@mastra/deployer-cloud 1.22.0-alpha.3 → 1.22.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 (27) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/studio/assets/{chunk-ZCJMLMGS-ChkoOBr-.js → chunk-ZCJMLMGS-DEMO6dGG.js} +1 -1
  3. package/dist/studio/assets/{index-ConrIlCh.js → index-A6BM34y5.js} +1 -1
  4. package/dist/studio/assets/{index-GGZc1rgO.js → index-BKTzGG4p.js} +1 -1
  5. package/dist/studio/assets/{index-DIk-Df0w.js → index-BPemyi6g.js} +1 -1
  6. package/dist/studio/assets/{index-Cd7ClifW.js → index-BUnkWoXT.js} +1 -1
  7. package/dist/studio/assets/{index-Djhf3-ic.js → index-BXjRHfo-.js} +1 -1
  8. package/dist/studio/assets/{index-DDzr7qHk.js → index-CqFevvQD.js} +1 -1
  9. package/dist/studio/assets/{index-Dnw78T8L.js → index-CruFxrCd.js} +1 -1
  10. package/dist/studio/assets/{index-B9VpmN2j.js → index-Ctec_dQM.js} +1 -1
  11. package/dist/studio/assets/{index-CUDvBsCF.js → index-D7lI9l4L.js} +1 -1
  12. package/dist/studio/assets/{index-CnoRB-yV.js → index-DBupw5JA.js} +1 -1
  13. package/dist/studio/assets/{index-BaCdlFvi.js → index-DO0qbHHx.js} +1 -1
  14. package/dist/studio/assets/{index-CAbGyzXh.js → index-DeqfI74y.js} +1 -1
  15. package/dist/studio/assets/{index-CKPkchMA.js → index-OQrGdguO.js} +1 -1
  16. package/dist/studio/assets/{index-bwsryY_u.js → index-RGPs7l8u.js} +1 -1
  17. package/dist/studio/assets/{index-CZ_EwzA3.js → index-VQvZ6bsp.js} +1 -1
  18. package/dist/studio/assets/{index-BKR8hODK.js → index-WQkYemkV.js} +1 -1
  19. package/dist/studio/assets/{index-RXNdBMiI.js → index-_39yLwv_.js} +1 -1
  20. package/dist/studio/assets/{index-BCrK0wTI.js → index-owoDuiWJ.js} +1 -1
  21. package/dist/studio/assets/{main-BYXq9N6a.js → main-DFV88sVi.js} +6 -6
  22. package/dist/studio/assets/{token-APYSY3BW-RPVF55TR-BQykn_y0.js → token-APYSY3BW-RPVF55TR--EWcY1p0.js} +1 -1
  23. package/dist/studio/assets/token-util-RMHT2CPJ-VVUHOXBL-DqSDvrq5.js +1 -0
  24. package/dist/studio/index.html +1 -1
  25. package/package.json +6 -6
  26. package/versions.json +1 -1
  27. package/dist/studio/assets/token-util-RMHT2CPJ-VVUHOXBL-DOZAKrB0.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./token-util-RMHT2CPJ-VVUHOXBL-DOZAKrB0.js","./chunk-ZCJMLMGS-ChkoOBr-.js","./index-BKR8hODK.js","./token-APYSY3BW-RPVF55TR-BQykn_y0.js","./index-GGZc1rgO.js","./index-BCrK0wTI.js","./index-Cd7ClifW.js","./index-CZ_EwzA3.js","./index-CUDvBsCF.js","./index-CKPkchMA.js","./index-CnoRB-yV.js","./index-Djhf3-ic.js","./index-bwsryY_u.js","./index-BaCdlFvi.js","./index-Dnw78T8L.js","./index-B9VpmN2j.js","./index-DIk-Df0w.js","./index-CAbGyzXh.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-RXNdBMiI.js","./index-ConrIlCh.js","./index-DDzr7qHk.js"])))=>i.map(i=>d[i]);
2
- import{_ as We}from"./index-BKR8hODK.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 l$=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 CB={exports:{}},VE={};var Yxe;function x_t(){if(Yxe)return VE;Yxe=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 VE.Fragment=t,VE.jsx=n,VE.jsxs=n,VE}var Xxe;function w_t(){return Xxe||(Xxe=1,CB.exports=x_t()),CB.exports}var l=w_t(),jB={exports:{}},dr={},Kxe;function S_t(){if(Kxe)return dr;Kxe=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,x={};function w(B,R,Q){this.props=B,this.context=R,this.refs=x,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=x,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 M(B,R){return I(B.type,R,B.props)}function P(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 q(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,te){var oe=typeof B;(oe==="undefined"||oe==="boolean")&&(B=null);var re=!1;if(B===null)re=!0;else switch(oe){case"bigint":case"string":case"number":re=!0;break;case"object":switch(B.$$typeof){case t:case n:re=!0;break;case f:return re=B._init,z(re(B._payload),R,Q,G,te)}}if(re)return te=te(B),re=G===""?"."+U(B,0):G,C(te)?(Q="",re!=null&&(Q=re.replace(D,"$&/")+"/"),z(te,R,Q,"",function(me){return me})):te!=null&&(P(te)&&(te=M(te,Q+(te.key==null||B&&B.key===te.key?"":(""+te.key).replace(D,"$&/")+"/")+re)),R.push(te)),1;re=0;var se=G===""?".":G+":";if(C(B))for(var ue=0;ue<B.length;ue++)G=B[ue],oe=se+U(G,ue),re+=z(G,R,Q,oe,te);else if(ue=m(B),typeof ue=="function")for(B=ue.call(B),ue=0;!(G=B.next()).done;)G=G.value,oe=se+U(G,ue++),re+=z(G,R,Q,oe,te);else if(oe==="object"){if(typeof B.then=="function")return z(q(B),R,Q,G,te);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 re}function V(B,R,Q){if(B==null)return B;var G=[],te=0;return z(B,G,"","",function(oe){return R.call(Q,oe,te++)}),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:V,forEach:function(B,R,Q){V(B,function(){R.apply(this,arguments)},Q)},count:function(B){var R=0;return V(B,function(){R++}),R},toArray:function(B){return V(B,function(R){return R})||[]},only:function(B){if(!P(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return dr.Activity=p,dr.Children=Z,dr.Component=w,dr.Fragment=r,dr.Profiler=s,dr.PureComponent=k,dr.StrictMode=a,dr.Suspense=u,dr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,dr.__COMPILER_RUNTIME={__proto__:null,c:function(B){return j.H.useMemoCache(B)}},dr.cache=function(B){return function(){return B.apply(null,arguments)}},dr.cacheSignal=function(){return null},dr.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),te=B.key;if(R!=null)for(oe in R.key!==void 0&&(te=""+R.key),R)!A.call(R,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&R.ref===void 0||(G[oe]=R[oe]);var oe=arguments.length-2;if(oe===1)G.children=Q;else if(1<oe){for(var re=Array(oe),se=0;se<oe;se++)re[se]=arguments[se+2];G.children=re}return I(B.type,te,G)},dr.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},dr.createElement=function(B,R,Q){var G,te={},oe=null;if(R!=null)for(G in R.key!==void 0&&(oe=""+R.key),R)A.call(R,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(te[G]=R[G]);var re=arguments.length-2;if(re===1)te.children=Q;else if(1<re){for(var se=Array(re),ue=0;ue<re;ue++)se[ue]=arguments[ue+2];te.children=se}if(B&&B.defaultProps)for(G in re=B.defaultProps,re)te[G]===void 0&&(te[G]=re[G]);return I(B,oe,te)},dr.createRef=function(){return{current:null}},dr.forwardRef=function(B){return{$$typeof:c,render:B}},dr.isValidElement=P,dr.lazy=function(B){return{$$typeof:f,_payload:{_status:-1,_result:B},_init:W}},dr.memo=function(B,R){return{$$typeof:d,type:B,compare:R===void 0?null:R}},dr.startTransition=function(B){var R=j.T,Q={};j.T=Q;try{var G=B(),te=j.S;te!==null&&te(Q,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,$)}catch(oe){$(oe)}finally{R!==null&&Q.types!==null&&(R.types=Q.types),j.T=R}},dr.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},dr.use=function(B){return j.H.use(B)},dr.useActionState=function(B,R,Q){return j.H.useActionState(B,R,Q)},dr.useCallback=function(B,R){return j.H.useCallback(B,R)},dr.useContext=function(B){return j.H.useContext(B)},dr.useDebugValue=function(){},dr.useDeferredValue=function(B,R){return j.H.useDeferredValue(B,R)},dr.useEffect=function(B,R){return j.H.useEffect(B,R)},dr.useEffectEvent=function(B){return j.H.useEffectEvent(B)},dr.useId=function(){return j.H.useId()},dr.useImperativeHandle=function(B,R,Q){return j.H.useImperativeHandle(B,R,Q)},dr.useInsertionEffect=function(B,R){return j.H.useInsertionEffect(B,R)},dr.useLayoutEffect=function(B,R){return j.H.useLayoutEffect(B,R)},dr.useMemo=function(B,R){return j.H.useMemo(B,R)},dr.useOptimistic=function(B,R){return j.H.useOptimistic(B,R)},dr.useReducer=function(B,R,Q){return j.H.useReducer(B,R,Q)},dr.useRef=function(B){return j.H.useRef(B)},dr.useState=function(B){return j.H.useState(B)},dr.useSyncExternalStore=function(B,R,Q){return j.H.useSyncExternalStore(B,R,Q)},dr.useTransition=function(){return j.H.useTransition()},dr.version="19.2.4",dr}var Jxe;function e_(){return Jxe||(Jxe=1,jB.exports=S_t()),jB.exports}var b=e_();const je=fo(b),Cw=S8e({__proto__:null,default:je},[b]);var TB={exports:{}},HE={},NB={exports:{}},AB={};var e0e;function O_t(){return e0e||(e0e=1,(function(e){function t(q,z){var V=q.length;q.push(z);e:for(;0<V;){var W=V-1>>>1,$=q[W];if(0<a($,z))q[W]=z,q[V]=$,V=W;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var z=q[0],V=q.pop();if(V!==z){q[0]=V;e:for(var W=0,$=q.length,Z=$>>>1;W<Z;){var B=2*(W+1)-1,R=q[B],Q=B+1,G=q[Q];if(0>a(R,V))Q<$&&0>a(G,R)?(q[W]=G,q[Q]=V,W=Q):(q[W]=R,q[B]=V,W=B);else if(Q<$&&0>a(G,V))q[W]=G,q[Q]=V,W=Q;else break e}}return z}function a(q,z){var V=q.sortIndex-z.sortIndex;return V!==0?V:q.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,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function k(q){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=q)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function _(q){if(g=!1,k(q),!m)if(n(c)!==null)m=!0,C||(C=!0,P());else{var z=n(u);z!==null&&U(_,z.startTime-q)}}var C=!1,T=-1,j=5,A=-1;function I(){return v?!0:!(e.unstable_now()-A<j)}function M(){if(v=!1,C){var q=e.unstable_now();A=q;var z=!0;try{e:{m=!1,g&&(g=!1,w(T),T=-1),h=!0;var V=p;try{t:{for(k(q),f=n(c);f!==null&&!(f.expirationTime>q&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,p=f.priorityLevel;var $=W(f.expirationTime<=q);if(q=e.unstable_now(),typeof $=="function"){f.callback=$,k(q),z=!0;break t}f===n(c)&&r(c),k(q)}else r(c);f=n(c)}if(f!==null)z=!0;else{var Z=n(u);Z!==null&&U(_,Z.startTime-q),z=!1}}break e}finally{f=null,p=V,h=!1}z=void 0}}finally{z?P():C=!1}}}var P;if(typeof O=="function")P=function(){O(M)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,D=F.port2;F.port1.onmessage=M,P=function(){D.postMessage(null)}}else P=function(){x(M,0)};function U(q,z){T=x(function(){q(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(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_next=function(q){switch(p){case 1:case 2:case 3:var z=3;break;default:z=p}var V=p;p=z;try{return q()}finally{p=V}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(q,z){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var V=p;p=q;try{return z()}finally{p=V}},e.unstable_scheduleCallback=function(q,z,V){var W=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?W+V:W):V=W,q){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=V+$,q={id:d++,callback:z,priorityLevel:q,startTime:V,expirationTime:$,sortIndex:-1},V>W?(q.sortIndex=V,t(u,q),n(c)===null&&q===n(u)&&(g?(w(T),T=-1):g=!0,U(_,V-W))):(q.sortIndex=$,t(c,q),m||h||(m=!0,C||(C=!0,P()))),q},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(q){var z=p;return function(){var V=p;p=z;try{return q.apply(this,arguments)}finally{p=V}}}})(AB)),AB}var t0e;function k_t(){return t0e||(t0e=1,NB.exports=O_t()),NB.exports}var IB={exports:{}},Nl={};var n0e;function __t(){if(n0e)return Nl;n0e=1;var e=e_();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 Nl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Nl.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)},Nl.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()}},Nl.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))},Nl.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},Nl.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})}},Nl.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)},Nl.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})}},Nl.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)},Nl.requestFormReset=function(c){r.d.r(c)},Nl.unstable_batchedUpdates=function(c,u){return c(u)},Nl.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},Nl.useFormStatus=function(){return i.H.useHostTransitionStatus()},Nl.version="19.2.4",Nl}var r0e;function O8e(){if(r0e)return IB.exports;r0e=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(),IB.exports=__t(),IB.exports}var a0e;function E_t(){if(a0e)return HE;a0e=1;var e={env:{}};var t=k_t(),n=e_(),r=O8e();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 H=L.alternate;if(H===null){if(N=L.return,N!==null){E=N;continue}break}if(L.child===H.child){for(H=L.child;H;){if(H===E)return u(L),y;if(H===N)return u(L),S;H=H.sibling}throw Error(a(188))}if(E.return!==N.return)E=L,N=H;else{for(var ee=!1,he=L.child;he;){if(he===E){ee=!0,E=L,N=H;break}if(he===N){ee=!0,N=L,E=H;break}he=he.sibling}if(!ee){for(he=H.child;he;){if(he===E){ee=!0,E=H,N=L;break}if(he===N){ee=!0,N=H,E=L;break}he=he.sibling}if(!ee)throw Error(a(189))}}if(E.alternate!==N)throw Error(a(190))}if(E.tag!==3)throw Error(a(188));return E.stateNode.current===E?y:S}function f(y){var S=y.tag;if(S===5||S===26||S===27||S===6)return y;for(y=y.child;y!==null;){if(S=f(y),S!==null)return S;y=y.sibling}return null}var p=Object.assign,h=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),M=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function F(y){return y===null||typeof y!="object"?null:(y=P&&y[P]||y["@@iterator"],typeof y=="function"?y:null)}var D=Symbol.for("react.client.reference");function U(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===D?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case v:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case C:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof y=="object")switch(y.$$typeof){case g:return"Portal";case k:return y.displayName||"Context";case O:return(y._context.displayName||"Context")+".Consumer";case _:var S=y.render;return y=y.displayName,y||(y=S.displayName||S.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case j:return S=y.displayName||null,S!==null?S:U(y.type)||"Memo";case A:S=y._payload,y=y._init;try{return U(y(S))}catch{}}return null}var q=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=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),te=B(null),oe=B(null),re=B(null);function se(y,S){switch(Q(oe,S),Q(te,y),Q(G,null),S.nodeType){case 9:case 11:y=(y=S.documentElement)&&(y=y.namespaceURI)?bxe(y):0;break;default:if(y=S.tagName,S=S.namespaceURI)S=bxe(S),y=xxe(S,y);else switch(y){case"svg":y=1;break;case"math":y=2;break;default:y=0}}R(G),Q(G,y)}function ue(){R(G),R(te),R(oe)}function me(y){y.memoizedState!==null&&Q(re,y);var S=G.current,E=xxe(S,y.type);S!==E&&(Q(te,y),Q(G,E))}function J(y){te.current===y&&(R(G),R(te)),re.current===y&&(R(re),zE._currentValue=W)}var ne,le;function be(y){if(ne===void 0)try{throw Error()}catch(E){var S=E.stack.trim().match(/\n( *(at )?)/);ne=S&&S[1]||"",le=-1<E.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./token-util-RMHT2CPJ-VVUHOXBL-DqSDvrq5.js","./chunk-ZCJMLMGS-DEMO6dGG.js","./index-WQkYemkV.js","./token-APYSY3BW-RPVF55TR--EWcY1p0.js","./index-BKTzGG4p.js","./index-owoDuiWJ.js","./index-BUnkWoXT.js","./index-VQvZ6bsp.js","./index-D7lI9l4L.js","./index-OQrGdguO.js","./index-DBupw5JA.js","./index-BXjRHfo-.js","./index-RGPs7l8u.js","./index-DO0qbHHx.js","./index-CruFxrCd.js","./index-Ctec_dQM.js","./index-BPemyi6g.js","./index-DeqfI74y.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-_39yLwv_.js","./index-A6BM34y5.js","./index-CqFevvQD.js"])))=>i.map(i=>d[i]);
2
+ import{_ as We}from"./index-WQkYemkV.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 l$=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 CB={exports:{}},VE={};var Yxe;function x_t(){if(Yxe)return VE;Yxe=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 VE.Fragment=t,VE.jsx=n,VE.jsxs=n,VE}var Xxe;function w_t(){return Xxe||(Xxe=1,CB.exports=x_t()),CB.exports}var l=w_t(),jB={exports:{}},dr={},Kxe;function S_t(){if(Kxe)return dr;Kxe=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,x={};function w(B,R,Q){this.props=B,this.context=R,this.refs=x,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=x,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 M(B,R){return I(B.type,R,B.props)}function P(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 q(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,te){var oe=typeof B;(oe==="undefined"||oe==="boolean")&&(B=null);var re=!1;if(B===null)re=!0;else switch(oe){case"bigint":case"string":case"number":re=!0;break;case"object":switch(B.$$typeof){case t:case n:re=!0;break;case f:return re=B._init,z(re(B._payload),R,Q,G,te)}}if(re)return te=te(B),re=G===""?"."+U(B,0):G,C(te)?(Q="",re!=null&&(Q=re.replace(D,"$&/")+"/"),z(te,R,Q,"",function(me){return me})):te!=null&&(P(te)&&(te=M(te,Q+(te.key==null||B&&B.key===te.key?"":(""+te.key).replace(D,"$&/")+"/")+re)),R.push(te)),1;re=0;var se=G===""?".":G+":";if(C(B))for(var ue=0;ue<B.length;ue++)G=B[ue],oe=se+U(G,ue),re+=z(G,R,Q,oe,te);else if(ue=m(B),typeof ue=="function")for(B=ue.call(B),ue=0;!(G=B.next()).done;)G=G.value,oe=se+U(G,ue++),re+=z(G,R,Q,oe,te);else if(oe==="object"){if(typeof B.then=="function")return z(q(B),R,Q,G,te);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 re}function V(B,R,Q){if(B==null)return B;var G=[],te=0;return z(B,G,"","",function(oe){return R.call(Q,oe,te++)}),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:V,forEach:function(B,R,Q){V(B,function(){R.apply(this,arguments)},Q)},count:function(B){var R=0;return V(B,function(){R++}),R},toArray:function(B){return V(B,function(R){return R})||[]},only:function(B){if(!P(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return dr.Activity=p,dr.Children=Z,dr.Component=w,dr.Fragment=r,dr.Profiler=s,dr.PureComponent=k,dr.StrictMode=a,dr.Suspense=u,dr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,dr.__COMPILER_RUNTIME={__proto__:null,c:function(B){return j.H.useMemoCache(B)}},dr.cache=function(B){return function(){return B.apply(null,arguments)}},dr.cacheSignal=function(){return null},dr.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),te=B.key;if(R!=null)for(oe in R.key!==void 0&&(te=""+R.key),R)!A.call(R,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&R.ref===void 0||(G[oe]=R[oe]);var oe=arguments.length-2;if(oe===1)G.children=Q;else if(1<oe){for(var re=Array(oe),se=0;se<oe;se++)re[se]=arguments[se+2];G.children=re}return I(B.type,te,G)},dr.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},dr.createElement=function(B,R,Q){var G,te={},oe=null;if(R!=null)for(G in R.key!==void 0&&(oe=""+R.key),R)A.call(R,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(te[G]=R[G]);var re=arguments.length-2;if(re===1)te.children=Q;else if(1<re){for(var se=Array(re),ue=0;ue<re;ue++)se[ue]=arguments[ue+2];te.children=se}if(B&&B.defaultProps)for(G in re=B.defaultProps,re)te[G]===void 0&&(te[G]=re[G]);return I(B,oe,te)},dr.createRef=function(){return{current:null}},dr.forwardRef=function(B){return{$$typeof:c,render:B}},dr.isValidElement=P,dr.lazy=function(B){return{$$typeof:f,_payload:{_status:-1,_result:B},_init:W}},dr.memo=function(B,R){return{$$typeof:d,type:B,compare:R===void 0?null:R}},dr.startTransition=function(B){var R=j.T,Q={};j.T=Q;try{var G=B(),te=j.S;te!==null&&te(Q,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,$)}catch(oe){$(oe)}finally{R!==null&&Q.types!==null&&(R.types=Q.types),j.T=R}},dr.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},dr.use=function(B){return j.H.use(B)},dr.useActionState=function(B,R,Q){return j.H.useActionState(B,R,Q)},dr.useCallback=function(B,R){return j.H.useCallback(B,R)},dr.useContext=function(B){return j.H.useContext(B)},dr.useDebugValue=function(){},dr.useDeferredValue=function(B,R){return j.H.useDeferredValue(B,R)},dr.useEffect=function(B,R){return j.H.useEffect(B,R)},dr.useEffectEvent=function(B){return j.H.useEffectEvent(B)},dr.useId=function(){return j.H.useId()},dr.useImperativeHandle=function(B,R,Q){return j.H.useImperativeHandle(B,R,Q)},dr.useInsertionEffect=function(B,R){return j.H.useInsertionEffect(B,R)},dr.useLayoutEffect=function(B,R){return j.H.useLayoutEffect(B,R)},dr.useMemo=function(B,R){return j.H.useMemo(B,R)},dr.useOptimistic=function(B,R){return j.H.useOptimistic(B,R)},dr.useReducer=function(B,R,Q){return j.H.useReducer(B,R,Q)},dr.useRef=function(B){return j.H.useRef(B)},dr.useState=function(B){return j.H.useState(B)},dr.useSyncExternalStore=function(B,R,Q){return j.H.useSyncExternalStore(B,R,Q)},dr.useTransition=function(){return j.H.useTransition()},dr.version="19.2.4",dr}var Jxe;function e_(){return Jxe||(Jxe=1,jB.exports=S_t()),jB.exports}var b=e_();const je=fo(b),Cw=S8e({__proto__:null,default:je},[b]);var TB={exports:{}},HE={},NB={exports:{}},AB={};var e0e;function O_t(){return e0e||(e0e=1,(function(e){function t(q,z){var V=q.length;q.push(z);e:for(;0<V;){var W=V-1>>>1,$=q[W];if(0<a($,z))q[W]=z,q[V]=$,V=W;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var z=q[0],V=q.pop();if(V!==z){q[0]=V;e:for(var W=0,$=q.length,Z=$>>>1;W<Z;){var B=2*(W+1)-1,R=q[B],Q=B+1,G=q[Q];if(0>a(R,V))Q<$&&0>a(G,R)?(q[W]=G,q[Q]=V,W=Q):(q[W]=R,q[B]=V,W=B);else if(Q<$&&0>a(G,V))q[W]=G,q[Q]=V,W=Q;else break e}}return z}function a(q,z){var V=q.sortIndex-z.sortIndex;return V!==0?V:q.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,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function k(q){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=q)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function _(q){if(g=!1,k(q),!m)if(n(c)!==null)m=!0,C||(C=!0,P());else{var z=n(u);z!==null&&U(_,z.startTime-q)}}var C=!1,T=-1,j=5,A=-1;function I(){return v?!0:!(e.unstable_now()-A<j)}function M(){if(v=!1,C){var q=e.unstable_now();A=q;var z=!0;try{e:{m=!1,g&&(g=!1,w(T),T=-1),h=!0;var V=p;try{t:{for(k(q),f=n(c);f!==null&&!(f.expirationTime>q&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,p=f.priorityLevel;var $=W(f.expirationTime<=q);if(q=e.unstable_now(),typeof $=="function"){f.callback=$,k(q),z=!0;break t}f===n(c)&&r(c),k(q)}else r(c);f=n(c)}if(f!==null)z=!0;else{var Z=n(u);Z!==null&&U(_,Z.startTime-q),z=!1}}break e}finally{f=null,p=V,h=!1}z=void 0}}finally{z?P():C=!1}}}var P;if(typeof O=="function")P=function(){O(M)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,D=F.port2;F.port1.onmessage=M,P=function(){D.postMessage(null)}}else P=function(){x(M,0)};function U(q,z){T=x(function(){q(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(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_next=function(q){switch(p){case 1:case 2:case 3:var z=3;break;default:z=p}var V=p;p=z;try{return q()}finally{p=V}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(q,z){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var V=p;p=q;try{return z()}finally{p=V}},e.unstable_scheduleCallback=function(q,z,V){var W=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?W+V:W):V=W,q){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=V+$,q={id:d++,callback:z,priorityLevel:q,startTime:V,expirationTime:$,sortIndex:-1},V>W?(q.sortIndex=V,t(u,q),n(c)===null&&q===n(u)&&(g?(w(T),T=-1):g=!0,U(_,V-W))):(q.sortIndex=$,t(c,q),m||h||(m=!0,C||(C=!0,P()))),q},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(q){var z=p;return function(){var V=p;p=z;try{return q.apply(this,arguments)}finally{p=V}}}})(AB)),AB}var t0e;function k_t(){return t0e||(t0e=1,NB.exports=O_t()),NB.exports}var IB={exports:{}},Nl={};var n0e;function __t(){if(n0e)return Nl;n0e=1;var e=e_();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 Nl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Nl.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)},Nl.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()}},Nl.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))},Nl.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},Nl.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})}},Nl.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)},Nl.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})}},Nl.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)},Nl.requestFormReset=function(c){r.d.r(c)},Nl.unstable_batchedUpdates=function(c,u){return c(u)},Nl.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},Nl.useFormStatus=function(){return i.H.useHostTransitionStatus()},Nl.version="19.2.4",Nl}var r0e;function O8e(){if(r0e)return IB.exports;r0e=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(),IB.exports=__t(),IB.exports}var a0e;function E_t(){if(a0e)return HE;a0e=1;var e={env:{}};var t=k_t(),n=e_(),r=O8e();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 H=L.alternate;if(H===null){if(N=L.return,N!==null){E=N;continue}break}if(L.child===H.child){for(H=L.child;H;){if(H===E)return u(L),y;if(H===N)return u(L),S;H=H.sibling}throw Error(a(188))}if(E.return!==N.return)E=L,N=H;else{for(var ee=!1,he=L.child;he;){if(he===E){ee=!0,E=L,N=H;break}if(he===N){ee=!0,N=L,E=H;break}he=he.sibling}if(!ee){for(he=H.child;he;){if(he===E){ee=!0,E=H,N=L;break}if(he===N){ee=!0,N=H,E=L;break}he=he.sibling}if(!ee)throw Error(a(189))}}if(E.alternate!==N)throw Error(a(190))}if(E.tag!==3)throw Error(a(188));return E.stateNode.current===E?y:S}function f(y){var S=y.tag;if(S===5||S===26||S===27||S===6)return y;for(y=y.child;y!==null;){if(S=f(y),S!==null)return S;y=y.sibling}return null}var p=Object.assign,h=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),M=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function F(y){return y===null||typeof y!="object"?null:(y=P&&y[P]||y["@@iterator"],typeof y=="function"?y:null)}var D=Symbol.for("react.client.reference");function U(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===D?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case v:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case C:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof y=="object")switch(y.$$typeof){case g:return"Portal";case k:return y.displayName||"Context";case O:return(y._context.displayName||"Context")+".Consumer";case _:var S=y.render;return y=y.displayName,y||(y=S.displayName||S.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case j:return S=y.displayName||null,S!==null?S:U(y.type)||"Memo";case A:S=y._payload,y=y._init;try{return U(y(S))}catch{}}return null}var q=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=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),te=B(null),oe=B(null),re=B(null);function se(y,S){switch(Q(oe,S),Q(te,y),Q(G,null),S.nodeType){case 9:case 11:y=(y=S.documentElement)&&(y=y.namespaceURI)?bxe(y):0;break;default:if(y=S.tagName,S=S.namespaceURI)S=bxe(S),y=xxe(S,y);else switch(y){case"svg":y=1;break;case"math":y=2;break;default:y=0}}R(G),Q(G,y)}function ue(){R(G),R(te),R(oe)}function me(y){y.memoizedState!==null&&Q(re,y);var S=G.current,E=xxe(S,y.type);S!==E&&(Q(te,y),Q(G,E))}function J(y){te.current===y&&(R(G),R(te)),re.current===y&&(R(re),zE._currentValue=W)}var ne,le;function be(y){if(ne===void 0)try{throw Error()}catch(E){var S=E.stack.trim().match(/\n( *(at )?)/);ne=S&&S[1]||"",le=-1<E.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<E.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+ne+y+le}var fe=!1;function ae(y,S){if(!y||fe)return"";fe=!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 qe=Xe}Reflect.construct(y,[],lt)}else{try{lt.call()}catch(Xe){qe=Xe}y.call(lt.prototype)}}else{try{throw Error()}catch(Xe){qe=Xe}(lt=y())&&typeof lt.catch=="function"&&lt.catch(function(){})}}catch(Xe){if(Xe&&qe&&typeof Xe.stack=="string")return[Xe.stack,qe.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 H=N.DetermineComponentFrameRoot(),ee=H[0],he=H[1];if(ee&&he){var Te=ee.split(`
5
5
  `),Be=he.split(`
@@ -56,7 +56,7 @@ Error message: ${rle(n)}`,cause:n}),this[M0e]=!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 FVe(e,t){var n,r,a,s,i,o;const c={type:"object",additionalProperties:(n=Ja(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}=LVe(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}=DVe(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function bNt(e,t){if(t.mapStrategy==="record")return FVe(e,t);const n=Ja(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Od(),r=Ja(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Od();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function xNt(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 wNt(){return{not:Od()}}function SNt(){return{type:"null"}}var qee={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ONt(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in qee&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((a,s)=>{const i=qee[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 kNt(e,t)}var kNt=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,a)=>Ja(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 _Nt(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[qee[e.innerType._def.typeName],"null"]};const n=Ja(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function ENt(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 CNt(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=TNt(o),u=Ja(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=jNt(e,t);return s!==void 0&&(n.additionalProperties=s),n}function jNt(e,t){if(e.catchall._def.typeName!=="ZodNever")return Ja(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 TNt(e){try{return e.isOptional()}catch{return!0}}var NNt=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return Ja(e.innerType._def,t);const r=Ja(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Od()},r]}:Od()},ANt=(e,t)=>{if(t.pipeStrategy==="input")return Ja(e.in._def,t);if(t.pipeStrategy==="output")return Ja(e.out._def,t);const n=Ja(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=Ja(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(a=>a!==void 0)}};function INt(e,t){return Ja(e.type._def,t)}function RNt(e,t){const r={type:"array",uniqueItems:!0,items:Ja(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 PNt(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>Ja(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Ja(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>Ja(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function MNt(){return{not:Od()}}function DNt(){return Od()}var $Nt=(e,t)=>Ja(e.innerType._def,t),LNt=(e,t,n)=>{switch(t){case Le.ZodString:return LVe(e,n);case Le.ZodNumber:return ENt(e);case Le.ZodObject:return CNt(e,n);case Le.ZodBigInt:return oNt(e);case Le.ZodBoolean:return lNt();case Le.ZodDate:return $Ve(e,n);case Le.ZodUndefined:return MNt();case Le.ZodNull:return SNt();case Le.ZodArray:return iNt(e,n);case Le.ZodUnion:case Le.ZodDiscriminatedUnion:return ONt(e,n);case Le.ZodIntersection:return mNt(e,n);case Le.ZodTuple:return PNt(e,n);case Le.ZodRecord:return FVe(e,n);case Le.ZodLiteral:return gNt(e);case Le.ZodEnum:return pNt(e);case Le.ZodNativeEnum:return xNt(e);case Le.ZodNullable:return _Nt(e,n);case Le.ZodOptional:return NNt(e,n);case Le.ZodMap:return bNt(e,n);case Le.ZodSet:return RNt(e,n);case Le.ZodLazy:return()=>e.getter()._def;case Le.ZodPromise:return INt(e,n);case Le.ZodNaN:case Le.ZodNever:return wNt();case Le.ZodEffects:return fNt(e,n);case Le.ZodAny:return Od();case Le.ZodUnknown:return DNt();case Le.ZodDefault:return dNt(e,n);case Le.ZodBranded:return DVe(e,n);case Le.ZodReadonly:return $Nt(e,n);case Le.ZodCatch:return cNt(e,n);case Le.ZodPipeline:return ANt(e,n);case Le.ZodFunction:case Le.ZodVoid:case Le.ZodSymbol:return;default:return(r=>{})()}};function Ja(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!==aNt)return c}if(a&&!n){const c=FNt(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=LNt(e,e.typeName,t),o=typeof i=="function"?Ja(i(),t):i;if(o&&zNt(e,t,o),t.postProcess){const c=t.postProcess(o,e,t);return s.jsonSchema=o,c}return s.jsonSchema=o,o}var FNt=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:rNt(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`),Od()):t.$refStrategy==="seen"?Od():void 0}},zNt=(e,t,n)=>(e.description&&(n.description=e.description),n),BNt=e=>{const t=sNt(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}]))}},UNt=(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=Ja(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?p:Od()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(n=Ja(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:Od(),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},qNt=UNt;function VNt(e,t){var n;const r=(n=void 0)!=null?n:!1;return sle(()=>qNt(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 HNt(e,t){var n;const r=(n=void 0)!=null?n:!1;return sle(()=>p2(VA(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async a=>{const s=await goe(e,a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function QNt(e){return"_zod"in e}function Hp(e,t){return QNt(e)?HNt(e):VNt(e)}var Vee=Symbol.for("vercel.ai.schema");function I5(e){let t;return()=>(t==null&&(t=e()),t)}function sle(e,{validate:t}={}){return{[Vee]:!0,_type:void 0,[S$]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function WNt(e){return typeof e=="object"&&e!==null&&Vee in e&&e[Vee]===!0&&"jsonSchema"in e&&"validate"in e}function GNt(e){return e==null?sle({properties:{},additionalProperties:!1}):WNt(e)?e:typeof e=="function"?e():Hp(e)}function ZNt(e){return e?.replace(/\/$/,"")}var YNt={},zVe=z3({"../../../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?.()??{}}}}),XNt=z3({"../../../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,x)=>{if(g&&typeof g=="object"||typeof g=="function")for(let w of a(g))!s.call(m,w)&&w!==v&&n(m,w,{get:()=>g[w],enumerable:!(x=r(g,w))||x.enumerable});return m},c=m=>o(n({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>h}),t.exports=c(u);var d=zVe(),f=P_t();async function p(){let m="",g;try{m=h()}catch(v){g=v}try{const[{getTokenPayload:v,isExpired:x},{refreshToken:w}]=await Promise.all([await We(()=>import("./token-util-RMHT2CPJ-VVUHOXBL-DOZAKrB0.js"),__vite__mapDeps([0,1,2]),import.meta.url),await We(()=>import("./token-APYSY3BW-RPVF55TR-BQykn_y0.js"),__vite__mapDeps([3,1,2]),import.meta.url)]);(!m||x(v(m)))&&(await w(),m=h())}catch(v){let x=g instanceof Error?g.message:"";throw v instanceof Error&&(x=`${x}
59
+ ]`;continue}s+=a[u],a[u]==="\\"?i=!0:o&&a[u]==="]"?o=!1:!o&&a[u]==="["&&(o=!0)}return s}function FVe(e,t){var n,r,a,s,i,o;const c={type:"object",additionalProperties:(n=Ja(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}=LVe(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}=DVe(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function bNt(e,t){if(t.mapStrategy==="record")return FVe(e,t);const n=Ja(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Od(),r=Ja(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Od();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function xNt(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 wNt(){return{not:Od()}}function SNt(){return{type:"null"}}var qee={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ONt(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in qee&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((a,s)=>{const i=qee[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 kNt(e,t)}var kNt=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,a)=>Ja(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 _Nt(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[qee[e.innerType._def.typeName],"null"]};const n=Ja(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function ENt(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 CNt(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=TNt(o),u=Ja(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=jNt(e,t);return s!==void 0&&(n.additionalProperties=s),n}function jNt(e,t){if(e.catchall._def.typeName!=="ZodNever")return Ja(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 TNt(e){try{return e.isOptional()}catch{return!0}}var NNt=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return Ja(e.innerType._def,t);const r=Ja(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Od()},r]}:Od()},ANt=(e,t)=>{if(t.pipeStrategy==="input")return Ja(e.in._def,t);if(t.pipeStrategy==="output")return Ja(e.out._def,t);const n=Ja(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=Ja(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(a=>a!==void 0)}};function INt(e,t){return Ja(e.type._def,t)}function RNt(e,t){const r={type:"array",uniqueItems:!0,items:Ja(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 PNt(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>Ja(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Ja(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>Ja(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function MNt(){return{not:Od()}}function DNt(){return Od()}var $Nt=(e,t)=>Ja(e.innerType._def,t),LNt=(e,t,n)=>{switch(t){case Le.ZodString:return LVe(e,n);case Le.ZodNumber:return ENt(e);case Le.ZodObject:return CNt(e,n);case Le.ZodBigInt:return oNt(e);case Le.ZodBoolean:return lNt();case Le.ZodDate:return $Ve(e,n);case Le.ZodUndefined:return MNt();case Le.ZodNull:return SNt();case Le.ZodArray:return iNt(e,n);case Le.ZodUnion:case Le.ZodDiscriminatedUnion:return ONt(e,n);case Le.ZodIntersection:return mNt(e,n);case Le.ZodTuple:return PNt(e,n);case Le.ZodRecord:return FVe(e,n);case Le.ZodLiteral:return gNt(e);case Le.ZodEnum:return pNt(e);case Le.ZodNativeEnum:return xNt(e);case Le.ZodNullable:return _Nt(e,n);case Le.ZodOptional:return NNt(e,n);case Le.ZodMap:return bNt(e,n);case Le.ZodSet:return RNt(e,n);case Le.ZodLazy:return()=>e.getter()._def;case Le.ZodPromise:return INt(e,n);case Le.ZodNaN:case Le.ZodNever:return wNt();case Le.ZodEffects:return fNt(e,n);case Le.ZodAny:return Od();case Le.ZodUnknown:return DNt();case Le.ZodDefault:return dNt(e,n);case Le.ZodBranded:return DVe(e,n);case Le.ZodReadonly:return $Nt(e,n);case Le.ZodCatch:return cNt(e,n);case Le.ZodPipeline:return ANt(e,n);case Le.ZodFunction:case Le.ZodVoid:case Le.ZodSymbol:return;default:return(r=>{})()}};function Ja(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!==aNt)return c}if(a&&!n){const c=FNt(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=LNt(e,e.typeName,t),o=typeof i=="function"?Ja(i(),t):i;if(o&&zNt(e,t,o),t.postProcess){const c=t.postProcess(o,e,t);return s.jsonSchema=o,c}return s.jsonSchema=o,o}var FNt=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:rNt(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`),Od()):t.$refStrategy==="seen"?Od():void 0}},zNt=(e,t,n)=>(e.description&&(n.description=e.description),n),BNt=e=>{const t=sNt(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}]))}},UNt=(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=Ja(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?p:Od()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(n=Ja(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:Od(),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},qNt=UNt;function VNt(e,t){var n;const r=(n=void 0)!=null?n:!1;return sle(()=>qNt(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 HNt(e,t){var n;const r=(n=void 0)!=null?n:!1;return sle(()=>p2(VA(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async a=>{const s=await goe(e,a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function QNt(e){return"_zod"in e}function Hp(e,t){return QNt(e)?HNt(e):VNt(e)}var Vee=Symbol.for("vercel.ai.schema");function I5(e){let t;return()=>(t==null&&(t=e()),t)}function sle(e,{validate:t}={}){return{[Vee]:!0,_type:void 0,[S$]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function WNt(e){return typeof e=="object"&&e!==null&&Vee in e&&e[Vee]===!0&&"jsonSchema"in e&&"validate"in e}function GNt(e){return e==null?sle({properties:{},additionalProperties:!1}):WNt(e)?e:typeof e=="function"?e():Hp(e)}function ZNt(e){return e?.replace(/\/$/,"")}var YNt={},zVe=z3({"../../../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?.()??{}}}}),XNt=z3({"../../../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,x)=>{if(g&&typeof g=="object"||typeof g=="function")for(let w of a(g))!s.call(m,w)&&w!==v&&n(m,w,{get:()=>g[w],enumerable:!(x=r(g,w))||x.enumerable});return m},c=m=>o(n({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>h}),t.exports=c(u);var d=zVe(),f=P_t();async function p(){let m="",g;try{m=h()}catch(v){g=v}try{const[{getTokenPayload:v,isExpired:x},{refreshToken:w}]=await Promise.all([await We(()=>import("./token-util-RMHT2CPJ-VVUHOXBL-DqSDvrq5.js"),__vite__mapDeps([0,1,2]),import.meta.url),await We(()=>import("./token-APYSY3BW-RPVF55TR--EWcY1p0.js"),__vite__mapDeps([3,1,2]),import.meta.url)]);(!m||x(v(m)))&&(await w(),m=h())}catch(v){let x=g instanceof Error?g.message:"";throw v instanceof Error&&(x=`${x}
60
60
  ${v.message}`),x?new f.VercelOidcTokenError(x):v}return m}function h(){const m=(0,d.getContext)().headers?.["x-vercel-oidc-token"]??YNt.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}}}),BVe=z3({"../../../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=XNt(),f=zVe()}}),KNt=E8e(BVe()),JNt=E8e(BVe()),eAt="vercel.ai.gateway.error",$B=Symbol.for(eAt),U0e,q0e,Cc=class UVe extends(q0e=Error,U0e=$B,q0e){constructor({message:t,statusCode:n=500,cause:r}){super(t),this[U0e]=!0,this.statusCode=n,this.cause=r}static isInstance(t){return UVe.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&$B in t&&t[$B]===!0}},qVe="GatewayAuthenticationError",tAt=`vercel.ai.gateway.error.${qVe}`,V0e=Symbol.for(tAt),H0e,Q0e,VVe=class HVe extends(Q0e=Cc,H0e=V0e,Q0e){constructor({message:t="Authentication failed",statusCode:n=401,cause:r}={}){super({message:t,statusCode:n,cause:r}),this[H0e]=!0,this.name=qVe,this.type="authentication_error"}static isInstance(t){return Cc.hasMarker(t)&&V0e 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"}),Xc('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Xc('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],oat=yde.concat([Xc("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Xc("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Xc("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),j_e=new utt,lat=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function sC(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const Oln=["FunctionDeclaration"],kln={FunctionDeclaration:sC("function"),ClassDeclaration:sC("class"),ClassExpression:()=>!0,EnumDeclaration:sC("constant"),TypeAliasDeclaration:sC("type"),NamespaceDeclaration:sC("namespace"),VariableDefinition(e,t){e.matchContext(Oln)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function cat(e,t){let n=j_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(Fa.IncludeAnonymous).iterate(i=>{if(a)a=!1;else if(i.name){let o=kln[i.name];if(o&&o(i,s)||lat.has(i.name))return!1}else if(i.to-i.from>8192){for(let o of cat(e,i.node))r.push(o);return!1}}),j_e.set(t,r),r}const TL=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,bde=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function uat(e){let t=ps(e.state).resolveInner(e.pos,-1);if(bde.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&TL.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let a=t;a;a=a.parent)lat.has(a.name)&&(r=r.concat(cat(e.state.doc,a)));return{options:r,from:n?t.from:e.pos,validFor:TL}}function xU(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 dat(e){let t=r=>e.state.doc.sliceString(r.from,r.to),n=ps(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?xU(t,n.parent,t(n)):(n.name=="."||n.name=="?.")&&n.parent.name=="MemberExpression"?xU(t,n.parent,""):bde.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&TL.test(t(n))?{path:[],name:t(n)}:n.name=="MemberExpression"?xU(t,n,""):e.explicit?{path:[],name:""}:null}function _ln(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 Eln(e){let t=new Map;return n=>{let r=dat(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=_ln(a,!r.path.length)),{from:n.pos-r.name.length,options:s,validFor:TL}}}const Af=X0.define({name:"javascript",parser:Sln.configure({props:[Ww.add({IfStatement:gO({except:/^\s*({|else\b)/}),TryStatement:gO({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:San,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:wan({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":gO({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}}),Gw.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Kue,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:"$"}}),fat={test:e=>/^JSX/.test(e.name),facet:nF({commentTokens:{block:{open:"{/*",close:"*/}"}}})},xde=Af.configure({dialect:"ts"},"typescript"),wde=Af.configure({dialect:"jsx",props:[Zue.add(e=>e.isTop?[fat]:void 0)]}),Sde=Af.configure({dialect:"jsx ts",props:[Zue.add(e=>e.isTop?[fat]:void 0)]},"typescript");let pat=e=>({label:e,type:"keyword"});const hat="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(pat),Cln=hat.concat(["declare","implements","private","protected","public"].map(pat));function NL(e={}){let t=e.jsx?e.typescript?Sde:wde:e.typescript?xde:Af,n=e.typescript?oat.concat(Cln):yde.concat(hat);return new J0(t,[Af.data.of({autocomplete:osn(bde,crt(n))}),Af.data.of({autocomplete:uat}),e.jsx?mat:[]])}function jln(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 T_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 Tln=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),mat=gt.inputHandler.of((e,t,n,r,a)=>{if((Tln?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Af.isActiveAt(e.state,t,-1))return!1;let s=a(),{state:i}=s,o=i.changeByRange(c=>{var u;let{head:d}=c,f=ps(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=T_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=jln(f);if(h&&h.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(p=T_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 Nln(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 Af.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(Aln(u,r.doc,c))}return a}}function N_e(e,t,n,r){return n.line(e+r.line).from+t+(e==1?r.col-1:-1)}function Aln(e,t,n){let r=N_e(e.line,e.column,t,n),a={from:r,to:e.endLine!=null&&e.endColumn!=1?N_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 qM=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:mat,completionPath:dat,esLint:Nln,javascript:NL,javascriptLanguage:Af,jsxLanguage:wde,localCompletionSource:uat,scopeCompletionSource:Eln,snippets:yde,tsxLanguage:Sde,typescriptLanguage:xde,typescriptSnippets:oat},Symbol.toStringTag,{value:"Module"})),iC=["_blank","_self","_top","_parent"],wU=["ascii","utf-8","utf-16","latin1","latin1"],SU=["get","post","put","delete"],OU=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Hu=["true","false"],jn={},Iln={a:{attrs:{href:null,ping:null,type:null,media:null,target:iC,hreflang:null}},abbr:jn,address:jn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:jn,aside:jn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:jn,base:{attrs:{href:null,target:iC}},bdi:jn,bdo:jn,blockquote:{attrs:{cite:null}},body:jn,br:jn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:OU,formmethod:SU,formnovalidate:["novalidate"],formtarget:iC,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:jn,center:jn,cite:jn,code:jn,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:jn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:jn,div:jn,dl:jn,dt:jn,em:jn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:jn,figure:jn,footer:jn,form:{attrs:{action:null,name:null,"accept-charset":wU,autocomplete:["on","off"],enctype:OU,method:SU,novalidate:["novalidate"],target:iC}},h1:jn,h2:jn,h3:jn,h4:jn,h5:jn,h6:jn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:jn,hgroup:jn,hr:jn,html:{attrs:{manifest:null}},i:jn,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:OU,formmethod:SU,formnovalidate:["novalidate"],formtarget:iC,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:jn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:jn,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:jn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:wU,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:jn,noscript:jn,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:jn,param:{attrs:{name:null,value:null}},pre:jn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:jn,rt:jn,ruby:jn,samp:jn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:wU}},section:jn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:jn,source:{attrs:{src:null,type:null,media:null}},span:jn,strong:jn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:jn,summary:jn,sup:jn,table:jn,tbody:jn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:jn,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:jn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:jn,time:{attrs:{datetime:null}},title:jn,tr:jn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:jn,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:jn},gat={accesskey:null,class:null,contenteditable:Hu,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:Hu,autocorrect:Hu,autocapitalize:Hu,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":Hu,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Hu,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Hu,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Hu,"aria-hidden":Hu,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Hu,"aria-multiselectable":Hu,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Hu,"aria-relevant":null,"aria-required":Hu,"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},vat="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 vat)gat[e]=null;let ON=class{constructor(t,n){this.tags={...Iln,...t},this.globalAttrs={...gat,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};ON.default=new ON;function mk(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 gk(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function yat(e,t,n){let r=n.tags[mk(e,gk(t))];return r?.children||n.allTags}function Ode(e,t){let n=[];for(let r=gk(t);r&&!r.type.isTop;r=gk(r.parent)){let a=mk(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 bat=/^[:\-\.\w\u00b7-\uffff]*$/;function A_e(e,t,n,r,a){let s=/\s*>/.test(e.sliceDoc(a,a+5))?"":">",i=gk(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:a,options:yat(e.doc,i,t).map(o=>({label:o,type:"type"})).concat(Ode(e.doc,n).map((o,c)=>({label:"/"+o,apply:"/"+o+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function I_e(e,t,n,r){let a=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:Ode(e.doc,t).map((s,i)=>({label:s,apply:s+a,type:"type",boost:99-i})),validFor:bat}}function Rln(e,t,n,r){let a=[],s=0;for(let i of yat(e.doc,n,t))a.push({label:"<"+i,type:"type"});for(let i of Ode(e.doc,n))a.push({label:"</"+i+">",type:"type",boost:99-s++});return{from:r,to:r,options:a,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Pln(e,t,n,r,a){let s=gk(n),i=s?t.tags[mk(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:bat}}function Mln(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=gk(n),p=f?t.tags[mk(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 xat(e,t){let{state:n,pos:r}=t,a=ps(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)?I_e(n,a,a.from,r):A_e(n,e,a,a.from,r):a.name=="StartTag"||a.name=="IncompleteTag"?A_e(n,e,a,r,r):a.name=="StartCloseTag"||a.name=="IncompleteCloseTag"?I_e(n,a,r,r):a.name=="OpenTag"||a.name=="SelfClosingTag"||a.name=="AttributeName"?Pln(n,e,a,a.name=="AttributeName"?a.from:r,r):a.name=="Is"||a.name=="AttributeValue"||a.name=="UnquotedAttributeValue"?Mln(n,e,a,a.name=="Is"?r:a.from,r):t.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?Rln(n,e,a,r):null}function wat(e){return xat(ON.default,e)}function Sat(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new ON(t,n):ON.default;return a=>xat(r,a)}const Dln=Af.parser.configure({top:"SingleExpression"}),Oat=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:xde.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:wde.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Sde.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:Dln},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Af.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:SN.parser}],kat=[{name:"style",parser:SN.parser.configure({top:"Styles"})}].concat(vat.map(e=>({name:e,parser:Af.parser}))),_at=X0.define({name:"html",parser:don.configure({props:[Ww.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}}),Gw.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}}}),nrt.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Zj=_at.configure({wrap:Xrt(Oat,kat)});function Eat(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=Xrt((e.nestedLanguages||[]).concat(Oat),(e.nestedAttributes||[]).concat(kat)));let r=n?_at.configure({wrap:n,dialect:t}):t?Zj.configure({dialect:t}):Zj;return new J0(r,[Zj.data.of({autocomplete:Sat(e)}),e.autoCloseTags!==!1?Cat:[],NL().support,sat().support])}const R_e=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Cat=gt.inputHandler.of((e,t,n,r,a)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Zj.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=ps(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=mk(i.doc,v.parent,h))&&!R_e.has(g)){let x=h+(i.doc.sliceString(h,h+1)===">"?1:0),w=`</${g}>`;return{range:c,changes:{from:h,to:x,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=mk(i.doc,v,h))&&!R_e.has(g)){let x=h+(i.doc.sliceString(h,h+1)===">"?1:0),w=`${g}>`;return{range:nt.cursor(h+w.length,-1),changes:{from:h,to:x,insert:w}}}}return{range:c}});return o.changes.empty?!1:(e.dispatch([s,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),$ln=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:Cat,html:Eat,htmlCompletionSource:wat,htmlCompletionSourceWith:Sat,htmlLanguage:Zj},Symbol.toStringTag,{value:"Module"})),jat=nF({commentTokens:{block:{open:"<!--",close:"-->"}}}),Tat=new lr,Nat=pin.configure({props:[Gw.add(e=>!e.is("Block")||e.is("Document")||Hne(e)!=null||Lln(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),Tat.add(Hne),Ww.add({Document:()=>null}),zy.add({Document:jat})]});function Hne(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function Lln(e){return e.name=="OrderedList"||e.name=="BulletList"}function Fln(e,t){let n=e;for(;;){let r=n.nextSibling,a;if(!r||(a=Hne(r.type))!=null&&a<=t)break;n=r}return n.to}const zln=Vnt.of((e,t,n)=>{for(let r=ps(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let a=r.type.prop(Tat);if(a==null)continue;let s=Fln(r,a);if(s>n)return{from:n,to:s}}return null});function kde(e){return new cd(jat,e,[],"markdown")}const Aat=kde(Nat),Bln=Nat.configure([kin,Ein,_in,Cin,{props:[Gw.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),nw=kde(Bln);function Uln(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:K0.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}class kU{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(+Rat(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function Iat(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 kU(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 kU(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 kU(s.parent,c,c+d,i[1],u,f,s))}}return r}function Rat(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function _U(e,t,n,r=0){for(let a=-1,s=e;;){if(s.name=="ListItem"){let o=Rat(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 _de(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(O_)!=" ")return e;let r=Dp(e,4,n),a="";for(let s=r;s>0;)s>=4?(a+=" ",s-=4):(a+=" ",s--);return a+e.slice(n)}const Pat=(e={})=>({state:t,dispatch:n})=>{let r=ps(t),{doc:a}=t,s=null,i=t.changeByRange(o=>{if(!o.empty||!nw.isActiveAt(t,o.from,-1)&&!nw.isActiveAt(t,o.from,1))return s={range:o};let c=o.from,u=a.lineAt(c),d=Iat(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 x=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(x.to>=c||w&&w.to<c||u.from>0&&!/[^\s>]/.test(a.lineAt(u.from-1).text)||e.nonTightLists===!1){let O=d.length>1?d[d.length-2]:null,k,_="";O&&O.item?(k=u.from+O.from,_=O.marker(a,1)):k=u.from+(O?O.to:0);let C=[{from:k,to:c,insert:_}];return f.node.name=="OrderedList"&&_U(f.item,a,C,-2),O&&O.node.name=="OrderedList"&&_U(O.item,a,C),{range:nt.cursor(k+_.length),changes:C}}else{let O=M_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 x=a.lineAt(u.from-1),w=/>\s*$/.exec(x.text);if(w&&w.index==f.from){let O=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:o.map(O),changes:O}}}let h=[];f.node.name=="OrderedList"&&_U(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 x=0,w=d.length-1;x<=w;x++)g+=x==w&&!m?d[x].marker(a,1):d[x].blank(x<w?Dp(u.text,4,d[x+1].from)-g.length:null);let v=c;for(;v>u.from&&/\s/.test(u.text.charAt(v-u.from-1));)v--;return g=_de(g,t),qln(f.node,t.doc)&&(g=M_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)},Mat=Pat();function P_e(e){return e.name=="QuoteMark"||e.name=="ListMark"}function qln(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 M_e(e,t,n){let r="";for(let a=0,s=e.length-2;a<=s;a++)r+=e[a].blank(a<s?Dp(n.text,4,e[a+1].from)-r.length:null,a<s);return _de(r,t)}function Vln(e,t){let n=e.resolveInner(t,-1),r=t;P_e(n)&&(r=n.from,n=n.parent);for(let a;a=n.childBefore(r);)if(P_e(a))r=a.from;else if(a.name=="OrderedList"||a.name=="BulletList")n=a.lastChild,r=n.to;else break;return n}const Dat=({state:e,dispatch:t})=>{let n=ps(e),r=null,a=e.changeByRange(s=>{let i=s.from,{doc:o}=e;if(s.empty&&nw.isActiveAt(e,s.from)){let c=o.lineAt(i),u=Iat(Vln(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(Dp(c.text,4,d.to)-Dp(c.text,4,d.from));return p==c.from&&(h=_de(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)},$at=[{key:"Enter",run:Mat},{key:"Backspace",run:Dat}],Lat=Eat({matchClosingTags:!1});function Ede(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:a}=Aat,completeHTMLTags:s=!0,pasteURLAsLink:i=!0,htmlTagLanguage:o=Lat}=e;if(!(a instanceof oF))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[o.support,zln],d;i&&u.push(Fat),n instanceof J0?(u.push(n.support),d=n.language):n&&(d=n);let f=t||d?Uln(t,d):void 0;c.push(min({codeParser:f,htmlParser:o.language.parser})),r&&u.push(Gp.high(S_.of($at)));let p=kde(a.configure(c));return s&&u.push(p.data.of({autocomplete:Hln})),new J0(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=ps(t).resolveInner(n,-1);for(;a&&!a.type.isTop;){if(a.name=="CodeBlock"||a.name=="FencedCode"||a.name=="ProcessingInstructionBlock"||a.name=="CommentBlock"||a.name=="Link"||a.name=="Image")return null;a=a.parent}return{from:n-r[0].length,to:n,options:Qln(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let EU=null;function Qln(){if(EU)return EU;let e=wat(new nde(Dr.create({extensions:Lat}),0,!0));return EU=e?e.options:[]}const Wln=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Fat=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),!nw.isActiveAt(t.state,r.from,1)))return!1;let s=ps(t.state),i=!1;return s.iterate({from:r.from,to:r.to,enter:o=>{(o.from>r.from||Wln.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)}}),Gln=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:Aat,deleteMarkupBackward:Dat,insertNewlineContinueMarkup:Mat,insertNewlineContinueMarkupCommand:Pat,markdown:Ede,markdownKeymap:$at,markdownLanguage:nw,pasteURLAsLink:Fat},Symbol.toStringTag,{value:"Module"}));function pt(e){return new J0(Jue.define(e))}function dy(e){return We(()=>import("./index-GGZc1rgO.js"),__vite__mapDeps([4,2]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const zat=[Ve.of({name:"C",extensions:["c","h","ino"],load(){return We(()=>import("./index-BCrK0wTI.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-BCrK0wTI.js"),__vite__mapDeps([5,2]),import.meta.url).then(e=>e.cpp())}}),Ve.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return dy("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-Cd7ClifW.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(()=>$ln),void 0,import.meta.url).then(e=>e.html())}}),Ve.of({name:"Java",extensions:["java"],load(){return We(()=>import("./index-CZ_EwzA3.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(()=>qM),void 0,import.meta.url).then(e=>e.javascript())}}),Ve.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return We(()=>import("./index-CUDvBsCF.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(()=>ssn),void 0,import.meta.url).then(e=>e.json())}}),Ve.of({name:"JSX",extensions:["jsx"],load(){return We(()=>Promise.resolve().then(()=>qM),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ve.of({name:"LESS",extensions:["less"],load(){return We(()=>import("./index-CKPkchMA.js"),__vite__mapDeps([9,2]),import.meta.url).then(e=>e.less())}}),Ve.of({name:"Liquid",extensions:["liquid"],load(){return We(()=>import("./index-CnoRB-yV.js"),__vite__mapDeps([10,2]),import.meta.url).then(e=>e.liquid())}}),Ve.of({name:"MariaDB SQL",load(){return dy("MariaSQL")}}),Ve.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return We(()=>Promise.resolve().then(()=>Gln),void 0,import.meta.url).then(e=>e.markdown())}}),Ve.of({name:"MS SQL",load(){return dy("MSSQL")}}),Ve.of({name:"MySQL",load(){return dy("MySQL")}}),Ve.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return We(()=>import("./index-Djhf3-ic.js"),__vite__mapDeps([11,2]),import.meta.url).then(e=>e.php())}}),Ve.of({name:"PLSQL",extensions:["pls"],load(){return dy("PLSQL")}}),Ve.of({name:"PostgreSQL",load(){return dy("PostgreSQL")}}),Ve.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return We(()=>import("./index-bwsryY_u.js"),__vite__mapDeps([12,2]),import.meta.url).then(e=>e.python())}}),Ve.of({name:"Rust",extensions:["rs"],load(){return We(()=>import("./index-BaCdlFvi.js"),__vite__mapDeps([13,2]),import.meta.url).then(e=>e.rust())}}),Ve.of({name:"Sass",extensions:["sass"],load(){return We(()=>import("./index-Dnw78T8L.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-Dnw78T8L.js"),__vite__mapDeps([14,2]),import.meta.url).then(e=>e.sass())}}),Ve.of({name:"SQL",extensions:["sql"],load(){return dy("StandardSQL")}}),Ve.of({name:"SQLite",load(){return dy("SQLite")}}),Ve.of({name:"TSX",extensions:["tsx"],load(){return We(()=>Promise.resolve().then(()=>qM),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(()=>qM),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ve.of({name:"WebAssembly",extensions:["wat","wast"],load(){return We(()=>import("./index-B9VpmN2j.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-DIk-Df0w.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-CAbGyzXh.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-RXNdBMiI.js"),__vite__mapDeps([24,2]),import.meta.url).then(e=>e.vue())}}),Ve.of({name:"Angular Template",load(){return We(()=>import("./index-ConrIlCh.js"),__vite__mapDeps([25,2]),import.meta.url).then(e=>e.angular())}})];var Zln=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=Am.define(r),u=[o,Zw(c)];return u},Yln={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"}],PI=e=>{var{theme:t="dark",settings:n={},styles:r=[]}=e||{};return Zln({theme:t,settings:yb({},Yln,n),styles:[...Xln,...r]})};PI();const Kln=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=jde(e.state,n.from);return r.line?Jln(e):r.block?tcn(e):!1};function Cde(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 Jln=Cde(acn,0),ecn=Cde(Bat,0),tcn=Cde((e,t)=>Bat(e,t,rcn(t)),0);function jde(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const oC=50;function ncn(e,{open:t,close:n},r,a){let s=e.sliceDoc(r-oC,r),i=e.sliceDoc(a,a+oC),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*oC?d=f=e.sliceDoc(r,a):(d=e.sliceDoc(r,r+oC),f=e.sliceDoc(a-oC,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 rcn(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 Bat(e,t,n=t.selection.ranges){let r=n.map(s=>jde(t,s.from).block);if(!r.every(s=>s))return null;let a=n.map((s,i)=>ncn(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 acn(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=jde(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 Qne=Tm.define(),scn=Tm.define(),icn=Xt.define(),Uat=Xt.define({combine(e){return Nm(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)})}}),qat=ho.define({create(){return Yh.empty},update(e,t){let n=t.state.facet(Uat),r=t.annotation(Qne);if(r){let c=fu.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=AL(d,d.length,n.minDepth,c):d=Qat(d,t.startState.selection),new Yh(u==0?r.rest:d,u==0?d:r.rest)}let a=t.annotation(scn);if((a=="full"||a=="before")&&(e=e.isolate()),t.annotation(so.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=fu.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 Yh(e.done.map(fu.fromJSON),e.undone.map(fu.fromJSON))}});function ocn(e={}){return[qat,Uat.of(e),gt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?Vat:t.inputType=="historyRedo"?Wne:null;return r?(t.preventDefault(),r(n)):!1}})]}function lF(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let a=n.field(qat,!1);if(!a)return!1;let s=a.pop(e,n,t);return s?(r(s),!0):!1}}const Vat=lF(0,!1),Wne=lF(1,!1),lcn=lF(0,!0),ccn=lF(1,!0);class fu{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 fu(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 fu(t.changes&&to.fromJSON(t.changes),[],t.mapped&&rm.fromJSON(t.mapped),t.startSelection&&nt.fromJSON(t.startSelection),t.selectionsAfter.map(nt.fromJSON))}static fromTransaction(t,n){let r=Sf;for(let a of t.startState.facet(icn)){let s=a(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new fu(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Sf)}static selection(t){return new fu(void 0,Sf,void 0,void 0,t)}}function AL(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 ucn(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 dcn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function Hat(e,t){return e.length?t.length?e.concat(t):e:t}const Sf=[],fcn=200;function Qat(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-fcn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),AL(e,e.length-1,1e9,n.setSelAfter(r)))}else return[fu.selection([t])]}function pcn(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 CU(e,t){if(!e.length)return e;let n=e.length,r=Sf;for(;n;){let a=hcn(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?[fu.selection(r)]:Sf}function hcn(e,t,n){let r=Hat(e.selectionsAfter.length?e.selectionsAfter.map(o=>o.map(t)):Sf,n);if(!e.changes)return fu.selection(r);let a=e.changes.map(t),s=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(s):s;return new fu(a,Kn.mapEffects(e.effects,t),i,e.startSelection.map(s),r)}const mcn=/^(input\.type|delete)($|\.)/;class Yh{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 Yh(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||mcn.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime<a.newGroupDelay&&a.joinToEvent(s,ucn(o.changes,t.changes))||r=="input.type.compose")?i=AL(i,i.length-1,a.minDepth,new fu(t.changes.compose(o.changes),Hat(Kn.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,Sf)):i=AL(i,i.length,a.minDepth,t),new Yh(i,Sf,n,r)}addSelection(t,n,r,a){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Sf;return s.length>0&&n-this.prevTime<a&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&dcn(s[s.length-1],t)?this:new Yh(Qat(this.done,t),this.undone,n,r)}addMapping(t){return new Yh(CU(this.done,t),CU(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:Qne.of({side:t,rest:pcn(a),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let o=a.length==1?Sf:a.slice(0,a.length-1);return s.mapped&&(o=CU(o,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Qne.of({side:t,rest:o,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Yh.empty=new Yh(Sf,Sf);const gcn=[{key:"Mod-z",run:Vat,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Wne,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Wne,preventDefault:!0},{key:"Mod-u",run:lcn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ccn,preventDefault:!0}];function __(e,t){return nt.create(e.ranges.map(t),e.mainIndex)}function Zp(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Yp({state:e,dispatch:t},n){let r=__(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Zp(e,r)),!0)}function cF(e,t){return nt.cursor(t?e.to:e.from)}function Wat(e,t){return Yp(e,n=>n.empty?e.moveByChar(n,t):cF(n,t))}function tc(e){return e.textDirectionAt(e.state.selection.main.head)==xs.LTR}const Gat=e=>Wat(e,!tc(e)),Zat=e=>Wat(e,tc(e));function Yat(e,t){return Yp(e,n=>n.empty?e.moveByGroup(n,t):cF(n,t))}const vcn=e=>Yat(e,!tc(e)),ycn=e=>Yat(e,tc(e));function bcn(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 uF(e,t,n){let r=ps(e).resolveInner(t.head),a=n?lr.closedBy:lr.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;bcn(e,u,a)?r=u:c=n?u.to:u.from}let s=r.type.prop(a),i,o;return s&&(i=n?Zh(e,r.from,1):Zh(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 xcn=e=>Yp(e,t=>uF(e.state,t,!tc(e))),wcn=e=>Yp(e,t=>uF(e.state,t,tc(e)));function Xat(e,t){return Yp(e,n=>{if(!n.empty)return cF(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Kat=e=>Xat(e,!1),Jat=e=>Xat(e,!0);function est(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 tst(e,t){let n=est(e),{state:r}=e,a=__(r.selection,i=>i.empty?e.moveVertically(i,t,n.height):cF(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(Zp(r,a),{effects:s}),!0}const D_e=e=>tst(e,!1),Gne=e=>tst(e,!0);function Hb(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 Scn=e=>Yp(e,t=>Hb(e,t,!0)),Ocn=e=>Yp(e,t=>Hb(e,t,!1)),kcn=e=>Yp(e,t=>Hb(e,t,!tc(e))),_cn=e=>Yp(e,t=>Hb(e,t,tc(e))),Ecn=e=>Yp(e,t=>nt.cursor(e.lineBlockAt(t.head).from,1)),Ccn=e=>Yp(e,t=>nt.cursor(e.lineBlockAt(t.head).to,-1));function jcn(e,t,n){let r=!1,a=__(e.selection,s=>{let i=Zh(e,s.head,-1)||Zh(e,s.head,1)||s.head>0&&Zh(e,s.head-1,1)||s.head<e.doc.length&&Zh(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(Zp(e,a)),!0):!1}const Tcn=({state:e,dispatch:t})=>jcn(e,t);function Gf(e,t){let n=__(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(Zp(e.state,n)),!0)}function nst(e,t){return Gf(e,n=>e.moveByChar(n,t))}const rst=e=>nst(e,!tc(e)),ast=e=>nst(e,tc(e));function sst(e,t){return Gf(e,n=>e.moveByGroup(n,t))}const Ncn=e=>sst(e,!tc(e)),Acn=e=>sst(e,tc(e)),Icn=e=>Gf(e,t=>uF(e.state,t,!tc(e))),Rcn=e=>Gf(e,t=>uF(e.state,t,tc(e)));function ist(e,t){return Gf(e,n=>e.moveVertically(n,t))}const ost=e=>ist(e,!1),lst=e=>ist(e,!0);function cst(e,t){return Gf(e,n=>e.moveVertically(n,t,est(e).height))}const $_e=e=>cst(e,!1),L_e=e=>cst(e,!0),Pcn=e=>Gf(e,t=>Hb(e,t,!0)),Mcn=e=>Gf(e,t=>Hb(e,t,!1)),Dcn=e=>Gf(e,t=>Hb(e,t,!tc(e))),$cn=e=>Gf(e,t=>Hb(e,t,tc(e))),Lcn=e=>Gf(e,t=>nt.cursor(e.lineBlockAt(t.head).from)),Fcn=e=>Gf(e,t=>nt.cursor(e.lineBlockAt(t.head).to)),F_e=({state:e,dispatch:t})=>(t(Zp(e,{anchor:0})),!0),z_e=({state:e,dispatch:t})=>(t(Zp(e,{anchor:e.doc.length})),!0),B_e=({state:e,dispatch:t})=>(t(Zp(e,{anchor:e.selection.main.anchor,head:0})),!0),U_e=({state:e,dispatch:t})=>(t(Zp(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),zcn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Bcn=({state:e,dispatch:t})=>{let n=dF(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},Ucn=({state:e,dispatch:t})=>{let n=__(e.selection,r=>{let a=ps(e),s=a.resolveStack(r.from,1);if(r.empty){let i=a.resolveStack(r.from,-1);i.node.from>=s.node.from&&i.node.to<=s.node.to&&(s=i)}for(let i=s;i;i=i.next){let{node: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(Zp(e,n)),!0)};function ust(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(Zp(n,nt.create(a,a.length-1))),!0)}const qcn=e=>ust(e,!1),Vcn=e=>ust(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(Zp(e,r)),!0):!1};function MI(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=VM(e,c,!1)):c>i&&(n="delete.forward",c=VM(e,c,!0)),i=Math.min(i,c),o=Math.max(o,c)}else i=VM(e,i,!1),o=VM(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 VM(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 dst=(e,t,n)=>MI(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=Dp(o,s.tabSize),d=u%ew(s)||ew(s);for(let f=0;f<d&&o[o.length-1-f]==" ";f++)a--;c=a}else c=Wo(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=Wo(i.text,c-i.from,!1,!1)+i.from);return c}),Zne=e=>dst(e,!1,!0),fst=e=>dst(e,!0,!1),pst=(e,t)=>MI(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=Wo(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}),hst=e=>pst(e,!1),Qcn=e=>pst(e,!0),Wcn=e=>MI(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Gcn=e=>MI(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Zcn=e=>MI(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Ycn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Ca.of(["",""])},range: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:Wo(s.text,a-s.from,!1)+s.from,o=a==s.to?a+1:Wo(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 dF(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 mst(e,t,n){if(e.readOnly)return!1;let r=[],a=[];for(let s of dF(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 Kcn=({state:e,dispatch:t})=>mst(e,t,!1),Jcn=({state:e,dispatch:t})=>mst(e,t,!0);function gst(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of dF(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 eun=({state:e,dispatch:t})=>gst(e,t,!1),tun=({state:e,dispatch:t})=>gst(e,t,!0),nun=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(dF(t).map(({from:a,to:s})=>(a>0?a--:s<t.doc.length&&s++,{from:a,to:s}))),r=__(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 run(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=ps(e).resolveInner(t),r=n.childBefore(t),a=n.childAfter(t),s;return r&&a&&r.to<=t&&a.from>=t&&(s=r.type.prop(lr.closedBy))&&s.indexOf(a.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(r.to,a.from))?{from:r.to,to:a.from}:null}const q_e=vst(!1),aun=vst(!0);function vst(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&&run(t,s);e&&(s=i=(i<=o.to?o:t.doc.lineAt(i)).to);let u=new rF(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=Yue(u,s);for(d==null&&(d=Dp(/^\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=["",hN(t,d)];return c&&f.push(hN(t,u.lineIndent(o.from,-1))),{changes:{from:s,to:i,insert:Ca.of(f)},range:nt.cursor(s+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Tde(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 sun=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new rF(e,{overrideIndentation:s=>{let i=n[s];return i??-1}}),a=Tde(e,(s,i,o)=>{let c=Yue(r,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=hN(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},yst=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Tde(e,(n,r)=>{r.push({from:n.from,insert:e.facet(O_)})}),{userEvent:"input.indent"})),!0),bst=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Tde(e,(n,r)=>{let a=/^\s*/.exec(n.text)[0];if(!a)return;let s=Dp(a,e.tabSize),i=0,o=hN(e,Math.max(0,s-ew(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),iun=e=>(e.setTabFocusMode(),!0),oun=[{key:"Ctrl-b",run:Gat,shift:rst,preventDefault:!0},{key:"Ctrl-f",run:Zat,shift:ast},{key:"Ctrl-p",run:Kat,shift:ost},{key:"Ctrl-n",run:Jat,shift:lst},{key:"Ctrl-a",run:Ecn,shift:Lcn},{key:"Ctrl-e",run:Ccn,shift:Fcn},{key:"Ctrl-d",run:fst},{key:"Ctrl-h",run:Zne},{key:"Ctrl-k",run:Wcn},{key:"Ctrl-Alt-h",run:hst},{key:"Ctrl-o",run:Ycn},{key:"Ctrl-t",run:Xcn},{key:"Ctrl-v",run:Gne}],lun=[{key:"ArrowLeft",run:Gat,shift:rst,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:vcn,shift:Ncn,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:kcn,shift:Dcn,preventDefault:!0},{key:"ArrowRight",run:Zat,shift:ast,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ycn,shift:Acn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:_cn,shift:$cn,preventDefault:!0},{key:"ArrowUp",run:Kat,shift:ost,preventDefault:!0},{mac:"Cmd-ArrowUp",run:F_e,shift:B_e},{mac:"Ctrl-ArrowUp",run:D_e,shift:$_e},{key:"ArrowDown",run:Jat,shift:lst,preventDefault:!0},{mac:"Cmd-ArrowDown",run:z_e,shift:U_e},{mac:"Ctrl-ArrowDown",run:Gne,shift:L_e},{key:"PageUp",run:D_e,shift:$_e},{key:"PageDown",run:Gne,shift:L_e},{key:"Home",run:Ocn,shift:Mcn,preventDefault:!0},{key:"Mod-Home",run:F_e,shift:B_e},{key:"End",run:Scn,shift:Pcn,preventDefault:!0},{key:"Mod-End",run:z_e,shift:U_e},{key:"Enter",run:q_e,shift:q_e},{key:"Mod-a",run:zcn},{key:"Backspace",run:Zne,shift:Zne,preventDefault:!0},{key:"Delete",run:fst,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:hst,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Qcn,preventDefault:!0},{mac:"Mod-Backspace",run:Gcn,preventDefault:!0},{mac:"Mod-Delete",run:Zcn,preventDefault:!0}].concat(oun.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),cun=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:xcn,shift:Icn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:wcn,shift:Rcn},{key:"Alt-ArrowUp",run:Kcn},{key:"Shift-Alt-ArrowUp",run:eun},{key:"Alt-ArrowDown",run:Jcn},{key:"Shift-Alt-ArrowDown",run:tun},{key:"Mod-Alt-ArrowUp",run:qcn},{key:"Mod-Alt-ArrowDown",run:Vcn},{key:"Escape",run:Hcn},{key:"Mod-Enter",run:aun},{key:"Alt-l",mac:"Ctrl-l",run:Bcn},{key:"Mod-i",run:Ucn,preventDefault:!0},{key:"Mod-[",run:bst},{key:"Mod-]",run:yst},{key:"Mod-Alt-\\",run:sun},{key:"Shift-Mod-k",run:nun},{key:"Shift-Mod-\\",run:Tcn},{key:"Mod-/",run:Kln},{key:"Alt-A",run:ecn},{key:"Ctrl-m",mac:"Shift-Alt-m",run:iun}].concat(lun),uun={key:"Tab",run:yst,shift:bst},V_e=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class vk{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(V_e(o)):V_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 nu(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=Iue(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Dh(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"&&(vk.prototype[Symbol.iterator]=function(){return this});const xst={from:-1,to:-1,match:/.*/.exec("")},Nde="gm"+(/x/.unicode==null?"":"u");class wst{constructor(t,n,r,a=0,s=t.length){if(this.text=t,this.to=s,this.curLine="",this.done=!1,this.value=xst,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Sst(t,n,r,a,s);this.re=new RegExp(n,Nde+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=t.iter();let i=t.lineAt(a);this.curLineStart=i.from,this.matchPos=IL(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=IL(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 jU=new WeakMap;class yO{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let a=jU.get(t);if(!a||a.from>=r||a.to<=n){let o=new yO(n,t.sliceString(n,r));return jU.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)),jU.set(t,new yO(i,s)),new yO(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=xst,this.matchPos=IL(t,a),this.re=new RegExp(n,Nde+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=yO.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=IL(this.text,a+(r==a?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=yO.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(wst.prototype[Symbol.iterator]=Sst.prototype[Symbol.iterator]=function(){return this});function dun(e){try{return new RegExp(e,Nde),!0}catch{return!1}}function IL(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 Yne(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),n=ys("input",{class:"cm-textfield",name:"line",value:t}),r=ys("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),e.dispatch({effects:Yj.of(!1)}),e.focus()):s.keyCode==13&&(s.preventDefault(),a())},onsubmit:s=>{s.preventDefault(),a()}},ys("label",e.state.phrase("Go to line"),": ",n)," ",ys("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),ys("button",{name:"close",onclick:()=>{e.dispatch({effects:Yj.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:[Yj.of(!1),gt.scrollIntoView(g.from,{y:"center"})],selection:g}),e.focus()}return{dom:r}}const Yj=Kn.define(),H_e=ho.define({create(){return!0},update(e,t){for(let n of t.effects)n.is(Yj)&&(e=n.value);return e},provide:e=>pN.from(e,t=>t?Yne:null)}),fun=e=>{let t=fN(e,Yne);if(!t){let n=[Yj.of(!0)];e.state.field(H_e,!1)==null&&n.push(Kn.appendConfig.of([H_e,pun])),e.dispatch({effects:n}),t=fN(e,Yne)}return t&&t.dom.querySelector("input").select(),!0},pun=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"}}}),hun={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},mun=Xt.define({combine(e){return Nm(e,hun,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function gun(e){return[wun,xun]}const vun=nn.mark({class:"cm-selectionMatch"}),yun=nn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Q_e(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=ai.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=ai.Word)}function bun(e,t,n,r){return e(t.sliceDoc(n,n+1))==ai.Word&&e(t.sliceDoc(r-1,r))==ai.Word}const xun=oi.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(mun),{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),!(Q_e(i,n,a.from,a.to)&&bun(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 vk(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||Q_e(i,n,d,f))&&(a.empty&&d<=a.from&&f>=a.to?o.push(yun.range(d,f)):(d>=a.to||f<=a.from)&&o.push(vun.range(d,f)),o.length>t.maxMatches))return nn.none}}return nn.set(o)}},{decorations:e=>e.decorations}),wun=gt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Sun=({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 Oun(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 vk(e.doc,t,r[r.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new vk(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 kun=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return Sun({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=Oun(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},E_=Xt.define({combine(e){return Nm(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Dun(t),scrollToMatch:t=>gt.scrollIntoView(t)})}});class Ost{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||dun(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"}),Xc('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Xc('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],oat=yde.concat([Xc("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Xc("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Xc("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),j_e=new utt,lat=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function sC(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const Oln=["FunctionDeclaration"],kln={FunctionDeclaration:sC("function"),ClassDeclaration:sC("class"),ClassExpression:()=>!0,EnumDeclaration:sC("constant"),TypeAliasDeclaration:sC("type"),NamespaceDeclaration:sC("namespace"),VariableDefinition(e,t){e.matchContext(Oln)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function cat(e,t){let n=j_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(Fa.IncludeAnonymous).iterate(i=>{if(a)a=!1;else if(i.name){let o=kln[i.name];if(o&&o(i,s)||lat.has(i.name))return!1}else if(i.to-i.from>8192){for(let o of cat(e,i.node))r.push(o);return!1}}),j_e.set(t,r),r}const TL=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,bde=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function uat(e){let t=ps(e.state).resolveInner(e.pos,-1);if(bde.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&TL.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let a=t;a;a=a.parent)lat.has(a.name)&&(r=r.concat(cat(e.state.doc,a)));return{options:r,from:n?t.from:e.pos,validFor:TL}}function xU(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 dat(e){let t=r=>e.state.doc.sliceString(r.from,r.to),n=ps(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?xU(t,n.parent,t(n)):(n.name=="."||n.name=="?.")&&n.parent.name=="MemberExpression"?xU(t,n.parent,""):bde.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&TL.test(t(n))?{path:[],name:t(n)}:n.name=="MemberExpression"?xU(t,n,""):e.explicit?{path:[],name:""}:null}function _ln(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 Eln(e){let t=new Map;return n=>{let r=dat(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=_ln(a,!r.path.length)),{from:n.pos-r.name.length,options:s,validFor:TL}}}const Af=X0.define({name:"javascript",parser:Sln.configure({props:[Ww.add({IfStatement:gO({except:/^\s*({|else\b)/}),TryStatement:gO({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:San,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:wan({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":gO({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}}),Gw.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Kue,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:"$"}}),fat={test:e=>/^JSX/.test(e.name),facet:nF({commentTokens:{block:{open:"{/*",close:"*/}"}}})},xde=Af.configure({dialect:"ts"},"typescript"),wde=Af.configure({dialect:"jsx",props:[Zue.add(e=>e.isTop?[fat]:void 0)]}),Sde=Af.configure({dialect:"jsx ts",props:[Zue.add(e=>e.isTop?[fat]:void 0)]},"typescript");let pat=e=>({label:e,type:"keyword"});const hat="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(pat),Cln=hat.concat(["declare","implements","private","protected","public"].map(pat));function NL(e={}){let t=e.jsx?e.typescript?Sde:wde:e.typescript?xde:Af,n=e.typescript?oat.concat(Cln):yde.concat(hat);return new J0(t,[Af.data.of({autocomplete:osn(bde,crt(n))}),Af.data.of({autocomplete:uat}),e.jsx?mat:[]])}function jln(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 T_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 Tln=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),mat=gt.inputHandler.of((e,t,n,r,a)=>{if((Tln?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Af.isActiveAt(e.state,t,-1))return!1;let s=a(),{state:i}=s,o=i.changeByRange(c=>{var u;let{head:d}=c,f=ps(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=T_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=jln(f);if(h&&h.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(p=T_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 Nln(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 Af.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(Aln(u,r.doc,c))}return a}}function N_e(e,t,n,r){return n.line(e+r.line).from+t+(e==1?r.col-1:-1)}function Aln(e,t,n){let r=N_e(e.line,e.column,t,n),a={from:r,to:e.endLine!=null&&e.endColumn!=1?N_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 qM=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:mat,completionPath:dat,esLint:Nln,javascript:NL,javascriptLanguage:Af,jsxLanguage:wde,localCompletionSource:uat,scopeCompletionSource:Eln,snippets:yde,tsxLanguage:Sde,typescriptLanguage:xde,typescriptSnippets:oat},Symbol.toStringTag,{value:"Module"})),iC=["_blank","_self","_top","_parent"],wU=["ascii","utf-8","utf-16","latin1","latin1"],SU=["get","post","put","delete"],OU=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Hu=["true","false"],jn={},Iln={a:{attrs:{href:null,ping:null,type:null,media:null,target:iC,hreflang:null}},abbr:jn,address:jn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:jn,aside:jn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:jn,base:{attrs:{href:null,target:iC}},bdi:jn,bdo:jn,blockquote:{attrs:{cite:null}},body:jn,br:jn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:OU,formmethod:SU,formnovalidate:["novalidate"],formtarget:iC,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:jn,center:jn,cite:jn,code:jn,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:jn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:jn,div:jn,dl:jn,dt:jn,em:jn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:jn,figure:jn,footer:jn,form:{attrs:{action:null,name:null,"accept-charset":wU,autocomplete:["on","off"],enctype:OU,method:SU,novalidate:["novalidate"],target:iC}},h1:jn,h2:jn,h3:jn,h4:jn,h5:jn,h6:jn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:jn,hgroup:jn,hr:jn,html:{attrs:{manifest:null}},i:jn,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:OU,formmethod:SU,formnovalidate:["novalidate"],formtarget:iC,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:jn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:jn,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:jn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:wU,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:jn,noscript:jn,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:jn,param:{attrs:{name:null,value:null}},pre:jn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:jn,rt:jn,ruby:jn,samp:jn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:wU}},section:jn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:jn,source:{attrs:{src:null,type:null,media:null}},span:jn,strong:jn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:jn,summary:jn,sup:jn,table:jn,tbody:jn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:jn,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:jn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:jn,time:{attrs:{datetime:null}},title:jn,tr:jn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:jn,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:jn},gat={accesskey:null,class:null,contenteditable:Hu,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:Hu,autocorrect:Hu,autocapitalize:Hu,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":Hu,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Hu,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Hu,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Hu,"aria-hidden":Hu,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Hu,"aria-multiselectable":Hu,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Hu,"aria-relevant":null,"aria-required":Hu,"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},vat="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 vat)gat[e]=null;let ON=class{constructor(t,n){this.tags={...Iln,...t},this.globalAttrs={...gat,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};ON.default=new ON;function mk(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 gk(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function yat(e,t,n){let r=n.tags[mk(e,gk(t))];return r?.children||n.allTags}function Ode(e,t){let n=[];for(let r=gk(t);r&&!r.type.isTop;r=gk(r.parent)){let a=mk(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 bat=/^[:\-\.\w\u00b7-\uffff]*$/;function A_e(e,t,n,r,a){let s=/\s*>/.test(e.sliceDoc(a,a+5))?"":">",i=gk(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:a,options:yat(e.doc,i,t).map(o=>({label:o,type:"type"})).concat(Ode(e.doc,n).map((o,c)=>({label:"/"+o,apply:"/"+o+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function I_e(e,t,n,r){let a=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:Ode(e.doc,t).map((s,i)=>({label:s,apply:s+a,type:"type",boost:99-i})),validFor:bat}}function Rln(e,t,n,r){let a=[],s=0;for(let i of yat(e.doc,n,t))a.push({label:"<"+i,type:"type"});for(let i of Ode(e.doc,n))a.push({label:"</"+i+">",type:"type",boost:99-s++});return{from:r,to:r,options:a,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Pln(e,t,n,r,a){let s=gk(n),i=s?t.tags[mk(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:bat}}function Mln(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=gk(n),p=f?t.tags[mk(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 xat(e,t){let{state:n,pos:r}=t,a=ps(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)?I_e(n,a,a.from,r):A_e(n,e,a,a.from,r):a.name=="StartTag"||a.name=="IncompleteTag"?A_e(n,e,a,r,r):a.name=="StartCloseTag"||a.name=="IncompleteCloseTag"?I_e(n,a,r,r):a.name=="OpenTag"||a.name=="SelfClosingTag"||a.name=="AttributeName"?Pln(n,e,a,a.name=="AttributeName"?a.from:r,r):a.name=="Is"||a.name=="AttributeValue"||a.name=="UnquotedAttributeValue"?Mln(n,e,a,a.name=="Is"?r:a.from,r):t.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?Rln(n,e,a,r):null}function wat(e){return xat(ON.default,e)}function Sat(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new ON(t,n):ON.default;return a=>xat(r,a)}const Dln=Af.parser.configure({top:"SingleExpression"}),Oat=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:xde.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:wde.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Sde.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:Dln},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Af.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:SN.parser}],kat=[{name:"style",parser:SN.parser.configure({top:"Styles"})}].concat(vat.map(e=>({name:e,parser:Af.parser}))),_at=X0.define({name:"html",parser:don.configure({props:[Ww.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}}),Gw.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}}}),nrt.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Zj=_at.configure({wrap:Xrt(Oat,kat)});function Eat(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=Xrt((e.nestedLanguages||[]).concat(Oat),(e.nestedAttributes||[]).concat(kat)));let r=n?_at.configure({wrap:n,dialect:t}):t?Zj.configure({dialect:t}):Zj;return new J0(r,[Zj.data.of({autocomplete:Sat(e)}),e.autoCloseTags!==!1?Cat:[],NL().support,sat().support])}const R_e=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Cat=gt.inputHandler.of((e,t,n,r,a)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Zj.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=ps(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=mk(i.doc,v.parent,h))&&!R_e.has(g)){let x=h+(i.doc.sliceString(h,h+1)===">"?1:0),w=`</${g}>`;return{range:c,changes:{from:h,to:x,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=mk(i.doc,v,h))&&!R_e.has(g)){let x=h+(i.doc.sliceString(h,h+1)===">"?1:0),w=`${g}>`;return{range:nt.cursor(h+w.length,-1),changes:{from:h,to:x,insert:w}}}}return{range:c}});return o.changes.empty?!1:(e.dispatch([s,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),$ln=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:Cat,html:Eat,htmlCompletionSource:wat,htmlCompletionSourceWith:Sat,htmlLanguage:Zj},Symbol.toStringTag,{value:"Module"})),jat=nF({commentTokens:{block:{open:"<!--",close:"-->"}}}),Tat=new lr,Nat=pin.configure({props:[Gw.add(e=>!e.is("Block")||e.is("Document")||Hne(e)!=null||Lln(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),Tat.add(Hne),Ww.add({Document:()=>null}),zy.add({Document:jat})]});function Hne(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function Lln(e){return e.name=="OrderedList"||e.name=="BulletList"}function Fln(e,t){let n=e;for(;;){let r=n.nextSibling,a;if(!r||(a=Hne(r.type))!=null&&a<=t)break;n=r}return n.to}const zln=Vnt.of((e,t,n)=>{for(let r=ps(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let a=r.type.prop(Tat);if(a==null)continue;let s=Fln(r,a);if(s>n)return{from:n,to:s}}return null});function kde(e){return new cd(jat,e,[],"markdown")}const Aat=kde(Nat),Bln=Nat.configure([kin,Ein,_in,Cin,{props:[Gw.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),nw=kde(Bln);function Uln(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:K0.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}class kU{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(+Rat(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function Iat(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 kU(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 kU(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 kU(s.parent,c,c+d,i[1],u,f,s))}}return r}function Rat(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function _U(e,t,n,r=0){for(let a=-1,s=e;;){if(s.name=="ListItem"){let o=Rat(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 _de(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(O_)!=" ")return e;let r=Dp(e,4,n),a="";for(let s=r;s>0;)s>=4?(a+=" ",s-=4):(a+=" ",s--);return a+e.slice(n)}const Pat=(e={})=>({state:t,dispatch:n})=>{let r=ps(t),{doc:a}=t,s=null,i=t.changeByRange(o=>{if(!o.empty||!nw.isActiveAt(t,o.from,-1)&&!nw.isActiveAt(t,o.from,1))return s={range:o};let c=o.from,u=a.lineAt(c),d=Iat(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 x=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(x.to>=c||w&&w.to<c||u.from>0&&!/[^\s>]/.test(a.lineAt(u.from-1).text)||e.nonTightLists===!1){let O=d.length>1?d[d.length-2]:null,k,_="";O&&O.item?(k=u.from+O.from,_=O.marker(a,1)):k=u.from+(O?O.to:0);let C=[{from:k,to:c,insert:_}];return f.node.name=="OrderedList"&&_U(f.item,a,C,-2),O&&O.node.name=="OrderedList"&&_U(O.item,a,C),{range:nt.cursor(k+_.length),changes:C}}else{let O=M_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 x=a.lineAt(u.from-1),w=/>\s*$/.exec(x.text);if(w&&w.index==f.from){let O=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:o.map(O),changes:O}}}let h=[];f.node.name=="OrderedList"&&_U(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 x=0,w=d.length-1;x<=w;x++)g+=x==w&&!m?d[x].marker(a,1):d[x].blank(x<w?Dp(u.text,4,d[x+1].from)-g.length:null);let v=c;for(;v>u.from&&/\s/.test(u.text.charAt(v-u.from-1));)v--;return g=_de(g,t),qln(f.node,t.doc)&&(g=M_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)},Mat=Pat();function P_e(e){return e.name=="QuoteMark"||e.name=="ListMark"}function qln(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 M_e(e,t,n){let r="";for(let a=0,s=e.length-2;a<=s;a++)r+=e[a].blank(a<s?Dp(n.text,4,e[a+1].from)-r.length:null,a<s);return _de(r,t)}function Vln(e,t){let n=e.resolveInner(t,-1),r=t;P_e(n)&&(r=n.from,n=n.parent);for(let a;a=n.childBefore(r);)if(P_e(a))r=a.from;else if(a.name=="OrderedList"||a.name=="BulletList")n=a.lastChild,r=n.to;else break;return n}const Dat=({state:e,dispatch:t})=>{let n=ps(e),r=null,a=e.changeByRange(s=>{let i=s.from,{doc:o}=e;if(s.empty&&nw.isActiveAt(e,s.from)){let c=o.lineAt(i),u=Iat(Vln(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(Dp(c.text,4,d.to)-Dp(c.text,4,d.from));return p==c.from&&(h=_de(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)},$at=[{key:"Enter",run:Mat},{key:"Backspace",run:Dat}],Lat=Eat({matchClosingTags:!1});function Ede(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:a}=Aat,completeHTMLTags:s=!0,pasteURLAsLink:i=!0,htmlTagLanguage:o=Lat}=e;if(!(a instanceof oF))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[o.support,zln],d;i&&u.push(Fat),n instanceof J0?(u.push(n.support),d=n.language):n&&(d=n);let f=t||d?Uln(t,d):void 0;c.push(min({codeParser:f,htmlParser:o.language.parser})),r&&u.push(Gp.high(S_.of($at)));let p=kde(a.configure(c));return s&&u.push(p.data.of({autocomplete:Hln})),new J0(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=ps(t).resolveInner(n,-1);for(;a&&!a.type.isTop;){if(a.name=="CodeBlock"||a.name=="FencedCode"||a.name=="ProcessingInstructionBlock"||a.name=="CommentBlock"||a.name=="Link"||a.name=="Image")return null;a=a.parent}return{from:n-r[0].length,to:n,options:Qln(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let EU=null;function Qln(){if(EU)return EU;let e=wat(new nde(Dr.create({extensions:Lat}),0,!0));return EU=e?e.options:[]}const Wln=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Fat=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),!nw.isActiveAt(t.state,r.from,1)))return!1;let s=ps(t.state),i=!1;return s.iterate({from:r.from,to:r.to,enter:o=>{(o.from>r.from||Wln.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)}}),Gln=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:Aat,deleteMarkupBackward:Dat,insertNewlineContinueMarkup:Mat,insertNewlineContinueMarkupCommand:Pat,markdown:Ede,markdownKeymap:$at,markdownLanguage:nw,pasteURLAsLink:Fat},Symbol.toStringTag,{value:"Module"}));function pt(e){return new J0(Jue.define(e))}function dy(e){return We(()=>import("./index-BKTzGG4p.js"),__vite__mapDeps([4,2]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const zat=[Ve.of({name:"C",extensions:["c","h","ino"],load(){return We(()=>import("./index-owoDuiWJ.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-owoDuiWJ.js"),__vite__mapDeps([5,2]),import.meta.url).then(e=>e.cpp())}}),Ve.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return dy("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-BUnkWoXT.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(()=>$ln),void 0,import.meta.url).then(e=>e.html())}}),Ve.of({name:"Java",extensions:["java"],load(){return We(()=>import("./index-VQvZ6bsp.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(()=>qM),void 0,import.meta.url).then(e=>e.javascript())}}),Ve.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return We(()=>import("./index-D7lI9l4L.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(()=>ssn),void 0,import.meta.url).then(e=>e.json())}}),Ve.of({name:"JSX",extensions:["jsx"],load(){return We(()=>Promise.resolve().then(()=>qM),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ve.of({name:"LESS",extensions:["less"],load(){return We(()=>import("./index-OQrGdguO.js"),__vite__mapDeps([9,2]),import.meta.url).then(e=>e.less())}}),Ve.of({name:"Liquid",extensions:["liquid"],load(){return We(()=>import("./index-DBupw5JA.js"),__vite__mapDeps([10,2]),import.meta.url).then(e=>e.liquid())}}),Ve.of({name:"MariaDB SQL",load(){return dy("MariaSQL")}}),Ve.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return We(()=>Promise.resolve().then(()=>Gln),void 0,import.meta.url).then(e=>e.markdown())}}),Ve.of({name:"MS SQL",load(){return dy("MSSQL")}}),Ve.of({name:"MySQL",load(){return dy("MySQL")}}),Ve.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return We(()=>import("./index-BXjRHfo-.js"),__vite__mapDeps([11,2]),import.meta.url).then(e=>e.php())}}),Ve.of({name:"PLSQL",extensions:["pls"],load(){return dy("PLSQL")}}),Ve.of({name:"PostgreSQL",load(){return dy("PostgreSQL")}}),Ve.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return We(()=>import("./index-RGPs7l8u.js"),__vite__mapDeps([12,2]),import.meta.url).then(e=>e.python())}}),Ve.of({name:"Rust",extensions:["rs"],load(){return We(()=>import("./index-DO0qbHHx.js"),__vite__mapDeps([13,2]),import.meta.url).then(e=>e.rust())}}),Ve.of({name:"Sass",extensions:["sass"],load(){return We(()=>import("./index-CruFxrCd.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-CruFxrCd.js"),__vite__mapDeps([14,2]),import.meta.url).then(e=>e.sass())}}),Ve.of({name:"SQL",extensions:["sql"],load(){return dy("StandardSQL")}}),Ve.of({name:"SQLite",load(){return dy("SQLite")}}),Ve.of({name:"TSX",extensions:["tsx"],load(){return We(()=>Promise.resolve().then(()=>qM),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(()=>qM),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ve.of({name:"WebAssembly",extensions:["wat","wast"],load(){return We(()=>import("./index-Ctec_dQM.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-BPemyi6g.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-DeqfI74y.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-_39yLwv_.js"),__vite__mapDeps([24,2]),import.meta.url).then(e=>e.vue())}}),Ve.of({name:"Angular Template",load(){return We(()=>import("./index-A6BM34y5.js"),__vite__mapDeps([25,2]),import.meta.url).then(e=>e.angular())}})];var Zln=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=Am.define(r),u=[o,Zw(c)];return u},Yln={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"}],PI=e=>{var{theme:t="dark",settings:n={},styles:r=[]}=e||{};return Zln({theme:t,settings:yb({},Yln,n),styles:[...Xln,...r]})};PI();const Kln=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=jde(e.state,n.from);return r.line?Jln(e):r.block?tcn(e):!1};function Cde(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 Jln=Cde(acn,0),ecn=Cde(Bat,0),tcn=Cde((e,t)=>Bat(e,t,rcn(t)),0);function jde(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const oC=50;function ncn(e,{open:t,close:n},r,a){let s=e.sliceDoc(r-oC,r),i=e.sliceDoc(a,a+oC),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*oC?d=f=e.sliceDoc(r,a):(d=e.sliceDoc(r,r+oC),f=e.sliceDoc(a-oC,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 rcn(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 Bat(e,t,n=t.selection.ranges){let r=n.map(s=>jde(t,s.from).block);if(!r.every(s=>s))return null;let a=n.map((s,i)=>ncn(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 acn(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=jde(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 Qne=Tm.define(),scn=Tm.define(),icn=Xt.define(),Uat=Xt.define({combine(e){return Nm(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)})}}),qat=ho.define({create(){return Yh.empty},update(e,t){let n=t.state.facet(Uat),r=t.annotation(Qne);if(r){let c=fu.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=AL(d,d.length,n.minDepth,c):d=Qat(d,t.startState.selection),new Yh(u==0?r.rest:d,u==0?d:r.rest)}let a=t.annotation(scn);if((a=="full"||a=="before")&&(e=e.isolate()),t.annotation(so.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=fu.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 Yh(e.done.map(fu.fromJSON),e.undone.map(fu.fromJSON))}});function ocn(e={}){return[qat,Uat.of(e),gt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?Vat:t.inputType=="historyRedo"?Wne:null;return r?(t.preventDefault(),r(n)):!1}})]}function lF(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let a=n.field(qat,!1);if(!a)return!1;let s=a.pop(e,n,t);return s?(r(s),!0):!1}}const Vat=lF(0,!1),Wne=lF(1,!1),lcn=lF(0,!0),ccn=lF(1,!0);class fu{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 fu(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 fu(t.changes&&to.fromJSON(t.changes),[],t.mapped&&rm.fromJSON(t.mapped),t.startSelection&&nt.fromJSON(t.startSelection),t.selectionsAfter.map(nt.fromJSON))}static fromTransaction(t,n){let r=Sf;for(let a of t.startState.facet(icn)){let s=a(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new fu(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Sf)}static selection(t){return new fu(void 0,Sf,void 0,void 0,t)}}function AL(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 ucn(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 dcn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function Hat(e,t){return e.length?t.length?e.concat(t):e:t}const Sf=[],fcn=200;function Qat(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-fcn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),AL(e,e.length-1,1e9,n.setSelAfter(r)))}else return[fu.selection([t])]}function pcn(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 CU(e,t){if(!e.length)return e;let n=e.length,r=Sf;for(;n;){let a=hcn(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?[fu.selection(r)]:Sf}function hcn(e,t,n){let r=Hat(e.selectionsAfter.length?e.selectionsAfter.map(o=>o.map(t)):Sf,n);if(!e.changes)return fu.selection(r);let a=e.changes.map(t),s=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(s):s;return new fu(a,Kn.mapEffects(e.effects,t),i,e.startSelection.map(s),r)}const mcn=/^(input\.type|delete)($|\.)/;class Yh{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 Yh(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||mcn.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime<a.newGroupDelay&&a.joinToEvent(s,ucn(o.changes,t.changes))||r=="input.type.compose")?i=AL(i,i.length-1,a.minDepth,new fu(t.changes.compose(o.changes),Hat(Kn.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,Sf)):i=AL(i,i.length,a.minDepth,t),new Yh(i,Sf,n,r)}addSelection(t,n,r,a){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Sf;return s.length>0&&n-this.prevTime<a&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&dcn(s[s.length-1],t)?this:new Yh(Qat(this.done,t),this.undone,n,r)}addMapping(t){return new Yh(CU(this.done,t),CU(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:Qne.of({side:t,rest:pcn(a),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let o=a.length==1?Sf:a.slice(0,a.length-1);return s.mapped&&(o=CU(o,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Qne.of({side:t,rest:o,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Yh.empty=new Yh(Sf,Sf);const gcn=[{key:"Mod-z",run:Vat,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Wne,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Wne,preventDefault:!0},{key:"Mod-u",run:lcn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ccn,preventDefault:!0}];function __(e,t){return nt.create(e.ranges.map(t),e.mainIndex)}function Zp(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Yp({state:e,dispatch:t},n){let r=__(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Zp(e,r)),!0)}function cF(e,t){return nt.cursor(t?e.to:e.from)}function Wat(e,t){return Yp(e,n=>n.empty?e.moveByChar(n,t):cF(n,t))}function tc(e){return e.textDirectionAt(e.state.selection.main.head)==xs.LTR}const Gat=e=>Wat(e,!tc(e)),Zat=e=>Wat(e,tc(e));function Yat(e,t){return Yp(e,n=>n.empty?e.moveByGroup(n,t):cF(n,t))}const vcn=e=>Yat(e,!tc(e)),ycn=e=>Yat(e,tc(e));function bcn(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 uF(e,t,n){let r=ps(e).resolveInner(t.head),a=n?lr.closedBy:lr.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;bcn(e,u,a)?r=u:c=n?u.to:u.from}let s=r.type.prop(a),i,o;return s&&(i=n?Zh(e,r.from,1):Zh(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 xcn=e=>Yp(e,t=>uF(e.state,t,!tc(e))),wcn=e=>Yp(e,t=>uF(e.state,t,tc(e)));function Xat(e,t){return Yp(e,n=>{if(!n.empty)return cF(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Kat=e=>Xat(e,!1),Jat=e=>Xat(e,!0);function est(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 tst(e,t){let n=est(e),{state:r}=e,a=__(r.selection,i=>i.empty?e.moveVertically(i,t,n.height):cF(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(Zp(r,a),{effects:s}),!0}const D_e=e=>tst(e,!1),Gne=e=>tst(e,!0);function Hb(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 Scn=e=>Yp(e,t=>Hb(e,t,!0)),Ocn=e=>Yp(e,t=>Hb(e,t,!1)),kcn=e=>Yp(e,t=>Hb(e,t,!tc(e))),_cn=e=>Yp(e,t=>Hb(e,t,tc(e))),Ecn=e=>Yp(e,t=>nt.cursor(e.lineBlockAt(t.head).from,1)),Ccn=e=>Yp(e,t=>nt.cursor(e.lineBlockAt(t.head).to,-1));function jcn(e,t,n){let r=!1,a=__(e.selection,s=>{let i=Zh(e,s.head,-1)||Zh(e,s.head,1)||s.head>0&&Zh(e,s.head-1,1)||s.head<e.doc.length&&Zh(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(Zp(e,a)),!0):!1}const Tcn=({state:e,dispatch:t})=>jcn(e,t);function Gf(e,t){let n=__(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(Zp(e.state,n)),!0)}function nst(e,t){return Gf(e,n=>e.moveByChar(n,t))}const rst=e=>nst(e,!tc(e)),ast=e=>nst(e,tc(e));function sst(e,t){return Gf(e,n=>e.moveByGroup(n,t))}const Ncn=e=>sst(e,!tc(e)),Acn=e=>sst(e,tc(e)),Icn=e=>Gf(e,t=>uF(e.state,t,!tc(e))),Rcn=e=>Gf(e,t=>uF(e.state,t,tc(e)));function ist(e,t){return Gf(e,n=>e.moveVertically(n,t))}const ost=e=>ist(e,!1),lst=e=>ist(e,!0);function cst(e,t){return Gf(e,n=>e.moveVertically(n,t,est(e).height))}const $_e=e=>cst(e,!1),L_e=e=>cst(e,!0),Pcn=e=>Gf(e,t=>Hb(e,t,!0)),Mcn=e=>Gf(e,t=>Hb(e,t,!1)),Dcn=e=>Gf(e,t=>Hb(e,t,!tc(e))),$cn=e=>Gf(e,t=>Hb(e,t,tc(e))),Lcn=e=>Gf(e,t=>nt.cursor(e.lineBlockAt(t.head).from)),Fcn=e=>Gf(e,t=>nt.cursor(e.lineBlockAt(t.head).to)),F_e=({state:e,dispatch:t})=>(t(Zp(e,{anchor:0})),!0),z_e=({state:e,dispatch:t})=>(t(Zp(e,{anchor:e.doc.length})),!0),B_e=({state:e,dispatch:t})=>(t(Zp(e,{anchor:e.selection.main.anchor,head:0})),!0),U_e=({state:e,dispatch:t})=>(t(Zp(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),zcn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Bcn=({state:e,dispatch:t})=>{let n=dF(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},Ucn=({state:e,dispatch:t})=>{let n=__(e.selection,r=>{let a=ps(e),s=a.resolveStack(r.from,1);if(r.empty){let i=a.resolveStack(r.from,-1);i.node.from>=s.node.from&&i.node.to<=s.node.to&&(s=i)}for(let i=s;i;i=i.next){let{node: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(Zp(e,n)),!0)};function ust(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(Zp(n,nt.create(a,a.length-1))),!0)}const qcn=e=>ust(e,!1),Vcn=e=>ust(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(Zp(e,r)),!0):!1};function MI(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=VM(e,c,!1)):c>i&&(n="delete.forward",c=VM(e,c,!0)),i=Math.min(i,c),o=Math.max(o,c)}else i=VM(e,i,!1),o=VM(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 VM(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 dst=(e,t,n)=>MI(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=Dp(o,s.tabSize),d=u%ew(s)||ew(s);for(let f=0;f<d&&o[o.length-1-f]==" ";f++)a--;c=a}else c=Wo(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=Wo(i.text,c-i.from,!1,!1)+i.from);return c}),Zne=e=>dst(e,!1,!0),fst=e=>dst(e,!0,!1),pst=(e,t)=>MI(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=Wo(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}),hst=e=>pst(e,!1),Qcn=e=>pst(e,!0),Wcn=e=>MI(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Gcn=e=>MI(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Zcn=e=>MI(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Ycn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Ca.of(["",""])},range: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:Wo(s.text,a-s.from,!1)+s.from,o=a==s.to?a+1:Wo(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 dF(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 mst(e,t,n){if(e.readOnly)return!1;let r=[],a=[];for(let s of dF(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 Kcn=({state:e,dispatch:t})=>mst(e,t,!1),Jcn=({state:e,dispatch:t})=>mst(e,t,!0);function gst(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of dF(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 eun=({state:e,dispatch:t})=>gst(e,t,!1),tun=({state:e,dispatch:t})=>gst(e,t,!0),nun=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(dF(t).map(({from:a,to:s})=>(a>0?a--:s<t.doc.length&&s++,{from:a,to:s}))),r=__(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 run(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=ps(e).resolveInner(t),r=n.childBefore(t),a=n.childAfter(t),s;return r&&a&&r.to<=t&&a.from>=t&&(s=r.type.prop(lr.closedBy))&&s.indexOf(a.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(r.to,a.from))?{from:r.to,to:a.from}:null}const q_e=vst(!1),aun=vst(!0);function vst(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&&run(t,s);e&&(s=i=(i<=o.to?o:t.doc.lineAt(i)).to);let u=new rF(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=Yue(u,s);for(d==null&&(d=Dp(/^\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=["",hN(t,d)];return c&&f.push(hN(t,u.lineIndent(o.from,-1))),{changes:{from:s,to:i,insert:Ca.of(f)},range:nt.cursor(s+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Tde(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 sun=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new rF(e,{overrideIndentation:s=>{let i=n[s];return i??-1}}),a=Tde(e,(s,i,o)=>{let c=Yue(r,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=hN(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},yst=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Tde(e,(n,r)=>{r.push({from:n.from,insert:e.facet(O_)})}),{userEvent:"input.indent"})),!0),bst=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Tde(e,(n,r)=>{let a=/^\s*/.exec(n.text)[0];if(!a)return;let s=Dp(a,e.tabSize),i=0,o=hN(e,Math.max(0,s-ew(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),iun=e=>(e.setTabFocusMode(),!0),oun=[{key:"Ctrl-b",run:Gat,shift:rst,preventDefault:!0},{key:"Ctrl-f",run:Zat,shift:ast},{key:"Ctrl-p",run:Kat,shift:ost},{key:"Ctrl-n",run:Jat,shift:lst},{key:"Ctrl-a",run:Ecn,shift:Lcn},{key:"Ctrl-e",run:Ccn,shift:Fcn},{key:"Ctrl-d",run:fst},{key:"Ctrl-h",run:Zne},{key:"Ctrl-k",run:Wcn},{key:"Ctrl-Alt-h",run:hst},{key:"Ctrl-o",run:Ycn},{key:"Ctrl-t",run:Xcn},{key:"Ctrl-v",run:Gne}],lun=[{key:"ArrowLeft",run:Gat,shift:rst,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:vcn,shift:Ncn,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:kcn,shift:Dcn,preventDefault:!0},{key:"ArrowRight",run:Zat,shift:ast,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ycn,shift:Acn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:_cn,shift:$cn,preventDefault:!0},{key:"ArrowUp",run:Kat,shift:ost,preventDefault:!0},{mac:"Cmd-ArrowUp",run:F_e,shift:B_e},{mac:"Ctrl-ArrowUp",run:D_e,shift:$_e},{key:"ArrowDown",run:Jat,shift:lst,preventDefault:!0},{mac:"Cmd-ArrowDown",run:z_e,shift:U_e},{mac:"Ctrl-ArrowDown",run:Gne,shift:L_e},{key:"PageUp",run:D_e,shift:$_e},{key:"PageDown",run:Gne,shift:L_e},{key:"Home",run:Ocn,shift:Mcn,preventDefault:!0},{key:"Mod-Home",run:F_e,shift:B_e},{key:"End",run:Scn,shift:Pcn,preventDefault:!0},{key:"Mod-End",run:z_e,shift:U_e},{key:"Enter",run:q_e,shift:q_e},{key:"Mod-a",run:zcn},{key:"Backspace",run:Zne,shift:Zne,preventDefault:!0},{key:"Delete",run:fst,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:hst,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Qcn,preventDefault:!0},{mac:"Mod-Backspace",run:Gcn,preventDefault:!0},{mac:"Mod-Delete",run:Zcn,preventDefault:!0}].concat(oun.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),cun=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:xcn,shift:Icn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:wcn,shift:Rcn},{key:"Alt-ArrowUp",run:Kcn},{key:"Shift-Alt-ArrowUp",run:eun},{key:"Alt-ArrowDown",run:Jcn},{key:"Shift-Alt-ArrowDown",run:tun},{key:"Mod-Alt-ArrowUp",run:qcn},{key:"Mod-Alt-ArrowDown",run:Vcn},{key:"Escape",run:Hcn},{key:"Mod-Enter",run:aun},{key:"Alt-l",mac:"Ctrl-l",run:Bcn},{key:"Mod-i",run:Ucn,preventDefault:!0},{key:"Mod-[",run:bst},{key:"Mod-]",run:yst},{key:"Mod-Alt-\\",run:sun},{key:"Shift-Mod-k",run:nun},{key:"Shift-Mod-\\",run:Tcn},{key:"Mod-/",run:Kln},{key:"Alt-A",run:ecn},{key:"Ctrl-m",mac:"Shift-Alt-m",run:iun}].concat(lun),uun={key:"Tab",run:yst,shift:bst},V_e=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class vk{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(V_e(o)):V_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 nu(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=Iue(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Dh(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"&&(vk.prototype[Symbol.iterator]=function(){return this});const xst={from:-1,to:-1,match:/.*/.exec("")},Nde="gm"+(/x/.unicode==null?"":"u");class wst{constructor(t,n,r,a=0,s=t.length){if(this.text=t,this.to=s,this.curLine="",this.done=!1,this.value=xst,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Sst(t,n,r,a,s);this.re=new RegExp(n,Nde+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=t.iter();let i=t.lineAt(a);this.curLineStart=i.from,this.matchPos=IL(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=IL(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 jU=new WeakMap;class yO{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let a=jU.get(t);if(!a||a.from>=r||a.to<=n){let o=new yO(n,t.sliceString(n,r));return jU.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)),jU.set(t,new yO(i,s)),new yO(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=xst,this.matchPos=IL(t,a),this.re=new RegExp(n,Nde+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=yO.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=IL(this.text,a+(r==a?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=yO.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(wst.prototype[Symbol.iterator]=Sst.prototype[Symbol.iterator]=function(){return this});function dun(e){try{return new RegExp(e,Nde),!0}catch{return!1}}function IL(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 Yne(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),n=ys("input",{class:"cm-textfield",name:"line",value:t}),r=ys("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),e.dispatch({effects:Yj.of(!1)}),e.focus()):s.keyCode==13&&(s.preventDefault(),a())},onsubmit:s=>{s.preventDefault(),a()}},ys("label",e.state.phrase("Go to line"),": ",n)," ",ys("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),ys("button",{name:"close",onclick:()=>{e.dispatch({effects:Yj.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:[Yj.of(!1),gt.scrollIntoView(g.from,{y:"center"})],selection:g}),e.focus()}return{dom:r}}const Yj=Kn.define(),H_e=ho.define({create(){return!0},update(e,t){for(let n of t.effects)n.is(Yj)&&(e=n.value);return e},provide:e=>pN.from(e,t=>t?Yne:null)}),fun=e=>{let t=fN(e,Yne);if(!t){let n=[Yj.of(!0)];e.state.field(H_e,!1)==null&&n.push(Kn.appendConfig.of([H_e,pun])),e.dispatch({effects:n}),t=fN(e,Yne)}return t&&t.dom.querySelector("input").select(),!0},pun=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"}}}),hun={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},mun=Xt.define({combine(e){return Nm(e,hun,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function gun(e){return[wun,xun]}const vun=nn.mark({class:"cm-selectionMatch"}),yun=nn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Q_e(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=ai.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=ai.Word)}function bun(e,t,n,r){return e(t.sliceDoc(n,n+1))==ai.Word&&e(t.sliceDoc(r-1,r))==ai.Word}const xun=oi.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(mun),{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),!(Q_e(i,n,a.from,a.to)&&bun(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 vk(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||Q_e(i,n,d,f))&&(a.empty&&d<=a.from&&f>=a.to?o.push(yun.range(d,f)):(d>=a.to||f<=a.from)&&o.push(vun.range(d,f)),o.length>t.maxMatches))return nn.none}}return nn.set(o)}},{decorations:e=>e.decorations}),wun=gt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Sun=({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 Oun(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 vk(e.doc,t,r[r.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new vk(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 kun=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return Sun({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=Oun(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},E_=Xt.define({combine(e){return Nm(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Dun(t),scrollToMatch:t=>gt.scrollIntoView(t)})}});class Ost{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||dun(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 jun(this):new Eun(this)}getCursor(t,n=0,r){let a=t.doc?t:Dr.create({doc:t});return r==null&&(r=a.doc.length),this.regexp?k1(this,a,n,r):O1(this,a,n,r)}}class kst{constructor(t){this.spec=t}}function O1(e,t,n,r){return new vk(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:a=>a.toLowerCase(),e.wholeWord?_un(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function _un(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(RL(a,n-s))!=ai.Word||t(PL(a,n-s))!=ai.Word)&&(t(PL(a,r-s))!=ai.Word||t(RL(a,r-s))!=ai.Word))}class Eun extends kst{constructor(t){super(t)}nextMatch(t,n,r){let a=O1(this.spec,t,r,t.doc.length).nextOverlapping();if(a.done){let s=Math.min(t.doc.length,n+this.spec.unquoted.length);a=O1(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=O1(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=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-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 k1(e,t,n,r){return new wst(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?Cun(t.charCategorizer(t.selection.main.head)):void 0},n,r)}function RL(e,t){return e.slice(Wo(e,t,!1),t)}function PL(e,t){return e.slice(t,Wo(e,t))}function Cun(e){return(t,n,r)=>!r[0].length||(e(RL(r.input,r.index))!=ai.Word||e(PL(r.input,r.index))!=ai.Word)&&(e(PL(r.input,r.index+r[0].length))!=ai.Word||e(RL(r.input,r.index+r[0].length))!=ai.Word)}class jun extends kst{nextMatch(t,n,r){let a=k1(this.spec,t,r,t.doc.length).next();return a.done&&(a=k1(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=k1(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=k1(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=k1(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 kN=Kn.define(),Ade=Kn.define(),Yy=ho.define({create(e){return new TU(Xne(e).create(),null)},update(e,t){for(let n of t.effects)n.is(kN)?e=new TU(n.value.create(),e.panel):n.is(Ade)&&(e=new TU(e.query,n.value?Ide:null));return e},provide:e=>pN.from(e,t=>t.panel)});class TU{constructor(t,n){this.query=t,this.panel=n}}const Tun=nn.mark({class:"cm-searchMatch"}),Nun=nn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Aun=oi.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Yy))}update(e){let t=e.state.field(Yy);(t!=e.startState.field(Yy)||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 ku;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?Nun:Tun)})}return r.finish()}},{decorations:e=>e.decorations});function DI(e){return t=>{let n=t.state.field(Yy,!1);return n&&n.query.spec.valid?e(t,n):Cst(t)}}const ML=DI((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(E_);return e.dispatch({selection:a,effects:[Rde(e,r),s.scrollToMatch(a.main,e)],userEvent:"select.search"}),Est(e),!0}),DL=DI((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(E_);return e.dispatch({selection:s,effects:[Rde(e,a),i.scrollToMatch(s.main,e)],userEvent:"select.search"}),Est(e),!0}),Iun=DI((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)}),Run=({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 vk(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},W_e=DI((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(Rde(e,i)),d.push(n.facet(E_).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),Pun=DI((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 Ide(e){return e.state.facet(E_).createPanel(e)}function Xne(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(E_);return new Ost({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 _st(e){let t=fN(e,Ide);return t&&t.dom.querySelector("[main-field]")}function Est(e){let t=_st(e);t&&t==e.root.activeElement&&t.select()}const Cst=e=>{let t=e.state.field(Yy,!1);if(t&&t.panel){let n=_st(e);if(n&&n!=e.root.activeElement){let r=Xne(e.state,t.query.spec);r.valid&&e.dispatch({effects:kN.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Ade.of(!0),t?kN.of(Xne(e.state,t.query.spec)):Kn.appendConfig.of(Lun)]});return!0},jst=e=>{let t=e.state.field(Yy,!1);if(!t||!t.panel)return!1;let n=fN(e,Ide);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Ade.of(!1)}),!0},Mun=[{key:"Mod-f",run:Cst,scope:"editor search-panel"},{key:"F3",run:ML,shift:DL,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ML,shift:DL,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:jst,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Run},{key:"Mod-Alt-g",run:fun},{key:"Mod-d",run:kun,preventDefault:!0}];class Dun{constructor(t){this.view=t;let n=this.query=t.state.field(Yy).query.spec;this.commit=this.commit.bind(this),this.searchField=ys("input",{value:n.search,placeholder:Qu(t,"Find"),"aria-label":Qu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ys("input",{value:n.replace,placeholder:Qu(t,"Replace"),"aria-label":Qu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ys("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=ys("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=ys("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(a,s,i){return ys("button",{class:"cm-button",name:a,onclick:s,type:"button"},i)}this.dom=ys("div",{onkeydown:a=>this.keydown(a),class:"cm-search"},[this.searchField,r("next",()=>ML(t),[Qu(t,"next")]),r("prev",()=>DL(t),[Qu(t,"previous")]),r("select",()=>Iun(t),[Qu(t,"all")]),ys("label",null,[this.caseField,Qu(t,"match case")]),ys("label",null,[this.reField,Qu(t,"regexp")]),ys("label",null,[this.wordField,Qu(t,"by word")]),...t.state.readOnly?[]:[ys("br"),this.replaceField,r("replace",()=>W_e(t),[Qu(t,"replace")]),r("replaceAll",()=>Pun(t),[Qu(t,"replace all")])],ys("button",{name:"close",onclick:()=>jst(t),"aria-label":Qu(t,"close"),type:"button"},["×"])])}commit(){let t=new Ost({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:kN.of(t)}))}keydown(t){drn(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?DL:ML)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),W_e(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(kN)&&!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(E_).top}}function Qu(e,t){return e.state.phrase(t)}const HM=30,QM=/[\s\.,:;?!]/;function Rde(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-HM),i=Math.min(a,n+HM),o=e.state.sliceDoc(s,i);if(s!=r.from){for(let c=0;c<HM;c++)if(!QM.test(o[c+1])&&QM.test(o[c])){o=o.slice(c);break}}if(i!=a){for(let c=o.length-1;c>o.length-HM;c--)if(!QM.test(o[c-1])&&QM.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 $un=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"}}),Lun=[Yy,Gp.low(Aun),$un];class G_e{constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class e0{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let a=r.facet(_N).markerFilter;a&&(t=a(t,r));let s=t.slice().sort((d,f)=>d.from-f.from||d.to-f.to),i=new ku,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 Wun(m),diagnostics:o.slice()}));else{let g=o.reduce((v,x)=>x.markClass?v+" "+x.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 e0(u,n,yk(u))}}function yk(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 G_e(a,s,t||i.diagnostics[0]);else{if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new G_e(r.from,s,r.diagnostic)}}),r}function Fun(e,t){let n=t.pos,r=t.end||n,a=e.state.facet(_N).hideOn(e,n,r);if(a!=null)return a;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(i=>i.is(Tst))||e.changes.touchesRange(s.from,Math.max(s.to,r)))}function zun(e,t){return e.field(ud,!1)?t:t.concat(Kn.appendConfig.of(Kun))}const Tst=Kn.define(),Pde=Kn.define(),Nst=Kn.define(),ud=ho.define({create(){return new e0(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=yk(n,e.selected.diagnostic,s)||yk(n,null,s)}!n.size&&a&&t.state.facet(_N).autoPanel&&(a=null),e=new e0(n,a,r)}for(let n of t.effects)if(n.is(Tst)){let r=t.state.facet(_N).autoPanel?n.value.length?EN.open:null:e.panel;e=e0.init(n.value,r,t.state)}else n.is(Pde)?e=new e0(e.diagnostics,n.value?EN.open:null,e.selected):n.is(Nst)&&(e=new e0(e.diagnostics,e.panel,n.value));return e},provide:e=>[pN.from(e,t=>t.panel),gt.decorations.from(e,t=>t.diagnostics)]}),Bun=nn.mark({class:"cm-lintRange cm-lintRange-active"});function Uun(e,t,n){let{diagnostics:r}=e.state.field(ud),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(_N).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:qun(e,a)}}}:null}function qun(e,t){return ys("ul",{class:"cm-tooltip-lint"},t.map(n=>Ist(e,n,!1)))}const Vun=e=>{let t=e.state.field(ud,!1);(!t||!t.panel)&&e.dispatch({effects:zun(e.state,[Pde.of(!0)])});let n=fN(e,EN.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Z_e=e=>{let t=e.state.field(ud,!1);return!t||!t.panel?!1:(e.dispatch({effects:Pde.of(!1)}),!0)},Hun=e=>{let t=e.state.field(ud,!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)},Qun=[{key:"Mod-Shift-m",run:Vun,preventDefault:!0},{key:"F8",run:Hun}],_N=Xt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Nm(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Y_e,tooltipFilter:Y_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 Y_e(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Ast(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 Ist(e,t,n){var r;let a=n?Ast(t.actions):[];return ys("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},ys("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(r=t.actions)===null||r===void 0?void 0:r.map((s,i)=>{let o=!1,c=h=>{if(h.preventDefault(),o)return;o=!0;let m=yk(e.state.field(ud).diagnostics,t);m&&s.apply(e,m.from,m.to)},{name:u}=s,d=a[i]?u.indexOf(a[i]):-1,f=d<0?u:[u.slice(0,d),ys("u",u.slice(d,d+1)),u.slice(d+1)],p=s.markClass?" "+s.markClass:"";return ys("button",{type:"button",class:"cm-diagnosticAction"+p,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${a[i]})"`}.`},f)}),t.source&&ys("div",{class:"cm-diagnosticSource"},t.source))}class Wun extends Dd{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return ys("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class X_e{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Ist(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class EN{constructor(t){this.view=t,this.items=[];let n=a=>{if(a.keyCode==27)Z_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=Ast(s.actions);for(let o=0;o<i.length;o++)if(i[o].toUpperCase().charCodeAt(0)==a.keyCode){let c=yk(this.view.state.field(ud).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=ys("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=ys("div",{class:"cm-panel-lint"},this.list,ys("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Z_e(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(ud).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(ud),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 X_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 X_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(ud),r=yk(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Nst.of(r)})}static open(t){return new EN(t)}}function Gun(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 WM(e){return Gun(`<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 Zun=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:WM("#d11")},".cm-lintRange-warning":{backgroundImage:WM("orange")},".cm-lintRange-info":{backgroundImage:WM("#999")},".cm-lintRange-hint":{backgroundImage:WM("#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 Yun(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=Yun(r.severity);a>n&&(n=a,t=r.severity)}return t}const Kun=[ud,gt.decorations.compute([ud],e=>{let{selected:t,panel:n}=e.field(ud);return!t||!n||t.from==t.to?nn.none:nn.set([Bun.range(t.from,t.to)])}),Krn(Uun,{hideOn:Fun}),Zun];var K_e=function(t){t===void 0&&(t={});var{crosshairCursor:n=!1}=t,r=[];t.closeBracketsKeymap!==!1&&(r=r.concat(Wsn)),t.defaultKeymap!==!1&&(r=r.concat(cun)),t.searchKeymap!==!1&&(r=r.concat(Mun)),t.historyKeymap!==!1&&(r=r.concat(gcn)),t.foldKeymap!==!1&&(r=r.concat(Ian)),t.completionKeymap!==!1&&(r=r.concat(brt)),t.lintKeymap!==!1&&(r=r.concat(Qun));var a=[];return t.lineNumbers!==!1&&a.push(lan()),t.highlightActiveLineGutter!==!1&&a.push(dan()),t.highlightSpecialChars!==!1&&a.push(Crn()),t.history!==!1&&a.push(ocn()),t.foldGutter!==!1&&a.push(Dan()),t.drawSelection!==!1&&a.push(vrn()),t.dropCursor!==!1&&a.push(Srn()),t.allowMultipleSelections!==!1&&a.push(Dr.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&a.push(kan()),t.syntaxHighlighting!==!1&&a.push(Zw(zan,{fallback:!0})),t.bracketMatching!==!1&&a.push(Wan()),t.closeBrackets!==!1&&a.push(qsn()),t.autocompletion!==!1&&a.push(yrt()),t.rectangularSelection!==!1&&a.push(Brn()),n!==!1&&a.push(Vrn()),t.highlightActiveLine!==!1&&a.push(Rrn()),t.highlightSelectionMatches!==!1&&a.push(gun()),t.tabSize&&typeof t.tabSize=="number"&&a.push(O_.of(" ".repeat(t.tabSize))),a.concat([S_.of(r.flat())]).filter(Boolean)};const Jun="#e5c07b",J_e="#e06c75",edn="#56b6c2",tdn="#ffffff",R2="#abb2bf",Kne="#7d8799",ndn="#61afef",rdn="#98c379",eEe="#d19a66",adn="#c678dd",sdn="#21252b",tEe="#2c313a",nEe="#282c34",NU="#353a42",idn="#3E4451",rEe="#528bff",odn=gt.theme({"&":{color:R2,backgroundColor:nEe},".cm-content":{caretColor:rEe},".cm-cursor, .cm-dropCursor":{borderLeftColor:rEe},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:idn},".cm-panels":{backgroundColor:sdn,color:R2},".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:nEe,color:Kne,border:"none"},".cm-activeLineGutter":{backgroundColor:tEe},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:NU},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:NU,borderBottomColor:NU},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:tEe,color:R2}}},{dark:!0}),ldn=Am.define([{tag:ie.keyword,color:adn},{tag:[ie.name,ie.deleted,ie.character,ie.propertyName,ie.macroName],color:J_e},{tag:[ie.function(ie.variableName),ie.labelName],color:ndn},{tag:[ie.color,ie.constant(ie.name),ie.standard(ie.name)],color:eEe},{tag:[ie.definition(ie.name),ie.separator],color:R2},{tag:[ie.typeName,ie.className,ie.number,ie.changed,ie.annotation,ie.modifier,ie.self,ie.namespace],color:Jun},{tag:[ie.operator,ie.operatorKeyword,ie.url,ie.escape,ie.regexp,ie.link,ie.special(ie.string)],color:edn},{tag:[ie.meta,ie.comment],color:Kne},{tag:ie.strong,fontWeight:"bold"},{tag:ie.emphasis,fontStyle:"italic"},{tag:ie.strikethrough,textDecoration:"line-through"},{tag:ie.link,color:Kne,textDecoration:"underline"},{tag:ie.heading,fontWeight:"bold",color:J_e},{tag:[ie.atom,ie.bool,ie.special(ie.variableName)],color:eEe},{tag:[ie.processingInstruction,ie.string,ie.inserted],color:rdn},{tag:ie.invalid,color:tdn}]),cdn=[odn,Zw(ldn)];var udn=gt.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),ddn=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(S_.of([uun])),o&&(typeof o=="boolean"?c.unshift(K_e()):c.unshift(K_e(o))),i&&c.unshift($rn(i)),s){case"light":c.push(udn);break;case"dark":c.push(cdn);break;case"none":break;default:c.push(s);break}return r===!1&&c.push(gt.editable.of(!1)),a&&c.push(Dr.readOnly.of(!0)),[...c]},fdn=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 pdn{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 aEe=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 AU=null,hdn=()=>typeof window>"u"?new aEe:(AU||(AU=new aEe),AU),sEe=Tm.define(),mdn=200,gdn=[];function vdn(e){var{value:t,selection:n,onChange:r,onStatistics:a,onCreateEditor:s,onUpdate:i,extensions:o=gdn,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:x=!0,readOnly:w=!1,indentWithTab:O=!0,basicSetup:k=!0,root:_,initialState:C}=e,[T,j]=b.useState(),[A,I]=b.useState(),[M,P]=b.useState(),F=b.useState(()=>({current:null}))[0],D=b.useState(()=>({current:null}))[0],U=gt.theme({"&":{height:d,minHeight:f,maxHeight:p,width:h,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),q=gt.updateListener.of(W=>{if(W.docChanged&&typeof r=="function"&&!W.transactions.some(B=>B.annotation(sEe))){F.current?F.current.reset():(F.current=new pdn(()=>{if(D.current){var B=D.current;D.current=null,B()}F.current=null},mdn),hdn().add(F.current));var $=W.state.doc,Z=$.toString();r(Z,W)}a&&a(fdn(W))}),z=ddn({theme:u,editable:x,readOnly:w,placeholder:v,indentWithTab:O,basicSetup:k}),V=[q,U,...z];return i&&typeof i=="function"&&V.push(gt.updateListener.of(i)),V=V.concat(o),b.useLayoutEffect(()=>{if(T&&!M){var W={doc:t,selection:n,extensions:V},$=C?Dr.fromJSON(C.json,W,C.fields):Dr.create(W);if(P($),!A){var Z=new gt({state:$,parent:T,root:_});I(Z),s&&s(Z,$)}}return()=>{A&&(P(void 0),I(void 0))}},[T,M]),b.useEffect(()=>{e.container&&j(e.container)},[e.container]),b.useEffect(()=>()=>{A&&(A.destroy(),I(void 0)),F.current&&(F.current.cancel(),F.current=null)},[A]),b.useEffect(()=>{c&&A&&A.focus()},[c,A]),b.useEffect(()=>{A&&A.dispatch({effects:Kn.reconfigure.of(V)})},[u,o,d,f,p,h,m,g,v,x,w,O,k,r,i]),b.useEffect(()=>{if(t!==void 0){var W=A?A.state.doc.toString():"";if(A&&t!==W){var $=F.current&&!F.current.isDone,Z=()=>{A&&t!==A.state.doc.toString()&&A.dispatch({changes:{from:0,to:A.state.doc.toString().length,insert:t||""},annotations:[sEe.of(!0)]})};$?D.current=Z:Z()}}},[t,A]),{state:M,setState:P,view:A,setView:I,container:T,setContainer:j}}var ydn=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Eu=b.forwardRef((e,t)=>{var{className:n,value:r="",selection:a,extensions:s=[],onChange:i,onStatistics:o,onCreateEditor:c,onUpdate:u,autoFocus:d,theme:f="light",height:p,minHeight:h,maxHeight:m,width:g,minWidth:v,maxWidth:x,basicSetup:w,placeholder:O,indentWithTab:k,editable:_,readOnly:C,root:T,initialState:j}=e,A=eue(e,ydn),I=b.useRef(null),{state:M,view:P,container:F,setContainer:D}=vdn({root:T,value:r,autoFocus:d,theme:f,height:p,minHeight:h,maxHeight:m,width:g,minWidth:v,maxWidth:x,basicSetup:w,placeholder:O,indentWithTab:k,editable:_,readOnly:C,selection:a,onChange:i,onStatistics:o,onCreateEditor:c,onUpdate:u,extensions:s,initialState:j});b.useImperativeHandle(t,()=>({editor:I.current,state:M,view:P}),[I,F,M,P]);var U=b.useCallback(z=>{I.current=z,D(z)},[D]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var q=typeof f=="string"?"cm-theme-"+f:"cm-theme";return l.jsx("div",yb({ref:U,className:""+q+(n?" "+n:"")},A))});Eu.displayName="CodeMirror";function bdn(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 xdn=e=>{switch(e){case"success":return Odn;case"info":return _dn;case"warning":return kdn;case"error":return Edn;default:return null}},wdn=Array(12).fill(0),Sdn=({visible:e,className:t})=>je.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},je.createElement("div",{className:"sonner-spinner"},wdn.map((n,r)=>je.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Odn=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.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"})),kdn=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},je.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"})),_dn=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.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"})),Edn=je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},je.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"})),Cdn=je.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"},je.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),je.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),jdn=()=>{const[e,t]=je.useState(document.hidden);return je.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let Jne=1;class Tdn{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:Jne++,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],je.isValidElement(u))s=!1,this.create({id:r,type:"default",message:u});else if(Adn(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"&&!je.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"&&!je.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"&&!je.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"&&!je.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||Jne++;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 Kc=new Tdn,Ndn=(e,t)=>{const n=t?.id||Jne++;return Kc.addToast({title:e,...t,id:n}),n},Adn=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Idn=Ndn,Rdn=()=>Kc.toasts,Pdn=()=>Kc.getActiveToasts(),Wl=Object.assign(Idn,{success:Kc.success,info:Kc.info,warning:Kc.warning,error:Kc.error,custom:Kc.custom,message:Kc.message,promise:Kc.promise,dismiss:Kc.dismiss,loading:Kc.loading},{getHistory:Rdn,getToasts:Pdn});bdn("[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 GM(e){return e.label!==void 0}const Mdn=3,Ddn="24px",$dn="16px",iEe=4e3,Ldn=356,Fdn=14,zdn=45,Bdn=200;function yh(...e){return e.filter(Boolean).join(" ")}function Udn(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const qdn=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:x,toasts:w,expanded:O,removeToast:k,defaultRichColors:_,closeButton:C,style:T,cancelButtonStyle:j,actionButtonStyle:A,className:I="",descriptionClassName:M="",duration:P,position:F,gap:D,expandByDefault:U,classNames:q,icons:z,closeButtonAriaLabel:V="Close toast"}=e,[W,$]=je.useState(null),[Z,B]=je.useState(null),[R,Q]=je.useState(!1),[G,te]=je.useState(!1),[oe,re]=je.useState(!1),[se,ue]=je.useState(!1),[me,J]=je.useState(!1),[ne,le]=je.useState(0),[be,fe]=je.useState(0),ae=je.useRef(f.duration||P||iEe),ge=je.useRef(null),ce=je.useRef(null),ye=x===0,K=x+1<=g,X=f.type,de=f.dismissible!==!1,Se=f.className||"",Ce=f.descriptionClassName||"",pe=je.useMemo(()=>v.findIndex(tt=>tt.toastId===f.id)||0,[v,f.id]),Oe=je.useMemo(()=>{var tt;return(tt=f.closeButton)!=null?tt:C},[f.closeButton,C]),Ie=je.useMemo(()=>f.duration||P||iEe,[f.duration,P]),Pe=je.useRef(0),et=je.useRef(0),Ot=je.useRef(0),qt=je.useRef(null),[cn,gn]=F.split("-"),Dt=je.useMemo(()=>v.reduce((tt,Yt,An)=>An>=pe?tt:tt+Yt.height,0),[v,pe]),rt=jdn(),Ge=f.invert||d,Ze=X==="loading";et.current=je.useMemo(()=>pe*D+Dt,[pe,Dt]),je.useEffect(()=>{ae.current=Ie},[Ie]),je.useEffect(()=>{Q(!0)},[]),je.useEffect(()=>{const tt=ce.current;if(tt){const Yt=tt.getBoundingClientRect().height;return fe(Yt),m(An=>[{toastId:f.id,height:Yt,position:f.position},...An]),()=>m(An=>An.filter(rn=>rn.toastId!==f.id))}},[m,f.id]),je.useLayoutEffect(()=>{if(!R)return;const tt=ce.current,Yt=tt.style.height;tt.style.height="auto";const An=tt.getBoundingClientRect().height;tt.style.height=Yt,fe(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 Je=je.useCallback(()=>{te(!0),le(et.current),m(tt=>tt.filter(Yt=>Yt.toastId!==f.id)),setTimeout(()=>{k(f)},Bdn)},[f,k,m,et]);je.useEffect(()=>{if(f.promise&&X==="loading"||f.duration===1/0||f.type==="loading")return;let tt;return O||h||rt?(()=>{if(Ot.current<Pe.current){const rn=new Date().getTime()-Pe.current;ae.current=ae.current-rn}Ot.current=new Date().getTime()})():ae.current!==1/0&&(Pe.current=new Date().getTime(),tt=setTimeout(()=>{f.onAutoClose==null||f.onAutoClose.call(f,f),Je()},ae.current)),()=>clearTimeout(tt)},[O,h,f,X,rt,Je]),je.useEffect(()=>{f.delete&&(Je(),f.onDismiss==null||f.onDismiss.call(f,f))},[Je,f.delete]);function yt(){var tt;if(z?.loading){var Yt;return je.createElement("div",{className:yh(q?.loader,f==null||(Yt=f.classNames)==null?void 0:Yt.loader,"sonner-loader"),"data-visible":X==="loading"},z.loading)}return je.createElement(Sdn,{className:yh(q?.loader,f==null||(tt=f.classNames)==null?void 0:tt.loader),visible:X==="loading"})}const ot=f.icon||z?.[X]||xdn(X);var Mn,Qn;return je.createElement("li",{tabIndex:0,ref:ce,className:yh(I,Se,q?.toast,f==null||(t=f.classNames)==null?void 0:t.toast,q?.default,q?.[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":K,"data-y-position":cn,"data-x-position":gn,"data-index":x,"data-front":ye,"data-swiping":oe,"data-dismissible":de,"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":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${G?ne:et.current}px`,"--initial-height":U?"auto":`${be}px`,...T,...f.style},onDragEnd:()=>{re(!1),$(null),qt.current=null},onPointerDown:tt=>{tt.button!==2&&(Ze||!de||(ge.current=new Date,le(et.current),tt.target.setPointerCapture(tt.pointerId),tt.target.tagName!=="BUTTON"&&(re(!0),qt.current={x:tt.clientX,y:tt.clientY})))},onPointerUp:()=>{var tt,Yt,An;if(se||!de)return;qt.current=null;const rn=Number(((tt=ce.current)==null?void 0:tt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Tr=Number(((Yt=ce.current)==null?void 0:Yt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),In=new Date().getTime()-((An=ge.current)==null?void 0:An.getTime()),jt=W==="x"?rn:Tr,mr=Math.abs(jt)/In;if(Math.abs(jt)>=zdn||mr>.11){le(et.current),f.onDismiss==null||f.onDismiss.call(f,f),B(W==="x"?rn>0?"right":"left":Tr>0?"down":"up"),Je(),ue(!0);return}else{var Sn,ke;(Sn=ce.current)==null||Sn.style.setProperty("--swipe-amount-x","0px"),(ke=ce.current)==null||ke.style.setProperty("--swipe-amount-y","0px")}J(!1),re(!1),$(null)},onPointerMove:tt=>{var Yt,An,rn;if(!qt.current||!de||((Yt=window.getSelection())==null?void 0:Yt.toString().length)>0)return;const In=tt.clientY-qt.current.y,jt=tt.clientX-qt.current.x;var mr;const Sn=(mr=e.swipeDirections)!=null?mr:Udn(F);!W&&(Math.abs(jt)>1||Math.abs(In)>1)&&$(Math.abs(jt)>Math.abs(In)?"x":"y");let ke={x:0,y:0};const Ne=De=>1/(1.5+Math.abs(De)/20);if(W==="y"){if(Sn.includes("top")||Sn.includes("bottom"))if(Sn.includes("top")&&In<0||Sn.includes("bottom")&&In>0)ke.y=In;else{const De=In*Ne(In);ke.y=Math.abs(De)<Math.abs(In)?De:In}}else if(W==="x"&&(Sn.includes("left")||Sn.includes("right")))if(Sn.includes("left")&&jt<0||Sn.includes("right")&&jt>0)ke.x=jt;else{const De=jt*Ne(jt);ke.x=Math.abs(De)<Math.abs(jt)?De:jt}(Math.abs(ke.x)>0||Math.abs(ke.y)>0)&&J(!0),(An=ce.current)==null||An.style.setProperty("--swipe-amount-x",`${ke.x}px`),(rn=ce.current)==null||rn.style.setProperty("--swipe-amount-y",`${ke.y}px`)}},Oe&&!f.jsx&&X!=="loading"?je.createElement("button",{"aria-label":V,"data-disabled":Ze,"data-close-button":!0,onClick:Ze||!de?()=>{}:()=>{Je(),f.onDismiss==null||f.onDismiss.call(f,f)},className:yh(q?.closeButton,f==null||(r=f.classNames)==null?void 0:r.closeButton)},(Qn=z?.close)!=null?Qn:Cdn):null,(X||f.icon||f.promise)&&f.icon!==null&&(z?.[X]!==null||f.icon)?je.createElement("div",{"data-icon":"",className:yh(q?.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,je.createElement("div",{"data-content":"",className:yh(q?.content,f==null||(s=f.classNames)==null?void 0:s.content)},je.createElement("div",{"data-title":"",className:yh(q?.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?je.createElement("div",{"data-description":"",className:yh(M,Ce,q?.description,f==null||(o=f.classNames)==null?void 0:o.description)},typeof f.description=="function"?f.description():f.description):null),je.isValidElement(f.cancel)?f.cancel:f.cancel&&GM(f.cancel)?je.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||j,onClick:tt=>{GM(f.cancel)&&de&&(f.cancel.onClick==null||f.cancel.onClick.call(f.cancel,tt),Je())},className:yh(q?.cancelButton,f==null||(c=f.classNames)==null?void 0:c.cancelButton)},f.cancel.label):null,je.isValidElement(f.action)?f.action:f.action&&GM(f.action)?je.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||A,onClick:tt=>{GM(f.action)&&(f.action.onClick==null||f.action.onClick.call(f.action,tt),!tt.defaultPrevented&&Je())},className:yh(q?.actionButton,f==null||(u=f.classNames)==null?void 0:u.actionButton)},f.action.label):null)};function oEe(){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 Vdn(e,t){const n={};return[e,t].forEach((r,a)=>{const s=a===1,i=s?"--mobile-offset":"--offset",o=s?$dn:Ddn;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 Rst=je.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=Mdn,toastOptions:x,dir:w=oEe(),gap:O=Fdn,icons:k,containerAriaLabel:_="Notifications"}=t,[C,T]=je.useState([]),j=je.useMemo(()=>r?C.filter(R=>R.toasterId===r):C.filter(R=>!R.toasterId),[C,r]),A=je.useMemo(()=>Array.from(new Set([s].concat(j.filter(R=>R.position).map(R=>R.position)))),[j,s]),[I,M]=je.useState([]),[P,F]=je.useState(!1),[D,U]=je.useState(!1),[q,z]=je.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=je.useRef(null),W=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=je.useRef(null),Z=je.useRef(!1),B=je.useCallback(R=>{T(Q=>{var G;return(G=Q.find(te=>te.id===R.id))!=null&&G.delete||Kc.dismiss(R.id),Q.filter(({id:te})=>te!==R.id)})},[]);return je.useEffect(()=>Kc.subscribe(R=>{if(R.dismiss){requestAnimationFrame(()=>{T(Q=>Q.map(G=>G.id===R.id?{...G,delete:!0}:G))});return}setTimeout(()=>{Ple.flushSync(()=>{T(Q=>{const G=Q.findIndex(te=>te.id===R.id);return G!==-1?[...Q.slice(0,G),{...Q[G],...R},...Q.slice(G+1)]:[R,...Q]})})})}),[C]),je.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(te){console.error(te)}})}},[p]),je.useEffect(()=>{C.length<=1&&F(!1)},[C]),je.useEffect(()=>{const R=Q=>{var G;if(i.every(re=>Q[re]||Q.code===re)){var oe;F(!0),(oe=V.current)==null||oe.focus()}Q.code==="Escape"&&(document.activeElement===V.current||(G=V.current)!=null&&G.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),je.useEffect(()=>{if(V.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,Z.current=!1)}},[V.current]),je.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[te,oe]=R.split("-");return j.length?je.createElement("ol",{key:R,dir:w==="auto"?oEe():w,tabIndex:-1,ref:V,className:u,"data-sonner-toaster":!0,"data-sonner-theme":q,"data-y-position":te,"data-x-position":oe,style:{"--front-toast-height":`${((G=I[0])==null?void 0:G.height)||0}px`,"--width":`${Ldn}px`,"--gap":`${O}px`,...g,...Vdn(d,f)},onBlur:re=>{Z.current&&!re.currentTarget.contains(re.relatedTarget)&&(Z.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||Z.current||(Z.current=!0,$.current=re.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{D||F(!1)},onDragEnd:()=>F(!1),onPointerDown:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},j.filter(re=>!re.position&&Q===0||re.position===R).map((re,se)=>{var ue,me;return je.createElement(qdn,{key:re.id,icons:k,index:se,toast:re,defaultRichColors:h,duration:(ue=x?.duration)!=null?ue:m,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:a,visibleToasts:v,closeButton:(me=x?.closeButton)!=null?me:c,interacting:D,position:R,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:B,toasts:j.filter(J=>J.position==re.position),heights:I.filter(J=>J.position==re.position),setHeights:M,expandByDefault:o,gap:O,expanded:P,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 Qdn(e,t,n){const a=Q6((n||{}).ignore||[]),s=Wdn(t);let i=-1;for(;++i<s.length;)ttt(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 x=!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,x=!0),!p.global)break;O=p.exec(u.value)}return x?(m<u.value.length&&w.push({type:"text",value:u.value.slice(m)}),f.children.splice(v,1,...w)):w=[u],v+w.length}}function Wdn(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([Gdn(a[0]),Zdn(a[1])])}return t}function Gdn(e){return typeof e=="string"?new RegExp(Hdn(e),"g"):e}function Zdn(e){return typeof e=="function"?e:function(){return e}}const IU="phrasing",RU=["autolink","link","image","label"];function Ydn(){return{transforms:[rfn],enter:{literalAutolink:Kdn,literalAutolinkEmail:PU,literalAutolinkHttp:PU,literalAutolinkWww:PU},exit:{literalAutolink:nfn,literalAutolinkEmail:tfn,literalAutolinkHttp:Jdn,literalAutolinkWww:efn}}}function Xdn(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:IU,notInConstruct:RU},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:IU,notInConstruct:RU},{character:":",before:"[ps]",after:"\\/",inConstruct:IU,notInConstruct:RU}]}}function Kdn(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function PU(e){this.config.enter.autolinkProtocol.call(this,e)}function Jdn(e){this.config.exit.autolinkProtocol.call(this,e)}function efn(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 tfn(e){this.config.exit.autolinkEmail.call(this,e)}function nfn(e){this.exit(e)}function rfn(e){Qdn(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,afn],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),sfn]],{ignore:["link","linkReference"]})}function afn(e,t,n,r,a){let s="";if(!Pst(a)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!ifn(n)))return!1;const i=ofn(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 sfn(e,t,n,r){return!Pst(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function ifn(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 ofn(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=ZSe(e,"(");let s=ZSe(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 Pst(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Q0(n)||q6(n))&&(!t||n!==47)}Mst.peek=gfn;function lfn(){this.buffer()}function cfn(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ufn(){this.buffer()}function dfn(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ffn(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ap(this.sliceSerialize(e)).toLowerCase(),n.label=t}function pfn(e){this.exit(e)}function hfn(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ap(this.sliceSerialize(e)).toLowerCase(),n.label=t}function mfn(e){this.exit(e)}function gfn(){return"["}function Mst(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 vfn(){return{enter:{gfmFootnoteCallString:lfn,gfmFootnoteCall:cfn,gfmFootnoteDefinitionLabelString:ufn,gfmFootnoteDefinition:dfn},exit:{gfmFootnoteCallString:ffn,gfmFootnoteCall:pfn,gfmFootnoteDefinitionLabelString:hfn,gfmFootnoteDefinition:mfn}}}function yfn(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Mst},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?Dst:bfn))),u(),c}}function bfn(e,t,n){return t===0?e:Dst(e,t,n)}function Dst(e,t,n){return(n?"":" ")+e}const xfn=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];$st.peek=_fn;function wfn(){return{canContainEols:["delete"],enter:{strikethrough:Ofn},exit:{strikethrough:kfn}}}function Sfn(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xfn}],handlers:{delete:$st}}}function Ofn(e){this.enter({type:"delete",children:[]},e)}function kfn(e){this.exit(e)}function $st(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 _fn(){return"~"}function Efn(e){return e.length}function Cfn(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||Efn,s=[],i=[],o=[],c=[];let u=0,d=-1;for(;++d<e.length;){const g=[],v=[];let x=-1;for(e[d].length>u&&(u=e[d].length);++x<e[d].length;){const w=jfn(e[d][x]);if(n.alignDelimiters!==!1){const O=a(w);v[x]=O,(c[x]===void 0||O>c[x])&&(c[x]=O)}g.push(w)}i[d]=g,o[d]=v}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)s[f]=lEe(r[f]);else{const g=lEe(r);for(;++f<u;)s[f]=g}f=-1;const p=[],h=[];for(;++f<u;){const g=s[f];let v="",x="";g===99?(v=":",x=":"):g===108?v=":":g===114&&(x=":");let w=n.alignDelimiters===!1?1:Math.max(1,c[f]-v.length-x.length);const O=v+"-".repeat(w)+x;n.alignDelimiters!==!1&&(w=v.length+w+x.length,w>c[f]&&(c[f]=w),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 x=[];for(;++f<u;){const w=g[f]||"";let O="",k="";if(n.alignDelimiters!==!1){const _=c[f]-(v[f]||0),C=s[f];C===114?O=" ".repeat(_):C===99?_%2?(O=" ".repeat(_/2+.5),k=" ".repeat(_/2-.5)):(O=" ".repeat(_/2),k=O):k=" ".repeat(_)}n.delimiterStart!==!1&&!f&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||f)&&x.push(" "),n.alignDelimiters!==!1&&x.push(O),x.push(w),n.alignDelimiters!==!1&&x.push(k),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&x.push("|")}m.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return m.join(`
218
218
  `)}function jfn(e){return e==null?"":String(e)}function lEe(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 Tfn(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()),Nfn);return a(),i}function Nfn(e,t,n){return">"+(n?"":" ")+e}function Afn(e,t){return cEe(e,t.inConstruct,!0)&&!cEe(e,t.notInConstruct,!1)}function cEe(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 uEe(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
@@ -458,7 +458,7 @@ ${te.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,te=I.length,oe=M.length,re=T(P),se=[],ue=[],me=[],J=W=0;if(!Z)return Se();if(D||D!==!1&&Z.indexOf(z)===-1){for(var ne=Z.split(I),le=0;le<ne.length;le++){if(me=ne[le],W+=me.length,le!==ne.length-1)W+=I.length;else if(R)return Se();if(!M||me.substring(0,oe)!==M){if(re){if(se=[],ye(me.split(A)),Ce(),$)return Se()}else ye(me.split(A));if(F&&F<=le)return se=se.slice(0,F),Se(!0)}}return Se()}for(var be=Z.indexOf(A,W),fe=Z.indexOf(I,W),ae=new RegExp(v(V)+v(z),"g"),ge=Z.indexOf(z,W);;)if(Z[W]===z)for(ge=W,W++;;){if((ge=Z.indexOf(z,ge+1))===-1)return R||ue.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:se.length,index:W}),X();if(ge===Q-1)return X(Z.substring(W,ge).replace(ae,z));if(z===V&&Z[ge+1]===V)ge++;else if(z===V||ge===0||Z[ge-1]!==V){be!==-1&&be<ge+1&&(be=Z.indexOf(A,ge+1));var ce=K((fe=fe!==-1&&fe<ge+1?Z.indexOf(I,ge+1):fe)===-1?be:Math.min(be,fe));if(Z.substr(ge+1+ce,G)===A){me.push(Z.substring(W,ge).replace(ae,z)),Z[W=ge+1+ce+G]!==z&&(ge=Z.indexOf(z,W)),be=Z.indexOf(A,W),fe=Z.indexOf(I,W);break}if(ce=K(fe),Z.substring(ge+1+ce,ge+1+ce+te)===I){if(me.push(Z.substring(W,ge).replace(ae,z)),de(ge+1+ce+te),be=Z.indexOf(A,W),ge=Z.indexOf(z,W),re&&(Ce(),$))return Se();if(F&&se.length>=F)return Se(!0);break}ue.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:se.length,index:W}),ge++}}else if(M&&me.length===0&&Z.substring(W,W+oe)===M){if(fe===-1)return Se();W=fe+te,fe=Z.indexOf(I,W),be=Z.indexOf(A,W)}else if(be!==-1&&(be<fe||fe===-1))me.push(Z.substring(W,be)),W=be+G,be=Z.indexOf(A,W);else{if(fe===-1)break;if(me.push(Z.substring(W,fe)),de(fe+te),re&&(Ce(),$))return Se();if(F&&se.length>=F)return Se(!0)}return X();function ye(pe){se.push(pe),J=W}function K(pe){var Oe=0;return Oe=pe!==-1&&(pe=Z.substring(ge+1,pe))&&pe.trim()===""?pe.length:Oe}function X(pe){return R||(pe===void 0&&(pe=Z.substring(W)),me.push(pe),W=Q,ye(me),re&&Ce()),Se()}function de(pe){W=pe,ye(me),me=[],fe=Z.indexOf(I,W)}function Se(pe){if(j.header&&!B&&se.length&&!q){var Oe=se[0],Ie=Object.create(null),Pe=new Set(Oe);let et=!1;for(let Ot=0;Ot<Oe.length;Ot++){let qt=Oe[Ot];if(Ie[qt=T(j.transformHeader)?j.transformHeader(qt,Ot):qt]){let cn,gn=Ie[qt];for(;cn=qt+"_"+gn,gn++,Pe.has(cn););Pe.add(cn),Oe[Ot]=cn,Ie[qt]++,et=!0,(U=U===null?{}:U)[cn]=qt}else Ie[qt]=1,Oe[Ot]=qt;Pe.add(qt)}et&&console.warn("Duplicate headers found and renamed."),q=!0}return{data:se,errors:ue,meta:{delimiter:A,linebreak:I,aborted:$,truncated:!!pe,cursor:J+(B||0),renamedHeaders:U}}}function Ce(){P(Se()),se=[],ue=[]}},this.abort=function(){$=!0},this.getCharIndex=function(){return W}}function w(j){var A=j.data,I=o[A.workerId],M=!1;if(A.error)I.userError(A.error,A.file);else if(A.results&&A.results.data){var P={abort:function(){M=!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},P),!M);F++);delete A.results}else T(I.userChunk)&&(I.userChunk(A.results,P,A.file),delete A.results)}A.finished&&!M&&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=(M=>M.charCodeAt(0)!==65279?M:M.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 M;return!!u.WORKERS_SUPPORTED&&(M=(()=>{var P=r.URL||r.webkitURL||null,F=n.toString();return u.BLOB_URL||(u.BLOB_URL=P.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"})))})(),(M=new r.Worker(M)).onmessage=w,M.id=c++,o[M.id]=M)})()).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,M=!0,P=",",F=`\r
460
460
  `,D='"',U=D+D,q=!1,z=null,V=!1,W=((()=>{if(typeof A=="object"){if(typeof A.delimiter!="string"||u.BAD_DELIMITERS.filter(function(B){return A.delimiter.indexOf(B)!==-1}).length||(P=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"||(q=A.skipEmptyLines),typeof A.newline=="string"&&(F=A.newline),typeof A.quoteChar=="string"&&(D=A.quoteChar),typeof A.header=="boolean"&&(M=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?V=A.escapeFormulae:typeof A.escapeFormulae=="boolean"&&A.escapeFormulae&&(V=/^[=+\-@\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,q);if(typeof j[0]=="object")return $(z||Object.keys(j[0]),j,q)}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||[],q);throw new Error("Unable to serialize unrecognized input");function $(B,R,Q){var G="",te=(typeof B=="string"&&(B=JSON.parse(B)),typeof R=="string"&&(R=JSON.parse(R)),Array.isArray(B)&&0<B.length),oe=!Array.isArray(R[0]);if(te&&M){for(var re=0;re<B.length;re++)0<re&&(G+=P),G+=Z(B[re],re);0<R.length&&(G+=F)}for(var se=0;se<R.length;se++){var ue=(te?B:R[se]).length,me=!1,J=te?Object.keys(R[se]).length===0:R[se].length===0;if(Q&&!te&&(me=Q==="greedy"?R[se].join("").trim()==="":R[se].length===1&&R[se][0].length===0),Q==="greedy"&&te){for(var ne=[],le=0;le<ue;le++){var be=oe?B[le]:le;ne.push(R[se][be])}me=ne.join("").trim()===""}if(!me){for(var fe=0;fe<ue;fe++){0<fe&&!J&&(G+=P);var ae=te&&oe?B[fe]:fe;G+=Z(R[se][ae],fe)}se<R.length-1&&(!Q||0<ue&&!J)&&(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,V&&typeof B=="string"&&V.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]||((te,oe)=>{for(var re=0;re<oe.length;re++)if(-1<te.indexOf(oe[re]))return!0;return!1})(Q,u.BAD_DELIMITERS)||-1<Q.indexOf(P)||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=x,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)})}),M(),this;function M(){if(I.length===0)T(j.complete)&&j.complete();else{var F,D,U,q,z=I[0];if(T(j.before)){var V=j.before(z.file,z.inputElem);if(typeof V=="object"){if(V.action==="abort")return F="AbortError",D=z.file,U=z.inputElem,q=V.reason,void(T(j.error)&&j.error({name:F},D,U,q));if(V.action==="skip")return void P();typeof V.config=="object"&&(z.instanceConfig=a.extend(z.instanceConfig,V.config))}else if(V==="skip")return void P()}var W=z.instanceConfig.complete;z.instanceConfig.complete=function($){T(W)&&W($,z.file,z.inputElem),P()},u.parse(z.file,z.instanceConfig)}}function P(){I.splice(0,1),M()}}),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})})(J2)),J2.exports}var xer=ber();const cyt=fo(xer);function uyt(e){const t=e;if(t._def?.typeName)return t._def.typeName;const n=t._def?.type;if(typeof n=="string"&&n)return"Zod"+n.charAt(0).toUpperCase()+n.slice(1)}function wer(e,t){const n=e;if(t==="ZodNullable"||t==="ZodOptional"||t==="ZodDefault")return n._zod?.def?.innerType??n._def?.innerType;if(t==="ZodEffects")return n._zod?.def?.schema??n._def?.schema;if(t==="ZodBranded")return n._zod?.def?.type??n._def?.type}var dyt=Ma(["LIVE","TEST"]),fyt=Ma(["AGENT","WORKFLOW",...Object.values(zme)]);Ee({description:we(),prompt:we()});var gA=Vr(we(),Br()),su=gA.optional(),Ser=Ee({runId:we().optional(),input:Br().optional(),output:Br(),additionalContext:su,requestContext:su});Ee({runId:we().optional(),scorer:gA,input:Br(),output:Br(),metadata:su,additionalContext:su,source:dyt,entity:gA,entityType:fyt,requestContext:su,structuredOutput:Rs().optional(),traceId:we().optional(),spanId:we().optional(),resourceId:we().optional(),threadId:we().optional()});var Oer=wn();Ee({result:su,score:Oer,prompt:we().optional()});var ker=Ser.extend({runId:we(),extractStepResult:su,extractPrompt:we().optional()}),_er=ker.extend({score:wn(),analyzeStepResult:su,analyzePrompt:we().optional()});_er.extend({reason:we().optional(),reasonPrompt:we().optional()});var Bme=Ee({id:we(),scorerId:we(),entityId:we(),runId:we(),input:Br().optional(),output:Br(),additionalContext:su,requestContext:su,extractStepResult:su,extractPrompt:we().optional(),score:wn(),analyzeStepResult:su,analyzePrompt:we().optional(),reason:we().optional(),reasonPrompt:we().optional(),scorer:gA,metadata:su,source:dyt,entity:gA,entityType:fyt.optional(),structuredOutput:Rs().optional(),traceId:we().optional(),spanId:we().optional(),resourceId:we().optional(),threadId:we().optional(),preprocessStepResult:su,preprocessPrompt:we().optional(),generateScorePrompt:we().optional(),generateReasonPrompt:we().optional(),...Tme});Bme.omit({id:!0,createdAt:!0,updatedAt:!0});Ee({pagination:iS,scores:Et(Bme)});var pyt=e=>Object.fromEntries(Object.keys(e).map(t=>[t,!0])),Eer=we().describe("Human-readable span name"),Cer=we().describe("Parent span reference (null = root span)"),hyt=Nw(zme).describe("Span type (e.g., WORKFLOW_RUN, AGENT_RUN, TOOL_CALL, etc.)"),jer=Vr(we(),Br()).describe("Span-type specific attributes (e.g., model, tokens, tools)"),Ter=Et(Br()).describe("References to related spans in other traces"),Ner=Br().describe("Input data passed to the span"),Aer=Br().describe("Output data returned from the span"),Ier=Br().describe("Error info - presence indicates failure (status derived from this)"),Rer=Rs().describe("Whether this is an event (point-in-time) vs a span (duration)"),Per=Vp().describe("When the span started"),Mer=Vp().describe("When the span ended (null = running, status derived from this)"),iT=(e=>(e.SUCCESS="success",e.ERROR="error",e.RUNNING="running",e))(iT||{}),myt=Nw(iT).describe("Current status of the trace"),Der=i_(e=>e==="true"?!0:e==="false"?!1:e,Rs()).describe("True if any span in the trace encountered an error"),gyt={...ner,metadata:Dme.nullish(),tags:$me.nullish()},Ume={traceId:$d,spanId:Cv};Ee({...Ume});var $er=pyt(Tme),Ler=pyt(Ume),Q_=Ee({...Ume,name:Eer,spanType:hyt,isEvent:Rer,startedAt:Per,parentSpanId:Cer.nullish(),...gyt,experimentId:we().nullish().describe("Experiment or eval run identifier"),attributes:jer.nullish(),links:Ter.nullish(),input:Ner.nullish(),output:Aer.nullish(),error:Ier.nullish(),endedAt:Mer.nullish(),requestContext:Vr(we(),Br()).nullish().describe("Request context data"),...Tme}).describe("Span record data"),Fer=Q_.extend({status:myt}).describe("Trace span with computed status (root spans only)"),qme=Q_.omit($er);Ee({span:qme}).describe("Arguments for creating a single span");Ee({records:Et(qme)}).describe("Arguments for batch creating spans");Ee({traceId:$d.min(1),spanId:Cv.min(1)}).describe("Arguments for getting a single span");Ee({span:Q_});Ee({traceId:$d.min(1)}).describe("Arguments for getting a root span");Ee({span:Q_});Ee({traceId:$d.min(1)}).describe("Arguments for getting a single trace");Ee({traceId:$d,spans:Et(Q_)});var zer=Ee({startedAt:Wae.optional().describe("Filter by span start time range"),endedAt:Wae.optional().describe("Filter by span end time range"),spanType:hyt.optional(),...gyt,status:myt.optional(),hasChildError:Der.optional()}).describe("Filters for querying traces"),Ber=Ma(["startedAt","endedAt"]).describe("Field to order by: 'startedAt' | 'endedAt'"),Uer=Ee({field:Ber.default("startedAt").describe("Field to order by"),direction:xR.default("DESC").describe("Sort direction")}).describe("Order by configuration");Ee({filters:zer.optional().describe("Optional filters to apply"),pagination:bR.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:Uer.default({field:"startedAt",direction:"DESC"}).describe("Ordering configuration (defaults to startedAt desc)")}).describe("Arguments for listing traces");Ee({pagination:iS,spans:Et(Fer)});var vyt=qme.omit(Ler);Ee({spanId:Cv,traceId:$d,updates:vyt.partial()}).describe("Arguments for updating a single span");Ee({records:Et(Ee({traceId:$d,spanId:Cv,updates:vyt.partial()}))}).describe("Arguments for batch updating spans");Ee({traceIds:Et($d)}).describe("Arguments for batch deleting traces");Ee({pagination:iS,scores:Et(Bme)});Ee({scorerName:we().min(1),targets:Et(Ee({traceId:$d,spanId:Cv.optional()})).min(1)});Ee({status:we(),message:we(),traceCount:wn()});function qer(e){let t=e,n=!1;for(;;){const r=uyt(t);if(!r)break;(r==="ZodNullable"||r==="ZodOptional")&&(n=!0);const a=wer(t,r);if(!a)break;t=a}return{base:t,nullable:n}}function y5e(e){if("_zod"in e){const n=e._zod?.def?.checks;if(n&&Array.isArray(n))return n.map(r=>{if(typeof r=="object"&&r!==null&&"def"in r&&typeof r.def=="object"&&r.def!==null){const a=r.def;return a.check==="number_format"&&a.format==="safeint"?{kind:"int"}:a.check==="string_format"&&typeof a.format=="string"?{kind:a.format}:{kind:typeof a.check=="string"?a.check:"unknown"}}return{kind:"unknown"}})}if("_def"in e){const n=e._def?.checks;if(n&&Array.isArray(n))return n}return[]}function Ver(e){const t=uyt(e);return t==="ZodString"?y5e(e).some(r=>r.kind==="uuid")?"uuid":"text":t==="ZodNativeEnum"||t==="ZodEnum"?"text":t==="ZodNumber"?y5e(e).some(r=>r.kind==="int")?"integer":"float":t==="ZodBigInt"||t==="ZodBigint"?"bigint":t==="ZodDate"?"timestamp":t==="ZodBoolean"?"boolean":"jsonb"}function Her(e){const t=e.shape,n={};for(const[r,a]of Object.entries(t)){const{base:s,nullable:i}=qer(a);n[r]={type:Ver(s),nullable:i}}return n}Her(Q_);var b5e=1,Qer=.9,Wer=.8,Ger=.17,pJ=.1,hJ=.999,Zer=.9999,Yer=.99,Xer=/[\\\/_+.#"@\[\(\{&]/,Ker=/[\\\/_+.#"@\[\(\{&]/g,Jer=/[\s-]/,yyt=/[\s-]/g;function Gae(e,t,n,r,a,s,i){if(s===t.length)return a===e.length?b5e:Yer;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=Gae(e,t,n,r,u+1,s+1,i),f>d&&(u===a?f*=b5e:Xer.test(e.charAt(u-1))?(f*=Wer,h=e.slice(a,u-1).match(Ker),h&&a>0&&(f*=Math.pow(hJ,h.length))):Jer.test(e.charAt(u-1))?(f*=Qer,m=e.slice(a,u-1).match(yyt),m&&a>0&&(f*=Math.pow(hJ,m.length))):(f*=Ger,a>0&&(f*=Math.pow(hJ,u-a))),e.charAt(u)!==t.charAt(s)&&(f*=Zer)),(f<pJ&&n.charAt(u-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(u-1)!==r.charAt(s))&&(p=Gae(e,t,n,r,u+1,s+2,i),p*pJ>f&&(f=p*pJ)),f>d&&(d=f),u=n.indexOf(c,u+1);return i[o]=d,d}function x5e(e){return e.toLowerCase().replace(yyt," ")}function etr(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Gae(e,t,x5e(e),x5e(t),0,0,{})}var IC='[cmdk-group=""]',mJ='[cmdk-group-items=""]',ttr='[cmdk-group-heading=""]',byt='[cmdk-item=""]',w5e=`${byt}:not([aria-disabled="true"])`,Zae="cmdk-item-select",j1="data-value",ntr=(e,t,n)=>etr(e,t,n),xyt=b.createContext(void 0),OR=()=>b.useContext(xyt),wyt=b.createContext(void 0),Vme=()=>b.useContext(wyt),Syt=b.createContext(void 0),Oyt=b.forwardRef((e,t)=>{let n=T1(()=>{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=T1(()=>new Set),a=T1(()=>new Map),s=T1(()=>new Map),i=T1(()=>new Set),o=kyt(e),{label:c,children:u,value:d,onValueChange:f,filter:p,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...x}=e,w=Wi(),O=Wi(),k=Wi(),_=b.useRef(null),C=ptr();Sw(()=>{if(d!==void 0){let B=d.trim();n.current.value=B,T.emit()}},[d]),Sw(()=>{C(6,F)},[]);let T=b.useMemo(()=>({subscribe:B=>(i.current.add(B),()=>i.current.delete(B)),snapshot:()=>n.current,setState:(B,R,Q)=>{var G,te,oe,re;if(!Object.is(n.current[B],R)){if(n.current[B]=R,B==="search")P(),I(),C(1,M);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),((te=o.current)==null?void 0:te.value)!==void 0){let se=R??"";(re=(oe=o.current).onValueChange)==null||re.call(oe,se);return}}T.emit()}},emit:()=>{i.current.forEach(B=>B())}}),[]),j=b.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,()=>{P(),I(),n.current.value||M(),T.emit()}),()=>{s.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let Q=D();C(4,()=>{P(),Q?.getAttribute("id")===B&&M(),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 te=(G=(Q=o.current)==null?void 0:Q.filter)!=null?G:ntr;return B?te(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 te=a.current.get(G),oe=0;te.forEach(re=>{let se=B.get(re);oe=Math.max(se,oe)}),R.push([G,oe])});let Q=_.current;U().sort((G,te)=>{var oe,re;let se=G.getAttribute("id"),ue=te.getAttribute("id");return((oe=B.get(ue))!=null?oe:0)-((re=B.get(se))!=null?re:0)}).forEach(G=>{let te=G.closest(mJ);te?te.appendChild(G.parentElement===te?G:G.closest(`${mJ} > *`)):Q.appendChild(G.parentElement===Q?G:G.closest(`${mJ} > *`))}),R.sort((G,te)=>te[1]-G[1]).forEach(G=>{var te;let oe=(te=_.current)==null?void 0:te.querySelector(`${IC}[${j1}="${encodeURIComponent(G[0])}"]`);oe?.parentElement.appendChild(oe)})}function M(){let B=U().find(Q=>Q.getAttribute("aria-disabled")!=="true"),R=B?.getAttribute(j1);T.setState("value",R||void 0)}function P(){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 te=0;for(let oe of r.current){let re=(R=(B=s.current.get(oe))==null?void 0:B.value)!=null?R:"",se=(G=(Q=s.current.get(oe))==null?void 0:Q.keywords)!=null?G:[],ue=A(re,se);n.current.filtered.items.set(oe,ue),ue>0&&te++}for(let[oe,re]of a.current)for(let se of re)if(n.current.filtered.items.get(se)>0){n.current.filtered.groups.add(oe);break}n.current.filtered.count=te}function F(){var B,R,Q;let G=D();G&&(((B=G.parentElement)==null?void 0:B.firstChild)===G&&((Q=(R=G.closest(IC))==null?void 0:R.querySelector(ttr))==null||Q.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function D(){var B;return(B=_.current)==null?void 0:B.querySelector(`${byt}[aria-selected="true"]`)}function U(){var B;return Array.from(((B=_.current)==null?void 0:B.querySelectorAll(w5e))||[])}function q(B){let R=U()[B];R&&T.setState("value",R.getAttribute(j1))}function z(B){var R;let Q=D(),G=U(),te=G.findIndex(re=>re===Q),oe=G[te+B];(R=o.current)!=null&&R.loop&&(oe=te+B<0?G[G.length-1]:te+B===G.length?G[0]:G[te+B]),oe&&T.setState("value",oe.getAttribute(j1))}function V(B){let R=D(),Q=R?.closest(IC),G;for(;Q&&!G;)Q=B>0?dtr(Q,IC):ftr(Q,IC),G=Q?.querySelector(w5e);G?T.setState("value",G.getAttribute(j1)):z(B)}let W=()=>q(U().length-1),$=B=>{B.preventDefault(),B.metaKey?W():B.altKey?V(1):z(1)},Z=B=>{B.preventDefault(),B.metaKey?q(0):B.altKey?V(-1):z(-1)};return b.createElement(po.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:B=>{var R;(R=x.onKeyDown)==null||R.call(x,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(),q(0);break}case"End":{B.preventDefault(),W();break}case"Enter":{B.preventDefault();let G=D();if(G){let te=new Event(Zae);G.dispatchEvent(te)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:mtr},c),Gz(e,B=>b.createElement(wyt.Provider,{value:T},b.createElement(xyt.Provider,{value:j},B))))}),rtr=b.forwardRef((e,t)=>{var n,r;let a=Wi(),s=b.useRef(null),i=b.useContext(Syt),o=OR(),c=kyt(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;Sw(()=>{if(!u)return o.item(a,i?.id)},[u]);let d=_yt(a,s,[e.value,e.children,s],e.keywords),f=Vme(),p=Nb(C=>C.value&&C.value===d.current),h=Nb(C=>u||o.filter()===!1?!0:C.search?C.filtered.items.get(a)>0:!0);b.useEffect(()=>{let C=s.current;if(!(!C||e.disabled))return C.addEventListener(Zae,m),()=>C.removeEventListener(Zae,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:x,onSelect:w,forceMount:O,keywords:k,..._}=e;return b.createElement(po.div,{ref:cm(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)}),atr=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...s}=e,i=Wi(),o=b.useRef(null),c=b.useRef(null),u=Wi(),d=OR(),f=Nb(h=>a||d.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);Sw(()=>d.group(i),[]),_yt(i,o,[e.value,e.heading,c]);let p=b.useMemo(()=>({id:i,forceMount:a}),[a]);return b.createElement(po.div,{ref:cm(o,t),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Gz(e,h=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Syt.Provider,{value:p},h))))}),str=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=b.useRef(null),s=Nb(i=>!i.search);return!n&&!s?null:b.createElement(po.div,{ref:cm(a,t),...r,"cmdk-separator":"",role:"separator"})}),itr=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,s=Vme(),i=Nb(u=>u.search),o=Nb(u=>u.selectedItemId),c=OR();return b.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),b.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)}})}),otr=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,s=b.useRef(null),i=b.useRef(null),o=Nb(u=>u.selectedItemId),c=OR();return b.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)}}},[]),b.createElement(po.div,{ref:cm(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:c.listId},Gz(e,u=>b.createElement("div",{ref:cm(i,c.listInnerRef),"cmdk-list-sizer":""},u)))}),ltr=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:s,container:i,...o}=e;return b.createElement(u6,{open:n,onOpenChange:r},b.createElement(d6,{container:i},b.createElement(pI,{"cmdk-overlay":"",className:a}),b.createElement(hI,{"aria-label":e.label,"cmdk-dialog":"",className:s},b.createElement(Oyt,{ref:t,...o}))))}),ctr=b.forwardRef((e,t)=>Nb(n=>n.filtered.count===0)?b.createElement(po.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),utr=b.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...s}=e;return b.createElement(po.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Gz(e,i=>b.createElement("div",{"aria-hidden":!0},i)))}),Mu=Object.assign(Oyt,{List:otr,Item:rtr,Input:itr,Group:atr,Separator:str,Dialog:ltr,Empty:ctr,Loading:utr});function dtr(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ftr(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function kyt(e){let t=b.useRef(e);return Sw(()=>{t.current=e}),t}var Sw=typeof window>"u"?b.useEffect:b.useLayoutEffect;function T1(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function Nb(e){let t=Vme(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function _yt(e,t,n,r=[]){let a=b.useRef(),s=OR();return Sw(()=>{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(j1,o),a.current=o}),a}var ptr=()=>{let[e,t]=b.useState(),n=T1(()=>new Map);return Sw(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function htr(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Gz({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(htr(t),{ref:t.ref},n(t.props.children)):n(t)}var mtr={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 Ow(e,t,n,r,a,s){if(e==r)return[];let i=Qme(e,t,n,r,a,s),o=Wme(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=jyt(e,t,n,r,a,s);if(d){let[f,p,h]=d;return Ow(e,t,f,r,a,p).concat(Ow(e,f+h,n,r,p+h,s))}return gtr(e,t,n,r,a,s)}let hj=1e9,mj=0,Hme=!1;function gtr(e,t,n,r,a,s){let i=n-t,o=s-a;if(hj<1e9&&Math.min(i,o)>hj*16||mj>0&&Date.now()>mj)return Math.min(i,o)>hj*64?[new ro(t,n,a,s)]:S5e(e,t,n,r,a,s);let c=Math.ceil((i+o)/2);gJ.reset(c),vJ.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?vJ:null,p=f?null:gJ;for(let h=0;h<c;h++){if(h>hj||mj>0&&!(h&63)&&Date.now()>mj)return S5e(e,t,n,r,a,s);let m=gJ.advance(h,i,o,c,f,!1,u)||vJ.advance(h,i,o,c,p,!0,d);if(m)return vtr(e,t,n,t+m[0],r,a,s,a+m[1])}return[new ro(t,n,a,s)]}class Eyt{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 gJ=new Eyt,vJ=new Eyt;function vtr(e,t,n,r,a,s,i,o){let c=!1;return!Bk(e,r)&&++r==n&&(c=!0),!Bk(a,o)&&++o==i&&(c=!0),c?[new ro(t,n,s,i)]:Ow(e,t,r,a,s,o).concat(Ow(e,r,n,a,o,i))}function Cyt(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n=n<<1;return n}function Qme(e,t,n,r,a,s){if(t==n||t==s||e.charCodeAt(t)!=r.charCodeAt(a))return 0;let i=Cyt(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-(Bk(e,o)?0:1);i=i>>1}else{if(u==n||d==s)return u-t;o=u,c=d}}}function Wme(e,t,n,r,a,s){if(t==n||a==s||e.charCodeAt(n-1)!=r.charCodeAt(s-1))return 0;let i=Cyt(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-(Bk(e,o)?0:1);i=i>>1}else{if(u==t||d==a)return n-u;o=u,c=d}}}function Yae(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;;){Bk(e,d)||d++;let f=d+i;if(Bk(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=Qme(e,f,n,r,a+h+p.length,s),g=Wme(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 jyt(e,t,n,r,a,s){let i=n-t,o=s-a;if(i<o){let c=jyt(r,a,s,e,t,n);return c&&[c[1],c[0],c[2]]}return i<4||o*2<i?null:Yae(e,t,n,r,a,s,Math.floor(i/4),-1)}function S5e(e,t,n,r,a,s){Hme=!0;let i=n-t,o=s-a,c;if(i<o){let p=Yae(r,a,s,e,t,n,Math.floor(i/6),50);c=p&&[p[1],p[0],p[2]]}else c=Yae(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 Ow(e,t,u,r,a,d).concat(Ow(e,u+f,n,r,d+f,s))}function Tyt(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 ytr(e,t,n){for(;;){Tyt(n,1);let r=!1;for(let a=0;a<n.length;a++){let s=n[a],i,o;(i=Qme(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=Wme(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 btr(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=k5e(t,s.fromA,u),p=O5e(t,s.toA,d),h=s.fromA-f,m=p-s.toA;if((!i||!o)&&h&&m){let g=Math.max(i,o),[v,x,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=O5e(t,s.toA,c-s.toA)):g>m&&t.slice(s.toA,p)==v.slice(x,x+m)&&(s=e[a]=new ro(p-i,p,s.fromB+m,s.toB+m),p=s.toA,f=k5e(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=E5e(t,s.fromA,s.toA),v,x=g<0?-1:_5e(t,s.toA,s.fromA);g>-1&&(v=g-s.fromA)<=d&&t.slice(s.fromA,g)==t.slice(s.toA,s.toA+v)?s=e[a]=s.offset(v):x>-1&&(v=s.toA-x)<=u&&t.slice(s.fromA-v,s.fromA)==t.slice(x,s.toA)&&(s=e[a]=s.offset(-v))}}else{let g=E5e(n,s.fromB,s.toB),v,x=g<0?-1:_5e(n,s.toB,s.fromB);g>-1&&(v=g-s.fromB)<=d&&n.slice(s.fromB,g)==n.slice(s.toB,s.toB+v)?s=e[a]=s.offset(v):x>-1&&(v=s.toB-x)<=u&&n.slice(s.fromB-v,s.fromB)==n.slice(x,s.toB)&&(s=e[a]=s.offset(-v))}}r=s.toA}return Tyt(e,3),e}let C0;try{C0=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Nyt(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Ayt(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?Nyt(n)?1:0:C0?!Pyt(n)||t==e.length-1?C0.test(String.fromCharCode(n))?1:0:C0.test(e.slice(t,t+2))?2:0:0}function Iyt(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?Nyt(n)?1:0:C0?!Myt(n)||t==1?C0.test(String.fromCharCode(n))?1:0:C0.test(e.slice(t-2,t))?2:0:0}const Ryt=8;function O5e(e,t,n){if(t==e.length||!Iyt(e,t))return t;for(let r=t,a=t+n,s=0;s<Ryt;s++){let i=Ayt(e,r);if(!i||r+i>a)return r;r+=i}return t}function k5e(e,t,n){if(!t||!Ayt(e,t))return t;for(let r=t,a=t-n,s=0;s<Ryt;s++){let i=Iyt(e,r);if(!i||r-i<a)return r;r-=i}return t}function _5e(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function E5e(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}const Pyt=e=>e>=55296&&e<=56319,Myt=e=>e>=56320&&e<=57343;function Bk(e,t){return!t||t==e.length||!Pyt(e.charCodeAt(t-1))||!Myt(e.charCodeAt(t))}function xtr(e,t,n){var r;let a=n?.override;return a?a(e,t):(hj=((r=n?.scanLimit)!==null&&r!==void 0?r:1e9)>>1,mj=n?.timeout?Date.now()+n.timeout:0,Hme=!1,ytr(e,t,Ow(e,0,e.length,t,0,t.length)))}function Dyt(){return!Hme}function $yt(e,t,n){return btr(xtr(e,t,n),e,t)}const zh=Xt.define({combine:e=>e[0]}),Xae=Kn.define(),wtr=Xt.define(),Uk=ho.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Xae)&&(e=n.value);for(let n of t.state.facet(wtr))e=n(e,t);return e}});class jO{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 jO(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=$yt(t.toString(),n.toString(),r);return Lyt(a,t,n,0,0,Dyt())}static updateA(t,n,r,a,s){return A5e(N5e(t,a,!0,r.length),t,n,r,s)}static updateB(t,n,r,a,s){return A5e(N5e(t,a,!1,n.length),t,n,r,s)}}function C5e(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 j5e(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 Lyt(e,t,n,r,a,s){let i=[];for(let o=0;o<e.length;o++){let c=e[o],[u,d]=C5e(c.fromA+r,c.fromB+a,t,n),[f,p]=j5e(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]=C5e(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]=j5e(m.toA+r,m.toB+a,t,n),o++}i.push(new jO(h,u,Math.max(u,f),d,Math.max(d,p),s))}return i}const MD=1e3;function T5e(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 N5e(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>MD&&([u,f]=T5e(e,s-MD,n,!0)),i<t.length-MD&&([d,p]=T5e(e,i+MD,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 A5e(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=$yt(n.sliceString(f,h),r.sliceString(p,m),a);for(let v of Lyt(g,n,r,f,p,Dyt()))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 Str={scanLimit:500},Fyt=oi.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=P5e(e))}update(e){(e.docChanged||e.viewportChanged||Otr(e.startState,e.state)||ktr(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=P5e(e.view))}},{decorations:e=>e.deco}),DD=Gp.low(Lnt({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(Fyt))===null||t===void 0?void 0:t.gutter)||Hr.empty}}));function Otr(e,t){return e.field(Uk,!1)!=t.field(Uk,!1)}function ktr(e,t){return e.facet(zh)!=t.facet(zh)}const I5e=nn.line({class:"cm-changedLine"}),_tr=nn.mark({class:"cm-changedText"}),Etr=nn.mark({tagName:"ins",class:"cm-insertedLine"}),Ctr=nn.mark({tagName:"del",class:"cm-deletedLine"}),R5e=new class extends fm{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function jtr(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,I5e),a.add(i,o,n?Ctr:Etr),s&&s.add(i,i,R5e);for(let u=t.iterRange(i,o-1),d=i;!u.next().done;){if(u.lineBreak){d++,a.add(d,d,I5e),s&&s.add(d,d,R5e);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,_tr),m<f)c++;else break}d=f}}}function P5e(e){let t=e.state.field(Uk),{side:n,highlightChanges:r,markGutter:a,overrideChunk:s}=e.state.facet(zh),i=n=="a",o=new ku,c=a?new ku:null,{from:u,to:d}=e.viewport;for(let f of t){if((i?f.fromA:f.fromB)>=d)break;(i?f.toA:f.toB)>u&&(!s||!s(e.state,f,o,c))&&jtr(f,e.state.doc,i,r,o,c)}return{deco:o.finish(),gutter:c&&c.finish()}}class $D extends Dd{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 u3=Kn.define({map:(e,t)=>e.map(t)}),gj=ho.define({create:()=>nn.none,update:(e,t)=>{for(let n of t.effects)if(n.is(u3))return n.value;return e.map(t.changes)},provide:e=>gt.decorations.from(e)}),LD=.01;function M5e(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 Ttr(e,t,n){let r=new ku,a=new ku,s=e.state.field(gj).iter(),i=t.state.field(gj).iter(),o=0,c=0,u=0,d=0,f=e.viewport,p=t.viewport;for(let v=0;;v++){let x=v<n.length?n[v]:null,w=x?x.fromA:e.state.doc.length,O=x?x.fromB:t.state.doc.length;if(o<w){let k=e.lineBlockAt(o).top+u,_=t.lineBlockAt(c).top+d,C=k-_;C<-LD?(u-=C,r.add(o,o,nn.widget({widget:new $D(-C),block:!0,side:-1}))):C>LD&&(d+=C,a.add(c,c,nn.widget({widget:new $D(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(x)o=x.toA,c=x.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<LD?r.add(e.state.doc.length,e.state.doc.length,nn.widget({widget:new $D(-h),block:!0,side:1})):h>LD&&a.add(t.state.doc.length,t.state.doc.length,nn.widget({widget:new $D(h),block:!0,side:1}));let m=r.finish(),g=a.finish();M5e(m,e.state.field(gj))||e.dispatch({effects:u3.of(m)}),M5e(g,t.state.field(gj))||t.dispatch({effects:u3.of(g)})}const Kae=Kn.define({map:(e,t)=>t.mapPos(e)});class Ntr extends Dd{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:Kae.of(a)});let{side:s,sibling:i}=t.state.facet(zh);i&&i().dispatch({effects:Kae.of(Atr(a,t.state.field(Uk),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 Itr=ho.define({create(e){return nn.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Kae)&&(e=e.update({filter:r=>r!=n.value}));return e},provide:e=>gt.decorations.from(e)});function D5e({margin:e=3,minSize:t=4}){return Itr.init(n=>Rtr(n,e,t))}function Rtr(e,t,n){let r=new ku,a=e.facet(zh).side=="a",s=e.field(Uk),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 Ntr(f),block:!0})),!c)break;i=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return r.finish()}const Ptr=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"}})),Mtr=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"}}),$5e=new w_,FD=new w_;class Dtr{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||Str;let n=[Gp.low(Fyt),Mtr,Ptr,gj,gt.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(p=>p.effects.some(h=>h.is(u3)))&&this.measure()})],r=[zh.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&r.push(DD);let a=Dr.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],gt.editorAttributes.of({class:"cm-merge-a"}),FD.of(r),n]}),s=[zh.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&s.push(DD);let i=Dr.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],gt.editorAttributes.of({class:"cm-merge-b"}),FD.of(s),n]});this.chunks=jO.build(a.doc,i.doc,this.diffConf);let o=[Uk.init(()=>this.chunks),$5e.of(t.collapseUnchanged?D5e(t.collapseUnchanged):[])];a=a.update({effects:Kn.appendConfig.of(o)}).state,i=i.update({effects:Kn.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?jO.updateA(this.chunks,r.newDoc,this.b.state.doc,a,this.diffConf):jO.updateB(this.chunks,this.a.state.doc,r.newDoc,a,this.diffConf),n.update([...t,r.state.update({effects:Xae.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Xae.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(zh),c=r?t.gutter!==!1:o.markGutter,u=n?t.highlightChanges!==!1:o.highlightChanges;s.push(FD.reconfigure([zh.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:c}),c?DD:[]])),i.push(FD.reconfigure([zh.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:c}),c?DD:[]]))}if(a){let o=$5e.reconfigure(t.collapseUnchanged?D5e(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(){Ttr(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=L5e(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=L5e(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 L5e(e){let t=e.nextSibling;return e.remove(),t}const yJ=[400,401,403,404];function ts(e){return!e||typeof e!="object"?!1:"status"in e&&e.status===403||"statusCode"in e&&e.statusCode===403?!0:"message"in e?e.message.includes("status: 403"):!1}function zyt(e){if(!e||typeof e!="object")return!1;if("status"in e){const t=e.status;return yJ.includes(t)}if("statusCode"in e){const t=e.statusCode;return yJ.includes(t)}if("message"in e){const t=e.message;return yJ.some(n=>t.includes(`status: ${n}`))}return!1}function $tr(e,t){return zyt(t)?!1:e<3}function Ltr(e,t){return t in e&&typeof e[t]=="function"}const Ko=e=>{const t=["listWorkspaces","getWorkspace"],n=fie.has("workspaces-v1"),r=t.every(a=>Ltr(e,a));return n&&r},Byt=e=>{if(!(!e||typeof e!="object")){if("status"in e&&typeof e.status=="number")return e.status;if("statusCode"in e&&typeof e.statusCode=="number")return e.statusCode}},Ftr=(e,t)=>Byt(e)===t,ztr=e=>{const t=Byt(e);return t!==void 0&&t>=400&&t<500},Jae=e=>{if(Ftr(e,501))return!0;if(e&&typeof e=="object"&&"message"in e){const t=e.message;return t.includes("Workspace v1 not supported")||t.includes("501")}return!1},cS=(e,t)=>ztr(t)||Jae(t)||zyt(t)?!1:e<3,F5e={modelSettings:{maxRetries:2,maxSteps:5,chatWithGenerateLegacy:!1,chatWithGenerate:!1}};function Btr({agentId:e,defaultSettings:t}){const[n,r]=b.useState(t),a=`mastra-agent-store-${e}`;return b.useEffect(()=>{try{const o=localStorage.getItem(a),c=o?JSON.parse(o):{},u={...c,modelSettings:{...F5e.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:{...F5e.modelSettings,...t?.modelSettings??{}}};r(o),localStorage.removeItem(a)}}}const Uyt=b.createContext({});function Gme({children:e,agentId:t,defaultSettings:n}){const{settings:r,setSettings:a,resetAll:s}=Btr({agentId:t,defaultSettings:n});return l.jsx(Uyt.Provider,{value:{settings:r,setSettings:a,resetAll:s},children:e})}const Zme=()=>b.useContext(Uyt),Ur=Ole()(FDt(e=>({requestContext:{},theme:"dark",setRequestContext:t=>e({requestContext:t}),setTheme:t=>e({theme:t})}),{name:"mastra-playground-store"})),ese=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;function Utr(e){return ese?.addEventListener("change",e),()=>ese?.removeEventListener("change",e)}function qtr(){return ese?.matches??!0}function Zz(){const e=Ur(n=>n.theme),t=b.useSyncExternalStore(Utr,qtr,()=>!0);return e==="system"?t:e==="dark"}const Yme=b.createContext(null);function kR({children:e}){const{requestContext:t}=Ur(),[n,r]=b.useState(t),a=i=>r(i),s=()=>{r({})};return l.jsx(Yme.Provider,{value:{schemaValues:n,setSchemaValues:a,clearSchemaValues:s},children:e})}function qyt(){const e=b.useContext(Yme);if(!e)throw new Error("useSchemaRequestContext must be used within a SchemaRequestContextProvider");return e}function vo(){const{requestContext:e}=Ur(),n=b.useContext(Yme)?.schemaValues??{};return{...e??{},...n}}const Vyt=({threadId:e,agentId:t,memory:n})=>{const r=Ue(),{requestContext:a}=Ur();return xt({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})},Vtr=({multiple:e=!0,onChange:t}={})=>{const n=KBt(s=>!s.isEditing),r=uI(),a=b.useCallback(()=>{const s=document.createElement("input");s.type="file",s.multiple=e,s.hidden=!0;const i=r.getState().attachmentAccept;i&&i!=="*"&&(s.accept=i),document.body.appendChild(s),s.onchange=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},Vl={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},_R="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",Qtr="rounded-md",Xme="bg-surface2 border-2 border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",Kme="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",Jme="disabled:opacity-50 disabled:cursor-not-allowed";function Hyt(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=Hyt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Qyt(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Hyt(e))&&(r&&(r+=" "),r+=t);return r}const Wtr=(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},Gtr=(e,t)=>({classGroupId:e,validator:t}),Wyt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),d3="-",z5e=[],Ztr="arbitrary..",Ytr=e=>{const t=Ktr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Xtr(i);const o=i.split(d3),c=o[0]===""&&o.length>1?1:0;return Gyt(o,c,t)},getConflictingClassGroupIds:(i,o)=>{if(o){const c=r[i],u=n[i];return c?u?Wtr(u,c):c:u||z5e}return n[i]||z5e}}},Gyt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],s=n.nextPart.get(a);if(s){const u=Gyt(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const o=t===0?e.join(d3):e.slice(t).join(d3),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?Ztr+r:void 0})(),Ktr=e=>{const{theme:t,classGroups:n}=e;return Jtr(n,t)},Jtr=(e,t)=>{const n=Wyt();for(const r in e){const a=e[r];ege(a,n,r,t)}return n},ege=(e,t,n,r)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];enr(i,t,n,r)}},enr=(e,t,n,r)=>{if(typeof e=="string"){tnr(e,t,n);return}if(typeof e=="function"){nnr(e,t,n,r);return}rnr(e,t,n,r)},tnr=(e,t,n)=>{const r=e===""?t:Zyt(t,e);r.classGroupId=n},nnr=(e,t,n,r)=>{if(anr(e)){ege(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Gtr(n,e))},rnr=(e,t,n,r)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[o,c]=a[i];ege(c,Zyt(t,o),n,r)}},Zyt=(e,t)=>{let n=e;const r=t.split(d3),a=r.length;for(let s=0;s<a;s++){const i=r[s];let o=n.nextPart.get(i);o||(o=Wyt(),n.nextPart.set(i,o)),n=o}return n},anr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,snr=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)}}},tse="!",B5e=":",inr=[],U5e=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),onr=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const s=[];let i=0,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===B5e){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(tse)?(p=f.slice(0,-1),h=!0):f.startsWith(tse)&&(p=f.slice(1),h=!0);const m=u&&u>c?u-c:void 0;return U5e(s,h,p,m)};if(t){const a=t+B5e,s=r;r=i=>i.startsWith(a)?s(i.slice(a.length)):U5e(inr,!1,i,void 0,!0)}if(n){const a=r;r=s=>n({className:s,parseClassName:a})}return r},lnr=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}},cnr=e=>({cache:snr(e.cacheSize),parseClassName:onr(e),sortModifiers:lnr(e),...Ytr(e)}),unr=/\s+/,dnr=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],o=e.trim().split(unr);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,x=r(v?m.substring(0,g):m);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=r(m),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const w=p.length===0?"":p.length===1?p[0]:s(p).join(":"),O=h?w+tse:w,k=O+x;if(i.indexOf(k)>-1)continue;i.push(k);const _=a(x,v);for(let C=0;C<_.length;++C){const T=_[C];i.push(O+T)}c=d+(c.length>0?" "+c:c)}return c},fnr=(...e)=>{let t=0,n,r,a="";for(;t<e.length;)(n=e[t++])&&(r=Yyt(n))&&(a&&(a+=" "),a+=r);return a},Yyt=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Yyt(e[r]))&&(n&&(n+=" "),n+=t);return n},q5e=(e,...t)=>{let n,r,a,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=cnr(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=dnr(c,n);return a(c,d),d};return s=i,(...c)=>s(fnr(...c))},pnr=[],wo=e=>{const t=n=>n[e]||pnr;return t.isThemeGetter=!0,t},Xyt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Kyt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,hnr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,mnr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gnr=/\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$/,vnr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ynr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bnr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vy=e=>hnr.test(e),Pr=e=>!!e&&!Number.isNaN(Number(e)),yy=e=>!!e&&Number.isInteger(Number(e)),bJ=e=>e.endsWith("%")&&Pr(e.slice(0,-1)),pg=e=>mnr.test(e),Jyt=()=>!0,xnr=e=>gnr.test(e)&&!vnr.test(e),tge=()=>!1,wnr=e=>ynr.test(e),Snr=e=>bnr.test(e),Onr=e=>!pn(e)&&!bn(e),knr=e=>Yb(e,nbt,tge),pn=e=>Xyt.test(e),Dx=e=>Yb(e,rbt,xnr),V5e=e=>Yb(e,Inr,Pr),_nr=e=>Yb(e,sbt,Jyt),Enr=e=>Yb(e,abt,tge),H5e=e=>Yb(e,ebt,tge),Cnr=e=>Yb(e,tbt,Snr),zD=e=>Yb(e,ibt,wnr),bn=e=>Kyt.test(e),RC=e=>uS(e,rbt),jnr=e=>uS(e,abt),Q5e=e=>uS(e,ebt),Tnr=e=>uS(e,nbt),Nnr=e=>uS(e,tbt),BD=e=>uS(e,ibt,!0),Anr=e=>uS(e,sbt,!0),Yb=(e,t,n)=>{const r=Xyt.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},uS=(e,t,n=!1)=>{const r=Kyt.exec(e);return r?r[1]?t(r[1]):n:!1},ebt=e=>e==="position"||e==="percentage",tbt=e=>e==="image"||e==="url",nbt=e=>e==="length"||e==="size"||e==="bg-size",rbt=e=>e==="length",Inr=e=>e==="number",abt=e=>e==="family-name",sbt=e=>e==="number"||e==="weight",ibt=e=>e==="shadow",W5e=()=>{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"),x=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(),bn,pn],C=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[bn,pn,c],A=()=>[vy,"full","auto",...j()],I=()=>[yy,"none","subgrid",bn,pn],M=()=>["auto",{span:["full",yy,bn,pn]},yy,bn,pn],P=()=>[yy,"auto",bn,pn],F=()=>["auto","min","max","fr",bn,pn],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...j()],z=()=>[vy,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],V=()=>[vy,"screen","full","dvw","lvw","svw","min","max","fit",...j()],W=()=>[vy,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],$=()=>[e,bn,pn],Z=()=>[...k(),Q5e,H5e,{position:[bn,pn]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],R=()=>["auto","cover","contain",Tnr,knr,{size:[bn,pn]}],Q=()=>[bJ,RC,Dx],G=()=>["","none","full",u,bn,pn],te=()=>["",Pr,RC,Dx],oe=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[Pr,bJ,Q5e,H5e],ue=()=>["","none",m,bn,pn],me=()=>["none",Pr,bn,pn],J=()=>["none",Pr,bn,pn],ne=()=>[Pr,bn,pn],le=()=>[vy,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pg],breakpoint:[pg],color:[Jyt],container:[pg],"drop-shadow":[pg],ease:["in","out","in-out"],font:[Onr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pg],shadow:[pg],spacing:["px",Pr],text:[pg],"text-shadow":[pg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vy,pn,bn,v]}],container:["container"],columns:[{columns:[Pr,pn,bn,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:[yy,"auto",bn,pn]}],basis:[{basis:[vy,"full","auto",o,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pr,vy,"auto","initial","none",pn]}],grow:[{grow:["",Pr,bn,pn]}],shrink:[{shrink:["",Pr,bn,pn]}],order:[{order:[yy,"first","last","none",bn,pn]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"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:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"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",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"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,RC,Dx]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Anr,_nr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",bJ,pn]}],"font-family":[{font:[jnr,Enr,t]}],"font-features":[{"font-features":[pn]}],"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,bn,pn]}],"line-clamp":[{"line-clamp":[Pr,"none",bn,V5e]}],leading:[{leading:[s,...j()]}],"list-image":[{"list-image":["none",bn,pn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",bn,pn]}],"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:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Pr,"from-font","auto",bn,Dx]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Pr,"auto",bn,pn]}],"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",bn,pn]}],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",bn,pn]}],"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"]},yy,bn,pn],radial:["",bn,pn],conic:[yy,bn,pn]},Nnr,Cnr]}],"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:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-bs":[{"border-bs":te()}],"border-w-be":[{"border-be":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"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:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Pr,bn,pn]}],"outline-w":[{outline:["",Pr,RC,Dx]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",d,BD,zD]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",f,BD,zD]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Pr,Dx]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",p,BD,zD]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Pr,bn,pn]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"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":[Pr]}],"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":[bn,pn]}],"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":[Pr]}],"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",bn,pn]}],filter:[{filter:["","none",bn,pn]}],blur:[{blur:ue()}],brightness:[{brightness:[Pr,bn,pn]}],contrast:[{contrast:[Pr,bn,pn]}],"drop-shadow":[{"drop-shadow":["","none",h,BD,zD]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Pr,bn,pn]}],"hue-rotate":[{"hue-rotate":[Pr,bn,pn]}],invert:[{invert:["",Pr,bn,pn]}],saturate:[{saturate:[Pr,bn,pn]}],sepia:[{sepia:["",Pr,bn,pn]}],"backdrop-filter":[{"backdrop-filter":["","none",bn,pn]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Pr,bn,pn]}],"backdrop-contrast":[{"backdrop-contrast":[Pr,bn,pn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pr,bn,pn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pr,bn,pn]}],"backdrop-invert":[{"backdrop-invert":["",Pr,bn,pn]}],"backdrop-opacity":[{"backdrop-opacity":[Pr,bn,pn]}],"backdrop-saturate":[{"backdrop-saturate":[Pr,bn,pn]}],"backdrop-sepia":[{"backdrop-sepia":["",Pr,bn,pn]}],"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",bn,pn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Pr,"initial",bn,pn]}],ease:[{ease:["linear","initial",x,bn,pn]}],delay:[{delay:[Pr,bn,pn]}],animate:[{animate:["none",w,bn,pn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,bn,pn]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:J()}],"scale-x":[{"scale-x":J()}],"scale-y":[{"scale-y":J()}],"scale-z":[{"scale-z":J()}],"scale-3d":["scale-3d"],skew:[{skew:ne()}],"skew-x":[{"skew-x":ne()}],"skew-y":[{"skew-y":ne()}],transform:[{transform:[bn,pn,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"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",bn,pn]}],"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",bn,pn]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[Pr,RC,Dx,V5e]}],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"]}},Rnr=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:a={},override:s={}})=>(vj(e,"cacheSize",t),vj(e,"prefix",n),vj(e,"experimentalParseClassName",r),UD(e.theme,s.theme),UD(e.classGroups,s.classGroups),UD(e.conflictingClassGroups,s.conflictingClassGroups),UD(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),vj(e,"orderSensitiveModifiers",s.orderSensitiveModifiers),qD(e.theme,a.theme),qD(e.classGroups,a.classGroups),qD(e.conflictingClassGroups,a.conflictingClassGroups),qD(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),obt(e,a,"orderSensitiveModifiers"),e),vj=(e,t,n)=>{n!==void 0&&(e[t]=n)},UD=(e,t)=>{if(t)for(const n in t)vj(e,n,t[n])},qD=(e,t)=>{if(t)for(const n in t)obt(e,t,n)},obt=(e,t,n)=>{const r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},Pnr=(e,...t)=>typeof e=="function"?q5e(W5e,e,...t):q5e(()=>Rnr(W5e(),e),...t),Mnr=Object.keys({...U6,...YYt}),Dnr=Object.keys(nXt),$nr=Object.keys(XYt),Lnr=Object.keys(KYt),Fnr=Object.keys(ZYt),$x=Object.keys(tXt),znr=Object.keys(JYt).concat(Object.keys(eXt)),Bnr=Pnr({extend:{theme:{color:Mnr,spacing:Dnr,radius:Fnr,leading:Lnr,shadow:znr},classGroups:{"font-size":[{text:$nr}],h:[{h:$x}],w:[{w:$x}],size:[{size:$x}],"min-h":[{"min-h":$x}],"min-w":[{"min-w":$x}],"max-h":[{"max-h":$x}],"max-w":[{"max-w":$x}]}}});function Y(...e){return Bnr(Qyt(e))}const Unr={sm:`${Vl.sm} text-ui-sm px-[.75em]`,md:`${Vl.md} text-ui-md px-[.75em]`,default:`${Vl.default} text-ui-md px-[.85em] `,lg:`${Vl.lg} text-ui-lg px-[1em] `},qnr={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:Xme,light:"",outline:""},Vnr=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",Jme,Kme),Hnr={light:"default",outline:"default"};function Qnr(e){return Hnr[e]??e}function W_(e){const t=Qnr(e?.variant||"default"),n=e?.size||"default";return Y(Vnr,qnr[t],Unr[n],e?.iconOnly&&"[&>svg]:opacity-75")}function lbt(e){const t=[];return je.Children.forEach(e,n=>{je.isValidElement(n)&&n.type===je.Fragment?t.push(...lbt(n.props.children)):t.push(n)}),t}function Wnr(e){const t=lbt(e);return t.length>0&&t.every(n=>je.isValidElement(n))}const xe=je.forwardRef(({className:e,as:t,size:n="default",variant:r="default",disabled:a,children:s,...i},o)=>{const c=t||"button",u=Wnr(s);return l.jsx(c,{ref:o,disabled:a,className:Y(W_({variant:r,size:n,iconOnly:u}),e),...i,children:s})});xe.displayName="Button";const $c=aFt,sr=sFt,ir=iFt,er=b.forwardRef(({className:e,sideOffset:t=4,children:n,...r},a)=>l.jsx(oFt,{children:l.jsxs(aGe,{ref:a,sideOffset:t,className:Y("z-50 overflow-hidden rounded-md bg-surface3 px-3 py-1.5 text-xs text-neutral4 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r,children:[n,l.jsx(lFt,{className:"fill-surface3"})]})}));er.displayName=aGe.displayName;const Qs=je.forwardRef(({tooltipContent:e,...t},n)=>l.jsxs(sr,{children:[l.jsx(ir,{asChild:!0,children:l.jsx(xe,{ref:n,...t})}),e&&l.jsx(er,{children:e})]}));Qs.displayName="ButtonWithTooltip";const _r=u6,cbt=hYe,Gnr=d6,ubt=b.forwardRef(({className:e,...t},n)=>l.jsx(pI,{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}));ubt.displayName=pI.displayName;const yr=b.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(Gnr,{children:[l.jsx(ubt,{}),l.jsxs(hI,{ref:r,className:Y("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-bottom-4","data-[state=open]:slide-in-from-bottom-4",e),...n,children:[t,l.jsxs(h6,{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(Hn,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yr.displayName=hI.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 Ad=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ad.displayName="DialogFooter";const Fr=({className:e,...t})=>l.jsx("div",{className:Y("overflow-y-auto px-6 max-h-[50vh]",e),...t});Fr.displayName="DialogBody";const br=b.forwardRef(({className:e,...t},n)=>l.jsx(f6,{ref:n,className:Y("text-ui-md font-medium",e),...t}));br.displayName=f6.displayName;const Ya=b.forwardRef(({className:e,...t},n)=>l.jsx(p6,{ref:n,className:Y("sr-only",e),...t}));Ya.displayName=p6.displayName;const G5e=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Z5e=Qyt,ER=(e,t)=>n=>{var r;if(t?.variants==null)return Z5e(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=G5e(d)||G5e(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 Z5e(e,i,c,n?.class,n?.className)},Znr=ER(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(Xme,Kme,Jme),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${Vl.sm} text-ui-sm px-[.75em]`,md:`${Vl.md} text-ui-md px-[.75em]`,default:`${Vl.default} text-ui-md px-[.85em]`,lg:`${Vl.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),an=b.forwardRef(({className:e,size:t,testId:n,variant:r,type:a,error:s,...i},o)=>l.jsx("input",{type:a,className:Y(Znr({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 Ynr=ER("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),bt=b.forwardRef(({className:e,...t},n)=>l.jsx(Ret,{ref:n,className:Y(Ynr(),e),...t}));bt.displayName=Ret.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"},Knr={mono:"font-mono"},ve=({as:e="p",className:t,variant:n="ui-md",font:r,...a})=>l.jsx(e,{className:Y(Xnr[n],r&&Knr[r],t),...a}),Xs=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"})]}),Jnr=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)"})})})]}),err=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"})]}),nge=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"})]}),rge=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"})]}),mc=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"})}),dbt=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)"})})})]}),fbt=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)"})})})]}),trr={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",trr[n],t),...r,children:e}),nrr=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"})]}),pbt=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"})}),age=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"})}),rrr=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"})}),Ao=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"})}),G_=e=>l.jsx(qYt,{...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"})}),Tu=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"})]}),arr=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 TO(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 srr={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"},irr=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 srr[a]}},orr=({onOpenChange:e,open:t})=>{const n=uI(),r=Vtr({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 irr(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(Ya,{children:"Add a file attachment via URL or from your computer"})]}),l.jsxs(Fr,{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(bt,{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(xe,{type:"submit",className:"h-8!",variant:"light",children:[l.jsx(_e,{children:l.jsx(cZt,{})}),"Add"]})]}),l.jsx("hr",{className:"my-2 border border-border1"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ve,{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(GWt,{className:"size-12"}),l.jsx(ve,{variant:"header-md",children:"Add a local file"})]})]})]})]})})},lrr=e=>{const[t,n]=b.useState(void 0);return b.useEffect(()=>{if(!e){n(void 0);return}const r=URL.createObjectURL(e);return n(r),()=>{URL.revokeObjectURL(r)}},[e]),t},crr=()=>{const{file:e,src:t}=x2(CZe(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 lrr(e)??t},urr=()=>{const e=uI(),[t,n]=b.useState(!1);return b.useEffect(()=>{e.subscribe(()=>{const r=e.getState().attachments;n(r.length>0)})},[e]),t},drr=e=>{const[t,n]=b.useState({isLoading:!1,text:""});return b.useEffect(()=>{if(!e)return;(async()=>{n(s=>({...s,isLoading:!0}));const a=await e.text();n(s=>({...s,isLoading:!1,text:a}))})()},[e]),t},f3="h-full w-full flex items-center justify-center",hbt=({data:e,url:t})=>{const[n,r]=b.useState(!1);return t?l.jsx("a",{href:t,className:f3,target:"_blank",rel:"noreferrer noopener",children:l.jsx(Df,{className:"text-accent2","aria-label":"View PDF"})}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>r(!0),className:f3,type:"button",children:l.jsx(Df,{className:"text-accent2","aria-label":"View PDF"})}),l.jsx(frr,{data:e,open:n,onOpenChange:r})]})},frr=({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(Ya,{children:"Preview of the PDF document"})]}),l.jsx(Fr,{children:t&&l.jsx("iframe",{src:e,width:"100%",height:"600px"})})]})}),mbt=({src:e})=>{const[t,n]=b.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>n(!0),type:"button",className:f3,children:l.jsx("img",{src:e,className:"object-cover aspect-ratio max-h-[140px] max-w-[320px]",alt:"Preview"})}),l.jsx(prr,{src:e,open:t,onOpenChange:n})]})},prr=({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(Ya,{children:"Preview of the image"})]}),l.jsx(Fr,{children:t&&l.jsx("img",{src:e,alt:"Image"})})]})}),gbt=({data:e})=>{const[t,n]=b.useState(!1),r=e.replace(/<attachment[^>]*>/,"").replace(/<\/attachment>/g,"");return l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>n(!0),className:f3,type:"button",children:l.jsx(Df,{className:"text-neutral3"})}),l.jsx(hrr,{data:r,open:t,onOpenChange:n})]})},hrr=({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(Ya,{children:"Preview of the text file"})]}),l.jsx(Fr,{children:t&&l.jsx("div",{className:"whitespace-pre-wrap",children:e})})]})}),mrr={sm:`${Vl.sm} w-form-sm`,md:`${Vl.md} w-form-md`,lg:`${Vl.lg} w-form-lg`,default:`${Vl.default}`},grr={sm:"sm",md:"default",lg:"lg",default:"default"},vrr={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"},yrr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",jr=je.forwardRef(({className:e,children:t,tooltip:n,size:r="md",variant:a="default",disabled:s,...i},o)=>l.jsxs(sr,{children:[l.jsx(ir,{asChild:!0,children:l.jsx("button",{ref:o,disabled:s,"aria-label":typeof n=="string"?n:void 0,className:Y(yrr,_R,vrr[a],mrr[r],s&&"active:scale-100",e),...i,children:l.jsx(_e,{size:grr[r],children:t})})}),l.jsx(er,{children:n})]}));jr.displayName="IconButton";const brr={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",brr[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 vbt=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)}),xrr=({document:e})=>{const{isLoading:t,text:n}=drr(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(gbt,{data:n})})},wrr=({document:e})=>{const[t,n]=b.useState({isLoading:!1,text:""});b.useEffect(()=>{let a=!1;return(async()=>{if(!e.file)return;n(o=>({...o,isLoading:!0}));const i=await vbt(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(hbt,{data:t.text,url:r?e.file?.name:void 0})})},Srr=()=>{const e=x2(i=>i.type==="image"),t=x2(i=>i.type==="document"?i:void 0),n=crr(),r=x2(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(Y5,{children:l.jsxs(sr,{children:[l.jsx(LJe,{children:l.jsx(ir,{asChild:!0,children:l.jsx("div",{className:"overflow-hidden size-16 rounded-lg bg-surface3 border border-border1 ",children:e?l.jsx(mbt,{src:s??""}):t?.contentType==="application/pdf"?l.jsx(wrr,{document:t}):t?l.jsx(xrr,{document:t}):null})})}),l.jsx(er,{side:"top",children:l.jsx(FJe,{})})]})}),r&&l.jsx(Orr,{})]})})},Orr=()=>l.jsx(nQt,{asChild:!0,children:l.jsx(jr,{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(xb,{})})})}),krr=()=>urr()?l.jsx("div",{className:"flex w-full flex-row items-center gap-4 pb-2",children:l.jsx(IZe,{components:{Attachment:Srr}})}):null;function _rr({containerRef:e}){const[t,n]=b.useState([]),[r,a]=b.useState(null),s=b.useRef(""),i=b.useRef(0),o=b.useCallback(()=>{const u=e.current;if(!u){s.current!==""&&(s.current="",n([]));return}const d=u.getBoundingClientRect(),f=Array.from(u.querySelectorAll("[data-om-badge]"));if(f.length===0){s.current!==""&&(s.current="",n([]));return}const p=[];for(let m=0;m<f.length;m++){const g=f[m],v=g.getAttribute("data-om-badge")||"",x=g.getAttribute("data-om-state")||"complete",w=g.getAttribute("data-om-type")||"observation",O=g.getBoundingClientRect();let k;const _=Err(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:x,top:k,height:j})}const h=JSON.stringify(p);h!==s.current&&(s.current=h,n(p))},[e]);if(b.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]),b.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(Crr,{highlight:u,visible:p},u.cycleId)})})}function Err(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 Crr({highlight:e,visible:t}){const n=jrr(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 jrr(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 Gn={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"},Xb={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},Trr={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"},Nrr={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",Gn.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":Trr[t],n),...a,children:[e&&l.jsx("span",{className:Nrr[t],children:l.jsx(_e,{children:e})}),r]}),Yz=({children:e,initialCollapsed:t=!0,icon:n,title:r,collapsible:a=!0,extraInfo:s,"data-testid":i})=>{const[o,c]=b.useState(t);return b.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(hv,{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 Arr(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 Irr(e){const t=Arr(e);return yrt({override:[Rrr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function Rrr(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 Prr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,Mrr=nn.mark({class:"cm-variable-highlight"}),Y5e=new Pnt({regexp:Prr,decoration:()=>Mrr}),Drr=oi.fromClass(class{decorations;constructor(e){this.decorations=Y5e.createDeco(e)}update(e){this.decorations=Y5e.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),$rr=Drr,Lrr={duration:5e3,cancel:{label:l.jsx(_e,{children:l.jsx(Hn,{})}),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 wd(e){const{classNames:t,...n}=Lrr,{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 Re=(e,t={})=>{if(Array.isArray(e))return e.forEach(n=>Wl(n,wd(t)));if(je.isValidElement(e))return Wl(e,wd(t));if(typeof e=="string")return Wl(e,wd(t));throw new Error("Invalid message type")};Re.success=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent1 shrink-0",children:l.jsx(due,{})}),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 Wl.success(e,wd(n));case"object":return e.forEach(r=>Wl.success(r,wd(n)))}};Re.error=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent2 shrink-0",children:l.jsx(xb,{})}),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 Wl.error(e,wd(n));case"object":return e.forEach(r=>Wl.error(r,wd(n)))}};Re.warning=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent6 shrink-0",children:l.jsx(bb,{})}),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 Wl.warning(e,wd(n));case"object":return e.forEach(r=>Wl.warning(r,wd(n)))}};Re.info=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent3 shrink-0",children:l.jsx(Bl,{})}),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 Wl.info(e,wd(n));case"object":return e.forEach(r=>Wl.info(r,wd(n)))}};Re.custom=(e,t={})=>Wl(e,wd(t));Re.dismiss=e=>{e&&Wl.dismiss(e)};Re.promise=({myPromise:e,loadingMessage:t,successMessage:n,errorMessage:r,onSuccess:a,onError:s,options:i={}})=>Wl.promise(e,{loading:t??"Loading...",success:o=>(a?.(o),n),error:o=>(s?.(o),r||o?.message||"Error..."),...wd(i)});function Bf({text:e,copyMessage:t="Copied to clipboard!"}){const[n,r]=b.useState(!1),a=b.useRef(null),s=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{Re.success(t),r(!0),a.current&&(clearTimeout(a.current),a.current=null),a.current=setTimeout(()=>{r(!1)},2e3)}).catch(()=>{Re.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:n,handleCopy:s}}function hi({content:e,copyMessage:t,tooltip:n="Copy to clipboard",size:r="sm",className:a}){const[s,i]=b.useState(!1),{handleCopy:o}=Bf({text:e,copyMessage:t}),c=()=>{o(),i(!0),setTimeout(()=>i(!1),2e3)};return l.jsxs(sr,{children:[l.jsx(ir,{asChild:!0,children:l.jsx(xe,{onClick:c,type:"button",size:r,className:a,"aria-label":s?"Copied!":n,children:s?l.jsx(ua,{}):l.jsx(Xl,{})})}),l.jsx(er,{children:s?"Copied!":n})]})}function Frr(){const e=PI({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 zrr(){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=Am.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,Zw(t)]}const jv=()=>{const e=Zz();return b.useMemo(()=>e?Frr():zrr(),[e])},la=b.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=jv(),m=e?JSON.stringify(e,null,2):t??"",g=b.useMemo(()=>{const v=[];return s==="json"?v.push(vd):s==="markdown"&&(v.push(Ede({base:nw,codeLanguages:zat})),v.push(gt.lineWrapping)),i&&s==="markdown"&&v.push($rr),c&&s==="markdown"&&v.push(Irr(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(hi,{content:m,className:"absolute top-2 right-2 z-20"}),l.jsx(Eu,{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 Brr(e,t){const{codeToTokens:n,bundledLanguages:r}=await We(async()=>{const{codeToTokens:s,bundledLanguages:i}=await import("./index-DDzr7qHk.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 Urr=({selectionReason:e,open:t,onOpenChange:n,input:r})=>{let a=null;if(r)try{a=typeof r=="object"?l.jsx(la,{data:r}):l.jsx(la,{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(Ya,{children:"View the metadata of the agent's network choice."})]}),l.jsxs(Fr,{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ve,{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(ve,{className:"text-neutral3",children:"Input"}),l.jsx("div",{className:"text-neutral6 text-ui-md",children:a})]})]})]})})},sge=({selectionReason:e,input:t})=>{const[n,r]=b.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(jr,{variant:"light",size:"md",tooltip:"Show selection reason",onClick:()=>r(a=>!a),children:l.jsx(hYt,{className:"text-neutral3 size-5"})}),l.jsx(Urr,{selectionReason:e||"",open:n,onOpenChange:r,input:t})]})},ybt=b.createContext(void 0);function qrr({children:e,approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:c,networkToolCallApprovals:u}){return l.jsx(ybt.Provider,{value:{approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:c,networkToolCallApprovals:u},children:e})}function Vrr(){const e=b.useContext(ybt);if(!e)throw new Error("useToolCall must be used within a ToolCallProvider");return e}const CR=({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}=Vrr(),g=()=>{a?p(r,n?.runId):s?c(t):i(t)},v=()=>{a?h(r,n?.runId):s?u(t):o(t)},x=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(xe,{onClick:g,disabled:d||!!x,className:x==="approved"?"text-accent1!":"",children:[l.jsx(_e,{children:l.jsx(ua,{})}),"Approve"]}),l.jsxs(xe,{onClick:v,disabled:d||!!x,className:x==="declined"?"text-accent2!":"",children:[l.jsx(_e,{children:l.jsx(Hn,{})}),"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(x=>x.type==="text"?!0:x.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(la,{data:o,"data-testid":"tool-suspend-payload"});return l.jsxs(Yz,{"data-testid":"agent-badge",icon:l.jsx(Xs,{className:"text-accent1"}),title:e,initialCollapsed:u&&!a,extraInfo:n?.mode==="network"&&l.jsx(sge,{selectionReason:d??"",input:f}),children:[t.map((x,w)=>{if(x.type==="text")return l.jsx(stt,{children:x.content},w);let O;try{O=typeof x.toolOutput=="string"?JSON.parse(x.toolOutput):x.toolOutput}catch{O=x.toolOutput}return l.jsx(je.Fragment,{children:l.jsx(Kbt,{toolName:x.toolName,argsText:typeof x.args=="string"?x.args:JSON.stringify(x.args),result:O,args:x.args,status:{type:"complete"},type:"tool-call",toolCallId:x.toolCallId,addResult:()=>{},resume:()=>{},metadata:{mode:"stream",requireApprovalMetadata: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(CR,{toolCalled:g,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,isGenerateMode:n?.mode==="generate"})]})};function Cr({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 ige=()=>l.jsx(Yz,{icon:l.jsx(Ft,{color:U6.neutral3}),title:l.jsx(Cr,{className:"ml-2 w-12 h-2"}),collapsible:!1}),Qrr=({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}=Vyt({threadId:t?.subAgentThreadId,agentId:e,memory:!0});if(f)return l.jsx(ige,{});const p=d?.messages?gQe(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=czt(p)),l.jsx(Hrr,{agentId:e,messages:h??[],metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:o,toolCalled:c,isComplete:u})},Xz=({copiedDuration:e=1500}={})=>{const[t,n]=b.useState(!1);return{isCopied:t,copyToClipboard:a=>{a&&navigator.clipboard.writeText(a).then(()=>{n(!0),setTimeout(()=>n(!1),e)})}}},bbt=b.createContext({Link:b.forwardRef(()=>null),navigate:()=>{},paths:{agentLink:()=>"",agentsLink:()=>"",agentToolLink:()=>"",agentSkillLink:()=>"",agentThreadLink:()=>"",agentNewThreadLink:()=>"",workflowsLink:()=>"",workflowLink:()=>"",networkLink:()=>"",networkNewThreadLink:()=>"",networkThreadLink:()=>"",scorerLink:()=>"",cmsScorersCreateLink:()=>"",cmsScorerEditLink:()=>"",cmsAgentCreateLink:()=>"",cmsAgentEditLink:()=>"",promptBlockLink:()=>"",promptBlocksLink:()=>"",cmsPromptBlockCreateLink:()=>"",cmsPromptBlockEditLink:()=>"",toolLink:()=>"",skillLink:()=>"",workspacesLink:()=>"",workspaceLink:()=>"",workspaceSkillLink:()=>"",processorsLink:()=>"",processorLink:()=>"",mcpServerLink:()=>"",mcpServerToolLink:()=>"",workflowRunLink:()=>"",datasetLink:()=>"",datasetItemLink:()=>"",datasetExperimentLink:()=>""}}),xbt=({children:e,Link:t,navigate:n,paths:r})=>l.jsx(bbt.Provider,{value:{Link:t,navigate:n,paths:r},children:e}),en=()=>{const e=b.useContext(bbt);if(!e)throw new Error("useLinkComponent must be used within a LinkComponentProvider");return e},Wrr=({toolName:e,args:t,result:n,toolCallId:r,toolApprovalMetadata:a,isNetwork:s,toolCalled:i})=>{const[o,c]=b.useState(!a),{isCopied:u,copyToClipboard:d}=Xz();b.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:x,extension:w}=p,O=[];m!==void 0&&m!==3&&O.push(`depth: ${m}`),g&&O.push("hidden"),v&&O.push("dirs only"),x&&O.push(`exclude: ${x}`),w&&O.push(`ext: ${w}`);let k="",_="";if(typeof n=="string"&&n){const P=n.lastIndexOf(`
461
+ `,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!s&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=x,u.ParserHandle=g,u.NetworkStreamer=f,u.FileStreamer=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)})}),M(),this;function M(){if(I.length===0)T(j.complete)&&j.complete();else{var F,D,U,q,z=I[0];if(T(j.before)){var V=j.before(z.file,z.inputElem);if(typeof V=="object"){if(V.action==="abort")return F="AbortError",D=z.file,U=z.inputElem,q=V.reason,void(T(j.error)&&j.error({name:F},D,U,q));if(V.action==="skip")return void P();typeof V.config=="object"&&(z.instanceConfig=a.extend(z.instanceConfig,V.config))}else if(V==="skip")return void P()}var W=z.instanceConfig.complete;z.instanceConfig.complete=function($){T(W)&&W($,z.file,z.inputElem),P()},u.parse(z.file,z.instanceConfig)}}function P(){I.splice(0,1),M()}}),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})})(J2)),J2.exports}var xer=ber();const cyt=fo(xer);function uyt(e){const t=e;if(t._def?.typeName)return t._def.typeName;const n=t._def?.type;if(typeof n=="string"&&n)return"Zod"+n.charAt(0).toUpperCase()+n.slice(1)}function wer(e,t){const n=e;if(t==="ZodNullable"||t==="ZodOptional"||t==="ZodDefault")return n._zod?.def?.innerType??n._def?.innerType;if(t==="ZodEffects")return n._zod?.def?.schema??n._def?.schema;if(t==="ZodBranded")return n._zod?.def?.type??n._def?.type}var dyt=Ma(["LIVE","TEST"]),fyt=Ma(["AGENT","WORKFLOW",...Object.values(zme)]);Ee({description:we(),prompt:we()});var gA=Vr(we(),Br()),su=gA.optional(),Ser=Ee({runId:we().optional(),input:Br().optional(),output:Br(),additionalContext:su,requestContext:su});Ee({runId:we().optional(),scorer:gA,input:Br(),output:Br(),metadata:su,additionalContext:su,source:dyt,entity:gA,entityType:fyt,requestContext:su,structuredOutput:Rs().optional(),traceId:we().optional(),spanId:we().optional(),resourceId:we().optional(),threadId:we().optional()});var Oer=wn();Ee({result:su,score:Oer,prompt:we().optional()});var ker=Ser.extend({runId:we(),extractStepResult:su,extractPrompt:we().optional()}),_er=ker.extend({score:wn(),analyzeStepResult:su,analyzePrompt:we().optional()});_er.extend({reason:we().optional(),reasonPrompt:we().optional()});var Bme=Ee({id:we(),scorerId:we(),entityId:we(),runId:we(),input:Br().optional(),output:Br(),additionalContext:su,requestContext:su,extractStepResult:su,extractPrompt:we().optional(),score:wn(),analyzeStepResult:su,analyzePrompt:we().optional(),reason:we().optional(),reasonPrompt:we().optional(),scorer:gA,metadata:su,source:dyt,entity:gA,entityType:fyt.optional(),structuredOutput:Rs().optional(),traceId:we().optional(),spanId:we().optional(),resourceId:we().optional(),threadId:we().optional(),preprocessStepResult:su,preprocessPrompt:we().optional(),generateScorePrompt:we().optional(),generateReasonPrompt:we().optional(),...Tme});Bme.omit({id:!0,createdAt:!0,updatedAt:!0});Ee({pagination:iS,scores:Et(Bme)});var pyt=e=>Object.fromEntries(Object.keys(e).map(t=>[t,!0])),Eer=we().describe("Human-readable span name"),Cer=we().describe("Parent span reference (null = root span)"),hyt=Nw(zme).describe("Span type (e.g., WORKFLOW_RUN, AGENT_RUN, TOOL_CALL, etc.)"),jer=Vr(we(),Br()).describe("Span-type specific attributes (e.g., model, tokens, tools)"),Ter=Et(Br()).describe("References to related spans in other traces"),Ner=Br().describe("Input data passed to the span"),Aer=Br().describe("Output data returned from the span"),Ier=Br().describe("Error info - presence indicates failure (status derived from this)"),Rer=Rs().describe("Whether this is an event (point-in-time) vs a span (duration)"),Per=Vp().describe("When the span started"),Mer=Vp().describe("When the span ended (null = running, status derived from this)"),iT=(e=>(e.SUCCESS="success",e.ERROR="error",e.RUNNING="running",e))(iT||{}),myt=Nw(iT).describe("Current status of the trace"),Der=i_(e=>e==="true"?!0:e==="false"?!1:e,Rs()).describe("True if any span in the trace encountered an error"),gyt={...ner,metadata:Dme.nullish(),tags:$me.nullish()},Ume={traceId:$d,spanId:Cv};Ee({...Ume});var $er=pyt(Tme),Ler=pyt(Ume),Q_=Ee({...Ume,name:Eer,spanType:hyt,isEvent:Rer,startedAt:Per,parentSpanId:Cer.nullish(),...gyt,experimentId:we().nullish().describe("Experiment or eval run identifier"),attributes:jer.nullish(),links:Ter.nullish(),input:Ner.nullish(),output:Aer.nullish(),error:Ier.nullish(),endedAt:Mer.nullish(),requestContext:Vr(we(),Br()).nullish().describe("Request context data"),...Tme}).describe("Span record data"),Fer=Q_.extend({status:myt}).describe("Trace span with computed status (root spans only)"),qme=Q_.omit($er);Ee({span:qme}).describe("Arguments for creating a single span");Ee({records:Et(qme)}).describe("Arguments for batch creating spans");Ee({traceId:$d.min(1),spanId:Cv.min(1)}).describe("Arguments for getting a single span");Ee({span:Q_});Ee({traceId:$d.min(1)}).describe("Arguments for getting a root span");Ee({span:Q_});Ee({traceId:$d.min(1)}).describe("Arguments for getting a single trace");Ee({traceId:$d,spans:Et(Q_)});var zer=Ee({startedAt:Wae.optional().describe("Filter by span start time range"),endedAt:Wae.optional().describe("Filter by span end time range"),spanType:hyt.optional(),...gyt,status:myt.optional(),hasChildError:Der.optional()}).describe("Filters for querying traces"),Ber=Ma(["startedAt","endedAt"]).describe("Field to order by: 'startedAt' | 'endedAt'"),Uer=Ee({field:Ber.default("startedAt").describe("Field to order by"),direction:xR.default("DESC").describe("Sort direction")}).describe("Order by configuration");Ee({filters:zer.optional().describe("Optional filters to apply"),pagination:bR.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:Uer.default({field:"startedAt",direction:"DESC"}).describe("Ordering configuration (defaults to startedAt desc)")}).describe("Arguments for listing traces");Ee({pagination:iS,spans:Et(Fer)});var vyt=qme.omit(Ler);Ee({spanId:Cv,traceId:$d,updates:vyt.partial()}).describe("Arguments for updating a single span");Ee({records:Et(Ee({traceId:$d,spanId:Cv,updates:vyt.partial()}))}).describe("Arguments for batch updating spans");Ee({traceIds:Et($d)}).describe("Arguments for batch deleting traces");Ee({pagination:iS,scores:Et(Bme)});Ee({scorerName:we().min(1),targets:Et(Ee({traceId:$d,spanId:Cv.optional()})).min(1)});Ee({status:we(),message:we(),traceCount:wn()});function qer(e){let t=e,n=!1;for(;;){const r=uyt(t);if(!r)break;(r==="ZodNullable"||r==="ZodOptional")&&(n=!0);const a=wer(t,r);if(!a)break;t=a}return{base:t,nullable:n}}function y5e(e){if("_zod"in e){const n=e._zod?.def?.checks;if(n&&Array.isArray(n))return n.map(r=>{if(typeof r=="object"&&r!==null&&"def"in r&&typeof r.def=="object"&&r.def!==null){const a=r.def;return a.check==="number_format"&&a.format==="safeint"?{kind:"int"}:a.check==="string_format"&&typeof a.format=="string"?{kind:a.format}:{kind:typeof a.check=="string"?a.check:"unknown"}}return{kind:"unknown"}})}if("_def"in e){const n=e._def?.checks;if(n&&Array.isArray(n))return n}return[]}function Ver(e){const t=uyt(e);return t==="ZodString"?y5e(e).some(r=>r.kind==="uuid")?"uuid":"text":t==="ZodNativeEnum"||t==="ZodEnum"?"text":t==="ZodNumber"?y5e(e).some(r=>r.kind==="int")?"integer":"float":t==="ZodBigInt"||t==="ZodBigint"?"bigint":t==="ZodDate"?"timestamp":t==="ZodBoolean"?"boolean":"jsonb"}function Her(e){const t=e.shape,n={};for(const[r,a]of Object.entries(t)){const{base:s,nullable:i}=qer(a);n[r]={type:Ver(s),nullable:i}}return n}Her(Q_);var b5e=1,Qer=.9,Wer=.8,Ger=.17,pJ=.1,hJ=.999,Zer=.9999,Yer=.99,Xer=/[\\\/_+.#"@\[\(\{&]/,Ker=/[\\\/_+.#"@\[\(\{&]/g,Jer=/[\s-]/,yyt=/[\s-]/g;function Gae(e,t,n,r,a,s,i){if(s===t.length)return a===e.length?b5e:Yer;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=Gae(e,t,n,r,u+1,s+1,i),f>d&&(u===a?f*=b5e:Xer.test(e.charAt(u-1))?(f*=Wer,h=e.slice(a,u-1).match(Ker),h&&a>0&&(f*=Math.pow(hJ,h.length))):Jer.test(e.charAt(u-1))?(f*=Qer,m=e.slice(a,u-1).match(yyt),m&&a>0&&(f*=Math.pow(hJ,m.length))):(f*=Ger,a>0&&(f*=Math.pow(hJ,u-a))),e.charAt(u)!==t.charAt(s)&&(f*=Zer)),(f<pJ&&n.charAt(u-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(u-1)!==r.charAt(s))&&(p=Gae(e,t,n,r,u+1,s+2,i),p*pJ>f&&(f=p*pJ)),f>d&&(d=f),u=n.indexOf(c,u+1);return i[o]=d,d}function x5e(e){return e.toLowerCase().replace(yyt," ")}function etr(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Gae(e,t,x5e(e),x5e(t),0,0,{})}var IC='[cmdk-group=""]',mJ='[cmdk-group-items=""]',ttr='[cmdk-group-heading=""]',byt='[cmdk-item=""]',w5e=`${byt}:not([aria-disabled="true"])`,Zae="cmdk-item-select",j1="data-value",ntr=(e,t,n)=>etr(e,t,n),xyt=b.createContext(void 0),OR=()=>b.useContext(xyt),wyt=b.createContext(void 0),Vme=()=>b.useContext(wyt),Syt=b.createContext(void 0),Oyt=b.forwardRef((e,t)=>{let n=T1(()=>{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=T1(()=>new Set),a=T1(()=>new Map),s=T1(()=>new Map),i=T1(()=>new Set),o=kyt(e),{label:c,children:u,value:d,onValueChange:f,filter:p,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...x}=e,w=Wi(),O=Wi(),k=Wi(),_=b.useRef(null),C=ptr();Sw(()=>{if(d!==void 0){let B=d.trim();n.current.value=B,T.emit()}},[d]),Sw(()=>{C(6,F)},[]);let T=b.useMemo(()=>({subscribe:B=>(i.current.add(B),()=>i.current.delete(B)),snapshot:()=>n.current,setState:(B,R,Q)=>{var G,te,oe,re;if(!Object.is(n.current[B],R)){if(n.current[B]=R,B==="search")P(),I(),C(1,M);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),((te=o.current)==null?void 0:te.value)!==void 0){let se=R??"";(re=(oe=o.current).onValueChange)==null||re.call(oe,se);return}}T.emit()}},emit:()=>{i.current.forEach(B=>B())}}),[]),j=b.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,()=>{P(),I(),n.current.value||M(),T.emit()}),()=>{s.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let Q=D();C(4,()=>{P(),Q?.getAttribute("id")===B&&M(),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 te=(G=(Q=o.current)==null?void 0:Q.filter)!=null?G:ntr;return B?te(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 te=a.current.get(G),oe=0;te.forEach(re=>{let se=B.get(re);oe=Math.max(se,oe)}),R.push([G,oe])});let Q=_.current;U().sort((G,te)=>{var oe,re;let se=G.getAttribute("id"),ue=te.getAttribute("id");return((oe=B.get(ue))!=null?oe:0)-((re=B.get(se))!=null?re:0)}).forEach(G=>{let te=G.closest(mJ);te?te.appendChild(G.parentElement===te?G:G.closest(`${mJ} > *`)):Q.appendChild(G.parentElement===Q?G:G.closest(`${mJ} > *`))}),R.sort((G,te)=>te[1]-G[1]).forEach(G=>{var te;let oe=(te=_.current)==null?void 0:te.querySelector(`${IC}[${j1}="${encodeURIComponent(G[0])}"]`);oe?.parentElement.appendChild(oe)})}function M(){let B=U().find(Q=>Q.getAttribute("aria-disabled")!=="true"),R=B?.getAttribute(j1);T.setState("value",R||void 0)}function P(){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 te=0;for(let oe of r.current){let re=(R=(B=s.current.get(oe))==null?void 0:B.value)!=null?R:"",se=(G=(Q=s.current.get(oe))==null?void 0:Q.keywords)!=null?G:[],ue=A(re,se);n.current.filtered.items.set(oe,ue),ue>0&&te++}for(let[oe,re]of a.current)for(let se of re)if(n.current.filtered.items.get(se)>0){n.current.filtered.groups.add(oe);break}n.current.filtered.count=te}function F(){var B,R,Q;let G=D();G&&(((B=G.parentElement)==null?void 0:B.firstChild)===G&&((Q=(R=G.closest(IC))==null?void 0:R.querySelector(ttr))==null||Q.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function D(){var B;return(B=_.current)==null?void 0:B.querySelector(`${byt}[aria-selected="true"]`)}function U(){var B;return Array.from(((B=_.current)==null?void 0:B.querySelectorAll(w5e))||[])}function q(B){let R=U()[B];R&&T.setState("value",R.getAttribute(j1))}function z(B){var R;let Q=D(),G=U(),te=G.findIndex(re=>re===Q),oe=G[te+B];(R=o.current)!=null&&R.loop&&(oe=te+B<0?G[G.length-1]:te+B===G.length?G[0]:G[te+B]),oe&&T.setState("value",oe.getAttribute(j1))}function V(B){let R=D(),Q=R?.closest(IC),G;for(;Q&&!G;)Q=B>0?dtr(Q,IC):ftr(Q,IC),G=Q?.querySelector(w5e);G?T.setState("value",G.getAttribute(j1)):z(B)}let W=()=>q(U().length-1),$=B=>{B.preventDefault(),B.metaKey?W():B.altKey?V(1):z(1)},Z=B=>{B.preventDefault(),B.metaKey?q(0):B.altKey?V(-1):z(-1)};return b.createElement(po.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:B=>{var R;(R=x.onKeyDown)==null||R.call(x,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(),q(0);break}case"End":{B.preventDefault(),W();break}case"Enter":{B.preventDefault();let G=D();if(G){let te=new Event(Zae);G.dispatchEvent(te)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:mtr},c),Gz(e,B=>b.createElement(wyt.Provider,{value:T},b.createElement(xyt.Provider,{value:j},B))))}),rtr=b.forwardRef((e,t)=>{var n,r;let a=Wi(),s=b.useRef(null),i=b.useContext(Syt),o=OR(),c=kyt(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;Sw(()=>{if(!u)return o.item(a,i?.id)},[u]);let d=_yt(a,s,[e.value,e.children,s],e.keywords),f=Vme(),p=Nb(C=>C.value&&C.value===d.current),h=Nb(C=>u||o.filter()===!1?!0:C.search?C.filtered.items.get(a)>0:!0);b.useEffect(()=>{let C=s.current;if(!(!C||e.disabled))return C.addEventListener(Zae,m),()=>C.removeEventListener(Zae,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:x,onSelect:w,forceMount:O,keywords:k,..._}=e;return b.createElement(po.div,{ref:cm(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)}),atr=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...s}=e,i=Wi(),o=b.useRef(null),c=b.useRef(null),u=Wi(),d=OR(),f=Nb(h=>a||d.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);Sw(()=>d.group(i),[]),_yt(i,o,[e.value,e.heading,c]);let p=b.useMemo(()=>({id:i,forceMount:a}),[a]);return b.createElement(po.div,{ref:cm(o,t),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Gz(e,h=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Syt.Provider,{value:p},h))))}),str=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=b.useRef(null),s=Nb(i=>!i.search);return!n&&!s?null:b.createElement(po.div,{ref:cm(a,t),...r,"cmdk-separator":"",role:"separator"})}),itr=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,s=Vme(),i=Nb(u=>u.search),o=Nb(u=>u.selectedItemId),c=OR();return b.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),b.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)}})}),otr=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,s=b.useRef(null),i=b.useRef(null),o=Nb(u=>u.selectedItemId),c=OR();return b.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)}}},[]),b.createElement(po.div,{ref:cm(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:c.listId},Gz(e,u=>b.createElement("div",{ref:cm(i,c.listInnerRef),"cmdk-list-sizer":""},u)))}),ltr=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:s,container:i,...o}=e;return b.createElement(u6,{open:n,onOpenChange:r},b.createElement(d6,{container:i},b.createElement(pI,{"cmdk-overlay":"",className:a}),b.createElement(hI,{"aria-label":e.label,"cmdk-dialog":"",className:s},b.createElement(Oyt,{ref:t,...o}))))}),ctr=b.forwardRef((e,t)=>Nb(n=>n.filtered.count===0)?b.createElement(po.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),utr=b.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...s}=e;return b.createElement(po.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Gz(e,i=>b.createElement("div",{"aria-hidden":!0},i)))}),Mu=Object.assign(Oyt,{List:otr,Item:rtr,Input:itr,Group:atr,Separator:str,Dialog:ltr,Empty:ctr,Loading:utr});function dtr(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ftr(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function kyt(e){let t=b.useRef(e);return Sw(()=>{t.current=e}),t}var Sw=typeof window>"u"?b.useEffect:b.useLayoutEffect;function T1(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function Nb(e){let t=Vme(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function _yt(e,t,n,r=[]){let a=b.useRef(),s=OR();return Sw(()=>{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(j1,o),a.current=o}),a}var ptr=()=>{let[e,t]=b.useState(),n=T1(()=>new Map);return Sw(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function htr(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Gz({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(htr(t),{ref:t.ref},n(t.props.children)):n(t)}var mtr={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 Ow(e,t,n,r,a,s){if(e==r)return[];let i=Qme(e,t,n,r,a,s),o=Wme(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=jyt(e,t,n,r,a,s);if(d){let[f,p,h]=d;return Ow(e,t,f,r,a,p).concat(Ow(e,f+h,n,r,p+h,s))}return gtr(e,t,n,r,a,s)}let hj=1e9,mj=0,Hme=!1;function gtr(e,t,n,r,a,s){let i=n-t,o=s-a;if(hj<1e9&&Math.min(i,o)>hj*16||mj>0&&Date.now()>mj)return Math.min(i,o)>hj*64?[new ro(t,n,a,s)]:S5e(e,t,n,r,a,s);let c=Math.ceil((i+o)/2);gJ.reset(c),vJ.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?vJ:null,p=f?null:gJ;for(let h=0;h<c;h++){if(h>hj||mj>0&&!(h&63)&&Date.now()>mj)return S5e(e,t,n,r,a,s);let m=gJ.advance(h,i,o,c,f,!1,u)||vJ.advance(h,i,o,c,p,!0,d);if(m)return vtr(e,t,n,t+m[0],r,a,s,a+m[1])}return[new ro(t,n,a,s)]}class Eyt{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 gJ=new Eyt,vJ=new Eyt;function vtr(e,t,n,r,a,s,i,o){let c=!1;return!Bk(e,r)&&++r==n&&(c=!0),!Bk(a,o)&&++o==i&&(c=!0),c?[new ro(t,n,s,i)]:Ow(e,t,r,a,s,o).concat(Ow(e,r,n,a,o,i))}function Cyt(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n=n<<1;return n}function Qme(e,t,n,r,a,s){if(t==n||t==s||e.charCodeAt(t)!=r.charCodeAt(a))return 0;let i=Cyt(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-(Bk(e,o)?0:1);i=i>>1}else{if(u==n||d==s)return u-t;o=u,c=d}}}function Wme(e,t,n,r,a,s){if(t==n||a==s||e.charCodeAt(n-1)!=r.charCodeAt(s-1))return 0;let i=Cyt(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-(Bk(e,o)?0:1);i=i>>1}else{if(u==t||d==a)return n-u;o=u,c=d}}}function Yae(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;;){Bk(e,d)||d++;let f=d+i;if(Bk(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=Qme(e,f,n,r,a+h+p.length,s),g=Wme(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 jyt(e,t,n,r,a,s){let i=n-t,o=s-a;if(i<o){let c=jyt(r,a,s,e,t,n);return c&&[c[1],c[0],c[2]]}return i<4||o*2<i?null:Yae(e,t,n,r,a,s,Math.floor(i/4),-1)}function S5e(e,t,n,r,a,s){Hme=!0;let i=n-t,o=s-a,c;if(i<o){let p=Yae(r,a,s,e,t,n,Math.floor(i/6),50);c=p&&[p[1],p[0],p[2]]}else c=Yae(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 Ow(e,t,u,r,a,d).concat(Ow(e,u+f,n,r,d+f,s))}function Tyt(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 ytr(e,t,n){for(;;){Tyt(n,1);let r=!1;for(let a=0;a<n.length;a++){let s=n[a],i,o;(i=Qme(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=Wme(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 btr(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=k5e(t,s.fromA,u),p=O5e(t,s.toA,d),h=s.fromA-f,m=p-s.toA;if((!i||!o)&&h&&m){let g=Math.max(i,o),[v,x,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=O5e(t,s.toA,c-s.toA)):g>m&&t.slice(s.toA,p)==v.slice(x,x+m)&&(s=e[a]=new ro(p-i,p,s.fromB+m,s.toB+m),p=s.toA,f=k5e(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=E5e(t,s.fromA,s.toA),v,x=g<0?-1:_5e(t,s.toA,s.fromA);g>-1&&(v=g-s.fromA)<=d&&t.slice(s.fromA,g)==t.slice(s.toA,s.toA+v)?s=e[a]=s.offset(v):x>-1&&(v=s.toA-x)<=u&&t.slice(s.fromA-v,s.fromA)==t.slice(x,s.toA)&&(s=e[a]=s.offset(-v))}}else{let g=E5e(n,s.fromB,s.toB),v,x=g<0?-1:_5e(n,s.toB,s.fromB);g>-1&&(v=g-s.fromB)<=d&&n.slice(s.fromB,g)==n.slice(s.toB,s.toB+v)?s=e[a]=s.offset(v):x>-1&&(v=s.toB-x)<=u&&n.slice(s.fromB-v,s.fromB)==n.slice(x,s.toB)&&(s=e[a]=s.offset(-v))}}r=s.toA}return Tyt(e,3),e}let C0;try{C0=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Nyt(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Ayt(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?Nyt(n)?1:0:C0?!Pyt(n)||t==e.length-1?C0.test(String.fromCharCode(n))?1:0:C0.test(e.slice(t,t+2))?2:0:0}function Iyt(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?Nyt(n)?1:0:C0?!Myt(n)||t==1?C0.test(String.fromCharCode(n))?1:0:C0.test(e.slice(t-2,t))?2:0:0}const Ryt=8;function O5e(e,t,n){if(t==e.length||!Iyt(e,t))return t;for(let r=t,a=t+n,s=0;s<Ryt;s++){let i=Ayt(e,r);if(!i||r+i>a)return r;r+=i}return t}function k5e(e,t,n){if(!t||!Ayt(e,t))return t;for(let r=t,a=t-n,s=0;s<Ryt;s++){let i=Iyt(e,r);if(!i||r-i<a)return r;r-=i}return t}function _5e(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function E5e(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}const Pyt=e=>e>=55296&&e<=56319,Myt=e=>e>=56320&&e<=57343;function Bk(e,t){return!t||t==e.length||!Pyt(e.charCodeAt(t-1))||!Myt(e.charCodeAt(t))}function xtr(e,t,n){var r;let a=n?.override;return a?a(e,t):(hj=((r=n?.scanLimit)!==null&&r!==void 0?r:1e9)>>1,mj=n?.timeout?Date.now()+n.timeout:0,Hme=!1,ytr(e,t,Ow(e,0,e.length,t,0,t.length)))}function Dyt(){return!Hme}function $yt(e,t,n){return btr(xtr(e,t,n),e,t)}const zh=Xt.define({combine:e=>e[0]}),Xae=Kn.define(),wtr=Xt.define(),Uk=ho.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Xae)&&(e=n.value);for(let n of t.state.facet(wtr))e=n(e,t);return e}});class jO{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 jO(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=$yt(t.toString(),n.toString(),r);return Lyt(a,t,n,0,0,Dyt())}static updateA(t,n,r,a,s){return A5e(N5e(t,a,!0,r.length),t,n,r,s)}static updateB(t,n,r,a,s){return A5e(N5e(t,a,!1,n.length),t,n,r,s)}}function C5e(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 j5e(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 Lyt(e,t,n,r,a,s){let i=[];for(let o=0;o<e.length;o++){let c=e[o],[u,d]=C5e(c.fromA+r,c.fromB+a,t,n),[f,p]=j5e(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]=C5e(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]=j5e(m.toA+r,m.toB+a,t,n),o++}i.push(new jO(h,u,Math.max(u,f),d,Math.max(d,p),s))}return i}const MD=1e3;function T5e(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 N5e(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>MD&&([u,f]=T5e(e,s-MD,n,!0)),i<t.length-MD&&([d,p]=T5e(e,i+MD,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 A5e(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=$yt(n.sliceString(f,h),r.sliceString(p,m),a);for(let v of Lyt(g,n,r,f,p,Dyt()))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 Str={scanLimit:500},Fyt=oi.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=P5e(e))}update(e){(e.docChanged||e.viewportChanged||Otr(e.startState,e.state)||ktr(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=P5e(e.view))}},{decorations:e=>e.deco}),DD=Gp.low(Lnt({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(Fyt))===null||t===void 0?void 0:t.gutter)||Hr.empty}}));function Otr(e,t){return e.field(Uk,!1)!=t.field(Uk,!1)}function ktr(e,t){return e.facet(zh)!=t.facet(zh)}const I5e=nn.line({class:"cm-changedLine"}),_tr=nn.mark({class:"cm-changedText"}),Etr=nn.mark({tagName:"ins",class:"cm-insertedLine"}),Ctr=nn.mark({tagName:"del",class:"cm-deletedLine"}),R5e=new class extends fm{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function jtr(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,I5e),a.add(i,o,n?Ctr:Etr),s&&s.add(i,i,R5e);for(let u=t.iterRange(i,o-1),d=i;!u.next().done;){if(u.lineBreak){d++,a.add(d,d,I5e),s&&s.add(d,d,R5e);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,_tr),m<f)c++;else break}d=f}}}function P5e(e){let t=e.state.field(Uk),{side:n,highlightChanges:r,markGutter:a,overrideChunk:s}=e.state.facet(zh),i=n=="a",o=new ku,c=a?new ku:null,{from:u,to:d}=e.viewport;for(let f of t){if((i?f.fromA:f.fromB)>=d)break;(i?f.toA:f.toB)>u&&(!s||!s(e.state,f,o,c))&&jtr(f,e.state.doc,i,r,o,c)}return{deco:o.finish(),gutter:c&&c.finish()}}class $D extends Dd{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 u3=Kn.define({map:(e,t)=>e.map(t)}),gj=ho.define({create:()=>nn.none,update:(e,t)=>{for(let n of t.effects)if(n.is(u3))return n.value;return e.map(t.changes)},provide:e=>gt.decorations.from(e)}),LD=.01;function M5e(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 Ttr(e,t,n){let r=new ku,a=new ku,s=e.state.field(gj).iter(),i=t.state.field(gj).iter(),o=0,c=0,u=0,d=0,f=e.viewport,p=t.viewport;for(let v=0;;v++){let x=v<n.length?n[v]:null,w=x?x.fromA:e.state.doc.length,O=x?x.fromB:t.state.doc.length;if(o<w){let k=e.lineBlockAt(o).top+u,_=t.lineBlockAt(c).top+d,C=k-_;C<-LD?(u-=C,r.add(o,o,nn.widget({widget:new $D(-C),block:!0,side:-1}))):C>LD&&(d+=C,a.add(c,c,nn.widget({widget:new $D(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(x)o=x.toA,c=x.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<LD?r.add(e.state.doc.length,e.state.doc.length,nn.widget({widget:new $D(-h),block:!0,side:1})):h>LD&&a.add(t.state.doc.length,t.state.doc.length,nn.widget({widget:new $D(h),block:!0,side:1}));let m=r.finish(),g=a.finish();M5e(m,e.state.field(gj))||e.dispatch({effects:u3.of(m)}),M5e(g,t.state.field(gj))||t.dispatch({effects:u3.of(g)})}const Kae=Kn.define({map:(e,t)=>t.mapPos(e)});class Ntr extends Dd{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:Kae.of(a)});let{side:s,sibling:i}=t.state.facet(zh);i&&i().dispatch({effects:Kae.of(Atr(a,t.state.field(Uk),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 Itr=ho.define({create(e){return nn.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Kae)&&(e=e.update({filter:r=>r!=n.value}));return e},provide:e=>gt.decorations.from(e)});function D5e({margin:e=3,minSize:t=4}){return Itr.init(n=>Rtr(n,e,t))}function Rtr(e,t,n){let r=new ku,a=e.facet(zh).side=="a",s=e.field(Uk),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 Ntr(f),block:!0})),!c)break;i=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return r.finish()}const Ptr=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"}})),Mtr=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"}}),$5e=new w_,FD=new w_;class Dtr{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||Str;let n=[Gp.low(Fyt),Mtr,Ptr,gj,gt.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(p=>p.effects.some(h=>h.is(u3)))&&this.measure()})],r=[zh.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&r.push(DD);let a=Dr.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],gt.editorAttributes.of({class:"cm-merge-a"}),FD.of(r),n]}),s=[zh.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&s.push(DD);let i=Dr.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],gt.editorAttributes.of({class:"cm-merge-b"}),FD.of(s),n]});this.chunks=jO.build(a.doc,i.doc,this.diffConf);let o=[Uk.init(()=>this.chunks),$5e.of(t.collapseUnchanged?D5e(t.collapseUnchanged):[])];a=a.update({effects:Kn.appendConfig.of(o)}).state,i=i.update({effects:Kn.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?jO.updateA(this.chunks,r.newDoc,this.b.state.doc,a,this.diffConf):jO.updateB(this.chunks,this.a.state.doc,r.newDoc,a,this.diffConf),n.update([...t,r.state.update({effects:Xae.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Xae.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(zh),c=r?t.gutter!==!1:o.markGutter,u=n?t.highlightChanges!==!1:o.highlightChanges;s.push(FD.reconfigure([zh.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:c}),c?DD:[]])),i.push(FD.reconfigure([zh.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:c}),c?DD:[]]))}if(a){let o=$5e.reconfigure(t.collapseUnchanged?D5e(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(){Ttr(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=L5e(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=L5e(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 L5e(e){let t=e.nextSibling;return e.remove(),t}const yJ=[400,401,403,404];function ts(e){return!e||typeof e!="object"?!1:"status"in e&&e.status===403||"statusCode"in e&&e.statusCode===403?!0:"message"in e?e.message.includes("status: 403"):!1}function zyt(e){if(!e||typeof e!="object")return!1;if("status"in e){const t=e.status;return yJ.includes(t)}if("statusCode"in e){const t=e.statusCode;return yJ.includes(t)}if("message"in e){const t=e.message;return yJ.some(n=>t.includes(`status: ${n}`))}return!1}function $tr(e,t){return zyt(t)?!1:e<3}function Ltr(e,t){return t in e&&typeof e[t]=="function"}const Ko=e=>{const t=["listWorkspaces","getWorkspace"],n=fie.has("workspaces-v1"),r=t.every(a=>Ltr(e,a));return n&&r},Byt=e=>{if(!(!e||typeof e!="object")){if("status"in e&&typeof e.status=="number")return e.status;if("statusCode"in e&&typeof e.statusCode=="number")return e.statusCode}},Ftr=(e,t)=>Byt(e)===t,ztr=e=>{const t=Byt(e);return t!==void 0&&t>=400&&t<500},Jae=e=>{if(Ftr(e,501))return!0;if(e&&typeof e=="object"&&"message"in e){const t=e.message;return t.includes("Workspace v1 not supported")||t.includes("501")}return!1},cS=(e,t)=>ztr(t)||Jae(t)||zyt(t)?!1:e<3,F5e={modelSettings:{maxRetries:2,maxSteps:5,chatWithGenerateLegacy:!1,chatWithGenerate:!1}};function Btr({agentId:e,defaultSettings:t}){const[n,r]=b.useState(t),a=`mastra-agent-store-${e}`;return b.useEffect(()=>{try{const o=localStorage.getItem(a),c=o?JSON.parse(o):{},u={...c,modelSettings:{...F5e.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:{...F5e.modelSettings,...t?.modelSettings??{}}};r(o),localStorage.removeItem(a)}}}const Uyt=b.createContext({});function Gme({children:e,agentId:t,defaultSettings:n}){const{settings:r,setSettings:a,resetAll:s}=Btr({agentId:t,defaultSettings:n});return l.jsx(Uyt.Provider,{value:{settings:r,setSettings:a,resetAll:s},children:e})}const Zme=()=>b.useContext(Uyt),Ur=Ole()(FDt(e=>({requestContext:{},theme:"dark",setRequestContext:t=>e({requestContext:t}),setTheme:t=>e({theme:t})}),{name:"mastra-playground-store"})),ese=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;function Utr(e){return ese?.addEventListener("change",e),()=>ese?.removeEventListener("change",e)}function qtr(){return ese?.matches??!0}function Zz(){const e=Ur(n=>n.theme),t=b.useSyncExternalStore(Utr,qtr,()=>!0);return e==="system"?t:e==="dark"}const Yme=b.createContext(null);function kR({children:e}){const{requestContext:t}=Ur(),[n,r]=b.useState(t),a=i=>r(i),s=()=>{r({})};return l.jsx(Yme.Provider,{value:{schemaValues:n,setSchemaValues:a,clearSchemaValues:s},children:e})}function qyt(){const e=b.useContext(Yme);if(!e)throw new Error("useSchemaRequestContext must be used within a SchemaRequestContextProvider");return e}function vo(){const{requestContext:e}=Ur(),n=b.useContext(Yme)?.schemaValues??{};return{...e??{},...n}}const Vyt=({threadId:e,agentId:t,memory:n})=>{const r=Ue(),{requestContext:a}=Ur();return xt({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})},Vtr=({multiple:e=!0,onChange:t}={})=>{const n=KBt(s=>!s.isEditing),r=uI(),a=b.useCallback(()=>{const s=document.createElement("input");s.type="file",s.multiple=e,s.hidden=!0;const i=r.getState().attachmentAccept;i&&i!=="*"&&(s.accept=i),document.body.appendChild(s),s.onchange=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},Vl={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},_R="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",Qtr="rounded-md",Xme="bg-surface2 border-2 border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",Kme="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",Jme="disabled:opacity-50 disabled:cursor-not-allowed";function Hyt(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=Hyt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Qyt(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Hyt(e))&&(r&&(r+=" "),r+=t);return r}const Wtr=(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},Gtr=(e,t)=>({classGroupId:e,validator:t}),Wyt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),d3="-",z5e=[],Ztr="arbitrary..",Ytr=e=>{const t=Ktr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Xtr(i);const o=i.split(d3),c=o[0]===""&&o.length>1?1:0;return Gyt(o,c,t)},getConflictingClassGroupIds:(i,o)=>{if(o){const c=r[i],u=n[i];return c?u?Wtr(u,c):c:u||z5e}return n[i]||z5e}}},Gyt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],s=n.nextPart.get(a);if(s){const u=Gyt(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const o=t===0?e.join(d3):e.slice(t).join(d3),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?Ztr+r:void 0})(),Ktr=e=>{const{theme:t,classGroups:n}=e;return Jtr(n,t)},Jtr=(e,t)=>{const n=Wyt();for(const r in e){const a=e[r];ege(a,n,r,t)}return n},ege=(e,t,n,r)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];enr(i,t,n,r)}},enr=(e,t,n,r)=>{if(typeof e=="string"){tnr(e,t,n);return}if(typeof e=="function"){nnr(e,t,n,r);return}rnr(e,t,n,r)},tnr=(e,t,n)=>{const r=e===""?t:Zyt(t,e);r.classGroupId=n},nnr=(e,t,n,r)=>{if(anr(e)){ege(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Gtr(n,e))},rnr=(e,t,n,r)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[o,c]=a[i];ege(c,Zyt(t,o),n,r)}},Zyt=(e,t)=>{let n=e;const r=t.split(d3),a=r.length;for(let s=0;s<a;s++){const i=r[s];let o=n.nextPart.get(i);o||(o=Wyt(),n.nextPart.set(i,o)),n=o}return n},anr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,snr=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)}}},tse="!",B5e=":",inr=[],U5e=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),onr=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const s=[];let i=0,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===B5e){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(tse)?(p=f.slice(0,-1),h=!0):f.startsWith(tse)&&(p=f.slice(1),h=!0);const m=u&&u>c?u-c:void 0;return U5e(s,h,p,m)};if(t){const a=t+B5e,s=r;r=i=>i.startsWith(a)?s(i.slice(a.length)):U5e(inr,!1,i,void 0,!0)}if(n){const a=r;r=s=>n({className:s,parseClassName:a})}return r},lnr=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}},cnr=e=>({cache:snr(e.cacheSize),parseClassName:onr(e),sortModifiers:lnr(e),...Ytr(e)}),unr=/\s+/,dnr=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],o=e.trim().split(unr);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,x=r(v?m.substring(0,g):m);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=r(m),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const w=p.length===0?"":p.length===1?p[0]:s(p).join(":"),O=h?w+tse:w,k=O+x;if(i.indexOf(k)>-1)continue;i.push(k);const _=a(x,v);for(let C=0;C<_.length;++C){const T=_[C];i.push(O+T)}c=d+(c.length>0?" "+c:c)}return c},fnr=(...e)=>{let t=0,n,r,a="";for(;t<e.length;)(n=e[t++])&&(r=Yyt(n))&&(a&&(a+=" "),a+=r);return a},Yyt=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Yyt(e[r]))&&(n&&(n+=" "),n+=t);return n},q5e=(e,...t)=>{let n,r,a,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=cnr(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=dnr(c,n);return a(c,d),d};return s=i,(...c)=>s(fnr(...c))},pnr=[],wo=e=>{const t=n=>n[e]||pnr;return t.isThemeGetter=!0,t},Xyt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Kyt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,hnr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,mnr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gnr=/\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$/,vnr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ynr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bnr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vy=e=>hnr.test(e),Pr=e=>!!e&&!Number.isNaN(Number(e)),yy=e=>!!e&&Number.isInteger(Number(e)),bJ=e=>e.endsWith("%")&&Pr(e.slice(0,-1)),pg=e=>mnr.test(e),Jyt=()=>!0,xnr=e=>gnr.test(e)&&!vnr.test(e),tge=()=>!1,wnr=e=>ynr.test(e),Snr=e=>bnr.test(e),Onr=e=>!pn(e)&&!bn(e),knr=e=>Yb(e,nbt,tge),pn=e=>Xyt.test(e),Dx=e=>Yb(e,rbt,xnr),V5e=e=>Yb(e,Inr,Pr),_nr=e=>Yb(e,sbt,Jyt),Enr=e=>Yb(e,abt,tge),H5e=e=>Yb(e,ebt,tge),Cnr=e=>Yb(e,tbt,Snr),zD=e=>Yb(e,ibt,wnr),bn=e=>Kyt.test(e),RC=e=>uS(e,rbt),jnr=e=>uS(e,abt),Q5e=e=>uS(e,ebt),Tnr=e=>uS(e,nbt),Nnr=e=>uS(e,tbt),BD=e=>uS(e,ibt,!0),Anr=e=>uS(e,sbt,!0),Yb=(e,t,n)=>{const r=Xyt.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},uS=(e,t,n=!1)=>{const r=Kyt.exec(e);return r?r[1]?t(r[1]):n:!1},ebt=e=>e==="position"||e==="percentage",tbt=e=>e==="image"||e==="url",nbt=e=>e==="length"||e==="size"||e==="bg-size",rbt=e=>e==="length",Inr=e=>e==="number",abt=e=>e==="family-name",sbt=e=>e==="number"||e==="weight",ibt=e=>e==="shadow",W5e=()=>{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"),x=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(),bn,pn],C=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[bn,pn,c],A=()=>[vy,"full","auto",...j()],I=()=>[yy,"none","subgrid",bn,pn],M=()=>["auto",{span:["full",yy,bn,pn]},yy,bn,pn],P=()=>[yy,"auto",bn,pn],F=()=>["auto","min","max","fr",bn,pn],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...j()],z=()=>[vy,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],V=()=>[vy,"screen","full","dvw","lvw","svw","min","max","fit",...j()],W=()=>[vy,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],$=()=>[e,bn,pn],Z=()=>[...k(),Q5e,H5e,{position:[bn,pn]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],R=()=>["auto","cover","contain",Tnr,knr,{size:[bn,pn]}],Q=()=>[bJ,RC,Dx],G=()=>["","none","full",u,bn,pn],te=()=>["",Pr,RC,Dx],oe=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[Pr,bJ,Q5e,H5e],ue=()=>["","none",m,bn,pn],me=()=>["none",Pr,bn,pn],J=()=>["none",Pr,bn,pn],ne=()=>[Pr,bn,pn],le=()=>[vy,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pg],breakpoint:[pg],color:[Jyt],container:[pg],"drop-shadow":[pg],ease:["in","out","in-out"],font:[Onr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pg],shadow:[pg],spacing:["px",Pr],text:[pg],"text-shadow":[pg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vy,pn,bn,v]}],container:["container"],columns:[{columns:[Pr,pn,bn,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:[yy,"auto",bn,pn]}],basis:[{basis:[vy,"full","auto",o,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pr,vy,"auto","initial","none",pn]}],grow:[{grow:["",Pr,bn,pn]}],shrink:[{shrink:["",Pr,bn,pn]}],order:[{order:[yy,"first","last","none",bn,pn]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"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:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"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",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"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,RC,Dx]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Anr,_nr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",bJ,pn]}],"font-family":[{font:[jnr,Enr,t]}],"font-features":[{"font-features":[pn]}],"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,bn,pn]}],"line-clamp":[{"line-clamp":[Pr,"none",bn,V5e]}],leading:[{leading:[s,...j()]}],"list-image":[{"list-image":["none",bn,pn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",bn,pn]}],"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:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Pr,"from-font","auto",bn,Dx]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Pr,"auto",bn,pn]}],"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",bn,pn]}],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",bn,pn]}],"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"]},yy,bn,pn],radial:["",bn,pn],conic:[yy,bn,pn]},Nnr,Cnr]}],"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:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-bs":[{"border-bs":te()}],"border-w-be":[{"border-be":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"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:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Pr,bn,pn]}],"outline-w":[{outline:["",Pr,RC,Dx]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",d,BD,zD]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",f,BD,zD]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Pr,Dx]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",p,BD,zD]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Pr,bn,pn]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"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":[Pr]}],"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":[bn,pn]}],"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":[Pr]}],"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",bn,pn]}],filter:[{filter:["","none",bn,pn]}],blur:[{blur:ue()}],brightness:[{brightness:[Pr,bn,pn]}],contrast:[{contrast:[Pr,bn,pn]}],"drop-shadow":[{"drop-shadow":["","none",h,BD,zD]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Pr,bn,pn]}],"hue-rotate":[{"hue-rotate":[Pr,bn,pn]}],invert:[{invert:["",Pr,bn,pn]}],saturate:[{saturate:[Pr,bn,pn]}],sepia:[{sepia:["",Pr,bn,pn]}],"backdrop-filter":[{"backdrop-filter":["","none",bn,pn]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Pr,bn,pn]}],"backdrop-contrast":[{"backdrop-contrast":[Pr,bn,pn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pr,bn,pn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pr,bn,pn]}],"backdrop-invert":[{"backdrop-invert":["",Pr,bn,pn]}],"backdrop-opacity":[{"backdrop-opacity":[Pr,bn,pn]}],"backdrop-saturate":[{"backdrop-saturate":[Pr,bn,pn]}],"backdrop-sepia":[{"backdrop-sepia":["",Pr,bn,pn]}],"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",bn,pn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Pr,"initial",bn,pn]}],ease:[{ease:["linear","initial",x,bn,pn]}],delay:[{delay:[Pr,bn,pn]}],animate:[{animate:["none",w,bn,pn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,bn,pn]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:J()}],"scale-x":[{"scale-x":J()}],"scale-y":[{"scale-y":J()}],"scale-z":[{"scale-z":J()}],"scale-3d":["scale-3d"],skew:[{skew:ne()}],"skew-x":[{"skew-x":ne()}],"skew-y":[{"skew-y":ne()}],transform:[{transform:[bn,pn,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"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",bn,pn]}],"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",bn,pn]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[Pr,RC,Dx,V5e]}],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"]}},Rnr=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:a={},override:s={}})=>(vj(e,"cacheSize",t),vj(e,"prefix",n),vj(e,"experimentalParseClassName",r),UD(e.theme,s.theme),UD(e.classGroups,s.classGroups),UD(e.conflictingClassGroups,s.conflictingClassGroups),UD(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),vj(e,"orderSensitiveModifiers",s.orderSensitiveModifiers),qD(e.theme,a.theme),qD(e.classGroups,a.classGroups),qD(e.conflictingClassGroups,a.conflictingClassGroups),qD(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),obt(e,a,"orderSensitiveModifiers"),e),vj=(e,t,n)=>{n!==void 0&&(e[t]=n)},UD=(e,t)=>{if(t)for(const n in t)vj(e,n,t[n])},qD=(e,t)=>{if(t)for(const n in t)obt(e,t,n)},obt=(e,t,n)=>{const r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},Pnr=(e,...t)=>typeof e=="function"?q5e(W5e,e,...t):q5e(()=>Rnr(W5e(),e),...t),Mnr=Object.keys({...U6,...YYt}),Dnr=Object.keys(nXt),$nr=Object.keys(XYt),Lnr=Object.keys(KYt),Fnr=Object.keys(ZYt),$x=Object.keys(tXt),znr=Object.keys(JYt).concat(Object.keys(eXt)),Bnr=Pnr({extend:{theme:{color:Mnr,spacing:Dnr,radius:Fnr,leading:Lnr,shadow:znr},classGroups:{"font-size":[{text:$nr}],h:[{h:$x}],w:[{w:$x}],size:[{size:$x}],"min-h":[{"min-h":$x}],"min-w":[{"min-w":$x}],"max-h":[{"max-h":$x}],"max-w":[{"max-w":$x}]}}});function Y(...e){return Bnr(Qyt(e))}const Unr={sm:`${Vl.sm} text-ui-sm px-[.75em]`,md:`${Vl.md} text-ui-md px-[.75em]`,default:`${Vl.default} text-ui-md px-[.85em] `,lg:`${Vl.lg} text-ui-lg px-[1em] `},qnr={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:Xme,light:"",outline:""},Vnr=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",Jme,Kme),Hnr={light:"default",outline:"default"};function Qnr(e){return Hnr[e]??e}function W_(e){const t=Qnr(e?.variant||"default"),n=e?.size||"default";return Y(Vnr,qnr[t],Unr[n],e?.iconOnly&&"[&>svg]:opacity-75")}function lbt(e){const t=[];return je.Children.forEach(e,n=>{je.isValidElement(n)&&n.type===je.Fragment?t.push(...lbt(n.props.children)):t.push(n)}),t}function Wnr(e){const t=lbt(e);return t.length>0&&t.every(n=>je.isValidElement(n))}const xe=je.forwardRef(({className:e,as:t,size:n="default",variant:r="default",disabled:a,children:s,...i},o)=>{const c=t||"button",u=Wnr(s);return l.jsx(c,{ref:o,disabled:a,className:Y(W_({variant:r,size:n,iconOnly:u}),e),...i,children:s})});xe.displayName="Button";const $c=aFt,sr=sFt,ir=iFt,er=b.forwardRef(({className:e,sideOffset:t=4,children:n,...r},a)=>l.jsx(oFt,{children:l.jsxs(aGe,{ref:a,sideOffset:t,className:Y("z-50 overflow-hidden rounded-md bg-surface3 px-3 py-1.5 text-xs text-neutral4 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r,children:[n,l.jsx(lFt,{className:"fill-surface3"})]})}));er.displayName=aGe.displayName;const Qs=je.forwardRef(({tooltipContent:e,...t},n)=>l.jsxs(sr,{children:[l.jsx(ir,{asChild:!0,children:l.jsx(xe,{ref:n,...t})}),e&&l.jsx(er,{children:e})]}));Qs.displayName="ButtonWithTooltip";const _r=u6,cbt=hYe,Gnr=d6,ubt=b.forwardRef(({className:e,...t},n)=>l.jsx(pI,{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}));ubt.displayName=pI.displayName;const yr=b.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(Gnr,{children:[l.jsx(ubt,{}),l.jsxs(hI,{ref:r,className:Y("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-bottom-4","data-[state=open]:slide-in-from-bottom-4",e),...n,children:[t,l.jsxs(h6,{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(Hn,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yr.displayName=hI.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 Ad=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ad.displayName="DialogFooter";const Fr=({className:e,...t})=>l.jsx("div",{className:Y("overflow-y-auto px-6 max-h-[50vh]",e),...t});Fr.displayName="DialogBody";const br=b.forwardRef(({className:e,...t},n)=>l.jsx(f6,{ref:n,className:Y("text-ui-md font-medium",e),...t}));br.displayName=f6.displayName;const Ya=b.forwardRef(({className:e,...t},n)=>l.jsx(p6,{ref:n,className:Y("sr-only",e),...t}));Ya.displayName=p6.displayName;const G5e=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Z5e=Qyt,ER=(e,t)=>n=>{var r;if(t?.variants==null)return Z5e(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=G5e(d)||G5e(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 Z5e(e,i,c,n?.class,n?.className)},Znr=ER(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(Xme,Kme,Jme),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${Vl.sm} text-ui-sm px-[.75em]`,md:`${Vl.md} text-ui-md px-[.75em]`,default:`${Vl.default} text-ui-md px-[.85em]`,lg:`${Vl.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),an=b.forwardRef(({className:e,size:t,testId:n,variant:r,type:a,error:s,...i},o)=>l.jsx("input",{type:a,className:Y(Znr({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 Ynr=ER("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),bt=b.forwardRef(({className:e,...t},n)=>l.jsx(Ret,{ref:n,className:Y(Ynr(),e),...t}));bt.displayName=Ret.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"},Knr={mono:"font-mono"},ve=({as:e="p",className:t,variant:n="ui-md",font:r,...a})=>l.jsx(e,{className:Y(Xnr[n],r&&Knr[r],t),...a}),Xs=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"})]}),Jnr=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)"})})})]}),err=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"})]}),nge=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"})]}),rge=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"})]}),mc=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"})}),dbt=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)"})})})]}),fbt=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)"})})})]}),trr={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",trr[n],t),...r,children:e}),nrr=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"})]}),pbt=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"})}),age=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"})}),rrr=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"})}),Ao=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"})}),G_=e=>l.jsx(qYt,{...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"})}),Tu=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"})]}),arr=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 TO(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 srr={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"},irr=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 srr[a]}},orr=({onOpenChange:e,open:t})=>{const n=uI(),r=Vtr({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 irr(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(Ya,{children:"Add a file attachment via URL or from your computer"})]}),l.jsxs(Fr,{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(bt,{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(xe,{type:"submit",className:"h-8!",variant:"light",children:[l.jsx(_e,{children:l.jsx(cZt,{})}),"Add"]})]}),l.jsx("hr",{className:"my-2 border border-border1"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ve,{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(GWt,{className:"size-12"}),l.jsx(ve,{variant:"header-md",children:"Add a local file"})]})]})]})]})})},lrr=e=>{const[t,n]=b.useState(void 0);return b.useEffect(()=>{if(!e){n(void 0);return}const r=URL.createObjectURL(e);return n(r),()=>{URL.revokeObjectURL(r)}},[e]),t},crr=()=>{const{file:e,src:t}=x2(CZe(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 lrr(e)??t},urr=()=>{const e=uI(),[t,n]=b.useState(!1);return b.useEffect(()=>{e.subscribe(()=>{const r=e.getState().attachments;n(r.length>0)})},[e]),t},drr=e=>{const[t,n]=b.useState({isLoading:!1,text:""});return b.useEffect(()=>{if(!e)return;(async()=>{n(s=>({...s,isLoading:!0}));const a=await e.text();n(s=>({...s,isLoading:!1,text:a}))})()},[e]),t},f3="h-full w-full flex items-center justify-center",hbt=({data:e,url:t})=>{const[n,r]=b.useState(!1);return t?l.jsx("a",{href:t,className:f3,target:"_blank",rel:"noreferrer noopener",children:l.jsx(Df,{className:"text-accent2","aria-label":"View PDF"})}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>r(!0),className:f3,type:"button",children:l.jsx(Df,{className:"text-accent2","aria-label":"View PDF"})}),l.jsx(frr,{data:e,open:n,onOpenChange:r})]})},frr=({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(Ya,{children:"Preview of the PDF document"})]}),l.jsx(Fr,{children:t&&l.jsx("iframe",{src:e,width:"100%",height:"600px"})})]})}),mbt=({src:e})=>{const[t,n]=b.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>n(!0),type:"button",className:f3,children:l.jsx("img",{src:e,className:"object-cover aspect-ratio max-h-[140px] max-w-[320px]",alt:"Preview"})}),l.jsx(prr,{src:e,open:t,onOpenChange:n})]})},prr=({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(Ya,{children:"Preview of the image"})]}),l.jsx(Fr,{children:t&&l.jsx("img",{src:e,alt:"Image"})})]})}),gbt=({data:e})=>{const[t,n]=b.useState(!1),r=e.replace(/<attachment[^>]*>/,"").replace(/<\/attachment>/g,"");return l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>n(!0),className:f3,type:"button",children:l.jsx(Df,{className:"text-neutral3"})}),l.jsx(hrr,{data:r,open:t,onOpenChange:n})]})},hrr=({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(Ya,{children:"Preview of the text file"})]}),l.jsx(Fr,{children:t&&l.jsx("div",{className:"whitespace-pre-wrap",children:e})})]})}),mrr={sm:`${Vl.sm} w-form-sm`,md:`${Vl.md} w-form-md`,lg:`${Vl.lg} w-form-lg`,default:`${Vl.default}`},grr={sm:"sm",md:"default",lg:"lg",default:"default"},vrr={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"},yrr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",jr=je.forwardRef(({className:e,children:t,tooltip:n,size:r="md",variant:a="default",disabled:s,...i},o)=>l.jsxs(sr,{children:[l.jsx(ir,{asChild:!0,children:l.jsx("button",{ref:o,disabled:s,"aria-label":typeof n=="string"?n:void 0,className:Y(yrr,_R,vrr[a],mrr[r],s&&"active:scale-100",e),...i,children:l.jsx(_e,{size:grr[r],children:t})})}),l.jsx(er,{children:n})]}));jr.displayName="IconButton";const brr={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",brr[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 vbt=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)}),xrr=({document:e})=>{const{isLoading:t,text:n}=drr(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(gbt,{data:n})})},wrr=({document:e})=>{const[t,n]=b.useState({isLoading:!1,text:""});b.useEffect(()=>{let a=!1;return(async()=>{if(!e.file)return;n(o=>({...o,isLoading:!0}));const i=await vbt(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(hbt,{data:t.text,url:r?e.file?.name:void 0})})},Srr=()=>{const e=x2(i=>i.type==="image"),t=x2(i=>i.type==="document"?i:void 0),n=crr(),r=x2(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(Y5,{children:l.jsxs(sr,{children:[l.jsx(LJe,{children:l.jsx(ir,{asChild:!0,children:l.jsx("div",{className:"overflow-hidden size-16 rounded-lg bg-surface3 border border-border1 ",children:e?l.jsx(mbt,{src:s??""}):t?.contentType==="application/pdf"?l.jsx(wrr,{document:t}):t?l.jsx(xrr,{document:t}):null})})}),l.jsx(er,{side:"top",children:l.jsx(FJe,{})})]})}),r&&l.jsx(Orr,{})]})})},Orr=()=>l.jsx(nQt,{asChild:!0,children:l.jsx(jr,{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(xb,{})})})}),krr=()=>urr()?l.jsx("div",{className:"flex w-full flex-row items-center gap-4 pb-2",children:l.jsx(IZe,{components:{Attachment:Srr}})}):null;function _rr({containerRef:e}){const[t,n]=b.useState([]),[r,a]=b.useState(null),s=b.useRef(""),i=b.useRef(0),o=b.useCallback(()=>{const u=e.current;if(!u){s.current!==""&&(s.current="",n([]));return}const d=u.getBoundingClientRect(),f=Array.from(u.querySelectorAll("[data-om-badge]"));if(f.length===0){s.current!==""&&(s.current="",n([]));return}const p=[];for(let m=0;m<f.length;m++){const g=f[m],v=g.getAttribute("data-om-badge")||"",x=g.getAttribute("data-om-state")||"complete",w=g.getAttribute("data-om-type")||"observation",O=g.getBoundingClientRect();let k;const _=Err(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:x,top:k,height:j})}const h=JSON.stringify(p);h!==s.current&&(s.current=h,n(p))},[e]);if(b.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]),b.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(Crr,{highlight:u,visible:p},u.cycleId)})})}function Err(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 Crr({highlight:e,visible:t}){const n=jrr(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 jrr(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 Gn={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"},Xb={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},Trr={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"},Nrr={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",Gn.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":Trr[t],n),...a,children:[e&&l.jsx("span",{className:Nrr[t],children:l.jsx(_e,{children:e})}),r]}),Yz=({children:e,initialCollapsed:t=!0,icon:n,title:r,collapsible:a=!0,extraInfo:s,"data-testid":i})=>{const[o,c]=b.useState(t);return b.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(hv,{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 Arr(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 Irr(e){const t=Arr(e);return yrt({override:[Rrr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function Rrr(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 Prr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,Mrr=nn.mark({class:"cm-variable-highlight"}),Y5e=new Pnt({regexp:Prr,decoration:()=>Mrr}),Drr=oi.fromClass(class{decorations;constructor(e){this.decorations=Y5e.createDeco(e)}update(e){this.decorations=Y5e.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),$rr=Drr,Lrr={duration:5e3,cancel:{label:l.jsx(_e,{children:l.jsx(Hn,{})}),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 wd(e){const{classNames:t,...n}=Lrr,{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 Re=(e,t={})=>{if(Array.isArray(e))return e.forEach(n=>Wl(n,wd(t)));if(je.isValidElement(e))return Wl(e,wd(t));if(typeof e=="string")return Wl(e,wd(t));throw new Error("Invalid message type")};Re.success=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent1 shrink-0",children:l.jsx(due,{})}),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 Wl.success(e,wd(n));case"object":return e.forEach(r=>Wl.success(r,wd(n)))}};Re.error=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent2 shrink-0",children:l.jsx(xb,{})}),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 Wl.error(e,wd(n));case"object":return e.forEach(r=>Wl.error(r,wd(n)))}};Re.warning=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent6 shrink-0",children:l.jsx(bb,{})}),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 Wl.warning(e,wd(n));case"object":return e.forEach(r=>Wl.warning(r,wd(n)))}};Re.info=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent3 shrink-0",children:l.jsx(Bl,{})}),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 Wl.info(e,wd(n));case"object":return e.forEach(r=>Wl.info(r,wd(n)))}};Re.custom=(e,t={})=>Wl(e,wd(t));Re.dismiss=e=>{e&&Wl.dismiss(e)};Re.promise=({myPromise:e,loadingMessage:t,successMessage:n,errorMessage:r,onSuccess:a,onError:s,options:i={}})=>Wl.promise(e,{loading:t??"Loading...",success:o=>(a?.(o),n),error:o=>(s?.(o),r||o?.message||"Error..."),...wd(i)});function Bf({text:e,copyMessage:t="Copied to clipboard!"}){const[n,r]=b.useState(!1),a=b.useRef(null),s=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{Re.success(t),r(!0),a.current&&(clearTimeout(a.current),a.current=null),a.current=setTimeout(()=>{r(!1)},2e3)}).catch(()=>{Re.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:n,handleCopy:s}}function hi({content:e,copyMessage:t,tooltip:n="Copy to clipboard",size:r="sm",className:a}){const[s,i]=b.useState(!1),{handleCopy:o}=Bf({text:e,copyMessage:t}),c=()=>{o(),i(!0),setTimeout(()=>i(!1),2e3)};return l.jsxs(sr,{children:[l.jsx(ir,{asChild:!0,children:l.jsx(xe,{onClick:c,type:"button",size:r,className:a,"aria-label":s?"Copied!":n,children:s?l.jsx(ua,{}):l.jsx(Xl,{})})}),l.jsx(er,{children:s?"Copied!":n})]})}function Frr(){const e=PI({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 zrr(){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=Am.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,Zw(t)]}const jv=()=>{const e=Zz();return b.useMemo(()=>e?Frr():zrr(),[e])},la=b.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=jv(),m=e?JSON.stringify(e,null,2):t??"",g=b.useMemo(()=>{const v=[];return s==="json"?v.push(vd):s==="markdown"&&(v.push(Ede({base:nw,codeLanguages:zat})),v.push(gt.lineWrapping)),i&&s==="markdown"&&v.push($rr),c&&s==="markdown"&&v.push(Irr(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(hi,{content:m,className:"absolute top-2 right-2 z-20"}),l.jsx(Eu,{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 Brr(e,t){const{codeToTokens:n,bundledLanguages:r}=await We(async()=>{const{codeToTokens:s,bundledLanguages:i}=await import("./index-CqFevvQD.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 Urr=({selectionReason:e,open:t,onOpenChange:n,input:r})=>{let a=null;if(r)try{a=typeof r=="object"?l.jsx(la,{data:r}):l.jsx(la,{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(Ya,{children:"View the metadata of the agent's network choice."})]}),l.jsxs(Fr,{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ve,{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(ve,{className:"text-neutral3",children:"Input"}),l.jsx("div",{className:"text-neutral6 text-ui-md",children:a})]})]})]})})},sge=({selectionReason:e,input:t})=>{const[n,r]=b.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(jr,{variant:"light",size:"md",tooltip:"Show selection reason",onClick:()=>r(a=>!a),children:l.jsx(hYt,{className:"text-neutral3 size-5"})}),l.jsx(Urr,{selectionReason:e||"",open:n,onOpenChange:r,input:t})]})},ybt=b.createContext(void 0);function qrr({children:e,approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:c,networkToolCallApprovals:u}){return l.jsx(ybt.Provider,{value:{approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:c,networkToolCallApprovals:u},children:e})}function Vrr(){const e=b.useContext(ybt);if(!e)throw new Error("useToolCall must be used within a ToolCallProvider");return e}const CR=({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}=Vrr(),g=()=>{a?p(r,n?.runId):s?c(t):i(t)},v=()=>{a?h(r,n?.runId):s?u(t):o(t)},x=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(xe,{onClick:g,disabled:d||!!x,className:x==="approved"?"text-accent1!":"",children:[l.jsx(_e,{children:l.jsx(ua,{})}),"Approve"]}),l.jsxs(xe,{onClick:v,disabled:d||!!x,className:x==="declined"?"text-accent2!":"",children:[l.jsx(_e,{children:l.jsx(Hn,{})}),"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(x=>x.type==="text"?!0:x.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(la,{data:o,"data-testid":"tool-suspend-payload"});return l.jsxs(Yz,{"data-testid":"agent-badge",icon:l.jsx(Xs,{className:"text-accent1"}),title:e,initialCollapsed:u&&!a,extraInfo:n?.mode==="network"&&l.jsx(sge,{selectionReason:d??"",input:f}),children:[t.map((x,w)=>{if(x.type==="text")return l.jsx(stt,{children:x.content},w);let O;try{O=typeof x.toolOutput=="string"?JSON.parse(x.toolOutput):x.toolOutput}catch{O=x.toolOutput}return l.jsx(je.Fragment,{children:l.jsx(Kbt,{toolName:x.toolName,argsText:typeof x.args=="string"?x.args:JSON.stringify(x.args),result:O,args:x.args,status:{type:"complete"},type:"tool-call",toolCallId:x.toolCallId,addResult:()=>{},resume:()=>{},metadata:{mode:"stream",requireApprovalMetadata: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(CR,{toolCalled:g,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,isGenerateMode:n?.mode==="generate"})]})};function Cr({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 ige=()=>l.jsx(Yz,{icon:l.jsx(Ft,{color:U6.neutral3}),title:l.jsx(Cr,{className:"ml-2 w-12 h-2"}),collapsible:!1}),Qrr=({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}=Vyt({threadId:t?.subAgentThreadId,agentId:e,memory:!0});if(f)return l.jsx(ige,{});const p=d?.messages?gQe(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=czt(p)),l.jsx(Hrr,{agentId:e,messages:h??[],metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:o,toolCalled:c,isComplete:u})},Xz=({copiedDuration:e=1500}={})=>{const[t,n]=b.useState(!1);return{isCopied:t,copyToClipboard:a=>{a&&navigator.clipboard.writeText(a).then(()=>{n(!0),setTimeout(()=>n(!1),e)})}}},bbt=b.createContext({Link:b.forwardRef(()=>null),navigate:()=>{},paths:{agentLink:()=>"",agentsLink:()=>"",agentToolLink:()=>"",agentSkillLink:()=>"",agentThreadLink:()=>"",agentNewThreadLink:()=>"",workflowsLink:()=>"",workflowLink:()=>"",networkLink:()=>"",networkNewThreadLink:()=>"",networkThreadLink:()=>"",scorerLink:()=>"",cmsScorersCreateLink:()=>"",cmsScorerEditLink:()=>"",cmsAgentCreateLink:()=>"",cmsAgentEditLink:()=>"",promptBlockLink:()=>"",promptBlocksLink:()=>"",cmsPromptBlockCreateLink:()=>"",cmsPromptBlockEditLink:()=>"",toolLink:()=>"",skillLink:()=>"",workspacesLink:()=>"",workspaceLink:()=>"",workspaceSkillLink:()=>"",processorsLink:()=>"",processorLink:()=>"",mcpServerLink:()=>"",mcpServerToolLink:()=>"",workflowRunLink:()=>"",datasetLink:()=>"",datasetItemLink:()=>"",datasetExperimentLink:()=>""}}),xbt=({children:e,Link:t,navigate:n,paths:r})=>l.jsx(bbt.Provider,{value:{Link:t,navigate:n,paths:r},children:e}),en=()=>{const e=b.useContext(bbt);if(!e)throw new Error("useLinkComponent must be used within a LinkComponentProvider");return e},Wrr=({toolName:e,args:t,result:n,toolCallId:r,toolApprovalMetadata:a,isNetwork:s,toolCalled:i})=>{const[o,c]=b.useState(!a),{isCopied:u,copyToClipboard:d}=Xz();b.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:x,extension:w}=p,O=[];m!==void 0&&m!==3&&O.push(`depth: ${m}`),g&&O.push("hidden"),v&&O.push("dirs only"),x&&O.push(`exclude: ${x}`),w&&O.push(`ext: ${w}`);let k="",_="";if(typeof n=="string"&&n){const P=n.lastIndexOf(`
462
462
 
463
463
  `);P!==-1?(k=n.slice(0,P),_=n.slice(P+2)):k=n}const C=!!k,T=i??C,j=Zn(P=>P.message),I=b.useMemo(()=>j.content.find(F=>F.type==="data"&&F.name==="workspace-metadata"&&F.data?.toolCallId===r),[j.content,r])?.data,M=()=>{!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(P=>!P),className:"flex items-center gap-2 min-w-0",type:"button",children:[l.jsx(_e,{children:l.jsx(hv,{className:Y("transition-all",o?"rotate-90":"rotate-180")})}),l.jsxs(vt,{icon:l.jsx(MGt,{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(Bte,{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(la,{data:p,"data-testid":"tool-args"})]}),l.jsx(CR,{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(jr,{variant:"light",size:"sm",tooltip:"Copy tree",onClick:M,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(ua,{size:14})}),l.jsx("span",{style:{gridArea:"1/1"},className:Y("transition-transform",u?"scale-0":"scale-100"),children:l.jsx(Xl,{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 qk({children:e}){const t=e.replace(/\\n/g,`
464
464
  `);return l.jsx(stt,{remarkPlugins:[rit],components:Zrr,className:"space-y-3",children:t})}const wbt=je.memo(({children:e,language:t,...n})=>{const[r,a]=b.useState([]);return b.useEffect(()=>{Brr(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=dze.test(u)?u.replace(dze,"$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>=fze)break}}}return(function(h){if(!h.length)return[];var m=Array.from(h);return m.reverse(),m.slice(0,fze).map((g=>{return $t({},g,{filename:g.filename||(v=m,v[v.length-1]||{}).filename,function:g.function||Yk});var v}))})(i)}})("web:javascript",TSr,ISr)}class PSr{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 _3(t,"DOMException")}isDOMError(t){return _3(t,"DOMError")}}class MSr{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 DSr{constructor(){}match(t){return _3(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 $Sr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class LSr{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($Sr);return a&&(n=a[1],r=a[2]),[n,r]}}var FSr=["fatal","error","warning","log","info","debug"];function O1t(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 zSr{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 lve(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: "+O1t(t)}isSeverityLevel(t){return ao(t)&&!Use(t)&&FSr.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(OSr(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class BSr{match(t){return lve(t)}coerce(t,n){var r,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+O1t(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class USr{match(t){return s1t(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 qSr{match(t){return _3(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!lve(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 s1t(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 k1t=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,r={k:function(a){if(Ye&&(cf.DEBUG||Ln.POSTHOG_DEBUG||n)&&!Ht(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)=>k1t(e+" "+a,s)};return r},Wt=k1t("[PostHog.js]"),vi=Wt.createLogger,VSr=vi("[ExternalScriptsLoader]"),pze=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return VSr.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);pze(e,s,n)},Ln.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);pze(e,r,n)};var C3={};function ib(e,t,n){if(Aa(e)){if(tze&&e.forEach===tze)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)===C3)return}}}function Is(e,t,n){if(!ia(e)){if(Aa(e))return ib(e,t,n);if(lSr(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===C3)return}else for(var a in e)if(a1t.call(e,a)&&t.call(n,e[a],a)===C3)return}}var Bi=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 ib(n,(function(a){for(var s in a)a[s]!==void 0&&(e[s]=a[s])})),e},Xk=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 ib(n,(function(a){ib(a,(function(s){e.push(s)}))})),e};function i$(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 hze=function(e){try{return e()}catch{return}},HSr=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){Wt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Wt.critical(a)}}},pve=function(e){var t={};return Is(e,(function(n,r){(ao(n)&&n.length>0||Om(n))&&(t[r]=n)})),t};function QSr(e,t){return n=e,r=s=>ao(s)&&!ih(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),Aa(i)?(c=[],ib(i,(u=>{c.push(s(u))}))):(c={},Is(i,((u,d)=>{a.has(u)||(c[d]=s(u,d))}))),c);var c})(n);var n,r,a}var WSr=["herokuapp.com","vercel.app","netlify.app"];function GSr(e){var t=e?.hostname;if(!ao(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of WSr)if(n===r)return!1;return!0}function _1t(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 E1t(e){return e.name==="ph_toolbar_internal"}var C1t="$people_distinct_id",Sj="__alias",Oj="__timers",mze="$autocapture_disabled_server_side",Wse="$heatmaps_enabled_server_side",gze="$exception_capture_enabled_server_side",Gse="$error_tracking_suppression_rules",vze="$error_tracking_capture_extension_exceptions",yze="$web_vitals_enabled_server_side",j1t="$dead_clicks_enabled_server_side",bze="$product_tours_enabled_server_side",xze="$web_vitals_allowed_metrics",s2="$session_recording_remote_config",j3="$sesid",T1t="$session_is_sampled",tO="$enabled_feature_flags",kj="$early_access_features",Zse="$feature_flag_details",_j="$stored_person_properties",Kx="$stored_group_properties",Yse="$surveys",cT="$flag_call_reported",Xse="$flag_call_reported_session_id",Kse="$feature_flag_errors",T3="$feature_flag_evaluated_at",Th="$user_state",Jse="$client_session_props",eie="$capture_rate_limit",tie="$initial_campaign_params",nie="$initial_referrer_info",N3="$initial_person_info",A3="$epp",N1t="__POSTHOG_TOOLBAR__",zC="$posthog_cookieless",ZSr=[C1t,Sj,"__cmpns",Oj,"$session_recording_enabled_server_side",Wse,j3,tO,Gse,Th,kj,Zse,Kx,_j,Yse,cT,Xse,Kse,T3,Jse,eie,tie,nie,A3,N3];Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Om(e)&&isFinite(e)&&Math.floor(e)===e});var wze="0123456789abcdef";class I3{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 I3(s)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+wze.charAt(this.bytes[n]>>>4)+wze.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 I3(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 YSr{constructor(){this.P=0,this.T=0,this.R=new XSr}generate(){var t=this.generateOrAbort();if(Ht(t)){this.P=0;var n=this.generateOrAbort();if(Ht(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 I3.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,A1t=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&&!Ht(Ye.crypto)&&crypto.getRandomValues&&(A1t=e=>crypto.getRandomValues(e));class XSr{constructor(){this.C=new Uint32Array(8),this.O=1/0}nextUint32(){return this.O>=this.C.length&&(A1t(this.C),this.O=0),this.C[this.O++]}}var Hy=()=>KSr().toString(),KSr=()=>(Sze||(Sze=new YSr)).generate(),BC="",JSr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function e1r(e,t){if(t){var n=(function(a,s){if(s===void 0&&(s=Ut),BC)return BC;if(!s||["localhost","127.0.0.1"].includes(a))return"";for(var i=a.split("."),o=Math.min(i.length,8),c="dmn_chk_"+Hy();!BC&&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",BC=u)}return BC})(e);if(!n){var r=(a=>{var s=a.match(JSr);return s?s[0]:""})(e);r!==n&&Wt.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Bh={F:()=>!!Ut,M:function(e){Wt.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(Bh.A(e))||{}}catch{}return t},L:function(e,t,n,r,a){if(Ut)try{var s="",i="",o=e1r(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&&Wt.warn("cookieStore warning: large cookie, len="+u.length),Ut.cookie=u,u}catch{return}},j:function(e,t){if(Ut!=null&&Ut.cookie)try{Bh.L(e,"",-1,t)}catch{return}}},eee=null,fi={F:function(){if(!ih(eee))return eee;var e=!0;if(Ht(Ye))e=!1;else try{var t="__mplssupport__";fi.L(t,"xyz"),fi.A(t)!=='"xyz"'&&(e=!1),fi.j(t)}catch{e=!1}return e||Wt.error("localStorage unsupported; falling back to cookie store"),eee=e,e},M:function(e){Wt.error("localStorage error: "+e)},A:function(e){try{return Ye?.localStorage.getItem(e)}catch(t){fi.M(t)}return null},D:function(e){try{return JSON.parse(fi.A(e))||{}}catch{}return null},L:function(e,t){try{Ye?.localStorage.setItem(e,JSON.stringify(t))}catch(n){fi.M(n)}},j:function(e){try{Ye?.localStorage.removeItem(e)}catch(t){fi.M(t)}}},t1r=["$device_id","distinct_id",j3,T1t,A3,N3,Th],i2={},n1r={F:function(){return!0},M:function(e){Wt.error("memoryStorage error: "+e)},A:function(e){return i2[e]||null},D:function(e){return i2[e]||null},L:function(e,t){i2[e]=t},j:function(e){delete i2[e]}},Bx=null,pl={F:function(){if(!ih(Bx))return Bx;if(Bx=!0,Ht(Ye))Bx=!1;else try{var e="__support__";pl.L(e,"xyz"),pl.A(e)!=='"xyz"'&&(Bx=!1),pl.j(e)}catch{Bx=!1}return Bx},M:function(e){Wt.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)}}},Sg=(function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e})({});class r1r{constructor(t){this._instance=t}get N(){return this._instance.config}get consent(){return this.U()?Sg.DENIED:this.H}isOptedOut(){return this.N.cookieless_mode==="always"||this.consent===Sg.DENIED||this.consent===Sg.PENDING&&(this.N.opt_out_capturing_by_default||this.N.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Sg.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 XJ(t)?Sg.GRANTED:Xr(dSr,t)?Sg.DENIED:Sg.PENDING}get B(){if(!this.V){var t=this.N.opt_out_capturing_persistence_type;this.V=t==="localStorage"?fi:Bh;var n=t==="localStorage"?Bh:fi;n.A(this.q)&&(this.V.A(this.q)||this.optInOut(XJ(n.A(this.q))),n.j(this.q,this.N.cross_subdomain_cookie))}return this.V}U(){return!!this.N.respect_dnt&&!!_1t([hd?.doNotTrack,hd?.msDoNotTrack,Ln.doNotTrack],(t=>XJ(t)))}}var o2=vi("[Dead Clicks]"),a1r=()=>!0,s1r=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(j1t)),r=e.instance.config.capture_dead_clicks;return Hg(r)?r:!!Co(r)||n};class Oze{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({[j1t]: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?o2.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),o2.info("starting...")}}else o2.error("`document` not found. Cannot start.")}stop(){this.W&&(this.W.stop(),this.W=void 0,o2.info("stopping..."))}}var tee=vi("[SegmentIntegration]");function i1r(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()||Hy();r.config.get_device_id=u,c.id()&&(r.register({distinct_id:c.id(),$device_id:u()}),r.persistence.set_property(Th,"identified")),a()},o=s.user();"then"in o&&Mg(o.then)?o.then(i):i(o)})(e,(()=>{n.register((r=>{Promise&&Promise.resolve||tee.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()||(tee.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(tee.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 I1t="posthog-js";function R1t(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=>$t({},w,{stacktrace:w.stacktrace?$t({},w.stacktrace,{type:"raw",frames:(w.stacktrace.frames||[]).map((O=>$t({},O,{platform:"web:javascript"})))}):void 0}))),x={$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&&(x.$sentry_url=(a||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+o.event_id),i&&((m=e.exceptions)==null||m.sendExceptionEvent(x)),o}}class o1r{constructor(t,n,r,a,s,i){this.name=I1t,this.setupOnce=function(o){o(R1t(t,{organization:n,projectId:r,prefix:a,severityAllowList:s,sendExceptionsToPostHog:i==null||i}))}}}class kze{constructor(t){this.J=(n,r,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength)&&(Wt.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(!(Ht(i)||Ht(o)||Ht(c)||Ht(u)||Ht(d)||Ht(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:tm(o/i,0,1,Wt),h=i<=1?1:tm(c/i,0,1,Wt),m=u<=1?1:tm(d/u,0,1,Wt),g=u<=1?1:tm(f/u,0,1,Wt);a=Bi(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 R3=e=>{var t=Ut?.createElement("a");return Ht(t)?null:(t.href=e,t)},l1r=function(e,t){var n,r;t===void 0&&(t="&");var a=[];return Is(e,(function(s,i){Ht(s)||Ht(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)},P3=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(!Aa(n)||n.length<2)return"";var i=n[1];try{i=decodeURIComponent(i)}catch{Wt.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},jA=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("=");Aa(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},M3=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},l2="https?://(.*)",Kk=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],c1r=Xk(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Kk),TA="<masked>",u1r=["li_fat_id"];function P1t(e,t,n){if(!Ut)return{};var r,a=t?Xk([],Kk,n||[]):[],s=M1t(jA(Ut.URL,a,TA),e),i=(r={},Is(u1r,(function(o){var c=Bh.A(o);r[o]=c||null})),r);return Bi(i,s)}function M1t(e,t){var n=c1r.concat(t||[]),r={};return Is(n,(function(a){var s=P3(e,a);r[a]=s||null})),r}function D1t(e){var t=(function(s){return s?s.search(l2+"google.([^/?]*)")===0?"google":s.search(l2+"bing.com")===0?"bing":s.search(l2+"yahoo.com")===0?"yahoo":s.search(l2+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!ih(t)){r.$search_engine=t;var a=Ut?P3(Ut.referrer,n):"";a.length&&(r.ph_keyword=a)}return r}function _ze(){return navigator.language||navigator.userLanguage}function $1t(){return Ut?.referrer||"$direct"}function L1t(e,t){var n=e?Xk([],Kk,t||[]):[],r=ml?.href.substring(0,1e3);return{r:$1t().substring(0,1e3),u:r?jA(r,n,TA):void 0}}function F1t(e){var t,{r:n,u:r}=e,a={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=R3(n))==null?void 0:t.host};if(r){a.$current_url=r;var s=R3(r);a.$host=s?.host,a.$pathname=s?.pathname;var i=M1t(r);Bi(a,i)}if(n){var o=D1t(n);Bi(a,o)}return a}function z1t(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function d1r(){try{return new Date().getTimezoneOffset()}catch{return}}function f1r(e,t){var n,r,a,s;if(!Jc)return{};var i,o,c,u,d,f,p,h,m=e?Xk([],Kk,t||[]):[],[g,v]=(function(x){for(var w=0;w<cze.length;w++){var[O,k]=cze[w],_=O.exec(x),C=_&&(Mg(k)?k(_,x):k);if(C)return C}return["",""]})(Jc);return Bi(pve({$os:g,$os_version:v,$browser:w1t(Jc,navigator.vendor),$device:uze(Jc),$device_type:(o=Jc,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=uze(o),h===o1t||h===i1t||h==="Kobo"||h==="Kindle Fire"||h===x1t?Gk:h===EA||h===PO||h===CA||h===Vse?"Console":h===c1t?"Wearable":h?Sd: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?Gk:Sd:"Desktop"),$timezone:z1t(),$timezone_offset:d1r()}),{$current_url:jA(ml?.href,m,TA),$host:ml?.host,$pathname:ml?.pathname,$raw_user_agent:Jc.length>1e3?Jc.substring(0,997)+"...":Jc,$browser_version:SSr(Jc,navigator.vendor),$browser_language:_ze(),$browser_language_prefix:(i=_ze(),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:cf.LIB_NAME,$lib_version:cf.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var p1r=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class nee{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&&Wt.info("Persistence loaded",t.persistence,$t({},this.props)),this.update_config(t,t,n),this.save()}isDisabled(){return!!this.st}rt(t){p1r.indexOf(t.persistence.toLowerCase())===-1&&(Wt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=(function(a){a===void 0&&(a=[]);var s=[...t1r,...a];return $t({},fi,{D:function(i){try{var o={};try{o=Bh.D(i)||{}}catch{}var c=Bi(o,JSON.parse(fi.A(i)||"{}"));return fi.L(i,c),c}catch{}return null},L:function(i,o,c,u,d,f){try{fi.L(i,o,void 0,void 0,f);var p={};s.forEach((h=>{o[h]&&(p[h]=o[h])})),Object.keys(p).length&&Bh.L(i,p,c,u,d,f)}catch(h){fi.M(h)}},j:function(i,o){try{Ye?.localStorage.removeItem(i),Bh.j(i,o)}catch(c){fi.M(c)}}})})(t.cookie_persisted_properties||[]),r=t.persistence.toLowerCase();return r==="localstorage"&&fi.F()?fi:r==="localstorage+cookie"&&n.F()?n:r==="sessionstorage"&&pl.F()?pl:r==="memory"?n1r:r==="cookie"?Bh:n.F()?n:Bh}nt(t){var n=t??this.N.feature_flag_cache_ttl_ms;if(!n||n<=0)return!1;var r=this.props[T3];return!r||typeof r!="number"||Date.now()-r>n}properties(){var t={};return Is(this.props,((n,r)=>{if(r===tO&&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,(ih(i=ZSr)?c:nze&&i.indexOf===nze?i.indexOf(o)!=-1:(Is(i,(function(u){if(c||(c=u===o))return C3})),c))||(t[r]=n);var i,o,c})),t}load(){if(!this.st){var t=this.B.D(this.et);t&&(this.props=Bi({},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)){Ht(n)&&(n="None"),this.ot=Ht(r)?this.dt:r;var a=!1;if(Is(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=Ht(n)?this.dt:n;var r=!1;if(Is(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=P1t(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);eO(pve(t))||this.register(t),this.it=!0}}update_search_keyword(){var t;this.register((t=Ut?.referrer)?D1t(t):{})}update_referrer_info(){var t;this.register_once({$referrer:$1t(),$referring_domain:Ut!=null&&Ut.referrer&&((t=R3(Ut.referrer))==null?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[tie]||this.props[nie]||this.register_once({[N3]:L1t(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Is([nie,tie],(i=>{var o=this.props[i];o&&Is(o,(function(c,u){t["$initial_"+Bse(u)]=c}))}));var n,r,a=this.props[N3];if(a){var s=(n=F1t(a),r={},Is(n,(function(i,o){r["$initial_"+Bse(o)]=i})),r);Bi(t,s)}return t}safe_merge(t){return Is(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[Oj]||{};r[t]=n,this.props[Oj]=r,this.save()}remove_event_timer(t){var n=(this.props[Oj]||{})[t];return Ht(n)||(delete this.props[Oj][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var UC={Activation:"events",Cancellation:"cancelEvents"},ree={Popover:"popover",API:"api",Widget:"widget"},Ej={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},aee={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},rie={Popover:"popover",Inline:"inline"},h1r=(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})({}),Eze=(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})({}),Cze=vi("[RateLimiter]");class m1r{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=>{Cze.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void Cze.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(eie))!==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(eie,c),{isRateLimited:u,remainingTokens:c.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var qC=vi("[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 qC.info("Using preloaded remote config",this.remoteConfig),this.ft(this.remoteConfig),void this._t();if(this._instance.bt())return void qC.warn("Remote config is disabled. Falling back to local config.");this.vt((t=>{if(!t)return qC.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){qC.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||qC.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 Tg=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Rf=Uint8Array,vu=Uint16Array,Jk=Uint32Array,hve=new Rf([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]),mve=new Rf([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]),jze=new Rf([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),U1t=function(e,t){for(var n=new vu(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var a=new Jk(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]},q1t=U1t(hve,2),g1r=q1t[0],aie=q1t[1];g1r[28]=258,aie[258]=28;for(var Tze=U1t(mve,0)[1],V1t=new vu(32768),Hs=0;Hs<32768;++Hs){var Ux=(43690&Hs)>>>1|(21845&Hs)<<1;Ux=(61680&(Ux=(52428&Ux)>>>2|(13107&Ux)<<2))>>>4|(3855&Ux)<<4,V1t[Hs]=((65280&Ux)>>>8|(255&Ux)<<8)>>>1}var uT=function(e,t,n){for(var r=e.length,a=0,s=new vu(t);a<r;++a)++s[e[a]-1];var i,o=new vu(t);for(a=0;a<t;++a)o[a]=o[a-1]+s[a-1]<<1;for(i=new vu(r),a=0;a<r;++a)i[a]=V1t[o[e[a]-1]++]>>>15-e[a];return i},Ew=new Rf(288);for(Hs=0;Hs<144;++Hs)Ew[Hs]=8;for(Hs=144;Hs<256;++Hs)Ew[Hs]=9;for(Hs=256;Hs<280;++Hs)Ew[Hs]=7;for(Hs=280;Hs<288;++Hs)Ew[Hs]=8;var D3=new Rf(32);for(Hs=0;Hs<32;++Hs)D3[Hs]=5;var v1r=uT(Ew,9),y1r=uT(D3,5),H1t=function(e){return(e/8>>0)+(7&e&&1)},Q1t=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof vu?vu:e instanceof Jk?Jk:Rf)(n-t);return r.set(e.subarray(t,n)),r},mg=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},VC=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},see=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 Rf(0),0];if(a==1){var i=new Rf(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 vu(p+1),m=sie(n[d-1],h,0);if(m>t){r=0;var g=0,v=m-t,x=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+=x-(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 Rf(h),m]},sie=function(e,t,n){return e.s==-1?Math.max(sie(e.l,t,n+1),sie(e.r,t,n+1)):t[e.s]=n},Nze=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new vu(++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]},HC=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},iie=function(e,t,n){var r=n.length,a=H1t(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)},Aze=function(e,t,n,r,a,s,i,o,c,u,d){mg(t,d++,n),++a[256];for(var f=see(a,15),p=f[0],h=f[1],m=see(s,15),g=m[0],v=m[1],x=Nze(p),w=x[0],O=x[1],k=Nze(g),_=k[0],C=k[1],T=new vu(19),j=0;j<w.length;++j)T[31&w[j]]++;for(j=0;j<_.length;++j)T[31&_[j]]++;for(var A=see(T,7),I=A[0],M=A[1],P=19;P>4&&!I[jze[P-1]];--P);var F,D,U,q,z=u+5<<3,V=HC(a,Ew)+HC(s,D3)+i,W=HC(a,p)+HC(s,g)+i+14+3*P+HC(T,I)+(2*T[16]+3*T[17]+7*T[18]);if(z<=V&&z<=W)return iie(t,d,e.subarray(c,c+u));if(mg(t,d,1+(W<V)),d+=2,W<V){F=uT(p,h),D=p,U=uT(g,v),q=g;var $=uT(I,M);for(mg(t,d,O-257),mg(t,d+5,C-1),mg(t,d+10,P-4),d+=14,j=0;j<P;++j)mg(t,d+3*j,I[jze[j]]);d+=3*P;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];mg(t,d,$[Q]),d+=I[Q],Q>15&&(mg(t,d,R[j]>>>5&127),d+=R[j]>>>12)}}}else F=v1r,D=Ew,U=y1r,q=D3;for(j=0;j<o;++j)if(r[j]>255){Q=r[j]>>>18&31,VC(t,d,F[Q+257]),d+=D[Q+257],Q>7&&(mg(t,d,r[j]>>>23&31),d+=hve[Q]);var G=31&r[j];VC(t,d,U[G]),d+=q[G],G>3&&(VC(t,d,r[j]>>>5&8191),d+=mve[G])}else VC(t,d,F[r[j]]),d+=D[r[j]];return VC(t,d,F[256]),d+D[256]},b1r=new Jk([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),x1r=(function(){for(var e=new Jk(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),w1r=function(e,t,n,r,a){return(function(s,i,o,c,u,d){var f=s.length,p=new Rf(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=iie(h,m,s.subarray(g,v)):(h[g]=d,m=iie(h,m,s.subarray(g,f)))}else{for(var x=b1r[i-1],w=x>>>13,O=8191&x,k=(1<<o)-1,_=new vu(32768),C=new vu(k+1),T=Math.ceil(o/3),j=2*T,A=function(ae){return(s[ae]^s[ae+1]<<T^s[ae+2]<<j)&k},I=new Jk(25e3),M=new vu(288),P=new vu(32),F=0,D=0,U=(g=0,0),q=0,z=0;g<f;++g){var V=A(g),W=32767&g,$=C[V];if(_[W]=$,C[V]=W,q<=g){var Z=f-g;if((F>7e3||U>24576)&&Z>423){m=Aze(s,h,0,I,M,P,D,U,z,g-z,m),U=F=D=0,z=g;for(var B=0;B<286;++B)M[B]=0;for(B=0;B<30;++B)P[B]=0}var R=2,Q=0,G=O,te=W-$&32767;if(Z>2&&V==A(g-te))for(var oe=Math.min(w,Z)-1,re=Math.min(32767,g),se=Math.min(258,Z);te<=re&&--G&&W!=$;){if(s[g+R]==s[g+R-te]){for(var ue=0;ue<se&&s[g+ue]==s[g+ue-te];++ue);if(ue>R){if(R=ue,Q=te,ue>oe)break;var me=Math.min(te,ue-2),J=0;for(B=0;B<me;++B){var ne=g-te+B+32768&32767,le=ne-_[ne]+32768&32767;le>J&&(J=le,$=ne)}}}te+=(W=$)-($=_[W])+32768&32767}if(Q){I[U++]=268435456|aie[R]<<18|Tze[Q];var be=31&aie[R],fe=31&Tze[Q];D+=hve[be]+mve[fe],++M[257+be],++P[fe],q=g+R,++F}else I[U++]=s[g],++M[s[g]]}}m=Aze(s,h,d,I,M,P,D,U,z,g-z,m)}return Q1t(p,0,c+H1t(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)},iee=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function S1r(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=x1r[255&u^c[d]]^u>>>8;o=u},d:function(){return 4294967295^o}}})(),r=e.length;n.p(e);var a,s=w1r(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&&iee(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),iee(s,i-8,n.d()),iee(s,i-4,r),s}var O1r=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),ih(o)||(n>t&&(s+=e.substring(t,n)),s+=o,t=n=a+1)}return n>t&&(s+=e.substring(t,e.length)),s},k1r=!!zse||!!Fse,$3=function(e,t,n){var r;n===void 0&&(n=!0);var[a,s]=e.split("?"),i=$t({},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=l1r(i);return c&&o.push(c),a+"?"+o.join("&")},Cj=(e,t)=>JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t),oee=e=>{var{data:t,compression:n}=e;if(t){if(n===Tg.GZipJS){var r=S1r((function(o,c){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var d=new Rf(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 Rf(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 Q1t(d,0,f)})(Cj(t)),{mtime:0});return{contentType:"text/plain",body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Tg.Base64){var a=(function(o){var c,u,d,f,p,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,g=0,v="",x=[];if(!o)return o;o=O1r(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,x[g++]=h.charAt(c)+h.charAt(u)+h.charAt(d)+h.charAt(f);while(m<o.length);switch(v=x.join(""),o.length%3){case 1:v=v.slice(0,-2)+"==";break;case 2:v=v.slice(0,-1)+"="}return v})(Cj(t)),s=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Cj(o)))(a);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var i=Cj(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}}},o$=[];Fse&&o$.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:a,estimatedSize:s}=(t=oee(e))!==null&&t!==void 0?t:{},i=new Headers;Is(e.headers,(function(d,f){i.append(f,d)})),r&&i.append("Content-Type",r);var o=e.url,c=null;if(rze){var u=new rze;c={signal:u.signal,timeout:setTimeout((()=>u.abort()),e.timeout)}}Fse(o,$t({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){Wt.error(h)}e.callback==null||e.callback(p)})))).catch((d=>{Wt.error(d),e.callback==null||e.callback({statusCode:0,error:d})})).finally((()=>c?clearTimeout(c.timeout):null))}}),zse&&o$.push({transport:"XHR",method:e=>{var t,n=new zse;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:a}=(t=oee(e))!==null&&t!==void 0?t:{};Is(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)}}),hd!=null&&hd.sendBeacon&&o$.push({transport:"sendBeacon",method:e=>{var t=$3(e.url,{beacon:"1"});try{var n,{contentType:r,body:a}=(n=oee(e))!==null&&n!==void 0?n:{},s=typeof a=="string"?new Blob([a],{type:r}):a;hd.sendBeacon(t,s)}catch{}}});var oie=3e3;class _1r{constructor(t,n){this.wt=!0,this.Et=[],this.St=tm(n?.flush_interval_ms||oie,250,5e3,Wt.createLogger("flush interval"),oie),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($t({},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&&Aa(s.data)&&Is(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 Is(this.Et,(n=>{var r,a=n,s=(a?a.batchKey:null)||a.url;Ht(t[s])&&(t[s]=$t({},a,{data:[]})),(r=t[s].data)==null||r.push(a.data)})),this.Et=[],t}}var E1r=["retriesPerformedSoFar"];class C1r{constructor(t){this.Rt=!1,this.It=3e3,this.Et=[],this._instance=t,this.Et=[],this.Ct=!0,!Ht(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=n1t(t,E1r);I1(n)&&(r.url=$3(r.url,{retry_count:n})),this._instance._send_request($t({},r,{callback:a=>{a.statusCode!==200&&(a.statusCode<400||a.statusCode>=500)&&(n??0)<10?this.At($t({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)"),Wt.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,Ht(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($t({},t,{transport:"sendBeacon"}))}catch(n){Wt.error(n)}this.Et=[]}}class j1r{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=Aa(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 T1r=e=>L1t(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties);class Ize{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({[Jse]:o})}},this._instance=t,this.qt=n,this.Bt=r,this.Ht=a||T1r,this.qt.onSessionId(this.Ut)}zt(){return this.Bt.props[Jse]}getSetOnceProps(){var t,n=(t=this.zt())==null?void 0:t.props;return n?"r"in n?F1t(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 Is(pve(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+Bse(r)]=n})),t}}class gve{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 lee=vi("[SessionId]");class Rze{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 gve,this.Jt=(d,f)=>!(!I1(d)||!I1(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||Hy,this.Zt=r||Hy;var s=this.N.persistence_name||this.N.token,i=this.N.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*tm(i,60,36e3,lee.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){lee.error("Invalid sessionID in bootstrap",d)}this.ni()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ht(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({[j3]:[n,t,r]}))}li(){var t=this.Bt.props[j3];return Aa(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=I1(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(),lee.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=I1(a)&&t&&!c?a:r,h=I1(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 W1t=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&ize(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((a=>ize(a?.brand,t))))return!0}catch{}return!!e.webdriver},L3=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 Pze(e,t,n){return Cj({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var G1t={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=>L3(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!L3(n,r))))),icontains:(e,t)=>t.map(c2).some((n=>e.map(c2).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(c2).every((n=>e.map(c2).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)))}))},c2=e=>e.toLowerCase();function Z1t(e,t){return!e||Object.entries(e).every((n=>{var[r,a]=n,s=t?.[r];if(Ht(s)||ih(s))return!1;var i=[String(s)],o=G1t[a.operator];return!!o&&o(a.values,i)}))}var jj=(function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e})({}),Mze="i.posthog.com";class N1r{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("."+Mze,".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]=jj.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hi[this.apiHost]=jj.EU:this.hi[this.apiHost]=jj.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===jj.CUSTOM)return this.apiHost+n;var r=Mze+n;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var gs=vi("[Surveys]"),Y1t="seenSurvey_",A1r=(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},Dze=e=>((t,n)=>{var r=""+t+n.id;return n.current_iteration&&n.current_iteration>0&&(r=""+t+n.id+"_"+n.current_iteration),r})(Y1t,e),I1r=[ree.Popover,ree.Widget,ree.API],R1r={ignoreConditions:!1,ignoreDelay:!1,displayType:rie.Popover},P1r=vi("[PostHog ExternalIntegrations]"),M1r={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class D1r{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 P1r.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(M1r[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 dT={},cee=0,lie=()=>{},R1="posthog",X1t=!k1r&&Jc?.indexOf("MSIE")===-1&&Jc?.indexOf("Mozilla")===-1,$ze=e=>{var t;return $t({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:GSr(Ut?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:lie,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;Wt.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:oie},error_tracking:{},_onCapture:lie,__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))},Lze=e=>{var t={};Ht(e.process_person)||(t.person_profiles=e.process_person),Ht(e.xhr_headers)||(t.request_headers=e.xhr_headers),Ht(e.cookie_name)||(t.persistence_name=e.cookie_name),Ht(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Ht(e.store_google)||(t.save_campaign_params=e.store_google),Ht(e.verbose)||(t.debug=e.verbose);var n=Bi({},t,e);return Aa(e.property_blacklist)&&(Ht(e.property_denylist)?n.property_denylist=e.property_blacklist:Aa(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Wt.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class $1r{constructor(){this.__forceAllowLocalhost=!1}get di(){return this.__forceAllowLocalhost}set di(t){Wt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Uh{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 $1r,this.fi=!1,this.version=cf.LIB_VERSION,this.pi=new gve,this.ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=$ze(),this.SentryIntegration=o1r,this.sentryIntegration=r=>(function(a,s){var i=R1t(a,s);return{name:I1t,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 j1r(this),this.pageViewManager=new kze(this),this.rateLimiter=new m1r(this),this.requestRouter=new N1r(this),this.consent=new r1r(this),this.externalIntegrations=new D1r(this);var n=(t=Uh.__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=>Wt.info('send "'+r?.event+'"',r)))}init(t,n,r){if(r&&r!==R1){var a,s=(a=dT[r])!==null&&a!==void 0?a:new Uh;return s._init(t,n,r),dT[r]=s,dT[R1][r]=s,s}return this._init(t,n,r)}_init(t,n,r){var a;if(n===void 0&&(n={}),Ht(t)||Use(t))return Wt.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(Bi({},$ze(n.defaults),Lze(n),{name:r,token:t})),this.config.on_xhr_error&&Wt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Tg.GZipJS;var s=this.xi();this.persistence=new nee(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new nee($t({},this.config,{persistence:"sessionStorage"}),s);var i=$t({},this.persistence.props),o=$t({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.$i=new _1r((m=>this.ki(m)),this.config.request_queue_config),this.Pi=new C1r(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 Rze(this),this.sessionPropsManager=new Ize(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Wt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ti(c)}),0)):(Wt.info("Initializing extensions synchronously"),this.Ti(c)),cf.DEBUG=cf.DEBUG||this.config.debug,cf.DEBUG&&Wt.info("Starting in debug mode",{this:this,config:n,thisC:$t({},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(Hy()),p=(u=n.bootstrap)!=null&&u.isIdentifiedID?f:n.bootstrap.distinctID;this.persistence.set_property(Th,(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:zC,$device_id:null},"");else if(!this.get_distinct_id()){var h=this.config.get_device_id(Hy());this.register_once({distinct_id:h,$device_id:h},""),this.persistence.set_property(Th,"anonymous")}return eo(Ye,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?i1r(this,(()=>this.Ri())):this.Ri(),Mg(this.config._onCapture)&&this.config._onCapture!==lie&&(Wt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(m=>this.config._onCapture(m.event,m)))),this.config.ip&&Wt.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=$t({},Uh.__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,s1r)),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){Wt.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&&Wt.info("PostHog extensions initialized ("+a+"ms)")}ft(t){var n;if(!Ut||!Ut.body)return Wt.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=Xr(t.supportedCompression,Tg.GZipJS)?Tg.GZipJS:Xr(t.supportedCompression,Tg.Base64)?Tg.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){Wt.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()&&ib(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&&(X1t?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=$3(t.url,{ip:this.config.ip?1:0}),t.headers=$t({},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=$t({},n);i.timeout=i.timeout||6e4,i.url=$3(i.url,{_:new Date().getTime().toString(),ver:cf.JS_SDK_VERSION,compression:i.compression});var o=(r=i.transport)!==null&&r!==void 0?r:"fetch",c=o$.filter((d=>!i.disableTransport||!d.transport||!i.disableTransport.includes(d.transport))),u=(a=(s=_1t(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)})($t({},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){cee++;try{var n,r=[],a=[],s=[];ib(t,(o=>{o&&(n=o[0],Aa(n)?s.push(o):Mg(o)?o.call(this):Aa(o)&&n==="alias"?r.push(o):Aa(o)&&n.indexOf("capture")!==-1&&Mg(this[n])?s.push(o):a.push(o))}));var i=function(o,c){ib(o,(function(u){if(Aa(u[0])){var d=c;Is(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{cee--}}push(t){if(cee>0&&Aa(t)&&ao(t[0])){var n=Uh.prototype[t[0]];Mg(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(!Ht(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)&&(Wt.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||Wt.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=Hy(),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=QSr(d,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=c,Ht(r?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=o),t===Ej.DISMISSED||t===Ej.SENT){var m=n?.[aee.SURVEY_ID],g=n?.[aee.SURVEY_ITERATION];f={id:m,current_iteration:g},localStorage.getItem(Dze(f))||localStorage.setItem(Dze(f),"true"),d.$set=$t({},d.$set,{[A1r({id:m,current_iteration:g},t===Ej.SENT?"responded":"dismissed")]:!0})}else t===Ej.SHOWN&&(d.$set=$t({},d.$set,{[aee.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===h1r.SHOWN){var v=n?.[Eze.TOUR_TYPE];v&&(d.$set=$t({},d.$set,{[Eze.TOUR_LAST_SEEN_DATE+"/"+v]:new Date().toISOString()}))}var x=$t({},d.properties.$set,d.$set);if(eO(x)||this.setPersonPropertiesForFlags(x),!ia(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}Wt.critical("This capture call is ignored due to client rate limiting.")}}else Wt.error("No event name provided to posthog.capture")}else Wt.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=$t({},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=$t({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=c.distinct_id,(!ao(o.distinct_id)&&!Om(o.distinct_id)||Use(o.distinct_id))&&Wt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,d=f1r(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&&Bi(o,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&Bi(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(h=this.Pi)==null?void 0:h.length}catch(x){o.$sdk_debug_error_capturing_properties=String(x)}if(this.requestRouter.region===jj.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=Bi(o,u),t==="$pageview"&&Ut&&(o.title=Ut.title),!Ht(i)){var m=r.getTime()-i;o.$duration=parseFloat((m/1e3).toFixed(3))}Jc&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=Bi({},d,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),Aa(this.config.property_denylist)?Is(this.config.property_denylist,(function(x){delete o[x]})):Wt.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&&(Wt.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=Bi({},a,s||{},t||{}),o=this.config.sanitize_properties;return o&&(Wt.error("sanitize_properties is deprecated. Use before_send instead"),i=o(i,"$set_once")),n&&(this.fi=!0),eO(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=R1r),(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 Wt.uninitializedWarning("posthog.identify");if(Om(t)&&(t=t.toString(),Wt.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()))Wt.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!==zC){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(Sj)&&(this.unregister(Sj),this.register({distinct_id:t}));var i,o=(this.persistence.get_property(Th)||"anonymous")==="anonymous";t!==a&&o?(this.persistence.set_property(Th,"identified"),this.setPersonPropertiesForFlags($t({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:r||{}}),this.yi=Pze(t,n,r),(i=this.featureFlags)==null||i.setAnonymousDistinctId(a)):(n||r)&&this.setPersonProperties(n,r),t!==a&&(this.reloadFeatureFlags(),this.unregister(cT))}}else Wt.critical('The string "'+zC+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Wt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this.Ui("posthog.setPersonProperties")){var r=Pze(this.get_distinct_id(),t,n);this.yi!==r?(this.setPersonPropertiesForFlags($t({},n||{},t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.yi=r):Wt.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:$t({},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 Wt.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(Wt.info("reset"),!this.__loaded)return Wt.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(Th,"anonymous"),(c=this.sessionManager)==null||c.resetSessionId(),this.yi=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:zC,$device_id:null},"");else{var d=this.config.get_device_id(Hy());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(C1t)?(Wt.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ui("posthog.alias")?(Ht(n)&&(n=this.get_distinct_id()),t!==n?(this.zi(Sj,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Wt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=$t({},this.config);if(Co(t)){var r,a,s,i,o,c,u,d,f;Bi(this.config,Lze(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 nee($t({},this.config,{persistence:"sessionStorage"}),p);var h=this.wi(this.config.debug);Hg(h)&&(this.config.debug=h),Hg(this.config.debug)&&(this.config.debug?(cf.DEBUG=!0,fi.F()&&fi.L("ph_debug",!0),Wt.info("set_config",{config:t,oldConfig:n,newConfig:$t({},this.config)})):(cf.DEBUG=!1,fi.F()&&fi.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){cf.LIB_NAME=t,cf.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($t({},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:R1;return n!==R1&&(n=R1+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Th))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(Th))==="identified"}Ni(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&eO(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Sj])&&((n=this.persistence)==null||(n=n.props)==null||!n[A3]))}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"?(Wt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.zi(A3,!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 Rze(this),this.pageViewManager=new kze(this),this.persistence&&(this.sessionPropsManager=new Ize(this,this.sessionManager,this.persistence));var c=(s=(i=this.config.__extensionClasses)==null?void 0:i.sessionRecording)!==null&&s!==void 0?s:(o=Uh.__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()),(Ht(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 Wt.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:zC,$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())):Wt.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===Sg.GRANTED?"granted":t===Sg.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 hd?W1t(hd,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?(Wt.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=Wt,i=(n="advanced_disable_flags")in(t=c)&&!ia(t[n]),o=r in t&&!ia(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(ia(this.config.before_send))return t;var n=Aa(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var a of n){if(r=a(r),ia(r)){var s="Event '"+t.event+"' was rejected in beforeSend function";return cSr(t.event)?Wt.warn(s+". This can cause unexpected behavior."):Wt.info(s),null}r.properties&&!eO(r.properties)||Wt.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=Hg(t)&&!t,r=fi.F()&&fi.A("ph_debug")==="true";return!n&&(!!r||t)}}Uh.__defaultExtensionClasses={},(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=HSr(e.prototype[t[n]])})(Uh,["identify"]);function Fze(e){return e instanceof Element&&(e.id===N1t||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function O8(e){return!!e&&e.nodeType===1}function ob(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function K1t(e){return!!e&&e.nodeType===3}function J1t(e){return!!e&&e.nodeType===11}function vve(e){return e?w8(e).split(/\s+/):[]}function zze(e){var t=Ye?.location.href;return!!(t&&e&&e.some((n=>t.match(n))))}function F3(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 vve(t)}function eOt(e){return ia(e)?null:w8(e).split(/(\s+)/).filter((t=>NA(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function BR(e){var t="";return cie(e)&&!aOt(e)&&e.childNodes&&e.childNodes.length&&Is(e.childNodes,(function(n){var r;K1t(n)&&n.textContent&&(t+=(r=eOt(n.textContent))!==null&&r!==void 0?r:"")})),w8(t)}function Bze(e){return Ht(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var yve=["a","button","form","input","select","textarea","label"];function tOt(e,t){if(Ht(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 nOt(e){var t=e.parentNode;return!(!t||!O8(t))&&t}var L1r=["next","previous","prev",">","<"],Uze=10,qze=[".ph-no-rageclick",".ph-no-capture"];function F1r(e,t){if(!Ye||bve(e))return!1;var n,r,a;if(Hg(t)?(n=!!t&&qze,r=void 0):(n=(a=t?.css_selector_ignorelist)!==null&&a!==void 0?a:qze,r=t?.content_ignorelist),n===!1)return!1;var{targetElementList:s}=rOt(e,!1);return!(function(i,o){if(i===!1||Ht(i))return!1;var c;if(i===!0)c=L1r;else{if(!Aa(i))return!1;if(i.length>Uze)return Wt.error("[PostHog] content_ignorelist array cannot exceed "+Uze+" 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:BR(i).toLowerCase(),ariaLabel:((o=i.getAttribute("aria-label"))==null?void 0:o.toLowerCase().trim())||""}})))&&!tOt(s,n)}var bve=e=>!e||ob(e,"html")||!O8(e),rOt=(e,t)=>{if(!Ye||bve(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],a=e;a.parentNode&&!ob(a,"body");)if(J1t(a.parentNode))r.push(a.parentNode.host),a=a.parentNode.host;else{var s=nOt(a);if(!s)break;if(t||yve.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 z1r(e,t,n,r,a){var s,i,o,c;if(n===void 0&&(n=void 0),!Ye||bve(e)||(s=n)!=null&&s.url_allowlist&&!zze(n.url_allowlist)||(i=n)!=null&&i.url_ignorelist&&zze(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}=rOt(e,r);if(!(function(m,g){var v=g?.element_allowlist;if(Ht(v))return!0;var x,w=function(k){if(v.some((_=>k.tagName.toLowerCase()===_)))return{v:!0}};for(var O of m)if(x=w(O))return x.v;return!1})(f,n)||!tOt(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&&(yve.indexOf(h)>-1||e.getAttribute("contenteditable")==="true")}}function cie(e){for(var t=e;t.parentNode&&!ob(t,"body");t=t.parentNode){var n=F3(t);if(Xr(n,"ph-sensitive")||Xr(n,"ph-no-capture"))return!1}if(Xr(F3(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 aOt(e){return!!(ob(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ob(e,"select")||ob(e,"textarea")||e.getAttribute("contenteditable")==="true")}var sOt="(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})",B1r=new RegExp("^(?:"+sOt+")$"),U1r=new RegExp(sOt),iOt="\\d{3}-?\\d{2}-?\\d{4}",q1r=new RegExp("^("+iOt+")$"),V1r=new RegExp("("+iOt+")");function NA(e,t){return t===void 0&&(t=!0),!(ia(e)||ao(e)&&(e=w8(e),(t?B1r:U1r).test((e||"").replace(/[- ]/g,""))||(t?q1r:V1r).test(e)))}function oOt(e){var t=BR(e);return NA(t=(t+" "+lOt(e)).trim())?t:""}function lOt(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Is(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var a=BR(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+lOt(n)).trim())}catch(s){Wt.error("[AutoCapture]",s)}})),t}function H1r(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=$t({},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 i$(c).sort(((d,f)=>{var[p]=d,[h]=f;return p.localeCompare(h)})).forEach((d=>{var[f,p]=d;return u[Vze(f.toString())]=Vze(p.toString())})),i+=":",i+=i$(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:Q1r(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return i$(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 Vze(e){return e.replace(/"|\\"/g,'\\"')}function Q1r(e){var t=e.attr__class;return t?Aa(t)?t:vve(t):void 0}class Hze{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 uee="$copy_autocapture",Qze=vi("[AutoCapture]");function dee(e,t){return t.length>e?t.slice(0,e)+"...":t}function W1r(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!O8(t));return t}function G1r(e,t,n,r){var a=e.tagName.toLowerCase(),s={tag_name:a};yve.indexOf(a)>-1&&!n&&(a.toLowerCase()==="a"||a.toLowerCase()==="button"?s.$el_text=dee(1024,oOt(e)):s.$el_text=dee(1024,BR(e)));var i=F3(e);i.length>0&&(s.classes=i.filter((function(d){return d!==""}))),Is(e.attributes,(function(d){var f;if((!aOt(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(r==null||!r.includes(d.name))&&!t&&NA(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=vve(p).join(" ")),s["attr__"+d.name]=dee(1024,p)}}));for(var o=1,c=1,u=e;u=W1r(u);)o++,u.tagName===e.tagName&&c++;return s.nth_child=o,s.nth_of_type=c,s}function Z1r(e,t){for(var n,r,{e:a,maskAllElementAttributes:s,maskAllText:i,elementAttributeIgnoreList:o,elementsChainAsString:c}=t,u=[e],d=e;d.parentNode&&!ob(d,"body");)J1t(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(Is(u,(k=>{var _=cie(k);k.tagName.toLowerCase()==="a"&&(m=k.getAttribute("href"),m=_&&m&&NA(m)&&m),Xr(F3(k),"ph-no-capture")&&(g=!0),p.push(G1r(k,s,i,o));var C=(function(T){if(!cie(T))return{};var j={};return Is(T.attributes,(function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var I=A.name.replace("data-ph-capture-attribute-",""),M=A.value;I&&M&&NA(M)&&(j[I]=M)}})),j})(k);Bi(h,C)})),g)return{props:{},explicitNoCapture:g};if(i||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?p[0].$el_text=oOt(e):p[0].$el_text=BR(e)),m){var v,x;p[0].attr__href=m;var w=(v=R3(m))==null?void 0:v.host,O=Ye==null||(x=Ye.location)==null?void 0:x.host;w&&O&&w!==O&&(f=m)}return{props:Bi({$event_type:a.type,$ce_version:1},c?{}:{$elements:p},{$elements_chain:H1r(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=vi("[ExceptionAutocapture]");function Wze(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],a=n(r);return Mg(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=a,()=>{e[t]=r}}catch{return()=>{}}}var Y1r=vi("[TracingHeaders]"),by=vi("[Web Vitals]"),Gze=9e5,Zze="disabled",Yze="lazy_loading",WC="awaiting_config",u2="missing_config";vi("[SessionRecording]");var uie="[SessionRecording]",qx=vi(uie),X1r=vi("[Heatmaps]");function Xze(e){return Co(e)&&"clientX"in e&&"clientY"in e&&Om(e.clientX)&&Om(e.clientY)}var Kze=vi("[Product Tours]"),fee="ph_product_tours",K1r=["$set_once","$set"],xy=vi("[SiteApps]");function v1(e,t,n){if(ia(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 J1r{constructor(t){this.Bi=new gve,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(!Ht((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(!Ht((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"||!v1(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=>v1(o.href,n.href,n.href_matching||"exact")));var s,i=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!i&&v1((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=>v1(u.text,n.text,n.text_matching||"exact")||v1(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;!ia(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=>v1(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||Z1t(n.properties.reduce(((r,a)=>{var s=Aa(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 eOr{constructor(t){this._instance=t,this.re=new Map,this.se=new Map,this.ne=new Map}oe(t,n){return!!t&&Z1t(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===UC.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;Ht((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 J1r(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,UC.Activation),this.se=this.ae(t,UC.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,UC.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,UC.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 tOr extends eOr{constructor(t){super(t)}fe(){return"$surveys_activated"}pe(){return Ej.SHOWN}ue(t){var n;(n=this._instance)==null||n.getSurveys(t)}ge(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}ce(){return gs}me(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var nOr=Ye!=null&&Ye.location?M3(Ye.location.hash,"__posthog")||M3(location.hash,"state"):null,Jze="_postHogToolbarParams",e8e=vi("[Toolbar]"),ky=(function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e})(ky||{}),Yc=vi("[FeatureFlags]"),GC=vi("[FeatureFlags]",{debugEnabled:!0}),rOr="errors_while_computing_flags",aOr="flag_missing",sOr="quota_limited",iOr="timeout",oOr="connection_error",lOr="unknown_error",cOr=e=>"api_error_"+e,pee="$active_feature_flags",y1="$override_feature_flags",t8e="$feature_flag_payloads",ZC="$override_feature_flag_payloads",n8e="$feature_flag_request_id",r8e=e=>{var t={};for(var[n,r]of i$(e||{}))r&&(t[n]=r);return t},uOr=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]})))):Yc.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e},dOr=(function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e})({}),hee=vi("[Error tracking]"),fOr={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&&L3(t.href,e),not_regex:(e,t)=>!!Ye&&!L3(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Al{constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((a=>{Al.ye("retrieved web experiments from the server"),n.we=new Map,a.forEach((s=>{if(s.feature_flag_key){var i;n.we&&(Al.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];Al.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())Al.ye("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ia(this.we))return this.we=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Al.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=Al.getWindowLocation();if(t!=null&&t.search){var n=P3(t?.search,"__experiment_id"),r=P3(t?.search,"__experiment_variant");n&&r&&(Al.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&&(Al.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!ia(t.conditions)&&Al.$e(t)&&Al.ke(t)}static $e(t){var n;if(ia(t.conditions)||ia((n=t.conditions)==null?void 0:n.url))return!0;var r,a,s,i=Al.getWindowLocation();return!!i&&((r=t.conditions)==null||!r.url||fOr[(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(ia(t.conditions)||ia((n=t.conditions)==null?void 0:n.utm))return!0;var r=P1t();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];Wt.info("[WebExperiments] "+t,r)}Ee(t,n,r){this._is_bot()?Al.ye("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach((a=>{if(a.selector){var s;Al.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)}))}})):Al.ye("Control variants leave the page unmodified.")}_is_bot(){return hd&&this._instance?W1t(hd,this._instance.config.custom_blocked_useragents):void 0}}var sf=vi("[Conversations]"),k8={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,Yc.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||(Yc.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||Yc.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=$t({},r,e),i=$t({},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:Ht(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(Zse),t=this._instance.get_property(y1),n=this._instance.get_property(ZC);if(!n&&!t)return e||{};var r=Bi({},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=Ht(u)?(i=c?.enabled)!==null&&i!==void 0&&i:!!u,f=Ht(u)?c.variant:typeof u=="string"?u:void 0,p=n?.[s],h=$t({},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=$t({},c?.metadata,{payload:p,original_payload:c==null||(o=c.metadata)==null?void 0:o.payload})),r[s]=h}return this.Pe||(Yc.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.Pe=!0),r}getFlagVariants(){var e=this._instance.get_property(tO),t=this._instance.get_property(y1);if(!t)return e||{};for(var n=Bi({},e),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.Pe||(Yc.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Pe=!0),n}getFlagPayloads(){var e=this._instance.get_property(t8e),t=this._instance.get_property(ZC);if(!t)return e||{};for(var n=Bi({},e||{}),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.Pe||(Yc.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:$t({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(_j)||{}),group_properties:this._instance.get_property(Kx),timezone:z1t()};ih(r)||Ht(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:Tg.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"?iOr:oOr):p.push(lOr):o.statusCode!==200&&p.push(cOr(o.statusCode)),(c=o.json)!=null&&c.errorsWhileComputingFlags&&p.push(rOr);var h=!((u=o.json)==null||(u=u.quotaLimited)==null||!u.includes(dOr.FeatureFlags));if(h&&p.push(sOr),(d=this._instance.persistence)==null||d.register({[Kse]:p}),h)Yc.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 Yc.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(n8e)||void 0,c=this._instance.get_property(T3)||void 0,u=this._instance.get_property(cT)||{};if(this._instance.config.advanced_feature_flags_dedup_per_session){var d,f=this._instance.get_session_id(),p=this._instance.get_property(Xse);f&&f!==p&&(u={},(d=this._instance.persistence)==null||d.register({[cT]:u,[Xse]:f}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(i))){var h,m,g,v,x,w,O,k,_,C;Aa(u[e])?u[e].push(i):u[e]=[i],(h=this._instance.persistence)==null||h.register({[cT]:u});var T=this.getFeatureFlagDetails(e),j=[...(m=this._instance.get_property(Kse))!==null&&m!==void 0?m:[]];Ht(a)&&j.push(aOr);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};Ht(T==null||(x=T.metadata)==null?void 0:x.version)||(A.$feature_flag_version=T.metadata.version);var I,M=(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;M&&(A.$feature_flag_reason=M),T!=null&&(_=T.metadata)!=null&&_.id&&(A.$feature_flag_id=T.metadata.id),Ht(T?.original_variant)&&Ht(T?.original_enabled)||(A.$feature_flag_original_response=Ht(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 P=s;if(!Ht(s))try{P=JSON.parse(s)}catch{}return{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:P}}}}else Yc.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:Tg.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 Ht(n)?void 0:!!n}Yc.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=uOr(s),f=d.flags,p=d.featureFlags,h=d.featureFlagPayloads;if(p){var m=s.requestId,g=s.evaluatedAt;if(Aa(p)){Yc.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(p)for(var x=0;x<p.length;x++)v[p[x]]=!0;i&&i.register({[pee]:p,[tO]: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=$t({},o,Object.fromEntries(Object.entries(w).filter((C=>{var[T]=C;return _.has(T)})))),O=$t({},c,Object.fromEntries(Object.entries(O||{}).filter((C=>{var[T]=C;return _.has(T)})))),k=$t({},u,Object.fromEntries(Object.entries(k||{}).filter((C=>{var[T]=C;return _.has(T)}))))}else w=$t({},o,w),O=$t({},c,O),k=$t({},u,k);i&&i.register($t({[pee]:Object.keys(r8e(w)),[tO]:w||{},[t8e]:O||{},[Zse]:k||{}},m?{[n8e]:m}:{},g?{[T3]:g}:{}))}}})(e,this._instance.persistence,n,r,a),t||(this.Me=!1),this.He(t)}}override(e,t){t===void 0&&(t=!1),Yc.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Yc.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(y1),this._instance.persistence.unregister(ZC),this.He(),GC.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(y1),GC.info("Flag overrides cleared");else if(n.flags){if(Aa(n.flags)){for(var r={},a=0;a<n.flags.length;a++)r[n.flags[a]]=!0;this._instance.persistence.register({[y1]:r})}else this._instance.persistence.register({[y1]:n.flags});GC.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(ZC),GC.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[ZC]:n.payloads}),GC.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(kj)||[]).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=$t({},this.getFlagVariants(),{[e]:t});(r=this._instance.persistence)==null||r.register({[pee]:Object.keys(r8e(o)),[tO]:o}),this.He()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(kj),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(kj),(o=this._instance.persistence)==null||o.register({[kj]: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(_j)||{};this._instance.register({[_j]:$t({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(_j)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(Kx)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((r=>{n[r]=$t({},n[r],e[r]),delete e[r]})),this._instance.register({[Kx]:$t({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Kx)||{};this._instance.register({[Kx]:$t({},t,{[e]:{}})})}else this._instance.unregister(Kx)}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}}},pOr={sessionRecording:class{get started(){var e;return!((e=this.qe)==null||!e.isStarted)}get status(){var e,t;return this.Ve===WC||this.Ve===u2?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=Zze,this.We=void 0,this._instance=e,!this._instance.sessionManager)throw qx.error("started without valid sessionManager"),new Error(uie+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(uie+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ge(){var e,t=!((e=this._instance.get_property(s2))==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=!Ht(Object.assign)&&!Ht(Array.from);this.Ge&&n?(this.Ye(e),qx.info("starting")):(this.Ve=Zze,this.stopRecording())}}Ye(e){var t,n,r;this.Ge&&(this.Ve!==WC&&this.Ve!==u2&&(this.Ve=Yze),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 qx.error("could not load recorder",a);this.Je(e)})))}stopRecording(){var e,t;(e=this.We)==null||e.call(this),this.We=void 0,(t=this.qe)==null||t.stop()}Xe(){var e,t;(e=this.We)==null||e.call(this),this.We=void 0,(t=this.qe)==null||t.discard()}Qe(){var e;(e=this._instance.persistence)==null||e.unregister(T1t)}Ze(e,t){if(ia(e))return null;var n,r=Om(e)?e:parseFloat(e);return typeof(n=r)=="number"&&Number.isFinite(n)&&n>=0&&n<=1?r:(qx.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null)}tr(e){if(this._instance.persistence){var t,n,r=this._instance.persistence,a=()=>{var s,i=e.sessionRecording===!1?void 0:e.sessionRecording,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;ia(u)&&this.Qe();var d=i?.minimumDurationMilliseconds;r.register({[s2]:$t({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:$t({capturePerformance:e.capturePerformance},i?.networkPayloadCapture),canvasRecording:{enabled:i?.recordCanvas,fps:i?.canvasFps,quality:i?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:Ht(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===WC&&(this.Ve=u2,qx.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.qe)!=null&&n.log?this.qe.log(e,t):qx.warn("log called before recorder was ready")}get Ke(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(s2);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}ir(){var e,t=this._instance.get_property(s2);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===u2||this.Ve===WC?void 0:(this.Ve=WC,qx.info("persisted remote config is stale, requesting fresh config before starting"),void new B1t(this._instance).load());this.Ve=Yze,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))}}},hOr={autocapture:class{constructor(e){this.er=!1,this.rr=null,this.sr=!1,this.instance=e,this.rageclicks=new Hze(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){Qze.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,uee)};eo(Ut,"copy",t,{capture:!0}),eo(Ut,"cut",t,{capture:!0})}}}else Qze.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({[mze]:!!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[mze],r=this.rr;if(ih(r)&&!Hg(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=Bze(e);K1t(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())&&F1r(r,this.instance.config.rageclick)&&this.lr(e,"$rageclick");var a=t===uee;if(r&&z1r(r,e,this.N,a,a?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:i}=Z1r(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===uee){var c,u=eOt(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 Mg(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&&(Wt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.hr&&this.hr(),this.hr=void 0,Wt.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(Ye&&Ye.history){var n=this;(e=Ye.history.pushState)!=null&&e.__posthog_wrapped__||Wze(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__||Wze(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){Wt.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[Wse]),this.rageclicks=new Hze(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 ia(this.instance.config.capture_heatmaps)?ia(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;X1r.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({[Wse]: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 Oze(this.instance,a1r,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&&O8(u)&&!ob(u,"body");){if(u===c)return!1;if(Xr(o,Ye?.getComputedStyle(u).position))return!0;u=nOt(u)}return!1})(Bze(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"),!Fze(e.target)&&Xze(e)){var r=this.Rr(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Ir($t({},r,{type:"rageclick"})),this.Ir(r)}}$r(e){!Fze(e.target)&&Xze(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?Xk([],Kk,r||[]):[],s=jA(t,a,TA);this.C=this.C||{},this.C[s]||(this.C[s]=[]),this.C[s].push(e)}}Ft(){this.C&&!eO(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Oze,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)=>$t({},n,{["$web_vitals_"+r.name+"_event"]:$t({},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(Ht(a))by.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.Mr();Ht(s)||(ia(n?.name)||ia(n?.value)?by.error("Invalid metric received",n):this.Ar&&n.value>=this.Ar?by.error("Ignoring metric with value >= "+this.Ar,n):(this.C.url!==s&&(this.Cr(),this.Or=setTimeout(this.Cr,this.flushToCaptureTimeoutMs)),Ht(this.C.url)&&(this.C.url=s),this.C.firstMetricTimestamp=Ht(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.C.metrics.push($t({},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__;Ht(i)||Ht(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):by.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.cr=!((t=this._instance.persistence)==null||!t.props[yze]),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 ia(n)?((t=this._instance.persistence)==null?void 0:t.props[xze])||["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)&&Om(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Gze;return 0<e&&e<=6e4?Gze:e}get isEnabled(){var e=ml?.protocol;if(e!=="http:"&&e!=="https:")return by.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:Hg(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Hg(t)?t:this.cr}startIfEnabled(){this.isEnabled&&!this.er&&(by.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({[yze]:t}),this._instance.persistence.register({[xze]: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?by.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?Xk([],Kk,n||[]):[];return jA(e,r,TA)}by.error("Could not determine current URL")}}},mOr={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[gze]),this.Hr=new fSr({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=$t({},t,e):(Ht(e)?this.zr:e)&&(t=$t({},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({[gze]: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 _Sr([new PSr,new qSr,new DSr,new MSr,new BSr,new zSr,new LSr,new USr],RSr()),this._instance=e,this.qr=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Gse))!==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({[Gse]:this.qr,[vze]:s})}}get Wr(){var e,t=!!this._instance.get_property(vze),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 hee.info("Skipping exception capture because a suppression rule matched");if(!this.Wr&&this.Jr(t))return void hee.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Kr(t))return void hee.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=G1t[a.operator],o=Aa(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!ia(e)&&Aa(e)}}},gOr=$t({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({[bze]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Xr||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(bze)||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?Kze.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),!Aa(this.Qr)||t){var n=this._instance.persistence;if(n){var r=n.props[fee];if(Aa(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 Kze.error(i),void e([],{isLoaded:!1,error:i})}var o=Aa(a.json.product_tours)?a.json.product_tours:[];this.Qr=o,n&&n.register({[fee]:o}),e(o,{isLoaded:!0})}})}else e(this.Qr,{isLoaded:!0})}getActiveProductTours(e){ia(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(fee)}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)}}},k8),vOr={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:$t({},n1t(e,K1r),{properties:$t({},e.properties,m?{$set:$t({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},m)}:{},h?{$set_once:$t({},(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&&(xy.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,xy.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){xy.error("Error while initializing PostHog app with config id "+e.id,i),a(!1)}if(r&&t.loaded)try{n()}catch(i){xy.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){xy.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 xy.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 xy.error("Error while initializing PostHog app with config id "+c,d)}))};for(var{id:i,url:o}of e.siteApps)s(i)}else xy.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},yOr={tracingHeaders:class{constructor(e){this.os=void 0,this.ls=void 0,this.Dr=()=>{var t,n;Ht(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)),Ht(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 Y1r.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)}}},bOr=$t({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(ia(t))return gs.warn("Flags not loaded yet. Not loading surveys.");var n=Aa(t);this.us=n?t.length>0:t,gs.info("flags response received, isSurveysEnabled: "+this.us),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(Y1t)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((r=>localStorage.removeItem(r)))}loadIfEnabled(){if(!this._surveyManager)if(this.hs)gs.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)gs.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())gs.info("Not loading surveys in cookieless mode without consent.");else{var e=Ln?.__PosthogExtensions__;if(e){if(!Ht(this.us)||this._instance.config.advanced_enable_surveys){var t=this.us||this._instance.config.advanced_enable_surveys;this.hs=!0;try{var n=e.generateSurveys;if(n)return void this.cs(n,t);var r=e.loadExternalDependency;if(!r)return void this.fs("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(a=>{a||!e.generateSurveys?this.fs("Could not load surveys script",a):this.cs(e.generateSurveys,t)}))}catch(a){throw this.fs("Error initializing surveys",a),a}finally{this.hs=!1}}}else gs.error("PostHog Extensions not found.")}}cs(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new tOr(this._instance),gs.info("Surveys loaded successfully"),this.ps({isLoaded:!0})}fs(e,t){gs.error(e,t),this.ps({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ds.push(e),this._surveyManager&&this.ps({isLoaded:!0}),()=>{this.ds=this.ds.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return gs.info("Disabled. Not loading surveys."),e([]);var n,r=this._instance.get_property(Yse);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;gs.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({[Yse]: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){gs.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ia(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);gs.warn("init was not called")}_s(e){var t=null;return this.getSurveys((n=>{var r;t=(r=n.find((a=>a.id===e)))!==null&&r!==void 0?r:null})),t}gs(e){if(ia(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(ia(this._surveyManager))return gs.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.gs(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ia(this._surveyManager)?(gs.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((n=>{this.getSurveys((r=>{var a,s=(a=r.find((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(ia(this._surveyManager))gs.warn("init was not called");else{var a=typeof e=="string"?this._s(e):e;if(a!=null&&a.id)if(I1r.includes(a.type)){var s=Ut?.querySelector(t);if(s)return(r=a.appearance)!=null&&r.surveyPopupDelaySeconds?(gs.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var i,o;gs.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),gs.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,s,n);gs.warn("Survey element not found")}else gs.warn("Surveys of type "+a.type+" cannot be rendered in the app");else gs.warn("Survey not found")}}displaySurvey(e,t){var n;if(ia(this._surveyManager))gs.warn("init was not called");else{var r=this._s(e);if(r){var a=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=$t({},r,{appearance:$t({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==rie.Popover&&t.initialResponses&&gs.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var s=this.canRenderSurvey(r);if(!s.visible)return void gs.warn("Survey is not eligible to be displayed: ",s.disabledReason)}t.displayType!==rie.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}else gs.warn("Survey not found")}}cancelPendingSurvey(e){ia(this._surveyManager)?gs.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},k8),xOr={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:ky.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),E1t(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=nOr||M3(e.hash,"__posthog")||M3(e.hash,"state"),s=a?hze((()=>JSON.parse(atob(decodeURIComponent(a)))))||hze((()=>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(Jze)||"{}")).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;!ia(t)&&Mg(t)?t(e,this.instance):e8e.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ut==null||!Ut.getElementById(N1t));if(!Ye||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=$t({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Ye.localStorage.setItem(Jze,JSON.stringify($t({},r,{source:void 0}))),this.ys()===ky.LOADED)this.ws(r);else if(this.ys()===ky.UNINITIALIZED){var a;this.bs(ky.LOADING),(a=Ln.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(s=>{if(s)return e8e.error("[Toolbar] Failed to load",s),void this.bs(ky.UNINITIALIZED);this.bs(ky.LOADED),this.ws(r)})),eo(Ye,"turbolinks:load",(()=>{this.bs(ky.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)}}},wOr=$t({experiments:Al},k8),SOr={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;ia(t)||(Hg(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||E1t(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Ln?.__PosthogExtensions__;if(e&&!Ht(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 sf.error("Conversations enabled but missing token in remote config.")}}ks(e){if(this.$s)try{this._conversationsManager=e(this.$s,this._instance),sf.info("Conversations loaded successfully")}catch(t){this.Ps("Error completing conversations initialization",t)}else sf.error("Cannot complete initialization: remote config is null")}Ps(e,t){sf.error(e,t),this._conversationsManager=null,this.xs=!1}show(){this._conversationsManager?this._conversationsManager.show():sf.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ss===!0&&!ih(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 wg((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(sf.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return wg((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(sf.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return wg((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(sf.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return wg((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(sf.warn("Conversations not available yet."),null)}))()}requestRestoreLink(e){var t=this;return wg((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(sf.warn("Conversations not available yet."),null)}))()}restoreFromToken(e){var t=this;return wg((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(sf.warn("Conversations not available yet."),null)}))()}restoreFromUrlToken(){var e=this;return wg((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(sf.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}}},OOr={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;!ia(n)&&n&&(this.Ts=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Ts&&!this.Rs){var e=vi("[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.")}}}},kOr=$t({},k8,pOr,hOr,mOr,gOr,vOr,bOr,yOr,xOr,wOr,SOr,OOr);Uh.__defaultExtensionClasses=$t({},kOr);var a8e,Ng=(a8e=dT[R1]=new Uh,(function(){function e(){e.done||(e.done=!0,X1t=!1,Is(dT,(function(t){t._dom_loaded()})))}Ut!=null&&Ut.addEventListener?Ut.readyState==="complete"?e():eo(Ut,"DOMContentLoaded",e,{capture:!1}):Ye&&Wt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),a8e),cOt=b.createContext({client:Ng,bootstrap:void 0});function uOt(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)||!uOt(e[o],t[o],n))return!1}return!0}function _Or(e){var t,n,r=e.children,a=e.client,s=e.apiKey,i=e.options,o=b.useRef(null),c=b.useMemo(function(){return a?(s&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),i&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),a):(s||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),Ng)},[a,s,JSON.stringify(i)]);return b.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&&!uOt(i,u.options)&&Ng.set_config(i),o.current={apiKey:s,options:i??{}}):(Ng.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),Ng.init(s,i),o.current={apiKey:s,options:i??{}})}},[a,s,JSON.stringify(i)]),je.createElement(cOt.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 mee=function(e){return typeof e=="function"},die=function(e,t){return die=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])},die(e,t)};function EOr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");die(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var COr={componentStack:null,exceptionEvent:null,error:null},jOr={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){EOr(t,e);function t(n){var r=e.call(this,n)||this;return r.state=COr,r}return t.prototype.componentDidCatch=function(n,r){var a=this.props.additionalProperties,s;mee(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 mee(r)?r():r;var i=mee(a)?je.createElement(a,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):a;return je.isValidElement(i)?i:(console.warn(jOr.INVALID_FALLBACK),je.createElement(je.Fragment,null))},t.contextType=cOt,t})(je.Component);function TOr({children:e}){return b.useEffect(()=>{if("brave"in navigator){console.info("[Analytics]: Telemetry is disabled for browser constraints.");return}if(window.MASTRA_TELEMETRY_DISABLED){console.info("[Analytics]: Telemetry is disabled.");return}Ng.init("phc_SBLpZVAB6jmHOct9CABq3PF0Yn5FU3G2FgT4xUr2XrT",{api_host:"https://us.posthog.com"}),Ng.register({mastraSource:"playground"})},[]),l.jsx(_Or,{client:Ng,children:e})}const NOr=["/swagger-ui","/openapi.json"],dOt=b.forwardRef(({children:e,href:t,...n},r)=>t&&NOr.some(s=>t.startsWith(s))?l.jsx("a",{ref:r,href:t,...n,children:e}):l.jsx(Zt,{ref:r,to:t,viewTransition:!0,...n,children:e}));function AOr(){const{data:e={},isLoading:t,error:n}=ah(),[r,a]=b.useState(""),{canCreateAgent:s}=kxt(),{Link:i,paths:o}=en(),c=o.cmsAgentCreateLink(),u=s&&!!c;return l.jsxs(Ua,{children:[l.jsxs(Ua.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:t,children:[l.jsx(Xs,{})," Agents"]})}),l.jsxs(dt.Column,{className:"flex justify-end gap-2",children:[u&&l.jsx(Qs,{as:i,to:c,tooltipContent:"Create an agent",children:l.jsx(tWe,{})}),l.jsx(Qs,{as:"a",href:"https://mastra.ai/en/docs/agents/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Agents documentation",children:l.jsx(Hl,{})})]})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(tx,{onSearch:a,label:"Filter agents",placeholder:"Filter by name or instructions"})})]}),l.jsx(ahr,{agents:e,isLoading:t,error:n,search:r})]})}function IOr({agentId:e,threadId:t,threads:n,isLoading:r}){const{mutateAsync:a}=ror(),{paths:s,navigate:i}=en(),o=async c=>{await a({threadId:c,agentId:e}),c===t&&i(s.agentNewThreadLink(e))};return l.jsx(lcr,{resourceId:e,resourceType:"agent",threads:n||[],isLoading:r,threadId:t,onDelete:o})}function s8e(){const{agentId:e,threadId:t}=hs(),[n]=Ii(),{data:r,isLoading:a,error:s}=Ld(e),{data:i}=K_(e),o=Fc(),c=t==="new",u=b.useMemo(()=>Vi(),[t]),d=!!i?.result,{data:f,isLoading:p,refetch:h}=Sxt({agentId:e,isMemoryEnabled:d,resourceId:e});b.useEffect(()=>{t||o(`/agents/${e}/chat/new`)},[t,e,o]);const m=n.get("messageId")??void 0,g=b.useMemo(()=>{if(!r)return{modelSettings:{}};const w=r.defaultOptions,{maxOutputTokens:O,...k}=w?.modelSettings??{};return{modelSettings:{...k,...O!==void 0&&{maxTokens:O},...w?.maxSteps!==void 0&&{maxSteps:w.maxSteps},...w?.providerOptions!==void 0&&{providerOptions:w.providerOptions}}}},[r]);if(s&&ts(s))return l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{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,x=async()=>{await h(),c&&o(`/agents/${e}/chat/${u}`)};return l.jsx(oge,{entityId:e,entityType:"agent",children:l.jsx(Gme,{agentId:e,defaultSettings:g,children:l.jsx(kR,{children:l.jsx(dxt,{agentId:e,threadId:v,resourceId:e,children:l.jsx(Xbt,{children:l.jsx(hxt,{agentId:e,threadId:v,children:l.jsx(ixt,{children:l.jsx(gxt,{children:l.jsx(Zbt,{children:l.jsx(Ycr,{agentId:e,leftSlot:d&&l.jsx(IOr,{agentId:e,threadId:v,threads:f||[],isLoading:p}),browserOverlay:l.jsx(Jcr,{}),rightSlot:l.jsx(Wcr,{agentId:e,threadId:v}),children:l.jsx(xge,{agentId:e,agentName:r?.name,modelVersion:r?.modelVersion,threadId:v,memory:d,refreshThreadList:x,modelList:r?.modelList,messageId:m,isNewThread:c},v)})},`${e}-${v}`)})})},`session-${e}-${v}`)},`browser-${e}-${v}`)})})})})}const d2="__custom__",ROr=()=>{const e=Hbt(),{requestContext:t,setRequestContext:n}=Ur(),r=b.useMemo(()=>{if(!e)return d2;const s=JSON.stringify(t??{});for(const[i,o]of Object.entries(e))if(JSON.stringify(o)===s)return i;return d2},[e,t]),a=s=>{if(s===d2){n({});return}if(!e)return;const i=e[s];i&&n(i)};return l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(sb,{className:"h-5 w-8 shrink-0"}),"Mastra Studio",l.jsx(Pse,{})]}),e&&Object.keys(e).length>0&&l.jsx(qi,{children:l.jsxs(Ws,{value:r,onValueChange:a,children:[l.jsx(Ps,{size:"sm",className:"w-[200px]",children:l.jsx(Gs,{placeholder:"Select a preset..."})}),l.jsxs(Ms,{children:[l.jsx(ea,{value:d2,children:"Custom"}),Object.keys(e).map(s=>l.jsx(ea,{value:s,children:s},s))]})]})})]})};function i8e(){const{agentId:e,threadId:t}=hs(),[n]=Ii(),{data:r,isLoading:a}=Ld(e),{data:s}=K_(e),i=Fc(),o=t==="new",c=b.useMemo(()=>Vi(),[t]),u=!!s?.result,{refetch:d}=Sxt({resourceId:e,agentId:e,isMemoryEnabled:u});b.useEffect(()=>{u&&(t||i(`/agents/${e}/session/new`))},[u,t,e,i]);const f=n.get("messageId")??void 0,p=b.useMemo(()=>{if(!r)return{modelSettings:{}};const g=r.defaultOptions,{maxOutputTokens:v,...x}=g?.modelSettings??{};return{modelSettings:{...x,...v!==void 0&&{maxTokens:v},...g?.maxSteps!==void 0&&{maxSteps:g.maxSteps},...g?.providerOptions!==void 0&&{providerOptions:g.providerOptions}}}},[r]);if(a)return null;if(!r)return 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(oge,{entityId:e,entityType:"agent",children:l.jsx(Gme,{agentId:e,defaultSettings:p,children:l.jsx(kR,{children:l.jsx(dxt,{agentId:e,threadId:h,resourceId:e,children:l.jsx(Xbt,{children:l.jsx(hxt,{agentId:e,threadId:h,children:l.jsx(ixt,{children:l.jsx(gxt,{children:l.jsx(Zbt,{children:l.jsxs(zn,{children:[l.jsx(ROr,{}),l.jsx("div",{className:"grid overflow-y-auto relative bg-surface1 h-full pt-6",children:l.jsx(xge,{agentId:e,agentName:r?.name,modelVersion:r?.modelVersion,threadId:h,memory:u,refreshThreadList:m,modelList:r?.modelList,messageId:f,isNewThread:o,hideModelSwitcher:!0},h)})]})})})})},`session-${e}-${h}`)},`browser-${e}-${h}`)})})})})}function POr(){const{agentId:e}=hs(),{navigate:t}=en(),{data:n,isLoading:r,error:a}=Ld(e),{data:s,isLoading:i}=Ege(e,{status:"draft"}),o=n?.source==="code",c=r||i,u=b.useMemo(()=>s||(n?Rge(n):{}),[s,n]),{form:d,handlePublish:f,handleSaveDraft:p,isSubmitting:h,isSavingDraft:m}=p8({mode:"edit",agentId:e??"",dataSource:u,isCodeAgentOverride:o,hasStoredOverride:o&&!!s,onSuccess:()=>{}}),[g,v]=b.useState(()=>{const x=sessionStorage.getItem(`pending-scorer-items-${e}`);if(x){sessionStorage.removeItem(`pending-scorer-items-${e}`);try{return JSON.parse(x)}catch{return null}}return null});return a&&ts(a)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{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(yge,{form:d,mode:"edit",agentId:e,isSubmitting:h,isSavingDraft:m,handlePublish:f,handleSaveDraft:p,isCodeAgentOverride:o,readOnly:!1,children:l.jsx(Ppr,{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 MOr(){const{agentId:e}=hs(),[t,n]=b.useState(null),{data:r,isLoading:a,error:s}=Ld(e),{data:i,isLoading:o}=Ege(e,{status:"draft"}),{data:c}=K_(e),u=r?.source==="code",d=a||o,f=!!c?.result,{data:p}=i0t({agentId:e??"",versionId:t??""}),{data:h}=pS({agentId:e??"",params:{sortDirection:"DESC"}}),m=i?.activeVersionId,g=h?.versions?.[0],v=!!(g&&g.id!==m),x=!!t&&!!p,w=x&&t!==g?.id,O=b.useMemo(()=>x&&p?p:i||(r?Rge(r):{}),[x,p,i,r]),{form:k,handlePublish:_,handleSaveDraft:C,isSubmitting:T,isSavingDraft:j,isDirty:A}=p8({mode:"edit",agentId:e??"",dataSource:O,isCodeAgentOverride:u,hasStoredOverride:u&&!!i,onSuccess:()=>{}}),I=b.useCallback(M=>{M===g?.id?n(null):n(M)},[g?.id]);return s&&ts(s)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{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(yge,{form:k,mode:"edit",agentId:e,isSubmitting:T,isSavingDraft:j,handlePublish:_,handleSaveDraft:C,isCodeAgentOverride:u,readOnly:w,children:l.jsx(Pfr,{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 DOr(){const{agentId:e}=hs(),{navigate:t}=en(),{data:n,isLoading:r,error:a}=Ld(e);if(a&&ts(a))return l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{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(zpr,{agentId:e,onCreateScorer:s})}function $Or(){const{agentId:e}=hs(),[t]=Ii();return l.jsx(nhr,{agentId:e,basePath:`/agents/${e}/traces`,initialTraceId:t.get("traceId")||void 0,initialSpanId:t.get("spanId")||void 0,initialSpanTab:t.get("tab")||void 0,initialScoreId:t.get("scoreId")||void 0})}function LOr(){return l.jsx(Sdr,{})}function FOr(){const{navigate:e,paths:t}=en(),n=Lc(),{form:r,handlePublish:a,isSubmitting:s,canPublish:i}=p8({mode:"create",onSuccess:o=>e(t.agentLink(o))});return l.jsxs(zn,{children:[l.jsxs(ar,{className:"bg-surface1",children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(Xs,{})}),"Create an agent"]}),l.jsx(qi,{children:l.jsx(xe,{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(ZQe,{})}),"Create agent"]})})})]}),l.jsx(gwt,{form:r,mode:"create",isSubmitting:s,handlePublish:a,basePath:"/cms/agents/create",currentPath:n.pathname,children:l.jsx(Wk,{})})]})}function o8e({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]=Ii(),g=Lc(),w=!!t&&!!n&&t!==f?l.jsxs(gc,{variant:"info",className:"mb-4",children:[l.jsx(vc,{children:"This is a previous version"}),l.jsx(gf,{as:"p",children:"You are seeing a specific version of the agent."}),l.jsx("div",{className:"pt-2",children:l.jsx(xe,{type:"button",variant:"light",size:"sm",onClick:()=>m({}),children:"View latest version"})})]}):void 0,O=p?void 0:l.jsx(xfr,{agentId:e,selectedVersionId:t??void 0,onVersionSelect:u,activeVersionId:d});return l.jsx(gwt,{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(Wk,{})})}function zOr(){const{agentId:e}=hs(),{navigate:t,paths:n}=en(),r=Fc(),a=Lc(),[s,i]=Ii(),o=s.get("versionId"),{data:c,isLoading:u}=Ld(e),{data:d,isLoading:f}=Ege(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}/`;b.useEffect(()=>{p&&v&&r(`${g}/instruction-blocks${a.search}${a.hash}`,{replace:!0})},[p,v,r,g,a.search,a.hash]);const{data:x}=i0t({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&&!!x,T=b.useMemo(()=>C&&x?x:h||(c?Rge(c):{}),[C,x,h,c]),j=h?.name??c?.name,{form:A,handlePublish:I,handleSaveDraft:M,isSubmitting:P,isSavingDraft:F,isDirty:D}=p8({mode:"edit",agentId:e??"",dataSource:T,isCodeAgentOverride:p,hasStoredOverride:p&&!!d,onSuccess:V=>t(n.agentLink(V))}),U=b.useCallback(V=>{i(V?{versionId:V}:{})},[i]),q=!m&&!h&&!c,z=!m&&!!e&&(!!h||!!c);return l.jsxs(zn,{children:[l.jsxs(ar,{className:"bg-surface1",children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(Xs,{})}),m&&l.jsx(Cr,{className:"h-6 w-[200px]"}),q&&"Agent not found",z&&`Edit agent: ${j}`,z&&_&&l.jsx(vt,{variant:"info",children:"Unpublished changes"})]}),z&&l.jsxs(qi,{children:[l.jsx(xe,{onClick:M,disabled:!D||F||P,children:F?l.jsxs(l.Fragment,{children:[l.jsx(Ft,{className:"h-4 w-4"}),"Saving..."]}):l.jsxs(l.Fragment,{children:[l.jsx(d3t,{}),"Save"]})}),l.jsx(xe,{variant:"primary",onClick:I,disabled:!_&&!D||P||F,children:P?l.jsxs(l.Fragment,{children:[l.jsx(Ft,{className:"h-4 w-4"}),"Publishing..."]}):l.jsxs(l.Fragment,{children:[l.jsx(ZQe,{}),"Publish"]})})]})]}),q?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(o8e,{agentId:e??"",selectedVersionId:o,versionData:x,readOnly:!0,form:A,handlePublish:I,handleSaveDraft:M,isSubmitting:P,isSavingDraft:F,onVersionSelect:U,activeVersionId:O,latestVersionId:k?.id})})]}):l.jsx(o8e,{agentId:e??"",selectedVersionId:o,versionData:x,form:A,handlePublish:I,handleSaveDraft:M,isSubmitting:P,isSavingDraft:F,onVersionSelect:U,activeVersionId:O,latestVersionId:k?.id,hideVersionPanel:p&&!d,isCodeAgentOverride:p})]})}function BOr(){return l.jsx(sdr,{})}function UOr(){return l.jsx(z0t,{})}function qOr(){return l.jsx(Edr,{})}function VOr(){return l.jsx(Odr,{})}function HOr(){return l.jsx(ufr,{})}function QOr(){return l.jsx(q0t,{})}function WOr(){return l.jsx(Pdr,{})}function GOr(){return l.jsx(_dr,{})}function ZOr(){const{navigate:e,paths:t}=en();return l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(Hl,{})}),"Create a prompt block"]})}),l.jsx(jur,{onSuccess:n=>e(t.cmsPromptBlockEditLink(n.id))})]})}function l8e(e){return{name:e.name,description:e.description||void 0,content:e.content,rules:e.rules||void 0,requestContextSchema:e.variables||void 0}}function YOr({block:e,blockId:t,selectedVersionId:n,hasDraft:r}){const a=Ue(),s=ns(),{navigate:i,paths:o}=en(),{updateStoredPromptBlock:c}=o8(t),[u,d]=b.useState(!1),[f,p]=b.useState(!1),{data:h}=Tur({blockId:t,versionId:n??""}),m=!!n&&!!h,g=m?h:e,v=b.useMemo(()=>({name:g.name||"",description:g.description||"",content:g.content||"",rules:g.rules,variables:g.requestContextSchema}),[g]),{form:x}=k0t({initialValues:v}),[w,O]=b.useState(0);b.useEffect(()=>{v&&!x.formState.isDirty&&(x.reset(v),O(C=>C+1))},[v,x]);const k=b.useCallback(async()=>{if(!await x.trigger()){Re.error("Please fill in all required fields");return}p(!0);try{const T=l8e(x.getValues());await c.mutateAsync(T),x.reset(x.getValues()),Re.success("Draft saved")}catch(T){Re.error(`Failed to save draft: ${T instanceof Error?T.message:"Unknown error"}`)}finally{p(!1)}},[x,c]),_=b.useCallback(async()=>{if(!await x.trigger()){Re.error("Please fill in all required fields");return}d(!0);try{const T=l8e(x.getValues());await c.mutateAsync(T);const A=(await a.getStoredPromptBlock(t).listVersions({sortDirection:"DESC",perPage:1})).versions[0];if(!A)throw new Error("No version found to publish");await a.getStoredPromptBlock(t).activateVersion(A.id),s.invalidateQueries({queryKey:["stored-prompt-blocks"]}),s.invalidateQueries({queryKey:["stored-prompt-block"]}),s.invalidateQueries({queryKey:["prompt-block-versions",t]}),Re.success("Prompt block published"),i(o.promptBlocksLink())}catch(T){Re.error(`Failed to publish: ${T instanceof Error?T.message:"Unknown error"}`)}finally{d(!1)}},[x,c,a,t,i,o,s]);return l.jsxs(Ib,{leftSlot:l.jsx(O0t,{form:x,onPublish:_,onSaveDraft:k,isSubmitting:u,isSavingDraft:f,isDirty:x.formState.isDirty,hasDraft:r,formResetKey:w,mode:"edit",blockId:t}),children:[m&&l.jsxs(gc,{variant:"info",className:"m-4 mb-0",children:[l.jsx(vc,{children:"This is a previous version"}),l.jsx(gf,{as:"p",children:"You are seeing a specific version of the prompt block."})]}),l.jsx("form",{className:"h-full",children:l.jsx(f0t,{form:x})})]})}function XOr(){const{promptBlockId:e}=hs(),[t,n]=Ii(),r=t.get("versionId"),{data:a,isLoading:s}=d0t(e,{status:"draft"}),{data:i}=_0t({blockId:e??"",params:{sortDirection:"DESC"}}),o=a?.activeVersionId,c=i?.versions?.[0],u=!!(c&&(!o||c.id!==o)),d=b.useCallback(f=>{n(f?{versionId:f}:{})},[n]);return s?l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(Hl,{})}),l.jsx(Cr,{className:"h-6 w-[200px]"})]})}),l.jsx(Ib,{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(ar,{children:l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(Hl,{})}),"Prompt block not found"]})}),l.jsx(Ib,{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(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(Hl,{})}),"Edit prompt block: ",a.name,u&&l.jsx(vt,{variant:"info",children:"Unpublished changes"})]}),l.jsx(qi,{children:l.jsx(Aur,{blockId:e,value:r??"",onValueChange:d,activeVersionId:o})})]}),l.jsx(YOr,{block:a,blockId:e,selectedVersionId:r,hasDraft:u})]})}function KOr(){const{navigate:e,paths:t}=en();return l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(b0,{})}),"Create a scorer"]})}),l.jsx(Vlr,{onSuccess:n=>e(t.scorerLink(n.id))})]})}function c8e(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 JOr({scorer:e,scorerId:t,selectedVersionId:n}){const r=Ue(),a=ns(),{navigate:s,paths:i}=en(),{updateStoredScorer:o}=kge(t),[c,u]=b.useState(!1),[d,f]=b.useState(!1),p=b.useRef(null),{data:h}=Qlr({scorerId:t,versionId:n??""}),m=!!n&&!!h,g=m?h:e,v=b.useMemo(()=>({name:g.name||"",description:g.description||"",type:"llm-judge",model:{provider:g.model?.provider||"",name:g.model?.name||""},instructions:g.instructions||"",scoreRange:{min:g.scoreRange?.min??0,max:g.scoreRange?.max??1},defaultSampling:g.defaultSampling}),[g]),{form:x}=Qxt({initialValues:v});b.useEffect(()=>{v&&x.reset(v)},[v,x]);const w=b.useCallback(async()=>{if(!await x.trigger()){Re.error("Please fill in all required fields");return}f(!0);try{const _=c8e(x.getValues());await o.mutateAsync(_),Re.success("Draft saved")}catch(_){Re.error(`Failed to save draft: ${_ instanceof Error?_.message:"Unknown error"}`)}finally{f(!1)}},[x,o]),O=b.useCallback(async()=>{if(!await x.trigger()){Re.error("Please fill in all required fields");return}u(!0);try{const _=c8e(x.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"]}),Re.success("Scorer published"),s(i.scorerLink(t))}catch(_){Re.error(`Failed to publish scorer: ${_ instanceof Error?_.message:"Unknown error"}`)}finally{u(!1)}},[x,o,r,t,s,i,a]);return l.jsxs(Ib,{leftSlot:l.jsx(Vxt,{form:x,onPublish:O,onSaveDraft:w,isSubmitting:c,isSavingDraft:d,formRef:p,mode:"edit"}),children:[m&&l.jsxs(gc,{variant:"info",className:"m-4 mb-0",children:[l.jsx(vc,{children:"This is a previous version"}),l.jsx(gf,{as:"p",children:"You are seeing a specific version of the scorer."})]}),l.jsx("form",{ref:p,className:"h-full",children:l.jsx(Hxt,{form:x})})]})}function ekr(){const{scorerId:e}=hs(),[t,n]=Ii(),r=t.get("versionId"),{data:a,isLoading:s}=qlr(e,{status:"draft"}),{data:i}=Wxt({scorerId:e??"",params:{sortDirection:"DESC"}}),o=a?.activeVersionId,c=i?.versions?.[0],u=!!(c&&o&&c.id!==o),d=b.useCallback(f=>{n(f?{versionId:f}:{})},[n]);return s?l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(b0,{})}),l.jsx(Cr,{className:"h-6 w-[200px]"})]})}),l.jsx(Ib,{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(ar,{children:l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(b0,{})}),"Scorer not found"]})}),l.jsx(Ib,{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(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(b0,{})}),"Edit scorer: ",a.name,u&&l.jsx(vt,{variant:"info",children:"Unpublished changes"})]}),l.jsx(qi,{children:l.jsx(Glr,{scorerId:e,value:r??"",onValueChange:d,variant:"outline",activeVersionId:o})})]}),l.jsx(JOr,{scorer:a,scorerId:e,selectedVersionId:r})]})}const tkr=new Set(["items","experiments","review"]);function nkr(){const{datasetId:e}=hs(),t=Fc(),[n,r]=Ii(),a=n.get("tab"),s=a&&tkr.has(a)?a:"items",i=C=>{r(C==="items"?{}:{tab:C},{replace:!0})},[o,c]=b.useState(!1),[u,d]=b.useState(!1),[f,p]=b.useState(!1),[h,m]=b.useState(!1),[g,v]=b.useState(null),{data:x,error:w}=Fm(e??"");if(!e)return l.jsx(zn,{children:l.jsx(Rc,{children:l.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});if(w&&ts(w))return l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{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(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(tgr,{value:e,variant:"ghost"})})]})}),l.jsxs(Rc,{className:"content-stretch",children:[l.jsx(dvr,{datasetId:e,onAddItemClick:()=>d(!0),onEditClick:()=>p(!0),onDeleteClick:()=>m(!0),activeDatasetVersion:g,onVersionSelect:_,initialTab:s,onTabChange:i,experimentTriggerSlot:l.jsxs(xe,{variant:"primary",onClick:()=>c(!0),children:[l.jsx(l3t,{}),g!=null?`Run on v${g}`:"Run Experiment"]})}),l.jsx(vvr,{datasetId:e,version:g??void 0,open:o,onOpenChange:c,onSuccess:O}),l.jsx(pvr,{datasetId:e,open:u,onOpenChange:d}),x&&l.jsx(Jmr,{open:f,onOpenChange:p,dataset:{id:x.id,name:x.name,description:x?.description||"",inputSchema:x.inputSchema,groundTruthSchema:x.groundTruthSchema}}),x&&l.jsx(egr,{open:h,onOpenChange:m,datasetId:x.id,datasetName:x.name,onSuccess:k})]})]})}function rkr(){const{datasetId:e,experimentId:t}=hs(),{data:n}=Fm(e??""),{data:r,isLoading:a,error:s}=_se(e,t),{data:i,isLoading:o,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d}=Pge({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&&ts(s)?l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{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(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsx(_n,{as:Zt,to:`/evaluation/datasets/${e}`,children:n?.name}),l.jsx(_n,{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(Lvr,{experimentId:t,experiment:r}),l.jsx(Mvr,{experimentId:t,experimentStatus:r?.status,results:i??[],isLoading:o,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d})]})})]})}function akr(){const{datasetId:e}=hs(),[t,n]=Ii(),{data:r,error:a}=Fm(e??""),s=t.get("baseline")??"",i=t.get("contender")??"";return a&&ts(a)?l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"datasets"})})}):!e||!s||!i?l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsxs(_n,{isCurrent:!0,as:"span",children:[l.jsx(_e,{children:l.jsx(Ij,{})}),"Compare Experiments"]})]})}),l.jsx(Rc,{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(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsx(_n,{as:Zt,to:`/evaluation/datasets/${e}`,children:r?.name??e?.slice(0,8)}),l.jsxs(_n,{isCurrent:!0,as:"span",children:[l.jsx(_e,{children:l.jsx(Ij,{})}),"Experiments Comparison"]})]})}),l.jsx(Rc,{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(Ij,{})," Dataset Experiments Comparison"]}),l.jsxs(dt.Description,{children:["Comparing"," ",l.jsx(Zt,{to:`/datasets/${e}/experiments/${s}`,children:s.slice(0,8)})," vs"," ",l.jsx(Zt,{to:`/datasets/${e}/experiments/${i}`,children:i.slice(0,8)})]})]}),l.jsx(dt.Column,{children:l.jsxs(xe,{as:Zt,to:`/evaluation/datasets/${e}`,children:[l.jsx(KO,{}),"Back to Dataset"]})})]}),l.jsx(Uvr,{datasetId:e,experimentIdA:s,experimentIdB:i,onSwap:()=>{n({baseline:i,contender:s})}})]})})]})}function skr(){const{datasetId:e,itemId:t}=hs(),{Link:n}=en(),r=Fc(),{data:a,isLoading:s,error:i}=Bge(e??"",t??""),{updateItem:o,deleteItem:c}=$s(),{data:u}=Fm(e??""),d=a?.[0]??null,f=d?.isDeleted??!1,[p,h]=b.useState(null),m=b.useMemo(()=>!d||f?{input:"",groundTruth:"",metadata:""}:{input:JSON.stringify(d.input,null,2),groundTruth:d.groundTruth?JSON.stringify(d.groundTruth,null,2):"",metadata:d.metadata?JSON.stringify(d.metadata,null,2):""},[d,f]),g=d?.datasetVersion??0,[v,x]=b.useState(!1),[w,O]=b.useState(m.input),[k,_]=b.useState(m.groundTruth),[C,T]=b.useState(m.metadata),[j,A]=b.useState(g);g!==j&&(A(g),O(m.input),_(m.groundTruth),T(m.metadata));const[I,M]=b.useState(!1),P=B=>{h(f?B:B.isLatest?null:B)},F=()=>{h(null)},D=!f&&p!=null,U=()=>{D||x(!0)},q=()=>{D||M(!0)},z=async()=>{if(!e||!t)return;let B;try{B=JSON.parse(w)}catch{Re.error("Input must be valid JSON");return}let R;if(k.trim())try{R=JSON.parse(k)}catch{Re.error("Ground Truth must be valid JSON");return}let Q;if(C.trim())try{Q=JSON.parse(C)}catch{Re.error("Metadata must be valid JSON");return}try{await o.mutateAsync({datasetId:e,itemId:t,input:B,groundTruth:R,metadata:Q}),Re.success("Item updated successfully"),x(!1)}catch(G){Re.error(`Failed to update item: ${G instanceof Error?G.message:"Unknown error"}`)}},V=()=>{d&&(O(JSON.stringify(d.input,null,2)),_(d.groundTruth?JSON.stringify(d.groundTruth,null,2):""),T(d.metadata?JSON.stringify(d.metadata,null,2):"")),x(!1)},W=async()=>{if(!(!e||!t))try{await c.mutateAsync({datasetId:e,itemId:t}),Re.success("Item deleted successfully"),M(!1),r(`/evaluation/datasets/${e}`)}catch(B){Re.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&&ts(i)?l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"datasets"})})}):s?null:!e||!t||!a||a.length===0?l.jsx(zn,{children:l.jsx(Rc,{children:l.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):l.jsxs(l.Fragment,{children:[l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsx(_n,{as:Zt,to:`/evaluation/datasets/${e}`,children:u?.name}),l.jsx(_n,{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(U4t,{}),t," ",l.jsx(hi,{content:t})]}),l.jsx(dt.Description,{children:l.jsxs(ha,{children:["Item of ",l.jsx(kd,{})," ",u?.name]})}),l.jsxs(dt.Description,{children:[l.jsxs(ha,{children:[l.jsx(_4t,{})," Created at"," ",d?.createdAt?Dn(new Date(d.createdAt),"MMM d, yyyy"):""]}),l.jsxs(ha,{children:[l.jsx(z5,{})," Latest version v",d?.datasetVersion??""]})]})]}),l.jsx(dt.Column,{children:!v&&!f&&l.jsxs(us,{children:[l.jsxs(xe,{onClick:U,disabled:D,title:D?"Return to latest version to edit":void 0,children:[l.jsx(a3t,{})," Edit"]}),l.jsxs(xe,{onClick:q,disabled:D,title:D?"Return to latest version to delete":void 0,children:[l.jsx(w3t,{})," Delete"]})]})})]}),l.jsxs(nx,{className:v?"grid-cols-1":"grid-cols-[1fr_auto]",children:[l.jsxs(Ir,{withRightSeparator:!v,children:[f&&d&&l.jsxs(Ho,{variant:"destructive",children:[l.jsx(rte,{}),l.jsxs(Ho.Message,{children:["This item was deleted at version v",d.datasetVersion]})]}),!f&&D&&p&&l.jsx(l.Fragment,{children:l.jsxs(Ho,{variant:"warning",children:[l.jsx(rte,{}),l.jsxs(Ho.Message,{children:["Viewing version v",p.datasetVersion]}),l.jsxs(Ho.Button,{onClick:F,children:[l.jsx(m4t,{})," 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:V,isSaving:o.isPending}):Z?l.jsx(g8,{item:Z,Link:n}):l.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!v&&l.jsx(Ir,{children:l.jsx(qvr,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:P,onCompareVersionsClick:B=>{r(`/evaluation/datasets/${e}/items/${t}/versions?ids=${B.join(",")}`)},activeVersion:p?.datasetVersion??null})})]})]})})]}),l.jsx(Qt,{open:I,onOpenChange:M,children:l.jsxs(Qt.Content,{children:[l.jsxs(Qt.Header,{children:[l.jsx(Qt.Title,{children:"Delete Item"}),l.jsx(Qt.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),l.jsxs(Qt.Footer,{children:[l.jsx(Qt.Cancel,{children:"Cancel"}),l.jsx(Qt.Action,{onClick:W,children:c.isPending?"Deleting...":"Delete"})]})]})})]})}function u8e(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function ikr(){const{datasetId:e}=hs(),[t,n]=Ii(),r=t.get("items")?.split(",").filter(Boolean)??[],{data:a,error:s}=Fm(e??""),{Link:i}=en(),[o,c]=b.useState(!1),{data:u}=Cse(e??"",r[0]??""),{data:d}=Cse(e??"",r[1]??"");return s&&ts(s)?l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"datasets"})})}):!e||r.length<2?l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsx(_n,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),l.jsx(Rc,{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(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsx(_n,{as:Zt,to:`/evaluation/datasets/${e}`,children:a?.name||e?.slice(0,8)}),l.jsx(_n,{isCurrent:!0,as:"span",children:"Compare Items"})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:`/evaluation/datasets/${e}`,variant:"outline",children:[l.jsx(_e,{children:l.jsx(KO,{})}),"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(Ij,{}),"Compare Dataset Items"]}),l.jsx(dt.Description,{children:l.jsxs(ha,{children:["Comparing ",r.length," items of"," ",l.jsx(Zt,{to:`/evaluation/datasets/${e}`,className:"text-info1 hover:underline",children:a?.name||e?.slice(0,8)})]})})]}),l.jsx(dt.Column,{children:l.jsxs(us,{children:[l.jsxs(xe,{as:Zt,to:`/evaluation/datasets/${e}`,children:[l.jsx(KO,{}),"Back to Dataset"]}),l.jsx(xe,{variant:"primary",onClick:()=>c(f=>!f),children:o?l.jsxs(l.Fragment,{children:[l.jsx(YQe,{})," Default View"]}):l.jsxs(l.Fragment,{children:[l.jsx(D4t,{})," Diff View"]})})]})})]}),l.jsx(nx,{className:"grid-cols-[1fr_3vw_1fr]",children:r.map((f,p)=>l.jsxs(b.Fragment,{children:[l.jsx(okr,{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(dSt,{codeA:u8e(u),codeB:u8e(d)})]})})]})}function okr({datasetId:e,itemId:t,Link:n,idx:r,itemIds:a,onItemChange:s,showContent:i=!0}){const{data:o,isLoading:c}=Cse(e,t),{data:u}=Vk(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(Ir,{children:[l.jsxs(Ir.Toolbar,{className:"flex gap-4",children:[l.jsx(s8,{label:"Item",name:`compare-item-${r}`,value:t,onValueChange:s,options:f,placeholder:"Select item",labelIsHidden:!0}),l.jsxs(xe,{as:n,to:`/datasets/${e}/items/${t}`,children:[l.jsx(z5,{}),"Versions"]})]}),i&&l.jsx(Ir.Content,{children:c?l.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):o?l.jsxs(l.Fragment,{children:[l.jsx(Uwt,{item:o}),l.jsx(g8,{item:o,Link:n})]}):l.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function d8e(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function lkr(){const{datasetId:e,itemId:t}=hs(),[n,r]=Ii(),[a,s]=b.useState(!1),i=n.get("ids")?.split(",").map(Number).filter(h=>!isNaN(h)&&h>0)??[],{data:o,error:c}=Fm(e??""),{Link:u}=en(),{data:d}=Bge(e??"",t??""),{data:f}=Ise(e??"",t??"",i[0]??0,o?.version),{data:p}=Ise(e??"",t??"",i[1]??0,o?.version);return c&&ts(c)?l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"datasets"})})}):!e||!t||i.length<2?l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsx(_n,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),l.jsx(Rc,{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(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsx(_n,{as:Zt,to:`/evaluation/datasets/${e}`,children:o?.name}),l.jsx(_n,{as:Zt,to:`/datasets/${e}/items/${t}`,children:"Item"}),l.jsx(_n,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[l.jsx(_e,{children:l.jsx(KO,{})}),"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(Ij,{}),"Compare Dataset Item Versions"]}),l.jsx(dt.Description,{children:l.jsxs(ha,{children:["Comparing ",i.length," versions of"," ",l.jsx(Zt,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),l.jsx(dt.Column,{children:l.jsxs(us,{children:[l.jsxs(xe,{as:Zt,to:`/datasets/${e}/items/${t}`,children:[l.jsx(KO,{}),"Back to Item"]}),l.jsx(xe,{variant:"primary",onClick:()=>s(h=>!h),children:a?l.jsxs(l.Fragment,{children:[l.jsx(YQe,{})," Default View"]}):l.jsxs(l.Fragment,{children:[l.jsx(Z4t,{})," Diff View"]})})]})})]}),l.jsx(nx,{className:"grid-cols-[1fr_3vw_1fr]",children:i.map((h,m)=>l.jsxs(b.Fragment,{children:[l.jsx(ckr,{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(dSt,{codeA:d8e(f),codeB:d8e(p)})]})})]})}function ckr({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}=Ise(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(Ss,{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(Ir,{children:[l.jsxs(Ir.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[l.jsx(z5,{className:"w-6 h-6 opacity-50"}),l.jsx(s8,{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(Ir.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(g8,{item:m,Link:i})})]})}function ukr(){const{datasetId:e}=hs(),[t]=Ii(),n=t.get("ids")?.split(",").map(Number).filter(g=>!isNaN(g)&&g>0)??[],r=Fc(),{data:a,error:s}=Fm(e??""),i=Vk(e??"",void 0,n[0]??null),o=Vk(e??"",void 0,n[1]??null),c=b.useMemo(()=>i.data??[],[i.data]),u=b.useMemo(()=>o.data??[],[o.data]),d=b.useMemo(()=>{const g=new Map;for(const v of[...c,...u])g.has(v.id)||g.set(v.id,{id:v.id,createdAt:new Date(v.createdAt)});return[...g.values()].sort((v,x)=>x.createdAt.getTime()-v.createdAt.getTime())},[c,u]),f=b.useMemo(()=>new Map(c.map(g=>[g.id,g])),[c]),p=b.useMemo(()=>new Map(u.map(g=>[g.id,g])),[u]);if(s&&ts(s))return l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"datasets"})})});if(!e||n.length<2)return l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsx(_n,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),l.jsx(Rc,{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,x)=>{r(`/datasets/${e}/items/${g}/versions?ids=${v?.datasetVersion??""},${x?.datasetVersion??""}`)},m=(g,v)=>{r(`/evaluation/datasets/${e}/versions?ids=${g},${v}`,{replace:!0})};return l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(kd,{})}),"Datasets"]}),l.jsx(_n,{as:Zt,to:`/evaluation/datasets/${e}`,children:a?.name||e?.slice(0,8)}),l.jsxs(_n,{isCurrent:!0,as:"span",children:[l.jsx(_e,{children:l.jsx(bSe,{})}),"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(bSe,{})," Compare Dataset Versions"]}),l.jsx(dt.Description,{children:l.jsxs(ha,{children:[l.jsx(z5,{})," Comparing ",n.length," versions of"," ",a?.name||e?.slice(0,8)]})})]}),l.jsx(dt.Column,{children:l.jsxs(xe,{as:Zt,to:`/evaluation/datasets/${e}`,children:[l.jsx(KO,{}),"Back to Dataset"]})})]}),l.jsx(nx,{children:l.jsxs(Ir,{children:[l.jsx(Qvr,{datasetId:e,versionA:String(n[0]),versionB:String(n[1]),onVersionChange:m}),l.jsx(Yvr,{datasetId:e,versionA:n[0],versionB:n[1],allItems:d,itemsAMap:f,itemsBMap:p,onItemClick:h})]})})]})})]})}const dkr="tab",fkr=["overview","scorers","datasets","experiments"];function pkr(){const[e]=Ii(),t=e.get(dkr),n=t&&fkr.includes(t)?t:"overview";return l.jsxs(Ua,{children:[l.jsx(Ua.Top,{children:l.jsx(dt,{withMargins:!1,children:l.jsx(dt.Column,{children:l.jsxs(dt.Title,{children:[l.jsx(H4t,{})," Evaluation"]})})})}),l.jsx("div",{className:"px-4 pt-2 overflow-y-auto",children:l.jsx(wbr,{activeTab:n})})]})}function hkr(){const[e]=Ii(),t=Fc(),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(SSt,{redirectUri:n,onSuccess:i,initialMode:a,errorMessage:s})}const mkr=20;function gkr(e,t,n){if(e?.pagination?.hasMore)return n+1}function vkr(e){return e.pages.flatMap(t=>t.logs??[])}const ykr=({filters:e}={})=>{const t=Ue(),{inView:n,setRef:r}=Z_(),a=Lw({queryKey:["logs",e],queryFn:({pageParam:c})=>t.listLogsVNext({pagination:{page:c,perPage:mkr},filters:e,orderBy:{field:"timestamp",direction:"DESC"}}),initialPageParam:0,getNextPageParam:gkr,select:vkr,retry:!1,refetchInterval:3e3}),{hasNextPage:s,isFetchingNextPage:i,fetchNextPage:o}=a;return b.useEffect(()=>{n&&s&&!i&&o()},[n,s,i,o]),{...a,data:a.data,setEndOfListElement:r}},gee="period",f8e="logId",p8e="traceId",h8e="spanId",bkr={"24h":1440*60*1e3,"3d":4320*60*1e3,"7d":10080*60*1e3,"14d":336*60*60*1e3,"30d":720*60*60*1e3};function xkr(){const[e,t]=Ii(),n=e.get(gee),r=Xyr(n)?n:"24h",a=e.get(f8e),s=e.get(p8e),i=e.get(h8e),o=b.useCallback(A=>{t(I=>{const M=new URLSearchParams(I);return A==="24h"?M.delete(gee):M.set(gee,A),M},{replace:!0})},[t]),c=b.useCallback(A=>{t(I=>{const M=new URLSearchParams(I);for(const[P,F]of Object.entries(A)){const D=P==="logId"?f8e:P==="traceId"?p8e:h8e;F?M.set(D,F):M.delete(D)}return M},{replace:!0})},[t]),u=b.useMemo(()=>{const A=bkr[r];if(A)return{timestamp:{start:new Date(Date.now()-A)}}},[r]),{data:d=[],isLoading:f,error:p,isFetchingNextPage:h,hasNextPage:m,setEndOfListElement:g}=ykr({filters:u}),{searchQuery:v,setSearchQuery:x,filterGroups:w,filterColumns:O,toggleComparator:k,removeFilterGroup:_,clearAllFilters:C,updateFilterGroups:T,filteredLogs:j}=Zyr(d);return l.jsxs(Ua,{className:"max-w-none",children:[l.jsxs(Ua.Top,{children:[l.jsx(dt,{withMargins:!1,children:l.jsx(dt.Column,{children:l.jsxs(dt.Title,{children:[l.jsx(JQe,{})," Logs"]})})}),l.jsx(Wyr,{onSearchChange:x,datePreset:r,onDatePresetChange:o,filterGroups:w,filterColumns:O,onToggleComparator:k,onRemoveFilterGroup:_,onClearAllFilters:C,onFilterGroupsChange:T,onReset:()=>{x(""),C(),o("24h")},isLoading:f,hasActiveFilters:v.length>0||w.length>0||r!=="24h"})]}),l.jsx(Uyr,{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 wkr=()=>{const{data:e=[],isLoading:t,error:n}=PR(),[r,a]=b.useState("");return l.jsxs(Ua,{children:[l.jsxs(Ua.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:t,children:[l.jsx(Tu,{})," MCP Servers"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Qs,{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(Hl,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(tx,{onSearch:a,label:"Filter MCP servers",placeholder:"Filter by name"})})]}),l.jsx(Gbr,{mcpServers:e,isLoading:t,error:n,search:r,onSearch:a})]})},Skr=()=>{const{serverId:e}=hs(),{data:t=[],isLoading:n}=PR(),r=t.find(a=>a.id===e);return l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/mcps",children:[l.jsx(_e,{children:l.jsx(Tu,{})}),"MCP Servers"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(B0t,{value:e,variant:"ghost"})})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"MCP documentation"]})})]}),l.jsx(Xbr,{isLoading:n,server:r})]})},Okr=()=>{const{data:e}=PR(),{serverId:t,toolId:n}=hs(),{data:r,isLoading:a}=pSt(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(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/mcps",children:[l.jsx(_e,{children:l.jsx(Tu,{})}),"MCP Servers"]}),l.jsx(_n,{as:Zt,to:`/mcps/${t}`,children:o}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:i})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"MCP documentation"]})})]}),l.jsx(Ybr,{toolId:n,serverId:t})]})},vee="period";function kkr(){const[e,t]=Ii(),n=e.get(vee),r=Rhr(n)?n:"24h",a=b.useCallback(s=>{t(i=>{const o=new URLSearchParams(i);return s==="24h"?o.delete(vee):o.set(vee,s),o},{replace:!0})},[t]);return l.jsx(Lhr,{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(Nle,{})," Metrics"]})}),l.jsxs(dt.Column,{className:"flex justify-end gap-2",children:[l.jsx(kmr,{}),l.jsx(Qs,{as:"a",href:"https://mastra.ai/en/docs/observability/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Metrics documentation",children:l.jsx(Hl,{})})]})]}),l.jsx(Smr,{})]})})}const _kr=(e,t)=>{const n=Ue();return xt({queryKey:["trace",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return await n.getTrace(e)},enabled:!!e,refetchInterval:3e3,...t})},Ekr=async({client:e,page:t,perPage:n,filters:r})=>e.listTraces({pagination:{page:t,perPage:n},filters:r}),Ckr=25;function jkr(e,t,n){if(e?.pagination?.hasMore)return n+1}function Tkr(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 Nkr=({filters:e})=>{const t=Ue(),{inView:n,setRef:r}=Z_(),a=Lw({queryKey:["traces",e],queryFn:({pageParam:c})=>Ekr({client:t,page:c,perPage:Ckr,filters:e}),initialPageParam:0,getNextPageParam:jkr,select:Tkr,placeholderData:Ozt,retry:!1,refetchInterval:c=>ts(c.state.error)?!1:3e3}),{hasNextPage:s,isFetchingNextPage:i,fetchNextPage:o}=a;return b.useEffect(()=>{n&&s&&!i&&o()},[n,s,i,o]),{...a,setEndOfListElement:r}};function Akr(){const e=Fc(),[t,n]=Ii(),[r,a]=b.useState(),[s,i]=b.useState({value:"all",label:"All",type:"all"}),[o,c]=b.useState(()=>new Date(Date.now()-1440*60*1e3)),[u,d]=b.useState(void 0),[f,p]=b.useState(!1),[h,m]=b.useState(!1),[g,v]=b.useState(""),[x,w]=b.useState([]),[O,k]=b.useState(!1),[_,C]=b.useState({}),[T,j]=b.useState("last-24h"),[A,I]=b.useState({}),{data:M={},isLoading:P}=ah(),{data:F,isLoading:D}=Iv(),{data:U={},isLoading:q}=sh(),{data:z=[]}=Mmr(),{data:V=[]}=Dmr(),{data:W=[]}=$mr(),{data:$,isLoading:Z}=_kr(r,{enabled:!!r}),B=t.get("traceId"),R=t.get("spanId"),Q=t.get("tab"),G=t.get("scoreId"),te=b.useMemo(()=>{if(Object.keys(_).length!==0)return _},[_]),{data:oe,isLoading:re,isFetchingNextPage:se,hasNextPage:ue,setEndOfListElement:me,error:J,isError:ne}=Nkr({filters:{...s?.type!=="all"&&{entityId:s?.value,entityType:s?.type},...o&&{startedAt:{start:o}},...u&&{endedAt:{end:u}},...x.length>0&&{tags:x},...O&&{status:"error"},...te&&{metadata:te},...Object.fromEntries(Object.entries(A).filter(([,Ze])=>Ze.trim()))}}),le=b.useMemo(()=>oe?.spans??[],[oe?.spans]),be=b.useDeferredValue(g),fe=b.useMemo(()=>{if(!be.trim())return le;const Ze=be.trim().toLowerCase();return le.filter(Je=>{if(Je.traceId?.toLowerCase().includes(Ze)||Je.name?.toLowerCase().includes(Ze)||Je.entityId?.toLowerCase().includes(Ze)||Je.entityName?.toLowerCase().includes(Ze))return!0;const yt=Je.metadata;if(yt&&typeof yt=="object"){for(const ot of Object.values(yt))if(String(ot).toLowerCase().includes(Ze))return!0}return!1})},[le,be]),ae=oe?.threadTitles??{},ge=b.useRef({}),ce=b.useRef({}),ye=b.useMemo(()=>{let Ze=!1;const Je=ge.current;for(const ot of le){const Mn=ot.metadata;if(Mn&&typeof Mn=="object")for(const[Qn,tt]of Object.entries(Mn)){if(tt==null)continue;Je[Qn]||(Je[Qn]=new Set,Ze=!0);const Yt=String(tt);Je[Qn].has(Yt)||(Je[Qn].add(Yt),Ze=!0)}}if(!Ze)return ce.current;const yt=Object.fromEntries(Object.entries(Je).map(([ot,Mn])=>[ot,[...Mn].sort()]));return ce.current=yt,yt},[le]),K=b.useRef({}),X=b.useRef({}),de=b.useMemo(()=>{let Ze=!1;const Je=K.current;for(const ot of le)for(const Mn of Fwt){const Qn=ot[Mn];Qn!=null&&typeof Qn=="string"&&Qn.trim()&&(Je[Mn]||(Je[Mn]=new Set,Ze=!0),Je[Mn].has(Qn)||(Je[Mn].add(Qn),Ze=!0))}for(const ot of V)Je.environment||(Je.environment=new Set,Ze=!0),Je.environment.has(ot)||(Je.environment.add(ot),Ze=!0);for(const ot of W)Je.serviceName||(Je.serviceName=new Set,Ze=!0),Je.serviceName.has(ot)||(Je.serviceName.add(ot),Ze=!0);if(!Ze)return X.current;const yt=Object.fromEntries(Object.entries(Je).map(([ot,Mn])=>[ot,[...Mn].sort()]));return X.current=yt,yt},[le,V,W]);b.useEffect(()=>{if(B){B!==r&&a(B),m(!0);return}r&&a(void 0),h&&m(!1)},[h,r,B]);const Se=b.useMemo(()=>(Object.entries(M)||[]).map(([Ze,Je])=>({value:Je.id,label:Je.name,type:Up.AGENT})),[M]),Ce=b.useMemo(()=>(Object.entries(F||{})||[]).map(([,Ze])=>({value:Ze.name,label:Ze.name,type:Up.WORKFLOW_RUN})),[F]),pe=b.useMemo(()=>[{value:"all",label:"All",type:"all"},...Se,...Ce],[Se,Ce]),Oe=t.get("entity"),Ie=pe.find(Ze=>Ze.value===Oe);Ie&&Ie.value!==s?.value&&i(Ie);const Pe=()=>{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({}),ge.current={},ce.current={},K.current={},X.current={}},et=(Ze,Je)=>{if(Je==="from")return c(Ze);d(Ze)},Ot=Ze=>{Ze?.value&&n({entity:Ze.value})},qt=Ze=>{if(Ze===r){e("/observability");return}e(`/observability?traceId=${encodeURIComponent(Ze)}`)},cn=ne?Ubr(J):void 0,gn=b.useMemo(()=>{if(!f)return fe.map(ot=>({id:ot.traceId}));const{groups:Ze,ungrouped:Je}=Lwt(fe),yt=[];for(const ot of Ze)for(const Mn of ot.traces)yt.push({id:Mn.traceId});for(const ot of Je)yt.push({id:ot.traceId});return yt},[fe,f]);if(J&&ts(J))return l.jsxs(Ua,{children:[l.jsx(Ua.Top,{children:l.jsxs(dt,{withMargins:!1,children:[l.jsxs(dt.Column,{children:[l.jsxs(dt.Title,{children:[l.jsx(JO,{})," 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(Qs,{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(Hl,{})})})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"traces"})})]});const Dt=s?.value!=="all"||o||u||g.trim()||x.length>0||O||Object.keys(_).length>0||Object.values(A).some(Ze=>Ze.trim()),rt=n8({entries:gn,id:r,update:a}),Ge=r8({entries:gn,id:r,update:a});return l.jsxs(l.Fragment,{children:[l.jsxs(Ua,{className:"grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsxs(Ua.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsxs(dt.Column,{children:[l.jsxs(dt.Title,{isLoading:re,children:[l.jsx(JO,{})," 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(Qs,{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(Hl,{})})})]}),l.jsx(jmr,{onEntityChange:Ot,onReset:Pe,selectedEntity:s,entityOptions:pe,onDateChange:et,selectedDateFrom:o,selectedDateTo:u,isLoading:re||P||D,groupByThread:f,onGroupByThreadChange:p,searchQuery:g,onSearchChange:v,selectedTags:x,availableTags:z,onTagsChange:w,errorOnly:O,onErrorOnlyChange:k,selectedMetadata:_,availableMetadata:ye,onMetadataChange:C,datePreset:T,onDatePresetChange:j,contextFilters:A,availableContextValues:de,onContextFiltersChange:I})]}),re?l.jsx(Ixt,{columns:m8}):l.jsx(Amr,{traces:fe,selectedTraceId:r,onTraceClick:qt,errorMsg:cn?.error,setEndOfListElement:me,filtersApplied:!!Dt,isFetchingNextPage:se,hasNextPage:ue,groupByThread:f,threadTitles:ae})]}),l.jsx(Mge,{traceSpans:$?.spans,traceId:r,initialSpanId:R||void 0,initialSpanTab:Q==="scores"?"scores":"details",initialScoreId:G||void 0,traceDetails:fe.find(Ze=>Ze.traceId===r),isOpen:h,onClose:()=>{e("/observability"),m(!1)},onNext:rt,onPrevious:Ge,isLoadingSpans:Z,computeTraceLink:(Ze,Je)=>`/observability?traceId=${Ze}${Je?`&spanId=${Je}`:""}`,scorers:U,isLoadingScorers:q})]})}const Ikr=[{title:"Metrics",description:"View system performance metrics, request latencies, and throughput across your agents and workflows.",icon:Nle,href:"/metrics"},{title:"Traces",description:"Explore distributed traces to debug and understand the execution flow of your AI operations.",icon:JO,href:"/observability"}];function Rkr(){return l.jsxs(Ua,{children:[l.jsx(Ua.Top,{children:l.jsx(dt,{withMargins:!1,children:l.jsx(dt.Column,{children:l.jsxs(dt.Title,{children:[l.jsx(JO,{})," 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:Ikr.map(e=>l.jsxs(Zt,{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 Pkr=[{title:"Agents",description:"Create and manage AI agents with tools, memory, and custom instructions.",icon:Xs,href:"/agents"},{title:"Prompts",description:"Design and version reusable prompt templates for your agents.",icon:rI,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:XQe,href:"/processors"},{title:"MCP Servers",description:"Connect to Model Context Protocol servers for external tool access.",icon:Tu,href:"/mcps"},{title:"Tools",description:"Browse and test the tools available to your agents and workflows.",icon:Ao,href:"/tools"},{title:"Workspaces",description:"Organize your projects and resources into isolated workspaces.",icon:fp,href:"/workspaces"},{title:"Request Context",description:"Inspect request-scoped context propagation for dynamic configuration.",icon:Ale,href:"/request-context"}];function Mkr(){return l.jsxs(Ua,{children:[l.jsx(Ua.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:Pkr.map(e=>l.jsxs(Zt,{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 Dkr(){const{paths:e}=en(),{data:t,isLoading:n}=u0t(),{isCmsAvailable:r}=Oge(),[a,s]=b.useState(""),i=t?.promptBlocks??[];return l.jsxs(Ua,{children:[l.jsxs(Ua.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:n,children:[l.jsx(rI,{})," Prompts"]})}),l.jsxs(dt.Column,{className:"flex justify-end gap-2",children:[l.jsx(Qs,{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(Hl,{})}),r&&l.jsxs(xe,{as:Zt,to:e.cmsPromptBlockCreateLink(),variant:"primary",children:[l.jsx(tWe,{}),"Create Prompt"]})]})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(tx,{onSearch:s,label:"Filter prompts",placeholder:"Filter by name or description"})})]}),l.jsx(Rur,{promptBlocks:i,isLoading:n,search:a,onSearch:s})]})}function $kr(){return l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(Ale,{})}),"Request Context"]})}),l.jsx(Rc,{children:l.jsx(kor,{children:l.jsx(_xt,{})})})]})}const Lkr=[{title:"Mastra APIs",description:"Explore and test the available REST API endpoints with the interactive Swagger UI.",icon:L4t,href:"/swagger-ui",external:!1},{title:"Documentation",description:"Read the official Mastra documentation for guides, references, and tutorials.",icon:Hl,href:"https://mastra.ai/en/docs",external:!0},{title:"Github",description:"Browse the source code, report issues, and contribute to the Mastra project.",icon:KQe,href:"https://github.com/mastra-ai/mastra",external:!0},{title:"Community",description:"Join the Mastra Discord community for help, discussion, and collaboration.",icon:t3t,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:A4t,href:"https://mastra.ai/cloud",external:!0},{title:"Talk to our Sales team",description:"Get a custom demo, discuss on-prem deployments, and how we can help you accelerate getting agents into production.",icon:O4t,href:"https://mastra.ai/contact?ref=studio",external:!0}];function Fkr(){return l.jsxs(Ua,{children:[l.jsx(Ua.Top,{children:l.jsx(dt,{withMargins:!1,children:l.jsx(dt.Column,{children:l.jsxs(dt.Title,{children:[l.jsx(Hl,{})," 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:Lkr.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(KQe,{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 zkr(){const{scorerId:e}=hs(),[t,n]=Ii(),[r,a]=b.useState(),[s,i]=b.useState(0),[o,c]=b.useState(!1),[u,d]=b.useState({value:"all",label:"All Entities",type:"ALL"}),{scorer:f,isLoading:p,error:h}=rlr(e),{data:m={},isLoading:g,error:v}=ah(),{data:x,isLoading:w,error:O}=Iv(),{data:k,isLoading:_,error:C}=nlr({scorerId:e,page:s,entityId:u?.value==="all"?void 0:u?.value,entityType:u?.type==="ALL"?void 0:u?.type}),T=b.useMemo(()=>f?.agentIds?.filter(B=>m[B]).map(B=>({value:B,label:m[B].name,type:"AGENT"}))||[],[f?.agentIds,m]),j=b.useMemo(()=>f?.workflowIds?.map(B=>({value:B,label:B,type:"WORKFLOW"}))||[],[f?.workflowIds]),A=b.useMemo(()=>[{value:"all",label:"All Entities",type:"ALL"},...T,...j],[T,j]),I=t.get("entity"),M=A.find(B=>B.value===I);M&&M.value!==u?.value&&d(M),b.useEffect(()=>{if(h){const B=h instanceof Error?h.message:"Failed to load scorer";Re.error(`Error loading scorer: ${B}`)}},[h]),b.useEffect(()=>{if(v){const B=v instanceof Error?v.message:"Failed to load agents";Re.error(`Error loading agents: ${B}`)}},[v]),b.useEffect(()=>{if(O){const B=O instanceof Error?O.message:"Failed to load workflows";Re.error(`Error loading workflows: ${B}`)}},[O]);const P=b.useMemo(()=>k?.scores||[],[k?.scores]),F=k?.pagination,D=f?.agentIds?.map(B=>({name:B,id:Object.entries(m).find(([,R])=>R.name===B)?.[0]}))||[],U=f?.workflowIds?.map(B=>({name:B,id:Object.entries(x||{}).find(([,R])=>R.name===B)?.[0]}))||[],z=[{key:"entities",label:"Entities",value:([...D.map(B=>({id:B.id,name:B.name,type:"AGENT"})),...U.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(R=>{const Q=new URLSearchParams(R);return Q.set("entity",B.value),Q})};if(b.useEffect(()=>{const B=t.get("scoreId");if(!B){r&&a(void 0),o&&c(!1);return}P.find(Q=>Q.id===B)&&(r!==B&&a(B),o||c(!0))},[o,P,t,r]),b.useEffect(()=>{const B=t.get("scoreId");(r?B===r:!B)||n(R=>{const Q=new URLSearchParams(R);return r?Q.set("scoreId",r):Q.delete("scoreId"),Q})},[t,r,n]),h&&ts(h))return l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=scorers",children:[l.jsx(_e,{children:l.jsx(b0,{})}),"Scorers"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"scorers"})})]});if(p||h||v||O)return null;const W=B=>{a(B),c(!0)},$=n8({entries:P,id:r,update:a}),Z=r8({entries:P,id:r,update:a});return l.jsxs(l.Fragment,{children:[l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/evaluation?tab=scorers",children:[l.jsx(_e,{children:l.jsx(b0,{})}),"Scorers"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(alr,{value:e,variant:"ghost"})})]}),l.jsxs(qi,{children:[f?.scorer?.source==="stored"&&l.jsxs(xe,{variant:"light",as:Zt,to:`/cms/scorers/${e}/edit`,children:[l.jsx(_e,{children:l.jsx(i3t,{})}),"Edit"]}),l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/evals/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"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(n$,{title:f?.scorer?.config?.name||"loading",description:f?.scorer?.config?.description||"loading",icon:l.jsx(b0,{})}),l.jsx(ex,{data:z,LinkComponent:Zt,isLoading:g||w}),l.jsx(tlr,{selectedEntity:u,entityOptions:A,onEntityChange:V,onReset:()=>{n(B=>{const R=new URLSearchParams(B);return R.set("entity","all"),R})},isLoading:_||g||w}),_?l.jsx("div",{className:"h-full w-full flex items-center justify-center",children:l.jsx(Ft,{})}):l.jsx($or,{scores:P,selectedScoreId:r,pagination:{total:F?.total||0,hasMore:F?.hasMore||!1,perPage:F?.perPage||0,page:F?.page||0},onScoreClick:W,onPageChange:i,errorMsg:C?.message})]})})]}),l.jsx(Mxt,{scorerName:f?.scorer?.config?.name,score:Bkr(P.find(B=>B.id===r)),isOpen:o,onClose:()=>{c(!1),a(void 0)},onNext:$,onPrevious:Z,computeTraceLink:(B,R)=>`/observability?traceId=${B}${R?`&spanId=${R}`:""}`})]})}const Bkr=e=>{if(e)return{...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt)}},Ukr=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}],qkr=()=>{const{baseUrl:e,headers:t,apiPrefix:n}=Sge(),{theme:r,setTheme:a}=Ur(),[s,i]=b.useState(r),o=b.useRef(r);return b.useEffect(()=>{i(r),o.current=r},[r]),l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(age,{})}),"Settings"]})}),l.jsx(Rc,{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(s8,{name:"theme",label:"Theme mode",value:s,onValueChange:c=>{const u=c;o.current=u,i(u)},options:Ukr.map(c=>({...c}))})]})}),l.jsx(qxt,{initialConfig:{baseUrl:e,headers:t,apiPrefix:n},onSave:()=>{a(o.current)}})]})})]})};function Vkr(){const[e]=Ii(),t=Fc(),n=e.get("redirect")||"/",r=()=>{n.startsWith("http")?window.location.href=n:t(n,{replace:!0})};return l.jsx(SSt,{redirectUri:n,onSuccess:r,initialMode:"signup"})}async function fOt(){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 Hkr({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 Qkr({repoOrSlug:e,owner:t}){const{templates:n}=await fOt(),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 Hkr({repo:e,owner:t});if(a)return a;throw new Error(`Template ${e} not found`)}return r}async function Wkr({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 Gkr=()=>xt({queryKey:["mastra-templates"],queryFn:fOt}),Zkr=({repoOrSlug:e,owner:t})=>xt({queryKey:["template-repo",e,t],queryFn:()=>Qkr({repoOrSlug:e,owner:t})}),Ykr=({repo:e,owner:t,branch:n})=>xt({queryKey:["template-repo-env-vars",e,t,n],queryFn:()=>Wkr({repo:e,owner:t,branch:n})}),Xkr=()=>{const e=Ue();return xt({queryKey:["agent-builder-workflow"],queryFn:async()=>await e.getAgentBuilderAction("merge-template").details()})},Kkr=()=>{const e=Ue();return Bn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").createRun({runId:t})})},Jkr=()=>{const e=Ue();return Bn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").runById(t)})},m8e=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)},g8e=(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=m8e(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=m8e(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}},e_r=(e,t)=>{try{localStorage.setItem(`template-install-${e}`,JSON.stringify({state:t,timestamp:Date.now()}))}catch(n){console.warn("Failed to save template state to localStorage:",n)}},pOt=(e,t)=>{const[n,r]=b.useState({}),[a,s]=b.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}=g8e(p,d,e);if(d=h,r(h),p.runId||c||t){const m=p.runId||c||t;e_r(m,h)}}}catch(f){console.error("💥 [processStream] Error processing template installation stream:",f);const{newState:p}=g8e({type:"error",payload:{error:f instanceof Error?f.message:"Unknown error"}},d,e);r(p)}finally{s(!1),u.releaseLock()}}}},t_r=e=>{const t=Ue(),{streamResult:n,isStreaming:r,processStream:a}=pOt(e);return{streamInstall:Bn({mutationFn:async({inputData:i,selectedModel:o,runId:c})=>{for(let d=1;d<=3;d++)try{const f=t.getAgentBuilderAction("merge-template"),p=new XO;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}},n_r=e=>{const t=Ue(),{streamResult:n,isStreaming:r,processStream:a}=pOt(e);return{observeInstall:Bn({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 r_r(){const{data:e,isLoading:t}=Gkr(),{templates:n,tags:r,providers:a}=e??{templates:[],tags:[],providers:[]},[s,i]=b.useState("all"),[o,c]=b.useState("all"),[u,d]=b.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))),x=u||s!=="all"||o!=="all";return l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(eWe,{})}),"Templates"]})}),l.jsxs("div",{className:Y("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[l.jsx(xhr,{selectedTag:s,onTagChange:w=>h(w,"tag"),tagOptions:f,selectedProvider:o,onProviderChange:w=>h(w,"provider"),providerOptions:p,searchTerm:u,onSearchChange:m,onReset:x?g:void 0,className:"max-w-[80rem]",isLoading:t}),l.jsx(Shr,{templates:v,linkComponent:Zt,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const a_r="1.22.0-alpha.3";function s_r(){const{templateSlug:e}=hs(),[t,n]=Ii(),[r,a]=b.useState(""),[s,i]=b.useState(""),[o,c]=b.useState(""),[u,d]=b.useState({}),[f,p]=b.useState([]),[h,m]=b.useState(null),[g,v]=b.useState(!1),[x,w]=b.useState(""),[O,k]=b.useState(!1),[_,C]=b.useState(!1),[T,j]=b.useState([]),{data:A,isLoading:I}=Zkr({repoOrSlug:e,owner:"mastra-ai"}),P=a_r?.includes("beta")??!1?"beta":"main",{data:F,isLoading:D}=Ykr({repo:A?.githubUrl?new URL(A.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:P}),{data:U,isLoading:q}=Xkr(),{mutateAsync:z,isPending:V}=Kkr(),{mutateAsync:W}=Jkr(),{streamInstall:$,streamResult:Z,isStreaming:B}=t_r(U),{observeInstall:R,streamResult:Q,isStreaming:G}=n_r(U);b.useEffect(()=>{const ne=t.get("runId");ne&&!g&&!h&&!B&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:ne}),w(ne),W({runId:ne}).then(le=>{const be=le.snapshot;if(be?.status==="success"&&be?.result?.success)v(!0);else if(be?.result?.success===!1)if(be?.result?.validationResults&&!be?.result?.validationResults?.valid&&be?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ae,errors:ge}=be.result.validationResults,ce=`Template installation completed but ${ae} validation issue${ae>1?"s":""} remain unresolved.`;m(ce),j(ge||[])}else{const ae=be?.result?.message||be?.result?.error||"Template installation failed";m(typeof ae=="string"?ae:String(ae))}}).catch(le=>{console.error("❌ Failed to fetch run details:",le),m("Failed to retrieve installation status after reload")}))},[t,g,h,B,G,W]),b.useEffect(()=>{const ne=t.get("runId"),le=t.get("resume"),be=t.get("provider");if(ne&&le==="true"&&be&&!B&&!G&&!O&&!_&&U){w(ne),k(!0);try{W({runId:ne}).then(fe=>{if(fe.snapshot?.status==="running")return R.mutateAsync({runId:ne})}).then(()=>{n(fe=>{const ae=new URLSearchParams(fe);return ae.delete("resume"),ae})}).catch(fe=>{console.error("❌ Failed to resume template installation:",fe),fe.message?.includes("404")||fe.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(fe){console.error("❌ Auto-resume failed with error:",fe),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,B,G,O,_,U,W,R,n]);const te=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],oe=[{key:"tools",label:"Tools",value:A?.tools?.length?A.tools.map(ne=>ne).join(", "):"n/a",icon:l.jsx(Ao,{})},{key:"agents",label:"Agents",value:A?.agents?.length?A.agents.map(ne=>ne).join(", "):"n/a",icon:l.jsx(Xs,{})},{key:"workflows",label:"Workflows",value:A?.workflows?.length?A.workflows.map(ne=>ne).join(", "):"n/a",icon:l.jsx(_3t,{})},{key:"providers",label:"Providers",value:A?.supportedProviders?.length?A.supportedProviders.join(", "):"n/a",icon:l.jsx(w4t,{})},{key:"tags",label:"Tags",value:A?.tags?.length?A.tags.join(", "):"n/a",icon:l.jsx(v3t,{})}],re=[{...oe[0]},{...oe[1]},{...oe[2]}].filter(ne=>ne.value!=="n/a");b.useEffect(()=>{F&&d(F)},[F]),b.useEffect(()=>{const ne=Z||Q;ne?.phase==="error"&&ne?.error&&m(typeof ne.error=="string"?ne.error:String(ne.error))},[Z?.phase,Z?.error,Q?.phase,Q?.error]);const se=ne=>{a(ne)},ue=async ne=>(i(ne.provider),c(ne.modelId),{message:"Model updated successfully"}),me=async()=>{const ne=Object.entries(u).reduce((le,[be,fe])=>(fe===""&&le.push(be),le),[]);if(ne.length>0){p(ne);return}if(A){m(null),v(!1),w(""),C(!0);try{const be={repo:A.githubUrl||`https://github.com/mastra-ai/template-${A.slug}`,ref:P,slug:A.slug,variables:u},{runId:fe}=await z({});w(fe),n(ae=>{const ge=new URLSearchParams(ae);return ge.set("runId",fe),ge.set("resume","true"),ge.set("provider",r||"openai"),ge}),await $.mutateAsync({inputData:be,selectedModel:{provider:s,modelId:o},runId:fe})}catch(le){C(!1),m(le?.message||"Template installation failed"),console.error("Template installation failed",le)}}},J=ne=>{const{name:le,value:be}=ne.target;be.trim()===""?p(fe=>[...fe,le]):p(fe=>fe.filter(ae=>ae!==le)),d(fe=>({...fe,[le]:be}))};return l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/templates",children:[l.jsx(_e,{children:l.jsx(eWe,{})}),"Templates"]}),l.jsx(_n,{as:Zt,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(Ohr,{isLoading:I,title:A?.title,description:A?.longDescription,imageURL:A?.imageURL,githubUrl:A?.githubUrl,infoData:oe,templateSlug:e}),A&&l.jsxs(l.Fragment,{children:[(B||G)&&l.jsx(Thr,{name:A.title,streamResult:G?Q:Z,runId:x,workflowInfo:U}),g&&l.jsx(Nhr,{name:A.title,installedEntities:re,linkComponent:Zt}),h&&l.jsx(Ahr,{errorMsg:h,validationErrors:T.length>0?T:Z?.validationResults?.errors||Q?.validationResults?.errors}),!B&&!G&&!g&&!h&&l.jsx(khr,{providerOptions:te,selectedProvider:r,onProviderChange:se,variables:u,setVariables:d,errors:f,setErrors:p,handleInstallTemplate:me,handleVariableChange:J,isLoadingEnvVars:D||q,isInstalling:V,defaultModelProvider:s,defaultModelId:o,onModelUpdate:ue})]})]})})]})}const i_r=()=>{const{toolId:e,agentId:t}=hs();return l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/agents",children:[l.jsx(_e,{children:l.jsx(Xs,{})}),"Agents"]}),l.jsx(_n,{as:Zt,to:`/agents/${t}/chat`,children:t}),l.jsx(_n,{as:Zt,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[l.jsx(_e,{children:l.jsx(mc,{})}),"Tools documentation"]})})]}),l.jsx(bcr,{toolId:e,agentId:t})]})},o_r=()=>{const{toolId:e}=hs();return l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/tools",children:[l.jsx(_e,{children:l.jsx(Ao,{})}),"Tools"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(bhr,{value:e,variant:"ghost"})})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"Tools documentation"]})})]}),l.jsx(yhr,{toolId:e})]})};function l_r(){const{data:e,isLoading:t,error:n}=Iv(),[r,a]=b.useState("");return l.jsxs(Ua,{children:[l.jsxs(Ua.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(Qs,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:l.jsx(Hl,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(tx,{onSearch:a,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),l.jsx(Vsr,{workflows:e||{},isLoading:t,error:n,search:r,onSearch:a})]})}const v8e=()=>{const{workflowId:e}=hs(),{data:t,isLoading:n,error:r}=jR(e);return r&&ts(r)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"workflows"})}):l.jsx(zbt,{workflowId:e,workflow:t??void 0,isLoading:n})};function y8e(){const{workspaceId:e}=hs(),[t,n]=Ii(),r=Fc(),[a,s]=b.useState(!1),[i,o]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState(null),[p,h]=b.useState(null),[m,g]=b.useState(!1),v=t.get("file"),x=t.get("tab"),{data:w,error:O,isLoading:k}=lwt(),_=w?.workspaces??[],C=e??_[0]?.id,{data:T,isLoading:j,error:A}=Hdr(C),I=ts(O)||ts(A),M=t.get("path")||".",P=Jae(O)||Jae(A),F=C?_.find(rt=>rt.id===C):void 0,D=rt=>{const Ge=new URLSearchParams(t);for(const[Ze,Je]of Object.entries(rt))Je===null?Ge.delete(Ze):Ge.set(Ze,Je);n(Ge)},U=rt=>{g(!1),s(!1),r(`/workspaces/${rt}`)},q=rt=>{D({path:rt==="."||rt===""?null:rt,file:null})},z=rt=>{D({file:rt})},V=rt=>{D({tab:rt})},W=M,$=v,{data:Z,isLoading:B,error:R,refetch:Q}=Qdr(W,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:C}),G=Gdr(),te=Zdr(),{data:oe,isLoading:re}=cwt($??"",{enabled:!!$,workspaceId:C}),{data:se,isLoading:ue,refetch:me}=Xdr({workspaceId:C}),J=afr(),ne=sfr(),le=ifr(),be=T?.isWorkspaceConfigured??!1,fe=T?.capabilities?.hasFilesystem??!1,ae=T?.capabilities?.hasSkills??!1,ge=T?.capabilities?.canBM25??!1,ce=T?.capabilities?.canVector??!1,ye=F?.safety?.readOnly??!1,K=fe&&!ye,X=T?.mounts,de=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,Ce=b.useCallback(rt=>{C&&J.mutate({...rt,workspaceId:C},{onSuccess:async Ge=>{if(Ge.success){u(!1);const{data:Ze,error:Je}=await me();if(Je||!Ze){Re.success(`Skill "${Ge.skillName}" installed successfully (${Ge.filesWritten} files)`);return}Ze.skills.some(ot=>ot.name===Ge.skillName)?Re.success(`Skill "${Ge.skillName}" installed successfully (${Ge.filesWritten} files)`):(g(!0),Re.warning(`Skill "${Ge.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else Re.error("Failed to install skill")},onError:Ge=>{Re.error(`Failed to install skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}})},[C,J,me]),pe=b.useCallback(rt=>{C&&(h(rt),ne.mutate({workspaceId:C,skillName:rt},{onSuccess:Ge=>{if(h(null),Ge.updated.length>0){const Ze=Ge.updated[0];Ze.success?(Re.success(`Skill "${rt}" updated successfully (${Ze.filesWritten} files)`),me()):Re.error(`Failed to update skill: ${Ze.error??"Unknown error"}`)}else Re.error("Failed to update skill: No update result returned")},onError:Ge=>{h(null),Re.error(`Failed to update skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}}))},[C,ne,me]),Oe=b.useCallback(rt=>{C&&(f(rt),le.mutate({workspaceId:C,skillName:rt},{onSuccess:Ge=>{f(null),Ge.success?(Re.success(`Skill "${Ge.skillName}" removed successfully`),me()):Re.error(`Failed to remove skill "${Ge.skillName}"`)},onError:Ge=>{f(null),Re.error(`Failed to remove skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}}))},[C,le,me]),Pe=x==="files"&&fe?"files":x==="skills"&&ae?"skills":fe?"files":ae?"skills":"files",et=se?.skills??[],Ot=se?.isSkillsConfigured??!1,qt=Z?.entries??[],cn=fe&&(ge||ce),gn=ae&&Ot&&et.length>0,Dt=cn||gn;return I?l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"workspaces"})})]}):P?l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"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(n$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(fp,{})}),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(rte,{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(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[l.jsx(_e,{children:l.jsx(mc,{})}),"Learn More"]})]})]})})]}):k?l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(_e,{children:l.jsx(mc,{})}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ft,{})})]}):!j&&!k&&!be?l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"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(n$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(fp,{})}),l.jsx(oxr,{})]})})]}):l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(qi,{children:[Dt&&l.jsxs(xe,{variant:"light",onClick:()=>s(!a),children:[l.jsx(_e,{children:l.jsx(h3t,{className:"h-4 w-4"})}),"Search"]}),l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(_e,{children:l.jsx(mc,{})}),"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(n$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(fp,{})}),_.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(m2,{className:"h-4 w-4 text-accent1"}):l.jsx(e7,{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(T4t,{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(m2,{className:"h-4 w-4 text-accent1 flex-shrink-0"}):l.jsx(e7,{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(m2,{className:"h-4 w-4 text-accent1"}):l.jsx(e7,{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,")"]}),ye&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),a&&Dt&&C&&l.jsx(c_r,{workspaceId:C,canSearchFiles:cn,canSearchSkills:gn,canBM25:ge,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:[fe&&l.jsxs("button",{onClick:()=>V("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Pe==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(rI,{className:"h-4 w-4"}),"Files"]}),ae&&l.jsxs("button",{onClick:()=>V("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Pe==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(P$,{className:"h-4 w-4"}),"Skills",Ot&&et.length>0&&l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:et.length})]})]}),l.jsxs("div",{className:"pb-8",children:[Pe==="files"&&fe&&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(rxr,{entries:qt,currentPath:W,isLoading:B,error:R,onNavigate:q,onFileSelect:z,onRefresh:()=>Q(),onCreateDirectory:ye?void 0:rt=>te.mutate({path:rt,workspaceId:C}),onDelete:ye?void 0:rt=>G.mutate({path:rt,recursive:!0,force:!0,workspaceId:C})}),$&&l.jsx(ixr,{path:$,content:oe?.content??"",isLoading:re,mimeType:oe?.mimeType,onClose:()=>z(null)})]})}),Pe==="skills"&&ae&&l.jsx(gxr,{skills:et,isLoading:ue,isSkillsConfigured:Ot,hasUndiscoveredAgentSkills:m,basePath:C?`/workspaces/${C}/skills`:"/workspaces",onAddSkill:K?()=>u(!0):void 0,onUpdateSkill:K?pe:void 0,onRemoveSkill:K?Oe:void 0,updatingSkillName:p??void 0,removingSkillName:d??void 0,mountPaths:Se}),!fe&&!ae&&l.jsx("div",{className:"py-12 text-center text-neutral4",children:l.jsx("p",{children:"No workspace capabilities are configured."})})]})]})}),C&&K&&l.jsx(Sxr,{open:c,onOpenChange:u,workspaceId:C,onInstall:Ce,isInstalling:J.isPending,installedSkillIds:et.filter(rt=>rt.skillsShSource).map(rt=>`${rt.skillsShSource.owner}/${rt.skillsShSource.repo}/${rt.name}`),installedSkillNames:et.filter(rt=>!rt.skillsShSource).map(rt=>rt.name),writableMounts:de,installedSkillPaths:Object.fromEntries(et.filter(rt=>rt.path).map(rt=>[rt.name,rt.path]))})]})}function c_r({workspaceId:e,canSearchFiles:t,canSearchSkills:n,canBM25:r,canVector:a,showInitWarning:s,onViewFileResult:i,onViewSkillResult:o}){const c=Ydr(),u=efr();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(rI,{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(lxr,{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(P$,{className:"h-4 w-4"}),"Search Skills"]}),l.jsx(uxr,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>o(d.skillName,d.skillPath)})]})]})}function u_r(e,t){return e==null||t==null?null:e in t?e:null}function d_r(){const{skillName:e,workspaceId:t}=hs(),[n]=Ii(),r=ns(),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=u_r(c,d),p=f?`/agents/${f}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[h,m]=b.useState(null),{data:g,isLoading:v,error:x}=Kdr(a,{workspaceId:t,path:i}),{data:w}=cwt(g?.path?`${g.path}/SKILL.md`:"",{enabled:!!g?.path,workspaceId:t}),{data:O,isLoading:k}=Jdr(a,h??"",{enabled:!!h,workspaceId:t,path:i}),_=C=>f?l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:p,children:[l.jsx(_e,{children:l.jsx(m2,{className:"h-4 w-4"})}),f]}),l.jsxs(_n,{as:"span",to:"",isCurrent:!0,children:[l.jsx(_e,{children:l.jsx(P$,{className:"h-4 w-4"})}),C]})]}):l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:p,children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(_n,{as:Zt,to:p,children:[l.jsx(_e,{children:l.jsx(P$,{className:"h-4 w-4"})}),"Skills"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:C})]});return v?l.jsxs(zn,{children:[l.jsx(ar,{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"})})]}):x&&ts(x)?l.jsxs(zn,{children:[l.jsx(ar,{children:_("Permission Denied")}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"workspaces"})})]}):x||!g?l.jsxs(zn,{children:[l.jsx(ar,{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:x?.message??"Skill not found"})]})})]}):l.jsxs(zn,{children:[l.jsxs(ar,{children:[_(g.name),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[l.jsx(_e,{children:l.jsx(mc,{})}),"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(xxr,{skill:g,rawSkillMd:w?.content,onReferenceClick:m})})}),l.jsx(wxr,{open:!!h,onOpenChange:C=>!C&&m(null),skillName:g.name,referencePath:h??"",content:O?.content,isLoading:k})]})}const f_r=[{key:"primitives",title:"Primitives",href:"/primitives",links:[{name:"Agents",url:"/agents",icon:l.jsx(Xs,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"agents:read"},{name:"Prompts",url:"/prompts",icon:l.jsx(rI,{}),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(XQe,{}),isOnMastraPlatform:!1,indent:!0,requiredPermission:"processors:read"},{name:"MCP Servers",url:"/mcps",icon:l.jsx(Tu,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"mcps:read"},{name:"Tools",url:"/tools",icon:l.jsx(Ao,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"tools:read"},{name:"Workspaces",url:"/workspaces",icon:l.jsx(fp,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workspaces:read"},{name:"Request Context",url:"/request-context",icon:l.jsx(Ale,{}),isOnMastraPlatform:!0,indent:!0}]},{key:"evaluation",title:"Evaluation",href:"/evaluation",links:[{name:"Scorers",url:"/evaluation?tab=scorers",icon:l.jsx(v4t,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"scorers:read"},{name:"Datasets",url:"/evaluation?tab=datasets",icon:l.jsx(kd,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]},{name:"Experiments",url:"/evaluation?tab=experiments",icon:l.jsx(b3t,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]}]},{key:"observability",title:"Observability",href:"/observability-overview",links:[{name:"Metrics",url:"/metrics",icon:l.jsx(Nle,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Traces",url:"/observability",icon:l.jsx(JO,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Logs",url:"/logs",icon:l.jsx(JQe,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"}]},{key:"bottom",separator:!0,links:[{name:"Settings",url:"/settings",icon:l.jsx(age,{}),isOnMastraPlatform:!1},{name:"Resources",url:"/resources",icon:l.jsx(Hl,{}),isOnMastraPlatform:!0}]}],p_r={scorers:"/evaluation/scorers",datasets:"/evaluation/datasets"};function b8e(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=p_r[s];if(o&&(t===o||t.startsWith(o+"/")))return!0}return!1}return t===e.url||t.startsWith(e.url+"/")}function h_r(){const{state:e}=Yge(),t=Lc(),n=t.pathname,{isMastraPlatform:r}=bSt(),{data:a}=Y_(),{isCmsAvailable:s,isLoading:i}=Oge(),{hasPermission:o,hasAnyPermission:c,rbacEnabled:u,isAuthenticated:d,isLoading:f}=Tv(),p=a&&AR(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(up,{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(sb,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),p&&l.jsx(Pse,{})]}):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(sb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),l.jsx(Pse,{})]}):l.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[l.jsx(sb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),l.jsx(up.Nav,{children:f_r.map(g=>{const v=g.links.filter(m),x=v.length>0&&g?.separator,w=v.some(k=>b8e(k,n,t.search)),O=!!(g.href&&n===g.href&&!w);return l.jsxs(up.NavSection,{children:[g?.title?l.jsx(up.NavHeader,{state:e,href:g.href,isActive:O,children:g.title}):l.jsx(l.Fragment,{children:x&&l.jsx(up.NavSeparator,{})}),l.jsx(up.NavList,{children:v.map(k=>{const _=b8e(k,n,t.search);return l.jsx(up.NavLink,{state:e,link:k,isActive:_},k.name)})})]},g.key)})}),l.jsxs(up.Bottom,{children:[e!=="collapsed"&&l.jsxs(l.Fragment,{children:[l.jsx(up.NavSeparator,{}),l.jsx(Mlr,{collapsed:!1})]}),l.jsx(up.NavSeparator,{}),l.jsx("div",{className:"flex justify-end pb-3",children:l.jsx(up.Trigger,{})})]})]})}const m_r=b.createContext({theme:"dark",setTheme:()=>null}),g_r=e=>e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";function hOt({children:e}){const t=Ur(a=>a.theme),n=Ur(a=>a.setTheme),r=t==="light"||t==="system"?t:"dark";return b.useEffect(()=>{const a=window.document.documentElement,s=c=>{const u=g_r(c);a.classList.remove("light","dark"),a.classList.add(u)};if(s(r),r!=="system")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>s("system");return i.addEventListener("change",o),()=>{i.removeEventListener("change",o)}},[r]),l.jsx(m_r.Provider,{value:{theme:r,setTheme:n},children:e})}const mOt="experimental-ui:",gOt="current",v_r=je.createContext(null);function y_r(e,t){const n=window.localStorage.getItem(mOt+e);return n&&t.has(n)?n:gOt}function b_r({experiments:e,children:t}){const n=je.useMemo(()=>new Map(e.map(c=>[c.key,new Set(c.variants.map(u=>u.value))])),[e]),[r,a]=je.useState({});je.useLayoutEffect(()=>{const c={};for(const u of e){const d=n.get(u.key);c[u.key]=y_r(u.key,d)}a(c)},[e,n]);const s=je.useCallback(c=>r[c]??gOt,[r]),i=je.useCallback((c,u)=>{window.localStorage.setItem(mOt+c,u),a(d=>({...d,[c]:u}))},[]),o=je.useMemo(()=>({experiments:e,getVariant:s,setVariant:i}),[e,s,i]);return l.jsx(v_r.Provider,{value:o,children:t})}const x_r=[{key:"entity-list-page",name:"Entity List page UI",path:["/agents","/prompts","/tools","/datasets","/scorers","/mcps","/workflows","/processors"],variants:[{value:"current",label:"Current state"},{value:"new-proposal",label:"New proposal"}]}],w_r=()=>({experimentalUIEnabled:typeof window<"u"&&window.MASTRA_EXPERIMENTAL_UI==="true"});function S_r({children:e}){const{data:t,isFetched:n}=Y_(),r=n&&t?.enabled&&!AR(t),a=n&&!r;return l.jsxs(l.Fragment,{children:[l.jsx(Nxr,{}),l.jsxs("div",{className:a?"grid h-full grid-cols-[auto_1fr]":"h-full",children:[a&&l.jsx(h_r,{}),l.jsx("div",{className:Y("bg-transparent overflow-y-auto",{"h-[calc(100%-1.5rem)]":r}),children:l.jsx(OSt,{children:e})})]})]})}const O_r=({children:e})=>{const{experimentalUIEnabled:t}=w_r();return l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(Rst,{position:"bottom-right"}),l.jsx(hOt,{defaultTheme:"dark",attribute:"class",children:l.jsx($c,{delayDuration:0,children:l.jsx(b_r,{experiments:t?x_r:[],children:l.jsx(Mbr,{children:l.jsx(S_r,{children:e})})})})})]})},k_r=({children:e})=>l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(Rst,{position:"bottom-right"}),l.jsx(hOt,{defaultTheme:"dark",attribute:"class",children:l.jsx($c,{delayDuration:0,children:l.jsx("div",{className:"h-full overflow-y-auto",children:l.jsx(OSt,{children:e})})})})]});function __r({agentId:e}){return l.jsxs(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/agents",children:[l.jsx(_e,{children:l.jsx(Xs,{})}),"Agents"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(hcr,{value:e,variant:"ghost"})})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"Agents documentation"]})})]})}const E_r=({children:e})=>{const{agentId:t}=hs(),n=Lc(),{isCmsAvailable:r}=Oge(),{hasObservability:a}=Flr(),s=fie.has("datasets"),i=r&&s,o=a&&s,{data:c}=Ld(t),u=kc(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(__r,{agentId:t}),l.jsx(Bpr,{agentId:t,activeTab:p,showPlayground:i,showObservability:o,rightSlot:h?l.jsx(Upr,{requestContextSchema:f}):void 0}),e]});return l.jsx(kR,{children:l.jsx(eor,{defaultProvider:u,defaultModel:d,children:l.jsx(Npr,{children:l.jsx(tor,{children:m})})})})};function C_r(){const{data:e={},isLoading:t,error:n}=Lge(),[r,a]=b.useState("");return l.jsxs(Ua,{children:[l.jsxs(Ua.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:t,children:[l.jsx(TO,{})," Processors"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Qs,{as:"a",href:"https://mastra.ai/en/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Processors documentation",children:l.jsx(Hl,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(tx,{onSearch:a,label:"Filter processors",placeholder:"Filter by name"})})]}),l.jsx(ohr,{processors:e,isLoading:t,error:n,search:r,onSearch:a})]})}function j_r(){const{processorId:e}=hs(),{data:t,isLoading:n,error:r}=Awt(e);return r&&ts(r)?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(TO,{})}),"Processors"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"processors"})})]}):!n&&t?.isWorkflow?l.jsx(bwr,{to:`/workflows/${e}/graph`,replace:!0}):n?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(TO,{})}),"Processors"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(Cr,{className:"h-6 w-32"})})]})}),l.jsxs("div",{className:"p-6",children:[l.jsx(Cr,{className:"h-8 w-48 mb-4"}),l.jsx(Cr,{className:"h-32 w-full"})]})]}):l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(TO,{})}),"Processors"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(phr,{value:e,variant:"ghost"})})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"Processors documentation"]})})]}),l.jsx(uhr,{processorId:e})]})}function T_r(){const{data:e={},isLoading:t}=ah(),{data:n={},isLoading:r,error:a}=d8(),[s,i]=b.useState(""),o=t||r;return l.jsxs(Ua,{children:[l.jsxs(Ua.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:o,children:[l.jsx(Ao,{})," Tools"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Qs,{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(Hl,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(tx,{onSearch:i,label:"Filter tools",placeholder:"Filter by name"})})]}),l.jsx(ghr,{tools:n,agents:e,isLoading:o,error:a,search:s,onSearch:i})]})}const vOt={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/${Vi()}`,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}`},N_r=()=>{const e=Fc(),t=n=>e(n,{viewTransition:!0});return l.jsx(xbt,{Link:dOt,navigate:t,paths:vOt,children:l.jsx(O_r,{children:l.jsx(Wk,{})})})},A_r=()=>{const e=Fc(),t=n=>e(n,{viewTransition:!0});return l.jsx(xbt,{Link:dOt,navigate:t,paths:vOt,children:l.jsx(k_r,{children:l.jsx(Wk,{})})})},I_r=!!window.MASTRA_CLOUD_API_ENDPOINT,x8e=fie.has("datasets"),w8e=[{index:!0,element:l.jsx(BOr,{})},{path:"instruction-blocks",element:l.jsx(UOr,{})},{path:"tools",element:l.jsx(QOr,{})},{path:"agents",element:l.jsx(LOr,{})},{path:"scorers",element:l.jsx(VOr,{})},{path:"workflows",element:l.jsx(GOr,{})},{path:"skills",element:l.jsx(HOr,{})},{path:"memory",element:l.jsx(qOr,{})},{path:"variables",element:l.jsx(WOr,{})}],R_r=[{path:"/login",element:l.jsx(hkr,{})},{path:"/signup",element:l.jsx(Vkr,{})},{element:l.jsx(A_r,{}),children:[{path:"/agents/:agentId/session",element:l.jsx(i8e,{})},{path:"/agents/:agentId/session/:threadId",element:l.jsx(i8e,{})}]},{element:l.jsx(N_r,{}),children:[...I_r?[]:[{path:"/settings",element:l.jsx(qkr,{})},{path:"/templates",element:l.jsx(r_r,{})},{path:"/templates/:templateSlug",element:l.jsx(s_r,{})}],{path:"/logs",element:l.jsx(xkr,{})},{path:"/primitives",element:l.jsx(Mkr,{})},{path:"/evaluation",element:l.jsx(pkr,{})},{path:"/evaluation/scorers/:scorerId",element:l.jsx(zkr,{})},{path:"/metrics",element:l.jsx(kkr,{})},{path:"/observability-overview",element:l.jsx(Rkr,{})},{path:"/observability",element:l.jsx(Akr,{})},{path:"/resources",element:l.jsx(Fkr,{})},{path:"/agents",element:l.jsx(AOr,{})},{path:"/cms/agents/create",element:l.jsx(FOr,{}),children:w8e},{path:"/cms/agents/:agentId/edit",element:l.jsx(zOr,{}),children:w8e},{path:"/cms/scorers/create",element:l.jsx(KOr,{})},{path:"/cms/scorers/:scorerId/edit",element:l.jsx(ekr,{})},{path:"/prompts",element:l.jsx(Dkr,{})},{path:"/cms/prompts/create",element:l.jsx(ZOr,{})},{path:"/cms/prompts/:promptBlockId/edit",element:l.jsx(XOr,{})},{path:"/agents/:agentId/tools/:toolId",element:l.jsx(i_r,{})},{path:"/agents/:agentId",element:l.jsx(E_r,{children:l.jsx(Wk,{})}),children:[{index:!0,loader:({params:e})=>QJ(`/agents/${e.agentId}/chat`)},{path:"chat",element:l.jsx(s8e,{})},{path:"chat/:threadId",element:l.jsx(s8e,{})},...x8e?[{path:"editor",element:l.jsx(MOr,{})},{path:"evaluate",element:l.jsx(POr,{})},{path:"review",element:l.jsx(DOr,{})}]:[],{path:"traces",element:l.jsx($Or,{})}]},{path:"/tools",element:l.jsx(T_r,{})},{path:"/tools/:toolId",element:l.jsx(o_r,{})},{path:"/processors",element:l.jsx(C_r,{})},{path:"/processors/:processorId",element:l.jsx(j_r,{})},{path:"/mcps",element:l.jsx(wkr,{})},{path:"/mcps/:serverId",element:l.jsx(Skr,{})},{path:"/mcps/:serverId/tools/:toolId",element:l.jsx(Okr,{})},{path:"/workspaces",element:l.jsx(y8e,{})},{path:"/workspaces/:workspaceId",element:l.jsx(y8e,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:l.jsx(d_r,{})},{path:"/workflows",element:l.jsx(l_r,{})},{path:"/workflows/:workflowId",element:l.jsx(aSr,{children:l.jsx(Wk,{})}),children:[{index:!0,loader:({params:e})=>QJ(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:l.jsx(v8e,{})},{path:"graph/:runId",element:l.jsx(v8e,{})}]},...x8e?[{path:"/evaluation/datasets/:datasetId",element:l.jsx(nkr,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId",element:l.jsx(skr,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId/versions",element:l.jsx(lkr,{})},{path:"/evaluation/datasets/:datasetId/experiments/:experimentId",element:l.jsx(rkr,{})},{path:"/evaluation/datasets/:datasetId/experiments",element:l.jsx(akr,{})},{path:"/evaluation/datasets/:datasetId/items",element:l.jsx(ikr,{})},{path:"/evaluation/datasets/:datasetId/versions",element:l.jsx(ukr,{})}]:[],{index:!0,loader:()=>QJ("/agents")},{path:"/request-context",element:l.jsx($kr,{})}]}];function P_r(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:n,apiPrefix:r,isLoading:a}=Sge();if(a)return null;if(!t)return l.jsx(Llr,{});const s=Hwr(R_r,{basename:e});return l.jsx(rzt,{baseUrl:t,headers:n,apiPrefix:r,children:l.jsx(TOr,{children:l.jsx(gwr,{router:s})})})}function M_r(){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(Bbr,{children:l.jsx(Tlr,{endpoint:i,defaultApiPrefix:r,children:l.jsx(P_r,{})})})}j_t.createRoot(document.getElementById("root")).render(l.jsx(b.StrictMode,{children:l.jsx(M_r,{})}));const HEr=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{dtt as A,rat as B,ptt as C,nrt as D,Md as E,Af as F,$_r as G,P_t as H,Fa as I,HEr as J,X0 as L,utt as N,z3 as _,cFt as a,_Ft as b,vEr as c,ZSe as d,J0 as e,wFt as f,gO as g,kFt as h,Ww as i,Gw as j,Qw as k,osn as l,crt as m,W0 as n,ps as o,San as p,wan as q,Kue as r,Qle as s,ie as t,uL as u,Xc as v,hFt as w,gt as x,nt as y,Eat 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 Gkr=()=>xt({queryKey:["mastra-templates"],queryFn:fOt}),Zkr=({repoOrSlug:e,owner:t})=>xt({queryKey:["template-repo",e,t],queryFn:()=>Qkr({repoOrSlug:e,owner:t})}),Ykr=({repo:e,owner:t,branch:n})=>xt({queryKey:["template-repo-env-vars",e,t,n],queryFn:()=>Wkr({repo:e,owner:t,branch:n})}),Xkr=()=>{const e=Ue();return xt({queryKey:["agent-builder-workflow"],queryFn:async()=>await e.getAgentBuilderAction("merge-template").details()})},Kkr=()=>{const e=Ue();return Bn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").createRun({runId:t})})},Jkr=()=>{const e=Ue();return Bn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").runById(t)})},m8e=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)},g8e=(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=m8e(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=m8e(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}},e_r=(e,t)=>{try{localStorage.setItem(`template-install-${e}`,JSON.stringify({state:t,timestamp:Date.now()}))}catch(n){console.warn("Failed to save template state to localStorage:",n)}},pOt=(e,t)=>{const[n,r]=b.useState({}),[a,s]=b.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}=g8e(p,d,e);if(d=h,r(h),p.runId||c||t){const m=p.runId||c||t;e_r(m,h)}}}catch(f){console.error("💥 [processStream] Error processing template installation stream:",f);const{newState:p}=g8e({type:"error",payload:{error:f instanceof Error?f.message:"Unknown error"}},d,e);r(p)}finally{s(!1),u.releaseLock()}}}},t_r=e=>{const t=Ue(),{streamResult:n,isStreaming:r,processStream:a}=pOt(e);return{streamInstall:Bn({mutationFn:async({inputData:i,selectedModel:o,runId:c})=>{for(let d=1;d<=3;d++)try{const f=t.getAgentBuilderAction("merge-template"),p=new XO;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}},n_r=e=>{const t=Ue(),{streamResult:n,isStreaming:r,processStream:a}=pOt(e);return{observeInstall:Bn({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 r_r(){const{data:e,isLoading:t}=Gkr(),{templates:n,tags:r,providers:a}=e??{templates:[],tags:[],providers:[]},[s,i]=b.useState("all"),[o,c]=b.useState("all"),[u,d]=b.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))),x=u||s!=="all"||o!=="all";return l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(eWe,{})}),"Templates"]})}),l.jsxs("div",{className:Y("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[l.jsx(xhr,{selectedTag:s,onTagChange:w=>h(w,"tag"),tagOptions:f,selectedProvider:o,onProviderChange:w=>h(w,"provider"),providerOptions:p,searchTerm:u,onSearchChange:m,onReset:x?g:void 0,className:"max-w-[80rem]",isLoading:t}),l.jsx(Shr,{templates:v,linkComponent:Zt,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const a_r="1.22.0";function s_r(){const{templateSlug:e}=hs(),[t,n]=Ii(),[r,a]=b.useState(""),[s,i]=b.useState(""),[o,c]=b.useState(""),[u,d]=b.useState({}),[f,p]=b.useState([]),[h,m]=b.useState(null),[g,v]=b.useState(!1),[x,w]=b.useState(""),[O,k]=b.useState(!1),[_,C]=b.useState(!1),[T,j]=b.useState([]),{data:A,isLoading:I}=Zkr({repoOrSlug:e,owner:"mastra-ai"}),P=a_r?.includes("beta")??!1?"beta":"main",{data:F,isLoading:D}=Ykr({repo:A?.githubUrl?new URL(A.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:P}),{data:U,isLoading:q}=Xkr(),{mutateAsync:z,isPending:V}=Kkr(),{mutateAsync:W}=Jkr(),{streamInstall:$,streamResult:Z,isStreaming:B}=t_r(U),{observeInstall:R,streamResult:Q,isStreaming:G}=n_r(U);b.useEffect(()=>{const ne=t.get("runId");ne&&!g&&!h&&!B&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:ne}),w(ne),W({runId:ne}).then(le=>{const be=le.snapshot;if(be?.status==="success"&&be?.result?.success)v(!0);else if(be?.result?.success===!1)if(be?.result?.validationResults&&!be?.result?.validationResults?.valid&&be?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ae,errors:ge}=be.result.validationResults,ce=`Template installation completed but ${ae} validation issue${ae>1?"s":""} remain unresolved.`;m(ce),j(ge||[])}else{const ae=be?.result?.message||be?.result?.error||"Template installation failed";m(typeof ae=="string"?ae:String(ae))}}).catch(le=>{console.error("❌ Failed to fetch run details:",le),m("Failed to retrieve installation status after reload")}))},[t,g,h,B,G,W]),b.useEffect(()=>{const ne=t.get("runId"),le=t.get("resume"),be=t.get("provider");if(ne&&le==="true"&&be&&!B&&!G&&!O&&!_&&U){w(ne),k(!0);try{W({runId:ne}).then(fe=>{if(fe.snapshot?.status==="running")return R.mutateAsync({runId:ne})}).then(()=>{n(fe=>{const ae=new URLSearchParams(fe);return ae.delete("resume"),ae})}).catch(fe=>{console.error("❌ Failed to resume template installation:",fe),fe.message?.includes("404")||fe.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(fe){console.error("❌ Auto-resume failed with error:",fe),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,B,G,O,_,U,W,R,n]);const te=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],oe=[{key:"tools",label:"Tools",value:A?.tools?.length?A.tools.map(ne=>ne).join(", "):"n/a",icon:l.jsx(Ao,{})},{key:"agents",label:"Agents",value:A?.agents?.length?A.agents.map(ne=>ne).join(", "):"n/a",icon:l.jsx(Xs,{})},{key:"workflows",label:"Workflows",value:A?.workflows?.length?A.workflows.map(ne=>ne).join(", "):"n/a",icon:l.jsx(_3t,{})},{key:"providers",label:"Providers",value:A?.supportedProviders?.length?A.supportedProviders.join(", "):"n/a",icon:l.jsx(w4t,{})},{key:"tags",label:"Tags",value:A?.tags?.length?A.tags.join(", "):"n/a",icon:l.jsx(v3t,{})}],re=[{...oe[0]},{...oe[1]},{...oe[2]}].filter(ne=>ne.value!=="n/a");b.useEffect(()=>{F&&d(F)},[F]),b.useEffect(()=>{const ne=Z||Q;ne?.phase==="error"&&ne?.error&&m(typeof ne.error=="string"?ne.error:String(ne.error))},[Z?.phase,Z?.error,Q?.phase,Q?.error]);const se=ne=>{a(ne)},ue=async ne=>(i(ne.provider),c(ne.modelId),{message:"Model updated successfully"}),me=async()=>{const ne=Object.entries(u).reduce((le,[be,fe])=>(fe===""&&le.push(be),le),[]);if(ne.length>0){p(ne);return}if(A){m(null),v(!1),w(""),C(!0);try{const be={repo:A.githubUrl||`https://github.com/mastra-ai/template-${A.slug}`,ref:P,slug:A.slug,variables:u},{runId:fe}=await z({});w(fe),n(ae=>{const ge=new URLSearchParams(ae);return ge.set("runId",fe),ge.set("resume","true"),ge.set("provider",r||"openai"),ge}),await $.mutateAsync({inputData:be,selectedModel:{provider:s,modelId:o},runId:fe})}catch(le){C(!1),m(le?.message||"Template installation failed"),console.error("Template installation failed",le)}}},J=ne=>{const{name:le,value:be}=ne.target;be.trim()===""?p(fe=>[...fe,le]):p(fe=>fe.filter(ae=>ae!==le)),d(fe=>({...fe,[le]:be}))};return l.jsxs(zn,{children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/templates",children:[l.jsx(_e,{children:l.jsx(eWe,{})}),"Templates"]}),l.jsx(_n,{as:Zt,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(Ohr,{isLoading:I,title:A?.title,description:A?.longDescription,imageURL:A?.imageURL,githubUrl:A?.githubUrl,infoData:oe,templateSlug:e}),A&&l.jsxs(l.Fragment,{children:[(B||G)&&l.jsx(Thr,{name:A.title,streamResult:G?Q:Z,runId:x,workflowInfo:U}),g&&l.jsx(Nhr,{name:A.title,installedEntities:re,linkComponent:Zt}),h&&l.jsx(Ahr,{errorMsg:h,validationErrors:T.length>0?T:Z?.validationResults?.errors||Q?.validationResults?.errors}),!B&&!G&&!g&&!h&&l.jsx(khr,{providerOptions:te,selectedProvider:r,onProviderChange:se,variables:u,setVariables:d,errors:f,setErrors:p,handleInstallTemplate:me,handleVariableChange:J,isLoadingEnvVars:D||q,isInstalling:V,defaultModelProvider:s,defaultModelId:o,onModelUpdate:ue})]})]})})]})}const i_r=()=>{const{toolId:e,agentId:t}=hs();return l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/agents",children:[l.jsx(_e,{children:l.jsx(Xs,{})}),"Agents"]}),l.jsx(_n,{as:Zt,to:`/agents/${t}/chat`,children:t}),l.jsx(_n,{as:Zt,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[l.jsx(_e,{children:l.jsx(mc,{})}),"Tools documentation"]})})]}),l.jsx(bcr,{toolId:e,agentId:t})]})},o_r=()=>{const{toolId:e}=hs();return l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/tools",children:[l.jsx(_e,{children:l.jsx(Ao,{})}),"Tools"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(bhr,{value:e,variant:"ghost"})})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"Tools documentation"]})})]}),l.jsx(yhr,{toolId:e})]})};function l_r(){const{data:e,isLoading:t,error:n}=Iv(),[r,a]=b.useState("");return l.jsxs(Ua,{children:[l.jsxs(Ua.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(Qs,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:l.jsx(Hl,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(tx,{onSearch:a,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),l.jsx(Vsr,{workflows:e||{},isLoading:t,error:n,search:r,onSearch:a})]})}const v8e=()=>{const{workflowId:e}=hs(),{data:t,isLoading:n,error:r}=jR(e);return r&&ts(r)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"workflows"})}):l.jsx(zbt,{workflowId:e,workflow:t??void 0,isLoading:n})};function y8e(){const{workspaceId:e}=hs(),[t,n]=Ii(),r=Fc(),[a,s]=b.useState(!1),[i,o]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState(null),[p,h]=b.useState(null),[m,g]=b.useState(!1),v=t.get("file"),x=t.get("tab"),{data:w,error:O,isLoading:k}=lwt(),_=w?.workspaces??[],C=e??_[0]?.id,{data:T,isLoading:j,error:A}=Hdr(C),I=ts(O)||ts(A),M=t.get("path")||".",P=Jae(O)||Jae(A),F=C?_.find(rt=>rt.id===C):void 0,D=rt=>{const Ge=new URLSearchParams(t);for(const[Ze,Je]of Object.entries(rt))Je===null?Ge.delete(Ze):Ge.set(Ze,Je);n(Ge)},U=rt=>{g(!1),s(!1),r(`/workspaces/${rt}`)},q=rt=>{D({path:rt==="."||rt===""?null:rt,file:null})},z=rt=>{D({file:rt})},V=rt=>{D({tab:rt})},W=M,$=v,{data:Z,isLoading:B,error:R,refetch:Q}=Qdr(W,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:C}),G=Gdr(),te=Zdr(),{data:oe,isLoading:re}=cwt($??"",{enabled:!!$,workspaceId:C}),{data:se,isLoading:ue,refetch:me}=Xdr({workspaceId:C}),J=afr(),ne=sfr(),le=ifr(),be=T?.isWorkspaceConfigured??!1,fe=T?.capabilities?.hasFilesystem??!1,ae=T?.capabilities?.hasSkills??!1,ge=T?.capabilities?.canBM25??!1,ce=T?.capabilities?.canVector??!1,ye=F?.safety?.readOnly??!1,K=fe&&!ye,X=T?.mounts,de=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,Ce=b.useCallback(rt=>{C&&J.mutate({...rt,workspaceId:C},{onSuccess:async Ge=>{if(Ge.success){u(!1);const{data:Ze,error:Je}=await me();if(Je||!Ze){Re.success(`Skill "${Ge.skillName}" installed successfully (${Ge.filesWritten} files)`);return}Ze.skills.some(ot=>ot.name===Ge.skillName)?Re.success(`Skill "${Ge.skillName}" installed successfully (${Ge.filesWritten} files)`):(g(!0),Re.warning(`Skill "${Ge.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else Re.error("Failed to install skill")},onError:Ge=>{Re.error(`Failed to install skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}})},[C,J,me]),pe=b.useCallback(rt=>{C&&(h(rt),ne.mutate({workspaceId:C,skillName:rt},{onSuccess:Ge=>{if(h(null),Ge.updated.length>0){const Ze=Ge.updated[0];Ze.success?(Re.success(`Skill "${rt}" updated successfully (${Ze.filesWritten} files)`),me()):Re.error(`Failed to update skill: ${Ze.error??"Unknown error"}`)}else Re.error("Failed to update skill: No update result returned")},onError:Ge=>{h(null),Re.error(`Failed to update skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}}))},[C,ne,me]),Oe=b.useCallback(rt=>{C&&(f(rt),le.mutate({workspaceId:C,skillName:rt},{onSuccess:Ge=>{f(null),Ge.success?(Re.success(`Skill "${Ge.skillName}" removed successfully`),me()):Re.error(`Failed to remove skill "${Ge.skillName}"`)},onError:Ge=>{f(null),Re.error(`Failed to remove skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}}))},[C,le,me]),Pe=x==="files"&&fe?"files":x==="skills"&&ae?"skills":fe?"files":ae?"skills":"files",et=se?.skills??[],Ot=se?.isSkillsConfigured??!1,qt=Z?.entries??[],cn=fe&&(ge||ce),gn=ae&&Ot&&et.length>0,Dt=cn||gn;return I?l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"workspaces"})})]}):P?l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"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(n$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(fp,{})}),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(rte,{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(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[l.jsx(_e,{children:l.jsx(mc,{})}),"Learn More"]})]})]})})]}):k?l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(_e,{children:l.jsx(mc,{})}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ft,{})})]}):!j&&!k&&!be?l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"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(n$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(fp,{})}),l.jsx(oxr,{})]})})]}):l.jsxs(zn,{children:[l.jsxs(ar,{children:[l.jsxs(Ui,{children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(qi,{children:[Dt&&l.jsxs(xe,{variant:"light",onClick:()=>s(!a),children:[l.jsx(_e,{children:l.jsx(h3t,{className:"h-4 w-4"})}),"Search"]}),l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(_e,{children:l.jsx(mc,{})}),"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(n$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(fp,{})}),_.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(m2,{className:"h-4 w-4 text-accent1"}):l.jsx(e7,{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(T4t,{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(m2,{className:"h-4 w-4 text-accent1 flex-shrink-0"}):l.jsx(e7,{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(m2,{className:"h-4 w-4 text-accent1"}):l.jsx(e7,{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,")"]}),ye&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),a&&Dt&&C&&l.jsx(c_r,{workspaceId:C,canSearchFiles:cn,canSearchSkills:gn,canBM25:ge,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:[fe&&l.jsxs("button",{onClick:()=>V("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Pe==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(rI,{className:"h-4 w-4"}),"Files"]}),ae&&l.jsxs("button",{onClick:()=>V("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Pe==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(P$,{className:"h-4 w-4"}),"Skills",Ot&&et.length>0&&l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:et.length})]})]}),l.jsxs("div",{className:"pb-8",children:[Pe==="files"&&fe&&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(rxr,{entries:qt,currentPath:W,isLoading:B,error:R,onNavigate:q,onFileSelect:z,onRefresh:()=>Q(),onCreateDirectory:ye?void 0:rt=>te.mutate({path:rt,workspaceId:C}),onDelete:ye?void 0:rt=>G.mutate({path:rt,recursive:!0,force:!0,workspaceId:C})}),$&&l.jsx(ixr,{path:$,content:oe?.content??"",isLoading:re,mimeType:oe?.mimeType,onClose:()=>z(null)})]})}),Pe==="skills"&&ae&&l.jsx(gxr,{skills:et,isLoading:ue,isSkillsConfigured:Ot,hasUndiscoveredAgentSkills:m,basePath:C?`/workspaces/${C}/skills`:"/workspaces",onAddSkill:K?()=>u(!0):void 0,onUpdateSkill:K?pe:void 0,onRemoveSkill:K?Oe:void 0,updatingSkillName:p??void 0,removingSkillName:d??void 0,mountPaths:Se}),!fe&&!ae&&l.jsx("div",{className:"py-12 text-center text-neutral4",children:l.jsx("p",{children:"No workspace capabilities are configured."})})]})]})}),C&&K&&l.jsx(Sxr,{open:c,onOpenChange:u,workspaceId:C,onInstall:Ce,isInstalling:J.isPending,installedSkillIds:et.filter(rt=>rt.skillsShSource).map(rt=>`${rt.skillsShSource.owner}/${rt.skillsShSource.repo}/${rt.name}`),installedSkillNames:et.filter(rt=>!rt.skillsShSource).map(rt=>rt.name),writableMounts:de,installedSkillPaths:Object.fromEntries(et.filter(rt=>rt.path).map(rt=>[rt.name,rt.path]))})]})}function c_r({workspaceId:e,canSearchFiles:t,canSearchSkills:n,canBM25:r,canVector:a,showInitWarning:s,onViewFileResult:i,onViewSkillResult:o}){const c=Ydr(),u=efr();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(rI,{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(lxr,{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(P$,{className:"h-4 w-4"}),"Search Skills"]}),l.jsx(uxr,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>o(d.skillName,d.skillPath)})]})]})}function u_r(e,t){return e==null||t==null?null:e in t?e:null}function d_r(){const{skillName:e,workspaceId:t}=hs(),[n]=Ii(),r=ns(),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=u_r(c,d),p=f?`/agents/${f}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[h,m]=b.useState(null),{data:g,isLoading:v,error:x}=Kdr(a,{workspaceId:t,path:i}),{data:w}=cwt(g?.path?`${g.path}/SKILL.md`:"",{enabled:!!g?.path,workspaceId:t}),{data:O,isLoading:k}=Jdr(a,h??"",{enabled:!!h,workspaceId:t,path:i}),_=C=>f?l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:p,children:[l.jsx(_e,{children:l.jsx(m2,{className:"h-4 w-4"})}),f]}),l.jsxs(_n,{as:"span",to:"",isCurrent:!0,children:[l.jsx(_e,{children:l.jsx(P$,{className:"h-4 w-4"})}),C]})]}):l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:p,children:[l.jsx(_e,{children:l.jsx(fp,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(_n,{as:Zt,to:p,children:[l.jsx(_e,{children:l.jsx(P$,{className:"h-4 w-4"})}),"Skills"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:C})]});return v?l.jsxs(zn,{children:[l.jsx(ar,{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"})})]}):x&&ts(x)?l.jsxs(zn,{children:[l.jsx(ar,{children:_("Permission Denied")}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"workspaces"})})]}):x||!g?l.jsxs(zn,{children:[l.jsx(ar,{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:x?.message??"Skill not found"})]})})]}):l.jsxs(zn,{children:[l.jsxs(ar,{children:[_(g.name),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[l.jsx(_e,{children:l.jsx(mc,{})}),"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(xxr,{skill:g,rawSkillMd:w?.content,onReferenceClick:m})})}),l.jsx(wxr,{open:!!h,onOpenChange:C=>!C&&m(null),skillName:g.name,referencePath:h??"",content:O?.content,isLoading:k})]})}const f_r=[{key:"primitives",title:"Primitives",href:"/primitives",links:[{name:"Agents",url:"/agents",icon:l.jsx(Xs,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"agents:read"},{name:"Prompts",url:"/prompts",icon:l.jsx(rI,{}),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(XQe,{}),isOnMastraPlatform:!1,indent:!0,requiredPermission:"processors:read"},{name:"MCP Servers",url:"/mcps",icon:l.jsx(Tu,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"mcps:read"},{name:"Tools",url:"/tools",icon:l.jsx(Ao,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"tools:read"},{name:"Workspaces",url:"/workspaces",icon:l.jsx(fp,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workspaces:read"},{name:"Request Context",url:"/request-context",icon:l.jsx(Ale,{}),isOnMastraPlatform:!0,indent:!0}]},{key:"evaluation",title:"Evaluation",href:"/evaluation",links:[{name:"Scorers",url:"/evaluation?tab=scorers",icon:l.jsx(v4t,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"scorers:read"},{name:"Datasets",url:"/evaluation?tab=datasets",icon:l.jsx(kd,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]},{name:"Experiments",url:"/evaluation?tab=experiments",icon:l.jsx(b3t,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]}]},{key:"observability",title:"Observability",href:"/observability-overview",links:[{name:"Metrics",url:"/metrics",icon:l.jsx(Nle,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Traces",url:"/observability",icon:l.jsx(JO,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Logs",url:"/logs",icon:l.jsx(JQe,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"}]},{key:"bottom",separator:!0,links:[{name:"Settings",url:"/settings",icon:l.jsx(age,{}),isOnMastraPlatform:!1},{name:"Resources",url:"/resources",icon:l.jsx(Hl,{}),isOnMastraPlatform:!0}]}],p_r={scorers:"/evaluation/scorers",datasets:"/evaluation/datasets"};function b8e(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=p_r[s];if(o&&(t===o||t.startsWith(o+"/")))return!0}return!1}return t===e.url||t.startsWith(e.url+"/")}function h_r(){const{state:e}=Yge(),t=Lc(),n=t.pathname,{isMastraPlatform:r}=bSt(),{data:a}=Y_(),{isCmsAvailable:s,isLoading:i}=Oge(),{hasPermission:o,hasAnyPermission:c,rbacEnabled:u,isAuthenticated:d,isLoading:f}=Tv(),p=a&&AR(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(up,{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(sb,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),p&&l.jsx(Pse,{})]}):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(sb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),l.jsx(Pse,{})]}):l.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[l.jsx(sb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),l.jsx(up.Nav,{children:f_r.map(g=>{const v=g.links.filter(m),x=v.length>0&&g?.separator,w=v.some(k=>b8e(k,n,t.search)),O=!!(g.href&&n===g.href&&!w);return l.jsxs(up.NavSection,{children:[g?.title?l.jsx(up.NavHeader,{state:e,href:g.href,isActive:O,children:g.title}):l.jsx(l.Fragment,{children:x&&l.jsx(up.NavSeparator,{})}),l.jsx(up.NavList,{children:v.map(k=>{const _=b8e(k,n,t.search);return l.jsx(up.NavLink,{state:e,link:k,isActive:_},k.name)})})]},g.key)})}),l.jsxs(up.Bottom,{children:[e!=="collapsed"&&l.jsxs(l.Fragment,{children:[l.jsx(up.NavSeparator,{}),l.jsx(Mlr,{collapsed:!1})]}),l.jsx(up.NavSeparator,{}),l.jsx("div",{className:"flex justify-end pb-3",children:l.jsx(up.Trigger,{})})]})]})}const m_r=b.createContext({theme:"dark",setTheme:()=>null}),g_r=e=>e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";function hOt({children:e}){const t=Ur(a=>a.theme),n=Ur(a=>a.setTheme),r=t==="light"||t==="system"?t:"dark";return b.useEffect(()=>{const a=window.document.documentElement,s=c=>{const u=g_r(c);a.classList.remove("light","dark"),a.classList.add(u)};if(s(r),r!=="system")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>s("system");return i.addEventListener("change",o),()=>{i.removeEventListener("change",o)}},[r]),l.jsx(m_r.Provider,{value:{theme:r,setTheme:n},children:e})}const mOt="experimental-ui:",gOt="current",v_r=je.createContext(null);function y_r(e,t){const n=window.localStorage.getItem(mOt+e);return n&&t.has(n)?n:gOt}function b_r({experiments:e,children:t}){const n=je.useMemo(()=>new Map(e.map(c=>[c.key,new Set(c.variants.map(u=>u.value))])),[e]),[r,a]=je.useState({});je.useLayoutEffect(()=>{const c={};for(const u of e){const d=n.get(u.key);c[u.key]=y_r(u.key,d)}a(c)},[e,n]);const s=je.useCallback(c=>r[c]??gOt,[r]),i=je.useCallback((c,u)=>{window.localStorage.setItem(mOt+c,u),a(d=>({...d,[c]:u}))},[]),o=je.useMemo(()=>({experiments:e,getVariant:s,setVariant:i}),[e,s,i]);return l.jsx(v_r.Provider,{value:o,children:t})}const x_r=[{key:"entity-list-page",name:"Entity List page UI",path:["/agents","/prompts","/tools","/datasets","/scorers","/mcps","/workflows","/processors"],variants:[{value:"current",label:"Current state"},{value:"new-proposal",label:"New proposal"}]}],w_r=()=>({experimentalUIEnabled:typeof window<"u"&&window.MASTRA_EXPERIMENTAL_UI==="true"});function S_r({children:e}){const{data:t,isFetched:n}=Y_(),r=n&&t?.enabled&&!AR(t),a=n&&!r;return l.jsxs(l.Fragment,{children:[l.jsx(Nxr,{}),l.jsxs("div",{className:a?"grid h-full grid-cols-[auto_1fr]":"h-full",children:[a&&l.jsx(h_r,{}),l.jsx("div",{className:Y("bg-transparent overflow-y-auto",{"h-[calc(100%-1.5rem)]":r}),children:l.jsx(OSt,{children:e})})]})]})}const O_r=({children:e})=>{const{experimentalUIEnabled:t}=w_r();return l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(Rst,{position:"bottom-right"}),l.jsx(hOt,{defaultTheme:"dark",attribute:"class",children:l.jsx($c,{delayDuration:0,children:l.jsx(b_r,{experiments:t?x_r:[],children:l.jsx(Mbr,{children:l.jsx(S_r,{children:e})})})})})]})},k_r=({children:e})=>l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(Rst,{position:"bottom-right"}),l.jsx(hOt,{defaultTheme:"dark",attribute:"class",children:l.jsx($c,{delayDuration:0,children:l.jsx("div",{className:"h-full overflow-y-auto",children:l.jsx(OSt,{children:e})})})})]});function __r({agentId:e}){return l.jsxs(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/agents",children:[l.jsx(_e,{children:l.jsx(Xs,{})}),"Agents"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(hcr,{value:e,variant:"ghost"})})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"Agents documentation"]})})]})}const E_r=({children:e})=>{const{agentId:t}=hs(),n=Lc(),{isCmsAvailable:r}=Oge(),{hasObservability:a}=Flr(),s=fie.has("datasets"),i=r&&s,o=a&&s,{data:c}=Ld(t),u=kc(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(__r,{agentId:t}),l.jsx(Bpr,{agentId:t,activeTab:p,showPlayground:i,showObservability:o,rightSlot:h?l.jsx(Upr,{requestContextSchema:f}):void 0}),e]});return l.jsx(kR,{children:l.jsx(eor,{defaultProvider:u,defaultModel:d,children:l.jsx(Npr,{children:l.jsx(tor,{children:m})})})})};function C_r(){const{data:e={},isLoading:t,error:n}=Lge(),[r,a]=b.useState("");return l.jsxs(Ua,{children:[l.jsxs(Ua.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:t,children:[l.jsx(TO,{})," Processors"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Qs,{as:"a",href:"https://mastra.ai/en/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Processors documentation",children:l.jsx(Hl,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(tx,{onSearch:a,label:"Filter processors",placeholder:"Filter by name"})})]}),l.jsx(ohr,{processors:e,isLoading:t,error:n,search:r,onSearch:a})]})}function j_r(){const{processorId:e}=hs(),{data:t,isLoading:n,error:r}=Awt(e);return r&&ts(r)?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(TO,{})}),"Processors"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Js,{resource:"processors"})})]}):!n&&t?.isWorkflow?l.jsx(bwr,{to:`/workflows/${e}/graph`,replace:!0}):n?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(ar,{children:l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(TO,{})}),"Processors"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(Cr,{className:"h-6 w-32"})})]})}),l.jsxs("div",{className:"p-6",children:[l.jsx(Cr,{className:"h-8 w-48 mb-4"}),l.jsx(Cr,{className:"h-32 w-full"})]})]}):l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(ar,{children:[l.jsxs(Zs,{children:[l.jsxs(_n,{as:Zt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(TO,{})}),"Processors"]}),l.jsx(_n,{as:"span",to:"",isCurrent:!0,children:l.jsx(phr,{value:e,variant:"ghost"})})]}),l.jsx(qi,{children:l.jsxs(xe,{as:Zt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[l.jsx(mc,{}),"Processors documentation"]})})]}),l.jsx(uhr,{processorId:e})]})}function T_r(){const{data:e={},isLoading:t}=ah(),{data:n={},isLoading:r,error:a}=d8(),[s,i]=b.useState(""),o=t||r;return l.jsxs(Ua,{children:[l.jsxs(Ua.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:o,children:[l.jsx(Ao,{})," Tools"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Qs,{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(Hl,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(tx,{onSearch:i,label:"Filter tools",placeholder:"Filter by name"})})]}),l.jsx(ghr,{tools:n,agents:e,isLoading:o,error:a,search:s,onSearch:i})]})}const vOt={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/${Vi()}`,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}`},N_r=()=>{const e=Fc(),t=n=>e(n,{viewTransition:!0});return l.jsx(xbt,{Link:dOt,navigate:t,paths:vOt,children:l.jsx(O_r,{children:l.jsx(Wk,{})})})},A_r=()=>{const e=Fc(),t=n=>e(n,{viewTransition:!0});return l.jsx(xbt,{Link:dOt,navigate:t,paths:vOt,children:l.jsx(k_r,{children:l.jsx(Wk,{})})})},I_r=!!window.MASTRA_CLOUD_API_ENDPOINT,x8e=fie.has("datasets"),w8e=[{index:!0,element:l.jsx(BOr,{})},{path:"instruction-blocks",element:l.jsx(UOr,{})},{path:"tools",element:l.jsx(QOr,{})},{path:"agents",element:l.jsx(LOr,{})},{path:"scorers",element:l.jsx(VOr,{})},{path:"workflows",element:l.jsx(GOr,{})},{path:"skills",element:l.jsx(HOr,{})},{path:"memory",element:l.jsx(qOr,{})},{path:"variables",element:l.jsx(WOr,{})}],R_r=[{path:"/login",element:l.jsx(hkr,{})},{path:"/signup",element:l.jsx(Vkr,{})},{element:l.jsx(A_r,{}),children:[{path:"/agents/:agentId/session",element:l.jsx(i8e,{})},{path:"/agents/:agentId/session/:threadId",element:l.jsx(i8e,{})}]},{element:l.jsx(N_r,{}),children:[...I_r?[]:[{path:"/settings",element:l.jsx(qkr,{})},{path:"/templates",element:l.jsx(r_r,{})},{path:"/templates/:templateSlug",element:l.jsx(s_r,{})}],{path:"/logs",element:l.jsx(xkr,{})},{path:"/primitives",element:l.jsx(Mkr,{})},{path:"/evaluation",element:l.jsx(pkr,{})},{path:"/evaluation/scorers/:scorerId",element:l.jsx(zkr,{})},{path:"/metrics",element:l.jsx(kkr,{})},{path:"/observability-overview",element:l.jsx(Rkr,{})},{path:"/observability",element:l.jsx(Akr,{})},{path:"/resources",element:l.jsx(Fkr,{})},{path:"/agents",element:l.jsx(AOr,{})},{path:"/cms/agents/create",element:l.jsx(FOr,{}),children:w8e},{path:"/cms/agents/:agentId/edit",element:l.jsx(zOr,{}),children:w8e},{path:"/cms/scorers/create",element:l.jsx(KOr,{})},{path:"/cms/scorers/:scorerId/edit",element:l.jsx(ekr,{})},{path:"/prompts",element:l.jsx(Dkr,{})},{path:"/cms/prompts/create",element:l.jsx(ZOr,{})},{path:"/cms/prompts/:promptBlockId/edit",element:l.jsx(XOr,{})},{path:"/agents/:agentId/tools/:toolId",element:l.jsx(i_r,{})},{path:"/agents/:agentId",element:l.jsx(E_r,{children:l.jsx(Wk,{})}),children:[{index:!0,loader:({params:e})=>QJ(`/agents/${e.agentId}/chat`)},{path:"chat",element:l.jsx(s8e,{})},{path:"chat/:threadId",element:l.jsx(s8e,{})},...x8e?[{path:"editor",element:l.jsx(MOr,{})},{path:"evaluate",element:l.jsx(POr,{})},{path:"review",element:l.jsx(DOr,{})}]:[],{path:"traces",element:l.jsx($Or,{})}]},{path:"/tools",element:l.jsx(T_r,{})},{path:"/tools/:toolId",element:l.jsx(o_r,{})},{path:"/processors",element:l.jsx(C_r,{})},{path:"/processors/:processorId",element:l.jsx(j_r,{})},{path:"/mcps",element:l.jsx(wkr,{})},{path:"/mcps/:serverId",element:l.jsx(Skr,{})},{path:"/mcps/:serverId/tools/:toolId",element:l.jsx(Okr,{})},{path:"/workspaces",element:l.jsx(y8e,{})},{path:"/workspaces/:workspaceId",element:l.jsx(y8e,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:l.jsx(d_r,{})},{path:"/workflows",element:l.jsx(l_r,{})},{path:"/workflows/:workflowId",element:l.jsx(aSr,{children:l.jsx(Wk,{})}),children:[{index:!0,loader:({params:e})=>QJ(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:l.jsx(v8e,{})},{path:"graph/:runId",element:l.jsx(v8e,{})}]},...x8e?[{path:"/evaluation/datasets/:datasetId",element:l.jsx(nkr,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId",element:l.jsx(skr,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId/versions",element:l.jsx(lkr,{})},{path:"/evaluation/datasets/:datasetId/experiments/:experimentId",element:l.jsx(rkr,{})},{path:"/evaluation/datasets/:datasetId/experiments",element:l.jsx(akr,{})},{path:"/evaluation/datasets/:datasetId/items",element:l.jsx(ikr,{})},{path:"/evaluation/datasets/:datasetId/versions",element:l.jsx(ukr,{})}]:[],{index:!0,loader:()=>QJ("/agents")},{path:"/request-context",element:l.jsx($kr,{})}]}];function P_r(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:n,apiPrefix:r,isLoading:a}=Sge();if(a)return null;if(!t)return l.jsx(Llr,{});const s=Hwr(R_r,{basename:e});return l.jsx(rzt,{baseUrl:t,headers:n,apiPrefix:r,children:l.jsx(TOr,{children:l.jsx(gwr,{router:s})})})}function M_r(){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(Bbr,{children:l.jsx(Tlr,{endpoint:i,defaultApiPrefix:r,children:l.jsx(P_r,{})})})}j_t.createRoot(document.getElementById("root")).render(l.jsx(b.StrictMode,{children:l.jsx(M_r,{})}));const HEr=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{dtt as A,rat as B,ptt as C,nrt as D,Md as E,Af as F,$_r as G,P_t as H,Fa as I,HEr as J,X0 as L,utt as N,z3 as _,cFt as a,_Ft as b,vEr as c,ZSe as d,J0 as e,wFt as f,gO as g,kFt as h,Ww as i,Gw as j,Qw as k,osn as l,crt as m,W0 as n,ps as o,San as p,wan as q,Kue as r,Qle as s,ie as t,uL as u,Xc as v,hFt as w,gt as x,nt as y,Eat as z};