@clawos-dev/clawd 0.2.705 → 0.2.706
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +1 -1
- package/dist/cloud-persona-conversations.html +17 -17
- package/dist/owner-ui/assets/{owner-CI_Jfzp1.js → owner-CkvEKX6O.js} +71 -71
- package/dist/owner-ui/owner.html +1 -1
- package/dist/share-ui/assets/{guest-C9LR1bEi.js → guest-Dtd2LyTv.js} +13 -13
- package/dist/share-ui/guest.html +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ var Mj=Object.defineProperty;var Lb=e=>{throw TypeError(e)};var Aj=(e,t,n)=>t in
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var $u=Symbol.for("react.element"),Lj=Symbol.for("react.portal"),Dj=Symbol.for("react.fragment"),Oj=Symbol.for("react.strict_mode"),Bj=Symbol.for("react.profiler"),$j=Symbol.for("react.provider"),zj=Symbol.for("react.context"),Fj=Symbol.for("react.forward_ref"),Hj=Symbol.for("react.suspense"),Uj=Symbol.for("react.memo"),Wj=Symbol.for("react.lazy"),zb=Symbol.iterator;function qj(e){return e===null||typeof e!="object"?null:(e=zb&&e[zb]||e["@@iterator"],typeof e=="function"?e:null)}var HE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},UE=Object.assign,WE={};function Nl(e,t,n){this.props=e,this.context=t,this.refs=WE,this.updater=n||HE}Nl.prototype.isReactComponent={};Nl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Nl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function qE(){}qE.prototype=Nl.prototype;function P1(e,t,n){this.props=e,this.context=t,this.refs=WE,this.updater=n||HE}var R1=P1.prototype=new qE;R1.constructor=P1;UE(R1,Nl.prototype);R1.isPureReactComponent=!0;var Fb=Array.isArray,VE=Object.prototype.hasOwnProperty,M1={current:null},KE={key:!0,ref:!0,__self:!0,__source:!0};function GE(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)VE.call(t,r)&&!KE.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:$u,type:e,key:s,ref:o,props:i,_owner:M1.current}}function Vj(e,t){return{$$typeof:$u,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function A1(e){return typeof e=="object"&&e!==null&&e.$$typeof===$u}function Kj(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Hb=/\/+/g;function zm(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Kj(""+e.key):t.toString(36)}function yh(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case $u:case Lj:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+zm(o,0):r,Fb(i)?(n="",e!=null&&(n=e.replace(Hb,"$&/")+"/"),yh(i,t,n,"",function(c){return c})):i!=null&&(A1(i)&&(i=Vj(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Hb,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",Fb(e))for(var a=0;a<e.length;a++){s=e[a];var l=r+zm(s,a);o+=yh(s,t,n,l,i)}else if(l=qj(e),typeof l=="function")for(e=l.call(e),a=0;!(s=e.next()).done;)s=s.value,l=r+zm(s,a++),o+=yh(s,t,n,l,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function xd(e,t,n){if(e==null)return e;var r=[],i=0;return yh(e,r,"","",function(s){return t.call(n,s,i++)}),r}function Gj(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var $n={current:null},_h={transition:null},Yj={ReactCurrentDispatcher:$n,ReactCurrentBatchConfig:_h,ReactCurrentOwner:M1};function YE(){throw Error("act(...) is not supported in production builds of React.")}Xe.Children={map:xd,forEach:function(e,t,n){xd(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return xd(e,function(){t++}),t},toArray:function(e){return xd(e,function(t){return t})||[]},only:function(e){if(!A1(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Xe.Component=Nl;Xe.Fragment=Dj;Xe.Profiler=Bj;Xe.PureComponent=P1;Xe.StrictMode=Oj;Xe.Suspense=Hj;Xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Yj;Xe.act=YE;Xe.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=UE({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=M1.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)VE.call(t,l)&&!KE.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:$u,type:e.type,key:i,ref:s,props:r,_owner:o}};Xe.createContext=function(e){return e={$$typeof:zj,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:$j,_context:e},e.Consumer=e};Xe.createElement=GE;Xe.createFactory=function(e){var t=GE.bind(null,e);return t.type=e,t};Xe.createRef=function(){return{current:null}};Xe.forwardRef=function(e){return{$$typeof:Fj,render:e}};Xe.isValidElement=A1;Xe.lazy=function(e){return{$$typeof:Wj,_payload:{_status:-1,_result:e},_init:Gj}};Xe.memo=function(e,t){return{$$typeof:Uj,type:e,compare:t===void 0?null:t}};Xe.startTransition=function(e){var t=_h.transition;_h.transition={};try{e()}finally{_h.transition=t}};Xe.unstable_act=YE;Xe.useCallback=function(e,t){return $n.current.useCallback(e,t)};Xe.useContext=function(e){return $n.current.useContext(e)};Xe.useDebugValue=function(){};Xe.useDeferredValue=function(e){return $n.current.useDeferredValue(e)};Xe.useEffect=function(e,t){return $n.current.useEffect(e,t)};Xe.useId=function(){return $n.current.useId()};Xe.useImperativeHandle=function(e,t,n){return $n.current.useImperativeHandle(e,t,n)};Xe.useInsertionEffect=function(e,t){return $n.current.useInsertionEffect(e,t)};Xe.useLayoutEffect=function(e,t){return $n.current.useLayoutEffect(e,t)};Xe.useMemo=function(e,t){return $n.current.useMemo(e,t)};Xe.useReducer=function(e,t,n){return $n.current.useReducer(e,t,n)};Xe.useRef=function(e){return $n.current.useRef(e)};Xe.useState=function(e){return $n.current.useState(e)};Xe.useSyncExternalStore=function(e,t,n){return $n.current.useSyncExternalStore(e,t,n)};Xe.useTransition=function(){return $n.current.useTransition()};Xe.version="18.3.1";FE.exports=Xe;var g=FE.exports;const
|
|
9
|
+
*/var $u=Symbol.for("react.element"),Lj=Symbol.for("react.portal"),Dj=Symbol.for("react.fragment"),Oj=Symbol.for("react.strict_mode"),Bj=Symbol.for("react.profiler"),$j=Symbol.for("react.provider"),zj=Symbol.for("react.context"),Fj=Symbol.for("react.forward_ref"),Hj=Symbol.for("react.suspense"),Uj=Symbol.for("react.memo"),Wj=Symbol.for("react.lazy"),zb=Symbol.iterator;function qj(e){return e===null||typeof e!="object"?null:(e=zb&&e[zb]||e["@@iterator"],typeof e=="function"?e:null)}var HE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},UE=Object.assign,WE={};function Nl(e,t,n){this.props=e,this.context=t,this.refs=WE,this.updater=n||HE}Nl.prototype.isReactComponent={};Nl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Nl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function qE(){}qE.prototype=Nl.prototype;function P1(e,t,n){this.props=e,this.context=t,this.refs=WE,this.updater=n||HE}var R1=P1.prototype=new qE;R1.constructor=P1;UE(R1,Nl.prototype);R1.isPureReactComponent=!0;var Fb=Array.isArray,VE=Object.prototype.hasOwnProperty,M1={current:null},KE={key:!0,ref:!0,__self:!0,__source:!0};function GE(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)VE.call(t,r)&&!KE.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:$u,type:e,key:s,ref:o,props:i,_owner:M1.current}}function Vj(e,t){return{$$typeof:$u,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function A1(e){return typeof e=="object"&&e!==null&&e.$$typeof===$u}function Kj(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Hb=/\/+/g;function zm(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Kj(""+e.key):t.toString(36)}function yh(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case $u:case Lj:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+zm(o,0):r,Fb(i)?(n="",e!=null&&(n=e.replace(Hb,"$&/")+"/"),yh(i,t,n,"",function(c){return c})):i!=null&&(A1(i)&&(i=Vj(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Hb,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",Fb(e))for(var a=0;a<e.length;a++){s=e[a];var l=r+zm(s,a);o+=yh(s,t,n,l,i)}else if(l=qj(e),typeof l=="function")for(e=l.call(e),a=0;!(s=e.next()).done;)s=s.value,l=r+zm(s,a++),o+=yh(s,t,n,l,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function xd(e,t,n){if(e==null)return e;var r=[],i=0;return yh(e,r,"","",function(s){return t.call(n,s,i++)}),r}function Gj(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var $n={current:null},_h={transition:null},Yj={ReactCurrentDispatcher:$n,ReactCurrentBatchConfig:_h,ReactCurrentOwner:M1};function YE(){throw Error("act(...) is not supported in production builds of React.")}Xe.Children={map:xd,forEach:function(e,t,n){xd(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return xd(e,function(){t++}),t},toArray:function(e){return xd(e,function(t){return t})||[]},only:function(e){if(!A1(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Xe.Component=Nl;Xe.Fragment=Dj;Xe.Profiler=Bj;Xe.PureComponent=P1;Xe.StrictMode=Oj;Xe.Suspense=Hj;Xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Yj;Xe.act=YE;Xe.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=UE({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=M1.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)VE.call(t,l)&&!KE.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:$u,type:e.type,key:i,ref:s,props:r,_owner:o}};Xe.createContext=function(e){return e={$$typeof:zj,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:$j,_context:e},e.Consumer=e};Xe.createElement=GE;Xe.createFactory=function(e){var t=GE.bind(null,e);return t.type=e,t};Xe.createRef=function(){return{current:null}};Xe.forwardRef=function(e){return{$$typeof:Fj,render:e}};Xe.isValidElement=A1;Xe.lazy=function(e){return{$$typeof:Wj,_payload:{_status:-1,_result:e},_init:Gj}};Xe.memo=function(e,t){return{$$typeof:Uj,type:e,compare:t===void 0?null:t}};Xe.startTransition=function(e){var t=_h.transition;_h.transition={};try{e()}finally{_h.transition=t}};Xe.unstable_act=YE;Xe.useCallback=function(e,t){return $n.current.useCallback(e,t)};Xe.useContext=function(e){return $n.current.useContext(e)};Xe.useDebugValue=function(){};Xe.useDeferredValue=function(e){return $n.current.useDeferredValue(e)};Xe.useEffect=function(e,t){return $n.current.useEffect(e,t)};Xe.useId=function(){return $n.current.useId()};Xe.useImperativeHandle=function(e,t,n){return $n.current.useImperativeHandle(e,t,n)};Xe.useInsertionEffect=function(e,t){return $n.current.useInsertionEffect(e,t)};Xe.useLayoutEffect=function(e,t){return $n.current.useLayoutEffect(e,t)};Xe.useMemo=function(e,t){return $n.current.useMemo(e,t)};Xe.useReducer=function(e,t,n){return $n.current.useReducer(e,t,n)};Xe.useRef=function(e){return $n.current.useRef(e)};Xe.useState=function(e){return $n.current.useState(e)};Xe.useSyncExternalStore=function(e,t,n){return $n.current.useSyncExternalStore(e,t,n)};Xe.useTransition=function(){return $n.current.useTransition()};Xe.version="18.3.1";FE.exports=Xe;var g=FE.exports;const Ze=Bu(g),Tl=jj({__proto__:null,default:Ze},[g]);/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.production.min.js
|
|
12
12
|
*
|
|
@@ -41,7 +41,7 @@ Error generating stack: `+s.message+`
|
|
|
41
41
|
Copyright (c) 2018 Jed Watson.
|
|
42
42
|
Licensed under the MIT License (MIT), see
|
|
43
43
|
http://jedwatson.github.io/classnames
|
|
44
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,r(a)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(t5);var hO=t5.exports;const fO=Bu(hO);function Sf(){return Sf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sf.apply(null,arguments)}function Rt(e){"@babel/helpers - typeof";return Rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(e)}var pO=Symbol.for("react.element"),mO=Symbol.for("react.transitional.element"),gO=Symbol.for("react.fragment");function vO(e){return e&&Rt(e)==="object"&&(e.$$typeof===pO||e.$$typeof===mO)&&e.type===gO}var bv={},xO=function(t){};function yO(e,t){}function _O(e,t){}function bO(){bv={}}function n5(e,t,n){!t&&!bv[n]&&(e(!1,n),bv[n]=!0)}function Mp(e,t){n5(yO,e,t)}function wO(e,t){n5(_O,e,t)}Mp.preMessage=xO;Mp.resetWarned=bO;Mp.noteOnce=wO;function SO(e,t){if(Rt(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Rt(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function r5(e){var t=SO(e,"string");return Rt(t)=="symbol"?t:t+""}function Te(e,t,n){return(t=r5(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ke(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zw(Object(n),!0).forEach(function(r){Te(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zw(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Qw(e){return e instanceof HTMLElement||e instanceof SVGElement}function kO(e){return e&&Rt(e)==="object"&&Qw(e.nativeElement)?e.nativeElement:Qw(e)?e:null}function CO(e){var t=kO(e);if(t)return t;if(e instanceof
|
|
44
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,r(a)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(t5);var hO=t5.exports;const fO=Bu(hO);function Sf(){return Sf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sf.apply(null,arguments)}function Rt(e){"@babel/helpers - typeof";return Rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(e)}var pO=Symbol.for("react.element"),mO=Symbol.for("react.transitional.element"),gO=Symbol.for("react.fragment");function vO(e){return e&&Rt(e)==="object"&&(e.$$typeof===pO||e.$$typeof===mO)&&e.type===gO}var bv={},xO=function(t){};function yO(e,t){}function _O(e,t){}function bO(){bv={}}function n5(e,t,n){!t&&!bv[n]&&(e(!1,n),bv[n]=!0)}function Mp(e,t){n5(yO,e,t)}function wO(e,t){n5(_O,e,t)}Mp.preMessage=xO;Mp.resetWarned=bO;Mp.noteOnce=wO;function SO(e,t){if(Rt(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Rt(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function r5(e){var t=SO(e,"string");return Rt(t)=="symbol"?t:t+""}function Te(e,t,n){return(t=r5(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ke(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zw(Object(n),!0).forEach(function(r){Te(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zw(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Qw(e){return e instanceof HTMLElement||e instanceof SVGElement}function kO(e){return e&&Rt(e)==="object"&&Qw(e.nativeElement)?e.nativeElement:Qw(e)?e:null}function CO(e){var t=kO(e);if(t)return t;if(e instanceof Ze.Component){var n;return(n=_v.findDOMNode)===null||n===void 0?void 0:n.call(_v,e)}return null}var i5={exports:{}},lt={};/**
|
|
45
45
|
* @license React
|
|
46
46
|
* react-is.production.min.js
|
|
47
47
|
*
|
|
@@ -55,7 +55,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
55
55
|
`);else if(_._keyframe)m(_);else{var b=d.reduce(function(S,C){var k;return(C==null||(k=C.visit)===null||k===void 0?void 0:k.call(C,S))||S},_);Object.keys(b).forEach(function(S){var C=b[S];if(Rt(C)==="object"&&C&&(S!=="animationName"||!C._keyframe)&&!B6(C)){var k=!1,T=S.trim(),E=!1;(i||s)&&a?T.startsWith("@")?k=!0:T==="&"?T=hS("",a,c):T=hS(S,a,c):i&&!a&&(T==="&"||T==="")&&(T="",E=!0);var D=e(C,n,{root:E,injectHash:k,parentSelectors:[].concat(Zo(o),[T])}),N=ot(D,2),L=N[0],R=N[1];p=Ke(Ke({},p),R),f+="".concat(T).concat(L)}else{let j=function(z,F){var $=z.replace(/[A-Z]/g,function(I){return"-".concat(I.toLowerCase())}),B=F;!g6[z]&&typeof B=="number"&&B!==0&&(B="".concat(B,"px")),z==="animationName"&&F!==null&&F!==void 0&&F._keyframe&&(m(F),B=F.getName(a)),f+="".concat($,":").concat(B,";")};var M,A=(M=C==null?void 0:C.value)!==null&&M!==void 0?M:C;Rt(C)==="object"&&C!==null&&C!==void 0&&C[P5]&&Array.isArray(A)?A.forEach(function(z){j(S,z)}):j(S,A)}})}}),i?l&&(f&&(f="@layer ".concat(l.name," {").concat(f,"}")),l.dependencies&&(p["@layer ".concat(l.name)]=l.dependencies.map(function(x){return"@layer ".concat(x,", ").concat(l.name,";")}).join(`
|
|
56
56
|
`))):f="{".concat(f,"}"),[f,p]};function z6(e,t){return pu("".concat(e.join("%")).concat(t))}function F6(){return null}var R5="style";function H6(e,t){var n=e.token,r=e.path,i=e.hashId,s=e.layer,o=e.nonce,a=e.clientOnly,l=e.order,c=l===void 0?0:l,u=g.useContext(Wp),d=u.autoClear;u.mock;var f=u.defaultCache,p=u.hashPriority,m=u.container,v=u.ssrInline,w=u.transformers,x=u.linters,_=u.cache,b=u.layer,S=n._tokenKey,C=[S];b&&C.push("layer"),C.push.apply(C,Zo(r));var k=oS,T=b5(R5,C,function(){var R=C.join("|");if(L6(R)){var M=D6(R),A=ot(M,2),j=A[0],z=A[1];if(j)return[j,S,z,{},a,c]}var F=t(),$=$6(F,{hashId:i,hashPriority:p,layer:b?s:void 0,path:r.join("-"),transformers:w,linters:x}),B=ot($,2),I=B[0],U=B[1],q=Ah(I),O=z6(C,q);return[q,S,O,U,a,c]},function(R,M){var A=ot(R,3),j=A[2];(M||d)&&oS&&$O(j,{mark:Vi,attachTo:m})},function(R){var M=ot(R,4),A=M[0];M[1];var j=M[2],z=M[3];if(k&&A!==N5){var F={mark:Vi,prepend:b?!1:"queue",attachTo:m,priority:c},$=typeof o=="function"?o():o;$&&(F.csp={nonce:$});var B=[],I=[];Object.keys(z).forEach(function(q){q.startsWith("@layer")?B.push(q):I.push(q)}),B.forEach(function(q){Fc(Ah(z[q]),"_layer-".concat(q),Ke(Ke({},F),{},{prepend:!0}))});var U=Fc(A,j,F);U[Co]=_.instanceId,U.setAttribute(mu,S),I.forEach(function(q){Fc(Ah(z[q]),"_effect-".concat(q),F)})}}),E=ot(T,3),D=E[0],N=E[1],L=E[2];return function(R){var M;return!v||k||!f?M=g.createElement(F6,null):M=g.createElement("style",Sf({},Te(Te({},mu,N),Vi,L),{dangerouslySetInnerHTML:{__html:D}})),g.createElement(g.Fragment,null,M,R)}}var U6=function(t,n,r){var i=ot(t,6),s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],d=r||{},f=d.plain;if(c)return null;var p=s,m={"data-rc-order":"prependQueue","data-rc-priority":"".concat(u)};return p=Cf(s,o,a,m,f),l&&Object.keys(l).forEach(function(v){if(!n[v]){n[v]=!0;var w=Ah(l[v]),x=Cf(w,o,"_effect-".concat(v),m,f);v.startsWith("@layer")?p=x+p:p+=x}}),[u,a,p]},W6="cssVar",q6=function(t,n,r){var i=ot(t,4),s=i[1],o=i[2],a=i[3],l=r||{},c=l.plain;if(!s)return null;var u=-999,d={"data-rc-order":"prependQueue","data-rc-priority":"".concat(u)},f=Cf(s,a,o,d,c);return[u,o,f]};Te(Te(Te({},R5,U6),w5,m6),W6,q6);function da(e){return e.notSplit=!0,e}da(["borderTop","borderBottom"]),da(["borderTop"]),da(["borderBottom"]),da(["borderLeft","borderRight"]),da(["borderLeft"]),da(["borderRight"]);var V6=g.createContext({});function K6(e){return m5(e)||d5(e)||Iy(e)||g5()}function Av(e,t){for(var n=e,r=0;r<t.length;r+=1){if(n==null)return;n=n[t[r]]}return n}function M5(e,t,n,r){if(!t.length)return n;var i=K6(t),s=i[0],o=i.slice(1),a;return!e&&typeof s=="number"?a=[]:Array.isArray(e)?a=Zo(e):a=Ke({},e),r&&n===void 0&&o.length===1?delete a[s][o[0]]:a[s]=M5(a[s],o,n,r),a}function gg(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return t.length&&r&&n===void 0&&!Av(e,t.slice(0,-1))?e:M5(e,t,n,r)}function G6(e){return Rt(e)==="object"&&e!==null&&Object.getPrototypeOf(e)===Object.prototype}function fS(e){return Array.isArray(e)?[]:{}}var Y6=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function X6(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=fS(t[0]);return t.forEach(function(i){function s(o,a){var l=new Set(a),c=Av(i,o),u=Array.isArray(c);if(u||G6(c)){if(!l.has(c)){l.add(c);var d=Av(r,o);u?r=gg(r,o,[]):(!d||Rt(d)!=="object")&&(r=gg(r,o,fS(c))),Y6(c).forEach(function(f){s([].concat(Zo(o),[f]),l)})}}else r=gg(r,o,c)}s([])}),r}const Z6=g.createContext({}),Q6=g.createContext(void 0),nr="${label} is not a valid ${type}",Kp={Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:nr,method:nr,array:nr,object:nr,number:nr,date:nr,boolean:nr,integer:nr,float:nr,regexp:nr,email:nr,url:nr,hex:nr},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}}};Object.assign({},Kp.Modal);let jh=[];const pS=()=>jh.reduce((e,t)=>Object.assign(Object.assign({},e),t),Kp.Modal);function J6(e){if(e){const t=Object.assign({},e);return jh.push(t),pS(),()=>{jh=jh.filter(n=>n!==t),pS()}}Object.assign({},Kp.Modal)}const A5=g.createContext(void 0),e8="internalMark",t8=e=>{const{locale:t={},children:n,_ANT_MARK__:r}=e;g.useEffect(()=>J6(t==null?void 0:t.Modal),[t]);const i=g.useMemo(()=>Object.assign(Object.assign({},t),{exist:!0}),[t]);return g.createElement(A5.Provider,{value:i},n)},My={blue:"#1677FF",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#EB2F96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},vu=Object.assign(Object.assign({},My),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
57
57
|
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
58
|
-
'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),rn=Math.round;function vg(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(i=>parseFloat(i));for(let i=0;i<3;i+=1)r[i]=t(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const mS=(e,t,n)=>n===0?e:e/100;function ac(e,t){const n=t||255;return e>n?n:e<0?0:e}class Et{constructor(t){Te(this,"isValid",!0),Te(this,"r",0),Te(this,"g",0),Te(this,"b",0),Te(this,"a",1),Te(this,"_h",void 0),Te(this,"_s",void 0),Te(this,"_l",void 0),Te(this,"_v",void 0),Te(this,"_max",void 0),Te(this,"_min",void 0),Te(this,"_brightness",void 0);function n(i){return i[0]in t&&i[1]in t&&i[2]in t}if(t)if(typeof t=="string"){let s=function(o){return i.startsWith(o)};var r=s;const i=t.trim();/^#?[A-F\d]{3,8}$/i.test(i)?this.fromHexString(i):s("rgb")?this.fromRgbString(i):s("hsl")?this.fromHslString(i):(s("hsv")||s("hsb"))&&this.fromHsvString(i)}else if(t instanceof Et)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=ac(t.r),this.g=ac(t.g),this.b=ac(t.b),this.a=typeof t.a=="number"?ac(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(s){const o=s/255;return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),i=t(this.b);return .2126*n+.7152*r+.0722*i}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=rn(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()-t/100;return i<0&&(i=0),this._c({h:n,s:r,l:i,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()+t/100;return i>1&&(i=1),this._c({h:n,s:r,l:i,a:this.a})}mix(t,n=50){const r=this._c(t),i=n/100,s=a=>(r[a]-this[a])*i+this[a],o={r:rn(s("r")),g:rn(s("g")),b:rn(s("b")),a:rn(s("a")*100)/100};return this._c(o)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),i=s=>rn((this[s]*this.a+n[s]*n.a*(1-this.a))/r);return this._c({r:i("r"),g:i("g"),b:i("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const i=(this.b||0).toString(16);if(t+=i.length===2?i:"0"+i,typeof this.a=="number"&&this.a>=0&&this.a<1){const s=rn(this.a*255).toString(16);t+=s.length===2?s:"0"+s}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=rn(this.getSaturation()*100),r=rn(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const i=this.clone();return i[t]=ac(n,r),i}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(i,s){return parseInt(n[i]+n[s||i],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a:i}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof i=="number"?i:1,n<=0){const f=rn(r*255);this.r=f,this.g=f,this.b=f}let s=0,o=0,a=0;const l=t/60,c=(1-Math.abs(2*r-1))*n,u=c*(1-Math.abs(l%2-1));l>=0&&l<1?(s=c,o=u):l>=1&&l<2?(s=u,o=c):l>=2&&l<3?(o=c,a=u):l>=3&&l<4?(o=u,a=c):l>=4&&l<5?(s=u,a=c):l>=5&&l<6&&(s=c,a=u);const d=r-c/2;this.r=rn((s+d)*255),this.g=rn((o+d)*255),this.b=rn((a+d)*255)}fromHsv({h:t,s:n,v:r,a:i}){this._h=t%360,this._s=n,this._v=r,this.a=typeof i=="number"?i:1;const s=rn(r*255);if(this.r=s,this.g=s,this.b=s,n<=0)return;const o=t/60,a=Math.floor(o),l=o-a,c=rn(r*(1-n)*255),u=rn(r*(1-n*l)*255),d=rn(r*(1-n*(1-l))*255);switch(a){case 0:this.g=d,this.b=c;break;case 1:this.r=u,this.b=c;break;case 2:this.r=c,this.b=d;break;case 3:this.r=c,this.g=u;break;case 4:this.r=d,this.g=c;break;case 5:default:this.g=c,this.b=u;break}}fromHsvString(t){const n=vg(t,mS);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=vg(t,mS);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=vg(t,(r,i)=>i.includes("%")?rn(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}var Dd=2,gS=.16,n8=.05,r8=.05,i8=.15,j5=5,L5=4,s8=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function vS(e,t,n){var r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-Dd*t:Math.round(e.h)+Dd*t:r=n?Math.round(e.h)+Dd*t:Math.round(e.h)-Dd*t,r<0?r+=360:r>=360&&(r-=360),r}function xS(e,t,n){if(e.h===0&&e.s===0)return e.s;var r;return n?r=e.s-gS*t:t===L5?r=e.s+gS:r=e.s+n8*t,r>1&&(r=1),n&&t===j5&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function yS(e,t,n){var r;return n?r=e.v+r8*t:r=e.v-i8*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function dl(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new Et(e),i=r.toHsv(),s=j5;s>0;s-=1){var o=new Et({h:vS(i,s,!0),s:xS(i,s,!0),v:yS(i,s,!0)});n.push(o)}n.push(r);for(var a=1;a<=L5;a+=1){var l=new Et({h:vS(i,a),s:xS(i,a),v:yS(i,a)});n.push(l)}return t.theme==="dark"?s8.map(function(c){var u=c.index,d=c.amount;return new Et(t.backgroundColor||"#141414").mix(n[u],d).toHexString()}):n.map(function(c){return c.toHexString()})}var xg={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},jv=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];jv.primary=jv[5];var Lv=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];Lv.primary=Lv[5];var Dv=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];Dv.primary=Dv[5];var Ov=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];Ov.primary=Ov[5];var Bv=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];Bv.primary=Bv[5];var $v=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];$v.primary=$v[5];var zv=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];zv.primary=zv[5];var Fv=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];Fv.primary=Fv[5];var Hv=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];Hv.primary=Hv[5];var Uv=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];Uv.primary=Uv[5];var Wv=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];Wv.primary=Wv[5];var qv=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];qv.primary=qv[5];var Vv=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];Vv.primary=Vv[5];var yg={red:jv,volcano:Lv,orange:Dv,gold:Ov,yellow:Bv,lime:$v,green:zv,cyan:Fv,blue:Hv,geekblue:Uv,purple:Wv,magenta:qv,grey:Vv};function D5(e,{generateColorPalettes:t,generateNeutralColorPalettes:n}){const{colorSuccess:r,colorWarning:i,colorError:s,colorInfo:o,colorPrimary:a,colorBgBase:l,colorTextBase:c}=e,u=t(a),d=t(r),f=t(i),p=t(s),m=t(o),v=n(l,c),w=e.colorLink||e.colorInfo,x=t(w),_=new Et(p[1]).mix(new Et(p[3]),50).toHexString();return Object.assign(Object.assign({},v),{colorPrimaryBg:u[1],colorPrimaryBgHover:u[2],colorPrimaryBorder:u[3],colorPrimaryBorderHover:u[4],colorPrimaryHover:u[5],colorPrimary:u[6],colorPrimaryActive:u[7],colorPrimaryTextHover:u[8],colorPrimaryText:u[9],colorPrimaryTextActive:u[10],colorSuccessBg:d[1],colorSuccessBgHover:d[2],colorSuccessBorder:d[3],colorSuccessBorderHover:d[4],colorSuccessHover:d[4],colorSuccess:d[6],colorSuccessActive:d[7],colorSuccessTextHover:d[8],colorSuccessText:d[9],colorSuccessTextActive:d[10],colorErrorBg:p[1],colorErrorBgHover:p[2],colorErrorBgFilledHover:_,colorErrorBgActive:p[3],colorErrorBorder:p[3],colorErrorBorderHover:p[4],colorErrorHover:p[5],colorError:p[6],colorErrorActive:p[7],colorErrorTextHover:p[8],colorErrorText:p[9],colorErrorTextActive:p[10],colorWarningBg:f[1],colorWarningBgHover:f[2],colorWarningBorder:f[3],colorWarningBorderHover:f[4],colorWarningHover:f[4],colorWarning:f[6],colorWarningActive:f[7],colorWarningTextHover:f[8],colorWarningText:f[9],colorWarningTextActive:f[10],colorInfoBg:m[1],colorInfoBgHover:m[2],colorInfoBorder:m[3],colorInfoBorderHover:m[4],colorInfoHover:m[4],colorInfo:m[6],colorInfoActive:m[7],colorInfoTextHover:m[8],colorInfoText:m[9],colorInfoTextActive:m[10],colorLinkHover:x[4],colorLink:x[6],colorLinkActive:x[7],colorBgMask:new Et("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const o8=e=>{let t=e,n=e,r=e,i=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?i=4:e>=8&&(i=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:i}};function a8(e){const{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:i}=e;return Object.assign({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:i+1},o8(r))}const l8=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function c8(e){return(e+8)/e}function u8(e){const t=Array.from({length:10}).map((n,r)=>{const i=r-1,s=e*Math.pow(Math.E,i/5),o=r>1?Math.floor(s):Math.ceil(s);return Math.floor(o/2)*2});return t[1]=e,t.map(n=>({size:n,lineHeight:c8(n)}))}const d8=e=>{const t=u8(e),n=t.map(u=>u.size),r=t.map(u=>u.lineHeight),i=n[1],s=n[0],o=n[2],a=r[1],l=r[0],c=r[2];return{fontSizeSM:s,fontSize:i,fontSizeLG:o,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:a,lineHeightLG:c,lineHeightSM:l,fontHeight:Math.round(a*i),fontHeightLG:Math.round(c*o),fontHeightSM:Math.round(l*s),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function h8(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const yr=(e,t)=>new Et(e).setA(t).toRgbString(),lc=(e,t)=>new Et(e).darken(t).toHexString(),f8=e=>{const t=dl(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},p8=(e,t)=>{const n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:yr(r,.88),colorTextSecondary:yr(r,.65),colorTextTertiary:yr(r,.45),colorTextQuaternary:yr(r,.25),colorFill:yr(r,.15),colorFillSecondary:yr(r,.06),colorFillTertiary:yr(r,.04),colorFillQuaternary:yr(r,.02),colorBgSolid:yr(r,1),colorBgSolidHover:yr(r,.75),colorBgSolidActive:yr(r,.95),colorBgLayout:lc(n,4),colorBgContainer:lc(n,0),colorBgElevated:lc(n,0),colorBgSpotlight:yr(r,.85),colorBgBlur:"transparent",colorBorder:lc(n,15),colorBorderSecondary:lc(n,6)}};function Ay(e){xg.pink=xg.magenta,yg.pink=yg.magenta;const t=Object.keys(My).map(n=>{const r=e[n]===xg[n]?yg[n]:dl(e[n]);return Array.from({length:10},()=>1).reduce((i,s,o)=>(i[`${n}-${o+1}`]=r[o],i[`${n}${o+1}`]=r[o],i),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),D5(e,{generateColorPalettes:f8,generateNeutralColorPalettes:p8})),d8(e.fontSize)),h8(e)),l8(e)),a8(e))}const O5=Tv(Ay),Ef={token:vu,override:{override:vu},hashed:!0},B5=Je.createContext(Ef),Kv="ant",$5="anticon",m8=(e,t)=>t||(e?`${Kv}-${e}`:Kv),Gp=g.createContext({getPrefixCls:m8,iconPrefixCls:$5}),{Consumer:Dde}=Gp,g8=`-ant-${Date.now()}-${Math.random()}`;function v8(e,t){const n={},r=(o,a)=>{let l=o.clone();return l=(a==null?void 0:a(l))||l,l.toRgbString()},i=(o,a)=>{const l=new Et(o),c=dl(l.toRgbString());n[`${a}-color`]=r(l),n[`${a}-color-disabled`]=c[1],n[`${a}-color-hover`]=c[4],n[`${a}-color-active`]=c[6],n[`${a}-color-outline`]=l.clone().setA(.2).toRgbString(),n[`${a}-color-deprecated-bg`]=c[0],n[`${a}-color-deprecated-border`]=c[2]};if(t.primaryColor){i(t.primaryColor,"primary");const o=new Et(t.primaryColor),a=dl(o.toRgbString());a.forEach((c,u)=>{n[`primary-${u+1}`]=c}),n["primary-color-deprecated-l-35"]=r(o,c=>c.lighten(35)),n["primary-color-deprecated-l-20"]=r(o,c=>c.lighten(20)),n["primary-color-deprecated-t-20"]=r(o,c=>c.tint(20)),n["primary-color-deprecated-t-50"]=r(o,c=>c.tint(50)),n["primary-color-deprecated-f-12"]=r(o,c=>c.setA(c.a*.12));const l=new Et(a[0]);n["primary-color-active-deprecated-f-30"]=r(l,c=>c.setA(c.a*.3)),n["primary-color-active-deprecated-d-02"]=r(l,c=>c.darken(2))}return t.successColor&&i(t.successColor,"success"),t.warningColor&&i(t.warningColor,"warning"),t.errorColor&&i(t.errorColor,"error"),t.infoColor&&i(t.infoColor,"info"),`
|
|
58
|
+
'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),rn=Math.round;function vg(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(i=>parseFloat(i));for(let i=0;i<3;i+=1)r[i]=t(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const mS=(e,t,n)=>n===0?e:e/100;function ac(e,t){const n=t||255;return e>n?n:e<0?0:e}class Et{constructor(t){Te(this,"isValid",!0),Te(this,"r",0),Te(this,"g",0),Te(this,"b",0),Te(this,"a",1),Te(this,"_h",void 0),Te(this,"_s",void 0),Te(this,"_l",void 0),Te(this,"_v",void 0),Te(this,"_max",void 0),Te(this,"_min",void 0),Te(this,"_brightness",void 0);function n(i){return i[0]in t&&i[1]in t&&i[2]in t}if(t)if(typeof t=="string"){let s=function(o){return i.startsWith(o)};var r=s;const i=t.trim();/^#?[A-F\d]{3,8}$/i.test(i)?this.fromHexString(i):s("rgb")?this.fromRgbString(i):s("hsl")?this.fromHslString(i):(s("hsv")||s("hsb"))&&this.fromHsvString(i)}else if(t instanceof Et)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=ac(t.r),this.g=ac(t.g),this.b=ac(t.b),this.a=typeof t.a=="number"?ac(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(s){const o=s/255;return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),i=t(this.b);return .2126*n+.7152*r+.0722*i}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=rn(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()-t/100;return i<0&&(i=0),this._c({h:n,s:r,l:i,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()+t/100;return i>1&&(i=1),this._c({h:n,s:r,l:i,a:this.a})}mix(t,n=50){const r=this._c(t),i=n/100,s=a=>(r[a]-this[a])*i+this[a],o={r:rn(s("r")),g:rn(s("g")),b:rn(s("b")),a:rn(s("a")*100)/100};return this._c(o)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),i=s=>rn((this[s]*this.a+n[s]*n.a*(1-this.a))/r);return this._c({r:i("r"),g:i("g"),b:i("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const i=(this.b||0).toString(16);if(t+=i.length===2?i:"0"+i,typeof this.a=="number"&&this.a>=0&&this.a<1){const s=rn(this.a*255).toString(16);t+=s.length===2?s:"0"+s}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=rn(this.getSaturation()*100),r=rn(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const i=this.clone();return i[t]=ac(n,r),i}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(i,s){return parseInt(n[i]+n[s||i],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a:i}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof i=="number"?i:1,n<=0){const f=rn(r*255);this.r=f,this.g=f,this.b=f}let s=0,o=0,a=0;const l=t/60,c=(1-Math.abs(2*r-1))*n,u=c*(1-Math.abs(l%2-1));l>=0&&l<1?(s=c,o=u):l>=1&&l<2?(s=u,o=c):l>=2&&l<3?(o=c,a=u):l>=3&&l<4?(o=u,a=c):l>=4&&l<5?(s=u,a=c):l>=5&&l<6&&(s=c,a=u);const d=r-c/2;this.r=rn((s+d)*255),this.g=rn((o+d)*255),this.b=rn((a+d)*255)}fromHsv({h:t,s:n,v:r,a:i}){this._h=t%360,this._s=n,this._v=r,this.a=typeof i=="number"?i:1;const s=rn(r*255);if(this.r=s,this.g=s,this.b=s,n<=0)return;const o=t/60,a=Math.floor(o),l=o-a,c=rn(r*(1-n)*255),u=rn(r*(1-n*l)*255),d=rn(r*(1-n*(1-l))*255);switch(a){case 0:this.g=d,this.b=c;break;case 1:this.r=u,this.b=c;break;case 2:this.r=c,this.b=d;break;case 3:this.r=c,this.g=u;break;case 4:this.r=d,this.g=c;break;case 5:default:this.g=c,this.b=u;break}}fromHsvString(t){const n=vg(t,mS);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=vg(t,mS);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=vg(t,(r,i)=>i.includes("%")?rn(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}var Dd=2,gS=.16,n8=.05,r8=.05,i8=.15,j5=5,L5=4,s8=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function vS(e,t,n){var r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-Dd*t:Math.round(e.h)+Dd*t:r=n?Math.round(e.h)+Dd*t:Math.round(e.h)-Dd*t,r<0?r+=360:r>=360&&(r-=360),r}function xS(e,t,n){if(e.h===0&&e.s===0)return e.s;var r;return n?r=e.s-gS*t:t===L5?r=e.s+gS:r=e.s+n8*t,r>1&&(r=1),n&&t===j5&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function yS(e,t,n){var r;return n?r=e.v+r8*t:r=e.v-i8*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function dl(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new Et(e),i=r.toHsv(),s=j5;s>0;s-=1){var o=new Et({h:vS(i,s,!0),s:xS(i,s,!0),v:yS(i,s,!0)});n.push(o)}n.push(r);for(var a=1;a<=L5;a+=1){var l=new Et({h:vS(i,a),s:xS(i,a),v:yS(i,a)});n.push(l)}return t.theme==="dark"?s8.map(function(c){var u=c.index,d=c.amount;return new Et(t.backgroundColor||"#141414").mix(n[u],d).toHexString()}):n.map(function(c){return c.toHexString()})}var xg={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},jv=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];jv.primary=jv[5];var Lv=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];Lv.primary=Lv[5];var Dv=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];Dv.primary=Dv[5];var Ov=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];Ov.primary=Ov[5];var Bv=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];Bv.primary=Bv[5];var $v=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];$v.primary=$v[5];var zv=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];zv.primary=zv[5];var Fv=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];Fv.primary=Fv[5];var Hv=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];Hv.primary=Hv[5];var Uv=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];Uv.primary=Uv[5];var Wv=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];Wv.primary=Wv[5];var qv=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];qv.primary=qv[5];var Vv=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];Vv.primary=Vv[5];var yg={red:jv,volcano:Lv,orange:Dv,gold:Ov,yellow:Bv,lime:$v,green:zv,cyan:Fv,blue:Hv,geekblue:Uv,purple:Wv,magenta:qv,grey:Vv};function D5(e,{generateColorPalettes:t,generateNeutralColorPalettes:n}){const{colorSuccess:r,colorWarning:i,colorError:s,colorInfo:o,colorPrimary:a,colorBgBase:l,colorTextBase:c}=e,u=t(a),d=t(r),f=t(i),p=t(s),m=t(o),v=n(l,c),w=e.colorLink||e.colorInfo,x=t(w),_=new Et(p[1]).mix(new Et(p[3]),50).toHexString();return Object.assign(Object.assign({},v),{colorPrimaryBg:u[1],colorPrimaryBgHover:u[2],colorPrimaryBorder:u[3],colorPrimaryBorderHover:u[4],colorPrimaryHover:u[5],colorPrimary:u[6],colorPrimaryActive:u[7],colorPrimaryTextHover:u[8],colorPrimaryText:u[9],colorPrimaryTextActive:u[10],colorSuccessBg:d[1],colorSuccessBgHover:d[2],colorSuccessBorder:d[3],colorSuccessBorderHover:d[4],colorSuccessHover:d[4],colorSuccess:d[6],colorSuccessActive:d[7],colorSuccessTextHover:d[8],colorSuccessText:d[9],colorSuccessTextActive:d[10],colorErrorBg:p[1],colorErrorBgHover:p[2],colorErrorBgFilledHover:_,colorErrorBgActive:p[3],colorErrorBorder:p[3],colorErrorBorderHover:p[4],colorErrorHover:p[5],colorError:p[6],colorErrorActive:p[7],colorErrorTextHover:p[8],colorErrorText:p[9],colorErrorTextActive:p[10],colorWarningBg:f[1],colorWarningBgHover:f[2],colorWarningBorder:f[3],colorWarningBorderHover:f[4],colorWarningHover:f[4],colorWarning:f[6],colorWarningActive:f[7],colorWarningTextHover:f[8],colorWarningText:f[9],colorWarningTextActive:f[10],colorInfoBg:m[1],colorInfoBgHover:m[2],colorInfoBorder:m[3],colorInfoBorderHover:m[4],colorInfoHover:m[4],colorInfo:m[6],colorInfoActive:m[7],colorInfoTextHover:m[8],colorInfoText:m[9],colorInfoTextActive:m[10],colorLinkHover:x[4],colorLink:x[6],colorLinkActive:x[7],colorBgMask:new Et("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const o8=e=>{let t=e,n=e,r=e,i=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?i=4:e>=8&&(i=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:i}};function a8(e){const{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:i}=e;return Object.assign({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:i+1},o8(r))}const l8=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function c8(e){return(e+8)/e}function u8(e){const t=Array.from({length:10}).map((n,r)=>{const i=r-1,s=e*Math.pow(Math.E,i/5),o=r>1?Math.floor(s):Math.ceil(s);return Math.floor(o/2)*2});return t[1]=e,t.map(n=>({size:n,lineHeight:c8(n)}))}const d8=e=>{const t=u8(e),n=t.map(u=>u.size),r=t.map(u=>u.lineHeight),i=n[1],s=n[0],o=n[2],a=r[1],l=r[0],c=r[2];return{fontSizeSM:s,fontSize:i,fontSizeLG:o,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:a,lineHeightLG:c,lineHeightSM:l,fontHeight:Math.round(a*i),fontHeightLG:Math.round(c*o),fontHeightSM:Math.round(l*s),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function h8(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const yr=(e,t)=>new Et(e).setA(t).toRgbString(),lc=(e,t)=>new Et(e).darken(t).toHexString(),f8=e=>{const t=dl(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},p8=(e,t)=>{const n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:yr(r,.88),colorTextSecondary:yr(r,.65),colorTextTertiary:yr(r,.45),colorTextQuaternary:yr(r,.25),colorFill:yr(r,.15),colorFillSecondary:yr(r,.06),colorFillTertiary:yr(r,.04),colorFillQuaternary:yr(r,.02),colorBgSolid:yr(r,1),colorBgSolidHover:yr(r,.75),colorBgSolidActive:yr(r,.95),colorBgLayout:lc(n,4),colorBgContainer:lc(n,0),colorBgElevated:lc(n,0),colorBgSpotlight:yr(r,.85),colorBgBlur:"transparent",colorBorder:lc(n,15),colorBorderSecondary:lc(n,6)}};function Ay(e){xg.pink=xg.magenta,yg.pink=yg.magenta;const t=Object.keys(My).map(n=>{const r=e[n]===xg[n]?yg[n]:dl(e[n]);return Array.from({length:10},()=>1).reduce((i,s,o)=>(i[`${n}-${o+1}`]=r[o],i[`${n}${o+1}`]=r[o],i),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),D5(e,{generateColorPalettes:f8,generateNeutralColorPalettes:p8})),d8(e.fontSize)),h8(e)),l8(e)),a8(e))}const O5=Tv(Ay),Ef={token:vu,override:{override:vu},hashed:!0},B5=Ze.createContext(Ef),Kv="ant",$5="anticon",m8=(e,t)=>t||(e?`${Kv}-${e}`:Kv),Gp=g.createContext({getPrefixCls:m8,iconPrefixCls:$5}),{Consumer:Dde}=Gp,g8=`-ant-${Date.now()}-${Math.random()}`;function v8(e,t){const n={},r=(o,a)=>{let l=o.clone();return l=(a==null?void 0:a(l))||l,l.toRgbString()},i=(o,a)=>{const l=new Et(o),c=dl(l.toRgbString());n[`${a}-color`]=r(l),n[`${a}-color-disabled`]=c[1],n[`${a}-color-hover`]=c[4],n[`${a}-color-active`]=c[6],n[`${a}-color-outline`]=l.clone().setA(.2).toRgbString(),n[`${a}-color-deprecated-bg`]=c[0],n[`${a}-color-deprecated-border`]=c[2]};if(t.primaryColor){i(t.primaryColor,"primary");const o=new Et(t.primaryColor),a=dl(o.toRgbString());a.forEach((c,u)=>{n[`primary-${u+1}`]=c}),n["primary-color-deprecated-l-35"]=r(o,c=>c.lighten(35)),n["primary-color-deprecated-l-20"]=r(o,c=>c.lighten(20)),n["primary-color-deprecated-t-20"]=r(o,c=>c.tint(20)),n["primary-color-deprecated-t-50"]=r(o,c=>c.tint(50)),n["primary-color-deprecated-f-12"]=r(o,c=>c.setA(c.a*.12));const l=new Et(a[0]);n["primary-color-active-deprecated-f-30"]=r(l,c=>c.setA(c.a*.3)),n["primary-color-active-deprecated-d-02"]=r(l,c=>c.darken(2))}return t.successColor&&i(t.successColor,"success"),t.warningColor&&i(t.warningColor,"warning"),t.errorColor&&i(t.errorColor,"error"),t.infoColor&&i(t.infoColor,"info"),`
|
|
59
59
|
:root {
|
|
60
60
|
${Object.keys(n).map(o=>`--${e}-${o}: ${n[o]};`).join(`
|
|
61
61
|
`)}
|
|
@@ -92,8 +92,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
92
92
|
0 -6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
93
93
|
0 -3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
94
94
|
0 -9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
95
|
-
`,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var _S=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const E8={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},I8={motionBase:!0,motionUnit:!0},N8={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},F5=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=_S(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=z5(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=_S(l,["theme"]);let d=u;c&&(d=F5(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function H5(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Je.useContext(B5),s=`${k8}-${t||""}`,o=n||O5,[a,l,c]=p6(o,[vu,e],{salt:s,override:r,getComputedToken:F5,formatToken:z5,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:E8,ignore:I8,preserve:N8}});return[o,c,t?l:"",a,i]}const T8=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),P8=e=>({[`.${e}`]:Object.assign(Object.assign({},T8()),{[`.${e} .${e}-icon`]:{display:"block"}})}),R8=(e,t)=>{const[n,r]=H5();return H6({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>P8(e))},M8=Object.assign({},Tl),{useId:bS}=M8,A8=()=>"",j8=typeof bS>"u"?A8:bS;function L8(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},Ef),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:Ef.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=j8();return o5(()=>{var a,l;if(!e)return t;const c=Object.assign({},s.components);Object.keys(e.components||{}).forEach(f=>{c[f]=Object.assign(Object.assign({},c[f]),e.components[f])});const u=`css-var-${o.replace(/:/g,"")}`,d=((a=i.cssVar)!==null&&a!==void 0?a:s.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof s.cssVar=="object"?s.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((l=i.cssVar)===null||l===void 0?void 0:l.key)||u});return Object.assign(Object.assign(Object.assign({},s),i),{token:Object.assign(Object.assign({},s.token),i.token),components:c,cssVar:d})},[i,s],(a,l)=>a.some((c,u)=>{const d=l[u];return!HO(c,d,!0)}))}var D8=["children"],U5=g.createContext({});function O8(e){var t=e.children,n=Iv(e,D8);return g.createElement(U5.Provider,{value:n},t)}var B8=function(e){l5(n,e);var t=u5(n);function n(){return Ml(this,n),t.apply(this,arguments)}return Al(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function $8(e){var t=g.useReducer(function(a){return a+1},0),n=ot(t,2),r=n[1],i=g.useRef(e),s=Yv(function(){return i.current}),o=Yv(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var bs="none",Bd="appear",$d="enter",zd="leave",wS="none",Hr="prepare",Oa="start",Ba="active",jy="end",W5="prepared";function SS(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}function z8(e,t){var n={animationend:SS("Animation","AnimationEnd"),transitionend:SS("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var F8=z8(os(),typeof window<"u"?window:{}),q5={};if(os()){var H8=document.createElement("div");q5=H8.style}var Fd={};function V5(e){if(Fd[e])return Fd[e];var t=F8[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var s=n[i];if(Object.prototype.hasOwnProperty.call(t,s)&&s in q5)return Fd[e]=t[s],Fd[e]}return""}var K5=V5("animationend"),G5=V5("transitionend"),Y5=!!(K5&&G5),kS=K5||"animationend",CS=G5||"transitionend";function ES(e,t){if(!e)return null;if(Rt(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const U8=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(CS,e),i.removeEventListener(kS,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(CS,e),i.addEventListener(kS,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var X5=os()?g.useLayoutEffect:g.useEffect;const W8=function(){var e=g.useRef(null);function t(){Cv.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=Cv(function(){i<=1?r({isCanceled:function(){return s!==e.current}}):n(r,i-1)});e.current=s}return g.useEffect(function(){return function(){t()}},[]),[n,t]};var q8=[Hr,Oa,Ba,jy],V8=[Hr,W5],Z5=!1,K8=!0;function Q5(e){return e===Ba||e===jy}const G8=function(e,t,n){var r=Xv(wS),i=ot(r,2),s=i[0],o=i[1],a=W8(),l=ot(a,2),c=l[0],u=l[1];function d(){o(Hr,!0)}var f=t?V8:q8;return X5(function(){if(s!==wS&&s!==jy){var p=f.indexOf(s),m=f[p+1],v=n(s);v===Z5?o(m,!0):m&&c(function(w){function x(){w.isCanceled()||o(m,!0)}v===!0?x():Promise.resolve(v).then(x)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function Y8(e,t,n,r){var i=r.motionEnter,s=i===void 0?!0:i,o=r.motionAppear,a=o===void 0?!0:o,l=r.motionLeave,c=l===void 0?!0:l,u=r.motionDeadline,d=r.motionLeaveImmediately,f=r.onAppearPrepare,p=r.onEnterPrepare,m=r.onLeavePrepare,v=r.onAppearStart,w=r.onEnterStart,x=r.onLeaveStart,_=r.onAppearActive,b=r.onEnterActive,S=r.onLeaveActive,C=r.onAppearEnd,k=r.onEnterEnd,T=r.onLeaveEnd,E=r.onVisibleChanged,D=Xv(),N=ot(D,2),L=N[0],R=N[1],M=$8(bs),A=ot(M,2),j=A[0],z=A[1],F=Xv(null),$=ot(F,2),B=$[0],I=$[1],U=j(),q=g.useRef(!1),O=g.useRef(null);function te(){return n()}var le=g.useRef(!1);function Y(){z(bs),I(null,!0)}var re=Yv(function(Pe){var Me=j();if(Me!==bs){var rt=te();if(!(Pe&&!Pe.deadline&&Pe.target!==rt)){var tn=le.current,hn;Me===Bd&&tn?hn=C==null?void 0:C(rt,Pe):Me===$d&&tn?hn=k==null?void 0:k(rt,Pe):Me===zd&&tn&&(hn=T==null?void 0:T(rt,Pe)),tn&&hn!==!1&&Y()}}}),ke=U8(re),oe=ot(ke,1),Ie=oe[0],Ee=function(Me){switch(Me){case Bd:return Te(Te(Te({},Hr,f),Oa,v),Ba,_);case $d:return Te(Te(Te({},Hr,p),Oa,w),Ba,b);case zd:return Te(Te(Te({},Hr,m),Oa,x),Ba,S);default:return{}}},Re=g.useMemo(function(){return Ee(U)},[U]),he=G8(U,!e,function(Pe){if(Pe===Hr){var Me=Re[Hr];return Me?Me(te()):Z5}if(Ge in Re){var rt;I(((rt=Re[Ge])===null||rt===void 0?void 0:rt.call(Re,te(),null))||null)}return Ge===Ba&&U!==bs&&(Ie(te()),u>0&&(clearTimeout(O.current),O.current=setTimeout(function(){re({deadline:!0})},u))),Ge===W5&&Y(),K8}),Be=ot(he,2),Qe=Be[0],Ge=Be[1],ft=Q5(Ge);le.current=ft;var Kt=g.useRef(null);X5(function(){if(!(q.current&&Kt.current===t)){R(t);var Pe=q.current;q.current=!0;var Me;!Pe&&t&&a&&(Me=Bd),Pe&&t&&s&&(Me=$d),(Pe&&!t&&c||!Pe&&d&&!t&&c)&&(Me=zd);var rt=Ee(Me);Me&&(e||rt[Hr])?(z(Me),Qe()):z(bs),Kt.current=t}},[t]),g.useEffect(function(){(U===Bd&&!a||U===$d&&!s||U===zd&&!c)&&z(bs)},[a,s,c]),g.useEffect(function(){return function(){q.current=!1,clearTimeout(O.current)}},[]);var fe=g.useRef(!1);g.useEffect(function(){L&&(fe.current=!0),L!==void 0&&U===bs&&((fe.current||L)&&(E==null||E(L)),fe.current=!0)},[L,U]);var He=B;return Re[Hr]&&Ge===Oa&&(He=Ke({transition:"none"},He)),[U,Ge,He,L??t]}function X8(e){var t=e;Rt(e)==="object"&&(t=e.transitionSupport);function n(i,s){return!!(i.motionName&&t&&s!==!1)}var r=g.forwardRef(function(i,s){var o=i.visible,a=o===void 0?!0:o,l=i.removeOnLeave,c=l===void 0?!0:l,u=i.forceRender,d=i.children,f=i.motionName,p=i.leavedClassName,m=i.eventProps,v=g.useContext(U5),w=v.motion,x=n(i,w),_=g.useRef(),b=g.useRef();function S(){try{return _.current instanceof HTMLElement?_.current:CO(b.current)}catch{return null}}var C=Y8(x,a,S,i),k=ot(C,4),T=k[0],E=k[1],D=k[2],N=k[3],L=g.useRef(N);N&&(L.current=!0);var R=g.useCallback(function($){_.current=$,TO(s,$)},[s]),M,A=Ke(Ke({},m),{},{visible:a});if(!d)M=null;else if(T===bs)N?M=d(Ke({},A),R):!c&&L.current&&p?M=d(Ke(Ke({},A),{},{className:p}),R):u||!c&&!p?M=d(Ke(Ke({},A),{},{style:{display:"none"}}),R):M=null;else{var j;E===Hr?j="prepare":Q5(E)?j="active":E===Oa&&(j="start");var z=ES(f,"".concat(T,"-").concat(j));M=d(Ke(Ke({},A),{},{className:fO(ES(f,T),Te(Te({},z,z&&j),f,typeof f=="string")),style:D}),R)}if(g.isValidElement(M)&&PO(M)){var F=RO(M);F||(M=g.cloneElement(M,{ref:R}))}return g.createElement(B8,{ref:b},M)});return r.displayName="CSSMotion",r}const Z8=X8(Y5);var Zv="add",Qv="keep",Jv="remove",bg="removed";function Q8(e){var t;return e&&Rt(e)==="object"&&"key"in e?t=e:t={key:e},Ke(Ke({},t),{},{key:String(t.key)})}function ex(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(Q8)}function J8(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=t.length,s=ex(e),o=ex(t);s.forEach(function(c){for(var u=!1,d=r;d<i;d+=1){var f=o[d];if(f.key===c.key){r<d&&(n=n.concat(o.slice(r,d).map(function(p){return Ke(Ke({},p),{},{status:Zv})})),r=d),n.push(Ke(Ke({},f),{},{status:Qv})),r+=1,u=!0;break}}u||n.push(Ke(Ke({},c),{},{status:Jv}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return Ke(Ke({},c),{},{status:Zv})})));var a={};n.forEach(function(c){var u=c.key;a[u]=(a[u]||0)+1});var l=Object.keys(a).filter(function(c){return a[c]>1});return l.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==Jv}),n.forEach(function(u){u.key===c&&(u.status=Qv)})}),n}var eB=["component","children","onVisibleChanged","onAllRemoved"],tB=["status"],nB=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function rB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Z8,n=function(r){l5(s,r);var i=u5(s);function s(){var o;Ml(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=i.call.apply(i,[this].concat(l)),Te(Sv(o),"state",{keyEntities:[]}),Te(Sv(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:Ke(Ke({},p),{},{status:bg})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==bg}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return Al(s,[{key:"render",value:function(){var a=this,l=this.state.keyEntities,c=this.props,u=c.component,d=c.children,f=c.onVisibleChanged;c.onAllRemoved;var p=Iv(c,eB),m=u||g.Fragment,v={};return nB.forEach(function(w){v[w]=p[w],delete p[w]}),delete p.keys,g.createElement(m,p,l.map(function(w,x){var _=w.status,b=Iv(w,tB),S=_===Zv||_===Qv;return g.createElement(t,Sf({},v,{key:b.key,visible:S,eventProps:b,onVisibleChanged:function(k){f==null||f(k,{key:b.key}),k||a.removeKey(b.key)}}),function(C,k){return d(Ke(Ke({},C),{},{index:x}),k)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=ex(c),f=J8(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(v){var w=v.key;return p.key===w});return!(m&&m.status===bg&&p.status===Jv)})}}}]),s}(g.Component);return Te(n,"defaultProps",{component:"div"}),n}rB(Y5);const IS=g.createContext(!0);function iB(e){const t=g.useContext(IS),{children:n}=e,[,r]=H5(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(IS.Provider,{value:i},g.createElement(O8,{motion:i},n)):n}const sB=()=>null;var oB=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const aB=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let J5;function lB(){return J5||Kv}function cB(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const uB=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(J5=t),r&&cB(r)&&x8(lB(),r)},dB=e=>{const{children:t,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:s,form:o,locale:a,componentSize:l,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:v,legacyLocale:w,parentContext:x,iconPrefixCls:_,theme:b,componentDisabled:S,segmented:C,statistic:k,spin:T,calendar:E,carousel:D,cascader:N,collapse:L,typography:R,checkbox:M,descriptions:A,divider:j,drawer:z,skeleton:F,steps:$,image:B,layout:I,list:U,mentions:q,modal:O,progress:te,result:le,slider:Y,breadcrumb:re,menu:ke,pagination:oe,input:Ie,textArea:Ee,empty:Re,badge:he,radio:Be,rate:Qe,switch:Ge,transfer:ft,avatar:Kt,message:fe,tag:He,table:Pe,card:Me,tabs:rt,timeline:tn,timePicker:hn,upload:W,notification:ee,tree:be,colorPicker:Oe,datePicker:Ue,rangePicker:At,flex:bn,wave:nn,dropdown:fn,warning:ce,tour:Se,tooltip:st,popover:gt,popconfirm:gr,floatButton:ae,floatButtonGroup:it,variant:Bt,inputNumber:ti,treeSelect:oa}=e,aa=g.useCallback((jt,$t)=>{const{prefixCls:Wn}=e;if($t)return $t;const vr=Wn||x.getPrefixCls("");return jt?`${vr}-${jt}`:vr},[x.getPrefixCls,e.prefixCls]),hs=_||x.iconPrefixCls||$5,la=n||x.csp;R8(hs,la);const Yl=L8(b,x.theme,{prefixCls:aa("")}),Xl={csp:la,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||w,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:v,getPrefixCls:aa,iconPrefixCls:hs,theme:Yl,segmented:C,statistic:k,spin:T,calendar:E,carousel:D,cascader:N,collapse:L,typography:R,checkbox:M,descriptions:A,divider:j,drawer:z,skeleton:F,steps:$,image:B,input:Ie,textArea:Ee,layout:I,list:U,mentions:q,modal:O,progress:te,result:le,slider:Y,breadcrumb:re,menu:ke,pagination:oe,empty:Re,badge:he,radio:Be,rate:Qe,switch:Ge,transfer:ft,avatar:Kt,message:fe,tag:He,table:Pe,card:Me,tabs:rt,timeline:tn,timePicker:hn,upload:W,notification:ee,tree:be,colorPicker:Oe,datePicker:Ue,rangePicker:At,flex:bn,wave:nn,dropdown:fn,warning:ce,tour:Se,tooltip:st,popover:gt,popconfirm:gr,floatButton:ae,floatButtonGroup:it,variant:Bt,inputNumber:ti,treeSelect:oa},fs=Object.assign({},x);Object.keys(Xl).forEach(jt=>{Xl[jt]!==void 0&&(fs[jt]=Xl[jt])}),aB.forEach(jt=>{const $t=e[jt];$t&&(fs[jt]=$t)}),typeof r<"u"&&(fs.button=Object.assign({autoInsertSpace:r},fs.button));const ni=o5(()=>fs,fs,(jt,$t)=>{const Wn=Object.keys(jt),vr=Object.keys($t);return Wn.length!==vr.length||Wn.some(Mi=>jt[Mi]!==$t[Mi])}),{layer:pd}=g.useContext(Wp),ca=g.useMemo(()=>({prefixCls:hs,csp:la,layer:pd?"antd":void 0}),[hs,la,pd]);let Gt=g.createElement(g.Fragment,null,g.createElement(sB,{dropdownMatchSelectWidth:p}),t);const Zl=g.useMemo(()=>{var jt,$t,Wn,vr;return X6(((jt=Kp.Form)===null||jt===void 0?void 0:jt.defaultValidateMessages)||{},((Wn=($t=ni.locale)===null||$t===void 0?void 0:$t.Form)===null||Wn===void 0?void 0:Wn.defaultValidateMessages)||{},((vr=ni.form)===null||vr===void 0?void 0:vr.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[ni,o==null?void 0:o.validateMessages]);Object.keys(Zl).length>0&&(Gt=g.createElement(Q6.Provider,{value:Zl},Gt)),a&&(Gt=g.createElement(t8,{locale:a,_ANT_MARK__:e8},Gt)),Gt=g.createElement(V6.Provider,{value:ca},Gt),l&&(Gt=g.createElement(_8,{size:l},Gt)),Gt=g.createElement(iB,null,Gt);const md=g.useMemo(()=>{const jt=Yl||{},{algorithm:$t,token:Wn,components:vr,cssVar:Mi}=jt,Bm=oB(jt,["algorithm","token","components","cssVar"]),gd=$t&&(!Array.isArray($t)||$t.length>0)?Tv($t):O5,lo={};Object.entries(vr||{}).forEach(([$m,vd])=>{const xr=Object.assign({},vd);"algorithm"in xr&&(xr.algorithm===!0?xr.theme=gd:(Array.isArray(xr.algorithm)||typeof xr.algorithm=="function")&&(xr.theme=Tv(xr.algorithm)),delete xr.algorithm),lo[$m]=xr});const co=Object.assign(Object.assign({},vu),Wn);return Object.assign(Object.assign({},Bm),{theme:gd,token:co,components:lo,override:Object.assign({override:co},lo),cssVar:Mi})},[Yl]);return b&&(Gt=g.createElement(B5.Provider,{value:md},Gt)),ni.warning&&(Gt=g.createElement(Z6.Provider,{value:ni.warning},Gt)),S!==void 0&&(Gt=g.createElement(y8,{disabled:S},Gt)),g.createElement(Gp.Provider,{value:ni},Gt)},Ll=e=>{const t=g.useContext(Gp),n=g.useContext(A5);return g.createElement(dB,Object.assign({parentContext:t,legacyLocale:n},e))};Ll.ConfigContext=Gp;Ll.SizeContext=xu;Ll.config=uB;Ll.useConfig=b8;Object.defineProperty(Ll,"SizeContext",{get:()=>xu});const _r=(e,t)=>new Et(e).setA(t).toRgbString(),ha=(e,t)=>new Et(e).lighten(t).toHexString(),hB=e=>{const t=dl(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},fB=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:_r(r,.85),colorTextSecondary:_r(r,.65),colorTextTertiary:_r(r,.45),colorTextQuaternary:_r(r,.25),colorFill:_r(r,.18),colorFillSecondary:_r(r,.12),colorFillTertiary:_r(r,.08),colorFillQuaternary:_r(r,.04),colorBgSolid:_r(r,.95),colorBgSolidHover:_r(r,1),colorBgSolidActive:_r(r,.9),colorBgElevated:ha(n,12),colorBgContainer:ha(n,8),colorBgLayout:ha(n,0),colorBgSpotlight:ha(n,26),colorBgBlur:_r(r,.04),colorBorder:ha(n,26),colorBorderSecondary:ha(n,19)}},pB=(e,t)=>{const n=Object.keys(My).map(s=>{const o=dl(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??Ay(e),i=D5(e,{generateColorPalettes:hB,generateNeutralColorPalettes:fB});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},NS={defaultSeed:Ef.token,defaultAlgorithm:Ay,darkAlgorithm:pB};function TS({children:e}){const t=ky(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(Ll,{theme:{algorithm:n.mode==="dark"?NS.darkAlgorithm:NS.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var tt;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(tt||(tt={}));var PS;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(PS||(PS={}));const ge=tt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cs=e=>{switch(typeof e){case"undefined":return ge.undefined;case"string":return ge.string;case"number":return Number.isNaN(e)?ge.nan:ge.number;case"boolean":return ge.boolean;case"function":return ge.function;case"bigint":return ge.bigint;case"symbol":return ge.symbol;case"object":return Array.isArray(e)?ge.array:e===null?ge.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ge.promise:typeof Map<"u"&&e instanceof Map?ge.map:typeof Set<"u"&&e instanceof Set?ge.set:typeof Date<"u"&&e instanceof Date?ge.date:ge.object;default:return ge.unknown}},X=tt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ji extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(t){if(!(t instanceof Ji))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,tt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ji.create=e=>new Ji(e);const tx=(e,t)=>{let n;switch(e.code){case X.invalid_type:e.received===ge.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,tt.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${tt.joinValues(e.keys,", ")}`;break;case X.invalid_union:n="Invalid input";break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tt.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${tt.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n="Invalid function arguments";break;case X.invalid_return_type:n="Invalid function return type";break;case X.invalid_date:n="Invalid date";break;case X.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:tt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case X.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case X.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case X.custom:n="Invalid input";break;case X.invalid_intersection_types:n="Intersection results could not be merged";break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n="Number must be finite";break;default:n=t.defaultError,tt.assertNever(e)}return{message:n}};let mB=tx;function gB(){return mB}const vB=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function ue(e,t){const n=gB(),r=vB({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===tx?void 0:tx].filter(i=>!!i)});e.common.issues.push(r)}class Bn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return je;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return Bn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return je;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const je=Object.freeze({status:"aborted"}),Sc=e=>({status:"dirty",value:e}),Lr=e=>({status:"valid",value:e}),RS=e=>e.status==="aborted",MS=e=>e.status==="dirty",hl=e=>e.status==="valid",If=e=>typeof Promise<"u"&&e instanceof Promise;var _e;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(_e||(_e={}));class ki{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const AS=(e,t)=>{if(hl(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ji(e.common.issues);return this._error=n,this._error}}};function Fe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class Ze{get description(){return this._def.description}_getType(t){return Cs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Bn,ctx:{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(If(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},i=this._parseSync({data:t,path:r.path,parent:r});return AS(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return hl(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>hl(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(If(i)?i:Promise.resolve(i));return AS(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:X.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Gs({schema:this,typeName:Le.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ki.create(this,this._def)}nullable(){return $o.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _i.create(this)}promise(){return Af.create(this,this._def)}or(t){return Tf.create([this,t],this._def)}and(t){return Pf.create(this,t,this._def)}transform(t){return new Gs({...Fe(this._def),schema:this,typeName:Le.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new jf({...Fe(this._def),innerType:this,defaultValue:n,typeName:Le.ZodDefault})}brand(){return new rT({typeName:Le.ZodBranded,type:this,...Fe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Lf({...Fe(this._def),innerType:this,catchValue:n,typeName:Le.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Dy.create(this,t)}readonly(){return Df.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xB=/^c[^\s-]{8,}$/i,yB=/^[0-9a-z]+$/,_B=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bB=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,wB=/^[a-z0-9_-]{21}$/i,SB=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,kB=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,CB=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,EB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let wg;const IB=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,NB=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TB=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,PB=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,RB=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,MB=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,eT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",AB=new RegExp(`^${eT}$`);function tT(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function jB(e){return new RegExp(`^${tT(e)}$`)}function LB(e){let t=`${eT}T${tT(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function DB(e,t){return!!((t==="v4"||!t)&&IB.test(e)||(t==="v6"||!t)&&TB.test(e))}function OB(e,t){if(!SB.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function BB(e,t){return!!((t==="v4"||!t)&&NB.test(e)||(t==="v6"||!t)&&PB.test(e))}class Fi extends Ze{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ge.string){const s=this._getOrReturnCtx(t);return ue(s,{code:X.invalid_type,expected:ge.string,received:s.parsedType}),je}const r=new Bn;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?ue(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&ue(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")CB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"email",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")wg||(wg=new RegExp(EB,"u")),wg.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"emoji",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")bB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"uuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")wB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"nanoid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")xB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"cuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")yB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"cuid2",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")_B.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"ulid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),ue(i,{validation:"url",code:X.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"regex",code:X.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?LB(s).test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?AB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?jB(s).test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?kB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"duration",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?DB(t.data,s.version)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"ip",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?OB(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"jwt",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?BB(t.data,s.version)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"cidr",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?RB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"base64",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?MB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"base64url",code:X.invalid_string,message:s.message}),r.dirty()):tt.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:X.invalid_string,..._e.errToObj(r)})}_addCheck(t){return new Fi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",..._e.errToObj(t)})}url(t){return this._addCheck({kind:"url",..._e.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",..._e.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",..._e.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",..._e.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",..._e.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",..._e.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",..._e.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",..._e.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",..._e.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",..._e.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",..._e.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",..._e.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,..._e.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,..._e.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",..._e.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,..._e.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,..._e.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,..._e.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,..._e.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,..._e.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,..._e.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,..._e.errToObj(n)})}nonempty(t){return this.min(1,_e.errToObj(t))}trim(){return new Fi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Fi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Fi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Fi.create=e=>new Fi({checks:[],typeName:Le.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Fe(e)});function $B(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class fl extends Ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ge.number){const s=this._getOrReturnCtx(t);return ue(s,{code:X.invalid_type,expected:ge.number,received:s.parsedType}),je}let r;const i=new Bn;for(const s of this._def.checks)s.kind==="int"?tt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ue(r,{code:X.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?$B(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ue(r,{code:X.not_finite,message:s.message}),i.dirty()):tt.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,_e.toString(n))}gt(t,n){return this.setLimit("min",t,!1,_e.toString(n))}lte(t,n){return this.setLimit("max",t,!0,_e.toString(n))}lt(t,n){return this.setLimit("max",t,!1,_e.toString(n))}setLimit(t,n,r,i){return new fl({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:_e.toString(i)}]})}_addCheck(t){return new fl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:_e.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_e.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_e.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_e.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_e.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:_e.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:_e.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_e.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_e.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&tt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}fl.create=e=>new fl({checks:[],typeName:Le.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class yu extends Ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ge.bigint)return this._getInvalidInput(t);let r;const i=new Bn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):tt.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return ue(n,{code:X.invalid_type,expected:ge.bigint,received:n.parsedType}),je}gte(t,n){return this.setLimit("min",t,!0,_e.toString(n))}gt(t,n){return this.setLimit("min",t,!1,_e.toString(n))}lte(t,n){return this.setLimit("max",t,!0,_e.toString(n))}lt(t,n){return this.setLimit("max",t,!1,_e.toString(n))}setLimit(t,n,r,i){return new yu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:_e.toString(i)}]})}_addCheck(t){return new yu({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_e.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_e.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_e.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_e.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:_e.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}yu.create=e=>new yu({checks:[],typeName:Le.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Fe(e)});class nx extends Ze{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ge.boolean){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.boolean,received:r.parsedType}),je}return Lr(t.data)}}nx.create=e=>new nx({typeName:Le.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class Nf extends Ze{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ge.date){const s=this._getOrReturnCtx(t);return ue(s,{code:X.invalid_type,expected:ge.date,received:s.parsedType}),je}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return ue(s,{code:X.invalid_date}),je}const r=new Bn;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code:X.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code:X.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):tt.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Nf({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:_e.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:_e.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Nf.create=e=>new Nf({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Le.ZodDate,...Fe(e)});class jS extends Ze{_parse(t){if(this._getType(t)!==ge.symbol){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.symbol,received:r.parsedType}),je}return Lr(t.data)}}jS.create=e=>new jS({typeName:Le.ZodSymbol,...Fe(e)});class rx extends Ze{_parse(t){if(this._getType(t)!==ge.undefined){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.undefined,received:r.parsedType}),je}return Lr(t.data)}}rx.create=e=>new rx({typeName:Le.ZodUndefined,...Fe(e)});class ix extends Ze{_parse(t){if(this._getType(t)!==ge.null){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.null,received:r.parsedType}),je}return Lr(t.data)}}ix.create=e=>new ix({typeName:Le.ZodNull,...Fe(e)});class LS extends Ze{constructor(){super(...arguments),this._any=!0}_parse(t){return Lr(t.data)}}LS.create=e=>new LS({typeName:Le.ZodAny,...Fe(e)});class sx extends Ze{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Lr(t.data)}}sx.create=e=>new sx({typeName:Le.ZodUnknown,...Fe(e)});class Ks extends Ze{_parse(t){const n=this._getOrReturnCtx(t);return ue(n,{code:X.invalid_type,expected:ge.never,received:n.parsedType}),je}}Ks.create=e=>new Ks({typeName:Le.ZodNever,...Fe(e)});class DS extends Ze{_parse(t){if(this._getType(t)!==ge.undefined){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.void,received:r.parsedType}),je}return Lr(t.data)}}DS.create=e=>new DS({typeName:Le.ZodVoid,...Fe(e)});class _i extends Ze{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==ge.array)return ue(n,{code:X.invalid_type,expected:ge.array,received:n.parsedType}),je;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(ue(n,{code:o?X.too_big:X.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(ue(n,{code:X.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(ue(n,{code:X.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new ki(n,o,n.path,a)))).then(o=>Bn.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new ki(n,o,n.path,a)));return Bn.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new _i({...this._def,minLength:{value:t,message:_e.toString(n)}})}max(t,n){return new _i({...this._def,maxLength:{value:t,message:_e.toString(n)}})}length(t,n){return new _i({...this._def,exactLength:{value:t,message:_e.toString(n)}})}nonempty(t){return this.min(1,t)}}_i.create=(e,t)=>new _i({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Le.ZodArray,...Fe(t)});function wa(e){if(e instanceof Ht){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ki.create(wa(r))}return new Ht({...e._def,shape:()=>t})}else return e instanceof _i?new _i({...e._def,type:wa(e.element)}):e instanceof Ki?Ki.create(wa(e.unwrap())):e instanceof $o?$o.create(wa(e.unwrap())):e instanceof Oo?Oo.create(e.items.map(t=>wa(t))):e}class Ht extends Ze{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=tt.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ge.object){const c=this._getOrReturnCtx(t);return ue(c,{code:X.invalid_type,expected:ge.object,received:c.parsedType}),je}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ks&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new ki(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ks){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(ue(i,{code:X.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new ki(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Bn.mergeObjectSync(r,c)):Bn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return _e.errToObj,new Ht({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:_e.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new Ht({...this._def,unknownKeys:"strip"})}passthrough(){return new Ht({...this._def,unknownKeys:"passthrough"})}extend(t){return new Ht({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Ht({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Le.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Ht({...this._def,catchall:t})}pick(t){const n={};for(const r of tt.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Ht({...this._def,shape:()=>n})}omit(t){const n={};for(const r of tt.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Ht({...this._def,shape:()=>n})}deepPartial(){return wa(this)}partial(t){const n={};for(const r of tt.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new Ht({...this._def,shape:()=>n})}required(t){const n={};for(const r of tt.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ki;)s=s._def.innerType;n[r]=s}return new Ht({...this._def,shape:()=>n})}keyof(){return nT(tt.objectKeys(this.shape))}}Ht.create=(e,t)=>new Ht({shape:()=>e,unknownKeys:"strip",catchall:Ks.create(),typeName:Le.ZodObject,...Fe(t)});Ht.strictCreate=(e,t)=>new Ht({shape:()=>e,unknownKeys:"strict",catchall:Ks.create(),typeName:Le.ZodObject,...Fe(t)});Ht.lazycreate=(e,t)=>new Ht({shape:e,unknownKeys:"strip",catchall:Ks.create(),typeName:Le.ZodObject,...Fe(t)});class Tf extends Ze{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Ji(a.ctx.common.issues));return ue(n,{code:X.invalid_union,unionErrors:o}),je}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new Ji(l));return ue(n,{code:X.invalid_union,unionErrors:a}),je}}get options(){return this._def.options}}Tf.create=(e,t)=>new Tf({options:e,typeName:Le.ZodUnion,...Fe(t)});const Di=e=>e instanceof ax?Di(e.schema):e instanceof Gs?Di(e.innerType()):e instanceof Mf?[e.value]:e instanceof Bo?e.options:e instanceof lx?tt.objectValues(e.enum):e instanceof jf?Di(e._def.innerType):e instanceof rx?[void 0]:e instanceof ix?[null]:e instanceof Ki?[void 0,...Di(e.unwrap())]:e instanceof $o?[null,...Di(e.unwrap())]:e instanceof rT||e instanceof Df?Di(e.unwrap()):e instanceof Lf?Di(e._def.innerType):[];class Ly extends Ze{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ge.object)return ue(n,{code:X.invalid_type,expected:ge.object,received:n.parsedType}),je;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(ue(n,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),je)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const o=Di(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new Ly({typeName:Le.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Fe(r)})}}function ox(e,t){const n=Cs(e),r=Cs(t);if(e===t)return{valid:!0,data:e};if(n===ge.object&&r===ge.object){const i=tt.objectKeys(t),s=tt.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=ox(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===ge.array&&r===ge.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=ox(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===ge.date&&r===ge.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Pf extends Ze{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(RS(s)||RS(o))return je;const a=ox(s.value,o.value);return a.valid?((MS(s)||MS(o))&&n.dirty(),{status:n.value,value:a.data}):(ue(r,{code:X.invalid_intersection_types}),je)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Pf.create=(e,t,n)=>new Pf({left:e,right:t,typeName:Le.ZodIntersection,...Fe(n)});class Oo extends Ze{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ge.array)return ue(r,{code:X.invalid_type,expected:ge.array,received:r.parsedType}),je;if(r.data.length<this._def.items.length)return ue(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&r.data.length>this._def.items.length&&(ue(r,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new ki(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>Bn.mergeArray(n,o)):Bn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Oo({...this._def,rest:t})}}Oo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Oo({items:e,typeName:Le.ZodTuple,rest:null,...Fe(t)})};class Rf extends Ze{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ge.object)return ue(r,{code:X.invalid_type,expected:ge.object,received:r.parsedType}),je;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new ki(r,a,r.path,a)),value:o._parse(new ki(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Bn.mergeObjectAsync(n,i):Bn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ze?new Rf({keyType:t,valueType:n,typeName:Le.ZodRecord,...Fe(r)}):new Rf({keyType:Fi.create(),valueType:t,typeName:Le.ZodRecord,...Fe(n)})}}class OS extends Ze{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ge.map)return ue(r,{code:X.invalid_type,expected:ge.map,received:r.parsedType}),je;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new ki(r,a,r.path,[c,"key"])),value:s._parse(new ki(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return je;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return je;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}OS.create=(e,t,n)=>new OS({valueType:t,keyType:e,typeName:Le.ZodMap,...Fe(n)});class _u extends Ze{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ge.set)return ue(r,{code:X.invalid_type,expected:ge.set,received:r.parsedType}),je;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(ue(r,{code:X.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(ue(r,{code:X.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return je;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new ki(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new _u({...this._def,minSize:{value:t,message:_e.toString(n)}})}max(t,n){return new _u({...this._def,maxSize:{value:t,message:_e.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}_u.create=(e,t)=>new _u({valueType:e,minSize:null,maxSize:null,typeName:Le.ZodSet,...Fe(t)});class ax extends Ze{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ax.create=(e,t)=>new ax({getter:e,typeName:Le.ZodLazy,...Fe(t)});class Mf extends Ze{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ue(n,{received:n.data,code:X.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:t.data}}get value(){return this._def.value}}Mf.create=(e,t)=>new Mf({value:e,typeName:Le.ZodLiteral,...Fe(t)});function nT(e,t){return new Bo({values:e,typeName:Le.ZodEnum,...Fe(t)})}class Bo extends Ze{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ue(n,{expected:tt.joinValues(r),received:n.parsedType,code:X.invalid_type}),je}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ue(n,{received:n.data,code:X.invalid_enum_value,options:r}),je}return Lr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Bo.create(t,{...this._def,...n})}exclude(t,n=this._def){return Bo.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Bo.create=nT;class lx extends Ze{_parse(t){const n=tt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ge.string&&r.parsedType!==ge.number){const i=tt.objectValues(n);return ue(r,{expected:tt.joinValues(i),received:r.parsedType,code:X.invalid_type}),je}if(this._cache||(this._cache=new Set(tt.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=tt.objectValues(n);return ue(r,{received:r.data,code:X.invalid_enum_value,options:i}),je}return Lr(t.data)}get enum(){return this._def.values}}lx.create=(e,t)=>new lx({values:e,typeName:Le.ZodNativeEnum,...Fe(t)});class Af extends Ze{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ge.promise&&n.common.async===!1)return ue(n,{code:X.invalid_type,expected:ge.promise,received:n.parsedType}),je;const r=n.parsedType===ge.promise?n.data:Promise.resolve(n.data);return Lr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Af.create=(e,t)=>new Af({type:e,typeName:Le.ZodPromise,...Fe(t)});class Gs extends Ze{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{ue(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return je;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?je:l.status==="dirty"||n.value==="dirty"?Sc(l.value):l});{if(n.value==="aborted")return je;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?je:a.status==="dirty"||n.value==="dirty"?Sc(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?je:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?je:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!hl(o))return je;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>hl(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):je);tt.assertNever(i)}}Gs.create=(e,t,n)=>new Gs({schema:e,typeName:Le.ZodEffects,effect:t,...Fe(n)});Gs.createWithPreprocess=(e,t,n)=>new Gs({schema:t,effect:{type:"preprocess",transform:e},typeName:Le.ZodEffects,...Fe(n)});class Ki extends Ze{_parse(t){return this._getType(t)===ge.undefined?Lr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ki.create=(e,t)=>new Ki({innerType:e,typeName:Le.ZodOptional,...Fe(t)});class $o extends Ze{_parse(t){return this._getType(t)===ge.null?Lr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}$o.create=(e,t)=>new $o({innerType:e,typeName:Le.ZodNullable,...Fe(t)});class jf extends Ze{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ge.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}jf.create=(e,t)=>new jf({innerType:e,typeName:Le.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Fe(t)});class Lf extends Ze{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return If(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ji(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ji(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Lf.create=(e,t)=>new Lf({innerType:e,typeName:Le.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Fe(t)});class BS extends Ze{_parse(t){if(this._getType(t)!==ge.nan){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.nan,received:r.parsedType}),je}return{status:"valid",value:t.data}}}BS.create=e=>new BS({typeName:Le.ZodNaN,...Fe(e)});class rT extends Ze{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Dy extends Ze{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?je:s.status==="dirty"?(n.dirty(),Sc(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?je:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Dy({in:t,out:n,typeName:Le.ZodPipeline})}}class Df extends Ze{_parse(t){const n=this._def.innerType._parse(t),r=i=>(hl(i)&&(i.value=Object.freeze(i.value)),i);return If(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Df.create=(e,t)=>new Df({innerType:e,typeName:Le.ZodReadonly,...Fe(t)});var Le;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Le||(Le={}));const y=Fi.create,H=fl.create,se=nx.create,Gi=sx.create;Ks.create;const G=_i.create,P=Ht.create,zB=Tf.create,Jn=Ly.create;Pf.create;Oo.create;const Dr=Rf.create,V=Mf.create,xe=Bo.create;Af.create;Ki.create;$o.create;const FB=Gs.createWithPreprocess,HB=["head","index"],iT=y().regex(/^[A-Za-z0-9][A-Za-z0-9-]{0,127}$/),Of=y().regex(/^[1-9][0-9]*$/),Bf=y().regex(/^[A-Za-z0-9_.-]+$/),bu=y().min(1).max(255).refine(e=>!e.startsWith("-")&&e!=="HEAD"&&!e.startsWith("/")&&!e.endsWith("/")&&!e.endsWith(".")&&!/[\s~^:?*\[\\\x00-\x1f\x7f]/.test(e)&&!e.includes("..")&&!e.includes("@{")&&!e.includes("//")&&e.split("/").every(t=>!t.startsWith(".")&&!t.endsWith(".lock")),"Invalid Git branch"),Oy=y().min(1).max(4096).refine(e=>!e.startsWith("/")&&!e.includes("\0")&&!e.split(/[\\/]/).includes("..")),Yp=P({workspaceId:iT,repoId:Of,owner:Bf,name:Bf,sourceBranch:bu,defaultBranch:bu}).strict(),UB=P({repoId:Of,owner:Bf,name:Bf,defaultBranch:y(),private:se(),description:y().nullable()}),WB=Yp.extend({initialCommit:y(),head:y(),actualBranch:y().nullable(),branches:G(y()).optional(),files:G(P({path:Oy,previousPath:y().optional(),comparison:xe(HB).optional(),status:y(),added:H().nonnegative(),removed:H().nonnegative(),binary:se(),untracked:se().optional()})),totalFiles:H().int().nonnegative().optional(),filesTruncated:se().optional(),added:H().nonnegative(),removed:H().nonnegative(),dirty:se(),conflicted:se(),version:y(),measuredAt:H()}),fa=P({sessionId:iT});Jn("action",[fa.extend({action:V("repositories"),page:H().int().min(1).max(1e3).optional(),search:y().max(100).optional()}).strict(),fa.extend({action:V("branches"),repoId:Of,page:H().int().min(1).max(1e3).optional(),search:y().max(100).optional(),cursor:y().min(1).max(1024).optional()}).strict(),fa.extend({action:V("bind"),repoId:Of,branch:bu}).strict(),fa.extend({action:V("status")}).strict(),fa.extend({action:V("intend"),branch:bu.optional()}).strict(),fa.extend({action:V("diff"),filePath:Oy}).strict()]);P({binding:Yp.nullable().optional(),workspace:WB.nullable().optional(),repositories:G(UB).optional(),branches:G(y()).optional(),hasMore:se().optional(),nextCursor:y().min(1).max(1024).optional(),diff:P({path:Oy,patch:y(),binary:se(),truncated:se(),notStored:se().optional()}).optional()});P({threadId:y().min(1),conversationId:y().min(1),workspace:Yp.optional()});new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");P({id:y().min(1),name:y().min(1),baseUrl:y().min(1),apiKey:y().min(1),remark:y().optional(),createdAt:H(),updatedAt:H()}).strict();const qB=P({id:y().min(1),name:y().min(1),baseUrl:y().min(1),remark:y().optional(),keyMasked:y(),hasKey:se(),createdAt:H(),updatedAt:H()}).strict();P({activeChannelId:y().nullable(),channels:G(qB)}).strict();P({}).strict();P({id:y().min(1).optional(),name:y().min(1),baseUrl:y().min(1),apiKey:y().optional(),remark:y().optional()}).strict();P({id:y().min(1)}).strict();P({id:y().min(1).nullable()}).strict();P({channelId:y().min(1).optional(),updatedAt:H().optional()}).strict().refine(e=>e.updatedAt===void 0||e.channelId!==void 0,{message:"updatedAt requires channelId"});P({channelId:y().nullable(),models:G(P({id:y().min(1),ownedBy:y().optional()}).strict())}).strict();const VB=["owner"],KB=["agent","owner","user-upload"],sT=P({id:y().min(1),relPath:y().min(1),from:xe(KB),label:y().optional(),size:H().int().nonnegative(),mime:y().min(1),addedAt:H().int().nonnegative(),lastEditedAt:H().int().nonnegative().optional(),stale:se().optional()});P({sessionId:y().min(1),relPath:y().min(1),ttlSeconds:H().int().positive().nullable().optional(),view:xe(["raw","md-rendered"]).optional()});P({url:y().min(1),expiresAt:H().int().nonnegative().nullable()});P({sessionId:y().min(1),relPath:y().min(1),label:y().optional(),origin:V("agent").optional()});P({entry:sT});P({sessionId:y().min(1),relPath:y().min(1)});P({removed:V(!0)});P({sessionId:y().min(1)});P({entries:G(sT)});P({attachmentId:y().min(1),url:y().min(1),relPath:y().min(1),sizeBytes:H().int().nonnegative(),mimeType:y().min(1)});const GB=Jn("type",[P({type:V("persona"),id:y().min(1)}).strict(),P({type:V("chat"),id:y().min(1)}).strict(),P({type:V("*")}).strict()]),YB=xe(["read","send","admin"]),By=P({resource:GB,actions:G(YB).min(1)}).strict(),XB=P({id:y().min(1),secretHash:y().regex(/^[a-f0-9]{64}$/),displayName:y(),grants:G(By),issuedAt:H().int().nonnegative(),expiresAt:H().int().positive().optional(),maxUses:H().int().positive().optional(),usedCount:H().int().nonnegative(),peerOwnerId:y().min(1).optional(),firstUsedByPeerAt:H().int().positive().optional(),peerDisplayName:y().optional()}).strict(),ZB=XB.omit({secretHash:!0});P({type:V("whoami:ok"),owner:P({id:y(),kind:xe(["owner","guest"]),displayName:y(),ownerId:y(),provider:y()}).strict(),capability:ZB,grantedPersonas:G(P({id:y().min(1),displayName:y()}).strict())}).strict();P({selfUrl:y().min(1)});P({type:V("contact:handshake:ok"),owner:P({id:y(),ownerId:y(),provider:y(),displayName:y()}),grants:G(By)});const QB=Jn("status",[P({status:V("authorized"),login:y().min(1),source:xe(["git","file"])}).strict(),P({status:V("missing")}).strict(),P({status:V("invalid"),message:y().min(1)}).strict(),P({status:V("pending"),authUrl:y().url()}).strict()]);P({token:y().min(1)}).strict();P({returnTo:y().url().optional()}).strict();const JB=P({url:y().url(),bin:y(),sha256:y().regex(/^[0-9a-f]{64}$/),size:H().int().positive()}),e9=P({name:y().min(1),from:y().optional(),version:y().optional(),min:y().optional(),library:se().optional(),localVersion:y().optional(),artifact:JB.optional(),aptMissing:V(!0).optional(),aptVersion:y().optional()}),t9=P({name:y().min(1),env:G(y().min(1)).min(1)}),$y=y().regex(/^[a-z0-9-]+$/,"连接器名只能是小写字母、数字和短横线"),oT=["proxy","env"],aT=["mcp","cli"],n9=["bearer","lark-sidecar"],r9=["none","shared","personal"],lT=["oauth","fields"],zy=y().regex(/^[A-Z][A-Z0-9_]*$/,"要填的变量名只能是大写字母、数字和下划线,且以字母开头"),cT=P({name:$y,kind:xe(oT),runner:xe(aT),protocol:xe(n9).optional(),id:y().min(1),credentialSource:xe(r9).optional(),auth:xe(lT).optional(),publisherUnionId:y().regex(/^on_[A-Za-z0-9_-]+$/).optional(),fields:G(zy).default([]),http:P({url:y().min(1),headers:Dr(y(),y())}).optional()}),i9=e=>{if(!e||typeof e!="object")return e;let t=e;if("clis"in t&&Array.isArray(t.clis)){const{clis:n,...r}=t;t="packages"in r?r:{...r,packages:n}}if("assets"in t&&Array.isArray(t.assets)&&t.assets.length===0){const{assets:n,...r}=t;t=r}return t},uT=P({version:V(1),entry:y().max(240).regex(/^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*\.mjs$/).refine(e=>!e.split("/").some(t=>[".",".."].includes(t))),timeoutSeconds:H().int().min(1).max(600),checks:G(y().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)).min(1).max(64).refine(e=>new Set(e).size===e.length)}).strict(),dT={test:uT.optional(),packages:G(e9),secrets:G(t9),connectors:G(cT).default([])};P(dT);const Fy=FB(i9,P({version:V(1),...dT}).strict()),s9=P({target:y().min(1),reason:y().min(1),file:y().min(1),quote:y().min(1)}),o9=["integration","production"],er=xe(o9),es=y().regex(/^[a-z0-9.-]+(?::[0-9]+)?\/[a-z0-9._/-]+@sha256:[a-f0-9]{64}$/),cx=y().regex(/^[a-f0-9]{40}$/),a9=y().refine(e=>{try{const t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password&&!t.search&&!t.hash&&t.pathname==="/"&&/(^|[.-])int([.-]|$)/.test(t.hostname)}catch{return!1}},"测试验证地址必须明确指向 int HTTPS 环境"),l9=P({version:V(1),runId:y().regex(/^[A-Za-z0-9_-]{1,128}$/),status:V("passed"),exitCode:V(0),result:P({version:V(1),runId:y().regex(/^[A-Za-z0-9_-]{1,128}$/),checks:G(P({name:y().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),status:V("passed"),reason:y().max(1024).optional()}).strict()).min(1).max(64)}).strict(),execution:P({image:es,imageID:y().min(1).max(512),engine:xe(["codex","pi"]),podUid:y().min(1).max(512),jobUid:y().min(1).max(512)}).strict()}).strict(),hT=P({status:V("passed"),fingerprint:y().regex(/^[a-f0-9]{64}$/),checks:G(y().regex(/^[a-z0-9-]+$/)),endpoint:a9,verifiedAt:y().refine(e=>Number.isFinite(Date.parse(e))),test:l9.optional()}).strict(),fT=P({engine:y().min(1),model:y(),effort:y(),size:y().min(1),cpu:H().positive(),taskConcurrency:H().int().positive()}).strict(),pT=P({version:V(1),environment:V("integration"),component:V("persona"),image:es,commit:cx,baseImage:es,pipelineCommit:cx,repository:y().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/),config:fT.optional(),verification:hT.refine(e=>e.checks.includes("persona-smoke")),test:uT.optional()}).strict().refine(e=>{if(!e.test)return e.verification.test===void 0;const t=e.verification.test;return["persona-dialogue","persona-task","persona-custom-test"].every(n=>e.verification.checks.includes(n))&&t!==void 0&&t.execution.image===e.image&&t.runId===t.result.runId&&t.result.checks.length===e.test.checks.length&&new Set(t.result.checks.map(n=>n.name)).size===e.test.checks.length&&t.result.checks.every(n=>e.test.checks.includes(n.name))},"Declared publisher acceptance requires complete candidate runtime evidence");P({version:V(1),environment:V("integration"),component:V("base"),image:es,commit:cx,verification:hT.refine(e=>e.checks.includes("base-smoke"))}).strict();const wu="-cloud",Hy=`codex${wu}`,$f={standard:"default",fast:"priority"},c9=`claude${wu}`;function mT(e){return e==="codex"||e===Hy}const gT="pi",u9=`${gT}${wu}`;function vT(e){return e===gT||e===u9}function Wc(e){return typeof e=="string"&&e.length>wu.length&&e.endsWith(wu)}const xT=xe([$f.standard,$f.fast]),d9=["tiny","small","medium","large","xlarge"],h9=xe(d9),f9=[.5,1,2],p9=H().refine(e=>f9.includes(e),"Unsupported CPU"),yT=P({model:y().optional(),effort:y().optional()}).strict(),zf=P({personaId:y(),label:y(),model:y().optional(),effort:y().optional(),serviceTier:xT.optional(),public:se(),iconKey:y().optional(),tool:y().optional(),size:y().optional(),cpu:H().finite().optional(),taskConcurrency:H().int().positive().optional(),cloudEngine:yT.optional(),createdAt:H(),updatedAt:H(),cloud:P({gatewayUrl:y().min(1),personaId:y().min(1),publishedByMe:se().optional(),environment:er.optional(),expectedImage:es.optional(),testReleaseId:y().optional()}).strict().optional()}).strict(),m9=P({name:y().min(1),description:y().optional()}),g9=P({id:y().min(1)}),_T=P({writableRoots:G(y()).optional(),denyRead:G(y()).optional(),network:se().optional()}).strict(),v9=P({permissions:P({defaultMode:y().optional(),allow:G(y()).optional(),deny:G(y()).optional()}).optional(),sandbox:P({enabled:se().optional(),autoAllowBashIfSandboxed:se().optional(),allowUnsandboxedCommands:se().optional(),excludedCommands:G(y()).optional(),filesystem:P({denyRead:G(y()).optional(),allowRead:G(y()).optional(),denyWrite:G(y()).optional(),allowWrite:G(y()).optional()}).optional(),network:P({allowedDomains:G(y()).optional(),allowLocalBinding:se().optional()}).optional()}).optional()});zf.extend({personality:y().optional(),personalityLocal:y().optional(),personalityManaged:se().optional(),skills:G(m9).optional(),plugins:G(g9).optional(),sandboxSettings:v9.nullable().optional(),codexSandbox:_T.nullable().optional()});P({slug:y().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:y().min(1),personality:y(),model:y().optional(),effort:y().optional(),serviceTier:zf.shape.serviceTier,tool:y().optional(),public:se().optional(),iconKey:y().optional()}).strict();P({personaId:y().min(1)});P({personaId:y().min(1),patch:P({label:y().min(1).optional(),model:y().optional(),effort:y().optional(),serviceTier:zf.shape.serviceTier,tool:y().optional(),size:h9.optional(),cpu:p9.optional(),taskConcurrency:zf.shape.taskConcurrency,cloudEngine:yT.optional(),personality:y().optional(),personalityLocal:y().optional(),public:se().optional(),iconKey:y().nullable().optional(),codexSandbox:_T.optional()}).strict()}).strict();P({version:V(1),manifest:Fy}).strict();const x9=["hard","soft"],bT=xe(x9),y9=xe(["scanning","done","failed"]),wT=P({id:y().min(1),manifest:Fy,scanSessionId:y().optional(),status:y9,evidence:G(s9).default([]),notes:G(y()).default([]),head:y().min(1).optional(),baseKind:bT.default("hard"),base:y().min(1).optional(),startedAt:H(),finishedAt:H().optional(),error:y().optional()}).strict(),Uy=P({id:y().min(1).optional(),environment:er.optional(),legacy:se().optional(),head:y().min(1),contentHead:y().min(1),scanId:y().min(1),at:H(),pushed:se().optional(),runId:H().int().positive().optional(),runAttempt:H().int().positive().optional(),artifactId:H().int().positive().optional(),verified:pT.optional(),config:fT.optional(),reconfigOf:y().min(1).optional(),workflowVersion:H().int().positive().optional(),confirmation:P({fingerprint:y().regex(/^[a-f0-9]{64}$/),runId:H().int().positive(),runAttempt:H().int().positive(),at:H()}).strict().optional()}).strict(),_9=["prepared","main-pushed","dispatching","dispatched","completed","failed"],Wy=P({id:y().min(1),releaseId:y().min(1),at:H(),verified:pT.optional(),phase:xe(_9),expectedMain:y().optional(),runId:H().int().positive().optional(),runAttempt:H().int().positive().optional(),error:y().optional()}).strict(),$S=P({channelId:y().min(1),updatedAt:H()}).strict(),qy=P({integration:$S.nullable().optional(),production:$S.nullable().optional()}).strict();P({version:V(4),engineChannels:qy.optional(),scans:G(wT),releases:G(Uy),promotions:G(Wy).default([])}).strict();const b9=P({url:y().min(1),branch:y().min(1),head:y().min(1),dirty:se(),ahead:H()}).strict(),Lh=P({env:y().min(1),setAt:H().optional()}).strict(),w9=["pending","running","done","failed","waiting","skipped"],S9=xe(w9),k9="verify",C9=["build","smoke","deploy",k9],E9=xe(C9),I9=P({key:E9,status:S9,url:y().optional(),jobId:H().optional(),startedAt:H().optional(),completedAt:H().optional()}).strict(),Dh=P({runId:H(),headSha:y().min(1),status:xe(["queued","running","completed"]),htmlUrl:y().min(1),jobs:G(I9),environment:er.optional(),branch:y().optional(),event:y().optional(),runAttempt:H().int().positive().optional(),conclusion:xe(["success","failure"]).optional(),promotionId:y().optional()}).strict(),Sg=P({runId:H(),status:Dh.shape.status,conclusion:xe(["success","failure"]).optional(),htmlUrl:y().min(1)}).strict(),ST=P({personaId:y().min(1),engineChannels:qy.optional(),github:QB.optional(),publisherFeishuAuth:P({integration:P({connected:se(),authUrl:y().optional(),error:y().optional()}).strict(),production:P({connected:se(),authUrl:y().optional(),error:y().optional()}).strict()}).strict().optional(),repo:b9.optional(),scans:G(wT).default([]),releases:G(Uy).default([]),promotions:G(Wy).optional(),targets:P({integration:P({run:Dh.optional(),secrets:G(Lh).optional(),online:se().optional(),image:es.optional(),unpublish:Sg.optional()}).strict().optional(),production:P({run:Dh.optional(),secrets:G(Lh).optional(),online:se().optional(),image:es.optional(),unpublish:Sg.optional()}).strict().optional()}).strict().optional(),secrets:G(Lh).optional(),run:Dh.optional(),online:se().optional(),unpublish:Sg.optional(),historyError:y().optional()}).strict();P({before:H().nullable()}).strict();ST.pick({personaId:!0,github:!0,repo:!0,scans:!0,releases:!0,promotions:!0,engineChannels:!0,historyError:!0});ST.pick({scans:!0});P({environment:er,secrets:G(Lh).optional(),engineChannels:qy.optional()}).strict();P({sha:y().min(1),actionsUrl:y().min(1),releaseId:y().optional()}).strict();const Wu=P({personaId:y().min(1)}).strict();Wu.extend({releaseHead:y().min(1).optional(),releaseId:y().min(1).optional(),environment:er.optional()}).strict();Wu.extend({scanBase:bT.optional()}).strict();Wu.extend({scanId:y().min(1)}).strict();Wu.extend({releaseId:y().min(1)}).strict();Wu.extend({environment:er.default("production")}).strict();P({confirmation:Uy.shape.confirmation.unwrap()}).strict();P({promotion:Wy}).strict();P({personaId:y().min(1),expectedImage:es}).strict();P({personaId:y().min(1),scanId:y().min(1),patch:P({manifest:Fy.optional(),connector:cT.optional()}).strict()}).strict();P({personaId:y().min(1),environment:er.default("production"),scanId:y().min(1),name:y().min(1),values:Dr(y(),y())}).strict();P({personaId:y().min(1),environment:er.default("production"),channelId:y().min(1).optional(),auth:P({baseUrl:y(),apiKey:y()}).strict().nullable().optional()}).strict().refine(e=>e.channelId!==void 0||e.auth!==void 0,{message:"Either channelId or auth must be provided"});P({personaId:y().min(1),environment:er.default("production"),releaseId:y().optional(),jobId:H()}).strict();P({personaId:y().min(1),kind:xe(["package","secret","connector"]),item:Dr(y(),Gi()),evidence:P({reason:y().min(1),file:y().min(1),quote:y().min(1)})}).strict();P({personaId:y().min(1),notes:G(y()).default([])}).strict();P({environment:er.default("production")}).strict();const N9=P({deviceId:y().min(1),name:y().min(1),url:y().min(1)});P({type:V("device:list:ok"),devices:G(N9)});P({deviceId:y().min(1),url:y().min(1).optional(),name:y().optional()});P({type:V("device:connect:ok"),deviceId:y(),name:y(),url:y()});const kT=P({ownerId:y().min(1),provider:y().min(1),displayName:y().min(1),avatarUrl:y().optional(),unionId:y().optional()});P({type:V("auth:login:start:ok"),environment:er.optional(),authUrl:y().min(1),state:y().min(1)});P({type:V("auth:getIdentity:ok"),identity:kT.nullable(),deviceId:y().min(1)});P({type:V("auth:logout:ok")});const CT=y().nullable();P({type:V("auth:apiKey:get:ok"),apiKey:y().nullable(),createdAt:y().nullable(),gatewayUrl:CT});P({type:V("auth:apiKey:regenerate:ok"),apiKey:y().min(1),createdAt:y().min(1),gatewayUrl:CT});P({type:V("auth:apiKey:revoke:ok"),revoked:se()});P({type:V("auth:login:done"),environment:er.optional(),identity:kT});P({type:V("auth:login:failed"),environment:er.optional(),reason:y()});P({deviceId:y().min(1),remoteAccessAllowed:se()}).strict();P({type:V("contact:setRemoteAccess:ok"),deviceId:y().min(1),remoteAccessAllowed:se()}).strict();P({type:V("contact:remote-access-updated"),deviceId:y().min(1),remoteAccessAllowed:se()}).strict();P({personaId:y().min(1)}).strict();const T9=["connected","missing","reauth"],P9=["link","fill"],R9=P({name:$y,id:y().min(1),kind:xe(oT),runner:xe(aT),auth:xe(lT),status:xe(T9),action:xe(P9),authUrl:y().optional(),fields:G(zy)}).strict();P({connectors:G(R9)}).strict();P({personaId:y().min(1),name:$y,values:Dr(zy,y().min(1))}).strict();const M9=P({deviceId:y().min(1),ownerId:y().min(1),provider:y().min(1),displayName:y(),remoteUrl:y().min(1),connectToken:y(),grants:G(By),addedAt:H().int().nonnegative(),pinnedAt:H().int().nullable().default(null),remoteAccessAllowed:se().default(!1),note:y().default("")}).strict(),ET=M9;P({deviceId:y().min(1)}).strict();P({type:V("contact:remove:ok"),deviceId:y().min(1)}).strict();P({type:V("contact:list:ok"),contacts:G(ET)}).strict();P({type:V("contact:added"),contact:ET}).strict();P({type:V("contact:removed"),deviceId:y().min(1)}).strict();P({deviceId:y().min(1),pinned:se()}).strict();P({deviceId:y().min(1),note:y()}).strict();P({type:V("contact:setNote:ok"),deviceId:y().min(1),note:y()}).strict();P({type:V("contact:pin:ok"),deviceId:y().min(1),pinnedAt:H().int().nullable()}).strict();P({type:V("contact:pinned"),deviceId:y().min(1),pinnedAt:H().int().nullable()}).strict();const Vy=Jn("kind",[P({kind:V("success"),text:y(),brief:y().optional(),filePaths:G(y()).optional()}),P({kind:V("failure"),reason:y(),brief:y().optional()})]);P({targetPersona:y().min(1).optional(),dispatchId:y().min(1).optional(),prompt:y(),brief:y().optional(),targetDeviceId:y().min(1).optional(),model:y().min(1).optional(),tool:y().min(1).optional(),sessionLabel:y().min(1).max(60).optional(),meta:Dr(Gi()).optional()}).refine(e=>e.targetPersona!==void 0||e.dispatchId!==void 0,{message:"either targetPersona (new dispatch) or dispatchId (follow-up) is required"}).refine(e=>!(e.dispatchId!==void 0&&e.targetDeviceId!==void 0),{message:"cross-device dispatch cannot be continued (dispatchId + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.tool!==void 0&&e.targetDeviceId!==void 0),{message:"engine override is not supported for cross-device dispatch (tool + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.dispatchId!==void 0&&(e.tool!==void 0||e.model!==void 0)),{message:"a follow-up dispatch cannot change engine or model (dispatchId excludes tool / model); start a new dispatch instead"});P({dispatchId:y().min(1),outcome:Vy});const A9=["running","completed","failed"],Ky=xe(A9),j9=P({dispatchId:y().min(1),sourceSessionId:y().min(1),sourcePersonaId:y().min(1).optional(),targetPersonaId:y().min(1),targetDeviceId:y().min(1).optional(),workerSessionId:y().min(1).optional(),taskText:y(),taskBrief:y().optional(),round:H().int().positive().optional(),status:Ky,outcome:Vy.optional(),meta:Dr(Gi()).optional(),createdAt:y().min(1),completedAt:y().min(1).optional(),deliveredAt:y().min(1).optional()});P({sourceSessionId:y().min(1).optional(),relatedSessionId:y().min(1).optional()});P({records:G(j9)});P({dispatchId:y().min(1)});P({type:V("personaDispatch:get:ok"),status:Ky,outcome:Vy.optional()});const L9=/^[a-z0-9][a-z0-9-]*$/;xe(["stopped","starting","running","crashed","invalid"]);const D9=new Set(["localhost","127.0.0.1"]);function O9(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&D9.has(t.hostname))}const Hd=P({id:y().regex(L9),name:y().min(1),version:y().min(1),apiVersion:V("1"),runtime:P({startCommand:y().min(1)}).passthrough().optional(),entry:P({url:y().url().refine(O9,{message:"INVALID_URL_SCHEME: only https or http://localhost is allowed"})}).strict().optional()}).passthrough().superRefine((e,t)=>{var i;const n=!!e.runtime,r=!!((i=e.entry)!=null&&i.url);n&&r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),B9=Jn("kind",[P({kind:V("local"),port:H().int().min(1).max(65535)}),P({kind:V("hosted"),url:y().url()})]);Jn("state",[P({extId:y(),manifest:Hd,state:V("stopped")}),P({extId:y(),manifest:Hd,state:V("starting")}),P({extId:y(),manifest:Hd,state:V("running"),target:B9}),P({extId:y(),manifest:Hd,state:V("crashed")}),P({extId:y(),manifest:Gi().nullable(),state:V("invalid"),invalidReason:y().min(1)})]);P({snapshotHash:y().min(1),version:y().min(1),publishedAt:H()});const $9=Jn("kind",[P({kind:V("p2p-tunnel"),ownerPrincipalId:y().min(1),extId:y().min(1)})]);Jn("kind",[P({kind:V("p2p-tunnel"),ownerPrincipalId:y().min(1),extId:y().min(1),snapshotHash:y().min(1)})]);P({extId:y().min(1),name:y().min(1),version:y().min(1),contentHash:y().min(1),publishedAt:H()});const z9=Jn("kind",[P({kind:V("clean")}),P({kind:V("ready-new-version"),fromVersion:y().min(1),toVersion:y().min(1)}),P({kind:V("error-same-hash"),version:y().min(1)}),P({kind:V("error-version-not-bumped"),localVersion:y().min(1),publishedVersion:y().min(1)}),P({kind:V("error-version-regression"),localVersion:y().min(1),publishedVersion:y().min(1)})]);P({localManifest:P({name:y().min(1),version:y().min(1),contentHash:y().min(1)}),publishState:Jn("kind",[P({kind:V("unpublished")}),P({kind:V("published"),version:y().min(1),contentHash:y().min(1),publishedAt:H()})]),check:z9});P({extId:y().min(1),newVersion:y().min(1).nullish()});P({extId:y().min(1)});P({extId:y().min(1),snapshotHash:y().min(1)});P({channelRef:$9,snapshotHash:y().min(1),zipBase64:y().min(1)});P({id:y().min(1),peerDeviceId:y().min(1),senderDeviceId:y().min(1),text:y().min(1),createdAt:H().int().nonnegative(),readBy:Dr(y().min(1),H().int().positive()).default({}),origin:P({kind:V("persona"),personaId:y().min(1)}).optional()}).strict();P({peerDeviceId:y().min(1).optional(),id:y().min(1),text:y().min(1),createdAt:H().int().nonnegative(),origin:P({kind:V("persona"),personaId:y().min(1)}).optional()}).strict();P({peerDeviceId:y().min(1),sinceCreatedAt:H().int().nonnegative().optional()}).strict();P({peerDeviceId:y().min(1),upToCreatedAt:H().int().nonnegative()}).strict();P({peerDeviceId:y().min(1).optional(),text:y().min(1)});P({peerDeviceId:y().min(1).optional(),command:y().min(1),timeoutMs:H().int().positive().optional()}).strict();P({type:V("peerExec:run:ok"),stdout:y(),stderr:y(),exitCode:H().int().nullable(),timedOut:se(),stdoutTruncated:se(),stderrTruncated:se()}).strict();const IT=Jn("kind",[P({kind:V("at"),at:y().min(1)}),P({kind:V("every"),everyMs:H().int().positive(),anchorMs:H().int().nonnegative().optional()}),P({kind:V("cron"),expr:y().min(1),tz:y().min(1).optional()})]),qu=y().trim().min(1);P({personaId:qu,name:y().min(1),schedule:IT,prompt:y().min(1),targetPersona:y().min(1).optional(),timeoutMs:H().int().positive().optional()});P({personaId:qu,onlyMine:se().optional()});P({personaId:qu,shiftId:y().min(1)});const F9=P({name:y().min(1).optional(),schedule:IT.optional(),prompt:y().min(1).optional(),targetPersona:y().min(1).optional(),timeoutMs:H().int().positive().optional(),enabled:se().optional()});P({personaId:qu,shiftId:y().min(1),patch:F9});P({personaId:qu,shiftId:y().min(1),limit:H().int().positive().optional()});const NT="persona-master",Gy=P({personaId:y().min(1),deviceId:y().min(1).optional()}),TT=P({id:y().min(1),name:y().min(1),memberPersonas:G(Gy),memberContactDeviceIds:G(y().min(1)),createdAt:y().min(1),updatedAt:y().min(1)}),PT=y().trim().min(1);P({name:PT,memberPersonas:G(Gy).default([]),memberContactDeviceIds:G(y().min(1)).default([])});P({channelId:y().min(1),name:PT.optional(),memberPersonas:G(Gy).optional(),memberContactDeviceIds:G(y().min(1)).optional()});P({channelId:y().min(1)});P({channels:G(TT)});P({channel:TT});P({ok:V(!0),removedTopics:H().int().min(0)});const Vt=y().trim().min(1),Yy=["master-confirmed","owner-needed"],Xy=["open","resolved"],H9=Yy[0];Yy[1];Xy[0];const U9=Xy[1],W9=xe(Yy),q9=xe(Xy),V9=P({id:Vt.optional(),resolves:Vt.optional(),type:W9,status:q9,question:Vt,recommendation:Vt}).superRefine((e,t)=>{e.type===H9&&e.status!==U9&&t.addIssue({code:X.custom,path:["status"],message:"master-confirmed decisions must be resolved"})}),K9=["planning","running","done"],G9=xe(K9),RT=P({at:y().min(1),actor:y().min(1),action:y().min(1),target:y().optional(),reason:y().min(1),artifacts:G(Vt).optional(),decision:V9.optional()}),Y9=P({rejectCount:H().int().min(0),accepted:se().default(!1),ordinal:H().int().min(1).optional(),overrideCount:H().int().min(0).optional()}),Zy=P({id:y().min(1),channelId:y().min(1),title:y(),masterSessionId:y().min(1),goal:y(),boundaries:y(),acceptanceCriteria:G(y()),activity:G(RT),lineMeta:Dr(Y9),nextLineOrdinal:H().int().min(1).optional(),state:G9,createdAt:y().min(1),updatedAt:y().min(1)}),X9=P({lineId:y().min(1),dispatchId:y().min(1),workerSessionId:y().optional(),assignee:y().min(1),focus:y(),status:Ky,acceptance:G(y()),rejectCount:H().int().min(0),accepted:se(),ordinal:H().int().min(1).nullable()});P({channelId:y().min(1)});P({topicId:y().min(1).optional(),sessionId:y().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});P({channelId:y().min(1),title:Vt.optional()});P({topicId:y().min(1),title:Vt.optional(),goal:Vt,boundaries:y(),acceptanceCriteria:G(Vt).min(1)});P({topicId:y().min(1),action:Vt,target:Vt.optional(),reason:Vt,artifacts:G(Vt).optional(),decision:RT.shape.decision});P({topicId:y().min(1),lineId:Vt,reason:Vt});P({topicId:y().min(1),lineId:Vt,reason:Vt,artifacts:G(Vt).optional(),watcherVerdict:xe(["pass","fail"]),overrideReason:Vt.optional()}).refine(e=>e.watcherVerdict!=="fail"||!!e.overrideReason,{message:"watcherVerdict=fail 时必须给 overrideReason(推翻 watcher 的理由)",path:["overrideReason"]});P({topicId:y().min(1),state:xe(["done"])});P({topicId:y().min(1),title:Vt});P({topicId:y().min(1)});const Z9=Zy.extend({lineCount:H().int().min(0)});P({topics:G(Z9)});P({topic:Zy,lines:G(X9)});P({topicId:y().min(1),masterSessionId:y().min(1)});P({rejectCount:H().int().min(1),needsOwnerAttention:se()});P({acceptedLines:H().int().min(1),totalLines:H().int().min(1),allAccepted:se(),overrides:H().int().min(0),needsOwnerAttention:se()});P({topic:Zy});P({ok:V(!0),removedMasterSessionId:y().min(1).nullable(),removedWorkerSessionIds:G(y().min(1))});const Q9=["ask","allow","deny"],MT=xe(Q9),J9=P({id:y().min(1),desc:y().min(1),action:MT});P({rules:G(J9)});P({ruleId:y().min(1)});P({action:MT,desc:y(),source:y().min(1)});const e$=["created","review-requested"],AT=/^[A-Za-z0-9._-]+$/,Dl=y().min(1).regex(AT),Ol=y().min(1).regex(AT),Vu=H().int().positive();P({role:xe(e$)});P({owner:Dl,repo:Ol,number:Vu});P({owner:Dl,repo:Ol,number:Vu,expectedHeadSha:y().min(1)});P({owner:Dl,repo:Ol,number:Vu,body:y().min(1)});P({owner:Dl,repo:Ol,number:Vu,ready:se()});P({owner:Dl,repo:Ol});P({owner:Dl,repo:Ol,number:Vu,reviewers:G(y().min(1)).min(1)});P({personaId:y().min(1)});P({personaId:y().min(1)});const t$=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],n$=xe(t$);P({personaId:y().min(1),appId:y().min(1),appSecret:y().min(1),botName:y().min(1).optional()});const r$=P({chatId:y().min(1),chatName:y().optional(),lastActiveAt:H().int().optional()}),i$=P({state:xe(["unbound","provisioning","bound","broken"]),appId:y().optional(),botName:y().optional(),brokenReason:y().optional(),qrUrl:y().optional(),provisionId:y().optional(),errorReason:n$.optional(),groups:G(r$),needsUpgrade:se().optional(),upgradeQrUrl:y().optional()});i$.extend({personaId:y().min(1)});P({});P({onboardingCompletedAt:H()});const Xp=["claude","codex","pi"];P({});P({tools:G(P({id:xe(Xp),available:se(),version:y().optional(),path:y().optional()}))});P({});const s$=P({tool:xe(Xp),cwd:y(),toolSessionId:y(),label:y().optional(),createdAt:y(),updatedAt:y(),turns:H()});P({candidates:G(s$)});P({});P({registered:se()});P({tool:xe(Xp)});const zS=P({usedPercent:H(),windowDurationMins:H().optional(),resetsAt:H().optional()}).strict(),o$=Jn("kind",[P({kind:V("claude"),loggedIn:se(),authMethod:y().optional(),apiProvider:y().optional(),apiKeySource:y().optional(),email:y().optional(),orgName:y().optional(),subscriptionType:y().optional()}).strict(),P({kind:V("codex"),login:Jn("type",[P({type:V("none")}).strict(),P({type:V("apiKey")}).strict(),P({type:V("chatgpt"),email:y(),planType:y()}).strict()]),provider:P({name:y(),baseUrl:y().optional()}).strict(),rateLimits:P({primary:zS.optional(),secondary:zS.optional()}).strict().optional()}).strict(),P({kind:V("pi"),providers:G(P({id:y(),modelCount:H(),credential:xe(["api_key","oauth"]).optional(),oauthExpiresAt:H().optional()}).strict())}).strict()]);P({tool:xe(Xp),installed:se(),version:y().optional(),path:y().optional(),account:o$.optional(),error:y().optional(),modelsLoadedAt:H().optional()}).strict();P({apiKey:y().min(1)}).strict();P({ok:V(!0)}).strict();const a$=["cloud-persona-metrics","cloud-persona-conversations"],l$=xe(a$);P({page:l$}).strict();P({url:y(),expiresAt:H().int()}).strict();const jT=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","session:queue","permission:request","session:question","session:question:cleared","pong","error","subscribed","unsubscribed","auth:ok","tunnel:ready","tunnel:exited","tunnel:unavailable","session:control","session:pty","contact:added","contact:pinned","contact:removed","contact:remote-access-updated","contact:note-updated","org-mesh:progress","channel:changed","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","larkBot:state"],c$="cloud_history_refresh",LT=["idle","running","running-idle","stopped","error","observing"],u$=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools","dispatch-task","dispatch-result"];function Zp(e){return e==="dispatch-task"||e==="dispatch-result"}const d$=["builtin","global","project","plugin"],h$=["builtin","global","project","policy","plugin"],DT=xe(["owner","guest"]);P({id:y().min(1),kind:DT,displayName:y(),feishuUnionId:y().optional()}).strict();const f$=P({did:y().min(1),displayName:y(),feishuUnionId:y().optional(),principal:DT}).strict(),p$=xe(LT),m$=P({inputTokens:H().int().nonnegative(),outputTokens:H().int().nonnegative(),cacheReadTokens:H().int().nonnegative().optional(),cacheCreateTokens:H().int().nonnegative().optional()}),OT={gitBranch:y().optional(),resolvedModel:y().optional(),resolvedEffort:y().optional(),contextUsage:m$.optional(),contextWindowSize:H().int().positive().optional(),aiLabel:y().optional()},g$=P(OT),BT=P({value:y(),label:y(),description:y().optional()}),v$=P({id:y().min(1),label:y().min(1),description:y().optional(),contextWindowSize:H().int().positive(),default:se().optional(),efforts:G(BT).optional(),defaultEffort:y().optional(),group:y().optional()}),x$=P({id:y().min(1),label:y().min(1),description:y().optional()}),y$=P({name:y().min(1),type:xe(["string","select","toggle"]),label:y().min(1),description:y().optional(),options:G(BT).optional(),default:Gi().optional(),scope:xe(["core","tool-specific"])});P({tool:y().min(1),refresh:se().optional()});const _$=P({rewind:se(),subagents:se(),tui:se(),observe:se(),fileSharing:se(),fork:se()});P({tool:y().min(1),toolSessionIdLabel:y().optional(),models:G(v$),permissionModes:G(x$),configSchema:G(y$),features:_$});const b$=P({tool:y().min(1),pattern:y().min(1),createdAt:y().min(1).optional()});P({cloudEnvironment:er.optional(),cloudExpectedImage:es.optional(),testReleaseId:y().optional(),sessionId:y().min(1),cloudExecutionId:y().min(1).optional(),cloudConversationId:y().min(1).optional(),cloudWorkspace:Yp.optional(),cloudPendingTurns:G(P({id:y().min(1),text:y(),prepared:se().optional()})).optional(),cloudBranchIntent:bu.optional(),cloudGatewaySessionId:y().min(1).optional(),cloudPendingCommand:P({id:y().min(1),text:y(),prepared:se().optional()}).optional(),cwd:y().min(1),tool:V("claude").or(y().min(1)).default("claude"),toolSessionId:y().optional(),label:y().optional(),model:y().optional(),permissionMode:y().optional(),effort:y().optional(),serviceTier:y().optional(),...OT,aiLabelGeneratedAt:y().optional(),permissionRules:G(b$).optional(),pinnedAt:H().int().nonnegative().nullable().optional(),archivedAt:H().int().nonnegative().nullable().optional(),pinSortOrder:H().int().nullable().optional(),unreadAt:y().min(1).nullable().optional(),iconKey:y().optional(),forkedFromSessionId:y().min(1).optional(),ephemeral:se().optional(),deployId:y().min(1).optional(),ownerPersonaId:y().min(1).optional(),projectPath:y().min(1).optional(),chatId:y().min(1).optional(),creatorPrincipalId:y().min(1).optional(),creatorDisplayName:y().min(1).optional(),creatorFeishuUnionId:y().min(1).optional(),originOwnerPrincipalId:y().min(1).optional(),originOwnerPersonaId:y().min(1).optional(),dispatchedFromSessionId:y().min(1).optional(),shiftFiredFromSessionId:y().min(1).optional(),larkChatId:y().min(1).optional(),larkChatName:y().min(1).optional(),larkChatType:xe(["p2p","group"]).optional(),createdAt:y().min(1),updatedAt:y().min(1)});const qn={turnId:y().min(1).optional(),seq:H().int().nonnegative().optional(),ts:y().optional(),uuid:y().optional()},w$=xe(u$),S$=P({readCount:H().int().nonnegative().optional(),searchCount:H().int().nonnegative().optional(),bashCount:H().int().nonnegative().optional(),editFileCount:H().int().nonnegative().optional(),linesAdded:H().int().nonnegative().optional(),linesRemoved:H().int().nonnegative().optional(),otherToolCount:H().int().nonnegative().optional()}),k$=P({oldStart:H().int().nonnegative(),oldLines:H().int().nonnegative(),newStart:H().int().nonnegative(),newLines:H().int().nonnegative(),lines:G(y())}),C$=P({agentId:y().optional(),agentType:y().optional(),status:y().optional(),prompt:y().optional(),filePath:y().optional(),structuredPatch:G(k$).optional(),stats:P({durationMs:H().int().nonnegative().optional(),tokens:H().int().nonnegative().optional(),toolUseCount:H().int().nonnegative().optional(),toolStats:S$.optional()}).optional()}),E$=P({path:y(),content:y(),mtimeMs:H().optional()}),I$=P({label:y().min(1),description:y().optional()}),$T=P({question:y().min(1),multiSelect:se(),options:G(I$).min(1)}),N$=["completed","interrupted"];Jn("kind",[P({...qn,kind:V("session_init"),toolSessionId:y().optional()}),P({...qn,kind:V("thinking"),text:y(),partialId:y().optional()}),P({...qn,kind:V("text"),text:y(),partialId:y().optional()}),P({...qn,kind:V("user_text"),text:y(),meta:w$.optional(),taskId:y().optional(),parentToolUseId:y().optional(),sender:f$.optional()}),P({...qn,kind:V("tool_call"),toolUseId:y(),tool:y(),toolKind:y().optional(),input:Gi()}),P({...qn,kind:V("tool_result"),toolUseId:y(),output:Gi().optional(),error:y().optional(),toolResultExtra:C$.optional(),sourceToolAssistantUUID:y().optional(),askQuestionAnswers:Dr(y(),y()).optional()}),P({...qn,kind:V("attachment_memories"),memories:G(E$)}),P({...qn,kind:V("permission_request"),requestId:y(),tool:y(),input:Gi(),toolUseId:y().optional()}),P({...qn,kind:V("ask_user_question"),toolUseId:y(),questions:G($T)}),P({...qn,kind:V("turn_end"),durationMs:H().int().nonnegative().optional(),reason:xe(N$).optional(),turnId:y().min(1).optional()}),P({...qn,kind:V("subagent_progress"),toolUseId:y(),agentId:y(),status:xe(["started","running","completed","failed"]),description:y().optional(),lastToolName:y().optional(),prompt:y().optional(),stats:P({durationMs:H().int().nonnegative().optional(),tokens:H().int().nonnegative().optional(),toolUseCount:H().int().nonnegative().optional()}).optional()}),P({...qn,kind:V("error"),message:y()}),P({...qn,kind:V("meta_update"),patch:g$}),P({...qn,kind:V("meta-text"),text:y(),metaSource:xe(["cc","owner"]).optional()})]);P({cwd:y().min(1).optional(),tool:y().optional(),label:y().optional(),aiLabel:y().optional(),model:y().optional(),permissionMode:y().optional(),effort:y().optional(),serviceTier:xT.optional(),iconKey:y().optional(),forkedFromSessionId:y().min(1).optional(),forkAt:zB([P({messageUuid:y().min(1)}).strict(),P({turnId:y().min(1)}).strict()]).optional(),ephemeral:se().optional(),ownerPersonaId:y().min(1).optional(),projectPath:y().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});P({path:y().min(1),name:y().min(1),createdAt:y().datetime(),pinnedAt:H().optional()});P({path:y().min(1),pinnedAt:H().nullable()});P({path:y().min(1)});P({path:y().min(1).optional(),name:y().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});P({cwd:y().min(1),tool:y().min(1),toolSessionId:y().min(1),label:y().optional(),aiLabel:y().optional(),iconKey:y().optional(),createdAt:y().datetime(),updatedAt:y().datetime(),ownerPersonaId:y().min(1).optional()});P({originOnly:se().optional(),ownerPersonaId:y().min(1).optional(),limit:H().int().positive().optional(),offset:H().int().nonnegative().optional()});P({sessionId:y().min(1)});P({sessionId:y().min(1),patch:P({label:y().optional(),model:y().optional(),permissionMode:y().optional(),effort:y().optional(),cwd:y().optional(),iconKey:y().optional(),ephemeral:V(!1).optional()})});P({id:y().min(1),text:y(),queuedAt:H(),senderDisplayName:y().optional()});P({sessionId:y().min(1),text:y(),queueWhileRunning:se().optional()});P({sessionId:y().min(1),id:y().min(1).optional()});P({sessionId:y().min(1),userMessageId:y().min(1),dryRun:se().optional()});P({canRewind:se(),error:y().optional(),filesChanged:G(y()).optional(),insertions:H().int().nonnegative().optional(),deletions:H().int().nonnegative().optional()});P({sessionId:y().min(1),userMessageId:y().min(1)});const T$=P({oldStart:H().int().nonnegative(),oldLines:H().int().nonnegative(),newStart:H().int().nonnegative(),newLines:H().int().nonnegative(),lines:G(y())}),P$=P({filePath:y().min(1),hunks:G(T$),insertions:H().int().nonnegative(),deletions:H().int().nonnegative(),status:xe(["modified","added","deleted"]).optional()});P({canRewind:se(),error:y().optional(),files:G(P$),totalInsertions:H().int().nonnegative(),totalDeletions:H().int().nonnegative()});P({userMessageIds:G(y())});P({sessionId:y().min(1),toolSessionId:y().min(1)});P({cwd:y().min(1),toolSessionId:y().min(1),messageUuid:y().min(1).optional(),turnId:y().min(1).optional(),sourceSessionId:y().min(1).optional(),targetCwd:y().min(1).optional()}).refine(e=>!!(e.messageUuid||e.turnId),"messageUuid or turnId required");P({forkedToolSessionId:y().min(1),forkedFilePath:y().min(1)});P({sessionId:y().min(1),toolSessionId:y().min(1),jsonlPath:y().optional()});P({sessionId:y().min(1),afterSeq:H().int().min(-1)});P({sessionId:y().min(1),permissionRequestId:y().min(1),allow:se(),permanent:se().optional(),pattern:y().optional()});P({projectPath:y().min(1)});P({sessionId:y().min(1),limit:H().int().positive().max(5e3).optional(),offset:H().int().nonnegative().optional(),snapshotId:y().uuid().optional(),slim:se().optional(),view:xe(["turns","items"]).optional(),cursor:y().min(1).max(16384).optional(),turnId:y().min(1).max(256).optional()}).superRefine((e,t)=>{e.view==="items"&&!e.turnId&&t.addIssue({code:X.custom,path:["turnId"],message:"items requires turnId"}),e.view&&(e.offset!==void 0||e.slim!==void 0)&&t.addIssue({code:X.custom,message:"native views do not accept offset or slim"}),!e.view&&(e.cursor!==void 0||e.turnId!==void 0)&&t.addIssue({code:X.custom,message:"cursor and turnId require a native view"}),e.view==="turns"&&e.turnId!==void 0&&t.addIssue({code:X.custom,path:["turnId"],message:"turns does not accept turnId"}),e.view&&e.limit!==void 0&&e.limit>100&&t.addIssue({code:X.custom,path:["limit"],message:"native page limit is 100"})});P({cwd:y().min(1),toolSessionId:y().min(1)});P({cwd:y().min(1),toolSessionId:y().min(1),subagentId:y().min(1)});P({cwd:y().min(1).optional(),path:y().optional(),showHidden:se().optional()});P({cwd:y().min(1),path:y().min(1)});P({cwd:y().min(1),tool:y().optional()});P({name:y().min(1),source:xe(d$),path:y().optional(),description:y().optional(),plugin:y().optional()});const R$=P({name:y().min(1),source:xe(h$),path:y().optional(),description:y().optional(),whenToUse:y().optional(),plugin:y().optional()});P({cwd:y().min(1),tool:y().optional()});P({agents:G(R$)});P({sessionId:y().optional()});P({sessionId:y().min(1).optional()});P({sessionId:y().min(1),pinned:se()});P({sessionId:y().min(1),archived:se()});P({query:y().min(1),sessionIds:G(y().min(1)),limit:H().int().positive().max(50).optional()});const M$=P({sessionId:y().min(1),snippet:y()});P({type:V("session:searchContent"),matches:G(M$)});P({type:V("peerSession:upsert:ok")});P({sessionId:y().min(1)});P({type:V("peerSession:remove:ok")});P({orderedIds:G(y().min(1)).min(1)});P({cwd:y().min(1)});P({isGitRoot:se(),gitRoot:y().nullable()});P({cwd:y().min(1)});P({branch:y().nullable()});P({cwd:y().min(1)});P({branches:G(y()),head:y().nullable()});const A$=P({cwd:y().min(1),updatedAt:y().min(1)});P({dirs:G(A$)});P({type:V("session:question"),sessionId:y().min(1),toolUseId:y().min(1),requestId:y().min(1),questions:G($T).min(1)});P({type:V("session:question:cleared"),sessionId:y().min(1),toolUseId:y().min(1),answers:Dr(y(),y()).optional()});P({sessionId:y().min(1),toolUseId:y().min(1),answers:Dr(y(),y())});P({ok:V(!0)});P({sessionId:y().min(1),toolUseId:y().min(1)});P({ok:V(!0)});const zT=P({name:y().min(1),version:y().min(1),instanceId:y().min(1),deviceLabel:y().transform(e=>e.trim().slice(0,64)).optional()});P({type:V("auth"),token:y().min(1),scheme:V("bearer").optional(),clientInfo:zT.optional()});P({type:V("auth:ok"),version:y().min(1).optional(),protocolVersion:H().int().nonnegative().optional()});const j$=P({clientId:y().min(1),connectedAt:H().int().nonnegative(),self:se(),clientInfo:zT.optional()});P({type:V("device:connections:ok"),connections:G(j$)});P({type:V("tunnel:ready"),url:y().min(1),subdomain:y().min(1)});P({type:V("tunnel:exited"),code:H().int().nullable(),subdomain:y().nullable(),url:y().nullable()});P({type:V("tunnel:unavailable"),reason:y().min(1),failedAt:y().min(1)});const L$=P({sessionId:y().min(1),status:p$,freshSpawn:se(),pendingPermissionRequestIds:G(y().min(1)),pendingQuestionToolUseIds:G(y().min(1))});P({type:V("info"),version:y(),protocolVersion:H(),hostname:y(),os:y(),tools:G(P({id:y(),available:se()})),runningSessions:G(L$),tokenRole:xe(VB).optional(),isLoopback:se().optional(),httpBaseUrl:y().optional(),httpToken:y().optional(),daemonSource:xe(["ota","packaged"]).optional(),globalCliVersion:y().nullable().optional()});P({});P({method:y().min(1).optional()});const D$=["allowed","conditional","denied"],O$=xe(D$),B$=P({name:y().min(1),status:O$,description:y().min(1),args:G(P({name:y(),required:se()})).nullable(),argsSchema:Dr(Gi()).optional(),reason:y().optional()});P({type:V("meta:methods"),methods:G(B$)});const FS=1,$$=P({usedBytes:H().int().nonnegative(),sizeBytes:H().int().positive(),measuredAt:H().int().nonnegative()}).strict();P({volume:$$.nullable()}).strict();const HS=25*1024*1024,Qy={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".pdf":"application/pdf",".txt":"text/plain",".md":"text/plain",".markdown":"text/plain",".csv":"text/plain",".log":"text/plain",".json":"application/json",".xml":"application/xml",".yaml":"application/yaml",".yml":"application/yaml",".html":"text/html",".conf":"text/plain",".cfg":"text/plain",".ini":"text/plain",".toml":"text/plain"},FT=new Set([...Object.values(Qy),"application/x-yaml"]),z$=[...FT,"text/*",...Object.keys(Qy)].join(",");function HT(e,t){const n=t.split(";",1)[0].trim().toLowerCase();if(n===""||n==="application/octet-stream"){const r=e.lastIndexOf("."),i=r>0?e.slice(r).toLowerCase():"";return Qy[i]??null}return FT.has(n)||n.startsWith("text/")?n:null}const F$=["daemon","main","renderer"],H$=xe(F$),U$=["debug","info","warn","error"],W$=xe(U$);P({ts:H().int(),source:H$,level:W$,msg:y(),ownerPrincipalId:y(),deviceId:y(),appVersion:y(),daemonVersion:y().optional(),os:y(),meta_json:y().optional(),sessionId:y().optional()});P({v:V(1),visitorId:y().min(1),displayName:y(),provider:y(),iat:H(),exp:H()});const q$=P({visitorId:y(),displayName:y(),avatarUrl:y().optional(),provider:y(),firstSeen:H(),lastSeen:H()});P({visitors:G(q$)});P({type:V("web:open"),url:y().min(1),expiresAt:H()});P({ticket:y().min(1)}).strict();P({token:y().min(1),expiresAt:H()});const V$=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,UT=/<system-reminder>此消息来自 (owner|guest):(.+?)<\/system-reminder>\s*$/,WT="clawd-dispatch-task",qT="clawd-dispatch-result",US=120;function K$(e){if(!e)return null;const t=e.search(WS(WT)),n=e.search(WS(qT));return t<0&&n<0?null:n<0?"task":t<0?"result":t<n?"task":"result"}function G$(e){if(!e)return[];const t=[];for(const n of["task","result"]){const r=n==="task"?WT:qT,i=new RegExp(`<${r}\\b([^>]*)>([\\s\\S]*?)</${r}>`,"gi");for(let s=i.exec(e);s!==null;s=i.exec(e))t.push({at:s.index,block:Y$(n,s[1]??"",s[2]??"")})}return t.sort((n,r)=>n.at-r.at).map(n=>n.block)}function Y$(e,t,n){var c;const r=nz(t),i=ux(tz(kg(n,"detail")??n)),s=(c=kg(n,"brief"))==null?void 0:c.trim(),o=s&&s.length>0?ux(s):X$(i),a=r.round!==void 0?Number.parseInt(r.round,10):void 0,l=r.status;return{kind:e,dispatchId:r["dispatch-id"]??"",...r.from?{from:r.from}:{},...e==="task"&&a!==void 0&&Number.isFinite(a)?{round:a}:{},...e==="result"&&(l==="success"||l==="failure")?{status:l}:{},brief:o,briefIsDerived:!(s&&s.length>0),detail:i,filePaths:ez(kg(n,"files"))}}function X$(e){const t=e.split(/\n\s*\n/).map(r=>r.trim()).find(r=>r.length>0);if(!t)return"";const n=t.replace(/\s+/g," ");return n.length>US?`${n.slice(0,US)}…`:n}const Z$="clawd-dispatch-task|clawd-dispatch-result|brief|detail|files",Q$=new RegExp(`<\\\\(\\\\*)(/?)(${Z$})\\b`,"g");function J$(e){return ux(e)}function ux(e){return e.replace(Q$,"<$1$2$3")}function kg(e,t){const n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`,"i").exec(e);return n?n[1]??"":null}function ez(e){return e?e.split(`
|
|
96
|
-
`).map(t=>t.trim()).filter(t=>t.startsWith("- ")).map(t=>t.slice(2).trim()).filter(t=>t.length>0):[]}function tz(e){return e.replace(/^\n/,"").replace(/\n$/,"")}function WS(e){return new RegExp(`<${e}\\b[^>]*>`,"i")}function nz(e){const t={},n=/([a-z-]+)="([^"]*)"/gi;for(let r=n.exec(e);r!==null;r=n.exec(e))t[r[1]]=rz(r[2]??"");return t}function rz(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}const iz=new Set(["localhost","127.0.0.1","0.0.0.0","::1"]);let Ai=null;function sz(){if(Ai!==null)return Ai;if(typeof window>"u")return Ai=!1,!1;if(iz.has(window.location.hostname)||window.location.protocol==="file:")return Ai=!0,!0;if(new URLSearchParams(window.location.search).get("debug")==="1"){Ai=!0;try{sessionStorage.setItem("debug","1")}catch{}}else try{Ai=sessionStorage.getItem("debug")==="1"}catch{Ai=!1}return Ai}function $e(e,...t){sz()&&console.log(`[${e}][${new Date().toISOString()}]`,...t)}function Ud(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const oz=e=>{const t=[1e3,2e3,4e3,8e3,16e3,3e4];return t[Math.min(e,t.length-1)]},az=new Set(["auth:ok","pong","error"]),qS=new Set(jT.filter(e=>!az.has(e)));let lz=0;const VS=()=>`r${++lz}`;function cz(e){let t=e.url,n=e.authToken,r=e.selfIdentity;const i=e.clientInfo,s=e.requestTimeoutMs??3e4,o=e.pingIntervalMs??3e4,a=e.watchdogMs??6e4,l=e.authTimeoutMs??1e4,c=e.backoffMs??oz;let u=null,d=!1,f=0,p=null,m=null,v=null,w=null,x=!1,_="disconnected";const b=new Map,S=new Map;let C=null;const k=(B,I)=>{var U;B==="ready"&&(C=I),(U=S.get(B))==null||U.forEach(q=>{try{q(I)}catch{}})},T=B=>{_!==B&&(_=B,k("status",B))},E=(B,I)=>{const U=S.get(B)??new Set;if(U.add(I),S.set(B,U),B==="ready"&&C!==null)try{I(C)}catch{}return()=>U.delete(I)},D=()=>{m&&(clearInterval(m),m=null),v&&(clearTimeout(v),v=null),w&&(clearTimeout(w),w=null)},N=()=>{v&&clearTimeout(v),v=setTimeout(()=>{try{u==null||u.close(4e3,"pong watchdog")}catch{}},a)},L=()=>{m&&clearInterval(m),m=setInterval(()=>{(u==null?void 0:u.readyState)===1&&u.send(JSON.stringify({type:"ping",requestId:VS()}))},o),N()},R=B=>{for(const[,I]of b)clearTimeout(I.timer),I.reject(new Error(B));b.clear()},M=[],A=()=>{if(M.length===0)return;const B=M.splice(0);for(const I of B)(u==null?void 0:u.readyState)===1&&!x?I.doSend():(clearTimeout(I.timer),I.reject(new Error("NOT_CONNECTED")))},j=B=>{if(M.length===0)return;const I=M.splice(0);for(const U of I)clearTimeout(U.timer),U.reject(new Error(B))},z=()=>{if(d)return;const B=c(f);if(B<0){j("connection closed: not reconnecting");return}k("daemon:reconnecting",{attempt:f+1,nextDelayMs:B,scheduledAt:Date.now()}),p&&clearTimeout(p),p=setTimeout(()=>{f+=1,$()},B)},F=B=>{N();const I=String(B.type??"");if(I==="auth:ok"){$e("daemon-client","auth:ok received → connected",{url:t}),w&&(clearTimeout(w),w=null),x=!1,f=0,T("connected"),k("daemon:connected",{url:t}),L(),A();return}if(I==="pong")return;if(I==="ready"){const q=Number(B.protocolVersion??-1);q!==FS&&k("daemon:version-mismatch",{daemonProtocol:q,supportedProtocol:FS}),k("ready",B);return}const U=B.requestId;if(typeof U=="string"&&b.has(U)){const q=b.get(U);if(b.delete(U),clearTimeout(q.timer),I==="error"){const O=String(B.code??"ERR"),te=String(B.message??"unknown");q.reject(new Error(`${O}: ${te}`))}else qS.has(I)&&k(I,B),q.resolve(B);return}qS.has(I)&&k(I,B)},$=()=>{p&&(clearTimeout(p),p=null),$e("daemon-client","connect →",{url:t,token:Ud(n),attempt:f}),T("connecting");let B;try{B=new WebSocket(t)}catch(I){T("disconnected"),k("daemon:disconnected",{reason:(I==null?void 0:I.message)??"ws constructor failed"}),z();return}u=B,x=!!n,B.onopen=()=>{if(B!==u){$e("daemon-client","onopen → stale (replaced before opened), ignore");return}if(n){$e("daemon-client","onopen → send auth frame",{token:Ud(n)});const I={type:"auth",token:n};r!=null&&r.principalId&&(I.selfPrincipalId=r.principalId),r!=null&&r.displayName&&(I.selfDisplayName=r.displayName),i&&(I.clientInfo=i),B.send(JSON.stringify(I)),w=setTimeout(()=>{try{B.close(4001,"auth handshake timeout")}catch{}},l)}else $e("daemon-client","onopen → no token, treat as connected (daemon authMode=none)"),f=0,T("connected"),k("daemon:connected",{url:t}),L(),A()},B.onclose=I=>{if(B!==u){$e("daemon-client","onclose → stale, ignore",{code:I.code,reason:I.reason});return}const U=I.reason||(I.code===1008?"auth failed":`close ${I.code}`);if($e("daemon-client","onclose →",{code:I.code,reason:U,awaitingAuth:x,manualStop:d}),D(),R(`connection closed: ${U}`),u=null,I.code===4401?T("revoked"):T("disconnected"),k("daemon:disconnected",{reason:U}),I.code===1008||I.code===4401){j(`connection closed: ${U}`);return}d?j(`connection closed: ${U}`):z()},B.onerror=()=>{},B.onmessage=I=>{if(B!==u)return;let U;try{U=JSON.parse(String(I.data))}catch{return}F(U)}};return{start(){d=!1,f=0,$()},stop(){d=!0,p&&(clearTimeout(p),p=null),D();try{u==null||u.close(1e3,"shutdown")}catch{}u=null,R("shutdown"),j("shutdown"),T("disconnected")},switchProfile(B){$e("daemon-client","switchProfile →",{url:B.url,token:Ud(B.authToken)},"prev:",{url:t,token:Ud(n)}),t=B.url,n=B.authToken,B.selfIdentity!==void 0&&(r=B.selfIdentity),f=0,d=!0,p&&(clearTimeout(p),p=null),D(),R("switch profile"),j("switch profile");try{u==null||u.close(1e3,"switch profile")}catch{}u=null,d=!1,$()},request(B,I,U){return new Promise((q,O)=>{const te=(U==null?void 0:U.requestId)??VS(),le=performance.now();let Y;const re=I,ke=B==="cloud:workspace"&&((re==null?void 0:re.action)==="repositories"||(re==null?void 0:re.action)==="branches"),oe=(he,Be)=>{var Ge;if(!ke)return;const Qe=performance.now();k("cloud:workspace:timing",{traceId:te,phase:he,outcome:Be,sessionId:re==null?void 0:re.sessionId,action:re==null?void 0:re.action,page:re==null?void 0:re.page,searchLength:((Ge=re==null?void 0:re.search)==null?void 0:Ge.length)??0,hasSearch:!!(re!=null&&re.search),hasCursor:!!(re!=null&&re.cursor),durationMs:Math.round(Qe-le),queueMs:Math.round((Y??Qe)-le),roundTripMs:Y===void 0?void 0:Math.round(Qe-Y)})},Ie=(he,Be="error")=>{oe("finished",Be),O(he)};oe("started");const Ee=setTimeout(()=>{b.delete(te);const he=M.findIndex(Be=>Be.timer===Ee);he>=0&&M.splice(he,1),Ie(new Error(`request timeout: ${B}`),"timeout")},B==="cloud:workspace"?Math.max(s,33e4):s),Re=()=>{Y=performance.now(),oe("sent"),b.set(te,{resolve:he=>{oe("finished","ok"),q(he)},reject:Ie,timer:Ee}),u.send(JSON.stringify({...I,type:B,requestId:te}))};(u==null?void 0:u.readyState)===1&&!x?Re():d||u==null&&p==null?(clearTimeout(Ee),Ie(new Error("NOT_CONNECTED"),"disconnected")):M.push({doSend:Re,reject:Ie,timer:Ee})})},on:E,get isOpen(){return(u==null?void 0:u.readyState)===1&&!x},get url(){return t},getStatus(){return _}}}function uz(e){const t=e.trim(),n=t.indexOf("#");if(n<0)return{url:t};const r=t.slice(0,n),i=t.slice(n+1),o=new URLSearchParams(i).get("token")??void 0;return{url:r,token:o??void 0}}function dz(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}function hz(e){return e?{id:e.id,mode:e.mode,url:e.url,token:dz(e.token),name:e.name}:null}function Wd(e){return e?Array.isArray(e)?e.map(hz):{_notArray:typeof e,_value:e}:null}function KS(e){return e==null?null:typeof e=="object"&&"value"in e?e.value:e}const fz="ws://127.0.0.1:18790",GS="daemon:profiles",YS="daemon:active-profile-id";function pz(){return Math.random().toString(36).slice(2,10)}function mz(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.name=="string"&&(t.mode==="localhost"||t.mode==="remote")&&typeof t.url=="string"&&(t.token===void 0||typeof t.token=="string")}function VT(e){let t={profiles:[],activeId:null},n=!1,r=null;const i=new Set,s=()=>{for(const l of i)l(t)},o=async()=>{$e("profile-store","persist →",Wd(t.profiles),"active:",t.activeId),await e.kv.set(GS,t.profiles),await e.kv.set(YS,t.activeId)},a=async()=>{if(!n){if(r){await r;return}r=(async()=>{var l;try{let c=null;try{const d=await e.kv.get(GS);c=KS(d)}catch{c=null}let u=null;try{const d=await e.kv.get(YS);u=KS(d)??null}catch{u=null}if($e("profile-store","ensureLoaded read kv →","profiles:",Wd(c),"activeId:",u),Array.isArray(c)&&c.length>0){const d=c.filter(mz),f=u&&d.some(p=>p.id===u)?u:((l=d[0])==null?void 0:l.id)??null;t={profiles:d,activeId:f},n=!0,$e("profile-store","ensureLoaded → use kv profiles",Wd(d),"active:",f);return}t={profiles:[{id:"default",name:"本机",mode:"localhost",url:fz}],activeId:"default"},$e("profile-store","ensureLoaded → fallback synthesized default (NO token)",Wd(t.profiles)),n=!0,await o()}finally{r=null}})(),await r}};return{async load(){return await a(),s(),t},async snapshot(){return await a(),t},async upsert(l){var w;await a();let c=l.url,u=l.token;if(c&&c.includes("#")){const x=uz(c);c=x.url,!u&&x.token&&(u=x.token)}const d=l.id?t.profiles.find(x=>x.id===l.id):void 0,f=u!=null&&u.trim()?u.trim():d==null?void 0:d.token;if(l.mode==="remote"&&!f)throw new Error("remote mode requires token");const p=l.id??pz(),m={id:p,name:((w=l.name)==null?void 0:w.trim())||(d==null?void 0:d.name)||(l.mode==="remote"?"远程":"本机"),mode:l.mode,url:c.trim(),token:f};return t={profiles:[...t.profiles.filter(x=>x.id!==p),m],activeId:p},await o(),s(),m},async delete(l){var d;await a();const c=t.profiles.filter(f=>f.id!==l);let u=t.activeId;u===l&&(u=((d=c[0])==null?void 0:d.id)??null),t={profiles:c,activeId:u},await o(),s()},async activate(l){await a(),t.profiles.some(c=>c.id===l)&&(t={...t,activeId:l},await o(),s())},subscribe(l){return i.add(l),()=>i.delete(l)},getActive(){return n?t.profiles.find(l=>l.id===t.activeId)??null:null}}}const XS="clawd.client-instance-id";let gz={name:"clawd-web",version:"unknown"};function vz(){let e=null;try{e=localStorage.getItem(XS),e||(e=crypto.randomUUID(),localStorage.setItem(XS,e))}catch{e=e??crypto.randomUUID()}return{...gz,instanceId:e}}const xz=g.createContext(null);function yz(){return g.useContext(xz)}function ZS(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const KT=g.createContext(null);function _z({host:e,children:t}){const[n,r]=g.useState(null),i=yz(),s=g.useRef(i);s.current=i;const o=l=>{const c=s.current;return c&&c.profileId===l.id?c.getToken()??l.token:l.token},a=g.useMemo(()=>async()=>{const l=VT(e),c=await l.load(),u=c.profiles.find(f=>f.id===c.activeId)??c.profiles[0];if(!u)throw new Error("DaemonProvider: profile store has no profiles after load");return $e("daemon-context","bootstrap → createDaemonClient",{id:u.id,url:u.url,token:ZS(o(u))}),{client:cz({url:u.url,authToken:o(u),clientInfo:vz()}),store:l}},[e]);return g.useEffect(()=>{let l=!0,c=null,u=null;return a().then(d=>{l&&(d.client.start(),c=d,r(d),u=d.store.subscribe(()=>{const f=d.store.getActive();if(!f){$e("daemon-context","subscribe → no active profile, skip switchProfile");return}$e("daemon-context","subscribe → switchProfile",{id:f.id,url:f.url,token:ZS(f.token)}),d.client.switchProfile({url:f.url,authToken:o(f)})}))}),()=>{l=!1,u==null||u(),c==null||c.client.stop()}},[a]),n?h.jsx(KT.Provider,{value:n,children:t}):null}function Ni(){const e=g.useContext(KT);if(!e)throw new Error("useDaemonClient must be used inside <DaemonProvider>");return e.client}function bz(){const e=Ni(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i.mode,o=s==="tui"?"tui":"sdk";$e("daemon-context","useDaemonMode ready.mode =",{rawMode:s,resolved:o}),n(o)}),[e]),t}function wz(){const e=Ni(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i;s.version!==void 0&&n(s.principalKind==="guest"?"guest":"owner")}),[e]),t}const GT=g.createContext(null);function Sz({cache:e,children:t}){return g.createElement(GT.Provider,{value:e},t)}function as(){const e=g.useContext(GT);if(!e)throw new Error("useCache must be used inside <CacheProvider>");return e}function ts(e){const t=as(),n=g.useCallback(i=>t.observe(e,()=>i()),[t,e]),r=g.useCallback(()=>t.read(e),[t,e]);return g.useSyncExternalStore(n,r,r)}const YT={actionsLevel:"none",httpBaseUrl:null,httpToken:null},XT=g.createContext(YT);function Qp(){return g.useContext(XT)}function kz(e){return e!=null&&e.httpBaseUrl?{actionsLevel:e.tokenRole==="owner"?"owner":"none",httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken??null}:YT}function Cz(){const e=ts("daemon-info");return g.useMemo(()=>kz(e),[e])}function Ez({children:e}){const t=Cz();return Je.createElement(XT.Provider,{value:t},e)}function Iz(e,t,n){if(!e.httpBaseUrl)return null;const r=encodeURIComponent(n);return`${e.httpBaseUrl}/session/${encodeURIComponent(t.sessionId)}/files?path=${r}`}function Nz(e){const t=new Map;return{observe(n,r){let i=t.get(n);i||(i={data:void 0,hasData:!1,listeners:new Set},t.set(n,i));const s=l=>r(l);i.listeners.add(s);const o=i.listeners.size===1;s(i.hasData?i.data:void 0),o&&e.onFirstObserver(n);let a=!1;return()=>{if(a)return;a=!0;const l=t.get(n);l&&(l.listeners.delete(s),l.listeners.size===0&&(t.delete(n),e.onLastObserver(n)))}},read(n){const r=t.get(n);return r!=null&&r.hasData?r.data:void 0},setData(n,r){const i=t.get(n);if(!i)return;const s=i.hasData?i.data:void 0,o=r(s);i.data=o,i.hasData=!0;for(const a of i.listeners)a(o)}}}function Tz(){const e=[],t=new Map,n=r=>{for(const i of e)if(i.pattern.test(r))return i.source;return null};return{register(r,i){e.push({pattern:r,source:i})},activate(r){if(t.has(r))return;const i=n(r);if(!i)throw new Error(`no source registered for key: ${r}`);t.set(r,i.start(r))},deactivate(r){const i=t.get(r);i&&(t.delete(r),i())}}}function Pz(e){return{request:(t,n)=>e.request(t,n),onFrame(t){const n=[];for(const r of jT)n.push(e.on(r,i=>t(r,i)));return()=>{for(const r of n)r()}},onConnect(t){return e.on("daemon:connected",()=>t())},get isConnected(){return e.isOpen}}}function ZT(e){const t=(e??"claude")==="claude";return{rewind:t,subagents:t,tui:t,observe:t,fileSharing:t,fork:t}}const Rz=e=>({tool:e,models:[{id:"",label:"未指定",contextWindowSize:2e5,default:!0}],permissionModes:[{id:"",label:"未指定"}],configSchema:[],features:ZT(e)});function Mz(e,t){return{start(n){const r=n.replace(/^capabilities\//,"");let i=!1;const s=async()=>{try{const a=await e.request("capabilities:get",{tool:r});if(i)return;t(n,()=>a)}catch{if(i)return;t(n,()=>Rz(r))}},o=e.onConnect(()=>{s()});return s(),()=>{i=!0,o()}}}}function Az(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("session:list",void 0);if(r)return;t(n,()=>a.sessions??[])}catch{}},s=e.onFrame((a,l)=>{if(a==="session:info"){const c=l;if(c.chatId!==void 0)return;t(n,u=>[c,...(u??[]).filter(d=>d.sessionId!==c.sessionId)])}else if(a==="session:deleted"){const c=l;t(n,u=>(u??[]).filter(d=>d.sessionId!==c.sessionId))}}),o=e.onConnect(()=>{i()});return i(),()=>{r=!0,s(),o()}}}}const zo={sessionId:null,events:[],lastSeq:-1,foldFloor:-1,pendingPermissions:[],status:"idle",pendingQuestions:{},queued:[]};function Cg(e,t){const n=t;if(n.kind==="permission_request"&&typeof n.requestId=="string"){if(e.some(i=>i.requestId===n.requestId))return e;const r={requestId:n.requestId,tool:typeof n.tool=="string"?n.tool:"",input:n.input,...typeof n.toolUseId=="string"&&n.toolUseId?{toolUseId:n.toolUseId}:{}};return[...e,r]}if(n.kind==="tool_result"&&typeof n.toolUseId=="string"&&n.toolUseId){const r=e.findIndex(i=>i.toolUseId===n.toolUseId);if(r>=0)return e.filter((i,s)=>s!==r)}return e}function dx(e){return e.kind==="text"||e.kind==="thinking"}function QT(e){return e.seqEnd??e.seq}function JT(e,t,n){if(!e||!dx(e)||!dx(t)||e.kind!==t.kind||!e.partialId||e.partialId!==t.partialId)return null;const r=QT(e);if(r===void 0||t.seq===void 0||t.seq!==r+1||r<=n)return null;const{uuid:i,...s}=e;return{...s,...t.uuid?{uuid:t.uuid}:{},text:e.text+t.text,seqEnd:t.seq}}function QS(e,t){const n=[];for(const r of e){const i=JT(n[n.length-1],r,t);i?n[n.length-1]=i:n.push(r)}return n}function Ff(e,t,n){const r=n===void 0?e.sessionId:n;switch(t.type){case"session:change":return{...zo,sessionId:t.sessionId};case"session:event":{if(!r||t.sessionId!==r)return e;const i=typeof t.event.seq=="number"?t.event.seq:-1,s=JT(e.events[e.events.length-1],t.event,e.foldFloor),o=s?[...e.events.slice(0,-1),s]:[...e.events,t.event],a=i>e.lastSeq?i:e.lastSeq,l=Cg(e.pendingPermissions,t.event);return{...e,events:o,lastSeq:a,pendingPermissions:l}}case"session:fold-barrier":return!r||t.sessionId!==r||e.foldFloor===e.lastSeq?e:{...e,foldFloor:e.lastSeq};case"session:status":return!r||t.sessionId!==r?e:{...e,status:t.status};case"session:queue":return!r||t.sessionId!==r?e:{...e,queued:t.items};case"session:events":{if(!r||t.sessionId!==r)return e;const i=QS(t.events.map(o=>o.event),e.foldFloor),s=i.reduce((o,a)=>Cg(o,a),[]);return{...e,sessionId:t.sessionId,events:i,lastSeq:t.latestSeq,pendingPermissions:s}}case"session:events:append":{if(!r||t.sessionId!==r)return e;const i=new Set;for(const c of e.events){const u=c.seq;if(typeof u!="number")continue;i.add(u);const d=dx(c)?QT(c):void 0;if(d!==void 0)for(let f=u+1;f<=d;f++)i.add(f)}const s=[];for(const c of t.events)typeof c.seq=="number"&&(i.has(c.seq)||s.push(c.event));const o=t.latestSeq>e.lastSeq?t.latestSeq:e.lastSeq;if(s.length===0)return o===e.lastSeq?e:{...e,lastSeq:o};const a=QS([...e.events,...s].sort((c,u)=>{const d=c.seq??-1,f=u.seq??-1;return d-f}),e.foldFloor),l=s.reduce((c,u)=>Cg(c,u),e.pendingPermissions);return{...e,events:a,lastSeq:o,pendingPermissions:l}}case"permission:request":{if(!r||t.sessionId!==r||e.pendingPermissions.some(s=>s.requestId===t.requestId))return e;const i={requestId:t.requestId,tool:t.tool,input:t.input,...t.toolUseId?{toolUseId:t.toolUseId}:{}};return{...e,pendingPermissions:[...e.pendingPermissions,i]}}case"permission:clear":{if(!r||r!==t.sessionId)return e;const i=t.requestId,s=e.pendingPermissions.findIndex(c=>c.requestId===i),o=s>=0?e.pendingPermissions.filter((c,u)=>u!==s):e.pendingPermissions;if(e.events.length===0)return o===e.pendingPermissions?e:{...e,pendingPermissions:o};const a=e.events.length-1,l=e.events[a];return l.kind==="permission_request"&&l.requestId===i?{...e,pendingPermissions:o,events:e.events.slice(0,a)}:o===e.pendingPermissions?e:{...e,pendingPermissions:o}}case"session:question":return!r||t.sessionId!==r?e:{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{toolUseId:t.toolUseId,requestId:t.requestId,questions:t.questions}}};case"session:question:clear":{if(!r||t.sessionId!==r||!(t.toolUseId in e.pendingQuestions))return e;const{[t.toolUseId]:i,...s}=e.pendingQuestions;return{...e,pendingQuestions:s}}case"session:question:submitted":{if(!r||t.sessionId!==r)return e;const i=e.pendingQuestions[t.toolUseId];return i?{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{...i,submittedAnswers:t.answers}}}:e}case"session:rewound":return!r||t.sessionId!==r?e:{...e,pendingPermissions:[],status:"idle"};case"ready":{if(!r)return e;const i=t.runningSessions.find(o=>o.sessionId===r);if(i!=null&&i.freshSpawn)return{...zo,sessionId:r};const s=(i==null?void 0:i.status)??"idle";return s===e.status?e:{...e,status:s}}case"daemon:disconnected":return{...e,pendingPermissions:[]};default:return e}}const jz="session/";function Lz(e){return{sid:e.slice(jz.length)}}const Dz=new Set(LT);function e4(e){return Dz.has(e)}function JS(e){return e4(e)?e:"idle"}function Oz(e,t){return{start(n){const{sid:r}=Lz(n);let i=!1,s=-1;const o=f=>{t(n,p=>Ff(p??zo,f,r))},a=async f=>{const p=f==="baseline"?-1:s;try{const m=await e.request("session:events",{sessionId:r,afterSeq:p});if(i)return;const v=m.events??[],w=m.latestSeq??-1;if(f==="baseline")o({type:"session:events",sessionId:r,events:v,latestSeq:w}),s=w;else{const x=m.bufferStartSeq??0,_=w<p||x>p+1;o({type:_?"session:events":"session:events:append",sessionId:r,events:v,latestSeq:w}),s=Math.max(s,w)}}catch{}},l=async()=>{try{const f=await e.request("info");if(i)return;o({type:"ready",runningSessions:(f.runningSessions??[]).map(p=>({sessionId:p.sessionId,freshSpawn:p.freshSpawn,status:JS(p.status)}))})}catch{}},c=async()=>{try{await e.request("session:subscribe",{sessionId:r})}catch{}i||(await a(s<0?"baseline":"delta"),!i&&await l())},u=e.onFrame((f,p)=>{if(!i)if(f==="session:event"){const m=p;if(m.sessionId!==r)return;const v=m.event.seq;o({type:"session:event",sessionId:m.sessionId,event:m.event}),typeof v=="number"&&v>s&&(s=v)}else if(f==="session:status"){const m=p;if(m.sessionId!==r)return;if(!e4(m.status)){$e("session-events","push session:status drop",{sid:r,status:m.status});return}$e("session-events","push session:status",{sid:r,status:m.status}),o({type:"session:status",sessionId:m.sessionId,status:m.status})}else if(f==="session:cleared"){if(p.sessionId!==r)return;$e("session-events","push session:cleared",{sid:r}),o({type:"session:change",sessionId:r}),s=-1}else if(f==="session:queue"){const m=p;if(m.sessionId!==r)return;$e("session-events","push session:queue",{sid:r,count:m.items.length}),o({type:"session:queue",sessionId:m.sessionId,items:m.items})}else if(f==="permission:request"){const m=p;if(m.sessionId!==r)return;o({type:"permission:request",sessionId:m.sessionId,requestId:m.requestId,tool:m.tool,input:m.input,...typeof m.toolUseId=="string"&&m.toolUseId?{toolUseId:m.toolUseId}:{}})}else if(f==="session:question"){const m=p;if(m.sessionId!==r)return;o({type:"session:question",sessionId:m.sessionId,toolUseId:m.toolUseId,requestId:m.requestId,questions:m.questions})}else if(f==="session:question:cleared"){const m=p;if(m.sessionId!==r)return;m.answers&&Object.keys(m.answers).length>0?o({type:"session:question:submitted",sessionId:m.sessionId,toolUseId:m.toolUseId,answers:m.answers}):o({type:"session:question:clear",sessionId:m.sessionId,toolUseId:m.toolUseId})}else if(f==="session:rewound"){const m=p;if(m.sessionId!==r)return;o({type:"session:rewound",sessionId:m.sessionId,userMessageId:m.userMessageId})}else f==="ready"&&o({type:"ready",runningSessions:(p.runningSessions??[]).map(v=>({sessionId:v.sessionId,freshSpawn:v.freshSpawn,status:JS(v.status)}))})}),d=e.onConnect(()=>{c()});return e.isConnected&&c(),()=>{i=!0,u(),d(),e.request("session:unsubscribe",{sessionId:r}).catch(()=>{})}}}}const Bz=new Set(["tunnel:ready","tunnel:exited","tunnel:unavailable"]);function $z(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("info",void 0);if(r)return;t(n,()=>a)}catch{}},s=e.onConnect(()=>{i()}),o=e.onFrame(a=>{Bz.has(a)&&i()});return i(),()=>{r=!0,s(),o()}}}}function zz(){return{start(){return()=>{}}}}function Fz(e,t){return{start(n){let r=!1;const i=async()=>{try{const o=await e.request("persona:list",{});if(r)return;t(n,()=>o.personas??[])}catch{}},s=e.onConnect(()=>{i()});return i(),()=>{r=!0,s()}}}}function Hz(e){const t=Pz(e),n=Tz();let r=null;const i=(o,a)=>{r==null||r.setData(o,a)};n.register(/^capabilities\//,Mz(t,i)),n.register(/^sessions$/,Az(t,i)),n.register(/^session\//,Oz(t,i)),n.register(/^personas$/,Fz(t,i)),n.register(/^persona-detail\//,zz()),n.register(/^daemon-info$/,$z(t,i));const s=Nz({onFirstObserver:o=>{o&&n.activate(o)},onLastObserver:o=>{o&&n.deactivate(o)}});return r=s,{cache:s,channel:t}}class Jp{constructor(t){this.client=t}info(){return this.client.request("info")}attachmentSignUrl(t){return this.client.request("attachment.signUrl",t)}attachmentGroupAdd(t,n,r){return this.client.request("attachment.groupAdd",{sessionId:t,relPath:n,...r?{label:r}:{}})}attachmentGroupRemove(t,n){return this.client.request("attachment.groupRemove",{sessionId:t,relPath:n})}attachmentGroupList(t){return this.client.request("attachment.groupList",{sessionId:t})}sessionCreate(t){return this.client.request("session:create",t)}projectList(){return this.client.request("project:list")}projectCreate(t){return this.client.request("project:create",{...t.path?{path:t.path}:{},...t.name?{name:t.name}:{}})}projectPatch(t){return this.client.request("project:patch",t)}projectReveal(t){return this.client.request("project:reveal",{path:t})}sessionList(){return this.client.request("session:list")}sessionGet(t){return this.client.request("session:get",{sessionId:t})}sessionUpdate(t,n){return this.client.request("session:update",{sessionId:t,patch:n})}sessionDelete(t){return this.client.request("session:delete",{sessionId:t})}sessionSend(t,n,r){return this.client.request("session:send",{sessionId:t,text:n,...r!=null&&r.queueWhileRunning?{queueWhileRunning:!0}:{}})}sessionDequeue(t,n){return this.client.request("session:dequeue",{sessionId:t,...n?{id:n}:{}})}sessionStop(t){return this.client.request("session:stop",{sessionId:t})}sessionInterrupt(t){return this.client.request("session:interrupt",{sessionId:t})}sessionRewind(t){return this.client.request("session:rewind",t)}sessionRewindableMessageIds(t){return this.client.request("session:rewindable-message-ids",{sessionId:t})}sessionRewindDiff(t){return this.client.request("session:rewind-diff",t)}sessionNew(t){return this.client.request("session:new",{sessionId:t})}sessionFork(t){return this.client.request("session:fork",t)}sessionResume(t,n){return this.client.request("session:resume",{sessionId:t,toolSessionId:n})}sessionObserve(t){return this.client.request("session:observe",t)}sessionEvents(t,n){return this.client.request("session:events",{sessionId:t,afterSeq:n})}sessionSubscribe(t){return this.client.request("session:subscribe",{sessionId:t})}sessionUnsubscribe(t){return this.client.request("session:unsubscribe",{sessionId:t})}pinSession(t,n){return this.client.request("session:pin",{sessionId:t,pinned:n})}searchSessionContent(t){return this.client.request("session:searchContent",t)}archiveSession(t,n){return this.client.request("session:archive",{sessionId:t,archived:n})}markSessionRead(t){return this.client.request("session:markRead",{sessionId:t})}reorderPins(t){return this.client.request("session:reorderPins",{orderedIds:t})}peerSessionUpsert(t){return this.client.request("peerSession:upsert",t)}peerSessionRemove(t){return this.client.request("peerSession:remove",{sessionId:t})}permissionRespond(t){return this.client.request("permission:respond",t)}answerQuestion(t){return this.client.request("session:answerQuestion",t)}cancelQuestion(t){return this.client.request("session:cancelQuestion",t)}historyProjects(){return this.client.request("history:projects")}historyList(t){return this.client.request("history:list",{projectPath:t})}historyRead(t){return this.client.request("history:read",t)}historyPage(t){return this.client.request("history:read",t)}historySubagents(t){return this.client.request("history:subagents",t)}historySubagentRead(t){return this.client.request("history:subagent-read",t)}listRecentDirs(){return this.client.request("history:recentDirs",{})}getGitRoot(t){return this.client.request("git:root",{cwd:t})}getGitBranch(t){return this.client.request("git:branch",{cwd:t})}listGitBranches(t){return this.client.request("git:branches",{cwd:t})}personaCreate(t){return this.client.request("persona:create",t)}personaList(){return this.client.request("persona:list",{})}personaGet(t){return this.client.request("persona:get",{personaId:t})}personaUpdate(t,n){return this.client.request("persona:update",{personaId:t,patch:n})}personaDelete(t){return this.client.request("persona:delete",{personaId:t})}larkBotBindManual(t,n,r){return this.client.request("larkBot:bindManual",{personaId:t,appId:n,appSecret:r})}larkBotUnbind(t){return this.client.request("larkBot:unbind",{personaId:t})}larkBotStatus(t){return this.client.request("larkBot:status",{personaId:t})}toolsProbe(){return this.client.request("tools:probe",{})}sessionExternalScan(){return this.client.request("session:externalScan",{})}sessionImportExternal(t){return this.client.request("session:importExternal",t)}onboardingComplete(){return this.client.request("onboarding:complete",{})}onboardingIosInterest(){return this.client.request("onboarding:iosInterest",{})}visitorList(){return this.client.request("visitor:list",{})}workspaceList(t={}){return this.client.request("workspace:list",t)}workspaceRead(t){return this.client.request("workspace:read",t)}skillsList(t,n){return this.client.request("skills:list",{cwd:t,...n?{tool:n}:{}})}agentsList(t,n){return this.client.request("agents:list",{cwd:t,...n?{tool:n}:{}})}capabilitiesGet(t="claude",n){return this.client.request("capabilities:get",{tool:t,...n!=null&&n.refresh?{refresh:!0}:{}})}engineStatus(t){return this.client.request("engine:status",{tool:t})}engineConnectPool(t){return this.client.request("engine:connectPool",{apiKey:t})}subscriptionChannelGet(){return this.client.request("subscriptionChannel:get",{})}subscriptionChannelSave(t){return this.client.request("subscriptionChannel:save",t)}subscriptionChannelDelete(t){return this.client.request("subscriptionChannel:delete",{id:t})}subscriptionChannelActivate(t){return this.client.request("subscriptionChannel:activate",{id:t})}subscriptionChannelModels(t={}){return this.client.request("subscriptionChannel:models",t)}shiftList(){return this.client.request("shift:list")}deployGet(t,n={}){return this.client.request("deploy:get",{personaId:t,...n})}deployGetLocal(t){return this.client.request("deploy:getLocal",{personaId:t})}deployScan(t,n){return this.client.request("deploy:scan",{personaId:t,...n?{scanBase:n}:{}})}deployPatch(t,n,r){return this.client.request("deploy:patch",{personaId:t,scanId:n,patch:r})}deployPutSecret(t,n,r,i,s){return this.client.request("deploy:putSecret",{personaId:t,scanId:n,name:r,values:i,...s?{environment:s}:{}})}deploySetEngineAuth(t,n,r){return n&&"channelId"in n?this.client.request("deploy:setEngineAuth",{personaId:t,channelId:n.channelId,...r?{environment:r}:{}}):this.client.request("deploy:setEngineAuth",{personaId:t,auth:n,...r?{environment:r}:{}})}deployRerunJob(t,n,r){return this.client.request("deploy:rerunJob",{personaId:t,jobId:n,...r?{environment:r}:{}})}deployUnpublish(t){return this.client.request("deploy:unpublish",{personaId:t})}deployRelease(t,n){return this.client.request("deploy:release",{personaId:t,scanId:n})}deployConfirmTest(t,n){return this.client.request("deploy:confirmTest",{personaId:t,releaseId:n})}deployApplyConfig(t,n){return this.client.request("deploy:applyConfig",{personaId:t,releaseId:n})}deployPromote(t,n){return this.client.request("deploy:promote",{personaId:t,releaseId:n})}deployOpenTest(t,n){return this.client.request("deploy:openTest",{personaId:t,releaseId:n})}cloudConnectorsList(t){return this.client.request("cloud:connectors:list",{personaId:t})}cloudWorkspace(t,n){return n?this.client.request("cloud:workspace",t,n):this.client.request("cloud:workspace",t)}cloudVolumeGet(){return this.client.request("cloud:volume:get",{})}dashboardOpenUrl(t){return this.client.request("dashboard:openUrl",{page:t})}cloudConnectorFill(t,n,r){return this.client.request("cloud:connectors:fill",{personaId:t,name:n,values:r})}channelList(){return this.client.request("channel:list")}channelCreate(t){return this.client.request("channel:create",t)}channelUpdate(t){return this.client.request("channel:update",t)}channelDelete(t){return this.client.request("channel:delete",t)}topicList(t){return this.client.request("topic:list",t)}topicGet(t){return this.client.request("topic:get",t)}topicCreate(t){return this.client.request("topic:create",t)}topicClose(t){return this.client.request("topic:close",t)}topicRename(t){return this.client.request("topic:rename",t)}topicDelete(t){return this.client.request("topic:delete",t)}personaDispatchList(t){return this.client.request("personaDispatch:list",t)}githubAuthGet(){return this.client.request("githubAuth:get")}githubAuthOauthStart(t){return this.client.request("githubAuth:oauthStart",t?{returnTo:t}:{})}githubAuthAuthorize(t){return this.client.request("githubAuth:authorize",{token:t})}githubStatus(){return this.client.request("github:status")}githubPrList(t){return this.client.request("github:prList",{role:t})}githubPrDetail(t){return this.client.request("github:prDetail",{...t})}githubPrMerge(t){return this.client.request("github:prMerge",{...t})}githubPrComment(t){return this.client.request("github:prComment",{...t})}githubPrSetReady(t){return this.client.request("github:prSetReady",{...t})}githubCollaborators(t){return this.client.request("github:collaborators",{...t})}githubPrRequestReviewers(t){return this.client.request("github:prRequestReviewers",{...t})}}function Uz(e){const[t,n]=g.useState(e.isOpen?{kind:"connected",url:""}:{kind:"connecting"});return g.useEffect(()=>{const r=e.on("ready",l=>{const c=l;n(u=>({kind:"connected",url:u.kind==="connected"?u.url:"",mode:u.kind==="connected"?u.mode:void 0,daemonVersion:c.version,protocolVersion:c.protocolVersion,daemonSource:c.daemonSource,globalCliVersion:c.globalCliVersion,onboardingCompletedAt:c.onboardingCompletedAt}))}),i=e.on("daemon:connected",l=>{const c=l;n(u=>({kind:"connected",url:c.url,mode:c.mode,daemonVersion:u.kind==="connected"?u.daemonVersion:void 0,protocolVersion:u.kind==="connected"?u.protocolVersion:void 0,daemonSource:u.kind==="connected"?u.daemonSource:void 0,globalCliVersion:u.kind==="connected"?u.globalCliVersion:void 0,onboardingCompletedAt:u.kind==="connected"?u.onboardingCompletedAt:void 0}))}),s=e.on("daemon:disconnected",l=>{const c=(l==null?void 0:l.reason)??"";/auth failed|auth timeout|auth required|auth handshake timeout/i.test(c)?n({kind:"auth-failed",reason:c}):n({kind:"disconnected",reason:c})}),o=e.on("daemon:reconnecting",l=>{const c=l;n({kind:"reconnecting",attempt:c.attempt,nextDelayMs:c.nextDelayMs,scheduledAt:c.scheduledAt??Date.now()})}),a=e.on("daemon:version-mismatch",l=>{const c=l;n({kind:"version-mismatch",daemonProtocol:c.daemonProtocol,supportedProtocol:c.supportedProtocol})});return()=>{r(),i(),s(),o(),a()}},[e]),t}function Wz(e){const t=as(),n=ts(e.kind==="connected"?"sessions":""),r=g.useCallback(async()=>{t.setData("sessions",i=>i??[])},[t]);return{sessions:n??[],loading:!1,loaded:n!==void 0,error:null,refresh:r}}function Bl(){const e=Ni();return g.useMemo(()=>new Jp(e),[e])}function t4(e){return{personaId:e.personaId,label:e.label,model:e.model,effort:e.effort,serviceTier:e.serviceTier,tool:e.tool,...e.size!==void 0?{size:e.size}:{},...e.cpu!==void 0?{cpu:e.cpu}:{},...e.taskConcurrency!==void 0?{taskConcurrency:e.taskConcurrency}:{},...e.cloudEngine?{cloudEngine:e.cloudEngine}:{},public:e.public,createdAt:e.createdAt,updatedAt:e.updatedAt,...e.cloud?{cloud:e.cloud}:{}}}function n4(){const e=as(),t=Bl(),n=ts("personas")??[],r=g.useMemo(()=>n.map(s=>t4(s)),[n]),i=g.useCallback(async()=>{const s=await t.personaList();e.setData("personas",()=>s.personas??[])},[t,e]);return{personas:r,raw:n,loaded:ts("personas")!==void 0,refresh:i}}function r4(e){const{raw:t}=n4(),n=as(),r=Bl(),i=e?t.find(a=>a.personaId===e)??null:null,s=i?t4(i):null,o=g.useCallback(async a=>{if(!e)return;(a==null?void 0:a.personaId)===e&&n.setData("personas",c=>{const u=c??[];return u.some(d=>d.personaId===e)?u.map(d=>d.personaId===e?a:d):[...u,a]});const l=await r.personaList();n.setData("personas",()=>l.personas??[])},[e,r,n]);return{persona:s,raw:i,loaded:!!s,refresh:o}}function qz(e){const t=Bl(),n=as(),r=e?`persona-detail/${e}`:"",i=ts(r),s=g.useCallback(async()=>{const o={personality:"",personalityLocal:"",personalityManaged:!1,skills:[],plugins:[],sandboxSettings:null,codexSandbox:null};if(!e)return o;let a=null;try{a=await t.personaGet(e)}catch(c){$e("personas","personaGet failed → empty detail",{personaId:e,err:c}),a=null}const l=a?{personality:a.personality??"",personalityLocal:a.personalityLocal??"",personalityManaged:a.personalityManaged??!1,skills:a.skills??[],plugins:a.plugins??[],sandboxSettings:a.sandboxSettings??null,codexSandbox:a.codexSandbox??null}:o;return n.setData(r,()=>l),l},[t,n,e,r]);return g.useEffect(()=>{e&&s()},[e,s]),{personality:(i==null?void 0:i.personality)??"",personalityLocal:(i==null?void 0:i.personalityLocal)??"",personalityManaged:(i==null?void 0:i.personalityManaged)??!1,skills:(i==null?void 0:i.skills)??[],plugins:(i==null?void 0:i.plugins)??[],sandboxSettings:(i==null?void 0:i.sandboxSettings)??null,codexSandbox:(i==null?void 0:i.codexSandbox)??null,loaded:i!==void 0,refresh:s}}function i4(){const e=as(),t=Bl();return g.useCallback(async()=>{const n=await t.personaList();e.setData("personas",()=>n.personas??[])},[e,t])}function Vz(){const e=Bl(),t=i4();return g.useCallback(async(n,r)=>{const i=await e.personaUpdate(n,r);return await t(),i},[e,t])}function Kz(){const e=Bl(),t=i4();return g.useCallback(async n=>{await e.personaDelete(n),await t()},[e,t])}const ek="clawd:sidebar:tree-collapsed";function Gz(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function Yz(e){const t=Gz(e);if(!Array.isArray(t))return new Set;const n=new Set;for(const r of t)typeof r=="string"&&n.add(r);return n}function Xz(){const e=ky(),[t,n]=g.useState(()=>new Set),r=g.useRef(t);r.current=t,g.useEffect(()=>{let l=!1;return(async()=>{try{const c=await e.kv.get(ek);if(l)return;n(Yz(c))}catch{}})(),()=>{l=!0}},[e]);const i=g.useCallback(l=>{e.kv.set(ek,[...l]).catch(()=>{})},[e]),s=g.useCallback(l=>r.current.has(l),[]),o=g.useCallback(l=>{n(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),i(u),u})},[i]),a=g.useCallback(l=>{n(c=>{let u=!1;const d=new Set;for(const f of c)l.has(f)?d.add(f):u=!0;return u?(i(d),d):c})},[i]);return{isCollapsed:s,toggle:o,prune:a}}const Jy=g.createContext(null);function Zz(){const e=g.useContext(Jy);if(!e)throw new Error("SessionTreeCollapsedContext.Provider missing — wrap SessionTreeNode tree with <SessionTreeCollapsedContext.Provider value={useSessionTreeCollapsed()}>");return e}/**
|
|
95
|
+
`,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var _S=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const E8={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},I8={motionBase:!0,motionUnit:!0},N8={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},F5=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=_S(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=z5(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=_S(l,["theme"]);let d=u;c&&(d=F5(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function H5(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Ze.useContext(B5),s=`${k8}-${t||""}`,o=n||O5,[a,l,c]=p6(o,[vu,e],{salt:s,override:r,getComputedToken:F5,formatToken:z5,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:E8,ignore:I8,preserve:N8}});return[o,c,t?l:"",a,i]}const T8=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),P8=e=>({[`.${e}`]:Object.assign(Object.assign({},T8()),{[`.${e} .${e}-icon`]:{display:"block"}})}),R8=(e,t)=>{const[n,r]=H5();return H6({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>P8(e))},M8=Object.assign({},Tl),{useId:bS}=M8,A8=()=>"",j8=typeof bS>"u"?A8:bS;function L8(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},Ef),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:Ef.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=j8();return o5(()=>{var a,l;if(!e)return t;const c=Object.assign({},s.components);Object.keys(e.components||{}).forEach(f=>{c[f]=Object.assign(Object.assign({},c[f]),e.components[f])});const u=`css-var-${o.replace(/:/g,"")}`,d=((a=i.cssVar)!==null&&a!==void 0?a:s.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof s.cssVar=="object"?s.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((l=i.cssVar)===null||l===void 0?void 0:l.key)||u});return Object.assign(Object.assign(Object.assign({},s),i),{token:Object.assign(Object.assign({},s.token),i.token),components:c,cssVar:d})},[i,s],(a,l)=>a.some((c,u)=>{const d=l[u];return!HO(c,d,!0)}))}var D8=["children"],U5=g.createContext({});function O8(e){var t=e.children,n=Iv(e,D8);return g.createElement(U5.Provider,{value:n},t)}var B8=function(e){l5(n,e);var t=u5(n);function n(){return Ml(this,n),t.apply(this,arguments)}return Al(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function $8(e){var t=g.useReducer(function(a){return a+1},0),n=ot(t,2),r=n[1],i=g.useRef(e),s=Yv(function(){return i.current}),o=Yv(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var bs="none",Bd="appear",$d="enter",zd="leave",wS="none",Hr="prepare",Oa="start",Ba="active",jy="end",W5="prepared";function SS(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}function z8(e,t){var n={animationend:SS("Animation","AnimationEnd"),transitionend:SS("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var F8=z8(os(),typeof window<"u"?window:{}),q5={};if(os()){var H8=document.createElement("div");q5=H8.style}var Fd={};function V5(e){if(Fd[e])return Fd[e];var t=F8[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var s=n[i];if(Object.prototype.hasOwnProperty.call(t,s)&&s in q5)return Fd[e]=t[s],Fd[e]}return""}var K5=V5("animationend"),G5=V5("transitionend"),Y5=!!(K5&&G5),kS=K5||"animationend",CS=G5||"transitionend";function ES(e,t){if(!e)return null;if(Rt(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const U8=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(CS,e),i.removeEventListener(kS,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(CS,e),i.addEventListener(kS,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var X5=os()?g.useLayoutEffect:g.useEffect;const W8=function(){var e=g.useRef(null);function t(){Cv.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=Cv(function(){i<=1?r({isCanceled:function(){return s!==e.current}}):n(r,i-1)});e.current=s}return g.useEffect(function(){return function(){t()}},[]),[n,t]};var q8=[Hr,Oa,Ba,jy],V8=[Hr,W5],Z5=!1,K8=!0;function Q5(e){return e===Ba||e===jy}const G8=function(e,t,n){var r=Xv(wS),i=ot(r,2),s=i[0],o=i[1],a=W8(),l=ot(a,2),c=l[0],u=l[1];function d(){o(Hr,!0)}var f=t?V8:q8;return X5(function(){if(s!==wS&&s!==jy){var p=f.indexOf(s),m=f[p+1],v=n(s);v===Z5?o(m,!0):m&&c(function(w){function x(){w.isCanceled()||o(m,!0)}v===!0?x():Promise.resolve(v).then(x)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function Y8(e,t,n,r){var i=r.motionEnter,s=i===void 0?!0:i,o=r.motionAppear,a=o===void 0?!0:o,l=r.motionLeave,c=l===void 0?!0:l,u=r.motionDeadline,d=r.motionLeaveImmediately,f=r.onAppearPrepare,p=r.onEnterPrepare,m=r.onLeavePrepare,v=r.onAppearStart,w=r.onEnterStart,x=r.onLeaveStart,_=r.onAppearActive,b=r.onEnterActive,S=r.onLeaveActive,C=r.onAppearEnd,k=r.onEnterEnd,T=r.onLeaveEnd,E=r.onVisibleChanged,D=Xv(),N=ot(D,2),L=N[0],R=N[1],M=$8(bs),A=ot(M,2),j=A[0],z=A[1],F=Xv(null),$=ot(F,2),B=$[0],I=$[1],U=j(),q=g.useRef(!1),O=g.useRef(null);function te(){return n()}var le=g.useRef(!1);function Y(){z(bs),I(null,!0)}var re=Yv(function(Pe){var Me=j();if(Me!==bs){var rt=te();if(!(Pe&&!Pe.deadline&&Pe.target!==rt)){var tn=le.current,hn;Me===Bd&&tn?hn=C==null?void 0:C(rt,Pe):Me===$d&&tn?hn=k==null?void 0:k(rt,Pe):Me===zd&&tn&&(hn=T==null?void 0:T(rt,Pe)),tn&&hn!==!1&&Y()}}}),ke=U8(re),oe=ot(ke,1),Ie=oe[0],Ee=function(Me){switch(Me){case Bd:return Te(Te(Te({},Hr,f),Oa,v),Ba,_);case $d:return Te(Te(Te({},Hr,p),Oa,w),Ba,b);case zd:return Te(Te(Te({},Hr,m),Oa,x),Ba,S);default:return{}}},Re=g.useMemo(function(){return Ee(U)},[U]),he=G8(U,!e,function(Pe){if(Pe===Hr){var Me=Re[Hr];return Me?Me(te()):Z5}if(Ge in Re){var rt;I(((rt=Re[Ge])===null||rt===void 0?void 0:rt.call(Re,te(),null))||null)}return Ge===Ba&&U!==bs&&(Ie(te()),u>0&&(clearTimeout(O.current),O.current=setTimeout(function(){re({deadline:!0})},u))),Ge===W5&&Y(),K8}),Be=ot(he,2),Je=Be[0],Ge=Be[1],ft=Q5(Ge);le.current=ft;var Kt=g.useRef(null);X5(function(){if(!(q.current&&Kt.current===t)){R(t);var Pe=q.current;q.current=!0;var Me;!Pe&&t&&a&&(Me=Bd),Pe&&t&&s&&(Me=$d),(Pe&&!t&&c||!Pe&&d&&!t&&c)&&(Me=zd);var rt=Ee(Me);Me&&(e||rt[Hr])?(z(Me),Je()):z(bs),Kt.current=t}},[t]),g.useEffect(function(){(U===Bd&&!a||U===$d&&!s||U===zd&&!c)&&z(bs)},[a,s,c]),g.useEffect(function(){return function(){q.current=!1,clearTimeout(O.current)}},[]);var fe=g.useRef(!1);g.useEffect(function(){L&&(fe.current=!0),L!==void 0&&U===bs&&((fe.current||L)&&(E==null||E(L)),fe.current=!0)},[L,U]);var He=B;return Re[Hr]&&Ge===Oa&&(He=Ke({transition:"none"},He)),[U,Ge,He,L??t]}function X8(e){var t=e;Rt(e)==="object"&&(t=e.transitionSupport);function n(i,s){return!!(i.motionName&&t&&s!==!1)}var r=g.forwardRef(function(i,s){var o=i.visible,a=o===void 0?!0:o,l=i.removeOnLeave,c=l===void 0?!0:l,u=i.forceRender,d=i.children,f=i.motionName,p=i.leavedClassName,m=i.eventProps,v=g.useContext(U5),w=v.motion,x=n(i,w),_=g.useRef(),b=g.useRef();function S(){try{return _.current instanceof HTMLElement?_.current:CO(b.current)}catch{return null}}var C=Y8(x,a,S,i),k=ot(C,4),T=k[0],E=k[1],D=k[2],N=k[3],L=g.useRef(N);N&&(L.current=!0);var R=g.useCallback(function($){_.current=$,TO(s,$)},[s]),M,A=Ke(Ke({},m),{},{visible:a});if(!d)M=null;else if(T===bs)N?M=d(Ke({},A),R):!c&&L.current&&p?M=d(Ke(Ke({},A),{},{className:p}),R):u||!c&&!p?M=d(Ke(Ke({},A),{},{style:{display:"none"}}),R):M=null;else{var j;E===Hr?j="prepare":Q5(E)?j="active":E===Oa&&(j="start");var z=ES(f,"".concat(T,"-").concat(j));M=d(Ke(Ke({},A),{},{className:fO(ES(f,T),Te(Te({},z,z&&j),f,typeof f=="string")),style:D}),R)}if(g.isValidElement(M)&&PO(M)){var F=RO(M);F||(M=g.cloneElement(M,{ref:R}))}return g.createElement(B8,{ref:b},M)});return r.displayName="CSSMotion",r}const Z8=X8(Y5);var Zv="add",Qv="keep",Jv="remove",bg="removed";function Q8(e){var t;return e&&Rt(e)==="object"&&"key"in e?t=e:t={key:e},Ke(Ke({},t),{},{key:String(t.key)})}function ex(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(Q8)}function J8(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=t.length,s=ex(e),o=ex(t);s.forEach(function(c){for(var u=!1,d=r;d<i;d+=1){var f=o[d];if(f.key===c.key){r<d&&(n=n.concat(o.slice(r,d).map(function(p){return Ke(Ke({},p),{},{status:Zv})})),r=d),n.push(Ke(Ke({},f),{},{status:Qv})),r+=1,u=!0;break}}u||n.push(Ke(Ke({},c),{},{status:Jv}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return Ke(Ke({},c),{},{status:Zv})})));var a={};n.forEach(function(c){var u=c.key;a[u]=(a[u]||0)+1});var l=Object.keys(a).filter(function(c){return a[c]>1});return l.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==Jv}),n.forEach(function(u){u.key===c&&(u.status=Qv)})}),n}var eB=["component","children","onVisibleChanged","onAllRemoved"],tB=["status"],nB=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function rB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Z8,n=function(r){l5(s,r);var i=u5(s);function s(){var o;Ml(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=i.call.apply(i,[this].concat(l)),Te(Sv(o),"state",{keyEntities:[]}),Te(Sv(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:Ke(Ke({},p),{},{status:bg})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==bg}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return Al(s,[{key:"render",value:function(){var a=this,l=this.state.keyEntities,c=this.props,u=c.component,d=c.children,f=c.onVisibleChanged;c.onAllRemoved;var p=Iv(c,eB),m=u||g.Fragment,v={};return nB.forEach(function(w){v[w]=p[w],delete p[w]}),delete p.keys,g.createElement(m,p,l.map(function(w,x){var _=w.status,b=Iv(w,tB),S=_===Zv||_===Qv;return g.createElement(t,Sf({},v,{key:b.key,visible:S,eventProps:b,onVisibleChanged:function(k){f==null||f(k,{key:b.key}),k||a.removeKey(b.key)}}),function(C,k){return d(Ke(Ke({},C),{},{index:x}),k)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=ex(c),f=J8(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(v){var w=v.key;return p.key===w});return!(m&&m.status===bg&&p.status===Jv)})}}}]),s}(g.Component);return Te(n,"defaultProps",{component:"div"}),n}rB(Y5);const IS=g.createContext(!0);function iB(e){const t=g.useContext(IS),{children:n}=e,[,r]=H5(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(IS.Provider,{value:i},g.createElement(O8,{motion:i},n)):n}const sB=()=>null;var oB=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const aB=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let J5;function lB(){return J5||Kv}function cB(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const uB=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(J5=t),r&&cB(r)&&x8(lB(),r)},dB=e=>{const{children:t,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:s,form:o,locale:a,componentSize:l,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:v,legacyLocale:w,parentContext:x,iconPrefixCls:_,theme:b,componentDisabled:S,segmented:C,statistic:k,spin:T,calendar:E,carousel:D,cascader:N,collapse:L,typography:R,checkbox:M,descriptions:A,divider:j,drawer:z,skeleton:F,steps:$,image:B,layout:I,list:U,mentions:q,modal:O,progress:te,result:le,slider:Y,breadcrumb:re,menu:ke,pagination:oe,input:Ie,textArea:Ee,empty:Re,badge:he,radio:Be,rate:Je,switch:Ge,transfer:ft,avatar:Kt,message:fe,tag:He,table:Pe,card:Me,tabs:rt,timeline:tn,timePicker:hn,upload:W,notification:ee,tree:be,colorPicker:Oe,datePicker:Ue,rangePicker:At,flex:bn,wave:nn,dropdown:fn,warning:ce,tour:Se,tooltip:st,popover:gt,popconfirm:gr,floatButton:ae,floatButtonGroup:it,variant:Bt,inputNumber:ti,treeSelect:oa}=e,aa=g.useCallback((jt,$t)=>{const{prefixCls:Wn}=e;if($t)return $t;const vr=Wn||x.getPrefixCls("");return jt?`${vr}-${jt}`:vr},[x.getPrefixCls,e.prefixCls]),hs=_||x.iconPrefixCls||$5,la=n||x.csp;R8(hs,la);const Yl=L8(b,x.theme,{prefixCls:aa("")}),Xl={csp:la,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||w,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:v,getPrefixCls:aa,iconPrefixCls:hs,theme:Yl,segmented:C,statistic:k,spin:T,calendar:E,carousel:D,cascader:N,collapse:L,typography:R,checkbox:M,descriptions:A,divider:j,drawer:z,skeleton:F,steps:$,image:B,input:Ie,textArea:Ee,layout:I,list:U,mentions:q,modal:O,progress:te,result:le,slider:Y,breadcrumb:re,menu:ke,pagination:oe,empty:Re,badge:he,radio:Be,rate:Je,switch:Ge,transfer:ft,avatar:Kt,message:fe,tag:He,table:Pe,card:Me,tabs:rt,timeline:tn,timePicker:hn,upload:W,notification:ee,tree:be,colorPicker:Oe,datePicker:Ue,rangePicker:At,flex:bn,wave:nn,dropdown:fn,warning:ce,tour:Se,tooltip:st,popover:gt,popconfirm:gr,floatButton:ae,floatButtonGroup:it,variant:Bt,inputNumber:ti,treeSelect:oa},fs=Object.assign({},x);Object.keys(Xl).forEach(jt=>{Xl[jt]!==void 0&&(fs[jt]=Xl[jt])}),aB.forEach(jt=>{const $t=e[jt];$t&&(fs[jt]=$t)}),typeof r<"u"&&(fs.button=Object.assign({autoInsertSpace:r},fs.button));const ni=o5(()=>fs,fs,(jt,$t)=>{const Wn=Object.keys(jt),vr=Object.keys($t);return Wn.length!==vr.length||Wn.some(Mi=>jt[Mi]!==$t[Mi])}),{layer:pd}=g.useContext(Wp),ca=g.useMemo(()=>({prefixCls:hs,csp:la,layer:pd?"antd":void 0}),[hs,la,pd]);let Gt=g.createElement(g.Fragment,null,g.createElement(sB,{dropdownMatchSelectWidth:p}),t);const Zl=g.useMemo(()=>{var jt,$t,Wn,vr;return X6(((jt=Kp.Form)===null||jt===void 0?void 0:jt.defaultValidateMessages)||{},((Wn=($t=ni.locale)===null||$t===void 0?void 0:$t.Form)===null||Wn===void 0?void 0:Wn.defaultValidateMessages)||{},((vr=ni.form)===null||vr===void 0?void 0:vr.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[ni,o==null?void 0:o.validateMessages]);Object.keys(Zl).length>0&&(Gt=g.createElement(Q6.Provider,{value:Zl},Gt)),a&&(Gt=g.createElement(t8,{locale:a,_ANT_MARK__:e8},Gt)),Gt=g.createElement(V6.Provider,{value:ca},Gt),l&&(Gt=g.createElement(_8,{size:l},Gt)),Gt=g.createElement(iB,null,Gt);const md=g.useMemo(()=>{const jt=Yl||{},{algorithm:$t,token:Wn,components:vr,cssVar:Mi}=jt,Bm=oB(jt,["algorithm","token","components","cssVar"]),gd=$t&&(!Array.isArray($t)||$t.length>0)?Tv($t):O5,lo={};Object.entries(vr||{}).forEach(([$m,vd])=>{const xr=Object.assign({},vd);"algorithm"in xr&&(xr.algorithm===!0?xr.theme=gd:(Array.isArray(xr.algorithm)||typeof xr.algorithm=="function")&&(xr.theme=Tv(xr.algorithm)),delete xr.algorithm),lo[$m]=xr});const co=Object.assign(Object.assign({},vu),Wn);return Object.assign(Object.assign({},Bm),{theme:gd,token:co,components:lo,override:Object.assign({override:co},lo),cssVar:Mi})},[Yl]);return b&&(Gt=g.createElement(B5.Provider,{value:md},Gt)),ni.warning&&(Gt=g.createElement(Z6.Provider,{value:ni.warning},Gt)),S!==void 0&&(Gt=g.createElement(y8,{disabled:S},Gt)),g.createElement(Gp.Provider,{value:ni},Gt)},Ll=e=>{const t=g.useContext(Gp),n=g.useContext(A5);return g.createElement(dB,Object.assign({parentContext:t,legacyLocale:n},e))};Ll.ConfigContext=Gp;Ll.SizeContext=xu;Ll.config=uB;Ll.useConfig=b8;Object.defineProperty(Ll,"SizeContext",{get:()=>xu});const _r=(e,t)=>new Et(e).setA(t).toRgbString(),ha=(e,t)=>new Et(e).lighten(t).toHexString(),hB=e=>{const t=dl(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},fB=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:_r(r,.85),colorTextSecondary:_r(r,.65),colorTextTertiary:_r(r,.45),colorTextQuaternary:_r(r,.25),colorFill:_r(r,.18),colorFillSecondary:_r(r,.12),colorFillTertiary:_r(r,.08),colorFillQuaternary:_r(r,.04),colorBgSolid:_r(r,.95),colorBgSolidHover:_r(r,1),colorBgSolidActive:_r(r,.9),colorBgElevated:ha(n,12),colorBgContainer:ha(n,8),colorBgLayout:ha(n,0),colorBgSpotlight:ha(n,26),colorBgBlur:_r(r,.04),colorBorder:ha(n,26),colorBorderSecondary:ha(n,19)}},pB=(e,t)=>{const n=Object.keys(My).map(s=>{const o=dl(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??Ay(e),i=D5(e,{generateColorPalettes:hB,generateNeutralColorPalettes:fB});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},NS={defaultSeed:Ef.token,defaultAlgorithm:Ay,darkAlgorithm:pB};function TS({children:e}){const t=ky(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(Ll,{theme:{algorithm:n.mode==="dark"?NS.darkAlgorithm:NS.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var tt;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(tt||(tt={}));var PS;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(PS||(PS={}));const ge=tt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cs=e=>{switch(typeof e){case"undefined":return ge.undefined;case"string":return ge.string;case"number":return Number.isNaN(e)?ge.nan:ge.number;case"boolean":return ge.boolean;case"function":return ge.function;case"bigint":return ge.bigint;case"symbol":return ge.symbol;case"object":return Array.isArray(e)?ge.array:e===null?ge.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ge.promise:typeof Map<"u"&&e instanceof Map?ge.map:typeof Set<"u"&&e instanceof Set?ge.set:typeof Date<"u"&&e instanceof Date?ge.date:ge.object;default:return ge.unknown}},X=tt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ji extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(t){if(!(t instanceof Ji))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,tt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ji.create=e=>new Ji(e);const tx=(e,t)=>{let n;switch(e.code){case X.invalid_type:e.received===ge.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,tt.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${tt.joinValues(e.keys,", ")}`;break;case X.invalid_union:n="Invalid input";break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tt.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${tt.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n="Invalid function arguments";break;case X.invalid_return_type:n="Invalid function return type";break;case X.invalid_date:n="Invalid date";break;case X.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:tt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case X.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case X.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case X.custom:n="Invalid input";break;case X.invalid_intersection_types:n="Intersection results could not be merged";break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n="Number must be finite";break;default:n=t.defaultError,tt.assertNever(e)}return{message:n}};let mB=tx;function gB(){return mB}const vB=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function ue(e,t){const n=gB(),r=vB({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===tx?void 0:tx].filter(i=>!!i)});e.common.issues.push(r)}class Bn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return je;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return Bn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return je;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const je=Object.freeze({status:"aborted"}),Sc=e=>({status:"dirty",value:e}),Lr=e=>({status:"valid",value:e}),RS=e=>e.status==="aborted",MS=e=>e.status==="dirty",hl=e=>e.status==="valid",If=e=>typeof Promise<"u"&&e instanceof Promise;var _e;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(_e||(_e={}));class ki{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const AS=(e,t)=>{if(hl(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ji(e.common.issues);return this._error=n,this._error}}};function Fe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class Qe{get description(){return this._def.description}_getType(t){return Cs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Bn,ctx:{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(If(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},i=this._parseSync({data:t,path:r.path,parent:r});return AS(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return hl(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>hl(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(If(i)?i:Promise.resolve(i));return AS(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:X.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Gs({schema:this,typeName:Le.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ki.create(this,this._def)}nullable(){return $o.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _i.create(this)}promise(){return Af.create(this,this._def)}or(t){return Tf.create([this,t],this._def)}and(t){return Pf.create(this,t,this._def)}transform(t){return new Gs({...Fe(this._def),schema:this,typeName:Le.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new jf({...Fe(this._def),innerType:this,defaultValue:n,typeName:Le.ZodDefault})}brand(){return new rT({typeName:Le.ZodBranded,type:this,...Fe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Lf({...Fe(this._def),innerType:this,catchValue:n,typeName:Le.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Dy.create(this,t)}readonly(){return Df.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xB=/^c[^\s-]{8,}$/i,yB=/^[0-9a-z]+$/,_B=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bB=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,wB=/^[a-z0-9_-]{21}$/i,SB=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,kB=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,CB=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,EB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let wg;const IB=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,NB=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TB=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,PB=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,RB=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,MB=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,eT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",AB=new RegExp(`^${eT}$`);function tT(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function jB(e){return new RegExp(`^${tT(e)}$`)}function LB(e){let t=`${eT}T${tT(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function DB(e,t){return!!((t==="v4"||!t)&&IB.test(e)||(t==="v6"||!t)&&TB.test(e))}function OB(e,t){if(!SB.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function BB(e,t){return!!((t==="v4"||!t)&&NB.test(e)||(t==="v6"||!t)&&PB.test(e))}class Fi extends Qe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ge.string){const s=this._getOrReturnCtx(t);return ue(s,{code:X.invalid_type,expected:ge.string,received:s.parsedType}),je}const r=new Bn;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?ue(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&ue(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")CB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"email",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")wg||(wg=new RegExp(EB,"u")),wg.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"emoji",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")bB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"uuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")wB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"nanoid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")xB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"cuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")yB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"cuid2",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")_B.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"ulid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),ue(i,{validation:"url",code:X.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"regex",code:X.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?LB(s).test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?AB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?jB(s).test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{code:X.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?kB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"duration",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?DB(t.data,s.version)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"ip",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?OB(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"jwt",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?BB(t.data,s.version)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"cidr",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?RB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"base64",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?MB.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"base64url",code:X.invalid_string,message:s.message}),r.dirty()):tt.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:X.invalid_string,..._e.errToObj(r)})}_addCheck(t){return new Fi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",..._e.errToObj(t)})}url(t){return this._addCheck({kind:"url",..._e.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",..._e.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",..._e.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",..._e.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",..._e.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",..._e.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",..._e.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",..._e.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",..._e.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",..._e.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",..._e.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",..._e.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,..._e.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,..._e.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",..._e.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,..._e.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,..._e.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,..._e.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,..._e.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,..._e.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,..._e.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,..._e.errToObj(n)})}nonempty(t){return this.min(1,_e.errToObj(t))}trim(){return new Fi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Fi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Fi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Fi.create=e=>new Fi({checks:[],typeName:Le.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Fe(e)});function $B(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class fl extends Qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ge.number){const s=this._getOrReturnCtx(t);return ue(s,{code:X.invalid_type,expected:ge.number,received:s.parsedType}),je}let r;const i=new Bn;for(const s of this._def.checks)s.kind==="int"?tt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ue(r,{code:X.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?$B(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ue(r,{code:X.not_finite,message:s.message}),i.dirty()):tt.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,_e.toString(n))}gt(t,n){return this.setLimit("min",t,!1,_e.toString(n))}lte(t,n){return this.setLimit("max",t,!0,_e.toString(n))}lt(t,n){return this.setLimit("max",t,!1,_e.toString(n))}setLimit(t,n,r,i){return new fl({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:_e.toString(i)}]})}_addCheck(t){return new fl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:_e.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_e.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_e.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_e.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_e.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:_e.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:_e.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_e.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_e.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&tt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}fl.create=e=>new fl({checks:[],typeName:Le.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class yu extends Qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ge.bigint)return this._getInvalidInput(t);let r;const i=new Bn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ue(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):tt.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return ue(n,{code:X.invalid_type,expected:ge.bigint,received:n.parsedType}),je}gte(t,n){return this.setLimit("min",t,!0,_e.toString(n))}gt(t,n){return this.setLimit("min",t,!1,_e.toString(n))}lte(t,n){return this.setLimit("max",t,!0,_e.toString(n))}lt(t,n){return this.setLimit("max",t,!1,_e.toString(n))}setLimit(t,n,r,i){return new yu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:_e.toString(i)}]})}_addCheck(t){return new yu({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_e.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_e.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_e.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_e.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:_e.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}yu.create=e=>new yu({checks:[],typeName:Le.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Fe(e)});class nx extends Qe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ge.boolean){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.boolean,received:r.parsedType}),je}return Lr(t.data)}}nx.create=e=>new nx({typeName:Le.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class Nf extends Qe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ge.date){const s=this._getOrReturnCtx(t);return ue(s,{code:X.invalid_type,expected:ge.date,received:s.parsedType}),je}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return ue(s,{code:X.invalid_date}),je}const r=new Bn;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code:X.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code:X.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):tt.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Nf({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:_e.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:_e.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Nf.create=e=>new Nf({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Le.ZodDate,...Fe(e)});class jS extends Qe{_parse(t){if(this._getType(t)!==ge.symbol){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.symbol,received:r.parsedType}),je}return Lr(t.data)}}jS.create=e=>new jS({typeName:Le.ZodSymbol,...Fe(e)});class rx extends Qe{_parse(t){if(this._getType(t)!==ge.undefined){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.undefined,received:r.parsedType}),je}return Lr(t.data)}}rx.create=e=>new rx({typeName:Le.ZodUndefined,...Fe(e)});class ix extends Qe{_parse(t){if(this._getType(t)!==ge.null){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.null,received:r.parsedType}),je}return Lr(t.data)}}ix.create=e=>new ix({typeName:Le.ZodNull,...Fe(e)});class LS extends Qe{constructor(){super(...arguments),this._any=!0}_parse(t){return Lr(t.data)}}LS.create=e=>new LS({typeName:Le.ZodAny,...Fe(e)});class sx extends Qe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Lr(t.data)}}sx.create=e=>new sx({typeName:Le.ZodUnknown,...Fe(e)});class Ks extends Qe{_parse(t){const n=this._getOrReturnCtx(t);return ue(n,{code:X.invalid_type,expected:ge.never,received:n.parsedType}),je}}Ks.create=e=>new Ks({typeName:Le.ZodNever,...Fe(e)});class DS extends Qe{_parse(t){if(this._getType(t)!==ge.undefined){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.void,received:r.parsedType}),je}return Lr(t.data)}}DS.create=e=>new DS({typeName:Le.ZodVoid,...Fe(e)});class _i extends Qe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==ge.array)return ue(n,{code:X.invalid_type,expected:ge.array,received:n.parsedType}),je;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(ue(n,{code:o?X.too_big:X.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(ue(n,{code:X.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(ue(n,{code:X.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new ki(n,o,n.path,a)))).then(o=>Bn.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new ki(n,o,n.path,a)));return Bn.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new _i({...this._def,minLength:{value:t,message:_e.toString(n)}})}max(t,n){return new _i({...this._def,maxLength:{value:t,message:_e.toString(n)}})}length(t,n){return new _i({...this._def,exactLength:{value:t,message:_e.toString(n)}})}nonempty(t){return this.min(1,t)}}_i.create=(e,t)=>new _i({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Le.ZodArray,...Fe(t)});function wa(e){if(e instanceof Ht){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ki.create(wa(r))}return new Ht({...e._def,shape:()=>t})}else return e instanceof _i?new _i({...e._def,type:wa(e.element)}):e instanceof Ki?Ki.create(wa(e.unwrap())):e instanceof $o?$o.create(wa(e.unwrap())):e instanceof Oo?Oo.create(e.items.map(t=>wa(t))):e}class Ht extends Qe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=tt.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ge.object){const c=this._getOrReturnCtx(t);return ue(c,{code:X.invalid_type,expected:ge.object,received:c.parsedType}),je}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ks&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new ki(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ks){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(ue(i,{code:X.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new ki(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Bn.mergeObjectSync(r,c)):Bn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return _e.errToObj,new Ht({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:_e.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new Ht({...this._def,unknownKeys:"strip"})}passthrough(){return new Ht({...this._def,unknownKeys:"passthrough"})}extend(t){return new Ht({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Ht({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Le.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Ht({...this._def,catchall:t})}pick(t){const n={};for(const r of tt.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Ht({...this._def,shape:()=>n})}omit(t){const n={};for(const r of tt.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Ht({...this._def,shape:()=>n})}deepPartial(){return wa(this)}partial(t){const n={};for(const r of tt.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new Ht({...this._def,shape:()=>n})}required(t){const n={};for(const r of tt.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ki;)s=s._def.innerType;n[r]=s}return new Ht({...this._def,shape:()=>n})}keyof(){return nT(tt.objectKeys(this.shape))}}Ht.create=(e,t)=>new Ht({shape:()=>e,unknownKeys:"strip",catchall:Ks.create(),typeName:Le.ZodObject,...Fe(t)});Ht.strictCreate=(e,t)=>new Ht({shape:()=>e,unknownKeys:"strict",catchall:Ks.create(),typeName:Le.ZodObject,...Fe(t)});Ht.lazycreate=(e,t)=>new Ht({shape:e,unknownKeys:"strip",catchall:Ks.create(),typeName:Le.ZodObject,...Fe(t)});class Tf extends Qe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Ji(a.ctx.common.issues));return ue(n,{code:X.invalid_union,unionErrors:o}),je}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new Ji(l));return ue(n,{code:X.invalid_union,unionErrors:a}),je}}get options(){return this._def.options}}Tf.create=(e,t)=>new Tf({options:e,typeName:Le.ZodUnion,...Fe(t)});const Di=e=>e instanceof ax?Di(e.schema):e instanceof Gs?Di(e.innerType()):e instanceof Mf?[e.value]:e instanceof Bo?e.options:e instanceof lx?tt.objectValues(e.enum):e instanceof jf?Di(e._def.innerType):e instanceof rx?[void 0]:e instanceof ix?[null]:e instanceof Ki?[void 0,...Di(e.unwrap())]:e instanceof $o?[null,...Di(e.unwrap())]:e instanceof rT||e instanceof Df?Di(e.unwrap()):e instanceof Lf?Di(e._def.innerType):[];class Ly extends Qe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ge.object)return ue(n,{code:X.invalid_type,expected:ge.object,received:n.parsedType}),je;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(ue(n,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),je)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const o=Di(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new Ly({typeName:Le.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Fe(r)})}}function ox(e,t){const n=Cs(e),r=Cs(t);if(e===t)return{valid:!0,data:e};if(n===ge.object&&r===ge.object){const i=tt.objectKeys(t),s=tt.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=ox(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===ge.array&&r===ge.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=ox(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===ge.date&&r===ge.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Pf extends Qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(RS(s)||RS(o))return je;const a=ox(s.value,o.value);return a.valid?((MS(s)||MS(o))&&n.dirty(),{status:n.value,value:a.data}):(ue(r,{code:X.invalid_intersection_types}),je)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Pf.create=(e,t,n)=>new Pf({left:e,right:t,typeName:Le.ZodIntersection,...Fe(n)});class Oo extends Qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ge.array)return ue(r,{code:X.invalid_type,expected:ge.array,received:r.parsedType}),je;if(r.data.length<this._def.items.length)return ue(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&r.data.length>this._def.items.length&&(ue(r,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new ki(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>Bn.mergeArray(n,o)):Bn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Oo({...this._def,rest:t})}}Oo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Oo({items:e,typeName:Le.ZodTuple,rest:null,...Fe(t)})};class Rf extends Qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ge.object)return ue(r,{code:X.invalid_type,expected:ge.object,received:r.parsedType}),je;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new ki(r,a,r.path,a)),value:o._parse(new ki(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Bn.mergeObjectAsync(n,i):Bn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Qe?new Rf({keyType:t,valueType:n,typeName:Le.ZodRecord,...Fe(r)}):new Rf({keyType:Fi.create(),valueType:t,typeName:Le.ZodRecord,...Fe(n)})}}class OS extends Qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ge.map)return ue(r,{code:X.invalid_type,expected:ge.map,received:r.parsedType}),je;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new ki(r,a,r.path,[c,"key"])),value:s._parse(new ki(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return je;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return je;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}OS.create=(e,t,n)=>new OS({valueType:t,keyType:e,typeName:Le.ZodMap,...Fe(n)});class _u extends Qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ge.set)return ue(r,{code:X.invalid_type,expected:ge.set,received:r.parsedType}),je;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(ue(r,{code:X.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(ue(r,{code:X.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return je;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new ki(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new _u({...this._def,minSize:{value:t,message:_e.toString(n)}})}max(t,n){return new _u({...this._def,maxSize:{value:t,message:_e.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}_u.create=(e,t)=>new _u({valueType:e,minSize:null,maxSize:null,typeName:Le.ZodSet,...Fe(t)});class ax extends Qe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ax.create=(e,t)=>new ax({getter:e,typeName:Le.ZodLazy,...Fe(t)});class Mf extends Qe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ue(n,{received:n.data,code:X.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:t.data}}get value(){return this._def.value}}Mf.create=(e,t)=>new Mf({value:e,typeName:Le.ZodLiteral,...Fe(t)});function nT(e,t){return new Bo({values:e,typeName:Le.ZodEnum,...Fe(t)})}class Bo extends Qe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ue(n,{expected:tt.joinValues(r),received:n.parsedType,code:X.invalid_type}),je}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ue(n,{received:n.data,code:X.invalid_enum_value,options:r}),je}return Lr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Bo.create(t,{...this._def,...n})}exclude(t,n=this._def){return Bo.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Bo.create=nT;class lx extends Qe{_parse(t){const n=tt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ge.string&&r.parsedType!==ge.number){const i=tt.objectValues(n);return ue(r,{expected:tt.joinValues(i),received:r.parsedType,code:X.invalid_type}),je}if(this._cache||(this._cache=new Set(tt.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=tt.objectValues(n);return ue(r,{received:r.data,code:X.invalid_enum_value,options:i}),je}return Lr(t.data)}get enum(){return this._def.values}}lx.create=(e,t)=>new lx({values:e,typeName:Le.ZodNativeEnum,...Fe(t)});class Af extends Qe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ge.promise&&n.common.async===!1)return ue(n,{code:X.invalid_type,expected:ge.promise,received:n.parsedType}),je;const r=n.parsedType===ge.promise?n.data:Promise.resolve(n.data);return Lr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Af.create=(e,t)=>new Af({type:e,typeName:Le.ZodPromise,...Fe(t)});class Gs extends Qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{ue(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return je;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?je:l.status==="dirty"||n.value==="dirty"?Sc(l.value):l});{if(n.value==="aborted")return je;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?je:a.status==="dirty"||n.value==="dirty"?Sc(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?je:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?je:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!hl(o))return je;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>hl(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):je);tt.assertNever(i)}}Gs.create=(e,t,n)=>new Gs({schema:e,typeName:Le.ZodEffects,effect:t,...Fe(n)});Gs.createWithPreprocess=(e,t,n)=>new Gs({schema:t,effect:{type:"preprocess",transform:e},typeName:Le.ZodEffects,...Fe(n)});class Ki extends Qe{_parse(t){return this._getType(t)===ge.undefined?Lr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ki.create=(e,t)=>new Ki({innerType:e,typeName:Le.ZodOptional,...Fe(t)});class $o extends Qe{_parse(t){return this._getType(t)===ge.null?Lr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}$o.create=(e,t)=>new $o({innerType:e,typeName:Le.ZodNullable,...Fe(t)});class jf extends Qe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ge.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}jf.create=(e,t)=>new jf({innerType:e,typeName:Le.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Fe(t)});class Lf extends Qe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return If(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ji(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ji(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Lf.create=(e,t)=>new Lf({innerType:e,typeName:Le.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Fe(t)});class BS extends Qe{_parse(t){if(this._getType(t)!==ge.nan){const r=this._getOrReturnCtx(t);return ue(r,{code:X.invalid_type,expected:ge.nan,received:r.parsedType}),je}return{status:"valid",value:t.data}}}BS.create=e=>new BS({typeName:Le.ZodNaN,...Fe(e)});class rT extends Qe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Dy extends Qe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?je:s.status==="dirty"?(n.dirty(),Sc(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?je:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Dy({in:t,out:n,typeName:Le.ZodPipeline})}}class Df extends Qe{_parse(t){const n=this._def.innerType._parse(t),r=i=>(hl(i)&&(i.value=Object.freeze(i.value)),i);return If(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Df.create=(e,t)=>new Df({innerType:e,typeName:Le.ZodReadonly,...Fe(t)});var Le;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Le||(Le={}));const y=Fi.create,H=fl.create,se=nx.create,Gi=sx.create;Ks.create;const G=_i.create,P=Ht.create,zB=Tf.create,Jn=Ly.create;Pf.create;Oo.create;const Dr=Rf.create,V=Mf.create,xe=Bo.create;Af.create;Ki.create;$o.create;const FB=Gs.createWithPreprocess,HB=["head","index"],iT=y().regex(/^[A-Za-z0-9][A-Za-z0-9-]{0,127}$/),Of=y().regex(/^[1-9][0-9]*$/),Bf=y().regex(/^[A-Za-z0-9_.-]+$/),bu=y().min(1).max(255).refine(e=>!e.startsWith("-")&&e!=="HEAD"&&!e.startsWith("/")&&!e.endsWith("/")&&!e.endsWith(".")&&!/[\s~^:?*\[\\\x00-\x1f\x7f]/.test(e)&&!e.includes("..")&&!e.includes("@{")&&!e.includes("//")&&e.split("/").every(t=>!t.startsWith(".")&&!t.endsWith(".lock")),"Invalid Git branch"),Oy=y().min(1).max(4096).refine(e=>!e.startsWith("/")&&!e.includes("\0")&&!e.split(/[\\/]/).includes("..")),Yp=P({workspaceId:iT,repoId:Of,owner:Bf,name:Bf,sourceBranch:bu,defaultBranch:bu}).strict(),UB=P({repoId:Of,owner:Bf,name:Bf,defaultBranch:y(),private:se(),description:y().nullable()}),WB=Yp.extend({initialCommit:y(),head:y(),actualBranch:y().nullable(),branches:G(y()).optional(),files:G(P({path:Oy,previousPath:y().optional(),comparison:xe(HB).optional(),status:y(),added:H().nonnegative(),removed:H().nonnegative(),binary:se(),untracked:se().optional()})),totalFiles:H().int().nonnegative().optional(),filesTruncated:se().optional(),added:H().nonnegative(),removed:H().nonnegative(),dirty:se(),conflicted:se(),version:y(),measuredAt:H()}),fa=P({sessionId:iT});Jn("action",[fa.extend({action:V("repositories"),page:H().int().min(1).max(1e3).optional(),search:y().max(100).optional()}).strict(),fa.extend({action:V("branches"),repoId:Of,page:H().int().min(1).max(1e3).optional(),search:y().max(100).optional(),cursor:y().min(1).max(1024).optional()}).strict(),fa.extend({action:V("bind"),repoId:Of,branch:bu}).strict(),fa.extend({action:V("status")}).strict(),fa.extend({action:V("intend"),branch:bu.optional()}).strict(),fa.extend({action:V("diff"),filePath:Oy}).strict()]);P({binding:Yp.nullable().optional(),workspace:WB.nullable().optional(),repositories:G(UB).optional(),branches:G(y()).optional(),hasMore:se().optional(),nextCursor:y().min(1).max(1024).optional(),diff:P({path:Oy,patch:y(),binary:se(),truncated:se(),notStored:se().optional()}).optional()});P({threadId:y().min(1),conversationId:y().min(1),workspace:Yp.optional()});new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");P({id:y().min(1),name:y().min(1),baseUrl:y().min(1),apiKey:y().min(1),remark:y().optional(),createdAt:H(),updatedAt:H()}).strict();const qB=P({id:y().min(1),name:y().min(1),baseUrl:y().min(1),remark:y().optional(),keyMasked:y(),hasKey:se(),createdAt:H(),updatedAt:H()}).strict();P({activeChannelId:y().nullable(),channels:G(qB)}).strict();P({}).strict();P({id:y().min(1).optional(),name:y().min(1),baseUrl:y().min(1),apiKey:y().optional(),remark:y().optional()}).strict();P({id:y().min(1)}).strict();P({id:y().min(1).nullable()}).strict();P({channelId:y().min(1).optional(),updatedAt:H().optional()}).strict().refine(e=>e.updatedAt===void 0||e.channelId!==void 0,{message:"updatedAt requires channelId"});P({channelId:y().nullable(),models:G(P({id:y().min(1),ownedBy:y().optional()}).strict())}).strict();const VB=["owner"],KB=["agent","owner","user-upload"],sT=P({id:y().min(1),relPath:y().min(1),from:xe(KB),label:y().optional(),size:H().int().nonnegative(),mime:y().min(1),addedAt:H().int().nonnegative(),lastEditedAt:H().int().nonnegative().optional(),stale:se().optional()});P({sessionId:y().min(1),relPath:y().min(1),ttlSeconds:H().int().positive().nullable().optional(),view:xe(["raw","md-rendered"]).optional()});P({url:y().min(1),expiresAt:H().int().nonnegative().nullable()});P({sessionId:y().min(1),relPath:y().min(1),label:y().optional(),origin:V("agent").optional()});P({entry:sT});P({sessionId:y().min(1),relPath:y().min(1)});P({removed:V(!0)});P({sessionId:y().min(1)});P({entries:G(sT)});P({attachmentId:y().min(1),url:y().min(1),relPath:y().min(1),sizeBytes:H().int().nonnegative(),mimeType:y().min(1)});const GB=Jn("type",[P({type:V("persona"),id:y().min(1)}).strict(),P({type:V("chat"),id:y().min(1)}).strict(),P({type:V("*")}).strict()]),YB=xe(["read","send","admin"]),By=P({resource:GB,actions:G(YB).min(1)}).strict(),XB=P({id:y().min(1),secretHash:y().regex(/^[a-f0-9]{64}$/),displayName:y(),grants:G(By),issuedAt:H().int().nonnegative(),expiresAt:H().int().positive().optional(),maxUses:H().int().positive().optional(),usedCount:H().int().nonnegative(),peerOwnerId:y().min(1).optional(),firstUsedByPeerAt:H().int().positive().optional(),peerDisplayName:y().optional()}).strict(),ZB=XB.omit({secretHash:!0});P({type:V("whoami:ok"),owner:P({id:y(),kind:xe(["owner","guest"]),displayName:y(),ownerId:y(),provider:y()}).strict(),capability:ZB,grantedPersonas:G(P({id:y().min(1),displayName:y()}).strict())}).strict();P({selfUrl:y().min(1)});P({type:V("contact:handshake:ok"),owner:P({id:y(),ownerId:y(),provider:y(),displayName:y()}),grants:G(By)});const QB=Jn("status",[P({status:V("authorized"),login:y().min(1),source:xe(["git","file"])}).strict(),P({status:V("missing")}).strict(),P({status:V("invalid"),message:y().min(1)}).strict(),P({status:V("pending"),authUrl:y().url()}).strict()]);P({token:y().min(1)}).strict();P({returnTo:y().url().optional()}).strict();const JB=P({url:y().url(),bin:y(),sha256:y().regex(/^[0-9a-f]{64}$/),size:H().int().positive()}),e9=P({name:y().min(1),from:y().optional(),version:y().optional(),min:y().optional(),library:se().optional(),localVersion:y().optional(),artifact:JB.optional(),aptMissing:V(!0).optional(),aptVersion:y().optional()}),t9=P({name:y().min(1),env:G(y().min(1)).min(1)}),$y=y().regex(/^[a-z0-9-]+$/,"连接器名只能是小写字母、数字和短横线"),oT=["proxy","env"],aT=["mcp","cli"],n9=["bearer","lark-sidecar"],r9=["none","shared","personal"],lT=["oauth","fields"],zy=y().regex(/^[A-Z][A-Z0-9_]*$/,"要填的变量名只能是大写字母、数字和下划线,且以字母开头"),cT=P({name:$y,kind:xe(oT),runner:xe(aT),protocol:xe(n9).optional(),id:y().min(1),credentialSource:xe(r9).optional(),auth:xe(lT).optional(),publisherUnionId:y().regex(/^on_[A-Za-z0-9_-]+$/).optional(),fields:G(zy).default([]),http:P({url:y().min(1),headers:Dr(y(),y())}).optional()}),i9=e=>{if(!e||typeof e!="object")return e;let t=e;if("clis"in t&&Array.isArray(t.clis)){const{clis:n,...r}=t;t="packages"in r?r:{...r,packages:n}}if("assets"in t&&Array.isArray(t.assets)&&t.assets.length===0){const{assets:n,...r}=t;t=r}return t},uT=P({version:V(1),entry:y().max(240).regex(/^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*\.mjs$/).refine(e=>!e.split("/").some(t=>[".",".."].includes(t))),timeoutSeconds:H().int().min(1).max(600),checks:G(y().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)).min(1).max(64).refine(e=>new Set(e).size===e.length)}).strict(),dT={test:uT.optional(),packages:G(e9),secrets:G(t9),connectors:G(cT).default([])};P(dT);const Fy=FB(i9,P({version:V(1),...dT}).strict()),s9=P({target:y().min(1),reason:y().min(1),file:y().min(1),quote:y().min(1)}),o9=["integration","production"],er=xe(o9),es=y().regex(/^[a-z0-9.-]+(?::[0-9]+)?\/[a-z0-9._/-]+@sha256:[a-f0-9]{64}$/),cx=y().regex(/^[a-f0-9]{40}$/),a9=y().refine(e=>{try{const t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password&&!t.search&&!t.hash&&t.pathname==="/"&&/(^|[.-])int([.-]|$)/.test(t.hostname)}catch{return!1}},"测试验证地址必须明确指向 int HTTPS 环境"),l9=P({version:V(1),runId:y().regex(/^[A-Za-z0-9_-]{1,128}$/),status:V("passed"),exitCode:V(0),result:P({version:V(1),runId:y().regex(/^[A-Za-z0-9_-]{1,128}$/),checks:G(P({name:y().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),status:V("passed"),reason:y().max(1024).optional()}).strict()).min(1).max(64)}).strict(),execution:P({image:es,imageID:y().min(1).max(512),engine:xe(["codex","pi"]),podUid:y().min(1).max(512),jobUid:y().min(1).max(512)}).strict()}).strict(),hT=P({status:V("passed"),fingerprint:y().regex(/^[a-f0-9]{64}$/),checks:G(y().regex(/^[a-z0-9-]+$/)),endpoint:a9,verifiedAt:y().refine(e=>Number.isFinite(Date.parse(e))),test:l9.optional()}).strict(),fT=P({engine:y().min(1),model:y(),effort:y(),size:y().min(1),cpu:H().positive(),taskConcurrency:H().int().positive()}).strict(),pT=P({version:V(1),environment:V("integration"),component:V("persona"),image:es,commit:cx,baseImage:es,pipelineCommit:cx,repository:y().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/),config:fT.optional(),verification:hT.refine(e=>e.checks.includes("persona-smoke")),test:uT.optional()}).strict().refine(e=>{if(!e.test)return e.verification.test===void 0;const t=e.verification.test;return["persona-dialogue","persona-task","persona-custom-test"].every(n=>e.verification.checks.includes(n))&&t!==void 0&&t.execution.image===e.image&&t.runId===t.result.runId&&t.result.checks.length===e.test.checks.length&&new Set(t.result.checks.map(n=>n.name)).size===e.test.checks.length&&t.result.checks.every(n=>e.test.checks.includes(n.name))},"Declared publisher acceptance requires complete candidate runtime evidence");P({version:V(1),environment:V("integration"),component:V("base"),image:es,commit:cx,verification:hT.refine(e=>e.checks.includes("base-smoke"))}).strict();const wu="-cloud",Hy=`codex${wu}`,$f={standard:"default",fast:"priority"},c9=`claude${wu}`;function mT(e){return e==="codex"||e===Hy}const gT="pi",u9=`${gT}${wu}`;function vT(e){return e===gT||e===u9}function Wc(e){return typeof e=="string"&&e.length>wu.length&&e.endsWith(wu)}const xT=xe([$f.standard,$f.fast]),d9=["tiny","small","medium","large","xlarge"],h9=xe(d9),f9=[.5,1,2],p9=H().refine(e=>f9.includes(e),"Unsupported CPU"),yT=P({model:y().optional(),effort:y().optional()}).strict(),zf=P({personaId:y(),label:y(),model:y().optional(),effort:y().optional(),serviceTier:xT.optional(),public:se(),iconKey:y().optional(),tool:y().optional(),size:y().optional(),cpu:H().finite().optional(),taskConcurrency:H().int().positive().optional(),cloudEngine:yT.optional(),createdAt:H(),updatedAt:H(),cloud:P({gatewayUrl:y().min(1),personaId:y().min(1),publishedByMe:se().optional(),environment:er.optional(),expectedImage:es.optional(),testReleaseId:y().optional()}).strict().optional()}).strict(),m9=P({name:y().min(1),description:y().optional()}),g9=P({id:y().min(1)}),_T=P({writableRoots:G(y()).optional(),denyRead:G(y()).optional(),network:se().optional()}).strict(),v9=P({permissions:P({defaultMode:y().optional(),allow:G(y()).optional(),deny:G(y()).optional()}).optional(),sandbox:P({enabled:se().optional(),autoAllowBashIfSandboxed:se().optional(),allowUnsandboxedCommands:se().optional(),excludedCommands:G(y()).optional(),filesystem:P({denyRead:G(y()).optional(),allowRead:G(y()).optional(),denyWrite:G(y()).optional(),allowWrite:G(y()).optional()}).optional(),network:P({allowedDomains:G(y()).optional(),allowLocalBinding:se().optional()}).optional()}).optional()});zf.extend({personality:y().optional(),personalityLocal:y().optional(),personalityManaged:se().optional(),skills:G(m9).optional(),plugins:G(g9).optional(),sandboxSettings:v9.nullable().optional(),codexSandbox:_T.nullable().optional()});P({slug:y().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:y().min(1),personality:y(),model:y().optional(),effort:y().optional(),serviceTier:zf.shape.serviceTier,tool:y().optional(),public:se().optional(),iconKey:y().optional()}).strict();P({personaId:y().min(1)});P({personaId:y().min(1),patch:P({label:y().min(1).optional(),model:y().optional(),effort:y().optional(),serviceTier:zf.shape.serviceTier,tool:y().optional(),size:h9.optional(),cpu:p9.optional(),taskConcurrency:zf.shape.taskConcurrency,cloudEngine:yT.optional(),personality:y().optional(),personalityLocal:y().optional(),public:se().optional(),iconKey:y().nullable().optional(),codexSandbox:_T.optional()}).strict()}).strict();P({version:V(1),manifest:Fy}).strict();const x9=["hard","soft"],bT=xe(x9),y9=xe(["scanning","done","failed"]),wT=P({id:y().min(1),manifest:Fy,scanSessionId:y().optional(),status:y9,evidence:G(s9).default([]),notes:G(y()).default([]),head:y().min(1).optional(),baseKind:bT.default("hard"),base:y().min(1).optional(),startedAt:H(),finishedAt:H().optional(),error:y().optional()}).strict(),Uy=P({id:y().min(1).optional(),environment:er.optional(),legacy:se().optional(),head:y().min(1),contentHead:y().min(1),scanId:y().min(1),at:H(),pushed:se().optional(),runId:H().int().positive().optional(),runAttempt:H().int().positive().optional(),artifactId:H().int().positive().optional(),verified:pT.optional(),config:fT.optional(),reconfigOf:y().min(1).optional(),workflowVersion:H().int().positive().optional(),confirmation:P({fingerprint:y().regex(/^[a-f0-9]{64}$/),runId:H().int().positive(),runAttempt:H().int().positive(),at:H()}).strict().optional()}).strict(),_9=["prepared","main-pushed","dispatching","dispatched","completed","failed"],Wy=P({id:y().min(1),releaseId:y().min(1),at:H(),verified:pT.optional(),phase:xe(_9),expectedMain:y().optional(),runId:H().int().positive().optional(),runAttempt:H().int().positive().optional(),error:y().optional()}).strict(),$S=P({channelId:y().min(1),updatedAt:H()}).strict(),qy=P({integration:$S.nullable().optional(),production:$S.nullable().optional()}).strict();P({version:V(4),engineChannels:qy.optional(),scans:G(wT),releases:G(Uy),promotions:G(Wy).default([])}).strict();const b9=P({url:y().min(1),branch:y().min(1),head:y().min(1),dirty:se(),ahead:H()}).strict(),Lh=P({env:y().min(1),setAt:H().optional()}).strict(),w9=["pending","running","done","failed","waiting","skipped"],S9=xe(w9),k9="verify",C9=["build","smoke","deploy",k9],E9=xe(C9),I9=P({key:E9,status:S9,url:y().optional(),jobId:H().optional(),startedAt:H().optional(),completedAt:H().optional()}).strict(),Dh=P({runId:H(),headSha:y().min(1),status:xe(["queued","running","completed"]),htmlUrl:y().min(1),jobs:G(I9),environment:er.optional(),branch:y().optional(),event:y().optional(),runAttempt:H().int().positive().optional(),conclusion:xe(["success","failure"]).optional(),promotionId:y().optional()}).strict(),Sg=P({runId:H(),status:Dh.shape.status,conclusion:xe(["success","failure"]).optional(),htmlUrl:y().min(1)}).strict(),ST=P({personaId:y().min(1),engineChannels:qy.optional(),github:QB.optional(),publisherFeishuAuth:P({integration:P({connected:se(),authUrl:y().optional(),error:y().optional()}).strict(),production:P({connected:se(),authUrl:y().optional(),error:y().optional()}).strict()}).strict().optional(),repo:b9.optional(),scans:G(wT).default([]),releases:G(Uy).default([]),promotions:G(Wy).optional(),targets:P({integration:P({run:Dh.optional(),secrets:G(Lh).optional(),online:se().optional(),image:es.optional(),unpublish:Sg.optional()}).strict().optional(),production:P({run:Dh.optional(),secrets:G(Lh).optional(),online:se().optional(),image:es.optional(),unpublish:Sg.optional()}).strict().optional()}).strict().optional(),secrets:G(Lh).optional(),run:Dh.optional(),online:se().optional(),unpublish:Sg.optional(),historyError:y().optional()}).strict();P({before:H().nullable()}).strict();ST.pick({personaId:!0,github:!0,repo:!0,scans:!0,releases:!0,promotions:!0,engineChannels:!0,historyError:!0});ST.pick({scans:!0});P({environment:er,secrets:G(Lh).optional(),engineChannels:qy.optional()}).strict();P({sha:y().min(1),actionsUrl:y().min(1),releaseId:y().optional()}).strict();const Wu=P({personaId:y().min(1)}).strict();Wu.extend({releaseHead:y().min(1).optional(),releaseId:y().min(1).optional(),environment:er.optional()}).strict();Wu.extend({scanBase:bT.optional()}).strict();Wu.extend({scanId:y().min(1)}).strict();Wu.extend({releaseId:y().min(1)}).strict();Wu.extend({environment:er.default("production")}).strict();P({confirmation:Uy.shape.confirmation.unwrap()}).strict();P({promotion:Wy}).strict();P({personaId:y().min(1),expectedImage:es}).strict();P({personaId:y().min(1),scanId:y().min(1),patch:P({manifest:Fy.optional(),connector:cT.optional()}).strict()}).strict();P({personaId:y().min(1),environment:er.default("production"),scanId:y().min(1),name:y().min(1),values:Dr(y(),y())}).strict();P({personaId:y().min(1),environment:er.default("production"),channelId:y().min(1).optional(),auth:P({baseUrl:y(),apiKey:y()}).strict().nullable().optional()}).strict().refine(e=>e.channelId!==void 0||e.auth!==void 0,{message:"Either channelId or auth must be provided"});P({personaId:y().min(1),environment:er.default("production"),releaseId:y().optional(),jobId:H()}).strict();P({personaId:y().min(1),kind:xe(["package","secret","connector"]),item:Dr(y(),Gi()),evidence:P({reason:y().min(1),file:y().min(1),quote:y().min(1)})}).strict();P({personaId:y().min(1),notes:G(y()).default([])}).strict();P({environment:er.default("production")}).strict();const N9=P({deviceId:y().min(1),name:y().min(1),url:y().min(1)});P({type:V("device:list:ok"),devices:G(N9)});P({deviceId:y().min(1),url:y().min(1).optional(),name:y().optional()});P({type:V("device:connect:ok"),deviceId:y(),name:y(),url:y()});const kT=P({ownerId:y().min(1),provider:y().min(1),displayName:y().min(1),avatarUrl:y().optional(),unionId:y().optional()});P({type:V("auth:login:start:ok"),environment:er.optional(),authUrl:y().min(1),state:y().min(1)});P({type:V("auth:getIdentity:ok"),identity:kT.nullable(),deviceId:y().min(1)});P({type:V("auth:logout:ok")});const CT=y().nullable();P({type:V("auth:apiKey:get:ok"),apiKey:y().nullable(),createdAt:y().nullable(),gatewayUrl:CT});P({type:V("auth:apiKey:regenerate:ok"),apiKey:y().min(1),createdAt:y().min(1),gatewayUrl:CT});P({type:V("auth:apiKey:revoke:ok"),revoked:se()});P({type:V("auth:login:done"),environment:er.optional(),identity:kT});P({type:V("auth:login:failed"),environment:er.optional(),reason:y()});P({deviceId:y().min(1),remoteAccessAllowed:se()}).strict();P({type:V("contact:setRemoteAccess:ok"),deviceId:y().min(1),remoteAccessAllowed:se()}).strict();P({type:V("contact:remote-access-updated"),deviceId:y().min(1),remoteAccessAllowed:se()}).strict();P({personaId:y().min(1)}).strict();const T9=["connected","missing","reauth"],P9=["link","fill"],R9=P({name:$y,id:y().min(1),kind:xe(oT),runner:xe(aT),auth:xe(lT),status:xe(T9),action:xe(P9),authUrl:y().optional(),fields:G(zy)}).strict();P({connectors:G(R9)}).strict();P({personaId:y().min(1),name:$y,values:Dr(zy,y().min(1))}).strict();const M9=P({deviceId:y().min(1),ownerId:y().min(1),provider:y().min(1),displayName:y(),remoteUrl:y().min(1),connectToken:y(),grants:G(By),addedAt:H().int().nonnegative(),pinnedAt:H().int().nullable().default(null),remoteAccessAllowed:se().default(!1),note:y().default("")}).strict(),ET=M9;P({deviceId:y().min(1)}).strict();P({type:V("contact:remove:ok"),deviceId:y().min(1)}).strict();P({type:V("contact:list:ok"),contacts:G(ET)}).strict();P({type:V("contact:added"),contact:ET}).strict();P({type:V("contact:removed"),deviceId:y().min(1)}).strict();P({deviceId:y().min(1),pinned:se()}).strict();P({deviceId:y().min(1),note:y()}).strict();P({type:V("contact:setNote:ok"),deviceId:y().min(1),note:y()}).strict();P({type:V("contact:pin:ok"),deviceId:y().min(1),pinnedAt:H().int().nullable()}).strict();P({type:V("contact:pinned"),deviceId:y().min(1),pinnedAt:H().int().nullable()}).strict();const Vy=Jn("kind",[P({kind:V("success"),text:y(),brief:y().optional(),filePaths:G(y()).optional()}),P({kind:V("failure"),reason:y(),brief:y().optional()})]);P({targetPersona:y().min(1).optional(),dispatchId:y().min(1).optional(),prompt:y(),brief:y().optional(),targetDeviceId:y().min(1).optional(),model:y().min(1).optional(),tool:y().min(1).optional(),sessionLabel:y().min(1).max(60).optional(),meta:Dr(Gi()).optional()}).refine(e=>e.targetPersona!==void 0||e.dispatchId!==void 0,{message:"either targetPersona (new dispatch) or dispatchId (follow-up) is required"}).refine(e=>!(e.dispatchId!==void 0&&e.targetDeviceId!==void 0),{message:"cross-device dispatch cannot be continued (dispatchId + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.tool!==void 0&&e.targetDeviceId!==void 0),{message:"engine override is not supported for cross-device dispatch (tool + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.dispatchId!==void 0&&(e.tool!==void 0||e.model!==void 0)),{message:"a follow-up dispatch cannot change engine or model (dispatchId excludes tool / model); start a new dispatch instead"});P({dispatchId:y().min(1),outcome:Vy});const A9=["running","completed","failed"],Ky=xe(A9),j9=P({dispatchId:y().min(1),sourceSessionId:y().min(1),sourcePersonaId:y().min(1).optional(),targetPersonaId:y().min(1),targetDeviceId:y().min(1).optional(),workerSessionId:y().min(1).optional(),taskText:y(),taskBrief:y().optional(),round:H().int().positive().optional(),status:Ky,outcome:Vy.optional(),meta:Dr(Gi()).optional(),createdAt:y().min(1),completedAt:y().min(1).optional(),deliveredAt:y().min(1).optional()});P({sourceSessionId:y().min(1).optional(),relatedSessionId:y().min(1).optional()});P({records:G(j9)});P({dispatchId:y().min(1)});P({type:V("personaDispatch:get:ok"),status:Ky,outcome:Vy.optional()});const L9=/^[a-z0-9][a-z0-9-]*$/;xe(["stopped","starting","running","crashed","invalid"]);const D9=new Set(["localhost","127.0.0.1"]);function O9(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&D9.has(t.hostname))}const Hd=P({id:y().regex(L9),name:y().min(1),version:y().min(1),apiVersion:V("1"),runtime:P({startCommand:y().min(1)}).passthrough().optional(),entry:P({url:y().url().refine(O9,{message:"INVALID_URL_SCHEME: only https or http://localhost is allowed"})}).strict().optional()}).passthrough().superRefine((e,t)=>{var i;const n=!!e.runtime,r=!!((i=e.entry)!=null&&i.url);n&&r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),B9=Jn("kind",[P({kind:V("local"),port:H().int().min(1).max(65535)}),P({kind:V("hosted"),url:y().url()})]);Jn("state",[P({extId:y(),manifest:Hd,state:V("stopped")}),P({extId:y(),manifest:Hd,state:V("starting")}),P({extId:y(),manifest:Hd,state:V("running"),target:B9}),P({extId:y(),manifest:Hd,state:V("crashed")}),P({extId:y(),manifest:Gi().nullable(),state:V("invalid"),invalidReason:y().min(1)})]);P({snapshotHash:y().min(1),version:y().min(1),publishedAt:H()});const $9=Jn("kind",[P({kind:V("p2p-tunnel"),ownerPrincipalId:y().min(1),extId:y().min(1)})]);Jn("kind",[P({kind:V("p2p-tunnel"),ownerPrincipalId:y().min(1),extId:y().min(1),snapshotHash:y().min(1)})]);P({extId:y().min(1),name:y().min(1),version:y().min(1),contentHash:y().min(1),publishedAt:H()});const z9=Jn("kind",[P({kind:V("clean")}),P({kind:V("ready-new-version"),fromVersion:y().min(1),toVersion:y().min(1)}),P({kind:V("error-same-hash"),version:y().min(1)}),P({kind:V("error-version-not-bumped"),localVersion:y().min(1),publishedVersion:y().min(1)}),P({kind:V("error-version-regression"),localVersion:y().min(1),publishedVersion:y().min(1)})]);P({localManifest:P({name:y().min(1),version:y().min(1),contentHash:y().min(1)}),publishState:Jn("kind",[P({kind:V("unpublished")}),P({kind:V("published"),version:y().min(1),contentHash:y().min(1),publishedAt:H()})]),check:z9});P({extId:y().min(1),newVersion:y().min(1).nullish()});P({extId:y().min(1)});P({extId:y().min(1),snapshotHash:y().min(1)});P({channelRef:$9,snapshotHash:y().min(1),zipBase64:y().min(1)});P({id:y().min(1),peerDeviceId:y().min(1),senderDeviceId:y().min(1),text:y().min(1),createdAt:H().int().nonnegative(),readBy:Dr(y().min(1),H().int().positive()).default({}),origin:P({kind:V("persona"),personaId:y().min(1)}).optional()}).strict();P({peerDeviceId:y().min(1).optional(),id:y().min(1),text:y().min(1),createdAt:H().int().nonnegative(),origin:P({kind:V("persona"),personaId:y().min(1)}).optional()}).strict();P({peerDeviceId:y().min(1),sinceCreatedAt:H().int().nonnegative().optional()}).strict();P({peerDeviceId:y().min(1),upToCreatedAt:H().int().nonnegative()}).strict();P({peerDeviceId:y().min(1).optional(),text:y().min(1)});P({peerDeviceId:y().min(1).optional(),command:y().min(1),timeoutMs:H().int().positive().optional()}).strict();P({type:V("peerExec:run:ok"),stdout:y(),stderr:y(),exitCode:H().int().nullable(),timedOut:se(),stdoutTruncated:se(),stderrTruncated:se()}).strict();const IT=Jn("kind",[P({kind:V("at"),at:y().min(1)}),P({kind:V("every"),everyMs:H().int().positive(),anchorMs:H().int().nonnegative().optional()}),P({kind:V("cron"),expr:y().min(1),tz:y().min(1).optional()})]),qu=y().trim().min(1);P({personaId:qu,name:y().min(1),schedule:IT,prompt:y().min(1),targetPersona:y().min(1).optional(),timeoutMs:H().int().positive().optional()});P({personaId:qu,onlyMine:se().optional()});P({personaId:qu,shiftId:y().min(1)});const F9=P({name:y().min(1).optional(),schedule:IT.optional(),prompt:y().min(1).optional(),targetPersona:y().min(1).optional(),timeoutMs:H().int().positive().optional(),enabled:se().optional()});P({personaId:qu,shiftId:y().min(1),patch:F9});P({personaId:qu,shiftId:y().min(1),limit:H().int().positive().optional()});const NT="persona-master",Gy=P({personaId:y().min(1),deviceId:y().min(1).optional()}),TT=P({id:y().min(1),name:y().min(1),memberPersonas:G(Gy),memberContactDeviceIds:G(y().min(1)),createdAt:y().min(1),updatedAt:y().min(1)}),PT=y().trim().min(1);P({name:PT,memberPersonas:G(Gy).default([]),memberContactDeviceIds:G(y().min(1)).default([])});P({channelId:y().min(1),name:PT.optional(),memberPersonas:G(Gy).optional(),memberContactDeviceIds:G(y().min(1)).optional()});P({channelId:y().min(1)});P({channels:G(TT)});P({channel:TT});P({ok:V(!0),removedTopics:H().int().min(0)});const Vt=y().trim().min(1),Yy=["master-confirmed","owner-needed"],Xy=["open","resolved"],H9=Yy[0];Yy[1];Xy[0];const U9=Xy[1],W9=xe(Yy),q9=xe(Xy),V9=P({id:Vt.optional(),resolves:Vt.optional(),type:W9,status:q9,question:Vt,recommendation:Vt}).superRefine((e,t)=>{e.type===H9&&e.status!==U9&&t.addIssue({code:X.custom,path:["status"],message:"master-confirmed decisions must be resolved"})}),K9=["planning","running","done"],G9=xe(K9),RT=P({at:y().min(1),actor:y().min(1),action:y().min(1),target:y().optional(),reason:y().min(1),artifacts:G(Vt).optional(),decision:V9.optional()}),Y9=P({rejectCount:H().int().min(0),accepted:se().default(!1),ordinal:H().int().min(1).optional(),overrideCount:H().int().min(0).optional()}),Zy=P({id:y().min(1),channelId:y().min(1),title:y(),masterSessionId:y().min(1),goal:y(),boundaries:y(),acceptanceCriteria:G(y()),activity:G(RT),lineMeta:Dr(Y9),nextLineOrdinal:H().int().min(1).optional(),state:G9,createdAt:y().min(1),updatedAt:y().min(1)}),X9=P({lineId:y().min(1),dispatchId:y().min(1),workerSessionId:y().optional(),assignee:y().min(1),focus:y(),status:Ky,acceptance:G(y()),rejectCount:H().int().min(0),accepted:se(),ordinal:H().int().min(1).nullable()});P({channelId:y().min(1)});P({topicId:y().min(1).optional(),sessionId:y().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});P({channelId:y().min(1),title:Vt.optional()});P({topicId:y().min(1),title:Vt.optional(),goal:Vt,boundaries:y(),acceptanceCriteria:G(Vt).min(1)});P({topicId:y().min(1),action:Vt,target:Vt.optional(),reason:Vt,artifacts:G(Vt).optional(),decision:RT.shape.decision});P({topicId:y().min(1),lineId:Vt,reason:Vt});P({topicId:y().min(1),lineId:Vt,reason:Vt,artifacts:G(Vt).optional(),watcherVerdict:xe(["pass","fail"]),overrideReason:Vt.optional()}).refine(e=>e.watcherVerdict!=="fail"||!!e.overrideReason,{message:"watcherVerdict=fail 时必须给 overrideReason(推翻 watcher 的理由)",path:["overrideReason"]});P({topicId:y().min(1),state:xe(["done"])});P({topicId:y().min(1),title:Vt});P({topicId:y().min(1)});const Z9=Zy.extend({lineCount:H().int().min(0)});P({topics:G(Z9)});P({topic:Zy,lines:G(X9)});P({topicId:y().min(1),masterSessionId:y().min(1)});P({rejectCount:H().int().min(1),needsOwnerAttention:se()});P({acceptedLines:H().int().min(1),totalLines:H().int().min(1),allAccepted:se(),overrides:H().int().min(0),needsOwnerAttention:se()});P({topic:Zy});P({ok:V(!0),removedMasterSessionId:y().min(1).nullable(),removedWorkerSessionIds:G(y().min(1))});const Q9=["ask","allow","deny"],MT=xe(Q9),J9=P({id:y().min(1),desc:y().min(1),action:MT});P({rules:G(J9)});P({ruleId:y().min(1)});P({action:MT,desc:y(),source:y().min(1)});const e$=["created","review-requested"],AT=/^[A-Za-z0-9._-]+$/,Dl=y().min(1).regex(AT),Ol=y().min(1).regex(AT),Vu=H().int().positive();P({role:xe(e$)});P({owner:Dl,repo:Ol,number:Vu});P({owner:Dl,repo:Ol,number:Vu,expectedHeadSha:y().min(1)});P({owner:Dl,repo:Ol,number:Vu,body:y().min(1)});P({owner:Dl,repo:Ol,number:Vu,ready:se()});P({owner:Dl,repo:Ol});P({owner:Dl,repo:Ol,number:Vu,reviewers:G(y().min(1)).min(1)});P({personaId:y().min(1)});P({personaId:y().min(1)});const t$=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],n$=xe(t$);P({personaId:y().min(1),appId:y().min(1),appSecret:y().min(1),botName:y().min(1).optional()});const r$=P({chatId:y().min(1),chatName:y().optional(),lastActiveAt:H().int().optional()}),i$=P({state:xe(["unbound","provisioning","bound","broken"]),appId:y().optional(),botName:y().optional(),brokenReason:y().optional(),qrUrl:y().optional(),provisionId:y().optional(),errorReason:n$.optional(),groups:G(r$),needsUpgrade:se().optional(),upgradeQrUrl:y().optional()});i$.extend({personaId:y().min(1)});P({});P({onboardingCompletedAt:H()});const Xp=["claude","codex","pi"];P({});P({tools:G(P({id:xe(Xp),available:se(),version:y().optional(),path:y().optional()}))});P({});const s$=P({tool:xe(Xp),cwd:y(),toolSessionId:y(),label:y().optional(),createdAt:y(),updatedAt:y(),turns:H()});P({candidates:G(s$)});P({});P({registered:se()});P({tool:xe(Xp)});const zS=P({usedPercent:H(),windowDurationMins:H().optional(),resetsAt:H().optional()}).strict(),o$=Jn("kind",[P({kind:V("claude"),loggedIn:se(),authMethod:y().optional(),apiProvider:y().optional(),apiKeySource:y().optional(),email:y().optional(),orgName:y().optional(),subscriptionType:y().optional()}).strict(),P({kind:V("codex"),login:Jn("type",[P({type:V("none")}).strict(),P({type:V("apiKey")}).strict(),P({type:V("chatgpt"),email:y(),planType:y()}).strict()]),provider:P({name:y(),baseUrl:y().optional()}).strict(),rateLimits:P({primary:zS.optional(),secondary:zS.optional()}).strict().optional()}).strict(),P({kind:V("pi"),providers:G(P({id:y(),modelCount:H(),credential:xe(["api_key","oauth"]).optional(),oauthExpiresAt:H().optional()}).strict())}).strict()]);P({tool:xe(Xp),installed:se(),version:y().optional(),path:y().optional(),account:o$.optional(),error:y().optional(),modelsLoadedAt:H().optional()}).strict();P({apiKey:y().min(1)}).strict();P({ok:V(!0)}).strict();const a$=["cloud-persona-metrics","cloud-persona-conversations"],l$=xe(a$);P({page:l$}).strict();P({url:y(),expiresAt:H().int()}).strict();const jT=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","session:queue","permission:request","session:question","session:question:cleared","pong","error","subscribed","unsubscribed","auth:ok","tunnel:ready","tunnel:exited","tunnel:unavailable","session:control","session:pty","contact:added","contact:pinned","contact:removed","contact:remote-access-updated","contact:note-updated","org-mesh:progress","channel:changed","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","larkBot:state"],c$="cloud_history_refresh",LT=["idle","running","running-idle","stopped","error","observing"],u$=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools","dispatch-task","dispatch-result"];function Zp(e){return e==="dispatch-task"||e==="dispatch-result"}const d$=["builtin","global","project","plugin"],h$=["builtin","global","project","policy","plugin"],DT=xe(["owner","guest"]);P({id:y().min(1),kind:DT,displayName:y(),feishuUnionId:y().optional()}).strict();const f$=P({did:y().min(1),displayName:y(),feishuUnionId:y().optional(),principal:DT}).strict(),p$=xe(LT),m$=P({inputTokens:H().int().nonnegative(),outputTokens:H().int().nonnegative(),cacheReadTokens:H().int().nonnegative().optional(),cacheCreateTokens:H().int().nonnegative().optional()}),OT={gitBranch:y().optional(),resolvedModel:y().optional(),resolvedEffort:y().optional(),contextUsage:m$.optional(),contextWindowSize:H().int().positive().optional(),aiLabel:y().optional()},g$=P(OT),BT=P({value:y(),label:y(),description:y().optional()}),v$=P({id:y().min(1),label:y().min(1),description:y().optional(),contextWindowSize:H().int().positive(),default:se().optional(),efforts:G(BT).optional(),defaultEffort:y().optional(),group:y().optional()}),x$=P({id:y().min(1),label:y().min(1),description:y().optional()}),y$=P({name:y().min(1),type:xe(["string","select","toggle"]),label:y().min(1),description:y().optional(),options:G(BT).optional(),default:Gi().optional(),scope:xe(["core","tool-specific"])});P({tool:y().min(1),refresh:se().optional()});const _$=P({rewind:se(),subagents:se(),tui:se(),observe:se(),fileSharing:se(),fork:se()});P({tool:y().min(1),toolSessionIdLabel:y().optional(),models:G(v$),permissionModes:G(x$),configSchema:G(y$),features:_$});const b$=P({tool:y().min(1),pattern:y().min(1),createdAt:y().min(1).optional()});P({cloudEnvironment:er.optional(),cloudExpectedImage:es.optional(),testReleaseId:y().optional(),sessionId:y().min(1),cloudExecutionId:y().min(1).optional(),cloudConversationId:y().min(1).optional(),cloudWorkspace:Yp.optional(),cloudPendingTurns:G(P({id:y().min(1),text:y(),prepared:se().optional()})).optional(),cloudBranchIntent:bu.optional(),cloudGatewaySessionId:y().min(1).optional(),cloudPendingCommand:P({id:y().min(1),text:y(),prepared:se().optional()}).optional(),cwd:y().min(1),tool:V("claude").or(y().min(1)).default("claude"),toolSessionId:y().optional(),label:y().optional(),model:y().optional(),permissionMode:y().optional(),effort:y().optional(),serviceTier:y().optional(),...OT,aiLabelGeneratedAt:y().optional(),permissionRules:G(b$).optional(),pinnedAt:H().int().nonnegative().nullable().optional(),archivedAt:H().int().nonnegative().nullable().optional(),pinSortOrder:H().int().nullable().optional(),unreadAt:y().min(1).nullable().optional(),iconKey:y().optional(),forkedFromSessionId:y().min(1).optional(),ephemeral:se().optional(),deployId:y().min(1).optional(),ownerPersonaId:y().min(1).optional(),projectPath:y().min(1).optional(),chatId:y().min(1).optional(),creatorPrincipalId:y().min(1).optional(),creatorDisplayName:y().min(1).optional(),creatorFeishuUnionId:y().min(1).optional(),originOwnerPrincipalId:y().min(1).optional(),originOwnerPersonaId:y().min(1).optional(),dispatchedFromSessionId:y().min(1).optional(),shiftFiredFromSessionId:y().min(1).optional(),larkChatId:y().min(1).optional(),larkChatName:y().min(1).optional(),larkChatType:xe(["p2p","group"]).optional(),createdAt:y().min(1),updatedAt:y().min(1)});const qn={turnId:y().min(1).optional(),seq:H().int().nonnegative().optional(),ts:y().optional(),uuid:y().optional()},w$=xe(u$),S$=P({readCount:H().int().nonnegative().optional(),searchCount:H().int().nonnegative().optional(),bashCount:H().int().nonnegative().optional(),editFileCount:H().int().nonnegative().optional(),linesAdded:H().int().nonnegative().optional(),linesRemoved:H().int().nonnegative().optional(),otherToolCount:H().int().nonnegative().optional()}),k$=P({oldStart:H().int().nonnegative(),oldLines:H().int().nonnegative(),newStart:H().int().nonnegative(),newLines:H().int().nonnegative(),lines:G(y())}),C$=P({agentId:y().optional(),agentType:y().optional(),status:y().optional(),prompt:y().optional(),filePath:y().optional(),structuredPatch:G(k$).optional(),stats:P({durationMs:H().int().nonnegative().optional(),tokens:H().int().nonnegative().optional(),toolUseCount:H().int().nonnegative().optional(),toolStats:S$.optional()}).optional()}),E$=P({path:y(),content:y(),mtimeMs:H().optional()}),I$=P({label:y().min(1),description:y().optional()}),$T=P({question:y().min(1),multiSelect:se(),options:G(I$).min(1)}),N$=["completed","interrupted"];Jn("kind",[P({...qn,kind:V("session_init"),toolSessionId:y().optional()}),P({...qn,kind:V("thinking"),text:y(),partialId:y().optional()}),P({...qn,kind:V("text"),text:y(),partialId:y().optional()}),P({...qn,kind:V("user_text"),text:y(),meta:w$.optional(),taskId:y().optional(),parentToolUseId:y().optional(),sender:f$.optional()}),P({...qn,kind:V("tool_call"),toolUseId:y(),tool:y(),toolKind:y().optional(),input:Gi()}),P({...qn,kind:V("tool_result"),toolUseId:y(),output:Gi().optional(),error:y().optional(),toolResultExtra:C$.optional(),sourceToolAssistantUUID:y().optional(),askQuestionAnswers:Dr(y(),y()).optional()}),P({...qn,kind:V("attachment_memories"),memories:G(E$)}),P({...qn,kind:V("permission_request"),requestId:y(),tool:y(),input:Gi(),toolUseId:y().optional()}),P({...qn,kind:V("ask_user_question"),toolUseId:y(),questions:G($T)}),P({...qn,kind:V("turn_end"),durationMs:H().int().nonnegative().optional(),reason:xe(N$).optional(),turnId:y().min(1).optional()}),P({...qn,kind:V("subagent_progress"),toolUseId:y(),agentId:y(),status:xe(["started","running","completed","failed"]),description:y().optional(),lastToolName:y().optional(),prompt:y().optional(),stats:P({durationMs:H().int().nonnegative().optional(),tokens:H().int().nonnegative().optional(),toolUseCount:H().int().nonnegative().optional()}).optional()}),P({...qn,kind:V("error"),message:y()}),P({...qn,kind:V("meta_update"),patch:g$}),P({...qn,kind:V("meta-text"),text:y(),metaSource:xe(["cc","owner"]).optional()})]);P({cwd:y().min(1).optional(),tool:y().optional(),label:y().optional(),aiLabel:y().optional(),model:y().optional(),permissionMode:y().optional(),effort:y().optional(),serviceTier:xT.optional(),iconKey:y().optional(),forkedFromSessionId:y().min(1).optional(),forkAt:zB([P({messageUuid:y().min(1)}).strict(),P({turnId:y().min(1)}).strict()]).optional(),ephemeral:se().optional(),ownerPersonaId:y().min(1).optional(),projectPath:y().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});P({path:y().min(1),name:y().min(1),createdAt:y().datetime(),pinnedAt:H().optional()});P({path:y().min(1),pinnedAt:H().nullable()});P({path:y().min(1)});P({path:y().min(1).optional(),name:y().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});P({cwd:y().min(1),tool:y().min(1),toolSessionId:y().min(1),label:y().optional(),aiLabel:y().optional(),iconKey:y().optional(),createdAt:y().datetime(),updatedAt:y().datetime(),ownerPersonaId:y().min(1).optional()});P({originOnly:se().optional(),ownerPersonaId:y().min(1).optional(),limit:H().int().positive().optional(),offset:H().int().nonnegative().optional()});P({sessionId:y().min(1)});P({sessionId:y().min(1),patch:P({label:y().optional(),model:y().optional(),permissionMode:y().optional(),effort:y().optional(),cwd:y().optional(),iconKey:y().optional(),ephemeral:V(!1).optional()})});P({id:y().min(1),text:y(),queuedAt:H(),senderDisplayName:y().optional()});P({sessionId:y().min(1),text:y(),queueWhileRunning:se().optional()});P({sessionId:y().min(1),id:y().min(1).optional()});P({sessionId:y().min(1),userMessageId:y().min(1),dryRun:se().optional()});P({canRewind:se(),error:y().optional(),filesChanged:G(y()).optional(),insertions:H().int().nonnegative().optional(),deletions:H().int().nonnegative().optional()});P({sessionId:y().min(1),userMessageId:y().min(1)});const T$=P({oldStart:H().int().nonnegative(),oldLines:H().int().nonnegative(),newStart:H().int().nonnegative(),newLines:H().int().nonnegative(),lines:G(y())}),P$=P({filePath:y().min(1),hunks:G(T$),insertions:H().int().nonnegative(),deletions:H().int().nonnegative(),status:xe(["modified","added","deleted"]).optional()});P({canRewind:se(),error:y().optional(),files:G(P$),totalInsertions:H().int().nonnegative(),totalDeletions:H().int().nonnegative()});P({userMessageIds:G(y())});P({sessionId:y().min(1),toolSessionId:y().min(1)});P({cwd:y().min(1),toolSessionId:y().min(1),messageUuid:y().min(1).optional(),turnId:y().min(1).optional(),sourceSessionId:y().min(1).optional(),targetCwd:y().min(1).optional()}).refine(e=>!!(e.messageUuid||e.turnId),"messageUuid or turnId required");P({forkedToolSessionId:y().min(1),forkedFilePath:y().min(1)});P({sessionId:y().min(1),toolSessionId:y().min(1),jsonlPath:y().optional()});P({sessionId:y().min(1),afterSeq:H().int().min(-1)});P({sessionId:y().min(1),permissionRequestId:y().min(1),allow:se(),permanent:se().optional(),pattern:y().optional()});P({projectPath:y().min(1)});P({sessionId:y().min(1),limit:H().int().positive().max(5e3).optional(),offset:H().int().nonnegative().optional(),snapshotId:y().uuid().optional(),slim:se().optional(),view:xe(["turns","items"]).optional(),cursor:y().min(1).max(16384).optional(),turnId:y().min(1).max(256).optional()}).superRefine((e,t)=>{e.view==="items"&&!e.turnId&&t.addIssue({code:X.custom,path:["turnId"],message:"items requires turnId"}),e.view&&(e.offset!==void 0||e.slim!==void 0)&&t.addIssue({code:X.custom,message:"native views do not accept offset or slim"}),!e.view&&(e.cursor!==void 0||e.turnId!==void 0)&&t.addIssue({code:X.custom,message:"cursor and turnId require a native view"}),e.view==="turns"&&e.turnId!==void 0&&t.addIssue({code:X.custom,path:["turnId"],message:"turns does not accept turnId"}),e.view&&e.limit!==void 0&&e.limit>100&&t.addIssue({code:X.custom,path:["limit"],message:"native page limit is 100"})});P({cwd:y().min(1),toolSessionId:y().min(1)});P({cwd:y().min(1),toolSessionId:y().min(1),subagentId:y().min(1)});P({cwd:y().min(1).optional(),path:y().optional(),showHidden:se().optional()});P({cwd:y().min(1),path:y().min(1)});P({cwd:y().min(1),tool:y().optional()});P({name:y().min(1),source:xe(d$),path:y().optional(),description:y().optional(),plugin:y().optional()});const R$=P({name:y().min(1),source:xe(h$),path:y().optional(),description:y().optional(),whenToUse:y().optional(),plugin:y().optional()});P({cwd:y().min(1),tool:y().optional()});P({agents:G(R$)});P({sessionId:y().optional()});P({sessionId:y().min(1).optional()});P({sessionId:y().min(1),pinned:se()});P({sessionId:y().min(1),archived:se()});P({query:y().min(1),sessionIds:G(y().min(1)),limit:H().int().positive().max(50).optional()});const M$=P({sessionId:y().min(1),snippet:y()});P({type:V("session:searchContent"),matches:G(M$)});P({type:V("peerSession:upsert:ok")});P({sessionId:y().min(1)});P({type:V("peerSession:remove:ok")});P({orderedIds:G(y().min(1)).min(1)});P({cwd:y().min(1)});P({isGitRoot:se(),gitRoot:y().nullable()});P({cwd:y().min(1)});P({branch:y().nullable()});P({cwd:y().min(1)});P({branches:G(y()),head:y().nullable()});const A$=P({cwd:y().min(1),updatedAt:y().min(1)});P({dirs:G(A$)});P({type:V("session:question"),sessionId:y().min(1),toolUseId:y().min(1),requestId:y().min(1),questions:G($T).min(1)});P({type:V("session:question:cleared"),sessionId:y().min(1),toolUseId:y().min(1),answers:Dr(y(),y()).optional()});P({sessionId:y().min(1),toolUseId:y().min(1),answers:Dr(y(),y())});P({ok:V(!0)});P({sessionId:y().min(1),toolUseId:y().min(1)});P({ok:V(!0)});const zT=P({name:y().min(1),version:y().min(1),instanceId:y().min(1),deviceLabel:y().transform(e=>e.trim().slice(0,64)).optional()});P({type:V("auth"),token:y().min(1),scheme:V("bearer").optional(),clientInfo:zT.optional()});P({type:V("auth:ok"),version:y().min(1).optional(),protocolVersion:H().int().nonnegative().optional()});const j$=P({clientId:y().min(1),connectedAt:H().int().nonnegative(),self:se(),clientInfo:zT.optional()});P({type:V("device:connections:ok"),connections:G(j$)});P({type:V("tunnel:ready"),url:y().min(1),subdomain:y().min(1)});P({type:V("tunnel:exited"),code:H().int().nullable(),subdomain:y().nullable(),url:y().nullable()});P({type:V("tunnel:unavailable"),reason:y().min(1),failedAt:y().min(1)});const L$=P({sessionId:y().min(1),status:p$,freshSpawn:se(),pendingPermissionRequestIds:G(y().min(1)),pendingQuestionToolUseIds:G(y().min(1))});P({type:V("info"),version:y(),protocolVersion:H(),hostname:y(),os:y(),tools:G(P({id:y(),available:se()})),runningSessions:G(L$),tokenRole:xe(VB).optional(),isLoopback:se().optional(),httpBaseUrl:y().optional(),httpToken:y().optional(),daemonSource:xe(["ota","packaged"]).optional(),globalCliVersion:y().nullable().optional()});P({});P({method:y().min(1).optional()});const D$=["allowed","conditional","denied"],O$=xe(D$),B$=P({name:y().min(1),status:O$,description:y().min(1),args:G(P({name:y(),required:se()})).nullable(),argsSchema:Dr(Gi()).optional(),reason:y().optional()});P({type:V("meta:methods"),methods:G(B$)});const FS=1,$$=P({usedBytes:H().int().nonnegative(),sizeBytes:H().int().positive(),measuredAt:H().int().nonnegative()}).strict();P({volume:$$.nullable()}).strict();const HS=25*1024*1024,Qy={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".pdf":"application/pdf",".txt":"text/plain",".md":"text/plain",".markdown":"text/plain",".csv":"text/plain",".log":"text/plain",".json":"application/json",".xml":"application/xml",".yaml":"application/yaml",".yml":"application/yaml",".html":"text/html",".conf":"text/plain",".cfg":"text/plain",".ini":"text/plain",".toml":"text/plain"},FT=new Set([...Object.values(Qy),"application/x-yaml"]),z$=[...FT,"text/*",...Object.keys(Qy)].join(",");function HT(e,t){const n=t.split(";",1)[0].trim().toLowerCase();if(n===""||n==="application/octet-stream"){const r=e.lastIndexOf("."),i=r>0?e.slice(r).toLowerCase():"";return Qy[i]??null}return FT.has(n)||n.startsWith("text/")?n:null}const F$=["daemon","main","renderer"],H$=xe(F$),U$=["debug","info","warn","error"],W$=xe(U$);P({ts:H().int(),source:H$,level:W$,msg:y(),ownerPrincipalId:y(),deviceId:y(),appVersion:y(),daemonVersion:y().optional(),os:y(),meta_json:y().optional(),sessionId:y().optional()});P({v:V(1),visitorId:y().min(1),displayName:y(),provider:y(),iat:H(),exp:H()});const q$=P({visitorId:y(),displayName:y(),avatarUrl:y().optional(),provider:y(),firstSeen:H(),lastSeen:H()});P({visitors:G(q$)});P({type:V("web:open"),url:y().min(1),expiresAt:H()});P({ticket:y().min(1)}).strict();P({token:y().min(1),expiresAt:H()});const V$=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,UT=/<system-reminder>此消息来自 (owner|guest):(.+?)<\/system-reminder>\s*$/,WT="clawd-dispatch-task",qT="clawd-dispatch-result",US=120;function K$(e){if(!e)return null;const t=e.search(WS(WT)),n=e.search(WS(qT));return t<0&&n<0?null:n<0?"task":t<0?"result":t<n?"task":"result"}function G$(e){if(!e)return[];const t=[];for(const n of["task","result"]){const r=n==="task"?WT:qT,i=new RegExp(`<${r}\\b([^>]*)>([\\s\\S]*?)</${r}>`,"gi");for(let s=i.exec(e);s!==null;s=i.exec(e))t.push({at:s.index,block:Y$(n,s[1]??"",s[2]??"")})}return t.sort((n,r)=>n.at-r.at).map(n=>n.block)}function Y$(e,t,n){var c;const r=nz(t),i=ux(tz(kg(n,"detail")??n)),s=(c=kg(n,"brief"))==null?void 0:c.trim(),o=s&&s.length>0?ux(s):X$(i),a=r.round!==void 0?Number.parseInt(r.round,10):void 0,l=r.status;return{kind:e,dispatchId:r["dispatch-id"]??"",...r.from?{from:r.from}:{},...e==="task"&&a!==void 0&&Number.isFinite(a)?{round:a}:{},...e==="result"&&(l==="success"||l==="failure")?{status:l}:{},brief:o,briefIsDerived:!(s&&s.length>0),detail:i,filePaths:ez(kg(n,"files"))}}function X$(e){const t=e.split(/\n\s*\n/).map(r=>r.trim()).find(r=>r.length>0);if(!t)return"";const n=t.replace(/\s+/g," ");return n.length>US?`${n.slice(0,US)}…`:n}const Z$="clawd-dispatch-task|clawd-dispatch-result|brief|detail|files",Q$=new RegExp(`<\\\\(\\\\*)(/?)(${Z$})\\b`,"g");function J$(e){return ux(e)}function ux(e){return e.replace(Q$,"<$1$2$3")}function kg(e,t){const n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`,"i").exec(e);return n?n[1]??"":null}function ez(e){return e?e.split(`
|
|
96
|
+
`).map(t=>t.trim()).filter(t=>t.startsWith("- ")).map(t=>t.slice(2).trim()).filter(t=>t.length>0):[]}function tz(e){return e.replace(/^\n/,"").replace(/\n$/,"")}function WS(e){return new RegExp(`<${e}\\b[^>]*>`,"i")}function nz(e){const t={},n=/([a-z-]+)="([^"]*)"/gi;for(let r=n.exec(e);r!==null;r=n.exec(e))t[r[1]]=rz(r[2]??"");return t}function rz(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}const iz=new Set(["localhost","127.0.0.1","0.0.0.0","::1"]);let Ai=null;function sz(){if(Ai!==null)return Ai;if(typeof window>"u")return Ai=!1,!1;if(iz.has(window.location.hostname)||window.location.protocol==="file:")return Ai=!0,!0;if(new URLSearchParams(window.location.search).get("debug")==="1"){Ai=!0;try{sessionStorage.setItem("debug","1")}catch{}}else try{Ai=sessionStorage.getItem("debug")==="1"}catch{Ai=!1}return Ai}function $e(e,...t){sz()&&console.log(`[${e}][${new Date().toISOString()}]`,...t)}function Ud(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const oz=e=>{const t=[1e3,2e3,4e3,8e3,16e3,3e4];return t[Math.min(e,t.length-1)]},az=new Set(["auth:ok","pong","error"]),qS=new Set(jT.filter(e=>!az.has(e)));let lz=0;const VS=()=>`r${++lz}`;function cz(e){let t=e.url,n=e.authToken,r=e.selfIdentity;const i=e.clientInfo,s=e.requestTimeoutMs??3e4,o=e.pingIntervalMs??3e4,a=e.watchdogMs??6e4,l=e.authTimeoutMs??1e4,c=e.backoffMs??oz;let u=null,d=!1,f=0,p=null,m=null,v=null,w=null,x=!1,_="disconnected";const b=new Map,S=new Map;let C=null;const k=(B,I)=>{var U;B==="ready"&&(C=I),(U=S.get(B))==null||U.forEach(q=>{try{q(I)}catch{}})},T=B=>{_!==B&&(_=B,k("status",B))},E=(B,I)=>{const U=S.get(B)??new Set;if(U.add(I),S.set(B,U),B==="ready"&&C!==null)try{I(C)}catch{}return()=>U.delete(I)},D=()=>{m&&(clearInterval(m),m=null),v&&(clearTimeout(v),v=null),w&&(clearTimeout(w),w=null)},N=()=>{v&&clearTimeout(v),v=setTimeout(()=>{try{u==null||u.close(4e3,"pong watchdog")}catch{}},a)},L=()=>{m&&clearInterval(m),m=setInterval(()=>{(u==null?void 0:u.readyState)===1&&u.send(JSON.stringify({type:"ping",requestId:VS()}))},o),N()},R=B=>{for(const[,I]of b)clearTimeout(I.timer),I.reject(new Error(B));b.clear()},M=[],A=()=>{if(M.length===0)return;const B=M.splice(0);for(const I of B)(u==null?void 0:u.readyState)===1&&!x?I.doSend():(clearTimeout(I.timer),I.reject(new Error("NOT_CONNECTED")))},j=B=>{if(M.length===0)return;const I=M.splice(0);for(const U of I)clearTimeout(U.timer),U.reject(new Error(B))},z=()=>{if(d)return;const B=c(f);if(B<0){j("connection closed: not reconnecting");return}k("daemon:reconnecting",{attempt:f+1,nextDelayMs:B,scheduledAt:Date.now()}),p&&clearTimeout(p),p=setTimeout(()=>{f+=1,$()},B)},F=B=>{N();const I=String(B.type??"");if(I==="auth:ok"){$e("daemon-client","auth:ok received → connected",{url:t}),w&&(clearTimeout(w),w=null),x=!1,f=0,T("connected"),k("daemon:connected",{url:t}),L(),A();return}if(I==="pong")return;if(I==="ready"){const q=Number(B.protocolVersion??-1);q!==FS&&k("daemon:version-mismatch",{daemonProtocol:q,supportedProtocol:FS}),k("ready",B);return}const U=B.requestId;if(typeof U=="string"&&b.has(U)){const q=b.get(U);if(b.delete(U),clearTimeout(q.timer),I==="error"){const O=String(B.code??"ERR"),te=String(B.message??"unknown");q.reject(new Error(`${O}: ${te}`))}else qS.has(I)&&k(I,B),q.resolve(B);return}qS.has(I)&&k(I,B)},$=()=>{p&&(clearTimeout(p),p=null),$e("daemon-client","connect →",{url:t,token:Ud(n),attempt:f}),T("connecting");let B;try{B=new WebSocket(t)}catch(I){T("disconnected"),k("daemon:disconnected",{reason:(I==null?void 0:I.message)??"ws constructor failed"}),z();return}u=B,x=!!n,B.onopen=()=>{if(B!==u){$e("daemon-client","onopen → stale (replaced before opened), ignore");return}if(n){$e("daemon-client","onopen → send auth frame",{token:Ud(n)});const I={type:"auth",token:n};r!=null&&r.principalId&&(I.selfPrincipalId=r.principalId),r!=null&&r.displayName&&(I.selfDisplayName=r.displayName),i&&(I.clientInfo=i),B.send(JSON.stringify(I)),w=setTimeout(()=>{try{B.close(4001,"auth handshake timeout")}catch{}},l)}else $e("daemon-client","onopen → no token, treat as connected (daemon authMode=none)"),f=0,T("connected"),k("daemon:connected",{url:t}),L(),A()},B.onclose=I=>{if(B!==u){$e("daemon-client","onclose → stale, ignore",{code:I.code,reason:I.reason});return}const U=I.reason||(I.code===1008?"auth failed":`close ${I.code}`);if($e("daemon-client","onclose →",{code:I.code,reason:U,awaitingAuth:x,manualStop:d}),D(),R(`connection closed: ${U}`),u=null,I.code===4401?T("revoked"):T("disconnected"),k("daemon:disconnected",{reason:U}),I.code===1008||I.code===4401){j(`connection closed: ${U}`);return}d?j(`connection closed: ${U}`):z()},B.onerror=()=>{},B.onmessage=I=>{if(B!==u)return;let U;try{U=JSON.parse(String(I.data))}catch{return}F(U)}};return{start(){d=!1,f=0,$()},stop(){d=!0,p&&(clearTimeout(p),p=null),D();try{u==null||u.close(1e3,"shutdown")}catch{}u=null,R("shutdown"),j("shutdown"),T("disconnected")},switchProfile(B){$e("daemon-client","switchProfile →",{url:B.url,token:Ud(B.authToken)},"prev:",{url:t,token:Ud(n)}),t=B.url,n=B.authToken,B.selfIdentity!==void 0&&(r=B.selfIdentity),f=0,d=!0,p&&(clearTimeout(p),p=null),D(),R("switch profile"),j("switch profile");try{u==null||u.close(1e3,"switch profile")}catch{}u=null,d=!1,$()},request(B,I,U){return new Promise((q,O)=>{const te=(U==null?void 0:U.requestId)??VS(),le=performance.now();let Y;const re=I,ke=B==="cloud:workspace"&&((re==null?void 0:re.action)==="repositories"||(re==null?void 0:re.action)==="branches"),oe=(he,Be)=>{var Ge;if(!ke)return;const Je=performance.now();k("cloud:workspace:timing",{traceId:te,phase:he,outcome:Be,sessionId:re==null?void 0:re.sessionId,action:re==null?void 0:re.action,page:re==null?void 0:re.page,searchLength:((Ge=re==null?void 0:re.search)==null?void 0:Ge.length)??0,hasSearch:!!(re!=null&&re.search),hasCursor:!!(re!=null&&re.cursor),durationMs:Math.round(Je-le),queueMs:Math.round((Y??Je)-le),roundTripMs:Y===void 0?void 0:Math.round(Je-Y)})},Ie=(he,Be="error")=>{oe("finished",Be),O(he)};oe("started");const Ee=setTimeout(()=>{b.delete(te);const he=M.findIndex(Be=>Be.timer===Ee);he>=0&&M.splice(he,1),Ie(new Error(`request timeout: ${B}`),"timeout")},B==="cloud:workspace"?Math.max(s,33e4):s),Re=()=>{Y=performance.now(),oe("sent"),b.set(te,{resolve:he=>{oe("finished","ok"),q(he)},reject:Ie,timer:Ee}),u.send(JSON.stringify({...I,type:B,requestId:te}))};(u==null?void 0:u.readyState)===1&&!x?Re():d||u==null&&p==null?(clearTimeout(Ee),Ie(new Error("NOT_CONNECTED"),"disconnected")):M.push({doSend:Re,reject:Ie,timer:Ee})})},on:E,get isOpen(){return(u==null?void 0:u.readyState)===1&&!x},get url(){return t},getStatus(){return _}}}function uz(e){const t=e.trim(),n=t.indexOf("#");if(n<0)return{url:t};const r=t.slice(0,n),i=t.slice(n+1),o=new URLSearchParams(i).get("token")??void 0;return{url:r,token:o??void 0}}function dz(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}function hz(e){return e?{id:e.id,mode:e.mode,url:e.url,token:dz(e.token),name:e.name}:null}function Wd(e){return e?Array.isArray(e)?e.map(hz):{_notArray:typeof e,_value:e}:null}function KS(e){return e==null?null:typeof e=="object"&&"value"in e?e.value:e}const fz="ws://127.0.0.1:18790",GS="daemon:profiles",YS="daemon:active-profile-id";function pz(){return Math.random().toString(36).slice(2,10)}function mz(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.name=="string"&&(t.mode==="localhost"||t.mode==="remote")&&typeof t.url=="string"&&(t.token===void 0||typeof t.token=="string")}function VT(e){let t={profiles:[],activeId:null},n=!1,r=null;const i=new Set,s=()=>{for(const l of i)l(t)},o=async()=>{$e("profile-store","persist →",Wd(t.profiles),"active:",t.activeId),await e.kv.set(GS,t.profiles),await e.kv.set(YS,t.activeId)},a=async()=>{if(!n){if(r){await r;return}r=(async()=>{var l;try{let c=null;try{const d=await e.kv.get(GS);c=KS(d)}catch{c=null}let u=null;try{const d=await e.kv.get(YS);u=KS(d)??null}catch{u=null}if($e("profile-store","ensureLoaded read kv →","profiles:",Wd(c),"activeId:",u),Array.isArray(c)&&c.length>0){const d=c.filter(mz),f=u&&d.some(p=>p.id===u)?u:((l=d[0])==null?void 0:l.id)??null;t={profiles:d,activeId:f},n=!0,$e("profile-store","ensureLoaded → use kv profiles",Wd(d),"active:",f);return}t={profiles:[{id:"default",name:"本机",mode:"localhost",url:fz}],activeId:"default"},$e("profile-store","ensureLoaded → fallback synthesized default (NO token)",Wd(t.profiles)),n=!0,await o()}finally{r=null}})(),await r}};return{async load(){return await a(),s(),t},async snapshot(){return await a(),t},async upsert(l){var w;await a();let c=l.url,u=l.token;if(c&&c.includes("#")){const x=uz(c);c=x.url,!u&&x.token&&(u=x.token)}const d=l.id?t.profiles.find(x=>x.id===l.id):void 0,f=u!=null&&u.trim()?u.trim():d==null?void 0:d.token;if(l.mode==="remote"&&!f)throw new Error("remote mode requires token");const p=l.id??pz(),m={id:p,name:((w=l.name)==null?void 0:w.trim())||(d==null?void 0:d.name)||(l.mode==="remote"?"远程":"本机"),mode:l.mode,url:c.trim(),token:f};return t={profiles:[...t.profiles.filter(x=>x.id!==p),m],activeId:p},await o(),s(),m},async delete(l){var d;await a();const c=t.profiles.filter(f=>f.id!==l);let u=t.activeId;u===l&&(u=((d=c[0])==null?void 0:d.id)??null),t={profiles:c,activeId:u},await o(),s()},async activate(l){await a(),t.profiles.some(c=>c.id===l)&&(t={...t,activeId:l},await o(),s())},subscribe(l){return i.add(l),()=>i.delete(l)},getActive(){return n?t.profiles.find(l=>l.id===t.activeId)??null:null}}}const XS="clawd.client-instance-id";let gz={name:"clawd-web",version:"unknown"};function vz(){let e=null;try{e=localStorage.getItem(XS),e||(e=crypto.randomUUID(),localStorage.setItem(XS,e))}catch{e=e??crypto.randomUUID()}return{...gz,instanceId:e}}const xz=g.createContext(null);function yz(){return g.useContext(xz)}function ZS(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const KT=g.createContext(null);function _z({host:e,children:t}){const[n,r]=g.useState(null),i=yz(),s=g.useRef(i);s.current=i;const o=l=>{const c=s.current;return c&&c.profileId===l.id?c.getToken()??l.token:l.token},a=g.useMemo(()=>async()=>{const l=VT(e),c=await l.load(),u=c.profiles.find(f=>f.id===c.activeId)??c.profiles[0];if(!u)throw new Error("DaemonProvider: profile store has no profiles after load");return $e("daemon-context","bootstrap → createDaemonClient",{id:u.id,url:u.url,token:ZS(o(u))}),{client:cz({url:u.url,authToken:o(u),clientInfo:vz()}),store:l}},[e]);return g.useEffect(()=>{let l=!0,c=null,u=null;return a().then(d=>{l&&(d.client.start(),c=d,r(d),u=d.store.subscribe(()=>{const f=d.store.getActive();if(!f){$e("daemon-context","subscribe → no active profile, skip switchProfile");return}$e("daemon-context","subscribe → switchProfile",{id:f.id,url:f.url,token:ZS(f.token)}),d.client.switchProfile({url:f.url,authToken:o(f)})}))}),()=>{l=!1,u==null||u(),c==null||c.client.stop()}},[a]),n?h.jsx(KT.Provider,{value:n,children:t}):null}function Ni(){const e=g.useContext(KT);if(!e)throw new Error("useDaemonClient must be used inside <DaemonProvider>");return e.client}function bz(){const e=Ni(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i.mode,o=s==="tui"?"tui":"sdk";$e("daemon-context","useDaemonMode ready.mode =",{rawMode:s,resolved:o}),n(o)}),[e]),t}function wz(){const e=Ni(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i;s.version!==void 0&&n(s.principalKind==="guest"?"guest":"owner")}),[e]),t}const GT=g.createContext(null);function Sz({cache:e,children:t}){return g.createElement(GT.Provider,{value:e},t)}function as(){const e=g.useContext(GT);if(!e)throw new Error("useCache must be used inside <CacheProvider>");return e}function ts(e){const t=as(),n=g.useCallback(i=>t.observe(e,()=>i()),[t,e]),r=g.useCallback(()=>t.read(e),[t,e]);return g.useSyncExternalStore(n,r,r)}const YT={actionsLevel:"none",httpBaseUrl:null,httpToken:null},XT=g.createContext(YT);function Qp(){return g.useContext(XT)}function kz(e){return e!=null&&e.httpBaseUrl?{actionsLevel:e.tokenRole==="owner"?"owner":"none",httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken??null}:YT}function Cz(){const e=ts("daemon-info");return g.useMemo(()=>kz(e),[e])}function Ez({children:e}){const t=Cz();return Ze.createElement(XT.Provider,{value:t},e)}function Iz(e,t,n){if(!e.httpBaseUrl)return null;const r=encodeURIComponent(n);return`${e.httpBaseUrl}/session/${encodeURIComponent(t.sessionId)}/files?path=${r}`}function Nz(e){const t=new Map;return{observe(n,r){let i=t.get(n);i||(i={data:void 0,hasData:!1,listeners:new Set},t.set(n,i));const s=l=>r(l);i.listeners.add(s);const o=i.listeners.size===1;s(i.hasData?i.data:void 0),o&&e.onFirstObserver(n);let a=!1;return()=>{if(a)return;a=!0;const l=t.get(n);l&&(l.listeners.delete(s),l.listeners.size===0&&(t.delete(n),e.onLastObserver(n)))}},read(n){const r=t.get(n);return r!=null&&r.hasData?r.data:void 0},setData(n,r){const i=t.get(n);if(!i)return;const s=i.hasData?i.data:void 0,o=r(s);i.data=o,i.hasData=!0;for(const a of i.listeners)a(o)}}}function Tz(){const e=[],t=new Map,n=r=>{for(const i of e)if(i.pattern.test(r))return i.source;return null};return{register(r,i){e.push({pattern:r,source:i})},activate(r){if(t.has(r))return;const i=n(r);if(!i)throw new Error(`no source registered for key: ${r}`);t.set(r,i.start(r))},deactivate(r){const i=t.get(r);i&&(t.delete(r),i())}}}function Pz(e){return{request:(t,n)=>e.request(t,n),onFrame(t){const n=[];for(const r of jT)n.push(e.on(r,i=>t(r,i)));return()=>{for(const r of n)r()}},onConnect(t){return e.on("daemon:connected",()=>t())},get isConnected(){return e.isOpen}}}function ZT(e){const t=(e??"claude")==="claude";return{rewind:t,subagents:t,tui:t,observe:t,fileSharing:t,fork:t}}const Rz=e=>({tool:e,models:[{id:"",label:"未指定",contextWindowSize:2e5,default:!0}],permissionModes:[{id:"",label:"未指定"}],configSchema:[],features:ZT(e)});function Mz(e,t){return{start(n){const r=n.replace(/^capabilities\//,"");let i=!1;const s=async()=>{try{const a=await e.request("capabilities:get",{tool:r});if(i)return;t(n,()=>a)}catch{if(i)return;t(n,()=>Rz(r))}},o=e.onConnect(()=>{s()});return s(),()=>{i=!0,o()}}}}function Az(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("session:list",void 0);if(r)return;t(n,()=>a.sessions??[])}catch{}},s=e.onFrame((a,l)=>{if(a==="session:info"){const c=l;if(c.chatId!==void 0)return;t(n,u=>[c,...(u??[]).filter(d=>d.sessionId!==c.sessionId)])}else if(a==="session:deleted"){const c=l;t(n,u=>(u??[]).filter(d=>d.sessionId!==c.sessionId))}}),o=e.onConnect(()=>{i()});return i(),()=>{r=!0,s(),o()}}}}const zo={sessionId:null,events:[],lastSeq:-1,foldFloor:-1,pendingPermissions:[],status:"idle",pendingQuestions:{},queued:[]};function Cg(e,t){const n=t;if(n.kind==="permission_request"&&typeof n.requestId=="string"){if(e.some(i=>i.requestId===n.requestId))return e;const r={requestId:n.requestId,tool:typeof n.tool=="string"?n.tool:"",input:n.input,...typeof n.toolUseId=="string"&&n.toolUseId?{toolUseId:n.toolUseId}:{}};return[...e,r]}if(n.kind==="tool_result"&&typeof n.toolUseId=="string"&&n.toolUseId){const r=e.findIndex(i=>i.toolUseId===n.toolUseId);if(r>=0)return e.filter((i,s)=>s!==r)}return e}function dx(e){return e.kind==="text"||e.kind==="thinking"}function QT(e){return e.seqEnd??e.seq}function JT(e,t,n){if(!e||!dx(e)||!dx(t)||e.kind!==t.kind||!e.partialId||e.partialId!==t.partialId)return null;const r=QT(e);if(r===void 0||t.seq===void 0||t.seq!==r+1||r<=n)return null;const{uuid:i,...s}=e;return{...s,...t.uuid?{uuid:t.uuid}:{},text:e.text+t.text,seqEnd:t.seq}}function QS(e,t){const n=[];for(const r of e){const i=JT(n[n.length-1],r,t);i?n[n.length-1]=i:n.push(r)}return n}function Ff(e,t,n){const r=n===void 0?e.sessionId:n;switch(t.type){case"session:change":return{...zo,sessionId:t.sessionId};case"session:event":{if(!r||t.sessionId!==r)return e;const i=typeof t.event.seq=="number"?t.event.seq:-1,s=JT(e.events[e.events.length-1],t.event,e.foldFloor),o=s?[...e.events.slice(0,-1),s]:[...e.events,t.event],a=i>e.lastSeq?i:e.lastSeq,l=Cg(e.pendingPermissions,t.event);return{...e,events:o,lastSeq:a,pendingPermissions:l}}case"session:fold-barrier":return!r||t.sessionId!==r||e.foldFloor===e.lastSeq?e:{...e,foldFloor:e.lastSeq};case"session:status":return!r||t.sessionId!==r?e:{...e,status:t.status};case"session:queue":return!r||t.sessionId!==r?e:{...e,queued:t.items};case"session:events":{if(!r||t.sessionId!==r)return e;const i=QS(t.events.map(o=>o.event),e.foldFloor),s=i.reduce((o,a)=>Cg(o,a),[]);return{...e,sessionId:t.sessionId,events:i,lastSeq:t.latestSeq,pendingPermissions:s}}case"session:events:append":{if(!r||t.sessionId!==r)return e;const i=new Set;for(const c of e.events){const u=c.seq;if(typeof u!="number")continue;i.add(u);const d=dx(c)?QT(c):void 0;if(d!==void 0)for(let f=u+1;f<=d;f++)i.add(f)}const s=[];for(const c of t.events)typeof c.seq=="number"&&(i.has(c.seq)||s.push(c.event));const o=t.latestSeq>e.lastSeq?t.latestSeq:e.lastSeq;if(s.length===0)return o===e.lastSeq?e:{...e,lastSeq:o};const a=QS([...e.events,...s].sort((c,u)=>{const d=c.seq??-1,f=u.seq??-1;return d-f}),e.foldFloor),l=s.reduce((c,u)=>Cg(c,u),e.pendingPermissions);return{...e,events:a,lastSeq:o,pendingPermissions:l}}case"permission:request":{if(!r||t.sessionId!==r||e.pendingPermissions.some(s=>s.requestId===t.requestId))return e;const i={requestId:t.requestId,tool:t.tool,input:t.input,...t.toolUseId?{toolUseId:t.toolUseId}:{}};return{...e,pendingPermissions:[...e.pendingPermissions,i]}}case"permission:clear":{if(!r||r!==t.sessionId)return e;const i=t.requestId,s=e.pendingPermissions.findIndex(c=>c.requestId===i),o=s>=0?e.pendingPermissions.filter((c,u)=>u!==s):e.pendingPermissions;if(e.events.length===0)return o===e.pendingPermissions?e:{...e,pendingPermissions:o};const a=e.events.length-1,l=e.events[a];return l.kind==="permission_request"&&l.requestId===i?{...e,pendingPermissions:o,events:e.events.slice(0,a)}:o===e.pendingPermissions?e:{...e,pendingPermissions:o}}case"session:question":return!r||t.sessionId!==r?e:{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{toolUseId:t.toolUseId,requestId:t.requestId,questions:t.questions}}};case"session:question:clear":{if(!r||t.sessionId!==r||!(t.toolUseId in e.pendingQuestions))return e;const{[t.toolUseId]:i,...s}=e.pendingQuestions;return{...e,pendingQuestions:s}}case"session:question:submitted":{if(!r||t.sessionId!==r)return e;const i=e.pendingQuestions[t.toolUseId];return i?{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{...i,submittedAnswers:t.answers}}}:e}case"session:rewound":return!r||t.sessionId!==r?e:{...e,pendingPermissions:[],status:"idle"};case"ready":{if(!r)return e;const i=t.runningSessions.find(o=>o.sessionId===r);if(i!=null&&i.freshSpawn)return{...zo,sessionId:r};const s=(i==null?void 0:i.status)??"idle";return s===e.status?e:{...e,status:s}}case"daemon:disconnected":return{...e,pendingPermissions:[]};default:return e}}const jz="session/";function Lz(e){return{sid:e.slice(jz.length)}}const Dz=new Set(LT);function e4(e){return Dz.has(e)}function JS(e){return e4(e)?e:"idle"}function Oz(e,t){return{start(n){const{sid:r}=Lz(n);let i=!1,s=-1;const o=f=>{t(n,p=>Ff(p??zo,f,r))},a=async f=>{const p=f==="baseline"?-1:s;try{const m=await e.request("session:events",{sessionId:r,afterSeq:p});if(i)return;const v=m.events??[],w=m.latestSeq??-1;if(f==="baseline")o({type:"session:events",sessionId:r,events:v,latestSeq:w}),s=w;else{const x=m.bufferStartSeq??0,_=w<p||x>p+1;o({type:_?"session:events":"session:events:append",sessionId:r,events:v,latestSeq:w}),s=Math.max(s,w)}}catch{}},l=async()=>{try{const f=await e.request("info");if(i)return;o({type:"ready",runningSessions:(f.runningSessions??[]).map(p=>({sessionId:p.sessionId,freshSpawn:p.freshSpawn,status:JS(p.status)}))})}catch{}},c=async()=>{try{await e.request("session:subscribe",{sessionId:r})}catch{}i||(await a(s<0?"baseline":"delta"),!i&&await l())},u=e.onFrame((f,p)=>{if(!i)if(f==="session:event"){const m=p;if(m.sessionId!==r)return;const v=m.event.seq;o({type:"session:event",sessionId:m.sessionId,event:m.event}),typeof v=="number"&&v>s&&(s=v)}else if(f==="session:status"){const m=p;if(m.sessionId!==r)return;if(!e4(m.status)){$e("session-events","push session:status drop",{sid:r,status:m.status});return}$e("session-events","push session:status",{sid:r,status:m.status}),o({type:"session:status",sessionId:m.sessionId,status:m.status})}else if(f==="session:cleared"){if(p.sessionId!==r)return;$e("session-events","push session:cleared",{sid:r}),o({type:"session:change",sessionId:r}),s=-1}else if(f==="session:queue"){const m=p;if(m.sessionId!==r)return;$e("session-events","push session:queue",{sid:r,count:m.items.length}),o({type:"session:queue",sessionId:m.sessionId,items:m.items})}else if(f==="permission:request"){const m=p;if(m.sessionId!==r)return;o({type:"permission:request",sessionId:m.sessionId,requestId:m.requestId,tool:m.tool,input:m.input,...typeof m.toolUseId=="string"&&m.toolUseId?{toolUseId:m.toolUseId}:{}})}else if(f==="session:question"){const m=p;if(m.sessionId!==r)return;o({type:"session:question",sessionId:m.sessionId,toolUseId:m.toolUseId,requestId:m.requestId,questions:m.questions})}else if(f==="session:question:cleared"){const m=p;if(m.sessionId!==r)return;m.answers&&Object.keys(m.answers).length>0?o({type:"session:question:submitted",sessionId:m.sessionId,toolUseId:m.toolUseId,answers:m.answers}):o({type:"session:question:clear",sessionId:m.sessionId,toolUseId:m.toolUseId})}else if(f==="session:rewound"){const m=p;if(m.sessionId!==r)return;o({type:"session:rewound",sessionId:m.sessionId,userMessageId:m.userMessageId})}else f==="ready"&&o({type:"ready",runningSessions:(p.runningSessions??[]).map(v=>({sessionId:v.sessionId,freshSpawn:v.freshSpawn,status:JS(v.status)}))})}),d=e.onConnect(()=>{c()});return e.isConnected&&c(),()=>{i=!0,u(),d(),e.request("session:unsubscribe",{sessionId:r}).catch(()=>{})}}}}const Bz=new Set(["tunnel:ready","tunnel:exited","tunnel:unavailable"]);function $z(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("info",void 0);if(r)return;t(n,()=>a)}catch{}},s=e.onConnect(()=>{i()}),o=e.onFrame(a=>{Bz.has(a)&&i()});return i(),()=>{r=!0,s(),o()}}}}function zz(){return{start(){return()=>{}}}}function Fz(e,t){return{start(n){let r=!1;const i=async()=>{try{const o=await e.request("persona:list",{});if(r)return;t(n,()=>o.personas??[])}catch{}},s=e.onConnect(()=>{i()});return i(),()=>{r=!0,s()}}}}function Hz(e){const t=Pz(e),n=Tz();let r=null;const i=(o,a)=>{r==null||r.setData(o,a)};n.register(/^capabilities\//,Mz(t,i)),n.register(/^sessions$/,Az(t,i)),n.register(/^session\//,Oz(t,i)),n.register(/^personas$/,Fz(t,i)),n.register(/^persona-detail\//,zz()),n.register(/^daemon-info$/,$z(t,i));const s=Nz({onFirstObserver:o=>{o&&n.activate(o)},onLastObserver:o=>{o&&n.deactivate(o)}});return r=s,{cache:s,channel:t}}class Jp{constructor(t){this.client=t}info(){return this.client.request("info")}attachmentSignUrl(t){return this.client.request("attachment.signUrl",t)}attachmentGroupAdd(t,n,r){return this.client.request("attachment.groupAdd",{sessionId:t,relPath:n,...r?{label:r}:{}})}attachmentGroupRemove(t,n){return this.client.request("attachment.groupRemove",{sessionId:t,relPath:n})}attachmentGroupList(t){return this.client.request("attachment.groupList",{sessionId:t})}sessionCreate(t){return this.client.request("session:create",t)}projectList(){return this.client.request("project:list")}projectCreate(t){return this.client.request("project:create",{...t.path?{path:t.path}:{},...t.name?{name:t.name}:{}})}projectPatch(t){return this.client.request("project:patch",t)}projectReveal(t){return this.client.request("project:reveal",{path:t})}sessionList(){return this.client.request("session:list")}sessionGet(t){return this.client.request("session:get",{sessionId:t})}sessionUpdate(t,n){return this.client.request("session:update",{sessionId:t,patch:n})}sessionDelete(t){return this.client.request("session:delete",{sessionId:t})}sessionSend(t,n,r){return this.client.request("session:send",{sessionId:t,text:n,...r!=null&&r.queueWhileRunning?{queueWhileRunning:!0}:{}})}sessionDequeue(t,n){return this.client.request("session:dequeue",{sessionId:t,...n?{id:n}:{}})}sessionStop(t){return this.client.request("session:stop",{sessionId:t})}sessionInterrupt(t){return this.client.request("session:interrupt",{sessionId:t})}sessionRewind(t){return this.client.request("session:rewind",t)}sessionRewindableMessageIds(t){return this.client.request("session:rewindable-message-ids",{sessionId:t})}sessionRewindDiff(t){return this.client.request("session:rewind-diff",t)}sessionNew(t){return this.client.request("session:new",{sessionId:t})}sessionFork(t){return this.client.request("session:fork",t)}sessionResume(t,n){return this.client.request("session:resume",{sessionId:t,toolSessionId:n})}sessionObserve(t){return this.client.request("session:observe",t)}sessionEvents(t,n){return this.client.request("session:events",{sessionId:t,afterSeq:n})}sessionSubscribe(t){return this.client.request("session:subscribe",{sessionId:t})}sessionUnsubscribe(t){return this.client.request("session:unsubscribe",{sessionId:t})}pinSession(t,n){return this.client.request("session:pin",{sessionId:t,pinned:n})}searchSessionContent(t){return this.client.request("session:searchContent",t)}archiveSession(t,n){return this.client.request("session:archive",{sessionId:t,archived:n})}markSessionRead(t){return this.client.request("session:markRead",{sessionId:t})}reorderPins(t){return this.client.request("session:reorderPins",{orderedIds:t})}peerSessionUpsert(t){return this.client.request("peerSession:upsert",t)}peerSessionRemove(t){return this.client.request("peerSession:remove",{sessionId:t})}permissionRespond(t){return this.client.request("permission:respond",t)}answerQuestion(t){return this.client.request("session:answerQuestion",t)}cancelQuestion(t){return this.client.request("session:cancelQuestion",t)}historyProjects(){return this.client.request("history:projects")}historyList(t){return this.client.request("history:list",{projectPath:t})}historyRead(t){return this.client.request("history:read",t)}historyPage(t){return this.client.request("history:read",t)}historySubagents(t){return this.client.request("history:subagents",t)}historySubagentRead(t){return this.client.request("history:subagent-read",t)}listRecentDirs(){return this.client.request("history:recentDirs",{})}getGitRoot(t){return this.client.request("git:root",{cwd:t})}getGitBranch(t){return this.client.request("git:branch",{cwd:t})}listGitBranches(t){return this.client.request("git:branches",{cwd:t})}personaCreate(t){return this.client.request("persona:create",t)}personaList(){return this.client.request("persona:list",{})}personaGet(t){return this.client.request("persona:get",{personaId:t})}personaUpdate(t,n){return this.client.request("persona:update",{personaId:t,patch:n})}personaDelete(t){return this.client.request("persona:delete",{personaId:t})}larkBotBindManual(t,n,r){return this.client.request("larkBot:bindManual",{personaId:t,appId:n,appSecret:r})}larkBotUnbind(t){return this.client.request("larkBot:unbind",{personaId:t})}larkBotStatus(t){return this.client.request("larkBot:status",{personaId:t})}toolsProbe(){return this.client.request("tools:probe",{})}sessionExternalScan(){return this.client.request("session:externalScan",{})}sessionImportExternal(t){return this.client.request("session:importExternal",t)}onboardingComplete(){return this.client.request("onboarding:complete",{})}onboardingIosInterest(){return this.client.request("onboarding:iosInterest",{})}visitorList(){return this.client.request("visitor:list",{})}workspaceList(t={}){return this.client.request("workspace:list",t)}workspaceRead(t){return this.client.request("workspace:read",t)}skillsList(t,n){return this.client.request("skills:list",{cwd:t,...n?{tool:n}:{}})}agentsList(t,n){return this.client.request("agents:list",{cwd:t,...n?{tool:n}:{}})}capabilitiesGet(t="claude",n){return this.client.request("capabilities:get",{tool:t,...n!=null&&n.refresh?{refresh:!0}:{}})}engineStatus(t){return this.client.request("engine:status",{tool:t})}engineConnectPool(t){return this.client.request("engine:connectPool",{apiKey:t})}subscriptionChannelGet(){return this.client.request("subscriptionChannel:get",{})}subscriptionChannelSave(t){return this.client.request("subscriptionChannel:save",t)}subscriptionChannelDelete(t){return this.client.request("subscriptionChannel:delete",{id:t})}subscriptionChannelActivate(t){return this.client.request("subscriptionChannel:activate",{id:t})}subscriptionChannelModels(t={}){return this.client.request("subscriptionChannel:models",t)}shiftList(){return this.client.request("shift:list")}deployGet(t,n={}){return this.client.request("deploy:get",{personaId:t,...n})}deployGetLocal(t){return this.client.request("deploy:getLocal",{personaId:t})}deployScan(t,n){return this.client.request("deploy:scan",{personaId:t,...n?{scanBase:n}:{}})}deployPatch(t,n,r){return this.client.request("deploy:patch",{personaId:t,scanId:n,patch:r})}deployPutSecret(t,n,r,i,s){return this.client.request("deploy:putSecret",{personaId:t,scanId:n,name:r,values:i,...s?{environment:s}:{}})}deploySetEngineAuth(t,n,r){return n&&"channelId"in n?this.client.request("deploy:setEngineAuth",{personaId:t,channelId:n.channelId,...r?{environment:r}:{}}):this.client.request("deploy:setEngineAuth",{personaId:t,auth:n,...r?{environment:r}:{}})}deployRerunJob(t,n,r){return this.client.request("deploy:rerunJob",{personaId:t,jobId:n,...r?{environment:r}:{}})}deployUnpublish(t){return this.client.request("deploy:unpublish",{personaId:t})}deployRelease(t,n){return this.client.request("deploy:release",{personaId:t,scanId:n})}deployConfirmTest(t,n){return this.client.request("deploy:confirmTest",{personaId:t,releaseId:n})}deployApplyConfig(t,n){return this.client.request("deploy:applyConfig",{personaId:t,releaseId:n})}deployPromote(t,n){return this.client.request("deploy:promote",{personaId:t,releaseId:n})}deployOpenTest(t,n){return this.client.request("deploy:openTest",{personaId:t,releaseId:n})}cloudConnectorsList(t){return this.client.request("cloud:connectors:list",{personaId:t})}cloudWorkspace(t,n){return n?this.client.request("cloud:workspace",t,n):this.client.request("cloud:workspace",t)}cloudVolumeGet(){return this.client.request("cloud:volume:get",{})}dashboardOpenUrl(t){return this.client.request("dashboard:openUrl",{page:t})}cloudConnectorFill(t,n,r){return this.client.request("cloud:connectors:fill",{personaId:t,name:n,values:r})}channelList(){return this.client.request("channel:list")}channelCreate(t){return this.client.request("channel:create",t)}channelUpdate(t){return this.client.request("channel:update",t)}channelDelete(t){return this.client.request("channel:delete",t)}topicList(t){return this.client.request("topic:list",t)}topicGet(t){return this.client.request("topic:get",t)}topicCreate(t){return this.client.request("topic:create",t)}topicClose(t){return this.client.request("topic:close",t)}topicRename(t){return this.client.request("topic:rename",t)}topicDelete(t){return this.client.request("topic:delete",t)}personaDispatchList(t){return this.client.request("personaDispatch:list",t)}githubAuthGet(){return this.client.request("githubAuth:get")}githubAuthOauthStart(t){return this.client.request("githubAuth:oauthStart",t?{returnTo:t}:{})}githubAuthAuthorize(t){return this.client.request("githubAuth:authorize",{token:t})}githubStatus(){return this.client.request("github:status")}githubPrList(t){return this.client.request("github:prList",{role:t})}githubPrDetail(t){return this.client.request("github:prDetail",{...t})}githubPrMerge(t){return this.client.request("github:prMerge",{...t})}githubPrComment(t){return this.client.request("github:prComment",{...t})}githubPrSetReady(t){return this.client.request("github:prSetReady",{...t})}githubCollaborators(t){return this.client.request("github:collaborators",{...t})}githubPrRequestReviewers(t){return this.client.request("github:prRequestReviewers",{...t})}}function Uz(e){const[t,n]=g.useState(e.isOpen?{kind:"connected",url:""}:{kind:"connecting"});return g.useEffect(()=>{const r=e.on("ready",l=>{const c=l;n(u=>({kind:"connected",url:u.kind==="connected"?u.url:"",mode:u.kind==="connected"?u.mode:void 0,daemonVersion:c.version,protocolVersion:c.protocolVersion,daemonSource:c.daemonSource,globalCliVersion:c.globalCliVersion,onboardingCompletedAt:c.onboardingCompletedAt}))}),i=e.on("daemon:connected",l=>{const c=l;n(u=>({kind:"connected",url:c.url,mode:c.mode,daemonVersion:u.kind==="connected"?u.daemonVersion:void 0,protocolVersion:u.kind==="connected"?u.protocolVersion:void 0,daemonSource:u.kind==="connected"?u.daemonSource:void 0,globalCliVersion:u.kind==="connected"?u.globalCliVersion:void 0,onboardingCompletedAt:u.kind==="connected"?u.onboardingCompletedAt:void 0}))}),s=e.on("daemon:disconnected",l=>{const c=(l==null?void 0:l.reason)??"";/auth failed|auth timeout|auth required|auth handshake timeout/i.test(c)?n({kind:"auth-failed",reason:c}):n({kind:"disconnected",reason:c})}),o=e.on("daemon:reconnecting",l=>{const c=l;n({kind:"reconnecting",attempt:c.attempt,nextDelayMs:c.nextDelayMs,scheduledAt:c.scheduledAt??Date.now()})}),a=e.on("daemon:version-mismatch",l=>{const c=l;n({kind:"version-mismatch",daemonProtocol:c.daemonProtocol,supportedProtocol:c.supportedProtocol})});return()=>{r(),i(),s(),o(),a()}},[e]),t}function Wz(e){const t=as(),n=ts(e.kind==="connected"?"sessions":""),r=g.useCallback(async()=>{t.setData("sessions",i=>i??[])},[t]);return{sessions:n??[],loading:!1,loaded:n!==void 0,error:null,refresh:r}}function Bl(){const e=Ni();return g.useMemo(()=>new Jp(e),[e])}function t4(e){return{personaId:e.personaId,label:e.label,model:e.model,effort:e.effort,serviceTier:e.serviceTier,tool:e.tool,...e.size!==void 0?{size:e.size}:{},...e.cpu!==void 0?{cpu:e.cpu}:{},...e.taskConcurrency!==void 0?{taskConcurrency:e.taskConcurrency}:{},...e.cloudEngine?{cloudEngine:e.cloudEngine}:{},public:e.public,createdAt:e.createdAt,updatedAt:e.updatedAt,...e.cloud?{cloud:e.cloud}:{}}}function n4(){const e=as(),t=Bl(),n=ts("personas")??[],r=g.useMemo(()=>n.map(s=>t4(s)),[n]),i=g.useCallback(async()=>{const s=await t.personaList();e.setData("personas",()=>s.personas??[])},[t,e]);return{personas:r,raw:n,loaded:ts("personas")!==void 0,refresh:i}}function r4(e){const{raw:t}=n4(),n=as(),r=Bl(),i=e?t.find(a=>a.personaId===e)??null:null,s=i?t4(i):null,o=g.useCallback(async a=>{if(!e)return;(a==null?void 0:a.personaId)===e&&n.setData("personas",c=>{const u=c??[];return u.some(d=>d.personaId===e)?u.map(d=>d.personaId===e?a:d):[...u,a]});const l=await r.personaList();n.setData("personas",()=>l.personas??[])},[e,r,n]);return{persona:s,raw:i,loaded:!!s,refresh:o}}function qz(e){const t=Bl(),n=as(),r=e?`persona-detail/${e}`:"",i=ts(r),s=g.useCallback(async()=>{const o={personality:"",personalityLocal:"",personalityManaged:!1,skills:[],plugins:[],sandboxSettings:null,codexSandbox:null};if(!e)return o;let a=null;try{a=await t.personaGet(e)}catch(c){$e("personas","personaGet failed → empty detail",{personaId:e,err:c}),a=null}const l=a?{personality:a.personality??"",personalityLocal:a.personalityLocal??"",personalityManaged:a.personalityManaged??!1,skills:a.skills??[],plugins:a.plugins??[],sandboxSettings:a.sandboxSettings??null,codexSandbox:a.codexSandbox??null}:o;return n.setData(r,()=>l),l},[t,n,e,r]);return g.useEffect(()=>{e&&s()},[e,s]),{personality:(i==null?void 0:i.personality)??"",personalityLocal:(i==null?void 0:i.personalityLocal)??"",personalityManaged:(i==null?void 0:i.personalityManaged)??!1,skills:(i==null?void 0:i.skills)??[],plugins:(i==null?void 0:i.plugins)??[],sandboxSettings:(i==null?void 0:i.sandboxSettings)??null,codexSandbox:(i==null?void 0:i.codexSandbox)??null,loaded:i!==void 0,refresh:s}}function i4(){const e=as(),t=Bl();return g.useCallback(async()=>{const n=await t.personaList();e.setData("personas",()=>n.personas??[])},[e,t])}function Vz(){const e=Bl(),t=i4();return g.useCallback(async(n,r)=>{const i=await e.personaUpdate(n,r);return await t(),i},[e,t])}function Kz(){const e=Bl(),t=i4();return g.useCallback(async n=>{await e.personaDelete(n),await t()},[e,t])}const ek="clawd:sidebar:tree-collapsed";function Gz(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function Yz(e){const t=Gz(e);if(!Array.isArray(t))return new Set;const n=new Set;for(const r of t)typeof r=="string"&&n.add(r);return n}function Xz(){const e=ky(),[t,n]=g.useState(()=>new Set),r=g.useRef(t);r.current=t,g.useEffect(()=>{let l=!1;return(async()=>{try{const c=await e.kv.get(ek);if(l)return;n(Yz(c))}catch{}})(),()=>{l=!0}},[e]);const i=g.useCallback(l=>{e.kv.set(ek,[...l]).catch(()=>{})},[e]),s=g.useCallback(l=>r.current.has(l),[]),o=g.useCallback(l=>{n(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),i(u),u})},[i]),a=g.useCallback(l=>{n(c=>{let u=!1;const d=new Set;for(const f of c)l.has(f)?d.add(f):u=!0;return u?(i(d),d):c})},[i]);return{isCollapsed:s,toggle:o,prune:a}}const Jy=g.createContext(null);function Zz(){const e=g.useContext(Jy);if(!e)throw new Error("SessionTreeCollapsedContext.Provider missing — wrap SessionTreeNode tree with <SessionTreeCollapsedContext.Provider value={useSessionTreeCollapsed()}>");return e}/**
|
|
97
97
|
* @license lucide-react v0.577.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
@@ -493,7 +493,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
493
493
|
*
|
|
494
494
|
* This source code is licensed under the ISC license.
|
|
495
495
|
* See the LICENSE file in the root directory of this source tree.
|
|
496
|
-
*/const nH=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],rH=de("zap",nH);function v4(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=v4(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function x4(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=v4(e))&&(r&&(r+=" "),r+=t);return r}const iH=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},sH=(e,t)=>({classGroupId:e,validator:t}),y4=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Wf="-",ak=[],oH="arbitrary..",aH=e=>{const t=cH(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return lH(o);const a=o.split(Wf),l=a[0]===""&&a.length>1?1:0;return _4(a,l,t)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?iH(c,l):l:c||ak}return n[o]||ak}}},_4=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const c=_4(e,t+1,s);if(c)return c}const o=n.validators;if(o===null)return;const a=t===0?e.join(Wf):e.slice(t).join(Wf),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},lH=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?oH+r:void 0})(),cH=e=>{const{theme:t,classGroups:n}=e;return uH(n,t)},uH=(e,t)=>{const n=y4();for(const r in e){const i=e[r];i_(i,n,r,t)}return n},i_=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];dH(o,t,n,r)}},dH=(e,t,n,r)=>{if(typeof e=="string"){hH(e,t,n);return}if(typeof e=="function"){fH(e,t,n,r);return}pH(e,t,n,r)},hH=(e,t,n)=>{const r=e===""?t:b4(t,e);r.classGroupId=n},fH=(e,t,n,r)=>{if(mH(e)){i_(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(sH(n,e))},pH=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];i_(l,b4(t,a),n,r)}},b4=(e,t)=>{let n=e;const r=t.split(Wf),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=y4(),n.nextPart.set(o,a)),n=a}return n},mH=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,gH=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},px="!",lk=":",vH=[],ck=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),xH=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const s=[];let o=0,a=0,l=0,c;const u=i.length;for(let v=0;v<u;v++){const w=i[v];if(o===0&&a===0){if(w===lk){s.push(i.slice(l,v)),l=v+1;continue}if(w==="/"){c=v;continue}}w==="["?o++:w==="]"?o--:w==="("?a++:w===")"&&a--}const d=s.length===0?i:i.slice(l);let f=d,p=!1;d.endsWith(px)?(f=d.slice(0,-1),p=!0):d.startsWith(px)&&(f=d.slice(1),p=!0);const m=c&&c>l?c-l:void 0;return ck(s,p,f,m)};if(t){const i=t+lk,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):ck(vH,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},yH=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],a=o[0]==="[",l=t.has(o);a||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},_H=e=>({cache:gH(e.cacheSize),parseClassName:xH(e),sortModifiers:yH(e),...aH(e)}),bH=/\s+/,wH=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],a=e.trim().split(bH);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:v}=n(u);if(d){l=u+(l.length>0?" "+l:l);continue}let w=!!v,x=r(w?m.substring(0,v):m);if(!x){if(!w){l=u+(l.length>0?" "+l:l);continue}if(x=r(m),!x){l=u+(l.length>0?" "+l:l);continue}w=!1}const _=f.length===0?"":f.length===1?f[0]:s(f).join(":"),b=p?_+px:_,S=b+x;if(o.indexOf(S)>-1)continue;o.push(S);const C=i(x,w);for(let k=0;k<C.length;++k){const T=C[k];o.push(b+T)}l=u+(l.length>0?" "+l:l)}return l},SH=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=w4(n))&&(i&&(i+=" "),i+=r);return i},w4=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=w4(e[r]))&&(n&&(n+=" "),n+=t);return n},kH=(e,...t)=>{let n,r,i,s;const o=l=>{const c=t.reduce((u,d)=>d(u),e());return n=_H(c),r=n.cache.get,i=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const u=wH(l,n);return i(l,u),u};return s=o,(...l)=>s(SH(...l))},CH=[],Yt=e=>{const t=n=>n[e]||CH;return t.isThemeGetter=!0,t},S4=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,k4=/^\((?:(\w[\w-]*):)?(.+)\)$/i,EH=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,IH=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,NH=/\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$/,TH=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,PH=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RH=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ms=e=>EH.test(e),qe=e=>!!e&&!Number.isNaN(Number(e)),gs=e=>!!e&&Number.isInteger(Number(e)),Ig=e=>e.endsWith("%")&&qe(e.slice(0,-1)),ji=e=>IH.test(e),C4=()=>!0,MH=e=>NH.test(e)&&!TH.test(e),s_=()=>!1,AH=e=>PH.test(e),jH=e=>RH.test(e),LH=e=>!ve(e)&&!ye(e),DH=e=>no(e,N4,s_),ve=e=>S4.test(e),uo=e=>no(e,T4,MH),uk=e=>no(e,WH,qe),OH=e=>no(e,R4,C4),BH=e=>no(e,P4,s_),dk=e=>no(e,E4,s_),$H=e=>no(e,I4,jH),qd=e=>no(e,M4,AH),ye=e=>k4.test(e),cc=e=>ea(e,T4),zH=e=>ea(e,P4),hk=e=>ea(e,E4),FH=e=>ea(e,N4),HH=e=>ea(e,I4),Vd=e=>ea(e,M4,!0),UH=e=>ea(e,R4,!0),no=(e,t,n)=>{const r=S4.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ea=(e,t,n=!1)=>{const r=k4.exec(e);return r?r[1]?t(r[1]):n:!1},E4=e=>e==="position"||e==="percentage",I4=e=>e==="image"||e==="url",N4=e=>e==="length"||e==="size"||e==="bg-size",T4=e=>e==="length",WH=e=>e==="number",P4=e=>e==="family-name",R4=e=>e==="number"||e==="weight",M4=e=>e==="shadow",qH=()=>{const e=Yt("color"),t=Yt("font"),n=Yt("text"),r=Yt("font-weight"),i=Yt("tracking"),s=Yt("leading"),o=Yt("breakpoint"),a=Yt("container"),l=Yt("spacing"),c=Yt("radius"),u=Yt("shadow"),d=Yt("inset-shadow"),f=Yt("text-shadow"),p=Yt("drop-shadow"),m=Yt("blur"),v=Yt("perspective"),w=Yt("aspect"),x=Yt("ease"),_=Yt("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...S(),ye,ve],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],E=()=>[ye,ve,l],D=()=>[ms,"full","auto",...E()],N=()=>[gs,"none","subgrid",ye,ve],L=()=>["auto",{span:["full",gs,ye,ve]},gs,ye,ve],R=()=>[gs,"auto",ye,ve],M=()=>["auto","min","max","fr",ye,ve],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],j=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...E()],F=()=>[ms,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],$=()=>[ms,"screen","full","dvw","lvw","svw","min","max","fit",...E()],B=()=>[ms,"screen","full","lh","dvh","lvh","svh","min","max","fit",...E()],I=()=>[e,ye,ve],U=()=>[...S(),hk,dk,{position:[ye,ve]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],O=()=>["auto","cover","contain",FH,DH,{size:[ye,ve]}],te=()=>[Ig,cc,uo],le=()=>["","none","full",c,ye,ve],Y=()=>["",qe,cc,uo],re=()=>["solid","dashed","dotted","double"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[qe,Ig,hk,dk],Ie=()=>["","none",m,ye,ve],Ee=()=>["none",qe,ye,ve],Re=()=>["none",qe,ye,ve],he=()=>[qe,ye,ve],Be=()=>[ms,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ji],breakpoint:[ji],color:[C4],container:[ji],"drop-shadow":[ji],ease:["in","out","in-out"],font:[LH],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ji],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ji],shadow:[ji],spacing:["px",qe],text:[ji],"text-shadow":[ji],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ms,ve,ye,w]}],container:["container"],columns:[{columns:[qe,ve,ye,a]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:C()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[gs,"auto",ye,ve]}],basis:[{basis:[ms,"full","auto",a,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qe,ms,"auto","initial","none",ve]}],grow:[{grow:["",qe,ye,ve]}],shrink:[{shrink:["",qe,ye,ve]}],order:[{order:[gs,"first","last","none",ye,ve]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...j(),"normal"]}],"justify-self":[{"justify-self":["auto",...j()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...j(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...j(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),"baseline"]}],"place-self":[{"place-self":["auto",...j()]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pbs:[{pbs:E()}],pbe:[{pbe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...B()]}],"min-block-size":[{"min-block":["auto",...B()]}],"max-block-size":[{"max-block":["none",...B()]}],w:[{w:[a,"screen",...F()]}],"min-w":[{"min-w":[a,"screen","none",...F()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,cc,uo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,UH,OH]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ig,ve]}],"font-family":[{font:[zH,BH,t]}],"font-features":[{"font-features":[ve]}],"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:[i,ye,ve]}],"line-clamp":[{"line-clamp":[qe,"none",ye,uk]}],leading:[{leading:[s,...E()]}],"list-image":[{"list-image":["none",ye,ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[qe,"from-font","auto",ye,uo]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[qe,"auto",ye,ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,ve]}],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",ye,ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:U()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:O()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gs,ye,ve],radial:["",ye,ve],conic:[gs,ye,ve]},HH,$H]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:le()}],"rounded-s":[{"rounded-s":le()}],"rounded-e":[{"rounded-e":le()}],"rounded-t":[{"rounded-t":le()}],"rounded-r":[{"rounded-r":le()}],"rounded-b":[{"rounded-b":le()}],"rounded-l":[{"rounded-l":le()}],"rounded-ss":[{"rounded-ss":le()}],"rounded-se":[{"rounded-se":le()}],"rounded-ee":[{"rounded-ee":le()}],"rounded-es":[{"rounded-es":le()}],"rounded-tl":[{"rounded-tl":le()}],"rounded-tr":[{"rounded-tr":le()}],"rounded-br":[{"rounded-br":le()}],"rounded-bl":[{"rounded-bl":le()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qe,ye,ve]}],"outline-w":[{outline:["",qe,cc,uo]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",u,Vd,qd]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",d,Vd,qd]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[qe,uo]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",f,Vd,qd]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[qe,ye,ve]}],"mix-blend":[{"mix-blend":[...ke(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ke()}],"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":[qe]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[ye,ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":S()}],"mask-image-conic-pos":[{"mask-conic":[qe]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:U()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:O()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,ve]}],filter:[{filter:["","none",ye,ve]}],blur:[{blur:Ie()}],brightness:[{brightness:[qe,ye,ve]}],contrast:[{contrast:[qe,ye,ve]}],"drop-shadow":[{"drop-shadow":["","none",p,Vd,qd]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",qe,ye,ve]}],"hue-rotate":[{"hue-rotate":[qe,ye,ve]}],invert:[{invert:["",qe,ye,ve]}],saturate:[{saturate:[qe,ye,ve]}],sepia:[{sepia:["",qe,ye,ve]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,ve]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[qe,ye,ve]}],"backdrop-contrast":[{"backdrop-contrast":[qe,ye,ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qe,ye,ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qe,ye,ve]}],"backdrop-invert":[{"backdrop-invert":["",qe,ye,ve]}],"backdrop-opacity":[{"backdrop-opacity":[qe,ye,ve]}],"backdrop-saturate":[{"backdrop-saturate":[qe,ye,ve]}],"backdrop-sepia":[{"backdrop-sepia":["",qe,ye,ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qe,"initial",ye,ve]}],ease:[{ease:["linear","initial",x,ye,ve]}],delay:[{delay:[qe,ye,ve]}],animate:[{animate:["none",_,ye,ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,ye,ve]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[ye,ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Be()}],"translate-x":[{"translate-x":Be()}],"translate-y":[{"translate-y":Be()}],"translate-z":[{"translate-z":Be()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",ye,ve]}],"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":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mbs":[{"scroll-mbs":E()}],"scroll-mbe":[{"scroll-mbe":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pbs":[{"scroll-pbs":E()}],"scroll-pbe":[{"scroll-pbe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"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",ye,ve]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[qe,cc,uo,uk]}],stroke:[{stroke:["none",...I()]}],"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"]}},VH=kH(qH);function ie(...e){return VH(x4(e))}const fk={path:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"},pk={path:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"},mk="M2 2H17V12H12V17H7V22H2ZM7 7V12H12V7ZM17 12H22V22H17Z",A4={claude:fk.path,"claude-cloud":fk.path,codex:pk.path,"codex-cloud":pk.path,pi:mk,"pi-cloud":mk},KH=new Set(["pi","pi-cloud"]);function GH(e){return e!=null&&e in A4}function tm({tool:e,className:t}){const n=e?A4[e]:void 0;return n?h.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:t,"aria-hidden":"true",children:h.jsx("path",{d:n,fillRule:e&&KH.has(e)?"evenodd":void 0})}):h.jsx(em,{className:t})}function o_(e){return e==="codex"?"Codex":e==="codex-cloud"?"Codex(云上)":e==="pi"?"pi":e==="pi-cloud"?"pi(云上)":e==="claude-cloud"?"Claude(云上)":"Claude Code"}function nm(e){return e==="claude"?"text-engine-claude":e==="codex"?"text-engine-codex":e==="codex-cloud"?"text-engine-codex-cloud":e==="pi"?"text-engine-pi":e==="pi-cloud"?"text-engine-pi-cloud":e==="claude-cloud"?"text-engine-claude-cloud":"text-text-400"}function a_(e){return e.label||e.aiLabel||e.larkChatName||e.larkChatId||e.cwd.split("/").filter(Boolean).pop()||e.sessionId.slice(0,8)}function YH(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`${i}m`;const s=Math.floor(i/60);if(s<24)return`${s}h`;const o=Math.floor(s/24);if(o<7)return`${o}d`;if(o<30)return`${Math.floor(o/7)}w`;const a=new Date(n),l=String(a.getMonth()+1).padStart(2,"0"),c=String(a.getDate()).padStart(2,"0");return`${l}/${c}`}function XH(e){const t=new Date(e),n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);if(i<24)return`${i}h ago`;const s=Math.floor(i/24);return s<7?`${s}d ago`:t.toLocaleDateString()}function ZH(e){return`'${e.replace(/'/g,"'\\''")}'`}function QH(e){return e.toolSessionId?e.tool==="codex"?`codex resume ${e.toolSessionId}`:e.tool==="pi"?`pi --session-id ${e.toolSessionId}`:`claude --resume ${e.toolSessionId} --permission-mode bypassPermissions`:null}function j4(e){const t=QH(e);return!t||!e.cwd?null:`cd ${ZH(e.cwd)} && ${t}`}function Ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function gk(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ku(...e){return t=>{let n=!1;const r=e.map(i=>{const s=gk(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():gk(e[i],null)}}}}function Ot(...e){return g.useCallback(Ku(...e),e)}function JH(e,t){const n=g.createContext(t),r=s=>{const{children:o,...a}=s,l=g.useMemo(()=>a,Object.values(a));return h.jsx(n.Provider,{value:l,children:o})};r.displayName=e+"Provider";function i(s){const o=g.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,i]}function ro(e,t=[]){let n=[];function r(s,o){const a=g.createContext(o),l=n.length;n=[...n,o];const c=d=>{var x;const{scope:f,children:p,...m}=d,v=((x=f==null?void 0:f[e])==null?void 0:x[l])||a,w=g.useMemo(()=>m,Object.values(m));return h.jsx(v.Provider,{value:w,children:p})};c.displayName=s+"Provider";function u(d,f){var v;const p=((v=f==null?void 0:f[e])==null?void 0:v[l])||a,m=g.useContext(p);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=n.map(o=>g.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,eU(i,...t)]}function eU(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ys=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},tU=Tl[" useInsertionEffect ".trim().toString()]||Ys;function $l({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,s,o]=nU({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=g.useRef(e!==void 0);g.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=g.useCallback(u=>{var d;if(a){const f=rU(u)?u(e):u;f!==e&&((d=o.current)==null||d.call(o,f))}else s(u)},[a,e,s,o]);return[l,c]}function nU({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),i=g.useRef(n),s=g.useRef(t);return tU(()=>{s.current=t},[t]),g.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function rU(e){return typeof e=="function"}function pl(e){const t=iU(e),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(oU);if(l){const c=l.props.children,u=a.map(d=>d===l?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:g.isValidElement(c)?g.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function iU(e){const t=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=lU(i),a=aU(s,i.props);return i.type!==g.Fragment&&(a.ref=r?Ku(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var L4=Symbol("radix.slottable");function sU(e){const t=({children:n})=>h.jsx(h.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=L4,t}function oU(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===L4}function aU(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function lU(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wt=cU.reduce((e,t)=>{const n=pl(`Primitive.${t}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function D4(e,t){e&&Do.flushSync(()=>e.dispatchEvent(t))}function O4(e){const t=e+"CollectionProvider",[n,r]=ro(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=v=>{const{scope:w,children:x}=v,_=Je.useRef(null),b=Je.useRef(new Map).current;return h.jsx(i,{scope:w,itemMap:b,collectionRef:_,children:x})};o.displayName=t;const a=e+"CollectionSlot",l=pl(a),c=Je.forwardRef((v,w)=>{const{scope:x,children:_}=v,b=s(a,x),S=Ot(w,b.collectionRef);return h.jsx(l,{ref:S,children:_})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=pl(u),p=Je.forwardRef((v,w)=>{const{scope:x,children:_,...b}=v,S=Je.useRef(null),C=Ot(w,S),k=s(u,x);return Je.useEffect(()=>(k.itemMap.set(S,{ref:S,...b}),()=>void k.itemMap.delete(S))),h.jsx(f,{[d]:"",ref:C,children:_})});p.displayName=u;function m(v){const w=s(e+"CollectionConsumer",v);return Je.useCallback(()=>{const _=w.collectionRef.current;if(!_)return[];const b=Array.from(_.querySelectorAll(`[${d}]`));return Array.from(w.itemMap.values()).sort((k,T)=>b.indexOf(k.ref.current)-b.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:c,ItemSlot:p},m,r]}var uU=g.createContext(void 0);function B4(e){const t=g.useContext(uU);return e||t||"ltr"}function Ei(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function dU(e,t=globalThis==null?void 0:globalThis.document){const n=Ei(e);g.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var hU="DismissableLayer",mx="dismissableLayer.update",fU="dismissableLayer.pointerDownOutside",pU="dismissableLayer.focusOutside",vk,$4=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Gu=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=e,c=g.useContext($4),[u,d]=g.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=g.useState({}),m=Ot(t,T=>d(T)),v=Array.from(c.layers),[w]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(w),_=u?v.indexOf(u):-1,b=c.layersWithOutsidePointerEventsDisabled.size>0,S=_>=x,C=vU(T=>{const E=T.target,D=[...c.branches].some(N=>N.contains(E));!S||D||(i==null||i(T),o==null||o(T),T.defaultPrevented||a==null||a())},f),k=xU(T=>{const E=T.target;[...c.branches].some(N=>N.contains(E))||(s==null||s(T),o==null||o(T),T.defaultPrevented||a==null||a())},f);return dU(T=>{_===c.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&a&&(T.preventDefault(),a()))},f),g.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(vk=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),xk(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=vk)}},[u,f,n,c]),g.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),xk())},[u,c]),g.useEffect(()=>{const T=()=>p({});return document.addEventListener(mx,T),()=>document.removeEventListener(mx,T)},[]),h.jsx(wt.div,{...l,ref:m,style:{pointerEvents:b?S?"auto":"none":void 0,...e.style},onFocusCapture:Ne(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Ne(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Ne(e.onPointerDownCapture,C.onPointerDownCapture)})});Gu.displayName=hU;var mU="DismissableLayerBranch",gU=g.forwardRef((e,t)=>{const n=g.useContext($4),r=g.useRef(null),i=Ot(t,r);return g.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),h.jsx(wt.div,{...e,ref:i})});gU.displayName=mU;function vU(e,t=globalThis==null?void 0:globalThis.document){const n=Ei(e),r=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){z4(fU,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function xU(e,t=globalThis==null?void 0:globalThis.document){const n=Ei(e),r=g.useRef(!1);return g.useEffect(()=>{const i=s=>{s.target&&!r.current&&z4(pU,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function xk(){const e=new CustomEvent(mx);document.dispatchEvent(e)}function z4(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?D4(i,s):i.dispatchEvent(s)}var Ng=0;function l_(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??yk()),document.body.insertAdjacentElement("beforeend",e[1]??yk()),Ng++,()=>{Ng===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ng--}},[])}function yk(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Tg="focusScope.autoFocusOnMount",Pg="focusScope.autoFocusOnUnmount",_k={bubbles:!1,cancelable:!0},yU="FocusScope",rm=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,l]=g.useState(null),c=Ei(i),u=Ei(s),d=g.useRef(null),f=Ot(t,v=>l(v)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let v=function(b){if(p.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:ws(d.current,{select:!0})},w=function(b){if(p.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||ws(d.current,{select:!0}))},x=function(b){if(document.activeElement===document.body)for(const C of b)C.removedNodes.length>0&&ws(a)};document.addEventListener("focusin",v),document.addEventListener("focusout",w);const _=new MutationObserver(x);return a&&_.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",w),_.disconnect()}}},[r,a,p.paused]),g.useEffect(()=>{if(a){wk.add(p);const v=document.activeElement;if(!a.contains(v)){const x=new CustomEvent(Tg,_k);a.addEventListener(Tg,c),a.dispatchEvent(x),x.defaultPrevented||(_U(CU(F4(a)),{select:!0}),document.activeElement===v&&ws(a))}return()=>{a.removeEventListener(Tg,c),setTimeout(()=>{const x=new CustomEvent(Pg,_k);a.addEventListener(Pg,u),a.dispatchEvent(x),x.defaultPrevented||ws(v??document.body,{select:!0}),a.removeEventListener(Pg,u),wk.remove(p)},0)}}},[a,c,u,p]);const m=g.useCallback(v=>{if(!n&&!r||p.paused)return;const w=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(w&&x){const _=v.currentTarget,[b,S]=bU(_);b&&S?!v.shiftKey&&x===S?(v.preventDefault(),n&&ws(b,{select:!0})):v.shiftKey&&x===b&&(v.preventDefault(),n&&ws(S,{select:!0})):x===_&&v.preventDefault()}},[n,r,p.paused]);return h.jsx(wt.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});rm.displayName=yU;function _U(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ws(r,{select:t}),document.activeElement!==n)return}function bU(e){const t=F4(e),n=bk(t,e),r=bk(t.reverse(),e);return[n,r]}function F4(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function bk(e,t){for(const n of e)if(!wU(n,{upTo:t}))return n}function wU(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function SU(e){return e instanceof HTMLInputElement&&"select"in e}function ws(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&SU(e)&&t&&e.select()}}var wk=kU();function kU(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Sk(e,t),e.unshift(t)},remove(t){var n;e=Sk(e,t),(n=e[0])==null||n.resume()}}}function Sk(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function CU(e){return e.filter(t=>t.tagName!=="A")}var EU=Tl[" useId ".trim().toString()]||(()=>{}),IU=0;function bi(e){const[t,n]=g.useState(EU());return Ys(()=>{n(r=>r??String(IU++))},[e]),t?`radix-${t}`:""}const NU=["top","right","bottom","left"],Xs=Math.min,ar=Math.max,qf=Math.round,Kd=Math.floor,wi=e=>({x:e,y:e}),TU={left:"right",right:"left",bottom:"top",top:"bottom"};function gx(e,t,n){return ar(e,Xs(t,n))}function ns(e,t){return typeof e=="function"?e(t):e}function rs(e){return e.split("-")[0]}function zl(e){return e.split("-")[1]}function c_(e){return e==="x"?"y":"x"}function u_(e){return e==="y"?"height":"width"}function mi(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function d_(e){return c_(mi(e))}function PU(e,t,n){n===void 0&&(n=!1);const r=zl(e),i=d_(e),s=u_(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Vf(o)),[o,Vf(o)]}function RU(e){const t=Vf(e);return[vx(e),t,vx(t)]}function vx(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const kk=["left","right"],Ck=["right","left"],MU=["top","bottom"],AU=["bottom","top"];function jU(e,t,n){switch(e){case"top":case"bottom":return n?t?Ck:kk:t?kk:Ck;case"left":case"right":return t?MU:AU;default:return[]}}function LU(e,t,n,r){const i=zl(e);let s=jU(rs(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(vx)))),s}function Vf(e){const t=rs(e);return TU[t]+e.slice(t.length)}function DU(e){return{top:0,right:0,bottom:0,left:0,...e}}function H4(e){return typeof e!="number"?DU(e):{top:e,right:e,bottom:e,left:e}}function Kf(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ek(e,t,n){let{reference:r,floating:i}=e;const s=mi(t),o=d_(t),a=u_(o),l=rs(t),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(zl(t)){case"start":p[o]-=f*(n&&c?-1:1);break;case"end":p[o]+=f*(n&&c?-1:1);break}return p}async function OU(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=ns(t,e),m=H4(p),w=a[f?d==="floating"?"reference":"floating":d],x=Kf(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},C=Kf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:b,strategy:l}):_);return{top:(x.top-C.top+m.top)/S.y,bottom:(C.bottom-x.bottom+m.bottom)/S.y,left:(x.left-C.left+m.left)/S.x,right:(C.right-x.right+m.right)/S.x}}const BU=50,$U=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:OU},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ek(c,r,l),f=r,p=0;const m={};for(let v=0;v<s.length;v++){const w=s[v];if(!w)continue;const{name:x,fn:_}=w,{x:b,y:S,data:C,reset:k}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});u=b??u,d=S??d,m[x]={...m[x],...C},k&&p<BU&&(p++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(c=k.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:u,y:d}=Ek(c,f,l)),v=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},zU=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=ns(e,t)||{};if(c==null)return{};const d=H4(u),f={x:n,y:r},p=d_(i),m=u_(p),v=await o.getDimensions(c),w=p==="y",x=w?"top":"left",_=w?"bottom":"right",b=w?"clientHeight":"clientWidth",S=s.reference[m]+s.reference[p]-f[p]-s.floating[m],C=f[p]-s.reference[p],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let T=k?k[b]:0;(!T||!await(o.isElement==null?void 0:o.isElement(k)))&&(T=a.floating[b]||s.floating[m]);const E=S/2-C/2,D=T/2-v[m]/2-1,N=Xs(d[x],D),L=Xs(d[_],D),R=N,M=T-v[m]-L,A=T/2-v[m]/2+E,j=gx(R,A,M),z=!l.arrow&&zl(i)!=null&&A!==j&&s.reference[m]/2-(A<R?N:L)-v[m]/2<0,F=z?A<R?A-R:A-M:0;return{[p]:f[p]+F,data:{[p]:j,centerOffset:A-j-F,...z&&{alignmentOffset:F}},reset:z}}}),FU=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...w}=ns(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=rs(i),_=mi(a),b=rs(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=f||(b||!v?[Vf(a)]:RU(a)),k=m!=="none";!f&&k&&C.push(...LU(a,v,m,S));const T=[a,...C],E=await l.detectOverflow(t,w),D=[];let N=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&D.push(E[x]),d){const A=PU(i,o,S);D.push(E[A[0]],E[A[1]])}if(N=[...N,{placement:i,overflows:D}],!D.every(A=>A<=0)){var L,R;const A=(((L=s.flip)==null?void 0:L.index)||0)+1,j=T[A];if(j&&(!(d==="alignment"?_!==mi(j):!1)||N.every($=>mi($.placement)===_?$.overflows[0]>0:!0)))return{data:{index:A,overflows:N},reset:{placement:j}};let z=(R=N.filter(F=>F.overflows[0]<=0).sort((F,$)=>F.overflows[1]-$.overflows[1])[0])==null?void 0:R.placement;if(!z)switch(p){case"bestFit":{var M;const F=(M=N.filter($=>{if(k){const B=mi($.placement);return B===_||B==="y"}return!0}).map($=>[$.placement,$.overflows.filter(B=>B>0).reduce((B,I)=>B+I,0)]).sort(($,B)=>$[1]-B[1])[0])==null?void 0:M[0];F&&(z=F);break}case"initialPlacement":z=a;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function Ik(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Nk(e){return NU.some(t=>e[t]>=0)}const HU=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=ns(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=Ik(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Nk(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),a=Ik(o,n.floating);return{data:{escapedOffsets:a,escaped:Nk(a)}}}default:return{}}}}},U4=new Set(["left","top"]);async function UU(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=rs(n),a=zl(n),l=mi(n)==="y",c=U4.has(o)?-1:1,u=s&&l?-1:1,d=ns(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}const WU=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await UU(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},qU=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:x=>{let{x:_,y:b}=x;return{x:_,y:b}}},...c}=ns(e,t),u={x:n,y:r},d=await s.detectOverflow(t,c),f=mi(rs(i)),p=c_(f);let m=u[p],v=u[f];if(o){const x=p==="y"?"top":"left",_=p==="y"?"bottom":"right",b=m+d[x],S=m-d[_];m=gx(b,m,S)}if(a){const x=f==="y"?"top":"left",_=f==="y"?"bottom":"right",b=v+d[x],S=v-d[_];v=gx(b,v,S)}const w=l.fn({...t,[p]:m,[f]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[p]:o,[f]:a}}}}}},VU=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ns(e,t),u={x:n,y:r},d=mi(i),f=c_(d);let p=u[f],m=u[d];const v=ns(a,t),w=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const b=f==="y"?"height":"width",S=s.reference[f]-s.floating[b]+w.mainAxis,C=s.reference[f]+s.reference[b]-w.mainAxis;p<S?p=S:p>C&&(p=C)}if(c){var x,_;const b=f==="y"?"width":"height",S=U4.has(rs(i)),C=s.reference[d]-s.floating[b]+(S&&((x=o.offset)==null?void 0:x[d])||0)+(S?0:w.crossAxis),k=s.reference[d]+s.reference[b]+(S?0:((_=o.offset)==null?void 0:_[d])||0)-(S?w.crossAxis:0);m<C?m=C:m>k&&(m=k)}return{[f]:p,[d]:m}}}},KU=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:l=()=>{},...c}=ns(e,t),u=await o.detectOverflow(t,c),d=rs(i),f=zl(i),p=mi(i)==="y",{width:m,height:v}=s.floating;let w,x;d==="top"||d==="bottom"?(w=d,x=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(x=d,w=f==="end"?"top":"bottom");const _=v-u.top-u.bottom,b=m-u.left-u.right,S=Xs(v-u[w],_),C=Xs(m-u[x],b),k=!t.middlewareData.shift;let T=S,E=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(E=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=_),k&&!f){const N=ar(u.left,0),L=ar(u.right,0),R=ar(u.top,0),M=ar(u.bottom,0);p?E=m-2*(N!==0||L!==0?N+L:ar(u.left,u.right)):T=v-2*(R!==0||M!==0?R+M:ar(u.top,u.bottom))}await l({...t,availableWidth:E,availableHeight:T});const D=await o.getDimensions(a.floating);return m!==D.width||v!==D.height?{reset:{rects:!0}}:{}}}};function im(){return typeof window<"u"}function Fl(e){return W4(e)?(e.nodeName||"").toLowerCase():"#document"}function ur(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ti(e){var t;return(t=(W4(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function W4(e){return im()?e instanceof Node||e instanceof ur(e).Node:!1}function Xr(e){return im()?e instanceof Element||e instanceof ur(e).Element:!1}function ls(e){return im()?e instanceof HTMLElement||e instanceof ur(e).HTMLElement:!1}function Tk(e){return!im()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ur(e).ShadowRoot}function Yu(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Zr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function GU(e){return/^(table|td|th)$/.test(Fl(e))}function sm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const YU=/transform|translate|scale|rotate|perspective|filter/,XU=/paint|layout|strict|content/,ho=e=>!!e&&e!=="none";let Rg;function h_(e){const t=Xr(e)?Zr(e):e;return ho(t.transform)||ho(t.translate)||ho(t.scale)||ho(t.rotate)||ho(t.perspective)||!f_()&&(ho(t.backdropFilter)||ho(t.filter))||YU.test(t.willChange||"")||XU.test(t.contain||"")}function ZU(e){let t=Zs(e);for(;ls(t)&&!ml(t);){if(h_(t))return t;if(sm(t))return null;t=Zs(t)}return null}function f_(){return Rg==null&&(Rg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Rg}function ml(e){return/^(html|body|#document)$/.test(Fl(e))}function Zr(e){return ur(e).getComputedStyle(e)}function om(e){return Xr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zs(e){if(Fl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Tk(e)&&e.host||Ti(e);return Tk(t)?t.host:t}function q4(e){const t=Zs(e);return ml(t)?e.ownerDocument?e.ownerDocument.body:e.body:ls(t)&&Yu(t)?t:q4(t)}function Cu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=q4(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=ur(i);if(s){const a=xx(o);return t.concat(o,o.visualViewport||[],Yu(i)?i:[],a&&n?Cu(a):[])}else return t.concat(i,Cu(i,[],n))}function xx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function V4(e){const t=Zr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ls(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=qf(n)!==s||qf(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function p_(e){return Xr(e)?e:e.contextElement}function Ya(e){const t=p_(e);if(!ls(t))return wi(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=V4(t);let o=(s?qf(n.width):n.width)/r,a=(s?qf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const QU=wi(0);function K4(e){const t=ur(e);return!f_()||!t.visualViewport?QU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function JU(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ur(e)?!1:t}function Fo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=p_(e);let o=wi(1);t&&(r?Xr(r)&&(o=Ya(r)):o=Ya(e));const a=JU(s,n,r)?K4(s):wi(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){const f=ur(s),p=r&&Xr(r)?ur(r):r;let m=f,v=xx(m);for(;v&&r&&p!==m;){const w=Ya(v),x=v.getBoundingClientRect(),_=Zr(v),b=x.left+(v.clientLeft+parseFloat(_.paddingLeft))*w.x,S=x.top+(v.clientTop+parseFloat(_.paddingTop))*w.y;l*=w.x,c*=w.y,u*=w.x,d*=w.y,l+=b,c+=S,m=ur(v),v=xx(m)}}return Kf({width:u,height:d,x:l,y:c})}function am(e,t){const n=om(e).scrollLeft;return t?t.left+n:Fo(Ti(e)).left+n}function G4(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-am(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function eW(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Ti(r),a=t?sm(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=wi(1);const u=wi(0),d=ls(r);if((d||!d&&!s)&&((Fl(r)!=="body"||Yu(o))&&(l=om(r)),d)){const p=Fo(r);c=Ya(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const f=o&&!d&&!s?G4(o,l):wi(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function tW(e){return Array.from(e.getClientRects())}function nW(e){const t=Ti(e),n=om(e),r=e.ownerDocument.body,i=ar(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ar(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+am(e);const a=-n.scrollTop;return Zr(r).direction==="rtl"&&(o+=ar(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Pk=25;function rW(e,t){const n=ur(e),r=Ti(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=f_();(!u||u&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=am(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-p);m<=Pk&&(s-=m)}else c<=Pk&&(s+=c);return{width:s,height:o,x:a,y:l}}function iW(e,t){const n=Fo(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ls(e)?Ya(e):wi(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function Rk(e,t,n){let r;if(t==="viewport")r=rW(e,n);else if(t==="document")r=nW(Ti(e));else if(Xr(t))r=iW(t,n);else{const i=K4(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Kf(r)}function Y4(e,t){const n=Zs(e);return n===t||!Xr(n)||ml(n)?!1:Zr(n).position==="fixed"||Y4(n,t)}function sW(e,t){const n=t.get(e);if(n)return n;let r=Cu(e,[],!1).filter(a=>Xr(a)&&Fl(a)!=="body"),i=null;const s=Zr(e).position==="fixed";let o=s?Zs(e):e;for(;Xr(o)&&!ml(o);){const a=Zr(o),l=h_(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Yu(o)&&!l&&Y4(e,o))?r=r.filter(u=>u!==o):i=a,o=Zs(o)}return t.set(e,r),r}function oW(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?sm(t)?[]:sW(t,this._c):[].concat(n),r],a=Rk(t,o[0],i);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<o.length;f++){const p=Rk(t,o[f],i);l=ar(p.top,l),c=Xs(p.right,c),u=Xs(p.bottom,u),d=ar(p.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function aW(e){const{width:t,height:n}=V4(e);return{width:t,height:n}}function lW(e,t,n){const r=ls(t),i=Ti(t),s=n==="fixed",o=Fo(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=wi(0);function c(){l.x=am(i)}if(r||!r&&!s)if((Fl(t)!=="body"||Yu(i))&&(a=om(t)),r){const p=Fo(t,!0,s,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else i&&c();s&&!r&&i&&c();const u=i&&!r&&!s?G4(i,a):wi(0),d=o.left+a.scrollLeft-l.x-u.x,f=o.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function Mg(e){return Zr(e).position==="static"}function Mk(e,t){if(!ls(e)||Zr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ti(e)===n&&(n=n.ownerDocument.body),n}function X4(e,t){const n=ur(e);if(sm(e))return n;if(!ls(e)){let i=Zs(e);for(;i&&!ml(i);){if(Xr(i)&&!Mg(i))return i;i=Zs(i)}return n}let r=Mk(e,t);for(;r&&GU(r)&&Mg(r);)r=Mk(r,t);return r&&ml(r)&&Mg(r)&&!h_(r)?n:r||ZU(e)||n}const cW=async function(e){const t=this.getOffsetParent||X4,n=this.getDimensions,r=await n(e.floating);return{reference:lW(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function uW(e){return Zr(e).direction==="rtl"}const dW={convertOffsetParentRelativeRectToViewportRelativeRect:eW,getDocumentElement:Ti,getClippingRect:oW,getOffsetParent:X4,getElementRects:cW,getClientRects:tW,getDimensions:aW,getScale:Ya,isElement:Xr,isRTL:uW};function Z4(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hW(e,t){let n=null,r;const i=Ti(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=c;if(a||t(),!f||!p)return;const m=Kd(d),v=Kd(i.clientWidth-(u+f)),w=Kd(i.clientHeight-(d+p)),x=Kd(u),b={rootMargin:-m+"px "+-v+"px "+-w+"px "+-x+"px",threshold:ar(0,Xs(1,l))||1};let S=!0;function C(k){const T=k[0].intersectionRatio;if(T!==l){if(!S)return o();T?o(!1,T):r=setTimeout(()=>{o(!1,1e-7)},1e3)}T===1&&!Z4(c,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(C,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,b)}n.observe(e)}return o(!0),s}function fW(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=p_(e),u=i||s?[...c?Cu(c):[],...t?Cu(t):[]]:[];u.forEach(x=>{i&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const d=c&&a?hW(c,n):null;let f=-1,p=null;o&&(p=new ResizeObserver(x=>{let[_]=x;_&&_.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let m,v=l?Fo(e):null;l&&w();function w(){const x=Fo(e);v&&!Z4(v,x)&&n(),v=x,m=requestAnimationFrame(w)}return n(),()=>{var x;u.forEach(_=>{i&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),d==null||d(),(x=p)==null||x.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const pW=WU,mW=qU,gW=FU,vW=KU,xW=HU,Ak=zU,yW=VU,_W=(e,t,n)=>{const r=new Map,i={platform:dW,...n},s={...i.platform,_c:r};return $U(e,t,{...i,platform:s})};var bW=typeof document<"u",wW=function(){},Oh=bW?g.useLayoutEffect:wW;function Gf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Gf(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Gf(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Q4(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jk(e,t){const n=Q4(e);return Math.round(t*n)/n}function Ag(e){const t=g.useRef(e);return Oh(()=>{t.current=e}),t}function SW(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=g.useState(r);Gf(f,r)||p(r);const[m,v]=g.useState(null),[w,x]=g.useState(null),_=g.useCallback($=>{$!==k.current&&(k.current=$,v($))},[]),b=g.useCallback($=>{$!==T.current&&(T.current=$,x($))},[]),S=s||m,C=o||w,k=g.useRef(null),T=g.useRef(null),E=g.useRef(u),D=l!=null,N=Ag(l),L=Ag(i),R=Ag(c),M=g.useCallback(()=>{if(!k.current||!T.current)return;const $={placement:t,strategy:n,middleware:f};L.current&&($.platform=L.current),_W(k.current,T.current,$).then(B=>{const I={...B,isPositioned:R.current!==!1};A.current&&!Gf(E.current,I)&&(E.current=I,Do.flushSync(()=>{d(I)}))})},[f,t,n,L,R]);Oh(()=>{c===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d($=>({...$,isPositioned:!1})))},[c]);const A=g.useRef(!1);Oh(()=>(A.current=!0,()=>{A.current=!1}),[]),Oh(()=>{if(S&&(k.current=S),C&&(T.current=C),S&&C){if(N.current)return N.current(S,C,M);M()}},[S,C,M,N,D]);const j=g.useMemo(()=>({reference:k,floating:T,setReference:_,setFloating:b}),[_,b]),z=g.useMemo(()=>({reference:S,floating:C}),[S,C]),F=g.useMemo(()=>{const $={position:n,left:0,top:0};if(!z.floating)return $;const B=jk(z.floating,u.x),I=jk(z.floating,u.y);return a?{...$,transform:"translate("+B+"px, "+I+"px)",...Q4(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:I}},[n,a,z.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:M,refs:j,elements:z,floatingStyles:F}),[u,M,j,z,F])}const kW=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ak({element:r.current,padding:i}).fn(n):{}:r?Ak({element:r,padding:i}).fn(n):{}}}},CW=(e,t)=>{const n=pW(e);return{name:n.name,fn:n.fn,options:[e,t]}},EW=(e,t)=>{const n=mW(e);return{name:n.name,fn:n.fn,options:[e,t]}},IW=(e,t)=>({fn:yW(e).fn,options:[e,t]}),NW=(e,t)=>{const n=gW(e);return{name:n.name,fn:n.fn,options:[e,t]}},TW=(e,t)=>{const n=vW(e);return{name:n.name,fn:n.fn,options:[e,t]}},PW=(e,t)=>{const n=xW(e);return{name:n.name,fn:n.fn,options:[e,t]}},RW=(e,t)=>{const n=kW(e);return{name:n.name,fn:n.fn,options:[e,t]}};var MW="Arrow",J4=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return h.jsx(wt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});J4.displayName=MW;var AW=J4;function jW(e){const[t,n]=g.useState(void 0);return Ys(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var m_="Popper",[e3,Hl]=ro(m_),[LW,t3]=e3(m_),n3=e=>{const{__scopePopper:t,children:n}=e,[r,i]=g.useState(null);return h.jsx(LW,{scope:t,anchor:r,onAnchorChange:i,children:n})};n3.displayName=m_;var r3="PopperAnchor",i3=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=t3(r3,n),o=g.useRef(null),a=Ot(t,o),l=g.useRef(null);return g.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:h.jsx(wt.div,{...i,ref:a})});i3.displayName=r3;var g_="PopperContent",[DW,OW]=e3(g_),s3=g.forwardRef((e,t)=>{var re,ke,oe,Ie,Ee,Re;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...v}=e,w=t3(g_,n),[x,_]=g.useState(null),b=Ot(t,he=>_(he)),[S,C]=g.useState(null),k=jW(S),T=(k==null?void 0:k.width)??0,E=(k==null?void 0:k.height)??0,D=r+(s!=="center"?"-"+s:""),N=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},L=Array.isArray(c)?c:[c],R=L.length>0,M={padding:N,boundary:L.filter($W),altBoundary:R},{refs:A,floatingStyles:j,placement:z,isPositioned:F,middlewareData:$}=SW({strategy:"fixed",placement:D,whileElementsMounted:(...he)=>fW(...he,{animationFrame:p==="always"}),elements:{reference:w.anchor},middleware:[CW({mainAxis:i+E,alignmentAxis:o}),l&&EW({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?IW():void 0,...M}),l&&NW({...M}),TW({...M,apply:({elements:he,rects:Be,availableWidth:Qe,availableHeight:Ge})=>{const{width:ft,height:Kt}=Be.reference,fe=he.floating.style;fe.setProperty("--radix-popper-available-width",`${Qe}px`),fe.setProperty("--radix-popper-available-height",`${Ge}px`),fe.setProperty("--radix-popper-anchor-width",`${ft}px`),fe.setProperty("--radix-popper-anchor-height",`${Kt}px`)}}),S&&RW({element:S,padding:a}),zW({arrowWidth:T,arrowHeight:E}),f&&PW({strategy:"referenceHidden",...M})]}),[B,I]=l3(z),U=Ei(m);Ys(()=>{F&&(U==null||U())},[F,U]);const q=(re=$.arrow)==null?void 0:re.x,O=(ke=$.arrow)==null?void 0:ke.y,te=((oe=$.arrow)==null?void 0:oe.centerOffset)!==0,[le,Y]=g.useState();return Ys(()=>{x&&Y(window.getComputedStyle(x).zIndex)},[x]),h.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:F?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[(Ie=$.transformOrigin)==null?void 0:Ie.x,(Ee=$.transformOrigin)==null?void 0:Ee.y].join(" "),...((Re=$.hide)==null?void 0:Re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(DW,{scope:n,placedSide:B,onArrowChange:C,arrowX:q,arrowY:O,shouldHideArrow:te,children:h.jsx(wt.div,{"data-side":B,"data-align":I,...v,ref:b,style:{...v.style,animation:F?void 0:"none"}})})})});s3.displayName=g_;var o3="PopperArrow",BW={top:"bottom",right:"left",bottom:"top",left:"right"},a3=g.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=OW(o3,r),o=BW[s.placedSide];return h.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:h.jsx(AW,{...i,ref:n,style:{...i.style,display:"block"}})})});a3.displayName=o3;function $W(e){return e!==null}var zW=e=>({name:"transformOrigin",options:e,fn(t){var w,x,_;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[c,u]=l3(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(((x=i.arrow)==null?void 0:x.x)??0)+a/2,p=(((_=i.arrow)==null?void 0:_.y)??0)+l/2;let m="",v="";return c==="bottom"?(m=o?d:`${f}px`,v=`${-l}px`):c==="top"?(m=o?d:`${f}px`,v=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,v=o?d:`${p}px`):c==="left"&&(m=`${r.floating.width+l}px`,v=o?d:`${p}px`),{data:{x:m,y:v}}}});function l3(e){const[t,n="center"]=e.split("-");return[t,n]}var lm=n3,cm=i3,v_=s3,x_=a3,FW="Portal",um=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,s]=g.useState(!1);Ys(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?_v.createPortal(h.jsx(wt.div,{...r,ref:t}),o):null});um.displayName=FW;function HW(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Jr=e=>{const{present:t,children:n}=e,r=UW(t),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=Ot(r.ref,WW(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:s}):null};Jr.displayName="Presence";function UW(e){const[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),s=g.useRef("none"),o=e?"mounted":"unmounted",[a,l]=HW(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=Gd(r.current);s.current=a==="mounted"?c:"none"},[a]),Ys(()=>{const c=r.current,u=i.current;if(u!==e){const f=s.current,p=Gd(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Ys(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const v=Gd(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(l("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},f=p=>{p.target===t&&(s.current=Gd(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Gd(e){return(e==null?void 0:e.animationName)||"none"}function WW(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jg="rovingFocusGroup.onEntryFocus",qW={bubbles:!1,cancelable:!0},Xu="RovingFocusGroup",[yx,c3,VW]=O4(Xu),[KW,u3]=ro(Xu,[VW]),[GW,YW]=KW(Xu),d3=g.forwardRef((e,t)=>h.jsx(yx.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(yx.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(XW,{...e,ref:t})})}));d3.displayName=Xu;var XW=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,f=g.useRef(null),p=Ot(t,f),m=B4(s),[v,w]=$l({prop:o,defaultProp:a??null,onChange:l,caller:Xu}),[x,_]=g.useState(!1),b=Ei(c),S=c3(n),C=g.useRef(!1),[k,T]=g.useState(0);return g.useEffect(()=>{const E=f.current;if(E)return E.addEventListener(jg,b),()=>E.removeEventListener(jg,b)},[b]),h.jsx(GW,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:v,onItemFocus:g.useCallback(E=>w(E),[w]),onItemShiftTab:g.useCallback(()=>_(!0),[]),onFocusableItemAdd:g.useCallback(()=>T(E=>E+1),[]),onFocusableItemRemove:g.useCallback(()=>T(E=>E-1),[]),children:h.jsx(wt.div,{tabIndex:x||k===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:Ne(e.onMouseDown,()=>{C.current=!0}),onFocus:Ne(e.onFocus,E=>{const D=!C.current;if(E.target===E.currentTarget&&D&&!x){const N=new CustomEvent(jg,qW);if(E.currentTarget.dispatchEvent(N),!N.defaultPrevented){const L=S().filter(z=>z.focusable),R=L.find(z=>z.active),M=L.find(z=>z.id===v),j=[R,M,...L].filter(Boolean).map(z=>z.ref.current);p3(j,u)}}C.current=!1}),onBlur:Ne(e.onBlur,()=>_(!1))})})}),h3="RovingFocusGroupItem",f3=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=e,l=bi(),c=s||l,u=YW(h3,n),d=u.currentTabStopId===c,f=c3(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:v}=u;return g.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),h.jsx(yx.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:h.jsx(wt.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Ne(e.onMouseDown,w=>{r?u.onItemFocus(c):w.preventDefault()}),onFocus:Ne(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ne(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){u.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const x=JW(w,u.orientation,u.dir);if(x!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let b=f().filter(S=>S.focusable).map(S=>S.ref.current);if(x==="last")b.reverse();else if(x==="prev"||x==="next"){x==="prev"&&b.reverse();const S=b.indexOf(w.currentTarget);b=u.loop?eq(b,S+1):b.slice(S+1)}setTimeout(()=>p3(b))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:v!=null}):o})})});f3.displayName=h3;var ZW={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function QW(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function JW(e,t,n){const r=QW(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ZW[r]}function p3(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function eq(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var tq=d3,nq=f3,rq=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},pa=new WeakMap,Yd=new WeakMap,Xd={},Lg=0,m3=function(e){return e&&(e.host||m3(e.parentNode))},iq=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=m3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},sq=function(e,t,n,r){var i=iq(t,Array.isArray(e)?e:[e]);Xd[n]||(Xd[n]=new WeakMap);var s=Xd[n],o=[],a=new Set,l=new Set(i),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};i.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))u(f);else try{var p=f.getAttribute(r),m=p!==null&&p!=="false",v=(pa.get(f)||0)+1,w=(s.get(f)||0)+1;pa.set(f,v),s.set(f,w),o.push(f),v===1&&m&&Yd.set(f,!0),w===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",f,x)}})};return u(t),a.clear(),Lg++,function(){o.forEach(function(d){var f=pa.get(d)-1,p=s.get(d)-1;pa.set(d,f),s.set(d,p),f||(Yd.has(d)||d.removeAttribute(r),Yd.delete(d)),p||d.removeAttribute(n)}),Lg--,Lg||(pa=new WeakMap,pa=new WeakMap,Yd=new WeakMap,Xd={})}},y_=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=rq(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),sq(r,i,n,"aria-hidden")):function(){return null}},pi=function(){return pi=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},pi.apply(this,arguments)};function g3(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function oq(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Bh="right-scroll-bar-position",$h="width-before-scroll-bar",aq="with-scroll-bars-hidden",lq="--removed-body-scroll-bar-size";function Dg(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function cq(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var uq=typeof window<"u"?g.useLayoutEffect:g.useEffect,Lk=new WeakMap;function dq(e,t){var n=cq(null,function(r){return e.forEach(function(i){return Dg(i,r)})});return uq(function(){var r=Lk.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Dg(a,null)}),s.forEach(function(a){i.has(a)||Dg(a,o)})}Lk.set(n,e)},[e]),n}function hq(e){return e}function fq(e,t){t===void 0&&(t=hq);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var o=t(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return i}function pq(e){e===void 0&&(e={});var t=fq(null);return t.options=pi({async:!0,ssr:!1},e),t}var v3=function(e){var t=e.sideCar,n=g3(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,pi({},n))};v3.isSideCarExport=!0;function mq(e,t){return e.useMedium(t),v3}var x3=pq(),Og=function(){},dm=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:Og,onWheelCapture:Og,onTouchMoveCapture:Og}),i=r[0],s=r[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,v=e.inert,w=e.allowPinchZoom,x=e.as,_=x===void 0?"div":x,b=e.gapMode,S=g3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,k=dq([n,t]),T=pi(pi({},S),i);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:x3,removeScrollBar:c,shards:d,noRelative:p,noIsolation:m,inert:v,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:b}),o?g.cloneElement(g.Children.only(a),pi(pi({},T),{ref:k})):g.createElement(_,pi({},T,{className:l,ref:k}),a))});dm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};dm.classNames={fullWidth:$h,zeroRight:Bh};var gq=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vq(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=gq();return t&&e.setAttribute("nonce",t),e}function xq(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function yq(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var _q=function(){var e=0,t=null;return{add:function(n){e==0&&(t=vq())&&(xq(t,n),yq(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},bq=function(){var e=_q();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},y3=function(){var e=bq(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},wq={left:0,top:0,right:0,gap:0},Bg=function(e){return parseInt(e||"",10)||0},Sq=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Bg(n),Bg(r),Bg(i)]},kq=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return wq;var t=Sq(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Cq=y3(),Xa="data-scroll-locked",Eq=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
496
|
+
*/const nH=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],rH=de("zap",nH);function v4(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=v4(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function x4(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=v4(e))&&(r&&(r+=" "),r+=t);return r}const iH=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},sH=(e,t)=>({classGroupId:e,validator:t}),y4=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Wf="-",ak=[],oH="arbitrary..",aH=e=>{const t=cH(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return lH(o);const a=o.split(Wf),l=a[0]===""&&a.length>1?1:0;return _4(a,l,t)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?iH(c,l):l:c||ak}return n[o]||ak}}},_4=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const c=_4(e,t+1,s);if(c)return c}const o=n.validators;if(o===null)return;const a=t===0?e.join(Wf):e.slice(t).join(Wf),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},lH=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?oH+r:void 0})(),cH=e=>{const{theme:t,classGroups:n}=e;return uH(n,t)},uH=(e,t)=>{const n=y4();for(const r in e){const i=e[r];i_(i,n,r,t)}return n},i_=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];dH(o,t,n,r)}},dH=(e,t,n,r)=>{if(typeof e=="string"){hH(e,t,n);return}if(typeof e=="function"){fH(e,t,n,r);return}pH(e,t,n,r)},hH=(e,t,n)=>{const r=e===""?t:b4(t,e);r.classGroupId=n},fH=(e,t,n,r)=>{if(mH(e)){i_(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(sH(n,e))},pH=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];i_(l,b4(t,a),n,r)}},b4=(e,t)=>{let n=e;const r=t.split(Wf),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=y4(),n.nextPart.set(o,a)),n=a}return n},mH=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,gH=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},px="!",lk=":",vH=[],ck=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),xH=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const s=[];let o=0,a=0,l=0,c;const u=i.length;for(let v=0;v<u;v++){const w=i[v];if(o===0&&a===0){if(w===lk){s.push(i.slice(l,v)),l=v+1;continue}if(w==="/"){c=v;continue}}w==="["?o++:w==="]"?o--:w==="("?a++:w===")"&&a--}const d=s.length===0?i:i.slice(l);let f=d,p=!1;d.endsWith(px)?(f=d.slice(0,-1),p=!0):d.startsWith(px)&&(f=d.slice(1),p=!0);const m=c&&c>l?c-l:void 0;return ck(s,p,f,m)};if(t){const i=t+lk,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):ck(vH,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},yH=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],a=o[0]==="[",l=t.has(o);a||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},_H=e=>({cache:gH(e.cacheSize),parseClassName:xH(e),sortModifiers:yH(e),...aH(e)}),bH=/\s+/,wH=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],a=e.trim().split(bH);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:v}=n(u);if(d){l=u+(l.length>0?" "+l:l);continue}let w=!!v,x=r(w?m.substring(0,v):m);if(!x){if(!w){l=u+(l.length>0?" "+l:l);continue}if(x=r(m),!x){l=u+(l.length>0?" "+l:l);continue}w=!1}const _=f.length===0?"":f.length===1?f[0]:s(f).join(":"),b=p?_+px:_,S=b+x;if(o.indexOf(S)>-1)continue;o.push(S);const C=i(x,w);for(let k=0;k<C.length;++k){const T=C[k];o.push(b+T)}l=u+(l.length>0?" "+l:l)}return l},SH=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=w4(n))&&(i&&(i+=" "),i+=r);return i},w4=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=w4(e[r]))&&(n&&(n+=" "),n+=t);return n},kH=(e,...t)=>{let n,r,i,s;const o=l=>{const c=t.reduce((u,d)=>d(u),e());return n=_H(c),r=n.cache.get,i=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const u=wH(l,n);return i(l,u),u};return s=o,(...l)=>s(SH(...l))},CH=[],Yt=e=>{const t=n=>n[e]||CH;return t.isThemeGetter=!0,t},S4=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,k4=/^\((?:(\w[\w-]*):)?(.+)\)$/i,EH=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,IH=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,NH=/\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$/,TH=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,PH=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RH=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ms=e=>EH.test(e),qe=e=>!!e&&!Number.isNaN(Number(e)),gs=e=>!!e&&Number.isInteger(Number(e)),Ig=e=>e.endsWith("%")&&qe(e.slice(0,-1)),ji=e=>IH.test(e),C4=()=>!0,MH=e=>NH.test(e)&&!TH.test(e),s_=()=>!1,AH=e=>PH.test(e),jH=e=>RH.test(e),LH=e=>!ve(e)&&!ye(e),DH=e=>no(e,N4,s_),ve=e=>S4.test(e),uo=e=>no(e,T4,MH),uk=e=>no(e,WH,qe),OH=e=>no(e,R4,C4),BH=e=>no(e,P4,s_),dk=e=>no(e,E4,s_),$H=e=>no(e,I4,jH),qd=e=>no(e,M4,AH),ye=e=>k4.test(e),cc=e=>ea(e,T4),zH=e=>ea(e,P4),hk=e=>ea(e,E4),FH=e=>ea(e,N4),HH=e=>ea(e,I4),Vd=e=>ea(e,M4,!0),UH=e=>ea(e,R4,!0),no=(e,t,n)=>{const r=S4.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ea=(e,t,n=!1)=>{const r=k4.exec(e);return r?r[1]?t(r[1]):n:!1},E4=e=>e==="position"||e==="percentage",I4=e=>e==="image"||e==="url",N4=e=>e==="length"||e==="size"||e==="bg-size",T4=e=>e==="length",WH=e=>e==="number",P4=e=>e==="family-name",R4=e=>e==="number"||e==="weight",M4=e=>e==="shadow",qH=()=>{const e=Yt("color"),t=Yt("font"),n=Yt("text"),r=Yt("font-weight"),i=Yt("tracking"),s=Yt("leading"),o=Yt("breakpoint"),a=Yt("container"),l=Yt("spacing"),c=Yt("radius"),u=Yt("shadow"),d=Yt("inset-shadow"),f=Yt("text-shadow"),p=Yt("drop-shadow"),m=Yt("blur"),v=Yt("perspective"),w=Yt("aspect"),x=Yt("ease"),_=Yt("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...S(),ye,ve],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],E=()=>[ye,ve,l],D=()=>[ms,"full","auto",...E()],N=()=>[gs,"none","subgrid",ye,ve],L=()=>["auto",{span:["full",gs,ye,ve]},gs,ye,ve],R=()=>[gs,"auto",ye,ve],M=()=>["auto","min","max","fr",ye,ve],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],j=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...E()],F=()=>[ms,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],$=()=>[ms,"screen","full","dvw","lvw","svw","min","max","fit",...E()],B=()=>[ms,"screen","full","lh","dvh","lvh","svh","min","max","fit",...E()],I=()=>[e,ye,ve],U=()=>[...S(),hk,dk,{position:[ye,ve]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],O=()=>["auto","cover","contain",FH,DH,{size:[ye,ve]}],te=()=>[Ig,cc,uo],le=()=>["","none","full",c,ye,ve],Y=()=>["",qe,cc,uo],re=()=>["solid","dashed","dotted","double"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[qe,Ig,hk,dk],Ie=()=>["","none",m,ye,ve],Ee=()=>["none",qe,ye,ve],Re=()=>["none",qe,ye,ve],he=()=>[qe,ye,ve],Be=()=>[ms,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ji],breakpoint:[ji],color:[C4],container:[ji],"drop-shadow":[ji],ease:["in","out","in-out"],font:[LH],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ji],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ji],shadow:[ji],spacing:["px",qe],text:[ji],"text-shadow":[ji],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ms,ve,ye,w]}],container:["container"],columns:[{columns:[qe,ve,ye,a]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:C()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[gs,"auto",ye,ve]}],basis:[{basis:[ms,"full","auto",a,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qe,ms,"auto","initial","none",ve]}],grow:[{grow:["",qe,ye,ve]}],shrink:[{shrink:["",qe,ye,ve]}],order:[{order:[gs,"first","last","none",ye,ve]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...j(),"normal"]}],"justify-self":[{"justify-self":["auto",...j()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...j(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...j(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),"baseline"]}],"place-self":[{"place-self":["auto",...j()]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pbs:[{pbs:E()}],pbe:[{pbe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...B()]}],"min-block-size":[{"min-block":["auto",...B()]}],"max-block-size":[{"max-block":["none",...B()]}],w:[{w:[a,"screen",...F()]}],"min-w":[{"min-w":[a,"screen","none",...F()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,cc,uo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,UH,OH]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ig,ve]}],"font-family":[{font:[zH,BH,t]}],"font-features":[{"font-features":[ve]}],"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:[i,ye,ve]}],"line-clamp":[{"line-clamp":[qe,"none",ye,uk]}],leading:[{leading:[s,...E()]}],"list-image":[{"list-image":["none",ye,ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[qe,"from-font","auto",ye,uo]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[qe,"auto",ye,ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,ve]}],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",ye,ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:U()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:O()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gs,ye,ve],radial:["",ye,ve],conic:[gs,ye,ve]},HH,$H]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:le()}],"rounded-s":[{"rounded-s":le()}],"rounded-e":[{"rounded-e":le()}],"rounded-t":[{"rounded-t":le()}],"rounded-r":[{"rounded-r":le()}],"rounded-b":[{"rounded-b":le()}],"rounded-l":[{"rounded-l":le()}],"rounded-ss":[{"rounded-ss":le()}],"rounded-se":[{"rounded-se":le()}],"rounded-ee":[{"rounded-ee":le()}],"rounded-es":[{"rounded-es":le()}],"rounded-tl":[{"rounded-tl":le()}],"rounded-tr":[{"rounded-tr":le()}],"rounded-br":[{"rounded-br":le()}],"rounded-bl":[{"rounded-bl":le()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qe,ye,ve]}],"outline-w":[{outline:["",qe,cc,uo]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",u,Vd,qd]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",d,Vd,qd]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[qe,uo]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",f,Vd,qd]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[qe,ye,ve]}],"mix-blend":[{"mix-blend":[...ke(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ke()}],"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":[qe]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[ye,ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":S()}],"mask-image-conic-pos":[{"mask-conic":[qe]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:U()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:O()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,ve]}],filter:[{filter:["","none",ye,ve]}],blur:[{blur:Ie()}],brightness:[{brightness:[qe,ye,ve]}],contrast:[{contrast:[qe,ye,ve]}],"drop-shadow":[{"drop-shadow":["","none",p,Vd,qd]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",qe,ye,ve]}],"hue-rotate":[{"hue-rotate":[qe,ye,ve]}],invert:[{invert:["",qe,ye,ve]}],saturate:[{saturate:[qe,ye,ve]}],sepia:[{sepia:["",qe,ye,ve]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,ve]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[qe,ye,ve]}],"backdrop-contrast":[{"backdrop-contrast":[qe,ye,ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qe,ye,ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qe,ye,ve]}],"backdrop-invert":[{"backdrop-invert":["",qe,ye,ve]}],"backdrop-opacity":[{"backdrop-opacity":[qe,ye,ve]}],"backdrop-saturate":[{"backdrop-saturate":[qe,ye,ve]}],"backdrop-sepia":[{"backdrop-sepia":["",qe,ye,ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qe,"initial",ye,ve]}],ease:[{ease:["linear","initial",x,ye,ve]}],delay:[{delay:[qe,ye,ve]}],animate:[{animate:["none",_,ye,ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,ye,ve]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[ye,ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Be()}],"translate-x":[{"translate-x":Be()}],"translate-y":[{"translate-y":Be()}],"translate-z":[{"translate-z":Be()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",ye,ve]}],"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":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mbs":[{"scroll-mbs":E()}],"scroll-mbe":[{"scroll-mbe":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pbs":[{"scroll-pbs":E()}],"scroll-pbe":[{"scroll-pbe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"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",ye,ve]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[qe,cc,uo,uk]}],stroke:[{stroke:["none",...I()]}],"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"]}},VH=kH(qH);function ie(...e){return VH(x4(e))}const fk={path:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"},pk={path:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"},mk="M2 2H17V12H12V17H7V22H2ZM7 7V12H12V7ZM17 12H22V22H17Z",A4={claude:fk.path,"claude-cloud":fk.path,codex:pk.path,"codex-cloud":pk.path,pi:mk,"pi-cloud":mk},KH=new Set(["pi","pi-cloud"]);function GH(e){return e!=null&&e in A4}function tm({tool:e,className:t}){const n=e?A4[e]:void 0;return n?h.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:t,"aria-hidden":"true",children:h.jsx("path",{d:n,fillRule:e&&KH.has(e)?"evenodd":void 0})}):h.jsx(em,{className:t})}function o_(e){return e==="codex"?"Codex":e==="codex-cloud"?"Codex(云上)":e==="pi"?"pi":e==="pi-cloud"?"pi(云上)":e==="claude-cloud"?"Claude(云上)":"Claude Code"}function nm(e){return e==="claude"?"text-engine-claude":e==="codex"?"text-engine-codex":e==="codex-cloud"?"text-engine-codex-cloud":e==="pi"?"text-engine-pi":e==="pi-cloud"?"text-engine-pi-cloud":e==="claude-cloud"?"text-engine-claude-cloud":"text-text-400"}function a_(e){return e.label||e.aiLabel||e.larkChatName||e.larkChatId||e.cwd.split("/").filter(Boolean).pop()||e.sessionId.slice(0,8)}function YH(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`${i}m`;const s=Math.floor(i/60);if(s<24)return`${s}h`;const o=Math.floor(s/24);if(o<7)return`${o}d`;if(o<30)return`${Math.floor(o/7)}w`;const a=new Date(n),l=String(a.getMonth()+1).padStart(2,"0"),c=String(a.getDate()).padStart(2,"0");return`${l}/${c}`}function XH(e){const t=new Date(e),n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);if(i<24)return`${i}h ago`;const s=Math.floor(i/24);return s<7?`${s}d ago`:t.toLocaleDateString()}function ZH(e){return`'${e.replace(/'/g,"'\\''")}'`}function QH(e){return e.toolSessionId?e.tool==="codex"?`codex resume ${e.toolSessionId}`:e.tool==="pi"?`pi --session-id ${e.toolSessionId}`:`claude --resume ${e.toolSessionId} --permission-mode bypassPermissions`:null}function j4(e){const t=QH(e);return!t||!e.cwd?null:`cd ${ZH(e.cwd)} && ${t}`}function Ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function gk(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ku(...e){return t=>{let n=!1;const r=e.map(i=>{const s=gk(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():gk(e[i],null)}}}}function Ot(...e){return g.useCallback(Ku(...e),e)}function JH(e,t){const n=g.createContext(t),r=s=>{const{children:o,...a}=s,l=g.useMemo(()=>a,Object.values(a));return h.jsx(n.Provider,{value:l,children:o})};r.displayName=e+"Provider";function i(s){const o=g.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,i]}function ro(e,t=[]){let n=[];function r(s,o){const a=g.createContext(o),l=n.length;n=[...n,o];const c=d=>{var x;const{scope:f,children:p,...m}=d,v=((x=f==null?void 0:f[e])==null?void 0:x[l])||a,w=g.useMemo(()=>m,Object.values(m));return h.jsx(v.Provider,{value:w,children:p})};c.displayName=s+"Provider";function u(d,f){var v;const p=((v=f==null?void 0:f[e])==null?void 0:v[l])||a,m=g.useContext(p);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=n.map(o=>g.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,eU(i,...t)]}function eU(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ys=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},tU=Tl[" useInsertionEffect ".trim().toString()]||Ys;function $l({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,s,o]=nU({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=g.useRef(e!==void 0);g.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=g.useCallback(u=>{var d;if(a){const f=rU(u)?u(e):u;f!==e&&((d=o.current)==null||d.call(o,f))}else s(u)},[a,e,s,o]);return[l,c]}function nU({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),i=g.useRef(n),s=g.useRef(t);return tU(()=>{s.current=t},[t]),g.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function rU(e){return typeof e=="function"}function pl(e){const t=iU(e),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(oU);if(l){const c=l.props.children,u=a.map(d=>d===l?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:g.isValidElement(c)?g.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function iU(e){const t=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=lU(i),a=aU(s,i.props);return i.type!==g.Fragment&&(a.ref=r?Ku(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var L4=Symbol("radix.slottable");function sU(e){const t=({children:n})=>h.jsx(h.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=L4,t}function oU(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===L4}function aU(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function lU(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wt=cU.reduce((e,t)=>{const n=pl(`Primitive.${t}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function D4(e,t){e&&Do.flushSync(()=>e.dispatchEvent(t))}function O4(e){const t=e+"CollectionProvider",[n,r]=ro(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=v=>{const{scope:w,children:x}=v,_=Ze.useRef(null),b=Ze.useRef(new Map).current;return h.jsx(i,{scope:w,itemMap:b,collectionRef:_,children:x})};o.displayName=t;const a=e+"CollectionSlot",l=pl(a),c=Ze.forwardRef((v,w)=>{const{scope:x,children:_}=v,b=s(a,x),S=Ot(w,b.collectionRef);return h.jsx(l,{ref:S,children:_})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=pl(u),p=Ze.forwardRef((v,w)=>{const{scope:x,children:_,...b}=v,S=Ze.useRef(null),C=Ot(w,S),k=s(u,x);return Ze.useEffect(()=>(k.itemMap.set(S,{ref:S,...b}),()=>void k.itemMap.delete(S))),h.jsx(f,{[d]:"",ref:C,children:_})});p.displayName=u;function m(v){const w=s(e+"CollectionConsumer",v);return Ze.useCallback(()=>{const _=w.collectionRef.current;if(!_)return[];const b=Array.from(_.querySelectorAll(`[${d}]`));return Array.from(w.itemMap.values()).sort((k,T)=>b.indexOf(k.ref.current)-b.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:c,ItemSlot:p},m,r]}var uU=g.createContext(void 0);function B4(e){const t=g.useContext(uU);return e||t||"ltr"}function Ei(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function dU(e,t=globalThis==null?void 0:globalThis.document){const n=Ei(e);g.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var hU="DismissableLayer",mx="dismissableLayer.update",fU="dismissableLayer.pointerDownOutside",pU="dismissableLayer.focusOutside",vk,$4=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Gu=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=e,c=g.useContext($4),[u,d]=g.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=g.useState({}),m=Ot(t,T=>d(T)),v=Array.from(c.layers),[w]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(w),_=u?v.indexOf(u):-1,b=c.layersWithOutsidePointerEventsDisabled.size>0,S=_>=x,C=vU(T=>{const E=T.target,D=[...c.branches].some(N=>N.contains(E));!S||D||(i==null||i(T),o==null||o(T),T.defaultPrevented||a==null||a())},f),k=xU(T=>{const E=T.target;[...c.branches].some(N=>N.contains(E))||(s==null||s(T),o==null||o(T),T.defaultPrevented||a==null||a())},f);return dU(T=>{_===c.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&a&&(T.preventDefault(),a()))},f),g.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(vk=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),xk(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=vk)}},[u,f,n,c]),g.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),xk())},[u,c]),g.useEffect(()=>{const T=()=>p({});return document.addEventListener(mx,T),()=>document.removeEventListener(mx,T)},[]),h.jsx(wt.div,{...l,ref:m,style:{pointerEvents:b?S?"auto":"none":void 0,...e.style},onFocusCapture:Ne(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Ne(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Ne(e.onPointerDownCapture,C.onPointerDownCapture)})});Gu.displayName=hU;var mU="DismissableLayerBranch",gU=g.forwardRef((e,t)=>{const n=g.useContext($4),r=g.useRef(null),i=Ot(t,r);return g.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),h.jsx(wt.div,{...e,ref:i})});gU.displayName=mU;function vU(e,t=globalThis==null?void 0:globalThis.document){const n=Ei(e),r=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){z4(fU,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function xU(e,t=globalThis==null?void 0:globalThis.document){const n=Ei(e),r=g.useRef(!1);return g.useEffect(()=>{const i=s=>{s.target&&!r.current&&z4(pU,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function xk(){const e=new CustomEvent(mx);document.dispatchEvent(e)}function z4(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?D4(i,s):i.dispatchEvent(s)}var Ng=0;function l_(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??yk()),document.body.insertAdjacentElement("beforeend",e[1]??yk()),Ng++,()=>{Ng===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ng--}},[])}function yk(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Tg="focusScope.autoFocusOnMount",Pg="focusScope.autoFocusOnUnmount",_k={bubbles:!1,cancelable:!0},yU="FocusScope",rm=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,l]=g.useState(null),c=Ei(i),u=Ei(s),d=g.useRef(null),f=Ot(t,v=>l(v)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let v=function(b){if(p.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:ws(d.current,{select:!0})},w=function(b){if(p.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||ws(d.current,{select:!0}))},x=function(b){if(document.activeElement===document.body)for(const C of b)C.removedNodes.length>0&&ws(a)};document.addEventListener("focusin",v),document.addEventListener("focusout",w);const _=new MutationObserver(x);return a&&_.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",w),_.disconnect()}}},[r,a,p.paused]),g.useEffect(()=>{if(a){wk.add(p);const v=document.activeElement;if(!a.contains(v)){const x=new CustomEvent(Tg,_k);a.addEventListener(Tg,c),a.dispatchEvent(x),x.defaultPrevented||(_U(CU(F4(a)),{select:!0}),document.activeElement===v&&ws(a))}return()=>{a.removeEventListener(Tg,c),setTimeout(()=>{const x=new CustomEvent(Pg,_k);a.addEventListener(Pg,u),a.dispatchEvent(x),x.defaultPrevented||ws(v??document.body,{select:!0}),a.removeEventListener(Pg,u),wk.remove(p)},0)}}},[a,c,u,p]);const m=g.useCallback(v=>{if(!n&&!r||p.paused)return;const w=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(w&&x){const _=v.currentTarget,[b,S]=bU(_);b&&S?!v.shiftKey&&x===S?(v.preventDefault(),n&&ws(b,{select:!0})):v.shiftKey&&x===b&&(v.preventDefault(),n&&ws(S,{select:!0})):x===_&&v.preventDefault()}},[n,r,p.paused]);return h.jsx(wt.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});rm.displayName=yU;function _U(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ws(r,{select:t}),document.activeElement!==n)return}function bU(e){const t=F4(e),n=bk(t,e),r=bk(t.reverse(),e);return[n,r]}function F4(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function bk(e,t){for(const n of e)if(!wU(n,{upTo:t}))return n}function wU(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function SU(e){return e instanceof HTMLInputElement&&"select"in e}function ws(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&SU(e)&&t&&e.select()}}var wk=kU();function kU(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Sk(e,t),e.unshift(t)},remove(t){var n;e=Sk(e,t),(n=e[0])==null||n.resume()}}}function Sk(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function CU(e){return e.filter(t=>t.tagName!=="A")}var EU=Tl[" useId ".trim().toString()]||(()=>{}),IU=0;function bi(e){const[t,n]=g.useState(EU());return Ys(()=>{n(r=>r??String(IU++))},[e]),t?`radix-${t}`:""}const NU=["top","right","bottom","left"],Xs=Math.min,ar=Math.max,qf=Math.round,Kd=Math.floor,wi=e=>({x:e,y:e}),TU={left:"right",right:"left",bottom:"top",top:"bottom"};function gx(e,t,n){return ar(e,Xs(t,n))}function ns(e,t){return typeof e=="function"?e(t):e}function rs(e){return e.split("-")[0]}function zl(e){return e.split("-")[1]}function c_(e){return e==="x"?"y":"x"}function u_(e){return e==="y"?"height":"width"}function mi(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function d_(e){return c_(mi(e))}function PU(e,t,n){n===void 0&&(n=!1);const r=zl(e),i=d_(e),s=u_(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Vf(o)),[o,Vf(o)]}function RU(e){const t=Vf(e);return[vx(e),t,vx(t)]}function vx(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const kk=["left","right"],Ck=["right","left"],MU=["top","bottom"],AU=["bottom","top"];function jU(e,t,n){switch(e){case"top":case"bottom":return n?t?Ck:kk:t?kk:Ck;case"left":case"right":return t?MU:AU;default:return[]}}function LU(e,t,n,r){const i=zl(e);let s=jU(rs(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(vx)))),s}function Vf(e){const t=rs(e);return TU[t]+e.slice(t.length)}function DU(e){return{top:0,right:0,bottom:0,left:0,...e}}function H4(e){return typeof e!="number"?DU(e):{top:e,right:e,bottom:e,left:e}}function Kf(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ek(e,t,n){let{reference:r,floating:i}=e;const s=mi(t),o=d_(t),a=u_(o),l=rs(t),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(zl(t)){case"start":p[o]-=f*(n&&c?-1:1);break;case"end":p[o]+=f*(n&&c?-1:1);break}return p}async function OU(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=ns(t,e),m=H4(p),w=a[f?d==="floating"?"reference":"floating":d],x=Kf(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},C=Kf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:b,strategy:l}):_);return{top:(x.top-C.top+m.top)/S.y,bottom:(C.bottom-x.bottom+m.bottom)/S.y,left:(x.left-C.left+m.left)/S.x,right:(C.right-x.right+m.right)/S.x}}const BU=50,$U=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:OU},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ek(c,r,l),f=r,p=0;const m={};for(let v=0;v<s.length;v++){const w=s[v];if(!w)continue;const{name:x,fn:_}=w,{x:b,y:S,data:C,reset:k}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});u=b??u,d=S??d,m[x]={...m[x],...C},k&&p<BU&&(p++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(c=k.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:u,y:d}=Ek(c,f,l)),v=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},zU=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=ns(e,t)||{};if(c==null)return{};const d=H4(u),f={x:n,y:r},p=d_(i),m=u_(p),v=await o.getDimensions(c),w=p==="y",x=w?"top":"left",_=w?"bottom":"right",b=w?"clientHeight":"clientWidth",S=s.reference[m]+s.reference[p]-f[p]-s.floating[m],C=f[p]-s.reference[p],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let T=k?k[b]:0;(!T||!await(o.isElement==null?void 0:o.isElement(k)))&&(T=a.floating[b]||s.floating[m]);const E=S/2-C/2,D=T/2-v[m]/2-1,N=Xs(d[x],D),L=Xs(d[_],D),R=N,M=T-v[m]-L,A=T/2-v[m]/2+E,j=gx(R,A,M),z=!l.arrow&&zl(i)!=null&&A!==j&&s.reference[m]/2-(A<R?N:L)-v[m]/2<0,F=z?A<R?A-R:A-M:0;return{[p]:f[p]+F,data:{[p]:j,centerOffset:A-j-F,...z&&{alignmentOffset:F}},reset:z}}}),FU=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...w}=ns(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=rs(i),_=mi(a),b=rs(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=f||(b||!v?[Vf(a)]:RU(a)),k=m!=="none";!f&&k&&C.push(...LU(a,v,m,S));const T=[a,...C],E=await l.detectOverflow(t,w),D=[];let N=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&D.push(E[x]),d){const A=PU(i,o,S);D.push(E[A[0]],E[A[1]])}if(N=[...N,{placement:i,overflows:D}],!D.every(A=>A<=0)){var L,R;const A=(((L=s.flip)==null?void 0:L.index)||0)+1,j=T[A];if(j&&(!(d==="alignment"?_!==mi(j):!1)||N.every($=>mi($.placement)===_?$.overflows[0]>0:!0)))return{data:{index:A,overflows:N},reset:{placement:j}};let z=(R=N.filter(F=>F.overflows[0]<=0).sort((F,$)=>F.overflows[1]-$.overflows[1])[0])==null?void 0:R.placement;if(!z)switch(p){case"bestFit":{var M;const F=(M=N.filter($=>{if(k){const B=mi($.placement);return B===_||B==="y"}return!0}).map($=>[$.placement,$.overflows.filter(B=>B>0).reduce((B,I)=>B+I,0)]).sort(($,B)=>$[1]-B[1])[0])==null?void 0:M[0];F&&(z=F);break}case"initialPlacement":z=a;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function Ik(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Nk(e){return NU.some(t=>e[t]>=0)}const HU=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=ns(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=Ik(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Nk(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),a=Ik(o,n.floating);return{data:{escapedOffsets:a,escaped:Nk(a)}}}default:return{}}}}},U4=new Set(["left","top"]);async function UU(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=rs(n),a=zl(n),l=mi(n)==="y",c=U4.has(o)?-1:1,u=s&&l?-1:1,d=ns(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}const WU=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await UU(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},qU=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:x=>{let{x:_,y:b}=x;return{x:_,y:b}}},...c}=ns(e,t),u={x:n,y:r},d=await s.detectOverflow(t,c),f=mi(rs(i)),p=c_(f);let m=u[p],v=u[f];if(o){const x=p==="y"?"top":"left",_=p==="y"?"bottom":"right",b=m+d[x],S=m-d[_];m=gx(b,m,S)}if(a){const x=f==="y"?"top":"left",_=f==="y"?"bottom":"right",b=v+d[x],S=v-d[_];v=gx(b,v,S)}const w=l.fn({...t,[p]:m,[f]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[p]:o,[f]:a}}}}}},VU=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ns(e,t),u={x:n,y:r},d=mi(i),f=c_(d);let p=u[f],m=u[d];const v=ns(a,t),w=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const b=f==="y"?"height":"width",S=s.reference[f]-s.floating[b]+w.mainAxis,C=s.reference[f]+s.reference[b]-w.mainAxis;p<S?p=S:p>C&&(p=C)}if(c){var x,_;const b=f==="y"?"width":"height",S=U4.has(rs(i)),C=s.reference[d]-s.floating[b]+(S&&((x=o.offset)==null?void 0:x[d])||0)+(S?0:w.crossAxis),k=s.reference[d]+s.reference[b]+(S?0:((_=o.offset)==null?void 0:_[d])||0)-(S?w.crossAxis:0);m<C?m=C:m>k&&(m=k)}return{[f]:p,[d]:m}}}},KU=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:l=()=>{},...c}=ns(e,t),u=await o.detectOverflow(t,c),d=rs(i),f=zl(i),p=mi(i)==="y",{width:m,height:v}=s.floating;let w,x;d==="top"||d==="bottom"?(w=d,x=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(x=d,w=f==="end"?"top":"bottom");const _=v-u.top-u.bottom,b=m-u.left-u.right,S=Xs(v-u[w],_),C=Xs(m-u[x],b),k=!t.middlewareData.shift;let T=S,E=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(E=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=_),k&&!f){const N=ar(u.left,0),L=ar(u.right,0),R=ar(u.top,0),M=ar(u.bottom,0);p?E=m-2*(N!==0||L!==0?N+L:ar(u.left,u.right)):T=v-2*(R!==0||M!==0?R+M:ar(u.top,u.bottom))}await l({...t,availableWidth:E,availableHeight:T});const D=await o.getDimensions(a.floating);return m!==D.width||v!==D.height?{reset:{rects:!0}}:{}}}};function im(){return typeof window<"u"}function Fl(e){return W4(e)?(e.nodeName||"").toLowerCase():"#document"}function ur(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ti(e){var t;return(t=(W4(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function W4(e){return im()?e instanceof Node||e instanceof ur(e).Node:!1}function Xr(e){return im()?e instanceof Element||e instanceof ur(e).Element:!1}function ls(e){return im()?e instanceof HTMLElement||e instanceof ur(e).HTMLElement:!1}function Tk(e){return!im()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ur(e).ShadowRoot}function Yu(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Zr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function GU(e){return/^(table|td|th)$/.test(Fl(e))}function sm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const YU=/transform|translate|scale|rotate|perspective|filter/,XU=/paint|layout|strict|content/,ho=e=>!!e&&e!=="none";let Rg;function h_(e){const t=Xr(e)?Zr(e):e;return ho(t.transform)||ho(t.translate)||ho(t.scale)||ho(t.rotate)||ho(t.perspective)||!f_()&&(ho(t.backdropFilter)||ho(t.filter))||YU.test(t.willChange||"")||XU.test(t.contain||"")}function ZU(e){let t=Zs(e);for(;ls(t)&&!ml(t);){if(h_(t))return t;if(sm(t))return null;t=Zs(t)}return null}function f_(){return Rg==null&&(Rg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Rg}function ml(e){return/^(html|body|#document)$/.test(Fl(e))}function Zr(e){return ur(e).getComputedStyle(e)}function om(e){return Xr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zs(e){if(Fl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Tk(e)&&e.host||Ti(e);return Tk(t)?t.host:t}function q4(e){const t=Zs(e);return ml(t)?e.ownerDocument?e.ownerDocument.body:e.body:ls(t)&&Yu(t)?t:q4(t)}function Cu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=q4(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=ur(i);if(s){const a=xx(o);return t.concat(o,o.visualViewport||[],Yu(i)?i:[],a&&n?Cu(a):[])}else return t.concat(i,Cu(i,[],n))}function xx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function V4(e){const t=Zr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ls(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=qf(n)!==s||qf(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function p_(e){return Xr(e)?e:e.contextElement}function Ya(e){const t=p_(e);if(!ls(t))return wi(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=V4(t);let o=(s?qf(n.width):n.width)/r,a=(s?qf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const QU=wi(0);function K4(e){const t=ur(e);return!f_()||!t.visualViewport?QU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function JU(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ur(e)?!1:t}function Fo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=p_(e);let o=wi(1);t&&(r?Xr(r)&&(o=Ya(r)):o=Ya(e));const a=JU(s,n,r)?K4(s):wi(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){const f=ur(s),p=r&&Xr(r)?ur(r):r;let m=f,v=xx(m);for(;v&&r&&p!==m;){const w=Ya(v),x=v.getBoundingClientRect(),_=Zr(v),b=x.left+(v.clientLeft+parseFloat(_.paddingLeft))*w.x,S=x.top+(v.clientTop+parseFloat(_.paddingTop))*w.y;l*=w.x,c*=w.y,u*=w.x,d*=w.y,l+=b,c+=S,m=ur(v),v=xx(m)}}return Kf({width:u,height:d,x:l,y:c})}function am(e,t){const n=om(e).scrollLeft;return t?t.left+n:Fo(Ti(e)).left+n}function G4(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-am(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function eW(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Ti(r),a=t?sm(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=wi(1);const u=wi(0),d=ls(r);if((d||!d&&!s)&&((Fl(r)!=="body"||Yu(o))&&(l=om(r)),d)){const p=Fo(r);c=Ya(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const f=o&&!d&&!s?G4(o,l):wi(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function tW(e){return Array.from(e.getClientRects())}function nW(e){const t=Ti(e),n=om(e),r=e.ownerDocument.body,i=ar(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ar(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+am(e);const a=-n.scrollTop;return Zr(r).direction==="rtl"&&(o+=ar(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Pk=25;function rW(e,t){const n=ur(e),r=Ti(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=f_();(!u||u&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=am(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-p);m<=Pk&&(s-=m)}else c<=Pk&&(s+=c);return{width:s,height:o,x:a,y:l}}function iW(e,t){const n=Fo(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ls(e)?Ya(e):wi(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function Rk(e,t,n){let r;if(t==="viewport")r=rW(e,n);else if(t==="document")r=nW(Ti(e));else if(Xr(t))r=iW(t,n);else{const i=K4(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Kf(r)}function Y4(e,t){const n=Zs(e);return n===t||!Xr(n)||ml(n)?!1:Zr(n).position==="fixed"||Y4(n,t)}function sW(e,t){const n=t.get(e);if(n)return n;let r=Cu(e,[],!1).filter(a=>Xr(a)&&Fl(a)!=="body"),i=null;const s=Zr(e).position==="fixed";let o=s?Zs(e):e;for(;Xr(o)&&!ml(o);){const a=Zr(o),l=h_(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Yu(o)&&!l&&Y4(e,o))?r=r.filter(u=>u!==o):i=a,o=Zs(o)}return t.set(e,r),r}function oW(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?sm(t)?[]:sW(t,this._c):[].concat(n),r],a=Rk(t,o[0],i);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<o.length;f++){const p=Rk(t,o[f],i);l=ar(p.top,l),c=Xs(p.right,c),u=Xs(p.bottom,u),d=ar(p.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function aW(e){const{width:t,height:n}=V4(e);return{width:t,height:n}}function lW(e,t,n){const r=ls(t),i=Ti(t),s=n==="fixed",o=Fo(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=wi(0);function c(){l.x=am(i)}if(r||!r&&!s)if((Fl(t)!=="body"||Yu(i))&&(a=om(t)),r){const p=Fo(t,!0,s,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else i&&c();s&&!r&&i&&c();const u=i&&!r&&!s?G4(i,a):wi(0),d=o.left+a.scrollLeft-l.x-u.x,f=o.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function Mg(e){return Zr(e).position==="static"}function Mk(e,t){if(!ls(e)||Zr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ti(e)===n&&(n=n.ownerDocument.body),n}function X4(e,t){const n=ur(e);if(sm(e))return n;if(!ls(e)){let i=Zs(e);for(;i&&!ml(i);){if(Xr(i)&&!Mg(i))return i;i=Zs(i)}return n}let r=Mk(e,t);for(;r&&GU(r)&&Mg(r);)r=Mk(r,t);return r&&ml(r)&&Mg(r)&&!h_(r)?n:r||ZU(e)||n}const cW=async function(e){const t=this.getOffsetParent||X4,n=this.getDimensions,r=await n(e.floating);return{reference:lW(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function uW(e){return Zr(e).direction==="rtl"}const dW={convertOffsetParentRelativeRectToViewportRelativeRect:eW,getDocumentElement:Ti,getClippingRect:oW,getOffsetParent:X4,getElementRects:cW,getClientRects:tW,getDimensions:aW,getScale:Ya,isElement:Xr,isRTL:uW};function Z4(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hW(e,t){let n=null,r;const i=Ti(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=c;if(a||t(),!f||!p)return;const m=Kd(d),v=Kd(i.clientWidth-(u+f)),w=Kd(i.clientHeight-(d+p)),x=Kd(u),b={rootMargin:-m+"px "+-v+"px "+-w+"px "+-x+"px",threshold:ar(0,Xs(1,l))||1};let S=!0;function C(k){const T=k[0].intersectionRatio;if(T!==l){if(!S)return o();T?o(!1,T):r=setTimeout(()=>{o(!1,1e-7)},1e3)}T===1&&!Z4(c,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(C,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,b)}n.observe(e)}return o(!0),s}function fW(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=p_(e),u=i||s?[...c?Cu(c):[],...t?Cu(t):[]]:[];u.forEach(x=>{i&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const d=c&&a?hW(c,n):null;let f=-1,p=null;o&&(p=new ResizeObserver(x=>{let[_]=x;_&&_.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let m,v=l?Fo(e):null;l&&w();function w(){const x=Fo(e);v&&!Z4(v,x)&&n(),v=x,m=requestAnimationFrame(w)}return n(),()=>{var x;u.forEach(_=>{i&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),d==null||d(),(x=p)==null||x.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const pW=WU,mW=qU,gW=FU,vW=KU,xW=HU,Ak=zU,yW=VU,_W=(e,t,n)=>{const r=new Map,i={platform:dW,...n},s={...i.platform,_c:r};return $U(e,t,{...i,platform:s})};var bW=typeof document<"u",wW=function(){},Oh=bW?g.useLayoutEffect:wW;function Gf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Gf(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Gf(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Q4(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jk(e,t){const n=Q4(e);return Math.round(t*n)/n}function Ag(e){const t=g.useRef(e);return Oh(()=>{t.current=e}),t}function SW(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=g.useState(r);Gf(f,r)||p(r);const[m,v]=g.useState(null),[w,x]=g.useState(null),_=g.useCallback($=>{$!==k.current&&(k.current=$,v($))},[]),b=g.useCallback($=>{$!==T.current&&(T.current=$,x($))},[]),S=s||m,C=o||w,k=g.useRef(null),T=g.useRef(null),E=g.useRef(u),D=l!=null,N=Ag(l),L=Ag(i),R=Ag(c),M=g.useCallback(()=>{if(!k.current||!T.current)return;const $={placement:t,strategy:n,middleware:f};L.current&&($.platform=L.current),_W(k.current,T.current,$).then(B=>{const I={...B,isPositioned:R.current!==!1};A.current&&!Gf(E.current,I)&&(E.current=I,Do.flushSync(()=>{d(I)}))})},[f,t,n,L,R]);Oh(()=>{c===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d($=>({...$,isPositioned:!1})))},[c]);const A=g.useRef(!1);Oh(()=>(A.current=!0,()=>{A.current=!1}),[]),Oh(()=>{if(S&&(k.current=S),C&&(T.current=C),S&&C){if(N.current)return N.current(S,C,M);M()}},[S,C,M,N,D]);const j=g.useMemo(()=>({reference:k,floating:T,setReference:_,setFloating:b}),[_,b]),z=g.useMemo(()=>({reference:S,floating:C}),[S,C]),F=g.useMemo(()=>{const $={position:n,left:0,top:0};if(!z.floating)return $;const B=jk(z.floating,u.x),I=jk(z.floating,u.y);return a?{...$,transform:"translate("+B+"px, "+I+"px)",...Q4(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:I}},[n,a,z.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:M,refs:j,elements:z,floatingStyles:F}),[u,M,j,z,F])}const kW=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ak({element:r.current,padding:i}).fn(n):{}:r?Ak({element:r,padding:i}).fn(n):{}}}},CW=(e,t)=>{const n=pW(e);return{name:n.name,fn:n.fn,options:[e,t]}},EW=(e,t)=>{const n=mW(e);return{name:n.name,fn:n.fn,options:[e,t]}},IW=(e,t)=>({fn:yW(e).fn,options:[e,t]}),NW=(e,t)=>{const n=gW(e);return{name:n.name,fn:n.fn,options:[e,t]}},TW=(e,t)=>{const n=vW(e);return{name:n.name,fn:n.fn,options:[e,t]}},PW=(e,t)=>{const n=xW(e);return{name:n.name,fn:n.fn,options:[e,t]}},RW=(e,t)=>{const n=kW(e);return{name:n.name,fn:n.fn,options:[e,t]}};var MW="Arrow",J4=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return h.jsx(wt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});J4.displayName=MW;var AW=J4;function jW(e){const[t,n]=g.useState(void 0);return Ys(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var m_="Popper",[e3,Hl]=ro(m_),[LW,t3]=e3(m_),n3=e=>{const{__scopePopper:t,children:n}=e,[r,i]=g.useState(null);return h.jsx(LW,{scope:t,anchor:r,onAnchorChange:i,children:n})};n3.displayName=m_;var r3="PopperAnchor",i3=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=t3(r3,n),o=g.useRef(null),a=Ot(t,o),l=g.useRef(null);return g.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:h.jsx(wt.div,{...i,ref:a})});i3.displayName=r3;var g_="PopperContent",[DW,OW]=e3(g_),s3=g.forwardRef((e,t)=>{var re,ke,oe,Ie,Ee,Re;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...v}=e,w=t3(g_,n),[x,_]=g.useState(null),b=Ot(t,he=>_(he)),[S,C]=g.useState(null),k=jW(S),T=(k==null?void 0:k.width)??0,E=(k==null?void 0:k.height)??0,D=r+(s!=="center"?"-"+s:""),N=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},L=Array.isArray(c)?c:[c],R=L.length>0,M={padding:N,boundary:L.filter($W),altBoundary:R},{refs:A,floatingStyles:j,placement:z,isPositioned:F,middlewareData:$}=SW({strategy:"fixed",placement:D,whileElementsMounted:(...he)=>fW(...he,{animationFrame:p==="always"}),elements:{reference:w.anchor},middleware:[CW({mainAxis:i+E,alignmentAxis:o}),l&&EW({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?IW():void 0,...M}),l&&NW({...M}),TW({...M,apply:({elements:he,rects:Be,availableWidth:Je,availableHeight:Ge})=>{const{width:ft,height:Kt}=Be.reference,fe=he.floating.style;fe.setProperty("--radix-popper-available-width",`${Je}px`),fe.setProperty("--radix-popper-available-height",`${Ge}px`),fe.setProperty("--radix-popper-anchor-width",`${ft}px`),fe.setProperty("--radix-popper-anchor-height",`${Kt}px`)}}),S&&RW({element:S,padding:a}),zW({arrowWidth:T,arrowHeight:E}),f&&PW({strategy:"referenceHidden",...M})]}),[B,I]=l3(z),U=Ei(m);Ys(()=>{F&&(U==null||U())},[F,U]);const q=(re=$.arrow)==null?void 0:re.x,O=(ke=$.arrow)==null?void 0:ke.y,te=((oe=$.arrow)==null?void 0:oe.centerOffset)!==0,[le,Y]=g.useState();return Ys(()=>{x&&Y(window.getComputedStyle(x).zIndex)},[x]),h.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:F?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[(Ie=$.transformOrigin)==null?void 0:Ie.x,(Ee=$.transformOrigin)==null?void 0:Ee.y].join(" "),...((Re=$.hide)==null?void 0:Re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(DW,{scope:n,placedSide:B,onArrowChange:C,arrowX:q,arrowY:O,shouldHideArrow:te,children:h.jsx(wt.div,{"data-side":B,"data-align":I,...v,ref:b,style:{...v.style,animation:F?void 0:"none"}})})})});s3.displayName=g_;var o3="PopperArrow",BW={top:"bottom",right:"left",bottom:"top",left:"right"},a3=g.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=OW(o3,r),o=BW[s.placedSide];return h.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:h.jsx(AW,{...i,ref:n,style:{...i.style,display:"block"}})})});a3.displayName=o3;function $W(e){return e!==null}var zW=e=>({name:"transformOrigin",options:e,fn(t){var w,x,_;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[c,u]=l3(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(((x=i.arrow)==null?void 0:x.x)??0)+a/2,p=(((_=i.arrow)==null?void 0:_.y)??0)+l/2;let m="",v="";return c==="bottom"?(m=o?d:`${f}px`,v=`${-l}px`):c==="top"?(m=o?d:`${f}px`,v=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,v=o?d:`${p}px`):c==="left"&&(m=`${r.floating.width+l}px`,v=o?d:`${p}px`),{data:{x:m,y:v}}}});function l3(e){const[t,n="center"]=e.split("-");return[t,n]}var lm=n3,cm=i3,v_=s3,x_=a3,FW="Portal",um=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,s]=g.useState(!1);Ys(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?_v.createPortal(h.jsx(wt.div,{...r,ref:t}),o):null});um.displayName=FW;function HW(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Jr=e=>{const{present:t,children:n}=e,r=UW(t),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=Ot(r.ref,WW(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:s}):null};Jr.displayName="Presence";function UW(e){const[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),s=g.useRef("none"),o=e?"mounted":"unmounted",[a,l]=HW(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=Gd(r.current);s.current=a==="mounted"?c:"none"},[a]),Ys(()=>{const c=r.current,u=i.current;if(u!==e){const f=s.current,p=Gd(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Ys(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const v=Gd(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(l("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},f=p=>{p.target===t&&(s.current=Gd(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Gd(e){return(e==null?void 0:e.animationName)||"none"}function WW(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jg="rovingFocusGroup.onEntryFocus",qW={bubbles:!1,cancelable:!0},Xu="RovingFocusGroup",[yx,c3,VW]=O4(Xu),[KW,u3]=ro(Xu,[VW]),[GW,YW]=KW(Xu),d3=g.forwardRef((e,t)=>h.jsx(yx.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(yx.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(XW,{...e,ref:t})})}));d3.displayName=Xu;var XW=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,f=g.useRef(null),p=Ot(t,f),m=B4(s),[v,w]=$l({prop:o,defaultProp:a??null,onChange:l,caller:Xu}),[x,_]=g.useState(!1),b=Ei(c),S=c3(n),C=g.useRef(!1),[k,T]=g.useState(0);return g.useEffect(()=>{const E=f.current;if(E)return E.addEventListener(jg,b),()=>E.removeEventListener(jg,b)},[b]),h.jsx(GW,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:v,onItemFocus:g.useCallback(E=>w(E),[w]),onItemShiftTab:g.useCallback(()=>_(!0),[]),onFocusableItemAdd:g.useCallback(()=>T(E=>E+1),[]),onFocusableItemRemove:g.useCallback(()=>T(E=>E-1),[]),children:h.jsx(wt.div,{tabIndex:x||k===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:Ne(e.onMouseDown,()=>{C.current=!0}),onFocus:Ne(e.onFocus,E=>{const D=!C.current;if(E.target===E.currentTarget&&D&&!x){const N=new CustomEvent(jg,qW);if(E.currentTarget.dispatchEvent(N),!N.defaultPrevented){const L=S().filter(z=>z.focusable),R=L.find(z=>z.active),M=L.find(z=>z.id===v),j=[R,M,...L].filter(Boolean).map(z=>z.ref.current);p3(j,u)}}C.current=!1}),onBlur:Ne(e.onBlur,()=>_(!1))})})}),h3="RovingFocusGroupItem",f3=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=e,l=bi(),c=s||l,u=YW(h3,n),d=u.currentTabStopId===c,f=c3(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:v}=u;return g.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),h.jsx(yx.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:h.jsx(wt.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Ne(e.onMouseDown,w=>{r?u.onItemFocus(c):w.preventDefault()}),onFocus:Ne(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ne(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){u.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const x=JW(w,u.orientation,u.dir);if(x!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let b=f().filter(S=>S.focusable).map(S=>S.ref.current);if(x==="last")b.reverse();else if(x==="prev"||x==="next"){x==="prev"&&b.reverse();const S=b.indexOf(w.currentTarget);b=u.loop?eq(b,S+1):b.slice(S+1)}setTimeout(()=>p3(b))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:v!=null}):o})})});f3.displayName=h3;var ZW={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function QW(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function JW(e,t,n){const r=QW(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ZW[r]}function p3(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function eq(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var tq=d3,nq=f3,rq=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},pa=new WeakMap,Yd=new WeakMap,Xd={},Lg=0,m3=function(e){return e&&(e.host||m3(e.parentNode))},iq=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=m3(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},sq=function(e,t,n,r){var i=iq(t,Array.isArray(e)?e:[e]);Xd[n]||(Xd[n]=new WeakMap);var s=Xd[n],o=[],a=new Set,l=new Set(i),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};i.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))u(f);else try{var p=f.getAttribute(r),m=p!==null&&p!=="false",v=(pa.get(f)||0)+1,w=(s.get(f)||0)+1;pa.set(f,v),s.set(f,w),o.push(f),v===1&&m&&Yd.set(f,!0),w===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",f,x)}})};return u(t),a.clear(),Lg++,function(){o.forEach(function(d){var f=pa.get(d)-1,p=s.get(d)-1;pa.set(d,f),s.set(d,p),f||(Yd.has(d)||d.removeAttribute(r),Yd.delete(d)),p||d.removeAttribute(n)}),Lg--,Lg||(pa=new WeakMap,pa=new WeakMap,Yd=new WeakMap,Xd={})}},y_=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=rq(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),sq(r,i,n,"aria-hidden")):function(){return null}},pi=function(){return pi=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},pi.apply(this,arguments)};function g3(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function oq(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Bh="right-scroll-bar-position",$h="width-before-scroll-bar",aq="with-scroll-bars-hidden",lq="--removed-body-scroll-bar-size";function Dg(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function cq(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var uq=typeof window<"u"?g.useLayoutEffect:g.useEffect,Lk=new WeakMap;function dq(e,t){var n=cq(null,function(r){return e.forEach(function(i){return Dg(i,r)})});return uq(function(){var r=Lk.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Dg(a,null)}),s.forEach(function(a){i.has(a)||Dg(a,o)})}Lk.set(n,e)},[e]),n}function hq(e){return e}function fq(e,t){t===void 0&&(t=hq);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var o=t(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return i}function pq(e){e===void 0&&(e={});var t=fq(null);return t.options=pi({async:!0,ssr:!1},e),t}var v3=function(e){var t=e.sideCar,n=g3(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,pi({},n))};v3.isSideCarExport=!0;function mq(e,t){return e.useMedium(t),v3}var x3=pq(),Og=function(){},dm=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:Og,onWheelCapture:Og,onTouchMoveCapture:Og}),i=r[0],s=r[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,v=e.inert,w=e.allowPinchZoom,x=e.as,_=x===void 0?"div":x,b=e.gapMode,S=g3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,k=dq([n,t]),T=pi(pi({},S),i);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:x3,removeScrollBar:c,shards:d,noRelative:p,noIsolation:m,inert:v,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:b}),o?g.cloneElement(g.Children.only(a),pi(pi({},T),{ref:k})):g.createElement(_,pi({},T,{className:l,ref:k}),a))});dm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};dm.classNames={fullWidth:$h,zeroRight:Bh};var gq=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vq(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=gq();return t&&e.setAttribute("nonce",t),e}function xq(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function yq(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var _q=function(){var e=0,t=null;return{add:function(n){e==0&&(t=vq())&&(xq(t,n),yq(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},bq=function(){var e=_q();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},y3=function(){var e=bq(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},wq={left:0,top:0,right:0,gap:0},Bg=function(e){return parseInt(e||"",10)||0},Sq=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Bg(n),Bg(r),Bg(i)]},kq=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return wq;var t=Sq(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Cq=y3(),Xa="data-scroll-locked",Eq=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
497
497
|
.`.concat(aq,` {
|
|
498
498
|
overflow: hidden `).concat(r,`;
|
|
499
499
|
padding-right: `).concat(a,"px ").concat(r,`;
|
|
@@ -538,10 +538,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
538
538
|
`+e}const br=e=>typeof e=="string"?e:"",hC=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];function FG(e){var s;if(e.type==="userMessage"){const a=(Array.isArray(e.content)?e.content:[]).map(c=>c.type==="text"?br(c.text):c.type==="image"?`[attachment:image:${br(c.url)}]`:c.type==="localImage"?`[图片](${br(c.path)})`:"").filter(Boolean).join(`
|
|
539
539
|
`),l=K$(a);return W_([{kind:"user-text",text:a,uuid:e.id,...l?{meta:l==="task"?"dispatch-task":"dispatch-result"}:{}}],0,"codex")}if(e.type==="agentMessage")return[{kind:"assistant-text",seq:0,text:br(e.text),uuid:e.id}];if(e.type==="reasoning")return[{kind:"assistant-thinking",seq:0,text:[...hC(e.summary),...hC(e.content)].join(`
|
|
540
540
|
`)}];if(e.type==="plan")return[{kind:"assistant-text",seq:0,text:br(e.text),uuid:e.id}];if(e.type==="hookPrompt"||e.type==="contextCompaction")return[];if(e.type==="subAgentActivity"){const o=br(e.agentThreadId);return e.kind==="started"?Fh([{kind:"tool_call",tool:"Agent",toolKind:"codex",toolUseId:`codex-agent-${o}`,input:{agentId:o,description:br(e.agentPath)}}]):e.kind==="completed"||e.kind==="interrupted"?Fh([{kind:"tool_result",toolUseId:`codex-agent-${o}`,output:e.kind==="completed"?"已完成":"已中断"}]):[]}const t=e.type==="mcpToolCall"?`${br(e.server)}.${br(e.tool)}`:e.type==="dynamicToolCall"?br(e.tool):e.type,n=e.type==="commandExecution"?{command:e.command,cwd:e.cwd}:e.type==="fileChange"?{changes:e.changes}:e.arguments??e,r=e.type==="commandExecution"?e.aggregatedOutput:e.type==="fileChange"?(Array.isArray(e.changes)?e.changes:[]).map(o=>br(o.diff)).join(`
|
|
541
|
-
`):e.result??e.contentItems??e.output??e,i=e.status==="failed"||e.status==="declined"||e.success===!1?br((s=e.error)==null?void 0:s.message)||"执行失败":e.type==="commandExecution"&&typeof e.exitCode=="number"&&e.exitCode!==0?`exit ${e.exitCode}`:void 0;return Fh([{kind:"tool_call",tool:t,toolKind:"codex",toolUseId:e.id,input:n},{kind:"tool_result",toolUseId:e.id,output:r,...i?{error:i}:{}}])}function HG(e,t,n){const r=new Set,s=(t===void 0?e.items:[...e.items.filter(a=>a.type==="userMessage"&&!t.some(l=>l.id===a.id)),...t,...e.items.filter(a=>a.type!=="userMessage"&&!t.some(l=>l.id===a.id))]).flatMap(a=>r.has(a.id)?[]:(r.add(a.id),FG(a)));let o=!1;for(const a of s)a.kind==="user-text"&&(o&&(a.continuesTurn=!0),o=!0);return e.error&&s.push({kind:"error",seq:0,message:e.error.message}),s.push(e.status==="inProgress"?{kind:"turn-end",seq:0,turnId:e.id,inProgress:!0}:{kind:"turn-end",seq:0,turnId:e.id,...e.durationMs!==null?{durationMs:e.durationMs}:{},reason:e.status==="interrupted"?"interrupted":"completed"}),s.map((a,l)=>({...a,seq:n+l}))}function UG(e,t){const n=new Map,r=[];let i=[];for(const c of e)c.kind==="turn-end"&&c.turnId?(n.set(c.turnId,{order:n.size,body:i,end:c}),r.push(c.turnId),i=[]):i.push(c);r.push(i);const s=[];let o=-1;const a=c=>{const u=new Set(c.flatMap(_=>_.turnId?[_.turnId]:[])),d=c.at(-1),f=(d==null?void 0:d.kind)==="turn-end"&&d.turnId?n.get(d.turnId):void 0;if(f&&(d==null?void 0:d.kind)==="turn-end"&&u.size>1){f.end=fC(f.end,d),o=Math.max(o,f.order),a(c.slice(0,-1));return}const p=u.size===1?[...u][0]:void 0,m=p?n.get(p):void 0;if(!p||!m){s.push(...c);return}const v=o<0?c.some(_=>_.kind==="session-init"):m.order>o,w=c.some(_=>_.kind!=="turn-end"&&_.turnId===p);let x=0;for(const _ of c){if(_.kind==="turn-end"){m.end=fC(m.end,_),o=Math.max(o,m.order);continue}if(_.kind==="session-init")continue;const b=_.kind==="user-text"||_.kind==="user-meta";b||(x=Math.max(x,m.body.findIndex(E=>E.kind==="user-text"||E.kind==="user-meta")+1));const S=m.body.findIndex((E,D)=>D>=x&&WG(E,_)),C=m.body[S],k=C&&"uuid"in C&&C.uuid&&"uuid"in _&&C.uuid===_.uuid,T=_.turnId===p||k||v&&w;if(b&&(S<0||!T)){s.push(_);continue}if(S>=0){const E=m.body[S];m.body[S]={...E,..._,...!b&&"text"in E&&"text"in _&&E.text.length>_.text.length?{text:E.text}:{}},x=S+1}else m.body.splice(x++,0,_)}};let l=[];for(const c of t)l.push(c),c.kind==="turn-end"&&(a(l),l=[]);return a(l),[...r.flatMap(c=>{if(typeof c!="string")return c;const u=n.get(c);return[...u.body,u.end]}),...s]}function fC(e,t){const{inProgress:n,...r}=e;return{...r,...t,seq:e.seq,reason:t.reason??"completed"}}function WG(e,t){if(e.kind!==t.kind)return!1;const n="partialId"in t&&t.partialId;if("uuid"in e&&e.uuid){if(n)return e.uuid===n;if("uuid"in t&&e.uuid===t.uuid)return!0}if("toolUseId"in e&&"toolUseId"in t)return e.toolUseId===t.toolUseId;if("text"in e&&"text"in t){if(e.text===t.text)return!0;if(e.kind==="user-text"&&t.kind==="user-text"){const r=Qf(e.text),i=Qf(t.text),s=r.attachments.filter(a=>a.type==="file"),o=i.attachments.filter(a=>a.type==="file");return r.attachments.some(a=>a.type==="image")&&r.text===i.text&&r.attachments.length===i.attachments.length&&s.length===o.length&&s.every((a,l)=>a.url===o[l].url)}}return!1}const nh=()=>({turns:[],details:{},nextCursor:null,loading:!1,loadingOlder:!1,error:null});function zg(e,t){if(e.view!==t||!Array.isArray(e.data))throw new Error("历史分页需要更新对端 daemon;未退回全量加载")}function qG(e){const{api:t,sessionId:n,toolSessionId:r,forkedFromSessionId:i,initialTurnStarted:s=!1,enabled:o,focused:a=!0,refreshVersion:l=0}=e,c=`${o}:${n}:${r??""}`,u=g.useRef(c);u.current=c;const d=g.useRef(0),f=g.useRef(!0),[p,m]=g.useState(nh),v=g.useRef(p);v.current=p;const w=g.useRef(!1),x=g.useRef(new Set),_=g.useRef(),b=g.useRef({sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:!!r});g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const S=g.useCallback(async()=>{if(!o||!r)return;_.current={identity:c,version:l,api:t};const D=++d.current,N=c;w.current=!1,x.current.clear(),m(L=>({...L,loading:!0,loadingOlder:!1,error:null}));try{const L=await t.historyPage({sessionId:n,view:"turns",limit:10});if(zg(L,"turns"),!f.current||d.current!==D||u.current!==N||L.view!=="turns")return;m({...nh(),turns:[...L.data].reverse(),snapshotId:L.snapshotId,nextCursor:L.nextCursor})}catch(L){if(!f.current||d.current!==D||u.current!==N)return;m(R=>({...R,loading:!1,error:L.message}))}},[t,c,o,r,n,l]);g.useEffect(()=>{const D=b.current,N=D.sessionId===n&&D.enabled,L=!!r||N&&D.hasAssignedThread;if(b.current={sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:L},!o||!r){d.current++,_.current=void 0,m(nh());return}if(!a)return;const R=!!i&&!D.hasAssignedThread;if(N&&D.focused&&!D.toolSessionId&&s&&!R&&D.refreshVersion===l&&D.api===t){_.current={identity:c,version:l,api:t,deferred:!0};return}const M=_.current,A=N&&!D.focused&&((M==null?void 0:M.deferred)||v.current.error!==null);(M==null?void 0:M.identity)===c&&M.version===l&&M.api===t&&!A||(((M==null?void 0:M.identity)!==c||M.api!==t)&&m(nh()),_.current={identity:c,version:l,api:t},S())},[t,c,n,o,r,i,s,a,l,S]);const C=g.useCallback(async()=>{const D=v.current;if(!o||D.loading||w.current||!D.nextCursor||!D.snapshotId)return;const N=d.current,L=c;w.current=!0,m(R=>({...R,loadingOlder:!0,error:null}));try{const R=await t.historyPage({sessionId:n,view:"turns",limit:10,cursor:D.nextCursor,snapshotId:D.snapshotId});if(zg(R,"turns"),!f.current||N!==d.current||L!==u.current||R.view!=="turns")return;if(R.snapshotId!==D.snapshotId||R.nextCursor===D.nextCursor)throw new Error("历史分页快照或游标失效,请刷新历史");m(M=>{const A=new Set(M.turns.map(j=>j.id));return{...M,turns:[...R.data.filter(j=>!A.has(j.id)).reverse(),...M.turns],nextCursor:R.nextCursor,loadingOlder:!1}})}catch(R){f.current&&N===d.current&&L===u.current&&m(M=>({...M,loadingOlder:!1,error:R.message}))}finally{N===d.current&&(w.current=!1)}},[t,o,c,n]),k=g.useCallback(async(D,N=!1)=>{const L=v.current,R=L.details[D];if(!o||L.loading||!L.snapshotId||x.current.has(D)||R&&!R.error&&!N||N&&!(R!=null&&R.nextCursor))return;const M=d.current,A=c;x.current.add(D);const j=R??{items:[],loading:!1,error:null,nextCursor:null};m(z=>({...z,details:{...z.details,[D]:{...j,loading:!0,error:null}}}));try{const z=await t.historyPage({sessionId:n,view:"items",turnId:D,limit:50,snapshotId:L.snapshotId,...R!=null&&R.nextCursor?{cursor:R.nextCursor}:{}});if(zg(z,"items"),!f.current||M!==d.current||A!==u.current||z.view!=="items")return;if(z.snapshotId!==L.snapshotId||R!=null&&R.nextCursor&&z.nextCursor===R.nextCursor)throw new Error("轮次详情快照或游标失效,请刷新历史");if(z.data.some(B=>B.turnId!==D))throw new Error("轮次详情身份不匹配");const F=new Set(j.items.map(B=>B.id)),$=[...j.items,...z.data.map(B=>B.item).filter(B=>!F.has(B.id))];m(B=>({...B,details:{...B.details,[D]:{items:$,loading:!1,error:null,nextCursor:z.nextCursor}}}))}catch(z){f.current&&M===d.current&&A===u.current&&m(F=>({...F,details:{...F.details,[D]:{...j,loading:!1,error:z.message}}}))}finally{M===d.current&&x.current.delete(D)}},[t,o,c,n]),T=g.useMemo(()=>p.turns.flatMap((D,N)=>{var L;return HG(D,(L=p.details[D.id])==null?void 0:L.items,(N-p.turns.length)*1e6)}),[p.turns,p.details]),E=g.useMemo(()=>T.map(D=>({kind:D.kind,..."text"in D?{text:D.text}:{},..."uuid"in D?{uuid:D.uuid}:{}})),[T]);return{...p,lines:T,messages:E,total:p.turns.length,loadOlder:C,loadDetails:k,refresh:S}}const VG=/<command-name>([\s\S]*?)<\/command-name>/i,KG=/<command-message>([\s\S]*?)<\/command-message>/i,GG=/<command-args>([\s\S]*?)<\/command-args>/i,YG=/<(local-command-[a-z]+|command-(?:stdout|stderr))>[\s\S]*?<\/\1>/gi;function _m(e){if(!e)return{commandName:null,commandMessage:null,commandArgs:null,body:""};const t=e.match(VG),n=e.match(KG),r=e.match(GG);let i=e;return t&&(i=i.replace(t[0],"")),n&&(i=i.replace(n[0],"")),r&&(i=i.replace(r[0],"")),i=i.replace(YG,""),i=i.trim(),{commandName:t?t[1].trim():null,commandMessage:n?n[1].trim():null,commandArgs:r?r[1].trim():null,body:i}}function pC(e){const t=_m(e);return t.commandName?t.commandArgs?`${t.commandName} ${t.commandArgs}`:t.commandName:e}function mC(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Zp(e.metaKind)}function XG(e,t){const n=t.find(mC);if(!n)return e;const r=pC(n.text);for(let s=e.length-1;s>=0;s--){const o=e[s];if(mC(o)&&pC(o.text)===r)return e.slice(0,s)}const i=e[e.length-1];return i!==void 0&&i.kind!=="turn-end"?[...e,{kind:"turn-end",seq:i.seq+1}]:e}function ZG(e){return e==="running"||e==="observing"}function ZP(e){return e==="running"||e==="running-idle"||e==="observing"}const QG=1e6,JG=5;function QP(e,t=!0){const n=ym(),r=Ni(),i=g.useMemo(()=>new Jp(r),[r]),s=ts("sessions"),o=g.useMemo(()=>s==null?void 0:s.find(fe=>fe.sessionId===e),[s,e]),a=o==null?void 0:o.toolSessionId,l=o==null?void 0:o.tool,[c,u]=g.useState(0),[d,f]=g.useState(null),p=as(),m=g.useRef(p);m.current=p;const[v,w]=g.useState(null),x=g.useRef(null),_=g.useRef(null);g.useEffect(()=>(f(null),w(null),_.current=null,r.on("session:control",fe=>{const He=fe;if(!((He==null?void 0:He.sessionId)!==e||He.kind!==c$))if(He.synchronized===!0){const Pe=`session/${e}`;m.current.setData(Pe,rt=>Ff(rt??zo,{type:"session:fold-barrier",sessionId:e},e));const Me=m.current.read(Pe);Me!=null&&Me.events.length&&w({first:Me.events[0],count:Me.events.length,historyBefore:x.current}),f(null),u(rt=>rt+1)}else f("断线期间的部分内容未显示,完整内容已保存在云端")})),[r,e]);const b=g.useCallback(()=>{const fe=`session/${e}`;m.current.setData(fe,rt=>Ff(rt??zo,{type:"session:fold-barrier",sessionId:e},e));const He=m.current.read(fe),Pe=(He==null?void 0:He.events)??[];let Me=Pe.length;for(;Me>0&&Pe[Me-1].kind!=="turn_end";)Me--;Me>0&&w({first:Pe[0],count:Me,historyBefore:x.current}),_.current={historyBefore:x.current},u(rt=>rt+1)},[e]),S=GP(e),{events:C,pendingPermissions:k,queued:T,status:E,clearPermission:D,restorePermission:N}=S,L=wz(),R=l==="codex",M=NG({api:i,sessionId:e,focused:t,toolSessionId:a,enabled:L!==void 0&&!R,refreshVersion:c,initialTurns:L==="owner"?void 0:JG,implicitCloseOnUserText:l==="codex"}),A=qG({api:i,sessionId:e,focused:t,toolSessionId:a,forkedFromSessionId:o==null?void 0:o.forkedFromSessionId,initialTurnStarted:C.some(fe=>fe.kind==="user_text"),enabled:L!==void 0&&R,refreshVersion:c}),j=R?A:M,z=g.useMemo(()=>({details:A.details,turnIds:new Set(A.turns.map(fe=>fe.id)),loadDetails:A.loadDetails}),[A.details,A.turns,A.loadDetails]);x.current=j.messages,g.useEffect(()=>{const fe=_.current;!fe||j.loading||j.messages===fe.historyBefore||(_.current=null,f(null))},[j.messages,j.loading]);const F=g.useMemo(()=>j.messages.filter(fe=>!fe.isSidechain),[j.messages]),$=g.useMemo(()=>{const fe=v;return!fe||j.messages===fe.historyBefore||j.loading||C[0]!==fe.first||C.length<fe.count?C:C.slice(fe.count)},[C,v,j.messages,j.loading]),B=g.useMemo(()=>R?A.lines:BG(W_(F,0,l)),[F,l,R,A.lines]),I=k[0]??null,U=g.useMemo(()=>Fh($,(I==null?void 0:I.requestId)??null),[$,I==null?void 0:I.requestId]),q=g.useMemo(()=>R?B:XG(B,U),[B,U,R]),O=g.useMemo(()=>U.map((fe,He)=>({...fe,seq:QG+He})),[U]),te=g.useMemo(()=>R?UG(q,O):[...q,...O],[q,O,R]),le=g.useRef(j.messages);g.useEffect(()=>{le.current!==j.messages&&(le.current=j.messages,!j.loading&&(n==null||n.push({level:"info",msg:"chatflow.history.display",sessionId:e,meta:{historyMessages:j.messages.length,mainChainMessages:F.length,historyLines:q.length,panelLines:te.length,total:j.total,error:j.error!==null}})))},[j.messages,j.loading,j.total,j.error,F.length,q.length,te.length,n,e]);const Y=ZP(E),re=ZG(E),ke=(o==null?void 0:o.resolvedModel)??(o==null?void 0:o.model),oe=g.useMemo(()=>({sessionLabel:(o==null?void 0:o.label)||(o==null?void 0:o.aiLabel)||(o==null?void 0:o.larkChatName)||(o==null?void 0:o.larkChatId)||e,sessionId:e,...o!=null&&o.larkChatId?{larkChatName:o.larkChatName??o.larkChatId,larkChatType:o.larkChatType??"group"}:{},...ke?{model:ke}:{},...(()=>{const fe=o==null?void 0:o.gitBranch;return fe?{gitBranch:fe}:{}})(),...(()=>{const fe=SG(o);return fe!==void 0?{contextPct:fe}:{}})(),...o!=null&&o.cwd?{cwd:o.cwd}:{},...(()=>{const fe=o==null?void 0:o.permissionMode;return fe?{permissionMode:fe}:{}})(),procAlive:Y,streamInProgress:re,pinnedAt:(o==null?void 0:o.pinnedAt)??null}),[o,e,ke,Y,re]),Ie=g.useMemo(()=>r.isOpen?E==="error"?{kind:"error",message:"session error"}:{kind:"ready"}:{kind:"closed"},[r.isOpen,E]),Ee=g.useCallback(async(fe,He)=>{await i.sessionSend(e,fe,He)},[i,e]),Re=g.useCallback(async fe=>{await i.sessionDequeue(e,fe)},[i,e]),he=g.useCallback(async()=>(await i.sessionInterrupt(e)).queued??[],[i,e]),Be=g.useCallback(async fe=>{if(!(o!=null&&o.cwd)||!a)throw new Error("fork requires sessionFile with cwd + toolSessionId");await i.sessionFork({cwd:o.cwd,toolSessionId:a,messageUuid:fe})},[i,o==null?void 0:o.cwd,a]),Qe=g.useCallback(async fe=>{await i.sessionRewind({sessionId:e,userMessageId:fe,dryRun:!1})},[i,e]),Ge=g.useCallback(async fe=>{await i.sessionUpdate(e,{model:fe})},[i,e]),ft=g.useCallback(async()=>{await i.sessionNew(e)},[i,e]),Kt=g.useCallback(async(fe,He)=>{const Pe=k.find(Me=>Me.requestId===fe);Pe&&D(fe);try{await i.permissionRespond({sessionId:e,permissionRequestId:fe,allow:He==="allow"})}catch(Me){throw!((Me==null?void 0:Me.message)??"").startsWith("PERMISSION_REQUEST_STALE")&&Pe&&N(Pe),Me}},[i,e,k,D,N]);return g.useMemo(()=>({lines:te,connState:Ie,meta:oe,historyLoading:j.loading,historyError:j.error,...R?{codexHistory:z,historyHasMore:A.nextCursor!==null,historyLoaded:A.snapshotId!==void 0,historyLoadingOlder:A.loadingOlder,loadOlderHistory:A.loadOlder,refreshHistory:A.refresh}:{},historySyncError:d,pendingPermissions:k,queued:T,sendText:Ee,dequeue:Re,interrupt:he,fork:Be,rewind:Qe,switchModel:Ge,clearSession:ft,respondPermission:Kt,reloadFromCloud:b}),[te,Ie,oe,j.loading,j.error,R,z,A.nextCursor,A.snapshotId,A.loadingOlder,A.loadOlder,A.refresh,d,k,T,Ee,Re,he,Be,Qe,Ge,ft,Kt,b])}const eY={codex:"on-request",claude:"bypassPermissions",pi:"never"};function tY(e){const t={cwd:e.cwd,permissionMode:e.sourcePermissionMode??eY[e.sourceTool??"claude"]??"bypassPermissions",forkedFromSessionId:e.sourceSessionId};return e.sourceOwnerPersonaId&&(t.ownerPersonaId=e.sourceOwnerPersonaId),e.sourceTool&&(t.tool=e.sourceTool),e.sourceModel&&(t.model=e.sourceModel),e.sourceEffort&&(t.effort=e.sourceEffort),e.sourceProjectPath&&(t.projectPath=e.sourceProjectPath),t}async function nY(e,t,n,r={}){if(!t.toolSessionId)return null;const i={...tY({cwd:t.cwd,sourceSessionId:t.sessionId,sourcePermissionMode:t.permissionMode,sourceOwnerPersonaId:t.ownerPersonaId,sourceTool:t.tool,sourceModel:t.model,sourceEffort:t.effort,sourceProjectPath:t.projectPath}),...r.ephemeral?{ephemeral:!0}:{}};if(Wc(t.tool))return e.sessionCreate({...i,forkAt:t.tool===Hy?{turnId:n}:{messageUuid:n}});const s=await e.sessionCreate(i);try{const{forkedToolSessionId:o}=await e.sessionFork({cwd:t.cwd,toolSessionId:t.toolSessionId,...t.tool==="codex"?{sourceSessionId:t.sessionId,turnId:n}:{messageUuid:n},targetCwd:s.cwd});await e.sessionResume(s.sessionId,o)}catch(o){throw e.sessionDelete(s.sessionId).catch(a=>$e("quick-ask","fork rollback failed",a)),o}return s}async function rY(e,t,n){return nY(e,t,n,{ephemeral:!0})}function rh(e){return e!=null&&e.ephemeral!==!1}async function iY(e,t){return t.stillEphemeral?(await e.sessionUpdate(t.sessionId,{ephemeral:!1}),!0):!1}function sY(e){try{const t=new URL(e);return t.protocol==="ws:"?t.protocol="http:":t.protocol==="wss:"&&(t.protocol="https:"),`${t.protocol}//${t.host}`}catch{return e}}function oY(e,t){try{const n=new URL(e),r=new URL(t);return n.protocol=r.protocol,n.host=r.host,n.toString()}catch{return e}}async function q_(e,t,n,r,i){const s=await e.attachmentSignUrl({sessionId:n,relPath:r,...i!==void 0?{ttlSeconds:i}:{}});return oY(s.url,sY(t.url))}async function gC(e,t,n,r,i=60,s){const o=window.open("about:blank","_blank");try{s&&await s();const a=await q_(e,t,n,r,i);o?o.location.href=a:window.open(a,"_blank")}catch(a){throw o&&o.close(),a}}async function aY(e){var t;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.setAttribute("readonly",""),document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}const lY=300;function cY(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function uY(e,t){const n=ky(),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>{let a=!1;return(async()=>{try{const l=await n.kv.get(e);if(a)return;const c=cY(l);typeof c=="number"&&Number.isFinite(c)&&c>0?i(c):i(t)}catch{a||i(t)}})(),()=>{a=!0}},[n,e,t]);const o=g.useCallback(a=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,n.kv.set(e,a).catch(()=>{})},lY)},[n,e]);return g.useEffect(()=>()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),{initialSize:r??t,setSize:o,loading:r===null}}function dY(){return{quickAsk:null,mds:[],active:null}}function hY(e,t){return{...e,quickAsk:{sessionId:t.sessionId,ephemeral:!0},active:"quick-ask"}}function fY(e,t){const n=e.mds.includes(t);return{...e,mds:n?e.mds:[...e.mds,t],active:{kind:"md",relPath:t}}}function pY(e){if(!e.quickAsk)return e;const t=e.active==="quick-ask",n=e.mds[0],r=t?n?{kind:"md",relPath:n}:null:e.active;return{...e,quickAsk:null,active:r}}function mY(e){return e.quickAsk?{...e,quickAsk:{...e.quickAsk,ephemeral:!1}}:e}function gY(e,t){const n=e.mds.indexOf(t);if(n<0)return e;const r=e.mds.filter(l=>l!==t);if(!(e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===t))return{...e,mds:r};const s=r[n],o=n>0?r[n-1]:void 0;let a=null;return s?a={kind:"md",relPath:s}:o?a={kind:"md",relPath:o}:e.quickAsk&&(a="quick-ask"),{...e,mds:r,active:a}}function vY(e,t){return{...e,active:t}}function xY(e,t){return e===null||t===null||e==="quick-ask"||t==="quick-ask"?e===t:e.relPath===t.relPath}function JP(e){return e.quickAsk!==null||e.mds.length>0}function yY(e,t,n,r=!0){const i=g.useRef({sid:null,tsid:void 0});g.useEffect(()=>{const s=i.current;i.current={sid:t,tsid:n},!(!r||!n||s.sid===t&&(s.tsid===void 0||s.tsid===null)&&typeof n=="string")&&e.sessionObserve({sessionId:t,toolSessionId:n}).catch(()=>{})},[e,t,n,r])}function _Y(e,t,n){const r=g.useRef(e),i=g.useRef(t),s=g.useRef(n);s.current=n,g.useEffect(()=>{const o=r.current,a=i.current;r.current=e,i.current=t;const l=o!==e,c=typeof a=="string"&&t==null;!l&&!c||s.current()},[e,t])}const bY=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function wY(e){const t=new Map,n=new Map,r=new Map;for(const i of e)if(i.kind==="tool_call"&&i.tool==="CronCreate"){const s=i.input;if(!s||typeof s.cron!="string"||typeof s.prompt!="string")continue;const o=i.ts;t.set(i.toolUseId,{cron:s.cron,prompt:s.prompt,recurring:s.recurring!==!1,ts:typeof o=="string"?o:"",toolUseId:i.toolUseId})}else if(i.kind==="tool_call"&&i.tool==="CronDelete"){const s=i.input;if(!s||typeof s.id!="string")continue;n.set(i.toolUseId,s.id)}else if(i.kind==="tool_result"){const s=t.get(i.toolUseId);if(s){if(t.delete(i.toolUseId),i.error||typeof i.output!="string")continue;const a=i.output.match(bY);if(!a)continue;r.set(a[1],{id:a[1],cron:s.cron,prompt:s.prompt,recurring:s.recurring,humanSchedule:a[2],createdAt:s.ts,toolUseId:s.toolUseId});continue}const o=n.get(i.toolUseId);o!==void 0&&(n.delete(i.toolUseId),i.error||r.delete(o))}return Array.from(r.values()).sort((i,s)=>i.createdAt.localeCompare(s.createdAt))}function eR(e){var n;if(e.error)return!1;if(e.pending)return!0;if(e.notifications.length>0)return!1;const t=(n=e.progress)==null?void 0:n.status;return t==="running"?!0:t==="started"?SY(e.input):!1}function SY(e){return!e||typeof e!="object"?!1:e.run_in_background===!0}function kY(e){return e.filter(t=>t.kind==="merged-agent"&&eR(t))}function tR(e){const{tasks:t,lastEventIndex:n}=AG(e);let r=-1;for(let m=e.length-1;m>=0;m--)if(e[m].kind==="todo-checklist"){r=m;break}const i=[],s=new Map,o=new Map,a=new Map,l=new Map,c=new Map,u=new Map,d=(m,v)=>{var S,C,k,T,E,D;const w=i[m],x=u.get(m),_=x!==void 0&&x!==v.toolUseId;if(!_&&(((S=w.progress)==null?void 0:S.status)==="completed"||((C=w.progress)==null?void 0:C.status)==="failed"))return;if(u.set(m,v.toolUseId),c.set(v.agentId,m),_&&(w.pending=!0,(k=w.toolResultExtra)!=null&&k.stats)){const{stats:N,...L}=w.toolResultExtra;w.toolResultExtra=L}const b={agentId:v.agentId,status:v.status};v.description?b.description=v.description:(T=w.progress)!=null&&T.description&&(b.description=w.progress.description),v.lastToolName?b.lastToolName=v.lastToolName:!_&&((E=w.progress)!=null&&E.lastToolName)&&(b.lastToolName=w.progress.lastToolName),v.stats?b.stats=v.stats:!_&&((D=w.progress)!=null&&D.stats)&&(b.stats=w.progress.stats),w.progress=b,(v.status==="completed"||v.status==="failed")&&(w.pending=!1)},f=m=>{var x;const v=s.get(m.toolUseId);if(v!==void 0){const _=i[v];return _.output=m.output,_.error=m.error,_.pending=!1,s.delete(m.toolUseId),!0}const w=o.get(m.toolUseId);if(w!==void 0){const _=i[w];return _.output=m.output,_.error=m.error,_.pending=!1,m.toolResultExtra&&(_.toolResultExtra=m.toolResultExtra),(x=m.toolResultExtra)!=null&&x.agentId&&(c.set(m.toolResultExtra.agentId,w),u.set(w,m.toolUseId)),!0}return!1},p=m=>{const v=l.get(m);v&&(l.delete(m),f(v))};for(let m=0;m<e.length;m++){const v=e[m];switch(v.kind){case"tool-call":{const w={kind:"merged-tool",seq:v.seq,tool:v.tool,toolKind:v.toolKind,toolUseId:v.toolUseId,input:v.input,pending:!0};s.set(v.toolUseId,i.length),i.push(w),p(v.toolUseId);break}case"tool-result":{f(v)||l.set(v.toolUseId,v);break}case"agent-call":{const w={kind:"merged-agent",seq:v.seq,toolUseId:v.toolUseId,description:v.description,input:v.input,pending:!0,notifications:[]},x=i.length;o.set(v.toolUseId,x),i.push(w);const _=a.get(v.toolUseId);_&&(d(x,_),a.delete(v.toolUseId)),p(v.toolUseId);break}case"agent-progress":{const w=o.get(v.toolUseId)??c.get(v.agentId);if(w!==void 0){d(w,v);break}const x=a.get(v.toolUseId);if((x==null?void 0:x.status)==="completed"||(x==null?void 0:x.status)==="failed")break;a.set(v.toolUseId,v);break}case"agent-notification":{const w=(v.parentToolUseId?o.get(v.parentToolUseId):void 0)??(v.taskId?c.get(v.taskId):void 0);if(w!==void 0){i[w].notifications.push({text:v.text,taskId:v.taskId});break}i.push({kind:"agent-notification",seq:v.seq,text:v.text,taskId:v.taskId,parentToolUseId:v.parentToolUseId});break}case"todo-checklist":{m===r&&v.todos.length>0&&i.push({kind:"todo-checklist",seq:v.seq,toolUseId:v.toolUseId,todos:v.todos});break}case"task-event":{m===n&&t.length>0&&i.push({kind:"plan-card",seq:v.seq,tasks:t});break}default:i.push(v)}}return i}const CY=new Set(["permission-inline","question-card"]);function EY(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Zp(e.metaKind)}function IY(e){return e.kind==="user-text"&&e.continuesTurn===!0}function NY(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(TY(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,s.inProgress!==!0);continue}if(EY(s)&&(r===null||!IY(s))){i(void 0,!0),r={query:s,body:[]};continue}r===null?r={body:[s]}:r.body.push(s)}return i(void 0,t.closeTrailing===!0),n}function TY(e,t,n){const{query:r,body:i}=e,s=PY(i,t,n),o=RY(i,s),a=AY(i,o),l=r??i[0]??t,c={kind:"turn",seq:l?l.seq:0,status:s,process:a,tail:o};return t!=null&&t.turnId&&(c.turnId=t.turnId),r&&(c.query=r),(t==null?void 0:t.durationMs)!==void 0&&(c.durationMs=t.durationMs),c}function PY(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=Ex(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function RY(e,t){if(t==="running"){const r=[];for(let i=e.length-1;i>=0&&CY.has(e[i].kind);i--)r.unshift(e[i]);return r}const n=t==="error"?Ex(e,r=>r.kind==="error"):Ex(e,r=>r.kind==="assistant-text");return n>=0?[e[n]]:[]}const MY=new Set(["assistant-thinking","user-meta"]);function AY(e,t){const n=new Set(t),r=[];let i=null;const s=()=>{i&&(r.push({kind:"tool-group",seq:i[0].seq,items:i}),i=null)};for(const o of e){if(n.has(o)){s();continue}if(o.kind==="merged-tool"){i?i.push(o):i=[o];continue}if(MY.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function Ex(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const jY={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function LY(e){if(!e||typeof e!="object")return"";const t=e,n=t.command??t.file_path??t.path??t.pattern??t.query??t.url??t.description;if(typeof n=="string")return n;for(const r of Object.values(t))if(typeof r=="string"&&r)return r;return""}function nR(e){const t=jY[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=LY(e.input);return r?`${n} ${r}`:n}function DY({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?Pn:Fn,s=n?(t==null?void 0:t(e))??null:null;return h.jsxs("div",{className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,"data-testid":"tool-call-group-row",className:ie("flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] hover:text-text-200",e.error?"text-destructive/80":"text-text-400"),children:[e.pending?h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(i,{className:"w-3.5 h-3.5 shrink-0 opacity-60"}),h.jsx("span",{className:"truncate min-w-0",children:nR(e)})]}),n?h.jsx("div",{"data-testid":"tool-call-group-row-detail",className:"pl-5 py-1 min-w-0 space-y-1.5 text-[12px] text-text-300",children:s!==null?s:h.jsxs(h.Fragment,{children:[h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono",children:JSON.stringify(e.input,null,2)}),e.output!==void 0?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-text-400",children:typeof e.output=="string"?e.output:JSON.stringify(e.output,null,2)}):null,e.error?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-destructive",children:e.error}):null]})}):null]})}function OY({items:e,renderItemDetail:t}){const[n,r]=g.useState(!1);if(e.length===0)return null;const i=e.some(l=>l.pending),s=i?[...e].reverse().find(l=>l.pending):e[e.length-1],o=!i&&e.length>1?` 等 ${e.length} 项`:"",a=n?Pn:Fn;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(l=>!l),"aria-expanded":n,"data-testid":"tool-call-group-header",className:"flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] text-text-400 hover:text-text-200",children:[i&&!n?h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"}),n?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:i?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:ie("truncate min-w-0",i&&"text-text-300"),children:[nR(s),o]})]}),n?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(l=>h.jsx(DY,{item:l,renderItemDetail:t},l.toolUseId))}):null]})}function BY(e){const t=Math.round(e/1e3);if(t<60)return`${t}秒`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}分${r}秒`:`${n}分钟`}function $Y(e,t){const n=t!==void 0?`耗时 ${BY(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function zY({status:e="done",durationMs:t,defaultExpanded:n=!1,onExpandedChange:r,children:i}){const[s,o]=g.useState(n),a=s?Pn:Fn;return h.jsxs("div",{"data-testid":"turn-process-block",className:"min-w-0 max-w-full border-t border-border pt-2",children:[h.jsxs("button",{type:"button",onClick:()=>{const l=!s;o(l),r==null||r(l)},"aria-expanded":s,"data-testid":"turn-process-block-header",className:ie("flex w-full items-center gap-1 text-left cursor-pointer min-w-0 py-0.5 text-[13px]",e!=="done"?"text-destructive/80 hover:text-destructive":"text-text-400 hover:text-text-200"),children:[h.jsx("span",{className:"truncate min-w-0",children:$Y(e,t)}),h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"})]}),s?h.jsx("div",{"data-testid":"turn-process-body",className:"mt-2 flex flex-col gap-2 border-l-2 border-border pl-3",children:i}):null]})}const FY=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,HY=/<builder-preview\b[^>]*\/>/gi,UY=/<(clawd-dispatch-task|clawd-dispatch-result)\b[^>]*>([\s\S]*?)<\/\1>/gi,WY=/<\/?(brief|detail|files)>/gi;function rR(e){return e?e.replace(UY,(t,n,r)=>J$(r.replace(WY,"")).trim()).replace(FY,"").replace(HY,"").trim():""}const qY=rR;function VY(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const KY=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,GY=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,YY={};function vC(e,t){return(YY.jsx?GY:KY).test(e)}const XY=/[ \t\n\f\r]/g;function ZY(e){return typeof e=="object"?e.type==="text"?xC(e.value):!1:xC(e)}function xC(e){return e.replace(XY,"")===""}class rd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}rd.prototype.normal={};rd.prototype.property={};rd.prototype.space=void 0;function iR(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new rd(n,r,t)}function Ix(e){return e.toLowerCase()}class tr{constructor(t,n){this.attribute=n,this.property=t}}tr.prototype.attribute="";tr.prototype.booleanish=!1;tr.prototype.boolean=!1;tr.prototype.commaOrSpaceSeparated=!1;tr.prototype.commaSeparated=!1;tr.prototype.defined=!1;tr.prototype.mustUseProperty=!1;tr.prototype.number=!1;tr.prototype.overloadedBoolean=!1;tr.prototype.property="";tr.prototype.spaceSeparated=!1;tr.prototype.space=void 0;let QY=0;const ze=ia(),zt=ia(),Nx=ia(),J=ia(),pt=ia(),Ja=ia(),sr=ia();function ia(){return 2**++QY}const Tx=Object.freeze(Object.defineProperty({__proto__:null,boolean:ze,booleanish:zt,commaOrSpaceSeparated:sr,commaSeparated:Ja,number:J,overloadedBoolean:Nx,spaceSeparated:pt},Symbol.toStringTag,{value:"Module"})),Fg=Object.keys(Tx);class V_ extends tr{constructor(t,n,r,i){let s=-1;if(super(t,n),yC(this,"space",i),typeof r=="number")for(;++s<Fg.length;){const o=Fg[s];yC(this,Fg[s],(r&Tx[o])===Tx[o])}}}V_.prototype.defined=!0;function yC(e,t,n){n&&(e[t]=n)}function Wl(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new V_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Ix(r)]=r,n[Ix(s.attribute)]=r}return new rd(t,n,e.space)}const sR=Wl({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:pt,ariaCurrent:null,ariaDescribedBy:pt,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:pt,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:pt,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:pt,ariaLevel:J,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:pt,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:pt,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:zt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function oR(e,t){return t in e?e[t]:t}function aR(e,t){return oR(e,t.toLowerCase())}const JY=Wl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ja,acceptCharset:pt,accessKey:pt,action:null,allow:null,allowFullScreen:ze,allowPaymentRequest:ze,allowUserMedia:ze,alt:null,as:null,async:ze,autoCapitalize:null,autoComplete:pt,autoFocus:ze,autoPlay:ze,blocking:pt,capture:null,charSet:null,checked:ze,cite:null,className:pt,cols:J,colSpan:null,content:null,contentEditable:zt,controls:ze,controlsList:pt,coords:J|Ja,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ze,defer:ze,dir:null,dirName:null,disabled:ze,download:Nx,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ze,formTarget:null,headers:pt,height:J,hidden:Nx,high:J,href:null,hrefLang:null,htmlFor:pt,httpEquiv:pt,id:null,imageSizes:null,imageSrcSet:null,inert:ze,inputMode:null,integrity:null,is:null,isMap:ze,itemId:null,itemProp:pt,itemRef:pt,itemScope:ze,itemType:pt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ze,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:ze,muted:ze,name:null,nonce:null,noModule:ze,noValidate:ze,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ze,optimum:J,pattern:null,ping:pt,placeholder:null,playsInline:ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ze,referrerPolicy:null,rel:pt,required:ze,reversed:ze,rows:J,rowSpan:J,sandbox:pt,scope:null,scoped:ze,seamless:ze,selected:ze,shadowRootClonable:ze,shadowRootDelegatesFocus:ze,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:ze,useMap:null,value:zt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:pt,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ze,declare:ze,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:ze,noHref:ze,noShade:ze,noWrap:ze,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ze,disableRemotePlayback:ze,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:aR}),eX=Wl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:sr,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:pt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ja,g2:Ja,glyphName:Ja,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:sr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:pt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sr,rev:sr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sr,requiredFeatures:sr,requiredFonts:sr,requiredFormats:sr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:sr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sr,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:oR}),lR=Wl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),cR=Wl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:aR}),uR=Wl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),tX={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},nX=/[A-Z]/g,_C=/-[a-z]/g,rX=/^data[-\w.:]+$/i;function iX(e,t){const n=Ix(t);let r=t,i=tr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&rX.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(_C,oX);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!_C.test(s)){let o=s.replace(nX,sX);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=V_}return new i(r,t)}function sX(e){return"-"+e.toLowerCase()}function oX(e){return e.charAt(1).toUpperCase()}const aX=iR([sR,JY,lR,cR,uR],"html"),K_=iR([sR,eX,lR,cR,uR],"svg");function lX(e){return e.join(" ").trim()}var G_={},bC=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,cX=/\n/g,uX=/^\s*/,dX=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,hX=/^:\s*/,fX=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,pX=/^[;\s]*/,mX=/^\s+|\s+$/g,gX=`
|
|
541
|
+
`):e.result??e.contentItems??e.output??e,i=e.status==="failed"||e.status==="declined"||e.success===!1?br((s=e.error)==null?void 0:s.message)||"执行失败":e.type==="commandExecution"&&typeof e.exitCode=="number"&&e.exitCode!==0?`exit ${e.exitCode}`:void 0;return Fh([{kind:"tool_call",tool:t,toolKind:"codex",toolUseId:e.id,input:n},{kind:"tool_result",toolUseId:e.id,output:r,...i?{error:i}:{}}])}function HG(e,t,n){const r=new Set,s=(t===void 0?e.items:[...e.items.filter(a=>a.type==="userMessage"&&!t.some(l=>l.id===a.id)),...t,...e.items.filter(a=>a.type!=="userMessage"&&!t.some(l=>l.id===a.id))]).flatMap(a=>r.has(a.id)?[]:(r.add(a.id),FG(a)));let o=!1;for(const a of s)a.kind==="user-text"&&(o&&(a.continuesTurn=!0),o=!0);return e.error&&s.push({kind:"error",seq:0,message:e.error.message}),s.push(e.status==="inProgress"?{kind:"turn-end",seq:0,turnId:e.id,inProgress:!0}:{kind:"turn-end",seq:0,turnId:e.id,...e.durationMs!==null?{durationMs:e.durationMs}:{},reason:e.status==="interrupted"?"interrupted":"completed"}),s.map((a,l)=>({...a,seq:n+l}))}function UG(e,t){const n=new Map,r=[];let i=[];for(const c of e)c.kind==="turn-end"&&c.turnId?(n.set(c.turnId,{order:n.size,body:i,end:c}),r.push(c.turnId),i=[]):i.push(c);r.push(i);const s=[];let o=-1;const a=c=>{const u=new Set(c.flatMap(_=>_.turnId?[_.turnId]:[])),d=c.at(-1),f=(d==null?void 0:d.kind)==="turn-end"&&d.turnId?n.get(d.turnId):void 0;if(f&&(d==null?void 0:d.kind)==="turn-end"&&u.size>1){f.end=fC(f.end,d),o=Math.max(o,f.order),a(c.slice(0,-1));return}const p=u.size===1?[...u][0]:void 0,m=p?n.get(p):void 0;if(!p||!m){s.push(...c);return}const v=o<0?c.some(_=>_.kind==="session-init"):m.order>o,w=c.some(_=>_.kind!=="turn-end"&&_.turnId===p);let x=0;for(const _ of c){if(_.kind==="turn-end"){m.end=fC(m.end,_),o=Math.max(o,m.order);continue}if(_.kind==="session-init")continue;const b=_.kind==="user-text"||_.kind==="user-meta";b||(x=Math.max(x,m.body.findIndex(E=>E.kind==="user-text"||E.kind==="user-meta")+1));const S=m.body.findIndex((E,D)=>D>=x&&WG(E,_)),C=m.body[S],k=C&&"uuid"in C&&C.uuid&&"uuid"in _&&C.uuid===_.uuid,T=_.turnId===p||k||v&&w;if(b&&(S<0||!T)){s.push(_);continue}if(S>=0){const E=m.body[S];m.body[S]={...E,..._,...!b&&"text"in E&&"text"in _&&E.text.length>_.text.length?{text:E.text}:{}},x=S+1}else m.body.splice(x++,0,_)}};let l=[];for(const c of t)l.push(c),c.kind==="turn-end"&&(a(l),l=[]);return a(l),[...r.flatMap(c=>{if(typeof c!="string")return c;const u=n.get(c);return[...u.body,u.end]}),...s]}function fC(e,t){const{inProgress:n,...r}=e;return{...r,...t,seq:e.seq,reason:t.reason??"completed"}}function WG(e,t){if(e.kind!==t.kind)return!1;const n="partialId"in t&&t.partialId;if("uuid"in e&&e.uuid){if(n)return e.uuid===n;if("uuid"in t&&e.uuid===t.uuid)return!0}if("toolUseId"in e&&"toolUseId"in t)return e.toolUseId===t.toolUseId;if("text"in e&&"text"in t){if(e.text===t.text)return!0;if(e.kind==="user-text"&&t.kind==="user-text"){const r=Qf(e.text),i=Qf(t.text),s=r.attachments.filter(a=>a.type==="file"),o=i.attachments.filter(a=>a.type==="file");return r.attachments.some(a=>a.type==="image")&&r.text===i.text&&r.attachments.length===i.attachments.length&&s.length===o.length&&s.every((a,l)=>a.url===o[l].url)}}return!1}const nh=()=>({turns:[],details:{},nextCursor:null,loading:!1,loadingOlder:!1,error:null});function zg(e,t){if(e.view!==t||!Array.isArray(e.data))throw new Error("历史分页需要更新对端 daemon;未退回全量加载")}function qG(e){const{api:t,sessionId:n,toolSessionId:r,forkedFromSessionId:i,initialTurnStarted:s=!1,enabled:o,focused:a=!0,refreshVersion:l=0}=e,c=`${o}:${n}:${r??""}`,u=g.useRef(c);u.current=c;const d=g.useRef(0),f=g.useRef(!0),[p,m]=g.useState(nh),v=g.useRef(p);v.current=p;const w=g.useRef(!1),x=g.useRef(new Set),_=g.useRef(),b=g.useRef({sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:!!r});g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const S=g.useCallback(async()=>{if(!o||!r)return;_.current={identity:c,version:l,api:t};const D=++d.current,N=c;w.current=!1,x.current.clear(),m(L=>({...L,loading:!0,loadingOlder:!1,error:null}));try{const L=await t.historyPage({sessionId:n,view:"turns",limit:10});if(zg(L,"turns"),!f.current||d.current!==D||u.current!==N||L.view!=="turns")return;m({...nh(),turns:[...L.data].reverse(),snapshotId:L.snapshotId,nextCursor:L.nextCursor})}catch(L){if(!f.current||d.current!==D||u.current!==N)return;m(R=>({...R,loading:!1,error:L.message}))}},[t,c,o,r,n,l]);g.useEffect(()=>{const D=b.current,N=D.sessionId===n&&D.enabled,L=!!r||N&&D.hasAssignedThread;if(b.current={sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:L},!o||!r){d.current++,_.current=void 0,m(nh());return}if(!a)return;const R=!!i&&!D.hasAssignedThread;if(N&&D.focused&&!D.toolSessionId&&s&&!R&&D.refreshVersion===l&&D.api===t){_.current={identity:c,version:l,api:t,deferred:!0};return}const M=_.current,A=N&&!D.focused&&((M==null?void 0:M.deferred)||v.current.error!==null);(M==null?void 0:M.identity)===c&&M.version===l&&M.api===t&&!A||(((M==null?void 0:M.identity)!==c||M.api!==t)&&m(nh()),_.current={identity:c,version:l,api:t},S())},[t,c,n,o,r,i,s,a,l,S]);const C=g.useCallback(async()=>{const D=v.current;if(!o||D.loading||w.current||!D.nextCursor||!D.snapshotId)return;const N=d.current,L=c;w.current=!0,m(R=>({...R,loadingOlder:!0,error:null}));try{const R=await t.historyPage({sessionId:n,view:"turns",limit:10,cursor:D.nextCursor,snapshotId:D.snapshotId});if(zg(R,"turns"),!f.current||N!==d.current||L!==u.current||R.view!=="turns")return;if(R.snapshotId!==D.snapshotId||R.nextCursor===D.nextCursor)throw new Error("历史分页快照或游标失效,请刷新历史");m(M=>{const A=new Set(M.turns.map(j=>j.id));return{...M,turns:[...R.data.filter(j=>!A.has(j.id)).reverse(),...M.turns],nextCursor:R.nextCursor,loadingOlder:!1}})}catch(R){f.current&&N===d.current&&L===u.current&&m(M=>({...M,loadingOlder:!1,error:R.message}))}finally{N===d.current&&(w.current=!1)}},[t,o,c,n]),k=g.useCallback(async(D,N=!1)=>{const L=v.current,R=L.details[D];if(!o||L.loading||!L.snapshotId||x.current.has(D)||R&&!R.error&&!N||N&&!(R!=null&&R.nextCursor))return;const M=d.current,A=c;x.current.add(D);const j=R??{items:[],loading:!1,error:null,nextCursor:null};m(z=>({...z,details:{...z.details,[D]:{...j,loading:!0,error:null}}}));try{const z=await t.historyPage({sessionId:n,view:"items",turnId:D,limit:50,snapshotId:L.snapshotId,...R!=null&&R.nextCursor?{cursor:R.nextCursor}:{}});if(zg(z,"items"),!f.current||M!==d.current||A!==u.current||z.view!=="items")return;if(z.snapshotId!==L.snapshotId||R!=null&&R.nextCursor&&z.nextCursor===R.nextCursor)throw new Error("轮次详情快照或游标失效,请刷新历史");if(z.data.some(B=>B.turnId!==D))throw new Error("轮次详情身份不匹配");const F=new Set(j.items.map(B=>B.id)),$=[...j.items,...z.data.map(B=>B.item).filter(B=>!F.has(B.id))];m(B=>({...B,details:{...B.details,[D]:{items:$,loading:!1,error:null,nextCursor:z.nextCursor}}}))}catch(z){f.current&&M===d.current&&A===u.current&&m(F=>({...F,details:{...F.details,[D]:{...j,loading:!1,error:z.message}}}))}finally{M===d.current&&x.current.delete(D)}},[t,o,c,n]),T=g.useMemo(()=>p.turns.flatMap((D,N)=>{var L;return HG(D,(L=p.details[D.id])==null?void 0:L.items,(N-p.turns.length)*1e6)}),[p.turns,p.details]),E=g.useMemo(()=>T.map(D=>({kind:D.kind,..."text"in D?{text:D.text}:{},..."uuid"in D?{uuid:D.uuid}:{}})),[T]);return{...p,lines:T,messages:E,total:p.turns.length,loadOlder:C,loadDetails:k,refresh:S}}const VG=/<command-name>([\s\S]*?)<\/command-name>/i,KG=/<command-message>([\s\S]*?)<\/command-message>/i,GG=/<command-args>([\s\S]*?)<\/command-args>/i,YG=/<(local-command-[a-z]+|command-(?:stdout|stderr))>[\s\S]*?<\/\1>/gi;function _m(e){if(!e)return{commandName:null,commandMessage:null,commandArgs:null,body:""};const t=e.match(VG),n=e.match(KG),r=e.match(GG);let i=e;return t&&(i=i.replace(t[0],"")),n&&(i=i.replace(n[0],"")),r&&(i=i.replace(r[0],"")),i=i.replace(YG,""),i=i.trim(),{commandName:t?t[1].trim():null,commandMessage:n?n[1].trim():null,commandArgs:r?r[1].trim():null,body:i}}function pC(e){const t=_m(e);return t.commandName?t.commandArgs?`${t.commandName} ${t.commandArgs}`:t.commandName:e}function mC(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Zp(e.metaKind)}function XG(e,t){const n=t.find(mC);if(!n)return e;const r=pC(n.text);for(let s=e.length-1;s>=0;s--){const o=e[s];if(mC(o)&&pC(o.text)===r)return e.slice(0,s)}const i=e[e.length-1];return i!==void 0&&i.kind!=="turn-end"?[...e,{kind:"turn-end",seq:i.seq+1}]:e}function ZG(e){return e==="running"||e==="observing"}function ZP(e){return e==="running"||e==="running-idle"||e==="observing"}const QG=1e6,JG=5;function QP(e,t=!0){const n=ym(),r=Ni(),i=g.useMemo(()=>new Jp(r),[r]),s=ts("sessions"),o=g.useMemo(()=>s==null?void 0:s.find(fe=>fe.sessionId===e),[s,e]),a=o==null?void 0:o.toolSessionId,l=o==null?void 0:o.tool,[c,u]=g.useState(0),[d,f]=g.useState(null),p=as(),m=g.useRef(p);m.current=p;const[v,w]=g.useState(null),x=g.useRef(null),_=g.useRef(null);g.useEffect(()=>(f(null),w(null),_.current=null,r.on("session:control",fe=>{const He=fe;if(!((He==null?void 0:He.sessionId)!==e||He.kind!==c$))if(He.synchronized===!0){const Pe=`session/${e}`;m.current.setData(Pe,rt=>Ff(rt??zo,{type:"session:fold-barrier",sessionId:e},e));const Me=m.current.read(Pe);Me!=null&&Me.events.length&&w({first:Me.events[0],count:Me.events.length,historyBefore:x.current}),f(null),u(rt=>rt+1)}else f("断线期间的部分内容未显示,完整内容已保存在云端")})),[r,e]);const b=g.useCallback(()=>{const fe=`session/${e}`;m.current.setData(fe,rt=>Ff(rt??zo,{type:"session:fold-barrier",sessionId:e},e));const He=m.current.read(fe),Pe=(He==null?void 0:He.events)??[];let Me=Pe.length;for(;Me>0&&Pe[Me-1].kind!=="turn_end";)Me--;Me>0&&w({first:Pe[0],count:Me,historyBefore:x.current}),_.current={historyBefore:x.current},u(rt=>rt+1)},[e]),S=GP(e),{events:C,pendingPermissions:k,queued:T,status:E,clearPermission:D,restorePermission:N}=S,L=wz(),R=l==="codex",M=NG({api:i,sessionId:e,focused:t,toolSessionId:a,enabled:L!==void 0&&!R,refreshVersion:c,initialTurns:L==="owner"?void 0:JG,implicitCloseOnUserText:l==="codex"}),A=qG({api:i,sessionId:e,focused:t,toolSessionId:a,forkedFromSessionId:o==null?void 0:o.forkedFromSessionId,initialTurnStarted:C.some(fe=>fe.kind==="user_text"),enabled:L!==void 0&&R,refreshVersion:c}),j=R?A:M,z=g.useMemo(()=>({details:A.details,turnIds:new Set(A.turns.map(fe=>fe.id)),loadDetails:A.loadDetails}),[A.details,A.turns,A.loadDetails]);x.current=j.messages,g.useEffect(()=>{const fe=_.current;!fe||j.loading||j.messages===fe.historyBefore||(_.current=null,f(null))},[j.messages,j.loading]);const F=g.useMemo(()=>j.messages.filter(fe=>!fe.isSidechain),[j.messages]),$=g.useMemo(()=>{const fe=v;return!fe||j.messages===fe.historyBefore||j.loading||C[0]!==fe.first||C.length<fe.count?C:C.slice(fe.count)},[C,v,j.messages,j.loading]),B=g.useMemo(()=>R?A.lines:BG(W_(F,0,l)),[F,l,R,A.lines]),I=k[0]??null,U=g.useMemo(()=>Fh($,(I==null?void 0:I.requestId)??null),[$,I==null?void 0:I.requestId]),q=g.useMemo(()=>R?B:XG(B,U),[B,U,R]),O=g.useMemo(()=>U.map((fe,He)=>({...fe,seq:QG+He})),[U]),te=g.useMemo(()=>R?UG(q,O):[...q,...O],[q,O,R]),le=g.useRef(j.messages);g.useEffect(()=>{le.current!==j.messages&&(le.current=j.messages,!j.loading&&(n==null||n.push({level:"info",msg:"chatflow.history.display",sessionId:e,meta:{historyMessages:j.messages.length,mainChainMessages:F.length,historyLines:q.length,panelLines:te.length,total:j.total,error:j.error!==null}})))},[j.messages,j.loading,j.total,j.error,F.length,q.length,te.length,n,e]);const Y=ZP(E),re=ZG(E),ke=(o==null?void 0:o.resolvedModel)??(o==null?void 0:o.model),oe=g.useMemo(()=>({sessionLabel:(o==null?void 0:o.label)||(o==null?void 0:o.aiLabel)||(o==null?void 0:o.larkChatName)||(o==null?void 0:o.larkChatId)||e,sessionId:e,...o!=null&&o.larkChatId?{larkChatName:o.larkChatName??o.larkChatId,larkChatType:o.larkChatType??"group"}:{},...ke?{model:ke}:{},...(()=>{const fe=o==null?void 0:o.gitBranch;return fe?{gitBranch:fe}:{}})(),...(()=>{const fe=SG(o);return fe!==void 0?{contextPct:fe}:{}})(),...o!=null&&o.cwd?{cwd:o.cwd}:{},...(()=>{const fe=o==null?void 0:o.permissionMode;return fe?{permissionMode:fe}:{}})(),procAlive:Y,streamInProgress:re,pinnedAt:(o==null?void 0:o.pinnedAt)??null}),[o,e,ke,Y,re]),Ie=g.useMemo(()=>r.isOpen?E==="error"?{kind:"error",message:"session error"}:{kind:"ready"}:{kind:"closed"},[r.isOpen,E]),Ee=g.useCallback(async(fe,He)=>{await i.sessionSend(e,fe,He)},[i,e]),Re=g.useCallback(async fe=>{await i.sessionDequeue(e,fe)},[i,e]),he=g.useCallback(async()=>(await i.sessionInterrupt(e)).queued??[],[i,e]),Be=g.useCallback(async fe=>{if(!(o!=null&&o.cwd)||!a)throw new Error("fork requires sessionFile with cwd + toolSessionId");await i.sessionFork({cwd:o.cwd,toolSessionId:a,messageUuid:fe})},[i,o==null?void 0:o.cwd,a]),Je=g.useCallback(async fe=>{await i.sessionRewind({sessionId:e,userMessageId:fe,dryRun:!1})},[i,e]),Ge=g.useCallback(async fe=>{await i.sessionUpdate(e,{model:fe})},[i,e]),ft=g.useCallback(async()=>{await i.sessionNew(e)},[i,e]),Kt=g.useCallback(async(fe,He)=>{const Pe=k.find(Me=>Me.requestId===fe);Pe&&D(fe);try{await i.permissionRespond({sessionId:e,permissionRequestId:fe,allow:He==="allow"})}catch(Me){throw!((Me==null?void 0:Me.message)??"").startsWith("PERMISSION_REQUEST_STALE")&&Pe&&N(Pe),Me}},[i,e,k,D,N]);return g.useMemo(()=>({lines:te,connState:Ie,meta:oe,historyLoading:j.loading,historyError:j.error,...R?{codexHistory:z,historyHasMore:A.nextCursor!==null,historyLoaded:A.snapshotId!==void 0,historyLoadingOlder:A.loadingOlder,loadOlderHistory:A.loadOlder,refreshHistory:A.refresh}:{},historySyncError:d,pendingPermissions:k,queued:T,sendText:Ee,dequeue:Re,interrupt:he,fork:Be,rewind:Je,switchModel:Ge,clearSession:ft,respondPermission:Kt,reloadFromCloud:b}),[te,Ie,oe,j.loading,j.error,R,z,A.nextCursor,A.snapshotId,A.loadingOlder,A.loadOlder,A.refresh,d,k,T,Ee,Re,he,Be,Je,Ge,ft,Kt,b])}const eY={codex:"on-request",claude:"bypassPermissions",pi:"never"};function tY(e){const t={cwd:e.cwd,permissionMode:e.sourcePermissionMode??eY[e.sourceTool??"claude"]??"bypassPermissions",forkedFromSessionId:e.sourceSessionId};return e.sourceOwnerPersonaId&&(t.ownerPersonaId=e.sourceOwnerPersonaId),e.sourceTool&&(t.tool=e.sourceTool),e.sourceModel&&(t.model=e.sourceModel),e.sourceEffort&&(t.effort=e.sourceEffort),e.sourceProjectPath&&(t.projectPath=e.sourceProjectPath),t}async function nY(e,t,n,r={}){if(!t.toolSessionId)return null;const i={...tY({cwd:t.cwd,sourceSessionId:t.sessionId,sourcePermissionMode:t.permissionMode,sourceOwnerPersonaId:t.ownerPersonaId,sourceTool:t.tool,sourceModel:t.model,sourceEffort:t.effort,sourceProjectPath:t.projectPath}),...r.ephemeral?{ephemeral:!0}:{}};if(Wc(t.tool))return e.sessionCreate({...i,forkAt:t.tool===Hy?{turnId:n}:{messageUuid:n}});const s=await e.sessionCreate(i);try{const{forkedToolSessionId:o}=await e.sessionFork({cwd:t.cwd,toolSessionId:t.toolSessionId,...t.tool==="codex"?{sourceSessionId:t.sessionId,turnId:n}:{messageUuid:n},targetCwd:s.cwd});await e.sessionResume(s.sessionId,o)}catch(o){throw e.sessionDelete(s.sessionId).catch(a=>$e("quick-ask","fork rollback failed",a)),o}return s}async function rY(e,t,n){return nY(e,t,n,{ephemeral:!0})}function rh(e){return e!=null&&e.ephemeral!==!1}async function iY(e,t){return t.stillEphemeral?(await e.sessionUpdate(t.sessionId,{ephemeral:!1}),!0):!1}function sY(e){try{const t=new URL(e);return t.protocol==="ws:"?t.protocol="http:":t.protocol==="wss:"&&(t.protocol="https:"),`${t.protocol}//${t.host}`}catch{return e}}function oY(e,t){try{const n=new URL(e),r=new URL(t);return n.protocol=r.protocol,n.host=r.host,n.toString()}catch{return e}}async function q_(e,t,n,r,i){const s=await e.attachmentSignUrl({sessionId:n,relPath:r,...i!==void 0?{ttlSeconds:i}:{}});return oY(s.url,sY(t.url))}async function gC(e,t,n,r,i=60,s){const o=window.open("about:blank","_blank");try{s&&await s();const a=await q_(e,t,n,r,i);o?o.location.href=a:window.open(a,"_blank")}catch(a){throw o&&o.close(),a}}async function aY(e){var t;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.setAttribute("readonly",""),document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}const lY=300;function cY(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function uY(e,t){const n=ky(),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>{let a=!1;return(async()=>{try{const l=await n.kv.get(e);if(a)return;const c=cY(l);typeof c=="number"&&Number.isFinite(c)&&c>0?i(c):i(t)}catch{a||i(t)}})(),()=>{a=!0}},[n,e,t]);const o=g.useCallback(a=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,n.kv.set(e,a).catch(()=>{})},lY)},[n,e]);return g.useEffect(()=>()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),{initialSize:r??t,setSize:o,loading:r===null}}function dY(){return{quickAsk:null,mds:[],active:null}}function hY(e,t){return{...e,quickAsk:{sessionId:t.sessionId,ephemeral:!0},active:"quick-ask"}}function fY(e,t){const n=e.mds.includes(t);return{...e,mds:n?e.mds:[...e.mds,t],active:{kind:"md",relPath:t}}}function pY(e){if(!e.quickAsk)return e;const t=e.active==="quick-ask",n=e.mds[0],r=t?n?{kind:"md",relPath:n}:null:e.active;return{...e,quickAsk:null,active:r}}function mY(e){return e.quickAsk?{...e,quickAsk:{...e.quickAsk,ephemeral:!1}}:e}function gY(e,t){const n=e.mds.indexOf(t);if(n<0)return e;const r=e.mds.filter(l=>l!==t);if(!(e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===t))return{...e,mds:r};const s=r[n],o=n>0?r[n-1]:void 0;let a=null;return s?a={kind:"md",relPath:s}:o?a={kind:"md",relPath:o}:e.quickAsk&&(a="quick-ask"),{...e,mds:r,active:a}}function vY(e,t){return{...e,active:t}}function xY(e,t){return e===null||t===null||e==="quick-ask"||t==="quick-ask"?e===t:e.relPath===t.relPath}function JP(e){return e.quickAsk!==null||e.mds.length>0}function yY(e,t,n,r=!0){const i=g.useRef({sid:null,tsid:void 0});g.useEffect(()=>{const s=i.current;i.current={sid:t,tsid:n},!(!r||!n||s.sid===t&&(s.tsid===void 0||s.tsid===null)&&typeof n=="string")&&e.sessionObserve({sessionId:t,toolSessionId:n}).catch(()=>{})},[e,t,n,r])}function _Y(e,t,n){const r=g.useRef(e),i=g.useRef(t),s=g.useRef(n);s.current=n,g.useEffect(()=>{const o=r.current,a=i.current;r.current=e,i.current=t;const l=o!==e,c=typeof a=="string"&&t==null;!l&&!c||s.current()},[e,t])}const bY=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function wY(e){const t=new Map,n=new Map,r=new Map;for(const i of e)if(i.kind==="tool_call"&&i.tool==="CronCreate"){const s=i.input;if(!s||typeof s.cron!="string"||typeof s.prompt!="string")continue;const o=i.ts;t.set(i.toolUseId,{cron:s.cron,prompt:s.prompt,recurring:s.recurring!==!1,ts:typeof o=="string"?o:"",toolUseId:i.toolUseId})}else if(i.kind==="tool_call"&&i.tool==="CronDelete"){const s=i.input;if(!s||typeof s.id!="string")continue;n.set(i.toolUseId,s.id)}else if(i.kind==="tool_result"){const s=t.get(i.toolUseId);if(s){if(t.delete(i.toolUseId),i.error||typeof i.output!="string")continue;const a=i.output.match(bY);if(!a)continue;r.set(a[1],{id:a[1],cron:s.cron,prompt:s.prompt,recurring:s.recurring,humanSchedule:a[2],createdAt:s.ts,toolUseId:s.toolUseId});continue}const o=n.get(i.toolUseId);o!==void 0&&(n.delete(i.toolUseId),i.error||r.delete(o))}return Array.from(r.values()).sort((i,s)=>i.createdAt.localeCompare(s.createdAt))}function eR(e){var n;if(e.error)return!1;if(e.pending)return!0;if(e.notifications.length>0)return!1;const t=(n=e.progress)==null?void 0:n.status;return t==="running"?!0:t==="started"?SY(e.input):!1}function SY(e){return!e||typeof e!="object"?!1:e.run_in_background===!0}function kY(e){return e.filter(t=>t.kind==="merged-agent"&&eR(t))}function tR(e){const{tasks:t,lastEventIndex:n}=AG(e);let r=-1;for(let m=e.length-1;m>=0;m--)if(e[m].kind==="todo-checklist"){r=m;break}const i=[],s=new Map,o=new Map,a=new Map,l=new Map,c=new Map,u=new Map,d=(m,v)=>{var S,C,k,T,E,D;const w=i[m],x=u.get(m),_=x!==void 0&&x!==v.toolUseId;if(!_&&(((S=w.progress)==null?void 0:S.status)==="completed"||((C=w.progress)==null?void 0:C.status)==="failed"))return;if(u.set(m,v.toolUseId),c.set(v.agentId,m),_&&(w.pending=!0,(k=w.toolResultExtra)!=null&&k.stats)){const{stats:N,...L}=w.toolResultExtra;w.toolResultExtra=L}const b={agentId:v.agentId,status:v.status};v.description?b.description=v.description:(T=w.progress)!=null&&T.description&&(b.description=w.progress.description),v.lastToolName?b.lastToolName=v.lastToolName:!_&&((E=w.progress)!=null&&E.lastToolName)&&(b.lastToolName=w.progress.lastToolName),v.stats?b.stats=v.stats:!_&&((D=w.progress)!=null&&D.stats)&&(b.stats=w.progress.stats),w.progress=b,(v.status==="completed"||v.status==="failed")&&(w.pending=!1)},f=m=>{var x;const v=s.get(m.toolUseId);if(v!==void 0){const _=i[v];return _.output=m.output,_.error=m.error,_.pending=!1,s.delete(m.toolUseId),!0}const w=o.get(m.toolUseId);if(w!==void 0){const _=i[w];return _.output=m.output,_.error=m.error,_.pending=!1,m.toolResultExtra&&(_.toolResultExtra=m.toolResultExtra),(x=m.toolResultExtra)!=null&&x.agentId&&(c.set(m.toolResultExtra.agentId,w),u.set(w,m.toolUseId)),!0}return!1},p=m=>{const v=l.get(m);v&&(l.delete(m),f(v))};for(let m=0;m<e.length;m++){const v=e[m];switch(v.kind){case"tool-call":{const w={kind:"merged-tool",seq:v.seq,tool:v.tool,toolKind:v.toolKind,toolUseId:v.toolUseId,input:v.input,pending:!0};s.set(v.toolUseId,i.length),i.push(w),p(v.toolUseId);break}case"tool-result":{f(v)||l.set(v.toolUseId,v);break}case"agent-call":{const w={kind:"merged-agent",seq:v.seq,toolUseId:v.toolUseId,description:v.description,input:v.input,pending:!0,notifications:[]},x=i.length;o.set(v.toolUseId,x),i.push(w);const _=a.get(v.toolUseId);_&&(d(x,_),a.delete(v.toolUseId)),p(v.toolUseId);break}case"agent-progress":{const w=o.get(v.toolUseId)??c.get(v.agentId);if(w!==void 0){d(w,v);break}const x=a.get(v.toolUseId);if((x==null?void 0:x.status)==="completed"||(x==null?void 0:x.status)==="failed")break;a.set(v.toolUseId,v);break}case"agent-notification":{const w=(v.parentToolUseId?o.get(v.parentToolUseId):void 0)??(v.taskId?c.get(v.taskId):void 0);if(w!==void 0){i[w].notifications.push({text:v.text,taskId:v.taskId});break}i.push({kind:"agent-notification",seq:v.seq,text:v.text,taskId:v.taskId,parentToolUseId:v.parentToolUseId});break}case"todo-checklist":{m===r&&v.todos.length>0&&i.push({kind:"todo-checklist",seq:v.seq,toolUseId:v.toolUseId,todos:v.todos});break}case"task-event":{m===n&&t.length>0&&i.push({kind:"plan-card",seq:v.seq,tasks:t});break}default:i.push(v)}}return i}const CY=new Set(["permission-inline","question-card"]);function EY(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Zp(e.metaKind)}function IY(e){return e.kind==="user-text"&&e.continuesTurn===!0}function NY(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(TY(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,s.inProgress!==!0);continue}if(EY(s)&&(r===null||!IY(s))){i(void 0,!0),r={query:s,body:[]};continue}r===null?r={body:[s]}:r.body.push(s)}return i(void 0,t.closeTrailing===!0),n}function TY(e,t,n){const{query:r,body:i}=e,s=PY(i,t,n),o=RY(i,s),a=AY(i,o),l=r??i[0]??t,c={kind:"turn",seq:l?l.seq:0,status:s,process:a,tail:o};return t!=null&&t.turnId&&(c.turnId=t.turnId),r&&(c.query=r),(t==null?void 0:t.durationMs)!==void 0&&(c.durationMs=t.durationMs),c}function PY(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=Ex(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function RY(e,t){if(t==="running"){const r=[];for(let i=e.length-1;i>=0&&CY.has(e[i].kind);i--)r.unshift(e[i]);return r}const n=t==="error"?Ex(e,r=>r.kind==="error"):Ex(e,r=>r.kind==="assistant-text");return n>=0?[e[n]]:[]}const MY=new Set(["assistant-thinking","user-meta"]);function AY(e,t){const n=new Set(t),r=[];let i=null;const s=()=>{i&&(r.push({kind:"tool-group",seq:i[0].seq,items:i}),i=null)};for(const o of e){if(n.has(o)){s();continue}if(o.kind==="merged-tool"){i?i.push(o):i=[o];continue}if(MY.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function Ex(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const jY={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function LY(e){if(!e||typeof e!="object")return"";const t=e,n=t.command??t.file_path??t.path??t.pattern??t.query??t.url??t.description;if(typeof n=="string")return n;for(const r of Object.values(t))if(typeof r=="string"&&r)return r;return""}function nR(e){const t=jY[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=LY(e.input);return r?`${n} ${r}`:n}function DY({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?Pn:Fn,s=n?(t==null?void 0:t(e))??null:null;return h.jsxs("div",{className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,"data-testid":"tool-call-group-row",className:ie("flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] hover:text-text-200",e.error?"text-destructive/80":"text-text-400"),children:[e.pending?h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(i,{className:"w-3.5 h-3.5 shrink-0 opacity-60"}),h.jsx("span",{className:"truncate min-w-0",children:nR(e)})]}),n?h.jsx("div",{"data-testid":"tool-call-group-row-detail",className:"pl-5 py-1 min-w-0 space-y-1.5 text-[12px] text-text-300",children:s!==null?s:h.jsxs(h.Fragment,{children:[h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono",children:JSON.stringify(e.input,null,2)}),e.output!==void 0?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-text-400",children:typeof e.output=="string"?e.output:JSON.stringify(e.output,null,2)}):null,e.error?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-destructive",children:e.error}):null]})}):null]})}function OY({items:e,renderItemDetail:t}){const[n,r]=g.useState(!1);if(e.length===0)return null;const i=e.some(l=>l.pending),s=i?[...e].reverse().find(l=>l.pending):e[e.length-1],o=!i&&e.length>1?` 等 ${e.length} 项`:"",a=n?Pn:Fn;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(l=>!l),"aria-expanded":n,"data-testid":"tool-call-group-header",className:"flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] text-text-400 hover:text-text-200",children:[i&&!n?h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"}),n?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:i?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:ie("truncate min-w-0",i&&"text-text-300"),children:[nR(s),o]})]}),n?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(l=>h.jsx(DY,{item:l,renderItemDetail:t},l.toolUseId))}):null]})}function BY(e){const t=Math.round(e/1e3);if(t<60)return`${t}秒`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}分${r}秒`:`${n}分钟`}function $Y(e,t){const n=t!==void 0?`耗时 ${BY(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function zY({status:e="done",durationMs:t,defaultExpanded:n=!1,onExpandedChange:r,children:i}){const[s,o]=g.useState(n),a=s?Pn:Fn;return h.jsxs("div",{"data-testid":"turn-process-block",className:"min-w-0 max-w-full border-t border-border pt-2",children:[h.jsxs("button",{type:"button",onClick:()=>{const l=!s;o(l),r==null||r(l)},"aria-expanded":s,"data-testid":"turn-process-block-header",className:ie("flex w-full items-center gap-1 text-left cursor-pointer min-w-0 py-0.5 text-[13px]",e!=="done"?"text-destructive/80 hover:text-destructive":"text-text-400 hover:text-text-200"),children:[h.jsx("span",{className:"truncate min-w-0",children:$Y(e,t)}),h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"})]}),s?h.jsx("div",{"data-testid":"turn-process-body",className:"mt-2 flex flex-col gap-2 border-l-2 border-border pl-3",children:i}):null]})}const FY=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,HY=/<builder-preview\b[^>]*\/>/gi,UY=/<(clawd-dispatch-task|clawd-dispatch-result)\b[^>]*>([\s\S]*?)<\/\1>/gi,WY=/<\/?(brief|detail|files)>/gi;function rR(e){return e?e.replace(UY,(t,n,r)=>J$(r.replace(WY,"")).trim()).replace(FY,"").replace(HY,"").trim():""}const qY=rR;function VY(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const KY=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,GY=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,YY={};function vC(e,t){return(YY.jsx?GY:KY).test(e)}const XY=/[ \t\n\f\r]/g;function ZY(e){return typeof e=="object"?e.type==="text"?xC(e.value):!1:xC(e)}function xC(e){return e.replace(XY,"")===""}class rd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}rd.prototype.normal={};rd.prototype.property={};rd.prototype.space=void 0;function iR(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new rd(n,r,t)}function Ix(e){return e.toLowerCase()}class tr{constructor(t,n){this.attribute=n,this.property=t}}tr.prototype.attribute="";tr.prototype.booleanish=!1;tr.prototype.boolean=!1;tr.prototype.commaOrSpaceSeparated=!1;tr.prototype.commaSeparated=!1;tr.prototype.defined=!1;tr.prototype.mustUseProperty=!1;tr.prototype.number=!1;tr.prototype.overloadedBoolean=!1;tr.prototype.property="";tr.prototype.spaceSeparated=!1;tr.prototype.space=void 0;let QY=0;const ze=ia(),zt=ia(),Nx=ia(),J=ia(),pt=ia(),Ja=ia(),sr=ia();function ia(){return 2**++QY}const Tx=Object.freeze(Object.defineProperty({__proto__:null,boolean:ze,booleanish:zt,commaOrSpaceSeparated:sr,commaSeparated:Ja,number:J,overloadedBoolean:Nx,spaceSeparated:pt},Symbol.toStringTag,{value:"Module"})),Fg=Object.keys(Tx);class V_ extends tr{constructor(t,n,r,i){let s=-1;if(super(t,n),yC(this,"space",i),typeof r=="number")for(;++s<Fg.length;){const o=Fg[s];yC(this,Fg[s],(r&Tx[o])===Tx[o])}}}V_.prototype.defined=!0;function yC(e,t,n){n&&(e[t]=n)}function Wl(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new V_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Ix(r)]=r,n[Ix(s.attribute)]=r}return new rd(t,n,e.space)}const sR=Wl({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:pt,ariaCurrent:null,ariaDescribedBy:pt,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:pt,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:pt,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:pt,ariaLevel:J,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:pt,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:pt,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:zt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function oR(e,t){return t in e?e[t]:t}function aR(e,t){return oR(e,t.toLowerCase())}const JY=Wl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ja,acceptCharset:pt,accessKey:pt,action:null,allow:null,allowFullScreen:ze,allowPaymentRequest:ze,allowUserMedia:ze,alt:null,as:null,async:ze,autoCapitalize:null,autoComplete:pt,autoFocus:ze,autoPlay:ze,blocking:pt,capture:null,charSet:null,checked:ze,cite:null,className:pt,cols:J,colSpan:null,content:null,contentEditable:zt,controls:ze,controlsList:pt,coords:J|Ja,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ze,defer:ze,dir:null,dirName:null,disabled:ze,download:Nx,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ze,formTarget:null,headers:pt,height:J,hidden:Nx,high:J,href:null,hrefLang:null,htmlFor:pt,httpEquiv:pt,id:null,imageSizes:null,imageSrcSet:null,inert:ze,inputMode:null,integrity:null,is:null,isMap:ze,itemId:null,itemProp:pt,itemRef:pt,itemScope:ze,itemType:pt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ze,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:ze,muted:ze,name:null,nonce:null,noModule:ze,noValidate:ze,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ze,optimum:J,pattern:null,ping:pt,placeholder:null,playsInline:ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ze,referrerPolicy:null,rel:pt,required:ze,reversed:ze,rows:J,rowSpan:J,sandbox:pt,scope:null,scoped:ze,seamless:ze,selected:ze,shadowRootClonable:ze,shadowRootDelegatesFocus:ze,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:ze,useMap:null,value:zt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:pt,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ze,declare:ze,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:ze,noHref:ze,noShade:ze,noWrap:ze,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ze,disableRemotePlayback:ze,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:aR}),eX=Wl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:sr,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:pt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ja,g2:Ja,glyphName:Ja,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:sr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:pt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sr,rev:sr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sr,requiredFeatures:sr,requiredFonts:sr,requiredFormats:sr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:sr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sr,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:oR}),lR=Wl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),cR=Wl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:aR}),uR=Wl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),tX={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},nX=/[A-Z]/g,_C=/-[a-z]/g,rX=/^data[-\w.:]+$/i;function iX(e,t){const n=Ix(t);let r=t,i=tr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&rX.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(_C,oX);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!_C.test(s)){let o=s.replace(nX,sX);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=V_}return new i(r,t)}function sX(e){return"-"+e.toLowerCase()}function oX(e){return e.charAt(1).toUpperCase()}const aX=iR([sR,JY,lR,cR,uR],"html"),K_=iR([sR,eX,lR,cR,uR],"svg");function lX(e){return e.join(" ").trim()}var G_={},bC=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,cX=/\n/g,uX=/^\s*/,dX=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,hX=/^:\s*/,fX=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,pX=/^[;\s]*/,mX=/^\s+|\s+$/g,gX=`
|
|
542
542
|
`,wC="/",SC="*",bo="",vX="comment",xX="declaration";function yX(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(m){var v=m.match(cX);v&&(n+=v.length);var w=m.lastIndexOf(gX);r=~w?m.length-w:r+m.length}function s(){var m={line:n,column:r};return function(v){return v.position=new o(m),c(),v}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(m){var v=new Error(t.source+":"+n+":"+r+": "+m);if(v.reason=m,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function l(m){var v=m.exec(e);if(v){var w=v[0];return i(w),e=e.slice(w.length),v}}function c(){l(uX)}function u(m){var v;for(m=m||[];v=d();)v!==!1&&m.push(v);return m}function d(){var m=s();if(!(wC!=e.charAt(0)||SC!=e.charAt(1))){for(var v=2;bo!=e.charAt(v)&&(SC!=e.charAt(v)||wC!=e.charAt(v+1));)++v;if(v+=2,bo===e.charAt(v-1))return a("End of comment missing");var w=e.slice(2,v-2);return r+=2,i(w),e=e.slice(v),r+=2,m({type:vX,comment:w})}}function f(){var m=s(),v=l(dX);if(v){if(d(),!l(hX))return a("property missing ':'");var w=l(fX),x=m({type:xX,property:kC(v[0].replace(bC,bo)),value:w?kC(w[0].replace(bC,bo)):bo});return l(pX),x}}function p(){var m=[];u(m);for(var v;v=f();)v!==!1&&(m.push(v),u(m));return m}return c(),p()}function kC(e){return e?e.replace(mX,bo):bo}var _X=yX,bX=Zh&&Zh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(G_,"__esModule",{value:!0});G_.default=SX;const wX=bX(_X);function SX(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,wX.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var bm={};Object.defineProperty(bm,"__esModule",{value:!0});bm.camelCase=void 0;var kX=/^--[a-zA-Z0-9_-]+$/,CX=/-([a-z])/g,EX=/^[^-]+$/,IX=/^-(webkit|moz|ms|o|khtml)-/,NX=/^-(ms)-/,TX=function(e){return!e||EX.test(e)||kX.test(e)},PX=function(e,t){return t.toUpperCase()},CC=function(e,t){return"".concat(t,"-")},RX=function(e,t){return t===void 0&&(t={}),TX(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(NX,CC):e=e.replace(IX,CC),e.replace(CX,PX))};bm.camelCase=RX;var MX=Zh&&Zh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},AX=MX(G_),jX=bm;function Px(e,t){var n={};return!e||typeof e!="string"||(0,AX.default)(e,function(r,i){r&&i&&(n[(0,jX.camelCase)(r,t)]=i)}),n}Px.default=Px;var LX=Px;const DX=Bu(LX),dR=hR("end"),Y_=hR("start");function hR(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function OX(e){const t=Y_(e),n=dR(e);if(t&&n)return{start:t,end:n}}function Vc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?EC(e.position):"start"in e||"end"in e?EC(e):"line"in e||"column"in e?Rx(e):""}function Rx(e){return IC(e&&e.line)+":"+IC(e&&e.column)}function EC(e){return Rx(e&&e.start)+"-"+Rx(e&&e.end)}function IC(e){return e&&typeof e=="number"?e:1}class Mn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Vc(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Mn.prototype.file="";Mn.prototype.name="";Mn.prototype.reason="";Mn.prototype.message="";Mn.prototype.stack="";Mn.prototype.column=void 0;Mn.prototype.line=void 0;Mn.prototype.ancestors=void 0;Mn.prototype.cause=void 0;Mn.prototype.fatal=void 0;Mn.prototype.place=void 0;Mn.prototype.ruleId=void 0;Mn.prototype.source=void 0;const X_={}.hasOwnProperty,BX=new Map,$X=/[A-Z]/g,zX=new Set(["table","tbody","thead","tfoot","tr"]),FX=new Set(["td","th"]),fR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function HX(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=XX(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=YX(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?K_:aX,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=pR(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function pR(e,t,n){if(t.type==="element")return UX(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return WX(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return VX(e,t,n);if(t.type==="mdxjsEsm")return qX(e,t);if(t.type==="root")return KX(e,t,n);if(t.type==="text")return GX(e,t)}function UX(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=K_,e.schema=i),e.ancestors.push(t);const s=gR(e,t.tagName,!1),o=ZX(e,t);let a=Q_(e,t);return zX.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!ZY(l):!0})),mR(e,o,s,t),Z_(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function WX(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ru(e,t.position)}function qX(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ru(e,t.position)}function VX(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=K_,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:gR(e,t.name,!0),o=QX(e,t),a=Q_(e,t);return mR(e,o,s,t),Z_(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function KX(e,t,n){const r={};return Z_(r,Q_(e,t)),e.create(t,e.Fragment,r,n)}function GX(e,t){return t.value}function mR(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Z_(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function YX(e,t,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:t;return a?c(s,o,a):c(s,o)}}function XX(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=Y_(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function ZX(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&X_.call(t.properties,i)){const s=JX(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&FX.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function QX(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ru(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else Ru(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Q_(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:BX;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=pR(e,s,o);a!==void 0&&n.push(a)}return n}function JX(e,t,n){const r=iX(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?VY(n):lX(n)),r.property==="style"){let i=typeof n=="object"?n:eZ(e,String(n));return e.stylePropertyNameCase==="css"&&(i=tZ(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?tX[r.property]||r.property:r.attribute,n]}}function eZ(e,t){try{return DX(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new Mn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=fR+"#cannot-parse-style-attribute",i}}function gR(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=vC(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=vC(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return X_.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ru(e)}function Ru(e,t){const n=new Mn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=fR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function tZ(e){const t={};let n;for(n in e)X_.call(e,n)&&(t[nZ(n)]=e[n]);return t}function nZ(e){let t=e.replace($X,rZ);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function rZ(e){return"-"+e.toLowerCase()}const Hg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},iZ={};function J_(e,t){const n=iZ,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return vR(e,r,i)}function vR(e,t,n){if(sZ(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return NC(e.children,t,n)}return Array.isArray(e)?NC(e,t,n):""}function NC(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=vR(e[i],t,n);return r.join("")}function sZ(e){return!!(e&&typeof e=="object")}const TC=document.createElement("i");function eb(e){const t="&"+e+";";TC.innerHTML=t;const n=TC.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yn(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function gn(e,t){return e.length>0?(yn(e,e.length,0,t),e):t}const PC={}.hasOwnProperty;function xR(e){const t={};let n=-1;for(;++n<e.length;)oZ(t,e[n]);return t}function oZ(e,t){let n;for(n in t){const i=(PC.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){PC.call(i,o)||(i[o]=[]);const a=s[o];aZ(i[o],Array.isArray(a)?a:a?[a]:[])}}}function aZ(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);yn(e,0,0,r)}function yR(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Gr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ln=so(/[A-Za-z]/),In=so(/[\dA-Za-z]/),lZ=so(/[#-'*+\--9=?A-Z^-~]/);function Jf(e){return e!==null&&(e<32||e===127)}const Mx=so(/\d/),cZ=so(/[\dA-Fa-f]/),uZ=so(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function ht(e){return e!==null&&(e<0||e===32)}function Ye(e){return e===-2||e===-1||e===32}const wm=so(new RegExp("\\p{P}|\\p{S}","u")),qo=so(/\s/);function so(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ql(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&In(e.charCodeAt(n+1))&&In(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function et(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ye(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ye(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const dZ={tokenize:hZ};function hZ(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),et(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return Ce(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const fZ={tokenize:pZ},RC={tokenize:mZ};function pZ(e){const t=this,n=[];let r=0,i,s,o;return a;function a(b){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,c)(b)}return c(b)}function l(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&_();const S=t.events.length;let C=S,k;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){k=t.events[C][1].end;break}x(r);let T=S;for(;T<t.events.length;)t.events[T][1].end={...k},T++;return yn(t.events,C+1,0,t.events.slice(S)),t.events.length=T,c(b)}return a(b)}function c(b){if(r===n.length){if(!i)return f(b);if(i.currentConstruct&&i.currentConstruct.concrete)return m(b);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(RC,u,d)(b)}function u(b){return i&&_(),x(r),f(b)}function d(b){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(b)}function f(b){return t.containerState={},e.attempt(RC,p,m)(b)}function p(b){return r++,n.push([t.currentConstruct,t.containerState]),f(b)}function m(b){if(b===null){i&&_(),x(0),e.consume(b);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),v(b)}function v(b){if(b===null){w(e.exit("chunkFlow"),!0),x(0),e.consume(b);return}return Ce(b)?(e.consume(b),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(b),v)}function w(b,S){const C=t.sliceStream(b);if(S&&C.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(C),t.parser.lazy[b.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const T=t.events.length;let E=T,D,N;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){if(D){N=t.events[E][1].end;break}D=!0}for(x(r),k=T;k<t.events.length;)t.events[k][1].end={...N},k++;yn(t.events,E+1,0,t.events.slice(T)),t.events.length=k}}function x(b){let S=n.length;for(;S-- >b;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=b}function _(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function mZ(e,t,n){return et(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function xl(e){if(e===null||ht(e)||qo(e))return 1;if(wm(e))return 2}function Vl(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Ax={name:"attention",resolveAll:gZ,tokenize:vZ};function gZ(e,t){let n=-1,r,i,s,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};MC(d,-l),MC(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=gn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=gn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=gn(c,Vl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=gn(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=gn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,yn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function vZ(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=xl(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const c=e.exit("attentionSequence"),u=xl(l),d=!u||u===2&&i||n.includes(l),f=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?d:d&&(i||!f)),c._close=!!(s===42?f:f&&(u||!d)),t(l)}}function MC(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const xZ={name:"autolink",tokenize:yZ};function yZ(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return Ln(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||In(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||In(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Jf(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):lZ(p)?(e.consume(p),c):n(p)}function u(p){return In(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||In(p))&&r++<63){const m=p===45?f:d;return e.consume(p),m}return n(p)}}const id={partial:!0,tokenize:_Z};function _Z(e,t,n){return r;function r(s){return Ye(s)?et(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ce(s)?t(s):n(s)}}const _R={continuation:{tokenize:wZ},exit:SZ,name:"blockQuote",tokenize:bZ};function bZ(e,t,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Ye(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function wZ(e,t,n){const r=this;return i;function i(o){return Ye(o)?et(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(_R,t,n)(o)}}function SZ(e){e.exit("blockQuote")}const bR={name:"characterEscape",tokenize:kZ};function kZ(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return uZ(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const wR={name:"characterReference",tokenize:CZ};function CZ(e,t,n){const r=this;let i=0,s,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=In,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=cZ,u):(e.enter("characterReferenceValue"),s=7,o=Mx,u(d))}function u(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return o===In&&!eb(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&i++<s?(e.consume(d),u):n(d)}}const AC={partial:!0,tokenize:IZ},jC={concrete:!0,name:"codeFenced",tokenize:EZ};function EZ(e,t,n){const r=this,i={partial:!0,tokenize:C};let s=0,o=0,a;return l;function l(k){return c(k)}function c(k){const T=r.events[r.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===a?(o++,e.consume(k),u):o<3?n(k):(e.exit("codeFencedFenceSequence"),Ye(k)?et(e,d,"whitespace")(k):d(k))}function d(k){return k===null||Ce(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(AC,v,S)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||Ce(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):Ye(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),et(e,p,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),f)}function p(k){return k===null||Ce(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||Ce(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===a?n(k):(e.consume(k),m)}function v(k){return e.attempt(i,S,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),x}function x(k){return s>0&&Ye(k)?et(e,_,"linePrefix",s+1)(k):_(k)}function _(k){return k===null||Ce(k)?e.check(AC,v,S)(k):(e.enter("codeFlowValue"),b(k))}function b(k){return k===null||Ce(k)?(e.exit("codeFlowValue"),_(k)):(e.consume(k),b)}function S(k){return e.exit("codeFenced"),t(k)}function C(k,T,E){let D=0;return N;function N(j){return k.enter("lineEnding"),k.consume(j),k.exit("lineEnding"),L}function L(j){return k.enter("codeFencedFence"),Ye(j)?et(k,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):R(j)}function R(j){return j===a?(k.enter("codeFencedFenceSequence"),M(j)):E(j)}function M(j){return j===a?(D++,k.consume(j),M):D>=o?(k.exit("codeFencedFenceSequence"),Ye(j)?et(k,A,"whitespace")(j):A(j)):E(j)}function A(j){return j===null||Ce(j)?(k.exit("codeFencedFence"),T(j)):E(j)}}}function IZ(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Ug={name:"codeIndented",tokenize:TZ},NZ={partial:!0,tokenize:PZ};function TZ(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),et(e,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):Ce(c)?e.attempt(NZ,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||Ce(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function PZ(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):et(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):Ce(o)?i(o):n(o)}}const RZ={name:"codeText",previous:AZ,resolve:MZ,tokenize:jZ};function MZ(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function AZ(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function jZ(e,t,n){let r=0,i,s;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(s=e.enter("codeTextSequence"),i=0,u(d)):Ce(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Ce(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",c(d))}}class LZ{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&uc(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),uc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),uc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);uc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);uc(this.left,n.reverse())}}}function uc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function SR(e){const t={};let n=-1,r,i,s,o,a,l,c;const u=new LZ(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,DZ(u,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return yn(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function DZ(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,f=-1,p=n,m=0,v=0;const w=[v];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(v=f+1,w.push(v),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):w.pop(),f=w.length;f--;){const x=a.slice(w[f],w[f+1]),_=s.pop();l.push([_,_+x.length-1]),e.splice(_,2,x)}for(l.reverse(),f=-1;++f<l.length;)c[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return c}const OZ={resolve:$Z,tokenize:zZ},BZ={partial:!0,tokenize:FZ};function $Z(e){return SR(e),e}function zZ(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):Ce(a)?e.check(BZ,o,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function FZ(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),et(e,s,"linePrefix")}function s(o){if(o===null||Ce(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function kR(e,t,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return x===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(x),e.exit(s),f):x===null||x===32||x===41||Jf(x)?n(x):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(x))}function f(x){return x===62?(e.enter(s),e.consume(x),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(a),f(x)):x===null||x===60||Ce(x)?n(x):(e.consume(x),x===92?m:p)}function m(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function v(x){return!u&&(x===null||x===41||ht(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(x)):u<c&&x===40?(e.consume(x),u++,v):x===41?(e.consume(x),u--,v):x===null||x===32||x===40||Jf(x)?n(x):(e.consume(x),x===92?w:v)}function w(x){return x===40||x===41||x===92?(e.consume(x),v):v(x)}}function CR(e,t,n,r,i,s){const o=this;let a=0,l;return c;function c(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(s),u}function u(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Ce(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||Ce(p)||a++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!Ye(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function ER(e,t,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),l(o)):f===null?n(f):Ce(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),et(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||Ce(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(e.consume(f),u):u(f)}}function Kc(e,t){let n;return r;function r(i){return Ce(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ye(i)?et(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const HZ={name:"definition",tokenize:WZ},UZ={partial:!0,tokenize:qZ};function WZ(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return CR.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Gr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ht(p)?Kc(e,c)(p):c(p)}function c(p){return kR(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(UZ,d,d)(p)}function d(p){return Ye(p)?et(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Ce(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function qZ(e,t,n){return r;function r(a){return ht(a)?Kc(e,i)(a):n(a)}function i(a){return ER(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ye(a)?et(e,o,"whitespace")(a):o(a)}function o(a){return a===null||Ce(a)?t(a):n(a)}}const VZ={name:"hardBreakEscape",tokenize:KZ};function KZ(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ce(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const GZ={name:"headingAtx",resolve:YZ,tokenize:XZ};function YZ(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},yn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function XZ(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),s(u)}function s(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||ht(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||Ce(u)?(e.exit("atxHeading"),t(u)):Ye(u)?et(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||ht(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const ZZ=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],LC=["pre","script","style","textarea"],QZ={concrete:!0,name:"htmlFlow",resolveTo:tQ,tokenize:nQ},JZ={partial:!0,tokenize:iQ},eQ={partial:!0,tokenize:rQ};function tQ(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function nQ(e,t,n){const r=this;let i,s,o,a,l;return c;function c(O){return u(O)}function u(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),d}function d(O){return O===33?(e.consume(O),f):O===47?(e.consume(O),s=!0,v):O===63?(e.consume(O),i=3,r.interrupt?t:I):Ln(O)?(e.consume(O),o=String.fromCharCode(O),w):n(O)}function f(O){return O===45?(e.consume(O),i=2,p):O===91?(e.consume(O),i=5,a=0,m):Ln(O)?(e.consume(O),i=4,r.interrupt?t:I):n(O)}function p(O){return O===45?(e.consume(O),r.interrupt?t:I):n(O)}function m(O){const te="CDATA[";return O===te.charCodeAt(a++)?(e.consume(O),a===te.length?r.interrupt?t:R:m):n(O)}function v(O){return Ln(O)?(e.consume(O),o=String.fromCharCode(O),w):n(O)}function w(O){if(O===null||O===47||O===62||ht(O)){const te=O===47,le=o.toLowerCase();return!te&&!s&&LC.includes(le)?(i=1,r.interrupt?t(O):R(O)):ZZ.includes(o.toLowerCase())?(i=6,te?(e.consume(O),x):r.interrupt?t(O):R(O)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):s?_(O):b(O))}return O===45||In(O)?(e.consume(O),o+=String.fromCharCode(O),w):n(O)}function x(O){return O===62?(e.consume(O),r.interrupt?t:R):n(O)}function _(O){return Ye(O)?(e.consume(O),_):N(O)}function b(O){return O===47?(e.consume(O),N):O===58||O===95||Ln(O)?(e.consume(O),S):Ye(O)?(e.consume(O),b):N(O)}function S(O){return O===45||O===46||O===58||O===95||In(O)?(e.consume(O),S):C(O)}function C(O){return O===61?(e.consume(O),k):Ye(O)?(e.consume(O),C):b(O)}function k(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),l=O,T):Ye(O)?(e.consume(O),k):E(O)}function T(O){return O===l?(e.consume(O),l=null,D):O===null||Ce(O)?n(O):(e.consume(O),T)}function E(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||ht(O)?C(O):(e.consume(O),E)}function D(O){return O===47||O===62||Ye(O)?b(O):n(O)}function N(O){return O===62?(e.consume(O),L):n(O)}function L(O){return O===null||Ce(O)?R(O):Ye(O)?(e.consume(O),L):n(O)}function R(O){return O===45&&i===2?(e.consume(O),z):O===60&&i===1?(e.consume(O),F):O===62&&i===4?(e.consume(O),U):O===63&&i===3?(e.consume(O),I):O===93&&i===5?(e.consume(O),B):Ce(O)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(JZ,q,M)(O)):O===null||Ce(O)?(e.exit("htmlFlowData"),M(O)):(e.consume(O),R)}function M(O){return e.check(eQ,A,q)(O)}function A(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),j}function j(O){return O===null||Ce(O)?M(O):(e.enter("htmlFlowData"),R(O))}function z(O){return O===45?(e.consume(O),I):R(O)}function F(O){return O===47?(e.consume(O),o="",$):R(O)}function $(O){if(O===62){const te=o.toLowerCase();return LC.includes(te)?(e.consume(O),U):R(O)}return Ln(O)&&o.length<8?(e.consume(O),o+=String.fromCharCode(O),$):R(O)}function B(O){return O===93?(e.consume(O),I):R(O)}function I(O){return O===62?(e.consume(O),U):O===45&&i===2?(e.consume(O),I):R(O)}function U(O){return O===null||Ce(O)?(e.exit("htmlFlowData"),q(O)):(e.consume(O),U)}function q(O){return e.exit("htmlFlow"),t(O)}}function rQ(e,t,n){const r=this;return i;function i(o){return Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function iQ(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(id,t,n)}}const sQ={name:"htmlText",tokenize:oQ};function oQ(e,t,n){const r=this;let i,s,o;return a;function a(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),l}function l(I){return I===33?(e.consume(I),c):I===47?(e.consume(I),C):I===63?(e.consume(I),b):Ln(I)?(e.consume(I),E):n(I)}function c(I){return I===45?(e.consume(I),u):I===91?(e.consume(I),s=0,m):Ln(I)?(e.consume(I),_):n(I)}function u(I){return I===45?(e.consume(I),p):n(I)}function d(I){return I===null?n(I):I===45?(e.consume(I),f):Ce(I)?(o=d,F(I)):(e.consume(I),d)}function f(I){return I===45?(e.consume(I),p):d(I)}function p(I){return I===62?z(I):I===45?f(I):d(I)}function m(I){const U="CDATA[";return I===U.charCodeAt(s++)?(e.consume(I),s===U.length?v:m):n(I)}function v(I){return I===null?n(I):I===93?(e.consume(I),w):Ce(I)?(o=v,F(I)):(e.consume(I),v)}function w(I){return I===93?(e.consume(I),x):v(I)}function x(I){return I===62?z(I):I===93?(e.consume(I),x):v(I)}function _(I){return I===null||I===62?z(I):Ce(I)?(o=_,F(I)):(e.consume(I),_)}function b(I){return I===null?n(I):I===63?(e.consume(I),S):Ce(I)?(o=b,F(I)):(e.consume(I),b)}function S(I){return I===62?z(I):b(I)}function C(I){return Ln(I)?(e.consume(I),k):n(I)}function k(I){return I===45||In(I)?(e.consume(I),k):T(I)}function T(I){return Ce(I)?(o=T,F(I)):Ye(I)?(e.consume(I),T):z(I)}function E(I){return I===45||In(I)?(e.consume(I),E):I===47||I===62||ht(I)?D(I):n(I)}function D(I){return I===47?(e.consume(I),z):I===58||I===95||Ln(I)?(e.consume(I),N):Ce(I)?(o=D,F(I)):Ye(I)?(e.consume(I),D):z(I)}function N(I){return I===45||I===46||I===58||I===95||In(I)?(e.consume(I),N):L(I)}function L(I){return I===61?(e.consume(I),R):Ce(I)?(o=L,F(I)):Ye(I)?(e.consume(I),L):D(I)}function R(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),i=I,M):Ce(I)?(o=R,F(I)):Ye(I)?(e.consume(I),R):(e.consume(I),A)}function M(I){return I===i?(e.consume(I),i=void 0,j):I===null?n(I):Ce(I)?(o=M,F(I)):(e.consume(I),M)}function A(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||ht(I)?D(I):(e.consume(I),A)}function j(I){return I===47||I===62||ht(I)?D(I):n(I)}function z(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function F(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),$}function $(I){return Ye(I)?et(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):B(I)}function B(I){return e.enter("htmlTextData"),o(I)}}const tb={name:"labelEnd",resolveAll:uQ,resolveTo:dQ,tokenize:hQ},aQ={tokenize:fQ},lQ={tokenize:pQ},cQ={tokenize:mQ};function uQ(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&yn(e,0,e.length,n),e}function dQ(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=gn(a,e.slice(s+1,s+r+3)),a=gn(a,[["enter",u,t]]),a=gn(a,Vl(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=gn(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=gn(a,e.slice(o+1)),a=gn(a,[["exit",l,t]]),yn(e,s,e.length,a),e}function hQ(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(f){return s?s._inactive?d(f):(o=r.parser.defined.includes(Gr(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(aQ,u,o?u:d)(f):f===91?e.attempt(lQ,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(cQ,u,d)(f)}function u(f){return t(f)}function d(f){return s._balanced=!0,n(f)}}function fQ(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return ht(d)?Kc(e,s)(d):s(d)}function s(d){return d===41?u(d):kR(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ht(d)?Kc(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?ER(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ht(d)?Kc(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function pQ(e,t,n){const r=this;return i;function i(a){return CR.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Gr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function mQ(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const gQ={name:"labelStartImage",resolveAll:tb.resolveAll,tokenize:vQ};function vQ(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const xQ={name:"labelStartLink",resolveAll:tb.resolveAll,tokenize:yQ};function yQ(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Wg={name:"lineEnding",tokenize:_Q};function _Q(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),et(e,t,"linePrefix")}}const Hh={name:"thematicBreak",tokenize:bQ};function bQ(e,t,n){let r=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Ce(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ye(c)?et(e,a,"whitespace")(c):a(c))}}const Kn={continuation:{tokenize:CQ},exit:IQ,name:"list",tokenize:kQ},wQ={partial:!0,tokenize:NQ},SQ={partial:!0,tokenize:EQ};function kQ(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Mx(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Hh,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Mx(p)&&++o<10?(e.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(id,r.interrupt?n:u,e.attempt(wQ,f,d))}function u(p){return r.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return Ye(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function CQ(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(id,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,et(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Ye(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(SQ,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,et(e,e.attempt(Kn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function EQ(e,t,n){const r=this;return et(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function IQ(e){e.exit(this.containerState.type)}function NQ(e,t,n){const r=this;return et(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ye(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const DC={name:"setextUnderline",resolveTo:TQ,tokenize:PQ};function TQ(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function PQ(e,t,n){const r=this;let i;return s;function s(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Ye(c)?et(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Ce(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const RQ={tokenize:MQ};function MQ(e){const t=this,n=e.attempt(id,r,e.attempt(this.parser.constructs.flowInitial,i,et(e,e.attempt(this.parser.constructs.flow,i,e.attempt(OZ,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const AQ={resolveAll:NR()},jQ=IR("string"),LQ=IR("text");function IR(e){return{resolveAll:NR(e==="text"?DQ:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function NR(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function DQ(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const OQ={42:Kn,43:Kn,45:Kn,48:Kn,49:Kn,50:Kn,51:Kn,52:Kn,53:Kn,54:Kn,55:Kn,56:Kn,57:Kn,62:_R},BQ={91:HZ},$Q={[-2]:Ug,[-1]:Ug,32:Ug},zQ={35:GZ,42:Hh,45:[DC,Hh],60:QZ,61:DC,95:Hh,96:jC,126:jC},FQ={38:wR,92:bR},HQ={[-5]:Wg,[-4]:Wg,[-3]:Wg,33:gQ,38:wR,42:Ax,60:[xZ,sQ],91:xQ,92:[VZ,bR],93:tb,95:Ax,96:RZ},UQ={null:[Ax,AQ]},WQ={null:[42,95]},qQ={null:[]},VQ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:WQ,contentInitial:BQ,disable:qQ,document:OQ,flow:zQ,flowInitial:$Q,insideSpan:UQ,string:FQ,text:HQ},Symbol.toStringTag,{value:"Module"}));function KQ(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:T(C),check:T(k),consume:_,enter:b,exit:S,interrupt:T(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:v,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function d(L){return o=gn(o,L),w(),o[o.length-1]!==null?[]:(E(t,0),c.events=Vl(s,c.events,c),c.events)}function f(L,R){return YQ(p(L),R)}function p(L){return GQ(o,L)}function m(){const{_bufferIndex:L,_index:R,line:M,column:A,offset:j}=r;return{_bufferIndex:L,_index:R,line:M,column:A,offset:j}}function v(L){i[L.line]=L.column,N()}function w(){let L;for(;r._index<o.length;){const R=o[r._index];if(typeof R=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<R.length;)x(R.charCodeAt(r._bufferIndex));else x(R)}}function x(L){u=u(L)}function _(L){Ce(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,N()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=L}function b(L,R){const M=R||{};return M.type=L,M.start=m(),c.events.push(["enter",M,c]),a.push(M),M}function S(L){const R=a.pop();return R.end=m(),c.events.push(["exit",R,c]),R}function C(L,R){E(L,R.from)}function k(L,R){R.restore()}function T(L,R){return M;function M(A,j,z){let F,$,B,I;return Array.isArray(A)?q(A):"tokenize"in A?q([A]):U(A);function U(Y){return re;function re(ke){const oe=ke!==null&&Y[ke],Ie=ke!==null&&Y.null,Ee=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return q(Ee)(ke)}}function q(Y){return F=Y,$=0,Y.length===0?z:O(Y[$])}function O(Y){return re;function re(ke){return I=D(),B=Y,Y.partial||(c.currentConstruct=Y),Y.name&&c.parser.constructs.disable.null.includes(Y.name)?le():Y.tokenize.call(R?Object.assign(Object.create(c),R):c,l,te,le)(ke)}}function te(Y){return L(B,I),j}function le(Y){return I.restore(),++$<F.length?O(F[$]):z}}}function E(L,R){L.resolveAll&&!s.includes(L)&&s.push(L),L.resolve&&yn(c.events,R,c.events.length-R,L.resolve(c.events.slice(R),c)),L.resolveTo&&(c.events=L.resolveTo(c.events,c))}function D(){const L=m(),R=c.previous,M=c.currentConstruct,A=c.events.length,j=Array.from(a);return{from:A,restore:z};function z(){r=L,c.previous=R,c.currentConstruct=M,c.events.length=A,a=j,N()}}function N(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function GQ(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function YQ(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
543
543
|
`;break}case-3:{o=`\r
|
|
544
|
-
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function XQ(e){const r={constructs:xR([VQ,...(e||{}).extensions||[]]),content:i(dZ),defined:[],document:i(fZ),flow:i(RQ),lazy:{},string:i(jQ),text:i(LQ)};return r;function i(s){return o;function o(a){return KQ(r,s,a)}}}function ZQ(e){for(;!SR(e););return e}const OC=/[\0\t\n\r]/g;function QQ(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,d,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(OC.lastIndex=d,c=OC.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(d);break}if(p===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(s.slice(d,f)),e+=f-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const JQ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function eJ(e){return e.replace(JQ,tJ)}function tJ(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return yR(n.slice(s?2:1),s?16:10)}return eb(n)||e}const TR={}.hasOwnProperty;function nJ(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),rJ(n)(ZQ(XQ(n).document().write(QQ()(e,t,!0))))}function rJ(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(fe),autolinkProtocol:D,autolinkEmail:D,atxHeading:s(Qe),blockQuote:s(Ie),characterEscape:D,characterReference:D,codeFenced:s(Ee),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Ee,o),codeText:s(Re,o),codeTextData:D,data:D,codeFlowValue:D,definition:s(he),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Be),hardBreakEscape:s(Ge),hardBreakTrailing:s(Ge),htmlFlow:s(ft,o),htmlFlowData:D,htmlText:s(ft,o),htmlTextData:D,image:s(Kt),label:o,link:s(fe),listItem:s(Pe),listItemValue:f,listOrdered:s(He,d),listUnordered:s(He),paragraph:s(Me),reference:O,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Qe),strong:s(rt),thematicBreak:s(hn)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:oe,autolinkProtocol:ke,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:Y,characterReference:re,codeFenced:l(w),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:N,codeIndented:l(x),codeText:l(j),codeTextData:N,data:N,definition:l(),definitionDestinationString:S,definitionLabelString:_,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(M),htmlFlowData:N,htmlText:l(A),htmlTextData:N,image:l(F),label:B,labelText:$,lineEnding:L,link:l(z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:te,resourceDestinationString:I,resourceTitleString:U,resource:q,setextHeading:l(E),setextHeadingLineSequence:T,setextHeadingText:k,strong:l(),thematicBreak:l()}};PR(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let ee={type:"root",children:[]};const be={stack:[ee],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},Oe=[];let Ue=-1;for(;++Ue<W.length;)if(W[Ue][1].type==="listOrdered"||W[Ue][1].type==="listUnordered")if(W[Ue][0]==="enter")Oe.push(Ue);else{const At=Oe.pop();Ue=i(W,At,Ue)}for(Ue=-1;++Ue<W.length;){const At=t[W[Ue][0]];TR.call(At,W[Ue][1].type)&&At[W[Ue][1].type].call(Object.assign({sliceSerialize:W[Ue][2].sliceSerialize},be),W[Ue][1])}if(be.tokenStack.length>0){const At=be.tokenStack[be.tokenStack.length-1];(At[1]||BC).call(be,void 0,At[0])}for(ee.position={start:vs(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:vs(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Ue=-1;++Ue<t.transforms.length;)ee=t.transforms[Ue](ee)||ee;return ee}function i(W,ee,be){let Oe=ee-1,Ue=-1,At=!1,bn,nn,fn,ce;for(;++Oe<=be;){const Se=W[Oe];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?Ue++:Ue--,ce=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(bn&&!ce&&!Ue&&!fn&&(fn=Oe),ce=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ce=void 0}if(!Ue&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||Ue===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(bn){let st=Oe;for(nn=void 0;st--;){const gt=W[st];if(gt[1].type==="lineEnding"||gt[1].type==="lineEndingBlank"){if(gt[0]==="exit")continue;nn&&(W[nn][1].type="lineEndingBlank",At=!0),gt[1].type="lineEnding",nn=st}else if(!(gt[1].type==="linePrefix"||gt[1].type==="blockQuotePrefix"||gt[1].type==="blockQuotePrefixWhitespace"||gt[1].type==="blockQuoteMarker"||gt[1].type==="listItemIndent"))break}fn&&(!nn||fn<nn)&&(bn._spread=!0),bn.end=Object.assign({},nn?W[nn][1].start:Se[1].end),W.splice(nn||Oe,0,["exit",bn,Se[2]]),Oe++,be++}if(Se[1].type==="listItemPrefix"){const st={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};bn=st,W.splice(Oe,0,["enter",st,Se[2]]),Oe++,be++,fn=void 0,ce=!0}}}return W[ee][1]._spread=At,be}function s(W,ee){return be;function be(Oe){a.call(this,W(Oe),Oe),ee&&ee.call(this,Oe)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(W,ee,be){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([ee,be||void 0]),W.position={start:vs(ee.start),end:void 0}}function l(W){return ee;function ee(be){W&&W.call(this,be),c.call(this,be)}}function c(W,ee){const be=this.stack.pop(),Oe=this.tokenStack.pop();if(Oe)Oe[0].type!==W.type&&(ee?ee.call(this,W,Oe[0]):(Oe[1]||BC).call(this,W,Oe[0]));else throw new Error("Cannot close `"+W.type+"` ("+Vc({start:W.start,end:W.end})+"): it’s not open");be.position.end=vs(W.end)}function u(){return J_(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(W){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function p(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=W}function m(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=W}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/(\r?\n|\r)$/g,"")}function _(W){const ee=this.resume(),be=this.stack[this.stack.length-1];be.label=ee,be.identifier=Gr(this.sliceSerialize(W)).toLowerCase()}function b(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function S(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function C(W){const ee=this.stack[this.stack.length-1];if(!ee.depth){const be=this.sliceSerialize(W).length;ee.depth=be}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function T(W){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function E(){this.data.setextHeadingSlurpLineEnding=void 0}function D(W){const be=this.stack[this.stack.length-1].children;let Oe=be[be.length-1];(!Oe||Oe.type!=="text")&&(Oe=tn(),Oe.position={start:vs(W.start),end:void 0},be.push(Oe)),this.stack.push(Oe)}function N(W){const ee=this.stack.pop();ee.value+=this.sliceSerialize(W),ee.position.end=vs(W.end)}function L(W){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=ee.children[ee.children.length-1];be.position.end=vs(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&(D.call(this,W),N.call(this,W))}function R(){this.data.atHardBreak=!0}function M(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function A(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function j(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function z(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function F(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function $(W){const ee=this.sliceSerialize(W),be=this.stack[this.stack.length-2];be.label=eJ(ee),be.identifier=Gr(ee).toLowerCase()}function B(){const W=this.stack[this.stack.length-1],ee=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const Oe=W.children;be.children=Oe}else be.alt=ee}function I(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function U(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function q(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function te(W){const ee=this.resume(),be=this.stack[this.stack.length-1];be.label=ee,be.identifier=Gr(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function le(W){this.data.characterReferenceType=W.type}function Y(W){const ee=this.sliceSerialize(W),be=this.data.characterReferenceType;let Oe;be?(Oe=yR(ee,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Oe=eb(ee);const Ue=this.stack[this.stack.length-1];Ue.value+=Oe}function re(W){const ee=this.stack.pop();ee.position.end=vs(W.end)}function ke(W){N.call(this,W);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(W)}function oe(W){N.call(this,W);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(W)}function Ie(){return{type:"blockquote",children:[]}}function Ee(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Be(){return{type:"emphasis",children:[]}}function Qe(){return{type:"heading",depth:0,children:[]}}function Ge(){return{type:"break"}}function ft(){return{type:"html",value:""}}function Kt(){return{type:"image",title:null,url:"",alt:null}}function fe(){return{type:"link",title:null,url:"",children:[]}}function He(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Pe(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function Me(){return{type:"paragraph",children:[]}}function rt(){return{type:"strong",children:[]}}function tn(){return{type:"text",value:""}}function hn(){return{type:"thematicBreak"}}}function vs(e){return{line:e.line,column:e.column,offset:e.offset}}function PR(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?PR(e,r):iJ(e,r)}}function iJ(e,t){let n;for(n in t)if(TR.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function BC(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Vc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Vc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Vc({start:t.start,end:t.end})+") is still open")}function sJ(e){const t=this;t.parser=n;function n(r){return nJ(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function oJ(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function aJ(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
544
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function XQ(e){const r={constructs:xR([VQ,...(e||{}).extensions||[]]),content:i(dZ),defined:[],document:i(fZ),flow:i(RQ),lazy:{},string:i(jQ),text:i(LQ)};return r;function i(s){return o;function o(a){return KQ(r,s,a)}}}function ZQ(e){for(;!SR(e););return e}const OC=/[\0\t\n\r]/g;function QQ(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,d,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(OC.lastIndex=d,c=OC.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(d);break}if(p===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(s.slice(d,f)),e+=f-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const JQ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function eJ(e){return e.replace(JQ,tJ)}function tJ(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return yR(n.slice(s?2:1),s?16:10)}return eb(n)||e}const TR={}.hasOwnProperty;function nJ(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),rJ(n)(ZQ(XQ(n).document().write(QQ()(e,t,!0))))}function rJ(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(fe),autolinkProtocol:D,autolinkEmail:D,atxHeading:s(Je),blockQuote:s(Ie),characterEscape:D,characterReference:D,codeFenced:s(Ee),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Ee,o),codeText:s(Re,o),codeTextData:D,data:D,codeFlowValue:D,definition:s(he),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Be),hardBreakEscape:s(Ge),hardBreakTrailing:s(Ge),htmlFlow:s(ft,o),htmlFlowData:D,htmlText:s(ft,o),htmlTextData:D,image:s(Kt),label:o,link:s(fe),listItem:s(Pe),listItemValue:f,listOrdered:s(He,d),listUnordered:s(He),paragraph:s(Me),reference:O,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Je),strong:s(rt),thematicBreak:s(hn)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:oe,autolinkProtocol:ke,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:Y,characterReference:re,codeFenced:l(w),codeFencedFence:v,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:N,codeIndented:l(x),codeText:l(j),codeTextData:N,data:N,definition:l(),definitionDestinationString:S,definitionLabelString:_,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(M),htmlFlowData:N,htmlText:l(A),htmlTextData:N,image:l(F),label:B,labelText:$,lineEnding:L,link:l(z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:te,resourceDestinationString:I,resourceTitleString:U,resource:q,setextHeading:l(E),setextHeadingLineSequence:T,setextHeadingText:k,strong:l(),thematicBreak:l()}};PR(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let ee={type:"root",children:[]};const be={stack:[ee],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},Oe=[];let Ue=-1;for(;++Ue<W.length;)if(W[Ue][1].type==="listOrdered"||W[Ue][1].type==="listUnordered")if(W[Ue][0]==="enter")Oe.push(Ue);else{const At=Oe.pop();Ue=i(W,At,Ue)}for(Ue=-1;++Ue<W.length;){const At=t[W[Ue][0]];TR.call(At,W[Ue][1].type)&&At[W[Ue][1].type].call(Object.assign({sliceSerialize:W[Ue][2].sliceSerialize},be),W[Ue][1])}if(be.tokenStack.length>0){const At=be.tokenStack[be.tokenStack.length-1];(At[1]||BC).call(be,void 0,At[0])}for(ee.position={start:vs(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:vs(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Ue=-1;++Ue<t.transforms.length;)ee=t.transforms[Ue](ee)||ee;return ee}function i(W,ee,be){let Oe=ee-1,Ue=-1,At=!1,bn,nn,fn,ce;for(;++Oe<=be;){const Se=W[Oe];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?Ue++:Ue--,ce=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(bn&&!ce&&!Ue&&!fn&&(fn=Oe),ce=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ce=void 0}if(!Ue&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||Ue===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(bn){let st=Oe;for(nn=void 0;st--;){const gt=W[st];if(gt[1].type==="lineEnding"||gt[1].type==="lineEndingBlank"){if(gt[0]==="exit")continue;nn&&(W[nn][1].type="lineEndingBlank",At=!0),gt[1].type="lineEnding",nn=st}else if(!(gt[1].type==="linePrefix"||gt[1].type==="blockQuotePrefix"||gt[1].type==="blockQuotePrefixWhitespace"||gt[1].type==="blockQuoteMarker"||gt[1].type==="listItemIndent"))break}fn&&(!nn||fn<nn)&&(bn._spread=!0),bn.end=Object.assign({},nn?W[nn][1].start:Se[1].end),W.splice(nn||Oe,0,["exit",bn,Se[2]]),Oe++,be++}if(Se[1].type==="listItemPrefix"){const st={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};bn=st,W.splice(Oe,0,["enter",st,Se[2]]),Oe++,be++,fn=void 0,ce=!0}}}return W[ee][1]._spread=At,be}function s(W,ee){return be;function be(Oe){a.call(this,W(Oe),Oe),ee&&ee.call(this,Oe)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(W,ee,be){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([ee,be||void 0]),W.position={start:vs(ee.start),end:void 0}}function l(W){return ee;function ee(be){W&&W.call(this,be),c.call(this,be)}}function c(W,ee){const be=this.stack.pop(),Oe=this.tokenStack.pop();if(Oe)Oe[0].type!==W.type&&(ee?ee.call(this,W,Oe[0]):(Oe[1]||BC).call(this,W,Oe[0]));else throw new Error("Cannot close `"+W.type+"` ("+Vc({start:W.start,end:W.end})+"): it’s not open");be.position.end=vs(W.end)}function u(){return J_(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(W){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function p(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=W}function m(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=W}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/(\r?\n|\r)$/g,"")}function _(W){const ee=this.resume(),be=this.stack[this.stack.length-1];be.label=ee,be.identifier=Gr(this.sliceSerialize(W)).toLowerCase()}function b(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function S(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function C(W){const ee=this.stack[this.stack.length-1];if(!ee.depth){const be=this.sliceSerialize(W).length;ee.depth=be}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function T(W){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function E(){this.data.setextHeadingSlurpLineEnding=void 0}function D(W){const be=this.stack[this.stack.length-1].children;let Oe=be[be.length-1];(!Oe||Oe.type!=="text")&&(Oe=tn(),Oe.position={start:vs(W.start),end:void 0},be.push(Oe)),this.stack.push(Oe)}function N(W){const ee=this.stack.pop();ee.value+=this.sliceSerialize(W),ee.position.end=vs(W.end)}function L(W){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=ee.children[ee.children.length-1];be.position.end=vs(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&(D.call(this,W),N.call(this,W))}function R(){this.data.atHardBreak=!0}function M(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function A(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function j(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function z(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function F(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function $(W){const ee=this.sliceSerialize(W),be=this.stack[this.stack.length-2];be.label=eJ(ee),be.identifier=Gr(ee).toLowerCase()}function B(){const W=this.stack[this.stack.length-1],ee=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const Oe=W.children;be.children=Oe}else be.alt=ee}function I(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function U(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function q(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function te(W){const ee=this.resume(),be=this.stack[this.stack.length-1];be.label=ee,be.identifier=Gr(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function le(W){this.data.characterReferenceType=W.type}function Y(W){const ee=this.sliceSerialize(W),be=this.data.characterReferenceType;let Oe;be?(Oe=yR(ee,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Oe=eb(ee);const Ue=this.stack[this.stack.length-1];Ue.value+=Oe}function re(W){const ee=this.stack.pop();ee.position.end=vs(W.end)}function ke(W){N.call(this,W);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(W)}function oe(W){N.call(this,W);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(W)}function Ie(){return{type:"blockquote",children:[]}}function Ee(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function he(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Be(){return{type:"emphasis",children:[]}}function Je(){return{type:"heading",depth:0,children:[]}}function Ge(){return{type:"break"}}function ft(){return{type:"html",value:""}}function Kt(){return{type:"image",title:null,url:"",alt:null}}function fe(){return{type:"link",title:null,url:"",children:[]}}function He(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Pe(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function Me(){return{type:"paragraph",children:[]}}function rt(){return{type:"strong",children:[]}}function tn(){return{type:"text",value:""}}function hn(){return{type:"thematicBreak"}}}function vs(e){return{line:e.line,column:e.column,offset:e.offset}}function PR(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?PR(e,r):iJ(e,r)}}function iJ(e,t){let n;for(n in t)if(TR.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function BC(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Vc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Vc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Vc({start:t.start,end:t.end})+") is still open")}function sJ(e){const t=this;t.parser=n;function n(r){return nJ(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function oJ(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function aJ(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
545
545
|
`}]}function lJ(e,t){const n=t.value?t.value+`
|
|
546
546
|
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function cJ(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uJ(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dJ(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=ql(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function hJ(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fJ(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function RR(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function pJ(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return RR(e,t);const i={src:ql(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function mJ(e,t){const n={src:ql(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function gJ(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function vJ(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return RR(e,t);const i={href:ql(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function xJ(e,t){const n={href:ql(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function yJ(e,t,n){const r=e.all(t),i=n?_J(n):MR(t),s={},o=[];if(typeof t.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
547
547
|
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
@@ -566,12 +566,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
566
566
|
`))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
|
|
567
567
|
`,...s.current()});return/^[\t ]/.test(c)&&(c=Mu(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}VR.peek=Ste;function VR(e){return e.value||""}function Ste(){return"<"}KR.peek=kte;function KR(e,t,n,r){const i=lb(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),o(),c}function kte(){return"!"}GR.peek=Cte;function GR(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Cte(){return"!"}YR.peek=Ete;function YR(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return i+r+i}function Ete(){return"`"}function XR(e,t){const n=J_(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}ZR.peek=Ite;function ZR(e,t,n,r){const i=lb(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(XR(e,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(e,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=u,d}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),l()),c+=o.move(")"),a(),c}function Ite(e,t,n){return XR(e,n)?"<":"["}QR.peek=Nte;function QR(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Nte(){return"["}function cb(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Tte(e){const t=cb(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Pte(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function JR(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Rte(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?Pte(n):cb(n);const a=e.ordered?o==="."?")":".":Tte(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),JR(n)===o&&u){let d=-1;for(;++d<e.children.length;){const f=e.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),c}function Mte(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Ate(e,t,n,r){const i=Mte(n);let s=n.bulletCurrent||cb(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),u);return l(),c;function u(d,f,p){return f?(p?"":" ".repeat(o))+d:(p?s:s+" ".repeat(o-s.length))+d}}function jte(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const Lte=km(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Dte(e,t,n,r){return(e.children.some(function(o){return Lte(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Ote(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}eM.peek=Bte;function eM(e,t,n,r){const i=Ote(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i);let l=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=np(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Mu(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=np(r.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+Mu(d));const p=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function Bte(e,t,n){return n.options.strong||"*"}function $te(e,t,n,r){return n.safe(e.value,r)}function zte(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Fte(e,t,n){const r=(JR(n)+(n.options.ruleSpaces?" ":"")).repeat(zte(n));return n.options.ruleSpaces?r.slice(0,-1):r}const tM={blockquote:ute,break:l2,code:gte,definition:xte,emphasis:qR,hardBreak:l2,heading:wte,html:VR,image:KR,imageReference:GR,inlineCode:YR,link:ZR,linkReference:QR,list:Rte,listItem:Ate,paragraph:jte,root:Dte,strong:eM,text:$te,thematicBreak:Fte};function Hte(){return{enter:{table:Ute,tableData:c2,tableHeader:c2,tableRow:qte},exit:{codeText:Vte,table:Wte,tableData:t0,tableHeader:t0,tableRow:t0}}}function Ute(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Wte(e){this.exit(e),this.data.inTable=void 0}function qte(e){this.enter({type:"tableRow",children:[]},e)}function t0(e){this.exit(e)}function c2(e){this.enter({type:"tableCell",children:[]},e)}function Vte(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Kte));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Kte(e,t){return t==="|"?t:e}function Gte(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
568
568
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(p,m,v,w){return c(u(p,v,w),p.align)}function a(p,m,v,w){const x=d(p,v,w),_=c([x]);return _.slice(0,_.indexOf(`
|
|
569
|
-
`))}function l(p,m,v,w){const x=v.enter("tableCell"),_=v.enter("phrasing"),b=v.containerPhrasing(p,{...w,before:s,after:s});return _(),x(),b}function c(p,m){return lte(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function u(p,m,v){const w=p.children;let x=-1;const _=[],b=m.enter("table");for(;++x<w.length;)_[x]=d(w[x],m,v);return b(),_}function d(p,m,v){const w=p.children;let x=-1;const _=[],b=m.enter("tableRow");for(;++x<w.length;)_[x]=l(w[x],p,m,v);return b(),_}function f(p,m,v){let w=tM.inlineCode(p,m,v);return v.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function Yte(){return{exit:{taskListCheckValueChecked:u2,taskListCheckValueUnchecked:u2,paragraph:Zte}}}function Xte(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Qte}}}function u2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Zte(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Qte(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=tM.listItem(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function Jte(){return[Ree(),Qee(),nte(),Hte(),Yte()]}function ene(e){return{extensions:[Mee(),Jee(e),rte(),Gte(e),Xte()]}}const tne={tokenize:ane,partial:!0},nM={tokenize:lne,partial:!0},rM={tokenize:cne,partial:!0},iM={tokenize:une,partial:!0},nne={tokenize:dne,partial:!0},sM={name:"wwwAutolink",tokenize:sne,previous:aM},oM={name:"protocolAutolink",tokenize:one,previous:lM},cs={name:"emailAutolink",tokenize:ine,previous:cM},Pi={};function rne(){return{text:Pi}}let po=48;for(;po<123;)Pi[po]=cs,po++,po===58?po=65:po===91&&(po=97);Pi[43]=cs;Pi[45]=cs;Pi[46]=cs;Pi[95]=cs;Pi[72]=[cs,oM];Pi[104]=[cs,oM];Pi[87]=[cs,sM];Pi[119]=[cs,sM];function ine(e,t,n){const r=this;let i,s;return o;function o(d){return!Bx(d)||!cM.call(r,r.previous)||ub(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(d))}function a(d){return Bx(d)?(e.consume(d),a):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(nne,u,c)(d):d===45||d===95||In(d)?(s=!0,e.consume(d),l):u(d)}function c(d){return e.consume(d),i=!0,l}function u(d){return s&&i&&Ln(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function sne(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!aM.call(r,r.previous)||ub(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(tne,e.attempt(nM,e.attempt(rM,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function one(e,t,n){const r=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&lM.call(r,r.previous)&&!ub(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),e.consume(d),a):n(d)}function a(d){if(Ln(d)&&i.length<5)return i+=String.fromCodePoint(d),e.consume(d),a;if(d===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(d),l}return n(d)}function l(d){return d===47?(e.consume(d),s?c:(s=!0,l)):n(d)}function c(d){return d===null||Jf(d)||ht(d)||qo(d)||wm(d)?n(d):e.attempt(nM,e.attempt(rM,u),n)(d)}function u(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function ane(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function lne(e,t,n){let r,i,s;return o;function o(c){return c===46||c===95?e.check(iM,l,a)(c):c===null||ht(c)||qo(c)||c!==45&&wm(c)?l(c):(s=!0,e.consume(c),o)}function a(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),o}function l(c){return i||r||!s?n(c):t(c)}}function cne(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(iM,t,s)(o):o===null||ht(o)||qo(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function une(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),s):a===93?(e.consume(a),i):a===60||a===null||ht(a)||qo(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||ht(a)||qo(a)?t(a):r(a)}function s(a){return Ln(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Ln(a)?(e.consume(a),o):n(a)}}function dne(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return In(s)?n(s):t(s)}}function aM(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ht(e)}function lM(e){return!Ln(e)}function cM(e){return!(e===47||Bx(e))}function Bx(e){return e===43||e===45||e===46||e===95||In(e)}function ub(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const hne={tokenize:_ne,partial:!0};function fne(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:vne,continuation:{tokenize:xne},exit:yne}},text:{91:{name:"gfmFootnoteCall",tokenize:gne},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:pne,resolveTo:mne}}}}function pne(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Gr(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function mne(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function gne(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(s>999||d===93&&!o||d===null||d===91||ht(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(Gr(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return ht(d)||(o=!0),s++,e.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(e.consume(d),s++,c):c(d)}}function vne(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||ht(m))return n(m);if(m===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return s=Gr(r.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return ht(m)||(a=!0),o++,e.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(e.consume(m),o++,u):u(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),et(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function xne(e,t,n){return e.check(id,t,e.attempt(hne,t,n))}function yne(e){e.exit("gfmFootnoteDefinition")}function _ne(e,t,n){const r=this;return et(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function bne(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],p=a.parser.constructs.insideSpan.null;p&&yn(f,f.length,0,Vl(p,o.slice(c+1,l),a)),yn(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),yn(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const c=this.previous,u=this.events;let d=0;return f;function f(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const v=xl(c);if(m===126)return d>1?l(m):(o.consume(m),d++,p);if(d<2&&!n)return l(m);const w=o.exit("strikethroughSequenceTemporary"),x=xl(m);return w._open=!x||x===2&&!!v,w._close=!v||v===2&&!!x,a(m)}}}class wne{constructor(){this.map=[]}add(t,n,r){Sne(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function Sne(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function kne(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Cne(){return{flow:{null:{name:"table",tokenize:Ene,resolveAll:Ine}}}}function Ene(e,t,n){const r=this;let i=0,s=0,o;return a;function a(N){let L=r.events.length-1;for(;L>-1;){const A=r.events[L][1].type;if(A==="lineEnding"||A==="linePrefix")L--;else break}const R=L>-1?r.events[L][1].type:null,M=R==="tableHead"||R==="tableRow"?k:l;return M===k&&r.parser.lazy[r.now().line]?n(N):M(N)}function l(N){return e.enter("tableHead"),e.enter("tableRow"),c(N)}function c(N){return N===124||(o=!0,s+=1),u(N)}function u(N){return N===null?n(N):Ce(N)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),p):n(N):Ye(N)?et(e,u,"whitespace")(N):(s+=1,o&&(o=!1,i+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),d(N)))}function d(N){return N===null||N===124||ht(N)?(e.exit("data"),u(N)):(e.consume(N),N===92?f:d)}function f(N){return N===92||N===124?(e.consume(N),d):d(N)}function p(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),o=!1,Ye(N)?et(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):m(N))}function m(N){return N===45||N===58?w(N):N===124?(o=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),v):C(N)}function v(N){return Ye(N)?et(e,w,"whitespace")(N):w(N)}function w(N){return N===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),x):N===45?(s+=1,x(N)):N===null||Ce(N)?S(N):C(N)}function x(N){return N===45?(e.enter("tableDelimiterFiller"),_(N)):C(N)}function _(N){return N===45?(e.consume(N),_):N===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(N))}function b(N){return Ye(N)?et(e,S,"whitespace")(N):S(N)}function S(N){return N===124?m(N):N===null||Ce(N)?!o||i!==s?C(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):C(N)}function C(N){return n(N)}function k(N){return e.enter("tableRow"),T(N)}function T(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),T):N===null||Ce(N)?(e.exit("tableRow"),t(N)):Ye(N)?et(e,T,"whitespace")(N):(e.enter("data"),E(N))}function E(N){return N===null||N===124||ht(N)?(e.exit("data"),T(N)):(e.consume(N),N===92?D:E)}function D(N){return N===92||N===124?(e.consume(N),E):E(N)}}function Ine(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const f=new wne;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(d2(f,t,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",u,t]])),i=m.type==="tableDelimiterRow"?2:u?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=ah(f,t,s,i,void 0,d),s=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],d=ah(f,t,s,i,void 0,d)),s=o,o=[s[1],n,0,0])):m.type==="tableHead"?(a=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],d=ah(f,t,s,i,n,d)):o[1]!==0&&(d=ah(f,t,o,i,n,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&d2(f,t,l,c,u),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=kne(t.events,n))}return e}function ah(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},Sa(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=Sa(t.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const c=Sa(t.events,n[2]),u=Sa(t.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,v=n[3]-n[2]-1;e.add(m,v,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return i!==void 0&&(s.end=Object.assign({},Sa(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function d2(e,t,n,r,i){const s=[],o=Sa(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function Sa(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Nne={name:"tasklistCheck",tokenize:Pne};function Tne(){return{text:{91:Nne}}}function Pne(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return ht(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return Ce(l)?t(l):Ye(l)?e.check({tokenize:Rne},t,n)(l):n(l)}}function Rne(e,t,n){return et(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Mne(e){return xR([rne(),fne(),bne(e),Cne(),Tne()])}const Ane={};function _l(e){const t=this,n=e||Ane,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Mne(n)),s.push(Jte()),o.push(ene(n))}const Hi={eof:null,asterisk:42,underscore:95,tilde:126},bl={attentionSideAfter:2,characterGroupPunctuation:2,characterGroupWhitespace:1},ui={data:"data",characterEscape:"characterEscape",emphasis:"emphasis",emphasisSequence:"emphasisSequence",emphasisText:"emphasisText",strong:"strong",strongSequence:"strongSequence",strongText:"strongText"},jne=161,Lne=1114109,Dne=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],One=12288,Bne=65510,$ne=[12288,12288,65281,65376,65504,65510],zne=8361,Fne=65518,Hne=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Une=32,Wne=10630,qne=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Vne=4352,Kne=262141,uM=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101594,101631,101664,101760,101874,101888,102801,102816,102866,110576,110579,110581,110587,110589,110590,110592,110888,110898,110898,110928,110930,110933,110933,110948,110952,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127406,127406,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128729,128732,128735,128747,128748,128756,128764,128986,128986,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129734,129736,129736,129740,129757,129759,129771,129775,129786,131072,196605,196608,262141],od=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=i*2;if(t<e[s])r=i-1;else if(t>e[s+1])n=i+1;else return!0}return!1},h2=19968,[Gne,Yne]=Xne(uM);function Xne(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){const i=e[r],s=e[r+1];if(h2>=i&&h2<=s)return[i,s];s-i>n-t&&(t=i,n=s)}return[t,n]}const Zne=e=>e<jne||e>Lne?!1:od(Dne,e),Qne=e=>e<One||e>Bne?!1:od($ne,e),Jne=e=>e<zne||e>Fne?!1:od(Hne,e),ere=e=>e<Une||e>Wne?!1:od(qne,e),tre=e=>e>=Gne&&e<=Yne?!0:e<Vne||e>Kne?!1:od(uM,e);function nre(e){return Zne(e)?"ambiguous":Qne(e)?"fullwidth":Jne(e)?"halfwidth":ere(e)?"narrow":tre(e)?"wide":"neutral"}function rre(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function ire(e){return rre(e),nre(e)}function sre(e){return new RegExp("^\\p{Emoji_Presentation}","u").test(String.fromCodePoint(e))}function ore(e){if(!e||e<4352)return!1;switch(ire(e)){case"fullwidth":case"halfwidth":return!0;case"wide":return!sre(e);case"narrow":return!1;case"ambiguous":return 917760<=e&&e<=917999?null:!1;case"neutral":return new RegExp("^\\p{sc=Hangul}","u").test(String.fromCodePoint(e))}}function are(e,t){return t!==65025||!e||e<8216?!1:e===8216||e===8217||e===8220||e===8221}function lre(e){return e!==null&&e>=65024&&e<=65038}const cre=dM(new RegExp("\\p{P}|\\p{S}","u")),ure=dM(/\s/);function dM(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCodePoint(n))}}function Au(e){return!!(e&bl.characterGroupWhitespace)}function rp(e){return(e&dr.cjkPunctuation)===bl.characterGroupPunctuation}function $x(e){return!!(e&dr.cjk)}function dre(e){return e===dr.ivs}function hre(e){return!!(e&dr.cjkOrIvs)}function fre(e){return e===dr.nonEmojiGeneralUseVS}function f2(e){return!!(e&dr.spaceOrPunctuation)}let dr;(function(e){e.spaceOrPunctuation=3,e.cjk=4096,e.cjkPunctuation=4098,e.ivs=8192,e.cjkOrIvs=12288,e.nonEmojiGeneralUseVS=16384,e.variationSelector=24576,e.ivsToCjkRightShift=1})(dr||(dr={}));function el(e){if(e===Hi.eof||ht(e)||ure(e))return bl.characterGroupWhitespace;let t=0;if(e>=4352){if(lre(e))return dr.nonEmojiGeneralUseVS;switch(ore(e)){case null:return dr.ivs;case!0:t|=dr.cjk;break}}return cre(e)&&(t|=bl.characterGroupPunctuation),t}function hM(e,t,n){if(!fre(e))return e;const r=t(),i=el(r);return!r||Au(i)?e:are(r,n)?dr.cjkPunctuation:pre(i)}function pre(e){return e&~dr.ivs}function fM(e){return!!(e&&e>=55296&&e<=56319)}function pM(e){return!!(e&&e>=56320&&e<=57343)}function mM(e,t,n){if(t._bufferIndex<2)return e;const r=n({start:{...t,_bufferIndex:t._bufferIndex-2},end:t}).codePointAt(0);return r&&r>=65536?r:e}function mre(e,t,n){const r=e>=65536?2:1;if(t._bufferIndex<1+r)return null;const i=t._bufferIndex-r-2,s=n({start:{...t,_bufferIndex:i>=0?i:0},end:{...t,_bufferIndex:t._bufferIndex-r}}),o=s.charCodeAt(s.length-1);if(Number.isNaN(o))return null;if(s.length<2||o<56320||57343<o)return o;const a=s.codePointAt(0);return a&&a>=65536?a:o}var gM=class{constructor(e,t,n){Db(this,"cachedValue");this.previousCode=e,this.nowPoint=t,this.sliceSerialize=n}value(){return this.cachedValue===void 0&&(this.cachedValue=mre(this.previousCode,this.nowPoint,this.sliceSerialize)),this.cachedValue}};function vM(e,t,n){const r=n({start:t,end:{...t,_bufferIndex:t._bufferIndex+2}}).codePointAt(0);return r&&r>=65536?r:e}const n0={name:"attention",resolveAll:gre,tokenize:vre};function gre(e,t){let n=-1,r,i,s,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};p2(d,-l),p2(f,l),o={type:l>1?ui.strongSequence:ui.emphasisSequence,start:d,end:{...e[r][1].end}},a={type:l>1?ui.strongSequence:ui.emphasisSequence,start:{...e[n][1].start},end:f},s={type:l>1?ui.strongText:ui.emphasisText,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?ui.strong:ui.emphasis,start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=gn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=gn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),t.parser.constructs.insideSpan.null,c=gn(c,Vl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=gn(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=gn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,yn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function vre(e,t){const n=this.parser.constructs.attentionMarkers.null,{now:r,sliceSerialize:i,previous:s}=this,o=pM(s)?mM(s,r(),i):s,a=el(o),l=new gM(o,r(),i),c=hM(a,l.value.bind(l),o);let u;return d;function d(p){return u=p,e.enter("attentionSequence"),f(p)}function f(p){if(p===u)return e.consume(p),f;const m=e.exit("attentionSequence"),v=el(fM(p)?vM(p,r(),i):p),w=rp(c),x=w||Au(c),_=rp(v),b=_||Au(v),S=hre(c),C=!b||_&&(x||S)||n.includes(p),k=!x||w&&(b||$x(v))||n.includes(o);return m._open=!!(u===Hi.asterisk?C:C&&(f2(c)||!k)),m._close=!!(u===Hi.asterisk?k:k&&(f2(v)||!C)),t(p)}}function p2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}function xre(){return{text:{[Hi.asterisk]:n0,[Hi.underscore]:n0},insideSpan:{null:[n0]}}}function yre(){const e=this.data();(e.micromarkExtensions||(e.micromarkExtensions=[])).push(xre())}function _re(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:i,resolveAll:r};return t==null&&(t=!0),{text:{[Hi.tilde]:n},insideSpan:{null:[n]},attentionMarkers:{null:[Hi.tilde]}};function r(s,o){let a=-1;for(;++a<s.length;)if(s[a][0]==="enter"&&s[a][1].type==="strikethroughSequenceTemporary"&&s[a][1]._close){let l=a;for(;l--;)if(s[l][0]==="exit"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._open&&s[a][1].end.offset-s[a][1].start.offset===s[l][1].end.offset-s[l][1].start.offset){s[a][1].type="strikethroughSequence",s[l][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},s[l][1].start),end:Object.assign({},s[a][1].end)},u={type:"strikethroughText",start:Object.assign({},s[l][1].end),end:Object.assign({},s[a][1].start)},d=[["enter",c,o],["enter",s[l][1],o],["exit",s[l][1],o],["enter",u,o]],f=o.parser.constructs.insideSpan.null;f&&yn(d,d.length,0,Vl(f,s.slice(l+1,a),o)),yn(d,d.length,0,[["exit",u,o],["enter",s[a][1],o],["exit",s[a][1],o],["exit",c,o]]),yn(s,l-1,a-l+3,d),a=l+d.length-2;break}}for(a=-1;++a<s.length;)s[a][1].type==="strikethroughSequenceTemporary"&&(s[a][1].type=ui.data);return s}function i(s,o,a){const{now:l,sliceSerialize:c,previous:u}=this,d=pM(u)?mM(u,l(),c):u,f=el(d),p=new gM(d,l(),c),m=hM(f,p.value.bind(p),d),v=this.events;let w=0;return x;function x(b){return d===Hi.tilde&&v[v.length-1][1].type!==ui.characterEscape?a(b):(s.enter("strikethroughSequenceTemporary"),_(b))}function _(b){const S=el(d);if(b===Hi.tilde)return w>1?a(b):(s.consume(b),w++,_);if(w<2&&!t)return a(b);const C=s.exit("strikethroughSequenceTemporary"),k=el(fM(b)?vM(b,l(),c):b),T=rp(m)||Au(m),E=rp(k)||Au(k),D=$x(m)||dre(S);return C._open=!E||k===bl.attentionSideAfter&&(T||D),C._close=!T||S===bl.attentionSideAfter&&(E||$x(k)),o(b)}}}function bre(e){const t=this.data();(t.micromarkExtensions||(t.micromarkExtensions=[])).push(_re(e))}function Em(e){if(!e)return!1;const n=e.split("#")[0].split("?")[0].toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")}function wre(e){if(!e)return null;let t;if(e.startsWith("file://")){const n=e.slice(7);t=n.startsWith("/")?n:`/${n.split("/").slice(1).join("/")}`}else{if(/^[a-z][a-z0-9+.-]*:/i.test(e))return null;if(e.startsWith("/"))t=e;else return null}try{return decodeURIComponent(t)}catch{return t}}const Sre=/\.(png|jpe?g|webp|gif|svg)$/i;function kre(e,t){if((typeof t=="string"?t:null)!==e)return!1;try{const r=new URL(e);return Sre.test(r.pathname)}catch{return!1}}function Cre(e){try{return new URL(e).pathname.split("/").filter(Boolean).pop()??""}catch{return""}}const Qs={a:({node:e,href:t,children:n,...r})=>typeof t=="string"&&kre(t,n)?h.jsxs("span",{className:"my-1 inline-flex flex-col items-start gap-1 align-top",children:[h.jsx("img",{src:t,alt:Cre(t),className:"max-w-full h-auto rounded border border-border"}),h.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"max-w-full truncate text-[11px] text-text-300 underline decoration-dotted underline-offset-2 hover:text-text-100",children:t})]}):h.jsx("a",{...r,href:t,target:"_blank",rel:"noopener noreferrer",children:n})};function xM(e){return e.startsWith("file://")?e:zR(e)}function yM(e){return{...Qs,a:t=>{const{href:n,children:r}=t,i=typeof n=="string"?wre(n):null;if(i===null){const s=Qs.a;return h.jsx(s,{...t})}return h.jsx("a",{href:n,"data-testid":"assistant-file-link",title:i,onClick:s=>{s.preventDefault(),e(i)},children:r})}}}function Ere({text:e,forkTarget:t,onOpenFilePath:n}){const{body:r}=_m(e),i=Je.useMemo(()=>n?yM(n):Qs,[n]);return r?h.jsxs("div",{className:"group relative flex min-w-0 max-w-full flex-col items-start","data-testid":"msg-line-assistant-wrapper",children:[h.jsx("div",{"data-testid":"msg-line-assistant",className:"assistant-markdown w-full min-w-0 max-w-full py-1 break-words",children:h.jsx(yl,{remarkPlugins:[_l,yre,bre],components:i,...n?{urlTransform:xM}:{},children:r})}),t?h.jsxs("div",{className:"mt-1 flex flex-row items-center gap-1 md:absolute md:top-full md:mt-0 md:pt-0.5 md:z-10 md:rounded-md md:pointer-events-none md:group-hover:pointer-events-auto md:group-hover:bg-bg-100",children:[t.onFork?h.jsxs("button",{type:"button","data-testid":"assistant-msg-fork","aria-label":"fork from this message",title:"从这条消息派生新 session(截断之后的对话)",onClick:()=>t.onFork(t.messageUuid),className:"inline-flex items-center justify-start gap-1 h-7 w-7 md:h-6 md:w-auto md:px-1.5 rounded-md text-[11px] text-text-400/60 md:text-text-400 hover:bg-text-100/5 hover:text-text-200 md:opacity-0 md:group-hover:opacity-100 md:transition-opacity cursor-pointer",children:[h.jsx(ku,{className:"w-3 h-3",strokeWidth:2}),h.jsx("span",{className:"hidden md:inline",children:"Fork"})]}):null,t.onQuickAsk?h.jsxs("button",{type:"button","data-testid":"assistant-msg-quick-ask","aria-label":"quick ask from this message",title:"快速问答:从这条消息派生临时会话,关闭即删",onClick:()=>t.onQuickAsk(t.messageUuid),className:"inline-flex items-center justify-start gap-1 h-7 w-7 md:h-6 md:w-auto md:px-1.5 rounded-md text-[11px] text-text-400/60 md:text-text-400 hover:bg-text-100/5 hover:text-text-200 md:opacity-0 md:group-hover:opacity-100 md:transition-opacity cursor-pointer",children:[h.jsx(dF,{className:"w-3 h-3",strokeWidth:2}),h.jsx("span",{className:"hidden md:inline",children:"问一下"})]}):null]}):null]}):null}function Ire({text:e}){const[t,n]=g.useState(!1);return e?h.jsxs("div",{"data-testid":"msg-line-thinking",className:"text-[12px] text-text-400",children:[h.jsxs("button",{type:"button",onClick:()=>n(r=>!r),className:"flex items-center gap-1 hover:text-text-300 transition-colors cursor-pointer","aria-expanded":t,"data-testid":"msg-line-thinking-toggle",children:[t?h.jsx(Pn,{className:"w-3 h-3"}):h.jsx(Fn,{className:"w-3 h-3"}),h.jsx("span",{children:"💭 Thinking"})]}),t?h.jsx("div",{className:"ml-4 mt-1 italic text-text-400 whitespace-pre-wrap break-words",children:e}):null]}):null}const Nre=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function zx(e){return Nre.has(e)}function Tre({tool:e,relPath:t,scope:n,onShareFile:r}){if(!zx(e)||!t||!n||!r)return null;const i=Em(t)?"md-rendered":"raw";return h.jsx("span",{"data-testid":"file-edit-hover-row",className:"inline-flex shrink-0 items-center gap-1",children:h.jsx("span",{role:"button",tabIndex:0,"data-testid":"file-edit-share-btn","aria-label":"Share link",title:"Share link",onClick:s=>{s.stopPropagation(),r(t,i)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.stopPropagation(),s.preventDefault(),r(t,i))},className:"inline-flex h-3.5 w-3.5 items-center justify-center text-text-400 hover:text-text-200 cursor-pointer",children:h.jsx(n_,{className:"h-3.5 w-3.5"})})})}function Pre(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.file_path=="string"&&t.file_path||typeof t.notebook_path=="string"&&t.notebook_path||typeof t.path=="string"&&t.path||null||null}function _M(e,t){const[n,r]=g.useState({kind:"idle"});return g.useEffect(()=>{let i=!1,s=null;r({kind:"loading"});const o={};return t&&(o.Authorization=`Bearer ${t}`),fetch(e,{headers:o,credentials:"omit"}).then(async a=>{if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.blob()}).then(a=>{if(i)return;const l=a.type.split(";",1)[0].trim().toLowerCase();if(!/^(image\/(png|jpeg|gif|webp)|video\/(mp4|webm|quicktime))$/.test(l))throw new Error("此文件不支持内嵌预览,请使用文件打开功能");const c=URL.createObjectURL(a);s=c,r({kind:"ready",objectUrl:c})}).catch(a=>{i||r({kind:"error",message:a.message})}),()=>{i=!0,s&&URL.revokeObjectURL(s)}},[e,t]),n}function Rre({url:e,bearerToken:t,alt:n,className:r}){const i=_M(e,t);return h.jsxs("div",{"data-testid":"blob-image","data-state":i.kind,className:ie("relative inline-flex items-center justify-center rounded-md border border-border bg-bg-0",r),children:[i.kind==="loading"?h.jsx("div",{className:"flex h-24 w-32 items-center justify-center",children:h.jsx(Tn,{className:"h-4 w-4 animate-spin text-text-400"})}):null,i.kind==="error"?h.jsxs("div",{className:"flex h-24 w-32 items-center justify-center gap-1 px-2 text-[11px] text-text-400",children:[h.jsx(Jo,{className:"h-3 w-3"}),h.jsx("span",{title:i.message,children:"加载失败"})]}):null,i.kind==="ready"?h.jsx("img",{src:i.objectUrl,alt:n,className:"block max-h-[180px] max-w-[420px] rounded-md object-contain"}):null]})}function Mre({url:e,bearerToken:t,className:n}){const r=_M(e,t);return h.jsxs("div",{"data-testid":"blob-video","data-state":r.kind,className:ie("relative inline-flex items-center justify-center rounded-md border border-border bg-bg-0",n),children:[r.kind==="loading"?h.jsx(Tn,{className:"h-4 w-4 animate-spin text-text-400"}):null,r.kind==="error"?h.jsx("span",{className:"px-2 text-[11px] text-text-400",children:"加载失败"}):null,r.kind==="ready"?h.jsx("video",{src:r.objectUrl,controls:!0,className:"block max-h-[240px] max-w-[420px] rounded-md"}):null]})}const Are=new Set([".png",".jpg",".jpeg",".gif",".webp"]),jre=new Set([".mp4",".webm",".mov"]),Lre=new Set([".pdf"]);function Dre(e){const t=e.lastIndexOf("."),n=t>=0?e.slice(t).toLowerCase():"";return Are.has(n)?"image":jre.has(n)?"video":Lre.has(n)?"pdf":"binary"}function bM(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ore({relPath:e,scope:t,size:n}){const r=Qp();if(r.actionsLevel==="none")return null;const i=Iz(r,t,e);if(!i)return null;const s=Dre(e);return s==="image"?h.jsx("div",{"data-testid":"file-edit-inline-preview","data-kind":"image",className:"mt-2",children:h.jsx(Rre,{url:i,bearerToken:r.httpToken,alt:e})}):s==="video"?h.jsx("div",{"data-testid":"file-edit-inline-preview","data-kind":"video",className:"mt-2",children:h.jsx(Mre,{url:i,bearerToken:r.httpToken})}):s==="pdf"?h.jsx(Bre,{relPath:e,url:i,size:n}):typeof n=="number"&&n>=1024*1024?h.jsxs("div",{"data-testid":"file-edit-inline-preview","data-kind":"binary",className:"mt-2 inline-flex items-center gap-1.5 rounded border border-border bg-bg-50 px-2 py-1 text-[11px] text-text-400",children:[h.jsx(Ci,{className:"h-3 w-3"}),h.jsx("span",{className:"font-mono",children:e.split("/").pop()}),h.jsx("span",{children:"·"}),h.jsx("span",{children:bM(n)})]}):null}function Bre({relPath:e,url:t,size:n}){return h.jsxs("a",{"data-testid":"file-edit-inline-preview","data-kind":"pdf",href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 rounded border border-border bg-bg-50 px-2 py-1 text-[11px] text-text-300 hover:bg-bg-100",children:[h.jsx(Ci,{className:"h-3 w-3"}),h.jsx("span",{className:"font-mono",children:e.split("/").pop()}),typeof n=="number"?h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"·"}),h.jsx("span",{children:bM(n)})]}):null,h.jsx(Su,{className:"h-3 w-3"})]})}const $re={Bash:p4,Read:Ci,Edit:hx,Write:q7,Grep:Hf,Glob:Hf};function zre(e){return $re[e]??eH}function Fre(e){if(!e||typeof e!="object")return"";const t=e,n=t.command??t.file_path??t.path??t.pattern??t.query??t.url??t.description;if(typeof n=="string")return n;for(const r of Object.values(t))if(typeof r=="string"&&r)return r;return""}function wM({tool:e,input:t,output:n,error:r,pending:i=!1,expandedBody:s,fileScope:o,onOpenInTab:a,onPreviewMarkdown:l,onShareFile:c}){const[u,d]=g.useState(!1),f=!!r,p=zre(e),m=Fre(t),v=Pre(t);return h.jsxs("div",{"data-testid":"msg-line-tool","data-tool":e,className:ie("group min-w-0 max-w-full rounded-md border px-3 py-2 text-[13px]",f?"border-destructive/40 bg-destructive/5":"border-border bg-bg-50"),children:[h.jsxs("button",{type:"button",onClick:()=>d(w=>!w),"aria-expanded":u,"data-testid":"msg-line-tool-header",className:"flex w-full items-center gap-2 text-left cursor-pointer min-w-0",children:[f?h.jsx(Jo,{className:"w-4 h-4 text-destructive shrink-0"}):h.jsx(p,{className:ie("w-4 h-4 shrink-0",i?"text-text-400":"text-text-300")}),h.jsx("span",{className:"font-medium text-text-100 shrink-0",children:e}),m?(()=>{if(f||!zx(e)||!v)return null;const x=Em(v)&&l?l:a;return x?h.jsx("span",{role:"button",tabIndex:0,"data-testid":"msg-line-tool-preview","data-clickable":"true",title:m,onClick:_=>{_.stopPropagation(),x(v)},onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.stopPropagation(),_.preventDefault(),x(v))},className:"text-[12px] text-accent font-mono truncate min-w-0 max-w-full cursor-pointer underline underline-offset-2 hover:opacity-80",children:m}):null})()??h.jsx("span",{"data-testid":"msg-line-tool-preview",className:"text-[12px] text-text-400 font-mono truncate min-w-0 max-w-full",title:m,children:m}):null,h.jsx("span",{"aria-hidden":"true","data-testid":"msg-line-tool-header-spacer",className:"flex-1 min-w-0 self-stretch"}),i?h.jsx(Tn,{"data-testid":"msg-line-tool-pending",className:"w-3 h-3 text-text-400 animate-spin shrink-0"}):null,!f&&o?h.jsx(Tre,{tool:e,relPath:v,scope:o,...c?{onShareFile:c}:{}}):null]}),u?s!==void 0?h.jsxs("div",{"data-testid":"msg-line-tool-body",className:"mt-2 min-w-0 text-[12px]",children:[s,f?h.jsxs("div",{className:"mt-2",children:[h.jsx("div",{className:"text-destructive mb-0.5",children:"error"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-destructive/40 rounded p-2 overflow-auto text-destructive",children:String(r)})]}):null]}):h.jsxs("div",{"data-testid":"msg-line-tool-body",className:"mt-2 min-w-0 space-y-1 text-[12px]",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-text-400 mb-0.5",children:"input"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-border rounded p-2 overflow-auto text-text-200",children:JSON.stringify(t,null,2)})]}),n!==void 0?h.jsxs("div",{children:[h.jsx("div",{className:"text-text-400 mb-0.5",children:"output"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-border rounded p-2 overflow-auto text-text-200",children:typeof n=="string"?n:JSON.stringify(n,null,2)})]}):null,f?h.jsxs("div",{children:[h.jsx("div",{className:"text-destructive mb-0.5",children:"error"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-destructive/40 rounded p-2 overflow-auto text-destructive",children:String(r)})]}):null]}):null,!f&&o&&v&&zx(e)?h.jsx(Ore,{relPath:v,scope:o}):null]})}var Hre=Symbol.for("react.lazy"),ip=Tl[" use ".trim().toString()];function Ure(e){return typeof e=="object"&&e!==null&&"then"in e}function SM(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Hre&&"_payload"in e&&Ure(e._payload)}function Wre(e){const t=Vre(e),n=g.forwardRef((r,i)=>{let{children:s,...o}=r;SM(s)&&typeof ip=="function"&&(s=ip(s._payload));const a=g.Children.toArray(s),l=a.find(Gre);if(l){const c=l.props.children,u=a.map(d=>d===l?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:g.isValidElement(c)?g.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}var qre=Wre("Slot");function Vre(e){const t=g.forwardRef((n,r)=>{let{children:i,...s}=n;if(SM(i)&&typeof ip=="function"&&(i=ip(i._payload)),g.isValidElement(i)){const o=Xre(i),a=Yre(s,i.props);return i.type!==g.Fragment&&(a.ref=r?Ku(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Kre=Symbol("radix.slottable");function Gre(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Kre}function Yre(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function Xre(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const m2=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,g2=x4,Zre=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return g2(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(c=>{const u=n==null?void 0:n[c],d=s==null?void 0:s[c];if(u===null)return null;const f=m2(u)||m2(d);return i[c][f]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...p}=u;return Object.entries(p).every(m=>{let[v,w]=m;return Array.isArray(w)?w.includes({...s,...a}[v]):{...s,...a}[v]===w})?[...c,d,f]:c},[]);return g2(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Qre=Zre("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-accent text-accent-contrast hover:bg-accent-hover",destructive:"bg-destructive text-white hover:bg-destructive-hover",outline:"border border-border bg-transparent text-text-100 hover:bg-bg-200",ghost:"bg-transparent text-text-200 hover:bg-bg-200 hover:text-text-100"},size:{sm:"h-8 px-3 text-xs",md:"h-9 px-4",lg:"h-11 px-6 text-base"}},defaultVariants:{variant:"default",size:"md"}}),tl=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},s)=>{const o=r?qre:"button";return h.jsx(o,{ref:s,className:ie(Qre({variant:t,size:n}),e),...i})});tl.displayName="Button";function Jre({tool:e,input:t,onRespond:n,onInterrupt:r}){return h.jsxs("div",{"data-testid":"msg-line-permission",className:"min-w-0 max-w-full rounded-md border border-warning/40 bg-warning-dim/60 px-3 py-2.5 text-[13px]",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2 mb-1.5",children:[h.jsx(BF,{className:"w-4 h-4 text-warning shrink-0"}),h.jsxs("span",{className:"min-w-0 font-medium text-text-100 truncate",children:["权限请求:",e]}),r?h.jsx("button",{type:"button",onClick:r,"data-testid":"msg-line-permission-interrupt","aria-label":"interrupt current turn",title:"中断当前轮次(不杀进程)",className:"ml-auto h-6 w-6 rounded-md flex items-center justify-center text-text-400 hover:bg-text-100/10 hover:text-text-200 transition-colors cursor-pointer",children:h.jsx(d4,{className:"w-3.5 h-3.5",strokeWidth:2})}):null]}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-border rounded p-2 mb-2 max-h-[140px] overflow-auto text-[12px] text-text-200",children:JSON.stringify(t,null,2)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(tl,{size:"sm",variant:"default",onClick:()=>n(!0,!1),"data-testid":"msg-line-permission-allow",children:"Allow"}),h.jsx(tl,{size:"sm",variant:"outline",onClick:()=>n(!0,!0),"data-testid":"msg-line-permission-allow-always",children:"Allow Always"}),h.jsx(tl,{size:"sm",variant:"destructive",onClick:()=>n(!1,!1),"data-testid":"msg-line-permission-deny",children:"Deny"})]})]})}function eie({message:e}){return h.jsxs("div",{"data-testid":"msg-line-error",className:"flex min-w-0 max-w-full items-start gap-2 text-destructive text-[13px] rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2",children:[h.jsx(Uf,{className:"w-4 h-4 shrink-0 mt-0.5"}),h.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e})]})}const tie=/\[skill:(.+?):(\/[^\]]+)\]/g;function nie(e){const t=[],n=e.replace(tie,(r,i)=>(t.push(i),""));return{skills:t,text:t.length>0?n.trim():e}}function rie({text:e,senderDisplayName:t,senderPrincipal:n,rewindTarget:r}){const i=n==="guest",s=rR(e),{attachments:o,text:a}=Qf(s),{skills:l,text:c}=nie(a),{commandName:u,body:d}=_m(c),f=d.length>0;return f||o.length>0||!!u||l.length>0?(u||l.length>0)&&!f&&o.length===0?h.jsxs("div",{className:"flex min-w-0 max-w-full justify-end gap-1.5 py-2 mt-2","data-testid":"msg-line-user","data-sender-principal":i?"guest":"owner",children:[l.map((m,v)=>h.jsxs("span",{"data-testid":"user-skill-chip",className:"inline-flex items-center rounded-md bg-bg-200/60 px-2 py-0.5 text-[11px] font-mono text-text-300",children:["/",m]},`${m}-${v}`)),u?h.jsx("span",{className:"inline-flex items-center rounded-md bg-bg-200/60 px-2 py-0.5 text-[11px] font-mono text-text-300",children:u}):null]}):h.jsxs("div",{className:"group flex min-w-0 max-w-full flex-col items-end py-2 mt-2","data-testid":"msg-line-user","data-sender-principal":i?"guest":"owner",children:[h.jsxs("div",{"data-testid":"user-msg-bubble",className:ie("min-w-0 max-w-[85%] rounded-2xl rounded-br-sm px-3.5 py-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",i?"border border-border bg-bg-200":"bg-accent"),children:[o.length>0?h.jsx(iie,{attachments:o}):null,l.length>0?h.jsx("div",{className:ie("flex flex-wrap gap-1.5",(f||u)&&"mb-1.5"),children:l.map((m,v)=>h.jsxs("span",{"data-testid":"user-skill-chip",className:ie("inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-mono",i?"bg-text-100/10 text-text-200":"bg-white/15 text-white/90"),children:["/",m]},`${m}-${v}`))}):null,u?h.jsx("div",{className:ie("flex",f&&"mb-1.5"),children:h.jsx("span",{"data-testid":"user-command-chip",className:ie("inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-mono",i?"bg-text-100/10 text-text-200":"bg-white/15 text-white/90"),children:u})}):null,f?h.jsx("div",{className:ie("text-[14px] font-medium leading-relaxed",i?"text-text-100":"text-white"),children:d}):null]}),t?h.jsx("div",{"data-testid":"user-msg-sender-label",className:"mt-1 text-[11px] text-text-400",children:t}):null,r?h.jsxs("button",{type:"button","data-testid":"user-msg-rewind","aria-label":"rewind to this message",title:"回退到这条消息(会撤销之后 CC 的文件编辑)",onClick:()=>r.onRewind(r.userMessageId),className:"mt-1 inline-flex items-center gap-1 h-6 px-1.5 rounded-md text-[11px] text-text-400 hover:bg-text-100/5 hover:text-text-200 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:[h.jsx(m4,{className:"w-3 h-3",strokeWidth:2}),h.jsx("span",{children:"Rewind"})]}):null]}):null}function iie({attachments:e}){return h.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5","data-testid":"user-attachment-row",children:e.map(t=>h.jsx(sie,{attachment:t},t.url))})}function sie({attachment:e}){return e.type==="image"?h.jsx("img",{src:e.url,alt:e.fileName,"data-testid":"user-attachment-image",className:"h-16 w-16 rounded object-cover shrink-0 border border-bg-300/50"}):h.jsxs("div",{"data-testid":"user-attachment-file",className:"flex items-center gap-1.5 rounded-md border border-bg-300 bg-bg-100/60 px-2 py-1 text-[12px] text-text-200",children:[h.jsx(Ci,{className:"h-3.5 w-3.5 text-text-400 shrink-0"}),h.jsx("span",{className:"max-w-[140px] truncate",children:e.fileName})]})}const oie={"task-notification":"子任务通知","slash-command":"斜杠命令","local-command":"本地命令输出","system-reminder":"系统提醒","skill-hint":"Skill 注入","meta-text":"系统消息","attachment-skills":"技能列表","attachment-deferred-tools":"Deferred 工具变更","dispatch-task":"委派任务","dispatch-result":"委派回报"},aie={"task-notification":rk,"slash-command":UF,"local-command":p4,"system-reminder":rk,"skill-hint":fx,"meta-text":u4,"attachment-skills":fx,"attachment-deferred-tools":EF,"dispatch-task":f4,"dispatch-result":c4};function kM({metaKind:e,text:t}){const[n,r]=g.useState(!1),i=aie[e];if(e==="slash-command"){const{commandName:o,commandMessage:a,commandArgs:l,body:c}=_m(t),u=o??(a?`/${a}`:null),d=!!(l&&l.length>0),f=c.length>0;return!u&&!d&&!f?null:h.jsxs("div",{"data-testid":"msg-line-user-meta","data-meta-kind":e,className:"flex min-w-0 max-w-full flex-col items-end gap-0.5 py-1",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2 max-w-full",children:[u?h.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md bg-bg-200/60 px-2 py-0.5 text-[11px] font-mono text-text-300 shrink-0",children:[h.jsx(i,{className:"w-3 h-3 opacity-70"}),u]}):null,d?h.jsx("span",{"data-testid":"user-meta-command-args",className:"min-w-0 text-[12px] text-text-200 whitespace-pre-wrap break-words max-w-[70ch] [overflow-wrap:anywhere]",children:l}):null]}),f?h.jsx("span",{className:"ml-2 max-w-[60%] truncate text-[11px] text-text-400",children:c}):null]})}const s=t.replace(/\s+/g," ").trim().slice(0,80);return h.jsxs("div",{"data-testid":"msg-line-user-meta","data-meta-kind":e,className:"flex min-w-0 max-w-full flex-col items-start gap-1 py-1",children:[h.jsxs("button",{type:"button","aria-expanded":n,onClick:()=>r(o=>!o),className:ie("group inline-flex items-center gap-1.5 rounded-md border border-bg-200/60 bg-bg-100/40","px-2 py-1 text-[11px] text-text-400 hover:bg-bg-200/40 transition-colors max-w-full"),children:[h.jsx(i,{className:"w-3 h-3 opacity-70 shrink-0"}),h.jsx("span",{className:"font-medium shrink-0",children:oie[e]}),h.jsx("span",{className:"truncate text-text-400/80 max-w-[60ch]",children:s}),n?h.jsx(Pn,{className:"w-3 h-3 opacity-60 shrink-0"}):h.jsx(Fn,{className:"w-3 h-3 opacity-60 shrink-0"})]}),n?h.jsx("pre",{"data-testid":"user-meta-body",className:"w-full max-w-full whitespace-pre-wrap break-words text-[11px] text-text-400 bg-bg-50/60 rounded-md p-2 border border-bg-200/60 [overflow-wrap:anywhere]",children:t}):null]})}function lie(e){return e.ordinal===null?e.label:`#${e.ordinal} ${e.label}`}function cie({text:e,metaKind:t,resolveDispatchOrigin:n,onOpenSession:r,onOpenFilePath:i}){const s=g.useMemo(()=>G$(e),[e]);return s.length===0?h.jsx(kM,{metaKind:t,text:e}):h.jsx("div",{"data-testid":"msg-line-dispatch-group",className:"my-1 flex min-w-0 max-w-full flex-col gap-1.5",children:s.map((o,a)=>h.jsx(fie,{block:o,...n?{resolveDispatchOrigin:n}:{},...r?{onOpenSession:r}:{},...i?{onOpenFilePath:i}:{}},`${o.kind}-${o.dispatchId}-${a}`))})}function uie(e){return e.length<=24?e:`${e.slice(0,12)}…${e.slice(-6)}`}function v2({origin:e}){const t=[];if(e.line&&t.push(h.jsx("span",{"data-testid":"dispatch-origin-line","data-line-ordinal":e.line.ordinal??"",className:"min-w-0 truncate tabular-nums text-text-300",children:lie(e.line)},"line")),t.push(h.jsxs("span",{"data-testid":"dispatch-origin-persona","data-persona-id":e.persona.id,className:"inline-flex min-w-0 items-baseline gap-1",children:[e.persona.label?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"truncate text-text-200",children:e.persona.label})," "]}):null,h.jsx("span",{className:"truncate font-mono text-[10px] text-text-400",children:e.persona.id})]},"persona")),e.device){const n=e.device;t.push(h.jsxs("span",{"data-testid":"dispatch-origin-device","data-device-id":n.id,title:n.id,className:"inline-flex min-w-0 items-baseline gap-1",children:[h.jsx(oF,{className:"h-3 w-3 shrink-0 translate-y-[2px] text-text-400"}),n.displayName?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"truncate text-text-200",children:n.displayName})," "]}):null,h.jsx("span",{className:"truncate font-mono text-[10px] text-text-400",children:uie(n.id)})]},"device"))}return h.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-baseline",children:[h.jsx("span",{className:"shrink-0 whitespace-pre text-text-400",children:"来自 "}),t.map((n,r)=>h.jsxs(Je.Fragment,{children:[r>0?h.jsx("span",{className:"shrink-0 whitespace-pre text-text-400",children:" · "}):null,n]},r))]})}function die({origin:e,onOpenSession:t,seam:n}){const r=ie("flex w-full min-w-0 items-center gap-2 border-t bg-bg-200/35 px-3 py-1 text-left text-[10px] leading-relaxed",n),i=e.sessionId;return!i||!t?h.jsxs("div",{"data-testid":"dispatch-origin","data-openable":"false",className:r,children:[h.jsx(v2,{origin:e}),e.unreachable?h.jsx("span",{"data-testid":"dispatch-origin-unreachable",className:"ml-auto inline-flex shrink-0 items-center gap-1 text-text-400",children:e.unreachable==="remote-device"?"会话在对端设备":"会话已删除"}):null]}):h.jsxs("button",{type:"button","data-testid":"dispatch-origin","data-openable":"true","data-session-id":i,onClick:()=>t(i),title:"打开这条会话",className:ie(r,"group cursor-pointer transition-colors hover:bg-bg-200/70"),children:[h.jsx("span",{className:"min-w-0 group-hover:underline group-hover:decoration-text-400 group-hover:underline-offset-2",children:h.jsx(v2,{origin:e})}),h.jsxs("span",{className:"ml-auto inline-flex shrink-0 items-center gap-0.5 text-text-400 transition-colors group-hover:text-text-100",children:["打开会话",h.jsx(o4,{className:"h-3 w-3"})]})]})}function hie(e){return e?{shell:"border-error/40 bg-error-dim",rail:"bg-error/55",hover:"hover:bg-error/10",icon:"text-error",title:"text-error",chevron:"text-error/70",seam:"border-error/25"}:{shell:"border-accent/35 bg-accent-dim",rail:"bg-accent/45",hover:"hover:bg-accent/10",icon:"text-accent",title:"text-accent",chevron:"text-accent/70",seam:"border-accent/20"}}function fie({block:e,resolveDispatchOrigin:t,onOpenSession:n,onOpenFilePath:r}){const[i,s]=g.useState(!1),o=g.useMemo(()=>r?yM(r):Qs,[r]),a=e.kind==="task",l=(t==null?void 0:t(e.dispatchId,e.from))??(e.from?{persona:{id:e.from}}:void 0),c=a&&typeof e.round=="number"&&e.round>=2,u=e.status==="failure",d=hie(u);return h.jsxs("div",{"data-testid":"msg-line-dispatch","data-dispatch-kind":e.kind,"data-dispatch-id":e.dispatchId,"data-round":e.round??"","data-status":e.status??"","data-open":i?"true":"false",className:ie("flex min-w-0 max-w-full overflow-hidden rounded-lg border",d.shell),children:[h.jsx("span",{"data-testid":"dispatch-rail","aria-hidden":"true",className:ie("w-[3px] shrink-0 self-stretch",d.rail)}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h.jsxs("button",{type:"button","aria-expanded":i,onClick:()=>s(f=>!f),className:ie("flex w-full min-w-0 cursor-pointer items-start gap-2 px-3 py-2 text-left transition-colors",d.hover),children:[h.jsx("span",{className:ie("mt-[2px] shrink-0",d.icon),children:a?h.jsx(f4,{className:"h-3.5 w-3.5"}):h.jsx(c4,{className:"h-3.5 w-3.5"})}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsxs("span",{"data-testid":"dispatch-header",className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[h.jsx("span",{className:ie("text-[12px] font-semibold",d.title),children:a?"委派任务":"委派回报"}),c?h.jsxs("span",{"data-testid":"dispatch-round",className:"inline-flex items-center gap-1 rounded-md bg-bg-200/70 px-1.5 py-0.5 text-[10px] text-text-300",children:[h.jsx(RF,{className:"h-3 w-3"}),"续派第 ",e.round," 轮"]}):null,u?h.jsxs("span",{"data-testid":"dispatch-status",className:"inline-flex items-center gap-1 text-[11px] text-error",children:[h.jsx(Jo,{className:"h-3.5 w-3.5"}),"失败"]}):null,e.filePaths.length>0?h.jsxs("span",{"data-testid":"dispatch-file-count",className:"inline-flex items-center gap-1 text-[11px] text-text-400",children:[h.jsx(Ci,{className:"h-3 w-3"}),e.filePaths.length," 个产物"]}):null]}),h.jsx("span",{"data-testid":"dispatch-brief",className:"mt-1 block whitespace-pre-wrap break-words text-[12px] leading-relaxed text-text-200 [overflow-wrap:anywhere]",children:e.brief}),e.briefIsDerived?h.jsxs("span",{"data-testid":"dispatch-brief-derived",title:"发送方没写摘要,这段是从正文首段自动截取的",className:"mt-1 inline-flex items-center gap-1 text-[10px] text-text-400 italic",children:[h.jsx(zF,{className:"h-2.5 w-2.5"}),"自动摘要(发送方未填)"]}):null]}),h.jsx("span",{className:ie("mt-[3px] shrink-0",d.chevron),children:i?h.jsx(Pn,{className:"h-3.5 w-3.5"}):h.jsx(Fn,{className:"h-3.5 w-3.5"})})]}),l?h.jsx(die,{origin:l,...n?{onOpenSession:n}:{},seam:d.seam}):null,i?h.jsxs(h.Fragment,{children:[h.jsx("div",{"data-testid":"dispatch-body",className:ie("min-w-0 space-y-2 border-t bg-bg-200/35 py-2.5 pl-4 pr-3",d.seam),children:h.jsxs("div",{"data-testid":"dispatch-detail-indent",className:"min-w-0 border-l border-border/70 pl-3",children:[h.jsx("div",{"data-testid":"dispatch-detail",className:"assistant-markdown markdown-attached min-w-0 break-words",children:h.jsx(yl,{remarkPlugins:[_l],components:o,...r?{urlTransform:xM}:{},children:e.detail})}),e.filePaths.length>0?h.jsxs("div",{"data-testid":"dispatch-files",className:"flex min-w-0 flex-col gap-1 pt-2",children:[h.jsx("span",{className:"text-[11px] text-text-400",children:"产物"}),e.filePaths.map(f=>h.jsx(pie,{path:f,...r?{onOpenFilePath:r}:{}},f))]}):null]})}),h.jsxs("button",{type:"button","data-testid":"dispatch-collapse-foot",onClick:()=>s(!1),className:ie("flex w-full cursor-pointer items-center justify-between gap-2 border-t bg-bg-200/35 px-3 py-1 text-[10px] text-text-400 transition-colors hover:bg-bg-200/60",d.seam),children:[h.jsx("span",{className:"min-w-0 truncate",children:e.dispatchId?h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"台账 "}),h.jsx("span",{"data-testid":"dispatch-id",className:"font-mono",children:e.dispatchId})]}):null}),h.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:["收起",h.jsx(a4,{className:"h-3 w-3"})]})]})]}):null]})]})}function pie({path:e,onOpenFilePath:t}){const n="inline-flex min-w-0 items-center gap-1.5 text-left text-[11px] font-mono text-text-300";return t?h.jsxs("button",{type:"button","data-testid":"dispatch-file-path",title:e,onClick:()=>t(e),className:ie(n,"hover:text-text-100 hover:underline"),children:[h.jsx(Ci,{className:"h-3 w-3 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:e})]}):h.jsxs("span",{"data-testid":"dispatch-file-path",title:e,className:n,children:[h.jsx(Ci,{className:"h-3 w-3 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:e})]})}function mie({text:e,metaSource:t}){return t==="owner"?h.jsx("div",{className:"flex min-w-0 max-w-full flex-col items-start py-1.5","data-testid":"msg-line-owner-meta",children:h.jsxs("div",{className:ie("inline-flex min-w-0 max-w-[85%] items-start gap-2 rounded-md","border-l-[3px] border-accent bg-accent-dim px-3 py-2"),children:[h.jsx(fF,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-accent","aria-label":"补充信息"}),h.jsx("span",{className:"min-w-0 text-[12px] leading-relaxed text-text-100 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e})]})}):h.jsxs("div",{className:"flex min-w-0 max-w-full items-start gap-1.5 py-1 text-[11px] text-text-400","data-testid":"msg-line-cc-meta",children:[h.jsx(u4,{className:"mt-0.5 h-3 w-3 shrink-0"}),h.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e})]})}function ii(e,t){const r=new RegExp(`<${t}\\b[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(!r)return;const i=r[1].trim();return i||void 0}function r0(e,t){const r=new RegExp(`${t}\\s*=\\s*"([^"]+)"`,"i").exec(e);if(!r)return;const i=Number(r[1]);return Number.isFinite(i)?i:void 0}function CM(e){var i,s,o;const t={};if(!e)return t;t.taskId=ii(e,"task-id"),t.toolUseId=ii(e,"tool-use-id"),t.outputFile=ii(e,"output-file"),t.status=ii(e,"status"),t.summary=ii(e,"summary"),t.result=ii(e,"result");const n=ii(e,"usage");if(n){const a=(i=/<total_tokens>\s*(\d+)\s*<\/total_tokens>/i.exec(n))==null?void 0:i[1],l=(s=/<tool_uses>\s*(\d+)\s*<\/tool_uses>/i.exec(n))==null?void 0:s[1],c=(o=/<duration_ms>\s*(\d+)\s*<\/duration_ms>/i.exec(n))==null?void 0:o[1];a&&(t.totalTokens=Number(a)),l&&(t.toolUses=Number(l)),c&&(t.durationMs=Number(c))}const r=ii(e,"worktree");if(r)t.worktreePath=ii(r,"worktreePath"),t.worktreeBranch=ii(r,"worktreeBranch");else{const a=/<worktree\b([^>]*)\/>/i.exec(e);if(a){const l=a[1],c=/worktreePath\s*=\s*"([^"]+)"/i.exec(l),u=/worktreeBranch\s*=\s*"([^"]+)"/i.exec(l);c&&(t.worktreePath=c[1]),u&&(t.worktreeBranch=u[1])}}if(t.totalTokens===void 0&&t.toolUses===void 0&&t.durationMs===void 0){const a=r0(e,"total_tokens"),l=r0(e,"tool_uses"),c=r0(e,"duration_ms");a!==void 0&&(t.totalTokens=a),l!==void 0&&(t.toolUses=l),c!==void 0&&(t.durationMs=c)}return t}function gie(e){if(!e||!Number.isFinite(e))return null;if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/60),r=Math.round(t-n*60);return`${n}m${r.toString().padStart(2,"0")}s`}function vie({text:e,taskId:t,parentToolUseId:n}){const r=g.useMemo(()=>CM(e),[e]),[i,s]=g.useState(!1),o=t??r.taskId,a=n??r.toolUseId,l=r.status==="failed"?h.jsx(Jo,{className:"w-3.5 h-3.5 text-error"}):r.status==="completed"?h.jsx(e_,{className:"w-3.5 h-3.5 text-success"}):h.jsx(em,{className:"w-3.5 h-3.5 text-text-400"}),c=r.status??"unknown",u=gie(r.durationMs);return h.jsxs("div",{"data-testid":"msg-line-agent-notification","data-task-id":o??"","data-parent-tool-use-id":a??"",className:"my-1 min-w-0 max-w-full rounded-md border border-bg-200/60 bg-bg-100/40",children:[h.jsxs("button",{type:"button","aria-expanded":i,onClick:()=>s(d=>!d),className:ie("flex w-full min-w-0 items-start gap-2 px-2.5 py-1.5 text-left text-[12px]","hover:bg-bg-200/40 rounded-md transition-colors"),children:[h.jsx("span",{className:"mt-[2px] shrink-0",children:l}),h.jsxs("span",{className:"flex-1 min-w-0",children:[h.jsxs("span",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx("span",{className:"font-medium text-text-200",children:"子任务"}),h.jsx("span",{className:"text-text-400 text-[11px] font-mono",children:o?o.slice(0,12):"未知"}),h.jsx("span",{className:"text-text-400 text-[11px] uppercase tracking-wide",children:c}),u?h.jsxs("span",{className:"text-text-400 text-[11px] tabular-nums",children:["· ",u]}):null,r.totalTokens?h.jsxs("span",{className:"text-text-400 text-[11px] tabular-nums",children:["· ",r.totalTokens," tok"]}):null,r.toolUses?h.jsxs("span",{className:"text-text-400 text-[11px] tabular-nums",children:["· ",r.toolUses," tools"]}):null]}),r.summary?h.jsx("span",{className:"block truncate text-text-300 text-[12px] mt-0.5",children:r.summary}):null]}),i?h.jsx(Pn,{className:"w-3.5 h-3.5 mt-[3px] text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 mt-[3px] text-text-400 shrink-0"})]}),i?h.jsxs("div",{"data-testid":"agent-notification-body",className:"min-w-0 border-t border-bg-200/60 px-3 py-2 text-[12px] text-text-300 space-y-2",children:[r.worktreePath||r.worktreeBranch?h.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-text-400",children:[h.jsx(ku,{className:"w-3 h-3"}),r.worktreeBranch?h.jsx("span",{className:"font-mono",children:r.worktreeBranch}):null,r.worktreePath?h.jsx("span",{className:"truncate font-mono",children:r.worktreePath}):null]}):null,r.outputFile?h.jsxs("div",{className:"text-[11px] text-text-400",children:[h.jsx("span",{children:"输出文件:"}),h.jsx("span",{className:"font-mono",children:r.outputFile})]}):null,a?h.jsxs("div",{className:"text-[11px] text-text-400",children:[h.jsx("span",{children:"父工具调用:"}),h.jsx("span",{className:"font-mono",children:a})]}):null,r.result?h.jsx("div",{"data-testid":"agent-notification-result",className:"assistant-markdown text-[12px] leading-relaxed break-words",children:h.jsx(yl,{remarkPlugins:[_l],components:Qs,children:r.result})}):h.jsx("div",{className:"text-[11px] text-text-400 italic",children:"无详细结果"})]}):null]})}const EM=g.createContext(null);function xie({children:e}){const[t,n]=g.useState({agentId:null}),r=g.useCallback((o,a)=>{n({agentId:o,agentType:a})},[]),i=g.useCallback(()=>{n(o=>({agentId:null,agentType:o.agentType}))},[]),s=g.useMemo(()=>({state:t,open:r,close:i}),[t,r,i]);return h.jsx(EM.Provider,{value:s,children:e})}function IM(){return g.useContext(EM)}function yie(e){if(e==null)return null;if(typeof e=="string")return e;if(Array.isArray(e)){const t=[];for(const n of e)if(n&&typeof n=="object"){const r=n;r.type==="text"&&typeof r.text=="string"&&t.push(r.text)}else typeof n=="string"&&t.push(n);return t.length?t.join(`
|
|
570
|
-
`):null}if(typeof e=="object"){const t=e;if(typeof t.text=="string")return t.text}return null}function x2(e){if(!e||!Number.isFinite(e))return null;if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/60),r=Math.round(t-n*60);return`${n}m${r.toString().padStart(2,"0")}s`}function _ie(e){return!e||!Number.isFinite(e)?null:e<1e3?`${e} tok`:e<1e4?`${(e/1e3).toFixed(1)}k tok`:`${Math.round(e/1e3)}k tok`}const bie={readCount:"read",searchCount:"search",bashCount:"bash",editFileCount:"edit",linesAdded:"+lines",linesRemoved:"-lines",otherToolCount:"other"};function wie(e){if(!e)return[];const t=[];for(const[n,r]of Object.entries(e)){if(!r||r<=0)continue;const i=bie[n]??n;t.push(`${i}:${r}`)}return t}function Sie({expandable:e,expanded:t,onToggle:n,children:r}){const i=ie("flex w-full min-w-0 items-center gap-2 px-2.5 py-1.5 text-left text-[13px] rounded-md",e&&"hover:bg-bg-200/40 transition-colors");return e?h.jsx("button",{type:"button","aria-expanded":t,onClick:n,className:i,children:r}):h.jsx("div",{className:i,children:r})}function NM({description:e,input:t,output:n,error:r,pending:i,notifications:s,toolResultExtra:o,progress:a,expandable:l=!0}){const[c,u]=g.useState(!1),d=IM(),f=g.useMemo(()=>{if(!t||typeof t!="object")return null;const R=t;return typeof R.prompt=="string"?R.prompt:null},[t]),p=g.useMemo(()=>{if(!t||typeof t!="object")return;const R=t.agentId;return typeof R=="string"&&R.length>0?R:void 0},[t]),m=(o==null?void 0:o.prompt)??f,v=g.useMemo(()=>yie(n),[n]),w=o==null?void 0:o.stats,x=a==null?void 0:a.stats,_=x2((w==null?void 0:w.durationMs)??(x==null?void 0:x.durationMs)),b=_ie((w==null?void 0:w.tokens)??(x==null?void 0:x.tokens)),S=wie(w==null?void 0:w.toolStats),C=eR({pending:i,error:r,notifications:s,progress:a,input:t}),k=C&&(a!=null&&a.lastToolName)?`now:${a.lastToolName}`:null,T=!!(o!=null&&o.agentType||_||b||S.length>0||k),E=(o==null?void 0:o.agentId)??(a==null?void 0:a.agentId)??p,D=!!(r||(a==null?void 0:a.status)==="failed"),N=g.useMemo(()=>s.map(R=>({taskId:R.taskId,text:R.text,parsed:CM(R.text)})),[s]),L=D?h.jsx(Jo,{className:"w-3.5 h-3.5 text-error"}):C?h.jsx(Tn,{className:"w-3.5 h-3.5 text-blue-400 animate-spin"}):h.jsx(e_,{className:"w-3.5 h-3.5 text-green-500"});return h.jsxs("div",{"data-testid":"msg-line-agent-call","data-pending":i?"true":"false","data-active":C?"true":"false","data-has-error":D?"true":"false","data-notification-count":s.length,"data-has-stats":T?"true":"false","data-agent-id":E??"",className:"my-1 min-w-0 max-w-full rounded-md border border-bg-200/60 bg-bg-100/30",children:[h.jsxs(Sie,{expandable:l,expanded:c,onToggle:()=>u(R=>!R),children:[h.jsx("span",{className:"w-5 h-5 flex items-center justify-center text-[10px] rounded bg-violet-500/10 text-violet-500 shrink-0","aria-hidden":!0,children:h.jsx(rH,{className:"w-3 h-3"})}),h.jsx("span",{className:"shrink-0",children:L}),h.jsx("span",{className:"flex-1 min-w-0 truncate font-medium text-text-200",children:e}),T?null:s.length>0?h.jsxs("span",{className:"text-[11px] text-text-400 tabular-nums shrink-0",children:[s.length," 次通知"]}):null,E&&(d!=null&&d.open)?h.jsx("span",{role:"button",tabIndex:0,"data-testid":"open-subagent-btn-header","data-agent-id":E,"aria-label":"打开子 agent 对话",onClick:R=>{R.stopPropagation(),d.open(E,o==null?void 0:o.agentType)},onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.stopPropagation(),R.preventDefault(),d.open(E,o==null?void 0:o.agentType))},className:"shrink-0 inline-flex items-center justify-center w-3.5 h-3.5 text-text-400 hover:text-text-200",children:h.jsx(Su,{className:"w-3.5 h-3.5"})}):null,l?c?h.jsx(Pn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):null]}),C&&(a!=null&&a.description)?h.jsx("div",{"data-testid":"agent-call-progress-desc",className:"px-3 pt-0 pb-1 text-[12px] text-text-300 truncate",children:a.description}):null,T?h.jsxs("div",{"data-testid":"agent-call-stats",className:"flex items-center gap-1.5 flex-wrap px-3 pb-1.5 pt-0 text-[11px] text-text-400",children:[o!=null&&o.agentType?h.jsx("span",{"data-testid":"agent-call-stats-type",className:"inline-flex items-center rounded-sm bg-violet-500/10 px-1.5 py-0.5 text-violet-400 font-medium",children:o.agentType}):null,_?h.jsx("span",{className:"tabular-nums",children:_}):null,b?h.jsx("span",{className:"tabular-nums",children:b}):null,k?h.jsx("span",{"data-testid":"agent-call-stats-now",className:"font-mono tabular-nums text-blue-400",children:k}):null,S.map(R=>h.jsx("span",{className:"font-mono tabular-nums text-text-400/80",children:R},R)),s.length>0?h.jsxs("span",{className:"tabular-nums text-text-400/70",children:["· ",s.length," 次通知"]}):null]}):null,c?h.jsxs("div",{"data-testid":"agent-call-body",className:"min-w-0 border-t border-bg-200/60 px-3 py-2 space-y-3",children:[r?h.jsx("div",{className:"text-[12px] text-error whitespace-pre-wrap",children:r}):null,N.map((R,M)=>{const A=R.parsed,j=x2(A.durationMs);return h.jsxs("div",{"data-testid":"agent-call-notification","data-task-id":R.taskId??"",className:"min-w-0 rounded-md border border-bg-200/60 bg-bg-0/40 p-2 space-y-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-text-400 flex-wrap",children:[h.jsx("span",{className:"font-mono",children:(R.taskId??A.taskId??"未知").slice(0,12)}),h.jsx("span",{className:"uppercase tracking-wide",children:A.status??"unknown"}),j?h.jsxs("span",{className:"tabular-nums",children:["· ",j]}):null,A.totalTokens?h.jsxs("span",{className:"tabular-nums",children:["· ",A.totalTokens," tok"]}):null,A.toolUses?h.jsxs("span",{className:"tabular-nums",children:["· ",A.toolUses," tools"]}):null,A.worktreeBranch?h.jsxs("span",{className:"font-mono",children:["· ",A.worktreeBranch]}):null]}),A.summary?h.jsx("div",{className:"text-[12px] text-text-300",children:A.summary}):null,A.result?h.jsx("div",{"data-testid":"agent-call-notification-result",className:"assistant-markdown text-[12px] leading-relaxed break-words",children:h.jsx(yl,{remarkPlugins:[_l],components:Qs,children:A.result})}):null]},`${R.taskId??"n"}-${M}`)}),m?h.jsxs("div",{"data-testid":"agent-call-prompt-block",className:"min-w-0 space-y-1",children:[h.jsx("div",{className:"text-[11px] text-text-400 font-medium",children:"任务指令"}),h.jsx("pre",{"data-testid":"agent-call-prompt",className:"max-w-full whitespace-pre-wrap break-words text-[11px] text-text-300 bg-bg-50/60 rounded p-2 border border-bg-200/60 max-h-64 overflow-auto [overflow-wrap:anywhere]",children:m})]}):null,v?h.jsxs("div",{"data-testid":"agent-call-result-block",className:"min-w-0 space-y-1",children:[h.jsx("div",{className:"text-[11px] text-text-400 font-medium",children:"子 agent 报告"}),h.jsx("div",{"data-testid":"agent-call-result",className:"assistant-markdown text-[12px] leading-relaxed break-words",children:h.jsx(yl,{remarkPlugins:[_l],components:Qs,children:v})})]}):null,!v&&N.length===0&&!r&&!m?h.jsx("div",{className:"text-[11px] text-text-400 italic",children:"无详细信息"}):null,E&&(d!=null&&d.open)?h.jsx("div",{className:"flex justify-end",children:h.jsxs("button",{type:"button","data-testid":"open-subagent-btn","data-agent-id":E,onClick:()=>d.open(E,o==null?void 0:o.agentType),className:ie("inline-flex items-center gap-1 rounded-md border border-bg-200/60","bg-bg-100/40 hover:bg-bg-200/40 transition-colors","px-2 py-1 text-[11px] text-text-300"),children:[h.jsx(Su,{className:"w-3 h-3"}),h.jsx("span",{children:"打开子 agent 对话"})]})}):null]}):null]})}function TM({title:e,items:t,progressColor:n="bg-green-500",listKind:r}){const[i,s]=g.useState(!1),o=t.length,a=t.filter(c=>c.status==="completed").length,l=o>0?Math.round(a/o*100):0;return h.jsxs("div",{"data-testid":"msg-line-checklist","data-list-kind":r,className:"min-w-0 max-w-full py-1",children:[h.jsxs("button",{type:"button",onClick:()=>s(c=>!c),"aria-expanded":i,className:"flex items-center gap-2.5 w-full text-left rounded-md px-1.5 py-1 hover:bg-text-100/5 cursor-pointer",children:[i?h.jsx(Pn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}),h.jsx("span",{className:"text-[13px] font-medium text-text-200",children:e}),h.jsxs("span",{className:"text-[11px] text-text-400 tabular-nums",children:[a,"/",o]}),h.jsx("div",{className:"flex-1 max-w-[120px] h-1.5 rounded-full bg-text-100/10 overflow-hidden",children:h.jsx("div",{className:ie("h-full rounded-full transition-all duration-300",n),style:{width:`${l}%`}})})]}),i?h.jsx("div",{"data-testid":"checklist-body",className:"ml-6 mt-0.5",children:h.jsx("div",{className:"space-y-px",children:t.map((c,u)=>h.jsxs("div",{className:"flex min-w-0 items-start gap-2 py-0.5 px-1",children:[h.jsx("span",{className:"w-4 h-4 mt-0.5 flex items-center justify-center shrink-0",children:c.status==="completed"?h.jsx(Qo,{className:"w-3.5 h-3.5 text-green-500"}):h.jsx("span",{className:"w-2 h-2 rounded-full border border-text-400/40"})}),h.jsx("span",{className:ie("min-w-0 text-[13px] leading-snug break-words [overflow-wrap:anywhere]",c.status==="completed"?"text-text-400 line-through":"text-text-200"),children:c.status==="in_progress"&&c.activeForm?c.activeForm:c.content})]},`${u}-${c.content}`))})}):null]})}function kie({todos:e}){return h.jsx(TM,{title:"Tasks",items:e,progressColor:"bg-green-500",listKind:"todo"})}function Cie({tasks:e}){return h.jsx(TM,{title:"Plan",items:e,progressColor:"bg-blue-500",listKind:"plan"})}function Eie(e){if(!e||!Number.isFinite(e))return null;const t=Date.now()-e;if(t<0)return null;const n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);if(i<24)return`${i}h ago`;const s=Math.floor(i/24);if(s<7)return`${s}d ago`;const o=Math.floor(s/7);return o<5?`${o}w ago`:new Date(e).toISOString().slice(0,10)}function Iie(e){return(e.split("/").pop()??e)||e}function Nie({memories:e}){return!e||e.length===0?null:h.jsxs("div",{"data-testid":"memory-callout",className:"my-1 min-w-0 max-w-full rounded-md border border-bg-200/60 bg-bg-100/30",children:[h.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[12px] text-text-300 border-b border-bg-200/60",children:[h.jsx(m7,{className:"w-3.5 h-3.5 text-amber-500 shrink-0"}),h.jsx("span",{className:"font-medium",children:"项目记忆"}),h.jsxs("span",{className:"text-text-400 tabular-nums",children:["· ",e.length]})]}),h.jsx("ul",{className:"divide-y divide-bg-200/40",children:e.map(t=>h.jsx(Tie,{memory:t},t.path))})]})}function Tie({memory:e}){const[t,n]=g.useState(!1),r=Eie(e.mtimeMs),i=e.content.replace(/\s+/g," ").trim().slice(0,80);return h.jsxs("li",{className:"px-2.5 py-1.5",children:[h.jsxs("button",{type:"button","aria-expanded":t,onClick:()=>n(s=>!s),className:ie("flex w-full items-center gap-1.5 text-left text-[12px]","hover:bg-bg-200/30 rounded-sm py-0.5"),children:[t?h.jsx(Pn,{className:"w-3 h-3 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3 h-3 text-text-400 shrink-0"}),h.jsx("span",{className:"font-mono text-text-300 shrink-0 max-w-[20ch] truncate",title:e.path,children:Iie(e.path)}),h.jsx("span",{className:"flex-1 min-w-0 truncate text-text-400/80",children:i}),r?h.jsx("span",{className:"shrink-0 text-[11px] text-text-400 tabular-nums",children:r}):null]}),t?h.jsx("pre",{"data-testid":"memory-callout-body",className:"mt-1 max-w-full whitespace-pre-wrap break-words text-[12px] text-text-300 bg-bg-50/60 rounded-md p-2 border border-bg-200/60 [overflow-wrap:anywhere]",children:e.content}):null]})}function Pie({toolUseId:e,questions:t,onSubmit:n,onCancel:r,submittedAnswers:i}){const[s,o]=g.useState({}),[a,l]=g.useState({}),[c,u]=g.useState({}),[d,f]=g.useState(!1),[p,m]=g.useState(!1),v=i!==void 0&&Object.keys(i).length>0,w=v||p,x=!n&&!v,_=(k,T)=>{const E={labels:new Set,freeText:""};if(!v||!i)return E;const D=i[k];if(typeof D!="string")return E;const N=D.split(",").map(A=>A.trim()).filter(Boolean),L=new Set(T.map(A=>A.label)),R=new Set,M=[];for(const A of N)L.has(A)?R.add(A):M.push(A);return{labels:R,freeText:M.join(", ")}},b=g.useMemo(()=>t.every(k=>{if((c[k.question]??"").trim().length>0)return!0;if(k.multiSelect){const E=a[k.question];return!!(E&&E.size>0)}return typeof s[k.question]=="string"&&s[k.question].length>0}),[t,s,a,c]),S=async()=>{if(!b||d||w||x||!n)return;const k={};for(const T of t){const E=(c[T.question]??"").trim();if(T.multiSelect){const D=a[T.question],N=D?T.options.filter(L=>D.has(L.label)).map(L=>L.label):[];if(E.length>0&&N.push(E),N.length===0)continue;k[T.question]=N.join(", ")}else if(E.length>0)k[T.question]=E;else{const D=s[T.question];typeof D=="string"&&(k[T.question]=D)}}f(!0);try{await n(k),m(!0)}finally{f(!1)}},C=ed(()=>{S()});return h.jsxs("div",{"data-testid":"msg-line-question","data-tool-use-id":e,className:"min-w-0 max-w-full rounded-md border border-accent/40 bg-accent/5 px-3 py-2.5 text-[13px]",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2 mb-2",children:[h.jsx(E7,{className:"w-4 h-4 text-accent shrink-0"}),h.jsx("span",{className:"min-w-0 font-medium text-text-100",children:"需要你的回答 / Need your answer"}),t.length>1?h.jsxs("span",{className:"ml-auto text-[12px] text-text-400","data-testid":"msg-line-question-count",children:[t.length," 个问题"]}):null]}),h.jsx("div",{className:"flex flex-col gap-3 mb-3",children:t.map((k,T)=>{const E=`q-${T}`,D=`${e}-${T}`,N=_(k.question,k.options),L=w||x,R=c[k.question]??"",M=v?N.freeText:p?(c[k.question]??"").trim():"";return h.jsxs("div",{"data-testid":"msg-line-question-item",children:[k.question?h.jsx("div",{className:"text-text-200 mb-1.5",children:k.question}):null,h.jsx("div",{className:"flex flex-col gap-1",children:k.options.map((A,j)=>{var $;const z=`${E}-${j}`,F=v?N.labels.has(A.label):k.multiSelect?!!(($=a[k.question])!=null&&$.has(A.label)):s[k.question]===A.label;return h.jsxs("label",{className:"flex min-w-0 items-start gap-2 cursor-pointer select-none py-1 px-2 rounded hover:bg-bg-100",children:[h.jsx("input",{type:k.multiSelect?"checkbox":"radio",name:D,value:A.label,checked:F,disabled:w||x,onChange:()=>{w||x||(k.multiSelect?l(B=>{const I=new Set(B[k.question]??[]);return I.has(A.label)?I.delete(A.label):I.add(A.label),{...B,[k.question]:I}}):o(B=>({...B,[k.question]:A.label})))},className:"mt-0.5","data-testid":"msg-line-question-option"}),h.jsxs("span",{className:"flex min-w-0 flex-col",children:[h.jsx("span",{className:"text-text-100 [overflow-wrap:anywhere]",children:A.label}),A.description?h.jsx("span",{className:"text-[12px] text-text-400 [overflow-wrap:anywhere]",children:A.description}):null]})]},z)})}),L?M.length>0?h.jsx("div",{className:"mt-2 rounded-lg border border-accent/15 bg-bg-100/60 px-3 py-2 text-[13px] leading-relaxed text-text-200 [overflow-wrap:anywhere]","data-testid":"msg-line-question-freetext-result",children:M}):null:h.jsx("textarea",{rows:3,value:R,placeholder:"或自行输入回答...",onChange:A=>{const j=A.target.value;u(z=>({...z,[k.question]:j}))},...C,className:"mt-2 w-full resize-y rounded-lg border border-accent/20 bg-bg-000/60 px-3 py-2 text-[13px] leading-relaxed text-text-100 placeholder:text-text-400 outline-none transition-colors focus:border-accent/60 focus:bg-bg-000","data-testid":"msg-line-question-freetext"})]},E)})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(tl,{size:"sm",variant:"default",onClick:()=>void S(),disabled:!b||d||w||x,"data-testid":"msg-line-question-submit",children:w?"已提交 / Submitted":x?"已结束 / Ended":"提交 / Submit"}),r&&!w&&!x?h.jsx(tl,{size:"sm",variant:"ghost",onClick:()=>void r(),disabled:d,"data-testid":"msg-line-question-cancel",children:"跳过 / Skip"}):null]})]})}function Rie({toolUseId:e,questions:t,historicalAnswers:n,realtimeAnswers:r,onSubmit:i,onCancel:s}){const o=r??n,a=g.useCallback(async c=>{i&&await i(e,c)},[i,e]),l=g.useCallback(async()=>{s&&await s(e)},[s,e]);return h.jsx(Pie,{toolUseId:e,questions:t,onSubmit:i?a:void 0,...s?{onCancel:l}:{},submittedAnswers:o})}function Mie(){const e=new Map,t=(n,r)=>`${n}::${r}`;return{register(n,r,i){e.set(t(n,r),i)},resolve(n,r){return n?e.get(t(n,r))??null:null},reset(){e.clear()}}}const za=Mie();function PM({lines:e,onPermissionRespond:t,onPermissionInterrupt:n,topSlot:r,onRewind:i,rewindableUserMessageIds:s,onFork:o,onQuickAsk:a,forkByTurn:l=!1,realtimeQuestionAnswers:c,onSubmitQuestion:u,onCancelQuestion:d,liveQuestionToolUseIds:f,fileSharingScope:p,onShareFile:m,onOpenInTab:v,onPreviewMarkdown:w,onOpenFilePath:x,dispatchOrigin:_,turnCollapse:b,dockedAgentToolUseIds:S,codexHistory:C}){const k=g.useMemo(()=>tR(e),[e]),T=g.useMemo(()=>{const N=new Map;let L;for(const R of k)R.kind==="user-text"&&R.continuesTurn!==!0&&(L=void 0),R.kind==="assistant-text"&&(L=R.seq),R.kind==="turn-end"&&(R.turnId&&R.reason!=="interrupted"&&L!==void 0&&N.set(L,R.turnId),L=void 0);return N},[k]),E=g.useMemo(()=>b?NY(k,b):null,[k,b]),D={codexHistory:C,onRewind:i,rewindableUserMessageIds:s,onPermissionRespond:t,onPermissionInterrupt:n,onFork:o,onQuickAsk:a,forkByTurn:l,codexForkAnchors:T,realtimeQuestionAnswers:c,onSubmitQuestion:u,onCancelQuestion:d,liveQuestionToolUseIds:f,fileSharingScope:p,onShareFile:m,onOpenInTab:v,onPreviewMarkdown:w,onOpenFilePath:x,dispatchOrigin:_,dockedAgentToolUseIds:S};return h.jsxs("div",{"data-testid":"message-list",className:"flex w-full min-w-0 max-w-full flex-col gap-2 px-4 py-3",children:[r,E!==null?E.map(N=>Aie(N,D)):k.map(N=>sp(N,D))]})}function Aie(e,t){var l;const n=e.turnId?`turn-${e.turnId}`:`turn-${e.seq}`,r=e.turnId&&((l=t.codexHistory)!=null&&l.turnIds.has(e.turnId))?t.codexHistory:void 0,i=e.turnId?r==null?void 0:r.details[e.turnId]:void 0,s=e.query?sp(e.query,t):null,o=e.process.map(c=>jie(c,t)),a=e.tail.map(c=>sp(c,t));return e.status==="running"?h.jsxs(Je.Fragment,{children:[s,o,a]},n):h.jsxs("div",{"data-history-turn-id":e.turnId,className:"flex flex-col gap-2",children:[s,h.jsxs(zY,{status:e.status,onExpandedChange:r&&e.turnId?c=>{c&&r.loadDetails(e.turnId)}:void 0,...e.durationMs!==void 0?{durationMs:e.durationMs}:{},children:[o,r&&!i?h.jsx("span",{className:"text-text-400 text-xs",children:"展开后加载过程"}):null,i!=null&&i.loading?h.jsx("span",{className:"text-text-400 text-xs","data-testid":"turn-details-loading",children:"正在加载过程…"}):null,i!=null&&i.error?h.jsxs("div",{className:"text-destructive text-xs","data-testid":"turn-details-error",children:[i.error," ",h.jsx("button",{type:"button",onClick:()=>void(r==null?void 0:r.loadDetails(e.turnId)),children:"重试"})]}):null,i!=null&&i.nextCursor&&!i.loading&&!i.error?h.jsx("button",{type:"button",className:"text-accent text-xs",onClick:()=>void(r==null?void 0:r.loadDetails(e.turnId,!0)),children:"加载更多过程"}):null,i&&!i.loading&&!i.error&&i.items.length===0?h.jsx("span",{className:"text-text-400 text-xs",children:"没有更多过程"}):null]}),a]},n)}function jie(e,t){return e.kind==="tool-group"?h.jsx(OY,{items:e.items,renderItemDetail:n=>Lie(n,t)},`tool-group-${e.seq}`):sp(e,t)}function Lie(e,t){const n=za.resolve(e.toolKind,e.tool);return n?n.render({input:e.input,output:e.output,error:e.error,pending:e.pending,toolUseId:e.toolUseId,...t.fileSharingScope?{fileScope:t.fileSharingScope}:{},...t.onShareFile?{onShareFile:t.onShareFile}:{},...t.onOpenInTab?{onOpenInTab:t.onOpenInTab}:{},...t.onPreviewMarkdown?{onPreviewMarkdown:t.onPreviewMarkdown}:{}}):null}function sp(e,t){var b;const{onRewind:n,rewindableUserMessageIds:r,onPermissionRespond:i,onPermissionInterrupt:s,onFork:o,onQuickAsk:a,realtimeQuestionAnswers:l,onSubmitQuestion:c,onCancelQuestion:u,liveQuestionToolUseIds:d,fileSharingScope:f,onShareFile:p,onOpenInTab:m,onPreviewMarkdown:v,onOpenFilePath:w,dispatchOrigin:x}=t,_=`${e.kind}-${e.seq}`;switch(e.kind){case"session-init":return null;case"user-text":{const S=typeof e.uuid=="string"?e.uuid:void 0,C=!!(n&&S&&(!r||r.has(S)));return h.jsx(rie,{text:e.text,senderDisplayName:e.senderDisplayName,senderPrincipal:e.senderPrincipal,rewindTarget:C&&S&&n?{userMessageId:S,onRewind:n}:void 0},_)}case"user-meta":return Zp(e.metaKind)?h.jsx(cie,{text:e.text,metaKind:e.metaKind,...x!=null&&x.resolve?{resolveDispatchOrigin:x.resolve}:{},...x!=null&&x.onOpenSession?{onOpenSession:x.onOpenSession}:{},...w?{onOpenFilePath:w}:{}},_):h.jsx(kM,{metaKind:e.metaKind,text:e.text},_);case"meta-text":return h.jsx(mie,{text:e.text,metaSource:e.metaSource},_);case"agent-notification":return h.jsx(vie,{text:e.text,taskId:e.taskId,parentToolUseId:e.parentToolUseId},_);case"assistant-text":{const S=t.forkByTurn?t.codexForkAnchors.get(e.seq):typeof e.uuid=="string"?e.uuid:void 0,C=S&&(o||a)?{messageUuid:S,onFork:o,onQuickAsk:a}:void 0;return h.jsx(Ere,{text:qY(e.text),forkTarget:C,...w?{onOpenFilePath:w}:{}},_)}case"assistant-thinking":return h.jsx(Ire,{text:e.text},_);case"permission-inline":return h.jsx(Jre,{tool:e.tool,input:e.input,onRespond:i??(()=>{}),onInterrupt:s},_);case"error":return h.jsx(eie,{message:e.message},_);case"turn-end":return null;case"merged-tool":return Die(e,_,{fileSharingScope:f,onShareFile:p,onOpenInTab:m,onPreviewMarkdown:v});case"merged-agent":return(b=t.dockedAgentToolUseIds)!=null&&b.has(e.toolUseId)?null:h.jsx(NM,{description:e.description,input:e.input,output:e.output,error:e.error,pending:e.pending,notifications:e.notifications,toolResultExtra:e.toolResultExtra,progress:e.progress},_);case"plan-card":return h.jsx(Cie,{tasks:e.tasks},_);case"todo-checklist":return h.jsx(kie,{todos:e.todos},_);case"memory-callout":return h.jsx(Nie,{memories:e.memories},_);case"question-card":{const S=d===void 0||d.has(e.toolUseId);return h.jsx(Rie,{toolUseId:e.toolUseId,questions:e.questions,historicalAnswers:e.submittedAnswers,realtimeAnswers:l==null?void 0:l[e.toolUseId],onSubmit:S?c:void 0,...S&&u?{onCancel:u}:{}},_)}default:return null}}function Die(e,t,n){const r=za.resolve(e.toolKind,e.tool),i=r?r.render({input:e.input,output:e.output,error:e.error,pending:e.pending,toolUseId:e.toolUseId,...n.fileSharingScope?{fileScope:n.fileSharingScope}:{},...n.onShareFile?{onShareFile:n.onShareFile}:{},...n.onOpenInTab?{onOpenInTab:n.onOpenInTab}:{},...n.onPreviewMarkdown?{onPreviewMarkdown:n.onPreviewMarkdown}:{}}):null;return h.jsx(Je.Fragment,{children:i??h.jsx(wM,{tool:e.tool,input:e.input,output:e.output,error:e.error,pending:e.pending,...n.fileSharingScope?{fileScope:n.fileSharingScope}:{},...n.onShareFile?{onShareFile:n.onShareFile}:{},...n.onOpenInTab?{onOpenInTab:n.onOpenInTab}:{},...n.onPreviewMarkdown?{onPreviewMarkdown:n.onPreviewMarkdown}:{}})},t)}function y2(e){const t=e.getBoundingClientRect().top,n=[...e.querySelectorAll("[data-history-turn-id]")].find(r=>r.getBoundingClientRect().bottom>t);return n!=null&&n.dataset.historyTurnId?{turnId:n.dataset.historyTurnId,offset:n.getBoundingClientRect().top-t}:null}function Oie(e,t){const n=[...e.querySelectorAll("[data-history-turn-id]")].find(r=>r.dataset.historyTurnId===t.turnId);n&&(e.scrollTop+=n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.offset)}const Bie={builtin:"Commands",global:"Global",project:"Project",plugin:"Plugin"},_2={builtin:0,global:1,project:2,plugin:3};function $ie({query:e,skills:t,activeIndex:n,onActiveIndexChange:r,onSelect:i}){const s=g.useRef(null),o=g.useMemo(()=>RM(t,e),[t,e]),a=g.useMemo(()=>{const l=new Set;let c=null;for(let u=0;u<o.length;u++)o[u].source!==c&&(l.add(u),c=o[u].source);return l},[o]);return g.useEffect(()=>{var l;try{(l=s.current)==null||l.scrollIntoView({block:"nearest"})}catch{}},[n]),o.length===0?null:h.jsx("div",{"data-testid":"cc-skill-selector",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 max-h-[320px] overflow-y-auto rounded-2xl border border-bg-300 bg-bg-50 shadow-lg",children:o.map((l,c)=>{const u=c===n,d=a.has(c);return h.jsxs(Je.Fragment,{children:[d?h.jsx("div",{className:"sticky top-0 z-10 bg-bg-50/95 backdrop-blur-sm px-4 py-2 text-[10px] font-semibold uppercase tracking-wider text-text-400/70 border-b border-bg-200/60",children:Bie[l.source]}):null,h.jsxs("div",{ref:u?s:void 0,"data-testid":`cc-skill-item-${l.name}`,onMouseEnter:()=>r(c),onClick:()=>i(l),className:ie("flex items-center gap-2.5 px-4 py-2 cursor-pointer transition-colors duration-75",u?"bg-[var(--text-100-dim)]":"hover:bg-bg-100/60"),children:[h.jsxs("code",{className:"text-[12px] font-mono font-semibold text-text-100 shrink-0",children:["/",l.name]}),l.description?h.jsx("span",{className:"text-[11px] text-text-300 truncate ml-auto",children:l.description}):null]})]},`${l.source}/${l.name}`)})})}function RM(e,t){const n=t.trim().toLowerCase(),r=n?e.filter(i=>i.name.toLowerCase().includes(n)||(i.description??"").toLowerCase().includes(n)):e.slice();return r.sort((i,s)=>(_2[i.source]??9)-(_2[s.source]??9)),r.slice(0,30)}const zie=g.createContext(null);function Fie(){return g.useContext(zie)}const Hie={builtin:"Built-in",global:"Global",project:"Project",policy:"Policy",plugin:"Plugin",persona:"My personas",contact:"People","remote-persona":"Remote personas"},b2={builtin:0,global:1,project:2,policy:3,plugin:4,persona:5,contact:6,"remote-persona":7};function op(e){switch(e.kind){case"persona":return"persona";case"contact":return"contact";case"remote-persona":return"remote-persona";case"cc-agent":return e.agent.source}}function Uie(e){switch(e.kind){case"persona":return`persona/${e.persona.personaId}`;case"contact":return`contact/${e.contact.deviceId}`;case"remote-persona":return`remote/${e.deviceId}/${e.persona.personaId}`;case"cc-agent":return`${e.agent.source}/${e.agent.name}`}}function Wie(e){switch(e.kind){case"persona":return`${e.persona.personaId} ${e.persona.label}`.toLowerCase();case"contact":return`${e.contact.displayName} ${e.contact.deviceId}`.toLowerCase();case"remote-persona":return`${e.persona.personaId} ${e.persona.label}`.toLowerCase();case"cc-agent":{const t=e.agent;return`${t.name} ${t.description??""} ${t.whenToUse??""}`.toLowerCase()}}}function qie(e){switch(e.kind){case"persona":return{displayName:`@persona/${e.persona.personaId}`,description:e.persona.label,testid:`cc-agent-item-persona-${e.persona.personaId}`};case"contact":return{displayName:`@${e.contact.displayName}`,description:e.contact.deviceId,testid:`cc-agent-item-contact-${e.contact.deviceId}`};case"remote-persona":return{displayName:`@persona/${e.persona.personaId}`,description:e.persona.label,testid:`cc-agent-item-remote-${e.deviceId}-${e.persona.personaId}`};case"cc-agent":return{displayName:`@${e.agent.name}`,description:e.agent.description,whenToUse:e.agent.whenToUse,plugin:e.agent.plugin,testid:`cc-agent-item-${e.agent.name}`}}}function MM(e,t){const n=t.trim().toLowerCase(),r=n?e.filter(i=>Wie(i).includes(n)):e.slice();return r.sort((i,s)=>(b2[op(i)]??9)-(b2[op(s)]??9)),r.slice(0,30)}function w2({query:e,entries:t,activeIndex:n,onActiveIndexChange:r,onSelect:i}){const s=g.useRef(null),o=g.useMemo(()=>MM(t,e),[t,e]),a=g.useMemo(()=>{const l=new Set;let c=null;for(let u=0;u<o.length;u++){const d=op(o[u]);d!==c&&(l.add(u),c=d)}return l},[o]);return g.useEffect(()=>{var l;try{(l=s.current)==null||l.scrollIntoView({block:"nearest"})}catch{}},[n]),o.length===0?null:h.jsx("div",{"data-testid":"cc-agent-selector",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 max-h-[320px] overflow-y-auto rounded-2xl border border-bg-300 bg-bg-50 shadow-lg",children:o.map((l,c)=>{const u=c===n,d=a.has(c),f=op(l),p=qie(l);return h.jsxs(Je.Fragment,{children:[d?h.jsx("div",{"data-testid":`cc-agent-group-header-${f}`,"data-source":f,className:"sticky top-0 z-10 bg-bg-50/95 backdrop-blur-sm px-4 py-2 text-[10px] font-semibold uppercase tracking-wider text-text-400/70 border-b border-bg-200/60",children:Hie[f]}):null,h.jsxs("div",{ref:u?s:void 0,"data-testid":p.testid,onMouseEnter:()=>r(c),onClick:()=>i(l),className:ie("flex items-center gap-2.5 px-4 py-2 cursor-pointer transition-colors duration-75",u?"bg-[var(--text-100-dim)]":"hover:bg-bg-100/60"),children:[h.jsx("code",{className:"text-[12px] font-mono font-semibold text-text-100 shrink-0",children:p.displayName}),p.description?h.jsx("span",{className:"text-[11px] text-text-300 truncate ml-2",children:p.description}):null,p.whenToUse?h.jsx("span",{className:"text-[10px] text-text-400/70 italic truncate ml-auto",children:p.whenToUse}):null,p.plugin?h.jsx("span",{className:"text-[10px] text-text-400/70 ml-2 shrink-0",children:p.plugin}):null]})]},Uie(l))})})}function Vie({attachment:e,onRemove:t,onOpenPreview:n}){var l;const r=e.mimeType.startsWith("image/"),i=e.status==="error",s=e.status==="uploading",o=((l=e.error)==null?void 0:l.trim())||"附件上传失败,请移除后重试",a=r&&e.status==="done"&&!!e.previewUrl&&!!n;return h.jsxs("div",{"data-testid":`attachment-pill-${e.id}`,className:ie("group relative flex items-center gap-1.5 rounded-lg border px-2 py-1.5 text-[12px] transition-colors",i?"border-red-400/40 bg-red-500/5":"border-bg-300 bg-bg-100"),children:[r&&e.previewUrl?h.jsxs("div",{className:"relative h-7 w-7 shrink-0",children:[h.jsx("img",{src:e.previewUrl,alt:e.fileName,onClick:a?n:void 0,"data-testid":`attachment-thumb-${e.id}`,className:ie("h-7 w-7 rounded object-cover",a&&"cursor-pointer hover:opacity-80",s&&"opacity-40")}),s?h.jsx(Tn,{"data-testid":`attachment-spinner-${e.id}`,className:"absolute inset-0 m-auto h-3.5 w-3.5 animate-spin text-text-200"}):null]}):h.jsx("div",{className:"relative flex h-7 w-7 items-center justify-center rounded bg-text-100/5 shrink-0",children:s?h.jsx(Tn,{"data-testid":`attachment-spinner-${e.id}`,className:"h-3.5 w-3.5 animate-spin text-text-400"}):h.jsx(Ci,{className:"h-3.5 w-3.5 text-text-400"})}),h.jsx("span",{className:ie("max-w-[120px] truncate text-text-200",s&&"text-text-400"),title:e.fileName,children:e.fileName}),i?h.jsx(Tu,{children:h.jsxs(td,{children:[h.jsx(nd,{asChild:!0,children:h.jsx("button",{type:"button","aria-label":`查看附件错误:${o}`,className:"flex h-4 w-4 items-center justify-center rounded text-red-400 shrink-0 cursor-help focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",children:h.jsx(Jo,{className:"h-3 w-3","aria-hidden":"true"})})}),h.jsx(Ul,{side:"top",collisionPadding:8,className:"max-w-[min(24rem,calc(100vw-2rem))] whitespace-pre-wrap break-words",children:o})]})}):null,h.jsx("button",{type:"button",onClick:t,"data-testid":`attachment-remove-${e.id}`,className:"flex h-4 w-4 items-center justify-center rounded-full text-text-400 hover:text-text-100 hover:bg-text-100/10 transition-colors cursor-pointer shrink-0","aria-label":"remove",children:h.jsx(Qr,{className:"h-3 w-3"})})]})}function Kie({attachments:e,onRemove:t,onOpenPreview:n}){return e.length===0?null:h.jsx("div",{"data-testid":"attachment-row",className:"flex flex-wrap gap-1.5 mb-2 px-1",children:e.map(r=>h.jsx(Vie,{attachment:r,onRemove:()=>t(r.id),onOpenPreview:n?()=>n(r):void 0},r.id))})}class ka extends Error{constructor(t,n,r){super(n),this.code=t,this.status=r,this.name="UploadAttachmentError"}}async function Gie(e){if(!e.httpBaseUrl)throw new ka("TUNNEL_NOT_READY","daemon httpBaseUrl unavailable");if(!e.httpToken)throw new ka("NO_AUTH","daemon httpToken unavailable");const t=HT(e.file.name,e.file.type);if(!t)throw new ka("UNSUPPORTED_MIME","不支持的文件类型");const n=new URLSearchParams({sessionId:e.sessionId,fileName:e.file.name,mimeType:t}),r=`${e.httpBaseUrl.replace(/\/$/,"")}/attachments/upload?${n.toString()}`;let i;try{i=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${e.httpToken}`,"Content-Type":t},body:e.file})}catch(s){throw new ka("NETWORK_ERROR",s.message)}if(!i.ok){let s="UPLOAD_FAILED",o=`HTTP ${i.status}`;try{const a=await i.json();a.code&&(s=a.code),a.message&&(o=a.message)}catch{}throw new ka(s,o,i.status)}return await i.json()}let Yie=0;const Xie=()=>`att-${++Yie}-${Date.now()}`;function Zie(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(typeof r.result=="string"?r.result:""),r.onerror=()=>n(r.error??new Error("read failed")),r.readAsDataURL(e)})}function Qie(e){const[t,n]=g.useState(e.initial??[]),r=g.useCallback(async o=>{const a=Array.from(o);if(a.length===0)return;const l=[],c=[],u=[];for(const d of a){const f=HT(d.name,d.type),p={id:Xie(),fileName:d.name,mimeType:f??(d.type||"application/octet-stream")};if(!f){c.push({...p,url:null,status:"error",error:"不支持的文件类型"});continue}if(d.size>HS){c.push({...p,url:null,status:"error",error:`超过 ${Math.round(HS/1024/1024)}MB 上限`});continue}if(e.sessionId==null){u.push({id:p.id,file:d,mimeType:p.mimeType}),c.push({...p,url:null,status:"uploading"});continue}const m=p.mimeType.startsWith("image/")?URL.createObjectURL(d.type===p.mimeType?d:d.slice(0,d.size,p.mimeType)):void 0;c.push({...p,url:null,status:"uploading",...m?{previewUrl:m}:{}}),l.push({id:p.id,file:d})}n(d=>[...d,...c]);for(const d of u)try{const f=await Zie(d.file.slice(0,d.file.size,d.mimeType));n(p=>p.map(m=>m.id===d.id?{...m,url:f,status:"done",...d.mimeType.startsWith("image/")?{previewUrl:f}:{}}:m))}catch(f){n(p=>p.map(m=>m.id===d.id?{...m,status:"error",error:f.message??"read failed"}:m))}l.length!==0&&await Promise.all(l.map(async d=>{try{const f=await Gie({httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken,sessionId:e.sessionId,file:d.file});n(p=>p.map(m=>m.id===d.id?{...m,url:f.url,status:"done"}:m))}catch(f){const p=f instanceof ka?f.code:"UPLOAD_FAILED",m=f.message??"upload failed";n(v=>v.map(w=>w.id===d.id?{...w,status:"error",error:`${p}: ${m}`}:w))}}))},[e.sessionId,e.httpBaseUrl,e.httpToken]),i=g.useCallback(o=>{n(a=>a.filter(l=>l.id!==o))},[]),s=g.useCallback(()=>{n([])},[]);return{attachments:t,setAttachments:n,addFiles:r,removeAttachment:i,clearAttachments:s}}function Jie(e,t){return[...e.map(n=>n.text),t].map(n=>n.trim()).filter(Boolean).join(`
|
|
569
|
+
`))}function l(p,m,v,w){const x=v.enter("tableCell"),_=v.enter("phrasing"),b=v.containerPhrasing(p,{...w,before:s,after:s});return _(),x(),b}function c(p,m){return lte(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function u(p,m,v){const w=p.children;let x=-1;const _=[],b=m.enter("table");for(;++x<w.length;)_[x]=d(w[x],m,v);return b(),_}function d(p,m,v){const w=p.children;let x=-1;const _=[],b=m.enter("tableRow");for(;++x<w.length;)_[x]=l(w[x],p,m,v);return b(),_}function f(p,m,v){let w=tM.inlineCode(p,m,v);return v.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function Yte(){return{exit:{taskListCheckValueChecked:u2,taskListCheckValueUnchecked:u2,paragraph:Zte}}}function Xte(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Qte}}}function u2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Zte(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Qte(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=tM.listItem(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function Jte(){return[Ree(),Qee(),nte(),Hte(),Yte()]}function ene(e){return{extensions:[Mee(),Jee(e),rte(),Gte(e),Xte()]}}const tne={tokenize:ane,partial:!0},nM={tokenize:lne,partial:!0},rM={tokenize:cne,partial:!0},iM={tokenize:une,partial:!0},nne={tokenize:dne,partial:!0},sM={name:"wwwAutolink",tokenize:sne,previous:aM},oM={name:"protocolAutolink",tokenize:one,previous:lM},cs={name:"emailAutolink",tokenize:ine,previous:cM},Pi={};function rne(){return{text:Pi}}let po=48;for(;po<123;)Pi[po]=cs,po++,po===58?po=65:po===91&&(po=97);Pi[43]=cs;Pi[45]=cs;Pi[46]=cs;Pi[95]=cs;Pi[72]=[cs,oM];Pi[104]=[cs,oM];Pi[87]=[cs,sM];Pi[119]=[cs,sM];function ine(e,t,n){const r=this;let i,s;return o;function o(d){return!Bx(d)||!cM.call(r,r.previous)||ub(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(d))}function a(d){return Bx(d)?(e.consume(d),a):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(nne,u,c)(d):d===45||d===95||In(d)?(s=!0,e.consume(d),l):u(d)}function c(d){return e.consume(d),i=!0,l}function u(d){return s&&i&&Ln(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function sne(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!aM.call(r,r.previous)||ub(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(tne,e.attempt(nM,e.attempt(rM,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function one(e,t,n){const r=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&lM.call(r,r.previous)&&!ub(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),e.consume(d),a):n(d)}function a(d){if(Ln(d)&&i.length<5)return i+=String.fromCodePoint(d),e.consume(d),a;if(d===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(d),l}return n(d)}function l(d){return d===47?(e.consume(d),s?c:(s=!0,l)):n(d)}function c(d){return d===null||Jf(d)||ht(d)||qo(d)||wm(d)?n(d):e.attempt(nM,e.attempt(rM,u),n)(d)}function u(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function ane(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function lne(e,t,n){let r,i,s;return o;function o(c){return c===46||c===95?e.check(iM,l,a)(c):c===null||ht(c)||qo(c)||c!==45&&wm(c)?l(c):(s=!0,e.consume(c),o)}function a(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),o}function l(c){return i||r||!s?n(c):t(c)}}function cne(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(iM,t,s)(o):o===null||ht(o)||qo(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function une(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),s):a===93?(e.consume(a),i):a===60||a===null||ht(a)||qo(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||ht(a)||qo(a)?t(a):r(a)}function s(a){return Ln(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Ln(a)?(e.consume(a),o):n(a)}}function dne(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return In(s)?n(s):t(s)}}function aM(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ht(e)}function lM(e){return!Ln(e)}function cM(e){return!(e===47||Bx(e))}function Bx(e){return e===43||e===45||e===46||e===95||In(e)}function ub(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const hne={tokenize:_ne,partial:!0};function fne(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:vne,continuation:{tokenize:xne},exit:yne}},text:{91:{name:"gfmFootnoteCall",tokenize:gne},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:pne,resolveTo:mne}}}}function pne(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Gr(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function mne(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function gne(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(s>999||d===93&&!o||d===null||d===91||ht(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(Gr(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return ht(d)||(o=!0),s++,e.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(e.consume(d),s++,c):c(d)}}function vne(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||ht(m))return n(m);if(m===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return s=Gr(r.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return ht(m)||(a=!0),o++,e.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(e.consume(m),o++,u):u(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),et(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function xne(e,t,n){return e.check(id,t,e.attempt(hne,t,n))}function yne(e){e.exit("gfmFootnoteDefinition")}function _ne(e,t,n){const r=this;return et(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function bne(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],p=a.parser.constructs.insideSpan.null;p&&yn(f,f.length,0,Vl(p,o.slice(c+1,l),a)),yn(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),yn(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const c=this.previous,u=this.events;let d=0;return f;function f(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const v=xl(c);if(m===126)return d>1?l(m):(o.consume(m),d++,p);if(d<2&&!n)return l(m);const w=o.exit("strikethroughSequenceTemporary"),x=xl(m);return w._open=!x||x===2&&!!v,w._close=!v||v===2&&!!x,a(m)}}}class wne{constructor(){this.map=[]}add(t,n,r){Sne(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function Sne(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function kne(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Cne(){return{flow:{null:{name:"table",tokenize:Ene,resolveAll:Ine}}}}function Ene(e,t,n){const r=this;let i=0,s=0,o;return a;function a(N){let L=r.events.length-1;for(;L>-1;){const A=r.events[L][1].type;if(A==="lineEnding"||A==="linePrefix")L--;else break}const R=L>-1?r.events[L][1].type:null,M=R==="tableHead"||R==="tableRow"?k:l;return M===k&&r.parser.lazy[r.now().line]?n(N):M(N)}function l(N){return e.enter("tableHead"),e.enter("tableRow"),c(N)}function c(N){return N===124||(o=!0,s+=1),u(N)}function u(N){return N===null?n(N):Ce(N)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),p):n(N):Ye(N)?et(e,u,"whitespace")(N):(s+=1,o&&(o=!1,i+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),d(N)))}function d(N){return N===null||N===124||ht(N)?(e.exit("data"),u(N)):(e.consume(N),N===92?f:d)}function f(N){return N===92||N===124?(e.consume(N),d):d(N)}function p(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),o=!1,Ye(N)?et(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):m(N))}function m(N){return N===45||N===58?w(N):N===124?(o=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),v):C(N)}function v(N){return Ye(N)?et(e,w,"whitespace")(N):w(N)}function w(N){return N===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),x):N===45?(s+=1,x(N)):N===null||Ce(N)?S(N):C(N)}function x(N){return N===45?(e.enter("tableDelimiterFiller"),_(N)):C(N)}function _(N){return N===45?(e.consume(N),_):N===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(N))}function b(N){return Ye(N)?et(e,S,"whitespace")(N):S(N)}function S(N){return N===124?m(N):N===null||Ce(N)?!o||i!==s?C(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):C(N)}function C(N){return n(N)}function k(N){return e.enter("tableRow"),T(N)}function T(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),T):N===null||Ce(N)?(e.exit("tableRow"),t(N)):Ye(N)?et(e,T,"whitespace")(N):(e.enter("data"),E(N))}function E(N){return N===null||N===124||ht(N)?(e.exit("data"),T(N)):(e.consume(N),N===92?D:E)}function D(N){return N===92||N===124?(e.consume(N),E):E(N)}}function Ine(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const f=new wne;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(d2(f,t,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",u,t]])),i=m.type==="tableDelimiterRow"?2:u?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=ah(f,t,s,i,void 0,d),s=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],d=ah(f,t,s,i,void 0,d)),s=o,o=[s[1],n,0,0])):m.type==="tableHead"?(a=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],d=ah(f,t,s,i,n,d)):o[1]!==0&&(d=ah(f,t,o,i,n,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&d2(f,t,l,c,u),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=kne(t.events,n))}return e}function ah(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},Sa(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=Sa(t.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const c=Sa(t.events,n[2]),u=Sa(t.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,v=n[3]-n[2]-1;e.add(m,v,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return i!==void 0&&(s.end=Object.assign({},Sa(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function d2(e,t,n,r,i){const s=[],o=Sa(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function Sa(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Nne={name:"tasklistCheck",tokenize:Pne};function Tne(){return{text:{91:Nne}}}function Pne(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return ht(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return Ce(l)?t(l):Ye(l)?e.check({tokenize:Rne},t,n)(l):n(l)}}function Rne(e,t,n){return et(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Mne(e){return xR([rne(),fne(),bne(e),Cne(),Tne()])}const Ane={};function _l(e){const t=this,n=e||Ane,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Mne(n)),s.push(Jte()),o.push(ene(n))}const Hi={eof:null,asterisk:42,underscore:95,tilde:126},bl={attentionSideAfter:2,characterGroupPunctuation:2,characterGroupWhitespace:1},ui={data:"data",characterEscape:"characterEscape",emphasis:"emphasis",emphasisSequence:"emphasisSequence",emphasisText:"emphasisText",strong:"strong",strongSequence:"strongSequence",strongText:"strongText"},jne=161,Lne=1114109,Dne=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],One=12288,Bne=65510,$ne=[12288,12288,65281,65376,65504,65510],zne=8361,Fne=65518,Hne=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Une=32,Wne=10630,qne=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Vne=4352,Kne=262141,uM=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101594,101631,101664,101760,101874,101888,102801,102816,102866,110576,110579,110581,110587,110589,110590,110592,110888,110898,110898,110928,110930,110933,110933,110948,110952,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127406,127406,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128729,128732,128735,128747,128748,128756,128764,128986,128986,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129734,129736,129736,129740,129757,129759,129771,129775,129786,131072,196605,196608,262141],od=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=i*2;if(t<e[s])r=i-1;else if(t>e[s+1])n=i+1;else return!0}return!1},h2=19968,[Gne,Yne]=Xne(uM);function Xne(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){const i=e[r],s=e[r+1];if(h2>=i&&h2<=s)return[i,s];s-i>n-t&&(t=i,n=s)}return[t,n]}const Zne=e=>e<jne||e>Lne?!1:od(Dne,e),Qne=e=>e<One||e>Bne?!1:od($ne,e),Jne=e=>e<zne||e>Fne?!1:od(Hne,e),ere=e=>e<Une||e>Wne?!1:od(qne,e),tre=e=>e>=Gne&&e<=Yne?!0:e<Vne||e>Kne?!1:od(uM,e);function nre(e){return Zne(e)?"ambiguous":Qne(e)?"fullwidth":Jne(e)?"halfwidth":ere(e)?"narrow":tre(e)?"wide":"neutral"}function rre(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function ire(e){return rre(e),nre(e)}function sre(e){return new RegExp("^\\p{Emoji_Presentation}","u").test(String.fromCodePoint(e))}function ore(e){if(!e||e<4352)return!1;switch(ire(e)){case"fullwidth":case"halfwidth":return!0;case"wide":return!sre(e);case"narrow":return!1;case"ambiguous":return 917760<=e&&e<=917999?null:!1;case"neutral":return new RegExp("^\\p{sc=Hangul}","u").test(String.fromCodePoint(e))}}function are(e,t){return t!==65025||!e||e<8216?!1:e===8216||e===8217||e===8220||e===8221}function lre(e){return e!==null&&e>=65024&&e<=65038}const cre=dM(new RegExp("\\p{P}|\\p{S}","u")),ure=dM(/\s/);function dM(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCodePoint(n))}}function Au(e){return!!(e&bl.characterGroupWhitespace)}function rp(e){return(e&dr.cjkPunctuation)===bl.characterGroupPunctuation}function $x(e){return!!(e&dr.cjk)}function dre(e){return e===dr.ivs}function hre(e){return!!(e&dr.cjkOrIvs)}function fre(e){return e===dr.nonEmojiGeneralUseVS}function f2(e){return!!(e&dr.spaceOrPunctuation)}let dr;(function(e){e.spaceOrPunctuation=3,e.cjk=4096,e.cjkPunctuation=4098,e.ivs=8192,e.cjkOrIvs=12288,e.nonEmojiGeneralUseVS=16384,e.variationSelector=24576,e.ivsToCjkRightShift=1})(dr||(dr={}));function el(e){if(e===Hi.eof||ht(e)||ure(e))return bl.characterGroupWhitespace;let t=0;if(e>=4352){if(lre(e))return dr.nonEmojiGeneralUseVS;switch(ore(e)){case null:return dr.ivs;case!0:t|=dr.cjk;break}}return cre(e)&&(t|=bl.characterGroupPunctuation),t}function hM(e,t,n){if(!fre(e))return e;const r=t(),i=el(r);return!r||Au(i)?e:are(r,n)?dr.cjkPunctuation:pre(i)}function pre(e){return e&~dr.ivs}function fM(e){return!!(e&&e>=55296&&e<=56319)}function pM(e){return!!(e&&e>=56320&&e<=57343)}function mM(e,t,n){if(t._bufferIndex<2)return e;const r=n({start:{...t,_bufferIndex:t._bufferIndex-2},end:t}).codePointAt(0);return r&&r>=65536?r:e}function mre(e,t,n){const r=e>=65536?2:1;if(t._bufferIndex<1+r)return null;const i=t._bufferIndex-r-2,s=n({start:{...t,_bufferIndex:i>=0?i:0},end:{...t,_bufferIndex:t._bufferIndex-r}}),o=s.charCodeAt(s.length-1);if(Number.isNaN(o))return null;if(s.length<2||o<56320||57343<o)return o;const a=s.codePointAt(0);return a&&a>=65536?a:o}var gM=class{constructor(e,t,n){Db(this,"cachedValue");this.previousCode=e,this.nowPoint=t,this.sliceSerialize=n}value(){return this.cachedValue===void 0&&(this.cachedValue=mre(this.previousCode,this.nowPoint,this.sliceSerialize)),this.cachedValue}};function vM(e,t,n){const r=n({start:t,end:{...t,_bufferIndex:t._bufferIndex+2}}).codePointAt(0);return r&&r>=65536?r:e}const n0={name:"attention",resolveAll:gre,tokenize:vre};function gre(e,t){let n=-1,r,i,s,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};p2(d,-l),p2(f,l),o={type:l>1?ui.strongSequence:ui.emphasisSequence,start:d,end:{...e[r][1].end}},a={type:l>1?ui.strongSequence:ui.emphasisSequence,start:{...e[n][1].start},end:f},s={type:l>1?ui.strongText:ui.emphasisText,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?ui.strong:ui.emphasis,start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=gn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=gn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),t.parser.constructs.insideSpan.null,c=gn(c,Vl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=gn(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=gn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,yn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function vre(e,t){const n=this.parser.constructs.attentionMarkers.null,{now:r,sliceSerialize:i,previous:s}=this,o=pM(s)?mM(s,r(),i):s,a=el(o),l=new gM(o,r(),i),c=hM(a,l.value.bind(l),o);let u;return d;function d(p){return u=p,e.enter("attentionSequence"),f(p)}function f(p){if(p===u)return e.consume(p),f;const m=e.exit("attentionSequence"),v=el(fM(p)?vM(p,r(),i):p),w=rp(c),x=w||Au(c),_=rp(v),b=_||Au(v),S=hre(c),C=!b||_&&(x||S)||n.includes(p),k=!x||w&&(b||$x(v))||n.includes(o);return m._open=!!(u===Hi.asterisk?C:C&&(f2(c)||!k)),m._close=!!(u===Hi.asterisk?k:k&&(f2(v)||!C)),t(p)}}function p2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}function xre(){return{text:{[Hi.asterisk]:n0,[Hi.underscore]:n0},insideSpan:{null:[n0]}}}function yre(){const e=this.data();(e.micromarkExtensions||(e.micromarkExtensions=[])).push(xre())}function _re(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:i,resolveAll:r};return t==null&&(t=!0),{text:{[Hi.tilde]:n},insideSpan:{null:[n]},attentionMarkers:{null:[Hi.tilde]}};function r(s,o){let a=-1;for(;++a<s.length;)if(s[a][0]==="enter"&&s[a][1].type==="strikethroughSequenceTemporary"&&s[a][1]._close){let l=a;for(;l--;)if(s[l][0]==="exit"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._open&&s[a][1].end.offset-s[a][1].start.offset===s[l][1].end.offset-s[l][1].start.offset){s[a][1].type="strikethroughSequence",s[l][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},s[l][1].start),end:Object.assign({},s[a][1].end)},u={type:"strikethroughText",start:Object.assign({},s[l][1].end),end:Object.assign({},s[a][1].start)},d=[["enter",c,o],["enter",s[l][1],o],["exit",s[l][1],o],["enter",u,o]],f=o.parser.constructs.insideSpan.null;f&&yn(d,d.length,0,Vl(f,s.slice(l+1,a),o)),yn(d,d.length,0,[["exit",u,o],["enter",s[a][1],o],["exit",s[a][1],o],["exit",c,o]]),yn(s,l-1,a-l+3,d),a=l+d.length-2;break}}for(a=-1;++a<s.length;)s[a][1].type==="strikethroughSequenceTemporary"&&(s[a][1].type=ui.data);return s}function i(s,o,a){const{now:l,sliceSerialize:c,previous:u}=this,d=pM(u)?mM(u,l(),c):u,f=el(d),p=new gM(d,l(),c),m=hM(f,p.value.bind(p),d),v=this.events;let w=0;return x;function x(b){return d===Hi.tilde&&v[v.length-1][1].type!==ui.characterEscape?a(b):(s.enter("strikethroughSequenceTemporary"),_(b))}function _(b){const S=el(d);if(b===Hi.tilde)return w>1?a(b):(s.consume(b),w++,_);if(w<2&&!t)return a(b);const C=s.exit("strikethroughSequenceTemporary"),k=el(fM(b)?vM(b,l(),c):b),T=rp(m)||Au(m),E=rp(k)||Au(k),D=$x(m)||dre(S);return C._open=!E||k===bl.attentionSideAfter&&(T||D),C._close=!T||S===bl.attentionSideAfter&&(E||$x(k)),o(b)}}}function bre(e){const t=this.data();(t.micromarkExtensions||(t.micromarkExtensions=[])).push(_re(e))}function Em(e){if(!e)return!1;const n=e.split("#")[0].split("?")[0].toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")}function wre(e){if(!e)return null;let t;if(e.startsWith("file://")){const n=e.slice(7);t=n.startsWith("/")?n:`/${n.split("/").slice(1).join("/")}`}else{if(/^[a-z][a-z0-9+.-]*:/i.test(e))return null;if(e.startsWith("/"))t=e;else return null}try{return decodeURIComponent(t)}catch{return t}}const Sre=/\.(png|jpe?g|webp|gif|svg)$/i;function kre(e,t){if((typeof t=="string"?t:null)!==e)return!1;try{const r=new URL(e);return Sre.test(r.pathname)}catch{return!1}}function Cre(e){try{return new URL(e).pathname.split("/").filter(Boolean).pop()??""}catch{return""}}const Qs={a:({node:e,href:t,children:n,...r})=>typeof t=="string"&&kre(t,n)?h.jsxs("span",{className:"my-1 inline-flex flex-col items-start gap-1 align-top",children:[h.jsx("img",{src:t,alt:Cre(t),className:"max-w-full h-auto rounded border border-border"}),h.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"max-w-full truncate text-[11px] text-text-300 underline decoration-dotted underline-offset-2 hover:text-text-100",children:t})]}):h.jsx("a",{...r,href:t,target:"_blank",rel:"noopener noreferrer",children:n})};function xM(e){return e.startsWith("file://")?e:zR(e)}function yM(e){return{...Qs,a:t=>{const{href:n,children:r}=t,i=typeof n=="string"?wre(n):null;if(i===null){const s=Qs.a;return h.jsx(s,{...t})}return h.jsx("a",{href:n,"data-testid":"assistant-file-link",title:i,onClick:s=>{s.preventDefault(),e(i)},children:r})}}}function Ere({text:e,forkTarget:t,onOpenFilePath:n}){const{body:r}=Ze.useMemo(()=>_m(e),[e]),i=Ze.useMemo(()=>n?yM(n):Qs,[n]),s=Ze.useMemo(()=>h.jsx(yl,{remarkPlugins:[_l,yre,bre],components:i,...n?{urlTransform:xM}:{},children:r}),[r,i,n]);return r?h.jsxs("div",{className:"group relative flex min-w-0 max-w-full flex-col items-start","data-testid":"msg-line-assistant-wrapper",children:[h.jsx("div",{"data-testid":"msg-line-assistant",className:"assistant-markdown w-full min-w-0 max-w-full py-1 break-words",children:s}),t?h.jsxs("div",{className:"mt-1 flex flex-row items-center gap-1 md:absolute md:top-full md:mt-0 md:pt-0.5 md:z-10 md:rounded-md md:pointer-events-none md:group-hover:pointer-events-auto md:group-hover:bg-bg-100",children:[t.onFork?h.jsxs("button",{type:"button","data-testid":"assistant-msg-fork","aria-label":"fork from this message",title:"从这条消息派生新 session(截断之后的对话)",onClick:()=>t.onFork(t.messageUuid),className:"inline-flex items-center justify-start gap-1 h-7 w-7 md:h-6 md:w-auto md:px-1.5 rounded-md text-[11px] text-text-400/60 md:text-text-400 hover:bg-text-100/5 hover:text-text-200 md:opacity-0 md:group-hover:opacity-100 md:transition-opacity cursor-pointer",children:[h.jsx(ku,{className:"w-3 h-3",strokeWidth:2}),h.jsx("span",{className:"hidden md:inline",children:"Fork"})]}):null,t.onQuickAsk?h.jsxs("button",{type:"button","data-testid":"assistant-msg-quick-ask","aria-label":"quick ask from this message",title:"快速问答:从这条消息派生临时会话,关闭即删",onClick:()=>t.onQuickAsk(t.messageUuid),className:"inline-flex items-center justify-start gap-1 h-7 w-7 md:h-6 md:w-auto md:px-1.5 rounded-md text-[11px] text-text-400/60 md:text-text-400 hover:bg-text-100/5 hover:text-text-200 md:opacity-0 md:group-hover:opacity-100 md:transition-opacity cursor-pointer",children:[h.jsx(dF,{className:"w-3 h-3",strokeWidth:2}),h.jsx("span",{className:"hidden md:inline",children:"问一下"})]}):null]}):null]}):null}function Ire({text:e}){const[t,n]=g.useState(!1);return e?h.jsxs("div",{"data-testid":"msg-line-thinking",className:"text-[12px] text-text-400",children:[h.jsxs("button",{type:"button",onClick:()=>n(r=>!r),className:"flex items-center gap-1 hover:text-text-300 transition-colors cursor-pointer","aria-expanded":t,"data-testid":"msg-line-thinking-toggle",children:[t?h.jsx(Pn,{className:"w-3 h-3"}):h.jsx(Fn,{className:"w-3 h-3"}),h.jsx("span",{children:"💭 Thinking"})]}),t?h.jsx("div",{className:"ml-4 mt-1 italic text-text-400 whitespace-pre-wrap break-words",children:e}):null]}):null}const Nre=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function zx(e){return Nre.has(e)}function Tre({tool:e,relPath:t,scope:n,onShareFile:r}){if(!zx(e)||!t||!n||!r)return null;const i=Em(t)?"md-rendered":"raw";return h.jsx("span",{"data-testid":"file-edit-hover-row",className:"inline-flex shrink-0 items-center gap-1",children:h.jsx("span",{role:"button",tabIndex:0,"data-testid":"file-edit-share-btn","aria-label":"Share link",title:"Share link",onClick:s=>{s.stopPropagation(),r(t,i)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.stopPropagation(),s.preventDefault(),r(t,i))},className:"inline-flex h-3.5 w-3.5 items-center justify-center text-text-400 hover:text-text-200 cursor-pointer",children:h.jsx(n_,{className:"h-3.5 w-3.5"})})})}function Pre(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.file_path=="string"&&t.file_path||typeof t.notebook_path=="string"&&t.notebook_path||typeof t.path=="string"&&t.path||null||null}function _M(e,t){const[n,r]=g.useState({kind:"idle"});return g.useEffect(()=>{let i=!1,s=null;r({kind:"loading"});const o={};return t&&(o.Authorization=`Bearer ${t}`),fetch(e,{headers:o,credentials:"omit"}).then(async a=>{if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.blob()}).then(a=>{if(i)return;const l=a.type.split(";",1)[0].trim().toLowerCase();if(!/^(image\/(png|jpeg|gif|webp)|video\/(mp4|webm|quicktime))$/.test(l))throw new Error("此文件不支持内嵌预览,请使用文件打开功能");const c=URL.createObjectURL(a);s=c,r({kind:"ready",objectUrl:c})}).catch(a=>{i||r({kind:"error",message:a.message})}),()=>{i=!0,s&&URL.revokeObjectURL(s)}},[e,t]),n}function Rre({url:e,bearerToken:t,alt:n,className:r}){const i=_M(e,t);return h.jsxs("div",{"data-testid":"blob-image","data-state":i.kind,className:ie("relative inline-flex items-center justify-center rounded-md border border-border bg-bg-0",r),children:[i.kind==="loading"?h.jsx("div",{className:"flex h-24 w-32 items-center justify-center",children:h.jsx(Tn,{className:"h-4 w-4 animate-spin text-text-400"})}):null,i.kind==="error"?h.jsxs("div",{className:"flex h-24 w-32 items-center justify-center gap-1 px-2 text-[11px] text-text-400",children:[h.jsx(Jo,{className:"h-3 w-3"}),h.jsx("span",{title:i.message,children:"加载失败"})]}):null,i.kind==="ready"?h.jsx("img",{src:i.objectUrl,alt:n,className:"block max-h-[180px] max-w-[420px] rounded-md object-contain"}):null]})}function Mre({url:e,bearerToken:t,className:n}){const r=_M(e,t);return h.jsxs("div",{"data-testid":"blob-video","data-state":r.kind,className:ie("relative inline-flex items-center justify-center rounded-md border border-border bg-bg-0",n),children:[r.kind==="loading"?h.jsx(Tn,{className:"h-4 w-4 animate-spin text-text-400"}):null,r.kind==="error"?h.jsx("span",{className:"px-2 text-[11px] text-text-400",children:"加载失败"}):null,r.kind==="ready"?h.jsx("video",{src:r.objectUrl,controls:!0,className:"block max-h-[240px] max-w-[420px] rounded-md"}):null]})}const Are=new Set([".png",".jpg",".jpeg",".gif",".webp"]),jre=new Set([".mp4",".webm",".mov"]),Lre=new Set([".pdf"]);function Dre(e){const t=e.lastIndexOf("."),n=t>=0?e.slice(t).toLowerCase():"";return Are.has(n)?"image":jre.has(n)?"video":Lre.has(n)?"pdf":"binary"}function bM(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ore({relPath:e,scope:t,size:n}){const r=Qp();if(r.actionsLevel==="none")return null;const i=Iz(r,t,e);if(!i)return null;const s=Dre(e);return s==="image"?h.jsx("div",{"data-testid":"file-edit-inline-preview","data-kind":"image",className:"mt-2",children:h.jsx(Rre,{url:i,bearerToken:r.httpToken,alt:e})}):s==="video"?h.jsx("div",{"data-testid":"file-edit-inline-preview","data-kind":"video",className:"mt-2",children:h.jsx(Mre,{url:i,bearerToken:r.httpToken})}):s==="pdf"?h.jsx(Bre,{relPath:e,url:i,size:n}):typeof n=="number"&&n>=1024*1024?h.jsxs("div",{"data-testid":"file-edit-inline-preview","data-kind":"binary",className:"mt-2 inline-flex items-center gap-1.5 rounded border border-border bg-bg-50 px-2 py-1 text-[11px] text-text-400",children:[h.jsx(Ci,{className:"h-3 w-3"}),h.jsx("span",{className:"font-mono",children:e.split("/").pop()}),h.jsx("span",{children:"·"}),h.jsx("span",{children:bM(n)})]}):null}function Bre({relPath:e,url:t,size:n}){return h.jsxs("a",{"data-testid":"file-edit-inline-preview","data-kind":"pdf",href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 rounded border border-border bg-bg-50 px-2 py-1 text-[11px] text-text-300 hover:bg-bg-100",children:[h.jsx(Ci,{className:"h-3 w-3"}),h.jsx("span",{className:"font-mono",children:e.split("/").pop()}),typeof n=="number"?h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"·"}),h.jsx("span",{children:bM(n)})]}):null,h.jsx(Su,{className:"h-3 w-3"})]})}const $re={Bash:p4,Read:Ci,Edit:hx,Write:q7,Grep:Hf,Glob:Hf};function zre(e){return $re[e]??eH}function Fre(e){if(!e||typeof e!="object")return"";const t=e,n=t.command??t.file_path??t.path??t.pattern??t.query??t.url??t.description;if(typeof n=="string")return n;for(const r of Object.values(t))if(typeof r=="string"&&r)return r;return""}function wM({tool:e,input:t,output:n,error:r,pending:i=!1,expandedBody:s,fileScope:o,onOpenInTab:a,onPreviewMarkdown:l,onShareFile:c}){const[u,d]=g.useState(!1),f=!!r,p=zre(e),m=Fre(t),v=Pre(t);return h.jsxs("div",{"data-testid":"msg-line-tool","data-tool":e,className:ie("group min-w-0 max-w-full rounded-md border px-3 py-2 text-[13px]",f?"border-destructive/40 bg-destructive/5":"border-border bg-bg-50"),children:[h.jsxs("button",{type:"button",onClick:()=>d(w=>!w),"aria-expanded":u,"data-testid":"msg-line-tool-header",className:"flex w-full items-center gap-2 text-left cursor-pointer min-w-0",children:[f?h.jsx(Jo,{className:"w-4 h-4 text-destructive shrink-0"}):h.jsx(p,{className:ie("w-4 h-4 shrink-0",i?"text-text-400":"text-text-300")}),h.jsx("span",{className:"font-medium text-text-100 shrink-0",children:e}),m?(()=>{if(f||!zx(e)||!v)return null;const x=Em(v)&&l?l:a;return x?h.jsx("span",{role:"button",tabIndex:0,"data-testid":"msg-line-tool-preview","data-clickable":"true",title:m,onClick:_=>{_.stopPropagation(),x(v)},onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.stopPropagation(),_.preventDefault(),x(v))},className:"text-[12px] text-accent font-mono truncate min-w-0 max-w-full cursor-pointer underline underline-offset-2 hover:opacity-80",children:m}):null})()??h.jsx("span",{"data-testid":"msg-line-tool-preview",className:"text-[12px] text-text-400 font-mono truncate min-w-0 max-w-full",title:m,children:m}):null,h.jsx("span",{"aria-hidden":"true","data-testid":"msg-line-tool-header-spacer",className:"flex-1 min-w-0 self-stretch"}),i?h.jsx(Tn,{"data-testid":"msg-line-tool-pending",className:"w-3 h-3 text-text-400 animate-spin shrink-0"}):null,!f&&o?h.jsx(Tre,{tool:e,relPath:v,scope:o,...c?{onShareFile:c}:{}}):null]}),u?s!==void 0?h.jsxs("div",{"data-testid":"msg-line-tool-body",className:"mt-2 min-w-0 text-[12px]",children:[s,f?h.jsxs("div",{className:"mt-2",children:[h.jsx("div",{className:"text-destructive mb-0.5",children:"error"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-destructive/40 rounded p-2 overflow-auto text-destructive",children:String(r)})]}):null]}):h.jsxs("div",{"data-testid":"msg-line-tool-body",className:"mt-2 min-w-0 space-y-1 text-[12px]",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-text-400 mb-0.5",children:"input"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-border rounded p-2 overflow-auto text-text-200",children:JSON.stringify(t,null,2)})]}),n!==void 0?h.jsxs("div",{children:[h.jsx("div",{className:"text-text-400 mb-0.5",children:"output"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-border rounded p-2 overflow-auto text-text-200",children:typeof n=="string"?n:JSON.stringify(n,null,2)})]}):null,f?h.jsxs("div",{children:[h.jsx("div",{className:"text-destructive mb-0.5",children:"error"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-destructive/40 rounded p-2 overflow-auto text-destructive",children:String(r)})]}):null]}):null,!f&&o&&v&&zx(e)?h.jsx(Ore,{relPath:v,scope:o}):null]})}var Hre=Symbol.for("react.lazy"),ip=Tl[" use ".trim().toString()];function Ure(e){return typeof e=="object"&&e!==null&&"then"in e}function SM(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Hre&&"_payload"in e&&Ure(e._payload)}function Wre(e){const t=Vre(e),n=g.forwardRef((r,i)=>{let{children:s,...o}=r;SM(s)&&typeof ip=="function"&&(s=ip(s._payload));const a=g.Children.toArray(s),l=a.find(Gre);if(l){const c=l.props.children,u=a.map(d=>d===l?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:g.isValidElement(c)?g.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}var qre=Wre("Slot");function Vre(e){const t=g.forwardRef((n,r)=>{let{children:i,...s}=n;if(SM(i)&&typeof ip=="function"&&(i=ip(i._payload)),g.isValidElement(i)){const o=Xre(i),a=Yre(s,i.props);return i.type!==g.Fragment&&(a.ref=r?Ku(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Kre=Symbol("radix.slottable");function Gre(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Kre}function Yre(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function Xre(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const m2=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,g2=x4,Zre=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return g2(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(c=>{const u=n==null?void 0:n[c],d=s==null?void 0:s[c];if(u===null)return null;const f=m2(u)||m2(d);return i[c][f]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...p}=u;return Object.entries(p).every(m=>{let[v,w]=m;return Array.isArray(w)?w.includes({...s,...a}[v]):{...s,...a}[v]===w})?[...c,d,f]:c},[]);return g2(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Qre=Zre("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-accent text-accent-contrast hover:bg-accent-hover",destructive:"bg-destructive text-white hover:bg-destructive-hover",outline:"border border-border bg-transparent text-text-100 hover:bg-bg-200",ghost:"bg-transparent text-text-200 hover:bg-bg-200 hover:text-text-100"},size:{sm:"h-8 px-3 text-xs",md:"h-9 px-4",lg:"h-11 px-6 text-base"}},defaultVariants:{variant:"default",size:"md"}}),tl=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},s)=>{const o=r?qre:"button";return h.jsx(o,{ref:s,className:ie(Qre({variant:t,size:n}),e),...i})});tl.displayName="Button";function Jre({tool:e,input:t,onRespond:n,onInterrupt:r}){return h.jsxs("div",{"data-testid":"msg-line-permission",className:"min-w-0 max-w-full rounded-md border border-warning/40 bg-warning-dim/60 px-3 py-2.5 text-[13px]",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2 mb-1.5",children:[h.jsx(BF,{className:"w-4 h-4 text-warning shrink-0"}),h.jsxs("span",{className:"min-w-0 font-medium text-text-100 truncate",children:["权限请求:",e]}),r?h.jsx("button",{type:"button",onClick:r,"data-testid":"msg-line-permission-interrupt","aria-label":"interrupt current turn",title:"中断当前轮次(不杀进程)",className:"ml-auto h-6 w-6 rounded-md flex items-center justify-center text-text-400 hover:bg-text-100/10 hover:text-text-200 transition-colors cursor-pointer",children:h.jsx(d4,{className:"w-3.5 h-3.5",strokeWidth:2})}):null]}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-border rounded p-2 mb-2 max-h-[140px] overflow-auto text-[12px] text-text-200",children:JSON.stringify(t,null,2)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(tl,{size:"sm",variant:"default",onClick:()=>n(!0,!1),"data-testid":"msg-line-permission-allow",children:"Allow"}),h.jsx(tl,{size:"sm",variant:"outline",onClick:()=>n(!0,!0),"data-testid":"msg-line-permission-allow-always",children:"Allow Always"}),h.jsx(tl,{size:"sm",variant:"destructive",onClick:()=>n(!1,!1),"data-testid":"msg-line-permission-deny",children:"Deny"})]})]})}function eie({message:e}){return h.jsxs("div",{"data-testid":"msg-line-error",className:"flex min-w-0 max-w-full items-start gap-2 text-destructive text-[13px] rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2",children:[h.jsx(Uf,{className:"w-4 h-4 shrink-0 mt-0.5"}),h.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e})]})}const tie=/\[skill:(.+?):(\/[^\]]+)\]/g;function nie(e){const t=[],n=e.replace(tie,(r,i)=>(t.push(i),""));return{skills:t,text:t.length>0?n.trim():e}}function rie({text:e,senderDisplayName:t,senderPrincipal:n,rewindTarget:r}){const i=n==="guest",s=rR(e),{attachments:o,text:a}=Qf(s),{skills:l,text:c}=nie(a),{commandName:u,body:d}=_m(c),f=d.length>0;return f||o.length>0||!!u||l.length>0?(u||l.length>0)&&!f&&o.length===0?h.jsxs("div",{className:"flex min-w-0 max-w-full justify-end gap-1.5 py-2 mt-2","data-testid":"msg-line-user","data-sender-principal":i?"guest":"owner",children:[l.map((m,v)=>h.jsxs("span",{"data-testid":"user-skill-chip",className:"inline-flex items-center rounded-md bg-bg-200/60 px-2 py-0.5 text-[11px] font-mono text-text-300",children:["/",m]},`${m}-${v}`)),u?h.jsx("span",{className:"inline-flex items-center rounded-md bg-bg-200/60 px-2 py-0.5 text-[11px] font-mono text-text-300",children:u}):null]}):h.jsxs("div",{className:"group flex min-w-0 max-w-full flex-col items-end py-2 mt-2","data-testid":"msg-line-user","data-sender-principal":i?"guest":"owner",children:[h.jsxs("div",{"data-testid":"user-msg-bubble",className:ie("min-w-0 max-w-[85%] rounded-2xl rounded-br-sm px-3.5 py-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",i?"border border-border bg-bg-200":"bg-accent"),children:[o.length>0?h.jsx(iie,{attachments:o}):null,l.length>0?h.jsx("div",{className:ie("flex flex-wrap gap-1.5",(f||u)&&"mb-1.5"),children:l.map((m,v)=>h.jsxs("span",{"data-testid":"user-skill-chip",className:ie("inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-mono",i?"bg-text-100/10 text-text-200":"bg-white/15 text-white/90"),children:["/",m]},`${m}-${v}`))}):null,u?h.jsx("div",{className:ie("flex",f&&"mb-1.5"),children:h.jsx("span",{"data-testid":"user-command-chip",className:ie("inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-mono",i?"bg-text-100/10 text-text-200":"bg-white/15 text-white/90"),children:u})}):null,f?h.jsx("div",{className:ie("text-[14px] font-medium leading-relaxed",i?"text-text-100":"text-white"),children:d}):null]}),t?h.jsx("div",{"data-testid":"user-msg-sender-label",className:"mt-1 text-[11px] text-text-400",children:t}):null,r?h.jsxs("button",{type:"button","data-testid":"user-msg-rewind","aria-label":"rewind to this message",title:"回退到这条消息(会撤销之后 CC 的文件编辑)",onClick:()=>r.onRewind(r.userMessageId),className:"mt-1 inline-flex items-center gap-1 h-6 px-1.5 rounded-md text-[11px] text-text-400 hover:bg-text-100/5 hover:text-text-200 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:[h.jsx(m4,{className:"w-3 h-3",strokeWidth:2}),h.jsx("span",{children:"Rewind"})]}):null]}):null}function iie({attachments:e}){return h.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5","data-testid":"user-attachment-row",children:e.map(t=>h.jsx(sie,{attachment:t},t.url))})}function sie({attachment:e}){return e.type==="image"?h.jsx("img",{src:e.url,alt:e.fileName,"data-testid":"user-attachment-image",className:"h-16 w-16 rounded object-cover shrink-0 border border-bg-300/50"}):h.jsxs("div",{"data-testid":"user-attachment-file",className:"flex items-center gap-1.5 rounded-md border border-bg-300 bg-bg-100/60 px-2 py-1 text-[12px] text-text-200",children:[h.jsx(Ci,{className:"h-3.5 w-3.5 text-text-400 shrink-0"}),h.jsx("span",{className:"max-w-[140px] truncate",children:e.fileName})]})}const oie={"task-notification":"子任务通知","slash-command":"斜杠命令","local-command":"本地命令输出","system-reminder":"系统提醒","skill-hint":"Skill 注入","meta-text":"系统消息","attachment-skills":"技能列表","attachment-deferred-tools":"Deferred 工具变更","dispatch-task":"委派任务","dispatch-result":"委派回报"},aie={"task-notification":rk,"slash-command":UF,"local-command":p4,"system-reminder":rk,"skill-hint":fx,"meta-text":u4,"attachment-skills":fx,"attachment-deferred-tools":EF,"dispatch-task":f4,"dispatch-result":c4};function kM({metaKind:e,text:t}){const[n,r]=g.useState(!1),i=aie[e];if(e==="slash-command"){const{commandName:o,commandMessage:a,commandArgs:l,body:c}=_m(t),u=o??(a?`/${a}`:null),d=!!(l&&l.length>0),f=c.length>0;return!u&&!d&&!f?null:h.jsxs("div",{"data-testid":"msg-line-user-meta","data-meta-kind":e,className:"flex min-w-0 max-w-full flex-col items-end gap-0.5 py-1",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2 max-w-full",children:[u?h.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md bg-bg-200/60 px-2 py-0.5 text-[11px] font-mono text-text-300 shrink-0",children:[h.jsx(i,{className:"w-3 h-3 opacity-70"}),u]}):null,d?h.jsx("span",{"data-testid":"user-meta-command-args",className:"min-w-0 text-[12px] text-text-200 whitespace-pre-wrap break-words max-w-[70ch] [overflow-wrap:anywhere]",children:l}):null]}),f?h.jsx("span",{className:"ml-2 max-w-[60%] truncate text-[11px] text-text-400",children:c}):null]})}const s=t.replace(/\s+/g," ").trim().slice(0,80);return h.jsxs("div",{"data-testid":"msg-line-user-meta","data-meta-kind":e,className:"flex min-w-0 max-w-full flex-col items-start gap-1 py-1",children:[h.jsxs("button",{type:"button","aria-expanded":n,onClick:()=>r(o=>!o),className:ie("group inline-flex items-center gap-1.5 rounded-md border border-bg-200/60 bg-bg-100/40","px-2 py-1 text-[11px] text-text-400 hover:bg-bg-200/40 transition-colors max-w-full"),children:[h.jsx(i,{className:"w-3 h-3 opacity-70 shrink-0"}),h.jsx("span",{className:"font-medium shrink-0",children:oie[e]}),h.jsx("span",{className:"truncate text-text-400/80 max-w-[60ch]",children:s}),n?h.jsx(Pn,{className:"w-3 h-3 opacity-60 shrink-0"}):h.jsx(Fn,{className:"w-3 h-3 opacity-60 shrink-0"})]}),n?h.jsx("pre",{"data-testid":"user-meta-body",className:"w-full max-w-full whitespace-pre-wrap break-words text-[11px] text-text-400 bg-bg-50/60 rounded-md p-2 border border-bg-200/60 [overflow-wrap:anywhere]",children:t}):null]})}function lie(e){return e.ordinal===null?e.label:`#${e.ordinal} ${e.label}`}function cie({text:e,metaKind:t,resolveDispatchOrigin:n,onOpenSession:r,onOpenFilePath:i}){const s=g.useMemo(()=>G$(e),[e]);return s.length===0?h.jsx(kM,{metaKind:t,text:e}):h.jsx("div",{"data-testid":"msg-line-dispatch-group",className:"my-1 flex min-w-0 max-w-full flex-col gap-1.5",children:s.map((o,a)=>h.jsx(fie,{block:o,...n?{resolveDispatchOrigin:n}:{},...r?{onOpenSession:r}:{},...i?{onOpenFilePath:i}:{}},`${o.kind}-${o.dispatchId}-${a}`))})}function uie(e){return e.length<=24?e:`${e.slice(0,12)}…${e.slice(-6)}`}function v2({origin:e}){const t=[];if(e.line&&t.push(h.jsx("span",{"data-testid":"dispatch-origin-line","data-line-ordinal":e.line.ordinal??"",className:"min-w-0 truncate tabular-nums text-text-300",children:lie(e.line)},"line")),t.push(h.jsxs("span",{"data-testid":"dispatch-origin-persona","data-persona-id":e.persona.id,className:"inline-flex min-w-0 items-baseline gap-1",children:[e.persona.label?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"truncate text-text-200",children:e.persona.label})," "]}):null,h.jsx("span",{className:"truncate font-mono text-[10px] text-text-400",children:e.persona.id})]},"persona")),e.device){const n=e.device;t.push(h.jsxs("span",{"data-testid":"dispatch-origin-device","data-device-id":n.id,title:n.id,className:"inline-flex min-w-0 items-baseline gap-1",children:[h.jsx(oF,{className:"h-3 w-3 shrink-0 translate-y-[2px] text-text-400"}),n.displayName?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"truncate text-text-200",children:n.displayName})," "]}):null,h.jsx("span",{className:"truncate font-mono text-[10px] text-text-400",children:uie(n.id)})]},"device"))}return h.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-baseline",children:[h.jsx("span",{className:"shrink-0 whitespace-pre text-text-400",children:"来自 "}),t.map((n,r)=>h.jsxs(Ze.Fragment,{children:[r>0?h.jsx("span",{className:"shrink-0 whitespace-pre text-text-400",children:" · "}):null,n]},r))]})}function die({origin:e,onOpenSession:t,seam:n}){const r=ie("flex w-full min-w-0 items-center gap-2 border-t bg-bg-200/35 px-3 py-1 text-left text-[10px] leading-relaxed",n),i=e.sessionId;return!i||!t?h.jsxs("div",{"data-testid":"dispatch-origin","data-openable":"false",className:r,children:[h.jsx(v2,{origin:e}),e.unreachable?h.jsx("span",{"data-testid":"dispatch-origin-unreachable",className:"ml-auto inline-flex shrink-0 items-center gap-1 text-text-400",children:e.unreachable==="remote-device"?"会话在对端设备":"会话已删除"}):null]}):h.jsxs("button",{type:"button","data-testid":"dispatch-origin","data-openable":"true","data-session-id":i,onClick:()=>t(i),title:"打开这条会话",className:ie(r,"group cursor-pointer transition-colors hover:bg-bg-200/70"),children:[h.jsx("span",{className:"min-w-0 group-hover:underline group-hover:decoration-text-400 group-hover:underline-offset-2",children:h.jsx(v2,{origin:e})}),h.jsxs("span",{className:"ml-auto inline-flex shrink-0 items-center gap-0.5 text-text-400 transition-colors group-hover:text-text-100",children:["打开会话",h.jsx(o4,{className:"h-3 w-3"})]})]})}function hie(e){return e?{shell:"border-error/40 bg-error-dim",rail:"bg-error/55",hover:"hover:bg-error/10",icon:"text-error",title:"text-error",chevron:"text-error/70",seam:"border-error/25"}:{shell:"border-accent/35 bg-accent-dim",rail:"bg-accent/45",hover:"hover:bg-accent/10",icon:"text-accent",title:"text-accent",chevron:"text-accent/70",seam:"border-accent/20"}}function fie({block:e,resolveDispatchOrigin:t,onOpenSession:n,onOpenFilePath:r}){const[i,s]=g.useState(!1),o=g.useMemo(()=>r?yM(r):Qs,[r]),a=e.kind==="task",l=(t==null?void 0:t(e.dispatchId,e.from))??(e.from?{persona:{id:e.from}}:void 0),c=a&&typeof e.round=="number"&&e.round>=2,u=e.status==="failure",d=hie(u);return h.jsxs("div",{"data-testid":"msg-line-dispatch","data-dispatch-kind":e.kind,"data-dispatch-id":e.dispatchId,"data-round":e.round??"","data-status":e.status??"","data-open":i?"true":"false",className:ie("flex min-w-0 max-w-full overflow-hidden rounded-lg border",d.shell),children:[h.jsx("span",{"data-testid":"dispatch-rail","aria-hidden":"true",className:ie("w-[3px] shrink-0 self-stretch",d.rail)}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h.jsxs("button",{type:"button","aria-expanded":i,onClick:()=>s(f=>!f),className:ie("flex w-full min-w-0 cursor-pointer items-start gap-2 px-3 py-2 text-left transition-colors",d.hover),children:[h.jsx("span",{className:ie("mt-[2px] shrink-0",d.icon),children:a?h.jsx(f4,{className:"h-3.5 w-3.5"}):h.jsx(c4,{className:"h-3.5 w-3.5"})}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsxs("span",{"data-testid":"dispatch-header",className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[h.jsx("span",{className:ie("text-[12px] font-semibold",d.title),children:a?"委派任务":"委派回报"}),c?h.jsxs("span",{"data-testid":"dispatch-round",className:"inline-flex items-center gap-1 rounded-md bg-bg-200/70 px-1.5 py-0.5 text-[10px] text-text-300",children:[h.jsx(RF,{className:"h-3 w-3"}),"续派第 ",e.round," 轮"]}):null,u?h.jsxs("span",{"data-testid":"dispatch-status",className:"inline-flex items-center gap-1 text-[11px] text-error",children:[h.jsx(Jo,{className:"h-3.5 w-3.5"}),"失败"]}):null,e.filePaths.length>0?h.jsxs("span",{"data-testid":"dispatch-file-count",className:"inline-flex items-center gap-1 text-[11px] text-text-400",children:[h.jsx(Ci,{className:"h-3 w-3"}),e.filePaths.length," 个产物"]}):null]}),h.jsx("span",{"data-testid":"dispatch-brief",className:"mt-1 block whitespace-pre-wrap break-words text-[12px] leading-relaxed text-text-200 [overflow-wrap:anywhere]",children:e.brief}),e.briefIsDerived?h.jsxs("span",{"data-testid":"dispatch-brief-derived",title:"发送方没写摘要,这段是从正文首段自动截取的",className:"mt-1 inline-flex items-center gap-1 text-[10px] text-text-400 italic",children:[h.jsx(zF,{className:"h-2.5 w-2.5"}),"自动摘要(发送方未填)"]}):null]}),h.jsx("span",{className:ie("mt-[3px] shrink-0",d.chevron),children:i?h.jsx(Pn,{className:"h-3.5 w-3.5"}):h.jsx(Fn,{className:"h-3.5 w-3.5"})})]}),l?h.jsx(die,{origin:l,...n?{onOpenSession:n}:{},seam:d.seam}):null,i?h.jsxs(h.Fragment,{children:[h.jsx("div",{"data-testid":"dispatch-body",className:ie("min-w-0 space-y-2 border-t bg-bg-200/35 py-2.5 pl-4 pr-3",d.seam),children:h.jsxs("div",{"data-testid":"dispatch-detail-indent",className:"min-w-0 border-l border-border/70 pl-3",children:[h.jsx("div",{"data-testid":"dispatch-detail",className:"assistant-markdown markdown-attached min-w-0 break-words",children:h.jsx(yl,{remarkPlugins:[_l],components:o,...r?{urlTransform:xM}:{},children:e.detail})}),e.filePaths.length>0?h.jsxs("div",{"data-testid":"dispatch-files",className:"flex min-w-0 flex-col gap-1 pt-2",children:[h.jsx("span",{className:"text-[11px] text-text-400",children:"产物"}),e.filePaths.map(f=>h.jsx(pie,{path:f,...r?{onOpenFilePath:r}:{}},f))]}):null]})}),h.jsxs("button",{type:"button","data-testid":"dispatch-collapse-foot",onClick:()=>s(!1),className:ie("flex w-full cursor-pointer items-center justify-between gap-2 border-t bg-bg-200/35 px-3 py-1 text-[10px] text-text-400 transition-colors hover:bg-bg-200/60",d.seam),children:[h.jsx("span",{className:"min-w-0 truncate",children:e.dispatchId?h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"台账 "}),h.jsx("span",{"data-testid":"dispatch-id",className:"font-mono",children:e.dispatchId})]}):null}),h.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:["收起",h.jsx(a4,{className:"h-3 w-3"})]})]})]}):null]})]})}function pie({path:e,onOpenFilePath:t}){const n="inline-flex min-w-0 items-center gap-1.5 text-left text-[11px] font-mono text-text-300";return t?h.jsxs("button",{type:"button","data-testid":"dispatch-file-path",title:e,onClick:()=>t(e),className:ie(n,"hover:text-text-100 hover:underline"),children:[h.jsx(Ci,{className:"h-3 w-3 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:e})]}):h.jsxs("span",{"data-testid":"dispatch-file-path",title:e,className:n,children:[h.jsx(Ci,{className:"h-3 w-3 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:e})]})}function mie({text:e,metaSource:t}){return t==="owner"?h.jsx("div",{className:"flex min-w-0 max-w-full flex-col items-start py-1.5","data-testid":"msg-line-owner-meta",children:h.jsxs("div",{className:ie("inline-flex min-w-0 max-w-[85%] items-start gap-2 rounded-md","border-l-[3px] border-accent bg-accent-dim px-3 py-2"),children:[h.jsx(fF,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-accent","aria-label":"补充信息"}),h.jsx("span",{className:"min-w-0 text-[12px] leading-relaxed text-text-100 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e})]})}):h.jsxs("div",{className:"flex min-w-0 max-w-full items-start gap-1.5 py-1 text-[11px] text-text-400","data-testid":"msg-line-cc-meta",children:[h.jsx(u4,{className:"mt-0.5 h-3 w-3 shrink-0"}),h.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e})]})}function ii(e,t){const r=new RegExp(`<${t}\\b[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(!r)return;const i=r[1].trim();return i||void 0}function r0(e,t){const r=new RegExp(`${t}\\s*=\\s*"([^"]+)"`,"i").exec(e);if(!r)return;const i=Number(r[1]);return Number.isFinite(i)?i:void 0}function CM(e){var i,s,o;const t={};if(!e)return t;t.taskId=ii(e,"task-id"),t.toolUseId=ii(e,"tool-use-id"),t.outputFile=ii(e,"output-file"),t.status=ii(e,"status"),t.summary=ii(e,"summary"),t.result=ii(e,"result");const n=ii(e,"usage");if(n){const a=(i=/<total_tokens>\s*(\d+)\s*<\/total_tokens>/i.exec(n))==null?void 0:i[1],l=(s=/<tool_uses>\s*(\d+)\s*<\/tool_uses>/i.exec(n))==null?void 0:s[1],c=(o=/<duration_ms>\s*(\d+)\s*<\/duration_ms>/i.exec(n))==null?void 0:o[1];a&&(t.totalTokens=Number(a)),l&&(t.toolUses=Number(l)),c&&(t.durationMs=Number(c))}const r=ii(e,"worktree");if(r)t.worktreePath=ii(r,"worktreePath"),t.worktreeBranch=ii(r,"worktreeBranch");else{const a=/<worktree\b([^>]*)\/>/i.exec(e);if(a){const l=a[1],c=/worktreePath\s*=\s*"([^"]+)"/i.exec(l),u=/worktreeBranch\s*=\s*"([^"]+)"/i.exec(l);c&&(t.worktreePath=c[1]),u&&(t.worktreeBranch=u[1])}}if(t.totalTokens===void 0&&t.toolUses===void 0&&t.durationMs===void 0){const a=r0(e,"total_tokens"),l=r0(e,"tool_uses"),c=r0(e,"duration_ms");a!==void 0&&(t.totalTokens=a),l!==void 0&&(t.toolUses=l),c!==void 0&&(t.durationMs=c)}return t}function gie(e){if(!e||!Number.isFinite(e))return null;if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/60),r=Math.round(t-n*60);return`${n}m${r.toString().padStart(2,"0")}s`}function vie({text:e,taskId:t,parentToolUseId:n}){const r=g.useMemo(()=>CM(e),[e]),[i,s]=g.useState(!1),o=t??r.taskId,a=n??r.toolUseId,l=r.status==="failed"?h.jsx(Jo,{className:"w-3.5 h-3.5 text-error"}):r.status==="completed"?h.jsx(e_,{className:"w-3.5 h-3.5 text-success"}):h.jsx(em,{className:"w-3.5 h-3.5 text-text-400"}),c=r.status??"unknown",u=gie(r.durationMs);return h.jsxs("div",{"data-testid":"msg-line-agent-notification","data-task-id":o??"","data-parent-tool-use-id":a??"",className:"my-1 min-w-0 max-w-full rounded-md border border-bg-200/60 bg-bg-100/40",children:[h.jsxs("button",{type:"button","aria-expanded":i,onClick:()=>s(d=>!d),className:ie("flex w-full min-w-0 items-start gap-2 px-2.5 py-1.5 text-left text-[12px]","hover:bg-bg-200/40 rounded-md transition-colors"),children:[h.jsx("span",{className:"mt-[2px] shrink-0",children:l}),h.jsxs("span",{className:"flex-1 min-w-0",children:[h.jsxs("span",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx("span",{className:"font-medium text-text-200",children:"子任务"}),h.jsx("span",{className:"text-text-400 text-[11px] font-mono",children:o?o.slice(0,12):"未知"}),h.jsx("span",{className:"text-text-400 text-[11px] uppercase tracking-wide",children:c}),u?h.jsxs("span",{className:"text-text-400 text-[11px] tabular-nums",children:["· ",u]}):null,r.totalTokens?h.jsxs("span",{className:"text-text-400 text-[11px] tabular-nums",children:["· ",r.totalTokens," tok"]}):null,r.toolUses?h.jsxs("span",{className:"text-text-400 text-[11px] tabular-nums",children:["· ",r.toolUses," tools"]}):null]}),r.summary?h.jsx("span",{className:"block truncate text-text-300 text-[12px] mt-0.5",children:r.summary}):null]}),i?h.jsx(Pn,{className:"w-3.5 h-3.5 mt-[3px] text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 mt-[3px] text-text-400 shrink-0"})]}),i?h.jsxs("div",{"data-testid":"agent-notification-body",className:"min-w-0 border-t border-bg-200/60 px-3 py-2 text-[12px] text-text-300 space-y-2",children:[r.worktreePath||r.worktreeBranch?h.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-text-400",children:[h.jsx(ku,{className:"w-3 h-3"}),r.worktreeBranch?h.jsx("span",{className:"font-mono",children:r.worktreeBranch}):null,r.worktreePath?h.jsx("span",{className:"truncate font-mono",children:r.worktreePath}):null]}):null,r.outputFile?h.jsxs("div",{className:"text-[11px] text-text-400",children:[h.jsx("span",{children:"输出文件:"}),h.jsx("span",{className:"font-mono",children:r.outputFile})]}):null,a?h.jsxs("div",{className:"text-[11px] text-text-400",children:[h.jsx("span",{children:"父工具调用:"}),h.jsx("span",{className:"font-mono",children:a})]}):null,r.result?h.jsx("div",{"data-testid":"agent-notification-result",className:"assistant-markdown text-[12px] leading-relaxed break-words",children:h.jsx(yl,{remarkPlugins:[_l],components:Qs,children:r.result})}):h.jsx("div",{className:"text-[11px] text-text-400 italic",children:"无详细结果"})]}):null]})}const EM=g.createContext(null);function xie({children:e}){const[t,n]=g.useState({agentId:null}),r=g.useCallback((o,a)=>{n({agentId:o,agentType:a})},[]),i=g.useCallback(()=>{n(o=>({agentId:null,agentType:o.agentType}))},[]),s=g.useMemo(()=>({state:t,open:r,close:i}),[t,r,i]);return h.jsx(EM.Provider,{value:s,children:e})}function IM(){return g.useContext(EM)}function yie(e){if(e==null)return null;if(typeof e=="string")return e;if(Array.isArray(e)){const t=[];for(const n of e)if(n&&typeof n=="object"){const r=n;r.type==="text"&&typeof r.text=="string"&&t.push(r.text)}else typeof n=="string"&&t.push(n);return t.length?t.join(`
|
|
570
|
+
`):null}if(typeof e=="object"){const t=e;if(typeof t.text=="string")return t.text}return null}function x2(e){if(!e||!Number.isFinite(e))return null;if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/60),r=Math.round(t-n*60);return`${n}m${r.toString().padStart(2,"0")}s`}function _ie(e){return!e||!Number.isFinite(e)?null:e<1e3?`${e} tok`:e<1e4?`${(e/1e3).toFixed(1)}k tok`:`${Math.round(e/1e3)}k tok`}const bie={readCount:"read",searchCount:"search",bashCount:"bash",editFileCount:"edit",linesAdded:"+lines",linesRemoved:"-lines",otherToolCount:"other"};function wie(e){if(!e)return[];const t=[];for(const[n,r]of Object.entries(e)){if(!r||r<=0)continue;const i=bie[n]??n;t.push(`${i}:${r}`)}return t}function Sie({expandable:e,expanded:t,onToggle:n,children:r}){const i=ie("flex w-full min-w-0 items-center gap-2 px-2.5 py-1.5 text-left text-[13px] rounded-md",e&&"hover:bg-bg-200/40 transition-colors");return e?h.jsx("button",{type:"button","aria-expanded":t,onClick:n,className:i,children:r}):h.jsx("div",{className:i,children:r})}function NM({description:e,input:t,output:n,error:r,pending:i,notifications:s,toolResultExtra:o,progress:a,expandable:l=!0}){const[c,u]=g.useState(!1),d=IM(),f=g.useMemo(()=>{if(!t||typeof t!="object")return null;const R=t;return typeof R.prompt=="string"?R.prompt:null},[t]),p=g.useMemo(()=>{if(!t||typeof t!="object")return;const R=t.agentId;return typeof R=="string"&&R.length>0?R:void 0},[t]),m=(o==null?void 0:o.prompt)??f,v=g.useMemo(()=>yie(n),[n]),w=o==null?void 0:o.stats,x=a==null?void 0:a.stats,_=x2((w==null?void 0:w.durationMs)??(x==null?void 0:x.durationMs)),b=_ie((w==null?void 0:w.tokens)??(x==null?void 0:x.tokens)),S=wie(w==null?void 0:w.toolStats),C=eR({pending:i,error:r,notifications:s,progress:a,input:t}),k=C&&(a!=null&&a.lastToolName)?`now:${a.lastToolName}`:null,T=!!(o!=null&&o.agentType||_||b||S.length>0||k),E=(o==null?void 0:o.agentId)??(a==null?void 0:a.agentId)??p,D=!!(r||(a==null?void 0:a.status)==="failed"),N=g.useMemo(()=>s.map(R=>({taskId:R.taskId,text:R.text,parsed:CM(R.text)})),[s]),L=D?h.jsx(Jo,{className:"w-3.5 h-3.5 text-error"}):C?h.jsx(Tn,{className:"w-3.5 h-3.5 text-blue-400 animate-spin"}):h.jsx(e_,{className:"w-3.5 h-3.5 text-green-500"});return h.jsxs("div",{"data-testid":"msg-line-agent-call","data-pending":i?"true":"false","data-active":C?"true":"false","data-has-error":D?"true":"false","data-notification-count":s.length,"data-has-stats":T?"true":"false","data-agent-id":E??"",className:"my-1 min-w-0 max-w-full rounded-md border border-bg-200/60 bg-bg-100/30",children:[h.jsxs(Sie,{expandable:l,expanded:c,onToggle:()=>u(R=>!R),children:[h.jsx("span",{className:"w-5 h-5 flex items-center justify-center text-[10px] rounded bg-violet-500/10 text-violet-500 shrink-0","aria-hidden":!0,children:h.jsx(rH,{className:"w-3 h-3"})}),h.jsx("span",{className:"shrink-0",children:L}),h.jsx("span",{className:"flex-1 min-w-0 truncate font-medium text-text-200",children:e}),T?null:s.length>0?h.jsxs("span",{className:"text-[11px] text-text-400 tabular-nums shrink-0",children:[s.length," 次通知"]}):null,E&&(d!=null&&d.open)?h.jsx("span",{role:"button",tabIndex:0,"data-testid":"open-subagent-btn-header","data-agent-id":E,"aria-label":"打开子 agent 对话",onClick:R=>{R.stopPropagation(),d.open(E,o==null?void 0:o.agentType)},onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.stopPropagation(),R.preventDefault(),d.open(E,o==null?void 0:o.agentType))},className:"shrink-0 inline-flex items-center justify-center w-3.5 h-3.5 text-text-400 hover:text-text-200",children:h.jsx(Su,{className:"w-3.5 h-3.5"})}):null,l?c?h.jsx(Pn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):null]}),C&&(a!=null&&a.description)?h.jsx("div",{"data-testid":"agent-call-progress-desc",className:"px-3 pt-0 pb-1 text-[12px] text-text-300 truncate",children:a.description}):null,T?h.jsxs("div",{"data-testid":"agent-call-stats",className:"flex items-center gap-1.5 flex-wrap px-3 pb-1.5 pt-0 text-[11px] text-text-400",children:[o!=null&&o.agentType?h.jsx("span",{"data-testid":"agent-call-stats-type",className:"inline-flex items-center rounded-sm bg-violet-500/10 px-1.5 py-0.5 text-violet-400 font-medium",children:o.agentType}):null,_?h.jsx("span",{className:"tabular-nums",children:_}):null,b?h.jsx("span",{className:"tabular-nums",children:b}):null,k?h.jsx("span",{"data-testid":"agent-call-stats-now",className:"font-mono tabular-nums text-blue-400",children:k}):null,S.map(R=>h.jsx("span",{className:"font-mono tabular-nums text-text-400/80",children:R},R)),s.length>0?h.jsxs("span",{className:"tabular-nums text-text-400/70",children:["· ",s.length," 次通知"]}):null]}):null,c?h.jsxs("div",{"data-testid":"agent-call-body",className:"min-w-0 border-t border-bg-200/60 px-3 py-2 space-y-3",children:[r?h.jsx("div",{className:"text-[12px] text-error whitespace-pre-wrap",children:r}):null,N.map((R,M)=>{const A=R.parsed,j=x2(A.durationMs);return h.jsxs("div",{"data-testid":"agent-call-notification","data-task-id":R.taskId??"",className:"min-w-0 rounded-md border border-bg-200/60 bg-bg-0/40 p-2 space-y-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-text-400 flex-wrap",children:[h.jsx("span",{className:"font-mono",children:(R.taskId??A.taskId??"未知").slice(0,12)}),h.jsx("span",{className:"uppercase tracking-wide",children:A.status??"unknown"}),j?h.jsxs("span",{className:"tabular-nums",children:["· ",j]}):null,A.totalTokens?h.jsxs("span",{className:"tabular-nums",children:["· ",A.totalTokens," tok"]}):null,A.toolUses?h.jsxs("span",{className:"tabular-nums",children:["· ",A.toolUses," tools"]}):null,A.worktreeBranch?h.jsxs("span",{className:"font-mono",children:["· ",A.worktreeBranch]}):null]}),A.summary?h.jsx("div",{className:"text-[12px] text-text-300",children:A.summary}):null,A.result?h.jsx("div",{"data-testid":"agent-call-notification-result",className:"assistant-markdown text-[12px] leading-relaxed break-words",children:h.jsx(yl,{remarkPlugins:[_l],components:Qs,children:A.result})}):null]},`${R.taskId??"n"}-${M}`)}),m?h.jsxs("div",{"data-testid":"agent-call-prompt-block",className:"min-w-0 space-y-1",children:[h.jsx("div",{className:"text-[11px] text-text-400 font-medium",children:"任务指令"}),h.jsx("pre",{"data-testid":"agent-call-prompt",className:"max-w-full whitespace-pre-wrap break-words text-[11px] text-text-300 bg-bg-50/60 rounded p-2 border border-bg-200/60 max-h-64 overflow-auto [overflow-wrap:anywhere]",children:m})]}):null,v?h.jsxs("div",{"data-testid":"agent-call-result-block",className:"min-w-0 space-y-1",children:[h.jsx("div",{className:"text-[11px] text-text-400 font-medium",children:"子 agent 报告"}),h.jsx("div",{"data-testid":"agent-call-result",className:"assistant-markdown text-[12px] leading-relaxed break-words",children:h.jsx(yl,{remarkPlugins:[_l],components:Qs,children:v})})]}):null,!v&&N.length===0&&!r&&!m?h.jsx("div",{className:"text-[11px] text-text-400 italic",children:"无详细信息"}):null,E&&(d!=null&&d.open)?h.jsx("div",{className:"flex justify-end",children:h.jsxs("button",{type:"button","data-testid":"open-subagent-btn","data-agent-id":E,onClick:()=>d.open(E,o==null?void 0:o.agentType),className:ie("inline-flex items-center gap-1 rounded-md border border-bg-200/60","bg-bg-100/40 hover:bg-bg-200/40 transition-colors","px-2 py-1 text-[11px] text-text-300"),children:[h.jsx(Su,{className:"w-3 h-3"}),h.jsx("span",{children:"打开子 agent 对话"})]})}):null]}):null]})}function TM({title:e,items:t,progressColor:n="bg-green-500",listKind:r}){const[i,s]=g.useState(!1),o=t.length,a=t.filter(c=>c.status==="completed").length,l=o>0?Math.round(a/o*100):0;return h.jsxs("div",{"data-testid":"msg-line-checklist","data-list-kind":r,className:"min-w-0 max-w-full py-1",children:[h.jsxs("button",{type:"button",onClick:()=>s(c=>!c),"aria-expanded":i,className:"flex items-center gap-2.5 w-full text-left rounded-md px-1.5 py-1 hover:bg-text-100/5 cursor-pointer",children:[i?h.jsx(Pn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}),h.jsx("span",{className:"text-[13px] font-medium text-text-200",children:e}),h.jsxs("span",{className:"text-[11px] text-text-400 tabular-nums",children:[a,"/",o]}),h.jsx("div",{className:"flex-1 max-w-[120px] h-1.5 rounded-full bg-text-100/10 overflow-hidden",children:h.jsx("div",{className:ie("h-full rounded-full transition-all duration-300",n),style:{width:`${l}%`}})})]}),i?h.jsx("div",{"data-testid":"checklist-body",className:"ml-6 mt-0.5",children:h.jsx("div",{className:"space-y-px",children:t.map((c,u)=>h.jsxs("div",{className:"flex min-w-0 items-start gap-2 py-0.5 px-1",children:[h.jsx("span",{className:"w-4 h-4 mt-0.5 flex items-center justify-center shrink-0",children:c.status==="completed"?h.jsx(Qo,{className:"w-3.5 h-3.5 text-green-500"}):h.jsx("span",{className:"w-2 h-2 rounded-full border border-text-400/40"})}),h.jsx("span",{className:ie("min-w-0 text-[13px] leading-snug break-words [overflow-wrap:anywhere]",c.status==="completed"?"text-text-400 line-through":"text-text-200"),children:c.status==="in_progress"&&c.activeForm?c.activeForm:c.content})]},`${u}-${c.content}`))})}):null]})}function kie({todos:e}){return h.jsx(TM,{title:"Tasks",items:e,progressColor:"bg-green-500",listKind:"todo"})}function Cie({tasks:e}){return h.jsx(TM,{title:"Plan",items:e,progressColor:"bg-blue-500",listKind:"plan"})}function Eie(e){if(!e||!Number.isFinite(e))return null;const t=Date.now()-e;if(t<0)return null;const n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);if(i<24)return`${i}h ago`;const s=Math.floor(i/24);if(s<7)return`${s}d ago`;const o=Math.floor(s/7);return o<5?`${o}w ago`:new Date(e).toISOString().slice(0,10)}function Iie(e){return(e.split("/").pop()??e)||e}function Nie({memories:e}){return!e||e.length===0?null:h.jsxs("div",{"data-testid":"memory-callout",className:"my-1 min-w-0 max-w-full rounded-md border border-bg-200/60 bg-bg-100/30",children:[h.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[12px] text-text-300 border-b border-bg-200/60",children:[h.jsx(m7,{className:"w-3.5 h-3.5 text-amber-500 shrink-0"}),h.jsx("span",{className:"font-medium",children:"项目记忆"}),h.jsxs("span",{className:"text-text-400 tabular-nums",children:["· ",e.length]})]}),h.jsx("ul",{className:"divide-y divide-bg-200/40",children:e.map(t=>h.jsx(Tie,{memory:t},t.path))})]})}function Tie({memory:e}){const[t,n]=g.useState(!1),r=Eie(e.mtimeMs),i=e.content.replace(/\s+/g," ").trim().slice(0,80);return h.jsxs("li",{className:"px-2.5 py-1.5",children:[h.jsxs("button",{type:"button","aria-expanded":t,onClick:()=>n(s=>!s),className:ie("flex w-full items-center gap-1.5 text-left text-[12px]","hover:bg-bg-200/30 rounded-sm py-0.5"),children:[t?h.jsx(Pn,{className:"w-3 h-3 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3 h-3 text-text-400 shrink-0"}),h.jsx("span",{className:"font-mono text-text-300 shrink-0 max-w-[20ch] truncate",title:e.path,children:Iie(e.path)}),h.jsx("span",{className:"flex-1 min-w-0 truncate text-text-400/80",children:i}),r?h.jsx("span",{className:"shrink-0 text-[11px] text-text-400 tabular-nums",children:r}):null]}),t?h.jsx("pre",{"data-testid":"memory-callout-body",className:"mt-1 max-w-full whitespace-pre-wrap break-words text-[12px] text-text-300 bg-bg-50/60 rounded-md p-2 border border-bg-200/60 [overflow-wrap:anywhere]",children:e.content}):null]})}function Pie({toolUseId:e,questions:t,onSubmit:n,onCancel:r,submittedAnswers:i}){const[s,o]=g.useState({}),[a,l]=g.useState({}),[c,u]=g.useState({}),[d,f]=g.useState(!1),[p,m]=g.useState(!1),v=i!==void 0&&Object.keys(i).length>0,w=v||p,x=!n&&!v,_=(k,T)=>{const E={labels:new Set,freeText:""};if(!v||!i)return E;const D=i[k];if(typeof D!="string")return E;const N=D.split(",").map(A=>A.trim()).filter(Boolean),L=new Set(T.map(A=>A.label)),R=new Set,M=[];for(const A of N)L.has(A)?R.add(A):M.push(A);return{labels:R,freeText:M.join(", ")}},b=g.useMemo(()=>t.every(k=>{if((c[k.question]??"").trim().length>0)return!0;if(k.multiSelect){const E=a[k.question];return!!(E&&E.size>0)}return typeof s[k.question]=="string"&&s[k.question].length>0}),[t,s,a,c]),S=async()=>{if(!b||d||w||x||!n)return;const k={};for(const T of t){const E=(c[T.question]??"").trim();if(T.multiSelect){const D=a[T.question],N=D?T.options.filter(L=>D.has(L.label)).map(L=>L.label):[];if(E.length>0&&N.push(E),N.length===0)continue;k[T.question]=N.join(", ")}else if(E.length>0)k[T.question]=E;else{const D=s[T.question];typeof D=="string"&&(k[T.question]=D)}}f(!0);try{await n(k),m(!0)}finally{f(!1)}},C=ed(()=>{S()});return h.jsxs("div",{"data-testid":"msg-line-question","data-tool-use-id":e,className:"min-w-0 max-w-full rounded-md border border-accent/40 bg-accent/5 px-3 py-2.5 text-[13px]",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2 mb-2",children:[h.jsx(E7,{className:"w-4 h-4 text-accent shrink-0"}),h.jsx("span",{className:"min-w-0 font-medium text-text-100",children:"需要你的回答 / Need your answer"}),t.length>1?h.jsxs("span",{className:"ml-auto text-[12px] text-text-400","data-testid":"msg-line-question-count",children:[t.length," 个问题"]}):null]}),h.jsx("div",{className:"flex flex-col gap-3 mb-3",children:t.map((k,T)=>{const E=`q-${T}`,D=`${e}-${T}`,N=_(k.question,k.options),L=w||x,R=c[k.question]??"",M=v?N.freeText:p?(c[k.question]??"").trim():"";return h.jsxs("div",{"data-testid":"msg-line-question-item",children:[k.question?h.jsx("div",{className:"text-text-200 mb-1.5",children:k.question}):null,h.jsx("div",{className:"flex flex-col gap-1",children:k.options.map((A,j)=>{var $;const z=`${E}-${j}`,F=v?N.labels.has(A.label):k.multiSelect?!!(($=a[k.question])!=null&&$.has(A.label)):s[k.question]===A.label;return h.jsxs("label",{className:"flex min-w-0 items-start gap-2 cursor-pointer select-none py-1 px-2 rounded hover:bg-bg-100",children:[h.jsx("input",{type:k.multiSelect?"checkbox":"radio",name:D,value:A.label,checked:F,disabled:w||x,onChange:()=>{w||x||(k.multiSelect?l(B=>{const I=new Set(B[k.question]??[]);return I.has(A.label)?I.delete(A.label):I.add(A.label),{...B,[k.question]:I}}):o(B=>({...B,[k.question]:A.label})))},className:"mt-0.5","data-testid":"msg-line-question-option"}),h.jsxs("span",{className:"flex min-w-0 flex-col",children:[h.jsx("span",{className:"text-text-100 [overflow-wrap:anywhere]",children:A.label}),A.description?h.jsx("span",{className:"text-[12px] text-text-400 [overflow-wrap:anywhere]",children:A.description}):null]})]},z)})}),L?M.length>0?h.jsx("div",{className:"mt-2 rounded-lg border border-accent/15 bg-bg-100/60 px-3 py-2 text-[13px] leading-relaxed text-text-200 [overflow-wrap:anywhere]","data-testid":"msg-line-question-freetext-result",children:M}):null:h.jsx("textarea",{rows:3,value:R,placeholder:"或自行输入回答...",onChange:A=>{const j=A.target.value;u(z=>({...z,[k.question]:j}))},...C,className:"mt-2 w-full resize-y rounded-lg border border-accent/20 bg-bg-000/60 px-3 py-2 text-[13px] leading-relaxed text-text-100 placeholder:text-text-400 outline-none transition-colors focus:border-accent/60 focus:bg-bg-000","data-testid":"msg-line-question-freetext"})]},E)})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(tl,{size:"sm",variant:"default",onClick:()=>void S(),disabled:!b||d||w||x,"data-testid":"msg-line-question-submit",children:w?"已提交 / Submitted":x?"已结束 / Ended":"提交 / Submit"}),r&&!w&&!x?h.jsx(tl,{size:"sm",variant:"ghost",onClick:()=>void r(),disabled:d,"data-testid":"msg-line-question-cancel",children:"跳过 / Skip"}):null]})]})}function Rie({toolUseId:e,questions:t,historicalAnswers:n,realtimeAnswers:r,onSubmit:i,onCancel:s}){const o=r??n,a=g.useCallback(async c=>{i&&await i(e,c)},[i,e]),l=g.useCallback(async()=>{s&&await s(e)},[s,e]);return h.jsx(Pie,{toolUseId:e,questions:t,onSubmit:i?a:void 0,...s?{onCancel:l}:{},submittedAnswers:o})}function Mie(){const e=new Map,t=(n,r)=>`${n}::${r}`;return{register(n,r,i){e.set(t(n,r),i)},resolve(n,r){return n?e.get(t(n,r))??null:null},reset(){e.clear()}}}const za=Mie();function PM({lines:e,onPermissionRespond:t,onPermissionInterrupt:n,topSlot:r,onRewind:i,rewindableUserMessageIds:s,onFork:o,onQuickAsk:a,forkByTurn:l=!1,realtimeQuestionAnswers:c,onSubmitQuestion:u,onCancelQuestion:d,liveQuestionToolUseIds:f,fileSharingScope:p,onShareFile:m,onOpenInTab:v,onPreviewMarkdown:w,onOpenFilePath:x,dispatchOrigin:_,turnCollapse:b,dockedAgentToolUseIds:S,codexHistory:C}){const k=g.useMemo(()=>tR(e),[e]),T=g.useMemo(()=>{const N=new Map;let L;for(const R of k)R.kind==="user-text"&&R.continuesTurn!==!0&&(L=void 0),R.kind==="assistant-text"&&(L=R.seq),R.kind==="turn-end"&&(R.turnId&&R.reason!=="interrupted"&&L!==void 0&&N.set(L,R.turnId),L=void 0);return N},[k]),E=g.useMemo(()=>b?NY(k,b):null,[k,b]),D={codexHistory:C,onRewind:i,rewindableUserMessageIds:s,onPermissionRespond:t,onPermissionInterrupt:n,onFork:o,onQuickAsk:a,forkByTurn:l,codexForkAnchors:T,realtimeQuestionAnswers:c,onSubmitQuestion:u,onCancelQuestion:d,liveQuestionToolUseIds:f,fileSharingScope:p,onShareFile:m,onOpenInTab:v,onPreviewMarkdown:w,onOpenFilePath:x,dispatchOrigin:_,dockedAgentToolUseIds:S};return h.jsxs("div",{"data-testid":"message-list",className:"flex w-full min-w-0 max-w-full flex-col gap-2 px-4 py-3",children:[r,E!==null?E.map(N=>Aie(N,D)):k.map(N=>sp(N,D))]})}function Aie(e,t){var l;const n=e.turnId?`turn-${e.turnId}`:`turn-${e.seq}`,r=e.turnId&&((l=t.codexHistory)!=null&&l.turnIds.has(e.turnId))?t.codexHistory:void 0,i=e.turnId?r==null?void 0:r.details[e.turnId]:void 0,s=e.query?sp(e.query,t):null,o=e.process.map(c=>jie(c,t)),a=e.tail.map(c=>sp(c,t));return e.status==="running"?h.jsxs(Ze.Fragment,{children:[s,o,a]},n):h.jsxs("div",{"data-history-turn-id":e.turnId,className:"flex flex-col gap-2",children:[s,h.jsxs(zY,{status:e.status,onExpandedChange:r&&e.turnId?c=>{c&&r.loadDetails(e.turnId)}:void 0,...e.durationMs!==void 0?{durationMs:e.durationMs}:{},children:[o,r&&!i?h.jsx("span",{className:"text-text-400 text-xs",children:"展开后加载过程"}):null,i!=null&&i.loading?h.jsx("span",{className:"text-text-400 text-xs","data-testid":"turn-details-loading",children:"正在加载过程…"}):null,i!=null&&i.error?h.jsxs("div",{className:"text-destructive text-xs","data-testid":"turn-details-error",children:[i.error," ",h.jsx("button",{type:"button",onClick:()=>void(r==null?void 0:r.loadDetails(e.turnId)),children:"重试"})]}):null,i!=null&&i.nextCursor&&!i.loading&&!i.error?h.jsx("button",{type:"button",className:"text-accent text-xs",onClick:()=>void(r==null?void 0:r.loadDetails(e.turnId,!0)),children:"加载更多过程"}):null,i&&!i.loading&&!i.error&&i.items.length===0?h.jsx("span",{className:"text-text-400 text-xs",children:"没有更多过程"}):null]}),a]},n)}function jie(e,t){return e.kind==="tool-group"?h.jsx(OY,{items:e.items,renderItemDetail:n=>Lie(n,t)},`tool-group-${e.seq}`):sp(e,t)}function Lie(e,t){const n=za.resolve(e.toolKind,e.tool);return n?n.render({input:e.input,output:e.output,error:e.error,pending:e.pending,toolUseId:e.toolUseId,...t.fileSharingScope?{fileScope:t.fileSharingScope}:{},...t.onShareFile?{onShareFile:t.onShareFile}:{},...t.onOpenInTab?{onOpenInTab:t.onOpenInTab}:{},...t.onPreviewMarkdown?{onPreviewMarkdown:t.onPreviewMarkdown}:{}}):null}function sp(e,t){var b;const{onRewind:n,rewindableUserMessageIds:r,onPermissionRespond:i,onPermissionInterrupt:s,onFork:o,onQuickAsk:a,realtimeQuestionAnswers:l,onSubmitQuestion:c,onCancelQuestion:u,liveQuestionToolUseIds:d,fileSharingScope:f,onShareFile:p,onOpenInTab:m,onPreviewMarkdown:v,onOpenFilePath:w,dispatchOrigin:x}=t,_=`${e.kind}-${e.seq}`;switch(e.kind){case"session-init":return null;case"user-text":{const S=typeof e.uuid=="string"?e.uuid:void 0,C=!!(n&&S&&(!r||r.has(S)));return h.jsx(rie,{text:e.text,senderDisplayName:e.senderDisplayName,senderPrincipal:e.senderPrincipal,rewindTarget:C&&S&&n?{userMessageId:S,onRewind:n}:void 0},_)}case"user-meta":return Zp(e.metaKind)?h.jsx(cie,{text:e.text,metaKind:e.metaKind,...x!=null&&x.resolve?{resolveDispatchOrigin:x.resolve}:{},...x!=null&&x.onOpenSession?{onOpenSession:x.onOpenSession}:{},...w?{onOpenFilePath:w}:{}},_):h.jsx(kM,{metaKind:e.metaKind,text:e.text},_);case"meta-text":return h.jsx(mie,{text:e.text,metaSource:e.metaSource},_);case"agent-notification":return h.jsx(vie,{text:e.text,taskId:e.taskId,parentToolUseId:e.parentToolUseId},_);case"assistant-text":{const S=t.forkByTurn?t.codexForkAnchors.get(e.seq):typeof e.uuid=="string"?e.uuid:void 0,C=S&&(o||a)?{messageUuid:S,onFork:o,onQuickAsk:a}:void 0;return h.jsx(Ere,{text:qY(e.text),forkTarget:C,...w?{onOpenFilePath:w}:{}},_)}case"assistant-thinking":return h.jsx(Ire,{text:e.text},_);case"permission-inline":return h.jsx(Jre,{tool:e.tool,input:e.input,onRespond:i??(()=>{}),onInterrupt:s},_);case"error":return h.jsx(eie,{message:e.message},_);case"turn-end":return null;case"merged-tool":return Die(e,_,{fileSharingScope:f,onShareFile:p,onOpenInTab:m,onPreviewMarkdown:v});case"merged-agent":return(b=t.dockedAgentToolUseIds)!=null&&b.has(e.toolUseId)?null:h.jsx(NM,{description:e.description,input:e.input,output:e.output,error:e.error,pending:e.pending,notifications:e.notifications,toolResultExtra:e.toolResultExtra,progress:e.progress},_);case"plan-card":return h.jsx(Cie,{tasks:e.tasks},_);case"todo-checklist":return h.jsx(kie,{todos:e.todos},_);case"memory-callout":return h.jsx(Nie,{memories:e.memories},_);case"question-card":{const S=d===void 0||d.has(e.toolUseId);return h.jsx(Rie,{toolUseId:e.toolUseId,questions:e.questions,historicalAnswers:e.submittedAnswers,realtimeAnswers:l==null?void 0:l[e.toolUseId],onSubmit:S?c:void 0,...S&&u?{onCancel:u}:{}},_)}default:return null}}function Die(e,t,n){const r=za.resolve(e.toolKind,e.tool),i=r?r.render({input:e.input,output:e.output,error:e.error,pending:e.pending,toolUseId:e.toolUseId,...n.fileSharingScope?{fileScope:n.fileSharingScope}:{},...n.onShareFile?{onShareFile:n.onShareFile}:{},...n.onOpenInTab?{onOpenInTab:n.onOpenInTab}:{},...n.onPreviewMarkdown?{onPreviewMarkdown:n.onPreviewMarkdown}:{}}):null;return h.jsx(Ze.Fragment,{children:i??h.jsx(wM,{tool:e.tool,input:e.input,output:e.output,error:e.error,pending:e.pending,...n.fileSharingScope?{fileScope:n.fileSharingScope}:{},...n.onShareFile?{onShareFile:n.onShareFile}:{},...n.onOpenInTab?{onOpenInTab:n.onOpenInTab}:{},...n.onPreviewMarkdown?{onPreviewMarkdown:n.onPreviewMarkdown}:{}})},t)}function y2(e){const t=e.getBoundingClientRect().top,n=[...e.querySelectorAll("[data-history-turn-id]")].find(r=>r.getBoundingClientRect().bottom>t);return n!=null&&n.dataset.historyTurnId?{turnId:n.dataset.historyTurnId,offset:n.getBoundingClientRect().top-t}:null}function Oie(e,t){const n=[...e.querySelectorAll("[data-history-turn-id]")].find(r=>r.dataset.historyTurnId===t.turnId);n&&(e.scrollTop+=n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.offset)}const Bie={builtin:"Commands",global:"Global",project:"Project",plugin:"Plugin"},_2={builtin:0,global:1,project:2,plugin:3};function $ie({query:e,skills:t,activeIndex:n,onActiveIndexChange:r,onSelect:i}){const s=g.useRef(null),o=g.useMemo(()=>RM(t,e),[t,e]),a=g.useMemo(()=>{const l=new Set;let c=null;for(let u=0;u<o.length;u++)o[u].source!==c&&(l.add(u),c=o[u].source);return l},[o]);return g.useEffect(()=>{var l;try{(l=s.current)==null||l.scrollIntoView({block:"nearest"})}catch{}},[n]),o.length===0?null:h.jsx("div",{"data-testid":"cc-skill-selector",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 max-h-[320px] overflow-y-auto rounded-2xl border border-bg-300 bg-bg-50 shadow-lg",children:o.map((l,c)=>{const u=c===n,d=a.has(c);return h.jsxs(Ze.Fragment,{children:[d?h.jsx("div",{className:"sticky top-0 z-10 bg-bg-50/95 backdrop-blur-sm px-4 py-2 text-[10px] font-semibold uppercase tracking-wider text-text-400/70 border-b border-bg-200/60",children:Bie[l.source]}):null,h.jsxs("div",{ref:u?s:void 0,"data-testid":`cc-skill-item-${l.name}`,onMouseEnter:()=>r(c),onClick:()=>i(l),className:ie("flex items-center gap-2.5 px-4 py-2 cursor-pointer transition-colors duration-75",u?"bg-[var(--text-100-dim)]":"hover:bg-bg-100/60"),children:[h.jsxs("code",{className:"text-[12px] font-mono font-semibold text-text-100 shrink-0",children:["/",l.name]}),l.description?h.jsx("span",{className:"text-[11px] text-text-300 truncate ml-auto",children:l.description}):null]})]},`${l.source}/${l.name}`)})})}function RM(e,t){const n=t.trim().toLowerCase(),r=n?e.filter(i=>i.name.toLowerCase().includes(n)||(i.description??"").toLowerCase().includes(n)):e.slice();return r.sort((i,s)=>(_2[i.source]??9)-(_2[s.source]??9)),r.slice(0,30)}const zie=g.createContext(null);function Fie(){return g.useContext(zie)}const Hie={builtin:"Built-in",global:"Global",project:"Project",policy:"Policy",plugin:"Plugin",persona:"My personas",contact:"People","remote-persona":"Remote personas"},b2={builtin:0,global:1,project:2,policy:3,plugin:4,persona:5,contact:6,"remote-persona":7};function op(e){switch(e.kind){case"persona":return"persona";case"contact":return"contact";case"remote-persona":return"remote-persona";case"cc-agent":return e.agent.source}}function Uie(e){switch(e.kind){case"persona":return`persona/${e.persona.personaId}`;case"contact":return`contact/${e.contact.deviceId}`;case"remote-persona":return`remote/${e.deviceId}/${e.persona.personaId}`;case"cc-agent":return`${e.agent.source}/${e.agent.name}`}}function Wie(e){switch(e.kind){case"persona":return`${e.persona.personaId} ${e.persona.label}`.toLowerCase();case"contact":return`${e.contact.displayName} ${e.contact.deviceId}`.toLowerCase();case"remote-persona":return`${e.persona.personaId} ${e.persona.label}`.toLowerCase();case"cc-agent":{const t=e.agent;return`${t.name} ${t.description??""} ${t.whenToUse??""}`.toLowerCase()}}}function qie(e){switch(e.kind){case"persona":return{displayName:`@persona/${e.persona.personaId}`,description:e.persona.label,testid:`cc-agent-item-persona-${e.persona.personaId}`};case"contact":return{displayName:`@${e.contact.displayName}`,description:e.contact.deviceId,testid:`cc-agent-item-contact-${e.contact.deviceId}`};case"remote-persona":return{displayName:`@persona/${e.persona.personaId}`,description:e.persona.label,testid:`cc-agent-item-remote-${e.deviceId}-${e.persona.personaId}`};case"cc-agent":return{displayName:`@${e.agent.name}`,description:e.agent.description,whenToUse:e.agent.whenToUse,plugin:e.agent.plugin,testid:`cc-agent-item-${e.agent.name}`}}}function MM(e,t){const n=t.trim().toLowerCase(),r=n?e.filter(i=>Wie(i).includes(n)):e.slice();return r.sort((i,s)=>(b2[op(i)]??9)-(b2[op(s)]??9)),r.slice(0,30)}function w2({query:e,entries:t,activeIndex:n,onActiveIndexChange:r,onSelect:i}){const s=g.useRef(null),o=g.useMemo(()=>MM(t,e),[t,e]),a=g.useMemo(()=>{const l=new Set;let c=null;for(let u=0;u<o.length;u++){const d=op(o[u]);d!==c&&(l.add(u),c=d)}return l},[o]);return g.useEffect(()=>{var l;try{(l=s.current)==null||l.scrollIntoView({block:"nearest"})}catch{}},[n]),o.length===0?null:h.jsx("div",{"data-testid":"cc-agent-selector",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 max-h-[320px] overflow-y-auto rounded-2xl border border-bg-300 bg-bg-50 shadow-lg",children:o.map((l,c)=>{const u=c===n,d=a.has(c),f=op(l),p=qie(l);return h.jsxs(Ze.Fragment,{children:[d?h.jsx("div",{"data-testid":`cc-agent-group-header-${f}`,"data-source":f,className:"sticky top-0 z-10 bg-bg-50/95 backdrop-blur-sm px-4 py-2 text-[10px] font-semibold uppercase tracking-wider text-text-400/70 border-b border-bg-200/60",children:Hie[f]}):null,h.jsxs("div",{ref:u?s:void 0,"data-testid":p.testid,onMouseEnter:()=>r(c),onClick:()=>i(l),className:ie("flex items-center gap-2.5 px-4 py-2 cursor-pointer transition-colors duration-75",u?"bg-[var(--text-100-dim)]":"hover:bg-bg-100/60"),children:[h.jsx("code",{className:"text-[12px] font-mono font-semibold text-text-100 shrink-0",children:p.displayName}),p.description?h.jsx("span",{className:"text-[11px] text-text-300 truncate ml-2",children:p.description}):null,p.whenToUse?h.jsx("span",{className:"text-[10px] text-text-400/70 italic truncate ml-auto",children:p.whenToUse}):null,p.plugin?h.jsx("span",{className:"text-[10px] text-text-400/70 ml-2 shrink-0",children:p.plugin}):null]})]},Uie(l))})})}function Vie({attachment:e,onRemove:t,onOpenPreview:n}){var l;const r=e.mimeType.startsWith("image/"),i=e.status==="error",s=e.status==="uploading",o=((l=e.error)==null?void 0:l.trim())||"附件上传失败,请移除后重试",a=r&&e.status==="done"&&!!e.previewUrl&&!!n;return h.jsxs("div",{"data-testid":`attachment-pill-${e.id}`,className:ie("group relative flex items-center gap-1.5 rounded-lg border px-2 py-1.5 text-[12px] transition-colors",i?"border-red-400/40 bg-red-500/5":"border-bg-300 bg-bg-100"),children:[r&&e.previewUrl?h.jsxs("div",{className:"relative h-7 w-7 shrink-0",children:[h.jsx("img",{src:e.previewUrl,alt:e.fileName,onClick:a?n:void 0,"data-testid":`attachment-thumb-${e.id}`,className:ie("h-7 w-7 rounded object-cover",a&&"cursor-pointer hover:opacity-80",s&&"opacity-40")}),s?h.jsx(Tn,{"data-testid":`attachment-spinner-${e.id}`,className:"absolute inset-0 m-auto h-3.5 w-3.5 animate-spin text-text-200"}):null]}):h.jsx("div",{className:"relative flex h-7 w-7 items-center justify-center rounded bg-text-100/5 shrink-0",children:s?h.jsx(Tn,{"data-testid":`attachment-spinner-${e.id}`,className:"h-3.5 w-3.5 animate-spin text-text-400"}):h.jsx(Ci,{className:"h-3.5 w-3.5 text-text-400"})}),h.jsx("span",{className:ie("max-w-[120px] truncate text-text-200",s&&"text-text-400"),title:e.fileName,children:e.fileName}),i?h.jsx(Tu,{children:h.jsxs(td,{children:[h.jsx(nd,{asChild:!0,children:h.jsx("button",{type:"button","aria-label":`查看附件错误:${o}`,className:"flex h-4 w-4 items-center justify-center rounded text-red-400 shrink-0 cursor-help focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",children:h.jsx(Jo,{className:"h-3 w-3","aria-hidden":"true"})})}),h.jsx(Ul,{side:"top",collisionPadding:8,className:"max-w-[min(24rem,calc(100vw-2rem))] whitespace-pre-wrap break-words",children:o})]})}):null,h.jsx("button",{type:"button",onClick:t,"data-testid":`attachment-remove-${e.id}`,className:"flex h-4 w-4 items-center justify-center rounded-full text-text-400 hover:text-text-100 hover:bg-text-100/10 transition-colors cursor-pointer shrink-0","aria-label":"remove",children:h.jsx(Qr,{className:"h-3 w-3"})})]})}function Kie({attachments:e,onRemove:t,onOpenPreview:n}){return e.length===0?null:h.jsx("div",{"data-testid":"attachment-row",className:"flex flex-wrap gap-1.5 mb-2 px-1",children:e.map(r=>h.jsx(Vie,{attachment:r,onRemove:()=>t(r.id),onOpenPreview:n?()=>n(r):void 0},r.id))})}class ka extends Error{constructor(t,n,r){super(n),this.code=t,this.status=r,this.name="UploadAttachmentError"}}async function Gie(e){if(!e.httpBaseUrl)throw new ka("TUNNEL_NOT_READY","daemon httpBaseUrl unavailable");if(!e.httpToken)throw new ka("NO_AUTH","daemon httpToken unavailable");const t=HT(e.file.name,e.file.type);if(!t)throw new ka("UNSUPPORTED_MIME","不支持的文件类型");const n=new URLSearchParams({sessionId:e.sessionId,fileName:e.file.name,mimeType:t}),r=`${e.httpBaseUrl.replace(/\/$/,"")}/attachments/upload?${n.toString()}`;let i;try{i=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${e.httpToken}`,"Content-Type":t},body:e.file})}catch(s){throw new ka("NETWORK_ERROR",s.message)}if(!i.ok){let s="UPLOAD_FAILED",o=`HTTP ${i.status}`;try{const a=await i.json();a.code&&(s=a.code),a.message&&(o=a.message)}catch{}throw new ka(s,o,i.status)}return await i.json()}let Yie=0;const Xie=()=>`att-${++Yie}-${Date.now()}`;function Zie(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(typeof r.result=="string"?r.result:""),r.onerror=()=>n(r.error??new Error("read failed")),r.readAsDataURL(e)})}function Qie(e){const[t,n]=g.useState(e.initial??[]),r=g.useCallback(async o=>{const a=Array.from(o);if(a.length===0)return;const l=[],c=[],u=[];for(const d of a){const f=HT(d.name,d.type),p={id:Xie(),fileName:d.name,mimeType:f??(d.type||"application/octet-stream")};if(!f){c.push({...p,url:null,status:"error",error:"不支持的文件类型"});continue}if(d.size>HS){c.push({...p,url:null,status:"error",error:`超过 ${Math.round(HS/1024/1024)}MB 上限`});continue}if(e.sessionId==null){u.push({id:p.id,file:d,mimeType:p.mimeType}),c.push({...p,url:null,status:"uploading"});continue}const m=p.mimeType.startsWith("image/")?URL.createObjectURL(d.type===p.mimeType?d:d.slice(0,d.size,p.mimeType)):void 0;c.push({...p,url:null,status:"uploading",...m?{previewUrl:m}:{}}),l.push({id:p.id,file:d})}n(d=>[...d,...c]);for(const d of u)try{const f=await Zie(d.file.slice(0,d.file.size,d.mimeType));n(p=>p.map(m=>m.id===d.id?{...m,url:f,status:"done",...d.mimeType.startsWith("image/")?{previewUrl:f}:{}}:m))}catch(f){n(p=>p.map(m=>m.id===d.id?{...m,status:"error",error:f.message??"read failed"}:m))}l.length!==0&&await Promise.all(l.map(async d=>{try{const f=await Gie({httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken,sessionId:e.sessionId,file:d.file});n(p=>p.map(m=>m.id===d.id?{...m,url:f.url,status:"done"}:m))}catch(f){const p=f instanceof ka?f.code:"UPLOAD_FAILED",m=f.message??"upload failed";n(v=>v.map(w=>w.id===d.id?{...w,status:"error",error:`${p}: ${m}`}:w))}}))},[e.sessionId,e.httpBaseUrl,e.httpToken]),i=g.useCallback(o=>{n(a=>a.filter(l=>l.id!==o))},[]),s=g.useCallback(()=>{n([])},[]);return{attachments:t,setAttachments:n,addFiles:r,removeAttachment:i,clearAttachments:s}}function Jie(e,t){return[...e.map(n=>n.text),t].map(n=>n.trim()).filter(Boolean).join(`
|
|
571
571
|
|
|
572
572
|
`)}function ese(e){const t=Qf(e);return{text:t.text,attachments:t.attachments.map((n,r)=>({id:`queued-${r}-${n.fileName}`,fileName:n.fileName,mimeType:n.type==="image"?"image/*":"application/octet-stream",url:n.url,status:"done"}))}}const Fx=new Map,tse=[];function S2(e){if(e)return Fx.get(e)}function k2(e,t){e&&(t.draft.length===0&&t.attachments.length===0?Fx.delete(e):Fx.set(e,t))}const C2=new Set;function nse(e,t){return e.trim().length>0?`${e.trimEnd()}
|
|
573
573
|
|
|
574
|
-
${t}`:t}function rse(e){return C2.add(e),()=>C2.delete(e)}function ise(e,t){return e.replace(/(^|\s)\/(\S+)/g,(n,r,i)=>{const s=t.find(o=>o.name===i&&o.path);return s!=null&&s.path?`${r}[skill:${i}:${s.path}]`:n})}function sse({api:e,cwd:t,sessionKey:n,onSend:r,disabled:i,onNewSession:s,onClearSession:o,tool:a,spawnableContacts:l=tse,ensureRemotePersonas:c,remotePersonasByDeviceId:u}){const d=S2(n),[f,p]=g.useState((d==null?void 0:d.draft)??""),[m,v]=g.useState(!1),w=g.useRef(null),x=g.useRef(!1),_=g.useCallback(()=>{x.current=!0},[]),b=g.useCallback(()=>{x.current=!1},[]),S=Qp(),{attachments:C,setAttachments:k,addFiles:T,removeAttachment:E,clearAttachments:D}=Qie({httpBaseUrl:S.httpBaseUrl,httpToken:S.httpToken,sessionId:n,initial:(d==null?void 0:d.attachments)??[]}),[N,L]=g.useState([]),[R,M]=g.useState(!1),[A,j]=g.useState(0),[z,F]=g.useState(!1),[$,B]=g.useState([]),[I,U]=g.useState(!1),[q,O]=g.useState(0),[te,le]=g.useState(!1),[Y,re]=g.useState([]),[ke,oe]=g.useState(!1),[Ie,Ee]=g.useState(null),[Re,he]=g.useState(!1),Be=g.useRef(null),Qe=g.useMemo(()=>{const ce=[];return s&&ce.push({name:"new",source:"builtin",description:"在当前目录下新建会话"}),o&&n&&ce.push({name:"clear",source:"builtin",description:"清除当前会话"}),ce},[s,o,n]),Ge=g.useMemo(()=>[...Qe,...N],[Qe,N]),ft=g.useMemo(()=>{const ce=f.match(/^\/(\S*)$/);return ce?ce[1]:null},[f]),Kt=ft!==null&&!z,fe=g.useMemo(()=>ft!==null?RM(Ge,ft):[],[Ge,ft]),He=g.useMemo(()=>{const ce=f.match(/^@(\S*)$/);return ce?ce[1]:null},[f]),Pe=He!==null&&!te,Me=g.useMemo(()=>Ie?((u==null?void 0:u.get(Ie.deviceId))??[]).map(Se=>({kind:"remote-persona",persona:Se,deviceId:Ie.deviceId})):[...$.map(ce=>({kind:"cc-agent",agent:ce})),...Y.map(ce=>({kind:"persona",persona:ce})),...l.map(ce=>({kind:"contact",contact:ce}))],[Ie,u,$,Y,l]),rt=g.useMemo(()=>He!==null?MM(Me,He):[],[Me,He]),tn=g.useRef(f);g.useEffect(()=>{f!==tn.current&&(F(!1),le(!1),tn.current=f)},[f]);const hn=g.useCallback(()=>{F(!0)},[]),W=g.useCallback(()=>{le(!0)},[]),ee=g.useRef(f),be=g.useRef(C);g.useEffect(()=>{ee.current=f},[f]),g.useEffect(()=>{be.current=C},[C]);const Oe=g.useRef(n);g.useEffect(()=>{if(n!==null)return rse((ce,Se)=>{ce===n&&(p(st=>nse(st,Se)),queueMicrotask(()=>Wh(w.current)))})},[n]),g.useEffect(()=>{const ce=Oe.current;if(ce===n)return;k2(ce,{draft:ee.current,attachments:be.current});const Se=S2(n);p((Se==null?void 0:Se.draft)??""),k((Se==null?void 0:Se.attachments)??[]),j(0),O(0),F(!1),le(!1),Ee(null),Be.current=null,he(!1),queueMicrotask(()=>{Se!=null&&Se.draft?Wh(w.current):ya(w.current)}),Oe.current=n},[n,k]),g.useEffect(()=>()=>{k2(Oe.current,{draft:ee.current,attachments:be.current})},[]),g.useEffect(()=>{j(0)},[ft]),g.useEffect(()=>{O(0)},[He]),g.useEffect(()=>{He===null&&Ie&&(Ee(null),Be.current=null,he(!1))},[He,Ie]),g.useEffect(()=>{if(!Kt||R)return;if(!e){M(!0);return}let ce=!1;return(async()=>{try{const Se=await e.skillsList(t,a);ce||(L(Se.skills??[]),M(!0))}catch{ce||M(!0)}})(),()=>{ce=!0}},[Kt,R,e,t,a]),g.useEffect(()=>{if(!Pe||I)return;if(!e){U(!0);return}let ce=!1;return(async()=>{try{const Se=await e.agentsList(t,a);ce||(B(Se.agents??[]),U(!0))}catch{ce||U(!0)}})(),()=>{ce=!0}},[Pe,I,e,t,a]),g.useEffect(()=>{if(!Pe||ke)return;if(!e){oe(!0);return}let ce=!1;return(async()=>{try{const Se=await e.personaList();ce||(re((Se.personas??[]).filter(st=>st.personaId!==NT).map(st=>({personaId:st.personaId,label:st.label}))),oe(!0))}catch{ce||oe(!0)}})(),()=>{ce=!0}},[Pe,ke,e]);const Ue=g.useCallback(ce=>{switch(ce.kind){case"persona":p(`@persona/${ce.persona.personaId} `);break;case"cc-agent":p(`@"${ce.agent.name} (agent)" `);break;case"contact":{const Se=ce.contact.deviceId;Ee({deviceId:Se,displayName:ce.contact.displayName}),Be.current=Se,he(!0),Promise.resolve(c==null?void 0:c(Se)).finally(()=>{Be.current===Se&&he(!1)}),p("@"),le(!1),setTimeout(()=>{var st;return(st=w.current)==null?void 0:st.focus()},0);return}case"remote-persona":p(`@persona/${ce.persona.personaId}@${ce.deviceId} `),Ee(null);break}le(!1),setTimeout(()=>{var Se;return(Se=w.current)==null?void 0:Se.focus()},0)},[c]),At=g.useCallback(()=>{Ee(null),Be.current=null,he(!1),p("@"),setTimeout(()=>{var ce;return(ce=w.current)==null?void 0:ce.focus()},0)},[]),bn=g.useCallback(ce=>{if(ce.source==="builtin"&&ce.name==="new"&&s){p(""),D(),ya(w.current),s(t);return}if(ce.source==="builtin"&&ce.name==="clear"&&o){p(""),D(),ya(w.current),o();return}p(`/${ce.name} `),setTimeout(()=>{var Se;return(Se=w.current)==null?void 0:Se.focus()},0)},[s,t,D,o]),nn=g.useCallback(async()=>{const ce=f.trim(),Se=C.filter(gt=>gt.status==="done");if(!ce&&Se.length===0||m||i)return;if(ce==="/new"&&s){v(!0);try{await s(t),p(""),D(),ya(w.current)}finally{v(!1)}return}if(ce==="/clear"&&o){v(!0);try{await o(),p(""),D(),ya(w.current)}finally{v(!1)}return}const st=mT(a)||vT(a)?ise(ce,N):ce;v(!0);try{const gt=zG(st,C);await r(gt,{queueWhileRunning:!0}),p(""),D(),ya(w.current)}finally{v(!1)}},[f,C,m,i,r,s,t,D,o,a,N]),fn=g.useCallback(ce=>{const{text:Se,attachments:st}=ese(ce);if(p(Se),st.length>0){const gt=new Set(be.current.map(gr=>gr.id));k([...be.current,...st.filter(gr=>!gt.has(gr.id))])}queueMicrotask(()=>Wh(w.current))},[k]);return{draft:f,setDraft:p,sending:m,textareaRef:w,isComposingRef:x,onCompositionStart:_,onCompositionEnd:b,attachments:C,addFiles:T,removeAttachment:E,skillSelectorVisible:Kt,filteredSkills:fe,slashQuery:ft??"",activeSkillIdx:A,setActiveSkillIdx:j,selectSkill:bn,dismissSkillSelector:hn,agentSelectorVisible:Pe,filteredAgents:rt,mentionQuery:He,activeAgentIdx:q,setActiveAgentIdx:O,selectAgent:Ue,dismissAgentSelector:W,drilldown:Ie,drilldownLoading:Re,exitDrilldown:At,doSend:nn,restoreTextToDraft:fn}}const ose=120;function Wh(e){e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,ose)}px`)}function ya(e){e&&(e.style.height="auto")}function ase({items:e,restoreDisabled:t,onRestore:n,onRemove:r}){return e.length===0?null:h.jsxs("div",{"data-testid":"chat-input-queue",className:"flex flex-col",children:[h.jsx("div",{className:"px-1 pb-1 text-[11px] text-text-400",children:`排队中 · ${e.length} 条(这一轮跑完连起来一起发出)`}),e.map((i,s)=>h.jsxs("div",{"data-testid":`chat-input-queue-item-${i.id}`,className:"flex items-center gap-2 rounded-md px-1 py-1 transition-colors hover:bg-text-100/5",children:[h.jsx("span",{className:"shrink-0 w-4 text-center text-[11px] text-text-400 tabular-nums",children:s+1}),h.jsx("button",{type:"button","data-testid":`chat-input-queue-restore-${i.id}`,disabled:t,title:t?"先清空输入框再取回这条":"取回输入框继续改",onClick:()=>n(i.id),className:"flex-1 min-w-0 text-left text-[12.5px] text-text-200 truncate hover:text-text-100 disabled:cursor-not-allowed disabled:hover:text-text-200",children:i.text.trim()||"(空消息)"}),h.jsx("button",{type:"button","aria-label":"移出队列","data-testid":`chat-input-queue-remove-${i.id}`,onClick:()=>r(i.id),className:"shrink-0 p-0.5 rounded text-text-400 hover:text-text-100 hover:bg-text-100/10",children:h.jsx(Qr,{className:"w-3.5 h-3.5"})})]},i.id))]})}const lse="[--color-border:#E6E6E6] [--bg-300:#E6E6E6] dark:[--color-border:#424242] dark:[--bg-300:#424242]",cse={spawnableContacts:[],ensureRemotePersonas:()=>Promise.resolve(),remotePersonasByDeviceId:new Map},use=g.createContext(cse);function dse(){return g.useContext(use)}function hse({url:e,fileName:t,onClose:n}){const[r,i]=g.useState(!1);g.useEffect(()=>{const o=a=>{a.key==="Escape"&&n()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n]);const s=async()=>{try{const a=await(await fetch(e)).blob();await navigator.clipboard.write([new ClipboardItem({[a.type]:a})]),i(!0),setTimeout(()=>i(!1),2e3)}catch{E2(e,t)}};return h.jsx("div",{"data-testid":"image-lightbox",className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60",onClick:n,role:"dialog","aria-modal":"true",children:h.jsxs("div",{className:"relative",onClick:o=>o.stopPropagation(),children:[h.jsx("img",{src:e,alt:t,className:"max-h-[90vh] max-w-[92vw] rounded-lg object-contain shadow-2xl"}),h.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-1.5",children:[h.jsxs("button",{type:"button",onClick:s,"data-testid":"image-lightbox-copy",className:"flex cursor-pointer items-center gap-1 rounded-full border border-bg-300 bg-bg-50/95 px-2 py-0.5 text-[11px] font-medium text-text-200 shadow transition-colors hover:bg-bg-100",children:[h.jsx(t_,{className:"h-3 w-3"}),r?"Copied":"Copy"]}),h.jsxs("button",{type:"button",onClick:()=>E2(e,t),"data-testid":"image-lightbox-save",className:"flex cursor-pointer items-center gap-1 rounded-full border border-bg-300 bg-bg-50/95 px-2 py-0.5 text-[11px] font-medium text-text-200 shadow transition-colors hover:bg-bg-100",children:[h.jsx($7,{className:"h-3.5 w-3.5"}),"Save"]}),h.jsx("button",{type:"button",onClick:n,"data-testid":"image-lightbox-close","aria-label":"close",className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded-full border border-bg-300 bg-bg-50/95 text-text-300 transition-colors hover:bg-bg-100 hover:text-text-100",children:h.jsx(Qr,{className:"h-3 w-3"})})]})]})})}function E2(e,t){const n=document.createElement("a");n.href=e,n.download=t||"image",n.click()}const I2=1e3,AM=`bg-bg-50 ${lse}`,N2=`mx-2 -mb-3 rounded-t-xl border border-b-0 border-border px-3 pt-2 pb-4 ${AM}`,fse=5e3;function lh(e){if(!e)return"null";if(e===document.body)return"body";const t=e.getAttribute("data-testid"),n=typeof e.className=="string"&&e.className.trim()?`.${e.className.trim().split(/\s+/).slice(0,3).join(".")}`:"";return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""}${t?`[${t}]`:""}${n}`}function pse({meta:e,api:t,cwd:n,tool:r,onSend:i,sessionKey:s,queued:o,onDequeue:a,disabled:l=!1,placeholder:c,className:u,awaitingUser:d=!1,onAbort:f,onNewSession:p,onClearSession:m,configSlot:v,aboveSlot:w}){const x=(e==null?void 0:e.streamInProgress)??!1,_=(e==null?void 0:e.contextPct)??null,b=_==null?"":_>=80?"text-red-400":_>=50?"text-amber-400":"text-text-500",S=g.useRef(null),C=dse(),k=sse({...t?{api:t}:{},cwd:n,...r?{tool:r}:{},sessionKey:s,onSend:i,disabled:l,...p?{onNewSession:p}:{},...m?{onClearSession:m}:{},spawnableContacts:C.spawnableContacts,ensureRemotePersonas:C.ensureRemotePersonas,remotePersonasByDeviceId:C.remotePersonasByDeviceId}),{draft:T,setDraft:E,sending:D,textareaRef:N,attachments:L,addFiles:R,removeAttachment:M,skillSelectorVisible:A,filteredSkills:j,slashQuery:z,activeSkillIdx:F,setActiveSkillIdx:$,selectSkill:B,dismissSkillSelector:I,agentSelectorVisible:U,filteredAgents:q,mentionQuery:O,activeAgentIdx:te,setActiveAgentIdx:le,selectAgent:Y,dismissAgentSelector:re,drilldown:ke,drilldownLoading:oe,exitDrilldown:Ie,doSend:Ee,restoreTextToDraft:Re}=k,he=g.useCallback(()=>{(async()=>{const ae=await(f==null?void 0:f());ae&&ae.length>0&&Re(Jie(ae,T))})()},[f,Re,T]),Be=g.useCallback(ae=>{const it=o==null?void 0:o.find(Bt=>Bt.id===ae);!it||!a||T.trim().length>0||(a(ae),Re(it.text))},[o,a,T,Re]),Qe=Fie();g.useEffect(()=>{if(!Qe||Qe.signal===0||s===null||Qe.sessionId!==s)return;const{signal:ae}=Qe;console.log("[chat-focus] 收到聚焦信号",{sessionKey:s,signal:ae,delayMs:I2,activeElement:lh(document.activeElement)});let it=null,Bt=null,ti=null;const oa=setTimeout(()=>{if(it=N.current,!it){console.warn("[chat-focus] textarea 已不在,放弃聚焦",{sessionKey:s,signal:ae});return}it.focus(),console.log("[chat-focus] focus() 已执行",{sessionKey:s,signal:ae,landed:document.activeElement===it,activeElement:lh(document.activeElement)}),Bt=aa=>{const hs=lh(aa.relatedTarget);setTimeout(()=>{console.warn("[chat-focus] STOLEN 输入框失焦",{sessionKey:s,signal:ae,relatedTarget:hs,activeElementAfterTick:lh(document.activeElement)})},0)},it.addEventListener("blur",Bt,{once:!0}),ti=setTimeout(()=>{it&&Bt&&it.removeEventListener("blur",Bt)},fse)},I2);return()=>{clearTimeout(oa),ti&&clearTimeout(ti),it&&Bt&&it.removeEventListener("blur",Bt)}},[Qe==null?void 0:Qe.signal]);const Ge=!!t,ft=D||l||x,fe=(T.trim().length>0||L.some(ae=>ae.status==="done"))&&!l&&!D&&!d,He=c??(d?"Answer the question above first...":ft?"Queue a message...":`Message ${o_(r)}...`),Pe=g.useRef(!1),Me=g.useCallback(()=>{Pe.current=!0},[]),rt=g.useCallback(()=>{Pe.current=!1},[]),tn=g.useCallback(ae=>{if(A&&j.length>0){if(ae.key==="ArrowDown")return ae.preventDefault(),$(F>=j.length-1?0:F+1),!0;if(ae.key==="ArrowUp")return ae.preventDefault(),$(F<=0?j.length-1:F-1),!0;if(ae.key==="Tab"||ae.key==="Enter"&&!ae.shiftKey){ae.preventDefault();const it=j[F];return it&&B(it),!0}if(ae.key==="Escape")return ae.preventDefault(),I(),!0}return!1},[A,j,F,$,B,I]),hn=g.useCallback(ae=>{if(U&&q.length>0){if(ae.key==="ArrowDown")return ae.preventDefault(),le(te>=q.length-1?0:te+1),!0;if(ae.key==="ArrowUp")return ae.preventDefault(),le(te<=0?q.length-1:te-1),!0;if(ae.key==="Tab"||ae.key==="Enter"&&!ae.shiftKey){ae.preventDefault();const it=q[te];return it&&Y(it),!0}if(ae.key==="Escape")return ae.preventDefault(),ke?Ie():re(),!0}return!1},[U,q,te,le,Y,re,ke,Ie]),W=g.useCallback(ae=>{const it=ae.nativeEvent;ae.key==="Enter"&&yP({compositionActive:Pe.current,nativeIsComposing:it.isComposing,keyCode:it.keyCode})||tn(ae)||hn(ae)||_P({key:ae.key,shiftKey:ae.shiftKey,compositionActive:Pe.current,nativeIsComposing:it.isComposing,keyCode:it.keyCode})&&(ae.preventDefault(),fe&&Ee())},[tn,hn,fe,Ee]),ee=g.useCallback(ae=>{E(ae.target.value),Wh(ae.target)},[E]),be=g.useCallback(ae=>{ae.target.files&&R(ae.target.files),ae.target.value=""},[R]),Oe=g.useCallback(ae=>{if(!Ge)return;const it=Array.from(ae.clipboardData.items).map(Bt=>Bt.getAsFile()).filter(Bt=>!!(Bt&&Bt.type.startsWith("image/")));it.length!==0&&(ae.preventDefault(),R(it))},[R,Ge]),[Ue,At]=g.useState(null),bn=g.useCallback(ae=>{ae.previewUrl&&At({url:ae.previewUrl,name:ae.fileName})},[]),[nn,fn]=g.useState(!1),ce=g.useCallback(ae=>{Ge&&(ae.preventDefault(),fn(!0))},[Ge]),Se=g.useCallback(()=>fn(!1),[]),st=g.useCallback(ae=>{Ge&&(ae.preventDefault(),fn(!1),ae.dataTransfer.files.length>0&&R(ae.dataTransfer.files))},[R,Ge]),gt=x&&!d&&typeof f=="function",gr=l||d;return h.jsxs("div",{"data-testid":"chat-input",className:ie("shrink-0 border-t border-bg-300/20 px-4 py-3",u),onDragOver:ce,onDragLeave:Se,onDrop:st,children:[h.jsxs("div",{className:"max-w-3xl mx-auto relative",children:[Ge?h.jsx("input",{ref:S,type:"file",multiple:!0,accept:z$,hidden:!0,onChange:be,"data-testid":"chat-input-file"}):null,h.jsxs("div",{"data-testid":"chat-input-bare",className:ie("flex flex-col gap-2"),children:[d||D||x?h.jsxs("div",{"data-testid":"chat-input-status-bar",className:"flex items-center gap-2 text-[12px] text-text-400",children:[h.jsxs("div",{className:"flex gap-1",children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-400-dim-fg animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-400-dim-fg animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-400-dim-fg animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{children:d?"Waiting for your answer":`${mT(r)?"Codex":vT(r)?"pi":"Claude"} is working`})]}):null,A?h.jsx($ie,{query:z,skills:j,activeIndex:F,onActiveIndexChange:$,onSelect:B}):null,U?ke?!C.remotePersonasByDeviceId.has(ke.deviceId)&&oe?h.jsx("div",{"data-testid":"cc-agent-remote-loading",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 rounded-2xl border border-bg-300 bg-bg-50 px-4 py-3 text-[12px] text-text-300 shadow-lg",children:`正在加载 @${ke.displayName} 的 persona…`}):q.length>0?h.jsx(w2,{query:O??"",entries:q,activeIndex:te,onActiveIndexChange:le,onSelect:Y}):h.jsx("div",{"data-testid":"cc-agent-remote-empty",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 rounded-2xl border border-bg-300 bg-bg-50 px-4 py-3 text-[12px] text-text-300 shadow-lg",children:`@${ke.displayName} 暂无可派活的 persona(可能离线或未公开)`}):h.jsx(w2,{query:O??"",entries:q,activeIndex:te,onActiveIndexChange:le,onSelect:Y}):null,o&&o.length>0?h.jsx("div",{"data-testid":"chat-input-queue-header",className:N2,children:h.jsx(ase,{items:o,restoreDisabled:T.trim().length>0||!a,onRestore:Be,onRemove:ae=>void(a==null?void 0:a(ae))})}):null,L.length>0?h.jsx(Kie,{attachments:L,onRemove:M,onOpenPreview:bn}):null,w?h.jsx("div",{"data-testid":"chat-input-above-slot",className:N2,children:w}):null,h.jsxs("div",{"data-testid":"bare-chat-input-frame",className:ie("relative flex flex-col gap-1 rounded-xl border border-border px-3 py-2 transition-colors duration-200",AM,gr?"opacity-60":null,nn?"border-accent/60 bg-accent/5":null),children:[h.jsx("textarea",{ref:N,"data-testid":"chat-input-textarea",value:T,onChange:ee,onKeyDown:W,onCompositionStart:Me,onCompositionEnd:rt,onPaste:Oe,placeholder:He,disabled:gr,readOnly:gr,rows:1,className:"w-full resize-none bg-transparent border-0 outline-none text-[14px] text-text-100 placeholder:text-text-400 leading-relaxed py-1 min-h-[22px] max-h-[120px] overflow-y-auto disabled:cursor-not-allowed"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[Ge?h.jsx("button",{type:"button",onClick:()=>{var ae;return(ae=S.current)==null?void 0:ae.click()},disabled:ft,"data-testid":"chat-input-attach","aria-label":"attach files",className:ie("flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors",ft?"cursor-default text-text-400/50":"cursor-pointer text-text-400 hover:bg-text-100/5 hover:text-text-200"),children:h.jsx(_F,{className:"h-4 w-4"})}):null,h.jsx("div",{className:"flex-1 min-w-0"}),_!=null?h.jsxs("span",{"data-testid":"chat-input-ctx",className:ie("shrink-0 text-[11px] tabular-nums",b),children:["ctx:",_,"%"]}):null,v,gt?h.jsx("button",{type:"button",onClick:he,"data-testid":"chat-input-abort","aria-label":"interrupt",title:"中断当前轮次(不杀进程)",className:"h-8 w-8 rounded-full flex items-center justify-center border border-text-400/40 text-text-400 hover:bg-text-100/5 hover:text-text-100 transition-colors cursor-pointer",children:h.jsx(d4,{className:"w-3.5 h-3.5",strokeWidth:2.5})}):null,h.jsx("button",{type:"button",onClick:()=>{fe&&Ee()},disabled:!fe,"data-testid":"chat-input-send","aria-label":"send",className:ie("h-8 w-8 rounded-full flex items-center justify-center transition-colors",fe?"bg-accent text-white hover:bg-accent-hover cursor-pointer shadow-sm":"bg-[var(--text-400-dim)] text-[var(--text-400-dim-fg)] cursor-default"),children:h.jsx(u7,{className:"w-4 h-4",strokeWidth:2.5})})]})]})]})]}),Ue?h.jsx(hse,{url:Ue.url,fileName:Ue.name,onClose:()=>At(null)}):null]})}function mse(e){const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n>=0?t.slice(n+1):t}function gse({meta:e,tool:t,connState:n,variant:r="full",onOpenConfig:i,liveWorktreeRoot:s,ephemeral:o=!1,onPromote:a,cloudVolume:l,className:c}){const u=s??e.cwd??"",f=!!e.sessionLabel&&e.sessionLabel!==e.sessionId?e.sessionLabel:mse(u),p=u;return r==="quickask"?h.jsxs("div",{"data-testid":"chat-header","data-variant":"quickask",className:ie("flex items-center shrink-0 px-3 py-2 gap-2",c),children:[a?h.jsx("button",{type:"button","data-testid":"chat-header-promote","data-promoted":o?"false":"true",disabled:!o,onClick:a,title:o?"保留为正式会话":"已保留为正式会话",className:ie("shrink-0 inline-flex items-center justify-center h-5 w-5 rounded-md transition-colors",o?"text-text-500 hover:text-text-200 hover:bg-text-100/5 cursor-pointer":"text-amber-400"),children:h.jsx(v7,{className:ie("w-3.5 h-3.5",!o&&"fill-current")})}):null,h.jsx("span",{className:"font-semibold text-text-100 truncate text-[13px]","data-testid":"chat-header-worktree",title:p,children:f})]}):h.jsxs("div",{"data-testid":"chat-header","data-variant":"full",className:ie("relative flex items-center shrink-0 px-4 py-2.5",l?"pr-36 md:pr-32":"pr-[4.5rem] md:pr-4",c),children:[h.jsx("span",{className:"font-semibold text-text-100 truncate text-[13px]","data-testid":"chat-header-worktree",title:p,children:f}),h.jsxs("div",{className:"absolute right-4 top-1/2 -translate-y-1/2 z-10 flex items-center gap-1",children:[l,i?h.jsx("button",{type:"button","aria-label":"Session settings","data-testid":"chat-header-settings-mobile",onClick:i,title:"Session settings",className:"flex md:hidden h-7 w-7 items-center justify-center rounded-md bg-transparent text-text-300 transition-colors duration-150 hover:bg-bg-200 hover:text-text-100 cursor-pointer outline-none",children:h.jsx(l4,{className:"w-4 h-4"})}):null]})]})}function vse({testid:e,children:t}){return h.jsx("div",{"data-testid":e,className:"h-full min-w-0 border-l border-border bg-bg-100 flex flex-col",children:t})}function xse({title:e,onBack:t,onCollapse:n,collapseLabel:r="collapse session info",collapseTitle:i="收起会话信息"}){const s=o=>h.jsx("button",{type:"button","data-testid":"session-info-collapse",onClick:n,"aria-label":r,title:i,className:`p-1 rounded text-text-400 hover:text-text-100 hover:bg-text-100/10 ${o}`,children:h.jsx(ik,{className:"w-4 h-4"})});return h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border shrink-0",children:[t?h.jsx("button",{type:"button","data-testid":"session-info-back",onClick:t,"aria-label":"返回会话信息",className:"p-1 -ml-1 rounded text-text-400 hover:text-text-100 hover:bg-text-100/10",children:h.jsx(a7,{className:"w-4 h-4"})}):n?s("-ml-1"):h.jsx(ik,{className:"w-4 h-4 text-text-300"}),h.jsx("span",{className:"flex-1 text-[13px] font-medium text-text-100 truncate",children:e}),t&&n?s(""):null]})}function ch({icon:e,label:t,meta:n,onClick:r,testid:i,disabled:s}){return h.jsxs("button",{type:"button","data-testid":i,onClick:r,disabled:s,className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-md cursor-pointer text-left hover:bg-text-100/5 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent",children:[h.jsx("span",{className:"w-4 h-4 shrink-0 text-text-300 inline-flex items-center justify-center",children:e}),h.jsx("span",{className:"flex-1 text-[12.5px] text-text-100",children:t}),n?h.jsx("span",{className:"shrink-0 text-[11px] text-text-400 font-mono",children:n}):null]})}let yse=null;function _se(){return yse}function Ec({label:e,labelTitle:t,children:n}){return h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1",children:[h.jsx("span",{className:"w-14 shrink-0 truncate text-[11px] text-text-400 pt-0.5",...t?{title:t}:{},children:e}),h.jsx("span",{className:"flex-1 min-w-0 text-[12px] text-text-100",children:n})]})}function T2({label:e,labelTitle:t,value:n,testid:r}){const[i,s]=g.useState(!1),o=g.useRef(null);g.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const a=()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(n).then(()=>{s(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>s(!1),2e3)},()=>{})};return h.jsx(Ec,{label:e,labelTitle:t,children:h.jsxs("button",{type:"button",onClick:a,"data-testid":r,title:i?"已复制":`复制:${n}`,className:"w-full flex items-center gap-1.5 text-left group cursor-pointer",children:[h.jsx("span",{className:"font-mono text-[11px] text-text-300 truncate flex-1 min-w-0",children:n}),i?h.jsx(Qo,{className:"w-3 h-3 shrink-0 text-accent"}):h.jsx(t_,{className:"w-3 h-3 shrink-0 text-text-400 opacity-0 group-hover:opacity-100 transition-opacity"})]})})}function bse({session:e,meta:t,liveGitBranch:n,liveWorktreeRoot:r,personaName:i,onOpenPersona:s,onOpenFiles:o,cronActiveCount:a,onCronClick:l,onForceStop:c,onReloadFromCloud:u,reloadFromCloudDisabled:d=!1,viewerRole:f="owner",toolSessionIdLabel:p="tool session id",drill:m=null,onCollapse:v,title:w="会话信息",leadingEntries:x}){const _=n!==void 0?n:t.gitBranch??null,b=t.procAlive??!1,S=j4(e),C=S!=null&&e.originOwnerPrincipalId==null&&f!=="guest",[k,T]=g.useState(null),E=g.useRef(null);g.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]);const D=async()=>{if(!C)return;const N=_se();let L;try{N||(await navigator.clipboard.writeText(S),L="命令已复制")}catch{L="操作失败"}T(L),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>T(null),2500)};return h.jsxs(vse,{testid:"session-info-panel",children:[h.jsx(xse,{title:m?m.title:w,...m?{onBack:m.onBack}:{},...v?{onCollapse:v}:{},collapseTitle:`收起${w}`}),m?h.jsx("div",{"data-testid":"session-info-drill",className:"flex-1 min-h-0 overflow-y-auto",children:m.content}):h.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[_?h.jsx(Ec,{label:"分支",children:h.jsxs("span",{"data-testid":"session-info-branch",className:"inline-flex items-center gap-1 font-mono text-[11.5px] min-w-0",title:r??void 0,children:[h.jsx(ku,{className:"w-3 h-3 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:_})]})}):null,i&&s?h.jsx(Ec,{label:"persona",children:h.jsxs("button",{type:"button","data-testid":"session-info-persona",onClick:s,className:"inline-flex items-center gap-1 hover:text-accent cursor-pointer",children:[h.jsx(g4,{className:"w-3 h-3"}),h.jsx("span",{className:"truncate",children:i})]})}):null,h.jsx(Ec,{label:"引擎",children:h.jsxs("span",{className:"inline-flex items-center gap-1.5","data-testid":"session-info-engine",children:[h.jsx(tm,{tool:e.tool,className:ie("w-3.5 h-3.5 shrink-0",nm(e.tool))}),h.jsxs("span",{className:"truncate",children:[o_(e.tool),t.model?` · ${t.model}`:""]})]})}),h.jsx(Ec,{label:"cwd",children:h.jsx("span",{"data-testid":"session-info-cwd",className:"font-mono text-[11px] text-text-300 truncate block",title:e.cwd,children:e.cwd})}),h.jsx(T2,{label:"session id",value:e.sessionId,testid:"session-info-session-id"}),e.toolSessionId?h.jsx(T2,{label:`${e.tool||"claude"} id`,labelTitle:p,value:e.toolSessionId,testid:"session-info-tool-session-id"}):null,h.jsx("div",{className:"my-2 border-t border-border"}),x,o?h.jsx(ch,{icon:h.jsx(Y7,{className:"w-3.5 h-3.5"}),label:"Edited Files",onClick:o,testid:"session-info-files"}):null,a&&a>0&&l?h.jsx(ch,{icon:h.jsx(P7,{className:"w-3.5 h-3.5"}),label:"定时任务",meta:String(a),onClick:l,testid:"session-info-cron"}):null,C?h.jsx(ch,{icon:h.jsx(qF,{className:"w-3.5 h-3.5"}),label:"终端",meta:k,onClick:()=>void D(),testid:"session-info-terminal"}):null,u?h.jsx(ch,{icon:h.jsx(M7,{className:"w-3.5 h-3.5"}),label:"从云端重新加载",...d?{meta:"运行中"}:{},onClick:u,disabled:d,testid:"session-info-reload-cloud"}):null]}),b&&c?h.jsx("div",{className:"shrink-0 border-t border-border px-3 py-2.5",children:h.jsxs("button",{type:"button","data-testid":"session-info-force-stop",onClick:c,title:e.tool==="codex"?"强制停止 Codex 进程":"强制停止 Claude Code 进程(会丢失 initialize / 预热缓存)",className:"inline-flex items-center gap-1.5 h-6 px-2.5 rounded-md text-text-400 hover:bg-red-500/10 hover:text-red-400 transition-colors text-[12px] cursor-pointer",children:[h.jsx(vF,{className:"w-3.5 h-3.5"}),h.jsx("span",{children:"强制停止"})]})}):null]})}const wse=g.createContext({container:null});function Sse(){return g.useContext(wse)}const db="fixed top-0 md:top-10 bottom-0 right-0";function kse({api:e,cwd:t,toolSessionId:n,toolKind:r="claude"}){const i=IM(),s=(i==null?void 0:i.state.agentId)??null,o=i==null?void 0:i.state.agentType,[a,l]=g.useState([]),[c,u]=g.useState(!1),[d,f]=g.useState(null);g.useEffect(()=>{if(!s)return;let m=!1;return u(!0),f(null),l([]),e.historySubagentRead({cwd:t,toolSessionId:n,subagentId:s}).then(v=>{m||l(v.messages??[])}).catch(v=>{m||f(v instanceof Error?v.message:String(v))}).finally(()=>{m||u(!1)}),()=>{m=!0}},[s,t,n,e]);const p=g.useMemo(()=>a.length>0?W_(a,0,r):[],[a,r]);return!i||!s?null:h.jsxs("div",{"data-testid":"subagent-drawer","data-agent-id":s,className:ie(db,"z-50 w-[min(560px,92vw)]","flex flex-col border-l border-bg-200/60 bg-bg-50 shadow-xl"),style:{paddingTop:"env(safe-area-inset-top)"},children:[h.jsxs("div",{className:"flex flex-col gap-0.5 px-3 py-2 border-b border-bg-200/60",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o?h.jsx("span",{className:"inline-flex items-center rounded-sm bg-violet-500/10 px-1.5 py-0.5 text-[11px] text-violet-400 font-medium",children:o}):null,h.jsx("span",{className:"font-mono text-[11px] text-text-400 truncate",title:s,children:s})]}),h.jsx("button",{type:"button","aria-label":"关闭",onClick:()=>i.close(),className:"p-1 rounded hover:bg-bg-200/50 text-text-400 hover:text-text-200",children:h.jsx(Qr,{className:"w-4 h-4"})})]}),!c&&!d&&a.length>0?h.jsxs("div",{className:"text-[11px] text-text-400",children:[a.length," 条消息 · 首条为主会话派发的任务指令"]}):null]}),h.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden px-3 py-2",children:c?h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin"}),h.jsx("span",{children:"加载中…"})]}):d?h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-error",children:[h.jsx(Jo,{className:"w-3.5 h-3.5"}),h.jsx("span",{children:d})]}):p.length===0?h.jsx("div",{className:"text-[12px] text-text-400 italic",children:"无消息"}):h.jsx(PM,{lines:p})})]})}function P2(e,t){let n=0;for(const r of e.lines)r.startsWith(t)&&n++;return n}function Cse(e,t){const n=e.findIndex(c=>c.kind==="user-text"&&c.uuid===t);if(n<0)return{userMessageId:t,files:[],totalInsertions:0,totalDeletions:0,anchorFound:!1};let r=e.length;for(let c=n+1;c<e.length;c++)if(e[c].kind==="user-text"){r=c;break}const i=[],s=new Map;for(let c=n+1;c<r;c++){const u=e[c];if(u.kind!=="tool-result")continue;const d=u.toolResultExtra;if(!(d!=null&&d.filePath)||!d.structuredPatch||d.structuredPatch.length===0)continue;const f=d.filePath;let p=s.get(f);p||(p={filePath:f,hunks:[],insertions:0,deletions:0},s.set(f,p),i.push(f));for(const m of d.structuredPatch)p.hunks.push(m),p.insertions+=P2(m,"+"),p.deletions+=P2(m,"-")}const o=i.map(c=>s.get(c)),a=o.reduce((c,u)=>c+u.insertions,0),l=o.reduce((c,u)=>c+u.deletions,0);return{userMessageId:t,files:o,totalInsertions:a,totalDeletions:l,anchorFound:!0}}function Ese({open:e,onOpenChange:t,api:n,sessionId:r,userMessageId:i,lines:s,procAlive:o,onApplied:a,onNoChanges:l}){const c=g.useMemo(()=>Cse(s,i),[s,i]),[u,d]=g.useState(null),[f,p]=g.useState(!1),[m,v]=g.useState(!1),[w,x]=g.useState(null);g.useEffect(()=>{if(!e)return;let k=!1;return p(!0),d(null),(async()=>{try{const T=await n.sessionRewindDiff({sessionId:r,userMessageId:i});k||(d(T),!T.canRewind&&!T.error&&T.files.length===0&&(l==null||l(i)))}catch{k||d(null)}finally{k||p(!1)}})(),()=>{k=!0}},[e,n,r,i]);const _=g.useMemo(()=>{if(u){const k=!u.canRewind&&!u.error&&u.files.length===0;if(u.canRewind||k)return{source:"rpc",anchorFound:!0,files:u.files.map(T=>({filePath:T.filePath,hunks:T.hunks,insertions:T.insertions,deletions:T.deletions})),totalInsertions:u.totalInsertions,totalDeletions:u.totalDeletions}}return{source:"local",anchorFound:c.anchorFound,files:c.files,totalInsertions:c.totalInsertions,totalDeletions:c.totalDeletions,rpcError:u==null?void 0:u.error}},[u,c]),b=g.useCallback(async()=>{v(!0),x(null);try{const k=await n.sessionRewind({sessionId:r,userMessageId:i,dryRun:!1});if(!k.canRewind){x(k.error??"回退失败");return}a==null||a(),t(!1)}catch(k){x(k.message||"回退失败")}finally{v(!1)}},[n,r,i,a,t]);if(!e)return null;const S=_.files.length>0,C=!f&&!m&&_.anchorFound&&S&&!w;return h.jsxs("div",{"data-testid":"rewind-preview-drawer",className:`${db} z-40 flex flex-col border-l border-bg-300/40 bg-bg-0 shadow-xl`,style:{width:480,minWidth:480},children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bg-300/30 shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(m4,{className:"w-4 h-4 text-text-300"}),h.jsx("span",{className:"text-[14px] font-semibold text-text-100",children:"Rewind 预览"})]}),h.jsx("button",{type:"button",onClick:()=>t(!1),"data-testid":"rewind-drawer-close",className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:bg-text-100/5 hover:text-text-200 cursor-pointer","aria-label":"close",children:h.jsx(Qr,{className:"w-4 h-4"})})]}),w?h.jsxs("div",{"data-testid":"rewind-error-banner",className:"mx-4 mt-3 flex items-start gap-2 rounded-md border border-red-400/40 bg-red-500/10 px-3 py-2 text-[12px] text-red-400",children:[h.jsx(Uf,{className:"w-4 h-4 shrink-0 mt-0.5"}),h.jsx("span",{children:w})]}):null,h.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:f?h.jsxs("div",{"data-testid":"rewind-loading",className:"flex items-center gap-2 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin"}),h.jsx("span",{children:"正在读取快照…"})]}):_.anchorFound?S?h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":"rewind-summary",className:"rounded-md border border-bg-300 bg-bg-100/40 px-3 py-2 text-[12px] text-text-200",children:[h.jsxs("div",{children:["将回退 ",h.jsx("span",{className:"font-semibold text-text-100",children:_.files.length})," ","个文件,",h.jsxs("span",{className:"text-green-500 font-mono",children:["+",_.totalInsertions]})," / ",h.jsxs("span",{className:"text-red-400 font-mono",children:["-",_.totalDeletions]})]}),_.source==="local"?h.jsx("div",{"data-testid":"rewind-source-hint",className:"mt-1 text-text-400 text-[11px]",children:"基于对话里 tool_result 估算(未读到 CC 快照,数字可能与实际磁盘略有差异)"}):null]}),_.files.map(k=>h.jsx(Nse,{file:k},k.filePath))]}):h.jsxs("div",{"data-testid":"rewind-no-changes",className:"rounded-md border border-bg-300 bg-bg-100/60 px-3 py-2 text-[12px] text-text-300 space-y-1",children:[h.jsx("div",{children:"磁盘上的文件已经和这个时刻的快照完全一致——没有需要回退的改动。"}),h.jsx("div",{className:"text-text-400 text-[11px]",children:"可能这条消息之后 Claude 没落盘编辑,或之前已经 rewind 过了。"})]}):h.jsx("div",{"data-testid":"rewind-no-anchor",className:"rounded-md border border-bg-300 bg-bg-100/60 px-3 py-2 text-[12px] text-text-300",children:"未能在当前消息流中找到对应的用户消息(可能已被历史裁剪)。"})}),h.jsxs("div",{className:"flex flex-col gap-2 px-4 py-3 border-t border-bg-300/30 shrink-0",children:[S&&_.anchorFound&&!o?h.jsxs("div",{"data-testid":"rewind-needs-cc",className:"flex items-start gap-2 rounded-md border border-bg-300 bg-bg-100/60 px-3 py-2 text-[12px] text-text-300",children:[h.jsx(Uf,{className:"w-4 h-4 shrink-0 mt-0.5 text-warning"}),h.jsx("span",{children:'Claude Code 进程当前未运行。点击"确认回退"时会自动启动它再执行 — 可能需要等一两秒。'})]}):null,h.jsxs("div",{className:"flex items-center justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:()=>t(!1),className:"h-8 px-3 rounded-md text-[12px] text-text-300 hover:bg-text-100/5 cursor-pointer",children:"取消"}),h.jsx("button",{type:"button",disabled:!C,onClick:()=>void b(),"data-testid":"rewind-apply",className:ie("h-8 px-3 rounded-md text-[12px] font-medium transition-colors",C?"bg-accent text-white hover:bg-accent-hover cursor-pointer":"bg-bg-200 text-text-400 cursor-not-allowed"),children:m?"回退中…":"确认回退"})]})]})]})}function Ise(e){return e.replace(/^\/Users\/[^/]+/,"~")}function Nse({file:e}){const[t,n]=g.useState(!0);return h.jsxs("div",{"data-testid":"rewind-file-block","data-file":e.filePath,className:"rounded-md border border-bg-300 overflow-hidden bg-bg-0",children:[h.jsxs("button",{type:"button",onClick:()=>n(r=>!r),className:"w-full flex items-center gap-1.5 px-3 py-2 text-[12px] hover:bg-text-100/5 cursor-pointer",children:[t?h.jsx(Pn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}),h.jsx("span",{className:"font-mono text-text-200 truncate flex-1 text-left",title:e.filePath,children:Ise(e.filePath)}),h.jsxs("span",{className:"font-mono shrink-0 text-text-400",children:[h.jsxs("span",{className:"text-green-500",children:["+",e.insertions]})," ",h.jsxs("span",{className:"text-red-400",children:["-",e.deletions]})]})]}),t?h.jsx("div",{className:"border-t border-bg-300",children:e.hunks.map(r=>h.jsx(Tse,{hunk:r},`${r.oldStart}-${r.oldLines}-${r.newStart}-${r.newLines}`))}):null]})}function Tse({hunk:e}){const t=`@@ -${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines} @@`;return h.jsxs("div",{className:"text-[11px] font-mono leading-relaxed",children:[h.jsx("div",{className:"px-3 py-1 text-text-400 bg-bg-100/40 border-b border-bg-300",children:t}),e.lines.map((n,r)=>{const i=n.charAt(0),s=i==="+"?"bg-green-500/10 text-green-300":i==="-"?"bg-red-500/10 text-red-300":"text-text-300";return h.jsx("div",{className:ie("px-3 whitespace-pre",s),children:n.length>0?n:" "},r)})]})}function Pse({jobs:e}){return e.length===0?h.jsx("div",{"data-testid":"cron-job-list-empty",className:"px-4 py-3 text-sm text-text-500",children:"当前会话暂无活跃 cron 任务"}):h.jsx("ul",{"data-testid":"cron-job-list",className:"flex flex-col gap-2",children:e.map(t=>h.jsxs("li",{"data-testid":`cron-job-${t.id}`,className:"flex flex-col gap-1 rounded-md border border-border px-3 py-2",children:[h.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[h.jsx("span",{className:"font-mono text-text-300",children:t.id}),h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{className:"text-text-400",children:t.humanSchedule}),t.recurring?h.jsx("span",{"data-testid":`cron-job-${t.id}-recurring-badge`,className:"ml-auto rounded-md bg-accent-dim px-2 py-0.5 text-accent",children:"recurring"}):null]}),h.jsx("div",{className:"text-sm text-text-200 truncate",title:t.prompt,children:t.prompt})]},t.id))})}const Rse={idle:"还没启动","turn-running":"正在 run 中","turn-idle":"进程活着,等输入",exited:"进程已退出",crashed:"启动失败 / 异常退出"};function Mse({sessionStatus:e}){switch(e){case"idle":return"idle";case"running":return"turn-running";case"running-idle":return"turn-idle";case"observing":return"turn-running";case"stopped":return"exited";case"error":return"crashed"}}/**
|
|
574
|
+
${t}`:t}function rse(e){return C2.add(e),()=>C2.delete(e)}function ise(e,t){return e.replace(/(^|\s)\/(\S+)/g,(n,r,i)=>{const s=t.find(o=>o.name===i&&o.path);return s!=null&&s.path?`${r}[skill:${i}:${s.path}]`:n})}function sse({api:e,cwd:t,sessionKey:n,onSend:r,disabled:i,onNewSession:s,onClearSession:o,tool:a,spawnableContacts:l=tse,ensureRemotePersonas:c,remotePersonasByDeviceId:u}){const d=S2(n),[f,p]=g.useState((d==null?void 0:d.draft)??""),[m,v]=g.useState(!1),w=g.useRef(null),x=g.useRef(!1),_=g.useCallback(()=>{x.current=!0},[]),b=g.useCallback(()=>{x.current=!1},[]),S=Qp(),{attachments:C,setAttachments:k,addFiles:T,removeAttachment:E,clearAttachments:D}=Qie({httpBaseUrl:S.httpBaseUrl,httpToken:S.httpToken,sessionId:n,initial:(d==null?void 0:d.attachments)??[]}),[N,L]=g.useState([]),[R,M]=g.useState(!1),[A,j]=g.useState(0),[z,F]=g.useState(!1),[$,B]=g.useState([]),[I,U]=g.useState(!1),[q,O]=g.useState(0),[te,le]=g.useState(!1),[Y,re]=g.useState([]),[ke,oe]=g.useState(!1),[Ie,Ee]=g.useState(null),[Re,he]=g.useState(!1),Be=g.useRef(null),Je=g.useMemo(()=>{const ce=[];return s&&ce.push({name:"new",source:"builtin",description:"在当前目录下新建会话"}),o&&n&&ce.push({name:"clear",source:"builtin",description:"清除当前会话"}),ce},[s,o,n]),Ge=g.useMemo(()=>[...Je,...N],[Je,N]),ft=g.useMemo(()=>{const ce=f.match(/^\/(\S*)$/);return ce?ce[1]:null},[f]),Kt=ft!==null&&!z,fe=g.useMemo(()=>ft!==null?RM(Ge,ft):[],[Ge,ft]),He=g.useMemo(()=>{const ce=f.match(/^@(\S*)$/);return ce?ce[1]:null},[f]),Pe=He!==null&&!te,Me=g.useMemo(()=>Ie?((u==null?void 0:u.get(Ie.deviceId))??[]).map(Se=>({kind:"remote-persona",persona:Se,deviceId:Ie.deviceId})):[...$.map(ce=>({kind:"cc-agent",agent:ce})),...Y.map(ce=>({kind:"persona",persona:ce})),...l.map(ce=>({kind:"contact",contact:ce}))],[Ie,u,$,Y,l]),rt=g.useMemo(()=>He!==null?MM(Me,He):[],[Me,He]),tn=g.useRef(f);g.useEffect(()=>{f!==tn.current&&(F(!1),le(!1),tn.current=f)},[f]);const hn=g.useCallback(()=>{F(!0)},[]),W=g.useCallback(()=>{le(!0)},[]),ee=g.useRef(f),be=g.useRef(C);g.useEffect(()=>{ee.current=f},[f]),g.useEffect(()=>{be.current=C},[C]);const Oe=g.useRef(n);g.useEffect(()=>{if(n!==null)return rse((ce,Se)=>{ce===n&&(p(st=>nse(st,Se)),queueMicrotask(()=>Wh(w.current)))})},[n]),g.useEffect(()=>{const ce=Oe.current;if(ce===n)return;k2(ce,{draft:ee.current,attachments:be.current});const Se=S2(n);p((Se==null?void 0:Se.draft)??""),k((Se==null?void 0:Se.attachments)??[]),j(0),O(0),F(!1),le(!1),Ee(null),Be.current=null,he(!1),queueMicrotask(()=>{Se!=null&&Se.draft?Wh(w.current):ya(w.current)}),Oe.current=n},[n,k]),g.useEffect(()=>()=>{k2(Oe.current,{draft:ee.current,attachments:be.current})},[]),g.useEffect(()=>{j(0)},[ft]),g.useEffect(()=>{O(0)},[He]),g.useEffect(()=>{He===null&&Ie&&(Ee(null),Be.current=null,he(!1))},[He,Ie]),g.useEffect(()=>{if(!Kt||R)return;if(!e){M(!0);return}let ce=!1;return(async()=>{try{const Se=await e.skillsList(t,a);ce||(L(Se.skills??[]),M(!0))}catch{ce||M(!0)}})(),()=>{ce=!0}},[Kt,R,e,t,a]),g.useEffect(()=>{if(!Pe||I)return;if(!e){U(!0);return}let ce=!1;return(async()=>{try{const Se=await e.agentsList(t,a);ce||(B(Se.agents??[]),U(!0))}catch{ce||U(!0)}})(),()=>{ce=!0}},[Pe,I,e,t,a]),g.useEffect(()=>{if(!Pe||ke)return;if(!e){oe(!0);return}let ce=!1;return(async()=>{try{const Se=await e.personaList();ce||(re((Se.personas??[]).filter(st=>st.personaId!==NT).map(st=>({personaId:st.personaId,label:st.label}))),oe(!0))}catch{ce||oe(!0)}})(),()=>{ce=!0}},[Pe,ke,e]);const Ue=g.useCallback(ce=>{switch(ce.kind){case"persona":p(`@persona/${ce.persona.personaId} `);break;case"cc-agent":p(`@"${ce.agent.name} (agent)" `);break;case"contact":{const Se=ce.contact.deviceId;Ee({deviceId:Se,displayName:ce.contact.displayName}),Be.current=Se,he(!0),Promise.resolve(c==null?void 0:c(Se)).finally(()=>{Be.current===Se&&he(!1)}),p("@"),le(!1),setTimeout(()=>{var st;return(st=w.current)==null?void 0:st.focus()},0);return}case"remote-persona":p(`@persona/${ce.persona.personaId}@${ce.deviceId} `),Ee(null);break}le(!1),setTimeout(()=>{var Se;return(Se=w.current)==null?void 0:Se.focus()},0)},[c]),At=g.useCallback(()=>{Ee(null),Be.current=null,he(!1),p("@"),setTimeout(()=>{var ce;return(ce=w.current)==null?void 0:ce.focus()},0)},[]),bn=g.useCallback(ce=>{if(ce.source==="builtin"&&ce.name==="new"&&s){p(""),D(),ya(w.current),s(t);return}if(ce.source==="builtin"&&ce.name==="clear"&&o){p(""),D(),ya(w.current),o();return}p(`/${ce.name} `),setTimeout(()=>{var Se;return(Se=w.current)==null?void 0:Se.focus()},0)},[s,t,D,o]),nn=g.useCallback(async()=>{const ce=f.trim(),Se=C.filter(gt=>gt.status==="done");if(!ce&&Se.length===0||m||i)return;if(ce==="/new"&&s){v(!0);try{await s(t),p(""),D(),ya(w.current)}finally{v(!1)}return}if(ce==="/clear"&&o){v(!0);try{await o(),p(""),D(),ya(w.current)}finally{v(!1)}return}const st=mT(a)||vT(a)?ise(ce,N):ce;v(!0);try{const gt=zG(st,C);await r(gt,{queueWhileRunning:!0}),p(""),D(),ya(w.current)}finally{v(!1)}},[f,C,m,i,r,s,t,D,o,a,N]),fn=g.useCallback(ce=>{const{text:Se,attachments:st}=ese(ce);if(p(Se),st.length>0){const gt=new Set(be.current.map(gr=>gr.id));k([...be.current,...st.filter(gr=>!gt.has(gr.id))])}queueMicrotask(()=>Wh(w.current))},[k]);return{draft:f,setDraft:p,sending:m,textareaRef:w,isComposingRef:x,onCompositionStart:_,onCompositionEnd:b,attachments:C,addFiles:T,removeAttachment:E,skillSelectorVisible:Kt,filteredSkills:fe,slashQuery:ft??"",activeSkillIdx:A,setActiveSkillIdx:j,selectSkill:bn,dismissSkillSelector:hn,agentSelectorVisible:Pe,filteredAgents:rt,mentionQuery:He,activeAgentIdx:q,setActiveAgentIdx:O,selectAgent:Ue,dismissAgentSelector:W,drilldown:Ie,drilldownLoading:Re,exitDrilldown:At,doSend:nn,restoreTextToDraft:fn}}const ose=120;function Wh(e){e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,ose)}px`)}function ya(e){e&&(e.style.height="auto")}function ase({items:e,restoreDisabled:t,onRestore:n,onRemove:r}){return e.length===0?null:h.jsxs("div",{"data-testid":"chat-input-queue",className:"flex flex-col",children:[h.jsx("div",{className:"px-1 pb-1 text-[11px] text-text-400",children:`排队中 · ${e.length} 条(这一轮跑完连起来一起发出)`}),e.map((i,s)=>h.jsxs("div",{"data-testid":`chat-input-queue-item-${i.id}`,className:"flex items-center gap-2 rounded-md px-1 py-1 transition-colors hover:bg-text-100/5",children:[h.jsx("span",{className:"shrink-0 w-4 text-center text-[11px] text-text-400 tabular-nums",children:s+1}),h.jsx("button",{type:"button","data-testid":`chat-input-queue-restore-${i.id}`,disabled:t,title:t?"先清空输入框再取回这条":"取回输入框继续改",onClick:()=>n(i.id),className:"flex-1 min-w-0 text-left text-[12.5px] text-text-200 truncate hover:text-text-100 disabled:cursor-not-allowed disabled:hover:text-text-200",children:i.text.trim()||"(空消息)"}),h.jsx("button",{type:"button","aria-label":"移出队列","data-testid":`chat-input-queue-remove-${i.id}`,onClick:()=>r(i.id),className:"shrink-0 p-0.5 rounded text-text-400 hover:text-text-100 hover:bg-text-100/10",children:h.jsx(Qr,{className:"w-3.5 h-3.5"})})]},i.id))]})}const lse="[--color-border:#E6E6E6] [--bg-300:#E6E6E6] dark:[--color-border:#424242] dark:[--bg-300:#424242]",cse={spawnableContacts:[],ensureRemotePersonas:()=>Promise.resolve(),remotePersonasByDeviceId:new Map},use=g.createContext(cse);function dse(){return g.useContext(use)}function hse({url:e,fileName:t,onClose:n}){const[r,i]=g.useState(!1);g.useEffect(()=>{const o=a=>{a.key==="Escape"&&n()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n]);const s=async()=>{try{const a=await(await fetch(e)).blob();await navigator.clipboard.write([new ClipboardItem({[a.type]:a})]),i(!0),setTimeout(()=>i(!1),2e3)}catch{E2(e,t)}};return h.jsx("div",{"data-testid":"image-lightbox",className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60",onClick:n,role:"dialog","aria-modal":"true",children:h.jsxs("div",{className:"relative",onClick:o=>o.stopPropagation(),children:[h.jsx("img",{src:e,alt:t,className:"max-h-[90vh] max-w-[92vw] rounded-lg object-contain shadow-2xl"}),h.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-1.5",children:[h.jsxs("button",{type:"button",onClick:s,"data-testid":"image-lightbox-copy",className:"flex cursor-pointer items-center gap-1 rounded-full border border-bg-300 bg-bg-50/95 px-2 py-0.5 text-[11px] font-medium text-text-200 shadow transition-colors hover:bg-bg-100",children:[h.jsx(t_,{className:"h-3 w-3"}),r?"Copied":"Copy"]}),h.jsxs("button",{type:"button",onClick:()=>E2(e,t),"data-testid":"image-lightbox-save",className:"flex cursor-pointer items-center gap-1 rounded-full border border-bg-300 bg-bg-50/95 px-2 py-0.5 text-[11px] font-medium text-text-200 shadow transition-colors hover:bg-bg-100",children:[h.jsx($7,{className:"h-3.5 w-3.5"}),"Save"]}),h.jsx("button",{type:"button",onClick:n,"data-testid":"image-lightbox-close","aria-label":"close",className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded-full border border-bg-300 bg-bg-50/95 text-text-300 transition-colors hover:bg-bg-100 hover:text-text-100",children:h.jsx(Qr,{className:"h-3 w-3"})})]})]})})}function E2(e,t){const n=document.createElement("a");n.href=e,n.download=t||"image",n.click()}const I2=1e3,AM=`bg-bg-50 ${lse}`,N2=`mx-2 -mb-3 rounded-t-xl border border-b-0 border-border px-3 pt-2 pb-4 ${AM}`,fse=5e3;function lh(e){if(!e)return"null";if(e===document.body)return"body";const t=e.getAttribute("data-testid"),n=typeof e.className=="string"&&e.className.trim()?`.${e.className.trim().split(/\s+/).slice(0,3).join(".")}`:"";return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""}${t?`[${t}]`:""}${n}`}function pse({meta:e,api:t,cwd:n,tool:r,onSend:i,sessionKey:s,queued:o,onDequeue:a,disabled:l=!1,placeholder:c,className:u,awaitingUser:d=!1,onAbort:f,onNewSession:p,onClearSession:m,configSlot:v,aboveSlot:w}){const x=(e==null?void 0:e.streamInProgress)??!1,_=(e==null?void 0:e.contextPct)??null,b=_==null?"":_>=80?"text-red-400":_>=50?"text-amber-400":"text-text-500",S=g.useRef(null),C=dse(),k=sse({...t?{api:t}:{},cwd:n,...r?{tool:r}:{},sessionKey:s,onSend:i,disabled:l,...p?{onNewSession:p}:{},...m?{onClearSession:m}:{},spawnableContacts:C.spawnableContacts,ensureRemotePersonas:C.ensureRemotePersonas,remotePersonasByDeviceId:C.remotePersonasByDeviceId}),{draft:T,setDraft:E,sending:D,textareaRef:N,attachments:L,addFiles:R,removeAttachment:M,skillSelectorVisible:A,filteredSkills:j,slashQuery:z,activeSkillIdx:F,setActiveSkillIdx:$,selectSkill:B,dismissSkillSelector:I,agentSelectorVisible:U,filteredAgents:q,mentionQuery:O,activeAgentIdx:te,setActiveAgentIdx:le,selectAgent:Y,dismissAgentSelector:re,drilldown:ke,drilldownLoading:oe,exitDrilldown:Ie,doSend:Ee,restoreTextToDraft:Re}=k,he=g.useCallback(()=>{(async()=>{const ae=await(f==null?void 0:f());ae&&ae.length>0&&Re(Jie(ae,T))})()},[f,Re,T]),Be=g.useCallback(ae=>{const it=o==null?void 0:o.find(Bt=>Bt.id===ae);!it||!a||T.trim().length>0||(a(ae),Re(it.text))},[o,a,T,Re]),Je=Fie();g.useEffect(()=>{if(!Je||Je.signal===0||s===null||Je.sessionId!==s)return;const{signal:ae}=Je;console.log("[chat-focus] 收到聚焦信号",{sessionKey:s,signal:ae,delayMs:I2,activeElement:lh(document.activeElement)});let it=null,Bt=null,ti=null;const oa=setTimeout(()=>{if(it=N.current,!it){console.warn("[chat-focus] textarea 已不在,放弃聚焦",{sessionKey:s,signal:ae});return}it.focus(),console.log("[chat-focus] focus() 已执行",{sessionKey:s,signal:ae,landed:document.activeElement===it,activeElement:lh(document.activeElement)}),Bt=aa=>{const hs=lh(aa.relatedTarget);setTimeout(()=>{console.warn("[chat-focus] STOLEN 输入框失焦",{sessionKey:s,signal:ae,relatedTarget:hs,activeElementAfterTick:lh(document.activeElement)})},0)},it.addEventListener("blur",Bt,{once:!0}),ti=setTimeout(()=>{it&&Bt&&it.removeEventListener("blur",Bt)},fse)},I2);return()=>{clearTimeout(oa),ti&&clearTimeout(ti),it&&Bt&&it.removeEventListener("blur",Bt)}},[Je==null?void 0:Je.signal]);const Ge=!!t,ft=D||l||x,fe=(T.trim().length>0||L.some(ae=>ae.status==="done"))&&!l&&!D&&!d,He=c??(d?"Answer the question above first...":ft?"Queue a message...":`Message ${o_(r)}...`),Pe=g.useRef(!1),Me=g.useCallback(()=>{Pe.current=!0},[]),rt=g.useCallback(()=>{Pe.current=!1},[]),tn=g.useCallback(ae=>{if(A&&j.length>0){if(ae.key==="ArrowDown")return ae.preventDefault(),$(F>=j.length-1?0:F+1),!0;if(ae.key==="ArrowUp")return ae.preventDefault(),$(F<=0?j.length-1:F-1),!0;if(ae.key==="Tab"||ae.key==="Enter"&&!ae.shiftKey){ae.preventDefault();const it=j[F];return it&&B(it),!0}if(ae.key==="Escape")return ae.preventDefault(),I(),!0}return!1},[A,j,F,$,B,I]),hn=g.useCallback(ae=>{if(U&&q.length>0){if(ae.key==="ArrowDown")return ae.preventDefault(),le(te>=q.length-1?0:te+1),!0;if(ae.key==="ArrowUp")return ae.preventDefault(),le(te<=0?q.length-1:te-1),!0;if(ae.key==="Tab"||ae.key==="Enter"&&!ae.shiftKey){ae.preventDefault();const it=q[te];return it&&Y(it),!0}if(ae.key==="Escape")return ae.preventDefault(),ke?Ie():re(),!0}return!1},[U,q,te,le,Y,re,ke,Ie]),W=g.useCallback(ae=>{const it=ae.nativeEvent;ae.key==="Enter"&&yP({compositionActive:Pe.current,nativeIsComposing:it.isComposing,keyCode:it.keyCode})||tn(ae)||hn(ae)||_P({key:ae.key,shiftKey:ae.shiftKey,compositionActive:Pe.current,nativeIsComposing:it.isComposing,keyCode:it.keyCode})&&(ae.preventDefault(),fe&&Ee())},[tn,hn,fe,Ee]),ee=g.useCallback(ae=>{E(ae.target.value),Wh(ae.target)},[E]),be=g.useCallback(ae=>{ae.target.files&&R(ae.target.files),ae.target.value=""},[R]),Oe=g.useCallback(ae=>{if(!Ge)return;const it=Array.from(ae.clipboardData.items).map(Bt=>Bt.getAsFile()).filter(Bt=>!!(Bt&&Bt.type.startsWith("image/")));it.length!==0&&(ae.preventDefault(),R(it))},[R,Ge]),[Ue,At]=g.useState(null),bn=g.useCallback(ae=>{ae.previewUrl&&At({url:ae.previewUrl,name:ae.fileName})},[]),[nn,fn]=g.useState(!1),ce=g.useCallback(ae=>{Ge&&(ae.preventDefault(),fn(!0))},[Ge]),Se=g.useCallback(()=>fn(!1),[]),st=g.useCallback(ae=>{Ge&&(ae.preventDefault(),fn(!1),ae.dataTransfer.files.length>0&&R(ae.dataTransfer.files))},[R,Ge]),gt=x&&!d&&typeof f=="function",gr=l||d;return h.jsxs("div",{"data-testid":"chat-input",className:ie("shrink-0 border-t border-bg-300/20 px-4 py-3",u),onDragOver:ce,onDragLeave:Se,onDrop:st,children:[h.jsxs("div",{className:"max-w-3xl mx-auto relative",children:[Ge?h.jsx("input",{ref:S,type:"file",multiple:!0,accept:z$,hidden:!0,onChange:be,"data-testid":"chat-input-file"}):null,h.jsxs("div",{"data-testid":"chat-input-bare",className:ie("flex flex-col gap-2"),children:[d||D||x?h.jsxs("div",{"data-testid":"chat-input-status-bar",className:"flex items-center gap-2 text-[12px] text-text-400",children:[h.jsxs("div",{className:"flex gap-1",children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-400-dim-fg animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-400-dim-fg animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-400-dim-fg animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{children:d?"Waiting for your answer":`${mT(r)?"Codex":vT(r)?"pi":"Claude"} is working`})]}):null,A?h.jsx($ie,{query:z,skills:j,activeIndex:F,onActiveIndexChange:$,onSelect:B}):null,U?ke?!C.remotePersonasByDeviceId.has(ke.deviceId)&&oe?h.jsx("div",{"data-testid":"cc-agent-remote-loading",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 rounded-2xl border border-bg-300 bg-bg-50 px-4 py-3 text-[12px] text-text-300 shadow-lg",children:`正在加载 @${ke.displayName} 的 persona…`}):q.length>0?h.jsx(w2,{query:O??"",entries:q,activeIndex:te,onActiveIndexChange:le,onSelect:Y}):h.jsx("div",{"data-testid":"cc-agent-remote-empty",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 rounded-2xl border border-bg-300 bg-bg-50 px-4 py-3 text-[12px] text-text-300 shadow-lg",children:`@${ke.displayName} 暂无可派活的 persona(可能离线或未公开)`}):h.jsx(w2,{query:O??"",entries:q,activeIndex:te,onActiveIndexChange:le,onSelect:Y}):null,o&&o.length>0?h.jsx("div",{"data-testid":"chat-input-queue-header",className:N2,children:h.jsx(ase,{items:o,restoreDisabled:T.trim().length>0||!a,onRestore:Be,onRemove:ae=>void(a==null?void 0:a(ae))})}):null,L.length>0?h.jsx(Kie,{attachments:L,onRemove:M,onOpenPreview:bn}):null,w?h.jsx("div",{"data-testid":"chat-input-above-slot",className:N2,children:w}):null,h.jsxs("div",{"data-testid":"bare-chat-input-frame",className:ie("relative flex flex-col gap-1 rounded-xl border border-border px-3 py-2 transition-colors duration-200",AM,gr?"opacity-60":null,nn?"border-accent/60 bg-accent/5":null),children:[h.jsx("textarea",{ref:N,"data-testid":"chat-input-textarea",value:T,onChange:ee,onKeyDown:W,onCompositionStart:Me,onCompositionEnd:rt,onPaste:Oe,placeholder:He,disabled:gr,readOnly:gr,rows:1,className:"w-full resize-none bg-transparent border-0 outline-none text-[14px] text-text-100 placeholder:text-text-400 leading-relaxed py-1 min-h-[22px] max-h-[120px] overflow-y-auto disabled:cursor-not-allowed"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[Ge?h.jsx("button",{type:"button",onClick:()=>{var ae;return(ae=S.current)==null?void 0:ae.click()},disabled:ft,"data-testid":"chat-input-attach","aria-label":"attach files",className:ie("flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors",ft?"cursor-default text-text-400/50":"cursor-pointer text-text-400 hover:bg-text-100/5 hover:text-text-200"),children:h.jsx(_F,{className:"h-4 w-4"})}):null,h.jsx("div",{className:"flex-1 min-w-0"}),_!=null?h.jsxs("span",{"data-testid":"chat-input-ctx",className:ie("shrink-0 text-[11px] tabular-nums",b),children:["ctx:",_,"%"]}):null,v,gt?h.jsx("button",{type:"button",onClick:he,"data-testid":"chat-input-abort","aria-label":"interrupt",title:"中断当前轮次(不杀进程)",className:"h-8 w-8 rounded-full flex items-center justify-center border border-text-400/40 text-text-400 hover:bg-text-100/5 hover:text-text-100 transition-colors cursor-pointer",children:h.jsx(d4,{className:"w-3.5 h-3.5",strokeWidth:2.5})}):null,h.jsx("button",{type:"button",onClick:()=>{fe&&Ee()},disabled:!fe,"data-testid":"chat-input-send","aria-label":"send",className:ie("h-8 w-8 rounded-full flex items-center justify-center transition-colors",fe?"bg-accent text-white hover:bg-accent-hover cursor-pointer shadow-sm":"bg-[var(--text-400-dim)] text-[var(--text-400-dim-fg)] cursor-default"),children:h.jsx(u7,{className:"w-4 h-4",strokeWidth:2.5})})]})]})]})]}),Ue?h.jsx(hse,{url:Ue.url,fileName:Ue.name,onClose:()=>At(null)}):null]})}function mse(e){const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n>=0?t.slice(n+1):t}function gse({meta:e,tool:t,connState:n,variant:r="full",onOpenConfig:i,liveWorktreeRoot:s,ephemeral:o=!1,onPromote:a,cloudVolume:l,className:c}){const u=s??e.cwd??"",f=!!e.sessionLabel&&e.sessionLabel!==e.sessionId?e.sessionLabel:mse(u),p=u;return r==="quickask"?h.jsxs("div",{"data-testid":"chat-header","data-variant":"quickask",className:ie("flex items-center shrink-0 px-3 py-2 gap-2",c),children:[a?h.jsx("button",{type:"button","data-testid":"chat-header-promote","data-promoted":o?"false":"true",disabled:!o,onClick:a,title:o?"保留为正式会话":"已保留为正式会话",className:ie("shrink-0 inline-flex items-center justify-center h-5 w-5 rounded-md transition-colors",o?"text-text-500 hover:text-text-200 hover:bg-text-100/5 cursor-pointer":"text-amber-400"),children:h.jsx(v7,{className:ie("w-3.5 h-3.5",!o&&"fill-current")})}):null,h.jsx("span",{className:"font-semibold text-text-100 truncate text-[13px]","data-testid":"chat-header-worktree",title:p,children:f})]}):h.jsxs("div",{"data-testid":"chat-header","data-variant":"full",className:ie("relative flex items-center shrink-0 px-4 py-2.5",l?"pr-36 md:pr-32":"pr-[4.5rem] md:pr-4",c),children:[h.jsx("span",{className:"font-semibold text-text-100 truncate text-[13px]","data-testid":"chat-header-worktree",title:p,children:f}),h.jsxs("div",{className:"absolute right-4 top-1/2 -translate-y-1/2 z-10 flex items-center gap-1",children:[l,i?h.jsx("button",{type:"button","aria-label":"Session settings","data-testid":"chat-header-settings-mobile",onClick:i,title:"Session settings",className:"flex md:hidden h-7 w-7 items-center justify-center rounded-md bg-transparent text-text-300 transition-colors duration-150 hover:bg-bg-200 hover:text-text-100 cursor-pointer outline-none",children:h.jsx(l4,{className:"w-4 h-4"})}):null]})]})}function vse({testid:e,children:t}){return h.jsx("div",{"data-testid":e,className:"h-full min-w-0 border-l border-border bg-bg-100 flex flex-col",children:t})}function xse({title:e,onBack:t,onCollapse:n,collapseLabel:r="collapse session info",collapseTitle:i="收起会话信息"}){const s=o=>h.jsx("button",{type:"button","data-testid":"session-info-collapse",onClick:n,"aria-label":r,title:i,className:`p-1 rounded text-text-400 hover:text-text-100 hover:bg-text-100/10 ${o}`,children:h.jsx(ik,{className:"w-4 h-4"})});return h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border shrink-0",children:[t?h.jsx("button",{type:"button","data-testid":"session-info-back",onClick:t,"aria-label":"返回会话信息",className:"p-1 -ml-1 rounded text-text-400 hover:text-text-100 hover:bg-text-100/10",children:h.jsx(a7,{className:"w-4 h-4"})}):n?s("-ml-1"):h.jsx(ik,{className:"w-4 h-4 text-text-300"}),h.jsx("span",{className:"flex-1 text-[13px] font-medium text-text-100 truncate",children:e}),t&&n?s(""):null]})}function ch({icon:e,label:t,meta:n,onClick:r,testid:i,disabled:s}){return h.jsxs("button",{type:"button","data-testid":i,onClick:r,disabled:s,className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-md cursor-pointer text-left hover:bg-text-100/5 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent",children:[h.jsx("span",{className:"w-4 h-4 shrink-0 text-text-300 inline-flex items-center justify-center",children:e}),h.jsx("span",{className:"flex-1 text-[12.5px] text-text-100",children:t}),n?h.jsx("span",{className:"shrink-0 text-[11px] text-text-400 font-mono",children:n}):null]})}let yse=null;function _se(){return yse}function Ec({label:e,labelTitle:t,children:n}){return h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1",children:[h.jsx("span",{className:"w-14 shrink-0 truncate text-[11px] text-text-400 pt-0.5",...t?{title:t}:{},children:e}),h.jsx("span",{className:"flex-1 min-w-0 text-[12px] text-text-100",children:n})]})}function T2({label:e,labelTitle:t,value:n,testid:r}){const[i,s]=g.useState(!1),o=g.useRef(null);g.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const a=()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(n).then(()=>{s(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>s(!1),2e3)},()=>{})};return h.jsx(Ec,{label:e,labelTitle:t,children:h.jsxs("button",{type:"button",onClick:a,"data-testid":r,title:i?"已复制":`复制:${n}`,className:"w-full flex items-center gap-1.5 text-left group cursor-pointer",children:[h.jsx("span",{className:"font-mono text-[11px] text-text-300 truncate flex-1 min-w-0",children:n}),i?h.jsx(Qo,{className:"w-3 h-3 shrink-0 text-accent"}):h.jsx(t_,{className:"w-3 h-3 shrink-0 text-text-400 opacity-0 group-hover:opacity-100 transition-opacity"})]})})}function bse({session:e,meta:t,liveGitBranch:n,liveWorktreeRoot:r,personaName:i,onOpenPersona:s,onOpenFiles:o,cronActiveCount:a,onCronClick:l,onForceStop:c,onReloadFromCloud:u,reloadFromCloudDisabled:d=!1,viewerRole:f="owner",toolSessionIdLabel:p="tool session id",drill:m=null,onCollapse:v,title:w="会话信息",leadingEntries:x}){const _=n!==void 0?n:t.gitBranch??null,b=t.procAlive??!1,S=j4(e),C=S!=null&&e.originOwnerPrincipalId==null&&f!=="guest",[k,T]=g.useState(null),E=g.useRef(null);g.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]);const D=async()=>{if(!C)return;const N=_se();let L;try{N||(await navigator.clipboard.writeText(S),L="命令已复制")}catch{L="操作失败"}T(L),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>T(null),2500)};return h.jsxs(vse,{testid:"session-info-panel",children:[h.jsx(xse,{title:m?m.title:w,...m?{onBack:m.onBack}:{},...v?{onCollapse:v}:{},collapseTitle:`收起${w}`}),m?h.jsx("div",{"data-testid":"session-info-drill",className:"flex-1 min-h-0 overflow-y-auto",children:m.content}):h.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[_?h.jsx(Ec,{label:"分支",children:h.jsxs("span",{"data-testid":"session-info-branch",className:"inline-flex items-center gap-1 font-mono text-[11.5px] min-w-0",title:r??void 0,children:[h.jsx(ku,{className:"w-3 h-3 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:_})]})}):null,i&&s?h.jsx(Ec,{label:"persona",children:h.jsxs("button",{type:"button","data-testid":"session-info-persona",onClick:s,className:"inline-flex items-center gap-1 hover:text-accent cursor-pointer",children:[h.jsx(g4,{className:"w-3 h-3"}),h.jsx("span",{className:"truncate",children:i})]})}):null,h.jsx(Ec,{label:"引擎",children:h.jsxs("span",{className:"inline-flex items-center gap-1.5","data-testid":"session-info-engine",children:[h.jsx(tm,{tool:e.tool,className:ie("w-3.5 h-3.5 shrink-0",nm(e.tool))}),h.jsxs("span",{className:"truncate",children:[o_(e.tool),t.model?` · ${t.model}`:""]})]})}),h.jsx(Ec,{label:"cwd",children:h.jsx("span",{"data-testid":"session-info-cwd",className:"font-mono text-[11px] text-text-300 truncate block",title:e.cwd,children:e.cwd})}),h.jsx(T2,{label:"session id",value:e.sessionId,testid:"session-info-session-id"}),e.toolSessionId?h.jsx(T2,{label:`${e.tool||"claude"} id`,labelTitle:p,value:e.toolSessionId,testid:"session-info-tool-session-id"}):null,h.jsx("div",{className:"my-2 border-t border-border"}),x,o?h.jsx(ch,{icon:h.jsx(Y7,{className:"w-3.5 h-3.5"}),label:"Edited Files",onClick:o,testid:"session-info-files"}):null,a&&a>0&&l?h.jsx(ch,{icon:h.jsx(P7,{className:"w-3.5 h-3.5"}),label:"定时任务",meta:String(a),onClick:l,testid:"session-info-cron"}):null,C?h.jsx(ch,{icon:h.jsx(qF,{className:"w-3.5 h-3.5"}),label:"终端",meta:k,onClick:()=>void D(),testid:"session-info-terminal"}):null,u?h.jsx(ch,{icon:h.jsx(M7,{className:"w-3.5 h-3.5"}),label:"从云端重新加载",...d?{meta:"运行中"}:{},onClick:u,disabled:d,testid:"session-info-reload-cloud"}):null]}),b&&c?h.jsx("div",{className:"shrink-0 border-t border-border px-3 py-2.5",children:h.jsxs("button",{type:"button","data-testid":"session-info-force-stop",onClick:c,title:e.tool==="codex"?"强制停止 Codex 进程":"强制停止 Claude Code 进程(会丢失 initialize / 预热缓存)",className:"inline-flex items-center gap-1.5 h-6 px-2.5 rounded-md text-text-400 hover:bg-red-500/10 hover:text-red-400 transition-colors text-[12px] cursor-pointer",children:[h.jsx(vF,{className:"w-3.5 h-3.5"}),h.jsx("span",{children:"强制停止"})]})}):null]})}const wse=g.createContext({container:null});function Sse(){return g.useContext(wse)}const db="fixed top-0 md:top-10 bottom-0 right-0";function kse({api:e,cwd:t,toolSessionId:n,toolKind:r="claude"}){const i=IM(),s=(i==null?void 0:i.state.agentId)??null,o=i==null?void 0:i.state.agentType,[a,l]=g.useState([]),[c,u]=g.useState(!1),[d,f]=g.useState(null);g.useEffect(()=>{if(!s)return;let m=!1;return u(!0),f(null),l([]),e.historySubagentRead({cwd:t,toolSessionId:n,subagentId:s}).then(v=>{m||l(v.messages??[])}).catch(v=>{m||f(v instanceof Error?v.message:String(v))}).finally(()=>{m||u(!1)}),()=>{m=!0}},[s,t,n,e]);const p=g.useMemo(()=>a.length>0?W_(a,0,r):[],[a,r]);return!i||!s?null:h.jsxs("div",{"data-testid":"subagent-drawer","data-agent-id":s,className:ie(db,"z-50 w-[min(560px,92vw)]","flex flex-col border-l border-bg-200/60 bg-bg-50 shadow-xl"),style:{paddingTop:"env(safe-area-inset-top)"},children:[h.jsxs("div",{className:"flex flex-col gap-0.5 px-3 py-2 border-b border-bg-200/60",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o?h.jsx("span",{className:"inline-flex items-center rounded-sm bg-violet-500/10 px-1.5 py-0.5 text-[11px] text-violet-400 font-medium",children:o}):null,h.jsx("span",{className:"font-mono text-[11px] text-text-400 truncate",title:s,children:s})]}),h.jsx("button",{type:"button","aria-label":"关闭",onClick:()=>i.close(),className:"p-1 rounded hover:bg-bg-200/50 text-text-400 hover:text-text-200",children:h.jsx(Qr,{className:"w-4 h-4"})})]}),!c&&!d&&a.length>0?h.jsxs("div",{className:"text-[11px] text-text-400",children:[a.length," 条消息 · 首条为主会话派发的任务指令"]}):null]}),h.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden px-3 py-2",children:c?h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin"}),h.jsx("span",{children:"加载中…"})]}):d?h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-error",children:[h.jsx(Jo,{className:"w-3.5 h-3.5"}),h.jsx("span",{children:d})]}):p.length===0?h.jsx("div",{className:"text-[12px] text-text-400 italic",children:"无消息"}):h.jsx(PM,{lines:p})})]})}function P2(e,t){let n=0;for(const r of e.lines)r.startsWith(t)&&n++;return n}function Cse(e,t){const n=e.findIndex(c=>c.kind==="user-text"&&c.uuid===t);if(n<0)return{userMessageId:t,files:[],totalInsertions:0,totalDeletions:0,anchorFound:!1};let r=e.length;for(let c=n+1;c<e.length;c++)if(e[c].kind==="user-text"){r=c;break}const i=[],s=new Map;for(let c=n+1;c<r;c++){const u=e[c];if(u.kind!=="tool-result")continue;const d=u.toolResultExtra;if(!(d!=null&&d.filePath)||!d.structuredPatch||d.structuredPatch.length===0)continue;const f=d.filePath;let p=s.get(f);p||(p={filePath:f,hunks:[],insertions:0,deletions:0},s.set(f,p),i.push(f));for(const m of d.structuredPatch)p.hunks.push(m),p.insertions+=P2(m,"+"),p.deletions+=P2(m,"-")}const o=i.map(c=>s.get(c)),a=o.reduce((c,u)=>c+u.insertions,0),l=o.reduce((c,u)=>c+u.deletions,0);return{userMessageId:t,files:o,totalInsertions:a,totalDeletions:l,anchorFound:!0}}function Ese({open:e,onOpenChange:t,api:n,sessionId:r,userMessageId:i,lines:s,procAlive:o,onApplied:a,onNoChanges:l}){const c=g.useMemo(()=>Cse(s,i),[s,i]),[u,d]=g.useState(null),[f,p]=g.useState(!1),[m,v]=g.useState(!1),[w,x]=g.useState(null);g.useEffect(()=>{if(!e)return;let k=!1;return p(!0),d(null),(async()=>{try{const T=await n.sessionRewindDiff({sessionId:r,userMessageId:i});k||(d(T),!T.canRewind&&!T.error&&T.files.length===0&&(l==null||l(i)))}catch{k||d(null)}finally{k||p(!1)}})(),()=>{k=!0}},[e,n,r,i]);const _=g.useMemo(()=>{if(u){const k=!u.canRewind&&!u.error&&u.files.length===0;if(u.canRewind||k)return{source:"rpc",anchorFound:!0,files:u.files.map(T=>({filePath:T.filePath,hunks:T.hunks,insertions:T.insertions,deletions:T.deletions})),totalInsertions:u.totalInsertions,totalDeletions:u.totalDeletions}}return{source:"local",anchorFound:c.anchorFound,files:c.files,totalInsertions:c.totalInsertions,totalDeletions:c.totalDeletions,rpcError:u==null?void 0:u.error}},[u,c]),b=g.useCallback(async()=>{v(!0),x(null);try{const k=await n.sessionRewind({sessionId:r,userMessageId:i,dryRun:!1});if(!k.canRewind){x(k.error??"回退失败");return}a==null||a(),t(!1)}catch(k){x(k.message||"回退失败")}finally{v(!1)}},[n,r,i,a,t]);if(!e)return null;const S=_.files.length>0,C=!f&&!m&&_.anchorFound&&S&&!w;return h.jsxs("div",{"data-testid":"rewind-preview-drawer",className:`${db} z-40 flex flex-col border-l border-bg-300/40 bg-bg-0 shadow-xl`,style:{width:480,minWidth:480},children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bg-300/30 shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(m4,{className:"w-4 h-4 text-text-300"}),h.jsx("span",{className:"text-[14px] font-semibold text-text-100",children:"Rewind 预览"})]}),h.jsx("button",{type:"button",onClick:()=>t(!1),"data-testid":"rewind-drawer-close",className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:bg-text-100/5 hover:text-text-200 cursor-pointer","aria-label":"close",children:h.jsx(Qr,{className:"w-4 h-4"})})]}),w?h.jsxs("div",{"data-testid":"rewind-error-banner",className:"mx-4 mt-3 flex items-start gap-2 rounded-md border border-red-400/40 bg-red-500/10 px-3 py-2 text-[12px] text-red-400",children:[h.jsx(Uf,{className:"w-4 h-4 shrink-0 mt-0.5"}),h.jsx("span",{children:w})]}):null,h.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:f?h.jsxs("div",{"data-testid":"rewind-loading",className:"flex items-center gap-2 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin"}),h.jsx("span",{children:"正在读取快照…"})]}):_.anchorFound?S?h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":"rewind-summary",className:"rounded-md border border-bg-300 bg-bg-100/40 px-3 py-2 text-[12px] text-text-200",children:[h.jsxs("div",{children:["将回退 ",h.jsx("span",{className:"font-semibold text-text-100",children:_.files.length})," ","个文件,",h.jsxs("span",{className:"text-green-500 font-mono",children:["+",_.totalInsertions]})," / ",h.jsxs("span",{className:"text-red-400 font-mono",children:["-",_.totalDeletions]})]}),_.source==="local"?h.jsx("div",{"data-testid":"rewind-source-hint",className:"mt-1 text-text-400 text-[11px]",children:"基于对话里 tool_result 估算(未读到 CC 快照,数字可能与实际磁盘略有差异)"}):null]}),_.files.map(k=>h.jsx(Nse,{file:k},k.filePath))]}):h.jsxs("div",{"data-testid":"rewind-no-changes",className:"rounded-md border border-bg-300 bg-bg-100/60 px-3 py-2 text-[12px] text-text-300 space-y-1",children:[h.jsx("div",{children:"磁盘上的文件已经和这个时刻的快照完全一致——没有需要回退的改动。"}),h.jsx("div",{className:"text-text-400 text-[11px]",children:"可能这条消息之后 Claude 没落盘编辑,或之前已经 rewind 过了。"})]}):h.jsx("div",{"data-testid":"rewind-no-anchor",className:"rounded-md border border-bg-300 bg-bg-100/60 px-3 py-2 text-[12px] text-text-300",children:"未能在当前消息流中找到对应的用户消息(可能已被历史裁剪)。"})}),h.jsxs("div",{className:"flex flex-col gap-2 px-4 py-3 border-t border-bg-300/30 shrink-0",children:[S&&_.anchorFound&&!o?h.jsxs("div",{"data-testid":"rewind-needs-cc",className:"flex items-start gap-2 rounded-md border border-bg-300 bg-bg-100/60 px-3 py-2 text-[12px] text-text-300",children:[h.jsx(Uf,{className:"w-4 h-4 shrink-0 mt-0.5 text-warning"}),h.jsx("span",{children:'Claude Code 进程当前未运行。点击"确认回退"时会自动启动它再执行 — 可能需要等一两秒。'})]}):null,h.jsxs("div",{className:"flex items-center justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:()=>t(!1),className:"h-8 px-3 rounded-md text-[12px] text-text-300 hover:bg-text-100/5 cursor-pointer",children:"取消"}),h.jsx("button",{type:"button",disabled:!C,onClick:()=>void b(),"data-testid":"rewind-apply",className:ie("h-8 px-3 rounded-md text-[12px] font-medium transition-colors",C?"bg-accent text-white hover:bg-accent-hover cursor-pointer":"bg-bg-200 text-text-400 cursor-not-allowed"),children:m?"回退中…":"确认回退"})]})]})]})}function Ise(e){return e.replace(/^\/Users\/[^/]+/,"~")}function Nse({file:e}){const[t,n]=g.useState(!0);return h.jsxs("div",{"data-testid":"rewind-file-block","data-file":e.filePath,className:"rounded-md border border-bg-300 overflow-hidden bg-bg-0",children:[h.jsxs("button",{type:"button",onClick:()=>n(r=>!r),className:"w-full flex items-center gap-1.5 px-3 py-2 text-[12px] hover:bg-text-100/5 cursor-pointer",children:[t?h.jsx(Pn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}),h.jsx("span",{className:"font-mono text-text-200 truncate flex-1 text-left",title:e.filePath,children:Ise(e.filePath)}),h.jsxs("span",{className:"font-mono shrink-0 text-text-400",children:[h.jsxs("span",{className:"text-green-500",children:["+",e.insertions]})," ",h.jsxs("span",{className:"text-red-400",children:["-",e.deletions]})]})]}),t?h.jsx("div",{className:"border-t border-bg-300",children:e.hunks.map(r=>h.jsx(Tse,{hunk:r},`${r.oldStart}-${r.oldLines}-${r.newStart}-${r.newLines}`))}):null]})}function Tse({hunk:e}){const t=`@@ -${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines} @@`;return h.jsxs("div",{className:"text-[11px] font-mono leading-relaxed",children:[h.jsx("div",{className:"px-3 py-1 text-text-400 bg-bg-100/40 border-b border-bg-300",children:t}),e.lines.map((n,r)=>{const i=n.charAt(0),s=i==="+"?"bg-green-500/10 text-green-300":i==="-"?"bg-red-500/10 text-red-300":"text-text-300";return h.jsx("div",{className:ie("px-3 whitespace-pre",s),children:n.length>0?n:" "},r)})]})}function Pse({jobs:e}){return e.length===0?h.jsx("div",{"data-testid":"cron-job-list-empty",className:"px-4 py-3 text-sm text-text-500",children:"当前会话暂无活跃 cron 任务"}):h.jsx("ul",{"data-testid":"cron-job-list",className:"flex flex-col gap-2",children:e.map(t=>h.jsxs("li",{"data-testid":`cron-job-${t.id}`,className:"flex flex-col gap-1 rounded-md border border-border px-3 py-2",children:[h.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[h.jsx("span",{className:"font-mono text-text-300",children:t.id}),h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{className:"text-text-400",children:t.humanSchedule}),t.recurring?h.jsx("span",{"data-testid":`cron-job-${t.id}-recurring-badge`,className:"ml-auto rounded-md bg-accent-dim px-2 py-0.5 text-accent",children:"recurring"}):null]}),h.jsx("div",{className:"text-sm text-text-200 truncate",title:t.prompt,children:t.prompt})]},t.id))})}const Rse={idle:"还没启动","turn-running":"正在 run 中","turn-idle":"进程活着,等输入",exited:"进程已退出",crashed:"启动失败 / 异常退出"};function Mse({sessionStatus:e}){switch(e){case"idle":return"idle";case"running":return"turn-running";case"running-idle":return"turn-idle";case"observing":return"turn-running";case"stopped":return"exited";case"error":return"crashed"}}/**
|
|
575
575
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
576
576
|
* @license MIT
|
|
577
577
|
*
|
|
@@ -619,5 +619,5 @@ Minimum version required to store current data is: `+s+`.
|
|
|
619
619
|
|
|
620
620
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
621
621
|
|
|
622
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Vce="DialogDescriptionWarning",Kce=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ej(Vce).contentName}}.`;return g.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Gce=FA,Yce=WA,tj=qA,nj=VA,rj=GA,ij=XA,Xce=QA;const sj=Gce,Zce=Yce,oj=g.forwardRef(({className:e,...t},n)=>h.jsx(tj,{ref:n,className:ie("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",e),...t}));oj.displayName=tj.displayName;const Pb=g.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(Zce,{children:[h.jsx(oj,{}),h.jsxs(nj,{ref:r,className:ie("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2","gap-4 rounded-lg border border-border bg-elevated p-6 shadow-lg",e),...n,children:[t,h.jsxs(Xce,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-accent",children:[h.jsx(Qr,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Pb.displayName=nj.displayName;const aj=({className:e,...t})=>h.jsx("div",{className:ie("flex flex-col space-y-1.5 text-left",e),...t});aj.displayName="DialogHeader";const Rb=g.forwardRef(({className:e,...t},n)=>h.jsx(rj,{ref:n,className:ie("text-lg font-semibold leading-none text-text-100",e),...t}));Rb.displayName=rj.displayName;const lj=g.forwardRef(({className:e,...t},n)=>h.jsx(ij,{ref:n,className:ie("text-sm text-text-300",e),...t}));lj.displayName=ij.displayName;function Qce({persona:e,open:t,onClose:n,onDelete:r,embedded:i,onLoadPersonality:s,onSavePersonality:o,onLoadPersonalityLocal:a,onSavePersonalityLocal:l,hasPersonalityLocal:c=!1,onDirtyChange:u,initialPersonality:d,onShareCapability:f,readOnly:p=!1,larkBot:m}){const[v,w]=g.useState(!1),[x,_]=g.useState(!1),b=v||x,S=Je.useRef(u);g.useEffect(()=>{S.current=u}),g.useEffect(()=>{var k;(k=S.current)==null||k.call(S,b)},[b]);const C=()=>{b&&!window.confirm("修改未保存,确定关闭?")||n()};return t?h.jsxs(h.Fragment,{children:[!i&&h.jsx("div",{className:"absolute inset-0 z-30 bg-black/30",onClick:C,"aria-hidden":"true"}),h.jsxs("aside",{className:i?"flex h-full w-full flex-col bg-bg-0":"absolute right-0 top-0 z-40 flex h-full w-[420px] flex-col bg-bg-0 border-l border-border shadow-xl","data-testid":"persona-settings-drawer",children:[h.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx(LF,{className:"h-4 w-4 text-text-300"}),h.jsx("span",{className:"text-[13px] font-medium text-text-100 truncate",children:"Persona 设置"})]}),h.jsx("button",{type:"button",onClick:C,"aria-label":"关闭",className:"rounded-sm p-1.5 text-text-400 hover:bg-bg-200 hover:text-text-100",children:h.jsx(Qr,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-6 flex flex-col gap-4",children:[h.jsxs("header",{className:"flex items-start justify-between gap-3",children:[h.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h2",{className:"text-lg font-semibold text-text-100 truncate",children:e.label}),e.public?h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-bg-200 px-1.5 py-0.5 text-[10px] text-text-200",children:[h.jsx(eF,{className:"h-3 w-3"})," 公开"]}):h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-error-dim px-1.5 py-0.5 text-[10px] text-error",children:[h.jsx(Q7,{className:"h-3 w-3"})," 已关闭"]})]}),h.jsx("span",{className:"font-mono text-[11px] text-text-400 truncate","data-testid":"persona-id-subtitle",children:e.personaId})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[f?h.jsxs("button",{type:"button",onClick:f,"aria-label":"分享给他人",title:"分享给他人",className:"inline-flex items-center gap-1 rounded-sm px-2 py-1.5 text-xs text-text-200 hover:bg-bg-200 hover:text-text-100",children:[h.jsx(n_,{className:"h-3.5 w-3.5"}),"分享"]}):null,r?h.jsx("button",{type:"button",onClick:r,"aria-label":"删除 persona",className:"rounded-sm p-1.5 text-text-400 hover:bg-bg-200 hover:text-error",children:h.jsx(r_,{className:"h-4 w-4"})}):null]})]}),h.jsx("hr",{className:"border-border"}),m?h.jsxs(h.Fragment,{children:[h.jsx(tue,{...m}),h.jsx("hr",{className:"border-border"})]}):null,s?h.jsxs(h.Fragment,{children:[h.jsx(PE,{onLoad:s,...o&&!e.personalityManaged?{onSave:o}:{},onDirtyChange:w,initialPersonality:d,readOnly:p||!!e.personalityManaged,title:e.personalityManaged?"内置人格":"人格 (Personality)",hint:e.personalityManaged?p?"这个 persona 自带的人格,随 clawd 版本更新。":"这个 persona 自带的人格,随 clawd 版本更新——在这里改不会保留,要加自己的规则请写下面的「你的补充」。":void 0,testIdPrefix:"persona-personality"}),(e.personalityManaged||c)&&a?h.jsx(PE,{onLoad:a,...l?{onSave:l}:{},onDirtyChange:_,readOnly:p,title:p?"补充设定":"你的补充",hint:p?"这个 persona 的补充设定,由它的主人维护。与内置人格叠加生效。":"写入 <persona-dir>/.clawd/personality.local.md,不会被更新覆盖。与内置人格叠加生效,冲突时以你写的为准;对 owner 和访客会话都生效,要区分对象请在正文里写明。只对新启动的会话生效。",placeholder:"例:回答一律先给结论,再展开。",testIdPrefix:"persona-personality-local"}):null,h.jsx("hr",{className:"border-border"})]}):null,h.jsx(nue,{settings:e.sandboxSettings??null}),h.jsx("hr",{className:"border-border"}),h.jsx(rue,{skills:e.skills??[]}),h.jsx("hr",{className:"border-border"}),h.jsx(iue,{plugins:e.plugins??[]})]})]})]}):null}function TE({qrUrl:e,busy:t,onCancel:n,title:r="扫码关联飞书 Bot",hint:i="用手机飞书扫码,按页面提示创建应用。确认后自动完成关联。"}){const[s,o]=g.useState(null);return g.useEffect(()=>{let a=!1;return dd.toDataURL(e,{width:240,margin:1}).then(l=>{a||o(l)}).catch(()=>{a||o(null)}),()=>{a=!0}},[e]),h.jsx(sj,{open:!0,onOpenChange:a=>a||n==null?void 0:n(),children:h.jsxs(Pb,{className:"max-w-xs","data-testid":"lark-bot-qr-dialog",onInteractOutside:a=>a.preventDefault(),onEscapeKeyDown:a=>a.preventDefault(),children:[h.jsx(aj,{children:h.jsx(Rb,{children:r})}),h.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s?h.jsx("img",{src:s,alt:"飞书扫码创建应用二维码",className:"h-60 w-60 rounded bg-white p-2","data-testid":"lark-bot-qr-img"}):h.jsx("div",{className:"flex h-60 w-60 items-center justify-center text-[12px] text-text-400",children:"二维码生成中…"}),h.jsx("span",{className:"text-center text-[12px] text-text-300",children:i}),n?h.jsx("button",{type:"button",disabled:t,onClick:n,className:"rounded border border-border px-3 py-1.5 text-[12px] text-text-300 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-provision-cancel",children:"取消"}):null]})]})})}const Jce={expired:"二维码已过期,请重新扫码。",cancelled:"已取消。",access_denied:"你在飞书上取消了本次授权。",lark_protocol_error:"飞书返回了未预期的响应,请重试。",cloud_unreachable:"云端暂时不可达,请稍后重试。",internal_error:"关联失败。若飞书中已创建应用,可在开发者后台删除后重试,或改用手动绑定填入其凭证。"},eue=new Set(["expired","access_denied","lark_protocol_error","cloud_unreachable","internal_error"]);function tue({status:e,onProvision:t,onCancelProvision:n,onBindManual:r,onUnbind:i,onUpgrade:s,runtime:o="local"}){const[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(""),[p,m]=g.useState(""),[v,w]=g.useState(null),x=T=>{T&&(l(!0),u(null),T().catch(E=>u(E instanceof Error?E.message:String(E))).finally(()=>l(!1)))},_=()=>{w(null),x(t)},b=!a&&!!d&&!!p,S=()=>{!b||!r||x(()=>r({appId:d,appSecret:p}))},C=ed(S),k=h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(em,{className:"h-3.5 w-3.5 text-text-400","aria-hidden":!0}),h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"飞书 Bot"})]});return e?h.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":"lark-bot-section",children:[k,e.state==="unbound"||e.state==="provisioning"?h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"text-[11px] text-text-400",children:["关联一个飞书 bot 后,这个 persona 就是它:拉进群后群成员 @ 它提问、或直接私聊它,",o==="cloud"?"云 Persona 在云端处理消息,回复自动发回去。":"推理跑在你本机,回复自动发回去。"]}),t?h.jsx("button",{type:"button",disabled:a||e.state==="provisioning",onClick:_,className:"self-start rounded border border-border bg-bg-200 px-3 py-1.5 text-[12px] font-medium text-text-100 hover:bg-bg-300 disabled:opacity-50","data-testid":"lark-bot-provision",children:e.state==="provisioning"?"等待扫码…":"扫码关联飞书 Bot"}):null,e.state==="unbound"&&e.errorReason&&!v?h.jsxs("div",{className:"flex flex-col gap-1.5 rounded border border-error bg-error-dim px-2 py-1.5","data-testid":"lark-bot-provision-error",children:[h.jsx("span",{className:"text-[11px] text-error",children:Jce[e.errorReason]}),h.jsxs("div",{className:"flex gap-1.5",children:[eue.has(e.errorReason)&&t?h.jsx("button",{type:"button",disabled:a,onClick:_,className:"rounded border border-border px-2 py-1 text-[11px] text-text-100 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-provision-retry",children:"重新扫码"}):null,h.jsx("button",{type:"button",onClick:()=>w(e.errorReason??null),className:"rounded border border-border px-2 py-1 text-[11px] text-text-300 hover:bg-bg-200","data-testid":"lark-bot-provision-error-dismiss",children:"知道了"})]})]}):null,e.state==="provisioning"&&e.qrUrl?h.jsx(TE,{qrUrl:e.qrUrl,busy:a,onCancel:n?()=>x(n):void 0}):null,r&&e.state==="unbound"?h.jsxs("details",{"data-testid":"lark-bot-manual-details",children:[h.jsx("summary",{className:"cursor-pointer text-[11px] text-text-400 hover:text-text-300",children:"已有飞书应用?手动填入凭证"}),h.jsxs("div",{className:"mt-1.5 flex flex-col gap-1.5","data-testid":"lark-bot-manual-form",children:[h.jsx("span",{className:"text-[11px] text-text-400",children:"先在飞书开放平台(open.feishu.cn)创建企业自建应用并启用机器人能力,再填入凭证:"}),h.jsx("input",{value:d,onChange:T=>f(T.target.value),...C,placeholder:"App ID(cli_ 开头)",className:"rounded border border-border bg-bg-100 px-2 py-1 text-[12px] text-text-200","data-testid":"lark-bot-manual-appid"}),h.jsx("input",{value:p,onChange:T=>m(T.target.value),...C,type:"password",placeholder:"App Secret",className:"rounded border border-border bg-bg-100 px-2 py-1 text-[12px] text-text-200","data-testid":"lark-bot-manual-secret"}),h.jsx("button",{type:"button",disabled:!b,onClick:S,className:"self-start rounded border border-border px-3 py-1.5 text-[12px] text-text-100 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-manual-submit",children:a?"绑定中…":"绑定"})]})]}):null]}):null,e.state==="bound"||e.state==="broken"?h.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.state==="bound"&&e.needsUpgrade?h.jsxs("div",{className:"flex flex-col gap-1.5 rounded border border-warning/30 bg-warning-dim px-2 py-1.5","data-testid":"lark-bot-upgrade-notice",children:[h.jsx("span",{className:"text-[11px] text-warning",children:"这个 bot 的权限配置有更新,扫码重新授权后生效。在此之前,新增能力对它不起作用。"}),s?h.jsx("button",{type:"button",disabled:a,onClick:()=>x(s),className:"self-start rounded border border-warning/30 bg-warning/10 px-2 py-1 text-[11px] text-warning hover:bg-warning/20 disabled:opacity-50","data-testid":"lark-bot-upgrade",children:"更新授权"}):null]}):null,e.state==="bound"&&e.upgradeQrUrl?h.jsx(TE,{qrUrl:e.upgradeQrUrl,busy:a,onCancel:n?()=>x(n):void 0,title:"扫码更新授权",hint:"用手机飞书扫码,确认页会列出将要添加的权限。期间 bot 照常服务,不会中断。"}):null,e.state==="broken"?h.jsxs("div",{className:"rounded border border-error bg-error-dim px-2 py-1.5 text-[11px] text-error","data-testid":"lark-bot-broken",children:["Bot 凭证失效:",e.brokenReason??"未知原因","。请解绑后重新填入有效凭证绑定。"]}):null,h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-text-200",children:[h.jsx("span",{className:"font-medium text-text-100",children:e.botName??"未命名 bot"}),e.appId?h.jsx("span",{className:"text-[11px] text-text-400",children:e.appId}):null]}),h.jsx("span",{className:"text-[11px] text-text-400",children:"把 bot 拉进任意飞书群,群成员 @ 它即可提问。"}),e.groups.length>0?h.jsx("ul",{className:"flex flex-col gap-0.5","data-testid":"lark-bot-groups",children:e.groups.map(T=>h.jsxs("li",{className:"text-[11px] text-text-300 truncate",children:["· ",T.chatName??T.chatId]},T.chatId))}):h.jsx("span",{className:"text-[11px] text-text-400","data-testid":"lark-bot-groups-empty",children:"还没有服务中的群。"}),i?h.jsx("button",{type:"button",disabled:a,onClick:()=>x(i),className:"self-start rounded border border-border px-3 py-1.5 text-[12px] text-error hover:bg-error-dim disabled:opacity-50","data-testid":"lark-bot-unbind",children:"解绑"}):null]}):null,c?h.jsx("div",{className:"rounded border border-error bg-error-dim px-2 py-1.5 text-[11px] text-error","data-testid":"lark-bot-error",children:c}):null]}):h.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":"lark-bot-section",children:[k,h.jsx("span",{className:"text-[11px] text-text-400",children:"状态加载中…"})]})}function nue({settings:e}){var t,n,r,i,s,o,a,l,c,u,d,f,p;return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-sandbox-setting-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Sandbox Setting"}),h.jsx("span",{className:"text-[11px] text-text-400",children:"约束此 persona 的沙箱权限(只读,需通过文件修改)。"})]}),e==null?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-sandbox-setting-empty",children:"暂无 sandbox 配置"}):h.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-border bg-bg-100 px-3 py-2",children:[h.jsx(xh,{label:"权限默认模式",value:((t=e.permissions)==null?void 0:t.defaultMode)??"—"}),h.jsx(xh,{label:"沙箱启用",value:E0((n=e.sandbox)==null?void 0:n.enabled)}),h.jsx(xh,{label:"沙箱内自动放行 Bash",value:E0((r=e.sandbox)==null?void 0:r.autoAllowBashIfSandboxed)}),h.jsx(xh,{label:"允许非沙箱命令",value:E0((i=e.sandbox)==null?void 0:i.allowUnsandboxedCommands)}),h.jsxs("div",{className:"mt-1 flex flex-col gap-1.5 border-t border-border pt-1.5",children:[h.jsx(xc,{label:"沙箱外命令",paths:(s=e.sandbox)==null?void 0:s.excludedCommands}),h.jsx(xc,{label:"允许读取",paths:(a=(o=e.sandbox)==null?void 0:o.filesystem)==null?void 0:a.allowRead}),h.jsx(xc,{label:"拒绝读取",paths:(c=(l=e.sandbox)==null?void 0:l.filesystem)==null?void 0:c.denyRead}),h.jsx(xc,{label:"允许写入",paths:(d=(u=e.sandbox)==null?void 0:u.filesystem)==null?void 0:d.allowWrite}),h.jsx(xc,{label:"拒绝写入",paths:(p=(f=e.sandbox)==null?void 0:f.filesystem)==null?void 0:p.denyWrite})]})]})]})}function E0(e){return e===!0?"是":e===!1?"否":"—"}function xh({label:e,value:t}){return h.jsxs("div",{className:"flex items-center justify-between gap-3 text-[12px]",children:[h.jsx("span",{className:"text-text-300",children:e}),h.jsx("span",{className:"font-mono text-text-100",children:t})]})}function xc({label:e,paths:t}){const n=!t||t.length===0;return h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[11px] text-text-300",children:e}),n?h.jsx("span",{className:"text-[11px] text-text-400",children:"—"}):h.jsx("div",{className:"flex flex-wrap gap-1",children:t.map((r,i)=>h.jsx("span",{className:"rounded-sm border border-border bg-bg-0 px-1.5 py-0.5 font-mono text-[11px] text-text-200",children:r},`${e}-${i}-${r}`))})]})}function rue({skills:e}){return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-skills-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Persona Skills"}),h.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-text-300",children:e.length})]}),h.jsxs("span",{className:"text-[11px] text-text-400",children:["此 persona 私有 skills(来自"," ",h.jsx("code",{className:"font-mono",children:"<persona-dir>/.claude/skills/"}),")。"]})]}),e.length===0?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-skills-empty",children:"暂无 skills"}):h.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border bg-bg-100",children:e.map(t=>h.jsxs("li",{className:"flex flex-col gap-0.5 px-3 py-2","data-testid":"persona-skill-row",children:[h.jsx("span",{className:"font-mono text-[13px] text-text-100",children:t.name}),t.description?h.jsx("span",{className:"text-[12px] text-text-300",children:t.description}):h.jsx("span",{className:"text-[11px] text-text-400 italic",children:"无描述"})]},t.name))})]})}function iue({plugins:e}){return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-plugins-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Enabled Plugins"}),h.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-text-300",children:e.length})]}),h.jsxs("span",{className:"text-[11px] text-text-400",children:["此 persona 已启用的插件(来自"," ",h.jsx("code",{className:"font-mono",children:"<persona-dir>/.claude/settings.json"})," ","的 ",h.jsx("code",{className:"font-mono",children:"enabledPlugins"}),")。"]})]}),e.length===0?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-plugins-empty",children:"暂无启用插件"}):h.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border bg-bg-100",children:e.map(t=>h.jsx("li",{className:"flex flex-col gap-0.5 px-3 py-2","data-testid":"persona-plugin-row",children:h.jsx("span",{className:"font-mono text-[13px] text-text-100",children:t.id})},t.id))})]})}function PE({onLoad:e,onSave:t,onDirtyChange:n,initialPersonality:r,readOnly:i=!1,title:s,hint:o,placeholder:a,testIdPrefix:l}){const c=r!==void 0,[u,d]=g.useState(c),[f,p]=g.useState(c?r:""),[m,v]=g.useState(c?r:""),[w,x]=g.useState(null),[_,b]=g.useState(!1),[S,C]=g.useState(null),k=Je.useRef(e),T=Je.useRef(t),E=Je.useRef(n);Je.useEffect(()=>{k.current=e,T.current=t,E.current=n});const D=Je.useCallback(()=>{d(!1),x(null),k.current().then(A=>{p(A),v(A),d(!0)}).catch(A=>{x(A instanceof Error?A.message:String(A))})},[]);Je.useEffect(()=>{c||D()},[c,D]);const N=!i&&u&&m!==f;Je.useEffect(()=>{i||E.current(N)},[N,i]);const L=()=>{T.current&&(b(!0),C(null),T.current(m).then(()=>{p(m),b(!1)}).catch(A=>{C(A instanceof Error?A.message:String(A)),b(!1)}))},R=()=>{v(f),C(null)},M=ed(()=>{!N||_||L()},()=>{!N||_||R()});return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":`${l}-section`,children:[h.jsx("span",{className:"text-[12px] font-medium text-text-200",children:s}),w?h.jsxs("div",{"data-testid":`${l}-load-error`,className:"rounded-md border border-error bg-error-dim px-3 py-2 text-[12px] text-error flex items-center justify-between gap-2",children:[h.jsxs("span",{children:["加载失败:",w]}),h.jsx("button",{type:"button",onClick:D,className:"rounded-sm border border-error px-2 py-0.5 text-[11px] hover:bg-error/10",children:"重试"})]}):null,S?h.jsxs("div",{"data-testid":`${l}-save-error`,className:"rounded-md border border-error bg-error-dim px-3 py-2 text-[12px] text-error",children:["保存失败:",S]}):null,h.jsx("textarea",{"data-testid":`${l}-textarea`,value:m,onChange:A=>v(A.target.value),...M,readOnly:i,disabled:!i&&(!u||_),placeholder:u?a??"":"加载中…",rows:8,className:"min-h-[8rem] max-h-[18rem] resize-y rounded-md border border-border bg-bg-100 px-2 py-1.5 font-mono text-[11px] text-text-100 disabled:opacity-60"}),o?h.jsx("p",{className:"text-[10px] text-text-400",children:o}):i?null:h.jsx("p",{className:"text-[10px] text-text-400",children:"写入人格文件。修改只对新启动的会话生效。"}),u&&N?h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:R,disabled:_,className:"rounded-sm border border-border px-2 py-1 text-[12px] text-text-200 hover:bg-bg-200 disabled:opacity-60",children:"放弃"}),h.jsx("button",{type:"button",onClick:L,disabled:_,"data-testid":`${l}-save-btn`,className:"rounded-sm bg-accent-dim px-2 py-1 text-[12px] text-text-100 hover:opacity-90 disabled:opacity-60",children:_?"保存中…":"保存"})]}):null]})}const sue={state:"unbound",groups:[]};function oue(e,t,n="local"){const[r,i]=g.useState(null),s=d=>`${n==="cloud"?"cloud:":""}larkBot:${d}`;g.useEffect(()=>{if(!e)return;let d=!1,f=0,p=!1;i(null);const m=async()=>{const _=++f;p=!0;try{const b=await e.request(s("status"),{personaId:t});if(d||_!==f)return;i(S=>n==="cloud"&&(S!=null&&S.upgradeQrUrl)&&b.state==="bound"&&b.needsUpgrade!==!1?{...b,upgradeQrUrl:S.upgradeQrUrl}:b.state==="unbound"&&!b.errorReason&&(S==null?void 0:S.state)==="unbound"&&S.errorReason?{...b,errorReason:S.errorReason}:b)}catch{!d&&_===f&&i(b=>b??sue)}finally{_===f&&(p=!1)}};m();const v=e.on("larkBot:state",_=>{const b=_;if(b.personaId!==t)return;const{personaId:S,...C}=b;++f,p=!1,i(C)}),w=e.on("daemon:connected",()=>{m()}),x=n==="cloud"?setInterval(()=>{p||m()},5e3):null;return()=>{d=!0,x&&clearInterval(x),v(),w()}},[e,t,n]);const o=g.useCallback(async()=>{e&&await e.request(s("provision"),{personaId:t})},[e,t,n]),a=g.useCallback(async()=>{e&&await e.request(s("provisionCancel"),{personaId:t})},[e,t,n]),l=g.useCallback(async d=>{e&&await e.request(s("bindManual"),{personaId:t,...d})},[e,t,n]),c=g.useCallback(async()=>{e&&await e.request(s("upgrade"),{personaId:t})},[e,t,n]),u=g.useCallback(async()=>{e&&await e.request(s("unbind"),{personaId:t})},[e,t,n]);return{status:r,provision:o,cancelProvision:a,bindManual:l,unbind:u,upgrade:c}}function aue(e,t="owner"){var T;const{persona:n}=r4(e),r=qz(e),i=Vz(),s=Kz(),{httpBaseUrl:o}=Qp(),a=Ni(),l=oue(t==="guest"?null:a,e),{capabilities:c}=Rm((n==null?void 0:n.tool)??"claude"),u=g.useMemo(()=>!(n!=null&&n.public)||!o||/^https?:\/\/(127\.0\.0\.1|localhost|0\.0\.0\.0|\[?::1\]?)([:/]|$)/i.test(o)?null:`${o}/s/${e}`,[n==null?void 0:n.public,o,e]),d=g.useCallback((E,D)=>{i(e,D).catch(N=>{$e("persona",`${E} failed`,N)})},[i,e]),f=g.useCallback(E=>d("togglePublic",{public:E}),[d]),p=g.useCallback(async E=>{await i(e,{codexSandbox:{network:E}}),await r.refresh()},[i,e,r]),m=g.useCallback(E=>d("changeTool",{tool:E}),[d]),v=g.useCallback(E=>d("changeModel",{model:E}),[d]),w=g.useCallback(E=>d("changeEffort",{effort:E}),[d]),x=g.useCallback(E=>d("toggleFastMode",{serviceTier:E?$f.fast:$f.standard}),[d]),_=g.useCallback(()=>!n||!confirm(`删除 persona "${n.label}"?`)?!1:(s(e).catch(E=>{$e("persona","delete failed",E)}),!0),[n,s,e]),b=g.useCallback(async()=>r.loaded?r.personality:(await r.refresh()).personality,[r]),S=g.useCallback(async E=>{await i(e,{personality:E}),await r.refresh()},[i,e,r]),C=g.useCallback(async()=>r.loaded?r.personalityLocal:(await r.refresh()).personalityLocal,[r]),k=g.useCallback(async E=>{await i(e,{personalityLocal:E}),await r.refresh()},[i,e,r]);return{persona:n,detail:r,configSchema:(c==null?void 0:c.configSchema)??[],larkBot:l,guestShareUrl:u,changeTool:m,changeModel:v,changeEffort:w,toggleFastMode:x,togglePublic:f,guestNetwork:((T=r.codexSandbox)==null?void 0:T.network)??!1,toggleGuestNetwork:p,remove:_,loadPersonality:b,savePersonality:S,loadPersonalityLocal:C,savePersonalityLocal:k}}function lue({personaId:e,open:t,onClose:n,api:r,embedded:i,onDirtyChange:s,onShareCapability:o,viewerRole:a="owner"}){const l=aue(e,a),{persona:c,detail:u}=l,d=g.useCallback(()=>{l.remove()&&n()},[l,n]);if(!c)return null;const f=a==="guest";return h.jsx(Qce,{embedded:i,persona:{...c,skills:u.skills,plugins:u.plugins,sandboxSettings:u.sandboxSettings,personalityManaged:u.personalityManaged},open:t,onClose:n,onLoadPersonality:l.loadPersonality,onLoadPersonalityLocal:l.loadPersonalityLocal,hasPersonalityLocal:u.personalityLocal!=="",onDirtyChange:s,readOnly:f,...f?{}:{onTogglePublic:l.togglePublic,guestShareUrl:l.guestShareUrl,onChangeTool:l.changeTool,onChangeModel:l.changeModel,onChangeEffort:l.changeEffort,configSchema:l.configSchema,onDelete:d,onSavePersonality:l.savePersonality,onSavePersonalityLocal:l.savePersonalityLocal,larkBot:{status:l.larkBot.status,onProvision:l.larkBot.provision,onCancelProvision:l.larkBot.cancelProvision,onBindManual:l.larkBot.bindManual,onUnbind:l.larkBot.unbind,onUpgrade:l.larkBot.upgrade},...o?{onShareCapability:o}:{}}})}const cue={resolve:()=>{}},uue=g.createContext(cue);function due(){return g.useContext(uue)}const hue={...Qs,h1:({node:e,...t})=>h.jsx("h1",{...t,className:"mt-4 mb-3 text-[18px] font-semibold leading-tight text-text-100"}),h2:({node:e,...t})=>h.jsx("h2",{...t,className:"mt-4 mb-2 text-[16px] font-semibold leading-tight text-text-100"}),h3:({node:e,...t})=>h.jsx("h3",{...t,className:"mt-3 mb-2 text-[14px] font-semibold leading-tight text-text-100"}),h4:({node:e,...t})=>h.jsx("h4",{...t,className:"mt-3 mb-1 text-[13px] font-semibold text-text-100"}),h5:({node:e,...t})=>h.jsx("h5",{...t,className:"mt-2 mb-1 text-[12px] font-semibold text-text-100"}),h6:({node:e,...t})=>h.jsx("h6",{...t,className:"mt-2 mb-1 text-[12px] font-semibold text-text-300"}),p:({node:e,...t})=>h.jsx("p",{...t,className:"my-2 leading-relaxed"}),ul:({node:e,...t})=>h.jsx("ul",{...t,className:"my-2 list-disc space-y-1 pl-5"}),ol:({node:e,...t})=>h.jsx("ol",{...t,className:"my-2 list-decimal space-y-1 pl-5"}),li:({node:e,...t})=>h.jsx("li",{...t,className:"leading-relaxed"}),blockquote:({node:e,...t})=>h.jsx("blockquote",{...t,className:"my-2 border-l-2 border-border pl-3 italic text-text-300"}),code:({node:e,className:t,children:n,...r})=>t?h.jsx("code",{...r,className:`${t} font-mono text-[12px]`,children:n}):h.jsx("code",{...r,className:"rounded bg-bg-50 px-1 py-0.5 font-mono text-[12px] text-text-100",children:n}),pre:({node:e,...t})=>h.jsx("pre",{...t,className:"my-2 overflow-auto rounded border border-border bg-bg-0 p-3 text-[12px] font-mono text-text-100"}),hr:({node:e,...t})=>h.jsx("hr",{...t,className:"my-3 border-border"}),table:({node:e,...t})=>h.jsx("table",{...t,className:"my-2 w-full border-collapse text-[12px]"}),thead:({node:e,...t})=>h.jsx("thead",{...t,className:"bg-bg-50"}),th:({node:e,...t})=>h.jsx("th",{...t,className:"border border-border px-2 py-1 text-left font-semibold"}),td:({node:e,...t})=>h.jsx("td",{...t,className:"border border-border px-2 py-1"}),strong:({node:e,...t})=>h.jsx("strong",{...t,className:"font-semibold text-text-100"}),em:({node:e,...t})=>h.jsx("em",{...t,className:"italic"})};function fue(e){const t=e.split("/");return t[t.length-1]||e}function cj({relPath:e,loadMarkdown:t,headerRight:n,showTitleBar:r=!1}){const[i,s]=g.useState(null),[o,a]=g.useState(null),[l,c]=g.useState(!1);return g.useEffect(()=>{if(!e)return;let u=!1;return c(!0),a(null),s(null),(async()=>{try{const d=await t(e);if(u)return;s(d)}catch(d){if(u)return;a(d.message||String(d))}finally{u||c(!1)}})(),()=>{u=!0}},[e,t]),h.jsxs("div",{className:"flex flex-col h-full",children:[r&&e?h.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[h.jsx("div",{"data-testid":"md-preview-title",className:"truncate text-[13px] font-medium text-text-100",title:e,children:fue(e)}),h.jsx("div",{className:"flex items-center gap-1",children:n})]}):null,h.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 text-[13px] text-text-100",children:l?h.jsx("div",{"data-testid":"md-preview-loading",className:"text-text-400",children:"Loading…"}):o?h.jsx("div",{"data-testid":"md-preview-error",className:"text-destructive whitespace-pre-wrap",children:o}):i!==null?h.jsx("div",{"data-testid":"md-preview-content",className:"max-w-none",children:h.jsx(yl,{remarkPlugins:[_l],components:hue,children:i})}):null})]})}function pue({open:e,onOpenChange:t,relPath:n,loadMarkdown:r,onShare:i}){return e?h.jsx("div",{"data-testid":"md-preview-drawer",className:`${db} z-50 flex w-1/2 max-w-[900px] flex-col border-l border-border bg-elevated shadow-2xl`,children:h.jsx(cj,{relPath:n,loadMarkdown:r,showTitleBar:!0,headerRight:h.jsxs(h.Fragment,{children:[i?h.jsx("button",{type:"button","data-testid":"md-preview-share","aria-label":"Share rendered preview link",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded text-text-400 hover:bg-bg-50 hover:text-text-200",children:h.jsx(lF,{className:"h-4 w-4"})}):null,h.jsx("button",{type:"button","aria-label":"Close preview",onClick:()=>t(!1),className:"inline-flex h-6 w-6 items-center justify-center rounded text-text-400 hover:bg-bg-50 hover:text-text-200",children:h.jsx(Qr,{className:"h-4 w-4"})})]})})}):null}const RE=4;function mue({children:e,onHeightChange:t}){const n=g.useRef(null),[r,i]=g.useState(0);return g.useEffect(()=>{const s=n.current;if(!s)return;const o=()=>i(s.offsetHeight>0?s.offsetHeight+RE*2:0);if(o(),typeof ResizeObserver>"u")return;const a=new ResizeObserver(o);return a.observe(s),()=>a.disconnect()},[]),g.useEffect(()=>{t==null||t(r)},[r,t]),h.jsx("div",{"data-testid":"chat-floating-dock","data-height":r,className:"relative z-20 h-0 shrink-0",children:h.jsx("div",{ref:n,className:"absolute left-4 right-4 flex flex-col items-end gap-1",style:{bottom:RE},children:e})})}function gue(e,t,n,r,i,s){const o=ym(),[a,l]=g.useState(null),[c,u]=g.useState(i??null),[d,f]=g.useState(!1),[p,m]=g.useState(!1),[v,w]=g.useState(null),x=g.useRef({api:e,sessionId:t,enabled:n,epoch:0,read:null,again:!1,mutating:!1}),_=g.useRef({api:e,sessionId:t,enabled:n});_.current={api:e,sessionId:t,enabled:n};const b=g.useRef(t),S=g.useRef(async()=>{}),C=E=>{if(E.workspace!==void 0&&l(E.workspace),E.binding!==void 0)u(E.binding);else if(E.workspace){const{workspaceId:D,repoId:N,owner:L,name:R,sourceBranch:M,defaultBranch:A}=E.workspace;u({workspaceId:D,repoId:N,owner:L,name:R,sourceBranch:M,defaultBranch:A})}},k=g.useCallback(async()=>{const E=x.current;if(!n||E.sessionId!==t||E.api!==e)return;if(E.mutating){E.again=!0;return}if(E.read)return E.again=!0,E.read;const D=E.epoch;f(!0);const N=(async()=>{try{const L=await e.cloudWorkspace({sessionId:t,action:"status"});x.current===E&&E.epoch===D&&_.current.sessionId===t&&(C(L),w(null))}catch(L){x.current===E&&E.epoch===D&&w(L.message)}finally{x.current===E&&(E.read=null,f(!1),E.again&&!E.mutating&&(E.again=!1,S.current()))}})();return E.read=N,N},[e,t,n]);S.current=k;const T=g.useCallback(async(E,D)=>{const N=x.current;if(!n||N.sessionId!==t)throw new Error("Cloud workspace unavailable");const L=E.action==="bind",R=["repositories","branches"].includes(E.action);if(L&&N.mutating)throw new Error("工作区操作正在进行");L&&(N.mutating=!0,N.epoch++,N.again=!1,m(!0),w(null));try{const M=await(D?e.cloudWorkspace({...E,sessionId:t},{requestId:D}):e.cloudWorkspace({...E,sessionId:t}));return x.current===N&&_.current.sessionId===t&&(C(M),R||w(null)),M}catch(M){throw x.current===N&&!R&&w(M.message),M}finally{L&&x.current===N&&(N.mutating=!1,m(!1),(E.action==="bind"||N.again)&&(N.again=!1,S.current()))}},[e,t,n]);return g.useEffect(()=>{const E={api:e,sessionId:t,enabled:n,epoch:0,read:null,again:!1,mutating:!1};return x.current=E,b.current!==t&&(b.current=t,l(null),u(i??null)),w(null),m(!1),f(!1),n&&S.current(),()=>{E.epoch++,x.current===E&&(x.current={...E,enabled:!1,again:!1})}},[e,t,n]),g.useEffect(()=>{if(!n||!r)return;const E=r.on("session:event",N=>{var R;const L=N;L.sessionId===t&&((R=L.event)==null?void 0:R.kind)==="session_init"&&S.current()}),D=r.on("daemon:connected",()=>{S.current()});return()=>{E(),D()}},[r,t,n]),g.useEffect(()=>{if(!(!r||!n))return r.on("cloud:workspace:timing",E=>{const D=E;if(D.sessionId===t)try{o==null||o.push({level:"info",msg:"cloud.workspace.transport."+D.phase,sessionId:t,meta:D})}catch{}})},[r,n,o,t]),{sessionId:t,workspace:a,binding:c,branchIntent:s,loading:d,busy:p,error:v,refresh:k,run:T}}function vue(e,t,n=()=>performance.now(),r){const i="workspace-"+crypto.randomUUID(),s=n(),o=r!==void 0&&Number.isFinite(r)&&r>=0&&r<=s?r:s,a=Math.round(s-o);let l,c,u="ok",d=!1;const f=(m,v={})=>{try{t("cloud.workspace.ui."+m,{...e,hasSearch:e.searchLength>0,traceId:i,inputDelayMs:a,...v})}catch{}},p=m=>{if(d)return;d=!0;const v=n();f("finished",{outcome:m,durationMs:Math.round(v-o),waitMs:l===void 0?void 0:Math.round(l-o),requestMs:l===void 0||c===void 0?void 0:Math.round(c-l),commitMs:c===void 0?void 0:Math.round(v-c)})};return f("started"),{requestId:i,get done(){return d},request(){l=n(),f("requested",{waitMs:Math.round(l-o)})},response(m,v,w){c=n(),u=m,f("response",{outcome:u,ignored:v,count:w,requestMs:l===void 0?void 0:Math.round(c-l)})},commit(){c!==void 0&&p(u)},finish:p}}var Om="Popover",[uj]=ro(Om,[Hl]),fd=Hl(),[xue,ao]=uj(Om),dj=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=e,a=fd(t),l=g.useRef(null),[c,u]=g.useState(!1),[d,f]=$l({prop:r,defaultProp:i??!1,onChange:s,caller:Om});return h.jsx(lm,{...a,children:h.jsx(xue,{scope:t,contentId:bi(),triggerRef:l,open:d,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:o,children:n})})};dj.displayName=Om;var hj="PopoverAnchor",yue=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ao(hj,n),s=fd(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return g.useEffect(()=>(o(),()=>a()),[o,a]),h.jsx(cm,{...s,...r,ref:t})});yue.displayName=hj;var fj="PopoverTrigger",pj=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ao(fj,n),s=fd(n),o=Ot(t,i.triggerRef),a=h.jsx(wt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":yj(i.open),...r,ref:o,onClick:Ne(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:h.jsx(cm,{asChild:!0,...s,children:a})});pj.displayName=fj;var Mb="PopoverPortal",[_ue,bue]=uj(Mb,{forceMount:void 0}),mj=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=ao(Mb,t);return h.jsx(_ue,{scope:t,forceMount:n,children:h.jsx(Jr,{present:n||s.open,children:h.jsx(um,{asChild:!0,container:i,children:r})})})};mj.displayName=Mb;var Il="PopoverContent",gj=g.forwardRef((e,t)=>{const n=bue(Il,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=ao(Il,e.__scopePopover);return h.jsx(Jr,{present:r||s.open,children:s.modal?h.jsx(Sue,{...i,ref:t}):h.jsx(kue,{...i,ref:t})})});gj.displayName=Il;var wue=pl("PopoverContent.RemoveScroll"),Sue=g.forwardRef((e,t)=>{const n=ao(Il,e.__scopePopover),r=g.useRef(null),i=Ot(t,r),s=g.useRef(!1);return g.useEffect(()=>{const o=r.current;if(o)return y_(o)},[]),h.jsx(hm,{as:wue,allowPinchZoom:!0,children:h.jsx(vj,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ne(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ne(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ne(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),kue=g.forwardRef((e,t)=>{const n=ao(Il,e.__scopePopover),r=g.useRef(!1),i=g.useRef(!1);return h.jsx(vj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),vj=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,f=ao(Il,n),p=fd(n);return l_(),h.jsx(rm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(Gu,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:h.jsx(v_,{"data-state":yj(f.open),role:"dialog",id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),xj="PopoverClose",Cue=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ao(xj,n);return h.jsx(wt.button,{type:"button",...r,ref:t,onClick:Ne(e.onClick,()=>i.onOpenChange(!1))})});Cue.displayName=xj;var Eue="PopoverArrow",Iue=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=fd(n);return h.jsx(x_,{...i,...r,ref:t})});Iue.displayName=Eue;function yj(e){return e?"open":"closed"}var Nue=dj,Tue=pj,Pue=mj,_j=gj;const bj=Nue,wj=Tue,Ab=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>h.jsx(Pue,{children:h.jsx(_j,{ref:i,align:t,sideOffset:n,className:ie("z-50 w-72 rounded-md border border-border bg-elevated p-4 text-text-100 shadow-md outline-none",e),...r})}));Ab.displayName=_j.displayName;const Wi="flex w-full min-w-0 items-center gap-2.5 rounded-md px-1.5 py-1.5 text-left text-[13px] hover:bg-text-100/5 disabled:opacity-40";function ME({title:e,children:t,trailing:n}){const[r,i]=g.useState(!0);return h.jsxs("section",{className:"rounded-[22px] border border-border bg-bg-100 p-3.5 shadow-[0_2px_12px_rgba(0,0,0,0.06)]",children:[h.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[h.jsxs("button",{onClick:()=>i(!r),className:"flex items-center gap-1.5 py-0.5 text-[13px] text-text-400","aria-expanded":r,children:[e,h.jsx(Pn,{className:`h-3 w-3 text-text-400 ${r?"":"-rotate-90"}`})]}),n]}),r&&t]})}const Rue=6e4,Sj=300;function kj({message:e,onRetry:t}){return h.jsxs("div",{role:"alert",className:"m-2 rounded-md bg-error/5 p-2 text-[11px] leading-relaxed text-error",children:[e,h.jsx("button",{className:"ml-2 underline",onClick:t,children:"重试"})]})}function Cj(e,t,n){const r=ym(),i=g.useRef(null),s=g.useRef(void 0),o=c=>{s.current=c.timeStamp},a=(c,u,d)=>{var p;(p=i.current)==null||p.finish("superseded");const f=vue({sessionId:e.sessionId,action:t,searchLength:c,page:u},(m,v)=>{r==null||r.push({level:"info",msg:m,sessionId:e.sessionId,meta:v})},void 0,d);return i.current=f,f};return g.useLayoutEffect(()=>{var c;n||(c=i.current)==null||c.commit()}),g.useEffect(()=>()=>{var c;(c=i.current)==null||c.finish("unmounted")},[]),{current:i,begin:a,open:(c,u)=>{const d=s.current;s.current=void 0,a(c,u,d)},captureOpen:o}}function Ej({controller:e,compact:t=!1}){const{binding:n,run:r,busy:i}=e,[s,o]=g.useState(!1),[a,l]=g.useState(""),[c,u]=g.useState(""),[d,f]=g.useState([]),[p,m]=g.useState(1),[v,w]=g.useState(!1),[x,_]=g.useState(!1),[b,S]=g.useState(null),[C,k]=g.useState(0),T=Cj(e,"repositories",x),E=g.useRef(!1),D=g.useRef(new Map);return g.useEffect(()=>{if(a===c)return;const N=setTimeout(()=>{u(a),m(1)},Sj);return()=>clearTimeout(N)},[a,c]),g.useEffect(()=>{if(!s||n)return;const N=T.current.current&&!T.current.current.done?T.current.current:T.begin(c.length,p),L=c+"|"+p,R=z=>{w(z.hasMore),f(F=>p===1?z.repos:[...F,...z.repos])},M=D.current.get(L);S(null);const A=E.current;if(E.current=!1,M&&Date.now()-M.at<Rue&&!A){N.response("cache",!1,M.repos.length),R({...M,repos:[...M.repos]}),_(!1);return}let j=!1;return _(!0),N.request(),r({action:"repositories",page:p,search:c},N.requestId).then(z=>{var $;if(N.response("ok",j,(($=z.repositories)==null?void 0:$.length)??0),j)return;const F={at:Date.now(),repos:z.repositories??[],hasMore:z.hasMore??!1};D.current.set(L,F),R(F)}).catch(z=>{N.response("error",j),j||S(z.message)}).finally(()=>{j||_(!1)}),()=>{j=!0,N.finish("cancelled")}},[s,n,c,p,C,r]),n?h.jsxs("button",{className:t?"flex min-w-0 items-center gap-1.5 text-[11px] text-text-300 hover:text-text-100":Wi,title:n.owner+"/"+n.name,"aria-label":"在 GitHub 查看仓库",onClick:()=>window.open(`https://github.com/${n.owner}/${n.name}`,"_blank","noopener"),children:[h.jsx(Eg,{className:"h-4 w-4 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:n.name}),!t&&h.jsx(Su,{className:"ml-auto h-3 w-3 text-text-400"})]}):h.jsxs(bj,{open:s,onOpenChange:N=>{var L;N?T.open(c.length,p):(L=T.current.current)==null||L.finish("closed"),o(N),N||(m(1),l(""),u(""))},children:[h.jsx(wj,{asChild:!0,children:h.jsxs("button",{disabled:i,onClickCapture:T.captureOpen,className:t?"flex items-center gap-1.5 text-[11px] text-text-300":Wi,"aria-label":"添加或选择仓库",children:[h.jsx(Eg,{className:"h-4 w-4 text-text-400"}),h.jsx("span",{className:"flex-1",children:"添加 repo"}),!t&&h.jsx(h4,{className:"h-3.5 w-3.5 text-text-400"})]})}),h.jsxs(Ab,{align:"end",className:"w-[330px] p-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[h.jsx(Hf,{className:"h-3.5 w-3.5 text-text-400"}),h.jsx("input",{autoFocus:!0,"aria-label":"搜索仓库",placeholder:"搜索 GitHub 仓库…",value:a,onChange:N=>{N.target.value!==a&&T.begin(N.target.value.length,1,N.timeStamp),l(N.target.value)},className:"w-full bg-transparent text-[12px] outline-none"})]}),h.jsxs("div",{className:"max-h-[340px] overflow-y-auto py-1",children:[d.map(N=>h.jsxs("button",{disabled:i,className:Wi,onClick:()=>{S(null),r({action:"bind",repoId:N.repoId,branch:N.defaultBranch}).then(()=>o(!1)).catch(L=>S(L.message))},children:[h.jsx(Eg,{className:"h-4 w-4 shrink-0 text-text-400"}),h.jsxs("span",{className:"truncate text-[12px]",children:[N.owner,"/",N.name]})]},N.repoId)),b&&h.jsx(kj,{message:b,onRetry:()=>{T.begin(c.length,p),E.current=!0,k(N=>N+1)}}),!x&&!b&&!d.length&&h.jsx("p",{className:"p-3 text-[12px] text-text-400",children:"没有找到仓库"}),x&&h.jsxs("div",{className:"flex items-center gap-2 p-3 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"h-3 w-3 animate-spin"}),"正在读取…"]}),v&&!x&&h.jsx("button",{className:Wi,onClick:N=>{T.begin(c.length,p+1,N.timeStamp),m(L=>L+1)},children:"加载更多"})]})]})]})}function Ij({controller:e,compact:t=!1,disabled:n=!1}){const{binding:r,workspace:i,branchIntent:s,run:o,busy:a}=e,[l,c]=g.useState(!1),[u,d]=g.useState(""),[f,p]=g.useState(""),[m,v]=g.useState([]),[w,x]=g.useState(1),[_,b]=g.useState(),[S,C]=g.useState(),[k,T]=g.useState(!1),[E,D]=g.useState(!1),[N,L]=g.useState(null),[R,M]=g.useState(0),A=Cj(e,"branches",E),j=u.trim();g.useEffect(()=>{if(j===f)return;if(!j){p("");return}const I=setTimeout(()=>p(j),Sj);return()=>clearTimeout(I)},[j,f]),g.useEffect(()=>{if(!l||!r||j!==f)return;const I=A.current.current&&!A.current.current.done?A.current.current:A.begin(f.length,w);let U=!1;return L(null),D(!0),I.request(),o({action:"branches",repoId:r.repoId,...f?{search:f,..._?{cursor:_}:{}}:{page:w}},I.requestId).then(q=>{var O;I.response("ok",U,((O=q.branches)==null?void 0:O.length)??0),U||(v(te=>(f?!_:w===1)?q.branches??[]:[...te,...q.branches??[]]),T(!!(q.hasMore&&(!f||q.nextCursor))),C(q.nextCursor))}).catch(q=>{I.response("error",U),U||L(q.message)}).finally(()=>{U||D(!1)}),()=>{U=!0,I.finish("cancelled")}},[l,r==null?void 0:r.repoId,j,f,w,_,R,o]);const z=I=>{var U;I?A.open(f.length,w):(U=A.current.current)==null||U.finish("closed"),c(I),I||(d(""),p(""),v([]),x(1),b(void 0),C(void 0),T(!1),D(!1),L(null))},F=s??(i==null?void 0:i.actualBranch)??(i?"HEAD · "+i.head.slice(0,7):(r==null?void 0:r.sourceBranch)??"选择 branch"),$=[...new Set([...[...r?[r.defaultBranch]:[],...i!=null&&i.actualBranch?[i.actualBranch]:[],...(i==null?void 0:i.branches)??[]].filter(I=>I.toLowerCase().includes(j.toLowerCase())),...m])],B=I=>{const U=I===((i==null?void 0:i.actualBranch)??(r==null?void 0:r.sourceBranch));o(U?{action:"intend"}:{action:"intend",branch:I}).then(()=>{z(!1)}).catch(()=>{})};return h.jsxs(bj,{open:l,onOpenChange:z,children:[h.jsx(wj,{asChild:!0,children:h.jsxs("button",{onClickCapture:A.captureOpen,className:t?"flex min-w-0 items-center gap-1.5 text-[11px] text-text-300 disabled:opacity-40":Wi,"aria-label":`选择分支,当前 ${F}`,disabled:a||n,children:[h.jsx(ku,{className:"h-3.5 w-3.5 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:F}),h.jsx(Pn,{className:"ml-auto h-3 w-3 shrink-0 text-text-400"})]})}),h.jsxs(Ab,{align:"end",className:"w-[280px] p-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[h.jsx(Hf,{className:"h-3.5 w-3.5 text-text-400"}),h.jsx("input",{autoFocus:!0,"aria-label":"搜索分支",placeholder:"搜索分支…",value:u,maxLength:100,onChange:I=>{d(I.target.value),I.target.value.trim()!==j&&(A.begin(I.target.value.trim().length,1,I.timeStamp),v([]),x(1),b(void 0),C(void 0),T(!1),L(null),D(!0))},className:"w-full bg-transparent text-[12px] outline-none"})]}),h.jsxs("div",{className:"max-h-[300px] overflow-y-auto",children:[(j===f?$:[]).map(I=>h.jsxs("button",{className:Wi,onClick:()=>B(I),children:[h.jsx(ku,{className:"h-3.5 w-3.5 text-text-400"}),h.jsx("span",{className:"flex-1 truncate",children:I}),I===(r==null?void 0:r.defaultBranch)&&h.jsx("span",{className:"text-[10px] text-text-400",children:"默认"}),I===F&&h.jsx(Qo,{className:"h-3.5 w-3.5"})]},I)),N&&h.jsx(kj,{message:N,onRetry:()=>{A.begin(f.length,w),M(I=>I+1)}}),E&&h.jsxs("div",{role:"status",className:"flex items-center gap-2 p-3 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"h-3 w-3 animate-spin"}),"正在读取…"]}),!E&&!N&&!$.length&&h.jsx("p",{className:"p-3 text-[12px] text-text-400",children:"没有找到分支"}),k&&h.jsx("button",{className:Wi,disabled:E||!!N,onClick:I=>{A.begin(f.length,w+1,I.timeStamp),D(!0),f?b(S):x(U=>U+1)},children:"加载更多分支"})]})]})]})}function Mue({controller:e,disabled:t=!1}){return h.jsxs("div",{"data-testid":"workspace-input-chip",className:"flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 px-1 pb-2 text-text-300",children:[h.jsx("div",{className:"max-w-[200px] min-w-0",children:h.jsx(Ej,{controller:e,compact:!0})}),e.binding&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"h-3 w-px bg-border"}),h.jsx("div",{className:"min-w-0 max-w-[230px]",children:h.jsx(Ij,{controller:e,compact:!0,disabled:t},e.binding.repoId)})]}),e.loading&&h.jsx(Tn,{className:"h-3 w-3 shrink-0 animate-spin text-text-400"})]})}function Aue({controller:e,disabled:t=!1}){var v;const{binding:n,workspace:r,branchIntent:i,loading:s,busy:o,error:a,refresh:l,run:c}=e,[u,d]=g.useState(null),[f,p]=g.useState();g.useEffect(()=>{if(!u){p(void 0);return}let w=!1;return p(void 0),c({action:"diff",filePath:u}).then(x=>{w||p(x.diff)}).catch(()=>{}),()=>{w=!0}},[u,c]);const m=(v=r==null?void 0:r.files.find(w=>w.path===u))==null?void 0:v.comparison;return h.jsxs("div",{className:"space-y-3",children:[h.jsxs(ME,{title:"环境",trailing:h.jsx("button",{"aria-label":"刷新工作区",title:"刷新工作区",disabled:o||s,onClick:()=>void l(),className:"p-1 text-text-400 disabled:opacity-40",children:h.jsx(TF,{className:`h-3 w-3 ${s?"animate-spin":""}`})}),children:[h.jsxs("div",{className:"flex items-center gap-2.5 px-1.5 py-1.5 text-[13px]",children:[h.jsx(j7,{className:"h-4 w-4 text-text-400"}),h.jsx("span",{children:"云端"}),h.jsx("span",{className:"ml-auto text-[11px] text-text-400",children:n?"已关联":"待关联"})]}),h.jsx(Ej,{controller:e}),n&&h.jsx(Ij,{controller:e,disabled:t},n.repoId),i&&h.jsxs("p",{className:"mt-1 px-1.5 text-[11px] text-text-400",children:["将在下一条消息里让 agent 切换到 ",i]}),r&&h.jsxs("p",{className:"mt-1 px-1.5 text-[10px] text-text-400",children:["截至 ",YH(new Date(r.measuredAt).toISOString())," ·"," ",r.head.slice(0,7)]}),!n&&h.jsx("p",{className:"mt-2 px-1.5 text-[11px] leading-relaxed text-text-400",children:"关联仓库和分支,在这个会话的独立工作区里开发。"}),a&&h.jsxs("div",{role:"alert",className:"mt-2 rounded-md bg-error/5 p-2 text-[11px] leading-relaxed text-error",children:[a,h.jsx("button",{className:"ml-2 underline",onClick:()=>void l(),children:"重试读取"})]})]}),!!(r!=null&&r.files.length)&&h.jsxs(ME,{title:"Changes",trailing:h.jsxs("span",{className:"text-[10px] text-text-400",children:[r.totalFiles??r.files.length," 个文件"]}),children:[h.jsxs("button",{"aria-label":"查看全部改动",className:Wi,onClick:()=>d(r.files[0].path),children:[h.jsx(U7,{className:"h-4 w-4 text-text-400"}),h.jsxs("span",{className:"tabular-nums text-success",children:["+",r.added]}),h.jsxs("span",{className:"tabular-nums text-error",children:["−",r.removed]}),h.jsx(o4,{className:"ml-auto h-3 w-3 text-text-400"})]}),h.jsx("div",{className:"mb-2",children:r.files.map(w=>h.jsxs("button",{className:"flex w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-1.5 text-left text-[11px] hover:bg-text-100/5",onClick:()=>d(w.path),children:[h.jsx("span",{className:"w-4 shrink-0 text-[10px] text-text-400",children:w.status}),h.jsx("span",{title:w.path,className:"min-w-0 flex-1 truncate text-text-300",children:w.path.split("/").at(-1)}),h.jsxs("span",{className:"text-success",children:["+",w.added]}),h.jsxs("span",{className:"text-error",children:["−",w.removed]})]},w.path))}),r.filesTruncated&&h.jsx("p",{className:"mb-2 px-1 text-[11px] text-text-400",children:"仅展示前 200 个改动文件。"})]}),h.jsx(sj,{open:u!==null,onOpenChange:w=>{w||d(null)},children:h.jsxs(Pb,{className:"flex h-[min(680px,84vh)] w-[min(1080px,94vw)] max-w-none flex-col gap-0 overflow-hidden p-0",children:[h.jsxs("div",{className:"border-b border-border px-5 py-4",children:[h.jsx(Rb,{className:"text-[14px]",children:"代码改动"}),h.jsxs(lj,{className:"mt-2 text-[11px]",children:[(r==null?void 0:r.actualBranch)??"HEAD"," ·"," ",m==="index"?"暂存区相对当前提交的改动":m==="head"?"尚未提交的改动":"相对起始提交 "+(r==null?void 0:r.initialCommit.slice(0,7))+" 的累计改动"]})]}),h.jsxs("div",{className:"flex min-h-0 flex-1",children:[h.jsx("nav",{"aria-label":"改动文件",className:"w-[225px] shrink-0 overflow-auto border-r border-border bg-bg-50 p-2 max-[700px]:hidden",children:r==null?void 0:r.files.map(w=>h.jsx("button",{className:Wi+" text-[11px]",onClick:()=>d(w.path),children:h.jsx("span",{className:"truncate",children:w.path.split("/").at(-1)})},w.path))}),h.jsxs("div",{className:"min-w-0 flex-1 overflow-auto",children:[h.jsx("div",{className:"sticky top-0 border-b border-border bg-bg-50 px-4 py-3 font-mono text-[11px]",children:u}),f?f.binary?h.jsx("p",{className:"p-5 text-[12px] text-text-400",children:"二进制文件发生变化"}):f.notStored?h.jsx("p",{className:"p-5 text-[12px] text-text-400",children:"这个文件的补丁暂不可用(文件较多或体积较大时只保存部分补丁)。"}):h.jsxs("pre",{className:"min-w-fit py-2 font-mono text-[11px] leading-6",children:[f.patch.split(`
|
|
623
|
-
`).map((w,x)=>h.jsx("div",{className:`px-4 ${w.startsWith("+")?"bg-success/8 text-success":w.startsWith("-")?"bg-error/8 text-error":"text-text-300"}`,children:w||" "},x)),f.truncated&&h.jsx("div",{className:"px-4 text-text-400",children:"Diff 较大,已截断显示。"})]}):h.jsx("div",{className:"p-5 text-[12px] text-text-400",children:a??"正在读取 diff…"})]})]})]})})]})}const jue=250;function Lue(e){if(!e||!Number.isFinite(e))return null;const t=e/1e3;if(t<60)return`${t.toFixed(0)}s`;const n=Math.floor(t/60);return`${n}m${Math.round(t-n*60).toString().padStart(2,"0")}s`}function Due({agents:e}){var l,c,u;const[t,n]=g.useState(!1),r=g.useRef(null);if(g.useEffect(()=>{if(!t)return;const d=f=>{const p=r.current;p&&f.target instanceof Node&&p.contains(f.target)||n(!1)};return window.addEventListener("pointerdown",d,!0),()=>window.removeEventListener("pointerdown",d,!0)},[t]),e.length===0)return null;const i=e.length===1?e[0]:null,s=i?i.description:`${e.length} 个后台任务`,o=i?Lue((c=(l=i.progress)==null?void 0:l.stats)==null?void 0:c.durationMs):null,a=i?(u=i.progress)==null?void 0:u.lastToolName:null;return h.jsxs("div",{ref:r,"data-testid":"running-agents-chip","data-agent-count":e.length,className:"relative",children:[t?h.jsx("div",{"data-testid":"running-agents-popover",className:"absolute bottom-full right-0 z-20 mb-1 w-[min(560px,80vw)]",children:h.jsx("div",{className:"min-w-0 overflow-y-auto rounded-lg border border-bg-200/60 bg-bg-100 px-2 py-1 shadow-lg",style:{maxHeight:jue},children:e.map(d=>h.jsx(NM,{expandable:!1,description:d.description,input:d.input,output:d.output,...d.error!==void 0?{error:d.error}:{},pending:d.pending,notifications:d.notifications,...d.toolResultExtra?{toolResultExtra:d.toolResultExtra}:{},...d.progress?{progress:d.progress}:{}},d.toolUseId))})}):null,h.jsxs("button",{type:"button","data-testid":"running-agents-chip-toggle","aria-expanded":t,onClick:()=>n(d=>!d),className:ie("flex max-w-[min(560px,80vw)] min-w-0 items-center gap-2 rounded-full","border border-bg-200/60 bg-bg-100/95 px-3 py-1 text-[12px] shadow-md backdrop-blur","hover:bg-bg-200/95 transition-colors"),children:[h.jsx(Tn,{className:"w-3 h-3 shrink-0 animate-spin text-blue-400"}),h.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-text-200",children:s}),o?h.jsx("span",{className:"shrink-0 tabular-nums text-text-400",children:o}):null,a?h.jsxs("span",{className:"shrink-0 font-mono tabular-nums text-blue-400",children:["now:",a]}):null,h.jsx(a4,{className:ie("w-3.5 h-3.5 shrink-0 text-text-400 transition-transform",t&&"rotate-180")})]})]})}const Oue={closeTrailing:!1},Bue={closeTrailing:!0};function $ue(e){return e?Oue:Bue}function zue({session:e,api:t,onPromoteQuickAsk:n}){const r=QP(e.sessionId);return h.jsx(Nj,{state:r,extras:{session:e,api:t,...n?{onPromoteQuickAsk:n}:{}}})}function Fue({headerMeta:e,connState:t,liveWorktreeRoot:n,onOpenConfig:r,variant:i="full",ephemeral:s,onPromote:o,hideHeader:a=!1,flatProcess:l=!1,lines:c,pendingPermissions:u,procAlive:d,rewindableUserMessageIds:f,onPermissionRespond:p,onPermissionInterrupt:m,onRewind:v,onFork:w,onQuickAsk:x,topSlot:_,codexHistory:b,realtimeQuestionAnswers:S,onSubmitQuestion:C,onCancelQuestion:k,liveQuestionToolUseIds:T,api:E,cwd:D,tool:N,cloudVolume:L,sessionKey:R,onSend:M,awaitingUser:A,queued:j,onDequeue:z,onAbort:F,onNewSession:$,onClearSession:B,configSlot:I,workspaceInput:U,workspaceInputDisabled:q,chatRootRef:O,chatBodyRef:te,drawers:le,xtermSlot:Y,fileSharingScope:re,onShareFile:ke,onOpenInTab:oe,onPreviewMarkdown:Ie,onOpenFilePath:Ee,dispatchOrigin:Re}){const[he,Be]=g.useState(0),Qe=g.useMemo(()=>i==="full"?kY(tR(c)):[],[c,i]),Ge=g.useMemo(()=>new Set(Qe.map(ft=>ft.toolUseId)),[Qe]);return h.jsx(xie,{children:h.jsxs("div",{ref:O,"data-cc-chat-root":"",className:"flex flex-col h-full bg-bg-100",children:[a?null:h.jsx(gse,{meta:e,...N?{tool:N}:{},...L?{cloudVolume:L}:{},connState:t,variant:i,...n!==void 0?{liveWorktreeRoot:n}:{},...i==="full"&&r?{onOpenConfig:r}:{},...i==="quickask"?{ephemeral:s??!1,...o?{onPromote:o}:{}}:{}}),h.jsx("div",{ref:te,"data-testid":"chat-body",className:"flex-1 overflow-y-auto min-h-0",style:{overflowAnchor:"none",paddingBottom:he},children:h.jsx(PM,{lines:c,forkByTurn:N==="codex"||N===Hy,...p?{onPermissionRespond:p}:{},...m&&d?{onPermissionInterrupt:m}:{},topSlot:_,codexHistory:b,...v?{onRewind:v}:{},rewindableUserMessageIds:f,...w?{onFork:w}:{},...x?{onQuickAsk:x}:{},realtimeQuestionAnswers:S,onSubmitQuestion:C,...k?{onCancelQuestion:k}:{},liveQuestionToolUseIds:T,...re?{fileSharingScope:re}:{},...ke?{onShareFile:ke}:{},...oe?{onOpenInTab:oe}:{},...Ie?{onPreviewMarkdown:Ie}:{},...Ee?{onOpenFilePath:Ee}:{},...Re?{dispatchOrigin:Re}:{},...i==="full"&&!l?{turnCollapse:$ue(d)}:{},dockedAgentToolUseIds:Ge})}),Y,h.jsx(mue,{onHeightChange:Be,children:h.jsx(Due,{agents:Qe})}),e.larkChatName?h.jsx("div",{className:"mx-3 mb-3 rounded-lg border border-border bg-bg-200 px-3 py-2 text-[12px] text-text-400","data-testid":"lark-readonly-notice",children:e.larkChatType==="p2p"?`此会话由与「${e.larkChatName}」的飞书私聊驱动——对方消息触发,这里仅供观察。`:`此会话由飞书群「${e.larkChatName}」驱动——群成员 @ bot 提问触发,这里仅供观察。`}):h.jsx(pse,{meta:e,aboveSlot:U,disabled:q,...E?{api:E}:{},cwd:D,...N?{tool:N}:{},sessionKey:R,onSend:M,awaitingUser:A,...j?{queued:j}:{},...z?{onDequeue:z}:{},...F?{onAbort:F}:{},...$?{onNewSession:$}:{},...B?{onClearSession:B}:{},...I?{configSlot:I}:{}}),le]})})}function Nj({state:e,extras:t,onQuickAskInternal:n,onPreviewMdInternal:r}){var xr;const{session:i,api:s,liveGitBranch:o,liveWorktreeRoot:a,cloudVolume:l,onNewSession:c,onTurnEnd:u,onOpenConfig:d,onFork:f,onQuickAsk:p,viewerRole:m,onPromoteQuickAsk:v,configSlot:w,hideHeader:x,flatProcess:_}=t,{capabilities:b}=Rm(i.tool||"claude"),S=(b==null?void 0:b.features)??ZT(i.tool),[C,k]=g.useState(null),[T,E]=g.useState(null),D=Qp(),N=!!s&&D.actionsLevel==="owner"&&S.fileSharing,L=r4(i.ownerPersonaId??null).persona,R=(L==null?void 0:L.label)??null,M=!!R&&!!i.ownerPersonaId,A=due(),j=g.useMemo(()=>({resolve:(Z,we)=>A.resolve(Z,we,i.sessionId),...A.onOpenSession?{onOpenSession:A.onOpenSession}:{}}),[A,i.sessionId]),z=g.useCallback((Z,we)=>{k({kind:Z,text:we}),setTimeout(()=>{k(De=>(De==null?void 0:De.text)===we?null:De)},2e3)},[]),F=Ni(),$=Wc(i.tool)&&m!=="guest"&&!i.larkChatId&&!v,B=gue(s,i.sessionId,$,F,i.cloudWorkspace,i.cloudBranchIntent),I=bz(),U=GP(i.sessionId,i.toolSessionId),{events:q,pendingQuestions:O,clearQuestion:te,markQuestionSubmitted:le,status:Y}=U,re=e.historyLoading,ke=ZP(Y);g.useEffect(()=>{$e("chat-panel","sessionStatus",{sessionId:i.sessionId,sessionStatus:Y,procAlive:ke})},[Y,ke,i.sessionId]);const oe=e.lines,Ie=e.pendingPermissions,Ee=Ie[0]??null,Re=g.useMemo(()=>wY(q),[q]),[he,Be]=g.useState(null),[Qe,Ge]=g.useState(()=>new Set);yY(s,i.sessionId,i.toolSessionId,S.observe);const ft=g.useRef(i.sessionId);g.useEffect(()=>{if(ft.current=i.sessionId,!S.rewind){Be(null);return}let Z=!1;return Be(null),(async()=>{try{const we=await s.sessionRewindableMessageIds(i.sessionId);if(Z)return;Be(new Set(we.userMessageIds))}catch{Z||Be(null)}})(),()=>{Z=!0}},[s,i.sessionId,S.rewind]);const Kt=g.useCallback(()=>{const Z=i.sessionId;s.sessionRewindableMessageIds(Z).then(we=>{ft.current===Z&&Be(new Set(we.userMessageIds))}).catch(()=>{})},[s,i.sessionId]),fe=g.useMemo(()=>{if(he!==null){const ct=new Set(he);for(const Or of Qe)ct.delete(Or);return ct}const Z=new Set(["Edit","Write","MultiEdit","NotebookEdit"]),we=new Set;let De=null;for(const ct of oe)ct.kind==="user-text"?De=ct.uuid??null:De&&ct.kind==="tool-call"&&Z.has(ct.tool)&&!Qe.has(De)&&we.add(De);return we},[oe,Qe,he]),He=g.useRef(u);He.current=u,_Y(i.sessionId,i.toolSessionId,()=>{hn(null),Ge(new Set)});const Pe=Mse({sessionStatus:Y}),Me=g.useRef(null);g.useEffect(()=>{var De;const Z=Me.current,we=(Z==null?void 0:Z.sid)===i.sessionId;we&&Z.phase===Pe||(Me.current={sid:i.sessionId,phase:Pe},$e("session-phase",Pe,{sid:i.sessionId,phase:Pe,prev:we?Z.phase:null,desc:Rse[Pe]}),we&&Z.phase==="turn-running"&&Pe!=="turn-running"&&((De=He.current)==null||De.call(He),Kt()))},[Pe,i.sessionId,Kt]);const rt=g.useCallback(async()=>{const Z=await s.sessionInterrupt(i.sessionId).catch(()=>{});return(Z==null?void 0:Z.queued)??[]},[s,i.sessionId]),[tn,hn]=g.useState(null),W=g.useCallback(Z=>{hn(Z)},[]),[ee,be]=g.useState(!1),Oe=g.useCallback(()=>{s.sessionStop(i.sessionId).catch(()=>{}),be(!1)},[s,i.sessionId]);g.useCallback(Z=>{s.pinSession(i.sessionId,Z).catch(we=>{$e("chat-panel","pinSession failed",{err:we==null?void 0:we.message})})},[s,i.sessionId]);const Ue=v?"quickask":"full",{container:At,workspaceContainer:bn,onCollapse:nn,hostExtras:fn}=Sse(),ce=g.useRef(0),Se=g.useRef(null);g.useEffect(()=>{const Z=we=>{if(we.key!=="Escape")return;if(!ke){ce.current=0;return}if(we.isComposing)return;const ct=we.target;if(ct&&ct.closest("[data-cc-chat-root]")!==Se.current)return;const Or=Date.now();Or-ce.current<2e3?(ce.current=0,be(!0)):(ce.current=Or,rt())};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[rt,ke]);const st=g.useRef(null),gt=g.useRef(null),gr=g.useRef(!!e.codexHistory);gr.current=!!e.codexHistory;const ae=g.useRef(!0),it=g.useRef(void 0),Bt=g.useRef(0),ti=g.useRef(0),oa=g.useRef(void 0);g.useEffect(()=>{E(null)},[i.sessionId]),g.useEffect(()=>{const Z=st.current;if(!Z)return;const we=150,De=ct=>{gr.current||Date.now()<ti.current&&(ct.preventDefault(),ti.current=Date.now()+we)};return Z.addEventListener("wheel",De,{passive:!1}),()=>Z.removeEventListener("wheel",De)},[]),g.useEffect(()=>{const Z=st.current;if(!Z)return;const we=32,De=()=>{var Or;const ct=Z.scrollHeight-Z.scrollTop-Z.clientHeight;ae.current=ct<=we,e.codexHistory&&(gt.current=y2(Z)),Z.scrollTop<=24&&e.historyHasMore&&!e.historyLoadingOlder&&!e.historyError&&!re&&((Or=e.loadOlderHistory)==null||Or.call(e))};return Z.addEventListener("scroll",De,{passive:!0}),()=>Z.removeEventListener("scroll",De)},[e.codexHistory,e.historyHasMore,e.historyLoadingOlder,e.historyError,e.loadOlderHistory,re]),g.useLayoutEffect(()=>{var jb;const Z=st.current;if(!Z)return;const we=oa.current!==i.sessionId;we&&(oa.current=i.sessionId,ae.current=!0,it.current=void 0,Bt.current=0,ti.current=0,gt.current=null);const De=it.current,ct=(jb=oe[0])==null?void 0:jb.seq;if(it.current=ct,e.codexHistory){!we&>.current&&!ae.current?Oie(Z,gt.current):ae.current&&(Z.scrollTop=Z.scrollHeight),gt.current=y2(Z),Bt.current=Z.scrollHeight-Z.scrollTop;return}!we&&De!==void 0&&ct!==void 0&&ct<De?(Z.scrollTop=Z.scrollHeight-Bt.current,ti.current=Date.now()+200):ae.current&&(Z.scrollTop=Z.scrollHeight),Bt.current=Z.scrollHeight-Z.scrollTop},[oe,Ee==null?void 0:Ee.requestId,i.sessionId]);const aa=g.useMemo(()=>{const Z={};for(const[we,De]of Object.entries(O))De.submittedAnswers&&(Z[we]=De.submittedAnswers);return Z},[O]),hs=g.useMemo(()=>new Set(Object.keys(O)),[O]),la=g.useCallback(async(Z,we)=>{try{await s.answerQuestion({sessionId:i.sessionId,toolUseId:Z,answers:we}),le(Z,we)}catch{}},[s,i.sessionId,le]),Yl=g.useCallback(async Z=>{try{await s.cancelQuestion({sessionId:i.sessionId,toolUseId:Z}),te(Z)}catch{}},[s,i.sessionId,te]),Xl=g.useCallback(async(Z,we)=>{var De;if(Ee)try{await((De=e.respondPermission)==null?void 0:De.call(e,Ee.requestId,Z?"allow":"deny"))}catch{}},[e,Ee]),fs=g.useCallback(async()=>{const Z=i.sessionId;try{await s.sessionStop(Z)}catch{}e.clearSession?await e.clearSession():await s.sessionNew(Z)},[e,s,i.sessionId]),ni=e.meta.streamInProgress??!1,pd=g.useMemo(()=>{if(e.codexHistory)return h.jsxs("div",{className:"flex flex-col items-center gap-2 py-2 text-xs text-text-400","data-testid":"codex-history-top",children:[e.historySyncError?h.jsx("span",{children:e.historySyncError}):null,e.historyError?h.jsx("span",{"data-testid":"history-error",children:e.historyError}):null,re||e.historyLoadingOlder?h.jsx("span",{"data-testid":"history-loading",children:"正在加载历史…"}):e.historyHasMore?h.jsx("button",{type:"button",onClick:()=>{var we;return void((we=e.loadOlderHistory)==null?void 0:we.call(e))},children:e.historyError?"重试更早记录":"加载更早记录"}):e.historyLoaded&&!e.historyError&&!e.historySyncError?h.jsx("span",{children:"已加载全部轮次摘要"}):null,e.historyError||e.historySyncError?h.jsx("button",{type:"button",onClick:()=>{var we;return void((we=e.refreshHistory)==null?void 0:we.call(e))},children:"刷新历史"}):null]});const Z=e.historySyncError?h.jsxs("div",{className:"flex justify-center items-center gap-2 py-2 text-[12px] text-text-400","data-testid":"history-sync-error",children:[h.jsx("span",{children:e.historySyncError}),e.reloadFromCloud?h.jsx("button",{type:"button","data-testid":"history-sync-reload",disabled:ni,onClick:e.reloadFromCloud,className:"text-accent hover:underline cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 disabled:no-underline",children:"从云端重新加载"}):null]}):null;return e.historyError?h.jsxs(h.Fragment,{children:[Z,h.jsxs("div",{className:"flex justify-center py-2 text-[12px] text-text-400","data-testid":"history-error",children:["历史未加载完(",e.historyError,");切走再切回可重试"]})]}):Z||(re&&oe.length===0?h.jsx("div",{className:"flex justify-center py-4","data-testid":"history-loading",children:h.jsx(Tn,{className:"w-4 h-4 text-text-400 animate-spin"})}):null)},[re,oe.length,e.historyError,e.historySyncError,e.reloadFromCloud,ni,e.codexHistory,e.historyHasMore,e.historyLoaded,e.historyLoadingOlder,e.loadOlderHistory,e.refreshHistory]),ca=e.meta,Gt=h.jsxs(h.Fragment,{children:[i.toolSessionId&&S.subagents?h.jsx(kse,{api:s,cwd:i.cwd,toolSessionId:i.toolSessionId,toolKind:i.tool??"claude"}):null,tn&&S.rewind?h.jsx(Ese,{open:!0,onOpenChange:Z=>{Z||hn(null)},api:s,sessionId:i.sessionId,userMessageId:tn,lines:oe,procAlive:ke,onNoChanges:Z=>{Ge(we=>{if(we.has(Z))return we;const De=new Set(we);return De.add(Z),De})}}):null,ee?h.jsx(Hue,{onConfirm:Oe,onCancel:()=>be(!1)}):null]}),Zl={kind:"session",sessionId:i.sessionId},md=g.useCallback(async Z=>{if(s)try{await gC(s,F,i.sessionId,Z)}catch(we){const De=we.message;$e("chat-panel","open-in-tab failed",{err:De}),z("err",`Open in tab 失败:${De}`)}},[s,F,i.sessionId,z]),[jt,$t]=g.useState(!1),[Wn,vr]=g.useState(null),Mi=g.useCallback(Z=>{if(r){r(Z);return}vr(Z),$t(!0)},[r]),Bm=g.useCallback(Z=>{if(!s)return;const we=async()=>{try{await s.attachmentGroupAdd(i.sessionId,Z)}catch(ct){$e("chat-panel","file-link groupAdd skipped",{err:ct.message})}},De=ct=>{const Or=ct.message;$e("chat-panel","file-link open failed",{err:Or}),z("err",`打开文件失败:${Or}`)};if(Em(Z)){we().then(()=>Mi(Z),De);return}gC(s,F,i.sessionId,Z,60,we).catch(De)},[s,F,i.sessionId,Mi,z]),gd=g.useCallback(async Z=>{if(!s)throw new Error("daemon api not ready");const we=await q_(s,F,i.sessionId,Z,60),De=await fetch(we);if(!De.ok)throw new Error(`fetch ${De.status} ${De.statusText}`);return await De.text()},[s,F,i.sessionId]),lo=g.useCallback(async(Z,we)=>{if(s)try{const{url:De}=await s.attachmentSignUrl({sessionId:i.sessionId,relPath:Z,...we?{view:we}:{}}),ct=await aY(De);z(ct?"ok":"err",ct?"分享链接已复制到剪贴板":"复制失败:请手动复制")}catch(De){const ct=De.message;$e("chat-panel","share-file failed",{err:ct}),z("err",`生成分享链接失败:${ct}`)}},[s,i.sessionId,z]),co=g.useCallback(()=>E(null),[]),$m=T==="files"&&N&&s?{title:"Edited Files",onBack:co,content:h.jsx(Vle,{api:s,scope:Zl,sessionId:i.sessionId,onShareFile:lo,onOpenInTab:md,onPreviewMarkdown:Mi})}:T==="cron"?{title:`定时任务${Re.length?` (${Re.length})`:""}`,onBack:co,content:h.jsx("div",{className:"p-3",children:h.jsx(Pse,{jobs:Re})})}:T==="persona"&&M&&s&&i.ownerPersonaId?{title:`Persona · ${R??""}`,onBack:co,content:h.jsx(lue,{personaId:i.ownerPersonaId,open:!0,onClose:co,api:s,embedded:!0,...m?{viewerRole:m}:{}},i.ownerPersonaId)}:null,vd=Ue==="full"?h.jsx(bse,{session:i,meta:ca,...$&&B.binding?{liveGitBranch:((xr=B.workspace)==null?void 0:xr.actualBranch)??null}:o!==void 0?{liveGitBranch:o}:{},...a!==void 0?{liveWorktreeRoot:a}:{},...M?{personaName:R}:{},...M?{onOpenPersona:()=>E("persona")}:{},...N?{onOpenFiles:()=>E("files")}:{},cronActiveCount:Re.length,onCronClick:()=>E("cron"),onForceStop:()=>be(!0),...Wc(i.tool)&&e.reloadFromCloud?{onReloadFromCloud:e.reloadFromCloud,reloadFromCloudDisabled:ni}:{},...m?{viewerRole:m}:{},...b!=null&&b.toolSessionIdLabel?{toolSessionIdLabel:b.toolSessionIdLabel}:{},drill:$m,...nn?{onCollapse:nn}:{},...fn?{title:fn.title,leadingEntries:fn.leadingEntries}:{}}):null;return h.jsxs(h.Fragment,{children:[$&&bn?Do.createPortal(h.jsx(Aue,{controller:B,disabled:ca.streamInProgress}),bn):null,At&&vd?Do.createPortal(vd,At):null,h.jsx(Fue,{headerMeta:ca,workspaceInput:$?h.jsx(Mue,{controller:B,disabled:ca.streamInProgress}):void 0,workspaceInputDisabled:$&&B.busy,connState:e.connState,...a!==void 0?{liveWorktreeRoot:a}:{},...d?{onOpenConfig:d}:{},variant:Ue,...x||$?{hideHeader:!0}:{},..._?{flatProcess:_}:{},...Ue==="quickask"?{ephemeral:i.ephemeral!==!1,onPromote:()=>void(v==null?void 0:v(i.sessionId))}:{},lines:oe,pendingPermissions:Ie,procAlive:ke,rewindableUserMessageIds:fe,onPermissionRespond:Xl,onPermissionInterrupt:rt,onRewind:S.rewind?W:void 0,...f&&S.fork?{onFork:f}:{},...Wc(i.tool)?{}:n&&S.fork?{onQuickAsk:n}:p&&S.fork?{onQuickAsk:p}:{},topSlot:pd,codexHistory:e.codexHistory,realtimeQuestionAnswers:aa,onSubmitQuestion:la,onCancelQuestion:Yl,liveQuestionToolUseIds:hs,api:s,cwd:i.cwd,...i.tool?{tool:i.tool}:{},...l?{cloudVolume:l}:{},sessionKey:i.sessionId,onSend:e.sendText,queued:e.queued,onDequeue:e.dequeue,awaitingUser:Ie.length>0||Object.values(O).some(Z=>!Z.submittedAnswers),onAbort:rt,...c?{onNewSession:c}:{},onClearSession:fs,...w?{configSlot:w}:{},chatRootRef:Se,chatBodyRef:st,drawers:Gt,xtermSlot:I==="tui"&&ke&&S.tui?h.jsx(qle,{sessionId:i.sessionId,client:F},i.sessionId):null,fileSharingScope:Zl,...s?{onShareFile:lo}:{},...s?{onOpenInTab:md}:{},...s?{onPreviewMarkdown:Mi}:{},...s?{onOpenFilePath:Bm}:{},dispatchOrigin:j}),s?h.jsx(pue,{open:jt,onOpenChange:$t,relPath:Wn,loadMarkdown:gd,onShare:Wn?()=>void lo(Wn,"md-rendered"):void 0}):null,C?h.jsx("div",{"data-testid":"share-toast",role:"status","aria-live":"polite",className:C.kind==="ok"?"fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-md border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-[12px] text-emerald-700 shadow-md dark:text-emerald-300":"fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive shadow-md",children:C.text}):null]})}function Hue({onConfirm:e,onCancel:t}){return h.jsx("div",{role:"dialog","aria-modal":"true","data-testid":"force-stop-confirm",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:t,children:h.jsxs("div",{className:"max-w-sm w-[92%] rounded-lg border border-red-400/40 bg-bg-0 p-4 shadow-xl",onClick:n=>n.stopPropagation(),children:[h.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[h.jsx(Uf,{className:"w-5 h-5 text-red-500 shrink-0 mt-0.5"}),h.jsx("div",{className:"text-[14px] text-text-100",children:"强制停止会话进程?会丢失 initialize / 预热缓存,下一次发送需要重新 spawn。"})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:t,className:"h-8 px-3 rounded-md text-[12px] text-text-300 hover:bg-text-100/5 cursor-pointer",children:"取消"}),h.jsx("button",{type:"button","data-testid":"force-stop-confirm-ok",onClick:e,className:"h-8 px-3 rounded-md bg-red-500 text-white text-[12px] font-medium hover:bg-red-600 cursor-pointer",children:"强制停止"})]})]})})}function Uue(e){return e.split("/").pop()||e}function Wue({state:e,api:t,onSwitchTab:n,onCloseQuickAsk:r,onCloseMd:i,loadMarkdown:s,quickAskSession:o,onPromoteQuickAsk:a}){if(!JP(e))return null;const l=[];e.quickAsk&&l.push({id:"quick-ask",label:"问一下",title:"问一下",icon:h.jsx(fx,{className:"w-3.5 h-3.5"})});for(const c of e.mds)l.push({id:{kind:"md",relPath:c},label:Uue(c),title:c,icon:h.jsx(Ci,{className:"w-3.5 h-3.5"})});return h.jsxs("div",{className:"flex flex-col h-full bg-bg-50/60 border-l border-border-strong",children:[h.jsx(Tu,{delayDuration:200,skipDelayDuration:100,children:h.jsx("div",{className:["flex items-stretch h-9 border-b border-text-100/10 shrink-0 overflow-x-auto","[scrollbar-width:none] [-ms-overflow-style:none]","[&::-webkit-scrollbar]:hidden"].join(" "),role:"tablist",children:l.map(c=>{const u=xY(e.active,c.id),d=c.id==="quick-ask"?"quick-ask":`md:${c.id.relPath}`;return h.jsxs(td,{children:[h.jsx(nd,{asChild:!0,children:h.jsxs("div",{role:"tab","aria-selected":u,"data-tab-title":c.title,onClick:()=>n(c.id),className:["group relative flex items-center gap-2 px-3 h-full cursor-pointer select-none","text-[12px] max-w-[180px] shrink-0 transition-colors duration-100",u?"text-text-100":"text-text-400 hover:text-text-100 hover:bg-text-100/[0.04]"].join(" "),children:[c.icon,h.jsx("span",{className:"truncate",children:c.label}),h.jsx("button",{type:"button","aria-label":`关闭 ${c.label}`,className:["ml-1 rounded p-0.5 shrink-0 transition-opacity","hover:bg-text-100/10",u?"opacity-70 hover:opacity-100":"opacity-0 group-hover:opacity-70"].join(" "),onClick:f=>{f.stopPropagation(),c.id==="quick-ask"?r():i(c.id.relPath)},children:h.jsx(Qr,{className:"w-3 h-3"})}),u?h.jsx("span",{"aria-hidden":"true",className:"absolute left-2 right-2 -bottom-px h-[2px] rounded-full bg-accent"}):null]})}),h.jsx(Ul,{side:"bottom",align:"start",className:"max-w-sm break-all",children:c.title})]},d)})})}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:[e.quickAsk&&o?h.jsx("div",{className:"absolute inset-0",style:{display:e.active==="quick-ask"?"block":"none"},children:h.jsx(zue,{session:o,api:t,...a?{onPromoteQuickAsk:a}:{}})}):null,e.mds.map(c=>{const u=e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===c;return h.jsx("div",{className:"absolute inset-0",style:{display:u?"block":"none"},children:h.jsx(cj,{relPath:c,loadMarkdown:s,showTitleBar:!1})},`md-body:${c}`)})]})]})}function que(e){const t=e instanceof Error?e.message:String(e);return t.length>200?`${t.slice(0,200)}…`:t}function Vue({state:e,extras:t}){const{api:n,session:r}=t,i=Ni(),[s,o]=g.useState(dY()),[a,l]=g.useState(null),c=r.ownerPersonaId!==NT,u=g.useRef(s);u.current=s;const d=g.useRef(!1),f=g.useCallback(async E=>{const D=u.current.quickAsk;l(null);let N;try{N=await rY(n,r,E)}catch(L){$e("quick-ask","fork failed",L),d.current||l(que(L));return}if(!N){d.current||l("这条会话还没准备好(没有可派生的对话记录),稍后再试");return}if(d.current){n.sessionDelete(N.sessionId).catch(()=>{});return}rh(D)&&n.sessionDelete(D.sessionId).catch(()=>{}),o(L=>hY(L,{sessionId:N.sessionId}))},[n,r]),p=g.useCallback(async E=>{const D=u.current.quickAsk,N=(D==null?void 0:D.sessionId)===E;try{await iY(n,{sessionId:E,stillEphemeral:N&&rh(D)})&&o(R=>mY(R))}catch(L){$e("quick-ask","promote failed",L)}},[n]),m=g.useCallback(E=>{o(D=>fY(D,E))},[]),v=g.useCallback(E=>{o(D=>vY(D,E))},[]),w=g.useCallback(()=>{const E=u.current.quickAsk;rh(E)&&n.sessionDelete(E.sessionId).catch(()=>{}),o(D=>pY(D))},[n]),x=g.useCallback(E=>{o(D=>gY(D,E))},[]);g.useEffect(()=>()=>{d.current=!0;const E=u.current.quickAsk;rh(E)&&n.sessionDelete(E.sessionId).catch(()=>{})},[]);const _=ts("sessions")??[],b=s.quickAsk?_.find(E=>E.sessionId===s.quickAsk.sessionId)??{sessionId:s.quickAsk.sessionId,cwd:r.cwd,tool:r.tool}:null,S=g.useCallback(async E=>{const D=await q_(n,i,r.sessionId,E,60),N=await fetch(D);if(!N.ok)throw new Error(`fetch ${N.status} ${N.statusText}`);return N.text()},[n,i,r.sessionId]),C=h.jsx(Nj,{state:e,extras:t,onQuickAskInternal:f,onPreviewMdInternal:m}),{initialSize:k,setSize:T}=uY("chat-panel-right-slot-width",480);return h.jsxs(H_,{orientation:"horizontal",className:"flex-1 flex min-w-0 min-h-0",children:[h.jsx(Zf,{id:"chat",minSize:"400px",children:h.jsxs("div",{className:"relative flex flex-col min-w-0 min-h-0 h-full",children:[C,a?h.jsxs("div",{"data-testid":"quick-ask-error",className:"absolute bottom-24 left-1/2 z-10 -translate-x-1/2 max-w-[90%] rounded-md border border-border bg-bg-200 px-3 py-2 text-[12px] text-text-300 shadow-lg",children:[h.jsxs("span",{className:"mr-2",children:["问一下没能打开:",a]}),h.jsx("button",{type:"button","aria-label":"关闭提示",onClick:()=>l(null),className:"text-text-400 hover:text-text-200 cursor-pointer",children:"✕"})]}):null]})}),JP(s)?h.jsxs(h.Fragment,{children:[h.jsx(KP,{className:"w-1 bg-text-100/10 hover:bg-text-100/25 transition-colors cursor-col-resize"}),h.jsx(Zf,{id:"right-slot",defaultSize:`${k}px`,minSize:"360px",maxSize:"800px",onResize:E=>T(E.inPixels),children:h.jsx(Wue,{state:s,api:n,onSwitchTab:v,onCloseQuickAsk:w,onCloseMd:x,loadMarkdown:S,quickAskSession:b,...c?{onPromoteQuickAsk:p}:{}})})]}):null]})}function Kue({extras:e}){const t=QP(e.session.sessionId,e.focused);return h.jsx(Vue,{state:t,extras:e})}function Gue(e,t,n){var s;const r=n.find(o=>o.name==="effort"),i=e?t.find(o=>o.id===e):void 0;if(i!=null&&i.efforts&&i.efforts.length>0){const o=(s=r==null?void 0:r.options)==null?void 0:s.find(l=>l.value==="none");return{options:o?[o,...i.efforts.filter(l=>l.value!=="none")]:i.efforts,defaultValue:i.defaultEffort??""}}return{options:(r==null?void 0:r.options)??[],defaultValue:typeof(r==null?void 0:r.default)=="string"?r.default:""}}function Yue(e,t,n){var l;if(!t)return((l=(e??[]).find(c=>c.id===""))==null?void 0:l.label)??"未指定";const r=t.toLowerCase(),i=[["opus","Opus"],["fable","Fable"],["sonnet","Sonnet"],["haiku","Haiku"]];for(const[c,u]of i){if(!r.includes(c))continue;const d=r.match(new RegExp(`${c}-(\\d+)(?:-(\\d+))?`));return d?d[2]?`${u} ${d[1]}.${d[2]}`:`${u} ${d[1]}`:u}const s=e??[],o=s.find(c=>c.id===t);if(o)return o.label;const a=s.find(c=>c.id&&t.toLowerCase().includes(c.id.toLowerCase()));return a?a.label:t}function Xue(e,t){var m,v,w,x;const{models:n,modes:r,configSchema:i}=t,s=e.resolvedModel??e.model,o=Gue(s,n,i),a=o.options,l=a.some(_=>_.value===e.effort)?e.effort:o.defaultValue,c=e.effort===""&&e.resolvedEffort?((m=a.find(_=>_.value===e.resolvedEffort))==null?void 0:m.label)??e.resolvedEffort:((v=a.find(_=>_.value===l))==null?void 0:v.label)??null,u=((w=i.find(_=>_.name==="permissionMode"))==null?void 0:w.default)??"",d=r.some(_=>_.id===e.permissionMode)?e.permissionMode:u,p=d===u?null:((x=r.find(_=>_.id===d))==null?void 0:x.label)??null;return{modelLabel:Yue(n,s),effortOptions:a,effortValue:l,effortLabel:c,modeValue:d,modeLabel:p,modeTone:p===null?null:d==="bypassPermissions"?"danger":"info"}}function Tj(e){let t;return e.map(n=>{const r=n.group&&n.group!==t?n.group:null;return n.group&&(t=n.group),{...n,groupHeading:r}})}function Zue(e){return e.map(t=>({value:t.id,label:t.label,...t.description?{description:t.description}:{},...t.group?{group:t.group}:{}}))}function Que({testid:e,list:t,options:n,current:r,onSelect:i}){if(t.loading)return h.jsx(Wr,{disabled:!0,"data-testid":`${e}-loading`,className:"text-[12px] text-text-400",children:"正在读取最新模型…"});if(t.error)return h.jsxs(h.Fragment,{children:[h.jsx("div",{"data-testid":`${e}-error`,className:"px-2 py-1.5 text-[11px] text-warning",children:t.error}),h.jsx(Wr,{"data-testid":`${e}-retry`,className:"text-[12px]",onSelect:o=>{o.preventDefault(),t.load()},children:"重试"})]});const s=n??Zue(t.models);return s.length===0?h.jsx(Wr,{disabled:!0,"data-testid":`${e}-empty`,className:"text-[12px] text-text-400",children:"没有可选模型"}):h.jsx(h.Fragment,{children:Tj(s).map((o,a)=>{const l=o.value===r;return h.jsxs(Je.Fragment,{children:[o.groupHeading?h.jsxs(h.Fragment,{children:[a>0?h.jsx(mm,{}):null,h.jsx(R_,{"data-testid":`${e}-group`,children:o.groupHeading})]}):null,h.jsxs(Wr,{"data-testid":`${e}-option-${o.value||"default"}`,onSelect:()=>i(o.value),className:"items-start gap-2",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:ie("block text-[12px]",l?"font-medium text-text-100":"text-text-300"),children:o.label}),o.description?h.jsx("span",{className:"mt-0.5 block text-[11px] text-text-400",children:o.description}):null]}),l?h.jsx(Qo,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-accent"}):null]})]},o.value||"default")})})}function Jue(e,t={}){return{models:e,loading:!1,error:null,load:()=>{},...t}}const ede=e=>e instanceof Error?e.message:String(e);function tde(e,t){const[n,r]=g.useState({key:e,loading:!1,error:null,data:t}),i=g.useRef(0),s=g.useCallback((a,l)=>{const c=++i.current;r(u=>({key:e,loading:!0,error:null,data:u.key===e?u.data:t})),a().then(u=>{i.current===c&&(l==null||l(u),r({key:e,loading:!1,error:null,data:u}))},u=>{i.current===c&&r(d=>({key:e,loading:!1,error:ede(u),data:d.key===e?d.data:t}))})},[e]);return{...n.key===e?n:{loading:!1,error:null,data:t},run:s}}const nde=[];function rde(e){const t=Ni(),n=g.useMemo(()=>new Jp(t),[t]),r=as(),{capabilities:i}=Rm(e),s=tde(e??"",null),{run:o}=s,a=g.useCallback(()=>{e&&o(()=>n.capabilitiesGet(e,{refresh:!0}),l=>{l&&r.setData(`capabilities/${e}`,()=>l)})},[n,r,e,o]);return{models:(i==null?void 0:i.models)??nde,loading:s.loading,error:s.error,load:a}}function ide({models:e,modelList:t,modes:n=[],configSchema:r=[],model:i,resolvedModel:s,resolvedEffort:o,effort:a,permissionMode:l,onPatch:c}){var w;const u=t??Jue(e??[]),d=u.models,f=Xue({model:i,resolvedModel:s,resolvedEffort:o,effort:a,permissionMode:l},{models:d,modes:n,configSchema:r}),p=s??i,m=d.map(x=>{const _=x.id===""&&s?`${x.description?`${x.description};`:""}当前:${s}`:x.description;return{value:x.id,label:x.label,..._?{description:_}:{},...x.group?{group:x.group}:{}}}),v=n.map(x=>({value:x.id,label:x.label,...x.description?{description:x.description}:{}}));return h.jsxs(gP,{children:[h.jsx(vP,{asChild:!0,children:h.jsxs("button",{type:"button","data-testid":"session-config-chip",title:"Model / reasoning effort / permission mode",className:"inline-flex items-center gap-1 h-7 px-2.5 rounded-full text-[11px] text-text-400 transition-colors outline-none cursor-pointer hover:bg-text-100/5 hover:text-text-200 data-[state=open]:bg-text-100/5",children:[h.jsx("span",{className:"truncate max-w-[120px]","data-testid":"session-config-chip-model",children:p||f.modelLabel}),f.effortLabel?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{className:"truncate max-w-[80px]","data-testid":"session-config-chip-effort",children:f.effortLabel})]}):null,f.modeLabel?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{"data-testid":"session-config-chip-mode","data-tone":f.modeTone,className:ie("font-semibold",f.modeTone==="danger"?"text-red-400":"text-blue-400"),children:f.modeLabel})]}):null]})}),h.jsxs(N_,{side:"top",align:"end",className:"w-[230px]","data-testid":"session-config-menu",children:[h.jsx(sde,{list:u,current:i,currentLabel:f.modelLabel,options:m,onSelect:x=>c({model:x})}),h.jsx(AE,{testid:"session-config-effort",label:"Reasoning effort",current:f.effortValue,currentLabel:f.effortLabel??"—",options:f.effortOptions,onSelect:x=>c({effort:x})}),v.length>0?h.jsx(AE,{testid:"session-config-mode",label:"Permission mode",current:f.modeValue,currentLabel:((w=n.find(x=>x.id===f.modeValue))==null?void 0:w.label)??"—",currentTone:f.modeTone,options:v,onSelect:x=>c({permissionMode:x})}):null]})]})}function Pj({label:e,currentLabel:t,currentTone:n}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"flex-1 text-text-200",children:e}),h.jsx("span",{className:ie("truncate max-w-[100px]",n==="danger"?"text-red-400 font-semibold":n==="info"?"text-blue-400 font-semibold":"text-text-400"),children:t}),h.jsx(Fn,{className:"w-3.5 h-3.5 shrink-0 text-text-500"})]})}function sde({list:e,current:t,currentLabel:n,options:r,onSelect:i}){const[s,o]=g.useState(!1),a=l=>{l&&!s&&e.load(),o(l)};return h.jsxs(xP,{open:s,onOpenChange:a,children:[h.jsx(T_,{"data-testid":"session-config-model",className:"gap-2 text-[12px]",children:h.jsx(Pj,{label:"Model",currentLabel:n})}),h.jsx(P_,{className:"w-[220px] max-h-[320px] overflow-y-auto",children:h.jsx(Que,{testid:"session-config-model",list:e,options:r,current:t,onSelect:i})})]})}function AE({testid:e,label:t,current:n,currentLabel:r,currentTone:i,options:s,onSelect:o}){const a=s.length===0;return h.jsxs(xP,{children:[h.jsx(T_,{"data-testid":e,disabled:a,className:"gap-2 text-[12px]",children:h.jsx(Pj,{label:t,currentLabel:r,currentTone:i??null})}),h.jsx(P_,{className:"w-[220px] max-h-[320px] overflow-y-auto",children:Tj(s).map((l,c)=>{const u=l.value===n;return h.jsxs(Je.Fragment,{children:[l.groupHeading?h.jsxs(h.Fragment,{children:[c>0?h.jsx(mm,{}):null,h.jsx(R_,{"data-testid":`${e}-group`,children:l.groupHeading})]}):null,h.jsxs(Wr,{"data-testid":`${e}-option-${l.value||"default"}`,onSelect:()=>o(l.value),className:"items-start gap-2",children:[h.jsxs("span",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:ie("block text-[12px]",u?"text-text-100 font-medium":"text-text-300"),children:l.label}),l.description?h.jsx("span",{className:"block text-[11px] text-text-400 mt-0.5",children:l.description}):null]}),u?h.jsx(Qo,{className:"w-3.5 h-3.5 shrink-0 text-accent mt-0.5"}):null]})]},l.value||"default")})})]})}function ode(e,t,n=0){const[r,i]=g.useState(null),[s,o]=g.useState(!1),a=g.useCallback(async()=>{if(!t){i(null);return}o(!0);try{const l=await e.getGitBranch(t);i(l.branch??null)}catch{i(null)}finally{o(!1)}},[e,t]);return g.useEffect(()=>{a()},[a,n]),{branch:r,loading:s,refresh:()=>void a()}}function ade(e,t,n=0){const[r,i]=g.useState(null),[s,o]=g.useState(!1),a=g.useCallback(async()=>{if(!t){i(null);return}o(!0);try{const l=await e.getGitRoot(t);i(l.gitRoot??null)}catch{i(null)}finally{o(!1)}},[e,t]);return g.useEffect(()=>{a()},[a,n]),{worktreeRoot:r,loading:s,refresh:()=>void a()}}const lde=5e3;function cde(e,t,n=0){const[r,i]=g.useState(null);return g.useEffect(()=>{if(!t){i(null);return}let s=!1;const o=async()=>{try{const l=await e.cloudVolumeGet();s||i(l.volume??null)}catch{s||i(null)}},a=n>0?setTimeout(()=>void o(),lde):null;return a||o(),()=>{s=!0,a&&clearTimeout(a)}},[e,t,n]),{volume:r}}const ude=90;function dde(e){return e.sizeBytes>0?Math.min(100,Math.max(0,Math.round(e.usedBytes/e.sizeBytes*100))):0}function jE(e){const t=e/1073741824;return t>=.1?`${t.toFixed(1)} GB`:`${Math.max(1,Math.round(e/1024**2))} MB`}function hde({volume:e}){if(!e)return null;const t=dde(e),n=t>=ude?"warn":"ok",r=new Date(e.measuredAt).toLocaleString(),i=n==="ok"?"上一次任务结束时量的。":"盘快满了:在会话里说「清理一下云盘」,persona 会分析工作区里哪些能删、列给你确认后清掉。";return h.jsxs("span",{"data-testid":"chat-header-cloud-volume","data-tone":n,title:`云盘已用 ${jE(e.usedBytes)} / ${jE(e.sizeBytes)}(${r})。${i}`,className:ie("ml-1.5 inline-flex items-center gap-1.5 px-1.5 py-0.5 rounded text-[11px] tabular-nums",n==="ok"&&"bg-text-100/10 text-text-400",n==="warn"&&"bg-warning-dim text-warning"),children:[h.jsx("span",{className:"relative inline-block w-8 h-1 rounded-full bg-current/20 overflow-hidden","aria-hidden":!0,children:h.jsx("span",{className:"absolute inset-y-0 left-0 rounded-full bg-current",style:{width:`${t}%`}})}),"云盘 ",t,"%"]})}function fde({api:e,session:t,focused:n,totalPanes:r,onFocus:i,onClose:s,onNewSession:o,onOpenConfig:a,onFork:l,onQuickAsk:c,className:u,viewerRole:d="owner",hideHeader:f}){const{capabilities:p}=Rm(t.tool),m=rde(t.tool),[v,w]=g.useState(0),[x,_]=g.useState(n);Je.useEffect(()=>{n&&_(!0)},[n]);const b=Wc(t.tool),S=b?void 0:t.cwd,{branch:C}=ode(e,S,v),{worktreeRoot:k}=ade(e,S,v),{volume:T}=cde(e,b,v),E=r>1,D=N=>{e.sessionUpdate(t.sessionId,N).catch(L=>{console.error("[session-config] session:update failed",t.sessionId,L)})};return h.jsxs("div",{className:`group/pane relative flex-1 ${u??"flex"} flex-row min-w-0 min-h-0 overflow-hidden ${E?`rounded-md border transition-colors ${n?"border-accent ring-1 ring-accent":"border-border"}`:""}`,onMouseDown:i,"data-testid":`session-pane-${t.sessionId}`,children:[h.jsx(H_,{orientation:"horizontal",className:"flex-1 flex min-w-0 min-h-0",children:h.jsx(Zf,{id:"chat",minSize:"400px",children:h.jsx("div",{className:"flex flex-col min-w-0 min-h-0 h-full",children:(n||x)&&h.jsx(pde,{api:e,session:t,focused:n,liveGitBranch:C,liveWorktreeRoot:k,...b&&T?{cloudVolume:h.jsx(hde,{volume:T})}:{},onNewSession:o,onTurnEnd:()=>w(N=>N+1),onOpenConfig:a,onFork:l,onQuickAsk:c,viewerRole:d,hideHeader:f,configSlot:p?h.jsx(ide,{modelList:m,modes:p.permissionModes,configSchema:p.configSchema,model:t.model??"",...t.resolvedModel?{resolvedModel:t.resolvedModel}:{},...t.resolvedEffort?{resolvedEffort:t.resolvedEffort}:{},effort:t.effort??"",permissionMode:t.permissionMode??"",onPatch:D}):null})})})}),E&&h.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),s()},className:"absolute top-1.5 right-1.5 z-10 p-1 rounded-md bg-bg-100/80 backdrop-blur-sm border border-border opacity-0 group-hover/pane:opacity-100 transition-opacity text-text-400 hover:text-text-100 hover:bg-bg-200","aria-label":"close pane","data-testid":`session-pane-close-${t.sessionId}`,children:h.jsx(Qr,{className:"w-3.5 h-3.5"})})]})}function pde({api:e,session:t,focused:n,liveGitBranch:r,liveWorktreeRoot:i,cloudVolume:s,onNewSession:o,onTurnEnd:a,onOpenConfig:l,onFork:c,onQuickAsk:u,viewerRole:d,configSlot:f,hideHeader:p}){return h.jsx(Kue,{extras:{session:t,api:e,focused:n,...r!==void 0?{liveGitBranch:r}:{},...i!==void 0?{liveWorktreeRoot:i}:{},...s!==void 0?{cloudVolume:s}:{},onNewSession:o,onTurnEnd:a,onOpenConfig:l,...c?{onFork:m=>{c(m)}}:{},...u?{onQuickAsk:m=>{u(m)}}:{},...d?{viewerRole:d}:{},...f?{configSlot:f}:{},...p?{hideHeader:p}:{}}})}function mde({personas:e,sessions:t,api:n,selfPrincipalId:r,selectedPersonaId:i,selectedSessionId:s,selectedSession:o,onSelectPersona:a,onSelectSession:l,onCreateSession:c,onDeleteSession:u,onEditSession:d,onCloseSession:f}){return h.jsxs("div",{className:"flex h-screen min-h-0 bg-bg-50","data-testid":"guest-share-page",children:[h.jsx("aside",{className:"w-[280px] shrink-0 overflow-y-auto border-r border-border bg-bg-50",children:h.jsx(FK,{personas:e,sessions:t,activePersonaId:i,activeSessionId:s,onSelectPersona:a,onSelectSession:l,onCreateSession:c,onDeleteSession:u,onEditSession:d,showCopyResume:!1,treatSessionsAsRoots:!0,...r?{ownerPrincipalId:r}:{},isPersonaExpanded:()=>!0})}),h.jsx("main",{className:"flex-1 min-w-0 min-h-0 flex",children:o?h.jsx(fde,{api:n,session:o,focused:!0,totalPanes:1,onFocus:()=>{},onClose:f,onNewSession:()=>{},onOpenConfig:()=>{},viewerRole:"guest"}):h.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-xs text-text-400","data-testid":"guest-share-empty",children:"选择左侧 persona 开始对话"})})]})}function gde(){const e=Ni(),t=g.useMemo(()=>new Jp(e),[e]),n=Uz(e),{sessions:r,refresh:i}=Wz(n),{personas:s}=n4(),o=Xz(),a=g.useMemo(()=>{const S=window.location.pathname.match(/^\/s\/([^/]+)/);return S?decodeURIComponent(S[1]):null},[]),l=g.useMemo(()=>r.filter(S=>!S.ephemeral&&S.larkChatId==null),[r]),c=g.useMemo(()=>a?s.filter(S=>S.personaId===a):s,[s,a]),[u,d]=g.useState(null),[f,p]=g.useState(null),[m,v]=g.useState(null);g.useEffect(()=>{let S=!1;return e.request("whoami",{}).then(C=>{S||d(C.capability.id)}).catch(()=>{}),()=>{S=!0}},[e]),g.useEffect(()=>{a&&p(a)},[a]);const w=g.useCallback(async(S,C)=>{const k=await t.sessionCreate({ownerPersonaId:S,...C.trim()?{label:C.trim()}:{}});await i(),p(S),v(k.sessionId)},[t,i]),x=g.useCallback(async S=>{await t.sessionDelete(S),await i(),v(C=>C===S?null:C)},[t,i]),_=g.useCallback(async(S,C)=>{await t.sessionUpdate(S,{label:C.label}),await i()},[t,i]),b=g.useMemo(()=>l.find(S=>S.sessionId===m)??null,[l,m]);return h.jsx(Jy.Provider,{value:o,children:h.jsx(mde,{personas:c,sessions:l,api:t,selfPrincipalId:u,selectedPersonaId:f,selectedSessionId:m,selectedSession:b,onSelectPersona:p,onSelectSession:v,onCreateSession:(S,C)=>void w(S,C),onDeleteSession:S=>void x(S),onEditSession:(S,C)=>void _(S,C),onCloseSession:()=>v(null)})})}const LE="https://app.ttcadvisory.com";function vde({onAuthed:e}){const[t,n]=g.useState(!1),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>()=>{s.current&&window.removeEventListener("message",s.current)},[]);const o=g.useCallback(()=>{s.current&&(window.removeEventListener("message",s.current),s.current=null),n(!0),i(null);const a=window.location.origin,l=`${LE}/auth/authorize?callback_url=${encodeURIComponent(a)}&auto=1`,c=async d=>{if(d.origin!==LE)return;const f=d.data;if((f==null?void 0:f.type)==="AUTH_CANCEL"){u(),n(!1);return}if(!((f==null?void 0:f.type)!=="AUTH_SUCCESS"||!f.token)){u();try{const p=await fetch(`${window.location.origin}/share/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ttcToken:f.token})});if(!p.ok){const v=await p.json().catch(()=>({}));throw new Error(v.code??`exchange failed (${p.status})`)}const m=await p.json();if(!m.visitorToken)throw new Error("no visitorToken in response");e(m.visitorToken)}catch(p){i(p instanceof Error?p.message:String(p)),n(!1)}}},u=()=>{window.removeEventListener("message",c),s.current=null};s.current=d=>void c(d),window.addEventListener("message",s.current),window.open(l,"ttc-login","width=480,height=640")},[e]);return h.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 font-sans text-text-100","data-testid":"guest-login",children:h.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-3 rounded-lg border border-border bg-bg-100 px-5 py-6",children:[h.jsx("h1",{className:"text-base font-semibold",children:"登录后进入分享"}),h.jsx("p",{className:"text-[11px] leading-snug text-text-400",children:"使用飞书账号登录,即可在浏览器里与分享给你的 persona 交互,无需安装。"}),r?h.jsxs("p",{className:"text-[11px] leading-snug text-error","data-testid":"guest-login-error",children:["登录失败:",r]}):null,h.jsx("button",{type:"button",disabled:t,onClick:()=>o(),"data-testid":"guest-login-button",className:"w-full rounded border border-border bg-bg-50 px-2 py-1.5 text-xs text-text-200 transition-colors hover:bg-text-100/5 hover:text-text-100 disabled:opacity-50",children:t?"请在弹窗中完成授权…":"飞书登录"})]})})}const T1="clawd-visitor:token";function xde(e,t){const r=`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}`;return t!=null&&t.devPath?`${r}${t.devPath}`:r}function yde(){return{async getUrl(e){const t=localStorage.getItem(T1);if(!t)throw new Error("NO_VISITOR_TOKEN");const n=xde(window.location,{});return await VT(e).upsert({id:"guest",name:"访客",mode:"remote",url:n,token:t}),{url:n}}}}function _de(e){const t=n=>{document.documentElement.classList.toggle("dark",n==="dark")};return t(e.theme.mode),e.onThemeChange(n=>t(n.mode))}function bde(){const e=Ni(),t=g.useMemo(()=>Hz(e),[e]);return h.jsx(Sz,{cache:t.cache,children:h.jsx(Ez,{children:h.jsx(gde,{})})})}function wde({host:e}){const[t]=g.useState(()=>localStorage.getItem(T1)),[n,r]=g.useState(!1),[i,s]=g.useState(null);return g.useEffect(()=>_de(e),[e]),g.useEffect(()=>{if(!t)return;let o=!1;return yde().getUrl(e).then(()=>{o||r(!0)}).catch(a=>{o||s(a instanceof Error?a.message:String(a))}),()=>{o=!0}},[e,t]),t?h.jsx(Xw,{host:e,children:h.jsx(TS,{children:i?h.jsxs("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 text-center text-xs text-error","data-testid":"guest-share-connect-error",children:["连接失败:",i]}):n?h.jsx(_z,{host:e,children:h.jsx(bde,{})}):h.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 text-xs text-text-400",children:"正在连接…"})})}):h.jsx(Xw,{host:e,children:h.jsx(TS,{children:h.jsx(vde,{onAuthed:o=>{localStorage.setItem(T1,o),window.location.reload()}})})})}function Sde({filePath:e,oldString:t,newString:n,content:r}){const i=g.useMemo(()=>r!=null?r.split(/\r?\n/).map(s=>({type:"add",text:s})):kde(t??"",n??""),[t,n,r]);return h.jsxs("div",{"data-testid":"inline-diff",className:"min-w-0 max-w-full rounded-lg border border-bg-300/60 bg-bg-50 overflow-hidden text-[12px] font-mono",children:[h.jsx("div",{className:"flex min-w-0 items-center gap-2 px-3 py-1.5 border-b border-bg-300/40 bg-bg-100/30",children:h.jsx("span",{className:"min-w-0 text-text-400 truncate",title:e,children:e})}),h.jsx("div",{className:"max-h-[320px] max-w-full overflow-auto",children:i.map((s,o)=>h.jsxs("div",{"data-testid":`diff-line-${s.type}`,className:ie("flex min-w-max gap-2 px-3 py-0.5 whitespace-pre",s.type==="add"?"bg-success/10 text-success":s.type==="remove"?"bg-error/10 text-error":"text-text-300"),children:[h.jsx("span",{className:"w-3 shrink-0 select-none opacity-60",children:s.type==="add"?"+":s.type==="remove"?"-":" "}),h.jsx("span",{className:"flex-1",children:s.text||" "})]},o))})]})}function kde(e,t){const n=e.split(/\r?\n/),r=t.split(/\r?\n/),i=n.length,s=r.length,o=Array.from({length:i+1},()=>new Array(s+1).fill(0));for(let u=i-1;u>=0;u--)for(let d=s-1;d>=0;d--)o[u][d]=n[u]===r[d]?o[u+1][d+1]+1:Math.max(o[u+1][d],o[u][d+1]);const a=[];let l=0,c=0;for(;l<i&&c<s;)n[l]===r[c]?(a.push({type:"equal",text:n[l]}),l++,c++):o[l+1][c]>=o[l][c+1]?(a.push({type:"remove",text:n[l]}),l++):(a.push({type:"add",text:r[c]}),c++);for(;l<i;)a.push({type:"remove",text:n[l++]});for(;c<s;)a.push({type:"add",text:r[c++]});return a}function Cde({items:e}){return e.length===0?null:h.jsxs("div",{"data-testid":"todo-checklist",className:"rounded-lg border border-bg-300/60 bg-bg-50 px-3 py-2 text-[13px]",children:[h.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-400/70 mb-1.5",children:"Todos"}),h.jsx("ul",{className:"flex flex-col gap-1",children:e.map((t,n)=>{const r=t.status==="in_progress"&&t.activeForm||t.content;return h.jsxs("li",{"data-testid":`todo-item-${t.status}`,className:"flex items-start gap-2",children:[h.jsx(Ede,{status:t.status}),h.jsx("span",{className:ie("flex-1 leading-snug",t.status==="completed"?"text-text-400 line-through":t.status==="in_progress"?"text-text-100 font-medium":"text-text-200"),children:r})]},n)})})]})}function Ede({status:e}){return e==="completed"?h.jsx(e_,{className:"w-3.5 h-3.5 text-success mt-0.5 shrink-0"}):e==="in_progress"?h.jsx(Tn,{className:"w-3.5 h-3.5 text-warning mt-0.5 shrink-0 animate-spin"}):h.jsx(N7,{className:"w-3.5 h-3.5 text-text-400 mt-0.5 shrink-0"})}function Ide(e){const t=e??{};return Array.isArray(t.todos)?t.todos.map(n=>{if(!n||typeof n!="object")return null;const r=n,i=typeof r.content=="string"?r.content:"",s=r.status==="pending"||r.status==="in_progress"||r.status==="completed"?r.status:"pending",o=typeof r.activeForm=="string"?r.activeForm:void 0;return{content:i,status:s,activeForm:o}}).filter(n=>n!==null):[]}function Nde({description:e,prompt:t,subagentType:n}){return h.jsxs("div",{"data-testid":"task-checklist",className:"rounded-lg border border-bg-300/60 bg-bg-50 px-3 py-2 text-[13px]",children:[h.jsxs("div",{className:"flex items-center gap-2 text-text-200 font-medium",children:[h.jsx(em,{className:"w-3.5 h-3.5 text-accent shrink-0"}),h.jsx("span",{className:"truncate",children:e||"subagent task"}),n?h.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded-md text-[10px] font-mono bg-accent/10 text-accent",children:n}):null]}),t?h.jsx("div",{className:"mt-1 text-[12px] text-text-400 leading-snug line-clamp-3",children:t}):null]})}function Tde(e){const t=e??{};return{description:typeof t.description=="string"?t.description:"",prompt:typeof t.prompt=="string"?t.prompt:void 0,subagentType:typeof t.subagent_type=="string"?t.subagent_type:void 0}}const Pde={render:({input:e})=>Je.createElement(Cde,{items:Ide(e)})},Rde={render:({input:e})=>{const{description:t,prompt:n,subagentType:r}=Tde(e);return Je.createElement(Nde,{description:t,prompt:n,subagentType:r})}},DE={render:({input:e,output:t,error:n,pending:r,fileScope:i,onShareFile:s,onOpenInTab:o,onPreviewMarkdown:a})=>{const l=Ade(e),c=l?Je.createElement(Sde,{filePath:l.filePath,oldString:l.oldString,newString:l.newString,content:l.content}):void 0;return Je.createElement(wM,{tool:Mde(e),input:e,output:t,error:n,pending:r,expandedBody:c,...i?{fileScope:i}:{},...s?{onShareFile:s}:{},...o?{onOpenInTab:o}:{},...a?{onPreviewMarkdown:a}:{}})}};function Mde(e){const t=e??{};return"content"in t&&t.content!==void 0?"Write":("old_string"in t&&t.old_string!==void 0,"Edit")}function Ade(e){const t=e??{},n=typeof t.file_path=="string"?t.file_path:null;if(!n)return null;const r=typeof t.old_string=="string"?t.old_string:void 0,i=typeof t.new_string=="string"?t.new_string:void 0,s=typeof t.content=="string"?t.content:void 0;return r==null&&i==null&&s==null?null:{filePath:n,oldString:r,newString:i,content:s}}for(const e of["claude",c9])za.register(e,"TodoWrite",Pde),za.register(e,"Task",Rde),za.register(e,"Edit",DE),za.register(e,"Write",DE);const Rj=document.getElementById("root");if(!Rj)throw new Error("guest-main: #root not found");const jde=dO({});I0.createRoot(Rj).render(h.jsx(Je.StrictMode,{children:h.jsx(wde,{host:jde})}));
|
|
622
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Vce="DialogDescriptionWarning",Kce=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ej(Vce).contentName}}.`;return g.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Gce=FA,Yce=WA,tj=qA,nj=VA,rj=GA,ij=XA,Xce=QA;const sj=Gce,Zce=Yce,oj=g.forwardRef(({className:e,...t},n)=>h.jsx(tj,{ref:n,className:ie("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",e),...t}));oj.displayName=tj.displayName;const Pb=g.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(Zce,{children:[h.jsx(oj,{}),h.jsxs(nj,{ref:r,className:ie("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2","gap-4 rounded-lg border border-border bg-elevated p-6 shadow-lg",e),...n,children:[t,h.jsxs(Xce,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-accent",children:[h.jsx(Qr,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Pb.displayName=nj.displayName;const aj=({className:e,...t})=>h.jsx("div",{className:ie("flex flex-col space-y-1.5 text-left",e),...t});aj.displayName="DialogHeader";const Rb=g.forwardRef(({className:e,...t},n)=>h.jsx(rj,{ref:n,className:ie("text-lg font-semibold leading-none text-text-100",e),...t}));Rb.displayName=rj.displayName;const lj=g.forwardRef(({className:e,...t},n)=>h.jsx(ij,{ref:n,className:ie("text-sm text-text-300",e),...t}));lj.displayName=ij.displayName;function Qce({persona:e,open:t,onClose:n,onDelete:r,embedded:i,onLoadPersonality:s,onSavePersonality:o,onLoadPersonalityLocal:a,onSavePersonalityLocal:l,hasPersonalityLocal:c=!1,onDirtyChange:u,initialPersonality:d,onShareCapability:f,readOnly:p=!1,larkBot:m}){const[v,w]=g.useState(!1),[x,_]=g.useState(!1),b=v||x,S=Ze.useRef(u);g.useEffect(()=>{S.current=u}),g.useEffect(()=>{var k;(k=S.current)==null||k.call(S,b)},[b]);const C=()=>{b&&!window.confirm("修改未保存,确定关闭?")||n()};return t?h.jsxs(h.Fragment,{children:[!i&&h.jsx("div",{className:"absolute inset-0 z-30 bg-black/30",onClick:C,"aria-hidden":"true"}),h.jsxs("aside",{className:i?"flex h-full w-full flex-col bg-bg-0":"absolute right-0 top-0 z-40 flex h-full w-[420px] flex-col bg-bg-0 border-l border-border shadow-xl","data-testid":"persona-settings-drawer",children:[h.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx(LF,{className:"h-4 w-4 text-text-300"}),h.jsx("span",{className:"text-[13px] font-medium text-text-100 truncate",children:"Persona 设置"})]}),h.jsx("button",{type:"button",onClick:C,"aria-label":"关闭",className:"rounded-sm p-1.5 text-text-400 hover:bg-bg-200 hover:text-text-100",children:h.jsx(Qr,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-6 flex flex-col gap-4",children:[h.jsxs("header",{className:"flex items-start justify-between gap-3",children:[h.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h2",{className:"text-lg font-semibold text-text-100 truncate",children:e.label}),e.public?h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-bg-200 px-1.5 py-0.5 text-[10px] text-text-200",children:[h.jsx(eF,{className:"h-3 w-3"})," 公开"]}):h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-error-dim px-1.5 py-0.5 text-[10px] text-error",children:[h.jsx(Q7,{className:"h-3 w-3"})," 已关闭"]})]}),h.jsx("span",{className:"font-mono text-[11px] text-text-400 truncate","data-testid":"persona-id-subtitle",children:e.personaId})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[f?h.jsxs("button",{type:"button",onClick:f,"aria-label":"分享给他人",title:"分享给他人",className:"inline-flex items-center gap-1 rounded-sm px-2 py-1.5 text-xs text-text-200 hover:bg-bg-200 hover:text-text-100",children:[h.jsx(n_,{className:"h-3.5 w-3.5"}),"分享"]}):null,r?h.jsx("button",{type:"button",onClick:r,"aria-label":"删除 persona",className:"rounded-sm p-1.5 text-text-400 hover:bg-bg-200 hover:text-error",children:h.jsx(r_,{className:"h-4 w-4"})}):null]})]}),h.jsx("hr",{className:"border-border"}),m?h.jsxs(h.Fragment,{children:[h.jsx(tue,{...m}),h.jsx("hr",{className:"border-border"})]}):null,s?h.jsxs(h.Fragment,{children:[h.jsx(PE,{onLoad:s,...o&&!e.personalityManaged?{onSave:o}:{},onDirtyChange:w,initialPersonality:d,readOnly:p||!!e.personalityManaged,title:e.personalityManaged?"内置人格":"人格 (Personality)",hint:e.personalityManaged?p?"这个 persona 自带的人格,随 clawd 版本更新。":"这个 persona 自带的人格,随 clawd 版本更新——在这里改不会保留,要加自己的规则请写下面的「你的补充」。":void 0,testIdPrefix:"persona-personality"}),(e.personalityManaged||c)&&a?h.jsx(PE,{onLoad:a,...l?{onSave:l}:{},onDirtyChange:_,readOnly:p,title:p?"补充设定":"你的补充",hint:p?"这个 persona 的补充设定,由它的主人维护。与内置人格叠加生效。":"写入 <persona-dir>/.clawd/personality.local.md,不会被更新覆盖。与内置人格叠加生效,冲突时以你写的为准;对 owner 和访客会话都生效,要区分对象请在正文里写明。只对新启动的会话生效。",placeholder:"例:回答一律先给结论,再展开。",testIdPrefix:"persona-personality-local"}):null,h.jsx("hr",{className:"border-border"})]}):null,h.jsx(nue,{settings:e.sandboxSettings??null}),h.jsx("hr",{className:"border-border"}),h.jsx(rue,{skills:e.skills??[]}),h.jsx("hr",{className:"border-border"}),h.jsx(iue,{plugins:e.plugins??[]})]})]})]}):null}function TE({qrUrl:e,busy:t,onCancel:n,title:r="扫码关联飞书 Bot",hint:i="用手机飞书扫码,按页面提示创建应用。确认后自动完成关联。"}){const[s,o]=g.useState(null);return g.useEffect(()=>{let a=!1;return dd.toDataURL(e,{width:240,margin:1}).then(l=>{a||o(l)}).catch(()=>{a||o(null)}),()=>{a=!0}},[e]),h.jsx(sj,{open:!0,onOpenChange:a=>a||n==null?void 0:n(),children:h.jsxs(Pb,{className:"max-w-xs","data-testid":"lark-bot-qr-dialog",onInteractOutside:a=>a.preventDefault(),onEscapeKeyDown:a=>a.preventDefault(),children:[h.jsx(aj,{children:h.jsx(Rb,{children:r})}),h.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s?h.jsx("img",{src:s,alt:"飞书扫码创建应用二维码",className:"h-60 w-60 rounded bg-white p-2","data-testid":"lark-bot-qr-img"}):h.jsx("div",{className:"flex h-60 w-60 items-center justify-center text-[12px] text-text-400",children:"二维码生成中…"}),h.jsx("span",{className:"text-center text-[12px] text-text-300",children:i}),n?h.jsx("button",{type:"button",disabled:t,onClick:n,className:"rounded border border-border px-3 py-1.5 text-[12px] text-text-300 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-provision-cancel",children:"取消"}):null]})]})})}const Jce={expired:"二维码已过期,请重新扫码。",cancelled:"已取消。",access_denied:"你在飞书上取消了本次授权。",lark_protocol_error:"飞书返回了未预期的响应,请重试。",cloud_unreachable:"云端暂时不可达,请稍后重试。",internal_error:"关联失败。若飞书中已创建应用,可在开发者后台删除后重试,或改用手动绑定填入其凭证。"},eue=new Set(["expired","access_denied","lark_protocol_error","cloud_unreachable","internal_error"]);function tue({status:e,onProvision:t,onCancelProvision:n,onBindManual:r,onUnbind:i,onUpgrade:s,runtime:o="local"}){const[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(""),[p,m]=g.useState(""),[v,w]=g.useState(null),x=T=>{T&&(l(!0),u(null),T().catch(E=>u(E instanceof Error?E.message:String(E))).finally(()=>l(!1)))},_=()=>{w(null),x(t)},b=!a&&!!d&&!!p,S=()=>{!b||!r||x(()=>r({appId:d,appSecret:p}))},C=ed(S),k=h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(em,{className:"h-3.5 w-3.5 text-text-400","aria-hidden":!0}),h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"飞书 Bot"})]});return e?h.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":"lark-bot-section",children:[k,e.state==="unbound"||e.state==="provisioning"?h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"text-[11px] text-text-400",children:["关联一个飞书 bot 后,这个 persona 就是它:拉进群后群成员 @ 它提问、或直接私聊它,",o==="cloud"?"云 Persona 在云端处理消息,回复自动发回去。":"推理跑在你本机,回复自动发回去。"]}),t?h.jsx("button",{type:"button",disabled:a||e.state==="provisioning",onClick:_,className:"self-start rounded border border-border bg-bg-200 px-3 py-1.5 text-[12px] font-medium text-text-100 hover:bg-bg-300 disabled:opacity-50","data-testid":"lark-bot-provision",children:e.state==="provisioning"?"等待扫码…":"扫码关联飞书 Bot"}):null,e.state==="unbound"&&e.errorReason&&!v?h.jsxs("div",{className:"flex flex-col gap-1.5 rounded border border-error bg-error-dim px-2 py-1.5","data-testid":"lark-bot-provision-error",children:[h.jsx("span",{className:"text-[11px] text-error",children:Jce[e.errorReason]}),h.jsxs("div",{className:"flex gap-1.5",children:[eue.has(e.errorReason)&&t?h.jsx("button",{type:"button",disabled:a,onClick:_,className:"rounded border border-border px-2 py-1 text-[11px] text-text-100 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-provision-retry",children:"重新扫码"}):null,h.jsx("button",{type:"button",onClick:()=>w(e.errorReason??null),className:"rounded border border-border px-2 py-1 text-[11px] text-text-300 hover:bg-bg-200","data-testid":"lark-bot-provision-error-dismiss",children:"知道了"})]})]}):null,e.state==="provisioning"&&e.qrUrl?h.jsx(TE,{qrUrl:e.qrUrl,busy:a,onCancel:n?()=>x(n):void 0}):null,r&&e.state==="unbound"?h.jsxs("details",{"data-testid":"lark-bot-manual-details",children:[h.jsx("summary",{className:"cursor-pointer text-[11px] text-text-400 hover:text-text-300",children:"已有飞书应用?手动填入凭证"}),h.jsxs("div",{className:"mt-1.5 flex flex-col gap-1.5","data-testid":"lark-bot-manual-form",children:[h.jsx("span",{className:"text-[11px] text-text-400",children:"先在飞书开放平台(open.feishu.cn)创建企业自建应用并启用机器人能力,再填入凭证:"}),h.jsx("input",{value:d,onChange:T=>f(T.target.value),...C,placeholder:"App ID(cli_ 开头)",className:"rounded border border-border bg-bg-100 px-2 py-1 text-[12px] text-text-200","data-testid":"lark-bot-manual-appid"}),h.jsx("input",{value:p,onChange:T=>m(T.target.value),...C,type:"password",placeholder:"App Secret",className:"rounded border border-border bg-bg-100 px-2 py-1 text-[12px] text-text-200","data-testid":"lark-bot-manual-secret"}),h.jsx("button",{type:"button",disabled:!b,onClick:S,className:"self-start rounded border border-border px-3 py-1.5 text-[12px] text-text-100 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-manual-submit",children:a?"绑定中…":"绑定"})]})]}):null]}):null,e.state==="bound"||e.state==="broken"?h.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.state==="bound"&&e.needsUpgrade?h.jsxs("div",{className:"flex flex-col gap-1.5 rounded border border-warning/30 bg-warning-dim px-2 py-1.5","data-testid":"lark-bot-upgrade-notice",children:[h.jsx("span",{className:"text-[11px] text-warning",children:"这个 bot 的权限配置有更新,扫码重新授权后生效。在此之前,新增能力对它不起作用。"}),s?h.jsx("button",{type:"button",disabled:a,onClick:()=>x(s),className:"self-start rounded border border-warning/30 bg-warning/10 px-2 py-1 text-[11px] text-warning hover:bg-warning/20 disabled:opacity-50","data-testid":"lark-bot-upgrade",children:"更新授权"}):null]}):null,e.state==="bound"&&e.upgradeQrUrl?h.jsx(TE,{qrUrl:e.upgradeQrUrl,busy:a,onCancel:n?()=>x(n):void 0,title:"扫码更新授权",hint:"用手机飞书扫码,确认页会列出将要添加的权限。期间 bot 照常服务,不会中断。"}):null,e.state==="broken"?h.jsxs("div",{className:"rounded border border-error bg-error-dim px-2 py-1.5 text-[11px] text-error","data-testid":"lark-bot-broken",children:["Bot 凭证失效:",e.brokenReason??"未知原因","。请解绑后重新填入有效凭证绑定。"]}):null,h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-text-200",children:[h.jsx("span",{className:"font-medium text-text-100",children:e.botName??"未命名 bot"}),e.appId?h.jsx("span",{className:"text-[11px] text-text-400",children:e.appId}):null]}),h.jsx("span",{className:"text-[11px] text-text-400",children:"把 bot 拉进任意飞书群,群成员 @ 它即可提问。"}),e.groups.length>0?h.jsx("ul",{className:"flex flex-col gap-0.5","data-testid":"lark-bot-groups",children:e.groups.map(T=>h.jsxs("li",{className:"text-[11px] text-text-300 truncate",children:["· ",T.chatName??T.chatId]},T.chatId))}):h.jsx("span",{className:"text-[11px] text-text-400","data-testid":"lark-bot-groups-empty",children:"还没有服务中的群。"}),i?h.jsx("button",{type:"button",disabled:a,onClick:()=>x(i),className:"self-start rounded border border-border px-3 py-1.5 text-[12px] text-error hover:bg-error-dim disabled:opacity-50","data-testid":"lark-bot-unbind",children:"解绑"}):null]}):null,c?h.jsx("div",{className:"rounded border border-error bg-error-dim px-2 py-1.5 text-[11px] text-error","data-testid":"lark-bot-error",children:c}):null]}):h.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":"lark-bot-section",children:[k,h.jsx("span",{className:"text-[11px] text-text-400",children:"状态加载中…"})]})}function nue({settings:e}){var t,n,r,i,s,o,a,l,c,u,d,f,p;return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-sandbox-setting-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Sandbox Setting"}),h.jsx("span",{className:"text-[11px] text-text-400",children:"约束此 persona 的沙箱权限(只读,需通过文件修改)。"})]}),e==null?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-sandbox-setting-empty",children:"暂无 sandbox 配置"}):h.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-border bg-bg-100 px-3 py-2",children:[h.jsx(xh,{label:"权限默认模式",value:((t=e.permissions)==null?void 0:t.defaultMode)??"—"}),h.jsx(xh,{label:"沙箱启用",value:E0((n=e.sandbox)==null?void 0:n.enabled)}),h.jsx(xh,{label:"沙箱内自动放行 Bash",value:E0((r=e.sandbox)==null?void 0:r.autoAllowBashIfSandboxed)}),h.jsx(xh,{label:"允许非沙箱命令",value:E0((i=e.sandbox)==null?void 0:i.allowUnsandboxedCommands)}),h.jsxs("div",{className:"mt-1 flex flex-col gap-1.5 border-t border-border pt-1.5",children:[h.jsx(xc,{label:"沙箱外命令",paths:(s=e.sandbox)==null?void 0:s.excludedCommands}),h.jsx(xc,{label:"允许读取",paths:(a=(o=e.sandbox)==null?void 0:o.filesystem)==null?void 0:a.allowRead}),h.jsx(xc,{label:"拒绝读取",paths:(c=(l=e.sandbox)==null?void 0:l.filesystem)==null?void 0:c.denyRead}),h.jsx(xc,{label:"允许写入",paths:(d=(u=e.sandbox)==null?void 0:u.filesystem)==null?void 0:d.allowWrite}),h.jsx(xc,{label:"拒绝写入",paths:(p=(f=e.sandbox)==null?void 0:f.filesystem)==null?void 0:p.denyWrite})]})]})]})}function E0(e){return e===!0?"是":e===!1?"否":"—"}function xh({label:e,value:t}){return h.jsxs("div",{className:"flex items-center justify-between gap-3 text-[12px]",children:[h.jsx("span",{className:"text-text-300",children:e}),h.jsx("span",{className:"font-mono text-text-100",children:t})]})}function xc({label:e,paths:t}){const n=!t||t.length===0;return h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[11px] text-text-300",children:e}),n?h.jsx("span",{className:"text-[11px] text-text-400",children:"—"}):h.jsx("div",{className:"flex flex-wrap gap-1",children:t.map((r,i)=>h.jsx("span",{className:"rounded-sm border border-border bg-bg-0 px-1.5 py-0.5 font-mono text-[11px] text-text-200",children:r},`${e}-${i}-${r}`))})]})}function rue({skills:e}){return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-skills-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Persona Skills"}),h.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-text-300",children:e.length})]}),h.jsxs("span",{className:"text-[11px] text-text-400",children:["此 persona 私有 skills(来自"," ",h.jsx("code",{className:"font-mono",children:"<persona-dir>/.claude/skills/"}),")。"]})]}),e.length===0?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-skills-empty",children:"暂无 skills"}):h.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border bg-bg-100",children:e.map(t=>h.jsxs("li",{className:"flex flex-col gap-0.5 px-3 py-2","data-testid":"persona-skill-row",children:[h.jsx("span",{className:"font-mono text-[13px] text-text-100",children:t.name}),t.description?h.jsx("span",{className:"text-[12px] text-text-300",children:t.description}):h.jsx("span",{className:"text-[11px] text-text-400 italic",children:"无描述"})]},t.name))})]})}function iue({plugins:e}){return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-plugins-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Enabled Plugins"}),h.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-text-300",children:e.length})]}),h.jsxs("span",{className:"text-[11px] text-text-400",children:["此 persona 已启用的插件(来自"," ",h.jsx("code",{className:"font-mono",children:"<persona-dir>/.claude/settings.json"})," ","的 ",h.jsx("code",{className:"font-mono",children:"enabledPlugins"}),")。"]})]}),e.length===0?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-plugins-empty",children:"暂无启用插件"}):h.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border bg-bg-100",children:e.map(t=>h.jsx("li",{className:"flex flex-col gap-0.5 px-3 py-2","data-testid":"persona-plugin-row",children:h.jsx("span",{className:"font-mono text-[13px] text-text-100",children:t.id})},t.id))})]})}function PE({onLoad:e,onSave:t,onDirtyChange:n,initialPersonality:r,readOnly:i=!1,title:s,hint:o,placeholder:a,testIdPrefix:l}){const c=r!==void 0,[u,d]=g.useState(c),[f,p]=g.useState(c?r:""),[m,v]=g.useState(c?r:""),[w,x]=g.useState(null),[_,b]=g.useState(!1),[S,C]=g.useState(null),k=Ze.useRef(e),T=Ze.useRef(t),E=Ze.useRef(n);Ze.useEffect(()=>{k.current=e,T.current=t,E.current=n});const D=Ze.useCallback(()=>{d(!1),x(null),k.current().then(A=>{p(A),v(A),d(!0)}).catch(A=>{x(A instanceof Error?A.message:String(A))})},[]);Ze.useEffect(()=>{c||D()},[c,D]);const N=!i&&u&&m!==f;Ze.useEffect(()=>{i||E.current(N)},[N,i]);const L=()=>{T.current&&(b(!0),C(null),T.current(m).then(()=>{p(m),b(!1)}).catch(A=>{C(A instanceof Error?A.message:String(A)),b(!1)}))},R=()=>{v(f),C(null)},M=ed(()=>{!N||_||L()},()=>{!N||_||R()});return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":`${l}-section`,children:[h.jsx("span",{className:"text-[12px] font-medium text-text-200",children:s}),w?h.jsxs("div",{"data-testid":`${l}-load-error`,className:"rounded-md border border-error bg-error-dim px-3 py-2 text-[12px] text-error flex items-center justify-between gap-2",children:[h.jsxs("span",{children:["加载失败:",w]}),h.jsx("button",{type:"button",onClick:D,className:"rounded-sm border border-error px-2 py-0.5 text-[11px] hover:bg-error/10",children:"重试"})]}):null,S?h.jsxs("div",{"data-testid":`${l}-save-error`,className:"rounded-md border border-error bg-error-dim px-3 py-2 text-[12px] text-error",children:["保存失败:",S]}):null,h.jsx("textarea",{"data-testid":`${l}-textarea`,value:m,onChange:A=>v(A.target.value),...M,readOnly:i,disabled:!i&&(!u||_),placeholder:u?a??"":"加载中…",rows:8,className:"min-h-[8rem] max-h-[18rem] resize-y rounded-md border border-border bg-bg-100 px-2 py-1.5 font-mono text-[11px] text-text-100 disabled:opacity-60"}),o?h.jsx("p",{className:"text-[10px] text-text-400",children:o}):i?null:h.jsx("p",{className:"text-[10px] text-text-400",children:"写入人格文件。修改只对新启动的会话生效。"}),u&&N?h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:R,disabled:_,className:"rounded-sm border border-border px-2 py-1 text-[12px] text-text-200 hover:bg-bg-200 disabled:opacity-60",children:"放弃"}),h.jsx("button",{type:"button",onClick:L,disabled:_,"data-testid":`${l}-save-btn`,className:"rounded-sm bg-accent-dim px-2 py-1 text-[12px] text-text-100 hover:opacity-90 disabled:opacity-60",children:_?"保存中…":"保存"})]}):null]})}const sue={state:"unbound",groups:[]};function oue(e,t,n="local"){const[r,i]=g.useState(null),s=d=>`${n==="cloud"?"cloud:":""}larkBot:${d}`;g.useEffect(()=>{if(!e)return;let d=!1,f=0,p=!1;i(null);const m=async()=>{const _=++f;p=!0;try{const b=await e.request(s("status"),{personaId:t});if(d||_!==f)return;i(S=>n==="cloud"&&(S!=null&&S.upgradeQrUrl)&&b.state==="bound"&&b.needsUpgrade!==!1?{...b,upgradeQrUrl:S.upgradeQrUrl}:b.state==="unbound"&&!b.errorReason&&(S==null?void 0:S.state)==="unbound"&&S.errorReason?{...b,errorReason:S.errorReason}:b)}catch{!d&&_===f&&i(b=>b??sue)}finally{_===f&&(p=!1)}};m();const v=e.on("larkBot:state",_=>{const b=_;if(b.personaId!==t)return;const{personaId:S,...C}=b;++f,p=!1,i(C)}),w=e.on("daemon:connected",()=>{m()}),x=n==="cloud"?setInterval(()=>{p||m()},5e3):null;return()=>{d=!0,x&&clearInterval(x),v(),w()}},[e,t,n]);const o=g.useCallback(async()=>{e&&await e.request(s("provision"),{personaId:t})},[e,t,n]),a=g.useCallback(async()=>{e&&await e.request(s("provisionCancel"),{personaId:t})},[e,t,n]),l=g.useCallback(async d=>{e&&await e.request(s("bindManual"),{personaId:t,...d})},[e,t,n]),c=g.useCallback(async()=>{e&&await e.request(s("upgrade"),{personaId:t})},[e,t,n]),u=g.useCallback(async()=>{e&&await e.request(s("unbind"),{personaId:t})},[e,t,n]);return{status:r,provision:o,cancelProvision:a,bindManual:l,unbind:u,upgrade:c}}function aue(e,t="owner"){var T;const{persona:n}=r4(e),r=qz(e),i=Vz(),s=Kz(),{httpBaseUrl:o}=Qp(),a=Ni(),l=oue(t==="guest"?null:a,e),{capabilities:c}=Rm((n==null?void 0:n.tool)??"claude"),u=g.useMemo(()=>!(n!=null&&n.public)||!o||/^https?:\/\/(127\.0\.0\.1|localhost|0\.0\.0\.0|\[?::1\]?)([:/]|$)/i.test(o)?null:`${o}/s/${e}`,[n==null?void 0:n.public,o,e]),d=g.useCallback((E,D)=>{i(e,D).catch(N=>{$e("persona",`${E} failed`,N)})},[i,e]),f=g.useCallback(E=>d("togglePublic",{public:E}),[d]),p=g.useCallback(async E=>{await i(e,{codexSandbox:{network:E}}),await r.refresh()},[i,e,r]),m=g.useCallback(E=>d("changeTool",{tool:E}),[d]),v=g.useCallback(E=>d("changeModel",{model:E}),[d]),w=g.useCallback(E=>d("changeEffort",{effort:E}),[d]),x=g.useCallback(E=>d("toggleFastMode",{serviceTier:E?$f.fast:$f.standard}),[d]),_=g.useCallback(()=>!n||!confirm(`删除 persona "${n.label}"?`)?!1:(s(e).catch(E=>{$e("persona","delete failed",E)}),!0),[n,s,e]),b=g.useCallback(async()=>r.loaded?r.personality:(await r.refresh()).personality,[r]),S=g.useCallback(async E=>{await i(e,{personality:E}),await r.refresh()},[i,e,r]),C=g.useCallback(async()=>r.loaded?r.personalityLocal:(await r.refresh()).personalityLocal,[r]),k=g.useCallback(async E=>{await i(e,{personalityLocal:E}),await r.refresh()},[i,e,r]);return{persona:n,detail:r,configSchema:(c==null?void 0:c.configSchema)??[],larkBot:l,guestShareUrl:u,changeTool:m,changeModel:v,changeEffort:w,toggleFastMode:x,togglePublic:f,guestNetwork:((T=r.codexSandbox)==null?void 0:T.network)??!1,toggleGuestNetwork:p,remove:_,loadPersonality:b,savePersonality:S,loadPersonalityLocal:C,savePersonalityLocal:k}}function lue({personaId:e,open:t,onClose:n,api:r,embedded:i,onDirtyChange:s,onShareCapability:o,viewerRole:a="owner"}){const l=aue(e,a),{persona:c,detail:u}=l,d=g.useCallback(()=>{l.remove()&&n()},[l,n]);if(!c)return null;const f=a==="guest";return h.jsx(Qce,{embedded:i,persona:{...c,skills:u.skills,plugins:u.plugins,sandboxSettings:u.sandboxSettings,personalityManaged:u.personalityManaged},open:t,onClose:n,onLoadPersonality:l.loadPersonality,onLoadPersonalityLocal:l.loadPersonalityLocal,hasPersonalityLocal:u.personalityLocal!=="",onDirtyChange:s,readOnly:f,...f?{}:{onTogglePublic:l.togglePublic,guestShareUrl:l.guestShareUrl,onChangeTool:l.changeTool,onChangeModel:l.changeModel,onChangeEffort:l.changeEffort,configSchema:l.configSchema,onDelete:d,onSavePersonality:l.savePersonality,onSavePersonalityLocal:l.savePersonalityLocal,larkBot:{status:l.larkBot.status,onProvision:l.larkBot.provision,onCancelProvision:l.larkBot.cancelProvision,onBindManual:l.larkBot.bindManual,onUnbind:l.larkBot.unbind,onUpgrade:l.larkBot.upgrade},...o?{onShareCapability:o}:{}}})}const cue={resolve:()=>{}},uue=g.createContext(cue);function due(){return g.useContext(uue)}const hue={...Qs,h1:({node:e,...t})=>h.jsx("h1",{...t,className:"mt-4 mb-3 text-[18px] font-semibold leading-tight text-text-100"}),h2:({node:e,...t})=>h.jsx("h2",{...t,className:"mt-4 mb-2 text-[16px] font-semibold leading-tight text-text-100"}),h3:({node:e,...t})=>h.jsx("h3",{...t,className:"mt-3 mb-2 text-[14px] font-semibold leading-tight text-text-100"}),h4:({node:e,...t})=>h.jsx("h4",{...t,className:"mt-3 mb-1 text-[13px] font-semibold text-text-100"}),h5:({node:e,...t})=>h.jsx("h5",{...t,className:"mt-2 mb-1 text-[12px] font-semibold text-text-100"}),h6:({node:e,...t})=>h.jsx("h6",{...t,className:"mt-2 mb-1 text-[12px] font-semibold text-text-300"}),p:({node:e,...t})=>h.jsx("p",{...t,className:"my-2 leading-relaxed"}),ul:({node:e,...t})=>h.jsx("ul",{...t,className:"my-2 list-disc space-y-1 pl-5"}),ol:({node:e,...t})=>h.jsx("ol",{...t,className:"my-2 list-decimal space-y-1 pl-5"}),li:({node:e,...t})=>h.jsx("li",{...t,className:"leading-relaxed"}),blockquote:({node:e,...t})=>h.jsx("blockquote",{...t,className:"my-2 border-l-2 border-border pl-3 italic text-text-300"}),code:({node:e,className:t,children:n,...r})=>t?h.jsx("code",{...r,className:`${t} font-mono text-[12px]`,children:n}):h.jsx("code",{...r,className:"rounded bg-bg-50 px-1 py-0.5 font-mono text-[12px] text-text-100",children:n}),pre:({node:e,...t})=>h.jsx("pre",{...t,className:"my-2 overflow-auto rounded border border-border bg-bg-0 p-3 text-[12px] font-mono text-text-100"}),hr:({node:e,...t})=>h.jsx("hr",{...t,className:"my-3 border-border"}),table:({node:e,...t})=>h.jsx("table",{...t,className:"my-2 w-full border-collapse text-[12px]"}),thead:({node:e,...t})=>h.jsx("thead",{...t,className:"bg-bg-50"}),th:({node:e,...t})=>h.jsx("th",{...t,className:"border border-border px-2 py-1 text-left font-semibold"}),td:({node:e,...t})=>h.jsx("td",{...t,className:"border border-border px-2 py-1"}),strong:({node:e,...t})=>h.jsx("strong",{...t,className:"font-semibold text-text-100"}),em:({node:e,...t})=>h.jsx("em",{...t,className:"italic"})};function fue(e){const t=e.split("/");return t[t.length-1]||e}function cj({relPath:e,loadMarkdown:t,headerRight:n,showTitleBar:r=!1}){const[i,s]=g.useState(null),[o,a]=g.useState(null),[l,c]=g.useState(!1);return g.useEffect(()=>{if(!e)return;let u=!1;return c(!0),a(null),s(null),(async()=>{try{const d=await t(e);if(u)return;s(d)}catch(d){if(u)return;a(d.message||String(d))}finally{u||c(!1)}})(),()=>{u=!0}},[e,t]),h.jsxs("div",{className:"flex flex-col h-full",children:[r&&e?h.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[h.jsx("div",{"data-testid":"md-preview-title",className:"truncate text-[13px] font-medium text-text-100",title:e,children:fue(e)}),h.jsx("div",{className:"flex items-center gap-1",children:n})]}):null,h.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 text-[13px] text-text-100",children:l?h.jsx("div",{"data-testid":"md-preview-loading",className:"text-text-400",children:"Loading…"}):o?h.jsx("div",{"data-testid":"md-preview-error",className:"text-destructive whitespace-pre-wrap",children:o}):i!==null?h.jsx("div",{"data-testid":"md-preview-content",className:"max-w-none",children:h.jsx(yl,{remarkPlugins:[_l],components:hue,children:i})}):null})]})}function pue({open:e,onOpenChange:t,relPath:n,loadMarkdown:r,onShare:i}){return e?h.jsx("div",{"data-testid":"md-preview-drawer",className:`${db} z-50 flex w-1/2 max-w-[900px] flex-col border-l border-border bg-elevated shadow-2xl`,children:h.jsx(cj,{relPath:n,loadMarkdown:r,showTitleBar:!0,headerRight:h.jsxs(h.Fragment,{children:[i?h.jsx("button",{type:"button","data-testid":"md-preview-share","aria-label":"Share rendered preview link",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded text-text-400 hover:bg-bg-50 hover:text-text-200",children:h.jsx(lF,{className:"h-4 w-4"})}):null,h.jsx("button",{type:"button","aria-label":"Close preview",onClick:()=>t(!1),className:"inline-flex h-6 w-6 items-center justify-center rounded text-text-400 hover:bg-bg-50 hover:text-text-200",children:h.jsx(Qr,{className:"h-4 w-4"})})]})})}):null}const RE=4;function mue({children:e,onHeightChange:t}){const n=g.useRef(null),[r,i]=g.useState(0);return g.useEffect(()=>{const s=n.current;if(!s)return;const o=()=>i(s.offsetHeight>0?s.offsetHeight+RE*2:0);if(o(),typeof ResizeObserver>"u")return;const a=new ResizeObserver(o);return a.observe(s),()=>a.disconnect()},[]),g.useEffect(()=>{t==null||t(r)},[r,t]),h.jsx("div",{"data-testid":"chat-floating-dock","data-height":r,className:"relative z-20 h-0 shrink-0",children:h.jsx("div",{ref:n,className:"absolute left-4 right-4 flex flex-col items-end gap-1",style:{bottom:RE},children:e})})}function gue(e,t,n,r,i,s){const o=ym(),[a,l]=g.useState(null),[c,u]=g.useState(i??null),[d,f]=g.useState(!1),[p,m]=g.useState(!1),[v,w]=g.useState(null),x=g.useRef({api:e,sessionId:t,enabled:n,epoch:0,read:null,again:!1,mutating:!1}),_=g.useRef({api:e,sessionId:t,enabled:n});_.current={api:e,sessionId:t,enabled:n};const b=g.useRef(t),S=g.useRef(async()=>{}),C=E=>{if(E.workspace!==void 0&&l(E.workspace),E.binding!==void 0)u(E.binding);else if(E.workspace){const{workspaceId:D,repoId:N,owner:L,name:R,sourceBranch:M,defaultBranch:A}=E.workspace;u({workspaceId:D,repoId:N,owner:L,name:R,sourceBranch:M,defaultBranch:A})}},k=g.useCallback(async()=>{const E=x.current;if(!n||E.sessionId!==t||E.api!==e)return;if(E.mutating){E.again=!0;return}if(E.read)return E.again=!0,E.read;const D=E.epoch;f(!0);const N=(async()=>{try{const L=await e.cloudWorkspace({sessionId:t,action:"status"});x.current===E&&E.epoch===D&&_.current.sessionId===t&&(C(L),w(null))}catch(L){x.current===E&&E.epoch===D&&w(L.message)}finally{x.current===E&&(E.read=null,f(!1),E.again&&!E.mutating&&(E.again=!1,S.current()))}})();return E.read=N,N},[e,t,n]);S.current=k;const T=g.useCallback(async(E,D)=>{const N=x.current;if(!n||N.sessionId!==t)throw new Error("Cloud workspace unavailable");const L=E.action==="bind",R=["repositories","branches"].includes(E.action);if(L&&N.mutating)throw new Error("工作区操作正在进行");L&&(N.mutating=!0,N.epoch++,N.again=!1,m(!0),w(null));try{const M=await(D?e.cloudWorkspace({...E,sessionId:t},{requestId:D}):e.cloudWorkspace({...E,sessionId:t}));return x.current===N&&_.current.sessionId===t&&(C(M),R||w(null)),M}catch(M){throw x.current===N&&!R&&w(M.message),M}finally{L&&x.current===N&&(N.mutating=!1,m(!1),(E.action==="bind"||N.again)&&(N.again=!1,S.current()))}},[e,t,n]);return g.useEffect(()=>{const E={api:e,sessionId:t,enabled:n,epoch:0,read:null,again:!1,mutating:!1};return x.current=E,b.current!==t&&(b.current=t,l(null),u(i??null)),w(null),m(!1),f(!1),n&&S.current(),()=>{E.epoch++,x.current===E&&(x.current={...E,enabled:!1,again:!1})}},[e,t,n]),g.useEffect(()=>{if(!n||!r)return;const E=r.on("session:event",N=>{var R;const L=N;L.sessionId===t&&((R=L.event)==null?void 0:R.kind)==="session_init"&&S.current()}),D=r.on("daemon:connected",()=>{S.current()});return()=>{E(),D()}},[r,t,n]),g.useEffect(()=>{if(!(!r||!n))return r.on("cloud:workspace:timing",E=>{const D=E;if(D.sessionId===t)try{o==null||o.push({level:"info",msg:"cloud.workspace.transport."+D.phase,sessionId:t,meta:D})}catch{}})},[r,n,o,t]),{sessionId:t,workspace:a,binding:c,branchIntent:s,loading:d,busy:p,error:v,refresh:k,run:T}}function vue(e,t,n=()=>performance.now(),r){const i="workspace-"+crypto.randomUUID(),s=n(),o=r!==void 0&&Number.isFinite(r)&&r>=0&&r<=s?r:s,a=Math.round(s-o);let l,c,u="ok",d=!1;const f=(m,v={})=>{try{t("cloud.workspace.ui."+m,{...e,hasSearch:e.searchLength>0,traceId:i,inputDelayMs:a,...v})}catch{}},p=m=>{if(d)return;d=!0;const v=n();f("finished",{outcome:m,durationMs:Math.round(v-o),waitMs:l===void 0?void 0:Math.round(l-o),requestMs:l===void 0||c===void 0?void 0:Math.round(c-l),commitMs:c===void 0?void 0:Math.round(v-c)})};return f("started"),{requestId:i,get done(){return d},request(){l=n(),f("requested",{waitMs:Math.round(l-o)})},response(m,v,w){c=n(),u=m,f("response",{outcome:u,ignored:v,count:w,requestMs:l===void 0?void 0:Math.round(c-l)})},commit(){c!==void 0&&p(u)},finish:p}}var Om="Popover",[uj]=ro(Om,[Hl]),fd=Hl(),[xue,ao]=uj(Om),dj=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=e,a=fd(t),l=g.useRef(null),[c,u]=g.useState(!1),[d,f]=$l({prop:r,defaultProp:i??!1,onChange:s,caller:Om});return h.jsx(lm,{...a,children:h.jsx(xue,{scope:t,contentId:bi(),triggerRef:l,open:d,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:o,children:n})})};dj.displayName=Om;var hj="PopoverAnchor",yue=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ao(hj,n),s=fd(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return g.useEffect(()=>(o(),()=>a()),[o,a]),h.jsx(cm,{...s,...r,ref:t})});yue.displayName=hj;var fj="PopoverTrigger",pj=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ao(fj,n),s=fd(n),o=Ot(t,i.triggerRef),a=h.jsx(wt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":yj(i.open),...r,ref:o,onClick:Ne(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:h.jsx(cm,{asChild:!0,...s,children:a})});pj.displayName=fj;var Mb="PopoverPortal",[_ue,bue]=uj(Mb,{forceMount:void 0}),mj=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=ao(Mb,t);return h.jsx(_ue,{scope:t,forceMount:n,children:h.jsx(Jr,{present:n||s.open,children:h.jsx(um,{asChild:!0,container:i,children:r})})})};mj.displayName=Mb;var Il="PopoverContent",gj=g.forwardRef((e,t)=>{const n=bue(Il,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=ao(Il,e.__scopePopover);return h.jsx(Jr,{present:r||s.open,children:s.modal?h.jsx(Sue,{...i,ref:t}):h.jsx(kue,{...i,ref:t})})});gj.displayName=Il;var wue=pl("PopoverContent.RemoveScroll"),Sue=g.forwardRef((e,t)=>{const n=ao(Il,e.__scopePopover),r=g.useRef(null),i=Ot(t,r),s=g.useRef(!1);return g.useEffect(()=>{const o=r.current;if(o)return y_(o)},[]),h.jsx(hm,{as:wue,allowPinchZoom:!0,children:h.jsx(vj,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ne(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ne(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ne(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),kue=g.forwardRef((e,t)=>{const n=ao(Il,e.__scopePopover),r=g.useRef(!1),i=g.useRef(!1);return h.jsx(vj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),vj=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,f=ao(Il,n),p=fd(n);return l_(),h.jsx(rm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(Gu,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:h.jsx(v_,{"data-state":yj(f.open),role:"dialog",id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),xj="PopoverClose",Cue=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ao(xj,n);return h.jsx(wt.button,{type:"button",...r,ref:t,onClick:Ne(e.onClick,()=>i.onOpenChange(!1))})});Cue.displayName=xj;var Eue="PopoverArrow",Iue=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=fd(n);return h.jsx(x_,{...i,...r,ref:t})});Iue.displayName=Eue;function yj(e){return e?"open":"closed"}var Nue=dj,Tue=pj,Pue=mj,_j=gj;const bj=Nue,wj=Tue,Ab=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>h.jsx(Pue,{children:h.jsx(_j,{ref:i,align:t,sideOffset:n,className:ie("z-50 w-72 rounded-md border border-border bg-elevated p-4 text-text-100 shadow-md outline-none",e),...r})}));Ab.displayName=_j.displayName;const Wi="flex w-full min-w-0 items-center gap-2.5 rounded-md px-1.5 py-1.5 text-left text-[13px] hover:bg-text-100/5 disabled:opacity-40";function ME({title:e,children:t,trailing:n}){const[r,i]=g.useState(!0);return h.jsxs("section",{className:"rounded-[22px] border border-border bg-bg-100 p-3.5 shadow-[0_2px_12px_rgba(0,0,0,0.06)]",children:[h.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[h.jsxs("button",{onClick:()=>i(!r),className:"flex items-center gap-1.5 py-0.5 text-[13px] text-text-400","aria-expanded":r,children:[e,h.jsx(Pn,{className:`h-3 w-3 text-text-400 ${r?"":"-rotate-90"}`})]}),n]}),r&&t]})}const Rue=6e4,Sj=300;function kj({message:e,onRetry:t}){return h.jsxs("div",{role:"alert",className:"m-2 rounded-md bg-error/5 p-2 text-[11px] leading-relaxed text-error",children:[e,h.jsx("button",{className:"ml-2 underline",onClick:t,children:"重试"})]})}function Cj(e,t,n){const r=ym(),i=g.useRef(null),s=g.useRef(void 0),o=c=>{s.current=c.timeStamp},a=(c,u,d)=>{var p;(p=i.current)==null||p.finish("superseded");const f=vue({sessionId:e.sessionId,action:t,searchLength:c,page:u},(m,v)=>{r==null||r.push({level:"info",msg:m,sessionId:e.sessionId,meta:v})},void 0,d);return i.current=f,f};return g.useLayoutEffect(()=>{var c;n||(c=i.current)==null||c.commit()}),g.useEffect(()=>()=>{var c;(c=i.current)==null||c.finish("unmounted")},[]),{current:i,begin:a,open:(c,u)=>{const d=s.current;s.current=void 0,a(c,u,d)},captureOpen:o}}function Ej({controller:e,compact:t=!1}){const{binding:n,run:r,busy:i}=e,[s,o]=g.useState(!1),[a,l]=g.useState(""),[c,u]=g.useState(""),[d,f]=g.useState([]),[p,m]=g.useState(1),[v,w]=g.useState(!1),[x,_]=g.useState(!1),[b,S]=g.useState(null),[C,k]=g.useState(0),T=Cj(e,"repositories",x),E=g.useRef(!1),D=g.useRef(new Map);return g.useEffect(()=>{if(a===c)return;const N=setTimeout(()=>{u(a),m(1)},Sj);return()=>clearTimeout(N)},[a,c]),g.useEffect(()=>{if(!s||n)return;const N=T.current.current&&!T.current.current.done?T.current.current:T.begin(c.length,p),L=c+"|"+p,R=z=>{w(z.hasMore),f(F=>p===1?z.repos:[...F,...z.repos])},M=D.current.get(L);S(null);const A=E.current;if(E.current=!1,M&&Date.now()-M.at<Rue&&!A){N.response("cache",!1,M.repos.length),R({...M,repos:[...M.repos]}),_(!1);return}let j=!1;return _(!0),N.request(),r({action:"repositories",page:p,search:c},N.requestId).then(z=>{var $;if(N.response("ok",j,(($=z.repositories)==null?void 0:$.length)??0),j)return;const F={at:Date.now(),repos:z.repositories??[],hasMore:z.hasMore??!1};D.current.set(L,F),R(F)}).catch(z=>{N.response("error",j),j||S(z.message)}).finally(()=>{j||_(!1)}),()=>{j=!0,N.finish("cancelled")}},[s,n,c,p,C,r]),n?h.jsxs("button",{className:t?"flex min-w-0 items-center gap-1.5 text-[11px] text-text-300 hover:text-text-100":Wi,title:n.owner+"/"+n.name,"aria-label":"在 GitHub 查看仓库",onClick:()=>window.open(`https://github.com/${n.owner}/${n.name}`,"_blank","noopener"),children:[h.jsx(Eg,{className:"h-4 w-4 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:n.name}),!t&&h.jsx(Su,{className:"ml-auto h-3 w-3 text-text-400"})]}):h.jsxs(bj,{open:s,onOpenChange:N=>{var L;N?T.open(c.length,p):(L=T.current.current)==null||L.finish("closed"),o(N),N||(m(1),l(""),u(""))},children:[h.jsx(wj,{asChild:!0,children:h.jsxs("button",{disabled:i,onClickCapture:T.captureOpen,className:t?"flex items-center gap-1.5 text-[11px] text-text-300":Wi,"aria-label":"添加或选择仓库",children:[h.jsx(Eg,{className:"h-4 w-4 text-text-400"}),h.jsx("span",{className:"flex-1",children:"添加 repo"}),!t&&h.jsx(h4,{className:"h-3.5 w-3.5 text-text-400"})]})}),h.jsxs(Ab,{align:"end",className:"w-[330px] p-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[h.jsx(Hf,{className:"h-3.5 w-3.5 text-text-400"}),h.jsx("input",{autoFocus:!0,"aria-label":"搜索仓库",placeholder:"搜索 GitHub 仓库…",value:a,onChange:N=>{N.target.value!==a&&T.begin(N.target.value.length,1,N.timeStamp),l(N.target.value)},className:"w-full bg-transparent text-[12px] outline-none"})]}),h.jsxs("div",{className:"max-h-[340px] overflow-y-auto py-1",children:[d.map(N=>h.jsxs("button",{disabled:i,className:Wi,onClick:()=>{S(null),r({action:"bind",repoId:N.repoId,branch:N.defaultBranch}).then(()=>o(!1)).catch(L=>S(L.message))},children:[h.jsx(Eg,{className:"h-4 w-4 shrink-0 text-text-400"}),h.jsxs("span",{className:"truncate text-[12px]",children:[N.owner,"/",N.name]})]},N.repoId)),b&&h.jsx(kj,{message:b,onRetry:()=>{T.begin(c.length,p),E.current=!0,k(N=>N+1)}}),!x&&!b&&!d.length&&h.jsx("p",{className:"p-3 text-[12px] text-text-400",children:"没有找到仓库"}),x&&h.jsxs("div",{className:"flex items-center gap-2 p-3 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"h-3 w-3 animate-spin"}),"正在读取…"]}),v&&!x&&h.jsx("button",{className:Wi,onClick:N=>{T.begin(c.length,p+1,N.timeStamp),m(L=>L+1)},children:"加载更多"})]})]})]})}function Ij({controller:e,compact:t=!1,disabled:n=!1}){const{binding:r,workspace:i,branchIntent:s,run:o,busy:a}=e,[l,c]=g.useState(!1),[u,d]=g.useState(""),[f,p]=g.useState(""),[m,v]=g.useState([]),[w,x]=g.useState(1),[_,b]=g.useState(),[S,C]=g.useState(),[k,T]=g.useState(!1),[E,D]=g.useState(!1),[N,L]=g.useState(null),[R,M]=g.useState(0),A=Cj(e,"branches",E),j=u.trim();g.useEffect(()=>{if(j===f)return;if(!j){p("");return}const I=setTimeout(()=>p(j),Sj);return()=>clearTimeout(I)},[j,f]),g.useEffect(()=>{if(!l||!r||j!==f)return;const I=A.current.current&&!A.current.current.done?A.current.current:A.begin(f.length,w);let U=!1;return L(null),D(!0),I.request(),o({action:"branches",repoId:r.repoId,...f?{search:f,..._?{cursor:_}:{}}:{page:w}},I.requestId).then(q=>{var O;I.response("ok",U,((O=q.branches)==null?void 0:O.length)??0),U||(v(te=>(f?!_:w===1)?q.branches??[]:[...te,...q.branches??[]]),T(!!(q.hasMore&&(!f||q.nextCursor))),C(q.nextCursor))}).catch(q=>{I.response("error",U),U||L(q.message)}).finally(()=>{U||D(!1)}),()=>{U=!0,I.finish("cancelled")}},[l,r==null?void 0:r.repoId,j,f,w,_,R,o]);const z=I=>{var U;I?A.open(f.length,w):(U=A.current.current)==null||U.finish("closed"),c(I),I||(d(""),p(""),v([]),x(1),b(void 0),C(void 0),T(!1),D(!1),L(null))},F=s??(i==null?void 0:i.actualBranch)??(i?"HEAD · "+i.head.slice(0,7):(r==null?void 0:r.sourceBranch)??"选择 branch"),$=[...new Set([...[...r?[r.defaultBranch]:[],...i!=null&&i.actualBranch?[i.actualBranch]:[],...(i==null?void 0:i.branches)??[]].filter(I=>I.toLowerCase().includes(j.toLowerCase())),...m])],B=I=>{const U=I===((i==null?void 0:i.actualBranch)??(r==null?void 0:r.sourceBranch));o(U?{action:"intend"}:{action:"intend",branch:I}).then(()=>{z(!1)}).catch(()=>{})};return h.jsxs(bj,{open:l,onOpenChange:z,children:[h.jsx(wj,{asChild:!0,children:h.jsxs("button",{onClickCapture:A.captureOpen,className:t?"flex min-w-0 items-center gap-1.5 text-[11px] text-text-300 disabled:opacity-40":Wi,"aria-label":`选择分支,当前 ${F}`,disabled:a||n,children:[h.jsx(ku,{className:"h-3.5 w-3.5 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:F}),h.jsx(Pn,{className:"ml-auto h-3 w-3 shrink-0 text-text-400"})]})}),h.jsxs(Ab,{align:"end",className:"w-[280px] p-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[h.jsx(Hf,{className:"h-3.5 w-3.5 text-text-400"}),h.jsx("input",{autoFocus:!0,"aria-label":"搜索分支",placeholder:"搜索分支…",value:u,maxLength:100,onChange:I=>{d(I.target.value),I.target.value.trim()!==j&&(A.begin(I.target.value.trim().length,1,I.timeStamp),v([]),x(1),b(void 0),C(void 0),T(!1),L(null),D(!0))},className:"w-full bg-transparent text-[12px] outline-none"})]}),h.jsxs("div",{className:"max-h-[300px] overflow-y-auto",children:[(j===f?$:[]).map(I=>h.jsxs("button",{className:Wi,onClick:()=>B(I),children:[h.jsx(ku,{className:"h-3.5 w-3.5 text-text-400"}),h.jsx("span",{className:"flex-1 truncate",children:I}),I===(r==null?void 0:r.defaultBranch)&&h.jsx("span",{className:"text-[10px] text-text-400",children:"默认"}),I===F&&h.jsx(Qo,{className:"h-3.5 w-3.5"})]},I)),N&&h.jsx(kj,{message:N,onRetry:()=>{A.begin(f.length,w),M(I=>I+1)}}),E&&h.jsxs("div",{role:"status",className:"flex items-center gap-2 p-3 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"h-3 w-3 animate-spin"}),"正在读取…"]}),!E&&!N&&!$.length&&h.jsx("p",{className:"p-3 text-[12px] text-text-400",children:"没有找到分支"}),k&&h.jsx("button",{className:Wi,disabled:E||!!N,onClick:I=>{A.begin(f.length,w+1,I.timeStamp),D(!0),f?b(S):x(U=>U+1)},children:"加载更多分支"})]})]})]})}function Mue({controller:e,disabled:t=!1}){return h.jsxs("div",{"data-testid":"workspace-input-chip",className:"flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 px-1 pb-2 text-text-300",children:[h.jsx("div",{className:"max-w-[200px] min-w-0",children:h.jsx(Ej,{controller:e,compact:!0})}),e.binding&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"h-3 w-px bg-border"}),h.jsx("div",{className:"min-w-0 max-w-[230px]",children:h.jsx(Ij,{controller:e,compact:!0,disabled:t},e.binding.repoId)})]}),e.loading&&h.jsx(Tn,{className:"h-3 w-3 shrink-0 animate-spin text-text-400"})]})}function Aue({controller:e,disabled:t=!1}){var v;const{binding:n,workspace:r,branchIntent:i,loading:s,busy:o,error:a,refresh:l,run:c}=e,[u,d]=g.useState(null),[f,p]=g.useState();g.useEffect(()=>{if(!u){p(void 0);return}let w=!1;return p(void 0),c({action:"diff",filePath:u}).then(x=>{w||p(x.diff)}).catch(()=>{}),()=>{w=!0}},[u,c]);const m=(v=r==null?void 0:r.files.find(w=>w.path===u))==null?void 0:v.comparison;return h.jsxs("div",{className:"space-y-3",children:[h.jsxs(ME,{title:"环境",trailing:h.jsx("button",{"aria-label":"刷新工作区",title:"刷新工作区",disabled:o||s,onClick:()=>void l(),className:"p-1 text-text-400 disabled:opacity-40",children:h.jsx(TF,{className:`h-3 w-3 ${s?"animate-spin":""}`})}),children:[h.jsxs("div",{className:"flex items-center gap-2.5 px-1.5 py-1.5 text-[13px]",children:[h.jsx(j7,{className:"h-4 w-4 text-text-400"}),h.jsx("span",{children:"云端"}),h.jsx("span",{className:"ml-auto text-[11px] text-text-400",children:n?"已关联":"待关联"})]}),h.jsx(Ej,{controller:e}),n&&h.jsx(Ij,{controller:e,disabled:t},n.repoId),i&&h.jsxs("p",{className:"mt-1 px-1.5 text-[11px] text-text-400",children:["将在下一条消息里让 agent 切换到 ",i]}),r&&h.jsxs("p",{className:"mt-1 px-1.5 text-[10px] text-text-400",children:["截至 ",YH(new Date(r.measuredAt).toISOString())," ·"," ",r.head.slice(0,7)]}),!n&&h.jsx("p",{className:"mt-2 px-1.5 text-[11px] leading-relaxed text-text-400",children:"关联仓库和分支,在这个会话的独立工作区里开发。"}),a&&h.jsxs("div",{role:"alert",className:"mt-2 rounded-md bg-error/5 p-2 text-[11px] leading-relaxed text-error",children:[a,h.jsx("button",{className:"ml-2 underline",onClick:()=>void l(),children:"重试读取"})]})]}),!!(r!=null&&r.files.length)&&h.jsxs(ME,{title:"Changes",trailing:h.jsxs("span",{className:"text-[10px] text-text-400",children:[r.totalFiles??r.files.length," 个文件"]}),children:[h.jsxs("button",{"aria-label":"查看全部改动",className:Wi,onClick:()=>d(r.files[0].path),children:[h.jsx(U7,{className:"h-4 w-4 text-text-400"}),h.jsxs("span",{className:"tabular-nums text-success",children:["+",r.added]}),h.jsxs("span",{className:"tabular-nums text-error",children:["−",r.removed]}),h.jsx(o4,{className:"ml-auto h-3 w-3 text-text-400"})]}),h.jsx("div",{className:"mb-2",children:r.files.map(w=>h.jsxs("button",{className:"flex w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-1.5 text-left text-[11px] hover:bg-text-100/5",onClick:()=>d(w.path),children:[h.jsx("span",{className:"w-4 shrink-0 text-[10px] text-text-400",children:w.status}),h.jsx("span",{title:w.path,className:"min-w-0 flex-1 truncate text-text-300",children:w.path.split("/").at(-1)}),h.jsxs("span",{className:"text-success",children:["+",w.added]}),h.jsxs("span",{className:"text-error",children:["−",w.removed]})]},w.path))}),r.filesTruncated&&h.jsx("p",{className:"mb-2 px-1 text-[11px] text-text-400",children:"仅展示前 200 个改动文件。"})]}),h.jsx(sj,{open:u!==null,onOpenChange:w=>{w||d(null)},children:h.jsxs(Pb,{className:"flex h-[min(680px,84vh)] w-[min(1080px,94vw)] max-w-none flex-col gap-0 overflow-hidden p-0",children:[h.jsxs("div",{className:"border-b border-border px-5 py-4",children:[h.jsx(Rb,{className:"text-[14px]",children:"代码改动"}),h.jsxs(lj,{className:"mt-2 text-[11px]",children:[(r==null?void 0:r.actualBranch)??"HEAD"," ·"," ",m==="index"?"暂存区相对当前提交的改动":m==="head"?"尚未提交的改动":"相对起始提交 "+(r==null?void 0:r.initialCommit.slice(0,7))+" 的累计改动"]})]}),h.jsxs("div",{className:"flex min-h-0 flex-1",children:[h.jsx("nav",{"aria-label":"改动文件",className:"w-[225px] shrink-0 overflow-auto border-r border-border bg-bg-50 p-2 max-[700px]:hidden",children:r==null?void 0:r.files.map(w=>h.jsx("button",{className:Wi+" text-[11px]",onClick:()=>d(w.path),children:h.jsx("span",{className:"truncate",children:w.path.split("/").at(-1)})},w.path))}),h.jsxs("div",{className:"min-w-0 flex-1 overflow-auto",children:[h.jsx("div",{className:"sticky top-0 border-b border-border bg-bg-50 px-4 py-3 font-mono text-[11px]",children:u}),f?f.binary?h.jsx("p",{className:"p-5 text-[12px] text-text-400",children:"二进制文件发生变化"}):f.notStored?h.jsx("p",{className:"p-5 text-[12px] text-text-400",children:"这个文件的补丁暂不可用(文件较多或体积较大时只保存部分补丁)。"}):h.jsxs("pre",{className:"min-w-fit py-2 font-mono text-[11px] leading-6",children:[f.patch.split(`
|
|
623
|
+
`).map((w,x)=>h.jsx("div",{className:`px-4 ${w.startsWith("+")?"bg-success/8 text-success":w.startsWith("-")?"bg-error/8 text-error":"text-text-300"}`,children:w||" "},x)),f.truncated&&h.jsx("div",{className:"px-4 text-text-400",children:"Diff 较大,已截断显示。"})]}):h.jsx("div",{className:"p-5 text-[12px] text-text-400",children:a??"正在读取 diff…"})]})]})]})})]})}const jue=250;function Lue(e){if(!e||!Number.isFinite(e))return null;const t=e/1e3;if(t<60)return`${t.toFixed(0)}s`;const n=Math.floor(t/60);return`${n}m${Math.round(t-n*60).toString().padStart(2,"0")}s`}function Due({agents:e}){var l,c,u;const[t,n]=g.useState(!1),r=g.useRef(null);if(g.useEffect(()=>{if(!t)return;const d=f=>{const p=r.current;p&&f.target instanceof Node&&p.contains(f.target)||n(!1)};return window.addEventListener("pointerdown",d,!0),()=>window.removeEventListener("pointerdown",d,!0)},[t]),e.length===0)return null;const i=e.length===1?e[0]:null,s=i?i.description:`${e.length} 个后台任务`,o=i?Lue((c=(l=i.progress)==null?void 0:l.stats)==null?void 0:c.durationMs):null,a=i?(u=i.progress)==null?void 0:u.lastToolName:null;return h.jsxs("div",{ref:r,"data-testid":"running-agents-chip","data-agent-count":e.length,className:"relative",children:[t?h.jsx("div",{"data-testid":"running-agents-popover",className:"absolute bottom-full right-0 z-20 mb-1 w-[min(560px,80vw)]",children:h.jsx("div",{className:"min-w-0 overflow-y-auto rounded-lg border border-bg-200/60 bg-bg-100 px-2 py-1 shadow-lg",style:{maxHeight:jue},children:e.map(d=>h.jsx(NM,{expandable:!1,description:d.description,input:d.input,output:d.output,...d.error!==void 0?{error:d.error}:{},pending:d.pending,notifications:d.notifications,...d.toolResultExtra?{toolResultExtra:d.toolResultExtra}:{},...d.progress?{progress:d.progress}:{}},d.toolUseId))})}):null,h.jsxs("button",{type:"button","data-testid":"running-agents-chip-toggle","aria-expanded":t,onClick:()=>n(d=>!d),className:ie("flex max-w-[min(560px,80vw)] min-w-0 items-center gap-2 rounded-full","border border-bg-200/60 bg-bg-100/95 px-3 py-1 text-[12px] shadow-md backdrop-blur","hover:bg-bg-200/95 transition-colors"),children:[h.jsx(Tn,{className:"w-3 h-3 shrink-0 animate-spin text-blue-400"}),h.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-text-200",children:s}),o?h.jsx("span",{className:"shrink-0 tabular-nums text-text-400",children:o}):null,a?h.jsxs("span",{className:"shrink-0 font-mono tabular-nums text-blue-400",children:["now:",a]}):null,h.jsx(a4,{className:ie("w-3.5 h-3.5 shrink-0 text-text-400 transition-transform",t&&"rotate-180")})]})]})}const Oue={closeTrailing:!1},Bue={closeTrailing:!0};function $ue(e){return e?Oue:Bue}function zue({session:e,api:t,onPromoteQuickAsk:n}){const r=QP(e.sessionId);return h.jsx(Nj,{state:r,extras:{session:e,api:t,...n?{onPromoteQuickAsk:n}:{}}})}function Fue({headerMeta:e,connState:t,liveWorktreeRoot:n,onOpenConfig:r,variant:i="full",ephemeral:s,onPromote:o,hideHeader:a=!1,flatProcess:l=!1,lines:c,pendingPermissions:u,procAlive:d,rewindableUserMessageIds:f,onPermissionRespond:p,onPermissionInterrupt:m,onRewind:v,onFork:w,onQuickAsk:x,topSlot:_,codexHistory:b,realtimeQuestionAnswers:S,onSubmitQuestion:C,onCancelQuestion:k,liveQuestionToolUseIds:T,api:E,cwd:D,tool:N,cloudVolume:L,sessionKey:R,onSend:M,awaitingUser:A,queued:j,onDequeue:z,onAbort:F,onNewSession:$,onClearSession:B,configSlot:I,workspaceInput:U,workspaceInputDisabled:q,chatRootRef:O,chatBodyRef:te,drawers:le,xtermSlot:Y,fileSharingScope:re,onShareFile:ke,onOpenInTab:oe,onPreviewMarkdown:Ie,onOpenFilePath:Ee,dispatchOrigin:Re}){const[he,Be]=g.useState(0),Je=g.useMemo(()=>i==="full"?kY(tR(c)):[],[c,i]),Ge=g.useMemo(()=>new Set(Je.map(ft=>ft.toolUseId)),[Je]);return h.jsx(xie,{children:h.jsxs("div",{ref:O,"data-cc-chat-root":"",className:"flex flex-col h-full bg-bg-100",children:[a?null:h.jsx(gse,{meta:e,...N?{tool:N}:{},...L?{cloudVolume:L}:{},connState:t,variant:i,...n!==void 0?{liveWorktreeRoot:n}:{},...i==="full"&&r?{onOpenConfig:r}:{},...i==="quickask"?{ephemeral:s??!1,...o?{onPromote:o}:{}}:{}}),h.jsx("div",{ref:te,"data-testid":"chat-body",className:"flex-1 overflow-y-auto min-h-0",style:{overflowAnchor:"none",paddingBottom:he},children:h.jsx(PM,{lines:c,forkByTurn:N==="codex"||N===Hy,...p?{onPermissionRespond:p}:{},...m&&d?{onPermissionInterrupt:m}:{},topSlot:_,codexHistory:b,...v?{onRewind:v}:{},rewindableUserMessageIds:f,...w?{onFork:w}:{},...x?{onQuickAsk:x}:{},realtimeQuestionAnswers:S,onSubmitQuestion:C,...k?{onCancelQuestion:k}:{},liveQuestionToolUseIds:T,...re?{fileSharingScope:re}:{},...ke?{onShareFile:ke}:{},...oe?{onOpenInTab:oe}:{},...Ie?{onPreviewMarkdown:Ie}:{},...Ee?{onOpenFilePath:Ee}:{},...Re?{dispatchOrigin:Re}:{},...i==="full"&&!l?{turnCollapse:$ue(d)}:{},dockedAgentToolUseIds:Ge})}),Y,h.jsx(mue,{onHeightChange:Be,children:h.jsx(Due,{agents:Je})}),e.larkChatName?h.jsx("div",{className:"mx-3 mb-3 rounded-lg border border-border bg-bg-200 px-3 py-2 text-[12px] text-text-400","data-testid":"lark-readonly-notice",children:e.larkChatType==="p2p"?`此会话由与「${e.larkChatName}」的飞书私聊驱动——对方消息触发,这里仅供观察。`:`此会话由飞书群「${e.larkChatName}」驱动——群成员 @ bot 提问触发,这里仅供观察。`}):h.jsx(pse,{meta:e,aboveSlot:U,disabled:q,...E?{api:E}:{},cwd:D,...N?{tool:N}:{},sessionKey:R,onSend:M,awaitingUser:A,...j?{queued:j}:{},...z?{onDequeue:z}:{},...F?{onAbort:F}:{},...$?{onNewSession:$}:{},...B?{onClearSession:B}:{},...I?{configSlot:I}:{}}),le]})})}function Nj({state:e,extras:t,onQuickAskInternal:n,onPreviewMdInternal:r}){var xr;const{session:i,api:s,liveGitBranch:o,liveWorktreeRoot:a,cloudVolume:l,onNewSession:c,onTurnEnd:u,onOpenConfig:d,onFork:f,onQuickAsk:p,viewerRole:m,onPromoteQuickAsk:v,configSlot:w,hideHeader:x,flatProcess:_}=t,{capabilities:b}=Rm(i.tool||"claude"),S=(b==null?void 0:b.features)??ZT(i.tool),[C,k]=g.useState(null),[T,E]=g.useState(null),D=Qp(),N=!!s&&D.actionsLevel==="owner"&&S.fileSharing,L=r4(i.ownerPersonaId??null).persona,R=(L==null?void 0:L.label)??null,M=!!R&&!!i.ownerPersonaId,A=due(),j=g.useMemo(()=>({resolve:(Z,we)=>A.resolve(Z,we,i.sessionId),...A.onOpenSession?{onOpenSession:A.onOpenSession}:{}}),[A,i.sessionId]),z=g.useCallback((Z,we)=>{k({kind:Z,text:we}),setTimeout(()=>{k(De=>(De==null?void 0:De.text)===we?null:De)},2e3)},[]),F=Ni(),$=Wc(i.tool)&&m!=="guest"&&!i.larkChatId&&!v,B=gue(s,i.sessionId,$,F,i.cloudWorkspace,i.cloudBranchIntent),I=bz(),U=GP(i.sessionId,i.toolSessionId),{events:q,pendingQuestions:O,clearQuestion:te,markQuestionSubmitted:le,status:Y}=U,re=e.historyLoading,ke=ZP(Y);g.useEffect(()=>{$e("chat-panel","sessionStatus",{sessionId:i.sessionId,sessionStatus:Y,procAlive:ke})},[Y,ke,i.sessionId]);const oe=e.lines,Ie=e.pendingPermissions,Ee=Ie[0]??null,Re=g.useMemo(()=>wY(q),[q]),[he,Be]=g.useState(null),[Je,Ge]=g.useState(()=>new Set);yY(s,i.sessionId,i.toolSessionId,S.observe);const ft=g.useRef(i.sessionId);g.useEffect(()=>{if(ft.current=i.sessionId,!S.rewind){Be(null);return}let Z=!1;return Be(null),(async()=>{try{const we=await s.sessionRewindableMessageIds(i.sessionId);if(Z)return;Be(new Set(we.userMessageIds))}catch{Z||Be(null)}})(),()=>{Z=!0}},[s,i.sessionId,S.rewind]);const Kt=g.useCallback(()=>{const Z=i.sessionId;s.sessionRewindableMessageIds(Z).then(we=>{ft.current===Z&&Be(new Set(we.userMessageIds))}).catch(()=>{})},[s,i.sessionId]),fe=g.useMemo(()=>{if(he!==null){const ct=new Set(he);for(const Or of Je)ct.delete(Or);return ct}const Z=new Set(["Edit","Write","MultiEdit","NotebookEdit"]),we=new Set;let De=null;for(const ct of oe)ct.kind==="user-text"?De=ct.uuid??null:De&&ct.kind==="tool-call"&&Z.has(ct.tool)&&!Je.has(De)&&we.add(De);return we},[oe,Je,he]),He=g.useRef(u);He.current=u,_Y(i.sessionId,i.toolSessionId,()=>{hn(null),Ge(new Set)});const Pe=Mse({sessionStatus:Y}),Me=g.useRef(null);g.useEffect(()=>{var De;const Z=Me.current,we=(Z==null?void 0:Z.sid)===i.sessionId;we&&Z.phase===Pe||(Me.current={sid:i.sessionId,phase:Pe},$e("session-phase",Pe,{sid:i.sessionId,phase:Pe,prev:we?Z.phase:null,desc:Rse[Pe]}),we&&Z.phase==="turn-running"&&Pe!=="turn-running"&&((De=He.current)==null||De.call(He),Kt()))},[Pe,i.sessionId,Kt]);const rt=g.useCallback(async()=>{const Z=await s.sessionInterrupt(i.sessionId).catch(()=>{});return(Z==null?void 0:Z.queued)??[]},[s,i.sessionId]),[tn,hn]=g.useState(null),W=g.useCallback(Z=>{hn(Z)},[]),[ee,be]=g.useState(!1),Oe=g.useCallback(()=>{s.sessionStop(i.sessionId).catch(()=>{}),be(!1)},[s,i.sessionId]);g.useCallback(Z=>{s.pinSession(i.sessionId,Z).catch(we=>{$e("chat-panel","pinSession failed",{err:we==null?void 0:we.message})})},[s,i.sessionId]);const Ue=v?"quickask":"full",{container:At,workspaceContainer:bn,onCollapse:nn,hostExtras:fn}=Sse(),ce=g.useRef(0),Se=g.useRef(null);g.useEffect(()=>{const Z=we=>{if(we.key!=="Escape")return;if(!ke){ce.current=0;return}if(we.isComposing)return;const ct=we.target;if(ct&&ct.closest("[data-cc-chat-root]")!==Se.current)return;const Or=Date.now();Or-ce.current<2e3?(ce.current=0,be(!0)):(ce.current=Or,rt())};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[rt,ke]);const st=g.useRef(null),gt=g.useRef(null),gr=g.useRef(!!e.codexHistory);gr.current=!!e.codexHistory;const ae=g.useRef(!0),it=g.useRef(void 0),Bt=g.useRef(0),ti=g.useRef(0),oa=g.useRef(void 0);g.useEffect(()=>{E(null)},[i.sessionId]),g.useEffect(()=>{const Z=st.current;if(!Z)return;const we=150,De=ct=>{gr.current||Date.now()<ti.current&&(ct.preventDefault(),ti.current=Date.now()+we)};return Z.addEventListener("wheel",De,{passive:!1}),()=>Z.removeEventListener("wheel",De)},[]),g.useEffect(()=>{const Z=st.current;if(!Z)return;const we=32,De=()=>{var Or;const ct=Z.scrollHeight-Z.scrollTop-Z.clientHeight;ae.current=ct<=we,e.codexHistory&&(gt.current=y2(Z)),Z.scrollTop<=24&&e.historyHasMore&&!e.historyLoadingOlder&&!e.historyError&&!re&&((Or=e.loadOlderHistory)==null||Or.call(e))};return Z.addEventListener("scroll",De,{passive:!0}),()=>Z.removeEventListener("scroll",De)},[e.codexHistory,e.historyHasMore,e.historyLoadingOlder,e.historyError,e.loadOlderHistory,re]),g.useLayoutEffect(()=>{var jb;const Z=st.current;if(!Z)return;const we=oa.current!==i.sessionId;we&&(oa.current=i.sessionId,ae.current=!0,it.current=void 0,Bt.current=0,ti.current=0,gt.current=null);const De=it.current,ct=(jb=oe[0])==null?void 0:jb.seq;if(it.current=ct,e.codexHistory){!we&>.current&&!ae.current?Oie(Z,gt.current):ae.current&&(Z.scrollTop=Z.scrollHeight),gt.current=y2(Z),Bt.current=Z.scrollHeight-Z.scrollTop;return}!we&&De!==void 0&&ct!==void 0&&ct<De?(Z.scrollTop=Z.scrollHeight-Bt.current,ti.current=Date.now()+200):ae.current&&(Z.scrollTop=Z.scrollHeight),Bt.current=Z.scrollHeight-Z.scrollTop},[oe,Ee==null?void 0:Ee.requestId,i.sessionId]);const aa=g.useMemo(()=>{const Z={};for(const[we,De]of Object.entries(O))De.submittedAnswers&&(Z[we]=De.submittedAnswers);return Z},[O]),hs=g.useMemo(()=>new Set(Object.keys(O)),[O]),la=g.useCallback(async(Z,we)=>{try{await s.answerQuestion({sessionId:i.sessionId,toolUseId:Z,answers:we}),le(Z,we)}catch{}},[s,i.sessionId,le]),Yl=g.useCallback(async Z=>{try{await s.cancelQuestion({sessionId:i.sessionId,toolUseId:Z}),te(Z)}catch{}},[s,i.sessionId,te]),Xl=g.useCallback(async(Z,we)=>{var De;if(Ee)try{await((De=e.respondPermission)==null?void 0:De.call(e,Ee.requestId,Z?"allow":"deny"))}catch{}},[e,Ee]),fs=g.useCallback(async()=>{const Z=i.sessionId;try{await s.sessionStop(Z)}catch{}e.clearSession?await e.clearSession():await s.sessionNew(Z)},[e,s,i.sessionId]),ni=e.meta.streamInProgress??!1,pd=g.useMemo(()=>{if(e.codexHistory)return h.jsxs("div",{className:"flex flex-col items-center gap-2 py-2 text-xs text-text-400","data-testid":"codex-history-top",children:[e.historySyncError?h.jsx("span",{children:e.historySyncError}):null,e.historyError?h.jsx("span",{"data-testid":"history-error",children:e.historyError}):null,re||e.historyLoadingOlder?h.jsx("span",{"data-testid":"history-loading",children:"正在加载历史…"}):e.historyHasMore?h.jsx("button",{type:"button",onClick:()=>{var we;return void((we=e.loadOlderHistory)==null?void 0:we.call(e))},children:e.historyError?"重试更早记录":"加载更早记录"}):e.historyLoaded&&!e.historyError&&!e.historySyncError?h.jsx("span",{children:"已加载全部轮次摘要"}):null,e.historyError||e.historySyncError?h.jsx("button",{type:"button",onClick:()=>{var we;return void((we=e.refreshHistory)==null?void 0:we.call(e))},children:"刷新历史"}):null]});const Z=e.historySyncError?h.jsxs("div",{className:"flex justify-center items-center gap-2 py-2 text-[12px] text-text-400","data-testid":"history-sync-error",children:[h.jsx("span",{children:e.historySyncError}),e.reloadFromCloud?h.jsx("button",{type:"button","data-testid":"history-sync-reload",disabled:ni,onClick:e.reloadFromCloud,className:"text-accent hover:underline cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 disabled:no-underline",children:"从云端重新加载"}):null]}):null;return e.historyError?h.jsxs(h.Fragment,{children:[Z,h.jsxs("div",{className:"flex justify-center py-2 text-[12px] text-text-400","data-testid":"history-error",children:["历史未加载完(",e.historyError,");切走再切回可重试"]})]}):Z||(re&&oe.length===0?h.jsx("div",{className:"flex justify-center py-4","data-testid":"history-loading",children:h.jsx(Tn,{className:"w-4 h-4 text-text-400 animate-spin"})}):null)},[re,oe.length,e.historyError,e.historySyncError,e.reloadFromCloud,ni,e.codexHistory,e.historyHasMore,e.historyLoaded,e.historyLoadingOlder,e.loadOlderHistory,e.refreshHistory]),ca=e.meta,Gt=h.jsxs(h.Fragment,{children:[i.toolSessionId&&S.subagents?h.jsx(kse,{api:s,cwd:i.cwd,toolSessionId:i.toolSessionId,toolKind:i.tool??"claude"}):null,tn&&S.rewind?h.jsx(Ese,{open:!0,onOpenChange:Z=>{Z||hn(null)},api:s,sessionId:i.sessionId,userMessageId:tn,lines:oe,procAlive:ke,onNoChanges:Z=>{Ge(we=>{if(we.has(Z))return we;const De=new Set(we);return De.add(Z),De})}}):null,ee?h.jsx(Hue,{onConfirm:Oe,onCancel:()=>be(!1)}):null]}),Zl={kind:"session",sessionId:i.sessionId},md=g.useCallback(async Z=>{if(s)try{await gC(s,F,i.sessionId,Z)}catch(we){const De=we.message;$e("chat-panel","open-in-tab failed",{err:De}),z("err",`Open in tab 失败:${De}`)}},[s,F,i.sessionId,z]),[jt,$t]=g.useState(!1),[Wn,vr]=g.useState(null),Mi=g.useCallback(Z=>{if(r){r(Z);return}vr(Z),$t(!0)},[r]),Bm=g.useCallback(Z=>{if(!s)return;const we=async()=>{try{await s.attachmentGroupAdd(i.sessionId,Z)}catch(ct){$e("chat-panel","file-link groupAdd skipped",{err:ct.message})}},De=ct=>{const Or=ct.message;$e("chat-panel","file-link open failed",{err:Or}),z("err",`打开文件失败:${Or}`)};if(Em(Z)){we().then(()=>Mi(Z),De);return}gC(s,F,i.sessionId,Z,60,we).catch(De)},[s,F,i.sessionId,Mi,z]),gd=g.useCallback(async Z=>{if(!s)throw new Error("daemon api not ready");const we=await q_(s,F,i.sessionId,Z,60),De=await fetch(we);if(!De.ok)throw new Error(`fetch ${De.status} ${De.statusText}`);return await De.text()},[s,F,i.sessionId]),lo=g.useCallback(async(Z,we)=>{if(s)try{const{url:De}=await s.attachmentSignUrl({sessionId:i.sessionId,relPath:Z,...we?{view:we}:{}}),ct=await aY(De);z(ct?"ok":"err",ct?"分享链接已复制到剪贴板":"复制失败:请手动复制")}catch(De){const ct=De.message;$e("chat-panel","share-file failed",{err:ct}),z("err",`生成分享链接失败:${ct}`)}},[s,i.sessionId,z]),co=g.useCallback(()=>E(null),[]),$m=T==="files"&&N&&s?{title:"Edited Files",onBack:co,content:h.jsx(Vle,{api:s,scope:Zl,sessionId:i.sessionId,onShareFile:lo,onOpenInTab:md,onPreviewMarkdown:Mi})}:T==="cron"?{title:`定时任务${Re.length?` (${Re.length})`:""}`,onBack:co,content:h.jsx("div",{className:"p-3",children:h.jsx(Pse,{jobs:Re})})}:T==="persona"&&M&&s&&i.ownerPersonaId?{title:`Persona · ${R??""}`,onBack:co,content:h.jsx(lue,{personaId:i.ownerPersonaId,open:!0,onClose:co,api:s,embedded:!0,...m?{viewerRole:m}:{}},i.ownerPersonaId)}:null,vd=Ue==="full"?h.jsx(bse,{session:i,meta:ca,...$&&B.binding?{liveGitBranch:((xr=B.workspace)==null?void 0:xr.actualBranch)??null}:o!==void 0?{liveGitBranch:o}:{},...a!==void 0?{liveWorktreeRoot:a}:{},...M?{personaName:R}:{},...M?{onOpenPersona:()=>E("persona")}:{},...N?{onOpenFiles:()=>E("files")}:{},cronActiveCount:Re.length,onCronClick:()=>E("cron"),onForceStop:()=>be(!0),...Wc(i.tool)&&e.reloadFromCloud?{onReloadFromCloud:e.reloadFromCloud,reloadFromCloudDisabled:ni}:{},...m?{viewerRole:m}:{},...b!=null&&b.toolSessionIdLabel?{toolSessionIdLabel:b.toolSessionIdLabel}:{},drill:$m,...nn?{onCollapse:nn}:{},...fn?{title:fn.title,leadingEntries:fn.leadingEntries}:{}}):null;return h.jsxs(h.Fragment,{children:[$&&bn?Do.createPortal(h.jsx(Aue,{controller:B,disabled:ca.streamInProgress}),bn):null,At&&vd?Do.createPortal(vd,At):null,h.jsx(Fue,{headerMeta:ca,workspaceInput:$?h.jsx(Mue,{controller:B,disabled:ca.streamInProgress}):void 0,workspaceInputDisabled:$&&B.busy,connState:e.connState,...a!==void 0?{liveWorktreeRoot:a}:{},...d?{onOpenConfig:d}:{},variant:Ue,...x||$?{hideHeader:!0}:{},..._?{flatProcess:_}:{},...Ue==="quickask"?{ephemeral:i.ephemeral!==!1,onPromote:()=>void(v==null?void 0:v(i.sessionId))}:{},lines:oe,pendingPermissions:Ie,procAlive:ke,rewindableUserMessageIds:fe,onPermissionRespond:Xl,onPermissionInterrupt:rt,onRewind:S.rewind?W:void 0,...f&&S.fork?{onFork:f}:{},...Wc(i.tool)?{}:n&&S.fork?{onQuickAsk:n}:p&&S.fork?{onQuickAsk:p}:{},topSlot:pd,codexHistory:e.codexHistory,realtimeQuestionAnswers:aa,onSubmitQuestion:la,onCancelQuestion:Yl,liveQuestionToolUseIds:hs,api:s,cwd:i.cwd,...i.tool?{tool:i.tool}:{},...l?{cloudVolume:l}:{},sessionKey:i.sessionId,onSend:e.sendText,queued:e.queued,onDequeue:e.dequeue,awaitingUser:Ie.length>0||Object.values(O).some(Z=>!Z.submittedAnswers),onAbort:rt,...c?{onNewSession:c}:{},onClearSession:fs,...w?{configSlot:w}:{},chatRootRef:Se,chatBodyRef:st,drawers:Gt,xtermSlot:I==="tui"&&ke&&S.tui?h.jsx(qle,{sessionId:i.sessionId,client:F},i.sessionId):null,fileSharingScope:Zl,...s?{onShareFile:lo}:{},...s?{onOpenInTab:md}:{},...s?{onPreviewMarkdown:Mi}:{},...s?{onOpenFilePath:Bm}:{},dispatchOrigin:j}),s?h.jsx(pue,{open:jt,onOpenChange:$t,relPath:Wn,loadMarkdown:gd,onShare:Wn?()=>void lo(Wn,"md-rendered"):void 0}):null,C?h.jsx("div",{"data-testid":"share-toast",role:"status","aria-live":"polite",className:C.kind==="ok"?"fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-md border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-[12px] text-emerald-700 shadow-md dark:text-emerald-300":"fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive shadow-md",children:C.text}):null]})}function Hue({onConfirm:e,onCancel:t}){return h.jsx("div",{role:"dialog","aria-modal":"true","data-testid":"force-stop-confirm",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:t,children:h.jsxs("div",{className:"max-w-sm w-[92%] rounded-lg border border-red-400/40 bg-bg-0 p-4 shadow-xl",onClick:n=>n.stopPropagation(),children:[h.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[h.jsx(Uf,{className:"w-5 h-5 text-red-500 shrink-0 mt-0.5"}),h.jsx("div",{className:"text-[14px] text-text-100",children:"强制停止会话进程?会丢失 initialize / 预热缓存,下一次发送需要重新 spawn。"})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:t,className:"h-8 px-3 rounded-md text-[12px] text-text-300 hover:bg-text-100/5 cursor-pointer",children:"取消"}),h.jsx("button",{type:"button","data-testid":"force-stop-confirm-ok",onClick:e,className:"h-8 px-3 rounded-md bg-red-500 text-white text-[12px] font-medium hover:bg-red-600 cursor-pointer",children:"强制停止"})]})]})})}function Uue(e){return e.split("/").pop()||e}function Wue({state:e,api:t,onSwitchTab:n,onCloseQuickAsk:r,onCloseMd:i,loadMarkdown:s,quickAskSession:o,onPromoteQuickAsk:a}){if(!JP(e))return null;const l=[];e.quickAsk&&l.push({id:"quick-ask",label:"问一下",title:"问一下",icon:h.jsx(fx,{className:"w-3.5 h-3.5"})});for(const c of e.mds)l.push({id:{kind:"md",relPath:c},label:Uue(c),title:c,icon:h.jsx(Ci,{className:"w-3.5 h-3.5"})});return h.jsxs("div",{className:"flex flex-col h-full bg-bg-50/60 border-l border-border-strong",children:[h.jsx(Tu,{delayDuration:200,skipDelayDuration:100,children:h.jsx("div",{className:["flex items-stretch h-9 border-b border-text-100/10 shrink-0 overflow-x-auto","[scrollbar-width:none] [-ms-overflow-style:none]","[&::-webkit-scrollbar]:hidden"].join(" "),role:"tablist",children:l.map(c=>{const u=xY(e.active,c.id),d=c.id==="quick-ask"?"quick-ask":`md:${c.id.relPath}`;return h.jsxs(td,{children:[h.jsx(nd,{asChild:!0,children:h.jsxs("div",{role:"tab","aria-selected":u,"data-tab-title":c.title,onClick:()=>n(c.id),className:["group relative flex items-center gap-2 px-3 h-full cursor-pointer select-none","text-[12px] max-w-[180px] shrink-0 transition-colors duration-100",u?"text-text-100":"text-text-400 hover:text-text-100 hover:bg-text-100/[0.04]"].join(" "),children:[c.icon,h.jsx("span",{className:"truncate",children:c.label}),h.jsx("button",{type:"button","aria-label":`关闭 ${c.label}`,className:["ml-1 rounded p-0.5 shrink-0 transition-opacity","hover:bg-text-100/10",u?"opacity-70 hover:opacity-100":"opacity-0 group-hover:opacity-70"].join(" "),onClick:f=>{f.stopPropagation(),c.id==="quick-ask"?r():i(c.id.relPath)},children:h.jsx(Qr,{className:"w-3 h-3"})}),u?h.jsx("span",{"aria-hidden":"true",className:"absolute left-2 right-2 -bottom-px h-[2px] rounded-full bg-accent"}):null]})}),h.jsx(Ul,{side:"bottom",align:"start",className:"max-w-sm break-all",children:c.title})]},d)})})}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:[e.quickAsk&&o?h.jsx("div",{className:"absolute inset-0",style:{display:e.active==="quick-ask"?"block":"none"},children:h.jsx(zue,{session:o,api:t,...a?{onPromoteQuickAsk:a}:{}})}):null,e.mds.map(c=>{const u=e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===c;return h.jsx("div",{className:"absolute inset-0",style:{display:u?"block":"none"},children:h.jsx(cj,{relPath:c,loadMarkdown:s,showTitleBar:!1})},`md-body:${c}`)})]})]})}function que(e){const t=e instanceof Error?e.message:String(e);return t.length>200?`${t.slice(0,200)}…`:t}function Vue({state:e,extras:t}){const{api:n,session:r}=t,i=Ni(),[s,o]=g.useState(dY()),[a,l]=g.useState(null),c=r.ownerPersonaId!==NT,u=g.useRef(s);u.current=s;const d=g.useRef(!1),f=g.useCallback(async E=>{const D=u.current.quickAsk;l(null);let N;try{N=await rY(n,r,E)}catch(L){$e("quick-ask","fork failed",L),d.current||l(que(L));return}if(!N){d.current||l("这条会话还没准备好(没有可派生的对话记录),稍后再试");return}if(d.current){n.sessionDelete(N.sessionId).catch(()=>{});return}rh(D)&&n.sessionDelete(D.sessionId).catch(()=>{}),o(L=>hY(L,{sessionId:N.sessionId}))},[n,r]),p=g.useCallback(async E=>{const D=u.current.quickAsk,N=(D==null?void 0:D.sessionId)===E;try{await iY(n,{sessionId:E,stillEphemeral:N&&rh(D)})&&o(R=>mY(R))}catch(L){$e("quick-ask","promote failed",L)}},[n]),m=g.useCallback(E=>{o(D=>fY(D,E))},[]),v=g.useCallback(E=>{o(D=>vY(D,E))},[]),w=g.useCallback(()=>{const E=u.current.quickAsk;rh(E)&&n.sessionDelete(E.sessionId).catch(()=>{}),o(D=>pY(D))},[n]),x=g.useCallback(E=>{o(D=>gY(D,E))},[]);g.useEffect(()=>()=>{d.current=!0;const E=u.current.quickAsk;rh(E)&&n.sessionDelete(E.sessionId).catch(()=>{})},[]);const _=ts("sessions")??[],b=s.quickAsk?_.find(E=>E.sessionId===s.quickAsk.sessionId)??{sessionId:s.quickAsk.sessionId,cwd:r.cwd,tool:r.tool}:null,S=g.useCallback(async E=>{const D=await q_(n,i,r.sessionId,E,60),N=await fetch(D);if(!N.ok)throw new Error(`fetch ${N.status} ${N.statusText}`);return N.text()},[n,i,r.sessionId]),C=h.jsx(Nj,{state:e,extras:t,onQuickAskInternal:f,onPreviewMdInternal:m}),{initialSize:k,setSize:T}=uY("chat-panel-right-slot-width",480);return h.jsxs(H_,{orientation:"horizontal",className:"flex-1 flex min-w-0 min-h-0",children:[h.jsx(Zf,{id:"chat",minSize:"400px",children:h.jsxs("div",{className:"relative flex flex-col min-w-0 min-h-0 h-full",children:[C,a?h.jsxs("div",{"data-testid":"quick-ask-error",className:"absolute bottom-24 left-1/2 z-10 -translate-x-1/2 max-w-[90%] rounded-md border border-border bg-bg-200 px-3 py-2 text-[12px] text-text-300 shadow-lg",children:[h.jsxs("span",{className:"mr-2",children:["问一下没能打开:",a]}),h.jsx("button",{type:"button","aria-label":"关闭提示",onClick:()=>l(null),className:"text-text-400 hover:text-text-200 cursor-pointer",children:"✕"})]}):null]})}),JP(s)?h.jsxs(h.Fragment,{children:[h.jsx(KP,{className:"w-1 bg-text-100/10 hover:bg-text-100/25 transition-colors cursor-col-resize"}),h.jsx(Zf,{id:"right-slot",defaultSize:`${k}px`,minSize:"360px",maxSize:"800px",onResize:E=>T(E.inPixels),children:h.jsx(Wue,{state:s,api:n,onSwitchTab:v,onCloseQuickAsk:w,onCloseMd:x,loadMarkdown:S,quickAskSession:b,...c?{onPromoteQuickAsk:p}:{}})})]}):null]})}function Kue({extras:e}){const t=QP(e.session.sessionId,e.focused);return h.jsx(Vue,{state:t,extras:e})}function Gue(e,t,n){var s;const r=n.find(o=>o.name==="effort"),i=e?t.find(o=>o.id===e):void 0;if(i!=null&&i.efforts&&i.efforts.length>0){const o=(s=r==null?void 0:r.options)==null?void 0:s.find(l=>l.value==="none");return{options:o?[o,...i.efforts.filter(l=>l.value!=="none")]:i.efforts,defaultValue:i.defaultEffort??""}}return{options:(r==null?void 0:r.options)??[],defaultValue:typeof(r==null?void 0:r.default)=="string"?r.default:""}}function Yue(e,t,n){var l;if(!t)return((l=(e??[]).find(c=>c.id===""))==null?void 0:l.label)??"未指定";const r=t.toLowerCase(),i=[["opus","Opus"],["fable","Fable"],["sonnet","Sonnet"],["haiku","Haiku"]];for(const[c,u]of i){if(!r.includes(c))continue;const d=r.match(new RegExp(`${c}-(\\d+)(?:-(\\d+))?`));return d?d[2]?`${u} ${d[1]}.${d[2]}`:`${u} ${d[1]}`:u}const s=e??[],o=s.find(c=>c.id===t);if(o)return o.label;const a=s.find(c=>c.id&&t.toLowerCase().includes(c.id.toLowerCase()));return a?a.label:t}function Xue(e,t){var m,v,w,x;const{models:n,modes:r,configSchema:i}=t,s=e.resolvedModel??e.model,o=Gue(s,n,i),a=o.options,l=a.some(_=>_.value===e.effort)?e.effort:o.defaultValue,c=e.effort===""&&e.resolvedEffort?((m=a.find(_=>_.value===e.resolvedEffort))==null?void 0:m.label)??e.resolvedEffort:((v=a.find(_=>_.value===l))==null?void 0:v.label)??null,u=((w=i.find(_=>_.name==="permissionMode"))==null?void 0:w.default)??"",d=r.some(_=>_.id===e.permissionMode)?e.permissionMode:u,p=d===u?null:((x=r.find(_=>_.id===d))==null?void 0:x.label)??null;return{modelLabel:Yue(n,s),effortOptions:a,effortValue:l,effortLabel:c,modeValue:d,modeLabel:p,modeTone:p===null?null:d==="bypassPermissions"?"danger":"info"}}function Tj(e){let t;return e.map(n=>{const r=n.group&&n.group!==t?n.group:null;return n.group&&(t=n.group),{...n,groupHeading:r}})}function Zue(e){return e.map(t=>({value:t.id,label:t.label,...t.description?{description:t.description}:{},...t.group?{group:t.group}:{}}))}function Que({testid:e,list:t,options:n,current:r,onSelect:i}){if(t.loading)return h.jsx(Wr,{disabled:!0,"data-testid":`${e}-loading`,className:"text-[12px] text-text-400",children:"正在读取最新模型…"});if(t.error)return h.jsxs(h.Fragment,{children:[h.jsx("div",{"data-testid":`${e}-error`,className:"px-2 py-1.5 text-[11px] text-warning",children:t.error}),h.jsx(Wr,{"data-testid":`${e}-retry`,className:"text-[12px]",onSelect:o=>{o.preventDefault(),t.load()},children:"重试"})]});const s=n??Zue(t.models);return s.length===0?h.jsx(Wr,{disabled:!0,"data-testid":`${e}-empty`,className:"text-[12px] text-text-400",children:"没有可选模型"}):h.jsx(h.Fragment,{children:Tj(s).map((o,a)=>{const l=o.value===r;return h.jsxs(Ze.Fragment,{children:[o.groupHeading?h.jsxs(h.Fragment,{children:[a>0?h.jsx(mm,{}):null,h.jsx(R_,{"data-testid":`${e}-group`,children:o.groupHeading})]}):null,h.jsxs(Wr,{"data-testid":`${e}-option-${o.value||"default"}`,onSelect:()=>i(o.value),className:"items-start gap-2",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:ie("block text-[12px]",l?"font-medium text-text-100":"text-text-300"),children:o.label}),o.description?h.jsx("span",{className:"mt-0.5 block text-[11px] text-text-400",children:o.description}):null]}),l?h.jsx(Qo,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-accent"}):null]})]},o.value||"default")})})}function Jue(e,t={}){return{models:e,loading:!1,error:null,load:()=>{},...t}}const ede=e=>e instanceof Error?e.message:String(e);function tde(e,t){const[n,r]=g.useState({key:e,loading:!1,error:null,data:t}),i=g.useRef(0),s=g.useCallback((a,l)=>{const c=++i.current;r(u=>({key:e,loading:!0,error:null,data:u.key===e?u.data:t})),a().then(u=>{i.current===c&&(l==null||l(u),r({key:e,loading:!1,error:null,data:u}))},u=>{i.current===c&&r(d=>({key:e,loading:!1,error:ede(u),data:d.key===e?d.data:t}))})},[e]);return{...n.key===e?n:{loading:!1,error:null,data:t},run:s}}const nde=[];function rde(e){const t=Ni(),n=g.useMemo(()=>new Jp(t),[t]),r=as(),{capabilities:i}=Rm(e),s=tde(e??"",null),{run:o}=s,a=g.useCallback(()=>{e&&o(()=>n.capabilitiesGet(e,{refresh:!0}),l=>{l&&r.setData(`capabilities/${e}`,()=>l)})},[n,r,e,o]);return{models:(i==null?void 0:i.models)??nde,loading:s.loading,error:s.error,load:a}}function ide({models:e,modelList:t,modes:n=[],configSchema:r=[],model:i,resolvedModel:s,resolvedEffort:o,effort:a,permissionMode:l,onPatch:c}){var w;const u=t??Jue(e??[]),d=u.models,f=Xue({model:i,resolvedModel:s,resolvedEffort:o,effort:a,permissionMode:l},{models:d,modes:n,configSchema:r}),p=s??i,m=d.map(x=>{const _=x.id===""&&s?`${x.description?`${x.description};`:""}当前:${s}`:x.description;return{value:x.id,label:x.label,..._?{description:_}:{},...x.group?{group:x.group}:{}}}),v=n.map(x=>({value:x.id,label:x.label,...x.description?{description:x.description}:{}}));return h.jsxs(gP,{children:[h.jsx(vP,{asChild:!0,children:h.jsxs("button",{type:"button","data-testid":"session-config-chip",title:"Model / reasoning effort / permission mode",className:"inline-flex items-center gap-1 h-7 px-2.5 rounded-full text-[11px] text-text-400 transition-colors outline-none cursor-pointer hover:bg-text-100/5 hover:text-text-200 data-[state=open]:bg-text-100/5",children:[h.jsx("span",{className:"truncate max-w-[120px]","data-testid":"session-config-chip-model",children:p||f.modelLabel}),f.effortLabel?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{className:"truncate max-w-[80px]","data-testid":"session-config-chip-effort",children:f.effortLabel})]}):null,f.modeLabel?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{"data-testid":"session-config-chip-mode","data-tone":f.modeTone,className:ie("font-semibold",f.modeTone==="danger"?"text-red-400":"text-blue-400"),children:f.modeLabel})]}):null]})}),h.jsxs(N_,{side:"top",align:"end",className:"w-[230px]","data-testid":"session-config-menu",children:[h.jsx(sde,{list:u,current:i,currentLabel:f.modelLabel,options:m,onSelect:x=>c({model:x})}),h.jsx(AE,{testid:"session-config-effort",label:"Reasoning effort",current:f.effortValue,currentLabel:f.effortLabel??"—",options:f.effortOptions,onSelect:x=>c({effort:x})}),v.length>0?h.jsx(AE,{testid:"session-config-mode",label:"Permission mode",current:f.modeValue,currentLabel:((w=n.find(x=>x.id===f.modeValue))==null?void 0:w.label)??"—",currentTone:f.modeTone,options:v,onSelect:x=>c({permissionMode:x})}):null]})]})}function Pj({label:e,currentLabel:t,currentTone:n}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"flex-1 text-text-200",children:e}),h.jsx("span",{className:ie("truncate max-w-[100px]",n==="danger"?"text-red-400 font-semibold":n==="info"?"text-blue-400 font-semibold":"text-text-400"),children:t}),h.jsx(Fn,{className:"w-3.5 h-3.5 shrink-0 text-text-500"})]})}function sde({list:e,current:t,currentLabel:n,options:r,onSelect:i}){const[s,o]=g.useState(!1),a=l=>{l&&!s&&e.load(),o(l)};return h.jsxs(xP,{open:s,onOpenChange:a,children:[h.jsx(T_,{"data-testid":"session-config-model",className:"gap-2 text-[12px]",children:h.jsx(Pj,{label:"Model",currentLabel:n})}),h.jsx(P_,{className:"w-[220px] max-h-[320px] overflow-y-auto",children:h.jsx(Que,{testid:"session-config-model",list:e,options:r,current:t,onSelect:i})})]})}function AE({testid:e,label:t,current:n,currentLabel:r,currentTone:i,options:s,onSelect:o}){const a=s.length===0;return h.jsxs(xP,{children:[h.jsx(T_,{"data-testid":e,disabled:a,className:"gap-2 text-[12px]",children:h.jsx(Pj,{label:t,currentLabel:r,currentTone:i??null})}),h.jsx(P_,{className:"w-[220px] max-h-[320px] overflow-y-auto",children:Tj(s).map((l,c)=>{const u=l.value===n;return h.jsxs(Ze.Fragment,{children:[l.groupHeading?h.jsxs(h.Fragment,{children:[c>0?h.jsx(mm,{}):null,h.jsx(R_,{"data-testid":`${e}-group`,children:l.groupHeading})]}):null,h.jsxs(Wr,{"data-testid":`${e}-option-${l.value||"default"}`,onSelect:()=>o(l.value),className:"items-start gap-2",children:[h.jsxs("span",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:ie("block text-[12px]",u?"text-text-100 font-medium":"text-text-300"),children:l.label}),l.description?h.jsx("span",{className:"block text-[11px] text-text-400 mt-0.5",children:l.description}):null]}),u?h.jsx(Qo,{className:"w-3.5 h-3.5 shrink-0 text-accent mt-0.5"}):null]})]},l.value||"default")})})]})}function ode(e,t,n=0){const[r,i]=g.useState(null),[s,o]=g.useState(!1),a=g.useCallback(async()=>{if(!t){i(null);return}o(!0);try{const l=await e.getGitBranch(t);i(l.branch??null)}catch{i(null)}finally{o(!1)}},[e,t]);return g.useEffect(()=>{a()},[a,n]),{branch:r,loading:s,refresh:()=>void a()}}function ade(e,t,n=0){const[r,i]=g.useState(null),[s,o]=g.useState(!1),a=g.useCallback(async()=>{if(!t){i(null);return}o(!0);try{const l=await e.getGitRoot(t);i(l.gitRoot??null)}catch{i(null)}finally{o(!1)}},[e,t]);return g.useEffect(()=>{a()},[a,n]),{worktreeRoot:r,loading:s,refresh:()=>void a()}}const lde=5e3;function cde(e,t,n=0){const[r,i]=g.useState(null);return g.useEffect(()=>{if(!t){i(null);return}let s=!1;const o=async()=>{try{const l=await e.cloudVolumeGet();s||i(l.volume??null)}catch{s||i(null)}},a=n>0?setTimeout(()=>void o(),lde):null;return a||o(),()=>{s=!0,a&&clearTimeout(a)}},[e,t,n]),{volume:r}}const ude=90;function dde(e){return e.sizeBytes>0?Math.min(100,Math.max(0,Math.round(e.usedBytes/e.sizeBytes*100))):0}function jE(e){const t=e/1073741824;return t>=.1?`${t.toFixed(1)} GB`:`${Math.max(1,Math.round(e/1024**2))} MB`}function hde({volume:e}){if(!e)return null;const t=dde(e),n=t>=ude?"warn":"ok",r=new Date(e.measuredAt).toLocaleString(),i=n==="ok"?"上一次任务结束时量的。":"盘快满了:在会话里说「清理一下云盘」,persona 会分析工作区里哪些能删、列给你确认后清掉。";return h.jsxs("span",{"data-testid":"chat-header-cloud-volume","data-tone":n,title:`云盘已用 ${jE(e.usedBytes)} / ${jE(e.sizeBytes)}(${r})。${i}`,className:ie("ml-1.5 inline-flex items-center gap-1.5 px-1.5 py-0.5 rounded text-[11px] tabular-nums",n==="ok"&&"bg-text-100/10 text-text-400",n==="warn"&&"bg-warning-dim text-warning"),children:[h.jsx("span",{className:"relative inline-block w-8 h-1 rounded-full bg-current/20 overflow-hidden","aria-hidden":!0,children:h.jsx("span",{className:"absolute inset-y-0 left-0 rounded-full bg-current",style:{width:`${t}%`}})}),"云盘 ",t,"%"]})}function fde({api:e,session:t,focused:n,totalPanes:r,onFocus:i,onClose:s,onNewSession:o,onOpenConfig:a,onFork:l,onQuickAsk:c,className:u,viewerRole:d="owner",hideHeader:f}){const{capabilities:p}=Rm(t.tool),m=rde(t.tool),[v,w]=g.useState(0),[x,_]=g.useState(n);Ze.useEffect(()=>{n&&_(!0)},[n]);const b=Wc(t.tool),S=b?void 0:t.cwd,{branch:C}=ode(e,S,v),{worktreeRoot:k}=ade(e,S,v),{volume:T}=cde(e,b,v),E=r>1,D=N=>{e.sessionUpdate(t.sessionId,N).catch(L=>{console.error("[session-config] session:update failed",t.sessionId,L)})};return h.jsxs("div",{className:`group/pane relative flex-1 ${u??"flex"} flex-row min-w-0 min-h-0 overflow-hidden ${E?`rounded-md border transition-colors ${n?"border-accent ring-1 ring-accent":"border-border"}`:""}`,onMouseDown:i,"data-testid":`session-pane-${t.sessionId}`,children:[h.jsx(H_,{orientation:"horizontal",className:"flex-1 flex min-w-0 min-h-0",children:h.jsx(Zf,{id:"chat",minSize:"400px",children:h.jsx("div",{className:"flex flex-col min-w-0 min-h-0 h-full",children:(n||x)&&h.jsx(pde,{api:e,session:t,focused:n,liveGitBranch:C,liveWorktreeRoot:k,...b&&T?{cloudVolume:h.jsx(hde,{volume:T})}:{},onNewSession:o,onTurnEnd:()=>w(N=>N+1),onOpenConfig:a,onFork:l,onQuickAsk:c,viewerRole:d,hideHeader:f,configSlot:p?h.jsx(ide,{modelList:m,modes:p.permissionModes,configSchema:p.configSchema,model:t.model??"",...t.resolvedModel?{resolvedModel:t.resolvedModel}:{},...t.resolvedEffort?{resolvedEffort:t.resolvedEffort}:{},effort:t.effort??"",permissionMode:t.permissionMode??"",onPatch:D}):null})})})}),E&&h.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),s()},className:"absolute top-1.5 right-1.5 z-10 p-1 rounded-md bg-bg-100/80 backdrop-blur-sm border border-border opacity-0 group-hover/pane:opacity-100 transition-opacity text-text-400 hover:text-text-100 hover:bg-bg-200","aria-label":"close pane","data-testid":`session-pane-close-${t.sessionId}`,children:h.jsx(Qr,{className:"w-3.5 h-3.5"})})]})}function pde({api:e,session:t,focused:n,liveGitBranch:r,liveWorktreeRoot:i,cloudVolume:s,onNewSession:o,onTurnEnd:a,onOpenConfig:l,onFork:c,onQuickAsk:u,viewerRole:d,configSlot:f,hideHeader:p}){return h.jsx(Kue,{extras:{session:t,api:e,focused:n,...r!==void 0?{liveGitBranch:r}:{},...i!==void 0?{liveWorktreeRoot:i}:{},...s!==void 0?{cloudVolume:s}:{},onNewSession:o,onTurnEnd:a,onOpenConfig:l,...c?{onFork:m=>{c(m)}}:{},...u?{onQuickAsk:m=>{u(m)}}:{},...d?{viewerRole:d}:{},...f?{configSlot:f}:{},...p?{hideHeader:p}:{}}})}function mde({personas:e,sessions:t,api:n,selfPrincipalId:r,selectedPersonaId:i,selectedSessionId:s,selectedSession:o,onSelectPersona:a,onSelectSession:l,onCreateSession:c,onDeleteSession:u,onEditSession:d,onCloseSession:f}){return h.jsxs("div",{className:"flex h-screen min-h-0 bg-bg-50","data-testid":"guest-share-page",children:[h.jsx("aside",{className:"w-[280px] shrink-0 overflow-y-auto border-r border-border bg-bg-50",children:h.jsx(FK,{personas:e,sessions:t,activePersonaId:i,activeSessionId:s,onSelectPersona:a,onSelectSession:l,onCreateSession:c,onDeleteSession:u,onEditSession:d,showCopyResume:!1,treatSessionsAsRoots:!0,...r?{ownerPrincipalId:r}:{},isPersonaExpanded:()=>!0})}),h.jsx("main",{className:"flex-1 min-w-0 min-h-0 flex",children:o?h.jsx(fde,{api:n,session:o,focused:!0,totalPanes:1,onFocus:()=>{},onClose:f,onNewSession:()=>{},onOpenConfig:()=>{},viewerRole:"guest"}):h.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-xs text-text-400","data-testid":"guest-share-empty",children:"选择左侧 persona 开始对话"})})]})}function gde(){const e=Ni(),t=g.useMemo(()=>new Jp(e),[e]),n=Uz(e),{sessions:r,refresh:i}=Wz(n),{personas:s}=n4(),o=Xz(),a=g.useMemo(()=>{const S=window.location.pathname.match(/^\/s\/([^/]+)/);return S?decodeURIComponent(S[1]):null},[]),l=g.useMemo(()=>r.filter(S=>!S.ephemeral&&S.larkChatId==null),[r]),c=g.useMemo(()=>a?s.filter(S=>S.personaId===a):s,[s,a]),[u,d]=g.useState(null),[f,p]=g.useState(null),[m,v]=g.useState(null);g.useEffect(()=>{let S=!1;return e.request("whoami",{}).then(C=>{S||d(C.capability.id)}).catch(()=>{}),()=>{S=!0}},[e]),g.useEffect(()=>{a&&p(a)},[a]);const w=g.useCallback(async(S,C)=>{const k=await t.sessionCreate({ownerPersonaId:S,...C.trim()?{label:C.trim()}:{}});await i(),p(S),v(k.sessionId)},[t,i]),x=g.useCallback(async S=>{await t.sessionDelete(S),await i(),v(C=>C===S?null:C)},[t,i]),_=g.useCallback(async(S,C)=>{await t.sessionUpdate(S,{label:C.label}),await i()},[t,i]),b=g.useMemo(()=>l.find(S=>S.sessionId===m)??null,[l,m]);return h.jsx(Jy.Provider,{value:o,children:h.jsx(mde,{personas:c,sessions:l,api:t,selfPrincipalId:u,selectedPersonaId:f,selectedSessionId:m,selectedSession:b,onSelectPersona:p,onSelectSession:v,onCreateSession:(S,C)=>void w(S,C),onDeleteSession:S=>void x(S),onEditSession:(S,C)=>void _(S,C),onCloseSession:()=>v(null)})})}const LE="https://app.ttcadvisory.com";function vde({onAuthed:e}){const[t,n]=g.useState(!1),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>()=>{s.current&&window.removeEventListener("message",s.current)},[]);const o=g.useCallback(()=>{s.current&&(window.removeEventListener("message",s.current),s.current=null),n(!0),i(null);const a=window.location.origin,l=`${LE}/auth/authorize?callback_url=${encodeURIComponent(a)}&auto=1`,c=async d=>{if(d.origin!==LE)return;const f=d.data;if((f==null?void 0:f.type)==="AUTH_CANCEL"){u(),n(!1);return}if(!((f==null?void 0:f.type)!=="AUTH_SUCCESS"||!f.token)){u();try{const p=await fetch(`${window.location.origin}/share/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ttcToken:f.token})});if(!p.ok){const v=await p.json().catch(()=>({}));throw new Error(v.code??`exchange failed (${p.status})`)}const m=await p.json();if(!m.visitorToken)throw new Error("no visitorToken in response");e(m.visitorToken)}catch(p){i(p instanceof Error?p.message:String(p)),n(!1)}}},u=()=>{window.removeEventListener("message",c),s.current=null};s.current=d=>void c(d),window.addEventListener("message",s.current),window.open(l,"ttc-login","width=480,height=640")},[e]);return h.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 font-sans text-text-100","data-testid":"guest-login",children:h.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-3 rounded-lg border border-border bg-bg-100 px-5 py-6",children:[h.jsx("h1",{className:"text-base font-semibold",children:"登录后进入分享"}),h.jsx("p",{className:"text-[11px] leading-snug text-text-400",children:"使用飞书账号登录,即可在浏览器里与分享给你的 persona 交互,无需安装。"}),r?h.jsxs("p",{className:"text-[11px] leading-snug text-error","data-testid":"guest-login-error",children:["登录失败:",r]}):null,h.jsx("button",{type:"button",disabled:t,onClick:()=>o(),"data-testid":"guest-login-button",className:"w-full rounded border border-border bg-bg-50 px-2 py-1.5 text-xs text-text-200 transition-colors hover:bg-text-100/5 hover:text-text-100 disabled:opacity-50",children:t?"请在弹窗中完成授权…":"飞书登录"})]})})}const T1="clawd-visitor:token";function xde(e,t){const r=`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}`;return t!=null&&t.devPath?`${r}${t.devPath}`:r}function yde(){return{async getUrl(e){const t=localStorage.getItem(T1);if(!t)throw new Error("NO_VISITOR_TOKEN");const n=xde(window.location,{});return await VT(e).upsert({id:"guest",name:"访客",mode:"remote",url:n,token:t}),{url:n}}}}function _de(e){const t=n=>{document.documentElement.classList.toggle("dark",n==="dark")};return t(e.theme.mode),e.onThemeChange(n=>t(n.mode))}function bde(){const e=Ni(),t=g.useMemo(()=>Hz(e),[e]);return h.jsx(Sz,{cache:t.cache,children:h.jsx(Ez,{children:h.jsx(gde,{})})})}function wde({host:e}){const[t]=g.useState(()=>localStorage.getItem(T1)),[n,r]=g.useState(!1),[i,s]=g.useState(null);return g.useEffect(()=>_de(e),[e]),g.useEffect(()=>{if(!t)return;let o=!1;return yde().getUrl(e).then(()=>{o||r(!0)}).catch(a=>{o||s(a instanceof Error?a.message:String(a))}),()=>{o=!0}},[e,t]),t?h.jsx(Xw,{host:e,children:h.jsx(TS,{children:i?h.jsxs("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 text-center text-xs text-error","data-testid":"guest-share-connect-error",children:["连接失败:",i]}):n?h.jsx(_z,{host:e,children:h.jsx(bde,{})}):h.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 text-xs text-text-400",children:"正在连接…"})})}):h.jsx(Xw,{host:e,children:h.jsx(TS,{children:h.jsx(vde,{onAuthed:o=>{localStorage.setItem(T1,o),window.location.reload()}})})})}function Sde({filePath:e,oldString:t,newString:n,content:r}){const i=g.useMemo(()=>r!=null?r.split(/\r?\n/).map(s=>({type:"add",text:s})):kde(t??"",n??""),[t,n,r]);return h.jsxs("div",{"data-testid":"inline-diff",className:"min-w-0 max-w-full rounded-lg border border-bg-300/60 bg-bg-50 overflow-hidden text-[12px] font-mono",children:[h.jsx("div",{className:"flex min-w-0 items-center gap-2 px-3 py-1.5 border-b border-bg-300/40 bg-bg-100/30",children:h.jsx("span",{className:"min-w-0 text-text-400 truncate",title:e,children:e})}),h.jsx("div",{className:"max-h-[320px] max-w-full overflow-auto",children:i.map((s,o)=>h.jsxs("div",{"data-testid":`diff-line-${s.type}`,className:ie("flex min-w-max gap-2 px-3 py-0.5 whitespace-pre",s.type==="add"?"bg-success/10 text-success":s.type==="remove"?"bg-error/10 text-error":"text-text-300"),children:[h.jsx("span",{className:"w-3 shrink-0 select-none opacity-60",children:s.type==="add"?"+":s.type==="remove"?"-":" "}),h.jsx("span",{className:"flex-1",children:s.text||" "})]},o))})]})}function kde(e,t){const n=e.split(/\r?\n/),r=t.split(/\r?\n/),i=n.length,s=r.length,o=Array.from({length:i+1},()=>new Array(s+1).fill(0));for(let u=i-1;u>=0;u--)for(let d=s-1;d>=0;d--)o[u][d]=n[u]===r[d]?o[u+1][d+1]+1:Math.max(o[u+1][d],o[u][d+1]);const a=[];let l=0,c=0;for(;l<i&&c<s;)n[l]===r[c]?(a.push({type:"equal",text:n[l]}),l++,c++):o[l+1][c]>=o[l][c+1]?(a.push({type:"remove",text:n[l]}),l++):(a.push({type:"add",text:r[c]}),c++);for(;l<i;)a.push({type:"remove",text:n[l++]});for(;c<s;)a.push({type:"add",text:r[c++]});return a}function Cde({items:e}){return e.length===0?null:h.jsxs("div",{"data-testid":"todo-checklist",className:"rounded-lg border border-bg-300/60 bg-bg-50 px-3 py-2 text-[13px]",children:[h.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-400/70 mb-1.5",children:"Todos"}),h.jsx("ul",{className:"flex flex-col gap-1",children:e.map((t,n)=>{const r=t.status==="in_progress"&&t.activeForm||t.content;return h.jsxs("li",{"data-testid":`todo-item-${t.status}`,className:"flex items-start gap-2",children:[h.jsx(Ede,{status:t.status}),h.jsx("span",{className:ie("flex-1 leading-snug",t.status==="completed"?"text-text-400 line-through":t.status==="in_progress"?"text-text-100 font-medium":"text-text-200"),children:r})]},n)})})]})}function Ede({status:e}){return e==="completed"?h.jsx(e_,{className:"w-3.5 h-3.5 text-success mt-0.5 shrink-0"}):e==="in_progress"?h.jsx(Tn,{className:"w-3.5 h-3.5 text-warning mt-0.5 shrink-0 animate-spin"}):h.jsx(N7,{className:"w-3.5 h-3.5 text-text-400 mt-0.5 shrink-0"})}function Ide(e){const t=e??{};return Array.isArray(t.todos)?t.todos.map(n=>{if(!n||typeof n!="object")return null;const r=n,i=typeof r.content=="string"?r.content:"",s=r.status==="pending"||r.status==="in_progress"||r.status==="completed"?r.status:"pending",o=typeof r.activeForm=="string"?r.activeForm:void 0;return{content:i,status:s,activeForm:o}}).filter(n=>n!==null):[]}function Nde({description:e,prompt:t,subagentType:n}){return h.jsxs("div",{"data-testid":"task-checklist",className:"rounded-lg border border-bg-300/60 bg-bg-50 px-3 py-2 text-[13px]",children:[h.jsxs("div",{className:"flex items-center gap-2 text-text-200 font-medium",children:[h.jsx(em,{className:"w-3.5 h-3.5 text-accent shrink-0"}),h.jsx("span",{className:"truncate",children:e||"subagent task"}),n?h.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded-md text-[10px] font-mono bg-accent/10 text-accent",children:n}):null]}),t?h.jsx("div",{className:"mt-1 text-[12px] text-text-400 leading-snug line-clamp-3",children:t}):null]})}function Tde(e){const t=e??{};return{description:typeof t.description=="string"?t.description:"",prompt:typeof t.prompt=="string"?t.prompt:void 0,subagentType:typeof t.subagent_type=="string"?t.subagent_type:void 0}}const Pde={render:({input:e})=>Ze.createElement(Cde,{items:Ide(e)})},Rde={render:({input:e})=>{const{description:t,prompt:n,subagentType:r}=Tde(e);return Ze.createElement(Nde,{description:t,prompt:n,subagentType:r})}},DE={render:({input:e,output:t,error:n,pending:r,fileScope:i,onShareFile:s,onOpenInTab:o,onPreviewMarkdown:a})=>{const l=Ade(e),c=l?Ze.createElement(Sde,{filePath:l.filePath,oldString:l.oldString,newString:l.newString,content:l.content}):void 0;return Ze.createElement(wM,{tool:Mde(e),input:e,output:t,error:n,pending:r,expandedBody:c,...i?{fileScope:i}:{},...s?{onShareFile:s}:{},...o?{onOpenInTab:o}:{},...a?{onPreviewMarkdown:a}:{}})}};function Mde(e){const t=e??{};return"content"in t&&t.content!==void 0?"Write":("old_string"in t&&t.old_string!==void 0,"Edit")}function Ade(e){const t=e??{},n=typeof t.file_path=="string"?t.file_path:null;if(!n)return null;const r=typeof t.old_string=="string"?t.old_string:void 0,i=typeof t.new_string=="string"?t.new_string:void 0,s=typeof t.content=="string"?t.content:void 0;return r==null&&i==null&&s==null?null:{filePath:n,oldString:r,newString:i,content:s}}for(const e of["claude",c9])za.register(e,"TodoWrite",Pde),za.register(e,"Task",Rde),za.register(e,"Edit",DE),za.register(e,"Write",DE);const Rj=document.getElementById("root");if(!Rj)throw new Error("guest-main: #root not found");const jde=dO({});I0.createRoot(Rj).render(h.jsx(Ze.StrictMode,{children:h.jsx(wde,{host:jde})}));
|