@mastra/deployer-cloud 1.10.0-alpha.0 → 1.10.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-REDZDNFN-Dt0FEDAx.js → chunk-REDZDNFN-BMGt6Yui.js} +1 -1
  3. package/dist/studio/assets/{index-CiqGdrf4.js → index-6Szop4GJ.js} +1 -1
  4. package/dist/studio/assets/{index-BK7DLJSu.js → index-B0kelVGd.js} +1 -1
  5. package/dist/studio/assets/{index-1ECmJOac.js → index-B_c5ew86.js} +1 -1
  6. package/dist/studio/assets/{index-9VLjnKa_.js → index-BhQHeAxR.js} +1 -1
  7. package/dist/studio/assets/{index-BPvfk-K0.js → index-BjlNLXTP.js} +1 -1
  8. package/dist/studio/assets/{index-CA7KKtGZ.js → index-BpQxqqq3.js} +1 -1
  9. package/dist/studio/assets/{index-I48RlqJT.js → index-ByFqbMW9.js} +1 -1
  10. package/dist/studio/assets/{index-COkIXLc1.js → index-C5OUmfZG.js} +1 -1
  11. package/dist/studio/assets/{index-DL9UU43r.js → index-CJLcspbn.js} +1 -1
  12. package/dist/studio/assets/{index-CJT_T6fA.js → index-CR3mc0Yb.js} +1 -1
  13. package/dist/studio/assets/{index-C7HkpPZy.js → index-CSm5GPao.js} +1 -1
  14. package/dist/studio/assets/{index-BJT2PLox.js → index-D1NoiTsN.js} +1 -1
  15. package/dist/studio/assets/{index-kcSwhype.js → index-DBeySQZ3.js} +1 -1
  16. package/dist/studio/assets/{index-FpLTbd64.js → index-NJHb1QwK.js} +1 -1
  17. package/dist/studio/assets/{index-DP97ZQxe.js → index-OEwIQkmT.js} +1 -1
  18. package/dist/studio/assets/{index-DsmnwW4m.js → index-RlnKqJOE.js} +1 -1
  19. package/dist/studio/assets/{index-D5ljq-sC.js → index-UbraKr-V.js} +1 -1
  20. package/dist/studio/assets/{index-AXm2KELX.js → index-zsQwNiDz.js} +1 -1
  21. package/dist/studio/assets/{main-DBUlHQYG.js → main-DHJmLzGx.js} +7 -7
  22. package/dist/studio/assets/{token-6GSAFR2W-XRCSVUPZ-BwL_AVJf.js → token-6GSAFR2W-XRCSVUPZ-BX3wH20Y.js} +1 -1
  23. package/dist/studio/assets/token-util-NEHG7TUY-U7CX7GS4-BuXpmqCQ.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-NEHG7TUY-U7CX7GS4-BxugX7ph.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BK7DLJSu.js","./index-COkIXLc1.js","./index-FpLTbd64.js","./index-BPvfk-K0.js","./index-CJT_T6fA.js","./index-1ECmJOac.js","./index-DP97ZQxe.js","./index-CA7KKtGZ.js","./index-kcSwhype.js","./index-C7HkpPZy.js","./index-AXm2KELX.js","./index-9VLjnKa_.js","./index-I48RlqJT.js","./index-BJT2PLox.js","./index-D5ljq-sC.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-CiqGdrf4.js","./index-DsmnwW4m.js","./token-util-NEHG7TUY-U7CX7GS4-BxugX7ph.js","./chunk-REDZDNFN-Dt0FEDAx.js","./token-6GSAFR2W-XRCSVUPZ-BwL_AVJf.js","./index-DL9UU43r.js"])))=>i.map(i=>d[i]);
2
- import{_ as Ge}from"./index-COkIXLc1.js";function SMe(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Y$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g7={exports:{}},E_={};var vye;function jvt(){if(vye)return E_;vye=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,a){var i=null;if(a!==void 0&&(i=""+a),s.key!==void 0&&(i=""+s.key),"key"in s){a={};for(var o in s)o!=="key"&&(a[o]=s[o])}else a=s;return s=a.ref,{$$typeof:e,type:n,key:i,ref:s!==void 0?s:null,props:a}}return E_.Fragment=t,E_.jsx=r,E_.jsxs=r,E_}var xye;function Rvt(){return xye||(xye=1,g7.exports=jvt()),g7.exports}var c=Rvt(),y7={exports:{}},yn={},Sye;function Pvt(){if(Sye)return yn;Sye=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),h=Symbol.iterator;function m(U){return U===null||typeof U!="object"?null:(U=h&&U[h]||U["@@iterator"],typeof U=="function"?U:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,v={};function S(U,j,Q){this.props=U,this.context=j,this.refs=v,this.updater=Q||g}S.prototype.isReactComponent={},S.prototype.setState=function(U,j){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,j,"setState")},S.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function w(){}w.prototype=S.prototype;function k(U,j,Q){this.props=U,this.context=j,this.refs=v,this.updater=Q||g}var _=k.prototype=new w;_.constructor=k,b(_,S.prototype),_.isPureReactComponent=!0;var C=Array.isArray;function T(){}var A={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function I(U,j,Q){var Z=Q.ref;return{$$typeof:t,type:U,key:j,ref:Z!==void 0?Z:null,props:Q}}function R(U,j){return I(U.type,j,U.props)}function $(U){return typeof U=="object"&&U!==null&&U.$$typeof===t}function F(U){var j={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(Q){return j[Q]})}var L=/\/+/g;function z(U,j){return typeof U=="object"&&U!==null&&U.key!=null?F(""+U.key):j.toString(36)}function q(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(T,T):(U.status="pending",U.then(function(j){U.status==="pending"&&(U.status="fulfilled",U.value=j)},function(j){U.status==="pending"&&(U.status="rejected",U.reason=j)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function H(U,j,Q,Z,J){var ee=typeof U;(ee==="undefined"||ee==="boolean")&&(U=null);var te=!1;if(U===null)te=!0;else switch(ee){case"bigint":case"string":case"number":te=!0;break;case"object":switch(U.$$typeof){case t:case r:te=!0;break;case p:return te=U._init,H(te(U._payload),j,Q,Z,J)}}if(te)return J=J(U),te=Z===""?"."+z(U,0):Z,C(J)?(Q="",te!=null&&(Q=te.replace(L,"$&/")+"/"),H(J,j,Q,"",function(Se){return Se})):J!=null&&($(J)&&(J=R(J,Q+(J.key==null||U&&U.key===J.key?"":(""+J.key).replace(L,"$&/")+"/")+te)),j.push(J)),1;te=0;var se=Z===""?".":Z+":";if(C(U))for(var ce=0;ce<U.length;ce++)Z=U[ce],ee=se+z(Z,ce),te+=H(Z,j,Q,ee,J);else if(ce=m(U),typeof ce=="function")for(U=ce.call(U),ce=0;!(Z=U.next()).done;)Z=Z.value,ee=se+z(Z,ce++),te+=H(Z,j,Q,ee,J);else if(ee==="object"){if(typeof U.then=="function")return H(q(U),j,Q,Z,J);throw j=String(U),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.")}return te}function V(U,j,Q){if(U==null)return U;var Z=[],J=0;return H(U,Z,"","",function(ee){return j.call(Q,ee,J++)}),Z}function G(U){if(U._status===-1){var j=U._result;j=j(),j.then(function(Q){(U._status===0||U._status===-1)&&(U._status=1,U._result=Q)},function(Q){(U._status===0||U._status===-1)&&(U._status=2,U._result=Q)}),U._status===-1&&(U._status=0,U._result=j)}if(U._status===1)return U._result.default;throw U._result}var M=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var j=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(j))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",U);return}console.error(U)},X={map:V,forEach:function(U,j,Q){V(U,function(){j.apply(this,arguments)},Q)},count:function(U){var j=0;return V(U,function(){j++}),j},toArray:function(U){return V(U,function(j){return j})||[]},only:function(U){if(!$(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return yn.Activity=f,yn.Children=X,yn.Component=S,yn.Fragment=n,yn.Profiler=a,yn.PureComponent=k,yn.StrictMode=s,yn.Suspense=u,yn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,yn.__COMPILER_RUNTIME={__proto__:null,c:function(U){return A.H.useMemoCache(U)}},yn.cache=function(U){return function(){return U.apply(null,arguments)}},yn.cacheSignal=function(){return null},yn.cloneElement=function(U,j,Q){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var Z=b({},U.props),J=U.key;if(j!=null)for(ee in j.key!==void 0&&(J=""+j.key),j)!N.call(j,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&j.ref===void 0||(Z[ee]=j[ee]);var ee=arguments.length-2;if(ee===1)Z.children=Q;else if(1<ee){for(var te=Array(ee),se=0;se<ee;se++)te[se]=arguments[se+2];Z.children=te}return I(U.type,J,Z)},yn.createContext=function(U){return U={$$typeof:o,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:i,_context:U},U},yn.createElement=function(U,j,Q){var Z,J={},ee=null;if(j!=null)for(Z in j.key!==void 0&&(ee=""+j.key),j)N.call(j,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(J[Z]=j[Z]);var te=arguments.length-2;if(te===1)J.children=Q;else if(1<te){for(var se=Array(te),ce=0;ce<te;ce++)se[ce]=arguments[ce+2];J.children=se}if(U&&U.defaultProps)for(Z in te=U.defaultProps,te)J[Z]===void 0&&(J[Z]=te[Z]);return I(U,ee,J)},yn.createRef=function(){return{current:null}},yn.forwardRef=function(U){return{$$typeof:l,render:U}},yn.isValidElement=$,yn.lazy=function(U){return{$$typeof:p,_payload:{_status:-1,_result:U},_init:G}},yn.memo=function(U,j){return{$$typeof:d,type:U,compare:j===void 0?null:j}},yn.startTransition=function(U){var j=A.T,Q={};A.T=Q;try{var Z=U(),J=A.S;J!==null&&J(Q,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(T,M)}catch(ee){M(ee)}finally{j!==null&&Q.types!==null&&(j.types=Q.types),A.T=j}},yn.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},yn.use=function(U){return A.H.use(U)},yn.useActionState=function(U,j,Q){return A.H.useActionState(U,j,Q)},yn.useCallback=function(U,j){return A.H.useCallback(U,j)},yn.useContext=function(U){return A.H.useContext(U)},yn.useDebugValue=function(){},yn.useDeferredValue=function(U,j){return A.H.useDeferredValue(U,j)},yn.useEffect=function(U,j){return A.H.useEffect(U,j)},yn.useEffectEvent=function(U){return A.H.useEffectEvent(U)},yn.useId=function(){return A.H.useId()},yn.useImperativeHandle=function(U,j,Q){return A.H.useImperativeHandle(U,j,Q)},yn.useInsertionEffect=function(U,j){return A.H.useInsertionEffect(U,j)},yn.useLayoutEffect=function(U,j){return A.H.useLayoutEffect(U,j)},yn.useMemo=function(U,j){return A.H.useMemo(U,j)},yn.useOptimistic=function(U,j){return A.H.useOptimistic(U,j)},yn.useReducer=function(U,j,Q){return A.H.useReducer(U,j,Q)},yn.useRef=function(U){return A.H.useRef(U)},yn.useState=function(U){return A.H.useState(U)},yn.useSyncExternalStore=function(U,j,Q){return A.H.useSyncExternalStore(U,j,Q)},yn.useTransition=function(){return A.H.useTransition()},yn.version="19.2.3",yn}var wye;function qk(){return wye||(wye=1,y7.exports=Pvt()),y7.exports}var E=qk();const Ee=Dd(E),Hk=SMe({__proto__:null,default:Ee},[E]);var b7={exports:{}},k_={},v7={exports:{}},x7={};var Eye;function $vt(){return Eye||(Eye=1,(function(e){function t(q,H){var V=q.length;q.push(H);e:for(;0<V;){var G=V-1>>>1,M=q[G];if(0<s(M,H))q[G]=H,q[V]=M,V=G;else break e}}function r(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var H=q[0],V=q.pop();if(V!==H){q[0]=V;e:for(var G=0,M=q.length,X=M>>>1;G<X;){var U=2*(G+1)-1,j=q[U],Q=U+1,Z=q[Q];if(0>s(j,V))Q<M&&0>s(Z,j)?(q[G]=Z,q[Q]=V,G=Q):(q[G]=j,q[U]=V,G=U);else if(Q<M&&0>s(Z,V))q[G]=Z,q[Q]=V,G=Q;else break e}}return H}function s(q,H){var V=q.sortIndex-H.sortIndex;return V!==0?V:q.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var l=[],u=[],d=1,p=null,f=3,h=!1,m=!1,g=!1,b=!1,v=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function k(q){for(var H=r(u);H!==null;){if(H.callback===null)n(u);else if(H.startTime<=q)n(u),H.sortIndex=H.expirationTime,t(l,H);else break;H=r(u)}}function _(q){if(g=!1,k(q),!m)if(r(l)!==null)m=!0,C||(C=!0,$());else{var H=r(u);H!==null&&z(_,H.startTime-q)}}var C=!1,T=-1,A=5,N=-1;function I(){return b?!0:!(e.unstable_now()-N<A)}function R(){if(b=!1,C){var q=e.unstable_now();N=q;var H=!0;try{e:{m=!1,g&&(g=!1,S(T),T=-1),h=!0;var V=f;try{t:{for(k(q),p=r(l);p!==null&&!(p.expirationTime>q&&I());){var G=p.callback;if(typeof G=="function"){p.callback=null,f=p.priorityLevel;var M=G(p.expirationTime<=q);if(q=e.unstable_now(),typeof M=="function"){p.callback=M,k(q),H=!0;break t}p===r(l)&&n(l),k(q)}else n(l);p=r(l)}if(p!==null)H=!0;else{var X=r(u);X!==null&&z(_,X.startTime-q),H=!1}}break e}finally{p=null,f=V,h=!1}H=void 0}}finally{H?$():C=!1}}}var $;if(typeof w=="function")$=function(){w(R)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,L=F.port2;F.port1.onmessage=R,$=function(){L.postMessage(null)}}else $=function(){v(R,0)};function z(q,H){T=v(function(){q(e.unstable_now())},H)}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"):A=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(q){switch(f){case 1:case 2:case 3:var H=3;break;default:H=f}var V=f;f=H;try{return q()}finally{f=V}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(q,H){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var V=f;f=q;try{return H()}finally{f=V}},e.unstable_scheduleCallback=function(q,H,V){var G=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?G+V:G):V=G,q){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=V+M,q={id:d++,callback:H,priorityLevel:q,startTime:V,expirationTime:M,sortIndex:-1},V>G?(q.sortIndex=V,t(u,q),r(l)===null&&q===r(u)&&(g?(S(T),T=-1):g=!0,z(_,V-G))):(q.sortIndex=M,t(l,q),m||h||(m=!0,C||(C=!0,$()))),q},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(q){var H=f;return function(){var V=f;f=H;try{return q.apply(this,arguments)}finally{f=V}}}})(x7)),x7}var kye;function Mvt(){return kye||(kye=1,v7.exports=$vt()),v7.exports}var S7={exports:{}},Il={};var Oye;function Lvt(){if(Oye)return Il;Oye=1;var e=qk();function t(l){var u="https://react.dev/errors/"+l;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 #"+l+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(l,u,d){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:l,containerInfo:u,implementation:d}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(l,u){if(l==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return Il.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Il.createPortal=function(l,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 a(l,u,null,d)},Il.flushSync=function(l){var u=i.T,d=n.p;try{if(i.T=null,n.p=2,l)return l()}finally{i.T=u,n.p=d,n.d.f()}},Il.preconnect=function(l,u){typeof l=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,n.d.C(l,u))},Il.prefetchDNS=function(l){typeof l=="string"&&n.d.D(l)},Il.preinit=function(l,u){if(typeof l=="string"&&u&&typeof u.as=="string"){var d=u.as,p=o(d,u.crossOrigin),f=typeof u.integrity=="string"?u.integrity:void 0,h=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?n.d.S(l,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:p,integrity:f,fetchPriority:h}):d==="script"&&n.d.X(l,{crossOrigin:p,integrity:f,fetchPriority:h,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},Il.preinitModule=function(l,u){if(typeof l=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=o(u.as,u.crossOrigin);n.d.M(l,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&n.d.M(l)},Il.preload=function(l,u){if(typeof l=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,p=o(d,u.crossOrigin);n.d.L(l,d,{crossOrigin:p,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})}},Il.preloadModule=function(l,u){if(typeof l=="string")if(u){var d=o(u.as,u.crossOrigin);n.d.m(l,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else n.d.m(l)},Il.requestFormReset=function(l){n.d.r(l)},Il.unstable_batchedUpdates=function(l,u){return l(u)},Il.useFormState=function(l,u,d){return i.H.useFormState(l,u,d)},Il.useFormStatus=function(){return i.H.useHostTransitionStatus()},Il.version="19.2.3",Il}var _ye;function wMe(){if(_ye)return S7.exports;_ye=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(),S7.exports=Lvt(),S7.exports}var Cye;function Fvt(){if(Cye)return k_;Cye=1;var e={env:{}};var t=Mvt(),r=qk(),n=wMe();function s(y){var x="https://react.dev/errors/"+y;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var O=2;O<arguments.length;O++)x+="&args[]="+encodeURIComponent(arguments[O])}return"Minified React error #"+y+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(y){return!(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)}function i(y){var x=y,O=y;if(y.alternate)for(;x.return;)x=x.return;else{y=x;do x=y,(x.flags&4098)!==0&&(O=x.return),y=x.return;while(y)}return x.tag===3?O:null}function o(y){if(y.tag===13){var x=y.memoizedState;if(x===null&&(y=y.alternate,y!==null&&(x=y.memoizedState)),x!==null)return x.dehydrated}return null}function l(y){if(y.tag===31){var x=y.memoizedState;if(x===null&&(y=y.alternate,y!==null&&(x=y.memoizedState)),x!==null)return x.dehydrated}return null}function u(y){if(i(y)!==y)throw Error(s(188))}function d(y){var x=y.alternate;if(!x){if(x=i(y),x===null)throw Error(s(188));return x!==y?null:y}for(var O=y,D=x;;){var P=O.return;if(P===null)break;var B=P.alternate;if(B===null){if(D=P.return,D!==null){O=D;continue}break}if(P.child===B.child){for(B=P.child;B;){if(B===O)return u(P),y;if(B===D)return u(P),x;B=B.sibling}throw Error(s(188))}if(O.return!==D.return)O=P,D=B;else{for(var Y=!1,ie=P.child;ie;){if(ie===O){Y=!0,O=P,D=B;break}if(ie===D){Y=!0,D=P,O=B;break}ie=ie.sibling}if(!Y){for(ie=B.child;ie;){if(ie===O){Y=!0,O=B,D=P;break}if(ie===D){Y=!0,D=B,O=P;break}ie=ie.sibling}if(!Y)throw Error(s(189))}}if(O.alternate!==D)throw Error(s(190))}if(O.tag!==3)throw Error(s(188));return O.stateNode.current===O?y:x}function p(y){var x=y.tag;if(x===5||x===26||x===27||x===6)return y;for(y=y.child;y!==null;){if(x=p(y),x!==null)return x;y=y.sibling}return null}var f=Object.assign,h=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),w=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"),A=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function F(y){return y===null||typeof y!="object"?null:(y=$&&y[$]||y["@@iterator"],typeof y=="function"?y:null)}var L=Symbol.for("react.client.reference");function z(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===L?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case b:return"Fragment";case S:return"Profiler";case v: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 w:return(y._context.displayName||"Context")+".Consumer";case _:var x=y.render;return y=y.displayName,y||(y=x.displayName||x.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case A:return x=y.displayName||null,x!==null?x:z(y.type)||"Memo";case N:x=y._payload,y=y._init;try{return z(y(x))}catch{}}return null}var q=Array.isArray,H=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},M=[],X=-1;function U(y){return{current:y}}function j(y){0>X||(y.current=M[X],M[X]=null,X--)}function Q(y,x){X++,M[X]=y.current,y.current=x}var Z=U(null),J=U(null),ee=U(null),te=U(null);function se(y,x){switch(Q(ee,x),Q(J,y),Q(Z,null),x.nodeType){case 9:case 11:y=(y=x.documentElement)&&(y=y.namespaceURI)?Uge(y):0;break;default:if(y=x.tagName,x=x.namespaceURI)x=Uge(x),y=Vge(x,y);else switch(y){case"svg":y=1;break;case"math":y=2;break;default:y=0}}j(Z),Q(Z,y)}function ce(){j(Z),j(J),j(ee)}function Se(y){y.memoizedState!==null&&Q(te,y);var x=Z.current,O=Vge(x,y.type);x!==O&&(Q(J,y),Q(Z,O))}function W(y){J.current===y&&(j(Z),j(J)),te.current===y&&(j(te),v_._currentValue=G)}var ne,ae;function ge(y){if(ne===void 0)try{throw Error()}catch(O){var x=O.stack.trim().match(/\n( *(at )?)/);ne=x&&x[1]||"",ae=-1<O.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-B0kelVGd.js","./index-C5OUmfZG.js","./index-NJHb1QwK.js","./index-BjlNLXTP.js","./index-CR3mc0Yb.js","./index-B_c5ew86.js","./index-OEwIQkmT.js","./index-BpQxqqq3.js","./index-DBeySQZ3.js","./index-CSm5GPao.js","./index-zsQwNiDz.js","./index-BhQHeAxR.js","./index-ByFqbMW9.js","./index-D1NoiTsN.js","./index-UbraKr-V.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-6Szop4GJ.js","./index-RlnKqJOE.js","./token-util-NEHG7TUY-U7CX7GS4-BuXpmqCQ.js","./chunk-REDZDNFN-BMGt6Yui.js","./token-6GSAFR2W-XRCSVUPZ-BX3wH20Y.js","./index-CJLcspbn.js"])))=>i.map(i=>d[i]);
2
+ import{_ as Ge}from"./index-C5OUmfZG.js";function SMe(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Y$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g7={exports:{}},E_={};var vye;function jvt(){if(vye)return E_;vye=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,a){var i=null;if(a!==void 0&&(i=""+a),s.key!==void 0&&(i=""+s.key),"key"in s){a={};for(var o in s)o!=="key"&&(a[o]=s[o])}else a=s;return s=a.ref,{$$typeof:e,type:n,key:i,ref:s!==void 0?s:null,props:a}}return E_.Fragment=t,E_.jsx=r,E_.jsxs=r,E_}var xye;function Rvt(){return xye||(xye=1,g7.exports=jvt()),g7.exports}var c=Rvt(),y7={exports:{}},yn={},Sye;function Pvt(){if(Sye)return yn;Sye=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),h=Symbol.iterator;function m(U){return U===null||typeof U!="object"?null:(U=h&&U[h]||U["@@iterator"],typeof U=="function"?U:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,v={};function S(U,j,Q){this.props=U,this.context=j,this.refs=v,this.updater=Q||g}S.prototype.isReactComponent={},S.prototype.setState=function(U,j){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,j,"setState")},S.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function w(){}w.prototype=S.prototype;function k(U,j,Q){this.props=U,this.context=j,this.refs=v,this.updater=Q||g}var _=k.prototype=new w;_.constructor=k,b(_,S.prototype),_.isPureReactComponent=!0;var C=Array.isArray;function T(){}var A={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function I(U,j,Q){var Z=Q.ref;return{$$typeof:t,type:U,key:j,ref:Z!==void 0?Z:null,props:Q}}function R(U,j){return I(U.type,j,U.props)}function $(U){return typeof U=="object"&&U!==null&&U.$$typeof===t}function F(U){var j={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(Q){return j[Q]})}var L=/\/+/g;function z(U,j){return typeof U=="object"&&U!==null&&U.key!=null?F(""+U.key):j.toString(36)}function q(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(T,T):(U.status="pending",U.then(function(j){U.status==="pending"&&(U.status="fulfilled",U.value=j)},function(j){U.status==="pending"&&(U.status="rejected",U.reason=j)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function H(U,j,Q,Z,J){var ee=typeof U;(ee==="undefined"||ee==="boolean")&&(U=null);var te=!1;if(U===null)te=!0;else switch(ee){case"bigint":case"string":case"number":te=!0;break;case"object":switch(U.$$typeof){case t:case r:te=!0;break;case p:return te=U._init,H(te(U._payload),j,Q,Z,J)}}if(te)return J=J(U),te=Z===""?"."+z(U,0):Z,C(J)?(Q="",te!=null&&(Q=te.replace(L,"$&/")+"/"),H(J,j,Q,"",function(Se){return Se})):J!=null&&($(J)&&(J=R(J,Q+(J.key==null||U&&U.key===J.key?"":(""+J.key).replace(L,"$&/")+"/")+te)),j.push(J)),1;te=0;var se=Z===""?".":Z+":";if(C(U))for(var ce=0;ce<U.length;ce++)Z=U[ce],ee=se+z(Z,ce),te+=H(Z,j,Q,ee,J);else if(ce=m(U),typeof ce=="function")for(U=ce.call(U),ce=0;!(Z=U.next()).done;)Z=Z.value,ee=se+z(Z,ce++),te+=H(Z,j,Q,ee,J);else if(ee==="object"){if(typeof U.then=="function")return H(q(U),j,Q,Z,J);throw j=String(U),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.")}return te}function V(U,j,Q){if(U==null)return U;var Z=[],J=0;return H(U,Z,"","",function(ee){return j.call(Q,ee,J++)}),Z}function G(U){if(U._status===-1){var j=U._result;j=j(),j.then(function(Q){(U._status===0||U._status===-1)&&(U._status=1,U._result=Q)},function(Q){(U._status===0||U._status===-1)&&(U._status=2,U._result=Q)}),U._status===-1&&(U._status=0,U._result=j)}if(U._status===1)return U._result.default;throw U._result}var M=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var j=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(j))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",U);return}console.error(U)},X={map:V,forEach:function(U,j,Q){V(U,function(){j.apply(this,arguments)},Q)},count:function(U){var j=0;return V(U,function(){j++}),j},toArray:function(U){return V(U,function(j){return j})||[]},only:function(U){if(!$(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return yn.Activity=f,yn.Children=X,yn.Component=S,yn.Fragment=n,yn.Profiler=a,yn.PureComponent=k,yn.StrictMode=s,yn.Suspense=u,yn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,yn.__COMPILER_RUNTIME={__proto__:null,c:function(U){return A.H.useMemoCache(U)}},yn.cache=function(U){return function(){return U.apply(null,arguments)}},yn.cacheSignal=function(){return null},yn.cloneElement=function(U,j,Q){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var Z=b({},U.props),J=U.key;if(j!=null)for(ee in j.key!==void 0&&(J=""+j.key),j)!N.call(j,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&j.ref===void 0||(Z[ee]=j[ee]);var ee=arguments.length-2;if(ee===1)Z.children=Q;else if(1<ee){for(var te=Array(ee),se=0;se<ee;se++)te[se]=arguments[se+2];Z.children=te}return I(U.type,J,Z)},yn.createContext=function(U){return U={$$typeof:o,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:i,_context:U},U},yn.createElement=function(U,j,Q){var Z,J={},ee=null;if(j!=null)for(Z in j.key!==void 0&&(ee=""+j.key),j)N.call(j,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(J[Z]=j[Z]);var te=arguments.length-2;if(te===1)J.children=Q;else if(1<te){for(var se=Array(te),ce=0;ce<te;ce++)se[ce]=arguments[ce+2];J.children=se}if(U&&U.defaultProps)for(Z in te=U.defaultProps,te)J[Z]===void 0&&(J[Z]=te[Z]);return I(U,ee,J)},yn.createRef=function(){return{current:null}},yn.forwardRef=function(U){return{$$typeof:l,render:U}},yn.isValidElement=$,yn.lazy=function(U){return{$$typeof:p,_payload:{_status:-1,_result:U},_init:G}},yn.memo=function(U,j){return{$$typeof:d,type:U,compare:j===void 0?null:j}},yn.startTransition=function(U){var j=A.T,Q={};A.T=Q;try{var Z=U(),J=A.S;J!==null&&J(Q,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(T,M)}catch(ee){M(ee)}finally{j!==null&&Q.types!==null&&(j.types=Q.types),A.T=j}},yn.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},yn.use=function(U){return A.H.use(U)},yn.useActionState=function(U,j,Q){return A.H.useActionState(U,j,Q)},yn.useCallback=function(U,j){return A.H.useCallback(U,j)},yn.useContext=function(U){return A.H.useContext(U)},yn.useDebugValue=function(){},yn.useDeferredValue=function(U,j){return A.H.useDeferredValue(U,j)},yn.useEffect=function(U,j){return A.H.useEffect(U,j)},yn.useEffectEvent=function(U){return A.H.useEffectEvent(U)},yn.useId=function(){return A.H.useId()},yn.useImperativeHandle=function(U,j,Q){return A.H.useImperativeHandle(U,j,Q)},yn.useInsertionEffect=function(U,j){return A.H.useInsertionEffect(U,j)},yn.useLayoutEffect=function(U,j){return A.H.useLayoutEffect(U,j)},yn.useMemo=function(U,j){return A.H.useMemo(U,j)},yn.useOptimistic=function(U,j){return A.H.useOptimistic(U,j)},yn.useReducer=function(U,j,Q){return A.H.useReducer(U,j,Q)},yn.useRef=function(U){return A.H.useRef(U)},yn.useState=function(U){return A.H.useState(U)},yn.useSyncExternalStore=function(U,j,Q){return A.H.useSyncExternalStore(U,j,Q)},yn.useTransition=function(){return A.H.useTransition()},yn.version="19.2.3",yn}var wye;function qk(){return wye||(wye=1,y7.exports=Pvt()),y7.exports}var E=qk();const Ee=Dd(E),Hk=SMe({__proto__:null,default:Ee},[E]);var b7={exports:{}},k_={},v7={exports:{}},x7={};var Eye;function $vt(){return Eye||(Eye=1,(function(e){function t(q,H){var V=q.length;q.push(H);e:for(;0<V;){var G=V-1>>>1,M=q[G];if(0<s(M,H))q[G]=H,q[V]=M,V=G;else break e}}function r(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var H=q[0],V=q.pop();if(V!==H){q[0]=V;e:for(var G=0,M=q.length,X=M>>>1;G<X;){var U=2*(G+1)-1,j=q[U],Q=U+1,Z=q[Q];if(0>s(j,V))Q<M&&0>s(Z,j)?(q[G]=Z,q[Q]=V,G=Q):(q[G]=j,q[U]=V,G=U);else if(Q<M&&0>s(Z,V))q[G]=Z,q[Q]=V,G=Q;else break e}}return H}function s(q,H){var V=q.sortIndex-H.sortIndex;return V!==0?V:q.id-H.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var l=[],u=[],d=1,p=null,f=3,h=!1,m=!1,g=!1,b=!1,v=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function k(q){for(var H=r(u);H!==null;){if(H.callback===null)n(u);else if(H.startTime<=q)n(u),H.sortIndex=H.expirationTime,t(l,H);else break;H=r(u)}}function _(q){if(g=!1,k(q),!m)if(r(l)!==null)m=!0,C||(C=!0,$());else{var H=r(u);H!==null&&z(_,H.startTime-q)}}var C=!1,T=-1,A=5,N=-1;function I(){return b?!0:!(e.unstable_now()-N<A)}function R(){if(b=!1,C){var q=e.unstable_now();N=q;var H=!0;try{e:{m=!1,g&&(g=!1,S(T),T=-1),h=!0;var V=f;try{t:{for(k(q),p=r(l);p!==null&&!(p.expirationTime>q&&I());){var G=p.callback;if(typeof G=="function"){p.callback=null,f=p.priorityLevel;var M=G(p.expirationTime<=q);if(q=e.unstable_now(),typeof M=="function"){p.callback=M,k(q),H=!0;break t}p===r(l)&&n(l),k(q)}else n(l);p=r(l)}if(p!==null)H=!0;else{var X=r(u);X!==null&&z(_,X.startTime-q),H=!1}}break e}finally{p=null,f=V,h=!1}H=void 0}}finally{H?$():C=!1}}}var $;if(typeof w=="function")$=function(){w(R)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,L=F.port2;F.port1.onmessage=R,$=function(){L.postMessage(null)}}else $=function(){v(R,0)};function z(q,H){T=v(function(){q(e.unstable_now())},H)}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"):A=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(q){switch(f){case 1:case 2:case 3:var H=3;break;default:H=f}var V=f;f=H;try{return q()}finally{f=V}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(q,H){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var V=f;f=q;try{return H()}finally{f=V}},e.unstable_scheduleCallback=function(q,H,V){var G=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?G+V:G):V=G,q){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=V+M,q={id:d++,callback:H,priorityLevel:q,startTime:V,expirationTime:M,sortIndex:-1},V>G?(q.sortIndex=V,t(u,q),r(l)===null&&q===r(u)&&(g?(S(T),T=-1):g=!0,z(_,V-G))):(q.sortIndex=M,t(l,q),m||h||(m=!0,C||(C=!0,$()))),q},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(q){var H=f;return function(){var V=f;f=H;try{return q.apply(this,arguments)}finally{f=V}}}})(x7)),x7}var kye;function Mvt(){return kye||(kye=1,v7.exports=$vt()),v7.exports}var S7={exports:{}},Il={};var Oye;function Lvt(){if(Oye)return Il;Oye=1;var e=qk();function t(l){var u="https://react.dev/errors/"+l;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 #"+l+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(l,u,d){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:l,containerInfo:u,implementation:d}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(l,u){if(l==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return Il.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Il.createPortal=function(l,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 a(l,u,null,d)},Il.flushSync=function(l){var u=i.T,d=n.p;try{if(i.T=null,n.p=2,l)return l()}finally{i.T=u,n.p=d,n.d.f()}},Il.preconnect=function(l,u){typeof l=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,n.d.C(l,u))},Il.prefetchDNS=function(l){typeof l=="string"&&n.d.D(l)},Il.preinit=function(l,u){if(typeof l=="string"&&u&&typeof u.as=="string"){var d=u.as,p=o(d,u.crossOrigin),f=typeof u.integrity=="string"?u.integrity:void 0,h=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?n.d.S(l,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:p,integrity:f,fetchPriority:h}):d==="script"&&n.d.X(l,{crossOrigin:p,integrity:f,fetchPriority:h,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},Il.preinitModule=function(l,u){if(typeof l=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=o(u.as,u.crossOrigin);n.d.M(l,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&n.d.M(l)},Il.preload=function(l,u){if(typeof l=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,p=o(d,u.crossOrigin);n.d.L(l,d,{crossOrigin:p,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})}},Il.preloadModule=function(l,u){if(typeof l=="string")if(u){var d=o(u.as,u.crossOrigin);n.d.m(l,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else n.d.m(l)},Il.requestFormReset=function(l){n.d.r(l)},Il.unstable_batchedUpdates=function(l,u){return l(u)},Il.useFormState=function(l,u,d){return i.H.useFormState(l,u,d)},Il.useFormStatus=function(){return i.H.useHostTransitionStatus()},Il.version="19.2.3",Il}var _ye;function wMe(){if(_ye)return S7.exports;_ye=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(),S7.exports=Lvt(),S7.exports}var Cye;function Fvt(){if(Cye)return k_;Cye=1;var e={env:{}};var t=Mvt(),r=qk(),n=wMe();function s(y){var x="https://react.dev/errors/"+y;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var O=2;O<arguments.length;O++)x+="&args[]="+encodeURIComponent(arguments[O])}return"Minified React error #"+y+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(y){return!(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)}function i(y){var x=y,O=y;if(y.alternate)for(;x.return;)x=x.return;else{y=x;do x=y,(x.flags&4098)!==0&&(O=x.return),y=x.return;while(y)}return x.tag===3?O:null}function o(y){if(y.tag===13){var x=y.memoizedState;if(x===null&&(y=y.alternate,y!==null&&(x=y.memoizedState)),x!==null)return x.dehydrated}return null}function l(y){if(y.tag===31){var x=y.memoizedState;if(x===null&&(y=y.alternate,y!==null&&(x=y.memoizedState)),x!==null)return x.dehydrated}return null}function u(y){if(i(y)!==y)throw Error(s(188))}function d(y){var x=y.alternate;if(!x){if(x=i(y),x===null)throw Error(s(188));return x!==y?null:y}for(var O=y,D=x;;){var P=O.return;if(P===null)break;var B=P.alternate;if(B===null){if(D=P.return,D!==null){O=D;continue}break}if(P.child===B.child){for(B=P.child;B;){if(B===O)return u(P),y;if(B===D)return u(P),x;B=B.sibling}throw Error(s(188))}if(O.return!==D.return)O=P,D=B;else{for(var Y=!1,ie=P.child;ie;){if(ie===O){Y=!0,O=P,D=B;break}if(ie===D){Y=!0,D=P,O=B;break}ie=ie.sibling}if(!Y){for(ie=B.child;ie;){if(ie===O){Y=!0,O=B,D=P;break}if(ie===D){Y=!0,D=B,O=P;break}ie=ie.sibling}if(!Y)throw Error(s(189))}}if(O.alternate!==D)throw Error(s(190))}if(O.tag!==3)throw Error(s(188));return O.stateNode.current===O?y:x}function p(y){var x=y.tag;if(x===5||x===26||x===27||x===6)return y;for(y=y.child;y!==null;){if(x=p(y),x!==null)return x;y=y.sibling}return null}var f=Object.assign,h=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),w=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"),A=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function F(y){return y===null||typeof y!="object"?null:(y=$&&y[$]||y["@@iterator"],typeof y=="function"?y:null)}var L=Symbol.for("react.client.reference");function z(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===L?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case b:return"Fragment";case S:return"Profiler";case v: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 w:return(y._context.displayName||"Context")+".Consumer";case _:var x=y.render;return y=y.displayName,y||(y=x.displayName||x.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case A:return x=y.displayName||null,x!==null?x:z(y.type)||"Memo";case N:x=y._payload,y=y._init;try{return z(y(x))}catch{}}return null}var q=Array.isArray,H=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},M=[],X=-1;function U(y){return{current:y}}function j(y){0>X||(y.current=M[X],M[X]=null,X--)}function Q(y,x){X++,M[X]=y.current,y.current=x}var Z=U(null),J=U(null),ee=U(null),te=U(null);function se(y,x){switch(Q(ee,x),Q(J,y),Q(Z,null),x.nodeType){case 9:case 11:y=(y=x.documentElement)&&(y=y.namespaceURI)?Uge(y):0;break;default:if(y=x.tagName,x=x.namespaceURI)x=Uge(x),y=Vge(x,y);else switch(y){case"svg":y=1;break;case"math":y=2;break;default:y=0}}j(Z),Q(Z,y)}function ce(){j(Z),j(J),j(ee)}function Se(y){y.memoizedState!==null&&Q(te,y);var x=Z.current,O=Vge(x,y.type);x!==O&&(Q(J,y),Q(Z,O))}function W(y){J.current===y&&(j(Z),j(J)),te.current===y&&(j(te),v_._currentValue=G)}var ne,ae;function ge(y){if(ne===void 0)try{throw Error()}catch(O){var x=O.stack.trim().match(/\n( *(at )?)/);ne=x&&x[1]||"",ae=-1<O.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<O.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+ne+y+ae}var le=!1;function xe(y,x){if(!y||le)return"";le=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var D={DetermineComponentFrameRoot:function(){try{if(x){var at=function(){throw Error()};if(Object.defineProperty(at.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(at,[])}catch(Qe){var Ue=Qe}Reflect.construct(y,[],at)}else{try{at.call()}catch(Qe){Ue=Qe}y.call(at.prototype)}}else{try{throw Error()}catch(Qe){Ue=Qe}(at=y())&&typeof at.catch=="function"&&at.catch(function(){})}}catch(Qe){if(Qe&&Ue&&typeof Qe.stack=="string")return[Qe.stack,Ue.stack]}return[null,null]}};D.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var P=Object.getOwnPropertyDescriptor(D.DetermineComponentFrameRoot,"name");P&&P.configurable&&Object.defineProperty(D.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var B=D.DetermineComponentFrameRoot(),Y=B[0],ie=B[1];if(Y&&ie){var be=Y.split(`
5
5
  `),Fe=ie.split(`
@@ -157,7 +157,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
157
157
  constructor(\${params}) {
158
158
  \${}
159
159
  }
160
- }`,{label:"class",detail:"definition",type:"keyword"}),Wc('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Wc('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],aQe=qoe.concat([Wc("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Wc("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Wc("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),C_e=new lVe,iQe=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function P_(e){return(t,r)=>{let n=t.node.getChild("VariableDefinition");return n&&r(n,e),!0}}const KZt=["FunctionDeclaration"],JZt={FunctionDeclaration:P_("function"),ClassDeclaration:P_("class"),ClassExpression:()=>!0,EnumDeclaration:P_("constant"),TypeAliasDeclaration:P_("type"),NamespaceDeclaration:P_("namespace"),VariableDefinition(e,t){e.matchContext(KZt)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function oQe(e,t){let r=C_e.get(t);if(r)return r;let n=[],s=!0;function a(i,o){let l=e.sliceString(i.from,i.to);n.push({label:l,type:o})}return t.cursor(Js.IncludeAnonymous).iterate(i=>{if(s)s=!1;else if(i.name){let o=JZt[i.name];if(o&&o(i,a)||iQe.has(i.name))return!1}else if(i.to-i.from>8192){for(let o of oQe(e,i.node))n.push(o);return!1}}),C_e.set(t,n),n}const H3=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Hoe=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function lQe(e){let t=ba(e.state).resolveInner(e.pos,-1);if(Hoe.indexOf(t.name)>-1)return null;let r=t.name=="VariableName"||t.to-t.from<20&&H3.test(e.state.sliceDoc(t.from,t.to));if(!r&&!e.explicit)return null;let n=[];for(let s=t;s;s=s.parent)iQe.has(s.name)&&(n=n.concat(oQe(e.state.doc,s)));return{options:n,from:r?t.from:e.pos,validFor:H3}}function pG(e,t,r){var n;let s=[];for(;;){let a=t.firstChild,i;if(a?.name=="VariableName")return s.push(e(a)),{path:s.reverse(),name:r};if(a?.name=="MemberExpression"&&((n=i=a.lastChild)===null||n===void 0?void 0:n.name)=="PropertyName")s.push(e(i)),t=a;else return null}}function cQe(e){let t=n=>e.state.doc.sliceString(n.from,n.to),r=ba(e.state).resolveInner(e.pos,-1);return r.name=="PropertyName"?pG(t,r.parent,t(r)):(r.name=="."||r.name=="?.")&&r.parent.name=="MemberExpression"?pG(t,r.parent,""):Hoe.indexOf(r.name)>-1?null:r.name=="VariableName"||r.to-r.from<20&&H3.test(t(r))?{path:[],name:t(r)}:r.name=="MemberExpression"?pG(t,r,""):e.explicit?{path:[],name:""}:null}function eWt(e,t){let r=e,n=[],s=new Set;for(let a=0;;a++){for(let o of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(o)||s.has(o))continue;s.add(o);let l;try{l=r[o]}catch{continue}n.push({label:o,type:typeof l=="function"?/^[A-Z]/.test(o)?"class":t?"function":"method":t?"variable":"property",boost:-a})}let i=Object.getPrototypeOf(e);if(!i)return n;e=i}}function tWt(e){let t=new Map;return r=>{let n=cQe(r);if(!n)return null;let s=e;for(let i of n.path)if(s=s[i],!s)return null;let a=t.get(s);return a||t.set(s,a=eWt(s,!n.path.length)),{from:r.pos-n.name.length,options:a,validFor:H3}}}const Ep=H0.define({name:"javascript",parser:YZt.configure({props:[P1.add({IfStatement:oE({except:/^\s*({|else\b)/}),TryStatement:oE({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Yqt,SwitchBody:e=>{let t=e.textAfter,r=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return e.baseIndent+(r?0:n?1:2)*e.unit},Block:Xqt({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":oE({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}}),$1.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Eoe,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 r=e.lastChild;return{from:t.to,to:r.type.isError?e.to:r.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let r=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,n=e.lastChild;return!r||r.type.isError?null:{from:r.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),uQe={test:e=>/^JSX/.test(e.name),facet:UL({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Qoe=Ep.configure({dialect:"ts"},"typescript"),Goe=Ep.configure({dialect:"jsx",props:[xoe.add(e=>e.isTop?[uQe]:void 0)]}),Zoe=Ep.configure({dialect:"jsx ts",props:[xoe.add(e=>e.isTop?[uQe]:void 0)]},"typescript");let dQe=e=>({label:e,type:"keyword"});const pQe="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(dQe),rWt=pQe.concat(["declare","implements","private","protected","public"].map(dQe));function Q3(e={}){let t=e.jsx?e.typescript?Zoe:Goe:e.typescript?Qoe:Ep,r=e.typescript?aQe.concat(rWt):qoe.concat(pQe);return new G0(t,[Ep.data.of({autocomplete:$Ht(Hoe,oHe(r))}),Ep.data.of({autocomplete:lQe}),e.jsx?fQe:[]])}function nWt(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,r=e.length){for(let n=t?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return e.sliceString(n.from,Math.min(n.to,r));return""}const sWt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),fQe=ht.inputHandler.of((e,t,r,n,s)=>{if((sWt?e.composing:e.compositionStarted)||e.state.readOnly||t!=r||n!=">"&&n!="/"||!Ep.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,o=i.changeByRange(l=>{var u;let{head:d}=l,p=ba(i).resolveInner(d-1,-1),f;if(p.name=="JSXStartTag"&&(p=p.parent),!(i.doc.sliceString(d-1,d)!=n||p.name=="JSXAttributeValue"&&p.to>d)){if(n==">"&&p.name=="JSXFragmentTag")return{range:l,changes:{from:d,insert:"</>"}};if(n=="/"&&p.name=="JSXStartCloseTag"){let h=p.parent,m=h.parent;if(m&&h.from==d-2&&((f=T_e(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${f}>`;return{range:Je.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(n==">"){let h=nWt(p);if(h&&h.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(f=T_e(i.doc,h,d)))return{range:l,changes:{from:d,insert:`</${f}>`}}}}return{range:l}});return o.changes.empty?!1:(e.dispatch([a,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function aWt(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((r,n)=>{var s;!((s=r.meta.docs)===null||s===void 0)&&s.recommended&&(t.rules[n]=2)})),r=>{let{state:n}=r,s=[];for(let{from:a,to:i}of Ep.findRegions(n)){let o=n.doc.lineAt(a),l={line:o.number-1,col:a-o.from,pos:a};for(let u of e.verify(n.sliceDoc(a,i),t))s.push(iWt(u,n.doc,l))}return s}}function A_e(e,t,r,n){return r.line(e+n.line).from+t+(e==1?n.col-1:-1)}function iWt(e,t,r){let n=A_e(e.line,e.column,t,r),s={from:n,to:e.endLine!=null&&e.endColumn!=1?A_e(e.endLine,e.endColumn,t,r):n,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:a,text:i}=e.fix,o=a[0]+r.pos-n,l=a[1]+r.pos-n;s.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+o,to:d+l,insert:i},scrollIntoView:!0})}}]}return s}const b2=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:fQe,completionPath:cQe,esLint:aWt,javascript:Q3,javascriptLanguage:Ep,jsxLanguage:Goe,localCompletionSource:lQe,scopeCompletionSource:tWt,snippets:qoe,tsxLanguage:Zoe,typescriptLanguage:Qoe,typescriptSnippets:aQe},Symbol.toStringTag,{value:"Module"})),$_=["_blank","_self","_top","_parent"],fG=["ascii","utf-8","utf-16","latin1","latin1"],hG=["get","post","put","delete"],mG=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],qu=["true","false"],Dr={},oWt={a:{attrs:{href:null,ping:null,type:null,media:null,target:$_,hreflang:null}},abbr:Dr,address:Dr,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Dr,aside:Dr,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Dr,base:{attrs:{href:null,target:$_}},bdi:Dr,bdo:Dr,blockquote:{attrs:{cite:null}},body:Dr,br:Dr,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:mG,formmethod:hG,formnovalidate:["novalidate"],formtarget:$_,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Dr,center:Dr,cite:Dr,code:Dr,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:Dr,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Dr,div:Dr,dl:Dr,dt:Dr,em:Dr,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Dr,figure:Dr,footer:Dr,form:{attrs:{action:null,name:null,"accept-charset":fG,autocomplete:["on","off"],enctype:mG,method:hG,novalidate:["novalidate"],target:$_}},h1:Dr,h2:Dr,h3:Dr,h4:Dr,h5:Dr,h6:Dr,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Dr,hgroup:Dr,hr:Dr,html:{attrs:{manifest:null}},i:Dr,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:mG,formmethod:hG,formnovalidate:["novalidate"],formtarget:$_,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:Dr,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Dr,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:Dr,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:fG,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:Dr,noscript:Dr,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:Dr,param:{attrs:{name:null,value:null}},pre:Dr,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Dr,rt:Dr,ruby:Dr,samp:Dr,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:fG}},section:Dr,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Dr,source:{attrs:{src:null,type:null,media:null}},span:Dr,strong:Dr,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Dr,summary:Dr,sup:Dr,table:Dr,tbody:Dr,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Dr,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:Dr,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Dr,time:{attrs:{datetime:null}},title:Dr,tr:Dr,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Dr,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:Dr},hQe={accesskey:null,class:null,contenteditable:qu,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:qu,autocorrect:qu,autocapitalize:qu,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":qu,"aria-autocomplete":["inline","list","both","none"],"aria-busy":qu,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":qu,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":qu,"aria-hidden":qu,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":qu,"aria-multiselectable":qu,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":qu,"aria-relevant":null,"aria-required":qu,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},mQe="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 mQe)hQe[e]=null;let LA=class{constructor(t,r){this.tags={...oWt,...t},this.globalAttrs={...hQe,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};LA.default=new LA;function XE(e,t,r=e.length){if(!t)return"";let n=t.firstChild,s=n&&n.getChild("TagName");return s?e.sliceString(s.from,Math.min(s.to,r)):""}function YE(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function gQe(e,t,r){let n=r.tags[XE(e,YE(t))];return n?.children||r.allTags}function Woe(e,t){let r=[];for(let n=YE(t);n&&!n.type.isTop;n=YE(n.parent)){let s=XE(e,n);if(s&&n.lastChild.name=="CloseTag")break;s&&r.indexOf(s)<0&&(t.name=="EndTag"||t.from>=n.firstChild.to)&&r.push(s)}return r}const yQe=/^[:\-\.\w\u00b7-\uffff]*$/;function D_e(e,t,r,n,s){let a=/\s*>/.test(e.sliceDoc(s,s+5))?"":">",i=YE(r,r.name=="StartTag"||r.name=="TagName");return{from:n,to:s,options:gQe(e.doc,i,t).map(o=>({label:o,type:"type"})).concat(Woe(e.doc,r).map((o,l)=>({label:"/"+o,apply:"/"+o+a,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function N_e(e,t,r,n){let s=/\s*>/.test(e.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:Woe(e.doc,t).map((a,i)=>({label:a,apply:a+s,type:"type",boost:99-i})),validFor:yQe}}function lWt(e,t,r,n){let s=[],a=0;for(let i of gQe(e.doc,r,t))s.push({label:"<"+i,type:"type"});for(let i of Woe(e.doc,r))s.push({label:"</"+i+">",type:"type",boost:99-a++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function cWt(e,t,r,n,s){let a=YE(r),i=a?t.tags[XE(e.doc,a)]:null,o=i&&i.attrs?Object.keys(i.attrs):[],l=i&&i.globalAttrs===!1?o:o.length?o.concat(t.globalAttrNames):t.globalAttrNames;return{from:n,to:s,options:l.map(u=>({label:u,type:"property"})),validFor:yQe}}function uWt(e,t,r,n,s){var a;let i=(a=r.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),o=[],l;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let p=YE(r),f=p?t.tags[XE(e.doc,p)]:null;d=f?.attrs&&f.attrs[u]}if(d){let p=e.sliceDoc(n,s).toLowerCase(),f='"',h='"';/^['"]/.test(p)?(l=p[0]=='"'?/^[^"]*$/:/^[^']*$/,f="",h=e.sliceDoc(s,s+1)==p[0]?"":p[0],p=p.slice(1),n++):l=/^[^\s<>='"]*$/;for(let m of d)o.push({label:m,apply:f+m+h,type:"constant"})}}return{from:n,to:s,options:o,validFor:l}}function bQe(e,t){let{state:r,pos:n}=t,s=ba(r).resolveInner(n,-1),a=s.resolve(n);for(let i=n,o;a==s&&(o=s.childBefore(i));){let l=o.lastChild;if(!l||!l.type.isError||l.from<l.to)break;a=s=o,i=l.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?N_e(r,s,s.from,n):D_e(r,e,s,s.from,n):s.name=="StartTag"||s.name=="IncompleteTag"?D_e(r,e,s,n,n):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?N_e(r,s,n,n):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?cWt(r,e,s,s.name=="AttributeName"?s.from:n,n):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?uWt(r,e,s,s.name=="Is"?n:s.from,n):t.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?lWt(r,e,s,n):null}function vQe(e){return bQe(LA.default,e)}function xQe(e){let{extraTags:t,extraGlobalAttributes:r}=e,n=r||t?new LA(t,r):LA.default;return s=>bQe(n,s)}const dWt=Ep.parser.configure({top:"SingleExpression"}),SQe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:Qoe.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Goe.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Zoe.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:dWt},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Ep.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:MA.parser}],wQe=[{name:"style",parser:MA.parser.configure({top:"Styles"})}].concat(mQe.map(e=>({name:e,parser:Ep.parser}))),EQe=H0.define({name:"html",parser:BGt.configure({props:[P1.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,r;for(let n=e.node;;){let s=n.lastChild;if(!s||s.name!="Element"||s.to!=n.to)break;t=n=s}return t&&!((r=t.lastChild)&&(r.name=="CloseTag"||r.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),$1.add({Element(e){let t=e.firstChild,r=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:r.name=="CloseTag"?r.from:e.to}}}),eHe.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),bT=EQe.configure({wrap:WHe(SQe,wQe)});function kQe(e={}){let t="",r;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(r=WHe((e.nestedLanguages||[]).concat(SQe),(e.nestedAttributes||[]).concat(wQe)));let n=r?EQe.configure({wrap:r,dialect:t}):t?bT.configure({dialect:t}):bT;return new G0(n,[bT.data.of({autocomplete:xQe(e)}),e.autoCloseTags!==!1?OQe:[],Q3().support,nQe().support])}const I_e=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),OQe=ht.inputHandler.of((e,t,r,n,s)=>{if(e.composing||e.state.readOnly||t!=r||n!=">"&&n!="/"||!bT.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,o=i.changeByRange(l=>{var u,d,p;let f=i.doc.sliceString(l.from-1,l.to)==n,{head:h}=l,m=ba(i).resolveInner(h,-1),g;if(f&&n==">"&&m.name=="EndTag"){let b=m.parent;if(((d=(u=b.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=XE(i.doc,b.parent,h))&&!I_e.has(g)){let v=h+(i.doc.sliceString(h,h+1)===">"?1:0),S=`</${g}>`;return{range:l,changes:{from:h,to:v,insert:S}}}}else if(f&&n=="/"&&m.name=="IncompleteCloseTag"){let b=m.parent;if(m.from==h-2&&((p=b.lastChild)===null||p===void 0?void 0:p.name)!="CloseTag"&&(g=XE(i.doc,b,h))&&!I_e.has(g)){let v=h+(i.doc.sliceString(h,h+1)===">"?1:0),S=`${g}>`;return{range:Je.cursor(h+S.length,-1),changes:{from:h,to:v,insert:S}}}}return{range:l}});return o.changes.empty?!1:(e.dispatch([a,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),pWt=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:OQe,html:kQe,htmlCompletionSource:vQe,htmlCompletionSourceWith:xQe,htmlLanguage:bT},Symbol.toStringTag,{value:"Module"})),_Qe=UL({commentTokens:{block:{open:"<!--",close:"-->"}}}),CQe=new fn,TQe=UQt.configure({props:[$1.add(e=>!e.is("Block")||e.is("Document")||HJ(e)!=null||fWt(e)?void 0:(t,r)=>({from:r.doc.lineAt(t.from).to,to:t.to})),CQe.add(HJ),P1.add({Document:()=>null}),$b.add({Document:_Qe})]});function HJ(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function fWt(e){return e.name=="OrderedList"||e.name=="BulletList"}function hWt(e,t){let r=e;for(;;){let n=r.nextSibling,s;if(!n||(s=HJ(n.type))!=null&&s<=t)break;r=n}return r.to}const mWt=Uqe.of((e,t,r)=>{for(let n=ba(e).resolveInner(r,-1);n&&!(n.from<t);n=n.parent){let s=n.type.prop(CQe);if(s==null)continue;let a=hWt(n,s);if(a>r)return{from:r,to:a}}return null});function Xoe(e){return new id(_Qe,e,[],"markdown")}const AQe=Xoe(TQe),gWt=TQe.configure([JQt,tGt,eGt,rGt,{props:[$1.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),X0=Xoe(gWt);function yWt(e,t){return r=>{if(r&&e){let n=null;if(r=/\S*/.exec(r)[0],typeof e=="function"?n=e(r):n=He.matchLanguageName(e,r,!0),n instanceof He)return n.support?n.support.language.parser:Q0.getSkippingParser(n.load());if(n)return n.parser}return t?t.parser:null}}class gG{constructor(t,r,n,s,a,i,o){this.node=t,this.from=r,this.to=n,this.spaceBefore=s,this.spaceAfter=a,this.type=i,this.item=o}blank(t,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;n.length<t;)n+=" ";return n}else{for(let s=this.to-this.from-n.length-this.spaceAfter.length;s>0;s--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(t,r){let n=this.node.name=="OrderedList"?String(+NQe(this.item,t)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function DQe(e,t){let r=[],n=[];for(let s=e;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&r.push(s)}for(let s=r.length-1;s>=0;s--){let a=r[s],i,o=t.lineAt(a.from),l=a.from-o.from;if(a.name=="Blockquote"&&(i=/^ *>( ?)/.exec(o.text.slice(l))))n.push(new gG(a,l,l+i[0].length,"",i[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(o.text.slice(l)))){let u=i[3],d=i[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),n.push(new gG(a.parent,l,l+d,i[1],u,i[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(i=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(l)))){let u=i[4],d=i[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let p=i[2];i[3]&&(p+=i[3].replace(/[xX]/," ")),n.push(new gG(a.parent,l,l+d,i[1],u,p,a))}}return n}function NQe(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function yG(e,t,r,n=0){for(let s=-1,a=e;;){if(a.name=="ListItem"){let o=NQe(a,t),l=+o[2];if(s>=0){if(l!=s+1)return;r.push({from:a.from+o[1].length,to:a.from+o[0].length,insert:String(s+2+n)})}s=l}let i=a.nextSibling;if(!i)break;a=i}}function Yoe(e,t){let r=/^[ \t]*/.exec(e)[0].length;if(!r||t.facet(sO)!=" ")return e;let n=Mf(e,4,r),s="";for(let a=n;a>0;)a>=4?(s+=" ",a-=4):(s+=" ",a--);return s+e.slice(r)}const IQe=(e={})=>({state:t,dispatch:r})=>{let n=ba(t),{doc:s}=t,a=null,i=t.changeByRange(o=>{if(!o.empty||!X0.isActiveAt(t,o.from,-1)&&!X0.isActiveAt(t,o.from,1))return a={range:o};let l=o.from,u=s.lineAt(l),d=DQe(n.resolveInner(l,-1),s);for(;d.length&&d[d.length-1].from>l-u.from;)d.pop();if(!d.length)return a={range:o};let p=d[d.length-1];if(p.to-p.spaceAfter.length>l-u.from)return a={range:o};let f=l>=p.to-p.spaceAfter.length&&!/\S/.test(u.text.slice(p.to));if(p.item&&f){let v=p.node.firstChild,S=p.node.getChild("ListItem","ListItem");if(v.to>=l||S&&S.to<l||u.from>0&&!/[^\s>]/.test(s.lineAt(u.from-1).text)||e.nonTightLists===!1){let w=d.length>1?d[d.length-2]:null,k,_="";w&&w.item?(k=u.from+w.from,_=w.marker(s,1)):k=u.from+(w?w.to:0);let C=[{from:k,to:l,insert:_}];return p.node.name=="OrderedList"&&yG(p.item,s,C,-2),w&&w.node.name=="OrderedList"&&yG(w.item,s,C),{range:Je.cursor(k+_.length),changes:C}}else{let w=R_e(d,t,u);return{range:Je.cursor(l+w.length+1),changes:{from:u.from,insert:w+t.lineBreak}}}}if(p.node.name=="Blockquote"&&f&&u.from){let v=s.lineAt(u.from-1),S=/>\s*$/.exec(v.text);if(S&&S.index==p.from){let w=t.changes([{from:v.from+S.index,to:v.to},{from:u.from+p.from,to:u.to}]);return{range:o.map(w),changes:w}}}let h=[];p.node.name=="OrderedList"&&yG(p.item,s,h);let m=p.item&&p.item.from<u.from,g="";if(!m||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=p.to)for(let v=0,S=d.length-1;v<=S;v++)g+=v==S&&!m?d[v].marker(s,1):d[v].blank(v<S?Mf(u.text,4,d[v+1].from)-g.length:null);let b=l;for(;b>u.from&&/\s/.test(u.text.charAt(b-u.from-1));)b--;return g=Yoe(g,t),bWt(p.node,t.doc)&&(g=R_e(d,t,u)+t.lineBreak+g),h.push({from:b,to:l,insert:t.lineBreak+g}),{range:Je.cursor(b+g.length+1),changes:h}});return a?!1:(r(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},jQe=IQe();function j_e(e){return e.name=="QuoteMark"||e.name=="ListMark"}function bWt(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let r=e.firstChild,n=e.getChild("ListItem","ListItem");if(!n)return!1;let s=t.lineAt(r.to),a=t.lineAt(n.from),i=/^[\s>]*$/.test(s.text);return s.number+(i?0:1)<a.number}function R_e(e,t,r){let n="";for(let s=0,a=e.length-2;s<=a;s++)n+=e[s].blank(s<a?Mf(r.text,4,e[s+1].from)-n.length:null,s<a);return Yoe(n,t)}function vWt(e,t){let r=e.resolveInner(t,-1),n=t;j_e(r)&&(n=r.from,r=r.parent);for(let s;s=r.childBefore(n);)if(j_e(s))n=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")r=s.lastChild,n=r.to;else break;return r}const RQe=({state:e,dispatch:t})=>{let r=ba(e),n=null,s=e.changeByRange(a=>{let i=a.from,{doc:o}=e;if(a.empty&&X0.isActiveAt(e,a.from)){let l=o.lineAt(i),u=DQe(vWt(r,i),o);if(u.length){let d=u[u.length-1],p=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(i-l.from>p&&!/\S/.test(l.text.slice(p,i-l.from)))return{range:Je.cursor(l.from+p),changes:{from:l.from+p,to:i}};if(i-l.from==p&&(!d.item||l.from<=d.item.from||!/\S/.test(l.text.slice(0,d.to)))){let f=l.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(l.text.slice(d.from,d.to))){let h=d.blank(Mf(l.text,4,d.to)-Mf(l.text,4,d.from));return f==l.from&&(h=Yoe(h,e)),{range:Je.cursor(f+h.length),changes:{from:f,to:l.from+d.to,insert:h}}}if(f<i)return{range:Je.cursor(f),changes:{from:f,to:i}}}}}return n={range:a}});return n?!1:(t(e.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},PQe=[{key:"Enter",run:jQe},{key:"Backspace",run:RQe}],$Qe=kQe({matchClosingTags:!1});function Koe(e={}){let{codeLanguages:t,defaultCodeLanguage:r,addKeymap:n=!0,base:{parser:s}=AQe,completeHTMLTags:a=!0,pasteURLAsLink:i=!0,htmlTagLanguage:o=$Qe}=e;if(!(s instanceof GL))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=e.extensions?[e.extensions]:[],u=[o.support,mWt],d;i&&u.push(MQe),r instanceof G0?(u.push(r.support),d=r.language):r&&(d=r);let p=t||d?yWt(t,d):void 0;l.push(qQt({codeParser:p,htmlParser:o.language.parser})),n&&u.push(Wf.high(nO.of(PQe)));let f=Xoe(s.configure(l));return a&&u.push(f.data.of({autocomplete:xWt})),new G0(f,u)}function xWt(e){let{state:t,pos:r}=e,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(r-25,r));if(!n)return null;let s=ba(t).resolveInner(r,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:r-n[0].length,to:r,options:SWt(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let bG=null;function SWt(){if(bG)return bG;let e=vQe(new Toe(Zn.create({extensions:$Qe}),0,!0));return bG=e?e.options:[]}const wWt=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,MQe=ht.domEventHandlers({paste:(e,t)=>{var r;let{main:n}=t.state.selection;if(n.empty)return!1;let s=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!X0.isActiveAt(t.state,n.from,1)))return!1;let a=ba(t.state),i=!1;return a.iterate({from:n.from,to:n.to,enter:o=>{(o.from>n.from||wWt.test(o.name))&&(i=!0)},leave:o=>{o.to<n.to&&(i=!0)}}),i?!1:(t.dispatch({changes:[{from:n.from,insert:"["},{from:n.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),EWt=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:AQe,deleteMarkupBackward:RQe,insertNewlineContinueMarkup:jQe,insertNewlineContinueMarkupCommand:IQe,markdown:Koe,markdownKeymap:PQe,markdownLanguage:X0,pasteURLAsLink:MQe},Symbol.toStringTag,{value:"Module"}));function ct(e){return new G0(koe.define(e))}function rb(e){return Ge(()=>import("./index-BK7DLJSu.js"),__vite__mapDeps([0,1]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const LQe=[He.of({name:"C",extensions:["c","h","ino"],load(){return Ge(()=>import("./index-FpLTbd64.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),He.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Ge(()=>import("./index-FpLTbd64.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),He.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return rb("Cassandra")}}),He.of({name:"CSS",extensions:["css"],load(){return Ge(()=>Promise.resolve().then(()=>xZt),void 0,import.meta.url).then(e=>e.css())}}),He.of({name:"Go",extensions:["go"],load(){return Ge(()=>import("./index-BPvfk-K0.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.go())}}),He.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Ge(()=>Promise.resolve().then(()=>pWt),void 0,import.meta.url).then(e=>e.html())}}),He.of({name:"Java",extensions:["java"],load(){return Ge(()=>import("./index-CJT_T6fA.js"),__vite__mapDeps([4,1]),import.meta.url).then(e=>e.java())}}),He.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Ge(()=>Promise.resolve().then(()=>b2),void 0,import.meta.url).then(e=>e.javascript())}}),He.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return Ge(()=>import("./index-1ECmJOac.js"),__vite__mapDeps([5,1]),import.meta.url).then(e=>e.jinja())}}),He.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Ge(()=>Promise.resolve().then(()=>RHt),void 0,import.meta.url).then(e=>e.json())}}),He.of({name:"JSX",extensions:["jsx"],load(){return Ge(()=>Promise.resolve().then(()=>b2),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),He.of({name:"LESS",extensions:["less"],load(){return Ge(()=>import("./index-DP97ZQxe.js"),__vite__mapDeps([6,1]),import.meta.url).then(e=>e.less())}}),He.of({name:"Liquid",extensions:["liquid"],load(){return Ge(()=>import("./index-CA7KKtGZ.js"),__vite__mapDeps([7,1]),import.meta.url).then(e=>e.liquid())}}),He.of({name:"MariaDB SQL",load(){return rb("MariaSQL")}}),He.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Ge(()=>Promise.resolve().then(()=>EWt),void 0,import.meta.url).then(e=>e.markdown())}}),He.of({name:"MS SQL",load(){return rb("MSSQL")}}),He.of({name:"MySQL",load(){return rb("MySQL")}}),He.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Ge(()=>import("./index-kcSwhype.js"),__vite__mapDeps([8,1]),import.meta.url).then(e=>e.php())}}),He.of({name:"PLSQL",extensions:["pls"],load(){return rb("PLSQL")}}),He.of({name:"PostgreSQL",load(){return rb("PostgreSQL")}}),He.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Ge(()=>import("./index-C7HkpPZy.js"),__vite__mapDeps([9,1]),import.meta.url).then(e=>e.python())}}),He.of({name:"Rust",extensions:["rs"],load(){return Ge(()=>import("./index-AXm2KELX.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>e.rust())}}),He.of({name:"Sass",extensions:["sass"],load(){return Ge(()=>import("./index-9VLjnKa_.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass({indented:!0}))}}),He.of({name:"SCSS",extensions:["scss"],load(){return Ge(()=>import("./index-9VLjnKa_.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass())}}),He.of({name:"SQL",extensions:["sql"],load(){return rb("StandardSQL")}}),He.of({name:"SQLite",load(){return rb("SQLite")}}),He.of({name:"TSX",extensions:["tsx"],load(){return Ge(()=>Promise.resolve().then(()=>b2),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),He.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Ge(()=>Promise.resolve().then(()=>b2),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),He.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Ge(()=>import("./index-I48RlqJT.js"),__vite__mapDeps([12,1]),import.meta.url).then(e=>e.wast())}}),He.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Ge(()=>import("./index-BJT2PLox.js"),__vite__mapDeps([13,1]),import.meta.url).then(e=>e.xml())}}),He.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Ge(()=>import("./index-D5ljq-sC.js"),__vite__mapDeps([14,1]),import.meta.url).then(e=>e.yaml())}}),He.of({name:"APL",extensions:["dyalog","apl"],load(){return Ge(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>ct(e.apl))}}),He.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Ge(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>ct(e.asciiArmor))}}),He.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Ge(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>ct(e.asn1({})))}}),He.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Ge(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>ct(e.asterisk))}}),He.of({name:"Brainfuck",extensions:["b","bf"],load(){return Ge(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>ct(e.brainfuck))}}),He.of({name:"Cobol",extensions:["cob","cpy"],load(){return Ge(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>ct(e.cobol))}}),He.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.csharp))}}),He.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Ge(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>ct(e.clojure))}}),He.of({name:"ClojureScript",extensions:["cljs"],load(){return Ge(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>ct(e.clojure))}}),He.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Ge(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>ct(e.gss))}}),He.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Ge(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>ct(e.cmake))}}),He.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Ge(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>ct(e.coffeeScript))}}),He.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Ge(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>ct(e.commonLisp))}}),He.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Ge(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>ct(e.cypher))}}),He.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Ge(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>ct(e.cython))}}),He.of({name:"Crystal",extensions:["cr"],load(){return Ge(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>ct(e.crystal))}}),He.of({name:"D",extensions:["d"],load(){return Ge(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>ct(e.d))}}),He.of({name:"Dart",extensions:["dart"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.dart))}}),He.of({name:"diff",extensions:["diff","patch"],load(){return Ge(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>ct(e.diff))}}),He.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Ge(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([15,16]),import.meta.url).then(e=>ct(e.dockerFile))}}),He.of({name:"DTD",extensions:["dtd"],load(){return Ge(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>ct(e.dtd))}}),He.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Ge(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>ct(e.dylan))}}),He.of({name:"EBNF",load(){return Ge(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>ct(e.ebnf))}}),He.of({name:"ECL",extensions:["ecl"],load(){return Ge(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>ct(e.ecl))}}),He.of({name:"edn",extensions:["edn"],load(){return Ge(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>ct(e.clojure))}}),He.of({name:"Eiffel",extensions:["e"],load(){return Ge(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>ct(e.eiffel))}}),He.of({name:"Elm",extensions:["elm"],load(){return Ge(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>ct(e.elm))}}),He.of({name:"Erlang",extensions:["erl"],load(){return Ge(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>ct(e.erlang))}}),He.of({name:"Esper",load(){return Ge(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>ct(e.esper))}}),He.of({name:"Factor",extensions:["factor"],load(){return Ge(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([17,16]),import.meta.url).then(e=>ct(e.factor))}}),He.of({name:"FCL",load(){return Ge(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>ct(e.fcl))}}),He.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Ge(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>ct(e.forth))}}),He.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Ge(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>ct(e.fortran))}}),He.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Ge(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>ct(e.fSharp))}}),He.of({name:"Gas",extensions:["s"],load(){return Ge(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>ct(e.gas))}}),He.of({name:"Gherkin",extensions:["feature"],load(){return Ge(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>ct(e.gherkin))}}),He.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Ge(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>ct(e.groovy))}}),He.of({name:"Haskell",extensions:["hs"],load(){return Ge(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>ct(e.haskell))}}),He.of({name:"Haxe",extensions:["hx"],load(){return Ge(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>ct(e.haxe))}}),He.of({name:"HXML",extensions:["hxml"],load(){return Ge(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>ct(e.hxml))}}),He.of({name:"HTTP",load(){return Ge(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>ct(e.http))}}),He.of({name:"IDL",extensions:["pro"],load(){return Ge(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>ct(e.idl))}}),He.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Ge(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>ct(e.jsonld))}}),He.of({name:"Julia",extensions:["jl"],load(){return Ge(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>ct(e.julia))}}),He.of({name:"Kotlin",extensions:["kt","kts"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.kotlin))}}),He.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Ge(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>ct(e.liveScript))}}),He.of({name:"Lua",extensions:["lua"],load(){return Ge(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>ct(e.lua))}}),He.of({name:"mIRC",extensions:["mrc"],load(){return Ge(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>ct(e.mirc))}}),He.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Ge(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>ct(e.mathematica))}}),He.of({name:"Modelica",extensions:["mo"],load(){return Ge(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>ct(e.modelica))}}),He.of({name:"MUMPS",extensions:["mps"],load(){return Ge(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>ct(e.mumps))}}),He.of({name:"Mbox",extensions:["mbox"],load(){return Ge(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>ct(e.mbox))}}),He.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Ge(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>ct(e.nginx))}}),He.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Ge(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([18,16]),import.meta.url).then(e=>ct(e.nsis))}}),He.of({name:"NTriples",extensions:["nt","nq"],load(){return Ge(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>ct(e.ntriples))}}),He.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.objectiveC))}}),He.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.objectiveCpp))}}),He.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Ge(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>ct(e.oCaml))}}),He.of({name:"Octave",extensions:["m"],load(){return Ge(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>ct(e.octave))}}),He.of({name:"Oz",extensions:["oz"],load(){return Ge(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>ct(e.oz))}}),He.of({name:"Pascal",extensions:["p","pas"],load(){return Ge(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>ct(e.pascal))}}),He.of({name:"Perl",extensions:["pl","pm"],load(){return Ge(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>ct(e.perl))}}),He.of({name:"Pig",extensions:["pig"],load(){return Ge(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>ct(e.pig))}}),He.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Ge(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>ct(e.powerShell))}}),He.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Ge(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>ct(e.properties))}}),He.of({name:"ProtoBuf",extensions:["proto"],load(){return Ge(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>ct(e.protobuf))}}),He.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Ge(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([19,20]),import.meta.url).then(e=>ct(e.pug))}}),He.of({name:"Puppet",extensions:["pp"],load(){return Ge(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>ct(e.puppet))}}),He.of({name:"Q",extensions:["q"],load(){return Ge(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>ct(e.q))}}),He.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Ge(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>ct(e.r))}}),He.of({name:"RPM Changes",load(){return Ge(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>ct(e.rpmChanges))}}),He.of({name:"RPM Spec",extensions:["spec"],load(){return Ge(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>ct(e.rpmSpec))}}),He.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Ge(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>ct(e.ruby))}}),He.of({name:"SAS",extensions:["sas"],load(){return Ge(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>ct(e.sas))}}),He.of({name:"Scala",extensions:["scala"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.scala))}}),He.of({name:"Scheme",extensions:["scm","ss"],load(){return Ge(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>ct(e.scheme))}}),He.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Ge(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>ct(e.shell))}}),He.of({name:"Sieve",extensions:["siv","sieve"],load(){return Ge(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>ct(e.sieve))}}),He.of({name:"Smalltalk",extensions:["st"],load(){return Ge(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>ct(e.smalltalk))}}),He.of({name:"Solr",load(){return Ge(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>ct(e.solr))}}),He.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Ge(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>ct(e.sml))}}),He.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Ge(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>ct(e.sparql))}}),He.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Ge(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>ct(e.spreadsheet))}}),He.of({name:"Squirrel",extensions:["nut"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.squirrel))}}),He.of({name:"Stylus",extensions:["styl"],load(){return Ge(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>ct(e.stylus))}}),He.of({name:"Swift",extensions:["swift"],load(){return Ge(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>ct(e.swift))}}),He.of({name:"sTeX",load(){return Ge(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>ct(e.stex))}}),He.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Ge(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>ct(e.stex))}}),He.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Ge(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>ct(e.verilog))}}),He.of({name:"Tcl",extensions:["tcl"],load(){return Ge(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>ct(e.tcl))}}),He.of({name:"Textile",extensions:["textile"],load(){return Ge(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>ct(e.textile))}}),He.of({name:"TiddlyWiki",load(){return Ge(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>ct(e.tiddlyWiki))}}),He.of({name:"Tiki wiki",load(){return Ge(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>ct(e.tiki))}}),He.of({name:"TOML",extensions:["toml"],load(){return Ge(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>ct(e.toml))}}),He.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Ge(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>ct(e.troff))}}),He.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Ge(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>ct(e.ttcn))}}),He.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Ge(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>ct(e.ttcnCfg))}}),He.of({name:"Turtle",extensions:["ttl"],load(){return Ge(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>ct(e.turtle))}}),He.of({name:"Web IDL",extensions:["webidl"],load(){return Ge(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>ct(e.webIDL))}}),He.of({name:"VB.NET",extensions:["vb"],load(){return Ge(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>ct(e.vb))}}),He.of({name:"VBScript",extensions:["vbs"],load(){return Ge(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>ct(e.vbScript))}}),He.of({name:"Velocity",extensions:["vtl"],load(){return Ge(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>ct(e.velocity))}}),He.of({name:"Verilog",extensions:["v"],load(){return Ge(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>ct(e.verilog))}}),He.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Ge(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>ct(e.vhdl))}}),He.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return Ge(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>ct(e.xQuery))}}),He.of({name:"Yacas",extensions:["ys"],load(){return Ge(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>ct(e.yacas))}}),He.of({name:"Z80",extensions:["z80"],load(){return Ge(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>ct(e.z80))}}),He.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Ge(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>ct(e.mscgen))}}),He.of({name:"Xù",extensions:["xu"],load(){return Ge(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>ct(e.xu))}}),He.of({name:"MsGenny",extensions:["msgenny"],load(){return Ge(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>ct(e.msgenny))}}),He.of({name:"Vue",extensions:["vue"],load(){return Ge(()=>import("./index-CiqGdrf4.js"),__vite__mapDeps([21,1]),import.meta.url).then(e=>e.vue())}}),He.of({name:"Angular Template",load(){return Ge(()=>import("./index-DsmnwW4m.js"),__vite__mapDeps([22,1]),import.meta.url).then(e=>e.angular())}})];var kWt=e=>{var{theme:t,settings:r={},styles:n=[]}=e,s={".cm-gutters":{}},a={};r.background&&(a.backgroundColor=r.background),r.backgroundImage&&(a.backgroundImage=r.backgroundImage),r.foreground&&(a.color=r.foreground),r.fontSize&&(a.fontSize=r.fontSize),(r.background||r.foreground)&&(s["&"]=a),r.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(s[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(s[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(s[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(s[".cm-content"]={caretColor:r.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var i={};r.gutterActiveForeground&&(i.color=r.gutterActiveForeground),r.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:r.lineHighlight},i.backgroundColor=r.lineHighlight),s[".cm-activeLineGutter"]=i,r.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var o=ht.theme(s,{dark:t==="dark"}),l=M1.define(n),u=[o,HL(l)];return u},OWt={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)"},_Wt=[{tag:re.comment,color:"#6272a4"},{tag:re.string,color:"#f1fa8c"},{tag:re.atom,color:"#bd93f9"},{tag:re.meta,color:"#f8f8f2"},{tag:[re.keyword,re.operator,re.tagName],color:"#ff79c6"},{tag:[re.function(re.propertyName),re.propertyName],color:"#66d9ef"},{tag:[re.definition(re.variableName),re.function(re.variableName),re.className,re.attributeName],color:"#50fa7b"},{tag:re.atom,color:"#bd93f9"}],ZL=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return kWt({theme:t,settings:lm({},OWt,r),styles:[..._Wt,...n]})};ZL();const CWt=e=>{let{state:t}=e,r=t.doc.lineAt(t.selection.main.from),n=ele(e.state,r.from);return n.line?TWt(e):n.block?DWt(e):!1};function Joe(e,t){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let s=e(t,r);return s?(n(r.update(s)),!0):!1}}const TWt=Joe(jWt,0),AWt=Joe(FQe,0),DWt=Joe((e,t)=>FQe(e,t,IWt(t)),0);function ele(e,t){let r=e.languageDataAt("commentTokens",t,1);return r.length?r[0]:{}}const M_=50;function NWt(e,{open:t,close:r},n,s){let a=e.sliceDoc(n-M_,n),i=e.sliceDoc(s,s+M_),o=/\s*$/.exec(a)[0].length,l=/^\s*/.exec(i)[0].length,u=a.length-o;if(a.slice(u-t.length,u)==t&&i.slice(l,l+r.length)==r)return{open:{pos:n-o,margin:o&&1},close:{pos:s+l,margin:l&&1}};let d,p;s-n<=2*M_?d=p=e.sliceDoc(n,s):(d=e.sliceDoc(n,n+M_),p=e.sliceDoc(s-M_,s));let f=/^\s*/.exec(d)[0].length,h=/\s*$/.exec(p)[0].length,m=p.length-h-r.length;return d.slice(f,f+t.length)==t&&p.slice(m,m+r.length)==r?{open:{pos:n+f+t.length,margin:/\s/.test(d.charAt(f+t.length))?1:0},close:{pos:s-h-r.length,margin:/\s/.test(p.charAt(m-1))?1:0}}:null}function IWt(e){let t=[];for(let r of e.selection.ranges){let n=e.doc.lineAt(r.from),s=r.to<=n.to?n:e.doc.lineAt(r.to);s.from>n.from&&s.from==r.to&&(s=r.to==n.to+1?n:e.doc.lineAt(r.to-1));let a=t.length-1;a>=0&&t[a].to>n.from?t[a].to=s.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return t}function FQe(e,t,r=t.selection.ranges){let n=r.map(a=>ele(t,a.from).block);if(!n.every(a=>a))return null;let s=r.map((a,i)=>NWt(t,n[i],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:t.changes(r.map((a,i)=>s[i]?[]:[{from:a.from,insert:n[i].open+" "},{from:a.to,insert:" "+n[i].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let i=0,o;i<s.length;i++)if(o=s[i]){let l=n[i],{open:u,close:d}=o;a.push({from:u.pos-l.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:a}}return null}function jWt(e,t,r=t.selection.ranges){let n=[],s=-1;for(let{from:a,to:i}of r){let o=n.length,l=1e9,u=ele(t,a).line;if(u){for(let d=a;d<=i;){let p=t.doc.lineAt(d);if(p.from>s&&(a==i||i>p.from)){s=p.from;let f=/^\s*/.exec(p.text)[0].length,h=f==p.length,m=p.text.slice(f,f+u.length)==u?f:-1;f<p.text.length&&f<l&&(l=f),n.push({line:p,comment:m,token:u,indent:f,empty:h,single:!1})}d=p.to+1}if(l<1e9)for(let d=o;d<n.length;d++)n[d].indent<n[d].line.text.length&&(n[d].indent=l);n.length==o+1&&(n[o].single=!0)}}if(e!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:o,token:l,indent:u,empty:d,single:p}of n)(p||!d)&&a.push({from:o.from+u,insert:l+" "});let i=t.changes(a);return{changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:i,comment:o,token:l}of n)if(o>=0){let u=i.from+o,d=u+l.length;i.text[d-i.from]==" "&&d++,a.push({from:u,to:d})}return{changes:a}}return null}const QJ=Tm.define(),RWt=Tm.define(),PWt=Xt.define(),BQe=Xt.define({combine(e){return Am(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,r)=>(n,s)=>t(n,s)||r(n,s)})}}),zQe=Ji.define({create(){return zh.empty},update(e,t){let r=t.state.facet(BQe),n=t.annotation(QJ);if(n){let l=uu.fromTransaction(t,n.selection),u=n.side,d=u==0?e.undone:e.done;return l?d=G3(d,d.length,r.minDepth,l):d=qQe(d,t.startState.selection),new zh(u==0?n.rest:d,u==0?d:n.rest)}let s=t.annotation(RWt);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(po.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=uu.fromTransaction(t),i=t.annotation(po.time),o=t.annotation(po.userEvent);return a?e=e.addChanges(a,i,o,r,t):t.selection&&(e=e.addSelection(t.startState.selection,i,o,r.newGroupDelay)),(s=="full"||s=="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 zh(e.done.map(uu.fromJSON),e.undone.map(uu.fromJSON))}});function $Wt(e={}){return[zQe,BQe.of(e),ht.domEventHandlers({beforeinput(t,r){let n=t.inputType=="historyUndo"?UQe:t.inputType=="historyRedo"?GJ:null;return n?(t.preventDefault(),n(r)):!1}})]}function WL(e,t){return function({state:r,dispatch:n}){if(!t&&r.readOnly)return!1;let s=r.field(zQe,!1);if(!s)return!1;let a=s.pop(e,r,t);return a?(n(a),!0):!1}}const UQe=WL(0,!1),GJ=WL(1,!1),MWt=WL(0,!0),LWt=WL(1,!0);class uu{constructor(t,r,n,s,a){this.changes=t,this.effects=r,this.mapped=n,this.startSelection=s,this.selectionsAfter=a}setSelAfter(t){return new uu(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,r,n;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new uu(t.changes&&io.fromJSON(t.changes),[],t.mapped&&Yh.fromJSON(t.mapped),t.startSelection&&Je.fromJSON(t.startSelection),t.selectionsAfter.map(Je.fromJSON))}static fromTransaction(t,r){let n=yp;for(let s of t.startState.facet(PWt)){let a=s(t);a.length&&(n=n.concat(a))}return!n.length&&t.changes.empty?null:new uu(t.changes.invert(t.startState.doc),n,void 0,r||t.startState.selection,yp)}static selection(t){return new uu(void 0,yp,void 0,void 0,t)}}function G3(e,t,r,n){let s=t+1>r+20?t-r-1:0,a=e.slice(s,t);return a.push(n),a}function FWt(e,t){let r=[],n=!1;return e.iterChangedRanges((s,a)=>r.push(s,a)),t.iterChangedRanges((s,a,i,o)=>{for(let l=0;l<r.length;){let u=r[l++],d=r[l++];o>=u&&i<=d&&(n=!0)}}),n}function BWt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((r,n)=>r.empty!=t.ranges[n].empty).length===0}function VQe(e,t){return e.length?t.length?e.concat(t):e:t}const yp=[],zWt=200;function qQe(e,t){if(e.length){let r=e[e.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-zWt));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),G3(e,e.length-1,1e9,r.setSelAfter(n)))}else return[uu.selection([t])]}function UWt(e){let t=e[e.length-1],r=e.slice();return r[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),r}function vG(e,t){if(!e.length)return e;let r=e.length,n=yp;for(;r;){let s=VWt(e[r-1],t,n);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,r);return a[r-1]=s,a}else t=s.mapped,r--,n=s.selectionsAfter}return n.length?[uu.selection(n)]:yp}function VWt(e,t,r){let n=VQe(e.selectionsAfter.length?e.selectionsAfter.map(o=>o.map(t)):yp,r);if(!e.changes)return uu.selection(n);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(a):a;return new uu(s,en.mapEffects(e.effects,t),i,e.startSelection.map(a),n)}const qWt=/^(input\.type|delete)($|\.)/;class zh{constructor(t,r,n=0,s=void 0){this.done=t,this.undone=r,this.prevTime=n,this.prevUserEvent=s}isolate(){return this.prevTime?new zh(this.done,this.undone):this}addChanges(t,r,n,s,a){let i=this.done,o=i[i.length-1];return o&&o.changes&&!o.changes.empty&&t.changes&&(!n||qWt.test(n))&&(!o.selectionsAfter.length&&r-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,FWt(o.changes,t.changes))||n=="input.type.compose")?i=G3(i,i.length-1,s.minDepth,new uu(t.changes.compose(o.changes),VQe(en.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,yp)):i=G3(i,i.length,s.minDepth,t),new zh(i,yp,r,n)}addSelection(t,r,n,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:yp;return a.length>0&&r-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&BWt(a[a.length-1],t)?this:new zh(qQe(this.done,t),this.undone,r,n)}addMapping(t){return new zh(vG(this.done,t),vG(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,r,n){let s=t==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],i=a.selectionsAfter[0]||r.selection;if(n&&a.selectionsAfter.length)return r.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:QJ.of({side:t,rest:UWt(s),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let o=s.length==1?yp:s.slice(0,s.length-1);return a.mapped&&(o=vG(o,a.mapped)),r.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:QJ.of({side:t,rest:o,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}zh.empty=new zh(yp,yp);const HWt=[{key:"Mod-z",run:UQe,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:GJ,preventDefault:!0},{linux:"Ctrl-Shift-z",run:GJ,preventDefault:!0},{key:"Mod-u",run:MWt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:LWt,preventDefault:!0}];function iO(e,t){return Je.create(e.ranges.map(t),e.mainIndex)}function Xf(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Yf({state:e,dispatch:t},r){let n=iO(e.selection,r);return n.eq(e.selection,!0)?!1:(t(Xf(e,n)),!0)}function XL(e,t){return Je.cursor(t?e.to:e.from)}function HQe(e,t){return Yf(e,r=>r.empty?e.moveByChar(r,t):XL(r,t))}function rc(e){return e.textDirectionAt(e.state.selection.main.head)==Oa.LTR}const QQe=e=>HQe(e,!rc(e)),GQe=e=>HQe(e,rc(e));function ZQe(e,t){return Yf(e,r=>r.empty?e.moveByGroup(r,t):XL(r,t))}const QWt=e=>ZQe(e,!rc(e)),GWt=e=>ZQe(e,rc(e));function ZWt(e,t,r){if(t.type.prop(r))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function YL(e,t,r){let n=ba(e).resolveInner(t.head),s=r?fn.closedBy:fn.openedBy;for(let l=t.head;;){let u=r?n.childAfter(l):n.childBefore(l);if(!u)break;ZWt(e,u,s)?n=u:l=r?u.to:u.from}let a=n.type.prop(s),i,o;return a&&(i=r?Bh(e,n.from,1):Bh(e,n.to,-1))&&i.matched?o=r?i.end.to:i.end.from:o=r?n.to:n.from,Je.cursor(o,r?-1:1)}const WWt=e=>Yf(e,t=>YL(e.state,t,!rc(e))),XWt=e=>Yf(e,t=>YL(e.state,t,rc(e)));function WQe(e,t){return Yf(e,r=>{if(!r.empty)return XL(r,t);let n=e.moveVertically(r,t);return n.head!=r.head?n:e.moveToLineBoundary(r,t)})}const XQe=e=>WQe(e,!1),YQe=e=>WQe(e,!0);function KQe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,n=0,s;if(t){for(let a of e.state.facet(ht.scrollMargins)){let i=a(e);i?.top&&(r=Math.max(i?.top,r)),i?.bottom&&(n=Math.max(i?.bottom,n))}s=e.scrollDOM.clientHeight-r-n}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function JQe(e,t){let r=KQe(e),{state:n}=e,s=iO(n.selection,i=>i.empty?e.moveVertically(i,t,r.height):XL(i,t));if(s.eq(n.selection))return!1;let a;if(r.selfScroll){let i=e.coordsAtPos(n.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),l=o.top+r.marginTop,u=o.bottom-r.marginBottom;i&&i.top>l&&i.bottom<u&&(a=ht.scrollIntoView(s.main.head,{y:"start",yMargin:i.top-l}))}return e.dispatch(Xf(n,s),{effects:a}),!0}const P_e=e=>JQe(e,!1),ZJ=e=>JQe(e,!0);function zv(e,t,r){let n=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,r);if(s.head==t.head&&s.head!=(r?n.to:n.from)&&(s=e.moveToLineBoundary(t,r,!1)),!r&&s.head==n.from&&n.length){let a=/^\s*/.exec(e.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&t.head!=n.from+a&&(s=Je.cursor(n.from+a))}return s}const YWt=e=>Yf(e,t=>zv(e,t,!0)),KWt=e=>Yf(e,t=>zv(e,t,!1)),JWt=e=>Yf(e,t=>zv(e,t,!rc(e))),eXt=e=>Yf(e,t=>zv(e,t,rc(e))),tXt=e=>Yf(e,t=>Je.cursor(e.lineBlockAt(t.head).from,1)),rXt=e=>Yf(e,t=>Je.cursor(e.lineBlockAt(t.head).to,-1));function nXt(e,t,r){let n=!1,s=iO(e.selection,a=>{let i=Bh(e,a.head,-1)||Bh(e,a.head,1)||a.head>0&&Bh(e,a.head-1,1)||a.head<e.doc.length&&Bh(e,a.head+1,-1);if(!i||!i.end)return a;n=!0;let o=i.start.from==a.head?i.end.to:i.end.from;return Je.cursor(o)});return n?(t(Xf(e,s)),!0):!1}const sXt=({state:e,dispatch:t})=>nXt(e,t);function Vp(e,t){let r=iO(e.state.selection,n=>{let s=t(n);return Je.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return r.eq(e.state.selection)?!1:(e.dispatch(Xf(e.state,r)),!0)}function eGe(e,t){return Vp(e,r=>e.moveByChar(r,t))}const tGe=e=>eGe(e,!rc(e)),rGe=e=>eGe(e,rc(e));function nGe(e,t){return Vp(e,r=>e.moveByGroup(r,t))}const aXt=e=>nGe(e,!rc(e)),iXt=e=>nGe(e,rc(e)),oXt=e=>Vp(e,t=>YL(e.state,t,!rc(e))),lXt=e=>Vp(e,t=>YL(e.state,t,rc(e)));function sGe(e,t){return Vp(e,r=>e.moveVertically(r,t))}const aGe=e=>sGe(e,!1),iGe=e=>sGe(e,!0);function oGe(e,t){return Vp(e,r=>e.moveVertically(r,t,KQe(e).height))}const $_e=e=>oGe(e,!1),M_e=e=>oGe(e,!0),cXt=e=>Vp(e,t=>zv(e,t,!0)),uXt=e=>Vp(e,t=>zv(e,t,!1)),dXt=e=>Vp(e,t=>zv(e,t,!rc(e))),pXt=e=>Vp(e,t=>zv(e,t,rc(e))),fXt=e=>Vp(e,t=>Je.cursor(e.lineBlockAt(t.head).from)),hXt=e=>Vp(e,t=>Je.cursor(e.lineBlockAt(t.head).to)),L_e=({state:e,dispatch:t})=>(t(Xf(e,{anchor:0})),!0),F_e=({state:e,dispatch:t})=>(t(Xf(e,{anchor:e.doc.length})),!0),B_e=({state:e,dispatch:t})=>(t(Xf(e,{anchor:e.selection.main.anchor,head:0})),!0),z_e=({state:e,dispatch:t})=>(t(Xf(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),mXt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),gXt=({state:e,dispatch:t})=>{let r=KL(e).map(({from:n,to:s})=>Je.range(n,Math.min(s+1,e.doc.length)));return t(e.update({selection:Je.create(r),userEvent:"select"})),!0},yXt=({state:e,dispatch:t})=>{let r=iO(e.selection,n=>{let s=ba(e),a=s.resolveStack(n.from,1);if(n.empty){let i=s.resolveStack(n.from,-1);i.node.from>=a.node.from&&i.node.to<=a.node.to&&(a=i)}for(let i=a;i;i=i.next){let{node:o}=i;if((o.from<n.from&&o.to>=n.to||o.to>n.to&&o.from<=n.from)&&i.next)return Je.range(o.to,o.from)}return n});return r.eq(e.selection)?!1:(t(Xf(e,r)),!0)};function lGe(e,t){let{state:r}=e,n=r.selection,s=r.selection.ranges.slice();for(let a of r.selection.ranges){let i=r.doc.lineAt(a.head);if(t?i.to<e.state.doc.length:i.from>0)for(let o=a;;){let l=e.moveVertically(o,t);if(l.head<i.from||l.head>i.to){s.some(u=>u.head==l.head)||s.push(l);break}else{if(l.head==o.head)break;o=l}}}return s.length==n.ranges.length?!1:(e.dispatch(Xf(r,Je.create(s,s.length-1))),!0)}const bXt=e=>lGe(e,!1),vXt=e=>lGe(e,!0),xXt=({state:e,dispatch:t})=>{let r=e.selection,n=null;return r.ranges.length>1?n=Je.create([r.main]):r.main.empty||(n=Je.create([Je.cursor(r.main.head)])),n?(t(Xf(e,n)),!0):!1};function gI(e,t){if(e.state.readOnly)return!1;let r="delete.selection",{state:n}=e,s=n.changeByRange(a=>{let{from:i,to:o}=a;if(i==o){let l=t(a);l<i?(r="delete.backward",l=v2(e,l,!1)):l>i&&(r="delete.forward",l=v2(e,l,!0)),i=Math.min(i,l),o=Math.max(o,l)}else i=v2(e,i,!1),o=v2(e,o,!0);return i==o?{range:a}:{changes:{from:i,to:o},range:Je.cursor(i,i<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(n.update(s,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?ht.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function v2(e,t,r){if(e instanceof ht)for(let n of e.state.facet(ht.atomicRanges).map(s=>s(e)))n.between(t,t,(s,a)=>{s<t&&a>t&&(t=r?a:s)});return t}const cGe=(e,t,r)=>gI(e,n=>{let s=n.from,{state:a}=e,i=a.doc.lineAt(s),o,l;if(r&&!t&&s>i.from&&s<i.from+200&&!/[^ \t]/.test(o=i.text.slice(0,s-i.from))){if(o[o.length-1]==" ")return s-1;let u=Mf(o,a.tabSize),d=u%Z0(a)||Z0(a);for(let p=0;p<d&&o[o.length-1-p]==" ";p++)s--;l=s}else l=Qo(i.text,s-i.from,t,t)+i.from,l==s&&i.number!=(t?a.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(i.text.slice(l-i.from,s-i.from))&&(l=Qo(i.text,l-i.from,!1,!1)+i.from);return l}),WJ=e=>cGe(e,!1,!0),uGe=e=>cGe(e,!0,!1),dGe=(e,t)=>gI(e,r=>{let n=r.head,{state:s}=e,a=s.doc.lineAt(n),i=s.charCategorizer(n);for(let o=null;;){if(n==(t?a.to:a.from)){n==r.head&&a.number!=(t?s.doc.lines:1)&&(n+=t?1:-1);break}let l=Qo(a.text,n-a.from,t)+a.from,u=a.text.slice(Math.min(n,l)-a.from,Math.max(n,l)-a.from),d=i(u);if(o!=null&&d!=o)break;(u!=" "||n!=r.head)&&(o=d),n=l}return n}),pGe=e=>dGe(e,!1),SXt=e=>dGe(e,!0),wXt=e=>gI(e,t=>{let r=e.lineBlockAt(t.head).to;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),EXt=e=>gI(e,t=>{let r=e.moveToLineBoundary(t,!1).head;return t.head>r?r:Math.max(0,t.head-1)}),kXt=e=>gI(e,t=>{let r=e.moveToLineBoundary(t,!0).head;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),OXt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:gs.of(["",""])},range:Je.cursor(n.from)}));return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},_Xt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let s=n.from,a=e.doc.lineAt(s),i=s==a.from?s-1:Qo(a.text,s-a.from,!1)+a.from,o=s==a.to?s+1:Qo(a.text,s-a.from,!0)+a.from;return{changes:{from:i,to:o,insert:e.doc.slice(s,o).append(e.doc.slice(i,s))},range:Je.cursor(o)}});return r.changes.empty?!1:(t(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function KL(e){let t=[],r=-1;for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),a=e.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=e.doc.lineAt(n.to-1)),r>=s.number){let i=t[t.length-1];i.to=a.to,i.ranges.push(n)}else t.push({from:s.from,to:a.to,ranges:[n]});r=a.number+1}return t}function fGe(e,t,r){if(e.readOnly)return!1;let n=[],s=[];for(let a of KL(e)){if(r?a.to==e.doc.length:a.from==0)continue;let i=e.doc.lineAt(r?a.to+1:a.from-1),o=i.length+1;if(r){n.push({from:a.to,to:i.to},{from:a.from,insert:i.text+e.lineBreak});for(let l of a.ranges)s.push(Je.range(Math.min(e.doc.length,l.anchor+o),Math.min(e.doc.length,l.head+o)))}else{n.push({from:i.from,to:a.from},{from:a.to,insert:e.lineBreak+i.text});for(let l of a.ranges)s.push(Je.range(l.anchor-o,l.head-o))}}return n.length?(t(e.update({changes:n,scrollIntoView:!0,selection:Je.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const CXt=({state:e,dispatch:t})=>fGe(e,t,!1),TXt=({state:e,dispatch:t})=>fGe(e,t,!0);function hGe(e,t,r){if(e.readOnly)return!1;let n=[];for(let a of KL(e))r?n.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):n.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(n);return t(e.update({changes:s,selection:e.selection.map(s,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const AXt=({state:e,dispatch:t})=>hGe(e,t,!1),DXt=({state:e,dispatch:t})=>hGe(e,t,!0),NXt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,r=t.changes(KL(t).map(({from:s,to:a})=>(s>0?s--:a<t.doc.length&&a++,{from:s,to:a}))),n=iO(t.selection,s=>{let a;if(e.lineWrapping){let i=e.lineBlockAt(s.head),o=e.coordsAtPos(s.head,s.assoc||1);o&&(a=i.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(r);return e.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function IXt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let r=ba(e).resolveInner(t),n=r.childBefore(t),s=r.childAfter(t),a;return n&&s&&n.to<=t&&s.from>=t&&(a=n.type.prop(fn.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(n.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(n.to,s.from))?{from:n.to,to:s.from}:null}const U_e=mGe(!1),jXt=mGe(!0);function mGe(e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let n=t.changeByRange(s=>{let{from:a,to:i}=s,o=t.doc.lineAt(a),l=!e&&a==i&&IXt(t,a);e&&(a=i=(i<=o.to?o:t.doc.lineAt(i)).to);let u=new VL(t,{simulateBreak:a,simulateDoubleBreak:!!l}),d=Soe(u,a);for(d==null&&(d=Mf(/^\s*/.exec(t.doc.lineAt(a).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;l?{from:a,to:i}=l:a>o.from&&a<o.from+100&&!/\S/.test(o.text.slice(0,a))&&(a=o.from);let p=["",AA(t,d)];return l&&p.push(AA(t,u.lineIndent(o.from,-1))),{changes:{from:a,to:i,insert:gs.of(p)},range:Je.cursor(a+1+p[1].length)}});return r(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function tle(e,t){let r=-1;return e.changeByRange(n=>{let s=[];for(let i=n.from;i<=n.to;){let o=e.doc.lineAt(i);o.number>r&&(n.empty||n.to>o.from)&&(t(o,s,n),r=o.number),i=o.to+1}let a=e.changes(s);return{changes:s,range:Je.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const RXt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),n=new VL(e,{overrideIndentation:a=>{let i=r[a];return i??-1}}),s=tle(e,(a,i,o)=>{let l=Soe(n,a.from);if(l==null)return;/\S/.test(a.text)||(l=0);let u=/^\s*/.exec(a.text)[0],d=AA(e,l);(u!=d||o.from<a.from+u.length)&&(r[a.from]=l,i.push({from:a.from,to:a.from+u.length,insert:d}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},gGe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(tle(e,(r,n)=>{n.push({from:r.from,insert:e.facet(sO)})}),{userEvent:"input.indent"})),!0),yGe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(tle(e,(r,n)=>{let s=/^\s*/.exec(r.text)[0];if(!s)return;let a=Mf(s,e.tabSize),i=0,o=AA(e,Math.max(0,a-Z0(e)));for(;i<s.length&&i<o.length&&s.charCodeAt(i)==o.charCodeAt(i);)i++;n.push({from:r.from+i,to:r.from+s.length,insert:o.slice(i)})}),{userEvent:"delete.dedent"})),!0),PXt=e=>(e.setTabFocusMode(),!0),$Xt=[{key:"Ctrl-b",run:QQe,shift:tGe,preventDefault:!0},{key:"Ctrl-f",run:GQe,shift:rGe},{key:"Ctrl-p",run:XQe,shift:aGe},{key:"Ctrl-n",run:YQe,shift:iGe},{key:"Ctrl-a",run:tXt,shift:fXt},{key:"Ctrl-e",run:rXt,shift:hXt},{key:"Ctrl-d",run:uGe},{key:"Ctrl-h",run:WJ},{key:"Ctrl-k",run:wXt},{key:"Ctrl-Alt-h",run:pGe},{key:"Ctrl-o",run:OXt},{key:"Ctrl-t",run:_Xt},{key:"Ctrl-v",run:ZJ}],MXt=[{key:"ArrowLeft",run:QQe,shift:tGe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:QWt,shift:aXt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:JWt,shift:dXt,preventDefault:!0},{key:"ArrowRight",run:GQe,shift:rGe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:GWt,shift:iXt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:eXt,shift:pXt,preventDefault:!0},{key:"ArrowUp",run:XQe,shift:aGe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:L_e,shift:B_e},{mac:"Ctrl-ArrowUp",run:P_e,shift:$_e},{key:"ArrowDown",run:YQe,shift:iGe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:F_e,shift:z_e},{mac:"Ctrl-ArrowDown",run:ZJ,shift:M_e},{key:"PageUp",run:P_e,shift:$_e},{key:"PageDown",run:ZJ,shift:M_e},{key:"Home",run:KWt,shift:uXt,preventDefault:!0},{key:"Mod-Home",run:L_e,shift:B_e},{key:"End",run:YWt,shift:cXt,preventDefault:!0},{key:"Mod-End",run:F_e,shift:z_e},{key:"Enter",run:U_e,shift:U_e},{key:"Mod-a",run:mXt},{key:"Backspace",run:WJ,shift:WJ,preventDefault:!0},{key:"Delete",run:uGe,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:pGe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:SXt,preventDefault:!0},{mac:"Mod-Backspace",run:EXt,preventDefault:!0},{mac:"Mod-Delete",run:kXt,preventDefault:!0}].concat($Xt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),LXt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:WWt,shift:oXt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:XWt,shift:lXt},{key:"Alt-ArrowUp",run:CXt},{key:"Shift-Alt-ArrowUp",run:AXt},{key:"Alt-ArrowDown",run:TXt},{key:"Shift-Alt-ArrowDown",run:DXt},{key:"Mod-Alt-ArrowUp",run:bXt},{key:"Mod-Alt-ArrowDown",run:vXt},{key:"Escape",run:xXt},{key:"Mod-Enter",run:jXt},{key:"Alt-l",mac:"Ctrl-l",run:gXt},{key:"Mod-i",run:yXt,preventDefault:!0},{key:"Mod-[",run:yGe},{key:"Mod-]",run:gGe},{key:"Mod-Alt-\\",run:RXt},{key:"Shift-Mod-k",run:NXt},{key:"Shift-Mod-\\",run:sXt},{key:"Mod-/",run:CWt},{key:"Alt-A",run:AWt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:PXt}].concat(MXt),FXt={key:"Tab",run:gGe,shift:yGe},V_e=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class KE{constructor(t,r,n=0,s=t.length,a,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,s),this.bufferStart=n,this.normalize=a?o=>a(V_e(o)):V_e,this.query=this.normalize(r)}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 ru(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 r=noe(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=Dh(t);let s=this.normalize(r);if(s.length)for(let a=0,i=n;;a++){let o=s.charCodeAt(a),l=this.match(o,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(l)return this.value=l,this;break}i==n&&a<r.length&&r.charCodeAt(a)==o&&i++}}}match(t,r,n){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],o=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?s={from:this.matches[a+1],to:n}:(this.matches[a]++,o=!0)),o||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?s={from:r,to:n}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(KE.prototype[Symbol.iterator]=function(){return this});const bGe={from:-1,to:-1,match:/.*/.exec("")},rle="gm"+(/x/.unicode==null?"":"u");class vGe{constructor(t,r,n,s=0,a=t.length){if(this.text=t,this.to=a,this.curLine="",this.done=!1,this.value=bGe,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new xGe(t,r,n,s,a);this.re=new RegExp(r,rle+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=t.iter();let i=t.lineAt(s);this.curLineStart=i.from,this.matchPos=Z3(t,s),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 r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,s=n+r[0].length;if(this.matchPos=Z3(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},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 xG=new WeakMap;class cE{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,n){let s=xG.get(t);if(!s||s.from>=n||s.to<=r){let o=new cE(r,t.sliceString(r,n));return xG.set(t,o),o}if(s.from==r&&s.to==n)return s;let{text:a,from:i}=s;return i>r&&(a=t.sliceString(r,i)+a,i=r),s.to<n&&(a+=t.sliceString(s.to,n)),xG.set(t,new cE(i,a)),new cE(r,a.slice(r-i,n-i))}}class xGe{constructor(t,r,n,s,a){this.text=t,this.to=a,this.done=!1,this.value=bGe,this.matchPos=Z3(t,s),this.re=new RegExp(r,rle+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=cE.get(t,s,this.chunkEnd(s+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,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t&&(this.re.lastIndex=t+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,s=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this.matchPos=Z3(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=cE.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(vGe.prototype[Symbol.iterator]=xGe.prototype[Symbol.iterator]=function(){return this});function BXt(e){try{return new RegExp(e,rle),!0}catch{return!1}}function Z3(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}function XJ(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),r=wa("input",{class:"cm-textfield",name:"line",value:t}),n=wa("form",{class:"cm-gotoLine",onkeydown:a=>{a.keyCode==27?(a.preventDefault(),e.dispatch({effects:vT.of(!1)}),e.focus()):a.keyCode==13&&(a.preventDefault(),s())},onsubmit:a=>{a.preventDefault(),s()}},wa("label",e.state.phrase("Go to line"),": ",r)," ",wa("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),wa("button",{name:"close",onclick:()=>{e.dispatch({effects:vT.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]));function s(){let a=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.value);if(!a)return;let{state:i}=e,o=i.doc.lineAt(i.selection.main.head),[,l,u,d,p]=a,f=d?+d.slice(1):0,h=u?+u:o.number;if(u&&p){let b=h/100;l&&(b=b*(l=="-"?-1:1)+o.number/i.doc.lines),h=Math.round(i.doc.lines*b)}else u&&l&&(h=h*(l=="-"?-1:1)+o.number);let m=i.doc.line(Math.max(1,Math.min(i.doc.lines,h))),g=Je.cursor(m.from+Math.max(0,Math.min(f,m.length)));e.dispatch({effects:[vT.of(!1),ht.scrollIntoView(g.from,{y:"center"})],selection:g}),e.focus()}return{dom:n}}const vT=en.define(),q_e=Ji.define({create(){return!0},update(e,t){for(let r of t.effects)r.is(vT)&&(e=r.value);return e},provide:e=>TA.from(e,t=>t?XJ:null)}),zXt=e=>{let t=CA(e,XJ);if(!t){let r=[vT.of(!0)];e.state.field(q_e,!1)==null&&r.push(en.appendConfig.of([q_e,UXt])),e.dispatch({effects:r}),t=CA(e,XJ)}return t&&t.dom.querySelector("input").select(),!0},UXt=ht.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"}}}),VXt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},qXt=Xt.define({combine(e){return Am(e,VXt,{highlightWordAroundCursor:(t,r)=>t||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function HXt(e){return[XXt,WXt]}const QXt=rr.mark({class:"cm-selectionMatch"}),GXt=rr.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function H_e(e,t,r,n){return(r==0||e(t.sliceDoc(r-1,r))!=li.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=li.Word)}function ZXt(e,t,r,n){return e(t.sliceDoc(r,r+1))==li.Word&&e(t.sliceDoc(n-1,n))==li.Word}const WXt=xi.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(qXt),{state:r}=e,n=r.selection;if(n.ranges.length>1)return rr.none;let s=n.main,a,i=null;if(s.empty){if(!t.highlightWordAroundCursor)return rr.none;let l=r.wordAt(s.head);if(!l)return rr.none;i=r.charCategorizer(s.head),a=r.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<t.minSelectionLength||l>200)return rr.none;if(t.wholeWords){if(a=r.sliceDoc(s.from,s.to),i=r.charCategorizer(s.head),!(H_e(i,r,s.from,s.to)&&ZXt(i,r,s.from,s.to)))return rr.none}else if(a=r.sliceDoc(s.from,s.to),!a)return rr.none}let o=[];for(let l of e.visibleRanges){let u=new KE(r.doc,a,l.from,l.to);for(;!u.next().done;){let{from:d,to:p}=u.value;if((!i||H_e(i,r,d,p))&&(s.empty&&d<=s.from&&p>=s.to?o.push(GXt.range(d,p)):(d>=s.to||p<=s.from)&&o.push(QXt.range(d,p)),o.length>t.maxMatches))return rr.none}}return rr.set(o)}},{decorations:e=>e.decorations}),XXt=ht.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),YXt=({state:e,dispatch:t})=>{let{selection:r}=e,n=Je.create(r.ranges.map(s=>e.wordAt(s.head)||Je.cursor(s.head)),r.mainIndex);return n.eq(r)?!1:(t(e.update({selection:n})),!0)};function KXt(e,t){let{main:r,ranges:n}=e.selection,s=e.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let i=!1,o=new KE(e.doc,t,n[n.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new KE(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),i=!0}else{if(i&&n.some(l=>l.from==o.value.from))continue;if(a){let l=e.wordAt(o.value.from);if(!l||l.from!=o.value.from||l.to!=o.value.to)continue}return o.value}}const JXt=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(a=>a.from===a.to))return YXt({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=n))return!1;let s=KXt(e,n);return s?(t(e.update({selection:e.selection.addRange(Je.range(s.from,s.to),!1),effects:ht.scrollIntoView(s.to)})),!0):!1},oO=Xt.define({combine(e){return Am(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new dYt(t),scrollToMatch:t=>ht.scrollIntoView(t)})}});class SGe{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||BXt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
160
+ }`,{label:"class",detail:"definition",type:"keyword"}),Wc('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Wc('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],aQe=qoe.concat([Wc("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Wc("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Wc("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),C_e=new lVe,iQe=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function P_(e){return(t,r)=>{let n=t.node.getChild("VariableDefinition");return n&&r(n,e),!0}}const KZt=["FunctionDeclaration"],JZt={FunctionDeclaration:P_("function"),ClassDeclaration:P_("class"),ClassExpression:()=>!0,EnumDeclaration:P_("constant"),TypeAliasDeclaration:P_("type"),NamespaceDeclaration:P_("namespace"),VariableDefinition(e,t){e.matchContext(KZt)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function oQe(e,t){let r=C_e.get(t);if(r)return r;let n=[],s=!0;function a(i,o){let l=e.sliceString(i.from,i.to);n.push({label:l,type:o})}return t.cursor(Js.IncludeAnonymous).iterate(i=>{if(s)s=!1;else if(i.name){let o=JZt[i.name];if(o&&o(i,a)||iQe.has(i.name))return!1}else if(i.to-i.from>8192){for(let o of oQe(e,i.node))n.push(o);return!1}}),C_e.set(t,n),n}const H3=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Hoe=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function lQe(e){let t=ba(e.state).resolveInner(e.pos,-1);if(Hoe.indexOf(t.name)>-1)return null;let r=t.name=="VariableName"||t.to-t.from<20&&H3.test(e.state.sliceDoc(t.from,t.to));if(!r&&!e.explicit)return null;let n=[];for(let s=t;s;s=s.parent)iQe.has(s.name)&&(n=n.concat(oQe(e.state.doc,s)));return{options:n,from:r?t.from:e.pos,validFor:H3}}function pG(e,t,r){var n;let s=[];for(;;){let a=t.firstChild,i;if(a?.name=="VariableName")return s.push(e(a)),{path:s.reverse(),name:r};if(a?.name=="MemberExpression"&&((n=i=a.lastChild)===null||n===void 0?void 0:n.name)=="PropertyName")s.push(e(i)),t=a;else return null}}function cQe(e){let t=n=>e.state.doc.sliceString(n.from,n.to),r=ba(e.state).resolveInner(e.pos,-1);return r.name=="PropertyName"?pG(t,r.parent,t(r)):(r.name=="."||r.name=="?.")&&r.parent.name=="MemberExpression"?pG(t,r.parent,""):Hoe.indexOf(r.name)>-1?null:r.name=="VariableName"||r.to-r.from<20&&H3.test(t(r))?{path:[],name:t(r)}:r.name=="MemberExpression"?pG(t,r,""):e.explicit?{path:[],name:""}:null}function eWt(e,t){let r=e,n=[],s=new Set;for(let a=0;;a++){for(let o of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(o)||s.has(o))continue;s.add(o);let l;try{l=r[o]}catch{continue}n.push({label:o,type:typeof l=="function"?/^[A-Z]/.test(o)?"class":t?"function":"method":t?"variable":"property",boost:-a})}let i=Object.getPrototypeOf(e);if(!i)return n;e=i}}function tWt(e){let t=new Map;return r=>{let n=cQe(r);if(!n)return null;let s=e;for(let i of n.path)if(s=s[i],!s)return null;let a=t.get(s);return a||t.set(s,a=eWt(s,!n.path.length)),{from:r.pos-n.name.length,options:a,validFor:H3}}}const Ep=H0.define({name:"javascript",parser:YZt.configure({props:[P1.add({IfStatement:oE({except:/^\s*({|else\b)/}),TryStatement:oE({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Yqt,SwitchBody:e=>{let t=e.textAfter,r=/^\s*\}/.test(t),n=/^\s*(case|default)\b/.test(t);return e.baseIndent+(r?0:n?1:2)*e.unit},Block:Xqt({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":oE({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}}),$1.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Eoe,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 r=e.lastChild;return{from:t.to,to:r.type.isError?e.to:r.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let r=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,n=e.lastChild;return!r||r.type.isError?null:{from:r.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),uQe={test:e=>/^JSX/.test(e.name),facet:UL({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Qoe=Ep.configure({dialect:"ts"},"typescript"),Goe=Ep.configure({dialect:"jsx",props:[xoe.add(e=>e.isTop?[uQe]:void 0)]}),Zoe=Ep.configure({dialect:"jsx ts",props:[xoe.add(e=>e.isTop?[uQe]:void 0)]},"typescript");let dQe=e=>({label:e,type:"keyword"});const pQe="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(dQe),rWt=pQe.concat(["declare","implements","private","protected","public"].map(dQe));function Q3(e={}){let t=e.jsx?e.typescript?Zoe:Goe:e.typescript?Qoe:Ep,r=e.typescript?aQe.concat(rWt):qoe.concat(pQe);return new G0(t,[Ep.data.of({autocomplete:$Ht(Hoe,oHe(r))}),Ep.data.of({autocomplete:lQe}),e.jsx?fQe:[]])}function nWt(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,r=e.length){for(let n=t?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return e.sliceString(n.from,Math.min(n.to,r));return""}const sWt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),fQe=ht.inputHandler.of((e,t,r,n,s)=>{if((sWt?e.composing:e.compositionStarted)||e.state.readOnly||t!=r||n!=">"&&n!="/"||!Ep.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,o=i.changeByRange(l=>{var u;let{head:d}=l,p=ba(i).resolveInner(d-1,-1),f;if(p.name=="JSXStartTag"&&(p=p.parent),!(i.doc.sliceString(d-1,d)!=n||p.name=="JSXAttributeValue"&&p.to>d)){if(n==">"&&p.name=="JSXFragmentTag")return{range:l,changes:{from:d,insert:"</>"}};if(n=="/"&&p.name=="JSXStartCloseTag"){let h=p.parent,m=h.parent;if(m&&h.from==d-2&&((f=T_e(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${f}>`;return{range:Je.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(n==">"){let h=nWt(p);if(h&&h.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(f=T_e(i.doc,h,d)))return{range:l,changes:{from:d,insert:`</${f}>`}}}}return{range:l}});return o.changes.empty?!1:(e.dispatch([a,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function aWt(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((r,n)=>{var s;!((s=r.meta.docs)===null||s===void 0)&&s.recommended&&(t.rules[n]=2)})),r=>{let{state:n}=r,s=[];for(let{from:a,to:i}of Ep.findRegions(n)){let o=n.doc.lineAt(a),l={line:o.number-1,col:a-o.from,pos:a};for(let u of e.verify(n.sliceDoc(a,i),t))s.push(iWt(u,n.doc,l))}return s}}function A_e(e,t,r,n){return r.line(e+n.line).from+t+(e==1?n.col-1:-1)}function iWt(e,t,r){let n=A_e(e.line,e.column,t,r),s={from:n,to:e.endLine!=null&&e.endColumn!=1?A_e(e.endLine,e.endColumn,t,r):n,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:a,text:i}=e.fix,o=a[0]+r.pos-n,l=a[1]+r.pos-n;s.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+o,to:d+l,insert:i},scrollIntoView:!0})}}]}return s}const b2=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:fQe,completionPath:cQe,esLint:aWt,javascript:Q3,javascriptLanguage:Ep,jsxLanguage:Goe,localCompletionSource:lQe,scopeCompletionSource:tWt,snippets:qoe,tsxLanguage:Zoe,typescriptLanguage:Qoe,typescriptSnippets:aQe},Symbol.toStringTag,{value:"Module"})),$_=["_blank","_self","_top","_parent"],fG=["ascii","utf-8","utf-16","latin1","latin1"],hG=["get","post","put","delete"],mG=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],qu=["true","false"],Dr={},oWt={a:{attrs:{href:null,ping:null,type:null,media:null,target:$_,hreflang:null}},abbr:Dr,address:Dr,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Dr,aside:Dr,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Dr,base:{attrs:{href:null,target:$_}},bdi:Dr,bdo:Dr,blockquote:{attrs:{cite:null}},body:Dr,br:Dr,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:mG,formmethod:hG,formnovalidate:["novalidate"],formtarget:$_,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Dr,center:Dr,cite:Dr,code:Dr,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:Dr,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Dr,div:Dr,dl:Dr,dt:Dr,em:Dr,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Dr,figure:Dr,footer:Dr,form:{attrs:{action:null,name:null,"accept-charset":fG,autocomplete:["on","off"],enctype:mG,method:hG,novalidate:["novalidate"],target:$_}},h1:Dr,h2:Dr,h3:Dr,h4:Dr,h5:Dr,h6:Dr,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Dr,hgroup:Dr,hr:Dr,html:{attrs:{manifest:null}},i:Dr,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:mG,formmethod:hG,formnovalidate:["novalidate"],formtarget:$_,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:Dr,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Dr,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:Dr,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:fG,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:Dr,noscript:Dr,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:Dr,param:{attrs:{name:null,value:null}},pre:Dr,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Dr,rt:Dr,ruby:Dr,samp:Dr,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:fG}},section:Dr,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Dr,source:{attrs:{src:null,type:null,media:null}},span:Dr,strong:Dr,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Dr,summary:Dr,sup:Dr,table:Dr,tbody:Dr,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Dr,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:Dr,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Dr,time:{attrs:{datetime:null}},title:Dr,tr:Dr,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Dr,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:Dr},hQe={accesskey:null,class:null,contenteditable:qu,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:qu,autocorrect:qu,autocapitalize:qu,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":qu,"aria-autocomplete":["inline","list","both","none"],"aria-busy":qu,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":qu,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":qu,"aria-hidden":qu,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":qu,"aria-multiselectable":qu,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":qu,"aria-relevant":null,"aria-required":qu,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},mQe="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 mQe)hQe[e]=null;let LA=class{constructor(t,r){this.tags={...oWt,...t},this.globalAttrs={...hQe,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};LA.default=new LA;function XE(e,t,r=e.length){if(!t)return"";let n=t.firstChild,s=n&&n.getChild("TagName");return s?e.sliceString(s.from,Math.min(s.to,r)):""}function YE(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function gQe(e,t,r){let n=r.tags[XE(e,YE(t))];return n?.children||r.allTags}function Woe(e,t){let r=[];for(let n=YE(t);n&&!n.type.isTop;n=YE(n.parent)){let s=XE(e,n);if(s&&n.lastChild.name=="CloseTag")break;s&&r.indexOf(s)<0&&(t.name=="EndTag"||t.from>=n.firstChild.to)&&r.push(s)}return r}const yQe=/^[:\-\.\w\u00b7-\uffff]*$/;function D_e(e,t,r,n,s){let a=/\s*>/.test(e.sliceDoc(s,s+5))?"":">",i=YE(r,r.name=="StartTag"||r.name=="TagName");return{from:n,to:s,options:gQe(e.doc,i,t).map(o=>({label:o,type:"type"})).concat(Woe(e.doc,r).map((o,l)=>({label:"/"+o,apply:"/"+o+a,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function N_e(e,t,r,n){let s=/\s*>/.test(e.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:Woe(e.doc,t).map((a,i)=>({label:a,apply:a+s,type:"type",boost:99-i})),validFor:yQe}}function lWt(e,t,r,n){let s=[],a=0;for(let i of gQe(e.doc,r,t))s.push({label:"<"+i,type:"type"});for(let i of Woe(e.doc,r))s.push({label:"</"+i+">",type:"type",boost:99-a++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function cWt(e,t,r,n,s){let a=YE(r),i=a?t.tags[XE(e.doc,a)]:null,o=i&&i.attrs?Object.keys(i.attrs):[],l=i&&i.globalAttrs===!1?o:o.length?o.concat(t.globalAttrNames):t.globalAttrNames;return{from:n,to:s,options:l.map(u=>({label:u,type:"property"})),validFor:yQe}}function uWt(e,t,r,n,s){var a;let i=(a=r.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),o=[],l;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let p=YE(r),f=p?t.tags[XE(e.doc,p)]:null;d=f?.attrs&&f.attrs[u]}if(d){let p=e.sliceDoc(n,s).toLowerCase(),f='"',h='"';/^['"]/.test(p)?(l=p[0]=='"'?/^[^"]*$/:/^[^']*$/,f="",h=e.sliceDoc(s,s+1)==p[0]?"":p[0],p=p.slice(1),n++):l=/^[^\s<>='"]*$/;for(let m of d)o.push({label:m,apply:f+m+h,type:"constant"})}}return{from:n,to:s,options:o,validFor:l}}function bQe(e,t){let{state:r,pos:n}=t,s=ba(r).resolveInner(n,-1),a=s.resolve(n);for(let i=n,o;a==s&&(o=s.childBefore(i));){let l=o.lastChild;if(!l||!l.type.isError||l.from<l.to)break;a=s=o,i=l.from}return s.name=="TagName"?s.parent&&/CloseTag$/.test(s.parent.name)?N_e(r,s,s.from,n):D_e(r,e,s,s.from,n):s.name=="StartTag"||s.name=="IncompleteTag"?D_e(r,e,s,n,n):s.name=="StartCloseTag"||s.name=="IncompleteCloseTag"?N_e(r,s,n,n):s.name=="OpenTag"||s.name=="SelfClosingTag"||s.name=="AttributeName"?cWt(r,e,s,s.name=="AttributeName"?s.from:n,n):s.name=="Is"||s.name=="AttributeValue"||s.name=="UnquotedAttributeValue"?uWt(r,e,s,s.name=="Is"?n:s.from,n):t.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?lWt(r,e,s,n):null}function vQe(e){return bQe(LA.default,e)}function xQe(e){let{extraTags:t,extraGlobalAttributes:r}=e,n=r||t?new LA(t,r):LA.default;return s=>bQe(n,s)}const dWt=Ep.parser.configure({top:"SingleExpression"}),SQe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:Qoe.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Goe.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Zoe.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:dWt},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Ep.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:MA.parser}],wQe=[{name:"style",parser:MA.parser.configure({top:"Styles"})}].concat(mQe.map(e=>({name:e,parser:Ep.parser}))),EQe=H0.define({name:"html",parser:BGt.configure({props:[P1.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,r;for(let n=e.node;;){let s=n.lastChild;if(!s||s.name!="Element"||s.to!=n.to)break;t=n=s}return t&&!((r=t.lastChild)&&(r.name=="CloseTag"||r.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),$1.add({Element(e){let t=e.firstChild,r=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:r.name=="CloseTag"?r.from:e.to}}}),eHe.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),bT=EQe.configure({wrap:WHe(SQe,wQe)});function kQe(e={}){let t="",r;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(r=WHe((e.nestedLanguages||[]).concat(SQe),(e.nestedAttributes||[]).concat(wQe)));let n=r?EQe.configure({wrap:r,dialect:t}):t?bT.configure({dialect:t}):bT;return new G0(n,[bT.data.of({autocomplete:xQe(e)}),e.autoCloseTags!==!1?OQe:[],Q3().support,nQe().support])}const I_e=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),OQe=ht.inputHandler.of((e,t,r,n,s)=>{if(e.composing||e.state.readOnly||t!=r||n!=">"&&n!="/"||!bT.isActiveAt(e.state,t,-1))return!1;let a=s(),{state:i}=a,o=i.changeByRange(l=>{var u,d,p;let f=i.doc.sliceString(l.from-1,l.to)==n,{head:h}=l,m=ba(i).resolveInner(h,-1),g;if(f&&n==">"&&m.name=="EndTag"){let b=m.parent;if(((d=(u=b.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=XE(i.doc,b.parent,h))&&!I_e.has(g)){let v=h+(i.doc.sliceString(h,h+1)===">"?1:0),S=`</${g}>`;return{range:l,changes:{from:h,to:v,insert:S}}}}else if(f&&n=="/"&&m.name=="IncompleteCloseTag"){let b=m.parent;if(m.from==h-2&&((p=b.lastChild)===null||p===void 0?void 0:p.name)!="CloseTag"&&(g=XE(i.doc,b,h))&&!I_e.has(g)){let v=h+(i.doc.sliceString(h,h+1)===">"?1:0),S=`${g}>`;return{range:Je.cursor(h+S.length,-1),changes:{from:h,to:v,insert:S}}}}return{range:l}});return o.changes.empty?!1:(e.dispatch([a,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),pWt=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:OQe,html:kQe,htmlCompletionSource:vQe,htmlCompletionSourceWith:xQe,htmlLanguage:bT},Symbol.toStringTag,{value:"Module"})),_Qe=UL({commentTokens:{block:{open:"<!--",close:"-->"}}}),CQe=new fn,TQe=UQt.configure({props:[$1.add(e=>!e.is("Block")||e.is("Document")||HJ(e)!=null||fWt(e)?void 0:(t,r)=>({from:r.doc.lineAt(t.from).to,to:t.to})),CQe.add(HJ),P1.add({Document:()=>null}),$b.add({Document:_Qe})]});function HJ(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function fWt(e){return e.name=="OrderedList"||e.name=="BulletList"}function hWt(e,t){let r=e;for(;;){let n=r.nextSibling,s;if(!n||(s=HJ(n.type))!=null&&s<=t)break;r=n}return r.to}const mWt=Uqe.of((e,t,r)=>{for(let n=ba(e).resolveInner(r,-1);n&&!(n.from<t);n=n.parent){let s=n.type.prop(CQe);if(s==null)continue;let a=hWt(n,s);if(a>r)return{from:r,to:a}}return null});function Xoe(e){return new id(_Qe,e,[],"markdown")}const AQe=Xoe(TQe),gWt=TQe.configure([JQt,tGt,eGt,rGt,{props:[$1.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),X0=Xoe(gWt);function yWt(e,t){return r=>{if(r&&e){let n=null;if(r=/\S*/.exec(r)[0],typeof e=="function"?n=e(r):n=He.matchLanguageName(e,r,!0),n instanceof He)return n.support?n.support.language.parser:Q0.getSkippingParser(n.load());if(n)return n.parser}return t?t.parser:null}}class gG{constructor(t,r,n,s,a,i,o){this.node=t,this.from=r,this.to=n,this.spaceBefore=s,this.spaceAfter=a,this.type=i,this.item=o}blank(t,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;n.length<t;)n+=" ";return n}else{for(let s=this.to-this.from-n.length-this.spaceAfter.length;s>0;s--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(t,r){let n=this.node.name=="OrderedList"?String(+NQe(this.item,t)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function DQe(e,t){let r=[],n=[];for(let s=e;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&r.push(s)}for(let s=r.length-1;s>=0;s--){let a=r[s],i,o=t.lineAt(a.from),l=a.from-o.from;if(a.name=="Blockquote"&&(i=/^ *>( ?)/.exec(o.text.slice(l))))n.push(new gG(a,l,l+i[0].length,"",i[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(o.text.slice(l)))){let u=i[3],d=i[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),n.push(new gG(a.parent,l,l+d,i[1],u,i[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(i=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(l)))){let u=i[4],d=i[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let p=i[2];i[3]&&(p+=i[3].replace(/[xX]/," ")),n.push(new gG(a.parent,l,l+d,i[1],u,p,a))}}return n}function NQe(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function yG(e,t,r,n=0){for(let s=-1,a=e;;){if(a.name=="ListItem"){let o=NQe(a,t),l=+o[2];if(s>=0){if(l!=s+1)return;r.push({from:a.from+o[1].length,to:a.from+o[0].length,insert:String(s+2+n)})}s=l}let i=a.nextSibling;if(!i)break;a=i}}function Yoe(e,t){let r=/^[ \t]*/.exec(e)[0].length;if(!r||t.facet(sO)!=" ")return e;let n=Mf(e,4,r),s="";for(let a=n;a>0;)a>=4?(s+=" ",a-=4):(s+=" ",a--);return s+e.slice(r)}const IQe=(e={})=>({state:t,dispatch:r})=>{let n=ba(t),{doc:s}=t,a=null,i=t.changeByRange(o=>{if(!o.empty||!X0.isActiveAt(t,o.from,-1)&&!X0.isActiveAt(t,o.from,1))return a={range:o};let l=o.from,u=s.lineAt(l),d=DQe(n.resolveInner(l,-1),s);for(;d.length&&d[d.length-1].from>l-u.from;)d.pop();if(!d.length)return a={range:o};let p=d[d.length-1];if(p.to-p.spaceAfter.length>l-u.from)return a={range:o};let f=l>=p.to-p.spaceAfter.length&&!/\S/.test(u.text.slice(p.to));if(p.item&&f){let v=p.node.firstChild,S=p.node.getChild("ListItem","ListItem");if(v.to>=l||S&&S.to<l||u.from>0&&!/[^\s>]/.test(s.lineAt(u.from-1).text)||e.nonTightLists===!1){let w=d.length>1?d[d.length-2]:null,k,_="";w&&w.item?(k=u.from+w.from,_=w.marker(s,1)):k=u.from+(w?w.to:0);let C=[{from:k,to:l,insert:_}];return p.node.name=="OrderedList"&&yG(p.item,s,C,-2),w&&w.node.name=="OrderedList"&&yG(w.item,s,C),{range:Je.cursor(k+_.length),changes:C}}else{let w=R_e(d,t,u);return{range:Je.cursor(l+w.length+1),changes:{from:u.from,insert:w+t.lineBreak}}}}if(p.node.name=="Blockquote"&&f&&u.from){let v=s.lineAt(u.from-1),S=/>\s*$/.exec(v.text);if(S&&S.index==p.from){let w=t.changes([{from:v.from+S.index,to:v.to},{from:u.from+p.from,to:u.to}]);return{range:o.map(w),changes:w}}}let h=[];p.node.name=="OrderedList"&&yG(p.item,s,h);let m=p.item&&p.item.from<u.from,g="";if(!m||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=p.to)for(let v=0,S=d.length-1;v<=S;v++)g+=v==S&&!m?d[v].marker(s,1):d[v].blank(v<S?Mf(u.text,4,d[v+1].from)-g.length:null);let b=l;for(;b>u.from&&/\s/.test(u.text.charAt(b-u.from-1));)b--;return g=Yoe(g,t),bWt(p.node,t.doc)&&(g=R_e(d,t,u)+t.lineBreak+g),h.push({from:b,to:l,insert:t.lineBreak+g}),{range:Je.cursor(b+g.length+1),changes:h}});return a?!1:(r(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},jQe=IQe();function j_e(e){return e.name=="QuoteMark"||e.name=="ListMark"}function bWt(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let r=e.firstChild,n=e.getChild("ListItem","ListItem");if(!n)return!1;let s=t.lineAt(r.to),a=t.lineAt(n.from),i=/^[\s>]*$/.test(s.text);return s.number+(i?0:1)<a.number}function R_e(e,t,r){let n="";for(let s=0,a=e.length-2;s<=a;s++)n+=e[s].blank(s<a?Mf(r.text,4,e[s+1].from)-n.length:null,s<a);return Yoe(n,t)}function vWt(e,t){let r=e.resolveInner(t,-1),n=t;j_e(r)&&(n=r.from,r=r.parent);for(let s;s=r.childBefore(n);)if(j_e(s))n=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")r=s.lastChild,n=r.to;else break;return r}const RQe=({state:e,dispatch:t})=>{let r=ba(e),n=null,s=e.changeByRange(a=>{let i=a.from,{doc:o}=e;if(a.empty&&X0.isActiveAt(e,a.from)){let l=o.lineAt(i),u=DQe(vWt(r,i),o);if(u.length){let d=u[u.length-1],p=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(i-l.from>p&&!/\S/.test(l.text.slice(p,i-l.from)))return{range:Je.cursor(l.from+p),changes:{from:l.from+p,to:i}};if(i-l.from==p&&(!d.item||l.from<=d.item.from||!/\S/.test(l.text.slice(0,d.to)))){let f=l.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(l.text.slice(d.from,d.to))){let h=d.blank(Mf(l.text,4,d.to)-Mf(l.text,4,d.from));return f==l.from&&(h=Yoe(h,e)),{range:Je.cursor(f+h.length),changes:{from:f,to:l.from+d.to,insert:h}}}if(f<i)return{range:Je.cursor(f),changes:{from:f,to:i}}}}}return n={range:a}});return n?!1:(t(e.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},PQe=[{key:"Enter",run:jQe},{key:"Backspace",run:RQe}],$Qe=kQe({matchClosingTags:!1});function Koe(e={}){let{codeLanguages:t,defaultCodeLanguage:r,addKeymap:n=!0,base:{parser:s}=AQe,completeHTMLTags:a=!0,pasteURLAsLink:i=!0,htmlTagLanguage:o=$Qe}=e;if(!(s instanceof GL))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=e.extensions?[e.extensions]:[],u=[o.support,mWt],d;i&&u.push(MQe),r instanceof G0?(u.push(r.support),d=r.language):r&&(d=r);let p=t||d?yWt(t,d):void 0;l.push(qQt({codeParser:p,htmlParser:o.language.parser})),n&&u.push(Wf.high(nO.of(PQe)));let f=Xoe(s.configure(l));return a&&u.push(f.data.of({autocomplete:xWt})),new G0(f,u)}function xWt(e){let{state:t,pos:r}=e,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(r-25,r));if(!n)return null;let s=ba(t).resolveInner(r,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:r-n[0].length,to:r,options:SWt(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let bG=null;function SWt(){if(bG)return bG;let e=vQe(new Toe(Zn.create({extensions:$Qe}),0,!0));return bG=e?e.options:[]}const wWt=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,MQe=ht.domEventHandlers({paste:(e,t)=>{var r;let{main:n}=t.state.selection;if(n.empty)return!1;let s=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!X0.isActiveAt(t.state,n.from,1)))return!1;let a=ba(t.state),i=!1;return a.iterate({from:n.from,to:n.to,enter:o=>{(o.from>n.from||wWt.test(o.name))&&(i=!0)},leave:o=>{o.to<n.to&&(i=!0)}}),i?!1:(t.dispatch({changes:[{from:n.from,insert:"["},{from:n.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),EWt=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:AQe,deleteMarkupBackward:RQe,insertNewlineContinueMarkup:jQe,insertNewlineContinueMarkupCommand:IQe,markdown:Koe,markdownKeymap:PQe,markdownLanguage:X0,pasteURLAsLink:MQe},Symbol.toStringTag,{value:"Module"}));function ct(e){return new G0(koe.define(e))}function rb(e){return Ge(()=>import("./index-B0kelVGd.js"),__vite__mapDeps([0,1]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const LQe=[He.of({name:"C",extensions:["c","h","ino"],load(){return Ge(()=>import("./index-NJHb1QwK.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),He.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Ge(()=>import("./index-NJHb1QwK.js"),__vite__mapDeps([2,1]),import.meta.url).then(e=>e.cpp())}}),He.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return rb("Cassandra")}}),He.of({name:"CSS",extensions:["css"],load(){return Ge(()=>Promise.resolve().then(()=>xZt),void 0,import.meta.url).then(e=>e.css())}}),He.of({name:"Go",extensions:["go"],load(){return Ge(()=>import("./index-BjlNLXTP.js"),__vite__mapDeps([3,1]),import.meta.url).then(e=>e.go())}}),He.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Ge(()=>Promise.resolve().then(()=>pWt),void 0,import.meta.url).then(e=>e.html())}}),He.of({name:"Java",extensions:["java"],load(){return Ge(()=>import("./index-CR3mc0Yb.js"),__vite__mapDeps([4,1]),import.meta.url).then(e=>e.java())}}),He.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Ge(()=>Promise.resolve().then(()=>b2),void 0,import.meta.url).then(e=>e.javascript())}}),He.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return Ge(()=>import("./index-B_c5ew86.js"),__vite__mapDeps([5,1]),import.meta.url).then(e=>e.jinja())}}),He.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Ge(()=>Promise.resolve().then(()=>RHt),void 0,import.meta.url).then(e=>e.json())}}),He.of({name:"JSX",extensions:["jsx"],load(){return Ge(()=>Promise.resolve().then(()=>b2),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),He.of({name:"LESS",extensions:["less"],load(){return Ge(()=>import("./index-OEwIQkmT.js"),__vite__mapDeps([6,1]),import.meta.url).then(e=>e.less())}}),He.of({name:"Liquid",extensions:["liquid"],load(){return Ge(()=>import("./index-BpQxqqq3.js"),__vite__mapDeps([7,1]),import.meta.url).then(e=>e.liquid())}}),He.of({name:"MariaDB SQL",load(){return rb("MariaSQL")}}),He.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Ge(()=>Promise.resolve().then(()=>EWt),void 0,import.meta.url).then(e=>e.markdown())}}),He.of({name:"MS SQL",load(){return rb("MSSQL")}}),He.of({name:"MySQL",load(){return rb("MySQL")}}),He.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Ge(()=>import("./index-DBeySQZ3.js"),__vite__mapDeps([8,1]),import.meta.url).then(e=>e.php())}}),He.of({name:"PLSQL",extensions:["pls"],load(){return rb("PLSQL")}}),He.of({name:"PostgreSQL",load(){return rb("PostgreSQL")}}),He.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Ge(()=>import("./index-CSm5GPao.js"),__vite__mapDeps([9,1]),import.meta.url).then(e=>e.python())}}),He.of({name:"Rust",extensions:["rs"],load(){return Ge(()=>import("./index-zsQwNiDz.js"),__vite__mapDeps([10,1]),import.meta.url).then(e=>e.rust())}}),He.of({name:"Sass",extensions:["sass"],load(){return Ge(()=>import("./index-BhQHeAxR.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass({indented:!0}))}}),He.of({name:"SCSS",extensions:["scss"],load(){return Ge(()=>import("./index-BhQHeAxR.js"),__vite__mapDeps([11,1]),import.meta.url).then(e=>e.sass())}}),He.of({name:"SQL",extensions:["sql"],load(){return rb("StandardSQL")}}),He.of({name:"SQLite",load(){return rb("SQLite")}}),He.of({name:"TSX",extensions:["tsx"],load(){return Ge(()=>Promise.resolve().then(()=>b2),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),He.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Ge(()=>Promise.resolve().then(()=>b2),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),He.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Ge(()=>import("./index-ByFqbMW9.js"),__vite__mapDeps([12,1]),import.meta.url).then(e=>e.wast())}}),He.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Ge(()=>import("./index-D1NoiTsN.js"),__vite__mapDeps([13,1]),import.meta.url).then(e=>e.xml())}}),He.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Ge(()=>import("./index-UbraKr-V.js"),__vite__mapDeps([14,1]),import.meta.url).then(e=>e.yaml())}}),He.of({name:"APL",extensions:["dyalog","apl"],load(){return Ge(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>ct(e.apl))}}),He.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Ge(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>ct(e.asciiArmor))}}),He.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Ge(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>ct(e.asn1({})))}}),He.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Ge(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>ct(e.asterisk))}}),He.of({name:"Brainfuck",extensions:["b","bf"],load(){return Ge(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>ct(e.brainfuck))}}),He.of({name:"Cobol",extensions:["cob","cpy"],load(){return Ge(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>ct(e.cobol))}}),He.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.csharp))}}),He.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Ge(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>ct(e.clojure))}}),He.of({name:"ClojureScript",extensions:["cljs"],load(){return Ge(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>ct(e.clojure))}}),He.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Ge(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>ct(e.gss))}}),He.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Ge(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>ct(e.cmake))}}),He.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Ge(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>ct(e.coffeeScript))}}),He.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Ge(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>ct(e.commonLisp))}}),He.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Ge(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>ct(e.cypher))}}),He.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Ge(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>ct(e.cython))}}),He.of({name:"Crystal",extensions:["cr"],load(){return Ge(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>ct(e.crystal))}}),He.of({name:"D",extensions:["d"],load(){return Ge(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>ct(e.d))}}),He.of({name:"Dart",extensions:["dart"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.dart))}}),He.of({name:"diff",extensions:["diff","patch"],load(){return Ge(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>ct(e.diff))}}),He.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Ge(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([15,16]),import.meta.url).then(e=>ct(e.dockerFile))}}),He.of({name:"DTD",extensions:["dtd"],load(){return Ge(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>ct(e.dtd))}}),He.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Ge(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>ct(e.dylan))}}),He.of({name:"EBNF",load(){return Ge(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>ct(e.ebnf))}}),He.of({name:"ECL",extensions:["ecl"],load(){return Ge(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>ct(e.ecl))}}),He.of({name:"edn",extensions:["edn"],load(){return Ge(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>ct(e.clojure))}}),He.of({name:"Eiffel",extensions:["e"],load(){return Ge(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>ct(e.eiffel))}}),He.of({name:"Elm",extensions:["elm"],load(){return Ge(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>ct(e.elm))}}),He.of({name:"Erlang",extensions:["erl"],load(){return Ge(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>ct(e.erlang))}}),He.of({name:"Esper",load(){return Ge(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>ct(e.esper))}}),He.of({name:"Factor",extensions:["factor"],load(){return Ge(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([17,16]),import.meta.url).then(e=>ct(e.factor))}}),He.of({name:"FCL",load(){return Ge(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>ct(e.fcl))}}),He.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Ge(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>ct(e.forth))}}),He.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Ge(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>ct(e.fortran))}}),He.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Ge(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>ct(e.fSharp))}}),He.of({name:"Gas",extensions:["s"],load(){return Ge(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>ct(e.gas))}}),He.of({name:"Gherkin",extensions:["feature"],load(){return Ge(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>ct(e.gherkin))}}),He.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Ge(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>ct(e.groovy))}}),He.of({name:"Haskell",extensions:["hs"],load(){return Ge(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>ct(e.haskell))}}),He.of({name:"Haxe",extensions:["hx"],load(){return Ge(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>ct(e.haxe))}}),He.of({name:"HXML",extensions:["hxml"],load(){return Ge(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>ct(e.hxml))}}),He.of({name:"HTTP",load(){return Ge(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>ct(e.http))}}),He.of({name:"IDL",extensions:["pro"],load(){return Ge(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>ct(e.idl))}}),He.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Ge(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>ct(e.jsonld))}}),He.of({name:"Julia",extensions:["jl"],load(){return Ge(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>ct(e.julia))}}),He.of({name:"Kotlin",extensions:["kt","kts"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.kotlin))}}),He.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Ge(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>ct(e.liveScript))}}),He.of({name:"Lua",extensions:["lua"],load(){return Ge(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>ct(e.lua))}}),He.of({name:"mIRC",extensions:["mrc"],load(){return Ge(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>ct(e.mirc))}}),He.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Ge(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>ct(e.mathematica))}}),He.of({name:"Modelica",extensions:["mo"],load(){return Ge(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>ct(e.modelica))}}),He.of({name:"MUMPS",extensions:["mps"],load(){return Ge(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>ct(e.mumps))}}),He.of({name:"Mbox",extensions:["mbox"],load(){return Ge(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>ct(e.mbox))}}),He.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Ge(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>ct(e.nginx))}}),He.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Ge(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([18,16]),import.meta.url).then(e=>ct(e.nsis))}}),He.of({name:"NTriples",extensions:["nt","nq"],load(){return Ge(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>ct(e.ntriples))}}),He.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.objectiveC))}}),He.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.objectiveCpp))}}),He.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Ge(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>ct(e.oCaml))}}),He.of({name:"Octave",extensions:["m"],load(){return Ge(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>ct(e.octave))}}),He.of({name:"Oz",extensions:["oz"],load(){return Ge(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>ct(e.oz))}}),He.of({name:"Pascal",extensions:["p","pas"],load(){return Ge(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>ct(e.pascal))}}),He.of({name:"Perl",extensions:["pl","pm"],load(){return Ge(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>ct(e.perl))}}),He.of({name:"Pig",extensions:["pig"],load(){return Ge(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>ct(e.pig))}}),He.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Ge(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>ct(e.powerShell))}}),He.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Ge(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>ct(e.properties))}}),He.of({name:"ProtoBuf",extensions:["proto"],load(){return Ge(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>ct(e.protobuf))}}),He.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Ge(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([19,20]),import.meta.url).then(e=>ct(e.pug))}}),He.of({name:"Puppet",extensions:["pp"],load(){return Ge(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>ct(e.puppet))}}),He.of({name:"Q",extensions:["q"],load(){return Ge(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>ct(e.q))}}),He.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Ge(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>ct(e.r))}}),He.of({name:"RPM Changes",load(){return Ge(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>ct(e.rpmChanges))}}),He.of({name:"RPM Spec",extensions:["spec"],load(){return Ge(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>ct(e.rpmSpec))}}),He.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Ge(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>ct(e.ruby))}}),He.of({name:"SAS",extensions:["sas"],load(){return Ge(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>ct(e.sas))}}),He.of({name:"Scala",extensions:["scala"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.scala))}}),He.of({name:"Scheme",extensions:["scm","ss"],load(){return Ge(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>ct(e.scheme))}}),He.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Ge(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>ct(e.shell))}}),He.of({name:"Sieve",extensions:["siv","sieve"],load(){return Ge(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>ct(e.sieve))}}),He.of({name:"Smalltalk",extensions:["st"],load(){return Ge(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>ct(e.smalltalk))}}),He.of({name:"Solr",load(){return Ge(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>ct(e.solr))}}),He.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Ge(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>ct(e.sml))}}),He.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Ge(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>ct(e.sparql))}}),He.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Ge(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>ct(e.spreadsheet))}}),He.of({name:"Squirrel",extensions:["nut"],load(){return Ge(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>ct(e.squirrel))}}),He.of({name:"Stylus",extensions:["styl"],load(){return Ge(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>ct(e.stylus))}}),He.of({name:"Swift",extensions:["swift"],load(){return Ge(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>ct(e.swift))}}),He.of({name:"sTeX",load(){return Ge(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>ct(e.stex))}}),He.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Ge(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>ct(e.stex))}}),He.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Ge(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>ct(e.verilog))}}),He.of({name:"Tcl",extensions:["tcl"],load(){return Ge(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>ct(e.tcl))}}),He.of({name:"Textile",extensions:["textile"],load(){return Ge(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>ct(e.textile))}}),He.of({name:"TiddlyWiki",load(){return Ge(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>ct(e.tiddlyWiki))}}),He.of({name:"Tiki wiki",load(){return Ge(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>ct(e.tiki))}}),He.of({name:"TOML",extensions:["toml"],load(){return Ge(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>ct(e.toml))}}),He.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Ge(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>ct(e.troff))}}),He.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Ge(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>ct(e.ttcn))}}),He.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Ge(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>ct(e.ttcnCfg))}}),He.of({name:"Turtle",extensions:["ttl"],load(){return Ge(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>ct(e.turtle))}}),He.of({name:"Web IDL",extensions:["webidl"],load(){return Ge(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>ct(e.webIDL))}}),He.of({name:"VB.NET",extensions:["vb"],load(){return Ge(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>ct(e.vb))}}),He.of({name:"VBScript",extensions:["vbs"],load(){return Ge(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>ct(e.vbScript))}}),He.of({name:"Velocity",extensions:["vtl"],load(){return Ge(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>ct(e.velocity))}}),He.of({name:"Verilog",extensions:["v"],load(){return Ge(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>ct(e.verilog))}}),He.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Ge(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>ct(e.vhdl))}}),He.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return Ge(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>ct(e.xQuery))}}),He.of({name:"Yacas",extensions:["ys"],load(){return Ge(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>ct(e.yacas))}}),He.of({name:"Z80",extensions:["z80"],load(){return Ge(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>ct(e.z80))}}),He.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Ge(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>ct(e.mscgen))}}),He.of({name:"Xù",extensions:["xu"],load(){return Ge(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>ct(e.xu))}}),He.of({name:"MsGenny",extensions:["msgenny"],load(){return Ge(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>ct(e.msgenny))}}),He.of({name:"Vue",extensions:["vue"],load(){return Ge(()=>import("./index-6Szop4GJ.js"),__vite__mapDeps([21,1]),import.meta.url).then(e=>e.vue())}}),He.of({name:"Angular Template",load(){return Ge(()=>import("./index-RlnKqJOE.js"),__vite__mapDeps([22,1]),import.meta.url).then(e=>e.angular())}})];var kWt=e=>{var{theme:t,settings:r={},styles:n=[]}=e,s={".cm-gutters":{}},a={};r.background&&(a.backgroundColor=r.background),r.backgroundImage&&(a.backgroundImage=r.backgroundImage),r.foreground&&(a.color=r.foreground),r.fontSize&&(a.fontSize=r.fontSize),(r.background||r.foreground)&&(s["&"]=a),r.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(s[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(s[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(s[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(s[".cm-content"]={caretColor:r.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var i={};r.gutterActiveForeground&&(i.color=r.gutterActiveForeground),r.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:r.lineHighlight},i.backgroundColor=r.lineHighlight),s[".cm-activeLineGutter"]=i,r.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var o=ht.theme(s,{dark:t==="dark"}),l=M1.define(n),u=[o,HL(l)];return u},OWt={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)"},_Wt=[{tag:re.comment,color:"#6272a4"},{tag:re.string,color:"#f1fa8c"},{tag:re.atom,color:"#bd93f9"},{tag:re.meta,color:"#f8f8f2"},{tag:[re.keyword,re.operator,re.tagName],color:"#ff79c6"},{tag:[re.function(re.propertyName),re.propertyName],color:"#66d9ef"},{tag:[re.definition(re.variableName),re.function(re.variableName),re.className,re.attributeName],color:"#50fa7b"},{tag:re.atom,color:"#bd93f9"}],ZL=e=>{var{theme:t="dark",settings:r={},styles:n=[]}=e||{};return kWt({theme:t,settings:lm({},OWt,r),styles:[..._Wt,...n]})};ZL();const CWt=e=>{let{state:t}=e,r=t.doc.lineAt(t.selection.main.from),n=ele(e.state,r.from);return n.line?TWt(e):n.block?DWt(e):!1};function Joe(e,t){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let s=e(t,r);return s?(n(r.update(s)),!0):!1}}const TWt=Joe(jWt,0),AWt=Joe(FQe,0),DWt=Joe((e,t)=>FQe(e,t,IWt(t)),0);function ele(e,t){let r=e.languageDataAt("commentTokens",t,1);return r.length?r[0]:{}}const M_=50;function NWt(e,{open:t,close:r},n,s){let a=e.sliceDoc(n-M_,n),i=e.sliceDoc(s,s+M_),o=/\s*$/.exec(a)[0].length,l=/^\s*/.exec(i)[0].length,u=a.length-o;if(a.slice(u-t.length,u)==t&&i.slice(l,l+r.length)==r)return{open:{pos:n-o,margin:o&&1},close:{pos:s+l,margin:l&&1}};let d,p;s-n<=2*M_?d=p=e.sliceDoc(n,s):(d=e.sliceDoc(n,n+M_),p=e.sliceDoc(s-M_,s));let f=/^\s*/.exec(d)[0].length,h=/\s*$/.exec(p)[0].length,m=p.length-h-r.length;return d.slice(f,f+t.length)==t&&p.slice(m,m+r.length)==r?{open:{pos:n+f+t.length,margin:/\s/.test(d.charAt(f+t.length))?1:0},close:{pos:s-h-r.length,margin:/\s/.test(p.charAt(m-1))?1:0}}:null}function IWt(e){let t=[];for(let r of e.selection.ranges){let n=e.doc.lineAt(r.from),s=r.to<=n.to?n:e.doc.lineAt(r.to);s.from>n.from&&s.from==r.to&&(s=r.to==n.to+1?n:e.doc.lineAt(r.to-1));let a=t.length-1;a>=0&&t[a].to>n.from?t[a].to=s.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return t}function FQe(e,t,r=t.selection.ranges){let n=r.map(a=>ele(t,a.from).block);if(!n.every(a=>a))return null;let s=r.map((a,i)=>NWt(t,n[i],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:t.changes(r.map((a,i)=>s[i]?[]:[{from:a.from,insert:n[i].open+" "},{from:a.to,insert:" "+n[i].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let i=0,o;i<s.length;i++)if(o=s[i]){let l=n[i],{open:u,close:d}=o;a.push({from:u.pos-l.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:a}}return null}function jWt(e,t,r=t.selection.ranges){let n=[],s=-1;for(let{from:a,to:i}of r){let o=n.length,l=1e9,u=ele(t,a).line;if(u){for(let d=a;d<=i;){let p=t.doc.lineAt(d);if(p.from>s&&(a==i||i>p.from)){s=p.from;let f=/^\s*/.exec(p.text)[0].length,h=f==p.length,m=p.text.slice(f,f+u.length)==u?f:-1;f<p.text.length&&f<l&&(l=f),n.push({line:p,comment:m,token:u,indent:f,empty:h,single:!1})}d=p.to+1}if(l<1e9)for(let d=o;d<n.length;d++)n[d].indent<n[d].line.text.length&&(n[d].indent=l);n.length==o+1&&(n[o].single=!0)}}if(e!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:o,token:l,indent:u,empty:d,single:p}of n)(p||!d)&&a.push({from:o.from+u,insert:l+" "});let i=t.changes(a);return{changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:i,comment:o,token:l}of n)if(o>=0){let u=i.from+o,d=u+l.length;i.text[d-i.from]==" "&&d++,a.push({from:u,to:d})}return{changes:a}}return null}const QJ=Tm.define(),RWt=Tm.define(),PWt=Xt.define(),BQe=Xt.define({combine(e){return Am(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,r)=>(n,s)=>t(n,s)||r(n,s)})}}),zQe=Ji.define({create(){return zh.empty},update(e,t){let r=t.state.facet(BQe),n=t.annotation(QJ);if(n){let l=uu.fromTransaction(t,n.selection),u=n.side,d=u==0?e.undone:e.done;return l?d=G3(d,d.length,r.minDepth,l):d=qQe(d,t.startState.selection),new zh(u==0?n.rest:d,u==0?d:n.rest)}let s=t.annotation(RWt);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(po.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=uu.fromTransaction(t),i=t.annotation(po.time),o=t.annotation(po.userEvent);return a?e=e.addChanges(a,i,o,r,t):t.selection&&(e=e.addSelection(t.startState.selection,i,o,r.newGroupDelay)),(s=="full"||s=="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 zh(e.done.map(uu.fromJSON),e.undone.map(uu.fromJSON))}});function $Wt(e={}){return[zQe,BQe.of(e),ht.domEventHandlers({beforeinput(t,r){let n=t.inputType=="historyUndo"?UQe:t.inputType=="historyRedo"?GJ:null;return n?(t.preventDefault(),n(r)):!1}})]}function WL(e,t){return function({state:r,dispatch:n}){if(!t&&r.readOnly)return!1;let s=r.field(zQe,!1);if(!s)return!1;let a=s.pop(e,r,t);return a?(n(a),!0):!1}}const UQe=WL(0,!1),GJ=WL(1,!1),MWt=WL(0,!0),LWt=WL(1,!0);class uu{constructor(t,r,n,s,a){this.changes=t,this.effects=r,this.mapped=n,this.startSelection=s,this.selectionsAfter=a}setSelAfter(t){return new uu(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,r,n;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new uu(t.changes&&io.fromJSON(t.changes),[],t.mapped&&Yh.fromJSON(t.mapped),t.startSelection&&Je.fromJSON(t.startSelection),t.selectionsAfter.map(Je.fromJSON))}static fromTransaction(t,r){let n=yp;for(let s of t.startState.facet(PWt)){let a=s(t);a.length&&(n=n.concat(a))}return!n.length&&t.changes.empty?null:new uu(t.changes.invert(t.startState.doc),n,void 0,r||t.startState.selection,yp)}static selection(t){return new uu(void 0,yp,void 0,void 0,t)}}function G3(e,t,r,n){let s=t+1>r+20?t-r-1:0,a=e.slice(s,t);return a.push(n),a}function FWt(e,t){let r=[],n=!1;return e.iterChangedRanges((s,a)=>r.push(s,a)),t.iterChangedRanges((s,a,i,o)=>{for(let l=0;l<r.length;){let u=r[l++],d=r[l++];o>=u&&i<=d&&(n=!0)}}),n}function BWt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((r,n)=>r.empty!=t.ranges[n].empty).length===0}function VQe(e,t){return e.length?t.length?e.concat(t):e:t}const yp=[],zWt=200;function qQe(e,t){if(e.length){let r=e[e.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-zWt));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),G3(e,e.length-1,1e9,r.setSelAfter(n)))}else return[uu.selection([t])]}function UWt(e){let t=e[e.length-1],r=e.slice();return r[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),r}function vG(e,t){if(!e.length)return e;let r=e.length,n=yp;for(;r;){let s=VWt(e[r-1],t,n);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,r);return a[r-1]=s,a}else t=s.mapped,r--,n=s.selectionsAfter}return n.length?[uu.selection(n)]:yp}function VWt(e,t,r){let n=VQe(e.selectionsAfter.length?e.selectionsAfter.map(o=>o.map(t)):yp,r);if(!e.changes)return uu.selection(n);let s=e.changes.map(t),a=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(a):a;return new uu(s,en.mapEffects(e.effects,t),i,e.startSelection.map(a),n)}const qWt=/^(input\.type|delete)($|\.)/;class zh{constructor(t,r,n=0,s=void 0){this.done=t,this.undone=r,this.prevTime=n,this.prevUserEvent=s}isolate(){return this.prevTime?new zh(this.done,this.undone):this}addChanges(t,r,n,s,a){let i=this.done,o=i[i.length-1];return o&&o.changes&&!o.changes.empty&&t.changes&&(!n||qWt.test(n))&&(!o.selectionsAfter.length&&r-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,FWt(o.changes,t.changes))||n=="input.type.compose")?i=G3(i,i.length-1,s.minDepth,new uu(t.changes.compose(o.changes),VQe(en.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,yp)):i=G3(i,i.length,s.minDepth,t),new zh(i,yp,r,n)}addSelection(t,r,n,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:yp;return a.length>0&&r-this.prevTime<s&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&BWt(a[a.length-1],t)?this:new zh(qQe(this.done,t),this.undone,r,n)}addMapping(t){return new zh(vG(this.done,t),vG(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,r,n){let s=t==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],i=a.selectionsAfter[0]||r.selection;if(n&&a.selectionsAfter.length)return r.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:QJ.of({side:t,rest:UWt(s),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let o=s.length==1?yp:s.slice(0,s.length-1);return a.mapped&&(o=vG(o,a.mapped)),r.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:QJ.of({side:t,rest:o,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}zh.empty=new zh(yp,yp);const HWt=[{key:"Mod-z",run:UQe,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:GJ,preventDefault:!0},{linux:"Ctrl-Shift-z",run:GJ,preventDefault:!0},{key:"Mod-u",run:MWt,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:LWt,preventDefault:!0}];function iO(e,t){return Je.create(e.ranges.map(t),e.mainIndex)}function Xf(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Yf({state:e,dispatch:t},r){let n=iO(e.selection,r);return n.eq(e.selection,!0)?!1:(t(Xf(e,n)),!0)}function XL(e,t){return Je.cursor(t?e.to:e.from)}function HQe(e,t){return Yf(e,r=>r.empty?e.moveByChar(r,t):XL(r,t))}function rc(e){return e.textDirectionAt(e.state.selection.main.head)==Oa.LTR}const QQe=e=>HQe(e,!rc(e)),GQe=e=>HQe(e,rc(e));function ZQe(e,t){return Yf(e,r=>r.empty?e.moveByGroup(r,t):XL(r,t))}const QWt=e=>ZQe(e,!rc(e)),GWt=e=>ZQe(e,rc(e));function ZWt(e,t,r){if(t.type.prop(r))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function YL(e,t,r){let n=ba(e).resolveInner(t.head),s=r?fn.closedBy:fn.openedBy;for(let l=t.head;;){let u=r?n.childAfter(l):n.childBefore(l);if(!u)break;ZWt(e,u,s)?n=u:l=r?u.to:u.from}let a=n.type.prop(s),i,o;return a&&(i=r?Bh(e,n.from,1):Bh(e,n.to,-1))&&i.matched?o=r?i.end.to:i.end.from:o=r?n.to:n.from,Je.cursor(o,r?-1:1)}const WWt=e=>Yf(e,t=>YL(e.state,t,!rc(e))),XWt=e=>Yf(e,t=>YL(e.state,t,rc(e)));function WQe(e,t){return Yf(e,r=>{if(!r.empty)return XL(r,t);let n=e.moveVertically(r,t);return n.head!=r.head?n:e.moveToLineBoundary(r,t)})}const XQe=e=>WQe(e,!1),YQe=e=>WQe(e,!0);function KQe(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,n=0,s;if(t){for(let a of e.state.facet(ht.scrollMargins)){let i=a(e);i?.top&&(r=Math.max(i?.top,r)),i?.bottom&&(n=Math.max(i?.bottom,n))}s=e.scrollDOM.clientHeight-r-n}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function JQe(e,t){let r=KQe(e),{state:n}=e,s=iO(n.selection,i=>i.empty?e.moveVertically(i,t,r.height):XL(i,t));if(s.eq(n.selection))return!1;let a;if(r.selfScroll){let i=e.coordsAtPos(n.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),l=o.top+r.marginTop,u=o.bottom-r.marginBottom;i&&i.top>l&&i.bottom<u&&(a=ht.scrollIntoView(s.main.head,{y:"start",yMargin:i.top-l}))}return e.dispatch(Xf(n,s),{effects:a}),!0}const P_e=e=>JQe(e,!1),ZJ=e=>JQe(e,!0);function zv(e,t,r){let n=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,r);if(s.head==t.head&&s.head!=(r?n.to:n.from)&&(s=e.moveToLineBoundary(t,r,!1)),!r&&s.head==n.from&&n.length){let a=/^\s*/.exec(e.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&t.head!=n.from+a&&(s=Je.cursor(n.from+a))}return s}const YWt=e=>Yf(e,t=>zv(e,t,!0)),KWt=e=>Yf(e,t=>zv(e,t,!1)),JWt=e=>Yf(e,t=>zv(e,t,!rc(e))),eXt=e=>Yf(e,t=>zv(e,t,rc(e))),tXt=e=>Yf(e,t=>Je.cursor(e.lineBlockAt(t.head).from,1)),rXt=e=>Yf(e,t=>Je.cursor(e.lineBlockAt(t.head).to,-1));function nXt(e,t,r){let n=!1,s=iO(e.selection,a=>{let i=Bh(e,a.head,-1)||Bh(e,a.head,1)||a.head>0&&Bh(e,a.head-1,1)||a.head<e.doc.length&&Bh(e,a.head+1,-1);if(!i||!i.end)return a;n=!0;let o=i.start.from==a.head?i.end.to:i.end.from;return Je.cursor(o)});return n?(t(Xf(e,s)),!0):!1}const sXt=({state:e,dispatch:t})=>nXt(e,t);function Vp(e,t){let r=iO(e.state.selection,n=>{let s=t(n);return Je.range(n.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return r.eq(e.state.selection)?!1:(e.dispatch(Xf(e.state,r)),!0)}function eGe(e,t){return Vp(e,r=>e.moveByChar(r,t))}const tGe=e=>eGe(e,!rc(e)),rGe=e=>eGe(e,rc(e));function nGe(e,t){return Vp(e,r=>e.moveByGroup(r,t))}const aXt=e=>nGe(e,!rc(e)),iXt=e=>nGe(e,rc(e)),oXt=e=>Vp(e,t=>YL(e.state,t,!rc(e))),lXt=e=>Vp(e,t=>YL(e.state,t,rc(e)));function sGe(e,t){return Vp(e,r=>e.moveVertically(r,t))}const aGe=e=>sGe(e,!1),iGe=e=>sGe(e,!0);function oGe(e,t){return Vp(e,r=>e.moveVertically(r,t,KQe(e).height))}const $_e=e=>oGe(e,!1),M_e=e=>oGe(e,!0),cXt=e=>Vp(e,t=>zv(e,t,!0)),uXt=e=>Vp(e,t=>zv(e,t,!1)),dXt=e=>Vp(e,t=>zv(e,t,!rc(e))),pXt=e=>Vp(e,t=>zv(e,t,rc(e))),fXt=e=>Vp(e,t=>Je.cursor(e.lineBlockAt(t.head).from)),hXt=e=>Vp(e,t=>Je.cursor(e.lineBlockAt(t.head).to)),L_e=({state:e,dispatch:t})=>(t(Xf(e,{anchor:0})),!0),F_e=({state:e,dispatch:t})=>(t(Xf(e,{anchor:e.doc.length})),!0),B_e=({state:e,dispatch:t})=>(t(Xf(e,{anchor:e.selection.main.anchor,head:0})),!0),z_e=({state:e,dispatch:t})=>(t(Xf(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),mXt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),gXt=({state:e,dispatch:t})=>{let r=KL(e).map(({from:n,to:s})=>Je.range(n,Math.min(s+1,e.doc.length)));return t(e.update({selection:Je.create(r),userEvent:"select"})),!0},yXt=({state:e,dispatch:t})=>{let r=iO(e.selection,n=>{let s=ba(e),a=s.resolveStack(n.from,1);if(n.empty){let i=s.resolveStack(n.from,-1);i.node.from>=a.node.from&&i.node.to<=a.node.to&&(a=i)}for(let i=a;i;i=i.next){let{node:o}=i;if((o.from<n.from&&o.to>=n.to||o.to>n.to&&o.from<=n.from)&&i.next)return Je.range(o.to,o.from)}return n});return r.eq(e.selection)?!1:(t(Xf(e,r)),!0)};function lGe(e,t){let{state:r}=e,n=r.selection,s=r.selection.ranges.slice();for(let a of r.selection.ranges){let i=r.doc.lineAt(a.head);if(t?i.to<e.state.doc.length:i.from>0)for(let o=a;;){let l=e.moveVertically(o,t);if(l.head<i.from||l.head>i.to){s.some(u=>u.head==l.head)||s.push(l);break}else{if(l.head==o.head)break;o=l}}}return s.length==n.ranges.length?!1:(e.dispatch(Xf(r,Je.create(s,s.length-1))),!0)}const bXt=e=>lGe(e,!1),vXt=e=>lGe(e,!0),xXt=({state:e,dispatch:t})=>{let r=e.selection,n=null;return r.ranges.length>1?n=Je.create([r.main]):r.main.empty||(n=Je.create([Je.cursor(r.main.head)])),n?(t(Xf(e,n)),!0):!1};function gI(e,t){if(e.state.readOnly)return!1;let r="delete.selection",{state:n}=e,s=n.changeByRange(a=>{let{from:i,to:o}=a;if(i==o){let l=t(a);l<i?(r="delete.backward",l=v2(e,l,!1)):l>i&&(r="delete.forward",l=v2(e,l,!0)),i=Math.min(i,l),o=Math.max(o,l)}else i=v2(e,i,!1),o=v2(e,o,!0);return i==o?{range:a}:{changes:{from:i,to:o},range:Je.cursor(i,i<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(n.update(s,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?ht.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function v2(e,t,r){if(e instanceof ht)for(let n of e.state.facet(ht.atomicRanges).map(s=>s(e)))n.between(t,t,(s,a)=>{s<t&&a>t&&(t=r?a:s)});return t}const cGe=(e,t,r)=>gI(e,n=>{let s=n.from,{state:a}=e,i=a.doc.lineAt(s),o,l;if(r&&!t&&s>i.from&&s<i.from+200&&!/[^ \t]/.test(o=i.text.slice(0,s-i.from))){if(o[o.length-1]==" ")return s-1;let u=Mf(o,a.tabSize),d=u%Z0(a)||Z0(a);for(let p=0;p<d&&o[o.length-1-p]==" ";p++)s--;l=s}else l=Qo(i.text,s-i.from,t,t)+i.from,l==s&&i.number!=(t?a.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(i.text.slice(l-i.from,s-i.from))&&(l=Qo(i.text,l-i.from,!1,!1)+i.from);return l}),WJ=e=>cGe(e,!1,!0),uGe=e=>cGe(e,!0,!1),dGe=(e,t)=>gI(e,r=>{let n=r.head,{state:s}=e,a=s.doc.lineAt(n),i=s.charCategorizer(n);for(let o=null;;){if(n==(t?a.to:a.from)){n==r.head&&a.number!=(t?s.doc.lines:1)&&(n+=t?1:-1);break}let l=Qo(a.text,n-a.from,t)+a.from,u=a.text.slice(Math.min(n,l)-a.from,Math.max(n,l)-a.from),d=i(u);if(o!=null&&d!=o)break;(u!=" "||n!=r.head)&&(o=d),n=l}return n}),pGe=e=>dGe(e,!1),SXt=e=>dGe(e,!0),wXt=e=>gI(e,t=>{let r=e.lineBlockAt(t.head).to;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),EXt=e=>gI(e,t=>{let r=e.moveToLineBoundary(t,!1).head;return t.head>r?r:Math.max(0,t.head-1)}),kXt=e=>gI(e,t=>{let r=e.moveToLineBoundary(t,!0).head;return t.head<r?r:Math.min(e.state.doc.length,t.head+1)}),OXt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:gs.of(["",""])},range:Je.cursor(n.from)}));return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},_Xt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let s=n.from,a=e.doc.lineAt(s),i=s==a.from?s-1:Qo(a.text,s-a.from,!1)+a.from,o=s==a.to?s+1:Qo(a.text,s-a.from,!0)+a.from;return{changes:{from:i,to:o,insert:e.doc.slice(s,o).append(e.doc.slice(i,s))},range:Je.cursor(o)}});return r.changes.empty?!1:(t(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function KL(e){let t=[],r=-1;for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),a=e.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=e.doc.lineAt(n.to-1)),r>=s.number){let i=t[t.length-1];i.to=a.to,i.ranges.push(n)}else t.push({from:s.from,to:a.to,ranges:[n]});r=a.number+1}return t}function fGe(e,t,r){if(e.readOnly)return!1;let n=[],s=[];for(let a of KL(e)){if(r?a.to==e.doc.length:a.from==0)continue;let i=e.doc.lineAt(r?a.to+1:a.from-1),o=i.length+1;if(r){n.push({from:a.to,to:i.to},{from:a.from,insert:i.text+e.lineBreak});for(let l of a.ranges)s.push(Je.range(Math.min(e.doc.length,l.anchor+o),Math.min(e.doc.length,l.head+o)))}else{n.push({from:i.from,to:a.from},{from:a.to,insert:e.lineBreak+i.text});for(let l of a.ranges)s.push(Je.range(l.anchor-o,l.head-o))}}return n.length?(t(e.update({changes:n,scrollIntoView:!0,selection:Je.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const CXt=({state:e,dispatch:t})=>fGe(e,t,!1),TXt=({state:e,dispatch:t})=>fGe(e,t,!0);function hGe(e,t,r){if(e.readOnly)return!1;let n=[];for(let a of KL(e))r?n.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):n.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(n);return t(e.update({changes:s,selection:e.selection.map(s,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const AXt=({state:e,dispatch:t})=>hGe(e,t,!1),DXt=({state:e,dispatch:t})=>hGe(e,t,!0),NXt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,r=t.changes(KL(t).map(({from:s,to:a})=>(s>0?s--:a<t.doc.length&&a++,{from:s,to:a}))),n=iO(t.selection,s=>{let a;if(e.lineWrapping){let i=e.lineBlockAt(s.head),o=e.coordsAtPos(s.head,s.assoc||1);o&&(a=i.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(r);return e.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function IXt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let r=ba(e).resolveInner(t),n=r.childBefore(t),s=r.childAfter(t),a;return n&&s&&n.to<=t&&s.from>=t&&(a=n.type.prop(fn.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(n.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(n.to,s.from))?{from:n.to,to:s.from}:null}const U_e=mGe(!1),jXt=mGe(!0);function mGe(e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let n=t.changeByRange(s=>{let{from:a,to:i}=s,o=t.doc.lineAt(a),l=!e&&a==i&&IXt(t,a);e&&(a=i=(i<=o.to?o:t.doc.lineAt(i)).to);let u=new VL(t,{simulateBreak:a,simulateDoubleBreak:!!l}),d=Soe(u,a);for(d==null&&(d=Mf(/^\s*/.exec(t.doc.lineAt(a).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;l?{from:a,to:i}=l:a>o.from&&a<o.from+100&&!/\S/.test(o.text.slice(0,a))&&(a=o.from);let p=["",AA(t,d)];return l&&p.push(AA(t,u.lineIndent(o.from,-1))),{changes:{from:a,to:i,insert:gs.of(p)},range:Je.cursor(a+1+p[1].length)}});return r(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function tle(e,t){let r=-1;return e.changeByRange(n=>{let s=[];for(let i=n.from;i<=n.to;){let o=e.doc.lineAt(i);o.number>r&&(n.empty||n.to>o.from)&&(t(o,s,n),r=o.number),i=o.to+1}let a=e.changes(s);return{changes:s,range:Je.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const RXt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),n=new VL(e,{overrideIndentation:a=>{let i=r[a];return i??-1}}),s=tle(e,(a,i,o)=>{let l=Soe(n,a.from);if(l==null)return;/\S/.test(a.text)||(l=0);let u=/^\s*/.exec(a.text)[0],d=AA(e,l);(u!=d||o.from<a.from+u.length)&&(r[a.from]=l,i.push({from:a.from,to:a.from+u.length,insert:d}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},gGe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(tle(e,(r,n)=>{n.push({from:r.from,insert:e.facet(sO)})}),{userEvent:"input.indent"})),!0),yGe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(tle(e,(r,n)=>{let s=/^\s*/.exec(r.text)[0];if(!s)return;let a=Mf(s,e.tabSize),i=0,o=AA(e,Math.max(0,a-Z0(e)));for(;i<s.length&&i<o.length&&s.charCodeAt(i)==o.charCodeAt(i);)i++;n.push({from:r.from+i,to:r.from+s.length,insert:o.slice(i)})}),{userEvent:"delete.dedent"})),!0),PXt=e=>(e.setTabFocusMode(),!0),$Xt=[{key:"Ctrl-b",run:QQe,shift:tGe,preventDefault:!0},{key:"Ctrl-f",run:GQe,shift:rGe},{key:"Ctrl-p",run:XQe,shift:aGe},{key:"Ctrl-n",run:YQe,shift:iGe},{key:"Ctrl-a",run:tXt,shift:fXt},{key:"Ctrl-e",run:rXt,shift:hXt},{key:"Ctrl-d",run:uGe},{key:"Ctrl-h",run:WJ},{key:"Ctrl-k",run:wXt},{key:"Ctrl-Alt-h",run:pGe},{key:"Ctrl-o",run:OXt},{key:"Ctrl-t",run:_Xt},{key:"Ctrl-v",run:ZJ}],MXt=[{key:"ArrowLeft",run:QQe,shift:tGe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:QWt,shift:aXt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:JWt,shift:dXt,preventDefault:!0},{key:"ArrowRight",run:GQe,shift:rGe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:GWt,shift:iXt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:eXt,shift:pXt,preventDefault:!0},{key:"ArrowUp",run:XQe,shift:aGe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:L_e,shift:B_e},{mac:"Ctrl-ArrowUp",run:P_e,shift:$_e},{key:"ArrowDown",run:YQe,shift:iGe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:F_e,shift:z_e},{mac:"Ctrl-ArrowDown",run:ZJ,shift:M_e},{key:"PageUp",run:P_e,shift:$_e},{key:"PageDown",run:ZJ,shift:M_e},{key:"Home",run:KWt,shift:uXt,preventDefault:!0},{key:"Mod-Home",run:L_e,shift:B_e},{key:"End",run:YWt,shift:cXt,preventDefault:!0},{key:"Mod-End",run:F_e,shift:z_e},{key:"Enter",run:U_e,shift:U_e},{key:"Mod-a",run:mXt},{key:"Backspace",run:WJ,shift:WJ,preventDefault:!0},{key:"Delete",run:uGe,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:pGe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:SXt,preventDefault:!0},{mac:"Mod-Backspace",run:EXt,preventDefault:!0},{mac:"Mod-Delete",run:kXt,preventDefault:!0}].concat($Xt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),LXt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:WWt,shift:oXt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:XWt,shift:lXt},{key:"Alt-ArrowUp",run:CXt},{key:"Shift-Alt-ArrowUp",run:AXt},{key:"Alt-ArrowDown",run:TXt},{key:"Shift-Alt-ArrowDown",run:DXt},{key:"Mod-Alt-ArrowUp",run:bXt},{key:"Mod-Alt-ArrowDown",run:vXt},{key:"Escape",run:xXt},{key:"Mod-Enter",run:jXt},{key:"Alt-l",mac:"Ctrl-l",run:gXt},{key:"Mod-i",run:yXt,preventDefault:!0},{key:"Mod-[",run:yGe},{key:"Mod-]",run:gGe},{key:"Mod-Alt-\\",run:RXt},{key:"Shift-Mod-k",run:NXt},{key:"Shift-Mod-\\",run:sXt},{key:"Mod-/",run:CWt},{key:"Alt-A",run:AWt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:PXt}].concat(MXt),FXt={key:"Tab",run:gGe,shift:yGe},V_e=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class KE{constructor(t,r,n=0,s=t.length,a,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,s),this.bufferStart=n,this.normalize=a?o=>a(V_e(o)):V_e,this.query=this.normalize(r)}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 ru(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 r=noe(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=Dh(t);let s=this.normalize(r);if(s.length)for(let a=0,i=n;;a++){let o=s.charCodeAt(a),l=this.match(o,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(l)return this.value=l,this;break}i==n&&a<r.length&&r.charCodeAt(a)==o&&i++}}}match(t,r,n){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],o=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?s={from:this.matches[a+1],to:n}:(this.matches[a]++,o=!0)),o||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?s={from:r,to:n}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(KE.prototype[Symbol.iterator]=function(){return this});const bGe={from:-1,to:-1,match:/.*/.exec("")},rle="gm"+(/x/.unicode==null?"":"u");class vGe{constructor(t,r,n,s=0,a=t.length){if(this.text=t,this.to=a,this.curLine="",this.done=!1,this.value=bGe,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new xGe(t,r,n,s,a);this.re=new RegExp(r,rle+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=t.iter();let i=t.lineAt(s);this.curLineStart=i.from,this.matchPos=Z3(t,s),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 r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,s=n+r[0].length;if(this.matchPos=Z3(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},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 xG=new WeakMap;class cE{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,n){let s=xG.get(t);if(!s||s.from>=n||s.to<=r){let o=new cE(r,t.sliceString(r,n));return xG.set(t,o),o}if(s.from==r&&s.to==n)return s;let{text:a,from:i}=s;return i>r&&(a=t.sliceString(r,i)+a,i=r),s.to<n&&(a+=t.sliceString(s.to,n)),xG.set(t,new cE(i,a)),new cE(r,a.slice(r-i,n-i))}}class xGe{constructor(t,r,n,s,a){this.text=t,this.to=a,this.done=!1,this.value=bGe,this.matchPos=Z3(t,s),this.re=new RegExp(r,rle+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=cE.get(t,s,this.chunkEnd(s+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,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t&&(this.re.lastIndex=t+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,s=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this.matchPos=Z3(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=cE.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(vGe.prototype[Symbol.iterator]=xGe.prototype[Symbol.iterator]=function(){return this});function BXt(e){try{return new RegExp(e,rle),!0}catch{return!1}}function Z3(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}function XJ(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),r=wa("input",{class:"cm-textfield",name:"line",value:t}),n=wa("form",{class:"cm-gotoLine",onkeydown:a=>{a.keyCode==27?(a.preventDefault(),e.dispatch({effects:vT.of(!1)}),e.focus()):a.keyCode==13&&(a.preventDefault(),s())},onsubmit:a=>{a.preventDefault(),s()}},wa("label",e.state.phrase("Go to line"),": ",r)," ",wa("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),wa("button",{name:"close",onclick:()=>{e.dispatch({effects:vT.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]));function s(){let a=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.value);if(!a)return;let{state:i}=e,o=i.doc.lineAt(i.selection.main.head),[,l,u,d,p]=a,f=d?+d.slice(1):0,h=u?+u:o.number;if(u&&p){let b=h/100;l&&(b=b*(l=="-"?-1:1)+o.number/i.doc.lines),h=Math.round(i.doc.lines*b)}else u&&l&&(h=h*(l=="-"?-1:1)+o.number);let m=i.doc.line(Math.max(1,Math.min(i.doc.lines,h))),g=Je.cursor(m.from+Math.max(0,Math.min(f,m.length)));e.dispatch({effects:[vT.of(!1),ht.scrollIntoView(g.from,{y:"center"})],selection:g}),e.focus()}return{dom:n}}const vT=en.define(),q_e=Ji.define({create(){return!0},update(e,t){for(let r of t.effects)r.is(vT)&&(e=r.value);return e},provide:e=>TA.from(e,t=>t?XJ:null)}),zXt=e=>{let t=CA(e,XJ);if(!t){let r=[vT.of(!0)];e.state.field(q_e,!1)==null&&r.push(en.appendConfig.of([q_e,UXt])),e.dispatch({effects:r}),t=CA(e,XJ)}return t&&t.dom.querySelector("input").select(),!0},UXt=ht.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"}}}),VXt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},qXt=Xt.define({combine(e){return Am(e,VXt,{highlightWordAroundCursor:(t,r)=>t||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function HXt(e){return[XXt,WXt]}const QXt=rr.mark({class:"cm-selectionMatch"}),GXt=rr.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function H_e(e,t,r,n){return(r==0||e(t.sliceDoc(r-1,r))!=li.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=li.Word)}function ZXt(e,t,r,n){return e(t.sliceDoc(r,r+1))==li.Word&&e(t.sliceDoc(n-1,n))==li.Word}const WXt=xi.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(qXt),{state:r}=e,n=r.selection;if(n.ranges.length>1)return rr.none;let s=n.main,a,i=null;if(s.empty){if(!t.highlightWordAroundCursor)return rr.none;let l=r.wordAt(s.head);if(!l)return rr.none;i=r.charCategorizer(s.head),a=r.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<t.minSelectionLength||l>200)return rr.none;if(t.wholeWords){if(a=r.sliceDoc(s.from,s.to),i=r.charCategorizer(s.head),!(H_e(i,r,s.from,s.to)&&ZXt(i,r,s.from,s.to)))return rr.none}else if(a=r.sliceDoc(s.from,s.to),!a)return rr.none}let o=[];for(let l of e.visibleRanges){let u=new KE(r.doc,a,l.from,l.to);for(;!u.next().done;){let{from:d,to:p}=u.value;if((!i||H_e(i,r,d,p))&&(s.empty&&d<=s.from&&p>=s.to?o.push(GXt.range(d,p)):(d>=s.to||p<=s.from)&&o.push(QXt.range(d,p)),o.length>t.maxMatches))return rr.none}}return rr.set(o)}},{decorations:e=>e.decorations}),XXt=ht.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),YXt=({state:e,dispatch:t})=>{let{selection:r}=e,n=Je.create(r.ranges.map(s=>e.wordAt(s.head)||Je.cursor(s.head)),r.mainIndex);return n.eq(r)?!1:(t(e.update({selection:n})),!0)};function KXt(e,t){let{main:r,ranges:n}=e.selection,s=e.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let i=!1,o=new KE(e.doc,t,n[n.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new KE(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),i=!0}else{if(i&&n.some(l=>l.from==o.value.from))continue;if(a){let l=e.wordAt(o.value.from);if(!l||l.from!=o.value.from||l.to!=o.value.to)continue}return o.value}}const JXt=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(a=>a.from===a.to))return YXt({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=n))return!1;let s=KXt(e,n);return s?(t(e.update({selection:e.selection.addRange(Je.range(s.from,s.to),!1),effects:ht.scrollIntoView(s.to)})),!0):!1},oO=Xt.define({combine(e){return Am(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new dYt(t),scrollToMatch:t=>ht.scrollIntoView(t)})}});class SGe{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||BXt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
161
161
  `:n=="r"?"\r":n=="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 nYt(this):new tYt(this)}getCursor(t,r=0,n){let s=t.doc?t:Zn.create({doc:t});return n==null&&(n=s.doc.length),this.regexp?yw(this,s,r,n):gw(this,s,r,n)}}class wGe{constructor(t){this.spec=t}}function gw(e,t,r,n){return new KE(t.doc,e.unquoted,r,n,e.caseSensitive?void 0:s=>s.toLowerCase(),e.wholeWord?eYt(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function eYt(e,t){return(r,n,s,a)=>((a>r||a+s.length<n)&&(a=Math.max(0,r-2),s=e.sliceString(a,Math.min(e.length,n+2))),(t(W3(s,r-a))!=li.Word||t(X3(s,r-a))!=li.Word)&&(t(X3(s,n-a))!=li.Word||t(W3(s,n-a))!=li.Word))}class tYt extends wGe{constructor(t){super(t)}nextMatch(t,r,n){let s=gw(this.spec,t,n,t.doc.length).nextOverlapping();if(s.done){let a=Math.min(t.doc.length,r+this.spec.unquoted.length);s=gw(this.spec,t,0,a).nextOverlapping()}return s.done||s.value.from==r&&s.value.to==n?null:s.value}prevMatchInRange(t,r,n){for(let s=n;;){let a=Math.max(r,s-1e4-this.spec.unquoted.length),i=gw(this.spec,t,a,s),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(a==r)return null;s-=1e4}}prevMatch(t,r,n){let s=this.prevMatchInRange(t,0,r);return s||(s=this.prevMatchInRange(t,Math.max(0,n-this.spec.unquoted.length),t.doc.length)),s&&(s.from!=r||s.to!=n)?s:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,r){let n=gw(this.spec,t,0,t.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(t,r,n,s){let a=gw(this.spec,t,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}function yw(e,t,r,n){return new vGe(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?rYt(t.charCategorizer(t.selection.main.head)):void 0},r,n)}function W3(e,t){return e.slice(Qo(e,t,!1),t)}function X3(e,t){return e.slice(t,Qo(e,t))}function rYt(e){return(t,r,n)=>!n[0].length||(e(W3(n.input,n.index))!=li.Word||e(X3(n.input,n.index))!=li.Word)&&(e(X3(n.input,n.index+n[0].length))!=li.Word||e(W3(n.input,n.index+n[0].length))!=li.Word)}class nYt extends wGe{nextMatch(t,r,n){let s=yw(this.spec,t,n,t.doc.length).next();return s.done&&(s=yw(this.spec,t,0,r).next()),s.done?null:s.value}prevMatchInRange(t,r,n){for(let s=1;;s++){let a=Math.max(r,n-s*1e4),i=yw(this.spec,t,a,n),o=null;for(;!i.next().done;)o=i.value;if(o&&(a==r||o.from>a+10))return o;if(a==r)return null}}prevMatch(t,r,n){return this.prevMatchInRange(t,0,r)||this.prevMatchInRange(t,n,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return t.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let a=+n.slice(0,s);if(a>0&&a<t.match.length)return t.match[a]+n.slice(s)}return r})}matchAll(t,r){let n=yw(this.spec,t,0,t.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(t,r,n,s){let a=yw(this.spec,t,Math.max(0,r-250),Math.min(n+250,t.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}const FA=en.define(),nle=en.define(),Hb=Ji.define({create(e){return new SG(YJ(e).create(),null)},update(e,t){for(let r of t.effects)r.is(FA)?e=new SG(r.value.create(),e.panel):r.is(nle)&&(e=new SG(e.query,r.value?sle:null));return e},provide:e=>TA.from(e,t=>t.panel)});class SG{constructor(t,r){this.query=t,this.panel=r}}const sYt=rr.mark({class:"cm-searchMatch"}),aYt=rr.mark({class:"cm-searchMatch cm-searchMatch-selected"}),iYt=xi.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Hb))}update(e){let t=e.state.field(Hb);(t!=e.startState.field(Hb)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return rr.none;let{view:r}=this,n=new bu;for(let s=0,a=r.visibleRanges,i=a.length;s<i;s++){let{from:o,to:l}=a[s];for(;s<i-1&&l>a[s+1].from-500;)l=a[++s].to;e.highlight(r.state,o,l,(u,d)=>{let p=r.state.selection.ranges.some(f=>f.from==u&&f.to==d);n.add(u,d,p?aYt:sYt)})}return n.finish()}},{decorations:e=>e.decorations});function yI(e){return t=>{let r=t.state.field(Hb,!1);return r&&r.query.spec.valid?e(t,r):OGe(t)}}const Y3=yI((e,{query:t})=>{let{to:r}=e.state.selection.main,n=t.nextMatch(e.state,r,r);if(!n)return!1;let s=Je.single(n.from,n.to),a=e.state.facet(oO);return e.dispatch({selection:s,effects:[ale(e,n),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),kGe(e),!0}),K3=yI((e,{query:t})=>{let{state:r}=e,{from:n}=r.selection.main,s=t.prevMatch(r,n,n);if(!s)return!1;let a=Je.single(s.from,s.to),i=e.state.facet(oO);return e.dispatch({selection:a,effects:[ale(e,s),i.scrollToMatch(a.main,e)],userEvent:"select.search"}),kGe(e),!0}),oYt=yI((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:Je.create(r.map(n=>Je.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),lYt=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:s}=r.main,a=[],i=0;for(let o=new KE(e.doc,e.sliceDoc(n,s));!o.next().done;){if(a.length>1e3)return!1;o.value.from==n&&(i=a.length),a.push(Je.range(o.value.from,o.value.to))}return t(e.update({selection:Je.create(a,i),userEvent:"select.search.matches"})),!0},Q_e=yI((e,{query:t})=>{let{state:r}=e,{from:n,to:s}=r.selection.main;if(r.readOnly)return!1;let a=t.nextMatch(r,n,n);if(!a)return!1;let i=a,o=[],l,u,d=[];i.from==n&&i.to==s&&(u=r.toText(t.getReplacement(i)),o.push({from:i.from,to:i.to,insert:u}),i=t.nextMatch(r,i.from,i.to),d.push(ht.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let p=e.state.changes(o);return i&&(l=Je.single(i.from,i.to).map(p),d.push(ale(e,i)),d.push(r.facet(oO).scrollToMatch(l.main,e))),e.dispatch({changes:p,selection:l,effects:d,userEvent:"input.replace"}),!0}),cYt=yI((e,{query:t})=>{if(e.state.readOnly)return!1;let r=t.matchAll(e.state,1e9).map(s=>{let{from:a,to:i}=s;return{from:a,to:i,insert:t.getReplacement(s)}});if(!r.length)return!1;let n=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:ht.announce.of(n),userEvent:"input.replace.all"}),!0});function sle(e){return e.state.facet(oO).createPanel(e)}function YJ(e,t){var r,n,s,a,i;let o=e.selection.main,l=o.empty||o.to>o.from+100?"":e.sliceDoc(o.from,o.to);if(t&&!l)return t;let u=e.facet(oO);return new SGe({search:((r=t?.literal)!==null&&r!==void 0?r:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=t?.caseSensitive)!==null&&n!==void 0?n:u.caseSensitive,literal:(s=t?.literal)!==null&&s!==void 0?s:u.literal,regexp:(a=t?.regexp)!==null&&a!==void 0?a:u.regexp,wholeWord:(i=t?.wholeWord)!==null&&i!==void 0?i:u.wholeWord})}function EGe(e){let t=CA(e,sle);return t&&t.dom.querySelector("[main-field]")}function kGe(e){let t=EGe(e);t&&t==e.root.activeElement&&t.select()}const OGe=e=>{let t=e.state.field(Hb,!1);if(t&&t.panel){let r=EGe(e);if(r&&r!=e.root.activeElement){let n=YJ(e.state,t.query.spec);n.valid&&e.dispatch({effects:FA.of(n)}),r.focus(),r.select()}}else e.dispatch({effects:[nle.of(!0),t?FA.of(YJ(e.state,t.query.spec)):en.appendConfig.of(fYt)]});return!0},_Ge=e=>{let t=e.state.field(Hb,!1);if(!t||!t.panel)return!1;let r=CA(e,sle);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:nle.of(!1)}),!0},uYt=[{key:"Mod-f",run:OGe,scope:"editor search-panel"},{key:"F3",run:Y3,shift:K3,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Y3,shift:K3,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:_Ge,scope:"editor search-panel"},{key:"Mod-Shift-l",run:lYt},{key:"Mod-Alt-g",run:zXt},{key:"Mod-d",run:JXt,preventDefault:!0}];class dYt{constructor(t){this.view=t;let r=this.query=t.state.field(Hb).query.spec;this.commit=this.commit.bind(this),this.searchField=wa("input",{value:r.search,placeholder:Hu(t,"Find"),"aria-label":Hu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=wa("input",{value:r.replace,placeholder:Hu(t,"Replace"),"aria-label":Hu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=wa("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=wa("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=wa("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(s,a,i){return wa("button",{class:"cm-button",name:s,onclick:a,type:"button"},i)}this.dom=wa("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>Y3(t),[Hu(t,"next")]),n("prev",()=>K3(t),[Hu(t,"previous")]),n("select",()=>oYt(t),[Hu(t,"all")]),wa("label",null,[this.caseField,Hu(t,"match case")]),wa("label",null,[this.reField,Hu(t,"regexp")]),wa("label",null,[this.wordField,Hu(t,"by word")]),...t.state.readOnly?[]:[wa("br"),this.replaceField,n("replace",()=>Q_e(t),[Hu(t,"replace")]),n("replaceAll",()=>cYt(t),[Hu(t,"replace all")])],wa("button",{name:"close",onclick:()=>_Ge(t),"aria-label":Hu(t,"close"),type:"button"},["×"])])}commit(){let t=new SGe({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:FA.of(t)}))}keydown(t){BVt(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?K3:Y3)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Q_e(this.view))}update(t){for(let r of t.transactions)for(let n of r.effects)n.is(FA)&&!n.value.eq(this.query)&&this.setQuery(n.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(oO).top}}function Hu(e,t){return e.state.phrase(t)}const x2=30,S2=/[\s\.,:;?!]/;function ale(e,{from:t,to:r}){let n=e.state.doc.lineAt(t),s=e.state.doc.lineAt(r).to,a=Math.max(n.from,t-x2),i=Math.min(s,r+x2),o=e.state.sliceDoc(a,i);if(a!=n.from){for(let l=0;l<x2;l++)if(!S2.test(o[l+1])&&S2.test(o[l])){o=o.slice(l);break}}if(i!=s){for(let l=o.length-1;l>o.length-x2;l--)if(!S2.test(o[l-1])&&S2.test(o[l])){o=o.slice(0,l);break}}return ht.announce.of(`${e.state.phrase("current match")}. ${o} ${e.state.phrase("on line")} ${n.number}.`)}const pYt=ht.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"}}),fYt=[Hb,Wf.low(iYt),pYt];class G_e{constructor(t,r,n){this.from=t,this.to=r,this.diagnostic=n}}class e0{constructor(t,r,n){this.diagnostics=t,this.panel=r,this.selected=n}static init(t,r,n){let s=n.facet(BA).markerFilter;s&&(t=s(t,n));let a=t.slice().sort((d,p)=>d.from-p.from||d.to-p.to),i=new bu,o=[],l=0;for(let d=0;;){let p=d==a.length?null:a[d];if(!p&&!o.length)break;let f,h;for(o.length?(f=l,h=o.reduce((g,b)=>Math.min(g,b.to),p&&p.from>f?p.from:1e8)):(f=p.from,h=p.to,o.push(p),d++);d<a.length;){let g=a[d];if(g.from==f&&(g.to>g.from||g.to==f))o.push(g),d++,h=Math.min(g.to,h);else{h=Math.min(g.from,h);break}}let m=_Yt(o);if(o.some(g=>g.from==g.to||g.from==g.to-1&&n.doc.lineAt(g.from).to==g.from))i.add(f,f,rr.widget({widget:new wYt(m),diagnostics:o.slice()}));else{let g=o.reduce((b,v)=>v.markClass?b+" "+v.markClass:b,"");i.add(f,h,rr.mark({class:"cm-lintRange cm-lintRange-"+m+g,diagnostics:o.slice(),inclusiveEnd:o.some(b=>b.to>h)}))}l=h;for(let g=0;g<o.length;g++)o[g].to<=l&&o.splice(g--,1)}let u=i.finish();return new e0(u,r,JE(u))}}function JE(e,t=null,r=0){let n=null;return e.between(r,1e9,(s,a,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!n)n=new G_e(s,a,t||i.diagnostics[0]);else{if(i.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new G_e(n.from,a,n.diagnostic)}}),n}function hYt(e,t){let r=t.pos,n=t.end||r,s=e.state.facet(BA).hideOn(e,r,n);if(s!=null)return s;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(i=>i.is(CGe))||e.changes.touchesRange(a.from,Math.max(a.to,n)))}function mYt(e,t){return e.field(od,!1)?t:t.concat(en.appendConfig.of(CYt))}const CGe=en.define(),ile=en.define(),TGe=en.define(),od=Ji.define({create(){return new e0(rr.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let r=e.diagnostics.map(t.changes),n=null,s=e.panel;if(e.selected){let a=t.changes.mapPos(e.selected.from,1);n=JE(r,e.selected.diagnostic,a)||JE(r,null,a)}!r.size&&s&&t.state.facet(BA).autoPanel&&(s=null),e=new e0(r,s,n)}for(let r of t.effects)if(r.is(CGe)){let n=t.state.facet(BA).autoPanel?r.value.length?zA.open:null:e.panel;e=e0.init(r.value,n,t.state)}else r.is(ile)?e=new e0(e.diagnostics,r.value?zA.open:null,e.selected):r.is(TGe)&&(e=new e0(e.diagnostics,e.panel,r.value));return e},provide:e=>[TA.from(e,t=>t.panel),ht.decorations.from(e,t=>t.diagnostics)]}),gYt=rr.mark({class:"cm-lintRange cm-lintRange-active"});function yYt(e,t,r){let{diagnostics:n}=e.state.field(od),s,a=-1,i=-1;n.between(t-(r<0?1:0),t+(r>0?1:0),(l,u,{spec:d})=>{if(t>=l&&t<=u&&(l==u||(t>l||r>0)&&(t<u||r<0)))return s=d.diagnostics,a=l,i=u,!1});let o=e.state.facet(BA).tooltipFilter;return s&&o&&(s=o(s,e.state)),s?{pos:a,end:i,above:e.state.doc.lineAt(a).to<i,create(){return{dom:bYt(e,s)}}}:null}function bYt(e,t){return wa("ul",{class:"cm-tooltip-lint"},t.map(r=>DGe(e,r,!1)))}const vYt=e=>{let t=e.state.field(od,!1);(!t||!t.panel)&&e.dispatch({effects:mYt(e.state,[ile.of(!0)])});let r=CA(e,zA.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},Z_e=e=>{let t=e.state.field(od,!1);return!t||!t.panel?!1:(e.dispatch({effects:ile.of(!1)}),!0)},xYt=e=>{let t=e.state.field(od,!1);if(!t)return!1;let r=e.state.selection.main,n=t.diagnostics.iter(r.to+1);return!n.value&&(n=t.diagnostics.iter(0),!n.value||n.from==r.from&&n.to==r.to)?!1:(e.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},SYt=[{key:"Mod-Shift-m",run:vYt,preventDefault:!0},{key:"F8",run:xYt}],BA=Xt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Am(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:W_e,tooltipFilter:W_e,needsRefresh:(t,r)=>t?r?n=>t(n)||r(n):t:r,hideOn:(t,r)=>t?r?(n,s,a)=>t(n,s,a)||r(n,s,a):t:r,autoPanel:(t,r)=>t||r})}}});function W_e(e,t){return e?t?(r,n)=>t(e(r,n),n):e:t}function AGe(e){let t=[];if(e)e:for(let{name:r}of e){for(let n=0;n<r.length;n++){let s=r[n];if(/[a-zA-Z]/.test(s)&&!t.some(a=>a.toLowerCase()==s.toLowerCase())){t.push(s);continue e}}t.push("")}return t}function DGe(e,t,r){var n;let s=r?AGe(t.actions):[];return wa("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},wa("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(n=t.actions)===null||n===void 0?void 0:n.map((a,i)=>{let o=!1,l=h=>{if(h.preventDefault(),o)return;o=!0;let m=JE(e.state.field(od).diagnostics,t);m&&a.apply(e,m.from,m.to)},{name:u}=a,d=s[i]?u.indexOf(s[i]):-1,p=d<0?u:[u.slice(0,d),wa("u",u.slice(d,d+1)),u.slice(d+1)],f=a.markClass?" "+a.markClass:"";return wa("button",{type:"button",class:"cm-diagnosticAction"+f,onclick:l,onmousedown:l,"aria-label":` Action: ${u}${d<0?"":` (access key "${s[i]})"`}.`},p)}),t.source&&wa("div",{class:"cm-diagnosticSource"},t.source))}class wYt extends $d{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return wa("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class X_e{constructor(t,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=DGe(t,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class zA{constructor(t){this.view=t,this.items=[];let r=s=>{if(s.keyCode==27)Z_e(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],i=AGe(a.actions);for(let o=0;o<i.length;o++)if(i[o].toUpperCase().charCodeAt(0)==s.keyCode){let l=JE(this.view.state.field(od).diagnostics,a);l&&a.actions[o].apply(t,l.from,l.to)}}else return;s.preventDefault()},n=s=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(s.target)&&this.moveSelection(a)};this.list=wa("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:n}),this.dom=wa("div",{class:"cm-panel-lint"},this.list,wa("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(od).selected;if(!t)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==t.diagnostic)return r;return-1}update(){let{diagnostics:t,selected:r}=this.view.state.field(od),n=0,s=!1,a=null,i=new Set;for(t.between(0,this.view.state.doc.length,(o,l,{spec:u})=>{for(let d of u.diagnostics){if(i.has(d))continue;i.add(d);let p=-1,f;for(let h=n;h<this.items.length;h++)if(this.items[h].diagnostic==d){p=h;break}p<0?(f=new X_e(this.view,d),this.items.splice(n,0,f),s=!0):(f=this.items[p],p>n&&(this.items.splice(n,p-n),s=!0)),r&&f.diagnostic==r.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),a=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!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")})),s=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let u=l.height/this.list.offsetHeight;o.top<l.top?this.list.scrollTop-=(l.top-o.top)/u:o.bottom>l.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let t=this.list.firstChild;function r(){let n=t;t=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;t!=n.dom;)r();t=n.dom.nextSibling}else this.list.insertBefore(n.dom,t);for(;t;)r()}moveSelection(t){if(this.selectedIndex<0)return;let r=this.view.state.field(od),n=JE(r.diagnostics,this.items[t].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:TGe.of(n)})}static open(t){return new zA(t)}}function EYt(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 w2(e){return EYt(`<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 kYt=ht.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:w2("#d11")},".cm-lintRange-warning":{backgroundImage:w2("orange")},".cm-lintRange-info":{backgroundImage:w2("#999")},".cm-lintRange-hint":{backgroundImage:w2("#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 OYt(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function _Yt(e){let t="hint",r=1;for(let n of e){let s=OYt(n.severity);s>r&&(r=s,t=n.severity)}return t}const CYt=[od,ht.decorations.compute([od],e=>{let{selected:t,panel:r}=e.field(od);return!t||!r||t.from==t.to?rr.none:rr.set([gYt.range(t.from,t.to)])}),Cqt(yYt,{hideOn:hYt}),kYt];var Y_e=function(t){t===void 0&&(t={});var{crosshairCursor:r=!1}=t,n=[];t.closeBracketsKeymap!==!1&&(n=n.concat(wQt)),t.defaultKeymap!==!1&&(n=n.concat(LXt)),t.searchKeymap!==!1&&(n=n.concat(uYt)),t.historyKeymap!==!1&&(n=n.concat(HWt)),t.foldKeymap!==!1&&(n=n.concat(oHt)),t.completionKeymap!==!1&&(n=n.concat(yHe)),t.lintKeymap!==!1&&(n=n.concat(SYt));var s=[];return t.lineNumbers!==!1&&s.push(Mqt()),t.highlightActiveLineGutter!==!1&&s.push(Bqt()),t.highlightSpecialChars!==!1&&s.push(rqt()),t.history!==!1&&s.push($Wt()),t.foldGutter!==!1&&s.push(dHt()),t.drawSelection!==!1&&s.push(QVt()),t.dropCursor!==!1&&s.push(YVt()),t.allowMultipleSelections!==!1&&s.push(Zn.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&s.push(Jqt()),t.syntaxHighlighting!==!1&&s.push(HL(mHt,{fallback:!0})),t.bracketMatching!==!1&&s.push(wHt()),t.closeBrackets!==!1&&s.push(bQt()),t.autocompletion!==!1&&s.push(gHe()),t.rectangularSelection!==!1&&s.push(gqt()),r!==!1&&s.push(vqt()),t.highlightActiveLine!==!1&&s.push(lqt()),t.highlightSelectionMatches!==!1&&s.push(HXt()),t.tabSize&&typeof t.tabSize=="number"&&s.push(sO.of(" ".repeat(t.tabSize))),s.concat([nO.of(n.flat())]).filter(Boolean)};const TYt="#e5c07b",K_e="#e06c75",AYt="#56b6c2",DYt="#ffffff",f$="#abb2bf",KJ="#7d8799",NYt="#61afef",IYt="#98c379",J_e="#d19a66",jYt="#c678dd",RYt="#21252b",eCe="#2c313a",tCe="#282c34",wG="#353a42",PYt="#3E4451",rCe="#528bff",$Yt=ht.theme({"&":{color:f$,backgroundColor:tCe},".cm-content":{caretColor:rCe},".cm-cursor, .cm-dropCursor":{borderLeftColor:rCe},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:PYt},".cm-panels":{backgroundColor:RYt,color:f$},".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:tCe,color:KJ,border:"none"},".cm-activeLineGutter":{backgroundColor:eCe},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:wG},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:wG,borderBottomColor:wG},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:eCe,color:f$}}},{dark:!0}),MYt=M1.define([{tag:re.keyword,color:jYt},{tag:[re.name,re.deleted,re.character,re.propertyName,re.macroName],color:K_e},{tag:[re.function(re.variableName),re.labelName],color:NYt},{tag:[re.color,re.constant(re.name),re.standard(re.name)],color:J_e},{tag:[re.definition(re.name),re.separator],color:f$},{tag:[re.typeName,re.className,re.number,re.changed,re.annotation,re.modifier,re.self,re.namespace],color:TYt},{tag:[re.operator,re.operatorKeyword,re.url,re.escape,re.regexp,re.link,re.special(re.string)],color:AYt},{tag:[re.meta,re.comment],color:KJ},{tag:re.strong,fontWeight:"bold"},{tag:re.emphasis,fontStyle:"italic"},{tag:re.strikethrough,textDecoration:"line-through"},{tag:re.link,color:KJ,textDecoration:"underline"},{tag:re.heading,fontWeight:"bold",color:K_e},{tag:[re.atom,re.bool,re.special(re.variableName)],color:J_e},{tag:[re.processingInstruction,re.string,re.inserted],color:IYt},{tag:re.invalid,color:DYt}]),LYt=[$Yt,HL(MYt)];var FYt=ht.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),BYt=function(t){t===void 0&&(t={});var{indentWithTab:r=!0,editable:n=!0,readOnly:s=!1,theme:a="light",placeholder:i="",basicSetup:o=!0}=t,l=[];switch(r&&l.unshift(nO.of([FXt])),o&&(typeof o=="boolean"?l.unshift(Y_e()):l.unshift(Y_e(o))),i&&l.unshift(pqt(i)),a){case"light":l.push(FYt);break;case"dark":l.push(LYt);break;case"none":break;default:l.push(a);break}return n===!1&&l.push(ht.editable.of(!1)),s&&l.push(Zn.readOnly.of(!0)),[...l]},zYt=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 UYt{constructor(t,r){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=r,this.timeoutMS=r,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(r=>{try{r()}catch(n){console.error("TimeoutLatch callback error:",n)}})}}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 nCe=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 EG=null,VYt=()=>typeof window>"u"?new nCe:(EG||(EG=new nCe),EG),sCe=Tm.define(),qYt=200,HYt=[];function QYt(e){var{value:t,selection:r,onChange:n,onStatistics:s,onCreateEditor:a,onUpdate:i,extensions:o=HYt,autoFocus:l,theme:u="light",height:d=null,minHeight:p=null,maxHeight:f=null,width:h=null,minWidth:m=null,maxWidth:g=null,placeholder:b="",editable:v=!0,readOnly:S=!1,indentWithTab:w=!0,basicSetup:k=!0,root:_,initialState:C}=e,[T,A]=E.useState(),[N,I]=E.useState(),[R,$]=E.useState(),F=E.useState(()=>({current:null}))[0],L=E.useState(()=>({current:null}))[0],z=ht.theme({"&":{height:d,minHeight:p,maxHeight:f,width:h,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),q=ht.updateListener.of(G=>{if(G.docChanged&&typeof n=="function"&&!G.transactions.some(U=>U.annotation(sCe))){F.current?F.current.reset():(F.current=new UYt(()=>{if(L.current){var U=L.current;L.current=null,U()}F.current=null},qYt),VYt().add(F.current));var M=G.state.doc,X=M.toString();n(X,G)}s&&s(zYt(G))}),H=BYt({theme:u,editable:v,readOnly:S,placeholder:b,indentWithTab:w,basicSetup:k}),V=[q,z,...H];return i&&typeof i=="function"&&V.push(ht.updateListener.of(i)),V=V.concat(o),E.useLayoutEffect(()=>{if(T&&!R){var G={doc:t,selection:r,extensions:V},M=C?Zn.fromJSON(C.json,G,C.fields):Zn.create(G);if($(M),!N){var X=new ht({state:M,parent:T,root:_});I(X),a&&a(X,M)}}return()=>{N&&($(void 0),I(void 0))}},[T,R]),E.useEffect(()=>{e.container&&A(e.container)},[e.container]),E.useEffect(()=>()=>{N&&(N.destroy(),I(void 0)),F.current&&(F.current.cancel(),F.current=null)},[N]),E.useEffect(()=>{l&&N&&N.focus()},[l,N]),E.useEffect(()=>{N&&N.dispatch({effects:en.reconfigure.of(V)})},[u,o,d,p,f,h,m,g,b,v,S,w,k,n,i]),E.useEffect(()=>{if(t!==void 0){var G=N?N.state.doc.toString():"";if(N&&t!==G){var M=F.current&&!F.current.isDone,X=()=>{N&&t!==N.state.doc.toString()&&N.dispatch({changes:{from:0,to:N.state.doc.toString().length,insert:t||""},annotations:[sCe.of(!0)]})};M?L.current=X:X()}}},[t,N]),{state:R,setState:$,view:N,setView:I,container:T,setContainer:A}}var GYt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Sd=E.forwardRef((e,t)=>{var{className:r,value:n="",selection:s,extensions:a=[],onChange:i,onStatistics:o,onCreateEditor:l,onUpdate:u,autoFocus:d,theme:p="light",height:f,minHeight:h,maxHeight:m,width:g,minWidth:b,maxWidth:v,basicSetup:S,placeholder:w,indentWithTab:k,editable:_,readOnly:C,root:T,initialState:A}=e,N=nie(e,GYt),I=E.useRef(null),{state:R,view:$,container:F,setContainer:L}=QYt({root:T,value:n,autoFocus:d,theme:p,height:f,minHeight:h,maxHeight:m,width:g,minWidth:b,maxWidth:v,basicSetup:S,placeholder:w,indentWithTab:k,editable:_,readOnly:C,selection:s,onChange:i,onStatistics:o,onCreateEditor:l,onUpdate:u,extensions:a,initialState:A});E.useImperativeHandle(t,()=>({editor:I.current,state:R,view:$}),[I,F,R,$]);var z=E.useCallback(H=>{I.current=H,L(H)},[L]);if(typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var q=typeof p=="string"?"cm-theme-"+p:"cm-theme";return c.jsx("div",lm({ref:z,className:""+q+(r?" "+r:"")},N))});Sd.displayName="CodeMirror";function ZYt(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const WYt=e=>{switch(e){case"success":return KYt;case"info":return eKt;case"warning":return JYt;case"error":return tKt;default:return null}},XYt=Array(12).fill(0),YYt=({visible:e,className:t})=>Ee.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Ee.createElement("div",{className:"sonner-spinner"},XYt.map((r,n)=>Ee.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),KYt=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ee.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"})),JYt=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ee.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"})),eKt=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ee.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"})),tKt=Ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ee.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"})),rKt=Ee.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"},Ee.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ee.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),nKt=()=>{const[e,t]=Ee.useState(document.hidden);return Ee.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let JJ=1;class sKt{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...s}=t,a=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:JJ++,i=this.toasts.find(l=>l.id===a),o=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...t,id:a,title:n}),{...l,...t,id:a,dismissible:o,title:n}):l):this.addToast({title:n,...s,dismissible:o,id:a}),a},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let a=n!==void 0,i;const o=s.then(async u=>{if(i=["resolve",u],Ee.isValidElement(u))a=!1,this.create({id:n,type:"default",message:u});else if(iKt(u)&&!u.ok){a=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,f=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description,m=typeof p=="object"&&!Ee.isValidElement(p)?p:{message:p};this.create({id:n,type:"error",description:f,...m})}else if(u instanceof Error){a=!1;const p=typeof r.error=="function"?await r.error(u):r.error,f=typeof r.description=="function"?await r.description(u):r.description,m=typeof p=="object"&&!Ee.isValidElement(p)?p:{message:p};this.create({id:n,type:"error",description:f,...m})}else if(r.success!==void 0){a=!1;const p=typeof r.success=="function"?await r.success(u):r.success,f=typeof r.description=="function"?await r.description(u):r.description,m=typeof p=="object"&&!Ee.isValidElement(p)?p:{message:p};this.create({id:n,type:"success",description:f,...m})}}).catch(async u=>{if(i=["reject",u],r.error!==void 0){a=!1;const d=typeof r.error=="function"?await r.error(u):r.error,p=typeof r.description=="function"?await r.description(u):r.description,h=typeof d=="object"&&!Ee.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:p,...h})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),l=()=>new Promise((u,d)=>o.then(()=>i[0]==="reject"?d(i[1]):u(i[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,r)=>{const n=r?.id||JJ++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Kc=new sKt,aKt=(e,t)=>{const r=t?.id||JJ++;return Kc.addToast({title:e,...t,id:r}),r},iKt=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",oKt=aKt,lKt=()=>Kc.toasts,cKt=()=>Kc.getActiveToasts(),Vl=Object.assign(oKt,{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:lKt,getToasts:cKt});ZYt("[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 E2(e){return e.label!==void 0}const uKt=3,dKt="24px",pKt="16px",aCe=4e3,fKt=356,hKt=14,mKt=45,gKt=200;function hh(...e){return e.filter(Boolean).join(" ")}function yKt(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const bKt=e=>{var t,r,n,s,a,i,o,l,u;const{invert:d,toast:p,unstyled:f,interacting:h,setHeights:m,visibleToasts:g,heights:b,index:v,toasts:S,expanded:w,removeToast:k,defaultRichColors:_,closeButton:C,style:T,cancelButtonStyle:A,actionButtonStyle:N,className:I="",descriptionClassName:R="",duration:$,position:F,gap:L,expandByDefault:z,classNames:q,icons:H,closeButtonAriaLabel:V="Close toast"}=e,[G,M]=Ee.useState(null),[X,U]=Ee.useState(null),[j,Q]=Ee.useState(!1),[Z,J]=Ee.useState(!1),[ee,te]=Ee.useState(!1),[se,ce]=Ee.useState(!1),[Se,W]=Ee.useState(!1),[ne,ae]=Ee.useState(0),[ge,le]=Ee.useState(0),xe=Ee.useRef(p.duration||$||aCe),Ie=Ee.useRef(null),Ce=Ee.useRef(null),oe=v===0,de=v+1<=g,fe=p.type,Ne=p.dismissible!==!1,Te=p.className||"",we=p.descriptionClassName||"",ue=Ee.useMemo(()=>b.findIndex(mt=>mt.toastId===p.id)||0,[b,p.id]),De=Ee.useMemo(()=>{var mt;return(mt=p.closeButton)!=null?mt:C},[p.closeButton,C]),Le=Ee.useMemo(()=>p.duration||$||aCe,[p.duration,$]),rt=Ee.useRef(0),Ot=Ee.useRef(0),$t=Ee.useRef(0),ut=Ee.useRef(null),[or,Br]=F.split("-"),Et=Ee.useMemo(()=>b.reduce((mt,Ar,vr)=>vr>=ue?mt:mt+Ar.height,0),[b,ue]),Dt=nKt(),xt=p.invert||d,je=fe==="loading";Ot.current=Ee.useMemo(()=>ue*L+Et,[ue,Et]),Ee.useEffect(()=>{xe.current=Le},[Le]),Ee.useEffect(()=>{Q(!0)},[]),Ee.useEffect(()=>{const mt=Ce.current;if(mt){const Ar=mt.getBoundingClientRect().height;return le(Ar),m(vr=>[{toastId:p.id,height:Ar,position:p.position},...vr]),()=>m(vr=>vr.filter(zr=>zr.toastId!==p.id))}},[m,p.id]),Ee.useLayoutEffect(()=>{if(!j)return;const mt=Ce.current,Ar=mt.style.height;mt.style.height="auto";const vr=mt.getBoundingClientRect().height;mt.style.height=Ar,le(vr),m(zr=>zr.find($r=>$r.toastId===p.id)?zr.map($r=>$r.toastId===p.id?{...$r,height:vr}:$r):[{toastId:p.id,height:vr,position:p.position},...zr])},[j,p.title,p.description,m,p.id,p.jsx,p.action,p.cancel]);const St=Ee.useCallback(()=>{J(!0),ae(Ot.current),m(mt=>mt.filter(Ar=>Ar.toastId!==p.id)),setTimeout(()=>{k(p)},gKt)},[p,k,m,Ot]);Ee.useEffect(()=>{if(p.promise&&fe==="loading"||p.duration===1/0||p.type==="loading")return;let mt;return w||h||Dt?(()=>{if($t.current<rt.current){const zr=new Date().getTime()-rt.current;xe.current=xe.current-zr}$t.current=new Date().getTime()})():xe.current!==1/0&&(rt.current=new Date().getTime(),mt=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),St()},xe.current)),()=>clearTimeout(mt)},[w,h,p,fe,Dt,St]),Ee.useEffect(()=>{p.delete&&(St(),p.onDismiss==null||p.onDismiss.call(p,p))},[St,p.delete]);function sr(){var mt;if(H?.loading){var Ar;return Ee.createElement("div",{className:hh(q?.loader,p==null||(Ar=p.classNames)==null?void 0:Ar.loader,"sonner-loader"),"data-visible":fe==="loading"},H.loading)}return Ee.createElement(YYt,{className:hh(q?.loader,p==null||(mt=p.classNames)==null?void 0:mt.loader),visible:fe==="loading"})}const En=p.icon||H?.[fe]||WYt(fe);var gt,Sn;return Ee.createElement("li",{tabIndex:0,ref:Ce,className:hh(I,Te,q?.toast,p==null||(t=p.classNames)==null?void 0:t.toast,q?.default,q?.[fe],p==null||(r=p.classNames)==null?void 0:r[fe]),"data-sonner-toast":"","data-rich-colors":(gt=p.richColors)!=null?gt:_,"data-styled":!(p.jsx||p.unstyled||f),"data-mounted":j,"data-promise":!!p.promise,"data-swiped":Se,"data-removed":Z,"data-visible":de,"data-y-position":or,"data-x-position":Br,"data-index":v,"data-front":oe,"data-swiping":ee,"data-dismissible":Ne,"data-type":fe,"data-invert":xt,"data-swipe-out":se,"data-swipe-direction":X,"data-expanded":!!(w||z&&j),"data-testid":p.testId,style:{"--index":v,"--toasts-before":v,"--z-index":S.length-v,"--offset":`${Z?ne:Ot.current}px`,"--initial-height":z?"auto":`${ge}px`,...T,...p.style},onDragEnd:()=>{te(!1),M(null),ut.current=null},onPointerDown:mt=>{mt.button!==2&&(je||!Ne||(Ie.current=new Date,ae(Ot.current),mt.target.setPointerCapture(mt.pointerId),mt.target.tagName!=="BUTTON"&&(te(!0),ut.current={x:mt.clientX,y:mt.clientY})))},onPointerUp:()=>{var mt,Ar,vr;if(se||!Ne)return;ut.current=null;const zr=Number(((mt=Ce.current)==null?void 0:mt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),pr=Number(((Ar=Ce.current)==null?void 0:Ar.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),$r=new Date().getTime()-((vr=Ie.current)==null?void 0:vr.getTime()),Jt=G==="x"?zr:pr,Ka=Math.abs(Jt)/$r;if(Math.abs(Jt)>=mKt||Ka>.11){ae(Ot.current),p.onDismiss==null||p.onDismiss.call(p,p),U(G==="x"?zr>0?"right":"left":pr>0?"down":"up"),St(),ce(!0);return}else{var pe,_e;(pe=Ce.current)==null||pe.style.setProperty("--swipe-amount-x","0px"),(_e=Ce.current)==null||_e.style.setProperty("--swipe-amount-y","0px")}W(!1),te(!1),M(null)},onPointerMove:mt=>{var Ar,vr,zr;if(!ut.current||!Ne||((Ar=window.getSelection())==null?void 0:Ar.toString().length)>0)return;const $r=mt.clientY-ut.current.y,Jt=mt.clientX-ut.current.x;var Ka;const pe=(Ka=e.swipeDirections)!=null?Ka:yKt(F);!G&&(Math.abs(Jt)>1||Math.abs($r)>1)&&M(Math.abs(Jt)>Math.abs($r)?"x":"y");let _e={x:0,y:0};const Re=qe=>1/(1.5+Math.abs(qe)/20);if(G==="y"){if(pe.includes("top")||pe.includes("bottom"))if(pe.includes("top")&&$r<0||pe.includes("bottom")&&$r>0)_e.y=$r;else{const qe=$r*Re($r);_e.y=Math.abs(qe)<Math.abs($r)?qe:$r}}else if(G==="x"&&(pe.includes("left")||pe.includes("right")))if(pe.includes("left")&&Jt<0||pe.includes("right")&&Jt>0)_e.x=Jt;else{const qe=Jt*Re(Jt);_e.x=Math.abs(qe)<Math.abs(Jt)?qe:Jt}(Math.abs(_e.x)>0||Math.abs(_e.y)>0)&&W(!0),(vr=Ce.current)==null||vr.style.setProperty("--swipe-amount-x",`${_e.x}px`),(zr=Ce.current)==null||zr.style.setProperty("--swipe-amount-y",`${_e.y}px`)}},De&&!p.jsx&&fe!=="loading"?Ee.createElement("button",{"aria-label":V,"data-disabled":je,"data-close-button":!0,onClick:je||!Ne?()=>{}:()=>{St(),p.onDismiss==null||p.onDismiss.call(p,p)},className:hh(q?.closeButton,p==null||(n=p.classNames)==null?void 0:n.closeButton)},(Sn=H?.close)!=null?Sn:rKt):null,(fe||p.icon||p.promise)&&p.icon!==null&&(H?.[fe]!==null||p.icon)?Ee.createElement("div",{"data-icon":"",className:hh(q?.icon,p==null||(s=p.classNames)==null?void 0:s.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||sr():null,p.type!=="loading"?En:null):null,Ee.createElement("div",{"data-content":"",className:hh(q?.content,p==null||(a=p.classNames)==null?void 0:a.content)},Ee.createElement("div",{"data-title":"",className:hh(q?.title,p==null||(i=p.classNames)==null?void 0:i.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?Ee.createElement("div",{"data-description":"",className:hh(R,we,q?.description,p==null||(o=p.classNames)==null?void 0:o.description)},typeof p.description=="function"?p.description():p.description):null),Ee.isValidElement(p.cancel)?p.cancel:p.cancel&&E2(p.cancel)?Ee.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||A,onClick:mt=>{E2(p.cancel)&&Ne&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,mt),St())},className:hh(q?.cancelButton,p==null||(l=p.classNames)==null?void 0:l.cancelButton)},p.cancel.label):null,Ee.isValidElement(p.action)?p.action:p.action&&E2(p.action)?Ee.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||N,onClick:mt=>{E2(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,mt),!mt.defaultPrevented&&St())},className:hh(q?.actionButton,p==null||(u=p.classNames)==null?void 0:u.actionButton)},p.action.label):null)};function iCe(){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 vKt(e,t){const r={};return[e,t].forEach((n,s)=>{const a=s===1,i=a?"--mobile-offset":"--offset",o=a?pKt:dKt;function l(u){["top","right","bottom","left"].forEach(d=>{r[`${i}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?l(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${i}-${u}`]=o:r[`${i}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):l(o)}),r}const xKt=Ee.forwardRef(function(t,r){const{id:n,invert:s,position:a="bottom-right",hotkey:i=["altKey","KeyT"],expand:o,closeButton:l,className:u,offset:d,mobileOffset:p,theme:f="light",richColors:h,duration:m,style:g,visibleToasts:b=uKt,toastOptions:v,dir:S=iCe(),gap:w=hKt,icons:k,containerAriaLabel:_="Notifications"}=t,[C,T]=Ee.useState([]),A=Ee.useMemo(()=>n?C.filter(j=>j.toasterId===n):C.filter(j=>!j.toasterId),[C,n]),N=Ee.useMemo(()=>Array.from(new Set([a].concat(A.filter(j=>j.position).map(j=>j.position)))),[A,a]),[I,R]=Ee.useState([]),[$,F]=Ee.useState(!1),[L,z]=Ee.useState(!1),[q,H]=Ee.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=Ee.useRef(null),G=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=Ee.useRef(null),X=Ee.useRef(!1),U=Ee.useCallback(j=>{T(Q=>{var Z;return(Z=Q.find(J=>J.id===j.id))!=null&&Z.delete||Kc.dismiss(j.id),Q.filter(({id:J})=>J!==j.id)})},[]);return Ee.useEffect(()=>Kc.subscribe(j=>{if(j.dismiss){requestAnimationFrame(()=>{T(Q=>Q.map(Z=>Z.id===j.id?{...Z,delete:!0}:Z))});return}setTimeout(()=>{Rae.flushSync(()=>{T(Q=>{const Z=Q.findIndex(J=>J.id===j.id);return Z!==-1?[...Q.slice(0,Z),{...Q[Z],...j},...Q.slice(Z+1)]:[j,...Q]})})})}),[C]),Ee.useEffect(()=>{if(f!=="system"){H(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window>"u")return;const j=window.matchMedia("(prefers-color-scheme: dark)");try{j.addEventListener("change",({matches:Q})=>{H(Q?"dark":"light")})}catch{j.addListener(({matches:Z})=>{try{H(Z?"dark":"light")}catch(J){console.error(J)}})}},[f]),Ee.useEffect(()=>{C.length<=1&&F(!1)},[C]),Ee.useEffect(()=>{const j=Q=>{var Z;if(i.every(te=>Q[te]||Q.code===te)){var ee;F(!0),(ee=V.current)==null||ee.focus()}Q.code==="Escape"&&(document.activeElement===V.current||(Z=V.current)!=null&&Z.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[i]),Ee.useEffect(()=>{if(V.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,X.current=!1)}},[V.current]),Ee.createElement("section",{ref:r,"aria-label":`${_} ${G}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},N.map((j,Q)=>{var Z;const[J,ee]=j.split("-");return A.length?Ee.createElement("ol",{key:j,dir:S==="auto"?iCe():S,tabIndex:-1,ref:V,className:u,"data-sonner-toaster":!0,"data-sonner-theme":q,"data-y-position":J,"data-x-position":ee,style:{"--front-toast-height":`${((Z=I[0])==null?void 0:Z.height)||0}px`,"--width":`${fKt}px`,"--gap":`${w}px`,...g,...vKt(d,p)},onBlur:te=>{X.current&&!te.currentTarget.contains(te.relatedTarget)&&(X.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||X.current||(X.current=!0,M.current=te.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{L||F(!1)},onDragEnd:()=>F(!1),onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||z(!0)},onPointerUp:()=>z(!1)},A.filter(te=>!te.position&&Q===0||te.position===j).map((te,se)=>{var ce,Se;return Ee.createElement(bKt,{key:te.id,icons:k,index:se,toast:te,defaultRichColors:h,duration:(ce=v?.duration)!=null?ce:m,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:s,visibleToasts:b,closeButton:(Se=v?.closeButton)!=null?Se:l,interacting:L,position:j,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:U,toasts:A.filter(W=>W.position==te.position),heights:I.filter(W=>W.position==te.position),setHeights:R,expandByDefault:o,gap:w,expanded:$,swipeDirections:t.swipeDirections})})):null}))});var JL="Dialog",[NGe,IGe]=$o(JL),[SKt,Kf]=NGe(JL),jGe=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,o=E.useRef(null),l=E.useRef(null),[u,d]=Rc({prop:n,defaultProp:s??!1,onChange:a,caller:JL});return c.jsx(SKt,{scope:t,triggerRef:o,contentRef:l,contentId:Xi(),titleId:Xi(),descriptionId:Xi(),open:u,onOpenChange:d,onOpenToggle:E.useCallback(()=>d(p=>!p),[d]),modal:i,children:r})};jGe.displayName=JL;var RGe="DialogTrigger",PGe=E.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Kf(RGe,r),a=Pr(t,s.triggerRef);return c.jsx(gr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":cle(s.open),...n,ref:a,onClick:dt(e.onClick,s.onOpenToggle)})});PGe.displayName=RGe;var ole="DialogPortal",[wKt,$Ge]=NGe(ole,{forceMount:void 0}),MGe=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,a=Kf(ole,t);return c.jsx(wKt,{scope:t,forceMount:r,children:E.Children.map(n,i=>c.jsx(Li,{present:r||a.open,children:c.jsx(T1,{asChild:!0,container:s,children:i})}))})};MGe.displayName=ole;var J3="DialogOverlay",LGe=E.forwardRef((e,t)=>{const r=$Ge(J3,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=Kf(J3,e.__scopeDialog);return a.modal?c.jsx(Li,{present:n||a.open,children:c.jsx(kKt,{...s,ref:t})}):null});LGe.displayName=J3;var EKt=$0("DialogOverlay.RemoveScroll"),kKt=E.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Kf(J3,r);return c.jsx(QN,{as:EKt,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(gr.div,{"data-state":cle(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Y0="DialogContent",FGe=E.forwardRef((e,t)=>{const r=$Ge(Y0,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=Kf(Y0,e.__scopeDialog);return c.jsx(Li,{present:n||a.open,children:a.modal?c.jsx(OKt,{...s,ref:t}):c.jsx(_Kt,{...s,ref:t})})});FGe.displayName=Y0;var OKt=E.forwardRef((e,t)=>{const r=Kf(Y0,e.__scopeDialog),n=E.useRef(null),s=Pr(t,r.contentRef,n);return E.useEffect(()=>{const a=n.current;if(a)return oL(a)},[]),c.jsx(BGe,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:dt(e.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:dt(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,o=i.button===0&&i.ctrlKey===!0;(i.button===2||o)&&a.preventDefault()}),onFocusOutside:dt(e.onFocusOutside,a=>a.preventDefault())})}),_Kt=E.forwardRef((e,t)=>{const r=Kf(Y0,e.__scopeDialog),n=E.useRef(!1),s=E.useRef(!1);return c.jsx(BGe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||r.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=a.target;r.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),BGe=E.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...i}=e,o=Kf(Y0,r),l=E.useRef(null),u=Pr(t,l);return J5(),c.jsxs(c.Fragment,{children:[c.jsx(zN,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:c.jsx(_1,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":cle(o.open),...i,ref:u,onDismiss:()=>o.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(TKt,{titleId:o.titleId}),c.jsx(DKt,{contentRef:l,descriptionId:o.descriptionId})]})]})}),lle="DialogTitle",zGe=E.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Kf(lle,r);return c.jsx(gr.h2,{id:s.titleId,...n,ref:t})});zGe.displayName=lle;var UGe="DialogDescription",VGe=E.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Kf(UGe,r);return c.jsx(gr.p,{id:s.descriptionId,...n,ref:t})});VGe.displayName=UGe;var qGe="DialogClose",HGe=E.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Kf(qGe,r);return c.jsx(gr.button,{type:"button",...n,ref:t,onClick:dt(e.onClick,()=>s.onOpenChange(!1))})});HGe.displayName=qGe;function cle(e){return e?"open":"closed"}var QGe="DialogTitleWarning",[CKt,GGe]=Skt(QGe,{contentName:Y0,titleName:lle,docsSlug:"dialog"}),TKt=({titleId:e})=>{const t=GGe(QGe),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
162
162
 
163
163
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
@@ -229,7 +229,7 @@ Error message: ${Sle(r)}`,cause:r}),this[CWe]=!0,this.value=t}static isInstance(
229
229
  ]))`;continue}else if(s[u]==="$"){a+=`($|(?=[\r
230
230
  ]))`;continue}}if(n.s&&s[u]==="."){a+=o?`${s[u]}\r
231
231
  `:`[${s[u]}\r
232
- ]`;continue}a+=s[u],s[u]==="\\"?i=!0:o&&s[u]==="]"?o=!1:!o&&s[u]==="["&&(o=!0)}return a}function PWe(e,t){var r,n,s,a,i,o;const l={type:"object",additionalProperties:(r=ia(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===Oe.ZodString&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:u,...d}=RWe(e.keyType._def,t);return{...l,propertyNames:d}}else{if(((a=e.keyType)==null?void 0:a._def.typeName)===Oe.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===Oe.ZodBranded&&e.keyType._def.type._def.typeName===Oe.ZodString&&((o=e.keyType._def.type._def.checks)!=null&&o.length)){const{type:u,...d}=IWe(e.keyType._def,t);return{...l,propertyNames:d}}}return l}function Yir(e,t){if(t.mapStrategy==="record")return PWe(e,t);const r=ia(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ed(),n=ia(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ed();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Kir(e){const t=e.values,n=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),s=Array.from(new Set(n.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function Jir(){return{not:Ed()}}function eor(){return{type:"null"}}var gee={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function tor(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in gee&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,a)=>{const i=gee[a._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((s,a)=>{const i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];default:return s}},[]);if(n.length===r.length){const s=n.filter((a,i,o)=>o.indexOf(a)===i);return{type:s.length>1?s:s[0],enum:r.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(a=>!n.includes(a))],[])};return ror(e,t)}var ror=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,s)=>ia(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function nor(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[gee[e.innerType._def.typeName],"null"]};const r=ia(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function sor(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value;break}return t}function aor(e,t){const r={type:"object",properties:{}},n=[],s=e.shape();for(const i in s){let o=s[i];if(o===void 0||o._def===void 0)continue;const l=oor(o),u=ia(o._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(r.properties[i]=u,l||n.push(i))}n.length&&(r.required=n);const a=ior(e,t);return a!==void 0&&(r.additionalProperties=a),r}function ior(e,t){if(e.catchall._def.typeName!=="ZodNever")return ia(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 oor(e){try{return e.isOptional()}catch{return!0}}var lor=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return ia(e.innerType._def,t);const n=ia(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:Ed()},n]}:Ed()},cor=(e,t)=>{if(t.pipeStrategy==="input")return ia(e.in._def,t);if(t.pipeStrategy==="output")return ia(e.out._def,t);const r=ia(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=ia(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function uor(e,t){return ia(e.type._def,t)}function dor(e,t){const n={type:"array",uniqueItems:!0,items:ia(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function por(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>ia(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:ia(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>ia(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function hor(){return{not:Ed()}}function mor(){return Ed()}var gor=(e,t)=>ia(e.innerType._def,t),yor=(e,t,r)=>{switch(t){case Oe.ZodString:return RWe(e,r);case Oe.ZodNumber:return sor(e);case Oe.ZodObject:return aor(e,r);case Oe.ZodBigInt:return Fir(e);case Oe.ZodBoolean:return Bir();case Oe.ZodDate:return jWe(e,r);case Oe.ZodUndefined:return hor();case Oe.ZodNull:return eor();case Oe.ZodArray:return Lir(e,r);case Oe.ZodUnion:case Oe.ZodDiscriminatedUnion:return tor(e,r);case Oe.ZodIntersection:return Gir(e,r);case Oe.ZodTuple:return por(e,r);case Oe.ZodRecord:return PWe(e,r);case Oe.ZodLiteral:return Zir(e);case Oe.ZodEnum:return Hir(e);case Oe.ZodNativeEnum:return Kir(e);case Oe.ZodNullable:return nor(e,r);case Oe.ZodOptional:return lor(e,r);case Oe.ZodMap:return Yir(e,r);case Oe.ZodSet:return dor(e,r);case Oe.ZodLazy:return()=>e.getter()._def;case Oe.ZodPromise:return uor(e,r);case Oe.ZodNaN:case Oe.ZodNever:return Jir();case Oe.ZodEffects:return qir(e,r);case Oe.ZodAny:return Ed();case Oe.ZodUnknown:return mor();case Oe.ZodDefault:return Vir(e,r);case Oe.ZodBranded:return IWe(e,r);case Oe.ZodReadonly:return gor(e,r);case Oe.ZodCatch:return zir(e,r);case Oe.ZodPipeline:return cor(e,r);case Oe.ZodFunction:case Oe.ZodVoid:case Oe.ZodSymbol:return;default:return(n=>{})()}};function ia(e,t,r=!1){var n;const s=t.seen.get(e);if(t.override){const l=(n=t.override)==null?void 0:n.call(t,e,t,s,r);if(l!==$ir)return l}if(s&&!r){const l=bor(s,t);if(l!==void 0)return l}const a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);const i=yor(e,e.typeName,t),o=typeof i=="function"?ia(i(),t):i;if(o&&vor(e,t,o),t.postProcess){const l=t.postProcess(o,e,t);return a.jsonSchema=o,l}return a.jsonSchema=o,o}var bor=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Pir(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ed()):t.$refStrategy==="seen"?Ed():void 0}},vor=(e,t,r)=>(e.description&&(r.description=e.description),r),xor=e=>{const t=Mir(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},Sor=(e,t)=>{var r;const n=xor(t);let s=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,p])=>{var f;return{...u,[d]:(f=ia(p._def,{...n,currentPath:[...n.basePath,n.definitionPath,d]},!0))!=null?f:Ed()}},{}):void 0;const a=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(r=ia(e._def,a===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,a]},!1))!=null?r:Ed(),o=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;o!==void 0&&(i.title=o);const l=a===void 0?s?{...i,[n.definitionPath]:s}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,a].join("/"),[n.definitionPath]:{...s,[a]:i}};return l.$schema="http://json-schema.org/draft-07/schema#",l},wor=Sor;function Eor(e,t){var r;const n=(r=void 0)!=null?r:!1;return Ele(()=>wor(e,{$refStrategy:n?"root":"none"}),{validate:async s=>{const a=await e.safeParseAsync(s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function kor(e,t){var r;const n=(r=void 0)!=null?r:!1;return Ele(()=>yZe(e,{target:"draft-7",io:"output",reused:n?"ref":"inline"}),{validate:async s=>{const a=await bZe(e,s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function Oor(e){return"_zod"in e}function F1(e,t){return Oor(e)?kor(e):Eor(e)}var yee=Symbol.for("vercel.ai.schema");function Ele(e,{validate:t}={}){return{[yee]:!0,_type:void 0,[mM]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function _or(e){return typeof e=="object"&&e!==null&&yee in e&&e[yee]===!0&&"jsonSchema"in e&&"validate"in e}function Cor(e){return e==null?Ele({properties:{},additionalProperties:!1}):_or(e)?e:typeof e=="function"?e():F1(e)}function Tor(e){return e?.replace(/\/$/,"")}var Aor={},$We=dF({"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/get-context.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(f,h)=>{for(var m in h)r(f,m,{get:h[m],enumerable:!0})},o=(f,h,m,g)=>{if(h&&typeof h=="object"||typeof h=="function")for(let b of s(h))!a.call(f,b)&&b!==m&&r(f,b,{get:()=>h[b],enumerable:!(g=n(h,b))||g.enumerable});return f},l=f=>o(r({},"__esModule",{value:!0}),f),u={};i(u,{SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>p}),t.exports=l(u);var d=Symbol.for("@vercel/request-context");function p(){return globalThis[d]?.get?.()??{}}}}),Dor=dF({"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(m,g)=>{for(var b in g)r(m,b,{get:g[b],enumerable:!0})},o=(m,g,b,v)=>{if(g&&typeof g=="object"||typeof g=="function")for(let S of s(g))!a.call(m,S)&&S!==b&&r(m,S,{get:()=>g[S],enumerable:!(v=n(g,S))||v.enumerable});return m},l=m=>o(r({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>f,getVercelOidcTokenSync:()=>h}),t.exports=l(u);var d=$We(),p=nir();async function f(){let m="",g;try{m=h()}catch(b){g=b}try{const[{getTokenPayload:b,isExpired:v},{refreshToken:S}]=await Promise.all([await Ge(()=>import("./token-util-NEHG7TUY-U7CX7GS4-BxugX7ph.js"),__vite__mapDeps([23,24,1]),import.meta.url),await Ge(()=>import("./token-6GSAFR2W-XRCSVUPZ-BwL_AVJf.js"),__vite__mapDeps([25,24,1]),import.meta.url)]);(!m||v(b(m)))&&(await S(),m=h())}catch(b){throw g?.message&&b instanceof Error&&(b.message=`${g.message}
232
+ ]`;continue}a+=s[u],s[u]==="\\"?i=!0:o&&s[u]==="]"?o=!1:!o&&s[u]==="["&&(o=!0)}return a}function PWe(e,t){var r,n,s,a,i,o;const l={type:"object",additionalProperties:(r=ia(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===Oe.ZodString&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:u,...d}=RWe(e.keyType._def,t);return{...l,propertyNames:d}}else{if(((a=e.keyType)==null?void 0:a._def.typeName)===Oe.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===Oe.ZodBranded&&e.keyType._def.type._def.typeName===Oe.ZodString&&((o=e.keyType._def.type._def.checks)!=null&&o.length)){const{type:u,...d}=IWe(e.keyType._def,t);return{...l,propertyNames:d}}}return l}function Yir(e,t){if(t.mapStrategy==="record")return PWe(e,t);const r=ia(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ed(),n=ia(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ed();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Kir(e){const t=e.values,n=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),s=Array.from(new Set(n.map(a=>typeof a)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function Jir(){return{not:Ed()}}function eor(){return{type:"null"}}var gee={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function tor(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in gee&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,a)=>{const i=gee[a._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((s,a)=>{const i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(a._def.value===null)return[...s,"null"];default:return s}},[]);if(n.length===r.length){const s=n.filter((a,i,o)=>o.indexOf(a)===i);return{type:s.length>1?s:s[0],enum:r.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(a=>!n.includes(a))],[])};return ror(e,t)}var ror=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,s)=>ia(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function nor(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[gee[e.innerType._def.typeName],"null"]};const r=ia(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function sor(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value;break}return t}function aor(e,t){const r={type:"object",properties:{}},n=[],s=e.shape();for(const i in s){let o=s[i];if(o===void 0||o._def===void 0)continue;const l=oor(o),u=ia(o._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(r.properties[i]=u,l||n.push(i))}n.length&&(r.required=n);const a=ior(e,t);return a!==void 0&&(r.additionalProperties=a),r}function ior(e,t){if(e.catchall._def.typeName!=="ZodNever")return ia(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 oor(e){try{return e.isOptional()}catch{return!0}}var lor=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return ia(e.innerType._def,t);const n=ia(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:Ed()},n]}:Ed()},cor=(e,t)=>{if(t.pipeStrategy==="input")return ia(e.in._def,t);if(t.pipeStrategy==="output")return ia(e.out._def,t);const r=ia(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=ia(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function uor(e,t){return ia(e.type._def,t)}function dor(e,t){const n={type:"array",uniqueItems:!0,items:ia(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function por(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>ia(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:ia(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>ia(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function hor(){return{not:Ed()}}function mor(){return Ed()}var gor=(e,t)=>ia(e.innerType._def,t),yor=(e,t,r)=>{switch(t){case Oe.ZodString:return RWe(e,r);case Oe.ZodNumber:return sor(e);case Oe.ZodObject:return aor(e,r);case Oe.ZodBigInt:return Fir(e);case Oe.ZodBoolean:return Bir();case Oe.ZodDate:return jWe(e,r);case Oe.ZodUndefined:return hor();case Oe.ZodNull:return eor();case Oe.ZodArray:return Lir(e,r);case Oe.ZodUnion:case Oe.ZodDiscriminatedUnion:return tor(e,r);case Oe.ZodIntersection:return Gir(e,r);case Oe.ZodTuple:return por(e,r);case Oe.ZodRecord:return PWe(e,r);case Oe.ZodLiteral:return Zir(e);case Oe.ZodEnum:return Hir(e);case Oe.ZodNativeEnum:return Kir(e);case Oe.ZodNullable:return nor(e,r);case Oe.ZodOptional:return lor(e,r);case Oe.ZodMap:return Yir(e,r);case Oe.ZodSet:return dor(e,r);case Oe.ZodLazy:return()=>e.getter()._def;case Oe.ZodPromise:return uor(e,r);case Oe.ZodNaN:case Oe.ZodNever:return Jir();case Oe.ZodEffects:return qir(e,r);case Oe.ZodAny:return Ed();case Oe.ZodUnknown:return mor();case Oe.ZodDefault:return Vir(e,r);case Oe.ZodBranded:return IWe(e,r);case Oe.ZodReadonly:return gor(e,r);case Oe.ZodCatch:return zir(e,r);case Oe.ZodPipeline:return cor(e,r);case Oe.ZodFunction:case Oe.ZodVoid:case Oe.ZodSymbol:return;default:return(n=>{})()}};function ia(e,t,r=!1){var n;const s=t.seen.get(e);if(t.override){const l=(n=t.override)==null?void 0:n.call(t,e,t,s,r);if(l!==$ir)return l}if(s&&!r){const l=bor(s,t);if(l!==void 0)return l}const a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);const i=yor(e,e.typeName,t),o=typeof i=="function"?ia(i(),t):i;if(o&&vor(e,t,o),t.postProcess){const l=t.postProcess(o,e,t);return a.jsonSchema=o,l}return a.jsonSchema=o,o}var bor=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Pir(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ed()):t.$refStrategy==="seen"?Ed():void 0}},vor=(e,t,r)=>(e.description&&(r.description=e.description),r),xor=e=>{const t=Mir(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},Sor=(e,t)=>{var r;const n=xor(t);let s=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,p])=>{var f;return{...u,[d]:(f=ia(p._def,{...n,currentPath:[...n.basePath,n.definitionPath,d]},!0))!=null?f:Ed()}},{}):void 0;const a=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(r=ia(e._def,a===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,a]},!1))!=null?r:Ed(),o=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;o!==void 0&&(i.title=o);const l=a===void 0?s?{...i,[n.definitionPath]:s}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,a].join("/"),[n.definitionPath]:{...s,[a]:i}};return l.$schema="http://json-schema.org/draft-07/schema#",l},wor=Sor;function Eor(e,t){var r;const n=(r=void 0)!=null?r:!1;return Ele(()=>wor(e,{$refStrategy:n?"root":"none"}),{validate:async s=>{const a=await e.safeParseAsync(s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function kor(e,t){var r;const n=(r=void 0)!=null?r:!1;return Ele(()=>yZe(e,{target:"draft-7",io:"output",reused:n?"ref":"inline"}),{validate:async s=>{const a=await bZe(e,s);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function Oor(e){return"_zod"in e}function F1(e,t){return Oor(e)?kor(e):Eor(e)}var yee=Symbol.for("vercel.ai.schema");function Ele(e,{validate:t}={}){return{[yee]:!0,_type:void 0,[mM]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function _or(e){return typeof e=="object"&&e!==null&&yee in e&&e[yee]===!0&&"jsonSchema"in e&&"validate"in e}function Cor(e){return e==null?Ele({properties:{},additionalProperties:!1}):_or(e)?e:typeof e=="function"?e():F1(e)}function Tor(e){return e?.replace(/\/$/,"")}var Aor={},$We=dF({"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/get-context.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(f,h)=>{for(var m in h)r(f,m,{get:h[m],enumerable:!0})},o=(f,h,m,g)=>{if(h&&typeof h=="object"||typeof h=="function")for(let b of s(h))!a.call(f,b)&&b!==m&&r(f,b,{get:()=>h[b],enumerable:!(g=n(h,b))||g.enumerable});return f},l=f=>o(r({},"__esModule",{value:!0}),f),u={};i(u,{SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>p}),t.exports=l(u);var d=Symbol.for("@vercel/request-context");function p(){return globalThis[d]?.get?.()??{}}}}),Dor=dF({"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(m,g)=>{for(var b in g)r(m,b,{get:g[b],enumerable:!0})},o=(m,g,b,v)=>{if(g&&typeof g=="object"||typeof g=="function")for(let S of s(g))!a.call(m,S)&&S!==b&&r(m,S,{get:()=>g[S],enumerable:!(v=n(g,S))||v.enumerable});return m},l=m=>o(r({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>f,getVercelOidcTokenSync:()=>h}),t.exports=l(u);var d=$We(),p=nir();async function f(){let m="",g;try{m=h()}catch(b){g=b}try{const[{getTokenPayload:b,isExpired:v},{refreshToken:S}]=await Promise.all([await Ge(()=>import("./token-util-NEHG7TUY-U7CX7GS4-BuXpmqCQ.js"),__vite__mapDeps([23,24,1]),import.meta.url),await Ge(()=>import("./token-6GSAFR2W-XRCSVUPZ-BX3wH20Y.js"),__vite__mapDeps([25,24,1]),import.meta.url)]);(!m||v(b(m)))&&(await S(),m=h())}catch(b){throw g?.message&&b instanceof Error&&(b.message=`${g.message}
233
233
  ${b.message}`),new p.VercelOidcTokenError("Failed to refresh OIDC token",b)}return m}function h(){const m=(0,d.getContext)().headers?.["x-vercel-oidc-token"]??Aor.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}}}),MWe=dF({"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/index.js"(e,t){var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,i=(f,h)=>{for(var m in h)r(f,m,{get:h[m],enumerable:!0})},o=(f,h,m,g)=>{if(h&&typeof h=="object"||typeof h=="function")for(let b of s(h))!a.call(f,b)&&b!==m&&r(f,b,{get:()=>h[b],enumerable:!(g=n(h,b))||g.enumerable});return f},l=f=>o(r({},"__esModule",{value:!0}),f),u={};i(u,{getContext:()=>p.getContext,getVercelOidcToken:()=>d.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync}),t.exports=l(u);var d=Dor(),p=$We()}}),Nor=cWe(MWe()),Ior=cWe(MWe()),jor="vercel.ai.gateway.error",jG=Symbol.for(jor),XCe,YCe,kd=class LWe extends(YCe=Error,XCe=jG,YCe){constructor({message:t,statusCode:r=500,cause:n}){super(t),this[XCe]=!0,this.statusCode=r,this.cause=n}static isInstance(t){return LWe.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&jG in t&&t[jG]===!0}},FWe="GatewayAuthenticationError",Ror=`vercel.ai.gateway.error.${FWe}`,KCe=Symbol.for(Ror),JCe,eTe,BWe=class zWe extends(eTe=kd,JCe=KCe,eTe){constructor({message:t="Authentication failed",statusCode:r=401,cause:n}={}){super({message:t,statusCode:r,cause:n}),this[JCe]=!0,this.name=FWe,this.type="authentication_error"}static isInstance(t){return kd.hasMarker(t)&&KCe in t}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:n="Authentication failed",statusCode:s=401,cause:a}){let i;return t?i=`AI Gateway authentication failed: Invalid API key.
234
234
 
235
235
  Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
@@ -564,7 +564,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
564
564
  `&&(I=`
565
565
  `);var G=0,M=!1;this.parse=function(X,U,j){if(typeof X!="string")throw new Error("Input must be a string");var Q=X.length,Z=N.length,J=I.length,ee=R.length,te=T($),se=[],ce=[],Se=[],W=G=0;if(!X)return Te();if(L||L!==!1&&X.indexOf(H)===-1){for(var ne=X.split(I),ae=0;ae<ne.length;ae++){if(Se=ne[ae],G+=Se.length,ae!==ne.length-1)G+=I.length;else if(j)return Te();if(!R||Se.substring(0,ee)!==R){if(te){if(se=[],oe(Se.split(N)),we(),M)return Te()}else oe(Se.split(N));if(F&&F<=ae)return se=se.slice(0,F),Te(!0)}}return Te()}for(var ge=X.indexOf(N,G),le=X.indexOf(I,G),xe=new RegExp(b(V)+b(H),"g"),Ie=X.indexOf(H,G);;)if(X[G]===H)for(Ie=G,G++;;){if((Ie=X.indexOf(H,Ie+1))===-1)return j||ce.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:se.length,index:G}),fe();if(Ie===Q-1)return fe(X.substring(G,Ie).replace(xe,H));if(H===V&&X[Ie+1]===V)Ie++;else if(H===V||Ie===0||X[Ie-1]!==V){ge!==-1&&ge<Ie+1&&(ge=X.indexOf(N,Ie+1));var Ce=de((le=le!==-1&&le<Ie+1?X.indexOf(I,Ie+1):le)===-1?ge:Math.min(ge,le));if(X.substr(Ie+1+Ce,Z)===N){Se.push(X.substring(G,Ie).replace(xe,H)),X[G=Ie+1+Ce+Z]!==H&&(Ie=X.indexOf(H,G)),ge=X.indexOf(N,G),le=X.indexOf(I,G);break}if(Ce=de(le),X.substring(Ie+1+Ce,Ie+1+Ce+J)===I){if(Se.push(X.substring(G,Ie).replace(xe,H)),Ne(Ie+1+Ce+J),ge=X.indexOf(N,G),Ie=X.indexOf(H,G),te&&(we(),M))return Te();if(F&&se.length>=F)return Te(!0);break}ce.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:se.length,index:G}),Ie++}}else if(R&&Se.length===0&&X.substring(G,G+ee)===R){if(le===-1)return Te();G=le+J,le=X.indexOf(I,G),ge=X.indexOf(N,G)}else if(ge!==-1&&(ge<le||le===-1))Se.push(X.substring(G,ge)),G=ge+Z,ge=X.indexOf(N,G);else{if(le===-1)break;if(Se.push(X.substring(G,le)),Ne(le+J),te&&(we(),M))return Te();if(F&&se.length>=F)return Te(!0)}return fe();function oe(ue){se.push(ue),W=G}function de(ue){var De=0;return De=ue!==-1&&(ue=X.substring(Ie+1,ue))&&ue.trim()===""?ue.length:De}function fe(ue){return j||(ue===void 0&&(ue=X.substring(G)),Se.push(ue),G=Q,oe(Se),te&&we()),Te()}function Ne(ue){G=ue,oe(Se),Se=[],le=X.indexOf(I,G)}function Te(ue){if(A.header&&!U&&se.length&&!q){var De=se[0],Le=Object.create(null),rt=new Set(De);let Ot=!1;for(let $t=0;$t<De.length;$t++){let ut=De[$t];if(Le[ut=T(A.transformHeader)?A.transformHeader(ut,$t):ut]){let or,Br=Le[ut];for(;or=ut+"_"+Br,Br++,rt.has(or););rt.add(or),De[$t]=or,Le[ut]++,Ot=!0,(z=z===null?{}:z)[or]=ut}else Le[ut]=1,De[$t]=ut;rt.add(ut)}Ot&&console.warn("Duplicate headers found and renamed."),q=!0}return{data:se,errors:ce,meta:{delimiter:N,linebreak:I,aborted:M,truncated:!!ue,cursor:W+(U||0),renamedHeaders:z}}}function we(){$(Te()),se=[],ce=[]}},this.abort=function(){M=!0},this.getCharIndex=function(){return G}}function S(A){var N=A.data,I=o[N.workerId],R=!1;if(N.error)I.userError(N.error,N.file);else if(N.results&&N.results.data){var $={abort:function(){R=!0,w(N.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:k,resume:k};if(T(I.userStep)){for(var F=0;F<N.results.data.length&&(I.userStep({data:N.results.data[F],errors:N.results.errors,meta:N.results.meta},$),!R);F++);delete N.results}else T(I.userChunk)&&(I.userChunk(N.results,$,N.file),delete N.results)}N.finished&&!R&&w(N.workerId,N.results)}function w(A,N){var I=o[A];T(I.userComplete)&&I.userComplete(N),I.terminate(),delete o[A]}function k(){throw new Error("Not implemented.")}function _(A){if(typeof A!="object"||A===null)return A;var N,I=Array.isArray(A)?[]:{};for(N in A)I[N]=_(A[N]);return I}function C(A,N){return function(){A.apply(N,arguments)}}function T(A){return typeof A=="function"}return u.parse=function(A,N){var I=(N=N||{}).dynamicTyping||!1;if(T(I)&&(N.dynamicTypingFunction=I,I={}),N.dynamicTyping=I,N.transform=!!T(N.transform)&&N.transform,!N.worker||!u.WORKERS_SUPPORTED)return I=null,u.NODE_STREAM_INPUT,typeof A=="string"?(A=(R=>R.charCodeAt(0)!==65279?R:R.slice(1))(A),I=new(N.download?p:h)(N)):A.readable===!0&&T(A.read)&&T(A.on)?I=new m(N):(n.File&&A instanceof File||A instanceof Object)&&(I=new f(N)),I.stream(A);(I=(()=>{var R;return!!u.WORKERS_SUPPORTED&&(R=(()=>{var $=n.URL||n.webkitURL||null,F=r.toString();return u.BLOB_URL||(u.BLOB_URL=$.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"})))})(),(R=new n.Worker(R)).onmessage=S,R.id=l++,o[R.id]=R)})()).userStep=N.step,I.userChunk=N.chunk,I.userComplete=N.complete,I.userError=N.error,N.step=T(N.step),N.chunk=T(N.chunk),N.complete=T(N.complete),N.error=T(N.error),delete N.worker,I.postMessage({input:A,config:N,workerId:I.id})},u.unparse=function(A,N){var I=!1,R=!0,$=",",F=`\r
566
566
  `,L='"',z=L+L,q=!1,H=null,V=!1,G=((()=>{if(typeof N=="object"){if(typeof N.delimiter!="string"||u.BAD_DELIMITERS.filter(function(U){return N.delimiter.indexOf(U)!==-1}).length||($=N.delimiter),typeof N.quotes!="boolean"&&typeof N.quotes!="function"&&!Array.isArray(N.quotes)||(I=N.quotes),typeof N.skipEmptyLines!="boolean"&&typeof N.skipEmptyLines!="string"||(q=N.skipEmptyLines),typeof N.newline=="string"&&(F=N.newline),typeof N.quoteChar=="string"&&(L=N.quoteChar),typeof N.header=="boolean"&&(R=N.header),Array.isArray(N.columns)){if(N.columns.length===0)throw new Error("Option columns is empty");H=N.columns}N.escapeChar!==void 0&&(z=N.escapeChar+L),N.escapeFormulae instanceof RegExp?V=N.escapeFormulae:typeof N.escapeFormulae=="boolean"&&N.escapeFormulae&&(V=/^[=+\-@\t\r].*$/)}})(),new RegExp(b(L),"g"));if(typeof A=="string"&&(A=JSON.parse(A)),Array.isArray(A)){if(!A.length||Array.isArray(A[0]))return M(null,A,q);if(typeof A[0]=="object")return M(H||Object.keys(A[0]),A,q)}else if(typeof A=="object")return typeof A.data=="string"&&(A.data=JSON.parse(A.data)),Array.isArray(A.data)&&(A.fields||(A.fields=A.meta&&A.meta.fields||H),A.fields||(A.fields=Array.isArray(A.data[0])?A.fields:typeof A.data[0]=="object"?Object.keys(A.data[0]):[]),Array.isArray(A.data[0])||typeof A.data[0]=="object"||(A.data=[A.data])),M(A.fields||[],A.data||[],q);throw new Error("Unable to serialize unrecognized input");function M(U,j,Q){var Z="",J=(typeof U=="string"&&(U=JSON.parse(U)),typeof j=="string"&&(j=JSON.parse(j)),Array.isArray(U)&&0<U.length),ee=!Array.isArray(j[0]);if(J&&R){for(var te=0;te<U.length;te++)0<te&&(Z+=$),Z+=X(U[te],te);0<j.length&&(Z+=F)}for(var se=0;se<j.length;se++){var ce=(J?U:j[se]).length,Se=!1,W=J?Object.keys(j[se]).length===0:j[se].length===0;if(Q&&!J&&(Se=Q==="greedy"?j[se].join("").trim()==="":j[se].length===1&&j[se][0].length===0),Q==="greedy"&&J){for(var ne=[],ae=0;ae<ce;ae++){var ge=ee?U[ae]:ae;ne.push(j[se][ge])}Se=ne.join("").trim()===""}if(!Se){for(var le=0;le<ce;le++){0<le&&!W&&(Z+=$);var xe=J&&ee?U[le]:le;Z+=X(j[se][xe],le)}se<j.length-1&&(!Q||0<ce&&!W)&&(Z+=F)}}return Z}function X(U,j){var Q,Z;return U==null?"":U.constructor===Date?JSON.stringify(U).slice(1,25):(Z=!1,V&&typeof U=="string"&&V.test(U)&&(U="'"+U,Z=!0),Q=U.toString().replace(G,z),(Z=Z||I===!0||typeof I=="function"&&I(U,j)||Array.isArray(I)&&I[j]||((J,ee)=>{for(var te=0;te<ee.length;te++)if(-1<J.indexOf(ee[te]))return!0;return!1})(Q,u.BAD_DELIMITERS)||-1<Q.indexOf($)||Q.charAt(0)===" "||Q.charAt(Q.length-1)===" ")?L+Q+L:Q)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
567
- `,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!a&&!!n.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=v,u.ParserHandle=g,u.NetworkStreamer=p,u.FileStreamer=f,u.StringStreamer=h,u.ReadableStreamStreamer=m,n.jQuery&&((s=n.jQuery).fn.parse=function(A){var N=A.config||{},I=[];return this.each(function(F){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var L=0;L<this.files.length;L++)I.push({file:this.files[L],inputElem:this,instanceConfig:s.extend({},N)})}),R(),this;function R(){if(I.length===0)T(A.complete)&&A.complete();else{var F,L,z,q,H=I[0];if(T(A.before)){var V=A.before(H.file,H.inputElem);if(typeof V=="object"){if(V.action==="abort")return F="AbortError",L=H.file,z=H.inputElem,q=V.reason,void(T(A.error)&&A.error({name:F},L,z,q));if(V.action==="skip")return void $();typeof V.config=="object"&&(H.instanceConfig=s.extend(H.instanceConfig,V.config))}else if(V==="skip")return void $()}var G=H.instanceConfig.complete;H.instanceConfig.complete=function(M){T(G)&&G(M,H.file,H.inputElem),$()},u.parse(H.file,H.instanceConfig)}}function $(){I.splice(0,1),R()}}),i&&(n.onmessage=function(A){A=A.data,u.WORKER_ID===void 0&&A&&(u.WORKER_ID=A.workerId),typeof A.input=="string"?n.postMessage({workerId:u.WORKER_ID,results:u.parse(A.input,A.config),finished:!0}):(n.File&&A.input instanceof File||A.input instanceof Object)&&(A=u.parse(A.input,A.config))&&n.postMessage({workerId:u.WORKER_ID,results:A,finished:!0})}),(p.prototype=Object.create(d.prototype)).constructor=p,(f.prototype=Object.create(d.prototype)).constructor=f,(h.prototype=Object.create(h.prototype)).constructor=h,(m.prototype=Object.create(d.prototype)).constructor=m,u})})(z$)),z$.exports}var ZXr=GXr();const Cdt=Dd(ZXr);var aPe=1,WXr=.9,XXr=.8,YXr=.17,vY=.1,xY=.999,KXr=.9999,JXr=.99,eYr=/[\\\/_+.#"@\[\(\{&]/,tYr=/[\\\/_+.#"@\[\(\{&]/g,rYr=/[\s-]/,Tdt=/[\s-]/g;function Ere(e,t,r,n,s,a,i){if(a===t.length)return s===e.length?aPe:JXr;var o=`${s},${a}`;if(i[o]!==void 0)return i[o];for(var l=n.charAt(a),u=r.indexOf(l,s),d=0,p,f,h,m;u>=0;)p=Ere(e,t,r,n,u+1,a+1,i),p>d&&(u===s?p*=aPe:eYr.test(e.charAt(u-1))?(p*=XXr,h=e.slice(s,u-1).match(tYr),h&&s>0&&(p*=Math.pow(xY,h.length))):rYr.test(e.charAt(u-1))?(p*=WXr,m=e.slice(s,u-1).match(Tdt),m&&s>0&&(p*=Math.pow(xY,m.length))):(p*=YXr,s>0&&(p*=Math.pow(xY,u-s))),e.charAt(u)!==t.charAt(a)&&(p*=KXr)),(p<vY&&r.charAt(u-1)===n.charAt(a+1)||n.charAt(a+1)===n.charAt(a)&&r.charAt(u-1)!==n.charAt(a))&&(f=Ere(e,t,r,n,u+1,a+2,i),f*vY>p&&(p=f*vY)),p>d&&(d=p),u=r.indexOf(l,u+1);return i[o]=d,d}function iPe(e){return e.toLowerCase().replace(Tdt," ")}function nYr(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Ere(e,t,iPe(e),iPe(t),0,0,{})}var uC='[cmdk-group=""]',SY='[cmdk-group-items=""]',sYr='[cmdk-group-heading=""]',Adt='[cmdk-item=""]',oPe=`${Adt}:not([aria-disabled="true"])`,kre="cmdk-item-select",Ew="data-value",aYr=(e,t,r)=>nYr(e,t,r),Ddt=E.createContext(void 0),aj=()=>E.useContext(Ddt),Ndt=E.createContext(void 0),Dpe=()=>E.useContext(Ndt),Idt=E.createContext(void 0),jdt=E.forwardRef((e,t)=>{let r=kw(()=>{var U,j;return{search:"",value:(j=(U=e.value)!=null?U:e.defaultValue)!=null?j:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=kw(()=>new Set),s=kw(()=>new Map),a=kw(()=>new Map),i=kw(()=>new Set),o=Rdt(e),{label:l,children:u,value:d,onValueChange:p,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:b=!0,...v}=e,S=Xi(),w=Xi(),k=Xi(),_=E.useRef(null),C=gYr();y1(()=>{if(d!==void 0){let U=d.trim();r.current.value=U,T.emit()}},[d]),y1(()=>{C(6,F)},[]);let T=E.useMemo(()=>({subscribe:U=>(i.current.add(U),()=>i.current.delete(U)),snapshot:()=>r.current,setState:(U,j,Q)=>{var Z,J,ee,te;if(!Object.is(r.current[U],j)){if(r.current[U]=j,U==="search")$(),I(),C(1,R);else if(U==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(k);se?se.focus():(Z=document.getElementById(S))==null||Z.focus()}if(C(7,()=>{var se;r.current.selectedItemId=(se=L())==null?void 0:se.id,T.emit()}),Q||C(5,F),((J=o.current)==null?void 0:J.value)!==void 0){let se=j??"";(te=(ee=o.current).onValueChange)==null||te.call(ee,se);return}}T.emit()}},emit:()=>{i.current.forEach(U=>U())}}),[]),A=E.useMemo(()=>({value:(U,j,Q)=>{var Z;j!==((Z=a.current.get(U))==null?void 0:Z.value)&&(a.current.set(U,{value:j,keywords:Q}),r.current.filtered.items.set(U,N(j,Q)),C(2,()=>{I(),T.emit()}))},item:(U,j)=>(n.current.add(U),j&&(s.current.has(j)?s.current.get(j).add(U):s.current.set(j,new Set([U]))),C(3,()=>{$(),I(),r.current.value||R(),T.emit()}),()=>{a.current.delete(U),n.current.delete(U),r.current.filtered.items.delete(U);let Q=L();C(4,()=>{$(),Q?.getAttribute("id")===U&&R(),T.emit()})}),group:U=>(s.current.has(U)||s.current.set(U,new Set),()=>{a.current.delete(U),s.current.delete(U)}),filter:()=>o.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:S,inputId:k,labelId:w,listInnerRef:_}),[]);function N(U,j){var Q,Z;let J=(Z=(Q=o.current)==null?void 0:Q.filter)!=null?Z:aYr;return U?J(U,r.current.search,j):0}function I(){if(!r.current.search||o.current.shouldFilter===!1)return;let U=r.current.filtered.items,j=[];r.current.filtered.groups.forEach(Z=>{let J=s.current.get(Z),ee=0;J.forEach(te=>{let se=U.get(te);ee=Math.max(se,ee)}),j.push([Z,ee])});let Q=_.current;z().sort((Z,J)=>{var ee,te;let se=Z.getAttribute("id"),ce=J.getAttribute("id");return((ee=U.get(ce))!=null?ee:0)-((te=U.get(se))!=null?te:0)}).forEach(Z=>{let J=Z.closest(SY);J?J.appendChild(Z.parentElement===J?Z:Z.closest(`${SY} > *`)):Q.appendChild(Z.parentElement===Q?Z:Z.closest(`${SY} > *`))}),j.sort((Z,J)=>J[1]-Z[1]).forEach(Z=>{var J;let ee=(J=_.current)==null?void 0:J.querySelector(`${uC}[${Ew}="${encodeURIComponent(Z[0])}"]`);ee?.parentElement.appendChild(ee)})}function R(){let U=z().find(Q=>Q.getAttribute("aria-disabled")!=="true"),j=U?.getAttribute(Ew);T.setState("value",j||void 0)}function $(){var U,j,Q,Z;if(!r.current.search||o.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let J=0;for(let ee of n.current){let te=(j=(U=a.current.get(ee))==null?void 0:U.value)!=null?j:"",se=(Z=(Q=a.current.get(ee))==null?void 0:Q.keywords)!=null?Z:[],ce=N(te,se);r.current.filtered.items.set(ee,ce),ce>0&&J++}for(let[ee,te]of s.current)for(let se of te)if(r.current.filtered.items.get(se)>0){r.current.filtered.groups.add(ee);break}r.current.filtered.count=J}function F(){var U,j,Q;let Z=L();Z&&(((U=Z.parentElement)==null?void 0:U.firstChild)===Z&&((Q=(j=Z.closest(uC))==null?void 0:j.querySelector(sYr))==null||Q.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function L(){var U;return(U=_.current)==null?void 0:U.querySelector(`${Adt}[aria-selected="true"]`)}function z(){var U;return Array.from(((U=_.current)==null?void 0:U.querySelectorAll(oPe))||[])}function q(U){let j=z()[U];j&&T.setState("value",j.getAttribute(Ew))}function H(U){var j;let Q=L(),Z=z(),J=Z.findIndex(te=>te===Q),ee=Z[J+U];(j=o.current)!=null&&j.loop&&(ee=J+U<0?Z[Z.length-1]:J+U===Z.length?Z[0]:Z[J+U]),ee&&T.setState("value",ee.getAttribute(Ew))}function V(U){let j=L(),Q=j?.closest(uC),Z;for(;Q&&!Z;)Q=U>0?hYr(Q,uC):mYr(Q,uC),Z=Q?.querySelector(oPe);Z?T.setState("value",Z.getAttribute(Ew)):H(U)}let G=()=>q(z().length-1),M=U=>{U.preventDefault(),U.metaKey?G():U.altKey?V(1):H(1)},X=U=>{U.preventDefault(),U.metaKey?q(0):U.altKey?V(-1):H(-1)};return E.createElement(rl.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:U=>{var j;(j=v.onKeyDown)==null||j.call(v,U);let Q=U.nativeEvent.isComposing||U.keyCode===229;if(!(U.defaultPrevented||Q))switch(U.key){case"n":case"j":{b&&U.ctrlKey&&M(U);break}case"ArrowDown":{M(U);break}case"p":case"k":{b&&U.ctrlKey&&X(U);break}case"ArrowUp":{X(U);break}case"Home":{U.preventDefault(),q(0);break}case"End":{U.preventDefault(),G();break}case"Enter":{U.preventDefault();let Z=L();if(Z){let J=new Event(kre);Z.dispatchEvent(J)}}}}},E.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:bYr},l),B6(e,U=>E.createElement(Ndt.Provider,{value:T},E.createElement(Ddt.Provider,{value:A},U))))}),iYr=E.forwardRef((e,t)=>{var r,n;let s=Xi(),a=E.useRef(null),i=E.useContext(Idt),o=aj(),l=Rdt(e),u=(n=(r=l.current)==null?void 0:r.forceMount)!=null?n:i?.forceMount;y1(()=>{if(!u)return o.item(s,i?.id)},[u]);let d=Pdt(s,a,[e.value,e.children,a],e.keywords),p=Dpe(),f=Iv(C=>C.value&&C.value===d.current),h=Iv(C=>u||o.filter()===!1?!0:C.search?C.filtered.items.get(s)>0:!0);E.useEffect(()=>{let C=a.current;if(!(!C||e.disabled))return C.addEventListener(kre,m),()=>C.removeEventListener(kre,m)},[h,e.onSelect,e.disabled]);function m(){var C,T;g(),(T=(C=l.current).onSelect)==null||T.call(C,d.current)}function g(){p.setState("value",d.current,!0)}if(!h)return null;let{disabled:b,value:v,onSelect:S,forceMount:w,keywords:k,..._}=e;return E.createElement(rl.div,{ref:am(a,t),..._,id:s,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!f,"data-disabled":!!b,"data-selected":!!f,onPointerMove:b||o.getDisablePointerSelection()?void 0:g,onClick:b?void 0:m},e.children)}),oYr=E.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...a}=e,i=Xi(),o=E.useRef(null),l=E.useRef(null),u=Xi(),d=aj(),p=Iv(h=>s||d.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);y1(()=>d.group(i),[]),Pdt(i,o,[e.value,e.heading,l]);let f=E.useMemo(()=>({id:i,forceMount:s}),[s]);return E.createElement(rl.div,{ref:am(o,t),...a,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},r&&E.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},r),B6(e,h=>E.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?u:void 0},E.createElement(Idt.Provider,{value:f},h))))}),lYr=E.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=E.useRef(null),a=Iv(i=>!i.search);return!r&&!a?null:E.createElement(rl.div,{ref:am(s,t),...n,"cmdk-separator":"",role:"separator"})}),cYr=E.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=e.value!=null,a=Dpe(),i=Iv(u=>u.search),o=Iv(u=>u.selectedItemId),l=aj();return E.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),E.createElement(rl.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":o,id:l.inputId,type:"text",value:s?e.value:i,onChange:u=>{s||a.setState("search",u.target.value),r?.(u.target.value)}})}),uYr=E.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,a=E.useRef(null),i=E.useRef(null),o=Iv(u=>u.selectedItemId),l=aj();return E.useEffect(()=>{if(i.current&&a.current){let u=i.current,d=a.current,p,f=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let h=u.offsetHeight;d.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return f.observe(u),()=>{cancelAnimationFrame(p),f.unobserve(u)}}},[]),E.createElement(rl.div,{ref:am(a,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":n,id:l.listId},B6(e,u=>E.createElement("div",{ref:am(i,l.listInnerRef),"cmdk-list-sizer":""},u)))}),dYr=E.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:a,container:i,...o}=e;return E.createElement(eF,{open:r,onOpenChange:n},E.createElement(tF,{container:i},E.createElement(bI,{"cmdk-overlay":"",className:s}),E.createElement(vI,{"aria-label":e.label,"cmdk-dialog":"",className:a},E.createElement(jdt,{ref:t,...o}))))}),pYr=E.forwardRef((e,t)=>Iv(r=>r.filtered.count===0)?E.createElement(rl.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),fYr=E.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...a}=e;return E.createElement(rl.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},B6(e,i=>E.createElement("div",{"aria-hidden":!0},i)))}),Iu=Object.assign(jdt,{List:uYr,Item:iYr,Input:cYr,Group:oYr,Separator:lYr,Dialog:dYr,Empty:pYr,Loading:fYr});function hYr(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function mYr(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Rdt(e){let t=E.useRef(e);return y1(()=>{t.current=e}),t}var y1=typeof window>"u"?E.useEffect:E.useLayoutEffect;function kw(e){let t=E.useRef();return t.current===void 0&&(t.current=e()),t}function Iv(e){let t=Dpe(),r=()=>e(t.snapshot());return E.useSyncExternalStore(t.subscribe,r,r)}function Pdt(e,t,r,n=[]){let s=E.useRef(),a=aj();return y1(()=>{var i;let o=(()=>{var u;for(let d of r){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():s.current}})(),l=n.map(u=>u.trim());a.value(e,o,l),(i=t.current)==null||i.setAttribute(Ew,o),s.current=o}),s}var gYr=()=>{let[e,t]=E.useState(),r=kw(()=>new Map);return y1(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,s)=>{r.current.set(n,s),t({})}};function yYr(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function B6({asChild:e,children:t},r){return e&&E.isValidElement(t)?E.cloneElement(yYr(t),{ref:t.ref},r(t.props.children)):r(t)}var bYr={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};class lo{constructor(t,r,n,s){this.fromA=t,this.toA=r,this.fromB=n,this.toB=s}offset(t,r=t){return new lo(this.fromA+t,this.toA+t,this.fromB+r,this.toB+r)}}function b1(e,t,r,n,s,a){if(e==n)return[];let i=Ipe(e,t,r,n,s,a),o=jpe(e,t+i,r,n,s+i,a);t+=i,r-=o,s+=i,a-=o;let l=r-t,u=a-s;if(!l||!u)return[new lo(t,r,s,a)];if(l>u){let p=e.slice(t,r).indexOf(n.slice(s,a));if(p>-1)return[new lo(t,t+p,s,s),new lo(t+p+u,r,a,a)]}else if(u>l){let p=n.slice(s,a).indexOf(e.slice(t,r));if(p>-1)return[new lo(t,t,s,s+p),new lo(r,r,s+p+l,a)]}if(l==1||u==1)return[new lo(t,r,s,a)];let d=Ldt(e,t,r,n,s,a);if(d){let[p,f,h]=d;return b1(e,t,p,n,s,f).concat(b1(e,p+h,r,n,f+h,a))}return vYr(e,t,r,n,s,a)}let VC=1e9,qC=0,Npe=!1;function vYr(e,t,r,n,s,a){let i=r-t,o=a-s;if(VC<1e9&&Math.min(i,o)>VC*16||qC>0&&Date.now()>qC)return Math.min(i,o)>VC*64?[new lo(t,r,s,a)]:lPe(e,t,r,n,s,a);let l=Math.ceil((i+o)/2);wY.reset(l),EY.reset(l);let u=(h,m)=>e.charCodeAt(t+h)==n.charCodeAt(s+m),d=(h,m)=>e.charCodeAt(r-h-1)==n.charCodeAt(a-m-1),p=(i-o)%2!=0?EY:null,f=p?null:wY;for(let h=0;h<l;h++){if(h>VC||qC>0&&!(h&63)&&Date.now()>qC)return lPe(e,t,r,n,s,a);let m=wY.advance(h,i,o,l,p,!1,u)||EY.advance(h,i,o,l,f,!0,d);if(m)return xYr(e,t,r,t+m[0],n,s,a,s+m[1])}return[new lo(t,r,s,a)]}class $dt{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,r,n,s,a,i,o){for(let l=-t+this.start;l<=t-this.end;l+=2){let u=s+l,d=l==-t||l!=t&&this.vec[u-1]<this.vec[u+1]?this.vec[u+1]:this.vec[u-1]+1,p=d-l;for(;d<r&&p<n&&o(d,p);)d++,p++;if(this.vec[u]=d,d>r)this.end+=2;else if(p>n)this.start+=2;else if(a){let f=s+(r-n)-l;if(f>=0&&f<this.len&&a.vec[f]!=-1)if(i){let h=a.vec[f];if(h>=r-d)return[h,s+h-f]}else{let h=r-a.vec[f];if(d>=h)return[d,p]}}}return null}}const wY=new $dt,EY=new $dt;function xYr(e,t,r,n,s,a,i,o){let l=!1;return!$k(e,n)&&++n==r&&(l=!0),!$k(s,o)&&++o==i&&(l=!0),l?[new lo(t,r,a,i)]:b1(e,t,n,s,a,o).concat(b1(e,n,r,s,o,i))}function Mdt(e,t){let r=1,n=Math.min(e,t);for(;r<n;)r=r<<1;return r}function Ipe(e,t,r,n,s,a){if(t==r||t==a||e.charCodeAt(t)!=n.charCodeAt(s))return 0;let i=Mdt(r-t,a-s);for(let o=t,l=s;;){let u=o+i,d=l+i;if(u>r||d>a||e.slice(o,u)!=n.slice(l,d)){if(i==1)return o-t-($k(e,o)?0:1);i=i>>1}else{if(u==r||d==a)return u-t;o=u,l=d}}}function jpe(e,t,r,n,s,a){if(t==r||s==a||e.charCodeAt(r-1)!=n.charCodeAt(a-1))return 0;let i=Mdt(r-t,a-s);for(let o=r,l=a;;){let u=o-i,d=l-i;if(u<t||d<s||e.slice(u,o)!=n.slice(d,l)){if(i==1)return r-o-($k(e,o)?0:1);i=i>>1}else{if(u==t||d==s)return r-u;o=u,l=d}}}function Ore(e,t,r,n,s,a,i,o){let l=n.slice(s,a),u=null;for(;;){if(u||i<o)return u;for(let d=t+i;;){$k(e,d)||d++;let p=d+i;if($k(e,p)||(p+=p==d+1?1:-1),p>=r)break;let f=e.slice(d,p),h=-1;for(;(h=l.indexOf(f,h+1))!=-1;){let m=Ipe(e,p,r,n,s+h+f.length,a),g=jpe(e,t,d,n,s,s+h),b=f.length+m+g;(!u||u[2]<b)&&(u=[d-g,s+h-g,b])}d=p}if(o<0)return u;i=i>>1}}function Ldt(e,t,r,n,s,a){let i=r-t,o=a-s;if(i<o){let l=Ldt(n,s,a,e,t,r);return l&&[l[1],l[0],l[2]]}return i<4||o*2<i?null:Ore(e,t,r,n,s,a,Math.floor(i/4),-1)}function lPe(e,t,r,n,s,a){Npe=!0;let i=r-t,o=a-s,l;if(i<o){let f=Ore(n,s,a,e,t,r,Math.floor(i/6),50);l=f&&[f[1],f[0],f[2]]}else l=Ore(e,t,r,n,s,a,Math.floor(o/6),50);if(!l)return[new lo(t,r,s,a)];let[u,d,p]=l;return b1(e,t,u,n,s,d).concat(b1(e,u+p,r,n,d+p,a))}function Fdt(e,t){for(let r=1;r<e.length;r++){let n=e[r-1],s=e[r];n.toA>s.fromA-t&&n.toB>s.fromB-t&&(e[r-1]=new lo(n.fromA,s.toA,n.fromB,s.toB),e.splice(r--,1))}}function SYr(e,t,r){for(;;){Fdt(r,1);let n=!1;for(let s=0;s<r.length;s++){let a=r[s],i,o;(i=Ipe(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=r[s]=new lo(a.fromA+i,a.toA,a.fromB+i,a.toB)),(o=jpe(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=r[s]=new lo(a.fromA,a.toA-o,a.fromB,a.toB-o));let l=a.toA-a.fromA,u=a.toB-a.fromB;if(l&&u)continue;let d=a.fromA-(s?r[s-1].toA:0),p=(s<r.length-1?r[s+1].fromA:e.length)-a.toA;if(!d||!p)continue;let f=l?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);d<=f.length&&e.slice(a.fromA-d,a.fromA)==f.slice(f.length-d)?(r[s]=new lo(a.fromA-d,a.toA-d,a.fromB-d,a.toB-d),n=!0):p<=f.length&&e.slice(a.toA,a.toA+p)==f.slice(0,p)&&(r[s]=new lo(a.fromA+p,a.toA+p,a.fromB+p,a.toB+p),n=!0)}if(!n)break}return r}function wYr(e,t,r){for(let n=0,s=0;s<e.length;s++){let a=e[s],i=a.toA-a.fromA,o=a.toB-a.fromB;if(i&&o||i>3||o>3){let l=s==e.length-1?t.length:e[s+1].fromA,u=a.fromA-n,d=l-a.toA,p=uPe(t,a.fromA,u),f=cPe(t,a.toA,d),h=a.fromA-p,m=f-a.toA;if((!i||!o)&&h&&m){let g=Math.max(i,o),[b,v,S]=i?[t,a.fromA,a.toA]:[r,a.fromB,a.toB];g>h&&t.slice(p,a.fromA)==b.slice(S-h,S)?(a=e[s]=new lo(p,p+i,a.fromB-h,a.toB-h),p=a.fromA,f=cPe(t,a.toA,l-a.toA)):g>m&&t.slice(a.toA,f)==b.slice(v,v+m)&&(a=e[s]=new lo(f-i,f,a.fromB+m,a.toB+m),f=a.toA,p=uPe(t,a.fromA,a.fromA-n)),h=a.fromA-p,m=f-a.toA}if(h||m)a=e[s]=new lo(a.fromA-h,a.toA+m,a.fromB-h,a.toB+m);else if(i){if(!o){let g=pPe(t,a.fromA,a.toA),b,v=g<0?-1:dPe(t,a.toA,a.fromA);g>-1&&(b=g-a.fromA)<=d&&t.slice(a.fromA,g)==t.slice(a.toA,a.toA+b)?a=e[s]=a.offset(b):v>-1&&(b=a.toA-v)<=u&&t.slice(a.fromA-b,a.fromA)==t.slice(v,a.toA)&&(a=e[s]=a.offset(-b))}}else{let g=pPe(r,a.fromB,a.toB),b,v=g<0?-1:dPe(r,a.toB,a.fromB);g>-1&&(b=g-a.fromB)<=d&&r.slice(a.fromB,g)==r.slice(a.toB,a.toB+b)?a=e[s]=a.offset(b):v>-1&&(b=a.toB-v)<=u&&r.slice(a.fromB-b,a.fromB)==r.slice(v,a.toB)&&(a=e[s]=a.offset(-b))}}n=a.toA}return Fdt(e,3),e}let A0;try{A0=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Bdt(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function zdt(e,t){if(t==e.length)return 0;let r=e.charCodeAt(t);return r<192?Bdt(r)?1:0:A0?!qdt(r)||t==e.length-1?A0.test(String.fromCharCode(r))?1:0:A0.test(e.slice(t,t+2))?2:0:0}function Udt(e,t){if(!t)return 0;let r=e.charCodeAt(t-1);return r<192?Bdt(r)?1:0:A0?!Hdt(r)||t==1?A0.test(String.fromCharCode(r))?1:0:A0.test(e.slice(t-2,t))?2:0:0}const Vdt=8;function cPe(e,t,r){if(t==e.length||!Udt(e,t))return t;for(let n=t,s=t+r,a=0;a<Vdt;a++){let i=zdt(e,n);if(!i||n+i>s)return n;n+=i}return t}function uPe(e,t,r){if(!t||!zdt(e,t))return t;for(let n=t,s=t-r,a=0;a<Vdt;a++){let i=Udt(e,n);if(!i||n-i<s)return n;n-=i}return t}function dPe(e,t,r){for(;t!=r;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function pPe(e,t,r){for(;t!=r;t++)if(e.charCodeAt(t)==10)return t;return-1}const qdt=e=>e>=55296&&e<=56319,Hdt=e=>e>=56320&&e<=57343;function $k(e,t){return!t||t==e.length||!qdt(e.charCodeAt(t-1))||!Hdt(e.charCodeAt(t))}function EYr(e,t,r){var n;let s=r?.override;return s?s(e,t):(VC=((n=r?.scanLimit)!==null&&n!==void 0?n:1e9)>>1,qC=r?.timeout?Date.now()+r.timeout:0,Npe=!1,SYr(e,t,b1(e,0,e.length,t,0,t.length)))}function Qdt(){return!Npe}function Gdt(e,t,r){return wYr(EYr(e,t,r),e,t)}const Ph=Xt.define({combine:e=>e[0]}),_re=en.define(),kYr=Xt.define(),Mk=Ji.define({create(e){return null},update(e,t){for(let r of t.effects)r.is(_re)&&(e=r.value);for(let r of t.state.facet(kYr))e=r(e,t);return e}});class SE{constructor(t,r,n,s,a,i=!0){this.changes=t,this.fromA=r,this.toA=n,this.fromB=s,this.toB=a,this.precise=i}offset(t,r){return t||r?new SE(this.changes,this.fromA+t,this.toA+t,this.fromB+r,this.toB+r,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,r,n){let s=Gdt(t.toString(),r.toString(),n);return Zdt(s,t,r,0,0,Qdt())}static updateA(t,r,n,s,a){return yPe(gPe(t,s,!0,n.length),t,r,n,a)}static updateB(t,r,n,s,a){return yPe(gPe(t,s,!1,r.length),t,r,n,a)}}function fPe(e,t,r,n){let s=r.lineAt(e),a=n.lineAt(t);return s.to==e&&a.to==t&&e<r.length&&t<n.length?[e+1,t+1]:[s.from,a.from]}function hPe(e,t,r,n){let s=r.lineAt(e),a=n.lineAt(t);return s.from==e&&a.from==t?[e,t]:[s.to+1,a.to+1]}function Zdt(e,t,r,n,s,a){let i=[];for(let o=0;o<e.length;o++){let l=e[o],[u,d]=fPe(l.fromA+n,l.fromB+s,t,r),[p,f]=hPe(l.toA+n,l.toB+s,t,r),h=[l.offset(-u+n,-d+s)];for(;o<e.length-1;){let m=e[o+1],[g,b]=fPe(m.fromA+n,m.fromB+s,t,r);if(g>p+1&&b>f+1)break;h.push(m.offset(-u+n,-d+s)),[p,f]=hPe(m.toA+n,m.toB+s,t,r),o++}i.push(new SE(h,u,Math.max(u,p),d,Math.max(d,f),a))}return i}const xP=1e3;function mPe(e,t,r,n){let s=0,a=e.length;for(;;){if(s==a){let d=0,p=0;s&&({toA:d,toB:p}=e[s-1]);let f=t-(r?d:p);return[d+f,p+f]}let i=s+a>>1,o=e[i],[l,u]=r?[o.fromA,o.toA]:[o.fromB,o.toB];if(l>t)a=i;else if(u<=t)s=i+1;else return n?[o.fromA,o.fromB]:[o.toA,o.toB]}}function gPe(e,t,r,n){let s=[];return t.iterChangedRanges((a,i,o,l)=>{let u=0,d=r?t.length:n,p=0,f=r?n:t.length;a>xP&&([u,p]=mPe(e,a-xP,r,!0)),i<t.length-xP&&([d,f]=mPe(e,i+xP,r,!1));let h=l-o-(i-a),m,[g,b]=r?[h,0]:[0,h];s.length&&(m=s[s.length-1]).toA>=u?s[s.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:f,diffA:m.diffA+g,diffB:m.diffB+b}:s.push({fromA:u,toA:d,fromB:p,toB:f,diffA:g,diffB:b})}),s}function yPe(e,t,r,n,s){if(!e.length)return t;let a=[];for(let i=0,o=0,l=0,u=0;;i++){let d=i==e.length?null:e[i],p=d?d.fromA+o:r.length,f=d?d.fromB+l:n.length;for(;u<t.length;){let b=t[u];if(b.endA+o>p||b.endB+l>f)break;a.push(b.offset(o,l)),u++}if(!d)break;let h=d.toA+o+d.diffA,m=d.toB+l+d.diffB,g=Gdt(r.sliceString(p,h),n.sliceString(f,m),s);for(let b of Zdt(g,r,n,p,f,Qdt()))a.push(b);for(o+=d.diffA,l+=d.diffB;u<t.length;){let b=t[u];if(b.fromA+o>h&&b.fromB+l>m)break;u++}}return a}const OYr={scanLimit:500},Wdt=xi.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=xPe(e))}update(e){(e.docChanged||e.viewportChanged||_Yr(e.startState,e.state)||CYr(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=xPe(e.view))}},{decorations:e=>e.deco}),SP=Wf.low($qe({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(Wdt))===null||t===void 0?void 0:t.gutter)||Yn.empty}}));function _Yr(e,t){return e.field(Mk,!1)!=t.field(Mk,!1)}function CYr(e,t){return e.facet(Ph)!=t.facet(Ph)}const bPe=rr.line({class:"cm-changedLine"}),TYr=rr.mark({class:"cm-changedText"}),AYr=rr.mark({tagName:"ins",class:"cm-insertedLine"}),DYr=rr.mark({tagName:"del",class:"cm-deletedLine"}),vPe=new class extends cm{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function NYr(e,t,r,n,s,a){let i=r?e.fromA:e.fromB,o=r?e.toA:e.toB,l=0;if(i!=o){s.add(i,i,bPe),s.add(i,o,r?DYr:AYr),a&&a.add(i,i,vPe);for(let u=t.iterRange(i,o-1),d=i;!u.next().done;){if(u.lineBreak){d++,s.add(d,d,bPe),a&&a.add(d,d,vPe);continue}let p=d+u.value.length;if(n)for(;l<e.changes.length;){let f=e.changes[l],h=i+(r?f.fromA:f.fromB),m=i+(r?f.toA:f.toB),g=Math.max(d,h),b=Math.min(p,m);if(g<b&&s.add(g,b,TYr),m<p)l++;else break}d=p}}}function xPe(e){let t=e.state.field(Mk),{side:r,highlightChanges:n,markGutter:s,overrideChunk:a}=e.state.facet(Ph),i=r=="a",o=new bu,l=s?new bu:null,{from:u,to:d}=e.viewport;for(let p of t){if((i?p.fromA:p.fromB)>=d)break;(i?p.toA:p.toB)>u&&(!a||!a(e.state,p,o,l))&&NYr(p,e.state.doc,i,n,o,l)}return{deco:o.finish(),gutter:l&&l.finish()}}class wP extends $d{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 k4=en.define({map:(e,t)=>e.map(t)}),HC=Ji.define({create:()=>rr.none,update:(e,t)=>{for(let r of t.effects)if(r.is(k4))return r.value;return e.map(t.changes)},provide:e=>ht.decorations.from(e)}),EP=.01;function SPe(e,t){if(e.size!=t.size)return!1;let r=e.iter(),n=t.iter();for(;r.value;){if(r.from!=n.from||Math.abs(r.value.spec.widget.height-n.value.spec.widget.height)>1)return!1;r.next(),n.next()}return!0}function IYr(e,t,r){let n=new bu,s=new bu,a=e.state.field(HC).iter(),i=t.state.field(HC).iter(),o=0,l=0,u=0,d=0,p=e.viewport,f=t.viewport;for(let b=0;;b++){let v=b<r.length?r[b]:null,S=v?v.fromA:e.state.doc.length,w=v?v.fromB:t.state.doc.length;if(o<S){let k=e.lineBlockAt(o).top+u,_=t.lineBlockAt(l).top+d,C=k-_;C<-EP?(u-=C,n.add(o,o,rr.widget({widget:new wP(-C),block:!0,side:-1}))):C>EP&&(d+=C,s.add(l,l,rr.widget({widget:new wP(C),block:!0,side:-1})))}if(S>o+1e3&&o<p.from&&S>p.from&&l<f.from&&w>f.from){let k=Math.min(p.from-o,f.from-l);o+=k,l+=k,b--}else if(v)o=v.toA,l=v.toB;else break;for(;a.value&&a.from<o;)u-=a.value.spec.widget.height,a.next();for(;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next()}for(;a.value;)u-=a.value.spec.widget.height,a.next();for(;i.value;)d-=i.value.spec.widget.height,i.next();let h=e.contentHeight+u-(t.contentHeight+d);h<EP?n.add(e.state.doc.length,e.state.doc.length,rr.widget({widget:new wP(-h),block:!0,side:1})):h>EP&&s.add(t.state.doc.length,t.state.doc.length,rr.widget({widget:new wP(h),block:!0,side:1}));let m=n.finish(),g=s.finish();SPe(m,e.state.field(HC))||e.dispatch({effects:k4.of(m)}),SPe(g,t.state.field(HC))||t.dispatch({effects:k4.of(g)})}const Cre=en.define({map:(e,t)=>t.mapPos(e)});class jYr extends $d{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=t.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",n=>{let s=t.posAtDOM(n.target);t.dispatch({effects:Cre.of(s)});let{side:a,sibling:i}=t.state.facet(Ph);i&&i().dispatch({effects:Cre.of(RYr(s,t.state.field(Mk),a=="a"))})}),r}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function RYr(e,t,r){let n=0,s=0;for(let a=0;;a++){let i=a<t.length?t[a]:null;if(!i||(r?i.fromA:i.fromB)>=e)return s+(e-n);[n,s]=r?[i.toA,i.toB]:[i.toB,i.toA]}}const PYr=Ji.define({create(e){return rr.none},update(e,t){e=e.map(t.changes);for(let r of t.effects)r.is(Cre)&&(e=e.update({filter:n=>n!=r.value}));return e},provide:e=>ht.decorations.from(e)});function wPe({margin:e=3,minSize:t=4}){return PYr.init(r=>$Yr(r,e,t))}function $Yr(e,t,r){let n=new bu,s=e.facet(Ph).side=="a",a=e.field(Mk),i=1;for(let o=0;;o++){let l=o<a.length?a[o]:null,u=o?i+t:1,d=l?e.doc.lineAt(s?l.fromA:l.fromB).number-1-t:e.doc.lines,p=d-u+1;if(p>=r&&n.add(e.doc.line(u).from,e.doc.line(d).to,rr.replace({widget:new jYr(p),block:!0})),!l)break;i=e.doc.lineAt(Math.min(e.doc.length,s?l.toA:l.toB)).number}return n.finish()}const MYr=ht.styleModule.of(new Wg({".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"}})),LYr=ht.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"}}),EPe=new rO,kP=new rO;class FYr{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||OYr;let r=[Wf.low(Wdt),LYr,MYr,HC,ht.updateListener.of(p=>{this.measuring<0&&(p.heightChanged||p.viewportChanged)&&!p.transactions.some(f=>f.effects.some(h=>h.is(k4)))&&this.measure()})],n=[Ph.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&n.push(SP);let s=Zn.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],ht.editorAttributes.of({class:"cm-merge-a"}),kP.of(n),r]}),a=[Ph.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&a.push(SP);let i=Zn.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],ht.editorAttributes.of({class:"cm-merge-b"}),kP.of(a),r]});this.chunks=SE.build(s.doc,i.doc,this.diffConf);let o=[Mk.init(()=>this.chunks),EPe.of(t.collapseUnchanged?wPe(t.collapseUnchanged):[])];s=s.update({effects:en.appendConfig.of(o)}).state,i=i.update({effects:en.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 l=t.orientation||"a-b",u=document.createElement("div");u.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?u:d),this.editorDOM.appendChild(l=="a-b"?d:u),this.a=new ht({state:s,parent:u,root:t.root,dispatchTransactions:p=>this.dispatch(p,this.a)}),this.b=new ht({state:i,parent:d,root:t.root,dispatchTransactions:p=>this.dispatch(p,this.b)}),this.setupRevertControls(!!t.revertControls,t.revertControls=="b-to-a",t.renderRevertControl),t.parent&&t.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(t,r){if(t.some(n=>n.docChanged)){let n=t[t.length-1],s=t.reduce((i,o)=>i.compose(o.changes),io.empty(t[0].startState.doc.length));this.chunks=r==this.a?SE.updateA(this.chunks,n.newDoc,this.b.state.doc,s,this.diffConf):SE.updateB(this.chunks,this.a.state.doc,n.newDoc,s,this.diffConf),r.update([...t,n.state.update({effects:_re.of(this.chunks)})]);let a=r==this.a?this.b:this.a;a.update([a.state.update({effects:_re.of(this.chunks)})]),this.scheduleMeasure()}else r.update(t)}reconfigure(t){if("diffConfig"in t&&(this.diffConf=t.diffConfig),"orientation"in t){let a=t.orientation!="b-a";if(a!=(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(a?i:o,this.editorDOM.firstChild),this.editorDOM.appendChild(a?o:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in t||"renderRevertControl"in t){let a=!!this.revertDOM,i=this.revertToA,o=this.renderRevert;"revertControls"in t&&(a=!!t.revertControls,i=t.revertControls=="b-to-a"),"renderRevertControl"in t&&(o=t.renderRevertControl),this.setupRevertControls(a,i,o)}let r="highlightChanges"in t,n="gutter"in t,s="collapseUnchanged"in t;if(r||n||s){let a=[],i=[];if(r||n){let o=this.a.state.facet(Ph),l=n?t.gutter!==!1:o.markGutter,u=r?t.highlightChanges!==!1:o.highlightChanges;a.push(kP.reconfigure([Ph.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:l}),l?SP:[]])),i.push(kP.reconfigure([Ph.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:l}),l?SP:[]]))}if(s){let o=EPe.reconfigure(t.collapseUnchanged?wPe(t.collapseUnchanged):[]);a.push(o),i.push(o)}this.a.dispatch({effects:a}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(t,r,n){this.revertToA=r,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!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",s=>this.revertClicked(s)),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(){IYr(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let t=this.revertDOM,r=t.firstChild,n=this.a.viewport,s=this.b.viewport;for(let a=0;a<this.chunks.length;a++){let i=this.chunks[a];if(i.fromA>n.to||i.fromB>s.to)break;if(i.fromA<n.from||i.fromB<s.from)continue;let o=this.a.lineBlockAt(i.fromA).top+"px";for(;r&&+r.dataset.chunk<a;)r=kPe(r);r&&r.dataset.chunk==String(a)?(r.style.top!=o&&(r.style.top=o),r=r.nextSibling):t.insertBefore(this.renderRevertButton(o,a),r)}for(;r;)r=kPe(r)}renderRevertButton(t,r){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement("button");let s=this.a.state.phrase("Revert this chunk");n.setAttribute("aria-label",s),n.setAttribute("title",s),n.textContent=this.revertToLeft?"⇜":"⇝"}return n.style.top=t,n.setAttribute("data-chunk",String(r)),n}revertClicked(t){let r=t.target,n;for(;r&&r.parentNode!=this.revertDOM;)r=r.parentNode;if(r&&(n=this.chunks[r.dataset.chunk])){let[s,a,i,o,l,u]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],d=s.state.sliceDoc(i,Math.max(i,o-1));i!=o&&u<=a.state.doc.length&&(d+=s.state.lineBreak),a.dispatch({changes:{from:l,to:Math.min(a.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 kPe(e){let t=e.nextSibling;return e.remove(),t}function Xdt(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Xdt(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ydt(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Xdt(e))&&(n&&(n+=" "),n+=t);return n}const BYr=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},zYr=(e,t)=>({classGroupId:e,validator:t}),Kdt=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),O4="-",OPe=[],UYr="arbitrary..",VYr=e=>{const t=HYr(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return qYr(i);const o=i.split(O4),l=o[0]===""&&o.length>1?1:0;return Jdt(o,l,t)},getConflictingClassGroupIds:(i,o)=>{if(o){const l=n[i],u=r[i];return l?u?BYr(u,l):l:u||OPe}return r[i]||OPe}}},Jdt=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const u=Jdt(e,t+1,a);if(u)return u}const i=r.validators;if(i===null)return;const o=t===0?e.join(O4):e.slice(t).join(O4),l=i.length;for(let u=0;u<l;u++){const d=i[u];if(d.validator(o))return d.classGroupId}},qYr=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?UYr+n:void 0})(),HYr=e=>{const{theme:t,classGroups:r}=e;return QYr(r,t)},QYr=(e,t)=>{const r=Kdt();for(const n in e){const s=e[n];Rpe(s,r,n,t)}return r},Rpe=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];GYr(i,t,r,n)}},GYr=(e,t,r,n)=>{if(typeof e=="string"){ZYr(e,t,r);return}if(typeof e=="function"){WYr(e,t,r,n);return}XYr(e,t,r,n)},ZYr=(e,t,r)=>{const n=e===""?t:ept(t,e);n.classGroupId=r},WYr=(e,t,r,n)=>{if(YYr(e)){Rpe(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(zYr(r,e))},XYr=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[o,l]=s[i];Rpe(l,ept(t,o),r,n)}},ept=(e,t)=>{let r=e;const n=t.split(O4),s=n.length;for(let a=0;a<s;a++){const i=n[a];let o=r.nextPart.get(i);o||(o=Kdt(),r.nextPart.set(i,o)),r=o}return r},YYr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,KYr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},Tre="!",_Pe=":",JYr=[],CPe=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),eKr=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,o=0,l=0,u;const d=s.length;for(let g=0;g<d;g++){const b=s[g];if(i===0&&o===0){if(b===_Pe){a.push(s.slice(l,g)),l=g+1;continue}if(b==="/"){u=g;continue}}b==="["?i++:b==="]"?i--:b==="("?o++:b===")"&&o--}const p=a.length===0?s:s.slice(l);let f=p,h=!1;p.endsWith(Tre)?(f=p.slice(0,-1),h=!0):p.startsWith(Tre)&&(f=p.slice(1),h=!0);const m=u&&u>l?u-l:void 0;return CPe(a,h,f,m)};if(t){const s=t+_Pe,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):CPe(JYr,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},tKr=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const i=r[a],o=i[0]==="[",l=t.has(i);o||l?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},rKr=e=>({cache:KYr(e.cacheSize),parseClassName:eKr(e),sortModifiers:tKr(e),...VYr(e)}),nKr=/\s+/,sKr=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],o=e.trim().split(nKr);let l="";for(let u=o.length-1;u>=0;u-=1){const d=o[u],{isExternal:p,modifiers:f,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}=r(d);if(p){l=d+(l.length>0?" "+l:l);continue}let b=!!g,v=n(b?m.substring(0,g):m);if(!v){if(!b){l=d+(l.length>0?" "+l:l);continue}if(v=n(m),!v){l=d+(l.length>0?" "+l:l);continue}b=!1}const S=f.length===0?"":f.length===1?f[0]:a(f).join(":"),w=h?S+Tre:S,k=w+v;if(i.indexOf(k)>-1)continue;i.push(k);const _=s(v,b);for(let C=0;C<_.length;++C){const T=_[C];i.push(w+T)}l=d+(l.length>0?" "+l:l)}return l},aKr=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=tpt(r))&&(s&&(s+=" "),s+=n);return s},tpt=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=tpt(e[n]))&&(r&&(r+=" "),r+=t);return r},TPe=(e,...t)=>{let r,n,s,a;const i=l=>{const u=t.reduce((d,p)=>p(d),e());return r=rKr(u),n=r.cache.get,s=r.cache.set,a=o,o(l)},o=l=>{const u=n(l);if(u)return u;const d=sKr(l,r);return s(l,d),d};return a=i,(...l)=>a(aKr(...l))},iKr=[],Eo=e=>{const t=r=>r[e]||iKr;return t.isThemeGetter=!0,t},rpt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,npt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oKr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lKr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cKr=/\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$/,uKr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dKr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pKr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fb=e=>oKr.test(e),Qn=e=>!!e&&!Number.isNaN(Number(e)),hb=e=>!!e&&Number.isInteger(Number(e)),kY=e=>e.endsWith("%")&&Qn(e.slice(0,-1)),fg=e=>lKr.test(e),spt=()=>!0,fKr=e=>cKr.test(e)&&!uKr.test(e),Ppe=()=>!1,hKr=e=>dKr.test(e),mKr=e=>pKr.test(e),gKr=e=>!br(e)&&!wr(e),yKr=e=>rx(e,opt,Ppe),br=e=>rpt.test(e),Fx=e=>rx(e,lpt,fKr),APe=e=>rx(e,OKr,Qn),bKr=e=>rx(e,upt,spt),vKr=e=>rx(e,cpt,Ppe),DPe=e=>rx(e,apt,Ppe),xKr=e=>rx(e,ipt,mKr),OP=e=>rx(e,dpt,hKr),wr=e=>npt.test(e),dC=e=>iS(e,lpt),SKr=e=>iS(e,cpt),NPe=e=>iS(e,apt),wKr=e=>iS(e,opt),EKr=e=>iS(e,ipt),_P=e=>iS(e,dpt,!0),kKr=e=>iS(e,upt,!0),rx=(e,t,r)=>{const n=rpt.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},iS=(e,t,r=!1)=>{const n=npt.exec(e);return n?n[1]?t(n[1]):r:!1},apt=e=>e==="position"||e==="percentage",ipt=e=>e==="image"||e==="url",opt=e=>e==="length"||e==="size"||e==="bg-size",lpt=e=>e==="length",OKr=e=>e==="number",cpt=e=>e==="family-name",upt=e=>e==="number"||e==="weight",dpt=e=>e==="shadow",IPe=()=>{const e=Eo("color"),t=Eo("font"),r=Eo("text"),n=Eo("font-weight"),s=Eo("tracking"),a=Eo("leading"),i=Eo("breakpoint"),o=Eo("container"),l=Eo("spacing"),u=Eo("radius"),d=Eo("shadow"),p=Eo("inset-shadow"),f=Eo("text-shadow"),h=Eo("drop-shadow"),m=Eo("blur"),g=Eo("perspective"),b=Eo("aspect"),v=Eo("ease"),S=Eo("animate"),w=()=>["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(),wr,br],C=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],A=()=>[wr,br,l],N=()=>[fb,"full","auto",...A()],I=()=>[hb,"none","subgrid",wr,br],R=()=>["auto",{span:["full",hb,wr,br]},hb,wr,br],$=()=>[hb,"auto",wr,br],F=()=>["auto","min","max","fr",wr,br],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...A()],H=()=>[fb,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],V=()=>[fb,"screen","full","dvw","lvw","svw","min","max","fit",...A()],G=()=>[fb,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],M=()=>[e,wr,br],X=()=>[...k(),NPe,DPe,{position:[wr,br]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",wKr,yKr,{size:[wr,br]}],Q=()=>[kY,dC,Fx],Z=()=>["","none","full",u,wr,br],J=()=>["",Qn,dC,Fx],ee=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[Qn,kY,NPe,DPe],ce=()=>["","none",m,wr,br],Se=()=>["none",Qn,wr,br],W=()=>["none",Qn,wr,br],ne=()=>[Qn,wr,br],ae=()=>[fb,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fg],breakpoint:[fg],color:[spt],container:[fg],"drop-shadow":[fg],ease:["in","out","in-out"],font:[gKr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fg],shadow:[fg],spacing:["px",Qn],text:[fg],"text-shadow":[fg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",fb,br,wr,b]}],container:["container"],columns:[{columns:[Qn,br,wr,o]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"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:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[hb,"auto",wr,br]}],basis:[{basis:[fb,"full","auto",o,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Qn,fb,"auto","initial","none",br]}],grow:[{grow:["",Qn,wr,br]}],shrink:[{shrink:["",Qn,wr,br]}],order:[{order:[hb,"first","last","none",wr,br]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:R()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:R()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],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":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[o,"screen",...H()]}],"min-w":[{"min-w":[o,"screen","none",...H()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,dC,Fx]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,kKr,bKr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",kY,br]}],"font-family":[{font:[SKr,vKr,t]}],"font-features":[{"font-features":[br]}],"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:[s,wr,br]}],"line-clamp":[{"line-clamp":[Qn,"none",wr,APe]}],leading:[{leading:[a,...A()]}],"list-image":[{"list-image":["none",wr,br]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",wr,br]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Qn,"from-font","auto",wr,Fx]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Qn,"auto",wr,br]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",wr,br]}],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",wr,br]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},hb,wr,br],radial:["",wr,br],conic:[hb,wr,br]},EKr,xKr]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Qn,wr,br]}],"outline-w":[{outline:["",Qn,dC,Fx]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,_P,OP]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",p,_P,OP]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Qn,Fx]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",f,_P,OP]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Qn,wr,br]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"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":[Qn]}],"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":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"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":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"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":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"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":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"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":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"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":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"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":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[wr,br]}],"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":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":[Qn]}],"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":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",wr,br]}],filter:[{filter:["","none",wr,br]}],blur:[{blur:ce()}],brightness:[{brightness:[Qn,wr,br]}],contrast:[{contrast:[Qn,wr,br]}],"drop-shadow":[{"drop-shadow":["","none",h,_P,OP]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Qn,wr,br]}],"hue-rotate":[{"hue-rotate":[Qn,wr,br]}],invert:[{invert:["",Qn,wr,br]}],saturate:[{saturate:[Qn,wr,br]}],sepia:[{sepia:["",Qn,wr,br]}],"backdrop-filter":[{"backdrop-filter":["","none",wr,br]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[Qn,wr,br]}],"backdrop-contrast":[{"backdrop-contrast":[Qn,wr,br]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Qn,wr,br]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qn,wr,br]}],"backdrop-invert":[{"backdrop-invert":["",Qn,wr,br]}],"backdrop-opacity":[{"backdrop-opacity":[Qn,wr,br]}],"backdrop-saturate":[{"backdrop-saturate":[Qn,wr,br]}],"backdrop-sepia":[{"backdrop-sepia":["",Qn,wr,br]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",wr,br]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Qn,"initial",wr,br]}],ease:[{ease:["linear","initial",v,wr,br]}],delay:[{delay:[Qn,wr,br]}],animate:[{animate:["none",S,wr,br]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,wr,br]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:Se()}],"rotate-x":[{"rotate-x":Se()}],"rotate-y":[{"rotate-y":Se()}],"rotate-z":[{"rotate-z":Se()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:ne()}],"skew-x":[{"skew-x":ne()}],"skew-y":[{"skew-y":ne()}],transform:[{transform:[wr,br,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",wr,br]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",wr,br]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Qn,dC,Fx,APe]}],stroke:[{stroke:["none",...M()]}],"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"]}},_Kr=(e,{cacheSize:t,prefix:r,experimentalParseClassName:n,extend:s={},override:a={}})=>(QC(e,"cacheSize",t),QC(e,"prefix",r),QC(e,"experimentalParseClassName",n),CP(e.theme,a.theme),CP(e.classGroups,a.classGroups),CP(e.conflictingClassGroups,a.conflictingClassGroups),CP(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),QC(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),TP(e.theme,s.theme),TP(e.classGroups,s.classGroups),TP(e.conflictingClassGroups,s.conflictingClassGroups),TP(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),ppt(e,s,"orderSensitiveModifiers"),e),QC=(e,t,r)=>{r!==void 0&&(e[t]=r)},CP=(e,t)=>{if(t)for(const r in t)QC(e,r,t[r])},TP=(e,t)=>{if(t)for(const r in t)ppt(e,t,r)},ppt=(e,t,r)=>{const n=t[r];n!==void 0&&(e[r]=e[r]?e[r].concat(n):n)},CKr=(e,...t)=>typeof e=="function"?TPe(IPe,e,...t):TPe(()=>_Kr(IPe(),e),...t),TKr=Object.keys({...fze,...hjt}),AKr=Object.keys(xjt),DKr=Object.keys(mjt),NKr=Object.keys(gjt),IKr=Object.keys(fjt),Bx=Object.keys(vjt),jKr=Object.keys(yjt).concat(Object.keys(bjt)),RKr=CKr({extend:{theme:{color:TKr,spacing:AKr,radius:IKr,leading:NKr,shadow:jKr},classGroups:{"font-size":[{text:DKr}],h:[{h:Bx}],w:[{w:Bx}],size:[{size:Bx}],"min-h":[{"min-h":Bx}],"min-w":[{"min-w":Bx}],"max-h":[{"max-h":Bx}],"max-w":[{"max-w":Bx}]}}});function K(...e){return RKr(Ydt(e))}const oi={sm:"h-form-sm",md:"h-form-md",lg:"h-form-lg",default:"h-form-default"},sh="focus:outline-none focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",PKr="focus-within:outline-none focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",ij="rounded-md",$Kr={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"},ve=({children:e,className:t,size:r="default",...n})=>c.jsx("span",{className:K("block",$Kr[r],t),...n,children:e}),nc=Mjt,dn=Ljt,pn=Fjt,sn=E.forwardRef(({className:e,sideOffset:t=4,children:r,...n},s)=>c.jsx(Bjt,{children:c.jsxs(kze,{ref:s,sideOffset:t,className:K("z-50 overflow-hidden rounded-md bg-surface6 px-3 py-1.5 text-xs text-neutral4 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n,children:[r,c.jsx(zjt,{className:"fill-surface6"})]})}));sn.displayName=kze.displayName;const MKr={sm:`${oi.sm} w-form-sm`,md:`${oi.md} w-form-md`,lg:`${oi.lg} w-form-lg`,default:`${oi.default}`},LKr={sm:"sm",md:"default",lg:"lg",default:"default"},FKr={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"},BKr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",oa=Ee.forwardRef(({className:e,children:t,tooltip:r,size:n="md",variant:s="default",disabled:a,...i},o)=>c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx("button",{ref:o,disabled:a,"aria-label":typeof r=="string"?r:void 0,className:K(BKr,sh,FKr[s],MKr[n],a&&"active:scale-100",e),...i,children:c.jsx(ve,{size:LKr[n],children:t})})}),c.jsx(sn,{children:r})]}));oa.displayName="IconButton";const zKr={"ui-xs":"text-ui-xs leading-ui-xs","ui-sm":"text-ui-sm leading-ui-sm","ui-md":"text-ui-md leading-ui-md","ui-lg":"text-ui-lg leading-ui-lg","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"},UKr={mono:"font-mono"},ze=({as:e="p",className:t,variant:r="ui-md",font:n,...s})=>c.jsx(e,{className:K(zKr[r],n&&UKr[n],t),...s}),Wr={colors:"transition-colors duration-normal ease-out-custom",all:"transition-all duration-normal ease-out-custom",opacity:"transition-opacity duration-normal ease-out-custom",allSlow:"transition-all duration-slow ease-out-custom"},nx={visible:"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},VKr={sm:"h-avatar-sm w-avatar-sm",md:"h-avatar-md w-avatar-md",lg:"h-avatar-lg w-avatar-lg"},fpt=({src:e,name:t,size:r="sm",interactive:n=!1})=>c.jsx("div",{className:K(VKr[r],"border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",Wr.all,n&&"cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"),children:e?c.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):c.jsx(ze,{variant:"ui-md",className:"text-center text-neutral4",children:t[0].toUpperCase()})}),z6=({copiedDuration:e=1500}={})=>{const[t,r]=E.useState(!1);return{isCopied:t,copyToClipboard:s=>{s&&navigator.clipboard.writeText(s).then(()=>{r(!0),setTimeout(()=>r(!1),e)})}}},qKr=ezt({style:zie.coldarkDark,customStyle:{margin:0,backgroundColor:"black"}}),HKr=()=>c.jsx(b3t,{remarkPlugins:[$Ue],className:"aui-md",components:ZKr}),jPe=E.memo(HKr),QKr=({language:e,code:t})=>{const{isCopied:r,copyToClipboard:n}=z6(),s=()=>{!t||r||n(t)};return c.jsxs("div",{style:{background:"hsl(0 0% 100% / 0.06)",borderTopRightRadius:"0.5rem",borderTopLeftRadius:"0.5rem",marginTop:"0.5rem",border:"1px solid hsl(0 0% 20.4%)",borderBottom:"none"},className:"flex items-center justify-between gap-4 px-4 py-2 text-sm font-semibold text-white",children:[c.jsx("span",{className:"lowercase [&>span]:text-xs",children:e}),c.jsx(oa,{variant:"light",size:"md",tooltip:"Copy",onClick:s,children:c.jsxs("span",{className:"grid",children:[c.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",r?"scale-100":"scale-0"),children:c.jsx(ya,{size:14})},"checkmark"),c.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",r?"scale-0":"scale-100"),children:c.jsx(Ql,{size:14})},"copy")]})})]})},GKr=({alt:e,src:t,...r})=>{const[n,s]=E.useState(!1);return E.useEffect(()=>{s(!1)},[t]),n||!t?c.jsxs("div",{children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",width:"150",height:"150",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})}),c.jsx("p",{className:"text-xs italic text-neutral3 -mt-2.5 mb-2.5",children:"Image link is broken"})]}):c.jsx("img",{src:t,alt:e,...r,onError:()=>{s(!0)}})},ZKr=r3t({h1:({className:e,...t})=>c.jsx("h1",{className:K("mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",e),...t,style:{marginBottom:"2rem"}}),h2:({className:e,...t})=>c.jsx("h2",{className:K("mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"2rem"}}),h3:({className:e,...t})=>c.jsx("h3",{className:K("scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1.5rem"}}),h4:({className:e,...t})=>c.jsx("h4",{className:K("scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1.5rem"}}),h5:({className:e,...t})=>c.jsx("h5",{className:K("font-semibold first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1rem"}}),h6:({className:e,...t})=>c.jsx("h6",{className:K("font-semibold first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1rem"}}),p:({className:e,...t})=>c.jsx("p",{className:K("leading-7 first:mt-0 last:mb-0",e),...t}),a:({className:e,...t})=>c.jsx("a",{className:K("text-neutral6 font-medium underline underline-offset-4",e),...t}),blockquote:({className:e,...t})=>c.jsx("blockquote",{className:K("border-l-2 pl-6 italic",e),...t}),ul:({className:e,...t})=>c.jsx("ul",{className:K("my-5 ml-6 list-disc [&>li]:mt-2",e),...t}),ol:({className:e,...t})=>c.jsx("ol",{className:K("my-5 ml-6 list-decimal [&>li]:mt-2",e),...t}),hr:({className:e,...t})=>c.jsx("hr",{className:K("my-5 border-b",e),...t}),table:({className:e,...t})=>c.jsx("table",{className:K("my-5 w-full border-separate border-spacing-0 overflow-y-auto",e),...t}),th:({className:e,...t})=>c.jsx("th",{className:K("bg-surface4 px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right",e),...t}),td:({className:e,...t})=>c.jsx("td",{className:K("border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right",e),...t}),tr:({className:e,...t})=>c.jsx("tr",{className:K("m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",e),...t}),sup:({className:e,...t})=>c.jsx("sup",{className:K("[&>a]:text-xs [&>a]:no-underline",e),...t}),pre:({className:e,...t})=>c.jsx("pre",{...t,style:{borderBottomRightRadius:"0.5rem",borderBottomLeftRadius:"0.5rem",background:"transparent",fontSize:"0.875rem",marginBottom:"0.5rem",border:"1px solid hsl(0 0% 20.4%)"},className:K("overflow-x-auto p-4 text-white",e)}),code:function({className:t,...r}){const n=uUe();return c.jsxs("pre",{style:{fontSize:"0.875rem",display:"inline"},children:[c.jsx("code",{className:K(!n&&"bg-surface4 rounded border font-semibold",t),...r,style:{fontWeight:"400",paddingBlock:n?0:"0.1em",paddingInline:n?0:"0.3em"}})," "]})},CodeHeader:QKr,SyntaxHighlighter:qKr,img:GKr}),WKr=({reason:e,tripwire:t})=>{const[r,n]=E.useState(!1),s=t&&(t.retry!==void 0||t.tripwirePayload||t.processorId);return c.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-950/20 overflow-hidden",children:[c.jsxs("div",{className:"flex items-start gap-3 p-4",children:[c.jsx(sI,{className:"w-5 h-5 text-amber-400 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-sm font-medium text-amber-200 mb-1",children:"Content Blocked"}),c.jsx("p",{className:"text-sm text-amber-300/90",children:e})]})]}),s&&c.jsxs(c.Fragment,{children:[c.jsxs("button",{onClick:()=>n(!r),className:"w-full flex items-center gap-2 px-4 py-2 text-xs text-amber-400/70 hover:text-amber-400 hover:bg-amber-900/20 transition-colors border-t border-amber-500/20",children:[r?c.jsx($a,{className:"w-3.5 h-3.5"}):c.jsx(Hi,{className:"w-3.5 h-3.5"}),c.jsx("span",{children:"Details"})]}),r&&c.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t border-amber-500/20 bg-amber-950/10",children:[t.retry!==void 0&&c.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[c.jsx(rI,{className:"w-3.5 h-3.5 text-amber-400/60"}),c.jsxs("span",{className:"text-xs text-amber-300/70",children:["Retry:"," ",t.retry?c.jsx("span",{className:"text-green-400",children:"Allowed"}):c.jsx("span",{className:"text-red-400",children:"Not allowed"})]})]}),t.processorId&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(mie,{className:"w-3.5 h-3.5 text-amber-400/60"}),c.jsxs("span",{className:"text-xs text-amber-300/70",children:["Processor:"," ",c.jsx("code",{className:"px-1.5 py-0.5 rounded bg-amber-900/30 text-amber-200 font-mono",children:t.processorId})]})]}),t.tripwirePayload!==void 0&&t.tripwirePayload!==null&&c.jsxs("div",{className:"pt-1",children:[c.jsx("p",{className:"text-xs text-amber-400/60 mb-1.5",children:"Metadata:"}),c.jsx("pre",{className:"text-xs text-amber-200/80 bg-amber-900/30 rounded p-2 overflow-x-auto font-mono",children:String(JSON.stringify(t.tripwirePayload,null,2))})]})]})]})]})},Mi=e=>c.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"})]}),hpt=e=>c.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"}),c.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"}),c.jsxs("g",{clipPath:"url(#clip0_21421_19519)",children:[c.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"}),c.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"})]}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_21421_19519",children:c.jsx("rect",{width:"62.7591",height:"62.7591",fill:"white",transform:"matrix(0.897148 0.441731 -0.897148 0.441731 63.1714 7.24365)"})})})]}),XKr=e=>c.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"})]}),$pe=e=>c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"})]}),Mpe=e=>c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"})]}),ai=e=>c.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),Lpe=e=>c.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:c.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"})}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_21999_22095",children:c.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),mpt=e=>c.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[c.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:"white"}),c.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:"white"}),c.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:"white"}),c.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:"white"})]}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_21999_20513",children:c.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),YKr=e=>c.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"}),c.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),c.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),c.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),gpt=e=>c.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),KKr=e=>c.jsx("svg",{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.jsx("path",{d:"M10.1266 5.67745C10.3409 5.0225 10.2695 4.2961 9.92413 3.70069C9.40017 2.78376 8.34034 2.31934 7.30433 2.53369C6.85182 2.02164 6.18496 1.73584 5.49428 1.73584C4.43445 1.73584 3.50561 2.41461 3.17218 3.4149C2.49342 3.55779 1.90992 3.97458 1.56458 4.5819C1.04062 5.49883 1.1597 6.64202 1.86228 7.42796C1.64793 8.09482 1.73129 8.80931 2.07663 9.40472C2.60059 10.3217 3.66042 10.798 4.69643 10.5717C5.16085 11.0838 5.8158 11.3815 6.50648 11.3815C7.56631 11.3815 8.49515 10.7027 8.82858 9.70243C9.50735 9.55953 10.0908 9.14274 10.4362 8.53542C10.9601 7.61849 10.8411 6.46339 10.1266 5.67745ZM6.50648 10.7503C6.07778 10.7503 5.67291 10.6074 5.35138 10.3336C5.36329 10.3217 5.39902 10.3097 5.41093 10.2978L7.32815 9.19037C7.42341 9.13083 7.48295 9.03557 7.48295 8.91648V6.21332L8.29271 6.67774C8.30462 6.67774 8.30462 6.68965 8.30462 6.70156V8.9403C8.31653 9.94059 7.50677 10.7503 6.50648 10.7503ZM2.62441 9.09511C2.41006 8.72595 2.33861 8.29726 2.41006 7.88047C2.42197 7.89238 2.44578 7.90429 2.4696 7.91619L4.38682 9.02366C4.48209 9.0832 4.60117 9.0832 4.69643 9.02366L7.04235 7.66612V8.60687C7.04235 8.61878 7.04235 8.63069 7.03044 8.63069L5.0894 9.75006C4.23201 10.2502 3.12455 9.9525 2.62441 9.09511ZM2.12426 4.90342C2.33861 4.53427 2.67204 4.26038 3.06501 4.10557V6.39195C3.06501 6.49912 3.12455 6.60629 3.21982 6.66583L5.56573 8.02337L4.75597 8.48779C4.74407 8.48779 4.73216 8.4997 4.73216 8.48779L2.79112 7.36842C1.90992 6.86827 1.62412 5.76081 2.12426 4.90342ZM8.79285 6.45149L6.44694 5.09395L7.2567 4.62953C7.2686 4.62953 7.28051 4.61762 7.28051 4.62953L9.22155 5.7489C10.0908 6.24905 10.3766 7.35651 9.8765 8.2139C9.66215 8.58305 9.32872 8.85694 8.93575 8.99984V6.72538C8.94766 6.6182 8.88812 6.51103 8.79285 6.45149ZM9.5907 5.23685C9.5788 5.22494 9.55498 5.21303 9.53116 5.20113L7.61394 4.09366C7.51868 4.03412 7.39959 4.03412 7.30433 4.09366L4.95841 5.4512V4.51045C4.95841 4.49854 4.95841 4.48663 4.97032 4.48663L6.91136 3.36726C7.78066 2.86712 8.87621 3.16482 9.37636 4.03412C9.5907 4.39137 9.66215 4.82006 9.5907 5.23685ZM4.51781 6.904L3.70805 6.43958C3.69615 6.43958 3.69615 6.42767 3.69615 6.41576V4.17702C3.69615 3.17673 4.5059 2.36697 5.50619 2.36697C5.93489 2.36697 6.33977 2.50987 6.66129 2.78376C6.64938 2.79567 6.62556 2.80758 6.60175 2.81949L4.68453 3.92695C4.58926 3.98649 4.52972 4.08176 4.52972 4.20084V6.904H4.51781ZM4.95841 5.95134L6.00634 5.34402L7.05426 5.95134V7.15407L6.00634 7.76139L4.95841 7.15407V5.95134Z",fill:"currentColor"})}),Fpe=e=>c.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),JKr=e=>c.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),tl=e=>c.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),_O=e=>c.jsx(ljt,{...e}),Yl=e=>c.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),eJr=e=>c.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"}),c.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"}),c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M74.9374 21.357C76.2127 20.7291 78.2804 20.7291 79.5557 21.357L90.8129 26.8997C92.0882 27.5276 92.0882 28.5458 90.8129 29.1737L83.1638 32.9399C81.8885 33.5678 79.8207 33.5678 78.5454 32.9399L75.8033 31.5898L68.3324 35.2682L64.1502 39.696C63.8908 39.481 63.6138 39.2568 63.3231 39.0227L63.1495 38.883C62.2893 38.1914 61.2677 37.3701 60.6254 36.6376C60.5446 36.5456 60.4618 36.4463 60.3812 36.3407C60.1669 36.3011 59.9652 36.2603 59.7782 36.2205C58.2906 35.9043 56.6225 35.4013 55.2179 34.9777L54.9342 34.8922C54.4589 34.7491 54.0034 34.6127 53.5666 34.4849L62.5594 32.4258L70.0304 28.7473L67.2882 27.3972C66.0129 26.7692 66.0129 25.7512 67.2882 25.1232L74.9374 21.357ZM53.5666 34.4849C53.5666 34.4849 53.5666 34.4849 53.5666 34.4849L46.1603 36.1808L47.516 36.8483C48.7913 37.4762 48.7912 38.4943 47.516 39.1222L39.8668 42.8884C38.5916 43.5163 36.5238 43.5164 35.2485 42.8884L23.9913 37.3457C22.7159 36.7177 22.716 35.6996 23.9913 35.0717L31.6404 31.3055C32.9156 30.6776 34.9834 30.6776 36.2587 31.3055L38.5358 32.4267C39.6899 31.9483 40.9309 31.4611 42.153 31.0313C43.6354 30.5099 45.4001 29.9605 47.091 29.683C49.7278 29.2502 52.3729 29.7072 53.9892 30.0537C55.8019 30.4425 57.6745 31.0055 59.1934 31.4628C60.6081 31.8887 61.6949 32.2154 62.5594 32.4258L53.5666 34.4849ZM46.1603 36.1808L53.5666 34.4849C52.5189 34.1784 51.5786 33.9213 50.7293 33.7392C49.9958 33.5819 49.6114 33.5441 49.4794 33.5326C48.964 33.6384 48.0924 33.8823 46.8983 34.3023C46.0703 34.5936 45.1981 34.9293 44.3325 35.2808L46.1603 36.1808ZM64.1502 39.696L68.3324 35.2682C68.7598 35.6939 69.4232 36.229 70.2883 36.9256C71.2171 37.6735 72.3605 38.5954 73.15 39.488C73.8539 40.2838 74.7818 41.5862 73.9029 42.8844C73.3394 43.717 72.2235 44.5859 71.1648 45.3159C70.2916 45.9175 69.3021 46.5286 68.3305 47.0968L70.6077 48.218C71.8829 48.8459 71.8829 49.864 70.6077 50.4919L62.9585 54.2582C61.6833 54.8861 59.6154 54.8861 58.3402 54.2582L47.083 48.7154C45.8077 48.0875 45.8077 47.0694 47.083 46.4415L54.7321 42.6752C56.0074 42.0474 58.0751 42.0473 59.3505 42.6752L60.7062 43.3428L64.1502 39.696ZM64.1502 39.696L60.7062 43.3428L62.5339 44.2427C63.2478 43.8165 63.9298 43.3871 64.5213 42.9794C65.3742 42.3914 65.8695 41.9622 66.0846 41.7085C66.0613 41.6436 65.9844 41.4543 65.6649 41.0931C65.295 40.6749 64.773 40.212 64.1502 39.696Z",fill:"#A9A9A9"})]}),Gf=e=>c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"})]}),tJr=e=>c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),rJr=e=>c.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.jsx("path",{d:"M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641V49.8368C6.67773 65.0327 31.894 77.3514 62.9998 77.3514C94.1055 77.3514 119.322 65.0327 119.322 49.8368V35.1641Z",fill:"#2E2E2E",fillOpacity:"0.9"}),c.jsx("path",{d:"M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641M119.322 35.1641C119.322 19.9681 94.1055 7.64941 62.9998 7.64941C31.894 7.64941 6.67773 19.9681 6.67773 35.1641M119.322 35.1641V49.8368C119.322 65.0327 94.1055 77.3514 62.9998 77.3514C31.894 77.3514 6.67773 65.0327 6.67773 49.8368V35.1641",stroke:"#424242"}),c.jsx("path",{d:"M63.0002 0.96875C28.5152 0.96875 0.55957 15.6489 0.55957 33.7578V51.2433C0.55957 69.3522 28.5152 84.0323 63.0002 84.0323C97.4853 84.0323 125.441 69.3522 125.441 51.2433V33.7578C125.441 15.6489 97.4853 0.96875 63.0002 0.96875Z",stroke:"#707070"}),c.jsx("path",{d:"M51.5215 39.9726C50.5464 40.4477 48.9738 40.4435 48.009 39.9634C47.0442 39.4833 47.0526 38.709 48.0277 38.2339L69.7191 27.6672C72.7243 26.2032 72.7347 23.8181 69.7605 22.3476L69.6898 22.313C66.6927 20.8686 61.8895 20.8864 58.9368 22.3528L30.3946 36.5278C29.4288 37.0074 27.8561 37.0107 26.882 36.5352C25.9078 36.0597 25.901 35.2853 26.8668 34.8057L55.4092 20.6308C60.2847 18.2094 68.2157 18.1801 73.1645 20.5651L73.2814 20.6222C76.1808 22.0558 77.3624 24.0157 76.8227 25.8782C80.6339 25.5828 84.6694 26.1476 87.6364 27.5775C92.6525 29.9949 92.7059 33.962 87.7554 36.4119L61.5441 49.3836C61.282 49.5133 61.281 49.7227 61.5417 49.853L67.0252 52.5932C67.988 53.0743 67.9763 53.8486 66.9992 54.3226C66.0221 54.7966 64.4495 54.7909 63.4867 54.3098L58.0033 51.5695C55.8306 50.4838 55.8392 48.7391 58.0226 47.6585L84.2339 34.6868C87.2382 33.2 87.2058 30.7925 84.1617 29.3254C81.1488 27.8734 76.1811 27.9317 73.2127 29.4058L51.5215 39.9726Z",fill:"#A9A9A9"}),c.jsx("path",{d:"M63.0028 23.8809C64.0019 23.4098 65.5873 23.4146 66.5747 23.8972C67.562 24.3798 67.5831 25.1603 66.6338 25.6556L66.5879 25.679L45.1511 36.3113C42.2204 37.7649 42.2292 40.1117 45.1707 41.56C48.1228 43.0135 52.91 43.0118 55.8578 41.5563L76.8564 31.1875L76.9037 31.1648C77.9049 30.6949 79.4903 30.7013 80.4755 31.185C81.4763 31.6764 81.4785 32.4741 80.4806 32.9669L59.4821 43.3356C54.5363 45.7777 46.5044 45.7806 41.5516 43.342C36.6166 40.9121 36.602 36.9747 41.519 34.5359L62.9558 23.9037L63.0028 23.8809Z",fill:"#A9A9A9"})]}),nJr=e=>c.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.jsx("path",{d:"M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641V49.8368C6.67773 65.0327 31.894 77.3514 62.9998 77.3514C94.1055 77.3514 119.322 65.0327 119.322 49.8368V35.1641Z",fill:"#2E2E2E",fillOpacity:"0.9"}),c.jsx("path",{d:"M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641M119.322 35.1641C119.322 19.9681 94.1055 7.64941 62.9998 7.64941C31.894 7.64941 6.67773 19.9681 6.67773 35.1641M119.322 35.1641V49.8368C119.322 65.0327 94.1055 77.3514 62.9998 77.3514C31.894 77.3514 6.67773 65.0327 6.67773 49.8368V35.1641",stroke:"#424242"}),c.jsx("path",{d:"M63.0002 0.96875C28.5152 0.96875 0.55957 15.6489 0.55957 33.7578V51.2433C0.55957 69.3522 28.5152 84.0323 63.0002 84.0323C97.4853 84.0323 125.441 69.3522 125.441 51.2433V33.7578C125.441 15.6489 97.4853 0.96875 63.0002 0.96875Z",stroke:"#707070"}),c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M95.8997 32.6647C98.4806 33.9355 98.4744 36.0012 95.8997 37.2689L89.6657 40.3384C87.0848 41.6091 82.8892 41.6061 80.3146 40.3384L74.0805 37.2689C71.4996 35.9981 71.5059 33.9324 74.0805 32.6647L80.3146 29.5952C82.8955 28.3244 87.091 28.3275 89.6657 29.5952L95.8997 32.6647ZM74.0805 21.9215C76.6614 23.1923 76.6552 25.258 74.0805 26.5257L67.8465 29.5952C65.2656 30.866 61.0701 30.8629 58.4954 29.5952L52.2613 26.5257C49.6804 25.255 49.6867 23.1892 52.2613 21.9215L58.4954 18.852C61.0763 17.5813 65.2718 17.5843 67.8465 18.852L74.0805 21.9215ZM74.0805 43.4079C76.6614 44.6786 76.6552 46.7444 74.0805 48.0121L67.8465 51.0816C65.2656 52.3523 61.0701 52.3493 58.4954 51.0816L52.2613 48.0121C49.6804 46.7413 49.6867 44.6756 52.2613 43.4079L58.4954 40.3384C61.0763 39.0676 65.2718 39.0707 67.8465 40.3384L74.0805 43.4079ZM52.2613 32.6647C54.8422 33.9355 54.836 36.0012 52.2613 37.2689L46.0273 40.3384C43.4464 41.6091 39.2509 41.6061 36.6762 40.3384L30.4422 37.2689C27.8613 35.9981 27.8675 33.9324 30.4422 32.6647L36.6762 29.5952C39.2571 28.3244 43.4526 28.3275 46.0273 29.5952L52.2613 32.6647Z",fill:"#A9A9A9"})]});function D0(e){return c.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:[c.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),c.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),c.jsx("path",{d:"M15 2v2"}),c.jsx("path",{d:"M15 20v2"}),c.jsx("path",{d:"M2 15h2"}),c.jsx("path",{d:"M2 9h2"}),c.jsx("path",{d:"M20 15h2"}),c.jsx("path",{d:"M20 9h2"}),c.jsx("path",{d:"M9 2v2"}),c.jsx("path",{d:"M9 20v2"})]})}const sJr={warning:"bg-accent6Darker border-accent6/30 text-accent6",destructive:"bg-accent2Darker border-accent2/30 text-accent2",info:"bg-accent5Darker border-accent5/30 text-accent5"},aJr={warning:Pc,destructive:Xh,info:Ac},Cp=({children:e,variant:t="destructive",className:r})=>{const n=aJr[t];return c.jsx("div",{className:K(sJr[t],"p-3 rounded-md border shadow-sm",Wr.all,"animate-in fade-in-0 slide-in-from-top-2 duration-200",r),children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(ve,{className:"mt-0.5 flex-shrink-0",children:c.jsx(n,{})}),c.jsx("div",{className:"text-neutral4",children:e})]})})},Tp=({children:e,as:t="h5"})=>c.jsx(ze,{as:t,variant:"ui-md",className:"font-semibold",children:e}),sy=({children:e,as:t="p"})=>c.jsx(ze,{as:t,variant:"ui-sm",children:e}),iJr={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"},oJr={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},Ft=({icon:e,variant:t="default",className:r,children:n,...s})=>c.jsxs("div",{className:K("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",Wr.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":iJr[t],r),...s,children:[e&&c.jsx("span",{className:oJr[t],children:c.jsx(ve,{children:e})}),n]}),lJr=()=>{const e=jn(({part:i})=>i),[t,r]=E.useState(!1),n=e.text||"",s=e.metadata||{};if(s?.status==="tripwire")return c.jsx(WKr,{reason:n,tripwire:s.tripwire});if(s?.status==="warning")return c.jsxs(Cp,{variant:"warning",children:[c.jsx(Tp,{as:"h5",children:"Warning"}),c.jsx(sy,{as:"p",children:n})]});if(s?.status==="error")return c.jsxs(Cp,{variant:"destructive",children:[c.jsx(Tp,{as:"h5",children:"Error"}),c.jsx(sy,{as:"p",children:n})]});const a=s?.completionResult;if(a)return c.jsxs("div",{className:"mb-2 space-y-2",children:[c.jsxs("button",{onClick:()=>r(i=>!i),className:"flex items-center gap-2",children:[c.jsx(ve,{children:c.jsx(D1,{className:K("transition-all",t?"rotate-90":"rotate-180")})}),c.jsxs(Ft,{variant:"info",icon:c.jsx(QBe,{}),children:[t?"Show":"Hide"," completion check"]})]}),!t&&c.jsxs(Cp,{variant:"info",children:[c.jsx(Tp,{as:"h5",children:a?.passed?"Complete":"Not Complete"}),c.jsx(jPe,{})]})]});try{const i=n.trim();if(i.startsWith("__ERROR__:")){const o=i.substring(10);return c.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[c.jsx(Xh,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),c.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:o})]})]})}else if(i.startsWith("Error:")){const o=i.substring(6).trim();return c.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[c.jsx(Xh,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),c.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:o})]})]})}return c.jsx(jPe,{})}catch{return c.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[c.jsx(Xh,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),c.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:String(n)})]})]})}},Wu="mastra_workspace",Ch={FILESYSTEM:{READ_FILE:`${Wu}_read_file`,WRITE_FILE:`${Wu}_write_file`,EDIT_FILE:`${Wu}_edit_file`,LIST_FILES:`${Wu}_list_files`,DELETE:`${Wu}_delete`,FILE_STAT:`${Wu}_file_stat`,MKDIR:`${Wu}_mkdir`},SANDBOX:{EXECUTE_COMMAND:`${Wu}_execute_command`,GET_PROCESS_OUTPUT:`${Wu}_get_process_output`,KILL_PROCESS:`${Wu}_kill_process`},SEARCH:{SEARCH:`${Wu}_search`,INDEX:`${Wu}_index`}},cJr={duration:5e3,cancel:{label:c.jsx(ve,{children:c.jsx(Os,{})}),onClick:()=>{}},unstyled:!0,classNames:{toast:"bg-surface3 w-full h-auto rounded-lg gap-2 border border-border1 px-3 py-2 flex items-center justify-between pointer-events-auto shadow-card [&>[data-content]]:flex-1",title:"text-xs font-medium text-neutral5",description:"text-xs text-neutral3",cancelButton:"!bg-transparent hover:!bg-surface2 !border-none !rounded-md !p-1.5 !m-0 !text-neutral3 hover:!text-neutral6 shrink-0 transition-all",actionButton:"!bg-white flex items-center justify-center font-medium !text-black order-last hover:opacity-80"}};function bd(e){const{classNames:t,...r}=cJr,{classNames:n,...s}=e||{};return{...r,classNames:{...t,title:K(t?.title,n?.title),toast:K(t?.toast,n?.toast),cancelButton:K(t?.cancelButton,n?.cancelButton),actionButton:K(t?.actionButton,n?.actionButton),description:K(t?.description,n?.description)},...s}}const Xe=(e,t={})=>{if(Array.isArray(e))return e.forEach(r=>Vl(r,bd(t)));if(Ee.isValidElement(e))return Vl(e,bd(t));if(typeof e=="string")return Vl(e,bd(t));throw new Error("Invalid message type")};Xe.success=(e,t={})=>{const r={...t,icon:c.jsx(ve,{className:"text-accent1 shrink-0",children:c.jsx(GBe,{})}),classNames:{...t.classNames,toast:K("bg-accent1Darker border-accent1/30 border-l-[3px] border-l-accent1",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Vl.success(e,bd(r));case"object":return e.forEach(n=>Vl.success(n,bd(r)))}};Xe.error=(e,t={})=>{const r={...t,icon:c.jsx(ve,{className:"text-accent2 shrink-0",children:c.jsx(uA,{})}),classNames:{...t.classNames,toast:K("bg-accent2Darker border-accent2/30 border-l-[3px] border-l-accent2",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Vl.error(e,bd(r));case"object":return e.forEach(n=>Vl.error(n,bd(r)))}};Xe.warning=(e,t={})=>{const r={...t,icon:c.jsx(ve,{className:"text-accent6 shrink-0",children:c.jsx(Xh,{})}),classNames:{...t.classNames,toast:K("bg-accent6Darker border-accent6/30 border-l-[3px] border-l-accent6",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Vl.warning(e,bd(r));case"object":return e.forEach(n=>Vl.warning(n,bd(r)))}};Xe.info=(e,t={})=>{const r={...t,icon:c.jsx(ve,{className:"text-accent3 shrink-0",children:c.jsx(Ac,{})}),classNames:{...t.classNames,toast:K("bg-accent3Darker border-accent3/30 border-l-[3px] border-l-accent3",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Vl.info(e,bd(r));case"object":return e.forEach(n=>Vl.info(n,bd(r)))}};Xe.custom=(e,t={})=>Vl(e,bd(t));Xe.dismiss=e=>{e&&Vl.dismiss(e)};Xe.promise=({myPromise:e,loadingMessage:t,successMessage:r,errorMessage:n,onSuccess:s,onError:a,options:i={}})=>Vl.promise(e,{loading:t??"Loading...",success:o=>(s?.(o),r),error:o=>(a?.(o),n||o?.message||"Error..."),...bd(i)});function Zf({text:e,copyMessage:t="Copied to clipboard!"}){const[r,n]=E.useState(!1),s=E.useRef(null),a=E.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{Xe.success(t),n(!0),s.current&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{n(!1)},2e3)}).catch(()=>{Xe.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:r,handleCopy:a}}const ypt={sm:`${oi.sm} gap-1 text-ui-sm`,md:`${oi.md} gap-1`,lg:`${oi.lg} gap-2`,default:`${oi.default} text-ui-md`,large:`${oi.lg} text-ui-lg`},bpt={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",cta:"bg-white/20 border-2 border-transparent hover:text-white hover:bg-white/25 disabled:opacity-50 disabled:cursor-not-allowed active:bg-white/30 text-neutral5",standard:"bg-white/10 border-2 border-transparent hover:text-white hover:bg-white/15 disabled:opacity-50 disabled:cursor-not-allowed active:bg-white/20 text-neutral4"},vpt="border border-border1 px-2 text-ui-md inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",uJr=K("flex items-center justify-center rounded-lg gap-[.75em] px-[1em] leading-0 transition-colors duration-200 ease-out-custom","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-50 [&>svg]:mx-[-.25em]","[&:hover>svg]:opacity-100"),dJr="focus-visible:outline-none focus-visible:border-accent1/50";function U6(e){const t=e?.variant||"default",r=e?.size||"md";return K(vpt,sh,bpt[t],ypt[r])}const ye=Ee.forwardRef(({className:e,as:t,size:r="md",variant:n="default",disabled:s,...a},i)=>{const o=t||"button",l=["cta","standard"].includes(n);return c.jsx(o,{ref:i,disabled:s,className:K(l?uJr:vpt,l?dJr:sh,bpt[n],ypt[r],s&&"active:scale-100",e),...a})});ye.displayName="Button";const nN=Ee.forwardRef(({tooltipContent:e,...t},r)=>c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx(ye,{ref:r,...t})}),e&&c.jsx(sn,{children:e})]}));nN.displayName="ButtonWithTooltip";function ql({content:e,copyMessage:t,tooltip:r="Copy to clipboard",iconSize:n="default",className:s,size:a="sm"}){const[i,o]=E.useState(!1),{handleCopy:l}=Zf({text:e,copyMessage:t}),u=()=>{l(),o(!0),setTimeout(()=>o(!1),2e3)};return c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx(ye,{onClick:u,type:"button",size:a,variant:"standard",children:i?c.jsx(ya,{}):c.jsx(Ql,{})})}),c.jsx(sn,{children:i?"Copied!":r})]})}const pJr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,fJr=rr.mark({class:"cm-variable-highlight"}),RPe=new Iqe({regexp:pJr,decoration:()=>fJr}),hJr=xi.fromClass(class{decorations;constructor(e){this.decorations=RPe.createDeco(e)}update(e){this.decorations=RPe.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),mJr=hJr;function gJr(e,t=5){if(!e?.properties)return[];const r=[];function n(s,a,i){if(i>t)return;const o=Array.isArray(s.type)?s.type.join(" | "):s.type;if(r.push({path:a,label:a,description:s.description??s.title,type:o}),s.properties)for(const[l,u]of Object.entries(s.properties))n(u,`${a}.${l}`,i+1);if(s.items?.properties)for(const[l,u]of Object.entries(s.items.properties))n(u,`${a}[].${l}`,i+1)}for(const[s,a]of Object.entries(e.properties))n(a,s,1);return r}function yJr(e){const t=gJr(e);return gHe({override:[bJr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function bJr(e){return t=>{const n=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!n)return null;const s=n[1]??"",a=t.pos-s.length,i=s?e.filter(l=>l.path.toLowerCase().startsWith(s.toLowerCase())):e;if(i.length===0)return null;const o=i.map(l=>({label:l.path,displayLabel:l.path,detail:l.type,info:l.description,apply:(u,d,p,f)=>{const g=u.state.sliceDoc(f,f+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:p,to:f,insert:g},selection:{anchor:p+g.length}})}}));return{from:a,options:o,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const sx=()=>E.useMemo(()=>{const e=ZL({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#939393",background:"transparent"},styles:[{tag:[re.className,re.propertyName]},{tag:re.heading,color:"#ff79c6",fontWeight:"bold"},{tag:[re.heading1,re.heading2,re.heading3,re.heading4,re.heading5,re.heading6],color:"#ff79c6",fontWeight:"bold"},{tag:re.emphasis,fontStyle:"italic",color:"#f8f8f2"},{tag:re.strong,fontWeight:"bold",color:"#f8f8f2"},{tag:re.link,color:"#8be9fd",textDecoration:"underline"},{tag:re.url,color:"#8be9fd"},{tag:re.monospace,color:"#f1fa8c"},{tag:re.strikethrough,textDecoration:"line-through"},{tag:re.quote,fontStyle:"italic",color:"#6272a4"}]}),t=ht.theme({".cm-editor":{colorScheme:"dark",backgroundColor:"transparent"},".cm-lineNumbers .cm-gutterElement":{color:"#939393"},".cm-tooltip-autocomplete":{backgroundColor:"#282a36",border:"1px solid #44475a",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.4)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"#f8f8f2"},".cm-completionDetail":{color:"#A1A1AA",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"#282a36",border:"1px solid #44475a",color:"#6272a4",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"#44475a",color:"#f8f8f2"},".cm-line .cm-variable-highlight":{color:"#F59E0B !important",fontWeight:"500"}});return[e,t]},[]),Wa=E.forwardRef(({data:e,value:t,onChange:r,showCopyButton:n=!0,className:s,language:a="json",highlightVariables:i=!1,placeholder:o,wordWrap:l=!1,schema:u,autoFocus:d,...p},f)=>{const h=sx(),m=e?JSON.stringify(e,null,2):t??"",g=E.useMemo(()=>{const b=[];return a==="json"?b.push(hd):a==="markdown"&&(b.push(Koe({base:X0,codeLanguages:LQe})),b.push(ht.lineWrapping)),i&&a==="markdown"&&b.push(mJr),u&&a==="markdown"&&b.push(yJr(u)),b},[a,i,u]);return c.jsxs("div",{className:K("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",s),...p,children:[n&&c.jsx(ql,{content:m,className:"absolute top-2 right-2 z-20"}),c.jsx(Sd,{ref:f,value:m,theme:h,extensions:g,onChange:r,"aria-label":"Code editor",placeholder:o,height:"100%",style:{height:"100%"},autoFocus:d})]})});async function vJr(e,t){const{codeToTokens:r,bundledLanguages:n}=await Ge(async()=>{const{codeToTokens:a,bundledLanguages:i}=await import("./index-DL9UU43r.js");return{codeToTokens:a,bundledLanguages:i}},__vite__mapDeps([26,1]),import.meta.url);if(!(t in n))return null;const{tokens:s}=await r(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return s}const V6=({children:e,initialCollapsed:t=!0,icon:r,title:n,collapsible:s=!0,extraInfo:a,"data-testid":i})=>{const[o,l]=E.useState(t);return E.useEffect(()=>{l(t)},[t]),c.jsxs("div",{className:"mb-4","data-testid":i,children:[c.jsxs("div",{className:"flex flex-row gap-2 items-center justify-between",children:[c.jsxs("button",{onClick:s?()=>l(u=>!u):void 0,className:"flex items-center gap-2 disabled:cursor-not-allowed",disabled:!s,type:"button",children:[c.jsx(ve,{children:c.jsx(D1,{className:K("transition-all",o?"rotate-90":"rotate-180")})}),c.jsx(Ft,{icon:r,children:n})]}),a]}),!o&&c.jsx("div",{className:"pt-2",children:c.jsx("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:e})})]})},ea=eF,xpt=ZGe,xJr=tF,Spt=E.forwardRef(({className:e,...t},r)=>c.jsx(bI,{ref:r,className:K("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}));Spt.displayName=bI.displayName;const Ls=E.forwardRef(({className:e,children:t,...r},n)=>c.jsxs(xJr,{children:[c.jsx(Spt,{}),c.jsxs(vI,{ref:n,className:K("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...r,children:[t,c.jsxs(sF,{className:K("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-none focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","disabled:pointer-events-none"),children:[c.jsx(Os,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ls.displayName=vI.displayName;const ta=({className:e,...t})=>c.jsx("div",{className:K("flex flex-col space-y-1.5 text-center sm:text-left border-b border-border1 pb-4 px-6",e),...t});ta.displayName="DialogHeader";const q6=({className:e,...t})=>c.jsx("div",{className:K("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});q6.displayName="DialogFooter";const ra=({className:e,...t})=>c.jsx("div",{className:K("overflow-y-auto px-6 max-h-[50vh]",e),...t});ra.displayName="DialogBody";const Fs=E.forwardRef(({className:e,...t},r)=>c.jsx(rF,{ref:r,className:K("text-ui-md font-medium",e),...t}));Fs.displayName=rF.displayName;const ni=E.forwardRef(({className:e,...t},r)=>c.jsx(nF,{ref:r,className:K("sr-only",e),...t}));ni.displayName=nF.displayName;const SJr=({selectionReason:e,open:t,onOpenChange:r,input:n})=>{let s=null;if(n)try{s=typeof n=="object"?c.jsx(Wa,{data:n}):c.jsx(Wa,{data:JSON.parse(n)})}catch{s=c.jsx("pre",{className:"whitespace-pre-wrap",children:n})}return c.jsx(ea,{open:t,onOpenChange:r,children:c.jsxs(Ls,{children:[c.jsxs(ta,{children:[c.jsx(Fs,{children:"Agent Network Metadata"}),c.jsx(ni,{children:"View the metadata of the agent's network choice."})]}),c.jsxs(ra,{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(ze,{className:"text-neutral3",children:"Selection Reason"}),c.jsx("div",{className:"text-neutral6 text-ui-md",children:e})]}),s&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(ze,{className:"text-neutral3",children:"Input"}),c.jsx("div",{className:"text-neutral6 text-ui-md",children:s})]})]})]})})},Bpe=({selectionReason:e,input:t})=>{const[r,n]=E.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsx(oa,{variant:"light",size:"md",tooltip:"Show selection reason",onClick:()=>n(s=>!s),children:c.jsx(LIt,{className:"text-neutral3 size-5"})}),c.jsx(SJr,{selectionReason:e||"",open:r,onOpenChange:n,input:t})]})},wpt=E.createContext(void 0);function wJr({children:e,approveToolcall:t,declineToolcall:r,approveToolcallGenerate:n,declineToolcallGenerate:s,approveNetworkToolcall:a,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:l,networkToolCallApprovals:u}){return c.jsx(wpt.Provider,{value:{approveToolcall:t,declineToolcall:r,approveToolcallGenerate:n,declineToolcallGenerate:s,approveNetworkToolcall:a,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:l,networkToolCallApprovals:u},children:e})}function EJr(){const e=E.useContext(wpt);if(!e)throw new Error("useToolCall must be used within a ToolCallProvider");return e}const oj=({toolCalled:e,toolCallId:t,toolApprovalMetadata:r,toolName:n,isNetwork:s,isGenerateMode:a})=>{const{approveToolcall:i,declineToolcall:o,approveToolcallGenerate:l,declineToolcallGenerate:u,isRunning:d,toolCallApprovals:p,approveNetworkToolcall:f,declineNetworkToolcall:h,networkToolCallApprovals:m}=EJr(),g=()=>{s?f(n,r?.runId):a?l(t):i(t)},b=()=>{s?h(n,r?.runId):a?u(t):o(t)},v=s?m?.[r?.runId?`${r.runId}-${n}`:n]?.status:p?.[t]?.status;return r&&!e?c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Approval required"}),c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsxs(ye,{onClick:g,disabled:d||!!v,className:v==="approved"?"!text-accent1":"",children:[c.jsx(ve,{children:c.jsx(ya,{})}),"Approve"]}),c.jsxs(ye,{onClick:b,disabled:d||!!v,className:v==="declined"?"!text-accent2":"",children:[c.jsx(ve,{children:c.jsx(Os,{})}),"Decline"]})]})]}):null},kJr=({toolName:e,args:t,result:r,metadata:n,toolOutput:s,toolCallId:a,toolApprovalMetadata:i,suspendPayload:o,isNetwork:l,toolCalled:u})=>{let d=null;try{const{__mastraMetadata:b,...v}=typeof t=="object"?t:JSON.parse(t);d=c.jsx(Wa,{data:v,"data-testid":"tool-args"})}catch{d=c.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:t})}let p=typeof r=="string"?c.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:r}):c.jsx(Wa,{data:r,"data-testid":"tool-result"}),f=typeof o=="string"?c.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:o}):c.jsx(Wa,{data:o,"data-testid":"tool-suspend-payload"});const h=n?.mode==="network"?n.selectionReason:void 0,m=n?.mode==="network"?n.agentInput:void 0,g=u??(r||s.length>0);return c.jsx(V6,{"data-testid":"tool-badge",icon:c.jsx(tl,{className:"text-accent6"}),title:e,extraInfo:n?.mode==="network"&&c.jsx(Bpe,{selectionReason:h||"",input:m}),initialCollapsed:!(i??o),children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Tool arguments"}),d]}),f!==void 0&&o&&c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Tool suspend payload"}),f]}),p!==void 0&&r&&c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Tool result"}),p]}),s.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Tool output"}),c.jsx("div",{className:"h-40 overflow-y-auto",children:c.jsx(Wa,{data:s,"data-testid":"tool-output"})})]}),c.jsx(oj,{toolCalled:g,toolCallId:a,toolApprovalMetadata:i,toolName:e,isNetwork:l,isGenerateMode:n?.mode==="generate"})]})})},Ept=E.createContext({Link:E.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:()=>""}}),OJr=({children:e,Link:t,navigate:r,paths:n})=>c.jsx(Ept.Provider,{value:{Link:t,navigate:r,paths:n},children:e}),Yt=()=>{const e=E.useContext(Ept);if(!e)throw new Error("useLinkComponent must be used within a LinkComponentProvider");return e},_Jr=e=>{switch(e){case"running":return"bg-green-500";case"starting":case"initializing":return"bg-yellow-500";case"stopped":case"paused":return"bg-gray-500";case"error":case"failed":return"bg-red-500";default:return"bg-accent6"}},CJr=(e,t)=>{const[r,n]=E.useState(0),s=E.useRef(null);return E.useEffect(()=>{if(e){n(0),s.current=t||Date.now();const a=setInterval(()=>{s.current&&n(Date.now()-s.current)},100);return()=>clearInterval(a)}else s.current=null},[e,t]),r},TJr=({command:e,content:t,maxHeight:r="20rem",onCopy:n,isCopied:s})=>{const a=E.useRef(null);return E.useEffect(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[t]),c.jsxs("div",{className:"rounded-md border border-border1 overflow-hidden",children:[e&&c.jsxs("div",{className:"px-3 py-2 bg-surface3 border-b border-border1 flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("span",{className:"text-neutral6 text-xs shrink-0",children:"$"}),c.jsx("code",{className:"text-xs text-neutral-300 font-mono truncate",children:e})]}),n&&c.jsx(oa,{variant:"light",size:"sm",tooltip:"Copy output",onClick:n,className:"shrink-0",children:c.jsxs("span",{className:"grid",children:[c.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",s?"scale-100":"scale-0"),children:c.jsx(ya,{size:14})}),c.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",s?"scale-0":"scale-100"),children:c.jsx(Ql,{size:14})})]})})]}),c.jsx("pre",{ref:a,style:{maxHeight:r},className:"overflow-x-auto overflow-y-auto p-3 text-sm text-neutral-300 font-mono whitespace-pre-wrap bg-black",children:t||c.jsx("span",{className:"text-neutral6 italic",children:"No output"})})]})},AJr=({toolName:e,args:t,result:r,metadata:n,toolCallId:s,toolApprovalMetadata:a,isNetwork:i,toolCalled:o})=>{const l=jn(G=>G.message),u=E.useMemo(()=>l.content.filter(M=>M.type==="data"),[l.content]),[d,p]=E.useState(!1),{isCopied:f,copyToClipboard:h}=z6(),{Link:m}=Yt(),g=u.find(G=>G.name==="sandbox-command"&&G.data?.toolCallId===s);let b="";try{const G=typeof t=="object"?t:JSON.parse(t);e===Ch.SANDBOX.EXECUTE_COMMAND?b=G.command||"":(e===Ch.SANDBOX.GET_PROCESS_OUTPUT||e===Ch.SANDBOX.KILL_PROCESS)&&(b=g?.data?.command||`PID ${G.pid}`)}catch{b=e}const v=u.filter(G=>(G.name==="sandbox-stdout"||G.name==="sandbox-stderr")&&G.data?.toolCallId===s),S=u.find(G=>G.name==="workspace-metadata"&&G.data?.toolCallId===s),w=S?.data,k=u.find(G=>G.name==="sandbox-exit"&&G.data?.toolCallId===s),_=!!k||typeof r=="string",C=!!S,T=C&&!_,A=o??(_||C),N=k?.data?.exitCode,I=k?.data?.success,R=k?.data?.executionTimeMs,$=k?.data?.killed,F=v.map(G=>G.data?.output||"").join(""),L=typeof r=="string"?r:F,z=e===Ch.SANDBOX.EXECUTE_COMMAND?"Execute Command":e===Ch.SANDBOX.GET_PROCESS_OUTPUT?"Get Process Output":e===Ch.SANDBOX.KILL_PROCESS?"Kill Process":e,q=v[0]?.data?.timestamp,H=CJr(T,q),V=()=>{!L||f||h(L)};return c.jsxs("div",{className:"mb-4","data-testid":"sandbox-execution-badge",children:[c.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[c.jsxs("button",{onClick:()=>p(G=>!G),className:"flex items-center gap-2 min-w-0",type:"button",children:[c.jsx(ve,{children:c.jsx(D1,{className:K("transition-all",d?"rotate-90":"rotate-180")})}),c.jsx(Ft,{icon:c.jsx(HIt,{className:"text-accent6",size:16}),children:z}),w?.sandbox&&c.jsxs(m,{href:w.id?`/workspaces/${w.id}`:"/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",onClick:G=>G.stopPropagation(),children:[c.jsx("span",{className:K("w-1.5 h-1.5 rounded-full",_Jr(w.sandbox.status))}),c.jsx("span",{children:w.sandbox.name||w.sandbox.provider})]})]}),c.jsx("div",{className:"flex items-center gap-2",children:T?c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-accent6",children:[c.jsx("span",{className:"w-1.5 h-1.5 bg-accent6 rounded-full animate-pulse"}),c.jsx("span",{className:"animate-pulse",children:"running"})]}),c.jsxs("span",{className:"text-neutral6 text-xs tabular-nums",children:[H,"ms"]})]}):c.jsxs(c.Fragment,{children:[N!==void 0&&(I?c.jsx(ya,{className:"text-green-400",size:14}):$?c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-orange-500/20 text-orange-400",children:"killed"}):c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-red-500/20 text-red-400",children:["exit ",N]})),R!==void 0&&c.jsxs("span",{className:"text-neutral6 text-xs",children:[R,"ms"]})]})})]}),!d&&c.jsxs("div",{className:"pt-2",children:[(L||b)&&c.jsx(TJr,{command:b,content:L,onCopy:L?V:void 0,isCopied:f}),c.jsx(oj,{toolCalled:A,toolCallId:s,toolApprovalMetadata:a,toolName:e,isNetwork:i,isGenerateMode:n?.mode==="generate"})]})]})},DJr=({toolName:e,args:t,result:r,toolCallId:n,toolApprovalMetadata:s,isNetwork:a,toolCalled:i})=>{const[o,l]=E.useState(!s),{isCopied:u,copyToClipboard:d}=z6();E.useEffect(()=>{l(!s)},[s]);const{Link:p}=Yt();let f={path:"/"};try{f=typeof t=="object"?t:JSON.parse(t)}catch{}const{path:h="/",maxDepth:m,showHidden:g,dirsOnly:b,exclude:v,extension:S}=f,w=[];m!==void 0&&m!==3&&w.push(`depth: ${m}`),g&&w.push("hidden"),b&&w.push("dirs only"),v&&w.push(`exclude: ${v}`),S&&w.push(`ext: ${S}`);let k="",_="";if(typeof r=="string"&&r){const $=r.lastIndexOf(`
567
+ `,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!a&&!!n.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=v,u.ParserHandle=g,u.NetworkStreamer=p,u.FileStreamer=f,u.StringStreamer=h,u.ReadableStreamStreamer=m,n.jQuery&&((s=n.jQuery).fn.parse=function(A){var N=A.config||{},I=[];return this.each(function(F){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var L=0;L<this.files.length;L++)I.push({file:this.files[L],inputElem:this,instanceConfig:s.extend({},N)})}),R(),this;function R(){if(I.length===0)T(A.complete)&&A.complete();else{var F,L,z,q,H=I[0];if(T(A.before)){var V=A.before(H.file,H.inputElem);if(typeof V=="object"){if(V.action==="abort")return F="AbortError",L=H.file,z=H.inputElem,q=V.reason,void(T(A.error)&&A.error({name:F},L,z,q));if(V.action==="skip")return void $();typeof V.config=="object"&&(H.instanceConfig=s.extend(H.instanceConfig,V.config))}else if(V==="skip")return void $()}var G=H.instanceConfig.complete;H.instanceConfig.complete=function(M){T(G)&&G(M,H.file,H.inputElem),$()},u.parse(H.file,H.instanceConfig)}}function $(){I.splice(0,1),R()}}),i&&(n.onmessage=function(A){A=A.data,u.WORKER_ID===void 0&&A&&(u.WORKER_ID=A.workerId),typeof A.input=="string"?n.postMessage({workerId:u.WORKER_ID,results:u.parse(A.input,A.config),finished:!0}):(n.File&&A.input instanceof File||A.input instanceof Object)&&(A=u.parse(A.input,A.config))&&n.postMessage({workerId:u.WORKER_ID,results:A,finished:!0})}),(p.prototype=Object.create(d.prototype)).constructor=p,(f.prototype=Object.create(d.prototype)).constructor=f,(h.prototype=Object.create(h.prototype)).constructor=h,(m.prototype=Object.create(d.prototype)).constructor=m,u})})(z$)),z$.exports}var ZXr=GXr();const Cdt=Dd(ZXr);var aPe=1,WXr=.9,XXr=.8,YXr=.17,vY=.1,xY=.999,KXr=.9999,JXr=.99,eYr=/[\\\/_+.#"@\[\(\{&]/,tYr=/[\\\/_+.#"@\[\(\{&]/g,rYr=/[\s-]/,Tdt=/[\s-]/g;function Ere(e,t,r,n,s,a,i){if(a===t.length)return s===e.length?aPe:JXr;var o=`${s},${a}`;if(i[o]!==void 0)return i[o];for(var l=n.charAt(a),u=r.indexOf(l,s),d=0,p,f,h,m;u>=0;)p=Ere(e,t,r,n,u+1,a+1,i),p>d&&(u===s?p*=aPe:eYr.test(e.charAt(u-1))?(p*=XXr,h=e.slice(s,u-1).match(tYr),h&&s>0&&(p*=Math.pow(xY,h.length))):rYr.test(e.charAt(u-1))?(p*=WXr,m=e.slice(s,u-1).match(Tdt),m&&s>0&&(p*=Math.pow(xY,m.length))):(p*=YXr,s>0&&(p*=Math.pow(xY,u-s))),e.charAt(u)!==t.charAt(a)&&(p*=KXr)),(p<vY&&r.charAt(u-1)===n.charAt(a+1)||n.charAt(a+1)===n.charAt(a)&&r.charAt(u-1)!==n.charAt(a))&&(f=Ere(e,t,r,n,u+1,a+2,i),f*vY>p&&(p=f*vY)),p>d&&(d=p),u=r.indexOf(l,u+1);return i[o]=d,d}function iPe(e){return e.toLowerCase().replace(Tdt," ")}function nYr(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Ere(e,t,iPe(e),iPe(t),0,0,{})}var uC='[cmdk-group=""]',SY='[cmdk-group-items=""]',sYr='[cmdk-group-heading=""]',Adt='[cmdk-item=""]',oPe=`${Adt}:not([aria-disabled="true"])`,kre="cmdk-item-select",Ew="data-value",aYr=(e,t,r)=>nYr(e,t,r),Ddt=E.createContext(void 0),aj=()=>E.useContext(Ddt),Ndt=E.createContext(void 0),Dpe=()=>E.useContext(Ndt),Idt=E.createContext(void 0),jdt=E.forwardRef((e,t)=>{let r=kw(()=>{var U,j;return{search:"",value:(j=(U=e.value)!=null?U:e.defaultValue)!=null?j:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=kw(()=>new Set),s=kw(()=>new Map),a=kw(()=>new Map),i=kw(()=>new Set),o=Rdt(e),{label:l,children:u,value:d,onValueChange:p,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:b=!0,...v}=e,S=Xi(),w=Xi(),k=Xi(),_=E.useRef(null),C=gYr();y1(()=>{if(d!==void 0){let U=d.trim();r.current.value=U,T.emit()}},[d]),y1(()=>{C(6,F)},[]);let T=E.useMemo(()=>({subscribe:U=>(i.current.add(U),()=>i.current.delete(U)),snapshot:()=>r.current,setState:(U,j,Q)=>{var Z,J,ee,te;if(!Object.is(r.current[U],j)){if(r.current[U]=j,U==="search")$(),I(),C(1,R);else if(U==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(k);se?se.focus():(Z=document.getElementById(S))==null||Z.focus()}if(C(7,()=>{var se;r.current.selectedItemId=(se=L())==null?void 0:se.id,T.emit()}),Q||C(5,F),((J=o.current)==null?void 0:J.value)!==void 0){let se=j??"";(te=(ee=o.current).onValueChange)==null||te.call(ee,se);return}}T.emit()}},emit:()=>{i.current.forEach(U=>U())}}),[]),A=E.useMemo(()=>({value:(U,j,Q)=>{var Z;j!==((Z=a.current.get(U))==null?void 0:Z.value)&&(a.current.set(U,{value:j,keywords:Q}),r.current.filtered.items.set(U,N(j,Q)),C(2,()=>{I(),T.emit()}))},item:(U,j)=>(n.current.add(U),j&&(s.current.has(j)?s.current.get(j).add(U):s.current.set(j,new Set([U]))),C(3,()=>{$(),I(),r.current.value||R(),T.emit()}),()=>{a.current.delete(U),n.current.delete(U),r.current.filtered.items.delete(U);let Q=L();C(4,()=>{$(),Q?.getAttribute("id")===U&&R(),T.emit()})}),group:U=>(s.current.has(U)||s.current.set(U,new Set),()=>{a.current.delete(U),s.current.delete(U)}),filter:()=>o.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:S,inputId:k,labelId:w,listInnerRef:_}),[]);function N(U,j){var Q,Z;let J=(Z=(Q=o.current)==null?void 0:Q.filter)!=null?Z:aYr;return U?J(U,r.current.search,j):0}function I(){if(!r.current.search||o.current.shouldFilter===!1)return;let U=r.current.filtered.items,j=[];r.current.filtered.groups.forEach(Z=>{let J=s.current.get(Z),ee=0;J.forEach(te=>{let se=U.get(te);ee=Math.max(se,ee)}),j.push([Z,ee])});let Q=_.current;z().sort((Z,J)=>{var ee,te;let se=Z.getAttribute("id"),ce=J.getAttribute("id");return((ee=U.get(ce))!=null?ee:0)-((te=U.get(se))!=null?te:0)}).forEach(Z=>{let J=Z.closest(SY);J?J.appendChild(Z.parentElement===J?Z:Z.closest(`${SY} > *`)):Q.appendChild(Z.parentElement===Q?Z:Z.closest(`${SY} > *`))}),j.sort((Z,J)=>J[1]-Z[1]).forEach(Z=>{var J;let ee=(J=_.current)==null?void 0:J.querySelector(`${uC}[${Ew}="${encodeURIComponent(Z[0])}"]`);ee?.parentElement.appendChild(ee)})}function R(){let U=z().find(Q=>Q.getAttribute("aria-disabled")!=="true"),j=U?.getAttribute(Ew);T.setState("value",j||void 0)}function $(){var U,j,Q,Z;if(!r.current.search||o.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let J=0;for(let ee of n.current){let te=(j=(U=a.current.get(ee))==null?void 0:U.value)!=null?j:"",se=(Z=(Q=a.current.get(ee))==null?void 0:Q.keywords)!=null?Z:[],ce=N(te,se);r.current.filtered.items.set(ee,ce),ce>0&&J++}for(let[ee,te]of s.current)for(let se of te)if(r.current.filtered.items.get(se)>0){r.current.filtered.groups.add(ee);break}r.current.filtered.count=J}function F(){var U,j,Q;let Z=L();Z&&(((U=Z.parentElement)==null?void 0:U.firstChild)===Z&&((Q=(j=Z.closest(uC))==null?void 0:j.querySelector(sYr))==null||Q.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function L(){var U;return(U=_.current)==null?void 0:U.querySelector(`${Adt}[aria-selected="true"]`)}function z(){var U;return Array.from(((U=_.current)==null?void 0:U.querySelectorAll(oPe))||[])}function q(U){let j=z()[U];j&&T.setState("value",j.getAttribute(Ew))}function H(U){var j;let Q=L(),Z=z(),J=Z.findIndex(te=>te===Q),ee=Z[J+U];(j=o.current)!=null&&j.loop&&(ee=J+U<0?Z[Z.length-1]:J+U===Z.length?Z[0]:Z[J+U]),ee&&T.setState("value",ee.getAttribute(Ew))}function V(U){let j=L(),Q=j?.closest(uC),Z;for(;Q&&!Z;)Q=U>0?hYr(Q,uC):mYr(Q,uC),Z=Q?.querySelector(oPe);Z?T.setState("value",Z.getAttribute(Ew)):H(U)}let G=()=>q(z().length-1),M=U=>{U.preventDefault(),U.metaKey?G():U.altKey?V(1):H(1)},X=U=>{U.preventDefault(),U.metaKey?q(0):U.altKey?V(-1):H(-1)};return E.createElement(rl.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:U=>{var j;(j=v.onKeyDown)==null||j.call(v,U);let Q=U.nativeEvent.isComposing||U.keyCode===229;if(!(U.defaultPrevented||Q))switch(U.key){case"n":case"j":{b&&U.ctrlKey&&M(U);break}case"ArrowDown":{M(U);break}case"p":case"k":{b&&U.ctrlKey&&X(U);break}case"ArrowUp":{X(U);break}case"Home":{U.preventDefault(),q(0);break}case"End":{U.preventDefault(),G();break}case"Enter":{U.preventDefault();let Z=L();if(Z){let J=new Event(kre);Z.dispatchEvent(J)}}}}},E.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:bYr},l),B6(e,U=>E.createElement(Ndt.Provider,{value:T},E.createElement(Ddt.Provider,{value:A},U))))}),iYr=E.forwardRef((e,t)=>{var r,n;let s=Xi(),a=E.useRef(null),i=E.useContext(Idt),o=aj(),l=Rdt(e),u=(n=(r=l.current)==null?void 0:r.forceMount)!=null?n:i?.forceMount;y1(()=>{if(!u)return o.item(s,i?.id)},[u]);let d=Pdt(s,a,[e.value,e.children,a],e.keywords),p=Dpe(),f=Iv(C=>C.value&&C.value===d.current),h=Iv(C=>u||o.filter()===!1?!0:C.search?C.filtered.items.get(s)>0:!0);E.useEffect(()=>{let C=a.current;if(!(!C||e.disabled))return C.addEventListener(kre,m),()=>C.removeEventListener(kre,m)},[h,e.onSelect,e.disabled]);function m(){var C,T;g(),(T=(C=l.current).onSelect)==null||T.call(C,d.current)}function g(){p.setState("value",d.current,!0)}if(!h)return null;let{disabled:b,value:v,onSelect:S,forceMount:w,keywords:k,..._}=e;return E.createElement(rl.div,{ref:am(a,t),..._,id:s,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!f,"data-disabled":!!b,"data-selected":!!f,onPointerMove:b||o.getDisablePointerSelection()?void 0:g,onClick:b?void 0:m},e.children)}),oYr=E.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...a}=e,i=Xi(),o=E.useRef(null),l=E.useRef(null),u=Xi(),d=aj(),p=Iv(h=>s||d.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);y1(()=>d.group(i),[]),Pdt(i,o,[e.value,e.heading,l]);let f=E.useMemo(()=>({id:i,forceMount:s}),[s]);return E.createElement(rl.div,{ref:am(o,t),...a,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},r&&E.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},r),B6(e,h=>E.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?u:void 0},E.createElement(Idt.Provider,{value:f},h))))}),lYr=E.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=E.useRef(null),a=Iv(i=>!i.search);return!r&&!a?null:E.createElement(rl.div,{ref:am(s,t),...n,"cmdk-separator":"",role:"separator"})}),cYr=E.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=e.value!=null,a=Dpe(),i=Iv(u=>u.search),o=Iv(u=>u.selectedItemId),l=aj();return E.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),E.createElement(rl.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":o,id:l.inputId,type:"text",value:s?e.value:i,onChange:u=>{s||a.setState("search",u.target.value),r?.(u.target.value)}})}),uYr=E.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,a=E.useRef(null),i=E.useRef(null),o=Iv(u=>u.selectedItemId),l=aj();return E.useEffect(()=>{if(i.current&&a.current){let u=i.current,d=a.current,p,f=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let h=u.offsetHeight;d.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return f.observe(u),()=>{cancelAnimationFrame(p),f.unobserve(u)}}},[]),E.createElement(rl.div,{ref:am(a,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":n,id:l.listId},B6(e,u=>E.createElement("div",{ref:am(i,l.listInnerRef),"cmdk-list-sizer":""},u)))}),dYr=E.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:a,container:i,...o}=e;return E.createElement(eF,{open:r,onOpenChange:n},E.createElement(tF,{container:i},E.createElement(bI,{"cmdk-overlay":"",className:s}),E.createElement(vI,{"aria-label":e.label,"cmdk-dialog":"",className:a},E.createElement(jdt,{ref:t,...o}))))}),pYr=E.forwardRef((e,t)=>Iv(r=>r.filtered.count===0)?E.createElement(rl.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),fYr=E.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...a}=e;return E.createElement(rl.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},B6(e,i=>E.createElement("div",{"aria-hidden":!0},i)))}),Iu=Object.assign(jdt,{List:uYr,Item:iYr,Input:cYr,Group:oYr,Separator:lYr,Dialog:dYr,Empty:pYr,Loading:fYr});function hYr(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function mYr(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Rdt(e){let t=E.useRef(e);return y1(()=>{t.current=e}),t}var y1=typeof window>"u"?E.useEffect:E.useLayoutEffect;function kw(e){let t=E.useRef();return t.current===void 0&&(t.current=e()),t}function Iv(e){let t=Dpe(),r=()=>e(t.snapshot());return E.useSyncExternalStore(t.subscribe,r,r)}function Pdt(e,t,r,n=[]){let s=E.useRef(),a=aj();return y1(()=>{var i;let o=(()=>{var u;for(let d of r){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():s.current}})(),l=n.map(u=>u.trim());a.value(e,o,l),(i=t.current)==null||i.setAttribute(Ew,o),s.current=o}),s}var gYr=()=>{let[e,t]=E.useState(),r=kw(()=>new Map);return y1(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,s)=>{r.current.set(n,s),t({})}};function yYr(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function B6({asChild:e,children:t},r){return e&&E.isValidElement(t)?E.cloneElement(yYr(t),{ref:t.ref},r(t.props.children)):r(t)}var bYr={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};class lo{constructor(t,r,n,s){this.fromA=t,this.toA=r,this.fromB=n,this.toB=s}offset(t,r=t){return new lo(this.fromA+t,this.toA+t,this.fromB+r,this.toB+r)}}function b1(e,t,r,n,s,a){if(e==n)return[];let i=Ipe(e,t,r,n,s,a),o=jpe(e,t+i,r,n,s+i,a);t+=i,r-=o,s+=i,a-=o;let l=r-t,u=a-s;if(!l||!u)return[new lo(t,r,s,a)];if(l>u){let p=e.slice(t,r).indexOf(n.slice(s,a));if(p>-1)return[new lo(t,t+p,s,s),new lo(t+p+u,r,a,a)]}else if(u>l){let p=n.slice(s,a).indexOf(e.slice(t,r));if(p>-1)return[new lo(t,t,s,s+p),new lo(r,r,s+p+l,a)]}if(l==1||u==1)return[new lo(t,r,s,a)];let d=Ldt(e,t,r,n,s,a);if(d){let[p,f,h]=d;return b1(e,t,p,n,s,f).concat(b1(e,p+h,r,n,f+h,a))}return vYr(e,t,r,n,s,a)}let VC=1e9,qC=0,Npe=!1;function vYr(e,t,r,n,s,a){let i=r-t,o=a-s;if(VC<1e9&&Math.min(i,o)>VC*16||qC>0&&Date.now()>qC)return Math.min(i,o)>VC*64?[new lo(t,r,s,a)]:lPe(e,t,r,n,s,a);let l=Math.ceil((i+o)/2);wY.reset(l),EY.reset(l);let u=(h,m)=>e.charCodeAt(t+h)==n.charCodeAt(s+m),d=(h,m)=>e.charCodeAt(r-h-1)==n.charCodeAt(a-m-1),p=(i-o)%2!=0?EY:null,f=p?null:wY;for(let h=0;h<l;h++){if(h>VC||qC>0&&!(h&63)&&Date.now()>qC)return lPe(e,t,r,n,s,a);let m=wY.advance(h,i,o,l,p,!1,u)||EY.advance(h,i,o,l,f,!0,d);if(m)return xYr(e,t,r,t+m[0],n,s,a,s+m[1])}return[new lo(t,r,s,a)]}class $dt{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let r=0;r<this.len;r++)this.vec[r]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,r,n,s,a,i,o){for(let l=-t+this.start;l<=t-this.end;l+=2){let u=s+l,d=l==-t||l!=t&&this.vec[u-1]<this.vec[u+1]?this.vec[u+1]:this.vec[u-1]+1,p=d-l;for(;d<r&&p<n&&o(d,p);)d++,p++;if(this.vec[u]=d,d>r)this.end+=2;else if(p>n)this.start+=2;else if(a){let f=s+(r-n)-l;if(f>=0&&f<this.len&&a.vec[f]!=-1)if(i){let h=a.vec[f];if(h>=r-d)return[h,s+h-f]}else{let h=r-a.vec[f];if(d>=h)return[d,p]}}}return null}}const wY=new $dt,EY=new $dt;function xYr(e,t,r,n,s,a,i,o){let l=!1;return!$k(e,n)&&++n==r&&(l=!0),!$k(s,o)&&++o==i&&(l=!0),l?[new lo(t,r,a,i)]:b1(e,t,n,s,a,o).concat(b1(e,n,r,s,o,i))}function Mdt(e,t){let r=1,n=Math.min(e,t);for(;r<n;)r=r<<1;return r}function Ipe(e,t,r,n,s,a){if(t==r||t==a||e.charCodeAt(t)!=n.charCodeAt(s))return 0;let i=Mdt(r-t,a-s);for(let o=t,l=s;;){let u=o+i,d=l+i;if(u>r||d>a||e.slice(o,u)!=n.slice(l,d)){if(i==1)return o-t-($k(e,o)?0:1);i=i>>1}else{if(u==r||d==a)return u-t;o=u,l=d}}}function jpe(e,t,r,n,s,a){if(t==r||s==a||e.charCodeAt(r-1)!=n.charCodeAt(a-1))return 0;let i=Mdt(r-t,a-s);for(let o=r,l=a;;){let u=o-i,d=l-i;if(u<t||d<s||e.slice(u,o)!=n.slice(d,l)){if(i==1)return r-o-($k(e,o)?0:1);i=i>>1}else{if(u==t||d==s)return r-u;o=u,l=d}}}function Ore(e,t,r,n,s,a,i,o){let l=n.slice(s,a),u=null;for(;;){if(u||i<o)return u;for(let d=t+i;;){$k(e,d)||d++;let p=d+i;if($k(e,p)||(p+=p==d+1?1:-1),p>=r)break;let f=e.slice(d,p),h=-1;for(;(h=l.indexOf(f,h+1))!=-1;){let m=Ipe(e,p,r,n,s+h+f.length,a),g=jpe(e,t,d,n,s,s+h),b=f.length+m+g;(!u||u[2]<b)&&(u=[d-g,s+h-g,b])}d=p}if(o<0)return u;i=i>>1}}function Ldt(e,t,r,n,s,a){let i=r-t,o=a-s;if(i<o){let l=Ldt(n,s,a,e,t,r);return l&&[l[1],l[0],l[2]]}return i<4||o*2<i?null:Ore(e,t,r,n,s,a,Math.floor(i/4),-1)}function lPe(e,t,r,n,s,a){Npe=!0;let i=r-t,o=a-s,l;if(i<o){let f=Ore(n,s,a,e,t,r,Math.floor(i/6),50);l=f&&[f[1],f[0],f[2]]}else l=Ore(e,t,r,n,s,a,Math.floor(o/6),50);if(!l)return[new lo(t,r,s,a)];let[u,d,p]=l;return b1(e,t,u,n,s,d).concat(b1(e,u+p,r,n,d+p,a))}function Fdt(e,t){for(let r=1;r<e.length;r++){let n=e[r-1],s=e[r];n.toA>s.fromA-t&&n.toB>s.fromB-t&&(e[r-1]=new lo(n.fromA,s.toA,n.fromB,s.toB),e.splice(r--,1))}}function SYr(e,t,r){for(;;){Fdt(r,1);let n=!1;for(let s=0;s<r.length;s++){let a=r[s],i,o;(i=Ipe(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=r[s]=new lo(a.fromA+i,a.toA,a.fromB+i,a.toB)),(o=jpe(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=r[s]=new lo(a.fromA,a.toA-o,a.fromB,a.toB-o));let l=a.toA-a.fromA,u=a.toB-a.fromB;if(l&&u)continue;let d=a.fromA-(s?r[s-1].toA:0),p=(s<r.length-1?r[s+1].fromA:e.length)-a.toA;if(!d||!p)continue;let f=l?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);d<=f.length&&e.slice(a.fromA-d,a.fromA)==f.slice(f.length-d)?(r[s]=new lo(a.fromA-d,a.toA-d,a.fromB-d,a.toB-d),n=!0):p<=f.length&&e.slice(a.toA,a.toA+p)==f.slice(0,p)&&(r[s]=new lo(a.fromA+p,a.toA+p,a.fromB+p,a.toB+p),n=!0)}if(!n)break}return r}function wYr(e,t,r){for(let n=0,s=0;s<e.length;s++){let a=e[s],i=a.toA-a.fromA,o=a.toB-a.fromB;if(i&&o||i>3||o>3){let l=s==e.length-1?t.length:e[s+1].fromA,u=a.fromA-n,d=l-a.toA,p=uPe(t,a.fromA,u),f=cPe(t,a.toA,d),h=a.fromA-p,m=f-a.toA;if((!i||!o)&&h&&m){let g=Math.max(i,o),[b,v,S]=i?[t,a.fromA,a.toA]:[r,a.fromB,a.toB];g>h&&t.slice(p,a.fromA)==b.slice(S-h,S)?(a=e[s]=new lo(p,p+i,a.fromB-h,a.toB-h),p=a.fromA,f=cPe(t,a.toA,l-a.toA)):g>m&&t.slice(a.toA,f)==b.slice(v,v+m)&&(a=e[s]=new lo(f-i,f,a.fromB+m,a.toB+m),f=a.toA,p=uPe(t,a.fromA,a.fromA-n)),h=a.fromA-p,m=f-a.toA}if(h||m)a=e[s]=new lo(a.fromA-h,a.toA+m,a.fromB-h,a.toB+m);else if(i){if(!o){let g=pPe(t,a.fromA,a.toA),b,v=g<0?-1:dPe(t,a.toA,a.fromA);g>-1&&(b=g-a.fromA)<=d&&t.slice(a.fromA,g)==t.slice(a.toA,a.toA+b)?a=e[s]=a.offset(b):v>-1&&(b=a.toA-v)<=u&&t.slice(a.fromA-b,a.fromA)==t.slice(v,a.toA)&&(a=e[s]=a.offset(-b))}}else{let g=pPe(r,a.fromB,a.toB),b,v=g<0?-1:dPe(r,a.toB,a.fromB);g>-1&&(b=g-a.fromB)<=d&&r.slice(a.fromB,g)==r.slice(a.toB,a.toB+b)?a=e[s]=a.offset(b):v>-1&&(b=a.toB-v)<=u&&r.slice(a.fromB-b,a.fromB)==r.slice(v,a.toB)&&(a=e[s]=a.offset(-b))}}n=a.toA}return Fdt(e,3),e}let A0;try{A0=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Bdt(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function zdt(e,t){if(t==e.length)return 0;let r=e.charCodeAt(t);return r<192?Bdt(r)?1:0:A0?!qdt(r)||t==e.length-1?A0.test(String.fromCharCode(r))?1:0:A0.test(e.slice(t,t+2))?2:0:0}function Udt(e,t){if(!t)return 0;let r=e.charCodeAt(t-1);return r<192?Bdt(r)?1:0:A0?!Hdt(r)||t==1?A0.test(String.fromCharCode(r))?1:0:A0.test(e.slice(t-2,t))?2:0:0}const Vdt=8;function cPe(e,t,r){if(t==e.length||!Udt(e,t))return t;for(let n=t,s=t+r,a=0;a<Vdt;a++){let i=zdt(e,n);if(!i||n+i>s)return n;n+=i}return t}function uPe(e,t,r){if(!t||!zdt(e,t))return t;for(let n=t,s=t-r,a=0;a<Vdt;a++){let i=Udt(e,n);if(!i||n-i<s)return n;n-=i}return t}function dPe(e,t,r){for(;t!=r;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function pPe(e,t,r){for(;t!=r;t++)if(e.charCodeAt(t)==10)return t;return-1}const qdt=e=>e>=55296&&e<=56319,Hdt=e=>e>=56320&&e<=57343;function $k(e,t){return!t||t==e.length||!qdt(e.charCodeAt(t-1))||!Hdt(e.charCodeAt(t))}function EYr(e,t,r){var n;let s=r?.override;return s?s(e,t):(VC=((n=r?.scanLimit)!==null&&n!==void 0?n:1e9)>>1,qC=r?.timeout?Date.now()+r.timeout:0,Npe=!1,SYr(e,t,b1(e,0,e.length,t,0,t.length)))}function Qdt(){return!Npe}function Gdt(e,t,r){return wYr(EYr(e,t,r),e,t)}const Ph=Xt.define({combine:e=>e[0]}),_re=en.define(),kYr=Xt.define(),Mk=Ji.define({create(e){return null},update(e,t){for(let r of t.effects)r.is(_re)&&(e=r.value);for(let r of t.state.facet(kYr))e=r(e,t);return e}});class SE{constructor(t,r,n,s,a,i=!0){this.changes=t,this.fromA=r,this.toA=n,this.fromB=s,this.toB=a,this.precise=i}offset(t,r){return t||r?new SE(this.changes,this.fromA+t,this.toA+t,this.fromB+r,this.toB+r,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,r,n){let s=Gdt(t.toString(),r.toString(),n);return Zdt(s,t,r,0,0,Qdt())}static updateA(t,r,n,s,a){return yPe(gPe(t,s,!0,n.length),t,r,n,a)}static updateB(t,r,n,s,a){return yPe(gPe(t,s,!1,r.length),t,r,n,a)}}function fPe(e,t,r,n){let s=r.lineAt(e),a=n.lineAt(t);return s.to==e&&a.to==t&&e<r.length&&t<n.length?[e+1,t+1]:[s.from,a.from]}function hPe(e,t,r,n){let s=r.lineAt(e),a=n.lineAt(t);return s.from==e&&a.from==t?[e,t]:[s.to+1,a.to+1]}function Zdt(e,t,r,n,s,a){let i=[];for(let o=0;o<e.length;o++){let l=e[o],[u,d]=fPe(l.fromA+n,l.fromB+s,t,r),[p,f]=hPe(l.toA+n,l.toB+s,t,r),h=[l.offset(-u+n,-d+s)];for(;o<e.length-1;){let m=e[o+1],[g,b]=fPe(m.fromA+n,m.fromB+s,t,r);if(g>p+1&&b>f+1)break;h.push(m.offset(-u+n,-d+s)),[p,f]=hPe(m.toA+n,m.toB+s,t,r),o++}i.push(new SE(h,u,Math.max(u,p),d,Math.max(d,f),a))}return i}const xP=1e3;function mPe(e,t,r,n){let s=0,a=e.length;for(;;){if(s==a){let d=0,p=0;s&&({toA:d,toB:p}=e[s-1]);let f=t-(r?d:p);return[d+f,p+f]}let i=s+a>>1,o=e[i],[l,u]=r?[o.fromA,o.toA]:[o.fromB,o.toB];if(l>t)a=i;else if(u<=t)s=i+1;else return n?[o.fromA,o.fromB]:[o.toA,o.toB]}}function gPe(e,t,r,n){let s=[];return t.iterChangedRanges((a,i,o,l)=>{let u=0,d=r?t.length:n,p=0,f=r?n:t.length;a>xP&&([u,p]=mPe(e,a-xP,r,!0)),i<t.length-xP&&([d,f]=mPe(e,i+xP,r,!1));let h=l-o-(i-a),m,[g,b]=r?[h,0]:[0,h];s.length&&(m=s[s.length-1]).toA>=u?s[s.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:f,diffA:m.diffA+g,diffB:m.diffB+b}:s.push({fromA:u,toA:d,fromB:p,toB:f,diffA:g,diffB:b})}),s}function yPe(e,t,r,n,s){if(!e.length)return t;let a=[];for(let i=0,o=0,l=0,u=0;;i++){let d=i==e.length?null:e[i],p=d?d.fromA+o:r.length,f=d?d.fromB+l:n.length;for(;u<t.length;){let b=t[u];if(b.endA+o>p||b.endB+l>f)break;a.push(b.offset(o,l)),u++}if(!d)break;let h=d.toA+o+d.diffA,m=d.toB+l+d.diffB,g=Gdt(r.sliceString(p,h),n.sliceString(f,m),s);for(let b of Zdt(g,r,n,p,f,Qdt()))a.push(b);for(o+=d.diffA,l+=d.diffB;u<t.length;){let b=t[u];if(b.fromA+o>h&&b.fromB+l>m)break;u++}}return a}const OYr={scanLimit:500},Wdt=xi.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=xPe(e))}update(e){(e.docChanged||e.viewportChanged||_Yr(e.startState,e.state)||CYr(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=xPe(e.view))}},{decorations:e=>e.deco}),SP=Wf.low($qe({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(Wdt))===null||t===void 0?void 0:t.gutter)||Yn.empty}}));function _Yr(e,t){return e.field(Mk,!1)!=t.field(Mk,!1)}function CYr(e,t){return e.facet(Ph)!=t.facet(Ph)}const bPe=rr.line({class:"cm-changedLine"}),TYr=rr.mark({class:"cm-changedText"}),AYr=rr.mark({tagName:"ins",class:"cm-insertedLine"}),DYr=rr.mark({tagName:"del",class:"cm-deletedLine"}),vPe=new class extends cm{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function NYr(e,t,r,n,s,a){let i=r?e.fromA:e.fromB,o=r?e.toA:e.toB,l=0;if(i!=o){s.add(i,i,bPe),s.add(i,o,r?DYr:AYr),a&&a.add(i,i,vPe);for(let u=t.iterRange(i,o-1),d=i;!u.next().done;){if(u.lineBreak){d++,s.add(d,d,bPe),a&&a.add(d,d,vPe);continue}let p=d+u.value.length;if(n)for(;l<e.changes.length;){let f=e.changes[l],h=i+(r?f.fromA:f.fromB),m=i+(r?f.toA:f.toB),g=Math.max(d,h),b=Math.min(p,m);if(g<b&&s.add(g,b,TYr),m<p)l++;else break}d=p}}}function xPe(e){let t=e.state.field(Mk),{side:r,highlightChanges:n,markGutter:s,overrideChunk:a}=e.state.facet(Ph),i=r=="a",o=new bu,l=s?new bu:null,{from:u,to:d}=e.viewport;for(let p of t){if((i?p.fromA:p.fromB)>=d)break;(i?p.toA:p.toB)>u&&(!a||!a(e.state,p,o,l))&&NYr(p,e.state.doc,i,n,o,l)}return{deco:o.finish(),gutter:l&&l.finish()}}class wP extends $d{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 k4=en.define({map:(e,t)=>e.map(t)}),HC=Ji.define({create:()=>rr.none,update:(e,t)=>{for(let r of t.effects)if(r.is(k4))return r.value;return e.map(t.changes)},provide:e=>ht.decorations.from(e)}),EP=.01;function SPe(e,t){if(e.size!=t.size)return!1;let r=e.iter(),n=t.iter();for(;r.value;){if(r.from!=n.from||Math.abs(r.value.spec.widget.height-n.value.spec.widget.height)>1)return!1;r.next(),n.next()}return!0}function IYr(e,t,r){let n=new bu,s=new bu,a=e.state.field(HC).iter(),i=t.state.field(HC).iter(),o=0,l=0,u=0,d=0,p=e.viewport,f=t.viewport;for(let b=0;;b++){let v=b<r.length?r[b]:null,S=v?v.fromA:e.state.doc.length,w=v?v.fromB:t.state.doc.length;if(o<S){let k=e.lineBlockAt(o).top+u,_=t.lineBlockAt(l).top+d,C=k-_;C<-EP?(u-=C,n.add(o,o,rr.widget({widget:new wP(-C),block:!0,side:-1}))):C>EP&&(d+=C,s.add(l,l,rr.widget({widget:new wP(C),block:!0,side:-1})))}if(S>o+1e3&&o<p.from&&S>p.from&&l<f.from&&w>f.from){let k=Math.min(p.from-o,f.from-l);o+=k,l+=k,b--}else if(v)o=v.toA,l=v.toB;else break;for(;a.value&&a.from<o;)u-=a.value.spec.widget.height,a.next();for(;i.value&&i.from<l;)d-=i.value.spec.widget.height,i.next()}for(;a.value;)u-=a.value.spec.widget.height,a.next();for(;i.value;)d-=i.value.spec.widget.height,i.next();let h=e.contentHeight+u-(t.contentHeight+d);h<EP?n.add(e.state.doc.length,e.state.doc.length,rr.widget({widget:new wP(-h),block:!0,side:1})):h>EP&&s.add(t.state.doc.length,t.state.doc.length,rr.widget({widget:new wP(h),block:!0,side:1}));let m=n.finish(),g=s.finish();SPe(m,e.state.field(HC))||e.dispatch({effects:k4.of(m)}),SPe(g,t.state.field(HC))||t.dispatch({effects:k4.of(g)})}const Cre=en.define({map:(e,t)=>t.mapPos(e)});class jYr extends $d{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=t.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",n=>{let s=t.posAtDOM(n.target);t.dispatch({effects:Cre.of(s)});let{side:a,sibling:i}=t.state.facet(Ph);i&&i().dispatch({effects:Cre.of(RYr(s,t.state.field(Mk),a=="a"))})}),r}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function RYr(e,t,r){let n=0,s=0;for(let a=0;;a++){let i=a<t.length?t[a]:null;if(!i||(r?i.fromA:i.fromB)>=e)return s+(e-n);[n,s]=r?[i.toA,i.toB]:[i.toB,i.toA]}}const PYr=Ji.define({create(e){return rr.none},update(e,t){e=e.map(t.changes);for(let r of t.effects)r.is(Cre)&&(e=e.update({filter:n=>n!=r.value}));return e},provide:e=>ht.decorations.from(e)});function wPe({margin:e=3,minSize:t=4}){return PYr.init(r=>$Yr(r,e,t))}function $Yr(e,t,r){let n=new bu,s=e.facet(Ph).side=="a",a=e.field(Mk),i=1;for(let o=0;;o++){let l=o<a.length?a[o]:null,u=o?i+t:1,d=l?e.doc.lineAt(s?l.fromA:l.fromB).number-1-t:e.doc.lines,p=d-u+1;if(p>=r&&n.add(e.doc.line(u).from,e.doc.line(d).to,rr.replace({widget:new jYr(p),block:!0})),!l)break;i=e.doc.lineAt(Math.min(e.doc.length,s?l.toA:l.toB)).number}return n.finish()}const MYr=ht.styleModule.of(new Wg({".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"}})),LYr=ht.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"}}),EPe=new rO,kP=new rO;class FYr{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||OYr;let r=[Wf.low(Wdt),LYr,MYr,HC,ht.updateListener.of(p=>{this.measuring<0&&(p.heightChanged||p.viewportChanged)&&!p.transactions.some(f=>f.effects.some(h=>h.is(k4)))&&this.measure()})],n=[Ph.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&n.push(SP);let s=Zn.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],ht.editorAttributes.of({class:"cm-merge-a"}),kP.of(n),r]}),a=[Ph.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&a.push(SP);let i=Zn.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],ht.editorAttributes.of({class:"cm-merge-b"}),kP.of(a),r]});this.chunks=SE.build(s.doc,i.doc,this.diffConf);let o=[Mk.init(()=>this.chunks),EPe.of(t.collapseUnchanged?wPe(t.collapseUnchanged):[])];s=s.update({effects:en.appendConfig.of(o)}).state,i=i.update({effects:en.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 l=t.orientation||"a-b",u=document.createElement("div");u.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?u:d),this.editorDOM.appendChild(l=="a-b"?d:u),this.a=new ht({state:s,parent:u,root:t.root,dispatchTransactions:p=>this.dispatch(p,this.a)}),this.b=new ht({state:i,parent:d,root:t.root,dispatchTransactions:p=>this.dispatch(p,this.b)}),this.setupRevertControls(!!t.revertControls,t.revertControls=="b-to-a",t.renderRevertControl),t.parent&&t.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(t,r){if(t.some(n=>n.docChanged)){let n=t[t.length-1],s=t.reduce((i,o)=>i.compose(o.changes),io.empty(t[0].startState.doc.length));this.chunks=r==this.a?SE.updateA(this.chunks,n.newDoc,this.b.state.doc,s,this.diffConf):SE.updateB(this.chunks,this.a.state.doc,n.newDoc,s,this.diffConf),r.update([...t,n.state.update({effects:_re.of(this.chunks)})]);let a=r==this.a?this.b:this.a;a.update([a.state.update({effects:_re.of(this.chunks)})]),this.scheduleMeasure()}else r.update(t)}reconfigure(t){if("diffConfig"in t&&(this.diffConf=t.diffConfig),"orientation"in t){let a=t.orientation!="b-a";if(a!=(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(a?i:o,this.editorDOM.firstChild),this.editorDOM.appendChild(a?o:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in t||"renderRevertControl"in t){let a=!!this.revertDOM,i=this.revertToA,o=this.renderRevert;"revertControls"in t&&(a=!!t.revertControls,i=t.revertControls=="b-to-a"),"renderRevertControl"in t&&(o=t.renderRevertControl),this.setupRevertControls(a,i,o)}let r="highlightChanges"in t,n="gutter"in t,s="collapseUnchanged"in t;if(r||n||s){let a=[],i=[];if(r||n){let o=this.a.state.facet(Ph),l=n?t.gutter!==!1:o.markGutter,u=r?t.highlightChanges!==!1:o.highlightChanges;a.push(kP.reconfigure([Ph.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:l}),l?SP:[]])),i.push(kP.reconfigure([Ph.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:l}),l?SP:[]]))}if(s){let o=EPe.reconfigure(t.collapseUnchanged?wPe(t.collapseUnchanged):[]);a.push(o),i.push(o)}this.a.dispatch({effects:a}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(t,r,n){this.revertToA=r,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!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",s=>this.revertClicked(s)),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(){IYr(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let t=this.revertDOM,r=t.firstChild,n=this.a.viewport,s=this.b.viewport;for(let a=0;a<this.chunks.length;a++){let i=this.chunks[a];if(i.fromA>n.to||i.fromB>s.to)break;if(i.fromA<n.from||i.fromB<s.from)continue;let o=this.a.lineBlockAt(i.fromA).top+"px";for(;r&&+r.dataset.chunk<a;)r=kPe(r);r&&r.dataset.chunk==String(a)?(r.style.top!=o&&(r.style.top=o),r=r.nextSibling):t.insertBefore(this.renderRevertButton(o,a),r)}for(;r;)r=kPe(r)}renderRevertButton(t,r){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement("button");let s=this.a.state.phrase("Revert this chunk");n.setAttribute("aria-label",s),n.setAttribute("title",s),n.textContent=this.revertToLeft?"⇜":"⇝"}return n.style.top=t,n.setAttribute("data-chunk",String(r)),n}revertClicked(t){let r=t.target,n;for(;r&&r.parentNode!=this.revertDOM;)r=r.parentNode;if(r&&(n=this.chunks[r.dataset.chunk])){let[s,a,i,o,l,u]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],d=s.state.sliceDoc(i,Math.max(i,o-1));i!=o&&u<=a.state.doc.length&&(d+=s.state.lineBreak),a.dispatch({changes:{from:l,to:Math.min(a.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 kPe(e){let t=e.nextSibling;return e.remove(),t}function Xdt(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Xdt(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ydt(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Xdt(e))&&(n&&(n+=" "),n+=t);return n}const BYr=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},zYr=(e,t)=>({classGroupId:e,validator:t}),Kdt=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),O4="-",OPe=[],UYr="arbitrary..",VYr=e=>{const t=HYr(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return qYr(i);const o=i.split(O4),l=o[0]===""&&o.length>1?1:0;return Jdt(o,l,t)},getConflictingClassGroupIds:(i,o)=>{if(o){const l=n[i],u=r[i];return l?u?BYr(u,l):l:u||OPe}return r[i]||OPe}}},Jdt=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const u=Jdt(e,t+1,a);if(u)return u}const i=r.validators;if(i===null)return;const o=t===0?e.join(O4):e.slice(t).join(O4),l=i.length;for(let u=0;u<l;u++){const d=i[u];if(d.validator(o))return d.classGroupId}},qYr=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?UYr+n:void 0})(),HYr=e=>{const{theme:t,classGroups:r}=e;return QYr(r,t)},QYr=(e,t)=>{const r=Kdt();for(const n in e){const s=e[n];Rpe(s,r,n,t)}return r},Rpe=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];GYr(i,t,r,n)}},GYr=(e,t,r,n)=>{if(typeof e=="string"){ZYr(e,t,r);return}if(typeof e=="function"){WYr(e,t,r,n);return}XYr(e,t,r,n)},ZYr=(e,t,r)=>{const n=e===""?t:ept(t,e);n.classGroupId=r},WYr=(e,t,r,n)=>{if(YYr(e)){Rpe(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(zYr(r,e))},XYr=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[o,l]=s[i];Rpe(l,ept(t,o),r,n)}},ept=(e,t)=>{let r=e;const n=t.split(O4),s=n.length;for(let a=0;a<s;a++){const i=n[a];let o=r.nextPart.get(i);o||(o=Kdt(),r.nextPart.set(i,o)),r=o}return r},YYr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,KYr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},Tre="!",_Pe=":",JYr=[],CPe=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),eKr=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,o=0,l=0,u;const d=s.length;for(let g=0;g<d;g++){const b=s[g];if(i===0&&o===0){if(b===_Pe){a.push(s.slice(l,g)),l=g+1;continue}if(b==="/"){u=g;continue}}b==="["?i++:b==="]"?i--:b==="("?o++:b===")"&&o--}const p=a.length===0?s:s.slice(l);let f=p,h=!1;p.endsWith(Tre)?(f=p.slice(0,-1),h=!0):p.startsWith(Tre)&&(f=p.slice(1),h=!0);const m=u&&u>l?u-l:void 0;return CPe(a,h,f,m)};if(t){const s=t+_Pe,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):CPe(JYr,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},tKr=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const i=r[a],o=i[0]==="[",l=t.has(i);o||l?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},rKr=e=>({cache:KYr(e.cacheSize),parseClassName:eKr(e),sortModifiers:tKr(e),...VYr(e)}),nKr=/\s+/,sKr=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],o=e.trim().split(nKr);let l="";for(let u=o.length-1;u>=0;u-=1){const d=o[u],{isExternal:p,modifiers:f,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}=r(d);if(p){l=d+(l.length>0?" "+l:l);continue}let b=!!g,v=n(b?m.substring(0,g):m);if(!v){if(!b){l=d+(l.length>0?" "+l:l);continue}if(v=n(m),!v){l=d+(l.length>0?" "+l:l);continue}b=!1}const S=f.length===0?"":f.length===1?f[0]:a(f).join(":"),w=h?S+Tre:S,k=w+v;if(i.indexOf(k)>-1)continue;i.push(k);const _=s(v,b);for(let C=0;C<_.length;++C){const T=_[C];i.push(w+T)}l=d+(l.length>0?" "+l:l)}return l},aKr=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=tpt(r))&&(s&&(s+=" "),s+=n);return s},tpt=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=tpt(e[n]))&&(r&&(r+=" "),r+=t);return r},TPe=(e,...t)=>{let r,n,s,a;const i=l=>{const u=t.reduce((d,p)=>p(d),e());return r=rKr(u),n=r.cache.get,s=r.cache.set,a=o,o(l)},o=l=>{const u=n(l);if(u)return u;const d=sKr(l,r);return s(l,d),d};return a=i,(...l)=>a(aKr(...l))},iKr=[],Eo=e=>{const t=r=>r[e]||iKr;return t.isThemeGetter=!0,t},rpt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,npt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oKr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lKr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cKr=/\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$/,uKr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dKr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pKr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fb=e=>oKr.test(e),Qn=e=>!!e&&!Number.isNaN(Number(e)),hb=e=>!!e&&Number.isInteger(Number(e)),kY=e=>e.endsWith("%")&&Qn(e.slice(0,-1)),fg=e=>lKr.test(e),spt=()=>!0,fKr=e=>cKr.test(e)&&!uKr.test(e),Ppe=()=>!1,hKr=e=>dKr.test(e),mKr=e=>pKr.test(e),gKr=e=>!br(e)&&!wr(e),yKr=e=>rx(e,opt,Ppe),br=e=>rpt.test(e),Fx=e=>rx(e,lpt,fKr),APe=e=>rx(e,OKr,Qn),bKr=e=>rx(e,upt,spt),vKr=e=>rx(e,cpt,Ppe),DPe=e=>rx(e,apt,Ppe),xKr=e=>rx(e,ipt,mKr),OP=e=>rx(e,dpt,hKr),wr=e=>npt.test(e),dC=e=>iS(e,lpt),SKr=e=>iS(e,cpt),NPe=e=>iS(e,apt),wKr=e=>iS(e,opt),EKr=e=>iS(e,ipt),_P=e=>iS(e,dpt,!0),kKr=e=>iS(e,upt,!0),rx=(e,t,r)=>{const n=rpt.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},iS=(e,t,r=!1)=>{const n=npt.exec(e);return n?n[1]?t(n[1]):r:!1},apt=e=>e==="position"||e==="percentage",ipt=e=>e==="image"||e==="url",opt=e=>e==="length"||e==="size"||e==="bg-size",lpt=e=>e==="length",OKr=e=>e==="number",cpt=e=>e==="family-name",upt=e=>e==="number"||e==="weight",dpt=e=>e==="shadow",IPe=()=>{const e=Eo("color"),t=Eo("font"),r=Eo("text"),n=Eo("font-weight"),s=Eo("tracking"),a=Eo("leading"),i=Eo("breakpoint"),o=Eo("container"),l=Eo("spacing"),u=Eo("radius"),d=Eo("shadow"),p=Eo("inset-shadow"),f=Eo("text-shadow"),h=Eo("drop-shadow"),m=Eo("blur"),g=Eo("perspective"),b=Eo("aspect"),v=Eo("ease"),S=Eo("animate"),w=()=>["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(),wr,br],C=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],A=()=>[wr,br,l],N=()=>[fb,"full","auto",...A()],I=()=>[hb,"none","subgrid",wr,br],R=()=>["auto",{span:["full",hb,wr,br]},hb,wr,br],$=()=>[hb,"auto",wr,br],F=()=>["auto","min","max","fr",wr,br],L=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...A()],H=()=>[fb,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],V=()=>[fb,"screen","full","dvw","lvw","svw","min","max","fit",...A()],G=()=>[fb,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],M=()=>[e,wr,br],X=()=>[...k(),NPe,DPe,{position:[wr,br]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",wKr,yKr,{size:[wr,br]}],Q=()=>[kY,dC,Fx],Z=()=>["","none","full",u,wr,br],J=()=>["",Qn,dC,Fx],ee=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>[Qn,kY,NPe,DPe],ce=()=>["","none",m,wr,br],Se=()=>["none",Qn,wr,br],W=()=>["none",Qn,wr,br],ne=()=>[Qn,wr,br],ae=()=>[fb,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fg],breakpoint:[fg],color:[spt],container:[fg],"drop-shadow":[fg],ease:["in","out","in-out"],font:[gKr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fg],shadow:[fg],spacing:["px",Qn],text:[fg],"text-shadow":[fg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",fb,br,wr,b]}],container:["container"],columns:[{columns:[Qn,br,wr,o]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"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:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[hb,"auto",wr,br]}],basis:[{basis:[fb,"full","auto",o,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Qn,fb,"auto","initial","none",br]}],grow:[{grow:["",Qn,wr,br]}],shrink:[{shrink:["",Qn,wr,br]}],order:[{order:[hb,"first","last","none",wr,br]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:R()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:R()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...L(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...L()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":L()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],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":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[o,"screen",...H()]}],"min-w":[{"min-w":[o,"screen","none",...H()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,dC,Fx]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,kKr,bKr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",kY,br]}],"font-family":[{font:[SKr,vKr,t]}],"font-features":[{"font-features":[br]}],"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:[s,wr,br]}],"line-clamp":[{"line-clamp":[Qn,"none",wr,APe]}],leading:[{leading:[a,...A()]}],"list-image":[{"list-image":["none",wr,br]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",wr,br]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Qn,"from-font","auto",wr,Fx]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Qn,"auto",wr,br]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",wr,br]}],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",wr,br]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},hb,wr,br],radial:["",wr,br],conic:[hb,wr,br]},EKr,xKr]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Qn,wr,br]}],"outline-w":[{outline:["",Qn,dC,Fx]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,_P,OP]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",p,_P,OP]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Qn,Fx]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",f,_P,OP]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Qn,wr,br]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"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":[Qn]}],"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":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"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":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"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":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"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":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"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":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"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":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"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":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[wr,br]}],"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":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":[Qn]}],"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":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",wr,br]}],filter:[{filter:["","none",wr,br]}],blur:[{blur:ce()}],brightness:[{brightness:[Qn,wr,br]}],contrast:[{contrast:[Qn,wr,br]}],"drop-shadow":[{"drop-shadow":["","none",h,_P,OP]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Qn,wr,br]}],"hue-rotate":[{"hue-rotate":[Qn,wr,br]}],invert:[{invert:["",Qn,wr,br]}],saturate:[{saturate:[Qn,wr,br]}],sepia:[{sepia:["",Qn,wr,br]}],"backdrop-filter":[{"backdrop-filter":["","none",wr,br]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[Qn,wr,br]}],"backdrop-contrast":[{"backdrop-contrast":[Qn,wr,br]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Qn,wr,br]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qn,wr,br]}],"backdrop-invert":[{"backdrop-invert":["",Qn,wr,br]}],"backdrop-opacity":[{"backdrop-opacity":[Qn,wr,br]}],"backdrop-saturate":[{"backdrop-saturate":[Qn,wr,br]}],"backdrop-sepia":[{"backdrop-sepia":["",Qn,wr,br]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",wr,br]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Qn,"initial",wr,br]}],ease:[{ease:["linear","initial",v,wr,br]}],delay:[{delay:[Qn,wr,br]}],animate:[{animate:["none",S,wr,br]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,wr,br]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:Se()}],"rotate-x":[{"rotate-x":Se()}],"rotate-y":[{"rotate-y":Se()}],"rotate-z":[{"rotate-z":Se()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:ne()}],"skew-x":[{"skew-x":ne()}],"skew-y":[{"skew-y":ne()}],transform:[{transform:[wr,br,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",wr,br]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",wr,br]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Qn,dC,Fx,APe]}],stroke:[{stroke:["none",...M()]}],"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"]}},_Kr=(e,{cacheSize:t,prefix:r,experimentalParseClassName:n,extend:s={},override:a={}})=>(QC(e,"cacheSize",t),QC(e,"prefix",r),QC(e,"experimentalParseClassName",n),CP(e.theme,a.theme),CP(e.classGroups,a.classGroups),CP(e.conflictingClassGroups,a.conflictingClassGroups),CP(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),QC(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),TP(e.theme,s.theme),TP(e.classGroups,s.classGroups),TP(e.conflictingClassGroups,s.conflictingClassGroups),TP(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),ppt(e,s,"orderSensitiveModifiers"),e),QC=(e,t,r)=>{r!==void 0&&(e[t]=r)},CP=(e,t)=>{if(t)for(const r in t)QC(e,r,t[r])},TP=(e,t)=>{if(t)for(const r in t)ppt(e,t,r)},ppt=(e,t,r)=>{const n=t[r];n!==void 0&&(e[r]=e[r]?e[r].concat(n):n)},CKr=(e,...t)=>typeof e=="function"?TPe(IPe,e,...t):TPe(()=>_Kr(IPe(),e),...t),TKr=Object.keys({...fze,...hjt}),AKr=Object.keys(xjt),DKr=Object.keys(mjt),NKr=Object.keys(gjt),IKr=Object.keys(fjt),Bx=Object.keys(vjt),jKr=Object.keys(yjt).concat(Object.keys(bjt)),RKr=CKr({extend:{theme:{color:TKr,spacing:AKr,radius:IKr,leading:NKr,shadow:jKr},classGroups:{"font-size":[{text:DKr}],h:[{h:Bx}],w:[{w:Bx}],size:[{size:Bx}],"min-h":[{"min-h":Bx}],"min-w":[{"min-w":Bx}],"max-h":[{"max-h":Bx}],"max-w":[{"max-w":Bx}]}}});function K(...e){return RKr(Ydt(e))}const oi={sm:"h-form-sm",md:"h-form-md",lg:"h-form-lg",default:"h-form-default"},sh="focus:outline-none focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",PKr="focus-within:outline-none focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",ij="rounded-md",$Kr={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"},ve=({children:e,className:t,size:r="default",...n})=>c.jsx("span",{className:K("block",$Kr[r],t),...n,children:e}),nc=Mjt,dn=Ljt,pn=Fjt,sn=E.forwardRef(({className:e,sideOffset:t=4,children:r,...n},s)=>c.jsx(Bjt,{children:c.jsxs(kze,{ref:s,sideOffset:t,className:K("z-50 overflow-hidden rounded-md bg-surface6 px-3 py-1.5 text-xs text-neutral4 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n,children:[r,c.jsx(zjt,{className:"fill-surface6"})]})}));sn.displayName=kze.displayName;const MKr={sm:`${oi.sm} w-form-sm`,md:`${oi.md} w-form-md`,lg:`${oi.lg} w-form-lg`,default:`${oi.default}`},LKr={sm:"sm",md:"default",lg:"lg",default:"default"},FKr={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"},BKr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",oa=Ee.forwardRef(({className:e,children:t,tooltip:r,size:n="md",variant:s="default",disabled:a,...i},o)=>c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx("button",{ref:o,disabled:a,"aria-label":typeof r=="string"?r:void 0,className:K(BKr,sh,FKr[s],MKr[n],a&&"active:scale-100",e),...i,children:c.jsx(ve,{size:LKr[n],children:t})})}),c.jsx(sn,{children:r})]}));oa.displayName="IconButton";const zKr={"ui-xs":"text-ui-xs leading-ui-xs","ui-sm":"text-ui-sm leading-ui-sm","ui-md":"text-ui-md leading-ui-md","ui-lg":"text-ui-lg leading-ui-lg","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"},UKr={mono:"font-mono"},ze=({as:e="p",className:t,variant:r="ui-md",font:n,...s})=>c.jsx(e,{className:K(zKr[r],n&&UKr[n],t),...s}),Wr={colors:"transition-colors duration-normal ease-out-custom",all:"transition-all duration-normal ease-out-custom",opacity:"transition-opacity duration-normal ease-out-custom",allSlow:"transition-all duration-slow ease-out-custom"},nx={visible:"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},VKr={sm:"h-avatar-sm w-avatar-sm",md:"h-avatar-md w-avatar-md",lg:"h-avatar-lg w-avatar-lg"},fpt=({src:e,name:t,size:r="sm",interactive:n=!1})=>c.jsx("div",{className:K(VKr[r],"border border-border1 bg-surface3 shrink-0 overflow-hidden rounded-full flex items-center justify-center",Wr.all,n&&"cursor-pointer hover:scale-105 hover:border-neutral2 hover:shadow-sm"),children:e?c.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):c.jsx(ze,{variant:"ui-md",className:"text-center text-neutral4",children:t[0].toUpperCase()})}),z6=({copiedDuration:e=1500}={})=>{const[t,r]=E.useState(!1);return{isCopied:t,copyToClipboard:s=>{s&&navigator.clipboard.writeText(s).then(()=>{r(!0),setTimeout(()=>r(!1),e)})}}},qKr=ezt({style:zie.coldarkDark,customStyle:{margin:0,backgroundColor:"black"}}),HKr=()=>c.jsx(b3t,{remarkPlugins:[$Ue],className:"aui-md",components:ZKr}),jPe=E.memo(HKr),QKr=({language:e,code:t})=>{const{isCopied:r,copyToClipboard:n}=z6(),s=()=>{!t||r||n(t)};return c.jsxs("div",{style:{background:"hsl(0 0% 100% / 0.06)",borderTopRightRadius:"0.5rem",borderTopLeftRadius:"0.5rem",marginTop:"0.5rem",border:"1px solid hsl(0 0% 20.4%)",borderBottom:"none"},className:"flex items-center justify-between gap-4 px-4 py-2 text-sm font-semibold text-white",children:[c.jsx("span",{className:"lowercase [&>span]:text-xs",children:e}),c.jsx(oa,{variant:"light",size:"md",tooltip:"Copy",onClick:s,children:c.jsxs("span",{className:"grid",children:[c.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",r?"scale-100":"scale-0"),children:c.jsx(ya,{size:14})},"checkmark"),c.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",r?"scale-0":"scale-100"),children:c.jsx(Ql,{size:14})},"copy")]})})]})},GKr=({alt:e,src:t,...r})=>{const[n,s]=E.useState(!1);return E.useEffect(()=>{s(!1)},[t]),n||!t?c.jsxs("div",{children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",width:"150",height:"150",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})}),c.jsx("p",{className:"text-xs italic text-neutral3 -mt-2.5 mb-2.5",children:"Image link is broken"})]}):c.jsx("img",{src:t,alt:e,...r,onError:()=>{s(!0)}})},ZKr=r3t({h1:({className:e,...t})=>c.jsx("h1",{className:K("mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",e),...t,style:{marginBottom:"2rem"}}),h2:({className:e,...t})=>c.jsx("h2",{className:K("mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"2rem"}}),h3:({className:e,...t})=>c.jsx("h3",{className:K("scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1.5rem"}}),h4:({className:e,...t})=>c.jsx("h4",{className:K("scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1.5rem"}}),h5:({className:e,...t})=>c.jsx("h5",{className:K("font-semibold first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1rem"}}),h6:({className:e,...t})=>c.jsx("h6",{className:K("font-semibold first:mt-0 last:mb-0",e),...t,style:{marginBottom:"1rem",marginTop:"1rem"}}),p:({className:e,...t})=>c.jsx("p",{className:K("leading-7 first:mt-0 last:mb-0",e),...t}),a:({className:e,...t})=>c.jsx("a",{className:K("text-neutral6 font-medium underline underline-offset-4",e),...t}),blockquote:({className:e,...t})=>c.jsx("blockquote",{className:K("border-l-2 pl-6 italic",e),...t}),ul:({className:e,...t})=>c.jsx("ul",{className:K("my-5 ml-6 list-disc [&>li]:mt-2",e),...t}),ol:({className:e,...t})=>c.jsx("ol",{className:K("my-5 ml-6 list-decimal [&>li]:mt-2",e),...t}),hr:({className:e,...t})=>c.jsx("hr",{className:K("my-5 border-b",e),...t}),table:({className:e,...t})=>c.jsx("table",{className:K("my-5 w-full border-separate border-spacing-0 overflow-y-auto",e),...t}),th:({className:e,...t})=>c.jsx("th",{className:K("bg-surface4 px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right",e),...t}),td:({className:e,...t})=>c.jsx("td",{className:K("border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right",e),...t}),tr:({className:e,...t})=>c.jsx("tr",{className:K("m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",e),...t}),sup:({className:e,...t})=>c.jsx("sup",{className:K("[&>a]:text-xs [&>a]:no-underline",e),...t}),pre:({className:e,...t})=>c.jsx("pre",{...t,style:{borderBottomRightRadius:"0.5rem",borderBottomLeftRadius:"0.5rem",background:"transparent",fontSize:"0.875rem",marginBottom:"0.5rem",border:"1px solid hsl(0 0% 20.4%)"},className:K("overflow-x-auto p-4 text-white",e)}),code:function({className:t,...r}){const n=uUe();return c.jsxs("pre",{style:{fontSize:"0.875rem",display:"inline"},children:[c.jsx("code",{className:K(!n&&"bg-surface4 rounded border font-semibold",t),...r,style:{fontWeight:"400",paddingBlock:n?0:"0.1em",paddingInline:n?0:"0.3em"}})," "]})},CodeHeader:QKr,SyntaxHighlighter:qKr,img:GKr}),WKr=({reason:e,tripwire:t})=>{const[r,n]=E.useState(!1),s=t&&(t.retry!==void 0||t.tripwirePayload||t.processorId);return c.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-950/20 overflow-hidden",children:[c.jsxs("div",{className:"flex items-start gap-3 p-4",children:[c.jsx(sI,{className:"w-5 h-5 text-amber-400 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-sm font-medium text-amber-200 mb-1",children:"Content Blocked"}),c.jsx("p",{className:"text-sm text-amber-300/90",children:e})]})]}),s&&c.jsxs(c.Fragment,{children:[c.jsxs("button",{onClick:()=>n(!r),className:"w-full flex items-center gap-2 px-4 py-2 text-xs text-amber-400/70 hover:text-amber-400 hover:bg-amber-900/20 transition-colors border-t border-amber-500/20",children:[r?c.jsx($a,{className:"w-3.5 h-3.5"}):c.jsx(Hi,{className:"w-3.5 h-3.5"}),c.jsx("span",{children:"Details"})]}),r&&c.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t border-amber-500/20 bg-amber-950/10",children:[t.retry!==void 0&&c.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[c.jsx(rI,{className:"w-3.5 h-3.5 text-amber-400/60"}),c.jsxs("span",{className:"text-xs text-amber-300/70",children:["Retry:"," ",t.retry?c.jsx("span",{className:"text-green-400",children:"Allowed"}):c.jsx("span",{className:"text-red-400",children:"Not allowed"})]})]}),t.processorId&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(mie,{className:"w-3.5 h-3.5 text-amber-400/60"}),c.jsxs("span",{className:"text-xs text-amber-300/70",children:["Processor:"," ",c.jsx("code",{className:"px-1.5 py-0.5 rounded bg-amber-900/30 text-amber-200 font-mono",children:t.processorId})]})]}),t.tripwirePayload!==void 0&&t.tripwirePayload!==null&&c.jsxs("div",{className:"pt-1",children:[c.jsx("p",{className:"text-xs text-amber-400/60 mb-1.5",children:"Metadata:"}),c.jsx("pre",{className:"text-xs text-amber-200/80 bg-amber-900/30 rounded p-2 overflow-x-auto font-mono",children:String(JSON.stringify(t.tripwirePayload,null,2))})]})]})]})]})},Mi=e=>c.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"})]}),hpt=e=>c.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"}),c.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"}),c.jsxs("g",{clipPath:"url(#clip0_21421_19519)",children:[c.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"}),c.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"})]}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_21421_19519",children:c.jsx("rect",{width:"62.7591",height:"62.7591",fill:"white",transform:"matrix(0.897148 0.441731 -0.897148 0.441731 63.1714 7.24365)"})})})]}),XKr=e=>c.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"})]}),$pe=e=>c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"})]}),Mpe=e=>c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"})]}),ai=e=>c.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),Lpe=e=>c.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:c.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"})}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_21999_22095",children:c.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),mpt=e=>c.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[c.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:"white"}),c.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:"white"}),c.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:"white"}),c.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:"white"})]}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_21999_20513",children:c.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),YKr=e=>c.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"}),c.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),c.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),c.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),gpt=e=>c.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),KKr=e=>c.jsx("svg",{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.jsx("path",{d:"M10.1266 5.67745C10.3409 5.0225 10.2695 4.2961 9.92413 3.70069C9.40017 2.78376 8.34034 2.31934 7.30433 2.53369C6.85182 2.02164 6.18496 1.73584 5.49428 1.73584C4.43445 1.73584 3.50561 2.41461 3.17218 3.4149C2.49342 3.55779 1.90992 3.97458 1.56458 4.5819C1.04062 5.49883 1.1597 6.64202 1.86228 7.42796C1.64793 8.09482 1.73129 8.80931 2.07663 9.40472C2.60059 10.3217 3.66042 10.798 4.69643 10.5717C5.16085 11.0838 5.8158 11.3815 6.50648 11.3815C7.56631 11.3815 8.49515 10.7027 8.82858 9.70243C9.50735 9.55953 10.0908 9.14274 10.4362 8.53542C10.9601 7.61849 10.8411 6.46339 10.1266 5.67745ZM6.50648 10.7503C6.07778 10.7503 5.67291 10.6074 5.35138 10.3336C5.36329 10.3217 5.39902 10.3097 5.41093 10.2978L7.32815 9.19037C7.42341 9.13083 7.48295 9.03557 7.48295 8.91648V6.21332L8.29271 6.67774C8.30462 6.67774 8.30462 6.68965 8.30462 6.70156V8.9403C8.31653 9.94059 7.50677 10.7503 6.50648 10.7503ZM2.62441 9.09511C2.41006 8.72595 2.33861 8.29726 2.41006 7.88047C2.42197 7.89238 2.44578 7.90429 2.4696 7.91619L4.38682 9.02366C4.48209 9.0832 4.60117 9.0832 4.69643 9.02366L7.04235 7.66612V8.60687C7.04235 8.61878 7.04235 8.63069 7.03044 8.63069L5.0894 9.75006C4.23201 10.2502 3.12455 9.9525 2.62441 9.09511ZM2.12426 4.90342C2.33861 4.53427 2.67204 4.26038 3.06501 4.10557V6.39195C3.06501 6.49912 3.12455 6.60629 3.21982 6.66583L5.56573 8.02337L4.75597 8.48779C4.74407 8.48779 4.73216 8.4997 4.73216 8.48779L2.79112 7.36842C1.90992 6.86827 1.62412 5.76081 2.12426 4.90342ZM8.79285 6.45149L6.44694 5.09395L7.2567 4.62953C7.2686 4.62953 7.28051 4.61762 7.28051 4.62953L9.22155 5.7489C10.0908 6.24905 10.3766 7.35651 9.8765 8.2139C9.66215 8.58305 9.32872 8.85694 8.93575 8.99984V6.72538C8.94766 6.6182 8.88812 6.51103 8.79285 6.45149ZM9.5907 5.23685C9.5788 5.22494 9.55498 5.21303 9.53116 5.20113L7.61394 4.09366C7.51868 4.03412 7.39959 4.03412 7.30433 4.09366L4.95841 5.4512V4.51045C4.95841 4.49854 4.95841 4.48663 4.97032 4.48663L6.91136 3.36726C7.78066 2.86712 8.87621 3.16482 9.37636 4.03412C9.5907 4.39137 9.66215 4.82006 9.5907 5.23685ZM4.51781 6.904L3.70805 6.43958C3.69615 6.43958 3.69615 6.42767 3.69615 6.41576V4.17702C3.69615 3.17673 4.5059 2.36697 5.50619 2.36697C5.93489 2.36697 6.33977 2.50987 6.66129 2.78376C6.64938 2.79567 6.62556 2.80758 6.60175 2.81949L4.68453 3.92695C4.58926 3.98649 4.52972 4.08176 4.52972 4.20084V6.904H4.51781ZM4.95841 5.95134L6.00634 5.34402L7.05426 5.95134V7.15407L6.00634 7.76139L4.95841 7.15407V5.95134Z",fill:"currentColor"})}),Fpe=e=>c.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),JKr=e=>c.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),tl=e=>c.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),_O=e=>c.jsx(ljt,{...e}),Yl=e=>c.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),eJr=e=>c.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"}),c.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"}),c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M74.9374 21.357C76.2127 20.7291 78.2804 20.7291 79.5557 21.357L90.8129 26.8997C92.0882 27.5276 92.0882 28.5458 90.8129 29.1737L83.1638 32.9399C81.8885 33.5678 79.8207 33.5678 78.5454 32.9399L75.8033 31.5898L68.3324 35.2682L64.1502 39.696C63.8908 39.481 63.6138 39.2568 63.3231 39.0227L63.1495 38.883C62.2893 38.1914 61.2677 37.3701 60.6254 36.6376C60.5446 36.5456 60.4618 36.4463 60.3812 36.3407C60.1669 36.3011 59.9652 36.2603 59.7782 36.2205C58.2906 35.9043 56.6225 35.4013 55.2179 34.9777L54.9342 34.8922C54.4589 34.7491 54.0034 34.6127 53.5666 34.4849L62.5594 32.4258L70.0304 28.7473L67.2882 27.3972C66.0129 26.7692 66.0129 25.7512 67.2882 25.1232L74.9374 21.357ZM53.5666 34.4849C53.5666 34.4849 53.5666 34.4849 53.5666 34.4849L46.1603 36.1808L47.516 36.8483C48.7913 37.4762 48.7912 38.4943 47.516 39.1222L39.8668 42.8884C38.5916 43.5163 36.5238 43.5164 35.2485 42.8884L23.9913 37.3457C22.7159 36.7177 22.716 35.6996 23.9913 35.0717L31.6404 31.3055C32.9156 30.6776 34.9834 30.6776 36.2587 31.3055L38.5358 32.4267C39.6899 31.9483 40.9309 31.4611 42.153 31.0313C43.6354 30.5099 45.4001 29.9605 47.091 29.683C49.7278 29.2502 52.3729 29.7072 53.9892 30.0537C55.8019 30.4425 57.6745 31.0055 59.1934 31.4628C60.6081 31.8887 61.6949 32.2154 62.5594 32.4258L53.5666 34.4849ZM46.1603 36.1808L53.5666 34.4849C52.5189 34.1784 51.5786 33.9213 50.7293 33.7392C49.9958 33.5819 49.6114 33.5441 49.4794 33.5326C48.964 33.6384 48.0924 33.8823 46.8983 34.3023C46.0703 34.5936 45.1981 34.9293 44.3325 35.2808L46.1603 36.1808ZM64.1502 39.696L68.3324 35.2682C68.7598 35.6939 69.4232 36.229 70.2883 36.9256C71.2171 37.6735 72.3605 38.5954 73.15 39.488C73.8539 40.2838 74.7818 41.5862 73.9029 42.8844C73.3394 43.717 72.2235 44.5859 71.1648 45.3159C70.2916 45.9175 69.3021 46.5286 68.3305 47.0968L70.6077 48.218C71.8829 48.8459 71.8829 49.864 70.6077 50.4919L62.9585 54.2582C61.6833 54.8861 59.6154 54.8861 58.3402 54.2582L47.083 48.7154C45.8077 48.0875 45.8077 47.0694 47.083 46.4415L54.7321 42.6752C56.0074 42.0474 58.0751 42.0473 59.3505 42.6752L60.7062 43.3428L64.1502 39.696ZM64.1502 39.696L60.7062 43.3428L62.5339 44.2427C63.2478 43.8165 63.9298 43.3871 64.5213 42.9794C65.3742 42.3914 65.8695 41.9622 66.0846 41.7085C66.0613 41.6436 65.9844 41.4543 65.6649 41.0931C65.295 40.6749 64.773 40.212 64.1502 39.696Z",fill:"#A9A9A9"})]}),Gf=e=>c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.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"}),c.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"})]}),tJr=e=>c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:c.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"})}),rJr=e=>c.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.jsx("path",{d:"M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641V49.8368C6.67773 65.0327 31.894 77.3514 62.9998 77.3514C94.1055 77.3514 119.322 65.0327 119.322 49.8368V35.1641Z",fill:"#2E2E2E",fillOpacity:"0.9"}),c.jsx("path",{d:"M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641M119.322 35.1641C119.322 19.9681 94.1055 7.64941 62.9998 7.64941C31.894 7.64941 6.67773 19.9681 6.67773 35.1641M119.322 35.1641V49.8368C119.322 65.0327 94.1055 77.3514 62.9998 77.3514C31.894 77.3514 6.67773 65.0327 6.67773 49.8368V35.1641",stroke:"#424242"}),c.jsx("path",{d:"M63.0002 0.96875C28.5152 0.96875 0.55957 15.6489 0.55957 33.7578V51.2433C0.55957 69.3522 28.5152 84.0323 63.0002 84.0323C97.4853 84.0323 125.441 69.3522 125.441 51.2433V33.7578C125.441 15.6489 97.4853 0.96875 63.0002 0.96875Z",stroke:"#707070"}),c.jsx("path",{d:"M51.5215 39.9726C50.5464 40.4477 48.9738 40.4435 48.009 39.9634C47.0442 39.4833 47.0526 38.709 48.0277 38.2339L69.7191 27.6672C72.7243 26.2032 72.7347 23.8181 69.7605 22.3476L69.6898 22.313C66.6927 20.8686 61.8895 20.8864 58.9368 22.3528L30.3946 36.5278C29.4288 37.0074 27.8561 37.0107 26.882 36.5352C25.9078 36.0597 25.901 35.2853 26.8668 34.8057L55.4092 20.6308C60.2847 18.2094 68.2157 18.1801 73.1645 20.5651L73.2814 20.6222C76.1808 22.0558 77.3624 24.0157 76.8227 25.8782C80.6339 25.5828 84.6694 26.1476 87.6364 27.5775C92.6525 29.9949 92.7059 33.962 87.7554 36.4119L61.5441 49.3836C61.282 49.5133 61.281 49.7227 61.5417 49.853L67.0252 52.5932C67.988 53.0743 67.9763 53.8486 66.9992 54.3226C66.0221 54.7966 64.4495 54.7909 63.4867 54.3098L58.0033 51.5695C55.8306 50.4838 55.8392 48.7391 58.0226 47.6585L84.2339 34.6868C87.2382 33.2 87.2058 30.7925 84.1617 29.3254C81.1488 27.8734 76.1811 27.9317 73.2127 29.4058L51.5215 39.9726Z",fill:"#A9A9A9"}),c.jsx("path",{d:"M63.0028 23.8809C64.0019 23.4098 65.5873 23.4146 66.5747 23.8972C67.562 24.3798 67.5831 25.1603 66.6338 25.6556L66.5879 25.679L45.1511 36.3113C42.2204 37.7649 42.2292 40.1117 45.1707 41.56C48.1228 43.0135 52.91 43.0118 55.8578 41.5563L76.8564 31.1875L76.9037 31.1648C77.9049 30.6949 79.4903 30.7013 80.4755 31.185C81.4763 31.6764 81.4785 32.4741 80.4806 32.9669L59.4821 43.3356C54.5363 45.7777 46.5044 45.7806 41.5516 43.342C36.6166 40.9121 36.602 36.9747 41.519 34.5359L62.9558 23.9037L63.0028 23.8809Z",fill:"#A9A9A9"})]}),nJr=e=>c.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[c.jsx("path",{d:"M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641V49.8368C6.67773 65.0327 31.894 77.3514 62.9998 77.3514C94.1055 77.3514 119.322 65.0327 119.322 49.8368V35.1641Z",fill:"#2E2E2E",fillOpacity:"0.9"}),c.jsx("path",{d:"M119.322 35.1641C119.322 50.36 94.1055 62.6787 62.9998 62.6787C31.894 62.6787 6.67773 50.36 6.67773 35.1641M119.322 35.1641C119.322 19.9681 94.1055 7.64941 62.9998 7.64941C31.894 7.64941 6.67773 19.9681 6.67773 35.1641M119.322 35.1641V49.8368C119.322 65.0327 94.1055 77.3514 62.9998 77.3514C31.894 77.3514 6.67773 65.0327 6.67773 49.8368V35.1641",stroke:"#424242"}),c.jsx("path",{d:"M63.0002 0.96875C28.5152 0.96875 0.55957 15.6489 0.55957 33.7578V51.2433C0.55957 69.3522 28.5152 84.0323 63.0002 84.0323C97.4853 84.0323 125.441 69.3522 125.441 51.2433V33.7578C125.441 15.6489 97.4853 0.96875 63.0002 0.96875Z",stroke:"#707070"}),c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M95.8997 32.6647C98.4806 33.9355 98.4744 36.0012 95.8997 37.2689L89.6657 40.3384C87.0848 41.6091 82.8892 41.6061 80.3146 40.3384L74.0805 37.2689C71.4996 35.9981 71.5059 33.9324 74.0805 32.6647L80.3146 29.5952C82.8955 28.3244 87.091 28.3275 89.6657 29.5952L95.8997 32.6647ZM74.0805 21.9215C76.6614 23.1923 76.6552 25.258 74.0805 26.5257L67.8465 29.5952C65.2656 30.866 61.0701 30.8629 58.4954 29.5952L52.2613 26.5257C49.6804 25.255 49.6867 23.1892 52.2613 21.9215L58.4954 18.852C61.0763 17.5813 65.2718 17.5843 67.8465 18.852L74.0805 21.9215ZM74.0805 43.4079C76.6614 44.6786 76.6552 46.7444 74.0805 48.0121L67.8465 51.0816C65.2656 52.3523 61.0701 52.3493 58.4954 51.0816L52.2613 48.0121C49.6804 46.7413 49.6867 44.6756 52.2613 43.4079L58.4954 40.3384C61.0763 39.0676 65.2718 39.0707 67.8465 40.3384L74.0805 43.4079ZM52.2613 32.6647C54.8422 33.9355 54.836 36.0012 52.2613 37.2689L46.0273 40.3384C43.4464 41.6091 39.2509 41.6061 36.6762 40.3384L30.4422 37.2689C27.8613 35.9981 27.8675 33.9324 30.4422 32.6647L36.6762 29.5952C39.2571 28.3244 43.4526 28.3275 46.0273 29.5952L52.2613 32.6647Z",fill:"#A9A9A9"})]});function D0(e){return c.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:[c.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),c.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),c.jsx("path",{d:"M15 2v2"}),c.jsx("path",{d:"M15 20v2"}),c.jsx("path",{d:"M2 15h2"}),c.jsx("path",{d:"M2 9h2"}),c.jsx("path",{d:"M20 15h2"}),c.jsx("path",{d:"M20 9h2"}),c.jsx("path",{d:"M9 2v2"}),c.jsx("path",{d:"M9 20v2"})]})}const sJr={warning:"bg-accent6Darker border-accent6/30 text-accent6",destructive:"bg-accent2Darker border-accent2/30 text-accent2",info:"bg-accent5Darker border-accent5/30 text-accent5"},aJr={warning:Pc,destructive:Xh,info:Ac},Cp=({children:e,variant:t="destructive",className:r})=>{const n=aJr[t];return c.jsx("div",{className:K(sJr[t],"p-3 rounded-md border shadow-sm",Wr.all,"animate-in fade-in-0 slide-in-from-top-2 duration-200",r),children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(ve,{className:"mt-0.5 flex-shrink-0",children:c.jsx(n,{})}),c.jsx("div",{className:"text-neutral4",children:e})]})})},Tp=({children:e,as:t="h5"})=>c.jsx(ze,{as:t,variant:"ui-md",className:"font-semibold",children:e}),sy=({children:e,as:t="p"})=>c.jsx(ze,{as:t,variant:"ui-sm",children:e}),iJr={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"},oJr={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},Ft=({icon:e,variant:t="default",className:r,children:n,...s})=>c.jsxs("div",{className:K("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",Wr.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":iJr[t],r),...s,children:[e&&c.jsx("span",{className:oJr[t],children:c.jsx(ve,{children:e})}),n]}),lJr=()=>{const e=jn(({part:i})=>i),[t,r]=E.useState(!1),n=e.text||"",s=e.metadata||{};if(s?.status==="tripwire")return c.jsx(WKr,{reason:n,tripwire:s.tripwire});if(s?.status==="warning")return c.jsxs(Cp,{variant:"warning",children:[c.jsx(Tp,{as:"h5",children:"Warning"}),c.jsx(sy,{as:"p",children:n})]});if(s?.status==="error")return c.jsxs(Cp,{variant:"destructive",children:[c.jsx(Tp,{as:"h5",children:"Error"}),c.jsx(sy,{as:"p",children:n})]});const a=s?.completionResult;if(a)return c.jsxs("div",{className:"mb-2 space-y-2",children:[c.jsxs("button",{onClick:()=>r(i=>!i),className:"flex items-center gap-2",children:[c.jsx(ve,{children:c.jsx(D1,{className:K("transition-all",t?"rotate-90":"rotate-180")})}),c.jsxs(Ft,{variant:"info",icon:c.jsx(QBe,{}),children:[t?"Show":"Hide"," completion check"]})]}),!t&&c.jsxs(Cp,{variant:"info",children:[c.jsx(Tp,{as:"h5",children:a?.passed?"Complete":"Not Complete"}),c.jsx(jPe,{})]})]});try{const i=n.trim();if(i.startsWith("__ERROR__:")){const o=i.substring(10);return c.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[c.jsx(Xh,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),c.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:o})]})]})}else if(i.startsWith("Error:")){const o=i.substring(6).trim();return c.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[c.jsx(Xh,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),c.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:o})]})]})}return c.jsx(jPe,{})}catch{return c.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50",children:[c.jsx(Xh,{className:"w-5 h-5 text-red-500 dark:text-red-400 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200 mb-1",children:"Error"}),c.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:String(n)})]})]})}},Wu="mastra_workspace",Ch={FILESYSTEM:{READ_FILE:`${Wu}_read_file`,WRITE_FILE:`${Wu}_write_file`,EDIT_FILE:`${Wu}_edit_file`,LIST_FILES:`${Wu}_list_files`,DELETE:`${Wu}_delete`,FILE_STAT:`${Wu}_file_stat`,MKDIR:`${Wu}_mkdir`},SANDBOX:{EXECUTE_COMMAND:`${Wu}_execute_command`,GET_PROCESS_OUTPUT:`${Wu}_get_process_output`,KILL_PROCESS:`${Wu}_kill_process`},SEARCH:{SEARCH:`${Wu}_search`,INDEX:`${Wu}_index`}},cJr={duration:5e3,cancel:{label:c.jsx(ve,{children:c.jsx(Os,{})}),onClick:()=>{}},unstyled:!0,classNames:{toast:"bg-surface3 w-full h-auto rounded-lg gap-2 border border-border1 px-3 py-2 flex items-center justify-between pointer-events-auto shadow-card [&>[data-content]]:flex-1",title:"text-xs font-medium text-neutral5",description:"text-xs text-neutral3",cancelButton:"!bg-transparent hover:!bg-surface2 !border-none !rounded-md !p-1.5 !m-0 !text-neutral3 hover:!text-neutral6 shrink-0 transition-all",actionButton:"!bg-white flex items-center justify-center font-medium !text-black order-last hover:opacity-80"}};function bd(e){const{classNames:t,...r}=cJr,{classNames:n,...s}=e||{};return{...r,classNames:{...t,title:K(t?.title,n?.title),toast:K(t?.toast,n?.toast),cancelButton:K(t?.cancelButton,n?.cancelButton),actionButton:K(t?.actionButton,n?.actionButton),description:K(t?.description,n?.description)},...s}}const Xe=(e,t={})=>{if(Array.isArray(e))return e.forEach(r=>Vl(r,bd(t)));if(Ee.isValidElement(e))return Vl(e,bd(t));if(typeof e=="string")return Vl(e,bd(t));throw new Error("Invalid message type")};Xe.success=(e,t={})=>{const r={...t,icon:c.jsx(ve,{className:"text-accent1 shrink-0",children:c.jsx(GBe,{})}),classNames:{...t.classNames,toast:K("bg-accent1Darker border-accent1/30 border-l-[3px] border-l-accent1",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Vl.success(e,bd(r));case"object":return e.forEach(n=>Vl.success(n,bd(r)))}};Xe.error=(e,t={})=>{const r={...t,icon:c.jsx(ve,{className:"text-accent2 shrink-0",children:c.jsx(uA,{})}),classNames:{...t.classNames,toast:K("bg-accent2Darker border-accent2/30 border-l-[3px] border-l-accent2",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Vl.error(e,bd(r));case"object":return e.forEach(n=>Vl.error(n,bd(r)))}};Xe.warning=(e,t={})=>{const r={...t,icon:c.jsx(ve,{className:"text-accent6 shrink-0",children:c.jsx(Xh,{})}),classNames:{...t.classNames,toast:K("bg-accent6Darker border-accent6/30 border-l-[3px] border-l-accent6",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Vl.warning(e,bd(r));case"object":return e.forEach(n=>Vl.warning(n,bd(r)))}};Xe.info=(e,t={})=>{const r={...t,icon:c.jsx(ve,{className:"text-accent3 shrink-0",children:c.jsx(Ac,{})}),classNames:{...t.classNames,toast:K("bg-accent3Darker border-accent3/30 border-l-[3px] border-l-accent3",t.classNames?.toast),title:K("text-xs text-neutral5",t.classNames?.title),description:K("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Vl.info(e,bd(r));case"object":return e.forEach(n=>Vl.info(n,bd(r)))}};Xe.custom=(e,t={})=>Vl(e,bd(t));Xe.dismiss=e=>{e&&Vl.dismiss(e)};Xe.promise=({myPromise:e,loadingMessage:t,successMessage:r,errorMessage:n,onSuccess:s,onError:a,options:i={}})=>Vl.promise(e,{loading:t??"Loading...",success:o=>(s?.(o),r),error:o=>(a?.(o),n||o?.message||"Error..."),...bd(i)});function Zf({text:e,copyMessage:t="Copied to clipboard!"}){const[r,n]=E.useState(!1),s=E.useRef(null),a=E.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{Xe.success(t),n(!0),s.current&&(clearTimeout(s.current),s.current=null),s.current=setTimeout(()=>{n(!1)},2e3)}).catch(()=>{Xe.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:r,handleCopy:a}}const ypt={sm:`${oi.sm} gap-1 text-ui-sm`,md:`${oi.md} gap-1`,lg:`${oi.lg} gap-2`,default:`${oi.default} text-ui-md`,large:`${oi.lg} text-ui-lg`},bpt={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",cta:"bg-white/20 border-2 border-transparent hover:text-white hover:bg-white/25 disabled:opacity-50 disabled:cursor-not-allowed active:bg-white/30 text-neutral5",standard:"bg-white/10 border-2 border-transparent hover:text-white hover:bg-white/15 disabled:opacity-50 disabled:cursor-not-allowed active:bg-white/20 text-neutral4"},vpt="border border-border1 px-2 text-ui-md inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",uJr=K("flex items-center justify-center rounded-lg gap-[.75em] px-[1em] leading-0 transition-colors duration-200 ease-out-custom","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:opacity-50 [&>svg]:mx-[-.25em]","[&:hover>svg]:opacity-100"),dJr="focus-visible:outline-none focus-visible:border-accent1/50";function U6(e){const t=e?.variant||"default",r=e?.size||"md";return K(vpt,sh,bpt[t],ypt[r])}const ye=Ee.forwardRef(({className:e,as:t,size:r="md",variant:n="default",disabled:s,...a},i)=>{const o=t||"button",l=["cta","standard"].includes(n);return c.jsx(o,{ref:i,disabled:s,className:K(l?uJr:vpt,l?dJr:sh,bpt[n],ypt[r],s&&"active:scale-100",e),...a})});ye.displayName="Button";const nN=Ee.forwardRef(({tooltipContent:e,...t},r)=>c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx(ye,{ref:r,...t})}),e&&c.jsx(sn,{children:e})]}));nN.displayName="ButtonWithTooltip";function ql({content:e,copyMessage:t,tooltip:r="Copy to clipboard",iconSize:n="default",className:s,size:a="sm"}){const[i,o]=E.useState(!1),{handleCopy:l}=Zf({text:e,copyMessage:t}),u=()=>{l(),o(!0),setTimeout(()=>o(!1),2e3)};return c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx(ye,{onClick:u,type:"button",size:a,variant:"standard",children:i?c.jsx(ya,{}):c.jsx(Ql,{})})}),c.jsx(sn,{children:i?"Copied!":r})]})}const pJr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,fJr=rr.mark({class:"cm-variable-highlight"}),RPe=new Iqe({regexp:pJr,decoration:()=>fJr}),hJr=xi.fromClass(class{decorations;constructor(e){this.decorations=RPe.createDeco(e)}update(e){this.decorations=RPe.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),mJr=hJr;function gJr(e,t=5){if(!e?.properties)return[];const r=[];function n(s,a,i){if(i>t)return;const o=Array.isArray(s.type)?s.type.join(" | "):s.type;if(r.push({path:a,label:a,description:s.description??s.title,type:o}),s.properties)for(const[l,u]of Object.entries(s.properties))n(u,`${a}.${l}`,i+1);if(s.items?.properties)for(const[l,u]of Object.entries(s.items.properties))n(u,`${a}[].${l}`,i+1)}for(const[s,a]of Object.entries(e.properties))n(a,s,1);return r}function yJr(e){const t=gJr(e);return gHe({override:[bJr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function bJr(e){return t=>{const n=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!n)return null;const s=n[1]??"",a=t.pos-s.length,i=s?e.filter(l=>l.path.toLowerCase().startsWith(s.toLowerCase())):e;if(i.length===0)return null;const o=i.map(l=>({label:l.path,displayLabel:l.path,detail:l.type,info:l.description,apply:(u,d,p,f)=>{const g=u.state.sliceDoc(f,f+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:p,to:f,insert:g},selection:{anchor:p+g.length}})}}));return{from:a,options:o,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const sx=()=>E.useMemo(()=>{const e=ZL({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#939393",background:"transparent"},styles:[{tag:[re.className,re.propertyName]},{tag:re.heading,color:"#ff79c6",fontWeight:"bold"},{tag:[re.heading1,re.heading2,re.heading3,re.heading4,re.heading5,re.heading6],color:"#ff79c6",fontWeight:"bold"},{tag:re.emphasis,fontStyle:"italic",color:"#f8f8f2"},{tag:re.strong,fontWeight:"bold",color:"#f8f8f2"},{tag:re.link,color:"#8be9fd",textDecoration:"underline"},{tag:re.url,color:"#8be9fd"},{tag:re.monospace,color:"#f1fa8c"},{tag:re.strikethrough,textDecoration:"line-through"},{tag:re.quote,fontStyle:"italic",color:"#6272a4"}]}),t=ht.theme({".cm-editor":{colorScheme:"dark",backgroundColor:"transparent"},".cm-lineNumbers .cm-gutterElement":{color:"#939393"},".cm-tooltip-autocomplete":{backgroundColor:"#282a36",border:"1px solid #44475a",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.4)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"#f8f8f2"},".cm-completionDetail":{color:"#A1A1AA",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"#282a36",border:"1px solid #44475a",color:"#6272a4",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"#44475a",color:"#f8f8f2"},".cm-line .cm-variable-highlight":{color:"#F59E0B !important",fontWeight:"500"}});return[e,t]},[]),Wa=E.forwardRef(({data:e,value:t,onChange:r,showCopyButton:n=!0,className:s,language:a="json",highlightVariables:i=!1,placeholder:o,wordWrap:l=!1,schema:u,autoFocus:d,...p},f)=>{const h=sx(),m=e?JSON.stringify(e,null,2):t??"",g=E.useMemo(()=>{const b=[];return a==="json"?b.push(hd):a==="markdown"&&(b.push(Koe({base:X0,codeLanguages:LQe})),b.push(ht.lineWrapping)),i&&a==="markdown"&&b.push(mJr),u&&a==="markdown"&&b.push(yJr(u)),b},[a,i,u]);return c.jsxs("div",{className:K("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",s),...p,children:[n&&c.jsx(ql,{content:m,className:"absolute top-2 right-2 z-20"}),c.jsx(Sd,{ref:f,value:m,theme:h,extensions:g,onChange:r,"aria-label":"Code editor",placeholder:o,height:"100%",style:{height:"100%"},autoFocus:d})]})});async function vJr(e,t){const{codeToTokens:r,bundledLanguages:n}=await Ge(async()=>{const{codeToTokens:a,bundledLanguages:i}=await import("./index-CJLcspbn.js");return{codeToTokens:a,bundledLanguages:i}},__vite__mapDeps([26,1]),import.meta.url);if(!(t in n))return null;const{tokens:s}=await r(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return s}const V6=({children:e,initialCollapsed:t=!0,icon:r,title:n,collapsible:s=!0,extraInfo:a,"data-testid":i})=>{const[o,l]=E.useState(t);return E.useEffect(()=>{l(t)},[t]),c.jsxs("div",{className:"mb-4","data-testid":i,children:[c.jsxs("div",{className:"flex flex-row gap-2 items-center justify-between",children:[c.jsxs("button",{onClick:s?()=>l(u=>!u):void 0,className:"flex items-center gap-2 disabled:cursor-not-allowed",disabled:!s,type:"button",children:[c.jsx(ve,{children:c.jsx(D1,{className:K("transition-all",o?"rotate-90":"rotate-180")})}),c.jsx(Ft,{icon:r,children:n})]}),a]}),!o&&c.jsx("div",{className:"pt-2",children:c.jsx("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:e})})]})},ea=eF,xpt=ZGe,xJr=tF,Spt=E.forwardRef(({className:e,...t},r)=>c.jsx(bI,{ref:r,className:K("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}));Spt.displayName=bI.displayName;const Ls=E.forwardRef(({className:e,children:t,...r},n)=>c.jsxs(xJr,{children:[c.jsx(Spt,{}),c.jsxs(vI,{ref:n,className:K("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...r,children:[t,c.jsxs(sF,{className:K("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-none focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","disabled:pointer-events-none"),children:[c.jsx(Os,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ls.displayName=vI.displayName;const ta=({className:e,...t})=>c.jsx("div",{className:K("flex flex-col space-y-1.5 text-center sm:text-left border-b border-border1 pb-4 px-6",e),...t});ta.displayName="DialogHeader";const q6=({className:e,...t})=>c.jsx("div",{className:K("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});q6.displayName="DialogFooter";const ra=({className:e,...t})=>c.jsx("div",{className:K("overflow-y-auto px-6 max-h-[50vh]",e),...t});ra.displayName="DialogBody";const Fs=E.forwardRef(({className:e,...t},r)=>c.jsx(rF,{ref:r,className:K("text-ui-md font-medium",e),...t}));Fs.displayName=rF.displayName;const ni=E.forwardRef(({className:e,...t},r)=>c.jsx(nF,{ref:r,className:K("sr-only",e),...t}));ni.displayName=nF.displayName;const SJr=({selectionReason:e,open:t,onOpenChange:r,input:n})=>{let s=null;if(n)try{s=typeof n=="object"?c.jsx(Wa,{data:n}):c.jsx(Wa,{data:JSON.parse(n)})}catch{s=c.jsx("pre",{className:"whitespace-pre-wrap",children:n})}return c.jsx(ea,{open:t,onOpenChange:r,children:c.jsxs(Ls,{children:[c.jsxs(ta,{children:[c.jsx(Fs,{children:"Agent Network Metadata"}),c.jsx(ni,{children:"View the metadata of the agent's network choice."})]}),c.jsxs(ra,{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(ze,{className:"text-neutral3",children:"Selection Reason"}),c.jsx("div",{className:"text-neutral6 text-ui-md",children:e})]}),s&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(ze,{className:"text-neutral3",children:"Input"}),c.jsx("div",{className:"text-neutral6 text-ui-md",children:s})]})]})]})})},Bpe=({selectionReason:e,input:t})=>{const[r,n]=E.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsx(oa,{variant:"light",size:"md",tooltip:"Show selection reason",onClick:()=>n(s=>!s),children:c.jsx(LIt,{className:"text-neutral3 size-5"})}),c.jsx(SJr,{selectionReason:e||"",open:r,onOpenChange:n,input:t})]})},wpt=E.createContext(void 0);function wJr({children:e,approveToolcall:t,declineToolcall:r,approveToolcallGenerate:n,declineToolcallGenerate:s,approveNetworkToolcall:a,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:l,networkToolCallApprovals:u}){return c.jsx(wpt.Provider,{value:{approveToolcall:t,declineToolcall:r,approveToolcallGenerate:n,declineToolcallGenerate:s,approveNetworkToolcall:a,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:l,networkToolCallApprovals:u},children:e})}function EJr(){const e=E.useContext(wpt);if(!e)throw new Error("useToolCall must be used within a ToolCallProvider");return e}const oj=({toolCalled:e,toolCallId:t,toolApprovalMetadata:r,toolName:n,isNetwork:s,isGenerateMode:a})=>{const{approveToolcall:i,declineToolcall:o,approveToolcallGenerate:l,declineToolcallGenerate:u,isRunning:d,toolCallApprovals:p,approveNetworkToolcall:f,declineNetworkToolcall:h,networkToolCallApprovals:m}=EJr(),g=()=>{s?f(n,r?.runId):a?l(t):i(t)},b=()=>{s?h(n,r?.runId):a?u(t):o(t)},v=s?m?.[r?.runId?`${r.runId}-${n}`:n]?.status:p?.[t]?.status;return r&&!e?c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Approval required"}),c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsxs(ye,{onClick:g,disabled:d||!!v,className:v==="approved"?"!text-accent1":"",children:[c.jsx(ve,{children:c.jsx(ya,{})}),"Approve"]}),c.jsxs(ye,{onClick:b,disabled:d||!!v,className:v==="declined"?"!text-accent2":"",children:[c.jsx(ve,{children:c.jsx(Os,{})}),"Decline"]})]})]}):null},kJr=({toolName:e,args:t,result:r,metadata:n,toolOutput:s,toolCallId:a,toolApprovalMetadata:i,suspendPayload:o,isNetwork:l,toolCalled:u})=>{let d=null;try{const{__mastraMetadata:b,...v}=typeof t=="object"?t:JSON.parse(t);d=c.jsx(Wa,{data:v,"data-testid":"tool-args"})}catch{d=c.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:t})}let p=typeof r=="string"?c.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:r}):c.jsx(Wa,{data:r,"data-testid":"tool-result"}),f=typeof o=="string"?c.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:o}):c.jsx(Wa,{data:o,"data-testid":"tool-suspend-payload"});const h=n?.mode==="network"?n.selectionReason:void 0,m=n?.mode==="network"?n.agentInput:void 0,g=u??(r||s.length>0);return c.jsx(V6,{"data-testid":"tool-badge",icon:c.jsx(tl,{className:"text-accent6"}),title:e,extraInfo:n?.mode==="network"&&c.jsx(Bpe,{selectionReason:h||"",input:m}),initialCollapsed:!(i??o),children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Tool arguments"}),d]}),f!==void 0&&o&&c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Tool suspend payload"}),f]}),p!==void 0&&r&&c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Tool result"}),p]}),s.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Tool output"}),c.jsx("div",{className:"h-40 overflow-y-auto",children:c.jsx(Wa,{data:s,"data-testid":"tool-output"})})]}),c.jsx(oj,{toolCalled:g,toolCallId:a,toolApprovalMetadata:i,toolName:e,isNetwork:l,isGenerateMode:n?.mode==="generate"})]})})},Ept=E.createContext({Link:E.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:()=>""}}),OJr=({children:e,Link:t,navigate:r,paths:n})=>c.jsx(Ept.Provider,{value:{Link:t,navigate:r,paths:n},children:e}),Yt=()=>{const e=E.useContext(Ept);if(!e)throw new Error("useLinkComponent must be used within a LinkComponentProvider");return e},_Jr=e=>{switch(e){case"running":return"bg-green-500";case"starting":case"initializing":return"bg-yellow-500";case"stopped":case"paused":return"bg-gray-500";case"error":case"failed":return"bg-red-500";default:return"bg-accent6"}},CJr=(e,t)=>{const[r,n]=E.useState(0),s=E.useRef(null);return E.useEffect(()=>{if(e){n(0),s.current=t||Date.now();const a=setInterval(()=>{s.current&&n(Date.now()-s.current)},100);return()=>clearInterval(a)}else s.current=null},[e,t]),r},TJr=({command:e,content:t,maxHeight:r="20rem",onCopy:n,isCopied:s})=>{const a=E.useRef(null);return E.useEffect(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[t]),c.jsxs("div",{className:"rounded-md border border-border1 overflow-hidden",children:[e&&c.jsxs("div",{className:"px-3 py-2 bg-surface3 border-b border-border1 flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("span",{className:"text-neutral6 text-xs shrink-0",children:"$"}),c.jsx("code",{className:"text-xs text-neutral-300 font-mono truncate",children:e})]}),n&&c.jsx(oa,{variant:"light",size:"sm",tooltip:"Copy output",onClick:n,className:"shrink-0",children:c.jsxs("span",{className:"grid",children:[c.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",s?"scale-100":"scale-0"),children:c.jsx(ya,{size:14})}),c.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",s?"scale-0":"scale-100"),children:c.jsx(Ql,{size:14})})]})})]}),c.jsx("pre",{ref:a,style:{maxHeight:r},className:"overflow-x-auto overflow-y-auto p-3 text-sm text-neutral-300 font-mono whitespace-pre-wrap bg-black",children:t||c.jsx("span",{className:"text-neutral6 italic",children:"No output"})})]})},AJr=({toolName:e,args:t,result:r,metadata:n,toolCallId:s,toolApprovalMetadata:a,isNetwork:i,toolCalled:o})=>{const l=jn(G=>G.message),u=E.useMemo(()=>l.content.filter(M=>M.type==="data"),[l.content]),[d,p]=E.useState(!1),{isCopied:f,copyToClipboard:h}=z6(),{Link:m}=Yt(),g=u.find(G=>G.name==="sandbox-command"&&G.data?.toolCallId===s);let b="";try{const G=typeof t=="object"?t:JSON.parse(t);e===Ch.SANDBOX.EXECUTE_COMMAND?b=G.command||"":(e===Ch.SANDBOX.GET_PROCESS_OUTPUT||e===Ch.SANDBOX.KILL_PROCESS)&&(b=g?.data?.command||`PID ${G.pid}`)}catch{b=e}const v=u.filter(G=>(G.name==="sandbox-stdout"||G.name==="sandbox-stderr")&&G.data?.toolCallId===s),S=u.find(G=>G.name==="workspace-metadata"&&G.data?.toolCallId===s),w=S?.data,k=u.find(G=>G.name==="sandbox-exit"&&G.data?.toolCallId===s),_=!!k||typeof r=="string",C=!!S,T=C&&!_,A=o??(_||C),N=k?.data?.exitCode,I=k?.data?.success,R=k?.data?.executionTimeMs,$=k?.data?.killed,F=v.map(G=>G.data?.output||"").join(""),L=typeof r=="string"?r:F,z=e===Ch.SANDBOX.EXECUTE_COMMAND?"Execute Command":e===Ch.SANDBOX.GET_PROCESS_OUTPUT?"Get Process Output":e===Ch.SANDBOX.KILL_PROCESS?"Kill Process":e,q=v[0]?.data?.timestamp,H=CJr(T,q),V=()=>{!L||f||h(L)};return c.jsxs("div",{className:"mb-4","data-testid":"sandbox-execution-badge",children:[c.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[c.jsxs("button",{onClick:()=>p(G=>!G),className:"flex items-center gap-2 min-w-0",type:"button",children:[c.jsx(ve,{children:c.jsx(D1,{className:K("transition-all",d?"rotate-90":"rotate-180")})}),c.jsx(Ft,{icon:c.jsx(HIt,{className:"text-accent6",size:16}),children:z}),w?.sandbox&&c.jsxs(m,{href:w.id?`/workspaces/${w.id}`:"/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",onClick:G=>G.stopPropagation(),children:[c.jsx("span",{className:K("w-1.5 h-1.5 rounded-full",_Jr(w.sandbox.status))}),c.jsx("span",{children:w.sandbox.name||w.sandbox.provider})]})]}),c.jsx("div",{className:"flex items-center gap-2",children:T?c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-accent6",children:[c.jsx("span",{className:"w-1.5 h-1.5 bg-accent6 rounded-full animate-pulse"}),c.jsx("span",{className:"animate-pulse",children:"running"})]}),c.jsxs("span",{className:"text-neutral6 text-xs tabular-nums",children:[H,"ms"]})]}):c.jsxs(c.Fragment,{children:[N!==void 0&&(I?c.jsx(ya,{className:"text-green-400",size:14}):$?c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-orange-500/20 text-orange-400",children:"killed"}):c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-red-500/20 text-red-400",children:["exit ",N]})),R!==void 0&&c.jsxs("span",{className:"text-neutral6 text-xs",children:[R,"ms"]})]})})]}),!d&&c.jsxs("div",{className:"pt-2",children:[(L||b)&&c.jsx(TJr,{command:b,content:L,onCopy:L?V:void 0,isCopied:f}),c.jsx(oj,{toolCalled:A,toolCallId:s,toolApprovalMetadata:a,toolName:e,isNetwork:i,isGenerateMode:n?.mode==="generate"})]})]})},DJr=({toolName:e,args:t,result:r,toolCallId:n,toolApprovalMetadata:s,isNetwork:a,toolCalled:i})=>{const[o,l]=E.useState(!s),{isCopied:u,copyToClipboard:d}=z6();E.useEffect(()=>{l(!s)},[s]);const{Link:p}=Yt();let f={path:"/"};try{f=typeof t=="object"?t:JSON.parse(t)}catch{}const{path:h="/",maxDepth:m,showHidden:g,dirsOnly:b,exclude:v,extension:S}=f,w=[];m!==void 0&&m!==3&&w.push(`depth: ${m}`),g&&w.push("hidden"),b&&w.push("dirs only"),v&&w.push(`exclude: ${v}`),S&&w.push(`ext: ${S}`);let k="",_="";if(typeof r=="string"&&r){const $=r.lastIndexOf(`
568
568
 
569
569
  `);$!==-1?(k=r.slice(0,$),_=r.slice($+2)):k=r}const C=!!k,T=i??C,A=jn($=>$.message),I=E.useMemo(()=>A.content.find(F=>F.type==="data"&&F.name==="workspace-metadata"&&F.data?.toolCallId===n),[A.content,n])?.data,R=()=>{!k||u||d(k)};return c.jsxs("div",{className:"mb-4","data-testid":"file-tree-badge",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[c.jsxs("button",{onClick:()=>l($=>!$),className:"flex items-center gap-2 min-w-0",type:"button",children:[c.jsx(ve,{children:c.jsx(D1,{className:K("transition-all",o?"rotate-90":"rotate-180")})}),c.jsxs(Ft,{icon:c.jsx(mNt,{className:"text-accent6",size:16}),children:["List Files ",c.jsx("span",{className:"text-neutral6 font-normal ml-1",children:h}),w.length>0&&c.jsxs("span",{className:"text-neutral4 font-normal ml-1",children:["(",w.join(", "),")"]})]})]}),I?.filesystem&&c.jsxs(p,{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:[c.jsx(NK,{className:"size-3"}),c.jsx("span",{children:I.name||I.filesystem.name})]}),o&&C&&_&&c.jsx("span",{className:"text-neutral6 text-xs",children:_})]}),!o&&c.jsxs("div",{className:"pt-2",children:[s&&!T&&c.jsxs("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Tool arguments"}),c.jsx(Wa,{data:f,"data-testid":"tool-args"})]}),c.jsx(oj,{toolCalled:T,toolCallId:n,toolApprovalMetadata:s,toolName:e,isNetwork:a})]}),T&&k&&c.jsxs("div",{className:"rounded-md border border-border1 bg-surface2 overflow-hidden",children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border1 bg-surface3",children:[_&&c.jsx("span",{className:"text-neutral6 text-xs",children:_}),c.jsx(oa,{variant:"light",size:"sm",tooltip:"Copy tree",onClick:R,disabled:!k,children:c.jsxs("span",{className:"grid",children:[c.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",u?"scale-100":"scale-0"),children:c.jsx(ya,{size:14})}),c.jsx("span",{style:{gridArea:"1/1"},className:K("transition-transform",u?"scale-0":"scale-100"),children:c.jsx(Ql,{size:14})})]})})]}),c.jsx("pre",{className:"p-3 text-xs font-mono text-mastra-el-6 overflow-x-auto whitespace-pre max-h-[300px] overflow-y-auto",children:k})]}),T&&!C&&c.jsx("div",{className:"rounded-md border border-border1 bg-surface2 px-3 py-2",children:c.jsx("span",{className:"text-xs text-neutral6",children:"Loading..."})})]})]})};function Are(e){const t={},r=e.context||{};Object.entries(r).forEach(([i,o])=>{if(i!=="input"&&"status"in o){const l=o,u=l.status==="failed"&&l.tripwire!==void 0;t[i]={status:l.status,output:"output"in l?l.output:void 0,payload:"payload"in l?l.payload:void 0,suspendPayload:"suspendPayload"in l?l.suspendPayload:void 0,suspendOutput:"suspendOutput"in l?l.suspendOutput:void 0,resumePayload:"resumePayload"in l?l.resumePayload:void 0,error:u?void 0:"error"in l?l.error:void 0,tripwire:u?l.tripwire:void 0,startedAt:"startedAt"in l?l.startedAt:Date.now(),endedAt:"endedAt"in l?l.endedAt:void 0,suspendedAt:"suspendedAt"in l?l.suspendedAt:void 0,resumedAt:"resumedAt"in l?l.resumedAt:void 0}}});const n=Object.entries(t).flatMap(([i,o])=>{if(o?.status==="suspended"){const l=o?.suspendPayload?.__workflow_meta?.path;return l?[[i,...l]]:[[i]]}return[]}),s=n?.[0]?.[0],a=s?t[s]?.suspendPayload:void 0;return{input:r.input,steps:t,status:e.status,...e.status==="success"?{result:e.result}:{},...e.status==="failed"?{error:e.error}:{},...e.status==="suspended"?{suspended:n,suspendPayload:a}:{},...e.status==="tripwire"&&e.tripwire?{tripwire:{reason:e.tripwire.reason,retry:e.tripwire.retry,metadata:e.tripwire.metadata,processorId:e.tripwire.processorId}}:{}}}const H6=()=>{const[e,t]=E.useState(!1),r=E.useCallback(n=>{if(n){const s=new IntersectionObserver(([a])=>{t(a.isIntersecting)});return s.observe(n),()=>s.disconnect()}},[]);return{inView:e,setRef:r}},Ss=zne()(xxr(e=>({requestContext:{},setRequestContext:t=>e({requestContext:t})}),{name:"mastra-playground-store"})),lj=e=>{const t=st(),{requestContext:r}=Ss();return ur({queryKey:["workflow",e],queryFn:()=>e?t.getWorkflow(e).details(r):null,enabled:!!e,retry:!1,refetchOnWindowFocus:!1,throwOnError:!1})},Dre=20;function NJr(e,t,r){if(!(e.runs.length<Dre))return r+1}function IJr(e){const t=new Set;return e.pages.flatMap(r=>r.runs).filter(r=>t.has(r.runId)?!1:(t.add(r.runId),!0))}const kpt=(e,{enabled:t=!0}={})=>{const r=st(),{inView:n,setRef:s}=H6(),a=CI({queryKey:["workflow-runs",e],queryFn:({pageParam:u})=>r.getWorkflow(e).runs({limit:Dre,offset:u*Dre}),initialPageParam:0,getNextPageParam:NJr,select:IJr,retry:!1,enabled:t,refetchInterval:5e3}),{hasNextPage:i,isFetchingNextPage:o,fetchNextPage:l}=a;return E.useEffect(()=>{n&&i&&!o&&l()},[n,i,o,l]),{...a,setEndOfListElement:s}},Opt=(e,t,r)=>{const n=st();return ur({queryKey:["workflow-run",e,t],queryFn:()=>n.getWorkflow(e).runById(t),enabled:!!(e&&t),gcTime:0,staleTime:0,refetchInterval:r})},jJr=e=>{const t=st(),r=va();return Kr({mutationFn:({runId:n})=>t.getWorkflow(e).deleteRunById(n),onSuccess:()=>{r.invalidateQueries({queryKey:["workflow-runs",e]}),Xe.success("Workflow run deleted successfully")},onError:()=>{Xe.error("Failed to delete workflow run")}})},_pt=E.createContext(null);function Q6(){const e=E.useContext(_pt);if(!e)throw new Error("useWorkflowStepDetail must be used within WorkflowStepDetailProvider");return e}function RJr({children:e}){const[t,r]=E.useState(null),n=E.useCallback(({stepName:i,stepId:o,mapConfig:l})=>{r({type:"map-config",stepName:i,stepId:o,mapConfig:l})},[]),s=E.useCallback(({label:i,stepGraph:o,fullStep:l})=>{r({type:"nested-graph",stepName:i,nestedGraph:{label:i,stepGraph:o,fullStep:l}})},[]),a=E.useCallback(()=>{r(null)},[]);return c.jsx(_pt.Provider,{value:{stepDetail:t,showMapConfig:n,showNestedGraph:s,closeStepDetail:a},children:e})}function PJr({entityId:e,entityType:t}){const[r,n]=E.useState(void 0),s=`tracing-options-${t}:${e}`;return E.useEffect(()=>{try{const o=localStorage.getItem(s);if(o){const l=JSON.parse(o);n(l||void 0)}}catch(o){console.error(o)}},[s]),{settings:r,setSettings:o=>{n(l=>({...l,...o})),localStorage.setItem(s,JSON.stringify({...o,entityId:e,entityType:t}))},resetAll:()=>{n(void 0),localStorage.removeItem(s)},entityType:t}}const Cpt=E.createContext({setSettings:()=>{},resetAll:()=>{},settings:void 0,entityType:void 0}),Tpt=({children:e,entityId:t,entityType:r})=>{const n=PJr({entityId:t,entityType:r});return c.jsx(Cpt.Provider,{value:n,children:e})},zpe=()=>E.useContext(Cpt),Fm=E.createContext({});function Upe({children:e,snapshot:t,workflowId:r,initialRunId:n,withoutTimeTravel:s=!1}){const[a,i]=E.useState(()=>t?Are(t):null),[o,l]=E.useState(()=>t?.context?.input??null),[u,d]=E.useState(()=>n??""),[p,f]=E.useState(!1),[h,m]=E.useState(!1),g=p||["success","failed","canceled","bailed"].includes(a?.status??"")?void 0:5e3,{isLoading:b,data:v}=Opt(r,n??"",g),S=E.useMemo(()=>v&&n?{context:{input:v?.payload,...v?.steps},status:v?.status,result:v?.result,error:v?.error,runId:n,serializedStepGraph:v?.serializedStepGraph,value:v?.initialState}:void 0,[v,n]),{data:w,isLoading:k,error:_}=lj(r),{settings:C}=zpe(),T=gxr(),{streamWorkflow:A,streamResult:N,isStreaming:I,observeWorkflowStream:R,closeStreamsAndReset:$,resumeWorkflowStream:F,timeTravelWorkflowStream:L}=mxr({debugMode:h,tracingOptions:C?.tracingOptions,onError:H=>Xe.error(H.message)}),z=yxr(),q=()=>{i(null),l(null)};return E.useEffect(()=>{f(!1)},[n]),E.useEffect(()=>{S?.runId&&(i(Are(S)),S.value&&Object.keys(S.value).length>0?l({initialState:S.value,inputData:S.context?.input}):l(S.context?.input),d(S.runId))},[S]),c.jsx(Fm.Provider,{value:{workflowId:r,result:a,setResult:i,payload:o,setPayload:l,clearData:q,snapshot:t,runId:u,setRunId:d,workflowError:_??null,workflow:w??void 0,isLoading:k,createWorkflowRun:T.mutateAsync,streamWorkflow:H=>(f(!0),A.mutateAsync(H)),resumeWorkflow:H=>(f(!0),F.mutateAsync(H)),streamResult:N,isStreamingWorkflow:I,isCancellingWorkflowRun:z.isPending,cancelWorkflowRun:z.mutateAsync,observeWorkflowStream:H=>(f(!0),R.mutate(H)),closeStreamsAndReset:$,timeTravelWorkflowStream:H=>(f(!0),L.mutateAsync(H)),runSnapshot:S,isLoadingRunExecutionResult:b,withoutTimeTravel:s,debugMode:h,setDebugMode:m},children:c.jsx(RJr,{children:e})})}function Nr({className:e,...t}){return c.jsx("div",{className:K("rounded-md bg-surface4 relative overflow-hidden","before:absolute before:inset-0","before:translate-x-[-100%]","before:animate-[shimmer_2s_infinite]","before:bg-gradient-to-r before:from-transparent before:via-surface5/20 before:to-transparent",e),...t})}const $Jr=e=>e.replace(/[-_\s]+(.)?/g,(r,n)=>n?n.toUpperCase():"").replace(/^(.)/,r=>r.toLowerCase()).replace(/([A-Z])/g," $1").replace(/^./,r=>r.toUpperCase()).trim(),MJr=(e,t,r)=>{if(!e.startsWith("mapping_"))return e;const n=l=>l.split(" ").map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join(" "),s=l=>{const u=l.replace(/Step$/,"").replace(/[-_]/g," ").trim();return n(u)},a=(l,u)=>l.length===0?u?"End":"Start":l.length===1?s(l[0]):`${l.length} Steps`,i=a(t,!1),o=a(r,!0);return`${i} → ${o} Map`},LJr=(e,t)=>{const r=new TNe.graphlib.Graph().setDefaultEdgeLabel(()=>({}));r.setGraph({rankdir:"TB"}),t.forEach(a=>r.setEdge(a.source,a.target)),e.forEach(a=>r.setNode(a.id,{...a,width:a.measured?.width??274,height:a.measured?.height??(a?.data?.isLarge?260:100)})),TNe.layout(r);const n=r.graph()?.width?r.graph().width/2:0,s=r.graph()?.height?r.graph().height/2:0;return{nodes:e.map(a=>{const i=r.node(a.id),o=i.x-(a.measured?.width??274)/2,l=i.y-(a.measured?.height??(a?.data?.isLarge?260:100))/2;return{...a,position:{x:o,y:l}}}),edges:t,fullWidth:n,fullHeight:s}},of={animated:!0,markerEnd:{type:DD.ArrowClosed,width:20,height:20,color:"#8e8e8e"}},Nre=({stepFlow:e,xIndex:t,yIndex:r,prevNodeIds:n,prevStepIds:s,nextStepFlow:a,condition:i,allPrevNodeIds:o})=>{let l=[],u=[];if((a?.type==="step"||a?.type==="foreach"||a?.type==="loop")&&(l=[o?.includes(a.step.id)?`${a.step.id}-${r+1}`:a.step.id],u=[a.step.id]),(a?.type==="sleep"||a?.type==="sleepUntil")&&(l=[o?.includes(a.id)?`${a.id}-${r+1}`:a.id],u=[a.id]),a?.type==="parallel"&&(l=a?.steps.map(d=>{const p=d.step.id;return o?.includes(p)?`${p}-${r+1}`:p})||[],u=a?.steps.map(d=>d.step.id)||[]),a?.type==="conditional"&&(l=a?.serializedConditions.map(d=>d.id)||[],u=a?.steps?.map(d=>d.step.id)||[]),e.type==="step"||e.type==="foreach"){const d=e.step.component==="WORKFLOW",p=o?.includes(e.step.id)?`${e.step.id}-${r}`:e.step.id,f=[...i?[{id:i.id,position:{x:t*300,y:r*100},type:"condition-node",data:{label:i.id,previousStepId:s[s.length-1],nextStepId:e.step.id,withoutTopHandle:!n.length,withoutBottomHandle:!l.length,isLarge:!0,conditions:[{type:"when",fnString:i.fn}]}}]:[],{id:p,position:{x:t*300,y:(r+(i?1:0))*100},type:d?"nested-node":"default-node",data:{label:MJr(e.step.id,s,u),stepId:e.step.id,description:e.step.description,withoutTopHandle:i?!1:!n.length,withoutBottomHandle:!l.length,stepGraph:d?e.step.serializedStepFlow:void 0,mapConfig:e.step.mapConfig,canSuspend:e.step.canSuspend,isForEach:e.type==="foreach",metadata:e.step.metadata}}],h=[...i?[...(n||[]).map((m,g)=>({id:`e${m}-${i.id}`,source:m,data:{previousStepId:s[g],nextStepId:e.step.id},target:i.id,...of})),{id:`e${i.id}-${p}`,source:i.id,data:{previousStepId:s[s.length-1],nextStepId:e.step.id,conditionNode:!0},target:p,...of}]:(n||[]).map((m,g)=>({id:`e${m}-${p}`,source:m,data:{previousStepId:s[g],nextStepId:e.step.id},target:p,...of})),...(l||[]).map((m,g)=>({id:`e${p}-${m}`,source:p,data:{previousStepId:e.step.id,nextStepId:u[g]},target:m,...of}))];return{nodes:f,edges:h,nextPrevNodeIds:[p],nextPrevStepIds:[e.step.id]}}if(e.type==="sleep"||e.type==="sleepUntil"){const d=o?.includes(e.id)?`${e.id}-${r}`:e.id,p=[...i?[{id:i.id,position:{x:t*300,y:r*100},type:"condition-node",data:{label:i.id,previousStepId:s[s.length-1],nextStepId:e.id,withoutTopHandle:!1,withoutBottomHandle:!l.length,isLarge:!0,conditions:[{type:"when",fnString:i.fn}]}}]:[],{id:d,position:{x:t*300,y:(r+(i?1:0))*100},type:"default-node",data:{label:e.id,withoutTopHandle:i?!1:!n.length,withoutBottomHandle:!l.length,...e.type==="sleepUntil"?{date:e.date}:{duration:e.duration}}}],f=[...n.length?i?[...n.map((h,m)=>({id:`e${h}-${i.id}`,source:h,data:{previousStepId:s[m],nextStepId:e.id},target:i.id,...of})),{id:`e${i.id}-${d}`,source:i.id,data:{previousStepId:s[s.length-1],nextStepId:e.id},target:d,...of}]:n.map((h,m)=>({id:`e${h}-${d}`,source:h,data:{previousStepId:s[m],nextStepId:e.id},target:d,...of})):[],...l.length?l.map((h,m)=>({id:`e${d}-${h}`,source:d,data:{previousStepId:e.id,nextStepId:u[m]},target:h,...of})):[]];return{nodes:p,edges:f,nextPrevNodeIds:[d],nextPrevStepIds:[e.id]}}if(e.type==="loop"){const{step:d,serializedCondition:p,loopType:f}=e,h=d.component==="WORKFLOW",m=[{id:d.id,position:{x:t*300,y:r*100},type:h?"nested-node":"default-node",data:{label:d.id,description:d.description,withoutTopHandle:!n.length,withoutBottomHandle:!1,stepGraph:h?d.serializedStepFlow:void 0,canSuspend:d.canSuspend,metadata:d.metadata}},{id:p.id,position:{x:t*300,y:(r+1)*100},type:"condition-node",data:{label:p.id,previousStepId:d.id,nextStepId:u[0],withoutTopHandle:!1,withoutBottomHandle:!l.length,isLarge:!0,conditions:[{type:f,fnString:p.fn}]}}],g=[...n.length?n.map((b,v)=>({id:`e${b}-${d.id}`,source:b,data:{previousStepId:s[v],nextStepId:d.id},target:d.id,...of})):[],{id:`e${d.id}-${p.id}`,source:d.id,data:{previousStepId:d.id,nextStepId:u[0]},target:p.id,...of},...l.length?l.map((b,v)=>({id:`e${p.id}-${b}`,source:p.id,data:{previousStepId:d.id,nextStepId:u[v]},target:b,...of})):[]];return{nodes:m,edges:g,nextPrevNodeIds:[p.id],nextPrevStepIds:[d.id]}}if(e.type==="parallel"){let d=[],p=[],f=[];return e.steps.forEach((h,m)=>{const{nodes:g,edges:b,nextPrevStepIds:v}=Nre({stepFlow:h,xIndex:m,yIndex:r,prevNodeIds:n,prevStepIds:s,nextStepFlow:a,allPrevNodeIds:o}),S=g.map(w=>({...w,data:{...w.data,isParallel:!0}}));d.push(...S),p.push(...b),f.push(...v)}),{nodes:d,edges:p,nextPrevNodeIds:d.map(h=>h.id),nextPrevStepIds:f}}if(e.type==="conditional"){let d=[],p=[],f=[];return e.steps.forEach((h,m)=>{const{nodes:g,edges:b,nextPrevStepIds:v}=Nre({stepFlow:h,xIndex:m,yIndex:r,prevNodeIds:n,prevStepIds:s,nextStepFlow:a,condition:e.serializedConditions[m],allPrevNodeIds:o});d.push(...g),p.push(...b),f.push(...v)}),{nodes:d,edges:p,nextPrevNodeIds:d.filter(({type:h})=>h!=="condition-node").map(h=>h.id),nextPrevStepIds:f}}return{nodes:[],edges:[],nextPrevNodeIds:[],nextPrevStepIds:[]}},Apt=({stepGraph:e})=>{if(!e)return{nodes:[],edges:[]};if(e.length===0)return{nodes:[],edges:[]};let t=[],r=[],n=[],s=[],a=[];for(let l=0;l<e.length;l++){const{nodes:u,edges:d,nextPrevNodeIds:p,nextPrevStepIds:f}=Nre({stepFlow:e[l],xIndex:l,yIndex:l,prevNodeIds:n,prevStepIds:s,nextStepFlow:l===e.length-1?void 0:e[l+1],allPrevNodeIds:a});t.push(...u),r.push(...d),n=p,s=f,a.push(...n)}const{nodes:i,edges:o}=LJr(t,r);return{nodes:i,edges:o}},CO=VCr,oS=Ee.forwardRef(({className:e,children:t,...r},n)=>c.jsx(Rce,{ref:n,className:K("-outline-offset-2",Wr.colors,nx.visible,"hover:text-neutral5","[&>svg]:transition-transform [&>svg]:duration-normal [&>svg]:ease-out-custom","[&[data-state=open]>svg]:rotate-90",e),...r,children:t}));oS.displayName=Rce.displayName;const lS=Ee.forwardRef(({className:e,children:t,...r},n)=>c.jsx($ce,{ref:n,className:K("overflow-hidden","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-top-1","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-1","duration-normal ease-out-custom",e),...r,children:t}));lS.displayName=$ce.displayName;const Zi={sleep:"#A855F7",forEach:"#F97316",map:"#F97316",parallel:"#3B82F6",suspend:"#EC4899",after:"#14B8A6",workflow:"#8B5CF6",when:"#ECB047",dountil:"#8B5CF6",dowhile:"#06B6D4",until:"#F59E0B",while:"#10B981",if:"#3B82F6",else:"#6B7280"},Ao={sleep:b3,sleepUntil:VAt,forEach:zE,map:zE,parallel:pze,suspend:YBe,after:hL,workflow:sze,when:ize,dountil:_It,dowhile:TIt,until:b3,while:rI,if:nze,else:BDt},PPe=e=>{switch(e){case"when":return{icon:Ao.when,color:Zi.when};case"dountil":return{icon:Ao.dountil,color:Zi.dountil};case"dowhile":return{icon:Ao.dowhile,color:Zi.dowhile};case"until":return{icon:Ao.until,color:Zi.until};case"while":return{icon:Ao.while,color:Zi.while};case"if":return{icon:Ao.if,color:Zi.if};case"else":return{icon:Ao.else,color:Zi.else};default:return{icon:void 0,color:void 0}}},Dpt=e=>{const t=!!(e.duration||e.date),r=!!e.isForEach,n=!!(e.mapConfig&&!e.isForEach),s=!!e.stepGraph,a=t||e.canSuspend||e.isParallel||r||n||s;return{isSleepNode:t,isForEachNode:r,isMapNode:n,isNestedWorkflow:s,hasSpecialBadge:a}},Npt=(e,{enabled:t=!0})=>{const r=E.useRef(t);Ee.useEffect(()=>{if(!t||!e?.current)return;const n=e.current,s=new MutationObserver(()=>{r.current&&n.scrollTo({top:n.scrollHeight,behavior:"smooth"})});s.observe(n,{childList:!0,subtree:!0,characterData:!0});const a=i=>{const o=i.target,l=o.scrollTop+o.clientHeight,u=o.scrollHeight;l>=u-1?r.current=!0:r.current=!1};return n.addEventListener("scroll",a),()=>{n.removeEventListener("scroll",a),s.disconnect()}},[t,e])},pi=E.forwardRef(({className:e,children:t,viewPortClassName:r,maxHeight:n,autoScroll:s=!1,...a},i)=>{const o=E.useRef(null);return Npt(o,{enabled:s}),c.jsxs(mtt,{ref:i,className:K("relative overflow-hidden",e),...a,children:[c.jsx(tTr,{ref:o,className:K("h-full w-full rounded-[inherit] [&>div]:!block",r),style:n?{maxHeight:n}:void 0,children:t}),c.jsx(Ipt,{}),c.jsx(rTr,{})]})});pi.displayName=mtt.displayName;const Ipt=E.forwardRef(({className:e,orientation:t="vertical",...r},n)=>c.jsx(Fce,{ref:n,orientation:t,className:K("flex touch-none select-none transition-all duration-normal ease-out-custom","opacity-0 hover:opacity-100 data-[state=visible]:opacity-100",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px",e),...r,children:c.jsx(utt,{className:"relative flex-1 rounded-full bg-neutral2 hover:bg-neutral3 transition-colors duration-normal"})}));Ipt.displayName=Fce.displayName;const cj=()=>{const e=E.useContext(Fm),t=e.result?.steps??{};return{steps:Object.entries(t).reduce((n,[s,a])=>{const i="tripwire"in a&&a.tripwire;return{...n,[s]:{error:i?void 0:"error"in a?a.error:void 0,tripwire:i?a.tripwire:void 0,startedAt:a.startedAt,endedAt:"endedAt"in a?a.endedAt:void 0,status:a.status,output:"output"in a?a.output:void 0,input:a.payload,resumeData:"resumePayload"in a?a.resumePayload:void 0,suspendOutput:"suspendOutput"in a?a.suspendOutput:void 0,suspendPayload:"suspendPayload"in a?a.suspendPayload:void 0,foreachProgress:"foreachProgress"in a?a.foreachProgress:void 0}}},{}),runId:e.runId}},Ow=({data:e,language:t="auto"})=>{const r=sx(),n=i=>{if(t==="javascript")return[Q3(),ht.lineWrapping];if(t==="json")return[hd,ht.lineWrapping];try{return JSON.parse(i),[hd,ht.lineWrapping]}catch{return i.includes("=>")||i.includes("function")||i.includes("const ")||i.includes("return ")?[Q3(),ht.lineWrapping]:[ht.lineWrapping]}};if(typeof e!="string"){const i=JSON.stringify(e,null,2);return c.jsxs("div",{className:"max-h-[500px] overflow-auto relative",children:[c.jsx("div",{className:"absolute right-2 top-2 bg-surface4 rounded-full z-10",children:c.jsx(ql,{content:i})}),c.jsx("div",{className:"bg-surface4 rounded-lg p-4",children:c.jsx(Sd,{value:i,theme:r,extensions:[hd,ht.lineWrapping]})})]})}const s=n(e);let a=e;try{const i=JSON.parse(e);a=JSON.stringify(i,null,2)}catch{}return c.jsxs("div",{className:"max-h-[500px] overflow-auto relative",children:[c.jsx("div",{className:"absolute right-2 top-2 bg-surface4 rounded-full z-10",children:c.jsx(ql,{content:e})}),c.jsx("div",{className:"bg-surface4 rounded-lg p-4",children:c.jsx(Sd,{value:a,theme:r,extensions:s})})]})},FJr=Ee.forwardRef(({children:e,...t},r)=>c.jsx("form",{ref:r,className:"space-y-4",...t,children:e})),BJr=["boolean","object","array"],zJr=({label:e,children:t,id:r,field:n,error:s})=>{const a=BJr.includes(n.type);return c.jsxs("div",{className:"pb-4 last:pb-0",children:[!a&&c.jsxs(ze,{as:"label",variant:"ui-sm",className:"text-neutral3 pb-1 block",htmlFor:r,children:[e,n.required&&c.jsx("span",{className:"text-accent2",children:" *"})]}),t,n.fieldConfig?.description&&c.jsx(ze,{as:"p",variant:"ui-sm",className:"text-neutral6",children:n.fieldConfig.description}),s&&c.jsx(ze,{as:"p",variant:"ui-sm",className:"text-accent2",children:s})]})},UJr=({error:e})=>c.jsx(Cp,{variant:"destructive",children:c.jsx(Tp,{children:e})}),VJr=({children:e})=>c.jsx(ye,{type:"submit",children:e}),$Pe=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,MPe=Ydt,Vpe=(e,t)=>r=>{var n;if(t?.variants==null)return MPe(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(u=>{const d=r?.[u],p=a?.[u];if(d===null)return null;const f=$Pe(d)||$Pe(p);return s[u][f]}),o=r&&Object.entries(r).reduce((u,d)=>{let[p,f]=d;return f===void 0||(u[p]=f),u},{}),l=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:p,className:f,...h}=d;return Object.entries(h).every(m=>{let[g,b]=m;return Array.isArray(b)?b.includes({...a,...o}[g]):{...a,...o}[g]===b})?[...u,p,f]:u},[]);return MPe(e,i,l,r?.class,r?.className)},qJr=Vpe(K("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70",ij,sh),{variants:{variant:{default:"border border-border1 hover:border-border2",filled:"border bg-surface2 border-border1 hover:border-border2",unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${oi.sm} px-2 text-ui-sm`,md:`${oi.md} px-3 text-ui-sm`,lg:`${oi.lg} px-4 text-ui-sm`}},defaultVariants:{variant:"default",size:"md"}}),qr=E.forwardRef(({className:e,size:t,testId:r,variant:n,type:s,error:a,...i},o)=>c.jsx("input",{type:s,className:K(qJr({variant:n,size:t}),a&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":r,ref:o,"aria-invalid":a,...i}));qr.displayName="Input";const HJr=({inputProps:e,error:t,field:r,id:n})=>{const{key:s,...a}=e;return c.jsx(qr,{id:n,className:t?"border-accent2":"",...a,defaultValue:r.default})},QJr=({inputProps:e,error:t,field:r,id:n})=>{const{key:s,...a}=e;return c.jsx(qr,{id:n,type:"number",className:t?"border-accent2":"",...a,defaultValue:r.default!==void 0?Number(r.default):void 0,onChange:i=>{const o=i.target.value;o!==""&&!isNaN(Number(o))&&a.onChange({target:{value:o,name:e.name}})},onBlur:i=>{const o=i.target.value;o!==""&&!isNaN(Number(o))&&a.onChange({target:{value:Number(o),name:e.name}})}})},Fp=E.forwardRef(({className:e,...t},r)=>c.jsx(Vce,{ref:r,className:K("peer h-4 w-4 shrink-0 rounded-sm border border-neutral3","shadow-sm",Wr.all,"hover:border-neutral5 hover:shadow-md",sh,"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-neutral3 disabled:hover:shadow-sm","data-[state=checked]:bg-accent1 data-[state=checked]:border-accent1 data-[state=checked]:text-surface1","data-[state=checked]:shadow-glow-accent1",e),...t,children:c.jsx(vtt,{className:K("flex items-center justify-center text-current","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:c.jsx(ya,{className:"h-3.5 w-3.5 stroke-[3]"})})}));Fp.displayName=Vce.displayName;const GJr=({field:e,label:t,id:r,inputProps:n,value:s})=>c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx(Fp,{id:r,onCheckedChange:a=>{const i={target:{name:n.name,value:a}};n.onChange(i)},defaultChecked:e.default,disabled:n.disabled||n.readOnly}),c.jsxs(ze,{as:"label",variant:"ui-sm",className:"text-neutral3",htmlFor:r,children:[t,e.required&&c.jsx("span",{className:"text-accent2",children:" *"})]})]});function jpt({className:e,classNames:t,showOutsideDays:r=!0,...n}){return c.jsx(GDr,{showOutsideDays:r,className:K("p-3",e),classNames:{months:"flex flex-col space-y-4 sm:space-y-0 ",month:"space-y-4 text-ui-sm ",caption:"flex justify-between pt-1 items-center pl-2",caption_label:"text-text font-medium ",nav:"flex items-center",nav_button_previous:K("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_next:K("flex justify-center items-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),dropdown_month:"w-full border-collapse space-y-1",weeknumber:"flex",day:K("relative p-0 text-center focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-surface5 [&:has([aria-selected].day-outside)]:bg-surface5/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",n.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md","h-8 w-8 p-0 hover:bg-lightGray-7/50 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"!bg-neutral6/50 !text-surface2 hover:bg-neutral6 rounded-md hover:text-surface2 focus:bg-neutral6 focus:text-surface2",day_today:"bg-neutral6/10 text-neutral5",day_outside:"day-outside text-neutral3 opacity-50 aria-selected:bg-surface5/50 aria-selected:text-neutral3 aria-selected:opacity-30",day_disabled:"text-neutral3 opacity-50",day_range_middle:"aria-selected:bg-surface5 aria-selected:text-neutral5",day_hidden:"invisible",head_cell:"text-ui-xs text-neutral3",...t},...n})}const qpe=ETt,Hpe=kTt,G6=E.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>c.jsx(OTt,{children:c.jsx(gBe,{ref:s,align:t,sideOffset:r,className:K("z-50 w-72 rounded-md border border-border1 bg-surface3 text-neutral5 shadow-md 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-[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&&/\bp-\S+/.test(e)?!1:"p-4",e),...n})}));G6.displayName=gBe.displayName;const Ro=vNr,Po=xNr,ZJr={sm:`${oi.sm} px-2 text-ui-sm`,md:`${oi.md} px-3 text-ui-sm`,lg:`${oi.lg} px-3 text-ui-sm`,default:`${oi.default} text-ui-md`},go=E.forwardRef(({className:e,children:t,size:r="md",variant:n="default",...s},a)=>{const i=["experimental"].includes(n);return c.jsxs(mrt,{ref:a,className:K("flex w-full items-center justify-between placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50",i?"bg-white/5 gap-[1em] text-white/70 ring-2 pl-[1.2em] pr-[.8em] ring-inset ring-white/10 font-light":"border border-border1 bg-transparent py-2 shadow-sm",i?"rounded":ij,i?"":sh,Wr.all,i?"":"hover:border-neutral2",ZJr[r],e),...s,children:[t,c.jsx(SNr,{asChild:!0,children:c.jsx($a,{className:K("h-4 w-4 text-neutral3",Wr.colors)})})]})});go.displayName=mrt.displayName;const yo=E.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>c.jsx(wNr,{children:c.jsx(grt,{ref:s,className:K("relative z-50 min-w-[8rem] max-h-dropdown-max-height overflow-y-auto overflow-x-hidden rounded-md border border-border1 bg-surface3 text-neutral5 shadow-md 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-[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",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:c.jsx(ENr,{className:K("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));yo.displayName=grt.displayName;const Ms=E.forwardRef(({className:e,children:t,...r},n)=>c.jsxs(yrt,{ref:n,className:K("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-neutral5 text-sm",Wr.colors,"hover:bg-surface5 hover:text-neutral5","focus:bg-surface5 focus:text-neutral5","data-[state=checked]:bg-accent1Dark data-[state=checked]:text-accent1","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(ONr,{children:c.jsx(ya,{className:"h-4 w-4 text-accent1"})})}),c.jsx(kNr,{children:t})]}));Ms.displayName=yrt.displayName;function OY({name:e,onChange:t,value:r,options:n,placeholder:s}){return c.jsxs(Ro,{name:e,onValueChange:t,value:r,children:[c.jsx(go,{children:c.jsx(Po,{placeholder:s||"Select..."})}),c.jsx(yo,{children:(n||[]).map((a,i)=>c.jsx(Ms,{value:`${i}`,children:c.jsx("div",{className:"flex items-center gap-2 [&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:text-neutral3",children:a})},a))})]})}const _Y=["12","1","2","3","4","5","6","7","8","9","10","11"],AP=["00","15","30","45","59"],DP=["AM","PM"];function WJr({defaultValue:e,onValueChange:t,className:r}){const[n,s]=E.useState("12"),[a,i]=E.useState("00"),[o,l]=E.useState("AM");E.useEffect(()=>{if(e){const f=/^(\d{1,2}):(\d{2})(?::\d{2})?\s*(AM|PM|am|pm)?$/,h=e.match(f);if(h){let m=parseInt(h[1],10);const g=parseInt(h[2],10),b=h[3]?.toUpperCase();m>=1&&m<=12&&g>=0&&g<=59&&(s(m.toString()),i(g===0?"00":g.toString()),l(b||"AM"))}}},[e]);const u=f=>{s(f),t(`${_Y[+f]}:${a} ${o}`.trim())},d=f=>{i(AP[+f]),t(`${n}:${AP[+f]} ${o}`.trim())},p=f=>{l(DP[+f]),t(`${n}:${a} ${DP[+f]}`.trim())};return c.jsxs("div",{className:K("flex gap-2 items-center",r),children:[c.jsx(OY,{name:"hour",value:_Y.indexOf(n).toString(),onChange:u,options:_Y}),":",c.jsx(OY,{name:"minute",value:AP.indexOf(a).toString(),onChange:d,options:AP}),c.jsx(OY,{name:"period",value:DP.indexOf(o).toString(),onChange:p,options:DP})]})}const XJr={sm:`${oi.sm} px-2`,md:`${oi.md} px-3`,lg:`${oi.lg} px-3 py-2`,default:`${oi.default} px-3`};function ay({name:e,value:t,label:r,labelIsHidden:n=!1,className:s,testId:a,required:i,disabled:o,helpMsg:l,error:u,errorMsg:d,size:p="lg",variant:f="default",...h}){const m=({children:b})=>n?c.jsx(Rp,{children:b}):b,g=f==="experimental";return c.jsxs("div",{className:K("grid gap-2 text-neutral4",{"grid-rows-[auto_1fr]":!n&&!l,"grid-rows-[auto_1fr_auto]":!n&&l},s),children:[c.jsx(m,{children:c.jsxs("label",{htmlFor:`input-${e}`,className:K("text-ui-sm text-neutral3 flex justify-between items-center"),children:[r,i&&c.jsx("i",{className:"text-neutral2 text-xs",children:"(required)"})]})}),c.jsx("input",{id:`input-${e}`,name:e,value:t,autoComplete:"off",className:K("flex grow items-center cursor-pointer text-ui-md leading-none",XJr[p],g?"text-neutral4 leading-[10] ring-2 ring-inset ring-white/20 bg-surface2 hover:ring-white/30 focus-visible:ring-accent1/60 px-[1em] rounded-lg transition-colors duration-200 ease-out-custom [&:-webkit-autofill]:bg-surface2":"text-neutral5 border border-border1 bg-transparent w-full",g?"focus-visible:outline-none":sh,g?"":ij,g?"placeholder:text-neutral2":"placeholder:text-neutral3 placeholder:text-ui-sm",{"cursor-not-allowed opacity-50":o,"border-red-800 focus:border-border1":!g&&(u||d)}),"data-testid":a,...h}),l&&c.jsx("p",{className:"text-neutral3 text-ui-sm",children:l}),d&&c.jsxs("p",{className:K("text-ui-sm text-neutral4 flex items-center gap-2","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-70 [&>svg]:text-red-400"),children:[c.jsx(Pc,{})," ",d]})]})}function sN({onReset:e,variant:t,...r}){return c.jsxs("div",{className:K("relative group"),children:[c.jsx(ay,{labelIsHidden:!0,...r,className:K("[&>input]:pl-10 relative",{}),variant:t}),c.jsx(_m,{"aria-hidden":"true",className:"text-neutral4 opacity-50 group-has-[:focus]:opacity-100 absolute top-2 left-3 w-5 h-5"}),e&&r.value&&c.jsx(c.Fragment,{children:t==="experimental"?c.jsx(ye,{type:"button",onClick:e,variant:"standard",size:"sm",className:"absolute top-[50%] translate-y-[-50%] rounded-none right-[2px] w-[2rem] h-[calc(100%-4px)] px-0","aria-label":"Clear",children:c.jsx(Os,{})}):c.jsx("button",{type:"button",onClick:e,className:K("absolute top-1/2 right-2 -translate-y-1/2 p-1 rounded",Wr.all,"hover:bg-surface4","[&>svg]:transition-colors [&>svg]:duration-normal","[&:hover>svg]:text-neutral5"),children:c.jsx(Os,{className:"text-neutral3 w-[1rem] h-[1rem]"})})})]})}function jc({name:e,value:t,label:r,labelIsHidden:n=!1,className:s,required:a,disabled:i,helpMsg:o,options:l,onValueChange:u,placeholder:d="Select an option",size:p="lg",variant:f="default"}){const h=({children:m})=>n?c.jsx(Rp,{children:m}):m;return c.jsxs("div",{className:K("flex gap-2 items-center",{"grid-rows-[auto_1fr]":r,"grid-rows-[auto_1fr_auto]":o},s),children:[c.jsx(h,{children:c.jsxs("label",{className:K("text-ui-sm text-neutral3 flex justify-between items-center shrink-0"),children:[r,a&&c.jsx("i",{className:"text-neutral2",children:"(required)"})]})}),c.jsxs(Ro,{name:e,value:t,onValueChange:u,disabled:i,children:[c.jsx(go,{id:`select-${e}`,size:p,variant:f,className:"grid grid-cols-[1fr_auto] [&>span]:truncate",children:c.jsx(Po,{placeholder:d})}),c.jsx(yo,{children:l.map(m=>c.jsx(Ms,{value:m.value,disabled:m.disabled,children:c.jsxs("span",{className:"whitespace-nowrap truncate flex items-center gap-2",children:[m.icon,m.label]})},m.value))})]}),o&&c.jsx("p",{className:"text-neutral3 text-ui-sm",children:o})]})}const LPe=({value:e,minValue:t,maxValue:r,defaultTimeStrValue:n,onValueChange:s,children:a,className:i,placeholder:o,...l})=>{const[u,d]=E.useState(!1);return c.jsxs(qpe,{open:u,onOpenChange:d,children:[c.jsx(Hpe,{asChild:!0,children:a||c.jsx(KJr,{value:e,placeholder:o,className:i,"data-testid":"datepicker-button"})}),c.jsx(G6,{className:"backdrop-blur-4xl w-auto !p-0 bg-surface4 max-w-[16.5rem]",align:"start","data-testid":"datepicker-calendar",children:c.jsx(YJr,{value:e,minValue:t,maxValue:r,onValueChange:s,setOpenPopover:d,defaultTimeStrValue:n,...l})})]})};function NP({date:e,timeStr:t=""}){if(!Fb(e))return null;if(t){const r=vn(e,"yyyy-MM-dd"),n=new Date(`${r} ${t}`);if(Fb(n))return n}return e}const YJr=({value:e,minValue:t,maxValue:r,onValueChange:n,setOpenPopover:s,placeholder:a,className:i,defaultTimeStrValue:o,...l})=>{const[u,d]=E.useState(null),[p,f]=E.useState(e?vn(NP({date:e,timeStr:o})||"","PP p"):""),[h,m]=E.useState(o||""),[g,b]=E.useState(e?new Date(e):void 0),v=MI(F=>{Fb(F)&&(b(F),n?.(F),s?.(!1))},500),S=F=>{f(F.currentTarget.value);const L=new Date(F.currentTarget.value);v(L)},w=F=>{Fb(F)?r&&F>r?(d(`The selected date should be before ${vn(r,"PP p")}`),f("")):t&&F<t?(d(`The selected date should be after ${vn(t,"PP p")}`),f("")):(f(vn(F,"PP p")),d("")):(f(""),d(""))},k=new Date(p),_=Fb(k),C=_&&k.getTime()!==e?.getTime(),T=F=>{if(b(F),F){const L=NP({date:F,timeStr:h});w(L||"")}else w("")},A=F=>{if(b(F),F){const L=NP({date:F,timeStr:h});w(L||"")}else w("")},N=F=>{if(m(F),_){const L=NP({date:k,timeStr:F});w(L||"")}},I=()=>{s?.(!1)},R=()=>{Fb(k)&&n(k),s?.(!1)},$=()=>{n(void 0),b(void 0),f(""),m(""),s?.(!1)};return c.jsxs("div",{"aria-label":"Choose date",className:K("relative flex flex-col",i),onKeyDown:F=>{F.stopPropagation(),F.key==="Escape"&&s?.(!1)},children:[c.jsx(ay,{type:"text",value:p,onChange:S,placeholder:a,className:"m-4 mb-0 !w-auto"}),u&&c.jsxs("div",{className:K("text-ui-md m-4 mb-0 text-neutral3","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mt-0.5 [&>svg]:text-red-500 [&>svg]:float-left [&>svg]:mr-2"),children:[c.jsx(Xh,{})," ",u]}),c.jsx(jpt,{mode:"single",month:g,selected:g,onMonthChange:A,onSelect:T,...l}),c.jsx(WJr,{onValueChange:N,className:"m-4 mt-0 w-auto",defaultValue:e?vn(new Date(e),"hh:mm a"):o}),c.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-2 m-4 mt-0",children:[c.jsx(ye,{variant:"light",size:"lg",tabIndex:0,onClick:()=>{_?R():I()},children:C?"Apply":"Cancel"}),C&&c.jsx(ye,{tabIndex:0,onClick:$,children:"Clear"})]})]})},KJr=E.forwardRef(({value:e,placeholder:t,className:r,...n},s)=>c.jsxs(ye,{ref:s,className:K("justify-start",r),variant:"light",size:"lg",...n,children:[c.jsx(cie,{className:"h-4 w-4"}),e?c.jsx("span",{className:"text-white",children:vn(e,"PP p")}):c.jsx("span",{className:"text-gray",children:t??"Pick a date"})]})),JJr=({inputProps:e,field:t,error:r,id:n})=>{const{key:s,...a}=e,[i,o]=E.useState(void 0),[l,u]=E.useState(!1);E.useEffect(()=>{if(t.default){const f=new Date(t.default);Fb(f)&&o(f)}},[t]);const d=f=>{o(f),f&&a.onChange({target:{value:f.toISOString(),name:e.name}}),u(!1)},p=()=>{o(void 0),a.onChange({target:{value:"",name:e.name}}),u(!1)};return c.jsxs(qpe,{open:l,onOpenChange:u,children:[c.jsx(Hpe,{asChild:!0,children:c.jsxs(ye,{id:n,variant:"light",size:"lg",className:K("w-full",r?"border-accent2":""),children:[c.jsx(cie,{className:"h-4 w-4"}),i?c.jsx("span",{className:"text-white",children:vn(i,"PPP")}):c.jsx("span",{className:"text-gray",children:"Pick a date"})]})}),c.jsxs(G6,{className:"w-auto p-0 bg-surface4",align:"start",children:[c.jsx(jpt,{mode:"single",selected:i,onSelect:d,month:i,onMonthChange:o}),i&&c.jsx("div",{className:"p-3 pt-0",children:c.jsx(ye,{variant:"light",size:"lg",className:"w-full",onClick:p,children:"Clear"})})]})]})},een=({field:e,inputProps:t,error:r,id:n,value:s})=>{const{key:a,...i}=t;return c.jsxs(Ro,{...i,value:s,onValueChange:o=>{const l={target:{value:o,name:t.name}};i.onChange(l)},children:[c.jsx(go,{id:n,className:r?"border-accent2":"",children:c.jsx(Po,{placeholder:"Select an option"})}),c.jsx(yo,{children:(e.options||[]).map(([o,l])=>c.jsx(Ms,{value:o,children:l},o))})]})},ten=({label:e,children:t})=>{const r=e!=="​"&&e!=="",[n,s]=E.useState(!1);return c.jsxs("div",{className:"",children:[c.jsxs("div",{className:"flex items-center",children:[r&&c.jsxs(ze,{as:"h3",variant:"ui-sm",className:"text-neutral3 flex items-center gap-1 pb-2",children:[c.jsx(ve,{size:"sm",children:c.jsx(jp,{})}),e]}),c.jsx(ye,{onClick:()=>s(!n),type:"button",className:"ml-auto px-1",size:"sm",children:c.jsx(ve,{size:"sm",children:c.jsx($a,{className:K("transition-all",n?"rotate-180":"rotate-0")})})})]}),n&&c.jsx("div",{className:r?"flex flex-col gap-1 [&>*]:border-dashed [&>*]:border-l [&>*]:border-l-border1 [&>*]:pl-4":"",children:t})]})},ren=({label:e,children:t,onAddItem:r})=>c.jsxs("div",{children:[c.jsxs("div",{className:"flex gap-2 justify-between",children:[c.jsxs(ze,{as:"h3",variant:"ui-sm",className:"text-neutral3 pb-2 flex items-center gap-1",children:[c.jsx(ve,{size:"sm",children:c.jsx(LAt,{})}),e]}),c.jsx(nc,{children:c.jsxs(dn,{delayDuration:0,children:[c.jsx(pn,{asChild:!0,children:c.jsx("button",{onClick:r,type:"button",className:"text-neutral3 bg-surface3 rounded-md p-1 hover:bg-surface4 hover:text-neutral6 h-icon-sm w-icon-sm",children:c.jsx(ve,{size:"sm",children:c.jsx(Qs,{})})})}),c.jsx(sn,{children:"Add item"})]})})]}),c.jsx("div",{className:"flex flex-col gap-1",children:t})]}),nen=({children:e,onRemove:t})=>c.jsxs("div",{className:"pl-4 border-l border-border1",children:[e,c.jsxs(ye,{onClick:t,type:"button",children:[c.jsx(ve,{size:"sm",children:c.jsx(yie,{})}),"Delete"]})]}),sen=({inputProps:e,field:t,error:r,id:n})=>{const{key:s,onChange:a,...i}=e,[o,l]=E.useState(()=>Object.entries(t.default||{}).map(([m,g])=>({id:m||No(),key:m,value:g})));E.useEffect(()=>{o.length===0&&l([{id:No(),key:"",value:""}])},[o]);const u=E.useCallback(m=>{const g=m.reduce((b,v)=>(v.key&&(b[v.key]=v.value),b),{});a?.({target:{value:g,name:e.name}})},[a,e.name]),d=(m,g,b)=>{l(v=>v.map(S=>S.id===m?{...S,[g]:b}:S))},p=()=>{u(o)},f=()=>{const m=[...o,{id:No(),key:"",value:""}];l(m),u(m)},h=m=>{const g=o.filter(b=>b.id!==m);g.length===0&&g.push({id:No(),key:"",value:""}),l(g),u(g)};return c.jsxs("div",{className:"space-y-3",children:[o.map(m=>c.jsxs("div",{className:"relative space-y-2 rounded-lg border p-4",children:[c.jsx(ye,{type:"button",className:"absolute right-2 top-2",onClick:()=>h(m.id),children:c.jsx(yie,{className:"h-4 w-4"})}),c.jsxs("div",{className:"space-y-2 pt-6",children:[c.jsx(qr,{placeholder:"Key",value:m.key,onChange:g=>d(m.id,"key",g.target.value),onBlur:p}),c.jsx(qr,{placeholder:"Value",value:m.value,onChange:g=>d(m.id,"value",g.target.value),onBlur:p})]})]},m.id)),c.jsxs(ye,{type:"button",className:"w-full",onClick:f,children:[c.jsx(Qs,{className:"mr-2 h-4 w-4"}),"Add Key-Value Pair"]})]})},aen=({field:e,path:t})=>{const{uiComponents:r}=uue();return c.jsx(r.ObjectWrapper,{label:KM(e),field:e,children:Object.entries(e.schema).map(([n,s])=>c.jsx(N0,{field:s,path:[...t,s.key]},`${t.join(".")}.${s.key}`))})},ien=({field:e,path:t})=>{const{uiComponents:r}=uue(),{control:n}=H1(),{fields:s,append:a,remove:i}=QNr({control:n,name:t.join(".")}),o=e.schema?.[0]?.type;let l;return o==="object"?l={}:o==="array"?l=[]:l=null,c.jsx(r.ArrayWrapper,{label:KM(e),field:e,onAddItem:()=>a(l),children:s.map((u,d)=>c.jsx(r.ArrayElementWrapper,{onRemove:()=>i(d),index:d,children:c.jsx(N0,{field:e.schema[0],path:[...t,d.toString()]})},u.id))})},N0=({field:e,path:t})=>{const{formComponents:r,uiComponents:n}=uue(),{register:s,formState:{errors:a},getValues:i}=H1(),o=t.join("."),l=OIr(a,t)?.message,u=i(o),d=e.fieldConfig?.fieldWrapper||n.FieldWrapper;let p=()=>c.jsx(n.ErrorMessage,{error:`[AutoForm Configuration Error] No component found for type "${e.type}" nor a fallback`});return e.type==="array"?p=ien:e.type==="object"?p=aen:e.type in r?p=r[e.type]:"fallback"in r&&(p=r.fallback),c.jsx(d,{label:KM(e),error:l,id:o,field:e,children:c.jsx(p,{label:KM(e),field:e,value:u,error:l,id:o,path:t,inputProps:{required:e.required,error:l,key:`${o}-input`,...e.fieldConfig?.inputProps,...s(o)}},o)})},oen=({field:e,inputProps:t})=>{const r=t.name?.split(".")??[];return e.schema?.map((n,s)=>c.jsxs("div",{children:[c.jsx(N0,{field:n,path:r},r.join(".")),s<(e.schema?.length??0)-1&&c.jsx(ze,{variant:"ui-xs",className:"text-center",children:"OR"})]},n.key))},len=({field:e,path:t})=>{const{watch:r}=H1(),n=t.join("."),s=r(n),i=(e.schema?.flatMap(f=>f.schema||[])||[])?.filter(f=>f.fieldConfig?.customData?.isLiteral)||[],o=i[0],l=i?.reduce((f,h)=>{const m=(h.fieldConfig?.customData?.literalValues??[]).map(g=>[g,g]);return f.options?.push(...m),f},{key:o.key,required:o.required,type:"select",default:o.default,description:o.description,options:[],fieldConfig:o.fieldConfig}),u=e.schema?.reduce((f,h)=>{const m=h.schema?.find(v=>v.fieldConfig?.customData?.isLiteral),g=m?.fieldConfig?.customData?.literalValues?.[0],b=h.schema?.filter(v=>v.key!==m?.key)??[];return g&&(f[g]=b),f},{}),d=e.schema?.filter(f=>!f.schema?.find(m=>m.fieldConfig?.customData?.isLiteral)),p=s?.[l.key];return c.jsxs("div",{children:[c.jsx(N0,{field:l,path:[...t,l.key]},`${n}.${l.key}`),p&&u?.[p]&&u[p].map(f=>c.jsx(N0,{field:f,path:[...t,f.key]},`${n}.${f.key}`)),d&&d.map(f=>c.jsx(N0,{field:f,path:[...t,f.key]},`${n}.${f.key}`))]},e.key)};function _4(e){const t={};for(const r in e){const n=e[r];if(![null,void 0,"",[],{}].includes(n))if(Array.isArray(n)){const a=n.map(i=>{if(typeof i=="object"){const o=_4(i);return Object.keys(o).length>0?o:null}return i}).filter(i=>i!==null);a.length>0&&(t[r]=a)}else if(typeof n=="object"){const s=_4(n);Object.keys(s).length>0&&(t[r]=s)}else t[r]=n}return t}function vm(e){return Function("z",`"use strict";return (${e});`)(VEt)}function cen({schema:e,onSubmit:t=()=>{},defaultValues:r,values:n,children:s,uiComponents:a,formComponents:i,withSubmit:o=!1,onFormInit:l=()=>{},formProps:u={}}){const d=E.useMemo(()=>ZNr(e),[e]),p=UI({defaultValues:{...WNr(e),...r},values:n});E.useEffect(()=>{l&&l(p)},[l,p]);const f=E.useCallback(async m=>{const g=_4(m),b=e.validateSchema(g);if(b.success)await t(b.data,p);else{p.clearErrors();let v=!1;b.errors?.forEach(S=>{const w=S.path.join(".");p.setError(w,{type:"custom",message:S.message},{shouldFocus:!v}),v=!0;const k=S.path?.slice?.(0,-1);k?.length>0&&p.setError(k.join("."),{type:"custom",message:S.message})})}},[e,t,p]),h=E.useMemo(()=>({schema:d,uiComponents:a,formComponents:i}),[d,a,i]);return c.jsx(TNr,{...p,children:c.jsx(sIr,{value:h,children:c.jsxs(a.Form,{onSubmit:p.handleSubmit(f),...u,children:[d.fields.map(m=>c.jsx(N0,{field:m,path:[m.key]},m.key)),s,o&&c.jsx(a.SubmitButton,{children:"Submit"})]})})})}const uen={Form:FJr,FieldWrapper:zJr,ErrorMessage:UJr,SubmitButton:VJr,ObjectWrapper:ten,ArrayWrapper:ren,ArrayElementWrapper:nen};function den({uiComponents:e,formComponents:t,readOnly:r,...n}){const s=E.useMemo(()=>({...uen,...e}),[e]),a=E.useMemo(()=>{const i=o=>r===void 0?o:{...o,readOnly:r};return{string:o=>c.jsx(HJr,{...o,inputProps:i(o.inputProps)}),number:o=>c.jsx(QJr,{...o,inputProps:i(o.inputProps)}),boolean:o=>c.jsx(GJr,{...o,inputProps:i(o.inputProps)}),date:o=>c.jsx(JJr,{...o,inputProps:i(o.inputProps)}),select:o=>c.jsx(een,{...o,inputProps:i(o.inputProps)}),record:o=>c.jsx(sen,{...o,inputProps:i(o.inputProps)}),union:o=>c.jsx(oen,{...o,inputProps:i(o.inputProps)}),"discriminated-union":o=>c.jsx(len,{...o,inputProps:i(o.inputProps)}),...t}},[r,t]);return c.jsx(cen,{...n,uiComponents:s,formComponents:a})}const pen=Vpe("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Bt=E.forwardRef(({className:e,...t},r)=>c.jsx(Grt,{ref:r,className:K(pen(),e),...t}));Bt.displayName=Grt.displayName;function Rpt(e){return e!=null&&typeof e=="object"&&"_zod"in e}function Kl(e){if(!(e==null||typeof e!="object"))return Rpt(e)?e._zod.def:e._def}function fen(e){return typeof e.isOptional=="function"?e.isOptional():typeof e.safeParse=="function"?e.safeParse(void 0).success:!1}function Rf(e){if(e.shape&&typeof e.shape=="object")return e.shape;const t=Kl(e);if(t?.shape)return typeof t.shape=="function"?t.shape():t.shape}function Ire(e){const t=Kl(e);return t?"innerType"in t?Ire(t.innerType):"schema"in t?Ire(t.schema):e:e}function hen(e){const t=Kl(e);if(t?.entries)return t.entries;if(t?.values)return t.values}function men(e){const t=Kl(e);return t?.element??t?.type}function Ppt(e){const t=Kl(e);if(t?.values!==void 0)return Array.isArray(t.values)?t.values[0]:t.values;if(t?.value!==void 0)return t.value}function gen(e){const t=Kl(e);if(t?.values!==void 0)return t.values;if(t?.value!==void 0)return[t.value]}function yen(e){const t=Kl(e);if(t?.defaultValue!==void 0)return typeof t.defaultValue=="function"?t.defaultValue():t.defaultValue}function $pt(e){return Kl(e)?.options}function jre(e){const t=Kl(e);if(t?.left&&t?.right)return{left:t.left,right:t.right};if(e.def?.left&&e.def?.right)return{left:e.def.left,right:e.def.right}}function ben(e){return Kl(e)?.checks??[]}function ven(e){return e.some(t=>{if(Rpt(t)){const r=Kl(t);return r?.check==="string_format"&&r?.format==="datetime"}return t.kind==="datetime"})}function xen(e,t){if(t?.fieldType)return t.fieldType;const r=e?.constructor?.name?.slice(1),n=Kl(e),s=typeof n?.type=="string"?`Zod${n.type.charAt(0).toUpperCase()}${n.type.slice(1)}`:void 0,a=n?.typeName??s??r;if(a==="ZodObject"||a==="ZodIntersection")return"object";if(a==="ZodNumber")return"number";if(a==="ZodBoolean")return"boolean";if(a==="ZodString"){const i=ben(e);return ven(i)?"date":"string"}if(a==="ZodEnum"||a==="ZodNativeEnum")return"select";if(a==="ZodArray")return"array";if(a==="ZodRecord")return"record";if(a==="ZodUnion"){const i=$pt(e);return i&&i.every(l=>{const u=Rf(l);return u?Object.values(u).some(d=>{const p=d?.constructor?.name?.slice(1),f=Kl(d);return p==="ZodLiteral"||f?.typeName==="ZodLiteral"||f?.type==="literal"}):!1})?"discriminated-union":"union"}if(a==="ZodDiscriminatedUnion")return"discriminated-union";if(a==="ZodLiteral"){const i=Ppt(e);return typeof i=="number"?"number":typeof i=="boolean"?"boolean":"string"}return"string"}function Vw(e){const t=Kl(e);if(!t)return;const r=yen(e);if(r!==void 0)return r;const n=Ppt(e);if(n!==void 0&&(t.typeName==="ZodLiteral"||t.type==="literal"||e?.constructor?.name?.slice(1)==="ZodLiteral"))return n;if("innerType"in t)return Vw(t.innerType);if("schema"in t)return Vw(t.schema);if(Rf(e)&&!("left"in t))return U$(e);if("left"in t&&"right"in t){const a=Rf(t.left),i=Rf(t.right),o=a?U$(t.left):Vw(t.left),l=i?U$(t.right):Vw(t.right);return{...o,...l}}}function U$(e){const t=Rf(e);if(!t)return{};const r={};for(const[n,s]of Object.entries(t)){const a=Vw(s);a!==void 0&&(r[n]=a)}return r}function Rre(e){const t=Kl(e);if(t){if(t.typeName==="ZodEffects"&&t.effect?.type==="refinement"){const r=t.effect?.refinement;if(r){const n=Object.getOwnPropertySymbols(r);for(const s of n){const a=r[s];if(a&&typeof a=="object")return a}}}if("innerType"in t)return Rre(t.innerType);if("schema"in t)return Rre(t.schema)}}function xb(e,t){const r=Ire(t),n=Rre(t);let s=xen(r,n);const a=Vw(t),i=hen(r);let o=[];i&&(Array.isArray(i)?o=i.map(v=>[v,v]):o=Object.entries(i));let l=[];const u=Rf(r);u&&!jre(r)&&(l=Object.entries(u).map(([v,S])=>xb(v,S)));const d=$pt(r),p=r?.constructor?.name?.slice(1),h=Kl(r)?.typeName??p;(h==="ZodUnion"||h==="ZodDiscriminatedUnion")&&d&&(l=Object.entries(d).map(([v,S])=>xb(v,S)));const m=jre(r);if(m){const{left:v,right:S}=m;let w=[],k=[];const _=Rf(v);if(_)w=Object.entries(_).map(([T,A])=>xb(T,A));else{const T=xb(e,v);w=T.schema??[T],s=T.type}const C=Rf(S);if(C)k=Object.entries(C).map(([T,A])=>xb(T,A));else{const T=xb(e,S);k=T.schema??[T],s=T.type}l=[...w,...k]}if(h==="ZodArray"){const v=men(r);v&&(l=[xb("0",v)])}const g=h==="ZodLiteral",b=g?gen(r):void 0;return{key:e,type:s,required:!fen(t),default:a,description:r.description,fieldConfig:g||Object.keys(n??{})?.length>0?{...n,customData:{...n?.customData??{},...g?{isLiteral:g,literalValues:b}:{}}}:void 0,options:o,schema:l}}function Sen(e){const t=Rf(e);return t?{fields:Object.entries(t).map(([n,s])=>xb(n,s))}:{fields:[]}}class wen{_schema;constructor(t){if(!t)throw new Error("CustomZodProvider: schema is required");this._schema=t}getDefaultValues(){return U$(this._schema)}validateSchema(t){const r=_4(t);try{const n=this._schema.safeParse(r);if(n.success)return{success:!0,data:n.data};{const s=n.error;return{success:!1,errors:(s.issues??s.errors??[]).map(i=>({path:i.path,message:i.message}))}}}catch(n){throw n}}parseSchema(){return Sen(this._schema)}}function Pre(e){const t=Rf(e);if(t)return Object.keys(t).length===0;const r=jre(e);return r?Pre(r.left)&&Pre(r.right):!1}function Een(e){return Rf(e)!==void 0}function Qpe({schema:e,onSubmit:t,onValuesChange:r,defaultValues:n,isSubmitLoading:s,submitButtonLabel:a,className:i,readOnly:o,children:l}){const u=E.useRef(null),d=!Een(e),p=E.useRef(r);E.useEffect(()=>{p.current=r},[r]),E.useEffect(()=>()=>{u.current?.unsubscribe()},[]);const f=E.useCallback(w=>{u.current?.unsubscribe(),p.current&&(u.current=w.watch(k=>{const _=d?k&&Object.prototype.hasOwnProperty.call(k,"​")?k["​"]:{}:k;p.current?.(_)}))},[d]),h=E.useMemo(()=>{if(!e)return null;const w=k=>Pre(k)?Fn({}):d?Fn({"​":k}):k;return new wen(w(e))},[e,d]),m=E.useMemo(()=>({SubmitButton:({children:w})=>t?c.jsx(ye,{variant:"light",className:"w-full",size:"md",disabled:s,children:s?c.jsx(ve,{children:c.jsx(Ii,{className:"animate-spin"})}):a||w}):null}),[t,s,a]),g=E.useMemo(()=>({Label:({value:w})=>c.jsx(Bt,{className:"text-sm font-normal",children:w})}),[]),b=E.useMemo(()=>({className:i,noValidate:!0}),[i]),v=E.useMemo(()=>d?n===void 0?void 0:{"​":n}:n,[d,n]),S=E.useCallback(async w=>{const k=d?w&&Object.prototype.hasOwnProperty.call(w,"​")?w["​"]:{}:w;await t?.(k)},[t,d]);return h?c.jsx(den,{schema:h,onSubmit:S,onFormInit:f,defaultValues:v,formProps:b,uiComponents:m,formComponents:g,withSubmit:!0,readOnly:o,children:l}):(console.error("no form schema found"),null)}const uj=E.forwardRef(({className:e,...t},r)=>c.jsx(int,{className:K("grid gap-2",e),...t,ref:r}));uj.displayName=int.displayName;const cd=E.forwardRef(({className:e,...t},r)=>c.jsx(ont,{ref:r,className:K("aspect-square h-4 w-4 rounded-full border border-neutral3 text-neutral6","shadow-sm",Wr.all,"hover:border-neutral5 hover:shadow-md",sh,"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-neutral3 disabled:hover:shadow-sm","data-[state=checked]:border-accent1 data-[state=checked]:shadow-glow-accent1",e),...t,children:c.jsx($Ir,{className:K("flex items-center justify-center","data-[state=checked]:animate-in data-[state=checked]:zoom-in-50 data-[state=checked]:duration-150"),children:c.jsx(JBe,{className:"h-2 w-2 fill-accent1 text-accent1"})})}));cd.displayName=ont.displayName;const Gpe=({schema:e,defaultValues:t,withoutSubmit:r,isSubmitLoading:n,submitButtonLabel:s,onSubmit:a,children:i,isProcessorWorkflow:o})=>{const[l,u]=E.useState(o?"simple":"form"),[d,p]=E.useState(!1);return E.useEffect(()=>{p(!0)},[]),d?c.jsxs("div",{children:[c.jsx(uj,{disabled:n,value:l,onValueChange:f=>u(f),className:"pb-4",children:c.jsxs("div",{className:"flex flex-row gap-4",children:[o&&c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(cd,{value:"simple",id:"simple"}),c.jsx(Bt,{htmlFor:"simple",className:"!text-neutral3 text-ui-sm",children:"Simple"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(cd,{value:"form",id:"form"}),c.jsx(Bt,{htmlFor:"form",className:"!text-neutral3 text-ui-sm",children:"Form"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(cd,{value:"json",id:"json"}),c.jsx(Bt,{htmlFor:"json",className:"!text-neutral3 text-ui-sm",children:"JSON"})]})]})}),c.jsx("div",{className:K({"opacity-50 pointer-events-none":n}),children:l==="simple"&&o?c.jsx(Oen,{schema:e,defaultValues:t,isSubmitLoading:n,submitButtonLabel:s,onSubmit:a,withoutSubmit:r,children:i}):l==="form"?c.jsx(Qpe,{schema:e,defaultValues:t,isSubmitLoading:n,submitButtonLabel:s,onSubmit:r?void 0:a,children:i}):c.jsx(ken,{schema:e,defaultValues:t,isSubmitLoading:n,submitButtonLabel:s,onSubmit:a,withoutSubmit:r,children:i})})]}):null},ken=({schema:e,defaultValues:t,isSubmitLoading:r,submitButtonLabel:n,onSubmit:s,withoutSubmit:a,children:i})=>{const[o,l]=E.useState([]),[u,d]=E.useState(()=>JSON.stringify(t??{},null,2)),p=()=>{l([]);try{const h=e.safeParse(JSON.parse(u));h.success?s(h.data):l(h.error.issues.map(m=>`[${m.path.join(".")}] ${m.message}`))}catch{l(["Invalid JSON provided"])}};let f={};try{f=JSON.parse(u)}catch{f={}}return c.jsxs("div",{className:"flex flex-col gap-4",children:[o.length>0&&c.jsxs("div",{className:"border border-accent2 rounded-lg p-2",children:[c.jsxs(ze,{as:"p",variant:"ui-md",className:"text-accent2 font-semibold",children:[o.length," errors found"]}),c.jsx("ul",{className:"list-disc list-inside",children:o.map((h,m)=>c.jsx("li",{className:"text-ui-sm text-accent2",children:h},m))})]}),c.jsx(Wa,{data:f,onChange:d}),i,a?null:c.jsx(ye,{variant:"light",onClick:p,className:"w-full",size:"lg",children:r?c.jsx(Ii,{className:"animate-spin"}):n})]})},FPe=[{value:"input",label:"Input - Process input messages before LLM"},{value:"inputStep",label:"Input Step - Process at each agentic loop step"},{value:"outputStream",label:"Output Stream - Process streaming chunks"},{value:"outputResult",label:"Output Result - Process complete output"},{value:"outputStep",label:"Output Step - Process after each LLM response"}],Oen=({schema:e,defaultValues:t,isSubmitLoading:r,submitButtonLabel:n,onSubmit:s,withoutSubmit:a,children:i})=>{const[o,l]=E.useState("Hello, this is a test message."),[u,d]=E.useState("input"),[p,f]=E.useState([]),h=()=>{f([]);const g=u==="outputStep"||u==="outputResult"?"assistant":"user",b={messages:[{id:crypto.randomUUID(),role:g,createdAt:new Date().toISOString(),content:{format:2,parts:[{type:"text",text:o}]}}],phase:u};try{const v=e.safeParse(b);v.success?s(v.data):f(v.error.issues.map(S=>`[${S.path.join(".")}] ${S.message}`))}catch{f(["Error processing input"])}};return c.jsxs("div",{className:"flex flex-col gap-4",children:[p.length>0&&c.jsxs("div",{className:"border border-accent2 rounded-lg p-2",children:[c.jsxs(ze,{as:"p",variant:"ui-md",className:"text-accent2 font-semibold",children:[p.length," errors found"]}),c.jsx("ul",{className:"list-disc list-inside",children:p.map((m,g)=>c.jsx("li",{className:"text-ui-sm text-accent2",children:m},g))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ze,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Phase"}),c.jsxs(Ro,{value:u,onValueChange:d,children:[c.jsx(go,{className:"w-full",children:c.jsx(Po,{placeholder:"Select phase"})}),c.jsx(yo,{children:FPe.map(m=>c.jsx(Ms,{value:m.value,children:m.value},m.value))})]}),c.jsx(ze,{variant:"ui-xs",className:"text-neutral4",children:FPe.find(m=>m.value===u)?.label})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ze,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Test Message"}),c.jsx("textarea",{value:o,onChange:m=>l(m.target.value),placeholder:"Enter a test message...",rows:4,className:"w-full bg-transparent border border-border1 rounded-md p-3 text-ui-sm text-neutral6 placeholder:text-neutral3 focus:outline-none focus:ring-2 focus:ring-accent1"})]}),i,a?null:c.jsx(ye,{variant:"light",onClick:h,className:"w-full",size:"lg",children:r?c.jsx(Ii,{className:"animate-spin"}):n})]})},wE=async e=>await lnt.format(e,{semi:!1,parser:"json",printWidth:80,tabWidth:2,plugins:[cst,Hst]}),aN=e=>{try{const t=JSON.parse(e);return!!t&&typeof t=="object"}catch{return!1}},Zpe=E.createContext(null);function Wpe({children:e}){const{requestContext:t}=Ss(),[r,n]=E.useState(t),s=i=>n(i),a=()=>{n({})};return c.jsx(Zpe.Provider,{value:{schemaValues:r,setSchemaValues:s,clearSchemaValues:a},children:e})}function Mpt(){const e=E.useContext(Zpe);if(!e)throw new Error("useSchemaRequestContext must be used within a SchemaRequestContextProvider");return e}function Fc(){const{requestContext:e}=Ss(),r=E.useContext(Zpe)?.schemaValues??{};return{...e??{},...r}}const pC="text-neutral3 hover:text-neutral6",BPe=e=>{try{return e==null?"{}":JSON.stringify(e,null,2)}catch{return"{}"}},CY=({label:e,value:t,onChange:r,helperText:n,exampleCode:s})=>{const a=sx(),{handleCopy:i}=Zf({text:t}),{handleCopy:o}=Zf({text:s??"{}"}),[l,u]=E.useState(null),[d,p]=E.useState(!1),[f,h]=E.useState(!1),m=async()=>{if(u(null),!t.trim()){r("{}");return}if(!aN(t)){u("Invalid JSON");return}try{const g=await wE(t);r(g)}catch{u("Unable to format JSON")}};return c.jsxs(c.Fragment,{children:[f&&c.jsxs("div",{className:"border border-border1 rounded-lg bg-surface3 p-3 space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(ze,{as:"p",variant:"ui-sm",className:"text-neutral3",children:["Example ",e]}),c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx("button",{type:"button",onClick:o,className:pC,"aria-label":"Copy example JSON",children:c.jsx(ve,{children:c.jsx(Ql,{})})})}),c.jsx(sn,{children:"Copy example JSON"})]})]}),c.jsx(Sd,{value:s,theme:a,extensions:[hd],className:"h-[150px] w-full overflow-y-scroll bg-surface3 rounded-lg overflow-scroll p-3"})]}),c.jsxs(CO,{className:"border border-border1 rounded-lg bg-surface3",open:d,onOpenChange:p,children:[c.jsxs("div",{className:"flex items-center justify-between w-full px-3",children:[c.jsxs("div",{children:[c.jsx(ze,{as:"label",variant:"ui-md",className:"text-neutral3",children:e}),n&&c.jsx(ze,{variant:"ui-xs",className:"text-neutral3",children:n})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx("button",{type:"button",onClick:m,className:pC,"aria-label":"Format JSON",children:c.jsx(ve,{children:c.jsx(jp,{})})})}),c.jsx(sn,{children:"Format JSON"})]}),c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx("button",{type:"button",onClick:i,className:pC,"aria-label":"Copy JSON",children:c.jsx(ve,{children:c.jsx(Ql,{})})})}),c.jsx(sn,{children:"Copy JSON"})]}),s&&c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx("button",{type:"button",onClick:()=>h(!f),className:pC,"aria-label":f?"Hide example JSON":"View example JSON",children:c.jsx(ve,{children:f?c.jsx(eNt,{}):c.jsx(wp,{})})})}),c.jsx(sn,{children:"View example JSON"})]}),c.jsx(oS,{asChild:!0,children:c.jsx("button",{type:"button",className:pC,"aria-label":d?`Collapse ${e}`:`Expand ${e}`,children:c.jsx(ve,{className:K("transition-transform",d?"rotate-0":"-rotate-90"),children:c.jsx($a,{})})})})]})]}),c.jsxs(lS,{className:"space-y-2",children:[c.jsx(Sd,{value:t,onChange:r,theme:a,extensions:[hd],className:"h-[260px] overflow-y-scroll bg-surface3 rounded-lg overflow-hidden p-3"}),l&&c.jsx(ze,{variant:"ui-sm",className:"text-accent2",children:l})]})]})]})},TY=({stepKey:e,closeModal:t,isPerStepRun:r,isContinueRun:n,buttonText:s="Start time travel",inputData:a})=>{const{result:i,workflow:o,timeTravelWorkflowStream:l,runId:u,workflowId:d,setDebugMode:p}=E.useContext(Fm),f=Fc(),h=a?{payload:a}:i?.steps?.[e],[m,g]=E.useState(()=>"{}"),[b,v]=E.useState(()=>"{}"),[S,w]=E.useState(()=>"{}"),[k,_]=E.useState(null),[C,T]=E.useState(!1),A=o?.allSteps?.[e],{schema:N}=E.useMemo(()=>{if(!A?.inputSchema)return{schema:vc(Tr(),P0())};try{const R=Av(A.inputSchema),$=o?.stateSchema?vm(fm(Av(o.stateSchema))):null,F=vm(fm(R));return{schema:$?Fn({inputData:F,initialState:$.optional()}):F,schemaError:null}}catch(R){return console.error("Failed to parse step schema",R),{schema:vc(Tr(),P0())}}},[A?.inputSchema,o?.stateSchema]),I=async R=>{_(null),T(!0);try{const $=m.trim()?JSON.parse(m):{},F=b.trim()?JSON.parse(b):{},L=S.trim()?JSON.parse(S):{},{initialState:z,inputData:q}=R??{},H=o?.stateSchema?q:R,V={runId:u,workflowId:d,step:e,inputData:H,initialState:z,resumeData:Object.keys($)?.length>0?$:void 0,context:Object.keys(F)?.length>0?F:void 0,nestedStepsContext:Object.keys(L)?.length>0?L:void 0,requestContext:f,...n?{perStep:!1}:{}};n&&p(!1),l(V),t()}catch($){console.error("Invalid JSON provided",$),_($ instanceof Error?$.message:"Error time traveling workflow")}finally{T(!1)}};return c.jsx(nc,{children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(ze,{as:"p",variant:"ui-lg",className:"text-neutral3",children:"Input data"}),c.jsxs(ze,{variant:"ui-xs",className:"text-neutral3",children:["Step: ",e]})]}),c.jsx(Gpe,{schema:N,defaultValues:h?.payload,isSubmitLoading:C,submitButtonLabel:s,onSubmit:I,children:c.jsxs("div",{className:"space-y-4 pb-4",children:[r||n?null:c.jsxs(c.Fragment,{children:[c.jsx(CY,{label:"Resume Data (JSON)",value:m,onChange:g,helperText:"Provide any resume payloads that should be passed to the step."}),c.jsx(CY,{label:"Context (JSON)",value:b,onChange:v,helperText:"Only include top level steps (no nested workflow steps) that are required in the time travel execution.",exampleCode:BPe({stepId:{status:"success",payload:{value:"test value"},output:{value:"test output"}}})}),c.jsx(CY,{label:"Nested Step Context (JSON)",value:S,onChange:w,helperText:"Includes nested workflow steps that are required in the time travel execution.",exampleCode:BPe({nestedWorkflowId:{stepId:{status:"success",payload:{value:"test value"},output:{value:"test output"}}}})})]}),k&&c.jsx(ze,{variant:"ui-sm",className:"text-accent2",children:k})]})})]})})},Xpe=({input:e,output:t,resumeData:r,suspendOutput:n,error:s,tripwire:a,mapConfig:i,stepName:o,stepId:l,onShowNestedGraph:u,status:d,stepKey:p,stepsFlow:f})=>{const[h,m]=E.useState(!1),[g,b]=E.useState(!1),[v,S]=E.useState(!1),[w,k]=E.useState(!1),[_,C]=E.useState(!1),[T,A]=E.useState(!1),[N,I]=E.useState(!1),[R,$]=E.useState(!1),{withoutTimeTravel:F,debugMode:L,result:z,runSnapshot:q,timeTravelWorkflowStream:H,runId:V,workflowId:G,setDebugMode:M}=E.useContext(Fm),{showMapConfig:X,stepDetail:U,closeStepDetail:j}=Q6(),Q=Fc(),Z=z?.status??q?.status,J="max-w-4xl w-full",ee=!F&&p&&!i&&Z!=="running"&&Z!=="paused",te=p&&L&&Z==="paused",se=E.useMemo(()=>{if(!p||!te)return;const xe=f?.[p]??[];if(xe.length===0)return;if(xe.length>1)return{hasMultiSteps:!0,input:xe.reduce((Ce,oe)=>(z?.steps?.[oe]?.status==="success"&&(Ce[oe]=z?.steps?.[oe].output),Ce),{})};const Ie=xe[0];if(z?.steps?.[Ie]?.status==="success")return{hasMultiSteps:!1,input:z?.steps?.[Ie].output}},[p,f,te,z]),ce=te&&se&&!z?.steps[p],Se=U?.type==="map-config"&&U?.stepName===o,W=U?.type==="nested-graph"&&U?.stepName===o,ne="ring-2 ring-accent1 ring-offset-1 ring-offset-transparent",ae=()=>{Se?j():X({stepName:o,stepId:l,mapConfig:i})},ge=()=>{W?j():u?.()},le=xe=>{const Ie={runId:V,workflowId:G,step:p,inputData:se?.hasMultiSteps?void 0:se?.input,requestContext:Q,...xe?{perStep:!1}:{},...se?.hasMultiSteps?{context:Object.keys(se.input)?.reduce((Ce,oe)=>(Ce[oe]={output:se.input[oe]},Ce),{})}:{}};xe&&M(!1),H(Ie)};return c.jsx(c.Fragment,{children:(e||t||s||a||i||r||u||ee||ce)&&c.jsxs("div",{className:K("flex flex-wrap items-center bg-surface4 border-t border-border1 px-2 py-1 gap-2 rounded-b-lg",d==="success"&&"bg-accent1Dark",d==="failed"&&"bg-accent2Dark",d==="tripwire"&&"bg-amber-900/40 border-amber-500/20",d==="suspended"&&"bg-accent3Dark",d==="waiting"&&"bg-accent5Dark",d==="running"&&"bg-accent6Dark"),children:[u&&c.jsx(ye,{onClick:ge,className:K(W&&ne),size:"sm",children:"View nested graph"}),ee&&c.jsxs(c.Fragment,{children:[c.jsx(ye,{onClick:()=>A(!0),size:"sm",children:"Time travel"}),c.jsx(ea,{open:T,onOpenChange:A,children:c.jsxs(Ls,{className:J,children:[c.jsxs(ta,{children:[c.jsxs(Fs,{children:["Time travel to ",p]}),c.jsx(ni,{children:"Time travel to a specific workflow step"})]}),c.jsx(ra,{className:"max-h-[600px]",children:c.jsx(TY,{stepKey:p,closeModal:()=>A(!1)})})]})})]}),ce&&c.jsxs(c.Fragment,{children:[c.jsx(ye,{onClick:()=>{i?le():$(!0)},size:"sm",children:"Run step"}),c.jsx(ea,{open:R,onOpenChange:$,children:c.jsxs(Ls,{className:J,children:[c.jsxs(ta,{children:[c.jsxs(Fs,{children:["Run step ",p]}),c.jsx(ni,{children:"Run a specific workflow step"})]}),c.jsx(ra,{className:"max-h-[600px]",children:c.jsx(TY,{stepKey:p,closeModal:()=>$(!1),isPerStepRun:!0,buttonText:"Run step",inputData:se?.input})})]})}),c.jsx(ye,{onClick:()=>{i?le(!0):I(!0)},size:"sm",children:"Continue run"}),c.jsx(ea,{open:N,onOpenChange:I,children:c.jsxs(Ls,{className:J,children:[c.jsxs(ta,{children:[c.jsxs(Fs,{children:["Continue run ",p]}),c.jsx(ni,{children:"Continue the workflow run from this step"})]}),c.jsx(ra,{className:"max-h-[600px]",children:c.jsx(TY,{stepKey:p,closeModal:()=>I(!1),isContinueRun:!0,buttonText:"Continue run",inputData:se?.input})})]})})]}),i&&c.jsx(ye,{onClick:ae,className:K(Se&&ne),size:"sm",children:"Map config"}),e&&c.jsxs(c.Fragment,{children:[c.jsx(ye,{onClick:()=>m(!0),size:"sm",children:"Input"}),c.jsx(ea,{open:h,onOpenChange:m,children:c.jsxs(Ls,{className:J,children:[c.jsxs(ta,{children:[c.jsxs(Fs,{children:[o," input"]}),c.jsx(ni,{children:"View the input data for this step"})]}),c.jsx(ra,{children:c.jsx(Ow,{data:e})})]})})]}),r&&c.jsxs(c.Fragment,{children:[c.jsx(ye,{onClick:()=>S(!0),size:"sm",children:"Resume data"}),c.jsx(ea,{open:v,onOpenChange:S,children:c.jsxs(Ls,{className:J,children:[c.jsxs(ta,{children:[c.jsxs(Fs,{children:[o," resume data"]}),c.jsx(ni,{children:"View the resume data for this step"})]}),c.jsx(ra,{children:c.jsx(Ow,{data:r})})]})})]}),(t??n)&&c.jsxs(c.Fragment,{children:[c.jsx(ye,{onClick:()=>b(!0),size:"sm",children:"Output"}),c.jsx(ea,{open:g,onOpenChange:b,children:c.jsxs(Ls,{className:J,children:[c.jsxs(ta,{children:[c.jsxs(Fs,{children:[o," output"]}),c.jsx(ni,{children:"View the output data for this step"})]}),c.jsx(ra,{children:c.jsx(Ow,{data:t??n})})]})})]}),s&&c.jsxs(c.Fragment,{children:[c.jsx(ye,{onClick:()=>k(!0),size:"sm",children:"Error"}),c.jsx(ea,{open:w,onOpenChange:k,children:c.jsxs(Ls,{className:J,children:[c.jsxs(ta,{children:[c.jsxs(Fs,{children:[o," error"]}),c.jsx(ni,{children:"View the error details for this step"})]}),c.jsx(ra,{children:c.jsx(Ow,{data:s})})]})})]}),a&&c.jsxs(c.Fragment,{children:[c.jsx(ye,{onClick:()=>C(!0),className:"text-amber-400 hover:text-amber-300",size:"sm",children:"Tripwire"}),c.jsx(ea,{open:_,onOpenChange:C,children:c.jsxs(Ls,{className:J,children:[c.jsxs(ta,{children:[c.jsxs(Fs,{children:[o," tripwire"]}),c.jsx(ni,{children:"View the tripwire details for this step"})]}),c.jsx(ra,{children:c.jsx(Ow,{data:{reason:a.reason,retry:a.retry,metadata:a.metadata,processorId:a.processorId}})})]})})]})]})})};function Lpt({data:e}){const{conditions:t,previousStepId:r,nextStepId:n,withoutTopHandle:s}=e,[a,i]=E.useState(!0),[o,l]=E.useState(!1),u=t[0]?.type,d=(t.some(S=>S.fnString)||t?.length>1)&&u!=="else",{steps:p}=cj(),f=p[r],h=p[n],m=f?.status==="failed"&&f?.tripwire!==void 0,g=m?"tripwire":f?.status,{icon:b,color:v}=PPe(u);return c.jsxs(c.Fragment,{children:[!s&&c.jsx(Ou,{type:"target",position:Er.Top,style:{visibility:"hidden"}}),c.jsxs("div",{"data-workflow-node":!0,"data-workflow-step-status":g,"data-testid":"workflow-condition-node",className:K("bg-surface3 rounded-lg w-[300px] border border-border1",g==="success"&&h&&"bg-accent1Darker",g==="failed"&&h&&"bg-accent2Darker",g==="tripwire"&&h&&"bg-amber-950/40 border-amber-500/30",!f&&!!h?.status&&"bg-accent1Darker"),children:[c.jsxs(CO,{open:d?a:!0,onOpenChange:S=>{d&&i(S)},children:[c.jsxs(oS,{className:"flex items-center justify-between w-full px-3 py-2",children:[c.jsx(Ft,{icon:b?c.jsx(b,{className:"text-current",...v?{style:{color:v}}:{}}):null,children:u?.toUpperCase()}),d&&c.jsx(ve,{children:c.jsx($a,{className:K("transition-transform text-neutral3",{"transform rotate-180":a})})})]}),u==="else"?null:c.jsx(lS,{className:"flex flex-col gap-2 pb-2",children:t.map((S,w)=>{const k=S.conj||u,{icon:_,color:C}=PPe(k),T=w===0?null:c.jsx(Ft,{icon:_?c.jsx(_,{className:"text-current",...C?{style:{color:C}}:{}}):null,children:S.conj?.toLocaleUpperCase()||"WHEN"});return S.fnString?c.jsxs("div",{className:"px-3",children:[c.jsx(jNe,{theme:ate.oneDark,code:String(S.fnString).trim(),language:"javascript",children:({className:A,style:N,tokens:I,getLineProps:R,getTokenProps:$})=>c.jsx("pre",{className:K("relative font-mono p-3 w-full cursor-pointer rounded-lg text-xs !bg-surface4 whitespace-pre-wrap break-words",A,g==="success"&&h&&"!bg-accent1Dark",g==="failed"&&h&&"!bg-accent2Dark",g==="tripwire"&&h&&"!bg-amber-900/40"),onClick:()=>l(!0),style:N,children:I.map((F,L)=>c.jsxs("div",{...R({line:F}),children:[c.jsx("span",{className:"inline-block mr-2 text-neutral3",children:L+1}),F.map((z,q)=>c.jsx("span",{...$({token:z})},q))]},L))})}),c.jsx(ea,{open:o,onOpenChange:l,children:c.jsxs(Ls,{className:"max-w-[30rem]",children:[c.jsxs(ta,{children:[c.jsx(Fs,{className:"sr-only",children:"Condition Function"}),c.jsx(ni,{children:"View the condition function code"})]}),c.jsx(ra,{children:c.jsx(pi,{className:"w-full",maxHeight:"400px",children:c.jsx(jNe,{theme:ate.oneDark,code:String(S.fnString).trim(),language:"javascript",children:({className:A,style:N,tokens:I,getLineProps:R,getTokenProps:$})=>c.jsx("pre",{className:`${A} relative font-mono text-sm overflow-x-auto p-3 w-full rounded-lg mt-2 dark:bg-zinc-800`,style:{...N,backgroundColor:"#121212",padding:"0 0.75rem 0 0"},children:I.map((F,L)=>c.jsxs("div",{...R({line:F}),children:[c.jsx("span",{className:"inline-block mr-2 text-neutral3",children:L+1}),F.map((z,q)=>c.jsx("span",{...$({token:z})},q))]},L))})})})})]})})]},`${S.fnString}-${w}`):c.jsx(E.Fragment,{children:S.ref?.step?c.jsxs("div",{className:"flex items-center gap-1",children:[T,c.jsxs(ze,{variant:"ui-xs",className:" text-neutral3 flex-1",children:[S.ref.step.id||S.ref.step,"'s ",S.ref.path," ",Object.entries(S.query).map(([A,N])=>`${A} ${String(N)}`)]})]}):null},`${S.ref?.path}-${w}`)})})]}),c.jsx(Xpe,{stepName:n,input:f?.output,mapConfig:e.mapConfig,tripwire:m?f?.tripwire:void 0,status:h?g:void 0})]}),c.jsx(Ou,{type:"source",position:Er.Bottom,style:{visibility:"hidden"}})]})}const _en=(e,t)=>Number(e.toPrecision(t)),Fpt=({startedAt:e,endedAt:t})=>{const[r,n]=E.useState(e);E.useEffect(()=>{const a=setInterval(()=>{n(Date.now())},100);return()=>clearInterval(a)},[e]);const s=t?t-e:r-e;return c.jsxs("span",{className:"text-xs text-neutral3",children:[_en(s,3),"ms"]})};function Bpt({data:e,parentWorkflowName:t,stepsFlow:r}){const{steps:n}=cj(),{label:s,stepId:a,description:i,withoutTopHandle:o,withoutBottomHandle:l,mapConfig:u,duration:d,date:p,isParallel:f,canSuspend:h,isForEach:m}=e,g=t?`${t}.${a||s}`:a||s,b=n[g],v=b?.status==="failed"&&b?.tripwire!==void 0,S=v?"tripwire":b?.status,{isSleepNode:w,isForEachNode:k,isMapNode:_,hasSpecialBadge:C}=Dpt({duration:d,date:p,isForEach:m,mapConfig:u,canSuspend:h,isParallel:f});return c.jsxs(c.Fragment,{children:[!o&&c.jsx(Ou,{type:"target",position:Er.Top,style:{visibility:"hidden"}}),c.jsxs("div",{"data-workflow-node":!0,"data-workflow-step-status":S??"idle","data-testid":"workflow-default-node",className:K("bg-surface3 rounded-lg w-[274px] border border-border1",C?"pt-0":"pt-2",S==="success"&&"bg-accent1Darker",S==="failed"&&"bg-accent2Darker",S==="tripwire"&&"bg-amber-950/40 border-amber-500/30",S==="suspended"&&"bg-accent3Darker",S==="waiting"&&"bg-accent5Darker",S==="running"&&"bg-accent6Darker"),children:[C&&c.jsxs("div",{className:"px-3 pt-2 pb-1 flex gap-1.5 flex-wrap",children:[w&&c.jsx(Ft,{icon:p?c.jsx(Ao.sleepUntil,{className:"text-current",style:{color:Zi.sleep}}):c.jsx(Ao.sleep,{className:"text-current",style:{color:Zi.sleep}}),children:p?"SLEEP UNTIL":"SLEEP"}),h&&c.jsx(Ft,{icon:c.jsx(Ao.suspend,{className:"text-current",style:{color:Zi.suspend}}),children:"SUSPEND/RESUME"}),f&&c.jsx(Ft,{icon:c.jsx(Ao.parallel,{className:"text-current",style:{color:Zi.parallel}}),children:"PARALLEL"}),k&&c.jsx(Ft,{icon:c.jsx(Ao.forEach,{className:"text-current",style:{color:Zi.forEach}}),children:"FOREACH"}),_&&c.jsx(Ft,{icon:c.jsx(Ao.map,{className:"text-current",style:{color:Zi.map}}),children:"MAP"})]}),c.jsxs("div",{className:K("flex items-center gap-2 px-3",!i&&"pb-2"),children:[c.jsxs(ve,{children:[S==="tripwire"&&c.jsx(sI,{className:"text-amber-400"}),S==="failed"&&c.jsx(Mpe,{className:"text-accent2"}),S==="success"&&c.jsx($pe,{className:"text-accent1"}),S==="suspended"&&c.jsx(uze,{className:"text-accent3"}),S==="waiting"&&c.jsx(die,{className:"text-accent5"}),S==="running"&&c.jsx(Ii,{className:"text-accent6 animate-spin"}),!b&&c.jsx(fL,{className:"text-neutral2"})]}),c.jsxs(ze,{variant:"ui-lg",className:"text-neutral6 font-medium inline-flex items-center gap-1 justify-between w-full",children:[s," ",b?.startedAt&&c.jsx(Fpt,{startedAt:b.startedAt,endedAt:b.endedAt})]})]}),i&&c.jsx(ze,{variant:"ui-sm",className:"text-neutral3 px-3 pb-2",children:i}),k&&b?.foreachProgress&&c.jsxs("div",{className:"px-3 pb-2 flex items-center gap-2",children:[c.jsx("div",{className:"flex-1 h-1.5 bg-surface1 rounded-full overflow-hidden",children:c.jsx("div",{className:K("h-full rounded-full transition-all duration-300",b.foreachProgress.iterationStatus==="failed"?"bg-accent2":"bg-accent1"),style:{width:`${b.foreachProgress.totalCount>0?b.foreachProgress.completedCount/b.foreachProgress.totalCount*100:0}%`}})}),c.jsxs(ze,{variant:"ui-xs",className:"text-neutral3 whitespace-nowrap",children:[b.foreachProgress.completedCount," / ",b.foreachProgress.totalCount]})]}),d&&c.jsxs(ze,{variant:"ui-sm",className:"text-neutral3 px-3 pb-2",children:["sleeps for ",c.jsxs("strong",{children:[d,"ms"]})]}),p&&c.jsxs(ze,{variant:"ui-sm",className:"text-neutral3 px-3 pb-2",children:["sleeps until ",c.jsx("strong",{children:new Date(p).toLocaleString()})]}),c.jsx(Xpe,{stepName:s,stepId:a,input:b?.input,resumeData:b?.resumeData,output:b?.output,suspendOutput:b?.suspendOutput,error:v?void 0:b?.error,tripwire:v?b?.tripwire:void 0,mapConfig:u,status:S,stepKey:g,stepsFlow:r})]}),!l&&c.jsx(Ou,{type:"source",position:Er.Bottom,style:{visibility:"hidden",color:"red"}})]})}function zpt({data:e}){const{steps:t}=e,[r,n]=E.useState(!0);return c.jsxs(CO,{open:r,onOpenChange:n,className:K("bg-surface4 rounded-md w-[274px] flex flex-col p-2 gap-2"),children:[c.jsx(Ou,{type:"target",position:Er.Top,style:{visibility:"hidden"}}),c.jsxs(oS,{className:"flex items-center justify-between w-full",children:[c.jsx(Ft,{icon:c.jsx(Ao.after,{className:"text-current",style:{color:Zi.after}}),children:"AFTER"}),c.jsx(ve,{children:c.jsx($a,{className:K("transition-transform text-neutral3",{"transform rotate-180":r})})})]}),c.jsx(lS,{className:"flex flex-col gap-2",children:t.map(s=>c.jsxs("div",{className:"text-sm bg-surface5 flex items-center gap-1.5 rounded-sm p-2",children:[c.jsx(rze,{className:"text-current w-4 h-4"}),c.jsx(ze,{variant:"ui-xs",className:"text-neutral6 capitalize",children:s})]},s))}),c.jsx(Ou,{type:"source",position:Er.Bottom,style:{visibility:"hidden"}})]})}function Upt({data:e}){const{result:t}=e;return c.jsxs("div",{"data-testid":"workflow-loop-result-node","data-workflow-step-status":t?"success":"failed",className:K("bg-surface4 rounded-md w-[274px]"),"data-workflow-node":!0,children:[c.jsx(Ou,{type:"target",position:Er.Top,style:{visibility:"hidden"}}),c.jsx("div",{className:"p-2",children:c.jsxs("div",{className:"text-sm bg-surface5 flex items-center gap-1.5 rounded-sm p-2",children:[t?c.jsx(GBe,{className:"text-current w-4 h-4"}):c.jsx(uA,{className:"text-current w-4 h-4"}),c.jsx(ze,{variant:"ui-xs",className:"text-neutral6 capitalize",children:String(t)})]})}),c.jsx(Ou,{type:"source",position:Er.Bottom,style:{visibility:"hidden"}})]})}function Vpt({data:e,parentWorkflowName:t,stepsFlow:r}){const{steps:n}=cj(),{showNestedGraph:s}=Q6(),{label:a,stepId:i,description:o,withoutTopHandle:l,withoutBottomHandle:u,stepGraph:d,mapConfig:p,isParallel:f,canSuspend:h,isForEach:m}=e,g=t?`${t}.${a}`:a,b=t?`${t}.${i||a}`:i||a,v=n[b],S=v?.status==="failed"&&v?.tripwire!==void 0,w=S?"tripwire":v?.status,{isForEachNode:k,isMapNode:_,isNestedWorkflow:C,hasSpecialBadge:T}=Dpt({isForEach:m,mapConfig:p,canSuspend:h,isParallel:f,stepGraph:d});return c.jsxs(c.Fragment,{children:[!l&&c.jsx(Ou,{type:"target",position:Er.Top,style:{visibility:"hidden"}}),c.jsxs("div",{"data-testid":"workflow-nested-node","data-workflow-node":!0,"data-workflow-step-status":w,className:K("bg-surface3 rounded-lg w-[274px] border border-border1",T?"pt-0":"pt-2",w==="success"&&"bg-accent1Darker",w==="failed"&&"bg-accent2Darker",w==="tripwire"&&"bg-amber-950/40 border-amber-500/30",w==="suspended"&&"bg-accent3Darker",w==="waiting"&&"bg-accent5Darker",w==="running"&&"bg-accent6Darker"),children:[T&&c.jsxs("div",{className:"px-3 pt-2 pb-1 flex gap-1.5 flex-wrap",children:[h&&c.jsx(Ft,{icon:c.jsx(Ao.suspend,{className:"text-current",style:{color:Zi.suspend}}),children:"SUSPEND/RESUME"}),f&&c.jsx(Ft,{icon:c.jsx(Ao.parallel,{className:"text-current",style:{color:Zi.parallel}}),children:"PARALLEL"}),C&&c.jsx(Ft,{icon:c.jsx(Ao.workflow,{className:"text-current",style:{color:Zi.workflow}}),children:"WORKFLOW"}),k&&c.jsx(Ft,{icon:c.jsx(Ao.forEach,{className:"text-current",style:{color:Zi.forEach}}),children:"FOREACH"}),_&&c.jsx(Ft,{icon:c.jsx(Ao.map,{className:"text-current",style:{color:Zi.map}}),children:"MAP"})]}),c.jsxs("div",{className:K("flex items-center gap-2 px-3",!o&&"pb-2"),children:[c.jsxs(ve,{children:[w==="failed"&&c.jsx(Mpe,{className:"text-accent2"}),w==="success"&&c.jsx($pe,{className:"text-accent1"}),w==="tripwire"&&c.jsx(sI,{className:"text-amber-400"}),w==="suspended"&&c.jsx(uze,{className:"text-accent3"}),w==="waiting"&&c.jsx(die,{className:"text-accent5"}),w==="running"&&c.jsx(Ii,{className:"text-accent6 animate-spin"}),!v&&c.jsx(fL,{className:"text-neutral2"})]}),c.jsxs(ze,{variant:"ui-lg",className:"text-neutral6 font-medium inline-flex items-center gap-1 justify-between w-full",children:[a," ",v?.startedAt&&c.jsx(Fpt,{startedAt:v.startedAt,endedAt:v.endedAt})]})]}),o&&c.jsx(ze,{variant:"ui-sm",className:"text-neutral3 px-3 pb-2",children:o}),k&&v?.foreachProgress&&c.jsxs("div",{className:"px-3 pb-2 flex items-center gap-2",children:[c.jsx("div",{className:"flex-1 h-1.5 bg-surface1 rounded-full overflow-hidden",children:c.jsx("div",{className:K("h-full rounded-full transition-all duration-300",v.foreachProgress.iterationStatus==="failed"?"bg-accent2":"bg-accent1"),style:{width:`${v.foreachProgress.totalCount>0?v.foreachProgress.completedCount/v.foreachProgress.totalCount*100:0}%`}})}),c.jsxs(ze,{variant:"ui-xs",className:"text-neutral3 whitespace-nowrap",children:[v.foreachProgress.completedCount," / ",v.foreachProgress.totalCount]})]}),c.jsx(Xpe,{stepName:a,stepId:i,input:v?.input,resumeData:v?.resumeData,output:v?.output,suspendOutput:v?.suspendOutput,error:v?.error,tripwire:S?v?.tripwire:void 0,mapConfig:p,onShowNestedGraph:()=>s({label:a,fullStep:g,stepGraph:d}),status:w,stepKey:b,stepsFlow:r})]}),!u&&c.jsx(Ou,{type:"source",position:Er.Bottom,style:{visibility:"hidden"}})]})}const C4=E.forwardRef(({className:e,...t},r)=>c.jsxs(Tot,{ref:r,className:K("relative flex w-full touch-none select-none items-center group",e),...t,children:[c.jsx(C7r,{className:K("relative h-1.5 w-full grow overflow-hidden rounded-full bg-neutral2",Wr.colors),children:c.jsx(T7r,{className:K("absolute h-full bg-accent1",Wr.all)})}),c.jsx(A7r,{className:K("block h-4 w-4 rounded-full border-2 border-accent1 bg-white shadow-md","transition-all duration-normal ease-out-custom",sh,"hover:scale-110 hover:shadow-lg","active:scale-95","disabled:pointer-events-none disabled:opacity-50")})]}));C4.displayName=Tot.displayName;const Ype=E.forwardRef(({className:e,...t})=>{const{zoom:r}=COr(),{zoomTo:n,zoomIn:s,zoomOut:a,fitView:i}=jF();return c.jsxs(RI,{className:K("flex gap-1 rounded-md bg-surface2 p-1 text-neutral6",e),...t,children:[c.jsx(ye,{onClick:()=>a({duration:300}),children:c.jsx(KNt,{className:"h-4 w-4"})}),c.jsx(C4,{className:"w-[140px]",value:[r],min:.01,max:1,step:.01,onValueChange:o=>{n(o[0])}}),c.jsx(ye,{onClick:()=>s({duration:300}),children:c.jsx(Qs,{className:"h-4 w-4"})}),c.jsxs(ye,{className:"min-w-20 tabular-nums",onClick:()=>n(1,{duration:300}),children:[(100*r).toFixed(0),"%"]}),c.jsx(ye,{onClick:()=>i({duration:300,maxZoom:1}),children:c.jsx(ZNt,{className:"h-4 w-4"})})]})});Ype.displayName="ZoomSlider";function Cen({workflow:e}){const{nodes:t,edges:r}=Apt(e),[n,s,a]=Met(t),[i]=Let(r),{steps:o}=cj(),l=E.useMemo(()=>r.reduce((d,p)=>{if(p.data){const f=p.data.nextStepId,h=p.data.previousStepId;return{...d,[f]:[...new Set([...d[f]||[],h])]}}return d},{}),[r]),u={"default-node":d=>c.jsx(Bpt,{...d,stepsFlow:l}),"condition-node":Lpt,"after-node":zpt,"loop-result-node":Upt,"nested-node":d=>c.jsx(Vpt,{...d,stepsFlow:l})};return c.jsx("div",{className:"w-full h-full bg-surface1",children:c.jsxs($et,{nodes:n,edges:i.map(d=>({...d,style:{...d.style,stroke:o[d.data?.previousStepId]?.status==="success"&&o[d.data?.nextStepId]||d.data?.conditionNode&&!o[d.data?.previousStepId]&&o[d.data?.nextStepId]?.status?"#22c55e":void 0}})),nodeTypes:u,onNodesChange:a,fitView:!0,fitViewOptions:{maxZoom:1},minZoom:.01,maxZoom:1,children:[c.jsx(Ype,{position:"bottom-left"}),c.jsx(Bet,{variant:em.Dots,gap:12,size:.5})]})})}function qpt({workflowId:e,workflow:t,isLoading:r}){const{snapshot:n}=E.useContext(Fm);return r?c.jsx("div",{className:"p-4",children:c.jsx(Nr,{className:"h-full"})}):t?c.jsx(Dce,{children:c.jsx(Cen,{workflow:n?.serializedStepGraph?{stepGraph:n?.serializedStepGraph}:t})}):c.jsx("div",{className:"grid h-full place-items-center",children:c.jsxs("div",{className:"flex flex-col items-center gap-2",children:[c.jsx(Xh,{}),c.jsxs("div",{children:["We couldn't find ",$Jr(e)," workflow."]})]})})}const Ten=e=>e&&Object.keys(e).length===0&&e.constructor===Object;async function Aen(e){const{baseUrl:t="",headers:r={}}=e.options,n=await fetch(`${t}/api/auth/capabilities`,{credentials:"include",headers:{"Content-Type":"application/json",...r}});if(!n.ok)throw new Error(`Failed to fetch auth capabilities: ${n.status}`);return n.json()}function dj(){const e=st();return ur({queryKey:["auth","capabilities"],queryFn:()=>Aen(e),staleTime:60*1e3,retry:!1})}function Z6(e){return"user"in e&&e.user!==void 0}function Den(e,t){if(e==="*")return!0;const r=e.split(":"),n=t.split(":");if(r.length<2||n.length<2)return e===t;const[s,a,i]=r,[o,l,u]=n;return s==="*"?a==="*"?!0:a!==l?!1:i===void 0?!0:i===u:s!==o?!1:a==="*"?i===void 0?!0:i===u:a!==l?!1:i===void 0?!0:i===u}function AY(e,t){return e.some(r=>Den(r,t))}function Bm(){const{data:e,isLoading:t}=dj(),r=e&&Z6(e),n=r?e.access:null,s=r?e.capabilities.rbac:!1,a=n?.roles??[],i=n?.permissions??[],o=l=>s?AY(i,l):!0;return{roles:a,permissions:i,isLoading:t,isAuthenticated:!!r,rbacEnabled:s,hasPermission:l=>o(l),hasAllPermissions:l=>s?l.every(u=>AY(i,u)):!0,hasAnyPermission:l=>s?l.some(u=>AY(i,u)):!0,hasRole:l=>s?a.includes(l):!0,canEdit:l=>o(`${l}:write`),canDelete:l=>o(`${l}:delete`),canExecute:l=>o(`${l}:execute`)}}function Nen(e,t){return E.useMemo(()=>Object.entries(e?.steps||{}).filter(([r,{status:n}])=>n==="suspended").map(([r,{suspendPayload:n}])=>({stepId:r,runId:t,suspendPayload:n,isLoading:!1})),[e?.steps,t])}function Ien(e){return E.useMemo(()=>{const t=e?.inputSchema,r=e?.stateSchema,n=t?vm(fm(Av(t))):null,s=r?vm(fm(Av(r))):null;return{zodSchemaToUse:s?Fn({inputData:n,initialState:s.optional()}):n,hasStateSchema:!!r}},[e?.inputSchema,e?.stateSchema])}function jen({zodSchema:e,isStreaming:t,onExecute:r,defaultValues:n,isViewingRun:s,isProcessorWorkflow:a}){return e?c.jsx(Gpe,{schema:e,defaultValues:n,isSubmitLoading:t,submitButtonLabel:"Run",onSubmit:r,withoutSubmit:s,isProcessorWorkflow:a}):s?null:c.jsx(ye,{className:"w-full",variant:"light",disabled:t,onClick:()=>r(null),children:t?c.jsx(ve,{children:c.jsx(Ii,{className:"animate-spin"})}):"Trigger"})}function Ren({suspendedSteps:e,workflow:t,isStreaming:r,onResume:n}){return r||e.length===0?null:c.jsx(c.Fragment,{children:e.map(s=>{const a=t.allSteps[s.stepId];if(!a||a.isWorkflow)return null;const i=a?.resumeSchema?vm(fm(Av(a.resumeSchema))):vc(Tr(),P0());return c.jsxs("div",{className:"flex flex-col px-4",children:[c.jsx(ze,{variant:"ui-xs",className:"text-neutral3",children:s.stepId}),s.suspendPayload&&c.jsx("div",{"data-testid":"suspended-payload",children:c.jsx(Wa,{data:s.suspendPayload,className:"w-full overflow-x-auto p-2",showCopyButton:!1})}),c.jsx(Gpe,{schema:i,isSubmitLoading:r,submitButtonLabel:"Resume workflow",onSubmit:o=>{const l=s.stepId?.split(".");n({stepId:l,runId:s.runId,suspendPayload:s.suspendPayload,resumeData:o,isLoading:!1})}})]},s.stepId)})})}const Pen=["success","failed","canceled","tripwire"];function $en({status:e,cancelMessage:t,isCancelling:r,onCancel:n}){return e!=="running"?null:c.jsxs(ye,{variant:"light",className:"w-full",onClick:n,disabled:!!t||r||e&&Pen.includes(e),children:[r?c.jsx(ve,{children:c.jsx(Ii,{className:"animate-spin"})}):c.jsx(ve,{children:c.jsx(KBe,{})}),t||"Cancel Workflow Run"]})}const Men=({header:e,children:t,footer:r})=>{const[n,s]=E.useState(!1);return c.jsxs("div",{className:"rounded-lg border border-border1 bg-surface4",children:[c.jsxs("button",{className:"py-1 px-2 flex items-center gap-3 justify-between w-full",onClick:()=>s(a=>!a),children:[c.jsx("div",{className:"w-full",children:e}),c.jsx(ve,{children:c.jsx($a,{className:K("text-neutral3 transition-transform -rotate-90",n&&"rotate-0")})})]}),t&&n&&c.jsx("div",{className:"border-t border-border1 max-h-[400px] overflow-y-auto",children:t}),r&&c.jsx("div",{className:"py-1 px-2 border-t border-border1",children:r})]})},Len=({stepId:e,status:t,result:r,tripwire:n})=>{const[s,a]=E.useState(!1),i=t==="tripwire",o=!!(n&&(n.retry!==void 0||n.metadata!==void 0||n.processorId!==void 0));return c.jsx(Men,{header:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs(ve,{children:[t==="success"&&c.jsx($pe,{className:"text-accent1"}),t==="failed"&&c.jsx(Mpe,{className:"text-accent2"}),t==="tripwire"&&c.jsx(sI,{className:"text-amber-400"}),t==="suspended"&&c.jsx(XBe,{className:"text-accent3"}),t==="waiting"&&c.jsx(die,{className:"text-accent5"}),t==="running"&&c.jsx(Ii,{className:"text-accent6 animate-spin"})]}),c.jsx(ze,{as:"span",variant:"ui-lg",className:"text-neutral6 font-medium",children:e.charAt(0).toUpperCase()+e.slice(1)})]}),children:i&&n?c.jsx(Fen,{tripwire:n,isExpanded:s,onToggleExpand:()=>a(!s),hasMetadata:o}):c.jsx(Wa,{data:r})})},Fen=({tripwire:e,isExpanded:t,onToggleExpand:r,hasMetadata:n})=>c.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-950/20 overflow-hidden",children:[c.jsxs("div",{className:"flex items-start gap-3 p-4",children:[c.jsx(sI,{className:"w-5 h-5 text-amber-400 mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-sm font-medium text-amber-200 mb-1",children:"Content Blocked"}),c.jsx("p",{className:"text-sm text-amber-300/90",children:e.reason||"Tripwire triggered"})]})]}),n&&c.jsxs(c.Fragment,{children:[c.jsxs("button",{onClick:r,className:"w-full flex items-center gap-2 px-4 py-2 text-xs text-amber-400/70 hover:text-amber-400 hover:bg-amber-900/20 transition-colors border-t border-amber-500/20",children:[t?c.jsx($a,{className:"w-3.5 h-3.5"}):c.jsx(Hi,{className:"w-3.5 h-3.5"}),c.jsx("span",{children:"Details"})]}),t&&c.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t border-amber-500/20 bg-amber-950/10",children:[e.retry!==void 0&&c.jsxs("div",{className:"flex items-center gap-2 pt-3",children:[c.jsx(rI,{className:"w-3.5 h-3.5 text-amber-400/60"}),c.jsxs("span",{className:"text-xs text-amber-300/70",children:["Retry:"," ",e.retry?c.jsx("span",{className:"text-green-400",children:"Allowed"}):c.jsx("span",{className:"text-red-400",children:"Not allowed"})]})]}),e.processorId&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(mie,{className:"w-3.5 h-3.5 text-amber-400/60"}),c.jsxs("span",{className:"text-xs text-amber-300/70",children:["Processor:"," ",c.jsx("code",{className:"px-1.5 py-0.5 rounded bg-amber-900/30 text-amber-200 font-mono",children:e.processorId})]})]}),e.metadata!==void 0&&e.metadata!==null&&c.jsxs("div",{className:"pt-1",children:[c.jsx("p",{className:"text-xs text-amber-400/60 mb-1.5",children:"Metadata:"}),c.jsx("pre",{className:"text-xs text-amber-200/80 bg-amber-900/30 rounded p-2 overflow-x-auto font-mono",children:String(JSON.stringify(e.metadata,null,2))})]})]})]})]});function Ben({steps:e,workflowResult:t}){const r=Object.entries(e).filter(([n,s])=>n!=="input"&&!n.endsWith(".input"));return r.length===0?null:c.jsxs("div",{className:"flex flex-col gap-2 pt-5 border-t border-border1",children:[c.jsx(ze,{variant:"ui-xs",className:"text-neutral3",children:"Status"}),c.jsx("div",{className:"flex flex-col gap-4",children:r.map(([n,s])=>{const{status:a}=s;let i,o,l;s.status==="suspended"&&(o=s.suspendOutput),s.status==="success"&&(i=s.output),s.status==="failed"&&(l=s.error);const u=s.status==="failed"&&s.tripwire?s.tripwire:t?.status==="tripwire"?{reason:t?.tripwire?.reason,retry:t?.tripwire?.retry,metadata:t?.tripwire?.metadata,processorId:t?.tripwire?.processorId}:void 0,d=s.status==="failed"&&s.tripwire?"tripwire":a;return c.jsx(Len,{stepId:n,status:d,result:i??o??l??{},tripwire:u},n)})})]})}function Hpt({workflowId:e,paramsRunId:t,setRunId:r,workflow:n,isLoading:s,createWorkflowRun:a,resumeWorkflow:i,streamWorkflow:o,observeWorkflowStream:l,isStreamingWorkflow:u,streamResult:d,isCancellingWorkflowRun:p,cancelWorkflowRun:f}){const h=Fc(),{result:m,setResult:g,payload:b,setPayload:v,setRunId:S}=E.useContext(Fm),{canExecute:w}=Bm(),k=w("workflows"),[_,C]=E.useState(""),[T,A]=E.useState(null),N=m??d,I=Nen(N,_),{zodSchemaToUse:R,hasStateSchema:$}=Ien(n),F=async G=>{try{if(!n)return;A(null),g(null);const M=await a({workflowId:e});r?.(M.runId),C(M.runId),S(M.runId);const{initialState:X,inputData:U}=G??{},j=$?U:G;o({workflowId:e,runId:M.runId,inputData:j,initialState:X,requestContext:h})}catch{Xe.error("Error executing workflow")}},L=async G=>{if(!n)return;A(null);const{stepId:M,runId:X,resumeData:U}=G,j=await a({workflowId:e,prevRunId:X});await i({step:M,runId:j.runId,resumeData:U,workflowId:e,requestContext:h})},z=async()=>{const G=await f({workflowId:e,runId:_});A(G)};if(E.useEffect(()=>{t&&l&&(l({workflowId:e,runId:t}),C(t),S(t))},[t]),E.useEffect(()=>{d&&g(d)},[d]),s)return c.jsx(pi,{className:"h-[calc(100vh-126px)] pt-2 px-4 pb-4 text-xs",children:c.jsxs("div",{className:"space-y-4",children:[c.jsx(Nr,{className:"h-10"}),c.jsx(Nr,{className:"h-10"})]})});if(!n)return null;const q=I.length>0,H=N?.steps??{},V=Object.values(H).length>0;return c.jsxs("div",{className:"h-full pt-3 overflow-y-auto",children:[c.jsxs("div",{className:"space-y-4 px-5 pb-5 border-b border-border1",children:[q&&u&&c.jsxs("div",{className:"py-2 px-5 flex items-center gap-2 bg-surface5 -mx-5 -mt-5 border-b border-border1",children:[c.jsx(ve,{children:c.jsx(Ii,{className:"animate-spin text-neutral6"})}),c.jsx(ze,{children:"Resuming workflow"})]}),!q&&k&&c.jsx(jen,{zodSchema:R,defaultValues:b,isStreaming:u,onExecute:G=>{v(G),F(G)},isViewingRun:!!t,isProcessorWorkflow:n?.isProcessorWorkflow}),!q&&!k&&c.jsx(ze,{variant:"ui-sm",className:"text-neutral3 py-2",children:"You don't have permission to execute workflows."}),c.jsx(Ren,{suspendedSteps:I,workflow:n,isStreaming:u,onResume:L}),c.jsx($en,{status:m?.status,cancelMessage:T?.message??null,isCancelling:p,onCancel:z}),V&&c.jsx(Ben,{steps:H,workflowResult:N})]}),m&&!Ten(m)&&c.jsx("div",{className:"p-5 border-b border-border1",children:c.jsx(zen,{result:m})})]})}const zen=({result:e})=>{const[t,r]=E.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsxs(ye,{variant:"light",onClick:()=>r(!0),className:"w-full truncate",children:[c.jsx(ve,{children:c.jsx(jp,{className:"text-neutral3"})}),"Open Workflow Execution (JSON)"]}),c.jsx(ea,{open:t,onOpenChange:r,children:c.jsxs(Ls,{className:"max-w-6xl",children:[c.jsxs(ta,{children:[c.jsx(Fs,{children:"Workflow Execution (JSON)"}),c.jsx(ni,{children:"JSON view of the workflow execution result"})]}),c.jsx(ra,{className:"max-h-[90vh]",children:c.jsx(Wa,{data:e,className:"p-4"})})]})})]})},Uen=({workflowId:e,runId:t,observeWorkflowStream:r,...n})=>{const{runSnapshot:s,isLoadingRunExecutionResult:a}=E.useContext(Fm);if(a)return c.jsx("div",{className:"p-4",children:c.jsx(Nr,{className:"h-[600px]"})});if(!s||!t)return c.jsx("div",{className:"p-4",children:c.jsx(ze,{variant:"ui-md",className:"text-neutral6 text-center",children:"No previous run"})});const i=Are(s),o=i?.status;if(t)return c.jsx("div",{className:"h-full grid grid-rows-[1fr_auto]",children:c.jsx(Hpt,{...n,paramsRunId:t,workflowId:e,observeWorkflowStream:()=>{o!=="success"&&o!=="failed"&&o!=="canceled"&&r?.({workflowId:e,runId:t,storeRunResult:i})}})})};function Bc({iconSlot:e,titleSlot:t,descriptionSlot:r,actionSlot:n,className:s,as:a="h3"}){return c.jsxs("div",{className:K("flex flex-col items-center justify-center text-center py-10 px-6","transition-opacity duration-normal ease-out-custom",s),children:[e&&c.jsx("div",{className:"mb-4",children:e}),c.jsx(a,{className:"font-medium text-neutral5 text-ui-md",children:t}),r&&c.jsx("p",{className:"mt-1.5 text-neutral3 text-ui-sm max-w-md",children:r}),n&&c.jsx("div",{className:"mt-5",children:n})]})}function Ld({resource:e,title:t,description:r,actionSlot:n,className:s}){const a="Permission Denied",i=e?`You don't have permission to access ${e}. Contact your administrator for access.`:"You don't have permission to access this resource. Contact your administrator for access.";return c.jsx(Bc,{className:s,iconSlot:c.jsx(ve,{size:"lg",className:"text-neutral3",children:c.jsx(zIt,{})}),titleSlot:t??a,descriptionSlot:r??i,actionSlot:n})}const Ven={default:"[&>tbody>tr]:h-table-row",small:"[&>tbody>tr]:h-table-row-small"},Tl=({className:e,children:t,size:r="default",style:n})=>c.jsx("table",{className:K("w-full",Ven[r],e),style:n,children:t}),Al=({className:e,children:t})=>c.jsx("thead",{children:c.jsx("tr",{className:K("h-table-header border-b border-border1 bg-surface2/80",e),children:t})}),Aa=({className:e,children:t,...r})=>c.jsx("th",{className:K("text-neutral2 text-ui-xs h-full whitespace-nowrap text-left font-medium uppercase tracking-wide first:pl-3 last:pr-3",e),...r,children:t}),Dl=({className:e,children:t,...r})=>c.jsx("tbody",{className:K("",e),...r,children:t}),Nl=E.forwardRef(({className:e,children:t,selected:r=!1,style:n,onClick:s,isActive:a=!1,...i},o)=>{const l=E.useRef(null);E.useEffect(()=>{o&&(typeof o=="function"?o(l.current):o.current=l.current)},[o]),E.useEffect(()=>{a&&l.current&&(l.current.focus(),l.current.scrollIntoView({block:"nearest"}))},[a]);const u=d=>{d.key==="Enter"&&s&&s()};return c.jsx("tr",{className:K("border-b border-border1","transition-colors duration-normal ease-out-custom","hover:bg-surface3","focus:bg-surface3 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-accent1/50",r&&"bg-surface4",s&&"cursor-pointer",e),style:n,onClick:s,ref:l,tabIndex:s?0:void 0,onKeyDown:u,"data-active":a||void 0,...i,children:t})}),Hs=({className:e,children:t,...r})=>c.jsx("td",{className:K("text-neutral5 first:pl-3 last:pr-3",e),...r,children:c.jsx("div",{className:K("flex h-full w-full shrink-0 items-center"),children:t})}),ax=({name:e,description:t,icon:r,meta:n,...s})=>c.jsx(Hs,{...s,children:c.jsxs("div",{className:"flex items-center gap-3.5",children:[r&&c.jsx(ve,{size:"lg",className:"text-neutral5",children:r}),c.jsxs("div",{className:"flex flex-col gap-0",children:[c.jsx(ze,{as:"span",variant:"ui-md",className:"text-neutral6 !leading-tight",children:e}),t&&c.jsx(ze,{as:"span",variant:"ui-xs",className:"text-neutral3 w-full max-w-[300px] truncate !leading-tight pt-1",children:t})]}),n]})});function cS({itemCount:e,initialIndex:t=-1,wrap:r=!1,onSelect:n,global:s=!1}){const[a,i]=E.useState(t),o=E.useCallback(u=>{if(e!==0)switch(u.key){case"ArrowDown":{u.preventDefault(),i(d=>d===-1?0:d>=e-1?r?0:e-1:d+1);break}case"ArrowUp":{u.preventDefault(),i(d=>d===-1?e-1:d<=0?r?e-1:0:d-1);break}case"Home":{u.preventDefault(),i(0);break}case"End":{u.preventDefault(),i(e-1);break}case"Enter":{a>=0&&n&&(u.preventDefault(),n(a));break}}},[e,r,a,n]);E.useEffect(()=>{if(s)return document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o)}},[s,o]);const l=E.useCallback(()=>s?null:{onKeyDown:o,tabIndex:0},[s,o]);return{activeIndex:a,setActiveIndex:i,getKeyboardProps:l}}const zPe=40,IP=150,UPe=10,ix=({className:e,children:t,scrollSpeed:r=100,scrollIntervalTime:n=20})=>{const s=E.useRef(null),a=E.useRef(null),[i,o]=E.useState(0),[l,u]=E.useState(0),[d,p]=E.useState(0),[f,h]=E.useState(0),[m,g]=E.useState(!1),[b,v]=E.useState(!1);E.useEffect(()=>{const _=()=>{if(!s.current)return;const N=s.current.scrollLeft<s.current.scrollWidth-s.current.clientWidth;g(N),o(s.current.clientHeight);const I=s.current.getBoundingClientRect();u(I.right),h(I.left),p(I.top)};_();const C=new ResizeObserver(_);s.current&&C.observe(s.current);const T=()=>{if(!s.current)return;const N=s.current.scrollLeft>0,I=s.current.scrollLeft<s.current.scrollWidth-s.current.clientWidth;v(N),g(I),_()};s?.current?.addEventListener("scroll",T);const A=s.current;return()=>{A&&(C.unobserve(A),A.removeEventListener("scroll",T))}},[]);const S=({isVisible:_,position:C,containerHeight:T,containerTop:A,containerRight:N,onStartScrolling:I,onStopScrolling:R})=>{if(!_)return null;const $={top:T<IP?A:A+(T-IP)/2,width:zPe,height:T<IP?`${T}px`:`${IP}px`};return c.jsxs("button",{onMouseDown:I,onTouchStart:I,onMouseUp:R,onTouchEnd:R,onTouchCancel:R,className:"bg-surface4 text-neutral3 border-surface5 hover:border-neutral3 fixed z-10 flex items-center justify-center rounded-lg border text-2xl hover:text-white",style:{...$,left:C==="left"?f+UPe:N-zPe-UPe},children:[" ",C==="left"?"«":"»"]})},w=E.useCallback((_,C)=>{C?.preventDefault(),C?.stopPropagation(),a.current&&(clearInterval(a.current),a.current=null),s.current&&s.current.scrollBy({left:_==="right"?r*2:-r*2,behavior:"smooth"}),a.current=setInterval(()=>{s.current&&s.current.scrollBy({left:_==="right"?r:-r,behavior:"smooth"})},n)},[r,n]),k=E.useCallback(()=>{a.current&&(clearInterval(a.current),a.current=null)},[]);return c.jsxs("div",{ref:s,className:K("relative max-h-full overflow-auto",e),children:[t,c.jsx(S,{isVisible:b,position:"left",containerHeight:i,containerTop:d,containerRight:l,onStartScrolling:_=>w("left",_),onStopScrolling:k}),c.jsx(S,{isVisible:m,position:"right",containerHeight:i,containerTop:d,containerRight:l,onStartScrolling:_=>w("right",_),onStopScrolling:k})]})},qen=[{id:"name",header:"Name",cell:({row:e})=>{const{Link:t,paths:r}=Yt(),n=e.original;return c.jsx(ax,{name:c.jsx(t,{href:r.workflowLink(e.original.id),children:e.original.name}),description:n.description,meta:void 0})},meta:{width:"auto"}},{id:"stepsCount",header:"Steps",size:300,cell:({row:e})=>{const t=e.original,r=Object.keys(t.steps??{}).length;return c.jsx(Hs,{children:c.jsx("div",{className:"flex justify-end items-center gap-2",children:c.jsxs(Ft,{icon:c.jsx(rze,{}),className:"!h-form-sm",children:[r," step",r>1?"s":""]})})})}}],VPe={sm:oi.sm,md:oi.md,lg:oi.lg,default:oi.default},ju=({onSearch:e,label:t,placeholder:r,debounceMs:n=300,size:s="md"})=>{const a=E.useId(),i=E.useRef(null),o=MI(u=>{e(u)},n);E.useEffect(()=>()=>{o.cancel()},[o]),E.useEffect(()=>{const u=i.current;if(!u)return;const d=p=>{p.key.toLowerCase()==="f"&&p.shiftKey&&(p.ctrlKey||p.metaKey)&&(p.preventDefault(),u.focus())};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}},[]);const l=u=>{o(u.target.value)};return c.jsxs("div",{className:K("border border-border1 flex w-full items-center gap-2 overflow-hidden pl-2 pr-1",ij,PKr,Wr.all,"hover:border-neutral2",VPe[s]),children:[c.jsx(_m,{className:K("text-neutral3 h-4 w-4",Wr.colors)}),c.jsxs("div",{className:"flex-1",children:[c.jsx("label",{htmlFor:a,className:"sr-only",children:t}),c.jsx("input",{id:a,type:"text",placeholder:r,className:K("bg-transparent text-ui-md placeholder:text-neutral3 block w-full px-2 outline-none",VPe[s]),name:a,ref:i,onChange:l})]})]})},Sy=({children:e})=>c.jsx("div",{className:"px-3 py-2.5 border-b border-border1",children:e});function Hen({workflows:e,isLoading:t,error:r}){const[n,s]=E.useState(""),{navigate:a,paths:i}=Yt(),o=E.useMemo(()=>Object.keys(e??{}).map(m=>{const g=e[m];return{id:m,...g}}),[e]),l=E.useMemo(()=>o.filter(h=>h.name.toLowerCase().includes(n.toLowerCase())),[o,n]),{activeIndex:u}=cS({itemCount:l.length,global:!0,onSelect:h=>{const m=l[h];m&&a(i.workflowLink(m.id))}}),d=ex({data:l,columns:qen,getCoreRowModel:Jv()}),p=d.getHeaderGroups()[0],f=d.getRowModel().rows;return r&&Mc(r)?c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"workflows"})}):o.length===0&&!t?c.jsx(Gen,{}):c.jsxs("div",{children:[c.jsx(Sy,{children:c.jsx(ju,{onSearch:s,label:"Search workflows",placeholder:"Search workflows"})}),t?c.jsx(Qen,{}):c.jsx(ix,{children:c.jsxs(Tl,{children:[c.jsx(Al,{className:"sticky top-0",children:p.headers.map(h=>c.jsx(Aa,{style:{width:h.index===0?"auto":h.column.getSize()},children:Xl(h.column.columnDef.header,h.getContext())},h.id))}),c.jsx(Dl,{children:f.map((h,m)=>c.jsx(Nl,{isActive:m===u,onClick:()=>a(i.workflowLink(h.original.id)),children:h.getVisibleCells().map(g=>c.jsx(Ee.Fragment,{children:Xl(g.column.columnDef.cell,g.getContext())},g.id))},h.id))})]})})]})}const Qen=()=>c.jsxs(Tl,{children:[c.jsxs(Al,{children:[c.jsx(Aa,{children:"Name"}),c.jsx(Aa,{width:300,children:"Steps"})]}),c.jsx(Dl,{children:Array.from({length:3}).map((e,t)=>c.jsxs(Nl,{children:[c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-1/2"})}),c.jsx(Hs,{width:300,children:c.jsx(Nr,{className:"h-4 w-1/2"})})]},t))})]}),Gen=()=>c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Bc,{iconSlot:c.jsx(eJr,{}),titleSlot:"Configure Workflows",descriptionSlot:"Mastra workflows are not configured yet. You can find more information in the documentation.",actionSlot:c.jsxs(ye,{size:"lg",className:"w-full",variant:"light",as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(Yl,{})}),"Docs"]})})}),Qpt=({icon:e,title:t,isLoading:r,children:n})=>c.jsxs("div",{className:"p-5 w-full overflow-x-hidden",children:[c.jsxs("div",{className:"text-neutral6 flex items-center gap-2",children:[c.jsx(ve,{size:"lg",className:"bg-surface4 rounded-md p-1",children:e}),r?c.jsx(Nr,{className:"h-3 w-1/3"}):c.jsx("div",{className:"flex min-w-0 items-center gap-4",children:c.jsx(ze,{variant:"header-md",as:"h2",className:"truncate font-medium",children:t})})]}),n&&c.jsx("div",{className:"pt-2",children:n})]}),TO=({children:e,defaultTab:t,value:r,onValueChange:n,className:s})=>{const[a,i]=E.useState(t),o=r!==void 0&&n!==void 0,l=o?r:a,u=d=>{const p=d;o?n(p):i(p)};return c.jsx(SBr,{value:l,onValueChange:u,className:K("overflow-y-auto",s),children:e})},AO=({children:e,variant:t="default",className:r})=>c.jsx("div",{className:K("w-full overflow-x-auto",r),children:c.jsx(wBr,{className:K("flex items-center relative",{"text-ui-lg":t==="default","[&>button]:py-2 [&>button]:px-6 [&>button]:font-normal [&>button]:text-neutral3 [&>button]:flex-1 [&>button]:border-b [&>button]:border-border1":t==="default",[`[&>button]:${Wr.colors} [&>button]:hover:text-neutral4`]:t==="default","[&>button[data-state=active]]:text-neutral5 [&>button[data-state=active]]:border-white/50":t==="default","border border-border1 flex justify-stretch rounded-md overflow-hidden text-ui-md min-h-[2.5rem]":t==="buttons",[`[&>button]:flex-1 [&>button]:py-2 [&>button]:px-4 [&>button]:text-neutral3 [&>button]:${Wr.all}`]:t==="buttons","[&>button]:hover:text-neutral4 [&>button]:hover:bg-surface3":t==="buttons","[&>button[data-state=active]]:text-neutral5 [&>button[data-state=active]]:bg-surface4 [&>button[data-state=active]]:shadow-inner":t==="buttons"},r),children:e})}),gl=({children:e,value:t,onClick:r,onClose:n,className:s})=>c.jsxs(EBr,{value:t,className:K("text-sm p-3 text-neutral3 whitespace-nowrap flex-shrink-0 flex items-center justify-center gap-1.5",Wr.all,nx.visible,"hover:text-neutral4","data-[state=active]:text-neutral5 data-[state=active]:border-b-2 data-[state=active]:border-accent1",s),onClick:r,children:[e,n&&c.jsx("button",{onClick:a=>{a.stopPropagation(),n()},className:K("p-0.5 hover:bg-surface4 rounded",Wr.colors,"hover:text-neutral5"),"aria-label":"Close tab",children:c.jsx(Os,{className:"w-3 h-3"})})]}),Tc=({children:e,value:t,className:r})=>c.jsx(kBr,{value:t,className:K("grid py-3 overflow-y-auto ring-offset-background",nx.visible,r),children:e}),Zen=()=>{const{debugMode:e,setDebugMode:t}=E.useContext(Fm);return c.jsxs(c.Fragment,{children:[c.jsx(ze,{as:"h3",variant:"ui-md",className:"text-neutral3",children:"Debug Mode"}),c.jsx(Fp,{checked:e,onCheckedChange:r=>t(r)})]})},Gpt=()=>{const e=sx(),{settings:t,setSettings:r,entityType:n}=zpe(),s=i=>{if(!i)return r({...t,tracingOptions:void 0});try{const o=JSON.parse(i);typeof o=="object"&&o!==null&&r({...t,tracingOptions:o})}catch{}};let a="{}";try{a=JSON.stringify(t?.tracingOptions,null,2)}catch{}return c.jsxs("div",{className:"space-y-2 px-5 py-2",children:[c.jsx(ze,{as:"h3",variant:"ui-md",className:"text-neutral3",children:"Tracing Options"}),c.jsx(Sd,{value:a,onChange:s,theme:e,extensions:[hd],className:"h-[400px] overflow-y-scroll bg-surface3 rounded-lg overflow-hidden p-3"}),n==="workflow"&&c.jsx(Zen,{})]})},Wen={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"};function Cn({color:e,className:t,size:r="md"}){return c.jsx("svg",{className:K("animate-spin",Wen[r],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:c.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:e||"currentColor",className:"text-accent1"})})}function Xen({stepGraph:e,open:t,workflowName:r}){const{nodes:n,edges:s}=Apt({stepGraph:e}),[a,i]=E.useState(!1),[o,l,u]=Met(n),[d]=Let(s),{steps:p}=cj(),f=E.useMemo(()=>s.reduce((m,g)=>{if(g.data){const b=g.data.nextStepId,v=g.data.previousStepId;return{...m,[b]:[...new Set([...m[b]||[],v])]}}return m},{}),[s]),h={"default-node":m=>c.jsx(Bpt,{parentWorkflowName:r,...m,stepsFlow:f}),"condition-node":Lpt,"after-node":zpt,"loop-result-node":Upt,"nested-node":m=>c.jsx(Vpt,{parentWorkflowName:r,...m,stepsFlow:f})};return E.useEffect(()=>{t&&setTimeout(()=>{i(!0)},500)},[t]),c.jsx("div",{className:"w-full h-full relative bg-surface1",children:a?c.jsxs($et,{nodes:o,edges:d.map(m=>({...m,style:{...m.style,stroke:p[`${r}.${m.data?.previousStepId}`]?.status==="success"&&p[`${r}.${m.data?.nextStepId}`]||m.data?.conditionNode&&!p[`${r}.${m.data?.previousStepId}`]&&p[`${r}.${m.data?.nextStepId}`]?.status?"#22c55e":void 0}})),fitView:!0,fitViewOptions:{maxZoom:1},minZoom:.01,maxZoom:1,nodeTypes:h,onNodesChange:u,children:[c.jsx(Ype,{position:"bottom-left"}),c.jsx(Bet,{variant:em.Lines,gap:12,size:.5})]}):c.jsx("div",{className:"w-full h-full flex items-center justify-center",children:c.jsx(Cn,{})})})}function Yen(){const{stepDetail:e,closeStepDetail:t}=Q6();return e?c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border1 bg-surface1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[e.type==="map-config"&&c.jsx(zE,{className:"w-4 h-4",style:{color:Zi.map}}),e.type==="nested-graph"&&c.jsx(Yl,{className:"w-4 h-4",style:{color:Zi.workflow}}),c.jsxs("div",{className:"flex flex-col",children:[c.jsx(ze,{variant:"ui-md",className:"text-neutral6 font-medium",children:e.type==="map-config"?`${e.stepName} Config`:`${e.stepName} Workflow`}),e.type==="map-config"&&e.stepId&&e.stepId!==e.stepName&&c.jsx(ze,{variant:"ui-xs",className:"text-neutral3",children:e.stepId})]})]}),c.jsx("button",{onClick:t,className:"p-1 hover:bg-surface3 rounded transition-colors","aria-label":"Close",children:c.jsx(Os,{className:"w-4 h-4 text-neutral3"})})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[e.type==="map-config"&&e.mapConfig&&c.jsx(Ow,{data:e.mapConfig}),e.type==="nested-graph"&&e.nestedGraph&&c.jsx("div",{className:"h-full min-h-[400px]",children:c.jsx(Dce,{children:c.jsx(Xen,{stepGraph:e.nestedGraph.stepGraph,open:!0,workflowName:e.nestedGraph.fullStep})},e.nestedGraph.fullStep)})]})]}):null}const Kpe=({requestContextSchema:e})=>{const{setSchemaValues:t,schemaValues:r}=Mpt(),n=JSON.stringify(r),s=E.useMemo(()=>{try{const a=Av(e);return vm(fm(a))}catch(a){return console.error("Failed to parse requestContextSchema:",a),null}},[e]);return s?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(ze,{as:"span",variant:"ui-md",className:"text-neutral3",children:"Request Context"}),c.jsx(ql,{content:n})]}),c.jsx(Qpe,{schema:s,onSubmit:t,submitButtonLabel:"Save",defaultValues:r})]}):c.jsx("div",{className:"text-neutral3",children:c.jsx(ze,{variant:"ui-sm",children:"Failed to parse request context schema"})})};function Ken(){return E.useMemo(()=>{const e=typeof window<"u"?window.MASTRA_REQUEST_CONTEXT_PRESETS:void 0;if(!e||e==="%%MASTRA_REQUEST_CONTEXT_PRESETS%%")return null;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t}catch{console.warn("Failed to parse request context presets")}return null},[])}function Jen({workflowId:e,initialRunId:t}){const{data:r,isLoading:n,error:s}=lj(e),{createWorkflowRun:a,streamWorkflow:i,streamResult:o,isStreamingWorkflow:l,observeWorkflowStream:u,closeStreamsAndReset:d,resumeWorkflow:p,cancelWorkflowRun:f,isCancellingWorkflowRun:h}=E.useContext(Fm),{stepDetail:m,closeStepDetail:g}=Q6(),[b,v]=E.useState("current-run"),[S,w]=E.useState(""),{handleCopy:k}=Zf({text:e}),_=Object.keys(r?.steps??{}).length,C=E.useMemo(()=>m?m.type==="map-config"?"Map Config":m.type==="nested-graph"?"Nested Workflow":"Node":null,[m]);E.useEffect(()=>{!S&&!t&&d()},[S,t]),E.useEffect(()=>{if(s){const A=s instanceof Error?s.message:"Failed to load workflow";Xe.error(`Error loading workflow: ${A}`)}},[s]),E.useEffect(()=>{m?v("node-details"):b==="node-details"&&v("current-run")},[m]);const T=A=>{b==="node-details"&&A!=="node-details"&&g(),v(A)};return s?null:c.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-full overflow-y-auto",children:[c.jsx(Qpt,{icon:c.jsx(Yl,{}),title:r?.name||"",isLoading:n,children:c.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx("button",{onClick:k,className:"h-badge-default",children:c.jsx(Ft,{icon:c.jsx(Ql,{}),variant:"default",children:e})})}),c.jsx(sn,{children:"Copy Workflow ID for use in code"})]}),c.jsxs(Ft,{children:[_," step",_>1?"s":""]}),r?.isProcessorWorkflow&&c.jsx(Ft,{icon:c.jsx(dA,{className:"h-3 w-3"}),className:"bg-violet-500/20 text-violet-400",children:"Processor"})]})}),c.jsx("div",{className:"flex-1 overflow-auto border-t border-border1 flex flex-col",children:c.jsxs(TO,{defaultTab:"current-run",value:b,onValueChange:T,className:"h-full",children:[c.jsxs(AO,{children:[c.jsx(gl,{value:"current-run",children:"Current Run"}),r?.requestContextSchema&&c.jsx(gl,{value:"request-context",children:"Request Context"}),c.jsx(gl,{value:"run-options",children:"Run Options"}),m&&C&&c.jsxs(gl,{value:"node-details",onClose:()=>{g(),v("current-run")},children:[C," Details"]})]}),c.jsx(Tc,{value:"current-run",children:e?t?c.jsx(Uen,{workflowId:e,runId:t,setRunId:w,workflow:r??void 0,isLoading:n,createWorkflowRun:a,streamWorkflow:i,resumeWorkflow:p,streamResult:o,isStreamingWorkflow:l,isCancellingWorkflowRun:h,cancelWorkflowRun:f,observeWorkflowStream:u}):c.jsx(Hpt,{workflowId:e,setRunId:w,workflow:r??void 0,isLoading:n,createWorkflowRun:a,streamWorkflow:i,resumeWorkflow:p,streamResult:o,isStreamingWorkflow:l,isCancellingWorkflowRun:h,cancelWorkflowRun:f}):null}),r?.requestContextSchema&&c.jsx(Tc,{value:"request-context",children:c.jsx("div",{className:"p-5",children:c.jsx(Kpe,{requestContextSchema:r.requestContextSchema})})}),c.jsx(Tc,{value:"run-options",children:c.jsx(Gpt,{})}),m&&c.jsx(Tc,{value:"node-details",children:c.jsx(Yen,{})})]})})]})}const bn={root:"flex flex-col gap-1.5",trigger:"w-full min-w-32 justify-between",triggerError:"border-accent2",chevron:"ml-2 h-4 w-4 shrink-0 opacity-50",placeholder:"text-neutral3",popup:K("min-w-[var(--anchor-width)] w-max max-w-[500px] rounded-md bg-surface3 text-neutral5","shadow-elevated","origin-[var(--transform-origin)]","transition-[transform,scale,opacity] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0"),positioner:"z-[100]",searchContainer:K("flex items-center border-b border-border1 px-3 py-2",Wr.colors),searchIcon:K("mr-2 h-4 w-4 shrink-0 text-neutral3",Wr.colors),searchInput:K("flex h-8 w-full rounded-md bg-transparent py-1 text-sm","placeholder:text-neutral3 disabled:cursor-not-allowed disabled:opacity-50","outline-none",Wr.colors),empty:"[&:not(:empty)]:block hidden py-6 text-center text-sm text-neutral3",list:"max-h-dropdown-max-height overflow-y-auto overflow-x-hidden p-1",item:K("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm",Wr.colors,"data-[highlighted]:bg-surface5 data-[highlighted]:text-neutral5"),itemSelected:"data-[selected]:bg-accent1Dark data-[selected]:text-accent1",checkContainer:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center",checkIcon:K("h-4 w-4 text-accent1",Wr.opacity),checkbox:"mr-2 flex h-4 w-4 shrink-0 items-center justify-center rounded border",checkboxSelected:"bg-accent1 border-accent1",checkboxUnselected:"border-border1",checkboxIcon:"h-3 w-3 text-white",optionContent:"flex items-center gap-2 w-full min-w-0",optionText:"flex flex-col gap-0.5 min-w-0",optionLabel:"truncate",optionDescription:"text-xs text-neutral3 truncate",optionEnd:"ml-auto",error:"text-xs text-accent2"};function Cu({options:e,value:t,onValueChange:r,placeholder:n="Select option...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:o=!1,variant:l="default",size:u="md",open:d,onOpenChange:p,container:f,error:h}){const m=e.find(b=>b.value===t)??null,g=b=>{b&&r?.(b.value)};return c.jsxs("div",{className:bn.root,children:[c.jsxs(zlt,{items:e,value:m,onValueChange:g,disabled:o,open:d,onOpenChange:p,children:[c.jsxs(Zlt,{className:K(U6({variant:l,size:u}),bn.trigger,h&&bn.triggerError,i),children:[c.jsxs("span",{className:"truncate flex items-center gap-2",children:[m?.start,c.jsx(GUr,{placeholder:n})]}),c.jsx(qBe,{className:bn.chevron})]}),c.jsx(Klt,{container:f,children:c.jsx(ect,{align:"start",sideOffset:4,className:bn.positioner,children:c.jsxs(tct,{className:bn.popup,children:[c.jsxs("div",{className:bn.searchContainer,children:[c.jsx(_m,{className:bn.searchIcon}),c.jsx(Qlt,{className:bn.searchInput,placeholder:s})]}),c.jsx(ict,{className:bn.empty,children:a}),c.jsx(Xlt,{className:bn.list,children:b=>c.jsxs(act,{value:b,className:K(bn.item,bn.itemSelected),children:[c.jsx("span",{className:bn.checkContainer,children:c.jsx(PVr,{children:c.jsx(ya,{className:bn.checkIcon})})}),c.jsxs("span",{className:bn.optionContent,children:[b.start,c.jsxs("span",{className:bn.optionText,children:[c.jsx("span",{className:bn.optionLabel,children:b.label}),b.description&&c.jsx("span",{className:bn.optionDescription,children:b.description})]}),b.end?c.jsx("div",{className:bn.optionEnd,children:b.end}):null]})]},b.value)})]})})})]}),h&&c.jsx("span",{className:bn.error,children:h})]})}function etn({options:e,value:t=[],onValueChange:r,placeholder:n="Select options...",searchPlaceholder:s="Search...",emptyText:a="No option found.",className:i,disabled:o=!1,variant:l="default",size:u="md",open:d,onOpenChange:p,container:f,error:h}){const m=e.filter(v=>t.includes(v.value)),g=v=>{v&&r?.(v.map(S=>S.value))},b=m.length===0?n:`${m.length} selected`;return c.jsxs("div",{className:bn.root,children:[c.jsxs(zlt,{multiple:!0,items:e,value:m,onValueChange:g,disabled:o,open:d,onOpenChange:p,children:[c.jsxs(Zlt,{className:K(U6({variant:l,size:u}),bn.trigger,h&&bn.triggerError,i),children:[c.jsx("span",{className:K("truncate",m.length===0&&bn.placeholder),children:b}),c.jsx(qBe,{className:bn.chevron})]}),c.jsx(Klt,{container:f,children:c.jsx(ect,{align:"start",sideOffset:4,className:bn.positioner,children:c.jsxs(tct,{className:bn.popup,children:[c.jsxs("div",{className:bn.searchContainer,children:[c.jsx(_m,{className:bn.searchIcon}),c.jsx(Qlt,{className:bn.searchInput,placeholder:s})]}),c.jsx(ict,{className:bn.empty,children:a}),c.jsx(Xlt,{className:bn.list,children:v=>{const S=t.includes(v.value);return c.jsxs(act,{value:v,className:bn.item,children:[c.jsx("span",{className:K(bn.checkbox,S?bn.checkboxSelected:bn.checkboxUnselected),children:S&&c.jsx(ya,{className:bn.checkboxIcon})}),c.jsxs("span",{className:bn.optionContent,children:[v.start,c.jsxs("span",{className:bn.optionText,children:[c.jsx("span",{className:bn.optionLabel,children:v.label}),v.description&&c.jsx("span",{className:bn.optionDescription,children:v.description})]}),v.end?c.jsx("div",{className:bn.optionEnd,children:v.end}):null]})]},v.value)}})]})})})]}),h&&c.jsx("span",{className:bn.error,children:h})]})}const wy=()=>{const e=st(),{requestContext:t}=Ss();return ur({queryKey:["workflows",t],queryFn:async()=>{const r=await e.listWorkflows(t);return Object.fromEntries(Object.entries(r).filter(([n,s])=>!s.isProcessorWorkflow))}})};function ttn({value:e,onValueChange:t,placeholder:r="Select a workflow...",searchPlaceholder:n="Search workflows...",emptyText:s="No workflows found.",className:a,disabled:i=!1,variant:o="default"}){const{data:l={},isLoading:u,isError:d,error:p}=wy(),{navigate:f,paths:h}=Yt();E.useEffect(()=>{if(d){const b=p instanceof Error?p.message:"Failed to load workflows";Xe.error(`Error loading workflows: ${b}`)}},[d,p]);const m=Object.keys(l).map(b=>({label:l[b]?.name||b,value:b})),g=b=>{t?t(b):b&&b!==e&&f(h.workflowLink(b))};return c.jsx(Cu,{options:m,value:e,onValueChange:g,placeholder:u?"Loading workflows...":r,searchPlaceholder:n,emptyText:s,className:a,disabled:i||u||d,variant:o})}function Hr({children:e,className:t,style:r}){const n=Zpt("MainContentLayout");return c.jsx("main",{className:K("grid grid-rows-[auto_1fr] h-full items-start content-start",t),style:{...r,...n?{border:"3px dotted red"}:{}},children:e})}function Si({children:e,className:t,isCentered:r=!1,isDivided:n=!1,hasLeftServiceColumn:s=!1,style:a}){const i=Zpt("MainContentContent"),o=Jpe({isCentered:r,isDivided:n,hasLeftServiceColumn:s,className:t});return c.jsx("div",{className:o,style:{...a,...i?{border:"3px dotted orange"}:{}},children:e})}const Jpe=({isCentered:e,isDivided:t,hasLeftServiceColumn:r,className:n})=>K("grid overflow-y-auto h-full ","overflow-x-auto min-w-[min-content]",{"items-start content-start":!e&&!t&&!r,"grid place-items-center":e,"grid-cols-[1fr_1fr]":t&&!r,"grid-cols-[12rem_1fr_1fr]":t&&r,"grid-cols-[auto_1fr]":!t&&r},n);function Zpt(e){try{const t=localStorage.getItem("add-dev-style-to-components");return t?t.split(",").map(n=>n.trim()).filter(Boolean).includes(e):!1}catch(t){return console.error("Error reading or parsing localStorage:",t),!1}}const T4=()=>c.jsx(bqr,{className:K("w-1.5 bg-surface3","[&[data-separator='hover']]:!bg-surface4","[&[data-separator='active']]:!bg-surface5","focus:outline-none")}),A4=({collapsedSize:e,children:t,direction:r,...n})=>{const[s,a]=E.useState(!1),i=gqr(),o=()=>{i.current&&i.current.expand()};return c.jsx(Yde,{panelRef:i,collapsedSize:e,...n,onResize:l=>{e&&typeof e=="number"&&(l.inPixels<=e?a(!0):s&&a(!1))},children:s?c.jsxs(dn,{children:[c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(pn,{asChild:!0,children:c.jsx(ye,{onClick:o,className:"!h-48 border-none",children:c.jsx(ve,{children:r==="left"?c.jsx(Wh,{}):c.jsx(KN,{})})})})}),c.jsx(sn,{children:"Expand"})]}):t})},rtn=({workflowId:e,children:t,leftSlot:r,rightSlot:n})=>{const{defaultLayout:s,onLayoutChange:a}=Ect({id:`workflow-layout-${e}`,storage:localStorage}),i=Jpe({isCentered:!1,isDivided:!0,hasLeftServiceColumn:!!r});return c.jsxs(wct,{className:i,defaultLayout:s,onLayoutChange:a,children:[r&&c.jsxs(c.Fragment,{children:[c.jsx(A4,{direction:"left",id:"left-slot",minSize:200,maxSize:"30%",defaultSize:200,collapsedSize:60,collapsible:!0,children:r}),c.jsx(T4,{})]}),c.jsx(Yde,{id:"main-slot",children:t}),n&&c.jsxs(c.Fragment,{children:[c.jsx(T4,{}),c.jsx(A4,{direction:"right",id:"right-slot",minSize:300,maxSize:"50%",defaultSize:300,collapsedSize:60,collapsible:!0,children:n})]})]})},efe=()=>c.jsx(V6,{icon:c.jsx(Cn,{color:fze.neutral3}),title:c.jsx(Nr,{className:"ml-2 w-12 h-2"}),collapsible:!1}),ntn=({result:e,workflowId:t,isStreaming:r,metadata:n,toolCallId:s,toolApprovalMetadata:a,suspendPayload:i,toolName:o,isNetwork:l,toolCalled:u})=>{const{runId:d,status:p}=e||{},{data:f,isLoading:h}=lj(t),{data:m,isLoading:g}=kpt(t,{enabled:!!d&&!r}),b=m?.find(C=>C.runId===d),v=g||!b,S=typeof b?.snapshot=="object"?b?.snapshot:void 0,w=n?.mode==="network"?n.selectionReason:void 0,k=n?.mode==="network"?n.agentInput:void 0;let _=typeof i=="string"?c.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:i}):c.jsx(Wa,{data:i,"data-testid":"tool-suspend-payload"});return h||!f?c.jsx(efe,{}):c.jsxs(V6,{"data-testid":"workflow-badge",icon:c.jsx(Yl,{className:"text-accent3"}),title:f.name,initialCollapsed:!1,extraInfo:n?.mode==="network"&&c.jsx(Bpe,{selectionReason:w??"",input:k}),children:[!r&&!v&&c.jsx(Upe,{snapshot:S,workflowId:t,initialRunId:d,withoutTimeTravel:!0,children:c.jsx(qPe,{workflowId:t,workflow:f,runId:d})}),r&&c.jsx(qPe,{workflowId:t,workflow:f,runId:d}),_!==void 0&&i&&c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Workflow suspend payload"}),_]}),c.jsx(oj,{toolCalled:u??!!p,toolCallId:s,toolApprovalMetadata:a,toolName:o,isNetwork:l,isGenerateMode:n?.mode==="generate"})]})},qPe=({workflowId:e,workflow:t,runId:r})=>{const{Link:n}=Yt();return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center gap-2 pb-2",children:[c.jsx(ye,{as:n,href:`/workflows/${e}/graph`,children:"Go to workflow"}),r&&c.jsx(ye,{as:n,href:`/workflows/${e}/graph/${r}`,children:"See run"})]}),c.jsx("div",{className:"rounded-md overflow-hidden h-[60vh] w-full",children:c.jsx(qpt,{workflowId:e,workflow:t})})]})},stn=e=>{const{setResult:t}=E.useContext(Fm);E.useEffect(()=>{e&&t(e)},[e])},atn=({agentId:e,messages:t=[],metadata:r,toolCallId:n,toolApprovalMetadata:s,toolName:a,isNetwork:i,suspendPayload:o,toolCalled:l,isComplete:u=!1})=>{const d=r?.mode==="network"?r.selectionReason:void 0,p=r?.mode==="network"?r.agentInput:void 0;let f=t.length>0;i&&(f=l??t.every(m=>m.type==="text"?!0:!!m.toolOutput));let h=typeof o=="string"?c.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:o}):c.jsx(Wa,{data:o,"data-testid":"tool-suspend-payload"});return c.jsxs(V6,{"data-testid":"agent-badge",icon:c.jsx(Mi,{className:"text-accent1"}),title:e,initialCollapsed:u,extraInfo:r?.mode==="network"&&c.jsx(Bpe,{selectionReason:d??"",input:p}),children:[t.map((m,g)=>{if(m.type==="text")return c.jsx(Oct,{children:m.content},g);let b;try{b=typeof m.toolOutput=="string"?JSON.parse(m.toolOutput):m.toolOutput}catch{b=m.toolOutput}return c.jsx(Ee.Fragment,{children:c.jsx(eft,{toolName:m.toolName,argsText:typeof m.args=="string"?m.args:JSON.stringify(m.args),result:b,args:m.args,status:{type:"complete"},type:"tool-call",toolCallId:m.toolCallId,addResult:()=>{},resume:()=>{},metadata:{mode:"stream"}})},g)}),h!==void 0&&o&&c.jsxs("div",{children:[c.jsx("p",{className:"font-medium pb-2",children:"Agent suspend payload"}),h]}),c.jsx(oj,{toolCalled:f,toolCallId:n,toolApprovalMetadata:s,toolName:a,isNetwork:i,isGenerateMode:r?.mode==="generate"})]})},Wpt=({threadId:e,agentId:t,memory:r})=>{const n=st(),{requestContext:s}=Ss();return ur({queryKey:["memory","messages",e,t,"requestContext"],queryFn:async()=>e?await n.listThreadMessages(e,{agentId:t,requestContext:s}):null,enabled:r&&!!e,staleTime:0,gcTime:0,retry:!1,refetchOnWindowFocus:!1})},itn=({agentId:e,result:t,metadata:r,toolCallId:n,toolApprovalMetadata:s,toolName:a,isNetwork:i,suspendPayload:o,toolCalled:l,isComplete:u})=>{const{data:d,isLoading:p}=Wpt({threadId:t?.subAgentThreadId,agentId:e,memory:!0});if(p)return c.jsx(efe,{});const f=d?.messages?kct(d.messages):[],h=t?.childMessages??uxr(f);return c.jsx(atn,{agentId:e,messages:h,metadata:r,toolCallId:n,toolApprovalMetadata:s,toolName:a,isNetwork:i,suspendPayload:o,toolCalled:l,isComplete:u})};function Lk({children:e}){const t=e.replace(/\\n/g,`
570
570
  `);return c.jsx(Oct,{remarkPlugins:[$Ue],components:ltn,className:"space-y-3",children:t})}const Xpt=Ee.memo(({children:e,language:t,...r})=>{const[n,s]=E.useState([]);return E.useEffect(()=>{vJr(e,t).then(a=>{a&&s(a)})},[e,t]),n.length?c.jsx("pre",{...r,children:c.jsx("code",{children:n.map((a,i)=>c.jsxs(c.Fragment,{children:[c.jsx("span",{children:a.map((o,l)=>{const u=typeof o.htmlStyle=="string"?void 0:o.htmlStyle;return c.jsx("span",{className:"text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",style:u,children:o.content},l)})},i),i!==n.length-1&&`
@@ -584,7 +584,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
584
584
 
585
585
  `):e||"",r=Array.isArray(e)?e.filter(n=>n.type==="prompt_block"||n.type==="prompt_block_ref").map(n=>n.type==="prompt_block_ref"?Eht(n.id):R4(n.content,n.rules)):[R4(e||"")];return{instructionsString:t,instructionBlocks:r}},Lon=e=>{const t=e?Object.entries(e):void 0;if(t)return Object.fromEntries(t.map(([r,n])=>[r,{description:n.description,sampling:n.sampling?{type:n.sampling.type,rate:n.sampling.rate||0}:void 0,rules:n.rules}]))},Fon=e=>{if(!e)return{};let t;if(Array.isArray(e)){t={};for(const n of e)Object.assign(t,n.value)}else t=e;const r={};for(const[n,s]of Object.entries(t))r[n]={description:s.description,sampling:s.sampling?.type==="ratio"?{type:"ratio",rate:s.sampling.rate}:void 0,rules:s.rules};return r},l$e=e=>{if(!e?.enabled)return;const t=$Y(e.model),r=$Y(e.observation?.model),n=r||e.observation?.messageTokens||e.observation?.maxTokensPerBatch||e.observation?.bufferTokens!==void 0||e.observation?.bufferActivation!==void 0||e.observation?.blockAfter!==void 0?{model:r,messageTokens:e.observation?.messageTokens,maxTokensPerBatch:e.observation?.maxTokensPerBatch,bufferTokens:e.observation?.bufferTokens,bufferActivation:e.observation?.bufferActivation,blockAfter:e.observation?.blockAfter}:void 0,s=$Y(e.reflection?.model),a=s||e.reflection?.observationTokens||e.reflection?.blockAfter!==void 0||e.reflection?.bufferActivation!==void 0?{model:s,observationTokens:e.reflection?.observationTokens,blockAfter:e.reflection?.blockAfter,bufferActivation:e.reflection?.bufferActivation}:void 0;return t||e.scope||e.shareTokenBudget||n||a?{model:t,scope:e.scope,shareTokenBudget:e.shareTokenBudget,observation:n,reflection:a}:!0},Bon=e=>{if(!e)return;const t=typeof e=="object"?e:{};return{enabled:!0,model:PY(t.model),scope:t.scope,shareTokenBudget:t.shareTokenBudget,observation:t.observation?{model:PY(t.observation.model),messageTokens:t.observation.messageTokens,maxTokensPerBatch:t.observation.maxTokensPerBatch,bufferTokens:t.observation.bufferTokens,bufferActivation:t.observation.bufferActivation,blockAfter:t.observation.blockAfter}:void 0,reflection:t.reflection?{model:PY(t.reflection.model),observationTokens:t.reflection.observationTokens,blockAfter:t.reflection.blockAfter,bufferActivation:t.reflection.bufferActivation}:void 0}};async function c$e(e,t){const r=e.filter(s=>s.id).map(s=>s.id),n=await Promise.all(e.filter(s=>!s.id).map(s=>t.createStoredMCPClient({name:s.name,description:s.description,servers:s.servers}).then(a=>a.id)));return[...r,...n]}function zon(e){let t;if(e.requestContextSchema)try{t=typeof e.requestContextSchema=="string"?JSON.parse(e.requestContextSchema):e.requestContextSchema}catch{}return{name:e.name,description:e.description,instructions:e.instructions,model:{provider:e.provider,name:e.modelId},tools:e.tools,workflows:e.workflows,agents:e.agents,skills:e.skills,workspace:e.workspaceId?{workspaceId:e.workspaceId}:void 0,requestContextSchema:t}}function Uon(e){const t=RY(e.tools),r=e.memory,{instructionsString:n,instructionBlocks:s}=Mon(e.instructions);return{name:e.name||"",description:e.description||"",instructions:n,model:{provider:e.model?.provider||"",name:e.model?.name||""},tools:t,integrationTools:Ron(e.integrationTools),workflows:RY(e.workflows),agents:RY(e.agents),scorers:Fon(e.scorers),memory:r?.options?{enabled:!0,lastMessages:r.options.lastMessages,semanticRecall:r.options.semanticRecall,readOnly:r.options.readOnly,vector:r.vector,embedder:r.embedder,observationalMemory:Bon(r.observationalMemory)}:void 0,instructionBlocks:s,skills:Pon(e.skills),workspace:$on(e.workspace),variables:e.requestContextSchema}}function umt(e){const t=st(),r=va(),[n,s]=E.useState(!1),[a,i]=E.useState(!1),o=e.mode==="edit",l=o?e.agentId:void 0,u=o&&!!e.isCodeAgentOverride,d=o&&!!e.hasStoredOverride,[p,f]=E.useState(!1),h=u&&!d&&!p,{createStoredAgent:m}=r$e(),{updateStoredAgent:g}=r$e(l),b=E.useMemo(()=>o?Uon(e.dataSource):void 0,[o,o?e.dataSource:void 0]),{form:v}=min({initialValues:b,isCodeAgentOverride:u}),S=E.useEffectEvent(()=>{if(!b||e.mode!=="edit")return;v.reset(b);const I=e.dataSource.mcpClients,R=Object.keys(I??{});R.length!==0&&Promise.all(R.map($=>t.getStoredMCPClient($).details())).then($=>{const F=$.map(q=>({id:q.id,name:q.name,description:q.description,servers:q.servers,selectedTools:I?.[q.id]?.tools??{}}));v.setValue("mcpClients",F,{shouldDirty:!0});const z={...v.getValues("tools")??{}};for(const q of F)for(const[H,V]of Object.entries(q.selectedTools??{}))z[H]={description:V.description};v.setValue("tools",z,{shouldDirty:!0})}).catch(()=>{})});E.useEffect(()=>{o&&S()},[o,o?e.dataSource:void 0]);const w=E.useCallback(async I=>{if(u){const z=new Set;for(const G of I.mcpClients??[])for(const M of Object.keys(G.selectedTools??{}))z.add(M);const q={};for(const[G,M]of Object.entries(I.tools??{}))z.has(G)||(q[G]=M);const H=await c$e(I.mcpClients??[],t),V=Object.fromEntries(H.map((G,M)=>{const X=I.mcpClients?.[M]?.selectedTools??{};return[G,{tools:X}]}));return{name:I.name,model:I.model,instructions:o$e(I.instructionBlocks),tools:Object.keys(q).length>0?q:void 0,mcpClients:V,requestContextSchema:I.variables?Object.fromEntries(Object.entries(I.variables)):void 0}}if(o){const z=I.mcpClientsToDelete??[];await Promise.all(z.map(q=>t.getStoredMCPClient(q).delete()))}const R=new Set;for(const z of I.mcpClients??[])for(const q of Object.keys(z.selectedTools??{}))R.add(q);const $={};for(const[z,q]of Object.entries(I.tools??{}))R.has(z)||($[z]=q);const F=await c$e(I.mcpClients??[],t),L=Object.fromEntries(F.map((z,q)=>{const H=I.mcpClients?.[q]?.selectedTools??{};return[z,{tools:H}]}));return{name:I.name,description:I.description||void 0,instructions:o$e(I.instructionBlocks),model:I.model,tools:Object.keys($).length>0?$:void 0,integrationTools:jon(I.integrationTools),workflows:I.workflows&&Object.keys(I.workflows).length>0?I.workflows:void 0,agents:I.agents&&Object.keys(I.agents).length>0?I.agents:void 0,mcpClients:L,scorers:Lon(I.scorers),skills:I.skills,workspace:I.workspace,requestContextSchema:I.variables?Object.fromEntries(Object.entries(I.variables)):void 0}},[o,u,t]),k=E.useCallback(I=>{const R=I.memory?.enabled?{options:{lastMessages:I.memory.lastMessages,semanticRecall:I.memory.semanticRecall,readOnly:I.memory.readOnly},observationalMemory:l$e(I.memory.observationalMemory)}:void 0;if(R)return{...R,vector:I.memory?.vector,embedder:I.memory?.embedder}},[]),_=E.useCallback(async()=>{if(!o)return;if(!await v.trigger()){Xe.error("Please fill in all required fields");return}const R=v.getValues();i(!0);try{const $=await w(R),F=u?void 0:k(R);if(h){const L={id:e.agentId,...$,memory:F};await m.mutateAsync(L),f(!0)}else await g.mutateAsync({...$,memory:F});v.reset(R),r.invalidateQueries({queryKey:["agent-versions",l]}),r.invalidateQueries({queryKey:["stored-agent",l]}),r.invalidateQueries({queryKey:["agent",l]}),Xe.success("Draft saved")}catch($){Xe.error(`Failed to save draft: ${$ instanceof Error?$.message:"Unknown error"}`)}finally{i(!1)}},[v,o,l,h,e,w,k,m,g,r]),C=E.useCallback(async()=>{if(!await v.trigger()){Xe.error("Please fill in all required fields");return}const R=v.getValues();s(!0);try{if(o){if(h){const $=await w(R),F=u?void 0:k(R),L={id:e.agentId,...$,memory:F};await m.mutateAsync(L),f(!0);const q=(await t.getStoredAgent(e.agentId).listVersions({sortDirection:"DESC",perPage:1})).versions[0];q&&await t.getStoredAgent(e.agentId).activateVersion(q.id)}else{const[$,F]=await Promise.all([t.getStoredAgent(e.agentId).details(),t.getStoredAgent(e.agentId).listVersions({sortDirection:"DESC",perPage:1})]),L=F.versions[0];if(!L||L.id===$.activeVersionId){Xe.error("No draft changes to publish. Save a draft first.");return}await t.getStoredAgent(e.agentId).activateVersion(L.id)}await Promise.all([r.invalidateQueries({queryKey:["agent-versions",l]}),r.invalidateQueries({queryKey:["stored-agent",l]}),r.invalidateQueries({queryKey:["agent",l]}),r.invalidateQueries({queryKey:["agents"]}),r.invalidateQueries({queryKey:["stored-agents"]})]),Xe.success("Agent published"),e.onSuccess(e.agentId)}else{const $=await w(R),F=R.memory?.enabled?{options:{lastMessages:R.memory.lastMessages,semanticRecall:R.memory.semanticRecall,readOnly:R.memory.readOnly},observationalMemory:l$e(R.memory.observationalMemory)}:void 0,L={...$,memory:F},z=await m.mutateAsync(L);Xe.success("Agent created successfully"),e.onSuccess(z.id)}}catch($){const F=o?"publish":"create";Xe.error(`Failed to ${F} agent: ${$ instanceof Error?$.message:"Unknown error"}`)}finally{s(!1)}},[v,o,h,t,m,e,l,w,k,r]),T=Ds({control:v.control}),A=E.useMemo(()=>{if(u)return(T.instructionBlocks??[]).some(F=>F.type==="prompt_block_ref"||F.type==="prompt_block"&&F.content?.trim());const I=!!T.name&&!!T.model?.provider&&!!T.model?.name,R=(T.instructionBlocks??[]).some($=>$.type==="prompt_block_ref"||$.type==="prompt_block"&&$.content?.trim());return I&&R},[u,T.name,T.model?.provider,T.model?.name,T.instructionBlocks]),N=v.formState.isDirty;return{form:v,handlePublish:C,handleSaveDraft:_,isSubmitting:n,isSavingDraft:a,canPublish:A,isDirty:N}}function dmt({form:e,mode:t,agentId:r,isSubmitting:n,isSavingDraft:s,handlePublish:a,handleSaveDraft:i,readOnly:o,isCodeAgentOverride:l,basePath:u,currentPath:d,banner:p,children:f,versionId:h,rightPanel:m}){return c.jsx(Trn,{form:e,mode:t,agentId:r,isSubmitting:n,isSavingDraft:s,handlePublish:a,handleSaveDraft:i,readOnly:o,isCodeAgentOverride:l,children:c.jsxs(kin,{basePath:u,currentPath:d,versionId:h,rightPanel:m,children:[p,f]})})}function Von(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function qon({agentId:e,selectedVersionId:t,onVersionSelect:r,activeVersionId:n}){const{data:s,isLoading:a}=nht({agentId:e,params:{sortDirection:"DESC"}}),i=s?.versions??[],l=(n?i.find(u=>u.id===n):void 0)?.versionNumber;return c.jsxs("div",{className:"h-full flex flex-col",children:[c.jsx("div",{className:"px-3 py-3 border-b border-border1",children:c.jsx(ze,{variant:"ui-sm",className:"font-medium text-neutral5",children:"Version history"})}),c.jsx(pi,{className:"flex-1 min-h-0",children:a?c.jsx("div",{className:"px-3 py-4",children:c.jsx(ze,{variant:"ui-xs",className:"text-neutral2",children:"Loading versions..."})}):c.jsx("ul",{className:"flex flex-col",children:i.map(u=>{const d=t===u.id||!t&&u.id===i[0]?.id,p=u.id===n,f=l!==void 0&&u.versionNumber>l;return c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>r(u.id),className:K("w-full text-left px-3 py-2.5 text-sm transition-colors border-l-2",d?"bg-surface2 text-neutral5 border-accent1":"border-transparent text-neutral3 hover:bg-surface3 hover:text-neutral5"),children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs(ze,{variant:"ui-sm",className:"text-inherit",children:["v",u.versionNumber]}),p&&c.jsx(Ft,{variant:"success",children:"Published"}),f&&c.jsx(Ft,{variant:"info",children:"Draft"})]}),c.jsx(ze,{variant:"ui-xs",className:"text-neutral2 mt-0.5",children:Von(u.createdAt)})]})},u.id)})})})]})}const Hon=({row:e})=>{const{Link:t,paths:r}=Yt(),n=e.original;return c.jsx(ax,{name:c.jsx(t,{className:"w-full space-y-0",href:r.processorLink(n.id),children:n.name||n.id}),description:n.description})},Qon=({row:e})=>{const r=e.original.phases||[],n={input:"Input",inputStep:"Input Step",outputStream:"Output Stream",outputResult:"Output Result",outputStep:"Output Step"};return c.jsx(Hs,{children:c.jsx("div",{className:"flex flex-wrap gap-1",children:r.map(s=>c.jsx(Ft,{variant:"default",children:n[s]||s},s))})})},Gon=({row:e})=>{const r=e.original.agentIds?.length||0;return c.jsx(Hs,{children:c.jsxs(Ft,{variant:"default",icon:c.jsx(Mi,{className:"text-accent1"}),children:[r," agent",r!==1?"s":""]})})},Zon=[{header:"Name",accessorKey:"name",cell:Hon},{header:"Phases",accessorKey:"phases",cell:Qon},{header:"Used by",accessorKey:"agentIds",cell:Gon}];function Won({processors:e,isLoading:t,error:r}){const[n,s]=E.useState(""),{navigate:a,paths:i}=Yt(),o=E.useMemo(()=>Object.values(e??{}).filter(h=>h.phases&&h.phases.length>0),[e]),l=E.useMemo(()=>{const h=n.toLowerCase();return o.filter(m=>{const g=m.id.toLowerCase(),b=(m.name||"").toLowerCase();return g.includes(h)||b.includes(h)})},[o,n]),{activeIndex:u}=cS({itemCount:l.length,global:!0,onSelect:h=>{const m=l[h];m&&(m.isWorkflow?a(i.workflowLink(m.id)+"/graph"):a(i.processorLink(m.id)))}}),d=ex({data:l,columns:Zon,getCoreRowModel:Jv()}),p=d.getHeaderGroups()[0],f=d.getRowModel().rows;return r&&Mc(r)?c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"processors"})}):o.length===0&&!t?c.jsx(Yon,{}):c.jsxs("div",{children:[c.jsx(Sy,{children:c.jsx(ju,{onSearch:s,label:"Search processors",placeholder:"Search processors"})}),t?c.jsx(Xon,{}):c.jsx(ix,{children:c.jsx(nc,{children:c.jsxs(Tl,{children:[c.jsx(Al,{className:"sticky top-0",children:p.headers.map(h=>c.jsx(Aa,{style:{width:h.column.getSize()??"auto"},children:Xl(h.column.columnDef.header,h.getContext())},h.id))}),c.jsx(Dl,{children:f.map((h,m)=>c.jsx(Nl,{isActive:m===u,onClick:()=>{h.original.isWorkflow?a(i.workflowLink(h.original.id)+"/graph"):a(i.processorLink(h.original.id))},children:h.getVisibleCells().map(g=>c.jsx(Ee.Fragment,{children:Xl(g.column.columnDef.cell,g.getContext())},g.id))},h.id))})]})})})]})}const Xon=()=>c.jsxs(Tl,{children:[c.jsxs(Al,{children:[c.jsx(Aa,{children:"Name"}),c.jsx(Aa,{children:"Phases"}),c.jsx(Aa,{children:"Used by"})]}),c.jsx(Dl,{children:Array.from({length:3}).map((e,t)=>c.jsxs(Nl,{children:[c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-1/2"})}),c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-1/2"})}),c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-1/2"})})]},t))})]}),Yon=()=>c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Bc,{iconSlot:c.jsx(dA,{}),titleSlot:"Configure Processors",descriptionSlot:"No processors are configured yet. Add input or output processors to your agents to transform messages.",actionSlot:c.jsxs(ye,{size:"lg",className:"w-full",variant:"light",as:"a",href:"https://mastra.ai/docs/agents/processors",target:"_blank",children:[c.jsx(ve,{children:c.jsx(dA,{})}),"Docs"]})})}),ffe=()=>{const{requestContext:e}=Ss(),t=st();return ur({queryKey:["processors"],queryFn:()=>t.listProcessors(e)})},pmt=(e,t)=>{const r=st(),{requestContext:n}=Ss();return ur({queryKey:["processor",e],queryFn:()=>r.getProcessor(e).details(n),enabled:!!e})},Kon=()=>{const e=st(),{requestContext:t}=Ss();return Kr({mutationFn:async({processorId:r,phase:n,messages:s,agentId:a})=>e.getProcessor(r).execute({phase:n,messages:s,agentId:a,requestContext:t})})},Jon={input:"Input - Process input messages before LLM (once at start)",inputStep:"Input Step - Process at each agentic loop step",outputStream:"Output Stream - Process streaming chunks",outputResult:"Output Result - Process complete output after streaming",outputStep:"Output Step - Process after each LLM response (before tools)"};function eln({processorId:e}){const{data:t,isLoading:r,error:n}=pmt(e);return E.useEffect(()=>{if(n){const s=n instanceof Error?n.message:"Failed to load processor";Xe.error(`Error loading processor: ${s}`)}},[n]),r?c.jsxs("div",{className:"p-6",children:[c.jsx(Nr,{className:"h-8 w-48 mb-4"}),c.jsx(Nr,{className:"h-32 w-full"})]}):n?null:t?c.jsx(tln,{processor:t}):c.jsx("div",{className:"py-12 text-center px-6",children:c.jsx(ze,{variant:"header-md",className:"text-neutral3",children:"Processor not found"})})}function tln({processor:e}){const t=sx(),r=E.useId(),[n,s]=E.useState(e.phases[0]||"input"),[a,i]=E.useState(e.configurations[0]?.agentId||""),[o,l]=E.useState("Hello, this is a test message."),[u,d]=E.useState(null),[p,f]=E.useState(),h=Kon(),m=async()=>{f(void 0),d(null);const v=n==="outputStep"||n==="outputResult"?"assistant":"user",S=[{id:crypto.randomUUID(),role:v,createdAt:new Date,content:{format:2,parts:[{type:"text",text:o}]}}];try{const w=await h.mutateAsync({processorId:e.id,phase:n,messages:S,agentId:a||void 0});d(w),!w.success&&w.error&&f(w.error)}catch(w){f(w.message||"An error occurred")}},g=u?JSON.stringify(u,null,2):"{}";return c.jsxs(Si,{hasLeftServiceColumn:!0,className:"relative",children:[c.jsxs("div",{className:"bg-surface2 border-r border-border1 w-[22rem] overflow-y-auto",children:[c.jsx(rln,{processor:e}),c.jsxs("div",{className:"p-5 space-y-5",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(ze,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Phase"}),c.jsxs(Ro,{value:n,onValueChange:b=>s(b),children:[c.jsx(go,{className:"w-full",children:c.jsx(Po,{placeholder:"Select phase"})}),c.jsx(yo,{children:e.phases.map(b=>c.jsx(Ms,{value:b,children:b},b))})]}),c.jsx(ze,{variant:"ui-xs",className:"text-neutral4",children:Jon[n]})]}),e.configurations.length>1&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(ze,{as:"label",variant:"ui-sm",className:"text-neutral3",children:"Agent Configuration"}),c.jsxs(Ro,{value:a,onValueChange:i,children:[c.jsx(go,{className:"w-full",children:c.jsx(Po,{placeholder:"Select agent"})}),c.jsx(yo,{children:e.configurations.map(b=>c.jsxs(Ms,{value:b.agentId,children:[b.agentName," (",b.type,")"]},b.agentId))})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(ze,{as:"label",htmlFor:r,variant:"ui-sm",className:"text-neutral3",children:"Test Message"}),c.jsx("textarea",{id:r,value:o,onChange:b=>l(b.target.value),placeholder:"Enter a test message...",rows:4,className:"w-full bg-transparent border border-border1 rounded-md p-3 text-ui-sm text-neutral6 placeholder:text-neutral3 focus:outline-none focus:ring-2 focus:ring-accent1"})]}),c.jsx(ye,{onClick:m,disabled:h.isPending||n==="outputStream",className:"w-full",children:h.isPending?"Running...":"Run Processor"}),n==="outputStream"&&c.jsx(ze,{variant:"ui-xs",className:"text-accent6",children:"Output Stream phase cannot be executed directly. Use streaming instead."}),u&&c.jsxs("div",{className:"space-y-2 pt-4 border-t border-border1",children:[c.jsx(ze,{variant:"ui-sm",className:"text-neutral3",children:"Status"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Ft,{variant:u.success?"success":"error",children:u.success?"Success":"Failed"}),u.tripwire?.triggered&&c.jsx(Ft,{variant:"info",children:"Tripwire Triggered"})]}),u.tripwire?.triggered&&u.tripwire.reason&&c.jsxs("div",{className:"mt-2 p-3 bg-accent6Dark rounded-md border border-accent6/20",children:[c.jsx(ze,{variant:"ui-sm",className:"text-accent6 font-medium",children:"Tripwire Reason"}),c.jsx(ze,{variant:"ui-sm",className:"text-neutral3 mt-1",children:u.tripwire.reason})]})]})]})]}),c.jsx("div",{className:"absolute top-4 right-4 z-10",children:c.jsx(ql,{content:g,tooltip:"Copy JSON result to clipboard"})}),c.jsx("div",{className:"p-5 h-full relative overflow-x-auto overflow-y-auto",children:c.jsx(Sd,{value:p||g,editable:!0,theme:t,extensions:[hd]})})]})}function rln({processor:e}){return c.jsxs("div",{className:"px-5 pt-5 pb-4 border-b border-border1",children:[c.jsx(ze,{variant:"header-md",className:"text-neutral1 mb-2",children:e.name||e.id}),e.name&&e.name!==e.id&&c.jsx(ze,{variant:"ui-sm",className:"text-neutral4 mb-3",children:e.id}),c.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:e.phases.map(t=>c.jsx(Ft,{variant:"default",children:t},t))}),c.jsx("div",{className:"mt-3",children:c.jsxs(ze,{variant:"ui-xs",className:"text-neutral4",children:["Attached to ",e.configurations.length," agent",e.configurations.length!==1?"s":""]})})]})}function nln({value:e,onValueChange:t,placeholder:r="Select a processor...",searchPlaceholder:n="Search processors...",emptyText:s="No processors found.",className:a,disabled:i=!1,variant:o="default"}){const{data:l={},isLoading:u,isError:d,error:p}=ffe(),{navigate:f,paths:h}=Yt();E.useEffect(()=>{if(d){const b=p instanceof Error?p.message:"Failed to load processors";Xe.error(`Error loading processors: ${b}`)}},[d,p]);const m=Object.keys(l).filter(b=>{const v=l[b];return v?.phases&&v.phases.length>0}).map(b=>({label:l[b]?.name||b,value:b})),g=b=>{t?t(b):b&&b!==e&&(l[b]?.isWorkflow?f(h.workflowLink(b)+"/graph"):f(h.processorLink(b)))};return c.jsx(Cu,{options:m,value:e,onValueChange:g,placeholder:u?"Loading processors...":r,searchPlaceholder:n,emptyText:s,className:a,disabled:i||u||d,variant:o})}const sln=({row:e})=>{const{Link:t,paths:r}=Yt(),n=e.original;return c.jsx(ax,{name:c.jsx(t,{className:"w-full space-y-0",href:r.toolLink(n.id),children:n.id}),description:n.description})},aln=[{header:"Name",accessorKey:"name",cell:sln},{header:"Attached entities",accessorKey:"attachedEntities",cell:({row:e})=>{const r=e.original.agents.length;return c.jsx(Hs,{children:c.jsxs(Ft,{variant:"default",icon:c.jsx(Mi,{className:"text-accent1"}),children:[r," agent",r>1?"s":""]})})}}],iln=(e,t)=>{const r=new Map,n=Object.keys(t);for(const s of n){const a=t[s],i=a.tools,o=Object.keys(i);for(const l of o){const u=i[l];r.has(u.id)||r.set(u.id,{...u,agents:[]}),r.get(u.id).agents.push({...a,id:s})}}for(const[s,a]of Object.entries(e))r.has(a.id)||r.set(a.id,{...a,agents:[]});return Array.from(r.values())};function oln({tools:e,agents:t,isLoading:r,error:n}){const[s,a]=E.useState(""),{navigate:i,paths:o}=Yt(),l=E.useMemo(()=>iln(e,t),[e,t]),u=E.useMemo(()=>l.filter(m=>m.id.toLowerCase().includes(s.toLowerCase())),[l,s]),{activeIndex:d}=cS({itemCount:u.length,global:!0,onSelect:m=>{const g=u[m];g&&i(o.toolLink(g.id))}}),p=ex({data:u,columns:aln,getCoreRowModel:Jv()}),f=p.getHeaderGroups()[0],h=p.getRowModel().rows;return n&&Mc(n)?c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"tools"})}):l.length===0&&!r?c.jsx(cln,{}):c.jsxs("div",{children:[c.jsx(Sy,{children:c.jsx(ju,{onSearch:a,label:"Search tools",placeholder:"Search tools"})}),r?c.jsx(lln,{}):c.jsx(ix,{children:c.jsx(nc,{children:c.jsxs(Tl,{children:[c.jsx(Al,{className:"sticky top-0",children:f.headers.map(m=>c.jsx(Aa,{style:{width:m.column.getSize()??"auto"},children:Xl(m.column.columnDef.header,m.getContext())},m.id))}),c.jsx(Dl,{children:h.map((m,g)=>c.jsx(Nl,{isActive:g===d,onClick:()=>i(o.toolLink(m.original.id)),children:m.getVisibleCells().map(b=>c.jsx(Ee.Fragment,{children:Xl(b.column.columnDef.cell,b.getContext())},b.id))},m.id))})]})})})]})}const lln=()=>c.jsxs(Tl,{children:[c.jsxs(Al,{children:[c.jsx(Aa,{children:"Name"}),c.jsx(Aa,{children:"Used by"})]}),c.jsx(Dl,{children:Array.from({length:3}).map((e,t)=>c.jsxs(Nl,{children:[c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-1/2"})}),c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-1/2"})})]},t))})]}),cln=()=>c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Bc,{iconSlot:c.jsx(nJr,{}),titleSlot:"Configure Tools",descriptionSlot:"Mastra tools are not configured yet. You can find more information in the documentation.",actionSlot:c.jsxs(ye,{size:"lg",className:"w-full",variant:"light",as:"a",href:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[c.jsx(ve,{children:c.jsx(tl,{})}),"Docs"]})})}),uln=()=>{const e=st();return Kr({mutationFn:async({toolId:t,input:r,requestContext:n})=>{const s=new bp;Object.entries(n??{}).forEach(([a,i])=>{s.set(a,i)});try{return await e.getTool(t).execute({data:r,requestContext:s})}catch(a){throw Xe.error("Error executing dev tool"),console.error("Error executing dev tool:",a),a}}})},dln=({toolId:e})=>{const{canExecute:t}=Bm(),r=t("tools"),{data:n={}}=ah(),s=E.useMemo(()=>{for(const g of Object.values(n))if(g.tools){const b=Object.values(g.tools).find(v=>v.id===e);if(b)return b}return null},[n,e]),{data:a,isLoading:i,error:o}=gin(e,{enabled:!s}),l=s||a,{mutateAsync:u,isPending:d,data:p}=uln(),{requestContext:f}=Ss();E.useEffect(()=>{if(o){const g=o instanceof Error?o.message:"Failed to load tool";Xe.error(`Error loading tool: ${g}`)}},[o]);const h=async(g,b)=>{if(!l)return;const v={...f??{},...b??{}};return u({toolId:l.id,input:g,requestContext:v})},m=l?.inputSchema?vm(fm(Av(l?.inputSchema))):Fn({});return i?c.jsxs("div",{className:"p-6",children:[c.jsx(Nr,{className:"h-8 w-48 mb-4"}),c.jsx(Nr,{className:"h-32 w-full"})]}):o?null:l?r?c.jsx(cfe,{executionResult:p,isExecutingTool:d,zodInputSchema:m,handleExecuteTool:h,toolDescription:l.description,toolId:l.id,requestContextSchema:l.requestContextSchema}):c.jsx("div",{className:"py-12 text-center px-6",children:c.jsx(ze,{variant:"ui-sm",className:"text-neutral3",children:"You don't have permission to execute tools."})}):c.jsx("div",{className:"py-12 text-center px-6",children:c.jsx(ze,{variant:"header-md",className:"text-neutral3",children:"Tool not found"})})};function pln({value:e,onValueChange:t,placeholder:r="Select a tool...",searchPlaceholder:n="Search tools...",emptyText:s="No tools found.",className:a,disabled:i=!1,variant:o="default"}){const{data:l={},isLoading:u,isError:d,error:p}=t8(),{data:f={},isLoading:h,isError:m,error:g}=ah(),{navigate:b,paths:v}=Yt();E.useEffect(()=>{if(d){const _=p instanceof Error?p.message:"Failed to load tools";Xe.error(`Error loading tools: ${_}`)}},[d,p]),E.useEffect(()=>{if(m){const _=g instanceof Error?g.message:"Failed to load agents";Xe.error(`Error loading agents: ${_}`)}},[m,g]);const S=new Map;Object.values(f).forEach(_=>{_.tools&&Object.values(_.tools).forEach(C=>{S.has(C.id)||S.set(C.id,C)})}),Object.values(l).forEach(_=>{S.has(_.id)||S.set(_.id,_)});const w=Array.from(S.values()).map(_=>({label:_.id,value:_.id})),k=_=>{t?t(_):_&&_!==e&&b(v.toolLink(_))};return c.jsx(Cu,{options:w,value:e,onValueChange:k,placeholder:u||h?"Loading tools...":r,searchPlaceholder:n,emptyText:s,className:a,disabled:i||u||h||d||m,variant:o})}function fln({tagOptions:e,selectedTag:t,providerOptions:r,selectedProvider:n,onTagChange:s,onProviderChange:a,searchTerm:i,onSearchChange:o,onReset:l,className:u,isLoading:d}){return d?c.jsxs("div",{className:K("h-[6.5rem] flex items-center gap-8","[&>div]:bg-surface3 [&>div]:w-48 [&>div]:h-8 [&>div]:animate-pulse",u),children:[c.jsx("div",{})," ",c.jsx("div",{})," ",c.jsx("div",{})]}):c.jsxs("div",{className:K("flex flex-wrap mx-auto sticky top-0 gap-8 bg-surface2 py-8",u),children:[c.jsx(sN,{label:"Search templates",value:i,onChange:p=>o?.(p.target.value),placeholder:"Search Template"}),c.jsx(jc,{label:"Filter by tag",value:t,onValueChange:s,options:e}),c.jsx(jc,{label:"Filter by provider",value:n,onValueChange:a,options:r}),l&&c.jsxs(ye,{onClick:l,children:["Reset ",c.jsx(Os,{})]})]})}function hln(e){return e.replace(/\/$/,"").split("/").pop()}function n8({children:e,className:t}){return c.jsx("div",{className:K("border border-border1 rounded-lg mt-12 py-8 lg:min-h-[25rem] transition-height px-4 lg:px-12",t),children:e})}function mln({templates:e,linkComponent:t,className:r,isLoading:n}){const s=t||"a";return n?c.jsx("div",{className:K("grid gap-y-4",r),children:Array.from({length:5}).map((a,i)=>c.jsx("div",{className:"h-16 bg-surface3 animate-pulse rounded-lg"},i))}):c.jsx("div",{className:K("grid gap-y-4",r),children:e.map(a=>{const i=a?.agents||a?.tools||a?.networks||a?.workflows||a?.mcp;return c.jsxs("article",{className:K("border border-border1 rounded-lg overflow-hidden w-full grid grid-cols-[1fr_auto] bg-surface3 transition-colors hover:bg-surface4"),children:[c.jsxs(s,{to:`/templates/${a.slug}`,className:K("grid [&:hover_p]:text-neutral5",{"grid-cols-[8rem_1fr] lg:grid-cols-[12rem_1fr]":a.imageURL}),children:[a.imageURL&&c.jsx("div",{className:K("overflow-hidden"),children:c.jsx("div",{className:"w-full h-full bg-cover thumb transition-scale duration-150",style:{backgroundImage:`url(${a.imageURL})`}})}),c.jsxs("div",{className:K("grid py-3 px-6 w-full gap-0.5","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[c.jsx("h2",{className:"text-ui-lg text-neutral5",children:a.title}),c.jsx("p",{className:"text-ui-md text-neutral4 transition-colors duration-500",children:a.description}),c.jsxs("div",{className:"hidden 2xl:flex text-neutral3 text-ui-md flex-wrap items-center gap-4 mt-3",children:[i&&c.jsxs("ul",{className:K("flex gap-4 text-ui-md text-neutral3 m-0 p-0 list-none","[&>li]:flex [&>li]:items-center [&>li]:gap-0.5 text-neutral4"),children:[a?.agents&&a.agents.length>0&&c.jsxs("li",{children:[c.jsx(Mi,{})," ",a.agents.length]}),a?.tools&&a.tools.length>0&&c.jsxs("li",{children:[c.jsx(tl,{})," ",a.tools.length]}),a?.networks&&a.networks.length>0&&c.jsxs("li",{children:[c.jsx(ize,{})," ",a.networks.length]}),a?.workflows&&a.workflows.length>0&&c.jsxs("li",{children:[c.jsx(pze,{})," ",a.workflows.length]}),a?.mcp&&a.mcp.length>0&&c.jsxs("li",{children:[c.jsx(Gf,{})," ",a.mcp.length]})]}),i&&a.supportedProviders&&c.jsx("small",{children:"|"}),c.jsx("div",{className:"flex items-center text-neutral3 gap-4",children:a.supportedProviders.map(o=>c.jsx("span",{className:"",children:o},o))})]})]})]}),c.jsx("a",{href:a.githubUrl,className:K("group items-center gap-2 text-ui-md ml-auto pr-4 hidden","lg:flex"),target:"_blank",rel:"noopener noreferrer",children:c.jsxs("span",{className:"flex items-center gap-2 px-2 py-1 rounded bg-surface1 group-hover:bg-surface2 text-neutral3 transition-colors group-hover:text-neutral5",children:[c.jsx(Lpe,{})," ",hln(a.githubUrl)]})})]},a.slug)})})}function gln({title:e,description:t,imageURL:r,githubUrl:n,isLoading:s,infoData:a,templateSlug:i}){const o=i?`feat/install-template-${i}`:"feat/install-template-[slug]";return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:K("grid mt-8 items-center"),children:c.jsxs("div",{className:K("text-header-lg flex items-center gap-3","[&>svg]:w-[1.2em] [&>svg]:h-[1.2em] [&>svg]:opacity-50",{"[&>svg]:opacity-20":s}),children:[c.jsx(Kw,{}),c.jsx("h2",{className:K({"bg-surface4 flex rounded-lg min-w-[50%]":s}),children:s?c.jsx(c.Fragment,{children:" "}):e})]})}),c.jsxs("div",{className:"grid lg:grid-cols-[1fr_1fr] gap-x-24",children:[c.jsxs("div",{className:"grid",children:[c.jsx("p",{className:K("mb-4 text-ui-md text-neutral4 mt-2 leading-7",{"bg-surface4 rounded-lg ":s}),children:s?c.jsx(c.Fragment,{children:" "}):t}),!s&&i&&c.jsxs("div",{className:K("bg-surface2 border border-surface4 rounded-lg p-4 mb-4","flex items-start gap-3"),children:[c.jsx("div",{className:"flex-shrink-0 mt-0.5",children:c.jsx(Ac,{className:"w-[1.1em] h-[1.1em] text-blue-500"})}),c.jsxs("div",{className:"flex-1 space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(nze,{className:"w-[1em] h-[1em] text-neutral4"}),c.jsx("span",{className:"text-ui-md font-medium text-neutral5",children:"A new Git branch will be created"})]}),c.jsxs("div",{className:"text-ui-sm text-neutral4 space-y-1",children:[c.jsxs("div",{children:[c.jsx("span",{className:"font-medium",children:"Branch name:"})," ",c.jsx("code",{className:"bg-surface3 px-1.5 py-0.5 rounded text-ui-sm font-mono",children:o})]}),c.jsx("div",{children:"This ensures safe installation with easy rollback if needed. Your main branch remains unchanged."})]})]})]}),n&&c.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 mt-auto text-neutral3 text-ui-md hover:text-neutral5",children:[c.jsx(Lpe,{}),n?.split("/")?.pop()]})]}),a&&c.jsx(gS,{data:a,LinkComponent:aze,labelsAreHidden:!0,isLoading:s})]})]})}function yln({providerOptions:e,selectedProvider:t,onProviderChange:r,variables:n,errors:s,handleInstallTemplate:a,handleVariableChange:i,isLoadingEnvVars:o,isInstalling:l,defaultModelProvider:u,defaultModelId:d,onModelUpdate:p}){return c.jsx(n8,{children:c.jsxs("div",{className:"max-w-[40rem] my-4 p-4 lg:p-8 mx-auto gap-8 grid",children:[c.jsxs("h2",{className:K("text-neutral4 text-header-sm font-semibold flex items-center gap-2","[&>svg]:w-[1.2em] [&_svg]:h-[1.2em] [&_svg]:opacity-70"),children:["Install Template ",c.jsx(oze,{})]}),c.jsx(jc,{options:e,label:"Template AI Model Provider",onValueChange:r,value:t,placeholder:"Select"}),t&&Object.entries(n||{}).length>0&&c.jsxs(c.Fragment,{children:[c.jsx("h3",{className:"text-neutral3 text-ui-md",children:"Set required Environmental Variables"}),c.jsx("div",{className:"grid grid-cols-[1fr_1fr] gap-4 items-start",children:o?c.jsxs("div",{className:K("flex items-center justify-center col-span-2 text-neutral3 text-ui-sm gap-4","[&_svg]:opacity-50 [&_svg]:w-[1.1em] [&_svg]:h-[1.1em]","animate-in fade-in duration-300"),children:[c.jsx(Cn,{})," Loading variables..."]}):Object.entries(n).map(([f,h])=>c.jsxs(E.Fragment,{children:[c.jsx(ay,{name:`env-${f}`,labelIsHidden:!0,label:"Key",value:f,disabled:!0,className:"w-full"}),c.jsx(ay,{name:f,labelIsHidden:!0,label:"Value",value:h,onChange:i,errorMsg:s.includes(f)?"Value is required.":"",autoComplete:"off",className:"w-full"})]},f))}),c.jsxs("div",{className:"border-t border-border1 pt-12 mt-3.5 relative",children:[c.jsx("div",{className:"absolute w-8 h-8 rounded-full bg-surface2 top-0 left-1/2 -translate-x-1/2 -translate-y-4 text-ui-sm text-neutral3 flex items-center justify-center",children:"And"}),c.jsx("h3",{className:"text-neutral4 text-ui-lg",children:"Set AI Model for Template Installation"}),c.jsx("p",{className:"text-neutral3 text-ui-md mt-2 mb-8",children:"This model will be used by the workflow to process and install the template"}),c.jsx(zft,{defaultProvider:u||"",defaultModel:d||"",updateModel:p||(()=>Promise.resolve({message:"Updated"})),closeEditor:()=>{},autoSave:!0,selectProviderPlaceholder:"Provider"})]})]}),t&&!o&&c.jsx(ye,{className:K("flex items-center gap-2 mt-4 justify-center text-ui-md w-full bg-surface5 min-h-10 rounded-lg text-neutral5 hover:bg-surface6 transition-colors","[&>svg]:w-[1.1em] [&_svg]:h-[1.1em] [&_svg]:text-neutral5"),onClick:a,disabled:!t||!u||!d||s.length>0||l,children:l?c.jsxs(c.Fragment,{children:[c.jsx(Cn,{className:"w-4 h-4"})," Installing..."]}):c.jsxs(c.Fragment,{children:["Install ",c.jsx(Wh,{})]})})]})})}function bln(e){switch(e){case"running":return c.jsx(Cn,{});case"success":return c.jsx(ya,{});case"failed":return c.jsx(Os,{});default:return null}}function vln({stepId:e,step:t,isActive:r,position:n}){const s=a=>a.charAt(0).toUpperCase()+a.slice(1).replace(/-/g," ");return c.jsxs("div",{className:K("grid gap-6 grid-cols-[1fr_auto] py-3 px-4 rounded-lg",Wr.all,{"border border-dashed border-neutral2 bg-surface3":r}),children:[c.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-2",children:[c.jsxs("span",{className:K("text-ui-md min-w-6 flex justify-end",Wr.colors,{"text-neutral5":r||t.status==="success","text-neutral3":!r&&t.status!=="success"}),children:[n,"."]}),c.jsxs("div",{children:[c.jsx("h4",{className:K("text-ui-md",Wr.colors,{"text-neutral5":r||t.status==="success","text-neutral3":!r&&t.status!=="success"}),children:s(e)}),t.description&&c.jsx("p",{className:"text-ui-md text-neutral2 -mt-0.5",children:t.description})]})]}),c.jsx("div",{className:K("w-[1.75rem] h-[1.75rem] rounded-full flex items-center justify-center self-center",Wr.all,{"border border-neutral2 border-dashed":t.status==="pending","[&>svg]:text-white [&>svg]:w-[1rem] [&>svg]:h-[1rem]":t.status!=="running","w-[1.75rem] h-[1.75rem]":t.status==="running","bg-accent1Dark shadow-glow-accent1":t.status==="success","bg-accent2Dark shadow-glow-accent2":t.status==="failed","scale-110":t.status==="success"||t.status==="failed"}),children:bln(t.status)})]})}function xln({currentStep:e,steps:t=[],className:r}){return c.jsx("div",{className:K(r),children:t.map((n,s)=>c.jsx(vln,{stepId:n.id,step:n,isActive:e?.id===n.id,position:s+1},n.id))})}function Sln({steps:e}){const t=e.length,r=e.filter(n=>n.status==="success").length;return c.jsxs("div",{className:"flex justify-center flex-col gap-4 content-center w-full",children:[c.jsx("div",{className:"grid grid-cols-[0_repeat(9,1fr)] w-full",children:e.map((n,s)=>c.jsx("div",{className:K("flex justify-end items-center relative h-[2rem]",Wr.colors,{"bg-accent1Dark":n.status==="success"&&e?.[s-1]?.status==="success"}),children:c.jsx("div",{className:K("w-[2rem] h-[2rem] rounded-full flex items-center justify-center self-center absolute right-0 translate-x-[50%] bg-surface3 z-10 text-neutral3 font-bold text-ui-sm",Wr.all,{"border border-neutral2 border-dashed":n.status==="pending","[&>svg]:text-surface1 [&>svg]:w-[1.1rem] [&>svg]:h-[1.1rem]":n.status!=="running","bg-accent1Dark text-white shadow-glow-accent1 scale-110":n.status==="success","bg-accent2Dark text-white shadow-glow-accent2 scale-110":n.status==="failed"}),children:n.status==="running"?c.jsx(Cn,{}):s+1})},n.id))}),c.jsxs("div",{className:K("text-xs text-neutral3 text-center",Wr.colors),children:[r," of ",t," steps completed"]})]})}function wln({name:e,streamResult:t,runId:r,workflowInfo:n}){const s=t?.phase||"initializing",a=t?.payload?.workflowState,i=t?.payload?.currentStep,o=t?.error,l=a?.steps||{},u=Object.keys(l).length>0,d=g=>g==="input"||g.endsWith(".input")||g.startsWith("Mapping_")&&/[0-9a-f]{8}/.test(g)||/[0-9a-f]{8,}/.test(g)?!1:n?.allSteps?g in n.allSteps:!0,p=Object.entries(l).filter(([g,b])=>d(g)),f=p.length,h=()=>{switch(s){case"initializing":return"Preparing template installation...";case"processing":return`Installing ${e} template`;case"completed":return"Template installation completed!";case"error":return"Template installation failed";default:return"Installing template..."}},m=p.map(([g,b])=>({id:g,status:b?.status,description:b?.description,title:g.charAt(0).toUpperCase()+g.slice(1).replace(/-/g," "),isActive:i?.id===g}));return c.jsxs(n8,{className:"space-y-6 text-neutral3 mb-8 content-center",children:[c.jsxs("div",{className:"text-center",children:[c.jsx("h3",{className:"text-lg font-semibold text-neutral5",children:h()}),t?.runId&&c.jsxs("div",{className:"mt-2 text-ui-sm text-neutral3",children:["Run ID: ",t.runId]})]}),u&&f>0&&!["error"].includes(s)&&c.jsx("div",{className:"max-w-[30rem] w-full mx-auto px-6",children:c.jsx(Sln,{steps:m})}),o&&s==="error"&&c.jsxs("div",{className:K("rounded-lg text-neutral5 p-6 flex items-center gap-3 text-ui-md bg-red-500/10","[&>svg]:w-6 [&>svg]:h-6 [&>svg]:opacity-70 [&>svg]:text-red-500"),children:[c.jsx(sIt,{}),o||"Something went wrong"]}),u&&c.jsx(xln,{steps:m,currentStep:i,className:"pb-4"}),!u&&s==="initializing"&&c.jsxs("div",{className:"text-center text-sm text-neutral3 grid gap-4 justify-items-center",children:[c.jsx(Cn,{}),c.jsx("p",{children:"This may take some time..."})]})]})}function Eln({name:e,installedEntities:t,linkComponent:r}){const n=r||"a";return c.jsxs(n8,{className:K("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[c.jsx(oze,{}),c.jsx("h2",{className:"text-header-md",children:"Done!"}),c.jsxs("p",{className:"text-ui-md text-center text-neutral3 ",children:["The ",c.jsx("b",{className:"text-neutral4",children:e})," template has been successfully installed.",t&&t.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("br",{})," Installed entities are listed below."]})]}),t&&t.length>0&&c.jsx(gS,{data:t,LinkComponent:n})]})}function kln({errorMsg:e,validationErrors:t}){const r=e?.includes("Invalid schema for function"),n=e?.includes("validation issue")||t&&t.length>0,s=()=>n?"Template installation completed but some validation issues remain. The template may still be functional, but you should review and fix these issues.":r?"There was an issue with the AI model configuration. This may be related to the selected model or AI SDK version compatibility.":"An unexpected error occurred during template installation.",a=()=>n?{icon:c.jsx(Pc,{className:"text-yellow-500"}),title:"Template Installed with Warnings"}:{icon:c.jsx(vNt,{}),title:"Template Installation Failed"},{icon:i,title:o}=a();return c.jsxs(n8,{className:"space-y-4 text-neutral3 mb-8 content-center",children:[c.jsxs("div",{className:K("grid items-center justify-items-center gap-4 content-center","[&>svg]:w-8 [&>svg]:h-8"),children:[i,c.jsxs("div",{className:"text-center space-y-2",children:[c.jsx("p",{className:"text-ui-md font-medium text-neutral5",children:o}),c.jsx("p",{className:"text-ui-md text-neutral3",children:s()})]})]}),t&&t.length>0&&c.jsxs("details",{className:"text-xs",children:[c.jsxs("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:["Show Validation Issues (",t.length,")"]}),c.jsx("div",{className:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto max-h-60 text-left space-y-2",children:t.map((l,u)=>c.jsxs("div",{className:"border-l-2 border-red-400 pl-2",children:[c.jsx("div",{className:"font-medium text-red-600 dark:text-red-400",children:l.type==="typescript"?"🔴 TypeScript Error":"⚠️ Lint Error"}),c.jsx("div",{className:"text-xs font-mono text-gray-700 dark:text-gray-300 mt-1 whitespace-pre-wrap break-words",children:l.message})]},u))})]}),e&&!n&&c.jsxs("details",{className:"text-xs",children:[c.jsx("summary",{className:"cursor-pointer text-neutral3 hover:text-neutral4 select-none text-center",children:"Show Details"}),c.jsx("div",{className:"mt-4 p-3 bg-gray-100 dark:bg-gray-800 rounded text-xs font-mono overflow-auto max-h-60 text-left",children:c.jsx("div",{className:"whitespace-pre-wrap break-words",children:e})})]})]})}const Oln=e=>{if(!e||e.length===0)return[];const t=e.reduce((o,l)=>{const u=l?.endedAt?new Date(l.endedAt):void 0;return u&&(!o||u>o)?u:o},null),r=new Map,n=[];e.forEach(o=>{const l=new Date(o.startedAt),u=o.endedAt?new Date(o.endedAt):void 0,d={id:o.spanId,name:o.name,type:o.spanType,latency:u?u.getTime()-l.getTime():0,startTime:l.toISOString(),endTime:u?u.toISOString():void 0,spans:[],parentSpanId:o.parentSpanId};r.set(o.spanId,d)}),e.forEach(o=>{const l=r.get(o.spanId);if(o?.parentSpanId==null){if(t&&l.endTime&&t>new Date(l.endTime)){l.endTime=t.toISOString();const u=new Date(t).getTime(),d=new Date(l.startTime).getTime();l.latency=u-d}n.push(l)}else{const u=r.get(o.parentSpanId);u?u.spans.push(l):n.push(l)}});const s=o=>o.sort((l,u)=>new Date(l.startTime).getTime()-new Date(u.startTime).getTime()),a=s(n),i=o=>{o.forEach(l=>{l.spans&&l.spans.length>0&&(l.spans=s(l.spans),i(l.spans))})};return i(a),a},u$e=["agent","workflow","model","tool","other"];function fmt(e){const t=e?.toLowerCase().split("_")[0],r={agent:{icon:c.jsx(Mi,{}),color:"oklch(0.75 0.15 250)",label:"Agent",bgColor:"bg-oklch(0.75 0.15 250 / 0.1)",typePrefix:"agent"},workflow:{icon:c.jsx(Yl,{}),color:"oklch(0.75 0.15 200)",label:"Workflow",bgColor:"bg-oklch(0.75 0.15 200 / 0.1)",typePrefix:"workflow"},model:{icon:c.jsx(Rg,{}),color:"oklch(0.75 0.15 320)",label:"Model",bgColor:"bg-oklch(0.75 0.15 320 / 0.1)",typePrefix:"model"},tool:{icon:c.jsx(tl,{}),color:"oklch(0.75 0.15 100)",label:"Tool",bgColor:"bg-oklch(0.75 0.15 100 / 0.1)",typePrefix:"tool"}};return t in r?r[t]:{typePrefix:"other"}}function hmt(e){if(!e.spans||e.spans.length===0)return[];const t=[];return e.spans.forEach(r=>{t.push(r.id),t.push(...hmt(r))}),t}function _ln({isLastChild:e,hasChildren:t=!1,expanded:r=!1}){return c.jsx("div",{className:K("w-[3rem] h-[2.8rem] relative opacity-100",'after:content-[""] after:absolute after:left-[-1px] after:top-0 after:bottom-0 after:w-[0px] after:border-l-[1px] after:border-neutral3 after:border-dashed ','before:content-[""] before:absolute before:left-0 before:top-[50%] before:w-full before:h-[0px] before:border-b-[1px] before:border-neutral3 before:border-dashed',"[&_svg]:transition-all","[&:hover_svg]:text-yellow-500 [&:hover_svg]:scale-[1.3] [&:hover_svg]:opacity-100",{"after:bottom-[50%]":e}),children:t&&c.jsx("span",{className:K("flex absolute left-[50%] top-[50%] translate-y-[-50%] translate-x-[-50%] items-center justify-center bg-surface2 p-[0.25rem]","[&>svg]:shrink-0 [&>svg]:opacity-60 [&>svg]:w-[0.8rem] [&>svg]:h-[0.8rem]"),children:r?c.jsx(WBe,{}):c.jsx(ZBe,{})})})}function Cln({icon:e,color:t}){return c.jsx("span",{className:K("flex w-[1.1rem] h-[1.1rem] shrink-0 rounded-md items-center justify-center","[&>svg]:w-[.9rem] [&>svg]:h-[.9rem] [&>svg]:text-surface2"),style:{backgroundColor:t},children:e})}function Tln({span:e,spanUI:t,isFaded:r,depth:n=0,onSpanClick:s,selectedSpanId:a,isLastChild:i,hasChildren:o,isRootSpan:l,isExpanded:u,toggleChildren:d}){return c.jsxs("div",{"aria-label":`View details for span ${e.name}`,className:K("rounded-md transition-colors flex opacity-80 min-h-12 items-center rounded-l-lg","mt-4 xl:mt-0",{"opacity-30 [&:hover]:opacity-60":r,"bg-surface4":a===e.id}),style:{paddingLeft:`${n*1.5}rem`},children:[!l&&c.jsx("button",{onClick:()=>d?.(),disabled:!o,className:K({"cursor-default":!o,"cursor-pointer":o}),children:c.jsx(_ln,{isLastChild:i,hasChildren:!!o,expanded:u})}),c.jsxs("button",{onClick:()=>s?.(e.id),className:K("text-ui-md flex items-center text-left break-all gap-2 text-white w-full rounded-lg h-full px-3 py-2 transition-colors","[&>svg]:transition-all [&>svg]:shrink-0 [&>svg]:opacity-0 [&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:ml-auto","hover:bg-surface4 [&:hover>svg]:opacity-60"),children:[t?.icon&&c.jsx(Cln,{icon:t.icon,color:t.color?t.color:void 0}),c.jsx("span",{className:K("p-0 px-1 rounded-md"),children:e.name}),c.jsx(mL,{})]})]})}function Aln({isSelected:e,isFaded:t,isExpanded:r,toggleChildren:n,expandAllDescendants:s,totalDescendants:a=0,allDescendantsExpanded:i,numOfChildren:o}){return c.jsx("div",{className:K("flex items-center justify-end h-full px-3",{"opacity-30 [&:hover]:opacity-60":t,"bg-surface4":e}),children:o&&o>0?c.jsxs("div",{className:"flex gap-1",children:[c.jsxs(d$e,{onClick:()=>n?.(),children:[i?a:o," ",r?i?c.jsx(HBe,{}):c.jsx(D1,{}):c.jsx($a,{})]}),a>o&&!i&&c.jsxs(d$e,{onClick:()=>s?.(),children:[a," ",c.jsx(VBe,{})]})]}):null})}function d$e({onClick:e,children:t,className:r}){return c.jsx("button",{onClick:e,className:K("h-full",r),children:c.jsx("div",{className:K("flex items-center gap-[0.1rem] text-ui-sm text-neutral5 border border-border1 pl-2 pr-1 rounded-lg transition-all","hover:text-yellow-500","[&>svg]:shrink-0 [&>svg]:opacity-80 [&>svg]:w-[1rem] [&>svg]:h-[1rem] [&>svg]:transition-all"),children:t})})}function Dln({span:e,selectedSpanId:t,isFaded:r,overallLatency:n,overallStartTime:s,color:a}){const{Link:i}=Yt(),o=n?Math.ceil(e.latency/n*100):0,l=s?new Date(s):null,u=e.startTime?new Date(e.startTime):null,d=u&&l?u.getTime()-l.getTime():0,p=n&&Math.floor(d/n*100);return c.jsxs(Fct,{openDelay:250,children:[c.jsxs(Bct,{className:K("h-12 p-2 grid grid-cols-[1fr_auto] gap-4 items-center cursor-help pr-3 rounded-r-lg col-span-2 xl:col-span-1","[&:hover>div]:bg-surface5",{"opacity-30 [&:hover]:opacity-60":r,"bg-surface4":t===e.id}),children:[c.jsx("div",{className:K("w-full p-2.5 rounded-lg bg-surface4 transition-colors duration-1000"),children:c.jsx("div",{className:"relative w-full h-1.5 rounded-sm",children:c.jsx("div",{className:K("bg-neutral1 absolute rounded-sm h-1.5 top-0"),style:{width:o?`${o}%`:"2px",left:`${p||0}%`,backgroundColor:a}})})}),c.jsxs("div",{className:K("flex justify-end text-neutral3 text-ui-sm"),children:[(e.latency/1e3).toFixed(3)," s"]})]}),c.jsx(zct,{children:c.jsxs(Uct,{className:"z-50 w-auto max-w-[25rem] rounded-md bg-surface4 p-2 px-4 pr-6 text-ui-sm text-neutral5 text-center border border-border1",sideOffset:5,side:"top",children:[c.jsxs("div",{className:K("text-ui-md flex items-center gap-2 mb-4","[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:shrink-0 [&>svg]:opacity-50"),children:[c.jsx(b3,{})," Span Timing"]}),c.jsx(gS,{className:" [&>dd]:text-ui-md [&>dt]:text-ui-md [&>dt]:min-h-0 [&>dd]:min-h-0",data:[{key:"Latency",label:"Latency",value:`${e.latency} ms`,icon:c.jsx(nDt,{})},{key:"startTime",label:"Started at",value:e.startTime?vn(new Date(e.startTime),"hh:mm:ss:SSS a"):"-",icon:c.jsx(ZAt,{})},{key:"endTime",label:"Ended at",value:e.endTime?vn(new Date(e.endTime),"hh:mm:ss:SSS a"):"-",icon:c.jsx(XAt,{})},{key:"startShift",label:"Start Shift",value:`${d}ms`,icon:c.jsx(uie,{})}],LinkComponent:i}),c.jsx(Vct,{className:"fill-surface5"})]})})]})}function mmt({span:e,depth:t=0,onSpanClick:r,selectedSpanId:n,isLastChild:s,overallLatency:a,overallStartTime:i,overallEndTime:o,fadedTypes:l,searchPhrase:u,featuredSpanIds:d,expandedSpanIds:p,setExpandedSpanIds:f}){const h=e.spans&&e.spans.length>0,m=e.spans?e.spans.length:0,g=hmt(e),b=g.length,v=t===0,S=fmt(e?.type),w=p?p.includes(e.id):!1,k=d&&d.length>0?!d.includes(e.id):!1,C=(l&&l.length>0?l.includes(S?.typePrefix||""):!1)||k;E.useEffect(()=>{v&&f?.([e.id])},[v,e.id,f]),E.useEffect(()=>{if(!d||!e.spans||e.spans.length===0)return;const I=e.spans.some(R=>d.includes(R.id));!w&&I&&T()},[d,e.spans,e.id,w,f,p]);const T=()=>{if(!(!f||!p))if(w){const I=[e.id,...g];f(p.filter(R=>!I.includes(R)))}else f([...p,e.id])},A=()=>{!f||!p||f([...p,e.id,...g])},N=g.every(I=>p?.includes(I));return c.jsxs(c.Fragment,{children:[c.jsx(Tln,{span:e,spanUI:S,isFaded:C,depth:t,onSpanClick:r,selectedSpanId:n,isLastChild:s,hasChildren:h,isRootSpan:v,isExpanded:w,toggleChildren:T}),c.jsx(Aln,{isSelected:n===e.id,isFaded:C,isExpanded:w,toggleChildren:T,expandAllDescendants:A,expandedSpanIds:p,totalDescendants:b,allDescendantsExpanded:N,numOfChildren:m}),c.jsx(Dln,{span:e,selectedSpanId:n,isFaded:C,overallLatency:a,overallStartTime:i,overallEndTime:o,color:S?.color}),h&&w&&e.spans?.map((I,R,$)=>{const F=R===$.length-1;return c.jsx(mmt,{span:I,depth:t+1,onSpanClick:r,selectedSpanId:n,isLastChild:F,overallLatency:a,overallStartTime:i,fadedTypes:l,searchPhrase:u,expandedSpanIds:p,setExpandedSpanIds:f,featuredSpanIds:d},I.id)})]})}function Nln({hierarchicalSpans:e=[],onSpanClick:t,selectedSpanId:r,isLoading:n,fadedTypes:s,expandedSpanIds:a,setExpandedSpanIds:i,featuredSpanIds:o}){const l=e?.[0]?.latency||0,u=e?.[0]?.startTime||"",d=e?.[0]?.endTime||"";return c.jsx(c.Fragment,{children:n?c.jsxs("div",{className:K("flex items-center text-ui-md gap-4 bg-surface3/50 rounded-md p-6 justify-center text-neutral3","[&_svg]:w-[1.25em] [&_svg]:h-[1.25em] [&_svg]:opacity-50"),children:[c.jsx(Cn,{})," Loading Trace Timeline ..."]}):c.jsx("div",{className:K("grid items-start content-start gap-y-0.5 overflow-hidden grid-cols-[1fr_auto] xl:py-4",{"xl:grid-cols-[1fr_auto_auto]":!d,"xl:grid-cols-[2fr_auto_1fr]":d}),children:e?.map(p=>c.jsx(mmt,{span:p,onSpanClick:t,selectedSpanId:r,overallLatency:l,overallStartTime:u,overallEndTime:d,fadedTypes:s,featuredSpanIds:o,expandedSpanIds:a,setExpandedSpanIds:i},p.id))})})}const gmt=({className:e,children:t})=>c.jsx("div",{className:K("flex items-center text-ui-sm border border-border1 rounded-lg overflow-hidden","[&>button]:border-0 [&>button:not(:first-child)]:border-l [&>button:not(:first-child)]:border-border1","[&>button]:rounded-none [&>button:first-child]:rounded-l-lg [&>button:last-child]:rounded-r-lg",e),children:t});function Iln({spans:e=[],fadedTypes:t,onLegendClick:r,onLegendReset:n,onSearchPhraseChange:s,traceId:a}){const[i,o]=E.useState("");E.useEffect(()=>{o("")},[a]);const l=u$e.filter(f=>e.some(h=>h?.spanType?.startsWith(f)))||[],u=e.some(f=>!u$e.some(m=>f?.spanType?.startsWith(m))),d=f=>{r?.(f)};E.useEffect(()=>{p(i)},[i,s]);const p=Rtt(f=>{s?.(f)},1e3);return c.jsxs("div",{className:"flex gap-3 items-center justify-between",children:[c.jsx("div",{className:"flex",children:c.jsx(sN,{value:i,onChange:f=>{o(f.target.value)},label:"Find span by name",placeholder:"Look for span name",onReset:()=>o("")})}),c.jsxs(gmt,{children:[l.map((f,h)=>{const m=fmt(f),g=t?.includes(f);return c.jsx(E.Fragment,{children:c.jsxs(ye,{onClick:()=>d(f),className:g?"opacity-40":"",style:{color:g?void 0:m?.color,backgroundColor:m?.bgColor},children:[m?.icon&&c.jsx(ve,{children:m.icon}),m?.label]})},f)}),u&&c.jsxs(ye,{onClick:()=>d("other"),className:t?.includes("other")?"opacity-40":"",style:{color:(t?.includes("other"),void 0),backgroundColor:void 0},children:[c.jsx(ve,{children:c.jsx(fL,{})}),"Other"]}),c.jsx(ye,{onClick:n,disabled:t?.length===0,children:c.jsx(ve,{children:c.jsx(Os,{})})})]})]})}function v1({children:e,className:t}){return c.jsx("div",{className:K("grid gap-12",t),children:e})}function jln(e){const{paths:t}=Yt();if(!e)return[];const r=t.agentsLink(),n=t.workflowsLink(),s=e.entityId,a=e.entityType,i=e.entityName,o=a==="agent",l=a==="workflow_run",u=o&&s?t.agentLink(s):l&&s?t.workflowLink(s):void 0;return[{key:"entityId",label:"Entity Id",value:[{id:s??"unknown",name:i||s||"-",path:u}]},{key:"entityType",label:"Entity Type",value:[{id:a??"unknown",name:a??"-",path:o?r:l?n:void 0}]},{key:"status",label:"Status",value:e?.attributes?.status||"-"},{key:"startedAt",label:"Started at",value:e?.startedAt?vn(new Date(e?.startedAt),"MMM dd, h:mm:ss.SSS aaa"):"-"},{key:"endedAt",label:"Ended at",value:e?.endedAt?vn(new Date(e?.endedAt),"MMM dd, h:mm:ss.SSS aaa"):"-"}]}function Rln({span:e}){if(!e)return[];const t=[{key:"spanType",label:"Span Type",value:e?.spanType},{key:"startedAt",label:"Started At",value:e?.startedAt?vn(new Date(e.startedAt),"MMM dd, h:mm:ss.SSS aaa"):"-"},{key:"endedAt",label:"Ended At",value:e?.endedAt?vn(new Date(e.endedAt),"MMM dd, h:mm:ss.SSS aaa"):"-"}],r=e?.attributes?.finishReason;return r&&t.push({key:"finishReason",label:"Finish Reason",value:r}),t}function p$e(e){return typeof e=="object"&&e!==null}const Pln={text:"Text",cacheRead:"Cache Read",cacheWrite:"Cache Write",audio:"Audio",image:"Image",reasoning:"Reasoning"};function $ln({traceUsage:e,traceSpans:t=[],spanUsage:r,className:n}){if(!e&&!r)return console.warn("No usage data available"),null;if(e&&r)return console.warn("Only one of traceUsage or spanUsage should be provided"),null;const s=t.filter(g=>g.spanType==="model_generation"),a=s.some(g=>{const b=g.attributes?.usage;return b&&"inputTokens"in b}),i=s.reduce((g,b)=>{const v=b.attributes?.usage||{},S=b?.attributes?.model||"",w=b?.attributes?.provider||"",k=`${w}${w&&S?" / ":""}${S}`;if(g?.[k]||(a?g[k]={inputTokens:0,outputTokens:0,totalTokens:0,reasoningTokens:0,cachedInputTokens:0}:g[k]={promptTokens:0,completionTokens:0,totalTokens:0}),"inputTokens"in g[k]&&a){const _=v.inputTokens??0,C=v.outputTokens??0,T=v.reasoningTokens??0,A=v.cachedInputTokens??0,N=g[k];N.inputTokens+=_,N.outputTokens+=C,N.reasoningTokens=(N.reasoningTokens??0)+T,N.cachedInputTokens=(N.cachedInputTokens??0)+A,N.totalTokens+=v.totalTokens||_+C}else if("promptTokens"in g[k]&&!a){const _=v.promptTokens??0,C=v.completionTokens??0,T=g[k];T.promptTokens+=_,T.completionTokens+=C,T.totalTokens+=v.totalTokens||_+C}return g},{}),o=Object.keys(i).reduce((g,b)=>{const v=i[b];if(a){const S=v,w=g;w.inputTokens=(w.inputTokens||0)+S.inputTokens,w.outputTokens=(w.outputTokens||0)+S.outputTokens,w.reasoningTokens=(w.reasoningTokens||0)+(S?.reasoningTokens??0),w.cachedInputTokens=(w.cachedInputTokens||0)+(S?.cachedInputTokens??0),w.totalTokens=(w.totalTokens||0)+S.totalTokens}else{const S=v,w=g;w.promptTokens=(w.promptTokens||0)+S.promptTokens,w.completionTokens=(w.completionTokens||0)+S.completionTokens,w.totalTokens=(w.totalTokens||0)+S.totalTokens}return g},a?{inputTokens:0,outputTokens:0,totalTokens:0,reasoningTokens:0,cachedInputTokens:0}:{promptTokens:0,completionTokens:0,totalTokens:0}),l=JSON.stringify(e)===JSON.stringify(o),u={promptTokens:{label:"Prompt Tokens",icon:c.jsx(Wh,{})},completionTokens:{label:"Completion Tokens",icon:c.jsx(pw,{})}},d={inputTokens:{label:"Input Tokens",icon:c.jsx(Wh,{})},outputTokens:{label:"Output Tokens",icon:c.jsx(pw,{})},reasoningTokens:{label:"Reasoning Tokens",icon:c.jsx(pw,{})},cachedInputTokens:{label:"Cached Input Tokens",icon:c.jsx(pw,{})},inputDetails:{label:"Input Details",icon:c.jsx(Wh,{})},outputDetails:{label:"Output Details",icon:c.jsx(pw,{})}};let f={...{totalTokens:{label:"Total LLM Tokens",icon:c.jsx(jDt,{})}},...d,...u},h=[];a?h=["totalTokens","inputTokens","outputTokens","reasoningTokens","cachedInputTokens","inputDetails","outputDetails"]:h=["totalTokens","promptTokens","completionTokens"];const m=Object.entries(e||r||{}).filter(g=>{const b=g[1];return typeof b=="number"||p$e(b)}).map(([g,b])=>({key:g,value:b})).sort((g,b)=>h.indexOf(g.key)-h.indexOf(b.key));return c.jsx("div",{className:K("flex gap-6 flex-wrap",n),children:m.map(({key:g,value:b})=>{const v=p$e(b);return c.jsxs("div",{className:K("bg-white/5 p-3 px-4 rounded-lg text-ui-md flex-grow",{"min-h-[5.5rem]":e}),children:[c.jsxs("div",{className:K("grid grid-cols-[1.5rem_1fr_auto] gap-2 items-center","[&>svg]:w-[1.5em] [&>svg]:h-[1.5em] [&>svg]:opacity-70"),children:[f?.[g]?.icon,c.jsx("span",{className:"text-ui-md",children:f?.[g]?.label}),!v&&c.jsx("b",{className:"text-ui-lg",children:b})]}),v&&c.jsx("div",{className:"text-ui-md mt-2 pl-8",children:Object.entries(b).map(([S,w])=>typeof w!="number"?null:c.jsxs("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 justify-between text-neutral3",children:[c.jsx("dt",{children:Pln[S]||S}),c.jsx("dd",{children:w})]},S))}),!v&&l&&c.jsx("div",{className:"text-ui-md mt-2 pl-8",children:Object.entries(i).map(([S,w])=>{const k=w?.[g];return typeof k!="number"?null:c.jsxs("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 justify-between text-neutral3",children:[c.jsx("dt",{children:S}),c.jsx("dd",{children:k})]},S)})})]},g)})})}function Mln(e){return e?.attributes?.finishReason==="length"}function Lln(e){const t=e?.attributes?.usage;if(!t)return"The model stopped generating because it reached the maximum token limit. The response was truncated and may be incomplete.";const r=t.inputTokens??0,n=t.outputTokens??0,s=t.totalTokens??r+n;return r>0||n>0?`The model stopped generating because it reached the maximum token limit. The response was truncated and may be incomplete.
586
586
 
587
- Token usage: ${r} input + ${n} output = ${s} total`:`The model stopped generating because it reached the maximum token limit (${s} tokens). The response was truncated and may be incomplete.`}function Fln({span:e}){if(!e)return null;const t=Mln(e);return c.jsxs(c.Fragment,{children:[t&&c.jsx("div",{className:"bg-yellow-900/20 border border-yellow-200 rounded-md p-2 mb-4",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Pc,{className:"text-yellow-200 mt-0.5 flex-shrink-0",size:20}),c.jsxs("div",{className:"flex-1",children:[c.jsx("h4",{className:"font-semibold text-yellow-200 mb-1 text-sm",children:"Token Limit Exceeded"}),c.jsx("p",{className:"text-sm text-neutral3 whitespace-pre-line",children:Lln(e)})]})]})}),c.jsx(er.CodeSection,{title:"Input",icon:c.jsx(JN,{}),codeStr:JSON.stringify(e.input||null,null,2)}),c.jsx(er.CodeSection,{title:"Output",icon:c.jsx(dv,{}),codeStr:JSON.stringify(e.output||null,null,2)}),c.jsx(er.CodeSection,{title:"Metadata",icon:c.jsx(jp,{}),codeStr:JSON.stringify(e.metadata||null,null,2)}),c.jsx(er.CodeSection,{title:"Attributes",icon:c.jsx(jp,{}),codeStr:JSON.stringify(e.attributes||null,null,2)})]})}function ymt({trace:e,span:t,spanScoresData:r,onSpanScoresPageChange:n,isLoadingSpanScoresData:s,spanInfo:a=[],defaultActiveTab:i="details",initialScoreId:o,computeTraceLink:l,scorers:u,isLoadingScorers:d}){const{Link:p}=Yt();let f;return t?.attributes?.agentId||t?.entityType===gD.AGENT?f="Agent":(t?.attributes?.workflowId||t?.entityType===gD.WORKFLOW_RUN)&&(f="Workflow"),c.jsxs(TO,{defaultTab:i,children:[c.jsxs(AO,{children:[c.jsx(gl,{value:"details",children:"Details"}),c.jsxs(gl,{value:"scores",children:["Scoring ",r?.pagination&&`(${r.pagination.total||0})`]})]}),c.jsx(Tc,{value:"details",children:c.jsxs(v1,{children:[t?.attributes?.usage?c.jsx($ln,{spanUsage:t.attributes.usage}):null,c.jsx(gS,{data:a,LinkComponent:p}),c.jsx(Fln,{span:t})]})}),c.jsx(Tc,{value:"scores",children:c.jsxs(v1,{children:[c.jsxs(Uo,{children:[c.jsx(Uo.Header,{children:c.jsxs(Uo.Heading,{children:[c.jsx(DK,{})," Scoring"]})}),c.jsx(Zln,{traceId:e?.traceId,isTopLevelSpan:!t?.parentSpanId,spanId:t?.spanId,entityType:f,scorers:u,isLoadingScorers:d})]}),c.jsxs(Uo,{children:[c.jsx(Uo.Header,{children:c.jsxs(Uo.Heading,{children:[c.jsx(DK,{})," Scores"]})}),c.jsx(Qln,{scoresData:r,onPageChange:n,isLoadingScoresData:s,initialScoreId:o,traceId:e?.traceId,spanId:t?.spanId,computeTraceLink:l})]})]})})]})}function Bln({trace:e,span:t,spanScoresData:r,onSpanScoresPageChange:n,isLoadingSpanScoresData:s,isOpen:a,onClose:i,onNext:o,onPrevious:l,onViewToggle:u,spanInfo:d=[],defaultActiveTab:p="details",initialScoreId:f,computeTraceLink:h,scorers:m,isLoadingScorers:g}){return c.jsxs(er,{dialogTitle:"Observability Span",dialogDescription:"View and analyze span details",isOpen:a,onClose:i,level:2,children:[c.jsxs(er.Top,{children:[c.jsxs(xs,{children:[c.jsx(wp,{})," ",vd(t?.traceId)]}),"›",c.jsxs(xs,{children:[c.jsx(y3,{}),vd(t?.spanId)]}),"|",c.jsx(er.Nav,{onNext:o,onPrevious:l}),c.jsxs("button",{className:"ml-auto mr-8",onClick:u,children:[c.jsx(uIt,{}),c.jsx(Rp,{children:"Switch to dialog view"})]})]}),c.jsxs(er.Content,{children:[c.jsxs(er.Header,{children:[c.jsxs(er.Heading,{children:[c.jsx(y3,{})," ",t?.name]}),c.jsxs(xs,{children:[c.jsx(F0,{})," ",t?.spanId]})]}),c.jsx(ymt,{trace:e,span:t,spanScoresData:r,onSpanScoresPageChange:n,isLoadingSpanScoresData:s,spanInfo:d,defaultActiveTab:p,initialScoreId:f,computeTraceLink:h,scorers:m,isLoadingScorers:g})]})]})}function zln(e){if(e?.input==null)return"{}";const t=e.input,n=e.spanType==="agent_run"&&t&&typeof t=="object"&&!Array.isArray(t)&&"messages"in t?t.messages??e.input:e.input;return JSON.stringify(n,null,2)}function Uln({traceDetails:e,traceId:t,isOpen:r,onClose:n,level:s=2}){return c.jsx(Rft,{initialInput:zln(e),initialGroundTruth:e?.output!=null?JSON.stringify(e.output,null,2):"",breadcrumb:c.jsxs(xs,{children:[c.jsx(wp,{})," ",vd(t)]}),isOpen:r,onClose:n,level:s})}function Vln({traceId:e,traceSpans:t=[],traceDetails:r,isOpen:n,onClose:s,onNext:a,onPrevious:i,isLoadingSpans:o,computeTraceLink:l,initialSpanId:u,initialSpanTab:d,initialScoreId:p,scorers:f,isLoadingScorers:h}){const{Link:m,navigate:g}=Yt(),[b,v]=E.useState(!!u),[S,w]=E.useState(u),[k,_]=E.useState(!1),[C,T]=E.useState(d||"details"),A=t.find(ge=>ge.spanId===S),N=jln(r),[I,R]=E.useState(0),[$,F]=E.useState(""),[L,z]=E.useState([]),[q,H]=E.useState([]),[V,G]=E.useState([]),[M,X]=E.useState(!1);E.useEffect(()=>{if($.trim()===""){H([]);return}const ge=$.toLowerCase(),le=t.filter(xe=>xe.name.toLowerCase().includes(ge)).map(xe=>xe.spanId);H(le)},[$]),E.useEffect(()=>{u&&(w(u),v(!0))},[u]),E.useEffect(()=>{I>0&&R(0)},[S]);const U=E.useMemo(()=>Oln(t),[t]),j=E.useMemo(()=>(le=>{const xe=[],Ie=Ce=>{xe.push(Ce),Ce.spans&&Ce.spans.length>0&&Ce.spans.forEach(Ie)};return le.forEach(Ie),xe})(U),[U]),{data:Q,isLoading:Z}=Ssn({traceId:e,spanId:S||j?.[0]?.id,page:I}),J=ge=>{S===ge?w(void 0):(w(ge),T("details"),v(!0))},ee=()=>{w(U[0]?.id),T("scores"),e&&g(`${l(e,U?.[0]?.id)}&tab=scores`)},te=()=>{w(U[0]?.id),T("scores"),e&&g(`${l(e,U?.[0]?.id)}&tab=scores&scoreId=${Q?.scores?.[0]?.id}`)},se=ge=>{z(le=>le.includes(ge)?le.filter(xe=>xe!==ge):[...le,ge])},ce=()=>{z([])},Se=Rln({span:A}),W=()=>{const ge=[],le=(xe,Ie)=>{xe.forEach(Ce=>{(!Ie||Ie===null||V.includes(Ie))&&(ge.push(Ce),V.includes(Ce.id)&&Ce.spans&&le(Ce.spans,Ce.id))})};return le(U),ge},ne=()=>{if(!S)return;const ge=W(),le=ge.findIndex(xe=>xe.id===S);if(le>=0&&le<ge.length-1)return()=>w(ge[le+1].id)},ae=()=>{if(!S)return;const ge=W(),le=ge.findIndex(xe=>xe.id===S);if(le>0)return()=>w(ge[le-1].id)};return c.jsxs(c.Fragment,{children:[c.jsxs(er,{dialogTitle:"Observability Trace",dialogDescription:"View and analyze trace details",isOpen:n,onClose:s,level:1,children:[c.jsxs(er.Top,{children:[c.jsxs(xs,{children:[c.jsx(wp,{})," ",vd(e)]}),"|",c.jsx(er.Nav,{onNext:a,onPrevious:i}),c.jsxs(ye,{variant:"standard",size:"default",className:"ml-auto mr-8",onClick:()=>X(!0),children:[c.jsx(ve,{children:c.jsx(nI,{})}),"Save as Dataset Item"]})]}),c.jsxs("div",{className:K("overflow-y-auto",{"grid grid-rows-[2fr_3fr]":!!(A&&k)}),children:[c.jsxs(er.Content,{children:[c.jsxs(er.Header,{children:[c.jsxs(er.Heading,{children:[c.jsx(wp,{})," ",r?.name]}),c.jsxs(xs,{children:[c.jsx(F0,{})," ",e]})]}),r&&c.jsxs(v1,{children:[c.jsxs("div",{className:"grid xl:grid-cols-[3fr_2fr] gap-4 items-start",children:[c.jsx(gS,{data:N,LinkComponent:m}),c.jsxs("div",{className:"bg-surface3 p-6 rounded-lg grid gap-4",children:[c.jsx("h4",{className:"text-ui-lg",children:c.jsxs(xs,{children:[c.jsx(Zg,{})," Evaluate trace"]})}),c.jsxs(Xo,{className:"w-full",children:[c.jsxs(ye,{onClick:ee,children:[c.jsx(ve,{children:c.jsx(DK,{})}),"Scoring"]}),Q?.scores?.[0]&&c.jsxs(ye,{onClick:te,children:["Last score: ",c.jsx("b",{children:Q?.scores?.[0]?.score})]})]})]})]}),c.jsxs(Uo,{children:[c.jsx(Uo.Header,{children:c.jsxs(Uo.Heading,{children:[c.jsx(UNt,{})," Timeline"]})}),c.jsx(Iln,{spans:t,fadedTypes:L,onLegendClick:se,onLegendReset:ce,searchPhrase:$,onSearchPhraseChange:F,traceId:e}),c.jsx(Nln,{hierarchicalSpans:U,onSpanClick:J,selectedSpanId:S,isLoading:o,fadedTypes:L,expandedSpanIds:V,setExpandedSpanIds:G,featuredSpanIds:q})]})]})]}),A&&k&&c.jsxs("div",{className:"grid grid-rows-[auto_1fr] relative overflow-y-auto rounded-xl mx-8 mb-8 bg-surface4",children:[c.jsxs(er.Top,{children:[c.jsxs(xs,{children:[c.jsx(y3,{})," ",vd(S)]}),"|",c.jsx(er.Nav,{onNext:ne(),onPrevious:ae()}),c.jsxs("button",{className:"ml-auto mr-8",onClick:()=>_(!1),children:[c.jsx(lze,{})," ",c.jsx(Rp,{children:"Switch to dialog view"})]})]}),c.jsx("div",{className:K("h-full overflow-y-auto pb-8 pl-8"),children:c.jsxs("div",{className:"overflow-y-auto pr-8 pt-8 h-full",children:[c.jsxs(er.Header,{children:[c.jsxs(er.Heading,{children:[c.jsx(wp,{}),A?.name]}),c.jsxs(xs,{children:[c.jsx(F0,{})," ",S]})]}),c.jsx(ymt,{trace:r,span:A,spanScoresData:Q,onSpanScoresPageChange:R,isLoadingSpanScoresData:Z,spanInfo:Se,defaultActiveTab:C,initialScoreId:p,computeTraceLink:l})]})})]})]})]}),c.jsx(Uln,{traceDetails:r,traceId:e,isOpen:M&&n,onClose:()=>X(!1)}),r&&c.jsx(Bln,{trace:r,span:A,spanScoresData:Q,onSpanScoresPageChange:R,isLoadingSpanScoresData:Z,isOpen:!!(b&&S&&!k),onClose:()=>{g(l(e||"")),v(!1)},onNext:ne(),onPrevious:ae(),onViewToggle:()=>_(!k),spanInfo:Se,defaultActiveTab:C,initialScoreId:p,computeTraceLink:l,scorers:f,isLoadingScorers:h})]})}function qln({onEntityChange:e,onReset:t,selectedEntity:r,entityOptions:n,onDateChange:s,selectedDateFrom:a,selectedDateTo:i,isLoading:o}){return c.jsxs("div",{className:K("flex flex-wrap gap-x-8 gap-y-4"),children:[c.jsx(jc,{label:"Filter by Entity",name:"select-entity",placeholder:"Select...",options:n||[],onValueChange:l=>{const u=n?.find(d=>d.value===l);u&&e(u)},value:r?.value||"",className:"min-w-[20rem]",disabled:o}),c.jsxs("div",{className:K("flex gap-4 items-center flex-wrap"),children:[c.jsx("span",{className:K("shrink-0 text-ui-md text-neutral3"),children:"Filter by Date & time range"}),c.jsx(LPe,{placeholder:"From",value:a,maxValue:i,onValueChange:l=>s?.(l,"from"),className:"min-w-32",defaultTimeStrValue:"12:00 AM",disabled:o}),c.jsx(LPe,{placeholder:"To",value:i,minValue:a,onValueChange:l=>s?.(l,"to"),className:"min-w-32",defaultTimeStrValue:"11:59 PM",disabled:o}),c.jsxs(ye,{variant:"light",size:"lg",className:"min-w-32",onClick:t,disabled:o,children:[c.jsx(ve,{children:c.jsx(Os,{})}),"Reset"]})]})]})}const q$=[{name:"shortId",label:"ID",size:"6rem"},{name:"date",label:"Date",size:"4.5rem"},{name:"time",label:"Time",size:"6.5rem"},{name:"name",label:"Name",size:"1fr"},{name:"entityId",label:"Entity",size:"10rem"},{name:"status",label:"Status",size:"3rem"}];function Hln({traces:e,selectedTraceId:t,onTraceClick:r,errorMsg:n,setEndOfListElement:s,filtersApplied:a,isFetchingNextPage:i,hasNextPage:o}){return e?c.jsxs(Ln,{children:[c.jsxs(Ln.Trim,{children:[c.jsx(Ln.Header,{columns:q$}),n?c.jsx(Ln.Message,{message:n,type:"error"}):c.jsx(c.Fragment,{children:e.length>0?c.jsx(Ln.Entries,{children:e.map(l=>{const u=new Date(l.createdAt),d=UF(u),p={id:l.traceId,shortId:vd(l?.traceId)||"n/a",date:d?"Today":vn(u,"MMM dd"),time:vn(u,"h:mm:ss aaa"),name:l?.name,entityId:l?.entityName||l?.entityId||l?.attributes?.agentId||l?.attributes?.workflowId,status:l?.attributes?.status};return c.jsx(Ln.Entry,{entry:p,isSelected:t===l.traceId,columns:q$,onClick:r,children:q$.map((f,h)=>{const m=`${h}-${l.traceId}`;return f.name==="status"?c.jsx(Ln.EntryStatus,{status:p?.[f.name]},m):c.jsx(Ln.EntryText,{children:p?.[f.name]},m)})},p.id)})}):c.jsx(Ln.Message,{message:a?"No traces found for applied filters":"No traces found yet"})})]}),c.jsx(Ln.NextPageLoading,{setEndOfListElement:s,loadingText:"Loading more traces...",noMoreDataText:"All traces loaded",isLoading:i,hasMore:o})]}):null}const PP=[{name:"shortId",label:"ID",size:"1fr"},{name:"date",label:"Date",size:"1fr"},{name:"time",label:"Time",size:"1fr"},{name:"score",label:"Score",size:"1fr"},{name:"scorer",label:"Scorer",size:"1fr"}];function Qln({scoresData:e,isLoadingScoresData:t,traceId:r,spanId:n,initialScoreId:s,onPageChange:a,computeTraceLink:i}){const{navigate:o}=Yt(),[l,u]=E.useState(!1),[d,p]=E.useState();E.useEffect(()=>{s&&f(s)},[s]);const f=b=>{const v=e?.scores?.find(S=>S?.id===b);p(v),u(!0)};if(t)return c.jsx(Ift,{columns:PP});const h=b=>{const v=e?.scores?.find(S=>S?.id===b);p(v)},m=ife({entries:e?.scores||[],id:d?.id,update:h}),g=ofe({entries:e?.scores||[],id:d?.id,update:h});return c.jsxs(c.Fragment,{children:[c.jsxs(Ln,{children:[c.jsxs(Ln.Trim,{children:[c.jsx(Ln.Header,{columns:PP}),e?.scores&&e.scores.length>0?c.jsx(Ln.Entries,{children:e?.scores?.map(b=>{const v=new Date(b.createdAt),S=UF(v),w={id:b?.id,shortId:vd(b?.id)||"n/a",date:S?"Today":vn(v,"MMM dd"),time:vn(v,"h:mm:ss aaa"),score:b?.score,scorer:b?.scorer?.name||b?.scorer?.id};return c.jsx(Ln.Entry,{columns:PP,onClick:()=>f(b.id),entry:w,children:PP.map(k=>{const _=`col-${k.name}`;return c.jsx(Ln.EntryText,{children:String(w?.[k.name]??"")},_)})},b.id)})}):c.jsx(Ln.Message,{message:"No scores found",type:"info"})]}),c.jsx(Ln.Pagination,{currentPage:e?.pagination?.page||0,hasMore:e?.pagination?.hasMore,onNextPage:()=>a&&a((e?.pagination?.page||0)+1),onPrevPage:()=>a&&a((e?.pagination?.page||0)-1)})]}),c.jsx(Pft,{scorerName:d?.scorer?.name||d?.scorer?.id||"",score:d,isOpen:l,onClose:()=>{r&&o(`${i(r,n)}&tab=scores`),u(!1)},dialogLevel:3,onNext:m,onPrevious:g,computeTraceLink:(b,v)=>`/observability?traceId=${b}${v?`&spanId=${v}`:""}`,usageContext:"SpanDialog"})]})}const Gln=()=>{const e=st();return Kr({mutationFn:async({scorerName:t,traceId:r,spanId:n})=>await e.score({scorerName:t,targets:[{traceId:r,spanId:n}]})})};function MY({children:e,className:t,isVisible:r,autoDismiss:n=!0,dismissTime:s=5e3,dismissible:a=!0,type:i="info"}){const[o,l]=E.useState(r),[u,d]=E.useState(!1);E.useEffect(()=>{if(a&&n&&r){const m=setTimeout(()=>{p()},s);return()=>clearTimeout(m)}},[n,r,s,a]),E.useEffect(()=>{r&&(d(!1),l(!0))},[r]);const p=()=>{d(!0),setTimeout(()=>{l(!1),d(!1)},200)};if(!o)return null;const f={info:"bg-surface4 border-border1",error:"bg-accent2Darker border-accent2/30",success:"bg-accent1Darker border-accent1/30",warning:"bg-accent6Darker border-accent6/30"},h={info:"text-accent5",error:"text-accent2",success:"text-accent1",warning:"text-accent6"};return c.jsxs("div",{className:K("grid grid-cols-[auto_1fr_auto] gap-3 rounded-lg border p-4 text-ui-md text-neutral4 items-start","shadow-card",Wr.all,u?"animate-out fade-out-0 slide-out-to-right-2 duration-200":"animate-in fade-in-0 slide-in-from-right-2 duration-300",f[i],t),children:[c.jsx("div",{className:K("flex-shrink-0 mt-0.5",h[i]),children:i==="error"||i==="warning"?c.jsx(Pc,{className:"h-4 w-4"}):c.jsx(Ac,{className:"h-4 w-4"})}),c.jsx("div",{className:"flex gap-2 items-start min-w-0",children:e}),a&&c.jsxs(ye,{variant:"ghost",className:K("h-6 w-6 p-0 flex-shrink-0",Wr.colors,"hover:bg-surface5"),onClick:p,children:[c.jsx(Os,{className:"h-4 w-4"}),c.jsx(Rp,{children:"Dismiss"})]})]})}const Zln=({traceId:e,spanId:t,entityType:r,isTopLevelSpan:n,scorers:s,isLoadingScorers:a})=>{const[i,o]=E.useState(null),{mutate:l,isPending:u,isSuccess:d}=Gln(),[p,f]=E.useState(!1);E.useEffect(()=>{d&&f(!0)},[d]);let h=Object.entries(s||{}).map(([S,w])=>({id:S,name:w.scorer.config.name,description:w.scorer.config.description,isRegistered:w.isRegistered,type:w.scorer.config.type})).filter(S=>S.isRegistered);(r!=="Agent"||!n)&&(h=h.filter(S=>S.type!=="agent"));const m=u||a,g=()=>{i&&(f(!1),l({scorerName:i,traceId:e||"",spanId:t}))},b=S=>{o(S),f(!1)},v=h.find(S=>S.name===i)?.description||"";return s===void 0&&!a?c.jsxs(MY,{isVisible:!0,autoDismiss:!1,type:"error",children:[c.jsx(Ac,{})," Failed to load scorers."]}):h.length===0?c.jsxs(MY,{isVisible:!0,dismissible:!1,children:[c.jsx(Ac,{})," No eligible scorers have been defined to run."]}):c.jsxs("div",{children:[c.jsxs("div",{className:"grid grid-cols-[3fr_1fr] gap-4 items-start",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(jc,{name:"select-scorer",placeholder:"Select a scorer...",options:h.map(S=>({label:S.name||S.id,value:S.id||S.name||""})),onValueChange:b,value:i||"",className:"min-w-[20rem]",disabled:m}),v&&c.jsxs(xs,{className:"text-neutral3",children:[c.jsx(Ac,{})," ",v]})]}),c.jsx(ye,{disabled:!i||m,onClick:g,children:u?"Starting...":"Start Scoring"})]}),c.jsxs(MY,{isVisible:p,className:"mt-4",children:[c.jsx(Ac,{})," Scorer triggered! When finished successfully, it will appear in the list below. It could take a moment."]})]})},Qre=(e,t)=>{const r=st();return ur({queryKey:["dataset-item",e,t],queryFn:()=>r.getDatasetItem(e,t),enabled:!!e&&!!t,retry:!1})},f$e=10,$4=(e,t,r)=>{const n=st(),{inView:s,setRef:a}=H6(),i=CI({queryKey:["dataset-items",e,t,r],queryFn:async({pageParam:o})=>await n.listDatasetItems(e,{page:o,perPage:f$e,search:t||void 0,version:r||void 0}),initialPageParam:0,getNextPageParam:(o,l,u)=>{if(!o?.items?.length)return;const d=(u+1)*f$e,p=o?.pagination?.total??0;if(!(d>=p))return u+1},enabled:!!e,select:o=>o.pages.flatMap(l=>l?.items??[]),retry:!1});return E.useEffect(()=>{s&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[s,i.hasNextPage,i.isFetchingNextPage]),{...i,setEndOfListElement:a}},hfe=(e,t)=>{const r=st();return ur({queryKey:["dataset-item-versions",e,t],queryFn:async()=>((await r.getItemHistory(e,t))?.history??[]).map((s,a)=>({id:s.id,datasetId:s.datasetId,datasetVersion:s.datasetVersion,input:s.input,groundTruth:s.groundTruth,metadata:s.metadata,validTo:s.validTo,isDeleted:s.isDeleted,createdAt:s.createdAt,updatedAt:s.updatedAt,isLatest:a===0})),enabled:!!e&&!!t})},Gre=(e,t,r,n)=>{const s=st();return ur({queryKey:["dataset-item-version",e,t,r],queryFn:async()=>{const a=await s.getDatasetItemVersion(e,t,r);return{id:a.id,datasetId:a.datasetId,datasetVersion:a.datasetVersion,input:a.input,groundTruth:a.groundTruth,metadata:a.metadata,validTo:a.validTo??null,isDeleted:a.isDeleted??!1,createdAt:a.createdAt,updatedAt:a.updatedAt,isLatest:n!=null?r===n:!1}},enabled:!!e&&!!t&&r>0})},h$e=(e,t,r)=>{const n=st();return ur({queryKey:["dataset-experiments",e,t,r],queryFn:()=>n.listDatasetExperiments(e,t),enabled:!!e,select:s=>{if(!r)return s;const a=s.experiments.filter(i=>!(r.status&&i.status!==r.status||r.targetType&&i.targetType!==r.targetType||r.targetId&&i.targetId!==r.targetId));return{...s,experiments:a}}})},Zre=(e,t)=>{const r=st();return ur({queryKey:["dataset-experiment",e,t],queryFn:()=>r.getDatasetExperiment(e,t),enabled:!!e&&!!t,gcTime:0,staleTime:0,refetchInterval:n=>{const s=n.state.data?.status;return s==="running"||s==="pending"?2e3:!1}})},m$e=100,Wln=({datasetId:e,experimentId:t,experimentStatus:r})=>{const n=st(),{inView:s,setRef:a}=H6(),i=CI({queryKey:["dataset-experiment-results",e,t,r],queryFn:async({pageParam:o})=>n.listDatasetExperimentResults(e,t,{page:o,perPage:m$e}),initialPageParam:0,getNextPageParam:(o,l,u)=>{if(!o?.results?.length)return;const d=(u+1)*m$e,p=o?.pagination?.total??0;if(!(d>=p))return u+1},enabled:!!e&&!!t,refetchInterval:r==="running"||r==="pending"?2e3:!1,select:o=>o.pages.flatMap(l=>l?.results??[])});return E.useEffect(()=>{s&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[s,i.hasNextPage,i.isFetchingNextPage]),{...i,setEndOfListElement:a}},Xln=(e,t)=>{const r=st();return ur({queryKey:["dataset-experiment-scores",e,t],queryFn:async()=>{const n=[];let s=0;const a=100;for(;;){const o=await r.listScoresByRunId({runId:e,page:s,perPage:a});if(n.push(...o.scores),!o.pagination.hasMore)break;s++}const i={};for(const o of n)i[o.entityId]||(i[o.entityId]=[]),i[o.entityId].push(o);return i},enabled:!!e,refetchInterval:t==="running"||t==="pending"?2e3:!1})},Yln=(e,t,r,n)=>{const s=st();return ur({queryKey:["compare-experiments",e,t,r,n],queryFn:()=>s.compareExperiments({datasetId:e,experimentIdA:t,experimentIdB:r,...n}),enabled:!!e&&!!t&&!!r})},Kln=10,bmt=e=>{const t=st();return CI({queryKey:["dataset-versions",e],queryFn:async({pageParam:r})=>t.listDatasetVersions(e,{page:r,perPage:Kln}),initialPageParam:0,getNextPageParam:(r,n,s)=>{if(r?.pagination?.hasMore)return s+1},select:r=>r.pages.flatMap(n=>n?.versions??[]).map((n,s)=>({id:n.id,datasetId:n.datasetId,version:n.version,createdAt:n.createdAt,isCurrent:s===0})),enabled:!!e})};function Jln(e){if(e==null||e==="")return{parsed:null};const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{return{parsed:JSON.parse(t)}}catch{return{parsed:e,warning:"Could not parse as JSON, keeping as string"}}return{parsed:e}}function ecn(e){const t={},r=[];for(const[n,s]of Object.entries(e)){const a=s==null?null:s===""?"":String(s),i=Jln(a);t[n]=i.parsed,i.warning&&r.push(`${n}: ${i.warning}`)}return{data:t,warnings:r}}const tcn=1e6;function rcn(){const[e,t]=E.useState(!1),[r,n]=E.useState(null);return{parseFile:E.useCallback(async a=>{t(!0),n(null);try{const i=a.size>tcn;return await new Promise((o,l)=>{Cdt.parse(a,{header:!0,skipEmptyLines:"greedy",dynamicTyping:!1,worker:i,complete:u=>{const d=u.meta.fields??[],p=[],f=u.data.map((h,m)=>{const g=ecn(h);return g.warnings.forEach(b=>{p.push(`Row ${m+2}: ${b}`)}),g.data});o({headers:d,data:f,errors:u.errors,warnings:p})},error:u=>{l(new Error(u.message))}})})}catch(i){const o=i instanceof Error?i:new Error("Failed to parse CSV");throw n(o),o}finally{t(!1)}},[]),isParsing:e,error:r}}function g$e(e){const t=fm(e);return vm(t)}function y$e(e){return e.issues.slice(0,5).map(t=>({path:t.path.length>0?"/"+t.path.join("/"):"/",code:t.code,message:t.message}))}function ncn(e,t,r,n=10){if(!t&&!r)return{validCount:e.length,invalidCount:0,validRows:e.map((u,d)=>({rowNumber:d+2,...u})),invalidRows:[],totalRows:e.length};const s=t?g$e(t):null,a=r?g$e(r):null,i=[],o=[];let l=0;for(let u=0;u<e.length;u++){const d=e[u],p=u+2;let f=!0,h=null;if(s){const m=s.safeParse(d.input);m.success||(f=!1,o.length<n&&(h={rowNumber:p,field:"input",errors:y$e(m.error),data:d.input}))}if(f&&a&&d.groundTruth!==void 0){const m=a.safeParse(d.groundTruth);m.success||(f=!1,o.length<n&&(h={rowNumber:p,field:"groundTruth",errors:y$e(m.error),data:d.groundTruth}))}f?i.push({rowNumber:p,...d}):(l++,h&&o.push(h))}return{validCount:i.length,invalidCount:l,validRows:i,invalidRows:o,totalRows:e.length}}function scn(e){const t=[],r=[];if(!Array.isArray(e))return t.push({index:-1,message:"JSON must be an array of items"}),{valid:!1,errors:t,items:r};if(e.length===0)return t.push({index:-1,message:"JSON array must contain at least one item"}),{valid:!1,errors:t,items:r};for(let n=0;n<e.length;n++){const s=e[n],a=n+1;if(typeof s!="object"||s===null||Array.isArray(s)){t.push({index:a,message:`Item ${a} must be an object`});continue}if(!("input"in s)||s.input===void 0||s.input===null){t.push({index:a,message:`Item ${a} is missing required 'input' field`});continue}if(s.input===""){t.push({index:a,message:`Item ${a} has empty 'input' field`});continue}if("metadata"in s&&s.metadata!==void 0&&s.metadata!==null&&(typeof s.metadata!="object"||Array.isArray(s.metadata))){t.push({index:a,message:`Item ${a} has invalid 'metadata' field (must be an object)`});continue}r.push({input:s.input,groundTruth:"groundTruth"in s?s.groundTruth:void 0,metadata:"metadata"in s?s.metadata:void 0})}return{valid:t.length===0,errors:t,items:r}}function acn(){const[e,t]=E.useState(!1),[r,n]=E.useState(null);return{parseFile:E.useCallback(async a=>{t(!0),n(null);try{const i=await a.text();let o;try{o=JSON.parse(i)}catch{throw new Error("Invalid JSON format. Please check your file syntax.")}const l=scn(o);return l.valid?{items:l.items,errors:[],rawData:o}:{items:l.items,errors:l.errors,rawData:o}}catch(i){const o=i instanceof Error?i:new Error("Failed to parse JSON file");throw n(o),o}finally{t(!1)}},[]),isParsing:e,error:r}}function icn(){const[e,t]=E.useState(new Set),[r,n]=E.useState(null),s=E.useCallback((o,l,u)=>{t(d=>{const p=new Set(d);if(l&&r!==null){const f=u.indexOf(r),h=u.indexOf(o);if(f!==-1&&h!==-1){const m=Math.min(f,h),g=Math.max(f,h);for(let b=m;b<=g;b++)p.add(u[b])}}else p.has(o)?p.delete(o):p.add(o);return p}),n(o)},[r]),a=E.useCallback(o=>{t(new Set(o))},[]),i=E.useCallback(()=>{t(new Set),n(null)},[]);return{selectedIds:e,selectedCount:e.size,toggle:s,selectAll:a,clearSelection:i}}function ocn(e,t){const r=e.map(o=>({input:b$e(o.input),groundTruth:b$e(o.groundTruth),createdAt:o.createdAt instanceof Date?o.createdAt.toISOString():String(o.createdAt??"")})),n=Cdt.unparse(r,{quotes:!0,header:!0}),s=new Blob([n],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(s),i=document.createElement("a");i.href=a,i.download=t,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}function b$e(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e)}function lcn(e,t){const r=e.map(o=>({input:o.input,groundTruth:o.groundTruth,metadata:o.metadata,createdAt:o.createdAt instanceof Date?o.createdAt.toISOString():o.createdAt})),n=JSON.stringify(r,null,2),s=new Blob([n],{type:"application/json;charset=utf-8;"}),a=URL.createObjectURL(s),i=document.createElement("a");i.href=a,i.download=t,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}const ccn=({row:e})=>{const{Link:t,paths:r}=Yt();return c.jsx(ax,{name:c.jsx(t,{className:"w-full",href:r.datasetLink(e.original.id),children:e.original.name}),description:e.original.description||"No description"})},ucn=[{header:"Name",accessorKey:"name",cell:({row:e})=>c.jsx(ccn,{row:e})},{header:"Version",accessorKey:"version",cell:({row:e})=>c.jsxs(Hs,{children:["v",e.original.version]}),size:150},{header:"Created",accessorKey:"createdAt",cell:({row:e})=>c.jsx(Hs,{children:e.original.createdAt instanceof Date?e.original.createdAt.toLocaleDateString():new Date(e.original.createdAt).toLocaleDateString()}),size:150}];function dcn({onCreateClick:e}){return c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Bc,{iconSlot:c.jsx(BE,{className:"size-10 text-neutral3"}),titleSlot:"No Datasets Yet",descriptionSlot:"Create your first dataset to start evaluating your agents and workflows.",actionSlot:c.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e&&c.jsxs(ye,{size:"lg",variant:"light",onClick:e,children:[c.jsx(ve,{children:c.jsx(Qs,{})}),"Create Dataset"]}),c.jsxs(ye,{size:"lg",variant:"outline",as:"a",href:"https://mastra.ai/docs/evals",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(ve,{children:c.jsx(lie,{})}),"Documentation"]})]})})})}function pcn({datasets:e,isLoading:t,onCreateClick:r}){const[n,s]=E.useState(""),{navigate:a,paths:i}=Yt(),o=E.useMemo(()=>e,[e]),l=ex({data:o,columns:ucn,getCoreRowModel:Jv()}),u=l.getHeaderGroups()[0],d=l.getRowModel().rows.concat();if(d.length===0&&!t)return c.jsx(dcn,{onCreateClick:r});const p=d.filter(f=>f.original.name.toLowerCase().includes(n.toLowerCase()));return c.jsxs("div",{children:[c.jsx(Sy,{children:c.jsx(ju,{onSearch:s,label:"Search datasets",placeholder:"Search datasets"})}),t?c.jsx(fcn,{}):c.jsx(ix,{children:c.jsxs(Tl,{children:[c.jsx(Al,{className:"sticky top-0",children:u.headers.map(f=>c.jsx(Aa,{style:{width:f.column.getSize()??"auto"},children:Xl(f.column.columnDef.header,f.getContext())},f.id))}),c.jsx(Dl,{children:p.map(f=>c.jsx(Nl,{onClick:()=>a(i.datasetLink(f.original.id)),children:f.getVisibleCells().map(h=>c.jsx(Ee.Fragment,{children:Xl(h.column.columnDef.cell,h.getContext())},h.id))},f.id))})]})})]})}const fcn=()=>c.jsxs(Tl,{children:[c.jsxs(Al,{children:[c.jsx(Aa,{children:"Name"}),c.jsx(Aa,{children:"Version"}),c.jsx(Aa,{children:"Created"})]}),c.jsx(Dl,{children:Array.from({length:3}).map((e,t)=>c.jsxs(Nl,{children:[c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-1/2"})}),c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-20"})}),c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-20"})})]},t))})]});function v$e({label:e,schemaType:t,value:r,onChange:n,error:s,sourceSchema:a,autoPopulate:i=!1}){const o=r!=null,[l,u]=E.useState(()=>r?JSON.stringify(r,null,2):""),[d,p]=E.useState(null),f=E.useRef(!1),h=E.useRef(!1);E.useEffect(()=>{if(h.current){h.current=!1;return}r&&(u(JSON.stringify(r,null,2)),p(null))},[r]),E.useEffect(()=>{f.current=!1},[a]);const m=b=>{b?i&&a&&!f.current?(f.current=!0,n(a)):n({type:"object",properties:{}}):n(null)},g=b=>{u(b);try{const v=JSON.parse(b);typeof v=="object"&&v!==null?(p(null),h.current=!0,n(v)):p("Schema must be a JSON object")}catch{p("Invalid JSON")}};return c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Jl,{checked:o,onCheckedChange:m,id:`${t}-schema-toggle`}),c.jsx("label",{htmlFor:`${t}-schema-toggle`,className:"text-sm font-medium",children:e})]}),o&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(Wa,{value:l,onChange:g,showCopyButton:!1,className:K("h-48 border rounded-md",(d||s)&&"border-destructive")}),d&&c.jsx("p",{className:"text-xs text-destructive",children:d}),s&&!d&&c.jsx("p",{className:"text-xs text-destructive",children:s})]})]})}function hcn(e){const t=st();return ur({queryKey:["workflow-schema",e],queryFn:async()=>{if(!e)throw new Error("No workflow selected");return t.getWorkflow(e).getSchema()},enabled:!!e,staleTime:300*1e3})}const mcn={anyOf:[{type:"string"},{type:"array",items:{type:"object",additionalProperties:!0}}]},x$e={type:"object",properties:{role:{type:"string",enum:["user","assistant","system","tool"]},content:mcn},required:["role","content"]},gcn={$schema:"http://json-schema.org/draft-07/schema#",description:"Agent message input (MessageListInput)",anyOf:[{type:"string",description:"Simple text message"},{type:"array",items:{type:"string"},description:"Array of text messages"},{...x$e,description:"Single message object"},{type:"array",description:"Array of message objects",items:x$e}]},ycn={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:"Agent generate() output",properties:{text:{type:"string",description:"Text response"},object:{description:"Structured output (if any)"},toolCalls:{type:"array",description:"Tool calls made by the agent",items:{type:"object",additionalProperties:!0}},toolResults:{type:"array",description:"Tool execution results",items:{type:"object",additionalProperties:!0}},sources:{type:"array",description:"Sources referenced",items:{type:"object",additionalProperties:!0}},files:{type:"array",description:"Files generated",items:{type:"object",additionalProperties:!0}},usage:{type:"object",description:"Token usage",properties:{promptTokens:{type:"number"},completionTokens:{type:"number"},totalTokens:{type:"number"}}},reasoningText:{type:"string",description:"Reasoning text (if any)"}}};function bcn(){return{inputSchema:gcn,outputSchema:ycn,isLoading:!1,error:null}}const Wre={anyOf:[{type:"string"},{type:"object",description:"Structured content (format 2 with parts)"},{type:"array",description:"Content parts array",items:{type:"object"}}]},Xre={type:"object",properties:{role:{type:"string",enum:["user","assistant","system","tool"]},content:Wre},required:["role","content"]},vcn={type:"object",description:"ScorerRunInputForAgent",properties:{inputMessages:{type:"array",description:"User input messages (MastraDBMessage[])",items:Xre},rememberedMessages:{type:"array",description:"Messages from memory (MastraDBMessage[])",items:Xre},systemMessages:{type:"array",description:"System messages (CoreMessage[])",items:{type:"object",properties:{role:{type:"string",enum:["system"]},content:Wre},required:["role","content"]}},taggedSystemMessages:{type:"object",description:"Tagged system messages (Record<string, CoreSystemMessage[]>)",additionalProperties:{type:"array",items:{type:"object",properties:{role:{type:"string",enum:["system"]},content:Wre},required:["role","content"]}}}},required:["inputMessages","rememberedMessages","systemMessages","taggedSystemMessages"]},xcn={type:"array",description:"ScorerRunOutputForAgent (MastraDBMessage[])",items:Xre},Scn={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:"Scorer input for agent-type scorers (scoringInputSchema)",properties:{runId:{type:"string",description:"Run ID (optional)"},input:vcn,output:xcn,additionalContext:{type:"object",description:"Additional context (optional)",additionalProperties:!0},requestContext:{type:"object",description:"Request context (optional)",additionalProperties:!0}},required:[]},wcn={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:"Scorer input for custom scorers (scoringInputSchema)",properties:{runId:{type:"string",description:"Run ID (optional)"},input:{description:"Input to the entity being scored (any)"},output:{description:"Output from the entity being scored (any)"},additionalContext:{type:"object",description:"Additional context (optional)",additionalProperties:!0},requestContext:{type:"object",description:"Request context (optional)",additionalProperties:!0}},required:[]},Ecn={$schema:"http://json-schema.org/draft-07/schema#",description:"Scorer ground truth (any shape)"};function kcn(){return{agentInputSchema:Scn,customInputSchema:wcn,outputSchema:Ecn,isLoading:!1,error:null}}function vmt({inputSchema:e,outputSchema:t,onChange:r,disabled:n=!1,defaultOpen:s=!1}){const[a,i]=E.useState(s),[o,l]=E.useState("custom"),[u,d]=E.useState(null),[p,f]=E.useState("agent"),{data:h,isLoading:m}=wy(),g=h?Object.entries(h):[],{data:b,isLoading:v}=hcn(o==="workflow"?u:null),S=bcn(),w=kcn(),_=(()=>{switch(o){case"agent":return{inputSchema:S.inputSchema,outputSchema:S.outputSchema};case"workflow":return b?{inputSchema:b.inputSchema??null,outputSchema:b.outputSchema??null}:{inputSchema:null,outputSchema:null};case"scorer":return{inputSchema:p==="agent"?w.agentInputSchema:w.customInputSchema,outputSchema:w.outputSchema};default:return{inputSchema:null,outputSchema:null}}})(),C=o!=="custom",T=E.useRef(null);E.useEffect(()=>{if(o==="custom"||!_.inputSchema&&!_.outputSchema)return;const R=o==="workflow"?`workflow:${u}`:o==="scorer"?`scorer:${p}`:o,$=T.current!==null&&T.current!==R;if(T.current=R,o==="workflow"&&!b)return;const F=e!=null,L=t!=null,z=e&&e.type==="object"&&Object.keys(e.properties||{}).length===0,q=t&&t.type==="object"&&Object.keys(t.properties||{}).length===0,H=_.inputSchema&&F&&($||z),V=_.outputSchema&&L&&($||q);(H||V)&&r({inputSchema:H?_.inputSchema:e??null,outputSchema:V?_.outputSchema:t??null})},[o,u,b,p]);const A=R=>{r({inputSchema:R,outputSchema:t??null})},N=R=>{r({inputSchema:e??null,outputSchema:R})},I=R=>{l(R),R!=="workflow"&&d(null)};return c.jsxs(CO,{open:a,onOpenChange:i,children:[c.jsxs(oS,{className:"flex items-center gap-2 text-sm font-medium text-neutral4 hover:text-neutral5 w-full py-2",children:[c.jsx(Hi,{className:"w-4 h-4"}),"Schema Configuration (Optional)"]}),c.jsxs(lS,{className:"pt-4 space-y-4",children:[c.jsxs(Cp,{variant:"info",children:[c.jsx(Tp,{children:"JSON Schema Format"}),c.jsxs(sy,{as:"p",children:["Schemas use"," ",c.jsx("a",{href:"https://json-schema.org/",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-accent5Lighter",children:"JSON Schema"})," ","for validation and type checking."]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium text-neutral4",children:"Import From"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(Ro,{value:o,onValueChange:R=>I(R),disabled:n,children:[c.jsx(go,{size:"sm",className:"w-40",children:c.jsx(Po,{})}),c.jsxs(yo,{children:[c.jsx(Ms,{value:"custom",children:"Custom"}),c.jsx(Ms,{value:"agent",children:"Agent"}),c.jsx(Ms,{value:"workflow",children:"Workflow"}),c.jsx(Ms,{value:"scorer",children:"Scorer"})]})]}),o==="workflow"&&c.jsxs(Ro,{value:u??"",onValueChange:d,disabled:n,children:[c.jsx(go,{size:"sm",className:"w-48",children:c.jsx(Po,{placeholder:"Select workflow..."})}),c.jsx(yo,{children:m?c.jsx(Ms,{value:"__loading__",disabled:!0,children:"Loading..."}):g.length===0?c.jsx(Ms,{value:"__empty__",disabled:!0,children:"No workflows"}):g.map(([R,$])=>c.jsx(Ms,{value:R,children:$.name||R},R))})]}),o==="workflow"&&u&&v&&c.jsx("span",{className:"text-xs text-neutral3",children:"Loading schema..."}),o==="scorer"&&c.jsxs(Ro,{value:p,onValueChange:R=>f(R),disabled:n,children:[c.jsx(go,{size:"sm",className:"w-32",children:c.jsx(Po,{})}),c.jsxs(yo,{children:[c.jsx(Ms,{value:"agent",children:"Agent"}),c.jsx(Ms,{value:"custom",children:"Custom"})]})]})]}),o==="scorer"&&c.jsx("p",{className:"text-xs text-neutral3",children:p==="agent"?"For calibrating agent-type scorers":"For calibrating custom scorers (input/output as any)"})]}),c.jsx(v$e,{label:"Input Schema",schemaType:"input",value:e,onChange:A,sourceSchema:C?_.inputSchema:void 0,autoPopulate:C}),c.jsx(v$e,{label:"Ground Truth Schema",schemaType:"output",value:t,onChange:N,sourceSchema:C?_.outputSchema:void 0,autoPopulate:C})]})]})}function Ocn({open:e,onOpenChange:t,onSuccess:r}){const[n,s]=E.useState(""),[a,i]=E.useState(""),[o,l]=E.useState(null),[u,d]=E.useState(null),{createDataset:p}=Ru(),f=g=>{l(g.inputSchema),d(g.outputSchema)},h=async g=>{if(g.preventDefault(),!n.trim()){Xe.error("Dataset name is required");return}try{const b=await p.mutateAsync({name:n.trim(),description:a.trim()||void 0,inputSchema:o,groundTruthSchema:u});Xe.success("Dataset created successfully"),s(""),i(""),l(null),d(null),t(!1),r?.(b.id)}catch(b){Xe.error(`Failed to create dataset: ${b instanceof Error?b.message:"Unknown error"}`)}},m=()=>{s(""),i(""),l(null),d(null),t(!1)};return c.jsx(ea,{open:e,onOpenChange:t,children:c.jsxs(Ls,{className:"max-w-2xl",children:[c.jsx(ta,{children:c.jsx(Fs,{children:"Create Dataset"})}),c.jsx(ra,{className:"max-h-[70vh] overflow-y-auto",children:c.jsxs("form",{onSubmit:h,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-name",children:"Name *"}),c.jsx(qr,{id:"dataset-name",value:n,onChange:g=>s(g.target.value),placeholder:"Enter dataset name",autoFocus:!0})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-description",children:"Description"}),c.jsx(qr,{id:"dataset-description",value:a,onChange:g=>i(g.target.value),placeholder:"Enter dataset description (optional)"})]}),c.jsx(vmt,{inputSchema:o,outputSchema:u,onChange:f,disabled:p.isPending}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[c.jsx(ye,{type:"button",variant:"standard",size:"default",onClick:m,children:"Cancel"}),c.jsx(ye,{type:"submit",variant:"cta",size:"default",disabled:p.isPending||!n.trim(),children:p.isPending?"Creating...":"Create Dataset"})]})]})})]})})}function _cn({open:e,onOpenChange:t,items:r,onSuccess:n}){const[s,a]=E.useState(""),[i,o]=E.useState(""),[l,u]=E.useState(!1),[d,p]=E.useState(0),{createDataset:f,addItem:h}=Ru(),m=async v=>{if(v.preventDefault(),!s.trim()){Xe.error("Dataset name is required");return}u(!0),p(0);try{const S=await f.mutateAsync({name:s.trim(),description:i.trim()||void 0});for(let w=0;w<r.length;w++){const k=r[w];await h.mutateAsync({datasetId:S.id,input:k.input,groundTruth:k.groundTruth,metadata:k.metadata}),p(w+1)}Xe.success(`Dataset created with ${r.length} items`),a(""),o(""),u(!1),p(0),t(!1),n?.(S.id)}catch(S){Xe.error(`Failed to create dataset: ${S instanceof Error?S.message:"Unknown error"}`),u(!1),p(0)}},g=()=>{l||(a(""),o(""),t(!1))},b=r.length>0?d/r.length*100:0;return c.jsx(ea,{open:e,onOpenChange:l?void 0:t,children:c.jsxs(Ls,{className:"max-w-md",children:[c.jsx(ta,{children:c.jsx(Fs,{children:"Create Dataset from Items"})}),c.jsx(ra,{children:c.jsxs("form",{onSubmit:m,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-name",children:"Name *"}),c.jsx(qr,{id:"dataset-name",value:s,onChange:v=>a(v.target.value),placeholder:"Enter dataset name",autoFocus:!0,disabled:l})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-description",children:"Description"}),c.jsx(qr,{id:"dataset-description",value:i,onChange:v=>o(v.target.value),placeholder:"Enter dataset description (optional)",disabled:l})]}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.length," item",r.length!==1?"s":""," will be copied to the new dataset"]}),l&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:c.jsx("div",{className:"h-full bg-primary transition-all duration-200",style:{width:`${b}%`}})}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Copying items: ",d," / ",r.length]})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[c.jsx(ye,{type:"button",variant:"standard",size:"default",onClick:g,disabled:l,children:"Cancel"}),c.jsx(ye,{type:"submit",variant:"cta",size:"default",disabled:l||!s.trim(),children:l?`Creating... (${d}/${r.length})`:"Create Dataset"})]})]})})]})})}function Ccn({open:e,onOpenChange:t,items:r,currentDatasetId:n,onSuccess:s}){const[a,i]=E.useState(""),[o,l]=E.useState(!1),[u,d]=E.useState(0),{data:p,isLoading:f}=Y6(),{addItem:h}=Ru(),m=p?.datasets??[],g=m.filter(w=>w.id!==n),b=async w=>{if(w.preventDefault(),!a){Xe.error("Please select a dataset");return}l(!0),d(0);try{for(let _=0;_<r.length;_++){const C=r[_];await h.mutateAsync({datasetId:a,input:C.input,groundTruth:C.groundTruth,metadata:C.metadata}),d(_+1)}const k=m.find(_=>_.id===a);Xe.success(`Added ${r.length} item${r.length!==1?"s":""} to "${k?.name}"`),i(""),l(!1),d(0),t(!1),s?.(a)}catch(k){Xe.error(`Failed to add items: ${k instanceof Error?k.message:"Unknown error"}`),l(!1),d(0)}},v=()=>{o||(i(""),t(!1))},S=r.length>0?u/r.length*100:0;return c.jsx(ea,{open:e,onOpenChange:o?void 0:t,children:c.jsxs(Ls,{className:"max-w-md",children:[c.jsx(ta,{children:c.jsx(Fs,{children:"Add Items to Dataset"})}),c.jsx(ra,{children:c.jsxs("form",{onSubmit:b,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"target-dataset",children:"Target Dataset *"}),c.jsxs(Ro,{value:a,onValueChange:i,disabled:o||f,children:[c.jsx(go,{id:"target-dataset",children:c.jsx(Po,{placeholder:f?"Loading datasets...":"Select a dataset"})}),c.jsx(yo,{children:g.length===0?c.jsx("div",{className:"px-2 py-4 text-sm text-neutral4 text-center",children:"No other datasets available"}):g.map(w=>c.jsx(Ms,{value:w.id,children:w.name},w.id))})]})]}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.length," item",r.length!==1?"s":""," will be copied to the selected dataset"]}),o&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:c.jsx("div",{className:"h-full bg-primary transition-all duration-200",style:{width:`${S}%`}})}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Adding items: ",u," / ",r.length]})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[c.jsx(ye,{type:"button",variant:"standard",size:"default",onClick:v,disabled:o,children:"Cancel"}),c.jsx(ye,{type:"submit",variant:"cta",size:"default",disabled:o||!a||g.length===0,children:o?`Adding... (${u}/${r.length})`:"Add Items"})]})]})})]})})}function Tcn({open:e,onOpenChange:t,sourceDatasetId:r,sourceDatasetName:n,sourceDatasetDescription:s,onSuccess:a}){const[i,o]=E.useState(""),[l,u]=E.useState(""),[d,p]=E.useState(!1),[f,h]=E.useState({phase:"idle",current:0,total:0}),m=st(),{createDataset:g,addItem:b}=Ru();E.useEffect(()=>{e&&(o(`${n} (Copy)`),u(s||""))},[e,n,s]);const v=async _=>{if(_.preventDefault(),!i.trim()){Xe.error("Dataset name is required");return}p(!0),h({phase:"fetching",current:0,total:0});try{const C=[];let T=0;const A=100;let N=!0;for(;N;){const R=await m.listDatasetItems(r,{page:T,perPage:A}),$=R.items||[];C.push(...$.map(L=>({input:L.input,groundTruth:L.groundTruth,metadata:L.metadata}))),h({phase:"fetching",current:C.length,total:R.pagination?.total||C.length});const F=(T+1)*A;N=$.length>0&&F<(R.pagination?.total||0),T++}h({phase:"creating",current:0,total:C.length});const I=await g.mutateAsync({name:i.trim(),description:l.trim()||void 0});h({phase:"copying",current:0,total:C.length});for(let R=0;R<C.length;R++){const $=C[R];await b.mutateAsync({datasetId:I.id,input:$.input,groundTruth:$.groundTruth,metadata:$.metadata}),h({phase:"copying",current:R+1,total:C.length})}Xe.success(`Dataset duplicated with ${C.length} items`),o(""),u(""),p(!1),h({phase:"idle",current:0,total:0}),t(!1),a?.(I.id)}catch(C){Xe.error(`Failed to duplicate dataset: ${C instanceof Error?C.message:"Unknown error"}`),p(!1),h({phase:"idle",current:0,total:0})}},S=()=>{d||(o(""),u(""),t(!1))},w=()=>{switch(f.phase){case"fetching":return`Fetching items: ${f.current}${f.total>0?` / ${f.total}`:""}`;case"creating":return"Creating dataset...";case"copying":return`Copying items: ${f.current} / ${f.total}`;default:return""}},k=f.total>0?f.current/f.total*100:0;return c.jsx(ea,{open:e,onOpenChange:d?void 0:t,children:c.jsxs(Ls,{className:"max-w-md",children:[c.jsx(ta,{children:c.jsx(Fs,{children:"Duplicate Dataset"})}),c.jsx(ra,{children:c.jsxs("form",{onSubmit:v,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-name",children:"Name *"}),c.jsx(qr,{id:"dataset-name",value:i,onChange:_=>o(_.target.value),placeholder:"Enter dataset name",autoFocus:!0,disabled:d})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-description",children:"Description"}),c.jsx(qr,{id:"dataset-description",value:l,onChange:_=>u(_.target.value),placeholder:"Enter dataset description (optional)",disabled:d})]}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:['All items from "',n,'" will be copied to the new dataset']}),d&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:c.jsx("div",{className:"h-full bg-primary transition-all duration-200",style:{width:`${k}%`}})}),c.jsx("p",{className:"text-sm text-muted-foreground",children:w()})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[c.jsx(ye,{type:"button",variant:"standard",size:"default",onClick:S,disabled:d,children:"Cancel"}),c.jsx(ye,{type:"submit",variant:"cta",size:"default",disabled:d||!i.trim(),children:d?"Duplicating...":"Duplicate Dataset"})]})]})})]})})}function Acn({open:e,onOpenChange:t,dataset:r,onSuccess:n}){const[s,a]=E.useState(r.name),[i,o]=E.useState(r.description??""),[l,u]=E.useState(r.inputSchema??null),[d,p]=E.useState(r.groundTruthSchema??null),[f,h]=E.useState(null),{updateDataset:m}=Ru();E.useEffect(()=>{e&&(a(r.name),o(r.description??""),u(r.inputSchema??null),p(r.groundTruthSchema??null),h(null))},[e]);const g=S=>{u(S.inputSchema),p(S.outputSchema),h(null)},b=async S=>{if(S.preventDefault(),h(null),!s.trim()){Xe.error("Dataset name is required");return}try{await m.mutateAsync({datasetId:r.id,name:s.trim(),description:i.trim()||void 0,inputSchema:l,groundTruthSchema:d}),Xe.success("Dataset updated successfully"),t(!1),n?.()}catch(w){const k=w?.body;if(Array.isArray(k?.cause?.failingItems)&&k.cause.failingItems.length>0){const _=k.cause.failingItems.length;h(`${_} existing item(s) fail validation. Fix items or adjust schema.`)}else{const _=w;Xe.error(`Failed to update dataset: ${_?.message||"Unknown error"}`)}}},v=()=>{a(r.name),o(r.description??""),u(r.inputSchema??null),p(r.groundTruthSchema??null),h(null),t(!1)};return c.jsx(ea,{open:e,onOpenChange:t,children:c.jsxs(Ls,{className:"max-w-2xl",children:[c.jsx(ta,{children:c.jsx(Fs,{children:"Edit Dataset"})}),c.jsx(ra,{className:"max-h-[70vh] overflow-y-auto",children:c.jsxs("form",{onSubmit:b,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"edit-dataset-name",children:"Name *"}),c.jsx(qr,{id:"edit-dataset-name",value:s,onChange:S=>a(S.target.value),placeholder:"Enter dataset name",autoFocus:!0})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"edit-dataset-description",children:"Description"}),c.jsx(qr,{id:"edit-dataset-description",value:i,onChange:S=>o(S.target.value),placeholder:"Enter dataset description (optional)"})]}),c.jsx(vmt,{inputSchema:l,outputSchema:d,onChange:g,disabled:m.isPending,defaultOpen:!!(r.inputSchema||r.groundTruthSchema)}),f&&c.jsx("div",{className:"p-3 bg-red-950/20 border border-red-900/50 rounded-md",children:c.jsx("p",{className:"text-sm text-red-200",children:f})}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[c.jsx(ye,{type:"button",variant:"standard",size:"default",onClick:v,children:"Cancel"}),c.jsx(ye,{type:"submit",variant:"cta",size:"default",disabled:m.isPending||!s.trim(),children:m.isPending?"Saving...":"Save Changes"})]})]})})]})})}function Dcn({open:e,onOpenChange:t,datasetId:r,datasetName:n,onSuccess:s}){const{deleteDataset:a}=Ru(),i=async()=>{try{await a.mutateAsync(r),Xe.success("Dataset deleted successfully"),t(!1),s?.()}catch(o){Xe.error(`Failed to delete dataset: ${o instanceof Error?o.message:"Unknown error"}`)}};return c.jsx(qt,{open:e,onOpenChange:t,children:c.jsxs(qt.Content,{children:[c.jsxs(qt.Header,{children:[c.jsx(qt.Title,{children:"Delete Dataset"}),c.jsxs(qt.Description,{children:['Are you sure you want to delete "',n,'"? This will permanently delete the dataset, all its items, and run history. This action cannot be undone.']})]}),c.jsxs(qt.Footer,{children:[c.jsx(qt.Action,{onClick:i,disabled:a.isPending,children:a.isPending?"Deleting...":"Delete"}),c.jsx(qt.Cancel,{children:"Cancel"})]})]})})}function Ncn({value:e,onValueChange:t,placeholder:r="Select a dataset...",searchPlaceholder:n="Search datasets...",emptyText:s="No datasets found.",className:a,disabled:i=!1,variant:o="default"}){const{data:l,isLoading:u,isError:d,error:p}=Y6(),{navigate:f,paths:h}=Yt();E.useEffect(()=>{if(d){const v=p instanceof Error?p.message:"Failed to load datasets";Xe.error(`Error loading datasets: ${v}`)}},[d,p]);const g=(l?.datasets??[]).map(v=>({label:v.name,value:v.id})),b=v=>{t?t(v):v&&v!==e&&f(h.datasetLink(v))};return c.jsx(Cu,{options:g,value:e,onValueChange:b,placeholder:u?"Loading datasets...":r,searchPlaceholder:n,emptyText:s,className:a,disabled:i||u||d,variant:o})}function Icn({children:e,className:t}){return c.jsx("div",{className:K("grid grid-rows-[auto_1fr] overflow-y-auto",t),children:e})}function mfe(e){return!e||e.length===0?"":e?.map(t=>t.size).join(" ")}function jcn({columns:e,isSelectionActive:t,children:r}){return c.jsx("div",{className:K("sticky top-0 bg-surface3 z-10 rounded-lg px-4 mb-4"),children:c.jsx("div",{className:K("grid gap-4 text-left items-center uppercase text-neutral3 tracking-widest text-ui-xs",{"pl-12 [&>label]:absolute [&>label]:left-0":t}),style:{gridTemplateColumns:mfe(e)},children:r})})}function Rcn({children:e,className:t}){return c.jsx("span",{className:K("py-3",t),children:e})}function Pcn({children:e}){return c.jsx("ul",{className:"grid content-start",children:e})}function $cn({isSelected:e,children:t,columns:r}){return c.jsx("li",{className:K("flex border border-transparent py-[3px] pb-[2px] text-neutral5 border-t-border1 rounded-lg first:border-t-transparent text-ui-md overflow-hidden","[&:last-child>button]:rounded-b-lg","[&.selected-row]:border-white/50 [&.selected-row]:pr-[3px] [&.selected-row]:border-dashed [&.selected-row]:border [&.selected-row]:first:border-t","[&:has(+.selected-row)]:rounded-b-none [&:has(+.selected-row)]:border-b-transparent","[.selected-row+&]:rounded-t-none",Wr.colors,{"selected-row":e,"grid px-4 gap-4 ":r}),style:{gridTemplateColumns:mfe(r)},children:t})}function Mcn({item:e,isFeatured:t,onClick:r,children:n,columns:s,className:a,disabled:i}){const o=()=>{r?.(e?.id)};return c.jsx("button",{onClick:o,className:K("grid w-full px-4 gap-4 text-left items-center rounded-lg",Wr.colors,nx.visible,{"bg-surface4":t,"hover:bg-surface4":e&&!t&&!i},a),style:{gridTemplateColumns:mfe(s)},disabled:i,children:n})}function Lcn({children:e,message:t,className:r,type:n}){return!e&&!t?null:c.jsx("div",{className:K("grid border-t border-border1",r),children:t?c.jsxs("p",{className:K("text-neutral3 text-ui-md text-center grid p-8 justify-center justify-items-center gap-2","[&>svg]:w-[1.5em] [&>svg]:h-[1.5em] [&>svg]:opacity-75",{"[&>svg]:text-red-500":n==="error"}),children:[n==="error"?c.jsx(Pc,{}):c.jsx(Ac,{})," ",t]}):e})}function Fcn({isLoading:e,hasMore:t,setEndOfListElement:r,loadingText:n="Loading more data...",noMoreDataText:s="No more data to load"}){return r?c.jsxs("div",{ref:r,className:"text-ui-md text-neutral3 opacity-50 flex mt-8 justify-center",children:[e&&n,!t&&!e&&s]}):null}function Bcn({currentPage:e,hasMore:t,onNextPage:r,onPrevPage:n}){const s=typeof e=="number"&&e>0||t;return c.jsxs("div",{className:K("flex pt-6 items-center justify-center text-neutral3 text-ui-md gap-8"),children:[c.jsxs("span",{children:["Page ",c.jsx("b",{children:e?e+1:"1"})]}),s&&c.jsxs("div",{className:K("flex gap-4","[&>button]:flex [&>button]:items-center [&>button]:gap-2 [&>button]:text-neutral4 [&>button:hover]:text-neutral5 [&>button]:transition-colors [&>button]:border [&>button]:border-border1 [&>button]:p-1 [&>button]:px-2 [&>button]:rounded-md","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[typeof e=="number"&&e>0&&c.jsxs("button",{onClick:n,children:[c.jsx(KN,{}),"Previous"]}),t&&c.jsxs("button",{onClick:r,children:["Next",c.jsx(Wh,{})]})]})]})}function zcn({children:e}){const t=E.useRef(null);return c.jsx("div",{ref:t,className:K("overflow-y-auto"),children:e})}function xmt({children:e,className:t}){return c.jsx("div",{className:K("",t),children:e})}function Ucn({children:e,isLoading:t,className:r}){return c.jsx("div",{className:K("text-neutral4 py-[0.6rem] text-ui-md truncate",r),children:t?c.jsx("div",{className:"bg-surface4 rounded-md animate-pulse text-transparent h-[1rem] select-none"}):e})}function Vcn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qcn({status:e}){return e?c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx("div",{className:K("flex items-center justify-center w-10 relative bg-transparent h-full"),children:c.jsx("div",{className:K("w-[0.5rem] h-[0.5rem] rounded-full",{"bg-green-600":["success","completed"].includes(e),"bg-red-700":["error","failed"].includes(e),"bg-yellow-500":["pending","running"].includes(e)})})})}),c.jsx(sn,{children:Vcn(e)})]}):null}const Hcn={small:"text-[11px] pt-[5px] pb-[4px]",default:"text-[12px] pt-[5px] pb-[4px] ",large:"text-[13px] pt-[5px] pb-[4px] "},Qcn={gray:{bright:"bg-neutral-700",muted:"bg-neutral-700/80"},red:{bright:"bg-red-900",muted:"bg-red-900/80"},orange:{bright:"bg-yellow-900",muted:"bg-yellow-900/80"},blue:{bright:"bg-blue-800",muted:"bg-blue-800/80"},green:{bright:"bg-green-900",muted:"bg-green-900/80"},purple:{bright:"bg-purple-900",muted:"bg-purple-900/80"},yellow:{bright:"bg-yellow-700",muted:"bg-yellow-700/80"},cyan:{bright:"bg-cyan-900",muted:"bg-cyan-900/80"},pink:{bright:"bg-pink-900",muted:"bg-pink-900/80"}},Gcn={bright:"text-neutral4",muted:"text-neutral3"},fo=({color:e="gray",size:t="default",intensity:r="bright",className:n,children:s,...a})=>c.jsx("span",{className:K("inline-flex items-center rounded-md uppercase px-[0.5em] gap-[0.4em] tracking-wide font-normal","[&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:translate-y-[-0.02em] [&>svg]:mx-[-0.2em]","[&>svg]:opacity-50 [&>svg:first-child:last-child]:opacity-100",Hcn[t],Qcn[e][r],Gcn[r],n),style:{lineHeight:1},...a,children:s});function S$e({children:e,className:t}){return c.jsx("div",{className:K("flex gap-[1px] items-center [&>*:not(:last-child)]:rounded-r-none [&>*:not(:first-child)]:rounded-l-none",t),children:e})}function Zcn({version:e,date:t,isLatest:r,isDeleted:n}){return c.jsxs(xmt,{className:K("grid grid-cols-[1fr_auto] pl-1"),children:[c.jsxs("div",{className:K("grid text-neutral3 gap-1 leading-none",{"text-neutral4":r}),children:[c.jsxs("strong",{className:"font-normal",children:["v. ",e]}),c.jsx("em",{className:"text-neutral2 text-ui-sm font-normal",children:t?vn(new Date(t),"MMM d, yyyy HH:mm"):null})]}),(r||n)&&c.jsxs("div",{className:"flex gap-1 items-center",children:[r&&c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx(fo,{color:"blue",children:c.jsx(hL,{})})}),c.jsx(sn,{children:"Latest version"})]}),n&&c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx(fo,{color:"red",children:c.jsx(oie,{})})}),c.jsx(sn,{children:"Deleted in this version"})]})]})]})}function Wcn({id:e,className:t,isShortened:r=!0}){const n=r?e.slice(0,8):e;return c.jsx("div",{className:K("text-neutral2 py-[0.6rem] text-ui-md truncate",t),children:n})}function Xcn({date:e,className:t,withTime:r=!1}){const n=e?fAr(new Date(e)):!1,s=e?UF(new Date(e))?"Today":vn(new Date(e),"MMM dd"):"",a=e&&!n?vn(new Date(e),"yyyy"):"",i=e&&r?`${vn(new Date(e),"'at' h:mm aaa")}`:"";return c.jsxs("div",{className:K("text-neutral2 text-ui-md truncate",t),children:[s," ",a," ",i]})}function Ycn({children:e,href:t,className:r}){const{Link:n}=Yt();return c.jsx(n,{href:t,className:K("w-full px-3 py-[0.6rem] gap-6 text-left items-center rounded-lg flex justify-center","hover:bg-surface4",Wr.colors,nx.visible,r),children:e})}function Kcn({children:e,className:t}){return c.jsx("label",{className:K("flex w-14 h-full justify-center items-center hover:bg-surface5 rounded-lg",t),children:e})}const We=Object.assign(Icn,{Header:jcn,HeaderCol:Rcn,Items:Pcn,Scroller:zcn,Row:$cn,RowButton:Mcn,Message:Lcn,NextPageLoading:Fcn,Pagination:Bcn,Cell:xmt,TextCell:Ucn,StatusCell:qcn,VersionCell:Zcn,IdCell:Wcn,DateCell:Xcn,LinkCell:Ycn,LabelCell:Kcn});function w$e(e,t=100){if(e==null)return"-";const r=typeof e=="string"?e:JSON.stringify(e);return!r||r.length<=t?r||"-":r.slice(0,t)+"..."}function Jcn({items:e,isLoading:t,onItemClick:r,featuredItemId:n,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i,columns:o=[],searchQuery:l,isSelectionActive:u,selectedIds:d,onToggleSelection:p,onSelectAll:f,onClearSelection:h,maxSelection:m,onAddClick:g,onImportClick:b,onImportJsonClick:v}){if(e.length===0&&!l&&!t)return c.jsx(eun,{onAddClick:g,onImportClick:b,onImportJsonClick:v});const S=e.map(N=>N.id),w=d.size,k=e.length>0&&w===e.length,_=w>0&&w<e.length,C=()=>{k?h():f(S)},T=(N,I,R)=>{if(m&&!d.has(N)&&d.size>=m){const[$]=Array.from(d);f([$,N]);return}p(N,I,R)},A=N=>{r?.(N)};return c.jsx(We,{children:c.jsxs(We.Scroller,{children:[c.jsxs(We.Header,{columns:o,isSelectionActive:u,children:[u&&!m&&c.jsx(We.LabelCell,{children:c.jsx(Fp,{checked:_?"indeterminate":k,onCheckedChange:C,"aria-label":"Select all items"})}),o?.map(N=>c.jsx(We.HeaderCol,{children:N.label||N.name},N.name))]}),c.jsx(We.Items,{children:e.length===0&&l?c.jsx("div",{className:"flex items-center justify-center py-12 text-neutral4",children:"No items match your search"}):e.map(N=>{const I=new Date(N.createdAt),R={id:N.id,input:w$e(N.input,60),groundTruth:N.groundTruth?w$e(N.groundTruth,40):"-",metadata:N.metadata?Object.keys(N.metadata).length+" keys":"-",date:I};return c.jsxs(We.Row,{isSelected:d.has(N.id),children:[u&&c.jsx(We.LabelCell,{children:c.jsx(Fp,{checked:d.has(N.id),onCheckedChange:()=>{},onClick:$=>{$.stopPropagation(),T(N.id,$.shiftKey,S)},"aria-label":`Select item ${N.id}`})}),c.jsxs(We.RowButton,{item:R,isFeatured:n===N.id,columns:o,onClick:A,children:[c.jsx(We.IdCell,{id:R.id}),c.jsx(We.TextCell,{className:"font-mono",children:R.input}),o.some($=>$.name==="groundTruth")&&c.jsx(We.TextCell,{className:"font-mono",children:R.groundTruth}),c.jsx(We.DateCell,{date:R.date,withTime:!0})]})]},N.id)})}),c.jsx(We.NextPageLoading,{setEndOfListElement:s,loadingText:"Loading more items...",noMoreDataText:"All items loaded",isLoading:a,hasMore:i})]})})}function eun({onAddClick:e,onImportClick:t,onImportJsonClick:r}){return c.jsx("div",{className:"flex h-full items-center justify-center py-12",children:c.jsx(Bc,{iconSlot:c.jsx(Qs,{className:"w-8 h-8 text-neutral3"}),titleSlot:"No items yet",descriptionSlot:"Add items to this dataset to use them in experiment runs.",actionSlot:c.jsx("div",{className:"flex flex-col gap-2",children:c.jsxs(Xo,{spacing:"close",children:[c.jsxs(ye,{size:"default",variant:"standard",onClick:e,children:[c.jsx(Qs,{}),"Add Single Item"]}),t&&c.jsxs(ye,{size:"default",variant:"standard",onClick:t,children:[c.jsx(xL,{}),"Import CSV"]}),r&&c.jsxs(ye,{size:"default",variant:"standard",onClick:r,children:[c.jsx(eI,{}),"Import JSON"]})]})})})})}function tun({children:e,className:t,withLeftSeparator:r,withRightSeparator:n}){return c.jsxs("div",{className:"flex overflow-y-auto w-full",children:[r&&c.jsx(E$e,{}),c.jsx("div",{className:K("grid gap-8 content-start w-full overflow-y-auto",t),children:e}),n&&c.jsx(E$e,{})]})}function E$e(){return c.jsx("div",{className:K("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})}function run({children:e,className:t}){return c.jsx("div",{className:K("grid overflow-y-auto gap-8 content-start",t),children:e})}function nun({children:e,className:t}){return c.jsx("div",{className:K("flex items-center justify-between w-full flex-wrap gap-4 gap-x-6",t),children:e})}const Un=Object.assign(tun,{Content:run,Toolbar:nun});function sun({onExportClick:e,onExportJsonClick:t,onCreateDatasetClick:r,onAddToDatasetClick:n,onDeleteClick:s,onCompareClick:a}){return c.jsxs(cn,{children:[c.jsx(cn.Trigger,{asChild:!0,children:c.jsxs(ye,{variant:"standard",size:"default","aria-label":"Actions menu",children:["Select ",c.jsx(_At,{})]})}),c.jsxs(cn.Content,{align:"end",className:"w-72",children:[c.jsxs(cn.Item,{onSelect:a,children:[c.jsx(pA,{}),c.jsx("span",{children:"Compare Items"})]}),c.jsx(cn.Separator,{}),c.jsxs(cn.Item,{onSelect:e,children:[c.jsx(Yw,{}),c.jsx("span",{children:"Export Items as CSV"})]}),c.jsxs(cn.Item,{onSelect:t,children:[c.jsx(Yw,{}),c.jsx("span",{children:"Export Items as JSON"})]}),c.jsx(cn.Separator,{}),c.jsxs(cn.Item,{onSelect:r,children:[c.jsx(gL,{}),c.jsx("span",{children:"Create Dataset from Items"})]}),c.jsxs(cn.Item,{onSelect:n,children:[c.jsx(pNt,{}),c.jsx("span",{children:"Copy Items to Dataset"})]}),c.jsx(cn.Separator,{}),c.jsxs(cn.Item,{onSelect:s,className:"text-red-500 focus:text-red-400",children:[c.jsx(Fv,{}),c.jsx("span",{children:"Delete Items"})]})]})]})}function aun({onAddClick:e,onImportClick:t,onImportJsonClick:r,onExportClick:n,onExportJsonClick:s,onCreateDatasetClick:a,onAddToDatasetClick:i,onDeleteClick:o,onCompareClick:l,hasItems:u,searchQuery:d,isSelectionActive:p,onSearchChange:f,selectedCount:h,onExecuteAction:m,onCancelSelection:g,selectionMode:b,onVersionsClick:v,isItemPanelOpen:S,isVersionsPanelOpen:w,isViewingOldVersion:k}){return p?c.jsxs(Un.Toolbar,{className:"",children:[c.jsx(sN,{label:"Search",placeholder:"Search items...",value:d??"",onChange:_=>f?.(_.target.value),variant:"experimental",size:"default",onReset:()=>f?.(""),disabled:!u&&!d}),c.jsxs("div",{className:"flex gap-5",children:[c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsxs("div",{className:"text-sm text-neutral3 flex items-center gap-2",children:[c.jsx(fo,{size:"large",color:b==="compare-items"&&h<2||h===0?"red":"green",children:h}),c.jsx("span",{children:b==="compare-items"?"of 2 items selected":"items selected"}),c.jsx(fie,{})]})}),(b==="compare-items"&&h<2||h===0)&&c.jsx(sn,{children:b==="compare-items"?h<=2?"Select 2 items to compare":void 0:h===0?"Select at least one item":void 0})]}),c.jsxs(Xo,{children:[c.jsxs(ye,{variant:"cta",size:"default",disabled:b==="compare-items"?h!==2:h===0,onClick:m,children:[b==="compare-items"&&"Compare Items",b==="export"&&"Export Items as CSV",b==="export-json"&&"Export Items as JSON",b==="create-dataset"&&"Create a new Dataset with Items",b==="add-to-dataset"&&"Add Items to a Dataset",b==="delete"&&"Delete Items"]}),c.jsx(ye,{variant:"standard",size:"default",onClick:g,children:"Cancel"})]})]})]}):c.jsxs("div",{className:"flex items-center justify-between gap-4 w-full",children:[c.jsx(sN,{label:"Search",placeholder:"Search items...",value:d??"",onChange:_=>f?.(_.target.value),variant:"experimental",size:"default",onReset:()=>f?.(""),disabled:!u&&!d}),c.jsxs(Xo,{children:[!S&&!k&&c.jsxs(Xo,{spacing:"close",children:[c.jsxs(ye,{variant:"standard",size:"default",onClick:e,children:[c.jsx(Qs,{})," Add Item"]}),c.jsxs(cn,{children:[c.jsx(cn.Trigger,{asChild:!0,children:c.jsx(ye,{variant:"standard",size:"default","aria-label":"Dataset actions menu",children:c.jsx($a,{})})}),c.jsxs(cn.Content,{align:"end",children:[c.jsxs(cn.Item,{onSelect:t,children:[c.jsx(xL,{})," Import CSV"]}),c.jsxs(cn.Item,{onSelect:r,children:[c.jsx(eI,{})," Import JSON"]})]})]})]}),u&&!k&&c.jsx(sun,{onExportClick:n,onExportJsonClick:s,onCreateDatasetClick:a,onAddToDatasetClick:i,onDeleteClick:o,onCompareClick:l}),!S&&!w&&c.jsxs(ye,{variant:"standard",size:"default",onClick:v,"aria-label":"View versions",children:[c.jsx(bL,{className:"w-4 h-4"}),"Versions"]})]})]})}function lx({children:e,className:t}){return c.jsx("div",{className:K("grid w-full h-full grid-cols-1 overflow-y-auto",t),children:e})}function iun({children:e,numOfColumns:t=1,minColumnWidth:r}){const n=E.useRef(null),[s,a]=E.useState(!1),[i,o]=E.useState(!1),l=E.useCallback(()=>{const p=n.current;if(!p)return;const{scrollLeft:f,scrollWidth:h,clientWidth:m}=p;a(f>1),o(f+m<h-1)},[]);E.useEffect(()=>{const p=n.current;if(!p)return;l(),p.addEventListener("scroll",l,{passive:!0});const f=new ResizeObserver(l);return f.observe(p),()=>{p.removeEventListener("scroll",l),f.disconnect()}},[l]);const u=E.useRef(t);E.useEffect(()=>{const p=n.current;p&&(t>u.current&&requestAnimationFrame(()=>{p.scrollTo({left:p.scrollWidth,behavior:"smooth"})}),u.current=t)},[t]),E.useEffect(()=>{const p=f=>{(f.key==="ArrowLeft"||f.key==="ArrowRight")&&(f.preventDefault(),d(f.key==="ArrowLeft"?"left":"right"))};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[]);const d=p=>{const f=n.current;if(!f)return;const h=Array.from(f.children),m=f.scrollLeft,g=m+f.clientWidth;if(p==="right"){const b=h.find(v=>v.offsetLeft+v.offsetWidth>g+1);b&&f.scrollTo({left:b.offsetLeft+b.offsetWidth-f.clientWidth,behavior:"smooth"})}else{const b=[...h].reverse().find(v=>v.offsetLeft<m-1);b&&f.scrollTo({left:b.offsetLeft,behavior:"smooth"})}};return c.jsxs("div",{className:K("MULTI_COLUMN relative w-full h-full overflow-hidden"),children:[s&&c.jsx(k$e,{direction:"left",onClick:()=>d("left")}),i&&c.jsx(k$e,{direction:"right",onClick:()=>d("right")}),c.jsx("div",{ref:n,className:"grid overflow-x-auto w-full overflow-y-auto h-full",style:{gridTemplateColumns:`repeat(${t}, minmax(${r??"0"}, 1fr))`},children:e})]})}function k$e({direction:e,onClick:t}){const r=e==="left"?UBe:Hi,n=e==="left";return c.jsx("div",{className:K("absolute top-0 bottom-0 z-20 w-20 flex items-center justify-center px-5 bg-surface2",n?"left-0":"right-0"),children:c.jsx(ye,{onClick:t,variant:"standard",size:"large",className:"w-full h-full px-0","aria-label":`Scroll ${e}`,children:c.jsx(r,{})})})}function hj({onPrevious:e,onNext:t,previousAriaLabel:r="Previous",nextAriaLabel:n="Next"}){return c.jsxs(Xo,{spacing:"close",children:[c.jsxs(ye,{variant:"standard",size:"default",onClick:e,disabled:!e,"aria-label":r,children:[c.jsx(pL,{})," Prev"]}),c.jsxs(ye,{variant:"standard",size:"default",onClick:t,disabled:!t,"aria-label":n,children:["Next",c.jsx(iie,{})]})]})}function oun({datasetId:e,itemId:t,onPrevious:r,onNext:n,onEdit:s,onDelete:a,onClose:i,isEditing:o=!1}){const{Link:l}=Yt();return c.jsxs(Un.Toolbar,{children:[c.jsx(hj,{onPrevious:r,onNext:n,previousAriaLabel:"Previous item",nextAriaLabel:"Next item"}),c.jsxs(Xo,{children:[!o&&c.jsxs(c.Fragment,{children:[c.jsxs(ye,{variant:"standard",size:"default",href:`/datasets/${e}/items/${t}`,as:l,children:[c.jsx(bL,{}),"Versions"]}),c.jsxs(cn,{children:[c.jsx(cn.Trigger,{asChild:!0,children:c.jsx(ye,{variant:"standard",size:"default","aria-label":"Actions menu",children:c.jsx(eze,{})})}),c.jsxs(cn.Content,{align:"end",className:"w-48",children:[c.jsxs(cn.Item,{onSelect:s,children:[c.jsx(vL,{}),"Edit"]}),c.jsxs(cn.Item,{onSelect:a,className:"text-red-500 focus:text-red-400",children:[c.jsx(Fv,{}),"Delete Item"]})]})]})]}),c.jsx(ye,{variant:"standard",size:"default",onClick:i,"aria-label":"Close detail panel",children:c.jsx(Os,{})})]})]})}function lun({children:e,title:t,description:r,icon:n,className:s,withMargins:a=!0}){const i=t==="loading",o=r==="loading";return e?c.jsx("header",{className:K("grid grid-cols-[1fr_auto] gap-16 w-full ",{"mt-[6vh] mb-[4vh]":a},s),children:e}):c.jsxs("header",{className:K("grid gap-2 pt-8 pb-8",s),children:[c.jsx("h1",{className:K("text-neutral6 text-xl font-normal flex items-center gap-2","[&>svg]:w-6 [&>svg]:h-6 [&>svg]:text-neutral3",{"bg-surface4 w-60 max-w-[50%] rounded-md animate-pulse":i}),children:i?c.jsx(c.Fragment,{children:" "}):c.jsxs(c.Fragment,{children:[n&&n," ",t]})}),r&&c.jsx("p",{className:K("text-neutral4 text-sm m-0",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":o}),children:o?c.jsx(c.Fragment,{children:" "}):r})]})}function cun({children:e,isLoading:t,size:r="default"}){return c.jsx("h1",{className:K("text-neutral5 text-xl font-normal gap-2 flex items-center","[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:opacity-50",{"bg-surface4 w-60 max-w-[50%] rounded-md animate-pulse":t,"text-md":r==="smaller"}),children:t?c.jsx(c.Fragment,{children:" "}):c.jsx(c.Fragment,{children:e})})}function uun({children:e,isLoading:t,titleWithIcon:r}){return c.jsx("p",{className:K("text-neutral3 text-sm max-w-[35rem] flex flex-wrap gap-x-4 gap-y-1 mt-1 first-of-type:mt-3 ml-1",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":t}),children:t?c.jsx(c.Fragment,{children:" "}):c.jsx(c.Fragment,{children:e})})}function dun({children:e,className:t}){return c.jsx("div",{className:K("grid content-start",t),children:e})}const Rr=Object.assign(lun,{Title:cun,Description:uun,Column:dun});function Smt({item:e}){return c.jsx(Rr,{withMargins:!1,children:c.jsxs(Rr.Column,{children:[c.jsxs(Rr.Title,{size:"smaller",children:[c.jsx(L0,{}),c.jsx("span",{className:"truncate",children:e.id}),c.jsx(ql,{content:e.id,tooltip:`Copy item ID: ${e.id}`})]}),c.jsxs(Rr.Description,{children:[c.jsxs(xs,{children:[c.jsx(cA,{})," Created ",vn(new Date(e.createdAt),"MMM d, yyyy h:mm aaa")]}),e.datasetVersion!=null&&c.jsxs(xs,{children:[c.jsx(bL,{})," Version v",e.datasetVersion]})]})]})})}function s8({item:e}){const t=e?.input?JSON.stringify(e.input,null,2):"null",r=e?.groundTruth?JSON.stringify(e.groundTruth,null,2):"null",n=e?.metadata?JSON.stringify(e.metadata,null,2):"null";return c.jsxs(v1,{children:[c.jsx(er.CodeSection,{title:"Input",icon:c.jsx(JN,{}),codeStr:t}),c.jsx(er.CodeSection,{title:"Ground Truth",icon:c.jsx(dv,{}),codeStr:r}),c.jsx(er.CodeSection,{title:"Metadata",icon:c.jsx(mie,{}),codeStr:n})]})}function O$e({field:e,errors:t}){return t.length?c.jsx("div",{className:"mt-2 space-y-1",children:t.map((r,n)=>c.jsxs("p",{className:"text-xs text-destructive",children:[c.jsxs("code",{className:"bg-destructive/10 px-1 rounded",children:[e,r.path!=="/"?r.path:""]}),": ",r.message]},n))}):null}function wmt({inputValue:e,setInputValue:t,groundTruthValue:r,setGroundTruthValue:n,metadataValue:s,setMetadataValue:a,validationErrors:i,onSave:o,onCancel:l,isSaving:u}){return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mb-4",children:c.jsxs("h3",{className:"text-lg font-medium flex items-center gap-2",children:[c.jsx(vL,{className:"w-5 h-5"})," Edit Item"]})}),c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{children:"Input (JSON) *"}),c.jsx(Wa,{value:e,onChange:t,showCopyButton:!1,className:"min-h-[120px]"}),i?.field==="input"&&c.jsx(O$e,{field:"input",errors:i.errors})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{children:"Ground Truth (JSON, optional)"}),c.jsx(Wa,{value:r,onChange:n,showCopyButton:!1,className:"min-h-[100px]"}),i?.field==="groundTruth"&&c.jsx(O$e,{field:"groundTruth",errors:i.errors})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{children:"Metadata (JSON, optional)"}),c.jsx(Wa,{value:s,onChange:a,showCopyButton:!1,className:"min-h-[80px]"})]}),c.jsxs("div",{className:"flex gap-2 pt-4",children:[c.jsx(ye,{variant:"cta",size:"default",onClick:o,disabled:u,children:u?"Saving...":"Save Changes"}),c.jsx(ye,{variant:"standard",size:"default",onClick:l,disabled:u,children:"Cancel"})]})]})]})}function pun(e){if(!(e instanceof Error))return null;const t=e.message.match(/- ({.*})$/);if(!t)return null;try{const r=JSON.parse(t[1]);if(r.field&&Array.isArray(r.errors))return{field:r.field,errors:r.errors}}catch{}return null}function fun({datasetId:e,item:t,items:r,onItemChange:n,onClose:s}){const{Link:a}=Yt(),{updateItem:i,deleteItem:o}=Ru(),[l,u]=E.useState(!1),[d,p]=E.useState(""),[f,h]=E.useState(""),[m,g]=E.useState(""),[b,v]=E.useState(null),[S,w]=E.useState(!1);E.useEffect(()=>{t&&(p(JSON.stringify(t.input,null,2)),h(t.groundTruth?JSON.stringify(t.groundTruth,null,2):""),g(t.metadata?JSON.stringify(t.metadata,null,2):""),u(!1),w(!1),v(null))},[t?.id]);const k=()=>{const F=r.findIndex(L=>L.id===t.id);if(F>=0&&F<r.length-1)return()=>n(r[F+1].id)},_=()=>{const F=r.findIndex(L=>L.id===t.id);if(F>0)return()=>n(r[F-1].id)},C=async()=>{let F;try{F=JSON.parse(d)}catch{Xe.error("Input must be valid JSON");return}let L;if(f.trim())try{L=JSON.parse(f)}catch{Xe.error("Ground Truth must be valid JSON");return}let z;if(m.trim())try{z=JSON.parse(m)}catch{Xe.error("Metadata must be valid JSON");return}try{await i.mutateAsync({datasetId:e,itemId:t.id,input:F,groundTruth:L,metadata:z}),Xe.success("Item updated successfully"),u(!1),v(null)}catch(q){const H=pun(q);H?v(H):Xe.error(`Failed to update item: ${q instanceof Error?q.message:"Unknown error"}`)}},T=()=>{p(JSON.stringify(t.input,null,2)),h(t.groundTruth?JSON.stringify(t.groundTruth,null,2):""),g(t.metadata?JSON.stringify(t.metadata,null,2):""),u(!1),v(null)},A=F=>{p(F),b?.field==="input"&&v(null)},N=F=>{h(F),b?.field==="groundTruth"&&v(null)},I=()=>{u(!0)},R=()=>{w(!0)},$=async()=>{try{await o.mutateAsync({datasetId:e,itemId:t.id}),Xe.success("Item deleted successfully"),w(!1),s()}catch(F){Xe.error(`Failed to delete item: ${F instanceof Error?F.message:"Unknown error"}`)}};return c.jsxs(c.Fragment,{children:[c.jsxs(Un,{withLeftSeparator:!0,children:[c.jsx(oun,{datasetId:e,itemId:t.id,onPrevious:_(),onNext:k(),onEdit:I,onDelete:R,onClose:s,isEditing:l}),c.jsx(Un.Content,{children:l?c.jsx(wmt,{inputValue:d,setInputValue:A,groundTruthValue:f,setGroundTruthValue:N,metadataValue:m,setMetadataValue:g,validationErrors:b,onSave:C,onCancel:T,isSaving:i.isPending}):c.jsxs(c.Fragment,{children:[c.jsx(Smt,{item:t}),c.jsx(s8,{item:t,Link:a})]})})]}),c.jsx(qt,{open:S,onOpenChange:w,children:c.jsxs(qt.Content,{children:[c.jsxs(qt.Header,{children:[c.jsx(qt.Title,{children:"Delete Item"}),c.jsx(qt.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),c.jsxs(qt.Footer,{children:[c.jsx(qt.Cancel,{children:"Cancel"}),c.jsx(qt.Action,{onClick:$,children:o.isPending?"Deleting...":"Yes, Delete"})]})]})})]})}function hun({datasetId:e,onClose:t,onVersionSelect:r,onCompareVersionsClick:n,activeVersion:s}){const{data:a,isLoading:i,fetchNextPage:o,hasNextPage:l,isFetchingNextPage:u}=bmt(e),[d,p]=E.useState(!1),[f,h]=E.useState(new Set),m=k=>{r?.(k)},g=k=>s==null?k.isCurrent:k.version===s,b=k=>{h(_=>{const C=new Set(_);if(C.has(k))C.delete(k);else if(C.size>=2){const[T]=Array.from(C);return new Set([T,k])}else C.add(k);return C})},v=()=>{p(!1),h(new Set)},S=()=>{p(!0)},w=()=>{f.size===2&&n?.(Array.from(f))};return c.jsxs(Un,{withLeftSeparator:!0,className:"w-[14rem]",children:[d?c.jsx(Un.Toolbar,{className:"grid justify-stretch gap-3 w-full",children:c.jsxs(Xo,{children:[c.jsx(ye,{variant:"standard",size:"default",onClick:v,children:"Cancel"}),c.jsxs(nN,{variant:"cta",size:"default",disabled:f.size!==2,onClick:w,tooltipContent:f.size!==2?"Select two versions to enable comparison":void 0,className:"w-full",children:[c.jsx(Wh,{})," Compare"]})]})}):c.jsxs(Un.Toolbar,{children:[c.jsxs(ye,{variant:"standard",size:"default",onClick:S,children:[c.jsx(pA,{})," Compare Ver."]}),c.jsx(nN,{variant:"standard",size:"default",onClick:t,tooltipContent:"Hide Versions Panel",children:c.jsx(Os,{})})]}),c.jsx(Un.Content,{children:i?c.jsx(mun,{}):c.jsxs(We,{children:[c.jsx(We.Header,{children:c.jsx(We.HeaderCol,{children:"Dataset Version History"})}),c.jsxs(We.Scroller,{children:[c.jsx(We.Items,{children:a?.map(k=>{const _=String(k.version),C=k.createdAt?typeof k.createdAt=="string"?new Date(k.createdAt):k.createdAt:null;return c.jsxs(We.Row,{isSelected:d&&f.has(_),children:[d&&c.jsx(We.LabelCell,{children:c.jsx(Fp,{checked:f.has(_),onCheckedChange:()=>{},onClick:T=>{T.stopPropagation(),b(_)},"aria-label":`Select version ${C?`v${k.version} — ${vn(C,"MMM d, yyyy HH:mm")}`:`v${k.version}`}`})}),c.jsx(We.RowButton,{item:k,isFeatured:g(k),columns:[{name:"version",label:"Dataset Version History",size:"1fr"}],onClick:()=>m(k),className:"py-2",children:c.jsx(We.VersionCell,{version:k.version,date:C,isLatest:k.isCurrent})})]},String(k.version))})}),l&&c.jsx(ye,{variant:"standard",size:"default",onClick:()=>o(),disabled:u,className:"w-full mt-2",children:u?"Loading...":"Load More"})]})]})})]})}function mun(){return c.jsxs(We,{children:[c.jsx(We.Header,{children:c.jsx(We.HeaderCol,{children:"Dataset Version History"})}),c.jsx(We.Items,{children:Array.from({length:3}).map((e,t)=>c.jsx(We.Row,{children:c.jsx(We.RowButton,{columns:[{name:"version",label:"Dataset Version History",size:"1fr"}],children:c.jsx(We.TextCell,{isLoading:!0,children:"Loading..."})})},t))})]})}const gun={warning:"bg-[#352f26] ",destructive:"bg-accent2/20",info:"bg-accent5/20",success:"bg-accent1/15"};function yun({children:e,variant:t,className:r}){return c.jsx("div",{className:K("flex items-center gap-3 px-4 pr-3 py-3 rounded-lg text-neutral4/80","animate-in fade-in-0 slide-in-from-top-2 duration-200","[>svg]:w-[1em] [&>dvg]:h-[1em] [&>svg]:opacity-50 [&>svg]:text-neutral4",gun[t],r),children:e})}function bun({children:e,className:t}){return c.jsx("div",{className:K("flex-1 text-sm ",t),children:e})}function vun(e){return c.jsx(ye,{size:"sm",variant:"standard",...e})}function xun({children:e,className:t}){return c.jsx("div",{className:K("flex-1 text-sm font-semibold",t),children:e})}function Sun({children:e,className:t}){return c.jsx("div",{className:K("grid gap-1 ",t),children:e})}const Vo=Object.assign(yun,{Message:bun,Button:vun,Title:xun,Column:Sun});function wun({datasetId:e,items:t,isLoading:r,featuredItemId:n,onItemSelect:s,onItemClose:a,onAddClick:i,onImportClick:o,onImportJsonClick:l,onBulkDeleteClick:u,onCreateDatasetClick:d,onAddToDatasetClick:p,onCompareItemsClick:f,datasetName:h,clearSelectionTrigger:m,setEndOfListElement:g,isFetchingNextPage:b,hasNextPage:v,searchQuery:S,onSearchChange:w,activeDatasetVersion:k,currentDatasetVersion:_,onVersionSelect:C,onCompareVersionsClick:T}){const[A,N]=E.useState(!1),[I,R]=E.useState("idle"),$=icn(),F=t.find(U=>U.id===n)??null;E.useEffect(()=>{m!==void 0&&m>0&&($.clearSelection(),R("idle"))},[m]);const L=k!=null&&_!=null&&k!==_,z=U=>{U===n?a():s(U)},q=()=>{N(!0)},H=()=>{N(!1)},V=()=>{R("idle"),$.clearSelection()},G=()=>{if($.selectedCount===0)return;const U=t.filter(j=>$.selectedIds.has(j.id));if(I==="export"){try{ocn(U,`${h||"dataset"}-items.csv`),Xe.success(`Exported ${$.selectedCount} items to CSV`)}catch(j){Xe.error("Failed to export items to CSV"),console.error("CSV export error:",j)}V()}else if(I==="export-json"){try{lcn(U,`${h||"dataset"}-items.json`),Xe.success(`Exported ${$.selectedCount} items to JSON`)}catch(j){Xe.error("Failed to export items to JSON"),console.error("JSON export error:",j)}V()}else I==="create-dataset"?d?.(U):I==="add-to-dataset"?p?.(U):I==="delete"?u?.(Array.from($.selectedIds)):I==="compare-items"&&f?.(Array.from($.selectedIds))},M=I!=="idle",X=[{name:"id",label:"ID",size:"5rem"},{name:"input",label:"Input",size:"1fr"},...F?[]:[{name:"groundTruth",label:"Ground Truth",size:"1fr"}],{name:"date",label:"Created",size:"10rem"}];return c.jsxs(lx,{className:K({"grid-cols-[1fr_1fr]":!!F,"grid-cols-[1fr_auto]":A&&!F}),children:[c.jsxs(Un,{children:[c.jsx(aun,{onAddClick:i,onImportClick:o??(()=>{}),onImportJsonClick:l??(()=>{}),onExportClick:()=>R("export"),onExportJsonClick:()=>R("export-json"),onCreateDatasetClick:()=>R("create-dataset"),onAddToDatasetClick:()=>R("add-to-dataset"),onDeleteClick:()=>R("delete"),onCompareClick:()=>R("compare-items"),hasItems:t.length>0,searchQuery:S,onSearchChange:w,isSelectionActive:M,selectedCount:$.selectedCount,onExecuteAction:G,onCancelSelection:V,selectionMode:I,onVersionsClick:q,isItemPanelOpen:!!F,isVersionsPanelOpen:A,isViewingOldVersion:L}),L&&k!=null&&c.jsxs(Vo,{variant:"warning",children:[c.jsx(Pc,{}),c.jsxs(Vo.Message,{children:["Viewing version v",k]}),c.jsxs(Vo.Button,{onClick:()=>C?.({version:_,isCurrent:!0}),children:[c.jsx(pw,{})," Return to the latest version"]})]}),c.jsx(Jcn,{items:t,isLoading:r,onItemClick:z,featuredItemId:n,columns:X,setEndOfListElement:g,isFetchingNextPage:b,hasNextPage:v,isSelectionActive:M,selectedIds:$.selectedIds,onToggleSelection:$.toggle,onSelectAll:$.selectAll,onClearSelection:$.clearSelection,maxSelection:I==="compare-items"?2:void 0,onAddClick:i,onImportClick:o,onImportJsonClick:l,searchQuery:S})]}),!!F&&c.jsx(fun,{datasetId:e,item:F,items:t,onItemChange:s,onClose:a}),!F&&A&&c.jsx(hun,{datasetId:e,onClose:H,onVersionSelect:C,onCompareVersionsClick:T,activeVersion:k})]})}const Eun=[{value:"all",label:"All statuses"},{value:"pending",label:"Pending"},{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}],kun=[{value:"all",label:"All types"},{value:"agent",label:"Agent"},{value:"workflow",label:"Workflow"},{value:"scorer",label:"Scorer"},{value:"processor",label:"Processor"}];function Oun({hasExperiments:e,onCompareClick:t,isSelectionActive:r,selectedCount:n,onExecuteCompare:s,onCancelSelection:a,filters:i,onFiltersChange:o,targetIds:l}){const u=[{value:"all",label:"All targets"},...l.map(d=>({value:d,label:d}))];return r?c.jsx("div",{className:"flex items-center justify-end gap-4 w-full",children:c.jsxs("div",{className:"flex gap-5",children:[c.jsxs("div",{className:"text-sm text-neutral3 flex items-center gap-2 pl-6",children:[c.jsx(fo,{size:"large",color:n<2?"red":"green",children:n}),c.jsx("span",{children:"of 2 experiments selected"}),c.jsx(fie,{})]}),c.jsxs(Xo,{children:[c.jsxs(ye,{variant:"cta",size:"default",disabled:n!==2,onClick:s,children:[c.jsx(pA,{className:"w-4 h-4"}),"Compare Experiments"]}),c.jsx(ye,{variant:"standard",size:"default",onClick:a,children:"Cancel"})]})]})}):c.jsxs("div",{className:"flex items-center justify-between gap-4 w-full",children:[c.jsxs(Xo,{children:[c.jsx(jc,{label:"Status",labelIsHidden:!0,name:"filter-status",options:Eun,value:i.status??"all",onValueChange:d=>o({...i,status:d==="all"?void 0:d}),variant:"experimental",size:"default"}),c.jsx(jc,{label:"Type",labelIsHidden:!0,name:"filter-target-type",options:kun,value:i.targetType??"all",onValueChange:d=>o({...i,targetType:d==="all"?void 0:d}),variant:"experimental",size:"default"}),l.length>0&&c.jsx(jc,{label:"Target",labelIsHidden:!0,name:"filter-target-id",options:u,value:i.targetId??"all",onValueChange:d=>o({...i,targetId:d==="all"?void 0:d}),variant:"experimental",size:"default"}),(i.status||i.targetType||i.targetId)&&c.jsxs(ye,{variant:"standard",size:"default",onClick:()=>o({}),children:[c.jsx(ve,{children:c.jsx(Os,{})}),"Reset"]})]}),e&&c.jsxs(ye,{variant:"standard",size:"default",onClick:t,children:[c.jsx(pA,{className:"w-4 h-4"}),"Compare"]})]})}const _$e=[{name:"experimentId",label:"ID",size:"6rem"},{name:"status",label:"Status",size:"4rem"},{name:"targetType",label:"Type",size:"4rem"},{name:"target",label:"Target",size:"1fr"},{name:"counts",label:"Counts",size:"7rem"},{name:"date",label:"Created",size:"10rem"}];function _un({experiments:e,isSelectionActive:t,selectedExperimentIds:r,onRowClick:n,onToggleSelection:s}){const a=_$e;return e.length===0?c.jsx(Cun,{}):c.jsx(We,{children:c.jsxs(We.Scroller,{children:[c.jsx(We.Header,{columns:a,isSelectionActive:t,children:a.map(i=>c.jsx(We.HeaderCol,{children:i.label},i.name))}),c.jsx(We.Items,{children:e.map(i=>{const o=i.status,l=r.includes(i.id),u={id:i.id};return c.jsxs(We.Row,{isSelected:l,children:[t&&c.jsx(We.LabelCell,{children:c.jsx(Fp,{checked:l,onCheckedChange:()=>s(i.id),"aria-label":`Select experiment ${i.id}`})}),c.jsxs(We.RowButton,{item:u,columns:_$e,onClick:()=>n(i.id),children:[c.jsx(We.IdCell,{id:i.id}),c.jsx(We.StatusCell,{status:o}),c.jsx(We.TextCell,{children:i.targetType}),c.jsx(We.TextCell,{children:i.targetId}),c.jsx(We.Cell,{children:c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsxs("div",{className:"flex gap-1",children:[i.succeededCount>0&&c.jsx(fo,{color:"green",children:i.succeededCount}),i.failedCount>0&&c.jsx(fo,{color:"red",children:i.failedCount})]})}),c.jsxs(sn,{children:[i.succeededCount," Succeeded",c.jsx("br",{}),i.failedCount," Failed"]})]})}),c.jsx(We.DateCell,{date:i.createdAt,withTime:!0})]})]},i.id)})})]})})}function Cun(){return c.jsx("div",{className:"flex h-full items-center justify-center py-12",children:c.jsx(Bc,{iconSlot:c.jsx(hie,{className:"w-8 h-8 text-neutral3"}),titleSlot:"No experiments yet",descriptionSlot:"Trigger an experiment to evaluate your dataset against an agent, workflow, or scorer."})})}function Tun({experiments:e,allExperiments:t,isLoading:r,datasetId:n,filters:s,onFiltersChange:a}){const[i,o]=E.useState([]),[l,u]=E.useState(!1),{navigate:d}=Yt(),p=E.useMemo(()=>{const b=t??e;return[...new Set(b.map(v=>v.targetId))]},[t,e]),f=b=>{o(v=>v.includes(b)?v.filter(S=>S!==b):v.length>=2?[v[0],b]:[...v,b])},h=()=>{if(i.length===2){const[b,v]=i;d(`/datasets/${n}/experiments?baseline=${b}&contender=${v}`)}},m=()=>{o([]),u(!1)},g=b=>{d(`/datasets/${n}/experiments/${b}`)};return r?c.jsx("div",{children:"Loading..."}):c.jsx(lx,{children:c.jsxs(Un,{children:[c.jsx(Oun,{hasExperiments:e.length>0||Object.values(s).some(Boolean),onCompareClick:()=>u(!0),isSelectionActive:l,selectedCount:i.length,onExecuteCompare:h,onCancelSelection:m,filters:s,onFiltersChange:a,targetIds:p}),c.jsx(_un,{experiments:e,isSelectionActive:l,selectedExperimentIds:i,onRowClick:g,onToggleSelection:f})]})})}function Aun({dataset:e,isLoading:t=!1,onEditClick:r,onDuplicateClick:n,onDeleteClick:s,experimentTriggerSlot:a,onExperimentClick:i,className:o}){return c.jsxs(Rr,{className:o,children:[c.jsxs(Rr.Column,{children:[c.jsxs(Rr.Title,{isLoading:t,children:[c.jsx(BE,{})," ",e?.name]}),c.jsx(Rr.Description,{isLoading:t,children:e?.description}),c.jsxs(Rr.Description,{isLoading:t,children:[c.jsxs(xs,{children:[c.jsx(cA,{})," Created at ",e?.createdAt?vn(new Date(e.createdAt),"MMM d, yyyy"):""]}),c.jsxs(xs,{children:[c.jsx(bL,{})," Latest version v",e?.version??""]})]})]}),c.jsx(Rr.Column,{children:c.jsxs(Xo,{children:[a||(i?c.jsxs(ye,{variant:"outline",size:"sm",onClick:i,children:[c.jsx(hie,{}),"Run Experiment"]}):null),c.jsxs(cn,{children:[c.jsx(cn.Trigger,{asChild:!0,children:c.jsx(ye,{variant:"standard",size:"default","aria-label":"Dataset actions menu",children:c.jsx(eze,{})})}),c.jsxs(cn.Content,{align:"end",className:"w-48",children:[c.jsxs(cn.Item,{onSelect:r,children:[c.jsx(vL,{})," Edit Dataset"]}),c.jsxs(cn.Item,{onSelect:n,children:[c.jsx(Ql,{})," Duplicate Dataset"]}),c.jsxs(cn.Item,{onSelect:s,className:"text-red-500 focus:text-red-400",children:[c.jsx(Fv,{})," Delete Dataset"]})]})]})]})})]})}function Dun(e){const[t,r]=E.useState(()=>e.reduce((o,l)=>(o[l]="ignore",o),{})),n=E.useRef([]);E.useEffect(()=>{const o=n.current;if(e.length!==o.length||e.some((u,d)=>u!==o[d])){n.current=e;const u={};for(const d of e)u[d]="ignore";r(u)}},[e]);const s=E.useCallback((o,l)=>{r(u=>({...u,[o]:l}))},[]),a=E.useCallback(()=>{r(e.reduce((o,l)=>(o[l]="ignore",o),{}))},[e]),i=E.useMemo(()=>Object.values(t).some(o=>o==="input"),[t]);return{mapping:t,setColumnField:s,resetMapping:a,isInputMapped:i}}function Nun({onFileSelect:e,isParsing:t,error:r}){const n=E.useRef(null),[s,a]=E.useState(!1),i=E.useCallback(()=>{t||n.current?.click()},[t]),o=E.useCallback(p=>{const f=p.target.files?.[0];f&&e(f),p.target.value=""},[e]),l=E.useCallback(p=>{p.preventDefault(),p.stopPropagation(),a(!0)},[]),u=E.useCallback(p=>{p.preventDefault(),p.stopPropagation(),a(!1)},[]),d=E.useCallback(p=>{if(p.preventDefault(),p.stopPropagation(),a(!1),t)return;const f=p.dataTransfer.files?.[0];f&&f.name.endsWith(".csv")&&e(f)},[t,e]);return c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("input",{ref:n,type:"file",accept:".csv",onChange:o,className:"hidden",disabled:t}),c.jsx("div",{onClick:i,onDragOver:l,onDragLeave:u,onDrop:d,className:K("flex flex-col items-center justify-center gap-3","min-h-[160px] rounded-lg border-2 border-dashed p-6","cursor-pointer transition-colors","border-surface4 bg-surface2",s&&"border-accent1/50 bg-accent1/5",r&&"border-accent2/50 bg-accent2/5",t&&"cursor-wait opacity-60"),children:t?c.jsxs(c.Fragment,{children:[c.jsx(Cn,{size:"lg"}),c.jsx("span",{className:"text-sm text-neutral4",children:"Parsing CSV..."})]}):c.jsxs(c.Fragment,{children:[c.jsx(ve,{className:"text-neutral4",children:c.jsx(xL,{className:"h-8 w-8"})}),c.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c.jsx("span",{className:"text-sm font-medium text-neutral1",children:"Click to upload or drag and drop"}),c.jsx("span",{className:"text-xs text-neutral4",children:"CSV files only"})]})]})}),r&&c.jsx("div",{className:"text-sm text-accent2",children:r})]})}function C$e({headers:e,data:t,maxRows:r=5}){const n=t.slice(0,r),s=t.length,a=i=>{if(i==null)return"";const o=typeof i=="object"?JSON.stringify(i):String(i);return o.length>50?o.slice(0,47)+"...":o};return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("div",{className:"overflow-x-auto rounded-lg border border-border1",children:c.jsxs(Tl,{size:"small",children:[c.jsx(Al,{children:e.map(i=>c.jsx(Aa,{children:i},i))}),c.jsx(Dl,{children:n.map((i,o)=>c.jsx(Nl,{children:e.map(l=>c.jsx(Hs,{className:"text-sm max-w-[200px]",children:c.jsx("span",{className:"truncate block",children:a(i[l])})},l))},o))})]})}),c.jsx("div",{className:"text-xs text-neutral4",children:n.length<s?`Showing ${n.length} of ${s} rows`:`${s} row${s!==1?"s":""}`})]})}const Iun=[{id:"input",label:"Input",description:"Data passed to target",required:!0},{id:"groundTruth",label:"Ground Truth",description:"Ground truth for comparison"},{id:"metadata",label:"Metadata",description:"Additional context"},{id:"ignore",label:"Ignore",description:"Not imported"}];function jun({headers:e,mapping:t,onMappingChange:r}){const n=i=>{if(!i.destination)return;const o=i.draggableId,l=i.destination.droppableId;t[o]!==l&&r(o,l)},s=i=>e.filter(o=>t[o]===i),a=s("input").length>0;return c.jsx(_pe,{onDragEnd:n,children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx("div",{className:"text-sm text-neutral4",children:"Drag columns to assign them to dataset fields"}),Iun.map(i=>{const o=s(i.id),l=o.length===0,u=i.required&&l;return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm font-medium text-neutral1",children:i.label}),i.required&&c.jsx("span",{className:"text-xs text-accent1",children:"*"}),c.jsx("span",{className:"text-xs text-neutral4",children:i.description})]}),c.jsx(Ape,{droppableId:i.id,direction:"horizontal",children:(d,p)=>c.jsxs("div",{ref:d.innerRef,...d.droppableProps,className:`
587
+ Token usage: ${r} input + ${n} output = ${s} total`:`The model stopped generating because it reached the maximum token limit (${s} tokens). The response was truncated and may be incomplete.`}function Fln({span:e}){if(!e)return null;const t=Mln(e);return c.jsxs(c.Fragment,{children:[t&&c.jsx("div",{className:"bg-yellow-900/20 border border-yellow-200 rounded-md p-2 mb-4",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Pc,{className:"text-yellow-200 mt-0.5 flex-shrink-0",size:20}),c.jsxs("div",{className:"flex-1",children:[c.jsx("h4",{className:"font-semibold text-yellow-200 mb-1 text-sm",children:"Token Limit Exceeded"}),c.jsx("p",{className:"text-sm text-neutral3 whitespace-pre-line",children:Lln(e)})]})]})}),c.jsx(er.CodeSection,{title:"Input",icon:c.jsx(JN,{}),codeStr:JSON.stringify(e.input||null,null,2)}),c.jsx(er.CodeSection,{title:"Output",icon:c.jsx(dv,{}),codeStr:JSON.stringify(e.output||null,null,2)}),c.jsx(er.CodeSection,{title:"Metadata",icon:c.jsx(jp,{}),codeStr:JSON.stringify(e.metadata||null,null,2)}),c.jsx(er.CodeSection,{title:"Attributes",icon:c.jsx(jp,{}),codeStr:JSON.stringify(e.attributes||null,null,2)})]})}function ymt({trace:e,span:t,spanScoresData:r,onSpanScoresPageChange:n,isLoadingSpanScoresData:s,spanInfo:a=[],defaultActiveTab:i="details",initialScoreId:o,computeTraceLink:l,scorers:u,isLoadingScorers:d}){const{Link:p}=Yt();let f;return t?.attributes?.agentId||t?.entityType===gD.AGENT?f="Agent":(t?.attributes?.workflowId||t?.entityType===gD.WORKFLOW_RUN)&&(f="Workflow"),c.jsxs(TO,{defaultTab:i,children:[c.jsxs(AO,{children:[c.jsx(gl,{value:"details",children:"Details"}),c.jsxs(gl,{value:"scores",children:["Scoring ",r?.pagination&&`(${r.pagination.total||0})`]})]}),c.jsx(Tc,{value:"details",children:c.jsxs(v1,{children:[t?.attributes?.usage?c.jsx($ln,{spanUsage:t.attributes.usage}):null,c.jsx(gS,{data:a,LinkComponent:p}),c.jsx(Fln,{span:t})]})}),c.jsx(Tc,{value:"scores",children:c.jsxs(v1,{children:[c.jsxs(Uo,{children:[c.jsx(Uo.Header,{children:c.jsxs(Uo.Heading,{children:[c.jsx(DK,{})," Scoring"]})}),c.jsx(Zln,{traceId:e?.traceId,isTopLevelSpan:!t?.parentSpanId,spanId:t?.spanId,entityType:f,scorers:u,isLoadingScorers:d})]}),c.jsxs(Uo,{children:[c.jsx(Uo.Header,{children:c.jsxs(Uo.Heading,{children:[c.jsx(DK,{})," Scores"]})}),c.jsx(Qln,{scoresData:r,onPageChange:n,isLoadingScoresData:s,initialScoreId:o,traceId:e?.traceId,spanId:t?.spanId,computeTraceLink:l})]})]})})]})}function Bln({trace:e,span:t,spanScoresData:r,onSpanScoresPageChange:n,isLoadingSpanScoresData:s,isOpen:a,onClose:i,onNext:o,onPrevious:l,onViewToggle:u,spanInfo:d=[],defaultActiveTab:p="details",initialScoreId:f,computeTraceLink:h,scorers:m,isLoadingScorers:g}){return c.jsxs(er,{dialogTitle:"Observability Span",dialogDescription:"View and analyze span details",isOpen:a,onClose:i,level:2,children:[c.jsxs(er.Top,{children:[c.jsxs(xs,{children:[c.jsx(wp,{})," ",vd(t?.traceId)]}),"›",c.jsxs(xs,{children:[c.jsx(y3,{}),vd(t?.spanId)]}),"|",c.jsx(er.Nav,{onNext:o,onPrevious:l}),c.jsxs("button",{className:"ml-auto mr-8",onClick:u,children:[c.jsx(uIt,{}),c.jsx(Rp,{children:"Switch to dialog view"})]})]}),c.jsxs(er.Content,{children:[c.jsxs(er.Header,{children:[c.jsxs(er.Heading,{children:[c.jsx(y3,{})," ",t?.name]}),c.jsxs(xs,{children:[c.jsx(F0,{})," ",t?.spanId]})]}),c.jsx(ymt,{trace:e,span:t,spanScoresData:r,onSpanScoresPageChange:n,isLoadingSpanScoresData:s,spanInfo:d,defaultActiveTab:p,initialScoreId:f,computeTraceLink:h,scorers:m,isLoadingScorers:g})]})]})}function zln(e){if(e?.input==null)return"{}";const t=e.input,n=e.spanType==="agent_run"&&t&&typeof t=="object"&&!Array.isArray(t)&&"messages"in t?t.messages??e.input:e.input;return JSON.stringify(n,null,2)}function Uln({traceDetails:e,traceId:t,isOpen:r,onClose:n,level:s=2}){return c.jsx(Rft,{initialInput:zln(e),initialGroundTruth:e?.output!=null?JSON.stringify(e.output,null,2):"",breadcrumb:c.jsxs(xs,{children:[c.jsx(wp,{})," ",vd(t)]}),isOpen:r,onClose:n,level:s})}function Vln({traceId:e,traceSpans:t=[],traceDetails:r,isOpen:n,onClose:s,onNext:a,onPrevious:i,isLoadingSpans:o,computeTraceLink:l,initialSpanId:u,initialSpanTab:d,initialScoreId:p,scorers:f,isLoadingScorers:h}){const{Link:m,navigate:g}=Yt(),[b,v]=E.useState(!!u),[S,w]=E.useState(u),[k,_]=E.useState(!1),[C,T]=E.useState(d||"details"),A=t.find(ge=>ge.spanId===S),N=jln(r),[I,R]=E.useState(0),[$,F]=E.useState(""),[L,z]=E.useState([]),[q,H]=E.useState([]),[V,G]=E.useState([]),[M,X]=E.useState(!1);E.useEffect(()=>{if($.trim()===""){H([]);return}const ge=$.toLowerCase(),le=t.filter(xe=>xe.name.toLowerCase().includes(ge)).map(xe=>xe.spanId);H(le)},[$]),E.useEffect(()=>{u&&(w(u),v(!0))},[u]),E.useEffect(()=>{I>0&&R(0)},[S]);const U=E.useMemo(()=>Oln(t),[t]),j=E.useMemo(()=>(le=>{const xe=[],Ie=Ce=>{xe.push(Ce),Ce.spans&&Ce.spans.length>0&&Ce.spans.forEach(Ie)};return le.forEach(Ie),xe})(U),[U]),{data:Q,isLoading:Z}=Ssn({traceId:e,spanId:S||j?.[0]?.id,page:I}),J=ge=>{S===ge?w(void 0):(w(ge),T("details"),v(!0))},ee=()=>{w(U[0]?.id),T("scores"),e&&g(`${l(e,U?.[0]?.id)}&tab=scores`)},te=()=>{w(U[0]?.id),T("scores"),e&&g(`${l(e,U?.[0]?.id)}&tab=scores&scoreId=${Q?.scores?.[0]?.id}`)},se=ge=>{z(le=>le.includes(ge)?le.filter(xe=>xe!==ge):[...le,ge])},ce=()=>{z([])},Se=Rln({span:A}),W=()=>{const ge=[],le=(xe,Ie)=>{xe.forEach(Ce=>{(!Ie||Ie===null||V.includes(Ie))&&(ge.push(Ce),V.includes(Ce.id)&&Ce.spans&&le(Ce.spans,Ce.id))})};return le(U),ge},ne=()=>{if(!S)return;const ge=W(),le=ge.findIndex(xe=>xe.id===S);if(le>=0&&le<ge.length-1)return()=>w(ge[le+1].id)},ae=()=>{if(!S)return;const ge=W(),le=ge.findIndex(xe=>xe.id===S);if(le>0)return()=>w(ge[le-1].id)};return c.jsxs(c.Fragment,{children:[c.jsxs(er,{dialogTitle:"Observability Trace",dialogDescription:"View and analyze trace details",isOpen:n,onClose:s,level:1,children:[c.jsxs(er.Top,{children:[c.jsxs(xs,{children:[c.jsx(wp,{})," ",vd(e)]}),"|",c.jsx(er.Nav,{onNext:a,onPrevious:i}),c.jsxs(ye,{variant:"standard",size:"default",className:"ml-auto mr-8",onClick:()=>X(!0),children:[c.jsx(ve,{children:c.jsx(nI,{})}),"Save as Dataset Item"]})]}),c.jsxs("div",{className:K("overflow-y-auto",{"grid grid-rows-[2fr_3fr]":!!(A&&k)}),children:[c.jsxs(er.Content,{children:[c.jsxs(er.Header,{children:[c.jsxs(er.Heading,{children:[c.jsx(wp,{})," ",r?.name]}),c.jsxs(xs,{children:[c.jsx(F0,{})," ",e]})]}),r&&c.jsxs(v1,{children:[c.jsxs("div",{className:"grid xl:grid-cols-[3fr_2fr] gap-4 items-start",children:[c.jsx(gS,{data:N,LinkComponent:m}),c.jsxs("div",{className:"bg-surface3 p-6 rounded-lg grid gap-4",children:[c.jsx("h4",{className:"text-ui-lg",children:c.jsxs(xs,{children:[c.jsx(Zg,{})," Evaluate trace"]})}),c.jsxs(Xo,{className:"w-full",children:[c.jsxs(ye,{onClick:ee,children:[c.jsx(ve,{children:c.jsx(DK,{})}),"Scoring"]}),Q?.scores?.[0]&&c.jsxs(ye,{onClick:te,children:["Last score: ",c.jsx("b",{children:Q?.scores?.[0]?.score})]})]})]})]}),c.jsxs(Uo,{children:[c.jsx(Uo.Header,{children:c.jsxs(Uo.Heading,{children:[c.jsx(UNt,{})," Timeline"]})}),c.jsx(Iln,{spans:t,fadedTypes:L,onLegendClick:se,onLegendReset:ce,searchPhrase:$,onSearchPhraseChange:F,traceId:e}),c.jsx(Nln,{hierarchicalSpans:U,onSpanClick:J,selectedSpanId:S,isLoading:o,fadedTypes:L,expandedSpanIds:V,setExpandedSpanIds:G,featuredSpanIds:q})]})]})]}),A&&k&&c.jsxs("div",{className:"grid grid-rows-[auto_1fr] relative overflow-y-auto rounded-xl mx-8 mb-8 bg-surface4",children:[c.jsxs(er.Top,{children:[c.jsxs(xs,{children:[c.jsx(y3,{})," ",vd(S)]}),"|",c.jsx(er.Nav,{onNext:ne(),onPrevious:ae()}),c.jsxs("button",{className:"ml-auto mr-8",onClick:()=>_(!1),children:[c.jsx(lze,{})," ",c.jsx(Rp,{children:"Switch to dialog view"})]})]}),c.jsx("div",{className:K("h-full overflow-y-auto pb-8 pl-8"),children:c.jsxs("div",{className:"overflow-y-auto pr-8 pt-8 h-full",children:[c.jsxs(er.Header,{children:[c.jsxs(er.Heading,{children:[c.jsx(wp,{}),A?.name]}),c.jsxs(xs,{children:[c.jsx(F0,{})," ",S]})]}),c.jsx(ymt,{trace:r,span:A,spanScoresData:Q,onSpanScoresPageChange:R,isLoadingSpanScoresData:Z,spanInfo:Se,defaultActiveTab:C,initialScoreId:p,computeTraceLink:l})]})})]})]})]}),c.jsx(Uln,{traceDetails:r,traceId:e,isOpen:M&&n,onClose:()=>X(!1)}),r&&c.jsx(Bln,{trace:r,span:A,spanScoresData:Q,onSpanScoresPageChange:R,isLoadingSpanScoresData:Z,isOpen:!!(b&&S&&!k),onClose:()=>{g(l(e||"")),v(!1)},onNext:ne(),onPrevious:ae(),onViewToggle:()=>_(!k),spanInfo:Se,defaultActiveTab:C,initialScoreId:p,computeTraceLink:l,scorers:f,isLoadingScorers:h})]})}function qln({onEntityChange:e,onReset:t,selectedEntity:r,entityOptions:n,onDateChange:s,selectedDateFrom:a,selectedDateTo:i,isLoading:o}){return c.jsxs("div",{className:K("flex flex-wrap gap-x-8 gap-y-4"),children:[c.jsx(jc,{label:"Filter by Entity",name:"select-entity",placeholder:"Select...",options:n||[],onValueChange:l=>{const u=n?.find(d=>d.value===l);u&&e(u)},value:r?.value||"",className:"min-w-[20rem]",disabled:o}),c.jsxs("div",{className:K("flex gap-4 items-center flex-wrap"),children:[c.jsx("span",{className:K("shrink-0 text-ui-md text-neutral3"),children:"Filter by Date & time range"}),c.jsx(LPe,{placeholder:"From",value:a,maxValue:i,onValueChange:l=>s?.(l,"from"),className:"min-w-32",defaultTimeStrValue:"12:00 AM",disabled:o}),c.jsx(LPe,{placeholder:"To",value:i,minValue:a,onValueChange:l=>s?.(l,"to"),className:"min-w-32",defaultTimeStrValue:"11:59 PM",disabled:o}),c.jsxs(ye,{variant:"light",size:"lg",className:"min-w-32",onClick:t,disabled:o,children:[c.jsx(ve,{children:c.jsx(Os,{})}),"Reset"]})]})]})}const q$=[{name:"shortId",label:"ID",size:"6rem"},{name:"date",label:"Date",size:"4.5rem"},{name:"time",label:"Time",size:"6.5rem"},{name:"name",label:"Name",size:"1fr"},{name:"entityId",label:"Entity",size:"10rem"},{name:"status",label:"Status",size:"3rem"}];function Hln({traces:e,selectedTraceId:t,onTraceClick:r,errorMsg:n,setEndOfListElement:s,filtersApplied:a,isFetchingNextPage:i,hasNextPage:o}){return e?c.jsxs(Ln,{children:[c.jsxs(Ln.Trim,{children:[c.jsx(Ln.Header,{columns:q$}),n?c.jsx(Ln.Message,{message:n,type:"error"}):c.jsx(c.Fragment,{children:e.length>0?c.jsx(Ln.Entries,{children:e.map(l=>{const u=new Date(l.createdAt),d=UF(u),p={id:l.traceId,shortId:vd(l?.traceId)||"n/a",date:d?"Today":vn(u,"MMM dd"),time:vn(u,"h:mm:ss aaa"),name:l?.name,entityId:l?.entityName||l?.entityId||l?.attributes?.agentId||l?.attributes?.workflowId,status:l?.attributes?.status};return c.jsx(Ln.Entry,{entry:p,isSelected:t===l.traceId,columns:q$,onClick:r,children:q$.map((f,h)=>{const m=`${h}-${l.traceId}`;return f.name==="status"?c.jsx(Ln.EntryStatus,{status:p?.[f.name]},m):c.jsx(Ln.EntryText,{children:p?.[f.name]},m)})},p.id)})}):c.jsx(Ln.Message,{message:a?"No traces found for applied filters":"No traces found yet"})})]}),c.jsx(Ln.NextPageLoading,{setEndOfListElement:s,loadingText:"Loading more traces...",noMoreDataText:"All traces loaded",isLoading:i,hasMore:o})]}):null}const PP=[{name:"shortId",label:"ID",size:"1fr"},{name:"date",label:"Date",size:"1fr"},{name:"time",label:"Time",size:"1fr"},{name:"score",label:"Score",size:"1fr"},{name:"scorer",label:"Scorer",size:"1fr"}];function Qln({scoresData:e,isLoadingScoresData:t,traceId:r,spanId:n,initialScoreId:s,onPageChange:a,computeTraceLink:i}){const{navigate:o}=Yt(),[l,u]=E.useState(!1),[d,p]=E.useState();E.useEffect(()=>{s&&f(s)},[s]);const f=b=>{const v=e?.scores?.find(S=>S?.id===b);p(v),u(!0)};if(t)return c.jsx(Ift,{columns:PP});const h=b=>{const v=e?.scores?.find(S=>S?.id===b);p(v)},m=ife({entries:e?.scores||[],id:d?.id,update:h}),g=ofe({entries:e?.scores||[],id:d?.id,update:h});return c.jsxs(c.Fragment,{children:[c.jsxs(Ln,{children:[c.jsxs(Ln.Trim,{children:[c.jsx(Ln.Header,{columns:PP}),e?.scores&&e.scores.length>0?c.jsx(Ln.Entries,{children:e?.scores?.map(b=>{const v=new Date(b.createdAt),S=UF(v),w={id:b?.id,shortId:vd(b?.id)||"n/a",date:S?"Today":vn(v,"MMM dd"),time:vn(v,"h:mm:ss aaa"),score:b?.score,scorer:b?.scorer?.name||b?.scorer?.id};return c.jsx(Ln.Entry,{columns:PP,onClick:()=>f(b.id),entry:w,children:PP.map(k=>{const _=`col-${k.name}`;return c.jsx(Ln.EntryText,{children:String(w?.[k.name]??"")},_)})},b.id)})}):c.jsx(Ln.Message,{message:"No scores found",type:"info"})]}),c.jsx(Ln.Pagination,{currentPage:e?.pagination?.page||0,hasMore:e?.pagination?.hasMore,onNextPage:()=>a&&a((e?.pagination?.page||0)+1),onPrevPage:()=>a&&a((e?.pagination?.page||0)-1)})]}),c.jsx(Pft,{scorerName:d?.scorer?.name||d?.scorer?.id||"",score:d,isOpen:l,onClose:()=>{r&&o(`${i(r,n)}&tab=scores`),u(!1)},dialogLevel:3,onNext:m,onPrevious:g,computeTraceLink:(b,v)=>`/observability?traceId=${b}${v?`&spanId=${v}`:""}`,usageContext:"SpanDialog"})]})}const Gln=()=>{const e=st();return Kr({mutationFn:async({scorerName:t,traceId:r,spanId:n})=>await e.score({scorerName:t,targets:[{traceId:r,spanId:n}]})})};function MY({children:e,className:t,isVisible:r,autoDismiss:n=!0,dismissTime:s=5e3,dismissible:a=!0,type:i="info"}){const[o,l]=E.useState(r),[u,d]=E.useState(!1);E.useEffect(()=>{if(a&&n&&r){const m=setTimeout(()=>{p()},s);return()=>clearTimeout(m)}},[n,r,s,a]),E.useEffect(()=>{r&&(d(!1),l(!0))},[r]);const p=()=>{d(!0),setTimeout(()=>{l(!1),d(!1)},200)};if(!o)return null;const f={info:"bg-surface4 border-border1",error:"bg-accent2Darker border-accent2/30",success:"bg-accent1Darker border-accent1/30",warning:"bg-accent6Darker border-accent6/30"},h={info:"text-accent5",error:"text-accent2",success:"text-accent1",warning:"text-accent6"};return c.jsxs("div",{className:K("grid grid-cols-[auto_1fr_auto] gap-3 rounded-lg border p-4 text-ui-md text-neutral4 items-start","shadow-card",Wr.all,u?"animate-out fade-out-0 slide-out-to-right-2 duration-200":"animate-in fade-in-0 slide-in-from-right-2 duration-300",f[i],t),children:[c.jsx("div",{className:K("flex-shrink-0 mt-0.5",h[i]),children:i==="error"||i==="warning"?c.jsx(Pc,{className:"h-4 w-4"}):c.jsx(Ac,{className:"h-4 w-4"})}),c.jsx("div",{className:"flex gap-2 items-start min-w-0",children:e}),a&&c.jsxs(ye,{variant:"ghost",className:K("h-6 w-6 p-0 flex-shrink-0",Wr.colors,"hover:bg-surface5"),onClick:p,children:[c.jsx(Os,{className:"h-4 w-4"}),c.jsx(Rp,{children:"Dismiss"})]})]})}const Zln=({traceId:e,spanId:t,entityType:r,isTopLevelSpan:n,scorers:s,isLoadingScorers:a})=>{const[i,o]=E.useState(null),{mutate:l,isPending:u,isSuccess:d}=Gln(),[p,f]=E.useState(!1);E.useEffect(()=>{d&&f(!0)},[d]);let h=Object.entries(s||{}).map(([S,w])=>({id:S,name:w.scorer.config.name,description:w.scorer.config.description,isRegistered:w.isRegistered,type:w.scorer.config.type})).filter(S=>S.isRegistered);(r!=="Agent"||!n)&&(h=h.filter(S=>S.type!=="agent"));const m=u||a,g=()=>{i&&(f(!1),l({scorerName:i,traceId:e||"",spanId:t}))},b=S=>{o(S),f(!1)},v=h.find(S=>S.name===i)?.description||"";return s===void 0&&!a?c.jsxs(MY,{isVisible:!0,autoDismiss:!1,type:"error",children:[c.jsx(Ac,{})," Failed to load scorers."]}):h.length===0?c.jsxs(MY,{isVisible:!0,dismissible:!1,children:[c.jsx(Ac,{})," No eligible scorers have been defined to run."]}):c.jsxs("div",{children:[c.jsxs("div",{className:"grid grid-cols-[3fr_1fr] gap-4 items-start",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(jc,{name:"select-scorer",placeholder:"Select a scorer...",options:h.map(S=>({label:S.name||S.id,value:S.id||S.name||""})),onValueChange:b,value:i||"",className:"min-w-[20rem]",disabled:m}),v&&c.jsxs(xs,{className:"text-neutral3",children:[c.jsx(Ac,{})," ",v]})]}),c.jsx(ye,{disabled:!i||m,onClick:g,children:u?"Starting...":"Start Scoring"})]}),c.jsxs(MY,{isVisible:p,className:"mt-4",children:[c.jsx(Ac,{})," Scorer triggered! When finished successfully, it will appear in the list below. It could take a moment."]})]})},Qre=(e,t)=>{const r=st();return ur({queryKey:["dataset-item",e,t],queryFn:()=>r.getDatasetItem(e,t),enabled:!!e&&!!t,retry:!1})},f$e=10,$4=(e,t,r)=>{const n=st(),{inView:s,setRef:a}=H6(),i=CI({queryKey:["dataset-items",e,t,r],queryFn:async({pageParam:o})=>await n.listDatasetItems(e,{page:o,perPage:f$e,search:t||void 0,version:r||void 0}),initialPageParam:0,getNextPageParam:(o,l,u)=>{if(!o?.items?.length)return;const d=(u+1)*f$e,p=o?.pagination?.total??0;if(!(d>=p))return u+1},enabled:!!e,select:o=>o.pages.flatMap(l=>l?.items??[]),retry:!1});return E.useEffect(()=>{s&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[s,i.hasNextPage,i.isFetchingNextPage]),{...i,setEndOfListElement:a}},hfe=(e,t)=>{const r=st();return ur({queryKey:["dataset-item-versions",e,t],queryFn:async()=>((await r.getItemHistory(e,t))?.history??[]).map((s,a)=>({id:s.id,datasetId:s.datasetId,datasetVersion:s.datasetVersion,input:s.input,groundTruth:s.groundTruth,metadata:s.metadata,validTo:s.validTo,isDeleted:s.isDeleted,createdAt:s.createdAt,updatedAt:s.updatedAt,isLatest:a===0})),enabled:!!e&&!!t})},Gre=(e,t,r,n)=>{const s=st();return ur({queryKey:["dataset-item-version",e,t,r],queryFn:async()=>{const a=await s.getDatasetItemVersion(e,t,r);return{id:a.id,datasetId:a.datasetId,datasetVersion:a.datasetVersion,input:a.input,groundTruth:a.groundTruth,metadata:a.metadata,validTo:a.validTo??null,isDeleted:a.isDeleted??!1,createdAt:a.createdAt,updatedAt:a.updatedAt,isLatest:n!=null?r===n:!1}},enabled:!!e&&!!t&&r>0})},h$e=(e,t,r)=>{const n=st();return ur({queryKey:["dataset-experiments",e,t,r],queryFn:()=>n.listDatasetExperiments(e,t),enabled:!!e,select:s=>{if(!r)return s;const a=s.experiments.filter(i=>!(r.status&&i.status!==r.status||r.targetType&&i.targetType!==r.targetType||r.targetId&&i.targetId!==r.targetId));return{...s,experiments:a}}})},Zre=(e,t)=>{const r=st();return ur({queryKey:["dataset-experiment",e,t],queryFn:()=>r.getDatasetExperiment(e,t),enabled:!!e&&!!t,gcTime:0,staleTime:0,refetchInterval:n=>{const s=n.state.data?.status;return s==="running"||s==="pending"?2e3:!1}})},m$e=100,Wln=({datasetId:e,experimentId:t,experimentStatus:r})=>{const n=st(),{inView:s,setRef:a}=H6(),i=CI({queryKey:["dataset-experiment-results",e,t,r],queryFn:async({pageParam:o})=>n.listDatasetExperimentResults(e,t,{page:o,perPage:m$e}),initialPageParam:0,getNextPageParam:(o,l,u)=>{if(!o?.results?.length)return;const d=(u+1)*m$e,p=o?.pagination?.total??0;if(!(d>=p))return u+1},enabled:!!e&&!!t,refetchInterval:r==="running"||r==="pending"?2e3:!1,select:o=>o.pages.flatMap(l=>l?.results??[])});return E.useEffect(()=>{s&&i.hasNextPage&&!i.isFetchingNextPage&&i.fetchNextPage()},[s,i.hasNextPage,i.isFetchingNextPage]),{...i,setEndOfListElement:a}},Xln=(e,t)=>{const r=st();return ur({queryKey:["dataset-experiment-scores",e,t],queryFn:async()=>{const n=[];let s=0;const a=100;for(;;){const o=await r.listScoresByRunId({runId:e,page:s,perPage:a});if(n.push(...o.scores),!o.pagination.hasMore)break;s++}const i={};for(const o of n)i[o.entityId]||(i[o.entityId]=[]),i[o.entityId].push(o);return i},enabled:!!e,refetchInterval:t==="running"||t==="pending"?2e3:!1})},Yln=(e,t,r,n)=>{const s=st();return ur({queryKey:["compare-experiments",e,t,r,n],queryFn:()=>s.compareExperiments({datasetId:e,experimentIdA:t,experimentIdB:r,...n}),enabled:!!e&&!!t&&!!r})},Kln=10,bmt=e=>{const t=st();return CI({queryKey:["dataset-versions",e],queryFn:async({pageParam:r})=>t.listDatasetVersions(e,{page:r,perPage:Kln}),initialPageParam:0,getNextPageParam:(r,n,s)=>{if(r?.pagination?.hasMore)return s+1},select:r=>r.pages.flatMap(n=>n?.versions??[]).map((n,s)=>({id:n.id,datasetId:n.datasetId,version:n.version,createdAt:n.createdAt,isCurrent:s===0})),enabled:!!e})};function Jln(e){if(e==null||e==="")return{parsed:null};const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{return{parsed:JSON.parse(t)}}catch{return{parsed:e,warning:"Could not parse as JSON, keeping as string"}}return{parsed:e}}function ecn(e){const t={},r=[];for(const[n,s]of Object.entries(e)){const a=s==null?null:s===""?"":String(s),i=Jln(a);t[n]=i.parsed,i.warning&&r.push(`${n}: ${i.warning}`)}return{data:t,warnings:r}}const tcn=1e6;function rcn(){const[e,t]=E.useState(!1),[r,n]=E.useState(null);return{parseFile:E.useCallback(async a=>{t(!0),n(null);try{const i=a.size>tcn;return await new Promise((o,l)=>{Cdt.parse(a,{header:!0,skipEmptyLines:"greedy",dynamicTyping:!1,worker:i,complete:u=>{const d=u.meta.fields??[],p=[],f=u.data.map((h,m)=>{const g=ecn(h);return g.warnings.forEach(b=>{p.push(`Row ${m+2}: ${b}`)}),g.data});o({headers:d,data:f,errors:u.errors,warnings:p})},error:u=>{l(new Error(u.message))}})})}catch(i){const o=i instanceof Error?i:new Error("Failed to parse CSV");throw n(o),o}finally{t(!1)}},[]),isParsing:e,error:r}}function g$e(e){const t=fm(e);return vm(t)}function y$e(e){return e.issues.slice(0,5).map(t=>({path:t.path.length>0?"/"+t.path.join("/"):"/",code:t.code,message:t.message}))}function ncn(e,t,r,n=10){if(!t&&!r)return{validCount:e.length,invalidCount:0,validRows:e.map((u,d)=>({rowNumber:d+2,...u})),invalidRows:[],totalRows:e.length};const s=t?g$e(t):null,a=r?g$e(r):null,i=[],o=[];let l=0;for(let u=0;u<e.length;u++){const d=e[u],p=u+2;let f=!0,h=null;if(s){const m=s.safeParse(d.input);m.success||(f=!1,o.length<n&&(h={rowNumber:p,field:"input",errors:y$e(m.error),data:d.input}))}if(f&&a&&d.groundTruth!==void 0){const m=a.safeParse(d.groundTruth);m.success||(f=!1,o.length<n&&(h={rowNumber:p,field:"groundTruth",errors:y$e(m.error),data:d.groundTruth}))}f?i.push({rowNumber:p,...d}):(l++,h&&o.push(h))}return{validCount:i.length,invalidCount:l,validRows:i,invalidRows:o,totalRows:e.length}}function scn(e){const t=[],r=[];if(!Array.isArray(e))return t.push({index:-1,message:"JSON must be an array of items"}),{valid:!1,errors:t,items:r};if(e.length===0)return t.push({index:-1,message:"JSON array must contain at least one item"}),{valid:!1,errors:t,items:r};for(let n=0;n<e.length;n++){const s=e[n],a=n+1;if(typeof s!="object"||s===null||Array.isArray(s)){t.push({index:a,message:`Item ${a} must be an object`});continue}if(!("input"in s)||s.input===void 0||s.input===null){t.push({index:a,message:`Item ${a} is missing required 'input' field`});continue}if(s.input===""){t.push({index:a,message:`Item ${a} has empty 'input' field`});continue}if("metadata"in s&&s.metadata!==void 0&&s.metadata!==null&&(typeof s.metadata!="object"||Array.isArray(s.metadata))){t.push({index:a,message:`Item ${a} has invalid 'metadata' field (must be an object)`});continue}r.push({input:s.input,groundTruth:"groundTruth"in s?s.groundTruth:void 0,metadata:"metadata"in s?s.metadata:void 0})}return{valid:t.length===0,errors:t,items:r}}function acn(){const[e,t]=E.useState(!1),[r,n]=E.useState(null);return{parseFile:E.useCallback(async a=>{t(!0),n(null);try{const i=await a.text();let o;try{o=JSON.parse(i)}catch{throw new Error("Invalid JSON format. Please check your file syntax.")}const l=scn(o);return l.valid?{items:l.items,errors:[],rawData:o}:{items:l.items,errors:l.errors,rawData:o}}catch(i){const o=i instanceof Error?i:new Error("Failed to parse JSON file");throw n(o),o}finally{t(!1)}},[]),isParsing:e,error:r}}function icn(){const[e,t]=E.useState(new Set),[r,n]=E.useState(null),s=E.useCallback((o,l,u)=>{t(d=>{const p=new Set(d);if(l&&r!==null){const f=u.indexOf(r),h=u.indexOf(o);if(f!==-1&&h!==-1){const m=Math.min(f,h),g=Math.max(f,h);for(let b=m;b<=g;b++)p.add(u[b])}}else p.has(o)?p.delete(o):p.add(o);return p}),n(o)},[r]),a=E.useCallback(o=>{t(new Set(o))},[]),i=E.useCallback(()=>{t(new Set),n(null)},[]);return{selectedIds:e,selectedCount:e.size,toggle:s,selectAll:a,clearSelection:i}}function ocn(e,t){const r=e.map(o=>({input:b$e(o.input),groundTruth:b$e(o.groundTruth),createdAt:o.createdAt instanceof Date?o.createdAt.toISOString():String(o.createdAt??"")})),n=Cdt.unparse(r,{quotes:!0,header:!0}),s=new Blob([n],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(s),i=document.createElement("a");i.href=a,i.download=t,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}function b$e(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e)}function lcn(e,t){const r=e.map(o=>({input:o.input,groundTruth:o.groundTruth,metadata:o.metadata,createdAt:o.createdAt instanceof Date?o.createdAt.toISOString():o.createdAt})),n=JSON.stringify(r,null,2),s=new Blob([n],{type:"application/json;charset=utf-8;"}),a=URL.createObjectURL(s),i=document.createElement("a");i.href=a,i.download=t,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a)}const ccn=({row:e})=>{const{Link:t,paths:r}=Yt();return c.jsx(ax,{name:c.jsx(t,{className:"w-full",href:r.datasetLink(e.original.id),children:e.original.name}),description:e.original.description||"No description"})},ucn=[{header:"Name",accessorKey:"name",cell:({row:e})=>c.jsx(ccn,{row:e})},{header:"Version",accessorKey:"version",cell:({row:e})=>c.jsxs(Hs,{children:["v",e.original.version]}),size:150},{header:"Created",accessorKey:"createdAt",cell:({row:e})=>c.jsx(Hs,{children:e.original.createdAt instanceof Date?e.original.createdAt.toLocaleDateString():new Date(e.original.createdAt).toLocaleDateString()}),size:150}];function dcn({onCreateClick:e}){return c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Bc,{iconSlot:c.jsx(BE,{className:"size-10 text-neutral3"}),titleSlot:"No Datasets Yet",descriptionSlot:"Create your first dataset to start evaluating your agents and workflows.",actionSlot:c.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e&&c.jsxs(ye,{size:"lg",variant:"light",onClick:e,children:[c.jsx(ve,{children:c.jsx(Qs,{})}),"Create Dataset"]}),c.jsxs(ye,{size:"lg",variant:"outline",as:"a",href:"https://mastra.ai/docs/observability/datasets/overview",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(ve,{children:c.jsx(lie,{})}),"Documentation"]})]})})})}function pcn({datasets:e,isLoading:t,onCreateClick:r}){const[n,s]=E.useState(""),{navigate:a,paths:i}=Yt(),o=E.useMemo(()=>e,[e]),l=ex({data:o,columns:ucn,getCoreRowModel:Jv()}),u=l.getHeaderGroups()[0],d=l.getRowModel().rows.concat();if(d.length===0&&!t)return c.jsx(dcn,{onCreateClick:r});const p=d.filter(f=>f.original.name.toLowerCase().includes(n.toLowerCase()));return c.jsxs("div",{children:[c.jsx(Sy,{children:c.jsx(ju,{onSearch:s,label:"Search datasets",placeholder:"Search datasets"})}),t?c.jsx(fcn,{}):c.jsx(ix,{children:c.jsxs(Tl,{children:[c.jsx(Al,{className:"sticky top-0",children:u.headers.map(f=>c.jsx(Aa,{style:{width:f.column.getSize()??"auto"},children:Xl(f.column.columnDef.header,f.getContext())},f.id))}),c.jsx(Dl,{children:p.map(f=>c.jsx(Nl,{onClick:()=>a(i.datasetLink(f.original.id)),children:f.getVisibleCells().map(h=>c.jsx(Ee.Fragment,{children:Xl(h.column.columnDef.cell,h.getContext())},h.id))},f.id))})]})})]})}const fcn=()=>c.jsxs(Tl,{children:[c.jsxs(Al,{children:[c.jsx(Aa,{children:"Name"}),c.jsx(Aa,{children:"Version"}),c.jsx(Aa,{children:"Created"})]}),c.jsx(Dl,{children:Array.from({length:3}).map((e,t)=>c.jsxs(Nl,{children:[c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-1/2"})}),c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-20"})}),c.jsx(Hs,{children:c.jsx(Nr,{className:"h-4 w-20"})})]},t))})]});function v$e({label:e,schemaType:t,value:r,onChange:n,error:s,sourceSchema:a,autoPopulate:i=!1}){const o=r!=null,[l,u]=E.useState(()=>r?JSON.stringify(r,null,2):""),[d,p]=E.useState(null),f=E.useRef(!1),h=E.useRef(!1);E.useEffect(()=>{if(h.current){h.current=!1;return}r&&(u(JSON.stringify(r,null,2)),p(null))},[r]),E.useEffect(()=>{f.current=!1},[a]);const m=b=>{b?i&&a&&!f.current?(f.current=!0,n(a)):n({type:"object",properties:{}}):n(null)},g=b=>{u(b);try{const v=JSON.parse(b);typeof v=="object"&&v!==null?(p(null),h.current=!0,n(v)):p("Schema must be a JSON object")}catch{p("Invalid JSON")}};return c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Jl,{checked:o,onCheckedChange:m,id:`${t}-schema-toggle`}),c.jsx("label",{htmlFor:`${t}-schema-toggle`,className:"text-sm font-medium",children:e})]}),o&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(Wa,{value:l,onChange:g,showCopyButton:!1,className:K("h-48 border rounded-md",(d||s)&&"border-destructive")}),d&&c.jsx("p",{className:"text-xs text-destructive",children:d}),s&&!d&&c.jsx("p",{className:"text-xs text-destructive",children:s})]})]})}function hcn(e){const t=st();return ur({queryKey:["workflow-schema",e],queryFn:async()=>{if(!e)throw new Error("No workflow selected");return t.getWorkflow(e).getSchema()},enabled:!!e,staleTime:300*1e3})}const mcn={anyOf:[{type:"string"},{type:"array",items:{type:"object",additionalProperties:!0}}]},x$e={type:"object",properties:{role:{type:"string",enum:["user","assistant","system","tool"]},content:mcn},required:["role","content"]},gcn={$schema:"http://json-schema.org/draft-07/schema#",description:"Agent message input (MessageListInput)",anyOf:[{type:"string",description:"Simple text message"},{type:"array",items:{type:"string"},description:"Array of text messages"},{...x$e,description:"Single message object"},{type:"array",description:"Array of message objects",items:x$e}]},ycn={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:"Agent generate() output",properties:{text:{type:"string",description:"Text response"},object:{description:"Structured output (if any)"},toolCalls:{type:"array",description:"Tool calls made by the agent",items:{type:"object",additionalProperties:!0}},toolResults:{type:"array",description:"Tool execution results",items:{type:"object",additionalProperties:!0}},sources:{type:"array",description:"Sources referenced",items:{type:"object",additionalProperties:!0}},files:{type:"array",description:"Files generated",items:{type:"object",additionalProperties:!0}},usage:{type:"object",description:"Token usage",properties:{promptTokens:{type:"number"},completionTokens:{type:"number"},totalTokens:{type:"number"}}},reasoningText:{type:"string",description:"Reasoning text (if any)"}}};function bcn(){return{inputSchema:gcn,outputSchema:ycn,isLoading:!1,error:null}}const Wre={anyOf:[{type:"string"},{type:"object",description:"Structured content (format 2 with parts)"},{type:"array",description:"Content parts array",items:{type:"object"}}]},Xre={type:"object",properties:{role:{type:"string",enum:["user","assistant","system","tool"]},content:Wre},required:["role","content"]},vcn={type:"object",description:"ScorerRunInputForAgent",properties:{inputMessages:{type:"array",description:"User input messages (MastraDBMessage[])",items:Xre},rememberedMessages:{type:"array",description:"Messages from memory (MastraDBMessage[])",items:Xre},systemMessages:{type:"array",description:"System messages (CoreMessage[])",items:{type:"object",properties:{role:{type:"string",enum:["system"]},content:Wre},required:["role","content"]}},taggedSystemMessages:{type:"object",description:"Tagged system messages (Record<string, CoreSystemMessage[]>)",additionalProperties:{type:"array",items:{type:"object",properties:{role:{type:"string",enum:["system"]},content:Wre},required:["role","content"]}}}},required:["inputMessages","rememberedMessages","systemMessages","taggedSystemMessages"]},xcn={type:"array",description:"ScorerRunOutputForAgent (MastraDBMessage[])",items:Xre},Scn={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:"Scorer input for agent-type scorers (scoringInputSchema)",properties:{runId:{type:"string",description:"Run ID (optional)"},input:vcn,output:xcn,additionalContext:{type:"object",description:"Additional context (optional)",additionalProperties:!0},requestContext:{type:"object",description:"Request context (optional)",additionalProperties:!0}},required:[]},wcn={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:"Scorer input for custom scorers (scoringInputSchema)",properties:{runId:{type:"string",description:"Run ID (optional)"},input:{description:"Input to the entity being scored (any)"},output:{description:"Output from the entity being scored (any)"},additionalContext:{type:"object",description:"Additional context (optional)",additionalProperties:!0},requestContext:{type:"object",description:"Request context (optional)",additionalProperties:!0}},required:[]},Ecn={$schema:"http://json-schema.org/draft-07/schema#",description:"Scorer ground truth (any shape)"};function kcn(){return{agentInputSchema:Scn,customInputSchema:wcn,outputSchema:Ecn,isLoading:!1,error:null}}function vmt({inputSchema:e,outputSchema:t,onChange:r,disabled:n=!1,defaultOpen:s=!1}){const[a,i]=E.useState(s),[o,l]=E.useState("custom"),[u,d]=E.useState(null),[p,f]=E.useState("agent"),{data:h,isLoading:m}=wy(),g=h?Object.entries(h):[],{data:b,isLoading:v}=hcn(o==="workflow"?u:null),S=bcn(),w=kcn(),_=(()=>{switch(o){case"agent":return{inputSchema:S.inputSchema,outputSchema:S.outputSchema};case"workflow":return b?{inputSchema:b.inputSchema??null,outputSchema:b.outputSchema??null}:{inputSchema:null,outputSchema:null};case"scorer":return{inputSchema:p==="agent"?w.agentInputSchema:w.customInputSchema,outputSchema:w.outputSchema};default:return{inputSchema:null,outputSchema:null}}})(),C=o!=="custom",T=E.useRef(null);E.useEffect(()=>{if(o==="custom"||!_.inputSchema&&!_.outputSchema)return;const R=o==="workflow"?`workflow:${u}`:o==="scorer"?`scorer:${p}`:o,$=T.current!==null&&T.current!==R;if(T.current=R,o==="workflow"&&!b)return;const F=e!=null,L=t!=null,z=e&&e.type==="object"&&Object.keys(e.properties||{}).length===0,q=t&&t.type==="object"&&Object.keys(t.properties||{}).length===0,H=_.inputSchema&&F&&($||z),V=_.outputSchema&&L&&($||q);(H||V)&&r({inputSchema:H?_.inputSchema:e??null,outputSchema:V?_.outputSchema:t??null})},[o,u,b,p]);const A=R=>{r({inputSchema:R,outputSchema:t??null})},N=R=>{r({inputSchema:e??null,outputSchema:R})},I=R=>{l(R),R!=="workflow"&&d(null)};return c.jsxs(CO,{open:a,onOpenChange:i,children:[c.jsxs(oS,{className:"flex items-center gap-2 text-sm font-medium text-neutral4 hover:text-neutral5 w-full py-2",children:[c.jsx(Hi,{className:"w-4 h-4"}),"Schema Configuration (Optional)"]}),c.jsxs(lS,{className:"pt-4 space-y-4",children:[c.jsxs(Cp,{variant:"info",children:[c.jsx(Tp,{children:"JSON Schema Format"}),c.jsxs(sy,{as:"p",children:["Schemas use"," ",c.jsx("a",{href:"https://json-schema.org/",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-accent5Lighter",children:"JSON Schema"})," ","for validation and type checking."]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-sm font-medium text-neutral4",children:"Import From"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(Ro,{value:o,onValueChange:R=>I(R),disabled:n,children:[c.jsx(go,{size:"sm",className:"w-40",children:c.jsx(Po,{})}),c.jsxs(yo,{children:[c.jsx(Ms,{value:"custom",children:"Custom"}),c.jsx(Ms,{value:"agent",children:"Agent"}),c.jsx(Ms,{value:"workflow",children:"Workflow"}),c.jsx(Ms,{value:"scorer",children:"Scorer"})]})]}),o==="workflow"&&c.jsxs(Ro,{value:u??"",onValueChange:d,disabled:n,children:[c.jsx(go,{size:"sm",className:"w-48",children:c.jsx(Po,{placeholder:"Select workflow..."})}),c.jsx(yo,{children:m?c.jsx(Ms,{value:"__loading__",disabled:!0,children:"Loading..."}):g.length===0?c.jsx(Ms,{value:"__empty__",disabled:!0,children:"No workflows"}):g.map(([R,$])=>c.jsx(Ms,{value:R,children:$.name||R},R))})]}),o==="workflow"&&u&&v&&c.jsx("span",{className:"text-xs text-neutral3",children:"Loading schema..."}),o==="scorer"&&c.jsxs(Ro,{value:p,onValueChange:R=>f(R),disabled:n,children:[c.jsx(go,{size:"sm",className:"w-32",children:c.jsx(Po,{})}),c.jsxs(yo,{children:[c.jsx(Ms,{value:"agent",children:"Agent"}),c.jsx(Ms,{value:"custom",children:"Custom"})]})]})]}),o==="scorer"&&c.jsx("p",{className:"text-xs text-neutral3",children:p==="agent"?"For calibrating agent-type scorers":"For calibrating custom scorers (input/output as any)"})]}),c.jsx(v$e,{label:"Input Schema",schemaType:"input",value:e,onChange:A,sourceSchema:C?_.inputSchema:void 0,autoPopulate:C}),c.jsx(v$e,{label:"Ground Truth Schema",schemaType:"output",value:t,onChange:N,sourceSchema:C?_.outputSchema:void 0,autoPopulate:C})]})]})}function Ocn({open:e,onOpenChange:t,onSuccess:r}){const[n,s]=E.useState(""),[a,i]=E.useState(""),[o,l]=E.useState(null),[u,d]=E.useState(null),{createDataset:p}=Ru(),f=g=>{l(g.inputSchema),d(g.outputSchema)},h=async g=>{if(g.preventDefault(),!n.trim()){Xe.error("Dataset name is required");return}try{const b=await p.mutateAsync({name:n.trim(),description:a.trim()||void 0,inputSchema:o,groundTruthSchema:u});Xe.success("Dataset created successfully"),s(""),i(""),l(null),d(null),t(!1),r?.(b.id)}catch(b){Xe.error(`Failed to create dataset: ${b instanceof Error?b.message:"Unknown error"}`)}},m=()=>{s(""),i(""),l(null),d(null),t(!1)};return c.jsx(ea,{open:e,onOpenChange:t,children:c.jsxs(Ls,{className:"max-w-2xl",children:[c.jsx(ta,{children:c.jsx(Fs,{children:"Create Dataset"})}),c.jsx(ra,{className:"max-h-[70vh] overflow-y-auto",children:c.jsxs("form",{onSubmit:h,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-name",children:"Name *"}),c.jsx(qr,{id:"dataset-name",value:n,onChange:g=>s(g.target.value),placeholder:"Enter dataset name",autoFocus:!0})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-description",children:"Description"}),c.jsx(qr,{id:"dataset-description",value:a,onChange:g=>i(g.target.value),placeholder:"Enter dataset description (optional)"})]}),c.jsx(vmt,{inputSchema:o,outputSchema:u,onChange:f,disabled:p.isPending}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[c.jsx(ye,{type:"button",variant:"standard",size:"default",onClick:m,children:"Cancel"}),c.jsx(ye,{type:"submit",variant:"cta",size:"default",disabled:p.isPending||!n.trim(),children:p.isPending?"Creating...":"Create Dataset"})]})]})})]})})}function _cn({open:e,onOpenChange:t,items:r,onSuccess:n}){const[s,a]=E.useState(""),[i,o]=E.useState(""),[l,u]=E.useState(!1),[d,p]=E.useState(0),{createDataset:f,addItem:h}=Ru(),m=async v=>{if(v.preventDefault(),!s.trim()){Xe.error("Dataset name is required");return}u(!0),p(0);try{const S=await f.mutateAsync({name:s.trim(),description:i.trim()||void 0});for(let w=0;w<r.length;w++){const k=r[w];await h.mutateAsync({datasetId:S.id,input:k.input,groundTruth:k.groundTruth,metadata:k.metadata}),p(w+1)}Xe.success(`Dataset created with ${r.length} items`),a(""),o(""),u(!1),p(0),t(!1),n?.(S.id)}catch(S){Xe.error(`Failed to create dataset: ${S instanceof Error?S.message:"Unknown error"}`),u(!1),p(0)}},g=()=>{l||(a(""),o(""),t(!1))},b=r.length>0?d/r.length*100:0;return c.jsx(ea,{open:e,onOpenChange:l?void 0:t,children:c.jsxs(Ls,{className:"max-w-md",children:[c.jsx(ta,{children:c.jsx(Fs,{children:"Create Dataset from Items"})}),c.jsx(ra,{children:c.jsxs("form",{onSubmit:m,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-name",children:"Name *"}),c.jsx(qr,{id:"dataset-name",value:s,onChange:v=>a(v.target.value),placeholder:"Enter dataset name",autoFocus:!0,disabled:l})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-description",children:"Description"}),c.jsx(qr,{id:"dataset-description",value:i,onChange:v=>o(v.target.value),placeholder:"Enter dataset description (optional)",disabled:l})]}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.length," item",r.length!==1?"s":""," will be copied to the new dataset"]}),l&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:c.jsx("div",{className:"h-full bg-primary transition-all duration-200",style:{width:`${b}%`}})}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Copying items: ",d," / ",r.length]})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[c.jsx(ye,{type:"button",variant:"standard",size:"default",onClick:g,disabled:l,children:"Cancel"}),c.jsx(ye,{type:"submit",variant:"cta",size:"default",disabled:l||!s.trim(),children:l?`Creating... (${d}/${r.length})`:"Create Dataset"})]})]})})]})})}function Ccn({open:e,onOpenChange:t,items:r,currentDatasetId:n,onSuccess:s}){const[a,i]=E.useState(""),[o,l]=E.useState(!1),[u,d]=E.useState(0),{data:p,isLoading:f}=Y6(),{addItem:h}=Ru(),m=p?.datasets??[],g=m.filter(w=>w.id!==n),b=async w=>{if(w.preventDefault(),!a){Xe.error("Please select a dataset");return}l(!0),d(0);try{for(let _=0;_<r.length;_++){const C=r[_];await h.mutateAsync({datasetId:a,input:C.input,groundTruth:C.groundTruth,metadata:C.metadata}),d(_+1)}const k=m.find(_=>_.id===a);Xe.success(`Added ${r.length} item${r.length!==1?"s":""} to "${k?.name}"`),i(""),l(!1),d(0),t(!1),s?.(a)}catch(k){Xe.error(`Failed to add items: ${k instanceof Error?k.message:"Unknown error"}`),l(!1),d(0)}},v=()=>{o||(i(""),t(!1))},S=r.length>0?u/r.length*100:0;return c.jsx(ea,{open:e,onOpenChange:o?void 0:t,children:c.jsxs(Ls,{className:"max-w-md",children:[c.jsx(ta,{children:c.jsx(Fs,{children:"Add Items to Dataset"})}),c.jsx(ra,{children:c.jsxs("form",{onSubmit:b,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"target-dataset",children:"Target Dataset *"}),c.jsxs(Ro,{value:a,onValueChange:i,disabled:o||f,children:[c.jsx(go,{id:"target-dataset",children:c.jsx(Po,{placeholder:f?"Loading datasets...":"Select a dataset"})}),c.jsx(yo,{children:g.length===0?c.jsx("div",{className:"px-2 py-4 text-sm text-neutral4 text-center",children:"No other datasets available"}):g.map(w=>c.jsx(Ms,{value:w.id,children:w.name},w.id))})]})]}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.length," item",r.length!==1?"s":""," will be copied to the selected dataset"]}),o&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:c.jsx("div",{className:"h-full bg-primary transition-all duration-200",style:{width:`${S}%`}})}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Adding items: ",u," / ",r.length]})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[c.jsx(ye,{type:"button",variant:"standard",size:"default",onClick:v,disabled:o,children:"Cancel"}),c.jsx(ye,{type:"submit",variant:"cta",size:"default",disabled:o||!a||g.length===0,children:o?`Adding... (${u}/${r.length})`:"Add Items"})]})]})})]})})}function Tcn({open:e,onOpenChange:t,sourceDatasetId:r,sourceDatasetName:n,sourceDatasetDescription:s,onSuccess:a}){const[i,o]=E.useState(""),[l,u]=E.useState(""),[d,p]=E.useState(!1),[f,h]=E.useState({phase:"idle",current:0,total:0}),m=st(),{createDataset:g,addItem:b}=Ru();E.useEffect(()=>{e&&(o(`${n} (Copy)`),u(s||""))},[e,n,s]);const v=async _=>{if(_.preventDefault(),!i.trim()){Xe.error("Dataset name is required");return}p(!0),h({phase:"fetching",current:0,total:0});try{const C=[];let T=0;const A=100;let N=!0;for(;N;){const R=await m.listDatasetItems(r,{page:T,perPage:A}),$=R.items||[];C.push(...$.map(L=>({input:L.input,groundTruth:L.groundTruth,metadata:L.metadata}))),h({phase:"fetching",current:C.length,total:R.pagination?.total||C.length});const F=(T+1)*A;N=$.length>0&&F<(R.pagination?.total||0),T++}h({phase:"creating",current:0,total:C.length});const I=await g.mutateAsync({name:i.trim(),description:l.trim()||void 0});h({phase:"copying",current:0,total:C.length});for(let R=0;R<C.length;R++){const $=C[R];await b.mutateAsync({datasetId:I.id,input:$.input,groundTruth:$.groundTruth,metadata:$.metadata}),h({phase:"copying",current:R+1,total:C.length})}Xe.success(`Dataset duplicated with ${C.length} items`),o(""),u(""),p(!1),h({phase:"idle",current:0,total:0}),t(!1),a?.(I.id)}catch(C){Xe.error(`Failed to duplicate dataset: ${C instanceof Error?C.message:"Unknown error"}`),p(!1),h({phase:"idle",current:0,total:0})}},S=()=>{d||(o(""),u(""),t(!1))},w=()=>{switch(f.phase){case"fetching":return`Fetching items: ${f.current}${f.total>0?` / ${f.total}`:""}`;case"creating":return"Creating dataset...";case"copying":return`Copying items: ${f.current} / ${f.total}`;default:return""}},k=f.total>0?f.current/f.total*100:0;return c.jsx(ea,{open:e,onOpenChange:d?void 0:t,children:c.jsxs(Ls,{className:"max-w-md",children:[c.jsx(ta,{children:c.jsx(Fs,{children:"Duplicate Dataset"})}),c.jsx(ra,{children:c.jsxs("form",{onSubmit:v,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-name",children:"Name *"}),c.jsx(qr,{id:"dataset-name",value:i,onChange:_=>o(_.target.value),placeholder:"Enter dataset name",autoFocus:!0,disabled:d})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"dataset-description",children:"Description"}),c.jsx(qr,{id:"dataset-description",value:l,onChange:_=>u(_.target.value),placeholder:"Enter dataset description (optional)",disabled:d})]}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:['All items from "',n,'" will be copied to the new dataset']}),d&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:c.jsx("div",{className:"h-full bg-primary transition-all duration-200",style:{width:`${k}%`}})}),c.jsx("p",{className:"text-sm text-muted-foreground",children:w()})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[c.jsx(ye,{type:"button",variant:"standard",size:"default",onClick:S,disabled:d,children:"Cancel"}),c.jsx(ye,{type:"submit",variant:"cta",size:"default",disabled:d||!i.trim(),children:d?"Duplicating...":"Duplicate Dataset"})]})]})})]})})}function Acn({open:e,onOpenChange:t,dataset:r,onSuccess:n}){const[s,a]=E.useState(r.name),[i,o]=E.useState(r.description??""),[l,u]=E.useState(r.inputSchema??null),[d,p]=E.useState(r.groundTruthSchema??null),[f,h]=E.useState(null),{updateDataset:m}=Ru();E.useEffect(()=>{e&&(a(r.name),o(r.description??""),u(r.inputSchema??null),p(r.groundTruthSchema??null),h(null))},[e]);const g=S=>{u(S.inputSchema),p(S.outputSchema),h(null)},b=async S=>{if(S.preventDefault(),h(null),!s.trim()){Xe.error("Dataset name is required");return}try{await m.mutateAsync({datasetId:r.id,name:s.trim(),description:i.trim()||void 0,inputSchema:l,groundTruthSchema:d}),Xe.success("Dataset updated successfully"),t(!1),n?.()}catch(w){const k=w?.body;if(Array.isArray(k?.cause?.failingItems)&&k.cause.failingItems.length>0){const _=k.cause.failingItems.length;h(`${_} existing item(s) fail validation. Fix items or adjust schema.`)}else{const _=w;Xe.error(`Failed to update dataset: ${_?.message||"Unknown error"}`)}}},v=()=>{a(r.name),o(r.description??""),u(r.inputSchema??null),p(r.groundTruthSchema??null),h(null),t(!1)};return c.jsx(ea,{open:e,onOpenChange:t,children:c.jsxs(Ls,{className:"max-w-2xl",children:[c.jsx(ta,{children:c.jsx(Fs,{children:"Edit Dataset"})}),c.jsx(ra,{className:"max-h-[70vh] overflow-y-auto",children:c.jsxs("form",{onSubmit:b,className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"edit-dataset-name",children:"Name *"}),c.jsx(qr,{id:"edit-dataset-name",value:s,onChange:S=>a(S.target.value),placeholder:"Enter dataset name",autoFocus:!0})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{htmlFor:"edit-dataset-description",children:"Description"}),c.jsx(qr,{id:"edit-dataset-description",value:i,onChange:S=>o(S.target.value),placeholder:"Enter dataset description (optional)"})]}),c.jsx(vmt,{inputSchema:l,outputSchema:d,onChange:g,disabled:m.isPending,defaultOpen:!!(r.inputSchema||r.groundTruthSchema)}),f&&c.jsx("div",{className:"p-3 bg-red-950/20 border border-red-900/50 rounded-md",children:c.jsx("p",{className:"text-sm text-red-200",children:f})}),c.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[c.jsx(ye,{type:"button",variant:"standard",size:"default",onClick:v,children:"Cancel"}),c.jsx(ye,{type:"submit",variant:"cta",size:"default",disabled:m.isPending||!s.trim(),children:m.isPending?"Saving...":"Save Changes"})]})]})})]})})}function Dcn({open:e,onOpenChange:t,datasetId:r,datasetName:n,onSuccess:s}){const{deleteDataset:a}=Ru(),i=async()=>{try{await a.mutateAsync(r),Xe.success("Dataset deleted successfully"),t(!1),s?.()}catch(o){Xe.error(`Failed to delete dataset: ${o instanceof Error?o.message:"Unknown error"}`)}};return c.jsx(qt,{open:e,onOpenChange:t,children:c.jsxs(qt.Content,{children:[c.jsxs(qt.Header,{children:[c.jsx(qt.Title,{children:"Delete Dataset"}),c.jsxs(qt.Description,{children:['Are you sure you want to delete "',n,'"? This will permanently delete the dataset, all its items, and run history. This action cannot be undone.']})]}),c.jsxs(qt.Footer,{children:[c.jsx(qt.Action,{onClick:i,disabled:a.isPending,children:a.isPending?"Deleting...":"Delete"}),c.jsx(qt.Cancel,{children:"Cancel"})]})]})})}function Ncn({value:e,onValueChange:t,placeholder:r="Select a dataset...",searchPlaceholder:n="Search datasets...",emptyText:s="No datasets found.",className:a,disabled:i=!1,variant:o="default"}){const{data:l,isLoading:u,isError:d,error:p}=Y6(),{navigate:f,paths:h}=Yt();E.useEffect(()=>{if(d){const v=p instanceof Error?p.message:"Failed to load datasets";Xe.error(`Error loading datasets: ${v}`)}},[d,p]);const g=(l?.datasets??[]).map(v=>({label:v.name,value:v.id})),b=v=>{t?t(v):v&&v!==e&&f(h.datasetLink(v))};return c.jsx(Cu,{options:g,value:e,onValueChange:b,placeholder:u?"Loading datasets...":r,searchPlaceholder:n,emptyText:s,className:a,disabled:i||u||d,variant:o})}function Icn({children:e,className:t}){return c.jsx("div",{className:K("grid grid-rows-[auto_1fr] overflow-y-auto",t),children:e})}function mfe(e){return!e||e.length===0?"":e?.map(t=>t.size).join(" ")}function jcn({columns:e,isSelectionActive:t,children:r}){return c.jsx("div",{className:K("sticky top-0 bg-surface3 z-10 rounded-lg px-4 mb-4"),children:c.jsx("div",{className:K("grid gap-4 text-left items-center uppercase text-neutral3 tracking-widest text-ui-xs",{"pl-12 [&>label]:absolute [&>label]:left-0":t}),style:{gridTemplateColumns:mfe(e)},children:r})})}function Rcn({children:e,className:t}){return c.jsx("span",{className:K("py-3",t),children:e})}function Pcn({children:e}){return c.jsx("ul",{className:"grid content-start",children:e})}function $cn({isSelected:e,children:t,columns:r}){return c.jsx("li",{className:K("flex border border-transparent py-[3px] pb-[2px] text-neutral5 border-t-border1 rounded-lg first:border-t-transparent text-ui-md overflow-hidden","[&:last-child>button]:rounded-b-lg","[&.selected-row]:border-white/50 [&.selected-row]:pr-[3px] [&.selected-row]:border-dashed [&.selected-row]:border [&.selected-row]:first:border-t","[&:has(+.selected-row)]:rounded-b-none [&:has(+.selected-row)]:border-b-transparent","[.selected-row+&]:rounded-t-none",Wr.colors,{"selected-row":e,"grid px-4 gap-4 ":r}),style:{gridTemplateColumns:mfe(r)},children:t})}function Mcn({item:e,isFeatured:t,onClick:r,children:n,columns:s,className:a,disabled:i}){const o=()=>{r?.(e?.id)};return c.jsx("button",{onClick:o,className:K("grid w-full px-4 gap-4 text-left items-center rounded-lg",Wr.colors,nx.visible,{"bg-surface4":t,"hover:bg-surface4":e&&!t&&!i},a),style:{gridTemplateColumns:mfe(s)},disabled:i,children:n})}function Lcn({children:e,message:t,className:r,type:n}){return!e&&!t?null:c.jsx("div",{className:K("grid border-t border-border1",r),children:t?c.jsxs("p",{className:K("text-neutral3 text-ui-md text-center grid p-8 justify-center justify-items-center gap-2","[&>svg]:w-[1.5em] [&>svg]:h-[1.5em] [&>svg]:opacity-75",{"[&>svg]:text-red-500":n==="error"}),children:[n==="error"?c.jsx(Pc,{}):c.jsx(Ac,{})," ",t]}):e})}function Fcn({isLoading:e,hasMore:t,setEndOfListElement:r,loadingText:n="Loading more data...",noMoreDataText:s="No more data to load"}){return r?c.jsxs("div",{ref:r,className:"text-ui-md text-neutral3 opacity-50 flex mt-8 justify-center",children:[e&&n,!t&&!e&&s]}):null}function Bcn({currentPage:e,hasMore:t,onNextPage:r,onPrevPage:n}){const s=typeof e=="number"&&e>0||t;return c.jsxs("div",{className:K("flex pt-6 items-center justify-center text-neutral3 text-ui-md gap-8"),children:[c.jsxs("span",{children:["Page ",c.jsx("b",{children:e?e+1:"1"})]}),s&&c.jsxs("div",{className:K("flex gap-4","[&>button]:flex [&>button]:items-center [&>button]:gap-2 [&>button]:text-neutral4 [&>button:hover]:text-neutral5 [&>button]:transition-colors [&>button]:border [&>button]:border-border1 [&>button]:p-1 [&>button]:px-2 [&>button]:rounded-md","[&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:text-neutral3"),children:[typeof e=="number"&&e>0&&c.jsxs("button",{onClick:n,children:[c.jsx(KN,{}),"Previous"]}),t&&c.jsxs("button",{onClick:r,children:["Next",c.jsx(Wh,{})]})]})]})}function zcn({children:e}){const t=E.useRef(null);return c.jsx("div",{ref:t,className:K("overflow-y-auto"),children:e})}function xmt({children:e,className:t}){return c.jsx("div",{className:K("",t),children:e})}function Ucn({children:e,isLoading:t,className:r}){return c.jsx("div",{className:K("text-neutral4 py-[0.6rem] text-ui-md truncate",r),children:t?c.jsx("div",{className:"bg-surface4 rounded-md animate-pulse text-transparent h-[1rem] select-none"}):e})}function Vcn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qcn({status:e}){return e?c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx("div",{className:K("flex items-center justify-center w-10 relative bg-transparent h-full"),children:c.jsx("div",{className:K("w-[0.5rem] h-[0.5rem] rounded-full",{"bg-green-600":["success","completed"].includes(e),"bg-red-700":["error","failed"].includes(e),"bg-yellow-500":["pending","running"].includes(e)})})})}),c.jsx(sn,{children:Vcn(e)})]}):null}const Hcn={small:"text-[11px] pt-[5px] pb-[4px]",default:"text-[12px] pt-[5px] pb-[4px] ",large:"text-[13px] pt-[5px] pb-[4px] "},Qcn={gray:{bright:"bg-neutral-700",muted:"bg-neutral-700/80"},red:{bright:"bg-red-900",muted:"bg-red-900/80"},orange:{bright:"bg-yellow-900",muted:"bg-yellow-900/80"},blue:{bright:"bg-blue-800",muted:"bg-blue-800/80"},green:{bright:"bg-green-900",muted:"bg-green-900/80"},purple:{bright:"bg-purple-900",muted:"bg-purple-900/80"},yellow:{bright:"bg-yellow-700",muted:"bg-yellow-700/80"},cyan:{bright:"bg-cyan-900",muted:"bg-cyan-900/80"},pink:{bright:"bg-pink-900",muted:"bg-pink-900/80"}},Gcn={bright:"text-neutral4",muted:"text-neutral3"},fo=({color:e="gray",size:t="default",intensity:r="bright",className:n,children:s,...a})=>c.jsx("span",{className:K("inline-flex items-center rounded-md uppercase px-[0.5em] gap-[0.4em] tracking-wide font-normal","[&>svg]:w-[1em] [&>svg]:h-[1em] [&>svg]:translate-y-[-0.02em] [&>svg]:mx-[-0.2em]","[&>svg]:opacity-50 [&>svg:first-child:last-child]:opacity-100",Hcn[t],Qcn[e][r],Gcn[r],n),style:{lineHeight:1},...a,children:s});function S$e({children:e,className:t}){return c.jsx("div",{className:K("flex gap-[1px] items-center [&>*:not(:last-child)]:rounded-r-none [&>*:not(:first-child)]:rounded-l-none",t),children:e})}function Zcn({version:e,date:t,isLatest:r,isDeleted:n}){return c.jsxs(xmt,{className:K("grid grid-cols-[1fr_auto] pl-1"),children:[c.jsxs("div",{className:K("grid text-neutral3 gap-1 leading-none",{"text-neutral4":r}),children:[c.jsxs("strong",{className:"font-normal",children:["v. ",e]}),c.jsx("em",{className:"text-neutral2 text-ui-sm font-normal",children:t?vn(new Date(t),"MMM d, yyyy HH:mm"):null})]}),(r||n)&&c.jsxs("div",{className:"flex gap-1 items-center",children:[r&&c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx(fo,{color:"blue",children:c.jsx(hL,{})})}),c.jsx(sn,{children:"Latest version"})]}),n&&c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsx(fo,{color:"red",children:c.jsx(oie,{})})}),c.jsx(sn,{children:"Deleted in this version"})]})]})]})}function Wcn({id:e,className:t,isShortened:r=!0}){const n=r?e.slice(0,8):e;return c.jsx("div",{className:K("text-neutral2 py-[0.6rem] text-ui-md truncate",t),children:n})}function Xcn({date:e,className:t,withTime:r=!1}){const n=e?fAr(new Date(e)):!1,s=e?UF(new Date(e))?"Today":vn(new Date(e),"MMM dd"):"",a=e&&!n?vn(new Date(e),"yyyy"):"",i=e&&r?`${vn(new Date(e),"'at' h:mm aaa")}`:"";return c.jsxs("div",{className:K("text-neutral2 text-ui-md truncate",t),children:[s," ",a," ",i]})}function Ycn({children:e,href:t,className:r}){const{Link:n}=Yt();return c.jsx(n,{href:t,className:K("w-full px-3 py-[0.6rem] gap-6 text-left items-center rounded-lg flex justify-center","hover:bg-surface4",Wr.colors,nx.visible,r),children:e})}function Kcn({children:e,className:t}){return c.jsx("label",{className:K("flex w-14 h-full justify-center items-center hover:bg-surface5 rounded-lg",t),children:e})}const We=Object.assign(Icn,{Header:jcn,HeaderCol:Rcn,Items:Pcn,Scroller:zcn,Row:$cn,RowButton:Mcn,Message:Lcn,NextPageLoading:Fcn,Pagination:Bcn,Cell:xmt,TextCell:Ucn,StatusCell:qcn,VersionCell:Zcn,IdCell:Wcn,DateCell:Xcn,LinkCell:Ycn,LabelCell:Kcn});function w$e(e,t=100){if(e==null)return"-";const r=typeof e=="string"?e:JSON.stringify(e);return!r||r.length<=t?r||"-":r.slice(0,t)+"..."}function Jcn({items:e,isLoading:t,onItemClick:r,featuredItemId:n,setEndOfListElement:s,isFetchingNextPage:a,hasNextPage:i,columns:o=[],searchQuery:l,isSelectionActive:u,selectedIds:d,onToggleSelection:p,onSelectAll:f,onClearSelection:h,maxSelection:m,onAddClick:g,onImportClick:b,onImportJsonClick:v}){if(e.length===0&&!l&&!t)return c.jsx(eun,{onAddClick:g,onImportClick:b,onImportJsonClick:v});const S=e.map(N=>N.id),w=d.size,k=e.length>0&&w===e.length,_=w>0&&w<e.length,C=()=>{k?h():f(S)},T=(N,I,R)=>{if(m&&!d.has(N)&&d.size>=m){const[$]=Array.from(d);f([$,N]);return}p(N,I,R)},A=N=>{r?.(N)};return c.jsx(We,{children:c.jsxs(We.Scroller,{children:[c.jsxs(We.Header,{columns:o,isSelectionActive:u,children:[u&&!m&&c.jsx(We.LabelCell,{children:c.jsx(Fp,{checked:_?"indeterminate":k,onCheckedChange:C,"aria-label":"Select all items"})}),o?.map(N=>c.jsx(We.HeaderCol,{children:N.label||N.name},N.name))]}),c.jsx(We.Items,{children:e.length===0&&l?c.jsx("div",{className:"flex items-center justify-center py-12 text-neutral4",children:"No items match your search"}):e.map(N=>{const I=new Date(N.createdAt),R={id:N.id,input:w$e(N.input,60),groundTruth:N.groundTruth?w$e(N.groundTruth,40):"-",metadata:N.metadata?Object.keys(N.metadata).length+" keys":"-",date:I};return c.jsxs(We.Row,{isSelected:d.has(N.id),children:[u&&c.jsx(We.LabelCell,{children:c.jsx(Fp,{checked:d.has(N.id),onCheckedChange:()=>{},onClick:$=>{$.stopPropagation(),T(N.id,$.shiftKey,S)},"aria-label":`Select item ${N.id}`})}),c.jsxs(We.RowButton,{item:R,isFeatured:n===N.id,columns:o,onClick:A,children:[c.jsx(We.IdCell,{id:R.id}),c.jsx(We.TextCell,{className:"font-mono",children:R.input}),o.some($=>$.name==="groundTruth")&&c.jsx(We.TextCell,{className:"font-mono",children:R.groundTruth}),c.jsx(We.DateCell,{date:R.date,withTime:!0})]})]},N.id)})}),c.jsx(We.NextPageLoading,{setEndOfListElement:s,loadingText:"Loading more items...",noMoreDataText:"All items loaded",isLoading:a,hasMore:i})]})})}function eun({onAddClick:e,onImportClick:t,onImportJsonClick:r}){return c.jsx("div",{className:"flex h-full items-center justify-center py-12",children:c.jsx(Bc,{iconSlot:c.jsx(Qs,{className:"w-8 h-8 text-neutral3"}),titleSlot:"No items yet",descriptionSlot:"Add items to this dataset to use them in experiment runs.",actionSlot:c.jsx("div",{className:"flex flex-col gap-2",children:c.jsxs(Xo,{spacing:"close",children:[c.jsxs(ye,{size:"default",variant:"standard",onClick:e,children:[c.jsx(Qs,{}),"Add Single Item"]}),t&&c.jsxs(ye,{size:"default",variant:"standard",onClick:t,children:[c.jsx(xL,{}),"Import CSV"]}),r&&c.jsxs(ye,{size:"default",variant:"standard",onClick:r,children:[c.jsx(eI,{}),"Import JSON"]})]})})})})}function tun({children:e,className:t,withLeftSeparator:r,withRightSeparator:n}){return c.jsxs("div",{className:"flex overflow-y-auto w-full",children:[r&&c.jsx(E$e,{}),c.jsx("div",{className:K("grid gap-8 content-start w-full overflow-y-auto",t),children:e}),n&&c.jsx(E$e,{})]})}function E$e(){return c.jsx("div",{className:K("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})}function run({children:e,className:t}){return c.jsx("div",{className:K("grid overflow-y-auto gap-8 content-start",t),children:e})}function nun({children:e,className:t}){return c.jsx("div",{className:K("flex items-center justify-between w-full flex-wrap gap-4 gap-x-6",t),children:e})}const Un=Object.assign(tun,{Content:run,Toolbar:nun});function sun({onExportClick:e,onExportJsonClick:t,onCreateDatasetClick:r,onAddToDatasetClick:n,onDeleteClick:s,onCompareClick:a}){return c.jsxs(cn,{children:[c.jsx(cn.Trigger,{asChild:!0,children:c.jsxs(ye,{variant:"standard",size:"default","aria-label":"Actions menu",children:["Select ",c.jsx(_At,{})]})}),c.jsxs(cn.Content,{align:"end",className:"w-72",children:[c.jsxs(cn.Item,{onSelect:a,children:[c.jsx(pA,{}),c.jsx("span",{children:"Compare Items"})]}),c.jsx(cn.Separator,{}),c.jsxs(cn.Item,{onSelect:e,children:[c.jsx(Yw,{}),c.jsx("span",{children:"Export Items as CSV"})]}),c.jsxs(cn.Item,{onSelect:t,children:[c.jsx(Yw,{}),c.jsx("span",{children:"Export Items as JSON"})]}),c.jsx(cn.Separator,{}),c.jsxs(cn.Item,{onSelect:r,children:[c.jsx(gL,{}),c.jsx("span",{children:"Create Dataset from Items"})]}),c.jsxs(cn.Item,{onSelect:n,children:[c.jsx(pNt,{}),c.jsx("span",{children:"Copy Items to Dataset"})]}),c.jsx(cn.Separator,{}),c.jsxs(cn.Item,{onSelect:s,className:"text-red-500 focus:text-red-400",children:[c.jsx(Fv,{}),c.jsx("span",{children:"Delete Items"})]})]})]})}function aun({onAddClick:e,onImportClick:t,onImportJsonClick:r,onExportClick:n,onExportJsonClick:s,onCreateDatasetClick:a,onAddToDatasetClick:i,onDeleteClick:o,onCompareClick:l,hasItems:u,searchQuery:d,isSelectionActive:p,onSearchChange:f,selectedCount:h,onExecuteAction:m,onCancelSelection:g,selectionMode:b,onVersionsClick:v,isItemPanelOpen:S,isVersionsPanelOpen:w,isViewingOldVersion:k}){return p?c.jsxs(Un.Toolbar,{className:"",children:[c.jsx(sN,{label:"Search",placeholder:"Search items...",value:d??"",onChange:_=>f?.(_.target.value),variant:"experimental",size:"default",onReset:()=>f?.(""),disabled:!u&&!d}),c.jsxs("div",{className:"flex gap-5",children:[c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsxs("div",{className:"text-sm text-neutral3 flex items-center gap-2",children:[c.jsx(fo,{size:"large",color:b==="compare-items"&&h<2||h===0?"red":"green",children:h}),c.jsx("span",{children:b==="compare-items"?"of 2 items selected":"items selected"}),c.jsx(fie,{})]})}),(b==="compare-items"&&h<2||h===0)&&c.jsx(sn,{children:b==="compare-items"?h<=2?"Select 2 items to compare":void 0:h===0?"Select at least one item":void 0})]}),c.jsxs(Xo,{children:[c.jsxs(ye,{variant:"cta",size:"default",disabled:b==="compare-items"?h!==2:h===0,onClick:m,children:[b==="compare-items"&&"Compare Items",b==="export"&&"Export Items as CSV",b==="export-json"&&"Export Items as JSON",b==="create-dataset"&&"Create a new Dataset with Items",b==="add-to-dataset"&&"Add Items to a Dataset",b==="delete"&&"Delete Items"]}),c.jsx(ye,{variant:"standard",size:"default",onClick:g,children:"Cancel"})]})]})]}):c.jsxs("div",{className:"flex items-center justify-between gap-4 w-full",children:[c.jsx(sN,{label:"Search",placeholder:"Search items...",value:d??"",onChange:_=>f?.(_.target.value),variant:"experimental",size:"default",onReset:()=>f?.(""),disabled:!u&&!d}),c.jsxs(Xo,{children:[!S&&!k&&c.jsxs(Xo,{spacing:"close",children:[c.jsxs(ye,{variant:"standard",size:"default",onClick:e,children:[c.jsx(Qs,{})," Add Item"]}),c.jsxs(cn,{children:[c.jsx(cn.Trigger,{asChild:!0,children:c.jsx(ye,{variant:"standard",size:"default","aria-label":"Dataset actions menu",children:c.jsx($a,{})})}),c.jsxs(cn.Content,{align:"end",children:[c.jsxs(cn.Item,{onSelect:t,children:[c.jsx(xL,{})," Import CSV"]}),c.jsxs(cn.Item,{onSelect:r,children:[c.jsx(eI,{})," Import JSON"]})]})]})]}),u&&!k&&c.jsx(sun,{onExportClick:n,onExportJsonClick:s,onCreateDatasetClick:a,onAddToDatasetClick:i,onDeleteClick:o,onCompareClick:l}),!S&&!w&&c.jsxs(ye,{variant:"standard",size:"default",onClick:v,"aria-label":"View versions",children:[c.jsx(bL,{className:"w-4 h-4"}),"Versions"]})]})]})}function lx({children:e,className:t}){return c.jsx("div",{className:K("grid w-full h-full grid-cols-1 overflow-y-auto",t),children:e})}function iun({children:e,numOfColumns:t=1,minColumnWidth:r}){const n=E.useRef(null),[s,a]=E.useState(!1),[i,o]=E.useState(!1),l=E.useCallback(()=>{const p=n.current;if(!p)return;const{scrollLeft:f,scrollWidth:h,clientWidth:m}=p;a(f>1),o(f+m<h-1)},[]);E.useEffect(()=>{const p=n.current;if(!p)return;l(),p.addEventListener("scroll",l,{passive:!0});const f=new ResizeObserver(l);return f.observe(p),()=>{p.removeEventListener("scroll",l),f.disconnect()}},[l]);const u=E.useRef(t);E.useEffect(()=>{const p=n.current;p&&(t>u.current&&requestAnimationFrame(()=>{p.scrollTo({left:p.scrollWidth,behavior:"smooth"})}),u.current=t)},[t]),E.useEffect(()=>{const p=f=>{(f.key==="ArrowLeft"||f.key==="ArrowRight")&&(f.preventDefault(),d(f.key==="ArrowLeft"?"left":"right"))};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[]);const d=p=>{const f=n.current;if(!f)return;const h=Array.from(f.children),m=f.scrollLeft,g=m+f.clientWidth;if(p==="right"){const b=h.find(v=>v.offsetLeft+v.offsetWidth>g+1);b&&f.scrollTo({left:b.offsetLeft+b.offsetWidth-f.clientWidth,behavior:"smooth"})}else{const b=[...h].reverse().find(v=>v.offsetLeft<m-1);b&&f.scrollTo({left:b.offsetLeft,behavior:"smooth"})}};return c.jsxs("div",{className:K("MULTI_COLUMN relative w-full h-full overflow-hidden"),children:[s&&c.jsx(k$e,{direction:"left",onClick:()=>d("left")}),i&&c.jsx(k$e,{direction:"right",onClick:()=>d("right")}),c.jsx("div",{ref:n,className:"grid overflow-x-auto w-full overflow-y-auto h-full",style:{gridTemplateColumns:`repeat(${t}, minmax(${r??"0"}, 1fr))`},children:e})]})}function k$e({direction:e,onClick:t}){const r=e==="left"?UBe:Hi,n=e==="left";return c.jsx("div",{className:K("absolute top-0 bottom-0 z-20 w-20 flex items-center justify-center px-5 bg-surface2",n?"left-0":"right-0"),children:c.jsx(ye,{onClick:t,variant:"standard",size:"large",className:"w-full h-full px-0","aria-label":`Scroll ${e}`,children:c.jsx(r,{})})})}function hj({onPrevious:e,onNext:t,previousAriaLabel:r="Previous",nextAriaLabel:n="Next"}){return c.jsxs(Xo,{spacing:"close",children:[c.jsxs(ye,{variant:"standard",size:"default",onClick:e,disabled:!e,"aria-label":r,children:[c.jsx(pL,{})," Prev"]}),c.jsxs(ye,{variant:"standard",size:"default",onClick:t,disabled:!t,"aria-label":n,children:["Next",c.jsx(iie,{})]})]})}function oun({datasetId:e,itemId:t,onPrevious:r,onNext:n,onEdit:s,onDelete:a,onClose:i,isEditing:o=!1}){const{Link:l}=Yt();return c.jsxs(Un.Toolbar,{children:[c.jsx(hj,{onPrevious:r,onNext:n,previousAriaLabel:"Previous item",nextAriaLabel:"Next item"}),c.jsxs(Xo,{children:[!o&&c.jsxs(c.Fragment,{children:[c.jsxs(ye,{variant:"standard",size:"default",href:`/datasets/${e}/items/${t}`,as:l,children:[c.jsx(bL,{}),"Versions"]}),c.jsxs(cn,{children:[c.jsx(cn.Trigger,{asChild:!0,children:c.jsx(ye,{variant:"standard",size:"default","aria-label":"Actions menu",children:c.jsx(eze,{})})}),c.jsxs(cn.Content,{align:"end",className:"w-48",children:[c.jsxs(cn.Item,{onSelect:s,children:[c.jsx(vL,{}),"Edit"]}),c.jsxs(cn.Item,{onSelect:a,className:"text-red-500 focus:text-red-400",children:[c.jsx(Fv,{}),"Delete Item"]})]})]})]}),c.jsx(ye,{variant:"standard",size:"default",onClick:i,"aria-label":"Close detail panel",children:c.jsx(Os,{})})]})]})}function lun({children:e,title:t,description:r,icon:n,className:s,withMargins:a=!0}){const i=t==="loading",o=r==="loading";return e?c.jsx("header",{className:K("grid grid-cols-[1fr_auto] gap-16 w-full ",{"mt-[6vh] mb-[4vh]":a},s),children:e}):c.jsxs("header",{className:K("grid gap-2 pt-8 pb-8",s),children:[c.jsx("h1",{className:K("text-neutral6 text-xl font-normal flex items-center gap-2","[&>svg]:w-6 [&>svg]:h-6 [&>svg]:text-neutral3",{"bg-surface4 w-60 max-w-[50%] rounded-md animate-pulse":i}),children:i?c.jsx(c.Fragment,{children:" "}):c.jsxs(c.Fragment,{children:[n&&n," ",t]})}),r&&c.jsx("p",{className:K("text-neutral4 text-sm m-0",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":o}),children:o?c.jsx(c.Fragment,{children:" "}):r})]})}function cun({children:e,isLoading:t,size:r="default"}){return c.jsx("h1",{className:K("text-neutral5 text-xl font-normal gap-2 flex items-center","[&>svg]:w-[1.25em] [&>svg]:h-[1.25em] [&>svg]:opacity-50",{"bg-surface4 w-60 max-w-[50%] rounded-md animate-pulse":t,"text-md":r==="smaller"}),children:t?c.jsx(c.Fragment,{children:" "}):c.jsx(c.Fragment,{children:e})})}function uun({children:e,isLoading:t,titleWithIcon:r}){return c.jsx("p",{className:K("text-neutral3 text-sm max-w-[35rem] flex flex-wrap gap-x-4 gap-y-1 mt-1 first-of-type:mt-3 ml-1",{"bg-surface4 w-[40rem] max-w-[80%] rounded-md animate-pulse":t}),children:t?c.jsx(c.Fragment,{children:" "}):c.jsx(c.Fragment,{children:e})})}function dun({children:e,className:t}){return c.jsx("div",{className:K("grid content-start",t),children:e})}const Rr=Object.assign(lun,{Title:cun,Description:uun,Column:dun});function Smt({item:e}){return c.jsx(Rr,{withMargins:!1,children:c.jsxs(Rr.Column,{children:[c.jsxs(Rr.Title,{size:"smaller",children:[c.jsx(L0,{}),c.jsx("span",{className:"truncate",children:e.id}),c.jsx(ql,{content:e.id,tooltip:`Copy item ID: ${e.id}`})]}),c.jsxs(Rr.Description,{children:[c.jsxs(xs,{children:[c.jsx(cA,{})," Created ",vn(new Date(e.createdAt),"MMM d, yyyy h:mm aaa")]}),e.datasetVersion!=null&&c.jsxs(xs,{children:[c.jsx(bL,{})," Version v",e.datasetVersion]})]})]})})}function s8({item:e}){const t=e?.input?JSON.stringify(e.input,null,2):"null",r=e?.groundTruth?JSON.stringify(e.groundTruth,null,2):"null",n=e?.metadata?JSON.stringify(e.metadata,null,2):"null";return c.jsxs(v1,{children:[c.jsx(er.CodeSection,{title:"Input",icon:c.jsx(JN,{}),codeStr:t}),c.jsx(er.CodeSection,{title:"Ground Truth",icon:c.jsx(dv,{}),codeStr:r}),c.jsx(er.CodeSection,{title:"Metadata",icon:c.jsx(mie,{}),codeStr:n})]})}function O$e({field:e,errors:t}){return t.length?c.jsx("div",{className:"mt-2 space-y-1",children:t.map((r,n)=>c.jsxs("p",{className:"text-xs text-destructive",children:[c.jsxs("code",{className:"bg-destructive/10 px-1 rounded",children:[e,r.path!=="/"?r.path:""]}),": ",r.message]},n))}):null}function wmt({inputValue:e,setInputValue:t,groundTruthValue:r,setGroundTruthValue:n,metadataValue:s,setMetadataValue:a,validationErrors:i,onSave:o,onCancel:l,isSaving:u}){return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mb-4",children:c.jsxs("h3",{className:"text-lg font-medium flex items-center gap-2",children:[c.jsx(vL,{className:"w-5 h-5"})," Edit Item"]})}),c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{children:"Input (JSON) *"}),c.jsx(Wa,{value:e,onChange:t,showCopyButton:!1,className:"min-h-[120px]"}),i?.field==="input"&&c.jsx(O$e,{field:"input",errors:i.errors})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{children:"Ground Truth (JSON, optional)"}),c.jsx(Wa,{value:r,onChange:n,showCopyButton:!1,className:"min-h-[100px]"}),i?.field==="groundTruth"&&c.jsx(O$e,{field:"groundTruth",errors:i.errors})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Bt,{children:"Metadata (JSON, optional)"}),c.jsx(Wa,{value:s,onChange:a,showCopyButton:!1,className:"min-h-[80px]"})]}),c.jsxs("div",{className:"flex gap-2 pt-4",children:[c.jsx(ye,{variant:"cta",size:"default",onClick:o,disabled:u,children:u?"Saving...":"Save Changes"}),c.jsx(ye,{variant:"standard",size:"default",onClick:l,disabled:u,children:"Cancel"})]})]})]})}function pun(e){if(!(e instanceof Error))return null;const t=e.message.match(/- ({.*})$/);if(!t)return null;try{const r=JSON.parse(t[1]);if(r.field&&Array.isArray(r.errors))return{field:r.field,errors:r.errors}}catch{}return null}function fun({datasetId:e,item:t,items:r,onItemChange:n,onClose:s}){const{Link:a}=Yt(),{updateItem:i,deleteItem:o}=Ru(),[l,u]=E.useState(!1),[d,p]=E.useState(""),[f,h]=E.useState(""),[m,g]=E.useState(""),[b,v]=E.useState(null),[S,w]=E.useState(!1);E.useEffect(()=>{t&&(p(JSON.stringify(t.input,null,2)),h(t.groundTruth?JSON.stringify(t.groundTruth,null,2):""),g(t.metadata?JSON.stringify(t.metadata,null,2):""),u(!1),w(!1),v(null))},[t?.id]);const k=()=>{const F=r.findIndex(L=>L.id===t.id);if(F>=0&&F<r.length-1)return()=>n(r[F+1].id)},_=()=>{const F=r.findIndex(L=>L.id===t.id);if(F>0)return()=>n(r[F-1].id)},C=async()=>{let F;try{F=JSON.parse(d)}catch{Xe.error("Input must be valid JSON");return}let L;if(f.trim())try{L=JSON.parse(f)}catch{Xe.error("Ground Truth must be valid JSON");return}let z;if(m.trim())try{z=JSON.parse(m)}catch{Xe.error("Metadata must be valid JSON");return}try{await i.mutateAsync({datasetId:e,itemId:t.id,input:F,groundTruth:L,metadata:z}),Xe.success("Item updated successfully"),u(!1),v(null)}catch(q){const H=pun(q);H?v(H):Xe.error(`Failed to update item: ${q instanceof Error?q.message:"Unknown error"}`)}},T=()=>{p(JSON.stringify(t.input,null,2)),h(t.groundTruth?JSON.stringify(t.groundTruth,null,2):""),g(t.metadata?JSON.stringify(t.metadata,null,2):""),u(!1),v(null)},A=F=>{p(F),b?.field==="input"&&v(null)},N=F=>{h(F),b?.field==="groundTruth"&&v(null)},I=()=>{u(!0)},R=()=>{w(!0)},$=async()=>{try{await o.mutateAsync({datasetId:e,itemId:t.id}),Xe.success("Item deleted successfully"),w(!1),s()}catch(F){Xe.error(`Failed to delete item: ${F instanceof Error?F.message:"Unknown error"}`)}};return c.jsxs(c.Fragment,{children:[c.jsxs(Un,{withLeftSeparator:!0,children:[c.jsx(oun,{datasetId:e,itemId:t.id,onPrevious:_(),onNext:k(),onEdit:I,onDelete:R,onClose:s,isEditing:l}),c.jsx(Un.Content,{children:l?c.jsx(wmt,{inputValue:d,setInputValue:A,groundTruthValue:f,setGroundTruthValue:N,metadataValue:m,setMetadataValue:g,validationErrors:b,onSave:C,onCancel:T,isSaving:i.isPending}):c.jsxs(c.Fragment,{children:[c.jsx(Smt,{item:t}),c.jsx(s8,{item:t,Link:a})]})})]}),c.jsx(qt,{open:S,onOpenChange:w,children:c.jsxs(qt.Content,{children:[c.jsxs(qt.Header,{children:[c.jsx(qt.Title,{children:"Delete Item"}),c.jsx(qt.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),c.jsxs(qt.Footer,{children:[c.jsx(qt.Cancel,{children:"Cancel"}),c.jsx(qt.Action,{onClick:$,children:o.isPending?"Deleting...":"Yes, Delete"})]})]})})]})}function hun({datasetId:e,onClose:t,onVersionSelect:r,onCompareVersionsClick:n,activeVersion:s}){const{data:a,isLoading:i,fetchNextPage:o,hasNextPage:l,isFetchingNextPage:u}=bmt(e),[d,p]=E.useState(!1),[f,h]=E.useState(new Set),m=k=>{r?.(k)},g=k=>s==null?k.isCurrent:k.version===s,b=k=>{h(_=>{const C=new Set(_);if(C.has(k))C.delete(k);else if(C.size>=2){const[T]=Array.from(C);return new Set([T,k])}else C.add(k);return C})},v=()=>{p(!1),h(new Set)},S=()=>{p(!0)},w=()=>{f.size===2&&n?.(Array.from(f))};return c.jsxs(Un,{withLeftSeparator:!0,className:"w-[14rem]",children:[d?c.jsx(Un.Toolbar,{className:"grid justify-stretch gap-3 w-full",children:c.jsxs(Xo,{children:[c.jsx(ye,{variant:"standard",size:"default",onClick:v,children:"Cancel"}),c.jsxs(nN,{variant:"cta",size:"default",disabled:f.size!==2,onClick:w,tooltipContent:f.size!==2?"Select two versions to enable comparison":void 0,className:"w-full",children:[c.jsx(Wh,{})," Compare"]})]})}):c.jsxs(Un.Toolbar,{children:[c.jsxs(ye,{variant:"standard",size:"default",onClick:S,children:[c.jsx(pA,{})," Compare Ver."]}),c.jsx(nN,{variant:"standard",size:"default",onClick:t,tooltipContent:"Hide Versions Panel",children:c.jsx(Os,{})})]}),c.jsx(Un.Content,{children:i?c.jsx(mun,{}):c.jsxs(We,{children:[c.jsx(We.Header,{children:c.jsx(We.HeaderCol,{children:"Dataset Version History"})}),c.jsxs(We.Scroller,{children:[c.jsx(We.Items,{children:a?.map(k=>{const _=String(k.version),C=k.createdAt?typeof k.createdAt=="string"?new Date(k.createdAt):k.createdAt:null;return c.jsxs(We.Row,{isSelected:d&&f.has(_),children:[d&&c.jsx(We.LabelCell,{children:c.jsx(Fp,{checked:f.has(_),onCheckedChange:()=>{},onClick:T=>{T.stopPropagation(),b(_)},"aria-label":`Select version ${C?`v${k.version} — ${vn(C,"MMM d, yyyy HH:mm")}`:`v${k.version}`}`})}),c.jsx(We.RowButton,{item:k,isFeatured:g(k),columns:[{name:"version",label:"Dataset Version History",size:"1fr"}],onClick:()=>m(k),className:"py-2",children:c.jsx(We.VersionCell,{version:k.version,date:C,isLatest:k.isCurrent})})]},String(k.version))})}),l&&c.jsx(ye,{variant:"standard",size:"default",onClick:()=>o(),disabled:u,className:"w-full mt-2",children:u?"Loading...":"Load More"})]})]})})]})}function mun(){return c.jsxs(We,{children:[c.jsx(We.Header,{children:c.jsx(We.HeaderCol,{children:"Dataset Version History"})}),c.jsx(We.Items,{children:Array.from({length:3}).map((e,t)=>c.jsx(We.Row,{children:c.jsx(We.RowButton,{columns:[{name:"version",label:"Dataset Version History",size:"1fr"}],children:c.jsx(We.TextCell,{isLoading:!0,children:"Loading..."})})},t))})]})}const gun={warning:"bg-[#352f26] ",destructive:"bg-accent2/20",info:"bg-accent5/20",success:"bg-accent1/15"};function yun({children:e,variant:t,className:r}){return c.jsx("div",{className:K("flex items-center gap-3 px-4 pr-3 py-3 rounded-lg text-neutral4/80","animate-in fade-in-0 slide-in-from-top-2 duration-200","[>svg]:w-[1em] [&>dvg]:h-[1em] [&>svg]:opacity-50 [&>svg]:text-neutral4",gun[t],r),children:e})}function bun({children:e,className:t}){return c.jsx("div",{className:K("flex-1 text-sm ",t),children:e})}function vun(e){return c.jsx(ye,{size:"sm",variant:"standard",...e})}function xun({children:e,className:t}){return c.jsx("div",{className:K("flex-1 text-sm font-semibold",t),children:e})}function Sun({children:e,className:t}){return c.jsx("div",{className:K("grid gap-1 ",t),children:e})}const Vo=Object.assign(yun,{Message:bun,Button:vun,Title:xun,Column:Sun});function wun({datasetId:e,items:t,isLoading:r,featuredItemId:n,onItemSelect:s,onItemClose:a,onAddClick:i,onImportClick:o,onImportJsonClick:l,onBulkDeleteClick:u,onCreateDatasetClick:d,onAddToDatasetClick:p,onCompareItemsClick:f,datasetName:h,clearSelectionTrigger:m,setEndOfListElement:g,isFetchingNextPage:b,hasNextPage:v,searchQuery:S,onSearchChange:w,activeDatasetVersion:k,currentDatasetVersion:_,onVersionSelect:C,onCompareVersionsClick:T}){const[A,N]=E.useState(!1),[I,R]=E.useState("idle"),$=icn(),F=t.find(U=>U.id===n)??null;E.useEffect(()=>{m!==void 0&&m>0&&($.clearSelection(),R("idle"))},[m]);const L=k!=null&&_!=null&&k!==_,z=U=>{U===n?a():s(U)},q=()=>{N(!0)},H=()=>{N(!1)},V=()=>{R("idle"),$.clearSelection()},G=()=>{if($.selectedCount===0)return;const U=t.filter(j=>$.selectedIds.has(j.id));if(I==="export"){try{ocn(U,`${h||"dataset"}-items.csv`),Xe.success(`Exported ${$.selectedCount} items to CSV`)}catch(j){Xe.error("Failed to export items to CSV"),console.error("CSV export error:",j)}V()}else if(I==="export-json"){try{lcn(U,`${h||"dataset"}-items.json`),Xe.success(`Exported ${$.selectedCount} items to JSON`)}catch(j){Xe.error("Failed to export items to JSON"),console.error("JSON export error:",j)}V()}else I==="create-dataset"?d?.(U):I==="add-to-dataset"?p?.(U):I==="delete"?u?.(Array.from($.selectedIds)):I==="compare-items"&&f?.(Array.from($.selectedIds))},M=I!=="idle",X=[{name:"id",label:"ID",size:"5rem"},{name:"input",label:"Input",size:"1fr"},...F?[]:[{name:"groundTruth",label:"Ground Truth",size:"1fr"}],{name:"date",label:"Created",size:"10rem"}];return c.jsxs(lx,{className:K({"grid-cols-[1fr_1fr]":!!F,"grid-cols-[1fr_auto]":A&&!F}),children:[c.jsxs(Un,{children:[c.jsx(aun,{onAddClick:i,onImportClick:o??(()=>{}),onImportJsonClick:l??(()=>{}),onExportClick:()=>R("export"),onExportJsonClick:()=>R("export-json"),onCreateDatasetClick:()=>R("create-dataset"),onAddToDatasetClick:()=>R("add-to-dataset"),onDeleteClick:()=>R("delete"),onCompareClick:()=>R("compare-items"),hasItems:t.length>0,searchQuery:S,onSearchChange:w,isSelectionActive:M,selectedCount:$.selectedCount,onExecuteAction:G,onCancelSelection:V,selectionMode:I,onVersionsClick:q,isItemPanelOpen:!!F,isVersionsPanelOpen:A,isViewingOldVersion:L}),L&&k!=null&&c.jsxs(Vo,{variant:"warning",children:[c.jsx(Pc,{}),c.jsxs(Vo.Message,{children:["Viewing version v",k]}),c.jsxs(Vo.Button,{onClick:()=>C?.({version:_,isCurrent:!0}),children:[c.jsx(pw,{})," Return to the latest version"]})]}),c.jsx(Jcn,{items:t,isLoading:r,onItemClick:z,featuredItemId:n,columns:X,setEndOfListElement:g,isFetchingNextPage:b,hasNextPage:v,isSelectionActive:M,selectedIds:$.selectedIds,onToggleSelection:$.toggle,onSelectAll:$.selectAll,onClearSelection:$.clearSelection,maxSelection:I==="compare-items"?2:void 0,onAddClick:i,onImportClick:o,onImportJsonClick:l,searchQuery:S})]}),!!F&&c.jsx(fun,{datasetId:e,item:F,items:t,onItemChange:s,onClose:a}),!F&&A&&c.jsx(hun,{datasetId:e,onClose:H,onVersionSelect:C,onCompareVersionsClick:T,activeVersion:k})]})}const Eun=[{value:"all",label:"All statuses"},{value:"pending",label:"Pending"},{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}],kun=[{value:"all",label:"All types"},{value:"agent",label:"Agent"},{value:"workflow",label:"Workflow"},{value:"scorer",label:"Scorer"},{value:"processor",label:"Processor"}];function Oun({hasExperiments:e,onCompareClick:t,isSelectionActive:r,selectedCount:n,onExecuteCompare:s,onCancelSelection:a,filters:i,onFiltersChange:o,targetIds:l}){const u=[{value:"all",label:"All targets"},...l.map(d=>({value:d,label:d}))];return r?c.jsx("div",{className:"flex items-center justify-end gap-4 w-full",children:c.jsxs("div",{className:"flex gap-5",children:[c.jsxs("div",{className:"text-sm text-neutral3 flex items-center gap-2 pl-6",children:[c.jsx(fo,{size:"large",color:n<2?"red":"green",children:n}),c.jsx("span",{children:"of 2 experiments selected"}),c.jsx(fie,{})]}),c.jsxs(Xo,{children:[c.jsxs(ye,{variant:"cta",size:"default",disabled:n!==2,onClick:s,children:[c.jsx(pA,{className:"w-4 h-4"}),"Compare Experiments"]}),c.jsx(ye,{variant:"standard",size:"default",onClick:a,children:"Cancel"})]})]})}):c.jsxs("div",{className:"flex items-center justify-between gap-4 w-full",children:[c.jsxs(Xo,{children:[c.jsx(jc,{label:"Status",labelIsHidden:!0,name:"filter-status",options:Eun,value:i.status??"all",onValueChange:d=>o({...i,status:d==="all"?void 0:d}),variant:"experimental",size:"default"}),c.jsx(jc,{label:"Type",labelIsHidden:!0,name:"filter-target-type",options:kun,value:i.targetType??"all",onValueChange:d=>o({...i,targetType:d==="all"?void 0:d}),variant:"experimental",size:"default"}),l.length>0&&c.jsx(jc,{label:"Target",labelIsHidden:!0,name:"filter-target-id",options:u,value:i.targetId??"all",onValueChange:d=>o({...i,targetId:d==="all"?void 0:d}),variant:"experimental",size:"default"}),(i.status||i.targetType||i.targetId)&&c.jsxs(ye,{variant:"standard",size:"default",onClick:()=>o({}),children:[c.jsx(ve,{children:c.jsx(Os,{})}),"Reset"]})]}),e&&c.jsxs(ye,{variant:"standard",size:"default",onClick:t,children:[c.jsx(pA,{className:"w-4 h-4"}),"Compare"]})]})}const _$e=[{name:"experimentId",label:"ID",size:"6rem"},{name:"status",label:"Status",size:"4rem"},{name:"targetType",label:"Type",size:"4rem"},{name:"target",label:"Target",size:"1fr"},{name:"counts",label:"Counts",size:"7rem"},{name:"date",label:"Created",size:"10rem"}];function _un({experiments:e,isSelectionActive:t,selectedExperimentIds:r,onRowClick:n,onToggleSelection:s}){const a=_$e;return e.length===0?c.jsx(Cun,{}):c.jsx(We,{children:c.jsxs(We.Scroller,{children:[c.jsx(We.Header,{columns:a,isSelectionActive:t,children:a.map(i=>c.jsx(We.HeaderCol,{children:i.label},i.name))}),c.jsx(We.Items,{children:e.map(i=>{const o=i.status,l=r.includes(i.id),u={id:i.id};return c.jsxs(We.Row,{isSelected:l,children:[t&&c.jsx(We.LabelCell,{children:c.jsx(Fp,{checked:l,onCheckedChange:()=>s(i.id),"aria-label":`Select experiment ${i.id}`})}),c.jsxs(We.RowButton,{item:u,columns:_$e,onClick:()=>n(i.id),children:[c.jsx(We.IdCell,{id:i.id}),c.jsx(We.StatusCell,{status:o}),c.jsx(We.TextCell,{children:i.targetType}),c.jsx(We.TextCell,{children:i.targetId}),c.jsx(We.Cell,{children:c.jsxs(dn,{children:[c.jsx(pn,{asChild:!0,children:c.jsxs("div",{className:"flex gap-1",children:[i.succeededCount>0&&c.jsx(fo,{color:"green",children:i.succeededCount}),i.failedCount>0&&c.jsx(fo,{color:"red",children:i.failedCount})]})}),c.jsxs(sn,{children:[i.succeededCount," Succeeded",c.jsx("br",{}),i.failedCount," Failed"]})]})}),c.jsx(We.DateCell,{date:i.createdAt,withTime:!0})]})]},i.id)})})]})})}function Cun(){return c.jsx("div",{className:"flex h-full items-center justify-center py-12",children:c.jsx(Bc,{iconSlot:c.jsx(hie,{className:"w-8 h-8 text-neutral3"}),titleSlot:"No experiments yet",descriptionSlot:"Trigger an experiment to evaluate your dataset against an agent, workflow, or scorer."})})}function Tun({experiments:e,allExperiments:t,isLoading:r,datasetId:n,filters:s,onFiltersChange:a}){const[i,o]=E.useState([]),[l,u]=E.useState(!1),{navigate:d}=Yt(),p=E.useMemo(()=>{const b=t??e;return[...new Set(b.map(v=>v.targetId))]},[t,e]),f=b=>{o(v=>v.includes(b)?v.filter(S=>S!==b):v.length>=2?[v[0],b]:[...v,b])},h=()=>{if(i.length===2){const[b,v]=i;d(`/datasets/${n}/experiments?baseline=${b}&contender=${v}`)}},m=()=>{o([]),u(!1)},g=b=>{d(`/datasets/${n}/experiments/${b}`)};return r?c.jsx("div",{children:"Loading..."}):c.jsx(lx,{children:c.jsxs(Un,{children:[c.jsx(Oun,{hasExperiments:e.length>0||Object.values(s).some(Boolean),onCompareClick:()=>u(!0),isSelectionActive:l,selectedCount:i.length,onExecuteCompare:h,onCancelSelection:m,filters:s,onFiltersChange:a,targetIds:p}),c.jsx(_un,{experiments:e,isSelectionActive:l,selectedExperimentIds:i,onRowClick:g,onToggleSelection:f})]})})}function Aun({dataset:e,isLoading:t=!1,onEditClick:r,onDuplicateClick:n,onDeleteClick:s,experimentTriggerSlot:a,onExperimentClick:i,className:o}){return c.jsxs(Rr,{className:o,children:[c.jsxs(Rr.Column,{children:[c.jsxs(Rr.Title,{isLoading:t,children:[c.jsx(BE,{})," ",e?.name]}),c.jsx(Rr.Description,{isLoading:t,children:e?.description}),c.jsxs(Rr.Description,{isLoading:t,children:[c.jsxs(xs,{children:[c.jsx(cA,{})," Created at ",e?.createdAt?vn(new Date(e.createdAt),"MMM d, yyyy"):""]}),c.jsxs(xs,{children:[c.jsx(bL,{})," Latest version v",e?.version??""]})]})]}),c.jsx(Rr.Column,{children:c.jsxs(Xo,{children:[a||(i?c.jsxs(ye,{variant:"outline",size:"sm",onClick:i,children:[c.jsx(hie,{}),"Run Experiment"]}):null),c.jsxs(cn,{children:[c.jsx(cn.Trigger,{asChild:!0,children:c.jsx(ye,{variant:"standard",size:"default","aria-label":"Dataset actions menu",children:c.jsx(eze,{})})}),c.jsxs(cn.Content,{align:"end",className:"w-48",children:[c.jsxs(cn.Item,{onSelect:r,children:[c.jsx(vL,{})," Edit Dataset"]}),c.jsxs(cn.Item,{onSelect:n,children:[c.jsx(Ql,{})," Duplicate Dataset"]}),c.jsxs(cn.Item,{onSelect:s,className:"text-red-500 focus:text-red-400",children:[c.jsx(Fv,{})," Delete Dataset"]})]})]})]})})]})}function Dun(e){const[t,r]=E.useState(()=>e.reduce((o,l)=>(o[l]="ignore",o),{})),n=E.useRef([]);E.useEffect(()=>{const o=n.current;if(e.length!==o.length||e.some((u,d)=>u!==o[d])){n.current=e;const u={};for(const d of e)u[d]="ignore";r(u)}},[e]);const s=E.useCallback((o,l)=>{r(u=>({...u,[o]:l}))},[]),a=E.useCallback(()=>{r(e.reduce((o,l)=>(o[l]="ignore",o),{}))},[e]),i=E.useMemo(()=>Object.values(t).some(o=>o==="input"),[t]);return{mapping:t,setColumnField:s,resetMapping:a,isInputMapped:i}}function Nun({onFileSelect:e,isParsing:t,error:r}){const n=E.useRef(null),[s,a]=E.useState(!1),i=E.useCallback(()=>{t||n.current?.click()},[t]),o=E.useCallback(p=>{const f=p.target.files?.[0];f&&e(f),p.target.value=""},[e]),l=E.useCallback(p=>{p.preventDefault(),p.stopPropagation(),a(!0)},[]),u=E.useCallback(p=>{p.preventDefault(),p.stopPropagation(),a(!1)},[]),d=E.useCallback(p=>{if(p.preventDefault(),p.stopPropagation(),a(!1),t)return;const f=p.dataTransfer.files?.[0];f&&f.name.endsWith(".csv")&&e(f)},[t,e]);return c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("input",{ref:n,type:"file",accept:".csv",onChange:o,className:"hidden",disabled:t}),c.jsx("div",{onClick:i,onDragOver:l,onDragLeave:u,onDrop:d,className:K("flex flex-col items-center justify-center gap-3","min-h-[160px] rounded-lg border-2 border-dashed p-6","cursor-pointer transition-colors","border-surface4 bg-surface2",s&&"border-accent1/50 bg-accent1/5",r&&"border-accent2/50 bg-accent2/5",t&&"cursor-wait opacity-60"),children:t?c.jsxs(c.Fragment,{children:[c.jsx(Cn,{size:"lg"}),c.jsx("span",{className:"text-sm text-neutral4",children:"Parsing CSV..."})]}):c.jsxs(c.Fragment,{children:[c.jsx(ve,{className:"text-neutral4",children:c.jsx(xL,{className:"h-8 w-8"})}),c.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c.jsx("span",{className:"text-sm font-medium text-neutral1",children:"Click to upload or drag and drop"}),c.jsx("span",{className:"text-xs text-neutral4",children:"CSV files only"})]})]})}),r&&c.jsx("div",{className:"text-sm text-accent2",children:r})]})}function C$e({headers:e,data:t,maxRows:r=5}){const n=t.slice(0,r),s=t.length,a=i=>{if(i==null)return"";const o=typeof i=="object"?JSON.stringify(i):String(i);return o.length>50?o.slice(0,47)+"...":o};return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("div",{className:"overflow-x-auto rounded-lg border border-border1",children:c.jsxs(Tl,{size:"small",children:[c.jsx(Al,{children:e.map(i=>c.jsx(Aa,{children:i},i))}),c.jsx(Dl,{children:n.map((i,o)=>c.jsx(Nl,{children:e.map(l=>c.jsx(Hs,{className:"text-sm max-w-[200px]",children:c.jsx("span",{className:"truncate block",children:a(i[l])})},l))},o))})]})}),c.jsx("div",{className:"text-xs text-neutral4",children:n.length<s?`Showing ${n.length} of ${s} rows`:`${s} row${s!==1?"s":""}`})]})}const Iun=[{id:"input",label:"Input",description:"Data passed to target",required:!0},{id:"groundTruth",label:"Ground Truth",description:"Ground truth for comparison"},{id:"metadata",label:"Metadata",description:"Additional context"},{id:"ignore",label:"Ignore",description:"Not imported"}];function jun({headers:e,mapping:t,onMappingChange:r}){const n=i=>{if(!i.destination)return;const o=i.draggableId,l=i.destination.droppableId;t[o]!==l&&r(o,l)},s=i=>e.filter(o=>t[o]===i),a=s("input").length>0;return c.jsx(_pe,{onDragEnd:n,children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx("div",{className:"text-sm text-neutral4",children:"Drag columns to assign them to dataset fields"}),Iun.map(i=>{const o=s(i.id),l=o.length===0,u=i.required&&l;return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm font-medium text-neutral1",children:i.label}),i.required&&c.jsx("span",{className:"text-xs text-accent1",children:"*"}),c.jsx("span",{className:"text-xs text-neutral4",children:i.description})]}),c.jsx(Ape,{droppableId:i.id,direction:"horizontal",children:(d,p)=>c.jsxs("div",{ref:d.innerRef,...d.droppableProps,className:`
588
588
  min-h-[48px] rounded-lg border-2 border-dashed p-2
589
589
  flex flex-wrap gap-2 items-center
590
590
  transition-colors
@@ -612,4 +612,4 @@ Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}
612
612
  `),l=a;l<o.length;l++){var u=o[l];if(!(u.length>1024)){var d=v3e.test(u)?u.replace(v3e,"$1"):u;if(!d.match(/\S*Error: /)){for(var p of r){var f=p(d,e);if(f){i.push(f);break}}if(i.length>=x3e)break}}}return(function(h){if(!h.length)return[];var m=Array.from(h);return m.reverse(),m.slice(0,x3e).map((g=>{return dr({},g,{filename:g.filename||(b=m,b[b.length-1]||{}).filename,function:g.function||zk});var b}))})(i)}}class xmn{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){var n=Do(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?r+": "+t.message:r}isDOMException(t){return L4(t,"DOMException")}isDOMError(t){return L4(t,"DOMError")}}class Smn{match(t){return(r=>r instanceof Error)(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){var n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}}class wmn{constructor(){}match(t){return L4(t,"ErrorEvent")&&t.error!=null}coerce(t,r){var n,s=r.apply(t.error);return s||{type:"ErrorEvent",value:t.message,stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}}var Emn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class kmn{match(t){return typeof t=="string"}coerce(t,r){var n,[s,a]=this.getInfos(t);return{type:s??"Error",value:a??t,stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}getInfos(t){var r="Error",n=t,s=t.match(Emn);return s&&(r=s[1],n=s[2]),[r,n]}}var Omn=["fatal","error","warning","log","info","debug"];function kgt(e,t){t===void 0&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var n=r.length;n>0;n--){var s=r.slice(0,n).join(", ");if(!(s.length>t))return n===r.length||s.length<=t?s:s.slice(0,t)+"..."}return""}class _mn{match(t){return typeof t=="object"&&t!==null}coerce(t,r){var n,s=this.getErrorPropertyFromObject(t);return s?r.apply(s):{type:this.getType(t),value:this.getValue(t),stack:(n=r.syntheticException)==null?void 0:n.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return wgt(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var r="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(r+=" with message: '"+t.message+"'"),r}if("message"in t&&typeof t.message=="string")return t.message;var n=this.getObjectClassName(t);return(n&&n!=="Object"?"'"+n+"'":"Object")+" captured as exception with keys: "+kgt(t)}isSeverityLevel(t){return Do(t)&&!ane(t)&&Omn.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var n=t[r];if(cmn(n))return n}}getObjectClassName(t){try{var r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}}class Cmn{match(t){return wgt(t)}coerce(t,r){var n,s=t.constructor.name;return{type:s,value:s+" captured as exception with keys: "+kgt(t),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}}class Tmn{match(t){return ine(t)}coerce(t,r){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}}}class Amn{match(t){return L4(t,"PromiseRejectionEvent")}coerce(t,r){var n,s=this.getUnhandledRejectionReason(t);return ine(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(n=r.syntheticException)==null?void 0:n.stack,synthetic:!0}:r.apply(s)}getUnhandledRejectionReason(t){if(ine(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var Ogt=function(e,t){var{debugEnabled:r}=t===void 0?{}:t,n={k:function(s){if(Ze&&(Eg.DEBUG||un.POSTHOG_DEBUG||r)&&!Ht(Ze.console)&&Ze.console){for(var a=("__rrweb_original__"in Ze.console[s])?Ze.console[s].__rrweb_original__:Ze.console[s],i=arguments.length,o=new Array(i>1?i-1:0),l=1;l<i;l++)o[l-1]=arguments[l];a(e,...o)}},info:function(){for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];n.k("log",...a)},warn:function(){for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];n.k("warn",...a)},error:function(){for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];n.k("error",...a)},critical:function(){for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];console.error(e,...a)},uninitializedWarning:s=>{n.error("You must initialize PostHog before calling "+s)},createLogger:(s,a)=>Ogt(e+" "+s,a)};return n},Kt=Ogt("[PostHog.js]"),Lo=Kt.createLogger,Dmn=Lo("[ExternalScriptsLoader]"),S3e=(e,t,r)=>{if(e.config.disable_external_dependency_loading)return Dmn.warn(t+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var n=Wt?.querySelectorAll("script");if(n){for(var s,a=function(){if(n[i].src===t){var l=n[i];return l.__posthog_loading_callback_fired?{v:r()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,r(void 0,u)})),l.onerror=u=>r(u),{v:void 0})}},i=0;i<n.length;i++)if(s=a())return s.v}var o=()=>{if(!Wt)return r("document not found");var l=Wt.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=t,l.onload=p=>{l.__posthog_loading_callback_fired=!0,r(void 0,p)},l.onerror=p=>r(p),e.config.prepare_external_dependency_script&&(l=e.config.prepare_external_dependency_script(l)),!l)return r("prepare_external_dependency_script returned null");var u,d=Wt.querySelectorAll("body > script");d.length>0?(u=d[0].parentNode)==null||u.insertBefore(l,d[0]):Wt.body.appendChild(l)};Wt!=null&&Wt.body?o():Wt?.addEventListener("DOMContentLoaded",o)};un.__PosthogExtensions__=un.__PosthogExtensions__||{},un.__PosthogExtensions__.loadExternalDependency=(e,t,r)=>{var n="/static/"+t+".js?v="+e.version;if(t==="remote-config"&&(n="/array/"+e.config.token+"/config.js"),t==="toolbar"){var s=3e5;n=n+"&t="+Math.floor(Date.now()/s)*s}var a=e.requestRouter.endpointFor("assets",n);S3e(e,a,r)},un.__PosthogExtensions__.loadSiteApp=(e,t,r)=>{var n=e.requestRouter.endpointFor("api",t);S3e(e,n,r)};var F4={};function sv(e,t,r){if(ka(e)){if(p3e&&e.forEach===p3e)e.forEach(t,r);else if("length"in e&&e.length===+e.length){for(var n=0,s=e.length;n<s;n++)if(n in e&&t.call(r,e[n],n)===F4)return}}}function La(e,t,r){if(!ma(e)){if(ka(e))return sv(e,t,r);if(smn(e)){for(var n of e.entries())if(t.call(r,n[1],n[0])===F4)return}else for(var s in e)if(Sgt.call(e,s)&&t.call(r,e[s],s)===F4)return}}var Wi=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return sv(r,(function(s){for(var a in s)s[a]!==void 0&&(e[a]=s[a])})),e},jO=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return sv(r,(function(s){sv(s,(function(a){e.push(a)}))})),e};function Z$(e){for(var t=Object.keys(e),r=t.length,n=new Array(r);r--;)n[r]=[t[r],e[t[r]]];return n}var w3e=function(e){try{return e()}catch{return}},Nmn=function(e){return function(){try{for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.apply(this,r)}catch(s){Kt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Kt.critical(s)}}},Dfe=function(e){var t={};return La(e,(function(r,n){(Do(r)&&r.length>0||Sm(r))&&(t[n]=r)})),t};function Imn(e,t){return r=e,n=a=>Do(a)&&!_y(t)?a.slice(0,t):a,s=new Set,(function a(i,o){return i!==Object(i)?n?n(i,o):i:s.has(i)?void 0:(s.add(i),ka(i)?(l=[],sv(i,(u=>{l.push(a(u))}))):(l={},La(i,((u,d)=>{s.has(u)||(l[d]=a(u,d))}))),l);var l})(r);var r,n,s}var jmn=["herokuapp.com","vercel.app","netlify.app"];function Rmn(e){var t=e?.hostname;if(!Do(t))return!1;var r=t.split(".").slice(-2).join(".");for(var n of jmn)if(r===n)return!1;return!0}function _gt(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}function uo(e,t,r,n){var{capture:s=!1,passive:a=!0}=n??{};e?.addEventListener(t,r,{capture:s,passive:a})}var Cgt="$people_distinct_id",XC="__alias",YC="__timers",E3e="$autocapture_disabled_server_side",lne="$heatmaps_enabled_server_side",k3e="$exception_capture_enabled_server_side",cne="$error_tracking_suppression_rules",O3e="$error_tracking_capture_extension_exceptions",_3e="$web_vitals_enabled_server_side",Tgt="$dead_clicks_enabled_server_side",C3e="$web_vitals_allowed_metrics",XY="$session_recording_remote_config",B4="$sesid",Agt="$session_is_sampled",Gw="$enabled_feature_flags",KC="$early_access_features",une="$feature_flag_details",JC="$stored_person_properties",Kx="$stored_group_properties",dne="$surveys",UP="$surveys_activated",z4="$flag_call_reported",kg="$user_state",pne="$client_session_props",fne="$capture_rate_limit",hne="$initial_campaign_params",mne="$initial_referrer_info",U4="$initial_person_info",V4="$epp",Dgt="__POSTHOG_TOOLBAR__",yC="$posthog_cookieless",Pmn=[Cgt,XC,"__cmpns",YC,"$session_recording_enabled_server_side",lne,B4,Gw,cne,kg,KC,une,Kx,JC,dne,z4,pne,fne,hne,mne,V4,U4];function T3e(e){return e instanceof Element&&(e.id===Dgt||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function p8(e){return!!e&&e.nodeType===1}function av(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ngt(e){return!!e&&e.nodeType===3}function Igt(e){return!!e&&e.nodeType===11}function Nfe(e){return e?u8(e).split(/\s+/):[]}function A3e(e){var t=Ze?.location.href;return!!(t&&e&&e.some((r=>t.match(r))))}function q4(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 Nfe(t)}function jgt(e){return ma(e)?null:u8(e).split(/(\s+)/).filter((t=>dN(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function vj(e){var t="";return gne(e)&&!Lgt(e)&&e.childNodes&&e.childNodes.length&&La(e.childNodes,(function(r){var n;Ngt(r)&&r.textContent&&(t+=(n=jgt(r.textContent))!==null&&n!==void 0?n:"")})),u8(t)}function Rgt(e){return Ht(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ife=["a","button","form","input","select","textarea","label"];function Pgt(e,t){if(Ht(t))return!0;var r,n=function(a){if(t.some((i=>a.matches(i))))return{v:!0}};for(var s of e)if(r=n(s))return r.v;return!1}function $gt(e){var t=e.parentNode;return!(!t||!p8(t))&&t}var $mn=["next","previous","prev",">","<"],D3e=10,N3e=[".ph-no-rageclick",".ph-no-capture"];function Mmn(e,t){if(!Ze||jfe(e))return!1;var r,n,s;if(nv(t)?(r=!!t&&N3e,n=void 0):(r=(s=t?.css_selector_ignorelist)!==null&&s!==void 0?s:N3e,n=t?.content_ignorelist),r===!1)return!1;var{targetElementList:a}=Mgt(e,!1);return!(function(i,o){if(i===!1||Ht(i))return!1;var l;if(i===!0)l=$mn;else{if(!ka(i))return!1;if(i.length>D3e)return Kt.error("[PostHog] content_ignorelist array cannot exceed "+D3e+" items. Use css_selector_ignorelist for more complex matching."),!1;l=i.map((u=>u.toLowerCase()))}return o.some((u=>{var{safeText:d,ariaLabel:p}=u;return l.some((f=>d.includes(f)||p.includes(f)))}))})(n,a.map((i=>{var o;return{safeText:vj(i).toLowerCase(),ariaLabel:((o=i.getAttribute("aria-label"))==null?void 0:o.toLowerCase().trim())||""}})))&&!Pgt(a,r)}var jfe=e=>!e||av(e,"html")||!p8(e),Mgt=(e,t)=>{if(!Ze||jfe(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,n=[e],s=e;s.parentNode&&!av(s,"body");)if(Igt(s.parentNode))n.push(s.parentNode.host),s=s.parentNode.host;else{var a=$gt(s);if(!a)break;if(t||Ife.indexOf(a.tagName.toLowerCase())>-1)r=!0;else{var i=Ze.getComputedStyle(a);i&&i.getPropertyValue("cursor")==="pointer"&&(r=!0)}n.push(a),s=a}return{parentIsUsefulElement:r,targetElementList:n}};function Lmn(e,t,r,n,s){var a,i,o,l;if(r===void 0&&(r=void 0),!Ze||jfe(e)||(a=r)!=null&&a.url_allowlist&&!A3e(r.url_allowlist)||(i=r)!=null&&i.url_ignorelist&&A3e(r.url_ignorelist))return!1;if((o=r)!=null&&o.dom_event_allowlist){var u=r.dom_event_allowlist;if(u&&!u.some((m=>t.type===m)))return!1}var{parentIsUsefulElement:d,targetElementList:p}=Mgt(e,n);if(!(function(m,g){var b=g?.element_allowlist;if(Ht(b))return!0;var v,S=function(k){if(b.some((_=>k.tagName.toLowerCase()===_)))return{v:!0}};for(var w of m)if(v=S(w))return v.v;return!1})(p,r)||!Pgt(p,(l=r)==null?void 0:l.css_selector_allowlist))return!1;var f=Ze.getComputedStyle(e);if(f&&f.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return d?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(Ife.indexOf(h)>-1||e.getAttribute("contenteditable")==="true")}}function gne(e){for(var t=e;t.parentNode&&!av(t,"body");t=t.parentNode){var r=q4(t);if(rs(r,"ph-sensitive")||rs(r,"ph-no-capture"))return!1}if(rs(q4(e),"ph-include"))return!0;var n=e.type||"";if(Do(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!(Do(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Lgt(e){return!!(av(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||av(e,"select")||av(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Fgt="(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})",Fmn=new RegExp("^(?:"+Fgt+")$"),Bmn=new RegExp(Fgt),Bgt="\\d{3}-?\\d{2}-?\\d{4}",zmn=new RegExp("^("+Bgt+")$"),Umn=new RegExp("("+Bgt+")");function dN(e,t){return t===void 0&&(t=!0),!(ma(e)||Do(e)&&(e=u8(e),(t?Fmn:Bmn).test((e||"").replace(/[- ]/g,""))||(t?zmn:Umn).test(e)))}function zgt(e){var t=vj(e);return dN(t=(t+" "+Ugt(e)).trim())?t:""}function Ugt(e){var t="";return e&&e.childNodes&&e.childNodes.length&&La(e.childNodes,(function(r){var n;if(r&&((n=r.tagName)==null?void 0:n.toLowerCase())==="span")try{var s=vj(r);t=(t+" "+s).trim(),r.childNodes&&r.childNodes.length&&(t=(t+" "+Ugt(r)).trim())}catch(a){Kt.error("[AutoCapture]",a)}})),t}function Vmn(e){return(function(t){var r=t.map((n=>{var s,a,i="";if(n.tag_name&&(i+=n.tag_name),n.attr_class)for(var o of(n.attr_class.sort(),n.attr_class))i+="."+o.replace(/"/g,"");var l=dr({},n.text?{text:n.text}:{},{"nth-child":(s=n.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(a=n.nth_of_type)!==null&&a!==void 0?a:0},n.href?{href:n.href}:{},n.attr_id?{attr_id:n.attr_id}:{},n.attributes),u={};return Z$(l).sort(((d,p)=>{var[f]=d,[h]=p;return f.localeCompare(h)})).forEach((d=>{var[p,f]=d;return u[I3e(p.toString())]=I3e(f.toString())})),i+=":",i+=Z$(u).map((d=>{var[p,f]=d;return p+'="'+f+'"'})).join("")}));return r.join(";")})((function(t){return t.map((r=>{var n,s,a={text:(n=r.$el_text)==null?void 0:n.slice(0,400),tag_name:r.tag_name,href:(s=r.attr__href)==null?void 0:s.slice(0,2048),attr_class:qmn(r),attr_id:r.attr__id,nth_child:r.nth_child,nth_of_type:r.nth_of_type,attributes:{}};return Z$(r).filter((i=>{var[o]=i;return o.indexOf("attr__")===0})).forEach((i=>{var[o,l]=i;return a.attributes[o]=l})),a}))})(e))}function I3e(e){return e.replace(/"|\\"/g,'\\"')}function qmn(e){var t=e.attr__class;return t?ka(t)?t:Nfe(t):void 0}class Vgt{constructor(t){this.disabled=t===!1;var r=qo(t)?t:{};this.thresholdPx=r.threshold_px||30,this.timeoutMs=r.timeout_ms||1e3,this.clickCount=r.click_count||3,this.clicks=[]}isRageClick(t,r,n){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(r-s.y)<this.thresholdPx&&n-s.timestamp<this.timeoutMs){if(this.clicks.push({x:t,y:r,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:r,timestamp:n}];return!1}}var YY="$copy_autocapture",Ig=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),H4=e=>{var t=Wt?.createElement("a");return Ht(t)?null:(t.href=e,t)},Hmn=function(e,t){var r,n;t===void 0&&(t="&");var s=[];return La(e,(function(a,i){Ht(a)||Ht(i)||i==="undefined"||(r=encodeURIComponent((o=>o instanceof File)(a)?a.name:a.toString()),n=encodeURIComponent(i),s[s.length]=n+"="+r)})),s.join(t)},Q4=function(e,t){for(var r,n=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<n.length;s++){var a=n[s].split("=");if(a[0]===t){r=a;break}}if(!ka(r)||r.length<2)return"";var i=r[1];try{i=decodeURIComponent(i)}catch{Kt.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},xj=function(e,t,r){if(!e||!t||!t.length)return e;for(var n=e.split("#"),s=n[0]||"",a=n[1],i=s.split("?"),o=i[1],l=i[0],u=(o||"").split("&"),d=[],p=0;p<u.length;p++){var f=u[p].split("=");ka(f)&&(t.includes(f[0])?d.push(f[0]+"="+r):d.push(u[p]))}var h=l;return o!=null&&(h+="?"+d.join("&")),a!=null&&(h+="#"+a),h},G4=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},j3e=Lo("[AutoCapture]");function KY(e,t){return t.length>e?t.slice(0,e)+"...":t}function Qmn(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!p8(t));return t}function Gmn(e,t,r,n){var s=e.tagName.toLowerCase(),a={tag_name:s};Ife.indexOf(s)>-1&&!r&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?a.$el_text=KY(1024,zgt(e)):a.$el_text=KY(1024,vj(e)));var i=q4(e);i.length>0&&(a.classes=i.filter((function(d){return d!==""}))),La(e.attributes,(function(d){var p;if((!Lgt(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(n==null||!n.includes(d.name))&&!t&&dN(d.value)&&(p=d.name,!Do(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var f=d.value;d.name==="class"&&(f=Nfe(f).join(" ")),a["attr__"+d.name]=KY(1024,f)}}));for(var o=1,l=1,u=e;u=Qmn(u);)o++,u.tagName===e.tagName&&l++;return a.nth_child=o,a.nth_of_type=l,a}function Zmn(e,t){for(var r,n,{e:s,maskAllElementAttributes:a,maskAllText:i,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,u=[e],d=e;d.parentNode&&!av(d,"body");)Igt(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var p,f=[],h={},m=!1,g=!1;if(La(u,(k=>{var _=gne(k);k.tagName.toLowerCase()==="a"&&(m=k.getAttribute("href"),m=_&&m&&dN(m)&&m),rs(q4(k),"ph-no-capture")&&(g=!0),f.push(Gmn(k,a,i,o));var C=(function(T){if(!gne(T))return{};var A={};return La(T.attributes,(function(N){if(N.name&&N.name.indexOf("data-ph-capture-attribute")===0){var I=N.name.replace("data-ph-capture-attribute-",""),R=N.value;I&&R&&dN(R)&&(A[I]=R)}})),A})(k);Wi(h,C)})),g)return{props:{},explicitNoCapture:g};if(i||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?f[0].$el_text=zgt(e):f[0].$el_text=vj(e)),m){var b,v;f[0].attr__href=m;var S=(b=H4(m))==null?void 0:b.host,w=Ze==null||(v=Ze.location)==null?void 0:v.host;S&&w&&S!==w&&(p=m)}return{props:Wi({$event_type:s.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:Vmn(f)},(r=f[0])!=null&&r.$el_text?{$el_text:(n=f[0])==null?void 0:n.$el_text}:{},p&&s.type==="click"?{$external_click_url:p}:{},h)}}class Wmn{constructor(t){this.P=!1,this.T=null,this.R=!1,this.instance=t,this.rageclicks=new Vgt(t.config.rageclick),this.I=null}get F(){var t,r,n=qo(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map((s=>new RegExp(s))),n.url_ignorelist=(r=n.url_ignorelist)==null?void 0:r.map((s=>new RegExp(s))),n}C(){if(this.isBrowserSupported()){if(Ze&&Wt){var t=n=>{n=n||Ze?.event;try{this.M(n)}catch(s){j3e.error("Failed to capture event",s)}};if(uo(Wt,"submit",t,{capture:!0}),uo(Wt,"change",t,{capture:!0}),uo(Wt,"click",t,{capture:!0}),this.F.capture_copied_text){var r=n=>{n=n||Ze?.event,this.M(n,YY)};uo(Wt,"copy",r,{capture:!0}),uo(Wt,"cut",r,{capture:!0})}}}else j3e.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.C(),this.P=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.R=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[E3e]:!!t.autocapture_opt_out}),this.T=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.I=t}getElementSelectors(t){var r,n=[];return(r=this.I)==null||r.forEach((s=>{var a=Wt?.querySelectorAll(s);a?.forEach((i=>{t===i&&n.push(s)}))})),n}get isEnabled(){var t,r,n=(t=this.instance.persistence)==null?void 0:t.props[E3e],s=this.T;if(_y(s)&&!nv(n)&&!this.instance.O())return!1;var a=(r=this.T)!==null&&r!==void 0?r:!!n;return!!this.instance.config.autocapture&&!a}M(t,r){if(r===void 0&&(r="$autocapture"),this.isEnabled){var n,s=Rgt(t);Ngt(s)&&(s=s.parentNode||null),r==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&Mmn(s,this.instance.config.rageclick)&&this.M(t,"$rageclick");var a=r===YY;if(s&&Lmn(s,t,this.F,a,a?["copy","cut"]:void 0)){var{props:i,explicitNoCapture:o}=Zmn(s,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.F.element_attribute_ignorelist,elementsChainAsString:this.R});if(o)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(i.$element_selectors=l),r===YY){var u,d=jgt(Ze==null||(u=Ze.getSelection())==null?void 0:u.toString()),p=t.type||"clipboard";if(!d)return!1;i.$selected_content=d,i.$copy_type=p}return this.instance.capture(r,i),!0}}}isBrowserSupported(){return rv(Wt?.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Sm(e)&&isFinite(e)&&Math.floor(e)===e});var R3e="0123456789abcdef";class Z4{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,r,n,s){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(s)||t<0||r<0||n<0||s<0||t>0xffffffffffff||r>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");var a=new Uint8Array(16);return a[0]=t/Math.pow(2,40),a[1]=t/Math.pow(2,32),a[2]=t/Math.pow(2,24),a[3]=t/Math.pow(2,16),a[4]=t/Math.pow(2,8),a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|n>>>24,a[9]=n>>>16,a[10]=n>>>8,a[11]=n,a[12]=s>>>24,a[13]=s>>>16,a[14]=s>>>8,a[15]=s,new Z4(a)}toString(){for(var t="",r=0;r<this.bytes.length;r++)t=t+R3e.charAt(this.bytes[r]>>>4)+R3e.charAt(15&this.bytes[r]),r!==3&&r!==5&&r!==7&&r!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Z4(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var r=0;r<16;r++){var n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}}class Xmn{constructor(){this.A=0,this.D=0,this.j=new Ymn}generate(){var t=this.generateOrAbort();if(Ht(t)){this.A=0;var r=this.generateOrAbort();if(Ht(r))throw new Error("Could not generate UUID after timestamp reset");return r}return t}generateOrAbort(){var t=Date.now();if(t>this.A)this.A=t,this.L();else{if(!(t+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return Z4.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var P3e,qgt=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};Ze&&!Ht(Ze.crypto)&&crypto.getRandomValues&&(qgt=e=>crypto.getRandomValues(e));class Ymn{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(qgt(this.N),this.U=0),this.N[this.U++]}}var Vb=()=>Kmn().toString(),Kmn=()=>(P3e||(P3e=new Xmn)).generate(),bC="",Jmn=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function egn(e,t){if(t){var r=(function(s,a){if(a===void 0&&(a=Wt),bC)return bC;if(!a||["localhost","127.0.0.1"].includes(s))return"";for(var i=s.split("."),o=Math.min(i.length,8),l="dmn_chk_"+Vb();!bC&&o--;){var u=i.slice(o).join("."),d=l+"=1;domain=."+u+";path=/";a.cookie=d+";max-age=3",a.cookie.includes(l)&&(a.cookie=d+";max-age=0",bC=u)}return bC})(e);if(!r){var n=(s=>{var a=s.match(Jmn);return a?a[0]:""})(e);n!==r&&Kt.info("Warning: cookie subdomain discovery mismatch",n,r),r=n}return r?"; domain=."+r:""}return""}var sm={H:()=>!!Wt,B:function(e){Kt.error("cookieStore error: "+e)},q:function(e){if(Wt){try{for(var t=e+"=",r=Wt.cookie.split(";").filter((a=>a.length)),n=0;n<r.length;n++){for(var s=r[n];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(t)===0)return decodeURIComponent(s.substring(t.length,s.length))}}catch{}return null}},W:function(e){var t;try{t=JSON.parse(sm.q(e))||{}}catch{}return t},G:function(e,t,r,n,s){if(Wt)try{var a="",i="",o=egn(Wt.location.hostname,n);if(r){var l=new Date;l.setTime(l.getTime()+24*r*60*60*1e3),a="; expires="+l.toUTCString()}s&&(i="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+a+"; SameSite=Lax; path=/"+o+i;return u.length>3686.4&&Kt.warn("cookieStore warning: large cookie, len="+u.length),Wt.cookie=u,u}catch{return}},V:function(e,t){if(Wt!=null&&Wt.cookie)try{sm.G(e,"",-1,t)}catch{return}}},JY=null,bi={H:function(){if(!_y(JY))return JY;var e=!0;if(Ht(Ze))e=!1;else try{var t="__mplssupport__";bi.G(t,"xyz"),bi.q(t)!=='"xyz"'&&(e=!1),bi.V(t)}catch{e=!1}return e||Kt.error("localStorage unsupported; falling back to cookie store"),JY=e,e},B:function(e){Kt.error("localStorage error: "+e)},q:function(e){try{return Ze?.localStorage.getItem(e)}catch(t){bi.B(t)}return null},W:function(e){try{return JSON.parse(bi.q(e))||{}}catch{}return null},G:function(e,t){try{Ze?.localStorage.setItem(e,JSON.stringify(t))}catch(r){bi.B(r)}},V:function(e){try{Ze?.localStorage.removeItem(e)}catch(t){bi.B(t)}}},tgn=["distinct_id",B4,Agt,V4,U4],VP=dr({},bi,{W:function(e){try{var t={};try{t=sm.W(e)||{}}catch{}var r=Wi(t,JSON.parse(bi.q(e)||"{}"));return bi.G(e,r),r}catch{}return null},G:function(e,t,r,n,s,a){try{bi.G(e,t,void 0,void 0,a);var i={};tgn.forEach((o=>{t[o]&&(i[o]=t[o])})),Object.keys(i).length&&sm.G(e,i,r,n,s,a)}catch(o){bi.B(o)}},V:function(e,t){try{Ze?.localStorage.removeItem(e),sm.V(e,t)}catch(r){bi.B(r)}}}),qP={},rgn={H:function(){return!0},B:function(e){Kt.error("memoryStorage error: "+e)},q:function(e){return qP[e]||null},W:function(e){return qP[e]||null},G:function(e,t){qP[e]=t},V:function(e){delete qP[e]}},Vx=null,fl={H:function(){if(!_y(Vx))return Vx;if(Vx=!0,Ht(Ze))Vx=!1;else try{var e="__support__";fl.G(e,"xyz"),fl.q(e)!=='"xyz"'&&(Vx=!1),fl.V(e)}catch{Vx=!1}return Vx},B:function(e){Kt.error("sessionStorage error: ",e)},q:function(e){try{return Ze?.sessionStorage.getItem(e)}catch(t){fl.B(t)}return null},W:function(e){try{return JSON.parse(fl.q(e))||null}catch{}return null},G:function(e,t){try{Ze?.sessionStorage.setItem(e,JSON.stringify(t))}catch(r){fl.B(r)}},V:function(e){try{Ze?.sessionStorage.removeItem(e)}catch(t){fl.B(t)}}},Og=(function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e})({});class ngn{constructor(t){this._instance=t}get F(){return this._instance.config}get consent(){return this.J()?Og.DENIED:this.K}isOptedOut(){return this.F.cookieless_mode==="always"||this.consent===Og.DENIED||this.consent===Og.PENDING&&(this.F.opt_out_capturing_by_default||this.F.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Og.DENIED}optInOut(t){this.Y.G(this.X,t?1:0,this.F.cookie_expiration,this.F.cross_subdomain_cookie,this.F.secure_cookie)}reset(){this.Y.V(this.X,this.F.cross_subdomain_cookie)}get X(){var{token:t,opt_out_capturing_cookie_prefix:r,consent_persistence_name:n}=this._instance.config;return n||(r?r+t:"__ph_opt_in_out_"+t)}get K(){var t=this.Y.q(this.X);return ZY(t)?Og.GRANTED:rs(omn,t)?Og.DENIED:Og.PENDING}get Y(){if(!this.Z){var t=this.F.opt_out_capturing_persistence_type;this.Z=t==="localStorage"?bi:sm;var r=t==="localStorage"?sm:bi;r.q(this.X)&&(this.Z.q(this.X)||this.optInOut(ZY(r.q(this.X))),r.V(this.X,this.F.cross_subdomain_cookie))}return this.Z}J(){return!!this.F.respect_dnt&&!!_gt([ud?.doNotTrack,ud?.msDoNotTrack,un.doNotTrack],(t=>ZY(t)))}}var HP=Lo("[Dead Clicks]"),sgn=()=>!0,agn=e=>{var t,r=!((t=e.instance.persistence)==null||!t.get_property(Tgt)),n=e.instance.config.capture_dead_clicks;return nv(n)?n:!!qo(n)||r};class Hgt{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(t,r,n){this.instance=t,this.isEnabled=r,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[Tgt]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(t){var r,n;(r=un.__PosthogExtensions__)!=null&&r.initDeadClicksAutocapture&&t(),(n=un.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?HP.error("failed to load script",s):t()}))}et(){var t;if(Wt){if(!this.tt&&(t=un.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var r=qo(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};r.__onCapture=this.onCapture,this.tt=un.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,r),this.tt.start(Wt),HP.info("starting...")}}else HP.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,HP.info("stopping..."))}}var vC=Lo("[ExceptionAutocapture]");class ign{constructor(t){var r,n,s;this.rt=()=>{var a;if(Ze&&this.isEnabled&&(a=un.__PosthogExtensions__)!=null&&a.errorWrappingFunctions){var i=un.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=un.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=un.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.F.capture_unhandled_errors&&(this.st=i(this.captureException.bind(this))),!this.nt&&this.F.capture_unhandled_rejections&&(this.nt=o(this.captureException.bind(this))),!this.ot&&this.F.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(u){vC.error("failed to start",u),this.lt()}}},this._instance=t,this.ut=!((r=this._instance.persistence)==null||!r.props[k3e]),this.F=this.ht(),this.vt=new lmn({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:vC}),this.startIfEnabled()}ht(){var t=this._instance.config.capture_exceptions,r={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return qo(t)?r=dr({},r,t):(Ht(t)?this.ut:t)&&(r=dr({},r,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),r}get isEnabled(){return this.F.capture_console_errors||this.F.capture_unhandled_errors||this.F.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(vC.info("enabled"),this.it(this.rt))}it(t){var r,n;(r=un.__PosthogExtensions__)!=null&&r.errorWrappingFunctions&&t(),(n=un.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return vC.error("failed to load script",s);t()}))}lt(){var t,r,n;(t=this.st)==null||t.call(this),this.st=void 0,(r=this.nt)==null||r.call(this),this.nt=void 0,(n=this.ot)==null||n.call(this),this.ot=void 0}onRemoteConfig(t){var r=t.autocaptureExceptions;this.ut=!!r||!1,this.F=this.ht(),this._instance.persistence&&this._instance.persistence.register({[k3e]:this.ut}),this.startIfEnabled()}captureException(t){var r,n,s=(r=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&r!==void 0?r:"Exception";this.vt.consumeRateLimit(s)?vC.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(t)}}function $3e(e,t,r){try{if(!(t in e))return()=>{};var n=e[t],s=r(n);return rv(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=n}}catch{return()=>{}}}class ogn{constructor(t){var r;this._instance=t,this.dt=(Ze==null||(r=Ze.location)==null?void 0:r.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Kt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,Kt.info("History API monitoring stopped")}monitorHistoryChanges(){var t,r;if(Ze&&Ze.history){var n=this;(t=Ze.history.pushState)!=null&&t.__posthog_wrapped__||$3e(Ze.history,"pushState",(s=>function(a,i,o){s.call(this,a,i,o),n.ft("pushState")})),(r=Ze.history.replaceState)!=null&&r.__posthog_wrapped__||$3e(Ze.history,"replaceState",(s=>function(a,i,o){s.call(this,a,i,o),n.ft("replaceState")})),this.gt()}}ft(t){try{var r,n=Ze==null||(r=Ze.location)==null?void 0:r.pathname;if(!n)return;n!==this.dt&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:t}),this.dt=n}catch(s){Kt.error("Error capturing "+t+" pageview",s)}}gt(){if(!this.ct){var t=()=>{this.ft("popstate")};uo(Ze,"popstate",t),this.ct=()=>{Ze&&Ze.removeEventListener("popstate",t)}}}}var eK=Lo("[SegmentIntegration]");function lgn(e,t){var r=e.config.segment;if(!r)return t();(function(n,s){var a=n.config.segment;if(!a)return s();var i=l=>{var u=()=>l.anonymousId()||Vb();n.config.get_device_id=u,l.id()&&(n.register({distinct_id:l.id(),$device_id:u()}),n.persistence.set_property(kg,"identified")),s()},o=a.user();"then"in o&&rv(o.then)?o.then((l=>i(l))):i(o)})(e,(()=>{r.register((n=>{Promise&&Promise.resolve||eK.warn("This browser does not have Promise support, and can not use the segment integration");var s=(a,i)=>{if(!i)return a;a.event.userId||a.event.anonymousId===n.get_distinct_id()||(eK.info("No userId set, resetting PostHog"),n.reset()),a.event.userId&&a.event.userId!==n.get_distinct_id()&&(eK.info("UserId set, identifying with PostHog"),n.identify(a.event.userId));var o=n.calculateEventProperties(i,a.event.properties);return a.event.properties=Object.assign({},o,a.event.properties),a};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:a=>s(a,a.event.event),page:a=>s(a,"$pageview"),identify:a=>s(a,"$identify"),screen:a=>s(a,"$screen")}})(e)).then((()=>{t()}))}))}var Qgt="posthog-js";function Ggt(e,t){var{organization:r,projectId:n,prefix:s,severityAllowList:a=["error"],sendExceptionsToPostHog:i=!0}=t===void 0?{}:t;return o=>{var l,u,d,p,f;if(!(a==="*"||a.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=((l=o.exception)==null?void 0:l.values)||[],g=m.map((v=>dr({},v,{stacktrace:v.stacktrace?dr({},v.stacktrace,{type:"raw",frames:(v.stacktrace.frames||[]).map((S=>dr({},S,{platform:"web:javascript"})))}):void 0}))),b={$exception_message:((u=m[0])==null?void 0:u.value)||o.message,$exception_type:(d=m[0])==null?void 0:d.type,$exception_level:o.level,$exception_list:g,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((p=m[0])==null?void 0:p.value)||o.message,$sentry_exception_type:(f=m[0])==null?void 0:f.type,$sentry_tags:o.tags};return r&&n&&(b.$sentry_url=(s||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+o.event_id),i&&e.exceptions.sendExceptionEvent(b),o}}class cgn{constructor(t,r,n,s,a,i){this.name=Qgt,this.setupOnce=function(o){o(Ggt(t,{organization:r,projectId:n,prefix:s,severityAllowList:a,sendExceptionsToPostHog:i==null||i}))}}}var ugn=Ze!=null&&Ze.location?G4(Ze.location.hash,"__posthog")||G4(location.hash,"state"):null,M3e="_postHogToolbarParams",L3e=Lo("[Toolbar]"),wb=(function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e})(wb||{});class dgn{constructor(t){this.instance=t}_t(t){un.ph_toolbar_state=t}yt(){var t;return(t=un.ph_toolbar_state)!==null&&t!==void 0?t:wb.UNINITIALIZED}maybeLoadToolbar(t,r,n){if(t===void 0&&(t=void 0),r===void 0&&(r=void 0),n===void 0&&(n=void 0),!Ze||!Wt)return!1;t=t??Ze.location,n=n??Ze.history;try{if(!r){try{Ze.localStorage.setItem("test","test"),Ze.localStorage.removeItem("test")}catch{return!1}r=Ze?.localStorage}var s,a=ugn||G4(t.hash,"__posthog")||G4(t.hash,"state"),i=a?w3e((()=>JSON.parse(atob(decodeURIComponent(a)))))||w3e((()=>JSON.parse(decodeURIComponent(a)))):null;return i&&i.action==="ph_authorize"?((s=i).source="url",s&&Object.keys(s).length>0&&(i.desiredHash?t.hash=i.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((s=JSON.parse(r.getItem(M3e)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}bt(t){var r=un.ph_load_toolbar||un.ph_load_editor;!ma(r)&&rv(r)?r(t,this.instance):L3e.warn("No toolbar load function found")}loadToolbar(t){var r=!(Wt==null||!Wt.getElementById(Dgt));if(!Ze||r)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=dr({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Ze.localStorage.setItem(M3e,JSON.stringify(dr({},s,{source:void 0}))),this.yt()===wb.LOADED)this.bt(s);else if(this.yt()===wb.UNINITIALIZED){var a;this._t(wb.LOADING),(a=un.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(i=>{if(i)return L3e.error("[Toolbar] Failed to load",i),void this._t(wb.UNINITIALIZED);this._t(wb.LOADED),this.bt(s)})),uo(Ze,"turbolinks:load",(()=>{this._t(wb.UNINITIALIZED),this.loadToolbar(s)}))}return!0}wt(t){return this.loadToolbar(t)}maybeLoadEditor(t,r,n){return t===void 0&&(t=void 0),r===void 0&&(r=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(t,r,n)}}var pgn=Lo("[TracingHeaders]");class fgn{constructor(t){this.xt=void 0,this.St=void 0,this.rt=()=>{var r,n;Ht(this.xt)&&((r=un.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null||r._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Ht(this.St)&&((n=un.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}it(t){var r,n;(r=un.__PosthogExtensions__)!=null&&r.tracingHeadersPatchFns&&t(),(n=un.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return pgn.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var t,r;this._instance.config.__add_tracing_headers?this.it(this.rt):((t=this.xt)==null||t.call(this),(r=this.St)==null||r.call(this),this.xt=void 0,this.St=void 0)}}var Dp="Mobile",W4="iOS",Qh="Android",pN="Tablet",Zgt=Qh+" "+pN,Wgt="iPad",Xgt="Apple",Ygt=Xgt+" Watch",fN="Safari",Uk="BlackBerry",Kgt="Samsung",Jgt=Kgt+"Browser",eyt=Kgt+" Internet",x1="Chrome",hgn=x1+" OS",tyt=x1+" "+W4,Rfe="Internet Explorer",ryt=Rfe+" "+Dp,Pfe="Opera",mgn=Pfe+" Mini",$fe="Edge",nyt="Microsoft "+$fe,OE="Firefox",syt=OE+" "+W4,hN="Nintendo",mN="PlayStation",_E="Xbox",ayt=Qh+" "+Dp,iyt=Dp+" "+fN,eT="Windows",yne=eT+" Phone",F3e="Nokia",bne="Ouya",oyt="Generic",ggn=oyt+" "+Dp.toLowerCase(),lyt=oyt+" "+pN.toLowerCase(),vne="Konqueror",gc="(\\d+(\\.\\d+)?)",tK=new RegExp("Version/"+gc),ygn=new RegExp(_E,"i"),bgn=new RegExp(mN+" \\w+","i"),vgn=new RegExp(hN+" \\w+","i"),Mfe=new RegExp(Uk+"|PlayBook|BB10","i"),xgn={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Sgn=(e,t)=>t&&rs(t,Xgt)||(function(r){return rs(r,fN)&&!rs(r,x1)&&!rs(r,Qh)})(e),cyt=function(e,t){return t=t||"",rs(e," OPR/")&&rs(e,"Mini")?mgn:rs(e," OPR/")?Pfe:Mfe.test(e)?Uk:rs(e,"IE"+Dp)||rs(e,"WPDesktop")?ryt:rs(e,Jgt)?eyt:rs(e,$fe)||rs(e,"Edg/")?nyt:rs(e,"FBIOS")?"Facebook "+Dp:rs(e,"UCWEB")||rs(e,"UCBrowser")?"UC Browser":rs(e,"CriOS")?tyt:rs(e,"CrMo")||rs(e,x1)?x1:rs(e,Qh)&&rs(e,fN)?ayt:rs(e,"FxiOS")?syt:rs(e.toLowerCase(),vne.toLowerCase())?vne:Sgn(e,t)?rs(e,Dp)?iyt:fN:rs(e,OE)?OE:rs(e,"MSIE")||rs(e,"Trident/")?Rfe:rs(e,"Gecko")?OE:""},wgn={[ryt]:[new RegExp("rv:"+gc)],[nyt]:[new RegExp($fe+"?\\/"+gc)],[x1]:[new RegExp("("+x1+"|CrMo)\\/"+gc)],[tyt]:[new RegExp("CriOS\\/"+gc)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+gc)],[fN]:[tK],[iyt]:[tK],[Pfe]:[new RegExp("(Opera|OPR)\\/"+gc)],[OE]:[new RegExp(OE+"\\/"+gc)],[syt]:[new RegExp("FxiOS\\/"+gc)],[vne]:[new RegExp("Konqueror[:/]?"+gc,"i")],[Uk]:[new RegExp(Uk+" "+gc),tK],[ayt]:[new RegExp("android\\s"+gc,"i")],[eyt]:[new RegExp(Jgt+"\\/"+gc)],[Rfe]:[new RegExp("(rv:|MSIE )"+gc)],Mozilla:[new RegExp("rv:"+gc)]},Egn=function(e,t){var r=cyt(e,t),n=wgn[r];if(Ht(n))return null;for(var s=0;s<n.length;s++){var a=n[s],i=e.match(a);if(i)return parseFloat(i[i.length-2])}return null},B3e=[[new RegExp(_E+"; "+_E+" (.*?)[);]","i"),e=>[_E,e&&e[1]||""]],[new RegExp(hN,"i"),[hN,""]],[new RegExp(mN,"i"),[mN,""]],[Mfe,[Uk,""]],[new RegExp(eT,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[yne,""];if(new RegExp(Dp).test(t)&&!/IEMobile\b/.test(t))return[eT+" "+Dp,""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var n=r[1],s=xgn[n]||"";return/arm/i.test(t)&&(s="RT"),[eT,s]}return[eT,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[W4,t.join(".")]}return[W4,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Ht(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Qh+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Qh+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Qh,t.join(".")]}return[Qh,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var r=[e[1],e[2],e[3]||"0"];t[1]=r.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[hgn,""]],[/Linux|debian/i,["Linux",""]]],z3e=function(e){return vgn.test(e)?hN:bgn.test(e)?mN:ygn.test(e)?_E:new RegExp(bne,"i").test(e)?bne:new RegExp("("+yne+"|WPDesktop)","i").test(e)?yne:/iPad/.test(e)?Wgt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ygt:Mfe.test(e)?Uk:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(F3e,"i").test(e)?F3e:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(Dp).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Qh:Zgt:Qh:new RegExp("(pda|"+Dp+")","i").test(e)?ggn:new RegExp(pN,"i").test(e)&&!new RegExp(pN+" pc","i").test(e)?lyt:""},QP="https?://(.*)",RO=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],kgn=jO(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],RO),Sj="<masked>",Ogn=["li_fat_id"];function uyt(e,t,r){if(!Wt)return{};var n,s=t?jO([],RO,r||[]):[],a=dyt(xj(Wt.URL,s,Sj),e),i=(n={},La(Ogn,(function(o){var l=sm.q(o);n[o]=l||null})),n);return Wi(i,a)}function dyt(e,t){var r=kgn.concat(t||[]),n={};return La(r,(function(s){var a=Q4(e,s);n[s]=a||null})),n}function pyt(e){var t=(function(a){return a?a.search(QP+"google.([^/?]*)")===0?"google":a.search(QP+"bing.com")===0?"bing":a.search(QP+"yahoo.com")===0?"yahoo":a.search(QP+"duckduckgo.com")===0?"duckduckgo":null:null})(e),r=t!="yahoo"?"q":"p",n={};if(!_y(t)){n.$search_engine=t;var s=Wt?Q4(Wt.referrer,r):"";s.length&&(n.ph_keyword=s)}return n}function U3e(){return navigator.language||navigator.userLanguage}function fyt(){return Wt?.referrer||"$direct"}function hyt(e,t){var r=e?jO([],RO,t||[]):[],n=au?.href.substring(0,1e3);return{r:fyt().substring(0,1e3),u:n?xj(n,r,Sj):void 0}}function myt(e){var t,{r,u:n}=e,s={$referrer:r,$referring_domain:r==null?void 0:r=="$direct"?"$direct":(t=H4(r))==null?void 0:t.host};if(n){s.$current_url=n;var a=H4(n);s.$host=a?.host,s.$pathname=a?.pathname;var i=dyt(n);Wi(s,i)}if(r){var o=pyt(r);Wi(s,o)}return s}function gyt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function _gn(){try{return new Date().getTimezoneOffset()}catch{return}}function Cgn(e,t){if(!Jc)return{};var r,n,s,a=e?jO([],RO,t||[]):[],[i,o]=(function(l){for(var u=0;u<B3e.length;u++){var[d,p]=B3e[u],f=d.exec(l),h=f&&(rv(p)?p(f,l):p);if(h)return h}return["",""]})(Jc);return Wi(Dfe({$os:i,$os_version:o,$browser:cyt(Jc,navigator.vendor),$device:z3e(Jc),$device_type:(n=Jc,s=z3e(n),s===Wgt||s===Zgt||s==="Kobo"||s==="Kindle Fire"||s===lyt?pN:s===hN||s===_E||s===mN||s===bne?"Console":s===Ygt?"Wearable":s?Dp:"Desktop"),$timezone:gyt(),$timezone_offset:_gn()}),{$current_url:xj(au?.href,a,Sj),$host:au?.host,$pathname:au?.pathname,$raw_user_agent:Jc.length>1e3?Jc.substring(0,997)+"...":Jc,$browser_version:Egn(Jc,navigator.vendor),$browser_language:U3e(),$browser_language_prefix:(r=U3e(),typeof r=="string"?r.split("-")[0]:void 0),$screen_height:Ze?.screen.height,$screen_width:Ze?.screen.width,$viewport_height:Ze?.innerHeight,$viewport_width:Ze?.innerWidth,$lib:"web",$lib_version:Eg.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var mb=Lo("[Web Vitals]"),V3e=9e5;class Tgn{constructor(t){var r;this.Et=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$t=()=>{clearTimeout(this.kt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((n,s)=>dr({},n,{["$web_vitals_"+s.name+"_event"]:dr({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=n=>{var s,a=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(Ht(a))mb.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.Tt();Ht(i)||(ma(n?.name)||ma(n?.value)?mb.error("Invalid metric received",n):this.Rt&&n.value>=this.Rt?mb.error("Ignoring metric with value >= "+this.Rt,n):(this.N.url!==i&&(this.$t(),this.kt=setTimeout(this.$t,this.flushToCaptureTimeoutMs)),Ht(this.N.url)&&(this.N.url=i),this.N.firstMetricTimestamp=Ht(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.N.metrics.push(dr({},n,{$current_url:i,$session_id:a.sessionId,$window_id:a.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.$t()))}},this.rt=()=>{var n,s,a,i,o=un.__PosthogExtensions__;Ht(o)||Ht(o.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:s,onFCP:a,onINP:i}=o.postHogWebVitalsCallbacks),n&&s&&a&&i?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Pt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Pt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Pt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.Pt.bind(this)),this.P=!0):mb.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.Et=!((r=this._instance.persistence)==null||!r.props[_3e]),this.startIfEnabled()}get allowedMetrics(){var t,r,n=qo(this._instance.config.capture_performance)?(t=this._instance.config.capture_performance)==null?void 0:t.web_vitals_allowed_metrics:void 0;return Ht(n)?((r=this._instance.persistence)==null?void 0:r.props[C3e])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(qo(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var t=qo(this._instance.config.capture_performance)&&Sm(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:V3e;return 0<t&&t<=6e4?V3e:t}get isEnabled(){var t=au?.protocol;if(t!=="http:"&&t!=="https:")return mb.info("Web Vitals are disabled on non-http/https protocols"),!1;var r=qo(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:nv(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return nv(r)?r:this.Et}startIfEnabled(){this.isEnabled&&!this.P&&(mb.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(t){var r=qo(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=qo(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[_3e]:r}),this._instance.persistence.register({[C3e]:n})),this.Et=r,this.startIfEnabled()}it(t){var r,n;(r=un.__PosthogExtensions__)!=null&&r.postHogWebVitalsCallbacks&&t(),(n=un.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"web-vitals",(s=>{s?mb.error("failed to load script",s):t()}))}Tt(){var t=Ze?Ze.location.href:void 0;if(t){var r=this._instance.config.mask_personal_data_properties,n=this._instance.config.custom_personal_data_properties,s=r?jO([],RO,n||[]):[];return xj(t,s,Sj)}mb.error("Could not determine current URL")}}var Agn=Lo("[Heatmaps]");function q3e(e){return qo(e)&&"clientX"in e&&"clientY"in e&&Sm(e.clientX)&&Sm(e.clientY)}class Dgn{constructor(t){var r;this.Et=!1,this.P=!1,this.It=null,this.instance=t,this.Et=!((r=this.instance.persistence)==null||!r.props[lne]),this.rageclicks=new Vgt(t.config.rageclick)}get flushIntervalMilliseconds(){var t=5e3;return qo(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Ht(this.instance.config.capture_heatmaps)?Ht(this.instance.config.enable_heatmaps)?this.Et:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;Agn.info("starting..."),this.Ft(),this.Ct()}else{var t;clearInterval((t=this.It)!==null&&t!==void 0?t:void 0),this.Mt(),this.getAndClearBuffer()}}onRemoteConfig(t){var r=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[lne]:r}),this.Et=r,this.startIfEnabled()}getAndClearBuffer(){var t=this.N;return this.N=void 0,t}Ot(t){this.At(t.originalEvent,"deadclick")}Ct(){this.It&&clearInterval(this.It),this.It=(function(t){return t?.visibilityState==="visible"})(Wt)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}Ft(){Ze&&Wt&&(this.jt=this.Dt.bind(this),uo(Ze,"beforeunload",this.jt),this.Lt=t=>this.At(t||Ze?.event),uo(Wt,"click",this.Lt,{capture:!0}),this.Nt=t=>this.Ut(t||Ze?.event),uo(Wt,"mousemove",this.Nt,{capture:!0}),this.zt=new Hgt(this.instance,sgn,this.Ot.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ct.bind(this),uo(Wt,"visibilitychange",this.Ht),this.P=!0)}Mt(){var t;Ze&&Wt&&(this.jt&&Ze.removeEventListener("beforeunload",this.jt),this.Lt&&Wt.removeEventListener("click",this.Lt,{capture:!0}),this.Nt&&Wt.removeEventListener("mousemove",this.Nt,{capture:!0}),this.Ht&&Wt.removeEventListener("visibilitychange",this.Ht),clearTimeout(this.Bt),(t=this.zt)==null||t.stop(),this.P=!1)}qt(t,r){var n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),i=(function(o,l,u){for(var d=o;d&&p8(d)&&!av(d,"body");){if(d===u)return!1;if(rs(l,Ze?.getComputedStyle(d).position))return!0;d=$gt(d)}return!1})(Rgt(t),["fixed","sticky"],a);return{x:t.clientX+(i?0:s),y:t.clientY+(i?0:n),target_fixed:i,type:r}}At(t,r){var n;if(r===void 0&&(r="click"),!T3e(t.target)&&q3e(t)){var s=this.qt(t,r);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.Wt(dr({},s,{type:"rageclick"})),this.Wt(s)}}Ut(t){!T3e(t.target)&&q3e(t)&&(clearTimeout(this.Bt),this.Bt=setTimeout((()=>{this.Wt(this.qt(t,"mousemove"))}),500))}Wt(t){if(Ze){var r=Ze.location.href,n=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,a=n?jO([],RO,s||[]):[],i=xj(r,a,Sj);this.N=this.N||{},this.N[i]||(this.N[i]=[]),this.N[i].push(t)}}Dt(){this.N&&!Qw(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Ngn{constructor(t){this._instance=t}doPageView(t,r){var n,s=this.Gt(t,r);return this.Vt={pathname:(n=Ze?.location.pathname)!==null&&n!==void 0?n:"",pageViewId:r,timestamp:t},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var r;return this.Gt(t,(r=this.Vt)==null?void 0:r.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.Vt)==null?void 0:t.pageViewId}}Gt(t,r){var n=this.Vt;if(!n)return{$pageview_id:r};var s={$pageview_id:r,$prev_pageview_id:n.pageViewId},a=this._instance.scrollManager.getContext();if(a&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:i,lastScrollY:o,maxScrollY:l,maxContentHeight:u,lastContentY:d,maxContentY:p}=a;if(!(Ht(i)||Ht(o)||Ht(l)||Ht(u)||Ht(d)||Ht(p))){i=Math.ceil(i),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d),p=Math.ceil(p);var f=i<=1?1:Hh(o/i,0,1,Kt),h=i<=1?1:Hh(l/i,0,1,Kt),m=u<=1?1:Hh(d/u,0,1,Kt),g=u<=1?1:Hh(p/u,0,1,Kt);s=Wi(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:m,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:g})}}return n.pathname&&(s.$prev_pageview_pathname=n.pathname),n.timestamp&&(s.$prev_pageview_duration=(t.getTime()-n.timestamp.getTime())/1e3),s}}var Np=Uint8Array,hu=Uint16Array,Vk=Uint32Array,Lfe=new Np([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]),Ffe=new Np([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]),H3e=new Np([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yyt=function(e,t){for(var r=new hu(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var s=new Vk(r[30]);for(n=1;n<30;++n)for(var a=r[n];a<r[n+1];++a)s[a]=a-r[n]<<5|n;return[r,s]},byt=yyt(Lfe,2),Ign=byt[0],xne=byt[1];Ign[28]=258,xne[258]=28;for(var Q3e=yyt(Ffe,0)[1],vyt=new hu(32768),Za=0;Za<32768;++Za){var qx=(43690&Za)>>>1|(21845&Za)<<1;qx=(61680&(qx=(52428&qx)>>>2|(13107&qx)<<2))>>>4|(3855&qx)<<4,vyt[Za]=((65280&qx)>>>8|(255&qx)<<8)>>>1}var WT=function(e,t,r){for(var n=e.length,s=0,a=new hu(t);s<n;++s)++a[e[s]-1];var i,o=new hu(t);for(s=0;s<t;++s)o[s]=o[s-1]+a[s-1]<<1;for(i=new hu(n),s=0;s<n;++s)i[s]=vyt[o[e[s]-1]++]>>>15-e[s];return i},S1=new Np(288);for(Za=0;Za<144;++Za)S1[Za]=8;for(Za=144;Za<256;++Za)S1[Za]=9;for(Za=256;Za<280;++Za)S1[Za]=7;for(Za=280;Za<288;++Za)S1[Za]=8;var X4=new Np(32);for(Za=0;Za<32;++Za)X4[Za]=5;var jgn=WT(S1,9),Rgn=WT(X4,5),xyt=function(e){return(e/8>>0)+(7&e&&1)},Syt=function(e,t,r){(r==null||r>e.length)&&(r=e.length);var n=new(e instanceof hu?hu:e instanceof Vk?Vk:Np)(r-t);return n.set(e.subarray(t,r)),n},hg=function(e,t,r){r<<=7&t;var n=t/8>>0;e[n]|=r,e[n+1]|=r>>>8},xC=function(e,t,r){r<<=7&t;var n=t/8>>0;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},rK=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var s=r.length,a=r.slice();if(!s)return[new Np(0),0];if(s==1){var i=new Np(r[0].s+1);return i[r[0].s]=1,[i,1]}r.sort((function(_,C){return _.f-C.f})),r.push({s:-1,f:25001});var o=r[0],l=r[1],u=0,d=1,p=2;for(r[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=s-1;)o=r[r[u].f<r[p].f?u++:p++],l=r[u!=d&&r[u].f<r[p].f?u++:p++],r[d++]={s:-1,f:o.f+l.f,l:o,r:l};var f=a[0].s;for(n=1;n<s;++n)a[n].s>f&&(f=a[n].s);var h=new hu(f+1),m=Sne(r[d-1],h,0);if(m>t){n=0;var g=0,b=m-t,v=1<<b;for(a.sort((function(_,C){return h[C.s]-h[_.s]||_.f-C.f}));n<s;++n){var S=a[n].s;if(!(h[S]>t))break;g+=v-(1<<m-h[S]),h[S]=t}for(g>>>=b;g>0;){var w=a[n].s;h[w]<t?g-=1<<t-h[w]++-1:++n}for(;n>=0&&g;--n){var k=a[n].s;h[k]==t&&(--h[k],++g)}m=t}return[new Np(h),m]},Sne=function(e,t,r){return e.s==-1?Math.max(Sne(e.l,t,r+1),Sne(e.r,t,r+1)):t[e.s]=r},G3e=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new hu(++t),n=0,s=e[0],a=1,i=function(l){r[n++]=l},o=1;o<=t;++o)if(e[o]==s&&o!=t)++a;else{if(!s&&a>2){for(;a>138;a-=138)i(32754);a>2&&(i(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(i(s),--a;a>6;a-=6)i(8304);a>2&&(i(a-3<<5|8208),a=0)}for(;a--;)i(s);a=1,s=e[o]}return[r.subarray(0,n),t]},SC=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},wne=function(e,t,r){var n=r.length,s=xyt(t+2);e[s]=255&n,e[s+1]=n>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var a=0;a<n;++a)e[s+a+4]=r[a];return 8*(s+4+n)},Z3e=function(e,t,r,n,s,a,i,o,l,u,d){hg(t,d++,r),++s[256];for(var p=rK(s,15),f=p[0],h=p[1],m=rK(a,15),g=m[0],b=m[1],v=G3e(f),S=v[0],w=v[1],k=G3e(g),_=k[0],C=k[1],T=new hu(19),A=0;A<S.length;++A)T[31&S[A]]++;for(A=0;A<_.length;++A)T[31&_[A]]++;for(var N=rK(T,7),I=N[0],R=N[1],$=19;$>4&&!I[H3e[$-1]];--$);var F,L,z,q,H=u+5<<3,V=SC(s,S1)+SC(a,X4)+i,G=SC(s,f)+SC(a,g)+i+14+3*$+SC(T,I)+(2*T[16]+3*T[17]+7*T[18]);if(H<=V&&H<=G)return wne(t,d,e.subarray(l,l+u));if(hg(t,d,1+(G<V)),d+=2,G<V){F=WT(f,h),L=f,z=WT(g,b),q=g;var M=WT(I,R);for(hg(t,d,w-257),hg(t,d+5,C-1),hg(t,d+10,$-4),d+=14,A=0;A<$;++A)hg(t,d+3*A,I[H3e[A]]);d+=3*$;for(var X=[S,_],U=0;U<2;++U){var j=X[U];for(A=0;A<j.length;++A){var Q=31&j[A];hg(t,d,M[Q]),d+=I[Q],Q>15&&(hg(t,d,j[A]>>>5&127),d+=j[A]>>>12)}}}else F=jgn,L=S1,z=Rgn,q=X4;for(A=0;A<o;++A)if(n[A]>255){Q=n[A]>>>18&31,xC(t,d,F[Q+257]),d+=L[Q+257],Q>7&&(hg(t,d,n[A]>>>23&31),d+=Lfe[Q]);var Z=31&n[A];xC(t,d,z[Z]),d+=q[Z],Z>3&&(xC(t,d,n[A]>>>5&8191),d+=Ffe[Z])}else xC(t,d,F[n[A]]),d+=L[n[A]];return xC(t,d,F[256]),d+L[256]},Pgn=new Vk([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),$gn=(function(){for(var e=new Vk(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e})(),Mgn=function(e,t,r,n,s){return(function(a,i,o,l,u,d){var p=a.length,f=new Np(l+p+5*(1+Math.floor(p/7e3))+u),h=f.subarray(l,f.length-u),m=0;if(!i||p<8)for(var g=0;g<=p;g+=65535){var b=g+65535;b<p?m=wne(h,m,a.subarray(g,b)):(h[g]=d,m=wne(h,m,a.subarray(g,p)))}else{for(var v=Pgn[i-1],S=v>>>13,w=8191&v,k=(1<<o)-1,_=new hu(32768),C=new hu(k+1),T=Math.ceil(o/3),A=2*T,N=function(xe){return(a[xe]^a[xe+1]<<T^a[xe+2]<<A)&k},I=new Vk(25e3),R=new hu(288),$=new hu(32),F=0,L=0,z=(g=0,0),q=0,H=0;g<p;++g){var V=N(g),G=32767&g,M=C[V];if(_[G]=M,C[V]=G,q<=g){var X=p-g;if((F>7e3||z>24576)&&X>423){m=Z3e(a,h,0,I,R,$,L,z,H,g-H,m),z=F=L=0,H=g;for(var U=0;U<286;++U)R[U]=0;for(U=0;U<30;++U)$[U]=0}var j=2,Q=0,Z=w,J=G-M&32767;if(X>2&&V==N(g-J))for(var ee=Math.min(S,X)-1,te=Math.min(32767,g),se=Math.min(258,X);J<=te&&--Z&&G!=M;){if(a[g+j]==a[g+j-J]){for(var ce=0;ce<se&&a[g+ce]==a[g+ce-J];++ce);if(ce>j){if(j=ce,Q=J,ce>ee)break;var Se=Math.min(J,ce-2),W=0;for(U=0;U<Se;++U){var ne=g-J+U+32768&32767,ae=ne-_[ne]+32768&32767;ae>W&&(W=ae,M=ne)}}}J+=(G=M)-(M=_[G])+32768&32767}if(Q){I[z++]=268435456|xne[j]<<18|Q3e[Q];var ge=31&xne[j],le=31&Q3e[Q];L+=Lfe[ge]+Ffe[le],++R[257+ge],++$[le],q=g+j,++F}else I[z++]=a[g],++R[a[g]]}}m=Z3e(a,h,d,I,R,$,L,z,H,g-H,m)}return Syt(f,0,l+xyt(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,r,n,!0)},nK=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function Lgn(e,t){t===void 0&&(t={});var r=(function(){var o=4294967295;return{p:function(l){for(var u=o,d=0;d<l.length;++d)u=$gn[255&u^l[d]]^u>>>8;o=u},d:function(){return 4294967295^o}}})(),n=e.length;r.p(e);var s,a=Mgn(e,t,10+((s=t).filename&&s.filename.length+1||0),8),i=a.length;return(function(o,l){var u=l.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=l.level<2?4:l.level==9?2:0,o[9]=3,l.mtime!=0&&nK(o,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),u){o[3]=8;for(var d=0;d<=u.length;++d)o[d+10]=u.charCodeAt(d)}})(a,t),nK(a,i-8,r.d()),nK(a,i-4,n),a}var Fgn=function(e){var t,r,n,s,a="";for(t=r=0,n=(e=(e+"").replace(/\r\n/g,`
613
613
  `).replace(/\r/g,`
614
614
  `)).length,s=0;s<n;s++){var i=e.charCodeAt(s),o=null;i<128?r++: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),_y(o)||(r>t&&(a+=e.substring(t,r)),a+=o,t=r=s+1)}return r>t&&(a+=e.substring(t,e.length)),a},Bgn=!!nne||!!rne,W3e="text/plain",Y4=function(e,t,r){var n;r===void 0&&(r=!0);var[s,a]=e.split("?"),i=dr({},t),o=(n=a?.split("&").map((u=>{var d,[p,f]=u.split("="),h=r&&(d=i[p])!==null&&d!==void 0?d:f;return delete i[p],p+"="+h})))!==null&&n!==void 0?n:[],l=Hmn(i);return l&&o.push(l),s+"?"+o.join("&")},tT=(e,t)=>JSON.stringify(e,((r,n)=>typeof n=="bigint"?n.toString():n),t),sK=e=>{var{data:t,compression:r}=e;if(t){if(r===Ig.GZipJS){var n=Lgn((function(l,u){var d=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var p=new Np(l.length+(l.length>>>1)),f=0,h=function(v){p[f++]=v},m=0;m<d;++m){if(f+5>p.length){var g=new Np(f+8+(d-m<<1));g.set(p),p=g}var b=l.charCodeAt(m);b<128||u?h(b):b<2048?(h(192|b>>>6),h(128|63&b)):b>55295&&b<57344?(h(240|(b=65536+(1047552&b)|1023&l.charCodeAt(++m))>>>18),h(128|b>>>12&63),h(128|b>>>6&63),h(128|63&b)):(h(224|b>>>12),h(128|b>>>6&63),h(128|63&b))}return Syt(p,0,f)})(tT(t)),{mtime:0}),s=new Blob([n],{type:W3e});return{contentType:W3e,body:s,estimatedSize:s.size}}if(r===Ig.Base64){var a=(function(l){var u,d,p,f,h,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,b=0,v="",S=[];if(!l)return l;l=Fgn(l);do u=(h=l.charCodeAt(g++)<<16|l.charCodeAt(g++)<<8|l.charCodeAt(g++))>>18&63,d=h>>12&63,p=h>>6&63,f=63&h,S[b++]=m.charAt(u)+m.charAt(d)+m.charAt(p)+m.charAt(f);while(g<l.length);switch(v=S.join(""),l.length%3){case 1:v=v.slice(0,-2)+"==";break;case 2:v=v.slice(0,-1)+"="}return v})(tT(t)),i=(l=>"data="+encodeURIComponent(typeof l=="string"?l:tT(l)))(a);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}var o=tT(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},W$=[];rne&&W$.push({transport:"fetch",method:e=>{var t,r,{contentType:n,body:s,estimatedSize:a}=(t=sK(e))!==null&&t!==void 0?t:{},i=new Headers;La(e.headers,(function(d,p){i.append(p,d)})),n&&i.append("Content-Type",n);var o=e.url,l=null;if(h3e){var u=new h3e;l={signal:u.signal,timeout:setTimeout((()=>u.abort()),e.timeout)}}rne(o,dr({method:e?.method||"GET",headers:i,keepalive:e.method==="POST"&&(a||0)<52428.8,body:s,signal:(r=l)==null?void 0:r.signal},e.fetchOptions)).then((d=>d.text().then((p=>{var f={statusCode:d.status,text:p};if(d.status===200)try{f.json=JSON.parse(p)}catch(h){Kt.error(h)}e.callback==null||e.callback(f)})))).catch((d=>{Kt.error(d),e.callback==null||e.callback({statusCode:0,text:d})})).finally((()=>l?clearTimeout(l.timeout):null))}}),nne&&W$.push({transport:"XHR",method:e=>{var t,r=new nne;r.open(e.method||"GET",e.url,!0);var{contentType:n,body:s}=(t=sK(e))!==null&&t!==void 0?t:{};La(e.headers,(function(a,i){r.setRequestHeader(i,a)})),n&&r.setRequestHeader("Content-Type",n),e.timeout&&(r.timeout=e.timeout),e.disableXHRCredentials||(r.withCredentials=!0),r.onreadystatechange=()=>{if(r.readyState===4){var a={statusCode:r.status,text:r.responseText};if(r.status===200)try{a.json=JSON.parse(r.responseText)}catch{}e.callback==null||e.callback(a)}},r.send(s)}}),ud!=null&&ud.sendBeacon&&W$.push({transport:"sendBeacon",method:e=>{var t=Y4(e.url,{beacon:"1"});try{var r,{contentType:n,body:s}=(r=sK(e))!==null&&r!==void 0?r:{},a=typeof s=="string"?new Blob([s],{type:n}):s;ud.sendBeacon(t,a)}catch{}}});var K4=function(e,t){if(!(function(r){try{new RegExp(r)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function X3e(e,t,r){return tT({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var wyt={exact:(e,t)=>t.some((r=>e.some((n=>r===n)))),is_not:(e,t)=>t.every((r=>e.every((n=>r!==n)))),regex:(e,t)=>t.some((r=>e.some((n=>K4(r,n))))),not_regex:(e,t)=>t.every((r=>e.every((n=>!K4(r,n))))),icontains:(e,t)=>t.map(GP).some((r=>e.map(GP).some((n=>r.includes(n))))),not_icontains:(e,t)=>t.map(GP).every((r=>e.map(GP).every((n=>!r.includes(n)))))},GP=e=>e.toLowerCase();function Eyt(e,t){return!e||Object.entries(e).every((r=>{var[n,s]=r,a=t?.[n];if(Ht(a)||_y(a))return!1;var i=[String(a)],o=wyt[s.operator];return!!o&&o(s.values,i)}))}var aK=Lo("[Error tracking]");class zgn{constructor(t){var r,n;this.Jt=[],this.Kt=new dmn([new xmn,new Amn,new wmn,new Smn,new Cmn,new _mn,new kmn,new Tmn],vmn("web:javascript",mmn,bmn)),this._instance=t,this.Jt=(r=(n=this._instance.persistence)==null?void 0:n.get_property(cne))!==null&&r!==void 0?r:[]}onRemoteConfig(t){var r,n,s,a=(r=(n=t.errorTracking)==null?void 0:n.suppressionRules)!==null&&r!==void 0?r:[],i=(s=t.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Jt=a,this._instance.persistence&&this._instance.persistence.register({[cne]:this.Jt,[O3e]:i})}get Yt(){var t,r=!!this._instance.get_property(O3e),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??r)!==null&&t!==void 0&&t}buildProperties(t,r){return this.Kt.buildFromUnknown(t,{syntheticException:r?.syntheticException,mechanism:{handled:r?.handled}})}sendExceptionEvent(t){var r=t.$exception_list;if(this.Xt(r)){if(this.Qt(r))return void aK.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(r))return void aK.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(r))return void aK.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(t){if(t.length===0)return!1;var r=t.reduce(((n,s)=>{var{type:a,value:i}=s;return Do(a)&&a.length>0&&n.$exception_types.push(a),Do(i)&&i.length>0&&n.$exception_values.push(i),n}),{$exception_types:[],$exception_values:[]});return this.Jt.some((n=>{var s=n.values.map((a=>{var i,o=wyt[a.operator],l=ka(a.value)?a.value:[a.value],u=(i=r[a.key])!==null&&i!==void 0?i:[];return l.length>0&&o(l,u)}));return n.type==="OR"?s.some(Boolean):s.every(Boolean)}))}Zt(t){return t.flatMap((r=>{var n,s;return(n=(s=r.stacktrace)==null?void 0:s.frames)!==null&&n!==void 0?n:[]})).some((r=>r.filename&&r.filename.startsWith("chrome-extension://")))}ti(t){if(t.length>0){var r,n,s,a,i=(r=(n=t[0].stacktrace)==null?void 0:n.frames)!==null&&r!==void 0?r:[],o=i[i.length-1];return(s=o==null||(a=o.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Xt(t){return!ma(t)&&ka(t)}}var cf=Lo("[FeatureFlags]"),wC=Lo("[FeatureFlags]",{debugEnabled:!0}),iK="$active_feature_flags",uw="$override_feature_flags",Y3e="$feature_flag_payloads",EC="$override_feature_flag_payloads",K3e="$feature_flag_request_id",J3e="$feature_flag_evaluated_at",eMe=e=>{var t={};for(var[r,n]of Z$(e||{}))n&&(t[r]=n);return t},Ugn=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((r=>{var n;return[r,(n=t[r].variant)!==null&&n!==void 0?n:t[r].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((r=>t[r].enabled)).filter((r=>{var n;return(n=t[r].metadata)==null?void 0:n.payload})).map((r=>{var n;return[r,(n=t[r].metadata)==null?void 0:n.payload]})))):cf.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e},Vgn=(function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e})({});class qgn{constructor(t){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=t,this.featureFlagEventHandlers=[]}li(){var t=this._instance.config.evaluation_environments;return t!=null&&t.length?t.filter((r=>{var n=r&&typeof r=="string"&&r.trim().length>0;return n||cf.error("Invalid evaluation environment found:",r,"Expected non-empty string"),n})):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var t=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.vi({disableFlags:t})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(une),r=this._instance.get_property(uw),n=this._instance.get_property(EC);if(!n&&!r)return t||{};var s=Wi({},t||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(r||{})])];for(var i of a){var o,l,u=s[i],d=r?.[i],p=Ht(d)?(o=u?.enabled)!==null&&o!==void 0&&o:!!d,f=Ht(d)?u.variant:typeof d=="string"?d:void 0,h=n?.[i],m=dr({},u,{enabled:p,variant:p?f??u?.variant:void 0});p!==u?.enabled&&(m.original_enabled=u?.enabled),f!==u?.variant&&(m.original_variant=u?.variant),h&&(m.metadata=dr({},u?.metadata,{payload:h,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),s[i]=m}return this.ii||(cf.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:s}),this.ii=!0),s}getFlagVariants(){var t=this._instance.get_property(Gw),r=this._instance.get_property(uw);if(!r)return t||{};for(var n=Wi({},t),s=Object.keys(r),a=0;a<s.length;a++)n[s[a]]=r[s[a]];return this.ii||(cf.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:r,finalFlags:n}),this.ii=!0),n}getFlagPayloads(){var t=this._instance.get_property(Y3e),r=this._instance.get_property(EC);if(!r)return t||{};for(var n=Wi({},t||{}),s=Object.keys(r),a=0;a<s.length;a++)n[s[a]]=r[s[a]];return this.ii||(cf.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:r,finalPayloads:n}),this.ii=!0),n}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout((()=>{this.vi()}),5))}di(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.si=t}vi(t){var r;if(this.di(),!this._instance.O())if(this.ri)this.ni=!0;else{var n={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:dr({},((r=this._instance.persistence)==null?void 0:r.get_initial_props())||{},this._instance.get_property(JC)||{}),group_properties:this._instance.get_property(Kx)};(t!=null&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.ui()&&(n.evaluation_environments=this.li());var s=this._instance.config.__preview_remote_config,a=s?"/flags/?v=2":"/flags/?v=2&config=true",i=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("flags",a+i);s&&(n.timezone=gyt()),this.ri=!0,this._instance.ci({method:"POST",url:o,data:n,compression:this._instance.config.disable_compression?void 0:Ig.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var u,d,p=!0;if(l.statusCode===200&&(this.ni||(this.$anon_distinct_id=void 0),p=!1),this.ri=!1,this.oi||(this.oi=!0,this._instance.fi((d=l.json)!==null&&d!==void 0?d:{})),!n.disable_flags||this.ni)if(this.ai=!p,l.json&&(u=l.json.quotaLimited)!=null&&u.includes(Vgn.FeatureFlags))cf.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 f;n.disable_flags||this.receivedFeatureFlags((f=l.json)!==null&&f!==void 0?f:{},p),this.ni&&(this.ni=!1,this.vi())}}})}}getFeatureFlag(t,r){if(r===void 0&&(r={}),this.ei||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants()[t],s=""+n,a=this._instance.get_property(K3e)||void 0,i=this._instance.get_property(J3e)||void 0,o=this._instance.get_property(z4)||{};if((r.send_event||!("send_event"in r))&&(!(t in o)||!o[t].includes(s))){var l,u,d,p,f,h,m,g,b;ka(o[t])?o[t].push(s):o[t]=[s],(l=this._instance.persistence)==null||l.register({[z4]:o});var v=this.getFeatureFlagDetails(t),S={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:i,$feature_flag_bootstrapped_response:((u=this._instance.config.bootstrap)==null||(u=u.featureFlags)==null?void 0:u[t])||null,$feature_flag_bootstrapped_payload:((d=this._instance.config.bootstrap)==null||(d=d.featureFlagPayloads)==null?void 0:d[t])||null,$used_bootstrap_value:!this.ai};Ht(v==null||(p=v.metadata)==null?void 0:p.version)||(S.$feature_flag_version=v.metadata.version);var w,k=(f=v==null||(h=v.reason)==null?void 0:h.description)!==null&&f!==void 0?f:v==null||(m=v.reason)==null?void 0:m.code;k&&(S.$feature_flag_reason=k),v!=null&&(g=v.metadata)!=null&&g.id&&(S.$feature_flag_id=v.metadata.id),Ht(v?.original_variant)&&Ht(v?.original_enabled)||(S.$feature_flag_original_response=Ht(v.original_variant)?v.original_enabled:v.original_variant),v!=null&&(b=v.metadata)!=null&&b.original_payload&&(S.$feature_flag_original_payload=v==null||(w=v.metadata)==null?void 0:w.original_payload),this._instance.capture("$feature_flag_called",S)}return n}cf.warn('getFeatureFlag for key "'+t+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,r){var n=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:n};this.ui()&&(s.evaluation_environments=this.li()),this._instance.ci({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:Ig.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:a=>{var i,o=(i=a.json)==null?void 0:i.featureFlagPayloads;r(o?.[t]||void 0)}})}isFeatureEnabled(t,r){if(r===void 0&&(r={}),this.ei||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(t,r);return Ht(n)?void 0:!!n}cf.warn('isFeatureEnabled for key "'+t+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((r=>r!==t))}receivedFeatureFlags(t,r){if(this._instance.persistence){this.ei=!0;var n=this.getFlagVariants(),s=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(i,o,l,u,d){l===void 0&&(l={}),u===void 0&&(u={}),d===void 0&&(d={});var p=Ugn(i),f=p.flags,h=p.featureFlags,m=p.featureFlagPayloads;if(h){var g=i.requestId,b=i.evaluatedAt;if(ka(h)){cf.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(h)for(var S=0;S<h.length;S++)v[h[S]]=!0;o&&o.register({[iK]:h,[Gw]:v})}else{var w=h,k=m,_=f;i.errorsWhileComputingFlags&&(w=dr({},l,w),k=dr({},u,k),_=dr({},d,_)),o&&o.register(dr({[iK]:Object.keys(eMe(w)),[Gw]:w||{},[Y3e]:k||{},[une]:_||{}},g?{[K3e]:g}:{},b?{[J3e]:b}:{}))}}})(t,this._instance.persistence,n,s,a),this.pi(r)}}override(t,r){r===void 0&&(r=!1),cf.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:r})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return cf.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this._instance.persistence.unregister(uw),this._instance.persistence.unregister(EC),this.pi(),wC.info("All overrides cleared");if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var r,n=t;if(this.ii=!!((r=n.suppressWarning)!==null&&r!==void 0&&r),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(uw),wC.info("Flag overrides cleared");else if(n.flags){if(ka(n.flags)){for(var s={},a=0;a<n.flags.length;a++)s[n.flags[a]]=!0;this._instance.persistence.register({[uw]:s})}else this._instance.persistence.register({[uw]:n.flags});wC.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(EC),wC.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[EC]:n.payloads}),wC.info("Payload overrides set",{payloads:n.payloads}))),void this.pi()}this.pi()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ei){var{flags:r,flagVariants:n}=this.gi();t(r,n)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,r,n){var s,a=(this._instance.get_property(KC)||[]).find((u=>u.flagKey===t)),i={["$feature_enrollment/"+t]:r},o={$feature_flag:t,$feature_enrollment:r,$set:i};a&&(o.$early_access_feature_name=a.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(i,!1);var l=dr({},this.getFlagVariants(),{[t]:r});(s=this._instance.persistence)==null||s.register({[iK]:Object.keys(eMe(l)),[Gw]:l}),this.pi()}getEarlyAccessFeatures(t,r,n){r===void 0&&(r=!1);var s=this._instance.get_property(KC),a=n?"&"+n.map((i=>"stage="+i)).join("&"):"";if(s&&!r)return t(s);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+a),method:"GET",callback:i=>{var o,l;if(i.json){var u=i.json.earlyAccessFeatures;return(o=this._instance.persistence)==null||o.unregister(KC),(l=this._instance.persistence)==null||l.register({[KC]:u}),t(u)}}})}gi(){var t=this.getFlags(),r=this.getFlagVariants();return{flags:t.filter((n=>r[n])),flagVariants:Object.keys(r).filter((n=>r[n])).reduce(((n,s)=>(n[s]=r[s],n)),{})}}pi(t){var{flags:r,flagVariants:n}=this.gi();this.featureFlagEventHandlers.forEach((s=>s(r,n,{errorsLoading:t})))}setPersonPropertiesForFlags(t,r){r===void 0&&(r=!0);var n=this._instance.get_property(JC)||{};this._instance.register({[JC]:dr({},n,t)}),r&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(JC)}setGroupPropertiesForFlags(t,r){r===void 0&&(r=!0);var n=this._instance.get_property(Kx)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((s=>{n[s]=dr({},n[s],t[s]),delete t[s]})),this._instance.register({[Kx]:dr({},n,t)}),r&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var r=this._instance.get_property(Kx)||{};this._instance.register({[Kx]:dr({},r,{[t]:{}})})}else this._instance.unregister(Kx)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.di(),this.ii=!1}}var Hgn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class oK{constructor(t,r){this.F=t,this.props={},this.mi=!1,this.yi=(n=>{var s="";return n.token&&(s=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+s+"_posthog"})(t),this.Y=this.bi(t),this.load(),t.debug&&Kt.info("Persistence loaded",t.persistence,dr({},this.props)),this.update_config(t,t,r),this.save()}isDisabled(){return!!this.wi}bi(t){Hgn.indexOf(t.persistence.toLowerCase())===-1&&(Kt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var r=t.persistence.toLowerCase();return r==="localstorage"&&bi.H()?bi:r==="localstorage+cookie"&&VP.H()?VP:r==="sessionstorage"&&fl.H()?fl:r==="memory"?rgn:r==="cookie"?sm:VP.H()?VP:sm}properties(){var t={};return La(this.props,(function(r,n){if(n===Gw&&qo(r))for(var s=Object.keys(r),a=0;a<s.length;a++)t["$feature/"+s[a]]=r[s[a]];else o=n,l=!1,(_y(i=Pmn)?l:f3e&&i.indexOf===f3e?i.indexOf(o)!=-1:(La(i,(function(u){if(l||(l=u===o))return F4})),l))||(t[n]=r);var i,o,l})),t}load(){if(!this.wi){var t=this.Y.W(this.yi);t&&(this.props=Wi({},t))}}save(){this.wi||this.Y.G(this.yi,this.props,this.xi,this.Si,this.Ei,this.F.debug)}remove(){this.Y.V(this.yi,!1),this.Y.V(this.yi,!0)}clear(){this.remove(),this.props={}}register_once(t,r,n){if(qo(t)){Ht(r)&&(r="None"),this.xi=Ht(n)?this.$i:n;var s=!1;if(La(t,((a,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==r||(this.props[i]=a,s=!0)})),s)return this.save(),!0}return!1}register(t,r){if(qo(t)){this.xi=Ht(r)?this.$i:r;var n=!1;if(La(t,((s,a)=>{t.hasOwnProperty(a)&&this.props[a]!==s&&(this.props[a]=s,n=!0)})),n)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.mi){var t=uyt(this.F.custom_campaign_params,this.F.mask_personal_data_properties,this.F.custom_personal_data_properties);Qw(Dfe(t))||this.register(t),this.mi=!0}}update_search_keyword(){var t;this.register((t=Wt?.referrer)?pyt(t):{})}update_referrer_info(){var t;this.register_once({$referrer:fyt(),$referring_domain:Wt!=null&&Wt.referrer&&((t=H4(Wt.referrer))==null?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[hne]||this.props[mne]||this.register_once({[U4]:hyt(this.F.mask_personal_data_properties,this.F.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};La([mne,hne],(i=>{var o=this.props[i];o&&La(o,(function(l,u){t["$initial_"+sne(u)]=l}))}));var r,n,s=this.props[U4];if(s){var a=(r=myt(s),n={},La(r,(function(i,o){n["$initial_"+sne(o)]=i})),n);Wi(t,a)}return t}safe_merge(t){return La(this.props,(function(r,n){n in t||(t[n]=r)})),t}update_config(t,r,n){if(this.$i=this.xi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!n),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==r.persistence){var s=this.bi(t),a=this.props;this.clear(),this.Y=s,this.props=a,this.save()}}set_disabled(t){this.wi=t,this.wi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Si&&(this.Si=t,this.remove(),this.save())}set_secure(t){t!==this.Ei&&(this.Ei=t,this.remove(),this.save())}set_event_timer(t,r){var n=this.props[YC]||{};n[t]=r,this.props[YC]=n,this.save()}remove_event_timer(t){var r=(this.props[YC]||{})[t];return Ht(r)||(delete this.props[YC][t],this.save()),r}get_property(t){return this.props[t]}set_property(t,r){this.props[t]=r,this.save()}}var kC=(function(e){return e.Activation="events",e.Cancellation="cancelEvents",e})({});(function(e){return e.Button="button",e.Tab="tab",e.Selector="selector",e})({});(function(e){return e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger",e})({});(function(e){return e.Top="top",e.Left="left",e.Right="right",e.Bottom="bottom",e})({});var lK=(function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e})({});(function(e){return e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link",e})({});(function(e){return e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question",e})({});(function(e){return e.Once="once",e.Recurring="recurring",e.Always="always",e})({});var X$=(function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e})({}),tMe=(function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e})({}),kyt=(function(e){return e.Popover="popover",e.Inline="inline",e})({});class Bfe{constructor(){this.ki={},this.ki={}}on(t,r){return this.ki[t]||(this.ki[t]=[]),this.ki[t].push(r),()=>{this.ki[t]=this.ki[t].filter((n=>n!==r))}}emit(t,r){for(var n of this.ki[t]||[])n(r);for(var s of this.ki["*"]||[])s(t,r)}}function dw(e,t,r){if(ma(e))return!1;switch(r){case"exact":return e===t;case"contains":var n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class Qgn{constructor(t){this.Pi=new Bfe,this.Ti=(r,n)=>this.Ri(r,n)&&this.Ii(r,n)&&this.Fi(r,n)&&this.Ci(r,n),this.Ri=(r,n)=>n==null||!n.event||r?.event===n?.event,this._instance=t,this.Mi=new Set,this.Oi=new Set}init(){var t;if(!Ht((t=this._instance)==null?void 0:t.Ai)){var r;(r=this._instance)==null||r.Ai(((n,s)=>{this.on(n,s)}))}}register(t){var r,n;if(!Ht((r=this._instance)==null?void 0:r.Ai)&&(t.forEach((i=>{var o,l;(o=this.Oi)==null||o.add(i),(l=i.steps)==null||l.forEach((u=>{var d;(d=this.Mi)==null||d.add(u?.event||"")}))})),(n=this._instance)!=null&&n.autocapture)){var s,a=new Set;t.forEach((i=>{var o;(o=i.steps)==null||o.forEach((l=>{l!=null&&l.selector&&a.add(l?.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(a)}}on(t,r){var n;r!=null&&t.length!=0&&(this.Mi.has(t)||this.Mi.has(r?.event))&&this.Oi&&((n=this.Oi)==null?void 0:n.size)>0&&this.Oi.forEach((s=>{this.Di(r,s)&&this.Pi.emit("actionCaptured",s.name)}))}ji(t){this.onAction("actionCaptured",(r=>t(r)))}Di(t,r){if(r?.steps==null)return!1;for(var n of r.steps)if(this.Ti(t,n))return!0;return!1}onAction(t,r){return this.Pi.on(t,r)}Ii(t,r){if(r!=null&&r.url){var n,s=t==null||(n=t.properties)==null?void 0:n.$current_url;if(!s||typeof s!="string"||!dw(s,r.url,r.url_matching||"contains"))return!1}return!0}Fi(t,r){return!!this.Li(t,r)&&!!this.Ni(t,r)&&!!this.Ui(t,r)}Li(t,r){var n;if(r==null||!r.href)return!0;var s=this.zi(t);if(s.length>0)return s.some((o=>dw(o.href,r.href,r.href_matching||"exact")));var a,i=(t==null||(n=t.properties)==null?void 0:n.$elements_chain)||"";return!!i&&dw((a=i.match(/(?::|")href="(.*?)"/))?a[1]:"",r.href,r.href_matching||"exact")}Ni(t,r){var n;if(r==null||!r.text)return!0;var s=this.zi(t);if(s.length>0)return s.some((u=>dw(u.text,r.text,r.text_matching||"exact")||dw(u.$el_text,r.text,r.text_matching||"exact")));var a,i,o,l=(t==null||(n=t.properties)==null?void 0:n.$elements_chain)||"";return!!l&&(a=(function(u){for(var d,p=[],f=/(?::|")text="(.*?)"/g;!ma(d=f.exec(u));)p.includes(d[1])||p.push(d[1]);return p})(l),i=r.text,o=r.text_matching||"exact",a.some((u=>dw(u,i,o))))}Ui(t,r){var n,s;if(r==null||!r.selector)return!0;var a=t==null||(n=t.properties)==null?void 0:n.$element_selectors;if(a!=null&&a.includes(r.selector))return!0;var i=(t==null||(s=t.properties)==null?void 0:s.$elements_chain)||"";if(r.selector_regex&&i)try{return new RegExp(r.selector_regex).test(i)}catch{return!1}return!1}zi(t){var r;return(t==null||(r=t.properties)==null?void 0:r.$elements)==null?[]:t?.properties.$elements}Ci(t,r){return r==null||!r.properties||r.properties.length===0||Eyt(r.properties.reduce(((n,s)=>{var a=ka(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return n[s.key]={values:a,operator:s.operator||"exact"},n}),{}),t?.properties)}}var Xs=Lo("[Surveys]"),Ene="seenSurvey_",Ggn=(e,t)=>{var r="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(r="$survey_"+t+"/"+e.id+"/"+e.current_iteration),r},rMe=e=>{var t=""+Ene+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+Ene+e.id+"_"+e.current_iteration),t},Zgn=[lK.Popover,lK.Widget,lK.API],Wgn={ignoreConditions:!1,ignoreDelay:!1,displayType:kyt.Popover};class Xgn{constructor(t){this._instance=t,this.Hi=new Map,this.Bi=new Map,this.qi=new Map}Wi(t,r){return!!t&&Eyt(t.propertyFilters,r?.properties)}Gi(t,r){var n=new Map;return t.forEach((s=>{var a;(a=s.conditions)==null||(a=a[r])==null||(a=a.values)==null||a.forEach((i=>{if(i!=null&&i.name){var o=n.get(i.name)||[];o.push(s.id),n.set(i.name,o)}}))})),n}Vi(t,r,n){var s,a=(n===kC.Activation?this.Hi:this.Bi).get(t),i=[];return(s=this._instance)==null||s.getSurveys((o=>{i=o.filter((l=>a?.includes(l.id)))})),i.filter((o=>{var l,u=(l=o.conditions)==null||(l=l[n])==null||(l=l.values)==null?void 0:l.find((d=>d.name===t));return this.Wi(u,r)}))}register(t){var r;Ht((r=this._instance)==null?void 0:r.Ai)||(this.Ji(t),this.Ki(t))}Ki(t){var r=t.filter((n=>{var s,a;return((s=n.conditions)==null?void 0:s.actions)&&((a=n.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0}));r.length!==0&&(this.Yi==null&&(this.Yi=new Qgn(this._instance),this.Yi.init(),this.Yi.ji((n=>{this.onAction(n)}))),r.forEach((n=>{var s,a,i,o,l;n.conditions&&(s=n.conditions)!=null&&s.actions&&(a=n.conditions)!=null&&(a=a.actions)!=null&&a.values&&((i=n.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0&&((o=this.Yi)==null||o.register(n.conditions.actions.values),(l=n.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((u=>{if(u&&u.name){var d=this.qi.get(u.name);d&&d.push(n.id),this.qi.set(u.name,d||[n.id])}})))})))}Ji(t){var r,n=t.filter((a=>{var i,o;return((i=a.conditions)==null?void 0:i.events)&&((o=a.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0})),s=t.filter((a=>{var i,o;return((i=a.conditions)==null?void 0:i.cancelEvents)&&((o=a.conditions)==null||(o=o.cancelEvents)==null||(o=o.values)==null?void 0:o.length)>0}));(n.length!==0||s.length!==0)&&((r=this._instance)==null||r.Ai(((a,i)=>{this.onEvent(a,i)})),this.Hi=this.Gi(t,kC.Activation),this.Bi=this.Gi(t,kC.Cancellation))}onEvent(t,r){var n,s=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[UP])||[];if(X$.SHOWN===t&&r&&s.length>0){var a;Xs.info("survey event matched, removing survey from activated surveys",{event:t,eventPayload:r,existingActivatedSurveys:s});var i=r==null||(a=r.properties)==null?void 0:a.$survey_id;if(i){var o=s.indexOf(i);o>=0&&(s.splice(o,1),this.Xi(s))}}else{if(this.Bi.has(t)){var l=this.Vi(t,r,kC.Cancellation);l.length>0&&(Xs.info("cancel event matched, cancelling surveys",{event:t,surveysToCancel:l.map((d=>d.id))}),l.forEach((d=>{var p,f=s.indexOf(d.id);f>=0&&s.splice(f,1),(p=this._instance)==null||p.cancelPendingSurvey(d.id)})),this.Xi(s))}if(this.Hi.has(t)){Xs.info("survey event name matched",{event:t,eventPayload:r,surveys:this.Hi.get(t)});var u=this.Vi(t,r,kC.Activation);this.Xi(s.concat(u.map((d=>d.id))||[]))}}}onAction(t){var r,n=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[UP])||[];this.qi.has(t)&&this.Xi(n.concat(this.qi.get(t)||[]))}Xi(t){var r;Xs.info("updating activated surveys",{activatedSurveys:t}),(r=this._instance)==null||(r=r.persistence)==null||r.register({[UP]:[...new Set(t)]})}getSurveys(){var t,r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[UP];return r||[]}getEventToSurveys(){return this.Hi}Qi(){return this.Yi}}class Ygn{constructor(t){this.Zi=void 0,this._surveyManager=null,this.te=!1,this.ie=!1,this.ee=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var r=t.surveys;if(ma(r))return Xs.warn("Flags not loaded yet. Not loading surveys.");var n=ka(r);this.Zi=n?r.length>0:r,Xs.info("flags response received, isSurveysEnabled: "+this.Zi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);(n!=null&&n.startsWith(Ene)||n!=null&&n.startsWith("inProgressSurvey_"))&&t.push(n)}t.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.ie)Xs.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Xs.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Xs.info("Not loading surveys in cookieless mode without consent.");else{var t=un?.__PosthogExtensions__;if(t){if(!Ht(this.Zi)||this._instance.config.advanced_enable_surveys){var r=this.Zi||this._instance.config.advanced_enable_surveys;this.ie=!0;try{var n=t.generateSurveys;if(n)return void this.re(n,r);var s=t.loadExternalDependency;if(!s)return void this.se("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",(a=>{a||!t.generateSurveys?this.se("Could not load surveys script",a):this.re(t.generateSurveys,r)}))}catch(a){throw this.se("Error initializing surveys",a),a}finally{this.ie=!1}}}else Xs.error("PostHog Extensions not found.")}}re(t,r){this._surveyManager=t(this._instance,r),this._surveyEventReceiver=new Xgn(this._instance),Xs.info("Surveys loaded successfully"),this.ne({isLoaded:!0})}se(t,r){Xs.error(t,r),this.ne({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ee.push(t),this._surveyManager&&this.ne({isLoaded:!0}),()=>{this.ee=this.ee.filter((r=>r!==t))}}getSurveys(t,r){if(r===void 0&&(r=!1),this._instance.config.disable_surveys)return Xs.info("Disabled. Not loading surveys."),t([]);var n=this._instance.get_property(dne);if(n&&!r)return t(n,{isLoaded:!0});if(this.te)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.te=!0,this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var a;this.te=!1;var i=s.statusCode;if(i!==200||!s.json){var o="Surveys API could not be loaded, status: "+i;return Xs.error(o),t([],{isLoaded:!1,error:o})}var l,u=s.json.surveys||[],d=u.filter((p=>(function(f){return!(!f.start_date||f.end_date)})(p)&&((function(f){var h;return!((h=f.conditions)==null||(h=h.events)==null||(h=h.values)==null||!h.length)})(p)||(function(f){var h;return!((h=f.conditions)==null||(h=h.actions)==null||(h=h.values)==null||!h.length)})(p))));return d.length>0&&((l=this._surveyEventReceiver)==null||l.register(d)),(a=this._instance.persistence)==null||a.register({[dne]:u}),t(u,{isLoaded:!0})}})}catch(s){throw this.te=!1,s}}ne(t){for(var r of this.ee)try{if(!t.isLoaded)return r([],t);this.getSurveys(r)}catch(n){Xs.error("Error in survey callback",n)}}getActiveMatchingSurveys(t,r){if(r===void 0&&(r=!1),!ma(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,r);Xs.warn("init was not called")}oe(t){var r=null;return this.getSurveys((n=>{var s;r=(s=n.find((a=>a.id===t)))!==null&&s!==void 0?s:null})),r}ae(t){if(ma(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var r=typeof t=="string"?this.oe(t):t;return r?this._surveyManager.checkSurveyEligibility(r):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(ma(this._surveyManager))return Xs.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var r=this.ae(t);return{visible:r.eligible,disabledReason:r.reason}}canRenderSurveyAsync(t,r){return ma(this._surveyManager)?(Xs.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((s=>{var a,i=(a=s.find((l=>l.id===t)))!==null&&a!==void 0?a:null;if(i){var o=this.ae(i);n({visible:o.eligible,disabledReason:o.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),r)}))}renderSurvey(t,r){var n;if(ma(this._surveyManager))Xs.warn("init was not called");else{var s=typeof t=="string"?this.oe(t):t;if(s!=null&&s.id)if(Zgn.includes(s.type)){var a=Wt?.querySelector(r);if(a)return(n=s.appearance)!=null&&n.surveyPopupDelaySeconds?(Xs.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var i,o;Xs.info("Rendering survey "+s.id+" with delay of "+((i=s.appearance)==null?void 0:i.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(s,a),Xs.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,a);Xs.warn("Survey element not found")}else Xs.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Xs.warn("Survey not found")}}displaySurvey(t,r){var n;if(ma(this._surveyManager))Xs.warn("init was not called");else{var s=this.oe(t);if(s){var a=s;if((n=s.appearance)!=null&&n.surveyPopupDelaySeconds&&r.ignoreDelay&&(a=dr({},s,{appearance:dr({},s.appearance,{surveyPopupDelaySeconds:0})})),r.ignoreConditions===!1){var i=this.canRenderSurvey(s);if(!i.visible)return void Xs.warn("Survey is not eligible to be displayed: ",i.disabledReason)}r.displayType!==kyt.Inline?this._surveyManager.handlePopoverSurvey(a):this.renderSurvey(a,r.selector)}else Xs.warn("Survey not found")}}cancelPendingSurvey(t){ma(this._surveyManager)?Xs.warn("init was not called"):this._surveyManager.cancelSurvey(t)}}var nMe=Lo("[RateLimiter]");class Kgn{constructor(t){var r,n;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=s=>{var a=s.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach((i=>{nMe.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void nMe.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:a})}},this.instance=t,this.captureEventsPerSecond=((r=t.config.rate_limiting)==null?void 0:r.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((n=t.config.rate_limiting)==null?void 0:n.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var r,n,s;t===void 0&&(t=!1);var a=new Date().getTime(),i=(r=(n=this.instance.persistence)==null?void 0:n.get_property(fne))!==null&&r!==void 0?r:{tokens:this.captureEventsBurstLimit,last:a};i.tokens+=(a-i.last)/1e3*this.captureEventsPerSecond,i.last=a,i.tokens>this.captureEventsBurstLimit&&(i.tokens=this.captureEventsBurstLimit);var o=i.tokens<1;return o||t||(i.tokens=Math.max(0,i.tokens-1)),!o||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(s=this.instance.persistence)==null||s.set_property(fne,i),{isRateLimited:o,remainingTokens:i.tokens}}isServerRateLimited(t){var r=this.serverLimits[t||"events"]||!1;return r!==!1&&new Date().getTime()<r}}var Hx=Lo("[RemoteConfig]");class Jgn{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=un._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}le(t){var r,n;(r=un.__PosthogExtensions__)!=null&&r.loadExternalDependency?(n=un.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):(Hx.error("PostHog Extensions not found. Cannot load remote config."),t())}ue(t){this._instance.ci({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:r=>{t(r.json)}})}load(){try{if(this.remoteConfig)return Hx.info("Using preloaded remote config",this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.O())return void Hx.warn("Remote config is disabled. Falling back to local config.");this.le((t=>{if(!t)return Hx.info("No config found after loading remote JS config. Falling back to JSON."),void this.ue((r=>{this.fi(r)}));this.fi(t)}))}catch(t){Hx.error("Error loading remote config",t)}}fi(t){t?this._instance.config.__preview_remote_config?(this._instance.fi(t),t.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Hx.info("__preview_remote_config is disabled. Logging config instead",t):Hx.error("Failed to fetch remote config from PostHog.")}}var kne=3e3;class eyn{constructor(t,r){this.he=!0,this.ve=[],this.de=Hh(r?.flush_interval_ms||kne,250,5e3,Kt.createLogger("flush interval"),kne),this.ce=t}enqueue(t){this.ve.push(t),this.fe||this.pe()}unload(){this.ge();var t=this.ve.length>0?this._e():{},r=Object.values(t);[...r.filter((n=>n.url.indexOf("/e")===0)),...r.filter((n=>n.url.indexOf("/e")!==0))].map((n=>{this.ce(dr({},n,{transport:"sendBeacon"}))}))}enable(){this.he=!1,this.pe()}pe(){var t=this;this.he||(this.fe=setTimeout((()=>{if(this.ge(),this.ve.length>0){var r=this._e(),n=function(){var a=r[s],i=new Date().getTime();a.data&&ka(a.data)&&La(a.data,(o=>{o.offset=Math.abs(o.timestamp-i),delete o.timestamp})),t.ce(a)};for(var s in r)n()}}),this.de))}ge(){clearTimeout(this.fe),this.fe=void 0}_e(){var t={};return La(this.ve,(r=>{var n,s=r,a=(s?s.batchKey:null)||s.url;Ht(t[a])&&(t[a]=dr({},s,{data:[]})),(n=t[a].data)==null||n.push(s.data)})),this.ve=[],t}}var tyn=["retriesPerformedSoFar"];class ryn{constructor(t){this.me=!1,this.ye=3e3,this.ve=[],this._instance=t,this.ve=[],this.be=!0,!Ht(Ze)&&"onLine"in Ze.navigator&&(this.be=Ze.navigator.onLine,this.we=()=>{this.be=!0,this.Dt()},this.xe=()=>{this.be=!1},uo(Ze,"online",this.we),uo(Ze,"offline",this.xe))}get length(){return this.ve.length}retriableRequest(t){var{retriesPerformedSoFar:r}=t,n=vgt(t,tyn);Sm(r)&&r>0&&(n.url=Y4(n.url,{retry_count:r})),this._instance.ci(dr({},n,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(r??0)<10?this.Se(dr({retriesPerformedSoFar:r},n)):n.callback==null||n.callback(s)}}))}Se(t){var r=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=r+1;var n=(function(i){var o=3e3*Math.pow(2,i),l=o/2,u=Math.min(18e5,o),d=(Math.random()-.5)*(u-l);return Math.ceil(u+d)})(r),s=Date.now()+n;this.ve.push({retryAt:s,requestOptions:t});var a="Enqueued failed request for retry in "+n;navigator.onLine||(a+=" (Browser is offline)"),Kt.warn(a),this.me||(this.me=!0,this.Ee())}Ee(){if(this.$e&&clearTimeout(this.$e),this.ve.length===0)return this.me=!1,void(this.$e=void 0);this.$e=setTimeout((()=>{this.be&&this.ve.length>0&&this.Dt(),this.Ee()}),this.ye)}Dt(){var t=Date.now(),r=[],n=this.ve.filter((a=>a.retryAt<t||(r.push(a),!1)));if(this.ve=r,n.length>0)for(var{requestOptions:s}of n)this.retriableRequest(s)}unload(){for(var{requestOptions:t}of(this.$e&&(clearTimeout(this.$e),this.$e=void 0),this.me=!1,Ht(Ze)||(this.we&&(Ze.removeEventListener("online",this.we),this.we=void 0),this.xe&&(Ze.removeEventListener("offline",this.xe),this.xe=void 0)),this.ve))try{this._instance.ci(dr({},t,{transport:"sendBeacon"}))}catch(r){Kt.error(r)}this.ve=[]}}class nyn{constructor(t){this.ke=()=>{var r,n,s,a;this.Pe||(this.Pe={});var i=this.scrollElement(),o=this.scrollY(),l=i?Math.max(0,i.scrollHeight-i.clientHeight):0,u=o+(i?.clientHeight||0),d=i?.scrollHeight||0;this.Pe.lastScrollY=Math.ceil(o),this.Pe.maxScrollY=Math.max(o,(r=this.Pe.maxScrollY)!==null&&r!==void 0?r:0),this.Pe.maxScrollHeight=Math.max(l,(n=this.Pe.maxScrollHeight)!==null&&n!==void 0?n:0),this.Pe.lastContentY=u,this.Pe.maxContentY=Math.max(u,(s=this.Pe.maxContentY)!==null&&s!==void 0?s:0),this.Pe.maxContentHeight=Math.max(d,(a=this.Pe.maxContentHeight)!==null&&a!==void 0?a:0)},this._instance=t}getContext(){return this.Pe}resetContext(){var t=this.Pe;return setTimeout(this.ke,0),t}startMeasuringScrollPosition(){uo(Ze,"scroll",this.ke,{capture:!0}),uo(Ze,"scrollend",this.ke,{capture:!0}),uo(Ze,"resize",this.ke)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Ze?.document.documentElement;var t=ka(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var r of t){var n=Ze?.document.querySelector(r);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return Ze&&(Ze.scrollY||Ze.pageYOffset||Ze.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return Ze&&(Ze.scrollX||Ze.pageXOffset||Ze.document.documentElement.scrollLeft)||0}}var syn=e=>hyt(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties);class sMe{constructor(t,r,n,s){this.Te=a=>{var i=this.Re();if(!i||i.sessionId!==a){var o={sessionId:a,props:this.Ie(this._instance)};this.Fe.register({[pne]:o})}},this._instance=t,this.Ce=r,this.Fe=n,this.Ie=s||syn,this.Ce.onSessionId(this.Te)}Re(){return this.Fe.props[pne]}getSetOnceProps(){var t,r=(t=this.Re())==null?void 0:t.props;return r?"r"in r?myt(r):{$referring_domain:r.referringDomain,$pathname:r.initialPathName,utm_source:r.utm_source,utm_campaign:r.utm_campaign,utm_medium:r.utm_medium,utm_content:r.utm_content,utm_term:r.utm_term}:{}}getSessionProps(){var t={};return La(Dfe(this.getSetOnceProps()),((r,n)=>{n==="$current_url"&&(n="url"),t["$session_entry_"+sne(n)]=r})),t}}var cK=Lo("[SessionId]");class aMe{on(t,r){return this.Me.on(t,r)}constructor(t,r,n){var s;if(this.Oe=[],this.Ae=void 0,this.Me=new Bfe,this.De=(d,p)=>Math.abs(d-p)>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.F=t.config,this.Fe=t.persistence,this.je=void 0,this.Le=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ne=r||Vb,this.Ue=n||Vb;var a=this.F.persistence_name||this.F.token,i=this.F.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Hh(i,60,36e3,cK.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ze(),this.He="ph_"+a+"_window_id",this.Be="ph_"+a+"_primary_window_exists",this.qe()){var o=fl.W(this.He),l=fl.W(this.Be);o&&!l?this.je=o:fl.V(this.He),fl.G(this.Be,!0)}if((s=this.F.bootstrap)!=null&&s.sessionID)try{var u=(d=>{var p=d.replace(/-/g,"");if(p.length!==32)throw new Error("Not a valid UUID");if(p[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(p.substring(0,12),16)})(this.F.bootstrap.sessionID);this.We(this.F.bootstrap.sessionID,new Date().getTime(),u)}catch(d){cK.error("Invalid sessionID in bootstrap",d)}this.Ge()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ht(this.Oe)&&(this.Oe=[]),this.Oe.push(t),this.Le&&t(this.Le,this.je),()=>{this.Oe=this.Oe.filter((r=>r!==t))}}qe(){return this.F.persistence!=="memory"&&!this.Fe.wi&&fl.H()}Ve(t){t!==this.je&&(this.je=t,this.qe()&&fl.G(this.He,t))}Je(){return this.je?this.je:this.qe()?fl.W(this.He):null}We(t,r,n){t===this.Le&&r===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=r,this.Le=t,this.Fe.register({[B4]:[r,t,n]}))}Ke(){var t=this.Fe.props[B4];return ka(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.We(null,null,null)}destroy(){clearTimeout(this.Ye),this.Ye=void 0,this.Ae&&Ze&&(Ze.removeEventListener("beforeunload",this.Ae,{capture:!1}),this.Ae=void 0),this.Oe=[]}Ge(){this.Ae=()=>{this.qe()&&fl.V(this.Be)},uo(Ze,"beforeunload",this.Ae,{capture:!1})}checkAndGetSessionAndWindowId(t,r){if(t===void 0&&(t=!1),r===void 0&&(r=null),this.F.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=r||new Date().getTime(),[s,a,i]=this.Ke(),o=this.Je(),l=Sm(i)&&i>0&&Math.abs(n-i)>864e5,u=!1,d=!a,p=!d&&!t&&this.De(n,s);d||p||l?(a=this.Ne(),o=this.Ue(),cK.info("new session ID generated",{sessionId:a,windowId:o,changeReason:{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}}),i=n,u=!0):o||(o=this.Ue(),u=!0);var f=s===0||!t||l?n:s,h=i===0?new Date().getTime():i;return this.Ve(o),this.We(a,f,h),t||this.ze(),u&&this.Oe.forEach((m=>m(a,o,u?{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}:void 0))),{sessionId:a,windowId:o,sessionStartTimestamp:h,changeReason:u?{noSessionId:d,activityTimeout:p,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}ze(){clearTimeout(this.Ye),this.Ye=setTimeout((()=>{var[t]=this.Ke();if(this.De(new Date().getTime(),t)){var r=this.Le;this.resetSessionId(),this.Me.emit("forcedIdleReset",{idleSessionId:r})}}),1.1*this.sessionTimeoutMs)}}var ayn=["$set_once","$set"],gb=Lo("[SiteApps]");class iyn{constructor(t){this._instance=t,this.Xe=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Qe(t,r){if(r){var n=this.globalsForEvent(r);this.Xe.push(n),this.Xe.length>1e3&&(this.Xe=this.Xe.slice(10))}}get siteAppLoaders(){var t;return(t=un._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ai(this.Qe.bind(this));this.Ze=()=>{t(),this.Xe=[],this.Ze=void 0}}}globalsForEvent(t){var r,n,s,a,i,o,l;if(!t)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var[f,h]of Object.entries(p))u[f]={id:d[f],type:f,properties:h};var{$set_once:m,$set:g}=t;return{event:dr({},vgt(t,ayn),{properties:dr({},t.properties,g?{$set:dr({},(r=(n=t.properties)==null?void 0:n.$set)!==null&&r!==void 0?r:{},g)}:{},m?{$set_once:dr({},(s=(a=t.properties)==null?void 0:a.$set_once)!==null&&s!==void 0?s:{},m)}:{}),elements_chain:(i=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(l=t.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var r=this.apps[t.id],n=()=>{var o;!r.errored&&this.Xe.length&&(gb.info("Processing "+this.Xe.length+" events for site app with id "+t.id),this.Xe.forEach((l=>r.processEvent==null?void 0:r.processEvent(l))),r.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((o=this.Ze)==null||o.call(this))},s=!1,a=o=>{r.errored=!o,r.loaded=!0,gb.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),s&&n()};try{var{processEvent:i}=t.init({posthog:this._instance,callback:o=>{a(o)}});i&&(r.processEvent=i),s=!0}catch(o){gb.error("Error while initializing PostHog app with config id "+t.id,o),a(!1)}if(s&&r.loaded)try{n()}catch(o){gb.error("Error while processing buffered events PostHog app with config id "+t.id,o),r.errored=!0}}tr(){var t=this.siteAppLoaders||[];for(var r of t)this.apps[r.id]={id:r.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}ir(t){if(Object.keys(this.apps).length!==0){var r=this.globalsForEvent(t);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(r)}catch(s){gb.error("Error while processing event "+t.event+" for site app "+n.id,s)}}}onRemoteConfig(t){var r,n,s,a=this;if((r=this.siteAppLoaders)!=null&&r.length)return this.isEnabled?(this.tr(),void this._instance.on("eventCaptured",(u=>this.ir(u)))):void gb.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Ze)==null||n.call(this),(s=t.siteApps)!=null&&s.length)if(this.isEnabled){var i=function(u){var d;un["__$$ph_site_app_"+u]=a._instance,(d=un.__PosthogExtensions__)==null||d.loadSiteApp==null||d.loadSiteApp(a._instance,l,(p=>{if(p)return gb.error("Error while initializing PostHog app with config id "+u,p)}))};for(var{id:o,url:l}of t.siteApps)i(o)}else gb.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Oyt=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&y3e(r,t))return!0;try{var n=e?.userAgentData;if(n!=null&&n.brands&&n.brands.some((s=>y3e(s?.brand,t))))return!0}catch{}return!!e.webdriver},rT=(function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e})({}),iMe="i.posthog.com";class oyn{constructor(t){this.er={},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,r=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return r||(r=this.apiHost.replace("."+iMe,".posthog.com")),r==="https://app.posthog.com"?"https://us.posthog.com":r}get region(){return this.er[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.er[this.apiHost]=rT.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.er[this.apiHost]=rT.EU:this.er[this.apiHost]=rT.CUSTOM),this.er[this.apiHost]}endpointFor(t,r){if(r===void 0&&(r=""),r&&(r=r[0]==="/"?r:"/"+r),t==="ui")return this.uiHost+r;if(t==="flags")return this.flagsApiHost+r;if(this.region===rT.CUSTOM)return this.apiHost+r;var n=iMe+r;switch(t){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var lyn={icontains:(e,t)=>!!Ze&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Ze&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!Ze&&K4(t.href,e),not_regex:(e,t)=>!!Ze&&!K4(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Rl{constructor(t){var r=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),r.getWebExperiments((s=>{Rl.rr("retrieved web experiments from the server"),r.sr=new Map,s.forEach((a=>{if(a.feature_flag_key){var i;r.sr&&(Rl.rr("setting flag key ",a.feature_flag_key," to web experiment ",a),(i=r.sr)==null||i.set(a.feature_flag_key,a));var o=r._instance.getFeatureFlag(a.feature_flag_key);Do(o)&&a.variants[o]&&r.nr(a.name,o,a.variants[o].transforms)}else if(a.variants)for(var l in a.variants){var u=a.variants[l];Rl.ar(u)&&r.nr(a.name,l,u.transforms)}}))}),n)},this._instance=t,this._instance.onFeatureFlags((n=>{this.onFeatureFlags(n)}))}onFeatureFlags(t){if(this._is_bot())Rl.rr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ma(this.sr))return this.sr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Rl.rr("applying feature flags",t),t.forEach((r=>{var n;if(this.sr&&(n=this.sr)!=null&&n.has(r)){var s,a=this._instance.getFeatureFlag(r),i=(s=this.sr)==null?void 0:s.get(r);a&&i!=null&&i.variants[a]&&this.nr(i.name,a,i.variants[a].transforms)}}))}}previewWebExperiment(){var t=Rl.getWindowLocation();if(t!=null&&t.search){var r=Q4(t?.search,"__experiment_id"),n=Q4(t?.search,"__experiment_variant");r&&n&&(Rl.rr("previewing web experiments "+r+" && "+n),this.getWebExperiments((s=>{this.lr(parseInt(r),n,s)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,r,n){if(this._instance.config.disable_web_experiments&&!n)return t([]);var s=this._instance.get_property("$web_experiments");if(s&&!r)return t(s);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:a=>{if(a.statusCode!==200||!a.json)return t([]);var i=a.json.experiments||[];return t(i)}})}lr(t,r,n){var s=n.filter((a=>a.id===t));s&&s.length>0&&(Rl.rr("Previewing web experiment ["+s[0].name+"] with variant ["+r+"]"),this.nr(s[0].name,r,s[0].variants[r].transforms))}static ar(t){return!ma(t.conditions)&&Rl.ur(t)&&Rl.hr(t)}static ur(t){var r;if(ma(t.conditions)||ma((r=t.conditions)==null?void 0:r.url))return!0;var n,s,a,i=Rl.getWindowLocation();return!!i&&((n=t.conditions)==null||!n.url||lyn[(s=(a=t.conditions)==null?void 0:a.urlMatchType)!==null&&s!==void 0?s:"icontains"](t.conditions.url,i))}static getWindowLocation(){return Ze?.location}static hr(t){var r;if(ma(t.conditions)||ma((r=t.conditions)==null?void 0:r.utm))return!0;var n=uyt();if(n.utm_source){var s,a,i,o,l,u,d,p,f=(s=t.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((a=t.conditions)==null||(a=a.utm)==null?void 0:a.utm_campaign)==n.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)==n.utm_source,m=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=t.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==n.utm_medium,g=(d=t.conditions)==null||(d=d.utm)==null||!d.utm_term||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==n.utm_term;return f&&m&&g&&h}return!1}static rr(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];Kt.info("[WebExperiments] "+t,n)}nr(t,r,n){this._is_bot()?Rl.rr("Refusing to render web experiment since the viewer is a likely bot"):r!=="control"?n.forEach((s=>{if(s.selector){var a;Rl.rr("applying transform of variant "+r+" for experiment "+t+" ",s);var i=(a=document)==null?void 0:a.querySelectorAll(s.selector);i?.forEach((o=>{var l=o;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)}))}})):Rl.rr("Control variants leave the page unmodified.")}_is_bot(){return ud&&this._instance?Oyt(ud,this._instance.config.custom_blocked_useragents):void 0}}var cyn=Lo("[PostHog ExternalIntegrations]"),uyn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class dyn{constructor(t){this._instance=t}it(t,r){var n;(n=un.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,t,(s=>{if(s)return cyn.error("failed to load script",s);r()}))}startIfEnabledOrStop(){var t=this,r=function(i){var o,l,u;!s||(o=un.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[i]||t.it(uyn[i],(()=>{var d;(d=un.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[i])==null||d.start(t._instance)})),!s&&(l=un.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[i]&&((u=un.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[i])==null||u.stop())};for(var[n,s]of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;r(n)}}}var One="[SessionRecording]",OC=Lo(One);class oMe{get started(){var t;return!((t=this.vr)==null||!t.isStarted)}get status(){return this.vr?this.vr.status:this.dr&&!this.cr?"disabled":"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.dr=!1,this.pr=void 0,this._instance=t,!this._instance.sessionManager)throw OC.error("started without valid sessionManager"),new Error(One+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(One+' cannot be used with cookieless_mode="always"')}get cr(){var t,r=!((t=this._instance.get_property(XY))==null||!t.enabled),n=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return Ze&&r&&n&&!s}startIfEnabledOrStop(t){var r;if(!this.cr||(r=this.vr)==null||!r.isStarted){var n=!Ht(Object.assign)&&!Ht(Array.from);this.cr&&n?(this.gr(t),OC.info("starting")):this.stopRecording()}}gr(t){var r,n,s;this.cr&&(un!=null&&(r=un.__PosthogExtensions__)!=null&&(r=r.rrweb)!=null&&r.record&&(n=un.__PosthogExtensions__)!=null&&n.initSessionRecording?this._r(t):(s=un.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.mr,(a=>{if(a)return OC.error("could not load recorder",a);this._r(t)})))}stopRecording(){var t,r;(t=this.pr)==null||t.call(this),this.pr=void 0,(r=this.vr)==null||r.stop()}yr(){var t;(t=this._instance.persistence)==null||t.unregister(Agt)}br(t){if(this._instance.persistence){var r,n,s=this._instance.persistence,a=()=>{var i=t.sessionRecording===!1?void 0:t.sessionRecording,o=i?.sampleRate,l=ma(o)?null:parseFloat(o);ma(l)&&this.yr();var u=i?.minimumDurationMilliseconds;s.register({[XY]:dr({enabled:!!i},i,{networkPayloadCapture:dr({capturePerformance:t.capturePerformance},i?.networkPayloadCapture),canvasRecording:{enabled:i?.recordCanvas,fps:i?.canvasFps,quality:i?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:Ht(u)?null:u,endpoint:i?.endpoint,triggerMatchType:i?.triggerMatchType,masking:i?.masking,urlTriggers:i?.urlTriggers})})};a(),(r=this.pr)==null||r.call(this),this.pr=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(t){"sessionRecording"in t?t.sessionRecording!==!1?(this.br(t),this.dr=!0,this.startIfEnabledOrStop()):this.dr=!0:OC.info("skipping remote config with no sessionRecording",t)}log(t,r){var n;r===void 0&&(r="log"),(n=this.vr)!=null&&n.log?this.vr.log(t,r):OC.warn("log called before recorder was ready")}get mr(){var t,r,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(XY);return(n==null||(r=n.scriptConfig)==null?void 0:r.script)||"lazy-recorder"}_r(t){var r,n;if((r=un.__PosthogExtensions__)==null||!r.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.vr||(this.vr=(n=un.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.vr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.vr.start(t)}onRRwebEmit(t){var r;(r=this.vr)==null||r.onRRwebEmit==null||r.onRRwebEmit(t)}overrideLinkedFlag(){var t,r;this.vr||(r=this._instance.persistence)==null||r.register({$replay_override_linked_flag:!0}),(t=this.vr)==null||t.overrideLinkedFlag()}overrideSampling(){var t,r;this.vr||(r=this._instance.persistence)==null||r.register({$replay_override_sampling:!0}),(t=this.vr)==null||t.overrideSampling()}overrideTrigger(t){var r,n;this.vr||(n=this._instance.persistence)==null||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(r=this.vr)==null||r.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.vr)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,r){var n;return!((n=this.vr)==null||!n.tryAddCustomEvent(t,r))}}var XT={},_ne=()=>{},Cw="posthog",_yt=!Bgn&&Jc?.indexOf("MSIE")===-1&&Jc?.indexOf("Mozilla")===-1,lMe=e=>{var t;return dr({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Rmn(Wt?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:_ne,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:au&&Do(au?.search)&&au.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_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Ze==null||(t=Ze.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_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:r=>{var n="Bad HTTP status: "+r.statusCode+" "+r.text;Kt.error(n)},get_device_id:r=>r,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:kne},error_tracking:{},_onCapture:_ne,__preview_eager_load_replay:!1},(r=>({rageclick:!(r&&r>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(r&&r>="2025-05-24")||"history_change",session_recording:r&&r>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(e))},cMe=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 r=Wi({},t,e);return ka(e.property_blacklist)&&(Ht(e.property_denylist)?r.property_denylist=e.property_blacklist:ka(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:Kt.error("Invalid value for property_denylist config: "+e.property_denylist)),r};class pyn{constructor(){this.__forceAllowLocalhost=!1}get wr(){return this.__forceAllowLocalhost}set wr(t){Kt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class f8{get decideEndpointWasHit(){var t,r;return(t=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,r;return(t=(r=this.featureFlags)==null?void 0:r.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){this.webPerformance=new pyn,this.Sr=!1,this.version=Eg.LIB_VERSION,this.Er=new Bfe,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=lMe(),this.SentryIntegration=cgn,this.sentryIntegration=t=>(function(r,n){var s=Ggt(r,n);return{name:Qgt,processEvent:a=>s(a)}})(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.$r=!1,this.kr=null,this.Pr=null,this.Tr=null,this.featureFlags=new qgn(this),this.toolbar=new dgn(this),this.scrollManager=new nyn(this),this.pageViewManager=new Ngn(this),this.surveys=new Ygn(this),this.experiments=new Rl(this),this.exceptions=new zgn(this),this.rateLimiter=new Kgn(this),this.requestRouter=new oyn(this),this.consent=new ngn(this),this.externalIntegrations=new dyn(this),this.people={set:(t,r,n)=>{var s=Do(t)?{[t]:r}:t;this.setPersonProperties(s),n?.({})},set_once:(t,r,n)=>{var s=Do(t)?{[t]:r}:t;this.setPersonProperties(void 0,s),n?.({})}},this.on("eventCaptured",(t=>Kt.info('send "'+t?.event+'"',t)))}init(t,r,n){if(n&&n!==Cw){var s,a=(s=XT[n])!==null&&s!==void 0?s:new f8;return a._init(t,r,n),XT[n]=a,XT[Cw][n]=a,a}return this._init(t,r,n)}_init(t,r,n){var s;if(r===void 0&&(r={}),Ht(t)||ane(t))return Kt.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={},r.debug=this.Rr(r.debug),this.Ir=r,this.Fr=[],r.person_profiles&&(this.Pr=r.person_profiles),this.set_config(Wi({},lMe(r.defaults),cMe(r),{name:n,token:t})),this.config.on_xhr_error&&Kt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:Ig.GZipJS;var a=this.Cr();this.persistence=new oK(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new oK(dr({},this.config,{persistence:"sessionStorage"}),a);var i=dr({},this.persistence.props),o=dr({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Mr=new eyn((S=>this.Or(S)),this.config.request_queue_config),this.Ar=new ryn(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new aMe(this),this.sessionPropsManager=new sMe(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Kt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Dr(l)}),0)):(Kt.info("Initializing extensions synchronously"),this.Dr(l)),Eg.DEBUG=Eg.DEBUG||this.config.debug,Eg.DEBUG&&Kt.info("Starting in debug mode",{this:this,config:r,thisC:dr({},this.config),p:i,s:o}),((s=r.bootstrap)==null?void 0:s.distinctID)!==void 0){var u,d,p=this.config.get_device_id(Vb()),f=(u=r.bootstrap)!=null&&u.isIdentifiedID?p:r.bootstrap.distinctID;this.persistence.set_property(kg,(d=r.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:r.bootstrap.distinctID,$device_id:f})}if(this.jr()){var h,m,g=Object.keys(((h=r.bootstrap)==null?void 0:h.featureFlags)||{}).filter((S=>{var w;return!((w=r.bootstrap)==null||(w=w.featureFlags)==null||!w[S])})).reduce(((S,w)=>{var k;return S[w]=((k=r.bootstrap)==null||(k=k.featureFlags)==null?void 0:k[w])||!1,S}),{}),b=Object.keys(((m=r.bootstrap)==null?void 0:m.featureFlagPayloads)||{}).filter((S=>g[S])).reduce(((S,w)=>{var k,_;return(k=r.bootstrap)!=null&&(k=k.featureFlagPayloads)!=null&&k[w]&&(S[w]=(_=r.bootstrap)==null||(_=_.featureFlagPayloads)==null?void 0:_[w]),S}),{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:b})}if(l)this.register_once({distinct_id:yC,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Vb());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(kg,"anonymous")}return uo(Ze,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),r.segment?lgn(this,(()=>this.Lr())):this.Lr(),rv(this.config._onCapture)&&this.config._onCapture!==_ne&&(Kt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(S=>this.config._onCapture(S.event,S)))),this.config.ip&&Kt.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}Dr(t){var r=performance.now();this.historyAutocapture=new ogn(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new fgn(this).startIfEnabledOrStop()})),n.push((()=>{var s;this.siteApps=new iyn(this),(s=this.siteApps)==null||s.init()})),t||n.push((()=>{this.sessionRecording=new oMe(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new Wmn(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.heatmaps=new Dgn(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new Tgn(this)})),n.push((()=>{this.exceptionObserver=new ign(this),this.exceptionObserver.startIfEnabled()})),n.push((()=>{this.deadClicksAutocapture=new Hgt(this,agn),this.deadClicksAutocapture.startIfEnabled()})),n.push((()=>{if(this.Nr){var s=this.Nr;this.Nr=void 0,this.fi(s)}})),this.Ur(n,r)}Ur(t,r){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&t.length>0)return void setTimeout((()=>{this.Ur(t,r)}),0);var n=t.shift();if(n)try{n()}catch(a){Kt.error("Error initializing extension:",a)}}var s=Math.round(performance.now()-r);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&Kt.info("PostHog extensions initialized ("+s+"ms)")}fi(t){var r,n,s,a,i,o,l,u;if(!Wt||!Wt.body)return Kt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fi(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Nr=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=rs(t.supportedCompression,Ig.GZipJS)?Ig.GZipJS:rs(t.supportedCompression,Ig.Base64)?Ig.Base64:void 0),(r=t.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pr?this.Pr:"identified_only"}),(n=this.siteApps)==null||n.onRemoteConfig(t),(s=this.sessionRecording)==null||s.onRemoteConfig(t),(a=this.autocapture)==null||a.onRemoteConfig(t),(i=this.heatmaps)==null||i.onRemoteConfig(t),this.surveys.onRemoteConfig(t),(o=this.webVitalsAutocapture)==null||o.onRemoteConfig(t),(l=this.exceptionObserver)==null||l.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(t)}Lr(){try{this.config.loaded(this)}catch(t){Kt.critical("`loaded` function failed",t)}this.zr(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Hr()}),1),new Jgn(this).load(),this.featureFlags.flags()}zr(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Mr)==null||t.enable())}_dom_loaded(){this.is_capturing()&&sv(this.__request_queue,(t=>this.Or(t))),this.__request_queue=[],this.zr()}_handle_unload(){var t,r;this.config.request_batching?(this.Br()&&this.capture("$pageleave"),(t=this.Mr)==null||t.unload(),(r=this.Ar)==null||r.unload()):this.Br()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ci(t){this.__loaded&&(_yt?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Y4(t.url,{ip:this.config.ip?1:0}),t.headers=dr({},this.config.request_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,(r=>{var n,s,a,i=dr({},r);i.timeout=i.timeout||6e4,i.url=Y4(i.url,{_:new Date().getTime().toString(),ver:Eg.LIB_VERSION,compression:i.compression});var o=(n=i.transport)!==null&&n!==void 0?n:"fetch",l=W$.filter((d=>!i.disableTransport||!d.transport||!i.disableTransport.includes(d.transport))),u=(s=(a=_gt(l,(d=>d.transport===o)))==null?void 0:a.method)!==null&&s!==void 0?s:l[0].method;if(!u)throw new Error("No available transport method");u(i)})(dr({},t,{callback:r=>{var n,s;this.rateLimiter.checkForLimiting(r),r.statusCode>=400&&((n=(s=this.config).on_request_error)==null||n.call(s,r)),t.callback==null||t.callback(r)}}))))}Or(t){this.Ar?this.Ar.retriableRequest(t):this.ci(t)}_execute_array(t){var r,n=[],s=[],a=[];sv(t,(o=>{o&&(r=o[0],ka(r)?a.push(o):rv(o)?o.call(this):ka(o)&&r==="alias"?n.push(o):ka(o)&&r.indexOf("capture")!==-1&&rv(this[r])?a.push(o):s.push(o))}));var i=function(o,l){sv(o,(function(u){if(ka(u[0])){var d=l;La(u,(function(p){d=d[p[0]].apply(d,p.slice(1))}))}else this[u[0]].apply(this,u.slice(1))}),l)};i(n,this),i(s,this),i(a,this)}jr(){var t,r;return((t=this.config.bootstrap)==null?void 0:t.featureFlags)&&Object.keys((r=this.config.bootstrap)==null?void 0:r.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,r,n){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Mr){if(this.is_capturing())if(!Ht(t)&&Do(t)){var a=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(a&&!this.config.__preview_capture_bot_pageviews)){var i=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i==null||!i.isRateLimited){r!=null&&r.$current_url&&!Do(r?.$current_url)&&(Kt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),r==null||delete r.$current_url),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,l=n?.timestamp||o,u=Vb(),d={uuid:u,event:t,properties:this.calculateEventProperties(t,r||{},l,u)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&a&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),i&&(d.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens),n?.$set&&(d.$set=n?.$set);var p,f=this.qr(n?.$set_once);if(f&&(d.$set_once=f),(d=Imn(d,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,Ht(n?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=o),t===X$.DISMISSED||t===X$.SENT){var h=r?.[tMe.SURVEY_ID],m=r?.[tMe.SURVEY_ITERATION];p={id:h,current_iteration:m},localStorage.getItem(rMe(p))||localStorage.setItem(rMe(p),"true"),d.$set=dr({},d.$set,{[Ggn({id:h,current_iteration:m},t===X$.SENT?"responded":"dismissed")]:!0})}var g=dr({},d.properties.$set,d.$set);if(Qw(g)||this.setPersonPropertiesForFlags(g),!ma(this.config.before_send)){var b=this.Wr(d);if(!b)return;d=b}this.Er.emit("eventCaptured",d);var v={method:"POST",url:(s=n?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:d,compression:"best-available",batchKey:n?._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Or(v):this.Mr.enqueue(v),d}Kt.critical("This capture call is ignored due to client rate limiting.")}}else Kt.error("No event name provided to posthog.capture")}else Kt.uninitializedWarning("posthog.capture")}Ai(t){return this.on("eventCaptured",(r=>t(r.event,r)))}calculateEventProperties(t,r,n,s,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return r;var i=a?void 0:this.persistence.remove_event_timer(t),o=dr({},r);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 l=dr({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!Do(o.distinct_id)&&!Sm(o.distinct_id)||ane(o.distinct_id))&&Kt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,d=Cgn(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:p,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());o.$session_id=p,o.$window_id=f}this.sessionPropsManager&&Wi(o,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&Wi(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(h=this.Ar)==null?void 0:h.length}catch(v){o.$sdk_debug_error_capturing_properties=String(v)}if(this.requestRouter.region===rT.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),u=t!=="$pageview"||a?t!=="$pageleave"||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,s),o=Wi(o,u),t==="$pageview"&&Wt&&(o.title=Wt.title),!Ht(i)){var m=n.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=Wi({},d,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),ka(this.config.property_denylist)?La(this.config.property_denylist,(function(v){delete o[v]})):Kt.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&&(Kt.error("sanitize_properties is deprecated. Use before_send instead"),o=g(o,t));var b=this.Gr();return o.$process_person_profile=b,b&&!a&&this.Vr("_calculate_event_properties"),o}qr(t){var r;if(!this.persistence||!this.Gr()||this.Sr)return t;var n=this.persistence.get_initial_props(),s=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),a=Wi({},n,s||{},t||{}),i=this.config.sanitize_properties;return i&&(Kt.error("sanitize_properties is deprecated. Use before_send instead"),a=i(a,"$set_once")),this.Sr=!0,Qw(a)?void 0:a}register(t,r){var n;(n=this.persistence)==null||n.register(t,r)}register_once(t,r,n){var s;(s=this.persistence)==null||s.register_once(t,r,n)}register_for_session(t){var r;(r=this.sessionPersistence)==null||r.register(t)}unregister(t){var r;(r=this.persistence)==null||r.unregister(t)}unregister_for_session(t){var r;(r=this.sessionPersistence)==null||r.unregister(t)}Jr(t,r){this.register({[t]:r})}getFeatureFlag(t,r){return this.featureFlags.getFeatureFlag(t,r)}getFeatureFlagPayload(t){var r=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(r)}catch{return r}}isFeatureEnabled(t,r){return this.featureFlags.isFeatureEnabled(t,r)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,r,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,r,n)}getEarlyAccessFeatures(t,r,n){return r===void 0&&(r=!1),this.featureFlags.getEarlyAccessFeatures(t,r,n)}on(t,r){return this.Er.on(t,r)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var r,n;return(r=(n=this.sessionManager)==null?void 0:n.onSessionId(t))!==null&&r!==void 0?r:()=>{}}getSurveys(t,r){r===void 0&&(r=!1),this.surveys.getSurveys(t,r)}getActiveMatchingSurveys(t,r){r===void 0&&(r=!1),this.surveys.getActiveMatchingSurveys(t,r)}renderSurvey(t,r){this.surveys.renderSurvey(t,r)}displaySurvey(t,r){r===void 0&&(r=Wgn),this.surveys.displaySurvey(t,r)}cancelPendingSurvey(t){this.surveys.cancelPendingSurvey(t)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,r){return r===void 0&&(r=!1),this.surveys.canRenderSurveyAsync(t,r)}identify(t,r,n){if(!this.__loaded||!this.persistence)return Kt.uninitializedWarning("posthog.identify");if(Sm(t)&&(t=t.toString(),Kt.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()))Kt.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!==yC){if(this.Vr("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var a=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:a},"")}t!==s&&t!==this.get_property(XC)&&(this.unregister(XC),this.register({distinct_id:t}));var i=(this.persistence.get_property(kg)||"anonymous")==="anonymous";t!==s&&i?(this.persistence.set_property(kg,"identified"),this.setPersonPropertiesForFlags(dr({},n||{},r||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:s},{$set:r||{},$set_once:n||{}}),this.Tr=X3e(t,r,n),this.featureFlags.setAnonymousDistinctId(s)):(r||n)&&this.setPersonProperties(r,n),t!==s&&(this.reloadFeatureFlags(),this.unregister(z4))}}else Kt.critical('The string "'+yC+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Kt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,r){if((t||r)&&this.Vr("posthog.setPersonProperties")){var n=X3e(this.get_distinct_id(),t,r);this.Tr!==n?(this.setPersonPropertiesForFlags(dr({},r||{},t||{})),this.capture("$set",{$set:t||{},$set_once:r||{}}),this.Tr=n):Kt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,r,n){if(t&&r){if(this.Vr("posthog.group")){var s=this.getGroups();s[t]!==r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:dr({},s,{[t]:r})}),n&&(this.capture("$groupidentify",{$group_type:t,$group_key:r,$group_set:n}),this.setGroupPropertiesForFlags({[t]:n})),s[t]===r||n||this.reloadFeatureFlags()}}else Kt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,r){r===void 0&&(r=!0),this.featureFlags.setPersonPropertiesForFlags(t,r)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,r){r===void 0&&(r=!0),this.Vr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,r)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var r,n,s,a;if(Kt.info("reset"),!this.__loaded)return Kt.uninitializedWarning("posthog.reset");var i=this.get_property("$device_id");if(this.consent.reset(),(r=this.persistence)==null||r.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(kg,"anonymous"),(a=this.sessionManager)==null||a.resetSessionId(),this.Tr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:yC,$device_id:null},"");else{var o=this.config.get_device_id(Vb());this.register_once({distinct_id:o,$device_id:t?o:i},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,r;return(t=(r=this.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:r,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+r);if(t!=null&&t.withTimestamp&&n){var a,i=(a=t.timestampLookBack)!==null&&a!==void 0?a:10;if(!n)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-i,0)}return s}alias(t,r){return t===this.get_property(Cgt)?(Kt.critical("Attempting to create alias for existing People user - aborting."),-2):this.Vr("posthog.alias")?(Ht(r)&&(r=this.get_distinct_id()),t!==r?(this.Jr(XC,t),this.capture("$create_alias",{alias:t,distinct_id:r})):(Kt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var r=dr({},this.config);if(qo(t)){var n,s,a,i,o;Wi(this.config,cMe(t));var l=this.Cr();(n=this.persistence)==null||n.update_config(this.config,r,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new oK(dr({},this.config,{persistence:"sessionStorage"}),l);var u=this.Rr(this.config.debug);nv(u)&&(this.config.debug=u),nv(this.config.debug)&&(this.config.debug?(Eg.DEBUG=!0,bi.H()&&bi.G("ph_debug","true"),Kt.info("set_config",{config:t,oldConfig:r,newConfig:dr({},this.config)})):(Eg.DEBUG=!1,bi.H()&&bi.V("ph_debug"))),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(i=this.heatmaps)==null||i.startIfEnabled(),this.surveys.loadIfEnabled(),this.Kr(),(o=this.externalIntegrations)==null||o.startIfEnabledOrStop()}}startSessionRecording(t){var r=t===!0,n={sampling:r||!(t==null||!t.sampling),linked_flag:r||!(t==null||!t.linked_flag),url_trigger:r||!(t==null||!t.url_trigger),event_trigger:r||!(t==null||!t.event_trigger)};if(Object.values(n).some(Boolean)){var s,a,i,o,l;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),n.sampling&&((a=this.sessionRecording)==null||a.overrideSampling()),n.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),n.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),n.event_trigger&&((l=this.sessionRecording)==null||l.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,r){var n=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(dr({},s,r))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var r;return(r=this.persistence)==null?void 0:r.props[t]}getSessionProperty(t){var r;return(r=this.sessionPersistence)==null?void 0:r.props[t]}toString(){var t,r=(t=this.config.name)!==null&&t!==void 0?t:Cw;return r!==Cw&&(r=Cw+"."+r),r}_isIdentified(){var t,r;return((t=this.persistence)==null?void 0:t.get_property(kg))==="identified"||((r=this.sessionPersistence)==null?void 0:r.get_property(kg))==="identified"}Gr(){var t,r;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Qw(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[XC])&&((r=this.persistence)==null||(r=r.props)==null||!r[V4]))}Br(){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.Gr()||this.Vr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Vr(t){return this.config.person_profiles==="never"?(Kt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Jr(V4,!0),!0)}Cr(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut(),r=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||t&&!!r}Kr(){var t,r,n,s,a=this.Cr();return((t=this.persistence)==null?void 0:t.wi)!==a&&((n=this.persistence)==null||n.set_disabled(a)),((r=this.sessionPersistence)==null?void 0:r.wi)!==a&&((s=this.sessionPersistence)==null||s.set_disabled(a)),a}opt_in_capturing(t){var r;if(this.config.cookieless_mode!=="always"){var n,s;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),this.sessionManager=new aMe(this),this.persistence&&(this.sessionPropsManager=new sMe(this,this.sessionManager,this.persistence)),this.sessionRecording=new oMe(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Kr(),this.zr(),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(Ht(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((s=t?.captureEventName)!==null&&s!==void 0?s:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Hr()}else Kt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,r;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Kr(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:yC,$device_id:null}),(t=this.sessionManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.Hr())):Kt.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===Og.GRANTED?"granted":t===Og.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.Kr()}_is_bot(){return ud?Oyt(ud,this.config.custom_blocked_useragents):void 0}Hr(){Wt&&(Wt.visibilityState==="visible"?this.$r||(this.$r=!0,this.capture("$pageview",{title:Wt.title},{send_instantly:!0}),this.kr&&(Wt.removeEventListener("visibilitychange",this.kr),this.kr=null)):this.kr||(this.kr=this.Hr.bind(this),uo(Wt,"visibilitychange",this.kr)))}debug(t){t===!1?(Ze?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Ze?.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}))}O(){var t,r,n,s,a,i,o,l=this.Ir||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Kt.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):(n="advanced_disable_decide",s=!1,a=Kt,i=(r="advanced_disable_flags")in(t=l)&&!Ht(t[r]),o=n in t&&!Ht(t[n]),i?t[r]:o?(a&&a.warn("Config field '"+n+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),t[n]):s)}Wr(t){if(ma(this.config.before_send))return t;var r=ka(this.config.before_send)?this.config.before_send:[this.config.before_send],n=t;for(var s of r){if(n=s(n),ma(n)){var a="Event '"+t.event+"' was rejected in beforeSend function";return amn(t.event)?Kt.warn(a+". This can cause unexpected behavior."):Kt.info(a),null}n.properties&&!Qw(n.properties)||Kt.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var t;return(t=this.pageViewManager.Vt)==null?void 0:t.pageViewId}captureTraceFeedback(t,r){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:r})}captureTraceMetric(t,r,n){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:r,$ai_metric_value:String(n)})}Rr(t){var r=nv(t)&&!t,n=bi.H()&&bi.q("ph_debug")==="true";return!r&&(!!n||t)}}(function(e,t){for(var r=0;r<t.length;r++)e.prototype[t[r]]=Nmn(e.prototype[t[r]])})(f8,["identify"]);var uMe,jg=(uMe=XT[Cw]=new f8,(function(){function e(){e.done||(e.done=!0,_yt=!1,La(XT,(function(t){t._dom_loaded()})))}Wt!=null&&Wt.addEventListener?Wt.readyState==="complete"?e():uo(Wt,"DOMContentLoaded",e,{capture:!1}):Ze&&Kt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),uMe),Cyt=E.createContext({client:jg,bootstrap:void 0});function Tyt(e,t,r){if(r===void 0&&(r=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(r.has(e)&&r.get(e)===t)return!0;r.set(e,t);var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(var a=0,i=n;a<i.length;a++){var o=i[a];if(!s.includes(o)||!Tyt(e[o],t[o],r))return!1}return!0}function fyn(e){var t,r,n=e.children,s=e.client,a=e.apiKey,i=e.options,o=E.useRef(null),l=E.useMemo(function(){return s?(a&&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`."),s):(a||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."),jg)},[s,a,JSON.stringify(i)]);return E.useEffect(function(){if(!s){var u=o.current;u?(a!==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&&!Tyt(i,u.options)&&jg.set_config(i),o.current={apiKey:a,options:i??{}}):(jg.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),jg.init(a,i),o.current={apiKey:a,options:i??{}})}},[s,a,JSON.stringify(i)]),Ee.createElement(Cyt.Provider,{value:{client:l,bootstrap:(t=i?.bootstrap)!==null&&t!==void 0?t:(r=s?.config)===null||r===void 0?void 0:r.bootstrap}},n)}var uK=function(e){return typeof e=="function"},Cne=function(e,t){return Cne=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Cne(e,t)};function hyn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Cne(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var myn={componentStack:null,exceptionEvent:null,error:null},gyn={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){hyn(t,e);function t(r){var n=e.call(this,r)||this;return n.state=myn,n}return t.prototype.componentDidCatch=function(r,n){var s=this.props.additionalProperties,a;uK(s)?a=s(r):typeof s=="object"&&(a=s);var i=this.context.client,o=i.captureException(r,a),l=n.componentStack;this.setState({error:r,componentStack:l,exceptionEvent:o})},t.prototype.render=function(){var r=this.props,n=r.children,s=r.fallback,a=this.state;if(a.componentStack==null)return uK(n)?n():n;var i=uK(s)?Ee.createElement(s,{error:a.error,componentStack:a.componentStack,exceptionEvent:a.exceptionEvent}):s;return Ee.isValidElement(i)?i:(console.warn(gyn.INVALID_FALLBACK),Ee.createElement(Ee.Fragment,null))},t.contextType=Cyt,t})(Ee.Component);function yyn({children:e}){return E.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}jg.init("phc_SBLpZVAB6jmHOct9CABq3PF0Yn5FU3G2FgT4xUr2XrT",{api_host:"https://us.posthog.com"}),jg.register({mastraSource:"playground"})},[]),c.jsx(fyn,{client:jg,children:e})}const byn=["/swagger-ui","/openapi.json"],vyn=E.forwardRef(({children:e,href:t,...r},n)=>t&&byn.some(a=>t.startsWith(a))?c.jsx("a",{ref:n,href:t,...r,children:e}):c.jsx(Pt,{ref:n,to:t,viewTransition:!0,...r,children:e}));function xyn(){const{Link:e,navigate:t}=Yt(),{data:r={},isLoading:n,error:s}=ah(),{isCmsAvailable:a}=pS(),{canEdit:i}=Bm(),o=a&&i("stored-agents"),l=()=>{t("/cms/agents/create")};return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Mi,{})}),"Agents"]}),c.jsxs(Vs,{children:[o&&c.jsxs(ye,{variant:"light",as:e,to:"/cms/agents/create",children:[c.jsx(ve,{children:c.jsx(wF,{})}),"Create an agent"]}),c.jsxs(ye,{variant:"outline",as:e,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Agents documentation"]})]})]}),c.jsx(Si,{isCentered:!n&&Object.keys(r||{}).length===0,children:c.jsx(Inn,{agents:r,isLoading:n,error:s,onCreateClick:o?l:void 0})})]})}function Syn({agentId:e,threadId:t,threads:r,isLoading:n}){const{mutateAsync:s}=Nrn(),{paths:a,navigate:i}=Yt(),o=async l=>{await s({threadId:l,agentId:e}),l===t&&i(a.agentNewThreadLink(e))};return c.jsx(Gsn,{resourceId:e,resourceType:"agent",threads:r||[],isLoading:n,threadId:t,onDelete:o})}function dMe(){const{agentId:e,threadId:t}=Ei(),[r]=sc(),{data:n,isLoading:s,error:a}=ox(e),{data:i}=X6(e),o=Hd(),l=t==="new",u=E.useMemo(()=>No(),[t]),d=!!i?.result,{data:p,isLoading:f,refetch:h}=Drn({agentId:e,isMemoryEnabled:d,resourceId:e});E.useEffect(()=>{d&&(t||o(`/agents/${e}/chat/new`))},[d,t,e,o]);const m=r.get("messageId")??void 0,g=E.useMemo(()=>{if(!n)return{modelSettings:{}};const S=n.defaultOptions,{maxOutputTokens:w,...k}=S?.modelSettings??{};return{modelSettings:{...k,...w!==void 0&&{maxTokens:w},...S?.maxSteps!==void 0&&{maxSteps:S.maxSteps},...S?.providerOptions!==void 0&&{providerOptions:S.providerOptions}}}},[n]);if(a&&Mc(a))return c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"agents"})});if(s)return null;if(!n)return c.jsx("div",{className:"text-center py-4",children:"Agent not found"});const b=l?u:t,v=async()=>{await h(),l&&o(`/agents/${e}/chat/${u}`)};return c.jsx(Tpt,{entityId:e,entityType:"agent",children:c.jsx(_rn,{agentId:e,defaultSettings:g,children:c.jsx(Wpe,{children:c.jsx(xrn,{agentId:e,threadId:b,resourceId:e,children:c.jsx(Ktn,{children:c.jsx(Crn,{children:c.jsx(ytn,{children:c.jsx(ban,{agentId:e,leftSlot:d&&c.jsx(Syn,{agentId:e,threadId:b,threads:p||[],isLoading:f}),rightSlot:c.jsx(man,{agentId:e,threadId:b}),children:c.jsx(zrn,{agentId:e,agentName:n?.name,modelVersion:n?.modelVersion,threadId:b,memory:d,refreshThreadList:v,modelList:n?.modelList,messageId:m,isNewThread:l},b)})},`${e}-${b}`)})})})})})})}function wyn(){return c.jsx(qin,{})}function Eyn(){const{navigate:e,paths:t}=Yt(),r=qd(),{form:n,handlePublish:s,isSubmitting:a,canPublish:i}=umt({mode:"create",onSuccess:o=>e(t.agentLink(o))});return c.jsxs(Hr,{children:[c.jsxs(Fr,{className:"bg-surface1",children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Mi,{})}),"Create an agent"]}),c.jsx(Vs,{children:c.jsx(ye,{variant:"primary",onClick:s,disabled:a||!i,className:"w-full",children:a?c.jsxs(c.Fragment,{children:[c.jsx(Cn,{className:"h-4 w-4"}),"Creating..."]}):c.jsxs(c.Fragment,{children:[c.jsx(ve,{children:c.jsx(hKe,{})}),"Create agent"]})})})]}),c.jsx(dmt,{form:n,mode:"create",isSubmitting:a,handlePublish:s,basePath:"/cms/agents/create",currentPath:r.pathname,children:c.jsx(uN,{})})]})}function pMe({agentId:e,selectedVersionId:t,versionData:r,readOnly:n=!1,form:s,handlePublish:a,handleSaveDraft:i,isSubmitting:o,isSavingDraft:l,onVersionSelect:u,activeVersionId:d,latestVersionId:p,hideVersionPanel:f=!1,isCodeAgentOverride:h=!1}){const[,m]=sc(),g=qd(),S=!!t&&!!r&&t!==p?c.jsxs(Cp,{variant:"info",className:"mb-4",children:[c.jsx(Tp,{children:"This is a previous version"}),c.jsx(sy,{as:"p",children:"You are seeing a specific version of the agent."}),c.jsx("div",{className:"pt-2",children:c.jsx(ye,{type:"button",variant:"light",size:"sm",onClick:()=>m({}),children:"View latest version"})})]}):void 0,w=f?void 0:c.jsx(qon,{agentId:e,selectedVersionId:t??void 0,onVersionSelect:u,activeVersionId:d});return c.jsx(dmt,{form:s,mode:"edit",agentId:e,isSubmitting:o,isSavingDraft:l,handlePublish:a,handleSaveDraft:i,readOnly:n,isCodeAgentOverride:h,basePath:`/cms/agents/${e}/edit`,currentPath:g.pathname,banner:S,versionId:t??void 0,rightPanel:w,children:c.jsx(uN,{})})}function kyn(){const{agentId:e}=Ei(),{navigate:t,paths:r}=Yt(),n=Hd(),s=qd(),[a,i]=sc(),o=a.get("versionId"),{data:l,isLoading:u}=ox(e),{data:d,isLoading:p}=tan(e,{status:"draft"}),f=l?.source==="code",h=d??null,m=u||p,g=`/cms/agents/${e}/edit`,b=s.pathname===g||s.pathname===`${g}/`;E.useEffect(()=>{f&&b&&n(`${g}/instruction-blocks${s.search}${s.hash}`,{replace:!0})},[f,b,n,g,s.search,s.hash]);const{data:v}=ran({agentId:e??"",versionId:o??""}),{data:S}=nht({agentId:e??"",params:{sortDirection:"DESC"}}),w=h?.activeVersionId,k=S?.versions?.[0],_=!!(k&&k.id!==w),C=!!o&&!!v,T=E.useMemo(()=>C&&v?v:h||(l?zon(l):{}),[C,v,h,l]),A=h?.name??l?.name,{form:N,handlePublish:I,handleSaveDraft:R,isSubmitting:$,isSavingDraft:F,isDirty:L}=umt({mode:"edit",agentId:e??"",dataSource:T,isCodeAgentOverride:f,hasStoredOverride:f&&!!d,onSuccess:V=>t(r.agentLink(V))}),z=E.useCallback(V=>{i(V?{versionId:V}:{})},[i]),q=!m&&!h&&!l,H=!m&&!!e&&(!!h||!!l);return c.jsxs(Hr,{children:[c.jsxs(Fr,{className:"bg-surface1",children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Mi,{})}),m&&c.jsx(Nr,{className:"h-6 w-[200px]"}),q&&"Agent not found",H&&`Edit agent: ${A}`,H&&_&&c.jsx(Ft,{variant:"info",children:"Unpublished changes"})]}),H&&c.jsxs(Vs,{children:[c.jsx(ye,{variant:"outline",onClick:R,disabled:!L||F||$,children:F?c.jsxs(c.Fragment,{children:[c.jsx(Cn,{className:"h-4 w-4"}),"Saving..."]}):c.jsxs(c.Fragment,{children:[c.jsx(ve,{children:c.jsx(evr,{})}),"Save"]})}),c.jsx(ye,{variant:"primary",onClick:I,disabled:!_&&!L||$||F,children:$?c.jsxs(c.Fragment,{children:[c.jsx(Cn,{className:"h-4 w-4"}),"Publishing..."]}):c.jsxs(c.Fragment,{children:[c.jsx(ve,{children:c.jsx(hKe,{})}),"Publish"]})})]})]}),q?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Agent not found"}),c.jsx("div",{className:"hidden",children:c.jsx(pMe,{agentId:e??"",selectedVersionId:o,versionData:v,readOnly:!0,form:N,handlePublish:I,handleSaveDraft:R,isSubmitting:$,isSavingDraft:F,onVersionSelect:z,activeVersionId:w,latestVersionId:k?.id})})]}):c.jsx(pMe,{agentId:e??"",selectedVersionId:o,versionData:v,form:N,handlePublish:I,handleSaveDraft:R,isSubmitting:$,isSavingDraft:F,onVersionSelect:z,activeVersionId:w,latestVersionId:k?.id,hideVersionPanel:f&&!d,isCodeAgentOverride:f})]})}function Oyn(){return c.jsx(Oin,{})}function _yn(){return c.jsx(_in,{})}function Cyn(){return c.jsx(Zin,{})}function Tyn(){return c.jsx(Hin,{})}function Ayn(){return c.jsx(Ion,{})}function Dyn(){return c.jsx(Vin,{})}function Nyn(){return c.jsx(ron,{})}function Iyn(){return c.jsx(Gin,{})}function jyn(){const{navigate:e,paths:t}=Yt();return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(OT,{})}),"Create a prompt block"]})}),c.jsx(Fan,{onSuccess:r=>e(t.cmsPromptBlockEditLink(r.id))})]})}function fMe(e){return{name:e.name,description:e.description||void 0,content:e.content,rules:e.rules||void 0,requestContextSchema:e.variables||void 0}}function Ryn({block:e,blockId:t,selectedVersionId:r,hasDraft:n}){const s=st(),a=va(),{navigate:i,paths:o}=Yt(),{updateStoredPromptBlock:l}=Sht(t),[u,d]=E.useState(!1),[p,f]=E.useState(!1),{data:h}=Han({blockId:t,versionId:r??""}),m=!!r&&!!h,g=m?h:e,b=E.useMemo(()=>({name:g.name||"",description:g.description||"",content:g.content||"",rules:g.rules,variables:g.requestContextSchema}),[g]),{form:v}=bht({initialValues:b}),[S,w]=E.useState(0);E.useEffect(()=>{b&&!v.formState.isDirty&&(v.reset(b),w(C=>C+1))},[b,v]);const k=E.useCallback(async()=>{if(!await v.trigger()){Xe.error("Please fill in all required fields");return}f(!0);try{const T=fMe(v.getValues());await l.mutateAsync(T),v.reset(v.getValues()),Xe.success("Draft saved")}catch(T){Xe.error(`Failed to save draft: ${T instanceof Error?T.message:"Unknown error"}`)}finally{f(!1)}},[v,l]),_=E.useCallback(async()=>{if(!await v.trigger()){Xe.error("Please fill in all required fields");return}d(!0);try{const T=fMe(v.getValues());await l.mutateAsync(T);const N=(await s.getStoredPromptBlock(t).listVersions({sortDirection:"DESC",perPage:1})).versions[0];if(!N)throw new Error("No version found to publish");await s.getStoredPromptBlock(t).activateVersion(N.id),a.invalidateQueries({queryKey:["stored-prompt-blocks"]}),a.invalidateQueries({queryKey:["stored-prompt-block"]}),a.invalidateQueries({queryKey:["prompt-block-versions",t]}),Xe.success("Prompt block published"),i(o.promptBlocksLink())}catch(T){Xe.error(`Failed to publish: ${T instanceof Error?T.message:"Unknown error"}`)}finally{d(!1)}},[v,l,s,t,i,o,a]);return c.jsxs(Rv,{leftSlot:c.jsx(ght,{form:v,onPublish:_,onSaveDraft:k,isSubmitting:u,isSavingDraft:p,isDirty:v.formState.isDirty,hasDraft:n,formResetKey:S,mode:"edit"}),children:[m&&c.jsxs(Cp,{variant:"info",className:"m-4 mb-0",children:[c.jsx(Tp,{children:"This is a previous version"}),c.jsx(sy,{as:"p",children:"You are seeing a specific version of the prompt block."})]}),c.jsx("form",{className:"h-full",children:c.jsx(yht,{form:v})})]})}function Pyn(){const{promptBlockId:e}=Ei(),[t,r]=sc(),n=t.get("versionId"),{data:s,isLoading:a}=xht(e,{status:"draft"}),{data:i}=wht({blockId:e??"",params:{sortDirection:"DESC"}}),o=s?.activeVersionId,l=i?.versions?.[0],u=!!(l&&(!o||l.id!==o)),d=E.useCallback(p=>{r(p?{versionId:p}:{})},[r]);return a?c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(OT,{})}),c.jsx(Nr,{className:"h-6 w-[200px]"})]})}),c.jsx(Rv,{leftSlot:c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(Cn,{className:"h-8 w-8"})}),children:c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(Cn,{className:"h-8 w-8"})})})]}):!s||!e?c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(OT,{})}),"Prompt block not found"]})}),c.jsx(Rv,{leftSlot:c.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Prompt block not found"}),children:c.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Prompt block not found"})})]}):c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(OT,{})}),"Edit prompt block: ",s.name,u&&c.jsx(Ft,{variant:"info",children:"Unpublished changes"})]}),c.jsx(Vs,{children:c.jsx(Gan,{blockId:e,value:n??"",onValueChange:d,variant:"outline",activeVersionId:o})})]}),c.jsx(Ryn,{block:s,blockId:e,selectedVersionId:n,hasDraft:u})]})}function $yn(){const{navigate:e,paths:t}=Yt();return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Bg,{})}),"Create a scorer"]})}),c.jsx(xsn,{onSuccess:r=>e(t.scorerLink(r.id))})]})}function hMe(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 Myn({scorer:e,scorerId:t,selectedVersionId:r}){const n=st(),s=va(),{navigate:a,paths:i}=Yt(),{updateStoredScorer:o}=Fft(t),[l,u]=E.useState(!1),[d,p]=E.useState(!1),f=E.useRef(null),{data:h}=wsn({scorerId:t,versionId:r??""}),m=!!r&&!!h,g=m?h:e,b=E.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:v}=Lft({initialValues:b});E.useEffect(()=>{b&&v.reset(b)},[b,v]);const S=E.useCallback(async()=>{if(!await v.trigger()){Xe.error("Please fill in all required fields");return}p(!0);try{const _=hMe(v.getValues());await o.mutateAsync(_),Xe.success("Draft saved")}catch(_){Xe.error(`Failed to save draft: ${_ instanceof Error?_.message:"Unknown error"}`)}finally{p(!1)}},[v,o]),w=E.useCallback(async()=>{if(!await v.trigger()){Xe.error("Please fill in all required fields");return}u(!0);try{const _=hMe(v.getValues());await o.mutateAsync(_);const T=(await n.getStoredScorer(t).listVersions({sortDirection:"DESC",perPage:1})).versions[0];T&&await n.getStoredScorer(t).activateVersion(T.id),s.invalidateQueries({queryKey:["scorers"]}),s.invalidateQueries({queryKey:["stored-scorers"]}),Xe.success("Scorer published"),a(i.scorerLink(t))}catch(_){Xe.error(`Failed to publish scorer: ${_ instanceof Error?_.message:"Unknown error"}`)}finally{u(!1)}},[v,o,n,t,a,i,s]);return c.jsxs(Rv,{leftSlot:c.jsx($ft,{form:v,onPublish:w,onSaveDraft:S,isSubmitting:l,isSavingDraft:d,formRef:f,mode:"edit"}),children:[m&&c.jsxs(Cp,{variant:"info",className:"m-4 mb-0",children:[c.jsx(Tp,{children:"This is a previous version"}),c.jsx(sy,{as:"p",children:"You are seeing a specific version of the scorer."})]}),c.jsx("form",{ref:f,className:"h-full",children:c.jsx(Mft,{form:v})})]})}function Lyn(){const{scorerId:e}=Ei(),[t,r]=sc(),n=t.get("versionId"),{data:s,isLoading:a}=vsn(e,{status:"draft"}),{data:i}=Bft({scorerId:e??"",params:{sortDirection:"DESC"}}),o=s?.activeVersionId,l=i?.versions?.[0],u=!!(l&&o&&l.id!==o),d=E.useCallback(p=>{r(p?{versionId:p}:{})},[r]);return a?c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Bg,{})}),c.jsx(Nr,{className:"h-6 w-[200px]"})]})}),c.jsx(Rv,{leftSlot:c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(Cn,{className:"h-8 w-8"})}),children:c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(Cn,{className:"h-8 w-8"})})})]}):!s||!e?c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Bg,{})}),"Scorer not found"]})}),c.jsx(Rv,{leftSlot:c.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Scorer not found"}),children:c.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Scorer not found"})})]}):c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Bg,{})}),"Edit scorer: ",s.name,u&&c.jsx(Ft,{variant:"info",children:"Unpublished changes"})]}),c.jsx(Vs,{children:c.jsx(ksn,{scorerId:e,value:n??"",onValueChange:d,variant:"outline",activeVersionId:o})})]}),c.jsx(Myn,{scorer:s,scorerId:e,selectedVersionId:n})]})}function Fyn(){const[e,t]=E.useState(!1),{navigate:r,paths:n}=Yt(),{data:s,isLoading:a}=Y6(),i=s?.datasets??[],o=l=>{t(!1),r(n.datasetLink(l))};return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Vs,{children:c.jsxs(ye,{variant:"light",onClick:()=>t(!0),children:[c.jsx(ve,{children:c.jsx(wF,{})}),"Create Dataset"]})})]}),c.jsx(Si,{isCentered:!a&&i.length===0,children:c.jsx(pcn,{datasets:i,isLoading:a,onCreateClick:()=>t(!0)})}),c.jsx(Ocn,{open:e,onOpenChange:t,onSuccess:o})]})}function Byn(){const{datasetId:e}=Ei(),t=Hd(),[r,n]=E.useState(!1),[s,a]=E.useState(!1),[i,o]=E.useState(!1),[l,u]=E.useState(!1),[d,p]=E.useState(null),{data:f}=ky(e??"");if(!e)return c.jsx(Hr,{children:c.jsx(Si,{children:c.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});const h=b=>{t(`/datasets/${e}/experiments/${b}`)},m=()=>{t("/datasets")},g=b=>{p(b?.version??null)};return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(Ncn,{value:e,variant:"ghost"})})]})}),c.jsxs(Si,{className:"content-stretch",children:[c.jsx(Uun,{datasetId:e,onAddItemClick:()=>a(!0),onEditClick:()=>o(!0),onDeleteClick:()=>u(!0),activeDatasetVersion:d,onVersionSelect:g,experimentTriggerSlot:c.jsxs(ye,{variant:"cta",size:"default",onClick:()=>n(!0),children:[c.jsx(Ybr,{}),d!=null?`Run on v${d}`:"Run Experiment"]})}),c.jsx(Zun,{datasetId:e,version:d??void 0,open:r,onOpenChange:n,onSuccess:h}),c.jsx(qun,{datasetId:e,open:s,onOpenChange:a}),f&&c.jsx(Acn,{open:i,onOpenChange:o,dataset:{id:f.id,name:f.name,description:f?.description||"",inputSchema:f.inputSchema,groundTruthSchema:f.groundTruthSchema}}),f&&c.jsx(Dcn,{open:l,onOpenChange:u,datasetId:f.id,datasetName:f.name,onSuccess:m})]})]})}function zyn(){const{datasetId:e,experimentId:t}=Ei(),{data:r}=ky(e??""),{data:n,isLoading:s,error:a}=Zre(e,t),{data:i,isLoading:o,setEndOfListElement:l,isFetchingNextPage:u,hasNextPage:d}=Wln({datasetId:e,experimentId:t,experimentStatus:n?.status});return!e||!t?null:s?c.jsx(Hr,{children:c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx(Cn,{})})}):a||!n?c.jsx(Hr,{children:c.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",a instanceof Error?a.message:"Unknown error"]})}):c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Or,{as:Pt,to:`/datasets/${e}`,children:r?.name}),c.jsx(Or,{isCurrent:!0,as:"span",children:"Experiment"})]})}),c.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:c.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[c.jsx(mdn,{experimentId:t,experiment:n}),c.jsx(pdn,{experimentId:t,experimentStatus:n?.status,results:i??[],isLoading:o,setEndOfListElement:l,isFetchingNextPage:u,hasNextPage:d})]})})]})}function Uyn(){const{datasetId:e}=Ei(),[t,r]=sc(),{data:n}=ky(e??""),s=t.get("baseline")??"",a=t.get("contender")??"";return!e||!s||!a?c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsxs(Or,{isCurrent:!0,as:"span",children:[c.jsx(ve,{children:c.jsx(_T,{})}),"Compare Experiments"]})]})}),c.jsx(Si,{children:c.jsxs("div",{className:"text-neutral4 text-center py-8",children:[c.jsx("p",{children:"Select two experiments to compare."}),c.jsxs("p",{className:"text-sm mt-2",children:["Use the URL format: /datasets/","{datasetId}","/experiments?baseline=","{experimentIdA}","&contender=","{experimentIdB}"]})]})})]}):c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Or,{as:Pt,to:`/datasets/${e}`,children:n?.name??e?.slice(0,8)}),c.jsxs(Or,{isCurrent:!0,as:"span",children:[c.jsx(ve,{children:c.jsx(_T,{})}),"Experiments Comparison"]})]})}),c.jsx(Si,{children:c.jsxs("div",{className:"max-w-[100rem] w-full px-12 mx-auto grid content-start ",children:[c.jsxs(Rr,{children:[c.jsxs(Rr.Column,{children:[c.jsxs(Rr.Title,{children:[c.jsx(_T,{})," Dataset Experiments Comparison"]}),c.jsxs(Rr.Description,{children:["Comparing"," ",c.jsx(Pt,{to:`/datasets/${e}/experiments/${s}`,children:s.slice(0,8)})," vs"," ",c.jsx(Pt,{to:`/datasets/${e}/experiments/${a}`,children:a.slice(0,8)})]})]}),c.jsx(Rr.Column,{children:c.jsxs(ye,{as:Pt,to:`/datasets/${e}`,variant:"standard",size:"default",children:[c.jsx(ck,{}),"Back to Dataset"]})})]}),c.jsx(vdn,{datasetId:e,experimentIdA:s,experimentIdB:a,onSwap:()=>{r({baseline:a,contender:s})}})]})})]})}function Vyn(){const{datasetId:e,itemId:t}=Ei(),{Link:r}=Yt(),n=Hd(),{data:s,isLoading:a}=hfe(e??"",t??""),{updateItem:i,deleteItem:o}=Ru(),{data:l}=ky(e??""),u=s?.[0]??null,d=u?.isDeleted??!1,[p,f]=E.useState(null),h=E.useMemo(()=>!u||d?{input:"",groundTruth:"",metadata:""}:{input:JSON.stringify(u.input,null,2),groundTruth:u.groundTruth?JSON.stringify(u.groundTruth,null,2):"",metadata:u.metadata?JSON.stringify(u.metadata,null,2):""},[u,d]),m=u?.datasetVersion??0,[g,b]=E.useState(!1),[v,S]=E.useState(h.input),[w,k]=E.useState(h.groundTruth),[_,C]=E.useState(h.metadata),[T,A]=E.useState(m);m!==T&&(A(m),S(h.input),k(h.groundTruth),C(h.metadata));const[N,I]=E.useState(!1),R=X=>{f(d?X:X.isLatest?null:X)},$=()=>{f(null)},F=!d&&p!=null,L=()=>{F||b(!0)},z=()=>{F||I(!0)},q=async()=>{if(!e||!t)return;let X;try{X=JSON.parse(v)}catch{Xe.error("Input must be valid JSON");return}let U;if(w.trim())try{U=JSON.parse(w)}catch{Xe.error("Ground Truth must be valid JSON");return}let j;if(_.trim())try{j=JSON.parse(_)}catch{Xe.error("Metadata must be valid JSON");return}try{await i.mutateAsync({datasetId:e,itemId:t,input:X,groundTruth:U,metadata:j}),Xe.success("Item updated successfully"),b(!1)}catch(Q){Xe.error(`Failed to update item: ${Q instanceof Error?Q.message:"Unknown error"}`)}},H=()=>{u&&(S(JSON.stringify(u.input,null,2)),k(u.groundTruth?JSON.stringify(u.groundTruth,null,2):""),C(u.metadata?JSON.stringify(u.metadata,null,2):"")),b(!1)},V=async()=>{if(!(!e||!t))try{await o.mutateAsync({datasetId:e,itemId:t}),Xe.success("Item deleted successfully"),I(!1),n(`/datasets/${e}`)}catch(X){Xe.error(`Failed to delete item: ${X instanceof Error?X.message:"Unknown error"}`)}},G=p??u,M=G?{id:t??"",datasetId:e??"",datasetVersion:G.datasetVersion,input:G.input,groundTruth:G.groundTruth,metadata:G.metadata,createdAt:G.createdAt,updatedAt:G.updatedAt}:null;return a?null:!e||!t||!s||s.length===0?c.jsx(Hr,{children:c.jsx(Si,{children:c.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):c.jsxs(c.Fragment,{children:[c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Or,{as:Pt,to:`/datasets/${e}`,children:l?.name}),c.jsx(Or,{isCurrent:!0,as:"span",children:"Item"})]})}),c.jsx("div",{className:"h-full overflow-hidden px-6 pb-4",children:c.jsxs("div",{className:"grid gap-6 max-w-[60rem] mx-auto grid-rows-[auto_1fr] h-full",children:[c.jsxs(Rr,{children:[c.jsxs(Rr.Column,{children:[c.jsxs(Rr.Title,{children:[c.jsx(Rbr,{}),t," ",c.jsx(ql,{content:t})]}),c.jsx(Rr.Description,{children:c.jsxs(xs,{children:["Item of ",c.jsx(ku,{})," ",l?.name]})}),c.jsxs(Rr.Description,{children:[c.jsxs(xs,{children:[c.jsx(bbr,{})," Created at"," ",u?.createdAt?vn(new Date(u.createdAt),"MMM d, yyyy"):""]}),c.jsxs(xs,{children:[c.jsx(SF,{})," Latest version v",u?.datasetVersion??""]})]})]}),c.jsx(Rr.Column,{children:!g&&!d&&c.jsxs(Xo,{children:[c.jsxs(ye,{variant:"cta",size:"default",onClick:L,disabled:F,title:F?"Return to latest version to edit":void 0,children:[c.jsx(Gbr,{})," Edit"]}),c.jsxs(ye,{variant:"cta",size:"default",onClick:z,disabled:F,title:F?"Return to latest version to delete":void 0,children:[c.jsx(lvr,{})," Delete"]})]})})]}),c.jsxs(lx,{className:g?"grid-cols-1":"grid-cols-[1fr_auto]",children:[c.jsxs(Un,{withRightSeparator:!g,children:[d&&u&&c.jsxs(Vo,{variant:"destructive",children:[c.jsx(jee,{}),c.jsxs(Vo.Message,{children:["This item was deleted at version v",u.datasetVersion]})]}),!d&&F&&p&&c.jsx(c.Fragment,{children:c.jsxs(Vo,{variant:"warning",children:[c.jsx(jee,{}),c.jsxs(Vo.Message,{children:["Viewing version v",p.datasetVersion]}),c.jsxs(Vo.Button,{onClick:$,children:[c.jsx(pbr,{})," Return to the latest version"]})]})}),g?c.jsx(wmt,{inputValue:v,setInputValue:S,groundTruthValue:w,setGroundTruthValue:k,metadataValue:_,setMetadataValue:C,validationErrors:null,onSave:q,onCancel:H,isSaving:i.isPending}):M?c.jsx(s8,{item:M,Link:r}):c.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!g&&c.jsx(Un,{children:c.jsx(xdn,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:R,onCompareVersionsClick:X=>{n(`/datasets/${e}/items/${t}/versions?ids=${X.join(",")}`)},activeVersion:p?.datasetVersion??null})})]})]})})]}),c.jsx(qt,{open:N,onOpenChange:I,children:c.jsxs(qt.Content,{children:[c.jsxs(qt.Header,{children:[c.jsx(qt.Title,{children:"Delete Item"}),c.jsx(qt.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),c.jsxs(qt.Footer,{children:[c.jsx(qt.Cancel,{children:"Cancel"}),c.jsx(qt.Action,{onClick:V,children:o.isPending?"Deleting...":"Delete"})]})]})})]})}function mMe(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function qyn(){const{datasetId:e}=Ei(),[t,r]=sc(),n=t.get("items")?.split(",").filter(Boolean)??[],{data:s}=ky(e??""),{Link:a}=Yt(),[i,o]=E.useState(!1),{data:l}=Qre(e??"",n[0]??""),{data:u}=Qre(e??"",n[1]??"");return!e||n.length<2?c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Or,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),c.jsx(Si,{children:c.jsx("div",{className:"text-neutral4 text-center py-8",children:c.jsx("p",{children:"Select at least two items to compare."})})})]}):c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Or,{as:Pt,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),c.jsx(Or,{isCurrent:!0,as:"span",children:"Compare Items"})]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:`/datasets/${e}`,variant:"outline",children:[c.jsx(ve,{children:c.jsx(ck,{})}),"Back to Dataset"]})})]}),c.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:c.jsxs("div",{className:K("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":i}),children:[c.jsxs(Rr,{children:[c.jsxs(Rr.Column,{children:[c.jsxs(Rr.Title,{children:[c.jsx(_T,{}),"Compare Dataset Items"]}),c.jsx(Rr.Description,{children:c.jsxs(xs,{children:["Comparing ",n.length," items of"," ",c.jsx(Pt,{to:`/datasets/${e}`,className:"text-info1 hover:underline",children:s?.name||e?.slice(0,8)})]})})]}),c.jsx(Rr.Column,{children:c.jsxs(Xo,{children:[c.jsxs(ye,{as:Pt,to:`/datasets/${e}`,variant:"standard",size:"default",children:[c.jsx(ck,{}),"Back to Dataset"]}),c.jsx(ye,{variant:"cta",size:"default",onClick:()=>o(d=>!d),children:i?c.jsxs(c.Fragment,{children:[c.jsx(mKe,{})," Default View"]}):c.jsxs(c.Fragment,{children:[c.jsx(Abr,{})," Diff View"]})})]})})]}),c.jsx(lx,{className:"grid-cols-[1fr_3vw_1fr]",children:n.map((d,p)=>c.jsxs(E.Fragment,{children:[c.jsx(Hyn,{datasetId:e,itemId:d,Link:a,idx:p,itemIds:n,showContent:!i,onItemChange:f=>{const h=[...n];h[p]=f,r({items:h.join(",")})}}),p==0&&c.jsx("div",{className:K("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},d))}),i&&l&&u&&c.jsx(Rmt,{codeA:mMe(l),codeB:mMe(u)})]})})]})}function Hyn({datasetId:e,itemId:t,Link:r,idx:n,itemIds:s,onItemChange:a,showContent:i=!0}){const{data:o,isLoading:l}=Qre(e,t),{data:u}=$4(e),d=new Set(s.filter((f,h)=>h!==n)),p=(u??[]).map(f=>({value:f.id,label:f.id,disabled:d.has(f.id)}));return c.jsxs(Un,{children:[c.jsxs(Un.Toolbar,{className:"flex gap-4",children:[c.jsx(jc,{label:"Item",name:`compare-item-${n}`,value:t,onValueChange:a,options:p,placeholder:"Select item",variant:"experimental",size:"default",labelIsHidden:!0}),c.jsxs(ye,{as:r,to:`/datasets/${e}/items/${t}`,variant:"standard",size:"default",children:[c.jsx(SF,{}),"Versions"]})]}),i&&c.jsx(Un.Content,{children:l?c.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):o?c.jsxs(c.Fragment,{children:[c.jsx(Smt,{item:o}),c.jsx(s8,{item:o,Link:r})]}):c.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function gMe(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function Qyn(){const{datasetId:e,itemId:t}=Ei(),[r,n]=sc(),[s,a]=E.useState(!1),i=r.get("ids")?.split(",").map(Number).filter(f=>!isNaN(f)&&f>0)??[],{data:o}=ky(e??""),{Link:l}=Yt(),{data:u}=hfe(e??"",t??""),{data:d}=Gre(e??"",t??"",i[0]??0,o?.version),{data:p}=Gre(e??"",t??"",i[1]??0,o?.version);return!e||!t||i.length<2?c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Or,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),c.jsx(Si,{children:c.jsx("div",{className:"text-neutral4 text-center py-8",children:c.jsx("p",{children:"Select at least two versions to compare."})})})]}):c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Or,{as:Pt,to:`/datasets/${e}`,children:o?.name}),c.jsx(Or,{as:Pt,to:`/datasets/${e}/items/${t}`,children:"Item"}),c.jsx(Or,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[c.jsx(ve,{children:c.jsx(ck,{})}),"Back to Item"]})})]}),c.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:c.jsxs("div",{className:K("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":s}),children:[c.jsxs(Rr,{children:[c.jsxs(Rr.Column,{children:[c.jsxs(Rr.Title,{children:[c.jsx(_T,{}),"Compare Dataset Item Versions"]}),c.jsx(Rr.Description,{children:c.jsxs(xs,{children:["Comparing ",i.length," versions of"," ",c.jsx(Pt,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),c.jsx(Rr.Column,{children:c.jsxs(Xo,{children:[c.jsxs(ye,{as:Pt,to:`/datasets/${e}/items/${t}`,variant:"standard",size:"default",children:[c.jsx(ck,{}),"Back to Item"]}),c.jsx(ye,{variant:"cta",size:"default",onClick:()=>a(f=>!f),children:s?c.jsxs(c.Fragment,{children:[c.jsx(mKe,{})," Default View"]}):c.jsxs(c.Fragment,{children:[c.jsx(Fbr,{})," Diff View"]})})]})})]}),c.jsx(lx,{className:"grid-cols-[1fr_3vw_1fr]",children:i.map((f,h)=>c.jsxs(E.Fragment,{children:[c.jsx(Gyn,{datasetId:e,itemId:t,datasetVersion:f,latestVersion:o?.version,allVersions:u??[],versionNumbers:i,Link:l,idx:h,showContent:!s,onVersionChange:m=>{const g=[...i];g[h]=m,n({ids:g.join(",")})}}),h===0&&c.jsx("div",{className:K("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},f))}),s&&d&&p&&c.jsx(Rmt,{codeA:gMe(d),codeB:gMe(p)})]})})]})}function Gyn({datasetId:e,itemId:t,datasetVersion:r,latestVersion:n,allVersions:s,versionNumbers:a,Link:i,idx:o,showContent:l=!0,onVersionChange:u}){const{data:d,isLoading:p}=Gre(e,t,r,n),f=new Set(a.filter((g,b)=>b!==o)),h=s.map(g=>{const b=typeof g.updatedAt=="string"?new Date(g.updatedAt):g.updatedAt;return{value:String(g.datasetVersion),label:c.jsxs(c.Fragment,{children:[c.jsxs("b",{children:["v. ",g.datasetVersion]})," - ",vn(b,"MMM d, yyyy h:mm a"),g.isLatest?c.jsx(fo,{color:"blue",size:"small",children:"Latest"}):null]}),disabled:f.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 c.jsxs(Un,{children:[c.jsxs(Un.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[c.jsx(SF,{className:"w-6 h-6 opacity-50"}),c.jsx(jc,{label:"Version",name:`compare-version-${o}`,value:String(r),onValueChange:g=>u(Number(g)),options:h,placeholder:"Select version",variant:"experimental",size:"default",labelIsHidden:!0,className:"w-full"})]}),l&&c.jsx(Un.Content,{children:p?c.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):!d||!m?c.jsxs("div",{className:"text-neutral4 text-sm",children:["Version ",r," not found"]}):c.jsx(s8,{item:m,Link:i})})]})}function Zyn(){const{datasetId:e}=Ei(),[t]=sc(),r=t.get("ids")?.split(",").map(Number).filter(m=>!isNaN(m)&&m>0)??[],n=Hd(),{data:s}=ky(e??""),a=$4(e??"",void 0,r[0]??null),i=$4(e??"",void 0,r[1]??null),o=E.useMemo(()=>a.data??[],[a.data]),l=E.useMemo(()=>i.data??[],[i.data]),u=E.useMemo(()=>{const m=new Map;for(const g of[...o,...l])m.has(g.id)||m.set(g.id,{id:g.id,createdAt:new Date(g.createdAt)});return[...m.values()].sort((g,b)=>b.createdAt.getTime()-g.createdAt.getTime())},[o,l]),d=E.useMemo(()=>new Map(o.map(m=>[m.id,m])),[o]),p=E.useMemo(()=>new Map(l.map(m=>[m.id,m])),[l]);if(!e||r.length<2)return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Or,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),c.jsx(Si,{children:c.jsx("div",{className:"text-neutral4 text-center py-8",children:c.jsx("p",{children:"Select at least two versions to compare."})})})]});const f=(m,g,b)=>{n(`/datasets/${e}/items/${m}/versions?ids=${g?.datasetVersion??""},${b?.datasetVersion??""}`)},h=(m,g)=>{n(`/datasets/${e}/versions?ids=${m},${g}`,{replace:!0})};return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/datasets",children:[c.jsx(ve,{children:c.jsx(ku,{})}),"Datasets"]}),c.jsx(Or,{as:Pt,to:`/datasets/${e}`,children:s?.name||e?.slice(0,8)}),c.jsxs(Or,{isCurrent:!0,as:"span",children:[c.jsx(ve,{children:c.jsx(fAe,{})}),"Compare Versions"]})]})}),c.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:c.jsxs("div",{className:"grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[c.jsxs(Rr,{children:[c.jsxs(Rr.Column,{children:[c.jsxs(Rr.Title,{children:[c.jsx(fAe,{})," Compare Dataset Versions"]}),c.jsx(Rr.Description,{children:c.jsxs(xs,{children:[c.jsx(SF,{})," Comparing ",r.length," versions of"," ",s?.name||e?.slice(0,8)]})})]}),c.jsx(Rr.Column,{children:c.jsxs(ye,{as:Pt,to:`/datasets/${e}`,variant:"standard",size:"default",children:[c.jsx(ck,{}),"Back to Dataset"]})})]}),c.jsx(lx,{children:c.jsxs(Un,{children:[c.jsx(Edn,{datasetId:e,versionA:String(r[0]),versionB:String(r[1]),onVersionChange:h}),c.jsx(Cdn,{datasetId:e,versionA:r[0],versionB:r[1],allItems:u,itemsAMap:d,itemsBMap:p,onItemClick:f})]})})]})})]})}function Wyn(){const[e]=sc(),t=Hd(),r=e.get("redirect")||"/",s=e.get("mode")==="signup"?"signup":"signin",a=e.get("error_description")||e.get("error")||null,i=()=>{r.startsWith("http")?window.location.href=r:t(r,{replace:!0})};return c.jsx(Hft,{redirectUri:r,onSuccess:i,initialMode:s,errorMessage:a})}const Xyn=()=>{const{data:e=[],isLoading:t,error:r}=fj(),n=!t&&e.length===0;return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Gf,{})}),"MCP Servers"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"MCP documentation"]})})]}),c.jsx(Si,{isCentered:n,children:c.jsx(Zdn,{mcpServers:e,isLoading:t,error:r})})]})},Yyn=()=>{const{serverId:e}=Ei(),{data:t=[],isLoading:r}=fj(),n=t.find(s=>s.id===e);return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/mcps",children:[c.jsx(ve,{children:c.jsx(Gf,{})}),"MCP Servers"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(Fht,{value:e,variant:"ghost"})})]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"MCP documentation"]})})]}),c.jsx(Jdn,{isLoading:r,server:n})]})},Kyn=()=>{const{data:e}=fj(),{serverId:t,toolId:r}=Ei(),{data:n,isLoading:s}=$mt(t,r),a=e?.find(l=>l.id===t),i=n?.name,o=a?.name||"";return s||!n?null:c.jsxs("div",{className:"h-full w-full bg-surface2 overflow-y-hidden",children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/mcps",children:[c.jsx(ve,{children:c.jsx(Gf,{})}),"MCP Servers"]}),c.jsx(Or,{as:Pt,to:`/mcps/${t}`,children:o}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:i})]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"MCP documentation"]})})]}),c.jsx(Kdn,{toolId:r,serverId:t})]})},Jyn=(e,t)=>{const r=st();return ur({queryKey:["trace",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return await r.getTrace(e)},enabled:!!e,refetchInterval:3e3,...t})},ebn=async({client:e,page:t,perPage:r,filters:n})=>e.listTraces({pagination:{page:t,perPage:r},filters:n}),tbn=25;function rbn(e,t,r){if(e?.pagination?.hasMore)return r+1}function nbn(e){const t=new Set;return e.pages.flatMap(r=>r.spans??[]).filter(r=>t.has(r.traceId)?!1:(t.add(r.traceId),!0))}const sbn=({filters:e})=>{const t=st(),{inView:r,setRef:n}=H6(),s=CI({queryKey:["traces",e],queryFn:({pageParam:l})=>ebn({client:t,page:l,perPage:tbn,filters:e}),initialPageParam:0,getNextPageParam:rbn,select:nbn,retry:!1,refetchInterval:l=>Mc(l.state.error)?!1:3e3}),{hasNextPage:a,isFetchingNextPage:i,fetchNextPage:o}=s;return E.useEffect(()=>{r&&a&&!i&&o()},[r,a,i,o]),{...s,setEndOfListElement:n}};function abn(){const e=Hd(),[t,r]=sc(),[n,s]=E.useState(),[a,i]=E.useState({value:"all",label:"All",type:"all"}),[o,l]=E.useState(void 0),[u,d]=E.useState(void 0),[p,f]=E.useState(!1),{data:h={},isLoading:m}=ah(),{data:g,isLoading:b}=wy(),{data:v={},isLoading:S}=Oy(),{data:w,isLoading:k}=Jyn(n,{enabled:!!n}),_=t.get("traceId"),C=t.get("spanId"),T=t.get("tab"),A=t.get("scoreId"),{data:N=[],isLoading:I,isFetchingNextPage:R,hasNextPage:$,setEndOfListElement:F,error:L,isError:z}=sbn({filters:{...a?.type!=="all"&&{entityId:a?.value,entityType:a?.type},...o&&{startedAt:{start:o}},...u&&{endedAt:{end:u}}}});_&&_!==n&&(s(_),f(!0));const q=E.useMemo(()=>(Object.entries(h)||[]).map(([se,ce])=>({value:ce.id,label:ce.name,type:gD.AGENT})),[h]),H=E.useMemo(()=>(Object.entries(g||{})||[]).map(([,se])=>({value:se.name,label:se.name,type:gD.WORKFLOW_RUN})),[g]),V=E.useMemo(()=>[{value:"all",label:"All",type:"all"},...q,...H],[q,H]),G=t.get("entity"),M=V.find(se=>se.value===G);M&&M.value!==a?.value&&i(M);const X=()=>{s(void 0),r({entity:"all",traceId:""}),f(!1),l(void 0),d(void 0)},U=(se,ce)=>{if(ce==="from")return l(se);d(se)},j=se=>{se?.value&&r({entity:se.value})},Q=se=>{if(se===n)return s(void 0);s(se),f(!0)},Z=z?Udn(L):void 0;if(L&&Mc(L))return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(dE,{})}),"Observability"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Observability documentation"]})})]}),c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"traces"})})]});const J=a?.value!=="all"||o||u,ee=ife({entries:N.map(se=>({id:se.traceId})),id:n,update:s}),te=ofe({entries:N.map(se=>({id:se.traceId})),id:n,update:s});return c.jsxs(c.Fragment,{children:[c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(dE,{})}),"Observability"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Observability documentation"]})})]}),c.jsx("div",{className:K("grid overflow-y-auto h-full"),children:c.jsxs("div",{className:K("max-w-[100rem] px-12 mx-auto grid content-start gap-8 h-full"),children:[c.jsx(GT,{title:"Observability",description:"Explore observability traces for your entities",icon:c.jsx(dE,{})}),c.jsx(qln,{onEntityChange:j,onReset:X,selectedEntity:a,entityOptions:V,onDateChange:U,selectedDateFrom:o,selectedDateTo:u,isLoading:I||m||b}),I?c.jsx(Ift,{columns:q$}):c.jsx(Hln,{traces:N,selectedTraceId:n,onTraceClick:Q,errorMsg:Z?.error,setEndOfListElement:F,filtersApplied:!!J,isFetchingNextPage:R,hasNextPage:$})]})})]}),c.jsx(Vln,{traceSpans:w?.spans,traceId:n,initialSpanId:C||void 0,initialSpanTab:T==="scores"?"scores":"details",initialScoreId:A||void 0,traceDetails:N.find(se=>se.traceId===n),isOpen:p,onClose:()=>{e("/observability"),f(!1)},onNext:ee,onPrevious:te,isLoadingSpans:k,computeTraceLink:(se,ce)=>`/observability?traceId=${se}${ce?`&spanId=${ce}`:""}`,scorers:v,isLoadingScorers:S})]})}function ibn(){const{Link:e,paths:t}=Yt(),{data:r,isLoading:n}=vht(),{isCmsAvailable:s}=pS(),a=r?.promptBlocks??[];return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(xF,{})}),"Prompts"]}),c.jsxs(Vs,{children:[s&&c.jsxs(ye,{variant:"light",as:e,to:t.cmsPromptBlockCreateLink(),children:[c.jsx(ve,{children:c.jsx(wF,{})}),"Create a prompt block"]}),c.jsxs(ye,{variant:"outline",as:Pt,to:"https://mastra.ai/en/docs/agents/agent-instructions#prompt-blocks",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})]})]}),c.jsx(Si,{isCentered:!n&&a.length===0,children:c.jsx(Uan,{isLoading:n,promptBlocks:a})})]})}function obn(){return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(gKe,{})}),"Request Context"]})}),c.jsx(Si,{children:c.jsx($nn,{children:c.jsx(Pnn,{})})})]})}function lbn(){const{Link:e}=Yt(),{data:t={},isLoading:r,error:n}=Oy(),{isCmsAvailable:s}=pS();return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Bg,{})}),"Scorers"]}),c.jsxs(Vs,{children:[s&&c.jsxs(ye,{variant:"light",as:e,to:"/cms/scorers/create",children:[c.jsx(ve,{children:c.jsx(wF,{})}),"Create a scorer"]}),c.jsxs(ye,{variant:"outline",as:Pt,to:"https://mastra.ai/en/docs/evals/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Scorers documentation"]})]})]}),c.jsx(Si,{isCentered:!r&&Object.keys(t||{}).length===0,children:c.jsx(fsn,{isLoading:r,scorers:t,error:n})})]})}function cbn(){const{scorerId:e}=Ei(),[t,r]=sc(),[n,s]=E.useState(),[a,i]=E.useState(0),[o,l]=E.useState(!1),[u,d]=E.useState({value:"all",label:"All",type:"ALL"}),{scorer:p,isLoading:f,error:h}=csn(e),{data:m={},isLoading:g,error:b}=ah(),{data:v,isLoading:S,error:w}=wy(),{data:k,isLoading:_,error:C}=lsn({scorerId:e,page:a,entityId:u?.value==="all"?void 0:u?.value,entityType:u?.type==="ALL"?void 0:u?.type}),T=E.useMemo(()=>p?.agentIds?.filter(U=>m[U]).map(U=>({value:U,label:m[U].name,type:"AGENT"}))||[],[p?.agentIds,m]),A=E.useMemo(()=>p?.workflowIds?.map(U=>({value:U,label:U,type:"WORKFLOW"}))||[],[p?.workflowIds]),N=E.useMemo(()=>[{value:"all",label:"All",type:"ALL"},...T,...A],[T,A]),I=t.get("entity"),R=N.find(U=>U.value===I);if(R&&R.value!==u?.value&&d(R),E.useEffect(()=>{if(h){const U=h instanceof Error?h.message:"Failed to load scorer";Xe.error(`Error loading scorer: ${U}`)}},[h]),E.useEffect(()=>{if(b){const U=b instanceof Error?b.message:"Failed to load agents";Xe.error(`Error loading agents: ${U}`)}},[b]),E.useEffect(()=>{if(w){const U=w instanceof Error?w.message:"Failed to load workflows";Xe.error(`Error loading workflows: ${U}`)}},[w]),h&&Mc(h))return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/scorers",children:[c.jsx(ve,{children:c.jsx(Bg,{})}),"Scorers"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:e})]})}),c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"scorers"})})]});if(f||h||b||w)return null;const $=p?.agentIds?.map(U=>({name:U,id:Object.entries(m).find(([,j])=>j.name===U)?.[0]}))||[],F=p?.workflowIds?.map(U=>({name:U,id:Object.entries(v||{}).find(([,j])=>j.name===U)?.[0]}))||[],z=[{key:"entities",label:"Entities",value:([...$.map(U=>({id:U.id,name:U.name,type:"AGENT"})),...F.map(U=>({id:U.id,name:U.name,type:"WORKFLOW"}))]||[]).map(U=>({id:U.id,name:U.name||U.id,path:`${U.type==="AGENT"?"/agents":"/workflows"}/${U.name}`}))}],q=U=>{U?.value&&r({entity:U.value})},H=k?.scores||[],V=k?.pagination,G=U=>{s(U),l(!0)},M=ife({entries:H,id:n,update:s}),X=ofe({entries:H,id:n,update:s});return c.jsxs(c.Fragment,{children:[c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/scorers",children:[c.jsx(ve,{children:c.jsx(Bg,{})}),"Scorers"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(usn,{value:e,variant:"ghost"})})]}),c.jsxs(Vs,{children:[p?.scorer?.source==="stored"&&c.jsxs(ye,{variant:"light",as:Pt,to:`/cms/scorers/${e}/edit`,children:[c.jsx(ve,{children:c.jsx(Wbr,{})}),"Edit"]}),c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/evals/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Scorers documentation"]})]})]}),c.jsx("div",{className:K("grid overflow-y-auto h-full"),children:c.jsxs("div",{className:K("max-w-[100rem] w-full px-12 mx-auto grid content-start gap-8 h-full"),children:[c.jsx(GT,{title:p?.scorer?.config?.name||"loading",description:p?.scorer?.config?.description||"loading",icon:c.jsx(Bg,{})}),c.jsx(gS,{data:z,LinkComponent:Pt,isLoading:g||S}),c.jsx(osn,{selectedEntity:u,entityOptions:N,onEntityChange:q,onReset:()=>r({entity:"all"}),isLoading:_||g||S}),_?c.jsx("div",{className:"h-full w-full flex items-center justify-center",children:c.jsx(Cn,{})}):c.jsx(Hnn,{scores:H,selectedScoreId:n,pagination:{total:V?.total||0,hasMore:V?.hasMore||!1,perPage:V?.perPage||0,page:V?.page||0},onScoreClick:G,onPageChange:i,errorMsg:C?.message})]})})]}),c.jsx(Pft,{scorerName:p?.scorer?.config?.name,score:ubn(H.find(U=>U.id===n)),isOpen:o,onClose:()=>l(!1),onNext:M,onPrevious:X,computeTraceLink:(U,j)=>`/observability?traceId=${U}${j?`&spanId=${j}`:""}`})]})}const ubn=e=>{if(e)return{...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt)}},dbn=()=>{const{baseUrl:e,headers:t}=afe();return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Fpe,{})}),"Settings"]})}),c.jsx(Si,{children:c.jsx("div",{className:"p-5",children:c.jsx("div",{className:"max-w-2xl p-5 w-full bg-surface3 border border-border1 rounded-lg",children:c.jsx(Oft,{initialConfig:{baseUrl:e,headers:t}})})})})]})};function pbn(){const[e]=sc(),t=Hd(),r=e.get("redirect")||"/",n=()=>{r.startsWith("http")?window.location.href=r:t(r,{replace:!0})};return c.jsx(Hft,{redirectUri:r,onSuccess:n,initialMode:"signup"})}async function Ayt(){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(),r=[{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],n=Array.from(new Set(r.flatMap(a=>a.tags))),s=Array.from(new Set(r.flatMap(a=>a.supportedProviders)));return{templates:r,tags:n,providers:s}}async function fbn({repo:e,owner:t}){const r=await fetch(`https://api.github.com/repos/${t}/${e}`);if(!r.ok)throw new Error(`Failed to fetch template: ${r.statusText}`);const n=await r.json();if(!n.is_template)throw new Error("Repo is not a template, please update the repo settings to make it a template");return{title:n.name,slug:n.name,description:n.description??"",imageURL:"",tags:[],useCase:"",longDescription:n.description??"",githubUrl:n.html_url,supportedProviders:[]}}async function hbn({repoOrSlug:e,owner:t}){const{templates:r}=await Ayt(),n=r.find(s=>s.slug===e);if(!n){if(e.startsWith("template-")){const a=r.find(i=>`template-${i.slug}`===e);if(a)return a}const s=await fbn({repo:e,owner:t});if(s)return s;throw new Error(`Template ${e} not found`)}return n}async function mbn({repo:e,owner:t,branch:r}){const n=`https://raw.githubusercontent.com/${t}/${e}/${r}/.env.example`,s=await fetch(n);return s.ok?(await s.text()).split(`
615
- `).reduce((o,l)=>{if(!l||l.startsWith("#"))return o;const[u,d]=l.split("=");return u&&(o[u]=d?.split("")?.every(p=>p==="*")?"":d?.replaceAll('"',"")),o},{}):{}}const gbn=()=>ur({queryKey:["mastra-templates"],queryFn:Ayt}),ybn=({repoOrSlug:e,owner:t})=>ur({queryKey:["template-repo",e,t],queryFn:()=>hbn({repoOrSlug:e,owner:t})}),bbn=({repo:e,owner:t,branch:r})=>ur({queryKey:["template-repo-env-vars",e,t,r],queryFn:()=>mbn({repo:e,owner:t,branch:r})}),vbn=()=>{const e=st();return ur({queryKey:["agent-builder-workflow"],queryFn:async()=>await e.getAgentBuilderAction("merge-template").details()})},xbn=()=>{const e=st();return Kr({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").createRun({runId:t})})},Sbn=()=>{const e=st();return Kr({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").runById(t)})},yMe=(e,t,r)=>{let n={...t};if(!(n.payload?.workflowState?.steps&&Object.keys(n.payload.workflowState.steps).length>0)&&r?.allSteps&&(n.payload={...n.payload,workflowState:{...n.payload?.workflowState,steps:Object.keys(r.allSteps).reduce((a,i)=>(a[i]={id:i,description:r.allSteps[i].description,status:"pending"},a),{})}}),e.type==="start"||e.type==="workflow-start"){const a={};r?.allSteps&&Object.entries(r.allSteps).forEach(([o,l])=>{a[o]={id:l.id,description:l.description,status:"pending"}});const i=e.runId||e.payload?.runId;n={...n,runId:i,eventTimestamp:new Date().toISOString(),status:"running",phase:"initializing",payload:{workflowState:{status:"running",steps:a},currentStep:null}}}if(e.type==="step-start"||e.type==="workflow-step-start"){const a=e.payload.id;n={...n,phase:"processing",payload:{...n.payload,currentStep:{id:a,status:"running",startTime:new Date,...e.payload},workflowState:{...n.payload.workflowState,steps:{...n.payload.workflowState.steps,[a]:{...n.payload.workflowState.steps[a],status:"running",startTime:new Date,...e.payload}}}}}}if(e.type==="step-result"||e.type==="workflow-step-result"){const a=e.payload.id,i=e.payload.status,o=e.payload.error;n={...n,payload:{...n.payload,currentStep:{...n.payload.currentStep,status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date},workflowState:{...n.payload.workflowState,steps:{...n.payload.workflowState.steps,[a]:{...n.payload.workflowState.steps[a],status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date}}}}},i==="failed"&&o&&(n={...n,status:"failed",error:o,phase:"error",failedStep:{id:a,error:o,description:e.payload.description||a},payload:{...n.payload,workflowState:{...n.payload.workflowState,status:"failed"}},errorTimestamp:new Date})}return(e.type==="step-finish"||e.type==="workflow-step-finish")&&(n={...n,payload:{...n.payload,currentStep:null}}),(e.type==="finish"||e.type==="workflow-finish")&&(n.phase==="error"||n.status==="failed"?n={...n,completedAt:new Date}:n={...n,status:e.payload.status||"completed",phase:"completed",payload:{...n.payload,currentStep:null,workflowState:{...n.payload.workflowState,status:e.payload.status||"completed"}},completedAt:new Date}),e.type==="error"&&(n={...n,status:"failed",error:e.payload.error,phase:"error",payload:{...n.payload,workflowState:{...n.payload.workflowState,status:"failed"}},errorTimestamp:new Date}),{newState:n}},wbn=(e,t)=>{try{localStorage.setItem(`template-install-${e}`,JSON.stringify({state:t,timestamp:Date.now()}))}catch(r){console.warn("Failed to save template state to localStorage:",r)}},Dyt=(e,t)=>{const[r,n]=E.useState({}),[s,a]=E.useState(!1);return{streamResult:r,isStreaming:s,processStream:async(o,l)=>{if(a(!0),n({}),!o)throw new Error("No stream returned");const u=o.getReader();let d={runId:l||t,eventTimestamp:new Date().toISOString(),phase:"running",payload:{workflowState:{steps:{}},currentStep:null}};try{for(;;){const{done:p,value:f}=await u.read();if(p)break;const{newState:h}=yMe(f,d,e);if(d=h,n(h),f.runId||l||t){const m=f.runId||l||t;wbn(m,h)}}}catch(p){console.error("💥 [processStream] Error processing template installation stream:",p);const{newState:f}=yMe({type:"error",payload:{error:p instanceof Error?p.message:"Unknown error"}},d,e);n(f)}finally{a(!1),u.releaseLock()}}}},Ebn=e=>{const t=st(),{streamResult:r,isStreaming:n,processStream:s}=Dyt(e);return{streamInstall:Kr({mutationFn:async({inputData:i,selectedModel:o,runId:l})=>{for(let d=1;d<=3;d++)try{const p=t.getAgentBuilderAction("merge-template"),f=new bp;f.set("selectedModel",o);const h=await p.stream({inputData:i,requestContext:f},l);await s(h,l);return}catch(p){console.error(`💥 [streamInstall] Attempt ${d} failed:`,p);const f=p?.message?.includes("Failed to fetch")||p?.message?.includes("NetworkError")||p?.message?.includes("network error")||p?.message?.includes("fetch")||p?.code==="NETWORK_ERROR"||p?.name==="TypeError";if(console.warn(`Stream attempt ${d}/3 failed:`,p),f){const h=l?`Network error during template installation (likely hot reload). Please refresh the page to resume from where you left off using runId: ${l}`:"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:",p),p}}}),streamResult:r,isStreaming:n}},kbn=e=>{const t=st(),{streamResult:r,isStreaming:n,processStream:s}=Dyt(e);return{observeInstall:Kr({mutationFn:async({runId:i})=>{for(let u=1;u<=3;u++)try{const p=await t.getAgentBuilderAction("merge-template").observeStream({runId:i});await s(p,i);return}catch(d){console.error(`💥 [observeInstall] Attempt ${u} failed:`,d);const p=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),p&&u<3){console.info(`🔄 ObserveStream network error detected (likely hot reload), retrying in 2000ms... (attempt ${u+1}/3)`),await new Promise(f=>setTimeout(f,2e3));continue}throw console.error("❌ [observeInstall] Non-network error or max retries reached, throwing:",d),d}}}),streamResult:r,isStreaming:n}};function Obn(){const{data:e,isLoading:t}=gbn(),{templates:r,tags:n,providers:s}=e??{templates:[],tags:[],providers:[]},[a,i]=E.useState("all"),[o,l]=E.useState("all"),[u,d]=E.useState(""),p=[{value:"all",label:"All"}];(n||[]).forEach(S=>{p.push({value:S,label:S})});const f=[{value:"all",label:"All"}];(s||[]).forEach(S=>{f.push({value:S,label:S})});const h=(S,w)=>{w==="tag"?i(S):w==="provider"&&l(S)},m=S=>{d(S)},g=()=>{i("all"),l("all"),d("")},b=r.filter(S=>!(u&&!S.title.toLowerCase().includes(u)&&!S.description.toLowerCase().includes(u)||a!=="all"&&!S.tags.includes(a)||o!=="all"&&!S.supportedProviders.includes(o))),v=u||a!=="all"||o!=="all";return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(ace,{})}),"Templates"]})}),c.jsxs("div",{className:K("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[c.jsx(fln,{selectedTag:a,onTagChange:S=>h(S,"tag"),tagOptions:p,selectedProvider:o,onProviderChange:S=>h(S,"provider"),providerOptions:f,searchTerm:u,onSearchChange:m,onReset:v?g:void 0,className:"max-w-[80rem]",isLoading:t}),c.jsx(mln,{templates:b,linkComponent:Pt,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const _bn="1.10.0-alpha.0";function Cbn(){const{templateSlug:e}=Ei(),[t,r]=sc(),[n,s]=E.useState(""),[a,i]=E.useState(""),[o,l]=E.useState(""),[u,d]=E.useState({}),[p,f]=E.useState([]),[h,m]=E.useState(null),[g,b]=E.useState(!1),[v,S]=E.useState(""),[w,k]=E.useState(!1),[_,C]=E.useState(!1),[T,A]=E.useState([]),{data:N,isLoading:I}=ybn({repoOrSlug:e,owner:"mastra-ai"}),$=_bn?.includes("beta")??!1?"beta":"main",{data:F,isLoading:L}=bbn({repo:N?.githubUrl?new URL(N.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:$}),{data:z,isLoading:q}=vbn(),{mutateAsync:H,isPending:V}=xbn(),{mutateAsync:G}=Sbn(),{streamInstall:M,streamResult:X,isStreaming:U}=Ebn(z),{observeInstall:j,streamResult:Q,isStreaming:Z}=kbn(z);E.useEffect(()=>{const ne=t.get("runId");ne&&!g&&!h&&!U&&!Z&&(console.info("🔄 Checking completed run after hot reload:",{runId:ne}),S(ne),G({runId:ne}).then(ae=>{const ge=ae.snapshot;if(ge?.status==="success"&&ge?.result?.success)b(!0);else if(ge?.result?.success===!1)if(ge?.result?.validationResults&&!ge?.result?.validationResults?.valid&&ge?.result?.validationResults?.remainingErrors>0){const{remainingErrors:xe,errors:Ie}=ge.result.validationResults,Ce=`Template installation completed but ${xe} validation issue${xe>1?"s":""} remain unresolved.`;m(Ce),A(Ie||[])}else m(ge?.result?.message||ge?.result?.error||"Template installation failed")}).catch(ae=>{console.error("❌ Failed to fetch run details:",ae),m("Failed to retrieve installation status after reload")}))},[t,g,h,U,Z,G]),E.useEffect(()=>{const ne=t.get("runId"),ae=t.get("resume"),ge=t.get("provider");if(ne&&ae==="true"&&ge&&!U&&!Z&&!w&&!_&&z){S(ne),k(!0);try{G({runId:ne}).then(le=>{if(le.snapshot?.status==="running")return j.mutateAsync({runId:ne})}).then(()=>{r(le=>{const xe=new URLSearchParams(le);return xe.delete("resume"),xe})}).catch(le=>{console.error("❌ Failed to resume template installation:",le),le.message?.includes("404")||le.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(le){console.error("❌ Auto-resume failed with error:",le),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,U,Z,w,_,z,G,j,r]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ee=[{key:"tools",label:"Tools",value:N?.tools?.length?N.tools.map(ne=>ne).join(", "):"n/a",icon:c.jsx(tl,{})},{key:"agents",label:"Agents",value:N?.agents?.length?N.agents.map(ne=>ne).join(", "):"n/a",icon:c.jsx(Mi,{})},{key:"workflows",label:"Workflows",value:N?.workflows?.length?N.workflows.map(ne=>ne).join(", "):"n/a",icon:c.jsx(pvr,{})},{key:"providers",label:"Providers",value:N?.supportedProviders?.length?N.supportedProviders.join(", "):"n/a",icon:c.jsx(gbr,{})},{key:"tags",label:"Tags",value:N?.tags?.length?N.tags.join(", "):"n/a",icon:c.jsx(ivr,{})}],te=[{...ee[0]},{...ee[1]},{...ee[2]}].filter(ne=>ne.value!=="n/a");E.useEffect(()=>{F&&d(F)},[F]),E.useEffect(()=>{const ne=X||Q;ne?.phase==="error"&&ne?.error&&m(ne.error)},[X?.phase,X?.error,Q?.phase,Q?.error]);const se=ne=>{s(ne)},ce=async ne=>(i(ne.provider),l(ne.modelId),{message:"Model updated successfully"}),Se=async()=>{const ne=Object.entries(u).reduce((ae,[ge,le])=>(le===""&&ae.push(ge),ae),[]);if(ne.length>0){f(ne);return}if(N){m(null),b(!1),S(""),C(!0);try{const ge={repo:N.githubUrl||`https://github.com/mastra-ai/template-${N.slug}`,ref:$,slug:N.slug,variables:u},{runId:le}=await H({});S(le),r(xe=>{const Ie=new URLSearchParams(xe);return Ie.set("runId",le),Ie.set("resume","true"),Ie.set("provider",n||"openai"),Ie}),await M.mutateAsync({inputData:ge,selectedModel:{provider:a,modelId:o},runId:le})}catch(ae){C(!1),m(ae?.message||"Template installation failed"),console.error("Template installation failed",ae)}}},W=ne=>{const{name:ae,value:ge}=ne.target;ge.trim()===""?f(le=>[...le,ae]):f(le=>le.filter(xe=>xe!==ae)),d(le=>({...le,[ae]:ge}))};return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/templates",children:[c.jsx(ve,{children:c.jsx(ace,{})}),"Templates"]}),c.jsx(Or,{as:Pt,to:`/templates/${N?.slug}`,isCurrent:!0,children:N?.title&&N.title})]})}),c.jsx("div",{className:K("w-full lg:px-12 h-full overflow-y-scroll"),children:c.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[c.jsx(gln,{isLoading:I,title:N?.title,description:N?.longDescription,imageURL:N?.imageURL,githubUrl:N?.githubUrl,infoData:ee,templateSlug:e}),N&&c.jsxs(c.Fragment,{children:[(U||Z)&&c.jsx(wln,{name:N.title,streamResult:Z?Q:X,runId:v,workflowInfo:z}),g&&c.jsx(Eln,{name:N.title,installedEntities:te,linkComponent:Pt}),h&&c.jsx(kln,{errorMsg:h,validationErrors:T.length>0?T:X?.validationResults?.errors||Q?.validationResults?.errors}),!U&&!Z&&!g&&!h&&c.jsx(yln,{providerOptions:J,selectedProvider:n,onProviderChange:se,variables:u,setVariables:d,errors:p,setErrors:f,handleInstallTemplate:Se,handleVariableChange:W,isLoadingEnvVars:L||q,isInstalling:V,defaultModelProvider:a,defaultModelId:o,onModelUpdate:ce})]})]})})]})}const Tbn=()=>{const{toolId:e,agentId:t}=Ei();return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/agents",children:[c.jsx(ve,{children:c.jsx(Mi,{})}),"Agents"]}),c.jsx(Or,{as:Pt,to:`/agents/${t}/chat`,children:t}),c.jsx(Or,{as:Pt,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Tools documentation"]})})]}),c.jsx(aan,{toolId:e,agentId:t})]})},Abn=()=>{const{toolId:e}=Ei();return c.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/tools",children:[c.jsx(ve,{children:c.jsx(tl,{})}),"Tools"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(pln,{value:e,variant:"ghost"})})]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Tools documentation"]})})]}),c.jsx(dln,{toolId:e})]})};function Dbn(){const{data:e,isLoading:t,error:r}=wy(),n=!t&&Object.keys(e||{}).length===0;return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Yl,{})}),"Workflows"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Workflows documentation"]})})]}),c.jsx(Si,{isCentered:n,children:c.jsx(Hen,{workflows:e||{},isLoading:t,error:r})})]})}const bMe=()=>{const{workflowId:e}=Ei(),{data:t,isLoading:r,error:n}=lj(e);return n&&Mc(n)?c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"workflows"})}):c.jsx(qpt,{workflowId:e,workflow:t??void 0,isLoading:r})};function vMe(){const{workspaceId:e}=Ei(),[t,r]=sc(),n=Hd(),[s,a]=E.useState(!1),[i,o]=E.useState(!1),[l,u]=E.useState(!1),[d,p]=E.useState(null),[f,h]=E.useState(null),[m,g]=E.useState(!1),b=t.get("file"),v=t.get("tab"),{data:S,error:w,isLoading:k}=zht(),_=S?.workspaces??[],C=e??_[0]?.id,{data:T,isLoading:A,error:N}=son(C),I=Mc(w)||Mc(N),R=T?.filesystem?.metadata,$=R?.contained===!1&&typeof R?.basePath=="string"?R.basePath:"/",F=t.get("path")||$,L=hre(w)||hre(N),z=C?_.find(je=>je.id===C):void 0,q=je=>{const St=new URLSearchParams(t);for(const[sr,En]of Object.entries(je))En===null?St.delete(sr):St.set(sr,En);r(St)},H=je=>{g(!1),a(!1),n(`/workspaces/${je}`)},V=je=>{q({path:je,file:null})},G=je=>{q({file:je})},M=je=>{q({tab:je})},X=F,U=b,{data:j,isLoading:Q,error:Z,refetch:J}=aon(X,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:C}),ee=oon(),te=lon(),{data:se,isLoading:ce}=Uht(U??"",{enabled:!!U,workspaceId:C}),{data:Se,isLoading:W,refetch:ne}=uon({workspaceId:C}),ae=yon(),ge=bon(),le=von(),xe=T?.isWorkspaceConfigured??!1,Ie=T?.capabilities?.hasFilesystem??!1,Ce=T?.capabilities?.hasSkills??!1,oe=T?.capabilities?.canBM25??!1,de=T?.capabilities?.canVector??!1,fe=z?.safety?.readOnly??!1,Ne=Ie&&!fe,Te=T?.mounts,we=Te?.filter(je=>!je.readOnly).map(je=>({path:je.path,displayName:je.displayName,icon:je.icon,provider:je.provider,name:je.name})),ue=Te&&Te.length>1?Te.map(je=>je.path):void 0,De=E.useCallback(je=>{C&&ae.mutate({...je,workspaceId:C},{onSuccess:async St=>{if(St.success){u(!1);const{data:sr,error:En}=await ne();if(En||!sr){Xe.success(`Skill "${St.skillName}" installed successfully (${St.filesWritten} files)`);return}sr.skills.some(Sn=>Sn.name===St.skillName)?Xe.success(`Skill "${St.skillName}" installed successfully (${St.filesWritten} files)`):(g(!0),Xe.warning(`Skill "${St.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else Xe.error("Failed to install skill")},onError:St=>{Xe.error(`Failed to install skill: ${St instanceof Error?St.message:"Unknown error"}`)}})},[C,ae,ne]),Le=E.useCallback(je=>{C&&(h(je),ge.mutate({workspaceId:C,skillName:je},{onSuccess:St=>{if(h(null),St.updated.length>0){const sr=St.updated[0];sr.success?(Xe.success(`Skill "${je}" updated successfully (${sr.filesWritten} files)`),ne()):Xe.error(`Failed to update skill: ${sr.error??"Unknown error"}`)}else Xe.error("Failed to update skill: No update result returned")},onError:St=>{h(null),Xe.error(`Failed to update skill: ${St instanceof Error?St.message:"Unknown error"}`)}}))},[C,ge,ne]),rt=E.useCallback(je=>{C&&(p(je),le.mutate({workspaceId:C,skillName:je},{onSuccess:St=>{p(null),St.success?(Xe.success(`Skill "${St.skillName}" removed successfully`),ne()):Xe.error(`Failed to remove skill "${St.skillName}"`)},onError:St=>{p(null),Xe.error(`Failed to remove skill: ${St instanceof Error?St.message:"Unknown error"}`)}}))},[C,le,ne]),$t=v==="files"&&Ie?"files":v==="skills"&&Ce?"skills":Ie?"files":Ce?"skills":"files",ut=Se?.skills??[],or=Se?.isSkillsConfigured??!1,Br=j?.entries??[],Et=Ie&&(oe||de),Dt=Ce&&or&&ut.length>0,xt=Et||Dt;return I?c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})})]}),c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"workspaces"})})]}):L?c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})})]}),c.jsx("div",{className:"grid overflow-y-auto h-full",children:c.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[c.jsx(GT,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:c.jsx(wh,{})}),c.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[c.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-amber-500/10 mb-6",children:c.jsx(jee,{className:"h-8 w-8 text-amber-500"})}),c.jsx("h2",{className:"text-xl font-semibold text-neutral6 mb-2",children:"Workspace Not Supported"}),c.jsxs("p",{className:"text-neutral4 max-w-md mb-6",children:["The workspace feature requires a newer version of ",c.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),". Please upgrade your dependencies to enable workspace functionality."]}),c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Learn More"]})]})]})})]}):k?c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})})]}),c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Cn,{})})]}):!A&&!k&&!xe?c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})})]}),c.jsx("div",{className:"grid overflow-y-auto h-full",children:c.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[c.jsx(GT,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:c.jsx(wh,{})}),c.jsx(cpn,{})]})})]}):c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsxs(Vs,{children:[xt&&c.jsxs(ye,{variant:"light",onClick:()=>a(!s),children:[c.jsx(ve,{children:c.jsx(nvr,{className:"h-4 w-4"})}),"Search"]}),c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})]})]}),c.jsx("div",{className:"grid overflow-y-auto h-full",children:c.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start gap-6 h-full w-full",children:[c.jsx(GT,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:c.jsx(wh,{})}),_.length>1&&c.jsxs("div",{className:"relative",children:[c.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:[z?.source==="agent"?c.jsx(b$,{className:"h-4 w-4 text-accent1"}):c.jsx(JG,{className:"h-4 w-4 text-neutral4"}),c.jsxs("span",{className:"flex-1 text-left truncate",children:[z?.name??"Select workspace",z?.source==="agent"&&z.agentName&&c.jsxs("span",{className:"text-neutral4 ml-1",children:["(",z.agentName,")"]})]}),c.jsx(Sbr,{className:`h-4 w-4 text-neutral4 transition-transform ${i?"rotate-180":""}`})]}),i&&c.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(je=>c.jsxs("button",{onClick:()=>{H(je.id),o(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${z?.id===je.id?"bg-surface3":""}`,children:[je.source==="agent"?c.jsx(b$,{className:"h-4 w-4 text-accent1 flex-shrink-0"}):c.jsx(JG,{className:"h-4 w-4 text-neutral4 flex-shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:je.name}),c.jsx("div",{className:"text-xs text-neutral4 truncate",children:je.source==="agent"?`Agent: ${je.agentName}`:"Global workspace"})]}),c.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[je.safety?.readOnly&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),je.capabilities.hasFilesystem&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),je.capabilities.hasSandbox&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),je.capabilities.hasSkills&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},je.id))})]}),_.length===1&&z&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[z.source==="agent"?c.jsx(b$,{className:"h-4 w-4 text-accent1"}):c.jsx(JG,{className:"h-4 w-4"}),c.jsx("span",{children:z.name}),z.source==="agent"&&z.agentName&&c.jsxs("span",{className:"text-neutral3",children:["(",z.agentName,")"]}),fe&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),s&&xt&&C&&c.jsx(Nbn,{workspaceId:C,canSearchFiles:Et,canSearchSkills:Dt,canBM25:oe,canVector:de,showInitWarning:!A&&T?.status!=="ready",onViewFileResult:je=>{q({file:je,tab:"files"})},onViewSkillResult:je=>{C&&n(`/workspaces/${C}/skills/${encodeURIComponent(je)}`)}},C),c.jsxs("div",{className:"flex gap-2 border-b border-border1",children:[Ie&&c.jsxs("button",{onClick:()=>M("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${$t==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[c.jsx(xF,{className:"h-4 w-4"}),"Files"]}),Ce&&c.jsxs("button",{onClick:()=>M("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${$t==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[c.jsx(TM,{className:"h-4 w-4"}),"Skills",or&&ut.length>0&&c.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:ut.length})]})]}),c.jsxs("div",{className:"pb-8",children:[$t==="files"&&Ie&&c.jsx("div",{className:"space-y-4",children:c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[c.jsx(apn,{entries:Br,currentPath:X,isLoading:Q,error:Z,onNavigate:V,onFileSelect:G,onRefresh:()=>J(),onCreateDirectory:fe?void 0:je=>te.mutate({path:je,workspaceId:C}),onDelete:fe?void 0:je=>ee.mutate({path:je,recursive:!0,force:!0,workspaceId:C})}),U&&c.jsx(lpn,{path:U,content:se?.content??"",isLoading:ce,mimeType:se?.mimeType,onClose:()=>G(null)})]})}),$t==="skills"&&Ce&&c.jsx(bpn,{skills:ut,isLoading:W,isSkillsConfigured:or,hasUndiscoveredAgentSkills:m,basePath:C?`/workspaces/${C}/skills`:"/workspaces",onAddSkill:Ne?()=>u(!0):void 0,onUpdateSkill:Ne?Le:void 0,onRemoveSkill:Ne?rt:void 0,updatingSkillName:f??void 0,removingSkillName:d??void 0,mountPaths:ue}),!Ie&&!Ce&&c.jsx("div",{className:"py-12 text-center text-neutral4",children:c.jsx("p",{children:"No workspace capabilities are configured."})})]})]})}),C&&Ne&&c.jsx(kpn,{open:l,onOpenChange:u,workspaceId:C,onInstall:De,isInstalling:ae.isPending,installedSkillIds:ut.filter(je=>je.skillsShSource).map(je=>`${je.skillsShSource.owner}/${je.skillsShSource.repo}/${je.name}`),installedSkillNames:ut.filter(je=>!je.skillsShSource).map(je=>je.name),writableMounts:we,installedSkillPaths:Object.fromEntries(ut.filter(je=>je.path).map(je=>[je.name,je.path]))})]})}function Nbn({workspaceId:e,canSearchFiles:t,canSearchSkills:r,canBM25:n,canVector:s,showInitWarning:a,onViewFileResult:i,onViewSkillResult:o}){const l=con(),u=fon();return c.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&c.jsxs("div",{children:[c.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[c.jsx(xF,{className:"h-4 w-4"}),"Search Indexed Files"]}),a&&c.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",c.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",c.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),c.jsx(upn,{onSearch:d=>l.mutate({...d,workspaceId:e}),isSearching:l.isPending,searchResults:l.data?{...l.data,results:l.data.results.filter(d=>!d.id.startsWith("skill:"))}:void 0,canBM25:n,canVector:s,onViewResult:i})]}),r&&c.jsxs("div",{children:[c.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[c.jsx(TM,{className:"h-4 w-4"}),"Search Skills"]}),c.jsx(ppn,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>o(d.skillName)})]})]})}function Ibn(){const{skillName:e,workspaceId:t}=Ei(),[r]=sc(),n=e?decodeURIComponent(e):"",s=r.get("agentId"),a=s?decodeURIComponent(s):null,i=a?`/agents/${a}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[o,l]=E.useState(null),{data:u,isLoading:d,error:p}=don(n,{workspaceId:t}),{data:f}=Uht(u?.path?`${u.path}/SKILL.md`:"",{enabled:!!u?.path,workspaceId:t}),{data:h,isLoading:m}=pon(n,o??"",{enabled:!!o,workspaceId:t}),g=b=>a?c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:i,children:[c.jsx(ve,{children:c.jsx(b$,{className:"h-4 w-4"})}),a]}),c.jsxs(Or,{as:"span",to:"",isCurrent:!0,children:[c.jsx(ve,{children:c.jsx(TM,{className:"h-4 w-4"})}),b]})]}):c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:i,children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsxs(Or,{as:Pt,to:i,children:[c.jsx(ve,{children:c.jsx(TM,{className:"h-4 w-4"})}),"Skills"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:b})]});return d?c.jsxs(Hr,{children:[c.jsx(Fr,{children:g("Loading...")}),c.jsx("div",{className:"grid place-items-center h-full",children:c.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):p&&Mc(p)?c.jsxs(Hr,{children:[c.jsx(Fr,{children:g("Permission Denied")}),c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"workspaces"})})]}):p||!u?c.jsxs(Hr,{children:[c.jsx(Fr,{children:g("Error")}),c.jsx("div",{className:"grid place-items-center h-full",children:c.jsxs("div",{className:"text-center",children:[c.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),c.jsx("p",{className:"text-sm text-neutral3",children:p?.message??"Skill not found"})]})})]}):c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[g(n),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})})]}),c.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:c.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:c.jsx(wpn,{skill:u,rawSkillMd:f?.content,onReferenceClick:l})})}),c.jsx(Epn,{open:!!o,onOpenChange:b=>!b&&l(null),skillName:n,referencePath:o??"",content:h?.content,isLoading:m})]})}const jbn=[{key:"main",links:[{name:"Agents",url:"/agents",icon:c.jsx(Mi,{}),isOnMastraPlatform:!0},{name:"Prompts",url:"/prompts",icon:c.jsx(xF,{}),isOnMastraPlatform:!0},{name:"Workflows",url:"/workflows",icon:c.jsx(Yl,{}),isOnMastraPlatform:!0},{name:"Processors",url:"/processors",icon:c.jsx(_br,{}),isOnMastraPlatform:!1},{name:"MCP Servers",url:"/mcps",icon:c.jsx(Gf,{}),isOnMastraPlatform:!0},{name:"Tools",url:"/tools",icon:c.jsx(tl,{}),isOnMastraPlatform:!0},{name:"Scorers",url:"/scorers",icon:c.jsx(Bg,{}),isOnMastraPlatform:!0},{name:"Workspaces",url:"/workspaces",icon:c.jsx(wh,{})},{name:"Request Context",url:"/request-context",icon:c.jsx(gKe,{}),isOnMastraPlatform:!0}]},{key:"observability",separator:!0,links:[{name:"Observability",url:"/observability",icon:c.jsx(dE,{}),isOnMastraPlatform:!0},{name:"Datasets",url:"/datasets",icon:c.jsx(ku,{}),isOnMastraPlatform:!1}]},{key:"Templates",separator:!0,links:[{name:"Templates",url:"/templates",icon:c.jsx(ace,{}),isOnMastraPlatform:!1}]},{key:"Settings",separator:!0,links:[{name:"Settings",url:"/settings",icon:c.jsx(Fpe,{}),isOnMastraPlatform:!1}]}],Rbn={links:[{name:"Mastra APIs",url:"/swagger-ui",icon:c.jsx(Nbr,{}),isOnMastraPlatform:!1},{name:"Documentation",url:"https://mastra.ai/en/docs",icon:c.jsx(OT,{}),isOnMastraPlatform:!0},{name:"Github",url:"https://github.com/mastra-ai/mastra",icon:c.jsx(Lpe,{}),isOnMastraPlatform:!0},{name:"Community",url:"https://discord.gg/BTYqqHKUrf",icon:c.jsx(qbr,{}),isOnMastraPlatform:!0}]};function Pbn(){const{state:e}=jmt(),r=qd().pathname,n=window?.MASTRA_HIDE_CLOUD_CTA==="true",{isMastraPlatform:s}=zmt(),{data:a}=dj(),{isCmsAvailable:i,isLoading:o}=pS(),l=a&&Z6(a),u=new Set(["/prompts"]),d=p=>u.has(p.url)&&!i&&!o?!1:s?p.isOnMastraPlatform:!0;return c.jsxs(hc,{children:[c.jsx("div",{className:"pt-3 mb-4 -ml-0.5 sticky top-0 bg-surface1 z-10",children:e==="collapsed"?c.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[c.jsx(I0,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),l&&c.jsx(t$e,{})]}):l?c.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(I0,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),c.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),c.jsx(t$e,{})]}):c.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[c.jsx(I0,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),c.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),c.jsx(hc.Nav,{children:jbn.map(p=>{const f=p.links.filter(d),h=f.length>0&&p?.separator;return c.jsxs(hc.NavSection,{children:[p?.title?c.jsx(hc.NavHeader,{state:e,children:p.title}):c.jsx(c.Fragment,{children:h&&c.jsx(hc.NavSeparator,{})}),c.jsx(hc.NavList,{children:f.map(m=>{const g=r.startsWith(m.url);return c.jsx(hc.NavLink,{state:e,link:m,isActive:g},m.name)})})]},p.key)})}),c.jsxs(hc.Bottom,{children:[c.jsx(hc.Nav,{children:c.jsxs(hc.NavSection,{children:[c.jsx(hc.NavSeparator,{}),c.jsxs(hc.NavList,{children:[Rbn.links.filter(d).map(p=>c.jsx(hc.NavLink,{link:p,state:e},p.name)),!n&&!s?c.jsx(hc.NavLink,{link:{name:"Share",url:"https://mastra.ai/cloud",icon:c.jsx(Ebr,{}),variant:"featured",tooltipMsg:"You're running Mastra Studio locally. Want your team to collaborate?",isOnMastraPlatform:!1},state:e}):null]})]})}),e!=="collapsed"&&c.jsxs(c.Fragment,{children:[c.jsx(hc.NavSeparator,{}),c.jsx(Tnn,{collapsed:!1})]})]})]})}const $bn=E.createContext({theme:"system",setTheme:()=>null});function Mbn({children:e,defaultTheme:t="system"}){const[r,n]=E.useState(t);return E.useEffect(()=>{const s=window.document.documentElement;if(s.classList.remove("light","dark"),r==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";s.classList.add(a);return}s.classList.add(r)},[r]),c.jsx($bn.Provider,{value:{theme:r,setTheme:n},children:e})}const Lbn=({children:e})=>c.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[c.jsx(xKt,{position:"bottom-right"}),c.jsx(Mbn,{defaultTheme:"dark",attribute:"class",children:c.jsx(nc,{delayDuration:0,children:c.jsxs(Ndn,{children:[c.jsx(_pn,{}),c.jsxs("div",{className:"grid grid-cols-[auto_1fr] h-full",children:[c.jsx(Pbn,{}),c.jsx("div",{className:"bg-surface2 my-3 mr-3 rounded-lg border border-border1 overflow-y-auto",children:c.jsx(Vsn,{children:e})})]})]})})})]});function Fbn({agentId:e}){const{isCmsAvailable:t}=pS();return c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/agents",children:[c.jsx(ve,{children:c.jsx(Mi,{})}),"Agents"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(Jsn,{value:e,variant:"ghost",showSourceIcon:t})})]}),c.jsx(_mt,{children:c.jsxs(ye,{as:Pt,to:`/observability?entity=${e}`,children:[c.jsx(ve,{children:c.jsx(dE,{})}),"Traces"]})}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Agents documentation"]})})]})}const Bbn=({children:e})=>{const{agentId:t}=Ei();return c.jsxs(Hr,{children:[c.jsx(Fbn,{agentId:t}),e]})};function zbn(){const{data:e={},isLoading:t,error:r}=ffe(),n=!t&&Object.keys(e).length===0;return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(D0,{})}),"Processors"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Processors documentation"]})})]}),c.jsx(Si,{isCentered:n,children:c.jsx(Won,{processors:e,isLoading:t,error:r})})]})}function Ubn(){const{processorId:e}=Ei(),{data:t,isLoading:r,error:n}=pmt(e);return n&&Mc(n)?c.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/processors",children:[c.jsx(ve,{children:c.jsx(D0,{})}),"Processors"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:e})]})}),c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"processors"})})]}):!r&&t?.isWorkflow?c.jsx(mhn,{to:`/workflows/${e}/graph`,replace:!0}):r?c.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/processors",children:[c.jsx(ve,{children:c.jsx(D0,{})}),"Processors"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(Nr,{className:"h-6 w-32"})})]})}),c.jsxs("div",{className:"p-6",children:[c.jsx(Nr,{className:"h-8 w-48 mb-4"}),c.jsx(Nr,{className:"h-32 w-full"})]})]}):c.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/processors",children:[c.jsx(ve,{children:c.jsx(D0,{})}),"Processors"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(nln,{value:e,variant:"ghost"})})]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Processors documentation"]})})]}),c.jsx(eln,{processorId:e})]})}function Vbn(){const{data:e={},isLoading:t}=ah(),{data:r={},isLoading:n,error:s}=t8(),a=Object.keys(r).length>0,i=Object.values(e).some(l=>l.tools&&Object.keys(l.tools).length>0),o=!n&&!t&&!a&&!i;return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(tl,{})}),"Tools"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Tools documentation"]})})]}),c.jsx(Si,{isCentered:o,children:c.jsx(oln,{tools:r,agents:e,isLoading:t||n,error:s})})]})}const qbn={agentLink:e=>`/agents/${e}/chat/new`,agentToolLink:(e,t)=>`/agents/${e}/tools/${t}`,agentSkillLink:(e,t,r)=>r?`/workspaces/${r}/skills/${t}?agentId=${encodeURIComponent(e)}`:"/workspaces",agentsLink:()=>"/agents",agentNewThreadLink:e=>`/agents/${e}/chat/new`,agentThreadLink:(e,t,r)=>r?`/agents/${e}/chat/${t}?messageId=${r}`:`/agents/${e}/chat/${t}`,workflowsLink:()=>"/workflows",workflowLink:e=>`/workflows/${e}`,networkLink:e=>`/networks/v-next/${e}/chat`,networkNewThreadLink:e=>`/networks/v-next/${e}/chat/${No()}`,networkThreadLink:(e,t)=>`/networks/v-next/${e}/chat/${t}`,scorerLink:e=>`/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)=>t?`/workspaces/${t}/skills/${e}`:"/workspaces",workspaceLink:e=>e?`/workspaces/${e}`:"/workspaces",workspaceSkillLink:(e,t)=>t?`/workspaces/${t}/skills/${e}`:"/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=>`/datasets/${e}`,datasetItemLink:(e,t)=>`/datasets/${e}/items/${t}`,datasetExperimentLink:(e,t)=>`/datasets/${e}/experiments/${t}`},Hbn=()=>{const e=Hd(),t=r=>e(r,{viewTransition:!0});return c.jsx(OJr,{Link:vyn,navigate:t,paths:qbn,children:c.jsx(Lbn,{children:c.jsx(uN,{})})})},Qbn=!!window.MASTRA_CLOUD_API_ENDPOINT,Gbn=EMe.has("datasets"),xMe=[{index:!0,element:c.jsx(Oyn,{})},{path:"instruction-blocks",element:c.jsx(_yn,{})},{path:"tools",element:c.jsx(Dyn,{})},{path:"agents",element:c.jsx(wyn,{})},{path:"scorers",element:c.jsx(Tyn,{})},{path:"workflows",element:c.jsx(Iyn,{})},{path:"skills",element:c.jsx(Ayn,{})},{path:"memory",element:c.jsx(Cyn,{})},{path:"variables",element:c.jsx(Nyn,{})}],Zbn=[{path:"/login",element:c.jsx(Wyn,{})},{path:"/signup",element:c.jsx(pbn,{})},{element:c.jsx(Hbn,{}),children:[...Qbn?[]:[{path:"/settings",element:c.jsx(dbn,{})},{path:"/templates",element:c.jsx(Obn,{})},{path:"/templates/:templateSlug",element:c.jsx(Cbn,{})}],{path:"/scorers",element:c.jsx(lbn,{})},{path:"/scorers/:scorerId",element:c.jsx(cbn,{})},{path:"/observability",element:c.jsx(abn,{})},{path:"/agents",element:c.jsx(xyn,{})},{path:"/cms/agents/create",element:c.jsx(Eyn,{}),children:xMe},{path:"/cms/agents/:agentId/edit",element:c.jsx(kyn,{}),children:xMe},{path:"/cms/scorers/create",element:c.jsx($yn,{})},{path:"/cms/scorers/:scorerId/edit",element:c.jsx(Lyn,{})},{path:"/prompts",element:c.jsx(ibn,{})},{path:"/cms/prompts/create",element:c.jsx(jyn,{})},{path:"/cms/prompts/:promptBlockId/edit",element:c.jsx(Pyn,{})},{path:"/agents/:agentId/tools/:toolId",element:c.jsx(Tbn,{})},{path:"/agents/:agentId",element:c.jsx(Bbn,{children:c.jsx(uN,{})}),children:[{index:!0,loader:({params:e})=>VY(`/agents/${e.agentId}/chat`)},{path:"chat",element:c.jsx(dMe,{})},{path:"chat/:threadId",element:c.jsx(dMe,{})}]},{path:"/tools",element:c.jsx(Vbn,{})},{path:"/tools/:toolId",element:c.jsx(Abn,{})},{path:"/processors",element:c.jsx(zbn,{})},{path:"/processors/:processorId",element:c.jsx(Ubn,{})},{path:"/mcps",element:c.jsx(Xyn,{})},{path:"/mcps/:serverId",element:c.jsx(Yyn,{})},{path:"/mcps/:serverId/tools/:toolId",element:c.jsx(Kyn,{})},{path:"/workspaces",element:c.jsx(vMe,{})},{path:"/workspaces/:workspaceId",element:c.jsx(vMe,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:c.jsx(Ibn,{})},{path:"/workflows",element:c.jsx(Dbn,{})},{path:"/workflows/:workflowId",element:c.jsx(emn,{children:c.jsx(uN,{})}),children:[{index:!0,loader:({params:e})=>VY(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:c.jsx(bMe,{})},{path:"graph/:runId",element:c.jsx(bMe,{})}]},...Gbn?[{path:"/datasets",element:c.jsx(Fyn,{})},{path:"/datasets/:datasetId",element:c.jsx(Byn,{})},{path:"/datasets/:datasetId/items/:itemId",element:c.jsx(Vyn,{})},{path:"/datasets/:datasetId/items/:itemId/versions",element:c.jsx(Qyn,{})},{path:"/datasets/:datasetId/experiments/:experimentId",element:c.jsx(zyn,{})},{path:"/datasets/:datasetId/experiments",element:c.jsx(Uyn,{})},{path:"/datasets/:datasetId/items",element:c.jsx(qyn,{})},{path:"/datasets/:datasetId/versions",element:c.jsx(Zyn,{})}]:[],{index:!0,loader:()=>VY("/agents")},{path:"/request-context",element:c.jsx(obn,{})}]}];function Wbn(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:r,apiPrefix:n,isLoading:s}=afe();if(s)return null;if(!t)return c.jsx(Nnn,{});const a=zhn(Zbn,{basename:e});return c.jsx(ixr,{baseUrl:t,headers:r,apiPrefix:n,children:c.jsx(yyn,{children:c.jsx(phn,{router:a})})})}function Xbn(){const e=window.MASTRA_SERVER_PROTOCOL||"http",t=window.MASTRA_SERVER_HOST||"localhost",r=window.MASTRA_SERVER_PORT||4111,n=window.MASTRA_API_PREFIX||"/api",s=window.MASTRA_CLOUD_API_ENDPOINT||"",a=window.MASTRA_AUTO_DETECT_URL==="true",i=s||(a?window.location.origin:`${e}://${t}:${r}`);return c.jsx(zdn,{children:c.jsx(wnn,{endpoint:i,defaultApiPrefix:n,children:c.jsx(Wbn,{})})})}zvt.createRoot(document.getElementById("root")).render(c.jsx(E.StrictMode,{children:c.jsx(Xbn,{})}));const Rxn=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{cVe as A,tQe as B,dVe as C,eHe as D,Pd as E,Ep as F,Tvn as G,nir as H,Js as I,Rxn as J,H0 as L,lVe as N,dF as _,Ujt as a,sRt as b,svn as c,Rve as d,z0 as e,eRt as f,G0 as g,nRt as h,P1 as i,$1 as j,R1 as k,oE as l,$Ht as m,oHe as n,ba as o,Xqt as p,Yqt as q,Eoe as r,wie as s,re as t,_3 as u,Wc as v,Gjt as w,ht as x,Je as y,kQe as z};
615
+ `).reduce((o,l)=>{if(!l||l.startsWith("#"))return o;const[u,d]=l.split("=");return u&&(o[u]=d?.split("")?.every(p=>p==="*")?"":d?.replaceAll('"',"")),o},{}):{}}const gbn=()=>ur({queryKey:["mastra-templates"],queryFn:Ayt}),ybn=({repoOrSlug:e,owner:t})=>ur({queryKey:["template-repo",e,t],queryFn:()=>hbn({repoOrSlug:e,owner:t})}),bbn=({repo:e,owner:t,branch:r})=>ur({queryKey:["template-repo-env-vars",e,t,r],queryFn:()=>mbn({repo:e,owner:t,branch:r})}),vbn=()=>{const e=st();return ur({queryKey:["agent-builder-workflow"],queryFn:async()=>await e.getAgentBuilderAction("merge-template").details()})},xbn=()=>{const e=st();return Kr({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").createRun({runId:t})})},Sbn=()=>{const e=st();return Kr({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").runById(t)})},yMe=(e,t,r)=>{let n={...t};if(!(n.payload?.workflowState?.steps&&Object.keys(n.payload.workflowState.steps).length>0)&&r?.allSteps&&(n.payload={...n.payload,workflowState:{...n.payload?.workflowState,steps:Object.keys(r.allSteps).reduce((a,i)=>(a[i]={id:i,description:r.allSteps[i].description,status:"pending"},a),{})}}),e.type==="start"||e.type==="workflow-start"){const a={};r?.allSteps&&Object.entries(r.allSteps).forEach(([o,l])=>{a[o]={id:l.id,description:l.description,status:"pending"}});const i=e.runId||e.payload?.runId;n={...n,runId:i,eventTimestamp:new Date().toISOString(),status:"running",phase:"initializing",payload:{workflowState:{status:"running",steps:a},currentStep:null}}}if(e.type==="step-start"||e.type==="workflow-step-start"){const a=e.payload.id;n={...n,phase:"processing",payload:{...n.payload,currentStep:{id:a,status:"running",startTime:new Date,...e.payload},workflowState:{...n.payload.workflowState,steps:{...n.payload.workflowState.steps,[a]:{...n.payload.workflowState.steps[a],status:"running",startTime:new Date,...e.payload}}}}}}if(e.type==="step-result"||e.type==="workflow-step-result"){const a=e.payload.id,i=e.payload.status,o=e.payload.error;n={...n,payload:{...n.payload,currentStep:{...n.payload.currentStep,status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date},workflowState:{...n.payload.workflowState,steps:{...n.payload.workflowState.steps,[a]:{...n.payload.workflowState.steps[a],status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date}}}}},i==="failed"&&o&&(n={...n,status:"failed",error:o,phase:"error",failedStep:{id:a,error:o,description:e.payload.description||a},payload:{...n.payload,workflowState:{...n.payload.workflowState,status:"failed"}},errorTimestamp:new Date})}return(e.type==="step-finish"||e.type==="workflow-step-finish")&&(n={...n,payload:{...n.payload,currentStep:null}}),(e.type==="finish"||e.type==="workflow-finish")&&(n.phase==="error"||n.status==="failed"?n={...n,completedAt:new Date}:n={...n,status:e.payload.status||"completed",phase:"completed",payload:{...n.payload,currentStep:null,workflowState:{...n.payload.workflowState,status:e.payload.status||"completed"}},completedAt:new Date}),e.type==="error"&&(n={...n,status:"failed",error:e.payload.error,phase:"error",payload:{...n.payload,workflowState:{...n.payload.workflowState,status:"failed"}},errorTimestamp:new Date}),{newState:n}},wbn=(e,t)=>{try{localStorage.setItem(`template-install-${e}`,JSON.stringify({state:t,timestamp:Date.now()}))}catch(r){console.warn("Failed to save template state to localStorage:",r)}},Dyt=(e,t)=>{const[r,n]=E.useState({}),[s,a]=E.useState(!1);return{streamResult:r,isStreaming:s,processStream:async(o,l)=>{if(a(!0),n({}),!o)throw new Error("No stream returned");const u=o.getReader();let d={runId:l||t,eventTimestamp:new Date().toISOString(),phase:"running",payload:{workflowState:{steps:{}},currentStep:null}};try{for(;;){const{done:p,value:f}=await u.read();if(p)break;const{newState:h}=yMe(f,d,e);if(d=h,n(h),f.runId||l||t){const m=f.runId||l||t;wbn(m,h)}}}catch(p){console.error("💥 [processStream] Error processing template installation stream:",p);const{newState:f}=yMe({type:"error",payload:{error:p instanceof Error?p.message:"Unknown error"}},d,e);n(f)}finally{a(!1),u.releaseLock()}}}},Ebn=e=>{const t=st(),{streamResult:r,isStreaming:n,processStream:s}=Dyt(e);return{streamInstall:Kr({mutationFn:async({inputData:i,selectedModel:o,runId:l})=>{for(let d=1;d<=3;d++)try{const p=t.getAgentBuilderAction("merge-template"),f=new bp;f.set("selectedModel",o);const h=await p.stream({inputData:i,requestContext:f},l);await s(h,l);return}catch(p){console.error(`💥 [streamInstall] Attempt ${d} failed:`,p);const f=p?.message?.includes("Failed to fetch")||p?.message?.includes("NetworkError")||p?.message?.includes("network error")||p?.message?.includes("fetch")||p?.code==="NETWORK_ERROR"||p?.name==="TypeError";if(console.warn(`Stream attempt ${d}/3 failed:`,p),f){const h=l?`Network error during template installation (likely hot reload). Please refresh the page to resume from where you left off using runId: ${l}`:"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:",p),p}}}),streamResult:r,isStreaming:n}},kbn=e=>{const t=st(),{streamResult:r,isStreaming:n,processStream:s}=Dyt(e);return{observeInstall:Kr({mutationFn:async({runId:i})=>{for(let u=1;u<=3;u++)try{const p=await t.getAgentBuilderAction("merge-template").observeStream({runId:i});await s(p,i);return}catch(d){console.error(`💥 [observeInstall] Attempt ${u} failed:`,d);const p=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),p&&u<3){console.info(`🔄 ObserveStream network error detected (likely hot reload), retrying in 2000ms... (attempt ${u+1}/3)`),await new Promise(f=>setTimeout(f,2e3));continue}throw console.error("❌ [observeInstall] Non-network error or max retries reached, throwing:",d),d}}}),streamResult:r,isStreaming:n}};function Obn(){const{data:e,isLoading:t}=gbn(),{templates:r,tags:n,providers:s}=e??{templates:[],tags:[],providers:[]},[a,i]=E.useState("all"),[o,l]=E.useState("all"),[u,d]=E.useState(""),p=[{value:"all",label:"All"}];(n||[]).forEach(S=>{p.push({value:S,label:S})});const f=[{value:"all",label:"All"}];(s||[]).forEach(S=>{f.push({value:S,label:S})});const h=(S,w)=>{w==="tag"?i(S):w==="provider"&&l(S)},m=S=>{d(S)},g=()=>{i("all"),l("all"),d("")},b=r.filter(S=>!(u&&!S.title.toLowerCase().includes(u)&&!S.description.toLowerCase().includes(u)||a!=="all"&&!S.tags.includes(a)||o!=="all"&&!S.supportedProviders.includes(o))),v=u||a!=="all"||o!=="all";return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(ace,{})}),"Templates"]})}),c.jsxs("div",{className:K("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[c.jsx(fln,{selectedTag:a,onTagChange:S=>h(S,"tag"),tagOptions:p,selectedProvider:o,onProviderChange:S=>h(S,"provider"),providerOptions:f,searchTerm:u,onSearchChange:m,onReset:v?g:void 0,className:"max-w-[80rem]",isLoading:t}),c.jsx(mln,{templates:b,linkComponent:Pt,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const _bn="1.10.0";function Cbn(){const{templateSlug:e}=Ei(),[t,r]=sc(),[n,s]=E.useState(""),[a,i]=E.useState(""),[o,l]=E.useState(""),[u,d]=E.useState({}),[p,f]=E.useState([]),[h,m]=E.useState(null),[g,b]=E.useState(!1),[v,S]=E.useState(""),[w,k]=E.useState(!1),[_,C]=E.useState(!1),[T,A]=E.useState([]),{data:N,isLoading:I}=ybn({repoOrSlug:e,owner:"mastra-ai"}),$=_bn?.includes("beta")??!1?"beta":"main",{data:F,isLoading:L}=bbn({repo:N?.githubUrl?new URL(N.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:$}),{data:z,isLoading:q}=vbn(),{mutateAsync:H,isPending:V}=xbn(),{mutateAsync:G}=Sbn(),{streamInstall:M,streamResult:X,isStreaming:U}=Ebn(z),{observeInstall:j,streamResult:Q,isStreaming:Z}=kbn(z);E.useEffect(()=>{const ne=t.get("runId");ne&&!g&&!h&&!U&&!Z&&(console.info("🔄 Checking completed run after hot reload:",{runId:ne}),S(ne),G({runId:ne}).then(ae=>{const ge=ae.snapshot;if(ge?.status==="success"&&ge?.result?.success)b(!0);else if(ge?.result?.success===!1)if(ge?.result?.validationResults&&!ge?.result?.validationResults?.valid&&ge?.result?.validationResults?.remainingErrors>0){const{remainingErrors:xe,errors:Ie}=ge.result.validationResults,Ce=`Template installation completed but ${xe} validation issue${xe>1?"s":""} remain unresolved.`;m(Ce),A(Ie||[])}else m(ge?.result?.message||ge?.result?.error||"Template installation failed")}).catch(ae=>{console.error("❌ Failed to fetch run details:",ae),m("Failed to retrieve installation status after reload")}))},[t,g,h,U,Z,G]),E.useEffect(()=>{const ne=t.get("runId"),ae=t.get("resume"),ge=t.get("provider");if(ne&&ae==="true"&&ge&&!U&&!Z&&!w&&!_&&z){S(ne),k(!0);try{G({runId:ne}).then(le=>{if(le.snapshot?.status==="running")return j.mutateAsync({runId:ne})}).then(()=>{r(le=>{const xe=new URLSearchParams(le);return xe.delete("resume"),xe})}).catch(le=>{console.error("❌ Failed to resume template installation:",le),le.message?.includes("404")||le.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(le){console.error("❌ Auto-resume failed with error:",le),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,U,Z,w,_,z,G,j,r]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ee=[{key:"tools",label:"Tools",value:N?.tools?.length?N.tools.map(ne=>ne).join(", "):"n/a",icon:c.jsx(tl,{})},{key:"agents",label:"Agents",value:N?.agents?.length?N.agents.map(ne=>ne).join(", "):"n/a",icon:c.jsx(Mi,{})},{key:"workflows",label:"Workflows",value:N?.workflows?.length?N.workflows.map(ne=>ne).join(", "):"n/a",icon:c.jsx(pvr,{})},{key:"providers",label:"Providers",value:N?.supportedProviders?.length?N.supportedProviders.join(", "):"n/a",icon:c.jsx(gbr,{})},{key:"tags",label:"Tags",value:N?.tags?.length?N.tags.join(", "):"n/a",icon:c.jsx(ivr,{})}],te=[{...ee[0]},{...ee[1]},{...ee[2]}].filter(ne=>ne.value!=="n/a");E.useEffect(()=>{F&&d(F)},[F]),E.useEffect(()=>{const ne=X||Q;ne?.phase==="error"&&ne?.error&&m(ne.error)},[X?.phase,X?.error,Q?.phase,Q?.error]);const se=ne=>{s(ne)},ce=async ne=>(i(ne.provider),l(ne.modelId),{message:"Model updated successfully"}),Se=async()=>{const ne=Object.entries(u).reduce((ae,[ge,le])=>(le===""&&ae.push(ge),ae),[]);if(ne.length>0){f(ne);return}if(N){m(null),b(!1),S(""),C(!0);try{const ge={repo:N.githubUrl||`https://github.com/mastra-ai/template-${N.slug}`,ref:$,slug:N.slug,variables:u},{runId:le}=await H({});S(le),r(xe=>{const Ie=new URLSearchParams(xe);return Ie.set("runId",le),Ie.set("resume","true"),Ie.set("provider",n||"openai"),Ie}),await M.mutateAsync({inputData:ge,selectedModel:{provider:a,modelId:o},runId:le})}catch(ae){C(!1),m(ae?.message||"Template installation failed"),console.error("Template installation failed",ae)}}},W=ne=>{const{name:ae,value:ge}=ne.target;ge.trim()===""?f(le=>[...le,ae]):f(le=>le.filter(xe=>xe!==ae)),d(le=>({...le,[ae]:ge}))};return c.jsxs(Hr,{children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/templates",children:[c.jsx(ve,{children:c.jsx(ace,{})}),"Templates"]}),c.jsx(Or,{as:Pt,to:`/templates/${N?.slug}`,isCurrent:!0,children:N?.title&&N.title})]})}),c.jsx("div",{className:K("w-full lg:px-12 h-full overflow-y-scroll"),children:c.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[c.jsx(gln,{isLoading:I,title:N?.title,description:N?.longDescription,imageURL:N?.imageURL,githubUrl:N?.githubUrl,infoData:ee,templateSlug:e}),N&&c.jsxs(c.Fragment,{children:[(U||Z)&&c.jsx(wln,{name:N.title,streamResult:Z?Q:X,runId:v,workflowInfo:z}),g&&c.jsx(Eln,{name:N.title,installedEntities:te,linkComponent:Pt}),h&&c.jsx(kln,{errorMsg:h,validationErrors:T.length>0?T:X?.validationResults?.errors||Q?.validationResults?.errors}),!U&&!Z&&!g&&!h&&c.jsx(yln,{providerOptions:J,selectedProvider:n,onProviderChange:se,variables:u,setVariables:d,errors:p,setErrors:f,handleInstallTemplate:Se,handleVariableChange:W,isLoadingEnvVars:L||q,isInstalling:V,defaultModelProvider:a,defaultModelId:o,onModelUpdate:ce})]})]})})]})}const Tbn=()=>{const{toolId:e,agentId:t}=Ei();return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/agents",children:[c.jsx(ve,{children:c.jsx(Mi,{})}),"Agents"]}),c.jsx(Or,{as:Pt,to:`/agents/${t}/chat`,children:t}),c.jsx(Or,{as:Pt,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Tools documentation"]})})]}),c.jsx(aan,{toolId:e,agentId:t})]})},Abn=()=>{const{toolId:e}=Ei();return c.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/tools",children:[c.jsx(ve,{children:c.jsx(tl,{})}),"Tools"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(pln,{value:e,variant:"ghost"})})]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Tools documentation"]})})]}),c.jsx(dln,{toolId:e})]})};function Dbn(){const{data:e,isLoading:t,error:r}=wy(),n=!t&&Object.keys(e||{}).length===0;return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(Yl,{})}),"Workflows"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Workflows documentation"]})})]}),c.jsx(Si,{isCentered:n,children:c.jsx(Hen,{workflows:e||{},isLoading:t,error:r})})]})}const bMe=()=>{const{workflowId:e}=Ei(),{data:t,isLoading:r,error:n}=lj(e);return n&&Mc(n)?c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"workflows"})}):c.jsx(qpt,{workflowId:e,workflow:t??void 0,isLoading:r})};function vMe(){const{workspaceId:e}=Ei(),[t,r]=sc(),n=Hd(),[s,a]=E.useState(!1),[i,o]=E.useState(!1),[l,u]=E.useState(!1),[d,p]=E.useState(null),[f,h]=E.useState(null),[m,g]=E.useState(!1),b=t.get("file"),v=t.get("tab"),{data:S,error:w,isLoading:k}=zht(),_=S?.workspaces??[],C=e??_[0]?.id,{data:T,isLoading:A,error:N}=son(C),I=Mc(w)||Mc(N),R=T?.filesystem?.metadata,$=R?.contained===!1&&typeof R?.basePath=="string"?R.basePath:"/",F=t.get("path")||$,L=hre(w)||hre(N),z=C?_.find(je=>je.id===C):void 0,q=je=>{const St=new URLSearchParams(t);for(const[sr,En]of Object.entries(je))En===null?St.delete(sr):St.set(sr,En);r(St)},H=je=>{g(!1),a(!1),n(`/workspaces/${je}`)},V=je=>{q({path:je,file:null})},G=je=>{q({file:je})},M=je=>{q({tab:je})},X=F,U=b,{data:j,isLoading:Q,error:Z,refetch:J}=aon(X,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:C}),ee=oon(),te=lon(),{data:se,isLoading:ce}=Uht(U??"",{enabled:!!U,workspaceId:C}),{data:Se,isLoading:W,refetch:ne}=uon({workspaceId:C}),ae=yon(),ge=bon(),le=von(),xe=T?.isWorkspaceConfigured??!1,Ie=T?.capabilities?.hasFilesystem??!1,Ce=T?.capabilities?.hasSkills??!1,oe=T?.capabilities?.canBM25??!1,de=T?.capabilities?.canVector??!1,fe=z?.safety?.readOnly??!1,Ne=Ie&&!fe,Te=T?.mounts,we=Te?.filter(je=>!je.readOnly).map(je=>({path:je.path,displayName:je.displayName,icon:je.icon,provider:je.provider,name:je.name})),ue=Te&&Te.length>1?Te.map(je=>je.path):void 0,De=E.useCallback(je=>{C&&ae.mutate({...je,workspaceId:C},{onSuccess:async St=>{if(St.success){u(!1);const{data:sr,error:En}=await ne();if(En||!sr){Xe.success(`Skill "${St.skillName}" installed successfully (${St.filesWritten} files)`);return}sr.skills.some(Sn=>Sn.name===St.skillName)?Xe.success(`Skill "${St.skillName}" installed successfully (${St.filesWritten} files)`):(g(!0),Xe.warning(`Skill "${St.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else Xe.error("Failed to install skill")},onError:St=>{Xe.error(`Failed to install skill: ${St instanceof Error?St.message:"Unknown error"}`)}})},[C,ae,ne]),Le=E.useCallback(je=>{C&&(h(je),ge.mutate({workspaceId:C,skillName:je},{onSuccess:St=>{if(h(null),St.updated.length>0){const sr=St.updated[0];sr.success?(Xe.success(`Skill "${je}" updated successfully (${sr.filesWritten} files)`),ne()):Xe.error(`Failed to update skill: ${sr.error??"Unknown error"}`)}else Xe.error("Failed to update skill: No update result returned")},onError:St=>{h(null),Xe.error(`Failed to update skill: ${St instanceof Error?St.message:"Unknown error"}`)}}))},[C,ge,ne]),rt=E.useCallback(je=>{C&&(p(je),le.mutate({workspaceId:C,skillName:je},{onSuccess:St=>{p(null),St.success?(Xe.success(`Skill "${St.skillName}" removed successfully`),ne()):Xe.error(`Failed to remove skill "${St.skillName}"`)},onError:St=>{p(null),Xe.error(`Failed to remove skill: ${St instanceof Error?St.message:"Unknown error"}`)}}))},[C,le,ne]),$t=v==="files"&&Ie?"files":v==="skills"&&Ce?"skills":Ie?"files":Ce?"skills":"files",ut=Se?.skills??[],or=Se?.isSkillsConfigured??!1,Br=j?.entries??[],Et=Ie&&(oe||de),Dt=Ce&&or&&ut.length>0,xt=Et||Dt;return I?c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})})]}),c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"workspaces"})})]}):L?c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})})]}),c.jsx("div",{className:"grid overflow-y-auto h-full",children:c.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[c.jsx(GT,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:c.jsx(wh,{})}),c.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[c.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-amber-500/10 mb-6",children:c.jsx(jee,{className:"h-8 w-8 text-amber-500"})}),c.jsx("h2",{className:"text-xl font-semibold text-neutral6 mb-2",children:"Workspace Not Supported"}),c.jsxs("p",{className:"text-neutral4 max-w-md mb-6",children:["The workspace feature requires a newer version of ",c.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),". Please upgrade your dependencies to enable workspace functionality."]}),c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Learn More"]})]})]})})]}):k?c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})})]}),c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Cn,{})})]}):!A&&!k&&!xe?c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})})]}),c.jsx("div",{className:"grid overflow-y-auto h-full",children:c.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[c.jsx(GT,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:c.jsx(wh,{})}),c.jsx(cpn,{})]})})]}):c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsxs(Vs,{children:[xt&&c.jsxs(ye,{variant:"light",onClick:()=>a(!s),children:[c.jsx(ve,{children:c.jsx(nvr,{className:"h-4 w-4"})}),"Search"]}),c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})]})]}),c.jsx("div",{className:"grid overflow-y-auto h-full",children:c.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start gap-6 h-full w-full",children:[c.jsx(GT,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:c.jsx(wh,{})}),_.length>1&&c.jsxs("div",{className:"relative",children:[c.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:[z?.source==="agent"?c.jsx(b$,{className:"h-4 w-4 text-accent1"}):c.jsx(JG,{className:"h-4 w-4 text-neutral4"}),c.jsxs("span",{className:"flex-1 text-left truncate",children:[z?.name??"Select workspace",z?.source==="agent"&&z.agentName&&c.jsxs("span",{className:"text-neutral4 ml-1",children:["(",z.agentName,")"]})]}),c.jsx(Sbr,{className:`h-4 w-4 text-neutral4 transition-transform ${i?"rotate-180":""}`})]}),i&&c.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(je=>c.jsxs("button",{onClick:()=>{H(je.id),o(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${z?.id===je.id?"bg-surface3":""}`,children:[je.source==="agent"?c.jsx(b$,{className:"h-4 w-4 text-accent1 flex-shrink-0"}):c.jsx(JG,{className:"h-4 w-4 text-neutral4 flex-shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:je.name}),c.jsx("div",{className:"text-xs text-neutral4 truncate",children:je.source==="agent"?`Agent: ${je.agentName}`:"Global workspace"})]}),c.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[je.safety?.readOnly&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),je.capabilities.hasFilesystem&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),je.capabilities.hasSandbox&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),je.capabilities.hasSkills&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},je.id))})]}),_.length===1&&z&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[z.source==="agent"?c.jsx(b$,{className:"h-4 w-4 text-accent1"}):c.jsx(JG,{className:"h-4 w-4"}),c.jsx("span",{children:z.name}),z.source==="agent"&&z.agentName&&c.jsxs("span",{className:"text-neutral3",children:["(",z.agentName,")"]}),fe&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),s&&xt&&C&&c.jsx(Nbn,{workspaceId:C,canSearchFiles:Et,canSearchSkills:Dt,canBM25:oe,canVector:de,showInitWarning:!A&&T?.status!=="ready",onViewFileResult:je=>{q({file:je,tab:"files"})},onViewSkillResult:je=>{C&&n(`/workspaces/${C}/skills/${encodeURIComponent(je)}`)}},C),c.jsxs("div",{className:"flex gap-2 border-b border-border1",children:[Ie&&c.jsxs("button",{onClick:()=>M("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${$t==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[c.jsx(xF,{className:"h-4 w-4"}),"Files"]}),Ce&&c.jsxs("button",{onClick:()=>M("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${$t==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[c.jsx(TM,{className:"h-4 w-4"}),"Skills",or&&ut.length>0&&c.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:ut.length})]})]}),c.jsxs("div",{className:"pb-8",children:[$t==="files"&&Ie&&c.jsx("div",{className:"space-y-4",children:c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[c.jsx(apn,{entries:Br,currentPath:X,isLoading:Q,error:Z,onNavigate:V,onFileSelect:G,onRefresh:()=>J(),onCreateDirectory:fe?void 0:je=>te.mutate({path:je,workspaceId:C}),onDelete:fe?void 0:je=>ee.mutate({path:je,recursive:!0,force:!0,workspaceId:C})}),U&&c.jsx(lpn,{path:U,content:se?.content??"",isLoading:ce,mimeType:se?.mimeType,onClose:()=>G(null)})]})}),$t==="skills"&&Ce&&c.jsx(bpn,{skills:ut,isLoading:W,isSkillsConfigured:or,hasUndiscoveredAgentSkills:m,basePath:C?`/workspaces/${C}/skills`:"/workspaces",onAddSkill:Ne?()=>u(!0):void 0,onUpdateSkill:Ne?Le:void 0,onRemoveSkill:Ne?rt:void 0,updatingSkillName:f??void 0,removingSkillName:d??void 0,mountPaths:ue}),!Ie&&!Ce&&c.jsx("div",{className:"py-12 text-center text-neutral4",children:c.jsx("p",{children:"No workspace capabilities are configured."})})]})]})}),C&&Ne&&c.jsx(kpn,{open:l,onOpenChange:u,workspaceId:C,onInstall:De,isInstalling:ae.isPending,installedSkillIds:ut.filter(je=>je.skillsShSource).map(je=>`${je.skillsShSource.owner}/${je.skillsShSource.repo}/${je.name}`),installedSkillNames:ut.filter(je=>!je.skillsShSource).map(je=>je.name),writableMounts:we,installedSkillPaths:Object.fromEntries(ut.filter(je=>je.path).map(je=>[je.name,je.path]))})]})}function Nbn({workspaceId:e,canSearchFiles:t,canSearchSkills:r,canBM25:n,canVector:s,showInitWarning:a,onViewFileResult:i,onViewSkillResult:o}){const l=con(),u=fon();return c.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&c.jsxs("div",{children:[c.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[c.jsx(xF,{className:"h-4 w-4"}),"Search Indexed Files"]}),a&&c.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",c.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",c.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),c.jsx(upn,{onSearch:d=>l.mutate({...d,workspaceId:e}),isSearching:l.isPending,searchResults:l.data?{...l.data,results:l.data.results.filter(d=>!d.id.startsWith("skill:"))}:void 0,canBM25:n,canVector:s,onViewResult:i})]}),r&&c.jsxs("div",{children:[c.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[c.jsx(TM,{className:"h-4 w-4"}),"Search Skills"]}),c.jsx(ppn,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>o(d.skillName)})]})]})}function Ibn(){const{skillName:e,workspaceId:t}=Ei(),[r]=sc(),n=e?decodeURIComponent(e):"",s=r.get("agentId"),a=s?decodeURIComponent(s):null,i=a?`/agents/${a}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[o,l]=E.useState(null),{data:u,isLoading:d,error:p}=don(n,{workspaceId:t}),{data:f}=Uht(u?.path?`${u.path}/SKILL.md`:"",{enabled:!!u?.path,workspaceId:t}),{data:h,isLoading:m}=pon(n,o??"",{enabled:!!o,workspaceId:t}),g=b=>a?c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:i,children:[c.jsx(ve,{children:c.jsx(b$,{className:"h-4 w-4"})}),a]}),c.jsxs(Or,{as:"span",to:"",isCurrent:!0,children:[c.jsx(ve,{children:c.jsx(TM,{className:"h-4 w-4"})}),b]})]}):c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:i,children:[c.jsx(ve,{children:c.jsx(wh,{className:"h-4 w-4"})}),"Workspace"]}),c.jsxs(Or,{as:Pt,to:i,children:[c.jsx(ve,{children:c.jsx(TM,{className:"h-4 w-4"})}),"Skills"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:b})]});return d?c.jsxs(Hr,{children:[c.jsx(Fr,{children:g("Loading...")}),c.jsx("div",{className:"grid place-items-center h-full",children:c.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):p&&Mc(p)?c.jsxs(Hr,{children:[c.jsx(Fr,{children:g("Permission Denied")}),c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"workspaces"})})]}):p||!u?c.jsxs(Hr,{children:[c.jsx(Fr,{children:g("Error")}),c.jsx("div",{className:"grid place-items-center h-full",children:c.jsxs("div",{className:"text-center",children:[c.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),c.jsx("p",{className:"text-sm text-neutral3",children:p?.message??"Skill not found"})]})})]}):c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[g(n),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Documentation"]})})]}),c.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:c.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:c.jsx(wpn,{skill:u,rawSkillMd:f?.content,onReferenceClick:l})})}),c.jsx(Epn,{open:!!o,onOpenChange:b=>!b&&l(null),skillName:n,referencePath:o??"",content:h?.content,isLoading:m})]})}const jbn=[{key:"main",links:[{name:"Agents",url:"/agents",icon:c.jsx(Mi,{}),isOnMastraPlatform:!0},{name:"Prompts",url:"/prompts",icon:c.jsx(xF,{}),isOnMastraPlatform:!0},{name:"Workflows",url:"/workflows",icon:c.jsx(Yl,{}),isOnMastraPlatform:!0},{name:"Processors",url:"/processors",icon:c.jsx(_br,{}),isOnMastraPlatform:!1},{name:"MCP Servers",url:"/mcps",icon:c.jsx(Gf,{}),isOnMastraPlatform:!0},{name:"Tools",url:"/tools",icon:c.jsx(tl,{}),isOnMastraPlatform:!0},{name:"Scorers",url:"/scorers",icon:c.jsx(Bg,{}),isOnMastraPlatform:!0},{name:"Workspaces",url:"/workspaces",icon:c.jsx(wh,{})},{name:"Request Context",url:"/request-context",icon:c.jsx(gKe,{}),isOnMastraPlatform:!0}]},{key:"observability",separator:!0,links:[{name:"Observability",url:"/observability",icon:c.jsx(dE,{}),isOnMastraPlatform:!0},{name:"Datasets",url:"/datasets",icon:c.jsx(ku,{}),isOnMastraPlatform:!1}]},{key:"Templates",separator:!0,links:[{name:"Templates",url:"/templates",icon:c.jsx(ace,{}),isOnMastraPlatform:!1}]},{key:"Settings",separator:!0,links:[{name:"Settings",url:"/settings",icon:c.jsx(Fpe,{}),isOnMastraPlatform:!1}]}],Rbn={links:[{name:"Mastra APIs",url:"/swagger-ui",icon:c.jsx(Nbr,{}),isOnMastraPlatform:!1},{name:"Documentation",url:"https://mastra.ai/en/docs",icon:c.jsx(OT,{}),isOnMastraPlatform:!0},{name:"Github",url:"https://github.com/mastra-ai/mastra",icon:c.jsx(Lpe,{}),isOnMastraPlatform:!0},{name:"Community",url:"https://discord.gg/BTYqqHKUrf",icon:c.jsx(qbr,{}),isOnMastraPlatform:!0}]};function Pbn(){const{state:e}=jmt(),r=qd().pathname,n=window?.MASTRA_HIDE_CLOUD_CTA==="true",{isMastraPlatform:s}=zmt(),{data:a}=dj(),{isCmsAvailable:i,isLoading:o}=pS(),l=a&&Z6(a),u=new Set(["/prompts"]),d=p=>u.has(p.url)&&!i&&!o?!1:s?p.isOnMastraPlatform:!0;return c.jsxs(hc,{children:[c.jsx("div",{className:"pt-3 mb-4 -ml-0.5 sticky top-0 bg-surface1 z-10",children:e==="collapsed"?c.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[c.jsx(I0,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),l&&c.jsx(t$e,{})]}):l?c.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(I0,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),c.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),c.jsx(t$e,{})]}):c.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[c.jsx(I0,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),c.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),c.jsx(hc.Nav,{children:jbn.map(p=>{const f=p.links.filter(d),h=f.length>0&&p?.separator;return c.jsxs(hc.NavSection,{children:[p?.title?c.jsx(hc.NavHeader,{state:e,children:p.title}):c.jsx(c.Fragment,{children:h&&c.jsx(hc.NavSeparator,{})}),c.jsx(hc.NavList,{children:f.map(m=>{const g=r.startsWith(m.url);return c.jsx(hc.NavLink,{state:e,link:m,isActive:g},m.name)})})]},p.key)})}),c.jsxs(hc.Bottom,{children:[c.jsx(hc.Nav,{children:c.jsxs(hc.NavSection,{children:[c.jsx(hc.NavSeparator,{}),c.jsxs(hc.NavList,{children:[Rbn.links.filter(d).map(p=>c.jsx(hc.NavLink,{link:p,state:e},p.name)),!n&&!s?c.jsx(hc.NavLink,{link:{name:"Share",url:"https://mastra.ai/cloud",icon:c.jsx(Ebr,{}),variant:"featured",tooltipMsg:"You're running Mastra Studio locally. Want your team to collaborate?",isOnMastraPlatform:!1},state:e}):null]})]})}),e!=="collapsed"&&c.jsxs(c.Fragment,{children:[c.jsx(hc.NavSeparator,{}),c.jsx(Tnn,{collapsed:!1})]})]})]})}const $bn=E.createContext({theme:"system",setTheme:()=>null});function Mbn({children:e,defaultTheme:t="system"}){const[r,n]=E.useState(t);return E.useEffect(()=>{const s=window.document.documentElement;if(s.classList.remove("light","dark"),r==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";s.classList.add(a);return}s.classList.add(r)},[r]),c.jsx($bn.Provider,{value:{theme:r,setTheme:n},children:e})}const Lbn=({children:e})=>c.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[c.jsx(xKt,{position:"bottom-right"}),c.jsx(Mbn,{defaultTheme:"dark",attribute:"class",children:c.jsx(nc,{delayDuration:0,children:c.jsxs(Ndn,{children:[c.jsx(_pn,{}),c.jsxs("div",{className:"grid grid-cols-[auto_1fr] h-full",children:[c.jsx(Pbn,{}),c.jsx("div",{className:"bg-surface2 my-3 mr-3 rounded-lg border border-border1 overflow-y-auto",children:c.jsx(Vsn,{children:e})})]})]})})})]});function Fbn({agentId:e}){const{isCmsAvailable:t}=pS();return c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/agents",children:[c.jsx(ve,{children:c.jsx(Mi,{})}),"Agents"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(Jsn,{value:e,variant:"ghost",showSourceIcon:t})})]}),c.jsx(_mt,{children:c.jsxs(ye,{as:Pt,to:`/observability?entity=${e}`,children:[c.jsx(ve,{children:c.jsx(dE,{})}),"Traces"]})}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Agents documentation"]})})]})}const Bbn=({children:e})=>{const{agentId:t}=Ei();return c.jsxs(Hr,{children:[c.jsx(Fbn,{agentId:t}),e]})};function zbn(){const{data:e={},isLoading:t,error:r}=ffe(),n=!t&&Object.keys(e).length===0;return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(D0,{})}),"Processors"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Processors documentation"]})})]}),c.jsx(Si,{isCentered:n,children:c.jsx(Won,{processors:e,isLoading:t,error:r})})]})}function Ubn(){const{processorId:e}=Ei(),{data:t,isLoading:r,error:n}=pmt(e);return n&&Mc(n)?c.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/processors",children:[c.jsx(ve,{children:c.jsx(D0,{})}),"Processors"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:e})]})}),c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx(Ld,{resource:"processors"})})]}):!r&&t?.isWorkflow?c.jsx(mhn,{to:`/workflows/${e}/graph`,replace:!0}):r?c.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[c.jsx(Fr,{children:c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/processors",children:[c.jsx(ve,{children:c.jsx(D0,{})}),"Processors"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(Nr,{className:"h-6 w-32"})})]})}),c.jsxs("div",{className:"p-6",children:[c.jsx(Nr,{className:"h-8 w-48 mb-4"}),c.jsx(Nr,{className:"h-32 w-full"})]})]}):c.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[c.jsxs(Fr,{children:[c.jsxs(Xa,{children:[c.jsxs(Or,{as:Pt,to:"/processors",children:[c.jsx(ve,{children:c.jsx(D0,{})}),"Processors"]}),c.jsx(Or,{as:"span",to:"",isCurrent:!0,children:c.jsx(nln,{value:e,variant:"ghost"})})]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Processors documentation"]})})]}),c.jsx(eln,{processorId:e})]})}function Vbn(){const{data:e={},isLoading:t}=ah(),{data:r={},isLoading:n,error:s}=t8(),a=Object.keys(r).length>0,i=Object.values(e).some(l=>l.tools&&Object.keys(l.tools).length>0),o=!n&&!t&&!a&&!i;return c.jsxs(Hr,{children:[c.jsxs(Fr,{children:[c.jsxs(Us,{children:[c.jsx(ve,{children:c.jsx(tl,{})}),"Tools"]}),c.jsx(Vs,{children:c.jsxs(ye,{as:Pt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[c.jsx(ve,{children:c.jsx(ai,{})}),"Tools documentation"]})})]}),c.jsx(Si,{isCentered:o,children:c.jsx(oln,{tools:r,agents:e,isLoading:t||n,error:s})})]})}const qbn={agentLink:e=>`/agents/${e}/chat/new`,agentToolLink:(e,t)=>`/agents/${e}/tools/${t}`,agentSkillLink:(e,t,r)=>r?`/workspaces/${r}/skills/${t}?agentId=${encodeURIComponent(e)}`:"/workspaces",agentsLink:()=>"/agents",agentNewThreadLink:e=>`/agents/${e}/chat/new`,agentThreadLink:(e,t,r)=>r?`/agents/${e}/chat/${t}?messageId=${r}`:`/agents/${e}/chat/${t}`,workflowsLink:()=>"/workflows",workflowLink:e=>`/workflows/${e}`,networkLink:e=>`/networks/v-next/${e}/chat`,networkNewThreadLink:e=>`/networks/v-next/${e}/chat/${No()}`,networkThreadLink:(e,t)=>`/networks/v-next/${e}/chat/${t}`,scorerLink:e=>`/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)=>t?`/workspaces/${t}/skills/${e}`:"/workspaces",workspaceLink:e=>e?`/workspaces/${e}`:"/workspaces",workspaceSkillLink:(e,t)=>t?`/workspaces/${t}/skills/${e}`:"/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=>`/datasets/${e}`,datasetItemLink:(e,t)=>`/datasets/${e}/items/${t}`,datasetExperimentLink:(e,t)=>`/datasets/${e}/experiments/${t}`},Hbn=()=>{const e=Hd(),t=r=>e(r,{viewTransition:!0});return c.jsx(OJr,{Link:vyn,navigate:t,paths:qbn,children:c.jsx(Lbn,{children:c.jsx(uN,{})})})},Qbn=!!window.MASTRA_CLOUD_API_ENDPOINT,Gbn=EMe.has("datasets"),xMe=[{index:!0,element:c.jsx(Oyn,{})},{path:"instruction-blocks",element:c.jsx(_yn,{})},{path:"tools",element:c.jsx(Dyn,{})},{path:"agents",element:c.jsx(wyn,{})},{path:"scorers",element:c.jsx(Tyn,{})},{path:"workflows",element:c.jsx(Iyn,{})},{path:"skills",element:c.jsx(Ayn,{})},{path:"memory",element:c.jsx(Cyn,{})},{path:"variables",element:c.jsx(Nyn,{})}],Zbn=[{path:"/login",element:c.jsx(Wyn,{})},{path:"/signup",element:c.jsx(pbn,{})},{element:c.jsx(Hbn,{}),children:[...Qbn?[]:[{path:"/settings",element:c.jsx(dbn,{})},{path:"/templates",element:c.jsx(Obn,{})},{path:"/templates/:templateSlug",element:c.jsx(Cbn,{})}],{path:"/scorers",element:c.jsx(lbn,{})},{path:"/scorers/:scorerId",element:c.jsx(cbn,{})},{path:"/observability",element:c.jsx(abn,{})},{path:"/agents",element:c.jsx(xyn,{})},{path:"/cms/agents/create",element:c.jsx(Eyn,{}),children:xMe},{path:"/cms/agents/:agentId/edit",element:c.jsx(kyn,{}),children:xMe},{path:"/cms/scorers/create",element:c.jsx($yn,{})},{path:"/cms/scorers/:scorerId/edit",element:c.jsx(Lyn,{})},{path:"/prompts",element:c.jsx(ibn,{})},{path:"/cms/prompts/create",element:c.jsx(jyn,{})},{path:"/cms/prompts/:promptBlockId/edit",element:c.jsx(Pyn,{})},{path:"/agents/:agentId/tools/:toolId",element:c.jsx(Tbn,{})},{path:"/agents/:agentId",element:c.jsx(Bbn,{children:c.jsx(uN,{})}),children:[{index:!0,loader:({params:e})=>VY(`/agents/${e.agentId}/chat`)},{path:"chat",element:c.jsx(dMe,{})},{path:"chat/:threadId",element:c.jsx(dMe,{})}]},{path:"/tools",element:c.jsx(Vbn,{})},{path:"/tools/:toolId",element:c.jsx(Abn,{})},{path:"/processors",element:c.jsx(zbn,{})},{path:"/processors/:processorId",element:c.jsx(Ubn,{})},{path:"/mcps",element:c.jsx(Xyn,{})},{path:"/mcps/:serverId",element:c.jsx(Yyn,{})},{path:"/mcps/:serverId/tools/:toolId",element:c.jsx(Kyn,{})},{path:"/workspaces",element:c.jsx(vMe,{})},{path:"/workspaces/:workspaceId",element:c.jsx(vMe,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:c.jsx(Ibn,{})},{path:"/workflows",element:c.jsx(Dbn,{})},{path:"/workflows/:workflowId",element:c.jsx(emn,{children:c.jsx(uN,{})}),children:[{index:!0,loader:({params:e})=>VY(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:c.jsx(bMe,{})},{path:"graph/:runId",element:c.jsx(bMe,{})}]},...Gbn?[{path:"/datasets",element:c.jsx(Fyn,{})},{path:"/datasets/:datasetId",element:c.jsx(Byn,{})},{path:"/datasets/:datasetId/items/:itemId",element:c.jsx(Vyn,{})},{path:"/datasets/:datasetId/items/:itemId/versions",element:c.jsx(Qyn,{})},{path:"/datasets/:datasetId/experiments/:experimentId",element:c.jsx(zyn,{})},{path:"/datasets/:datasetId/experiments",element:c.jsx(Uyn,{})},{path:"/datasets/:datasetId/items",element:c.jsx(qyn,{})},{path:"/datasets/:datasetId/versions",element:c.jsx(Zyn,{})}]:[],{index:!0,loader:()=>VY("/agents")},{path:"/request-context",element:c.jsx(obn,{})}]}];function Wbn(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:r,apiPrefix:n,isLoading:s}=afe();if(s)return null;if(!t)return c.jsx(Nnn,{});const a=zhn(Zbn,{basename:e});return c.jsx(ixr,{baseUrl:t,headers:r,apiPrefix:n,children:c.jsx(yyn,{children:c.jsx(phn,{router:a})})})}function Xbn(){const e=window.MASTRA_SERVER_PROTOCOL||"http",t=window.MASTRA_SERVER_HOST||"localhost",r=window.MASTRA_SERVER_PORT||4111,n=window.MASTRA_API_PREFIX||"/api",s=window.MASTRA_CLOUD_API_ENDPOINT||"",a=window.MASTRA_AUTO_DETECT_URL==="true",i=s||(a?window.location.origin:`${e}://${t}:${r}`);return c.jsx(zdn,{children:c.jsx(wnn,{endpoint:i,defaultApiPrefix:n,children:c.jsx(Wbn,{})})})}zvt.createRoot(document.getElementById("root")).render(c.jsx(E.StrictMode,{children:c.jsx(Xbn,{})}));const Rxn=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{cVe as A,tQe as B,dVe as C,eHe as D,Pd as E,Ep as F,Tvn as G,nir as H,Js as I,Rxn as J,H0 as L,lVe as N,dF as _,Ujt as a,sRt as b,svn as c,Rve as d,z0 as e,eRt as f,G0 as g,nRt as h,P1 as i,$1 as j,R1 as k,oE as l,$Ht as m,oHe as n,ba as o,Xqt as p,Yqt as q,Eoe as r,wie as s,re as t,_3 as u,Wc as v,Gjt as w,ht as x,Je as y,kQe as z};