groove-dev 0.17.2 → 0.17.3

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.
@@ -40,13 +40,13 @@
40
40
  * LICENSE file in the root directory of this source tree.
41
41
  */var Gk;function Y3(){if(Gk)return Ah;Gk=1;var t=V3(),e=Gu(),i=W$();function n(o){var l="https://react.dev/errors/"+o;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)l+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var l=o,u=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,(l.flags&4098)!==0&&(u=l.return),o=l.return;while(o)}return l.tag===3?u:null}function a(o){if(o.tag===13){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function c(o){if(o.tag===31){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function h(o){if(s(o)!==o)throw Error(n(188))}function d(o){var l=o.alternate;if(!l){if(l=s(o),l===null)throw Error(n(188));return l!==o?null:o}for(var u=o,p=l;;){var y=u.return;if(y===null)break;var b=y.alternate;if(b===null){if(p=y.return,p!==null){u=p;continue}break}if(y.child===b.child){for(b=y.child;b;){if(b===u)return h(y),o;if(b===p)return h(y),l;b=b.sibling}throw Error(n(188))}if(u.return!==p.return)u=y,p=b;else{for(var C=!1,A=y.child;A;){if(A===u){C=!0,u=y,p=b;break}if(A===p){C=!0,p=y,u=b;break}A=A.sibling}if(!C){for(A=b.child;A;){if(A===u){C=!0,u=b,p=y;break}if(A===p){C=!0,p=b,u=y;break}A=A.sibling}if(!C)throw Error(n(189))}}if(u.alternate!==p)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?o:l}function f(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o;for(o=o.child;o!==null;){if(l=f(o),l!==null)return l;o=o.sibling}return null}var g=Object.assign,m=Symbol.for("react.element"),O=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),k=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),ee=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function j(o){return o===null||typeof o!="object"?null:(o=I&&o[I]||o["@@iterator"],typeof o=="function"?o:null)}var D=Symbol.for("react.client.reference");function E(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===D?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case _:return"Fragment";case x:return"Profiler";case w:return"StrictMode";case M:return"Suspense";case $:return"SuspenseList";case H:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case S:return"Portal";case k:return o.displayName||"Context";case Q:return(o._context.displayName||"Context")+".Consumer";case T:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case R:return l=o.displayName||null,l!==null?l:E(o.type)||"Memo";case V:l=o._payload,o=o._init;try{return E(o(l))}catch{}}return null}var X=Array.isArray,P=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L={pending:!1,data:null,method:null,action:null},B=[],G=-1;function z(o){return{current:o}}function q(o){0>G||(o.current=B[G],B[G]=null,G--)}function K(o,l){G++,B[G]=o.current,o.current=l}var ie=z(null),ce=z(null),de=z(null),pe=z(null);function fe(o,l){switch(K(de,l),K(ce,o),K(ie,null),l.nodeType){case 9:case 11:o=(o=l.documentElement)&&(o=o.namespaceURI)?uk(o):0;break;default:if(o=l.tagName,l=l.namespaceURI)l=uk(l),o=dk(l,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}q(ie),K(ie,o)}function ve(){q(ie),q(ce),q(de)}function De(o){o.memoizedState!==null&&K(pe,o);var l=ie.current,u=dk(l,o.type);l!==u&&(K(ce,o),K(ie,u))}function Ee(o){ce.current===o&&(q(ie),q(ce)),pe.current===o&&(q(pe),Qh._currentValue=L)}var ke,me;function Be(o){if(ke===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);ke=l&&l[1]||"",me=-1<u.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+ke+o+me}var lt=!1;function Ue(o,l){if(!o||lt)return"";lt=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(l){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(re){var ne=re}Reflect.construct(o,[],he)}else{try{he.call()}catch(re){ne=re}o.call(he.prototype)}}else{try{throw Error()}catch(re){ne=re}(he=o())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(re){if(re&&ne&&typeof re.stack=="string")return[re.stack,ne.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=p.DetermineComponentFrameRoot(),C=b[0],A=b[1];if(C&&A){var Y=C.split(`
43
+ `+ke+o+me}var lt=!1;function He(o,l){if(!o||lt)return"";lt=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(l){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(re){var ne=re}Reflect.construct(o,[],he)}else{try{he.call()}catch(re){ne=re}o.call(he.prototype)}}else{try{throw Error()}catch(re){ne=re}(he=o())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(re){if(re&&ne&&typeof re.stack=="string")return[re.stack,ne.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=p.DetermineComponentFrameRoot(),C=b[0],A=b[1];if(C&&A){var Y=C.split(`
44
44
  `),te=A.split(`
45
45
  `);for(y=p=0;p<Y.length&&!Y[p].includes("DetermineComponentFrameRoot");)p++;for(;y<te.length&&!te[y].includes("DetermineComponentFrameRoot");)y++;if(p===Y.length||y===te.length)for(p=Y.length-1,y=te.length-1;1<=p&&0<=y&&Y[p]!==te[y];)y--;for(;1<=p&&0<=y;p--,y--)if(Y[p]!==te[y]){if(p!==1||y!==1)do if(p--,y--,0>y||Y[p]!==te[y]){var se=`
46
- `+Y[p].replace(" at new "," at ");return o.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",o.displayName)),se}while(1<=p&&0<=y);break}}}finally{lt=!1,Error.prepareStackTrace=u}return(u=o?o.displayName||o.name:"")?Be(u):""}function Ft(o,l){switch(o.tag){case 26:case 27:case 5:return Be(o.type);case 16:return Be("Lazy");case 13:return o.child!==l&&l!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return Ue(o.type,!1);case 11:return Ue(o.type.render,!1);case 1:return Ue(o.type,!0);case 31:return Be("Activity");default:return""}}function rn(o){try{var l="",u=null;do l+=Ft(o,u),u=o,o=o.return;while(o);return l}catch(p){return`
46
+ `+Y[p].replace(" at new "," at ");return o.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",o.displayName)),se}while(1<=p&&0<=y);break}}}finally{lt=!1,Error.prepareStackTrace=u}return(u=o?o.displayName||o.name:"")?Be(u):""}function Ft(o,l){switch(o.tag){case 26:case 27:case 5:return Be(o.type);case 16:return Be("Lazy");case 13:return o.child!==l&&l!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return He(o.type,!1);case 11:return He(o.type.render,!1);case 1:return He(o.type,!0);case 31:return Be("Activity");default:return""}}function rn(o){try{var l="",u=null;do l+=Ft(o,u),u=o,o=o.return;while(o);return l}catch(p){return`
47
47
  Error generating stack: `+p.message+`
48
- `+p.stack}}var qi=Object.prototype.hasOwnProperty,_n=t.unstable_scheduleCallback,ar=t.unstable_cancelCallback,oe=t.unstable_shouldYield,We=t.unstable_requestPaint,Le=t.unstable_now,sn=t.unstable_getCurrentPriorityLevel,on=t.unstable_ImmediatePriority,Vi=t.unstable_UserBlockingPriority,Go=t.unstable_NormalPriority,Rm=t.unstable_LowPriority,tl=t.unstable_IdlePriority,Am=t.log,Mm=t.unstable_setDisableYieldValue,Fo=null,Ii=null;function wr(o){if(typeof Am=="function"&&Mm(o),Ii&&typeof Ii.setStrictMode=="function")try{Ii.setStrictMode(Fo,o)}catch{}}var Yi=Math.clz32?Math.clz32:Dm,zm=Math.log,jm=Math.LN2;function Dm(o){return o>>>=0,o===0?32:31-(zm(o)/jm|0)|0}var il=256,nl=262144,rl=4194304;function Kr(o){var l=o&42;if(l!==0)return l;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function sl(o,l,u){var p=o.pendingLanes;if(p===0)return 0;var y=0,b=o.suspendedLanes,C=o.pingedLanes;o=o.warmLanes;var A=p&134217727;return A!==0?(p=A&~b,p!==0?y=Kr(p):(C&=A,C!==0?y=Kr(C):u||(u=A&~o,u!==0&&(y=Kr(u))))):(A=p&~b,A!==0?y=Kr(A):C!==0?y=Kr(C):u||(u=p&~o,u!==0&&(y=Kr(u)))),y===0?0:l!==0&&l!==y&&(l&b)===0&&(b=y&-y,u=l&-l,b>=u||b===32&&(u&4194048)!==0)?l:y}function Ko(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function Bm(o,l){switch(o){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Od(){var o=rl;return rl<<=1,(rl&62914560)===0&&(rl=4194304),o}function Lc(o){for(var l=[],u=0;31>u;u++)l.push(o);return l}function Jo(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Lm(o,l,u,p,y,b){var C=o.pendingLanes;o.pendingLanes=u,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=u,o.entangledLanes&=u,o.errorRecoveryDisabledLanes&=u,o.shellSuspendCounter=0;var A=o.entanglements,Y=o.expirationTimes,te=o.hiddenUpdates;for(u=C&~u;0<u;){var se=31-Yi(u),he=1<<se;A[se]=0,Y[se]=-1;var ne=te[se];if(ne!==null)for(te[se]=null,se=0;se<ne.length;se++){var re=ne[se];re!==null&&(re.lane&=-536870913)}u&=~he}p!==0&&vd(o,p,0),b!==0&&y===0&&o.tag!==0&&(o.suspendedLanes|=b&~(C&~l))}function vd(o,l,u){o.pendingLanes|=l,o.suspendedLanes&=~l;var p=31-Yi(l);o.entangledLanes|=l,o.entanglements[p]=o.entanglements[p]|1073741824|u&261930}function yd(o,l){var u=o.entangledLanes|=l;for(o=o.entanglements;u;){var p=31-Yi(u),y=1<<p;y&l|o[p]&l&&(o[p]|=l),u&=~y}}function Sd(o,l){var u=l&-l;return u=(u&42)!==0?1:Xc(u),(u&(o.suspendedLanes|l))!==0?0:u}function Xc(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Nc(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function bd(){var o=Z.p;return o!==0?o:(o=window.event,o===void 0?32:zk(o.type))}function _d(o,l){var u=Z.p;try{return Z.p=o,l()}finally{Z.p=u}}var kr=Math.random().toString(36).slice(2),li="__reactFiber$"+kr,Di="__reactProps$"+kr,Jr="__reactContainer$"+kr,ol="__reactEvents$"+kr,xd="__reactListeners$"+kr,Xm="__reactHandles$"+kr,wd="__reactResources$"+kr,ea="__reactMarker$"+kr;function Zc(o){delete o[li],delete o[Di],delete o[ol],delete o[xd],delete o[Xm]}function Zs(o){var l=o[li];if(l)return l;for(var u=o.parentNode;u;){if(l=u[Jr]||u[li]){if(u=l.alternate,l.child!==null||u!==null&&u.child!==null)for(o=yk(o);o!==null;){if(u=o[li])return u;o=yk(o)}return l}o=u,u=o.parentNode}return null}function Ws(o){if(o=o[li]||o[Jr]){var l=o.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return o}return null}function qs(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o.stateNode;throw Error(n(33))}function Vs(o){var l=o[wd];return l||(l=o[wd]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Kt(o){o[ea]=!0}var kd=new Set,Cd={};function es(o,l){Is(o,l),Is(o+"Capture",l)}function Is(o,l){for(Cd[o]=l,o=0;o<l.length;o++)kd.add(l[o])}var Nm=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Wc={},Td={};function Zm(o){return qi.call(Td,o)?!0:qi.call(Wc,o)?!1:Nm.test(o)?Td[o]=!0:(Wc[o]=!0,!1)}function al(o,l,u){if(Zm(l))if(u===null)o.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":o.removeAttribute(l);return;case"boolean":var p=l.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){o.removeAttribute(l);return}}o.setAttribute(l,""+u)}}function ll(o,l,u){if(u===null)o.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(l);return}o.setAttribute(l,""+u)}}function lr(o,l,u,p){if(p===null)o.removeAttribute(u);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(u);return}o.setAttributeNS(l,u,""+p)}}function an(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Qd(o){var l=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Wm(o,l,u){var p=Object.getOwnPropertyDescriptor(o.constructor.prototype,l);if(!o.hasOwnProperty(l)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var y=p.get,b=p.set;return Object.defineProperty(o,l,{configurable:!0,get:function(){return y.call(this)},set:function(C){u=""+C,b.call(this,C)}}),Object.defineProperty(o,l,{enumerable:p.enumerable}),{getValue:function(){return u},setValue:function(C){u=""+C},stopTracking:function(){o._valueTracker=null,delete o[l]}}}}function Ys(o){if(!o._valueTracker){var l=Qd(o)?"checked":"value";o._valueTracker=Wm(o,l,""+o[l])}}function $d(o){if(!o)return!1;var l=o._valueTracker;if(!l)return!0;var u=l.getValue(),p="";return o&&(p=Qd(o)?o.checked?"true":"false":o.value),o=p,o!==u?(l.setValue(o),!0):!1}function ta(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var qm=/[\n"\\]/g;function ln(o){return o.replace(qm,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function ia(o,l,u,p,y,b,C,A){o.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?o.type=C:o.removeAttribute("type"),l!=null?C==="number"?(l===0&&o.value===""||o.value!=l)&&(o.value=""+an(l)):o.value!==""+an(l)&&(o.value=""+an(l)):C!=="submit"&&C!=="reset"||o.removeAttribute("value"),l!=null?qc(o,C,an(l)):u!=null?qc(o,C,an(u)):p!=null&&o.removeAttribute("value"),y==null&&b!=null&&(o.defaultChecked=!!b),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?o.name=""+an(A):o.removeAttribute("name")}function Pd(o,l,u,p,y,b,C,A){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(o.type=b),l!=null||u!=null){if(!(b!=="submit"&&b!=="reset"||l!=null)){Ys(o);return}u=u!=null?""+an(u):"",l=l!=null?""+an(l):u,A||l===o.value||(o.value=l),o.defaultValue=l}p=p??y,p=typeof p!="function"&&typeof p!="symbol"&&!!p,o.checked=A?o.checked:!!p,o.defaultChecked=!!p,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(o.name=C),Ys(o)}function qc(o,l,u){l==="number"&&ta(o.ownerDocument)===o||o.defaultValue===""+u||(o.defaultValue=""+u)}function ts(o,l,u,p){if(o=o.options,l){l={};for(var y=0;y<u.length;y++)l["$"+u[y]]=!0;for(u=0;u<o.length;u++)y=l.hasOwnProperty("$"+o[u].value),o[u].selected!==y&&(o[u].selected=y),y&&p&&(o[u].defaultSelected=!0)}else{for(u=""+an(u),l=null,y=0;y<o.length;y++){if(o[y].value===u){o[y].selected=!0,p&&(o[y].defaultSelected=!0);return}l!==null||o[y].disabled||(l=o[y])}l!==null&&(l.selected=!0)}}function o_(o,l,u){if(l!=null&&(l=""+an(l),l!==o.value&&(o.value=l),u==null)){o.defaultValue!==l&&(o.defaultValue=l);return}o.defaultValue=u!=null?""+an(u):""}function a_(o,l,u,p){if(l==null){if(p!=null){if(u!=null)throw Error(n(92));if(X(p)){if(1<p.length)throw Error(n(93));p=p[0]}u=p}u==null&&(u=""),l=u}u=an(l),o.defaultValue=u,p=o.textContent,p===u&&p!==""&&p!==null&&(o.value=p),Ys(o)}function cl(o,l){if(l){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=l;return}}o.textContent=l}var jz=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function l_(o,l,u){var p=l.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?p?o.setProperty(l,""):l==="float"?o.cssFloat="":o[l]="":p?o.setProperty(l,u):typeof u!="number"||u===0||jz.has(l)?l==="float"?o.cssFloat=u:o[l]=(""+u).trim():o[l]=u+"px"}function c_(o,l,u){if(l!=null&&typeof l!="object")throw Error(n(62));if(o=o.style,u!=null){for(var p in u)!u.hasOwnProperty(p)||l!=null&&l.hasOwnProperty(p)||(p.indexOf("--")===0?o.setProperty(p,""):p==="float"?o.cssFloat="":o[p]="");for(var y in l)p=l[y],l.hasOwnProperty(y)&&u[y]!==p&&l_(o,y,p)}else for(var b in l)l.hasOwnProperty(b)&&l_(o,b,l[b])}function Vm(o){if(o.indexOf("-")===-1)return!1;switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Dz=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Bz=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ed(o){return Bz.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function is(){}var Im=null;function Ym(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var hl=null,ul=null;function h_(o){var l=Ws(o);if(l&&(o=l.stateNode)){var u=o[Di]||null;e:switch(o=l.stateNode,l.type){case"input":if(ia(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),l=u.name,u.type==="radio"&&l!=null){for(u=o;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+ln(""+l)+'"][type="radio"]'),l=0;l<u.length;l++){var p=u[l];if(p!==o&&p.form===o.form){var y=p[Di]||null;if(!y)throw Error(n(90));ia(p,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(l=0;l<u.length;l++)p=u[l],p.form===o.form&&$d(p)}break e;case"textarea":o_(o,u.value,u.defaultValue);break e;case"select":l=u.value,l!=null&&ts(o,!!u.multiple,l,!1)}}}var Hm=!1;function u_(o,l,u){if(Hm)return o(l,u);Hm=!0;try{var p=o(l);return p}finally{if(Hm=!1,(hl!==null||ul!==null)&&(yf(),hl&&(l=hl,o=ul,ul=hl=null,h_(l),o)))for(l=0;l<o.length;l++)h_(o[l])}}function Vc(o,l){var u=o.stateNode;if(u===null)return null;var p=u[Di]||null;if(p===null)return null;u=p[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(o=o.type,p=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!p;break e;default:o=!1}if(o)return null;if(u&&typeof u!="function")throw Error(n(231,l,typeof u));return u}var ns=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Um=!1;if(ns)try{var Ic={};Object.defineProperty(Ic,"passive",{get:function(){Um=!0}}),window.addEventListener("test",Ic,Ic),window.removeEventListener("test",Ic,Ic)}catch{Um=!1}var Hs=null,Gm=null,Rd=null;function d_(){if(Rd)return Rd;var o,l=Gm,u=l.length,p,y="value"in Hs?Hs.value:Hs.textContent,b=y.length;for(o=0;o<u&&l[o]===y[o];o++);var C=u-o;for(p=1;p<=C&&l[u-p]===y[b-p];p++);return Rd=y.slice(o,1<p?1-p:void 0)}function Ad(o){var l=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&l===13&&(o=13)):o=l,o===10&&(o=13),32<=o||o===13?o:0}function Md(){return!0}function f_(){return!1}function cn(o){function l(u,p,y,b,C){this._reactName=u,this._targetInst=y,this.type=p,this.nativeEvent=b,this.target=C,this.currentTarget=null;for(var A in o)o.hasOwnProperty(A)&&(u=o[A],this[A]=u?u(b):b[A]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?Md:f_,this.isPropagationStopped=f_,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Md)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Md)},persist:function(){},isPersistent:Md}),l}var na={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zd=cn(na),Yc=g({},na,{view:0,detail:0}),Lz=cn(Yc),Fm,Km,Hc,jd=g({},Yc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:eO,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Hc&&(Hc&&o.type==="mousemove"?(Fm=o.screenX-Hc.screenX,Km=o.screenY-Hc.screenY):Km=Fm=0,Hc=o),Fm)},movementY:function(o){return"movementY"in o?o.movementY:Km}}),p_=cn(jd),Xz=g({},jd,{dataTransfer:0}),Nz=cn(Xz),Zz=g({},Yc,{relatedTarget:0}),Jm=cn(Zz),Wz=g({},na,{animationName:0,elapsedTime:0,pseudoElement:0}),qz=cn(Wz),Vz=g({},na,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),Iz=cn(Vz),Yz=g({},na,{data:0}),g_=cn(Yz),Hz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Uz={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Gz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Fz(o){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(o):(o=Gz[o])?!!l[o]:!1}function eO(){return Fz}var Kz=g({},Yc,{key:function(o){if(o.key){var l=Hz[o.key]||o.key;if(l!=="Unidentified")return l}return o.type==="keypress"?(o=Ad(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?Uz[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:eO,charCode:function(o){return o.type==="keypress"?Ad(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Ad(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Jz=cn(Kz),ej=g({},jd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),m_=cn(ej),tj=g({},Yc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:eO}),ij=cn(tj),nj=g({},na,{propertyName:0,elapsedTime:0,pseudoElement:0}),rj=cn(nj),sj=g({},jd,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),oj=cn(sj),aj=g({},na,{newState:0,oldState:0}),lj=cn(aj),cj=[9,13,27,32],tO=ns&&"CompositionEvent"in window,Uc=null;ns&&"documentMode"in document&&(Uc=document.documentMode);var hj=ns&&"TextEvent"in window&&!Uc,O_=ns&&(!tO||Uc&&8<Uc&&11>=Uc),v_=" ",y_=!1;function S_(o,l){switch(o){case"keyup":return cj.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function b_(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var dl=!1;function uj(o,l){switch(o){case"compositionend":return b_(l);case"keypress":return l.which!==32?null:(y_=!0,v_);case"textInput":return o=l.data,o===v_&&y_?null:o;default:return null}}function dj(o,l){if(dl)return o==="compositionend"||!tO&&S_(o,l)?(o=d_(),Rd=Gm=Hs=null,dl=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return O_&&l.locale!=="ko"?null:l.data;default:return null}}var fj={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function __(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l==="input"?!!fj[o.type]:l==="textarea"}function x_(o,l,u,p){hl?ul?ul.push(p):ul=[p]:hl=p,l=Cf(l,"onChange"),0<l.length&&(u=new zd("onChange","change",null,u,p),o.push({event:u,listeners:l}))}var Gc=null,Fc=null;function pj(o){sk(o,0)}function Dd(o){var l=qs(o);if($d(l))return o}function w_(o,l){if(o==="change")return l}var k_=!1;if(ns){var iO;if(ns){var nO="oninput"in document;if(!nO){var C_=document.createElement("div");C_.setAttribute("oninput","return;"),nO=typeof C_.oninput=="function"}iO=nO}else iO=!1;k_=iO&&(!document.documentMode||9<document.documentMode)}function T_(){Gc&&(Gc.detachEvent("onpropertychange",Q_),Fc=Gc=null)}function Q_(o){if(o.propertyName==="value"&&Dd(Fc)){var l=[];x_(l,Fc,o,Ym(o)),u_(pj,l)}}function gj(o,l,u){o==="focusin"?(T_(),Gc=l,Fc=u,Gc.attachEvent("onpropertychange",Q_)):o==="focusout"&&T_()}function mj(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Dd(Fc)}function Oj(o,l){if(o==="click")return Dd(l)}function vj(o,l){if(o==="input"||o==="change")return Dd(l)}function yj(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var xn=typeof Object.is=="function"?Object.is:yj;function Kc(o,l){if(xn(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var u=Object.keys(o),p=Object.keys(l);if(u.length!==p.length)return!1;for(p=0;p<u.length;p++){var y=u[p];if(!qi.call(l,y)||!xn(o[y],l[y]))return!1}return!0}function $_(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function P_(o,l){var u=$_(o);o=0;for(var p;u;){if(u.nodeType===3){if(p=o+u.textContent.length,o<=l&&p>=l)return{node:u,offset:l-o};o=p}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=$_(u)}}function E_(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?E_(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function R_(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var l=ta(o.document);l instanceof o.HTMLIFrameElement;){try{var u=typeof l.contentWindow.location.href=="string"}catch{u=!1}if(u)o=l.contentWindow;else break;l=ta(o.document)}return l}function rO(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}var Sj=ns&&"documentMode"in document&&11>=document.documentMode,fl=null,sO=null,Jc=null,oO=!1;function A_(o,l,u){var p=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;oO||fl==null||fl!==ta(p)||(p=fl,"selectionStart"in p&&rO(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Jc&&Kc(Jc,p)||(Jc=p,p=Cf(sO,"onSelect"),0<p.length&&(l=new zd("onSelect","select",null,l,u),o.push({event:l,listeners:p}),l.target=fl)))}function ra(o,l){var u={};return u[o.toLowerCase()]=l.toLowerCase(),u["Webkit"+o]="webkit"+l,u["Moz"+o]="moz"+l,u}var pl={animationend:ra("Animation","AnimationEnd"),animationiteration:ra("Animation","AnimationIteration"),animationstart:ra("Animation","AnimationStart"),transitionrun:ra("Transition","TransitionRun"),transitionstart:ra("Transition","TransitionStart"),transitioncancel:ra("Transition","TransitionCancel"),transitionend:ra("Transition","TransitionEnd")},aO={},M_={};ns&&(M_=document.createElement("div").style,"AnimationEvent"in window||(delete pl.animationend.animation,delete pl.animationiteration.animation,delete pl.animationstart.animation),"TransitionEvent"in window||delete pl.transitionend.transition);function sa(o){if(aO[o])return aO[o];if(!pl[o])return o;var l=pl[o],u;for(u in l)if(l.hasOwnProperty(u)&&u in M_)return aO[o]=l[u];return o}var z_=sa("animationend"),j_=sa("animationiteration"),D_=sa("animationstart"),bj=sa("transitionrun"),_j=sa("transitionstart"),xj=sa("transitioncancel"),B_=sa("transitionend"),L_=new Map,lO="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");lO.push("scrollEnd");function cr(o,l){L_.set(o,l),es(l,[o])}var Bd=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Zn=[],gl=0,cO=0;function Ld(){for(var o=gl,l=cO=gl=0;l<o;){var u=Zn[l];Zn[l++]=null;var p=Zn[l];Zn[l++]=null;var y=Zn[l];Zn[l++]=null;var b=Zn[l];if(Zn[l++]=null,p!==null&&y!==null){var C=p.pending;C===null?y.next=y:(y.next=C.next,C.next=y),p.pending=y}b!==0&&X_(u,y,b)}}function Xd(o,l,u,p){Zn[gl++]=o,Zn[gl++]=l,Zn[gl++]=u,Zn[gl++]=p,cO|=p,o.lanes|=p,o=o.alternate,o!==null&&(o.lanes|=p)}function hO(o,l,u,p){return Xd(o,l,u,p),Nd(o)}function oa(o,l){return Xd(o,null,null,l),Nd(o)}function X_(o,l,u){o.lanes|=u;var p=o.alternate;p!==null&&(p.lanes|=u);for(var y=!1,b=o.return;b!==null;)b.childLanes|=u,p=b.alternate,p!==null&&(p.childLanes|=u),b.tag===22&&(o=b.stateNode,o===null||o._visibility&1||(y=!0)),o=b,b=b.return;return o.tag===3?(b=o.stateNode,y&&l!==null&&(y=31-Yi(u),o=b.hiddenUpdates,p=o[y],p===null?o[y]=[l]:p.push(l),l.lane=u|536870912),b):null}function Nd(o){if(50<bh)throw bh=0,y0=null,Error(n(185));for(var l=o.return;l!==null;)o=l,l=o.return;return o.tag===3?o.stateNode:null}var ml={};function wj(o,l,u,p){this.tag=o,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wn(o,l,u,p){return new wj(o,l,u,p)}function uO(o){return o=o.prototype,!(!o||!o.isReactComponent)}function rs(o,l){var u=o.alternate;return u===null?(u=wn(o.tag,l,o.key,o.mode),u.elementType=o.elementType,u.type=o.type,u.stateNode=o.stateNode,u.alternate=o,o.alternate=u):(u.pendingProps=l,u.type=o.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=o.flags&65011712,u.childLanes=o.childLanes,u.lanes=o.lanes,u.child=o.child,u.memoizedProps=o.memoizedProps,u.memoizedState=o.memoizedState,u.updateQueue=o.updateQueue,l=o.dependencies,u.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},u.sibling=o.sibling,u.index=o.index,u.ref=o.ref,u.refCleanup=o.refCleanup,u}function N_(o,l){o.flags&=65011714;var u=o.alternate;return u===null?(o.childLanes=0,o.lanes=l,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=u.childLanes,o.lanes=u.lanes,o.child=u.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=u.memoizedProps,o.memoizedState=u.memoizedState,o.updateQueue=u.updateQueue,o.type=u.type,l=u.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),o}function Zd(o,l,u,p,y,b){var C=0;if(p=o,typeof o=="function")uO(o)&&(C=1);else if(typeof o=="string")C=$3(o,u,ie.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case H:return o=wn(31,u,l,y),o.elementType=H,o.lanes=b,o;case _:return aa(u.children,y,b,l);case w:C=8,y|=24;break;case x:return o=wn(12,u,l,y|2),o.elementType=x,o.lanes=b,o;case M:return o=wn(13,u,l,y),o.elementType=M,o.lanes=b,o;case $:return o=wn(19,u,l,y),o.elementType=$,o.lanes=b,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case k:C=10;break e;case Q:C=9;break e;case T:C=11;break e;case R:C=14;break e;case V:C=16,p=null;break e}C=29,u=Error(n(130,o===null?"null":typeof o,"")),p=null}return l=wn(C,u,l,y),l.elementType=o,l.type=p,l.lanes=b,l}function aa(o,l,u,p){return o=wn(7,o,p,l),o.lanes=u,o}function dO(o,l,u){return o=wn(6,o,null,l),o.lanes=u,o}function Z_(o){var l=wn(18,null,null,0);return l.stateNode=o,l}function fO(o,l,u){return l=wn(4,o.children!==null?o.children:[],o.key,l),l.lanes=u,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}var W_=new WeakMap;function Wn(o,l){if(typeof o=="object"&&o!==null){var u=W_.get(o);return u!==void 0?u:(l={value:o,source:l,stack:rn(l)},W_.set(o,l),l)}return{value:o,source:l,stack:rn(l)}}var Ol=[],vl=0,Wd=null,eh=0,qn=[],Vn=0,Us=null,Cr=1,Tr="";function ss(o,l){Ol[vl++]=eh,Ol[vl++]=Wd,Wd=o,eh=l}function q_(o,l,u){qn[Vn++]=Cr,qn[Vn++]=Tr,qn[Vn++]=Us,Us=o;var p=Cr;o=Tr;var y=32-Yi(p)-1;p&=~(1<<y),u+=1;var b=32-Yi(l)+y;if(30<b){var C=y-y%5;b=(p&(1<<C)-1).toString(32),p>>=C,y-=C,Cr=1<<32-Yi(l)+y|u<<y|p,Tr=b+o}else Cr=1<<b|u<<y|p,Tr=o}function pO(o){o.return!==null&&(ss(o,1),q_(o,1,0))}function gO(o){for(;o===Wd;)Wd=Ol[--vl],Ol[vl]=null,eh=Ol[--vl],Ol[vl]=null;for(;o===Us;)Us=qn[--Vn],qn[Vn]=null,Tr=qn[--Vn],qn[Vn]=null,Cr=qn[--Vn],qn[Vn]=null}function V_(o,l){qn[Vn++]=Cr,qn[Vn++]=Tr,qn[Vn++]=Us,Cr=l.id,Tr=l.overflow,Us=o}var ki=null,$t=null,st=!1,Gs=null,In=!1,mO=Error(n(519));function Fs(o){var l=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw th(Wn(l,o)),mO}function I_(o){var l=o.stateNode,u=o.type,p=o.memoizedProps;switch(l[li]=o,l[Di]=p,u){case"dialog":Je("cancel",l),Je("close",l);break;case"iframe":case"object":case"embed":Je("load",l);break;case"video":case"audio":for(u=0;u<xh.length;u++)Je(xh[u],l);break;case"source":Je("error",l);break;case"img":case"image":case"link":Je("error",l),Je("load",l);break;case"details":Je("toggle",l);break;case"input":Je("invalid",l),Pd(l,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":Je("invalid",l);break;case"textarea":Je("invalid",l),a_(l,p.value,p.defaultValue,p.children)}u=p.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||l.textContent===""+u||p.suppressHydrationWarning===!0||ck(l.textContent,u)?(p.popover!=null&&(Je("beforetoggle",l),Je("toggle",l)),p.onScroll!=null&&Je("scroll",l),p.onScrollEnd!=null&&Je("scrollend",l),p.onClick!=null&&(l.onclick=is),l=!0):l=!1,l||Fs(o,!0)}function Y_(o){for(ki=o.return;ki;)switch(ki.tag){case 5:case 31:case 13:In=!1;return;case 27:case 3:In=!0;return;default:ki=ki.return}}function yl(o){if(o!==ki)return!1;if(!st)return Y_(o),st=!0,!1;var l=o.tag,u;if((u=l!==3&&l!==27)&&((u=l===5)&&(u=o.type,u=!(u!=="form"&&u!=="button")||M0(o.type,o.memoizedProps)),u=!u),u&&$t&&Fs(o),Y_(o),l===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));$t=vk(o)}else if(l===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));$t=vk(o)}else l===27?(l=$t,uo(o.type)?(o=L0,L0=null,$t=o):$t=l):$t=ki?Hn(o.stateNode.nextSibling):null;return!0}function la(){$t=ki=null,st=!1}function OO(){var o=Gs;return o!==null&&(fn===null?fn=o:fn.push.apply(fn,o),Gs=null),o}function th(o){Gs===null?Gs=[o]:Gs.push(o)}var vO=z(null),ca=null,os=null;function Ks(o,l,u){K(vO,l._currentValue),l._currentValue=u}function as(o){o._currentValue=vO.current,q(vO)}function yO(o,l,u){for(;o!==null;){var p=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,p!==null&&(p.childLanes|=l)):p!==null&&(p.childLanes&l)!==l&&(p.childLanes|=l),o===u)break;o=o.return}}function SO(o,l,u,p){var y=o.child;for(y!==null&&(y.return=o);y!==null;){var b=y.dependencies;if(b!==null){var C=y.child;b=b.firstContext;e:for(;b!==null;){var A=b;b=y;for(var Y=0;Y<l.length;Y++)if(A.context===l[Y]){b.lanes|=u,A=b.alternate,A!==null&&(A.lanes|=u),yO(b.return,u,o),p||(C=null);break e}b=A.next}}else if(y.tag===18){if(C=y.return,C===null)throw Error(n(341));C.lanes|=u,b=C.alternate,b!==null&&(b.lanes|=u),yO(C,u,o),C=null}else C=y.child;if(C!==null)C.return=y;else for(C=y;C!==null;){if(C===o){C=null;break}if(y=C.sibling,y!==null){y.return=C.return,C=y;break}C=C.return}y=C}}function Sl(o,l,u,p){o=null;for(var y=l,b=!1;y!==null;){if(!b){if((y.flags&524288)!==0)b=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var C=y.alternate;if(C===null)throw Error(n(387));if(C=C.memoizedProps,C!==null){var A=y.type;xn(y.pendingProps.value,C.value)||(o!==null?o.push(A):o=[A])}}else if(y===pe.current){if(C=y.alternate,C===null)throw Error(n(387));C.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(o!==null?o.push(Qh):o=[Qh])}y=y.return}o!==null&&SO(l,o,u,p),l.flags|=262144}function qd(o){for(o=o.firstContext;o!==null;){if(!xn(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function ha(o){ca=o,os=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Ci(o){return H_(ca,o)}function Vd(o,l){return ca===null&&ha(o),H_(o,l)}function H_(o,l){var u=l._currentValue;if(l={context:l,memoizedValue:u,next:null},os===null){if(o===null)throw Error(n(308));os=l,o.dependencies={lanes:0,firstContext:l},o.flags|=524288}else os=os.next=l;return u}var kj=typeof AbortController<"u"?AbortController:function(){var o=[],l=this.signal={aborted:!1,addEventListener:function(u,p){o.push(p)}};this.abort=function(){l.aborted=!0,o.forEach(function(u){return u()})}},Cj=t.unstable_scheduleCallback,Tj=t.unstable_NormalPriority,Jt={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bO(){return{controller:new kj,data:new Map,refCount:0}}function ih(o){o.refCount--,o.refCount===0&&Cj(Tj,function(){o.controller.abort()})}var nh=null,_O=0,bl=0,_l=null;function Qj(o,l){if(nh===null){var u=nh=[];_O=0,bl=k0(),_l={status:"pending",value:void 0,then:function(p){u.push(p)}}}return _O++,l.then(U_,U_),l}function U_(){if(--_O===0&&nh!==null){_l!==null&&(_l.status="fulfilled");var o=nh;nh=null,bl=0,_l=null;for(var l=0;l<o.length;l++)(0,o[l])()}}function $j(o,l){var u=[],p={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return o.then(function(){p.status="fulfilled",p.value=l;for(var y=0;y<u.length;y++)(0,u[y])(l)},function(y){for(p.status="rejected",p.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),p}var G_=P.S;P.S=function(o,l){Aw=Le(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&Qj(o,l),G_!==null&&G_(o,l)};var ua=z(null);function xO(){var o=ua.current;return o!==null?o:wt.pooledCache}function Id(o,l){l===null?K(ua,ua.current):K(ua,l.pool)}function F_(){var o=xO();return o===null?null:{parent:Jt._currentValue,pool:o}}var xl=Error(n(460)),wO=Error(n(474)),Yd=Error(n(542)),Hd={then:function(){}};function K_(o){return o=o.status,o==="fulfilled"||o==="rejected"}function J_(o,l,u){switch(u=o[u],u===void 0?o.push(l):u!==l&&(l.then(is,is),l=u),l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,tx(o),o;default:if(typeof l.status=="string")l.then(is,is);else{if(o=wt,o!==null&&100<o.shellSuspendCounter)throw Error(n(482));o=l,o.status="pending",o.then(function(p){if(l.status==="pending"){var y=l;y.status="fulfilled",y.value=p}},function(p){if(l.status==="pending"){var y=l;y.status="rejected",y.reason=p}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,tx(o),o}throw fa=l,xl}}function da(o){try{var l=o._init;return l(o._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(fa=u,xl):u}}var fa=null;function ex(){if(fa===null)throw Error(n(459));var o=fa;return fa=null,o}function tx(o){if(o===xl||o===Yd)throw Error(n(483))}var wl=null,rh=0;function Ud(o){var l=rh;return rh+=1,wl===null&&(wl=[]),J_(wl,o,l)}function sh(o,l){l=l.props.ref,o.ref=l!==void 0?l:null}function Gd(o,l){throw l.$$typeof===m?Error(n(525)):(o=Object.prototype.toString.call(l),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o)))}function ix(o){function l(F,U){if(o){var J=F.deletions;J===null?(F.deletions=[U],F.flags|=16):J.push(U)}}function u(F,U){if(!o)return null;for(;U!==null;)l(F,U),U=U.sibling;return null}function p(F){for(var U=new Map;F!==null;)F.key!==null?U.set(F.key,F):U.set(F.index,F),F=F.sibling;return U}function y(F,U){return F=rs(F,U),F.index=0,F.sibling=null,F}function b(F,U,J){return F.index=J,o?(J=F.alternate,J!==null?(J=J.index,J<U?(F.flags|=67108866,U):J):(F.flags|=67108866,U)):(F.flags|=1048576,U)}function C(F){return o&&F.alternate===null&&(F.flags|=67108866),F}function A(F,U,J,ae){return U===null||U.tag!==6?(U=dO(J,F.mode,ae),U.return=F,U):(U=y(U,J),U.return=F,U)}function Y(F,U,J,ae){var Ae=J.type;return Ae===_?se(F,U,J.props.children,ae,J.key):U!==null&&(U.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===V&&da(Ae)===U.type)?(U=y(U,J.props),sh(U,J),U.return=F,U):(U=Zd(J.type,J.key,J.props,null,F.mode,ae),sh(U,J),U.return=F,U)}function te(F,U,J,ae){return U===null||U.tag!==4||U.stateNode.containerInfo!==J.containerInfo||U.stateNode.implementation!==J.implementation?(U=fO(J,F.mode,ae),U.return=F,U):(U=y(U,J.children||[]),U.return=F,U)}function se(F,U,J,ae,Ae){return U===null||U.tag!==7?(U=aa(J,F.mode,ae,Ae),U.return=F,U):(U=y(U,J),U.return=F,U)}function he(F,U,J){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=dO(""+U,F.mode,J),U.return=F,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case O:return J=Zd(U.type,U.key,U.props,null,F.mode,J),sh(J,U),J.return=F,J;case S:return U=fO(U,F.mode,J),U.return=F,U;case V:return U=da(U),he(F,U,J)}if(X(U)||j(U))return U=aa(U,F.mode,J,null),U.return=F,U;if(typeof U.then=="function")return he(F,Ud(U),J);if(U.$$typeof===k)return he(F,Vd(F,U),J);Gd(F,U)}return null}function ne(F,U,J,ae){var Ae=U!==null?U.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Ae!==null?null:A(F,U,""+J,ae);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case O:return J.key===Ae?Y(F,U,J,ae):null;case S:return J.key===Ae?te(F,U,J,ae):null;case V:return J=da(J),ne(F,U,J,ae)}if(X(J)||j(J))return Ae!==null?null:se(F,U,J,ae,null);if(typeof J.then=="function")return ne(F,U,Ud(J),ae);if(J.$$typeof===k)return ne(F,U,Vd(F,J),ae);Gd(F,J)}return null}function re(F,U,J,ae,Ae){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return F=F.get(J)||null,A(U,F,""+ae,Ae);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case O:return F=F.get(ae.key===null?J:ae.key)||null,Y(U,F,ae,Ae);case S:return F=F.get(ae.key===null?J:ae.key)||null,te(U,F,ae,Ae);case V:return ae=da(ae),re(F,U,J,ae,Ae)}if(X(ae)||j(ae))return F=F.get(J)||null,se(U,F,ae,Ae,null);if(typeof ae.then=="function")return re(F,U,J,Ud(ae),Ae);if(ae.$$typeof===k)return re(F,U,J,Vd(U,ae),Ae);Gd(U,ae)}return null}function we(F,U,J,ae){for(var Ae=null,ht=null,Te=U,He=U=0,it=null;Te!==null&&He<J.length;He++){Te.index>He?(it=Te,Te=null):it=Te.sibling;var ut=ne(F,Te,J[He],ae);if(ut===null){Te===null&&(Te=it);break}o&&Te&&ut.alternate===null&&l(F,Te),U=b(ut,U,He),ht===null?Ae=ut:ht.sibling=ut,ht=ut,Te=it}if(He===J.length)return u(F,Te),st&&ss(F,He),Ae;if(Te===null){for(;He<J.length;He++)Te=he(F,J[He],ae),Te!==null&&(U=b(Te,U,He),ht===null?Ae=Te:ht.sibling=Te,ht=Te);return st&&ss(F,He),Ae}for(Te=p(Te);He<J.length;He++)it=re(Te,F,He,J[He],ae),it!==null&&(o&&it.alternate!==null&&Te.delete(it.key===null?He:it.key),U=b(it,U,He),ht===null?Ae=it:ht.sibling=it,ht=it);return o&&Te.forEach(function(Oo){return l(F,Oo)}),st&&ss(F,He),Ae}function ze(F,U,J,ae){if(J==null)throw Error(n(151));for(var Ae=null,ht=null,Te=U,He=U=0,it=null,ut=J.next();Te!==null&&!ut.done;He++,ut=J.next()){Te.index>He?(it=Te,Te=null):it=Te.sibling;var Oo=ne(F,Te,ut.value,ae);if(Oo===null){Te===null&&(Te=it);break}o&&Te&&Oo.alternate===null&&l(F,Te),U=b(Oo,U,He),ht===null?Ae=Oo:ht.sibling=Oo,ht=Oo,Te=it}if(ut.done)return u(F,Te),st&&ss(F,He),Ae;if(Te===null){for(;!ut.done;He++,ut=J.next())ut=he(F,ut.value,ae),ut!==null&&(U=b(ut,U,He),ht===null?Ae=ut:ht.sibling=ut,ht=ut);return st&&ss(F,He),Ae}for(Te=p(Te);!ut.done;He++,ut=J.next())ut=re(Te,F,He,ut.value,ae),ut!==null&&(o&&ut.alternate!==null&&Te.delete(ut.key===null?He:ut.key),U=b(ut,U,He),ht===null?Ae=ut:ht.sibling=ut,ht=ut);return o&&Te.forEach(function(X3){return l(F,X3)}),st&&ss(F,He),Ae}function _t(F,U,J,ae){if(typeof J=="object"&&J!==null&&J.type===_&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case O:e:{for(var Ae=J.key;U!==null;){if(U.key===Ae){if(Ae=J.type,Ae===_){if(U.tag===7){u(F,U.sibling),ae=y(U,J.props.children),ae.return=F,F=ae;break e}}else if(U.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===V&&da(Ae)===U.type){u(F,U.sibling),ae=y(U,J.props),sh(ae,J),ae.return=F,F=ae;break e}u(F,U);break}else l(F,U);U=U.sibling}J.type===_?(ae=aa(J.props.children,F.mode,ae,J.key),ae.return=F,F=ae):(ae=Zd(J.type,J.key,J.props,null,F.mode,ae),sh(ae,J),ae.return=F,F=ae)}return C(F);case S:e:{for(Ae=J.key;U!==null;){if(U.key===Ae)if(U.tag===4&&U.stateNode.containerInfo===J.containerInfo&&U.stateNode.implementation===J.implementation){u(F,U.sibling),ae=y(U,J.children||[]),ae.return=F,F=ae;break e}else{u(F,U);break}else l(F,U);U=U.sibling}ae=fO(J,F.mode,ae),ae.return=F,F=ae}return C(F);case V:return J=da(J),_t(F,U,J,ae)}if(X(J))return we(F,U,J,ae);if(j(J)){if(Ae=j(J),typeof Ae!="function")throw Error(n(150));return J=Ae.call(J),ze(F,U,J,ae)}if(typeof J.then=="function")return _t(F,U,Ud(J),ae);if(J.$$typeof===k)return _t(F,U,Vd(F,J),ae);Gd(F,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,U!==null&&U.tag===6?(u(F,U.sibling),ae=y(U,J),ae.return=F,F=ae):(u(F,U),ae=dO(J,F.mode,ae),ae.return=F,F=ae),C(F)):u(F,U)}return function(F,U,J,ae){try{rh=0;var Ae=_t(F,U,J,ae);return wl=null,Ae}catch(Te){if(Te===xl||Te===Yd)throw Te;var ht=wn(29,Te,null,F.mode);return ht.lanes=ae,ht.return=F,ht}finally{}}}var pa=ix(!0),nx=ix(!1),Js=!1;function kO(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function CO(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function eo(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function to(o,l,u){var p=o.updateQueue;if(p===null)return null;if(p=p.shared,(ft&2)!==0){var y=p.pending;return y===null?l.next=l:(l.next=y.next,y.next=l),p.pending=l,l=Nd(o),X_(o,null,u),l}return Xd(o,p,l,u),Nd(o)}function oh(o,l,u){if(l=l.updateQueue,l!==null&&(l=l.shared,(u&4194048)!==0)){var p=l.lanes;p&=o.pendingLanes,u|=p,l.lanes=u,yd(o,u)}}function TO(o,l){var u=o.updateQueue,p=o.alternate;if(p!==null&&(p=p.updateQueue,u===p)){var y=null,b=null;if(u=u.firstBaseUpdate,u!==null){do{var C={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};b===null?y=b=C:b=b.next=C,u=u.next}while(u!==null);b===null?y=b=l:b=b.next=l}else y=b=l;u={baseState:p.baseState,firstBaseUpdate:y,lastBaseUpdate:b,shared:p.shared,callbacks:p.callbacks},o.updateQueue=u;return}o=u.lastBaseUpdate,o===null?u.firstBaseUpdate=l:o.next=l,u.lastBaseUpdate=l}var QO=!1;function ah(){if(QO){var o=_l;if(o!==null)throw o}}function lh(o,l,u,p){QO=!1;var y=o.updateQueue;Js=!1;var b=y.firstBaseUpdate,C=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var Y=A,te=Y.next;Y.next=null,C===null?b=te:C.next=te,C=Y;var se=o.alternate;se!==null&&(se=se.updateQueue,A=se.lastBaseUpdate,A!==C&&(A===null?se.firstBaseUpdate=te:A.next=te,se.lastBaseUpdate=Y))}if(b!==null){var he=y.baseState;C=0,se=te=Y=null,A=b;do{var ne=A.lane&-536870913,re=ne!==A.lane;if(re?(tt&ne)===ne:(p&ne)===ne){ne!==0&&ne===bl&&(QO=!0),se!==null&&(se=se.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var we=o,ze=A;ne=l;var _t=u;switch(ze.tag){case 1:if(we=ze.payload,typeof we=="function"){he=we.call(_t,he,ne);break e}he=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=ze.payload,ne=typeof we=="function"?we.call(_t,he,ne):we,ne==null)break e;he=g({},he,ne);break e;case 2:Js=!0}}ne=A.callback,ne!==null&&(o.flags|=64,re&&(o.flags|=8192),re=y.callbacks,re===null?y.callbacks=[ne]:re.push(ne))}else re={lane:ne,tag:A.tag,payload:A.payload,callback:A.callback,next:null},se===null?(te=se=re,Y=he):se=se.next=re,C|=ne;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;re=A,A=re.next,re.next=null,y.lastBaseUpdate=re,y.shared.pending=null}}while(!0);se===null&&(Y=he),y.baseState=Y,y.firstBaseUpdate=te,y.lastBaseUpdate=se,b===null&&(y.shared.lanes=0),oo|=C,o.lanes=C,o.memoizedState=he}}function rx(o,l){if(typeof o!="function")throw Error(n(191,o));o.call(l)}function sx(o,l){var u=o.callbacks;if(u!==null)for(o.callbacks=null,o=0;o<u.length;o++)rx(u[o],l)}var kl=z(null),Fd=z(0);function ox(o,l){o=ms,K(Fd,o),K(kl,l),ms=o|l.baseLanes}function $O(){K(Fd,ms),K(kl,kl.current)}function PO(){ms=Fd.current,q(kl),q(Fd)}var kn=z(null),Yn=null;function io(o){var l=o.alternate;K(Vt,Vt.current&1),K(kn,o),Yn===null&&(l===null||kl.current!==null||l.memoizedState!==null)&&(Yn=o)}function EO(o){K(Vt,Vt.current),K(kn,o),Yn===null&&(Yn=o)}function ax(o){o.tag===22?(K(Vt,Vt.current),K(kn,o),Yn===null&&(Yn=o)):no()}function no(){K(Vt,Vt.current),K(kn,kn.current)}function Cn(o){q(kn),Yn===o&&(Yn=null),q(Vt)}var Vt=z(0);function Kd(o){for(var l=o;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||D0(u)||B0(u)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var ls=0,Ie=null,St=null,ei=null,Jd=!1,Cl=!1,ga=!1,ef=0,ch=0,Tl=null,Pj=0;function Xt(){throw Error(n(321))}function RO(o,l){if(l===null)return!1;for(var u=0;u<l.length&&u<o.length;u++)if(!xn(o[u],l[u]))return!1;return!0}function AO(o,l,u,p,y,b){return ls=b,Ie=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,P.H=o===null||o.memoizedState===null?qx:HO,ga=!1,b=u(p,y),ga=!1,Cl&&(b=cx(l,u,p,y)),lx(o),b}function lx(o){P.H=dh;var l=St!==null&&St.next!==null;if(ls=0,ei=St=Ie=null,Jd=!1,ch=0,Tl=null,l)throw Error(n(300));o===null||ti||(o=o.dependencies,o!==null&&qd(o)&&(ti=!0))}function cx(o,l,u,p){Ie=o;var y=0;do{if(Cl&&(Tl=null),ch=0,Cl=!1,25<=y)throw Error(n(301));if(y+=1,ei=St=null,o.updateQueue!=null){var b=o.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}P.H=Vx,b=l(u,p)}while(Cl);return b}function Ej(){var o=P.H,l=o.useState()[0];return l=typeof l.then=="function"?hh(l):l,o=o.useState()[0],(St!==null?St.memoizedState:null)!==o&&(Ie.flags|=1024),l}function MO(){var o=ef!==0;return ef=0,o}function zO(o,l,u){l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~u}function jO(o){if(Jd){for(o=o.memoizedState;o!==null;){var l=o.queue;l!==null&&(l.pending=null),o=o.next}Jd=!1}ls=0,ei=St=Ie=null,Cl=!1,ch=ef=0,Tl=null}function Hi(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ei===null?Ie.memoizedState=ei=o:ei=ei.next=o,ei}function It(){if(St===null){var o=Ie.alternate;o=o!==null?o.memoizedState:null}else o=St.next;var l=ei===null?Ie.memoizedState:ei.next;if(l!==null)ei=l,St=o;else{if(o===null)throw Ie.alternate===null?Error(n(467)):Error(n(310));St=o,o={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},ei===null?Ie.memoizedState=ei=o:ei=ei.next=o}return ei}function tf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hh(o){var l=ch;return ch+=1,Tl===null&&(Tl=[]),o=J_(Tl,o,l),l=Ie,(ei===null?l.memoizedState:ei.next)===null&&(l=l.alternate,P.H=l===null||l.memoizedState===null?qx:HO),o}function nf(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return hh(o);if(o.$$typeof===k)return Ci(o)}throw Error(n(438,String(o)))}function DO(o){var l=null,u=Ie.updateQueue;if(u!==null&&(l=u.memoCache),l==null){var p=Ie.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(l={data:p.data.map(function(y){return y.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),u===null&&(u=tf(),Ie.updateQueue=u),u.memoCache=l,u=l.data[l.index],u===void 0)for(u=l.data[l.index]=Array(o),p=0;p<o;p++)u[p]=ee;return l.index++,u}function cs(o,l){return typeof l=="function"?l(o):l}function rf(o){var l=It();return BO(l,St,o)}function BO(o,l,u){var p=o.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=u;var y=o.baseQueue,b=p.pending;if(b!==null){if(y!==null){var C=y.next;y.next=b.next,b.next=C}l.baseQueue=y=b,p.pending=null}if(b=o.baseState,y===null)o.memoizedState=b;else{l=y.next;var A=C=null,Y=null,te=l,se=!1;do{var he=te.lane&-536870913;if(he!==te.lane?(tt&he)===he:(ls&he)===he){var ne=te.revertLane;if(ne===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),he===bl&&(se=!0);else if((ls&ne)===ne){te=te.next,ne===bl&&(se=!0);continue}else he={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},Y===null?(A=Y=he,C=b):Y=Y.next=he,Ie.lanes|=ne,oo|=ne;he=te.action,ga&&u(b,he),b=te.hasEagerState?te.eagerState:u(b,he)}else ne={lane:he,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},Y===null?(A=Y=ne,C=b):Y=Y.next=ne,Ie.lanes|=he,oo|=he;te=te.next}while(te!==null&&te!==l);if(Y===null?C=b:Y.next=A,!xn(b,o.memoizedState)&&(ti=!0,se&&(u=_l,u!==null)))throw u;o.memoizedState=b,o.baseState=C,o.baseQueue=Y,p.lastRenderedState=b}return y===null&&(p.lanes=0),[o.memoizedState,p.dispatch]}function LO(o){var l=It(),u=l.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=o;var p=u.dispatch,y=u.pending,b=l.memoizedState;if(y!==null){u.pending=null;var C=y=y.next;do b=o(b,C.action),C=C.next;while(C!==y);xn(b,l.memoizedState)||(ti=!0),l.memoizedState=b,l.baseQueue===null&&(l.baseState=b),u.lastRenderedState=b}return[b,p]}function hx(o,l,u){var p=Ie,y=It(),b=st;if(b){if(u===void 0)throw Error(n(407));u=u()}else u=l();var C=!xn((St||y).memoizedState,u);if(C&&(y.memoizedState=u,ti=!0),y=y.queue,ZO(fx.bind(null,p,y,o),[o]),y.getSnapshot!==l||C||ei!==null&&ei.memoizedState.tag&1){if(p.flags|=2048,Ql(9,{destroy:void 0},dx.bind(null,p,y,u,l),null),wt===null)throw Error(n(349));b||(ls&127)!==0||ux(p,l,u)}return u}function ux(o,l,u){o.flags|=16384,o={getSnapshot:l,value:u},l=Ie.updateQueue,l===null?(l=tf(),Ie.updateQueue=l,l.stores=[o]):(u=l.stores,u===null?l.stores=[o]:u.push(o))}function dx(o,l,u,p){l.value=u,l.getSnapshot=p,px(l)&&gx(o)}function fx(o,l,u){return u(function(){px(l)&&gx(o)})}function px(o){var l=o.getSnapshot;o=o.value;try{var u=l();return!xn(o,u)}catch{return!0}}function gx(o){var l=oa(o,2);l!==null&&pn(l,o,2)}function XO(o){var l=Hi();if(typeof o=="function"){var u=o;if(o=u(),ga){wr(!0);try{u()}finally{wr(!1)}}}return l.memoizedState=l.baseState=o,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:o},l}function mx(o,l,u,p){return o.baseState=u,BO(o,St,typeof p=="function"?p:cs)}function Rj(o,l,u,p,y){if(af(o))throw Error(n(485));if(o=l.action,o!==null){var b={payload:y,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){b.listeners.push(C)}};P.T!==null?u(!0):b.isTransition=!1,p(b),u=l.pending,u===null?(b.next=l.pending=b,Ox(l,b)):(b.next=u.next,l.pending=u.next=b)}}function Ox(o,l){var u=l.action,p=l.payload,y=o.state;if(l.isTransition){var b=P.T,C={};P.T=C;try{var A=u(y,p),Y=P.S;Y!==null&&Y(C,A),vx(o,l,A)}catch(te){NO(o,l,te)}finally{b!==null&&C.types!==null&&(b.types=C.types),P.T=b}}else try{b=u(y,p),vx(o,l,b)}catch(te){NO(o,l,te)}}function vx(o,l,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(p){yx(o,l,p)},function(p){return NO(o,l,p)}):yx(o,l,u)}function yx(o,l,u){l.status="fulfilled",l.value=u,Sx(l),o.state=u,l=o.pending,l!==null&&(u=l.next,u===l?o.pending=null:(u=u.next,l.next=u,Ox(o,u)))}function NO(o,l,u){var p=o.pending;if(o.pending=null,p!==null){p=p.next;do l.status="rejected",l.reason=u,Sx(l),l=l.next;while(l!==p)}o.action=null}function Sx(o){o=o.listeners;for(var l=0;l<o.length;l++)(0,o[l])()}function bx(o,l){return l}function _x(o,l){if(st){var u=wt.formState;if(u!==null){e:{var p=Ie;if(st){if($t){t:{for(var y=$t,b=In;y.nodeType!==8;){if(!b){y=null;break t}if(y=Hn(y.nextSibling),y===null){y=null;break t}}b=y.data,y=b==="F!"||b==="F"?y:null}if(y){$t=Hn(y.nextSibling),p=y.data==="F!";break e}}Fs(p)}p=!1}p&&(l=u[0])}}return u=Hi(),u.memoizedState=u.baseState=l,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bx,lastRenderedState:l},u.queue=p,u=Nx.bind(null,Ie,p),p.dispatch=u,p=XO(!1),b=YO.bind(null,Ie,!1,p.queue),p=Hi(),y={state:l,dispatch:null,action:o,pending:null},p.queue=y,u=Rj.bind(null,Ie,y,b,u),y.dispatch=u,p.memoizedState=o,[l,u,!1]}function xx(o){var l=It();return wx(l,St,o)}function wx(o,l,u){if(l=BO(o,l,bx)[0],o=rf(cs)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var p=hh(l)}catch(C){throw C===xl?Yd:C}else p=l;l=It();var y=l.queue,b=y.dispatch;return u!==l.memoizedState&&(Ie.flags|=2048,Ql(9,{destroy:void 0},Aj.bind(null,y,u),null)),[p,b,o]}function Aj(o,l){o.action=l}function kx(o){var l=It(),u=St;if(u!==null)return wx(l,u,o);It(),l=l.memoizedState,u=It();var p=u.queue.dispatch;return u.memoizedState=o,[l,p,!1]}function Ql(o,l,u,p){return o={tag:o,create:u,deps:p,inst:l,next:null},l=Ie.updateQueue,l===null&&(l=tf(),Ie.updateQueue=l),u=l.lastEffect,u===null?l.lastEffect=o.next=o:(p=u.next,u.next=o,o.next=p,l.lastEffect=o),o}function Cx(){return It().memoizedState}function sf(o,l,u,p){var y=Hi();Ie.flags|=o,y.memoizedState=Ql(1|l,{destroy:void 0},u,p===void 0?null:p)}function of(o,l,u,p){var y=It();p=p===void 0?null:p;var b=y.memoizedState.inst;St!==null&&p!==null&&RO(p,St.memoizedState.deps)?y.memoizedState=Ql(l,b,u,p):(Ie.flags|=o,y.memoizedState=Ql(1|l,b,u,p))}function Tx(o,l){sf(8390656,8,o,l)}function ZO(o,l){of(2048,8,o,l)}function Mj(o){Ie.flags|=4;var l=Ie.updateQueue;if(l===null)l=tf(),Ie.updateQueue=l,l.events=[o];else{var u=l.events;u===null?l.events=[o]:u.push(o)}}function Qx(o){var l=It().memoizedState;return Mj({ref:l,nextImpl:o}),function(){if((ft&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}function $x(o,l){return of(4,2,o,l)}function Px(o,l){return of(4,4,o,l)}function Ex(o,l){if(typeof l=="function"){o=o();var u=l(o);return function(){typeof u=="function"?u():l(null)}}if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function Rx(o,l,u){u=u!=null?u.concat([o]):null,of(4,4,Ex.bind(null,l,o),u)}function WO(){}function Ax(o,l){var u=It();l=l===void 0?null:l;var p=u.memoizedState;return l!==null&&RO(l,p[1])?p[0]:(u.memoizedState=[o,l],o)}function Mx(o,l){var u=It();l=l===void 0?null:l;var p=u.memoizedState;if(l!==null&&RO(l,p[1]))return p[0];if(p=o(),ga){wr(!0);try{o()}finally{wr(!1)}}return u.memoizedState=[p,l],p}function qO(o,l,u){return u===void 0||(ls&1073741824)!==0&&(tt&261930)===0?o.memoizedState=l:(o.memoizedState=u,o=zw(),Ie.lanes|=o,oo|=o,u)}function zx(o,l,u,p){return xn(u,l)?u:kl.current!==null?(o=qO(o,u,p),xn(o,l)||(ti=!0),o):(ls&42)===0||(ls&1073741824)!==0&&(tt&261930)===0?(ti=!0,o.memoizedState=u):(o=zw(),Ie.lanes|=o,oo|=o,l)}function jx(o,l,u,p,y){var b=Z.p;Z.p=b!==0&&8>b?b:8;var C=P.T,A={};P.T=A,YO(o,!1,l,u);try{var Y=y(),te=P.S;if(te!==null&&te(A,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var se=$j(Y,p);uh(o,l,se,$n(o))}else uh(o,l,p,$n(o))}catch(he){uh(o,l,{then:function(){},status:"rejected",reason:he},$n())}finally{Z.p=b,C!==null&&A.types!==null&&(C.types=A.types),P.T=C}}function zj(){}function VO(o,l,u,p){if(o.tag!==5)throw Error(n(476));var y=Dx(o).queue;jx(o,y,l,L,u===null?zj:function(){return Bx(o),u(p)})}function Dx(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:L,baseState:L,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:L},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:u},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function Bx(o){var l=Dx(o);l.next===null&&(l=o.alternate.memoizedState),uh(o,l.next.queue,{},$n())}function IO(){return Ci(Qh)}function Lx(){return It().memoizedState}function Xx(){return It().memoizedState}function jj(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var u=$n();o=eo(u);var p=to(l,o,u);p!==null&&(pn(p,l,u),oh(p,l,u)),l={cache:bO()},o.payload=l;return}l=l.return}}function Dj(o,l,u){var p=$n();u={lane:p,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},af(o)?Zx(l,u):(u=hO(o,l,u,p),u!==null&&(pn(u,o,p),Wx(u,l,p)))}function Nx(o,l,u){var p=$n();uh(o,l,u,p)}function uh(o,l,u,p){var y={lane:p,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(af(o))Zx(l,y);else{var b=o.alternate;if(o.lanes===0&&(b===null||b.lanes===0)&&(b=l.lastRenderedReducer,b!==null))try{var C=l.lastRenderedState,A=b(C,u);if(y.hasEagerState=!0,y.eagerState=A,xn(A,C))return Xd(o,l,y,0),wt===null&&Ld(),!1}catch{}finally{}if(u=hO(o,l,y,p),u!==null)return pn(u,o,p),Wx(u,l,p),!0}return!1}function YO(o,l,u,p){if(p={lane:2,revertLane:k0(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},af(o)){if(l)throw Error(n(479))}else l=hO(o,u,p,2),l!==null&&pn(l,o,2)}function af(o){var l=o.alternate;return o===Ie||l!==null&&l===Ie}function Zx(o,l){Cl=Jd=!0;var u=o.pending;u===null?l.next=l:(l.next=u.next,u.next=l),o.pending=l}function Wx(o,l,u){if((u&4194048)!==0){var p=l.lanes;p&=o.pendingLanes,u|=p,l.lanes=u,yd(o,u)}}var dh={readContext:Ci,use:nf,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt};dh.useEffectEvent=Xt;var qx={readContext:Ci,use:nf,useCallback:function(o,l){return Hi().memoizedState=[o,l===void 0?null:l],o},useContext:Ci,useEffect:Tx,useImperativeHandle:function(o,l,u){u=u!=null?u.concat([o]):null,sf(4194308,4,Ex.bind(null,l,o),u)},useLayoutEffect:function(o,l){return sf(4194308,4,o,l)},useInsertionEffect:function(o,l){sf(4,2,o,l)},useMemo:function(o,l){var u=Hi();l=l===void 0?null:l;var p=o();if(ga){wr(!0);try{o()}finally{wr(!1)}}return u.memoizedState=[p,l],p},useReducer:function(o,l,u){var p=Hi();if(u!==void 0){var y=u(l);if(ga){wr(!0);try{u(l)}finally{wr(!1)}}}else y=l;return p.memoizedState=p.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},p.queue=o,o=o.dispatch=Dj.bind(null,Ie,o),[p.memoizedState,o]},useRef:function(o){var l=Hi();return o={current:o},l.memoizedState=o},useState:function(o){o=XO(o);var l=o.queue,u=Nx.bind(null,Ie,l);return l.dispatch=u,[o.memoizedState,u]},useDebugValue:WO,useDeferredValue:function(o,l){var u=Hi();return qO(u,o,l)},useTransition:function(){var o=XO(!1);return o=jx.bind(null,Ie,o.queue,!0,!1),Hi().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,u){var p=Ie,y=Hi();if(st){if(u===void 0)throw Error(n(407));u=u()}else{if(u=l(),wt===null)throw Error(n(349));(tt&127)!==0||ux(p,l,u)}y.memoizedState=u;var b={value:u,getSnapshot:l};return y.queue=b,Tx(fx.bind(null,p,b,o),[o]),p.flags|=2048,Ql(9,{destroy:void 0},dx.bind(null,p,b,u,l),null),u},useId:function(){var o=Hi(),l=wt.identifierPrefix;if(st){var u=Tr,p=Cr;u=(p&~(1<<32-Yi(p)-1)).toString(32)+u,l="_"+l+"R_"+u,u=ef++,0<u&&(l+="H"+u.toString(32)),l+="_"}else u=Pj++,l="_"+l+"r_"+u.toString(32)+"_";return o.memoizedState=l},useHostTransitionStatus:IO,useFormState:_x,useActionState:_x,useOptimistic:function(o){var l=Hi();l.memoizedState=l.baseState=o;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=u,l=YO.bind(null,Ie,!0,u),u.dispatch=l,[o,l]},useMemoCache:DO,useCacheRefresh:function(){return Hi().memoizedState=jj.bind(null,Ie)},useEffectEvent:function(o){var l=Hi(),u={impl:o};return l.memoizedState=u,function(){if((ft&2)!==0)throw Error(n(440));return u.impl.apply(void 0,arguments)}}},HO={readContext:Ci,use:nf,useCallback:Ax,useContext:Ci,useEffect:ZO,useImperativeHandle:Rx,useInsertionEffect:$x,useLayoutEffect:Px,useMemo:Mx,useReducer:rf,useRef:Cx,useState:function(){return rf(cs)},useDebugValue:WO,useDeferredValue:function(o,l){var u=It();return zx(u,St.memoizedState,o,l)},useTransition:function(){var o=rf(cs)[0],l=It().memoizedState;return[typeof o=="boolean"?o:hh(o),l]},useSyncExternalStore:hx,useId:Lx,useHostTransitionStatus:IO,useFormState:xx,useActionState:xx,useOptimistic:function(o,l){var u=It();return mx(u,St,o,l)},useMemoCache:DO,useCacheRefresh:Xx};HO.useEffectEvent=Qx;var Vx={readContext:Ci,use:nf,useCallback:Ax,useContext:Ci,useEffect:ZO,useImperativeHandle:Rx,useInsertionEffect:$x,useLayoutEffect:Px,useMemo:Mx,useReducer:LO,useRef:Cx,useState:function(){return LO(cs)},useDebugValue:WO,useDeferredValue:function(o,l){var u=It();return St===null?qO(u,o,l):zx(u,St.memoizedState,o,l)},useTransition:function(){var o=LO(cs)[0],l=It().memoizedState;return[typeof o=="boolean"?o:hh(o),l]},useSyncExternalStore:hx,useId:Lx,useHostTransitionStatus:IO,useFormState:kx,useActionState:kx,useOptimistic:function(o,l){var u=It();return St!==null?mx(u,St,o,l):(u.baseState=o,[o,u.queue.dispatch])},useMemoCache:DO,useCacheRefresh:Xx};Vx.useEffectEvent=Qx;function UO(o,l,u,p){l=o.memoizedState,u=u(p,l),u=u==null?l:g({},l,u),o.memoizedState=u,o.lanes===0&&(o.updateQueue.baseState=u)}var GO={enqueueSetState:function(o,l,u){o=o._reactInternals;var p=$n(),y=eo(p);y.payload=l,u!=null&&(y.callback=u),l=to(o,y,p),l!==null&&(pn(l,o,p),oh(l,o,p))},enqueueReplaceState:function(o,l,u){o=o._reactInternals;var p=$n(),y=eo(p);y.tag=1,y.payload=l,u!=null&&(y.callback=u),l=to(o,y,p),l!==null&&(pn(l,o,p),oh(l,o,p))},enqueueForceUpdate:function(o,l){o=o._reactInternals;var u=$n(),p=eo(u);p.tag=2,l!=null&&(p.callback=l),l=to(o,p,u),l!==null&&(pn(l,o,u),oh(l,o,u))}};function Ix(o,l,u,p,y,b,C){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(p,b,C):l.prototype&&l.prototype.isPureReactComponent?!Kc(u,p)||!Kc(y,b):!0}function Yx(o,l,u,p){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(u,p),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(u,p),l.state!==o&&GO.enqueueReplaceState(l,l.state,null)}function ma(o,l){var u=l;if("ref"in l){u={};for(var p in l)p!=="ref"&&(u[p]=l[p])}if(o=o.defaultProps){u===l&&(u=g({},u));for(var y in o)u[y]===void 0&&(u[y]=o[y])}return u}function Hx(o){Bd(o)}function Ux(o){console.error(o)}function Gx(o){Bd(o)}function lf(o,l){try{var u=o.onUncaughtError;u(l.value,{componentStack:l.stack})}catch(p){setTimeout(function(){throw p})}}function Fx(o,l,u){try{var p=o.onCaughtError;p(u.value,{componentStack:u.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function FO(o,l,u){return u=eo(u),u.tag=3,u.payload={element:null},u.callback=function(){lf(o,l)},u}function Kx(o){return o=eo(o),o.tag=3,o}function Jx(o,l,u,p){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var b=p.value;o.payload=function(){return y(b)},o.callback=function(){Fx(l,u,p)}}var C=u.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(o.callback=function(){Fx(l,u,p),typeof y!="function"&&(ao===null?ao=new Set([this]):ao.add(this));var A=p.stack;this.componentDidCatch(p.value,{componentStack:A!==null?A:""})})}function Bj(o,l,u,p,y){if(u.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(l=u.alternate,l!==null&&Sl(l,u,y,!0),u=kn.current,u!==null){switch(u.tag){case 31:case 13:return Yn===null?Sf():u.alternate===null&&Nt===0&&(Nt=3),u.flags&=-257,u.flags|=65536,u.lanes=y,p===Hd?u.flags|=16384:(l=u.updateQueue,l===null?u.updateQueue=new Set([p]):l.add(p),_0(o,p,y)),!1;case 22:return u.flags|=65536,p===Hd?u.flags|=16384:(l=u.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([p])},u.updateQueue=l):(u=l.retryQueue,u===null?l.retryQueue=new Set([p]):u.add(p)),_0(o,p,y)),!1}throw Error(n(435,u.tag))}return _0(o,p,y),Sf(),!1}if(st)return l=kn.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=y,p!==mO&&(o=Error(n(422),{cause:p}),th(Wn(o,u)))):(p!==mO&&(l=Error(n(423),{cause:p}),th(Wn(l,u))),o=o.current.alternate,o.flags|=65536,y&=-y,o.lanes|=y,p=Wn(p,u),y=FO(o.stateNode,p,y),TO(o,y),Nt!==4&&(Nt=2)),!1;var b=Error(n(520),{cause:p});if(b=Wn(b,u),Sh===null?Sh=[b]:Sh.push(b),Nt!==4&&(Nt=2),l===null)return!0;p=Wn(p,u),u=l;do{switch(u.tag){case 3:return u.flags|=65536,o=y&-y,u.lanes|=o,o=FO(u.stateNode,p,o),TO(u,o),!1;case 1:if(l=u.type,b=u.stateNode,(u.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(ao===null||!ao.has(b))))return u.flags|=65536,y&=-y,u.lanes|=y,y=Kx(y),Jx(y,o,u,p),TO(u,y),!1}u=u.return}while(u!==null);return!1}var KO=Error(n(461)),ti=!1;function Ti(o,l,u,p){l.child=o===null?nx(l,null,u,p):pa(l,o.child,u,p)}function ew(o,l,u,p,y){u=u.render;var b=l.ref;if("ref"in p){var C={};for(var A in p)A!=="ref"&&(C[A]=p[A])}else C=p;return ha(l),p=AO(o,l,u,C,b,y),A=MO(),o!==null&&!ti?(zO(o,l,y),hs(o,l,y)):(st&&A&&pO(l),l.flags|=1,Ti(o,l,p,y),l.child)}function tw(o,l,u,p,y){if(o===null){var b=u.type;return typeof b=="function"&&!uO(b)&&b.defaultProps===void 0&&u.compare===null?(l.tag=15,l.type=b,iw(o,l,b,p,y)):(o=Zd(u.type,null,p,l,l.mode,y),o.ref=l.ref,o.return=l,l.child=o)}if(b=o.child,!o0(o,y)){var C=b.memoizedProps;if(u=u.compare,u=u!==null?u:Kc,u(C,p)&&o.ref===l.ref)return hs(o,l,y)}return l.flags|=1,o=rs(b,p),o.ref=l.ref,o.return=l,l.child=o}function iw(o,l,u,p,y){if(o!==null){var b=o.memoizedProps;if(Kc(b,p)&&o.ref===l.ref)if(ti=!1,l.pendingProps=p=b,o0(o,y))(o.flags&131072)!==0&&(ti=!0);else return l.lanes=o.lanes,hs(o,l,y)}return JO(o,l,u,p,y)}function nw(o,l,u,p){var y=p.children,b=o!==null?o.memoizedState:null;if(o===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((l.flags&128)!==0){if(b=b!==null?b.baseLanes|u:u,o!==null){for(p=l.child=o.child,y=0;p!==null;)y=y|p.lanes|p.childLanes,p=p.sibling;p=y&~b}else p=0,l.child=null;return rw(o,l,b,u,p)}if((u&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},o!==null&&Id(l,b!==null?b.cachePool:null),b!==null?ox(l,b):$O(),ax(l);else return p=l.lanes=536870912,rw(o,l,b!==null?b.baseLanes|u:u,u,p)}else b!==null?(Id(l,b.cachePool),ox(l,b),no(),l.memoizedState=null):(o!==null&&Id(l,null),$O(),no());return Ti(o,l,y,u),l.child}function fh(o,l){return o!==null&&o.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function rw(o,l,u,p,y){var b=xO();return b=b===null?null:{parent:Jt._currentValue,pool:b},l.memoizedState={baseLanes:u,cachePool:b},o!==null&&Id(l,null),$O(),ax(l),o!==null&&Sl(o,l,p,!0),l.childLanes=y,null}function cf(o,l){return l=uf({mode:l.mode,children:l.children},o.mode),l.ref=o.ref,o.child=l,l.return=o,l}function sw(o,l,u){return pa(l,o.child,null,u),o=cf(l,l.pendingProps),o.flags|=2,Cn(l),l.memoizedState=null,o}function Lj(o,l,u){var p=l.pendingProps,y=(l.flags&128)!==0;if(l.flags&=-129,o===null){if(st){if(p.mode==="hidden")return o=cf(l,p),l.lanes=536870912,fh(null,o);if(EO(l),(o=$t)?(o=Ok(o,In),o=o!==null&&o.data==="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Us!==null?{id:Cr,overflow:Tr}:null,retryLane:536870912,hydrationErrors:null},u=Z_(o),u.return=l,l.child=u,ki=l,$t=null)):o=null,o===null)throw Fs(l);return l.lanes=536870912,null}return cf(l,p)}var b=o.memoizedState;if(b!==null){var C=b.dehydrated;if(EO(l),y)if(l.flags&256)l.flags&=-257,l=sw(o,l,u);else if(l.memoizedState!==null)l.child=o.child,l.flags|=128,l=null;else throw Error(n(558));else if(ti||Sl(o,l,u,!1),y=(u&o.childLanes)!==0,ti||y){if(p=wt,p!==null&&(C=Sd(p,u),C!==0&&C!==b.retryLane))throw b.retryLane=C,oa(o,C),pn(p,o,C),KO;Sf(),l=sw(o,l,u)}else o=b.treeContext,$t=Hn(C.nextSibling),ki=l,st=!0,Gs=null,In=!1,o!==null&&V_(l,o),l=cf(l,p),l.flags|=4096;return l}return o=rs(o.child,{mode:p.mode,children:p.children}),o.ref=l.ref,l.child=o,o.return=l,o}function hf(o,l){var u=l.ref;if(u===null)o!==null&&o.ref!==null&&(l.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(n(284));(o===null||o.ref!==u)&&(l.flags|=4194816)}}function JO(o,l,u,p,y){return ha(l),u=AO(o,l,u,p,void 0,y),p=MO(),o!==null&&!ti?(zO(o,l,y),hs(o,l,y)):(st&&p&&pO(l),l.flags|=1,Ti(o,l,u,y),l.child)}function ow(o,l,u,p,y,b){return ha(l),l.updateQueue=null,u=cx(l,p,u,y),lx(o),p=MO(),o!==null&&!ti?(zO(o,l,b),hs(o,l,b)):(st&&p&&pO(l),l.flags|=1,Ti(o,l,u,b),l.child)}function aw(o,l,u,p,y){if(ha(l),l.stateNode===null){var b=ml,C=u.contextType;typeof C=="object"&&C!==null&&(b=Ci(C)),b=new u(p,b),l.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=GO,l.stateNode=b,b._reactInternals=l,b=l.stateNode,b.props=p,b.state=l.memoizedState,b.refs={},kO(l),C=u.contextType,b.context=typeof C=="object"&&C!==null?Ci(C):ml,b.state=l.memoizedState,C=u.getDerivedStateFromProps,typeof C=="function"&&(UO(l,u,C,p),b.state=l.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(C=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),C!==b.state&&GO.enqueueReplaceState(b,b.state,null),lh(l,p,b,y),ah(),b.state=l.memoizedState),typeof b.componentDidMount=="function"&&(l.flags|=4194308),p=!0}else if(o===null){b=l.stateNode;var A=l.memoizedProps,Y=ma(u,A);b.props=Y;var te=b.context,se=u.contextType;C=ml,typeof se=="object"&&se!==null&&(C=Ci(se));var he=u.getDerivedStateFromProps;se=typeof he=="function"||typeof b.getSnapshotBeforeUpdate=="function",A=l.pendingProps!==A,se||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(A||te!==C)&&Yx(l,b,p,C),Js=!1;var ne=l.memoizedState;b.state=ne,lh(l,p,b,y),ah(),te=l.memoizedState,A||ne!==te||Js?(typeof he=="function"&&(UO(l,u,he,p),te=l.memoizedState),(Y=Js||Ix(l,u,Y,p,ne,te,C))?(se||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(l.flags|=4194308)):(typeof b.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=p,l.memoizedState=te),b.props=p,b.state=te,b.context=C,p=Y):(typeof b.componentDidMount=="function"&&(l.flags|=4194308),p=!1)}else{b=l.stateNode,CO(o,l),C=l.memoizedProps,se=ma(u,C),b.props=se,he=l.pendingProps,ne=b.context,te=u.contextType,Y=ml,typeof te=="object"&&te!==null&&(Y=Ci(te)),A=u.getDerivedStateFromProps,(te=typeof A=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(C!==he||ne!==Y)&&Yx(l,b,p,Y),Js=!1,ne=l.memoizedState,b.state=ne,lh(l,p,b,y),ah();var re=l.memoizedState;C!==he||ne!==re||Js||o!==null&&o.dependencies!==null&&qd(o.dependencies)?(typeof A=="function"&&(UO(l,u,A,p),re=l.memoizedState),(se=Js||Ix(l,u,se,p,ne,re,Y)||o!==null&&o.dependencies!==null&&qd(o.dependencies))?(te||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(p,re,Y),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(p,re,Y)),typeof b.componentDidUpdate=="function"&&(l.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof b.componentDidUpdate!="function"||C===o.memoizedProps&&ne===o.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||C===o.memoizedProps&&ne===o.memoizedState||(l.flags|=1024),l.memoizedProps=p,l.memoizedState=re),b.props=p,b.state=re,b.context=Y,p=se):(typeof b.componentDidUpdate!="function"||C===o.memoizedProps&&ne===o.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||C===o.memoizedProps&&ne===o.memoizedState||(l.flags|=1024),p=!1)}return b=p,hf(o,l),p=(l.flags&128)!==0,b||p?(b=l.stateNode,u=p&&typeof u.getDerivedStateFromError!="function"?null:b.render(),l.flags|=1,o!==null&&p?(l.child=pa(l,o.child,null,y),l.child=pa(l,null,u,y)):Ti(o,l,u,y),l.memoizedState=b.state,o=l.child):o=hs(o,l,y),o}function lw(o,l,u,p){return la(),l.flags|=256,Ti(o,l,u,p),l.child}var e0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function t0(o){return{baseLanes:o,cachePool:F_()}}function i0(o,l,u){return o=o!==null?o.childLanes&~u:0,l&&(o|=Qn),o}function cw(o,l,u){var p=l.pendingProps,y=!1,b=(l.flags&128)!==0,C;if((C=b)||(C=o!==null&&o.memoizedState===null?!1:(Vt.current&2)!==0),C&&(y=!0,l.flags&=-129),C=(l.flags&32)!==0,l.flags&=-33,o===null){if(st){if(y?io(l):no(),(o=$t)?(o=Ok(o,In),o=o!==null&&o.data!=="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Us!==null?{id:Cr,overflow:Tr}:null,retryLane:536870912,hydrationErrors:null},u=Z_(o),u.return=l,l.child=u,ki=l,$t=null)):o=null,o===null)throw Fs(l);return B0(o)?l.lanes=32:l.lanes=536870912,null}var A=p.children;return p=p.fallback,y?(no(),y=l.mode,A=uf({mode:"hidden",children:A},y),p=aa(p,y,u,null),A.return=l,p.return=l,A.sibling=p,l.child=A,p=l.child,p.memoizedState=t0(u),p.childLanes=i0(o,C,u),l.memoizedState=e0,fh(null,p)):(io(l),n0(l,A))}var Y=o.memoizedState;if(Y!==null&&(A=Y.dehydrated,A!==null)){if(b)l.flags&256?(io(l),l.flags&=-257,l=r0(o,l,u)):l.memoizedState!==null?(no(),l.child=o.child,l.flags|=128,l=null):(no(),A=p.fallback,y=l.mode,p=uf({mode:"visible",children:p.children},y),A=aa(A,y,u,null),A.flags|=2,p.return=l,A.return=l,p.sibling=A,l.child=p,pa(l,o.child,null,u),p=l.child,p.memoizedState=t0(u),p.childLanes=i0(o,C,u),l.memoizedState=e0,l=fh(null,p));else if(io(l),B0(A)){if(C=A.nextSibling&&A.nextSibling.dataset,C)var te=C.dgst;C=te,p=Error(n(419)),p.stack="",p.digest=C,th({value:p,source:null,stack:null}),l=r0(o,l,u)}else if(ti||Sl(o,l,u,!1),C=(u&o.childLanes)!==0,ti||C){if(C=wt,C!==null&&(p=Sd(C,u),p!==0&&p!==Y.retryLane))throw Y.retryLane=p,oa(o,p),pn(C,o,p),KO;D0(A)||Sf(),l=r0(o,l,u)}else D0(A)?(l.flags|=192,l.child=o.child,l=null):(o=Y.treeContext,$t=Hn(A.nextSibling),ki=l,st=!0,Gs=null,In=!1,o!==null&&V_(l,o),l=n0(l,p.children),l.flags|=4096);return l}return y?(no(),A=p.fallback,y=l.mode,Y=o.child,te=Y.sibling,p=rs(Y,{mode:"hidden",children:p.children}),p.subtreeFlags=Y.subtreeFlags&65011712,te!==null?A=rs(te,A):(A=aa(A,y,u,null),A.flags|=2),A.return=l,p.return=l,p.sibling=A,l.child=p,fh(null,p),p=l.child,A=o.child.memoizedState,A===null?A=t0(u):(y=A.cachePool,y!==null?(Y=Jt._currentValue,y=y.parent!==Y?{parent:Y,pool:Y}:y):y=F_(),A={baseLanes:A.baseLanes|u,cachePool:y}),p.memoizedState=A,p.childLanes=i0(o,C,u),l.memoizedState=e0,fh(o.child,p)):(io(l),u=o.child,o=u.sibling,u=rs(u,{mode:"visible",children:p.children}),u.return=l,u.sibling=null,o!==null&&(C=l.deletions,C===null?(l.deletions=[o],l.flags|=16):C.push(o)),l.child=u,l.memoizedState=null,u)}function n0(o,l){return l=uf({mode:"visible",children:l},o.mode),l.return=o,o.child=l}function uf(o,l){return o=wn(22,o,null,l),o.lanes=0,o}function r0(o,l,u){return pa(l,o.child,null,u),o=n0(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function hw(o,l,u){o.lanes|=l;var p=o.alternate;p!==null&&(p.lanes|=l),yO(o.return,l,u)}function s0(o,l,u,p,y,b){var C=o.memoizedState;C===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:p,tail:u,tailMode:y,treeForkCount:b}:(C.isBackwards=l,C.rendering=null,C.renderingStartTime=0,C.last=p,C.tail=u,C.tailMode=y,C.treeForkCount=b)}function uw(o,l,u){var p=l.pendingProps,y=p.revealOrder,b=p.tail;p=p.children;var C=Vt.current,A=(C&2)!==0;if(A?(C=C&1|2,l.flags|=128):C&=1,K(Vt,C),Ti(o,l,p,u),p=st?eh:0,!A&&o!==null&&(o.flags&128)!==0)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&hw(o,u,l);else if(o.tag===19)hw(o,u,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(y){case"forwards":for(u=l.child,y=null;u!==null;)o=u.alternate,o!==null&&Kd(o)===null&&(y=u),u=u.sibling;u=y,u===null?(y=l.child,l.child=null):(y=u.sibling,u.sibling=null),s0(l,!1,y,u,b,p);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=l.child,l.child=null;y!==null;){if(o=y.alternate,o!==null&&Kd(o)===null){l.child=y;break}o=y.sibling,y.sibling=u,u=y,y=o}s0(l,!0,u,null,b,p);break;case"together":s0(l,!1,null,null,void 0,p);break;default:l.memoizedState=null}return l.child}function hs(o,l,u){if(o!==null&&(l.dependencies=o.dependencies),oo|=l.lanes,(u&l.childLanes)===0)if(o!==null){if(Sl(o,l,u,!1),(u&l.childLanes)===0)return null}else return null;if(o!==null&&l.child!==o.child)throw Error(n(153));if(l.child!==null){for(o=l.child,u=rs(o,o.pendingProps),l.child=u,u.return=l;o.sibling!==null;)o=o.sibling,u=u.sibling=rs(o,o.pendingProps),u.return=l;u.sibling=null}return l.child}function o0(o,l){return(o.lanes&l)!==0?!0:(o=o.dependencies,!!(o!==null&&qd(o)))}function Xj(o,l,u){switch(l.tag){case 3:fe(l,l.stateNode.containerInfo),Ks(l,Jt,o.memoizedState.cache),la();break;case 27:case 5:De(l);break;case 4:fe(l,l.stateNode.containerInfo);break;case 10:Ks(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,EO(l),null;break;case 13:var p=l.memoizedState;if(p!==null)return p.dehydrated!==null?(io(l),l.flags|=128,null):(u&l.child.childLanes)!==0?cw(o,l,u):(io(l),o=hs(o,l,u),o!==null?o.sibling:null);io(l);break;case 19:var y=(o.flags&128)!==0;if(p=(u&l.childLanes)!==0,p||(Sl(o,l,u,!1),p=(u&l.childLanes)!==0),y){if(p)return uw(o,l,u);l.flags|=128}if(y=l.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),K(Vt,Vt.current),p)break;return null;case 22:return l.lanes=0,nw(o,l,u,l.pendingProps);case 24:Ks(l,Jt,o.memoizedState.cache)}return hs(o,l,u)}function dw(o,l,u){if(o!==null)if(o.memoizedProps!==l.pendingProps)ti=!0;else{if(!o0(o,u)&&(l.flags&128)===0)return ti=!1,Xj(o,l,u);ti=(o.flags&131072)!==0}else ti=!1,st&&(l.flags&1048576)!==0&&q_(l,eh,l.index);switch(l.lanes=0,l.tag){case 16:e:{var p=l.pendingProps;if(o=da(l.elementType),l.type=o,typeof o=="function")uO(o)?(p=ma(o,p),l.tag=1,l=aw(null,l,o,p,u)):(l.tag=0,l=JO(null,l,o,p,u));else{if(o!=null){var y=o.$$typeof;if(y===T){l.tag=11,l=ew(null,l,o,p,u);break e}else if(y===R){l.tag=14,l=tw(null,l,o,p,u);break e}}throw l=E(o)||o,Error(n(306,l,""))}}return l;case 0:return JO(o,l,l.type,l.pendingProps,u);case 1:return p=l.type,y=ma(p,l.pendingProps),aw(o,l,p,y,u);case 3:e:{if(fe(l,l.stateNode.containerInfo),o===null)throw Error(n(387));p=l.pendingProps;var b=l.memoizedState;y=b.element,CO(o,l),lh(l,p,null,u);var C=l.memoizedState;if(p=C.cache,Ks(l,Jt,p),p!==b.cache&&SO(l,[Jt],u,!0),ah(),p=C.element,b.isDehydrated)if(b={element:p,isDehydrated:!1,cache:C.cache},l.updateQueue.baseState=b,l.memoizedState=b,l.flags&256){l=lw(o,l,p,u);break e}else if(p!==y){y=Wn(Error(n(424)),l),th(y),l=lw(o,l,p,u);break e}else{switch(o=l.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for($t=Hn(o.firstChild),ki=l,st=!0,Gs=null,In=!0,u=nx(l,null,p,u),l.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(la(),p===y){l=hs(o,l,u);break e}Ti(o,l,p,u)}l=l.child}return l;case 26:return hf(o,l),o===null?(u=xk(l.type,null,l.pendingProps,null))?l.memoizedState=u:st||(u=l.type,o=l.pendingProps,p=Tf(de.current).createElement(u),p[li]=l,p[Di]=o,Qi(p,u,o),Kt(p),l.stateNode=p):l.memoizedState=xk(l.type,o.memoizedProps,l.pendingProps,o.memoizedState),null;case 27:return De(l),o===null&&st&&(p=l.stateNode=Sk(l.type,l.pendingProps,de.current),ki=l,In=!0,y=$t,uo(l.type)?(L0=y,$t=Hn(p.firstChild)):$t=y),Ti(o,l,l.pendingProps.children,u),hf(o,l),o===null&&(l.flags|=4194304),l.child;case 5:return o===null&&st&&((y=p=$t)&&(p=m3(p,l.type,l.pendingProps,In),p!==null?(l.stateNode=p,ki=l,$t=Hn(p.firstChild),In=!1,y=!0):y=!1),y||Fs(l)),De(l),y=l.type,b=l.pendingProps,C=o!==null?o.memoizedProps:null,p=b.children,M0(y,b)?p=null:C!==null&&M0(y,C)&&(l.flags|=32),l.memoizedState!==null&&(y=AO(o,l,Ej,null,null,u),Qh._currentValue=y),hf(o,l),Ti(o,l,p,u),l.child;case 6:return o===null&&st&&((o=u=$t)&&(u=O3(u,l.pendingProps,In),u!==null?(l.stateNode=u,ki=l,$t=null,o=!0):o=!1),o||Fs(l)),null;case 13:return cw(o,l,u);case 4:return fe(l,l.stateNode.containerInfo),p=l.pendingProps,o===null?l.child=pa(l,null,p,u):Ti(o,l,p,u),l.child;case 11:return ew(o,l,l.type,l.pendingProps,u);case 7:return Ti(o,l,l.pendingProps,u),l.child;case 8:return Ti(o,l,l.pendingProps.children,u),l.child;case 12:return Ti(o,l,l.pendingProps.children,u),l.child;case 10:return p=l.pendingProps,Ks(l,l.type,p.value),Ti(o,l,p.children,u),l.child;case 9:return y=l.type._context,p=l.pendingProps.children,ha(l),y=Ci(y),p=p(y),l.flags|=1,Ti(o,l,p,u),l.child;case 14:return tw(o,l,l.type,l.pendingProps,u);case 15:return iw(o,l,l.type,l.pendingProps,u);case 19:return uw(o,l,u);case 31:return Lj(o,l,u);case 22:return nw(o,l,u,l.pendingProps);case 24:return ha(l),p=Ci(Jt),o===null?(y=xO(),y===null&&(y=wt,b=bO(),y.pooledCache=b,b.refCount++,b!==null&&(y.pooledCacheLanes|=u),y=b),l.memoizedState={parent:p,cache:y},kO(l),Ks(l,Jt,y)):((o.lanes&u)!==0&&(CO(o,l),lh(l,null,null,u),ah()),y=o.memoizedState,b=l.memoizedState,y.parent!==p?(y={parent:p,cache:p},l.memoizedState=y,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=y),Ks(l,Jt,p)):(p=b.cache,Ks(l,Jt,p),p!==y.cache&&SO(l,[Jt],u,!0))),Ti(o,l,l.pendingProps.children,u),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function us(o){o.flags|=4}function a0(o,l,u,p,y){if((l=(o.mode&32)!==0)&&(l=!1),l){if(o.flags|=16777216,(y&335544128)===y)if(o.stateNode.complete)o.flags|=8192;else if(Lw())o.flags|=8192;else throw fa=Hd,wO}else o.flags&=-16777217}function fw(o,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!Qk(l))if(Lw())o.flags|=8192;else throw fa=Hd,wO}function df(o,l){l!==null&&(o.flags|=4),o.flags&16384&&(l=o.tag!==22?Od():536870912,o.lanes|=l,Rl|=l)}function ph(o,l){if(!st)switch(o.tailMode){case"hidden":l=o.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?o.tail=null:u.sibling=null;break;case"collapsed":u=o.tail;for(var p=null;u!==null;)u.alternate!==null&&(p=u),u=u.sibling;p===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:p.sibling=null}}function Pt(o){var l=o.alternate!==null&&o.alternate.child===o.child,u=0,p=0;if(l)for(var y=o.child;y!==null;)u|=y.lanes|y.childLanes,p|=y.subtreeFlags&65011712,p|=y.flags&65011712,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)u|=y.lanes|y.childLanes,p|=y.subtreeFlags,p|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=p,o.childLanes=u,l}function Nj(o,l,u){var p=l.pendingProps;switch(gO(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(l),null;case 1:return Pt(l),null;case 3:return u=l.stateNode,p=null,o!==null&&(p=o.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),as(Jt),ve(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(o===null||o.child===null)&&(yl(l)?us(l):o===null||o.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,OO())),Pt(l),null;case 26:var y=l.type,b=l.memoizedState;return o===null?(us(l),b!==null?(Pt(l),fw(l,b)):(Pt(l),a0(l,y,null,p,u))):b?b!==o.memoizedState?(us(l),Pt(l),fw(l,b)):(Pt(l),l.flags&=-16777217):(o=o.memoizedProps,o!==p&&us(l),Pt(l),a0(l,y,o,p,u)),null;case 27:if(Ee(l),u=de.current,y=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==p&&us(l);else{if(!p){if(l.stateNode===null)throw Error(n(166));return Pt(l),null}o=ie.current,yl(l)?I_(l):(o=Sk(y,p,u),l.stateNode=o,us(l))}return Pt(l),null;case 5:if(Ee(l),y=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==p&&us(l);else{if(!p){if(l.stateNode===null)throw Error(n(166));return Pt(l),null}if(b=ie.current,yl(l))I_(l);else{var C=Tf(de.current);switch(b){case 1:b=C.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:b=C.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":b=C.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":b=C.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":b=C.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof p.is=="string"?C.createElement("select",{is:p.is}):C.createElement("select"),p.multiple?b.multiple=!0:p.size&&(b.size=p.size);break;default:b=typeof p.is=="string"?C.createElement(y,{is:p.is}):C.createElement(y)}}b[li]=l,b[Di]=p;e:for(C=l.child;C!==null;){if(C.tag===5||C.tag===6)b.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===l)break e;for(;C.sibling===null;){if(C.return===null||C.return===l)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}l.stateNode=b;e:switch(Qi(b,y,p),y){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&us(l)}}return Pt(l),a0(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,u),null;case 6:if(o&&l.stateNode!=null)o.memoizedProps!==p&&us(l);else{if(typeof p!="string"&&l.stateNode===null)throw Error(n(166));if(o=de.current,yl(l)){if(o=l.stateNode,u=l.memoizedProps,p=null,y=ki,y!==null)switch(y.tag){case 27:case 5:p=y.memoizedProps}o[li]=l,o=!!(o.nodeValue===u||p!==null&&p.suppressHydrationWarning===!0||ck(o.nodeValue,u)),o||Fs(l,!0)}else o=Tf(o).createTextNode(p),o[li]=l,l.stateNode=o}return Pt(l),null;case 31:if(u=l.memoizedState,o===null||o.memoizedState!==null){if(p=yl(l),u!==null){if(o===null){if(!p)throw Error(n(318));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(557));o[li]=l}else la(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Pt(l),o=!1}else u=OO(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=u),o=!0;if(!o)return l.flags&256?(Cn(l),l):(Cn(l),null);if((l.flags&128)!==0)throw Error(n(558))}return Pt(l),null;case 13:if(p=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=yl(l),p!==null&&p.dehydrated!==null){if(o===null){if(!y)throw Error(n(318));if(y=l.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(n(317));y[li]=l}else la(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Pt(l),y=!1}else y=OO(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return l.flags&256?(Cn(l),l):(Cn(l),null)}return Cn(l),(l.flags&128)!==0?(l.lanes=u,l):(u=p!==null,o=o!==null&&o.memoizedState!==null,u&&(p=l.child,y=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(y=p.alternate.memoizedState.cachePool.pool),b=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(b=p.memoizedState.cachePool.pool),b!==y&&(p.flags|=2048)),u!==o&&u&&(l.child.flags|=8192),df(l,l.updateQueue),Pt(l),null);case 4:return ve(),o===null&&$0(l.stateNode.containerInfo),Pt(l),null;case 10:return as(l.type),Pt(l),null;case 19:if(q(Vt),p=l.memoizedState,p===null)return Pt(l),null;if(y=(l.flags&128)!==0,b=p.rendering,b===null)if(y)ph(p,!1);else{if(Nt!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(b=Kd(o),b!==null){for(l.flags|=128,ph(p,!1),o=b.updateQueue,l.updateQueue=o,df(l,o),l.subtreeFlags=0,o=u,u=l.child;u!==null;)N_(u,o),u=u.sibling;return K(Vt,Vt.current&1|2),st&&ss(l,p.treeForkCount),l.child}o=o.sibling}p.tail!==null&&Le()>Of&&(l.flags|=128,y=!0,ph(p,!1),l.lanes=4194304)}else{if(!y)if(o=Kd(b),o!==null){if(l.flags|=128,y=!0,o=o.updateQueue,l.updateQueue=o,df(l,o),ph(p,!0),p.tail===null&&p.tailMode==="hidden"&&!b.alternate&&!st)return Pt(l),null}else 2*Le()-p.renderingStartTime>Of&&u!==536870912&&(l.flags|=128,y=!0,ph(p,!1),l.lanes=4194304);p.isBackwards?(b.sibling=l.child,l.child=b):(o=p.last,o!==null?o.sibling=b:l.child=b,p.last=b)}return p.tail!==null?(o=p.tail,p.rendering=o,p.tail=o.sibling,p.renderingStartTime=Le(),o.sibling=null,u=Vt.current,K(Vt,y?u&1|2:u&1),st&&ss(l,p.treeForkCount),o):(Pt(l),null);case 22:case 23:return Cn(l),PO(),p=l.memoizedState!==null,o!==null?o.memoizedState!==null!==p&&(l.flags|=8192):p&&(l.flags|=8192),p?(u&536870912)!==0&&(l.flags&128)===0&&(Pt(l),l.subtreeFlags&6&&(l.flags|=8192)):Pt(l),u=l.updateQueue,u!==null&&df(l,u.retryQueue),u=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==u&&(l.flags|=2048),o!==null&&q(ua),null;case 24:return u=null,o!==null&&(u=o.memoizedState.cache),l.memoizedState.cache!==u&&(l.flags|=2048),as(Jt),Pt(l),null;case 25:return null;case 30:return null}throw Error(n(156,l.tag))}function Zj(o,l){switch(gO(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return as(Jt),ve(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return Ee(l),null;case 31:if(l.memoizedState!==null){if(Cn(l),l.alternate===null)throw Error(n(340));la()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(Cn(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(n(340));la()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return q(Vt),null;case 4:return ve(),null;case 10:return as(l.type),null;case 22:case 23:return Cn(l),PO(),o!==null&&q(ua),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return as(Jt),null;case 25:return null;default:return null}}function pw(o,l){switch(gO(l),l.tag){case 3:as(Jt),ve();break;case 26:case 27:case 5:Ee(l);break;case 4:ve();break;case 31:l.memoizedState!==null&&Cn(l);break;case 13:Cn(l);break;case 19:q(Vt);break;case 10:as(l.type);break;case 22:case 23:Cn(l),PO(),o!==null&&q(ua);break;case 24:as(Jt)}}function gh(o,l){try{var u=l.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var y=p.next;u=y;do{if((u.tag&o)===o){p=void 0;var b=u.create,C=u.inst;p=b(),C.destroy=p}u=u.next}while(u!==y)}}catch(A){yt(l,l.return,A)}}function ro(o,l,u){try{var p=l.updateQueue,y=p!==null?p.lastEffect:null;if(y!==null){var b=y.next;p=b;do{if((p.tag&o)===o){var C=p.inst,A=C.destroy;if(A!==void 0){C.destroy=void 0,y=l;var Y=u,te=A;try{te()}catch(se){yt(y,Y,se)}}}p=p.next}while(p!==b)}}catch(se){yt(l,l.return,se)}}function gw(o){var l=o.updateQueue;if(l!==null){var u=o.stateNode;try{sx(l,u)}catch(p){yt(o,o.return,p)}}}function mw(o,l,u){u.props=ma(o.type,o.memoizedProps),u.state=o.memoizedState;try{u.componentWillUnmount()}catch(p){yt(o,l,p)}}function mh(o,l){try{var u=o.ref;if(u!==null){switch(o.tag){case 26:case 27:case 5:var p=o.stateNode;break;case 30:p=o.stateNode;break;default:p=o.stateNode}typeof u=="function"?o.refCleanup=u(p):u.current=p}}catch(y){yt(o,l,y)}}function Qr(o,l){var u=o.ref,p=o.refCleanup;if(u!==null)if(typeof p=="function")try{p()}catch(y){yt(o,l,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){yt(o,l,y)}else u.current=null}function Ow(o){var l=o.type,u=o.memoizedProps,p=o.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":u.autoFocus&&p.focus();break e;case"img":u.src?p.src=u.src:u.srcSet&&(p.srcset=u.srcSet)}}catch(y){yt(o,o.return,y)}}function l0(o,l,u){try{var p=o.stateNode;h3(p,o.type,u,l),p[Di]=l}catch(y){yt(o,o.return,y)}}function vw(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&uo(o.type)||o.tag===4}function c0(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||vw(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&uo(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function h0(o,l,u){var p=o.tag;if(p===5||p===6)o=o.stateNode,l?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(o,l):(l=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,l.appendChild(o),u=u._reactRootContainer,u!=null||l.onclick!==null||(l.onclick=is));else if(p!==4&&(p===27&&uo(o.type)&&(u=o.stateNode,l=null),o=o.child,o!==null))for(h0(o,l,u),o=o.sibling;o!==null;)h0(o,l,u),o=o.sibling}function ff(o,l,u){var p=o.tag;if(p===5||p===6)o=o.stateNode,l?u.insertBefore(o,l):u.appendChild(o);else if(p!==4&&(p===27&&uo(o.type)&&(u=o.stateNode),o=o.child,o!==null))for(ff(o,l,u),o=o.sibling;o!==null;)ff(o,l,u),o=o.sibling}function yw(o){var l=o.stateNode,u=o.memoizedProps;try{for(var p=o.type,y=l.attributes;y.length;)l.removeAttributeNode(y[0]);Qi(l,p,u),l[li]=o,l[Di]=u}catch(b){yt(o,o.return,b)}}var ds=!1,ii=!1,u0=!1,Sw=typeof WeakSet=="function"?WeakSet:Set,mi=null;function Wj(o,l){if(o=o.containerInfo,R0=Mf,o=R_(o),rO(o)){if("selectionStart"in o)var u={start:o.selectionStart,end:o.selectionEnd};else e:{u=(u=o.ownerDocument)&&u.defaultView||window;var p=u.getSelection&&u.getSelection();if(p&&p.rangeCount!==0){u=p.anchorNode;var y=p.anchorOffset,b=p.focusNode;p=p.focusOffset;try{u.nodeType,b.nodeType}catch{u=null;break e}var C=0,A=-1,Y=-1,te=0,se=0,he=o,ne=null;t:for(;;){for(var re;he!==u||y!==0&&he.nodeType!==3||(A=C+y),he!==b||p!==0&&he.nodeType!==3||(Y=C+p),he.nodeType===3&&(C+=he.nodeValue.length),(re=he.firstChild)!==null;)ne=he,he=re;for(;;){if(he===o)break t;if(ne===u&&++te===y&&(A=C),ne===b&&++se===p&&(Y=C),(re=he.nextSibling)!==null)break;he=ne,ne=he.parentNode}he=re}u=A===-1||Y===-1?null:{start:A,end:Y}}else u=null}u=u||{start:0,end:0}}else u=null;for(A0={focusedElem:o,selectionRange:u},Mf=!1,mi=l;mi!==null;)if(l=mi,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,mi=o;else for(;mi!==null;){switch(l=mi,b=l.alternate,o=l.flags,l.tag){case 0:if((o&4)!==0&&(o=l.updateQueue,o=o!==null?o.events:null,o!==null))for(u=0;u<o.length;u++)y=o[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&b!==null){o=void 0,u=l,y=b.memoizedProps,b=b.memoizedState,p=u.stateNode;try{var we=ma(u.type,y);o=p.getSnapshotBeforeUpdate(we,b),p.__reactInternalSnapshotBeforeUpdate=o}catch(ze){yt(u,u.return,ze)}}break;case 3:if((o&1024)!==0){if(o=l.stateNode.containerInfo,u=o.nodeType,u===9)j0(o);else if(u===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":j0(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(n(163))}if(o=l.sibling,o!==null){o.return=l.return,mi=o;break}mi=l.return}}function bw(o,l,u){var p=u.flags;switch(u.tag){case 0:case 11:case 15:ps(o,u),p&4&&gh(5,u);break;case 1:if(ps(o,u),p&4)if(o=u.stateNode,l===null)try{o.componentDidMount()}catch(C){yt(u,u.return,C)}else{var y=ma(u.type,l.memoizedProps);l=l.memoizedState;try{o.componentDidUpdate(y,l,o.__reactInternalSnapshotBeforeUpdate)}catch(C){yt(u,u.return,C)}}p&64&&gw(u),p&512&&mh(u,u.return);break;case 3:if(ps(o,u),p&64&&(o=u.updateQueue,o!==null)){if(l=null,u.child!==null)switch(u.child.tag){case 27:case 5:l=u.child.stateNode;break;case 1:l=u.child.stateNode}try{sx(o,l)}catch(C){yt(u,u.return,C)}}break;case 27:l===null&&p&4&&yw(u);case 26:case 5:ps(o,u),l===null&&p&4&&Ow(u),p&512&&mh(u,u.return);break;case 12:ps(o,u);break;case 31:ps(o,u),p&4&&ww(o,u);break;case 13:ps(o,u),p&4&&kw(o,u),p&64&&(o=u.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(u=Kj.bind(null,u),v3(o,u))));break;case 22:if(p=u.memoizedState!==null||ds,!p){l=l!==null&&l.memoizedState!==null||ii,y=ds;var b=ii;ds=p,(ii=l)&&!b?gs(o,u,(u.subtreeFlags&8772)!==0):ps(o,u),ds=y,ii=b}break;case 30:break;default:ps(o,u)}}function _w(o){var l=o.alternate;l!==null&&(o.alternate=null,_w(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&Zc(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Rt=null,hn=!1;function fs(o,l,u){for(u=u.child;u!==null;)xw(o,l,u),u=u.sibling}function xw(o,l,u){if(Ii&&typeof Ii.onCommitFiberUnmount=="function")try{Ii.onCommitFiberUnmount(Fo,u)}catch{}switch(u.tag){case 26:ii||Qr(u,l),fs(o,l,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:ii||Qr(u,l);var p=Rt,y=hn;uo(u.type)&&(Rt=u.stateNode,hn=!1),fs(o,l,u),kh(u.stateNode),Rt=p,hn=y;break;case 5:ii||Qr(u,l);case 6:if(p=Rt,y=hn,Rt=null,fs(o,l,u),Rt=p,hn=y,Rt!==null)if(hn)try{(Rt.nodeType===9?Rt.body:Rt.nodeName==="HTML"?Rt.ownerDocument.body:Rt).removeChild(u.stateNode)}catch(b){yt(u,l,b)}else try{Rt.removeChild(u.stateNode)}catch(b){yt(u,l,b)}break;case 18:Rt!==null&&(hn?(o=Rt,gk(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,u.stateNode),Xl(o)):gk(Rt,u.stateNode));break;case 4:p=Rt,y=hn,Rt=u.stateNode.containerInfo,hn=!0,fs(o,l,u),Rt=p,hn=y;break;case 0:case 11:case 14:case 15:ro(2,u,l),ii||ro(4,u,l),fs(o,l,u);break;case 1:ii||(Qr(u,l),p=u.stateNode,typeof p.componentWillUnmount=="function"&&mw(u,l,p)),fs(o,l,u);break;case 21:fs(o,l,u);break;case 22:ii=(p=ii)||u.memoizedState!==null,fs(o,l,u),ii=p;break;default:fs(o,l,u)}}function ww(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Xl(o)}catch(u){yt(l,l.return,u)}}}function kw(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Xl(o)}catch(u){yt(l,l.return,u)}}function qj(o){switch(o.tag){case 31:case 13:case 19:var l=o.stateNode;return l===null&&(l=o.stateNode=new Sw),l;case 22:return o=o.stateNode,l=o._retryCache,l===null&&(l=o._retryCache=new Sw),l;default:throw Error(n(435,o.tag))}}function pf(o,l){var u=qj(o);l.forEach(function(p){if(!u.has(p)){u.add(p);var y=Jj.bind(null,o,p);p.then(y,y)}})}function un(o,l){var u=l.deletions;if(u!==null)for(var p=0;p<u.length;p++){var y=u[p],b=o,C=l,A=C;e:for(;A!==null;){switch(A.tag){case 27:if(uo(A.type)){Rt=A.stateNode,hn=!1;break e}break;case 5:Rt=A.stateNode,hn=!1;break e;case 3:case 4:Rt=A.stateNode.containerInfo,hn=!0;break e}A=A.return}if(Rt===null)throw Error(n(160));xw(b,C,y),Rt=null,hn=!1,b=y.alternate,b!==null&&(b.return=null),y.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)Cw(l,o),l=l.sibling}var hr=null;function Cw(o,l){var u=o.alternate,p=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:un(l,o),dn(o),p&4&&(ro(3,o,o.return),gh(3,o),ro(5,o,o.return));break;case 1:un(l,o),dn(o),p&512&&(ii||u===null||Qr(u,u.return)),p&64&&ds&&(o=o.updateQueue,o!==null&&(p=o.callbacks,p!==null&&(u=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=u===null?p:u.concat(p))));break;case 26:var y=hr;if(un(l,o),dn(o),p&512&&(ii||u===null||Qr(u,u.return)),p&4){var b=u!==null?u.memoizedState:null;if(p=o.memoizedState,u===null)if(p===null)if(o.stateNode===null){e:{p=o.type,u=o.memoizedProps,y=y.ownerDocument||y;t:switch(p){case"title":b=y.getElementsByTagName("title")[0],(!b||b[ea]||b[li]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=y.createElement(p),y.head.insertBefore(b,y.querySelector("head > title"))),Qi(b,p,u),b[li]=o,Kt(b),p=b;break e;case"link":var C=Ck("link","href",y).get(p+(u.href||""));if(C){for(var A=0;A<C.length;A++)if(b=C[A],b.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&b.getAttribute("rel")===(u.rel==null?null:u.rel)&&b.getAttribute("title")===(u.title==null?null:u.title)&&b.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){C.splice(A,1);break t}}b=y.createElement(p),Qi(b,p,u),y.head.appendChild(b);break;case"meta":if(C=Ck("meta","content",y).get(p+(u.content||""))){for(A=0;A<C.length;A++)if(b=C[A],b.getAttribute("content")===(u.content==null?null:""+u.content)&&b.getAttribute("name")===(u.name==null?null:u.name)&&b.getAttribute("property")===(u.property==null?null:u.property)&&b.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&b.getAttribute("charset")===(u.charSet==null?null:u.charSet)){C.splice(A,1);break t}}b=y.createElement(p),Qi(b,p,u),y.head.appendChild(b);break;default:throw Error(n(468,p))}b[li]=o,Kt(b),p=b}o.stateNode=p}else Tk(y,o.type,o.stateNode);else o.stateNode=kk(y,p,o.memoizedProps);else b!==p?(b===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):b.count--,p===null?Tk(y,o.type,o.stateNode):kk(y,p,o.memoizedProps)):p===null&&o.stateNode!==null&&l0(o,o.memoizedProps,u.memoizedProps)}break;case 27:un(l,o),dn(o),p&512&&(ii||u===null||Qr(u,u.return)),u!==null&&p&4&&l0(o,o.memoizedProps,u.memoizedProps);break;case 5:if(un(l,o),dn(o),p&512&&(ii||u===null||Qr(u,u.return)),o.flags&32){y=o.stateNode;try{cl(y,"")}catch(we){yt(o,o.return,we)}}p&4&&o.stateNode!=null&&(y=o.memoizedProps,l0(o,y,u!==null?u.memoizedProps:y)),p&1024&&(u0=!0);break;case 6:if(un(l,o),dn(o),p&4){if(o.stateNode===null)throw Error(n(162));p=o.memoizedProps,u=o.stateNode;try{u.nodeValue=p}catch(we){yt(o,o.return,we)}}break;case 3:if(Pf=null,y=hr,hr=Qf(l.containerInfo),un(l,o),hr=y,dn(o),p&4&&u!==null&&u.memoizedState.isDehydrated)try{Xl(l.containerInfo)}catch(we){yt(o,o.return,we)}u0&&(u0=!1,Tw(o));break;case 4:p=hr,hr=Qf(o.stateNode.containerInfo),un(l,o),dn(o),hr=p;break;case 12:un(l,o),dn(o);break;case 31:un(l,o),dn(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,pf(o,p)));break;case 13:un(l,o),dn(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(mf=Le()),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,pf(o,p)));break;case 22:y=o.memoizedState!==null;var Y=u!==null&&u.memoizedState!==null,te=ds,se=ii;if(ds=te||y,ii=se||Y,un(l,o),ii=se,ds=te,dn(o),p&8192)e:for(l=o.stateNode,l._visibility=y?l._visibility&-2:l._visibility|1,y&&(u===null||Y||ds||ii||Oa(o)),u=null,l=o;;){if(l.tag===5||l.tag===26){if(u===null){Y=u=l;try{if(b=Y.stateNode,y)C=b.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{A=Y.stateNode;var he=Y.memoizedProps.style,ne=he!=null&&he.hasOwnProperty("display")?he.display:null;A.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(we){yt(Y,Y.return,we)}}}else if(l.tag===6){if(u===null){Y=l;try{Y.stateNode.nodeValue=y?"":Y.memoizedProps}catch(we){yt(Y,Y.return,we)}}}else if(l.tag===18){if(u===null){Y=l;try{var re=Y.stateNode;y?mk(re,!0):mk(Y.stateNode,!1)}catch(we){yt(Y,Y.return,we)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===o)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break e;for(;l.sibling===null;){if(l.return===null||l.return===o)break e;u===l&&(u=null),l=l.return}u===l&&(u=null),l.sibling.return=l.return,l=l.sibling}p&4&&(p=o.updateQueue,p!==null&&(u=p.retryQueue,u!==null&&(p.retryQueue=null,pf(o,u))));break;case 19:un(l,o),dn(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,pf(o,p)));break;case 30:break;case 21:break;default:un(l,o),dn(o)}}function dn(o){var l=o.flags;if(l&2){try{for(var u,p=o.return;p!==null;){if(vw(p)){u=p;break}p=p.return}if(u==null)throw Error(n(160));switch(u.tag){case 27:var y=u.stateNode,b=c0(o);ff(o,b,y);break;case 5:var C=u.stateNode;u.flags&32&&(cl(C,""),u.flags&=-33);var A=c0(o);ff(o,A,C);break;case 3:case 4:var Y=u.stateNode.containerInfo,te=c0(o);h0(o,te,Y);break;default:throw Error(n(161))}}catch(se){yt(o,o.return,se)}o.flags&=-3}l&4096&&(o.flags&=-4097)}function Tw(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var l=o;Tw(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),o=o.sibling}}function ps(o,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)bw(o,l.alternate,l),l=l.sibling}function Oa(o){for(o=o.child;o!==null;){var l=o;switch(l.tag){case 0:case 11:case 14:case 15:ro(4,l,l.return),Oa(l);break;case 1:Qr(l,l.return);var u=l.stateNode;typeof u.componentWillUnmount=="function"&&mw(l,l.return,u),Oa(l);break;case 27:kh(l.stateNode);case 26:case 5:Qr(l,l.return),Oa(l);break;case 22:l.memoizedState===null&&Oa(l);break;case 30:Oa(l);break;default:Oa(l)}o=o.sibling}}function gs(o,l,u){for(u=u&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var p=l.alternate,y=o,b=l,C=b.flags;switch(b.tag){case 0:case 11:case 15:gs(y,b,u),gh(4,b);break;case 1:if(gs(y,b,u),p=b,y=p.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(te){yt(p,p.return,te)}if(p=b,y=p.updateQueue,y!==null){var A=p.stateNode;try{var Y=y.shared.hiddenCallbacks;if(Y!==null)for(y.shared.hiddenCallbacks=null,y=0;y<Y.length;y++)rx(Y[y],A)}catch(te){yt(p,p.return,te)}}u&&C&64&&gw(b),mh(b,b.return);break;case 27:yw(b);case 26:case 5:gs(y,b,u),u&&p===null&&C&4&&Ow(b),mh(b,b.return);break;case 12:gs(y,b,u);break;case 31:gs(y,b,u),u&&C&4&&ww(y,b);break;case 13:gs(y,b,u),u&&C&4&&kw(y,b);break;case 22:b.memoizedState===null&&gs(y,b,u),mh(b,b.return);break;case 30:break;default:gs(y,b,u)}l=l.sibling}}function d0(o,l){var u=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==u&&(o!=null&&o.refCount++,u!=null&&ih(u))}function f0(o,l){o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&ih(o))}function ur(o,l,u,p){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Qw(o,l,u,p),l=l.sibling}function Qw(o,l,u,p){var y=l.flags;switch(l.tag){case 0:case 11:case 15:ur(o,l,u,p),y&2048&&gh(9,l);break;case 1:ur(o,l,u,p);break;case 3:ur(o,l,u,p),y&2048&&(o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&ih(o)));break;case 12:if(y&2048){ur(o,l,u,p),o=l.stateNode;try{var b=l.memoizedProps,C=b.id,A=b.onPostCommit;typeof A=="function"&&A(C,l.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(Y){yt(l,l.return,Y)}}else ur(o,l,u,p);break;case 31:ur(o,l,u,p);break;case 13:ur(o,l,u,p);break;case 23:break;case 22:b=l.stateNode,C=l.alternate,l.memoizedState!==null?b._visibility&2?ur(o,l,u,p):Oh(o,l):b._visibility&2?ur(o,l,u,p):(b._visibility|=2,$l(o,l,u,p,(l.subtreeFlags&10256)!==0||!1)),y&2048&&d0(C,l);break;case 24:ur(o,l,u,p),y&2048&&f0(l.alternate,l);break;default:ur(o,l,u,p)}}function $l(o,l,u,p,y){for(y=y&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var b=o,C=l,A=u,Y=p,te=C.flags;switch(C.tag){case 0:case 11:case 15:$l(b,C,A,Y,y),gh(8,C);break;case 23:break;case 22:var se=C.stateNode;C.memoizedState!==null?se._visibility&2?$l(b,C,A,Y,y):Oh(b,C):(se._visibility|=2,$l(b,C,A,Y,y)),y&&te&2048&&d0(C.alternate,C);break;case 24:$l(b,C,A,Y,y),y&&te&2048&&f0(C.alternate,C);break;default:$l(b,C,A,Y,y)}l=l.sibling}}function Oh(o,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var u=o,p=l,y=p.flags;switch(p.tag){case 22:Oh(u,p),y&2048&&d0(p.alternate,p);break;case 24:Oh(u,p),y&2048&&f0(p.alternate,p);break;default:Oh(u,p)}l=l.sibling}}var vh=8192;function Pl(o,l,u){if(o.subtreeFlags&vh)for(o=o.child;o!==null;)$w(o,l,u),o=o.sibling}function $w(o,l,u){switch(o.tag){case 26:Pl(o,l,u),o.flags&vh&&o.memoizedState!==null&&P3(u,hr,o.memoizedState,o.memoizedProps);break;case 5:Pl(o,l,u);break;case 3:case 4:var p=hr;hr=Qf(o.stateNode.containerInfo),Pl(o,l,u),hr=p;break;case 22:o.memoizedState===null&&(p=o.alternate,p!==null&&p.memoizedState!==null?(p=vh,vh=16777216,Pl(o,l,u),vh=p):Pl(o,l,u));break;default:Pl(o,l,u)}}function Pw(o){var l=o.alternate;if(l!==null&&(o=l.child,o!==null)){l.child=null;do l=o.sibling,o.sibling=null,o=l;while(o!==null)}}function yh(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var p=l[u];mi=p,Rw(p,o)}Pw(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Ew(o),o=o.sibling}function Ew(o){switch(o.tag){case 0:case 11:case 15:yh(o),o.flags&2048&&ro(9,o,o.return);break;case 3:yh(o);break;case 12:yh(o);break;case 22:var l=o.stateNode;o.memoizedState!==null&&l._visibility&2&&(o.return===null||o.return.tag!==13)?(l._visibility&=-3,gf(o)):yh(o);break;default:yh(o)}}function gf(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var p=l[u];mi=p,Rw(p,o)}Pw(o)}for(o=o.child;o!==null;){switch(l=o,l.tag){case 0:case 11:case 15:ro(8,l,l.return),gf(l);break;case 22:u=l.stateNode,u._visibility&2&&(u._visibility&=-3,gf(l));break;default:gf(l)}o=o.sibling}}function Rw(o,l){for(;mi!==null;){var u=mi;switch(u.tag){case 0:case 11:case 15:ro(8,u,l);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var p=u.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:ih(u.memoizedState.cache)}if(p=u.child,p!==null)p.return=u,mi=p;else e:for(u=o;mi!==null;){p=mi;var y=p.sibling,b=p.return;if(_w(p),p===u){mi=null;break e}if(y!==null){y.return=b,mi=y;break e}mi=b}}}var Vj={getCacheForType:function(o){var l=Ci(Jt),u=l.data.get(o);return u===void 0&&(u=o(),l.data.set(o,u)),u},cacheSignal:function(){return Ci(Jt).controller.signal}},Ij=typeof WeakMap=="function"?WeakMap:Map,ft=0,wt=null,Ke=null,tt=0,vt=0,Tn=null,so=!1,El=!1,p0=!1,ms=0,Nt=0,oo=0,va=0,g0=0,Qn=0,Rl=0,Sh=null,fn=null,m0=!1,mf=0,Aw=0,Of=1/0,vf=null,ao=null,ci=0,lo=null,Al=null,Os=0,O0=0,v0=null,Mw=null,bh=0,y0=null;function $n(){return(ft&2)!==0&&tt!==0?tt&-tt:P.T!==null?k0():bd()}function zw(){if(Qn===0)if((tt&536870912)===0||st){var o=nl;nl<<=1,(nl&3932160)===0&&(nl=262144),Qn=o}else Qn=536870912;return o=kn.current,o!==null&&(o.flags|=32),Qn}function pn(o,l,u){(o===wt&&(vt===2||vt===9)||o.cancelPendingCommit!==null)&&(Ml(o,0),co(o,tt,Qn,!1)),Jo(o,u),((ft&2)===0||o!==wt)&&(o===wt&&((ft&2)===0&&(va|=u),Nt===4&&co(o,tt,Qn,!1)),$r(o))}function jw(o,l,u){if((ft&6)!==0)throw Error(n(327));var p=!u&&(l&127)===0&&(l&o.expiredLanes)===0||Ko(o,l),y=p?Uj(o,l):b0(o,l,!0),b=p;do{if(y===0){El&&!p&&co(o,l,0,!1);break}else{if(u=o.current.alternate,b&&!Yj(u)){y=b0(o,l,!1),b=!1;continue}if(y===2){if(b=l,o.errorRecoveryDisabledLanes&b)var C=0;else C=o.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){l=C;e:{var A=o;y=Sh;var Y=A.current.memoizedState.isDehydrated;if(Y&&(Ml(A,C).flags|=256),C=b0(A,C,!1),C!==2){if(p0&&!Y){A.errorRecoveryDisabledLanes|=b,va|=b,y=4;break e}b=fn,fn=y,b!==null&&(fn===null?fn=b:fn.push.apply(fn,b))}y=C}if(b=!1,y!==2)continue}}if(y===1){Ml(o,0),co(o,l,0,!0);break}e:{switch(p=o,b=y,b){case 0:case 1:throw Error(n(345));case 4:if((l&4194048)!==l)break;case 6:co(p,l,Qn,!so);break e;case 2:fn=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(y=mf+300-Le(),10<y)){if(co(p,l,Qn,!so),sl(p,0,!0)!==0)break e;Os=l,p.timeoutHandle=fk(Dw.bind(null,p,u,fn,vf,m0,l,Qn,va,Rl,so,b,"Throttled",-0,0),y);break e}Dw(p,u,fn,vf,m0,l,Qn,va,Rl,so,b,null,-0,0)}}break}while(!0);$r(o)}function Dw(o,l,u,p,y,b,C,A,Y,te,se,he,ne,re){if(o.timeoutHandle=-1,he=l.subtreeFlags,he&8192||(he&16785408)===16785408){he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:is},$w(l,b,he);var we=(b&62914560)===b?mf-Le():(b&4194048)===b?Aw-Le():0;if(we=E3(he,we),we!==null){Os=b,o.cancelPendingCommit=we(Vw.bind(null,o,l,b,u,p,y,C,A,Y,se,he,null,ne,re)),co(o,b,C,!te);return}}Vw(o,l,b,u,p,y,C,A,Y)}function Yj(o){for(var l=o;;){var u=l.tag;if((u===0||u===11||u===15)&&l.flags&16384&&(u=l.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var p=0;p<u.length;p++){var y=u[p],b=y.getSnapshot;y=y.value;try{if(!xn(b(),y))return!1}catch{return!1}}if(u=l.child,l.subtreeFlags&16384&&u!==null)u.return=l,l=u;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function co(o,l,u,p){l&=~g0,l&=~va,o.suspendedLanes|=l,o.pingedLanes&=~l,p&&(o.warmLanes|=l),p=o.expirationTimes;for(var y=l;0<y;){var b=31-Yi(y),C=1<<b;p[b]=-1,y&=~C}u!==0&&vd(o,u,l)}function yf(){return(ft&6)===0?(_h(0),!1):!0}function S0(){if(Ke!==null){if(vt===0)var o=Ke.return;else o=Ke,os=ca=null,jO(o),wl=null,rh=0,o=Ke;for(;o!==null;)pw(o.alternate,o),o=o.return;Ke=null}}function Ml(o,l){var u=o.timeoutHandle;u!==-1&&(o.timeoutHandle=-1,f3(u)),u=o.cancelPendingCommit,u!==null&&(o.cancelPendingCommit=null,u()),Os=0,S0(),wt=o,Ke=u=rs(o.current,null),tt=l,vt=0,Tn=null,so=!1,El=Ko(o,l),p0=!1,Rl=Qn=g0=va=oo=Nt=0,fn=Sh=null,m0=!1,(l&8)!==0&&(l|=l&32);var p=o.entangledLanes;if(p!==0)for(o=o.entanglements,p&=l;0<p;){var y=31-Yi(p),b=1<<y;l|=o[y],p&=~b}return ms=l,Ld(),u}function Bw(o,l){Ie=null,P.H=dh,l===xl||l===Yd?(l=ex(),vt=3):l===wO?(l=ex(),vt=4):vt=l===KO?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Tn=l,Ke===null&&(Nt=1,lf(o,Wn(l,o.current)))}function Lw(){var o=kn.current;return o===null?!0:(tt&4194048)===tt?Yn===null:(tt&62914560)===tt||(tt&536870912)!==0?o===Yn:!1}function Xw(){var o=P.H;return P.H=dh,o===null?dh:o}function Nw(){var o=P.A;return P.A=Vj,o}function Sf(){Nt=4,so||(tt&4194048)!==tt&&kn.current!==null||(El=!0),(oo&134217727)===0&&(va&134217727)===0||wt===null||co(wt,tt,Qn,!1)}function b0(o,l,u){var p=ft;ft|=2;var y=Xw(),b=Nw();(wt!==o||tt!==l)&&(vf=null,Ml(o,l)),l=!1;var C=Nt;e:do try{if(vt!==0&&Ke!==null){var A=Ke,Y=Tn;switch(vt){case 8:S0(),C=6;break e;case 3:case 2:case 9:case 6:kn.current===null&&(l=!0);var te=vt;if(vt=0,Tn=null,zl(o,A,Y,te),u&&El){C=0;break e}break;default:te=vt,vt=0,Tn=null,zl(o,A,Y,te)}}Hj(),C=Nt;break}catch(se){Bw(o,se)}while(!0);return l&&o.shellSuspendCounter++,os=ca=null,ft=p,P.H=y,P.A=b,Ke===null&&(wt=null,tt=0,Ld()),C}function Hj(){for(;Ke!==null;)Zw(Ke)}function Uj(o,l){var u=ft;ft|=2;var p=Xw(),y=Nw();wt!==o||tt!==l?(vf=null,Of=Le()+500,Ml(o,l)):El=Ko(o,l);e:do try{if(vt!==0&&Ke!==null){l=Ke;var b=Tn;t:switch(vt){case 1:vt=0,Tn=null,zl(o,l,b,1);break;case 2:case 9:if(K_(b)){vt=0,Tn=null,Ww(l);break}l=function(){vt!==2&&vt!==9||wt!==o||(vt=7),$r(o)},b.then(l,l);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:K_(b)?(vt=0,Tn=null,Ww(l)):(vt=0,Tn=null,zl(o,l,b,7));break;case 5:var C=null;switch(Ke.tag){case 26:C=Ke.memoizedState;case 5:case 27:var A=Ke;if(C?Qk(C):A.stateNode.complete){vt=0,Tn=null;var Y=A.sibling;if(Y!==null)Ke=Y;else{var te=A.return;te!==null?(Ke=te,bf(te)):Ke=null}break t}}vt=0,Tn=null,zl(o,l,b,5);break;case 6:vt=0,Tn=null,zl(o,l,b,6);break;case 8:S0(),Nt=6;break e;default:throw Error(n(462))}}Gj();break}catch(se){Bw(o,se)}while(!0);return os=ca=null,P.H=p,P.A=y,ft=u,Ke!==null?0:(wt=null,tt=0,Ld(),Nt)}function Gj(){for(;Ke!==null&&!oe();)Zw(Ke)}function Zw(o){var l=dw(o.alternate,o,ms);o.memoizedProps=o.pendingProps,l===null?bf(o):Ke=l}function Ww(o){var l=o,u=l.alternate;switch(l.tag){case 15:case 0:l=ow(u,l,l.pendingProps,l.type,void 0,tt);break;case 11:l=ow(u,l,l.pendingProps,l.type.render,l.ref,tt);break;case 5:jO(l);default:pw(u,l),l=Ke=N_(l,ms),l=dw(u,l,ms)}o.memoizedProps=o.pendingProps,l===null?bf(o):Ke=l}function zl(o,l,u,p){os=ca=null,jO(l),wl=null,rh=0;var y=l.return;try{if(Bj(o,y,l,u,tt)){Nt=1,lf(o,Wn(u,o.current)),Ke=null;return}}catch(b){if(y!==null)throw Ke=y,b;Nt=1,lf(o,Wn(u,o.current)),Ke=null;return}l.flags&32768?(st||p===1?o=!0:El||(tt&536870912)!==0?o=!1:(so=o=!0,(p===2||p===9||p===3||p===6)&&(p=kn.current,p!==null&&p.tag===13&&(p.flags|=16384))),qw(l,o)):bf(l)}function bf(o){var l=o;do{if((l.flags&32768)!==0){qw(l,so);return}o=l.return;var u=Nj(l.alternate,l,ms);if(u!==null){Ke=u;return}if(l=l.sibling,l!==null){Ke=l;return}Ke=l=o}while(l!==null);Nt===0&&(Nt=5)}function qw(o,l){do{var u=Zj(o.alternate,o);if(u!==null){u.flags&=32767,Ke=u;return}if(u=o.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!l&&(o=o.sibling,o!==null)){Ke=o;return}Ke=o=u}while(o!==null);Nt=6,Ke=null}function Vw(o,l,u,p,y,b,C,A,Y){o.cancelPendingCommit=null;do _f();while(ci!==0);if((ft&6)!==0)throw Error(n(327));if(l!==null){if(l===o.current)throw Error(n(177));if(b=l.lanes|l.childLanes,b|=cO,Lm(o,u,b,C,A,Y),o===wt&&(Ke=wt=null,tt=0),Al=l,lo=o,Os=u,O0=b,v0=y,Mw=p,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,e3(Go,function(){return Gw(),null})):(o.callbackNode=null,o.callbackPriority=0),p=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||p){p=P.T,P.T=null,y=Z.p,Z.p=2,C=ft,ft|=4;try{Wj(o,l,u)}finally{ft=C,Z.p=y,P.T=p}}ci=1,Iw(),Yw(),Hw()}}function Iw(){if(ci===1){ci=0;var o=lo,l=Al,u=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||u){u=P.T,P.T=null;var p=Z.p;Z.p=2;var y=ft;ft|=4;try{Cw(l,o);var b=A0,C=R_(o.containerInfo),A=b.focusedElem,Y=b.selectionRange;if(C!==A&&A&&A.ownerDocument&&E_(A.ownerDocument.documentElement,A)){if(Y!==null&&rO(A)){var te=Y.start,se=Y.end;if(se===void 0&&(se=te),"selectionStart"in A)A.selectionStart=te,A.selectionEnd=Math.min(se,A.value.length);else{var he=A.ownerDocument||document,ne=he&&he.defaultView||window;if(ne.getSelection){var re=ne.getSelection(),we=A.textContent.length,ze=Math.min(Y.start,we),_t=Y.end===void 0?ze:Math.min(Y.end,we);!re.extend&&ze>_t&&(C=_t,_t=ze,ze=C);var F=P_(A,ze),U=P_(A,_t);if(F&&U&&(re.rangeCount!==1||re.anchorNode!==F.node||re.anchorOffset!==F.offset||re.focusNode!==U.node||re.focusOffset!==U.offset)){var J=he.createRange();J.setStart(F.node,F.offset),re.removeAllRanges(),ze>_t?(re.addRange(J),re.extend(U.node,U.offset)):(J.setEnd(U.node,U.offset),re.addRange(J))}}}}for(he=[],re=A;re=re.parentNode;)re.nodeType===1&&he.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<he.length;A++){var ae=he[A];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}Mf=!!R0,A0=R0=null}finally{ft=y,Z.p=p,P.T=u}}o.current=l,ci=2}}function Yw(){if(ci===2){ci=0;var o=lo,l=Al,u=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||u){u=P.T,P.T=null;var p=Z.p;Z.p=2;var y=ft;ft|=4;try{bw(o,l.alternate,l)}finally{ft=y,Z.p=p,P.T=u}}ci=3}}function Hw(){if(ci===4||ci===3){ci=0,We();var o=lo,l=Al,u=Os,p=Mw;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?ci=5:(ci=0,Al=lo=null,Uw(o,o.pendingLanes));var y=o.pendingLanes;if(y===0&&(ao=null),Nc(u),l=l.stateNode,Ii&&typeof Ii.onCommitFiberRoot=="function")try{Ii.onCommitFiberRoot(Fo,l,void 0,(l.current.flags&128)===128)}catch{}if(p!==null){l=P.T,y=Z.p,Z.p=2,P.T=null;try{for(var b=o.onRecoverableError,C=0;C<p.length;C++){var A=p[C];b(A.value,{componentStack:A.stack})}}finally{P.T=l,Z.p=y}}(Os&3)!==0&&_f(),$r(o),y=o.pendingLanes,(u&261930)!==0&&(y&42)!==0?o===y0?bh++:(bh=0,y0=o):bh=0,_h(0)}}function Uw(o,l){(o.pooledCacheLanes&=l)===0&&(l=o.pooledCache,l!=null&&(o.pooledCache=null,ih(l)))}function _f(){return Iw(),Yw(),Hw(),Gw()}function Gw(){if(ci!==5)return!1;var o=lo,l=O0;O0=0;var u=Nc(Os),p=P.T,y=Z.p;try{Z.p=32>u?32:u,P.T=null,u=v0,v0=null;var b=lo,C=Os;if(ci=0,Al=lo=null,Os=0,(ft&6)!==0)throw Error(n(331));var A=ft;if(ft|=4,Ew(b.current),Qw(b,b.current,C,u),ft=A,_h(0,!1),Ii&&typeof Ii.onPostCommitFiberRoot=="function")try{Ii.onPostCommitFiberRoot(Fo,b)}catch{}return!0}finally{Z.p=y,P.T=p,Uw(o,l)}}function Fw(o,l,u){l=Wn(u,l),l=FO(o.stateNode,l,2),o=to(o,l,2),o!==null&&(Jo(o,2),$r(o))}function yt(o,l,u){if(o.tag===3)Fw(o,o,u);else for(;l!==null;){if(l.tag===3){Fw(l,o,u);break}else if(l.tag===1){var p=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(ao===null||!ao.has(p))){o=Wn(u,o),u=Kx(2),p=to(l,u,2),p!==null&&(Jx(u,p,l,o),Jo(p,2),$r(p));break}}l=l.return}}function _0(o,l,u){var p=o.pingCache;if(p===null){p=o.pingCache=new Ij;var y=new Set;p.set(l,y)}else y=p.get(l),y===void 0&&(y=new Set,p.set(l,y));y.has(u)||(p0=!0,y.add(u),o=Fj.bind(null,o,l,u),l.then(o,o))}function Fj(o,l,u){var p=o.pingCache;p!==null&&p.delete(l),o.pingedLanes|=o.suspendedLanes&u,o.warmLanes&=~u,wt===o&&(tt&u)===u&&(Nt===4||Nt===3&&(tt&62914560)===tt&&300>Le()-mf?(ft&2)===0&&Ml(o,0):g0|=u,Rl===tt&&(Rl=0)),$r(o)}function Kw(o,l){l===0&&(l=Od()),o=oa(o,l),o!==null&&(Jo(o,l),$r(o))}function Kj(o){var l=o.memoizedState,u=0;l!==null&&(u=l.retryLane),Kw(o,u)}function Jj(o,l){var u=0;switch(o.tag){case 31:case 13:var p=o.stateNode,y=o.memoizedState;y!==null&&(u=y.retryLane);break;case 19:p=o.stateNode;break;case 22:p=o.stateNode._retryCache;break;default:throw Error(n(314))}p!==null&&p.delete(l),Kw(o,u)}function e3(o,l){return _n(o,l)}var xf=null,jl=null,x0=!1,wf=!1,w0=!1,ho=0;function $r(o){o!==jl&&o.next===null&&(jl===null?xf=jl=o:jl=jl.next=o),wf=!0,x0||(x0=!0,i3())}function _h(o,l){if(!w0&&wf){w0=!0;do for(var u=!1,p=xf;p!==null;){if(o!==0){var y=p.pendingLanes;if(y===0)var b=0;else{var C=p.suspendedLanes,A=p.pingedLanes;b=(1<<31-Yi(42|o)+1)-1,b&=y&~(C&~A),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(u=!0,ik(p,b))}else b=tt,b=sl(p,p===wt?b:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(b&3)===0||Ko(p,b)||(u=!0,ik(p,b));p=p.next}while(u);w0=!1}}function t3(){Jw()}function Jw(){wf=x0=!1;var o=0;ho!==0&&d3()&&(o=ho);for(var l=Le(),u=null,p=xf;p!==null;){var y=p.next,b=ek(p,l);b===0?(p.next=null,u===null?xf=y:u.next=y,y===null&&(jl=u)):(u=p,(o!==0||(b&3)!==0)&&(wf=!0)),p=y}ci!==0&&ci!==5||_h(o),ho!==0&&(ho=0)}function ek(o,l){for(var u=o.suspendedLanes,p=o.pingedLanes,y=o.expirationTimes,b=o.pendingLanes&-62914561;0<b;){var C=31-Yi(b),A=1<<C,Y=y[C];Y===-1?((A&u)===0||(A&p)!==0)&&(y[C]=Bm(A,l)):Y<=l&&(o.expiredLanes|=A),b&=~A}if(l=wt,u=tt,u=sl(o,o===l?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p=o.callbackNode,u===0||o===l&&(vt===2||vt===9)||o.cancelPendingCommit!==null)return p!==null&&p!==null&&ar(p),o.callbackNode=null,o.callbackPriority=0;if((u&3)===0||Ko(o,u)){if(l=u&-u,l===o.callbackPriority)return l;switch(p!==null&&ar(p),Nc(u)){case 2:case 8:u=Vi;break;case 32:u=Go;break;case 268435456:u=tl;break;default:u=Go}return p=tk.bind(null,o),u=_n(u,p),o.callbackPriority=l,o.callbackNode=u,l}return p!==null&&p!==null&&ar(p),o.callbackPriority=2,o.callbackNode=null,2}function tk(o,l){if(ci!==0&&ci!==5)return o.callbackNode=null,o.callbackPriority=0,null;var u=o.callbackNode;if(_f()&&o.callbackNode!==u)return null;var p=tt;return p=sl(o,o===wt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p===0?null:(jw(o,p,l),ek(o,Le()),o.callbackNode!=null&&o.callbackNode===u?tk.bind(null,o):null)}function ik(o,l){if(_f())return null;jw(o,l,!0)}function i3(){p3(function(){(ft&6)!==0?_n(on,t3):Jw()})}function k0(){if(ho===0){var o=bl;o===0&&(o=il,il<<=1,(il&261888)===0&&(il=256)),ho=o}return ho}function nk(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Ed(""+o)}function rk(o,l){var u=l.ownerDocument.createElement("input");return u.name=l.name,u.value=l.value,o.id&&u.setAttribute("form",o.id),l.parentNode.insertBefore(u,l),o=new FormData(o),u.parentNode.removeChild(u),o}function n3(o,l,u,p,y){if(l==="submit"&&u&&u.stateNode===y){var b=nk((y[Di]||null).action),C=p.submitter;C&&(l=(l=C[Di]||null)?nk(l.formAction):C.getAttribute("formAction"),l!==null&&(b=l,C=null));var A=new zd("action","action",null,p,y);o.push({event:A,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(ho!==0){var Y=C?rk(y,C):new FormData(y);VO(u,{pending:!0,data:Y,method:y.method,action:b},null,Y)}}else typeof b=="function"&&(A.preventDefault(),Y=C?rk(y,C):new FormData(y),VO(u,{pending:!0,data:Y,method:y.method,action:b},b,Y))},currentTarget:y}]})}}for(var C0=0;C0<lO.length;C0++){var T0=lO[C0],r3=T0.toLowerCase(),s3=T0[0].toUpperCase()+T0.slice(1);cr(r3,"on"+s3)}cr(z_,"onAnimationEnd"),cr(j_,"onAnimationIteration"),cr(D_,"onAnimationStart"),cr("dblclick","onDoubleClick"),cr("focusin","onFocus"),cr("focusout","onBlur"),cr(bj,"onTransitionRun"),cr(_j,"onTransitionStart"),cr(xj,"onTransitionCancel"),cr(B_,"onTransitionEnd"),Is("onMouseEnter",["mouseout","mouseover"]),Is("onMouseLeave",["mouseout","mouseover"]),Is("onPointerEnter",["pointerout","pointerover"]),Is("onPointerLeave",["pointerout","pointerover"]),es("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),es("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),es("onBeforeInput",["compositionend","keypress","textInput","paste"]),es("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),es("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),es("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xh="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),o3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xh));function sk(o,l){l=(l&4)!==0;for(var u=0;u<o.length;u++){var p=o[u],y=p.event;p=p.listeners;e:{var b=void 0;if(l)for(var C=p.length-1;0<=C;C--){var A=p[C],Y=A.instance,te=A.currentTarget;if(A=A.listener,Y!==b&&y.isPropagationStopped())break e;b=A,y.currentTarget=te;try{b(y)}catch(se){Bd(se)}y.currentTarget=null,b=Y}else for(C=0;C<p.length;C++){if(A=p[C],Y=A.instance,te=A.currentTarget,A=A.listener,Y!==b&&y.isPropagationStopped())break e;b=A,y.currentTarget=te;try{b(y)}catch(se){Bd(se)}y.currentTarget=null,b=Y}}}}function Je(o,l){var u=l[ol];u===void 0&&(u=l[ol]=new Set);var p=o+"__bubble";u.has(p)||(ok(l,o,2,!1),u.add(p))}function Q0(o,l,u){var p=0;l&&(p|=4),ok(u,o,p,l)}var kf="_reactListening"+Math.random().toString(36).slice(2);function $0(o){if(!o[kf]){o[kf]=!0,kd.forEach(function(u){u!=="selectionchange"&&(o3.has(u)||Q0(u,!1,o),Q0(u,!0,o))});var l=o.nodeType===9?o:o.ownerDocument;l===null||l[kf]||(l[kf]=!0,Q0("selectionchange",!1,l))}}function ok(o,l,u,p){switch(zk(l)){case 2:var y=M3;break;case 8:y=z3;break;default:y=q0}u=y.bind(null,l,u,o),y=void 0,!Um||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(y=!0),p?y!==void 0?o.addEventListener(l,u,{capture:!0,passive:y}):o.addEventListener(l,u,!0):y!==void 0?o.addEventListener(l,u,{passive:y}):o.addEventListener(l,u,!1)}function P0(o,l,u,p,y){var b=p;if((l&1)===0&&(l&2)===0&&p!==null)e:for(;;){if(p===null)return;var C=p.tag;if(C===3||C===4){var A=p.stateNode.containerInfo;if(A===y)break;if(C===4)for(C=p.return;C!==null;){var Y=C.tag;if((Y===3||Y===4)&&C.stateNode.containerInfo===y)return;C=C.return}for(;A!==null;){if(C=Zs(A),C===null)return;if(Y=C.tag,Y===5||Y===6||Y===26||Y===27){p=b=C;continue e}A=A.parentNode}}p=p.return}u_(function(){var te=b,se=Ym(u),he=[];e:{var ne=L_.get(o);if(ne!==void 0){var re=zd,we=o;switch(o){case"keypress":if(Ad(u)===0)break e;case"keydown":case"keyup":re=Jz;break;case"focusin":we="focus",re=Jm;break;case"focusout":we="blur",re=Jm;break;case"beforeblur":case"afterblur":re=Jm;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=p_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=Nz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=ij;break;case z_:case j_:case D_:re=qz;break;case B_:re=rj;break;case"scroll":case"scrollend":re=Lz;break;case"wheel":re=oj;break;case"copy":case"cut":case"paste":re=Iz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=m_;break;case"toggle":case"beforetoggle":re=lj}var ze=(l&4)!==0,_t=!ze&&(o==="scroll"||o==="scrollend"),F=ze?ne!==null?ne+"Capture":null:ne;ze=[];for(var U=te,J;U!==null;){var ae=U;if(J=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||J===null||F===null||(ae=Vc(U,F),ae!=null&&ze.push(wh(U,ae,J))),_t)break;U=U.return}0<ze.length&&(ne=new re(ne,we,null,u,se),he.push({event:ne,listeners:ze}))}}if((l&7)===0){e:{if(ne=o==="mouseover"||o==="pointerover",re=o==="mouseout"||o==="pointerout",ne&&u!==Im&&(we=u.relatedTarget||u.fromElement)&&(Zs(we)||we[Jr]))break e;if((re||ne)&&(ne=se.window===se?se:(ne=se.ownerDocument)?ne.defaultView||ne.parentWindow:window,re?(we=u.relatedTarget||u.toElement,re=te,we=we?Zs(we):null,we!==null&&(_t=s(we),ze=we.tag,we!==_t||ze!==5&&ze!==27&&ze!==6)&&(we=null)):(re=null,we=te),re!==we)){if(ze=p_,ae="onMouseLeave",F="onMouseEnter",U="mouse",(o==="pointerout"||o==="pointerover")&&(ze=m_,ae="onPointerLeave",F="onPointerEnter",U="pointer"),_t=re==null?ne:qs(re),J=we==null?ne:qs(we),ne=new ze(ae,U+"leave",re,u,se),ne.target=_t,ne.relatedTarget=J,ae=null,Zs(se)===te&&(ze=new ze(F,U+"enter",we,u,se),ze.target=J,ze.relatedTarget=_t,ae=ze),_t=ae,re&&we)t:{for(ze=a3,F=re,U=we,J=0,ae=F;ae;ae=ze(ae))J++;ae=0;for(var Ae=U;Ae;Ae=ze(Ae))ae++;for(;0<J-ae;)F=ze(F),J--;for(;0<ae-J;)U=ze(U),ae--;for(;J--;){if(F===U||U!==null&&F===U.alternate){ze=F;break t}F=ze(F),U=ze(U)}ze=null}else ze=null;re!==null&&ak(he,ne,re,ze,!1),we!==null&&_t!==null&&ak(he,_t,we,ze,!0)}}e:{if(ne=te?qs(te):window,re=ne.nodeName&&ne.nodeName.toLowerCase(),re==="select"||re==="input"&&ne.type==="file")var ht=w_;else if(__(ne))if(k_)ht=vj;else{ht=mj;var Te=gj}else re=ne.nodeName,!re||re.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Vm(te.elementType)&&(ht=w_):ht=Oj;if(ht&&(ht=ht(o,te))){x_(he,ht,u,se);break e}Te&&Te(o,ne,te),o==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&qc(ne,"number",ne.value)}switch(Te=te?qs(te):window,o){case"focusin":(__(Te)||Te.contentEditable==="true")&&(fl=Te,sO=te,Jc=null);break;case"focusout":Jc=sO=fl=null;break;case"mousedown":oO=!0;break;case"contextmenu":case"mouseup":case"dragend":oO=!1,A_(he,u,se);break;case"selectionchange":if(Sj)break;case"keydown":case"keyup":A_(he,u,se)}var He;if(tO)e:{switch(o){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else dl?S_(o,u)&&(it="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(it="onCompositionStart");it&&(O_&&u.locale!=="ko"&&(dl||it!=="onCompositionStart"?it==="onCompositionEnd"&&dl&&(He=d_()):(Hs=se,Gm="value"in Hs?Hs.value:Hs.textContent,dl=!0)),Te=Cf(te,it),0<Te.length&&(it=new g_(it,o,null,u,se),he.push({event:it,listeners:Te}),He?it.data=He:(He=b_(u),He!==null&&(it.data=He)))),(He=hj?uj(o,u):dj(o,u))&&(it=Cf(te,"onBeforeInput"),0<it.length&&(Te=new g_("onBeforeInput","beforeinput",null,u,se),he.push({event:Te,listeners:it}),Te.data=He)),n3(he,o,te,u,se)}sk(he,l)})}function wh(o,l,u){return{instance:o,listener:l,currentTarget:u}}function Cf(o,l){for(var u=l+"Capture",p=[];o!==null;){var y=o,b=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||b===null||(y=Vc(o,u),y!=null&&p.unshift(wh(o,y,b)),y=Vc(o,l),y!=null&&p.push(wh(o,y,b))),o.tag===3)return p;o=o.return}return[]}function a3(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function ak(o,l,u,p,y){for(var b=l._reactName,C=[];u!==null&&u!==p;){var A=u,Y=A.alternate,te=A.stateNode;if(A=A.tag,Y!==null&&Y===p)break;A!==5&&A!==26&&A!==27||te===null||(Y=te,y?(te=Vc(u,b),te!=null&&C.unshift(wh(u,te,Y))):y||(te=Vc(u,b),te!=null&&C.push(wh(u,te,Y)))),u=u.return}C.length!==0&&o.push({event:l,listeners:C})}var l3=/\r\n?/g,c3=/\u0000|\uFFFD/g;function lk(o){return(typeof o=="string"?o:""+o).replace(l3,`
49
- `).replace(c3,"")}function ck(o,l){return l=lk(l),lk(o)===l}function bt(o,l,u,p,y,b){switch(u){case"children":typeof p=="string"?l==="body"||l==="textarea"&&p===""||cl(o,p):(typeof p=="number"||typeof p=="bigint")&&l!=="body"&&cl(o,""+p);break;case"className":ll(o,"class",p);break;case"tabIndex":ll(o,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":ll(o,u,p);break;case"style":c_(o,p,b);break;case"data":if(l!=="object"){ll(o,"data",p);break}case"src":case"href":if(p===""&&(l!=="a"||u!=="href")){o.removeAttribute(u);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(u);break}p=Ed(""+p),o.setAttribute(u,p);break;case"action":case"formAction":if(typeof p=="function"){o.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof b=="function"&&(u==="formAction"?(l!=="input"&&bt(o,l,"name",y.name,y,null),bt(o,l,"formEncType",y.formEncType,y,null),bt(o,l,"formMethod",y.formMethod,y,null),bt(o,l,"formTarget",y.formTarget,y,null)):(bt(o,l,"encType",y.encType,y,null),bt(o,l,"method",y.method,y,null),bt(o,l,"target",y.target,y,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(u);break}p=Ed(""+p),o.setAttribute(u,p);break;case"onClick":p!=null&&(o.onclick=is);break;case"onScroll":p!=null&&Je("scroll",o);break;case"onScrollEnd":p!=null&&Je("scrollend",o);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(n(61));if(u=p.__html,u!=null){if(y.children!=null)throw Error(n(60));o.innerHTML=u}}break;case"multiple":o.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":o.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){o.removeAttribute("xlink:href");break}u=Ed(""+p),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(u,""+p):o.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(u,""):o.removeAttribute(u);break;case"capture":case"download":p===!0?o.setAttribute(u,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(u,p):o.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?o.setAttribute(u,p):o.removeAttribute(u);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?o.removeAttribute(u):o.setAttribute(u,p);break;case"popover":Je("beforetoggle",o),Je("toggle",o),al(o,"popover",p);break;case"xlinkActuate":lr(o,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":lr(o,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":lr(o,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":lr(o,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":lr(o,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":lr(o,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":lr(o,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":lr(o,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":lr(o,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":al(o,"is",p);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=Dz.get(u)||u,al(o,u,p))}}function E0(o,l,u,p,y,b){switch(u){case"style":c_(o,p,b);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(n(61));if(u=p.__html,u!=null){if(y.children!=null)throw Error(n(60));o.innerHTML=u}}break;case"children":typeof p=="string"?cl(o,p):(typeof p=="number"||typeof p=="bigint")&&cl(o,""+p);break;case"onScroll":p!=null&&Je("scroll",o);break;case"onScrollEnd":p!=null&&Je("scrollend",o);break;case"onClick":p!=null&&(o.onclick=is);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Cd.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),l=u.slice(2,y?u.length-7:void 0),b=o[Di]||null,b=b!=null?b[u]:null,typeof b=="function"&&o.removeEventListener(l,b,y),typeof p=="function")){typeof b!="function"&&b!==null&&(u in o?o[u]=null:o.hasAttribute(u)&&o.removeAttribute(u)),o.addEventListener(l,p,y);break e}u in o?o[u]=p:p===!0?o.setAttribute(u,""):al(o,u,p)}}}function Qi(o,l,u){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",o),Je("load",o);var p=!1,y=!1,b;for(b in u)if(u.hasOwnProperty(b)){var C=u[b];if(C!=null)switch(b){case"src":p=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:bt(o,l,b,C,u,null)}}y&&bt(o,l,"srcSet",u.srcSet,u,null),p&&bt(o,l,"src",u.src,u,null);return;case"input":Je("invalid",o);var A=b=C=y=null,Y=null,te=null;for(p in u)if(u.hasOwnProperty(p)){var se=u[p];if(se!=null)switch(p){case"name":y=se;break;case"type":C=se;break;case"checked":Y=se;break;case"defaultChecked":te=se;break;case"value":b=se;break;case"defaultValue":A=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(n(137,l));break;default:bt(o,l,p,se,u,null)}}Pd(o,b,A,Y,te,C,y,!1);return;case"select":Je("invalid",o),p=C=b=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":b=A;break;case"defaultValue":C=A;break;case"multiple":p=A;default:bt(o,l,y,A,u,null)}l=b,u=C,o.multiple=!!p,l!=null?ts(o,!!p,l,!1):u!=null&&ts(o,!!p,u,!0);return;case"textarea":Je("invalid",o),b=y=p=null;for(C in u)if(u.hasOwnProperty(C)&&(A=u[C],A!=null))switch(C){case"value":p=A;break;case"defaultValue":y=A;break;case"children":b=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(n(91));break;default:bt(o,l,C,A,u,null)}a_(o,p,y,b);return;case"option":for(Y in u)if(u.hasOwnProperty(Y)&&(p=u[Y],p!=null))switch(Y){case"selected":o.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:bt(o,l,Y,p,u,null)}return;case"dialog":Je("beforetoggle",o),Je("toggle",o),Je("cancel",o),Je("close",o);break;case"iframe":case"object":Je("load",o);break;case"video":case"audio":for(p=0;p<xh.length;p++)Je(xh[p],o);break;case"image":Je("error",o),Je("load",o);break;case"details":Je("toggle",o);break;case"embed":case"source":case"link":Je("error",o),Je("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in u)if(u.hasOwnProperty(te)&&(p=u[te],p!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:bt(o,l,te,p,u,null)}return;default:if(Vm(l)){for(se in u)u.hasOwnProperty(se)&&(p=u[se],p!==void 0&&E0(o,l,se,p,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(p=u[A],p!=null&&bt(o,l,A,p,u,null))}function h3(o,l,u,p){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,b=null,C=null,A=null,Y=null,te=null,se=null;for(re in u){var he=u[re];if(u.hasOwnProperty(re)&&he!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":Y=he;default:p.hasOwnProperty(re)||bt(o,l,re,null,p,he)}}for(var ne in p){var re=p[ne];if(he=u[ne],p.hasOwnProperty(ne)&&(re!=null||he!=null))switch(ne){case"type":b=re;break;case"name":y=re;break;case"checked":te=re;break;case"defaultChecked":se=re;break;case"value":C=re;break;case"defaultValue":A=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(n(137,l));break;default:re!==he&&bt(o,l,ne,re,p,he)}}ia(o,C,A,Y,te,se,b,y);return;case"select":re=C=A=ne=null;for(b in u)if(Y=u[b],u.hasOwnProperty(b)&&Y!=null)switch(b){case"value":break;case"multiple":re=Y;default:p.hasOwnProperty(b)||bt(o,l,b,null,p,Y)}for(y in p)if(b=p[y],Y=u[y],p.hasOwnProperty(y)&&(b!=null||Y!=null))switch(y){case"value":ne=b;break;case"defaultValue":A=b;break;case"multiple":C=b;default:b!==Y&&bt(o,l,y,b,p,Y)}l=A,u=C,p=re,ne!=null?ts(o,!!u,ne,!1):!!p!=!!u&&(l!=null?ts(o,!!u,l,!0):ts(o,!!u,u?[]:"",!1));return;case"textarea":re=ne=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!p.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:bt(o,l,A,null,p,y)}for(C in p)if(y=p[C],b=u[C],p.hasOwnProperty(C)&&(y!=null||b!=null))switch(C){case"value":ne=y;break;case"defaultValue":re=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(n(91));break;default:y!==b&&bt(o,l,C,y,p,b)}o_(o,ne,re);return;case"option":for(var we in u)if(ne=u[we],u.hasOwnProperty(we)&&ne!=null&&!p.hasOwnProperty(we))switch(we){case"selected":o.selected=!1;break;default:bt(o,l,we,null,p,ne)}for(Y in p)if(ne=p[Y],re=u[Y],p.hasOwnProperty(Y)&&ne!==re&&(ne!=null||re!=null))switch(Y){case"selected":o.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:bt(o,l,Y,ne,p,re)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ze in u)ne=u[ze],u.hasOwnProperty(ze)&&ne!=null&&!p.hasOwnProperty(ze)&&bt(o,l,ze,null,p,ne);for(te in p)if(ne=p[te],re=u[te],p.hasOwnProperty(te)&&ne!==re&&(ne!=null||re!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(n(137,l));break;default:bt(o,l,te,ne,p,re)}return;default:if(Vm(l)){for(var _t in u)ne=u[_t],u.hasOwnProperty(_t)&&ne!==void 0&&!p.hasOwnProperty(_t)&&E0(o,l,_t,void 0,p,ne);for(se in p)ne=p[se],re=u[se],!p.hasOwnProperty(se)||ne===re||ne===void 0&&re===void 0||E0(o,l,se,ne,p,re);return}}for(var F in u)ne=u[F],u.hasOwnProperty(F)&&ne!=null&&!p.hasOwnProperty(F)&&bt(o,l,F,null,p,ne);for(he in p)ne=p[he],re=u[he],!p.hasOwnProperty(he)||ne===re||ne==null&&re==null||bt(o,l,he,ne,p,re)}function hk(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function u3(){if(typeof performance.getEntriesByType=="function"){for(var o=0,l=0,u=performance.getEntriesByType("resource"),p=0;p<u.length;p++){var y=u[p],b=y.transferSize,C=y.initiatorType,A=y.duration;if(b&&A&&hk(C)){for(C=0,A=y.responseEnd,p+=1;p<u.length;p++){var Y=u[p],te=Y.startTime;if(te>A)break;var se=Y.transferSize,he=Y.initiatorType;se&&hk(he)&&(Y=Y.responseEnd,C+=se*(Y<A?1:(A-te)/(Y-te)))}if(--p,l+=8*(b+C)/(y.duration/1e3),o++,10<o)break}}if(0<o)return l/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var R0=null,A0=null;function Tf(o){return o.nodeType===9?o:o.ownerDocument}function uk(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function dk(o,l){if(o===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&l==="foreignObject"?0:o}function M0(o,l){return o==="textarea"||o==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var z0=null;function d3(){var o=window.event;return o&&o.type==="popstate"?o===z0?!1:(z0=o,!0):(z0=null,!1)}var fk=typeof setTimeout=="function"?setTimeout:void 0,f3=typeof clearTimeout=="function"?clearTimeout:void 0,pk=typeof Promise=="function"?Promise:void 0,p3=typeof queueMicrotask=="function"?queueMicrotask:typeof pk<"u"?function(o){return pk.resolve(null).then(o).catch(g3)}:fk;function g3(o){setTimeout(function(){throw o})}function uo(o){return o==="head"}function gk(o,l){var u=l,p=0;do{var y=u.nextSibling;if(o.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(p===0){o.removeChild(y),Xl(l);return}p--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")p++;else if(u==="html")kh(o.ownerDocument.documentElement);else if(u==="head"){u=o.ownerDocument.head,kh(u);for(var b=u.firstChild;b;){var C=b.nextSibling,A=b.nodeName;b[ea]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&b.rel.toLowerCase()==="stylesheet"||u.removeChild(b),b=C}}else u==="body"&&kh(o.ownerDocument.body);u=y}while(u);Xl(l)}function mk(o,l){var u=o;o=0;do{var p=u.nextSibling;if(u.nodeType===1?l?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(l?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),p&&p.nodeType===8)if(u=p.data,u==="/$"){if(o===0)break;o--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||o++;u=p}while(u)}function j0(o){var l=o.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var u=l;switch(l=l.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":j0(u),Zc(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}o.removeChild(u)}}function m3(o,l,u,p){for(;o.nodeType===1;){var y=u;if(o.nodeName.toLowerCase()!==l.toLowerCase()){if(!p&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(p){if(!o[ea])switch(l){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(b=o.getAttribute("rel"),b==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(b!==y.rel||o.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||o.getAttribute("title")!==(y.title==null?null:y.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(b=o.getAttribute("src"),(b!==(y.src==null?null:y.src)||o.getAttribute("type")!==(y.type==null?null:y.type)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&b&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(l==="input"&&o.type==="hidden"){var b=y.name==null?null:""+y.name;if(y.type==="hidden"&&o.getAttribute("name")===b)return o}else return o;if(o=Hn(o.nextSibling),o===null)break}return null}function O3(o,l,u){if(l==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=Hn(o.nextSibling),o===null))return null;return o}function Ok(o,l){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!l||(o=Hn(o.nextSibling),o===null))return null;return o}function D0(o){return o.data==="$?"||o.data==="$~"}function B0(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function v3(o,l){var u=o.ownerDocument;if(o.data==="$~")o._reactRetry=l;else if(o.data!=="$?"||u.readyState!=="loading")l();else{var p=function(){l(),u.removeEventListener("DOMContentLoaded",p)};u.addEventListener("DOMContentLoaded",p),o._reactRetry=p}}function Hn(o){for(;o!=null;o=o.nextSibling){var l=o.nodeType;if(l===1||l===3)break;if(l===8){if(l=o.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return o}var L0=null;function vk(o){o=o.nextSibling;for(var l=0;o;){if(o.nodeType===8){var u=o.data;if(u==="/$"||u==="/&"){if(l===0)return Hn(o.nextSibling);l--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||l++}o=o.nextSibling}return null}function yk(o){o=o.previousSibling;for(var l=0;o;){if(o.nodeType===8){var u=o.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(l===0)return o;l--}else u!=="/$"&&u!=="/&"||l++}o=o.previousSibling}return null}function Sk(o,l,u){switch(l=Tf(u),o){case"html":if(o=l.documentElement,!o)throw Error(n(452));return o;case"head":if(o=l.head,!o)throw Error(n(453));return o;case"body":if(o=l.body,!o)throw Error(n(454));return o;default:throw Error(n(451))}}function kh(o){for(var l=o.attributes;l.length;)o.removeAttributeNode(l[0]);Zc(o)}var Un=new Map,bk=new Set;function Qf(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var vs=Z.d;Z.d={f:y3,r:S3,D:b3,C:_3,L:x3,m:w3,X:C3,S:k3,M:T3};function y3(){var o=vs.f(),l=yf();return o||l}function S3(o){var l=Ws(o);l!==null&&l.tag===5&&l.type==="form"?Bx(l):vs.r(o)}var Dl=typeof document>"u"?null:document;function _k(o,l,u){var p=Dl;if(p&&typeof l=="string"&&l){var y=ln(l);y='link[rel="'+o+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),bk.has(y)||(bk.add(y),o={rel:o,crossOrigin:u,href:l},p.querySelector(y)===null&&(l=p.createElement("link"),Qi(l,"link",o),Kt(l),p.head.appendChild(l)))}}function b3(o){vs.D(o),_k("dns-prefetch",o,null)}function _3(o,l){vs.C(o,l),_k("preconnect",o,l)}function x3(o,l,u){vs.L(o,l,u);var p=Dl;if(p&&o&&l){var y='link[rel="preload"][as="'+ln(l)+'"]';l==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+ln(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+ln(u.imageSizes)+'"]')):y+='[href="'+ln(o)+'"]';var b=y;switch(l){case"style":b=Bl(o);break;case"script":b=Ll(o)}Un.has(b)||(o=g({rel:"preload",href:l==="image"&&u&&u.imageSrcSet?void 0:o,as:l},u),Un.set(b,o),p.querySelector(y)!==null||l==="style"&&p.querySelector(Ch(b))||l==="script"&&p.querySelector(Th(b))||(l=p.createElement("link"),Qi(l,"link",o),Kt(l),p.head.appendChild(l)))}}function w3(o,l){vs.m(o,l);var u=Dl;if(u&&o){var p=l&&typeof l.as=="string"?l.as:"script",y='link[rel="modulepreload"][as="'+ln(p)+'"][href="'+ln(o)+'"]',b=y;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Ll(o)}if(!Un.has(b)&&(o=g({rel:"modulepreload",href:o},l),Un.set(b,o),u.querySelector(y)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Th(b)))return}p=u.createElement("link"),Qi(p,"link",o),Kt(p),u.head.appendChild(p)}}}function k3(o,l,u){vs.S(o,l,u);var p=Dl;if(p&&o){var y=Vs(p).hoistableStyles,b=Bl(o);l=l||"default";var C=y.get(b);if(!C){var A={loading:0,preload:null};if(C=p.querySelector(Ch(b)))A.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":l},u),(u=Un.get(b))&&X0(o,u);var Y=C=p.createElement("link");Kt(Y),Qi(Y,"link",o),Y._p=new Promise(function(te,se){Y.onload=te,Y.onerror=se}),Y.addEventListener("load",function(){A.loading|=1}),Y.addEventListener("error",function(){A.loading|=2}),A.loading|=4,$f(C,l,p)}C={type:"stylesheet",instance:C,count:1,state:A},y.set(b,C)}}}function C3(o,l){vs.X(o,l);var u=Dl;if(u&&o){var p=Vs(u).hoistableScripts,y=Ll(o),b=p.get(y);b||(b=u.querySelector(Th(y)),b||(o=g({src:o,async:!0},l),(l=Un.get(y))&&N0(o,l),b=u.createElement("script"),Kt(b),Qi(b,"link",o),u.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},p.set(y,b))}}function T3(o,l){vs.M(o,l);var u=Dl;if(u&&o){var p=Vs(u).hoistableScripts,y=Ll(o),b=p.get(y);b||(b=u.querySelector(Th(y)),b||(o=g({src:o,async:!0,type:"module"},l),(l=Un.get(y))&&N0(o,l),b=u.createElement("script"),Kt(b),Qi(b,"link",o),u.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},p.set(y,b))}}function xk(o,l,u,p){var y=(y=de.current)?Qf(y):null;if(!y)throw Error(n(446));switch(o){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(l=Bl(u.href),u=Vs(y).hoistableStyles,p=u.get(l),p||(p={type:"style",instance:null,count:0,state:null},u.set(l,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){o=Bl(u.href);var b=Vs(y).hoistableStyles,C=b.get(o);if(C||(y=y.ownerDocument||y,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(o,C),(b=y.querySelector(Ch(o)))&&!b._p&&(C.instance=b,C.state.loading=5),Un.has(o)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Un.set(o,u),b||Q3(y,o,u,C.state))),l&&p===null)throw Error(n(528,""));return C}if(l&&p!==null)throw Error(n(529,""));return null;case"script":return l=u.async,u=u.src,typeof u=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Ll(u),u=Vs(y).hoistableScripts,p=u.get(l),p||(p={type:"script",instance:null,count:0,state:null},u.set(l,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,o))}}function Bl(o){return'href="'+ln(o)+'"'}function Ch(o){return'link[rel="stylesheet"]['+o+"]"}function wk(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function Q3(o,l,u,p){o.querySelector('link[rel="preload"][as="style"]['+l+"]")?p.loading=1:(l=o.createElement("link"),p.preload=l,l.addEventListener("load",function(){return p.loading|=1}),l.addEventListener("error",function(){return p.loading|=2}),Qi(l,"link",u),Kt(l),o.head.appendChild(l))}function Ll(o){return'[src="'+ln(o)+'"]'}function Th(o){return"script[async]"+o}function kk(o,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var p=o.querySelector('style[data-href~="'+ln(u.href)+'"]');if(p)return l.instance=p,Kt(p),p;var y=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return p=(o.ownerDocument||o).createElement("style"),Kt(p),Qi(p,"style",y),$f(p,u.precedence,o),l.instance=p;case"stylesheet":y=Bl(u.href);var b=o.querySelector(Ch(y));if(b)return l.state.loading|=4,l.instance=b,Kt(b),b;p=wk(u),(y=Un.get(y))&&X0(p,y),b=(o.ownerDocument||o).createElement("link"),Kt(b);var C=b;return C._p=new Promise(function(A,Y){C.onload=A,C.onerror=Y}),Qi(b,"link",p),l.state.loading|=4,$f(b,u.precedence,o),l.instance=b;case"script":return b=Ll(u.src),(y=o.querySelector(Th(b)))?(l.instance=y,Kt(y),y):(p=u,(y=Un.get(b))&&(p=g({},u),N0(p,y)),o=o.ownerDocument||o,y=o.createElement("script"),Kt(y),Qi(y,"link",p),o.head.appendChild(y),l.instance=y);case"void":return null;default:throw Error(n(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(p=l.instance,l.state.loading|=4,$f(p,u.precedence,o));return l.instance}function $f(o,l,u){for(var p=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=p.length?p[p.length-1]:null,b=y,C=0;C<p.length;C++){var A=p[C];if(A.dataset.precedence===l)b=A;else if(b!==y)break}b?b.parentNode.insertBefore(o,b.nextSibling):(l=u.nodeType===9?u.head:u,l.insertBefore(o,l.firstChild))}function X0(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.title==null&&(o.title=l.title)}function N0(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.integrity==null&&(o.integrity=l.integrity)}var Pf=null;function Ck(o,l,u){if(Pf===null){var p=new Map,y=Pf=new Map;y.set(u,p)}else y=Pf,p=y.get(u),p||(p=new Map,y.set(u,p));if(p.has(o))return p;for(p.set(o,null),u=u.getElementsByTagName(o),y=0;y<u.length;y++){var b=u[y];if(!(b[ea]||b[li]||o==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var C=b.getAttribute(l)||"";C=o+C;var A=p.get(C);A?A.push(b):p.set(C,[b])}}return p}function Tk(o,l,u){o=o.ownerDocument||o,o.head.insertBefore(u,l==="title"?o.querySelector("head > title"):null)}function $3(o,l,u){if(u===1||l.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return o=l.disabled,typeof l.precedence=="string"&&o==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function Qk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function P3(o,l,u,p){if(u.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Bl(p.href),b=l.querySelector(Ch(y));if(b){l=b._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(o.count++,o=Ef.bind(o),l.then(o,o)),u.state.loading|=4,u.instance=b,Kt(b);return}b=l.ownerDocument||l,p=wk(p),(y=Un.get(y))&&X0(p,y),b=b.createElement("link"),Kt(b);var C=b;C._p=new Promise(function(A,Y){C.onload=A,C.onerror=Y}),Qi(b,"link",p),u.instance=b}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(u,l),(l=u.state.preload)&&(u.state.loading&3)===0&&(o.count++,u=Ef.bind(o),l.addEventListener("load",u),l.addEventListener("error",u))}}var Z0=0;function E3(o,l){return o.stylesheets&&o.count===0&&Af(o,o.stylesheets),0<o.count||0<o.imgCount?function(u){var p=setTimeout(function(){if(o.stylesheets&&Af(o,o.stylesheets),o.unsuspend){var b=o.unsuspend;o.unsuspend=null,b()}},6e4+l);0<o.imgBytes&&Z0===0&&(Z0=62500*u3());var y=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Af(o,o.stylesheets),o.unsuspend)){var b=o.unsuspend;o.unsuspend=null,b()}},(o.imgBytes>Z0?50:800)+l);return o.unsuspend=u,function(){o.unsuspend=null,clearTimeout(p),clearTimeout(y)}}:null}function Ef(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Af(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Rf=null;function Af(o,l){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Rf=new Map,l.forEach(R3,o),Rf=null,Ef.call(o))}function R3(o,l){if(!(l.state.loading&4)){var u=Rf.get(o);if(u)var p=u.get(null);else{u=new Map,Rf.set(o,u);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<y.length;b++){var C=y[b];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(u.set(C.dataset.precedence,C),p=C)}p&&u.set(null,p)}y=l.instance,C=y.getAttribute("data-precedence"),b=u.get(C)||p,b===p&&u.set(null,y),u.set(C,y),this.count++,p=Ef.bind(this),y.addEventListener("load",p),y.addEventListener("error",p),b?b.parentNode.insertBefore(y,b.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(y,o.firstChild)),l.state.loading|=4}}var Qh={$$typeof:k,Provider:null,Consumer:null,_currentValue:L,_currentValue2:L,_threadCount:0};function A3(o,l,u,p,y,b,C,A,Y){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Lc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lc(0),this.hiddenUpdates=Lc(null),this.identifierPrefix=p,this.onUncaughtError=y,this.onCaughtError=b,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function $k(o,l,u,p,y,b,C,A,Y,te,se,he){return o=new A3(o,l,u,C,Y,te,se,he,A),l=1,b===!0&&(l|=24),b=wn(3,null,null,l),o.current=b,b.stateNode=o,l=bO(),l.refCount++,o.pooledCache=l,l.refCount++,b.memoizedState={element:p,isDehydrated:u,cache:l},kO(b),o}function Pk(o){return o?(o=ml,o):ml}function Ek(o,l,u,p,y,b){y=Pk(y),p.context===null?p.context=y:p.pendingContext=y,p=eo(l),p.payload={element:u},b=b===void 0?null:b,b!==null&&(p.callback=b),u=to(o,p,l),u!==null&&(pn(u,o,l),oh(u,o,l))}function Rk(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<l?u:l}}function W0(o,l){Rk(o,l),(o=o.alternate)&&Rk(o,l)}function Ak(o){if(o.tag===13||o.tag===31){var l=oa(o,67108864);l!==null&&pn(l,o,67108864),W0(o,67108864)}}function Mk(o){if(o.tag===13||o.tag===31){var l=$n();l=Xc(l);var u=oa(o,l);u!==null&&pn(u,o,l),W0(o,l)}}var Mf=!0;function M3(o,l,u,p){var y=P.T;P.T=null;var b=Z.p;try{Z.p=2,q0(o,l,u,p)}finally{Z.p=b,P.T=y}}function z3(o,l,u,p){var y=P.T;P.T=null;var b=Z.p;try{Z.p=8,q0(o,l,u,p)}finally{Z.p=b,P.T=y}}function q0(o,l,u,p){if(Mf){var y=V0(p);if(y===null)P0(o,l,p,zf,u),jk(o,p);else if(D3(y,o,l,u,p))p.stopPropagation();else if(jk(o,p),l&4&&-1<j3.indexOf(o)){for(;y!==null;){var b=Ws(y);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var C=Kr(b.pendingLanes);if(C!==0){var A=b;for(A.pendingLanes|=2,A.entangledLanes|=2;C;){var Y=1<<31-Yi(C);A.entanglements[1]|=Y,C&=~Y}$r(b),(ft&6)===0&&(Of=Le()+500,_h(0))}}break;case 31:case 13:A=oa(b,2),A!==null&&pn(A,b,2),yf(),W0(b,2)}if(b=V0(p),b===null&&P0(o,l,p,zf,u),b===y)break;y=b}y!==null&&p.stopPropagation()}else P0(o,l,p,null,u)}}function V0(o){return o=Ym(o),I0(o)}var zf=null;function I0(o){if(zf=null,o=Zs(o),o!==null){var l=s(o);if(l===null)o=null;else{var u=l.tag;if(u===13){if(o=a(l),o!==null)return o;o=null}else if(u===31){if(o=c(l),o!==null)return o;o=null}else if(u===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;o=null}else l!==o&&(o=null)}}return zf=o,null}function zk(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(sn()){case on:return 2;case Vi:return 8;case Go:case Rm:return 32;case tl:return 268435456;default:return 32}default:return 32}}var Y0=!1,fo=null,po=null,go=null,$h=new Map,Ph=new Map,mo=[],j3="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function jk(o,l){switch(o){case"focusin":case"focusout":fo=null;break;case"dragenter":case"dragleave":po=null;break;case"mouseover":case"mouseout":go=null;break;case"pointerover":case"pointerout":$h.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ph.delete(l.pointerId)}}function Eh(o,l,u,p,y,b){return o===null||o.nativeEvent!==b?(o={blockedOn:l,domEventName:u,eventSystemFlags:p,nativeEvent:b,targetContainers:[y]},l!==null&&(l=Ws(l),l!==null&&Ak(l)),o):(o.eventSystemFlags|=p,l=o.targetContainers,y!==null&&l.indexOf(y)===-1&&l.push(y),o)}function D3(o,l,u,p,y){switch(l){case"focusin":return fo=Eh(fo,o,l,u,p,y),!0;case"dragenter":return po=Eh(po,o,l,u,p,y),!0;case"mouseover":return go=Eh(go,o,l,u,p,y),!0;case"pointerover":var b=y.pointerId;return $h.set(b,Eh($h.get(b)||null,o,l,u,p,y)),!0;case"gotpointercapture":return b=y.pointerId,Ph.set(b,Eh(Ph.get(b)||null,o,l,u,p,y)),!0}return!1}function Dk(o){var l=Zs(o.target);if(l!==null){var u=s(l);if(u!==null){if(l=u.tag,l===13){if(l=a(u),l!==null){o.blockedOn=l,_d(o.priority,function(){Mk(u)});return}}else if(l===31){if(l=c(u),l!==null){o.blockedOn=l,_d(o.priority,function(){Mk(u)});return}}else if(l===3&&u.stateNode.current.memoizedState.isDehydrated){o.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}o.blockedOn=null}function jf(o){if(o.blockedOn!==null)return!1;for(var l=o.targetContainers;0<l.length;){var u=V0(o.nativeEvent);if(u===null){u=o.nativeEvent;var p=new u.constructor(u.type,u);Im=p,u.target.dispatchEvent(p),Im=null}else return l=Ws(u),l!==null&&Ak(l),o.blockedOn=u,!1;l.shift()}return!0}function Bk(o,l,u){jf(o)&&u.delete(l)}function B3(){Y0=!1,fo!==null&&jf(fo)&&(fo=null),po!==null&&jf(po)&&(po=null),go!==null&&jf(go)&&(go=null),$h.forEach(Bk),Ph.forEach(Bk)}function Df(o,l){o.blockedOn===l&&(o.blockedOn=null,Y0||(Y0=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,B3)))}var Bf=null;function Lk(o){Bf!==o&&(Bf=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bf===o&&(Bf=null);for(var l=0;l<o.length;l+=3){var u=o[l],p=o[l+1],y=o[l+2];if(typeof p!="function"){if(I0(p||u)===null)continue;break}var b=Ws(u);b!==null&&(o.splice(l,3),l-=3,VO(b,{pending:!0,data:y,method:u.method,action:p},p,y))}}))}function Xl(o){function l(Y){return Df(Y,o)}fo!==null&&Df(fo,o),po!==null&&Df(po,o),go!==null&&Df(go,o),$h.forEach(l),Ph.forEach(l);for(var u=0;u<mo.length;u++){var p=mo[u];p.blockedOn===o&&(p.blockedOn=null)}for(;0<mo.length&&(u=mo[0],u.blockedOn===null);)Dk(u),u.blockedOn===null&&mo.shift();if(u=(o.ownerDocument||o).$$reactFormReplay,u!=null)for(p=0;p<u.length;p+=3){var y=u[p],b=u[p+1],C=y[Di]||null;if(typeof b=="function")C||Lk(u);else if(C){var A=null;if(b&&b.hasAttribute("formAction")){if(y=b,C=b[Di]||null)A=C.formAction;else if(I0(y)!==null)continue}else A=C.action;typeof A=="function"?u[p+1]=A:(u.splice(p,3),p-=3),Lk(u)}}}function Xk(){function o(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(C){return y=C})},focusReset:"manual",scroll:"manual"})}function l(){y!==null&&(y(),y=null),p||setTimeout(u,20)}function u(){if(!p&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,y=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(u,100),function(){p=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),y!==null&&(y(),y=null)}}}function H0(o){this._internalRoot=o}Lf.prototype.render=H0.prototype.render=function(o){var l=this._internalRoot;if(l===null)throw Error(n(409));var u=l.current,p=$n();Ek(u,p,o,l,null,null)},Lf.prototype.unmount=H0.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var l=o.containerInfo;Ek(o.current,2,null,o,null,null),yf(),l[Jr]=null}};function Lf(o){this._internalRoot=o}Lf.prototype.unstable_scheduleHydration=function(o){if(o){var l=bd();o={blockedOn:null,target:o,priority:l};for(var u=0;u<mo.length&&l!==0&&l<mo[u].priority;u++);mo.splice(u,0,o),u===0&&Dk(o)}};var Nk=e.version;if(Nk!=="19.2.4")throw Error(n(527,Nk,"19.2.4"));Z.findDOMNode=function(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=d(l),o=o!==null?f(o):null,o=o===null?null:o.stateNode,o};var L3={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xf.isDisabled&&Xf.supportsFiber)try{Fo=Xf.inject(L3),Ii=Xf}catch{}}return Ah.createRoot=function(o,l){if(!r(o))throw Error(n(299));var u=!1,p="",y=Hx,b=Ux,C=Gx;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(p=l.identifierPrefix),l.onUncaughtError!==void 0&&(y=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError)),l=$k(o,1,!1,null,null,u,p,null,y,b,C,Xk),o[Jr]=l.current,$0(o),new H0(l)},Ah.hydrateRoot=function(o,l,u){if(!r(o))throw Error(n(299));var p=!1,y="",b=Hx,C=Ux,A=Gx,Y=null;return u!=null&&(u.unstable_strictMode===!0&&(p=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(b=u.onUncaughtError),u.onCaughtError!==void 0&&(C=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(Y=u.formState)),l=$k(o,1,!0,l,u??null,p,y,Y,b,C,A,Xk),l.context=Pk(null),u=l.current,p=$n(),p=Xc(p),y=eo(p),y.callback=null,to(u,y,p),u=p,l.current.lanes=u,Jo(l,u),$r(l),o[Jr]=l.current,$0(o),new Lf(l)},Ah.version="19.2.4",Ah}var Fk;function H3(){if(Fk)return F0.exports;Fk=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),F0.exports=Y3(),F0.exports}var U3=H3();const Kk=t=>{let e;const i=new Set,n=(d,f)=>{const g=typeof d=="function"?d(e):d;if(!Object.is(g,e)){const m=e;e=f??(typeof g!="object"||g===null)?g:Object.assign({},e,g),i.forEach(O=>O(e,m))}},r=()=>e,c={setState:n,getState:r,getInitialState:()=>h,subscribe:d=>(i.add(d),()=>i.delete(d))},h=e=t(n,r,c);return c},G3=(t=>t?Kk(t):Kk),F3=t=>t;function K3(t,e=F3){const i=Ul.useSyncExternalStore(t.subscribe,Ul.useCallback(()=>e(t.getState()),[t,e]),Ul.useCallback(()=>e(t.getInitialState()),[t,e]));return Ul.useDebugValue(i),i}const Jk=t=>{const e=G3(t),i=n=>K3(e,n);return Object.assign(i,e),i},J3=(t=>t?Jk(t):Jk),eD=`ws://${window.location.hostname}:${window.location.port||31415}`,Ui="",Ce=J3((t,e)=>({agents:[],connected:!1,ws:null,daemonHost:null,tunneled:!1,activeTab:"agents",detailPanel:null,activityLog:{},statusMessage:null,commandHistory:[],chatHistory:{},tokenTimeline:{},dashTelemetry:{},editorFiles:{},editorActiveFile:null,editorOpenTabs:[],editorTreeCache:{},editorChangedFiles:{},editorRecentSaves:{},connect(){if(e().ws)return;const i=new WebSocket(eD);i.onopen=()=>{t({connected:!0,ws:i}),fetch(`${Ui}/api/status`).then(n=>n.json()).then(n=>{const r={};n.host&&n.host!=="127.0.0.1"&&(r.daemonHost=n.host);const s=window.location.port||"80";String(n.port)!==s&&(r.tunneled=!0),Object.keys(r).length>0&&t(r)}).catch(()=>{})},i.onmessage=n=>{const r=JSON.parse(n.data);switch(r.type){case"state":{const s={...e().tokenTimeline},a=Date.now();for(const c of r.data){s[c.id]||(s[c.id]=[]);const h=s[c.id],d=h[h.length-1];(!d||c.tokensUsed!==d.v||a-d.t>5e3)&&(h.push({t:a,v:c.tokensUsed||0}),h.length>200&&(s[c.id]=h.slice(-200)))}t({agents:r.data,tokenTimeline:s});break}case"agent:output":{const{agentId:s,data:a}=r,c={...e().activityLog};c[s]||(c[s]=[]),c[s]=[...c[s].slice(-200),{timestamp:Date.now(),text:typeof a.data=="string"?a.data:JSON.stringify(a.data),type:a.type}],t({activityLog:c});break}case"agent:exit":{const s=e().agents.find(h=>h.id===r.agentId),a=(s==null?void 0:s.name)||r.agentId,c=r.status==="completed"?`${a} completed`:r.status==="killed"?`${a} killed`:`${a} crashed (exit ${r.code})`;e().showStatus(c);break}case"rotation:start":e().showStatus(`rotating ${r.agentName}...`);break;case"rotation:complete":{e().showStatus(`rotated ${r.agentName} (saved ${r.tokensSaved} tokens)`);const s=e().detailPanel;(s==null?void 0:s.type)==="agent"&&s.agentId===r.oldAgentId&&r.newAgentId&&t(a=>{const c={...a.chatHistory},h={...a.tokenTimeline},d=c[r.oldAgentId]||[],f=h[r.oldAgentId]||[];return d.length>0&&(c[r.newAgentId]=[...d]),f.length>0&&(h[r.newAgentId]=[...f]),{chatHistory:c,tokenTimeline:h,detailPanel:{type:"agent",agentId:r.newAgentId}}});break}case"rotation:failed":e().showStatus(`rotation failed: ${r.error}`);break;case"file:changed":{const s=e().editorRecentSaves[r.path];if(s&&Date.now()-s<2e3)break;t(a=>({editorChangedFiles:{...a.editorChangedFiles,[r.path]:r.timestamp}}));break}}},i.onclose=()=>{t({connected:!1,ws:null,daemonHost:null,tunneled:!1}),setTimeout(()=>e().connect(),2e3)},i.onerror=()=>i.close()},async spawnAgent(i){const n=await fetch(`${Ui}/api/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error||"Spawn failed")}const r=await n.json();return e().showStatus(`spawned ${r.name}`),r},async killAgent(i,n=!1){await fetch(`${Ui}/api/agents/${i}?purge=${n}`,{method:"DELETE"})},async rotateAgent(i){const n=await fetch(`${Ui}/api/agents/${i}/rotate`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Rotation failed")}return n.json()},async fetchProviders(){return(await fetch(`${Ui}/api/providers`)).json()},setActiveTab(i){t({activeTab:i})},openDetail(i){t({detailPanel:i})},closeDetail(){t({detailPanel:null})},selectAgent(i){t({detailPanel:{type:"agent",agentId:i}})},clearSelection(){t({detailPanel:null})},showStatus(i){t({statusMessage:i}),setTimeout(()=>{e().statusMessage===i&&t({statusMessage:null})},4e3)},addChatMessage(i,n,r,s=!1){t(a=>{const c={...a.chatHistory};return c[i]||(c[i]=[]),c[i]=[...c[i].slice(-100),{from:n,text:r,timestamp:Date.now(),isQuery:s}],{chatHistory:c}})},async instructAgent(i,n){const r=e().agents.find(f=>f.id===i),s=r&&(r.status==="running"||r.status==="starting");e().addChatMessage(i,"user",n,!1),e().addChatMessage(i,"system",s?"sending instruction...":"continuing conversation...");const a=await fetch(`${Ui}/api/agents/${i}/instruct`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n})});if(!a.ok){const f=await a.json().catch(()=>({}));throw e().addChatMessage(i,"system",`failed: ${f.error||"unknown error"}`),new Error(f.error||"Instruction failed")}const c=await a.json(),h=e().chatHistory[i]||[];h.length>0&&t(f=>{const g={...f.chatHistory};return g[c.id]=[...h],{chatHistory:g}});const d=e().tokenTimeline[i]||[];return d.length>0&&t(f=>{const g={...f.tokenTimeline};return g[c.id]=[...d],{tokenTimeline:g}}),e().selectAgent(c.id),e().addChatMessage(c.id,"system","agent resumed with context"),c},async queryAgent(i,n){e().addChatMessage(i,"user",n,!0);const r=await fetch(`${Ui}/api/agents/${i}/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n})});if(!r.ok){const a=await r.json().catch(()=>({}));throw e().addChatMessage(i,"system",`query failed: ${a.error||"unknown error"}`),new Error(a.error||"Query failed")}const s=await r.json();return e().addChatMessage(i,"agent",s.response),s},async openFile(i){var s;if(e().editorFiles[i]||e().editorOpenTabs.includes(i)){t(a=>({editorActiveFile:i,editorOpenTabs:a.editorOpenTabs.includes(i)?a.editorOpenTabs:[...a.editorOpenTabs,i]}));return}const n=(s=i.split(".").pop())==null?void 0:s.toLowerCase();if(["png","jpg","jpeg","gif","svg","webp","ico","bmp","avif","mp4","webm","mov","avi","mkv","ogv"].includes(n)){t(a=>({editorActiveFile:i,editorOpenTabs:[...a.editorOpenTabs,i]}));return}try{const a=await fetch(`${Ui}/api/files/read?path=${encodeURIComponent(i)}`);if(!a.ok){const d=await a.json().catch(()=>({}));e().showStatus(d.error||"Failed to read file");return}const c=await a.json();if(c.binary){e().showStatus("Binary file — cannot open");return}t(d=>({editorFiles:{...d.editorFiles,[i]:{content:c.content,originalContent:c.content,language:c.language,loadedAt:Date.now()}},editorActiveFile:i,editorOpenTabs:d.editorOpenTabs.includes(i)?d.editorOpenTabs:[...d.editorOpenTabs,i]}));const h=e().ws;(h==null?void 0:h.readyState)===1&&h.send(JSON.stringify({type:"editor:watch",path:i}))}catch{e().showStatus("Failed to open file")}},closeFile(i){t(r=>{const s=r.editorOpenTabs.filter(d=>d!==i),a={...r.editorFiles};delete a[i];const c={...r.editorChangedFiles};delete c[i];let h=r.editorActiveFile;if(h===i){const d=r.editorOpenTabs.indexOf(i);h=s[Math.min(d,s.length-1)]||null}return{editorOpenTabs:s,editorFiles:a,editorChangedFiles:c,editorActiveFile:h}});const n=e().ws;(n==null?void 0:n.readyState)===1&&n.send(JSON.stringify({type:"editor:unwatch",path:i}))},setActiveFile(i){t({editorActiveFile:i})},updateFileContent(i,n){t(r=>({editorFiles:{...r.editorFiles,[i]:{...r.editorFiles[i],content:n}}}))},async saveFile(i){const n=e().editorFiles[i];if(n)try{const r=await fetch(`${Ui}/api/files/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:n.content})});if(!r.ok){const s=await r.json().catch(()=>({}));e().showStatus(s.error||"Save failed");return}t(s=>({editorFiles:{...s.editorFiles,[i]:{...s.editorFiles[i],originalContent:n.content}},editorChangedFiles:(()=>{const a={...s.editorChangedFiles};return delete a[i],a})(),editorRecentSaves:{...s.editorRecentSaves,[i]:Date.now()}})),e().showStatus("Saved")}catch{e().showStatus("Save failed")}},async reloadFile(i){try{const n=await fetch(`${Ui}/api/files/read?path=${encodeURIComponent(i)}`);if(!n.ok)return;const r=await n.json();if(r.binary)return;t(s=>({editorFiles:{...s.editorFiles,[i]:{content:r.content,originalContent:r.content,language:r.language,loadedAt:Date.now()}},editorChangedFiles:(()=>{const a={...s.editorChangedFiles};return delete a[i],a})()}))}catch{}},dismissFileChange(i){t(n=>{const r={...n.editorChangedFiles};return delete r[i],{editorChangedFiles:r}})},async fetchTreeDir(i){try{const n=await fetch(`${Ui}/api/files/tree?path=${encodeURIComponent(i)}`);if(!n.ok)return;const r=await n.json();t(s=>({editorTreeCache:{...s.editorTreeCache,[i]:r.entries}}))}catch{}},async createFile(i){try{const n=await fetch(`${Ui}/api/files/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i})});if(!n.ok){const s=await n.json().catch(()=>({}));return e().showStatus(s.error||"Create failed"),!1}const r=i.includes("/")?i.split("/").slice(0,-1).join("/"):"";return await e().fetchTreeDir(r),e().showStatus("File created"),!0}catch{return e().showStatus("Create failed"),!1}},async createDir(i){try{const n=await fetch(`${Ui}/api/files/mkdir`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i})});if(!n.ok){const s=await n.json().catch(()=>({}));return e().showStatus(s.error||"Create failed"),!1}const r=i.includes("/")?i.split("/").slice(0,-1).join("/"):"";return await e().fetchTreeDir(r),e().showStatus("Folder created"),!0}catch{return e().showStatus("Create failed"),!1}},async deleteFile(i){try{const n=await fetch(`${Ui}/api/files/delete?path=${encodeURIComponent(i)}`,{method:"DELETE"});if(!n.ok){const s=await n.json().catch(()=>({}));return e().showStatus(s.error||"Delete failed"),!1}e().editorOpenTabs.includes(i)&&e().closeFile(i);const r=i.includes("/")?i.split("/").slice(0,-1).join("/"):"";return await e().fetchTreeDir(r),t(s=>{const a={...s.editorTreeCache};return delete a[i],{editorTreeCache:a}}),e().showStatus("Deleted"),!0}catch{return e().showStatus("Delete failed"),!1}},async renameFile(i,n){try{const r=await fetch(`${Ui}/api/files/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:i,newPath:n})});if(!r.ok){const c=await r.json().catch(()=>({}));return e().showStatus(c.error||"Rename failed"),!1}t(c=>{const h=c.editorOpenTabs.map(g=>g===i?n:g),d={...c.editorFiles};d[i]&&(d[n]=d[i],delete d[i]);const f=c.editorActiveFile===i?n:c.editorActiveFile;return{editorOpenTabs:h,editorFiles:d,editorActiveFile:f}});const s=i.includes("/")?i.split("/").slice(0,-1).join("/"):"",a=n.includes("/")?n.split("/").slice(0,-1).join("/"):"";return await e().fetchTreeDir(s),a!==s&&await e().fetchTreeDir(a),e().showStatus("Renamed"),!0}catch{return e().showStatus("Rename failed"),!1}},addCommand(i){t(n=>({commandHistory:[...n.commandHistory.slice(-49),i]}))}}));function ai(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let i=0,n;i<t.length;i++)(n=ai(t[i]))!==""&&(e+=(e&&" ")+n);else for(let i in t)t[i]&&(e+=(e&&" ")+i);return e}var tD={value:()=>{}};function em(){for(var t=0,e=arguments.length,i={},n;t<e;++t){if(!(n=arguments[t]+"")||n in i||/[\s.]/.test(n))throw new Error("illegal type: "+n);i[n]=[]}return new Ep(i)}function Ep(t){this._=t}function iD(t,e){return t.trim().split(/^|\s+/).map(function(i){var n="",r=i.indexOf(".");if(r>=0&&(n=i.slice(r+1),i=i.slice(0,r)),i&&!e.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:n}})}Ep.prototype=em.prototype={constructor:Ep,on:function(t,e){var i=this._,n=iD(t+"",i),r,s=-1,a=n.length;if(arguments.length<2){for(;++s<a;)if((r=(t=n[s]).type)&&(r=nD(i[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=n[s]).type)i[r]=eC(i[r],t.name,e);else if(e==null)for(r in i)i[r]=eC(i[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new Ep(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var i=new Array(r),n=0,r,s;n<r;++n)i[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],n=0,r=s.length;n<r;++n)s[n].value.apply(e,i)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],r=0,s=n.length;r<s;++r)n[r].value.apply(e,i)}};function nD(t,e){for(var i=0,n=t.length,r;i<n;++i)if((r=t[i]).name===e)return r.value}function eC(t,e,i){for(var n=0,r=t.length;n<r;++n)if(t[n].name===e){t[n]=tD,t=t.slice(0,n).concat(t.slice(n+1));break}return i!=null&&t.push({name:e,value:i}),t}var _y="http://www.w3.org/1999/xhtml";const tC={svg:"http://www.w3.org/2000/svg",xhtml:_y,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function tm(t){var e=t+="",i=e.indexOf(":");return i>=0&&(e=t.slice(0,i))!=="xmlns"&&(t=t.slice(i+1)),tC.hasOwnProperty(e)?{space:tC[e],local:t}:t}function rD(t){return function(){var e=this.ownerDocument,i=this.namespaceURI;return i===_y&&e.documentElement.namespaceURI===_y?e.createElement(t):e.createElementNS(i,t)}}function sD(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function q$(t){var e=tm(t);return(e.local?sD:rD)(e)}function oD(){}function _1(t){return t==null?oD:function(){return this.querySelector(t)}}function aD(t){typeof t!="function"&&(t=_1(t));for(var e=this._groups,i=e.length,n=new Array(i),r=0;r<i;++r)for(var s=e[r],a=s.length,c=n[r]=new Array(a),h,d,f=0;f<a;++f)(h=s[f])&&(d=t.call(h,h.__data__,f,s))&&("__data__"in h&&(d.__data__=h.__data__),c[f]=d);return new Xn(n,this._parents)}function lD(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function cD(){return[]}function V$(t){return t==null?cD:function(){return this.querySelectorAll(t)}}function hD(t){return function(){return lD(t.apply(this,arguments))}}function uD(t){typeof t=="function"?t=hD(t):t=V$(t);for(var e=this._groups,i=e.length,n=[],r=[],s=0;s<i;++s)for(var a=e[s],c=a.length,h,d=0;d<c;++d)(h=a[d])&&(n.push(t.call(h,h.__data__,d,a)),r.push(h));return new Xn(n,r)}function I$(t){return function(){return this.matches(t)}}function Y$(t){return function(e){return e.matches(t)}}var dD=Array.prototype.find;function fD(t){return function(){return dD.call(this.children,t)}}function pD(){return this.firstElementChild}function gD(t){return this.select(t==null?pD:fD(typeof t=="function"?t:Y$(t)))}var mD=Array.prototype.filter;function OD(){return Array.from(this.children)}function vD(t){return function(){return mD.call(this.children,t)}}function yD(t){return this.selectAll(t==null?OD:vD(typeof t=="function"?t:Y$(t)))}function SD(t){typeof t!="function"&&(t=I$(t));for(var e=this._groups,i=e.length,n=new Array(i),r=0;r<i;++r)for(var s=e[r],a=s.length,c=n[r]=[],h,d=0;d<a;++d)(h=s[d])&&t.call(h,h.__data__,d,s)&&c.push(h);return new Xn(n,this._parents)}function H$(t){return new Array(t.length)}function bD(){return new Xn(this._enter||this._groups.map(H$),this._parents)}function ng(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}ng.prototype={constructor:ng,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function _D(t){return function(){return t}}function xD(t,e,i,n,r,s){for(var a=0,c,h=e.length,d=s.length;a<d;++a)(c=e[a])?(c.__data__=s[a],n[a]=c):i[a]=new ng(t,s[a]);for(;a<h;++a)(c=e[a])&&(r[a]=c)}function wD(t,e,i,n,r,s,a){var c,h,d=new Map,f=e.length,g=s.length,m=new Array(f),O;for(c=0;c<f;++c)(h=e[c])&&(m[c]=O=a.call(h,h.__data__,c,e)+"",d.has(O)?r[c]=h:d.set(O,h));for(c=0;c<g;++c)O=a.call(t,s[c],c,s)+"",(h=d.get(O))?(n[c]=h,h.__data__=s[c],d.delete(O)):i[c]=new ng(t,s[c]);for(c=0;c<f;++c)(h=e[c])&&d.get(m[c])===h&&(r[c]=h)}function kD(t){return t.__data__}function CD(t,e){if(!arguments.length)return Array.from(this,kD);var i=e?wD:xD,n=this._parents,r=this._groups;typeof t!="function"&&(t=_D(t));for(var s=r.length,a=new Array(s),c=new Array(s),h=new Array(s),d=0;d<s;++d){var f=n[d],g=r[d],m=g.length,O=TD(t.call(f,f&&f.__data__,d,n)),S=O.length,_=c[d]=new Array(S),w=a[d]=new Array(S),x=h[d]=new Array(m);i(f,g,_,w,x,O,e);for(var Q=0,k=0,T,M;Q<S;++Q)if(T=_[Q]){for(Q>=k&&(k=Q+1);!(M=w[k])&&++k<S;);T._next=M||null}}return a=new Xn(a,n),a._enter=c,a._exit=h,a}function TD(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function QD(){return new Xn(this._exit||this._groups.map(H$),this._parents)}function $D(t,e,i){var n=this.enter(),r=this,s=this.exit();return typeof t=="function"?(n=t(n),n&&(n=n.selection())):n=n.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),i==null?s.remove():i(s),n&&r?n.merge(r).order():r}function PD(t){for(var e=t.selection?t.selection():t,i=this._groups,n=e._groups,r=i.length,s=n.length,a=Math.min(r,s),c=new Array(r),h=0;h<a;++h)for(var d=i[h],f=n[h],g=d.length,m=c[h]=new Array(g),O,S=0;S<g;++S)(O=d[S]||f[S])&&(m[S]=O);for(;h<r;++h)c[h]=i[h];return new Xn(c,this._parents)}function ED(){for(var t=this._groups,e=-1,i=t.length;++e<i;)for(var n=t[e],r=n.length-1,s=n[r],a;--r>=0;)(a=n[r])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function RD(t){t||(t=AD);function e(g,m){return g&&m?t(g.__data__,m.__data__):!g-!m}for(var i=this._groups,n=i.length,r=new Array(n),s=0;s<n;++s){for(var a=i[s],c=a.length,h=r[s]=new Array(c),d,f=0;f<c;++f)(d=a[f])&&(h[f]=d);h.sort(e)}return new Xn(r,this._parents).order()}function AD(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function MD(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function zD(){return Array.from(this)}function jD(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var n=t[e],r=0,s=n.length;r<s;++r){var a=n[r];if(a)return a}return null}function DD(){let t=0;for(const e of this)++t;return t}function BD(){return!this.node()}function LD(t){for(var e=this._groups,i=0,n=e.length;i<n;++i)for(var r=e[i],s=0,a=r.length,c;s<a;++s)(c=r[s])&&t.call(c,c.__data__,s,r);return this}function XD(t){return function(){this.removeAttribute(t)}}function ND(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ZD(t,e){return function(){this.setAttribute(t,e)}}function WD(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function qD(t,e){return function(){var i=e.apply(this,arguments);i==null?this.removeAttribute(t):this.setAttribute(t,i)}}function VD(t,e){return function(){var i=e.apply(this,arguments);i==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,i)}}function ID(t,e){var i=tm(t);if(arguments.length<2){var n=this.node();return i.local?n.getAttributeNS(i.space,i.local):n.getAttribute(i)}return this.each((e==null?i.local?ND:XD:typeof e=="function"?i.local?VD:qD:i.local?WD:ZD)(i,e))}function U$(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function YD(t){return function(){this.style.removeProperty(t)}}function HD(t,e,i){return function(){this.style.setProperty(t,e,i)}}function UD(t,e,i){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,i)}}function GD(t,e,i){return arguments.length>1?this.each((e==null?YD:typeof e=="function"?UD:HD)(t,e,i??"")):pc(this.node(),t)}function pc(t,e){return t.style.getPropertyValue(e)||U$(t).getComputedStyle(t,null).getPropertyValue(e)}function FD(t){return function(){delete this[t]}}function KD(t,e){return function(){this[t]=e}}function JD(t,e){return function(){var i=e.apply(this,arguments);i==null?delete this[t]:this[t]=i}}function eB(t,e){return arguments.length>1?this.each((e==null?FD:typeof e=="function"?JD:KD)(t,e)):this.node()[t]}function G$(t){return t.trim().split(/^|\s+/)}function x1(t){return t.classList||new F$(t)}function F$(t){this._node=t,this._names=G$(t.getAttribute("class")||"")}F$.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function K$(t,e){for(var i=x1(t),n=-1,r=e.length;++n<r;)i.add(e[n])}function J$(t,e){for(var i=x1(t),n=-1,r=e.length;++n<r;)i.remove(e[n])}function tB(t){return function(){K$(this,t)}}function iB(t){return function(){J$(this,t)}}function nB(t,e){return function(){(e.apply(this,arguments)?K$:J$)(this,t)}}function rB(t,e){var i=G$(t+"");if(arguments.length<2){for(var n=x1(this.node()),r=-1,s=i.length;++r<s;)if(!n.contains(i[r]))return!1;return!0}return this.each((typeof e=="function"?nB:e?tB:iB)(i,e))}function sB(){this.textContent=""}function oB(t){return function(){this.textContent=t}}function aB(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function lB(t){return arguments.length?this.each(t==null?sB:(typeof t=="function"?aB:oB)(t)):this.node().textContent}function cB(){this.innerHTML=""}function hB(t){return function(){this.innerHTML=t}}function uB(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function dB(t){return arguments.length?this.each(t==null?cB:(typeof t=="function"?uB:hB)(t)):this.node().innerHTML}function fB(){this.nextSibling&&this.parentNode.appendChild(this)}function pB(){return this.each(fB)}function gB(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mB(){return this.each(gB)}function OB(t){var e=typeof t=="function"?t:q$(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function vB(){return null}function yB(t,e){var i=typeof t=="function"?t:q$(t),n=e==null?vB:typeof e=="function"?e:_1(e);return this.select(function(){return this.insertBefore(i.apply(this,arguments),n.apply(this,arguments)||null)})}function SB(){var t=this.parentNode;t&&t.removeChild(this)}function bB(){return this.each(SB)}function _B(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function xB(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function wB(t){return this.select(t?xB:_B)}function kB(t){return arguments.length?this.property("__data__",t):this.node().__data__}function CB(t){return function(e){t.call(this,e,this.__data__)}}function TB(t){return t.trim().split(/^|\s+/).map(function(e){var i="",n=e.indexOf(".");return n>=0&&(i=e.slice(n+1),e=e.slice(0,n)),{type:e,name:i}})}function QB(t){return function(){var e=this.__on;if(e){for(var i=0,n=-1,r=e.length,s;i<r;++i)s=e[i],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function $B(t,e,i){return function(){var n=this.__on,r,s=CB(e);if(n){for(var a=0,c=n.length;a<c;++a)if((r=n[a]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=i),r.value=e;return}}this.addEventListener(t.type,s,i),r={type:t.type,name:t.name,value:e,listener:s,options:i},n?n.push(r):this.__on=[r]}}function PB(t,e,i){var n=TB(t+""),r,s=n.length,a;if(arguments.length<2){var c=this.node().__on;if(c){for(var h=0,d=c.length,f;h<d;++h)for(r=0,f=c[h];r<s;++r)if((a=n[r]).type===f.type&&a.name===f.name)return f.value}return}for(c=e?$B:QB,r=0;r<s;++r)this.each(c(n[r],e,i));return this}function eP(t,e,i){var n=U$(t),r=n.CustomEvent;typeof r=="function"?r=new r(e,i):(r=n.document.createEvent("Event"),i?(r.initEvent(e,i.bubbles,i.cancelable),r.detail=i.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function EB(t,e){return function(){return eP(this,t,e)}}function RB(t,e){return function(){return eP(this,t,e.apply(this,arguments))}}function AB(t,e){return this.each((typeof e=="function"?RB:EB)(t,e))}function*MB(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var n=t[e],r=0,s=n.length,a;r<s;++r)(a=n[r])&&(yield a)}var tP=[null];function Xn(t,e){this._groups=t,this._parents=e}function Fu(){return new Xn([[document.documentElement]],tP)}function zB(){return this}Xn.prototype=Fu.prototype={constructor:Xn,select:aD,selectAll:uD,selectChild:gD,selectChildren:yD,filter:SD,data:CD,enter:bD,exit:QD,join:$D,merge:PD,selection:zB,order:ED,sort:RD,call:MD,nodes:zD,node:jD,size:DD,empty:BD,each:LD,attr:ID,style:GD,property:eB,classed:rB,text:lB,html:dB,raise:pB,lower:mB,append:OB,insert:yB,remove:bB,clone:wB,datum:kB,on:PB,dispatch:AB,[Symbol.iterator]:MB};function Bn(t){return typeof t=="string"?new Xn([[document.querySelector(t)]],[document.documentElement]):new Xn([[t]],tP)}function jB(t){let e;for(;e=t.sourceEvent;)t=e;return t}function pr(t,e){if(t=jB(t),e===void 0&&(e=t.currentTarget),e){var i=e.ownerSVGElement||e;if(i.createSVGPoint){var n=i.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const DB={passive:!1},Su={capture:!0,passive:!1};function tv(t){t.stopImmediatePropagation()}function nc(t){t.preventDefault(),t.stopImmediatePropagation()}function iP(t){var e=t.document.documentElement,i=Bn(t).on("dragstart.drag",nc,Su);"onselectstart"in e?i.on("selectstart.drag",nc,Su):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function nP(t,e){var i=t.document.documentElement,n=Bn(t).on("dragstart.drag",null);e&&(n.on("click.drag",nc,Su),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in i?n.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}const Nf=t=>()=>t;function xy(t,{sourceEvent:e,subject:i,target:n,identifier:r,active:s,x:a,y:c,dx:h,dy:d,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:f}})}xy.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function BB(t){return!t.ctrlKey&&!t.button}function LB(){return this.parentNode}function XB(t,e){return e??{x:t.x,y:t.y}}function NB(){return navigator.maxTouchPoints||"ontouchstart"in this}function rP(){var t=BB,e=LB,i=XB,n=NB,r={},s=em("start","drag","end"),a=0,c,h,d,f,g=0;function m(T){T.on("mousedown.drag",O).filter(n).on("touchstart.drag",w).on("touchmove.drag",x,DB).on("touchend.drag touchcancel.drag",Q).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function O(T,M){if(!(f||!t.call(this,T,M))){var $=k(this,e.call(this,T,M),T,M,"mouse");$&&(Bn(T.view).on("mousemove.drag",S,Su).on("mouseup.drag",_,Su),iP(T.view),tv(T),d=!1,c=T.clientX,h=T.clientY,$("start",T))}}function S(T){if(nc(T),!d){var M=T.clientX-c,$=T.clientY-h;d=M*M+$*$>g}r.mouse("drag",T)}function _(T){Bn(T.view).on("mousemove.drag mouseup.drag",null),nP(T.view,d),nc(T),r.mouse("end",T)}function w(T,M){if(t.call(this,T,M)){var $=T.changedTouches,R=e.call(this,T,M),V=$.length,H,ee;for(H=0;H<V;++H)(ee=k(this,R,T,M,$[H].identifier,$[H]))&&(tv(T),ee("start",T,$[H]))}}function x(T){var M=T.changedTouches,$=M.length,R,V;for(R=0;R<$;++R)(V=r[M[R].identifier])&&(nc(T),V("drag",T,M[R]))}function Q(T){var M=T.changedTouches,$=M.length,R,V;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),R=0;R<$;++R)(V=r[M[R].identifier])&&(tv(T),V("end",T,M[R]))}function k(T,M,$,R,V,H){var ee=s.copy(),I=pr(H||$,M),j,D,E;if((E=i.call(T,new xy("beforestart",{sourceEvent:$,target:m,identifier:V,active:a,x:I[0],y:I[1],dx:0,dy:0,dispatch:ee}),R))!=null)return j=E.x-I[0]||0,D=E.y-I[1]||0,function X(P,Z,L){var B=I,G;switch(P){case"start":r[V]=X,G=a++;break;case"end":delete r[V],--a;case"drag":I=pr(L||Z,M),G=a;break}ee.call(P,T,new xy(P,{sourceEvent:Z,subject:E,target:m,identifier:V,active:G,x:I[0]+j,y:I[1]+D,dx:I[0]-B[0],dy:I[1]-B[1],dispatch:ee}),R)}}return m.filter=function(T){return arguments.length?(t=typeof T=="function"?T:Nf(!!T),m):t},m.container=function(T){return arguments.length?(e=typeof T=="function"?T:Nf(T),m):e},m.subject=function(T){return arguments.length?(i=typeof T=="function"?T:Nf(T),m):i},m.touchable=function(T){return arguments.length?(n=typeof T=="function"?T:Nf(!!T),m):n},m.on=function(){var T=s.on.apply(s,arguments);return T===s?m:T},m.clickDistance=function(T){return arguments.length?(g=(T=+T)*T,m):Math.sqrt(g)},m}function w1(t,e,i){t.prototype=e.prototype=i,i.constructor=t}function sP(t,e){var i=Object.create(t.prototype);for(var n in e)i[n]=e[n];return i}function Ku(){}var bu=.7,rg=1/bu,rc="\\s*([+-]?\\d+)\\s*",_u="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Vr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ZB=/^#([0-9a-f]{3,8})$/,WB=new RegExp(`^rgb\\(${rc},${rc},${rc}\\)$`),qB=new RegExp(`^rgb\\(${Vr},${Vr},${Vr}\\)$`),VB=new RegExp(`^rgba\\(${rc},${rc},${rc},${_u}\\)$`),IB=new RegExp(`^rgba\\(${Vr},${Vr},${Vr},${_u}\\)$`),YB=new RegExp(`^hsl\\(${_u},${Vr},${Vr}\\)$`),HB=new RegExp(`^hsla\\(${_u},${Vr},${Vr},${_u}\\)$`),iC={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};w1(Ku,La,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:nC,formatHex:nC,formatHex8:UB,formatHsl:GB,formatRgb:rC,toString:rC});function nC(){return this.rgb().formatHex()}function UB(){return this.rgb().formatHex8()}function GB(){return oP(this).formatHsl()}function rC(){return this.rgb().formatRgb()}function La(t){var e,i;return t=(t+"").trim().toLowerCase(),(e=ZB.exec(t))?(i=e[1].length,e=parseInt(e[1],16),i===6?sC(e):i===3?new yn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):i===8?Zf(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):i===4?Zf(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=WB.exec(t))?new yn(e[1],e[2],e[3],1):(e=qB.exec(t))?new yn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=VB.exec(t))?Zf(e[1],e[2],e[3],e[4]):(e=IB.exec(t))?Zf(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=YB.exec(t))?lC(e[1],e[2]/100,e[3]/100,1):(e=HB.exec(t))?lC(e[1],e[2]/100,e[3]/100,e[4]):iC.hasOwnProperty(t)?sC(iC[t]):t==="transparent"?new yn(NaN,NaN,NaN,0):null}function sC(t){return new yn(t>>16&255,t>>8&255,t&255,1)}function Zf(t,e,i,n){return n<=0&&(t=e=i=NaN),new yn(t,e,i,n)}function FB(t){return t instanceof Ku||(t=La(t)),t?(t=t.rgb(),new yn(t.r,t.g,t.b,t.opacity)):new yn}function wy(t,e,i,n){return arguments.length===1?FB(t):new yn(t,e,i,n??1)}function yn(t,e,i,n){this.r=+t,this.g=+e,this.b=+i,this.opacity=+n}w1(yn,wy,sP(Ku,{brighter(t){return t=t==null?rg:Math.pow(rg,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?bu:Math.pow(bu,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new yn(Ma(this.r),Ma(this.g),Ma(this.b),sg(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oC,formatHex:oC,formatHex8:KB,formatRgb:aC,toString:aC}));function oC(){return`#${$a(this.r)}${$a(this.g)}${$a(this.b)}`}function KB(){return`#${$a(this.r)}${$a(this.g)}${$a(this.b)}${$a((isNaN(this.opacity)?1:this.opacity)*255)}`}function aC(){const t=sg(this.opacity);return`${t===1?"rgb(":"rgba("}${Ma(this.r)}, ${Ma(this.g)}, ${Ma(this.b)}${t===1?")":`, ${t})`}`}function sg(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ma(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function $a(t){return t=Ma(t),(t<16?"0":"")+t.toString(16)}function lC(t,e,i,n){return n<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new gr(t,e,i,n)}function oP(t){if(t instanceof gr)return new gr(t.h,t.s,t.l,t.opacity);if(t instanceof Ku||(t=La(t)),!t)return new gr;if(t instanceof gr)return t;t=t.rgb();var e=t.r/255,i=t.g/255,n=t.b/255,r=Math.min(e,i,n),s=Math.max(e,i,n),a=NaN,c=s-r,h=(s+r)/2;return c?(e===s?a=(i-n)/c+(i<n)*6:i===s?a=(n-e)/c+2:a=(e-i)/c+4,c/=h<.5?s+r:2-s-r,a*=60):c=h>0&&h<1?0:a,new gr(a,c,h,t.opacity)}function JB(t,e,i,n){return arguments.length===1?oP(t):new gr(t,e,i,n??1)}function gr(t,e,i,n){this.h=+t,this.s=+e,this.l=+i,this.opacity=+n}w1(gr,JB,sP(Ku,{brighter(t){return t=t==null?rg:Math.pow(rg,t),new gr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?bu:Math.pow(bu,t),new gr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,i=this.l,n=i+(i<.5?i:1-i)*e,r=2*i-n;return new yn(iv(t>=240?t-240:t+120,r,n),iv(t,r,n),iv(t<120?t+240:t-120,r,n),this.opacity)},clamp(){return new gr(cC(this.h),Wf(this.s),Wf(this.l),sg(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=sg(this.opacity);return`${t===1?"hsl(":"hsla("}${cC(this.h)}, ${Wf(this.s)*100}%, ${Wf(this.l)*100}%${t===1?")":`, ${t})`}`}}));function cC(t){return t=(t||0)%360,t<0?t+360:t}function Wf(t){return Math.max(0,Math.min(1,t||0))}function iv(t,e,i){return(t<60?e+(i-e)*t/60:t<180?i:t<240?e+(i-e)*(240-t)/60:e)*255}const k1=t=>()=>t;function e4(t,e){return function(i){return t+i*e}}function t4(t,e,i){return t=Math.pow(t,i),e=Math.pow(e,i)-t,i=1/i,function(n){return Math.pow(t+n*e,i)}}function i4(t){return(t=+t)==1?aP:function(e,i){return i-e?t4(e,i,t):k1(isNaN(e)?i:e)}}function aP(t,e){var i=e-t;return i?e4(t,i):k1(isNaN(t)?e:t)}const og=(function t(e){var i=i4(e);function n(r,s){var a=i((r=wy(r)).r,(s=wy(s)).r),c=i(r.g,s.g),h=i(r.b,s.b),d=aP(r.opacity,s.opacity);return function(f){return r.r=a(f),r.g=c(f),r.b=h(f),r.opacity=d(f),r+""}}return n.gamma=t,n})(1);function n4(t,e){e||(e=[]);var i=t?Math.min(e.length,t.length):0,n=e.slice(),r;return function(s){for(r=0;r<i;++r)n[r]=t[r]*(1-s)+e[r]*s;return n}}function r4(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function s4(t,e){var i=e?e.length:0,n=t?Math.min(i,t.length):0,r=new Array(n),s=new Array(i),a;for(a=0;a<n;++a)r[a]=cu(t[a],e[a]);for(;a<i;++a)s[a]=e[a];return function(c){for(a=0;a<n;++a)s[a]=r[a](c);return s}}function o4(t,e){var i=new Date;return t=+t,e=+e,function(n){return i.setTime(t*(1-n)+e*n),i}}function Dr(t,e){return t=+t,e=+e,function(i){return t*(1-i)+e*i}}function a4(t,e){var i={},n={},r;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in t?i[r]=cu(t[r],e[r]):n[r]=e[r];return function(s){for(r in i)n[r]=i[r](s);return n}}var ky=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,nv=new RegExp(ky.source,"g");function l4(t){return function(){return t}}function c4(t){return function(e){return t(e)+""}}function lP(t,e){var i=ky.lastIndex=nv.lastIndex=0,n,r,s,a=-1,c=[],h=[];for(t=t+"",e=e+"";(n=ky.exec(t))&&(r=nv.exec(e));)(s=r.index)>i&&(s=e.slice(i,s),c[a]?c[a]+=s:c[++a]=s),(n=n[0])===(r=r[0])?c[a]?c[a]+=r:c[++a]=r:(c[++a]=null,h.push({i:a,x:Dr(n,r)})),i=nv.lastIndex;return i<e.length&&(s=e.slice(i),c[a]?c[a]+=s:c[++a]=s),c.length<2?h[0]?c4(h[0].x):l4(e):(e=h.length,function(d){for(var f=0,g;f<e;++f)c[(g=h[f]).i]=g.x(d);return c.join("")})}function cu(t,e){var i=typeof e,n;return e==null||i==="boolean"?k1(e):(i==="number"?Dr:i==="string"?(n=La(e))?(e=n,og):lP:e instanceof La?og:e instanceof Date?o4:r4(e)?n4:Array.isArray(e)?s4:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?a4:Dr)(t,e)}var hC=180/Math.PI,Cy={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cP(t,e,i,n,r,s){var a,c,h;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(h=t*i+e*n)&&(i-=t*h,n-=e*h),(c=Math.sqrt(i*i+n*n))&&(i/=c,n/=c,h/=c),t*n<e*i&&(t=-t,e=-e,h=-h,a=-a),{translateX:r,translateY:s,rotate:Math.atan2(e,t)*hC,skewX:Math.atan(h)*hC,scaleX:a,scaleY:c}}var qf;function h4(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Cy:cP(e.a,e.b,e.c,e.d,e.e,e.f)}function u4(t){return t==null||(qf||(qf=document.createElementNS("http://www.w3.org/2000/svg","g")),qf.setAttribute("transform",t),!(t=qf.transform.baseVal.consolidate()))?Cy:(t=t.matrix,cP(t.a,t.b,t.c,t.d,t.e,t.f))}function hP(t,e,i,n){function r(d){return d.length?d.pop()+" ":""}function s(d,f,g,m,O,S){if(d!==g||f!==m){var _=O.push("translate(",null,e,null,i);S.push({i:_-4,x:Dr(d,g)},{i:_-2,x:Dr(f,m)})}else(g||m)&&O.push("translate("+g+e+m+i)}function a(d,f,g,m){d!==f?(d-f>180?f+=360:f-d>180&&(d+=360),m.push({i:g.push(r(g)+"rotate(",null,n)-2,x:Dr(d,f)})):f&&g.push(r(g)+"rotate("+f+n)}function c(d,f,g,m){d!==f?m.push({i:g.push(r(g)+"skewX(",null,n)-2,x:Dr(d,f)}):f&&g.push(r(g)+"skewX("+f+n)}function h(d,f,g,m,O,S){if(d!==g||f!==m){var _=O.push(r(O)+"scale(",null,",",null,")");S.push({i:_-4,x:Dr(d,g)},{i:_-2,x:Dr(f,m)})}else(g!==1||m!==1)&&O.push(r(O)+"scale("+g+","+m+")")}return function(d,f){var g=[],m=[];return d=t(d),f=t(f),s(d.translateX,d.translateY,f.translateX,f.translateY,g,m),a(d.rotate,f.rotate,g,m),c(d.skewX,f.skewX,g,m),h(d.scaleX,d.scaleY,f.scaleX,f.scaleY,g,m),d=f=null,function(O){for(var S=-1,_=m.length,w;++S<_;)g[(w=m[S]).i]=w.x(O);return g.join("")}}}var d4=hP(h4,"px, ","px)","deg)"),f4=hP(u4,", ",")",")"),p4=1e-12;function uC(t){return((t=Math.exp(t))+1/t)/2}function g4(t){return((t=Math.exp(t))-1/t)/2}function m4(t){return((t=Math.exp(2*t))-1)/(t+1)}const Rp=(function t(e,i,n){function r(s,a){var c=s[0],h=s[1],d=s[2],f=a[0],g=a[1],m=a[2],O=f-c,S=g-h,_=O*O+S*S,w,x;if(_<p4)x=Math.log(m/d)/e,w=function(R){return[c+R*O,h+R*S,d*Math.exp(e*R*x)]};else{var Q=Math.sqrt(_),k=(m*m-d*d+n*_)/(2*d*i*Q),T=(m*m-d*d-n*_)/(2*m*i*Q),M=Math.log(Math.sqrt(k*k+1)-k),$=Math.log(Math.sqrt(T*T+1)-T);x=($-M)/e,w=function(R){var V=R*x,H=uC(M),ee=d/(i*Q)*(H*m4(e*V+M)-g4(M));return[c+ee*O,h+ee*S,d*H/uC(e*V+M)]}}return w.duration=x*1e3*e/Math.SQRT2,w}return r.rho=function(s){var a=Math.max(.001,+s),c=a*a,h=c*c;return t(a,c,h)},r})(Math.SQRT2,2,4);var gc=0,Jh=0,Mh=0,uP=1e3,ag,eu,lg=0,Xa=0,im=0,xu=typeof performance=="object"&&performance.now?performance:Date,dP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function C1(){return Xa||(dP(O4),Xa=xu.now()+im)}function O4(){Xa=0}function cg(){this._call=this._time=this._next=null}cg.prototype=fP.prototype={constructor:cg,restart:function(t,e,i){if(typeof t!="function")throw new TypeError("callback is not a function");i=(i==null?C1():+i)+(e==null?0:+e),!this._next&&eu!==this&&(eu?eu._next=this:ag=this,eu=this),this._call=t,this._time=i,Ty()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ty())}};function fP(t,e,i){var n=new cg;return n.restart(t,e,i),n}function v4(){C1(),++gc;for(var t=ag,e;t;)(e=Xa-t._time)>=0&&t._call.call(void 0,e),t=t._next;--gc}function dC(){Xa=(lg=xu.now())+im,gc=Jh=0;try{v4()}finally{gc=0,S4(),Xa=0}}function y4(){var t=xu.now(),e=t-lg;e>uP&&(im-=e,lg=t)}function S4(){for(var t,e=ag,i,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(i=e._next,e._next=null,e=t?t._next=i:ag=i);eu=t,Ty(n)}function Ty(t){if(!gc){Jh&&(Jh=clearTimeout(Jh));var e=t-Xa;e>24?(t<1/0&&(Jh=setTimeout(dC,t-xu.now()-im)),Mh&&(Mh=clearInterval(Mh))):(Mh||(lg=xu.now(),Mh=setInterval(y4,uP)),gc=1,dP(dC))}}function fC(t,e,i){var n=new cg;return e=e==null?0:+e,n.restart(r=>{n.stop(),t(r+e)},e,i),n}var b4=em("start","end","cancel","interrupt"),_4=[],pP=0,pC=1,Qy=2,Ap=3,gC=4,$y=5,Mp=6;function nm(t,e,i,n,r,s){var a=t.__transition;if(!a)t.__transition={};else if(i in a)return;x4(t,i,{name:e,index:n,group:r,on:b4,tween:_4,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:pP})}function T1(t,e){var i=br(t,e);if(i.state>pP)throw new Error("too late; already scheduled");return i}function Fr(t,e){var i=br(t,e);if(i.state>Ap)throw new Error("too late; already running");return i}function br(t,e){var i=t.__transition;if(!i||!(i=i[e]))throw new Error("transition not found");return i}function x4(t,e,i){var n=t.__transition,r;n[e]=i,i.timer=fP(s,0,i.time);function s(d){i.state=pC,i.timer.restart(a,i.delay,i.time),i.delay<=d&&a(d-i.delay)}function a(d){var f,g,m,O;if(i.state!==pC)return h();for(f in n)if(O=n[f],O.name===i.name){if(O.state===Ap)return fC(a);O.state===gC?(O.state=Mp,O.timer.stop(),O.on.call("interrupt",t,t.__data__,O.index,O.group),delete n[f]):+f<e&&(O.state=Mp,O.timer.stop(),O.on.call("cancel",t,t.__data__,O.index,O.group),delete n[f])}if(fC(function(){i.state===Ap&&(i.state=gC,i.timer.restart(c,i.delay,i.time),c(d))}),i.state=Qy,i.on.call("start",t,t.__data__,i.index,i.group),i.state===Qy){for(i.state=Ap,r=new Array(m=i.tween.length),f=0,g=-1;f<m;++f)(O=i.tween[f].value.call(t,t.__data__,i.index,i.group))&&(r[++g]=O);r.length=g+1}}function c(d){for(var f=d<i.duration?i.ease.call(null,d/i.duration):(i.timer.restart(h),i.state=$y,1),g=-1,m=r.length;++g<m;)r[g].call(t,f);i.state===$y&&(i.on.call("end",t,t.__data__,i.index,i.group),h())}function h(){i.state=Mp,i.timer.stop(),delete n[e];for(var d in n)return;delete t.__transition}}function zp(t,e){var i=t.__transition,n,r,s=!0,a;if(i){e=e==null?null:e+"";for(a in i){if((n=i[a]).name!==e){s=!1;continue}r=n.state>Qy&&n.state<$y,n.state=Mp,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete i[a]}s&&delete t.__transition}}function w4(t){return this.each(function(){zp(this,t)})}function k4(t,e){var i,n;return function(){var r=Fr(this,t),s=r.tween;if(s!==i){n=i=s;for(var a=0,c=n.length;a<c;++a)if(n[a].name===e){n=n.slice(),n.splice(a,1);break}}r.tween=n}}function C4(t,e,i){var n,r;if(typeof i!="function")throw new Error;return function(){var s=Fr(this,t),a=s.tween;if(a!==n){r=(n=a).slice();for(var c={name:e,value:i},h=0,d=r.length;h<d;++h)if(r[h].name===e){r[h]=c;break}h===d&&r.push(c)}s.tween=r}}function T4(t,e){var i=this._id;if(t+="",arguments.length<2){for(var n=br(this.node(),i).tween,r=0,s=n.length,a;r<s;++r)if((a=n[r]).name===t)return a.value;return null}return this.each((e==null?k4:C4)(i,t,e))}function Q1(t,e,i){var n=t._id;return t.each(function(){var r=Fr(this,n);(r.value||(r.value={}))[e]=i.apply(this,arguments)}),function(r){return br(r,n).value[e]}}function gP(t,e){var i;return(typeof e=="number"?Dr:e instanceof La?og:(i=La(e))?(e=i,og):lP)(t,e)}function Q4(t){return function(){this.removeAttribute(t)}}function $4(t){return function(){this.removeAttributeNS(t.space,t.local)}}function P4(t,e,i){var n,r=i+"",s;return function(){var a=this.getAttribute(t);return a===r?null:a===n?s:s=e(n=a,i)}}function E4(t,e,i){var n,r=i+"",s;return function(){var a=this.getAttributeNS(t.space,t.local);return a===r?null:a===n?s:s=e(n=a,i)}}function R4(t,e,i){var n,r,s;return function(){var a,c=i(this),h;return c==null?void this.removeAttribute(t):(a=this.getAttribute(t),h=c+"",a===h?null:a===n&&h===r?s:(r=h,s=e(n=a,c)))}}function A4(t,e,i){var n,r,s;return function(){var a,c=i(this),h;return c==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),h=c+"",a===h?null:a===n&&h===r?s:(r=h,s=e(n=a,c)))}}function M4(t,e){var i=tm(t),n=i==="transform"?f4:gP;return this.attrTween(t,typeof e=="function"?(i.local?A4:R4)(i,n,Q1(this,"attr."+t,e)):e==null?(i.local?$4:Q4)(i):(i.local?E4:P4)(i,n,e))}function z4(t,e){return function(i){this.setAttribute(t,e.call(this,i))}}function j4(t,e){return function(i){this.setAttributeNS(t.space,t.local,e.call(this,i))}}function D4(t,e){var i,n;function r(){var s=e.apply(this,arguments);return s!==n&&(i=(n=s)&&j4(t,s)),i}return r._value=e,r}function B4(t,e){var i,n;function r(){var s=e.apply(this,arguments);return s!==n&&(i=(n=s)&&z4(t,s)),i}return r._value=e,r}function L4(t,e){var i="attr."+t;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;var n=tm(t);return this.tween(i,(n.local?D4:B4)(n,e))}function X4(t,e){return function(){T1(this,t).delay=+e.apply(this,arguments)}}function N4(t,e){return e=+e,function(){T1(this,t).delay=e}}function Z4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?X4:N4)(e,t)):br(this.node(),e).delay}function W4(t,e){return function(){Fr(this,t).duration=+e.apply(this,arguments)}}function q4(t,e){return e=+e,function(){Fr(this,t).duration=e}}function V4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?W4:q4)(e,t)):br(this.node(),e).duration}function I4(t,e){if(typeof e!="function")throw new Error;return function(){Fr(this,t).ease=e}}function Y4(t){var e=this._id;return arguments.length?this.each(I4(e,t)):br(this.node(),e).ease}function H4(t,e){return function(){var i=e.apply(this,arguments);if(typeof i!="function")throw new Error;Fr(this,t).ease=i}}function U4(t){if(typeof t!="function")throw new Error;return this.each(H4(this._id,t))}function G4(t){typeof t!="function"&&(t=I$(t));for(var e=this._groups,i=e.length,n=new Array(i),r=0;r<i;++r)for(var s=e[r],a=s.length,c=n[r]=[],h,d=0;d<a;++d)(h=s[d])&&t.call(h,h.__data__,d,s)&&c.push(h);return new As(n,this._parents,this._name,this._id)}function F4(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,i=t._groups,n=e.length,r=i.length,s=Math.min(n,r),a=new Array(n),c=0;c<s;++c)for(var h=e[c],d=i[c],f=h.length,g=a[c]=new Array(f),m,O=0;O<f;++O)(m=h[O]||d[O])&&(g[O]=m);for(;c<n;++c)a[c]=e[c];return new As(a,this._parents,this._name,this._id)}function K4(t){return(t+"").trim().split(/^|\s+/).every(function(e){var i=e.indexOf(".");return i>=0&&(e=e.slice(0,i)),!e||e==="start"})}function J4(t,e,i){var n,r,s=K4(e)?T1:Fr;return function(){var a=s(this,t),c=a.on;c!==n&&(r=(n=c).copy()).on(e,i),a.on=r}}function eL(t,e){var i=this._id;return arguments.length<2?br(this.node(),i).on.on(t):this.each(J4(i,t,e))}function tL(t){return function(){var e=this.parentNode;for(var i in this.__transition)if(+i!==t)return;e&&e.removeChild(this)}}function iL(){return this.on("end.remove",tL(this._id))}function nL(t){var e=this._name,i=this._id;typeof t!="function"&&(t=_1(t));for(var n=this._groups,r=n.length,s=new Array(r),a=0;a<r;++a)for(var c=n[a],h=c.length,d=s[a]=new Array(h),f,g,m=0;m<h;++m)(f=c[m])&&(g=t.call(f,f.__data__,m,c))&&("__data__"in f&&(g.__data__=f.__data__),d[m]=g,nm(d[m],e,i,m,d,br(f,i)));return new As(s,this._parents,e,i)}function rL(t){var e=this._name,i=this._id;typeof t!="function"&&(t=V$(t));for(var n=this._groups,r=n.length,s=[],a=[],c=0;c<r;++c)for(var h=n[c],d=h.length,f,g=0;g<d;++g)if(f=h[g]){for(var m=t.call(f,f.__data__,g,h),O,S=br(f,i),_=0,w=m.length;_<w;++_)(O=m[_])&&nm(O,e,i,_,m,S);s.push(m),a.push(f)}return new As(s,a,e,i)}var sL=Fu.prototype.constructor;function oL(){return new sL(this._groups,this._parents)}function aL(t,e){var i,n,r;return function(){var s=pc(this,t),a=(this.style.removeProperty(t),pc(this,t));return s===a?null:s===i&&a===n?r:r=e(i=s,n=a)}}function mP(t){return function(){this.style.removeProperty(t)}}function lL(t,e,i){var n,r=i+"",s;return function(){var a=pc(this,t);return a===r?null:a===n?s:s=e(n=a,i)}}function cL(t,e,i){var n,r,s;return function(){var a=pc(this,t),c=i(this),h=c+"";return c==null&&(h=c=(this.style.removeProperty(t),pc(this,t))),a===h?null:a===n&&h===r?s:(r=h,s=e(n=a,c))}}function hL(t,e){var i,n,r,s="style."+e,a="end."+s,c;return function(){var h=Fr(this,t),d=h.on,f=h.value[s]==null?c||(c=mP(e)):void 0;(d!==i||r!==f)&&(n=(i=d).copy()).on(a,r=f),h.on=n}}function uL(t,e,i){var n=(t+="")=="transform"?d4:gP;return e==null?this.styleTween(t,aL(t,n)).on("end.style."+t,mP(t)):typeof e=="function"?this.styleTween(t,cL(t,n,Q1(this,"style."+t,e))).each(hL(this._id,t)):this.styleTween(t,lL(t,n,e),i).on("end.style."+t,null)}function dL(t,e,i){return function(n){this.style.setProperty(t,e.call(this,n),i)}}function fL(t,e,i){var n,r;function s(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&dL(t,a,i)),n}return s._value=e,s}function pL(t,e,i){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,fL(t,e,i??""))}function gL(t){return function(){this.textContent=t}}function mL(t){return function(){var e=t(this);this.textContent=e??""}}function OL(t){return this.tween("text",typeof t=="function"?mL(Q1(this,"text",t)):gL(t==null?"":t+""))}function vL(t){return function(e){this.textContent=t.call(this,e)}}function yL(t){var e,i;function n(){var r=t.apply(this,arguments);return r!==i&&(e=(i=r)&&vL(r)),e}return n._value=t,n}function SL(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,yL(t))}function bL(){for(var t=this._name,e=this._id,i=OP(),n=this._groups,r=n.length,s=0;s<r;++s)for(var a=n[s],c=a.length,h,d=0;d<c;++d)if(h=a[d]){var f=br(h,e);nm(h,t,i,d,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new As(n,this._parents,t,i)}function _L(){var t,e,i=this,n=i._id,r=i.size();return new Promise(function(s,a){var c={value:a},h={value:function(){--r===0&&s()}};i.each(function(){var d=Fr(this,n),f=d.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(c),e._.interrupt.push(c),e._.end.push(h)),d.on=e}),r===0&&s()})}var xL=0;function As(t,e,i,n){this._groups=t,this._parents=e,this._name=i,this._id=n}function OP(){return++xL}var ys=Fu.prototype;As.prototype={constructor:As,select:nL,selectAll:rL,selectChild:ys.selectChild,selectChildren:ys.selectChildren,filter:G4,merge:F4,selection:oL,transition:bL,call:ys.call,nodes:ys.nodes,node:ys.node,size:ys.size,empty:ys.empty,each:ys.each,on:eL,attr:M4,attrTween:L4,style:uL,styleTween:pL,text:OL,textTween:SL,remove:iL,tween:T4,delay:Z4,duration:V4,ease:Y4,easeVarying:U4,end:_L,[Symbol.iterator]:ys[Symbol.iterator]};function wL(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var kL={time:null,delay:0,duration:250,ease:wL};function CL(t,e){for(var i;!(i=t.__transition)||!(i=i[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return i}function TL(t){var e,i;t instanceof As?(e=t._id,t=t._name):(e=OP(),(i=kL).time=C1(),t=t==null?null:t+"");for(var n=this._groups,r=n.length,s=0;s<r;++s)for(var a=n[s],c=a.length,h,d=0;d<c;++d)(h=a[d])&&nm(h,t,e,d,a,i||CL(h,e));return new As(n,this._parents,t,e)}Fu.prototype.interrupt=w4;Fu.prototype.transition=TL;const Vf=t=>()=>t;function QL(t,{sourceEvent:e,target:i,transform:n,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:r}})}function $s(t,e,i){this.k=t,this.x=e,this.y=i}$s.prototype={constructor:$s,scale:function(t){return t===1?this:new $s(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new $s(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var rm=new $s(1,0,0);vP.prototype=$s.prototype;function vP(t){for(;!t.__zoom;)if(!(t=t.parentNode))return rm;return t.__zoom}function rv(t){t.stopImmediatePropagation()}function zh(t){t.preventDefault(),t.stopImmediatePropagation()}function $L(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function PL(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function mC(){return this.__zoom||rm}function EL(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function RL(){return navigator.maxTouchPoints||"ontouchstart"in this}function AL(t,e,i){var n=t.invertX(e[0][0])-i[0][0],r=t.invertX(e[1][0])-i[1][0],s=t.invertY(e[0][1])-i[0][1],a=t.invertY(e[1][1])-i[1][1];return t.translate(r>n?(n+r)/2:Math.min(0,n)||Math.max(0,r),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function yP(){var t=$L,e=PL,i=AL,n=EL,r=RL,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],c=250,h=Rp,d=em("start","zoom","end"),f,g,m,O=500,S=150,_=0,w=10;function x(E){E.property("__zoom",mC).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",ee).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(E,X,P,Z){var L=E.selection?E.selection():E;L.property("__zoom",mC),E!==L?M(E,X,P,Z):L.interrupt().each(function(){$(this,arguments).event(Z).start().zoom(null,typeof X=="function"?X.apply(this,arguments):X).end()})},x.scaleBy=function(E,X,P,Z){x.scaleTo(E,function(){var L=this.__zoom.k,B=typeof X=="function"?X.apply(this,arguments):X;return L*B},P,Z)},x.scaleTo=function(E,X,P,Z){x.transform(E,function(){var L=e.apply(this,arguments),B=this.__zoom,G=P==null?T(L):typeof P=="function"?P.apply(this,arguments):P,z=B.invert(G),q=typeof X=="function"?X.apply(this,arguments):X;return i(k(Q(B,q),G,z),L,a)},P,Z)},x.translateBy=function(E,X,P,Z){x.transform(E,function(){return i(this.__zoom.translate(typeof X=="function"?X.apply(this,arguments):X,typeof P=="function"?P.apply(this,arguments):P),e.apply(this,arguments),a)},null,Z)},x.translateTo=function(E,X,P,Z,L){x.transform(E,function(){var B=e.apply(this,arguments),G=this.__zoom,z=Z==null?T(B):typeof Z=="function"?Z.apply(this,arguments):Z;return i(rm.translate(z[0],z[1]).scale(G.k).translate(typeof X=="function"?-X.apply(this,arguments):-X,typeof P=="function"?-P.apply(this,arguments):-P),B,a)},Z,L)};function Q(E,X){return X=Math.max(s[0],Math.min(s[1],X)),X===E.k?E:new $s(X,E.x,E.y)}function k(E,X,P){var Z=X[0]-P[0]*E.k,L=X[1]-P[1]*E.k;return Z===E.x&&L===E.y?E:new $s(E.k,Z,L)}function T(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function M(E,X,P,Z){E.on("start.zoom",function(){$(this,arguments).event(Z).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(Z).end()}).tween("zoom",function(){var L=this,B=arguments,G=$(L,B).event(Z),z=e.apply(L,B),q=P==null?T(z):typeof P=="function"?P.apply(L,B):P,K=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),ie=L.__zoom,ce=typeof X=="function"?X.apply(L,B):X,de=h(ie.invert(q).concat(K/ie.k),ce.invert(q).concat(K/ce.k));return function(pe){if(pe===1)pe=ce;else{var fe=de(pe),ve=K/fe[2];pe=new $s(ve,q[0]-fe[0]*ve,q[1]-fe[1]*ve)}G.zoom(null,pe)}})}function $(E,X,P){return!P&&E.__zooming||new R(E,X)}function R(E,X){this.that=E,this.args=X,this.active=0,this.sourceEvent=null,this.extent=e.apply(E,X),this.taps=0}R.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,X){return this.mouse&&E!=="mouse"&&(this.mouse[1]=X.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=X.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=X.invert(this.touch1[0])),this.that.__zoom=X,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var X=Bn(this.that).datum();d.call(E,this.that,new QL(E,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:d}),X)}};function V(E,...X){if(!t.apply(this,arguments))return;var P=$(this,X).event(E),Z=this.__zoom,L=Math.max(s[0],Math.min(s[1],Z.k*Math.pow(2,n.apply(this,arguments)))),B=pr(E);if(P.wheel)(P.mouse[0][0]!==B[0]||P.mouse[0][1]!==B[1])&&(P.mouse[1]=Z.invert(P.mouse[0]=B)),clearTimeout(P.wheel);else{if(Z.k===L)return;P.mouse=[B,Z.invert(B)],zp(this),P.start()}zh(E),P.wheel=setTimeout(G,S),P.zoom("mouse",i(k(Q(Z,L),P.mouse[0],P.mouse[1]),P.extent,a));function G(){P.wheel=null,P.end()}}function H(E,...X){if(m||!t.apply(this,arguments))return;var P=E.currentTarget,Z=$(this,X,!0).event(E),L=Bn(E.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",K,!0),B=pr(E,P),G=E.clientX,z=E.clientY;iP(E.view),rv(E),Z.mouse=[B,this.__zoom.invert(B)],zp(this),Z.start();function q(ie){if(zh(ie),!Z.moved){var ce=ie.clientX-G,de=ie.clientY-z;Z.moved=ce*ce+de*de>_}Z.event(ie).zoom("mouse",i(k(Z.that.__zoom,Z.mouse[0]=pr(ie,P),Z.mouse[1]),Z.extent,a))}function K(ie){L.on("mousemove.zoom mouseup.zoom",null),nP(ie.view,Z.moved),zh(ie),Z.event(ie).end()}}function ee(E,...X){if(t.apply(this,arguments)){var P=this.__zoom,Z=pr(E.changedTouches?E.changedTouches[0]:E,this),L=P.invert(Z),B=P.k*(E.shiftKey?.5:2),G=i(k(Q(P,B),Z,L),e.apply(this,X),a);zh(E),c>0?Bn(this).transition().duration(c).call(M,G,Z,E):Bn(this).call(x.transform,G,Z,E)}}function I(E,...X){if(t.apply(this,arguments)){var P=E.touches,Z=P.length,L=$(this,X,E.changedTouches.length===Z).event(E),B,G,z,q;for(rv(E),G=0;G<Z;++G)z=P[G],q=pr(z,this),q=[q,this.__zoom.invert(q),z.identifier],L.touch0?!L.touch1&&L.touch0[2]!==q[2]&&(L.touch1=q,L.taps=0):(L.touch0=q,B=!0,L.taps=1+!!f);f&&(f=clearTimeout(f)),B&&(L.taps<2&&(g=q[0],f=setTimeout(function(){f=null},O)),zp(this),L.start())}}function j(E,...X){if(this.__zooming){var P=$(this,X).event(E),Z=E.changedTouches,L=Z.length,B,G,z,q;for(zh(E),B=0;B<L;++B)G=Z[B],z=pr(G,this),P.touch0&&P.touch0[2]===G.identifier?P.touch0[0]=z:P.touch1&&P.touch1[2]===G.identifier&&(P.touch1[0]=z);if(G=P.that.__zoom,P.touch1){var K=P.touch0[0],ie=P.touch0[1],ce=P.touch1[0],de=P.touch1[1],pe=(pe=ce[0]-K[0])*pe+(pe=ce[1]-K[1])*pe,fe=(fe=de[0]-ie[0])*fe+(fe=de[1]-ie[1])*fe;G=Q(G,Math.sqrt(pe/fe)),z=[(K[0]+ce[0])/2,(K[1]+ce[1])/2],q=[(ie[0]+de[0])/2,(ie[1]+de[1])/2]}else if(P.touch0)z=P.touch0[0],q=P.touch0[1];else return;P.zoom("touch",i(k(G,z,q),P.extent,a))}}function D(E,...X){if(this.__zooming){var P=$(this,X).event(E),Z=E.changedTouches,L=Z.length,B,G;for(rv(E),m&&clearTimeout(m),m=setTimeout(function(){m=null},O),B=0;B<L;++B)G=Z[B],P.touch0&&P.touch0[2]===G.identifier?delete P.touch0:P.touch1&&P.touch1[2]===G.identifier&&delete P.touch1;if(P.touch1&&!P.touch0&&(P.touch0=P.touch1,delete P.touch1),P.touch0)P.touch0[1]=this.__zoom.invert(P.touch0[0]);else if(P.end(),P.taps===2&&(G=pr(G,this),Math.hypot(g[0]-G[0],g[1]-G[1])<w)){var z=Bn(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return x.wheelDelta=function(E){return arguments.length?(n=typeof E=="function"?E:Vf(+E),x):n},x.filter=function(E){return arguments.length?(t=typeof E=="function"?E:Vf(!!E),x):t},x.touchable=function(E){return arguments.length?(r=typeof E=="function"?E:Vf(!!E),x):r},x.extent=function(E){return arguments.length?(e=typeof E=="function"?E:Vf([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),x):e},x.scaleExtent=function(E){return arguments.length?(s[0]=+E[0],s[1]=+E[1],x):[s[0],s[1]]},x.translateExtent=function(E){return arguments.length?(a[0][0]=+E[0][0],a[1][0]=+E[1][0],a[0][1]=+E[0][1],a[1][1]=+E[1][1],x):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},x.constrain=function(E){return arguments.length?(i=E,x):i},x.duration=function(E){return arguments.length?(c=+E,x):c},x.interpolate=function(E){return arguments.length?(h=E,x):h},x.on=function(){var E=d.on.apply(d,arguments);return E===d?x:E},x.clickDistance=function(E){return arguments.length?(_=(E=+E)*E,x):Math.sqrt(_)},x.tapDistance=function(E){return arguments.length?(w=+E,x):w},x}const Ur={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:i,targetHandle:n})=>`Couldn't create edge for ${t} handle id: "${t==="source"?i:n}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},wu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],SP=["Enter"," ","Escape"],bP={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:i})=>`Moved selected node ${t}. New position, x: ${e}, y: ${i}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var mc;(function(t){t.Strict="strict",t.Loose="loose"})(mc||(mc={}));var za;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(za||(za={}));var ku;(function(t){t.Partial="partial",t.Full="full"})(ku||(ku={}));const _P={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Eo;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Eo||(Eo={}));var hg;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(hg||(hg={}));var Re;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Re||(Re={}));const OC={[Re.Left]:Re.Right,[Re.Right]:Re.Left,[Re.Top]:Re.Bottom,[Re.Bottom]:Re.Top};function xP(t){return t===null?null:t?"valid":"invalid"}const wP=t=>"id"in t&&"source"in t&&"target"in t,ML=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),$1=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),Ju=(t,e=[0,0])=>{const{width:i,height:n}=Ds(t),r=t.origin??e,s=i*r[0],a=n*r[1];return{x:t.position.x-s,y:t.position.y-a}},zL=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const i=t.reduce((n,r)=>{const s=typeof r=="string";let a=!e.nodeLookup&&!s?r:void 0;e.nodeLookup&&(a=s?e.nodeLookup.get(r):$1(r)?r:e.nodeLookup.get(r.id));const c=a?ug(a,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return sm(n,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return om(i)},ed=(t,e={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},n=!1;return t.forEach(r=>{(e.filter===void 0||e.filter(r))&&(i=sm(i,ug(r)),n=!0)}),n?om(i):{x:0,y:0,width:0,height:0}},P1=(t,e,[i,n,r]=[0,0,1],s=!1,a=!1)=>{const c={...id(e,[i,n,r]),width:e.width/r,height:e.height/r},h=[];for(const d of t.values()){const{measured:f,selectable:g=!0,hidden:m=!1}=d;if(a&&!g||m)continue;const O=f.width??d.width??d.initialWidth??null,S=f.height??d.height??d.initialHeight??null,_=Cu(c,vc(d)),w=(O??0)*(S??0),x=s&&_>0;(!d.internals.handleBounds||x||_>=w||d.dragging)&&h.push(d)}return h},jL=(t,e)=>{const i=new Set;return t.forEach(n=>{i.add(n.id)}),e.filter(n=>i.has(n.source)||i.has(n.target))};function DL(t,e){const i=new Map,n=e!=null&&e.nodes?new Set(e.nodes.map(r=>r.id)):null;return t.forEach(r=>{r.measured.width&&r.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!r.hidden)&&(!n||n.has(r.id))&&i.set(r.id,r)}),i}async function BL({nodes:t,width:e,height:i,panZoom:n,minZoom:r,maxZoom:s},a){if(t.size===0)return Promise.resolve(!0);const c=DL(t,a),h=ed(c),d=E1(h,e,i,(a==null?void 0:a.minZoom)??r,(a==null?void 0:a.maxZoom)??s,(a==null?void 0:a.padding)??.1);return await n.setViewport(d,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)}function kP({nodeId:t,nextPosition:e,nodeLookup:i,nodeOrigin:n=[0,0],nodeExtent:r,onError:s}){const a=i.get(t),c=a.parentId?i.get(a.parentId):void 0,{x:h,y:d}=c?c.internals.positionAbsolute:{x:0,y:0},f=a.origin??n;let g=a.extent||r;if(a.extent==="parent"&&!a.expandParent)if(!c)s==null||s("005",Ur.error005());else{const O=c.measured.width,S=c.measured.height;O&&S&&(g=[[h,d],[h+O,d+S]])}else c&&yc(a.extent)&&(g=[[a.extent[0][0]+h,a.extent[0][1]+d],[a.extent[1][0]+h,a.extent[1][1]+d]]);const m=yc(g)?Na(e,g,a.measured):e;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",Ur.error015())),{position:{x:m.x-h+(a.measured.width??0)*f[0],y:m.y-d+(a.measured.height??0)*f[1]},positionAbsolute:m}}async function LL({nodesToRemove:t=[],edgesToRemove:e=[],nodes:i,edges:n,onBeforeDelete:r}){const s=new Set(t.map(m=>m.id)),a=[];for(const m of i){if(m.deletable===!1)continue;const O=s.has(m.id),S=!O&&m.parentId&&a.find(_=>_.id===m.parentId);(O||S)&&a.push(m)}const c=new Set(e.map(m=>m.id)),h=n.filter(m=>m.deletable!==!1),f=jL(a,h);for(const m of h)c.has(m.id)&&!f.find(S=>S.id===m.id)&&f.push(m);if(!r)return{edges:f,nodes:a};const g=await r({nodes:a,edges:f});return typeof g=="boolean"?g?{edges:f,nodes:a}:{edges:[],nodes:[]}:g}const Oc=(t,e=0,i=1)=>Math.min(Math.max(t,e),i),Na=(t={x:0,y:0},e,i)=>({x:Oc(t.x,e[0][0],e[1][0]-((i==null?void 0:i.width)??0)),y:Oc(t.y,e[0][1],e[1][1]-((i==null?void 0:i.height)??0))});function CP(t,e,i){const{width:n,height:r}=Ds(i),{x:s,y:a}=i.internals.positionAbsolute;return Na(t,[[s,a],[s+n,a+r]],e)}const vC=(t,e,i)=>t<e?Oc(Math.abs(t-e),1,e)/e:t>i?-Oc(Math.abs(t-i),1,e)/e:0,TP=(t,e,i=15,n=40)=>{const r=vC(t.x,n,e.width-n)*i,s=vC(t.y,n,e.height-n)*i;return[r,s]},sm=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Py=({x:t,y:e,width:i,height:n})=>({x:t,y:e,x2:t+i,y2:e+n}),om=({x:t,y:e,x2:i,y2:n})=>({x:t,y:e,width:i-t,height:n-e}),vc=(t,e=[0,0])=>{var r,s;const{x:i,y:n}=$1(t)?t.internals.positionAbsolute:Ju(t,e);return{x:i,y:n,width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((s=t.measured)==null?void 0:s.height)??t.height??t.initialHeight??0}},ug=(t,e=[0,0])=>{var r,s;const{x:i,y:n}=$1(t)?t.internals.positionAbsolute:Ju(t,e);return{x:i,y:n,x2:i+(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0),y2:n+(((s=t.measured)==null?void 0:s.height)??t.height??t.initialHeight??0)}},QP=(t,e)=>om(sm(Py(t),Py(e))),Cu=(t,e)=>{const i=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),n=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(i*n)},yC=t=>Or(t.width)&&Or(t.height)&&Or(t.x)&&Or(t.y),Or=t=>!isNaN(t)&&isFinite(t),XL=(t,e)=>{},td=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),id=({x:t,y:e},[i,n,r],s=!1,a=[1,1])=>{const c={x:(t-i)/r,y:(e-n)/r};return s?td(c,a):c},dg=({x:t,y:e},[i,n,r])=>({x:t*r+i,y:e*r+n});function Nl(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const i=parseFloat(t);if(!Number.isNaN(i))return Math.floor(i)}if(typeof t=="string"&&t.endsWith("%")){const i=parseFloat(t);if(!Number.isNaN(i))return Math.floor(e*i*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function NL(t,e,i){if(typeof t=="string"||typeof t=="number"){const n=Nl(t,i),r=Nl(t,e);return{top:n,right:r,bottom:n,left:r,x:r*2,y:n*2}}if(typeof t=="object"){const n=Nl(t.top??t.y??0,i),r=Nl(t.bottom??t.y??0,i),s=Nl(t.left??t.x??0,e),a=Nl(t.right??t.x??0,e);return{top:n,right:a,bottom:r,left:s,x:s+a,y:n+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ZL(t,e,i,n,r,s){const{x:a,y:c}=dg(t,[e,i,n]),{x:h,y:d}=dg({x:t.x+t.width,y:t.y+t.height},[e,i,n]),f=r-h,g=s-d;return{left:Math.floor(a),top:Math.floor(c),right:Math.floor(f),bottom:Math.floor(g)}}const E1=(t,e,i,n,r,s)=>{const a=NL(s,e,i),c=(e-a.x)/t.width,h=(i-a.y)/t.height,d=Math.min(c,h),f=Oc(d,n,r),g=t.x+t.width/2,m=t.y+t.height/2,O=e/2-g*f,S=i/2-m*f,_=ZL(t,O,S,f,e,i),w={left:Math.min(_.left-a.left,0),top:Math.min(_.top-a.top,0),right:Math.min(_.right-a.right,0),bottom:Math.min(_.bottom-a.bottom,0)};return{x:O-w.left+w.right,y:S-w.top+w.bottom,zoom:f}},Tu=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function yc(t){return t!=null&&t!=="parent"}function Ds(t){var e,i;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}}function $P(t){var e,i;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight)!==void 0}function PP(t,e={width:0,height:0},i,n,r){const s={...t},a=n.get(i);if(a){const c=a.origin||r;s.x+=a.internals.positionAbsolute.x-(e.width??0)*c[0],s.y+=a.internals.positionAbsolute.y-(e.height??0)*c[1]}return s}function SC(t,e){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}function WL(){let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}}function qL(t){return{...bP,...t||{}}}function hu(t,{snapGrid:e=[0,0],snapToGrid:i=!1,transform:n,containerBounds:r}){const{x:s,y:a}=vr(t),c=id({x:s-((r==null?void 0:r.left)??0),y:a-((r==null?void 0:r.top)??0)},n),{x:h,y:d}=i?td(c,e):c;return{xSnapped:h,ySnapped:d,...c}}const R1=t=>({width:t.offsetWidth,height:t.offsetHeight}),EP=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},VL=["INPUT","SELECT","TEXTAREA"];function RP(t){var n,r;const e=((r=(n=t.composedPath)==null?void 0:n.call(t))==null?void 0:r[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:VL.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const AP=t=>"clientX"in t,vr=(t,e)=>{var s,a;const i=AP(t),n=i?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=i?t.clientY:(a=t.touches)==null?void 0:a[0].clientY;return{x:n-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},bC=(t,e,i,n,r)=>{const s=e.querySelectorAll(`.${t}`);return!s||!s.length?null:Array.from(s).map(a=>{const c=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:t,nodeId:r,position:a.getAttribute("data-handlepos"),x:(c.left-i.left)/n,y:(c.top-i.top)/n,...R1(a)}})};function MP({sourceX:t,sourceY:e,targetX:i,targetY:n,sourceControlX:r,sourceControlY:s,targetControlX:a,targetControlY:c}){const h=t*.125+r*.375+a*.375+i*.125,d=e*.125+s*.375+c*.375+n*.125,f=Math.abs(h-t),g=Math.abs(d-e);return[h,d,f,g]}function If(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function _C({pos:t,x1:e,y1:i,x2:n,y2:r,c:s}){switch(t){case Re.Left:return[e-If(e-n,s),i];case Re.Right:return[e+If(n-e,s),i];case Re.Top:return[e,i-If(i-r,s)];case Re.Bottom:return[e,i+If(r-i,s)]}}function zP({sourceX:t,sourceY:e,sourcePosition:i=Re.Bottom,targetX:n,targetY:r,targetPosition:s=Re.Top,curvature:a=.25}){const[c,h]=_C({pos:i,x1:t,y1:e,x2:n,y2:r,c:a}),[d,f]=_C({pos:s,x1:n,y1:r,x2:t,y2:e,c:a}),[g,m,O,S]=MP({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:c,sourceControlY:h,targetControlX:d,targetControlY:f});return[`M${t},${e} C${c},${h} ${d},${f} ${n},${r}`,g,m,O,S]}function jP({sourceX:t,sourceY:e,targetX:i,targetY:n}){const r=Math.abs(i-t)/2,s=i<t?i+r:i-r,a=Math.abs(n-e)/2,c=n<e?n+a:n-a;return[s,c,r,a]}function IL({sourceNode:t,targetNode:e,selected:i=!1,zIndex:n=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return n;const a=r&&i?n+1e3:n,c=Math.max(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0);return a+c}function YL({sourceNode:t,targetNode:e,width:i,height:n,transform:r}){const s=sm(ug(t),ug(e));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const a={x:-r[0]/r[2],y:-r[1]/r[2],width:i/r[2],height:n/r[2]};return Cu(a,om(s))>0}const HL=({source:t,sourceHandle:e,target:i,targetHandle:n})=>`xy-edge__${t}${e||""}-${i}${n||""}`,UL=(t,e)=>e.some(i=>i.source===t.source&&i.target===t.target&&(i.sourceHandle===t.sourceHandle||!i.sourceHandle&&!t.sourceHandle)&&(i.targetHandle===t.targetHandle||!i.targetHandle&&!t.targetHandle)),GL=(t,e,i={})=>{if(!t.source||!t.target)return e;const n=i.getEdgeId||HL;let r;return wP(t)?r={...t}:r={...t,id:n(t)},UL(r,e)?e:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,e.concat(r))};function DP({sourceX:t,sourceY:e,targetX:i,targetY:n}){const[r,s,a,c]=jP({sourceX:t,sourceY:e,targetX:i,targetY:n});return[`M ${t},${e}L ${i},${n}`,r,s,a,c]}const xC={[Re.Left]:{x:-1,y:0},[Re.Right]:{x:1,y:0},[Re.Top]:{x:0,y:-1},[Re.Bottom]:{x:0,y:1}},FL=({source:t,sourcePosition:e=Re.Bottom,target:i})=>e===Re.Left||e===Re.Right?t.x<i.x?{x:1,y:0}:{x:-1,y:0}:t.y<i.y?{x:0,y:1}:{x:0,y:-1},wC=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function KL({source:t,sourcePosition:e=Re.Bottom,target:i,targetPosition:n=Re.Top,center:r,offset:s,stepPosition:a}){const c=xC[e],h=xC[n],d={x:t.x+c.x*s,y:t.y+c.y*s},f={x:i.x+h.x*s,y:i.y+h.y*s},g=FL({source:d,sourcePosition:e,target:f}),m=g.x!==0?"x":"y",O=g[m];let S=[],_,w;const x={x:0,y:0},Q={x:0,y:0},[,,k,T]=jP({sourceX:t.x,sourceY:t.y,targetX:i.x,targetY:i.y});if(c[m]*h[m]===-1){m==="x"?(_=r.x??d.x+(f.x-d.x)*a,w=r.y??(d.y+f.y)/2):(_=r.x??(d.x+f.x)/2,w=r.y??d.y+(f.y-d.y)*a);const V=[{x:_,y:d.y},{x:_,y:f.y}],H=[{x:d.x,y:w},{x:f.x,y:w}];c[m]===O?S=m==="x"?V:H:S=m==="x"?H:V}else{const V=[{x:d.x,y:f.y}],H=[{x:f.x,y:d.y}];if(m==="x"?S=c.x===O?H:V:S=c.y===O?V:H,e===n){const E=Math.abs(t[m]-i[m]);if(E<=s){const X=Math.min(s-1,s-E);c[m]===O?x[m]=(d[m]>t[m]?-1:1)*X:Q[m]=(f[m]>i[m]?-1:1)*X}}if(e!==n){const E=m==="x"?"y":"x",X=c[m]===h[E],P=d[E]>f[E],Z=d[E]<f[E];(c[m]===1&&(!X&&P||X&&Z)||c[m]!==1&&(!X&&Z||X&&P))&&(S=m==="x"?V:H)}const ee={x:d.x+x.x,y:d.y+x.y},I={x:f.x+Q.x,y:f.y+Q.y},j=Math.max(Math.abs(ee.x-S[0].x),Math.abs(I.x-S[0].x)),D=Math.max(Math.abs(ee.y-S[0].y),Math.abs(I.y-S[0].y));j>=D?(_=(ee.x+I.x)/2,w=S[0].y):(_=S[0].x,w=(ee.y+I.y)/2)}const M={x:d.x+x.x,y:d.y+x.y},$={x:f.x+Q.x,y:f.y+Q.y};return[[t,...M.x!==S[0].x||M.y!==S[0].y?[M]:[],...S,...$.x!==S[S.length-1].x||$.y!==S[S.length-1].y?[$]:[],i],_,w,k,T]}function JL(t,e,i,n){const r=Math.min(wC(t,e)/2,wC(e,i)/2,n),{x:s,y:a}=e;if(t.x===s&&s===i.x||t.y===a&&a===i.y)return`L${s} ${a}`;if(t.y===a){const d=t.x<i.x?-1:1,f=t.y<i.y?1:-1;return`L ${s+r*d},${a}Q ${s},${a} ${s},${a+r*f}`}const c=t.x<i.x?1:-1,h=t.y<i.y?-1:1;return`L ${s},${a+r*h}Q ${s},${a} ${s+r*c},${a}`}function Ey({sourceX:t,sourceY:e,sourcePosition:i=Re.Bottom,targetX:n,targetY:r,targetPosition:s=Re.Top,borderRadius:a=5,centerX:c,centerY:h,offset:d=20,stepPosition:f=.5}){const[g,m,O,S,_]=KL({source:{x:t,y:e},sourcePosition:i,target:{x:n,y:r},targetPosition:s,center:{x:c,y:h},offset:d,stepPosition:f});let w=`M${g[0].x} ${g[0].y}`;for(let x=1;x<g.length-1;x++)w+=JL(g[x-1],g[x],g[x+1],a);return w+=`L${g[g.length-1].x} ${g[g.length-1].y}`,[w,m,O,S,_]}function kC(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function e6(t){var g;const{sourceNode:e,targetNode:i}=t;if(!kC(e)||!kC(i))return null;const n=e.internals.handleBounds||CC(e.handles),r=i.internals.handleBounds||CC(i.handles),s=TC((n==null?void 0:n.source)??[],t.sourceHandle),a=TC(t.connectionMode===mc.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),t.targetHandle);if(!s||!a)return(g=t.onError)==null||g.call(t,"008",Ur.error008(s?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const c=(s==null?void 0:s.position)||Re.Bottom,h=(a==null?void 0:a.position)||Re.Top,d=Za(e,s,c),f=Za(i,a,h);return{sourceX:d.x,sourceY:d.y,targetX:f.x,targetY:f.y,sourcePosition:c,targetPosition:h}}function CC(t){if(!t)return null;const e=[],i=[];for(const n of t)n.width=n.width??1,n.height=n.height??1,n.type==="source"?e.push(n):n.type==="target"&&i.push(n);return{source:e,target:i}}function Za(t,e,i=Re.Left,n=!1){const r=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,s=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:a,height:c}=e??Ds(t);if(n)return{x:r+a/2,y:s+c/2};switch((e==null?void 0:e.position)??i){case Re.Top:return{x:r+a/2,y:s};case Re.Right:return{x:r+a,y:s+c/2};case Re.Bottom:return{x:r+a/2,y:s+c};case Re.Left:return{x:r,y:s+c/2}}}function TC(t,e){return t&&(e?t.find(i=>i.id===e):t[0])||null}function Ry(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`:""}function t6(t,{id:e,defaultColor:i,defaultMarkerStart:n,defaultMarkerEnd:r}){const s=new Set;return t.reduce((a,c)=>([c.markerStart||n,c.markerEnd||r].forEach(h=>{if(h&&typeof h=="object"){const d=Ry(h,e);s.has(d)||(a.push({id:d,color:h.color||i,...h}),s.add(d))}}),a),[]).sort((a,c)=>a.id.localeCompare(c.id))}const BP=1e3,i6=10,A1={nodeOrigin:[0,0],nodeExtent:wu,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},n6={...A1,checkEquality:!0};function M1(t,e){const i={...t};for(const n in e)e[n]!==void 0&&(i[n]=e[n]);return i}function r6(t,e,i){const n=M1(A1,i);for(const r of t.values())if(r.parentId)j1(r,t,e,n);else{const s=Ju(r,n.nodeOrigin),a=yc(r.extent)?r.extent:n.nodeExtent,c=Na(s,a,Ds(r));r.internals.positionAbsolute=c}}function s6(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const i=[],n=[];for(const r of t.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:t.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?i.push(s):r.type==="target"&&n.push(s)}return{source:i,target:n}}function z1(t){return t==="manual"}function Ay(t,e,i,n={}){var f,g;const r=M1(n6,n),s={i:0},a=new Map(e),c=r!=null&&r.elevateNodesOnSelect&&!z1(r.zIndexMode)?BP:0;let h=t.length>0,d=!1;e.clear(),i.clear();for(const m of t){let O=a.get(m.id);if(r.checkEquality&&m===(O==null?void 0:O.internals.userNode))e.set(m.id,O);else{const S=Ju(m,r.nodeOrigin),_=yc(m.extent)?m.extent:r.nodeExtent,w=Na(S,_,Ds(m));O={...r.defaults,...m,measured:{width:(f=m.measured)==null?void 0:f.width,height:(g=m.measured)==null?void 0:g.height},internals:{positionAbsolute:w,handleBounds:s6(m,O),z:LP(m,c,r.zIndexMode),userNode:m}},e.set(m.id,O)}(O.measured===void 0||O.measured.width===void 0||O.measured.height===void 0)&&!O.hidden&&(h=!1),m.parentId&&j1(O,e,i,n,s),d||(d=m.selected??!1)}return{nodesInitialized:h,hasSelectedNodes:d}}function o6(t,e){if(!t.parentId)return;const i=e.get(t.parentId);i?i.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function j1(t,e,i,n,r){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:c,zIndexMode:h}=M1(A1,n),d=t.parentId,f=e.get(d);if(!f){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}o6(t,i),r&&!f.parentId&&f.internals.rootParentIndex===void 0&&h==="auto"&&(f.internals.rootParentIndex=++r.i,f.internals.z=f.internals.z+r.i*i6),r&&f.internals.rootParentIndex!==void 0&&(r.i=f.internals.rootParentIndex);const g=s&&!z1(h)?BP:0,{x:m,y:O,z:S}=a6(t,f,a,c,g,h),{positionAbsolute:_}=t.internals,w=m!==_.x||O!==_.y;(w||S!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:w?{x:m,y:O}:_,z:S}})}function LP(t,e,i){const n=Or(t.zIndex)?t.zIndex:0;return z1(i)?n:n+(t.selected?e:0)}function a6(t,e,i,n,r,s){const{x:a,y:c}=e.internals.positionAbsolute,h=Ds(t),d=Ju(t,i),f=yc(t.extent)?Na(d,t.extent,h):d;let g=Na({x:a+f.x,y:c+f.y},n,h);t.extent==="parent"&&(g=CP(g,h,e));const m=LP(t,r,s),O=e.internals.z??0;return{x:g.x,y:g.y,z:O>=m?O+1:m}}function D1(t,e,i,n=[0,0]){var a;const r=[],s=new Map;for(const c of t){const h=e.get(c.parentId);if(!h)continue;const d=((a=s.get(c.parentId))==null?void 0:a.expandedRect)??vc(h),f=QP(d,c.rect);s.set(c.parentId,{expandedRect:f,parent:h})}return s.size>0&&s.forEach(({expandedRect:c,parent:h},d)=>{var k;const f=h.internals.positionAbsolute,g=Ds(h),m=h.origin??n,O=c.x<f.x?Math.round(Math.abs(f.x-c.x)):0,S=c.y<f.y?Math.round(Math.abs(f.y-c.y)):0,_=Math.max(g.width,Math.round(c.width)),w=Math.max(g.height,Math.round(c.height)),x=(_-g.width)*m[0],Q=(w-g.height)*m[1];(O>0||S>0||x||Q)&&(r.push({id:d,type:"position",position:{x:h.position.x-O+x,y:h.position.y-S+Q}}),(k=i.get(d))==null||k.forEach(T=>{t.some(M=>M.id===T.id)||r.push({id:T.id,type:"position",position:{x:T.position.x+O,y:T.position.y+S}})})),(g.width<c.width||g.height<c.height||O||S)&&r.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:_+(O?m[0]*O-x:0),height:w+(S?m[1]*S-Q:0)}})}),r}function l6(t,e,i,n,r,s,a){const c=n==null?void 0:n.querySelector(".xyflow__viewport");let h=!1;if(!c)return{changes:[],updatedInternals:h};const d=[],f=window.getComputedStyle(c),{m22:g}=new window.DOMMatrixReadOnly(f.transform),m=[];for(const O of t.values()){const S=e.get(O.id);if(!S)continue;if(S.hidden){e.set(S.id,{...S,internals:{...S.internals,handleBounds:void 0}}),h=!0;continue}const _=R1(O.nodeElement),w=S.measured.width!==_.width||S.measured.height!==_.height;if(!!(_.width&&_.height&&(w||!S.internals.handleBounds||O.force))){const Q=O.nodeElement.getBoundingClientRect(),k=yc(S.extent)?S.extent:s;let{positionAbsolute:T}=S.internals;S.parentId&&S.extent==="parent"?T=CP(T,_,e.get(S.parentId)):k&&(T=Na(T,k,_));const M={...S,measured:_,internals:{...S.internals,positionAbsolute:T,handleBounds:{source:bC("source",O.nodeElement,Q,g,S.id),target:bC("target",O.nodeElement,Q,g,S.id)}}};e.set(S.id,M),S.parentId&&j1(M,e,i,{nodeOrigin:r,zIndexMode:a}),h=!0,w&&(d.push({id:S.id,type:"dimensions",dimensions:_}),S.expandParent&&S.parentId&&m.push({id:S.id,parentId:S.parentId,rect:vc(M,r)}))}}if(m.length>0){const O=D1(m,e,i,r);d.push(...O)}return{changes:d,updatedInternals:h}}async function c6({delta:t,panZoom:e,transform:i,translateExtent:n,width:r,height:s}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const a=await e.setViewportConstrained({x:i[0]+t.x,y:i[1]+t.y,zoom:i[2]},[[0,0],[r,s]],n),c=!!a&&(a.x!==i[0]||a.y!==i[1]||a.k!==i[2]);return Promise.resolve(c)}function QC(t,e,i,n,r,s){let a=r;const c=n.get(a)||new Map;n.set(a,c.set(i,e)),a=`${r}-${t}`;const h=n.get(a)||new Map;if(n.set(a,h.set(i,e)),s){a=`${r}-${t}-${s}`;const d=n.get(a)||new Map;n.set(a,d.set(i,e))}}function XP(t,e,i){t.clear(),e.clear();for(const n of i){const{source:r,target:s,sourceHandle:a=null,targetHandle:c=null}=n,h={edgeId:n.id,source:r,target:s,sourceHandle:a,targetHandle:c},d=`${r}-${a}--${s}-${c}`,f=`${s}-${c}--${r}-${a}`;QC("source",h,f,t,r,a),QC("target",h,d,t,s,c),e.set(n.id,n)}}function NP(t,e){if(!t.parentId)return!1;const i=e.get(t.parentId);return i?i.selected?!0:NP(i,e):!1}function $C(t,e,i){var r;let n=t;do{if((r=n==null?void 0:n.matches)!=null&&r.call(n,e))return!0;if(n===i)return!1;n=n==null?void 0:n.parentElement}while(n);return!1}function h6(t,e,i,n){const r=new Map;for(const[s,a]of t)if((a.selected||a.id===n)&&(!a.parentId||!NP(a,t))&&(a.draggable||e&&typeof a.draggable>"u")){const c=t.get(s);c&&r.set(s,{id:s,position:c.position||{x:0,y:0},distance:{x:i.x-c.internals.positionAbsolute.x,y:i.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return r}function sv({nodeId:t,dragItems:e,nodeLookup:i,dragging:n=!0}){var a,c,h;const r=[];for(const[d,f]of e){const g=(a=i.get(d))==null?void 0:a.internals.userNode;g&&r.push({...g,position:f.position,dragging:n})}if(!t)return[r[0],r];const s=(c=i.get(t))==null?void 0:c.internals.userNode;return[s?{...s,position:((h=e.get(t))==null?void 0:h.position)||s.position,dragging:n}:r[0],r]}function u6({dragItems:t,snapGrid:e,x:i,y:n}){const r=t.values().next().value;if(!r)return null;const s={x:i-r.distance.x,y:n-r.distance.y},a=td(s,e);return{x:a.x-s.x,y:a.y-s.y}}function d6({onNodeMouseDown:t,getStoreItems:e,onDragStart:i,onDrag:n,onDragStop:r}){let s={x:null,y:null},a=0,c=new Map,h=!1,d={x:0,y:0},f=null,g=!1,m=null,O=!1,S=!1,_=null;function w({noDragClassName:Q,handleSelector:k,domNode:T,isSelectable:M,nodeId:$,nodeClickDistance:R=0}){m=Bn(T);function V({x:j,y:D}){const{nodeLookup:E,nodeExtent:X,snapGrid:P,snapToGrid:Z,nodeOrigin:L,onNodeDrag:B,onSelectionDrag:G,onError:z,updateNodePositions:q}=e();s={x:j,y:D};let K=!1;const ie=c.size>1,ce=ie&&X?Py(ed(c)):null,de=ie&&Z?u6({dragItems:c,snapGrid:P,x:j,y:D}):null;for(const[pe,fe]of c){if(!E.has(pe))continue;let ve={x:j-fe.distance.x,y:D-fe.distance.y};Z&&(ve=de?{x:Math.round(ve.x+de.x),y:Math.round(ve.y+de.y)}:td(ve,P));let De=null;if(ie&&X&&!fe.extent&&ce){const{positionAbsolute:me}=fe.internals,Be=me.x-ce.x+X[0][0],lt=me.x+fe.measured.width-ce.x2+X[1][0],Ue=me.y-ce.y+X[0][1],Ft=me.y+fe.measured.height-ce.y2+X[1][1];De=[[Be,Ue],[lt,Ft]]}const{position:Ee,positionAbsolute:ke}=kP({nodeId:pe,nextPosition:ve,nodeLookup:E,nodeExtent:De||X,nodeOrigin:L,onError:z});K=K||fe.position.x!==Ee.x||fe.position.y!==Ee.y,fe.position=Ee,fe.internals.positionAbsolute=ke}if(S=S||K,!!K&&(q(c,!0),_&&(n||B||!$&&G))){const[pe,fe]=sv({nodeId:$,dragItems:c,nodeLookup:E});n==null||n(_,c,pe,fe),B==null||B(_,pe,fe),$||G==null||G(_,fe)}}async function H(){if(!f)return;const{transform:j,panBy:D,autoPanSpeed:E,autoPanOnNodeDrag:X}=e();if(!X){h=!1,cancelAnimationFrame(a);return}const[P,Z]=TP(d,f,E);(P!==0||Z!==0)&&(s.x=(s.x??0)-P/j[2],s.y=(s.y??0)-Z/j[2],await D({x:P,y:Z})&&V(s)),a=requestAnimationFrame(H)}function ee(j){var ie;const{nodeLookup:D,multiSelectionActive:E,nodesDraggable:X,transform:P,snapGrid:Z,snapToGrid:L,selectNodesOnDrag:B,onNodeDragStart:G,onSelectionDragStart:z,unselectNodesAndEdges:q}=e();g=!0,(!B||!M)&&!E&&$&&((ie=D.get($))!=null&&ie.selected||q()),M&&B&&$&&(t==null||t($));const K=hu(j.sourceEvent,{transform:P,snapGrid:Z,snapToGrid:L,containerBounds:f});if(s=K,c=h6(D,X,K,$),c.size>0&&(i||G||!$&&z)){const[ce,de]=sv({nodeId:$,dragItems:c,nodeLookup:D});i==null||i(j.sourceEvent,c,ce,de),G==null||G(j.sourceEvent,ce,de),$||z==null||z(j.sourceEvent,de)}}const I=rP().clickDistance(R).on("start",j=>{const{domNode:D,nodeDragThreshold:E,transform:X,snapGrid:P,snapToGrid:Z}=e();f=(D==null?void 0:D.getBoundingClientRect())||null,O=!1,S=!1,_=j.sourceEvent,E===0&&ee(j),s=hu(j.sourceEvent,{transform:X,snapGrid:P,snapToGrid:Z,containerBounds:f}),d=vr(j.sourceEvent,f)}).on("drag",j=>{const{autoPanOnNodeDrag:D,transform:E,snapGrid:X,snapToGrid:P,nodeDragThreshold:Z,nodeLookup:L}=e(),B=hu(j.sourceEvent,{transform:E,snapGrid:X,snapToGrid:P,containerBounds:f});if(_=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||$&&!L.has($))&&(O=!0),!O){if(!h&&D&&g&&(h=!0,H()),!g){const G=vr(j.sourceEvent,f),z=G.x-d.x,q=G.y-d.y;Math.sqrt(z*z+q*q)>Z&&ee(j)}(s.x!==B.xSnapped||s.y!==B.ySnapped)&&c&&g&&(d=vr(j.sourceEvent,f),V(B))}}).on("end",j=>{if(!(!g||O)&&(h=!1,g=!1,cancelAnimationFrame(a),c.size>0)){const{nodeLookup:D,updateNodePositions:E,onNodeDragStop:X,onSelectionDragStop:P}=e();if(S&&(E(c,!1),S=!1),r||X||!$&&P){const[Z,L]=sv({nodeId:$,dragItems:c,nodeLookup:D,dragging:!1});r==null||r(j.sourceEvent,c,Z,L),X==null||X(j.sourceEvent,Z,L),$||P==null||P(j.sourceEvent,L)}}}).filter(j=>{const D=j.target;return!j.button&&(!Q||!$C(D,`.${Q}`,T))&&(!k||$C(D,k,T))});m.call(I)}function x(){m==null||m.on(".drag",null)}return{update:w,destroy:x}}function f6(t,e,i){const n=[],r={x:t.x-i,y:t.y-i,width:i*2,height:i*2};for(const s of e.values())Cu(r,vc(s))>0&&n.push(s);return n}const p6=250;function g6(t,e,i,n){var c,h;let r=[],s=1/0;const a=f6(t,i,e+p6);for(const d of a){const f=[...((c=d.internals.handleBounds)==null?void 0:c.source)??[],...((h=d.internals.handleBounds)==null?void 0:h.target)??[]];for(const g of f){if(n.nodeId===g.nodeId&&n.type===g.type&&n.id===g.id)continue;const{x:m,y:O}=Za(d,g,g.position,!0),S=Math.sqrt(Math.pow(m-t.x,2)+Math.pow(O-t.y,2));S>e||(S<s?(r=[{...g,x:m,y:O}],s=S):S===s&&r.push({...g,x:m,y:O}))}}if(!r.length)return null;if(r.length>1){const d=n.type==="source"?"target":"source";return r.find(f=>f.type===d)??r[0]}return r[0]}function ZP(t,e,i,n,r,s=!1){var d,f,g;const a=n.get(t);if(!a)return null;const c=r==="strict"?(d=a.internals.handleBounds)==null?void 0:d[e]:[...((f=a.internals.handleBounds)==null?void 0:f.source)??[],...((g=a.internals.handleBounds)==null?void 0:g.target)??[]],h=(i?c==null?void 0:c.find(m=>m.id===i):c==null?void 0:c[0])??null;return h&&s?{...h,...Za(a,h,h.position,!0)}:h}function WP(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function m6(t,e){let i=null;return e?i=!0:t&&!e&&(i=!1),i}const qP=()=>!0;function O6(t,{connectionMode:e,connectionRadius:i,handleId:n,nodeId:r,edgeUpdaterType:s,isTarget:a,domNode:c,nodeLookup:h,lib:d,autoPanOnConnect:f,flowId:g,panBy:m,cancelConnection:O,onConnectStart:S,onConnect:_,onConnectEnd:w,isValidConnection:x=qP,onReconnectEnd:Q,updateConnection:k,getTransform:T,getFromHandle:M,autoPanSpeed:$,dragThreshold:R=1,handleDomNode:V}){const H=EP(t.target);let ee=0,I;const{x:j,y:D}=vr(t),E=WP(s,V),X=c==null?void 0:c.getBoundingClientRect();let P=!1;if(!X||!E)return;const Z=ZP(r,E,n,h,e);if(!Z)return;let L=vr(t,X),B=!1,G=null,z=!1,q=null;function K(){if(!f||!X)return;const[Ee,ke]=TP(L,X,$);m({x:Ee,y:ke}),ee=requestAnimationFrame(K)}const ie={...Z,nodeId:r,type:E,position:Z.position},ce=h.get(r);let pe={inProgress:!0,isValid:null,from:Za(ce,ie,Re.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:ce,to:L,toHandle:null,toPosition:OC[ie.position],toNode:null,pointer:L};function fe(){P=!0,k(pe),S==null||S(t,{nodeId:r,handleId:n,handleType:E})}R===0&&fe();function ve(Ee){if(!P){const{x:Ft,y:rn}=vr(Ee),qi=Ft-j,_n=rn-D;if(!(qi*qi+_n*_n>R*R))return;fe()}if(!M()||!ie){De(Ee);return}const ke=T();L=vr(Ee,X),I=g6(id(L,ke,!1,[1,1]),i,h,ie),B||(K(),B=!0);const me=VP(Ee,{handle:I,connectionMode:e,fromNodeId:r,fromHandleId:n,fromType:a?"target":"source",isValidConnection:x,doc:H,lib:d,flowId:g,nodeLookup:h});q=me.handleDomNode,G=me.connection,z=m6(!!I,me.isValid);const Be=h.get(r),lt=Be?Za(Be,ie,Re.Left,!0):pe.from,Ue={...pe,from:lt,isValid:z,to:me.toHandle&&z?dg({x:me.toHandle.x,y:me.toHandle.y},ke):L,toHandle:me.toHandle,toPosition:z&&me.toHandle?me.toHandle.position:OC[ie.position],toNode:me.toHandle?h.get(me.toHandle.nodeId):null,pointer:L};k(Ue),pe=Ue}function De(Ee){if(!("touches"in Ee&&Ee.touches.length>0)){if(P){(I||q)&&G&&z&&(_==null||_(G));const{inProgress:ke,...me}=pe,Be={...me,toPosition:pe.toHandle?pe.toPosition:null};w==null||w(Ee,Be),s&&(Q==null||Q(Ee,Be))}O(),cancelAnimationFrame(ee),B=!1,z=!1,G=null,q=null,H.removeEventListener("mousemove",ve),H.removeEventListener("mouseup",De),H.removeEventListener("touchmove",ve),H.removeEventListener("touchend",De)}}H.addEventListener("mousemove",ve),H.addEventListener("mouseup",De),H.addEventListener("touchmove",ve),H.addEventListener("touchend",De)}function VP(t,{handle:e,connectionMode:i,fromNodeId:n,fromHandleId:r,fromType:s,doc:a,lib:c,flowId:h,isValidConnection:d=qP,nodeLookup:f}){const g=s==="target",m=e?a.querySelector(`.${c}-flow__handle[data-id="${h}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:O,y:S}=vr(t),_=a.elementFromPoint(O,S),w=_!=null&&_.classList.contains(`${c}-flow__handle`)?_:m,x={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const Q=WP(void 0,w),k=w.getAttribute("data-nodeid"),T=w.getAttribute("data-handleid"),M=w.classList.contains("connectable"),$=w.classList.contains("connectableend");if(!k||!Q)return x;const R={source:g?k:n,sourceHandle:g?T:r,target:g?n:k,targetHandle:g?r:T};x.connection=R;const H=M&&$&&(i===mc.Strict?g&&Q==="source"||!g&&Q==="target":k!==n||T!==r);x.isValid=H&&d(R),x.toHandle=ZP(k,Q,T,f,i,!0)}return x}const My={onPointerDown:O6,isValid:VP};function v6({domNode:t,panZoom:e,getTransform:i,getViewScale:n}){const r=Bn(t);function s({translateExtent:c,width:h,height:d,zoomStep:f=1,pannable:g=!0,zoomable:m=!0,inversePan:O=!1}){const S=k=>{if(k.sourceEvent.type!=="wheel"||!e)return;const T=i(),M=k.sourceEvent.ctrlKey&&Tu()?10:1,$=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*f,R=T[2]*Math.pow(2,$*M);e.scaleTo(R)};let _=[0,0];const w=k=>{(k.sourceEvent.type==="mousedown"||k.sourceEvent.type==="touchstart")&&(_=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY])},x=k=>{const T=i();if(k.sourceEvent.type!=="mousemove"&&k.sourceEvent.type!=="touchmove"||!e)return;const M=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],$=[M[0]-_[0],M[1]-_[1]];_=M;const R=n()*Math.max(T[2],Math.log(T[2]))*(O?-1:1),V={x:T[0]-$[0]*R,y:T[1]-$[1]*R},H=[[0,0],[h,d]];e.setViewportConstrained({x:V.x,y:V.y,zoom:T[2]},H,c)},Q=yP().on("start",w).on("zoom",g?x:null).on("zoom.wheel",m?S:null);r.call(Q,{})}function a(){r.on("zoom",null)}return{update:s,destroy:a,pointer:pr}}const am=t=>({x:t.x,y:t.y,zoom:t.k}),ov=({x:t,y:e,zoom:i})=>rm.translate(t,e).scale(i),Gl=(t,e)=>t.target.closest(`.${e}`),IP=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),y6=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,av=(t,e=0,i=y6,n=()=>{})=>{const r=typeof e=="number"&&e>0;return r||n(),r?t.transition().duration(e).ease(i).on("end",n):t},YP=t=>{const e=t.ctrlKey&&Tu()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function S6({zoomPanValues:t,noWheelClassName:e,d3Selection:i,d3Zoom:n,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:c,onPanZoom:h,onPanZoomEnd:d}){return f=>{if(Gl(f,e))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const g=i.property("__zoom").k||1;if(f.ctrlKey&&a){const w=pr(f),x=YP(f),Q=g*Math.pow(2,x);n.scaleTo(i,Q,w,f);return}const m=f.deltaMode===1?20:1;let O=r===za.Vertical?0:f.deltaX*m,S=r===za.Horizontal?0:f.deltaY*m;!Tu()&&f.shiftKey&&r!==za.Vertical&&(O=f.deltaY*m,S=0),n.translateBy(i,-(O/g)*s,-(S/g)*s,{internal:!0});const _=am(i.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(h==null||h(f,_),t.panScrollTimeout=setTimeout(()=>{d==null||d(f,_),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,c==null||c(f,_))}}function b6({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:i}){return function(n,r){const s=n.type==="wheel",a=!e&&s&&!n.ctrlKey,c=Gl(n,t);if(n.ctrlKey&&s&&c&&n.preventDefault(),a||c)return null;n.preventDefault(),i.call(this,n,r)}}function _6({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:i}){return n=>{var s,a,c;if((s=n.sourceEvent)!=null&&s.internal)return;const r=am(n.transform);t.mouseButton=((a=n.sourceEvent)==null?void 0:a.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=r,((c=n.sourceEvent)==null?void 0:c.type)==="mousedown"&&e(!0),i&&(i==null||i(n.sourceEvent,r))}}function x6({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:i,onTransformChange:n,onPanZoom:r}){return s=>{var a,c;t.usedRightMouseButton=!!(i&&IP(e,t.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||n([s.transform.x,s.transform.y,s.transform.k]),r&&!((c=s.sourceEvent)!=null&&c.internal)&&(r==null||r(s.sourceEvent,am(s.transform)))}}function w6({zoomPanValues:t,panOnDrag:e,panOnScroll:i,onDraggingChange:n,onPanZoomEnd:r,onPaneContextMenu:s}){return a=>{var c;if(!((c=a.sourceEvent)!=null&&c.internal)&&(t.isZoomingOrPanning=!1,s&&IP(e,t.mouseButton??0)&&!t.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),t.usedRightMouseButton=!1,n(!1),r)){const h=am(a.transform);t.prevViewport=h,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{r==null||r(a.sourceEvent,h)},i?150:0)}}}function k6({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:i,panOnDrag:n,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:h,lib:d,connectionInProgress:f}){return g=>{var w;const m=t||e,O=i&&g.ctrlKey,S=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(Gl(g,`${d}-flow__node`)||Gl(g,`${d}-flow__edge`)))return!0;if(!n&&!m&&!r&&!s&&!i||a||f&&!S||Gl(g,c)&&S||Gl(g,h)&&(!S||r&&S&&!t)||!i&&g.ctrlKey&&S)return!1;if(!i&&g.type==="touchstart"&&((w=g.touches)==null?void 0:w.length)>1)return g.preventDefault(),!1;if(!m&&!r&&!O&&S||!n&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(n)&&!n.includes(g.button)&&g.type==="mousedown")return!1;const _=Array.isArray(n)&&n.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||S)&&_}}function C6({domNode:t,minZoom:e,maxZoom:i,translateExtent:n,viewport:r,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:h}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=t.getBoundingClientRect(),g=yP().scaleExtent([e,i]).translateExtent(n),m=Bn(t).call(g);Q({x:r.x,y:r.y,zoom:Oc(r.zoom,e,i)},[[0,0],[f.width,f.height]],n);const O=m.on("wheel.zoom"),S=m.on("dblclick.zoom");g.wheelDelta(YP);function _(I,j){return m?new Promise(D=>{g==null||g.interpolate((j==null?void 0:j.interpolate)==="linear"?cu:Rp).transform(av(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>D(!0)),I)}):Promise.resolve(!1)}function w({noWheelClassName:I,noPanClassName:j,onPaneContextMenu:D,userSelectionActive:E,panOnScroll:X,panOnDrag:P,panOnScrollMode:Z,panOnScrollSpeed:L,preventScrolling:B,zoomOnPinch:G,zoomOnScroll:z,zoomOnDoubleClick:q,zoomActivationKeyPressed:K,lib:ie,onTransformChange:ce,connectionInProgress:de,paneClickDistance:pe,selectionOnDrag:fe}){E&&!d.isZoomingOrPanning&&x();const ve=X&&!K&&!E;g.clickDistance(fe?1/0:!Or(pe)||pe<0?0:pe);const De=ve?S6({zoomPanValues:d,noWheelClassName:I,d3Selection:m,d3Zoom:g,panOnScrollMode:Z,panOnScrollSpeed:L,zoomOnPinch:G,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:c}):b6({noWheelClassName:I,preventScrolling:B,d3ZoomHandler:O});if(m.on("wheel.zoom",De,{passive:!1}),!E){const ke=_6({zoomPanValues:d,onDraggingChange:h,onPanZoomStart:a});g.on("start",ke);const me=x6({zoomPanValues:d,panOnDrag:P,onPaneContextMenu:!!D,onPanZoom:s,onTransformChange:ce});g.on("zoom",me);const Be=w6({zoomPanValues:d,panOnDrag:P,panOnScroll:X,onPaneContextMenu:D,onPanZoomEnd:c,onDraggingChange:h});g.on("end",Be)}const Ee=k6({zoomActivationKeyPressed:K,panOnDrag:P,zoomOnScroll:z,panOnScroll:X,zoomOnDoubleClick:q,zoomOnPinch:G,userSelectionActive:E,noPanClassName:j,noWheelClassName:I,lib:ie,connectionInProgress:de});g.filter(Ee),q?m.on("dblclick.zoom",S):m.on("dblclick.zoom",null)}function x(){g.on("zoom",null)}async function Q(I,j,D){const E=ov(I),X=g==null?void 0:g.constrain()(E,j,D);return X&&await _(X),new Promise(P=>P(X))}async function k(I,j){const D=ov(I);return await _(D,j),new Promise(E=>E(D))}function T(I){if(m){const j=ov(I),D=m.property("__zoom");(D.k!==I.zoom||D.x!==I.x||D.y!==I.y)&&(g==null||g.transform(m,j,null,{sync:!0}))}}function M(){const I=m?vP(m.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function $(I,j){return m?new Promise(D=>{g==null||g.interpolate((j==null?void 0:j.interpolate)==="linear"?cu:Rp).scaleTo(av(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>D(!0)),I)}):Promise.resolve(!1)}function R(I,j){return m?new Promise(D=>{g==null||g.interpolate((j==null?void 0:j.interpolate)==="linear"?cu:Rp).scaleBy(av(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>D(!0)),I)}):Promise.resolve(!1)}function V(I){g==null||g.scaleExtent(I)}function H(I){g==null||g.translateExtent(I)}function ee(I){const j=!Or(I)||I<0?0:I;g==null||g.clickDistance(j)}return{update:w,destroy:x,setViewport:k,setViewportConstrained:Q,getViewport:M,scaleTo:$,scaleBy:R,setScaleExtent:V,setTranslateExtent:H,syncViewport:T,setClickDistance:ee}}var Sc;(function(t){t.Line="line",t.Handle="handle"})(Sc||(Sc={}));function T6({width:t,prevWidth:e,height:i,prevHeight:n,affectsX:r,affectsY:s}){const a=t-e,c=i-n,h=[a>0?1:a<0?-1:0,c>0?1:c<0?-1:0];return a&&r&&(h[0]=h[0]*-1),c&&s&&(h[1]=h[1]*-1),h}function PC(t){const e=t.includes("right")||t.includes("left"),i=t.includes("bottom")||t.includes("top"),n=t.includes("left"),r=t.includes("top");return{isHorizontal:e,isVertical:i,affectsX:n,affectsY:r}}function vo(t,e){return Math.max(0,e-t)}function yo(t,e){return Math.max(0,t-e)}function Yf(t,e,i){return Math.max(0,e-t,t-i)}function EC(t,e){return t?!e:e}function Q6(t,e,i,n,r,s,a,c){let{affectsX:h,affectsY:d}=e;const{isHorizontal:f,isVertical:g}=e,m=f&&g,{xSnapped:O,ySnapped:S}=i,{minWidth:_,maxWidth:w,minHeight:x,maxHeight:Q}=n,{x:k,y:T,width:M,height:$,aspectRatio:R}=t;let V=Math.floor(f?O-t.pointerX:0),H=Math.floor(g?S-t.pointerY:0);const ee=M+(h?-V:V),I=$+(d?-H:H),j=-s[0]*M,D=-s[1]*$;let E=Yf(ee,_,w),X=Yf(I,x,Q);if(a){let L=0,B=0;h&&V<0?L=vo(k+V+j,a[0][0]):!h&&V>0&&(L=yo(k+ee+j,a[1][0])),d&&H<0?B=vo(T+H+D,a[0][1]):!d&&H>0&&(B=yo(T+I+D,a[1][1])),E=Math.max(E,L),X=Math.max(X,B)}if(c){let L=0,B=0;h&&V>0?L=yo(k+V,c[0][0]):!h&&V<0&&(L=vo(k+ee,c[1][0])),d&&H>0?B=yo(T+H,c[0][1]):!d&&H<0&&(B=vo(T+I,c[1][1])),E=Math.max(E,L),X=Math.max(X,B)}if(r){if(f){const L=Yf(ee/R,x,Q)*R;if(E=Math.max(E,L),a){let B=0;!h&&!d||h&&!d&&m?B=yo(T+D+ee/R,a[1][1])*R:B=vo(T+D+(h?V:-V)/R,a[0][1])*R,E=Math.max(E,B)}if(c){let B=0;!h&&!d||h&&!d&&m?B=vo(T+ee/R,c[1][1])*R:B=yo(T+(h?V:-V)/R,c[0][1])*R,E=Math.max(E,B)}}if(g){const L=Yf(I*R,_,w)/R;if(X=Math.max(X,L),a){let B=0;!h&&!d||d&&!h&&m?B=yo(k+I*R+j,a[1][0])/R:B=vo(k+(d?H:-H)*R+j,a[0][0])/R,X=Math.max(X,B)}if(c){let B=0;!h&&!d||d&&!h&&m?B=vo(k+I*R,c[1][0])/R:B=yo(k+(d?H:-H)*R,c[0][0])/R,X=Math.max(X,B)}}}H=H+(H<0?X:-X),V=V+(V<0?E:-E),r&&(m?ee>I*R?H=(EC(h,d)?-V:V)/R:V=(EC(h,d)?-H:H)*R:f?(H=V/R,d=h):(V=H*R,h=d));const P=h?k+V:k,Z=d?T+H:T;return{width:M+(h?-V:V),height:$+(d?-H:H),x:s[0]*V*(h?-1:1)+P,y:s[1]*H*(d?-1:1)+Z}}const HP={width:0,height:0,x:0,y:0},$6={...HP,pointerX:0,pointerY:0,aspectRatio:1};function P6(t){return[[0,0],[t.measured.width,t.measured.height]]}function E6(t,e,i){const n=e.position.x+t.position.x,r=e.position.y+t.position.y,s=t.measured.width??0,a=t.measured.height??0,c=i[0]*s,h=i[1]*a;return[[n-c,r-h],[n+s-c,r+a-h]]}function R6({domNode:t,nodeId:e,getStoreItems:i,onChange:n,onEnd:r}){const s=Bn(t);let a={controlDirection:PC("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:d,boundaries:f,keepAspectRatio:g,resizeDirection:m,onResizeStart:O,onResize:S,onResizeEnd:_,shouldResize:w}){let x={...HP},Q={...$6};a={boundaries:f,resizeDirection:m,keepAspectRatio:g,controlDirection:PC(d)};let k,T=null,M=[],$,R,V,H=!1;const ee=rP().on("start",I=>{const{nodeLookup:j,transform:D,snapGrid:E,snapToGrid:X,nodeOrigin:P,paneDomNode:Z}=i();if(k=j.get(e),!k)return;T=(Z==null?void 0:Z.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:B}=hu(I.sourceEvent,{transform:D,snapGrid:E,snapToGrid:X,containerBounds:T});x={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},Q={...x,pointerX:L,pointerY:B,aspectRatio:x.width/x.height},$=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&($=j.get(k.parentId),R=$&&k.extent==="parent"?P6($):void 0),M=[],V=void 0;for(const[G,z]of j)if(z.parentId===e&&(M.push({id:G,position:{...z.position},extent:z.extent}),z.extent==="parent"||z.expandParent)){const q=E6(z,k,z.origin??P);V?V=[[Math.min(q[0][0],V[0][0]),Math.min(q[0][1],V[0][1])],[Math.max(q[1][0],V[1][0]),Math.max(q[1][1],V[1][1])]]:V=q}O==null||O(I,{...x})}).on("drag",I=>{const{transform:j,snapGrid:D,snapToGrid:E,nodeOrigin:X}=i(),P=hu(I.sourceEvent,{transform:j,snapGrid:D,snapToGrid:E,containerBounds:T}),Z=[];if(!k)return;const{x:L,y:B,width:G,height:z}=x,q={},K=k.origin??X,{width:ie,height:ce,x:de,y:pe}=Q6(Q,a.controlDirection,P,a.boundaries,a.keepAspectRatio,K,R,V),fe=ie!==G,ve=ce!==z,De=de!==L&&fe,Ee=pe!==B&&ve;if(!De&&!Ee&&!fe&&!ve)return;if((De||Ee||K[0]===1||K[1]===1)&&(q.x=De?de:x.x,q.y=Ee?pe:x.y,x.x=q.x,x.y=q.y,M.length>0)){const lt=de-L,Ue=pe-B;for(const Ft of M)Ft.position={x:Ft.position.x-lt+K[0]*(ie-G),y:Ft.position.y-Ue+K[1]*(ce-z)},Z.push(Ft)}if((fe||ve)&&(q.width=fe&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ie:x.width,q.height=ve&&(!a.resizeDirection||a.resizeDirection==="vertical")?ce:x.height,x.width=q.width,x.height=q.height),$&&k.expandParent){const lt=K[0]*(q.width??0);q.x&&q.x<lt&&(x.x=lt,Q.x=Q.x-(q.x-lt));const Ue=K[1]*(q.height??0);q.y&&q.y<Ue&&(x.y=Ue,Q.y=Q.y-(q.y-Ue))}const ke=T6({width:x.width,prevWidth:G,height:x.height,prevHeight:z,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),me={...x,direction:ke};(w==null?void 0:w(I,me))!==!1&&(H=!0,S==null||S(I,me),n(q,Z))}).on("end",I=>{H&&(_==null||_(I,{...x}),r==null||r({...x}),H=!1)});s.call(ee)}function h(){s.on(".drag",null)}return{update:c,destroy:h}}var lv={exports:{}},cv={},hv={exports:{}},uv={};/**
48
+ `+p.stack}}var qi=Object.prototype.hasOwnProperty,_n=t.unstable_scheduleCallback,ar=t.unstable_cancelCallback,oe=t.unstable_shouldYield,We=t.unstable_requestPaint,Le=t.unstable_now,sn=t.unstable_getCurrentPriorityLevel,on=t.unstable_ImmediatePriority,Vi=t.unstable_UserBlockingPriority,Go=t.unstable_NormalPriority,Rm=t.unstable_LowPriority,tl=t.unstable_IdlePriority,Am=t.log,Mm=t.unstable_setDisableYieldValue,Fo=null,Ii=null;function wr(o){if(typeof Am=="function"&&Mm(o),Ii&&typeof Ii.setStrictMode=="function")try{Ii.setStrictMode(Fo,o)}catch{}}var Yi=Math.clz32?Math.clz32:Dm,zm=Math.log,jm=Math.LN2;function Dm(o){return o>>>=0,o===0?32:31-(zm(o)/jm|0)|0}var il=256,nl=262144,rl=4194304;function Kr(o){var l=o&42;if(l!==0)return l;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function sl(o,l,u){var p=o.pendingLanes;if(p===0)return 0;var y=0,b=o.suspendedLanes,C=o.pingedLanes;o=o.warmLanes;var A=p&134217727;return A!==0?(p=A&~b,p!==0?y=Kr(p):(C&=A,C!==0?y=Kr(C):u||(u=A&~o,u!==0&&(y=Kr(u))))):(A=p&~b,A!==0?y=Kr(A):C!==0?y=Kr(C):u||(u=p&~o,u!==0&&(y=Kr(u)))),y===0?0:l!==0&&l!==y&&(l&b)===0&&(b=y&-y,u=l&-l,b>=u||b===32&&(u&4194048)!==0)?l:y}function Ko(o,l){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&l)===0}function Bm(o,l){switch(o){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Od(){var o=rl;return rl<<=1,(rl&62914560)===0&&(rl=4194304),o}function Lc(o){for(var l=[],u=0;31>u;u++)l.push(o);return l}function Jo(o,l){o.pendingLanes|=l,l!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Lm(o,l,u,p,y,b){var C=o.pendingLanes;o.pendingLanes=u,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=u,o.entangledLanes&=u,o.errorRecoveryDisabledLanes&=u,o.shellSuspendCounter=0;var A=o.entanglements,Y=o.expirationTimes,te=o.hiddenUpdates;for(u=C&~u;0<u;){var se=31-Yi(u),he=1<<se;A[se]=0,Y[se]=-1;var ne=te[se];if(ne!==null)for(te[se]=null,se=0;se<ne.length;se++){var re=ne[se];re!==null&&(re.lane&=-536870913)}u&=~he}p!==0&&vd(o,p,0),b!==0&&y===0&&o.tag!==0&&(o.suspendedLanes|=b&~(C&~l))}function vd(o,l,u){o.pendingLanes|=l,o.suspendedLanes&=~l;var p=31-Yi(l);o.entangledLanes|=l,o.entanglements[p]=o.entanglements[p]|1073741824|u&261930}function yd(o,l){var u=o.entangledLanes|=l;for(o=o.entanglements;u;){var p=31-Yi(u),y=1<<p;y&l|o[p]&l&&(o[p]|=l),u&=~y}}function Sd(o,l){var u=l&-l;return u=(u&42)!==0?1:Xc(u),(u&(o.suspendedLanes|l))!==0?0:u}function Xc(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Nc(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function bd(){var o=Z.p;return o!==0?o:(o=window.event,o===void 0?32:zk(o.type))}function _d(o,l){var u=Z.p;try{return Z.p=o,l()}finally{Z.p=u}}var kr=Math.random().toString(36).slice(2),li="__reactFiber$"+kr,Di="__reactProps$"+kr,Jr="__reactContainer$"+kr,ol="__reactEvents$"+kr,xd="__reactListeners$"+kr,Xm="__reactHandles$"+kr,wd="__reactResources$"+kr,ea="__reactMarker$"+kr;function Zc(o){delete o[li],delete o[Di],delete o[ol],delete o[xd],delete o[Xm]}function Zs(o){var l=o[li];if(l)return l;for(var u=o.parentNode;u;){if(l=u[Jr]||u[li]){if(u=l.alternate,l.child!==null||u!==null&&u.child!==null)for(o=yk(o);o!==null;){if(u=o[li])return u;o=yk(o)}return l}o=u,u=o.parentNode}return null}function Ws(o){if(o=o[li]||o[Jr]){var l=o.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return o}return null}function qs(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o.stateNode;throw Error(n(33))}function Vs(o){var l=o[wd];return l||(l=o[wd]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Kt(o){o[ea]=!0}var kd=new Set,Cd={};function es(o,l){Is(o,l),Is(o+"Capture",l)}function Is(o,l){for(Cd[o]=l,o=0;o<l.length;o++)kd.add(l[o])}var Nm=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Wc={},Td={};function Zm(o){return qi.call(Td,o)?!0:qi.call(Wc,o)?!1:Nm.test(o)?Td[o]=!0:(Wc[o]=!0,!1)}function al(o,l,u){if(Zm(l))if(u===null)o.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":o.removeAttribute(l);return;case"boolean":var p=l.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){o.removeAttribute(l);return}}o.setAttribute(l,""+u)}}function ll(o,l,u){if(u===null)o.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(l);return}o.setAttribute(l,""+u)}}function lr(o,l,u,p){if(p===null)o.removeAttribute(u);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(u);return}o.setAttributeNS(l,u,""+p)}}function an(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Qd(o){var l=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Wm(o,l,u){var p=Object.getOwnPropertyDescriptor(o.constructor.prototype,l);if(!o.hasOwnProperty(l)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var y=p.get,b=p.set;return Object.defineProperty(o,l,{configurable:!0,get:function(){return y.call(this)},set:function(C){u=""+C,b.call(this,C)}}),Object.defineProperty(o,l,{enumerable:p.enumerable}),{getValue:function(){return u},setValue:function(C){u=""+C},stopTracking:function(){o._valueTracker=null,delete o[l]}}}}function Ys(o){if(!o._valueTracker){var l=Qd(o)?"checked":"value";o._valueTracker=Wm(o,l,""+o[l])}}function $d(o){if(!o)return!1;var l=o._valueTracker;if(!l)return!0;var u=l.getValue(),p="";return o&&(p=Qd(o)?o.checked?"true":"false":o.value),o=p,o!==u?(l.setValue(o),!0):!1}function ta(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var qm=/[\n"\\]/g;function ln(o){return o.replace(qm,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function ia(o,l,u,p,y,b,C,A){o.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?o.type=C:o.removeAttribute("type"),l!=null?C==="number"?(l===0&&o.value===""||o.value!=l)&&(o.value=""+an(l)):o.value!==""+an(l)&&(o.value=""+an(l)):C!=="submit"&&C!=="reset"||o.removeAttribute("value"),l!=null?qc(o,C,an(l)):u!=null?qc(o,C,an(u)):p!=null&&o.removeAttribute("value"),y==null&&b!=null&&(o.defaultChecked=!!b),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?o.name=""+an(A):o.removeAttribute("name")}function Pd(o,l,u,p,y,b,C,A){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(o.type=b),l!=null||u!=null){if(!(b!=="submit"&&b!=="reset"||l!=null)){Ys(o);return}u=u!=null?""+an(u):"",l=l!=null?""+an(l):u,A||l===o.value||(o.value=l),o.defaultValue=l}p=p??y,p=typeof p!="function"&&typeof p!="symbol"&&!!p,o.checked=A?o.checked:!!p,o.defaultChecked=!!p,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(o.name=C),Ys(o)}function qc(o,l,u){l==="number"&&ta(o.ownerDocument)===o||o.defaultValue===""+u||(o.defaultValue=""+u)}function ts(o,l,u,p){if(o=o.options,l){l={};for(var y=0;y<u.length;y++)l["$"+u[y]]=!0;for(u=0;u<o.length;u++)y=l.hasOwnProperty("$"+o[u].value),o[u].selected!==y&&(o[u].selected=y),y&&p&&(o[u].defaultSelected=!0)}else{for(u=""+an(u),l=null,y=0;y<o.length;y++){if(o[y].value===u){o[y].selected=!0,p&&(o[y].defaultSelected=!0);return}l!==null||o[y].disabled||(l=o[y])}l!==null&&(l.selected=!0)}}function o_(o,l,u){if(l!=null&&(l=""+an(l),l!==o.value&&(o.value=l),u==null)){o.defaultValue!==l&&(o.defaultValue=l);return}o.defaultValue=u!=null?""+an(u):""}function a_(o,l,u,p){if(l==null){if(p!=null){if(u!=null)throw Error(n(92));if(X(p)){if(1<p.length)throw Error(n(93));p=p[0]}u=p}u==null&&(u=""),l=u}u=an(l),o.defaultValue=u,p=o.textContent,p===u&&p!==""&&p!==null&&(o.value=p),Ys(o)}function cl(o,l){if(l){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=l;return}}o.textContent=l}var jz=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function l_(o,l,u){var p=l.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?p?o.setProperty(l,""):l==="float"?o.cssFloat="":o[l]="":p?o.setProperty(l,u):typeof u!="number"||u===0||jz.has(l)?l==="float"?o.cssFloat=u:o[l]=(""+u).trim():o[l]=u+"px"}function c_(o,l,u){if(l!=null&&typeof l!="object")throw Error(n(62));if(o=o.style,u!=null){for(var p in u)!u.hasOwnProperty(p)||l!=null&&l.hasOwnProperty(p)||(p.indexOf("--")===0?o.setProperty(p,""):p==="float"?o.cssFloat="":o[p]="");for(var y in l)p=l[y],l.hasOwnProperty(y)&&u[y]!==p&&l_(o,y,p)}else for(var b in l)l.hasOwnProperty(b)&&l_(o,b,l[b])}function Vm(o){if(o.indexOf("-")===-1)return!1;switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Dz=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Bz=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ed(o){return Bz.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function is(){}var Im=null;function Ym(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var hl=null,ul=null;function h_(o){var l=Ws(o);if(l&&(o=l.stateNode)){var u=o[Di]||null;e:switch(o=l.stateNode,l.type){case"input":if(ia(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),l=u.name,u.type==="radio"&&l!=null){for(u=o;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+ln(""+l)+'"][type="radio"]'),l=0;l<u.length;l++){var p=u[l];if(p!==o&&p.form===o.form){var y=p[Di]||null;if(!y)throw Error(n(90));ia(p,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(l=0;l<u.length;l++)p=u[l],p.form===o.form&&$d(p)}break e;case"textarea":o_(o,u.value,u.defaultValue);break e;case"select":l=u.value,l!=null&&ts(o,!!u.multiple,l,!1)}}}var Hm=!1;function u_(o,l,u){if(Hm)return o(l,u);Hm=!0;try{var p=o(l);return p}finally{if(Hm=!1,(hl!==null||ul!==null)&&(yf(),hl&&(l=hl,o=ul,ul=hl=null,h_(l),o)))for(l=0;l<o.length;l++)h_(o[l])}}function Vc(o,l){var u=o.stateNode;if(u===null)return null;var p=u[Di]||null;if(p===null)return null;u=p[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(o=o.type,p=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!p;break e;default:o=!1}if(o)return null;if(u&&typeof u!="function")throw Error(n(231,l,typeof u));return u}var ns=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Um=!1;if(ns)try{var Ic={};Object.defineProperty(Ic,"passive",{get:function(){Um=!0}}),window.addEventListener("test",Ic,Ic),window.removeEventListener("test",Ic,Ic)}catch{Um=!1}var Hs=null,Gm=null,Rd=null;function d_(){if(Rd)return Rd;var o,l=Gm,u=l.length,p,y="value"in Hs?Hs.value:Hs.textContent,b=y.length;for(o=0;o<u&&l[o]===y[o];o++);var C=u-o;for(p=1;p<=C&&l[u-p]===y[b-p];p++);return Rd=y.slice(o,1<p?1-p:void 0)}function Ad(o){var l=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&l===13&&(o=13)):o=l,o===10&&(o=13),32<=o||o===13?o:0}function Md(){return!0}function f_(){return!1}function cn(o){function l(u,p,y,b,C){this._reactName=u,this._targetInst=y,this.type=p,this.nativeEvent=b,this.target=C,this.currentTarget=null;for(var A in o)o.hasOwnProperty(A)&&(u=o[A],this[A]=u?u(b):b[A]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?Md:f_,this.isPropagationStopped=f_,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Md)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Md)},persist:function(){},isPersistent:Md}),l}var na={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zd=cn(na),Yc=g({},na,{view:0,detail:0}),Lz=cn(Yc),Fm,Km,Hc,jd=g({},Yc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:eO,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Hc&&(Hc&&o.type==="mousemove"?(Fm=o.screenX-Hc.screenX,Km=o.screenY-Hc.screenY):Km=Fm=0,Hc=o),Fm)},movementY:function(o){return"movementY"in o?o.movementY:Km}}),p_=cn(jd),Xz=g({},jd,{dataTransfer:0}),Nz=cn(Xz),Zz=g({},Yc,{relatedTarget:0}),Jm=cn(Zz),Wz=g({},na,{animationName:0,elapsedTime:0,pseudoElement:0}),qz=cn(Wz),Vz=g({},na,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),Iz=cn(Vz),Yz=g({},na,{data:0}),g_=cn(Yz),Hz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Uz={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Gz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Fz(o){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(o):(o=Gz[o])?!!l[o]:!1}function eO(){return Fz}var Kz=g({},Yc,{key:function(o){if(o.key){var l=Hz[o.key]||o.key;if(l!=="Unidentified")return l}return o.type==="keypress"?(o=Ad(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?Uz[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:eO,charCode:function(o){return o.type==="keypress"?Ad(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Ad(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Jz=cn(Kz),ej=g({},jd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),m_=cn(ej),tj=g({},Yc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:eO}),ij=cn(tj),nj=g({},na,{propertyName:0,elapsedTime:0,pseudoElement:0}),rj=cn(nj),sj=g({},jd,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),oj=cn(sj),aj=g({},na,{newState:0,oldState:0}),lj=cn(aj),cj=[9,13,27,32],tO=ns&&"CompositionEvent"in window,Uc=null;ns&&"documentMode"in document&&(Uc=document.documentMode);var hj=ns&&"TextEvent"in window&&!Uc,O_=ns&&(!tO||Uc&&8<Uc&&11>=Uc),v_=" ",y_=!1;function S_(o,l){switch(o){case"keyup":return cj.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function b_(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var dl=!1;function uj(o,l){switch(o){case"compositionend":return b_(l);case"keypress":return l.which!==32?null:(y_=!0,v_);case"textInput":return o=l.data,o===v_&&y_?null:o;default:return null}}function dj(o,l){if(dl)return o==="compositionend"||!tO&&S_(o,l)?(o=d_(),Rd=Gm=Hs=null,dl=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return O_&&l.locale!=="ko"?null:l.data;default:return null}}var fj={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function __(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l==="input"?!!fj[o.type]:l==="textarea"}function x_(o,l,u,p){hl?ul?ul.push(p):ul=[p]:hl=p,l=Cf(l,"onChange"),0<l.length&&(u=new zd("onChange","change",null,u,p),o.push({event:u,listeners:l}))}var Gc=null,Fc=null;function pj(o){sk(o,0)}function Dd(o){var l=qs(o);if($d(l))return o}function w_(o,l){if(o==="change")return l}var k_=!1;if(ns){var iO;if(ns){var nO="oninput"in document;if(!nO){var C_=document.createElement("div");C_.setAttribute("oninput","return;"),nO=typeof C_.oninput=="function"}iO=nO}else iO=!1;k_=iO&&(!document.documentMode||9<document.documentMode)}function T_(){Gc&&(Gc.detachEvent("onpropertychange",Q_),Fc=Gc=null)}function Q_(o){if(o.propertyName==="value"&&Dd(Fc)){var l=[];x_(l,Fc,o,Ym(o)),u_(pj,l)}}function gj(o,l,u){o==="focusin"?(T_(),Gc=l,Fc=u,Gc.attachEvent("onpropertychange",Q_)):o==="focusout"&&T_()}function mj(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Dd(Fc)}function Oj(o,l){if(o==="click")return Dd(l)}function vj(o,l){if(o==="input"||o==="change")return Dd(l)}function yj(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var xn=typeof Object.is=="function"?Object.is:yj;function Kc(o,l){if(xn(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var u=Object.keys(o),p=Object.keys(l);if(u.length!==p.length)return!1;for(p=0;p<u.length;p++){var y=u[p];if(!qi.call(l,y)||!xn(o[y],l[y]))return!1}return!0}function $_(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function P_(o,l){var u=$_(o);o=0;for(var p;u;){if(u.nodeType===3){if(p=o+u.textContent.length,o<=l&&p>=l)return{node:u,offset:l-o};o=p}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=$_(u)}}function E_(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?E_(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function R_(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var l=ta(o.document);l instanceof o.HTMLIFrameElement;){try{var u=typeof l.contentWindow.location.href=="string"}catch{u=!1}if(u)o=l.contentWindow;else break;l=ta(o.document)}return l}function rO(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}var Sj=ns&&"documentMode"in document&&11>=document.documentMode,fl=null,sO=null,Jc=null,oO=!1;function A_(o,l,u){var p=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;oO||fl==null||fl!==ta(p)||(p=fl,"selectionStart"in p&&rO(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Jc&&Kc(Jc,p)||(Jc=p,p=Cf(sO,"onSelect"),0<p.length&&(l=new zd("onSelect","select",null,l,u),o.push({event:l,listeners:p}),l.target=fl)))}function ra(o,l){var u={};return u[o.toLowerCase()]=l.toLowerCase(),u["Webkit"+o]="webkit"+l,u["Moz"+o]="moz"+l,u}var pl={animationend:ra("Animation","AnimationEnd"),animationiteration:ra("Animation","AnimationIteration"),animationstart:ra("Animation","AnimationStart"),transitionrun:ra("Transition","TransitionRun"),transitionstart:ra("Transition","TransitionStart"),transitioncancel:ra("Transition","TransitionCancel"),transitionend:ra("Transition","TransitionEnd")},aO={},M_={};ns&&(M_=document.createElement("div").style,"AnimationEvent"in window||(delete pl.animationend.animation,delete pl.animationiteration.animation,delete pl.animationstart.animation),"TransitionEvent"in window||delete pl.transitionend.transition);function sa(o){if(aO[o])return aO[o];if(!pl[o])return o;var l=pl[o],u;for(u in l)if(l.hasOwnProperty(u)&&u in M_)return aO[o]=l[u];return o}var z_=sa("animationend"),j_=sa("animationiteration"),D_=sa("animationstart"),bj=sa("transitionrun"),_j=sa("transitionstart"),xj=sa("transitioncancel"),B_=sa("transitionend"),L_=new Map,lO="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");lO.push("scrollEnd");function cr(o,l){L_.set(o,l),es(l,[o])}var Bd=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Zn=[],gl=0,cO=0;function Ld(){for(var o=gl,l=cO=gl=0;l<o;){var u=Zn[l];Zn[l++]=null;var p=Zn[l];Zn[l++]=null;var y=Zn[l];Zn[l++]=null;var b=Zn[l];if(Zn[l++]=null,p!==null&&y!==null){var C=p.pending;C===null?y.next=y:(y.next=C.next,C.next=y),p.pending=y}b!==0&&X_(u,y,b)}}function Xd(o,l,u,p){Zn[gl++]=o,Zn[gl++]=l,Zn[gl++]=u,Zn[gl++]=p,cO|=p,o.lanes|=p,o=o.alternate,o!==null&&(o.lanes|=p)}function hO(o,l,u,p){return Xd(o,l,u,p),Nd(o)}function oa(o,l){return Xd(o,null,null,l),Nd(o)}function X_(o,l,u){o.lanes|=u;var p=o.alternate;p!==null&&(p.lanes|=u);for(var y=!1,b=o.return;b!==null;)b.childLanes|=u,p=b.alternate,p!==null&&(p.childLanes|=u),b.tag===22&&(o=b.stateNode,o===null||o._visibility&1||(y=!0)),o=b,b=b.return;return o.tag===3?(b=o.stateNode,y&&l!==null&&(y=31-Yi(u),o=b.hiddenUpdates,p=o[y],p===null?o[y]=[l]:p.push(l),l.lane=u|536870912),b):null}function Nd(o){if(50<bh)throw bh=0,y0=null,Error(n(185));for(var l=o.return;l!==null;)o=l,l=o.return;return o.tag===3?o.stateNode:null}var ml={};function wj(o,l,u,p){this.tag=o,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wn(o,l,u,p){return new wj(o,l,u,p)}function uO(o){return o=o.prototype,!(!o||!o.isReactComponent)}function rs(o,l){var u=o.alternate;return u===null?(u=wn(o.tag,l,o.key,o.mode),u.elementType=o.elementType,u.type=o.type,u.stateNode=o.stateNode,u.alternate=o,o.alternate=u):(u.pendingProps=l,u.type=o.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=o.flags&65011712,u.childLanes=o.childLanes,u.lanes=o.lanes,u.child=o.child,u.memoizedProps=o.memoizedProps,u.memoizedState=o.memoizedState,u.updateQueue=o.updateQueue,l=o.dependencies,u.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},u.sibling=o.sibling,u.index=o.index,u.ref=o.ref,u.refCleanup=o.refCleanup,u}function N_(o,l){o.flags&=65011714;var u=o.alternate;return u===null?(o.childLanes=0,o.lanes=l,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=u.childLanes,o.lanes=u.lanes,o.child=u.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=u.memoizedProps,o.memoizedState=u.memoizedState,o.updateQueue=u.updateQueue,o.type=u.type,l=u.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),o}function Zd(o,l,u,p,y,b){var C=0;if(p=o,typeof o=="function")uO(o)&&(C=1);else if(typeof o=="string")C=$3(o,u,ie.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case H:return o=wn(31,u,l,y),o.elementType=H,o.lanes=b,o;case _:return aa(u.children,y,b,l);case w:C=8,y|=24;break;case x:return o=wn(12,u,l,y|2),o.elementType=x,o.lanes=b,o;case M:return o=wn(13,u,l,y),o.elementType=M,o.lanes=b,o;case $:return o=wn(19,u,l,y),o.elementType=$,o.lanes=b,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case k:C=10;break e;case Q:C=9;break e;case T:C=11;break e;case R:C=14;break e;case V:C=16,p=null;break e}C=29,u=Error(n(130,o===null?"null":typeof o,"")),p=null}return l=wn(C,u,l,y),l.elementType=o,l.type=p,l.lanes=b,l}function aa(o,l,u,p){return o=wn(7,o,p,l),o.lanes=u,o}function dO(o,l,u){return o=wn(6,o,null,l),o.lanes=u,o}function Z_(o){var l=wn(18,null,null,0);return l.stateNode=o,l}function fO(o,l,u){return l=wn(4,o.children!==null?o.children:[],o.key,l),l.lanes=u,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}var W_=new WeakMap;function Wn(o,l){if(typeof o=="object"&&o!==null){var u=W_.get(o);return u!==void 0?u:(l={value:o,source:l,stack:rn(l)},W_.set(o,l),l)}return{value:o,source:l,stack:rn(l)}}var Ol=[],vl=0,Wd=null,eh=0,qn=[],Vn=0,Us=null,Cr=1,Tr="";function ss(o,l){Ol[vl++]=eh,Ol[vl++]=Wd,Wd=o,eh=l}function q_(o,l,u){qn[Vn++]=Cr,qn[Vn++]=Tr,qn[Vn++]=Us,Us=o;var p=Cr;o=Tr;var y=32-Yi(p)-1;p&=~(1<<y),u+=1;var b=32-Yi(l)+y;if(30<b){var C=y-y%5;b=(p&(1<<C)-1).toString(32),p>>=C,y-=C,Cr=1<<32-Yi(l)+y|u<<y|p,Tr=b+o}else Cr=1<<b|u<<y|p,Tr=o}function pO(o){o.return!==null&&(ss(o,1),q_(o,1,0))}function gO(o){for(;o===Wd;)Wd=Ol[--vl],Ol[vl]=null,eh=Ol[--vl],Ol[vl]=null;for(;o===Us;)Us=qn[--Vn],qn[Vn]=null,Tr=qn[--Vn],qn[Vn]=null,Cr=qn[--Vn],qn[Vn]=null}function V_(o,l){qn[Vn++]=Cr,qn[Vn++]=Tr,qn[Vn++]=Us,Cr=l.id,Tr=l.overflow,Us=o}var ki=null,$t=null,st=!1,Gs=null,In=!1,mO=Error(n(519));function Fs(o){var l=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw th(Wn(l,o)),mO}function I_(o){var l=o.stateNode,u=o.type,p=o.memoizedProps;switch(l[li]=o,l[Di]=p,u){case"dialog":Je("cancel",l),Je("close",l);break;case"iframe":case"object":case"embed":Je("load",l);break;case"video":case"audio":for(u=0;u<xh.length;u++)Je(xh[u],l);break;case"source":Je("error",l);break;case"img":case"image":case"link":Je("error",l),Je("load",l);break;case"details":Je("toggle",l);break;case"input":Je("invalid",l),Pd(l,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":Je("invalid",l);break;case"textarea":Je("invalid",l),a_(l,p.value,p.defaultValue,p.children)}u=p.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||l.textContent===""+u||p.suppressHydrationWarning===!0||ck(l.textContent,u)?(p.popover!=null&&(Je("beforetoggle",l),Je("toggle",l)),p.onScroll!=null&&Je("scroll",l),p.onScrollEnd!=null&&Je("scrollend",l),p.onClick!=null&&(l.onclick=is),l=!0):l=!1,l||Fs(o,!0)}function Y_(o){for(ki=o.return;ki;)switch(ki.tag){case 5:case 31:case 13:In=!1;return;case 27:case 3:In=!0;return;default:ki=ki.return}}function yl(o){if(o!==ki)return!1;if(!st)return Y_(o),st=!0,!1;var l=o.tag,u;if((u=l!==3&&l!==27)&&((u=l===5)&&(u=o.type,u=!(u!=="form"&&u!=="button")||M0(o.type,o.memoizedProps)),u=!u),u&&$t&&Fs(o),Y_(o),l===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));$t=vk(o)}else if(l===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));$t=vk(o)}else l===27?(l=$t,uo(o.type)?(o=L0,L0=null,$t=o):$t=l):$t=ki?Hn(o.stateNode.nextSibling):null;return!0}function la(){$t=ki=null,st=!1}function OO(){var o=Gs;return o!==null&&(fn===null?fn=o:fn.push.apply(fn,o),Gs=null),o}function th(o){Gs===null?Gs=[o]:Gs.push(o)}var vO=z(null),ca=null,os=null;function Ks(o,l,u){K(vO,l._currentValue),l._currentValue=u}function as(o){o._currentValue=vO.current,q(vO)}function yO(o,l,u){for(;o!==null;){var p=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,p!==null&&(p.childLanes|=l)):p!==null&&(p.childLanes&l)!==l&&(p.childLanes|=l),o===u)break;o=o.return}}function SO(o,l,u,p){var y=o.child;for(y!==null&&(y.return=o);y!==null;){var b=y.dependencies;if(b!==null){var C=y.child;b=b.firstContext;e:for(;b!==null;){var A=b;b=y;for(var Y=0;Y<l.length;Y++)if(A.context===l[Y]){b.lanes|=u,A=b.alternate,A!==null&&(A.lanes|=u),yO(b.return,u,o),p||(C=null);break e}b=A.next}}else if(y.tag===18){if(C=y.return,C===null)throw Error(n(341));C.lanes|=u,b=C.alternate,b!==null&&(b.lanes|=u),yO(C,u,o),C=null}else C=y.child;if(C!==null)C.return=y;else for(C=y;C!==null;){if(C===o){C=null;break}if(y=C.sibling,y!==null){y.return=C.return,C=y;break}C=C.return}y=C}}function Sl(o,l,u,p){o=null;for(var y=l,b=!1;y!==null;){if(!b){if((y.flags&524288)!==0)b=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var C=y.alternate;if(C===null)throw Error(n(387));if(C=C.memoizedProps,C!==null){var A=y.type;xn(y.pendingProps.value,C.value)||(o!==null?o.push(A):o=[A])}}else if(y===pe.current){if(C=y.alternate,C===null)throw Error(n(387));C.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(o!==null?o.push(Qh):o=[Qh])}y=y.return}o!==null&&SO(l,o,u,p),l.flags|=262144}function qd(o){for(o=o.firstContext;o!==null;){if(!xn(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function ha(o){ca=o,os=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Ci(o){return H_(ca,o)}function Vd(o,l){return ca===null&&ha(o),H_(o,l)}function H_(o,l){var u=l._currentValue;if(l={context:l,memoizedValue:u,next:null},os===null){if(o===null)throw Error(n(308));os=l,o.dependencies={lanes:0,firstContext:l},o.flags|=524288}else os=os.next=l;return u}var kj=typeof AbortController<"u"?AbortController:function(){var o=[],l=this.signal={aborted:!1,addEventListener:function(u,p){o.push(p)}};this.abort=function(){l.aborted=!0,o.forEach(function(u){return u()})}},Cj=t.unstable_scheduleCallback,Tj=t.unstable_NormalPriority,Jt={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bO(){return{controller:new kj,data:new Map,refCount:0}}function ih(o){o.refCount--,o.refCount===0&&Cj(Tj,function(){o.controller.abort()})}var nh=null,_O=0,bl=0,_l=null;function Qj(o,l){if(nh===null){var u=nh=[];_O=0,bl=k0(),_l={status:"pending",value:void 0,then:function(p){u.push(p)}}}return _O++,l.then(U_,U_),l}function U_(){if(--_O===0&&nh!==null){_l!==null&&(_l.status="fulfilled");var o=nh;nh=null,bl=0,_l=null;for(var l=0;l<o.length;l++)(0,o[l])()}}function $j(o,l){var u=[],p={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return o.then(function(){p.status="fulfilled",p.value=l;for(var y=0;y<u.length;y++)(0,u[y])(l)},function(y){for(p.status="rejected",p.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),p}var G_=P.S;P.S=function(o,l){Aw=Le(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&Qj(o,l),G_!==null&&G_(o,l)};var ua=z(null);function xO(){var o=ua.current;return o!==null?o:wt.pooledCache}function Id(o,l){l===null?K(ua,ua.current):K(ua,l.pool)}function F_(){var o=xO();return o===null?null:{parent:Jt._currentValue,pool:o}}var xl=Error(n(460)),wO=Error(n(474)),Yd=Error(n(542)),Hd={then:function(){}};function K_(o){return o=o.status,o==="fulfilled"||o==="rejected"}function J_(o,l,u){switch(u=o[u],u===void 0?o.push(l):u!==l&&(l.then(is,is),l=u),l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,tx(o),o;default:if(typeof l.status=="string")l.then(is,is);else{if(o=wt,o!==null&&100<o.shellSuspendCounter)throw Error(n(482));o=l,o.status="pending",o.then(function(p){if(l.status==="pending"){var y=l;y.status="fulfilled",y.value=p}},function(p){if(l.status==="pending"){var y=l;y.status="rejected",y.reason=p}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw o=l.reason,tx(o),o}throw fa=l,xl}}function da(o){try{var l=o._init;return l(o._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(fa=u,xl):u}}var fa=null;function ex(){if(fa===null)throw Error(n(459));var o=fa;return fa=null,o}function tx(o){if(o===xl||o===Yd)throw Error(n(483))}var wl=null,rh=0;function Ud(o){var l=rh;return rh+=1,wl===null&&(wl=[]),J_(wl,o,l)}function sh(o,l){l=l.props.ref,o.ref=l!==void 0?l:null}function Gd(o,l){throw l.$$typeof===m?Error(n(525)):(o=Object.prototype.toString.call(l),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o)))}function ix(o){function l(F,U){if(o){var J=F.deletions;J===null?(F.deletions=[U],F.flags|=16):J.push(U)}}function u(F,U){if(!o)return null;for(;U!==null;)l(F,U),U=U.sibling;return null}function p(F){for(var U=new Map;F!==null;)F.key!==null?U.set(F.key,F):U.set(F.index,F),F=F.sibling;return U}function y(F,U){return F=rs(F,U),F.index=0,F.sibling=null,F}function b(F,U,J){return F.index=J,o?(J=F.alternate,J!==null?(J=J.index,J<U?(F.flags|=67108866,U):J):(F.flags|=67108866,U)):(F.flags|=1048576,U)}function C(F){return o&&F.alternate===null&&(F.flags|=67108866),F}function A(F,U,J,ae){return U===null||U.tag!==6?(U=dO(J,F.mode,ae),U.return=F,U):(U=y(U,J),U.return=F,U)}function Y(F,U,J,ae){var Ae=J.type;return Ae===_?se(F,U,J.props.children,ae,J.key):U!==null&&(U.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===V&&da(Ae)===U.type)?(U=y(U,J.props),sh(U,J),U.return=F,U):(U=Zd(J.type,J.key,J.props,null,F.mode,ae),sh(U,J),U.return=F,U)}function te(F,U,J,ae){return U===null||U.tag!==4||U.stateNode.containerInfo!==J.containerInfo||U.stateNode.implementation!==J.implementation?(U=fO(J,F.mode,ae),U.return=F,U):(U=y(U,J.children||[]),U.return=F,U)}function se(F,U,J,ae,Ae){return U===null||U.tag!==7?(U=aa(J,F.mode,ae,Ae),U.return=F,U):(U=y(U,J),U.return=F,U)}function he(F,U,J){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=dO(""+U,F.mode,J),U.return=F,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case O:return J=Zd(U.type,U.key,U.props,null,F.mode,J),sh(J,U),J.return=F,J;case S:return U=fO(U,F.mode,J),U.return=F,U;case V:return U=da(U),he(F,U,J)}if(X(U)||j(U))return U=aa(U,F.mode,J,null),U.return=F,U;if(typeof U.then=="function")return he(F,Ud(U),J);if(U.$$typeof===k)return he(F,Vd(F,U),J);Gd(F,U)}return null}function ne(F,U,J,ae){var Ae=U!==null?U.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Ae!==null?null:A(F,U,""+J,ae);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case O:return J.key===Ae?Y(F,U,J,ae):null;case S:return J.key===Ae?te(F,U,J,ae):null;case V:return J=da(J),ne(F,U,J,ae)}if(X(J)||j(J))return Ae!==null?null:se(F,U,J,ae,null);if(typeof J.then=="function")return ne(F,U,Ud(J),ae);if(J.$$typeof===k)return ne(F,U,Vd(F,J),ae);Gd(F,J)}return null}function re(F,U,J,ae,Ae){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return F=F.get(J)||null,A(U,F,""+ae,Ae);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case O:return F=F.get(ae.key===null?J:ae.key)||null,Y(U,F,ae,Ae);case S:return F=F.get(ae.key===null?J:ae.key)||null,te(U,F,ae,Ae);case V:return ae=da(ae),re(F,U,J,ae,Ae)}if(X(ae)||j(ae))return F=F.get(J)||null,se(U,F,ae,Ae,null);if(typeof ae.then=="function")return re(F,U,J,Ud(ae),Ae);if(ae.$$typeof===k)return re(F,U,J,Vd(U,ae),Ae);Gd(U,ae)}return null}function we(F,U,J,ae){for(var Ae=null,ht=null,Te=U,Ye=U=0,it=null;Te!==null&&Ye<J.length;Ye++){Te.index>Ye?(it=Te,Te=null):it=Te.sibling;var ut=ne(F,Te,J[Ye],ae);if(ut===null){Te===null&&(Te=it);break}o&&Te&&ut.alternate===null&&l(F,Te),U=b(ut,U,Ye),ht===null?Ae=ut:ht.sibling=ut,ht=ut,Te=it}if(Ye===J.length)return u(F,Te),st&&ss(F,Ye),Ae;if(Te===null){for(;Ye<J.length;Ye++)Te=he(F,J[Ye],ae),Te!==null&&(U=b(Te,U,Ye),ht===null?Ae=Te:ht.sibling=Te,ht=Te);return st&&ss(F,Ye),Ae}for(Te=p(Te);Ye<J.length;Ye++)it=re(Te,F,Ye,J[Ye],ae),it!==null&&(o&&it.alternate!==null&&Te.delete(it.key===null?Ye:it.key),U=b(it,U,Ye),ht===null?Ae=it:ht.sibling=it,ht=it);return o&&Te.forEach(function(Oo){return l(F,Oo)}),st&&ss(F,Ye),Ae}function ze(F,U,J,ae){if(J==null)throw Error(n(151));for(var Ae=null,ht=null,Te=U,Ye=U=0,it=null,ut=J.next();Te!==null&&!ut.done;Ye++,ut=J.next()){Te.index>Ye?(it=Te,Te=null):it=Te.sibling;var Oo=ne(F,Te,ut.value,ae);if(Oo===null){Te===null&&(Te=it);break}o&&Te&&Oo.alternate===null&&l(F,Te),U=b(Oo,U,Ye),ht===null?Ae=Oo:ht.sibling=Oo,ht=Oo,Te=it}if(ut.done)return u(F,Te),st&&ss(F,Ye),Ae;if(Te===null){for(;!ut.done;Ye++,ut=J.next())ut=he(F,ut.value,ae),ut!==null&&(U=b(ut,U,Ye),ht===null?Ae=ut:ht.sibling=ut,ht=ut);return st&&ss(F,Ye),Ae}for(Te=p(Te);!ut.done;Ye++,ut=J.next())ut=re(Te,F,Ye,ut.value,ae),ut!==null&&(o&&ut.alternate!==null&&Te.delete(ut.key===null?Ye:ut.key),U=b(ut,U,Ye),ht===null?Ae=ut:ht.sibling=ut,ht=ut);return o&&Te.forEach(function(X3){return l(F,X3)}),st&&ss(F,Ye),Ae}function _t(F,U,J,ae){if(typeof J=="object"&&J!==null&&J.type===_&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case O:e:{for(var Ae=J.key;U!==null;){if(U.key===Ae){if(Ae=J.type,Ae===_){if(U.tag===7){u(F,U.sibling),ae=y(U,J.props.children),ae.return=F,F=ae;break e}}else if(U.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===V&&da(Ae)===U.type){u(F,U.sibling),ae=y(U,J.props),sh(ae,J),ae.return=F,F=ae;break e}u(F,U);break}else l(F,U);U=U.sibling}J.type===_?(ae=aa(J.props.children,F.mode,ae,J.key),ae.return=F,F=ae):(ae=Zd(J.type,J.key,J.props,null,F.mode,ae),sh(ae,J),ae.return=F,F=ae)}return C(F);case S:e:{for(Ae=J.key;U!==null;){if(U.key===Ae)if(U.tag===4&&U.stateNode.containerInfo===J.containerInfo&&U.stateNode.implementation===J.implementation){u(F,U.sibling),ae=y(U,J.children||[]),ae.return=F,F=ae;break e}else{u(F,U);break}else l(F,U);U=U.sibling}ae=fO(J,F.mode,ae),ae.return=F,F=ae}return C(F);case V:return J=da(J),_t(F,U,J,ae)}if(X(J))return we(F,U,J,ae);if(j(J)){if(Ae=j(J),typeof Ae!="function")throw Error(n(150));return J=Ae.call(J),ze(F,U,J,ae)}if(typeof J.then=="function")return _t(F,U,Ud(J),ae);if(J.$$typeof===k)return _t(F,U,Vd(F,J),ae);Gd(F,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,U!==null&&U.tag===6?(u(F,U.sibling),ae=y(U,J),ae.return=F,F=ae):(u(F,U),ae=dO(J,F.mode,ae),ae.return=F,F=ae),C(F)):u(F,U)}return function(F,U,J,ae){try{rh=0;var Ae=_t(F,U,J,ae);return wl=null,Ae}catch(Te){if(Te===xl||Te===Yd)throw Te;var ht=wn(29,Te,null,F.mode);return ht.lanes=ae,ht.return=F,ht}finally{}}}var pa=ix(!0),nx=ix(!1),Js=!1;function kO(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function CO(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function eo(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function to(o,l,u){var p=o.updateQueue;if(p===null)return null;if(p=p.shared,(ft&2)!==0){var y=p.pending;return y===null?l.next=l:(l.next=y.next,y.next=l),p.pending=l,l=Nd(o),X_(o,null,u),l}return Xd(o,p,l,u),Nd(o)}function oh(o,l,u){if(l=l.updateQueue,l!==null&&(l=l.shared,(u&4194048)!==0)){var p=l.lanes;p&=o.pendingLanes,u|=p,l.lanes=u,yd(o,u)}}function TO(o,l){var u=o.updateQueue,p=o.alternate;if(p!==null&&(p=p.updateQueue,u===p)){var y=null,b=null;if(u=u.firstBaseUpdate,u!==null){do{var C={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};b===null?y=b=C:b=b.next=C,u=u.next}while(u!==null);b===null?y=b=l:b=b.next=l}else y=b=l;u={baseState:p.baseState,firstBaseUpdate:y,lastBaseUpdate:b,shared:p.shared,callbacks:p.callbacks},o.updateQueue=u;return}o=u.lastBaseUpdate,o===null?u.firstBaseUpdate=l:o.next=l,u.lastBaseUpdate=l}var QO=!1;function ah(){if(QO){var o=_l;if(o!==null)throw o}}function lh(o,l,u,p){QO=!1;var y=o.updateQueue;Js=!1;var b=y.firstBaseUpdate,C=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var Y=A,te=Y.next;Y.next=null,C===null?b=te:C.next=te,C=Y;var se=o.alternate;se!==null&&(se=se.updateQueue,A=se.lastBaseUpdate,A!==C&&(A===null?se.firstBaseUpdate=te:A.next=te,se.lastBaseUpdate=Y))}if(b!==null){var he=y.baseState;C=0,se=te=Y=null,A=b;do{var ne=A.lane&-536870913,re=ne!==A.lane;if(re?(tt&ne)===ne:(p&ne)===ne){ne!==0&&ne===bl&&(QO=!0),se!==null&&(se=se.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var we=o,ze=A;ne=l;var _t=u;switch(ze.tag){case 1:if(we=ze.payload,typeof we=="function"){he=we.call(_t,he,ne);break e}he=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=ze.payload,ne=typeof we=="function"?we.call(_t,he,ne):we,ne==null)break e;he=g({},he,ne);break e;case 2:Js=!0}}ne=A.callback,ne!==null&&(o.flags|=64,re&&(o.flags|=8192),re=y.callbacks,re===null?y.callbacks=[ne]:re.push(ne))}else re={lane:ne,tag:A.tag,payload:A.payload,callback:A.callback,next:null},se===null?(te=se=re,Y=he):se=se.next=re,C|=ne;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;re=A,A=re.next,re.next=null,y.lastBaseUpdate=re,y.shared.pending=null}}while(!0);se===null&&(Y=he),y.baseState=Y,y.firstBaseUpdate=te,y.lastBaseUpdate=se,b===null&&(y.shared.lanes=0),oo|=C,o.lanes=C,o.memoizedState=he}}function rx(o,l){if(typeof o!="function")throw Error(n(191,o));o.call(l)}function sx(o,l){var u=o.callbacks;if(u!==null)for(o.callbacks=null,o=0;o<u.length;o++)rx(u[o],l)}var kl=z(null),Fd=z(0);function ox(o,l){o=ms,K(Fd,o),K(kl,l),ms=o|l.baseLanes}function $O(){K(Fd,ms),K(kl,kl.current)}function PO(){ms=Fd.current,q(kl),q(Fd)}var kn=z(null),Yn=null;function io(o){var l=o.alternate;K(Vt,Vt.current&1),K(kn,o),Yn===null&&(l===null||kl.current!==null||l.memoizedState!==null)&&(Yn=o)}function EO(o){K(Vt,Vt.current),K(kn,o),Yn===null&&(Yn=o)}function ax(o){o.tag===22?(K(Vt,Vt.current),K(kn,o),Yn===null&&(Yn=o)):no()}function no(){K(Vt,Vt.current),K(kn,kn.current)}function Cn(o){q(kn),Yn===o&&(Yn=null),q(Vt)}var Vt=z(0);function Kd(o){for(var l=o;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||D0(u)||B0(u)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var ls=0,Ie=null,St=null,ei=null,Jd=!1,Cl=!1,ga=!1,ef=0,ch=0,Tl=null,Pj=0;function Xt(){throw Error(n(321))}function RO(o,l){if(l===null)return!1;for(var u=0;u<l.length&&u<o.length;u++)if(!xn(o[u],l[u]))return!1;return!0}function AO(o,l,u,p,y,b){return ls=b,Ie=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,P.H=o===null||o.memoizedState===null?qx:HO,ga=!1,b=u(p,y),ga=!1,Cl&&(b=cx(l,u,p,y)),lx(o),b}function lx(o){P.H=dh;var l=St!==null&&St.next!==null;if(ls=0,ei=St=Ie=null,Jd=!1,ch=0,Tl=null,l)throw Error(n(300));o===null||ti||(o=o.dependencies,o!==null&&qd(o)&&(ti=!0))}function cx(o,l,u,p){Ie=o;var y=0;do{if(Cl&&(Tl=null),ch=0,Cl=!1,25<=y)throw Error(n(301));if(y+=1,ei=St=null,o.updateQueue!=null){var b=o.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}P.H=Vx,b=l(u,p)}while(Cl);return b}function Ej(){var o=P.H,l=o.useState()[0];return l=typeof l.then=="function"?hh(l):l,o=o.useState()[0],(St!==null?St.memoizedState:null)!==o&&(Ie.flags|=1024),l}function MO(){var o=ef!==0;return ef=0,o}function zO(o,l,u){l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~u}function jO(o){if(Jd){for(o=o.memoizedState;o!==null;){var l=o.queue;l!==null&&(l.pending=null),o=o.next}Jd=!1}ls=0,ei=St=Ie=null,Cl=!1,ch=ef=0,Tl=null}function Hi(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ei===null?Ie.memoizedState=ei=o:ei=ei.next=o,ei}function It(){if(St===null){var o=Ie.alternate;o=o!==null?o.memoizedState:null}else o=St.next;var l=ei===null?Ie.memoizedState:ei.next;if(l!==null)ei=l,St=o;else{if(o===null)throw Ie.alternate===null?Error(n(467)):Error(n(310));St=o,o={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},ei===null?Ie.memoizedState=ei=o:ei=ei.next=o}return ei}function tf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function hh(o){var l=ch;return ch+=1,Tl===null&&(Tl=[]),o=J_(Tl,o,l),l=Ie,(ei===null?l.memoizedState:ei.next)===null&&(l=l.alternate,P.H=l===null||l.memoizedState===null?qx:HO),o}function nf(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return hh(o);if(o.$$typeof===k)return Ci(o)}throw Error(n(438,String(o)))}function DO(o){var l=null,u=Ie.updateQueue;if(u!==null&&(l=u.memoCache),l==null){var p=Ie.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(l={data:p.data.map(function(y){return y.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),u===null&&(u=tf(),Ie.updateQueue=u),u.memoCache=l,u=l.data[l.index],u===void 0)for(u=l.data[l.index]=Array(o),p=0;p<o;p++)u[p]=ee;return l.index++,u}function cs(o,l){return typeof l=="function"?l(o):l}function rf(o){var l=It();return BO(l,St,o)}function BO(o,l,u){var p=o.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=u;var y=o.baseQueue,b=p.pending;if(b!==null){if(y!==null){var C=y.next;y.next=b.next,b.next=C}l.baseQueue=y=b,p.pending=null}if(b=o.baseState,y===null)o.memoizedState=b;else{l=y.next;var A=C=null,Y=null,te=l,se=!1;do{var he=te.lane&-536870913;if(he!==te.lane?(tt&he)===he:(ls&he)===he){var ne=te.revertLane;if(ne===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),he===bl&&(se=!0);else if((ls&ne)===ne){te=te.next,ne===bl&&(se=!0);continue}else he={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},Y===null?(A=Y=he,C=b):Y=Y.next=he,Ie.lanes|=ne,oo|=ne;he=te.action,ga&&u(b,he),b=te.hasEagerState?te.eagerState:u(b,he)}else ne={lane:he,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},Y===null?(A=Y=ne,C=b):Y=Y.next=ne,Ie.lanes|=he,oo|=he;te=te.next}while(te!==null&&te!==l);if(Y===null?C=b:Y.next=A,!xn(b,o.memoizedState)&&(ti=!0,se&&(u=_l,u!==null)))throw u;o.memoizedState=b,o.baseState=C,o.baseQueue=Y,p.lastRenderedState=b}return y===null&&(p.lanes=0),[o.memoizedState,p.dispatch]}function LO(o){var l=It(),u=l.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=o;var p=u.dispatch,y=u.pending,b=l.memoizedState;if(y!==null){u.pending=null;var C=y=y.next;do b=o(b,C.action),C=C.next;while(C!==y);xn(b,l.memoizedState)||(ti=!0),l.memoizedState=b,l.baseQueue===null&&(l.baseState=b),u.lastRenderedState=b}return[b,p]}function hx(o,l,u){var p=Ie,y=It(),b=st;if(b){if(u===void 0)throw Error(n(407));u=u()}else u=l();var C=!xn((St||y).memoizedState,u);if(C&&(y.memoizedState=u,ti=!0),y=y.queue,ZO(fx.bind(null,p,y,o),[o]),y.getSnapshot!==l||C||ei!==null&&ei.memoizedState.tag&1){if(p.flags|=2048,Ql(9,{destroy:void 0},dx.bind(null,p,y,u,l),null),wt===null)throw Error(n(349));b||(ls&127)!==0||ux(p,l,u)}return u}function ux(o,l,u){o.flags|=16384,o={getSnapshot:l,value:u},l=Ie.updateQueue,l===null?(l=tf(),Ie.updateQueue=l,l.stores=[o]):(u=l.stores,u===null?l.stores=[o]:u.push(o))}function dx(o,l,u,p){l.value=u,l.getSnapshot=p,px(l)&&gx(o)}function fx(o,l,u){return u(function(){px(l)&&gx(o)})}function px(o){var l=o.getSnapshot;o=o.value;try{var u=l();return!xn(o,u)}catch{return!0}}function gx(o){var l=oa(o,2);l!==null&&pn(l,o,2)}function XO(o){var l=Hi();if(typeof o=="function"){var u=o;if(o=u(),ga){wr(!0);try{u()}finally{wr(!1)}}}return l.memoizedState=l.baseState=o,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:o},l}function mx(o,l,u,p){return o.baseState=u,BO(o,St,typeof p=="function"?p:cs)}function Rj(o,l,u,p,y){if(af(o))throw Error(n(485));if(o=l.action,o!==null){var b={payload:y,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){b.listeners.push(C)}};P.T!==null?u(!0):b.isTransition=!1,p(b),u=l.pending,u===null?(b.next=l.pending=b,Ox(l,b)):(b.next=u.next,l.pending=u.next=b)}}function Ox(o,l){var u=l.action,p=l.payload,y=o.state;if(l.isTransition){var b=P.T,C={};P.T=C;try{var A=u(y,p),Y=P.S;Y!==null&&Y(C,A),vx(o,l,A)}catch(te){NO(o,l,te)}finally{b!==null&&C.types!==null&&(b.types=C.types),P.T=b}}else try{b=u(y,p),vx(o,l,b)}catch(te){NO(o,l,te)}}function vx(o,l,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(p){yx(o,l,p)},function(p){return NO(o,l,p)}):yx(o,l,u)}function yx(o,l,u){l.status="fulfilled",l.value=u,Sx(l),o.state=u,l=o.pending,l!==null&&(u=l.next,u===l?o.pending=null:(u=u.next,l.next=u,Ox(o,u)))}function NO(o,l,u){var p=o.pending;if(o.pending=null,p!==null){p=p.next;do l.status="rejected",l.reason=u,Sx(l),l=l.next;while(l!==p)}o.action=null}function Sx(o){o=o.listeners;for(var l=0;l<o.length;l++)(0,o[l])()}function bx(o,l){return l}function _x(o,l){if(st){var u=wt.formState;if(u!==null){e:{var p=Ie;if(st){if($t){t:{for(var y=$t,b=In;y.nodeType!==8;){if(!b){y=null;break t}if(y=Hn(y.nextSibling),y===null){y=null;break t}}b=y.data,y=b==="F!"||b==="F"?y:null}if(y){$t=Hn(y.nextSibling),p=y.data==="F!";break e}}Fs(p)}p=!1}p&&(l=u[0])}}return u=Hi(),u.memoizedState=u.baseState=l,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bx,lastRenderedState:l},u.queue=p,u=Nx.bind(null,Ie,p),p.dispatch=u,p=XO(!1),b=YO.bind(null,Ie,!1,p.queue),p=Hi(),y={state:l,dispatch:null,action:o,pending:null},p.queue=y,u=Rj.bind(null,Ie,y,b,u),y.dispatch=u,p.memoizedState=o,[l,u,!1]}function xx(o){var l=It();return wx(l,St,o)}function wx(o,l,u){if(l=BO(o,l,bx)[0],o=rf(cs)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var p=hh(l)}catch(C){throw C===xl?Yd:C}else p=l;l=It();var y=l.queue,b=y.dispatch;return u!==l.memoizedState&&(Ie.flags|=2048,Ql(9,{destroy:void 0},Aj.bind(null,y,u),null)),[p,b,o]}function Aj(o,l){o.action=l}function kx(o){var l=It(),u=St;if(u!==null)return wx(l,u,o);It(),l=l.memoizedState,u=It();var p=u.queue.dispatch;return u.memoizedState=o,[l,p,!1]}function Ql(o,l,u,p){return o={tag:o,create:u,deps:p,inst:l,next:null},l=Ie.updateQueue,l===null&&(l=tf(),Ie.updateQueue=l),u=l.lastEffect,u===null?l.lastEffect=o.next=o:(p=u.next,u.next=o,o.next=p,l.lastEffect=o),o}function Cx(){return It().memoizedState}function sf(o,l,u,p){var y=Hi();Ie.flags|=o,y.memoizedState=Ql(1|l,{destroy:void 0},u,p===void 0?null:p)}function of(o,l,u,p){var y=It();p=p===void 0?null:p;var b=y.memoizedState.inst;St!==null&&p!==null&&RO(p,St.memoizedState.deps)?y.memoizedState=Ql(l,b,u,p):(Ie.flags|=o,y.memoizedState=Ql(1|l,b,u,p))}function Tx(o,l){sf(8390656,8,o,l)}function ZO(o,l){of(2048,8,o,l)}function Mj(o){Ie.flags|=4;var l=Ie.updateQueue;if(l===null)l=tf(),Ie.updateQueue=l,l.events=[o];else{var u=l.events;u===null?l.events=[o]:u.push(o)}}function Qx(o){var l=It().memoizedState;return Mj({ref:l,nextImpl:o}),function(){if((ft&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}function $x(o,l){return of(4,2,o,l)}function Px(o,l){return of(4,4,o,l)}function Ex(o,l){if(typeof l=="function"){o=o();var u=l(o);return function(){typeof u=="function"?u():l(null)}}if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function Rx(o,l,u){u=u!=null?u.concat([o]):null,of(4,4,Ex.bind(null,l,o),u)}function WO(){}function Ax(o,l){var u=It();l=l===void 0?null:l;var p=u.memoizedState;return l!==null&&RO(l,p[1])?p[0]:(u.memoizedState=[o,l],o)}function Mx(o,l){var u=It();l=l===void 0?null:l;var p=u.memoizedState;if(l!==null&&RO(l,p[1]))return p[0];if(p=o(),ga){wr(!0);try{o()}finally{wr(!1)}}return u.memoizedState=[p,l],p}function qO(o,l,u){return u===void 0||(ls&1073741824)!==0&&(tt&261930)===0?o.memoizedState=l:(o.memoizedState=u,o=zw(),Ie.lanes|=o,oo|=o,u)}function zx(o,l,u,p){return xn(u,l)?u:kl.current!==null?(o=qO(o,u,p),xn(o,l)||(ti=!0),o):(ls&42)===0||(ls&1073741824)!==0&&(tt&261930)===0?(ti=!0,o.memoizedState=u):(o=zw(),Ie.lanes|=o,oo|=o,l)}function jx(o,l,u,p,y){var b=Z.p;Z.p=b!==0&&8>b?b:8;var C=P.T,A={};P.T=A,YO(o,!1,l,u);try{var Y=y(),te=P.S;if(te!==null&&te(A,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var se=$j(Y,p);uh(o,l,se,$n(o))}else uh(o,l,p,$n(o))}catch(he){uh(o,l,{then:function(){},status:"rejected",reason:he},$n())}finally{Z.p=b,C!==null&&A.types!==null&&(C.types=A.types),P.T=C}}function zj(){}function VO(o,l,u,p){if(o.tag!==5)throw Error(n(476));var y=Dx(o).queue;jx(o,y,l,L,u===null?zj:function(){return Bx(o),u(p)})}function Dx(o){var l=o.memoizedState;if(l!==null)return l;l={memoizedState:L,baseState:L,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:L},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:u},next:null},o.memoizedState=l,o=o.alternate,o!==null&&(o.memoizedState=l),l}function Bx(o){var l=Dx(o);l.next===null&&(l=o.alternate.memoizedState),uh(o,l.next.queue,{},$n())}function IO(){return Ci(Qh)}function Lx(){return It().memoizedState}function Xx(){return It().memoizedState}function jj(o){for(var l=o.return;l!==null;){switch(l.tag){case 24:case 3:var u=$n();o=eo(u);var p=to(l,o,u);p!==null&&(pn(p,l,u),oh(p,l,u)),l={cache:bO()},o.payload=l;return}l=l.return}}function Dj(o,l,u){var p=$n();u={lane:p,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},af(o)?Zx(l,u):(u=hO(o,l,u,p),u!==null&&(pn(u,o,p),Wx(u,l,p)))}function Nx(o,l,u){var p=$n();uh(o,l,u,p)}function uh(o,l,u,p){var y={lane:p,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(af(o))Zx(l,y);else{var b=o.alternate;if(o.lanes===0&&(b===null||b.lanes===0)&&(b=l.lastRenderedReducer,b!==null))try{var C=l.lastRenderedState,A=b(C,u);if(y.hasEagerState=!0,y.eagerState=A,xn(A,C))return Xd(o,l,y,0),wt===null&&Ld(),!1}catch{}finally{}if(u=hO(o,l,y,p),u!==null)return pn(u,o,p),Wx(u,l,p),!0}return!1}function YO(o,l,u,p){if(p={lane:2,revertLane:k0(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},af(o)){if(l)throw Error(n(479))}else l=hO(o,u,p,2),l!==null&&pn(l,o,2)}function af(o){var l=o.alternate;return o===Ie||l!==null&&l===Ie}function Zx(o,l){Cl=Jd=!0;var u=o.pending;u===null?l.next=l:(l.next=u.next,u.next=l),o.pending=l}function Wx(o,l,u){if((u&4194048)!==0){var p=l.lanes;p&=o.pendingLanes,u|=p,l.lanes=u,yd(o,u)}}var dh={readContext:Ci,use:nf,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt};dh.useEffectEvent=Xt;var qx={readContext:Ci,use:nf,useCallback:function(o,l){return Hi().memoizedState=[o,l===void 0?null:l],o},useContext:Ci,useEffect:Tx,useImperativeHandle:function(o,l,u){u=u!=null?u.concat([o]):null,sf(4194308,4,Ex.bind(null,l,o),u)},useLayoutEffect:function(o,l){return sf(4194308,4,o,l)},useInsertionEffect:function(o,l){sf(4,2,o,l)},useMemo:function(o,l){var u=Hi();l=l===void 0?null:l;var p=o();if(ga){wr(!0);try{o()}finally{wr(!1)}}return u.memoizedState=[p,l],p},useReducer:function(o,l,u){var p=Hi();if(u!==void 0){var y=u(l);if(ga){wr(!0);try{u(l)}finally{wr(!1)}}}else y=l;return p.memoizedState=p.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},p.queue=o,o=o.dispatch=Dj.bind(null,Ie,o),[p.memoizedState,o]},useRef:function(o){var l=Hi();return o={current:o},l.memoizedState=o},useState:function(o){o=XO(o);var l=o.queue,u=Nx.bind(null,Ie,l);return l.dispatch=u,[o.memoizedState,u]},useDebugValue:WO,useDeferredValue:function(o,l){var u=Hi();return qO(u,o,l)},useTransition:function(){var o=XO(!1);return o=jx.bind(null,Ie,o.queue,!0,!1),Hi().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,l,u){var p=Ie,y=Hi();if(st){if(u===void 0)throw Error(n(407));u=u()}else{if(u=l(),wt===null)throw Error(n(349));(tt&127)!==0||ux(p,l,u)}y.memoizedState=u;var b={value:u,getSnapshot:l};return y.queue=b,Tx(fx.bind(null,p,b,o),[o]),p.flags|=2048,Ql(9,{destroy:void 0},dx.bind(null,p,b,u,l),null),u},useId:function(){var o=Hi(),l=wt.identifierPrefix;if(st){var u=Tr,p=Cr;u=(p&~(1<<32-Yi(p)-1)).toString(32)+u,l="_"+l+"R_"+u,u=ef++,0<u&&(l+="H"+u.toString(32)),l+="_"}else u=Pj++,l="_"+l+"r_"+u.toString(32)+"_";return o.memoizedState=l},useHostTransitionStatus:IO,useFormState:_x,useActionState:_x,useOptimistic:function(o){var l=Hi();l.memoizedState=l.baseState=o;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=u,l=YO.bind(null,Ie,!0,u),u.dispatch=l,[o,l]},useMemoCache:DO,useCacheRefresh:function(){return Hi().memoizedState=jj.bind(null,Ie)},useEffectEvent:function(o){var l=Hi(),u={impl:o};return l.memoizedState=u,function(){if((ft&2)!==0)throw Error(n(440));return u.impl.apply(void 0,arguments)}}},HO={readContext:Ci,use:nf,useCallback:Ax,useContext:Ci,useEffect:ZO,useImperativeHandle:Rx,useInsertionEffect:$x,useLayoutEffect:Px,useMemo:Mx,useReducer:rf,useRef:Cx,useState:function(){return rf(cs)},useDebugValue:WO,useDeferredValue:function(o,l){var u=It();return zx(u,St.memoizedState,o,l)},useTransition:function(){var o=rf(cs)[0],l=It().memoizedState;return[typeof o=="boolean"?o:hh(o),l]},useSyncExternalStore:hx,useId:Lx,useHostTransitionStatus:IO,useFormState:xx,useActionState:xx,useOptimistic:function(o,l){var u=It();return mx(u,St,o,l)},useMemoCache:DO,useCacheRefresh:Xx};HO.useEffectEvent=Qx;var Vx={readContext:Ci,use:nf,useCallback:Ax,useContext:Ci,useEffect:ZO,useImperativeHandle:Rx,useInsertionEffect:$x,useLayoutEffect:Px,useMemo:Mx,useReducer:LO,useRef:Cx,useState:function(){return LO(cs)},useDebugValue:WO,useDeferredValue:function(o,l){var u=It();return St===null?qO(u,o,l):zx(u,St.memoizedState,o,l)},useTransition:function(){var o=LO(cs)[0],l=It().memoizedState;return[typeof o=="boolean"?o:hh(o),l]},useSyncExternalStore:hx,useId:Lx,useHostTransitionStatus:IO,useFormState:kx,useActionState:kx,useOptimistic:function(o,l){var u=It();return St!==null?mx(u,St,o,l):(u.baseState=o,[o,u.queue.dispatch])},useMemoCache:DO,useCacheRefresh:Xx};Vx.useEffectEvent=Qx;function UO(o,l,u,p){l=o.memoizedState,u=u(p,l),u=u==null?l:g({},l,u),o.memoizedState=u,o.lanes===0&&(o.updateQueue.baseState=u)}var GO={enqueueSetState:function(o,l,u){o=o._reactInternals;var p=$n(),y=eo(p);y.payload=l,u!=null&&(y.callback=u),l=to(o,y,p),l!==null&&(pn(l,o,p),oh(l,o,p))},enqueueReplaceState:function(o,l,u){o=o._reactInternals;var p=$n(),y=eo(p);y.tag=1,y.payload=l,u!=null&&(y.callback=u),l=to(o,y,p),l!==null&&(pn(l,o,p),oh(l,o,p))},enqueueForceUpdate:function(o,l){o=o._reactInternals;var u=$n(),p=eo(u);p.tag=2,l!=null&&(p.callback=l),l=to(o,p,u),l!==null&&(pn(l,o,u),oh(l,o,u))}};function Ix(o,l,u,p,y,b,C){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(p,b,C):l.prototype&&l.prototype.isPureReactComponent?!Kc(u,p)||!Kc(y,b):!0}function Yx(o,l,u,p){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(u,p),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(u,p),l.state!==o&&GO.enqueueReplaceState(l,l.state,null)}function ma(o,l){var u=l;if("ref"in l){u={};for(var p in l)p!=="ref"&&(u[p]=l[p])}if(o=o.defaultProps){u===l&&(u=g({},u));for(var y in o)u[y]===void 0&&(u[y]=o[y])}return u}function Hx(o){Bd(o)}function Ux(o){console.error(o)}function Gx(o){Bd(o)}function lf(o,l){try{var u=o.onUncaughtError;u(l.value,{componentStack:l.stack})}catch(p){setTimeout(function(){throw p})}}function Fx(o,l,u){try{var p=o.onCaughtError;p(u.value,{componentStack:u.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function FO(o,l,u){return u=eo(u),u.tag=3,u.payload={element:null},u.callback=function(){lf(o,l)},u}function Kx(o){return o=eo(o),o.tag=3,o}function Jx(o,l,u,p){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var b=p.value;o.payload=function(){return y(b)},o.callback=function(){Fx(l,u,p)}}var C=u.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(o.callback=function(){Fx(l,u,p),typeof y!="function"&&(ao===null?ao=new Set([this]):ao.add(this));var A=p.stack;this.componentDidCatch(p.value,{componentStack:A!==null?A:""})})}function Bj(o,l,u,p,y){if(u.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(l=u.alternate,l!==null&&Sl(l,u,y,!0),u=kn.current,u!==null){switch(u.tag){case 31:case 13:return Yn===null?Sf():u.alternate===null&&Nt===0&&(Nt=3),u.flags&=-257,u.flags|=65536,u.lanes=y,p===Hd?u.flags|=16384:(l=u.updateQueue,l===null?u.updateQueue=new Set([p]):l.add(p),_0(o,p,y)),!1;case 22:return u.flags|=65536,p===Hd?u.flags|=16384:(l=u.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([p])},u.updateQueue=l):(u=l.retryQueue,u===null?l.retryQueue=new Set([p]):u.add(p)),_0(o,p,y)),!1}throw Error(n(435,u.tag))}return _0(o,p,y),Sf(),!1}if(st)return l=kn.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=y,p!==mO&&(o=Error(n(422),{cause:p}),th(Wn(o,u)))):(p!==mO&&(l=Error(n(423),{cause:p}),th(Wn(l,u))),o=o.current.alternate,o.flags|=65536,y&=-y,o.lanes|=y,p=Wn(p,u),y=FO(o.stateNode,p,y),TO(o,y),Nt!==4&&(Nt=2)),!1;var b=Error(n(520),{cause:p});if(b=Wn(b,u),Sh===null?Sh=[b]:Sh.push(b),Nt!==4&&(Nt=2),l===null)return!0;p=Wn(p,u),u=l;do{switch(u.tag){case 3:return u.flags|=65536,o=y&-y,u.lanes|=o,o=FO(u.stateNode,p,o),TO(u,o),!1;case 1:if(l=u.type,b=u.stateNode,(u.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(ao===null||!ao.has(b))))return u.flags|=65536,y&=-y,u.lanes|=y,y=Kx(y),Jx(y,o,u,p),TO(u,y),!1}u=u.return}while(u!==null);return!1}var KO=Error(n(461)),ti=!1;function Ti(o,l,u,p){l.child=o===null?nx(l,null,u,p):pa(l,o.child,u,p)}function ew(o,l,u,p,y){u=u.render;var b=l.ref;if("ref"in p){var C={};for(var A in p)A!=="ref"&&(C[A]=p[A])}else C=p;return ha(l),p=AO(o,l,u,C,b,y),A=MO(),o!==null&&!ti?(zO(o,l,y),hs(o,l,y)):(st&&A&&pO(l),l.flags|=1,Ti(o,l,p,y),l.child)}function tw(o,l,u,p,y){if(o===null){var b=u.type;return typeof b=="function"&&!uO(b)&&b.defaultProps===void 0&&u.compare===null?(l.tag=15,l.type=b,iw(o,l,b,p,y)):(o=Zd(u.type,null,p,l,l.mode,y),o.ref=l.ref,o.return=l,l.child=o)}if(b=o.child,!o0(o,y)){var C=b.memoizedProps;if(u=u.compare,u=u!==null?u:Kc,u(C,p)&&o.ref===l.ref)return hs(o,l,y)}return l.flags|=1,o=rs(b,p),o.ref=l.ref,o.return=l,l.child=o}function iw(o,l,u,p,y){if(o!==null){var b=o.memoizedProps;if(Kc(b,p)&&o.ref===l.ref)if(ti=!1,l.pendingProps=p=b,o0(o,y))(o.flags&131072)!==0&&(ti=!0);else return l.lanes=o.lanes,hs(o,l,y)}return JO(o,l,u,p,y)}function nw(o,l,u,p){var y=p.children,b=o!==null?o.memoizedState:null;if(o===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((l.flags&128)!==0){if(b=b!==null?b.baseLanes|u:u,o!==null){for(p=l.child=o.child,y=0;p!==null;)y=y|p.lanes|p.childLanes,p=p.sibling;p=y&~b}else p=0,l.child=null;return rw(o,l,b,u,p)}if((u&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},o!==null&&Id(l,b!==null?b.cachePool:null),b!==null?ox(l,b):$O(),ax(l);else return p=l.lanes=536870912,rw(o,l,b!==null?b.baseLanes|u:u,u,p)}else b!==null?(Id(l,b.cachePool),ox(l,b),no(),l.memoizedState=null):(o!==null&&Id(l,null),$O(),no());return Ti(o,l,y,u),l.child}function fh(o,l){return o!==null&&o.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function rw(o,l,u,p,y){var b=xO();return b=b===null?null:{parent:Jt._currentValue,pool:b},l.memoizedState={baseLanes:u,cachePool:b},o!==null&&Id(l,null),$O(),ax(l),o!==null&&Sl(o,l,p,!0),l.childLanes=y,null}function cf(o,l){return l=uf({mode:l.mode,children:l.children},o.mode),l.ref=o.ref,o.child=l,l.return=o,l}function sw(o,l,u){return pa(l,o.child,null,u),o=cf(l,l.pendingProps),o.flags|=2,Cn(l),l.memoizedState=null,o}function Lj(o,l,u){var p=l.pendingProps,y=(l.flags&128)!==0;if(l.flags&=-129,o===null){if(st){if(p.mode==="hidden")return o=cf(l,p),l.lanes=536870912,fh(null,o);if(EO(l),(o=$t)?(o=Ok(o,In),o=o!==null&&o.data==="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Us!==null?{id:Cr,overflow:Tr}:null,retryLane:536870912,hydrationErrors:null},u=Z_(o),u.return=l,l.child=u,ki=l,$t=null)):o=null,o===null)throw Fs(l);return l.lanes=536870912,null}return cf(l,p)}var b=o.memoizedState;if(b!==null){var C=b.dehydrated;if(EO(l),y)if(l.flags&256)l.flags&=-257,l=sw(o,l,u);else if(l.memoizedState!==null)l.child=o.child,l.flags|=128,l=null;else throw Error(n(558));else if(ti||Sl(o,l,u,!1),y=(u&o.childLanes)!==0,ti||y){if(p=wt,p!==null&&(C=Sd(p,u),C!==0&&C!==b.retryLane))throw b.retryLane=C,oa(o,C),pn(p,o,C),KO;Sf(),l=sw(o,l,u)}else o=b.treeContext,$t=Hn(C.nextSibling),ki=l,st=!0,Gs=null,In=!1,o!==null&&V_(l,o),l=cf(l,p),l.flags|=4096;return l}return o=rs(o.child,{mode:p.mode,children:p.children}),o.ref=l.ref,l.child=o,o.return=l,o}function hf(o,l){var u=l.ref;if(u===null)o!==null&&o.ref!==null&&(l.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(n(284));(o===null||o.ref!==u)&&(l.flags|=4194816)}}function JO(o,l,u,p,y){return ha(l),u=AO(o,l,u,p,void 0,y),p=MO(),o!==null&&!ti?(zO(o,l,y),hs(o,l,y)):(st&&p&&pO(l),l.flags|=1,Ti(o,l,u,y),l.child)}function ow(o,l,u,p,y,b){return ha(l),l.updateQueue=null,u=cx(l,p,u,y),lx(o),p=MO(),o!==null&&!ti?(zO(o,l,b),hs(o,l,b)):(st&&p&&pO(l),l.flags|=1,Ti(o,l,u,b),l.child)}function aw(o,l,u,p,y){if(ha(l),l.stateNode===null){var b=ml,C=u.contextType;typeof C=="object"&&C!==null&&(b=Ci(C)),b=new u(p,b),l.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=GO,l.stateNode=b,b._reactInternals=l,b=l.stateNode,b.props=p,b.state=l.memoizedState,b.refs={},kO(l),C=u.contextType,b.context=typeof C=="object"&&C!==null?Ci(C):ml,b.state=l.memoizedState,C=u.getDerivedStateFromProps,typeof C=="function"&&(UO(l,u,C,p),b.state=l.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(C=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),C!==b.state&&GO.enqueueReplaceState(b,b.state,null),lh(l,p,b,y),ah(),b.state=l.memoizedState),typeof b.componentDidMount=="function"&&(l.flags|=4194308),p=!0}else if(o===null){b=l.stateNode;var A=l.memoizedProps,Y=ma(u,A);b.props=Y;var te=b.context,se=u.contextType;C=ml,typeof se=="object"&&se!==null&&(C=Ci(se));var he=u.getDerivedStateFromProps;se=typeof he=="function"||typeof b.getSnapshotBeforeUpdate=="function",A=l.pendingProps!==A,se||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(A||te!==C)&&Yx(l,b,p,C),Js=!1;var ne=l.memoizedState;b.state=ne,lh(l,p,b,y),ah(),te=l.memoizedState,A||ne!==te||Js?(typeof he=="function"&&(UO(l,u,he,p),te=l.memoizedState),(Y=Js||Ix(l,u,Y,p,ne,te,C))?(se||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(l.flags|=4194308)):(typeof b.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=p,l.memoizedState=te),b.props=p,b.state=te,b.context=C,p=Y):(typeof b.componentDidMount=="function"&&(l.flags|=4194308),p=!1)}else{b=l.stateNode,CO(o,l),C=l.memoizedProps,se=ma(u,C),b.props=se,he=l.pendingProps,ne=b.context,te=u.contextType,Y=ml,typeof te=="object"&&te!==null&&(Y=Ci(te)),A=u.getDerivedStateFromProps,(te=typeof A=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(C!==he||ne!==Y)&&Yx(l,b,p,Y),Js=!1,ne=l.memoizedState,b.state=ne,lh(l,p,b,y),ah();var re=l.memoizedState;C!==he||ne!==re||Js||o!==null&&o.dependencies!==null&&qd(o.dependencies)?(typeof A=="function"&&(UO(l,u,A,p),re=l.memoizedState),(se=Js||Ix(l,u,se,p,ne,re,Y)||o!==null&&o.dependencies!==null&&qd(o.dependencies))?(te||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(p,re,Y),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(p,re,Y)),typeof b.componentDidUpdate=="function"&&(l.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof b.componentDidUpdate!="function"||C===o.memoizedProps&&ne===o.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||C===o.memoizedProps&&ne===o.memoizedState||(l.flags|=1024),l.memoizedProps=p,l.memoizedState=re),b.props=p,b.state=re,b.context=Y,p=se):(typeof b.componentDidUpdate!="function"||C===o.memoizedProps&&ne===o.memoizedState||(l.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||C===o.memoizedProps&&ne===o.memoizedState||(l.flags|=1024),p=!1)}return b=p,hf(o,l),p=(l.flags&128)!==0,b||p?(b=l.stateNode,u=p&&typeof u.getDerivedStateFromError!="function"?null:b.render(),l.flags|=1,o!==null&&p?(l.child=pa(l,o.child,null,y),l.child=pa(l,null,u,y)):Ti(o,l,u,y),l.memoizedState=b.state,o=l.child):o=hs(o,l,y),o}function lw(o,l,u,p){return la(),l.flags|=256,Ti(o,l,u,p),l.child}var e0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function t0(o){return{baseLanes:o,cachePool:F_()}}function i0(o,l,u){return o=o!==null?o.childLanes&~u:0,l&&(o|=Qn),o}function cw(o,l,u){var p=l.pendingProps,y=!1,b=(l.flags&128)!==0,C;if((C=b)||(C=o!==null&&o.memoizedState===null?!1:(Vt.current&2)!==0),C&&(y=!0,l.flags&=-129),C=(l.flags&32)!==0,l.flags&=-33,o===null){if(st){if(y?io(l):no(),(o=$t)?(o=Ok(o,In),o=o!==null&&o.data!=="&"?o:null,o!==null&&(l.memoizedState={dehydrated:o,treeContext:Us!==null?{id:Cr,overflow:Tr}:null,retryLane:536870912,hydrationErrors:null},u=Z_(o),u.return=l,l.child=u,ki=l,$t=null)):o=null,o===null)throw Fs(l);return B0(o)?l.lanes=32:l.lanes=536870912,null}var A=p.children;return p=p.fallback,y?(no(),y=l.mode,A=uf({mode:"hidden",children:A},y),p=aa(p,y,u,null),A.return=l,p.return=l,A.sibling=p,l.child=A,p=l.child,p.memoizedState=t0(u),p.childLanes=i0(o,C,u),l.memoizedState=e0,fh(null,p)):(io(l),n0(l,A))}var Y=o.memoizedState;if(Y!==null&&(A=Y.dehydrated,A!==null)){if(b)l.flags&256?(io(l),l.flags&=-257,l=r0(o,l,u)):l.memoizedState!==null?(no(),l.child=o.child,l.flags|=128,l=null):(no(),A=p.fallback,y=l.mode,p=uf({mode:"visible",children:p.children},y),A=aa(A,y,u,null),A.flags|=2,p.return=l,A.return=l,p.sibling=A,l.child=p,pa(l,o.child,null,u),p=l.child,p.memoizedState=t0(u),p.childLanes=i0(o,C,u),l.memoizedState=e0,l=fh(null,p));else if(io(l),B0(A)){if(C=A.nextSibling&&A.nextSibling.dataset,C)var te=C.dgst;C=te,p=Error(n(419)),p.stack="",p.digest=C,th({value:p,source:null,stack:null}),l=r0(o,l,u)}else if(ti||Sl(o,l,u,!1),C=(u&o.childLanes)!==0,ti||C){if(C=wt,C!==null&&(p=Sd(C,u),p!==0&&p!==Y.retryLane))throw Y.retryLane=p,oa(o,p),pn(C,o,p),KO;D0(A)||Sf(),l=r0(o,l,u)}else D0(A)?(l.flags|=192,l.child=o.child,l=null):(o=Y.treeContext,$t=Hn(A.nextSibling),ki=l,st=!0,Gs=null,In=!1,o!==null&&V_(l,o),l=n0(l,p.children),l.flags|=4096);return l}return y?(no(),A=p.fallback,y=l.mode,Y=o.child,te=Y.sibling,p=rs(Y,{mode:"hidden",children:p.children}),p.subtreeFlags=Y.subtreeFlags&65011712,te!==null?A=rs(te,A):(A=aa(A,y,u,null),A.flags|=2),A.return=l,p.return=l,p.sibling=A,l.child=p,fh(null,p),p=l.child,A=o.child.memoizedState,A===null?A=t0(u):(y=A.cachePool,y!==null?(Y=Jt._currentValue,y=y.parent!==Y?{parent:Y,pool:Y}:y):y=F_(),A={baseLanes:A.baseLanes|u,cachePool:y}),p.memoizedState=A,p.childLanes=i0(o,C,u),l.memoizedState=e0,fh(o.child,p)):(io(l),u=o.child,o=u.sibling,u=rs(u,{mode:"visible",children:p.children}),u.return=l,u.sibling=null,o!==null&&(C=l.deletions,C===null?(l.deletions=[o],l.flags|=16):C.push(o)),l.child=u,l.memoizedState=null,u)}function n0(o,l){return l=uf({mode:"visible",children:l},o.mode),l.return=o,o.child=l}function uf(o,l){return o=wn(22,o,null,l),o.lanes=0,o}function r0(o,l,u){return pa(l,o.child,null,u),o=n0(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function hw(o,l,u){o.lanes|=l;var p=o.alternate;p!==null&&(p.lanes|=l),yO(o.return,l,u)}function s0(o,l,u,p,y,b){var C=o.memoizedState;C===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:p,tail:u,tailMode:y,treeForkCount:b}:(C.isBackwards=l,C.rendering=null,C.renderingStartTime=0,C.last=p,C.tail=u,C.tailMode=y,C.treeForkCount=b)}function uw(o,l,u){var p=l.pendingProps,y=p.revealOrder,b=p.tail;p=p.children;var C=Vt.current,A=(C&2)!==0;if(A?(C=C&1|2,l.flags|=128):C&=1,K(Vt,C),Ti(o,l,p,u),p=st?eh:0,!A&&o!==null&&(o.flags&128)!==0)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&hw(o,u,l);else if(o.tag===19)hw(o,u,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(y){case"forwards":for(u=l.child,y=null;u!==null;)o=u.alternate,o!==null&&Kd(o)===null&&(y=u),u=u.sibling;u=y,u===null?(y=l.child,l.child=null):(y=u.sibling,u.sibling=null),s0(l,!1,y,u,b,p);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=l.child,l.child=null;y!==null;){if(o=y.alternate,o!==null&&Kd(o)===null){l.child=y;break}o=y.sibling,y.sibling=u,u=y,y=o}s0(l,!0,u,null,b,p);break;case"together":s0(l,!1,null,null,void 0,p);break;default:l.memoizedState=null}return l.child}function hs(o,l,u){if(o!==null&&(l.dependencies=o.dependencies),oo|=l.lanes,(u&l.childLanes)===0)if(o!==null){if(Sl(o,l,u,!1),(u&l.childLanes)===0)return null}else return null;if(o!==null&&l.child!==o.child)throw Error(n(153));if(l.child!==null){for(o=l.child,u=rs(o,o.pendingProps),l.child=u,u.return=l;o.sibling!==null;)o=o.sibling,u=u.sibling=rs(o,o.pendingProps),u.return=l;u.sibling=null}return l.child}function o0(o,l){return(o.lanes&l)!==0?!0:(o=o.dependencies,!!(o!==null&&qd(o)))}function Xj(o,l,u){switch(l.tag){case 3:fe(l,l.stateNode.containerInfo),Ks(l,Jt,o.memoizedState.cache),la();break;case 27:case 5:De(l);break;case 4:fe(l,l.stateNode.containerInfo);break;case 10:Ks(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,EO(l),null;break;case 13:var p=l.memoizedState;if(p!==null)return p.dehydrated!==null?(io(l),l.flags|=128,null):(u&l.child.childLanes)!==0?cw(o,l,u):(io(l),o=hs(o,l,u),o!==null?o.sibling:null);io(l);break;case 19:var y=(o.flags&128)!==0;if(p=(u&l.childLanes)!==0,p||(Sl(o,l,u,!1),p=(u&l.childLanes)!==0),y){if(p)return uw(o,l,u);l.flags|=128}if(y=l.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),K(Vt,Vt.current),p)break;return null;case 22:return l.lanes=0,nw(o,l,u,l.pendingProps);case 24:Ks(l,Jt,o.memoizedState.cache)}return hs(o,l,u)}function dw(o,l,u){if(o!==null)if(o.memoizedProps!==l.pendingProps)ti=!0;else{if(!o0(o,u)&&(l.flags&128)===0)return ti=!1,Xj(o,l,u);ti=(o.flags&131072)!==0}else ti=!1,st&&(l.flags&1048576)!==0&&q_(l,eh,l.index);switch(l.lanes=0,l.tag){case 16:e:{var p=l.pendingProps;if(o=da(l.elementType),l.type=o,typeof o=="function")uO(o)?(p=ma(o,p),l.tag=1,l=aw(null,l,o,p,u)):(l.tag=0,l=JO(null,l,o,p,u));else{if(o!=null){var y=o.$$typeof;if(y===T){l.tag=11,l=ew(null,l,o,p,u);break e}else if(y===R){l.tag=14,l=tw(null,l,o,p,u);break e}}throw l=E(o)||o,Error(n(306,l,""))}}return l;case 0:return JO(o,l,l.type,l.pendingProps,u);case 1:return p=l.type,y=ma(p,l.pendingProps),aw(o,l,p,y,u);case 3:e:{if(fe(l,l.stateNode.containerInfo),o===null)throw Error(n(387));p=l.pendingProps;var b=l.memoizedState;y=b.element,CO(o,l),lh(l,p,null,u);var C=l.memoizedState;if(p=C.cache,Ks(l,Jt,p),p!==b.cache&&SO(l,[Jt],u,!0),ah(),p=C.element,b.isDehydrated)if(b={element:p,isDehydrated:!1,cache:C.cache},l.updateQueue.baseState=b,l.memoizedState=b,l.flags&256){l=lw(o,l,p,u);break e}else if(p!==y){y=Wn(Error(n(424)),l),th(y),l=lw(o,l,p,u);break e}else{switch(o=l.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for($t=Hn(o.firstChild),ki=l,st=!0,Gs=null,In=!0,u=nx(l,null,p,u),l.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(la(),p===y){l=hs(o,l,u);break e}Ti(o,l,p,u)}l=l.child}return l;case 26:return hf(o,l),o===null?(u=xk(l.type,null,l.pendingProps,null))?l.memoizedState=u:st||(u=l.type,o=l.pendingProps,p=Tf(de.current).createElement(u),p[li]=l,p[Di]=o,Qi(p,u,o),Kt(p),l.stateNode=p):l.memoizedState=xk(l.type,o.memoizedProps,l.pendingProps,o.memoizedState),null;case 27:return De(l),o===null&&st&&(p=l.stateNode=Sk(l.type,l.pendingProps,de.current),ki=l,In=!0,y=$t,uo(l.type)?(L0=y,$t=Hn(p.firstChild)):$t=y),Ti(o,l,l.pendingProps.children,u),hf(o,l),o===null&&(l.flags|=4194304),l.child;case 5:return o===null&&st&&((y=p=$t)&&(p=m3(p,l.type,l.pendingProps,In),p!==null?(l.stateNode=p,ki=l,$t=Hn(p.firstChild),In=!1,y=!0):y=!1),y||Fs(l)),De(l),y=l.type,b=l.pendingProps,C=o!==null?o.memoizedProps:null,p=b.children,M0(y,b)?p=null:C!==null&&M0(y,C)&&(l.flags|=32),l.memoizedState!==null&&(y=AO(o,l,Ej,null,null,u),Qh._currentValue=y),hf(o,l),Ti(o,l,p,u),l.child;case 6:return o===null&&st&&((o=u=$t)&&(u=O3(u,l.pendingProps,In),u!==null?(l.stateNode=u,ki=l,$t=null,o=!0):o=!1),o||Fs(l)),null;case 13:return cw(o,l,u);case 4:return fe(l,l.stateNode.containerInfo),p=l.pendingProps,o===null?l.child=pa(l,null,p,u):Ti(o,l,p,u),l.child;case 11:return ew(o,l,l.type,l.pendingProps,u);case 7:return Ti(o,l,l.pendingProps,u),l.child;case 8:return Ti(o,l,l.pendingProps.children,u),l.child;case 12:return Ti(o,l,l.pendingProps.children,u),l.child;case 10:return p=l.pendingProps,Ks(l,l.type,p.value),Ti(o,l,p.children,u),l.child;case 9:return y=l.type._context,p=l.pendingProps.children,ha(l),y=Ci(y),p=p(y),l.flags|=1,Ti(o,l,p,u),l.child;case 14:return tw(o,l,l.type,l.pendingProps,u);case 15:return iw(o,l,l.type,l.pendingProps,u);case 19:return uw(o,l,u);case 31:return Lj(o,l,u);case 22:return nw(o,l,u,l.pendingProps);case 24:return ha(l),p=Ci(Jt),o===null?(y=xO(),y===null&&(y=wt,b=bO(),y.pooledCache=b,b.refCount++,b!==null&&(y.pooledCacheLanes|=u),y=b),l.memoizedState={parent:p,cache:y},kO(l),Ks(l,Jt,y)):((o.lanes&u)!==0&&(CO(o,l),lh(l,null,null,u),ah()),y=o.memoizedState,b=l.memoizedState,y.parent!==p?(y={parent:p,cache:p},l.memoizedState=y,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=y),Ks(l,Jt,p)):(p=b.cache,Ks(l,Jt,p),p!==y.cache&&SO(l,[Jt],u,!0))),Ti(o,l,l.pendingProps.children,u),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function us(o){o.flags|=4}function a0(o,l,u,p,y){if((l=(o.mode&32)!==0)&&(l=!1),l){if(o.flags|=16777216,(y&335544128)===y)if(o.stateNode.complete)o.flags|=8192;else if(Lw())o.flags|=8192;else throw fa=Hd,wO}else o.flags&=-16777217}function fw(o,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!Qk(l))if(Lw())o.flags|=8192;else throw fa=Hd,wO}function df(o,l){l!==null&&(o.flags|=4),o.flags&16384&&(l=o.tag!==22?Od():536870912,o.lanes|=l,Rl|=l)}function ph(o,l){if(!st)switch(o.tailMode){case"hidden":l=o.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?o.tail=null:u.sibling=null;break;case"collapsed":u=o.tail;for(var p=null;u!==null;)u.alternate!==null&&(p=u),u=u.sibling;p===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:p.sibling=null}}function Pt(o){var l=o.alternate!==null&&o.alternate.child===o.child,u=0,p=0;if(l)for(var y=o.child;y!==null;)u|=y.lanes|y.childLanes,p|=y.subtreeFlags&65011712,p|=y.flags&65011712,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)u|=y.lanes|y.childLanes,p|=y.subtreeFlags,p|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=p,o.childLanes=u,l}function Nj(o,l,u){var p=l.pendingProps;switch(gO(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(l),null;case 1:return Pt(l),null;case 3:return u=l.stateNode,p=null,o!==null&&(p=o.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),as(Jt),ve(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(o===null||o.child===null)&&(yl(l)?us(l):o===null||o.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,OO())),Pt(l),null;case 26:var y=l.type,b=l.memoizedState;return o===null?(us(l),b!==null?(Pt(l),fw(l,b)):(Pt(l),a0(l,y,null,p,u))):b?b!==o.memoizedState?(us(l),Pt(l),fw(l,b)):(Pt(l),l.flags&=-16777217):(o=o.memoizedProps,o!==p&&us(l),Pt(l),a0(l,y,o,p,u)),null;case 27:if(Ee(l),u=de.current,y=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==p&&us(l);else{if(!p){if(l.stateNode===null)throw Error(n(166));return Pt(l),null}o=ie.current,yl(l)?I_(l):(o=Sk(y,p,u),l.stateNode=o,us(l))}return Pt(l),null;case 5:if(Ee(l),y=l.type,o!==null&&l.stateNode!=null)o.memoizedProps!==p&&us(l);else{if(!p){if(l.stateNode===null)throw Error(n(166));return Pt(l),null}if(b=ie.current,yl(l))I_(l);else{var C=Tf(de.current);switch(b){case 1:b=C.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:b=C.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":b=C.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":b=C.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":b=C.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof p.is=="string"?C.createElement("select",{is:p.is}):C.createElement("select"),p.multiple?b.multiple=!0:p.size&&(b.size=p.size);break;default:b=typeof p.is=="string"?C.createElement(y,{is:p.is}):C.createElement(y)}}b[li]=l,b[Di]=p;e:for(C=l.child;C!==null;){if(C.tag===5||C.tag===6)b.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===l)break e;for(;C.sibling===null;){if(C.return===null||C.return===l)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}l.stateNode=b;e:switch(Qi(b,y,p),y){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&us(l)}}return Pt(l),a0(l,l.type,o===null?null:o.memoizedProps,l.pendingProps,u),null;case 6:if(o&&l.stateNode!=null)o.memoizedProps!==p&&us(l);else{if(typeof p!="string"&&l.stateNode===null)throw Error(n(166));if(o=de.current,yl(l)){if(o=l.stateNode,u=l.memoizedProps,p=null,y=ki,y!==null)switch(y.tag){case 27:case 5:p=y.memoizedProps}o[li]=l,o=!!(o.nodeValue===u||p!==null&&p.suppressHydrationWarning===!0||ck(o.nodeValue,u)),o||Fs(l,!0)}else o=Tf(o).createTextNode(p),o[li]=l,l.stateNode=o}return Pt(l),null;case 31:if(u=l.memoizedState,o===null||o.memoizedState!==null){if(p=yl(l),u!==null){if(o===null){if(!p)throw Error(n(318));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(557));o[li]=l}else la(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Pt(l),o=!1}else u=OO(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=u),o=!0;if(!o)return l.flags&256?(Cn(l),l):(Cn(l),null);if((l.flags&128)!==0)throw Error(n(558))}return Pt(l),null;case 13:if(p=l.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=yl(l),p!==null&&p.dehydrated!==null){if(o===null){if(!y)throw Error(n(318));if(y=l.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(n(317));y[li]=l}else la(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Pt(l),y=!1}else y=OO(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return l.flags&256?(Cn(l),l):(Cn(l),null)}return Cn(l),(l.flags&128)!==0?(l.lanes=u,l):(u=p!==null,o=o!==null&&o.memoizedState!==null,u&&(p=l.child,y=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(y=p.alternate.memoizedState.cachePool.pool),b=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(b=p.memoizedState.cachePool.pool),b!==y&&(p.flags|=2048)),u!==o&&u&&(l.child.flags|=8192),df(l,l.updateQueue),Pt(l),null);case 4:return ve(),o===null&&$0(l.stateNode.containerInfo),Pt(l),null;case 10:return as(l.type),Pt(l),null;case 19:if(q(Vt),p=l.memoizedState,p===null)return Pt(l),null;if(y=(l.flags&128)!==0,b=p.rendering,b===null)if(y)ph(p,!1);else{if(Nt!==0||o!==null&&(o.flags&128)!==0)for(o=l.child;o!==null;){if(b=Kd(o),b!==null){for(l.flags|=128,ph(p,!1),o=b.updateQueue,l.updateQueue=o,df(l,o),l.subtreeFlags=0,o=u,u=l.child;u!==null;)N_(u,o),u=u.sibling;return K(Vt,Vt.current&1|2),st&&ss(l,p.treeForkCount),l.child}o=o.sibling}p.tail!==null&&Le()>Of&&(l.flags|=128,y=!0,ph(p,!1),l.lanes=4194304)}else{if(!y)if(o=Kd(b),o!==null){if(l.flags|=128,y=!0,o=o.updateQueue,l.updateQueue=o,df(l,o),ph(p,!0),p.tail===null&&p.tailMode==="hidden"&&!b.alternate&&!st)return Pt(l),null}else 2*Le()-p.renderingStartTime>Of&&u!==536870912&&(l.flags|=128,y=!0,ph(p,!1),l.lanes=4194304);p.isBackwards?(b.sibling=l.child,l.child=b):(o=p.last,o!==null?o.sibling=b:l.child=b,p.last=b)}return p.tail!==null?(o=p.tail,p.rendering=o,p.tail=o.sibling,p.renderingStartTime=Le(),o.sibling=null,u=Vt.current,K(Vt,y?u&1|2:u&1),st&&ss(l,p.treeForkCount),o):(Pt(l),null);case 22:case 23:return Cn(l),PO(),p=l.memoizedState!==null,o!==null?o.memoizedState!==null!==p&&(l.flags|=8192):p&&(l.flags|=8192),p?(u&536870912)!==0&&(l.flags&128)===0&&(Pt(l),l.subtreeFlags&6&&(l.flags|=8192)):Pt(l),u=l.updateQueue,u!==null&&df(l,u.retryQueue),u=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==u&&(l.flags|=2048),o!==null&&q(ua),null;case 24:return u=null,o!==null&&(u=o.memoizedState.cache),l.memoizedState.cache!==u&&(l.flags|=2048),as(Jt),Pt(l),null;case 25:return null;case 30:return null}throw Error(n(156,l.tag))}function Zj(o,l){switch(gO(l),l.tag){case 1:return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return as(Jt),ve(),o=l.flags,(o&65536)!==0&&(o&128)===0?(l.flags=o&-65537|128,l):null;case 26:case 27:case 5:return Ee(l),null;case 31:if(l.memoizedState!==null){if(Cn(l),l.alternate===null)throw Error(n(340));la()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 13:if(Cn(l),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(n(340));la()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return q(Vt),null;case 4:return ve(),null;case 10:return as(l.type),null;case 22:case 23:return Cn(l),PO(),o!==null&&q(ua),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 24:return as(Jt),null;case 25:return null;default:return null}}function pw(o,l){switch(gO(l),l.tag){case 3:as(Jt),ve();break;case 26:case 27:case 5:Ee(l);break;case 4:ve();break;case 31:l.memoizedState!==null&&Cn(l);break;case 13:Cn(l);break;case 19:q(Vt);break;case 10:as(l.type);break;case 22:case 23:Cn(l),PO(),o!==null&&q(ua);break;case 24:as(Jt)}}function gh(o,l){try{var u=l.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var y=p.next;u=y;do{if((u.tag&o)===o){p=void 0;var b=u.create,C=u.inst;p=b(),C.destroy=p}u=u.next}while(u!==y)}}catch(A){yt(l,l.return,A)}}function ro(o,l,u){try{var p=l.updateQueue,y=p!==null?p.lastEffect:null;if(y!==null){var b=y.next;p=b;do{if((p.tag&o)===o){var C=p.inst,A=C.destroy;if(A!==void 0){C.destroy=void 0,y=l;var Y=u,te=A;try{te()}catch(se){yt(y,Y,se)}}}p=p.next}while(p!==b)}}catch(se){yt(l,l.return,se)}}function gw(o){var l=o.updateQueue;if(l!==null){var u=o.stateNode;try{sx(l,u)}catch(p){yt(o,o.return,p)}}}function mw(o,l,u){u.props=ma(o.type,o.memoizedProps),u.state=o.memoizedState;try{u.componentWillUnmount()}catch(p){yt(o,l,p)}}function mh(o,l){try{var u=o.ref;if(u!==null){switch(o.tag){case 26:case 27:case 5:var p=o.stateNode;break;case 30:p=o.stateNode;break;default:p=o.stateNode}typeof u=="function"?o.refCleanup=u(p):u.current=p}}catch(y){yt(o,l,y)}}function Qr(o,l){var u=o.ref,p=o.refCleanup;if(u!==null)if(typeof p=="function")try{p()}catch(y){yt(o,l,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){yt(o,l,y)}else u.current=null}function Ow(o){var l=o.type,u=o.memoizedProps,p=o.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":u.autoFocus&&p.focus();break e;case"img":u.src?p.src=u.src:u.srcSet&&(p.srcset=u.srcSet)}}catch(y){yt(o,o.return,y)}}function l0(o,l,u){try{var p=o.stateNode;h3(p,o.type,u,l),p[Di]=l}catch(y){yt(o,o.return,y)}}function vw(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&uo(o.type)||o.tag===4}function c0(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||vw(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&uo(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function h0(o,l,u){var p=o.tag;if(p===5||p===6)o=o.stateNode,l?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(o,l):(l=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,l.appendChild(o),u=u._reactRootContainer,u!=null||l.onclick!==null||(l.onclick=is));else if(p!==4&&(p===27&&uo(o.type)&&(u=o.stateNode,l=null),o=o.child,o!==null))for(h0(o,l,u),o=o.sibling;o!==null;)h0(o,l,u),o=o.sibling}function ff(o,l,u){var p=o.tag;if(p===5||p===6)o=o.stateNode,l?u.insertBefore(o,l):u.appendChild(o);else if(p!==4&&(p===27&&uo(o.type)&&(u=o.stateNode),o=o.child,o!==null))for(ff(o,l,u),o=o.sibling;o!==null;)ff(o,l,u),o=o.sibling}function yw(o){var l=o.stateNode,u=o.memoizedProps;try{for(var p=o.type,y=l.attributes;y.length;)l.removeAttributeNode(y[0]);Qi(l,p,u),l[li]=o,l[Di]=u}catch(b){yt(o,o.return,b)}}var ds=!1,ii=!1,u0=!1,Sw=typeof WeakSet=="function"?WeakSet:Set,mi=null;function Wj(o,l){if(o=o.containerInfo,R0=Mf,o=R_(o),rO(o)){if("selectionStart"in o)var u={start:o.selectionStart,end:o.selectionEnd};else e:{u=(u=o.ownerDocument)&&u.defaultView||window;var p=u.getSelection&&u.getSelection();if(p&&p.rangeCount!==0){u=p.anchorNode;var y=p.anchorOffset,b=p.focusNode;p=p.focusOffset;try{u.nodeType,b.nodeType}catch{u=null;break e}var C=0,A=-1,Y=-1,te=0,se=0,he=o,ne=null;t:for(;;){for(var re;he!==u||y!==0&&he.nodeType!==3||(A=C+y),he!==b||p!==0&&he.nodeType!==3||(Y=C+p),he.nodeType===3&&(C+=he.nodeValue.length),(re=he.firstChild)!==null;)ne=he,he=re;for(;;){if(he===o)break t;if(ne===u&&++te===y&&(A=C),ne===b&&++se===p&&(Y=C),(re=he.nextSibling)!==null)break;he=ne,ne=he.parentNode}he=re}u=A===-1||Y===-1?null:{start:A,end:Y}}else u=null}u=u||{start:0,end:0}}else u=null;for(A0={focusedElem:o,selectionRange:u},Mf=!1,mi=l;mi!==null;)if(l=mi,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,mi=o;else for(;mi!==null;){switch(l=mi,b=l.alternate,o=l.flags,l.tag){case 0:if((o&4)!==0&&(o=l.updateQueue,o=o!==null?o.events:null,o!==null))for(u=0;u<o.length;u++)y=o[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&b!==null){o=void 0,u=l,y=b.memoizedProps,b=b.memoizedState,p=u.stateNode;try{var we=ma(u.type,y);o=p.getSnapshotBeforeUpdate(we,b),p.__reactInternalSnapshotBeforeUpdate=o}catch(ze){yt(u,u.return,ze)}}break;case 3:if((o&1024)!==0){if(o=l.stateNode.containerInfo,u=o.nodeType,u===9)j0(o);else if(u===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":j0(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(n(163))}if(o=l.sibling,o!==null){o.return=l.return,mi=o;break}mi=l.return}}function bw(o,l,u){var p=u.flags;switch(u.tag){case 0:case 11:case 15:ps(o,u),p&4&&gh(5,u);break;case 1:if(ps(o,u),p&4)if(o=u.stateNode,l===null)try{o.componentDidMount()}catch(C){yt(u,u.return,C)}else{var y=ma(u.type,l.memoizedProps);l=l.memoizedState;try{o.componentDidUpdate(y,l,o.__reactInternalSnapshotBeforeUpdate)}catch(C){yt(u,u.return,C)}}p&64&&gw(u),p&512&&mh(u,u.return);break;case 3:if(ps(o,u),p&64&&(o=u.updateQueue,o!==null)){if(l=null,u.child!==null)switch(u.child.tag){case 27:case 5:l=u.child.stateNode;break;case 1:l=u.child.stateNode}try{sx(o,l)}catch(C){yt(u,u.return,C)}}break;case 27:l===null&&p&4&&yw(u);case 26:case 5:ps(o,u),l===null&&p&4&&Ow(u),p&512&&mh(u,u.return);break;case 12:ps(o,u);break;case 31:ps(o,u),p&4&&ww(o,u);break;case 13:ps(o,u),p&4&&kw(o,u),p&64&&(o=u.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(u=Kj.bind(null,u),v3(o,u))));break;case 22:if(p=u.memoizedState!==null||ds,!p){l=l!==null&&l.memoizedState!==null||ii,y=ds;var b=ii;ds=p,(ii=l)&&!b?gs(o,u,(u.subtreeFlags&8772)!==0):ps(o,u),ds=y,ii=b}break;case 30:break;default:ps(o,u)}}function _w(o){var l=o.alternate;l!==null&&(o.alternate=null,_w(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&Zc(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Rt=null,hn=!1;function fs(o,l,u){for(u=u.child;u!==null;)xw(o,l,u),u=u.sibling}function xw(o,l,u){if(Ii&&typeof Ii.onCommitFiberUnmount=="function")try{Ii.onCommitFiberUnmount(Fo,u)}catch{}switch(u.tag){case 26:ii||Qr(u,l),fs(o,l,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:ii||Qr(u,l);var p=Rt,y=hn;uo(u.type)&&(Rt=u.stateNode,hn=!1),fs(o,l,u),kh(u.stateNode),Rt=p,hn=y;break;case 5:ii||Qr(u,l);case 6:if(p=Rt,y=hn,Rt=null,fs(o,l,u),Rt=p,hn=y,Rt!==null)if(hn)try{(Rt.nodeType===9?Rt.body:Rt.nodeName==="HTML"?Rt.ownerDocument.body:Rt).removeChild(u.stateNode)}catch(b){yt(u,l,b)}else try{Rt.removeChild(u.stateNode)}catch(b){yt(u,l,b)}break;case 18:Rt!==null&&(hn?(o=Rt,gk(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,u.stateNode),Xl(o)):gk(Rt,u.stateNode));break;case 4:p=Rt,y=hn,Rt=u.stateNode.containerInfo,hn=!0,fs(o,l,u),Rt=p,hn=y;break;case 0:case 11:case 14:case 15:ro(2,u,l),ii||ro(4,u,l),fs(o,l,u);break;case 1:ii||(Qr(u,l),p=u.stateNode,typeof p.componentWillUnmount=="function"&&mw(u,l,p)),fs(o,l,u);break;case 21:fs(o,l,u);break;case 22:ii=(p=ii)||u.memoizedState!==null,fs(o,l,u),ii=p;break;default:fs(o,l,u)}}function ww(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Xl(o)}catch(u){yt(l,l.return,u)}}}function kw(o,l){if(l.memoizedState===null&&(o=l.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Xl(o)}catch(u){yt(l,l.return,u)}}function qj(o){switch(o.tag){case 31:case 13:case 19:var l=o.stateNode;return l===null&&(l=o.stateNode=new Sw),l;case 22:return o=o.stateNode,l=o._retryCache,l===null&&(l=o._retryCache=new Sw),l;default:throw Error(n(435,o.tag))}}function pf(o,l){var u=qj(o);l.forEach(function(p){if(!u.has(p)){u.add(p);var y=Jj.bind(null,o,p);p.then(y,y)}})}function un(o,l){var u=l.deletions;if(u!==null)for(var p=0;p<u.length;p++){var y=u[p],b=o,C=l,A=C;e:for(;A!==null;){switch(A.tag){case 27:if(uo(A.type)){Rt=A.stateNode,hn=!1;break e}break;case 5:Rt=A.stateNode,hn=!1;break e;case 3:case 4:Rt=A.stateNode.containerInfo,hn=!0;break e}A=A.return}if(Rt===null)throw Error(n(160));xw(b,C,y),Rt=null,hn=!1,b=y.alternate,b!==null&&(b.return=null),y.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)Cw(l,o),l=l.sibling}var hr=null;function Cw(o,l){var u=o.alternate,p=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:un(l,o),dn(o),p&4&&(ro(3,o,o.return),gh(3,o),ro(5,o,o.return));break;case 1:un(l,o),dn(o),p&512&&(ii||u===null||Qr(u,u.return)),p&64&&ds&&(o=o.updateQueue,o!==null&&(p=o.callbacks,p!==null&&(u=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=u===null?p:u.concat(p))));break;case 26:var y=hr;if(un(l,o),dn(o),p&512&&(ii||u===null||Qr(u,u.return)),p&4){var b=u!==null?u.memoizedState:null;if(p=o.memoizedState,u===null)if(p===null)if(o.stateNode===null){e:{p=o.type,u=o.memoizedProps,y=y.ownerDocument||y;t:switch(p){case"title":b=y.getElementsByTagName("title")[0],(!b||b[ea]||b[li]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=y.createElement(p),y.head.insertBefore(b,y.querySelector("head > title"))),Qi(b,p,u),b[li]=o,Kt(b),p=b;break e;case"link":var C=Ck("link","href",y).get(p+(u.href||""));if(C){for(var A=0;A<C.length;A++)if(b=C[A],b.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&b.getAttribute("rel")===(u.rel==null?null:u.rel)&&b.getAttribute("title")===(u.title==null?null:u.title)&&b.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){C.splice(A,1);break t}}b=y.createElement(p),Qi(b,p,u),y.head.appendChild(b);break;case"meta":if(C=Ck("meta","content",y).get(p+(u.content||""))){for(A=0;A<C.length;A++)if(b=C[A],b.getAttribute("content")===(u.content==null?null:""+u.content)&&b.getAttribute("name")===(u.name==null?null:u.name)&&b.getAttribute("property")===(u.property==null?null:u.property)&&b.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&b.getAttribute("charset")===(u.charSet==null?null:u.charSet)){C.splice(A,1);break t}}b=y.createElement(p),Qi(b,p,u),y.head.appendChild(b);break;default:throw Error(n(468,p))}b[li]=o,Kt(b),p=b}o.stateNode=p}else Tk(y,o.type,o.stateNode);else o.stateNode=kk(y,p,o.memoizedProps);else b!==p?(b===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):b.count--,p===null?Tk(y,o.type,o.stateNode):kk(y,p,o.memoizedProps)):p===null&&o.stateNode!==null&&l0(o,o.memoizedProps,u.memoizedProps)}break;case 27:un(l,o),dn(o),p&512&&(ii||u===null||Qr(u,u.return)),u!==null&&p&4&&l0(o,o.memoizedProps,u.memoizedProps);break;case 5:if(un(l,o),dn(o),p&512&&(ii||u===null||Qr(u,u.return)),o.flags&32){y=o.stateNode;try{cl(y,"")}catch(we){yt(o,o.return,we)}}p&4&&o.stateNode!=null&&(y=o.memoizedProps,l0(o,y,u!==null?u.memoizedProps:y)),p&1024&&(u0=!0);break;case 6:if(un(l,o),dn(o),p&4){if(o.stateNode===null)throw Error(n(162));p=o.memoizedProps,u=o.stateNode;try{u.nodeValue=p}catch(we){yt(o,o.return,we)}}break;case 3:if(Pf=null,y=hr,hr=Qf(l.containerInfo),un(l,o),hr=y,dn(o),p&4&&u!==null&&u.memoizedState.isDehydrated)try{Xl(l.containerInfo)}catch(we){yt(o,o.return,we)}u0&&(u0=!1,Tw(o));break;case 4:p=hr,hr=Qf(o.stateNode.containerInfo),un(l,o),dn(o),hr=p;break;case 12:un(l,o),dn(o);break;case 31:un(l,o),dn(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,pf(o,p)));break;case 13:un(l,o),dn(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(mf=Le()),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,pf(o,p)));break;case 22:y=o.memoizedState!==null;var Y=u!==null&&u.memoizedState!==null,te=ds,se=ii;if(ds=te||y,ii=se||Y,un(l,o),ii=se,ds=te,dn(o),p&8192)e:for(l=o.stateNode,l._visibility=y?l._visibility&-2:l._visibility|1,y&&(u===null||Y||ds||ii||Oa(o)),u=null,l=o;;){if(l.tag===5||l.tag===26){if(u===null){Y=u=l;try{if(b=Y.stateNode,y)C=b.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{A=Y.stateNode;var he=Y.memoizedProps.style,ne=he!=null&&he.hasOwnProperty("display")?he.display:null;A.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(we){yt(Y,Y.return,we)}}}else if(l.tag===6){if(u===null){Y=l;try{Y.stateNode.nodeValue=y?"":Y.memoizedProps}catch(we){yt(Y,Y.return,we)}}}else if(l.tag===18){if(u===null){Y=l;try{var re=Y.stateNode;y?mk(re,!0):mk(Y.stateNode,!1)}catch(we){yt(Y,Y.return,we)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===o)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break e;for(;l.sibling===null;){if(l.return===null||l.return===o)break e;u===l&&(u=null),l=l.return}u===l&&(u=null),l.sibling.return=l.return,l=l.sibling}p&4&&(p=o.updateQueue,p!==null&&(u=p.retryQueue,u!==null&&(p.retryQueue=null,pf(o,u))));break;case 19:un(l,o),dn(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,pf(o,p)));break;case 30:break;case 21:break;default:un(l,o),dn(o)}}function dn(o){var l=o.flags;if(l&2){try{for(var u,p=o.return;p!==null;){if(vw(p)){u=p;break}p=p.return}if(u==null)throw Error(n(160));switch(u.tag){case 27:var y=u.stateNode,b=c0(o);ff(o,b,y);break;case 5:var C=u.stateNode;u.flags&32&&(cl(C,""),u.flags&=-33);var A=c0(o);ff(o,A,C);break;case 3:case 4:var Y=u.stateNode.containerInfo,te=c0(o);h0(o,te,Y);break;default:throw Error(n(161))}}catch(se){yt(o,o.return,se)}o.flags&=-3}l&4096&&(o.flags&=-4097)}function Tw(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var l=o;Tw(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),o=o.sibling}}function ps(o,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)bw(o,l.alternate,l),l=l.sibling}function Oa(o){for(o=o.child;o!==null;){var l=o;switch(l.tag){case 0:case 11:case 14:case 15:ro(4,l,l.return),Oa(l);break;case 1:Qr(l,l.return);var u=l.stateNode;typeof u.componentWillUnmount=="function"&&mw(l,l.return,u),Oa(l);break;case 27:kh(l.stateNode);case 26:case 5:Qr(l,l.return),Oa(l);break;case 22:l.memoizedState===null&&Oa(l);break;case 30:Oa(l);break;default:Oa(l)}o=o.sibling}}function gs(o,l,u){for(u=u&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var p=l.alternate,y=o,b=l,C=b.flags;switch(b.tag){case 0:case 11:case 15:gs(y,b,u),gh(4,b);break;case 1:if(gs(y,b,u),p=b,y=p.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(te){yt(p,p.return,te)}if(p=b,y=p.updateQueue,y!==null){var A=p.stateNode;try{var Y=y.shared.hiddenCallbacks;if(Y!==null)for(y.shared.hiddenCallbacks=null,y=0;y<Y.length;y++)rx(Y[y],A)}catch(te){yt(p,p.return,te)}}u&&C&64&&gw(b),mh(b,b.return);break;case 27:yw(b);case 26:case 5:gs(y,b,u),u&&p===null&&C&4&&Ow(b),mh(b,b.return);break;case 12:gs(y,b,u);break;case 31:gs(y,b,u),u&&C&4&&ww(y,b);break;case 13:gs(y,b,u),u&&C&4&&kw(y,b);break;case 22:b.memoizedState===null&&gs(y,b,u),mh(b,b.return);break;case 30:break;default:gs(y,b,u)}l=l.sibling}}function d0(o,l){var u=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==u&&(o!=null&&o.refCount++,u!=null&&ih(u))}function f0(o,l){o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&ih(o))}function ur(o,l,u,p){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Qw(o,l,u,p),l=l.sibling}function Qw(o,l,u,p){var y=l.flags;switch(l.tag){case 0:case 11:case 15:ur(o,l,u,p),y&2048&&gh(9,l);break;case 1:ur(o,l,u,p);break;case 3:ur(o,l,u,p),y&2048&&(o=null,l.alternate!==null&&(o=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==o&&(l.refCount++,o!=null&&ih(o)));break;case 12:if(y&2048){ur(o,l,u,p),o=l.stateNode;try{var b=l.memoizedProps,C=b.id,A=b.onPostCommit;typeof A=="function"&&A(C,l.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(Y){yt(l,l.return,Y)}}else ur(o,l,u,p);break;case 31:ur(o,l,u,p);break;case 13:ur(o,l,u,p);break;case 23:break;case 22:b=l.stateNode,C=l.alternate,l.memoizedState!==null?b._visibility&2?ur(o,l,u,p):Oh(o,l):b._visibility&2?ur(o,l,u,p):(b._visibility|=2,$l(o,l,u,p,(l.subtreeFlags&10256)!==0||!1)),y&2048&&d0(C,l);break;case 24:ur(o,l,u,p),y&2048&&f0(l.alternate,l);break;default:ur(o,l,u,p)}}function $l(o,l,u,p,y){for(y=y&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var b=o,C=l,A=u,Y=p,te=C.flags;switch(C.tag){case 0:case 11:case 15:$l(b,C,A,Y,y),gh(8,C);break;case 23:break;case 22:var se=C.stateNode;C.memoizedState!==null?se._visibility&2?$l(b,C,A,Y,y):Oh(b,C):(se._visibility|=2,$l(b,C,A,Y,y)),y&&te&2048&&d0(C.alternate,C);break;case 24:$l(b,C,A,Y,y),y&&te&2048&&f0(C.alternate,C);break;default:$l(b,C,A,Y,y)}l=l.sibling}}function Oh(o,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var u=o,p=l,y=p.flags;switch(p.tag){case 22:Oh(u,p),y&2048&&d0(p.alternate,p);break;case 24:Oh(u,p),y&2048&&f0(p.alternate,p);break;default:Oh(u,p)}l=l.sibling}}var vh=8192;function Pl(o,l,u){if(o.subtreeFlags&vh)for(o=o.child;o!==null;)$w(o,l,u),o=o.sibling}function $w(o,l,u){switch(o.tag){case 26:Pl(o,l,u),o.flags&vh&&o.memoizedState!==null&&P3(u,hr,o.memoizedState,o.memoizedProps);break;case 5:Pl(o,l,u);break;case 3:case 4:var p=hr;hr=Qf(o.stateNode.containerInfo),Pl(o,l,u),hr=p;break;case 22:o.memoizedState===null&&(p=o.alternate,p!==null&&p.memoizedState!==null?(p=vh,vh=16777216,Pl(o,l,u),vh=p):Pl(o,l,u));break;default:Pl(o,l,u)}}function Pw(o){var l=o.alternate;if(l!==null&&(o=l.child,o!==null)){l.child=null;do l=o.sibling,o.sibling=null,o=l;while(o!==null)}}function yh(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var p=l[u];mi=p,Rw(p,o)}Pw(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Ew(o),o=o.sibling}function Ew(o){switch(o.tag){case 0:case 11:case 15:yh(o),o.flags&2048&&ro(9,o,o.return);break;case 3:yh(o);break;case 12:yh(o);break;case 22:var l=o.stateNode;o.memoizedState!==null&&l._visibility&2&&(o.return===null||o.return.tag!==13)?(l._visibility&=-3,gf(o)):yh(o);break;default:yh(o)}}function gf(o){var l=o.deletions;if((o.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var p=l[u];mi=p,Rw(p,o)}Pw(o)}for(o=o.child;o!==null;){switch(l=o,l.tag){case 0:case 11:case 15:ro(8,l,l.return),gf(l);break;case 22:u=l.stateNode,u._visibility&2&&(u._visibility&=-3,gf(l));break;default:gf(l)}o=o.sibling}}function Rw(o,l){for(;mi!==null;){var u=mi;switch(u.tag){case 0:case 11:case 15:ro(8,u,l);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var p=u.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:ih(u.memoizedState.cache)}if(p=u.child,p!==null)p.return=u,mi=p;else e:for(u=o;mi!==null;){p=mi;var y=p.sibling,b=p.return;if(_w(p),p===u){mi=null;break e}if(y!==null){y.return=b,mi=y;break e}mi=b}}}var Vj={getCacheForType:function(o){var l=Ci(Jt),u=l.data.get(o);return u===void 0&&(u=o(),l.data.set(o,u)),u},cacheSignal:function(){return Ci(Jt).controller.signal}},Ij=typeof WeakMap=="function"?WeakMap:Map,ft=0,wt=null,Ke=null,tt=0,vt=0,Tn=null,so=!1,El=!1,p0=!1,ms=0,Nt=0,oo=0,va=0,g0=0,Qn=0,Rl=0,Sh=null,fn=null,m0=!1,mf=0,Aw=0,Of=1/0,vf=null,ao=null,ci=0,lo=null,Al=null,Os=0,O0=0,v0=null,Mw=null,bh=0,y0=null;function $n(){return(ft&2)!==0&&tt!==0?tt&-tt:P.T!==null?k0():bd()}function zw(){if(Qn===0)if((tt&536870912)===0||st){var o=nl;nl<<=1,(nl&3932160)===0&&(nl=262144),Qn=o}else Qn=536870912;return o=kn.current,o!==null&&(o.flags|=32),Qn}function pn(o,l,u){(o===wt&&(vt===2||vt===9)||o.cancelPendingCommit!==null)&&(Ml(o,0),co(o,tt,Qn,!1)),Jo(o,u),((ft&2)===0||o!==wt)&&(o===wt&&((ft&2)===0&&(va|=u),Nt===4&&co(o,tt,Qn,!1)),$r(o))}function jw(o,l,u){if((ft&6)!==0)throw Error(n(327));var p=!u&&(l&127)===0&&(l&o.expiredLanes)===0||Ko(o,l),y=p?Uj(o,l):b0(o,l,!0),b=p;do{if(y===0){El&&!p&&co(o,l,0,!1);break}else{if(u=o.current.alternate,b&&!Yj(u)){y=b0(o,l,!1),b=!1;continue}if(y===2){if(b=l,o.errorRecoveryDisabledLanes&b)var C=0;else C=o.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){l=C;e:{var A=o;y=Sh;var Y=A.current.memoizedState.isDehydrated;if(Y&&(Ml(A,C).flags|=256),C=b0(A,C,!1),C!==2){if(p0&&!Y){A.errorRecoveryDisabledLanes|=b,va|=b,y=4;break e}b=fn,fn=y,b!==null&&(fn===null?fn=b:fn.push.apply(fn,b))}y=C}if(b=!1,y!==2)continue}}if(y===1){Ml(o,0),co(o,l,0,!0);break}e:{switch(p=o,b=y,b){case 0:case 1:throw Error(n(345));case 4:if((l&4194048)!==l)break;case 6:co(p,l,Qn,!so);break e;case 2:fn=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(y=mf+300-Le(),10<y)){if(co(p,l,Qn,!so),sl(p,0,!0)!==0)break e;Os=l,p.timeoutHandle=fk(Dw.bind(null,p,u,fn,vf,m0,l,Qn,va,Rl,so,b,"Throttled",-0,0),y);break e}Dw(p,u,fn,vf,m0,l,Qn,va,Rl,so,b,null,-0,0)}}break}while(!0);$r(o)}function Dw(o,l,u,p,y,b,C,A,Y,te,se,he,ne,re){if(o.timeoutHandle=-1,he=l.subtreeFlags,he&8192||(he&16785408)===16785408){he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:is},$w(l,b,he);var we=(b&62914560)===b?mf-Le():(b&4194048)===b?Aw-Le():0;if(we=E3(he,we),we!==null){Os=b,o.cancelPendingCommit=we(Vw.bind(null,o,l,b,u,p,y,C,A,Y,se,he,null,ne,re)),co(o,b,C,!te);return}}Vw(o,l,b,u,p,y,C,A,Y)}function Yj(o){for(var l=o;;){var u=l.tag;if((u===0||u===11||u===15)&&l.flags&16384&&(u=l.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var p=0;p<u.length;p++){var y=u[p],b=y.getSnapshot;y=y.value;try{if(!xn(b(),y))return!1}catch{return!1}}if(u=l.child,l.subtreeFlags&16384&&u!==null)u.return=l,l=u;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function co(o,l,u,p){l&=~g0,l&=~va,o.suspendedLanes|=l,o.pingedLanes&=~l,p&&(o.warmLanes|=l),p=o.expirationTimes;for(var y=l;0<y;){var b=31-Yi(y),C=1<<b;p[b]=-1,y&=~C}u!==0&&vd(o,u,l)}function yf(){return(ft&6)===0?(_h(0),!1):!0}function S0(){if(Ke!==null){if(vt===0)var o=Ke.return;else o=Ke,os=ca=null,jO(o),wl=null,rh=0,o=Ke;for(;o!==null;)pw(o.alternate,o),o=o.return;Ke=null}}function Ml(o,l){var u=o.timeoutHandle;u!==-1&&(o.timeoutHandle=-1,f3(u)),u=o.cancelPendingCommit,u!==null&&(o.cancelPendingCommit=null,u()),Os=0,S0(),wt=o,Ke=u=rs(o.current,null),tt=l,vt=0,Tn=null,so=!1,El=Ko(o,l),p0=!1,Rl=Qn=g0=va=oo=Nt=0,fn=Sh=null,m0=!1,(l&8)!==0&&(l|=l&32);var p=o.entangledLanes;if(p!==0)for(o=o.entanglements,p&=l;0<p;){var y=31-Yi(p),b=1<<y;l|=o[y],p&=~b}return ms=l,Ld(),u}function Bw(o,l){Ie=null,P.H=dh,l===xl||l===Yd?(l=ex(),vt=3):l===wO?(l=ex(),vt=4):vt=l===KO?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Tn=l,Ke===null&&(Nt=1,lf(o,Wn(l,o.current)))}function Lw(){var o=kn.current;return o===null?!0:(tt&4194048)===tt?Yn===null:(tt&62914560)===tt||(tt&536870912)!==0?o===Yn:!1}function Xw(){var o=P.H;return P.H=dh,o===null?dh:o}function Nw(){var o=P.A;return P.A=Vj,o}function Sf(){Nt=4,so||(tt&4194048)!==tt&&kn.current!==null||(El=!0),(oo&134217727)===0&&(va&134217727)===0||wt===null||co(wt,tt,Qn,!1)}function b0(o,l,u){var p=ft;ft|=2;var y=Xw(),b=Nw();(wt!==o||tt!==l)&&(vf=null,Ml(o,l)),l=!1;var C=Nt;e:do try{if(vt!==0&&Ke!==null){var A=Ke,Y=Tn;switch(vt){case 8:S0(),C=6;break e;case 3:case 2:case 9:case 6:kn.current===null&&(l=!0);var te=vt;if(vt=0,Tn=null,zl(o,A,Y,te),u&&El){C=0;break e}break;default:te=vt,vt=0,Tn=null,zl(o,A,Y,te)}}Hj(),C=Nt;break}catch(se){Bw(o,se)}while(!0);return l&&o.shellSuspendCounter++,os=ca=null,ft=p,P.H=y,P.A=b,Ke===null&&(wt=null,tt=0,Ld()),C}function Hj(){for(;Ke!==null;)Zw(Ke)}function Uj(o,l){var u=ft;ft|=2;var p=Xw(),y=Nw();wt!==o||tt!==l?(vf=null,Of=Le()+500,Ml(o,l)):El=Ko(o,l);e:do try{if(vt!==0&&Ke!==null){l=Ke;var b=Tn;t:switch(vt){case 1:vt=0,Tn=null,zl(o,l,b,1);break;case 2:case 9:if(K_(b)){vt=0,Tn=null,Ww(l);break}l=function(){vt!==2&&vt!==9||wt!==o||(vt=7),$r(o)},b.then(l,l);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:K_(b)?(vt=0,Tn=null,Ww(l)):(vt=0,Tn=null,zl(o,l,b,7));break;case 5:var C=null;switch(Ke.tag){case 26:C=Ke.memoizedState;case 5:case 27:var A=Ke;if(C?Qk(C):A.stateNode.complete){vt=0,Tn=null;var Y=A.sibling;if(Y!==null)Ke=Y;else{var te=A.return;te!==null?(Ke=te,bf(te)):Ke=null}break t}}vt=0,Tn=null,zl(o,l,b,5);break;case 6:vt=0,Tn=null,zl(o,l,b,6);break;case 8:S0(),Nt=6;break e;default:throw Error(n(462))}}Gj();break}catch(se){Bw(o,se)}while(!0);return os=ca=null,P.H=p,P.A=y,ft=u,Ke!==null?0:(wt=null,tt=0,Ld(),Nt)}function Gj(){for(;Ke!==null&&!oe();)Zw(Ke)}function Zw(o){var l=dw(o.alternate,o,ms);o.memoizedProps=o.pendingProps,l===null?bf(o):Ke=l}function Ww(o){var l=o,u=l.alternate;switch(l.tag){case 15:case 0:l=ow(u,l,l.pendingProps,l.type,void 0,tt);break;case 11:l=ow(u,l,l.pendingProps,l.type.render,l.ref,tt);break;case 5:jO(l);default:pw(u,l),l=Ke=N_(l,ms),l=dw(u,l,ms)}o.memoizedProps=o.pendingProps,l===null?bf(o):Ke=l}function zl(o,l,u,p){os=ca=null,jO(l),wl=null,rh=0;var y=l.return;try{if(Bj(o,y,l,u,tt)){Nt=1,lf(o,Wn(u,o.current)),Ke=null;return}}catch(b){if(y!==null)throw Ke=y,b;Nt=1,lf(o,Wn(u,o.current)),Ke=null;return}l.flags&32768?(st||p===1?o=!0:El||(tt&536870912)!==0?o=!1:(so=o=!0,(p===2||p===9||p===3||p===6)&&(p=kn.current,p!==null&&p.tag===13&&(p.flags|=16384))),qw(l,o)):bf(l)}function bf(o){var l=o;do{if((l.flags&32768)!==0){qw(l,so);return}o=l.return;var u=Nj(l.alternate,l,ms);if(u!==null){Ke=u;return}if(l=l.sibling,l!==null){Ke=l;return}Ke=l=o}while(l!==null);Nt===0&&(Nt=5)}function qw(o,l){do{var u=Zj(o.alternate,o);if(u!==null){u.flags&=32767,Ke=u;return}if(u=o.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!l&&(o=o.sibling,o!==null)){Ke=o;return}Ke=o=u}while(o!==null);Nt=6,Ke=null}function Vw(o,l,u,p,y,b,C,A,Y){o.cancelPendingCommit=null;do _f();while(ci!==0);if((ft&6)!==0)throw Error(n(327));if(l!==null){if(l===o.current)throw Error(n(177));if(b=l.lanes|l.childLanes,b|=cO,Lm(o,u,b,C,A,Y),o===wt&&(Ke=wt=null,tt=0),Al=l,lo=o,Os=u,O0=b,v0=y,Mw=p,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,e3(Go,function(){return Gw(),null})):(o.callbackNode=null,o.callbackPriority=0),p=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||p){p=P.T,P.T=null,y=Z.p,Z.p=2,C=ft,ft|=4;try{Wj(o,l,u)}finally{ft=C,Z.p=y,P.T=p}}ci=1,Iw(),Yw(),Hw()}}function Iw(){if(ci===1){ci=0;var o=lo,l=Al,u=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||u){u=P.T,P.T=null;var p=Z.p;Z.p=2;var y=ft;ft|=4;try{Cw(l,o);var b=A0,C=R_(o.containerInfo),A=b.focusedElem,Y=b.selectionRange;if(C!==A&&A&&A.ownerDocument&&E_(A.ownerDocument.documentElement,A)){if(Y!==null&&rO(A)){var te=Y.start,se=Y.end;if(se===void 0&&(se=te),"selectionStart"in A)A.selectionStart=te,A.selectionEnd=Math.min(se,A.value.length);else{var he=A.ownerDocument||document,ne=he&&he.defaultView||window;if(ne.getSelection){var re=ne.getSelection(),we=A.textContent.length,ze=Math.min(Y.start,we),_t=Y.end===void 0?ze:Math.min(Y.end,we);!re.extend&&ze>_t&&(C=_t,_t=ze,ze=C);var F=P_(A,ze),U=P_(A,_t);if(F&&U&&(re.rangeCount!==1||re.anchorNode!==F.node||re.anchorOffset!==F.offset||re.focusNode!==U.node||re.focusOffset!==U.offset)){var J=he.createRange();J.setStart(F.node,F.offset),re.removeAllRanges(),ze>_t?(re.addRange(J),re.extend(U.node,U.offset)):(J.setEnd(U.node,U.offset),re.addRange(J))}}}}for(he=[],re=A;re=re.parentNode;)re.nodeType===1&&he.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<he.length;A++){var ae=he[A];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}Mf=!!R0,A0=R0=null}finally{ft=y,Z.p=p,P.T=u}}o.current=l,ci=2}}function Yw(){if(ci===2){ci=0;var o=lo,l=Al,u=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||u){u=P.T,P.T=null;var p=Z.p;Z.p=2;var y=ft;ft|=4;try{bw(o,l.alternate,l)}finally{ft=y,Z.p=p,P.T=u}}ci=3}}function Hw(){if(ci===4||ci===3){ci=0,We();var o=lo,l=Al,u=Os,p=Mw;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?ci=5:(ci=0,Al=lo=null,Uw(o,o.pendingLanes));var y=o.pendingLanes;if(y===0&&(ao=null),Nc(u),l=l.stateNode,Ii&&typeof Ii.onCommitFiberRoot=="function")try{Ii.onCommitFiberRoot(Fo,l,void 0,(l.current.flags&128)===128)}catch{}if(p!==null){l=P.T,y=Z.p,Z.p=2,P.T=null;try{for(var b=o.onRecoverableError,C=0;C<p.length;C++){var A=p[C];b(A.value,{componentStack:A.stack})}}finally{P.T=l,Z.p=y}}(Os&3)!==0&&_f(),$r(o),y=o.pendingLanes,(u&261930)!==0&&(y&42)!==0?o===y0?bh++:(bh=0,y0=o):bh=0,_h(0)}}function Uw(o,l){(o.pooledCacheLanes&=l)===0&&(l=o.pooledCache,l!=null&&(o.pooledCache=null,ih(l)))}function _f(){return Iw(),Yw(),Hw(),Gw()}function Gw(){if(ci!==5)return!1;var o=lo,l=O0;O0=0;var u=Nc(Os),p=P.T,y=Z.p;try{Z.p=32>u?32:u,P.T=null,u=v0,v0=null;var b=lo,C=Os;if(ci=0,Al=lo=null,Os=0,(ft&6)!==0)throw Error(n(331));var A=ft;if(ft|=4,Ew(b.current),Qw(b,b.current,C,u),ft=A,_h(0,!1),Ii&&typeof Ii.onPostCommitFiberRoot=="function")try{Ii.onPostCommitFiberRoot(Fo,b)}catch{}return!0}finally{Z.p=y,P.T=p,Uw(o,l)}}function Fw(o,l,u){l=Wn(u,l),l=FO(o.stateNode,l,2),o=to(o,l,2),o!==null&&(Jo(o,2),$r(o))}function yt(o,l,u){if(o.tag===3)Fw(o,o,u);else for(;l!==null;){if(l.tag===3){Fw(l,o,u);break}else if(l.tag===1){var p=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(ao===null||!ao.has(p))){o=Wn(u,o),u=Kx(2),p=to(l,u,2),p!==null&&(Jx(u,p,l,o),Jo(p,2),$r(p));break}}l=l.return}}function _0(o,l,u){var p=o.pingCache;if(p===null){p=o.pingCache=new Ij;var y=new Set;p.set(l,y)}else y=p.get(l),y===void 0&&(y=new Set,p.set(l,y));y.has(u)||(p0=!0,y.add(u),o=Fj.bind(null,o,l,u),l.then(o,o))}function Fj(o,l,u){var p=o.pingCache;p!==null&&p.delete(l),o.pingedLanes|=o.suspendedLanes&u,o.warmLanes&=~u,wt===o&&(tt&u)===u&&(Nt===4||Nt===3&&(tt&62914560)===tt&&300>Le()-mf?(ft&2)===0&&Ml(o,0):g0|=u,Rl===tt&&(Rl=0)),$r(o)}function Kw(o,l){l===0&&(l=Od()),o=oa(o,l),o!==null&&(Jo(o,l),$r(o))}function Kj(o){var l=o.memoizedState,u=0;l!==null&&(u=l.retryLane),Kw(o,u)}function Jj(o,l){var u=0;switch(o.tag){case 31:case 13:var p=o.stateNode,y=o.memoizedState;y!==null&&(u=y.retryLane);break;case 19:p=o.stateNode;break;case 22:p=o.stateNode._retryCache;break;default:throw Error(n(314))}p!==null&&p.delete(l),Kw(o,u)}function e3(o,l){return _n(o,l)}var xf=null,jl=null,x0=!1,wf=!1,w0=!1,ho=0;function $r(o){o!==jl&&o.next===null&&(jl===null?xf=jl=o:jl=jl.next=o),wf=!0,x0||(x0=!0,i3())}function _h(o,l){if(!w0&&wf){w0=!0;do for(var u=!1,p=xf;p!==null;){if(o!==0){var y=p.pendingLanes;if(y===0)var b=0;else{var C=p.suspendedLanes,A=p.pingedLanes;b=(1<<31-Yi(42|o)+1)-1,b&=y&~(C&~A),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(u=!0,ik(p,b))}else b=tt,b=sl(p,p===wt?b:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(b&3)===0||Ko(p,b)||(u=!0,ik(p,b));p=p.next}while(u);w0=!1}}function t3(){Jw()}function Jw(){wf=x0=!1;var o=0;ho!==0&&d3()&&(o=ho);for(var l=Le(),u=null,p=xf;p!==null;){var y=p.next,b=ek(p,l);b===0?(p.next=null,u===null?xf=y:u.next=y,y===null&&(jl=u)):(u=p,(o!==0||(b&3)!==0)&&(wf=!0)),p=y}ci!==0&&ci!==5||_h(o),ho!==0&&(ho=0)}function ek(o,l){for(var u=o.suspendedLanes,p=o.pingedLanes,y=o.expirationTimes,b=o.pendingLanes&-62914561;0<b;){var C=31-Yi(b),A=1<<C,Y=y[C];Y===-1?((A&u)===0||(A&p)!==0)&&(y[C]=Bm(A,l)):Y<=l&&(o.expiredLanes|=A),b&=~A}if(l=wt,u=tt,u=sl(o,o===l?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p=o.callbackNode,u===0||o===l&&(vt===2||vt===9)||o.cancelPendingCommit!==null)return p!==null&&p!==null&&ar(p),o.callbackNode=null,o.callbackPriority=0;if((u&3)===0||Ko(o,u)){if(l=u&-u,l===o.callbackPriority)return l;switch(p!==null&&ar(p),Nc(u)){case 2:case 8:u=Vi;break;case 32:u=Go;break;case 268435456:u=tl;break;default:u=Go}return p=tk.bind(null,o),u=_n(u,p),o.callbackPriority=l,o.callbackNode=u,l}return p!==null&&p!==null&&ar(p),o.callbackPriority=2,o.callbackNode=null,2}function tk(o,l){if(ci!==0&&ci!==5)return o.callbackNode=null,o.callbackPriority=0,null;var u=o.callbackNode;if(_f()&&o.callbackNode!==u)return null;var p=tt;return p=sl(o,o===wt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p===0?null:(jw(o,p,l),ek(o,Le()),o.callbackNode!=null&&o.callbackNode===u?tk.bind(null,o):null)}function ik(o,l){if(_f())return null;jw(o,l,!0)}function i3(){p3(function(){(ft&6)!==0?_n(on,t3):Jw()})}function k0(){if(ho===0){var o=bl;o===0&&(o=il,il<<=1,(il&261888)===0&&(il=256)),ho=o}return ho}function nk(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Ed(""+o)}function rk(o,l){var u=l.ownerDocument.createElement("input");return u.name=l.name,u.value=l.value,o.id&&u.setAttribute("form",o.id),l.parentNode.insertBefore(u,l),o=new FormData(o),u.parentNode.removeChild(u),o}function n3(o,l,u,p,y){if(l==="submit"&&u&&u.stateNode===y){var b=nk((y[Di]||null).action),C=p.submitter;C&&(l=(l=C[Di]||null)?nk(l.formAction):C.getAttribute("formAction"),l!==null&&(b=l,C=null));var A=new zd("action","action",null,p,y);o.push({event:A,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(ho!==0){var Y=C?rk(y,C):new FormData(y);VO(u,{pending:!0,data:Y,method:y.method,action:b},null,Y)}}else typeof b=="function"&&(A.preventDefault(),Y=C?rk(y,C):new FormData(y),VO(u,{pending:!0,data:Y,method:y.method,action:b},b,Y))},currentTarget:y}]})}}for(var C0=0;C0<lO.length;C0++){var T0=lO[C0],r3=T0.toLowerCase(),s3=T0[0].toUpperCase()+T0.slice(1);cr(r3,"on"+s3)}cr(z_,"onAnimationEnd"),cr(j_,"onAnimationIteration"),cr(D_,"onAnimationStart"),cr("dblclick","onDoubleClick"),cr("focusin","onFocus"),cr("focusout","onBlur"),cr(bj,"onTransitionRun"),cr(_j,"onTransitionStart"),cr(xj,"onTransitionCancel"),cr(B_,"onTransitionEnd"),Is("onMouseEnter",["mouseout","mouseover"]),Is("onMouseLeave",["mouseout","mouseover"]),Is("onPointerEnter",["pointerout","pointerover"]),Is("onPointerLeave",["pointerout","pointerover"]),es("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),es("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),es("onBeforeInput",["compositionend","keypress","textInput","paste"]),es("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),es("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),es("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xh="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),o3=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xh));function sk(o,l){l=(l&4)!==0;for(var u=0;u<o.length;u++){var p=o[u],y=p.event;p=p.listeners;e:{var b=void 0;if(l)for(var C=p.length-1;0<=C;C--){var A=p[C],Y=A.instance,te=A.currentTarget;if(A=A.listener,Y!==b&&y.isPropagationStopped())break e;b=A,y.currentTarget=te;try{b(y)}catch(se){Bd(se)}y.currentTarget=null,b=Y}else for(C=0;C<p.length;C++){if(A=p[C],Y=A.instance,te=A.currentTarget,A=A.listener,Y!==b&&y.isPropagationStopped())break e;b=A,y.currentTarget=te;try{b(y)}catch(se){Bd(se)}y.currentTarget=null,b=Y}}}}function Je(o,l){var u=l[ol];u===void 0&&(u=l[ol]=new Set);var p=o+"__bubble";u.has(p)||(ok(l,o,2,!1),u.add(p))}function Q0(o,l,u){var p=0;l&&(p|=4),ok(u,o,p,l)}var kf="_reactListening"+Math.random().toString(36).slice(2);function $0(o){if(!o[kf]){o[kf]=!0,kd.forEach(function(u){u!=="selectionchange"&&(o3.has(u)||Q0(u,!1,o),Q0(u,!0,o))});var l=o.nodeType===9?o:o.ownerDocument;l===null||l[kf]||(l[kf]=!0,Q0("selectionchange",!1,l))}}function ok(o,l,u,p){switch(zk(l)){case 2:var y=M3;break;case 8:y=z3;break;default:y=q0}u=y.bind(null,l,u,o),y=void 0,!Um||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(y=!0),p?y!==void 0?o.addEventListener(l,u,{capture:!0,passive:y}):o.addEventListener(l,u,!0):y!==void 0?o.addEventListener(l,u,{passive:y}):o.addEventListener(l,u,!1)}function P0(o,l,u,p,y){var b=p;if((l&1)===0&&(l&2)===0&&p!==null)e:for(;;){if(p===null)return;var C=p.tag;if(C===3||C===4){var A=p.stateNode.containerInfo;if(A===y)break;if(C===4)for(C=p.return;C!==null;){var Y=C.tag;if((Y===3||Y===4)&&C.stateNode.containerInfo===y)return;C=C.return}for(;A!==null;){if(C=Zs(A),C===null)return;if(Y=C.tag,Y===5||Y===6||Y===26||Y===27){p=b=C;continue e}A=A.parentNode}}p=p.return}u_(function(){var te=b,se=Ym(u),he=[];e:{var ne=L_.get(o);if(ne!==void 0){var re=zd,we=o;switch(o){case"keypress":if(Ad(u)===0)break e;case"keydown":case"keyup":re=Jz;break;case"focusin":we="focus",re=Jm;break;case"focusout":we="blur",re=Jm;break;case"beforeblur":case"afterblur":re=Jm;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=p_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=Nz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=ij;break;case z_:case j_:case D_:re=qz;break;case B_:re=rj;break;case"scroll":case"scrollend":re=Lz;break;case"wheel":re=oj;break;case"copy":case"cut":case"paste":re=Iz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=m_;break;case"toggle":case"beforetoggle":re=lj}var ze=(l&4)!==0,_t=!ze&&(o==="scroll"||o==="scrollend"),F=ze?ne!==null?ne+"Capture":null:ne;ze=[];for(var U=te,J;U!==null;){var ae=U;if(J=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||J===null||F===null||(ae=Vc(U,F),ae!=null&&ze.push(wh(U,ae,J))),_t)break;U=U.return}0<ze.length&&(ne=new re(ne,we,null,u,se),he.push({event:ne,listeners:ze}))}}if((l&7)===0){e:{if(ne=o==="mouseover"||o==="pointerover",re=o==="mouseout"||o==="pointerout",ne&&u!==Im&&(we=u.relatedTarget||u.fromElement)&&(Zs(we)||we[Jr]))break e;if((re||ne)&&(ne=se.window===se?se:(ne=se.ownerDocument)?ne.defaultView||ne.parentWindow:window,re?(we=u.relatedTarget||u.toElement,re=te,we=we?Zs(we):null,we!==null&&(_t=s(we),ze=we.tag,we!==_t||ze!==5&&ze!==27&&ze!==6)&&(we=null)):(re=null,we=te),re!==we)){if(ze=p_,ae="onMouseLeave",F="onMouseEnter",U="mouse",(o==="pointerout"||o==="pointerover")&&(ze=m_,ae="onPointerLeave",F="onPointerEnter",U="pointer"),_t=re==null?ne:qs(re),J=we==null?ne:qs(we),ne=new ze(ae,U+"leave",re,u,se),ne.target=_t,ne.relatedTarget=J,ae=null,Zs(se)===te&&(ze=new ze(F,U+"enter",we,u,se),ze.target=J,ze.relatedTarget=_t,ae=ze),_t=ae,re&&we)t:{for(ze=a3,F=re,U=we,J=0,ae=F;ae;ae=ze(ae))J++;ae=0;for(var Ae=U;Ae;Ae=ze(Ae))ae++;for(;0<J-ae;)F=ze(F),J--;for(;0<ae-J;)U=ze(U),ae--;for(;J--;){if(F===U||U!==null&&F===U.alternate){ze=F;break t}F=ze(F),U=ze(U)}ze=null}else ze=null;re!==null&&ak(he,ne,re,ze,!1),we!==null&&_t!==null&&ak(he,_t,we,ze,!0)}}e:{if(ne=te?qs(te):window,re=ne.nodeName&&ne.nodeName.toLowerCase(),re==="select"||re==="input"&&ne.type==="file")var ht=w_;else if(__(ne))if(k_)ht=vj;else{ht=mj;var Te=gj}else re=ne.nodeName,!re||re.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Vm(te.elementType)&&(ht=w_):ht=Oj;if(ht&&(ht=ht(o,te))){x_(he,ht,u,se);break e}Te&&Te(o,ne,te),o==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&qc(ne,"number",ne.value)}switch(Te=te?qs(te):window,o){case"focusin":(__(Te)||Te.contentEditable==="true")&&(fl=Te,sO=te,Jc=null);break;case"focusout":Jc=sO=fl=null;break;case"mousedown":oO=!0;break;case"contextmenu":case"mouseup":case"dragend":oO=!1,A_(he,u,se);break;case"selectionchange":if(Sj)break;case"keydown":case"keyup":A_(he,u,se)}var Ye;if(tO)e:{switch(o){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else dl?S_(o,u)&&(it="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(it="onCompositionStart");it&&(O_&&u.locale!=="ko"&&(dl||it!=="onCompositionStart"?it==="onCompositionEnd"&&dl&&(Ye=d_()):(Hs=se,Gm="value"in Hs?Hs.value:Hs.textContent,dl=!0)),Te=Cf(te,it),0<Te.length&&(it=new g_(it,o,null,u,se),he.push({event:it,listeners:Te}),Ye?it.data=Ye:(Ye=b_(u),Ye!==null&&(it.data=Ye)))),(Ye=hj?uj(o,u):dj(o,u))&&(it=Cf(te,"onBeforeInput"),0<it.length&&(Te=new g_("onBeforeInput","beforeinput",null,u,se),he.push({event:Te,listeners:it}),Te.data=Ye)),n3(he,o,te,u,se)}sk(he,l)})}function wh(o,l,u){return{instance:o,listener:l,currentTarget:u}}function Cf(o,l){for(var u=l+"Capture",p=[];o!==null;){var y=o,b=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||b===null||(y=Vc(o,u),y!=null&&p.unshift(wh(o,y,b)),y=Vc(o,l),y!=null&&p.push(wh(o,y,b))),o.tag===3)return p;o=o.return}return[]}function a3(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function ak(o,l,u,p,y){for(var b=l._reactName,C=[];u!==null&&u!==p;){var A=u,Y=A.alternate,te=A.stateNode;if(A=A.tag,Y!==null&&Y===p)break;A!==5&&A!==26&&A!==27||te===null||(Y=te,y?(te=Vc(u,b),te!=null&&C.unshift(wh(u,te,Y))):y||(te=Vc(u,b),te!=null&&C.push(wh(u,te,Y)))),u=u.return}C.length!==0&&o.push({event:l,listeners:C})}var l3=/\r\n?/g,c3=/\u0000|\uFFFD/g;function lk(o){return(typeof o=="string"?o:""+o).replace(l3,`
49
+ `).replace(c3,"")}function ck(o,l){return l=lk(l),lk(o)===l}function bt(o,l,u,p,y,b){switch(u){case"children":typeof p=="string"?l==="body"||l==="textarea"&&p===""||cl(o,p):(typeof p=="number"||typeof p=="bigint")&&l!=="body"&&cl(o,""+p);break;case"className":ll(o,"class",p);break;case"tabIndex":ll(o,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":ll(o,u,p);break;case"style":c_(o,p,b);break;case"data":if(l!=="object"){ll(o,"data",p);break}case"src":case"href":if(p===""&&(l!=="a"||u!=="href")){o.removeAttribute(u);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(u);break}p=Ed(""+p),o.setAttribute(u,p);break;case"action":case"formAction":if(typeof p=="function"){o.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof b=="function"&&(u==="formAction"?(l!=="input"&&bt(o,l,"name",y.name,y,null),bt(o,l,"formEncType",y.formEncType,y,null),bt(o,l,"formMethod",y.formMethod,y,null),bt(o,l,"formTarget",y.formTarget,y,null)):(bt(o,l,"encType",y.encType,y,null),bt(o,l,"method",y.method,y,null),bt(o,l,"target",y.target,y,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(u);break}p=Ed(""+p),o.setAttribute(u,p);break;case"onClick":p!=null&&(o.onclick=is);break;case"onScroll":p!=null&&Je("scroll",o);break;case"onScrollEnd":p!=null&&Je("scrollend",o);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(n(61));if(u=p.__html,u!=null){if(y.children!=null)throw Error(n(60));o.innerHTML=u}}break;case"multiple":o.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":o.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){o.removeAttribute("xlink:href");break}u=Ed(""+p),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(u,""+p):o.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(u,""):o.removeAttribute(u);break;case"capture":case"download":p===!0?o.setAttribute(u,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(u,p):o.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?o.setAttribute(u,p):o.removeAttribute(u);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?o.removeAttribute(u):o.setAttribute(u,p);break;case"popover":Je("beforetoggle",o),Je("toggle",o),al(o,"popover",p);break;case"xlinkActuate":lr(o,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":lr(o,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":lr(o,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":lr(o,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":lr(o,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":lr(o,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":lr(o,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":lr(o,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":lr(o,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":al(o,"is",p);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=Dz.get(u)||u,al(o,u,p))}}function E0(o,l,u,p,y,b){switch(u){case"style":c_(o,p,b);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(n(61));if(u=p.__html,u!=null){if(y.children!=null)throw Error(n(60));o.innerHTML=u}}break;case"children":typeof p=="string"?cl(o,p):(typeof p=="number"||typeof p=="bigint")&&cl(o,""+p);break;case"onScroll":p!=null&&Je("scroll",o);break;case"onScrollEnd":p!=null&&Je("scrollend",o);break;case"onClick":p!=null&&(o.onclick=is);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Cd.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),l=u.slice(2,y?u.length-7:void 0),b=o[Di]||null,b=b!=null?b[u]:null,typeof b=="function"&&o.removeEventListener(l,b,y),typeof p=="function")){typeof b!="function"&&b!==null&&(u in o?o[u]=null:o.hasAttribute(u)&&o.removeAttribute(u)),o.addEventListener(l,p,y);break e}u in o?o[u]=p:p===!0?o.setAttribute(u,""):al(o,u,p)}}}function Qi(o,l,u){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",o),Je("load",o);var p=!1,y=!1,b;for(b in u)if(u.hasOwnProperty(b)){var C=u[b];if(C!=null)switch(b){case"src":p=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:bt(o,l,b,C,u,null)}}y&&bt(o,l,"srcSet",u.srcSet,u,null),p&&bt(o,l,"src",u.src,u,null);return;case"input":Je("invalid",o);var A=b=C=y=null,Y=null,te=null;for(p in u)if(u.hasOwnProperty(p)){var se=u[p];if(se!=null)switch(p){case"name":y=se;break;case"type":C=se;break;case"checked":Y=se;break;case"defaultChecked":te=se;break;case"value":b=se;break;case"defaultValue":A=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(n(137,l));break;default:bt(o,l,p,se,u,null)}}Pd(o,b,A,Y,te,C,y,!1);return;case"select":Je("invalid",o),p=C=b=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":b=A;break;case"defaultValue":C=A;break;case"multiple":p=A;default:bt(o,l,y,A,u,null)}l=b,u=C,o.multiple=!!p,l!=null?ts(o,!!p,l,!1):u!=null&&ts(o,!!p,u,!0);return;case"textarea":Je("invalid",o),b=y=p=null;for(C in u)if(u.hasOwnProperty(C)&&(A=u[C],A!=null))switch(C){case"value":p=A;break;case"defaultValue":y=A;break;case"children":b=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(n(91));break;default:bt(o,l,C,A,u,null)}a_(o,p,y,b);return;case"option":for(Y in u)if(u.hasOwnProperty(Y)&&(p=u[Y],p!=null))switch(Y){case"selected":o.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:bt(o,l,Y,p,u,null)}return;case"dialog":Je("beforetoggle",o),Je("toggle",o),Je("cancel",o),Je("close",o);break;case"iframe":case"object":Je("load",o);break;case"video":case"audio":for(p=0;p<xh.length;p++)Je(xh[p],o);break;case"image":Je("error",o),Je("load",o);break;case"details":Je("toggle",o);break;case"embed":case"source":case"link":Je("error",o),Je("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in u)if(u.hasOwnProperty(te)&&(p=u[te],p!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:bt(o,l,te,p,u,null)}return;default:if(Vm(l)){for(se in u)u.hasOwnProperty(se)&&(p=u[se],p!==void 0&&E0(o,l,se,p,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(p=u[A],p!=null&&bt(o,l,A,p,u,null))}function h3(o,l,u,p){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,b=null,C=null,A=null,Y=null,te=null,se=null;for(re in u){var he=u[re];if(u.hasOwnProperty(re)&&he!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":Y=he;default:p.hasOwnProperty(re)||bt(o,l,re,null,p,he)}}for(var ne in p){var re=p[ne];if(he=u[ne],p.hasOwnProperty(ne)&&(re!=null||he!=null))switch(ne){case"type":b=re;break;case"name":y=re;break;case"checked":te=re;break;case"defaultChecked":se=re;break;case"value":C=re;break;case"defaultValue":A=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(n(137,l));break;default:re!==he&&bt(o,l,ne,re,p,he)}}ia(o,C,A,Y,te,se,b,y);return;case"select":re=C=A=ne=null;for(b in u)if(Y=u[b],u.hasOwnProperty(b)&&Y!=null)switch(b){case"value":break;case"multiple":re=Y;default:p.hasOwnProperty(b)||bt(o,l,b,null,p,Y)}for(y in p)if(b=p[y],Y=u[y],p.hasOwnProperty(y)&&(b!=null||Y!=null))switch(y){case"value":ne=b;break;case"defaultValue":A=b;break;case"multiple":C=b;default:b!==Y&&bt(o,l,y,b,p,Y)}l=A,u=C,p=re,ne!=null?ts(o,!!u,ne,!1):!!p!=!!u&&(l!=null?ts(o,!!u,l,!0):ts(o,!!u,u?[]:"",!1));return;case"textarea":re=ne=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!p.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:bt(o,l,A,null,p,y)}for(C in p)if(y=p[C],b=u[C],p.hasOwnProperty(C)&&(y!=null||b!=null))switch(C){case"value":ne=y;break;case"defaultValue":re=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(n(91));break;default:y!==b&&bt(o,l,C,y,p,b)}o_(o,ne,re);return;case"option":for(var we in u)if(ne=u[we],u.hasOwnProperty(we)&&ne!=null&&!p.hasOwnProperty(we))switch(we){case"selected":o.selected=!1;break;default:bt(o,l,we,null,p,ne)}for(Y in p)if(ne=p[Y],re=u[Y],p.hasOwnProperty(Y)&&ne!==re&&(ne!=null||re!=null))switch(Y){case"selected":o.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:bt(o,l,Y,ne,p,re)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ze in u)ne=u[ze],u.hasOwnProperty(ze)&&ne!=null&&!p.hasOwnProperty(ze)&&bt(o,l,ze,null,p,ne);for(te in p)if(ne=p[te],re=u[te],p.hasOwnProperty(te)&&ne!==re&&(ne!=null||re!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(n(137,l));break;default:bt(o,l,te,ne,p,re)}return;default:if(Vm(l)){for(var _t in u)ne=u[_t],u.hasOwnProperty(_t)&&ne!==void 0&&!p.hasOwnProperty(_t)&&E0(o,l,_t,void 0,p,ne);for(se in p)ne=p[se],re=u[se],!p.hasOwnProperty(se)||ne===re||ne===void 0&&re===void 0||E0(o,l,se,ne,p,re);return}}for(var F in u)ne=u[F],u.hasOwnProperty(F)&&ne!=null&&!p.hasOwnProperty(F)&&bt(o,l,F,null,p,ne);for(he in p)ne=p[he],re=u[he],!p.hasOwnProperty(he)||ne===re||ne==null&&re==null||bt(o,l,he,ne,p,re)}function hk(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function u3(){if(typeof performance.getEntriesByType=="function"){for(var o=0,l=0,u=performance.getEntriesByType("resource"),p=0;p<u.length;p++){var y=u[p],b=y.transferSize,C=y.initiatorType,A=y.duration;if(b&&A&&hk(C)){for(C=0,A=y.responseEnd,p+=1;p<u.length;p++){var Y=u[p],te=Y.startTime;if(te>A)break;var se=Y.transferSize,he=Y.initiatorType;se&&hk(he)&&(Y=Y.responseEnd,C+=se*(Y<A?1:(A-te)/(Y-te)))}if(--p,l+=8*(b+C)/(y.duration/1e3),o++,10<o)break}}if(0<o)return l/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var R0=null,A0=null;function Tf(o){return o.nodeType===9?o:o.ownerDocument}function uk(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function dk(o,l){if(o===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&l==="foreignObject"?0:o}function M0(o,l){return o==="textarea"||o==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var z0=null;function d3(){var o=window.event;return o&&o.type==="popstate"?o===z0?!1:(z0=o,!0):(z0=null,!1)}var fk=typeof setTimeout=="function"?setTimeout:void 0,f3=typeof clearTimeout=="function"?clearTimeout:void 0,pk=typeof Promise=="function"?Promise:void 0,p3=typeof queueMicrotask=="function"?queueMicrotask:typeof pk<"u"?function(o){return pk.resolve(null).then(o).catch(g3)}:fk;function g3(o){setTimeout(function(){throw o})}function uo(o){return o==="head"}function gk(o,l){var u=l,p=0;do{var y=u.nextSibling;if(o.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(p===0){o.removeChild(y),Xl(l);return}p--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")p++;else if(u==="html")kh(o.ownerDocument.documentElement);else if(u==="head"){u=o.ownerDocument.head,kh(u);for(var b=u.firstChild;b;){var C=b.nextSibling,A=b.nodeName;b[ea]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&b.rel.toLowerCase()==="stylesheet"||u.removeChild(b),b=C}}else u==="body"&&kh(o.ownerDocument.body);u=y}while(u);Xl(l)}function mk(o,l){var u=o;o=0;do{var p=u.nextSibling;if(u.nodeType===1?l?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(l?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),p&&p.nodeType===8)if(u=p.data,u==="/$"){if(o===0)break;o--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||o++;u=p}while(u)}function j0(o){var l=o.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var u=l;switch(l=l.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":j0(u),Zc(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}o.removeChild(u)}}function m3(o,l,u,p){for(;o.nodeType===1;){var y=u;if(o.nodeName.toLowerCase()!==l.toLowerCase()){if(!p&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(p){if(!o[ea])switch(l){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(b=o.getAttribute("rel"),b==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(b!==y.rel||o.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||o.getAttribute("title")!==(y.title==null?null:y.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(b=o.getAttribute("src"),(b!==(y.src==null?null:y.src)||o.getAttribute("type")!==(y.type==null?null:y.type)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&b&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(l==="input"&&o.type==="hidden"){var b=y.name==null?null:""+y.name;if(y.type==="hidden"&&o.getAttribute("name")===b)return o}else return o;if(o=Hn(o.nextSibling),o===null)break}return null}function O3(o,l,u){if(l==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=Hn(o.nextSibling),o===null))return null;return o}function Ok(o,l){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!l||(o=Hn(o.nextSibling),o===null))return null;return o}function D0(o){return o.data==="$?"||o.data==="$~"}function B0(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function v3(o,l){var u=o.ownerDocument;if(o.data==="$~")o._reactRetry=l;else if(o.data!=="$?"||u.readyState!=="loading")l();else{var p=function(){l(),u.removeEventListener("DOMContentLoaded",p)};u.addEventListener("DOMContentLoaded",p),o._reactRetry=p}}function Hn(o){for(;o!=null;o=o.nextSibling){var l=o.nodeType;if(l===1||l===3)break;if(l===8){if(l=o.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return o}var L0=null;function vk(o){o=o.nextSibling;for(var l=0;o;){if(o.nodeType===8){var u=o.data;if(u==="/$"||u==="/&"){if(l===0)return Hn(o.nextSibling);l--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||l++}o=o.nextSibling}return null}function yk(o){o=o.previousSibling;for(var l=0;o;){if(o.nodeType===8){var u=o.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(l===0)return o;l--}else u!=="/$"&&u!=="/&"||l++}o=o.previousSibling}return null}function Sk(o,l,u){switch(l=Tf(u),o){case"html":if(o=l.documentElement,!o)throw Error(n(452));return o;case"head":if(o=l.head,!o)throw Error(n(453));return o;case"body":if(o=l.body,!o)throw Error(n(454));return o;default:throw Error(n(451))}}function kh(o){for(var l=o.attributes;l.length;)o.removeAttributeNode(l[0]);Zc(o)}var Un=new Map,bk=new Set;function Qf(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var vs=Z.d;Z.d={f:y3,r:S3,D:b3,C:_3,L:x3,m:w3,X:C3,S:k3,M:T3};function y3(){var o=vs.f(),l=yf();return o||l}function S3(o){var l=Ws(o);l!==null&&l.tag===5&&l.type==="form"?Bx(l):vs.r(o)}var Dl=typeof document>"u"?null:document;function _k(o,l,u){var p=Dl;if(p&&typeof l=="string"&&l){var y=ln(l);y='link[rel="'+o+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),bk.has(y)||(bk.add(y),o={rel:o,crossOrigin:u,href:l},p.querySelector(y)===null&&(l=p.createElement("link"),Qi(l,"link",o),Kt(l),p.head.appendChild(l)))}}function b3(o){vs.D(o),_k("dns-prefetch",o,null)}function _3(o,l){vs.C(o,l),_k("preconnect",o,l)}function x3(o,l,u){vs.L(o,l,u);var p=Dl;if(p&&o&&l){var y='link[rel="preload"][as="'+ln(l)+'"]';l==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+ln(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+ln(u.imageSizes)+'"]')):y+='[href="'+ln(o)+'"]';var b=y;switch(l){case"style":b=Bl(o);break;case"script":b=Ll(o)}Un.has(b)||(o=g({rel:"preload",href:l==="image"&&u&&u.imageSrcSet?void 0:o,as:l},u),Un.set(b,o),p.querySelector(y)!==null||l==="style"&&p.querySelector(Ch(b))||l==="script"&&p.querySelector(Th(b))||(l=p.createElement("link"),Qi(l,"link",o),Kt(l),p.head.appendChild(l)))}}function w3(o,l){vs.m(o,l);var u=Dl;if(u&&o){var p=l&&typeof l.as=="string"?l.as:"script",y='link[rel="modulepreload"][as="'+ln(p)+'"][href="'+ln(o)+'"]',b=y;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Ll(o)}if(!Un.has(b)&&(o=g({rel:"modulepreload",href:o},l),Un.set(b,o),u.querySelector(y)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Th(b)))return}p=u.createElement("link"),Qi(p,"link",o),Kt(p),u.head.appendChild(p)}}}function k3(o,l,u){vs.S(o,l,u);var p=Dl;if(p&&o){var y=Vs(p).hoistableStyles,b=Bl(o);l=l||"default";var C=y.get(b);if(!C){var A={loading:0,preload:null};if(C=p.querySelector(Ch(b)))A.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":l},u),(u=Un.get(b))&&X0(o,u);var Y=C=p.createElement("link");Kt(Y),Qi(Y,"link",o),Y._p=new Promise(function(te,se){Y.onload=te,Y.onerror=se}),Y.addEventListener("load",function(){A.loading|=1}),Y.addEventListener("error",function(){A.loading|=2}),A.loading|=4,$f(C,l,p)}C={type:"stylesheet",instance:C,count:1,state:A},y.set(b,C)}}}function C3(o,l){vs.X(o,l);var u=Dl;if(u&&o){var p=Vs(u).hoistableScripts,y=Ll(o),b=p.get(y);b||(b=u.querySelector(Th(y)),b||(o=g({src:o,async:!0},l),(l=Un.get(y))&&N0(o,l),b=u.createElement("script"),Kt(b),Qi(b,"link",o),u.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},p.set(y,b))}}function T3(o,l){vs.M(o,l);var u=Dl;if(u&&o){var p=Vs(u).hoistableScripts,y=Ll(o),b=p.get(y);b||(b=u.querySelector(Th(y)),b||(o=g({src:o,async:!0,type:"module"},l),(l=Un.get(y))&&N0(o,l),b=u.createElement("script"),Kt(b),Qi(b,"link",o),u.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},p.set(y,b))}}function xk(o,l,u,p){var y=(y=de.current)?Qf(y):null;if(!y)throw Error(n(446));switch(o){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(l=Bl(u.href),u=Vs(y).hoistableStyles,p=u.get(l),p||(p={type:"style",instance:null,count:0,state:null},u.set(l,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){o=Bl(u.href);var b=Vs(y).hoistableStyles,C=b.get(o);if(C||(y=y.ownerDocument||y,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(o,C),(b=y.querySelector(Ch(o)))&&!b._p&&(C.instance=b,C.state.loading=5),Un.has(o)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Un.set(o,u),b||Q3(y,o,u,C.state))),l&&p===null)throw Error(n(528,""));return C}if(l&&p!==null)throw Error(n(529,""));return null;case"script":return l=u.async,u=u.src,typeof u=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Ll(u),u=Vs(y).hoistableScripts,p=u.get(l),p||(p={type:"script",instance:null,count:0,state:null},u.set(l,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,o))}}function Bl(o){return'href="'+ln(o)+'"'}function Ch(o){return'link[rel="stylesheet"]['+o+"]"}function wk(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function Q3(o,l,u,p){o.querySelector('link[rel="preload"][as="style"]['+l+"]")?p.loading=1:(l=o.createElement("link"),p.preload=l,l.addEventListener("load",function(){return p.loading|=1}),l.addEventListener("error",function(){return p.loading|=2}),Qi(l,"link",u),Kt(l),o.head.appendChild(l))}function Ll(o){return'[src="'+ln(o)+'"]'}function Th(o){return"script[async]"+o}function kk(o,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var p=o.querySelector('style[data-href~="'+ln(u.href)+'"]');if(p)return l.instance=p,Kt(p),p;var y=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return p=(o.ownerDocument||o).createElement("style"),Kt(p),Qi(p,"style",y),$f(p,u.precedence,o),l.instance=p;case"stylesheet":y=Bl(u.href);var b=o.querySelector(Ch(y));if(b)return l.state.loading|=4,l.instance=b,Kt(b),b;p=wk(u),(y=Un.get(y))&&X0(p,y),b=(o.ownerDocument||o).createElement("link"),Kt(b);var C=b;return C._p=new Promise(function(A,Y){C.onload=A,C.onerror=Y}),Qi(b,"link",p),l.state.loading|=4,$f(b,u.precedence,o),l.instance=b;case"script":return b=Ll(u.src),(y=o.querySelector(Th(b)))?(l.instance=y,Kt(y),y):(p=u,(y=Un.get(b))&&(p=g({},u),N0(p,y)),o=o.ownerDocument||o,y=o.createElement("script"),Kt(y),Qi(y,"link",p),o.head.appendChild(y),l.instance=y);case"void":return null;default:throw Error(n(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(p=l.instance,l.state.loading|=4,$f(p,u.precedence,o));return l.instance}function $f(o,l,u){for(var p=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=p.length?p[p.length-1]:null,b=y,C=0;C<p.length;C++){var A=p[C];if(A.dataset.precedence===l)b=A;else if(b!==y)break}b?b.parentNode.insertBefore(o,b.nextSibling):(l=u.nodeType===9?u.head:u,l.insertBefore(o,l.firstChild))}function X0(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.title==null&&(o.title=l.title)}function N0(o,l){o.crossOrigin==null&&(o.crossOrigin=l.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=l.referrerPolicy),o.integrity==null&&(o.integrity=l.integrity)}var Pf=null;function Ck(o,l,u){if(Pf===null){var p=new Map,y=Pf=new Map;y.set(u,p)}else y=Pf,p=y.get(u),p||(p=new Map,y.set(u,p));if(p.has(o))return p;for(p.set(o,null),u=u.getElementsByTagName(o),y=0;y<u.length;y++){var b=u[y];if(!(b[ea]||b[li]||o==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var C=b.getAttribute(l)||"";C=o+C;var A=p.get(C);A?A.push(b):p.set(C,[b])}}return p}function Tk(o,l,u){o=o.ownerDocument||o,o.head.insertBefore(u,l==="title"?o.querySelector("head > title"):null)}function $3(o,l,u){if(u===1||l.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return o=l.disabled,typeof l.precedence=="string"&&o==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function Qk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function P3(o,l,u,p){if(u.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Bl(p.href),b=l.querySelector(Ch(y));if(b){l=b._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(o.count++,o=Ef.bind(o),l.then(o,o)),u.state.loading|=4,u.instance=b,Kt(b);return}b=l.ownerDocument||l,p=wk(p),(y=Un.get(y))&&X0(p,y),b=b.createElement("link"),Kt(b);var C=b;C._p=new Promise(function(A,Y){C.onload=A,C.onerror=Y}),Qi(b,"link",p),u.instance=b}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(u,l),(l=u.state.preload)&&(u.state.loading&3)===0&&(o.count++,u=Ef.bind(o),l.addEventListener("load",u),l.addEventListener("error",u))}}var Z0=0;function E3(o,l){return o.stylesheets&&o.count===0&&Af(o,o.stylesheets),0<o.count||0<o.imgCount?function(u){var p=setTimeout(function(){if(o.stylesheets&&Af(o,o.stylesheets),o.unsuspend){var b=o.unsuspend;o.unsuspend=null,b()}},6e4+l);0<o.imgBytes&&Z0===0&&(Z0=62500*u3());var y=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Af(o,o.stylesheets),o.unsuspend)){var b=o.unsuspend;o.unsuspend=null,b()}},(o.imgBytes>Z0?50:800)+l);return o.unsuspend=u,function(){o.unsuspend=null,clearTimeout(p),clearTimeout(y)}}:null}function Ef(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Af(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Rf=null;function Af(o,l){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Rf=new Map,l.forEach(R3,o),Rf=null,Ef.call(o))}function R3(o,l){if(!(l.state.loading&4)){var u=Rf.get(o);if(u)var p=u.get(null);else{u=new Map,Rf.set(o,u);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<y.length;b++){var C=y[b];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(u.set(C.dataset.precedence,C),p=C)}p&&u.set(null,p)}y=l.instance,C=y.getAttribute("data-precedence"),b=u.get(C)||p,b===p&&u.set(null,y),u.set(C,y),this.count++,p=Ef.bind(this),y.addEventListener("load",p),y.addEventListener("error",p),b?b.parentNode.insertBefore(y,b.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(y,o.firstChild)),l.state.loading|=4}}var Qh={$$typeof:k,Provider:null,Consumer:null,_currentValue:L,_currentValue2:L,_threadCount:0};function A3(o,l,u,p,y,b,C,A,Y){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Lc(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lc(0),this.hiddenUpdates=Lc(null),this.identifierPrefix=p,this.onUncaughtError=y,this.onCaughtError=b,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function $k(o,l,u,p,y,b,C,A,Y,te,se,he){return o=new A3(o,l,u,C,Y,te,se,he,A),l=1,b===!0&&(l|=24),b=wn(3,null,null,l),o.current=b,b.stateNode=o,l=bO(),l.refCount++,o.pooledCache=l,l.refCount++,b.memoizedState={element:p,isDehydrated:u,cache:l},kO(b),o}function Pk(o){return o?(o=ml,o):ml}function Ek(o,l,u,p,y,b){y=Pk(y),p.context===null?p.context=y:p.pendingContext=y,p=eo(l),p.payload={element:u},b=b===void 0?null:b,b!==null&&(p.callback=b),u=to(o,p,l),u!==null&&(pn(u,o,l),oh(u,o,l))}function Rk(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<l?u:l}}function W0(o,l){Rk(o,l),(o=o.alternate)&&Rk(o,l)}function Ak(o){if(o.tag===13||o.tag===31){var l=oa(o,67108864);l!==null&&pn(l,o,67108864),W0(o,67108864)}}function Mk(o){if(o.tag===13||o.tag===31){var l=$n();l=Xc(l);var u=oa(o,l);u!==null&&pn(u,o,l),W0(o,l)}}var Mf=!0;function M3(o,l,u,p){var y=P.T;P.T=null;var b=Z.p;try{Z.p=2,q0(o,l,u,p)}finally{Z.p=b,P.T=y}}function z3(o,l,u,p){var y=P.T;P.T=null;var b=Z.p;try{Z.p=8,q0(o,l,u,p)}finally{Z.p=b,P.T=y}}function q0(o,l,u,p){if(Mf){var y=V0(p);if(y===null)P0(o,l,p,zf,u),jk(o,p);else if(D3(y,o,l,u,p))p.stopPropagation();else if(jk(o,p),l&4&&-1<j3.indexOf(o)){for(;y!==null;){var b=Ws(y);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var C=Kr(b.pendingLanes);if(C!==0){var A=b;for(A.pendingLanes|=2,A.entangledLanes|=2;C;){var Y=1<<31-Yi(C);A.entanglements[1]|=Y,C&=~Y}$r(b),(ft&6)===0&&(Of=Le()+500,_h(0))}}break;case 31:case 13:A=oa(b,2),A!==null&&pn(A,b,2),yf(),W0(b,2)}if(b=V0(p),b===null&&P0(o,l,p,zf,u),b===y)break;y=b}y!==null&&p.stopPropagation()}else P0(o,l,p,null,u)}}function V0(o){return o=Ym(o),I0(o)}var zf=null;function I0(o){if(zf=null,o=Zs(o),o!==null){var l=s(o);if(l===null)o=null;else{var u=l.tag;if(u===13){if(o=a(l),o!==null)return o;o=null}else if(u===31){if(o=c(l),o!==null)return o;o=null}else if(u===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;o=null}else l!==o&&(o=null)}}return zf=o,null}function zk(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(sn()){case on:return 2;case Vi:return 8;case Go:case Rm:return 32;case tl:return 268435456;default:return 32}default:return 32}}var Y0=!1,fo=null,po=null,go=null,$h=new Map,Ph=new Map,mo=[],j3="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function jk(o,l){switch(o){case"focusin":case"focusout":fo=null;break;case"dragenter":case"dragleave":po=null;break;case"mouseover":case"mouseout":go=null;break;case"pointerover":case"pointerout":$h.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ph.delete(l.pointerId)}}function Eh(o,l,u,p,y,b){return o===null||o.nativeEvent!==b?(o={blockedOn:l,domEventName:u,eventSystemFlags:p,nativeEvent:b,targetContainers:[y]},l!==null&&(l=Ws(l),l!==null&&Ak(l)),o):(o.eventSystemFlags|=p,l=o.targetContainers,y!==null&&l.indexOf(y)===-1&&l.push(y),o)}function D3(o,l,u,p,y){switch(l){case"focusin":return fo=Eh(fo,o,l,u,p,y),!0;case"dragenter":return po=Eh(po,o,l,u,p,y),!0;case"mouseover":return go=Eh(go,o,l,u,p,y),!0;case"pointerover":var b=y.pointerId;return $h.set(b,Eh($h.get(b)||null,o,l,u,p,y)),!0;case"gotpointercapture":return b=y.pointerId,Ph.set(b,Eh(Ph.get(b)||null,o,l,u,p,y)),!0}return!1}function Dk(o){var l=Zs(o.target);if(l!==null){var u=s(l);if(u!==null){if(l=u.tag,l===13){if(l=a(u),l!==null){o.blockedOn=l,_d(o.priority,function(){Mk(u)});return}}else if(l===31){if(l=c(u),l!==null){o.blockedOn=l,_d(o.priority,function(){Mk(u)});return}}else if(l===3&&u.stateNode.current.memoizedState.isDehydrated){o.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}o.blockedOn=null}function jf(o){if(o.blockedOn!==null)return!1;for(var l=o.targetContainers;0<l.length;){var u=V0(o.nativeEvent);if(u===null){u=o.nativeEvent;var p=new u.constructor(u.type,u);Im=p,u.target.dispatchEvent(p),Im=null}else return l=Ws(u),l!==null&&Ak(l),o.blockedOn=u,!1;l.shift()}return!0}function Bk(o,l,u){jf(o)&&u.delete(l)}function B3(){Y0=!1,fo!==null&&jf(fo)&&(fo=null),po!==null&&jf(po)&&(po=null),go!==null&&jf(go)&&(go=null),$h.forEach(Bk),Ph.forEach(Bk)}function Df(o,l){o.blockedOn===l&&(o.blockedOn=null,Y0||(Y0=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,B3)))}var Bf=null;function Lk(o){Bf!==o&&(Bf=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bf===o&&(Bf=null);for(var l=0;l<o.length;l+=3){var u=o[l],p=o[l+1],y=o[l+2];if(typeof p!="function"){if(I0(p||u)===null)continue;break}var b=Ws(u);b!==null&&(o.splice(l,3),l-=3,VO(b,{pending:!0,data:y,method:u.method,action:p},p,y))}}))}function Xl(o){function l(Y){return Df(Y,o)}fo!==null&&Df(fo,o),po!==null&&Df(po,o),go!==null&&Df(go,o),$h.forEach(l),Ph.forEach(l);for(var u=0;u<mo.length;u++){var p=mo[u];p.blockedOn===o&&(p.blockedOn=null)}for(;0<mo.length&&(u=mo[0],u.blockedOn===null);)Dk(u),u.blockedOn===null&&mo.shift();if(u=(o.ownerDocument||o).$$reactFormReplay,u!=null)for(p=0;p<u.length;p+=3){var y=u[p],b=u[p+1],C=y[Di]||null;if(typeof b=="function")C||Lk(u);else if(C){var A=null;if(b&&b.hasAttribute("formAction")){if(y=b,C=b[Di]||null)A=C.formAction;else if(I0(y)!==null)continue}else A=C.action;typeof A=="function"?u[p+1]=A:(u.splice(p,3),p-=3),Lk(u)}}}function Xk(){function o(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(C){return y=C})},focusReset:"manual",scroll:"manual"})}function l(){y!==null&&(y(),y=null),p||setTimeout(u,20)}function u(){if(!p&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,y=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(u,100),function(){p=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),y!==null&&(y(),y=null)}}}function H0(o){this._internalRoot=o}Lf.prototype.render=H0.prototype.render=function(o){var l=this._internalRoot;if(l===null)throw Error(n(409));var u=l.current,p=$n();Ek(u,p,o,l,null,null)},Lf.prototype.unmount=H0.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var l=o.containerInfo;Ek(o.current,2,null,o,null,null),yf(),l[Jr]=null}};function Lf(o){this._internalRoot=o}Lf.prototype.unstable_scheduleHydration=function(o){if(o){var l=bd();o={blockedOn:null,target:o,priority:l};for(var u=0;u<mo.length&&l!==0&&l<mo[u].priority;u++);mo.splice(u,0,o),u===0&&Dk(o)}};var Nk=e.version;if(Nk!=="19.2.4")throw Error(n(527,Nk,"19.2.4"));Z.findDOMNode=function(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=d(l),o=o!==null?f(o):null,o=o===null?null:o.stateNode,o};var L3={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xf.isDisabled&&Xf.supportsFiber)try{Fo=Xf.inject(L3),Ii=Xf}catch{}}return Ah.createRoot=function(o,l){if(!r(o))throw Error(n(299));var u=!1,p="",y=Hx,b=Ux,C=Gx;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(p=l.identifierPrefix),l.onUncaughtError!==void 0&&(y=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError)),l=$k(o,1,!1,null,null,u,p,null,y,b,C,Xk),o[Jr]=l.current,$0(o),new H0(l)},Ah.hydrateRoot=function(o,l,u){if(!r(o))throw Error(n(299));var p=!1,y="",b=Hx,C=Ux,A=Gx,Y=null;return u!=null&&(u.unstable_strictMode===!0&&(p=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(b=u.onUncaughtError),u.onCaughtError!==void 0&&(C=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(Y=u.formState)),l=$k(o,1,!0,l,u??null,p,y,Y,b,C,A,Xk),l.context=Pk(null),u=l.current,p=$n(),p=Xc(p),y=eo(p),y.callback=null,to(u,y,p),u=p,l.current.lanes=u,Jo(l,u),$r(l),o[Jr]=l.current,$0(o),new Lf(l)},Ah.version="19.2.4",Ah}var Fk;function H3(){if(Fk)return F0.exports;Fk=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),F0.exports=Y3(),F0.exports}var U3=H3();const Kk=t=>{let e;const i=new Set,n=(d,f)=>{const g=typeof d=="function"?d(e):d;if(!Object.is(g,e)){const m=e;e=f??(typeof g!="object"||g===null)?g:Object.assign({},e,g),i.forEach(O=>O(e,m))}},r=()=>e,c={setState:n,getState:r,getInitialState:()=>h,subscribe:d=>(i.add(d),()=>i.delete(d))},h=e=t(n,r,c);return c},G3=(t=>t?Kk(t):Kk),F3=t=>t;function K3(t,e=F3){const i=Ul.useSyncExternalStore(t.subscribe,Ul.useCallback(()=>e(t.getState()),[t,e]),Ul.useCallback(()=>e(t.getInitialState()),[t,e]));return Ul.useDebugValue(i),i}const Jk=t=>{const e=G3(t),i=n=>K3(e,n);return Object.assign(i,e),i},J3=(t=>t?Jk(t):Jk),eD=`ws://${window.location.hostname}:${window.location.port||31415}`,Ui="",Ce=J3((t,e)=>({agents:[],connected:!1,ws:null,daemonHost:null,tunneled:!1,activeTab:"agents",detailPanel:null,activityLog:{},statusMessage:null,commandHistory:[],chatHistory:{},tokenTimeline:{},dashTelemetry:{},editorFiles:{},editorActiveFile:null,editorOpenTabs:[],editorTreeCache:{},editorChangedFiles:{},editorRecentSaves:{},connect(){if(e().ws)return;const i=new WebSocket(eD);i.onopen=()=>{t({connected:!0,ws:i}),fetch(`${Ui}/api/status`).then(n=>n.json()).then(n=>{const r={};n.host&&n.host!=="127.0.0.1"&&(r.daemonHost=n.host);const s=window.location.port||"80";String(n.port)!==s&&(r.tunneled=!0),Object.keys(r).length>0&&t(r)}).catch(()=>{})},i.onmessage=n=>{const r=JSON.parse(n.data);switch(r.type){case"state":{const s={...e().tokenTimeline},a=Date.now();for(const c of r.data){s[c.id]||(s[c.id]=[]);const h=s[c.id],d=h[h.length-1];(!d||c.tokensUsed!==d.v||a-d.t>5e3)&&(h.push({t:a,v:c.tokensUsed||0}),h.length>200&&(s[c.id]=h.slice(-200)))}t({agents:r.data,tokenTimeline:s});break}case"agent:output":{const{agentId:s,data:a}=r,c={...e().activityLog};c[s]||(c[s]=[]),c[s]=[...c[s].slice(-200),{timestamp:Date.now(),text:typeof a.data=="string"?a.data:JSON.stringify(a.data),type:a.type}],t({activityLog:c});break}case"agent:exit":{const s=e().agents.find(h=>h.id===r.agentId),a=(s==null?void 0:s.name)||r.agentId,c=r.status==="completed"?`${a} completed`:r.status==="killed"?`${a} killed`:`${a} crashed (exit ${r.code})`;e().showStatus(c);break}case"rotation:start":e().showStatus(`rotating ${r.agentName}...`);break;case"rotation:complete":{e().showStatus(`rotated ${r.agentName} (saved ${r.tokensSaved} tokens)`);const s=e().detailPanel;(s==null?void 0:s.type)==="agent"&&s.agentId===r.oldAgentId&&r.newAgentId&&t(a=>{const c={...a.chatHistory},h={...a.tokenTimeline},d=c[r.oldAgentId]||[],f=h[r.oldAgentId]||[];return d.length>0&&(c[r.newAgentId]=[...d]),f.length>0&&(h[r.newAgentId]=[...f]),{chatHistory:c,tokenTimeline:h,detailPanel:{type:"agent",agentId:r.newAgentId}}});break}case"rotation:failed":e().showStatus(`rotation failed: ${r.error}`);break;case"file:changed":{const s=e().editorRecentSaves[r.path];if(s&&Date.now()-s<2e3)break;t(a=>({editorChangedFiles:{...a.editorChangedFiles,[r.path]:r.timestamp}}));break}}},i.onclose=()=>{t({connected:!1,ws:null,daemonHost:null,tunneled:!1}),setTimeout(()=>e().connect(),2e3)},i.onerror=()=>i.close()},async spawnAgent(i){const n=await fetch(`${Ui}/api/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error||"Spawn failed")}const r=await n.json();return e().showStatus(`spawned ${r.name}`),r},async killAgent(i,n=!1){await fetch(`${Ui}/api/agents/${i}?purge=${n}`,{method:"DELETE"})},async rotateAgent(i){const n=await fetch(`${Ui}/api/agents/${i}/rotate`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Rotation failed")}return n.json()},async fetchProviders(){return(await fetch(`${Ui}/api/providers`)).json()},setActiveTab(i){t({activeTab:i})},openDetail(i){t({detailPanel:i})},closeDetail(){t({detailPanel:null})},selectAgent(i){t({detailPanel:{type:"agent",agentId:i}})},clearSelection(){t({detailPanel:null})},showStatus(i){t({statusMessage:i}),setTimeout(()=>{e().statusMessage===i&&t({statusMessage:null})},4e3)},addChatMessage(i,n,r,s=!1){t(a=>{const c={...a.chatHistory};return c[i]||(c[i]=[]),c[i]=[...c[i].slice(-100),{from:n,text:r,timestamp:Date.now(),isQuery:s}],{chatHistory:c}})},async instructAgent(i,n){const r=e().agents.find(f=>f.id===i),s=r&&(r.status==="running"||r.status==="starting");e().addChatMessage(i,"user",n,!1),e().addChatMessage(i,"system",s?"sending instruction...":"continuing conversation...");const a=await fetch(`${Ui}/api/agents/${i}/instruct`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n})});if(!a.ok){const f=await a.json().catch(()=>({}));throw e().addChatMessage(i,"system",`failed: ${f.error||"unknown error"}`),new Error(f.error||"Instruction failed")}const c=await a.json(),h=e().chatHistory[i]||[];h.length>0&&t(f=>{const g={...f.chatHistory};return g[c.id]=[...h],{chatHistory:g}});const d=e().tokenTimeline[i]||[];return d.length>0&&t(f=>{const g={...f.tokenTimeline};return g[c.id]=[...d],{tokenTimeline:g}}),e().selectAgent(c.id),e().addChatMessage(c.id,"system","agent resumed with context"),c},async queryAgent(i,n){e().addChatMessage(i,"user",n,!0);const r=await fetch(`${Ui}/api/agents/${i}/query`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n})});if(!r.ok){const a=await r.json().catch(()=>({}));throw e().addChatMessage(i,"system",`query failed: ${a.error||"unknown error"}`),new Error(a.error||"Query failed")}const s=await r.json();return e().addChatMessage(i,"agent",s.response),s},async openFile(i){var s;if(e().editorFiles[i]||e().editorOpenTabs.includes(i)){t(a=>({editorActiveFile:i,editorOpenTabs:a.editorOpenTabs.includes(i)?a.editorOpenTabs:[...a.editorOpenTabs,i]}));return}const n=(s=i.split(".").pop())==null?void 0:s.toLowerCase();if(["png","jpg","jpeg","gif","svg","webp","ico","bmp","avif","mp4","webm","mov","avi","mkv","ogv"].includes(n)){t(a=>({editorActiveFile:i,editorOpenTabs:[...a.editorOpenTabs,i]}));return}try{const a=await fetch(`${Ui}/api/files/read?path=${encodeURIComponent(i)}`);if(!a.ok){const d=await a.json().catch(()=>({}));e().showStatus(d.error||"Failed to read file");return}const c=await a.json();if(c.binary){e().showStatus("Binary file — cannot open");return}t(d=>({editorFiles:{...d.editorFiles,[i]:{content:c.content,originalContent:c.content,language:c.language,loadedAt:Date.now()}},editorActiveFile:i,editorOpenTabs:d.editorOpenTabs.includes(i)?d.editorOpenTabs:[...d.editorOpenTabs,i]}));const h=e().ws;(h==null?void 0:h.readyState)===1&&h.send(JSON.stringify({type:"editor:watch",path:i}))}catch{e().showStatus("Failed to open file")}},closeFile(i){t(r=>{const s=r.editorOpenTabs.filter(d=>d!==i),a={...r.editorFiles};delete a[i];const c={...r.editorChangedFiles};delete c[i];let h=r.editorActiveFile;if(h===i){const d=r.editorOpenTabs.indexOf(i);h=s[Math.min(d,s.length-1)]||null}return{editorOpenTabs:s,editorFiles:a,editorChangedFiles:c,editorActiveFile:h}});const n=e().ws;(n==null?void 0:n.readyState)===1&&n.send(JSON.stringify({type:"editor:unwatch",path:i}))},setActiveFile(i){t({editorActiveFile:i})},updateFileContent(i,n){t(r=>({editorFiles:{...r.editorFiles,[i]:{...r.editorFiles[i],content:n}}}))},async saveFile(i){const n=e().editorFiles[i];if(n)try{const r=await fetch(`${Ui}/api/files/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:n.content})});if(!r.ok){const s=await r.json().catch(()=>({}));e().showStatus(s.error||"Save failed");return}t(s=>({editorFiles:{...s.editorFiles,[i]:{...s.editorFiles[i],originalContent:n.content}},editorChangedFiles:(()=>{const a={...s.editorChangedFiles};return delete a[i],a})(),editorRecentSaves:{...s.editorRecentSaves,[i]:Date.now()}})),e().showStatus("Saved")}catch{e().showStatus("Save failed")}},async reloadFile(i){try{const n=await fetch(`${Ui}/api/files/read?path=${encodeURIComponent(i)}`);if(!n.ok)return;const r=await n.json();if(r.binary)return;t(s=>({editorFiles:{...s.editorFiles,[i]:{content:r.content,originalContent:r.content,language:r.language,loadedAt:Date.now()}},editorChangedFiles:(()=>{const a={...s.editorChangedFiles};return delete a[i],a})()}))}catch{}},dismissFileChange(i){t(n=>{const r={...n.editorChangedFiles};return delete r[i],{editorChangedFiles:r}})},async fetchTreeDir(i){try{const n=await fetch(`${Ui}/api/files/tree?path=${encodeURIComponent(i)}`);if(!n.ok)return;const r=await n.json();t(s=>({editorTreeCache:{...s.editorTreeCache,[i]:r.entries}}))}catch{}},async createFile(i){try{const n=await fetch(`${Ui}/api/files/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i})});if(!n.ok){const s=await n.json().catch(()=>({}));return e().showStatus(s.error||"Create failed"),!1}const r=i.includes("/")?i.split("/").slice(0,-1).join("/"):"";return await e().fetchTreeDir(r),e().showStatus("File created"),!0}catch{return e().showStatus("Create failed"),!1}},async createDir(i){try{const n=await fetch(`${Ui}/api/files/mkdir`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i})});if(!n.ok){const s=await n.json().catch(()=>({}));return e().showStatus(s.error||"Create failed"),!1}const r=i.includes("/")?i.split("/").slice(0,-1).join("/"):"";return await e().fetchTreeDir(r),e().showStatus("Folder created"),!0}catch{return e().showStatus("Create failed"),!1}},async deleteFile(i){try{const n=await fetch(`${Ui}/api/files/delete?path=${encodeURIComponent(i)}`,{method:"DELETE"});if(!n.ok){const s=await n.json().catch(()=>({}));return e().showStatus(s.error||"Delete failed"),!1}e().editorOpenTabs.includes(i)&&e().closeFile(i);const r=i.includes("/")?i.split("/").slice(0,-1).join("/"):"";return await e().fetchTreeDir(r),t(s=>{const a={...s.editorTreeCache};return delete a[i],{editorTreeCache:a}}),e().showStatus("Deleted"),!0}catch{return e().showStatus("Delete failed"),!1}},async renameFile(i,n){try{const r=await fetch(`${Ui}/api/files/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:i,newPath:n})});if(!r.ok){const c=await r.json().catch(()=>({}));return e().showStatus(c.error||"Rename failed"),!1}t(c=>{const h=c.editorOpenTabs.map(g=>g===i?n:g),d={...c.editorFiles};d[i]&&(d[n]=d[i],delete d[i]);const f=c.editorActiveFile===i?n:c.editorActiveFile;return{editorOpenTabs:h,editorFiles:d,editorActiveFile:f}});const s=i.includes("/")?i.split("/").slice(0,-1).join("/"):"",a=n.includes("/")?n.split("/").slice(0,-1).join("/"):"";return await e().fetchTreeDir(s),a!==s&&await e().fetchTreeDir(a),e().showStatus("Renamed"),!0}catch{return e().showStatus("Rename failed"),!1}},addCommand(i){t(n=>({commandHistory:[...n.commandHistory.slice(-49),i]}))}}));function ai(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let i=0,n;i<t.length;i++)(n=ai(t[i]))!==""&&(e+=(e&&" ")+n);else for(let i in t)t[i]&&(e+=(e&&" ")+i);return e}var tD={value:()=>{}};function em(){for(var t=0,e=arguments.length,i={},n;t<e;++t){if(!(n=arguments[t]+"")||n in i||/[\s.]/.test(n))throw new Error("illegal type: "+n);i[n]=[]}return new Ep(i)}function Ep(t){this._=t}function iD(t,e){return t.trim().split(/^|\s+/).map(function(i){var n="",r=i.indexOf(".");if(r>=0&&(n=i.slice(r+1),i=i.slice(0,r)),i&&!e.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:n}})}Ep.prototype=em.prototype={constructor:Ep,on:function(t,e){var i=this._,n=iD(t+"",i),r,s=-1,a=n.length;if(arguments.length<2){for(;++s<a;)if((r=(t=n[s]).type)&&(r=nD(i[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=n[s]).type)i[r]=eC(i[r],t.name,e);else if(e==null)for(r in i)i[r]=eC(i[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new Ep(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var i=new Array(r),n=0,r,s;n<r;++n)i[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],n=0,r=s.length;n<r;++n)s[n].value.apply(e,i)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],r=0,s=n.length;r<s;++r)n[r].value.apply(e,i)}};function nD(t,e){for(var i=0,n=t.length,r;i<n;++i)if((r=t[i]).name===e)return r.value}function eC(t,e,i){for(var n=0,r=t.length;n<r;++n)if(t[n].name===e){t[n]=tD,t=t.slice(0,n).concat(t.slice(n+1));break}return i!=null&&t.push({name:e,value:i}),t}var _y="http://www.w3.org/1999/xhtml";const tC={svg:"http://www.w3.org/2000/svg",xhtml:_y,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function tm(t){var e=t+="",i=e.indexOf(":");return i>=0&&(e=t.slice(0,i))!=="xmlns"&&(t=t.slice(i+1)),tC.hasOwnProperty(e)?{space:tC[e],local:t}:t}function rD(t){return function(){var e=this.ownerDocument,i=this.namespaceURI;return i===_y&&e.documentElement.namespaceURI===_y?e.createElement(t):e.createElementNS(i,t)}}function sD(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function q$(t){var e=tm(t);return(e.local?sD:rD)(e)}function oD(){}function _1(t){return t==null?oD:function(){return this.querySelector(t)}}function aD(t){typeof t!="function"&&(t=_1(t));for(var e=this._groups,i=e.length,n=new Array(i),r=0;r<i;++r)for(var s=e[r],a=s.length,c=n[r]=new Array(a),h,d,f=0;f<a;++f)(h=s[f])&&(d=t.call(h,h.__data__,f,s))&&("__data__"in h&&(d.__data__=h.__data__),c[f]=d);return new Xn(n,this._parents)}function lD(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function cD(){return[]}function V$(t){return t==null?cD:function(){return this.querySelectorAll(t)}}function hD(t){return function(){return lD(t.apply(this,arguments))}}function uD(t){typeof t=="function"?t=hD(t):t=V$(t);for(var e=this._groups,i=e.length,n=[],r=[],s=0;s<i;++s)for(var a=e[s],c=a.length,h,d=0;d<c;++d)(h=a[d])&&(n.push(t.call(h,h.__data__,d,a)),r.push(h));return new Xn(n,r)}function I$(t){return function(){return this.matches(t)}}function Y$(t){return function(e){return e.matches(t)}}var dD=Array.prototype.find;function fD(t){return function(){return dD.call(this.children,t)}}function pD(){return this.firstElementChild}function gD(t){return this.select(t==null?pD:fD(typeof t=="function"?t:Y$(t)))}var mD=Array.prototype.filter;function OD(){return Array.from(this.children)}function vD(t){return function(){return mD.call(this.children,t)}}function yD(t){return this.selectAll(t==null?OD:vD(typeof t=="function"?t:Y$(t)))}function SD(t){typeof t!="function"&&(t=I$(t));for(var e=this._groups,i=e.length,n=new Array(i),r=0;r<i;++r)for(var s=e[r],a=s.length,c=n[r]=[],h,d=0;d<a;++d)(h=s[d])&&t.call(h,h.__data__,d,s)&&c.push(h);return new Xn(n,this._parents)}function H$(t){return new Array(t.length)}function bD(){return new Xn(this._enter||this._groups.map(H$),this._parents)}function ng(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}ng.prototype={constructor:ng,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function _D(t){return function(){return t}}function xD(t,e,i,n,r,s){for(var a=0,c,h=e.length,d=s.length;a<d;++a)(c=e[a])?(c.__data__=s[a],n[a]=c):i[a]=new ng(t,s[a]);for(;a<h;++a)(c=e[a])&&(r[a]=c)}function wD(t,e,i,n,r,s,a){var c,h,d=new Map,f=e.length,g=s.length,m=new Array(f),O;for(c=0;c<f;++c)(h=e[c])&&(m[c]=O=a.call(h,h.__data__,c,e)+"",d.has(O)?r[c]=h:d.set(O,h));for(c=0;c<g;++c)O=a.call(t,s[c],c,s)+"",(h=d.get(O))?(n[c]=h,h.__data__=s[c],d.delete(O)):i[c]=new ng(t,s[c]);for(c=0;c<f;++c)(h=e[c])&&d.get(m[c])===h&&(r[c]=h)}function kD(t){return t.__data__}function CD(t,e){if(!arguments.length)return Array.from(this,kD);var i=e?wD:xD,n=this._parents,r=this._groups;typeof t!="function"&&(t=_D(t));for(var s=r.length,a=new Array(s),c=new Array(s),h=new Array(s),d=0;d<s;++d){var f=n[d],g=r[d],m=g.length,O=TD(t.call(f,f&&f.__data__,d,n)),S=O.length,_=c[d]=new Array(S),w=a[d]=new Array(S),x=h[d]=new Array(m);i(f,g,_,w,x,O,e);for(var Q=0,k=0,T,M;Q<S;++Q)if(T=_[Q]){for(Q>=k&&(k=Q+1);!(M=w[k])&&++k<S;);T._next=M||null}}return a=new Xn(a,n),a._enter=c,a._exit=h,a}function TD(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function QD(){return new Xn(this._exit||this._groups.map(H$),this._parents)}function $D(t,e,i){var n=this.enter(),r=this,s=this.exit();return typeof t=="function"?(n=t(n),n&&(n=n.selection())):n=n.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),i==null?s.remove():i(s),n&&r?n.merge(r).order():r}function PD(t){for(var e=t.selection?t.selection():t,i=this._groups,n=e._groups,r=i.length,s=n.length,a=Math.min(r,s),c=new Array(r),h=0;h<a;++h)for(var d=i[h],f=n[h],g=d.length,m=c[h]=new Array(g),O,S=0;S<g;++S)(O=d[S]||f[S])&&(m[S]=O);for(;h<r;++h)c[h]=i[h];return new Xn(c,this._parents)}function ED(){for(var t=this._groups,e=-1,i=t.length;++e<i;)for(var n=t[e],r=n.length-1,s=n[r],a;--r>=0;)(a=n[r])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function RD(t){t||(t=AD);function e(g,m){return g&&m?t(g.__data__,m.__data__):!g-!m}for(var i=this._groups,n=i.length,r=new Array(n),s=0;s<n;++s){for(var a=i[s],c=a.length,h=r[s]=new Array(c),d,f=0;f<c;++f)(d=a[f])&&(h[f]=d);h.sort(e)}return new Xn(r,this._parents).order()}function AD(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function MD(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function zD(){return Array.from(this)}function jD(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var n=t[e],r=0,s=n.length;r<s;++r){var a=n[r];if(a)return a}return null}function DD(){let t=0;for(const e of this)++t;return t}function BD(){return!this.node()}function LD(t){for(var e=this._groups,i=0,n=e.length;i<n;++i)for(var r=e[i],s=0,a=r.length,c;s<a;++s)(c=r[s])&&t.call(c,c.__data__,s,r);return this}function XD(t){return function(){this.removeAttribute(t)}}function ND(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ZD(t,e){return function(){this.setAttribute(t,e)}}function WD(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function qD(t,e){return function(){var i=e.apply(this,arguments);i==null?this.removeAttribute(t):this.setAttribute(t,i)}}function VD(t,e){return function(){var i=e.apply(this,arguments);i==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,i)}}function ID(t,e){var i=tm(t);if(arguments.length<2){var n=this.node();return i.local?n.getAttributeNS(i.space,i.local):n.getAttribute(i)}return this.each((e==null?i.local?ND:XD:typeof e=="function"?i.local?VD:qD:i.local?WD:ZD)(i,e))}function U$(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function YD(t){return function(){this.style.removeProperty(t)}}function HD(t,e,i){return function(){this.style.setProperty(t,e,i)}}function UD(t,e,i){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,i)}}function GD(t,e,i){return arguments.length>1?this.each((e==null?YD:typeof e=="function"?UD:HD)(t,e,i??"")):pc(this.node(),t)}function pc(t,e){return t.style.getPropertyValue(e)||U$(t).getComputedStyle(t,null).getPropertyValue(e)}function FD(t){return function(){delete this[t]}}function KD(t,e){return function(){this[t]=e}}function JD(t,e){return function(){var i=e.apply(this,arguments);i==null?delete this[t]:this[t]=i}}function eB(t,e){return arguments.length>1?this.each((e==null?FD:typeof e=="function"?JD:KD)(t,e)):this.node()[t]}function G$(t){return t.trim().split(/^|\s+/)}function x1(t){return t.classList||new F$(t)}function F$(t){this._node=t,this._names=G$(t.getAttribute("class")||"")}F$.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function K$(t,e){for(var i=x1(t),n=-1,r=e.length;++n<r;)i.add(e[n])}function J$(t,e){for(var i=x1(t),n=-1,r=e.length;++n<r;)i.remove(e[n])}function tB(t){return function(){K$(this,t)}}function iB(t){return function(){J$(this,t)}}function nB(t,e){return function(){(e.apply(this,arguments)?K$:J$)(this,t)}}function rB(t,e){var i=G$(t+"");if(arguments.length<2){for(var n=x1(this.node()),r=-1,s=i.length;++r<s;)if(!n.contains(i[r]))return!1;return!0}return this.each((typeof e=="function"?nB:e?tB:iB)(i,e))}function sB(){this.textContent=""}function oB(t){return function(){this.textContent=t}}function aB(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function lB(t){return arguments.length?this.each(t==null?sB:(typeof t=="function"?aB:oB)(t)):this.node().textContent}function cB(){this.innerHTML=""}function hB(t){return function(){this.innerHTML=t}}function uB(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function dB(t){return arguments.length?this.each(t==null?cB:(typeof t=="function"?uB:hB)(t)):this.node().innerHTML}function fB(){this.nextSibling&&this.parentNode.appendChild(this)}function pB(){return this.each(fB)}function gB(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mB(){return this.each(gB)}function OB(t){var e=typeof t=="function"?t:q$(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function vB(){return null}function yB(t,e){var i=typeof t=="function"?t:q$(t),n=e==null?vB:typeof e=="function"?e:_1(e);return this.select(function(){return this.insertBefore(i.apply(this,arguments),n.apply(this,arguments)||null)})}function SB(){var t=this.parentNode;t&&t.removeChild(this)}function bB(){return this.each(SB)}function _B(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function xB(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function wB(t){return this.select(t?xB:_B)}function kB(t){return arguments.length?this.property("__data__",t):this.node().__data__}function CB(t){return function(e){t.call(this,e,this.__data__)}}function TB(t){return t.trim().split(/^|\s+/).map(function(e){var i="",n=e.indexOf(".");return n>=0&&(i=e.slice(n+1),e=e.slice(0,n)),{type:e,name:i}})}function QB(t){return function(){var e=this.__on;if(e){for(var i=0,n=-1,r=e.length,s;i<r;++i)s=e[i],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function $B(t,e,i){return function(){var n=this.__on,r,s=CB(e);if(n){for(var a=0,c=n.length;a<c;++a)if((r=n[a]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=i),r.value=e;return}}this.addEventListener(t.type,s,i),r={type:t.type,name:t.name,value:e,listener:s,options:i},n?n.push(r):this.__on=[r]}}function PB(t,e,i){var n=TB(t+""),r,s=n.length,a;if(arguments.length<2){var c=this.node().__on;if(c){for(var h=0,d=c.length,f;h<d;++h)for(r=0,f=c[h];r<s;++r)if((a=n[r]).type===f.type&&a.name===f.name)return f.value}return}for(c=e?$B:QB,r=0;r<s;++r)this.each(c(n[r],e,i));return this}function eP(t,e,i){var n=U$(t),r=n.CustomEvent;typeof r=="function"?r=new r(e,i):(r=n.document.createEvent("Event"),i?(r.initEvent(e,i.bubbles,i.cancelable),r.detail=i.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function EB(t,e){return function(){return eP(this,t,e)}}function RB(t,e){return function(){return eP(this,t,e.apply(this,arguments))}}function AB(t,e){return this.each((typeof e=="function"?RB:EB)(t,e))}function*MB(){for(var t=this._groups,e=0,i=t.length;e<i;++e)for(var n=t[e],r=0,s=n.length,a;r<s;++r)(a=n[r])&&(yield a)}var tP=[null];function Xn(t,e){this._groups=t,this._parents=e}function Fu(){return new Xn([[document.documentElement]],tP)}function zB(){return this}Xn.prototype=Fu.prototype={constructor:Xn,select:aD,selectAll:uD,selectChild:gD,selectChildren:yD,filter:SD,data:CD,enter:bD,exit:QD,join:$D,merge:PD,selection:zB,order:ED,sort:RD,call:MD,nodes:zD,node:jD,size:DD,empty:BD,each:LD,attr:ID,style:GD,property:eB,classed:rB,text:lB,html:dB,raise:pB,lower:mB,append:OB,insert:yB,remove:bB,clone:wB,datum:kB,on:PB,dispatch:AB,[Symbol.iterator]:MB};function Bn(t){return typeof t=="string"?new Xn([[document.querySelector(t)]],[document.documentElement]):new Xn([[t]],tP)}function jB(t){let e;for(;e=t.sourceEvent;)t=e;return t}function pr(t,e){if(t=jB(t),e===void 0&&(e=t.currentTarget),e){var i=e.ownerSVGElement||e;if(i.createSVGPoint){var n=i.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const DB={passive:!1},Su={capture:!0,passive:!1};function tv(t){t.stopImmediatePropagation()}function nc(t){t.preventDefault(),t.stopImmediatePropagation()}function iP(t){var e=t.document.documentElement,i=Bn(t).on("dragstart.drag",nc,Su);"onselectstart"in e?i.on("selectstart.drag",nc,Su):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function nP(t,e){var i=t.document.documentElement,n=Bn(t).on("dragstart.drag",null);e&&(n.on("click.drag",nc,Su),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in i?n.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}const Nf=t=>()=>t;function xy(t,{sourceEvent:e,subject:i,target:n,identifier:r,active:s,x:a,y:c,dx:h,dy:d,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:f}})}xy.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function BB(t){return!t.ctrlKey&&!t.button}function LB(){return this.parentNode}function XB(t,e){return e??{x:t.x,y:t.y}}function NB(){return navigator.maxTouchPoints||"ontouchstart"in this}function rP(){var t=BB,e=LB,i=XB,n=NB,r={},s=em("start","drag","end"),a=0,c,h,d,f,g=0;function m(T){T.on("mousedown.drag",O).filter(n).on("touchstart.drag",w).on("touchmove.drag",x,DB).on("touchend.drag touchcancel.drag",Q).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function O(T,M){if(!(f||!t.call(this,T,M))){var $=k(this,e.call(this,T,M),T,M,"mouse");$&&(Bn(T.view).on("mousemove.drag",S,Su).on("mouseup.drag",_,Su),iP(T.view),tv(T),d=!1,c=T.clientX,h=T.clientY,$("start",T))}}function S(T){if(nc(T),!d){var M=T.clientX-c,$=T.clientY-h;d=M*M+$*$>g}r.mouse("drag",T)}function _(T){Bn(T.view).on("mousemove.drag mouseup.drag",null),nP(T.view,d),nc(T),r.mouse("end",T)}function w(T,M){if(t.call(this,T,M)){var $=T.changedTouches,R=e.call(this,T,M),V=$.length,H,ee;for(H=0;H<V;++H)(ee=k(this,R,T,M,$[H].identifier,$[H]))&&(tv(T),ee("start",T,$[H]))}}function x(T){var M=T.changedTouches,$=M.length,R,V;for(R=0;R<$;++R)(V=r[M[R].identifier])&&(nc(T),V("drag",T,M[R]))}function Q(T){var M=T.changedTouches,$=M.length,R,V;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),R=0;R<$;++R)(V=r[M[R].identifier])&&(tv(T),V("end",T,M[R]))}function k(T,M,$,R,V,H){var ee=s.copy(),I=pr(H||$,M),j,D,E;if((E=i.call(T,new xy("beforestart",{sourceEvent:$,target:m,identifier:V,active:a,x:I[0],y:I[1],dx:0,dy:0,dispatch:ee}),R))!=null)return j=E.x-I[0]||0,D=E.y-I[1]||0,function X(P,Z,L){var B=I,G;switch(P){case"start":r[V]=X,G=a++;break;case"end":delete r[V],--a;case"drag":I=pr(L||Z,M),G=a;break}ee.call(P,T,new xy(P,{sourceEvent:Z,subject:E,target:m,identifier:V,active:G,x:I[0]+j,y:I[1]+D,dx:I[0]-B[0],dy:I[1]-B[1],dispatch:ee}),R)}}return m.filter=function(T){return arguments.length?(t=typeof T=="function"?T:Nf(!!T),m):t},m.container=function(T){return arguments.length?(e=typeof T=="function"?T:Nf(T),m):e},m.subject=function(T){return arguments.length?(i=typeof T=="function"?T:Nf(T),m):i},m.touchable=function(T){return arguments.length?(n=typeof T=="function"?T:Nf(!!T),m):n},m.on=function(){var T=s.on.apply(s,arguments);return T===s?m:T},m.clickDistance=function(T){return arguments.length?(g=(T=+T)*T,m):Math.sqrt(g)},m}function w1(t,e,i){t.prototype=e.prototype=i,i.constructor=t}function sP(t,e){var i=Object.create(t.prototype);for(var n in e)i[n]=e[n];return i}function Ku(){}var bu=.7,rg=1/bu,rc="\\s*([+-]?\\d+)\\s*",_u="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Vr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ZB=/^#([0-9a-f]{3,8})$/,WB=new RegExp(`^rgb\\(${rc},${rc},${rc}\\)$`),qB=new RegExp(`^rgb\\(${Vr},${Vr},${Vr}\\)$`),VB=new RegExp(`^rgba\\(${rc},${rc},${rc},${_u}\\)$`),IB=new RegExp(`^rgba\\(${Vr},${Vr},${Vr},${_u}\\)$`),YB=new RegExp(`^hsl\\(${_u},${Vr},${Vr}\\)$`),HB=new RegExp(`^hsla\\(${_u},${Vr},${Vr},${_u}\\)$`),iC={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};w1(Ku,La,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:nC,formatHex:nC,formatHex8:UB,formatHsl:GB,formatRgb:rC,toString:rC});function nC(){return this.rgb().formatHex()}function UB(){return this.rgb().formatHex8()}function GB(){return oP(this).formatHsl()}function rC(){return this.rgb().formatRgb()}function La(t){var e,i;return t=(t+"").trim().toLowerCase(),(e=ZB.exec(t))?(i=e[1].length,e=parseInt(e[1],16),i===6?sC(e):i===3?new yn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):i===8?Zf(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):i===4?Zf(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=WB.exec(t))?new yn(e[1],e[2],e[3],1):(e=qB.exec(t))?new yn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=VB.exec(t))?Zf(e[1],e[2],e[3],e[4]):(e=IB.exec(t))?Zf(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=YB.exec(t))?lC(e[1],e[2]/100,e[3]/100,1):(e=HB.exec(t))?lC(e[1],e[2]/100,e[3]/100,e[4]):iC.hasOwnProperty(t)?sC(iC[t]):t==="transparent"?new yn(NaN,NaN,NaN,0):null}function sC(t){return new yn(t>>16&255,t>>8&255,t&255,1)}function Zf(t,e,i,n){return n<=0&&(t=e=i=NaN),new yn(t,e,i,n)}function FB(t){return t instanceof Ku||(t=La(t)),t?(t=t.rgb(),new yn(t.r,t.g,t.b,t.opacity)):new yn}function wy(t,e,i,n){return arguments.length===1?FB(t):new yn(t,e,i,n??1)}function yn(t,e,i,n){this.r=+t,this.g=+e,this.b=+i,this.opacity=+n}w1(yn,wy,sP(Ku,{brighter(t){return t=t==null?rg:Math.pow(rg,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?bu:Math.pow(bu,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new yn(Ma(this.r),Ma(this.g),Ma(this.b),sg(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oC,formatHex:oC,formatHex8:KB,formatRgb:aC,toString:aC}));function oC(){return`#${$a(this.r)}${$a(this.g)}${$a(this.b)}`}function KB(){return`#${$a(this.r)}${$a(this.g)}${$a(this.b)}${$a((isNaN(this.opacity)?1:this.opacity)*255)}`}function aC(){const t=sg(this.opacity);return`${t===1?"rgb(":"rgba("}${Ma(this.r)}, ${Ma(this.g)}, ${Ma(this.b)}${t===1?")":`, ${t})`}`}function sg(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ma(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function $a(t){return t=Ma(t),(t<16?"0":"")+t.toString(16)}function lC(t,e,i,n){return n<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new gr(t,e,i,n)}function oP(t){if(t instanceof gr)return new gr(t.h,t.s,t.l,t.opacity);if(t instanceof Ku||(t=La(t)),!t)return new gr;if(t instanceof gr)return t;t=t.rgb();var e=t.r/255,i=t.g/255,n=t.b/255,r=Math.min(e,i,n),s=Math.max(e,i,n),a=NaN,c=s-r,h=(s+r)/2;return c?(e===s?a=(i-n)/c+(i<n)*6:i===s?a=(n-e)/c+2:a=(e-i)/c+4,c/=h<.5?s+r:2-s-r,a*=60):c=h>0&&h<1?0:a,new gr(a,c,h,t.opacity)}function JB(t,e,i,n){return arguments.length===1?oP(t):new gr(t,e,i,n??1)}function gr(t,e,i,n){this.h=+t,this.s=+e,this.l=+i,this.opacity=+n}w1(gr,JB,sP(Ku,{brighter(t){return t=t==null?rg:Math.pow(rg,t),new gr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?bu:Math.pow(bu,t),new gr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,i=this.l,n=i+(i<.5?i:1-i)*e,r=2*i-n;return new yn(iv(t>=240?t-240:t+120,r,n),iv(t,r,n),iv(t<120?t+240:t-120,r,n),this.opacity)},clamp(){return new gr(cC(this.h),Wf(this.s),Wf(this.l),sg(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=sg(this.opacity);return`${t===1?"hsl(":"hsla("}${cC(this.h)}, ${Wf(this.s)*100}%, ${Wf(this.l)*100}%${t===1?")":`, ${t})`}`}}));function cC(t){return t=(t||0)%360,t<0?t+360:t}function Wf(t){return Math.max(0,Math.min(1,t||0))}function iv(t,e,i){return(t<60?e+(i-e)*t/60:t<180?i:t<240?e+(i-e)*(240-t)/60:e)*255}const k1=t=>()=>t;function e4(t,e){return function(i){return t+i*e}}function t4(t,e,i){return t=Math.pow(t,i),e=Math.pow(e,i)-t,i=1/i,function(n){return Math.pow(t+n*e,i)}}function i4(t){return(t=+t)==1?aP:function(e,i){return i-e?t4(e,i,t):k1(isNaN(e)?i:e)}}function aP(t,e){var i=e-t;return i?e4(t,i):k1(isNaN(t)?e:t)}const og=(function t(e){var i=i4(e);function n(r,s){var a=i((r=wy(r)).r,(s=wy(s)).r),c=i(r.g,s.g),h=i(r.b,s.b),d=aP(r.opacity,s.opacity);return function(f){return r.r=a(f),r.g=c(f),r.b=h(f),r.opacity=d(f),r+""}}return n.gamma=t,n})(1);function n4(t,e){e||(e=[]);var i=t?Math.min(e.length,t.length):0,n=e.slice(),r;return function(s){for(r=0;r<i;++r)n[r]=t[r]*(1-s)+e[r]*s;return n}}function r4(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function s4(t,e){var i=e?e.length:0,n=t?Math.min(i,t.length):0,r=new Array(n),s=new Array(i),a;for(a=0;a<n;++a)r[a]=cu(t[a],e[a]);for(;a<i;++a)s[a]=e[a];return function(c){for(a=0;a<n;++a)s[a]=r[a](c);return s}}function o4(t,e){var i=new Date;return t=+t,e=+e,function(n){return i.setTime(t*(1-n)+e*n),i}}function Dr(t,e){return t=+t,e=+e,function(i){return t*(1-i)+e*i}}function a4(t,e){var i={},n={},r;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in t?i[r]=cu(t[r],e[r]):n[r]=e[r];return function(s){for(r in i)n[r]=i[r](s);return n}}var ky=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,nv=new RegExp(ky.source,"g");function l4(t){return function(){return t}}function c4(t){return function(e){return t(e)+""}}function lP(t,e){var i=ky.lastIndex=nv.lastIndex=0,n,r,s,a=-1,c=[],h=[];for(t=t+"",e=e+"";(n=ky.exec(t))&&(r=nv.exec(e));)(s=r.index)>i&&(s=e.slice(i,s),c[a]?c[a]+=s:c[++a]=s),(n=n[0])===(r=r[0])?c[a]?c[a]+=r:c[++a]=r:(c[++a]=null,h.push({i:a,x:Dr(n,r)})),i=nv.lastIndex;return i<e.length&&(s=e.slice(i),c[a]?c[a]+=s:c[++a]=s),c.length<2?h[0]?c4(h[0].x):l4(e):(e=h.length,function(d){for(var f=0,g;f<e;++f)c[(g=h[f]).i]=g.x(d);return c.join("")})}function cu(t,e){var i=typeof e,n;return e==null||i==="boolean"?k1(e):(i==="number"?Dr:i==="string"?(n=La(e))?(e=n,og):lP:e instanceof La?og:e instanceof Date?o4:r4(e)?n4:Array.isArray(e)?s4:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?a4:Dr)(t,e)}var hC=180/Math.PI,Cy={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cP(t,e,i,n,r,s){var a,c,h;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(h=t*i+e*n)&&(i-=t*h,n-=e*h),(c=Math.sqrt(i*i+n*n))&&(i/=c,n/=c,h/=c),t*n<e*i&&(t=-t,e=-e,h=-h,a=-a),{translateX:r,translateY:s,rotate:Math.atan2(e,t)*hC,skewX:Math.atan(h)*hC,scaleX:a,scaleY:c}}var qf;function h4(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Cy:cP(e.a,e.b,e.c,e.d,e.e,e.f)}function u4(t){return t==null||(qf||(qf=document.createElementNS("http://www.w3.org/2000/svg","g")),qf.setAttribute("transform",t),!(t=qf.transform.baseVal.consolidate()))?Cy:(t=t.matrix,cP(t.a,t.b,t.c,t.d,t.e,t.f))}function hP(t,e,i,n){function r(d){return d.length?d.pop()+" ":""}function s(d,f,g,m,O,S){if(d!==g||f!==m){var _=O.push("translate(",null,e,null,i);S.push({i:_-4,x:Dr(d,g)},{i:_-2,x:Dr(f,m)})}else(g||m)&&O.push("translate("+g+e+m+i)}function a(d,f,g,m){d!==f?(d-f>180?f+=360:f-d>180&&(d+=360),m.push({i:g.push(r(g)+"rotate(",null,n)-2,x:Dr(d,f)})):f&&g.push(r(g)+"rotate("+f+n)}function c(d,f,g,m){d!==f?m.push({i:g.push(r(g)+"skewX(",null,n)-2,x:Dr(d,f)}):f&&g.push(r(g)+"skewX("+f+n)}function h(d,f,g,m,O,S){if(d!==g||f!==m){var _=O.push(r(O)+"scale(",null,",",null,")");S.push({i:_-4,x:Dr(d,g)},{i:_-2,x:Dr(f,m)})}else(g!==1||m!==1)&&O.push(r(O)+"scale("+g+","+m+")")}return function(d,f){var g=[],m=[];return d=t(d),f=t(f),s(d.translateX,d.translateY,f.translateX,f.translateY,g,m),a(d.rotate,f.rotate,g,m),c(d.skewX,f.skewX,g,m),h(d.scaleX,d.scaleY,f.scaleX,f.scaleY,g,m),d=f=null,function(O){for(var S=-1,_=m.length,w;++S<_;)g[(w=m[S]).i]=w.x(O);return g.join("")}}}var d4=hP(h4,"px, ","px)","deg)"),f4=hP(u4,", ",")",")"),p4=1e-12;function uC(t){return((t=Math.exp(t))+1/t)/2}function g4(t){return((t=Math.exp(t))-1/t)/2}function m4(t){return((t=Math.exp(2*t))-1)/(t+1)}const Rp=(function t(e,i,n){function r(s,a){var c=s[0],h=s[1],d=s[2],f=a[0],g=a[1],m=a[2],O=f-c,S=g-h,_=O*O+S*S,w,x;if(_<p4)x=Math.log(m/d)/e,w=function(R){return[c+R*O,h+R*S,d*Math.exp(e*R*x)]};else{var Q=Math.sqrt(_),k=(m*m-d*d+n*_)/(2*d*i*Q),T=(m*m-d*d-n*_)/(2*m*i*Q),M=Math.log(Math.sqrt(k*k+1)-k),$=Math.log(Math.sqrt(T*T+1)-T);x=($-M)/e,w=function(R){var V=R*x,H=uC(M),ee=d/(i*Q)*(H*m4(e*V+M)-g4(M));return[c+ee*O,h+ee*S,d*H/uC(e*V+M)]}}return w.duration=x*1e3*e/Math.SQRT2,w}return r.rho=function(s){var a=Math.max(.001,+s),c=a*a,h=c*c;return t(a,c,h)},r})(Math.SQRT2,2,4);var gc=0,Jh=0,Mh=0,uP=1e3,ag,eu,lg=0,Xa=0,im=0,xu=typeof performance=="object"&&performance.now?performance:Date,dP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function C1(){return Xa||(dP(O4),Xa=xu.now()+im)}function O4(){Xa=0}function cg(){this._call=this._time=this._next=null}cg.prototype=fP.prototype={constructor:cg,restart:function(t,e,i){if(typeof t!="function")throw new TypeError("callback is not a function");i=(i==null?C1():+i)+(e==null?0:+e),!this._next&&eu!==this&&(eu?eu._next=this:ag=this,eu=this),this._call=t,this._time=i,Ty()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ty())}};function fP(t,e,i){var n=new cg;return n.restart(t,e,i),n}function v4(){C1(),++gc;for(var t=ag,e;t;)(e=Xa-t._time)>=0&&t._call.call(void 0,e),t=t._next;--gc}function dC(){Xa=(lg=xu.now())+im,gc=Jh=0;try{v4()}finally{gc=0,S4(),Xa=0}}function y4(){var t=xu.now(),e=t-lg;e>uP&&(im-=e,lg=t)}function S4(){for(var t,e=ag,i,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(i=e._next,e._next=null,e=t?t._next=i:ag=i);eu=t,Ty(n)}function Ty(t){if(!gc){Jh&&(Jh=clearTimeout(Jh));var e=t-Xa;e>24?(t<1/0&&(Jh=setTimeout(dC,t-xu.now()-im)),Mh&&(Mh=clearInterval(Mh))):(Mh||(lg=xu.now(),Mh=setInterval(y4,uP)),gc=1,dP(dC))}}function fC(t,e,i){var n=new cg;return e=e==null?0:+e,n.restart(r=>{n.stop(),t(r+e)},e,i),n}var b4=em("start","end","cancel","interrupt"),_4=[],pP=0,pC=1,Qy=2,Ap=3,gC=4,$y=5,Mp=6;function nm(t,e,i,n,r,s){var a=t.__transition;if(!a)t.__transition={};else if(i in a)return;x4(t,i,{name:e,index:n,group:r,on:b4,tween:_4,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:pP})}function T1(t,e){var i=br(t,e);if(i.state>pP)throw new Error("too late; already scheduled");return i}function Fr(t,e){var i=br(t,e);if(i.state>Ap)throw new Error("too late; already running");return i}function br(t,e){var i=t.__transition;if(!i||!(i=i[e]))throw new Error("transition not found");return i}function x4(t,e,i){var n=t.__transition,r;n[e]=i,i.timer=fP(s,0,i.time);function s(d){i.state=pC,i.timer.restart(a,i.delay,i.time),i.delay<=d&&a(d-i.delay)}function a(d){var f,g,m,O;if(i.state!==pC)return h();for(f in n)if(O=n[f],O.name===i.name){if(O.state===Ap)return fC(a);O.state===gC?(O.state=Mp,O.timer.stop(),O.on.call("interrupt",t,t.__data__,O.index,O.group),delete n[f]):+f<e&&(O.state=Mp,O.timer.stop(),O.on.call("cancel",t,t.__data__,O.index,O.group),delete n[f])}if(fC(function(){i.state===Ap&&(i.state=gC,i.timer.restart(c,i.delay,i.time),c(d))}),i.state=Qy,i.on.call("start",t,t.__data__,i.index,i.group),i.state===Qy){for(i.state=Ap,r=new Array(m=i.tween.length),f=0,g=-1;f<m;++f)(O=i.tween[f].value.call(t,t.__data__,i.index,i.group))&&(r[++g]=O);r.length=g+1}}function c(d){for(var f=d<i.duration?i.ease.call(null,d/i.duration):(i.timer.restart(h),i.state=$y,1),g=-1,m=r.length;++g<m;)r[g].call(t,f);i.state===$y&&(i.on.call("end",t,t.__data__,i.index,i.group),h())}function h(){i.state=Mp,i.timer.stop(),delete n[e];for(var d in n)return;delete t.__transition}}function zp(t,e){var i=t.__transition,n,r,s=!0,a;if(i){e=e==null?null:e+"";for(a in i){if((n=i[a]).name!==e){s=!1;continue}r=n.state>Qy&&n.state<$y,n.state=Mp,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete i[a]}s&&delete t.__transition}}function w4(t){return this.each(function(){zp(this,t)})}function k4(t,e){var i,n;return function(){var r=Fr(this,t),s=r.tween;if(s!==i){n=i=s;for(var a=0,c=n.length;a<c;++a)if(n[a].name===e){n=n.slice(),n.splice(a,1);break}}r.tween=n}}function C4(t,e,i){var n,r;if(typeof i!="function")throw new Error;return function(){var s=Fr(this,t),a=s.tween;if(a!==n){r=(n=a).slice();for(var c={name:e,value:i},h=0,d=r.length;h<d;++h)if(r[h].name===e){r[h]=c;break}h===d&&r.push(c)}s.tween=r}}function T4(t,e){var i=this._id;if(t+="",arguments.length<2){for(var n=br(this.node(),i).tween,r=0,s=n.length,a;r<s;++r)if((a=n[r]).name===t)return a.value;return null}return this.each((e==null?k4:C4)(i,t,e))}function Q1(t,e,i){var n=t._id;return t.each(function(){var r=Fr(this,n);(r.value||(r.value={}))[e]=i.apply(this,arguments)}),function(r){return br(r,n).value[e]}}function gP(t,e){var i;return(typeof e=="number"?Dr:e instanceof La?og:(i=La(e))?(e=i,og):lP)(t,e)}function Q4(t){return function(){this.removeAttribute(t)}}function $4(t){return function(){this.removeAttributeNS(t.space,t.local)}}function P4(t,e,i){var n,r=i+"",s;return function(){var a=this.getAttribute(t);return a===r?null:a===n?s:s=e(n=a,i)}}function E4(t,e,i){var n,r=i+"",s;return function(){var a=this.getAttributeNS(t.space,t.local);return a===r?null:a===n?s:s=e(n=a,i)}}function R4(t,e,i){var n,r,s;return function(){var a,c=i(this),h;return c==null?void this.removeAttribute(t):(a=this.getAttribute(t),h=c+"",a===h?null:a===n&&h===r?s:(r=h,s=e(n=a,c)))}}function A4(t,e,i){var n,r,s;return function(){var a,c=i(this),h;return c==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),h=c+"",a===h?null:a===n&&h===r?s:(r=h,s=e(n=a,c)))}}function M4(t,e){var i=tm(t),n=i==="transform"?f4:gP;return this.attrTween(t,typeof e=="function"?(i.local?A4:R4)(i,n,Q1(this,"attr."+t,e)):e==null?(i.local?$4:Q4)(i):(i.local?E4:P4)(i,n,e))}function z4(t,e){return function(i){this.setAttribute(t,e.call(this,i))}}function j4(t,e){return function(i){this.setAttributeNS(t.space,t.local,e.call(this,i))}}function D4(t,e){var i,n;function r(){var s=e.apply(this,arguments);return s!==n&&(i=(n=s)&&j4(t,s)),i}return r._value=e,r}function B4(t,e){var i,n;function r(){var s=e.apply(this,arguments);return s!==n&&(i=(n=s)&&z4(t,s)),i}return r._value=e,r}function L4(t,e){var i="attr."+t;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;var n=tm(t);return this.tween(i,(n.local?D4:B4)(n,e))}function X4(t,e){return function(){T1(this,t).delay=+e.apply(this,arguments)}}function N4(t,e){return e=+e,function(){T1(this,t).delay=e}}function Z4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?X4:N4)(e,t)):br(this.node(),e).delay}function W4(t,e){return function(){Fr(this,t).duration=+e.apply(this,arguments)}}function q4(t,e){return e=+e,function(){Fr(this,t).duration=e}}function V4(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?W4:q4)(e,t)):br(this.node(),e).duration}function I4(t,e){if(typeof e!="function")throw new Error;return function(){Fr(this,t).ease=e}}function Y4(t){var e=this._id;return arguments.length?this.each(I4(e,t)):br(this.node(),e).ease}function H4(t,e){return function(){var i=e.apply(this,arguments);if(typeof i!="function")throw new Error;Fr(this,t).ease=i}}function U4(t){if(typeof t!="function")throw new Error;return this.each(H4(this._id,t))}function G4(t){typeof t!="function"&&(t=I$(t));for(var e=this._groups,i=e.length,n=new Array(i),r=0;r<i;++r)for(var s=e[r],a=s.length,c=n[r]=[],h,d=0;d<a;++d)(h=s[d])&&t.call(h,h.__data__,d,s)&&c.push(h);return new As(n,this._parents,this._name,this._id)}function F4(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,i=t._groups,n=e.length,r=i.length,s=Math.min(n,r),a=new Array(n),c=0;c<s;++c)for(var h=e[c],d=i[c],f=h.length,g=a[c]=new Array(f),m,O=0;O<f;++O)(m=h[O]||d[O])&&(g[O]=m);for(;c<n;++c)a[c]=e[c];return new As(a,this._parents,this._name,this._id)}function K4(t){return(t+"").trim().split(/^|\s+/).every(function(e){var i=e.indexOf(".");return i>=0&&(e=e.slice(0,i)),!e||e==="start"})}function J4(t,e,i){var n,r,s=K4(e)?T1:Fr;return function(){var a=s(this,t),c=a.on;c!==n&&(r=(n=c).copy()).on(e,i),a.on=r}}function eL(t,e){var i=this._id;return arguments.length<2?br(this.node(),i).on.on(t):this.each(J4(i,t,e))}function tL(t){return function(){var e=this.parentNode;for(var i in this.__transition)if(+i!==t)return;e&&e.removeChild(this)}}function iL(){return this.on("end.remove",tL(this._id))}function nL(t){var e=this._name,i=this._id;typeof t!="function"&&(t=_1(t));for(var n=this._groups,r=n.length,s=new Array(r),a=0;a<r;++a)for(var c=n[a],h=c.length,d=s[a]=new Array(h),f,g,m=0;m<h;++m)(f=c[m])&&(g=t.call(f,f.__data__,m,c))&&("__data__"in f&&(g.__data__=f.__data__),d[m]=g,nm(d[m],e,i,m,d,br(f,i)));return new As(s,this._parents,e,i)}function rL(t){var e=this._name,i=this._id;typeof t!="function"&&(t=V$(t));for(var n=this._groups,r=n.length,s=[],a=[],c=0;c<r;++c)for(var h=n[c],d=h.length,f,g=0;g<d;++g)if(f=h[g]){for(var m=t.call(f,f.__data__,g,h),O,S=br(f,i),_=0,w=m.length;_<w;++_)(O=m[_])&&nm(O,e,i,_,m,S);s.push(m),a.push(f)}return new As(s,a,e,i)}var sL=Fu.prototype.constructor;function oL(){return new sL(this._groups,this._parents)}function aL(t,e){var i,n,r;return function(){var s=pc(this,t),a=(this.style.removeProperty(t),pc(this,t));return s===a?null:s===i&&a===n?r:r=e(i=s,n=a)}}function mP(t){return function(){this.style.removeProperty(t)}}function lL(t,e,i){var n,r=i+"",s;return function(){var a=pc(this,t);return a===r?null:a===n?s:s=e(n=a,i)}}function cL(t,e,i){var n,r,s;return function(){var a=pc(this,t),c=i(this),h=c+"";return c==null&&(h=c=(this.style.removeProperty(t),pc(this,t))),a===h?null:a===n&&h===r?s:(r=h,s=e(n=a,c))}}function hL(t,e){var i,n,r,s="style."+e,a="end."+s,c;return function(){var h=Fr(this,t),d=h.on,f=h.value[s]==null?c||(c=mP(e)):void 0;(d!==i||r!==f)&&(n=(i=d).copy()).on(a,r=f),h.on=n}}function uL(t,e,i){var n=(t+="")=="transform"?d4:gP;return e==null?this.styleTween(t,aL(t,n)).on("end.style."+t,mP(t)):typeof e=="function"?this.styleTween(t,cL(t,n,Q1(this,"style."+t,e))).each(hL(this._id,t)):this.styleTween(t,lL(t,n,e),i).on("end.style."+t,null)}function dL(t,e,i){return function(n){this.style.setProperty(t,e.call(this,n),i)}}function fL(t,e,i){var n,r;function s(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&dL(t,a,i)),n}return s._value=e,s}function pL(t,e,i){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,fL(t,e,i??""))}function gL(t){return function(){this.textContent=t}}function mL(t){return function(){var e=t(this);this.textContent=e??""}}function OL(t){return this.tween("text",typeof t=="function"?mL(Q1(this,"text",t)):gL(t==null?"":t+""))}function vL(t){return function(e){this.textContent=t.call(this,e)}}function yL(t){var e,i;function n(){var r=t.apply(this,arguments);return r!==i&&(e=(i=r)&&vL(r)),e}return n._value=t,n}function SL(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,yL(t))}function bL(){for(var t=this._name,e=this._id,i=OP(),n=this._groups,r=n.length,s=0;s<r;++s)for(var a=n[s],c=a.length,h,d=0;d<c;++d)if(h=a[d]){var f=br(h,e);nm(h,t,i,d,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new As(n,this._parents,t,i)}function _L(){var t,e,i=this,n=i._id,r=i.size();return new Promise(function(s,a){var c={value:a},h={value:function(){--r===0&&s()}};i.each(function(){var d=Fr(this,n),f=d.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(c),e._.interrupt.push(c),e._.end.push(h)),d.on=e}),r===0&&s()})}var xL=0;function As(t,e,i,n){this._groups=t,this._parents=e,this._name=i,this._id=n}function OP(){return++xL}var ys=Fu.prototype;As.prototype={constructor:As,select:nL,selectAll:rL,selectChild:ys.selectChild,selectChildren:ys.selectChildren,filter:G4,merge:F4,selection:oL,transition:bL,call:ys.call,nodes:ys.nodes,node:ys.node,size:ys.size,empty:ys.empty,each:ys.each,on:eL,attr:M4,attrTween:L4,style:uL,styleTween:pL,text:OL,textTween:SL,remove:iL,tween:T4,delay:Z4,duration:V4,ease:Y4,easeVarying:U4,end:_L,[Symbol.iterator]:ys[Symbol.iterator]};function wL(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var kL={time:null,delay:0,duration:250,ease:wL};function CL(t,e){for(var i;!(i=t.__transition)||!(i=i[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return i}function TL(t){var e,i;t instanceof As?(e=t._id,t=t._name):(e=OP(),(i=kL).time=C1(),t=t==null?null:t+"");for(var n=this._groups,r=n.length,s=0;s<r;++s)for(var a=n[s],c=a.length,h,d=0;d<c;++d)(h=a[d])&&nm(h,t,e,d,a,i||CL(h,e));return new As(n,this._parents,t,e)}Fu.prototype.interrupt=w4;Fu.prototype.transition=TL;const Vf=t=>()=>t;function QL(t,{sourceEvent:e,target:i,transform:n,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:r}})}function $s(t,e,i){this.k=t,this.x=e,this.y=i}$s.prototype={constructor:$s,scale:function(t){return t===1?this:new $s(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new $s(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var rm=new $s(1,0,0);vP.prototype=$s.prototype;function vP(t){for(;!t.__zoom;)if(!(t=t.parentNode))return rm;return t.__zoom}function rv(t){t.stopImmediatePropagation()}function zh(t){t.preventDefault(),t.stopImmediatePropagation()}function $L(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function PL(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function mC(){return this.__zoom||rm}function EL(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function RL(){return navigator.maxTouchPoints||"ontouchstart"in this}function AL(t,e,i){var n=t.invertX(e[0][0])-i[0][0],r=t.invertX(e[1][0])-i[1][0],s=t.invertY(e[0][1])-i[0][1],a=t.invertY(e[1][1])-i[1][1];return t.translate(r>n?(n+r)/2:Math.min(0,n)||Math.max(0,r),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function yP(){var t=$L,e=PL,i=AL,n=EL,r=RL,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],c=250,h=Rp,d=em("start","zoom","end"),f,g,m,O=500,S=150,_=0,w=10;function x(E){E.property("__zoom",mC).on("wheel.zoom",V,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",ee).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(E,X,P,Z){var L=E.selection?E.selection():E;L.property("__zoom",mC),E!==L?M(E,X,P,Z):L.interrupt().each(function(){$(this,arguments).event(Z).start().zoom(null,typeof X=="function"?X.apply(this,arguments):X).end()})},x.scaleBy=function(E,X,P,Z){x.scaleTo(E,function(){var L=this.__zoom.k,B=typeof X=="function"?X.apply(this,arguments):X;return L*B},P,Z)},x.scaleTo=function(E,X,P,Z){x.transform(E,function(){var L=e.apply(this,arguments),B=this.__zoom,G=P==null?T(L):typeof P=="function"?P.apply(this,arguments):P,z=B.invert(G),q=typeof X=="function"?X.apply(this,arguments):X;return i(k(Q(B,q),G,z),L,a)},P,Z)},x.translateBy=function(E,X,P,Z){x.transform(E,function(){return i(this.__zoom.translate(typeof X=="function"?X.apply(this,arguments):X,typeof P=="function"?P.apply(this,arguments):P),e.apply(this,arguments),a)},null,Z)},x.translateTo=function(E,X,P,Z,L){x.transform(E,function(){var B=e.apply(this,arguments),G=this.__zoom,z=Z==null?T(B):typeof Z=="function"?Z.apply(this,arguments):Z;return i(rm.translate(z[0],z[1]).scale(G.k).translate(typeof X=="function"?-X.apply(this,arguments):-X,typeof P=="function"?-P.apply(this,arguments):-P),B,a)},Z,L)};function Q(E,X){return X=Math.max(s[0],Math.min(s[1],X)),X===E.k?E:new $s(X,E.x,E.y)}function k(E,X,P){var Z=X[0]-P[0]*E.k,L=X[1]-P[1]*E.k;return Z===E.x&&L===E.y?E:new $s(E.k,Z,L)}function T(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function M(E,X,P,Z){E.on("start.zoom",function(){$(this,arguments).event(Z).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(Z).end()}).tween("zoom",function(){var L=this,B=arguments,G=$(L,B).event(Z),z=e.apply(L,B),q=P==null?T(z):typeof P=="function"?P.apply(L,B):P,K=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),ie=L.__zoom,ce=typeof X=="function"?X.apply(L,B):X,de=h(ie.invert(q).concat(K/ie.k),ce.invert(q).concat(K/ce.k));return function(pe){if(pe===1)pe=ce;else{var fe=de(pe),ve=K/fe[2];pe=new $s(ve,q[0]-fe[0]*ve,q[1]-fe[1]*ve)}G.zoom(null,pe)}})}function $(E,X,P){return!P&&E.__zooming||new R(E,X)}function R(E,X){this.that=E,this.args=X,this.active=0,this.sourceEvent=null,this.extent=e.apply(E,X),this.taps=0}R.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,X){return this.mouse&&E!=="mouse"&&(this.mouse[1]=X.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=X.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=X.invert(this.touch1[0])),this.that.__zoom=X,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var X=Bn(this.that).datum();d.call(E,this.that,new QL(E,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:d}),X)}};function V(E,...X){if(!t.apply(this,arguments))return;var P=$(this,X).event(E),Z=this.__zoom,L=Math.max(s[0],Math.min(s[1],Z.k*Math.pow(2,n.apply(this,arguments)))),B=pr(E);if(P.wheel)(P.mouse[0][0]!==B[0]||P.mouse[0][1]!==B[1])&&(P.mouse[1]=Z.invert(P.mouse[0]=B)),clearTimeout(P.wheel);else{if(Z.k===L)return;P.mouse=[B,Z.invert(B)],zp(this),P.start()}zh(E),P.wheel=setTimeout(G,S),P.zoom("mouse",i(k(Q(Z,L),P.mouse[0],P.mouse[1]),P.extent,a));function G(){P.wheel=null,P.end()}}function H(E,...X){if(m||!t.apply(this,arguments))return;var P=E.currentTarget,Z=$(this,X,!0).event(E),L=Bn(E.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",K,!0),B=pr(E,P),G=E.clientX,z=E.clientY;iP(E.view),rv(E),Z.mouse=[B,this.__zoom.invert(B)],zp(this),Z.start();function q(ie){if(zh(ie),!Z.moved){var ce=ie.clientX-G,de=ie.clientY-z;Z.moved=ce*ce+de*de>_}Z.event(ie).zoom("mouse",i(k(Z.that.__zoom,Z.mouse[0]=pr(ie,P),Z.mouse[1]),Z.extent,a))}function K(ie){L.on("mousemove.zoom mouseup.zoom",null),nP(ie.view,Z.moved),zh(ie),Z.event(ie).end()}}function ee(E,...X){if(t.apply(this,arguments)){var P=this.__zoom,Z=pr(E.changedTouches?E.changedTouches[0]:E,this),L=P.invert(Z),B=P.k*(E.shiftKey?.5:2),G=i(k(Q(P,B),Z,L),e.apply(this,X),a);zh(E),c>0?Bn(this).transition().duration(c).call(M,G,Z,E):Bn(this).call(x.transform,G,Z,E)}}function I(E,...X){if(t.apply(this,arguments)){var P=E.touches,Z=P.length,L=$(this,X,E.changedTouches.length===Z).event(E),B,G,z,q;for(rv(E),G=0;G<Z;++G)z=P[G],q=pr(z,this),q=[q,this.__zoom.invert(q),z.identifier],L.touch0?!L.touch1&&L.touch0[2]!==q[2]&&(L.touch1=q,L.taps=0):(L.touch0=q,B=!0,L.taps=1+!!f);f&&(f=clearTimeout(f)),B&&(L.taps<2&&(g=q[0],f=setTimeout(function(){f=null},O)),zp(this),L.start())}}function j(E,...X){if(this.__zooming){var P=$(this,X).event(E),Z=E.changedTouches,L=Z.length,B,G,z,q;for(zh(E),B=0;B<L;++B)G=Z[B],z=pr(G,this),P.touch0&&P.touch0[2]===G.identifier?P.touch0[0]=z:P.touch1&&P.touch1[2]===G.identifier&&(P.touch1[0]=z);if(G=P.that.__zoom,P.touch1){var K=P.touch0[0],ie=P.touch0[1],ce=P.touch1[0],de=P.touch1[1],pe=(pe=ce[0]-K[0])*pe+(pe=ce[1]-K[1])*pe,fe=(fe=de[0]-ie[0])*fe+(fe=de[1]-ie[1])*fe;G=Q(G,Math.sqrt(pe/fe)),z=[(K[0]+ce[0])/2,(K[1]+ce[1])/2],q=[(ie[0]+de[0])/2,(ie[1]+de[1])/2]}else if(P.touch0)z=P.touch0[0],q=P.touch0[1];else return;P.zoom("touch",i(k(G,z,q),P.extent,a))}}function D(E,...X){if(this.__zooming){var P=$(this,X).event(E),Z=E.changedTouches,L=Z.length,B,G;for(rv(E),m&&clearTimeout(m),m=setTimeout(function(){m=null},O),B=0;B<L;++B)G=Z[B],P.touch0&&P.touch0[2]===G.identifier?delete P.touch0:P.touch1&&P.touch1[2]===G.identifier&&delete P.touch1;if(P.touch1&&!P.touch0&&(P.touch0=P.touch1,delete P.touch1),P.touch0)P.touch0[1]=this.__zoom.invert(P.touch0[0]);else if(P.end(),P.taps===2&&(G=pr(G,this),Math.hypot(g[0]-G[0],g[1]-G[1])<w)){var z=Bn(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return x.wheelDelta=function(E){return arguments.length?(n=typeof E=="function"?E:Vf(+E),x):n},x.filter=function(E){return arguments.length?(t=typeof E=="function"?E:Vf(!!E),x):t},x.touchable=function(E){return arguments.length?(r=typeof E=="function"?E:Vf(!!E),x):r},x.extent=function(E){return arguments.length?(e=typeof E=="function"?E:Vf([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),x):e},x.scaleExtent=function(E){return arguments.length?(s[0]=+E[0],s[1]=+E[1],x):[s[0],s[1]]},x.translateExtent=function(E){return arguments.length?(a[0][0]=+E[0][0],a[1][0]=+E[1][0],a[0][1]=+E[0][1],a[1][1]=+E[1][1],x):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},x.constrain=function(E){return arguments.length?(i=E,x):i},x.duration=function(E){return arguments.length?(c=+E,x):c},x.interpolate=function(E){return arguments.length?(h=E,x):h},x.on=function(){var E=d.on.apply(d,arguments);return E===d?x:E},x.clickDistance=function(E){return arguments.length?(_=(E=+E)*E,x):Math.sqrt(_)},x.tapDistance=function(E){return arguments.length?(w=+E,x):w},x}const Ur={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:i,targetHandle:n})=>`Couldn't create edge for ${t} handle id: "${t==="source"?i:n}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},wu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],SP=["Enter"," ","Escape"],bP={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:i})=>`Moved selected node ${t}. New position, x: ${e}, y: ${i}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var mc;(function(t){t.Strict="strict",t.Loose="loose"})(mc||(mc={}));var za;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(za||(za={}));var ku;(function(t){t.Partial="partial",t.Full="full"})(ku||(ku={}));const _P={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Eo;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Eo||(Eo={}));var hg;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(hg||(hg={}));var Re;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Re||(Re={}));const OC={[Re.Left]:Re.Right,[Re.Right]:Re.Left,[Re.Top]:Re.Bottom,[Re.Bottom]:Re.Top};function xP(t){return t===null?null:t?"valid":"invalid"}const wP=t=>"id"in t&&"source"in t&&"target"in t,ML=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),$1=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),Ju=(t,e=[0,0])=>{const{width:i,height:n}=Ds(t),r=t.origin??e,s=i*r[0],a=n*r[1];return{x:t.position.x-s,y:t.position.y-a}},zL=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const i=t.reduce((n,r)=>{const s=typeof r=="string";let a=!e.nodeLookup&&!s?r:void 0;e.nodeLookup&&(a=s?e.nodeLookup.get(r):$1(r)?r:e.nodeLookup.get(r.id));const c=a?ug(a,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return sm(n,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return om(i)},ed=(t,e={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},n=!1;return t.forEach(r=>{(e.filter===void 0||e.filter(r))&&(i=sm(i,ug(r)),n=!0)}),n?om(i):{x:0,y:0,width:0,height:0}},P1=(t,e,[i,n,r]=[0,0,1],s=!1,a=!1)=>{const c={...id(e,[i,n,r]),width:e.width/r,height:e.height/r},h=[];for(const d of t.values()){const{measured:f,selectable:g=!0,hidden:m=!1}=d;if(a&&!g||m)continue;const O=f.width??d.width??d.initialWidth??null,S=f.height??d.height??d.initialHeight??null,_=Cu(c,vc(d)),w=(O??0)*(S??0),x=s&&_>0;(!d.internals.handleBounds||x||_>=w||d.dragging)&&h.push(d)}return h},jL=(t,e)=>{const i=new Set;return t.forEach(n=>{i.add(n.id)}),e.filter(n=>i.has(n.source)||i.has(n.target))};function DL(t,e){const i=new Map,n=e!=null&&e.nodes?new Set(e.nodes.map(r=>r.id)):null;return t.forEach(r=>{r.measured.width&&r.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!r.hidden)&&(!n||n.has(r.id))&&i.set(r.id,r)}),i}async function BL({nodes:t,width:e,height:i,panZoom:n,minZoom:r,maxZoom:s},a){if(t.size===0)return Promise.resolve(!0);const c=DL(t,a),h=ed(c),d=E1(h,e,i,(a==null?void 0:a.minZoom)??r,(a==null?void 0:a.maxZoom)??s,(a==null?void 0:a.padding)??.1);return await n.setViewport(d,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)}function kP({nodeId:t,nextPosition:e,nodeLookup:i,nodeOrigin:n=[0,0],nodeExtent:r,onError:s}){const a=i.get(t),c=a.parentId?i.get(a.parentId):void 0,{x:h,y:d}=c?c.internals.positionAbsolute:{x:0,y:0},f=a.origin??n;let g=a.extent||r;if(a.extent==="parent"&&!a.expandParent)if(!c)s==null||s("005",Ur.error005());else{const O=c.measured.width,S=c.measured.height;O&&S&&(g=[[h,d],[h+O,d+S]])}else c&&yc(a.extent)&&(g=[[a.extent[0][0]+h,a.extent[0][1]+d],[a.extent[1][0]+h,a.extent[1][1]+d]]);const m=yc(g)?Na(e,g,a.measured):e;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",Ur.error015())),{position:{x:m.x-h+(a.measured.width??0)*f[0],y:m.y-d+(a.measured.height??0)*f[1]},positionAbsolute:m}}async function LL({nodesToRemove:t=[],edgesToRemove:e=[],nodes:i,edges:n,onBeforeDelete:r}){const s=new Set(t.map(m=>m.id)),a=[];for(const m of i){if(m.deletable===!1)continue;const O=s.has(m.id),S=!O&&m.parentId&&a.find(_=>_.id===m.parentId);(O||S)&&a.push(m)}const c=new Set(e.map(m=>m.id)),h=n.filter(m=>m.deletable!==!1),f=jL(a,h);for(const m of h)c.has(m.id)&&!f.find(S=>S.id===m.id)&&f.push(m);if(!r)return{edges:f,nodes:a};const g=await r({nodes:a,edges:f});return typeof g=="boolean"?g?{edges:f,nodes:a}:{edges:[],nodes:[]}:g}const Oc=(t,e=0,i=1)=>Math.min(Math.max(t,e),i),Na=(t={x:0,y:0},e,i)=>({x:Oc(t.x,e[0][0],e[1][0]-((i==null?void 0:i.width)??0)),y:Oc(t.y,e[0][1],e[1][1]-((i==null?void 0:i.height)??0))});function CP(t,e,i){const{width:n,height:r}=Ds(i),{x:s,y:a}=i.internals.positionAbsolute;return Na(t,[[s,a],[s+n,a+r]],e)}const vC=(t,e,i)=>t<e?Oc(Math.abs(t-e),1,e)/e:t>i?-Oc(Math.abs(t-i),1,e)/e:0,TP=(t,e,i=15,n=40)=>{const r=vC(t.x,n,e.width-n)*i,s=vC(t.y,n,e.height-n)*i;return[r,s]},sm=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Py=({x:t,y:e,width:i,height:n})=>({x:t,y:e,x2:t+i,y2:e+n}),om=({x:t,y:e,x2:i,y2:n})=>({x:t,y:e,width:i-t,height:n-e}),vc=(t,e=[0,0])=>{var r,s;const{x:i,y:n}=$1(t)?t.internals.positionAbsolute:Ju(t,e);return{x:i,y:n,width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((s=t.measured)==null?void 0:s.height)??t.height??t.initialHeight??0}},ug=(t,e=[0,0])=>{var r,s;const{x:i,y:n}=$1(t)?t.internals.positionAbsolute:Ju(t,e);return{x:i,y:n,x2:i+(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0),y2:n+(((s=t.measured)==null?void 0:s.height)??t.height??t.initialHeight??0)}},QP=(t,e)=>om(sm(Py(t),Py(e))),Cu=(t,e)=>{const i=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),n=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(i*n)},yC=t=>Or(t.width)&&Or(t.height)&&Or(t.x)&&Or(t.y),Or=t=>!isNaN(t)&&isFinite(t),XL=(t,e)=>{},td=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),id=({x:t,y:e},[i,n,r],s=!1,a=[1,1])=>{const c={x:(t-i)/r,y:(e-n)/r};return s?td(c,a):c},dg=({x:t,y:e},[i,n,r])=>({x:t*r+i,y:e*r+n});function Nl(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const i=parseFloat(t);if(!Number.isNaN(i))return Math.floor(i)}if(typeof t=="string"&&t.endsWith("%")){const i=parseFloat(t);if(!Number.isNaN(i))return Math.floor(e*i*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function NL(t,e,i){if(typeof t=="string"||typeof t=="number"){const n=Nl(t,i),r=Nl(t,e);return{top:n,right:r,bottom:n,left:r,x:r*2,y:n*2}}if(typeof t=="object"){const n=Nl(t.top??t.y??0,i),r=Nl(t.bottom??t.y??0,i),s=Nl(t.left??t.x??0,e),a=Nl(t.right??t.x??0,e);return{top:n,right:a,bottom:r,left:s,x:s+a,y:n+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ZL(t,e,i,n,r,s){const{x:a,y:c}=dg(t,[e,i,n]),{x:h,y:d}=dg({x:t.x+t.width,y:t.y+t.height},[e,i,n]),f=r-h,g=s-d;return{left:Math.floor(a),top:Math.floor(c),right:Math.floor(f),bottom:Math.floor(g)}}const E1=(t,e,i,n,r,s)=>{const a=NL(s,e,i),c=(e-a.x)/t.width,h=(i-a.y)/t.height,d=Math.min(c,h),f=Oc(d,n,r),g=t.x+t.width/2,m=t.y+t.height/2,O=e/2-g*f,S=i/2-m*f,_=ZL(t,O,S,f,e,i),w={left:Math.min(_.left-a.left,0),top:Math.min(_.top-a.top,0),right:Math.min(_.right-a.right,0),bottom:Math.min(_.bottom-a.bottom,0)};return{x:O-w.left+w.right,y:S-w.top+w.bottom,zoom:f}},Tu=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function yc(t){return t!=null&&t!=="parent"}function Ds(t){var e,i;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}}function $P(t){var e,i;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight)!==void 0}function PP(t,e={width:0,height:0},i,n,r){const s={...t},a=n.get(i);if(a){const c=a.origin||r;s.x+=a.internals.positionAbsolute.x-(e.width??0)*c[0],s.y+=a.internals.positionAbsolute.y-(e.height??0)*c[1]}return s}function SC(t,e){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}function WL(){let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}}function qL(t){return{...bP,...t||{}}}function hu(t,{snapGrid:e=[0,0],snapToGrid:i=!1,transform:n,containerBounds:r}){const{x:s,y:a}=vr(t),c=id({x:s-((r==null?void 0:r.left)??0),y:a-((r==null?void 0:r.top)??0)},n),{x:h,y:d}=i?td(c,e):c;return{xSnapped:h,ySnapped:d,...c}}const R1=t=>({width:t.offsetWidth,height:t.offsetHeight}),EP=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},VL=["INPUT","SELECT","TEXTAREA"];function RP(t){var n,r;const e=((r=(n=t.composedPath)==null?void 0:n.call(t))==null?void 0:r[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:VL.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const AP=t=>"clientX"in t,vr=(t,e)=>{var s,a;const i=AP(t),n=i?t.clientX:(s=t.touches)==null?void 0:s[0].clientX,r=i?t.clientY:(a=t.touches)==null?void 0:a[0].clientY;return{x:n-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},bC=(t,e,i,n,r)=>{const s=e.querySelectorAll(`.${t}`);return!s||!s.length?null:Array.from(s).map(a=>{const c=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:t,nodeId:r,position:a.getAttribute("data-handlepos"),x:(c.left-i.left)/n,y:(c.top-i.top)/n,...R1(a)}})};function MP({sourceX:t,sourceY:e,targetX:i,targetY:n,sourceControlX:r,sourceControlY:s,targetControlX:a,targetControlY:c}){const h=t*.125+r*.375+a*.375+i*.125,d=e*.125+s*.375+c*.375+n*.125,f=Math.abs(h-t),g=Math.abs(d-e);return[h,d,f,g]}function If(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function _C({pos:t,x1:e,y1:i,x2:n,y2:r,c:s}){switch(t){case Re.Left:return[e-If(e-n,s),i];case Re.Right:return[e+If(n-e,s),i];case Re.Top:return[e,i-If(i-r,s)];case Re.Bottom:return[e,i+If(r-i,s)]}}function zP({sourceX:t,sourceY:e,sourcePosition:i=Re.Bottom,targetX:n,targetY:r,targetPosition:s=Re.Top,curvature:a=.25}){const[c,h]=_C({pos:i,x1:t,y1:e,x2:n,y2:r,c:a}),[d,f]=_C({pos:s,x1:n,y1:r,x2:t,y2:e,c:a}),[g,m,O,S]=MP({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:c,sourceControlY:h,targetControlX:d,targetControlY:f});return[`M${t},${e} C${c},${h} ${d},${f} ${n},${r}`,g,m,O,S]}function jP({sourceX:t,sourceY:e,targetX:i,targetY:n}){const r=Math.abs(i-t)/2,s=i<t?i+r:i-r,a=Math.abs(n-e)/2,c=n<e?n+a:n-a;return[s,c,r,a]}function IL({sourceNode:t,targetNode:e,selected:i=!1,zIndex:n=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return n;const a=r&&i?n+1e3:n,c=Math.max(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0);return a+c}function YL({sourceNode:t,targetNode:e,width:i,height:n,transform:r}){const s=sm(ug(t),ug(e));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const a={x:-r[0]/r[2],y:-r[1]/r[2],width:i/r[2],height:n/r[2]};return Cu(a,om(s))>0}const HL=({source:t,sourceHandle:e,target:i,targetHandle:n})=>`xy-edge__${t}${e||""}-${i}${n||""}`,UL=(t,e)=>e.some(i=>i.source===t.source&&i.target===t.target&&(i.sourceHandle===t.sourceHandle||!i.sourceHandle&&!t.sourceHandle)&&(i.targetHandle===t.targetHandle||!i.targetHandle&&!t.targetHandle)),GL=(t,e,i={})=>{if(!t.source||!t.target)return e;const n=i.getEdgeId||HL;let r;return wP(t)?r={...t}:r={...t,id:n(t)},UL(r,e)?e:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,e.concat(r))};function DP({sourceX:t,sourceY:e,targetX:i,targetY:n}){const[r,s,a,c]=jP({sourceX:t,sourceY:e,targetX:i,targetY:n});return[`M ${t},${e}L ${i},${n}`,r,s,a,c]}const xC={[Re.Left]:{x:-1,y:0},[Re.Right]:{x:1,y:0},[Re.Top]:{x:0,y:-1},[Re.Bottom]:{x:0,y:1}},FL=({source:t,sourcePosition:e=Re.Bottom,target:i})=>e===Re.Left||e===Re.Right?t.x<i.x?{x:1,y:0}:{x:-1,y:0}:t.y<i.y?{x:0,y:1}:{x:0,y:-1},wC=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function KL({source:t,sourcePosition:e=Re.Bottom,target:i,targetPosition:n=Re.Top,center:r,offset:s,stepPosition:a}){const c=xC[e],h=xC[n],d={x:t.x+c.x*s,y:t.y+c.y*s},f={x:i.x+h.x*s,y:i.y+h.y*s},g=FL({source:d,sourcePosition:e,target:f}),m=g.x!==0?"x":"y",O=g[m];let S=[],_,w;const x={x:0,y:0},Q={x:0,y:0},[,,k,T]=jP({sourceX:t.x,sourceY:t.y,targetX:i.x,targetY:i.y});if(c[m]*h[m]===-1){m==="x"?(_=r.x??d.x+(f.x-d.x)*a,w=r.y??(d.y+f.y)/2):(_=r.x??(d.x+f.x)/2,w=r.y??d.y+(f.y-d.y)*a);const V=[{x:_,y:d.y},{x:_,y:f.y}],H=[{x:d.x,y:w},{x:f.x,y:w}];c[m]===O?S=m==="x"?V:H:S=m==="x"?H:V}else{const V=[{x:d.x,y:f.y}],H=[{x:f.x,y:d.y}];if(m==="x"?S=c.x===O?H:V:S=c.y===O?V:H,e===n){const E=Math.abs(t[m]-i[m]);if(E<=s){const X=Math.min(s-1,s-E);c[m]===O?x[m]=(d[m]>t[m]?-1:1)*X:Q[m]=(f[m]>i[m]?-1:1)*X}}if(e!==n){const E=m==="x"?"y":"x",X=c[m]===h[E],P=d[E]>f[E],Z=d[E]<f[E];(c[m]===1&&(!X&&P||X&&Z)||c[m]!==1&&(!X&&Z||X&&P))&&(S=m==="x"?V:H)}const ee={x:d.x+x.x,y:d.y+x.y},I={x:f.x+Q.x,y:f.y+Q.y},j=Math.max(Math.abs(ee.x-S[0].x),Math.abs(I.x-S[0].x)),D=Math.max(Math.abs(ee.y-S[0].y),Math.abs(I.y-S[0].y));j>=D?(_=(ee.x+I.x)/2,w=S[0].y):(_=S[0].x,w=(ee.y+I.y)/2)}const M={x:d.x+x.x,y:d.y+x.y},$={x:f.x+Q.x,y:f.y+Q.y};return[[t,...M.x!==S[0].x||M.y!==S[0].y?[M]:[],...S,...$.x!==S[S.length-1].x||$.y!==S[S.length-1].y?[$]:[],i],_,w,k,T]}function JL(t,e,i,n){const r=Math.min(wC(t,e)/2,wC(e,i)/2,n),{x:s,y:a}=e;if(t.x===s&&s===i.x||t.y===a&&a===i.y)return`L${s} ${a}`;if(t.y===a){const d=t.x<i.x?-1:1,f=t.y<i.y?1:-1;return`L ${s+r*d},${a}Q ${s},${a} ${s},${a+r*f}`}const c=t.x<i.x?1:-1,h=t.y<i.y?-1:1;return`L ${s},${a+r*h}Q ${s},${a} ${s+r*c},${a}`}function Ey({sourceX:t,sourceY:e,sourcePosition:i=Re.Bottom,targetX:n,targetY:r,targetPosition:s=Re.Top,borderRadius:a=5,centerX:c,centerY:h,offset:d=20,stepPosition:f=.5}){const[g,m,O,S,_]=KL({source:{x:t,y:e},sourcePosition:i,target:{x:n,y:r},targetPosition:s,center:{x:c,y:h},offset:d,stepPosition:f});let w=`M${g[0].x} ${g[0].y}`;for(let x=1;x<g.length-1;x++)w+=JL(g[x-1],g[x],g[x+1],a);return w+=`L${g[g.length-1].x} ${g[g.length-1].y}`,[w,m,O,S,_]}function kC(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function e6(t){var g;const{sourceNode:e,targetNode:i}=t;if(!kC(e)||!kC(i))return null;const n=e.internals.handleBounds||CC(e.handles),r=i.internals.handleBounds||CC(i.handles),s=TC((n==null?void 0:n.source)??[],t.sourceHandle),a=TC(t.connectionMode===mc.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),t.targetHandle);if(!s||!a)return(g=t.onError)==null||g.call(t,"008",Ur.error008(s?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const c=(s==null?void 0:s.position)||Re.Bottom,h=(a==null?void 0:a.position)||Re.Top,d=Za(e,s,c),f=Za(i,a,h);return{sourceX:d.x,sourceY:d.y,targetX:f.x,targetY:f.y,sourcePosition:c,targetPosition:h}}function CC(t){if(!t)return null;const e=[],i=[];for(const n of t)n.width=n.width??1,n.height=n.height??1,n.type==="source"?e.push(n):n.type==="target"&&i.push(n);return{source:e,target:i}}function Za(t,e,i=Re.Left,n=!1){const r=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,s=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:a,height:c}=e??Ds(t);if(n)return{x:r+a/2,y:s+c/2};switch((e==null?void 0:e.position)??i){case Re.Top:return{x:r+a/2,y:s};case Re.Right:return{x:r+a,y:s+c/2};case Re.Bottom:return{x:r+a/2,y:s+c};case Re.Left:return{x:r,y:s+c/2}}}function TC(t,e){return t&&(e?t.find(i=>i.id===e):t[0])||null}function Ry(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(n=>`${n}=${t[n]}`).join("&")}`:""}function t6(t,{id:e,defaultColor:i,defaultMarkerStart:n,defaultMarkerEnd:r}){const s=new Set;return t.reduce((a,c)=>([c.markerStart||n,c.markerEnd||r].forEach(h=>{if(h&&typeof h=="object"){const d=Ry(h,e);s.has(d)||(a.push({id:d,color:h.color||i,...h}),s.add(d))}}),a),[]).sort((a,c)=>a.id.localeCompare(c.id))}const BP=1e3,i6=10,A1={nodeOrigin:[0,0],nodeExtent:wu,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},n6={...A1,checkEquality:!0};function M1(t,e){const i={...t};for(const n in e)e[n]!==void 0&&(i[n]=e[n]);return i}function r6(t,e,i){const n=M1(A1,i);for(const r of t.values())if(r.parentId)j1(r,t,e,n);else{const s=Ju(r,n.nodeOrigin),a=yc(r.extent)?r.extent:n.nodeExtent,c=Na(s,a,Ds(r));r.internals.positionAbsolute=c}}function s6(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const i=[],n=[];for(const r of t.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:t.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?i.push(s):r.type==="target"&&n.push(s)}return{source:i,target:n}}function z1(t){return t==="manual"}function Ay(t,e,i,n={}){var f,g;const r=M1(n6,n),s={i:0},a=new Map(e),c=r!=null&&r.elevateNodesOnSelect&&!z1(r.zIndexMode)?BP:0;let h=t.length>0,d=!1;e.clear(),i.clear();for(const m of t){let O=a.get(m.id);if(r.checkEquality&&m===(O==null?void 0:O.internals.userNode))e.set(m.id,O);else{const S=Ju(m,r.nodeOrigin),_=yc(m.extent)?m.extent:r.nodeExtent,w=Na(S,_,Ds(m));O={...r.defaults,...m,measured:{width:(f=m.measured)==null?void 0:f.width,height:(g=m.measured)==null?void 0:g.height},internals:{positionAbsolute:w,handleBounds:s6(m,O),z:LP(m,c,r.zIndexMode),userNode:m}},e.set(m.id,O)}(O.measured===void 0||O.measured.width===void 0||O.measured.height===void 0)&&!O.hidden&&(h=!1),m.parentId&&j1(O,e,i,n,s),d||(d=m.selected??!1)}return{nodesInitialized:h,hasSelectedNodes:d}}function o6(t,e){if(!t.parentId)return;const i=e.get(t.parentId);i?i.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function j1(t,e,i,n,r){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:c,zIndexMode:h}=M1(A1,n),d=t.parentId,f=e.get(d);if(!f){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}o6(t,i),r&&!f.parentId&&f.internals.rootParentIndex===void 0&&h==="auto"&&(f.internals.rootParentIndex=++r.i,f.internals.z=f.internals.z+r.i*i6),r&&f.internals.rootParentIndex!==void 0&&(r.i=f.internals.rootParentIndex);const g=s&&!z1(h)?BP:0,{x:m,y:O,z:S}=a6(t,f,a,c,g,h),{positionAbsolute:_}=t.internals,w=m!==_.x||O!==_.y;(w||S!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:w?{x:m,y:O}:_,z:S}})}function LP(t,e,i){const n=Or(t.zIndex)?t.zIndex:0;return z1(i)?n:n+(t.selected?e:0)}function a6(t,e,i,n,r,s){const{x:a,y:c}=e.internals.positionAbsolute,h=Ds(t),d=Ju(t,i),f=yc(t.extent)?Na(d,t.extent,h):d;let g=Na({x:a+f.x,y:c+f.y},n,h);t.extent==="parent"&&(g=CP(g,h,e));const m=LP(t,r,s),O=e.internals.z??0;return{x:g.x,y:g.y,z:O>=m?O+1:m}}function D1(t,e,i,n=[0,0]){var a;const r=[],s=new Map;for(const c of t){const h=e.get(c.parentId);if(!h)continue;const d=((a=s.get(c.parentId))==null?void 0:a.expandedRect)??vc(h),f=QP(d,c.rect);s.set(c.parentId,{expandedRect:f,parent:h})}return s.size>0&&s.forEach(({expandedRect:c,parent:h},d)=>{var k;const f=h.internals.positionAbsolute,g=Ds(h),m=h.origin??n,O=c.x<f.x?Math.round(Math.abs(f.x-c.x)):0,S=c.y<f.y?Math.round(Math.abs(f.y-c.y)):0,_=Math.max(g.width,Math.round(c.width)),w=Math.max(g.height,Math.round(c.height)),x=(_-g.width)*m[0],Q=(w-g.height)*m[1];(O>0||S>0||x||Q)&&(r.push({id:d,type:"position",position:{x:h.position.x-O+x,y:h.position.y-S+Q}}),(k=i.get(d))==null||k.forEach(T=>{t.some(M=>M.id===T.id)||r.push({id:T.id,type:"position",position:{x:T.position.x+O,y:T.position.y+S}})})),(g.width<c.width||g.height<c.height||O||S)&&r.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:_+(O?m[0]*O-x:0),height:w+(S?m[1]*S-Q:0)}})}),r}function l6(t,e,i,n,r,s,a){const c=n==null?void 0:n.querySelector(".xyflow__viewport");let h=!1;if(!c)return{changes:[],updatedInternals:h};const d=[],f=window.getComputedStyle(c),{m22:g}=new window.DOMMatrixReadOnly(f.transform),m=[];for(const O of t.values()){const S=e.get(O.id);if(!S)continue;if(S.hidden){e.set(S.id,{...S,internals:{...S.internals,handleBounds:void 0}}),h=!0;continue}const _=R1(O.nodeElement),w=S.measured.width!==_.width||S.measured.height!==_.height;if(!!(_.width&&_.height&&(w||!S.internals.handleBounds||O.force))){const Q=O.nodeElement.getBoundingClientRect(),k=yc(S.extent)?S.extent:s;let{positionAbsolute:T}=S.internals;S.parentId&&S.extent==="parent"?T=CP(T,_,e.get(S.parentId)):k&&(T=Na(T,k,_));const M={...S,measured:_,internals:{...S.internals,positionAbsolute:T,handleBounds:{source:bC("source",O.nodeElement,Q,g,S.id),target:bC("target",O.nodeElement,Q,g,S.id)}}};e.set(S.id,M),S.parentId&&j1(M,e,i,{nodeOrigin:r,zIndexMode:a}),h=!0,w&&(d.push({id:S.id,type:"dimensions",dimensions:_}),S.expandParent&&S.parentId&&m.push({id:S.id,parentId:S.parentId,rect:vc(M,r)}))}}if(m.length>0){const O=D1(m,e,i,r);d.push(...O)}return{changes:d,updatedInternals:h}}async function c6({delta:t,panZoom:e,transform:i,translateExtent:n,width:r,height:s}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const a=await e.setViewportConstrained({x:i[0]+t.x,y:i[1]+t.y,zoom:i[2]},[[0,0],[r,s]],n),c=!!a&&(a.x!==i[0]||a.y!==i[1]||a.k!==i[2]);return Promise.resolve(c)}function QC(t,e,i,n,r,s){let a=r;const c=n.get(a)||new Map;n.set(a,c.set(i,e)),a=`${r}-${t}`;const h=n.get(a)||new Map;if(n.set(a,h.set(i,e)),s){a=`${r}-${t}-${s}`;const d=n.get(a)||new Map;n.set(a,d.set(i,e))}}function XP(t,e,i){t.clear(),e.clear();for(const n of i){const{source:r,target:s,sourceHandle:a=null,targetHandle:c=null}=n,h={edgeId:n.id,source:r,target:s,sourceHandle:a,targetHandle:c},d=`${r}-${a}--${s}-${c}`,f=`${s}-${c}--${r}-${a}`;QC("source",h,f,t,r,a),QC("target",h,d,t,s,c),e.set(n.id,n)}}function NP(t,e){if(!t.parentId)return!1;const i=e.get(t.parentId);return i?i.selected?!0:NP(i,e):!1}function $C(t,e,i){var r;let n=t;do{if((r=n==null?void 0:n.matches)!=null&&r.call(n,e))return!0;if(n===i)return!1;n=n==null?void 0:n.parentElement}while(n);return!1}function h6(t,e,i,n){const r=new Map;for(const[s,a]of t)if((a.selected||a.id===n)&&(!a.parentId||!NP(a,t))&&(a.draggable||e&&typeof a.draggable>"u")){const c=t.get(s);c&&r.set(s,{id:s,position:c.position||{x:0,y:0},distance:{x:i.x-c.internals.positionAbsolute.x,y:i.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return r}function sv({nodeId:t,dragItems:e,nodeLookup:i,dragging:n=!0}){var a,c,h;const r=[];for(const[d,f]of e){const g=(a=i.get(d))==null?void 0:a.internals.userNode;g&&r.push({...g,position:f.position,dragging:n})}if(!t)return[r[0],r];const s=(c=i.get(t))==null?void 0:c.internals.userNode;return[s?{...s,position:((h=e.get(t))==null?void 0:h.position)||s.position,dragging:n}:r[0],r]}function u6({dragItems:t,snapGrid:e,x:i,y:n}){const r=t.values().next().value;if(!r)return null;const s={x:i-r.distance.x,y:n-r.distance.y},a=td(s,e);return{x:a.x-s.x,y:a.y-s.y}}function d6({onNodeMouseDown:t,getStoreItems:e,onDragStart:i,onDrag:n,onDragStop:r}){let s={x:null,y:null},a=0,c=new Map,h=!1,d={x:0,y:0},f=null,g=!1,m=null,O=!1,S=!1,_=null;function w({noDragClassName:Q,handleSelector:k,domNode:T,isSelectable:M,nodeId:$,nodeClickDistance:R=0}){m=Bn(T);function V({x:j,y:D}){const{nodeLookup:E,nodeExtent:X,snapGrid:P,snapToGrid:Z,nodeOrigin:L,onNodeDrag:B,onSelectionDrag:G,onError:z,updateNodePositions:q}=e();s={x:j,y:D};let K=!1;const ie=c.size>1,ce=ie&&X?Py(ed(c)):null,de=ie&&Z?u6({dragItems:c,snapGrid:P,x:j,y:D}):null;for(const[pe,fe]of c){if(!E.has(pe))continue;let ve={x:j-fe.distance.x,y:D-fe.distance.y};Z&&(ve=de?{x:Math.round(ve.x+de.x),y:Math.round(ve.y+de.y)}:td(ve,P));let De=null;if(ie&&X&&!fe.extent&&ce){const{positionAbsolute:me}=fe.internals,Be=me.x-ce.x+X[0][0],lt=me.x+fe.measured.width-ce.x2+X[1][0],He=me.y-ce.y+X[0][1],Ft=me.y+fe.measured.height-ce.y2+X[1][1];De=[[Be,He],[lt,Ft]]}const{position:Ee,positionAbsolute:ke}=kP({nodeId:pe,nextPosition:ve,nodeLookup:E,nodeExtent:De||X,nodeOrigin:L,onError:z});K=K||fe.position.x!==Ee.x||fe.position.y!==Ee.y,fe.position=Ee,fe.internals.positionAbsolute=ke}if(S=S||K,!!K&&(q(c,!0),_&&(n||B||!$&&G))){const[pe,fe]=sv({nodeId:$,dragItems:c,nodeLookup:E});n==null||n(_,c,pe,fe),B==null||B(_,pe,fe),$||G==null||G(_,fe)}}async function H(){if(!f)return;const{transform:j,panBy:D,autoPanSpeed:E,autoPanOnNodeDrag:X}=e();if(!X){h=!1,cancelAnimationFrame(a);return}const[P,Z]=TP(d,f,E);(P!==0||Z!==0)&&(s.x=(s.x??0)-P/j[2],s.y=(s.y??0)-Z/j[2],await D({x:P,y:Z})&&V(s)),a=requestAnimationFrame(H)}function ee(j){var ie;const{nodeLookup:D,multiSelectionActive:E,nodesDraggable:X,transform:P,snapGrid:Z,snapToGrid:L,selectNodesOnDrag:B,onNodeDragStart:G,onSelectionDragStart:z,unselectNodesAndEdges:q}=e();g=!0,(!B||!M)&&!E&&$&&((ie=D.get($))!=null&&ie.selected||q()),M&&B&&$&&(t==null||t($));const K=hu(j.sourceEvent,{transform:P,snapGrid:Z,snapToGrid:L,containerBounds:f});if(s=K,c=h6(D,X,K,$),c.size>0&&(i||G||!$&&z)){const[ce,de]=sv({nodeId:$,dragItems:c,nodeLookup:D});i==null||i(j.sourceEvent,c,ce,de),G==null||G(j.sourceEvent,ce,de),$||z==null||z(j.sourceEvent,de)}}const I=rP().clickDistance(R).on("start",j=>{const{domNode:D,nodeDragThreshold:E,transform:X,snapGrid:P,snapToGrid:Z}=e();f=(D==null?void 0:D.getBoundingClientRect())||null,O=!1,S=!1,_=j.sourceEvent,E===0&&ee(j),s=hu(j.sourceEvent,{transform:X,snapGrid:P,snapToGrid:Z,containerBounds:f}),d=vr(j.sourceEvent,f)}).on("drag",j=>{const{autoPanOnNodeDrag:D,transform:E,snapGrid:X,snapToGrid:P,nodeDragThreshold:Z,nodeLookup:L}=e(),B=hu(j.sourceEvent,{transform:E,snapGrid:X,snapToGrid:P,containerBounds:f});if(_=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||$&&!L.has($))&&(O=!0),!O){if(!h&&D&&g&&(h=!0,H()),!g){const G=vr(j.sourceEvent,f),z=G.x-d.x,q=G.y-d.y;Math.sqrt(z*z+q*q)>Z&&ee(j)}(s.x!==B.xSnapped||s.y!==B.ySnapped)&&c&&g&&(d=vr(j.sourceEvent,f),V(B))}}).on("end",j=>{if(!(!g||O)&&(h=!1,g=!1,cancelAnimationFrame(a),c.size>0)){const{nodeLookup:D,updateNodePositions:E,onNodeDragStop:X,onSelectionDragStop:P}=e();if(S&&(E(c,!1),S=!1),r||X||!$&&P){const[Z,L]=sv({nodeId:$,dragItems:c,nodeLookup:D,dragging:!1});r==null||r(j.sourceEvent,c,Z,L),X==null||X(j.sourceEvent,Z,L),$||P==null||P(j.sourceEvent,L)}}}).filter(j=>{const D=j.target;return!j.button&&(!Q||!$C(D,`.${Q}`,T))&&(!k||$C(D,k,T))});m.call(I)}function x(){m==null||m.on(".drag",null)}return{update:w,destroy:x}}function f6(t,e,i){const n=[],r={x:t.x-i,y:t.y-i,width:i*2,height:i*2};for(const s of e.values())Cu(r,vc(s))>0&&n.push(s);return n}const p6=250;function g6(t,e,i,n){var c,h;let r=[],s=1/0;const a=f6(t,i,e+p6);for(const d of a){const f=[...((c=d.internals.handleBounds)==null?void 0:c.source)??[],...((h=d.internals.handleBounds)==null?void 0:h.target)??[]];for(const g of f){if(n.nodeId===g.nodeId&&n.type===g.type&&n.id===g.id)continue;const{x:m,y:O}=Za(d,g,g.position,!0),S=Math.sqrt(Math.pow(m-t.x,2)+Math.pow(O-t.y,2));S>e||(S<s?(r=[{...g,x:m,y:O}],s=S):S===s&&r.push({...g,x:m,y:O}))}}if(!r.length)return null;if(r.length>1){const d=n.type==="source"?"target":"source";return r.find(f=>f.type===d)??r[0]}return r[0]}function ZP(t,e,i,n,r,s=!1){var d,f,g;const a=n.get(t);if(!a)return null;const c=r==="strict"?(d=a.internals.handleBounds)==null?void 0:d[e]:[...((f=a.internals.handleBounds)==null?void 0:f.source)??[],...((g=a.internals.handleBounds)==null?void 0:g.target)??[]],h=(i?c==null?void 0:c.find(m=>m.id===i):c==null?void 0:c[0])??null;return h&&s?{...h,...Za(a,h,h.position,!0)}:h}function WP(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function m6(t,e){let i=null;return e?i=!0:t&&!e&&(i=!1),i}const qP=()=>!0;function O6(t,{connectionMode:e,connectionRadius:i,handleId:n,nodeId:r,edgeUpdaterType:s,isTarget:a,domNode:c,nodeLookup:h,lib:d,autoPanOnConnect:f,flowId:g,panBy:m,cancelConnection:O,onConnectStart:S,onConnect:_,onConnectEnd:w,isValidConnection:x=qP,onReconnectEnd:Q,updateConnection:k,getTransform:T,getFromHandle:M,autoPanSpeed:$,dragThreshold:R=1,handleDomNode:V}){const H=EP(t.target);let ee=0,I;const{x:j,y:D}=vr(t),E=WP(s,V),X=c==null?void 0:c.getBoundingClientRect();let P=!1;if(!X||!E)return;const Z=ZP(r,E,n,h,e);if(!Z)return;let L=vr(t,X),B=!1,G=null,z=!1,q=null;function K(){if(!f||!X)return;const[Ee,ke]=TP(L,X,$);m({x:Ee,y:ke}),ee=requestAnimationFrame(K)}const ie={...Z,nodeId:r,type:E,position:Z.position},ce=h.get(r);let pe={inProgress:!0,isValid:null,from:Za(ce,ie,Re.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:ce,to:L,toHandle:null,toPosition:OC[ie.position],toNode:null,pointer:L};function fe(){P=!0,k(pe),S==null||S(t,{nodeId:r,handleId:n,handleType:E})}R===0&&fe();function ve(Ee){if(!P){const{x:Ft,y:rn}=vr(Ee),qi=Ft-j,_n=rn-D;if(!(qi*qi+_n*_n>R*R))return;fe()}if(!M()||!ie){De(Ee);return}const ke=T();L=vr(Ee,X),I=g6(id(L,ke,!1,[1,1]),i,h,ie),B||(K(),B=!0);const me=VP(Ee,{handle:I,connectionMode:e,fromNodeId:r,fromHandleId:n,fromType:a?"target":"source",isValidConnection:x,doc:H,lib:d,flowId:g,nodeLookup:h});q=me.handleDomNode,G=me.connection,z=m6(!!I,me.isValid);const Be=h.get(r),lt=Be?Za(Be,ie,Re.Left,!0):pe.from,He={...pe,from:lt,isValid:z,to:me.toHandle&&z?dg({x:me.toHandle.x,y:me.toHandle.y},ke):L,toHandle:me.toHandle,toPosition:z&&me.toHandle?me.toHandle.position:OC[ie.position],toNode:me.toHandle?h.get(me.toHandle.nodeId):null,pointer:L};k(He),pe=He}function De(Ee){if(!("touches"in Ee&&Ee.touches.length>0)){if(P){(I||q)&&G&&z&&(_==null||_(G));const{inProgress:ke,...me}=pe,Be={...me,toPosition:pe.toHandle?pe.toPosition:null};w==null||w(Ee,Be),s&&(Q==null||Q(Ee,Be))}O(),cancelAnimationFrame(ee),B=!1,z=!1,G=null,q=null,H.removeEventListener("mousemove",ve),H.removeEventListener("mouseup",De),H.removeEventListener("touchmove",ve),H.removeEventListener("touchend",De)}}H.addEventListener("mousemove",ve),H.addEventListener("mouseup",De),H.addEventListener("touchmove",ve),H.addEventListener("touchend",De)}function VP(t,{handle:e,connectionMode:i,fromNodeId:n,fromHandleId:r,fromType:s,doc:a,lib:c,flowId:h,isValidConnection:d=qP,nodeLookup:f}){const g=s==="target",m=e?a.querySelector(`.${c}-flow__handle[data-id="${h}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:O,y:S}=vr(t),_=a.elementFromPoint(O,S),w=_!=null&&_.classList.contains(`${c}-flow__handle`)?_:m,x={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const Q=WP(void 0,w),k=w.getAttribute("data-nodeid"),T=w.getAttribute("data-handleid"),M=w.classList.contains("connectable"),$=w.classList.contains("connectableend");if(!k||!Q)return x;const R={source:g?k:n,sourceHandle:g?T:r,target:g?n:k,targetHandle:g?r:T};x.connection=R;const H=M&&$&&(i===mc.Strict?g&&Q==="source"||!g&&Q==="target":k!==n||T!==r);x.isValid=H&&d(R),x.toHandle=ZP(k,Q,T,f,i,!0)}return x}const My={onPointerDown:O6,isValid:VP};function v6({domNode:t,panZoom:e,getTransform:i,getViewScale:n}){const r=Bn(t);function s({translateExtent:c,width:h,height:d,zoomStep:f=1,pannable:g=!0,zoomable:m=!0,inversePan:O=!1}){const S=k=>{if(k.sourceEvent.type!=="wheel"||!e)return;const T=i(),M=k.sourceEvent.ctrlKey&&Tu()?10:1,$=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*f,R=T[2]*Math.pow(2,$*M);e.scaleTo(R)};let _=[0,0];const w=k=>{(k.sourceEvent.type==="mousedown"||k.sourceEvent.type==="touchstart")&&(_=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY])},x=k=>{const T=i();if(k.sourceEvent.type!=="mousemove"&&k.sourceEvent.type!=="touchmove"||!e)return;const M=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],$=[M[0]-_[0],M[1]-_[1]];_=M;const R=n()*Math.max(T[2],Math.log(T[2]))*(O?-1:1),V={x:T[0]-$[0]*R,y:T[1]-$[1]*R},H=[[0,0],[h,d]];e.setViewportConstrained({x:V.x,y:V.y,zoom:T[2]},H,c)},Q=yP().on("start",w).on("zoom",g?x:null).on("zoom.wheel",m?S:null);r.call(Q,{})}function a(){r.on("zoom",null)}return{update:s,destroy:a,pointer:pr}}const am=t=>({x:t.x,y:t.y,zoom:t.k}),ov=({x:t,y:e,zoom:i})=>rm.translate(t,e).scale(i),Gl=(t,e)=>t.target.closest(`.${e}`),IP=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),y6=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,av=(t,e=0,i=y6,n=()=>{})=>{const r=typeof e=="number"&&e>0;return r||n(),r?t.transition().duration(e).ease(i).on("end",n):t},YP=t=>{const e=t.ctrlKey&&Tu()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function S6({zoomPanValues:t,noWheelClassName:e,d3Selection:i,d3Zoom:n,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:c,onPanZoom:h,onPanZoomEnd:d}){return f=>{if(Gl(f,e))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const g=i.property("__zoom").k||1;if(f.ctrlKey&&a){const w=pr(f),x=YP(f),Q=g*Math.pow(2,x);n.scaleTo(i,Q,w,f);return}const m=f.deltaMode===1?20:1;let O=r===za.Vertical?0:f.deltaX*m,S=r===za.Horizontal?0:f.deltaY*m;!Tu()&&f.shiftKey&&r!==za.Vertical&&(O=f.deltaY*m,S=0),n.translateBy(i,-(O/g)*s,-(S/g)*s,{internal:!0});const _=am(i.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(h==null||h(f,_),t.panScrollTimeout=setTimeout(()=>{d==null||d(f,_),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,c==null||c(f,_))}}function b6({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:i}){return function(n,r){const s=n.type==="wheel",a=!e&&s&&!n.ctrlKey,c=Gl(n,t);if(n.ctrlKey&&s&&c&&n.preventDefault(),a||c)return null;n.preventDefault(),i.call(this,n,r)}}function _6({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:i}){return n=>{var s,a,c;if((s=n.sourceEvent)!=null&&s.internal)return;const r=am(n.transform);t.mouseButton=((a=n.sourceEvent)==null?void 0:a.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=r,((c=n.sourceEvent)==null?void 0:c.type)==="mousedown"&&e(!0),i&&(i==null||i(n.sourceEvent,r))}}function x6({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:i,onTransformChange:n,onPanZoom:r}){return s=>{var a,c;t.usedRightMouseButton=!!(i&&IP(e,t.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||n([s.transform.x,s.transform.y,s.transform.k]),r&&!((c=s.sourceEvent)!=null&&c.internal)&&(r==null||r(s.sourceEvent,am(s.transform)))}}function w6({zoomPanValues:t,panOnDrag:e,panOnScroll:i,onDraggingChange:n,onPanZoomEnd:r,onPaneContextMenu:s}){return a=>{var c;if(!((c=a.sourceEvent)!=null&&c.internal)&&(t.isZoomingOrPanning=!1,s&&IP(e,t.mouseButton??0)&&!t.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),t.usedRightMouseButton=!1,n(!1),r)){const h=am(a.transform);t.prevViewport=h,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{r==null||r(a.sourceEvent,h)},i?150:0)}}}function k6({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:i,panOnDrag:n,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:h,lib:d,connectionInProgress:f}){return g=>{var w;const m=t||e,O=i&&g.ctrlKey,S=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(Gl(g,`${d}-flow__node`)||Gl(g,`${d}-flow__edge`)))return!0;if(!n&&!m&&!r&&!s&&!i||a||f&&!S||Gl(g,c)&&S||Gl(g,h)&&(!S||r&&S&&!t)||!i&&g.ctrlKey&&S)return!1;if(!i&&g.type==="touchstart"&&((w=g.touches)==null?void 0:w.length)>1)return g.preventDefault(),!1;if(!m&&!r&&!O&&S||!n&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(n)&&!n.includes(g.button)&&g.type==="mousedown")return!1;const _=Array.isArray(n)&&n.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||S)&&_}}function C6({domNode:t,minZoom:e,maxZoom:i,translateExtent:n,viewport:r,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:h}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=t.getBoundingClientRect(),g=yP().scaleExtent([e,i]).translateExtent(n),m=Bn(t).call(g);Q({x:r.x,y:r.y,zoom:Oc(r.zoom,e,i)},[[0,0],[f.width,f.height]],n);const O=m.on("wheel.zoom"),S=m.on("dblclick.zoom");g.wheelDelta(YP);function _(I,j){return m?new Promise(D=>{g==null||g.interpolate((j==null?void 0:j.interpolate)==="linear"?cu:Rp).transform(av(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>D(!0)),I)}):Promise.resolve(!1)}function w({noWheelClassName:I,noPanClassName:j,onPaneContextMenu:D,userSelectionActive:E,panOnScroll:X,panOnDrag:P,panOnScrollMode:Z,panOnScrollSpeed:L,preventScrolling:B,zoomOnPinch:G,zoomOnScroll:z,zoomOnDoubleClick:q,zoomActivationKeyPressed:K,lib:ie,onTransformChange:ce,connectionInProgress:de,paneClickDistance:pe,selectionOnDrag:fe}){E&&!d.isZoomingOrPanning&&x();const ve=X&&!K&&!E;g.clickDistance(fe?1/0:!Or(pe)||pe<0?0:pe);const De=ve?S6({zoomPanValues:d,noWheelClassName:I,d3Selection:m,d3Zoom:g,panOnScrollMode:Z,panOnScrollSpeed:L,zoomOnPinch:G,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:c}):b6({noWheelClassName:I,preventScrolling:B,d3ZoomHandler:O});if(m.on("wheel.zoom",De,{passive:!1}),!E){const ke=_6({zoomPanValues:d,onDraggingChange:h,onPanZoomStart:a});g.on("start",ke);const me=x6({zoomPanValues:d,panOnDrag:P,onPaneContextMenu:!!D,onPanZoom:s,onTransformChange:ce});g.on("zoom",me);const Be=w6({zoomPanValues:d,panOnDrag:P,panOnScroll:X,onPaneContextMenu:D,onPanZoomEnd:c,onDraggingChange:h});g.on("end",Be)}const Ee=k6({zoomActivationKeyPressed:K,panOnDrag:P,zoomOnScroll:z,panOnScroll:X,zoomOnDoubleClick:q,zoomOnPinch:G,userSelectionActive:E,noPanClassName:j,noWheelClassName:I,lib:ie,connectionInProgress:de});g.filter(Ee),q?m.on("dblclick.zoom",S):m.on("dblclick.zoom",null)}function x(){g.on("zoom",null)}async function Q(I,j,D){const E=ov(I),X=g==null?void 0:g.constrain()(E,j,D);return X&&await _(X),new Promise(P=>P(X))}async function k(I,j){const D=ov(I);return await _(D,j),new Promise(E=>E(D))}function T(I){if(m){const j=ov(I),D=m.property("__zoom");(D.k!==I.zoom||D.x!==I.x||D.y!==I.y)&&(g==null||g.transform(m,j,null,{sync:!0}))}}function M(){const I=m?vP(m.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function $(I,j){return m?new Promise(D=>{g==null||g.interpolate((j==null?void 0:j.interpolate)==="linear"?cu:Rp).scaleTo(av(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>D(!0)),I)}):Promise.resolve(!1)}function R(I,j){return m?new Promise(D=>{g==null||g.interpolate((j==null?void 0:j.interpolate)==="linear"?cu:Rp).scaleBy(av(m,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>D(!0)),I)}):Promise.resolve(!1)}function V(I){g==null||g.scaleExtent(I)}function H(I){g==null||g.translateExtent(I)}function ee(I){const j=!Or(I)||I<0?0:I;g==null||g.clickDistance(j)}return{update:w,destroy:x,setViewport:k,setViewportConstrained:Q,getViewport:M,scaleTo:$,scaleBy:R,setScaleExtent:V,setTranslateExtent:H,syncViewport:T,setClickDistance:ee}}var Sc;(function(t){t.Line="line",t.Handle="handle"})(Sc||(Sc={}));function T6({width:t,prevWidth:e,height:i,prevHeight:n,affectsX:r,affectsY:s}){const a=t-e,c=i-n,h=[a>0?1:a<0?-1:0,c>0?1:c<0?-1:0];return a&&r&&(h[0]=h[0]*-1),c&&s&&(h[1]=h[1]*-1),h}function PC(t){const e=t.includes("right")||t.includes("left"),i=t.includes("bottom")||t.includes("top"),n=t.includes("left"),r=t.includes("top");return{isHorizontal:e,isVertical:i,affectsX:n,affectsY:r}}function vo(t,e){return Math.max(0,e-t)}function yo(t,e){return Math.max(0,t-e)}function Yf(t,e,i){return Math.max(0,e-t,t-i)}function EC(t,e){return t?!e:e}function Q6(t,e,i,n,r,s,a,c){let{affectsX:h,affectsY:d}=e;const{isHorizontal:f,isVertical:g}=e,m=f&&g,{xSnapped:O,ySnapped:S}=i,{minWidth:_,maxWidth:w,minHeight:x,maxHeight:Q}=n,{x:k,y:T,width:M,height:$,aspectRatio:R}=t;let V=Math.floor(f?O-t.pointerX:0),H=Math.floor(g?S-t.pointerY:0);const ee=M+(h?-V:V),I=$+(d?-H:H),j=-s[0]*M,D=-s[1]*$;let E=Yf(ee,_,w),X=Yf(I,x,Q);if(a){let L=0,B=0;h&&V<0?L=vo(k+V+j,a[0][0]):!h&&V>0&&(L=yo(k+ee+j,a[1][0])),d&&H<0?B=vo(T+H+D,a[0][1]):!d&&H>0&&(B=yo(T+I+D,a[1][1])),E=Math.max(E,L),X=Math.max(X,B)}if(c){let L=0,B=0;h&&V>0?L=yo(k+V,c[0][0]):!h&&V<0&&(L=vo(k+ee,c[1][0])),d&&H>0?B=yo(T+H,c[0][1]):!d&&H<0&&(B=vo(T+I,c[1][1])),E=Math.max(E,L),X=Math.max(X,B)}if(r){if(f){const L=Yf(ee/R,x,Q)*R;if(E=Math.max(E,L),a){let B=0;!h&&!d||h&&!d&&m?B=yo(T+D+ee/R,a[1][1])*R:B=vo(T+D+(h?V:-V)/R,a[0][1])*R,E=Math.max(E,B)}if(c){let B=0;!h&&!d||h&&!d&&m?B=vo(T+ee/R,c[1][1])*R:B=yo(T+(h?V:-V)/R,c[0][1])*R,E=Math.max(E,B)}}if(g){const L=Yf(I*R,_,w)/R;if(X=Math.max(X,L),a){let B=0;!h&&!d||d&&!h&&m?B=yo(k+I*R+j,a[1][0])/R:B=vo(k+(d?H:-H)*R+j,a[0][0])/R,X=Math.max(X,B)}if(c){let B=0;!h&&!d||d&&!h&&m?B=vo(k+I*R,c[1][0])/R:B=yo(k+(d?H:-H)*R,c[0][0])/R,X=Math.max(X,B)}}}H=H+(H<0?X:-X),V=V+(V<0?E:-E),r&&(m?ee>I*R?H=(EC(h,d)?-V:V)/R:V=(EC(h,d)?-H:H)*R:f?(H=V/R,d=h):(V=H*R,h=d));const P=h?k+V:k,Z=d?T+H:T;return{width:M+(h?-V:V),height:$+(d?-H:H),x:s[0]*V*(h?-1:1)+P,y:s[1]*H*(d?-1:1)+Z}}const HP={width:0,height:0,x:0,y:0},$6={...HP,pointerX:0,pointerY:0,aspectRatio:1};function P6(t){return[[0,0],[t.measured.width,t.measured.height]]}function E6(t,e,i){const n=e.position.x+t.position.x,r=e.position.y+t.position.y,s=t.measured.width??0,a=t.measured.height??0,c=i[0]*s,h=i[1]*a;return[[n-c,r-h],[n+s-c,r+a-h]]}function R6({domNode:t,nodeId:e,getStoreItems:i,onChange:n,onEnd:r}){const s=Bn(t);let a={controlDirection:PC("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:d,boundaries:f,keepAspectRatio:g,resizeDirection:m,onResizeStart:O,onResize:S,onResizeEnd:_,shouldResize:w}){let x={...HP},Q={...$6};a={boundaries:f,resizeDirection:m,keepAspectRatio:g,controlDirection:PC(d)};let k,T=null,M=[],$,R,V,H=!1;const ee=rP().on("start",I=>{const{nodeLookup:j,transform:D,snapGrid:E,snapToGrid:X,nodeOrigin:P,paneDomNode:Z}=i();if(k=j.get(e),!k)return;T=(Z==null?void 0:Z.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:B}=hu(I.sourceEvent,{transform:D,snapGrid:E,snapToGrid:X,containerBounds:T});x={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},Q={...x,pointerX:L,pointerY:B,aspectRatio:x.width/x.height},$=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&($=j.get(k.parentId),R=$&&k.extent==="parent"?P6($):void 0),M=[],V=void 0;for(const[G,z]of j)if(z.parentId===e&&(M.push({id:G,position:{...z.position},extent:z.extent}),z.extent==="parent"||z.expandParent)){const q=E6(z,k,z.origin??P);V?V=[[Math.min(q[0][0],V[0][0]),Math.min(q[0][1],V[0][1])],[Math.max(q[1][0],V[1][0]),Math.max(q[1][1],V[1][1])]]:V=q}O==null||O(I,{...x})}).on("drag",I=>{const{transform:j,snapGrid:D,snapToGrid:E,nodeOrigin:X}=i(),P=hu(I.sourceEvent,{transform:j,snapGrid:D,snapToGrid:E,containerBounds:T}),Z=[];if(!k)return;const{x:L,y:B,width:G,height:z}=x,q={},K=k.origin??X,{width:ie,height:ce,x:de,y:pe}=Q6(Q,a.controlDirection,P,a.boundaries,a.keepAspectRatio,K,R,V),fe=ie!==G,ve=ce!==z,De=de!==L&&fe,Ee=pe!==B&&ve;if(!De&&!Ee&&!fe&&!ve)return;if((De||Ee||K[0]===1||K[1]===1)&&(q.x=De?de:x.x,q.y=Ee?pe:x.y,x.x=q.x,x.y=q.y,M.length>0)){const lt=de-L,He=pe-B;for(const Ft of M)Ft.position={x:Ft.position.x-lt+K[0]*(ie-G),y:Ft.position.y-He+K[1]*(ce-z)},Z.push(Ft)}if((fe||ve)&&(q.width=fe&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ie:x.width,q.height=ve&&(!a.resizeDirection||a.resizeDirection==="vertical")?ce:x.height,x.width=q.width,x.height=q.height),$&&k.expandParent){const lt=K[0]*(q.width??0);q.x&&q.x<lt&&(x.x=lt,Q.x=Q.x-(q.x-lt));const He=K[1]*(q.height??0);q.y&&q.y<He&&(x.y=He,Q.y=Q.y-(q.y-He))}const ke=T6({width:x.width,prevWidth:G,height:x.height,prevHeight:z,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),me={...x,direction:ke};(w==null?void 0:w(I,me))!==!1&&(H=!0,S==null||S(I,me),n(q,Z))}).on("end",I=>{H&&(_==null||_(I,{...x}),r==null||r({...x}),H=!1)});s.call(ee)}function h(){s.on(".drag",null)}return{update:c,destroy:h}}var lv={exports:{}},cv={},hv={exports:{}},uv={};/**
50
50
  * @license React
51
51
  * use-sync-external-store-shim.production.js
52
52
  *
@@ -67,14 +67,14 @@ Error generating stack: `+p.message+`
67
67
 
68
68
  `,`
69
69
  +`).split(`
70
- `)),f=d.reduce((g,m)=>g.concat(...m),[]);return[d,f]}return[[],[]]},[t]);return N.useEffect(()=>{const h=(e==null?void 0:e.target)??ZC,d=(e==null?void 0:e.actInsideInputWithModifier)??!0;if(t!==null){const f=O=>{var w,x;if(r.current=O.ctrlKey||O.metaKey||O.shiftKey||O.altKey,(!r.current||r.current&&!d)&&RP(O))return!1;const _=qC(O.code,c);if(s.current.add(O[_]),WC(a,s.current,!1)){const Q=((x=(w=O.composedPath)==null?void 0:w.call(O))==null?void 0:x[0])||O.target,k=(Q==null?void 0:Q.nodeName)==="BUTTON"||(Q==null?void 0:Q.nodeName)==="A";e.preventDefault!==!1&&(r.current||!k)&&O.preventDefault(),n(!0)}},g=O=>{const S=qC(O.code,c);WC(a,s.current,!0)?(n(!1),s.current.clear()):s.current.delete(O[S]),O.key==="Meta"&&s.current.clear(),r.current=!1},m=()=>{s.current.clear(),n(!1)};return h==null||h.addEventListener("keydown",f),h==null||h.addEventListener("keyup",g),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{h==null||h.removeEventListener("keydown",f),h==null||h.removeEventListener("keyup",g),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[t,n]),i}function WC(t,e,i){return t.filter(n=>i||n.length===e.size).some(n=>n.every(r=>e.has(r)))}function qC(t,e){return e.includes(t)?"code":"key"}const cX=()=>{const t=jt();return N.useMemo(()=>({zoomIn:e=>{const{panZoom:i}=t.getState();return i?i.scaleBy(1.2,e):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:i}=t.getState();return i?i.scaleBy(1/1.2,e):Promise.resolve(!1)},zoomTo:(e,i)=>{const{panZoom:n}=t.getState();return n?n.scaleTo(e,i):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,i)=>{const{transform:[n,r,s],panZoom:a}=t.getState();return a?(await a.setViewport({x:e.x??n,y:e.y??r,zoom:e.zoom??s},i),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,i,n]=t.getState().transform;return{x:e,y:i,zoom:n}},setCenter:async(e,i,n)=>t.getState().setCenter(e,i,n),fitBounds:async(e,i)=>{const{width:n,height:r,minZoom:s,maxZoom:a,panZoom:c}=t.getState(),h=E1(e,n,r,s,a,(i==null?void 0:i.padding)??.1);return c?(await c.setViewport(h,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,i={})=>{const{transform:n,snapGrid:r,snapToGrid:s,domNode:a}=t.getState();if(!a)return e;const{x:c,y:h}=a.getBoundingClientRect(),d={x:e.x-c,y:e.y-h},f=i.snapGrid??r,g=i.snapToGrid??s;return id(d,n,g,f)},flowToScreenPosition:e=>{const{transform:i,domNode:n}=t.getState();if(!n)return e;const{x:r,y:s}=n.getBoundingClientRect(),a=dg(e,i);return{x:a.x+r,y:a.y+s}}}),[])};function eE(t,e){const i=[],n=new Map,r=[];for(const s of t)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")n.set(s.id,[s]);else{const a=n.get(s.id);a?a.push(s):n.set(s.id,[s])}for(const s of e){const a=n.get(s.id);if(!a){i.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){i.push({...a[0].item});continue}const c={...s};for(const h of a)hX(h,c);i.push(c)}return r.length&&r.forEach(s=>{s.index!==void 0?i.splice(s.index,0,{...s.item}):i.push({...s.item})}),i}function hX(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function uX(t,e){return eE(t,e)}function dX(t,e){return eE(t,e)}function ba(t,e){return{id:t,type:"select",selected:e}}function Fl(t,e=new Set,i=!1){const n=[];for(const[r,s]of t){const a=e.has(r);!(s.selected===void 0&&!a)&&s.selected!==a&&(i&&(s.selected=a),n.push(ba(s.id,a)))}return n}function VC({items:t=[],lookup:e}){var r;const i=[],n=new Map(t.map(s=>[s.id,s]));for(const[s,a]of t.entries()){const c=e.get(a.id),h=((r=c==null?void 0:c.internals)==null?void 0:r.userNode)??c;h!==void 0&&h!==a&&i.push({id:a.id,item:a,type:"replace"}),h===void 0&&i.push({item:a,type:"add",index:s})}for(const[s]of e)n.get(s)===void 0&&i.push({id:s,type:"remove"});return i}function IC(t){return{id:t.id,type:"remove"}}const YC=t=>ML(t),fX=t=>wP(t);function tE(t){return N.forwardRef(t)}function HC(t){const[e,i]=N.useState(BigInt(0)),[n]=N.useState(()=>pX(()=>i(r=>r+BigInt(1))));return zy(()=>{const r=n.get();r.length&&(t(r),n.reset())},[e]),n}function pX(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:i=>{e.push(i),t()}}}const iE=N.createContext(null);function gX({children:t}){const e=jt(),i=N.useCallback(c=>{const{nodes:h=[],setNodes:d,hasDefaultNodes:f,onNodesChange:g,nodeLookup:m,fitViewQueued:O,onNodesChangeMiddlewareMap:S}=e.getState();let _=h;for(const x of c)_=typeof x=="function"?x(_):x;let w=VC({items:_,lookup:m});for(const x of S.values())w=x(w);f&&d(_),w.length>0?g==null||g(w):O&&window.requestAnimationFrame(()=>{const{fitViewQueued:x,nodes:Q,setNodes:k}=e.getState();x&&k(Q)})},[]),n=HC(i),r=N.useCallback(c=>{const{edges:h=[],setEdges:d,hasDefaultEdges:f,onEdgesChange:g,edgeLookup:m}=e.getState();let O=h;for(const S of c)O=typeof S=="function"?S(O):S;f?d(O):g&&g(VC({items:O,lookup:m}))},[]),s=HC(r),a=N.useMemo(()=>({nodeQueue:n,edgeQueue:s}),[]);return v.jsx(iE.Provider,{value:a,children:t})}function mX(){const t=N.useContext(iE);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const OX=t=>!!t.panZoom;function hm(){const t=cX(),e=jt(),i=mX(),n=at(OX),r=N.useMemo(()=>{const s=g=>e.getState().nodeLookup.get(g),a=g=>{i.nodeQueue.push(g)},c=g=>{i.edgeQueue.push(g)},h=g=>{var x,Q;const{nodeLookup:m,nodeOrigin:O}=e.getState(),S=YC(g)?g:m.get(g.id),_=S.parentId?PP(S.position,S.measured,S.parentId,m,O):S.position,w={...S,position:_,width:((x=S.measured)==null?void 0:x.width)??S.width,height:((Q=S.measured)==null?void 0:Q.height)??S.height};return vc(w)},d=(g,m,O={replace:!1})=>{a(S=>S.map(_=>{if(_.id===g){const w=typeof m=="function"?m(_):m;return O.replace&&YC(w)?w:{..._,...w}}return _}))},f=(g,m,O={replace:!1})=>{c(S=>S.map(_=>{if(_.id===g){const w=typeof m=="function"?m(_):m;return O.replace&&fX(w)?w:{..._,...w}}return _}))};return{getNodes:()=>e.getState().nodes.map(g=>({...g})),getNode:g=>{var m;return(m=s(g))==null?void 0:m.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:g=[]}=e.getState();return g.map(m=>({...m}))},getEdge:g=>e.getState().edgeLookup.get(g),setNodes:a,setEdges:c,addNodes:g=>{const m=Array.isArray(g)?g:[g];i.nodeQueue.push(O=>[...O,...m])},addEdges:g=>{const m=Array.isArray(g)?g:[g];i.edgeQueue.push(O=>[...O,...m])},toObject:()=>{const{nodes:g=[],edges:m=[],transform:O}=e.getState(),[S,_,w]=O;return{nodes:g.map(x=>({...x})),edges:m.map(x=>({...x})),viewport:{x:S,y:_,zoom:w}}},deleteElements:async({nodes:g=[],edges:m=[]})=>{const{nodes:O,edges:S,onNodesDelete:_,onEdgesDelete:w,triggerNodeChanges:x,triggerEdgeChanges:Q,onDelete:k,onBeforeDelete:T}=e.getState(),{nodes:M,edges:$}=await LL({nodesToRemove:g,edgesToRemove:m,nodes:O,edges:S,onBeforeDelete:T}),R=$.length>0,V=M.length>0;if(R){const H=$.map(IC);w==null||w($),Q(H)}if(V){const H=M.map(IC);_==null||_(M),x(H)}return(V||R)&&(k==null||k({nodes:M,edges:$})),{deletedNodes:M,deletedEdges:$}},getIntersectingNodes:(g,m=!0,O)=>{const S=yC(g),_=S?g:h(g),w=O!==void 0;return _?(O||e.getState().nodes).filter(x=>{const Q=e.getState().nodeLookup.get(x.id);if(Q&&!S&&(x.id===g.id||!Q.internals.positionAbsolute))return!1;const k=vc(w?x:Q),T=Cu(k,_);return m&&T>0||T>=k.width*k.height||T>=_.width*_.height}):[]},isNodeIntersecting:(g,m,O=!0)=>{const _=yC(g)?g:h(g);if(!_)return!1;const w=Cu(_,m);return O&&w>0||w>=m.width*m.height||w>=_.width*_.height},updateNode:d,updateNodeData:(g,m,O={replace:!1})=>{d(g,S=>{const _=typeof m=="function"?m(S):m;return O.replace?{...S,data:_}:{...S,data:{...S.data,..._}}},O)},updateEdge:f,updateEdgeData:(g,m,O={replace:!1})=>{f(g,S=>{const _=typeof m=="function"?m(S):m;return O.replace?{...S,data:_}:{...S,data:{...S.data,..._}}},O)},getNodesBounds:g=>{const{nodeLookup:m,nodeOrigin:O}=e.getState();return zL(g,{nodeLookup:m,nodeOrigin:O})},getHandleConnections:({type:g,id:m,nodeId:O})=>{var S;return Array.from(((S=e.getState().connectionLookup.get(`${O}-${g}${m?`-${m}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:g,handleId:m,nodeId:O})=>{var S;return Array.from(((S=e.getState().connectionLookup.get(`${O}${g?m?`-${g}-${m}`:`-${g}`:""}`))==null?void 0:S.values())??[])},fitView:async g=>{const m=e.getState().fitViewResolver??WL();return e.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:m}),i.nodeQueue.push(O=>[...O]),m.promise}}},[]);return N.useMemo(()=>({...r,...t,viewportInitialized:n}),[n])}const UC=t=>t.selected,vX=typeof window<"u"?window:void 0;function yX({deleteKeyCode:t,multiSelectionKeyCode:e}){const i=jt(),{deleteElements:n}=hm(),r=Qu(t,{actInsideInputWithModifier:!1}),s=Qu(e,{target:vX});N.useEffect(()=>{if(r){const{edges:a,nodes:c}=i.getState();n({nodes:c.filter(UC),edges:a.filter(UC)}),i.setState({nodesSelectionActive:!1})}},[r]),N.useEffect(()=>{i.setState({multiSelectionActive:s})},[s])}function SX(t){const e=jt();N.useEffect(()=>{const i=()=>{var r,s,a,c;if(!t.current||!(((s=(r=t.current).checkVisibility)==null?void 0:s.call(r))??!0))return!1;const n=R1(t.current);(n.height===0||n.width===0)&&((c=(a=e.getState()).onError)==null||c.call(a,"004",Ur.error004())),e.setState({width:n.width||500,height:n.height||500})};if(t.current){i(),window.addEventListener("resize",i);const n=new ResizeObserver(()=>i());return n.observe(t.current),()=>{window.removeEventListener("resize",i),n&&t.current&&n.unobserve(t.current)}}},[])}const um={position:"absolute",width:"100%",height:"100%",top:0,left:0},bX=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function _X({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:i=!0,panOnScroll:n=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=za.Free,zoomOnDoubleClick:a=!0,panOnDrag:c=!0,defaultViewport:h,translateExtent:d,minZoom:f,maxZoom:g,zoomActivationKeyCode:m,preventScrolling:O=!0,children:S,noWheelClassName:_,noPanClassName:w,onViewportChange:x,isControlledViewport:Q,paneClickDistance:k,selectionOnDrag:T}){const M=jt(),$=N.useRef(null),{userSelectionActive:R,lib:V,connectionInProgress:H}=at(bX,Mt),ee=Qu(m),I=N.useRef();SX($);const j=N.useCallback(D=>{x==null||x({x:D[0],y:D[1],zoom:D[2]}),Q||M.setState({transform:D})},[x,Q]);return N.useEffect(()=>{if($.current){I.current=C6({domNode:$.current,minZoom:f,maxZoom:g,translateExtent:d,viewport:h,onDraggingChange:P=>M.setState(Z=>Z.paneDragging===P?Z:{paneDragging:P}),onPanZoomStart:(P,Z)=>{const{onViewportChangeStart:L,onMoveStart:B}=M.getState();B==null||B(P,Z),L==null||L(Z)},onPanZoom:(P,Z)=>{const{onViewportChange:L,onMove:B}=M.getState();B==null||B(P,Z),L==null||L(Z)},onPanZoomEnd:(P,Z)=>{const{onViewportChangeEnd:L,onMoveEnd:B}=M.getState();B==null||B(P,Z),L==null||L(Z)}});const{x:D,y:E,zoom:X}=I.current.getViewport();return M.setState({panZoom:I.current,transform:[D,E,X],domNode:$.current.closest(".react-flow")}),()=>{var P;(P=I.current)==null||P.destroy()}}},[]),N.useEffect(()=>{var D;(D=I.current)==null||D.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:i,panOnScroll:n,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:c,zoomActivationKeyPressed:ee,preventScrolling:O,noPanClassName:w,userSelectionActive:R,noWheelClassName:_,lib:V,onTransformChange:j,connectionInProgress:H,selectionOnDrag:T,paneClickDistance:k})},[t,e,i,n,r,s,a,c,ee,O,w,R,_,V,j,H,T,k]),v.jsx("div",{className:"react-flow__renderer",ref:$,style:um,children:S})}const xX=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function wX(){const{userSelectionActive:t,userSelectionRect:e}=at(xX,Mt);return t&&e?v.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const dv=(t,e)=>i=>{i.target===e.current&&(t==null||t(i))},kX=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function CX({isSelecting:t,selectionKeyPressed:e,selectionMode:i=ku.Full,panOnDrag:n,paneClickDistance:r,selectionOnDrag:s,onSelectionStart:a,onSelectionEnd:c,onPaneClick:h,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:g,onPaneMouseMove:m,onPaneMouseLeave:O,children:S}){const _=jt(),{userSelectionActive:w,elementsSelectable:x,dragging:Q,connectionInProgress:k}=at(kX,Mt),T=x&&(t||w),M=N.useRef(null),$=N.useRef(),R=N.useRef(new Set),V=N.useRef(new Set),H=N.useRef(!1),ee=L=>{if(H.current||k){H.current=!1;return}h==null||h(L),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},I=L=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){L.preventDefault();return}d==null||d(L)},j=f?L=>f(L):void 0,D=L=>{H.current&&(L.stopPropagation(),H.current=!1)},E=L=>{var ce,de;const{domNode:B}=_.getState();if($.current=B==null?void 0:B.getBoundingClientRect(),!$.current)return;const G=L.target===M.current;if(!G&&!!L.target.closest(".nokey")||!t||!(s&&G||e)||L.button!==0||!L.isPrimary)return;(de=(ce=L.target)==null?void 0:ce.setPointerCapture)==null||de.call(ce,L.pointerId),H.current=!1;const{x:K,y:ie}=vr(L.nativeEvent,$.current);_.setState({userSelectionRect:{width:0,height:0,startX:K,startY:ie,x:K,y:ie}}),G||(L.stopPropagation(),L.preventDefault())},X=L=>{const{userSelectionRect:B,transform:G,nodeLookup:z,edgeLookup:q,connectionLookup:K,triggerNodeChanges:ie,triggerEdgeChanges:ce,defaultEdgeOptions:de,resetSelectedElements:pe}=_.getState();if(!$.current||!B)return;const{x:fe,y:ve}=vr(L.nativeEvent,$.current),{startX:De,startY:Ee}=B;if(!H.current){const Ue=e?0:r;if(Math.hypot(fe-De,ve-Ee)<=Ue)return;pe(),a==null||a(L)}H.current=!0;const ke={startX:De,startY:Ee,x:fe<De?fe:De,y:ve<Ee?ve:Ee,width:Math.abs(fe-De),height:Math.abs(ve-Ee)},me=R.current,Be=V.current;R.current=new Set(P1(z,ke,G,i===ku.Partial,!0).map(Ue=>Ue.id)),V.current=new Set;const lt=(de==null?void 0:de.selectable)??!0;for(const Ue of R.current){const Ft=K.get(Ue);if(Ft)for(const{edgeId:rn}of Ft.values()){const qi=q.get(rn);qi&&(qi.selectable??lt)&&V.current.add(rn)}}if(!SC(me,R.current)){const Ue=Fl(z,R.current,!0);ie(Ue)}if(!SC(Be,V.current)){const Ue=Fl(q,V.current);ce(Ue)}_.setState({userSelectionRect:ke,userSelectionActive:!0,nodesSelectionActive:!1})},P=L=>{var B,G;L.button===0&&((G=(B=L.target)==null?void 0:B.releasePointerCapture)==null||G.call(B,L.pointerId),!w&&L.target===M.current&&_.getState().userSelectionRect&&(ee==null||ee(L)),_.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(c==null||c(L),_.setState({nodesSelectionActive:R.current.size>0})))},Z=n===!0||Array.isArray(n)&&n.includes(0);return v.jsxs("div",{className:ai(["react-flow__pane",{draggable:Z,dragging:Q,selection:t}]),onClick:T?void 0:dv(ee,M),onContextMenu:dv(I,M),onWheel:dv(j,M),onPointerEnter:T?void 0:g,onPointerMove:T?X:m,onPointerUp:T?P:void 0,onPointerDownCapture:T?E:void 0,onClickCapture:T?D:void 0,onPointerLeave:O,ref:M,style:um,children:[S,v.jsx(wX,{})]})}function jy({id:t,store:e,unselect:i=!1,nodeRef:n}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:c,onError:h}=e.getState(),d=c.get(t);if(!d){h==null||h("012",Ur.error012(t));return}e.setState({nodesSelectionActive:!1}),d.selected?(i||d.selected&&a)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var f;return(f=n==null?void 0:n.current)==null?void 0:f.blur()})):r([t])}function nE({nodeRef:t,disabled:e=!1,noDragClassName:i,handleSelector:n,nodeId:r,isSelectable:s,nodeClickDistance:a}){const c=jt(),[h,d]=N.useState(!1),f=N.useRef();return N.useEffect(()=>{f.current=d6({getStoreItems:()=>c.getState(),onNodeMouseDown:g=>{jy({id:g,store:c,nodeRef:t})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),N.useEffect(()=>{if(!(e||!t.current||!f.current))return f.current.update({noDragClassName:i,handleSelector:n,domNode:t.current,isSelectable:s,nodeId:r,nodeClickDistance:a}),()=>{var g;(g=f.current)==null||g.destroy()}},[i,n,e,s,t,r,a]),h}const TX=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function rE(){const t=jt();return N.useCallback(i=>{const{nodeExtent:n,snapToGrid:r,snapGrid:s,nodesDraggable:a,onError:c,updateNodePositions:h,nodeLookup:d,nodeOrigin:f}=t.getState(),g=new Map,m=TX(a),O=r?s[0]:5,S=r?s[1]:5,_=i.direction.x*O*i.factor,w=i.direction.y*S*i.factor;for(const[,x]of d){if(!m(x))continue;let Q={x:x.internals.positionAbsolute.x+_,y:x.internals.positionAbsolute.y+w};r&&(Q=td(Q,s));const{position:k,positionAbsolute:T}=kP({nodeId:x.id,nextPosition:Q,nodeLookup:d,nodeExtent:n,nodeOrigin:f,onError:c});x.position=k,x.internals.positionAbsolute=T,g.set(x.id,x)}h(g)},[])}const B1=N.createContext(null),QX=B1.Provider;B1.Consumer;const sE=()=>N.useContext(B1),$X=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),PX=(t,e,i)=>n=>{const{connectionClickStartHandle:r,connectionMode:s,connection:a}=n,{fromHandle:c,toHandle:h,isValid:d}=a,f=(h==null?void 0:h.nodeId)===t&&(h==null?void 0:h.id)===e&&(h==null?void 0:h.type)===i;return{connectingFrom:(c==null?void 0:c.nodeId)===t&&(c==null?void 0:c.id)===e&&(c==null?void 0:c.type)===i,connectingTo:f,clickConnecting:(r==null?void 0:r.nodeId)===t&&(r==null?void 0:r.id)===e&&(r==null?void 0:r.type)===i,isPossibleEndHandle:s===mc.Strict?(c==null?void 0:c.type)!==i:t!==(c==null?void 0:c.nodeId)||e!==(c==null?void 0:c.id),connectionInProcess:!!c,clickConnectionInProcess:!!r,valid:f&&d}};function EX({type:t="source",position:e=Re.Top,isValidConnection:i,isConnectable:n=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:a,onConnect:c,children:h,className:d,onMouseDown:f,onTouchStart:g,...m},O){var X,P;const S=a||null,_=t==="target",w=jt(),x=sE(),{connectOnClick:Q,noPanClassName:k,rfId:T}=at($X,Mt),{connectingFrom:M,connectingTo:$,clickConnecting:R,isPossibleEndHandle:V,connectionInProcess:H,clickConnectionInProcess:ee,valid:I}=at(PX(x,S,t),Mt);x||(P=(X=w.getState()).onError)==null||P.call(X,"010",Ur.error010());const j=Z=>{const{defaultEdgeOptions:L,onConnect:B,hasDefaultEdges:G}=w.getState(),z={...L,...Z};if(G){const{edges:q,setEdges:K}=w.getState();K(GL(z,q))}B==null||B(z),c==null||c(z)},D=Z=>{if(!x)return;const L=AP(Z.nativeEvent);if(r&&(L&&Z.button===0||!L)){const B=w.getState();My.onPointerDown(Z.nativeEvent,{handleDomNode:Z.currentTarget,autoPanOnConnect:B.autoPanOnConnect,connectionMode:B.connectionMode,connectionRadius:B.connectionRadius,domNode:B.domNode,nodeLookup:B.nodeLookup,lib:B.lib,isTarget:_,handleId:S,nodeId:x,flowId:B.rfId,panBy:B.panBy,cancelConnection:B.cancelConnection,onConnectStart:B.onConnectStart,onConnectEnd:(...G)=>{var z,q;return(q=(z=w.getState()).onConnectEnd)==null?void 0:q.call(z,...G)},updateConnection:B.updateConnection,onConnect:j,isValidConnection:i||((...G)=>{var z,q;return((q=(z=w.getState()).isValidConnection)==null?void 0:q.call(z,...G))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:B.autoPanSpeed,dragThreshold:B.connectionDragThreshold})}L?f==null||f(Z):g==null||g(Z)},E=Z=>{const{onClickConnectStart:L,onClickConnectEnd:B,connectionClickStartHandle:G,connectionMode:z,isValidConnection:q,lib:K,rfId:ie,nodeLookup:ce,connection:de}=w.getState();if(!x||!G&&!r)return;if(!G){L==null||L(Z.nativeEvent,{nodeId:x,handleId:S,handleType:t}),w.setState({connectionClickStartHandle:{nodeId:x,type:t,id:S}});return}const pe=EP(Z.target),fe=i||q,{connection:ve,isValid:De}=My.isValid(Z.nativeEvent,{handle:{nodeId:x,id:S,type:t},connectionMode:z,fromNodeId:G.nodeId,fromHandleId:G.id||null,fromType:G.type,isValidConnection:fe,flowId:ie,doc:pe,lib:K,nodeLookup:ce});De&&ve&&j(ve);const Ee=structuredClone(de);delete Ee.inProgress,Ee.toPosition=Ee.toHandle?Ee.toHandle.position:null,B==null||B(Z,Ee),w.setState({connectionClickStartHandle:null})};return v.jsx("div",{"data-handleid":S,"data-nodeid":x,"data-handlepos":e,"data-id":`${T}-${x}-${S}-${t}`,className:ai(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",k,d,{source:!_,target:_,connectable:n,connectablestart:r,connectableend:s,clickconnecting:R,connectingfrom:M,connectingto:$,valid:I,connectionindicator:n&&(!H||V)&&(H||ee?s:r)}]),onMouseDown:D,onTouchStart:D,onClick:Q?E:void 0,ref:O,...m,children:h})}const bc=N.memo(tE(EX));function RX({data:t,isConnectable:e,sourcePosition:i=Re.Bottom}){return v.jsxs(v.Fragment,{children:[t==null?void 0:t.label,v.jsx(bc,{type:"source",position:i,isConnectable:e})]})}function AX({data:t,isConnectable:e,targetPosition:i=Re.Top,sourcePosition:n=Re.Bottom}){return v.jsxs(v.Fragment,{children:[v.jsx(bc,{type:"target",position:i,isConnectable:e}),t==null?void 0:t.label,v.jsx(bc,{type:"source",position:n,isConnectable:e})]})}function MX(){return null}function zX({data:t,isConnectable:e,targetPosition:i=Re.Top}){return v.jsxs(v.Fragment,{children:[v.jsx(bc,{type:"target",position:i,isConnectable:e}),t==null?void 0:t.label]})}const fg={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},GC={input:RX,default:AX,output:zX,group:MX};function jX(t){var e,i,n,r;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((e=t.style)==null?void 0:e.width),height:t.height??t.initialHeight??((i=t.style)==null?void 0:i.height)}:{width:t.width??((n=t.style)==null?void 0:n.width),height:t.height??((r=t.style)==null?void 0:r.height)}}const DX=t=>{const{width:e,height:i,x:n,y:r}=ed(t.nodeLookup,{filter:s=>!!s.selected});return{width:Or(e)?e:null,height:Or(i)?i:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${n}px,${r}px)`}};function BX({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:i}){const n=jt(),{width:r,height:s,transformString:a,userSelectionActive:c}=at(DX,Mt),h=rE(),d=N.useRef(null);N.useEffect(()=>{var O;i||(O=d.current)==null||O.focus({preventScroll:!0})},[i]);const f=!c&&r!==null&&s!==null;if(nE({nodeRef:d,disabled:!f}),!f)return null;const g=t?O=>{const S=n.getState().nodes.filter(_=>_.selected);t(O,S)}:void 0,m=O=>{Object.prototype.hasOwnProperty.call(fg,O.key)&&(O.preventDefault(),h({direction:fg[O.key],factor:O.shiftKey?4:1}))};return v.jsx("div",{className:ai(["react-flow__nodesselection","react-flow__container",e]),style:{transform:a},children:v.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:i?void 0:-1,onKeyDown:i?void 0:m,style:{width:r,height:s}})})}const FC=typeof window<"u"?window:void 0,LX=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function oE({children:t,onPaneClick:e,onPaneMouseEnter:i,onPaneMouseMove:n,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:c,deleteKeyCode:h,selectionKeyCode:d,selectionOnDrag:f,selectionMode:g,onSelectionStart:m,onSelectionEnd:O,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:w,elementsSelectable:x,zoomOnScroll:Q,zoomOnPinch:k,panOnScroll:T,panOnScrollSpeed:M,panOnScrollMode:$,zoomOnDoubleClick:R,panOnDrag:V,defaultViewport:H,translateExtent:ee,minZoom:I,maxZoom:j,preventScrolling:D,onSelectionContextMenu:E,noWheelClassName:X,noPanClassName:P,disableKeyboardA11y:Z,onViewportChange:L,isControlledViewport:B}){const{nodesSelectionActive:G,userSelectionActive:z}=at(LX,Mt),q=Qu(d,{target:FC}),K=Qu(_,{target:FC}),ie=K||V,ce=K||T,de=f&&ie!==!0,pe=q||z||de;return yX({deleteKeyCode:h,multiSelectionKeyCode:S}),v.jsx(_X,{onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:Q,zoomOnPinch:k,panOnScroll:ce,panOnScrollSpeed:M,panOnScrollMode:$,zoomOnDoubleClick:R,panOnDrag:!q&&ie,defaultViewport:H,translateExtent:ee,minZoom:I,maxZoom:j,zoomActivationKeyCode:w,preventScrolling:D,noWheelClassName:X,noPanClassName:P,onViewportChange:L,isControlledViewport:B,paneClickDistance:c,selectionOnDrag:de,children:v.jsxs(CX,{onSelectionStart:m,onSelectionEnd:O,onPaneClick:e,onPaneMouseEnter:i,onPaneMouseMove:n,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:ie,isSelecting:!!pe,selectionMode:g,selectionKeyPressed:q,paneClickDistance:c,selectionOnDrag:de,children:[t,G&&v.jsx(BX,{onSelectionContextMenu:E,noPanClassName:P,disableKeyboardA11y:Z})]})})}oE.displayName="FlowRenderer";const XX=N.memo(oE),NX=t=>e=>t?P1(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(i=>i.id):Array.from(e.nodeLookup.keys());function ZX(t){return at(N.useCallback(NX(t),[t]),Mt)}const WX=t=>t.updateNodeInternals;function qX(){const t=at(WX),[e]=N.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const n=new Map;i.forEach(r=>{const s=r.target.getAttribute("data-id");n.set(s,{id:s,nodeElement:r.target,force:!0})}),t(n)}));return N.useEffect(()=>()=>{e==null||e.disconnect()},[e]),e}function VX({node:t,nodeType:e,hasDimensions:i,resizeObserver:n}){const r=jt(),s=N.useRef(null),a=N.useRef(null),c=N.useRef(t.sourcePosition),h=N.useRef(t.targetPosition),d=N.useRef(e),f=i&&!!t.internals.handleBounds;return N.useEffect(()=>{s.current&&!t.hidden&&(!f||a.current!==s.current)&&(a.current&&(n==null||n.unobserve(a.current)),n==null||n.observe(s.current),a.current=s.current)},[f,t.hidden]),N.useEffect(()=>()=>{a.current&&(n==null||n.unobserve(a.current),a.current=null)},[]),N.useEffect(()=>{if(s.current){const g=d.current!==e,m=c.current!==t.sourcePosition,O=h.current!==t.targetPosition;(g||m||O)&&(d.current=e,c.current=t.sourcePosition,h.current=t.targetPosition,r.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:s.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),s}function IX({id:t,onClick:e,onMouseEnter:i,onMouseMove:n,onMouseLeave:r,onContextMenu:s,onDoubleClick:a,nodesDraggable:c,elementsSelectable:h,nodesConnectable:d,nodesFocusable:f,resizeObserver:g,noDragClassName:m,noPanClassName:O,disableKeyboardA11y:S,rfId:_,nodeTypes:w,nodeClickDistance:x,onError:Q}){const{node:k,internals:T,isParent:M}=at(fe=>{const ve=fe.nodeLookup.get(t),De=fe.parentLookup.has(t);return{node:ve,internals:ve.internals,isParent:De}},Mt);let $=k.type||"default",R=(w==null?void 0:w[$])||GC[$];R===void 0&&(Q==null||Q("003",Ur.error003($)),$="default",R=(w==null?void 0:w.default)||GC.default);const V=!!(k.draggable||c&&typeof k.draggable>"u"),H=!!(k.selectable||h&&typeof k.selectable>"u"),ee=!!(k.connectable||d&&typeof k.connectable>"u"),I=!!(k.focusable||f&&typeof k.focusable>"u"),j=jt(),D=$P(k),E=VX({node:k,nodeType:$,hasDimensions:D,resizeObserver:g}),X=nE({nodeRef:E,disabled:k.hidden||!V,noDragClassName:m,handleSelector:k.dragHandle,nodeId:t,isSelectable:H,nodeClickDistance:x}),P=rE();if(k.hidden)return null;const Z=Ds(k),L=jX(k),B=H||V||e||i||n||r,G=i?fe=>i(fe,{...T.userNode}):void 0,z=n?fe=>n(fe,{...T.userNode}):void 0,q=r?fe=>r(fe,{...T.userNode}):void 0,K=s?fe=>s(fe,{...T.userNode}):void 0,ie=a?fe=>a(fe,{...T.userNode}):void 0,ce=fe=>{const{selectNodesOnDrag:ve,nodeDragThreshold:De}=j.getState();H&&(!ve||!V||De>0)&&jy({id:t,store:j,nodeRef:E}),e&&e(fe,{...T.userNode})},de=fe=>{if(!(RP(fe.nativeEvent)||S)){if(SP.includes(fe.key)&&H){const ve=fe.key==="Escape";jy({id:t,store:j,unselect:ve,nodeRef:E})}else if(V&&k.selected&&Object.prototype.hasOwnProperty.call(fg,fe.key)){fe.preventDefault();const{ariaLabelConfig:ve}=j.getState();j.setState({ariaLiveMessage:ve["node.a11yDescription.ariaLiveMessage"]({direction:fe.key.replace("Arrow","").toLowerCase(),x:~~T.positionAbsolute.x,y:~~T.positionAbsolute.y})}),P({direction:fg[fe.key],factor:fe.shiftKey?4:1})}}},pe=()=>{var Be;if(S||!((Be=E.current)!=null&&Be.matches(":focus-visible")))return;const{transform:fe,width:ve,height:De,autoPanOnNodeFocus:Ee,setCenter:ke}=j.getState();if(!Ee)return;P1(new Map([[t,k]]),{x:0,y:0,width:ve,height:De},fe,!0).length>0||ke(k.position.x+Z.width/2,k.position.y+Z.height/2,{zoom:fe[2]})};return v.jsx("div",{className:ai(["react-flow__node",`react-flow__node-${$}`,{[O]:V},k.className,{selected:k.selected,selectable:H,parent:M,draggable:V,dragging:X}]),ref:E,style:{zIndex:T.z,transform:`translate(${T.positionAbsolute.x}px,${T.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:D?"visible":"hidden",...k.style,...L},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:G,onMouseMove:z,onMouseLeave:q,onContextMenu:K,onClick:ce,onDoubleClick:ie,onKeyDown:I?de:void 0,tabIndex:I?0:void 0,onFocus:I?pe:void 0,role:k.ariaRole??(I?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${FP}-${_}`,"aria-label":k.ariaLabel,...k.domAttributes,children:v.jsx(QX,{value:t,children:v.jsx(R,{id:t,data:k.data,type:$,positionAbsoluteX:T.positionAbsolute.x,positionAbsoluteY:T.positionAbsolute.y,selected:k.selected??!1,selectable:H,draggable:V,deletable:k.deletable??!0,isConnectable:ee,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:X,dragHandle:k.dragHandle,zIndex:T.z,parentId:k.parentId,...Z})})})}var YX=N.memo(IX);const HX=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function aE(t){const{nodesDraggable:e,nodesConnectable:i,nodesFocusable:n,elementsSelectable:r,onError:s}=at(HX,Mt),a=ZX(t.onlyRenderVisibleElements),c=qX();return v.jsx("div",{className:"react-flow__nodes",style:um,children:a.map(h=>v.jsx(YX,{id:h,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:c,nodesDraggable:e,nodesConnectable:i,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:t.nodeClickDistance,onError:s},h))})}aE.displayName="NodeRenderer";const UX=N.memo(aE);function GX(t){return at(N.useCallback(i=>{if(!t)return i.edges.map(r=>r.id);const n=[];if(i.width&&i.height)for(const r of i.edges){const s=i.nodeLookup.get(r.source),a=i.nodeLookup.get(r.target);s&&a&&YL({sourceNode:s,targetNode:a,width:i.width,height:i.height,transform:i.transform})&&n.push(r.id)}return n},[t]),Mt)}const FX=({color:t="none",strokeWidth:e=1})=>{const i={strokeWidth:e,...t&&{stroke:t}};return v.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},KX=({color:t="none",strokeWidth:e=1})=>{const i={strokeWidth:e,...t&&{stroke:t,fill:t}};return v.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},KC={[hg.Arrow]:FX,[hg.ArrowClosed]:KX};function JX(t){const e=jt();return N.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(KC,t)?KC[t]:((s=(r=e.getState()).onError)==null||s.call(r,"009",Ur.error009(t)),null)},[t])}const eN=({id:t,type:e,color:i,width:n=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:c="auto-start-reverse"})=>{const h=JX(e);return h?v.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${n}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:v.jsx(h,{color:i,strokeWidth:a})}):null},lE=({defaultColor:t,rfId:e})=>{const i=at(s=>s.edges),n=at(s=>s.defaultEdgeOptions),r=N.useMemo(()=>t6(i,{id:e,defaultColor:t,defaultMarkerStart:n==null?void 0:n.markerStart,defaultMarkerEnd:n==null?void 0:n.markerEnd}),[i,n,e,t]);return r.length?v.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:v.jsx("defs",{children:r.map(s=>v.jsx(eN,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};lE.displayName="MarkerDefinitions";var tN=N.memo(lE);function cE({x:t,y:e,label:i,labelStyle:n,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:c=2,children:h,className:d,...f}){const[g,m]=N.useState({x:1,y:0,width:0,height:0}),O=ai(["react-flow__edge-textwrapper",d]),S=N.useRef(null);return N.useEffect(()=>{if(S.current){const _=S.current.getBBox();m({x:_.x,y:_.y,width:_.width,height:_.height})}},[i]),i?v.jsxs("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:O,visibility:g.width?"visible":"hidden",...f,children:[r&&v.jsx("rect",{width:g.width+2*a[0],x:-a[0],y:-a[1],height:g.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:c,ry:c}),v.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:S,style:n,children:i}),h]}):null}cE.displayName="EdgeText";const iN=N.memo(cE);function dm({path:t,labelX:e,labelY:i,label:n,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:h,interactionWidth:d=20,...f}){return v.jsxs(v.Fragment,{children:[v.jsx("path",{...f,d:t,fill:"none",className:ai(["react-flow__edge-path",f.className])}),d?v.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,n&&Or(e)&&Or(i)?v.jsx(iN,{x:e,y:i,label:n,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:h}):null]})}function JC({pos:t,x1:e,y1:i,x2:n,y2:r}){return t===Re.Left||t===Re.Right?[.5*(e+n),i]:[e,.5*(i+r)]}function hE({sourceX:t,sourceY:e,sourcePosition:i=Re.Bottom,targetX:n,targetY:r,targetPosition:s=Re.Top}){const[a,c]=JC({pos:i,x1:t,y1:e,x2:n,y2:r}),[h,d]=JC({pos:s,x1:n,y1:r,x2:t,y2:e}),[f,g,m,O]=MP({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:h,targetControlY:d});return[`M${t},${e} C${a},${c} ${h},${d} ${n},${r}`,f,g,m,O]}function uE(t){return N.memo(({id:e,sourceX:i,sourceY:n,targetX:r,targetY:s,sourcePosition:a,targetPosition:c,label:h,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:O,style:S,markerEnd:_,markerStart:w,interactionWidth:x})=>{const[Q,k,T]=hE({sourceX:i,sourceY:n,sourcePosition:a,targetX:r,targetY:s,targetPosition:c}),M=t.isInternal?void 0:e;return v.jsx(dm,{id:M,path:Q,labelX:k,labelY:T,label:h,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:O,style:S,markerEnd:_,markerStart:w,interactionWidth:x})})}const nN=uE({isInternal:!1}),dE=uE({isInternal:!0});nN.displayName="SimpleBezierEdge";dE.displayName="SimpleBezierEdgeInternal";function fE(t){return N.memo(({id:e,sourceX:i,sourceY:n,targetX:r,targetY:s,label:a,labelStyle:c,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,sourcePosition:O=Re.Bottom,targetPosition:S=Re.Top,markerEnd:_,markerStart:w,pathOptions:x,interactionWidth:Q})=>{const[k,T,M]=Ey({sourceX:i,sourceY:n,sourcePosition:O,targetX:r,targetY:s,targetPosition:S,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset,stepPosition:x==null?void 0:x.stepPosition}),$=t.isInternal?void 0:e;return v.jsx(dm,{id:$,path:k,labelX:T,labelY:M,label:a,labelStyle:c,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,markerEnd:_,markerStart:w,interactionWidth:Q})})}const pE=fE({isInternal:!1}),gE=fE({isInternal:!0});pE.displayName="SmoothStepEdge";gE.displayName="SmoothStepEdgeInternal";function mE(t){return N.memo(({id:e,...i})=>{var r;const n=t.isInternal?void 0:e;return v.jsx(pE,{...i,id:n,pathOptions:N.useMemo(()=>{var s;return{borderRadius:0,offset:(s=i.pathOptions)==null?void 0:s.offset}},[(r=i.pathOptions)==null?void 0:r.offset])})})}const rN=mE({isInternal:!1}),OE=mE({isInternal:!0});rN.displayName="StepEdge";OE.displayName="StepEdgeInternal";function vE(t){return N.memo(({id:e,sourceX:i,sourceY:n,targetX:r,targetY:s,label:a,labelStyle:c,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,markerEnd:O,markerStart:S,interactionWidth:_})=>{const[w,x,Q]=DP({sourceX:i,sourceY:n,targetX:r,targetY:s}),k=t.isInternal?void 0:e;return v.jsx(dm,{id:k,path:w,labelX:x,labelY:Q,label:a,labelStyle:c,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,markerEnd:O,markerStart:S,interactionWidth:_})})}const sN=vE({isInternal:!1}),yE=vE({isInternal:!0});sN.displayName="StraightEdge";yE.displayName="StraightEdgeInternal";function SE(t){return N.memo(({id:e,sourceX:i,sourceY:n,targetX:r,targetY:s,sourcePosition:a=Re.Bottom,targetPosition:c=Re.Top,label:h,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:O,style:S,markerEnd:_,markerStart:w,pathOptions:x,interactionWidth:Q})=>{const[k,T,M]=zP({sourceX:i,sourceY:n,sourcePosition:a,targetX:r,targetY:s,targetPosition:c,curvature:x==null?void 0:x.curvature}),$=t.isInternal?void 0:e;return v.jsx(dm,{id:$,path:k,labelX:T,labelY:M,label:h,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:O,style:S,markerEnd:_,markerStart:w,interactionWidth:Q})})}const oN=SE({isInternal:!1}),bE=SE({isInternal:!0});oN.displayName="BezierEdge";bE.displayName="BezierEdgeInternal";const e2={default:bE,straight:yE,step:OE,smoothstep:gE,simplebezier:dE},t2={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},aN=(t,e,i)=>i===Re.Left?t-e:i===Re.Right?t+e:t,lN=(t,e,i)=>i===Re.Top?t-e:i===Re.Bottom?t+e:t,i2="react-flow__edgeupdater";function n2({position:t,centerX:e,centerY:i,radius:n=10,onMouseDown:r,onMouseEnter:s,onMouseOut:a,type:c}){return v.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:a,className:ai([i2,`${i2}-${c}`]),cx:aN(e,n,t),cy:lN(i,n,t),r:n,stroke:"transparent",fill:"transparent"})}function cN({isReconnectable:t,reconnectRadius:e,edge:i,sourceX:n,sourceY:r,targetX:s,targetY:a,sourcePosition:c,targetPosition:h,onReconnect:d,onReconnectStart:f,onReconnectEnd:g,setReconnecting:m,setUpdateHover:O}){const S=jt(),_=(T,M)=>{if(T.button!==0)return;const{autoPanOnConnect:$,domNode:R,connectionMode:V,connectionRadius:H,lib:ee,onConnectStart:I,cancelConnection:j,nodeLookup:D,rfId:E,panBy:X,updateConnection:P}=S.getState(),Z=M.type==="target",L=(z,q)=>{m(!1),g==null||g(z,i,M.type,q)},B=z=>d==null?void 0:d(i,z),G=(z,q)=>{m(!0),f==null||f(T,i,M.type),I==null||I(z,q)};My.onPointerDown(T.nativeEvent,{autoPanOnConnect:$,connectionMode:V,connectionRadius:H,domNode:R,handleId:M.id,nodeId:M.nodeId,nodeLookup:D,isTarget:Z,edgeUpdaterType:M.type,lib:ee,flowId:E,cancelConnection:j,panBy:X,isValidConnection:(...z)=>{var q,K;return((K=(q=S.getState()).isValidConnection)==null?void 0:K.call(q,...z))??!0},onConnect:B,onConnectStart:G,onConnectEnd:(...z)=>{var q,K;return(K=(q=S.getState()).onConnectEnd)==null?void 0:K.call(q,...z)},onReconnectEnd:L,updateConnection:P,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:T.currentTarget})},w=T=>_(T,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),x=T=>_(T,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),Q=()=>O(!0),k=()=>O(!1);return v.jsxs(v.Fragment,{children:[(t===!0||t==="source")&&v.jsx(n2,{position:c,centerX:n,centerY:r,radius:e,onMouseDown:w,onMouseEnter:Q,onMouseOut:k,type:"source"}),(t===!0||t==="target")&&v.jsx(n2,{position:h,centerX:s,centerY:a,radius:e,onMouseDown:x,onMouseEnter:Q,onMouseOut:k,type:"target"})]})}function hN({id:t,edgesFocusable:e,edgesReconnectable:i,elementsSelectable:n,onClick:r,onDoubleClick:s,onContextMenu:a,onMouseEnter:c,onMouseMove:h,onMouseLeave:d,reconnectRadius:f,onReconnect:g,onReconnectStart:m,onReconnectEnd:O,rfId:S,edgeTypes:_,noPanClassName:w,onError:x,disableKeyboardA11y:Q}){let k=at(ke=>ke.edgeLookup.get(t));const T=at(ke=>ke.defaultEdgeOptions);k=T?{...T,...k}:k;let M=k.type||"default",$=(_==null?void 0:_[M])||e2[M];$===void 0&&(x==null||x("011",Ur.error011(M)),M="default",$=(_==null?void 0:_.default)||e2.default);const R=!!(k.focusable||e&&typeof k.focusable>"u"),V=typeof g<"u"&&(k.reconnectable||i&&typeof k.reconnectable>"u"),H=!!(k.selectable||n&&typeof k.selectable>"u"),ee=N.useRef(null),[I,j]=N.useState(!1),[D,E]=N.useState(!1),X=jt(),{zIndex:P,sourceX:Z,sourceY:L,targetX:B,targetY:G,sourcePosition:z,targetPosition:q}=at(N.useCallback(ke=>{const me=ke.nodeLookup.get(k.source),Be=ke.nodeLookup.get(k.target);if(!me||!Be)return{zIndex:k.zIndex,...t2};const lt=e6({id:t,sourceNode:me,targetNode:Be,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:ke.connectionMode,onError:x});return{zIndex:IL({selected:k.selected,zIndex:k.zIndex,sourceNode:me,targetNode:Be,elevateOnSelect:ke.elevateEdgesOnSelect,zIndexMode:ke.zIndexMode}),...lt||t2}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),Mt),K=N.useMemo(()=>k.markerStart?`url('#${Ry(k.markerStart,S)}')`:void 0,[k.markerStart,S]),ie=N.useMemo(()=>k.markerEnd?`url('#${Ry(k.markerEnd,S)}')`:void 0,[k.markerEnd,S]);if(k.hidden||Z===null||L===null||B===null||G===null)return null;const ce=ke=>{var Ue;const{addSelectedEdges:me,unselectNodesAndEdges:Be,multiSelectionActive:lt}=X.getState();H&&(X.setState({nodesSelectionActive:!1}),k.selected&&lt?(Be({nodes:[],edges:[k]}),(Ue=ee.current)==null||Ue.blur()):me([t])),r&&r(ke,k)},de=s?ke=>{s(ke,{...k})}:void 0,pe=a?ke=>{a(ke,{...k})}:void 0,fe=c?ke=>{c(ke,{...k})}:void 0,ve=h?ke=>{h(ke,{...k})}:void 0,De=d?ke=>{d(ke,{...k})}:void 0,Ee=ke=>{var me;if(!Q&&SP.includes(ke.key)&&H){const{unselectNodesAndEdges:Be,addSelectedEdges:lt}=X.getState();ke.key==="Escape"?((me=ee.current)==null||me.blur(),Be({edges:[k]})):lt([t])}};return v.jsx("svg",{style:{zIndex:P},children:v.jsxs("g",{className:ai(["react-flow__edge",`react-flow__edge-${M}`,k.className,w,{selected:k.selected,animated:k.animated,inactive:!H&&!r,updating:I,selectable:H}]),onClick:ce,onDoubleClick:de,onContextMenu:pe,onMouseEnter:fe,onMouseMove:ve,onMouseLeave:De,onKeyDown:R?Ee:void 0,tabIndex:R?0:void 0,role:k.ariaRole??(R?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":k.ariaLabel===null?void 0:k.ariaLabel||`Edge from ${k.source} to ${k.target}`,"aria-describedby":R?`${KP}-${S}`:void 0,ref:ee,...k.domAttributes,children:[!D&&v.jsx($,{id:t,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:H,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:Z,sourceY:L,targetX:B,targetY:G,sourcePosition:z,targetPosition:q,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:K,markerEnd:ie,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),V&&v.jsx(cN,{edge:k,isReconnectable:V,reconnectRadius:f,onReconnect:g,onReconnectStart:m,onReconnectEnd:O,sourceX:Z,sourceY:L,targetX:B,targetY:G,sourcePosition:z,targetPosition:q,setUpdateHover:j,setReconnecting:E})]})})}var uN=N.memo(hN);const dN=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function _E({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:i,edgeTypes:n,noPanClassName:r,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:c,onEdgeMouseMove:h,onEdgeMouseLeave:d,onEdgeClick:f,reconnectRadius:g,onEdgeDoubleClick:m,onReconnectStart:O,onReconnectEnd:S,disableKeyboardA11y:_}){const{edgesFocusable:w,edgesReconnectable:x,elementsSelectable:Q,onError:k}=at(dN,Mt),T=GX(e);return v.jsxs("div",{className:"react-flow__edges",children:[v.jsx(tN,{defaultColor:t,rfId:i}),T.map(M=>v.jsx(uN,{id:M,edgesFocusable:w,edgesReconnectable:x,elementsSelectable:Q,noPanClassName:r,onReconnect:s,onContextMenu:a,onMouseEnter:c,onMouseMove:h,onMouseLeave:d,onClick:f,reconnectRadius:g,onDoubleClick:m,onReconnectStart:O,onReconnectEnd:S,rfId:i,onError:k,edgeTypes:n,disableKeyboardA11y:_},M))]})}_E.displayName="EdgeRenderer";const fN=N.memo(_E),pN=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function gN({children:t}){const e=at(pN);return v.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function mN(t){const e=hm(),i=N.useRef(!1);N.useEffect(()=>{!i.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),i.current=!0)},[t,e.viewportInitialized])}const ON=t=>{var e;return(e=t.panZoom)==null?void 0:e.syncViewport};function vN(t){const e=at(ON),i=jt();return N.useEffect(()=>{t&&(e==null||e(t),i.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function yN(t){return t.connection.inProgress?{...t.connection,to:id(t.connection.to,t.transform)}:{...t.connection}}function SN(t){return yN}function bN(t){const e=SN();return at(e,Mt)}const _N=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function xN({containerStyle:t,style:e,type:i,component:n}){const{nodesConnectable:r,width:s,height:a,isValid:c,inProgress:h}=at(_N,Mt);return!(s&&r&&h)?null:v.jsx("svg",{style:t,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:v.jsx("g",{className:ai(["react-flow__connection",xP(c)]),children:v.jsx(xE,{style:e,type:i,CustomComponent:n,isValid:c})})})}const xE=({style:t,type:e=Eo.Bezier,CustomComponent:i,isValid:n})=>{const{inProgress:r,from:s,fromNode:a,fromHandle:c,fromPosition:h,to:d,toNode:f,toHandle:g,toPosition:m,pointer:O}=bN();if(!r)return;if(i)return v.jsx(i,{connectionLineType:e,connectionLineStyle:t,fromNode:a,fromHandle:c,fromX:s.x,fromY:s.y,toX:d.x,toY:d.y,fromPosition:h,toPosition:m,connectionStatus:xP(n),toNode:f,toHandle:g,pointer:O});let S="";const _={sourceX:s.x,sourceY:s.y,sourcePosition:h,targetX:d.x,targetY:d.y,targetPosition:m};switch(e){case Eo.Bezier:[S]=zP(_);break;case Eo.SimpleBezier:[S]=hE(_);break;case Eo.Step:[S]=Ey({..._,borderRadius:0});break;case Eo.SmoothStep:[S]=Ey(_);break;default:[S]=DP(_)}return v.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:t})};xE.displayName="ConnectionLine";const wN={};function r2(t=wN){N.useRef(t),jt(),N.useEffect(()=>{},[t])}function kN(){jt(),N.useRef(!1),N.useEffect(()=>{},[])}function wE({nodeTypes:t,edgeTypes:e,onInit:i,onNodeClick:n,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:h,onNodeMouseLeave:d,onNodeContextMenu:f,onSelectionContextMenu:g,onSelectionStart:m,onSelectionEnd:O,connectionLineType:S,connectionLineStyle:_,connectionLineComponent:w,connectionLineContainerStyle:x,selectionKeyCode:Q,selectionOnDrag:k,selectionMode:T,multiSelectionKeyCode:M,panActivationKeyCode:$,zoomActivationKeyCode:R,deleteKeyCode:V,onlyRenderVisibleElements:H,elementsSelectable:ee,defaultViewport:I,translateExtent:j,minZoom:D,maxZoom:E,preventScrolling:X,defaultMarkerColor:P,zoomOnScroll:Z,zoomOnPinch:L,panOnScroll:B,panOnScrollSpeed:G,panOnScrollMode:z,zoomOnDoubleClick:q,panOnDrag:K,onPaneClick:ie,onPaneMouseEnter:ce,onPaneMouseMove:de,onPaneMouseLeave:pe,onPaneScroll:fe,onPaneContextMenu:ve,paneClickDistance:De,nodeClickDistance:Ee,onEdgeContextMenu:ke,onEdgeMouseEnter:me,onEdgeMouseMove:Be,onEdgeMouseLeave:lt,reconnectRadius:Ue,onReconnect:Ft,onReconnectStart:rn,onReconnectEnd:qi,noDragClassName:_n,noWheelClassName:ar,noPanClassName:oe,disableKeyboardA11y:We,nodeExtent:Le,rfId:sn,viewport:on,onViewportChange:Vi}){return r2(t),r2(e),kN(),mN(i),vN(on),v.jsx(XX,{onPaneClick:ie,onPaneMouseEnter:ce,onPaneMouseMove:de,onPaneMouseLeave:pe,onPaneContextMenu:ve,onPaneScroll:fe,paneClickDistance:De,deleteKeyCode:V,selectionKeyCode:Q,selectionOnDrag:k,selectionMode:T,onSelectionStart:m,onSelectionEnd:O,multiSelectionKeyCode:M,panActivationKeyCode:$,zoomActivationKeyCode:R,elementsSelectable:ee,zoomOnScroll:Z,zoomOnPinch:L,zoomOnDoubleClick:q,panOnScroll:B,panOnScrollSpeed:G,panOnScrollMode:z,panOnDrag:K,defaultViewport:I,translateExtent:j,minZoom:D,maxZoom:E,onSelectionContextMenu:g,preventScrolling:X,noDragClassName:_n,noWheelClassName:ar,noPanClassName:oe,disableKeyboardA11y:We,onViewportChange:Vi,isControlledViewport:!!on,children:v.jsxs(gN,{children:[v.jsx(fN,{edgeTypes:e,onEdgeClick:r,onEdgeDoubleClick:a,onReconnect:Ft,onReconnectStart:rn,onReconnectEnd:qi,onlyRenderVisibleElements:H,onEdgeContextMenu:ke,onEdgeMouseEnter:me,onEdgeMouseMove:Be,onEdgeMouseLeave:lt,reconnectRadius:Ue,defaultMarkerColor:P,noPanClassName:oe,disableKeyboardA11y:We,rfId:sn}),v.jsx(xN,{style:_,type:S,component:w,containerStyle:x}),v.jsx("div",{className:"react-flow__edgelabel-renderer"}),v.jsx(UX,{nodeTypes:t,onNodeClick:n,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:h,onNodeMouseLeave:d,onNodeContextMenu:f,nodeClickDistance:Ee,onlyRenderVisibleElements:H,noPanClassName:oe,noDragClassName:_n,disableKeyboardA11y:We,nodeExtent:Le,rfId:sn}),v.jsx("div",{className:"react-flow__viewport-portal"})]})})}wE.displayName="GraphView";const CN=N.memo(wE),s2=({nodes:t,edges:e,defaultNodes:i,defaultEdges:n,width:r,height:s,fitView:a,fitViewOptions:c,minZoom:h=.5,maxZoom:d=2,nodeOrigin:f,nodeExtent:g,zIndexMode:m="basic"}={})=>{const O=new Map,S=new Map,_=new Map,w=new Map,x=n??e??[],Q=i??t??[],k=f??[0,0],T=g??wu;XP(_,w,x);const{nodesInitialized:M}=Ay(Q,O,S,{nodeOrigin:k,nodeExtent:T,zIndexMode:m});let $=[0,0,1];if(a&&r&&s){const R=ed(O,{filter:I=>!!((I.width||I.initialWidth)&&(I.height||I.initialHeight))}),{x:V,y:H,zoom:ee}=E1(R,r,s,h,d,(c==null?void 0:c.padding)??.1);$=[V,H,ee]}return{rfId:"1",width:r??0,height:s??0,transform:$,nodes:Q,nodesInitialized:M,nodeLookup:O,parentLookup:S,edges:x,edgeLookup:w,connectionLookup:_,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:n!==void 0,panZoom:null,minZoom:h,maxZoom:d,translateExtent:wu,nodeExtent:T,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:mc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:k,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:c,fitViewResolver:null,connection:{..._P},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:XL,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:bP,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},TN=({nodes:t,edges:e,defaultNodes:i,defaultEdges:n,width:r,height:s,fitView:a,fitViewOptions:c,minZoom:h,maxZoom:d,nodeOrigin:f,nodeExtent:g,zIndexMode:m})=>q6((O,S)=>{async function _(){const{nodeLookup:w,panZoom:x,fitViewOptions:Q,fitViewResolver:k,width:T,height:M,minZoom:$,maxZoom:R}=S();x&&(await BL({nodes:w,width:T,height:M,panZoom:x,minZoom:$,maxZoom:R},Q),k==null||k.resolve(!0),O({fitViewResolver:null}))}return{...s2({nodes:t,edges:e,width:r,height:s,fitView:a,fitViewOptions:c,minZoom:h,maxZoom:d,nodeOrigin:f,nodeExtent:g,defaultNodes:i,defaultEdges:n,zIndexMode:m}),setNodes:w=>{const{nodeLookup:x,parentLookup:Q,nodeOrigin:k,elevateNodesOnSelect:T,fitViewQueued:M,zIndexMode:$,nodesSelectionActive:R}=S(),{nodesInitialized:V,hasSelectedNodes:H}=Ay(w,x,Q,{nodeOrigin:k,nodeExtent:g,elevateNodesOnSelect:T,checkEquality:!0,zIndexMode:$}),ee=R&&H;M&&V?(_(),O({nodes:w,nodesInitialized:V,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:ee})):O({nodes:w,nodesInitialized:V,nodesSelectionActive:ee})},setEdges:w=>{const{connectionLookup:x,edgeLookup:Q}=S();XP(x,Q,w),O({edges:w})},setDefaultNodesAndEdges:(w,x)=>{if(w){const{setNodes:Q}=S();Q(w),O({hasDefaultNodes:!0})}if(x){const{setEdges:Q}=S();Q(x),O({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:x,nodeLookup:Q,parentLookup:k,domNode:T,nodeOrigin:M,nodeExtent:$,debug:R,fitViewQueued:V,zIndexMode:H}=S(),{changes:ee,updatedInternals:I}=l6(w,Q,k,T,M,$,H);I&&(r6(Q,k,{nodeOrigin:M,nodeExtent:$,zIndexMode:H}),V?(_(),O({fitViewQueued:!1,fitViewOptions:void 0})):O({}),(ee==null?void 0:ee.length)>0&&(R&&console.log("React Flow: trigger node changes",ee),x==null||x(ee)))},updateNodePositions:(w,x=!1)=>{const Q=[];let k=[];const{nodeLookup:T,triggerNodeChanges:M,connection:$,updateConnection:R,onNodesChangeMiddlewareMap:V}=S();for(const[H,ee]of w){const I=T.get(H),j=!!(I!=null&&I.expandParent&&(I!=null&&I.parentId)&&(ee!=null&&ee.position)),D={id:H,type:"position",position:j?{x:Math.max(0,ee.position.x),y:Math.max(0,ee.position.y)}:ee.position,dragging:x};if(I&&$.inProgress&&$.fromNode.id===I.id){const E=Za(I,$.fromHandle,Re.Left,!0);R({...$,from:E})}j&&I.parentId&&Q.push({id:H,parentId:I.parentId,rect:{...ee.internals.positionAbsolute,width:ee.measured.width??0,height:ee.measured.height??0}}),k.push(D)}if(Q.length>0){const{parentLookup:H,nodeOrigin:ee}=S(),I=D1(Q,T,H,ee);k.push(...I)}for(const H of V.values())k=H(k);M(k)},triggerNodeChanges:w=>{const{onNodesChange:x,setNodes:Q,nodes:k,hasDefaultNodes:T,debug:M}=S();if(w!=null&&w.length){if(T){const $=uX(w,k);Q($)}M&&console.log("React Flow: trigger node changes",w),x==null||x(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:x,setEdges:Q,edges:k,hasDefaultEdges:T,debug:M}=S();if(w!=null&&w.length){if(T){const $=dX(w,k);Q($)}M&&console.log("React Flow: trigger edge changes",w),x==null||x(w)}},addSelectedNodes:w=>{const{multiSelectionActive:x,edgeLookup:Q,nodeLookup:k,triggerNodeChanges:T,triggerEdgeChanges:M}=S();if(x){const $=w.map(R=>ba(R,!0));T($);return}T(Fl(k,new Set([...w]),!0)),M(Fl(Q))},addSelectedEdges:w=>{const{multiSelectionActive:x,edgeLookup:Q,nodeLookup:k,triggerNodeChanges:T,triggerEdgeChanges:M}=S();if(x){const $=w.map(R=>ba(R,!0));M($);return}M(Fl(Q,new Set([...w]))),T(Fl(k,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:x}={})=>{const{edges:Q,nodes:k,nodeLookup:T,triggerNodeChanges:M,triggerEdgeChanges:$}=S(),R=w||k,V=x||Q,H=[];for(const I of R){if(!I.selected)continue;const j=T.get(I.id);j&&(j.selected=!1),H.push(ba(I.id,!1))}const ee=[];for(const I of V)I.selected&&ee.push(ba(I.id,!1));M(H),$(ee)},setMinZoom:w=>{const{panZoom:x,maxZoom:Q}=S();x==null||x.setScaleExtent([w,Q]),O({minZoom:w})},setMaxZoom:w=>{const{panZoom:x,minZoom:Q}=S();x==null||x.setScaleExtent([Q,w]),O({maxZoom:w})},setTranslateExtent:w=>{var x;(x=S().panZoom)==null||x.setTranslateExtent(w),O({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:x,triggerNodeChanges:Q,triggerEdgeChanges:k,elementsSelectable:T}=S();if(!T)return;const M=x.reduce((R,V)=>V.selected?[...R,ba(V.id,!1)]:R,[]),$=w.reduce((R,V)=>V.selected?[...R,ba(V.id,!1)]:R,[]);Q(M),k($)},setNodeExtent:w=>{const{nodes:x,nodeLookup:Q,parentLookup:k,nodeOrigin:T,elevateNodesOnSelect:M,nodeExtent:$,zIndexMode:R}=S();w[0][0]===$[0][0]&&w[0][1]===$[0][1]&&w[1][0]===$[1][0]&&w[1][1]===$[1][1]||(Ay(x,Q,k,{nodeOrigin:T,nodeExtent:w,elevateNodesOnSelect:M,checkEquality:!1,zIndexMode:R}),O({nodeExtent:w}))},panBy:w=>{const{transform:x,width:Q,height:k,panZoom:T,translateExtent:M}=S();return c6({delta:w,panZoom:T,transform:x,translateExtent:M,width:Q,height:k})},setCenter:async(w,x,Q)=>{const{width:k,height:T,maxZoom:M,panZoom:$}=S();if(!$)return Promise.resolve(!1);const R=typeof(Q==null?void 0:Q.zoom)<"u"?Q.zoom:M;return await $.setViewport({x:k/2-w*R,y:T/2-x*R,zoom:R},{duration:Q==null?void 0:Q.duration,ease:Q==null?void 0:Q.ease,interpolate:Q==null?void 0:Q.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{O({connection:{..._P}})},updateConnection:w=>{O({connection:w})},reset:()=>O({...s2()})}},Object.is);function kE({initialNodes:t,initialEdges:e,defaultNodes:i,defaultEdges:n,initialWidth:r,initialHeight:s,initialMinZoom:a,initialMaxZoom:c,initialFitViewOptions:h,fitView:d,nodeOrigin:f,nodeExtent:g,zIndexMode:m,children:O}){const[S]=N.useState(()=>TN({nodes:t,edges:e,defaultNodes:i,defaultEdges:n,width:r,height:s,fitView:d,minZoom:a,maxZoom:c,fitViewOptions:h,nodeOrigin:f,nodeExtent:g,zIndexMode:m}));return v.jsx(V6,{value:S,children:v.jsx(gX,{children:O})})}function QN({children:t,nodes:e,edges:i,defaultNodes:n,defaultEdges:r,width:s,height:a,fitView:c,fitViewOptions:h,minZoom:d,maxZoom:f,nodeOrigin:g,nodeExtent:m,zIndexMode:O}){return N.useContext(lm)?v.jsx(v.Fragment,{children:t}):v.jsx(kE,{initialNodes:e,initialEdges:i,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:a,fitView:c,initialFitViewOptions:h,initialMinZoom:d,initialMaxZoom:f,nodeOrigin:g,nodeExtent:m,zIndexMode:O,children:t})}const $N={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function PN({nodes:t,edges:e,defaultNodes:i,defaultEdges:n,className:r,nodeTypes:s,edgeTypes:a,onNodeClick:c,onEdgeClick:h,onInit:d,onMove:f,onMoveStart:g,onMoveEnd:m,onConnect:O,onConnectStart:S,onConnectEnd:_,onClickConnectStart:w,onClickConnectEnd:x,onNodeMouseEnter:Q,onNodeMouseMove:k,onNodeMouseLeave:T,onNodeContextMenu:M,onNodeDoubleClick:$,onNodeDragStart:R,onNodeDrag:V,onNodeDragStop:H,onNodesDelete:ee,onEdgesDelete:I,onDelete:j,onSelectionChange:D,onSelectionDragStart:E,onSelectionDrag:X,onSelectionDragStop:P,onSelectionContextMenu:Z,onSelectionStart:L,onSelectionEnd:B,onBeforeDelete:G,connectionMode:z,connectionLineType:q=Eo.Bezier,connectionLineStyle:K,connectionLineComponent:ie,connectionLineContainerStyle:ce,deleteKeyCode:de="Backspace",selectionKeyCode:pe="Shift",selectionOnDrag:fe=!1,selectionMode:ve=ku.Full,panActivationKeyCode:De="Space",multiSelectionKeyCode:Ee=Tu()?"Meta":"Control",zoomActivationKeyCode:ke=Tu()?"Meta":"Control",snapToGrid:me,snapGrid:Be,onlyRenderVisibleElements:lt=!1,selectNodesOnDrag:Ue,nodesDraggable:Ft,autoPanOnNodeFocus:rn,nodesConnectable:qi,nodesFocusable:_n,nodeOrigin:ar=JP,edgesFocusable:oe,edgesReconnectable:We,elementsSelectable:Le=!0,defaultViewport:sn=rX,minZoom:on=.5,maxZoom:Vi=2,translateExtent:Go=wu,preventScrolling:Rm=!0,nodeExtent:tl,defaultMarkerColor:Am="#b1b1b7",zoomOnScroll:Mm=!0,zoomOnPinch:Fo=!0,panOnScroll:Ii=!1,panOnScrollSpeed:wr=.5,panOnScrollMode:Yi=za.Free,zoomOnDoubleClick:zm=!0,panOnDrag:jm=!0,onPaneClick:Dm,onPaneMouseEnter:il,onPaneMouseMove:nl,onPaneMouseLeave:rl,onPaneScroll:Kr,onPaneContextMenu:sl,paneClickDistance:Ko=1,nodeClickDistance:Bm=0,children:Od,onReconnect:Lc,onReconnectStart:Jo,onReconnectEnd:Lm,onEdgeContextMenu:vd,onEdgeDoubleClick:yd,onEdgeMouseEnter:Sd,onEdgeMouseMove:Xc,onEdgeMouseLeave:Nc,reconnectRadius:bd=10,onNodesChange:_d,onEdgesChange:kr,noDragClassName:li="nodrag",noWheelClassName:Di="nowheel",noPanClassName:Jr="nopan",fitView:ol,fitViewOptions:xd,connectOnClick:Xm,attributionPosition:wd,proOptions:ea,defaultEdgeOptions:Zc,elevateNodesOnSelect:Zs=!0,elevateEdgesOnSelect:Ws=!1,disableKeyboardA11y:qs=!1,autoPanOnConnect:Vs,autoPanOnNodeDrag:Kt,autoPanSpeed:kd,connectionRadius:Cd,isValidConnection:es,onError:Is,style:Nm,id:Wc,nodeDragThreshold:Td,connectionDragThreshold:Zm,viewport:al,onViewportChange:ll,width:lr,height:an,colorMode:Qd="light",debug:Wm,onScroll:Ys,ariaLabelConfig:$d,zIndexMode:ta="basic",...qm},ln){const ia=Wc||"1",Pd=lX(Qd),qc=N.useCallback(ts=>{ts.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ys==null||Ys(ts)},[Ys]);return v.jsx("div",{"data-testid":"rf__wrapper",...qm,onScroll:qc,style:{...Nm,...$N},ref:ln,className:ai(["react-flow",r,Pd]),id:Wc,role:"application",children:v.jsxs(QN,{nodes:t,edges:e,width:lr,height:an,fitView:ol,fitViewOptions:xd,minZoom:on,maxZoom:Vi,nodeOrigin:ar,nodeExtent:tl,zIndexMode:ta,children:[v.jsx(aX,{nodes:t,edges:e,defaultNodes:i,defaultEdges:n,onConnect:O,onConnectStart:S,onConnectEnd:_,onClickConnectStart:w,onClickConnectEnd:x,nodesDraggable:Ft,autoPanOnNodeFocus:rn,nodesConnectable:qi,nodesFocusable:_n,edgesFocusable:oe,edgesReconnectable:We,elementsSelectable:Le,elevateNodesOnSelect:Zs,elevateEdgesOnSelect:Ws,minZoom:on,maxZoom:Vi,nodeExtent:tl,onNodesChange:_d,onEdgesChange:kr,snapToGrid:me,snapGrid:Be,connectionMode:z,translateExtent:Go,connectOnClick:Xm,defaultEdgeOptions:Zc,fitView:ol,fitViewOptions:xd,onNodesDelete:ee,onEdgesDelete:I,onDelete:j,onNodeDragStart:R,onNodeDrag:V,onNodeDragStop:H,onSelectionDrag:X,onSelectionDragStart:E,onSelectionDragStop:P,onMove:f,onMoveStart:g,onMoveEnd:m,noPanClassName:Jr,nodeOrigin:ar,rfId:ia,autoPanOnConnect:Vs,autoPanOnNodeDrag:Kt,autoPanSpeed:kd,onError:Is,connectionRadius:Cd,isValidConnection:es,selectNodesOnDrag:Ue,nodeDragThreshold:Td,connectionDragThreshold:Zm,onBeforeDelete:G,debug:Wm,ariaLabelConfig:$d,zIndexMode:ta}),v.jsx(CN,{onInit:d,onNodeClick:c,onEdgeClick:h,onNodeMouseEnter:Q,onNodeMouseMove:k,onNodeMouseLeave:T,onNodeContextMenu:M,onNodeDoubleClick:$,nodeTypes:s,edgeTypes:a,connectionLineType:q,connectionLineStyle:K,connectionLineComponent:ie,connectionLineContainerStyle:ce,selectionKeyCode:pe,selectionOnDrag:fe,selectionMode:ve,deleteKeyCode:de,multiSelectionKeyCode:Ee,panActivationKeyCode:De,zoomActivationKeyCode:ke,onlyRenderVisibleElements:lt,defaultViewport:sn,translateExtent:Go,minZoom:on,maxZoom:Vi,preventScrolling:Rm,zoomOnScroll:Mm,zoomOnPinch:Fo,zoomOnDoubleClick:zm,panOnScroll:Ii,panOnScrollSpeed:wr,panOnScrollMode:Yi,panOnDrag:jm,onPaneClick:Dm,onPaneMouseEnter:il,onPaneMouseMove:nl,onPaneMouseLeave:rl,onPaneScroll:Kr,onPaneContextMenu:sl,paneClickDistance:Ko,nodeClickDistance:Bm,onSelectionContextMenu:Z,onSelectionStart:L,onSelectionEnd:B,onReconnect:Lc,onReconnectStart:Jo,onReconnectEnd:Lm,onEdgeContextMenu:vd,onEdgeDoubleClick:yd,onEdgeMouseEnter:Sd,onEdgeMouseMove:Xc,onEdgeMouseLeave:Nc,reconnectRadius:bd,defaultMarkerColor:Am,noDragClassName:li,noWheelClassName:Di,noPanClassName:Jr,rfId:ia,disableKeyboardA11y:qs,nodeExtent:tl,viewport:al,onViewportChange:ll}),v.jsx(nX,{onSelectionChange:D}),Od,v.jsx(K6,{proOptions:ea,position:wd}),v.jsx(F6,{rfId:ia,disableKeyboardA11y:qs})]})})}var EN=tE(PN);function RN({dimensions:t,lineWidth:e,variant:i,className:n}){return v.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:ai(["react-flow__background-pattern",i,n])})}function AN({radius:t,className:e}){return v.jsx("circle",{cx:t,cy:t,r:t,className:ai(["react-flow__background-pattern","dots",e])})}var zo;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(zo||(zo={}));const MN={[zo.Dots]:1,[zo.Lines]:1,[zo.Cross]:6},zN=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function CE({id:t,variant:e=zo.Dots,gap:i=20,size:n,lineWidth:r=1,offset:s=0,color:a,bgColor:c,style:h,className:d,patternClassName:f}){const g=N.useRef(null),{transform:m,patternId:O}=at(zN,Mt),S=n||MN[e],_=e===zo.Dots,w=e===zo.Cross,x=Array.isArray(i)?i:[i,i],Q=[x[0]*m[2]||1,x[1]*m[2]||1],k=S*m[2],T=Array.isArray(s)?s:[s,s],M=w?[k,k]:Q,$=[T[0]*m[2]||1+M[0]/2,T[1]*m[2]||1+M[1]/2],R=`${O}${t||""}`;return v.jsxs("svg",{className:ai(["react-flow__background",d]),style:{...h,...um,"--xy-background-color-props":c,"--xy-background-pattern-color-props":a},ref:g,"data-testid":"rf__background",children:[v.jsx("pattern",{id:R,x:m[0]%Q[0],y:m[1]%Q[1],width:Q[0],height:Q[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${$[0]},-${$[1]})`,children:_?v.jsx(AN,{radius:k/2,className:f}):v.jsx(RN,{dimensions:M,lineWidth:r,variant:e,className:f})}),v.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}CE.displayName="Background";const jN=N.memo(CE);function DN(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:v.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function BN(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:v.jsx("path",{d:"M0 0h32v4.2H0z"})})}function LN(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:v.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function XN(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function NN(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Uf({children:t,className:e,...i}){return v.jsx("button",{type:"button",className:ai(["react-flow__controls-button",e]),...i,children:t})}const ZN=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function TE({style:t,showZoom:e=!0,showFitView:i=!0,showInteractive:n=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:a,onFitView:c,onInteractiveChange:h,className:d,children:f,position:g="bottom-left",orientation:m="vertical","aria-label":O}){const S=jt(),{isInteractive:_,minZoomReached:w,maxZoomReached:x,ariaLabelConfig:Q}=at(ZN,Mt),{zoomIn:k,zoomOut:T,fitView:M}=hm(),$=()=>{k(),s==null||s()},R=()=>{T(),a==null||a()},V=()=>{M(r),c==null||c()},H=()=>{S.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h==null||h(!_)},ee=m==="horizontal"?"horizontal":"vertical";return v.jsxs(cm,{className:ai(["react-flow__controls",ee,d]),position:g,style:t,"data-testid":"rf__controls","aria-label":O??Q["controls.ariaLabel"],children:[e&&v.jsxs(v.Fragment,{children:[v.jsx(Uf,{onClick:$,className:"react-flow__controls-zoomin",title:Q["controls.zoomIn.ariaLabel"],"aria-label":Q["controls.zoomIn.ariaLabel"],disabled:x,children:v.jsx(DN,{})}),v.jsx(Uf,{onClick:R,className:"react-flow__controls-zoomout",title:Q["controls.zoomOut.ariaLabel"],"aria-label":Q["controls.zoomOut.ariaLabel"],disabled:w,children:v.jsx(BN,{})})]}),i&&v.jsx(Uf,{className:"react-flow__controls-fitview",onClick:V,title:Q["controls.fitView.ariaLabel"],"aria-label":Q["controls.fitView.ariaLabel"],children:v.jsx(LN,{})}),n&&v.jsx(Uf,{className:"react-flow__controls-interactive",onClick:H,title:Q["controls.interactive.ariaLabel"],"aria-label":Q["controls.interactive.ariaLabel"],children:_?v.jsx(NN,{}):v.jsx(XN,{})}),f]})}TE.displayName="Controls";N.memo(TE);function WN({id:t,x:e,y:i,width:n,height:r,style:s,color:a,strokeColor:c,strokeWidth:h,className:d,borderRadius:f,shapeRendering:g,selected:m,onClick:O}){const{background:S,backgroundColor:_}=s||{},w=a||S||_;return v.jsx("rect",{className:ai(["react-flow__minimap-node",{selected:m},d]),x:e,y:i,rx:f,ry:f,width:n,height:r,style:{fill:w,stroke:c,strokeWidth:h},shapeRendering:g,onClick:O?x=>O(x,t):void 0})}const qN=N.memo(WN),VN=t=>t.nodes.map(e=>e.id),fv=t=>t instanceof Function?t:()=>t;function IN({nodeStrokeColor:t,nodeColor:e,nodeClassName:i="",nodeBorderRadius:n=5,nodeStrokeWidth:r,nodeComponent:s=qN,onClick:a}){const c=at(VN,Mt),h=fv(e),d=fv(t),f=fv(i),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return v.jsx(v.Fragment,{children:c.map(m=>v.jsx(HN,{id:m,nodeColorFunc:h,nodeStrokeColorFunc:d,nodeClassNameFunc:f,nodeBorderRadius:n,nodeStrokeWidth:r,NodeComponent:s,onClick:a,shapeRendering:g},m))})}function YN({id:t,nodeColorFunc:e,nodeStrokeColorFunc:i,nodeClassNameFunc:n,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:c,onClick:h}){const{node:d,x:f,y:g,width:m,height:O}=at(S=>{const _=S.nodeLookup.get(t);if(!_)return{node:void 0,x:0,y:0,width:0,height:0};const w=_.internals.userNode,{x,y:Q}=_.internals.positionAbsolute,{width:k,height:T}=Ds(w);return{node:w,x,y:Q,width:k,height:T}},Mt);return!d||d.hidden||!$P(d)?null:v.jsx(c,{x:f,y:g,width:m,height:O,style:d.style,selected:!!d.selected,className:n(d),color:e(d),borderRadius:r,strokeColor:i(d),strokeWidth:s,shapeRendering:a,onClick:h,id:d.id})}const HN=N.memo(YN);var UN=N.memo(IN);const GN=200,FN=150,KN=t=>!t.hidden,JN=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?QP(ed(t.nodeLookup,{filter:KN}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},e8="react-flow__minimap-desc";function QE({style:t,className:e,nodeStrokeColor:i,nodeColor:n,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:c,bgColor:h,maskColor:d,maskStrokeColor:f,maskStrokeWidth:g,position:m="bottom-right",onClick:O,onNodeClick:S,pannable:_=!1,zoomable:w=!1,ariaLabel:x,inversePan:Q,zoomStep:k=1,offsetScale:T=5}){const M=jt(),$=N.useRef(null),{boundingRect:R,viewBB:V,rfId:H,panZoom:ee,translateExtent:I,flowWidth:j,flowHeight:D,ariaLabelConfig:E}=at(JN,Mt),X=(t==null?void 0:t.width)??GN,P=(t==null?void 0:t.height)??FN,Z=R.width/X,L=R.height/P,B=Math.max(Z,L),G=B*X,z=B*P,q=T*B,K=R.x-(G-R.width)/2-q,ie=R.y-(z-R.height)/2-q,ce=G+q*2,de=z+q*2,pe=`${e8}-${H}`,fe=N.useRef(0),ve=N.useRef();fe.current=B,N.useEffect(()=>{if($.current&&ee)return ve.current=v6({domNode:$.current,panZoom:ee,getTransform:()=>M.getState().transform,getViewScale:()=>fe.current}),()=>{var me;(me=ve.current)==null||me.destroy()}},[ee]),N.useEffect(()=>{var me;(me=ve.current)==null||me.update({translateExtent:I,width:j,height:D,inversePan:Q,pannable:_,zoomStep:k,zoomable:w})},[_,w,Q,k,I,j,D]);const De=O?me=>{var Ue;const[Be,lt]=((Ue=ve.current)==null?void 0:Ue.pointer(me))||[0,0];O(me,{x:Be,y:lt})}:void 0,Ee=S?N.useCallback((me,Be)=>{const lt=M.getState().nodeLookup.get(Be).internals.userNode;S(me,lt)},[]):void 0,ke=x??E["minimap.ariaLabel"];return v.jsx(cm,{position:m,style:{...t,"--xy-minimap-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*B:void 0,"--xy-minimap-node-background-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:ai(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:v.jsxs("svg",{width:X,height:P,viewBox:`${K} ${ie} ${ce} ${de}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":pe,ref:$,onClick:De,children:[ke&&v.jsx("title",{id:pe,children:ke}),v.jsx(UN,{onClick:Ee,nodeColor:n,nodeStrokeColor:i,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:a,nodeComponent:c}),v.jsx("path",{className:"react-flow__minimap-mask",d:`M${K-q},${ie-q}h${ce+q*2}v${de+q*2}h${-ce-q*2}z
70
+ `)),f=d.reduce((g,m)=>g.concat(...m),[]);return[d,f]}return[[],[]]},[t]);return N.useEffect(()=>{const h=(e==null?void 0:e.target)??ZC,d=(e==null?void 0:e.actInsideInputWithModifier)??!0;if(t!==null){const f=O=>{var w,x;if(r.current=O.ctrlKey||O.metaKey||O.shiftKey||O.altKey,(!r.current||r.current&&!d)&&RP(O))return!1;const _=qC(O.code,c);if(s.current.add(O[_]),WC(a,s.current,!1)){const Q=((x=(w=O.composedPath)==null?void 0:w.call(O))==null?void 0:x[0])||O.target,k=(Q==null?void 0:Q.nodeName)==="BUTTON"||(Q==null?void 0:Q.nodeName)==="A";e.preventDefault!==!1&&(r.current||!k)&&O.preventDefault(),n(!0)}},g=O=>{const S=qC(O.code,c);WC(a,s.current,!0)?(n(!1),s.current.clear()):s.current.delete(O[S]),O.key==="Meta"&&s.current.clear(),r.current=!1},m=()=>{s.current.clear(),n(!1)};return h==null||h.addEventListener("keydown",f),h==null||h.addEventListener("keyup",g),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{h==null||h.removeEventListener("keydown",f),h==null||h.removeEventListener("keyup",g),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[t,n]),i}function WC(t,e,i){return t.filter(n=>i||n.length===e.size).some(n=>n.every(r=>e.has(r)))}function qC(t,e){return e.includes(t)?"code":"key"}const cX=()=>{const t=jt();return N.useMemo(()=>({zoomIn:e=>{const{panZoom:i}=t.getState();return i?i.scaleBy(1.2,e):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:i}=t.getState();return i?i.scaleBy(1/1.2,e):Promise.resolve(!1)},zoomTo:(e,i)=>{const{panZoom:n}=t.getState();return n?n.scaleTo(e,i):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,i)=>{const{transform:[n,r,s],panZoom:a}=t.getState();return a?(await a.setViewport({x:e.x??n,y:e.y??r,zoom:e.zoom??s},i),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,i,n]=t.getState().transform;return{x:e,y:i,zoom:n}},setCenter:async(e,i,n)=>t.getState().setCenter(e,i,n),fitBounds:async(e,i)=>{const{width:n,height:r,minZoom:s,maxZoom:a,panZoom:c}=t.getState(),h=E1(e,n,r,s,a,(i==null?void 0:i.padding)??.1);return c?(await c.setViewport(h,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,i={})=>{const{transform:n,snapGrid:r,snapToGrid:s,domNode:a}=t.getState();if(!a)return e;const{x:c,y:h}=a.getBoundingClientRect(),d={x:e.x-c,y:e.y-h},f=i.snapGrid??r,g=i.snapToGrid??s;return id(d,n,g,f)},flowToScreenPosition:e=>{const{transform:i,domNode:n}=t.getState();if(!n)return e;const{x:r,y:s}=n.getBoundingClientRect(),a=dg(e,i);return{x:a.x+r,y:a.y+s}}}),[])};function eE(t,e){const i=[],n=new Map,r=[];for(const s of t)if(s.type==="add"){r.push(s);continue}else if(s.type==="remove"||s.type==="replace")n.set(s.id,[s]);else{const a=n.get(s.id);a?a.push(s):n.set(s.id,[s])}for(const s of e){const a=n.get(s.id);if(!a){i.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){i.push({...a[0].item});continue}const c={...s};for(const h of a)hX(h,c);i.push(c)}return r.length&&r.forEach(s=>{s.index!==void 0?i.splice(s.index,0,{...s.item}):i.push({...s.item})}),i}function hX(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function uX(t,e){return eE(t,e)}function dX(t,e){return eE(t,e)}function ba(t,e){return{id:t,type:"select",selected:e}}function Fl(t,e=new Set,i=!1){const n=[];for(const[r,s]of t){const a=e.has(r);!(s.selected===void 0&&!a)&&s.selected!==a&&(i&&(s.selected=a),n.push(ba(s.id,a)))}return n}function VC({items:t=[],lookup:e}){var r;const i=[],n=new Map(t.map(s=>[s.id,s]));for(const[s,a]of t.entries()){const c=e.get(a.id),h=((r=c==null?void 0:c.internals)==null?void 0:r.userNode)??c;h!==void 0&&h!==a&&i.push({id:a.id,item:a,type:"replace"}),h===void 0&&i.push({item:a,type:"add",index:s})}for(const[s]of e)n.get(s)===void 0&&i.push({id:s,type:"remove"});return i}function IC(t){return{id:t.id,type:"remove"}}const YC=t=>ML(t),fX=t=>wP(t);function tE(t){return N.forwardRef(t)}function HC(t){const[e,i]=N.useState(BigInt(0)),[n]=N.useState(()=>pX(()=>i(r=>r+BigInt(1))));return zy(()=>{const r=n.get();r.length&&(t(r),n.reset())},[e]),n}function pX(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:i=>{e.push(i),t()}}}const iE=N.createContext(null);function gX({children:t}){const e=jt(),i=N.useCallback(c=>{const{nodes:h=[],setNodes:d,hasDefaultNodes:f,onNodesChange:g,nodeLookup:m,fitViewQueued:O,onNodesChangeMiddlewareMap:S}=e.getState();let _=h;for(const x of c)_=typeof x=="function"?x(_):x;let w=VC({items:_,lookup:m});for(const x of S.values())w=x(w);f&&d(_),w.length>0?g==null||g(w):O&&window.requestAnimationFrame(()=>{const{fitViewQueued:x,nodes:Q,setNodes:k}=e.getState();x&&k(Q)})},[]),n=HC(i),r=N.useCallback(c=>{const{edges:h=[],setEdges:d,hasDefaultEdges:f,onEdgesChange:g,edgeLookup:m}=e.getState();let O=h;for(const S of c)O=typeof S=="function"?S(O):S;f?d(O):g&&g(VC({items:O,lookup:m}))},[]),s=HC(r),a=N.useMemo(()=>({nodeQueue:n,edgeQueue:s}),[]);return v.jsx(iE.Provider,{value:a,children:t})}function mX(){const t=N.useContext(iE);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const OX=t=>!!t.panZoom;function hm(){const t=cX(),e=jt(),i=mX(),n=at(OX),r=N.useMemo(()=>{const s=g=>e.getState().nodeLookup.get(g),a=g=>{i.nodeQueue.push(g)},c=g=>{i.edgeQueue.push(g)},h=g=>{var x,Q;const{nodeLookup:m,nodeOrigin:O}=e.getState(),S=YC(g)?g:m.get(g.id),_=S.parentId?PP(S.position,S.measured,S.parentId,m,O):S.position,w={...S,position:_,width:((x=S.measured)==null?void 0:x.width)??S.width,height:((Q=S.measured)==null?void 0:Q.height)??S.height};return vc(w)},d=(g,m,O={replace:!1})=>{a(S=>S.map(_=>{if(_.id===g){const w=typeof m=="function"?m(_):m;return O.replace&&YC(w)?w:{..._,...w}}return _}))},f=(g,m,O={replace:!1})=>{c(S=>S.map(_=>{if(_.id===g){const w=typeof m=="function"?m(_):m;return O.replace&&fX(w)?w:{..._,...w}}return _}))};return{getNodes:()=>e.getState().nodes.map(g=>({...g})),getNode:g=>{var m;return(m=s(g))==null?void 0:m.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:g=[]}=e.getState();return g.map(m=>({...m}))},getEdge:g=>e.getState().edgeLookup.get(g),setNodes:a,setEdges:c,addNodes:g=>{const m=Array.isArray(g)?g:[g];i.nodeQueue.push(O=>[...O,...m])},addEdges:g=>{const m=Array.isArray(g)?g:[g];i.edgeQueue.push(O=>[...O,...m])},toObject:()=>{const{nodes:g=[],edges:m=[],transform:O}=e.getState(),[S,_,w]=O;return{nodes:g.map(x=>({...x})),edges:m.map(x=>({...x})),viewport:{x:S,y:_,zoom:w}}},deleteElements:async({nodes:g=[],edges:m=[]})=>{const{nodes:O,edges:S,onNodesDelete:_,onEdgesDelete:w,triggerNodeChanges:x,triggerEdgeChanges:Q,onDelete:k,onBeforeDelete:T}=e.getState(),{nodes:M,edges:$}=await LL({nodesToRemove:g,edgesToRemove:m,nodes:O,edges:S,onBeforeDelete:T}),R=$.length>0,V=M.length>0;if(R){const H=$.map(IC);w==null||w($),Q(H)}if(V){const H=M.map(IC);_==null||_(M),x(H)}return(V||R)&&(k==null||k({nodes:M,edges:$})),{deletedNodes:M,deletedEdges:$}},getIntersectingNodes:(g,m=!0,O)=>{const S=yC(g),_=S?g:h(g),w=O!==void 0;return _?(O||e.getState().nodes).filter(x=>{const Q=e.getState().nodeLookup.get(x.id);if(Q&&!S&&(x.id===g.id||!Q.internals.positionAbsolute))return!1;const k=vc(w?x:Q),T=Cu(k,_);return m&&T>0||T>=k.width*k.height||T>=_.width*_.height}):[]},isNodeIntersecting:(g,m,O=!0)=>{const _=yC(g)?g:h(g);if(!_)return!1;const w=Cu(_,m);return O&&w>0||w>=m.width*m.height||w>=_.width*_.height},updateNode:d,updateNodeData:(g,m,O={replace:!1})=>{d(g,S=>{const _=typeof m=="function"?m(S):m;return O.replace?{...S,data:_}:{...S,data:{...S.data,..._}}},O)},updateEdge:f,updateEdgeData:(g,m,O={replace:!1})=>{f(g,S=>{const _=typeof m=="function"?m(S):m;return O.replace?{...S,data:_}:{...S,data:{...S.data,..._}}},O)},getNodesBounds:g=>{const{nodeLookup:m,nodeOrigin:O}=e.getState();return zL(g,{nodeLookup:m,nodeOrigin:O})},getHandleConnections:({type:g,id:m,nodeId:O})=>{var S;return Array.from(((S=e.getState().connectionLookup.get(`${O}-${g}${m?`-${m}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:g,handleId:m,nodeId:O})=>{var S;return Array.from(((S=e.getState().connectionLookup.get(`${O}${g?m?`-${g}-${m}`:`-${g}`:""}`))==null?void 0:S.values())??[])},fitView:async g=>{const m=e.getState().fitViewResolver??WL();return e.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:m}),i.nodeQueue.push(O=>[...O]),m.promise}}},[]);return N.useMemo(()=>({...r,...t,viewportInitialized:n}),[n])}const UC=t=>t.selected,vX=typeof window<"u"?window:void 0;function yX({deleteKeyCode:t,multiSelectionKeyCode:e}){const i=jt(),{deleteElements:n}=hm(),r=Qu(t,{actInsideInputWithModifier:!1}),s=Qu(e,{target:vX});N.useEffect(()=>{if(r){const{edges:a,nodes:c}=i.getState();n({nodes:c.filter(UC),edges:a.filter(UC)}),i.setState({nodesSelectionActive:!1})}},[r]),N.useEffect(()=>{i.setState({multiSelectionActive:s})},[s])}function SX(t){const e=jt();N.useEffect(()=>{const i=()=>{var r,s,a,c;if(!t.current||!(((s=(r=t.current).checkVisibility)==null?void 0:s.call(r))??!0))return!1;const n=R1(t.current);(n.height===0||n.width===0)&&((c=(a=e.getState()).onError)==null||c.call(a,"004",Ur.error004())),e.setState({width:n.width||500,height:n.height||500})};if(t.current){i(),window.addEventListener("resize",i);const n=new ResizeObserver(()=>i());return n.observe(t.current),()=>{window.removeEventListener("resize",i),n&&t.current&&n.unobserve(t.current)}}},[])}const um={position:"absolute",width:"100%",height:"100%",top:0,left:0},bX=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function _X({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:i=!0,panOnScroll:n=!1,panOnScrollSpeed:r=.5,panOnScrollMode:s=za.Free,zoomOnDoubleClick:a=!0,panOnDrag:c=!0,defaultViewport:h,translateExtent:d,minZoom:f,maxZoom:g,zoomActivationKeyCode:m,preventScrolling:O=!0,children:S,noWheelClassName:_,noPanClassName:w,onViewportChange:x,isControlledViewport:Q,paneClickDistance:k,selectionOnDrag:T}){const M=jt(),$=N.useRef(null),{userSelectionActive:R,lib:V,connectionInProgress:H}=at(bX,Mt),ee=Qu(m),I=N.useRef();SX($);const j=N.useCallback(D=>{x==null||x({x:D[0],y:D[1],zoom:D[2]}),Q||M.setState({transform:D})},[x,Q]);return N.useEffect(()=>{if($.current){I.current=C6({domNode:$.current,minZoom:f,maxZoom:g,translateExtent:d,viewport:h,onDraggingChange:P=>M.setState(Z=>Z.paneDragging===P?Z:{paneDragging:P}),onPanZoomStart:(P,Z)=>{const{onViewportChangeStart:L,onMoveStart:B}=M.getState();B==null||B(P,Z),L==null||L(Z)},onPanZoom:(P,Z)=>{const{onViewportChange:L,onMove:B}=M.getState();B==null||B(P,Z),L==null||L(Z)},onPanZoomEnd:(P,Z)=>{const{onViewportChangeEnd:L,onMoveEnd:B}=M.getState();B==null||B(P,Z),L==null||L(Z)}});const{x:D,y:E,zoom:X}=I.current.getViewport();return M.setState({panZoom:I.current,transform:[D,E,X],domNode:$.current.closest(".react-flow")}),()=>{var P;(P=I.current)==null||P.destroy()}}},[]),N.useEffect(()=>{var D;(D=I.current)==null||D.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:i,panOnScroll:n,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:c,zoomActivationKeyPressed:ee,preventScrolling:O,noPanClassName:w,userSelectionActive:R,noWheelClassName:_,lib:V,onTransformChange:j,connectionInProgress:H,selectionOnDrag:T,paneClickDistance:k})},[t,e,i,n,r,s,a,c,ee,O,w,R,_,V,j,H,T,k]),v.jsx("div",{className:"react-flow__renderer",ref:$,style:um,children:S})}const xX=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function wX(){const{userSelectionActive:t,userSelectionRect:e}=at(xX,Mt);return t&&e?v.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const dv=(t,e)=>i=>{i.target===e.current&&(t==null||t(i))},kX=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function CX({isSelecting:t,selectionKeyPressed:e,selectionMode:i=ku.Full,panOnDrag:n,paneClickDistance:r,selectionOnDrag:s,onSelectionStart:a,onSelectionEnd:c,onPaneClick:h,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:g,onPaneMouseMove:m,onPaneMouseLeave:O,children:S}){const _=jt(),{userSelectionActive:w,elementsSelectable:x,dragging:Q,connectionInProgress:k}=at(kX,Mt),T=x&&(t||w),M=N.useRef(null),$=N.useRef(),R=N.useRef(new Set),V=N.useRef(new Set),H=N.useRef(!1),ee=L=>{if(H.current||k){H.current=!1;return}h==null||h(L),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},I=L=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){L.preventDefault();return}d==null||d(L)},j=f?L=>f(L):void 0,D=L=>{H.current&&(L.stopPropagation(),H.current=!1)},E=L=>{var ce,de;const{domNode:B}=_.getState();if($.current=B==null?void 0:B.getBoundingClientRect(),!$.current)return;const G=L.target===M.current;if(!G&&!!L.target.closest(".nokey")||!t||!(s&&G||e)||L.button!==0||!L.isPrimary)return;(de=(ce=L.target)==null?void 0:ce.setPointerCapture)==null||de.call(ce,L.pointerId),H.current=!1;const{x:K,y:ie}=vr(L.nativeEvent,$.current);_.setState({userSelectionRect:{width:0,height:0,startX:K,startY:ie,x:K,y:ie}}),G||(L.stopPropagation(),L.preventDefault())},X=L=>{const{userSelectionRect:B,transform:G,nodeLookup:z,edgeLookup:q,connectionLookup:K,triggerNodeChanges:ie,triggerEdgeChanges:ce,defaultEdgeOptions:de,resetSelectedElements:pe}=_.getState();if(!$.current||!B)return;const{x:fe,y:ve}=vr(L.nativeEvent,$.current),{startX:De,startY:Ee}=B;if(!H.current){const He=e?0:r;if(Math.hypot(fe-De,ve-Ee)<=He)return;pe(),a==null||a(L)}H.current=!0;const ke={startX:De,startY:Ee,x:fe<De?fe:De,y:ve<Ee?ve:Ee,width:Math.abs(fe-De),height:Math.abs(ve-Ee)},me=R.current,Be=V.current;R.current=new Set(P1(z,ke,G,i===ku.Partial,!0).map(He=>He.id)),V.current=new Set;const lt=(de==null?void 0:de.selectable)??!0;for(const He of R.current){const Ft=K.get(He);if(Ft)for(const{edgeId:rn}of Ft.values()){const qi=q.get(rn);qi&&(qi.selectable??lt)&&V.current.add(rn)}}if(!SC(me,R.current)){const He=Fl(z,R.current,!0);ie(He)}if(!SC(Be,V.current)){const He=Fl(q,V.current);ce(He)}_.setState({userSelectionRect:ke,userSelectionActive:!0,nodesSelectionActive:!1})},P=L=>{var B,G;L.button===0&&((G=(B=L.target)==null?void 0:B.releasePointerCapture)==null||G.call(B,L.pointerId),!w&&L.target===M.current&&_.getState().userSelectionRect&&(ee==null||ee(L)),_.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(c==null||c(L),_.setState({nodesSelectionActive:R.current.size>0})))},Z=n===!0||Array.isArray(n)&&n.includes(0);return v.jsxs("div",{className:ai(["react-flow__pane",{draggable:Z,dragging:Q,selection:t}]),onClick:T?void 0:dv(ee,M),onContextMenu:dv(I,M),onWheel:dv(j,M),onPointerEnter:T?void 0:g,onPointerMove:T?X:m,onPointerUp:T?P:void 0,onPointerDownCapture:T?E:void 0,onClickCapture:T?D:void 0,onPointerLeave:O,ref:M,style:um,children:[S,v.jsx(wX,{})]})}function jy({id:t,store:e,unselect:i=!1,nodeRef:n}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:c,onError:h}=e.getState(),d=c.get(t);if(!d){h==null||h("012",Ur.error012(t));return}e.setState({nodesSelectionActive:!1}),d.selected?(i||d.selected&&a)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var f;return(f=n==null?void 0:n.current)==null?void 0:f.blur()})):r([t])}function nE({nodeRef:t,disabled:e=!1,noDragClassName:i,handleSelector:n,nodeId:r,isSelectable:s,nodeClickDistance:a}){const c=jt(),[h,d]=N.useState(!1),f=N.useRef();return N.useEffect(()=>{f.current=d6({getStoreItems:()=>c.getState(),onNodeMouseDown:g=>{jy({id:g,store:c,nodeRef:t})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),N.useEffect(()=>{if(!(e||!t.current||!f.current))return f.current.update({noDragClassName:i,handleSelector:n,domNode:t.current,isSelectable:s,nodeId:r,nodeClickDistance:a}),()=>{var g;(g=f.current)==null||g.destroy()}},[i,n,e,s,t,r,a]),h}const TX=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function rE(){const t=jt();return N.useCallback(i=>{const{nodeExtent:n,snapToGrid:r,snapGrid:s,nodesDraggable:a,onError:c,updateNodePositions:h,nodeLookup:d,nodeOrigin:f}=t.getState(),g=new Map,m=TX(a),O=r?s[0]:5,S=r?s[1]:5,_=i.direction.x*O*i.factor,w=i.direction.y*S*i.factor;for(const[,x]of d){if(!m(x))continue;let Q={x:x.internals.positionAbsolute.x+_,y:x.internals.positionAbsolute.y+w};r&&(Q=td(Q,s));const{position:k,positionAbsolute:T}=kP({nodeId:x.id,nextPosition:Q,nodeLookup:d,nodeExtent:n,nodeOrigin:f,onError:c});x.position=k,x.internals.positionAbsolute=T,g.set(x.id,x)}h(g)},[])}const B1=N.createContext(null),QX=B1.Provider;B1.Consumer;const sE=()=>N.useContext(B1),$X=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),PX=(t,e,i)=>n=>{const{connectionClickStartHandle:r,connectionMode:s,connection:a}=n,{fromHandle:c,toHandle:h,isValid:d}=a,f=(h==null?void 0:h.nodeId)===t&&(h==null?void 0:h.id)===e&&(h==null?void 0:h.type)===i;return{connectingFrom:(c==null?void 0:c.nodeId)===t&&(c==null?void 0:c.id)===e&&(c==null?void 0:c.type)===i,connectingTo:f,clickConnecting:(r==null?void 0:r.nodeId)===t&&(r==null?void 0:r.id)===e&&(r==null?void 0:r.type)===i,isPossibleEndHandle:s===mc.Strict?(c==null?void 0:c.type)!==i:t!==(c==null?void 0:c.nodeId)||e!==(c==null?void 0:c.id),connectionInProcess:!!c,clickConnectionInProcess:!!r,valid:f&&d}};function EX({type:t="source",position:e=Re.Top,isValidConnection:i,isConnectable:n=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:a,onConnect:c,children:h,className:d,onMouseDown:f,onTouchStart:g,...m},O){var X,P;const S=a||null,_=t==="target",w=jt(),x=sE(),{connectOnClick:Q,noPanClassName:k,rfId:T}=at($X,Mt),{connectingFrom:M,connectingTo:$,clickConnecting:R,isPossibleEndHandle:V,connectionInProcess:H,clickConnectionInProcess:ee,valid:I}=at(PX(x,S,t),Mt);x||(P=(X=w.getState()).onError)==null||P.call(X,"010",Ur.error010());const j=Z=>{const{defaultEdgeOptions:L,onConnect:B,hasDefaultEdges:G}=w.getState(),z={...L,...Z};if(G){const{edges:q,setEdges:K}=w.getState();K(GL(z,q))}B==null||B(z),c==null||c(z)},D=Z=>{if(!x)return;const L=AP(Z.nativeEvent);if(r&&(L&&Z.button===0||!L)){const B=w.getState();My.onPointerDown(Z.nativeEvent,{handleDomNode:Z.currentTarget,autoPanOnConnect:B.autoPanOnConnect,connectionMode:B.connectionMode,connectionRadius:B.connectionRadius,domNode:B.domNode,nodeLookup:B.nodeLookup,lib:B.lib,isTarget:_,handleId:S,nodeId:x,flowId:B.rfId,panBy:B.panBy,cancelConnection:B.cancelConnection,onConnectStart:B.onConnectStart,onConnectEnd:(...G)=>{var z,q;return(q=(z=w.getState()).onConnectEnd)==null?void 0:q.call(z,...G)},updateConnection:B.updateConnection,onConnect:j,isValidConnection:i||((...G)=>{var z,q;return((q=(z=w.getState()).isValidConnection)==null?void 0:q.call(z,...G))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:B.autoPanSpeed,dragThreshold:B.connectionDragThreshold})}L?f==null||f(Z):g==null||g(Z)},E=Z=>{const{onClickConnectStart:L,onClickConnectEnd:B,connectionClickStartHandle:G,connectionMode:z,isValidConnection:q,lib:K,rfId:ie,nodeLookup:ce,connection:de}=w.getState();if(!x||!G&&!r)return;if(!G){L==null||L(Z.nativeEvent,{nodeId:x,handleId:S,handleType:t}),w.setState({connectionClickStartHandle:{nodeId:x,type:t,id:S}});return}const pe=EP(Z.target),fe=i||q,{connection:ve,isValid:De}=My.isValid(Z.nativeEvent,{handle:{nodeId:x,id:S,type:t},connectionMode:z,fromNodeId:G.nodeId,fromHandleId:G.id||null,fromType:G.type,isValidConnection:fe,flowId:ie,doc:pe,lib:K,nodeLookup:ce});De&&ve&&j(ve);const Ee=structuredClone(de);delete Ee.inProgress,Ee.toPosition=Ee.toHandle?Ee.toHandle.position:null,B==null||B(Z,Ee),w.setState({connectionClickStartHandle:null})};return v.jsx("div",{"data-handleid":S,"data-nodeid":x,"data-handlepos":e,"data-id":`${T}-${x}-${S}-${t}`,className:ai(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",k,d,{source:!_,target:_,connectable:n,connectablestart:r,connectableend:s,clickconnecting:R,connectingfrom:M,connectingto:$,valid:I,connectionindicator:n&&(!H||V)&&(H||ee?s:r)}]),onMouseDown:D,onTouchStart:D,onClick:Q?E:void 0,ref:O,...m,children:h})}const bc=N.memo(tE(EX));function RX({data:t,isConnectable:e,sourcePosition:i=Re.Bottom}){return v.jsxs(v.Fragment,{children:[t==null?void 0:t.label,v.jsx(bc,{type:"source",position:i,isConnectable:e})]})}function AX({data:t,isConnectable:e,targetPosition:i=Re.Top,sourcePosition:n=Re.Bottom}){return v.jsxs(v.Fragment,{children:[v.jsx(bc,{type:"target",position:i,isConnectable:e}),t==null?void 0:t.label,v.jsx(bc,{type:"source",position:n,isConnectable:e})]})}function MX(){return null}function zX({data:t,isConnectable:e,targetPosition:i=Re.Top}){return v.jsxs(v.Fragment,{children:[v.jsx(bc,{type:"target",position:i,isConnectable:e}),t==null?void 0:t.label]})}const fg={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},GC={input:RX,default:AX,output:zX,group:MX};function jX(t){var e,i,n,r;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((e=t.style)==null?void 0:e.width),height:t.height??t.initialHeight??((i=t.style)==null?void 0:i.height)}:{width:t.width??((n=t.style)==null?void 0:n.width),height:t.height??((r=t.style)==null?void 0:r.height)}}const DX=t=>{const{width:e,height:i,x:n,y:r}=ed(t.nodeLookup,{filter:s=>!!s.selected});return{width:Or(e)?e:null,height:Or(i)?i:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${n}px,${r}px)`}};function BX({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:i}){const n=jt(),{width:r,height:s,transformString:a,userSelectionActive:c}=at(DX,Mt),h=rE(),d=N.useRef(null);N.useEffect(()=>{var O;i||(O=d.current)==null||O.focus({preventScroll:!0})},[i]);const f=!c&&r!==null&&s!==null;if(nE({nodeRef:d,disabled:!f}),!f)return null;const g=t?O=>{const S=n.getState().nodes.filter(_=>_.selected);t(O,S)}:void 0,m=O=>{Object.prototype.hasOwnProperty.call(fg,O.key)&&(O.preventDefault(),h({direction:fg[O.key],factor:O.shiftKey?4:1}))};return v.jsx("div",{className:ai(["react-flow__nodesselection","react-flow__container",e]),style:{transform:a},children:v.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:i?void 0:-1,onKeyDown:i?void 0:m,style:{width:r,height:s}})})}const FC=typeof window<"u"?window:void 0,LX=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function oE({children:t,onPaneClick:e,onPaneMouseEnter:i,onPaneMouseMove:n,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:c,deleteKeyCode:h,selectionKeyCode:d,selectionOnDrag:f,selectionMode:g,onSelectionStart:m,onSelectionEnd:O,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:w,elementsSelectable:x,zoomOnScroll:Q,zoomOnPinch:k,panOnScroll:T,panOnScrollSpeed:M,panOnScrollMode:$,zoomOnDoubleClick:R,panOnDrag:V,defaultViewport:H,translateExtent:ee,minZoom:I,maxZoom:j,preventScrolling:D,onSelectionContextMenu:E,noWheelClassName:X,noPanClassName:P,disableKeyboardA11y:Z,onViewportChange:L,isControlledViewport:B}){const{nodesSelectionActive:G,userSelectionActive:z}=at(LX,Mt),q=Qu(d,{target:FC}),K=Qu(_,{target:FC}),ie=K||V,ce=K||T,de=f&&ie!==!0,pe=q||z||de;return yX({deleteKeyCode:h,multiSelectionKeyCode:S}),v.jsx(_X,{onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:Q,zoomOnPinch:k,panOnScroll:ce,panOnScrollSpeed:M,panOnScrollMode:$,zoomOnDoubleClick:R,panOnDrag:!q&&ie,defaultViewport:H,translateExtent:ee,minZoom:I,maxZoom:j,zoomActivationKeyCode:w,preventScrolling:D,noWheelClassName:X,noPanClassName:P,onViewportChange:L,isControlledViewport:B,paneClickDistance:c,selectionOnDrag:de,children:v.jsxs(CX,{onSelectionStart:m,onSelectionEnd:O,onPaneClick:e,onPaneMouseEnter:i,onPaneMouseMove:n,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:ie,isSelecting:!!pe,selectionMode:g,selectionKeyPressed:q,paneClickDistance:c,selectionOnDrag:de,children:[t,G&&v.jsx(BX,{onSelectionContextMenu:E,noPanClassName:P,disableKeyboardA11y:Z})]})})}oE.displayName="FlowRenderer";const XX=N.memo(oE),NX=t=>e=>t?P1(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(i=>i.id):Array.from(e.nodeLookup.keys());function ZX(t){return at(N.useCallback(NX(t),[t]),Mt)}const WX=t=>t.updateNodeInternals;function qX(){const t=at(WX),[e]=N.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const n=new Map;i.forEach(r=>{const s=r.target.getAttribute("data-id");n.set(s,{id:s,nodeElement:r.target,force:!0})}),t(n)}));return N.useEffect(()=>()=>{e==null||e.disconnect()},[e]),e}function VX({node:t,nodeType:e,hasDimensions:i,resizeObserver:n}){const r=jt(),s=N.useRef(null),a=N.useRef(null),c=N.useRef(t.sourcePosition),h=N.useRef(t.targetPosition),d=N.useRef(e),f=i&&!!t.internals.handleBounds;return N.useEffect(()=>{s.current&&!t.hidden&&(!f||a.current!==s.current)&&(a.current&&(n==null||n.unobserve(a.current)),n==null||n.observe(s.current),a.current=s.current)},[f,t.hidden]),N.useEffect(()=>()=>{a.current&&(n==null||n.unobserve(a.current),a.current=null)},[]),N.useEffect(()=>{if(s.current){const g=d.current!==e,m=c.current!==t.sourcePosition,O=h.current!==t.targetPosition;(g||m||O)&&(d.current=e,c.current=t.sourcePosition,h.current=t.targetPosition,r.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:s.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),s}function IX({id:t,onClick:e,onMouseEnter:i,onMouseMove:n,onMouseLeave:r,onContextMenu:s,onDoubleClick:a,nodesDraggable:c,elementsSelectable:h,nodesConnectable:d,nodesFocusable:f,resizeObserver:g,noDragClassName:m,noPanClassName:O,disableKeyboardA11y:S,rfId:_,nodeTypes:w,nodeClickDistance:x,onError:Q}){const{node:k,internals:T,isParent:M}=at(fe=>{const ve=fe.nodeLookup.get(t),De=fe.parentLookup.has(t);return{node:ve,internals:ve.internals,isParent:De}},Mt);let $=k.type||"default",R=(w==null?void 0:w[$])||GC[$];R===void 0&&(Q==null||Q("003",Ur.error003($)),$="default",R=(w==null?void 0:w.default)||GC.default);const V=!!(k.draggable||c&&typeof k.draggable>"u"),H=!!(k.selectable||h&&typeof k.selectable>"u"),ee=!!(k.connectable||d&&typeof k.connectable>"u"),I=!!(k.focusable||f&&typeof k.focusable>"u"),j=jt(),D=$P(k),E=VX({node:k,nodeType:$,hasDimensions:D,resizeObserver:g}),X=nE({nodeRef:E,disabled:k.hidden||!V,noDragClassName:m,handleSelector:k.dragHandle,nodeId:t,isSelectable:H,nodeClickDistance:x}),P=rE();if(k.hidden)return null;const Z=Ds(k),L=jX(k),B=H||V||e||i||n||r,G=i?fe=>i(fe,{...T.userNode}):void 0,z=n?fe=>n(fe,{...T.userNode}):void 0,q=r?fe=>r(fe,{...T.userNode}):void 0,K=s?fe=>s(fe,{...T.userNode}):void 0,ie=a?fe=>a(fe,{...T.userNode}):void 0,ce=fe=>{const{selectNodesOnDrag:ve,nodeDragThreshold:De}=j.getState();H&&(!ve||!V||De>0)&&jy({id:t,store:j,nodeRef:E}),e&&e(fe,{...T.userNode})},de=fe=>{if(!(RP(fe.nativeEvent)||S)){if(SP.includes(fe.key)&&H){const ve=fe.key==="Escape";jy({id:t,store:j,unselect:ve,nodeRef:E})}else if(V&&k.selected&&Object.prototype.hasOwnProperty.call(fg,fe.key)){fe.preventDefault();const{ariaLabelConfig:ve}=j.getState();j.setState({ariaLiveMessage:ve["node.a11yDescription.ariaLiveMessage"]({direction:fe.key.replace("Arrow","").toLowerCase(),x:~~T.positionAbsolute.x,y:~~T.positionAbsolute.y})}),P({direction:fg[fe.key],factor:fe.shiftKey?4:1})}}},pe=()=>{var Be;if(S||!((Be=E.current)!=null&&Be.matches(":focus-visible")))return;const{transform:fe,width:ve,height:De,autoPanOnNodeFocus:Ee,setCenter:ke}=j.getState();if(!Ee)return;P1(new Map([[t,k]]),{x:0,y:0,width:ve,height:De},fe,!0).length>0||ke(k.position.x+Z.width/2,k.position.y+Z.height/2,{zoom:fe[2]})};return v.jsx("div",{className:ai(["react-flow__node",`react-flow__node-${$}`,{[O]:V},k.className,{selected:k.selected,selectable:H,parent:M,draggable:V,dragging:X}]),ref:E,style:{zIndex:T.z,transform:`translate(${T.positionAbsolute.x}px,${T.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:D?"visible":"hidden",...k.style,...L},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:G,onMouseMove:z,onMouseLeave:q,onContextMenu:K,onClick:ce,onDoubleClick:ie,onKeyDown:I?de:void 0,tabIndex:I?0:void 0,onFocus:I?pe:void 0,role:k.ariaRole??(I?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${FP}-${_}`,"aria-label":k.ariaLabel,...k.domAttributes,children:v.jsx(QX,{value:t,children:v.jsx(R,{id:t,data:k.data,type:$,positionAbsoluteX:T.positionAbsolute.x,positionAbsoluteY:T.positionAbsolute.y,selected:k.selected??!1,selectable:H,draggable:V,deletable:k.deletable??!0,isConnectable:ee,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:X,dragHandle:k.dragHandle,zIndex:T.z,parentId:k.parentId,...Z})})})}var YX=N.memo(IX);const HX=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function aE(t){const{nodesDraggable:e,nodesConnectable:i,nodesFocusable:n,elementsSelectable:r,onError:s}=at(HX,Mt),a=ZX(t.onlyRenderVisibleElements),c=qX();return v.jsx("div",{className:"react-flow__nodes",style:um,children:a.map(h=>v.jsx(YX,{id:h,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:c,nodesDraggable:e,nodesConnectable:i,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:t.nodeClickDistance,onError:s},h))})}aE.displayName="NodeRenderer";const UX=N.memo(aE);function GX(t){return at(N.useCallback(i=>{if(!t)return i.edges.map(r=>r.id);const n=[];if(i.width&&i.height)for(const r of i.edges){const s=i.nodeLookup.get(r.source),a=i.nodeLookup.get(r.target);s&&a&&YL({sourceNode:s,targetNode:a,width:i.width,height:i.height,transform:i.transform})&&n.push(r.id)}return n},[t]),Mt)}const FX=({color:t="none",strokeWidth:e=1})=>{const i={strokeWidth:e,...t&&{stroke:t}};return v.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},KX=({color:t="none",strokeWidth:e=1})=>{const i={strokeWidth:e,...t&&{stroke:t,fill:t}};return v.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},KC={[hg.Arrow]:FX,[hg.ArrowClosed]:KX};function JX(t){const e=jt();return N.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(KC,t)?KC[t]:((s=(r=e.getState()).onError)==null||s.call(r,"009",Ur.error009(t)),null)},[t])}const eN=({id:t,type:e,color:i,width:n=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:c="auto-start-reverse"})=>{const h=JX(e);return h?v.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${n}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:v.jsx(h,{color:i,strokeWidth:a})}):null},lE=({defaultColor:t,rfId:e})=>{const i=at(s=>s.edges),n=at(s=>s.defaultEdgeOptions),r=N.useMemo(()=>t6(i,{id:e,defaultColor:t,defaultMarkerStart:n==null?void 0:n.markerStart,defaultMarkerEnd:n==null?void 0:n.markerEnd}),[i,n,e,t]);return r.length?v.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:v.jsx("defs",{children:r.map(s=>v.jsx(eN,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};lE.displayName="MarkerDefinitions";var tN=N.memo(lE);function cE({x:t,y:e,label:i,labelStyle:n,labelShowBg:r=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:c=2,children:h,className:d,...f}){const[g,m]=N.useState({x:1,y:0,width:0,height:0}),O=ai(["react-flow__edge-textwrapper",d]),S=N.useRef(null);return N.useEffect(()=>{if(S.current){const _=S.current.getBBox();m({x:_.x,y:_.y,width:_.width,height:_.height})}},[i]),i?v.jsxs("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:O,visibility:g.width?"visible":"hidden",...f,children:[r&&v.jsx("rect",{width:g.width+2*a[0],x:-a[0],y:-a[1],height:g.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:c,ry:c}),v.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:S,style:n,children:i}),h]}):null}cE.displayName="EdgeText";const iN=N.memo(cE);function dm({path:t,labelX:e,labelY:i,label:n,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:h,interactionWidth:d=20,...f}){return v.jsxs(v.Fragment,{children:[v.jsx("path",{...f,d:t,fill:"none",className:ai(["react-flow__edge-path",f.className])}),d?v.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,n&&Or(e)&&Or(i)?v.jsx(iN,{x:e,y:i,label:n,labelStyle:r,labelShowBg:s,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:h}):null]})}function JC({pos:t,x1:e,y1:i,x2:n,y2:r}){return t===Re.Left||t===Re.Right?[.5*(e+n),i]:[e,.5*(i+r)]}function hE({sourceX:t,sourceY:e,sourcePosition:i=Re.Bottom,targetX:n,targetY:r,targetPosition:s=Re.Top}){const[a,c]=JC({pos:i,x1:t,y1:e,x2:n,y2:r}),[h,d]=JC({pos:s,x1:n,y1:r,x2:t,y2:e}),[f,g,m,O]=MP({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:h,targetControlY:d});return[`M${t},${e} C${a},${c} ${h},${d} ${n},${r}`,f,g,m,O]}function uE(t){return N.memo(({id:e,sourceX:i,sourceY:n,targetX:r,targetY:s,sourcePosition:a,targetPosition:c,label:h,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:O,style:S,markerEnd:_,markerStart:w,interactionWidth:x})=>{const[Q,k,T]=hE({sourceX:i,sourceY:n,sourcePosition:a,targetX:r,targetY:s,targetPosition:c}),M=t.isInternal?void 0:e;return v.jsx(dm,{id:M,path:Q,labelX:k,labelY:T,label:h,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:O,style:S,markerEnd:_,markerStart:w,interactionWidth:x})})}const nN=uE({isInternal:!1}),dE=uE({isInternal:!0});nN.displayName="SimpleBezierEdge";dE.displayName="SimpleBezierEdgeInternal";function fE(t){return N.memo(({id:e,sourceX:i,sourceY:n,targetX:r,targetY:s,label:a,labelStyle:c,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,sourcePosition:O=Re.Bottom,targetPosition:S=Re.Top,markerEnd:_,markerStart:w,pathOptions:x,interactionWidth:Q})=>{const[k,T,M]=Ey({sourceX:i,sourceY:n,sourcePosition:O,targetX:r,targetY:s,targetPosition:S,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset,stepPosition:x==null?void 0:x.stepPosition}),$=t.isInternal?void 0:e;return v.jsx(dm,{id:$,path:k,labelX:T,labelY:M,label:a,labelStyle:c,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,markerEnd:_,markerStart:w,interactionWidth:Q})})}const pE=fE({isInternal:!1}),gE=fE({isInternal:!0});pE.displayName="SmoothStepEdge";gE.displayName="SmoothStepEdgeInternal";function mE(t){return N.memo(({id:e,...i})=>{var r;const n=t.isInternal?void 0:e;return v.jsx(pE,{...i,id:n,pathOptions:N.useMemo(()=>{var s;return{borderRadius:0,offset:(s=i.pathOptions)==null?void 0:s.offset}},[(r=i.pathOptions)==null?void 0:r.offset])})})}const rN=mE({isInternal:!1}),OE=mE({isInternal:!0});rN.displayName="StepEdge";OE.displayName="StepEdgeInternal";function vE(t){return N.memo(({id:e,sourceX:i,sourceY:n,targetX:r,targetY:s,label:a,labelStyle:c,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,markerEnd:O,markerStart:S,interactionWidth:_})=>{const[w,x,Q]=DP({sourceX:i,sourceY:n,targetX:r,targetY:s}),k=t.isInternal?void 0:e;return v.jsx(dm,{id:k,path:w,labelX:x,labelY:Q,label:a,labelStyle:c,labelShowBg:h,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:m,markerEnd:O,markerStart:S,interactionWidth:_})})}const sN=vE({isInternal:!1}),yE=vE({isInternal:!0});sN.displayName="StraightEdge";yE.displayName="StraightEdgeInternal";function SE(t){return N.memo(({id:e,sourceX:i,sourceY:n,targetX:r,targetY:s,sourcePosition:a=Re.Bottom,targetPosition:c=Re.Top,label:h,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:O,style:S,markerEnd:_,markerStart:w,pathOptions:x,interactionWidth:Q})=>{const[k,T,M]=zP({sourceX:i,sourceY:n,sourcePosition:a,targetX:r,targetY:s,targetPosition:c,curvature:x==null?void 0:x.curvature}),$=t.isInternal?void 0:e;return v.jsx(dm,{id:$,path:k,labelX:T,labelY:M,label:h,labelStyle:d,labelShowBg:f,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:O,style:S,markerEnd:_,markerStart:w,interactionWidth:Q})})}const oN=SE({isInternal:!1}),bE=SE({isInternal:!0});oN.displayName="BezierEdge";bE.displayName="BezierEdgeInternal";const e2={default:bE,straight:yE,step:OE,smoothstep:gE,simplebezier:dE},t2={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},aN=(t,e,i)=>i===Re.Left?t-e:i===Re.Right?t+e:t,lN=(t,e,i)=>i===Re.Top?t-e:i===Re.Bottom?t+e:t,i2="react-flow__edgeupdater";function n2({position:t,centerX:e,centerY:i,radius:n=10,onMouseDown:r,onMouseEnter:s,onMouseOut:a,type:c}){return v.jsx("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:a,className:ai([i2,`${i2}-${c}`]),cx:aN(e,n,t),cy:lN(i,n,t),r:n,stroke:"transparent",fill:"transparent"})}function cN({isReconnectable:t,reconnectRadius:e,edge:i,sourceX:n,sourceY:r,targetX:s,targetY:a,sourcePosition:c,targetPosition:h,onReconnect:d,onReconnectStart:f,onReconnectEnd:g,setReconnecting:m,setUpdateHover:O}){const S=jt(),_=(T,M)=>{if(T.button!==0)return;const{autoPanOnConnect:$,domNode:R,connectionMode:V,connectionRadius:H,lib:ee,onConnectStart:I,cancelConnection:j,nodeLookup:D,rfId:E,panBy:X,updateConnection:P}=S.getState(),Z=M.type==="target",L=(z,q)=>{m(!1),g==null||g(z,i,M.type,q)},B=z=>d==null?void 0:d(i,z),G=(z,q)=>{m(!0),f==null||f(T,i,M.type),I==null||I(z,q)};My.onPointerDown(T.nativeEvent,{autoPanOnConnect:$,connectionMode:V,connectionRadius:H,domNode:R,handleId:M.id,nodeId:M.nodeId,nodeLookup:D,isTarget:Z,edgeUpdaterType:M.type,lib:ee,flowId:E,cancelConnection:j,panBy:X,isValidConnection:(...z)=>{var q,K;return((K=(q=S.getState()).isValidConnection)==null?void 0:K.call(q,...z))??!0},onConnect:B,onConnectStart:G,onConnectEnd:(...z)=>{var q,K;return(K=(q=S.getState()).onConnectEnd)==null?void 0:K.call(q,...z)},onReconnectEnd:L,updateConnection:P,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:T.currentTarget})},w=T=>_(T,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),x=T=>_(T,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),Q=()=>O(!0),k=()=>O(!1);return v.jsxs(v.Fragment,{children:[(t===!0||t==="source")&&v.jsx(n2,{position:c,centerX:n,centerY:r,radius:e,onMouseDown:w,onMouseEnter:Q,onMouseOut:k,type:"source"}),(t===!0||t==="target")&&v.jsx(n2,{position:h,centerX:s,centerY:a,radius:e,onMouseDown:x,onMouseEnter:Q,onMouseOut:k,type:"target"})]})}function hN({id:t,edgesFocusable:e,edgesReconnectable:i,elementsSelectable:n,onClick:r,onDoubleClick:s,onContextMenu:a,onMouseEnter:c,onMouseMove:h,onMouseLeave:d,reconnectRadius:f,onReconnect:g,onReconnectStart:m,onReconnectEnd:O,rfId:S,edgeTypes:_,noPanClassName:w,onError:x,disableKeyboardA11y:Q}){let k=at(ke=>ke.edgeLookup.get(t));const T=at(ke=>ke.defaultEdgeOptions);k=T?{...T,...k}:k;let M=k.type||"default",$=(_==null?void 0:_[M])||e2[M];$===void 0&&(x==null||x("011",Ur.error011(M)),M="default",$=(_==null?void 0:_.default)||e2.default);const R=!!(k.focusable||e&&typeof k.focusable>"u"),V=typeof g<"u"&&(k.reconnectable||i&&typeof k.reconnectable>"u"),H=!!(k.selectable||n&&typeof k.selectable>"u"),ee=N.useRef(null),[I,j]=N.useState(!1),[D,E]=N.useState(!1),X=jt(),{zIndex:P,sourceX:Z,sourceY:L,targetX:B,targetY:G,sourcePosition:z,targetPosition:q}=at(N.useCallback(ke=>{const me=ke.nodeLookup.get(k.source),Be=ke.nodeLookup.get(k.target);if(!me||!Be)return{zIndex:k.zIndex,...t2};const lt=e6({id:t,sourceNode:me,targetNode:Be,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:ke.connectionMode,onError:x});return{zIndex:IL({selected:k.selected,zIndex:k.zIndex,sourceNode:me,targetNode:Be,elevateOnSelect:ke.elevateEdgesOnSelect,zIndexMode:ke.zIndexMode}),...lt||t2}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),Mt),K=N.useMemo(()=>k.markerStart?`url('#${Ry(k.markerStart,S)}')`:void 0,[k.markerStart,S]),ie=N.useMemo(()=>k.markerEnd?`url('#${Ry(k.markerEnd,S)}')`:void 0,[k.markerEnd,S]);if(k.hidden||Z===null||L===null||B===null||G===null)return null;const ce=ke=>{var He;const{addSelectedEdges:me,unselectNodesAndEdges:Be,multiSelectionActive:lt}=X.getState();H&&(X.setState({nodesSelectionActive:!1}),k.selected&&lt?(Be({nodes:[],edges:[k]}),(He=ee.current)==null||He.blur()):me([t])),r&&r(ke,k)},de=s?ke=>{s(ke,{...k})}:void 0,pe=a?ke=>{a(ke,{...k})}:void 0,fe=c?ke=>{c(ke,{...k})}:void 0,ve=h?ke=>{h(ke,{...k})}:void 0,De=d?ke=>{d(ke,{...k})}:void 0,Ee=ke=>{var me;if(!Q&&SP.includes(ke.key)&&H){const{unselectNodesAndEdges:Be,addSelectedEdges:lt}=X.getState();ke.key==="Escape"?((me=ee.current)==null||me.blur(),Be({edges:[k]})):lt([t])}};return v.jsx("svg",{style:{zIndex:P},children:v.jsxs("g",{className:ai(["react-flow__edge",`react-flow__edge-${M}`,k.className,w,{selected:k.selected,animated:k.animated,inactive:!H&&!r,updating:I,selectable:H}]),onClick:ce,onDoubleClick:de,onContextMenu:pe,onMouseEnter:fe,onMouseMove:ve,onMouseLeave:De,onKeyDown:R?Ee:void 0,tabIndex:R?0:void 0,role:k.ariaRole??(R?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":k.ariaLabel===null?void 0:k.ariaLabel||`Edge from ${k.source} to ${k.target}`,"aria-describedby":R?`${KP}-${S}`:void 0,ref:ee,...k.domAttributes,children:[!D&&v.jsx($,{id:t,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:H,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:Z,sourceY:L,targetX:B,targetY:G,sourcePosition:z,targetPosition:q,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:K,markerEnd:ie,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),V&&v.jsx(cN,{edge:k,isReconnectable:V,reconnectRadius:f,onReconnect:g,onReconnectStart:m,onReconnectEnd:O,sourceX:Z,sourceY:L,targetX:B,targetY:G,sourcePosition:z,targetPosition:q,setUpdateHover:j,setReconnecting:E})]})})}var uN=N.memo(hN);const dN=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function _E({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:i,edgeTypes:n,noPanClassName:r,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:c,onEdgeMouseMove:h,onEdgeMouseLeave:d,onEdgeClick:f,reconnectRadius:g,onEdgeDoubleClick:m,onReconnectStart:O,onReconnectEnd:S,disableKeyboardA11y:_}){const{edgesFocusable:w,edgesReconnectable:x,elementsSelectable:Q,onError:k}=at(dN,Mt),T=GX(e);return v.jsxs("div",{className:"react-flow__edges",children:[v.jsx(tN,{defaultColor:t,rfId:i}),T.map(M=>v.jsx(uN,{id:M,edgesFocusable:w,edgesReconnectable:x,elementsSelectable:Q,noPanClassName:r,onReconnect:s,onContextMenu:a,onMouseEnter:c,onMouseMove:h,onMouseLeave:d,onClick:f,reconnectRadius:g,onDoubleClick:m,onReconnectStart:O,onReconnectEnd:S,rfId:i,onError:k,edgeTypes:n,disableKeyboardA11y:_},M))]})}_E.displayName="EdgeRenderer";const fN=N.memo(_E),pN=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function gN({children:t}){const e=at(pN);return v.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function mN(t){const e=hm(),i=N.useRef(!1);N.useEffect(()=>{!i.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),i.current=!0)},[t,e.viewportInitialized])}const ON=t=>{var e;return(e=t.panZoom)==null?void 0:e.syncViewport};function vN(t){const e=at(ON),i=jt();return N.useEffect(()=>{t&&(e==null||e(t),i.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function yN(t){return t.connection.inProgress?{...t.connection,to:id(t.connection.to,t.transform)}:{...t.connection}}function SN(t){return yN}function bN(t){const e=SN();return at(e,Mt)}const _N=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function xN({containerStyle:t,style:e,type:i,component:n}){const{nodesConnectable:r,width:s,height:a,isValid:c,inProgress:h}=at(_N,Mt);return!(s&&r&&h)?null:v.jsx("svg",{style:t,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:v.jsx("g",{className:ai(["react-flow__connection",xP(c)]),children:v.jsx(xE,{style:e,type:i,CustomComponent:n,isValid:c})})})}const xE=({style:t,type:e=Eo.Bezier,CustomComponent:i,isValid:n})=>{const{inProgress:r,from:s,fromNode:a,fromHandle:c,fromPosition:h,to:d,toNode:f,toHandle:g,toPosition:m,pointer:O}=bN();if(!r)return;if(i)return v.jsx(i,{connectionLineType:e,connectionLineStyle:t,fromNode:a,fromHandle:c,fromX:s.x,fromY:s.y,toX:d.x,toY:d.y,fromPosition:h,toPosition:m,connectionStatus:xP(n),toNode:f,toHandle:g,pointer:O});let S="";const _={sourceX:s.x,sourceY:s.y,sourcePosition:h,targetX:d.x,targetY:d.y,targetPosition:m};switch(e){case Eo.Bezier:[S]=zP(_);break;case Eo.SimpleBezier:[S]=hE(_);break;case Eo.Step:[S]=Ey({..._,borderRadius:0});break;case Eo.SmoothStep:[S]=Ey(_);break;default:[S]=DP(_)}return v.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:t})};xE.displayName="ConnectionLine";const wN={};function r2(t=wN){N.useRef(t),jt(),N.useEffect(()=>{},[t])}function kN(){jt(),N.useRef(!1),N.useEffect(()=>{},[])}function wE({nodeTypes:t,edgeTypes:e,onInit:i,onNodeClick:n,onEdgeClick:r,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:h,onNodeMouseLeave:d,onNodeContextMenu:f,onSelectionContextMenu:g,onSelectionStart:m,onSelectionEnd:O,connectionLineType:S,connectionLineStyle:_,connectionLineComponent:w,connectionLineContainerStyle:x,selectionKeyCode:Q,selectionOnDrag:k,selectionMode:T,multiSelectionKeyCode:M,panActivationKeyCode:$,zoomActivationKeyCode:R,deleteKeyCode:V,onlyRenderVisibleElements:H,elementsSelectable:ee,defaultViewport:I,translateExtent:j,minZoom:D,maxZoom:E,preventScrolling:X,defaultMarkerColor:P,zoomOnScroll:Z,zoomOnPinch:L,panOnScroll:B,panOnScrollSpeed:G,panOnScrollMode:z,zoomOnDoubleClick:q,panOnDrag:K,onPaneClick:ie,onPaneMouseEnter:ce,onPaneMouseMove:de,onPaneMouseLeave:pe,onPaneScroll:fe,onPaneContextMenu:ve,paneClickDistance:De,nodeClickDistance:Ee,onEdgeContextMenu:ke,onEdgeMouseEnter:me,onEdgeMouseMove:Be,onEdgeMouseLeave:lt,reconnectRadius:He,onReconnect:Ft,onReconnectStart:rn,onReconnectEnd:qi,noDragClassName:_n,noWheelClassName:ar,noPanClassName:oe,disableKeyboardA11y:We,nodeExtent:Le,rfId:sn,viewport:on,onViewportChange:Vi}){return r2(t),r2(e),kN(),mN(i),vN(on),v.jsx(XX,{onPaneClick:ie,onPaneMouseEnter:ce,onPaneMouseMove:de,onPaneMouseLeave:pe,onPaneContextMenu:ve,onPaneScroll:fe,paneClickDistance:De,deleteKeyCode:V,selectionKeyCode:Q,selectionOnDrag:k,selectionMode:T,onSelectionStart:m,onSelectionEnd:O,multiSelectionKeyCode:M,panActivationKeyCode:$,zoomActivationKeyCode:R,elementsSelectable:ee,zoomOnScroll:Z,zoomOnPinch:L,zoomOnDoubleClick:q,panOnScroll:B,panOnScrollSpeed:G,panOnScrollMode:z,panOnDrag:K,defaultViewport:I,translateExtent:j,minZoom:D,maxZoom:E,onSelectionContextMenu:g,preventScrolling:X,noDragClassName:_n,noWheelClassName:ar,noPanClassName:oe,disableKeyboardA11y:We,onViewportChange:Vi,isControlledViewport:!!on,children:v.jsxs(gN,{children:[v.jsx(fN,{edgeTypes:e,onEdgeClick:r,onEdgeDoubleClick:a,onReconnect:Ft,onReconnectStart:rn,onReconnectEnd:qi,onlyRenderVisibleElements:H,onEdgeContextMenu:ke,onEdgeMouseEnter:me,onEdgeMouseMove:Be,onEdgeMouseLeave:lt,reconnectRadius:He,defaultMarkerColor:P,noPanClassName:oe,disableKeyboardA11y:We,rfId:sn}),v.jsx(xN,{style:_,type:S,component:w,containerStyle:x}),v.jsx("div",{className:"react-flow__edgelabel-renderer"}),v.jsx(UX,{nodeTypes:t,onNodeClick:n,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:h,onNodeMouseLeave:d,onNodeContextMenu:f,nodeClickDistance:Ee,onlyRenderVisibleElements:H,noPanClassName:oe,noDragClassName:_n,disableKeyboardA11y:We,nodeExtent:Le,rfId:sn}),v.jsx("div",{className:"react-flow__viewport-portal"})]})})}wE.displayName="GraphView";const CN=N.memo(wE),s2=({nodes:t,edges:e,defaultNodes:i,defaultEdges:n,width:r,height:s,fitView:a,fitViewOptions:c,minZoom:h=.5,maxZoom:d=2,nodeOrigin:f,nodeExtent:g,zIndexMode:m="basic"}={})=>{const O=new Map,S=new Map,_=new Map,w=new Map,x=n??e??[],Q=i??t??[],k=f??[0,0],T=g??wu;XP(_,w,x);const{nodesInitialized:M}=Ay(Q,O,S,{nodeOrigin:k,nodeExtent:T,zIndexMode:m});let $=[0,0,1];if(a&&r&&s){const R=ed(O,{filter:I=>!!((I.width||I.initialWidth)&&(I.height||I.initialHeight))}),{x:V,y:H,zoom:ee}=E1(R,r,s,h,d,(c==null?void 0:c.padding)??.1);$=[V,H,ee]}return{rfId:"1",width:r??0,height:s??0,transform:$,nodes:Q,nodesInitialized:M,nodeLookup:O,parentLookup:S,edges:x,edgeLookup:w,connectionLookup:_,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:n!==void 0,panZoom:null,minZoom:h,maxZoom:d,translateExtent:wu,nodeExtent:T,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:mc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:k,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:c,fitViewResolver:null,connection:{..._P},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:XL,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:bP,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},TN=({nodes:t,edges:e,defaultNodes:i,defaultEdges:n,width:r,height:s,fitView:a,fitViewOptions:c,minZoom:h,maxZoom:d,nodeOrigin:f,nodeExtent:g,zIndexMode:m})=>q6((O,S)=>{async function _(){const{nodeLookup:w,panZoom:x,fitViewOptions:Q,fitViewResolver:k,width:T,height:M,minZoom:$,maxZoom:R}=S();x&&(await BL({nodes:w,width:T,height:M,panZoom:x,minZoom:$,maxZoom:R},Q),k==null||k.resolve(!0),O({fitViewResolver:null}))}return{...s2({nodes:t,edges:e,width:r,height:s,fitView:a,fitViewOptions:c,minZoom:h,maxZoom:d,nodeOrigin:f,nodeExtent:g,defaultNodes:i,defaultEdges:n,zIndexMode:m}),setNodes:w=>{const{nodeLookup:x,parentLookup:Q,nodeOrigin:k,elevateNodesOnSelect:T,fitViewQueued:M,zIndexMode:$,nodesSelectionActive:R}=S(),{nodesInitialized:V,hasSelectedNodes:H}=Ay(w,x,Q,{nodeOrigin:k,nodeExtent:g,elevateNodesOnSelect:T,checkEquality:!0,zIndexMode:$}),ee=R&&H;M&&V?(_(),O({nodes:w,nodesInitialized:V,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:ee})):O({nodes:w,nodesInitialized:V,nodesSelectionActive:ee})},setEdges:w=>{const{connectionLookup:x,edgeLookup:Q}=S();XP(x,Q,w),O({edges:w})},setDefaultNodesAndEdges:(w,x)=>{if(w){const{setNodes:Q}=S();Q(w),O({hasDefaultNodes:!0})}if(x){const{setEdges:Q}=S();Q(x),O({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:x,nodeLookup:Q,parentLookup:k,domNode:T,nodeOrigin:M,nodeExtent:$,debug:R,fitViewQueued:V,zIndexMode:H}=S(),{changes:ee,updatedInternals:I}=l6(w,Q,k,T,M,$,H);I&&(r6(Q,k,{nodeOrigin:M,nodeExtent:$,zIndexMode:H}),V?(_(),O({fitViewQueued:!1,fitViewOptions:void 0})):O({}),(ee==null?void 0:ee.length)>0&&(R&&console.log("React Flow: trigger node changes",ee),x==null||x(ee)))},updateNodePositions:(w,x=!1)=>{const Q=[];let k=[];const{nodeLookup:T,triggerNodeChanges:M,connection:$,updateConnection:R,onNodesChangeMiddlewareMap:V}=S();for(const[H,ee]of w){const I=T.get(H),j=!!(I!=null&&I.expandParent&&(I!=null&&I.parentId)&&(ee!=null&&ee.position)),D={id:H,type:"position",position:j?{x:Math.max(0,ee.position.x),y:Math.max(0,ee.position.y)}:ee.position,dragging:x};if(I&&$.inProgress&&$.fromNode.id===I.id){const E=Za(I,$.fromHandle,Re.Left,!0);R({...$,from:E})}j&&I.parentId&&Q.push({id:H,parentId:I.parentId,rect:{...ee.internals.positionAbsolute,width:ee.measured.width??0,height:ee.measured.height??0}}),k.push(D)}if(Q.length>0){const{parentLookup:H,nodeOrigin:ee}=S(),I=D1(Q,T,H,ee);k.push(...I)}for(const H of V.values())k=H(k);M(k)},triggerNodeChanges:w=>{const{onNodesChange:x,setNodes:Q,nodes:k,hasDefaultNodes:T,debug:M}=S();if(w!=null&&w.length){if(T){const $=uX(w,k);Q($)}M&&console.log("React Flow: trigger node changes",w),x==null||x(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:x,setEdges:Q,edges:k,hasDefaultEdges:T,debug:M}=S();if(w!=null&&w.length){if(T){const $=dX(w,k);Q($)}M&&console.log("React Flow: trigger edge changes",w),x==null||x(w)}},addSelectedNodes:w=>{const{multiSelectionActive:x,edgeLookup:Q,nodeLookup:k,triggerNodeChanges:T,triggerEdgeChanges:M}=S();if(x){const $=w.map(R=>ba(R,!0));T($);return}T(Fl(k,new Set([...w]),!0)),M(Fl(Q))},addSelectedEdges:w=>{const{multiSelectionActive:x,edgeLookup:Q,nodeLookup:k,triggerNodeChanges:T,triggerEdgeChanges:M}=S();if(x){const $=w.map(R=>ba(R,!0));M($);return}M(Fl(Q,new Set([...w]))),T(Fl(k,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:x}={})=>{const{edges:Q,nodes:k,nodeLookup:T,triggerNodeChanges:M,triggerEdgeChanges:$}=S(),R=w||k,V=x||Q,H=[];for(const I of R){if(!I.selected)continue;const j=T.get(I.id);j&&(j.selected=!1),H.push(ba(I.id,!1))}const ee=[];for(const I of V)I.selected&&ee.push(ba(I.id,!1));M(H),$(ee)},setMinZoom:w=>{const{panZoom:x,maxZoom:Q}=S();x==null||x.setScaleExtent([w,Q]),O({minZoom:w})},setMaxZoom:w=>{const{panZoom:x,minZoom:Q}=S();x==null||x.setScaleExtent([Q,w]),O({maxZoom:w})},setTranslateExtent:w=>{var x;(x=S().panZoom)==null||x.setTranslateExtent(w),O({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:x,triggerNodeChanges:Q,triggerEdgeChanges:k,elementsSelectable:T}=S();if(!T)return;const M=x.reduce((R,V)=>V.selected?[...R,ba(V.id,!1)]:R,[]),$=w.reduce((R,V)=>V.selected?[...R,ba(V.id,!1)]:R,[]);Q(M),k($)},setNodeExtent:w=>{const{nodes:x,nodeLookup:Q,parentLookup:k,nodeOrigin:T,elevateNodesOnSelect:M,nodeExtent:$,zIndexMode:R}=S();w[0][0]===$[0][0]&&w[0][1]===$[0][1]&&w[1][0]===$[1][0]&&w[1][1]===$[1][1]||(Ay(x,Q,k,{nodeOrigin:T,nodeExtent:w,elevateNodesOnSelect:M,checkEquality:!1,zIndexMode:R}),O({nodeExtent:w}))},panBy:w=>{const{transform:x,width:Q,height:k,panZoom:T,translateExtent:M}=S();return c6({delta:w,panZoom:T,transform:x,translateExtent:M,width:Q,height:k})},setCenter:async(w,x,Q)=>{const{width:k,height:T,maxZoom:M,panZoom:$}=S();if(!$)return Promise.resolve(!1);const R=typeof(Q==null?void 0:Q.zoom)<"u"?Q.zoom:M;return await $.setViewport({x:k/2-w*R,y:T/2-x*R,zoom:R},{duration:Q==null?void 0:Q.duration,ease:Q==null?void 0:Q.ease,interpolate:Q==null?void 0:Q.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{O({connection:{..._P}})},updateConnection:w=>{O({connection:w})},reset:()=>O({...s2()})}},Object.is);function kE({initialNodes:t,initialEdges:e,defaultNodes:i,defaultEdges:n,initialWidth:r,initialHeight:s,initialMinZoom:a,initialMaxZoom:c,initialFitViewOptions:h,fitView:d,nodeOrigin:f,nodeExtent:g,zIndexMode:m,children:O}){const[S]=N.useState(()=>TN({nodes:t,edges:e,defaultNodes:i,defaultEdges:n,width:r,height:s,fitView:d,minZoom:a,maxZoom:c,fitViewOptions:h,nodeOrigin:f,nodeExtent:g,zIndexMode:m}));return v.jsx(V6,{value:S,children:v.jsx(gX,{children:O})})}function QN({children:t,nodes:e,edges:i,defaultNodes:n,defaultEdges:r,width:s,height:a,fitView:c,fitViewOptions:h,minZoom:d,maxZoom:f,nodeOrigin:g,nodeExtent:m,zIndexMode:O}){return N.useContext(lm)?v.jsx(v.Fragment,{children:t}):v.jsx(kE,{initialNodes:e,initialEdges:i,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:a,fitView:c,initialFitViewOptions:h,initialMinZoom:d,initialMaxZoom:f,nodeOrigin:g,nodeExtent:m,zIndexMode:O,children:t})}const $N={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function PN({nodes:t,edges:e,defaultNodes:i,defaultEdges:n,className:r,nodeTypes:s,edgeTypes:a,onNodeClick:c,onEdgeClick:h,onInit:d,onMove:f,onMoveStart:g,onMoveEnd:m,onConnect:O,onConnectStart:S,onConnectEnd:_,onClickConnectStart:w,onClickConnectEnd:x,onNodeMouseEnter:Q,onNodeMouseMove:k,onNodeMouseLeave:T,onNodeContextMenu:M,onNodeDoubleClick:$,onNodeDragStart:R,onNodeDrag:V,onNodeDragStop:H,onNodesDelete:ee,onEdgesDelete:I,onDelete:j,onSelectionChange:D,onSelectionDragStart:E,onSelectionDrag:X,onSelectionDragStop:P,onSelectionContextMenu:Z,onSelectionStart:L,onSelectionEnd:B,onBeforeDelete:G,connectionMode:z,connectionLineType:q=Eo.Bezier,connectionLineStyle:K,connectionLineComponent:ie,connectionLineContainerStyle:ce,deleteKeyCode:de="Backspace",selectionKeyCode:pe="Shift",selectionOnDrag:fe=!1,selectionMode:ve=ku.Full,panActivationKeyCode:De="Space",multiSelectionKeyCode:Ee=Tu()?"Meta":"Control",zoomActivationKeyCode:ke=Tu()?"Meta":"Control",snapToGrid:me,snapGrid:Be,onlyRenderVisibleElements:lt=!1,selectNodesOnDrag:He,nodesDraggable:Ft,autoPanOnNodeFocus:rn,nodesConnectable:qi,nodesFocusable:_n,nodeOrigin:ar=JP,edgesFocusable:oe,edgesReconnectable:We,elementsSelectable:Le=!0,defaultViewport:sn=rX,minZoom:on=.5,maxZoom:Vi=2,translateExtent:Go=wu,preventScrolling:Rm=!0,nodeExtent:tl,defaultMarkerColor:Am="#b1b1b7",zoomOnScroll:Mm=!0,zoomOnPinch:Fo=!0,panOnScroll:Ii=!1,panOnScrollSpeed:wr=.5,panOnScrollMode:Yi=za.Free,zoomOnDoubleClick:zm=!0,panOnDrag:jm=!0,onPaneClick:Dm,onPaneMouseEnter:il,onPaneMouseMove:nl,onPaneMouseLeave:rl,onPaneScroll:Kr,onPaneContextMenu:sl,paneClickDistance:Ko=1,nodeClickDistance:Bm=0,children:Od,onReconnect:Lc,onReconnectStart:Jo,onReconnectEnd:Lm,onEdgeContextMenu:vd,onEdgeDoubleClick:yd,onEdgeMouseEnter:Sd,onEdgeMouseMove:Xc,onEdgeMouseLeave:Nc,reconnectRadius:bd=10,onNodesChange:_d,onEdgesChange:kr,noDragClassName:li="nodrag",noWheelClassName:Di="nowheel",noPanClassName:Jr="nopan",fitView:ol,fitViewOptions:xd,connectOnClick:Xm,attributionPosition:wd,proOptions:ea,defaultEdgeOptions:Zc,elevateNodesOnSelect:Zs=!0,elevateEdgesOnSelect:Ws=!1,disableKeyboardA11y:qs=!1,autoPanOnConnect:Vs,autoPanOnNodeDrag:Kt,autoPanSpeed:kd,connectionRadius:Cd,isValidConnection:es,onError:Is,style:Nm,id:Wc,nodeDragThreshold:Td,connectionDragThreshold:Zm,viewport:al,onViewportChange:ll,width:lr,height:an,colorMode:Qd="light",debug:Wm,onScroll:Ys,ariaLabelConfig:$d,zIndexMode:ta="basic",...qm},ln){const ia=Wc||"1",Pd=lX(Qd),qc=N.useCallback(ts=>{ts.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ys==null||Ys(ts)},[Ys]);return v.jsx("div",{"data-testid":"rf__wrapper",...qm,onScroll:qc,style:{...Nm,...$N},ref:ln,className:ai(["react-flow",r,Pd]),id:Wc,role:"application",children:v.jsxs(QN,{nodes:t,edges:e,width:lr,height:an,fitView:ol,fitViewOptions:xd,minZoom:on,maxZoom:Vi,nodeOrigin:ar,nodeExtent:tl,zIndexMode:ta,children:[v.jsx(aX,{nodes:t,edges:e,defaultNodes:i,defaultEdges:n,onConnect:O,onConnectStart:S,onConnectEnd:_,onClickConnectStart:w,onClickConnectEnd:x,nodesDraggable:Ft,autoPanOnNodeFocus:rn,nodesConnectable:qi,nodesFocusable:_n,edgesFocusable:oe,edgesReconnectable:We,elementsSelectable:Le,elevateNodesOnSelect:Zs,elevateEdgesOnSelect:Ws,minZoom:on,maxZoom:Vi,nodeExtent:tl,onNodesChange:_d,onEdgesChange:kr,snapToGrid:me,snapGrid:Be,connectionMode:z,translateExtent:Go,connectOnClick:Xm,defaultEdgeOptions:Zc,fitView:ol,fitViewOptions:xd,onNodesDelete:ee,onEdgesDelete:I,onDelete:j,onNodeDragStart:R,onNodeDrag:V,onNodeDragStop:H,onSelectionDrag:X,onSelectionDragStart:E,onSelectionDragStop:P,onMove:f,onMoveStart:g,onMoveEnd:m,noPanClassName:Jr,nodeOrigin:ar,rfId:ia,autoPanOnConnect:Vs,autoPanOnNodeDrag:Kt,autoPanSpeed:kd,onError:Is,connectionRadius:Cd,isValidConnection:es,selectNodesOnDrag:He,nodeDragThreshold:Td,connectionDragThreshold:Zm,onBeforeDelete:G,debug:Wm,ariaLabelConfig:$d,zIndexMode:ta}),v.jsx(CN,{onInit:d,onNodeClick:c,onEdgeClick:h,onNodeMouseEnter:Q,onNodeMouseMove:k,onNodeMouseLeave:T,onNodeContextMenu:M,onNodeDoubleClick:$,nodeTypes:s,edgeTypes:a,connectionLineType:q,connectionLineStyle:K,connectionLineComponent:ie,connectionLineContainerStyle:ce,selectionKeyCode:pe,selectionOnDrag:fe,selectionMode:ve,deleteKeyCode:de,multiSelectionKeyCode:Ee,panActivationKeyCode:De,zoomActivationKeyCode:ke,onlyRenderVisibleElements:lt,defaultViewport:sn,translateExtent:Go,minZoom:on,maxZoom:Vi,preventScrolling:Rm,zoomOnScroll:Mm,zoomOnPinch:Fo,zoomOnDoubleClick:zm,panOnScroll:Ii,panOnScrollSpeed:wr,panOnScrollMode:Yi,panOnDrag:jm,onPaneClick:Dm,onPaneMouseEnter:il,onPaneMouseMove:nl,onPaneMouseLeave:rl,onPaneScroll:Kr,onPaneContextMenu:sl,paneClickDistance:Ko,nodeClickDistance:Bm,onSelectionContextMenu:Z,onSelectionStart:L,onSelectionEnd:B,onReconnect:Lc,onReconnectStart:Jo,onReconnectEnd:Lm,onEdgeContextMenu:vd,onEdgeDoubleClick:yd,onEdgeMouseEnter:Sd,onEdgeMouseMove:Xc,onEdgeMouseLeave:Nc,reconnectRadius:bd,defaultMarkerColor:Am,noDragClassName:li,noWheelClassName:Di,noPanClassName:Jr,rfId:ia,disableKeyboardA11y:qs,nodeExtent:tl,viewport:al,onViewportChange:ll}),v.jsx(nX,{onSelectionChange:D}),Od,v.jsx(K6,{proOptions:ea,position:wd}),v.jsx(F6,{rfId:ia,disableKeyboardA11y:qs})]})})}var EN=tE(PN);function RN({dimensions:t,lineWidth:e,variant:i,className:n}){return v.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:ai(["react-flow__background-pattern",i,n])})}function AN({radius:t,className:e}){return v.jsx("circle",{cx:t,cy:t,r:t,className:ai(["react-flow__background-pattern","dots",e])})}var zo;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(zo||(zo={}));const MN={[zo.Dots]:1,[zo.Lines]:1,[zo.Cross]:6},zN=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function CE({id:t,variant:e=zo.Dots,gap:i=20,size:n,lineWidth:r=1,offset:s=0,color:a,bgColor:c,style:h,className:d,patternClassName:f}){const g=N.useRef(null),{transform:m,patternId:O}=at(zN,Mt),S=n||MN[e],_=e===zo.Dots,w=e===zo.Cross,x=Array.isArray(i)?i:[i,i],Q=[x[0]*m[2]||1,x[1]*m[2]||1],k=S*m[2],T=Array.isArray(s)?s:[s,s],M=w?[k,k]:Q,$=[T[0]*m[2]||1+M[0]/2,T[1]*m[2]||1+M[1]/2],R=`${O}${t||""}`;return v.jsxs("svg",{className:ai(["react-flow__background",d]),style:{...h,...um,"--xy-background-color-props":c,"--xy-background-pattern-color-props":a},ref:g,"data-testid":"rf__background",children:[v.jsx("pattern",{id:R,x:m[0]%Q[0],y:m[1]%Q[1],width:Q[0],height:Q[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${$[0]},-${$[1]})`,children:_?v.jsx(AN,{radius:k/2,className:f}):v.jsx(RN,{dimensions:M,lineWidth:r,variant:e,className:f})}),v.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}CE.displayName="Background";const jN=N.memo(CE);function DN(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:v.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function BN(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:v.jsx("path",{d:"M0 0h32v4.2H0z"})})}function LN(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:v.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function XN(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function NN(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Uf({children:t,className:e,...i}){return v.jsx("button",{type:"button",className:ai(["react-flow__controls-button",e]),...i,children:t})}const ZN=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function TE({style:t,showZoom:e=!0,showFitView:i=!0,showInteractive:n=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:a,onFitView:c,onInteractiveChange:h,className:d,children:f,position:g="bottom-left",orientation:m="vertical","aria-label":O}){const S=jt(),{isInteractive:_,minZoomReached:w,maxZoomReached:x,ariaLabelConfig:Q}=at(ZN,Mt),{zoomIn:k,zoomOut:T,fitView:M}=hm(),$=()=>{k(),s==null||s()},R=()=>{T(),a==null||a()},V=()=>{M(r),c==null||c()},H=()=>{S.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h==null||h(!_)},ee=m==="horizontal"?"horizontal":"vertical";return v.jsxs(cm,{className:ai(["react-flow__controls",ee,d]),position:g,style:t,"data-testid":"rf__controls","aria-label":O??Q["controls.ariaLabel"],children:[e&&v.jsxs(v.Fragment,{children:[v.jsx(Uf,{onClick:$,className:"react-flow__controls-zoomin",title:Q["controls.zoomIn.ariaLabel"],"aria-label":Q["controls.zoomIn.ariaLabel"],disabled:x,children:v.jsx(DN,{})}),v.jsx(Uf,{onClick:R,className:"react-flow__controls-zoomout",title:Q["controls.zoomOut.ariaLabel"],"aria-label":Q["controls.zoomOut.ariaLabel"],disabled:w,children:v.jsx(BN,{})})]}),i&&v.jsx(Uf,{className:"react-flow__controls-fitview",onClick:V,title:Q["controls.fitView.ariaLabel"],"aria-label":Q["controls.fitView.ariaLabel"],children:v.jsx(LN,{})}),n&&v.jsx(Uf,{className:"react-flow__controls-interactive",onClick:H,title:Q["controls.interactive.ariaLabel"],"aria-label":Q["controls.interactive.ariaLabel"],children:_?v.jsx(NN,{}):v.jsx(XN,{})}),f]})}TE.displayName="Controls";N.memo(TE);function WN({id:t,x:e,y:i,width:n,height:r,style:s,color:a,strokeColor:c,strokeWidth:h,className:d,borderRadius:f,shapeRendering:g,selected:m,onClick:O}){const{background:S,backgroundColor:_}=s||{},w=a||S||_;return v.jsx("rect",{className:ai(["react-flow__minimap-node",{selected:m},d]),x:e,y:i,rx:f,ry:f,width:n,height:r,style:{fill:w,stroke:c,strokeWidth:h},shapeRendering:g,onClick:O?x=>O(x,t):void 0})}const qN=N.memo(WN),VN=t=>t.nodes.map(e=>e.id),fv=t=>t instanceof Function?t:()=>t;function IN({nodeStrokeColor:t,nodeColor:e,nodeClassName:i="",nodeBorderRadius:n=5,nodeStrokeWidth:r,nodeComponent:s=qN,onClick:a}){const c=at(VN,Mt),h=fv(e),d=fv(t),f=fv(i),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return v.jsx(v.Fragment,{children:c.map(m=>v.jsx(HN,{id:m,nodeColorFunc:h,nodeStrokeColorFunc:d,nodeClassNameFunc:f,nodeBorderRadius:n,nodeStrokeWidth:r,NodeComponent:s,onClick:a,shapeRendering:g},m))})}function YN({id:t,nodeColorFunc:e,nodeStrokeColorFunc:i,nodeClassNameFunc:n,nodeBorderRadius:r,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:c,onClick:h}){const{node:d,x:f,y:g,width:m,height:O}=at(S=>{const _=S.nodeLookup.get(t);if(!_)return{node:void 0,x:0,y:0,width:0,height:0};const w=_.internals.userNode,{x,y:Q}=_.internals.positionAbsolute,{width:k,height:T}=Ds(w);return{node:w,x,y:Q,width:k,height:T}},Mt);return!d||d.hidden||!$P(d)?null:v.jsx(c,{x:f,y:g,width:m,height:O,style:d.style,selected:!!d.selected,className:n(d),color:e(d),borderRadius:r,strokeColor:i(d),strokeWidth:s,shapeRendering:a,onClick:h,id:d.id})}const HN=N.memo(YN);var UN=N.memo(IN);const GN=200,FN=150,KN=t=>!t.hidden,JN=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?QP(ed(t.nodeLookup,{filter:KN}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},e8="react-flow__minimap-desc";function QE({style:t,className:e,nodeStrokeColor:i,nodeColor:n,nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:c,bgColor:h,maskColor:d,maskStrokeColor:f,maskStrokeWidth:g,position:m="bottom-right",onClick:O,onNodeClick:S,pannable:_=!1,zoomable:w=!1,ariaLabel:x,inversePan:Q,zoomStep:k=1,offsetScale:T=5}){const M=jt(),$=N.useRef(null),{boundingRect:R,viewBB:V,rfId:H,panZoom:ee,translateExtent:I,flowWidth:j,flowHeight:D,ariaLabelConfig:E}=at(JN,Mt),X=(t==null?void 0:t.width)??GN,P=(t==null?void 0:t.height)??FN,Z=R.width/X,L=R.height/P,B=Math.max(Z,L),G=B*X,z=B*P,q=T*B,K=R.x-(G-R.width)/2-q,ie=R.y-(z-R.height)/2-q,ce=G+q*2,de=z+q*2,pe=`${e8}-${H}`,fe=N.useRef(0),ve=N.useRef();fe.current=B,N.useEffect(()=>{if($.current&&ee)return ve.current=v6({domNode:$.current,panZoom:ee,getTransform:()=>M.getState().transform,getViewScale:()=>fe.current}),()=>{var me;(me=ve.current)==null||me.destroy()}},[ee]),N.useEffect(()=>{var me;(me=ve.current)==null||me.update({translateExtent:I,width:j,height:D,inversePan:Q,pannable:_,zoomStep:k,zoomable:w})},[_,w,Q,k,I,j,D]);const De=O?me=>{var He;const[Be,lt]=((He=ve.current)==null?void 0:He.pointer(me))||[0,0];O(me,{x:Be,y:lt})}:void 0,Ee=S?N.useCallback((me,Be)=>{const lt=M.getState().nodeLookup.get(Be).internals.userNode;S(me,lt)},[]):void 0,ke=x??E["minimap.ariaLabel"];return v.jsx(cm,{position:m,style:{...t,"--xy-minimap-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*B:void 0,"--xy-minimap-node-background-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:ai(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:v.jsxs("svg",{width:X,height:P,viewBox:`${K} ${ie} ${ce} ${de}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":pe,ref:$,onClick:De,children:[ke&&v.jsx("title",{id:pe,children:ke}),v.jsx(UN,{onClick:Ee,nodeColor:n,nodeStrokeColor:i,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:a,nodeComponent:c}),v.jsx("path",{className:"react-flow__minimap-mask",d:`M${K-q},${ie-q}h${ce+q*2}v${de+q*2}h${-ce-q*2}z
71
71
  M${V.x},${V.y}h${V.width}v${V.height}h${-V.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}QE.displayName="MiniMap";N.memo(QE);const t8=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,i8={[Sc.Line]:"right",[Sc.Handle]:"bottom-right"};function n8({nodeId:t,position:e,variant:i=Sc.Handle,className:n,style:r=void 0,children:s,color:a,minWidth:c=10,minHeight:h=10,maxWidth:d=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:m,autoScale:O=!0,shouldResize:S,onResizeStart:_,onResize:w,onResizeEnd:x}){const Q=sE(),k=typeof t=="string"?t:Q,T=jt(),M=N.useRef(null),$=i===Sc.Handle,R=at(N.useCallback(t8($&&O),[$,O]),Mt),V=N.useRef(null),H=e??i8[i];N.useEffect(()=>{if(!(!M.current||!k))return V.current||(V.current=R6({domNode:M.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:I,transform:j,snapGrid:D,snapToGrid:E,nodeOrigin:X,domNode:P}=T.getState();return{nodeLookup:I,transform:j,snapGrid:D,snapToGrid:E,nodeOrigin:X,paneDomNode:P}},onChange:(I,j)=>{const{triggerNodeChanges:D,nodeLookup:E,parentLookup:X,nodeOrigin:P}=T.getState(),Z=[],L={x:I.x,y:I.y},B=E.get(k);if(B&&B.expandParent&&B.parentId){const G=B.origin??P,z=I.width??B.measured.width??0,q=I.height??B.measured.height??0,K={id:B.id,parentId:B.parentId,rect:{width:z,height:q,...PP({x:I.x??B.position.x,y:I.y??B.position.y},{width:z,height:q},B.parentId,E,G)}},ie=D1([K],E,X,P);Z.push(...ie),L.x=I.x?Math.max(G[0]*z,I.x):void 0,L.y=I.y?Math.max(G[1]*q,I.y):void 0}if(L.x!==void 0&&L.y!==void 0){const G={id:k,type:"position",position:{...L}};Z.push(G)}if(I.width!==void 0&&I.height!==void 0){const z={id:k,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:I.width,height:I.height}};Z.push(z)}for(const G of j){const z={...G,type:"position"};Z.push(z)}D(Z)},onEnd:({width:I,height:j})=>{const D={id:k,type:"dimensions",resizing:!1,dimensions:{width:I,height:j}};T.getState().triggerNodeChanges([D])}})),V.current.update({controlPosition:H,boundaries:{minWidth:c,minHeight:h,maxWidth:d,maxHeight:f},keepAspectRatio:g,resizeDirection:m,onResizeStart:_,onResize:w,onResizeEnd:x,shouldResize:S}),()=>{var I;(I=V.current)==null||I.destroy()}},[H,c,h,d,f,g,_,w,x,S]);const ee=H.split("-");return v.jsx("div",{className:ai(["react-flow__resize-control","nodrag",...ee,i,n]),ref:M,style:{...r,scale:R,...a&&{[$?"backgroundColor":"borderColor"]:a}},children:s})}N.memo(n8);const o2={running:"#4ae168",starting:"#e5c07b",stopped:"#5c6370",crashed:"#e06c75",completed:"#33afbc",killed:"#5c6370"},a2={planner:{bg:"#4ae16820",color:"#4ae168"},backend:{bg:"#33afbc20",color:"#33afbc"},frontend:{bg:"#e5c07b20",color:"#e5c07b"},fullstack:{bg:"#4ae16820",color:"#4ae168"},testing:{bg:"#61afef20",color:"#61afef"},devops:{bg:"#d19a6620",color:"#d19a66"},docs:{bg:"#5c637020",color:"#8b929e"}};function r8({data:t}){var h;const e=o2[t.status]||o2.stopped,i=a2[t.role]||a2.docs,n=t.status==="running"||t.status==="starting",r=t.selected,s=Math.round((t.contextUsage||0)*100),a=t.tokensUsed>0?t.tokensUsed>999?`${(t.tokensUsed/1e3).toFixed(1)}k`:`${t.tokensUsed}`:"0",c=t.workingDir?t.workingDir.replace(/^\.\//,""):((h=t.scope)==null?void 0:h.length)>0?t.scope[0].replace(/\/\*\*$/,"").replace(/^src\//,""):t.role;return v.jsxs("div",{style:{background:"#282c34",border:r?"1px solid #33afbc":"1px solid #3e4451",borderRadius:10,width:210,padding:0,cursor:"pointer",fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', Consolas, monospace",fontSize:10,overflow:"hidden"},children:[v.jsx(bc,{type:"target",position:Re.Top,style:{background:"#282c34",border:"2px solid #3e4451",width:8,height:8,borderRadius:"50%",top:-4}}),v.jsxs("div",{style:{padding:"10px 12px 8px"},children:[v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:6},children:[v.jsx("div",{style:{width:7,height:7,borderRadius:"50%",background:e,flexShrink:0,...n?{animation:"pulse 2s infinite"}:{}}}),v.jsx("span",{style:{color:"#e6e6e6",fontWeight:700,fontSize:12,flex:1},children:t.name})]}),v.jsx("div",{style:{marginBottom:10},children:v.jsx("span",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:1,color:i.color,background:i.bg,padding:"3px 8px",borderRadius:4,display:"inline-block"},children:t.role})}),v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:"#5c6370",fontSize:10,marginBottom:4},children:[v.jsxs("span",{children:[a," tok"]}),v.jsxs("span",{children:[s,"% ctx"]})]}),v.jsx("div",{style:{color:"#3e4451",fontSize:9,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c})]}),n&&v.jsx(s8,{agentId:t.id,color:e}),v.jsx(bc,{type:"source",position:Re.Bottom,style:{background:"#282c34",border:"2px solid #3e4451",width:8,height:8,borderRadius:"50%",bottom:-4}})]})}function s8({agentId:t,color:e}){const i=N.useRef(),n=Ce(r=>r.tokenTimeline);return N.useEffect(()=>{const r=i.current;if(!r)return;const s=window.devicePixelRatio||1,a=210,c=24;r.width=a*s,r.height=c*s;const h=r.getContext("2d");h.scale(s,s),h.clearRect(0,0,a,c);const d=n[t]||[];if(d.length<2){h.strokeStyle="#2c313a",h.lineWidth=.5,h.beginPath(),h.moveTo(0,c/2),h.lineTo(a,c/2),h.stroke();return}const f=d.slice(-40),g=f.map(T=>T.v),m=Math.min(...g),S=Math.max(...g)-m||1,_=4,w=c-_*2,x=a/(f.length-1);h.beginPath(),f.forEach((T,M)=>{const $=M*x,R=_+w-(T.v-m)/S*w;M===0?h.moveTo($,R):h.lineTo($,R)}),h.strokeStyle=e,h.lineWidth=1,h.stroke();const Q=(f.length-1)*x,k=_+w-(f[f.length-1].v-m)/S*w;h.beginPath(),h.arc(Q,k,2,0,Math.PI*2),h.fillStyle=e,h.fill()},[n,t,e]),v.jsx("div",{style:{borderTop:"1px solid #2c313a",background:"#1e222a"},children:v.jsx("canvas",{ref:i,style:{display:"block",width:210,height:24}})})}const o8={agent:r8},Zl=4,Gf=250,pv=140;function a8(){const t=Ce(g=>g.agents),e=Ce(g=>g.detailPanel),i=Ce(g=>g.selectAgent),n=Ce(g=>g.clearSelection),{fitView:r}=hm(),s=(e==null?void 0:e.type)==="agent"?e.agentId:null,a=N.useRef(0),{nodes:c,edges:h}=N.useMemo(()=>{const g=t.filter($=>$.status==="running"||$.status==="starting"),m=t.filter($=>$.status!=="running"&&$.status!=="starting"),O=g.map(($,R)=>({id:$.id,type:"agent",position:{x:R%Zl*Gf,y:80+Math.floor(R/Zl)*pv},data:{...$,selected:$.id===s},draggable:!0})),_=80+(Math.ceil(g.length/Zl)||1)*pv+50,w=m.map(($,R)=>({id:$.id,type:"agent",position:{x:R%Zl*Gf,y:_+Math.floor(R/Zl)*pv},data:{...$,selected:$.id===s},draggable:!0})),x=[...O,...w],T={id:"groove-root",type:"default",position:{x:(Math.min(Math.max(g.length,m.length,1),Zl)*Gf-Gf)/2+25,y:0},data:{label:"GROOVE"},selectable:!1,draggable:!1,style:{background:"#282c34",color:"#e6e6e6",border:"1px solid #3e4451",borderRadius:24,fontWeight:600,fontSize:11,letterSpacing:6,padding:"10px 36px 9px",fontFamily:"'JetBrains Mono', 'SF Mono', Consolas, monospace"}},M=x.map($=>{const R=t.find(H=>H.id===$.id),V=(R==null?void 0:R.status)==="running";return{id:`groove-${$.id}`,source:"groove-root",target:$.id,type:"default",style:{stroke:V?"#5c6370":"#2c313a",strokeWidth:1},animated:V}});return{nodes:[T,...x],edges:M}},[t,s]);N.useEffect(()=>{const g=t.length;g!==a.current&&setTimeout(()=>r({padding:.3,maxZoom:1.4,duration:200}),50),a.current=g},[t.length,r]),N.useEffect(()=>{setTimeout(()=>r({padding:.3,maxZoom:1.4,duration:0}),100)},[]);const d=N.useCallback((g,m)=>{m.id!=="groove-root"&&i(m.id)},[i]),f=N.useCallback(()=>{n()},[n]);return v.jsx(EN,{nodes:c,edges:h,nodeTypes:o8,onNodeClick:d,onPaneClick:f,proOptions:{hideAttribution:!0},nodesConnectable:!1,elementsSelectable:!0,minZoom:.3,maxZoom:2,fitView:!0,fitViewOptions:{padding:.3,maxZoom:1.4},children:v.jsx(jN,{color:"#3e4451",gap:20,size:1})})}function l8(){return v.jsx(kE,{children:v.jsx(a8,{})})}function c8({agent:t}){const[e,i]=N.useState(""),[n,r]=N.useState(null),s=N.useRef(),a=Ce(x=>x.activityLog),c=Ce(x=>x.instructAgent),h=Ce(x=>x.queryAgent),d=Ce(x=>x.showStatus),f=Ce(x=>x.chatHistory),g=a[t.id]||[],m=f[t.id]||[],O=f8(m,g),S=t.status==="running"||t.status==="starting";N.useEffect(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[O.length]);async function _(){const x=e.trim();if(!x||n)return;const Q=x.startsWith("?"),k=Q?x.slice(1).trim():x;if(k)if(i(""),Q&&S){r("querying...");try{await h(t.id,k)}catch{}r(null)}else{r(S?"sending...":"continuing...");try{await c(t.id,k)}catch(T){d(`failed: ${T.message}`)}r(null)}}function w(x){x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),x.stopPropagation(),_())}return v.jsxs("div",{style:At.container,children:[v.jsxs("div",{ref:s,style:At.timeline,children:[O.length===0&&v.jsx("div",{style:At.hint,children:S?"Type a message to instruct this agent. Prefix with ? to query without disrupting.":"Agent finished. Reply to continue the conversation."}),O.map((x,Q)=>v.jsxs("div",{style:At.entry,children:[x.from==="user"&&v.jsxs("div",{style:At.userMsg,children:[v.jsx("span",{style:At.userLabel,children:x.isQuery?"? you":"> you"}),v.jsx("div",{style:At.userText,children:x.text})]}),x.from==="agent"&&v.jsxs("div",{style:At.agentMsg,children:[v.jsx("span",{style:At.agentLabel,children:t.name}),v.jsx("div",{style:At.agentText,children:Q===O.length-1&&x.from==="agent"&&Date.now()-x.timestamp<5e3?v.jsx(h8,{text:x.text}):v.jsx($E,{text:x.text})})]}),x.from==="system"&&v.jsx("div",{style:At.systemMsg,children:x.text}),v.jsx("span",{style:At.time,children:new Date(x.timestamp).toLocaleTimeString()})]},Q)),n&&v.jsx("div",{style:At.statusMsg,children:n})]}),t.role==="planner"&&t.status==="completed"&&v.jsx(u8,{showStatus:d}),v.jsxs("div",{style:At.inputRow,children:[v.jsx("input",{style:At.input,value:e,onChange:x=>i(x.target.value),onKeyDown:w,placeholder:S?"message or ?query...":"reply to continue...",disabled:!!n,spellCheck:!1}),v.jsx("button",{type:"button",onClick:_,disabled:!!n||!e.trim(),style:{...At.sendBtn,opacity:n||!e.trim()?.3:1},children:"Send"})]})]})}function h8({text:t}){const[e,i]=N.useState(0),n=N.useRef(t);N.useEffect(()=>{n.current=t,i(0)},[t]),N.useEffect(()=>{if(e>=t.length)return;const a=Math.random()>.7?4:2,c=setTimeout(()=>{i(h=>Math.min(h+a,t.length))},12);return()=>clearTimeout(c)},[e,t.length]);const r=t.slice(0,e),s=e>=t.length;return v.jsxs(v.Fragment,{children:[v.jsx($E,{text:r}),!s&&v.jsx("span",{style:At.cursor,children:"|"})]})}function u8({showStatus:t}){const[e,i]=N.useState(null),[n,r]=N.useState(!1),[s,a]=N.useState(!1);N.useEffect(()=>{fetch("/api/recommended-team").then(h=>h.json()).then(h=>{h.exists&&h.agents.length>0&&i(h.agents)}).catch(()=>{})},[]);async function c(){r(!0);try{const d=await(await fetch("/api/recommended-team/launch",{method:"POST"})).json();d.launched?(t(`Launched ${d.launched} agents`),a(!0)):t(`Launch failed: ${d.error||"unknown"}`)}catch(h){t(`Launch failed: ${h.message}`)}r(!1)}return!e||s?null:v.jsxs("div",{style:At.launchBox,children:[v.jsxs("div",{style:At.launchHeader,children:["Recommended Team (",e.length," agents)"]}),v.jsx("div",{style:At.launchList,children:e.map((h,d)=>v.jsxs("div",{style:At.launchAgent,children:[v.jsx("span",{style:At.launchRole,children:h.role}),v.jsxs("span",{style:At.launchPrompt,children:[(h.prompt||"").slice(0,80),(h.prompt||"").length>80?"...":""]})]},d))}),v.jsx("button",{type:"button",onClick:c,disabled:n,style:{...At.launchBtn,opacity:n?.5:1},children:n?"Launching...":"Launch Team"})]})}function $E({text:t}){return t?t.split(`
72
72
  `).map((i,n)=>{if(/^#{1,3}\s/.test(i)){const r=i.replace(/^#{1,3}\s+/,"");return v.jsx("div",{style:{fontWeight:700,color:"var(--text-bright)",marginTop:n>0?6:0,marginBottom:2,fontSize:11},children:Ff(r)},n)}if(/^[-*_]{3,}\s*$/.test(i))return v.jsx("div",{style:{borderTop:"1px solid var(--border)",margin:"4px 0"}},n);if(/^\s*[-*]\s/.test(i)){const r=i.match(/^(\s*)/)[1].length,s=i.replace(/^\s*[-*]\s+/,"");return v.jsxs("div",{style:{paddingLeft:8+r*6,position:"relative"},children:[v.jsx("span",{style:{position:"absolute",left:r*6,color:"var(--text-dim)"},children:"-"}),Ff(s)]},n)}if(/^\s*\d+\.\s/.test(i)){const r=i.match(/^(\s*)/)[1].length,s=i.match(/(\d+)\./)[1],a=i.replace(/^\s*\d+\.\s+/,"");return v.jsxs("div",{style:{paddingLeft:12+r*6,position:"relative"},children:[v.jsxs("span",{style:{position:"absolute",left:r*6,color:"var(--text-dim)"},children:[s,"."]}),Ff(a)]},n)}return i.trim()?v.jsx("div",{children:Ff(i)},n):v.jsx("div",{style:{height:4}},n)}):null}function Ff(t){const e=[];let i=t,n=0;for(;i.length>0;){const r=i.match(/^(.*?)\*\*(.+?)\*\*(.*)/s);if(r){r[1]&&e.push(v.jsx("span",{children:r[1]},n++)),e.push(v.jsx("span",{style:{fontWeight:700,color:"var(--text-bright)"},children:r[2]},n++)),i=r[3];continue}const s=i.match(/^(.*?)`(.+?)`(.*)/s);if(s){s[1]&&e.push(v.jsx("span",{children:s[1]},n++)),e.push(v.jsx("span",{style:{background:"var(--bg-base)",padding:"0 3px",borderRadius:2,color:"var(--accent)",fontSize:"0.95em"},children:s[2]},n++)),i=s[3];continue}e.push(v.jsx("span",{children:i},n++));break}return e.length>0?e:t}function d8(t){if(!t)return"";try{const e=JSON.parse(t);return Array.isArray(e)?e.map(i=>i.type==="text"&&i.text?i.text:(i.type==="thinking"&&i.thinking||i.type==="tool_use",null)).filter(Boolean).join(`
73
- `)||null:e.type==="text"&&e.text?e.text:e.type==="result"&&e.result?e.result:null}catch{return t.length>5?t:null}}function f8(t,e){const i=[];for(const n of t)i.push({timestamp:n.timestamp,from:n.from,text:n.text,isQuery:n.isQuery});for(const n of e.slice(-30)){const r=d8(n.text);if(!r||r.trimStart().startsWith("[")||r.trimStart().startsWith("{"))continue;i.some(a=>Math.abs(a.timestamp-n.timestamp)<2e3&&a.from==="agent")||i.push({timestamp:n.timestamp,from:"agent",text:r.slice(0,2e3)})}return i.sort((n,r)=>n.timestamp-r.timestamp),i}const At={container:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},timeline:{flex:1,overflowY:"auto",padding:"10px 0"},hint:{color:"var(--text-dim)",fontSize:11,padding:"20px 4px",textAlign:"center",lineHeight:1.6},entry:{padding:"4px 0",position:"relative"},userMsg:{display:"flex",flexDirection:"column",gap:2},userLabel:{fontSize:10,fontWeight:600,color:"var(--accent)",textTransform:"uppercase",letterSpacing:.5},userText:{fontSize:12,color:"var(--text-bright)",lineHeight:1.5,padding:"4px 8px",background:"var(--bg-surface)",borderRadius:2,border:"1px solid var(--border)",whiteSpace:"pre-wrap",wordBreak:"break-word"},agentMsg:{display:"flex",flexDirection:"column",gap:2},agentLabel:{fontSize:10,fontWeight:600,color:"var(--green)",textTransform:"uppercase",letterSpacing:.5},agentText:{fontSize:12,color:"var(--text-primary)",lineHeight:1.5,padding:"4px 8px",background:"var(--bg-base)",borderRadius:2,whiteSpace:"pre-wrap",wordBreak:"break-word"},systemMsg:{fontSize:10,color:"var(--text-dim)",fontStyle:"italic",padding:"2px 0"},time:{position:"absolute",top:4,right:0,fontSize:9,color:"var(--text-muted)"},statusMsg:{fontSize:11,color:"var(--text-dim)",fontStyle:"italic",padding:"6px 0"},inputRow:{display:"flex",gap:6,padding:"8px 0 0",borderTop:"1px solid var(--border)"},input:{flex:1,background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"8px 10px",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},sendBtn:{padding:"8px 14px",background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:11,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},cursor:{color:"var(--accent)",fontWeight:400,animation:"pulse 1s infinite",marginLeft:1},launchBox:{padding:"8px 0",borderTop:"1px solid var(--border)",flexShrink:0},launchHeader:{fontSize:10,fontWeight:700,color:"var(--text-bright)",marginBottom:6},launchList:{display:"flex",flexDirection:"column",gap:3,marginBottom:8},launchAgent:{display:"flex",alignItems:"baseline",gap:6,fontSize:10,padding:"2px 0"},launchRole:{fontWeight:600,color:"var(--accent)",minWidth:60},launchPrompt:{color:"var(--text-dim)",fontSize:9,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},launchBtn:{width:"100%",padding:"8px",background:"rgba(51, 175, 188, 0.1)",border:"1px solid var(--accent)",color:"var(--accent)",fontSize:11,fontWeight:700,fontFamily:"var(--font)",cursor:"pointer",letterSpacing:.5}};function p8({agent:t}){var h;const e=Ce(d=>d.activityLog),i=Ce(d=>d.tokenTimeline),n=e[t.id]||[],r=i[t.id]||[],s=Math.round((t.contextUsage||0)*100),a=t.spawnedAt?O8(Date.now()-new Date(t.spawnedAt).getTime()):"-",c=t.spawnedAt&&t.tokensUsed>0?Math.round(t.tokensUsed/((Date.now()-new Date(t.spawnedAt).getTime())/6e4)):0;return v.jsxs("div",{style:ni.container,children:[v.jsxs("div",{style:ni.metricsGrid,children:[v.jsx(Kf,{label:"Tokens",value:((h=t.tokensUsed)==null?void 0:h.toLocaleString())||"0"}),v.jsx(Kf,{label:"Burn Rate",value:`${c}/min`}),v.jsx(Kf,{label:"Uptime",value:a}),v.jsx(Kf,{label:"Activity",value:`${n.length} events`})]}),v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:ni.sectionLabel,children:"TOKEN HEARTBEAT"}),v.jsx(g8,{data:r,isAlive:t.status==="running"})]}),v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:ni.sectionLabel,children:"CONTEXT USAGE"}),v.jsxs("div",{style:ni.gaugeRow,children:[v.jsx("div",{style:ni.gaugeTrack,children:v.jsx("div",{style:{height:"100%",width:`${s}%`,borderRadius:1,background:s>80?"var(--red)":s>60?"var(--amber)":"var(--green)",transition:"width 0.3s"}})}),v.jsxs("span",{style:ni.gaugeLabel,children:[s,"%"]})]})]}),v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:ni.sectionLabel,children:"ACTIVITY PULSE"}),v.jsx(m8,{activity:n})]}),v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:ni.sectionLabel,children:"DETAILS"}),v.jsxs("div",{style:ni.infoList,children:[v.jsx(So,{label:"ID",value:t.id}),v.jsx(So,{label:"Role",value:t.role}),v.jsx(So,{label:"Provider",value:t.provider}),v.jsx(So,{label:"Model",value:t.model||"default"}),t.workingDir&&v.jsx(So,{label:"Directory",value:t.workingDir}),v.jsx(So,{label:"Scope",value:(t.scope||[]).join(", ")||"unrestricted"}),v.jsx(So,{label:"Spawned",value:t.spawnedAt?new Date(t.spawnedAt).toLocaleTimeString():"-"}),v.jsx(So,{label:"Last Active",value:t.lastActivity?new Date(t.lastActivity).toLocaleTimeString():"-"})]})]}),t.prompt&&v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:ni.sectionLabel,children:"ORIGINAL PROMPT"}),v.jsx("div",{style:ni.promptBox,children:t.prompt})]}),v.jsxs("div",{style:{marginTop:16},children:[v.jsxs("div",{style:ni.sectionLabel,children:["RECENT LOG (",n.length,")"]}),v.jsxs("div",{style:ni.logScroll,children:[n.length===0&&v.jsx("div",{style:{color:"var(--text-dim)",fontSize:11,padding:8},children:"No activity yet..."}),n.slice(-30).reverse().map((d,f)=>{var g;return v.jsxs("div",{style:ni.logEntry,children:[v.jsx("span",{style:ni.logTime,children:new Date(d.timestamp).toLocaleTimeString()}),v.jsx("span",{style:ni.logText,children:(g=d.text)==null?void 0:g.slice(0,200)})]},f)})]})]})]})}function g8({data:t,isAlive:e}){const i=N.useRef();return N.useEffect(()=>{const n=i.current;if(!n)return;const r=n.getContext("2d"),s=n.width,a=n.height;r.clearRect(0,0,s,a),r.strokeStyle="#3e4451",r.lineWidth=.5;for(let O=0;O<a;O+=a/4)r.beginPath(),r.moveTo(0,O),r.lineTo(s,O),r.stroke();if(t.length<2){r.strokeStyle=e?"#5c6370":"#3e4451",r.lineWidth=1,r.beginPath(),r.moveTo(0,a/2),r.lineTo(s,a/2),r.stroke(),e&&(r.fillStyle="#5c6370",r.font="10px monospace",r.fillText("waiting for data...",8,a/2-6));return}const c=t.map(O=>O.v),h=Math.min(...c),d=Math.max(...c),f=d-h||1,g=[];for(let O=1;O<c.length;O++){const S=c[O]-c[O-1];S>f*.2&&S>0&&g.push(O)}const m=r.createLinearGradient(0,0,0,a);m.addColorStop(0,e?"rgba(51, 175, 188, 0.15)":"rgba(92, 99, 112, 0.1)"),m.addColorStop(1,"transparent"),r.beginPath(),r.moveTo(0,a);for(let O=0;O<t.length;O++){const S=O/(t.length-1)*s,_=a-4-(c[O]-h)/f*(a-8);r.lineTo(S,_)}r.lineTo(s,a),r.closePath(),r.fillStyle=m,r.fill(),r.strokeStyle=e?"#33afbc":"#5c6370",r.lineWidth=1.5,r.beginPath();for(let O=0;O<t.length;O++){const S=O/(t.length-1)*s,_=a-4-(c[O]-h)/f*(a-8);O===0?r.moveTo(S,_):r.lineTo(S,_)}r.stroke();for(const O of g){const S=O/(t.length-1)*s,_=a-4-(c[O]-h)/f*(a-8);r.fillStyle="#e5c07b",r.beginPath(),r.arc(S,_,3,0,Math.PI*2),r.fill()}if(e&&t.length>0){const O=s,S=a-4-(c[c.length-1]-h)/f*(a-8);r.fillStyle="#33afbc",r.beginPath(),r.arc(O-2,S,3,0,Math.PI*2),r.fill()}r.fillStyle="#5c6370",r.font="9px monospace",r.fillText(d.toLocaleString(),4,10),r.fillText(h.toLocaleString(),4,a-2)},[t,e]),v.jsx("div",{style:ni.chartContainer,children:v.jsx("canvas",{ref:i,width:400,height:60,style:{width:"100%",height:60,display:"block"}})})}function m8({activity:t}){const i=Date.now(),n=300*1e3,r=n/40,s=new Array(40).fill(0);for(const h of t){const d=i-h.timestamp;if(d>n)continue;const f=Math.min(Math.floor((n-d)/r),39);s[f]++}const a=Math.max(...s,1),c=s.map((h,d)=>{const f=d/39*300,g=28-h/a*24;return`${f},${g}`}).join(" ");return v.jsx("div",{style:ni.chartContainer,children:v.jsxs("svg",{width:"100%",height:"32",viewBox:"0 0 300 32",preserveAspectRatio:"none",style:{display:"block"},children:[v.jsx("polyline",{points:c,fill:"none",stroke:"var(--green)",strokeWidth:"1",opacity:"0.6"}),v.jsx("line",{x1:"0",y1:"31",x2:"300",y2:"31",stroke:"var(--text-muted)",strokeWidth:"0.5"})]})})}function Kf({label:t,value:e}){return v.jsxs("div",{style:ni.metric,children:[v.jsx("div",{style:{fontSize:14,fontWeight:700,color:"var(--text-bright)"},children:e}),v.jsx("div",{style:{fontSize:10,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1},children:t})]})}function So({label:t,value:e}){return v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"3px 0"},children:[v.jsx("span",{style:{color:"var(--text-dim)",fontSize:11},children:t}),v.jsx("span",{style:{color:"var(--text-primary)",fontSize:11,maxWidth:"65%",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function O8(t){const e=Math.floor(t/1e3),i=Math.floor(e/60),n=Math.floor(i/60);return n>0?`${n}h ${i%60}m`:i>0?`${i}m ${e%60}s`:`${e}s`}const ni={container:{flex:1,overflowY:"auto",padding:"10px 0"},metricsGrid:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},metric:{background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:10,textAlign:"center"},sectionLabel:{fontSize:11,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5,marginBottom:6,fontWeight:600},gaugeRow:{display:"flex",alignItems:"center",gap:8},gaugeTrack:{flex:1,height:4,background:"var(--text-muted)",borderRadius:2,overflow:"hidden"},gaugeLabel:{fontSize:12,color:"var(--text-primary)",fontWeight:600,minWidth:36,textAlign:"right"},chartContainer:{background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",overflow:"hidden"},infoList:{borderTop:"1px solid var(--border)",paddingTop:6},promptBox:{background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,padding:8,fontSize:12,color:"var(--text-primary)",lineHeight:1.5,whiteSpace:"pre-wrap"},logScroll:{maxHeight:160,overflowY:"auto",background:"var(--bg-base)",borderRadius:2,border:"1px solid var(--border)"},logEntry:{padding:"3px 8px",borderBottom:"1px solid var(--bg-surface)",fontSize:10,display:"flex",gap:6},logTime:{color:"var(--text-dim)",whiteSpace:"nowrap"},logText:{color:"var(--text-primary)",wordBreak:"break-word"}};function v8({agent:t}){const e=Ce(B=>B.killAgent),i=Ce(B=>B.rotateAgent),n=Ce(B=>B.spawnAgent),r=Ce(B=>B.instructAgent),s=Ce(B=>B.showStatus),a=Ce(B=>B.closeDetail),[c,h]=N.useState(!1),[d,f]=N.useState(!1),[g,m]=N.useState(""),[O,S]=N.useState(!1),[_,w]=N.useState(t.model||""),[x,Q]=N.useState([]),[k,T]=N.useState([]),[M,$]=N.useState(!1),R=t.status==="running"||t.status==="starting";N.useEffect(()=>{fetch("/api/providers").then(B=>B.json()).then(Q).catch(()=>{}),fetch("/api/skills/installed").then(B=>B.json()).then(T).catch(()=>{})},[]);const V=x.find(B=>B.id===t.provider),H=(V==null?void 0:V.models)||[];async function ee(){try{await i(t.id)}catch(B){s(`rotate failed: ${B.message}`)}}async function I(){if(!c){h(!0),setTimeout(()=>h(!1),3e3);return}try{await e(t.id),s(`${t.name} killed`)}catch(B){s(`kill failed: ${B.message}`)}h(!1)}async function j(){if(!d){f(!0),setTimeout(()=>f(!1),3e3);return}try{await e(t.id,!0),a(),s(`${t.name} deleted`)}catch(B){s(`delete failed: ${B.message}`)}f(!1)}async function D(B){try{await fetch(`/api/agents/${t.id}/skills/${B}`,{method:"POST"}),s(`skill attached to ${t.name}`)}catch(G){s(`attach failed: ${G.message}`)}}async function E(B){try{await fetch(`/api/agents/${t.id}/skills/${B}`,{method:"DELETE"}),s(`skill detached from ${t.name}`)}catch(G){s(`detach failed: ${G.message}`)}}async function X(){try{const B=await n({role:t.role,scope:t.scope,prompt:t.prompt,provider:t.provider,model:t.model,skills:t.skills});s(`cloned as ${B.name}`)}catch(B){s(`clone failed: ${B.message}`)}}async function P(B){w(B);try{await fetch(`/api/agents/${t.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:B||null})}),s(`model set to ${B||"default"} (takes effect on next rotation)`)}catch(G){s(`model change failed: ${G.message}`)}}async function Z(){if(g.trim())try{await r(t.id,g.trim()),S(!1),m("")}catch(B){s(`prompt update failed: ${B.message}`)}}async function L(){try{await e(t.id,!0);const B=await n({role:t.role,scope:t.scope,prompt:t.prompt,provider:t.provider,model:t.model,skills:t.skills});s(`restarted as ${B.name}`)}catch(B){s(`restart failed: ${B.message}`)}}return v.jsxs("div",{style:pt.container,children:[v.jsx("div",{style:pt.sectionLabel,children:"LIFECYCLE"}),v.jsxs("div",{style:pt.btnGrid,children:[R&&v.jsxs(v.Fragment,{children:[v.jsx(jh,{icon:"~",label:"Rotate",desc:"Fresh context + handoff brief",onClick:ee,color:"var(--accent)"}),v.jsx(jh,{icon:"||",label:c?"Confirm Kill":"Stop",desc:"Stop the agent process",onClick:I,color:c?"var(--red)":"var(--amber)"})]}),!R&&v.jsx(jh,{icon:">",label:"Restart",desc:"Spawn fresh with same config",onClick:L,color:"var(--green)"}),v.jsx(jh,{icon:"+",label:"Clone",desc:"Spawn duplicate agent",onClick:X,color:"var(--accent)"}),v.jsx(jh,{icon:"x",label:d?"Confirm Delete":"Delete",desc:"Kill and remove permanently",onClick:j,color:d?"var(--red)":"var(--text-dim)"})]}),v.jsxs("div",{style:{...pt.sectionLabel,marginTop:20},children:["MODEL ",t.routingMode==="auto"&&v.jsx("span",{style:{color:"var(--accent)",fontWeight:400,textTransform:"none"},children:" — auto-routed"})]}),v.jsxs("select",{style:pt.select,value:_,onChange:B=>P(B.target.value),children:[v.jsx("option",{value:"",children:"Default"}),H.map(B=>v.jsxs("option",{value:B.id,children:[B.name," (",B.tier,")"]},B.id))]}),v.jsx("div",{style:pt.fieldHint,children:"Changes take effect on next rotation"}),v.jsx("div",{style:{...pt.sectionLabel,marginTop:20},children:"PROMPT"}),t.prompt&&!O&&v.jsxs("div",{style:pt.currentPrompt,children:[v.jsx("div",{style:pt.promptText,children:t.prompt}),R&&v.jsx("button",{onClick:()=>{S(!0),m("")},style:pt.editBtn,children:"Send New Instruction"})]}),!t.prompt&&!O&&v.jsx("div",{style:pt.noPrompt,children:"No prompt set"}),O&&v.jsxs("div",{children:[v.jsx("textarea",{style:pt.textarea,value:g,onChange:B=>m(B.target.value),placeholder:"New instruction for this agent...",rows:4,autoFocus:!0}),v.jsxs("div",{style:{display:"flex",gap:6,marginTop:6},children:[v.jsx("button",{onClick:Z,style:pt.saveBtn,disabled:!g.trim(),children:"Send (rotates agent)"}),v.jsx("button",{onClick:()=>S(!1),style:pt.cancelBtn,children:"Cancel"})]})]}),v.jsxs("div",{style:{...pt.sectionLabel,marginTop:20},children:["SKILLS (",(t.skills||[]).length,")"]}),(t.skills||[]).length>0?v.jsx("div",{style:pt.skillsList,children:(t.skills||[]).map(B=>{const G=k.find(z=>z.id===B);return v.jsxs("div",{style:pt.skillRow,children:[v.jsx("span",{style:pt.skillRowIcon,children:(G==null?void 0:G.icon)||B.charAt(0).toUpperCase()}),v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{style:{fontSize:11,color:"var(--text-primary)",fontWeight:500},children:(G==null?void 0:G.name)||B}),v.jsx("div",{style:{fontSize:9,color:"var(--text-muted)"},children:(G==null?void 0:G.author)||"unknown"})]}),v.jsx("button",{onClick:()=>E(B),style:pt.detachBtn,title:"Detach skill",children:"✕"})]},B)})}):v.jsx("div",{style:pt.noPrompt,children:"No skills attached"}),!M&&k.length>0&&v.jsx("button",{onClick:()=>$(!0),style:{...pt.editBtn,marginTop:6},children:"+ Attach Skill"}),M&&v.jsxs("div",{style:pt.skillPicker,children:[k.filter(B=>!(t.skills||[]).includes(B.id)).map(B=>v.jsxs("button",{onClick:()=>{D(B.id),$(!1)},style:pt.skillPickerItem,children:[v.jsx("span",{style:pt.skillRowIcon,children:B.icon||B.name.charAt(0)}),v.jsxs("div",{style:{flex:1},children:[v.jsx("div",{style:{fontSize:11,color:"var(--text-primary)"},children:B.name}),v.jsx("div",{style:{fontSize:9,color:"var(--text-muted)"},children:B.author})]})]},B.id)),k.filter(B=>!(t.skills||[]).includes(B.id)).length===0&&v.jsx("div",{style:{fontSize:10,color:"var(--text-dim)",padding:8},children:"All installed skills are already attached"}),v.jsx("button",{onClick:()=>$(!1),style:pt.cancelBtn,children:"cancel"})]}),v.jsx("div",{style:{...pt.sectionLabel,marginTop:20},children:"CONFIGURATION"}),v.jsx(Wl,{label:"ID",value:t.id}),v.jsx(Wl,{label:"Role",value:t.role}),v.jsx(Wl,{label:"Provider",value:t.provider}),v.jsx(Wl,{label:"Model",value:t.routingMode==="auto"?`auto (${t.model||"pending"})`:t.model||"default"}),v.jsx(Wl,{label:"Scope",value:(t.scope||[]).join(", ")||"unrestricted"}),v.jsx(Wl,{label:"Status",value:t.status})]})}function jh({icon:t,label:e,desc:i,onClick:n,color:r}){return v.jsxs("button",{onClick:n,style:{...pt.actionBtn,borderColor:r},children:[v.jsx("span",{style:{...pt.actionIcon,color:r},children:t}),v.jsxs("div",{children:[v.jsx("div",{style:pt.actionTitle,children:e}),v.jsx("div",{style:pt.actionDesc,children:i})]})]})}function Wl({label:t,value:e}){return v.jsxs("div",{style:pt.configRow,children:[v.jsx("span",{style:{color:"var(--text-dim)",fontSize:11,minWidth:60},children:t}),v.jsx("span",{style:{color:"var(--text-primary)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}const pt={container:{flex:1,overflowY:"auto",padding:"10px 0"},sectionLabel:{fontSize:11,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5,marginBottom:8,fontWeight:600},btnGrid:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4},actionBtn:{display:"flex",alignItems:"center",gap:8,padding:"8px 10px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,cursor:"pointer",textAlign:"left",fontFamily:"var(--font)"},actionIcon:{fontSize:14,fontWeight:700,width:18,textAlign:"center",flexShrink:0},actionTitle:{fontSize:11,color:"var(--text-primary)",fontWeight:600},actionDesc:{fontSize:9,color:"var(--text-dim)",marginTop:1},select:{width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},fieldHint:{fontSize:10,color:"var(--text-muted)",marginTop:4},currentPrompt:{},promptText:{background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,padding:8,fontSize:12,color:"var(--text-primary)",lineHeight:1.5,whiteSpace:"pre-wrap",maxHeight:100,overflowY:"auto"},noPrompt:{fontSize:12,color:"var(--text-dim)",fontStyle:"italic"},editBtn:{marginTop:6,padding:"4px 10px",background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:11,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},textarea:{width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none",resize:"vertical"},saveBtn:{flex:1,padding:"6px",background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:11,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},cancelBtn:{padding:"6px 12px",background:"transparent",border:"1px solid var(--border)",borderRadius:2,color:"var(--text-dim)",fontSize:11,fontFamily:"var(--font)",cursor:"pointer"},configRow:{display:"flex",gap:8,padding:"3px 0",borderBottom:"1px solid var(--bg-surface)"},skillsList:{display:"flex",flexDirection:"column",gap:3},skillRow:{display:"flex",alignItems:"center",gap:8,padding:"5px 8px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2},skillRowIcon:{width:20,height:20,borderRadius:4,background:"var(--accent)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:9,fontWeight:700,color:"var(--bg-base)",flexShrink:0},detachBtn:{background:"none",border:"none",color:"var(--text-muted)",fontSize:11,cursor:"pointer",fontFamily:"var(--font)",padding:"2px 4px",flexShrink:0},skillPicker:{marginTop:6,padding:6,background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,display:"flex",flexDirection:"column",gap:2,maxHeight:180,overflowY:"auto"},skillPickerItem:{display:"flex",alignItems:"center",gap:8,padding:"5px 8px",width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,cursor:"pointer",textAlign:"left",fontFamily:"var(--font)",transition:"border-color 0.1s"}},y8=[{id:"chat",label:"Chat"},{id:"stats",label:"Stats"},{id:"actions",label:"Actions"}],S8={running:"var(--green)",starting:"var(--amber)",stopped:"var(--text-dim)",crashed:"var(--red)",completed:"var(--accent)",killed:"var(--text-dim)"};function b8(){const[t,e]=N.useState("chat"),i=Ce(c=>c.detailPanel),r=Ce(c=>c.agents).find(c=>c.id===(i==null?void 0:i.agentId));if(!r)return v.jsx("div",{style:bo.empty,children:"Agent not found"});const s=S8[r.status]||"var(--text-dim)",a=r.status==="running"||r.status==="starting";return v.jsxs("div",{style:bo.container,children:[v.jsxs("div",{style:bo.agentHeader,children:[v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[v.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:s,animation:a?"pulse 2s infinite":"none"}}),v.jsx("span",{style:bo.agentName,children:r.name}),v.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,color:s,padding:"1px 6px",borderRadius:2,background:`color-mix(in srgb, ${s} 12%, transparent)`},children:r.status})]}),v.jsxs("span",{style:bo.agentMeta,children:[r.role," / ",r.provider]})]}),v.jsx("div",{style:bo.tabBar,children:y8.map(c=>v.jsx("button",{onClick:()=>e(c.id),style:{...bo.tab,color:t===c.id?"var(--text-bright)":"var(--text-dim)",borderBottom:t===c.id?"2px solid var(--accent)":"2px solid transparent"},children:c.label},c.id))}),v.jsxs("div",{style:bo.tabContent,children:[t==="chat"&&v.jsx(c8,{agent:r}),t==="stats"&&v.jsx(p8,{agent:r}),t==="actions"&&v.jsx(v8,{agent:r})]})]})}const bo={container:{display:"flex",flexDirection:"column",height:"100%"},agentHeader:{padding:"12px 0 8px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid var(--border)"},agentName:{fontSize:14,fontWeight:600,color:"var(--text-bright)"},agentMeta:{fontSize:11,color:"var(--text-dim)"},tabBar:{display:"flex",gap:0,borderBottom:"1px solid var(--border)"},tab:{padding:"8px 16px",background:"transparent",border:"none",borderBottom:"2px solid transparent",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,fontFamily:"var(--font)",cursor:"pointer"},tabContent:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column"},empty:{color:"var(--text-dim)",fontSize:12,padding:16}};function _8(){const t=Ce(i=>i.openDetail),e=Ce(i=>i.connected);return v.jsx("div",{style:dr.container,children:v.jsx("div",{style:dr.inner,children:e?v.jsxs(v.Fragment,{children:[v.jsx("div",{style:dr.readyIcon,children:v.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:[v.jsx("circle",{cx:"20",cy:"20",r:"18",fill:"none",stroke:"#2c313a",strokeWidth:"1"}),v.jsx("circle",{cx:"20",cy:"20",r:"18",fill:"none",stroke:"#33afbc",strokeWidth:"1",strokeDasharray:"113",strokeDashoffset:"28",strokeLinecap:"round",children:v.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 20 20",to:"360 20 20",dur:"3s",repeatCount:"indefinite"})}),v.jsx("text",{x:"20",y:"24",textAnchor:"middle",fill:"#33afbc",fontSize:"14",fontWeight:"700",fontFamily:"JetBrains Mono, monospace",children:"+"})]})}),v.jsx("div",{style:dr.title,children:"Ready to orchestrate"}),v.jsx("div",{style:dr.hint,children:"Spawn your first agent to start building"}),v.jsx("button",{onClick:()=>t({type:"spawn"}),style:dr.spawnBtn,children:"Spawn Agent"})]}):v.jsxs(v.Fragment,{children:[v.jsx("div",{style:dr.pulseRing,children:v.jsx("div",{style:dr.pulseCore})}),v.jsx("div",{style:dr.title,children:"Connecting to daemon..."}),v.jsx("div",{style:dr.hint,children:"Make sure the GROOVE daemon is running"}),v.jsx("code",{style:dr.code,children:"groove start"})]})})})}const dr={container:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",background:"#1a1e25"},inner:{display:"flex",flexDirection:"column",alignItems:"center",gap:12,padding:40},pulseRing:{width:40,height:40,borderRadius:"50%",border:"1px solid #33afbc",display:"flex",alignItems:"center",justifyContent:"center",animation:"pulse 2s infinite"},pulseCore:{width:8,height:8,borderRadius:"50%",background:"#33afbc",boxShadow:"0 0 12px rgba(51, 175, 188, 0.5)"},readyIcon:{marginBottom:4},title:{fontSize:14,color:"#e6e6e6",fontWeight:600,letterSpacing:.5},hint:{fontSize:12,color:"#6b7280",textAlign:"center",lineHeight:1.6,maxWidth:360},spawnBtn:{padding:"8px 24px",background:"rgba(51, 175, 188, 0.1)",border:"1px solid #33afbc",color:"#33afbc",fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:"pointer",marginTop:4,transition:"background 0.2s"},code:{background:"#252a33",padding:"8px 16px",fontSize:11,color:"#33afbc",border:"1px solid #2c313a"}};function x8({onSelect:t,onClose:e,initial:i}){const[n,r]=N.useState(i||""),[s,a]=N.useState([]),[c,h]=N.useState(null),[d,f]=N.useState(0),[g,m]=N.useState(!0),[O,S]=N.useState(""),[_,w]=N.useState(null),x=N.useRef(null);N.useEffect(()=>{Q(n)},[n]),N.useEffect(()=>{x.current&&(x.current.scrollTop=0)},[s]);async function Q(T){m(!0),S("");try{const M=await fetch(`/api/browse?path=${encodeURIComponent(T)}`);if(!M.ok){const R=await M.json().catch(()=>({}));S(R.error||"Failed to browse"),a([]);return}const $=await M.json();a($.dirs),h($.parent),f($.fileCount||0)}catch{S("Failed to connect")}finally{m(!1)}}const k=n?[{label:"root",path:""},...n.split("/").map((T,M,$)=>({label:T,path:$.slice(0,M+1).join("/")}))]:[{label:"root",path:""}];return v.jsx("div",{style:nt.overlay,onClick:e,children:v.jsxs("div",{style:nt.modal,onClick:T=>T.stopPropagation(),children:[v.jsxs("div",{style:nt.header,children:[v.jsxs("div",{children:[v.jsx("div",{style:nt.title,children:"SELECT DIRECTORY"}),v.jsx("div",{style:nt.subtitle,children:"Choose where this agent will work"})]}),v.jsx("button",{onClick:e,style:nt.closeBtn,children:"x"})]}),v.jsxs("div",{style:nt.breadcrumb,children:[k.map((T,M)=>v.jsxs("span",{children:[M>0&&v.jsx("span",{style:nt.breadSep,children:"/"}),v.jsx("button",{onClick:()=>r(T.path),style:{...nt.breadPart,color:M===k.length-1?"var(--text-bright)":"var(--accent)"},children:T.label})]},M)),!g&&v.jsxs("span",{style:nt.breadMeta,children:[s.length," folder",s.length!==1?"s":"",", ",d," file",d!==1?"s":""]})]}),v.jsxs("div",{style:nt.list,ref:x,children:[c!==null&&v.jsxs("div",{onClick:()=>r(c),onMouseEnter:()=>w("__parent"),onMouseLeave:()=>w(null),style:{...nt.dirRow,background:_==="__parent"?"var(--bg-hover)":"transparent"},children:[v.jsx("div",{style:nt.dirIconWrap,children:v.jsx("span",{style:nt.dirArrow,children:"<"})}),v.jsx("div",{style:nt.dirInfo,children:v.jsx("div",{style:nt.dirNameText,children:".."})})]}),g&&v.jsx("div",{style:nt.emptyState,children:v.jsx("div",{style:nt.emptyText,children:"Loading..."})}),O&&v.jsx("div",{style:nt.emptyState,children:v.jsx("div",{style:{...nt.emptyText,color:"var(--red)"},children:O})}),!g&&!O&&s.length===0&&v.jsxs("div",{style:nt.emptyState,children:[v.jsx("div",{style:nt.emptyText,children:"No subdirectories"}),v.jsxs("div",{style:nt.emptyHint,children:["This directory has ",d," file",d!==1?"s":""]})]}),s.map(T=>v.jsxs("div",{onClick:()=>r(T.path),onMouseEnter:()=>w(T.path),onMouseLeave:()=>w(null),style:{...nt.dirRow,background:_===T.path?"var(--bg-hover)":"transparent"},children:[v.jsx("div",{style:nt.dirIconWrap,children:v.jsx("span",{style:nt.dirArrow,children:T.hasChildren?">":""})}),v.jsxs("div",{style:nt.dirInfo,children:[v.jsx("div",{style:nt.dirNameText,children:T.name}),v.jsxs("div",{style:nt.dirMeta,children:[T.childCount>0&&`${T.childCount} folder${T.childCount!==1?"s":""}`,T.childCount>0&&T.fileCount>0&&", ",T.fileCount>0&&`${T.fileCount} file${T.fileCount!==1?"s":""}`,T.childCount===0&&T.fileCount===0&&"empty"]})]})]},T.path))]}),v.jsxs("div",{style:nt.footer,children:[v.jsxs("div",{style:nt.footerLeft,children:[v.jsx("div",{style:nt.selectedLabel,children:"Selected"}),v.jsxs("div",{style:nt.selectedPath,children:["/",n||"(project root)"]})]}),v.jsxs("div",{style:nt.footerActions,children:[v.jsx("button",{onClick:e,style:nt.cancelBtn,children:"Cancel"}),v.jsx("button",{onClick:()=>{t(n),e()},style:nt.selectBtn,children:"Select"})]})]})]})})}const nt={overlay:{position:"fixed",inset:0,zIndex:200,background:"rgba(0, 0, 0, 0.65)",display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)"},modal:{width:480,maxHeight:"80vh",background:"var(--bg-chrome)",border:"1px solid var(--border)",borderRadius:6,display:"flex",flexDirection:"column",fontFamily:"var(--font)",boxShadow:"0 16px 48px rgba(0, 0, 0, 0.4)"},header:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",padding:"14px 16px 12px",borderBottom:"1px solid var(--border)"},title:{fontSize:12,fontWeight:700,color:"var(--text-bright)",letterSpacing:.5},subtitle:{fontSize:10,color:"var(--text-dim)",marginTop:2},closeBtn:{background:"none",border:"none",color:"var(--text-dim)",fontSize:14,cursor:"pointer",fontFamily:"var(--font)",padding:"0 4px",lineHeight:1},breadcrumb:{padding:"8px 16px",borderBottom:"1px solid var(--border)",fontSize:11,display:"flex",alignItems:"center",flexWrap:"wrap",gap:0,background:"var(--bg-base)"},breadSep:{color:"var(--text-muted)",margin:"0 3px"},breadPart:{background:"none",border:"none",cursor:"pointer",fontFamily:"var(--font)",fontSize:11,padding:0},breadMeta:{marginLeft:"auto",fontSize:10,color:"var(--text-muted)"},list:{flex:1,overflowY:"auto",minHeight:200,maxHeight:400},dirRow:{display:"flex",alignItems:"center",gap:0,padding:"8px 16px",cursor:"pointer",transition:"background 0.08s",borderBottom:"1px solid rgba(75, 82, 99, 0.2)"},dirIconWrap:{width:28,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},dirArrow:{fontSize:10,color:"var(--text-muted)",fontWeight:600},dirInfo:{flex:1,minWidth:0},dirNameText:{fontSize:12,color:"var(--text-bright)",fontWeight:500},dirMeta:{fontSize:10,color:"var(--text-muted)",marginTop:1},emptyState:{padding:"32px 16px",textAlign:"center"},emptyText:{fontSize:12,color:"var(--text-dim)"},emptyHint:{fontSize:10,color:"var(--text-muted)",marginTop:4},footer:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderTop:"1px solid var(--border)",background:"var(--bg-base)"},footerLeft:{flex:1,minWidth:0,marginRight:12},selectedLabel:{fontSize:9,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:1,fontWeight:600},selectedPath:{fontSize:11,color:"var(--accent)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},footerActions:{display:"flex",gap:6,flexShrink:0},cancelBtn:{padding:"6px 14px",background:"transparent",border:"1px solid var(--border)",borderRadius:3,color:"var(--text-dim)",fontSize:11,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer"},selectBtn:{padding:"6px 18px",background:"var(--accent)",border:"1px solid var(--accent)",borderRadius:3,color:"var(--bg-base)",fontSize:11,fontWeight:700,fontFamily:"var(--font)",cursor:"pointer"}},gv=[{id:"backend",label:"Backend",desc:"APIs, server logic, database",scope:["src/api/**","src/server/**","src/lib/**","src/db/**"],category:"coding"},{id:"frontend",label:"Frontend",desc:"UI components, views, styles",scope:["src/components/**","src/views/**","src/pages/**","src/styles/**"],category:"coding"},{id:"fullstack",label:"Fullstack",desc:"Full codebase access",scope:[],category:"coding"},{id:"planner",label:"Planner",desc:"Architecture, research, planning",scope:[],category:"coding"},{id:"testing",label:"Testing",desc:"Tests, specs, coverage",scope:["tests/**","test/**","**/*.test.*","**/*.spec.*"],category:"coding"},{id:"devops",label:"DevOps",desc:"Docker, CI/CD, infra",scope:["Dockerfile*","docker-compose*",".github/**","infra/**"],category:"coding"},{id:"docs",label:"Docs",desc:"Documentation, READMEs",scope:["docs/**","*.md"],category:"coding"},{id:"cmo",label:"CMO",desc:"Marketing, social media, content",scope:[],category:"business",integrations:["slack","brave-search"]},{id:"cfo",label:"CFO",desc:"Finance, billing, revenue",scope:[],category:"business",integrations:["stripe","google-drive"]},{id:"ea",label:"EA",desc:"Scheduling, email, comms",scope:[],category:"business",integrations:["gmail","google-calendar","slack"]},{id:"support",label:"Support",desc:"Customer support, triage",scope:[],category:"business",integrations:["slack","discord"]},{id:"analyst",label:"Analyst",desc:"Data analysis, reporting",scope:[],category:"business",integrations:["postgres","google-drive"]},{id:"home",label:"Home",desc:"Smart home automation",scope:[],category:"business",integrations:["home-assistant"]}],w8=[{id:"auto",label:"Auto",desc:"AI PM reviews risky operations before they happen",icon:"~"},{id:"full",label:"Full Send",desc:"No reviews, maximum speed",icon:">"}];function k8(){const t=Ce(oe=>oe.spawnAgent),e=Ce(oe=>oe.closeDetail),[i,n]=N.useState(""),[r,s]=N.useState(""),[a,c]=N.useState(""),[h,d]=N.useState(""),[f,g]=N.useState("auto"),[m,O]=N.useState("claude-code"),[S,_]=N.useState("auto"),[w,x]=N.useState([]),[Q,k]=N.useState(!1),[T,M]=N.useState(""),[$,R]=N.useState(!1),[V,H]=N.useState(""),[ee,I]=N.useState([]),[j,D]=N.useState(null),[E,X]=N.useState(""),[P,Z]=N.useState(!1),[L,B]=N.useState(!1),[G,z]=N.useState([]),[q,K]=N.useState([]),[ie,ce]=N.useState([]),[de,pe]=N.useState([]);N.useEffect(()=>{fe(),ve(),De(),Ee()},[]);async function fe(){try{const oe=await fetch("/api/providers");x(await oe.json())}catch{}}async function ve(){try{const We=await(await fetch("/api/indexer/workspaces")).json();I(We.workspaces||[])}catch{}}async function De(){try{const oe=await fetch("/api/skills/installed");z(await oe.json())}catch{}}async function Ee(){try{const oe=await fetch("/api/integrations/installed");ce(await oe.json())}catch{}}function ke(oe){K(We=>We.includes(oe)?We.filter(Le=>Le!==oe):[...We,oe])}function me(oe){pe(We=>We.includes(oe)?We.filter(Le=>Le!==oe):[...We,oe])}N.useEffect(()=>{const oe=gv.find(We=>We.id===i);if(oe!=null&&oe.integrations&&ie.length>0){const We=oe.integrations.filter(Le=>ie.some(sn=>sn.id===Le&&sn.configured));pe(We)}},[i,ie]);const Be=gv.find(oe=>oe.id===i),lt=i==="custom"?a:(Be==null?void 0:Be.scope.join(", "))||"",Ue=i==="planner";function Ft(oe){if(oe.installed&&(oe.authType==="subscription"||oe.authType==="local"||oe.hasKey)){O(oe.id),_("auto"),D(null);return}D(oe.id),X("")}async function rn(){if(!(!E.trim()||!j)){Z(!0);try{await fetch(`/api/credentials/${j}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:E.trim()})}),X(""),D(null),O(j),_("auto"),await fe()}catch{}Z(!1)}}async function qi(oe){oe.preventDefault();const We=i==="custom"?r:i;if(!We){M("Select a role");return}k(!0),M("");try{const Le=lt?lt.split(",").map(on=>on.trim()).filter(Boolean):[];await t({role:We,scope:Le,prompt:h||null,model:S||"auto",provider:m,permission:f,...V.trim()?{workingDir:V.trim()}:{},...q.length>0?{skills:q}:{},...de.length>0?{integrations:de}:{}}),e()}catch(Le){M(Le.message)}finally{k(!1)}}function _n(oe){return oe.installed?oe.authType==="api-key"&&!oe.hasKey?"needs key":oe.authType==="subscription"?"subscription":oe.authType==="local"?"local":"ready":"not installed"}function ar(oe){return!(!oe.installed||oe.authType==="api-key"&&!oe.hasKey)}return v.jsxs("div",{style:{paddingTop:4},children:[v.jsx("div",{style:$e.title,children:"SPAWN AGENT"}),v.jsxs("form",{onSubmit:qi,children:[v.jsx("div",{style:$e.label,children:"ROLE"}),v.jsxs("div",{style:$e.roleGrid,children:[gv.map(oe=>v.jsx("button",{type:"button",onClick:()=>n(oe.id),style:{...$e.roleBtn,...i===oe.id?$e.roleBtnActive:{}},title:oe.desc,children:oe.label},oe.id)),v.jsx("button",{type:"button",onClick:()=>n("custom"),style:{...$e.roleBtn,...i==="custom"?$e.roleBtnActive:{}},children:"Custom"})]}),Be&&v.jsx("div",{style:$e.roleDesc,children:Be.desc}),i==="custom"&&v.jsx("input",{style:{...$e.input,marginTop:6},placeholder:"Custom role name...",value:r,onChange:oe=>s(oe.target.value),autoFocus:!0}),v.jsx("div",{style:$e.label,children:Ue?"WHAT TO PLAN":"TASK PROMPT"}),v.jsx("textarea",{style:$e.textarea,placeholder:Ue?"What should this agent research or plan?":"What should this agent work on?",value:h,onChange:oe=>d(oe.target.value),rows:3}),v.jsx("div",{style:$e.label,children:"DIRECTORY"}),v.jsxs("div",{style:$e.wsRow,children:[v.jsx("button",{type:"button",onClick:()=>H(""),style:{...$e.wsBtn,...V?{}:{borderColor:"var(--accent)",color:"var(--text-bright)"}},children:"project root"}),ee.map(oe=>v.jsx("button",{type:"button",onClick:()=>H(oe.path),style:{...$e.wsBtn,...V===oe.path?{borderColor:"var(--accent)",color:"var(--text-bright)"}:{}},title:`${oe.name} (${oe.files} files)`,children:oe.path},oe.path)),v.jsx("button",{type:"button",onClick:()=>B(!0),style:$e.browseBtn,children:"Browse..."})]}),V&&v.jsx("div",{style:$e.hint,children:V}),L&&v.jsx(x8,{initial:V,onSelect:oe=>H(oe),onClose:()=>B(!1)}),v.jsx("div",{style:$e.label,children:"PERMISSIONS"}),v.jsx("div",{style:$e.permGrid,children:w8.map(oe=>v.jsxs("button",{type:"button",onClick:()=>g(oe.id),style:{...$e.permBtn,...f===oe.id?$e.permBtnActive:{}},children:[v.jsx("span",{style:$e.permIcon,children:oe.icon}),v.jsxs("div",{children:[v.jsx("div",{style:$e.permLabel,children:oe.label}),v.jsx("div",{style:$e.permDesc,children:oe.desc})]})]},oe.id))}),ie.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:$e.label,children:"INTEGRATIONS"}),v.jsx("div",{style:$e.skillsGrid,children:ie.map(oe=>{const We=de.includes(oe.id),Le=oe.configured;return v.jsxs("button",{type:"button",onClick:()=>Le&&me(oe.id),title:Le?oe.description:"Configure credentials first",style:{...$e.skillBtn,borderColor:We?"var(--accent)":Le?"var(--border)":"var(--amber)",background:We?"rgba(51, 175, 188, 0.08)":"var(--bg-surface)",opacity:Le?1:.5,cursor:Le?"pointer":"not-allowed"},children:[v.jsx("span",{style:{...$e.skillIcon,background:We?"var(--accent)":Le?"var(--bg-active)":"var(--amber)",color:We?"var(--bg-base)":"var(--text-dim)"},children:(oe.name||"?").charAt(0)}),v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{style:{fontSize:11,fontWeight:600,color:We?"var(--text-bright)":"var(--text-primary)"},children:oe.name}),v.jsx("div",{style:{fontSize:9,color:Le?"var(--green)":"var(--amber)"},children:Le?"connected":"needs setup"})]}),We&&v.jsx("span",{style:{fontSize:10,color:"var(--accent)",flexShrink:0},children:"✓"})]},oe.id)})}),de.length>0&&v.jsxs("div",{style:$e.hint,children:[de.length," integration",de.length!==1?"s":""," will provide MCP tools to this agent"]})]}),G.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:$e.label,children:"SKILLS"}),v.jsx("div",{style:$e.skillsGrid,children:G.map(oe=>{const We=q.includes(oe.id);return v.jsxs("button",{type:"button",onClick:()=>ke(oe.id),style:{...$e.skillBtn,borderColor:We?"var(--accent)":"var(--border)",background:We?"rgba(51, 175, 188, 0.08)":"var(--bg-surface)"},children:[v.jsx("span",{style:{...$e.skillIcon,background:We?"var(--accent)":"var(--bg-active)",color:We?"var(--bg-base)":"var(--text-dim)"},children:oe.icon||oe.name.charAt(0)}),v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{style:{fontSize:11,fontWeight:600,color:We?"var(--text-bright)":"var(--text-primary)"},children:oe.name}),v.jsx("div",{style:{fontSize:9,color:"var(--text-muted)"},children:oe.author||"local"})]}),We&&v.jsx("span",{style:{fontSize:10,color:"var(--accent)",flexShrink:0},children:"✓"})]},oe.id)})}),q.length>0&&v.jsxs("div",{style:$e.hint,children:[q.length," skill",q.length!==1?"s":""," will be injected into this agent's context"]})]}),v.jsx("button",{type:"button",onClick:()=>R(!$),style:$e.advancedToggle,children:$?"- hide advanced":"+ advanced options"}),$&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:$e.label,children:"PROVIDER"}),w.map(oe=>{const We=ar(oe),Le=_n(oe),sn=m===oe.id,on=j===oe.id;return v.jsxs("div",{style:{marginBottom:2},children:[v.jsxs("button",{type:"button",onClick:()=>Ft(oe),style:{...$e.providerBtn,borderColor:sn?"var(--accent)":"var(--border)",opacity:We||on?1:.6},children:[v.jsxs("div",{style:{flex:1},children:[v.jsx("span",{style:{fontSize:12,fontWeight:600,color:sn?"var(--text-bright)":"var(--text-primary)"},children:oe.name}),v.jsx("span",{style:$e.providerModels,children:oe.models.map(Vi=>Vi.name).join(", ")})]}),v.jsx("span",{style:{fontSize:10,color:We?"var(--green)":Le==="not installed"?"var(--text-muted)":"var(--amber)"},children:We?sn?"active":"ready":Le})]}),on&&v.jsxs("div",{style:$e.connectBox,children:[!oe.installed&&v.jsxs("div",{children:[v.jsx("div",{style:$e.connectLabel,children:"Install first:"}),v.jsx("code",{style:$e.connectCode,children:oe.installCommand}),v.jsx("div",{style:$e.connectHint,children:"Run this in your terminal, then click the provider again"})]}),oe.installed&&oe.authType==="api-key"&&!oe.hasKey&&v.jsxs("div",{children:[v.jsxs("div",{style:$e.connectLabel,children:["API Key ",oe.envKey?`(${oe.envKey})`:""]}),v.jsxs("div",{style:{display:"flex",gap:4},children:[v.jsx("input",{type:"password",style:$e.input,placeholder:"sk-...",value:E,onChange:Vi=>X(Vi.target.value),onKeyDown:Vi=>Vi.key==="Enter"&&(Vi.preventDefault(),rn())}),v.jsx("button",{type:"button",onClick:rn,disabled:P||!E.trim(),style:$e.connectSaveBtn,children:P?"...":"Save"})]}),v.jsx("div",{style:$e.connectHint,children:"Encrypted locally. Never sent to GROOVE servers."})]}),oe.installed&&oe.authType==="subscription"&&v.jsxs("div",{children:[v.jsx("div",{style:$e.connectLabel,children:"Subscription auth"}),v.jsxs("div",{style:$e.connectHint,children:[oe.name," uses your existing subscription. Make sure you're logged in via the CLI."]})]}),oe.installed&&oe.authType==="local"&&v.jsxs("div",{children:[v.jsx("div",{style:$e.connectLabel,children:"Local model"}),v.jsxs("div",{style:$e.connectHint,children:["Make sure ",oe.name," is running locally. No API key needed."]})]}),v.jsx("button",{type:"button",onClick:()=>D(null),style:$e.connectCancel,children:"cancel"})]})]},oe.id)}),(()=>{const oe=w.find(Le=>Le.id===m),We=(oe==null?void 0:oe.models)||[];return We.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx("div",{style:$e.label,children:"MODEL"}),v.jsxs("select",{style:$e.input,value:S,onChange:Le=>_(Le.target.value),children:[v.jsx("option",{value:"auto",children:"Auto (recommended)"}),We.map(Le=>v.jsxs("option",{value:Le.id,children:[Le.name," (",Le.tier,")"]},Le.id))]})]})})(),v.jsx("div",{style:$e.label,children:"FILE SCOPE"}),v.jsx("input",{style:$e.input,placeholder:"e.g. src/api/**, src/lib/**",value:i==="custom"?a:lt,onChange:oe=>{i==="custom"&&c(oe.target.value)},readOnly:i!=="custom"}),v.jsx("div",{style:$e.hint,children:i==="custom"?"Comma-separated glob patterns":"Auto-set by role preset"})]}),T&&v.jsx("div",{style:$e.error,children:T}),v.jsx("button",{type:"submit",disabled:Q,style:{...$e.submitBtn,opacity:Q?.5:1},children:Q?"spawning...":Ue?"Start Planning":"Spawn Agent"})]})]})}const $e={title:{fontSize:11,fontWeight:600,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5,marginBottom:14},label:{fontSize:11,color:"var(--text-dim)",marginBottom:4,marginTop:12,textTransform:"uppercase",letterSpacing:1.5,fontWeight:600},roleGrid:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4},roleBtn:{background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 4px",color:"var(--text-primary)",fontSize:11,cursor:"pointer",fontFamily:"var(--font)",transition:"color 0.1s, border-color 0.1s"},roleBtnActive:{borderColor:"var(--accent)",color:"var(--text-bright)"},roleDesc:{fontSize:10,color:"var(--text-dim)",marginTop:4,fontStyle:"italic"},permGrid:{display:"flex",flexDirection:"column",gap:4},permBtn:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,cursor:"pointer",textAlign:"left",fontFamily:"var(--font)"},permBtnActive:{borderColor:"var(--accent)"},permIcon:{fontSize:14,fontWeight:700,color:"var(--accent)",width:18,textAlign:"center",flexShrink:0},permLabel:{fontSize:11,color:"var(--text-bright)",fontWeight:600},permDesc:{fontSize:10,color:"var(--text-dim)"},skillsGrid:{display:"flex",flexDirection:"column",gap:3},skillBtn:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",width:"100%",border:"1px solid var(--border)",borderRadius:2,cursor:"pointer",textAlign:"left",fontFamily:"var(--font)",transition:"border-color 0.1s, background 0.1s"},skillIcon:{width:22,height:22,borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,flexShrink:0},advancedToggle:{background:"none",border:"none",color:"var(--text-dim)",fontSize:10,cursor:"pointer",fontFamily:"var(--font)",padding:"8px 0",marginTop:8},providerBtn:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"8px 10px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,cursor:"pointer",textAlign:"left",fontFamily:"var(--font)"},providerModels:{fontSize:10,color:"var(--text-dim)",marginLeft:6},connectBox:{padding:"8px 10px",margin:"2px 0 4px",background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2},connectLabel:{fontSize:11,color:"var(--text-primary)",fontWeight:600,marginBottom:4},connectCode:{display:"block",padding:"6px 8px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,fontSize:11,color:"var(--accent)",wordBreak:"break-all"},connectHint:{fontSize:10,color:"var(--text-dim)",marginTop:4},connectSaveBtn:{padding:"6px 12px",flexShrink:0,background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:11,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},connectCancel:{background:"none",border:"none",color:"var(--text-dim)",fontSize:10,cursor:"pointer",fontFamily:"var(--font)",padding:"4px 0",marginTop:4},input:{width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",color:"var(--text-primary)",fontSize:12,outline:"none",fontFamily:"var(--font)"},textarea:{width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",color:"var(--text-primary)",fontSize:12,outline:"none",fontFamily:"var(--font)",resize:"vertical"},hint:{fontSize:10,color:"var(--text-dim)",marginTop:3},wsRow:{display:"flex",flexWrap:"wrap",gap:4,marginTop:6},wsBtn:{background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"3px 8px",color:"var(--text-dim)",fontSize:10,cursor:"pointer",fontFamily:"var(--font)",transition:"color 0.1s, border-color 0.1s"},browseBtn:{background:"var(--bg-surface)",border:"1px solid var(--accent)",borderRadius:2,padding:"3px 10px",color:"var(--accent)",fontSize:10,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},error:{color:"var(--red)",fontSize:11,marginTop:8},submitBtn:{width:"100%",marginTop:14,padding:"8px",background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:12,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"}};function C8(){var a;const[t,e]=N.useState(null),[i,n]=N.useState(!0);N.useEffect(()=>{r();const c=setInterval(r,1e4);return()=>clearInterval(c)},[]);async function r(){try{const c=await fetch("/api/journalist");e(await c.json())}catch{}n(!1)}async function s(){n(!0);try{await fetch("/api/journalist/cycle",{method:"POST"}),await r()}catch{}n(!1)}return v.jsxs("div",{style:{paddingTop:4},children:[v.jsxs("div",{style:Li.header,children:[v.jsx("span",{style:Li.title,children:"THE JOURNALIST"}),v.jsx("button",{onClick:s,disabled:i,style:Li.btn,children:i?"synthesizing...":"Run Cycle"})]}),v.jsxs("div",{style:Li.statusRow,children:[v.jsxs("span",{children:["Status: ",t!=null&&t.running?"active":"stopped"]}),v.jsxs("span",{children:["Cycles: ",(t==null?void 0:t.cycleCount)||0]}),(t==null?void 0:t.lastCycleAt)&&v.jsxs("span",{children:["Last: ",new Date(t.lastCycleAt).toLocaleTimeString()]})]}),t!=null&&t.lastSynthesis?v.jsxs("div",{children:[v.jsx("div",{style:Li.sectionLabel,children:"SUMMARY"}),v.jsx("div",{style:Li.textBox,children:t.lastSynthesis.summary}),t.lastSynthesis.projectMap&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:Li.sectionLabel,children:"PROJECT MAP"}),v.jsx("pre",{style:Li.codeBox,children:t.lastSynthesis.projectMap})]}),t.lastSynthesis.decisions&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:Li.sectionLabel,children:"DECISIONS"}),v.jsx("pre",{style:Li.codeBox,children:t.lastSynthesis.decisions})]})]}):v.jsx("div",{style:Li.empty,children:"No synthesis yet. The Journalist runs every 2 minutes when agents are active."}),((a=t==null?void 0:t.history)==null?void 0:a.length)>0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:Li.sectionLabel,children:"HISTORY"}),v.jsx("div",{style:Li.historyList,children:t.history.slice().reverse().map((c,h)=>{var d;return v.jsxs("div",{style:Li.historyEntry,children:[v.jsx("span",{style:Li.historyTime,children:new Date(c.timestamp).toLocaleTimeString()}),v.jsxs("span",{style:Li.historyText,children:["Cycle ",c.cycle,": ",c.agentCount," agent",c.agentCount!==1?"s":""," — ",(d=c.summary)==null?void 0:d.slice(0,80)]})]},h)})})]})]})}const Li={header:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},title:{fontSize:11,fontWeight:600,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5},btn:{padding:"3px 10px",background:"transparent",border:"1px solid var(--purple)",borderRadius:2,color:"var(--purple)",fontSize:11,cursor:"pointer",fontFamily:"var(--font)"},statusRow:{display:"flex",gap:12,fontSize:11,color:"var(--text-dim)",marginBottom:12,padding:"6px 0",borderBottom:"1px solid var(--border)",flexWrap:"wrap"},sectionLabel:{fontSize:11,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5,marginBottom:4,marginTop:12,fontWeight:600},textBox:{background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,padding:8,fontSize:12,color:"var(--text-primary)",lineHeight:1.5},codeBox:{background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,padding:8,fontSize:11,color:"var(--text-dim)",lineHeight:1.5,whiteSpace:"pre-wrap",maxHeight:200,overflowY:"auto",margin:0},empty:{color:"var(--text-dim)",fontSize:12,padding:16,textAlign:"center"},historyList:{maxHeight:160,overflowY:"auto",background:"var(--bg-base)",borderRadius:2,border:"1px solid var(--border)"},historyEntry:{padding:"4px 8px",borderBottom:"1px solid var(--bg-surface)",fontSize:10,display:"flex",gap:6},historyTime:{color:"var(--text-dim)",whiteSpace:"nowrap"},historyText:{color:"var(--text-primary)"}};function T8(){const[t,e]=N.useState([]),[i,n]=N.useState(null),[r,s]=N.useState(!1),[a,c]=N.useState(""),h=Ce(O=>O.showStatus);N.useEffect(()=>{d();const O=setInterval(d,5e3);return()=>clearInterval(O)},[]);async function d(){try{const S=await(await fetch("/api/teams")).json();e(S.teams),n(S.activeTeam)}catch{}}async function f(O){try{await fetch(`/api/teams/${encodeURIComponent(O)}/load`,{method:"POST"}),h(`loaded team "${O}"`),d()}catch{h("failed to load team")}}async function g(){if(a.trim())try{await fetch("/api/teams",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a.trim()})}),h(`saved team "${a}"`),c(""),s(!1),d()}catch{h("failed to save team")}}async function m(O){await fetch(`/api/teams/${encodeURIComponent(O)}`,{method:"DELETE"}),h(`deleted "${O}"`),d()}return v.jsxs("div",{style:gn.container,children:[v.jsx("div",{style:gn.title,children:"SAVED TEAMS"}),t.length===0?v.jsx("div",{style:gn.empty,children:"No saved teams"}):t.map(O=>v.jsxs("div",{style:{...gn.item,background:O.name===i?"var(--bg-hover)":"transparent"},children:[v.jsxs("div",{style:{flex:1},children:[v.jsxs("div",{style:gn.teamName,children:[">"," ",O.name]}),v.jsxs("div",{style:gn.teamMeta,children:[O.agents," agents"]})]}),v.jsxs("div",{style:{display:"flex",gap:8},children:[v.jsx("button",{onClick:()=>f(O.name),style:gn.loadBtn,children:"Load"}),v.jsx("button",{onClick:()=>m(O.name),style:gn.deleteBtn,children:"x"})]})]},O.name)),v.jsx("div",{style:gn.divider}),r?v.jsxs("div",{style:gn.saveRow,children:[v.jsx("input",{style:gn.saveInput,placeholder:"Team name...",value:a,onChange:O=>c(O.target.value),onKeyDown:O=>O.key==="Enter"&&g(),autoFocus:!0}),v.jsx("button",{onClick:g,style:gn.saveBtn,children:"Save"}),v.jsx("button",{onClick:()=>s(!1),style:gn.cancelBtn,children:"x"})]}):v.jsx("button",{onClick:()=>s(!0),style:gn.saveTeamBtn,children:"Save Current as Team"})]})}const gn={container:{padding:24,maxWidth:600,margin:"0 auto"},title:{fontSize:11,fontWeight:600,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5,marginBottom:16},item:{padding:"10px 12px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid var(--border)"},teamName:{fontSize:12,color:"var(--text-bright)",fontWeight:600},teamMeta:{fontSize:11,color:"var(--text-dim)",marginTop:2},loadBtn:{background:"transparent",border:"none",color:"var(--accent)",fontSize:11,cursor:"pointer",fontFamily:"var(--font)",fontWeight:600},deleteBtn:{background:"none",border:"none",color:"var(--text-dim)",fontSize:12,cursor:"pointer",fontFamily:"var(--font)"},empty:{padding:20,color:"var(--text-dim)",fontSize:12,textAlign:"center"},divider:{borderTop:"1px solid var(--border)",margin:"12px 0"},saveTeamBtn:{background:"transparent",border:"1px solid var(--accent)",borderRadius:2,padding:"6px 14px",color:"var(--accent)",fontSize:12,cursor:"pointer",fontFamily:"var(--font)",fontWeight:600},saveRow:{display:"flex",gap:6,alignItems:"center"},saveInput:{flex:1,background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},saveBtn:{padding:"6px 12px",background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:12,cursor:"pointer",fontFamily:"var(--font)"},cancelBtn:{background:"none",border:"none",color:"var(--text-dim)",fontSize:12,cursor:"pointer",fontFamily:"var(--font)"}},ka="#4ae168",L1="#33afbc",X1="#e5c07b",N1="#e06c75",Q8="#c678dd",$8="#61afef",Kl=[L1,X1,ka,Q8,N1,$8,"#d19a66"],P8={medium:.009};function E8(){const[t,e]=N.useState(null),i=Ce(O=>O.agents),n=Ce(O=>O.dashTelemetry);N.useEffect(()=>{r();const O=setInterval(r,4e3);return()=>clearInterval(O)},[]);async function r(){try{const S=await(await fetch("/api/dashboard")).json();e(S),Ce.setState(_=>{const w={..._.dashTelemetry},x=Date.now();for(const Q of S.agents.breakdown){w[Q.id]||(w[Q.id]=[]);const k=w[Q.id],T=k[k.length-1];(!T||Q.tokens!==T.v||x-T.t>1e4)&&(k.push({t:x,v:Q.tokens||0,name:Q.name}),k.length>200&&(w[Q.id]=k.slice(-200)))}return{dashTelemetry:w}})}catch{}}if(!t)return v.jsxs("div",{style:Ot.loadingRoot,children:[v.jsx("div",{style:Ot.loadingText,children:"COMMAND CENTER"}),v.jsx("div",{style:Ot.loadingBar,children:v.jsx("div",{style:Ot.loadingFill})})]});const{tokens:s,routing:a,rotation:c,adaptive:h,journalist:d,uptime:f}=t,g=t.agents.breakdown,m=s.savings.total/1e3*P8.medium;return v.jsxs("div",{style:Ot.root,children:[v.jsxs("div",{style:Ot.statBar,children:[v.jsx(Dh,{label:"Total Tokens",value:Co(s.totalTokens),sub:`${t.agents.total} agent${t.agents.total!==1?"s":""}`}),v.jsx(Dh,{label:"Tokens Saved",value:Co(s.savings.total),sub:`${s.savings.percentage||0}% efficiency`,color:ka}),v.jsx(Dh,{label:"Est. Savings",value:m>0?`$${m.toFixed(2)}`:"$0.00",sub:"based on token costs",color:ka}),v.jsx(Dh,{label:"Rotations",value:c.totalRotations,sub:`${Co(c.totalTokensSaved)} tok recovered`}),v.jsx(Dh,{label:"Uptime",value:M8(f),sub:`${t.agents.running} running`})]}),v.jsxs("div",{style:Ot.midRow,children:[v.jsxs("div",{style:Ot.chartPanel,children:[v.jsxs("div",{style:Ot.panelHead,children:[v.jsx("span",{children:"Token Usage"}),v.jsx("span",{style:Ot.panelHeadRight,children:g.filter(O=>O.tokens>0).map((O,S)=>v.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginLeft:12},children:[v.jsx("span",{style:{width:6,height:2,background:Kl[S%Kl.length],display:"inline-block",borderRadius:1}}),v.jsx("span",{style:{fontSize:9},children:O.name})]},O.id))})]}),v.jsx(A8,{tokenTimeline:n,agents:i})]}),v.jsxs("div",{style:Ot.donutPanel,children:[v.jsx("div",{style:Ot.panelHead,children:"Model Routing"}),v.jsx(R8,{routing:a})]})]}),v.jsxs("div",{style:Ot.bottomRow,children:[v.jsxs("div",{style:Ot.panel,children:[v.jsx("div",{style:Ot.panelHead,children:"Savings Breakdown"}),v.jsxs("div",{style:Ot.scrollInner,children:[v.jsx(Jf,{label:"Rotation",value:s.savings.fromRotation,max:s.savings.total||1,color:L1}),v.jsx(Jf,{label:"Conflict Prevention",value:s.savings.fromConflictPrevention,max:s.savings.total||1,color:X1}),v.jsx(Jf,{label:"Cold-Start Skip",value:s.savings.fromColdStartSkip,max:s.savings.total||1,color:ka}),v.jsx("div",{style:Ot.divider}),v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:10,color:"#8b929e",padding:"4px 0"},children:[v.jsx("span",{children:"Without Groove"}),v.jsx("span",{style:{color:N1,fontWeight:600},children:Co(s.savings.estimatedWithoutGroove)})]}),v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:10,color:"#8b929e",padding:"4px 0"},children:[v.jsx("span",{children:"With Groove"}),v.jsx("span",{style:{color:ka,fontWeight:600},children:Co(s.totalTokens)})]}),v.jsx("div",{style:{fontSize:8,color:"#5c6370",marginTop:4,lineHeight:1.4},children:"Calculated from: rotation recovery (30% of degraded context), cold-start prevention (2K tokens/skip), conflict avoidance (500 tokens/conflict)."}),d.lastSummary&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:Ot.divider}),v.jsx("div",{style:Ot.panelHead,children:"Journalist"}),v.jsx("div",{style:Ot.journSummary,children:d.lastSummary})]})]})]}),v.jsxs("div",{style:Ot.panel,children:[v.jsx("div",{style:Ot.panelHead,children:"Agent Fleet"}),v.jsxs("div",{style:Ot.scrollInner,children:[g.length===0?v.jsx("div",{style:Ot.empty,children:"No agents spawned"}):g.map((O,S)=>v.jsx(Jf,{label:O.name,value:O.tokens,max:Math.max(...g.map(_=>_.tokens),1),color:Kl[S%Kl.length],sub:`${O.role} · ${O.model||"auto"}`},O.id)),c.history.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:Ot.divider}),v.jsx("div",{style:Ot.panelHead,children:"Rotation History"}),c.history.slice().reverse().slice(0,8).map((O,S)=>v.jsxs("div",{style:Ot.rotEntry,children:[v.jsx("span",{style:Ot.rotName,children:O.agentName}),v.jsxs("span",{style:{color:ka,fontSize:9},children:[Co(O.oldTokens)," saved"]}),v.jsx("span",{style:Ot.rotTime,children:z8(O.timestamp)})]},S))]})]})]})]})]})}function Dh({label:t,value:e,sub:i,color:n}){return v.jsxs("div",{style:Ot.statCard,children:[v.jsx("div",{style:{fontSize:10,color:"#8b929e",textTransform:"uppercase",letterSpacing:1,marginBottom:6},children:t}),v.jsx("div",{style:{fontSize:20,fontWeight:700,color:n||"#e6e6e6",lineHeight:1},children:e}),i&&v.jsx("div",{style:{fontSize:9,color:"#6b7280",marginTop:4},children:i})]})}function Jf({label:t,value:e,max:i,color:n,sub:r}){const s=i>0?e/i*100:0;return v.jsxs("div",{style:{padding:"6px 0"},children:[v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:4},children:[v.jsx("span",{style:{fontSize:11,color:"#abb2bf"},children:t}),v.jsx("span",{style:{fontSize:11,color:"#e6e6e6",fontWeight:600},children:Co(e)})]}),v.jsx("div",{style:{height:4,background:"#1e222a",borderRadius:2},children:v.jsx("div",{style:{width:`${Math.max(s,e>0?1:0)}%`,height:"100%",background:n,borderRadius:2,transition:"width 0.3s"}})}),r&&v.jsx("div",{style:{fontSize:8,color:"#3e4451",marginTop:2},children:r})]})}function R8({routing:t}){const e=[{label:"Heavy",color:N1,count:t.byTier.heavy,cost:"$0.045/1k"},{label:"Medium",color:X1,count:t.byTier.medium,cost:"$0.009/1k"},{label:"Light",color:ka,count:t.byTier.light,cost:"$0.002/1k"}],i=e.reduce((h,d)=>h+d.count,0)||1,n=50,r=60,s=60,a=2*Math.PI*n;let c=0;return v.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,alignItems:"center",justifyContent:"center",gap:12,minHeight:0},children:[v.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",children:[v.jsx("circle",{cx:r,cy:s,r:n,fill:"none",stroke:"#1e222a",strokeWidth:"10"}),e.map(h=>{if(h.count===0)return null;const f=h.count/i*a,g=v.jsx("circle",{cx:r,cy:s,r:n,fill:"none",stroke:h.color,strokeWidth:"10",strokeDasharray:`${f} ${a-f}`,strokeDashoffset:-c,strokeLinecap:"butt",transform:`rotate(-90 ${r} ${s})`,style:{transition:"stroke-dasharray 0.5s"}},h.label);return c+=f,g}),v.jsx("text",{x:r,y:s-4,textAnchor:"middle",fill:"#e6e6e6",fontSize:"16",fontWeight:"700",fontFamily:"JetBrains Mono, monospace",children:i>1?i:t.totalDecisions}),v.jsx("text",{x:r,y:s+10,textAnchor:"middle",fill:"#5c6370",fontSize:"8",fontFamily:"JetBrains Mono, monospace",children:"decisions"})]}),v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,width:"100%",padding:"0 8px"},children:e.map(h=>v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:10},children:[v.jsx("span",{style:{width:8,height:8,borderRadius:2,background:h.color,flexShrink:0}}),v.jsx("span",{style:{color:"#abb2bf",flex:1},children:h.label}),v.jsx("span",{style:{color:"#5c6370",fontSize:9},children:h.cost}),v.jsx("span",{style:{color:"#e6e6e6",fontWeight:600,minWidth:20,textAlign:"right"},children:h.count})]},h.label))}),v.jsxs("div",{style:{fontSize:9,color:"#3e4451"},children:[t.autoRoutedCount," auto-routed"]})]})}function A8({tokenTimeline:t,agents:e}){const i=N.useRef(),n=N.useRef(),r=N.useCallback(()=>{const s=i.current,a=n.current;if(!s||!a)return;const c=window.devicePixelRatio||1,h=s.clientWidth,d=s.clientHeight;if(h===0||d===0)return;a.width=h*c,a.height=d*c,a.style.width=h+"px",a.style.height=d+"px";const f=a.getContext("2d");f.scale(c,c),f.clearRect(0,0,h,d);const g=40,m=10,O=10,S=20,_=h-g-m,w=d-O-S;f.strokeStyle="#1e222a",f.lineWidth=.5;for(let $=0;$<=4;$++){const R=O+$/4*w;f.beginPath(),f.moveTo(g,R),f.lineTo(h-m,R),f.stroke()}const x=Object.keys(t);if(x.length===0){f.fillStyle="#3e4451",f.font="10px monospace",f.textAlign="center",f.fillText("Waiting for agent telemetry...",h/2,d/2);return}let Q=1/0,k=0,T=0;for(const $ of x)for(const R of t[$]||[])R.t<Q&&(Q=R.t),R.t>k&&(k=R.t),R.v>T&&(T=R.v);k===Q&&(k=Q+6e4),T===0&&(T=100);const M=k-Q;f.fillStyle="#3e4451",f.font="8px monospace",f.textAlign="right";for(let $=0;$<=4;$++){const R=T*(1-$/4);f.fillText(Co(Math.round(R)),g-4,O+$/4*w+3)}f.textAlign="center";for(let $=0;$<=4;$++){const R=Q+$/4*M,V=new Date(R);f.fillText(`${V.getHours()}:${String(V.getMinutes()).padStart(2,"0")}`,g+$/4*_,d-4)}x.forEach(($,R)=>{const V=t[$]||[];if(V.length<2)return;const H=Kl[R%Kl.length],ee=V.map(D=>({x:g+(D.t-Q)/M*_,y:O+(1-D.v/T)*w}));f.beginPath(),f.moveTo(ee[0].x,O+w);for(const D of ee)f.lineTo(D.x,D.y);f.lineTo(ee[ee.length-1].x,O+w),f.closePath();const I=f.createLinearGradient(0,O,0,O+w);I.addColorStop(0,H+"20"),I.addColorStop(1,H+"03"),f.fillStyle=I,f.fill(),f.beginPath();for(let D=0;D<ee.length;D++)D===0?f.moveTo(ee[D].x,ee[D].y):f.lineTo(ee[D].x,ee[D].y);f.strokeStyle=H,f.lineWidth=1,f.stroke();const j=ee[ee.length-1];f.beginPath(),f.arc(j.x,j.y,2,0,Math.PI*2),f.fillStyle=H,f.fill()})},[t,e]);return N.useEffect(()=>{r()},[r]),N.useEffect(()=>{const s=new ResizeObserver(r);return i.current&&s.observe(i.current),()=>s.disconnect()},[r]),v.jsx("div",{ref:i,style:{flex:1,minHeight:0,position:"relative"},children:v.jsx("canvas",{ref:n,style:{display:"block",position:"absolute",top:0,left:0}})})}function Co(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t||0)}function M8(t){const e=Math.floor(t/3600),i=Math.floor(t%3600/60);return e>0?`${e}h ${i}m`:`${i}m ${Math.floor(t%60)}s`}function z8(t){const e=Math.floor((Date.now()-new Date(t).getTime())/6e4);return e>=60?`${Math.floor(e/60)}h ago`:e>0?`${e}m ago`:"now"}const Ot={root:{width:"100%",height:"100%",display:"flex",flexDirection:"column",overflow:"hidden",padding:14,gap:12,background:"var(--bg-base)"},loadingRoot:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:12},loadingText:{fontSize:11,fontWeight:700,color:"var(--text-dim)",letterSpacing:3,textTransform:"uppercase"},loadingBar:{width:120,height:2,background:"#282c34",borderRadius:1,overflow:"hidden"},loadingFill:{width:"40%",height:"100%",background:L1,animation:"pulse 1.5s infinite"},statBar:{display:"flex",flexShrink:0,background:"#282c34",borderRadius:12,overflow:"hidden"},statCard:{flex:1,padding:"14px 16px",borderRight:"1px solid #1e222a",display:"flex",flexDirection:"column"},midRow:{display:"grid",gridTemplateColumns:"2fr 1fr",gap:12,flex:2,minHeight:0},chartPanel:{background:"#282c34",borderRadius:12,padding:"12px 14px",display:"flex",flexDirection:"column",minHeight:0},donutPanel:{background:"#282c34",borderRadius:12,padding:"12px 14px",display:"flex",flexDirection:"column",minHeight:0},bottomRow:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,flex:3,minHeight:0},panel:{background:"#282c34",borderRadius:12,padding:"12px 14px",display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},panelHead:{fontSize:10,fontWeight:600,color:"#5c6370",textTransform:"uppercase",letterSpacing:1,marginBottom:8,flexShrink:0,display:"flex",justifyContent:"space-between",alignItems:"center"},panelHeadRight:{display:"flex",alignItems:"center",color:"#3e4451"},scrollInner:{flex:1,minHeight:0,overflowY:"auto"},empty:{color:"#3e4451",fontSize:10,textAlign:"center",padding:20},divider:{height:1,background:"#1e222a",margin:"8px 0",flexShrink:0},journSummary:{fontSize:10,color:"#8b929e",lineHeight:1.5,padding:"4px 0",whiteSpace:"pre-wrap",maxHeight:80,overflowY:"auto"},rotEntry:{display:"flex",alignItems:"center",gap:8,padding:"4px 0",fontSize:10},rotName:{color:"#abb2bf",flex:1},rotTime:{color:"#3e4451",fontSize:9}};function j8(){const[t,e]=N.useState(null);N.useEffect(()=>{i();const s=setInterval(i,4e3);return()=>clearInterval(s)},[]);async function i(){try{const s=await fetch("/api/pm/history");e(await s.json())}catch{}}const n=(t==null?void 0:t.history)||[],r=(t==null?void 0:t.stats)||{};return v.jsxs("div",{style:di.container,children:[v.jsxs("div",{style:di.header,children:[v.jsx("div",{style:di.title,children:"PM REVIEW LOG"}),v.jsx("div",{style:di.subtitle,children:"AI Project Manager reviews risky agent operations in Auto mode"})]}),v.jsxs("div",{style:di.statsBar,children:[v.jsx(ep,{label:"REVIEWS",value:r.totalReviews||0}),v.jsx(ep,{label:"APPROVED",value:r.approved||0,color:"var(--green)"}),v.jsx(ep,{label:"REJECTED",value:r.rejected||0,color:"var(--red)"}),v.jsx(ep,{label:"AVG TIME",value:r.avgDurationMs?`${(r.avgDurationMs/1e3).toFixed(1)}s`:"-"})]}),n.length===0?v.jsxs("div",{style:di.empty,children:[v.jsx("div",{style:di.emptyTitle,children:"No reviews yet"}),v.jsx("div",{style:di.emptyDesc,children:"Spawn agents with Auto permission mode. The AI PM will review risky operations (new files, deletions, config changes) before they happen."})]}):v.jsx("div",{style:di.list,children:n.slice().reverse().map((s,a)=>v.jsxs("div",{style:di.entry,children:[v.jsxs("div",{style:di.entryTop,children:[v.jsx("span",{style:{...di.verdict,color:s.approved?"var(--green)":"var(--red)",borderColor:s.approved?"rgba(74,225,104,0.3)":"rgba(224,108,117,0.3)",background:s.approved?"rgba(74,225,104,0.08)":"rgba(224,108,117,0.08)"},children:s.approved?"APPROVED":"REJECTED"}),v.jsx("span",{style:di.entryAgent,children:s.agent}),v.jsx("span",{style:di.entryAction,children:s.action}),v.jsx("span",{style:di.entryTime,children:D8(s.timestamp)})]}),v.jsx("div",{style:di.entryFile,children:s.file}),s.description&&v.jsx("div",{style:di.entryDesc,children:s.description}),v.jsx("div",{style:di.entryReason,children:s.reason})]},a))})]})}function ep({label:t,value:e,color:i}){return v.jsxs("div",{style:di.stat,children:[v.jsx("div",{style:{fontSize:16,fontWeight:700,color:i||"var(--text-bright)"},children:e}),v.jsx("div",{style:{fontSize:7,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1},children:t})]})}function D8(t){const e=Math.floor((Date.now()-new Date(t).getTime())/6e4);return e>=60?`${Math.floor(e/60)}h ago`:e>0?`${e}m ago`:"just now"}const di={container:{padding:24,maxWidth:700,margin:"0 auto"},header:{marginBottom:16},title:{fontSize:11,fontWeight:700,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5},subtitle:{fontSize:10,color:"var(--text-dim)",marginTop:4},statsBar:{display:"flex",gap:8,marginBottom:16},stat:{flex:1,background:"var(--bg-surface)",border:"1px solid var(--border)",padding:"8px 10px",textAlign:"center"},empty:{textAlign:"center",padding:"40px 20px",background:"var(--bg-surface)",border:"1px solid var(--border)"},emptyTitle:{fontSize:12,color:"var(--text-primary)",fontWeight:600,marginBottom:8},emptyDesc:{fontSize:10,color:"var(--text-dim)",lineHeight:1.6,maxWidth:400,margin:"0 auto"},list:{display:"flex",flexDirection:"column",gap:4},entry:{background:"var(--bg-surface)",border:"1px solid var(--border)",padding:"8px 10px"},entryTop:{display:"flex",alignItems:"center",gap:8,marginBottom:4},verdict:{fontSize:8,fontWeight:700,letterSpacing:.5,padding:"1px 5px",border:"1px solid"},entryAgent:{fontSize:11,fontWeight:600,color:"var(--text-bright)"},entryAction:{fontSize:10,color:"var(--text-dim)"},entryTime:{fontSize:9,color:"var(--text-dim)",marginLeft:"auto"},entryFile:{fontSize:10,color:"var(--accent)",fontFamily:"var(--font)"},entryDesc:{fontSize:10,color:"var(--text-primary)",marginTop:2},entryReason:{fontSize:10,color:"var(--text-dim)",marginTop:3,fontStyle:"italic"}},Z1={all:"All Skills",design:"Design",quality:"Quality",devtools:"Dev Tools",workflow:"Workflow",security:"Security",specialized:"Specialized"},W1={design:"✨",quality:"✔",devtools:"⚙",workflow:"↻",security:"⛨",specialized:"☆"},B8=[{id:"popular",label:"Popular"},{id:"rating",label:"Top Rated"},{id:"newest",label:"Newest"},{id:"name",label:"A–Z"}];function L8(t){return t.source==="claude-official"?{label:"Anthropic",color:"#d4a574",bg:"rgba(212, 165, 116, 0.12)"}:t.source==="groove-official"?{label:"Groove",color:"var(--accent)",bg:"rgba(51, 175, 188, 0.12)"}:t.verified?{label:"Verified",color:"var(--green)",bg:"rgba(74, 225, 104, 0.10)"}:null}function q1({skill:t,size:e="small"}){const i=L8(t);if(!i)return null;const n=e==="small";return v.jsxs("span",{title:`${i.label} — Verified publisher`,style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:n?9:10,fontWeight:600,color:i.color,background:i.bg,padding:n?"1px 6px":"2px 8px",borderRadius:3,letterSpacing:.3,flexShrink:0,cursor:"default"},children:[v.jsx("span",{style:{fontSize:n?8:10,lineHeight:1},children:"✓"}),i.label]})}function V1(t){return t?t>=1e3?(t/1e3).toFixed(1).replace(/\.0$/,"")+"k":String(t):"0"}function Dy(t){if(!t)return null;const e=Math.floor(t),i=t-e>=.3,n=[];for(let r=0;r<5;r++)r<e?n.push("★"):n.push("☆");return n.join("")}function l2(t,e){const i=[...t];switch(e){case"popular":return i.sort((n,r)=>(r.downloads||0)-(n.downloads||0));case"rating":return i.sort((n,r)=>(r.rating||0)-(n.rating||0));case"name":return i.sort((n,r)=>n.name.localeCompare(r.name));case"newest":return i.reverse();default:return i}}function X8({current:t,onRate:e,disabled:i}){const[n,r]=N.useState(0);return v.jsx("div",{style:{display:"flex",gap:2,alignItems:"center"},children:[1,2,3,4,5].map(s=>{const a=n>0?s<=n:s<=(t||0);return v.jsx("span",{onClick:()=>!i&&e(s),onMouseEnter:()=>!i&&r(s),onMouseLeave:()=>r(0),style:{fontSize:18,cursor:i?"default":"pointer",color:a?"var(--amber)":"var(--bg-active)",transition:"color 0.1s, transform 0.1s",transform:n===s?"scale(1.2)":"none",userSelect:"none"},children:"★"},s)})})}function N8({skill:t,content:e,installing:i,onInstall:n,onUninstall:r,onRate:s,onClose:a}){const[c,h]=N.useState(0),[d,f]=N.useState(!1),[g,m]=N.useState(!1);if(!t)return null;async function O(S){m(!0);try{await s(t.id,S),h(S),f(!0)}catch{}m(!1)}return v.jsx("div",{style:Xe.overlay,onClick:a,children:v.jsxs("div",{style:Xe.container,onClick:S=>S.stopPropagation(),children:[v.jsxs("div",{style:Xe.topBar,children:[v.jsx(q1,{skill:t,size:"large"}),v.jsx("button",{onClick:a,style:Xe.closeBtn,children:"×"})]}),v.jsxs("div",{style:Xe.header,children:[v.jsx("div",{style:{...Xe.icon,background:t.installed?"var(--green)":t.price>0?"var(--purple)":"var(--accent)"},children:t.icon||t.name.charAt(0)}),v.jsxs("div",{style:Xe.headerInfo,children:[v.jsx("div",{style:Xe.name,children:t.name}),v.jsxs("div",{style:Xe.author,children:["by ",t.author]}),v.jsxs("div",{style:Xe.meta,children:[t.rating>0&&v.jsxs("span",{style:Xe.metaItem,children:[v.jsx("span",{style:{color:"var(--amber)"},children:Dy(t.rating)})," ",t.rating," (",t.ratingCount||0,")"]}),t.downloads>0&&v.jsxs("span",{style:Xe.metaItem,children:["⤓"," ",V1(t.downloads)]}),v.jsxs("span",{style:Xe.metaItem,children:[W1[t.category]||""," ",Z1[t.category]||t.category]})]})]})]}),v.jsxs("div",{style:Xe.actionBar,children:[t.installed?v.jsx("button",{onClick:()=>r(t.id),disabled:i===t.id,style:Xe.uninstallBtn,children:i===t.id?"Removing...":"Uninstall"}):v.jsx("button",{onClick:()=>n(t.id),disabled:i===t.id,style:t.price>0?Xe.buyBtn:Xe.installBtn,children:i===t.id?"Installing...":t.price>0?`$${t.price.toFixed(2)}`:"Install"}),t.price===0&&!t.installed&&v.jsx("span",{style:Xe.freeLabel,children:"Free"})]}),v.jsxs("div",{style:Xe.section,children:[v.jsx("div",{style:Xe.sectionTitle,children:"Rating"}),v.jsxs("div",{style:Xe.ratingRow,children:[v.jsxs("div",{style:Xe.ratingLeft,children:[v.jsx("div",{style:Xe.ratingBig,children:t.rating||"-"}),v.jsx("div",{style:{color:"var(--amber)",fontSize:13},children:Dy(t.rating)}),v.jsxs("div",{style:Xe.ratingCount,children:[t.ratingCount||0," ratings"]})]}),v.jsxs("div",{style:Xe.ratingRight,children:[v.jsx("div",{style:Xe.rateLabel,children:d?"Thanks for rating!":"Rate this skill"}),v.jsx(X8,{current:c,onRate:O,disabled:g||d}),g&&v.jsx("div",{style:{fontSize:10,color:"var(--text-muted)",marginTop:4},children:"Submitting..."})]})]})]}),v.jsxs("div",{style:Xe.section,children:[v.jsx("div",{style:Xe.sectionTitle,children:"About"}),v.jsx("div",{style:Xe.description,children:t.description})]}),v.jsxs("div",{style:Xe.section,children:[v.jsx("div",{style:Xe.sectionTitle,children:"Tags"}),v.jsxs("div",{style:Xe.tagRow,children:[(t.tags||[]).map(S=>v.jsx("span",{style:Xe.tag,children:S},S)),(t.roles||[]).map(S=>v.jsx("span",{style:Xe.roleTag,children:S},S))]})]}),t.authorProfile&&v.jsxs("div",{style:Xe.section,children:[v.jsx("div",{style:Xe.sectionTitle,children:"Developer"}),v.jsxs("div",{style:Xe.authorCard,children:[v.jsx("div",{style:Xe.authorAvatar,children:t.authorProfile.avatar?v.jsx("img",{src:t.authorProfile.avatar,alt:"",style:{width:"100%",height:"100%",borderRadius:6}}):t.author.charAt(0)}),v.jsxs("div",{style:Xe.authorDetails,children:[v.jsx("div",{style:Xe.authorName,children:t.author}),v.jsxs("div",{style:Xe.authorLinks,children:[t.authorProfile.website&&v.jsx("a",{href:t.authorProfile.website,target:"_blank",rel:"noopener noreferrer",style:Xe.authorLink,children:"Website"}),t.authorProfile.github&&v.jsx("a",{href:`https://github.com/${t.authorProfile.github}`,target:"_blank",rel:"noopener noreferrer",style:Xe.authorLink,children:"GitHub"}),t.authorProfile.twitter&&v.jsxs("a",{href:`https://x.com/${t.authorProfile.twitter}`,target:"_blank",rel:"noopener noreferrer",style:Xe.authorLink,children:["@",t.authorProfile.twitter]})]})]})]})]}),e&&v.jsxs("div",{style:Xe.section,children:[v.jsx("div",{style:Xe.sectionTitle,children:"Skill Instructions"}),v.jsxs("pre",{style:Xe.contentPre,children:[e.replace(/^---[\s\S]*?---\n/,"").trim().slice(0,2e3),e.length>2e3?`
74
- ...`:""]})]})]})})}function Z8({skills:t,onSelect:e}){const i=t.filter(n=>n.featured).slice(0,3);return i.length===0?null:v.jsxs("div",{style:Me.featuredSection,children:[v.jsx("div",{style:Me.featuredLabel,children:"Featured"}),v.jsx("div",{style:Me.featuredRow,children:i.map(n=>v.jsxs("div",{onClick:()=>e(n),style:Me.featuredCard,onMouseEnter:r=>{r.currentTarget.style.borderColor="var(--accent)",r.currentTarget.style.transform="translateY(-1px)"},onMouseLeave:r=>{r.currentTarget.style.borderColor="var(--border)",r.currentTarget.style.transform="none"},children:[v.jsx("div",{style:Me.featuredGradient,children:v.jsx("div",{style:{...Me.featuredIcon,background:n.installed?"var(--green)":"var(--accent)"},children:n.icon||n.name.charAt(0)})}),v.jsxs("div",{style:Me.featuredInfo,children:[v.jsx("div",{style:Me.featuredName,children:n.name}),v.jsxs("div",{style:Me.featuredAuthorRow,children:[v.jsx("span",{style:Me.featuredAuthor,children:n.author}),v.jsx(q1,{skill:n})]}),v.jsx("div",{style:Me.featuredDesc,children:n.description}),v.jsxs("div",{style:Me.featuredMeta,children:[n.rating>0&&v.jsxs("span",{style:{color:"var(--amber)",fontSize:10},children:[Dy(n.rating)," ",n.rating]}),v.jsxs("span",{style:{color:"var(--text-muted)",fontSize:10},children:["⤓"," ",V1(n.downloads)]})]})]}),n.installed&&v.jsx("div",{style:Me.featuredBadge,children:"installed"})]},n.id))})]})}function W8({skill:t,onSelect:e,hovered:i,onHover:n}){return v.jsxs("div",{onClick:()=>e(t),onMouseEnter:()=>n(t.id),onMouseLeave:()=>n(null),style:{...Me.card,borderColor:t.installed?"var(--green)":i?"var(--accent)":"var(--border)",background:i?"var(--bg-hover)":"var(--bg-surface)",transform:i?"translateY(-1px)":"none"},children:[v.jsxs("div",{style:Me.cardTop,children:[v.jsx("div",{style:{...Me.cardIcon,background:t.installed?"var(--green)":t.price>0?"var(--purple)":"var(--accent)"},children:t.icon||t.name.charAt(0)}),v.jsxs("div",{style:Me.cardInfo,children:[v.jsx("div",{style:Me.cardName,children:t.name}),v.jsxs("div",{style:Me.cardAuthorRow,children:[v.jsx("span",{style:Me.cardAuthor,children:t.author}),v.jsx(q1,{skill:t})]})]}),t.installed&&v.jsx("div",{style:Me.installedBadge,children:"installed"}),t.price>0&&!t.installed&&v.jsxs("div",{style:Me.priceBadge,children:["$",t.price.toFixed(2)]}),t.price===0&&!t.installed&&v.jsx("div",{style:Me.freeBadge,children:"Free"})]}),v.jsx("div",{style:Me.cardDesc,children:t.description}),v.jsxs("div",{style:Me.cardBottom,children:[v.jsxs("div",{style:Me.cardStats,children:[t.rating>0&&v.jsxs("span",{style:Me.cardRating,children:[v.jsx("span",{style:{color:"var(--amber)"},children:"★"})," ",t.rating]}),t.downloads>0&&v.jsxs("span",{style:Me.cardDownloads,children:["⤓"," ",V1(t.downloads)]})]}),v.jsxs("span",{style:Me.catTag,children:[W1[t.category]||""," ",Z1[t.category]||t.category]})]})]})}function q8(){const[t,e]=N.useState([]),[i,n]=N.useState([]),[r,s]=N.useState(""),[a,c]=N.useState("all"),[h,d]=N.useState("popular"),[f,g]=N.useState("browse"),[m,O]=N.useState(!0),[S,_]=N.useState(null),[w,x]=N.useState(null),[Q,k]=N.useState(null),[T,M]=N.useState(null),$=N.useCallback(async()=>{O(!0);try{const D=new URLSearchParams;r&&D.set("search",r),a!=="all"&&D.set("category",a);const X=await(await fetch(`/api/skills/registry?${D}`)).json();e(X.skills||[]),n(X.categories||[])}catch{}O(!1)},[r,a]);N.useEffect(()=>{$()},[$]);async function R(D){_(D);try{await fetch(`/api/skills/${D}/install`,{method:"POST"}),await $(),e(E=>{const X=E.find(P=>P.id===D);return X&&(w==null?void 0:w.id)===D&&x({...X,installed:!0}),E})}catch{}_(null)}async function V(D){_(D);try{await fetch(`/api/skills/${D}`,{method:"DELETE"}),await $(),(w==null?void 0:w.id)===D&&(x(E=>E?{...E,installed:!1}:null),k(null))}catch{}_(null)}async function H(D,E){const X=await fetch(`/api/skills/${D}/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:E})});if(!X.ok)throw new Error("Rating failed");const P=await X.json();e(Z=>Z.map(L=>L.id===D?{...L,rating:P.rating,ratingCount:P.rating_count??P.ratingCount}:L)),(w==null?void 0:w.id)===D&&x(Z=>Z?{...Z,rating:P.rating,ratingCount:P.rating_count??P.ratingCount}:null)}async function ee(D){if(x(D),k(null),D.installed)try{const X=await(await fetch(`/api/skills/${D.id}/content`)).json();k(X.content)}catch{}}const I=t.filter(D=>D.installed),j=l2(f==="installed"?I:t,h);return v.jsxs("div",{style:Me.root,children:[v.jsxs("div",{style:Me.headerBar,children:[v.jsxs("div",{style:Me.headerLeft,children:[v.jsx("div",{style:Me.title,children:"Skills Store"}),v.jsxs("div",{style:Me.headerTabs,children:[v.jsx("button",{onClick:()=>g("browse"),style:{...Me.headerTab,color:f==="browse"?"var(--text-bright)":"var(--text-dim)",borderBottom:f==="browse"?"2px solid var(--accent)":"2px solid transparent"},children:"Browse"}),v.jsxs("button",{onClick:()=>g("installed"),style:{...Me.headerTab,color:f==="installed"?"var(--text-bright)":"var(--text-dim)",borderBottom:f==="installed"?"2px solid var(--green)":"2px solid transparent"},children:["My Skills (",I.length,")"]})]})]}),v.jsx("div",{style:Me.headerRight,children:v.jsxs("span",{style:Me.headerCount,children:[t.length," skills"]})})]}),v.jsxs("div",{style:Me.toolbar,children:[v.jsxs("div",{style:Me.searchRow,children:[v.jsxs("div",{style:Me.searchWrap,children:[v.jsx("span",{style:Me.searchIcon,children:"⌕"}),v.jsx("input",{style:Me.search,placeholder:"Search skills...",value:r,onChange:D=>s(D.target.value)})]}),v.jsx("div",{style:Me.sortWrap,children:B8.map(D=>v.jsx("button",{onClick:()=>d(D.id),style:{...Me.sortBtn,color:h===D.id?"var(--text-bright)":"var(--text-muted)",background:h===D.id?"var(--bg-active)":"transparent"},children:D.label},D.id))})]}),f==="browse"&&v.jsxs("div",{style:Me.catRow,children:[v.jsx("button",{onClick:()=>c("all"),style:{...Me.catBtn,...a==="all"?Me.catBtnActive:{}},children:"All"}),i.map(D=>v.jsxs("button",{onClick:()=>c(D.id),style:{...Me.catBtn,...a===D.id?Me.catBtnActive:{}},children:[W1[D.id]||""," ",Z1[D.id]||D.id," (",D.count,")"]},D.id))]})]}),v.jsxs("div",{style:Me.scrollArea,children:[f==="browse"&&!r&&a==="all"&&v.jsx(Z8,{skills:t,onSelect:ee}),m&&t.length===0&&v.jsx("div",{style:Me.empty,children:"Loading skills..."}),!m&&j.length===0&&v.jsx("div",{style:Me.empty,children:f==="installed"?"No skills installed yet. Browse the store to find skills.":"No skills match your search."}),v.jsx("div",{style:Me.grid,children:j.map(D=>v.jsx(W8,{skill:D,onSelect:ee,hovered:T===D.id,onHover:M},D.id))})]}),v.jsx(N8,{skill:w,content:Q,installing:S,onInstall:R,onUninstall:V,onRate:H,onClose:()=>{x(null),k(null)}})]})}const Me={root:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},headerBar:{padding:"12px 20px 0",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},headerLeft:{display:"flex",alignItems:"center",gap:20},title:{fontSize:15,fontWeight:700,color:"var(--text-bright)",letterSpacing:.3},headerTabs:{display:"flex",gap:0},headerTab:{padding:"6px 14px",background:"none",border:"none",fontSize:12,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer",transition:"color 0.1s"},headerRight:{display:"flex",alignItems:"center",gap:10},headerCount:{fontSize:11,color:"var(--text-muted)"},toolbar:{padding:"10px 20px",flexShrink:0},searchRow:{display:"flex",gap:10,alignItems:"center"},searchWrap:{flex:1,position:"relative"},searchIcon:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--text-muted)",fontSize:13,pointerEvents:"none"},search:{width:"100%",padding:"7px 12px 7px 30px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},sortWrap:{display:"flex",gap:2},sortBtn:{padding:"5px 10px",background:"transparent",border:"1px solid transparent",borderRadius:4,fontSize:10,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer",transition:"all 0.1s"},catRow:{display:"flex",gap:4,marginTop:8,flexWrap:"wrap"},catBtn:{padding:"4px 12px",background:"transparent",border:"1px solid var(--border)",borderRadius:14,color:"var(--text-dim)",fontSize:10,fontFamily:"var(--font)",cursor:"pointer",transition:"all 0.1s"},catBtnActive:{borderColor:"var(--accent)",color:"var(--accent)",background:"rgba(51, 175, 188, 0.08)"},scrollArea:{flex:1,overflowY:"auto",padding:"4px 20px 20px"},featuredSection:{marginBottom:16},featuredLabel:{fontSize:11,fontWeight:700,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1,marginBottom:8},featuredRow:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:8},featuredCard:{padding:"14px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",transition:"border-color 0.15s, transform 0.15s",position:"relative",overflow:"hidden"},featuredGradient:{display:"flex",alignItems:"center",marginBottom:10},featuredIcon:{width:40,height:40,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",fontSize:16,fontWeight:700,color:"var(--bg-base)"},featuredInfo:{flex:1},featuredName:{fontSize:13,fontWeight:700,color:"var(--text-bright)"},featuredAuthorRow:{display:"flex",alignItems:"center",gap:6,marginTop:2},featuredAuthor:{fontSize:10,color:"var(--text-muted)"},featuredDesc:{fontSize:10,color:"var(--text-dim)",marginTop:6,lineHeight:1.45,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},featuredMeta:{display:"flex",gap:10,marginTop:8},featuredBadge:{position:"absolute",top:8,right:8,fontSize:8,fontWeight:600,color:"var(--green)",border:"1px solid var(--green)",borderRadius:3,padding:"1px 5px",textTransform:"uppercase",letterSpacing:.5},grid:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:8},empty:{padding:"60px 0",textAlign:"center",color:"var(--text-dim)",fontSize:12,gridColumn:"1 / -1"},card:{padding:"14px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",transition:"border-color 0.12s, background 0.12s, transform 0.12s",display:"flex",flexDirection:"column"},cardTop:{display:"flex",alignItems:"center",gap:10},cardIcon:{width:36,height:36,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,color:"var(--bg-base)",flexShrink:0},cardInfo:{flex:1,minWidth:0},cardName:{fontSize:12,fontWeight:600,color:"var(--text-bright)"},cardAuthorRow:{display:"flex",alignItems:"center",gap:6,marginTop:2},cardAuthor:{fontSize:10,color:"var(--text-muted)"},installedBadge:{fontSize:8,fontWeight:600,color:"var(--green)",border:"1px solid var(--green)",borderRadius:3,padding:"1px 6px",textTransform:"uppercase",letterSpacing:.5,flexShrink:0},priceBadge:{fontSize:10,fontWeight:700,color:"var(--purple)",border:"1px solid var(--purple)",borderRadius:4,padding:"2px 8px",flexShrink:0},freeBadge:{fontSize:9,fontWeight:500,color:"var(--text-muted)",flexShrink:0},cardDesc:{fontSize:11,color:"var(--text-dim)",marginTop:10,lineHeight:1.5,flex:1,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},cardBottom:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:10,paddingTop:8,borderTop:"1px solid var(--border)"},cardStats:{display:"flex",gap:10},cardRating:{fontSize:10,color:"var(--text-dim)"},cardDownloads:{fontSize:10,color:"var(--text-muted)"},catTag:{fontSize:9,padding:"2px 8px",borderRadius:4,background:"var(--bg-active)",color:"var(--text-dim)",fontWeight:500}},Xe={overlay:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(2px)"},container:{width:"90%",maxWidth:560,maxHeight:"85vh",background:"var(--bg-chrome)",border:"1px solid var(--border)",borderRadius:10,overflowY:"auto",padding:"0 24px 24px",position:"relative"},topBar:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 0 10px",position:"sticky",top:0,zIndex:1,background:"var(--bg-chrome)"},closeBtn:{background:"none",border:"1px solid var(--border)",borderRadius:4,color:"var(--text-dim)",fontSize:16,cursor:"pointer",fontFamily:"var(--font)",lineHeight:1,padding:"2px 8px",transition:"border-color 0.1s"},header:{display:"flex",gap:14,alignItems:"flex-start",marginBottom:14},actionBar:{display:"flex",alignItems:"center",gap:10,marginBottom:18,paddingBottom:16,borderBottom:"1px solid var(--border)"},icon:{width:52,height:52,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:20,fontWeight:700,color:"var(--bg-base)",flexShrink:0},headerInfo:{flex:1,minWidth:0},name:{fontSize:16,fontWeight:700,color:"var(--text-bright)"},author:{fontSize:11,color:"var(--text-dim)",marginTop:2},meta:{display:"flex",gap:12,marginTop:6,fontSize:11,color:"var(--text-dim)"},metaItem:{display:"flex",alignItems:"center",gap:3},installBtn:{padding:"8px 28px",background:"var(--accent)",border:"none",borderRadius:6,color:"var(--bg-base)",fontSize:12,fontWeight:700,fontFamily:"var(--font)",cursor:"pointer",transition:"opacity 0.1s"},buyBtn:{padding:"8px 28px",background:"var(--purple)",border:"none",borderRadius:6,color:"#fff",fontSize:12,fontWeight:700,fontFamily:"var(--font)",cursor:"pointer",transition:"opacity 0.1s"},uninstallBtn:{padding:"8px 20px",background:"transparent",border:"1px solid var(--red)",borderRadius:6,color:"var(--red)",fontSize:12,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},freeLabel:{fontSize:9,color:"var(--text-muted)",fontWeight:500},section:{marginBottom:16},ratingRow:{display:"flex",gap:20,alignItems:"center",padding:"12px 14px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6},ratingLeft:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,minWidth:70},ratingBig:{fontSize:24,fontWeight:700,color:"var(--text-bright)",lineHeight:1},ratingCount:{fontSize:9,color:"var(--text-muted)",marginTop:2},ratingRight:{flex:1},rateLabel:{fontSize:11,color:"var(--text-dim)",marginBottom:6},sectionTitle:{fontSize:10,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:.8,marginBottom:8},description:{fontSize:12,color:"var(--text-primary)",lineHeight:1.6},tagRow:{display:"flex",gap:5,flexWrap:"wrap"},tag:{fontSize:10,padding:"2px 8px",borderRadius:4,background:"var(--bg-active)",color:"var(--text-dim)"},roleTag:{fontSize:10,padding:"2px 8px",borderRadius:4,background:"rgba(51, 175, 188, 0.1)",color:"var(--accent)"},authorCard:{display:"flex",gap:12,alignItems:"center",padding:"10px 12px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6},authorAvatar:{width:36,height:36,borderRadius:6,background:"var(--accent)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,color:"var(--bg-base)",flexShrink:0},authorDetails:{flex:1},authorName:{fontSize:12,fontWeight:600,color:"var(--text-bright)"},authorLinks:{display:"flex",gap:10,marginTop:4},authorLink:{fontSize:10,color:"var(--accent)",textDecoration:"none"},contentPre:{fontSize:10,color:"var(--text-dim)",lineHeight:1.6,fontFamily:"var(--font)",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:300,overflowY:"auto",padding:"10px 12px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6}},I1={all:"All",communication:"Communication",productivity:"Productivity",finance:"Finance",developer:"Developer",database:"Database","smart-home":"Smart Home",analytics:"Analytics"},Y1={communication:"✉",productivity:"⚙",finance:"⚖",developer:"⌘",database:"≡","smart-home":"⌂",analytics:"⌕"},H1={slack:"S",github:"G",stripe:"$",calendar:"C",email:"@",gmail:"@",database:"D",search:"?",drive:"D",linear:"L",notion:"N",discord:"D",home:"H",folder:"F",map:"M"},V8=[{id:"popular",label:"Popular"},{id:"name",label:"A–Z"},{id:"category",label:"Category"}];function I8(t){return t.verified==="mcp-official"?{label:"Official",color:"var(--accent)",bg:"rgba(51, 175, 188, 0.12)"}:t.verified==="verified"?{label:"Verified",color:"var(--green)",bg:"rgba(74, 225, 104, 0.10)"}:null}function U1({item:t,size:e="small"}){const i=I8(t);if(!i)return null;const n=e==="small";return v.jsxs("span",{title:`${i.label} MCP server`,style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:n?9:10,fontWeight:600,color:i.color,background:i.bg,padding:n?"1px 6px":"2px 8px",borderRadius:3,letterSpacing:.3,flexShrink:0,cursor:"default"},children:[v.jsx("span",{style:{fontSize:n?8:10,lineHeight:1},children:"✓"}),i.label]})}function c2(t,e){const i=[...t];switch(e){case"popular":return i.sort((n,r)=>(r.featured?1:0)-(n.featured?1:0)||n.name.localeCompare(r.name));case"name":return i.sort((n,r)=>n.name.localeCompare(r.name));case"category":return i.sort((n,r)=>(n.category||"").localeCompare(r.category||"")||n.name.localeCompare(r.name));default:return i}}function Y8({integration:t,onClose:e}){const[i,n]=N.useState({}),[r,s]=N.useState(!1),[a,c]=N.useState({}),[h,d]=N.useState(null),[f,g]=N.useState(""),[m,O]=N.useState(""),[S,_]=N.useState(!1);if(N.useEffect(()=>{(t==null?void 0:t.authType)==="oauth-google"&&(d("checking"),fetch("/api/integrations/google-oauth/status").then($=>$.json()).then($=>d($.configured?"ready":"not-configured")).catch(()=>d("not-configured")))},[t]),!t)return null;const w=t.authType==="oauth-google",x=(t.envKeys||[]).filter($=>!$.hidden),Q=t.setupSteps||[];async function k($){if(i[$]){s(!0);try{(await fetch(`/api/integrations/${t.id}/credentials`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:$,value:i[$]})})).ok&&(c(V=>({...V,[$]:!0})),n(V=>({...V,[$]:""})))}catch{}s(!1)}}async function T(){if(!(!f||!m)){s(!0);try{await fetch("/api/integrations/google-oauth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:f,clientSecret:m})}),d("ready"),_(!1)}catch{}s(!1)}}async function M(){d("connecting");try{const R=await(await fetch(`/api/integrations/${t.id}/oauth/start`,{method:"POST"})).json();if(R.url){window.open(R.url,"_blank","width=600,height=700");const V=setInterval(async()=>{try{(await(await fetch(`/api/integrations/${t.id}/status`)).json()).configured&&(clearInterval(V),d("ready"),e())}catch{}},2e3);setTimeout(()=>clearInterval(V),3e5)}}catch{d("ready")}}return v.jsx("div",{style:Ye.overlay,onClick:e,children:v.jsxs("div",{style:Ye.container,onClick:$=>$.stopPropagation(),children:[v.jsxs("div",{style:Ye.topBar,children:[v.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-bright)"},children:["Connect ",t.name]}),v.jsx("button",{onClick:e,style:Ye.closeBtn,children:"×"})]}),v.jsxs("div",{style:{padding:"16px 0"},children:[Q.length>0&&v.jsxs("div",{style:{marginBottom:20},children:[v.jsx("div",{style:{fontSize:10,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:.5,marginBottom:10},children:"Setup Guide"}),Q.map(($,R)=>v.jsxs("div",{style:{display:"flex",gap:10,marginBottom:8,fontSize:11,color:"var(--text-primary)",lineHeight:1.5},children:[v.jsx("span",{style:{width:20,height:20,borderRadius:"50%",flexShrink:0,background:"var(--bg-active)",color:"var(--accent)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700},children:R+1}),v.jsx("span",{children:$})]},R))]}),t.setupUrl&&!w&&v.jsxs("a",{href:t.setupUrl,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"10px 16px",marginBottom:16,background:"var(--bg-active)",color:"var(--accent)",border:"1px solid var(--accent)",borderRadius:6,fontSize:12,fontWeight:600,textDecoration:"none",cursor:"pointer"},children:["Open ",t.name," Settings ","↗"]}),w&&v.jsxs("div",{style:{marginBottom:16},children:[h==="checking"&&v.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textAlign:"center",padding:16},children:"Checking Google OAuth setup..."}),h==="not-configured"&&!S&&v.jsxs("div",{style:{padding:16,borderRadius:8,background:"rgba(229, 192, 123, 0.06)",border:"1px solid var(--amber)"},children:[v.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--amber)",marginBottom:8},children:"One-time Google setup needed"}),v.jsx("div",{style:{fontSize:11,color:"var(--text-dim)",lineHeight:1.5,marginBottom:12},children:"To connect Google services, you need a Google Cloud project with OAuth credentials. This is a one-time setup that works for Gmail, Calendar, and Drive."}),v.jsxs("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:11,color:"var(--accent)",textDecoration:"none",marginBottom:12},children:["Open Google Cloud Console ","↗"]}),v.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)",lineHeight:1.6,marginBottom:12},children:["1. Create a project (or select existing)",`
75
- `,"2. Configure OAuth consent screen (External, add your email as test user)",`
76
- `,"3. Create OAuth Client ID (Desktop app)",`
77
- `,"4. Copy the Client ID and Client Secret below"]}),v.jsx("button",{onClick:()=>_(!0),style:{...Ye.saveBtn,width:"100%"},children:"I have my Client ID and Secret"})]}),h==="not-configured"&&S&&v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[v.jsxs("div",{children:[v.jsx("label",{style:Ye.label,children:"Google OAuth Client ID"}),v.jsx("input",{value:f,onChange:$=>g($.target.value),placeholder:"123456789.apps.googleusercontent.com",style:Ye.input})]}),v.jsxs("div",{children:[v.jsx("label",{style:Ye.label,children:"Google OAuth Client Secret"}),v.jsx("input",{type:"password",value:m,onChange:$=>O($.target.value),placeholder:"GOCSPX-...",style:Ye.input})]}),v.jsx("button",{onClick:T,disabled:r||!f||!m,style:{...Ye.saveBtn,width:"100%",opacity:r||!f||!m?.4:1},children:r?"Saving...":"Save Google OAuth Credentials"}),v.jsx("div",{style:{fontSize:9,color:"var(--text-muted)",textAlign:"center"},children:"Stored encrypted, only on this machine. One-time setup for all Google integrations."})]}),(h==="ready"||h==="connecting")&&v.jsx("button",{onClick:M,disabled:h==="connecting",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8,width:"100%",padding:"12px 16px",background:h==="connecting"?"var(--bg-active)":"#4285f4",color:"#fff",border:"none",borderRadius:6,fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},children:h==="connecting"?"Waiting for authorization...":"Connect with Google"})]}),x.length>0&&v.jsxs("div",{children:[v.jsx("div",{style:{fontSize:11,color:"var(--text-dim)",marginBottom:12,lineHeight:1.5},children:"Paste your credentials below. Values are encrypted and stored locally on this machine only."}),x.map($=>v.jsxs("div",{style:{marginBottom:14},children:[v.jsxs("label",{style:Ye.label,children:[$.label||$.key,$.required&&v.jsx("span",{style:{color:"var(--red)",marginLeft:4},children:"*"}),a[$.key]&&v.jsxs("span",{style:{color:"var(--green)",marginLeft:8,fontSize:10,fontWeight:500},children:["✓"," saved"]})]}),v.jsxs("div",{style:{display:"flex",gap:6},children:[v.jsx("input",{type:"password",value:i[$.key]||"",placeholder:$.placeholder||$.key,onChange:R=>n(V=>({...V,[$.key]:R.target.value})),onKeyDown:R=>R.key==="Enter"&&k($.key),style:Ye.input}),v.jsx("button",{onClick:()=>k($.key),disabled:r||!i[$.key],style:{...Ye.saveBtn,opacity:r||!i[$.key]?.4:1},children:"Save"})]})]},$.key))]})]})]})})}function H8({integration:t,installing:e,onInstall:i,onUninstall:n,onConfigure:r,onClose:s}){return t?v.jsx("div",{style:Ye.overlay,onClick:s,children:v.jsxs("div",{style:Ye.container,onClick:a=>a.stopPropagation(),children:[v.jsxs("div",{style:Ye.topBar,children:[v.jsx(U1,{item:t,size:"large"}),v.jsx("button",{onClick:s,style:Ye.closeBtn,children:"×"})]}),v.jsxs("div",{style:Ye.header,children:[v.jsx("div",{style:{...Ye.icon,background:t.installed&&t.configured?"var(--green)":t.installed?"var(--amber)":"var(--accent)"},children:H1[t.icon]||t.name.charAt(0)}),v.jsxs("div",{style:Ye.headerInfo,children:[v.jsx("div",{style:Ye.name,children:t.name}),v.jsxs("div",{style:Ye.meta,children:[v.jsxs("span",{style:Ye.metaItem,children:[Y1[t.category]||""," ",I1[t.category]||t.category]}),v.jsx("span",{style:Ye.metaItem,children:"MCP Server"})]})]})]}),v.jsx("div",{style:Ye.actionBar,children:t.installed?v.jsxs("div",{style:{display:"flex",gap:8,flex:1},children:[v.jsx("button",{onClick:()=>r(t),style:Ye.configureBtn,disabled:(t.envKeys||[]).length===0,children:t.configured?"Reconfigure":"Configure"}),v.jsx("button",{onClick:()=>n(t.id),disabled:e===t.id,style:Ye.uninstallBtn,children:e===t.id?"Removing...":"Uninstall"})]}):v.jsx("button",{onClick:()=>i(t.id),disabled:e===t.id,style:Ye.installBtn,children:e===t.id?"Installing...":"Install"})}),t.installed&&v.jsxs("div",{style:Ye.section,children:[v.jsx("div",{style:Ye.sectionTitle,children:"Status"}),v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderRadius:6,background:t.configured?"rgba(74, 225, 104, 0.06)":"rgba(229, 192, 123, 0.06)",border:`1px solid ${t.configured?"var(--green)":"var(--amber)"}`},children:[v.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:t.configured?"var(--green)":"var(--amber)"}}),v.jsx("span",{style:{fontSize:11,color:t.configured?"var(--green)":"var(--amber)"},children:t.configured?"Connected and ready":"Credentials needed"})]})]}),v.jsxs("div",{style:Ye.section,children:[v.jsx("div",{style:Ye.sectionTitle,children:"About"}),v.jsx("div",{style:Ye.description,children:t.description})]}),(t.envKeys||[]).length>0&&v.jsxs("div",{style:Ye.section,children:[v.jsx("div",{style:Ye.sectionTitle,children:"Required Credentials"}),v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:t.envKeys.map(a=>v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:11,color:"var(--text-dim)"},children:[v.jsx("code",{style:{fontSize:10,padding:"1px 6px",borderRadius:3,background:"var(--bg-active)",color:"var(--text-primary)",fontFamily:"var(--font)"},children:a.key}),v.jsx("span",{children:a.label}),a.required&&v.jsx("span",{style:{color:"var(--amber)",fontSize:9},children:"required"})]},a.key))})]}),v.jsxs("div",{style:Ye.section,children:[v.jsx("div",{style:Ye.sectionTitle,children:"Tags"}),v.jsxs("div",{style:Ye.tagRow,children:[(t.tags||[]).map(a=>v.jsx("span",{style:Ye.tag,children:a},a)),(t.roles||[]).map(a=>v.jsx("span",{style:Ye.roleTag,children:a},a))]})]}),t.npmPackage&&v.jsxs("div",{style:Ye.section,children:[v.jsx("div",{style:Ye.sectionTitle,children:"Package"}),v.jsx("code",{style:{fontSize:11,padding:"6px 10px",borderRadius:4,background:"var(--bg-active)",color:"var(--text-primary)",display:"block",fontFamily:"var(--font)"},children:t.npmPackage})]})]})}):null}function U8({integrations:t,onSelect:e}){const i=t.filter(n=>n.featured).slice(0,3);return i.length===0?null:v.jsxs("div",{style:je.featuredSection,children:[v.jsx("div",{style:je.featuredLabel,children:"Featured Integrations"}),v.jsx("div",{style:je.featuredRow,children:i.map(n=>v.jsxs("div",{onClick:()=>e(n),style:je.featuredCard,onMouseEnter:r=>{r.currentTarget.style.borderColor="var(--accent)",r.currentTarget.style.transform="translateY(-1px)"},onMouseLeave:r=>{r.currentTarget.style.borderColor="var(--border)",r.currentTarget.style.transform="none"},children:[v.jsx("div",{style:je.featuredGradient,children:v.jsx("div",{style:{...je.featuredIcon,background:n.installed&&n.configured?"var(--green)":n.installed?"var(--amber)":"var(--accent)"},children:H1[n.icon]||n.name.charAt(0)})}),v.jsxs("div",{style:je.featuredInfo,children:[v.jsx("div",{style:je.featuredName,children:n.name}),v.jsx("div",{style:je.featuredAuthorRow,children:v.jsx(U1,{item:n})}),v.jsx("div",{style:je.featuredDesc,children:n.description})]}),n.installed&&n.configured&&v.jsx("div",{style:je.connectedBadge,children:"connected"}),n.installed&&!n.configured&&v.jsx("div",{style:je.setupBadge,children:"needs setup"})]},n.id))})]})}function G8({item:t,onSelect:e,hovered:i,onHover:n}){return v.jsxs("div",{onClick:()=>e(t),onMouseEnter:()=>n(t.id),onMouseLeave:()=>n(null),style:{...je.card,borderColor:t.installed&&t.configured?"var(--green)":t.installed?"var(--amber)":i?"var(--accent)":"var(--border)",background:i?"var(--bg-hover)":"var(--bg-surface)",transform:i?"translateY(-1px)":"none"},children:[v.jsxs("div",{style:je.cardTop,children:[v.jsx("div",{style:{...je.cardIcon,background:t.installed&&t.configured?"var(--green)":t.installed?"var(--amber)":"var(--accent)"},children:H1[t.icon]||t.name.charAt(0)}),v.jsxs("div",{style:je.cardInfo,children:[v.jsx("div",{style:je.cardName,children:t.name}),v.jsx("div",{style:je.cardAuthorRow,children:v.jsx(U1,{item:t})})]}),t.installed&&t.configured&&v.jsx("div",{style:je.connectedBadgeSm,children:"connected"}),t.installed&&!t.configured&&v.jsx("div",{style:je.setupBadgeSm,children:"setup"}),!t.installed&&v.jsx("div",{style:je.freeBadge,children:"MCP"})]}),v.jsx("div",{style:je.cardDesc,children:t.description}),v.jsxs("div",{style:je.cardBottom,children:[v.jsx("div",{style:je.cardStats,children:(t.envKeys||[]).length>0&&v.jsxs("span",{style:je.cardCredCount,children:[t.envKeys.length," credential",t.envKeys.length>1?"s":""]})}),v.jsxs("span",{style:je.catTag,children:[Y1[t.category]||""," ",I1[t.category]||t.category]})]})]})}function F8(){const[t,e]=N.useState([]),[i,n]=N.useState([]),[r,s]=N.useState(""),[a,c]=N.useState("all"),[h,d]=N.useState("popular"),[f,g]=N.useState("browse"),[m,O]=N.useState(!0),[S,_]=N.useState(null),[w,x]=N.useState(null),[Q,k]=N.useState(null),[T,M]=N.useState(null),$=N.useCallback(async()=>{O(!0);try{const E=new URLSearchParams;r&&E.set("search",r),a!=="all"&&E.set("category",a);const P=await(await fetch(`/api/integrations/registry?${E}`)).json();e(P.integrations||[]),n(P.categories||[])}catch{}O(!1)},[r,a]);N.useEffect(()=>{$()},[$]);async function R(E){_(E);try{if(await fetch(`/api/integrations/${E}/install`,{method:"POST"}),await $(),(w==null?void 0:w.id)===E){const X=t.find(P=>P.id===E);X&&x({...X,installed:!0})}}catch{}_(null)}async function V(E){_(E);try{await fetch(`/api/integrations/${E}`,{method:"DELETE"}),await $(),(w==null?void 0:w.id)===E&&x(X=>X?{...X,installed:!1,configured:!1}:null)}catch{}_(null)}function H(E){x(E)}function ee(E){x(null),k(E)}function I(){k(null),$()}const j=t.filter(E=>E.installed),D=c2(f==="installed"?j:t,h);return v.jsxs("div",{style:je.root,children:[v.jsxs("div",{style:je.headerBar,children:[v.jsxs("div",{style:je.headerLeft,children:[v.jsx("div",{style:je.title,children:"Integrations"}),v.jsxs("div",{style:je.headerTabs,children:[v.jsx("button",{onClick:()=>g("browse"),style:{...je.headerTab,color:f==="browse"?"var(--text-bright)":"var(--text-dim)",borderBottom:f==="browse"?"2px solid var(--accent)":"2px solid transparent"},children:"Browse"}),v.jsxs("button",{onClick:()=>g("installed"),style:{...je.headerTab,color:f==="installed"?"var(--text-bright)":"var(--text-dim)",borderBottom:f==="installed"?"2px solid var(--green)":"2px solid transparent"},children:["Installed (",j.length,")"]})]})]}),v.jsx("div",{style:je.headerRight,children:v.jsxs("span",{style:je.headerCount,children:[t.length," integrations"]})})]}),v.jsxs("div",{style:je.toolbar,children:[v.jsxs("div",{style:je.searchRow,children:[v.jsxs("div",{style:je.searchWrap,children:[v.jsx("span",{style:je.searchIcon,children:"⌕"}),v.jsx("input",{style:je.search,placeholder:"Search integrations...",value:r,onChange:E=>s(E.target.value)})]}),v.jsx("div",{style:je.sortWrap,children:V8.map(E=>v.jsx("button",{onClick:()=>d(E.id),style:{...je.sortBtn,color:h===E.id?"var(--text-bright)":"var(--text-muted)",background:h===E.id?"var(--bg-active)":"transparent"},children:E.label},E.id))})]}),f==="browse"&&v.jsxs("div",{style:je.catRow,children:[v.jsx("button",{onClick:()=>c("all"),style:{...je.catBtn,...a==="all"?je.catBtnActive:{}},children:"All"}),i.map(E=>v.jsxs("button",{onClick:()=>c(E.id),style:{...je.catBtn,...a===E.id?je.catBtnActive:{}},children:[Y1[E.id]||""," ",I1[E.id]||E.id," (",E.count,")"]},E.id))]})]}),v.jsxs("div",{style:je.scrollArea,children:[f==="browse"&&!r&&a==="all"&&v.jsx(U8,{integrations:t,onSelect:H}),m&&t.length===0&&v.jsx("div",{style:je.empty,children:"Loading integrations..."}),!m&&D.length===0&&v.jsx("div",{style:je.empty,children:f==="installed"?"No integrations installed yet. Browse to connect your tools.":"No integrations match your search."}),v.jsx("div",{style:je.grid,children:D.map(E=>v.jsx(G8,{item:E,onSelect:H,hovered:T===E.id,onHover:M},E.id))})]}),v.jsx(H8,{integration:w,installing:S,onInstall:R,onUninstall:V,onConfigure:ee,onClose:()=>x(null)}),v.jsx(Y8,{integration:Q,onClose:I})]})}const je={root:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},headerBar:{padding:"12px 20px 0",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},headerLeft:{display:"flex",alignItems:"center",gap:20},title:{fontSize:15,fontWeight:700,color:"var(--text-bright)",letterSpacing:.3},headerTabs:{display:"flex",gap:0},headerTab:{padding:"6px 14px",background:"none",border:"none",fontSize:12,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer",transition:"color 0.1s"},headerRight:{display:"flex",alignItems:"center",gap:10},headerCount:{fontSize:11,color:"var(--text-muted)"},toolbar:{padding:"10px 20px",flexShrink:0},searchRow:{display:"flex",gap:10,alignItems:"center"},searchWrap:{flex:1,position:"relative"},searchIcon:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--text-muted)",fontSize:13,pointerEvents:"none"},search:{width:"100%",padding:"7px 12px 7px 30px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},sortWrap:{display:"flex",gap:2},sortBtn:{padding:"5px 10px",background:"transparent",border:"1px solid transparent",borderRadius:4,fontSize:10,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer",transition:"all 0.1s"},catRow:{display:"flex",gap:4,marginTop:8,flexWrap:"wrap"},catBtn:{padding:"4px 12px",background:"transparent",border:"1px solid var(--border)",borderRadius:14,color:"var(--text-dim)",fontSize:10,fontFamily:"var(--font)",cursor:"pointer",transition:"all 0.1s"},catBtnActive:{borderColor:"var(--accent)",color:"var(--accent)",background:"rgba(51, 175, 188, 0.08)"},scrollArea:{flex:1,overflowY:"auto",padding:"4px 20px 20px"},featuredSection:{marginBottom:16},featuredLabel:{fontSize:11,fontWeight:700,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1,marginBottom:8},featuredRow:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:8},featuredCard:{padding:"14px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",transition:"border-color 0.15s, transform 0.15s",position:"relative",overflow:"hidden"},featuredGradient:{display:"flex",alignItems:"center",marginBottom:10},featuredIcon:{width:40,height:40,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",fontSize:16,fontWeight:700,color:"var(--bg-base)"},featuredInfo:{flex:1},featuredName:{fontSize:13,fontWeight:700,color:"var(--text-bright)"},featuredAuthorRow:{display:"flex",alignItems:"center",gap:6,marginTop:2},featuredDesc:{fontSize:10,color:"var(--text-dim)",marginTop:6,lineHeight:1.45,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},connectedBadge:{position:"absolute",top:8,right:8,fontSize:8,fontWeight:600,color:"var(--green)",border:"1px solid var(--green)",borderRadius:3,padding:"1px 5px",textTransform:"uppercase",letterSpacing:.5},setupBadge:{position:"absolute",top:8,right:8,fontSize:8,fontWeight:600,color:"var(--amber)",border:"1px solid var(--amber)",borderRadius:3,padding:"1px 5px",textTransform:"uppercase",letterSpacing:.5},grid:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:8},empty:{padding:"60px 0",textAlign:"center",color:"var(--text-dim)",fontSize:12,gridColumn:"1 / -1"},card:{padding:"14px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",transition:"border-color 0.12s, background 0.12s, transform 0.12s",display:"flex",flexDirection:"column"},cardTop:{display:"flex",alignItems:"center",gap:10},cardIcon:{width:36,height:36,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,color:"var(--bg-base)",flexShrink:0},cardInfo:{flex:1,minWidth:0},cardName:{fontSize:12,fontWeight:600,color:"var(--text-bright)"},cardAuthorRow:{display:"flex",alignItems:"center",gap:6,marginTop:2},connectedBadgeSm:{fontSize:8,fontWeight:600,color:"var(--green)",border:"1px solid var(--green)",borderRadius:3,padding:"1px 6px",textTransform:"uppercase",letterSpacing:.5,flexShrink:0},setupBadgeSm:{fontSize:8,fontWeight:600,color:"var(--amber)",border:"1px solid var(--amber)",borderRadius:3,padding:"1px 6px",textTransform:"uppercase",letterSpacing:.5,flexShrink:0},freeBadge:{fontSize:9,fontWeight:500,color:"var(--text-muted)",flexShrink:0},cardDesc:{fontSize:11,color:"var(--text-dim)",marginTop:10,lineHeight:1.5,flex:1,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},cardBottom:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:10,paddingTop:8,borderTop:"1px solid var(--border)"},cardStats:{display:"flex",gap:10},cardCredCount:{fontSize:10,color:"var(--text-muted)"},catTag:{fontSize:9,padding:"2px 8px",borderRadius:4,background:"var(--bg-active)",color:"var(--text-dim)",fontWeight:500}},Ye={overlay:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(2px)"},container:{width:"90%",maxWidth:520,maxHeight:"85vh",background:"var(--bg-chrome)",border:"1px solid var(--border)",borderRadius:10,overflowY:"auto",padding:"0 24px 24px",position:"relative"},topBar:{position:"sticky",top:0,background:"var(--bg-chrome)",padding:"16px 0 8px",display:"flex",alignItems:"center",justifyContent:"space-between",zIndex:1},closeBtn:{background:"none",border:"none",color:"var(--text-muted)",fontSize:20,cursor:"pointer",padding:"2px 6px",fontFamily:"var(--font)"},header:{display:"flex",gap:14,alignItems:"flex-start",marginBottom:16},icon:{width:52,height:52,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:20,fontWeight:700,color:"var(--bg-base)",flexShrink:0},headerInfo:{flex:1},name:{fontSize:17,fontWeight:700,color:"var(--text-bright)"},meta:{display:"flex",gap:10,marginTop:6,flexWrap:"wrap"},metaItem:{fontSize:11,color:"var(--text-dim)"},actionBar:{display:"flex",alignItems:"center",gap:8,padding:"12px 0",borderTop:"1px solid var(--border)",borderBottom:"1px solid var(--border)",marginBottom:16},installBtn:{flex:1,padding:"8px 16px",background:"var(--accent)",color:"var(--bg-base)",border:"none",borderRadius:6,fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},configureBtn:{flex:1,padding:"8px 16px",background:"var(--bg-active)",color:"var(--text-bright)",border:"1px solid var(--border)",borderRadius:6,fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},uninstallBtn:{padding:"8px 16px",background:"transparent",color:"var(--red)",border:"1px solid var(--red)",borderRadius:6,fontSize:12,fontWeight:500,cursor:"pointer",fontFamily:"var(--font)"},section:{marginBottom:16},sectionTitle:{fontSize:11,fontWeight:700,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:.5,marginBottom:8},description:{fontSize:12,color:"var(--text-primary)",lineHeight:1.6},tagRow:{display:"flex",gap:4,flexWrap:"wrap"},tag:{fontSize:10,padding:"2px 8px",borderRadius:4,background:"var(--bg-active)",color:"var(--text-dim)"},roleTag:{fontSize:10,padding:"2px 8px",borderRadius:4,background:"rgba(51, 175, 188, 0.08)",color:"var(--accent)",border:"1px solid rgba(51, 175, 188, 0.2)"},label:{display:"block",fontSize:11,fontWeight:600,color:"var(--text-primary)",marginBottom:4},input:{flex:1,padding:"7px 10px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:5,color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},saveBtn:{padding:"7px 14px",background:"var(--accent)",color:"var(--bg-base)",border:"none",borderRadius:5,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"}},K8=[{label:"Every 5 min",cron:"*/5 * * * *"},{label:"Every 15 min",cron:"*/15 * * * *"},{label:"Every hour",cron:"0 * * * *"},{label:"Every 6 hours",cron:"0 */6 * * *"},{label:"Daily 9 AM",cron:"0 9 * * *"},{label:"Weekdays 9 AM",cron:"0 9 * * 1-5"},{label:"Weekly (Mon)",cron:"0 0 * * 1"},{label:"Monthly",cron:"0 0 1 * *"}],J8=[{id:"backend",label:"Backend"},{id:"frontend",label:"Frontend"},{id:"fullstack",label:"Fullstack"},{id:"testing",label:"Testing"},{id:"devops",label:"DevOps"},{id:"docs",label:"Docs"},{id:"cmo",label:"CMO"},{id:"cfo",label:"CFO"},{id:"ea",label:"EA"},{id:"support",label:"Support"},{id:"analyst",label:"Analyst"}];function PE(t){if(!t)return"never";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}function EE({status:t}){const e={spawned:"var(--green)",skipped:"var(--amber)",error:"var(--red)"};return v.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:e[t]||"var(--text-muted)",display:"inline-block",marginRight:6}})}function eZ({onSubmit:t,onCancel:e}){const[i,n]=N.useState(""),[r,s]=N.useState("0 9 * * *"),[a,c]=N.useState("fullstack"),[h,d]=N.useState(""),[f,g]=N.useState(!1),[m,O]=N.useState("");async function S(_){if(_.preventDefault(),!i.trim()){O("Name is required");return}if(!h.trim()){O("Task prompt is required");return}g(!0),O("");try{await t({name:i.trim(),cron:r,agentConfig:{role:a,prompt:h.trim()}})}catch(w){O(w.message)}g(!1)}return v.jsxs("form",{onSubmit:S,style:Pe.form,children:[v.jsx("div",{style:Pe.formTitle,children:"New Schedule"}),v.jsx("label",{style:Pe.label,children:"NAME"}),v.jsx("input",{value:i,onChange:_=>n(_.target.value),placeholder:"e.g., Daily standup summary",style:Pe.input}),v.jsx("label",{style:Pe.label,children:"FREQUENCY"}),v.jsx("div",{style:Pe.presetRow,children:K8.map(_=>v.jsx("button",{type:"button",onClick:()=>s(_.cron),style:{...Pe.presetBtn,borderColor:r===_.cron?"var(--accent)":"var(--border)",color:r===_.cron?"var(--accent)":"var(--text-dim)",background:r===_.cron?"rgba(51, 175, 188, 0.08)":"transparent"},children:_.label},_.cron))}),v.jsx("input",{value:r,onChange:_=>s(_.target.value),placeholder:"* * * * * (min hr day mon wkday)",style:{...Pe.input,fontFamily:"var(--font)",fontSize:11}}),v.jsx("label",{style:Pe.label,children:"AGENT ROLE"}),v.jsx("div",{style:Pe.presetRow,children:J8.map(_=>v.jsx("button",{type:"button",onClick:()=>c(_.id),style:{...Pe.presetBtn,borderColor:a===_.id?"var(--accent)":"var(--border)",color:a===_.id?"var(--accent)":"var(--text-dim)",background:a===_.id?"rgba(51, 175, 188, 0.08)":"transparent"},children:_.label},_.id))}),v.jsx("label",{style:Pe.label,children:"TASK"}),v.jsx("textarea",{value:h,onChange:_=>d(_.target.value),placeholder:"What should this agent do each time it runs?",rows:3,style:Pe.textarea}),m&&v.jsx("div",{style:Pe.error,children:m}),v.jsxs("div",{style:Pe.formActions,children:[v.jsx("button",{type:"button",onClick:e,style:Pe.cancelBtn,children:"Cancel"}),v.jsx("button",{type:"submit",disabled:f,style:Pe.submitBtn,children:f?"Creating...":"Create Schedule"})]})]})}function tZ({schedule:t,onToggle:e,onRun:i,onDelete:n,onSelect:r}){var c;const[s,a]=N.useState(!1);return v.jsxs("div",{style:Pe.scheduleRow,onMouseEnter:h=>{h.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:h=>{h.currentTarget.style.background="var(--bg-surface)"},children:[v.jsxs("div",{style:Pe.scheduleMain,onClick:()=>r(t),children:[v.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:t.enabled?t.isRunning?"var(--green)":"var(--accent)":"var(--text-muted)",flexShrink:0,animation:t.isRunning?"pulse 2s infinite":"none"}}),v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{style:Pe.scheduleName,children:t.name}),v.jsxs("div",{style:Pe.scheduleMeta,children:[v.jsx("span",{children:t.cronDescription||t.cron}),v.jsx("span",{style:{color:"var(--text-muted)"},children:(c=t.agentConfig)==null?void 0:c.role}),t.lastRun&&v.jsxs("span",{style:{color:"var(--text-muted)"},children:[v.jsx(EE,{status:t.lastRun.status}),PE(t.lastRun.timestamp)]})]})]})]}),v.jsxs("div",{style:Pe.scheduleActions,children:[v.jsx("button",{onClick:()=>e(t.id,!t.enabled),title:t.enabled?"Disable":"Enable",style:{...Pe.actionBtn,color:t.enabled?"var(--green)":"var(--text-muted)"},children:t.enabled?"ON":"OFF"}),v.jsx("button",{onClick:()=>i(t.id),title:"Run now",style:{...Pe.actionBtn,color:"var(--accent)"},children:"▶"}),s?v.jsx("button",{onClick:()=>{n(t.id),a(!1)},style:{...Pe.actionBtn,color:"var(--red)"},children:"confirm"}):v.jsx("button",{onClick:()=>a(!0),style:{...Pe.actionBtn,color:"var(--text-muted)"},children:"✕"})]})]})}function iZ({schedule:t,onClose:e}){var i,n;return t?v.jsxs("div",{style:Pe.detailPanel,children:[v.jsxs("div",{style:Pe.detailHeader,children:[v.jsx("div",{style:Pe.detailTitle,children:t.name}),v.jsx("button",{onClick:e,style:Pe.detailClose,children:"×"})]}),v.jsxs("div",{style:Pe.detailGrid,children:[v.jsx("div",{style:Pe.detailLabel,children:"Cron"}),v.jsx("div",{style:Pe.detailValue,children:t.cron}),v.jsx("div",{style:Pe.detailLabel,children:"Description"}),v.jsx("div",{style:Pe.detailValue,children:t.cronDescription}),v.jsx("div",{style:Pe.detailLabel,children:"Role"}),v.jsx("div",{style:Pe.detailValue,children:(i=t.agentConfig)==null?void 0:i.role}),v.jsx("div",{style:Pe.detailLabel,children:"Status"}),v.jsx("div",{style:Pe.detailValue,children:v.jsx("span",{style:{color:t.enabled?"var(--green)":"var(--text-muted)"},children:t.enabled?"Enabled":"Disabled"})}),v.jsx("div",{style:Pe.detailLabel,children:"Created"}),v.jsx("div",{style:Pe.detailValue,children:new Date(t.createdAt).toLocaleString()})]}),((n=t.agentConfig)==null?void 0:n.prompt)&&v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:Pe.detailLabel,children:"Task Prompt"}),v.jsx("pre",{style:Pe.promptPre,children:t.agentConfig.prompt})]}),(t.history||[]).length>0&&v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:{...Pe.detailLabel,marginBottom:8},children:"Execution History"}),v.jsx("div",{style:Pe.historyList,children:t.history.slice(0,20).map((r,s)=>v.jsxs("div",{style:Pe.historyEntry,children:[v.jsx(EE,{status:r.status}),v.jsxs("span",{style:{fontSize:10,color:"var(--text-dim)",flex:1},children:[r.status,r.agentId&&v.jsxs("span",{style:{color:"var(--text-muted)"},children:[" (",r.agentId,")"]})]}),v.jsx("span",{style:{fontSize:9,color:"var(--text-muted)"},children:PE(r.timestamp)})]},s))})]})]}):null}function nZ(){const[t,e]=N.useState([]),[i,n]=N.useState(!0),[r,s]=N.useState(!1),[a,c]=N.useState(null),[h,d]=N.useState(""),f=N.useCallback(async()=>{try{const x=await fetch("/api/schedules");e(await x.json())}catch{}n(!1)},[]);N.useEffect(()=>{f();const x=setInterval(f,1e4);return()=>clearInterval(x)},[f]);async function g(x){const Q=await fetch("/api/schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!Q.ok){const k=await Q.json();throw new Error(k.error||"Failed to create schedule")}s(!1),await f(),w("Schedule created")}async function m(x,Q){await fetch(`/api/schedules/${x}/${Q?"enable":"disable"}`,{method:"POST"}),await f()}async function O(x){try{await fetch(`/api/schedules/${x}/run`,{method:"POST"}),w("Agent spawned"),await f()}catch{w("Failed to run")}}async function S(x){await fetch(`/api/schedules/${x}`,{method:"DELETE"}),(a==null?void 0:a.id)===x&&c(null),await f(),w("Schedule deleted")}async function _(x){try{const Q=await fetch(`/api/schedules/${x.id}`);c(await Q.json())}catch{c(x)}}function w(x){d(x),setTimeout(()=>d(""),3e3)}return v.jsxs("div",{style:Pe.root,children:[v.jsxs("div",{style:Pe.headerBar,children:[v.jsxs("div",{style:Pe.headerLeft,children:[v.jsx("div",{style:Pe.title,children:"Schedules"}),v.jsxs("span",{style:Pe.headerCount,children:[t.length," schedule",t.length!==1?"s":""," • ",t.filter(x=>x.enabled).length," active"]})]}),v.jsx("button",{onClick:()=>{s(!0),c(null)},style:Pe.createBtn,children:"+ New Schedule"})]}),h&&v.jsx("div",{style:Pe.statusMsg,children:h}),v.jsxs("div",{style:Pe.mainRow,children:[v.jsxs("div",{style:Pe.listArea,children:[r&&v.jsx(eZ,{onSubmit:g,onCancel:()=>s(!1)}),i&&t.length===0&&v.jsx("div",{style:Pe.empty,children:"Loading schedules..."}),!i&&t.length===0&&!r&&v.jsxs("div",{style:Pe.empty,children:[v.jsx("div",{style:{fontSize:13,marginBottom:8},children:"No schedules yet"}),v.jsx("div",{style:{fontSize:11,color:"var(--text-muted)"},children:"Create a schedule to run agents on a recurring basis — daily standups, weekly reports, monitoring checks."})]}),t.map(x=>v.jsx(tZ,{schedule:x,onToggle:m,onRun:O,onDelete:S,onSelect:_},x.id))]}),a&&v.jsx(iZ,{schedule:a,onClose:()=>c(null)})]})]})}const Pe={root:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},headerBar:{padding:"12px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},headerLeft:{display:"flex",alignItems:"center",gap:12},title:{fontSize:15,fontWeight:700,color:"var(--text-bright)",letterSpacing:.3},headerCount:{fontSize:11,color:"var(--text-muted)"},createBtn:{padding:"6px 14px",background:"var(--accent)",color:"var(--bg-base)",border:"none",borderRadius:6,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},statusMsg:{padding:"4px 20px",fontSize:10,color:"var(--green)",flexShrink:0},mainRow:{flex:1,display:"flex",overflow:"hidden"},listArea:{flex:1,overflowY:"auto",padding:"0 20px 20px"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--text-dim)",fontSize:12},scheduleRow:{display:"flex",alignItems:"center",padding:"10px 12px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6,marginBottom:4,cursor:"pointer",transition:"background 0.1s"},scheduleMain:{display:"flex",alignItems:"center",gap:10,flex:1,minWidth:0},scheduleName:{fontSize:12,fontWeight:600,color:"var(--text-bright)"},scheduleMeta:{display:"flex",gap:10,fontSize:10,color:"var(--text-dim)",marginTop:2},scheduleActions:{display:"flex",gap:4,flexShrink:0},actionBtn:{padding:"3px 8px",background:"transparent",border:"1px solid var(--border)",borderRadius:4,fontSize:9,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},form:{padding:"16px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:8,marginBottom:12},formTitle:{fontSize:13,fontWeight:700,color:"var(--text-bright)",marginBottom:12},label:{display:"block",fontSize:9,fontWeight:700,color:"var(--text-muted)",letterSpacing:.5,textTransform:"uppercase",marginTop:10,marginBottom:4},input:{width:"100%",padding:"7px 10px",background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:5,color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none",boxSizing:"border-box"},textarea:{width:"100%",padding:"7px 10px",background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:5,color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none",resize:"vertical",boxSizing:"border-box"},presetRow:{display:"flex",gap:4,flexWrap:"wrap",marginBottom:6},presetBtn:{padding:"3px 10px",background:"transparent",border:"1px solid var(--border)",borderRadius:10,fontSize:10,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer",transition:"all 0.1s"},error:{fontSize:11,color:"var(--red)",marginTop:8},formActions:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:14},cancelBtn:{padding:"6px 14px",background:"transparent",color:"var(--text-dim)",border:"1px solid var(--border)",borderRadius:5,fontSize:11,fontWeight:500,cursor:"pointer",fontFamily:"var(--font)"},submitBtn:{padding:"6px 14px",background:"var(--accent)",color:"var(--bg-base)",border:"none",borderRadius:5,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},detailPanel:{width:320,flexShrink:0,borderLeft:"1px solid var(--border)",padding:"16px",overflowY:"auto"},detailHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},detailTitle:{fontSize:14,fontWeight:700,color:"var(--text-bright)"},detailClose:{background:"none",border:"none",color:"var(--text-muted)",fontSize:18,cursor:"pointer",fontFamily:"var(--font)"},detailGrid:{display:"grid",gridTemplateColumns:"80px 1fr",gap:"6px 10px"},detailLabel:{fontSize:10,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase"},detailValue:{fontSize:11,color:"var(--text-primary)"},promptPre:{fontSize:11,color:"var(--text-primary)",lineHeight:1.5,padding:"8px 10px",background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:4,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font)",maxHeight:200,overflowY:"auto",marginTop:4},historyList:{display:"flex",flexDirection:"column",gap:4},historyEntry:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:4,background:"var(--bg-base)"}},h2={javascript:"#e5c07b",typescript:"#61afef",css:"#c678dd",html:"#e06c75",json:"#4ae168",markdown:"#c678dd",python:"#61afef",rust:"#e06c75",go:"#33afbc",shell:"#4ae168",text:"#abb2bf"};function RE({entry:t,depth:e,activeFile:i,expandedDirs:n,onToggleDir:r,onFileClick:s,onContextMenu:a,renamingPath:c,renameValue:h,onRenameChange:d,onRenameSubmit:f,onRenameCancel:g}){const m=t.type==="dir",O=n.has(t.path),S=!m&&t.path===i,_=c===t.path,x=Ce(Q=>Q.editorTreeCache)[t.path]||[];return v.jsxs(v.Fragment,{children:[v.jsxs("div",{onClick:()=>m?r(t.path,t.hasChildren):s(t.path),onContextMenu:Q=>a(Q,t),style:{...Ht.row,paddingLeft:12+e*16,background:S?"var(--bg-active)":"transparent",borderLeft:S?"2px solid var(--accent)":"2px solid transparent"},children:[m?v.jsx("span",{style:Ht.arrow,children:O?"▾":"▸"}):v.jsx("span",{style:{...Ht.fileDot,background:h2[t.language]||h2.text}}),_?v.jsx("input",{autoFocus:!0,value:h,onChange:Q=>d(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&f(),Q.key==="Escape"&&g()},onBlur:g,onClick:Q=>Q.stopPropagation(),style:Ht.renameInput}):v.jsx("span",{style:{...Ht.name,color:m?"var(--text-primary)":S?"var(--text-bright)":"var(--text-primary)",fontWeight:m?600:400},children:t.name}),!m&&!_&&t.size>0&&v.jsx("span",{style:Ht.size,children:rZ(t.size)})]}),m&&O&&x.map(Q=>v.jsx(RE,{entry:Q,depth:e+1,activeFile:i,expandedDirs:n,onToggleDir:r,onFileClick:s,onContextMenu:a,renamingPath:c,renameValue:h,onRenameChange:d,onRenameSubmit:f,onRenameCancel:g},Q.path))]})}function rZ(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(0)}K`:`${(t/(1024*1024)).toFixed(1)}M`}function sZ({x:t,y:e,entry:i,onClose:n,onAction:r}){const s=N.useRef(null);N.useEffect(()=>{const h=d=>{s.current&&!s.current.contains(d.target)&&n()};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]);const a=(i==null?void 0:i.type)==="dir",c=[{label:"New File",action:a?"newFileIn":"newFileSibling"},{label:"New Folder",action:a?"newDirIn":"newDirSibling"},{sep:!0},{label:"Rename",action:"rename"},{label:"Delete",action:"delete",danger:!0}];return v.jsx("div",{ref:s,style:{...Ht.contextMenu,left:t,top:e},children:c.map((h,d)=>h.sep?v.jsx("div",{style:Ht.contextSep},d):v.jsx("div",{onClick:()=>{r(h.action,i),n()},style:{...Ht.contextItem,color:h.danger?"var(--red)":"var(--text-primary)"},children:h.label},h.action))})}function u2({placeholder:t,onSubmit:e,onCancel:i,depth:n}){const[r,s]=N.useState("");return v.jsx("div",{style:{...Ht.row,paddingLeft:12+(n||0)*16},children:v.jsx("input",{autoFocus:!0,placeholder:t,value:r,onChange:a=>s(a.target.value),onKeyDown:a=>{a.key==="Enter"&&r.trim()&&e(r.trim()),a.key==="Escape"&&i()},onBlur:i,style:Ht.renameInput})})}function oZ(){const t=Ce(j=>j.editorTreeCache),e=Ce(j=>j.editorActiveFile),i=Ce(j=>j.fetchTreeDir),n=Ce(j=>j.openFile),r=Ce(j=>j.createFile),s=Ce(j=>j.createDir),a=Ce(j=>j.deleteFile),c=Ce(j=>j.renameFile),[h,d]=N.useState(new Set([""])),[f,g]=N.useState(""),[m,O]=N.useState(null),[S,_]=N.useState(null),[w,x]=N.useState(null),[Q,k]=N.useState("");N.useEffect(()=>{i("")},[i]);const T=N.useCallback((j,D)=>{d(E=>{const X=new Set(E);return X.has(j)?X.delete(j):(X.add(j),(D||!t[j])&&i(j)),X})},[i,t]),M=N.useCallback((j,D)=>{j.preventDefault(),j.stopPropagation(),O({x:j.clientX,y:j.clientY,entry:D})},[]),$=N.useCallback(async(j,D)=>{const E=D.path.includes("/")?D.path.split("/").slice(0,-1).join("/"):"";switch(j){case"newFileIn":_({type:"file",parentPath:D.path}),d(X=>{const P=new Set(X);return P.add(D.path),t[D.path]||i(D.path),P});break;case"newDirIn":_({type:"dir",parentPath:D.path}),d(X=>{const P=new Set(X);return P.add(D.path),t[D.path]||i(D.path),P});break;case"newFileSibling":_({type:"file",parentPath:E});break;case"newDirSibling":_({type:"dir",parentPath:E});break;case"rename":x(D.path),k(D.name);break;case"delete":confirm(`Delete "${D.name}"?`)&&await a(D.path);break}},[a,i,t]),R=N.useCallback(async j=>{if(!S)return;const D=S.parentPath?`${S.parentPath}/${j}`:j,E=S.type==="file"?await r(D):await s(D);_(null),E&&S.type==="file"&&n(D)},[S,r,s,n]),V=N.useCallback(async()=>{if(!w||!Q.trim()){x(null);return}const j=w.includes("/")?w.split("/").slice(0,-1).join("/"):"",D=j?`${j}/${Q.trim()}`:Q.trim();D!==w&&await c(w,D),x(null)},[w,Q,c]),H=N.useCallback(j=>{j.target===j.currentTarget&&(j.preventDefault(),O({x:j.clientX,y:j.clientY,entry:{type:"dir",path:"",name:"root"}}))},[]),ee=t[""]||[],I=f?ee.filter(j=>j.name.toLowerCase().includes(f.toLowerCase())):ee;return S&&(S.parentPath===""||S.parentPath.split("/").length),v.jsxs("div",{style:Ht.container,children:[v.jsxs("div",{style:Ht.toolbar,children:[v.jsx("span",{style:Ht.toolbarTitle,children:"FILES"}),v.jsxs("div",{style:Ht.toolbarActions,children:[v.jsx("button",{onClick:()=>_({type:"file",parentPath:""}),title:"New File",style:Ht.toolbarBtn,children:v.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[v.jsx("path",{d:"M3 1.5h6l4 4V14a.5.5 0 01-.5.5h-9A.5.5 0 013 14V2a.5.5 0 01.5-.5z"}),v.jsx("path",{d:"M9 1.5V5.5h4"}),v.jsx("path",{d:"M8 8.5v4M6 10.5h4",strokeLinecap:"round"})]})}),v.jsx("button",{onClick:()=>_({type:"dir",parentPath:""}),title:"New Folder",style:Ht.toolbarBtn,children:v.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[v.jsx("path",{d:"M1.5 3.5h4l1.5 1.5H14a.5.5 0 01.5.5v8a.5.5 0 01-.5.5H2a.5.5 0 01-.5-.5V4z"}),v.jsx("path",{d:"M8 8v3M6.5 9.5h3",strokeLinecap:"round"})]})})]})]}),v.jsx("div",{style:Ht.searchWrap,children:v.jsx("input",{type:"text",placeholder:"Filter...",value:f,onChange:j=>g(j.target.value),style:Ht.searchInput})}),v.jsxs("div",{style:Ht.tree,onContextMenu:H,children:[I.length===0&&!S&&v.jsx("div",{style:Ht.empty,children:ee.length===0?"Loading...":"No matches"}),S&&S.parentPath===""&&v.jsx(u2,{placeholder:S.type==="file"?"filename.ext":"folder-name",onSubmit:R,onCancel:()=>_(null),depth:0}),I.map(j=>v.jsxs(Ul.Fragment,{children:[v.jsx(RE,{entry:j,depth:0,activeFile:e,expandedDirs:h,onToggleDir:T,onFileClick:n,onContextMenu:M,renamingPath:w,renameValue:Q,onRenameChange:k,onRenameSubmit:V,onRenameCancel:()=>x(null)}),S&&S.parentPath===j.path&&h.has(j.path)&&v.jsx(u2,{placeholder:S.type==="file"?"filename.ext":"folder-name",onSubmit:R,onCancel:()=>_(null),depth:1})]},j.path))]}),m&&v.jsx(sZ,{x:m.x,y:m.y,entry:m.entry,onClose:()=>O(null),onAction:$})]})}const Ht={container:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-chrome)",position:"relative"},toolbar:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",borderBottom:"1px solid var(--border)"},toolbarTitle:{fontSize:10,fontWeight:700,letterSpacing:1,color:"var(--text-dim)",textTransform:"uppercase"},toolbarActions:{display:"flex",gap:2},toolbarBtn:{background:"none",border:"none",color:"var(--text-dim)",fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)",padding:"2px 5px",borderRadius:3,lineHeight:1},searchWrap:{padding:"6px 8px",borderBottom:"1px solid var(--border)"},searchInput:{width:"100%",padding:"5px 8px",background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:3,color:"var(--text-primary)",fontSize:11,fontFamily:"var(--font)",outline:"none"},tree:{flex:1,overflowY:"auto",overflowX:"hidden"},row:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",cursor:"pointer",transition:"background 0.08s",whiteSpace:"nowrap"},arrow:{fontSize:10,color:"var(--text-muted)",width:10,flexShrink:0,textAlign:"center"},fileDot:{width:6,height:6,borderRadius:"50%",flexShrink:0},name:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},size:{fontSize:9,color:"var(--text-muted)",flexShrink:0},empty:{padding:16,textAlign:"center",fontSize:11,color:"var(--text-dim)"},renameInput:{flex:1,padding:"2px 6px",background:"var(--bg-base)",border:"1px solid var(--accent)",borderRadius:2,color:"var(--text-bright)",fontSize:12,fontFamily:"var(--font)",outline:"none",minWidth:0},contextMenu:{position:"fixed",zIndex:300,background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:4,padding:"4px 0",minWidth:160,boxShadow:"0 8px 24px rgba(0,0,0,0.4)",fontFamily:"var(--font)"},contextItem:{padding:"6px 14px",fontSize:11,cursor:"pointer",transition:"background 0.08s"},contextSep:{height:1,background:"var(--border)",margin:"4px 0"}};function aZ(){const t=Ce(s=>s.editorOpenTabs),e=Ce(s=>s.editorActiveFile),i=Ce(s=>s.editorFiles),n=Ce(s=>s.setActiveFile),r=Ce(s=>s.closeFile);return t.length===0?null:v.jsx("div",{style:Bh.container,children:t.map(s=>{const a=i[s],c=s===e,h=a&&a.content!==a.originalContent,d=s.split("/").pop();return v.jsxs("div",{onClick:()=>n(s),title:s,style:{...Bh.tab,color:c?"var(--text-bright)":"var(--text-primary)",borderBottom:c?"1px solid var(--accent)":"1px solid transparent",background:c?"var(--bg-base)":"transparent"},children:[h&&v.jsx("span",{style:Bh.dirtyDot}),v.jsx("span",{style:Bh.tabName,children:d}),v.jsx("button",{onClick:f=>{f.stopPropagation(),r(s)},style:Bh.closeBtn,children:"x"})]},s)})})}const Bh={container:{display:"flex",alignItems:"center",height:32,flexShrink:0,background:"var(--bg-chrome)",borderBottom:"1px solid var(--border)",overflowX:"auto",overflowY:"hidden"},tab:{display:"flex",alignItems:"center",gap:5,padding:"0 12px",height:"100%",cursor:"pointer",whiteSpace:"nowrap",fontSize:11,fontFamily:"var(--font)",transition:"background 0.08s",borderRight:"1px solid rgba(75, 82, 99, 0.4)",flexShrink:0},tabName:{overflow:"hidden",textOverflow:"ellipsis",maxWidth:140},dirtyDot:{width:6,height:6,borderRadius:"50%",background:"var(--amber)",flexShrink:0},closeBtn:{background:"none",border:"none",color:"var(--text-muted)",fontSize:10,cursor:"pointer",fontFamily:"var(--font)",padding:"0 2px",lineHeight:1,opacity:.6}};let By=[],AE=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,i=0;e<t.length;e++)(e%2?AE:By).push(i=i+t[e])})();function lZ(t){if(t<768)return!1;for(let e=0,i=By.length;;){let n=e+i>>1;if(t<By[n])i=n;else if(t>=AE[n])e=n+1;else return!0;if(e==i)return!1}}function d2(t){return t>=127462&&t<=127487}const f2=8205;function cZ(t,e,i=!0,n=!0){return(i?ME:hZ)(t,e,n)}function ME(t,e,i){if(e==t.length)return e;e&&zE(t.charCodeAt(e))&&jE(t.charCodeAt(e-1))&&e--;let n=mv(t,e);for(e+=p2(n);e<t.length;){let r=mv(t,e);if(n==f2||r==f2||i&&lZ(r))e+=p2(r),n=r;else if(d2(r)){let s=0,a=e-2;for(;a>=0&&d2(mv(t,a));)s++,a-=2;if(s%2==0)break;e+=2}else break}return e}function hZ(t,e,i){for(;e>0;){let n=ME(t,e-2,i);if(n<e)return n;e--}return 0}function mv(t,e){let i=t.charCodeAt(e);if(!jE(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return zE(n)?(i-55296<<10)+(n-56320)+65536:i}function zE(t){return t>=56320&&t<57344}function jE(t){return t>=55296&&t<56320}function p2(t){return t<65536?1:2}let dt=class DE{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,i,n){[e,i]=_c(this,e,i);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(i,this.length,r,1),Br.from(r,this.length-(i-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=_c(this,e,i);let n=[];return this.decompose(e,i,n,0),Br.from(n,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new uu(this),s=new uu(e);for(let a=i,c=i;;){if(r.next(a),s.next(a),a=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(c+=r.value.length,r.done||c>=n)return!0}}iter(e=1){return new uu(this,e)}iterRange(e,i=this.length){return new BE(this,e,i)}iterLines(e,i){let n;if(e==null)n=this.iter();else{i==null&&(i=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new LE(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?DE.empty:e.length<=32?new Ut(e):Br.from(Ut.split(e,[]))}};class Ut extends dt{constructor(e,i=uZ(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,n,r){for(let s=0;;s++){let a=this.text[s],c=r+a.length;if((i?n:c)>=e)return new dZ(r,c,n,a);r=c+1,n++}}decompose(e,i,n,r){let s=e<=0&&i>=this.length?this:new Ut(g2(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(r&1){let a=n.pop(),c=jp(s.text,a.text.slice(),0,s.length);if(c.length<=32)n.push(new Ut(c,a.length+s.length));else{let h=c.length>>1;n.push(new Ut(c.slice(0,h)),new Ut(c.slice(h)))}}else n.push(s)}replace(e,i,n){if(!(n instanceof Ut))return super.replace(e,i,n);[e,i]=_c(this,e,i);let r=jp(this.text,jp(n.text,g2(this.text,0,e)),i),s=this.length+n.length-(i-e);return r.length<=32?new Ut(r,s):Br.from(Ut.split(r,[]),s)}sliceString(e,i=this.length,n=`
73
+ `)||null:e.type==="text"&&e.text?e.text:e.type==="result"&&e.result?e.result:null}catch{return t.length>5?t:null}}function f8(t,e){const i=[];for(const n of t)i.push({timestamp:n.timestamp,from:n.from,text:n.text,isQuery:n.isQuery});for(const n of e.slice(-30)){const r=d8(n.text);if(!r||r.trimStart().startsWith("[")||r.trimStart().startsWith("{"))continue;i.some(a=>Math.abs(a.timestamp-n.timestamp)<2e3&&a.from==="agent")||i.push({timestamp:n.timestamp,from:"agent",text:r.slice(0,2e3)})}return i.sort((n,r)=>n.timestamp-r.timestamp),i}const At={container:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},timeline:{flex:1,overflowY:"auto",padding:"10px 0"},hint:{color:"var(--text-dim)",fontSize:11,padding:"20px 4px",textAlign:"center",lineHeight:1.6},entry:{padding:"4px 0",position:"relative"},userMsg:{display:"flex",flexDirection:"column",gap:2},userLabel:{fontSize:10,fontWeight:600,color:"var(--accent)",textTransform:"uppercase",letterSpacing:.5},userText:{fontSize:12,color:"var(--text-bright)",lineHeight:1.5,padding:"4px 8px",background:"var(--bg-surface)",borderRadius:2,border:"1px solid var(--border)",whiteSpace:"pre-wrap",wordBreak:"break-word"},agentMsg:{display:"flex",flexDirection:"column",gap:2},agentLabel:{fontSize:10,fontWeight:600,color:"var(--green)",textTransform:"uppercase",letterSpacing:.5},agentText:{fontSize:12,color:"var(--text-primary)",lineHeight:1.5,padding:"4px 8px",background:"var(--bg-base)",borderRadius:2,whiteSpace:"pre-wrap",wordBreak:"break-word"},systemMsg:{fontSize:10,color:"var(--text-dim)",fontStyle:"italic",padding:"2px 0"},time:{position:"absolute",top:4,right:0,fontSize:9,color:"var(--text-muted)"},statusMsg:{fontSize:11,color:"var(--text-dim)",fontStyle:"italic",padding:"6px 0"},inputRow:{display:"flex",gap:6,padding:"8px 0 0",borderTop:"1px solid var(--border)"},input:{flex:1,background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"8px 10px",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},sendBtn:{padding:"8px 14px",background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:11,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},cursor:{color:"var(--accent)",fontWeight:400,animation:"pulse 1s infinite",marginLeft:1},launchBox:{padding:"8px 0",borderTop:"1px solid var(--border)",flexShrink:0},launchHeader:{fontSize:10,fontWeight:700,color:"var(--text-bright)",marginBottom:6},launchList:{display:"flex",flexDirection:"column",gap:3,marginBottom:8},launchAgent:{display:"flex",alignItems:"baseline",gap:6,fontSize:10,padding:"2px 0"},launchRole:{fontWeight:600,color:"var(--accent)",minWidth:60},launchPrompt:{color:"var(--text-dim)",fontSize:9,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},launchBtn:{width:"100%",padding:"8px",background:"rgba(51, 175, 188, 0.1)",border:"1px solid var(--accent)",color:"var(--accent)",fontSize:11,fontWeight:700,fontFamily:"var(--font)",cursor:"pointer",letterSpacing:.5}};function p8({agent:t}){var h;const e=Ce(d=>d.activityLog),i=Ce(d=>d.tokenTimeline),n=e[t.id]||[],r=i[t.id]||[],s=Math.round((t.contextUsage||0)*100),a=t.spawnedAt?O8(Date.now()-new Date(t.spawnedAt).getTime()):"-",c=t.spawnedAt&&t.tokensUsed>0?Math.round(t.tokensUsed/((Date.now()-new Date(t.spawnedAt).getTime())/6e4)):0;return v.jsxs("div",{style:ni.container,children:[v.jsxs("div",{style:ni.metricsGrid,children:[v.jsx(Kf,{label:"Tokens",value:((h=t.tokensUsed)==null?void 0:h.toLocaleString())||"0"}),v.jsx(Kf,{label:"Burn Rate",value:`${c}/min`}),v.jsx(Kf,{label:"Uptime",value:a}),v.jsx(Kf,{label:"Activity",value:`${n.length} events`})]}),v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:ni.sectionLabel,children:"TOKEN HEARTBEAT"}),v.jsx(g8,{data:r,isAlive:t.status==="running"})]}),v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:ni.sectionLabel,children:"CONTEXT USAGE"}),v.jsxs("div",{style:ni.gaugeRow,children:[v.jsx("div",{style:ni.gaugeTrack,children:v.jsx("div",{style:{height:"100%",width:`${s}%`,borderRadius:1,background:s>80?"var(--red)":s>60?"var(--amber)":"var(--green)",transition:"width 0.3s"}})}),v.jsxs("span",{style:ni.gaugeLabel,children:[s,"%"]})]})]}),v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:ni.sectionLabel,children:"ACTIVITY PULSE"}),v.jsx(m8,{activity:n})]}),v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:ni.sectionLabel,children:"DETAILS"}),v.jsxs("div",{style:ni.infoList,children:[v.jsx(So,{label:"ID",value:t.id}),v.jsx(So,{label:"Role",value:t.role}),v.jsx(So,{label:"Provider",value:t.provider}),v.jsx(So,{label:"Model",value:t.model||"default"}),t.workingDir&&v.jsx(So,{label:"Directory",value:t.workingDir}),v.jsx(So,{label:"Scope",value:(t.scope||[]).join(", ")||"unrestricted"}),v.jsx(So,{label:"Spawned",value:t.spawnedAt?new Date(t.spawnedAt).toLocaleTimeString():"-"}),v.jsx(So,{label:"Last Active",value:t.lastActivity?new Date(t.lastActivity).toLocaleTimeString():"-"})]})]}),t.prompt&&v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:ni.sectionLabel,children:"ORIGINAL PROMPT"}),v.jsx("div",{style:ni.promptBox,children:t.prompt})]}),v.jsxs("div",{style:{marginTop:16},children:[v.jsxs("div",{style:ni.sectionLabel,children:["RECENT LOG (",n.length,")"]}),v.jsxs("div",{style:ni.logScroll,children:[n.length===0&&v.jsx("div",{style:{color:"var(--text-dim)",fontSize:11,padding:8},children:"No activity yet..."}),n.slice(-30).reverse().map((d,f)=>{var g;return v.jsxs("div",{style:ni.logEntry,children:[v.jsx("span",{style:ni.logTime,children:new Date(d.timestamp).toLocaleTimeString()}),v.jsx("span",{style:ni.logText,children:(g=d.text)==null?void 0:g.slice(0,200)})]},f)})]})]})]})}function g8({data:t,isAlive:e}){const i=N.useRef();return N.useEffect(()=>{const n=i.current;if(!n)return;const r=n.getContext("2d"),s=n.width,a=n.height;r.clearRect(0,0,s,a),r.strokeStyle="#3e4451",r.lineWidth=.5;for(let O=0;O<a;O+=a/4)r.beginPath(),r.moveTo(0,O),r.lineTo(s,O),r.stroke();if(t.length<2){r.strokeStyle=e?"#5c6370":"#3e4451",r.lineWidth=1,r.beginPath(),r.moveTo(0,a/2),r.lineTo(s,a/2),r.stroke(),e&&(r.fillStyle="#5c6370",r.font="10px monospace",r.fillText("waiting for data...",8,a/2-6));return}const c=t.map(O=>O.v),h=Math.min(...c),d=Math.max(...c),f=d-h||1,g=[];for(let O=1;O<c.length;O++){const S=c[O]-c[O-1];S>f*.2&&S>0&&g.push(O)}const m=r.createLinearGradient(0,0,0,a);m.addColorStop(0,e?"rgba(51, 175, 188, 0.15)":"rgba(92, 99, 112, 0.1)"),m.addColorStop(1,"transparent"),r.beginPath(),r.moveTo(0,a);for(let O=0;O<t.length;O++){const S=O/(t.length-1)*s,_=a-4-(c[O]-h)/f*(a-8);r.lineTo(S,_)}r.lineTo(s,a),r.closePath(),r.fillStyle=m,r.fill(),r.strokeStyle=e?"#33afbc":"#5c6370",r.lineWidth=1.5,r.beginPath();for(let O=0;O<t.length;O++){const S=O/(t.length-1)*s,_=a-4-(c[O]-h)/f*(a-8);O===0?r.moveTo(S,_):r.lineTo(S,_)}r.stroke();for(const O of g){const S=O/(t.length-1)*s,_=a-4-(c[O]-h)/f*(a-8);r.fillStyle="#e5c07b",r.beginPath(),r.arc(S,_,3,0,Math.PI*2),r.fill()}if(e&&t.length>0){const O=s,S=a-4-(c[c.length-1]-h)/f*(a-8);r.fillStyle="#33afbc",r.beginPath(),r.arc(O-2,S,3,0,Math.PI*2),r.fill()}r.fillStyle="#5c6370",r.font="9px monospace",r.fillText(d.toLocaleString(),4,10),r.fillText(h.toLocaleString(),4,a-2)},[t,e]),v.jsx("div",{style:ni.chartContainer,children:v.jsx("canvas",{ref:i,width:400,height:60,style:{width:"100%",height:60,display:"block"}})})}function m8({activity:t}){const i=Date.now(),n=300*1e3,r=n/40,s=new Array(40).fill(0);for(const h of t){const d=i-h.timestamp;if(d>n)continue;const f=Math.min(Math.floor((n-d)/r),39);s[f]++}const a=Math.max(...s,1),c=s.map((h,d)=>{const f=d/39*300,g=28-h/a*24;return`${f},${g}`}).join(" ");return v.jsx("div",{style:ni.chartContainer,children:v.jsxs("svg",{width:"100%",height:"32",viewBox:"0 0 300 32",preserveAspectRatio:"none",style:{display:"block"},children:[v.jsx("polyline",{points:c,fill:"none",stroke:"var(--green)",strokeWidth:"1",opacity:"0.6"}),v.jsx("line",{x1:"0",y1:"31",x2:"300",y2:"31",stroke:"var(--text-muted)",strokeWidth:"0.5"})]})})}function Kf({label:t,value:e}){return v.jsxs("div",{style:ni.metric,children:[v.jsx("div",{style:{fontSize:14,fontWeight:700,color:"var(--text-bright)"},children:e}),v.jsx("div",{style:{fontSize:10,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1},children:t})]})}function So({label:t,value:e}){return v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"3px 0"},children:[v.jsx("span",{style:{color:"var(--text-dim)",fontSize:11},children:t}),v.jsx("span",{style:{color:"var(--text-primary)",fontSize:11,maxWidth:"65%",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function O8(t){const e=Math.floor(t/1e3),i=Math.floor(e/60),n=Math.floor(i/60);return n>0?`${n}h ${i%60}m`:i>0?`${i}m ${e%60}s`:`${e}s`}const ni={container:{flex:1,overflowY:"auto",padding:"10px 0"},metricsGrid:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6},metric:{background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:10,textAlign:"center"},sectionLabel:{fontSize:11,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5,marginBottom:6,fontWeight:600},gaugeRow:{display:"flex",alignItems:"center",gap:8},gaugeTrack:{flex:1,height:4,background:"var(--text-muted)",borderRadius:2,overflow:"hidden"},gaugeLabel:{fontSize:12,color:"var(--text-primary)",fontWeight:600,minWidth:36,textAlign:"right"},chartContainer:{background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",overflow:"hidden"},infoList:{borderTop:"1px solid var(--border)",paddingTop:6},promptBox:{background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,padding:8,fontSize:12,color:"var(--text-primary)",lineHeight:1.5,whiteSpace:"pre-wrap"},logScroll:{maxHeight:160,overflowY:"auto",background:"var(--bg-base)",borderRadius:2,border:"1px solid var(--border)"},logEntry:{padding:"3px 8px",borderBottom:"1px solid var(--bg-surface)",fontSize:10,display:"flex",gap:6},logTime:{color:"var(--text-dim)",whiteSpace:"nowrap"},logText:{color:"var(--text-primary)",wordBreak:"break-word"}};function v8({agent:t}){const e=Ce(B=>B.killAgent),i=Ce(B=>B.rotateAgent),n=Ce(B=>B.spawnAgent),r=Ce(B=>B.instructAgent),s=Ce(B=>B.showStatus),a=Ce(B=>B.closeDetail),[c,h]=N.useState(!1),[d,f]=N.useState(!1),[g,m]=N.useState(""),[O,S]=N.useState(!1),[_,w]=N.useState(t.model||""),[x,Q]=N.useState([]),[k,T]=N.useState([]),[M,$]=N.useState(!1),R=t.status==="running"||t.status==="starting";N.useEffect(()=>{fetch("/api/providers").then(B=>B.json()).then(Q).catch(()=>{}),fetch("/api/skills/installed").then(B=>B.json()).then(T).catch(()=>{})},[]);const V=x.find(B=>B.id===t.provider),H=(V==null?void 0:V.models)||[];async function ee(){try{await i(t.id)}catch(B){s(`rotate failed: ${B.message}`)}}async function I(){if(!c){h(!0),setTimeout(()=>h(!1),3e3);return}try{await e(t.id),s(`${t.name} killed`)}catch(B){s(`kill failed: ${B.message}`)}h(!1)}async function j(){if(!d){f(!0),setTimeout(()=>f(!1),3e3);return}try{await e(t.id,!0),a(),s(`${t.name} deleted`)}catch(B){s(`delete failed: ${B.message}`)}f(!1)}async function D(B){try{await fetch(`/api/agents/${t.id}/skills/${B}`,{method:"POST"}),s(`skill attached to ${t.name}`)}catch(G){s(`attach failed: ${G.message}`)}}async function E(B){try{await fetch(`/api/agents/${t.id}/skills/${B}`,{method:"DELETE"}),s(`skill detached from ${t.name}`)}catch(G){s(`detach failed: ${G.message}`)}}async function X(){try{const B=await n({role:t.role,scope:t.scope,prompt:t.prompt,provider:t.provider,model:t.model,skills:t.skills});s(`cloned as ${B.name}`)}catch(B){s(`clone failed: ${B.message}`)}}async function P(B){w(B);try{await fetch(`/api/agents/${t.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:B||null})}),s(`model set to ${B||"default"} (takes effect on next rotation)`)}catch(G){s(`model change failed: ${G.message}`)}}async function Z(){if(g.trim())try{await r(t.id,g.trim()),S(!1),m("")}catch(B){s(`prompt update failed: ${B.message}`)}}async function L(){try{await e(t.id,!0);const B=await n({role:t.role,scope:t.scope,prompt:t.prompt,provider:t.provider,model:t.model,skills:t.skills});s(`restarted as ${B.name}`)}catch(B){s(`restart failed: ${B.message}`)}}return v.jsxs("div",{style:pt.container,children:[v.jsx("div",{style:pt.sectionLabel,children:"LIFECYCLE"}),v.jsxs("div",{style:pt.btnGrid,children:[R&&v.jsxs(v.Fragment,{children:[v.jsx(jh,{icon:"~",label:"Rotate",desc:"Fresh context + handoff brief",onClick:ee,color:"var(--accent)"}),v.jsx(jh,{icon:"||",label:c?"Confirm Kill":"Stop",desc:"Stop the agent process",onClick:I,color:c?"var(--red)":"var(--amber)"})]}),!R&&v.jsx(jh,{icon:">",label:"Restart",desc:"Spawn fresh with same config",onClick:L,color:"var(--green)"}),v.jsx(jh,{icon:"+",label:"Clone",desc:"Spawn duplicate agent",onClick:X,color:"var(--accent)"}),v.jsx(jh,{icon:"x",label:d?"Confirm Delete":"Delete",desc:"Kill and remove permanently",onClick:j,color:d?"var(--red)":"var(--text-dim)"})]}),v.jsxs("div",{style:{...pt.sectionLabel,marginTop:20},children:["MODEL ",t.routingMode==="auto"&&v.jsx("span",{style:{color:"var(--accent)",fontWeight:400,textTransform:"none"},children:" — auto-routed"})]}),v.jsxs("select",{style:pt.select,value:_,onChange:B=>P(B.target.value),children:[v.jsx("option",{value:"",children:"Default"}),H.map(B=>v.jsxs("option",{value:B.id,children:[B.name," (",B.tier,")"]},B.id))]}),v.jsx("div",{style:pt.fieldHint,children:"Changes take effect on next rotation"}),v.jsx("div",{style:{...pt.sectionLabel,marginTop:20},children:"PROMPT"}),t.prompt&&!O&&v.jsxs("div",{style:pt.currentPrompt,children:[v.jsx("div",{style:pt.promptText,children:t.prompt}),R&&v.jsx("button",{onClick:()=>{S(!0),m("")},style:pt.editBtn,children:"Send New Instruction"})]}),!t.prompt&&!O&&v.jsx("div",{style:pt.noPrompt,children:"No prompt set"}),O&&v.jsxs("div",{children:[v.jsx("textarea",{style:pt.textarea,value:g,onChange:B=>m(B.target.value),placeholder:"New instruction for this agent...",rows:4,autoFocus:!0}),v.jsxs("div",{style:{display:"flex",gap:6,marginTop:6},children:[v.jsx("button",{onClick:Z,style:pt.saveBtn,disabled:!g.trim(),children:"Send (rotates agent)"}),v.jsx("button",{onClick:()=>S(!1),style:pt.cancelBtn,children:"Cancel"})]})]}),v.jsxs("div",{style:{...pt.sectionLabel,marginTop:20},children:["SKILLS (",(t.skills||[]).length,")"]}),(t.skills||[]).length>0?v.jsx("div",{style:pt.skillsList,children:(t.skills||[]).map(B=>{const G=k.find(z=>z.id===B);return v.jsxs("div",{style:pt.skillRow,children:[v.jsx("span",{style:pt.skillRowIcon,children:(G==null?void 0:G.icon)||B.charAt(0).toUpperCase()}),v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{style:{fontSize:11,color:"var(--text-primary)",fontWeight:500},children:(G==null?void 0:G.name)||B}),v.jsx("div",{style:{fontSize:9,color:"var(--text-muted)"},children:(G==null?void 0:G.author)||"unknown"})]}),v.jsx("button",{onClick:()=>E(B),style:pt.detachBtn,title:"Detach skill",children:"✕"})]},B)})}):v.jsx("div",{style:pt.noPrompt,children:"No skills attached"}),!M&&k.length>0&&v.jsx("button",{onClick:()=>$(!0),style:{...pt.editBtn,marginTop:6},children:"+ Attach Skill"}),M&&v.jsxs("div",{style:pt.skillPicker,children:[k.filter(B=>!(t.skills||[]).includes(B.id)).map(B=>v.jsxs("button",{onClick:()=>{D(B.id),$(!1)},style:pt.skillPickerItem,children:[v.jsx("span",{style:pt.skillRowIcon,children:B.icon||B.name.charAt(0)}),v.jsxs("div",{style:{flex:1},children:[v.jsx("div",{style:{fontSize:11,color:"var(--text-primary)"},children:B.name}),v.jsx("div",{style:{fontSize:9,color:"var(--text-muted)"},children:B.author})]})]},B.id)),k.filter(B=>!(t.skills||[]).includes(B.id)).length===0&&v.jsx("div",{style:{fontSize:10,color:"var(--text-dim)",padding:8},children:"All installed skills are already attached"}),v.jsx("button",{onClick:()=>$(!1),style:pt.cancelBtn,children:"cancel"})]}),v.jsx("div",{style:{...pt.sectionLabel,marginTop:20},children:"CONFIGURATION"}),v.jsx(Wl,{label:"ID",value:t.id}),v.jsx(Wl,{label:"Role",value:t.role}),v.jsx(Wl,{label:"Provider",value:t.provider}),v.jsx(Wl,{label:"Model",value:t.routingMode==="auto"?`auto (${t.model||"pending"})`:t.model||"default"}),v.jsx(Wl,{label:"Scope",value:(t.scope||[]).join(", ")||"unrestricted"}),v.jsx(Wl,{label:"Status",value:t.status})]})}function jh({icon:t,label:e,desc:i,onClick:n,color:r}){return v.jsxs("button",{onClick:n,style:{...pt.actionBtn,borderColor:r},children:[v.jsx("span",{style:{...pt.actionIcon,color:r},children:t}),v.jsxs("div",{children:[v.jsx("div",{style:pt.actionTitle,children:e}),v.jsx("div",{style:pt.actionDesc,children:i})]})]})}function Wl({label:t,value:e}){return v.jsxs("div",{style:pt.configRow,children:[v.jsx("span",{style:{color:"var(--text-dim)",fontSize:11,minWidth:60},children:t}),v.jsx("span",{style:{color:"var(--text-primary)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}const pt={container:{flex:1,overflowY:"auto",padding:"10px 0"},sectionLabel:{fontSize:11,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5,marginBottom:8,fontWeight:600},btnGrid:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4},actionBtn:{display:"flex",alignItems:"center",gap:8,padding:"8px 10px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,cursor:"pointer",textAlign:"left",fontFamily:"var(--font)"},actionIcon:{fontSize:14,fontWeight:700,width:18,textAlign:"center",flexShrink:0},actionTitle:{fontSize:11,color:"var(--text-primary)",fontWeight:600},actionDesc:{fontSize:9,color:"var(--text-dim)",marginTop:1},select:{width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},fieldHint:{fontSize:10,color:"var(--text-muted)",marginTop:4},currentPrompt:{},promptText:{background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,padding:8,fontSize:12,color:"var(--text-primary)",lineHeight:1.5,whiteSpace:"pre-wrap",maxHeight:100,overflowY:"auto"},noPrompt:{fontSize:12,color:"var(--text-dim)",fontStyle:"italic"},editBtn:{marginTop:6,padding:"4px 10px",background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:11,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},textarea:{width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none",resize:"vertical"},saveBtn:{flex:1,padding:"6px",background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:11,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},cancelBtn:{padding:"6px 12px",background:"transparent",border:"1px solid var(--border)",borderRadius:2,color:"var(--text-dim)",fontSize:11,fontFamily:"var(--font)",cursor:"pointer"},configRow:{display:"flex",gap:8,padding:"3px 0",borderBottom:"1px solid var(--bg-surface)"},skillsList:{display:"flex",flexDirection:"column",gap:3},skillRow:{display:"flex",alignItems:"center",gap:8,padding:"5px 8px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2},skillRowIcon:{width:20,height:20,borderRadius:4,background:"var(--accent)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:9,fontWeight:700,color:"var(--bg-base)",flexShrink:0},detachBtn:{background:"none",border:"none",color:"var(--text-muted)",fontSize:11,cursor:"pointer",fontFamily:"var(--font)",padding:"2px 4px",flexShrink:0},skillPicker:{marginTop:6,padding:6,background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,display:"flex",flexDirection:"column",gap:2,maxHeight:180,overflowY:"auto"},skillPickerItem:{display:"flex",alignItems:"center",gap:8,padding:"5px 8px",width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,cursor:"pointer",textAlign:"left",fontFamily:"var(--font)",transition:"border-color 0.1s"}},y8=[{id:"chat",label:"Chat"},{id:"stats",label:"Stats"},{id:"actions",label:"Actions"}],S8={running:"var(--green)",starting:"var(--amber)",stopped:"var(--text-dim)",crashed:"var(--red)",completed:"var(--accent)",killed:"var(--text-dim)"};function b8(){const[t,e]=N.useState("chat"),i=Ce(c=>c.detailPanel),r=Ce(c=>c.agents).find(c=>c.id===(i==null?void 0:i.agentId));if(!r)return v.jsx("div",{style:bo.empty,children:"Agent not found"});const s=S8[r.status]||"var(--text-dim)",a=r.status==="running"||r.status==="starting";return v.jsxs("div",{style:bo.container,children:[v.jsxs("div",{style:bo.agentHeader,children:[v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[v.jsx("div",{style:{width:6,height:6,borderRadius:"50%",background:s,animation:a?"pulse 2s infinite":"none"}}),v.jsx("span",{style:bo.agentName,children:r.name}),v.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,color:s,padding:"1px 6px",borderRadius:2,background:`color-mix(in srgb, ${s} 12%, transparent)`},children:r.status})]}),v.jsxs("span",{style:bo.agentMeta,children:[r.role," / ",r.provider]})]}),v.jsx("div",{style:bo.tabBar,children:y8.map(c=>v.jsx("button",{onClick:()=>e(c.id),style:{...bo.tab,color:t===c.id?"var(--text-bright)":"var(--text-dim)",borderBottom:t===c.id?"2px solid var(--accent)":"2px solid transparent"},children:c.label},c.id))}),v.jsxs("div",{style:bo.tabContent,children:[t==="chat"&&v.jsx(c8,{agent:r}),t==="stats"&&v.jsx(p8,{agent:r}),t==="actions"&&v.jsx(v8,{agent:r})]})]})}const bo={container:{display:"flex",flexDirection:"column",height:"100%"},agentHeader:{padding:"12px 0 8px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid var(--border)"},agentName:{fontSize:14,fontWeight:600,color:"var(--text-bright)"},agentMeta:{fontSize:11,color:"var(--text-dim)"},tabBar:{display:"flex",gap:0,borderBottom:"1px solid var(--border)"},tab:{padding:"8px 16px",background:"transparent",border:"none",borderBottom:"2px solid transparent",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,fontFamily:"var(--font)",cursor:"pointer"},tabContent:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column"},empty:{color:"var(--text-dim)",fontSize:12,padding:16}};function _8(){const t=Ce(i=>i.openDetail),e=Ce(i=>i.connected);return v.jsx("div",{style:dr.container,children:v.jsx("div",{style:dr.inner,children:e?v.jsxs(v.Fragment,{children:[v.jsx("div",{style:dr.readyIcon,children:v.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:[v.jsx("circle",{cx:"20",cy:"20",r:"18",fill:"none",stroke:"#2c313a",strokeWidth:"1"}),v.jsx("circle",{cx:"20",cy:"20",r:"18",fill:"none",stroke:"#33afbc",strokeWidth:"1",strokeDasharray:"113",strokeDashoffset:"28",strokeLinecap:"round",children:v.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 20 20",to:"360 20 20",dur:"3s",repeatCount:"indefinite"})}),v.jsx("text",{x:"20",y:"24",textAnchor:"middle",fill:"#33afbc",fontSize:"14",fontWeight:"700",fontFamily:"JetBrains Mono, monospace",children:"+"})]})}),v.jsx("div",{style:dr.title,children:"Ready to orchestrate"}),v.jsx("div",{style:dr.hint,children:"Spawn your first agent to start building"}),v.jsx("button",{onClick:()=>t({type:"spawn"}),style:dr.spawnBtn,children:"Spawn Agent"})]}):v.jsxs(v.Fragment,{children:[v.jsx("div",{style:dr.pulseRing,children:v.jsx("div",{style:dr.pulseCore})}),v.jsx("div",{style:dr.title,children:"Connecting to daemon..."}),v.jsx("div",{style:dr.hint,children:"Make sure the GROOVE daemon is running"}),v.jsx("code",{style:dr.code,children:"groove start"})]})})})}const dr={container:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",background:"#1a1e25"},inner:{display:"flex",flexDirection:"column",alignItems:"center",gap:12,padding:40},pulseRing:{width:40,height:40,borderRadius:"50%",border:"1px solid #33afbc",display:"flex",alignItems:"center",justifyContent:"center",animation:"pulse 2s infinite"},pulseCore:{width:8,height:8,borderRadius:"50%",background:"#33afbc",boxShadow:"0 0 12px rgba(51, 175, 188, 0.5)"},readyIcon:{marginBottom:4},title:{fontSize:14,color:"#e6e6e6",fontWeight:600,letterSpacing:.5},hint:{fontSize:12,color:"#6b7280",textAlign:"center",lineHeight:1.6,maxWidth:360},spawnBtn:{padding:"8px 24px",background:"rgba(51, 175, 188, 0.1)",border:"1px solid #33afbc",color:"#33afbc",fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:"pointer",marginTop:4,transition:"background 0.2s"},code:{background:"#252a33",padding:"8px 16px",fontSize:11,color:"#33afbc",border:"1px solid #2c313a"}};function x8({onSelect:t,onClose:e,initial:i}){const[n,r]=N.useState(i||""),[s,a]=N.useState([]),[c,h]=N.useState(null),[d,f]=N.useState(0),[g,m]=N.useState(!0),[O,S]=N.useState(""),[_,w]=N.useState(null),x=N.useRef(null);N.useEffect(()=>{Q(n)},[n]),N.useEffect(()=>{x.current&&(x.current.scrollTop=0)},[s]);async function Q(T){m(!0),S("");try{const M=await fetch(`/api/browse?path=${encodeURIComponent(T)}`);if(!M.ok){const R=await M.json().catch(()=>({}));S(R.error||"Failed to browse"),a([]);return}const $=await M.json();a($.dirs),h($.parent),f($.fileCount||0)}catch{S("Failed to connect")}finally{m(!1)}}const k=n?[{label:"root",path:""},...n.split("/").map((T,M,$)=>({label:T,path:$.slice(0,M+1).join("/")}))]:[{label:"root",path:""}];return v.jsx("div",{style:nt.overlay,onClick:e,children:v.jsxs("div",{style:nt.modal,onClick:T=>T.stopPropagation(),children:[v.jsxs("div",{style:nt.header,children:[v.jsxs("div",{children:[v.jsx("div",{style:nt.title,children:"SELECT DIRECTORY"}),v.jsx("div",{style:nt.subtitle,children:"Choose where this agent will work"})]}),v.jsx("button",{onClick:e,style:nt.closeBtn,children:"x"})]}),v.jsxs("div",{style:nt.breadcrumb,children:[k.map((T,M)=>v.jsxs("span",{children:[M>0&&v.jsx("span",{style:nt.breadSep,children:"/"}),v.jsx("button",{onClick:()=>r(T.path),style:{...nt.breadPart,color:M===k.length-1?"var(--text-bright)":"var(--accent)"},children:T.label})]},M)),!g&&v.jsxs("span",{style:nt.breadMeta,children:[s.length," folder",s.length!==1?"s":"",", ",d," file",d!==1?"s":""]})]}),v.jsxs("div",{style:nt.list,ref:x,children:[c!==null&&v.jsxs("div",{onClick:()=>r(c),onMouseEnter:()=>w("__parent"),onMouseLeave:()=>w(null),style:{...nt.dirRow,background:_==="__parent"?"var(--bg-hover)":"transparent"},children:[v.jsx("div",{style:nt.dirIconWrap,children:v.jsx("span",{style:nt.dirArrow,children:"<"})}),v.jsx("div",{style:nt.dirInfo,children:v.jsx("div",{style:nt.dirNameText,children:".."})})]}),g&&v.jsx("div",{style:nt.emptyState,children:v.jsx("div",{style:nt.emptyText,children:"Loading..."})}),O&&v.jsx("div",{style:nt.emptyState,children:v.jsx("div",{style:{...nt.emptyText,color:"var(--red)"},children:O})}),!g&&!O&&s.length===0&&v.jsxs("div",{style:nt.emptyState,children:[v.jsx("div",{style:nt.emptyText,children:"No subdirectories"}),v.jsxs("div",{style:nt.emptyHint,children:["This directory has ",d," file",d!==1?"s":""]})]}),s.map(T=>v.jsxs("div",{onClick:()=>r(T.path),onMouseEnter:()=>w(T.path),onMouseLeave:()=>w(null),style:{...nt.dirRow,background:_===T.path?"var(--bg-hover)":"transparent"},children:[v.jsx("div",{style:nt.dirIconWrap,children:v.jsx("span",{style:nt.dirArrow,children:T.hasChildren?">":""})}),v.jsxs("div",{style:nt.dirInfo,children:[v.jsx("div",{style:nt.dirNameText,children:T.name}),v.jsxs("div",{style:nt.dirMeta,children:[T.childCount>0&&`${T.childCount} folder${T.childCount!==1?"s":""}`,T.childCount>0&&T.fileCount>0&&", ",T.fileCount>0&&`${T.fileCount} file${T.fileCount!==1?"s":""}`,T.childCount===0&&T.fileCount===0&&"empty"]})]})]},T.path))]}),v.jsxs("div",{style:nt.footer,children:[v.jsxs("div",{style:nt.footerLeft,children:[v.jsx("div",{style:nt.selectedLabel,children:"Selected"}),v.jsxs("div",{style:nt.selectedPath,children:["/",n||"(project root)"]})]}),v.jsxs("div",{style:nt.footerActions,children:[v.jsx("button",{onClick:e,style:nt.cancelBtn,children:"Cancel"}),v.jsx("button",{onClick:()=>{t(n),e()},style:nt.selectBtn,children:"Select"})]})]})]})})}const nt={overlay:{position:"fixed",inset:0,zIndex:200,background:"rgba(0, 0, 0, 0.65)",display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)"},modal:{width:480,maxHeight:"80vh",background:"var(--bg-chrome)",border:"1px solid var(--border)",borderRadius:6,display:"flex",flexDirection:"column",fontFamily:"var(--font)",boxShadow:"0 16px 48px rgba(0, 0, 0, 0.4)"},header:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",padding:"14px 16px 12px",borderBottom:"1px solid var(--border)"},title:{fontSize:12,fontWeight:700,color:"var(--text-bright)",letterSpacing:.5},subtitle:{fontSize:10,color:"var(--text-dim)",marginTop:2},closeBtn:{background:"none",border:"none",color:"var(--text-dim)",fontSize:14,cursor:"pointer",fontFamily:"var(--font)",padding:"0 4px",lineHeight:1},breadcrumb:{padding:"8px 16px",borderBottom:"1px solid var(--border)",fontSize:11,display:"flex",alignItems:"center",flexWrap:"wrap",gap:0,background:"var(--bg-base)"},breadSep:{color:"var(--text-muted)",margin:"0 3px"},breadPart:{background:"none",border:"none",cursor:"pointer",fontFamily:"var(--font)",fontSize:11,padding:0},breadMeta:{marginLeft:"auto",fontSize:10,color:"var(--text-muted)"},list:{flex:1,overflowY:"auto",minHeight:200,maxHeight:400},dirRow:{display:"flex",alignItems:"center",gap:0,padding:"8px 16px",cursor:"pointer",transition:"background 0.08s",borderBottom:"1px solid rgba(75, 82, 99, 0.2)"},dirIconWrap:{width:28,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},dirArrow:{fontSize:10,color:"var(--text-muted)",fontWeight:600},dirInfo:{flex:1,minWidth:0},dirNameText:{fontSize:12,color:"var(--text-bright)",fontWeight:500},dirMeta:{fontSize:10,color:"var(--text-muted)",marginTop:1},emptyState:{padding:"32px 16px",textAlign:"center"},emptyText:{fontSize:12,color:"var(--text-dim)"},emptyHint:{fontSize:10,color:"var(--text-muted)",marginTop:4},footer:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderTop:"1px solid var(--border)",background:"var(--bg-base)"},footerLeft:{flex:1,minWidth:0,marginRight:12},selectedLabel:{fontSize:9,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:1,fontWeight:600},selectedPath:{fontSize:11,color:"var(--accent)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},footerActions:{display:"flex",gap:6,flexShrink:0},cancelBtn:{padding:"6px 14px",background:"transparent",border:"1px solid var(--border)",borderRadius:3,color:"var(--text-dim)",fontSize:11,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer"},selectBtn:{padding:"6px 18px",background:"var(--accent)",border:"1px solid var(--accent)",borderRadius:3,color:"var(--bg-base)",fontSize:11,fontWeight:700,fontFamily:"var(--font)",cursor:"pointer"}},gv=[{id:"backend",label:"Backend",desc:"APIs, server logic, database",scope:["src/api/**","src/server/**","src/lib/**","src/db/**"],category:"coding"},{id:"frontend",label:"Frontend",desc:"UI components, views, styles",scope:["src/components/**","src/views/**","src/pages/**","src/styles/**"],category:"coding"},{id:"fullstack",label:"Fullstack",desc:"Full codebase access",scope:[],category:"coding"},{id:"planner",label:"Planner",desc:"Architecture, research, planning",scope:[],category:"coding"},{id:"testing",label:"Testing",desc:"Tests, specs, coverage",scope:["tests/**","test/**","**/*.test.*","**/*.spec.*"],category:"coding"},{id:"devops",label:"DevOps",desc:"Docker, CI/CD, infra",scope:["Dockerfile*","docker-compose*",".github/**","infra/**"],category:"coding"},{id:"docs",label:"Docs",desc:"Documentation, READMEs",scope:["docs/**","*.md"],category:"coding"},{id:"cmo",label:"CMO",desc:"Marketing, social media, content",scope:[],category:"business",integrations:["slack","brave-search"]},{id:"cfo",label:"CFO",desc:"Finance, billing, revenue",scope:[],category:"business",integrations:["stripe","google-drive"]},{id:"ea",label:"EA",desc:"Scheduling, email, comms",scope:[],category:"business",integrations:["gmail","google-calendar","slack"]},{id:"support",label:"Support",desc:"Customer support, triage",scope:[],category:"business",integrations:["slack","discord"]},{id:"analyst",label:"Analyst",desc:"Data analysis, reporting",scope:[],category:"business",integrations:["postgres","google-drive"]},{id:"home",label:"Home",desc:"Smart home automation",scope:[],category:"business",integrations:["home-assistant"]}],w8=[{id:"auto",label:"Auto",desc:"AI PM reviews risky operations before they happen",icon:"~"},{id:"full",label:"Full Send",desc:"No reviews, maximum speed",icon:">"}];function k8(){const t=Ce(oe=>oe.spawnAgent),e=Ce(oe=>oe.closeDetail),[i,n]=N.useState(""),[r,s]=N.useState(""),[a,c]=N.useState(""),[h,d]=N.useState(""),[f,g]=N.useState("auto"),[m,O]=N.useState("claude-code"),[S,_]=N.useState("auto"),[w,x]=N.useState([]),[Q,k]=N.useState(!1),[T,M]=N.useState(""),[$,R]=N.useState(!1),[V,H]=N.useState(""),[ee,I]=N.useState([]),[j,D]=N.useState(null),[E,X]=N.useState(""),[P,Z]=N.useState(!1),[L,B]=N.useState(!1),[G,z]=N.useState([]),[q,K]=N.useState([]),[ie,ce]=N.useState([]),[de,pe]=N.useState([]);N.useEffect(()=>{fe(),ve(),De(),Ee()},[]);async function fe(){try{const oe=await fetch("/api/providers");x(await oe.json())}catch{}}async function ve(){try{const We=await(await fetch("/api/indexer/workspaces")).json();I(We.workspaces||[])}catch{}}async function De(){try{const oe=await fetch("/api/skills/installed");z(await oe.json())}catch{}}async function Ee(){try{const oe=await fetch("/api/integrations/installed");ce(await oe.json())}catch{}}function ke(oe){K(We=>We.includes(oe)?We.filter(Le=>Le!==oe):[...We,oe])}function me(oe){pe(We=>We.includes(oe)?We.filter(Le=>Le!==oe):[...We,oe])}N.useEffect(()=>{const oe=gv.find(We=>We.id===i);if(oe!=null&&oe.integrations&&ie.length>0){const We=oe.integrations.filter(Le=>ie.some(sn=>sn.id===Le&&sn.configured));pe(We)}},[i,ie]);const Be=gv.find(oe=>oe.id===i),lt=i==="custom"?a:(Be==null?void 0:Be.scope.join(", "))||"",He=i==="planner";function Ft(oe){if(oe.installed&&(oe.authType==="subscription"||oe.authType==="local"||oe.hasKey)){O(oe.id),_("auto"),D(null);return}D(oe.id),X("")}async function rn(){if(!(!E.trim()||!j)){Z(!0);try{await fetch(`/api/credentials/${j}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:E.trim()})}),X(""),D(null),O(j),_("auto"),await fe()}catch{}Z(!1)}}async function qi(oe){oe.preventDefault();const We=i==="custom"?r:i;if(!We){M("Select a role");return}k(!0),M("");try{const Le=lt?lt.split(",").map(on=>on.trim()).filter(Boolean):[];await t({role:We,scope:Le,prompt:h||null,model:S||"auto",provider:m,permission:f,...V.trim()?{workingDir:V.trim()}:{},...q.length>0?{skills:q}:{},...de.length>0?{integrations:de}:{}}),e()}catch(Le){M(Le.message)}finally{k(!1)}}function _n(oe){return oe.installed?oe.authType==="api-key"&&!oe.hasKey?"needs key":oe.authType==="subscription"?"subscription":oe.authType==="local"?"local":"ready":"not installed"}function ar(oe){return!(!oe.installed||oe.authType==="api-key"&&!oe.hasKey)}return v.jsxs("div",{style:{paddingTop:4},children:[v.jsx("div",{style:$e.title,children:"SPAWN AGENT"}),v.jsxs("form",{onSubmit:qi,children:[v.jsx("div",{style:$e.label,children:"ROLE"}),v.jsxs("div",{style:$e.roleGrid,children:[gv.map(oe=>v.jsx("button",{type:"button",onClick:()=>n(oe.id),style:{...$e.roleBtn,...i===oe.id?$e.roleBtnActive:{}},title:oe.desc,children:oe.label},oe.id)),v.jsx("button",{type:"button",onClick:()=>n("custom"),style:{...$e.roleBtn,...i==="custom"?$e.roleBtnActive:{}},children:"Custom"})]}),Be&&v.jsx("div",{style:$e.roleDesc,children:Be.desc}),i==="custom"&&v.jsx("input",{style:{...$e.input,marginTop:6},placeholder:"Custom role name...",value:r,onChange:oe=>s(oe.target.value),autoFocus:!0}),v.jsx("div",{style:$e.label,children:He?"WHAT TO PLAN":"TASK PROMPT"}),v.jsx("textarea",{style:$e.textarea,placeholder:He?"What should this agent research or plan?":"What should this agent work on?",value:h,onChange:oe=>d(oe.target.value),rows:3}),v.jsx("div",{style:$e.label,children:"DIRECTORY"}),v.jsxs("div",{style:$e.wsRow,children:[v.jsx("button",{type:"button",onClick:()=>H(""),style:{...$e.wsBtn,...V?{}:{borderColor:"var(--accent)",color:"var(--text-bright)"}},children:"project root"}),ee.map(oe=>v.jsx("button",{type:"button",onClick:()=>H(oe.path),style:{...$e.wsBtn,...V===oe.path?{borderColor:"var(--accent)",color:"var(--text-bright)"}:{}},title:`${oe.name} (${oe.files} files)`,children:oe.path},oe.path)),v.jsx("button",{type:"button",onClick:()=>B(!0),style:$e.browseBtn,children:"Browse..."})]}),V&&v.jsx("div",{style:$e.hint,children:V}),L&&v.jsx(x8,{initial:V,onSelect:oe=>H(oe),onClose:()=>B(!1)}),v.jsx("div",{style:$e.label,children:"PERMISSIONS"}),v.jsx("div",{style:$e.permGrid,children:w8.map(oe=>v.jsxs("button",{type:"button",onClick:()=>g(oe.id),style:{...$e.permBtn,...f===oe.id?$e.permBtnActive:{}},children:[v.jsx("span",{style:$e.permIcon,children:oe.icon}),v.jsxs("div",{children:[v.jsx("div",{style:$e.permLabel,children:oe.label}),v.jsx("div",{style:$e.permDesc,children:oe.desc})]})]},oe.id))}),ie.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:$e.label,children:"INTEGRATIONS"}),v.jsx("div",{style:$e.skillsGrid,children:ie.map(oe=>{const We=de.includes(oe.id),Le=oe.configured;return v.jsxs("button",{type:"button",onClick:()=>Le&&me(oe.id),title:Le?oe.description:"Configure credentials first",style:{...$e.skillBtn,borderColor:We?"var(--accent)":Le?"var(--border)":"var(--amber)",background:We?"rgba(51, 175, 188, 0.08)":"var(--bg-surface)",opacity:Le?1:.5,cursor:Le?"pointer":"not-allowed"},children:[v.jsx("span",{style:{...$e.skillIcon,background:We?"var(--accent)":Le?"var(--bg-active)":"var(--amber)",color:We?"var(--bg-base)":"var(--text-dim)"},children:(oe.name||"?").charAt(0)}),v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{style:{fontSize:11,fontWeight:600,color:We?"var(--text-bright)":"var(--text-primary)"},children:oe.name}),v.jsx("div",{style:{fontSize:9,color:Le?"var(--green)":"var(--amber)"},children:Le?"connected":"needs setup"})]}),We&&v.jsx("span",{style:{fontSize:10,color:"var(--accent)",flexShrink:0},children:"✓"})]},oe.id)})}),de.length>0&&v.jsxs("div",{style:$e.hint,children:[de.length," integration",de.length!==1?"s":""," will provide MCP tools to this agent"]})]}),G.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:$e.label,children:"SKILLS"}),v.jsx("div",{style:$e.skillsGrid,children:G.map(oe=>{const We=q.includes(oe.id);return v.jsxs("button",{type:"button",onClick:()=>ke(oe.id),style:{...$e.skillBtn,borderColor:We?"var(--accent)":"var(--border)",background:We?"rgba(51, 175, 188, 0.08)":"var(--bg-surface)"},children:[v.jsx("span",{style:{...$e.skillIcon,background:We?"var(--accent)":"var(--bg-active)",color:We?"var(--bg-base)":"var(--text-dim)"},children:oe.icon||oe.name.charAt(0)}),v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{style:{fontSize:11,fontWeight:600,color:We?"var(--text-bright)":"var(--text-primary)"},children:oe.name}),v.jsx("div",{style:{fontSize:9,color:"var(--text-muted)"},children:oe.author||"local"})]}),We&&v.jsx("span",{style:{fontSize:10,color:"var(--accent)",flexShrink:0},children:"✓"})]},oe.id)})}),q.length>0&&v.jsxs("div",{style:$e.hint,children:[q.length," skill",q.length!==1?"s":""," will be injected into this agent's context"]})]}),v.jsx("button",{type:"button",onClick:()=>R(!$),style:$e.advancedToggle,children:$?"- hide advanced":"+ advanced options"}),$&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:$e.label,children:"PROVIDER"}),w.map(oe=>{const We=ar(oe),Le=_n(oe),sn=m===oe.id,on=j===oe.id;return v.jsxs("div",{style:{marginBottom:2},children:[v.jsxs("button",{type:"button",onClick:()=>Ft(oe),style:{...$e.providerBtn,borderColor:sn?"var(--accent)":"var(--border)",opacity:We||on?1:.6},children:[v.jsxs("div",{style:{flex:1},children:[v.jsx("span",{style:{fontSize:12,fontWeight:600,color:sn?"var(--text-bright)":"var(--text-primary)"},children:oe.name}),v.jsx("span",{style:$e.providerModels,children:oe.models.map(Vi=>Vi.name).join(", ")})]}),v.jsx("span",{style:{fontSize:10,color:We?"var(--green)":Le==="not installed"?"var(--text-muted)":"var(--amber)"},children:We?sn?"active":"ready":Le})]}),on&&v.jsxs("div",{style:$e.connectBox,children:[!oe.installed&&v.jsxs("div",{children:[v.jsx("div",{style:$e.connectLabel,children:"Install first:"}),v.jsx("code",{style:$e.connectCode,children:oe.installCommand}),v.jsx("div",{style:$e.connectHint,children:"Run this in your terminal, then click the provider again"})]}),oe.installed&&oe.authType==="api-key"&&!oe.hasKey&&v.jsxs("div",{children:[v.jsxs("div",{style:$e.connectLabel,children:["API Key ",oe.envKey?`(${oe.envKey})`:""]}),v.jsxs("div",{style:{display:"flex",gap:4},children:[v.jsx("input",{type:"password",style:$e.input,placeholder:"sk-...",value:E,onChange:Vi=>X(Vi.target.value),onKeyDown:Vi=>Vi.key==="Enter"&&(Vi.preventDefault(),rn())}),v.jsx("button",{type:"button",onClick:rn,disabled:P||!E.trim(),style:$e.connectSaveBtn,children:P?"...":"Save"})]}),v.jsx("div",{style:$e.connectHint,children:"Encrypted locally. Never sent to GROOVE servers."})]}),oe.installed&&oe.authType==="subscription"&&v.jsxs("div",{children:[v.jsx("div",{style:$e.connectLabel,children:"Subscription auth"}),v.jsxs("div",{style:$e.connectHint,children:[oe.name," uses your existing subscription. Make sure you're logged in via the CLI."]})]}),oe.installed&&oe.authType==="local"&&v.jsxs("div",{children:[v.jsx("div",{style:$e.connectLabel,children:"Local model"}),v.jsxs("div",{style:$e.connectHint,children:["Make sure ",oe.name," is running locally. No API key needed."]})]}),v.jsx("button",{type:"button",onClick:()=>D(null),style:$e.connectCancel,children:"cancel"})]})]},oe.id)}),(()=>{const oe=w.find(Le=>Le.id===m),We=(oe==null?void 0:oe.models)||[];return We.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx("div",{style:$e.label,children:"MODEL"}),v.jsxs("select",{style:$e.input,value:S,onChange:Le=>_(Le.target.value),children:[v.jsx("option",{value:"auto",children:"Auto (recommended)"}),We.map(Le=>v.jsxs("option",{value:Le.id,children:[Le.name," (",Le.tier,")"]},Le.id))]})]})})(),v.jsx("div",{style:$e.label,children:"FILE SCOPE"}),v.jsx("input",{style:$e.input,placeholder:"e.g. src/api/**, src/lib/**",value:i==="custom"?a:lt,onChange:oe=>{i==="custom"&&c(oe.target.value)},readOnly:i!=="custom"}),v.jsx("div",{style:$e.hint,children:i==="custom"?"Comma-separated glob patterns":"Auto-set by role preset"})]}),T&&v.jsx("div",{style:$e.error,children:T}),v.jsx("button",{type:"submit",disabled:Q,style:{...$e.submitBtn,opacity:Q?.5:1},children:Q?"spawning...":He?"Start Planning":"Spawn Agent"})]})]})}const $e={title:{fontSize:11,fontWeight:600,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5,marginBottom:14},label:{fontSize:11,color:"var(--text-dim)",marginBottom:4,marginTop:12,textTransform:"uppercase",letterSpacing:1.5,fontWeight:600},roleGrid:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4},roleBtn:{background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 4px",color:"var(--text-primary)",fontSize:11,cursor:"pointer",fontFamily:"var(--font)",transition:"color 0.1s, border-color 0.1s"},roleBtnActive:{borderColor:"var(--accent)",color:"var(--text-bright)"},roleDesc:{fontSize:10,color:"var(--text-dim)",marginTop:4,fontStyle:"italic"},permGrid:{display:"flex",flexDirection:"column",gap:4},permBtn:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,cursor:"pointer",textAlign:"left",fontFamily:"var(--font)"},permBtnActive:{borderColor:"var(--accent)"},permIcon:{fontSize:14,fontWeight:700,color:"var(--accent)",width:18,textAlign:"center",flexShrink:0},permLabel:{fontSize:11,color:"var(--text-bright)",fontWeight:600},permDesc:{fontSize:10,color:"var(--text-dim)"},skillsGrid:{display:"flex",flexDirection:"column",gap:3},skillBtn:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",width:"100%",border:"1px solid var(--border)",borderRadius:2,cursor:"pointer",textAlign:"left",fontFamily:"var(--font)",transition:"border-color 0.1s, background 0.1s"},skillIcon:{width:22,height:22,borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,flexShrink:0},advancedToggle:{background:"none",border:"none",color:"var(--text-dim)",fontSize:10,cursor:"pointer",fontFamily:"var(--font)",padding:"8px 0",marginTop:8},providerBtn:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"8px 10px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,cursor:"pointer",textAlign:"left",fontFamily:"var(--font)"},providerModels:{fontSize:10,color:"var(--text-dim)",marginLeft:6},connectBox:{padding:"8px 10px",margin:"2px 0 4px",background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2},connectLabel:{fontSize:11,color:"var(--text-primary)",fontWeight:600,marginBottom:4},connectCode:{display:"block",padding:"6px 8px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,fontSize:11,color:"var(--accent)",wordBreak:"break-all"},connectHint:{fontSize:10,color:"var(--text-dim)",marginTop:4},connectSaveBtn:{padding:"6px 12px",flexShrink:0,background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:11,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},connectCancel:{background:"none",border:"none",color:"var(--text-dim)",fontSize:10,cursor:"pointer",fontFamily:"var(--font)",padding:"4px 0",marginTop:4},input:{width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",color:"var(--text-primary)",fontSize:12,outline:"none",fontFamily:"var(--font)"},textarea:{width:"100%",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",color:"var(--text-primary)",fontSize:12,outline:"none",fontFamily:"var(--font)",resize:"vertical"},hint:{fontSize:10,color:"var(--text-dim)",marginTop:3},wsRow:{display:"flex",flexWrap:"wrap",gap:4,marginTop:6},wsBtn:{background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"3px 8px",color:"var(--text-dim)",fontSize:10,cursor:"pointer",fontFamily:"var(--font)",transition:"color 0.1s, border-color 0.1s"},browseBtn:{background:"var(--bg-surface)",border:"1px solid var(--accent)",borderRadius:2,padding:"3px 10px",color:"var(--accent)",fontSize:10,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},error:{color:"var(--red)",fontSize:11,marginTop:8},submitBtn:{width:"100%",marginTop:14,padding:"8px",background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:12,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"}};function C8(){var a;const[t,e]=N.useState(null),[i,n]=N.useState(!0);N.useEffect(()=>{r();const c=setInterval(r,1e4);return()=>clearInterval(c)},[]);async function r(){try{const c=await fetch("/api/journalist");e(await c.json())}catch{}n(!1)}async function s(){n(!0);try{await fetch("/api/journalist/cycle",{method:"POST"}),await r()}catch{}n(!1)}return v.jsxs("div",{style:{paddingTop:4},children:[v.jsxs("div",{style:Li.header,children:[v.jsx("span",{style:Li.title,children:"THE JOURNALIST"}),v.jsx("button",{onClick:s,disabled:i,style:Li.btn,children:i?"synthesizing...":"Run Cycle"})]}),v.jsxs("div",{style:Li.statusRow,children:[v.jsxs("span",{children:["Status: ",t!=null&&t.running?"active":"stopped"]}),v.jsxs("span",{children:["Cycles: ",(t==null?void 0:t.cycleCount)||0]}),(t==null?void 0:t.lastCycleAt)&&v.jsxs("span",{children:["Last: ",new Date(t.lastCycleAt).toLocaleTimeString()]})]}),t!=null&&t.lastSynthesis?v.jsxs("div",{children:[v.jsx("div",{style:Li.sectionLabel,children:"SUMMARY"}),v.jsx("div",{style:Li.textBox,children:t.lastSynthesis.summary}),t.lastSynthesis.projectMap&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:Li.sectionLabel,children:"PROJECT MAP"}),v.jsx("pre",{style:Li.codeBox,children:t.lastSynthesis.projectMap})]}),t.lastSynthesis.decisions&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:Li.sectionLabel,children:"DECISIONS"}),v.jsx("pre",{style:Li.codeBox,children:t.lastSynthesis.decisions})]})]}):v.jsx("div",{style:Li.empty,children:"No synthesis yet. The Journalist runs every 2 minutes when agents are active."}),((a=t==null?void 0:t.history)==null?void 0:a.length)>0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:Li.sectionLabel,children:"HISTORY"}),v.jsx("div",{style:Li.historyList,children:t.history.slice().reverse().map((c,h)=>{var d;return v.jsxs("div",{style:Li.historyEntry,children:[v.jsx("span",{style:Li.historyTime,children:new Date(c.timestamp).toLocaleTimeString()}),v.jsxs("span",{style:Li.historyText,children:["Cycle ",c.cycle,": ",c.agentCount," agent",c.agentCount!==1?"s":""," — ",(d=c.summary)==null?void 0:d.slice(0,80)]})]},h)})})]})]})}const Li={header:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:10},title:{fontSize:11,fontWeight:600,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5},btn:{padding:"3px 10px",background:"transparent",border:"1px solid var(--purple)",borderRadius:2,color:"var(--purple)",fontSize:11,cursor:"pointer",fontFamily:"var(--font)"},statusRow:{display:"flex",gap:12,fontSize:11,color:"var(--text-dim)",marginBottom:12,padding:"6px 0",borderBottom:"1px solid var(--border)",flexWrap:"wrap"},sectionLabel:{fontSize:11,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5,marginBottom:4,marginTop:12,fontWeight:600},textBox:{background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,padding:8,fontSize:12,color:"var(--text-primary)",lineHeight:1.5},codeBox:{background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:2,padding:8,fontSize:11,color:"var(--text-dim)",lineHeight:1.5,whiteSpace:"pre-wrap",maxHeight:200,overflowY:"auto",margin:0},empty:{color:"var(--text-dim)",fontSize:12,padding:16,textAlign:"center"},historyList:{maxHeight:160,overflowY:"auto",background:"var(--bg-base)",borderRadius:2,border:"1px solid var(--border)"},historyEntry:{padding:"4px 8px",borderBottom:"1px solid var(--bg-surface)",fontSize:10,display:"flex",gap:6},historyTime:{color:"var(--text-dim)",whiteSpace:"nowrap"},historyText:{color:"var(--text-primary)"}};function T8(){const[t,e]=N.useState([]),[i,n]=N.useState(null),[r,s]=N.useState(!1),[a,c]=N.useState(""),h=Ce(O=>O.showStatus);N.useEffect(()=>{d();const O=setInterval(d,5e3);return()=>clearInterval(O)},[]);async function d(){try{const S=await(await fetch("/api/teams")).json();e(S.teams),n(S.activeTeam)}catch{}}async function f(O){try{await fetch(`/api/teams/${encodeURIComponent(O)}/load`,{method:"POST"}),h(`loaded team "${O}"`),d()}catch{h("failed to load team")}}async function g(){if(a.trim())try{await fetch("/api/teams",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a.trim()})}),h(`saved team "${a}"`),c(""),s(!1),d()}catch{h("failed to save team")}}async function m(O){await fetch(`/api/teams/${encodeURIComponent(O)}`,{method:"DELETE"}),h(`deleted "${O}"`),d()}return v.jsxs("div",{style:gn.container,children:[v.jsx("div",{style:gn.title,children:"SAVED TEAMS"}),t.length===0?v.jsx("div",{style:gn.empty,children:"No saved teams"}):t.map(O=>v.jsxs("div",{style:{...gn.item,background:O.name===i?"var(--bg-hover)":"transparent"},children:[v.jsxs("div",{style:{flex:1},children:[v.jsxs("div",{style:gn.teamName,children:[">"," ",O.name]}),v.jsxs("div",{style:gn.teamMeta,children:[O.agents," agents"]})]}),v.jsxs("div",{style:{display:"flex",gap:8},children:[v.jsx("button",{onClick:()=>f(O.name),style:gn.loadBtn,children:"Load"}),v.jsx("button",{onClick:()=>m(O.name),style:gn.deleteBtn,children:"x"})]})]},O.name)),v.jsx("div",{style:gn.divider}),r?v.jsxs("div",{style:gn.saveRow,children:[v.jsx("input",{style:gn.saveInput,placeholder:"Team name...",value:a,onChange:O=>c(O.target.value),onKeyDown:O=>O.key==="Enter"&&g(),autoFocus:!0}),v.jsx("button",{onClick:g,style:gn.saveBtn,children:"Save"}),v.jsx("button",{onClick:()=>s(!1),style:gn.cancelBtn,children:"x"})]}):v.jsx("button",{onClick:()=>s(!0),style:gn.saveTeamBtn,children:"Save Current as Team"})]})}const gn={container:{padding:24,maxWidth:600,margin:"0 auto"},title:{fontSize:11,fontWeight:600,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5,marginBottom:16},item:{padding:"10px 12px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid var(--border)"},teamName:{fontSize:12,color:"var(--text-bright)",fontWeight:600},teamMeta:{fontSize:11,color:"var(--text-dim)",marginTop:2},loadBtn:{background:"transparent",border:"none",color:"var(--accent)",fontSize:11,cursor:"pointer",fontFamily:"var(--font)",fontWeight:600},deleteBtn:{background:"none",border:"none",color:"var(--text-dim)",fontSize:12,cursor:"pointer",fontFamily:"var(--font)"},empty:{padding:20,color:"var(--text-dim)",fontSize:12,textAlign:"center"},divider:{borderTop:"1px solid var(--border)",margin:"12px 0"},saveTeamBtn:{background:"transparent",border:"1px solid var(--accent)",borderRadius:2,padding:"6px 14px",color:"var(--accent)",fontSize:12,cursor:"pointer",fontFamily:"var(--font)",fontWeight:600},saveRow:{display:"flex",gap:6,alignItems:"center"},saveInput:{flex:1,background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:2,padding:"6px 8px",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},saveBtn:{padding:"6px 12px",background:"transparent",border:"1px solid var(--accent)",borderRadius:2,color:"var(--accent)",fontSize:12,cursor:"pointer",fontFamily:"var(--font)"},cancelBtn:{background:"none",border:"none",color:"var(--text-dim)",fontSize:12,cursor:"pointer",fontFamily:"var(--font)"}},ka="#4ae168",L1="#33afbc",X1="#e5c07b",N1="#e06c75",Q8="#c678dd",$8="#61afef",Kl=[L1,X1,ka,Q8,N1,$8,"#d19a66"],P8={medium:.009};function E8(){const[t,e]=N.useState(null),i=Ce(O=>O.agents),n=Ce(O=>O.dashTelemetry);N.useEffect(()=>{r();const O=setInterval(r,4e3);return()=>clearInterval(O)},[]);async function r(){try{const S=await(await fetch("/api/dashboard")).json();e(S),Ce.setState(_=>{const w={..._.dashTelemetry},x=Date.now();for(const Q of S.agents.breakdown){w[Q.id]||(w[Q.id]=[]);const k=w[Q.id],T=k[k.length-1];(!T||Q.tokens!==T.v||x-T.t>1e4)&&(k.push({t:x,v:Q.tokens||0,name:Q.name}),k.length>200&&(w[Q.id]=k.slice(-200)))}return{dashTelemetry:w}})}catch{}}if(!t)return v.jsxs("div",{style:Ot.loadingRoot,children:[v.jsx("div",{style:Ot.loadingText,children:"COMMAND CENTER"}),v.jsx("div",{style:Ot.loadingBar,children:v.jsx("div",{style:Ot.loadingFill})})]});const{tokens:s,routing:a,rotation:c,adaptive:h,journalist:d,uptime:f}=t,g=t.agents.breakdown,m=s.savings.total/1e3*P8.medium;return v.jsxs("div",{style:Ot.root,children:[v.jsxs("div",{style:Ot.statBar,children:[v.jsx(Dh,{label:"Total Tokens",value:Co(s.totalTokens),sub:`${t.agents.total} agent${t.agents.total!==1?"s":""}`}),v.jsx(Dh,{label:"Tokens Saved",value:Co(s.savings.total),sub:`${s.savings.percentage||0}% efficiency`,color:ka}),v.jsx(Dh,{label:"Est. Savings",value:m>0?`$${m.toFixed(2)}`:"$0.00",sub:"based on token costs",color:ka}),v.jsx(Dh,{label:"Rotations",value:c.totalRotations,sub:`${Co(c.totalTokensSaved)} tok recovered`}),v.jsx(Dh,{label:"Uptime",value:M8(f),sub:`${t.agents.running} running`})]}),v.jsxs("div",{style:Ot.midRow,children:[v.jsxs("div",{style:Ot.chartPanel,children:[v.jsxs("div",{style:Ot.panelHead,children:[v.jsx("span",{children:"Token Usage"}),v.jsx("span",{style:Ot.panelHeadRight,children:g.filter(O=>O.tokens>0).map((O,S)=>v.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginLeft:12},children:[v.jsx("span",{style:{width:6,height:2,background:Kl[S%Kl.length],display:"inline-block",borderRadius:1}}),v.jsx("span",{style:{fontSize:9},children:O.name})]},O.id))})]}),v.jsx(A8,{tokenTimeline:n,agents:i})]}),v.jsxs("div",{style:Ot.donutPanel,children:[v.jsx("div",{style:Ot.panelHead,children:"Model Routing"}),v.jsx(R8,{routing:a})]})]}),v.jsxs("div",{style:Ot.bottomRow,children:[v.jsxs("div",{style:Ot.panel,children:[v.jsx("div",{style:Ot.panelHead,children:"Savings Breakdown"}),v.jsxs("div",{style:Ot.scrollInner,children:[v.jsx(Jf,{label:"Rotation",value:s.savings.fromRotation,max:s.savings.total||1,color:L1}),v.jsx(Jf,{label:"Conflict Prevention",value:s.savings.fromConflictPrevention,max:s.savings.total||1,color:X1}),v.jsx(Jf,{label:"Cold-Start Skip",value:s.savings.fromColdStartSkip,max:s.savings.total||1,color:ka}),v.jsx("div",{style:Ot.divider}),v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:10,color:"#8b929e",padding:"4px 0"},children:[v.jsx("span",{children:"Without Groove"}),v.jsx("span",{style:{color:N1,fontWeight:600},children:Co(s.savings.estimatedWithoutGroove)})]}),v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:10,color:"#8b929e",padding:"4px 0"},children:[v.jsx("span",{children:"With Groove"}),v.jsx("span",{style:{color:ka,fontWeight:600},children:Co(s.totalTokens)})]}),v.jsx("div",{style:{fontSize:8,color:"#5c6370",marginTop:4,lineHeight:1.4},children:"Calculated from: rotation recovery (30% of degraded context), cold-start prevention (2K tokens/skip), conflict avoidance (500 tokens/conflict)."}),d.lastSummary&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:Ot.divider}),v.jsx("div",{style:Ot.panelHead,children:"Journalist"}),v.jsx("div",{style:Ot.journSummary,children:d.lastSummary})]})]})]}),v.jsxs("div",{style:Ot.panel,children:[v.jsx("div",{style:Ot.panelHead,children:"Agent Fleet"}),v.jsxs("div",{style:Ot.scrollInner,children:[g.length===0?v.jsx("div",{style:Ot.empty,children:"No agents spawned"}):g.map((O,S)=>v.jsx(Jf,{label:O.name,value:O.tokens,max:Math.max(...g.map(_=>_.tokens),1),color:Kl[S%Kl.length],sub:`${O.role} · ${O.model||"auto"}`},O.id)),c.history.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:Ot.divider}),v.jsx("div",{style:Ot.panelHead,children:"Rotation History"}),c.history.slice().reverse().slice(0,8).map((O,S)=>v.jsxs("div",{style:Ot.rotEntry,children:[v.jsx("span",{style:Ot.rotName,children:O.agentName}),v.jsxs("span",{style:{color:ka,fontSize:9},children:[Co(O.oldTokens)," saved"]}),v.jsx("span",{style:Ot.rotTime,children:z8(O.timestamp)})]},S))]})]})]})]})]})}function Dh({label:t,value:e,sub:i,color:n}){return v.jsxs("div",{style:Ot.statCard,children:[v.jsx("div",{style:{fontSize:10,color:"#8b929e",textTransform:"uppercase",letterSpacing:1,marginBottom:6},children:t}),v.jsx("div",{style:{fontSize:20,fontWeight:700,color:n||"#e6e6e6",lineHeight:1},children:e}),i&&v.jsx("div",{style:{fontSize:9,color:"#6b7280",marginTop:4},children:i})]})}function Jf({label:t,value:e,max:i,color:n,sub:r}){const s=i>0?e/i*100:0;return v.jsxs("div",{style:{padding:"6px 0"},children:[v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:4},children:[v.jsx("span",{style:{fontSize:11,color:"#abb2bf"},children:t}),v.jsx("span",{style:{fontSize:11,color:"#e6e6e6",fontWeight:600},children:Co(e)})]}),v.jsx("div",{style:{height:4,background:"#1e222a",borderRadius:2},children:v.jsx("div",{style:{width:`${Math.max(s,e>0?1:0)}%`,height:"100%",background:n,borderRadius:2,transition:"width 0.3s"}})}),r&&v.jsx("div",{style:{fontSize:8,color:"#3e4451",marginTop:2},children:r})]})}function R8({routing:t}){const e=[{label:"Heavy",color:N1,count:t.byTier.heavy,cost:"$0.045/1k"},{label:"Medium",color:X1,count:t.byTier.medium,cost:"$0.009/1k"},{label:"Light",color:ka,count:t.byTier.light,cost:"$0.002/1k"}],i=e.reduce((h,d)=>h+d.count,0)||1,n=50,r=60,s=60,a=2*Math.PI*n;let c=0;return v.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,alignItems:"center",justifyContent:"center",gap:12,minHeight:0},children:[v.jsxs("svg",{width:"120",height:"120",viewBox:"0 0 120 120",children:[v.jsx("circle",{cx:r,cy:s,r:n,fill:"none",stroke:"#1e222a",strokeWidth:"10"}),e.map(h=>{if(h.count===0)return null;const f=h.count/i*a,g=v.jsx("circle",{cx:r,cy:s,r:n,fill:"none",stroke:h.color,strokeWidth:"10",strokeDasharray:`${f} ${a-f}`,strokeDashoffset:-c,strokeLinecap:"butt",transform:`rotate(-90 ${r} ${s})`,style:{transition:"stroke-dasharray 0.5s"}},h.label);return c+=f,g}),v.jsx("text",{x:r,y:s-4,textAnchor:"middle",fill:"#e6e6e6",fontSize:"16",fontWeight:"700",fontFamily:"JetBrains Mono, monospace",children:i>1?i:t.totalDecisions}),v.jsx("text",{x:r,y:s+10,textAnchor:"middle",fill:"#5c6370",fontSize:"8",fontFamily:"JetBrains Mono, monospace",children:"decisions"})]}),v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,width:"100%",padding:"0 8px"},children:e.map(h=>v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:10},children:[v.jsx("span",{style:{width:8,height:8,borderRadius:2,background:h.color,flexShrink:0}}),v.jsx("span",{style:{color:"#abb2bf",flex:1},children:h.label}),v.jsx("span",{style:{color:"#5c6370",fontSize:9},children:h.cost}),v.jsx("span",{style:{color:"#e6e6e6",fontWeight:600,minWidth:20,textAlign:"right"},children:h.count})]},h.label))}),v.jsxs("div",{style:{fontSize:9,color:"#3e4451"},children:[t.autoRoutedCount," auto-routed"]})]})}function A8({tokenTimeline:t,agents:e}){const i=N.useRef(),n=N.useRef(),r=N.useCallback(()=>{const s=i.current,a=n.current;if(!s||!a)return;const c=window.devicePixelRatio||1,h=s.clientWidth,d=s.clientHeight;if(h===0||d===0)return;a.width=h*c,a.height=d*c,a.style.width=h+"px",a.style.height=d+"px";const f=a.getContext("2d");f.scale(c,c),f.clearRect(0,0,h,d);const g=40,m=10,O=10,S=20,_=h-g-m,w=d-O-S;f.strokeStyle="#1e222a",f.lineWidth=.5;for(let $=0;$<=4;$++){const R=O+$/4*w;f.beginPath(),f.moveTo(g,R),f.lineTo(h-m,R),f.stroke()}const x=Object.keys(t);if(x.length===0){f.fillStyle="#3e4451",f.font="10px monospace",f.textAlign="center",f.fillText("Waiting for agent telemetry...",h/2,d/2);return}let Q=1/0,k=0,T=0;for(const $ of x)for(const R of t[$]||[])R.t<Q&&(Q=R.t),R.t>k&&(k=R.t),R.v>T&&(T=R.v);k===Q&&(k=Q+6e4),T===0&&(T=100);const M=k-Q;f.fillStyle="#3e4451",f.font="8px monospace",f.textAlign="right";for(let $=0;$<=4;$++){const R=T*(1-$/4);f.fillText(Co(Math.round(R)),g-4,O+$/4*w+3)}f.textAlign="center";for(let $=0;$<=4;$++){const R=Q+$/4*M,V=new Date(R);f.fillText(`${V.getHours()}:${String(V.getMinutes()).padStart(2,"0")}`,g+$/4*_,d-4)}x.forEach(($,R)=>{const V=t[$]||[];if(V.length<2)return;const H=Kl[R%Kl.length],ee=V.map(D=>({x:g+(D.t-Q)/M*_,y:O+(1-D.v/T)*w}));f.beginPath(),f.moveTo(ee[0].x,O+w);for(const D of ee)f.lineTo(D.x,D.y);f.lineTo(ee[ee.length-1].x,O+w),f.closePath();const I=f.createLinearGradient(0,O,0,O+w);I.addColorStop(0,H+"20"),I.addColorStop(1,H+"03"),f.fillStyle=I,f.fill(),f.beginPath();for(let D=0;D<ee.length;D++)D===0?f.moveTo(ee[D].x,ee[D].y):f.lineTo(ee[D].x,ee[D].y);f.strokeStyle=H,f.lineWidth=1,f.stroke();const j=ee[ee.length-1];f.beginPath(),f.arc(j.x,j.y,2,0,Math.PI*2),f.fillStyle=H,f.fill()})},[t,e]);return N.useEffect(()=>{r()},[r]),N.useEffect(()=>{const s=new ResizeObserver(r);return i.current&&s.observe(i.current),()=>s.disconnect()},[r]),v.jsx("div",{ref:i,style:{flex:1,minHeight:0,position:"relative"},children:v.jsx("canvas",{ref:n,style:{display:"block",position:"absolute",top:0,left:0}})})}function Co(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t||0)}function M8(t){const e=Math.floor(t/3600),i=Math.floor(t%3600/60);return e>0?`${e}h ${i}m`:`${i}m ${Math.floor(t%60)}s`}function z8(t){const e=Math.floor((Date.now()-new Date(t).getTime())/6e4);return e>=60?`${Math.floor(e/60)}h ago`:e>0?`${e}m ago`:"now"}const Ot={root:{width:"100%",height:"100%",display:"flex",flexDirection:"column",overflow:"hidden",padding:14,gap:12,background:"var(--bg-base)"},loadingRoot:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:12},loadingText:{fontSize:11,fontWeight:700,color:"var(--text-dim)",letterSpacing:3,textTransform:"uppercase"},loadingBar:{width:120,height:2,background:"#282c34",borderRadius:1,overflow:"hidden"},loadingFill:{width:"40%",height:"100%",background:L1,animation:"pulse 1.5s infinite"},statBar:{display:"flex",flexShrink:0,background:"#282c34",borderRadius:12,overflow:"hidden"},statCard:{flex:1,padding:"14px 16px",borderRight:"1px solid #1e222a",display:"flex",flexDirection:"column"},midRow:{display:"grid",gridTemplateColumns:"2fr 1fr",gap:12,flex:2,minHeight:0},chartPanel:{background:"#282c34",borderRadius:12,padding:"12px 14px",display:"flex",flexDirection:"column",minHeight:0},donutPanel:{background:"#282c34",borderRadius:12,padding:"12px 14px",display:"flex",flexDirection:"column",minHeight:0},bottomRow:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,flex:3,minHeight:0},panel:{background:"#282c34",borderRadius:12,padding:"12px 14px",display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},panelHead:{fontSize:10,fontWeight:600,color:"#5c6370",textTransform:"uppercase",letterSpacing:1,marginBottom:8,flexShrink:0,display:"flex",justifyContent:"space-between",alignItems:"center"},panelHeadRight:{display:"flex",alignItems:"center",color:"#3e4451"},scrollInner:{flex:1,minHeight:0,overflowY:"auto"},empty:{color:"#3e4451",fontSize:10,textAlign:"center",padding:20},divider:{height:1,background:"#1e222a",margin:"8px 0",flexShrink:0},journSummary:{fontSize:10,color:"#8b929e",lineHeight:1.5,padding:"4px 0",whiteSpace:"pre-wrap",maxHeight:80,overflowY:"auto"},rotEntry:{display:"flex",alignItems:"center",gap:8,padding:"4px 0",fontSize:10},rotName:{color:"#abb2bf",flex:1},rotTime:{color:"#3e4451",fontSize:9}};function j8(){const[t,e]=N.useState(null);N.useEffect(()=>{i();const s=setInterval(i,4e3);return()=>clearInterval(s)},[]);async function i(){try{const s=await fetch("/api/pm/history");e(await s.json())}catch{}}const n=(t==null?void 0:t.history)||[],r=(t==null?void 0:t.stats)||{};return v.jsxs("div",{style:di.container,children:[v.jsxs("div",{style:di.header,children:[v.jsx("div",{style:di.title,children:"PM REVIEW LOG"}),v.jsx("div",{style:di.subtitle,children:"AI Project Manager reviews risky agent operations in Auto mode"})]}),v.jsxs("div",{style:di.statsBar,children:[v.jsx(ep,{label:"REVIEWS",value:r.totalReviews||0}),v.jsx(ep,{label:"APPROVED",value:r.approved||0,color:"var(--green)"}),v.jsx(ep,{label:"REJECTED",value:r.rejected||0,color:"var(--red)"}),v.jsx(ep,{label:"AVG TIME",value:r.avgDurationMs?`${(r.avgDurationMs/1e3).toFixed(1)}s`:"-"})]}),n.length===0?v.jsxs("div",{style:di.empty,children:[v.jsx("div",{style:di.emptyTitle,children:"No reviews yet"}),v.jsx("div",{style:di.emptyDesc,children:"Spawn agents with Auto permission mode. The AI PM will review risky operations (new files, deletions, config changes) before they happen."})]}):v.jsx("div",{style:di.list,children:n.slice().reverse().map((s,a)=>v.jsxs("div",{style:di.entry,children:[v.jsxs("div",{style:di.entryTop,children:[v.jsx("span",{style:{...di.verdict,color:s.approved?"var(--green)":"var(--red)",borderColor:s.approved?"rgba(74,225,104,0.3)":"rgba(224,108,117,0.3)",background:s.approved?"rgba(74,225,104,0.08)":"rgba(224,108,117,0.08)"},children:s.approved?"APPROVED":"REJECTED"}),v.jsx("span",{style:di.entryAgent,children:s.agent}),v.jsx("span",{style:di.entryAction,children:s.action}),v.jsx("span",{style:di.entryTime,children:D8(s.timestamp)})]}),v.jsx("div",{style:di.entryFile,children:s.file}),s.description&&v.jsx("div",{style:di.entryDesc,children:s.description}),v.jsx("div",{style:di.entryReason,children:s.reason})]},a))})]})}function ep({label:t,value:e,color:i}){return v.jsxs("div",{style:di.stat,children:[v.jsx("div",{style:{fontSize:16,fontWeight:700,color:i||"var(--text-bright)"},children:e}),v.jsx("div",{style:{fontSize:7,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1},children:t})]})}function D8(t){const e=Math.floor((Date.now()-new Date(t).getTime())/6e4);return e>=60?`${Math.floor(e/60)}h ago`:e>0?`${e}m ago`:"just now"}const di={container:{padding:24,maxWidth:700,margin:"0 auto"},header:{marginBottom:16},title:{fontSize:11,fontWeight:700,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1.5},subtitle:{fontSize:10,color:"var(--text-dim)",marginTop:4},statsBar:{display:"flex",gap:8,marginBottom:16},stat:{flex:1,background:"var(--bg-surface)",border:"1px solid var(--border)",padding:"8px 10px",textAlign:"center"},empty:{textAlign:"center",padding:"40px 20px",background:"var(--bg-surface)",border:"1px solid var(--border)"},emptyTitle:{fontSize:12,color:"var(--text-primary)",fontWeight:600,marginBottom:8},emptyDesc:{fontSize:10,color:"var(--text-dim)",lineHeight:1.6,maxWidth:400,margin:"0 auto"},list:{display:"flex",flexDirection:"column",gap:4},entry:{background:"var(--bg-surface)",border:"1px solid var(--border)",padding:"8px 10px"},entryTop:{display:"flex",alignItems:"center",gap:8,marginBottom:4},verdict:{fontSize:8,fontWeight:700,letterSpacing:.5,padding:"1px 5px",border:"1px solid"},entryAgent:{fontSize:11,fontWeight:600,color:"var(--text-bright)"},entryAction:{fontSize:10,color:"var(--text-dim)"},entryTime:{fontSize:9,color:"var(--text-dim)",marginLeft:"auto"},entryFile:{fontSize:10,color:"var(--accent)",fontFamily:"var(--font)"},entryDesc:{fontSize:10,color:"var(--text-primary)",marginTop:2},entryReason:{fontSize:10,color:"var(--text-dim)",marginTop:3,fontStyle:"italic"}},Z1={all:"All Skills",design:"Design",quality:"Quality",devtools:"Dev Tools",workflow:"Workflow",security:"Security",specialized:"Specialized"},W1={design:"✨",quality:"✔",devtools:"⚙",workflow:"↻",security:"⛨",specialized:"☆"},B8=[{id:"popular",label:"Popular"},{id:"rating",label:"Top Rated"},{id:"newest",label:"Newest"},{id:"name",label:"A–Z"}];function L8(t){return t.source==="claude-official"?{label:"Anthropic",color:"#d4a574",bg:"rgba(212, 165, 116, 0.12)"}:t.source==="groove-official"?{label:"Groove",color:"var(--accent)",bg:"rgba(51, 175, 188, 0.12)"}:t.verified?{label:"Verified",color:"var(--green)",bg:"rgba(74, 225, 104, 0.10)"}:null}function q1({skill:t,size:e="small"}){const i=L8(t);if(!i)return null;const n=e==="small";return v.jsxs("span",{title:`${i.label} — Verified publisher`,style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:n?9:10,fontWeight:600,color:i.color,background:i.bg,padding:n?"1px 6px":"2px 8px",borderRadius:3,letterSpacing:.3,flexShrink:0,cursor:"default"},children:[v.jsx("span",{style:{fontSize:n?8:10,lineHeight:1},children:"✓"}),i.label]})}function V1(t){return t?t>=1e3?(t/1e3).toFixed(1).replace(/\.0$/,"")+"k":String(t):"0"}function Dy(t){if(!t)return null;const e=Math.floor(t),i=t-e>=.3,n=[];for(let r=0;r<5;r++)r<e?n.push("★"):n.push("☆");return n.join("")}function l2(t,e){const i=[...t];switch(e){case"popular":return i.sort((n,r)=>(r.downloads||0)-(n.downloads||0));case"rating":return i.sort((n,r)=>(r.rating||0)-(n.rating||0));case"name":return i.sort((n,r)=>n.name.localeCompare(r.name));case"newest":return i.reverse();default:return i}}function X8({current:t,onRate:e,disabled:i}){const[n,r]=N.useState(0);return v.jsx("div",{style:{display:"flex",gap:2,alignItems:"center"},children:[1,2,3,4,5].map(s=>{const a=n>0?s<=n:s<=(t||0);return v.jsx("span",{onClick:()=>!i&&e(s),onMouseEnter:()=>!i&&r(s),onMouseLeave:()=>r(0),style:{fontSize:18,cursor:i?"default":"pointer",color:a?"var(--amber)":"var(--bg-active)",transition:"color 0.1s, transform 0.1s",transform:n===s?"scale(1.2)":"none",userSelect:"none"},children:"★"},s)})})}function N8({skill:t,content:e,installing:i,onInstall:n,onUninstall:r,onRate:s,onClose:a}){const[c,h]=N.useState(0),[d,f]=N.useState(!1),[g,m]=N.useState(!1);if(!t)return null;async function O(S){m(!0);try{await s(t.id,S),h(S),f(!0)}catch{}m(!1)}return v.jsx("div",{style:Xe.overlay,onClick:a,children:v.jsxs("div",{style:Xe.container,onClick:S=>S.stopPropagation(),children:[v.jsxs("div",{style:Xe.topBar,children:[v.jsx(q1,{skill:t,size:"large"}),v.jsx("button",{onClick:a,style:Xe.closeBtn,children:"×"})]}),v.jsxs("div",{style:Xe.header,children:[v.jsx("div",{style:{...Xe.icon,background:t.installed?"var(--green)":t.price>0?"var(--purple)":"var(--accent)"},children:t.icon||t.name.charAt(0)}),v.jsxs("div",{style:Xe.headerInfo,children:[v.jsx("div",{style:Xe.name,children:t.name}),v.jsxs("div",{style:Xe.author,children:["by ",t.author]}),v.jsxs("div",{style:Xe.meta,children:[t.rating>0&&v.jsxs("span",{style:Xe.metaItem,children:[v.jsx("span",{style:{color:"var(--amber)"},children:Dy(t.rating)})," ",t.rating," (",t.ratingCount||0,")"]}),t.downloads>0&&v.jsxs("span",{style:Xe.metaItem,children:["⤓"," ",V1(t.downloads)]}),v.jsxs("span",{style:Xe.metaItem,children:[W1[t.category]||""," ",Z1[t.category]||t.category]})]})]})]}),v.jsxs("div",{style:Xe.actionBar,children:[t.installed?v.jsx("button",{onClick:()=>r(t.id),disabled:i===t.id,style:Xe.uninstallBtn,children:i===t.id?"Removing...":"Uninstall"}):v.jsx("button",{onClick:()=>n(t.id),disabled:i===t.id,style:t.price>0?Xe.buyBtn:Xe.installBtn,children:i===t.id?"Installing...":t.price>0?`$${t.price.toFixed(2)}`:"Install"}),t.price===0&&!t.installed&&v.jsx("span",{style:Xe.freeLabel,children:"Free"})]}),v.jsxs("div",{style:Xe.section,children:[v.jsx("div",{style:Xe.sectionTitle,children:"Rating"}),v.jsxs("div",{style:Xe.ratingRow,children:[v.jsxs("div",{style:Xe.ratingLeft,children:[v.jsx("div",{style:Xe.ratingBig,children:t.rating||"-"}),v.jsx("div",{style:{color:"var(--amber)",fontSize:13},children:Dy(t.rating)}),v.jsxs("div",{style:Xe.ratingCount,children:[t.ratingCount||0," ratings"]})]}),v.jsxs("div",{style:Xe.ratingRight,children:[v.jsx("div",{style:Xe.rateLabel,children:d?"Thanks for rating!":"Rate this skill"}),v.jsx(X8,{current:c,onRate:O,disabled:g||d}),g&&v.jsx("div",{style:{fontSize:10,color:"var(--text-muted)",marginTop:4},children:"Submitting..."})]})]})]}),v.jsxs("div",{style:Xe.section,children:[v.jsx("div",{style:Xe.sectionTitle,children:"About"}),v.jsx("div",{style:Xe.description,children:t.description})]}),v.jsxs("div",{style:Xe.section,children:[v.jsx("div",{style:Xe.sectionTitle,children:"Tags"}),v.jsxs("div",{style:Xe.tagRow,children:[(t.tags||[]).map(S=>v.jsx("span",{style:Xe.tag,children:S},S)),(t.roles||[]).map(S=>v.jsx("span",{style:Xe.roleTag,children:S},S))]})]}),t.authorProfile&&v.jsxs("div",{style:Xe.section,children:[v.jsx("div",{style:Xe.sectionTitle,children:"Developer"}),v.jsxs("div",{style:Xe.authorCard,children:[v.jsx("div",{style:Xe.authorAvatar,children:t.authorProfile.avatar?v.jsx("img",{src:t.authorProfile.avatar,alt:"",style:{width:"100%",height:"100%",borderRadius:6}}):t.author.charAt(0)}),v.jsxs("div",{style:Xe.authorDetails,children:[v.jsx("div",{style:Xe.authorName,children:t.author}),v.jsxs("div",{style:Xe.authorLinks,children:[t.authorProfile.website&&v.jsx("a",{href:t.authorProfile.website,target:"_blank",rel:"noopener noreferrer",style:Xe.authorLink,children:"Website"}),t.authorProfile.github&&v.jsx("a",{href:`https://github.com/${t.authorProfile.github}`,target:"_blank",rel:"noopener noreferrer",style:Xe.authorLink,children:"GitHub"}),t.authorProfile.twitter&&v.jsxs("a",{href:`https://x.com/${t.authorProfile.twitter}`,target:"_blank",rel:"noopener noreferrer",style:Xe.authorLink,children:["@",t.authorProfile.twitter]})]})]})]})]}),e&&v.jsxs("div",{style:Xe.section,children:[v.jsx("div",{style:Xe.sectionTitle,children:"Skill Instructions"}),v.jsxs("pre",{style:Xe.contentPre,children:[e.replace(/^---[\s\S]*?---\n/,"").trim().slice(0,2e3),e.length>2e3?`
74
+ ...`:""]})]})]})})}function Z8({skills:t,onSelect:e}){const i=t.filter(n=>n.featured).slice(0,3);return i.length===0?null:v.jsxs("div",{style:Me.featuredSection,children:[v.jsx("div",{style:Me.featuredLabel,children:"Featured"}),v.jsx("div",{style:Me.featuredRow,children:i.map(n=>v.jsxs("div",{onClick:()=>e(n),style:Me.featuredCard,onMouseEnter:r=>{r.currentTarget.style.borderColor="var(--accent)",r.currentTarget.style.transform="translateY(-1px)"},onMouseLeave:r=>{r.currentTarget.style.borderColor="var(--border)",r.currentTarget.style.transform="none"},children:[v.jsx("div",{style:Me.featuredGradient,children:v.jsx("div",{style:{...Me.featuredIcon,background:n.installed?"var(--green)":"var(--accent)"},children:n.icon||n.name.charAt(0)})}),v.jsxs("div",{style:Me.featuredInfo,children:[v.jsx("div",{style:Me.featuredName,children:n.name}),v.jsxs("div",{style:Me.featuredAuthorRow,children:[v.jsx("span",{style:Me.featuredAuthor,children:n.author}),v.jsx(q1,{skill:n})]}),v.jsx("div",{style:Me.featuredDesc,children:n.description}),v.jsxs("div",{style:Me.featuredMeta,children:[n.rating>0&&v.jsxs("span",{style:{color:"var(--amber)",fontSize:10},children:[Dy(n.rating)," ",n.rating]}),v.jsxs("span",{style:{color:"var(--text-muted)",fontSize:10},children:["⤓"," ",V1(n.downloads)]})]})]}),n.installed&&v.jsx("div",{style:Me.featuredBadge,children:"installed"})]},n.id))})]})}function W8({skill:t,onSelect:e,hovered:i,onHover:n}){return v.jsxs("div",{onClick:()=>e(t),onMouseEnter:()=>n(t.id),onMouseLeave:()=>n(null),style:{...Me.card,borderColor:t.installed?"var(--green)":i?"var(--accent)":"var(--border)",background:i?"var(--bg-hover)":"var(--bg-surface)",transform:i?"translateY(-1px)":"none"},children:[v.jsxs("div",{style:Me.cardTop,children:[v.jsx("div",{style:{...Me.cardIcon,background:t.installed?"var(--green)":t.price>0?"var(--purple)":"var(--accent)"},children:t.icon||t.name.charAt(0)}),v.jsxs("div",{style:Me.cardInfo,children:[v.jsx("div",{style:Me.cardName,children:t.name}),v.jsxs("div",{style:Me.cardAuthorRow,children:[v.jsx("span",{style:Me.cardAuthor,children:t.author}),v.jsx(q1,{skill:t})]})]}),t.installed&&v.jsx("div",{style:Me.installedBadge,children:"installed"}),t.price>0&&!t.installed&&v.jsxs("div",{style:Me.priceBadge,children:["$",t.price.toFixed(2)]}),t.price===0&&!t.installed&&v.jsx("div",{style:Me.freeBadge,children:"Free"})]}),v.jsx("div",{style:Me.cardDesc,children:t.description}),v.jsxs("div",{style:Me.cardBottom,children:[v.jsxs("div",{style:Me.cardStats,children:[t.rating>0&&v.jsxs("span",{style:Me.cardRating,children:[v.jsx("span",{style:{color:"var(--amber)"},children:"★"})," ",t.rating]}),t.downloads>0&&v.jsxs("span",{style:Me.cardDownloads,children:["⤓"," ",V1(t.downloads)]})]}),v.jsxs("span",{style:Me.catTag,children:[W1[t.category]||""," ",Z1[t.category]||t.category]})]})]})}function q8(){const[t,e]=N.useState([]),[i,n]=N.useState([]),[r,s]=N.useState(""),[a,c]=N.useState("all"),[h,d]=N.useState("popular"),[f,g]=N.useState("browse"),[m,O]=N.useState(!0),[S,_]=N.useState(null),[w,x]=N.useState(null),[Q,k]=N.useState(null),[T,M]=N.useState(null),$=N.useCallback(async()=>{O(!0);try{const D=new URLSearchParams;r&&D.set("search",r),a!=="all"&&D.set("category",a);const X=await(await fetch(`/api/skills/registry?${D}`)).json();e(X.skills||[]),n(X.categories||[])}catch{}O(!1)},[r,a]);N.useEffect(()=>{$()},[$]);async function R(D){_(D);try{await fetch(`/api/skills/${D}/install`,{method:"POST"}),await $(),e(E=>{const X=E.find(P=>P.id===D);return X&&(w==null?void 0:w.id)===D&&x({...X,installed:!0}),E})}catch{}_(null)}async function V(D){_(D);try{await fetch(`/api/skills/${D}`,{method:"DELETE"}),await $(),(w==null?void 0:w.id)===D&&(x(E=>E?{...E,installed:!1}:null),k(null))}catch{}_(null)}async function H(D,E){const X=await fetch(`/api/skills/${D}/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:E})});if(!X.ok)throw new Error("Rating failed");const P=await X.json();e(Z=>Z.map(L=>L.id===D?{...L,rating:P.rating,ratingCount:P.rating_count??P.ratingCount}:L)),(w==null?void 0:w.id)===D&&x(Z=>Z?{...Z,rating:P.rating,ratingCount:P.rating_count??P.ratingCount}:null)}async function ee(D){if(x(D),k(null),D.installed)try{const X=await(await fetch(`/api/skills/${D.id}/content`)).json();k(X.content)}catch{}}const I=t.filter(D=>D.installed),j=l2(f==="installed"?I:t,h);return v.jsxs("div",{style:Me.root,children:[v.jsxs("div",{style:Me.headerBar,children:[v.jsxs("div",{style:Me.headerLeft,children:[v.jsx("div",{style:Me.title,children:"Skills Store"}),v.jsxs("div",{style:Me.headerTabs,children:[v.jsx("button",{onClick:()=>g("browse"),style:{...Me.headerTab,color:f==="browse"?"var(--text-bright)":"var(--text-dim)",borderBottom:f==="browse"?"2px solid var(--accent)":"2px solid transparent"},children:"Browse"}),v.jsxs("button",{onClick:()=>g("installed"),style:{...Me.headerTab,color:f==="installed"?"var(--text-bright)":"var(--text-dim)",borderBottom:f==="installed"?"2px solid var(--green)":"2px solid transparent"},children:["My Skills (",I.length,")"]})]})]}),v.jsx("div",{style:Me.headerRight,children:v.jsxs("span",{style:Me.headerCount,children:[t.length," skills"]})})]}),v.jsxs("div",{style:Me.toolbar,children:[v.jsxs("div",{style:Me.searchRow,children:[v.jsxs("div",{style:Me.searchWrap,children:[v.jsx("span",{style:Me.searchIcon,children:"⌕"}),v.jsx("input",{style:Me.search,placeholder:"Search skills...",value:r,onChange:D=>s(D.target.value)})]}),v.jsx("div",{style:Me.sortWrap,children:B8.map(D=>v.jsx("button",{onClick:()=>d(D.id),style:{...Me.sortBtn,color:h===D.id?"var(--text-bright)":"var(--text-muted)",background:h===D.id?"var(--bg-active)":"transparent"},children:D.label},D.id))})]}),f==="browse"&&v.jsxs("div",{style:Me.catRow,children:[v.jsx("button",{onClick:()=>c("all"),style:{...Me.catBtn,...a==="all"?Me.catBtnActive:{}},children:"All"}),i.map(D=>v.jsxs("button",{onClick:()=>c(D.id),style:{...Me.catBtn,...a===D.id?Me.catBtnActive:{}},children:[W1[D.id]||""," ",Z1[D.id]||D.id," (",D.count,")"]},D.id))]})]}),v.jsxs("div",{style:Me.scrollArea,children:[f==="browse"&&!r&&a==="all"&&v.jsx(Z8,{skills:t,onSelect:ee}),m&&t.length===0&&v.jsx("div",{style:Me.empty,children:"Loading skills..."}),!m&&j.length===0&&v.jsx("div",{style:Me.empty,children:f==="installed"?"No skills installed yet. Browse the store to find skills.":"No skills match your search."}),v.jsx("div",{style:Me.grid,children:j.map(D=>v.jsx(W8,{skill:D,onSelect:ee,hovered:T===D.id,onHover:M},D.id))})]}),v.jsx(N8,{skill:w,content:Q,installing:S,onInstall:R,onUninstall:V,onRate:H,onClose:()=>{x(null),k(null)}})]})}const Me={root:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},headerBar:{padding:"12px 20px 0",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},headerLeft:{display:"flex",alignItems:"center",gap:20},title:{fontSize:15,fontWeight:700,color:"var(--text-bright)",letterSpacing:.3},headerTabs:{display:"flex",gap:0},headerTab:{padding:"6px 14px",background:"none",border:"none",fontSize:12,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer",transition:"color 0.1s"},headerRight:{display:"flex",alignItems:"center",gap:10},headerCount:{fontSize:11,color:"var(--text-muted)"},toolbar:{padding:"10px 20px",flexShrink:0},searchRow:{display:"flex",gap:10,alignItems:"center"},searchWrap:{flex:1,position:"relative"},searchIcon:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--text-muted)",fontSize:13,pointerEvents:"none"},search:{width:"100%",padding:"7px 12px 7px 30px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},sortWrap:{display:"flex",gap:2},sortBtn:{padding:"5px 10px",background:"transparent",border:"1px solid transparent",borderRadius:4,fontSize:10,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer",transition:"all 0.1s"},catRow:{display:"flex",gap:4,marginTop:8,flexWrap:"wrap"},catBtn:{padding:"4px 12px",background:"transparent",border:"1px solid var(--border)",borderRadius:14,color:"var(--text-dim)",fontSize:10,fontFamily:"var(--font)",cursor:"pointer",transition:"all 0.1s"},catBtnActive:{borderColor:"var(--accent)",color:"var(--accent)",background:"rgba(51, 175, 188, 0.08)"},scrollArea:{flex:1,overflowY:"auto",padding:"4px 20px 20px"},featuredSection:{marginBottom:16},featuredLabel:{fontSize:11,fontWeight:700,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1,marginBottom:8},featuredRow:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:8},featuredCard:{padding:"14px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",transition:"border-color 0.15s, transform 0.15s",position:"relative",overflow:"hidden"},featuredGradient:{display:"flex",alignItems:"center",marginBottom:10},featuredIcon:{width:40,height:40,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",fontSize:16,fontWeight:700,color:"var(--bg-base)"},featuredInfo:{flex:1},featuredName:{fontSize:13,fontWeight:700,color:"var(--text-bright)"},featuredAuthorRow:{display:"flex",alignItems:"center",gap:6,marginTop:2},featuredAuthor:{fontSize:10,color:"var(--text-muted)"},featuredDesc:{fontSize:10,color:"var(--text-dim)",marginTop:6,lineHeight:1.45,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},featuredMeta:{display:"flex",gap:10,marginTop:8},featuredBadge:{position:"absolute",top:8,right:8,fontSize:8,fontWeight:600,color:"var(--green)",border:"1px solid var(--green)",borderRadius:3,padding:"1px 5px",textTransform:"uppercase",letterSpacing:.5},grid:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:8},empty:{padding:"60px 0",textAlign:"center",color:"var(--text-dim)",fontSize:12,gridColumn:"1 / -1"},card:{padding:"14px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",transition:"border-color 0.12s, background 0.12s, transform 0.12s",display:"flex",flexDirection:"column"},cardTop:{display:"flex",alignItems:"center",gap:10},cardIcon:{width:36,height:36,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,color:"var(--bg-base)",flexShrink:0},cardInfo:{flex:1,minWidth:0},cardName:{fontSize:12,fontWeight:600,color:"var(--text-bright)"},cardAuthorRow:{display:"flex",alignItems:"center",gap:6,marginTop:2},cardAuthor:{fontSize:10,color:"var(--text-muted)"},installedBadge:{fontSize:8,fontWeight:600,color:"var(--green)",border:"1px solid var(--green)",borderRadius:3,padding:"1px 6px",textTransform:"uppercase",letterSpacing:.5,flexShrink:0},priceBadge:{fontSize:10,fontWeight:700,color:"var(--purple)",border:"1px solid var(--purple)",borderRadius:4,padding:"2px 8px",flexShrink:0},freeBadge:{fontSize:9,fontWeight:500,color:"var(--text-muted)",flexShrink:0},cardDesc:{fontSize:11,color:"var(--text-dim)",marginTop:10,lineHeight:1.5,flex:1,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},cardBottom:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:10,paddingTop:8,borderTop:"1px solid var(--border)"},cardStats:{display:"flex",gap:10},cardRating:{fontSize:10,color:"var(--text-dim)"},cardDownloads:{fontSize:10,color:"var(--text-muted)"},catTag:{fontSize:9,padding:"2px 8px",borderRadius:4,background:"var(--bg-active)",color:"var(--text-dim)",fontWeight:500}},Xe={overlay:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(2px)"},container:{width:"90%",maxWidth:560,maxHeight:"85vh",background:"var(--bg-chrome)",border:"1px solid var(--border)",borderRadius:10,overflowY:"auto",padding:"0 24px 24px",position:"relative"},topBar:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 0 10px",position:"sticky",top:0,zIndex:1,background:"var(--bg-chrome)"},closeBtn:{background:"none",border:"1px solid var(--border)",borderRadius:4,color:"var(--text-dim)",fontSize:16,cursor:"pointer",fontFamily:"var(--font)",lineHeight:1,padding:"2px 8px",transition:"border-color 0.1s"},header:{display:"flex",gap:14,alignItems:"flex-start",marginBottom:14},actionBar:{display:"flex",alignItems:"center",gap:10,marginBottom:18,paddingBottom:16,borderBottom:"1px solid var(--border)"},icon:{width:52,height:52,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:20,fontWeight:700,color:"var(--bg-base)",flexShrink:0},headerInfo:{flex:1,minWidth:0},name:{fontSize:16,fontWeight:700,color:"var(--text-bright)"},author:{fontSize:11,color:"var(--text-dim)",marginTop:2},meta:{display:"flex",gap:12,marginTop:6,fontSize:11,color:"var(--text-dim)"},metaItem:{display:"flex",alignItems:"center",gap:3},installBtn:{padding:"8px 28px",background:"var(--accent)",border:"none",borderRadius:6,color:"var(--bg-base)",fontSize:12,fontWeight:700,fontFamily:"var(--font)",cursor:"pointer",transition:"opacity 0.1s"},buyBtn:{padding:"8px 28px",background:"var(--purple)",border:"none",borderRadius:6,color:"#fff",fontSize:12,fontWeight:700,fontFamily:"var(--font)",cursor:"pointer",transition:"opacity 0.1s"},uninstallBtn:{padding:"8px 20px",background:"transparent",border:"1px solid var(--red)",borderRadius:6,color:"var(--red)",fontSize:12,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},freeLabel:{fontSize:9,color:"var(--text-muted)",fontWeight:500},section:{marginBottom:16},ratingRow:{display:"flex",gap:20,alignItems:"center",padding:"12px 14px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6},ratingLeft:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,minWidth:70},ratingBig:{fontSize:24,fontWeight:700,color:"var(--text-bright)",lineHeight:1},ratingCount:{fontSize:9,color:"var(--text-muted)",marginTop:2},ratingRight:{flex:1},rateLabel:{fontSize:11,color:"var(--text-dim)",marginBottom:6},sectionTitle:{fontSize:10,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:.8,marginBottom:8},description:{fontSize:12,color:"var(--text-primary)",lineHeight:1.6},tagRow:{display:"flex",gap:5,flexWrap:"wrap"},tag:{fontSize:10,padding:"2px 8px",borderRadius:4,background:"var(--bg-active)",color:"var(--text-dim)"},roleTag:{fontSize:10,padding:"2px 8px",borderRadius:4,background:"rgba(51, 175, 188, 0.1)",color:"var(--accent)"},authorCard:{display:"flex",gap:12,alignItems:"center",padding:"10px 12px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6},authorAvatar:{width:36,height:36,borderRadius:6,background:"var(--accent)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,color:"var(--bg-base)",flexShrink:0},authorDetails:{flex:1},authorName:{fontSize:12,fontWeight:600,color:"var(--text-bright)"},authorLinks:{display:"flex",gap:10,marginTop:4},authorLink:{fontSize:10,color:"var(--accent)",textDecoration:"none"},contentPre:{fontSize:10,color:"var(--text-dim)",lineHeight:1.6,fontFamily:"var(--font)",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:300,overflowY:"auto",padding:"10px 12px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6}},I1={all:"All",communication:"Communication",productivity:"Productivity",finance:"Finance",developer:"Developer",database:"Database","smart-home":"Smart Home",analytics:"Analytics"},Y1={communication:"✉",productivity:"⚙",finance:"⚖",developer:"⌘",database:"≡","smart-home":"⌂",analytics:"⌕"},H1={slack:"S",github:"G",stripe:"$",calendar:"C",email:"@",gmail:"@",database:"D",search:"?",drive:"D",linear:"L",notion:"N",discord:"D",home:"H",folder:"F",map:"M"},V8=[{id:"popular",label:"Popular"},{id:"name",label:"A–Z"},{id:"category",label:"Category"}];function I8(t){return t.verified==="mcp-official"?{label:"Official",color:"var(--accent)",bg:"rgba(51, 175, 188, 0.12)"}:t.verified==="verified"?{label:"Verified",color:"var(--green)",bg:"rgba(74, 225, 104, 0.10)"}:null}function U1({item:t,size:e="small"}){const i=I8(t);if(!i)return null;const n=e==="small";return v.jsxs("span",{title:`${i.label} MCP server`,style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:n?9:10,fontWeight:600,color:i.color,background:i.bg,padding:n?"1px 6px":"2px 8px",borderRadius:3,letterSpacing:.3,flexShrink:0,cursor:"default"},children:[v.jsx("span",{style:{fontSize:n?8:10,lineHeight:1},children:"✓"}),i.label]})}function c2(t,e){const i=[...t];switch(e){case"popular":return i.sort((n,r)=>(r.featured?1:0)-(n.featured?1:0)||n.name.localeCompare(r.name));case"name":return i.sort((n,r)=>n.name.localeCompare(r.name));case"category":return i.sort((n,r)=>(n.category||"").localeCompare(r.category||"")||n.name.localeCompare(r.name));default:return i}}function Y8({integration:t,onClose:e}){const[i,n]=N.useState({}),[r,s]=N.useState(!1),[a,c]=N.useState({}),[h,d]=N.useState(null),[f,g]=N.useState(""),[m,O]=N.useState(""),[S,_]=N.useState(!1);if(N.useEffect(()=>{(t==null?void 0:t.authType)==="oauth-google"&&(d("checking"),fetch("/api/integrations/google-oauth/status").then($=>$.json()).then($=>d($.configured?"ready":"not-configured")).catch(()=>d("not-configured")))},[t]),!t)return null;const w=t.authType==="oauth-google",x=(t.envKeys||[]).filter($=>!$.hidden),Q=t.setupSteps||[];async function k($){if(i[$]){s(!0);try{(await fetch(`/api/integrations/${t.id}/credentials`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:$,value:i[$]})})).ok&&(c(V=>({...V,[$]:!0})),n(V=>({...V,[$]:""})))}catch{}s(!1)}}async function T(){if(!(!f||!m)){s(!0);try{await fetch("/api/integrations/google-oauth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:f,clientSecret:m})}),d("ready"),_(!1)}catch{}s(!1)}}async function M(){d("connecting");try{const R=await(await fetch(`/api/integrations/${t.id}/oauth/start`,{method:"POST"})).json();if(R.url){window.open(R.url,"_blank","width=600,height=700");const V=setInterval(async()=>{try{(await(await fetch(`/api/integrations/${t.id}/status`)).json()).configured&&(clearInterval(V),d("ready"),e())}catch{}},2e3);setTimeout(()=>clearInterval(V),3e5)}}catch{d("ready")}}return v.jsx("div",{style:Ge.overlay,onClick:e,children:v.jsxs("div",{style:Ge.container,onClick:$=>$.stopPropagation(),children:[v.jsxs("div",{style:Ge.topBar,children:[v.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-bright)"},children:["Connect ",t.name]}),v.jsx("button",{onClick:e,style:Ge.closeBtn,children:"×"})]}),v.jsxs("div",{style:{padding:"16px 0"},children:[Q.length>0&&v.jsxs("div",{style:{marginBottom:20},children:[v.jsx("div",{style:{fontSize:10,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:.5,marginBottom:10},children:"Setup Guide"}),Q.map(($,R)=>v.jsxs("div",{style:{display:"flex",gap:10,marginBottom:8,fontSize:11,color:"var(--text-primary)",lineHeight:1.5},children:[v.jsx("span",{style:{width:20,height:20,borderRadius:"50%",flexShrink:0,background:"var(--bg-active)",color:"var(--accent)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700},children:R+1}),v.jsx("span",{children:$})]},R))]}),t.setupUrl&&!w&&v.jsxs("a",{href:t.setupUrl,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"10px 16px",marginBottom:16,background:"var(--bg-active)",color:"var(--accent)",border:"1px solid var(--accent)",borderRadius:6,fontSize:12,fontWeight:600,textDecoration:"none",cursor:"pointer"},children:["Open ",t.name," Settings ","↗"]}),w&&v.jsxs("div",{style:{marginBottom:16},children:[v.jsx("button",{onClick:h==="ready"?M:()=>_(!0),disabled:h==="checking"||h==="connecting",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8,width:"100%",padding:"12px 16px",marginBottom:12,background:h==="connecting"?"var(--bg-active)":"#4285f4",color:"#fff",border:"none",borderRadius:6,fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)",opacity:h==="checking"?.5:1},children:h==="checking"?"Checking...":h==="connecting"?"Waiting for authorization...":"Connect with Google"}),S&&h==="not-configured"&&v.jsxs("div",{style:{padding:14,borderRadius:8,background:"var(--bg-surface)",border:"1px solid var(--border)"},children:[v.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-bright)",marginBottom:8},children:"First-time setup (one time for all Google services)"}),v.jsx("div",{style:{fontSize:10,color:"var(--text-dim)",lineHeight:1.6,marginBottom:10},children:"Create a free Google Cloud OAuth app to let Groove connect on your behalf:"}),v.jsxs("a",{href:"https://console.cloud.google.com/apis/credentials/oauthclient",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 14px",marginBottom:10,background:"var(--bg-active)",color:"var(--accent)",border:"1px solid var(--accent)",borderRadius:6,fontSize:11,fontWeight:600,textDecoration:"none"},children:["Open Google Cloud Console ","↗"]}),v.jsxs("div",{style:{fontSize:10,color:"var(--text-muted)",lineHeight:1.7,marginBottom:12},children:["1. Create a project if you don't have one",`
75
+ `,"2. Set up OAuth consent screen (External, add your email as test user)",`
76
+ `,"3. Create credentials ","→"," OAuth client ID ","→"," Desktop app",`
77
+ `,"4. Paste the Client ID and Secret below:"]}),v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[v.jsx("input",{value:f,onChange:$=>g($.target.value),placeholder:"Client ID (e.g. 123456.apps.googleusercontent.com)",style:Ge.input}),v.jsx("input",{type:"password",value:m,onChange:$=>O($.target.value),placeholder:"Client Secret (e.g. GOCSPX-...)",style:Ge.input}),v.jsx("button",{onClick:async()=>{await T(),f&&m&&setTimeout(()=>M(),500)},disabled:r||!f||!m,style:{...Ge.saveBtn,width:"100%",opacity:r||!f||!m?.4:1},children:r?"Saving...":"Save & Connect"})]}),v.jsx("div",{style:{fontSize:9,color:"var(--text-muted)",textAlign:"center",marginTop:6},children:"One-time setup. Works for Gmail, Calendar, and Drive. Encrypted on this machine only."})]})]}),x.length>0&&v.jsxs("div",{children:[v.jsx("div",{style:{fontSize:11,color:"var(--text-dim)",marginBottom:12,lineHeight:1.5},children:"Paste your credentials below. Values are encrypted and stored locally on this machine only."}),x.map($=>v.jsxs("div",{style:{marginBottom:14},children:[v.jsxs("label",{style:Ge.label,children:[$.label||$.key,$.required&&v.jsx("span",{style:{color:"var(--red)",marginLeft:4},children:"*"}),a[$.key]&&v.jsxs("span",{style:{color:"var(--green)",marginLeft:8,fontSize:10,fontWeight:500},children:["✓"," saved"]})]}),v.jsxs("div",{style:{display:"flex",gap:6},children:[v.jsx("input",{type:"password",value:i[$.key]||"",placeholder:$.placeholder||$.key,onChange:R=>n(V=>({...V,[$.key]:R.target.value})),onKeyDown:R=>R.key==="Enter"&&k($.key),style:Ge.input}),v.jsx("button",{onClick:()=>k($.key),disabled:r||!i[$.key],style:{...Ge.saveBtn,opacity:r||!i[$.key]?.4:1},children:"Save"})]})]},$.key))]})]})]})})}function H8({integration:t,installing:e,onInstall:i,onUninstall:n,onConfigure:r,onClose:s}){return t?v.jsx("div",{style:Ge.overlay,onClick:s,children:v.jsxs("div",{style:Ge.container,onClick:a=>a.stopPropagation(),children:[v.jsxs("div",{style:Ge.topBar,children:[v.jsx(U1,{item:t,size:"large"}),v.jsx("button",{onClick:s,style:Ge.closeBtn,children:"×"})]}),v.jsxs("div",{style:Ge.header,children:[v.jsx("div",{style:{...Ge.icon,background:t.installed&&t.configured?"var(--green)":t.installed?"var(--amber)":"var(--accent)"},children:H1[t.icon]||t.name.charAt(0)}),v.jsxs("div",{style:Ge.headerInfo,children:[v.jsx("div",{style:Ge.name,children:t.name}),v.jsxs("div",{style:Ge.meta,children:[v.jsxs("span",{style:Ge.metaItem,children:[Y1[t.category]||""," ",I1[t.category]||t.category]}),v.jsx("span",{style:Ge.metaItem,children:"MCP Server"})]})]})]}),v.jsx("div",{style:Ge.actionBar,children:t.installed?v.jsxs("div",{style:{display:"flex",gap:8,flex:1},children:[v.jsx("button",{onClick:()=>r(t),style:Ge.configureBtn,disabled:(t.envKeys||[]).length===0,children:t.configured?"Reconfigure":"Configure"}),v.jsx("button",{onClick:()=>n(t.id),disabled:e===t.id,style:Ge.uninstallBtn,children:e===t.id?"Removing...":"Uninstall"})]}):v.jsx("button",{onClick:()=>i(t.id),disabled:e===t.id,style:Ge.installBtn,children:e===t.id?"Installing...":"Install"})}),t.installed&&v.jsxs("div",{style:Ge.section,children:[v.jsx("div",{style:Ge.sectionTitle,children:"Status"}),v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderRadius:6,background:t.configured?"rgba(74, 225, 104, 0.06)":"rgba(229, 192, 123, 0.06)",border:`1px solid ${t.configured?"var(--green)":"var(--amber)"}`},children:[v.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:t.configured?"var(--green)":"var(--amber)"}}),v.jsx("span",{style:{fontSize:11,color:t.configured?"var(--green)":"var(--amber)"},children:t.configured?"Connected and ready":"Credentials needed"})]})]}),v.jsxs("div",{style:Ge.section,children:[v.jsx("div",{style:Ge.sectionTitle,children:"About"}),v.jsx("div",{style:Ge.description,children:t.description})]}),(t.envKeys||[]).length>0&&v.jsxs("div",{style:Ge.section,children:[v.jsx("div",{style:Ge.sectionTitle,children:"Required Credentials"}),v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:t.envKeys.map(a=>v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:11,color:"var(--text-dim)"},children:[v.jsx("code",{style:{fontSize:10,padding:"1px 6px",borderRadius:3,background:"var(--bg-active)",color:"var(--text-primary)",fontFamily:"var(--font)"},children:a.key}),v.jsx("span",{children:a.label}),a.required&&v.jsx("span",{style:{color:"var(--amber)",fontSize:9},children:"required"})]},a.key))})]}),v.jsxs("div",{style:Ge.section,children:[v.jsx("div",{style:Ge.sectionTitle,children:"Tags"}),v.jsxs("div",{style:Ge.tagRow,children:[(t.tags||[]).map(a=>v.jsx("span",{style:Ge.tag,children:a},a)),(t.roles||[]).map(a=>v.jsx("span",{style:Ge.roleTag,children:a},a))]})]}),t.npmPackage&&v.jsxs("div",{style:Ge.section,children:[v.jsx("div",{style:Ge.sectionTitle,children:"Package"}),v.jsx("code",{style:{fontSize:11,padding:"6px 10px",borderRadius:4,background:"var(--bg-active)",color:"var(--text-primary)",display:"block",fontFamily:"var(--font)"},children:t.npmPackage})]})]})}):null}function U8({integrations:t,onSelect:e}){const i=t.filter(n=>n.featured).slice(0,3);return i.length===0?null:v.jsxs("div",{style:je.featuredSection,children:[v.jsx("div",{style:je.featuredLabel,children:"Featured Integrations"}),v.jsx("div",{style:je.featuredRow,children:i.map(n=>v.jsxs("div",{onClick:()=>e(n),style:je.featuredCard,onMouseEnter:r=>{r.currentTarget.style.borderColor="var(--accent)",r.currentTarget.style.transform="translateY(-1px)"},onMouseLeave:r=>{r.currentTarget.style.borderColor="var(--border)",r.currentTarget.style.transform="none"},children:[v.jsx("div",{style:je.featuredGradient,children:v.jsx("div",{style:{...je.featuredIcon,background:n.installed&&n.configured?"var(--green)":n.installed?"var(--amber)":"var(--accent)"},children:H1[n.icon]||n.name.charAt(0)})}),v.jsxs("div",{style:je.featuredInfo,children:[v.jsx("div",{style:je.featuredName,children:n.name}),v.jsx("div",{style:je.featuredAuthorRow,children:v.jsx(U1,{item:n})}),v.jsx("div",{style:je.featuredDesc,children:n.description})]}),n.installed&&n.configured&&v.jsx("div",{style:je.connectedBadge,children:"connected"}),n.installed&&!n.configured&&v.jsx("div",{style:je.setupBadge,children:"needs setup"})]},n.id))})]})}function G8({item:t,onSelect:e,hovered:i,onHover:n}){return v.jsxs("div",{onClick:()=>e(t),onMouseEnter:()=>n(t.id),onMouseLeave:()=>n(null),style:{...je.card,borderColor:t.installed&&t.configured?"var(--green)":t.installed?"var(--amber)":i?"var(--accent)":"var(--border)",background:i?"var(--bg-hover)":"var(--bg-surface)",transform:i?"translateY(-1px)":"none"},children:[v.jsxs("div",{style:je.cardTop,children:[v.jsx("div",{style:{...je.cardIcon,background:t.installed&&t.configured?"var(--green)":t.installed?"var(--amber)":"var(--accent)"},children:H1[t.icon]||t.name.charAt(0)}),v.jsxs("div",{style:je.cardInfo,children:[v.jsx("div",{style:je.cardName,children:t.name}),v.jsx("div",{style:je.cardAuthorRow,children:v.jsx(U1,{item:t})})]}),t.installed&&t.configured&&v.jsx("div",{style:je.connectedBadgeSm,children:"connected"}),t.installed&&!t.configured&&v.jsx("div",{style:je.setupBadgeSm,children:"setup"}),!t.installed&&v.jsx("div",{style:je.freeBadge,children:"MCP"})]}),v.jsx("div",{style:je.cardDesc,children:t.description}),v.jsxs("div",{style:je.cardBottom,children:[v.jsx("div",{style:je.cardStats,children:(t.envKeys||[]).length>0&&v.jsxs("span",{style:je.cardCredCount,children:[t.envKeys.length," credential",t.envKeys.length>1?"s":""]})}),v.jsxs("span",{style:je.catTag,children:[Y1[t.category]||""," ",I1[t.category]||t.category]})]})]})}function F8(){const[t,e]=N.useState([]),[i,n]=N.useState([]),[r,s]=N.useState(""),[a,c]=N.useState("all"),[h,d]=N.useState("popular"),[f,g]=N.useState("browse"),[m,O]=N.useState(!0),[S,_]=N.useState(null),[w,x]=N.useState(null),[Q,k]=N.useState(null),[T,M]=N.useState(null),$=N.useCallback(async()=>{O(!0);try{const E=new URLSearchParams;r&&E.set("search",r),a!=="all"&&E.set("category",a);const P=await(await fetch(`/api/integrations/registry?${E}`)).json();e(P.integrations||[]),n(P.categories||[])}catch{}O(!1)},[r,a]);N.useEffect(()=>{$()},[$]);async function R(E){_(E);try{if(await fetch(`/api/integrations/${E}/install`,{method:"POST"}),await $(),(w==null?void 0:w.id)===E){const X=t.find(P=>P.id===E);X&&x({...X,installed:!0})}}catch{}_(null)}async function V(E){_(E);try{await fetch(`/api/integrations/${E}`,{method:"DELETE"}),await $(),(w==null?void 0:w.id)===E&&x(X=>X?{...X,installed:!1,configured:!1}:null)}catch{}_(null)}function H(E){x(E)}function ee(E){x(null),k(E)}function I(){k(null),$()}const j=t.filter(E=>E.installed),D=c2(f==="installed"?j:t,h);return v.jsxs("div",{style:je.root,children:[v.jsxs("div",{style:je.headerBar,children:[v.jsxs("div",{style:je.headerLeft,children:[v.jsx("div",{style:je.title,children:"Integrations"}),v.jsxs("div",{style:je.headerTabs,children:[v.jsx("button",{onClick:()=>g("browse"),style:{...je.headerTab,color:f==="browse"?"var(--text-bright)":"var(--text-dim)",borderBottom:f==="browse"?"2px solid var(--accent)":"2px solid transparent"},children:"Browse"}),v.jsxs("button",{onClick:()=>g("installed"),style:{...je.headerTab,color:f==="installed"?"var(--text-bright)":"var(--text-dim)",borderBottom:f==="installed"?"2px solid var(--green)":"2px solid transparent"},children:["Installed (",j.length,")"]})]})]}),v.jsx("div",{style:je.headerRight,children:v.jsxs("span",{style:je.headerCount,children:[t.length," integrations"]})})]}),v.jsxs("div",{style:je.toolbar,children:[v.jsxs("div",{style:je.searchRow,children:[v.jsxs("div",{style:je.searchWrap,children:[v.jsx("span",{style:je.searchIcon,children:"⌕"}),v.jsx("input",{style:je.search,placeholder:"Search integrations...",value:r,onChange:E=>s(E.target.value)})]}),v.jsx("div",{style:je.sortWrap,children:V8.map(E=>v.jsx("button",{onClick:()=>d(E.id),style:{...je.sortBtn,color:h===E.id?"var(--text-bright)":"var(--text-muted)",background:h===E.id?"var(--bg-active)":"transparent"},children:E.label},E.id))})]}),f==="browse"&&v.jsxs("div",{style:je.catRow,children:[v.jsx("button",{onClick:()=>c("all"),style:{...je.catBtn,...a==="all"?je.catBtnActive:{}},children:"All"}),i.map(E=>v.jsxs("button",{onClick:()=>c(E.id),style:{...je.catBtn,...a===E.id?je.catBtnActive:{}},children:[Y1[E.id]||""," ",I1[E.id]||E.id," (",E.count,")"]},E.id))]})]}),v.jsxs("div",{style:je.scrollArea,children:[f==="browse"&&!r&&a==="all"&&v.jsx(U8,{integrations:t,onSelect:H}),m&&t.length===0&&v.jsx("div",{style:je.empty,children:"Loading integrations..."}),!m&&D.length===0&&v.jsx("div",{style:je.empty,children:f==="installed"?"No integrations installed yet. Browse to connect your tools.":"No integrations match your search."}),v.jsx("div",{style:je.grid,children:D.map(E=>v.jsx(G8,{item:E,onSelect:H,hovered:T===E.id,onHover:M},E.id))})]}),v.jsx(H8,{integration:w,installing:S,onInstall:R,onUninstall:V,onConfigure:ee,onClose:()=>x(null)}),v.jsx(Y8,{integration:Q,onClose:I})]})}const je={root:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},headerBar:{padding:"12px 20px 0",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},headerLeft:{display:"flex",alignItems:"center",gap:20},title:{fontSize:15,fontWeight:700,color:"var(--text-bright)",letterSpacing:.3},headerTabs:{display:"flex",gap:0},headerTab:{padding:"6px 14px",background:"none",border:"none",fontSize:12,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer",transition:"color 0.1s"},headerRight:{display:"flex",alignItems:"center",gap:10},headerCount:{fontSize:11,color:"var(--text-muted)"},toolbar:{padding:"10px 20px",flexShrink:0},searchRow:{display:"flex",gap:10,alignItems:"center"},searchWrap:{flex:1,position:"relative"},searchIcon:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--text-muted)",fontSize:13,pointerEvents:"none"},search:{width:"100%",padding:"7px 12px 7px 30px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},sortWrap:{display:"flex",gap:2},sortBtn:{padding:"5px 10px",background:"transparent",border:"1px solid transparent",borderRadius:4,fontSize:10,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer",transition:"all 0.1s"},catRow:{display:"flex",gap:4,marginTop:8,flexWrap:"wrap"},catBtn:{padding:"4px 12px",background:"transparent",border:"1px solid var(--border)",borderRadius:14,color:"var(--text-dim)",fontSize:10,fontFamily:"var(--font)",cursor:"pointer",transition:"all 0.1s"},catBtnActive:{borderColor:"var(--accent)",color:"var(--accent)",background:"rgba(51, 175, 188, 0.08)"},scrollArea:{flex:1,overflowY:"auto",padding:"4px 20px 20px"},featuredSection:{marginBottom:16},featuredLabel:{fontSize:11,fontWeight:700,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:1,marginBottom:8},featuredRow:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:8},featuredCard:{padding:"14px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",transition:"border-color 0.15s, transform 0.15s",position:"relative",overflow:"hidden"},featuredGradient:{display:"flex",alignItems:"center",marginBottom:10},featuredIcon:{width:40,height:40,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",fontSize:16,fontWeight:700,color:"var(--bg-base)"},featuredInfo:{flex:1},featuredName:{fontSize:13,fontWeight:700,color:"var(--text-bright)"},featuredAuthorRow:{display:"flex",alignItems:"center",gap:6,marginTop:2},featuredDesc:{fontSize:10,color:"var(--text-dim)",marginTop:6,lineHeight:1.45,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},connectedBadge:{position:"absolute",top:8,right:8,fontSize:8,fontWeight:600,color:"var(--green)",border:"1px solid var(--green)",borderRadius:3,padding:"1px 5px",textTransform:"uppercase",letterSpacing:.5},setupBadge:{position:"absolute",top:8,right:8,fontSize:8,fontWeight:600,color:"var(--amber)",border:"1px solid var(--amber)",borderRadius:3,padding:"1px 5px",textTransform:"uppercase",letterSpacing:.5},grid:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:8},empty:{padding:"60px 0",textAlign:"center",color:"var(--text-dim)",fontSize:12,gridColumn:"1 / -1"},card:{padding:"14px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:8,cursor:"pointer",transition:"border-color 0.12s, background 0.12s, transform 0.12s",display:"flex",flexDirection:"column"},cardTop:{display:"flex",alignItems:"center",gap:10},cardIcon:{width:36,height:36,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,color:"var(--bg-base)",flexShrink:0},cardInfo:{flex:1,minWidth:0},cardName:{fontSize:12,fontWeight:600,color:"var(--text-bright)"},cardAuthorRow:{display:"flex",alignItems:"center",gap:6,marginTop:2},connectedBadgeSm:{fontSize:8,fontWeight:600,color:"var(--green)",border:"1px solid var(--green)",borderRadius:3,padding:"1px 6px",textTransform:"uppercase",letterSpacing:.5,flexShrink:0},setupBadgeSm:{fontSize:8,fontWeight:600,color:"var(--amber)",border:"1px solid var(--amber)",borderRadius:3,padding:"1px 6px",textTransform:"uppercase",letterSpacing:.5,flexShrink:0},freeBadge:{fontSize:9,fontWeight:500,color:"var(--text-muted)",flexShrink:0},cardDesc:{fontSize:11,color:"var(--text-dim)",marginTop:10,lineHeight:1.5,flex:1,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},cardBottom:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:10,paddingTop:8,borderTop:"1px solid var(--border)"},cardStats:{display:"flex",gap:10},cardCredCount:{fontSize:10,color:"var(--text-muted)"},catTag:{fontSize:9,padding:"2px 8px",borderRadius:4,background:"var(--bg-active)",color:"var(--text-dim)",fontWeight:500}},Ge={overlay:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(2px)"},container:{width:"90%",maxWidth:520,maxHeight:"85vh",background:"var(--bg-chrome)",border:"1px solid var(--border)",borderRadius:10,overflowY:"auto",padding:"0 24px 24px",position:"relative"},topBar:{position:"sticky",top:0,background:"var(--bg-chrome)",padding:"16px 0 8px",display:"flex",alignItems:"center",justifyContent:"space-between",zIndex:1},closeBtn:{background:"none",border:"none",color:"var(--text-muted)",fontSize:20,cursor:"pointer",padding:"2px 6px",fontFamily:"var(--font)"},header:{display:"flex",gap:14,alignItems:"flex-start",marginBottom:16},icon:{width:52,height:52,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:20,fontWeight:700,color:"var(--bg-base)",flexShrink:0},headerInfo:{flex:1},name:{fontSize:17,fontWeight:700,color:"var(--text-bright)"},meta:{display:"flex",gap:10,marginTop:6,flexWrap:"wrap"},metaItem:{fontSize:11,color:"var(--text-dim)"},actionBar:{display:"flex",alignItems:"center",gap:8,padding:"12px 0",borderTop:"1px solid var(--border)",borderBottom:"1px solid var(--border)",marginBottom:16},installBtn:{flex:1,padding:"8px 16px",background:"var(--accent)",color:"var(--bg-base)",border:"none",borderRadius:6,fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},configureBtn:{flex:1,padding:"8px 16px",background:"var(--bg-active)",color:"var(--text-bright)",border:"1px solid var(--border)",borderRadius:6,fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},uninstallBtn:{padding:"8px 16px",background:"transparent",color:"var(--red)",border:"1px solid var(--red)",borderRadius:6,fontSize:12,fontWeight:500,cursor:"pointer",fontFamily:"var(--font)"},section:{marginBottom:16},sectionTitle:{fontSize:11,fontWeight:700,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:.5,marginBottom:8},description:{fontSize:12,color:"var(--text-primary)",lineHeight:1.6},tagRow:{display:"flex",gap:4,flexWrap:"wrap"},tag:{fontSize:10,padding:"2px 8px",borderRadius:4,background:"var(--bg-active)",color:"var(--text-dim)"},roleTag:{fontSize:10,padding:"2px 8px",borderRadius:4,background:"rgba(51, 175, 188, 0.08)",color:"var(--accent)",border:"1px solid rgba(51, 175, 188, 0.2)"},label:{display:"block",fontSize:11,fontWeight:600,color:"var(--text-primary)",marginBottom:4},input:{flex:1,padding:"7px 10px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:5,color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none"},saveBtn:{padding:"7px 14px",background:"var(--accent)",color:"var(--bg-base)",border:"none",borderRadius:5,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"}},K8=[{label:"Every 5 min",cron:"*/5 * * * *"},{label:"Every 15 min",cron:"*/15 * * * *"},{label:"Every hour",cron:"0 * * * *"},{label:"Every 6 hours",cron:"0 */6 * * *"},{label:"Daily 9 AM",cron:"0 9 * * *"},{label:"Weekdays 9 AM",cron:"0 9 * * 1-5"},{label:"Weekly (Mon)",cron:"0 0 * * 1"},{label:"Monthly",cron:"0 0 1 * *"}],J8=[{id:"backend",label:"Backend"},{id:"frontend",label:"Frontend"},{id:"fullstack",label:"Fullstack"},{id:"testing",label:"Testing"},{id:"devops",label:"DevOps"},{id:"docs",label:"Docs"},{id:"cmo",label:"CMO"},{id:"cfo",label:"CFO"},{id:"ea",label:"EA"},{id:"support",label:"Support"},{id:"analyst",label:"Analyst"}];function PE(t){if(!t)return"never";const e=Date.now()-new Date(t).getTime();return e<6e4?"just now":e<36e5?`${Math.floor(e/6e4)}m ago`:e<864e5?`${Math.floor(e/36e5)}h ago`:`${Math.floor(e/864e5)}d ago`}function EE({status:t}){const e={spawned:"var(--green)",skipped:"var(--amber)",error:"var(--red)"};return v.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:e[t]||"var(--text-muted)",display:"inline-block",marginRight:6}})}function eZ({onSubmit:t,onCancel:e}){const[i,n]=N.useState(""),[r,s]=N.useState("0 9 * * *"),[a,c]=N.useState("fullstack"),[h,d]=N.useState(""),[f,g]=N.useState(!1),[m,O]=N.useState("");async function S(_){if(_.preventDefault(),!i.trim()){O("Name is required");return}if(!h.trim()){O("Task prompt is required");return}g(!0),O("");try{await t({name:i.trim(),cron:r,agentConfig:{role:a,prompt:h.trim()}})}catch(w){O(w.message)}g(!1)}return v.jsxs("form",{onSubmit:S,style:Pe.form,children:[v.jsx("div",{style:Pe.formTitle,children:"New Schedule"}),v.jsx("label",{style:Pe.label,children:"NAME"}),v.jsx("input",{value:i,onChange:_=>n(_.target.value),placeholder:"e.g., Daily standup summary",style:Pe.input}),v.jsx("label",{style:Pe.label,children:"FREQUENCY"}),v.jsx("div",{style:Pe.presetRow,children:K8.map(_=>v.jsx("button",{type:"button",onClick:()=>s(_.cron),style:{...Pe.presetBtn,borderColor:r===_.cron?"var(--accent)":"var(--border)",color:r===_.cron?"var(--accent)":"var(--text-dim)",background:r===_.cron?"rgba(51, 175, 188, 0.08)":"transparent"},children:_.label},_.cron))}),v.jsx("input",{value:r,onChange:_=>s(_.target.value),placeholder:"* * * * * (min hr day mon wkday)",style:{...Pe.input,fontFamily:"var(--font)",fontSize:11}}),v.jsx("label",{style:Pe.label,children:"AGENT ROLE"}),v.jsx("div",{style:Pe.presetRow,children:J8.map(_=>v.jsx("button",{type:"button",onClick:()=>c(_.id),style:{...Pe.presetBtn,borderColor:a===_.id?"var(--accent)":"var(--border)",color:a===_.id?"var(--accent)":"var(--text-dim)",background:a===_.id?"rgba(51, 175, 188, 0.08)":"transparent"},children:_.label},_.id))}),v.jsx("label",{style:Pe.label,children:"TASK"}),v.jsx("textarea",{value:h,onChange:_=>d(_.target.value),placeholder:"What should this agent do each time it runs?",rows:3,style:Pe.textarea}),m&&v.jsx("div",{style:Pe.error,children:m}),v.jsxs("div",{style:Pe.formActions,children:[v.jsx("button",{type:"button",onClick:e,style:Pe.cancelBtn,children:"Cancel"}),v.jsx("button",{type:"submit",disabled:f,style:Pe.submitBtn,children:f?"Creating...":"Create Schedule"})]})]})}function tZ({schedule:t,onToggle:e,onRun:i,onDelete:n,onSelect:r}){var c;const[s,a]=N.useState(!1);return v.jsxs("div",{style:Pe.scheduleRow,onMouseEnter:h=>{h.currentTarget.style.background="var(--bg-hover)"},onMouseLeave:h=>{h.currentTarget.style.background="var(--bg-surface)"},children:[v.jsxs("div",{style:Pe.scheduleMain,onClick:()=>r(t),children:[v.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:t.enabled?t.isRunning?"var(--green)":"var(--accent)":"var(--text-muted)",flexShrink:0,animation:t.isRunning?"pulse 2s infinite":"none"}}),v.jsxs("div",{style:{flex:1,minWidth:0},children:[v.jsx("div",{style:Pe.scheduleName,children:t.name}),v.jsxs("div",{style:Pe.scheduleMeta,children:[v.jsx("span",{children:t.cronDescription||t.cron}),v.jsx("span",{style:{color:"var(--text-muted)"},children:(c=t.agentConfig)==null?void 0:c.role}),t.lastRun&&v.jsxs("span",{style:{color:"var(--text-muted)"},children:[v.jsx(EE,{status:t.lastRun.status}),PE(t.lastRun.timestamp)]})]})]})]}),v.jsxs("div",{style:Pe.scheduleActions,children:[v.jsx("button",{onClick:()=>e(t.id,!t.enabled),title:t.enabled?"Disable":"Enable",style:{...Pe.actionBtn,color:t.enabled?"var(--green)":"var(--text-muted)"},children:t.enabled?"ON":"OFF"}),v.jsx("button",{onClick:()=>i(t.id),title:"Run now",style:{...Pe.actionBtn,color:"var(--accent)"},children:"▶"}),s?v.jsx("button",{onClick:()=>{n(t.id),a(!1)},style:{...Pe.actionBtn,color:"var(--red)"},children:"confirm"}):v.jsx("button",{onClick:()=>a(!0),style:{...Pe.actionBtn,color:"var(--text-muted)"},children:"✕"})]})]})}function iZ({schedule:t,onClose:e}){var i,n;return t?v.jsxs("div",{style:Pe.detailPanel,children:[v.jsxs("div",{style:Pe.detailHeader,children:[v.jsx("div",{style:Pe.detailTitle,children:t.name}),v.jsx("button",{onClick:e,style:Pe.detailClose,children:"×"})]}),v.jsxs("div",{style:Pe.detailGrid,children:[v.jsx("div",{style:Pe.detailLabel,children:"Cron"}),v.jsx("div",{style:Pe.detailValue,children:t.cron}),v.jsx("div",{style:Pe.detailLabel,children:"Description"}),v.jsx("div",{style:Pe.detailValue,children:t.cronDescription}),v.jsx("div",{style:Pe.detailLabel,children:"Role"}),v.jsx("div",{style:Pe.detailValue,children:(i=t.agentConfig)==null?void 0:i.role}),v.jsx("div",{style:Pe.detailLabel,children:"Status"}),v.jsx("div",{style:Pe.detailValue,children:v.jsx("span",{style:{color:t.enabled?"var(--green)":"var(--text-muted)"},children:t.enabled?"Enabled":"Disabled"})}),v.jsx("div",{style:Pe.detailLabel,children:"Created"}),v.jsx("div",{style:Pe.detailValue,children:new Date(t.createdAt).toLocaleString()})]}),((n=t.agentConfig)==null?void 0:n.prompt)&&v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:Pe.detailLabel,children:"Task Prompt"}),v.jsx("pre",{style:Pe.promptPre,children:t.agentConfig.prompt})]}),(t.history||[]).length>0&&v.jsxs("div",{style:{marginTop:16},children:[v.jsx("div",{style:{...Pe.detailLabel,marginBottom:8},children:"Execution History"}),v.jsx("div",{style:Pe.historyList,children:t.history.slice(0,20).map((r,s)=>v.jsxs("div",{style:Pe.historyEntry,children:[v.jsx(EE,{status:r.status}),v.jsxs("span",{style:{fontSize:10,color:"var(--text-dim)",flex:1},children:[r.status,r.agentId&&v.jsxs("span",{style:{color:"var(--text-muted)"},children:[" (",r.agentId,")"]})]}),v.jsx("span",{style:{fontSize:9,color:"var(--text-muted)"},children:PE(r.timestamp)})]},s))})]})]}):null}function nZ(){const[t,e]=N.useState([]),[i,n]=N.useState(!0),[r,s]=N.useState(!1),[a,c]=N.useState(null),[h,d]=N.useState(""),f=N.useCallback(async()=>{try{const x=await fetch("/api/schedules");e(await x.json())}catch{}n(!1)},[]);N.useEffect(()=>{f();const x=setInterval(f,1e4);return()=>clearInterval(x)},[f]);async function g(x){const Q=await fetch("/api/schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!Q.ok){const k=await Q.json();throw new Error(k.error||"Failed to create schedule")}s(!1),await f(),w("Schedule created")}async function m(x,Q){await fetch(`/api/schedules/${x}/${Q?"enable":"disable"}`,{method:"POST"}),await f()}async function O(x){try{await fetch(`/api/schedules/${x}/run`,{method:"POST"}),w("Agent spawned"),await f()}catch{w("Failed to run")}}async function S(x){await fetch(`/api/schedules/${x}`,{method:"DELETE"}),(a==null?void 0:a.id)===x&&c(null),await f(),w("Schedule deleted")}async function _(x){try{const Q=await fetch(`/api/schedules/${x.id}`);c(await Q.json())}catch{c(x)}}function w(x){d(x),setTimeout(()=>d(""),3e3)}return v.jsxs("div",{style:Pe.root,children:[v.jsxs("div",{style:Pe.headerBar,children:[v.jsxs("div",{style:Pe.headerLeft,children:[v.jsx("div",{style:Pe.title,children:"Schedules"}),v.jsxs("span",{style:Pe.headerCount,children:[t.length," schedule",t.length!==1?"s":""," • ",t.filter(x=>x.enabled).length," active"]})]}),v.jsx("button",{onClick:()=>{s(!0),c(null)},style:Pe.createBtn,children:"+ New Schedule"})]}),h&&v.jsx("div",{style:Pe.statusMsg,children:h}),v.jsxs("div",{style:Pe.mainRow,children:[v.jsxs("div",{style:Pe.listArea,children:[r&&v.jsx(eZ,{onSubmit:g,onCancel:()=>s(!1)}),i&&t.length===0&&v.jsx("div",{style:Pe.empty,children:"Loading schedules..."}),!i&&t.length===0&&!r&&v.jsxs("div",{style:Pe.empty,children:[v.jsx("div",{style:{fontSize:13,marginBottom:8},children:"No schedules yet"}),v.jsx("div",{style:{fontSize:11,color:"var(--text-muted)"},children:"Create a schedule to run agents on a recurring basis — daily standups, weekly reports, monitoring checks."})]}),t.map(x=>v.jsx(tZ,{schedule:x,onToggle:m,onRun:O,onDelete:S,onSelect:_},x.id))]}),a&&v.jsx(iZ,{schedule:a,onClose:()=>c(null)})]})]})}const Pe={root:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},headerBar:{padding:"12px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},headerLeft:{display:"flex",alignItems:"center",gap:12},title:{fontSize:15,fontWeight:700,color:"var(--text-bright)",letterSpacing:.3},headerCount:{fontSize:11,color:"var(--text-muted)"},createBtn:{padding:"6px 14px",background:"var(--accent)",color:"var(--bg-base)",border:"none",borderRadius:6,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},statusMsg:{padding:"4px 20px",fontSize:10,color:"var(--green)",flexShrink:0},mainRow:{flex:1,display:"flex",overflow:"hidden"},listArea:{flex:1,overflowY:"auto",padding:"0 20px 20px"},empty:{padding:"60px 20px",textAlign:"center",color:"var(--text-dim)",fontSize:12},scheduleRow:{display:"flex",alignItems:"center",padding:"10px 12px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:6,marginBottom:4,cursor:"pointer",transition:"background 0.1s"},scheduleMain:{display:"flex",alignItems:"center",gap:10,flex:1,minWidth:0},scheduleName:{fontSize:12,fontWeight:600,color:"var(--text-bright)"},scheduleMeta:{display:"flex",gap:10,fontSize:10,color:"var(--text-dim)",marginTop:2},scheduleActions:{display:"flex",gap:4,flexShrink:0},actionBtn:{padding:"3px 8px",background:"transparent",border:"1px solid var(--border)",borderRadius:4,fontSize:9,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},form:{padding:"16px",background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:8,marginBottom:12},formTitle:{fontSize:13,fontWeight:700,color:"var(--text-bright)",marginBottom:12},label:{display:"block",fontSize:9,fontWeight:700,color:"var(--text-muted)",letterSpacing:.5,textTransform:"uppercase",marginTop:10,marginBottom:4},input:{width:"100%",padding:"7px 10px",background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:5,color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none",boxSizing:"border-box"},textarea:{width:"100%",padding:"7px 10px",background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:5,color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font)",outline:"none",resize:"vertical",boxSizing:"border-box"},presetRow:{display:"flex",gap:4,flexWrap:"wrap",marginBottom:6},presetBtn:{padding:"3px 10px",background:"transparent",border:"1px solid var(--border)",borderRadius:10,fontSize:10,fontWeight:500,fontFamily:"var(--font)",cursor:"pointer",transition:"all 0.1s"},error:{fontSize:11,color:"var(--red)",marginTop:8},formActions:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:14},cancelBtn:{padding:"6px 14px",background:"transparent",color:"var(--text-dim)",border:"1px solid var(--border)",borderRadius:5,fontSize:11,fontWeight:500,cursor:"pointer",fontFamily:"var(--font)"},submitBtn:{padding:"6px 14px",background:"var(--accent)",color:"var(--bg-base)",border:"none",borderRadius:5,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)"},detailPanel:{width:320,flexShrink:0,borderLeft:"1px solid var(--border)",padding:"16px",overflowY:"auto"},detailHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},detailTitle:{fontSize:14,fontWeight:700,color:"var(--text-bright)"},detailClose:{background:"none",border:"none",color:"var(--text-muted)",fontSize:18,cursor:"pointer",fontFamily:"var(--font)"},detailGrid:{display:"grid",gridTemplateColumns:"80px 1fr",gap:"6px 10px"},detailLabel:{fontSize:10,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase"},detailValue:{fontSize:11,color:"var(--text-primary)"},promptPre:{fontSize:11,color:"var(--text-primary)",lineHeight:1.5,padding:"8px 10px",background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:4,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font)",maxHeight:200,overflowY:"auto",marginTop:4},historyList:{display:"flex",flexDirection:"column",gap:4},historyEntry:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:4,background:"var(--bg-base)"}},h2={javascript:"#e5c07b",typescript:"#61afef",css:"#c678dd",html:"#e06c75",json:"#4ae168",markdown:"#c678dd",python:"#61afef",rust:"#e06c75",go:"#33afbc",shell:"#4ae168",text:"#abb2bf"};function RE({entry:t,depth:e,activeFile:i,expandedDirs:n,onToggleDir:r,onFileClick:s,onContextMenu:a,renamingPath:c,renameValue:h,onRenameChange:d,onRenameSubmit:f,onRenameCancel:g}){const m=t.type==="dir",O=n.has(t.path),S=!m&&t.path===i,_=c===t.path,x=Ce(Q=>Q.editorTreeCache)[t.path]||[];return v.jsxs(v.Fragment,{children:[v.jsxs("div",{onClick:()=>m?r(t.path,t.hasChildren):s(t.path),onContextMenu:Q=>a(Q,t),style:{...Ht.row,paddingLeft:12+e*16,background:S?"var(--bg-active)":"transparent",borderLeft:S?"2px solid var(--accent)":"2px solid transparent"},children:[m?v.jsx("span",{style:Ht.arrow,children:O?"▾":"▸"}):v.jsx("span",{style:{...Ht.fileDot,background:h2[t.language]||h2.text}}),_?v.jsx("input",{autoFocus:!0,value:h,onChange:Q=>d(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&f(),Q.key==="Escape"&&g()},onBlur:g,onClick:Q=>Q.stopPropagation(),style:Ht.renameInput}):v.jsx("span",{style:{...Ht.name,color:m?"var(--text-primary)":S?"var(--text-bright)":"var(--text-primary)",fontWeight:m?600:400},children:t.name}),!m&&!_&&t.size>0&&v.jsx("span",{style:Ht.size,children:rZ(t.size)})]}),m&&O&&x.map(Q=>v.jsx(RE,{entry:Q,depth:e+1,activeFile:i,expandedDirs:n,onToggleDir:r,onFileClick:s,onContextMenu:a,renamingPath:c,renameValue:h,onRenameChange:d,onRenameSubmit:f,onRenameCancel:g},Q.path))]})}function rZ(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(0)}K`:`${(t/(1024*1024)).toFixed(1)}M`}function sZ({x:t,y:e,entry:i,onClose:n,onAction:r}){const s=N.useRef(null);N.useEffect(()=>{const h=d=>{s.current&&!s.current.contains(d.target)&&n()};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]);const a=(i==null?void 0:i.type)==="dir",c=[{label:"New File",action:a?"newFileIn":"newFileSibling"},{label:"New Folder",action:a?"newDirIn":"newDirSibling"},{sep:!0},{label:"Rename",action:"rename"},{label:"Delete",action:"delete",danger:!0}];return v.jsx("div",{ref:s,style:{...Ht.contextMenu,left:t,top:e},children:c.map((h,d)=>h.sep?v.jsx("div",{style:Ht.contextSep},d):v.jsx("div",{onClick:()=>{r(h.action,i),n()},style:{...Ht.contextItem,color:h.danger?"var(--red)":"var(--text-primary)"},children:h.label},h.action))})}function u2({placeholder:t,onSubmit:e,onCancel:i,depth:n}){const[r,s]=N.useState("");return v.jsx("div",{style:{...Ht.row,paddingLeft:12+(n||0)*16},children:v.jsx("input",{autoFocus:!0,placeholder:t,value:r,onChange:a=>s(a.target.value),onKeyDown:a=>{a.key==="Enter"&&r.trim()&&e(r.trim()),a.key==="Escape"&&i()},onBlur:i,style:Ht.renameInput})})}function oZ(){const t=Ce(j=>j.editorTreeCache),e=Ce(j=>j.editorActiveFile),i=Ce(j=>j.fetchTreeDir),n=Ce(j=>j.openFile),r=Ce(j=>j.createFile),s=Ce(j=>j.createDir),a=Ce(j=>j.deleteFile),c=Ce(j=>j.renameFile),[h,d]=N.useState(new Set([""])),[f,g]=N.useState(""),[m,O]=N.useState(null),[S,_]=N.useState(null),[w,x]=N.useState(null),[Q,k]=N.useState("");N.useEffect(()=>{i("")},[i]);const T=N.useCallback((j,D)=>{d(E=>{const X=new Set(E);return X.has(j)?X.delete(j):(X.add(j),(D||!t[j])&&i(j)),X})},[i,t]),M=N.useCallback((j,D)=>{j.preventDefault(),j.stopPropagation(),O({x:j.clientX,y:j.clientY,entry:D})},[]),$=N.useCallback(async(j,D)=>{const E=D.path.includes("/")?D.path.split("/").slice(0,-1).join("/"):"";switch(j){case"newFileIn":_({type:"file",parentPath:D.path}),d(X=>{const P=new Set(X);return P.add(D.path),t[D.path]||i(D.path),P});break;case"newDirIn":_({type:"dir",parentPath:D.path}),d(X=>{const P=new Set(X);return P.add(D.path),t[D.path]||i(D.path),P});break;case"newFileSibling":_({type:"file",parentPath:E});break;case"newDirSibling":_({type:"dir",parentPath:E});break;case"rename":x(D.path),k(D.name);break;case"delete":confirm(`Delete "${D.name}"?`)&&await a(D.path);break}},[a,i,t]),R=N.useCallback(async j=>{if(!S)return;const D=S.parentPath?`${S.parentPath}/${j}`:j,E=S.type==="file"?await r(D):await s(D);_(null),E&&S.type==="file"&&n(D)},[S,r,s,n]),V=N.useCallback(async()=>{if(!w||!Q.trim()){x(null);return}const j=w.includes("/")?w.split("/").slice(0,-1).join("/"):"",D=j?`${j}/${Q.trim()}`:Q.trim();D!==w&&await c(w,D),x(null)},[w,Q,c]),H=N.useCallback(j=>{j.target===j.currentTarget&&(j.preventDefault(),O({x:j.clientX,y:j.clientY,entry:{type:"dir",path:"",name:"root"}}))},[]),ee=t[""]||[],I=f?ee.filter(j=>j.name.toLowerCase().includes(f.toLowerCase())):ee;return S&&(S.parentPath===""||S.parentPath.split("/").length),v.jsxs("div",{style:Ht.container,children:[v.jsxs("div",{style:Ht.toolbar,children:[v.jsx("span",{style:Ht.toolbarTitle,children:"FILES"}),v.jsxs("div",{style:Ht.toolbarActions,children:[v.jsx("button",{onClick:()=>_({type:"file",parentPath:""}),title:"New File",style:Ht.toolbarBtn,children:v.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[v.jsx("path",{d:"M3 1.5h6l4 4V14a.5.5 0 01-.5.5h-9A.5.5 0 013 14V2a.5.5 0 01.5-.5z"}),v.jsx("path",{d:"M9 1.5V5.5h4"}),v.jsx("path",{d:"M8 8.5v4M6 10.5h4",strokeLinecap:"round"})]})}),v.jsx("button",{onClick:()=>_({type:"dir",parentPath:""}),title:"New Folder",style:Ht.toolbarBtn,children:v.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:[v.jsx("path",{d:"M1.5 3.5h4l1.5 1.5H14a.5.5 0 01.5.5v8a.5.5 0 01-.5.5H2a.5.5 0 01-.5-.5V4z"}),v.jsx("path",{d:"M8 8v3M6.5 9.5h3",strokeLinecap:"round"})]})})]})]}),v.jsx("div",{style:Ht.searchWrap,children:v.jsx("input",{type:"text",placeholder:"Filter...",value:f,onChange:j=>g(j.target.value),style:Ht.searchInput})}),v.jsxs("div",{style:Ht.tree,onContextMenu:H,children:[I.length===0&&!S&&v.jsx("div",{style:Ht.empty,children:ee.length===0?"Loading...":"No matches"}),S&&S.parentPath===""&&v.jsx(u2,{placeholder:S.type==="file"?"filename.ext":"folder-name",onSubmit:R,onCancel:()=>_(null),depth:0}),I.map(j=>v.jsxs(Ul.Fragment,{children:[v.jsx(RE,{entry:j,depth:0,activeFile:e,expandedDirs:h,onToggleDir:T,onFileClick:n,onContextMenu:M,renamingPath:w,renameValue:Q,onRenameChange:k,onRenameSubmit:V,onRenameCancel:()=>x(null)}),S&&S.parentPath===j.path&&h.has(j.path)&&v.jsx(u2,{placeholder:S.type==="file"?"filename.ext":"folder-name",onSubmit:R,onCancel:()=>_(null),depth:1})]},j.path))]}),m&&v.jsx(sZ,{x:m.x,y:m.y,entry:m.entry,onClose:()=>O(null),onAction:$})]})}const Ht={container:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-chrome)",position:"relative"},toolbar:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",borderBottom:"1px solid var(--border)"},toolbarTitle:{fontSize:10,fontWeight:700,letterSpacing:1,color:"var(--text-dim)",textTransform:"uppercase"},toolbarActions:{display:"flex",gap:2},toolbarBtn:{background:"none",border:"none",color:"var(--text-dim)",fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:"var(--font)",padding:"2px 5px",borderRadius:3,lineHeight:1},searchWrap:{padding:"6px 8px",borderBottom:"1px solid var(--border)"},searchInput:{width:"100%",padding:"5px 8px",background:"var(--bg-base)",border:"1px solid var(--border)",borderRadius:3,color:"var(--text-primary)",fontSize:11,fontFamily:"var(--font)",outline:"none"},tree:{flex:1,overflowY:"auto",overflowX:"hidden"},row:{display:"flex",alignItems:"center",gap:6,padding:"4px 12px",cursor:"pointer",transition:"background 0.08s",whiteSpace:"nowrap"},arrow:{fontSize:10,color:"var(--text-muted)",width:10,flexShrink:0,textAlign:"center"},fileDot:{width:6,height:6,borderRadius:"50%",flexShrink:0},name:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},size:{fontSize:9,color:"var(--text-muted)",flexShrink:0},empty:{padding:16,textAlign:"center",fontSize:11,color:"var(--text-dim)"},renameInput:{flex:1,padding:"2px 6px",background:"var(--bg-base)",border:"1px solid var(--accent)",borderRadius:2,color:"var(--text-bright)",fontSize:12,fontFamily:"var(--font)",outline:"none",minWidth:0},contextMenu:{position:"fixed",zIndex:300,background:"var(--bg-surface)",border:"1px solid var(--border)",borderRadius:4,padding:"4px 0",minWidth:160,boxShadow:"0 8px 24px rgba(0,0,0,0.4)",fontFamily:"var(--font)"},contextItem:{padding:"6px 14px",fontSize:11,cursor:"pointer",transition:"background 0.08s"},contextSep:{height:1,background:"var(--border)",margin:"4px 0"}};function aZ(){const t=Ce(s=>s.editorOpenTabs),e=Ce(s=>s.editorActiveFile),i=Ce(s=>s.editorFiles),n=Ce(s=>s.setActiveFile),r=Ce(s=>s.closeFile);return t.length===0?null:v.jsx("div",{style:Bh.container,children:t.map(s=>{const a=i[s],c=s===e,h=a&&a.content!==a.originalContent,d=s.split("/").pop();return v.jsxs("div",{onClick:()=>n(s),title:s,style:{...Bh.tab,color:c?"var(--text-bright)":"var(--text-primary)",borderBottom:c?"1px solid var(--accent)":"1px solid transparent",background:c?"var(--bg-base)":"transparent"},children:[h&&v.jsx("span",{style:Bh.dirtyDot}),v.jsx("span",{style:Bh.tabName,children:d}),v.jsx("button",{onClick:f=>{f.stopPropagation(),r(s)},style:Bh.closeBtn,children:"x"})]},s)})})}const Bh={container:{display:"flex",alignItems:"center",height:32,flexShrink:0,background:"var(--bg-chrome)",borderBottom:"1px solid var(--border)",overflowX:"auto",overflowY:"hidden"},tab:{display:"flex",alignItems:"center",gap:5,padding:"0 12px",height:"100%",cursor:"pointer",whiteSpace:"nowrap",fontSize:11,fontFamily:"var(--font)",transition:"background 0.08s",borderRight:"1px solid rgba(75, 82, 99, 0.4)",flexShrink:0},tabName:{overflow:"hidden",textOverflow:"ellipsis",maxWidth:140},dirtyDot:{width:6,height:6,borderRadius:"50%",background:"var(--amber)",flexShrink:0},closeBtn:{background:"none",border:"none",color:"var(--text-muted)",fontSize:10,cursor:"pointer",fontFamily:"var(--font)",padding:"0 2px",lineHeight:1,opacity:.6}};let By=[],AE=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,i=0;e<t.length;e++)(e%2?AE:By).push(i=i+t[e])})();function lZ(t){if(t<768)return!1;for(let e=0,i=By.length;;){let n=e+i>>1;if(t<By[n])i=n;else if(t>=AE[n])e=n+1;else return!0;if(e==i)return!1}}function d2(t){return t>=127462&&t<=127487}const f2=8205;function cZ(t,e,i=!0,n=!0){return(i?ME:hZ)(t,e,n)}function ME(t,e,i){if(e==t.length)return e;e&&zE(t.charCodeAt(e))&&jE(t.charCodeAt(e-1))&&e--;let n=mv(t,e);for(e+=p2(n);e<t.length;){let r=mv(t,e);if(n==f2||r==f2||i&&lZ(r))e+=p2(r),n=r;else if(d2(r)){let s=0,a=e-2;for(;a>=0&&d2(mv(t,a));)s++,a-=2;if(s%2==0)break;e+=2}else break}return e}function hZ(t,e,i){for(;e>0;){let n=ME(t,e-2,i);if(n<e)return n;e--}return 0}function mv(t,e){let i=t.charCodeAt(e);if(!jE(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return zE(n)?(i-55296<<10)+(n-56320)+65536:i}function zE(t){return t>=56320&&t<57344}function jE(t){return t>=55296&&t<56320}function p2(t){return t<65536?1:2}let dt=class DE{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,i,n){[e,i]=_c(this,e,i);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(i,this.length,r,1),Br.from(r,this.length-(i-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=_c(this,e,i);let n=[];return this.decompose(e,i,n,0),Br.from(n,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new uu(this),s=new uu(e);for(let a=i,c=i;;){if(r.next(a),s.next(a),a=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(c+=r.value.length,r.done||c>=n)return!0}}iter(e=1){return new uu(this,e)}iterRange(e,i=this.length){return new BE(this,e,i)}iterLines(e,i){let n;if(e==null)n=this.iter();else{i==null&&(i=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new LE(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?DE.empty:e.length<=32?new Ut(e):Br.from(Ut.split(e,[]))}};class Ut extends dt{constructor(e,i=uZ(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,n,r){for(let s=0;;s++){let a=this.text[s],c=r+a.length;if((i?n:c)>=e)return new dZ(r,c,n,a);r=c+1,n++}}decompose(e,i,n,r){let s=e<=0&&i>=this.length?this:new Ut(g2(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(r&1){let a=n.pop(),c=jp(s.text,a.text.slice(),0,s.length);if(c.length<=32)n.push(new Ut(c,a.length+s.length));else{let h=c.length>>1;n.push(new Ut(c.slice(0,h)),new Ut(c.slice(h)))}}else n.push(s)}replace(e,i,n){if(!(n instanceof Ut))return super.replace(e,i,n);[e,i]=_c(this,e,i);let r=jp(this.text,jp(n.text,g2(this.text,0,e)),i),s=this.length+n.length-(i-e);return r.length<=32?new Ut(r,s):Br.from(Ut.split(r,[]),s)}sliceString(e,i=this.length,n=`
78
78
  `){[e,i]=_c(this,e,i);let r="";for(let s=0,a=0;s<=i&&a<this.text.length;a++){let c=this.text[a],h=s+c.length;s>e&&a&&(r+=n),e<h&&i>s&&(r+=c.slice(Math.max(0,e-s),i-s)),s=h+1}return r}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(i.push(new Ut(n,r)),n=[],r=-1);return r>-1&&i.push(new Ut(n,r)),i}}class Br extends dt{constructor(e,i){super(),this.children=e,this.length=i,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,i,n,r){for(let s=0;;s++){let a=this.children[s],c=r+a.length,h=n+a.lines-1;if((i?h:c)>=e)return a.lineInner(e,i,n,r);r=c+1,n=h+1}}decompose(e,i,n,r){for(let s=0,a=0;a<=i&&s<this.children.length;s++){let c=this.children[s],h=a+c.length;if(e<=h&&i>=a){let d=r&((a<=e?1:0)|(h>=i?2:0));a>=e&&h<=i&&!d?n.push(c):c.decompose(e-a,i-a,n,d)}a=h+1}}replace(e,i,n){if([e,i]=_c(this,e,i),n.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let a=this.children[r],c=s+a.length;if(e>=s&&i<=c){let h=a.replace(e-s,i-s,n),d=this.lines-a.lines+h.lines;if(h.lines<d>>4&&h.lines>d>>6){let f=this.children.slice();return f[r]=h,new Br(f,this.length-(i-e)+n.length)}return super.replace(s,c,h)}s=c+1}return super.replace(e,i,n)}sliceString(e,i=this.length,n=`
79
79
  `){[e,i]=_c(this,e,i);let r="";for(let s=0,a=0;s<this.children.length&&a<=i;s++){let c=this.children[s],h=a+c.length;a>e&&s&&(r+=n),e<h&&i>a&&(r+=c.sliceString(e-a,i-a,n)),a=h+1}return r}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof Br))return 0;let n=0,[r,s,a,c]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=i,s+=i){if(r==a||s==c)return n;let h=this.children[r],d=e.children[s];if(h!=d)return n+h.scanIdentical(d,i);n+=h.length+1}}static from(e,i=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let O of e)n+=O.lines;if(n<32){let O=[];for(let S of e)S.flatten(O);return new Ut(O,i)}let r=Math.max(32,n>>5),s=r<<1,a=r>>1,c=[],h=0,d=-1,f=[];function g(O){let S;if(O.lines>s&&O instanceof Br)for(let _ of O.children)g(_);else O.lines>a&&(h>a||!h)?(m(),c.push(O)):O instanceof Ut&&h&&(S=f[f.length-1])instanceof Ut&&O.lines+S.lines<=32?(h+=O.lines,d+=O.length+1,f[f.length-1]=new Ut(S.text.concat(O.text),S.length+1+O.length)):(h+O.lines>r&&m(),h+=O.lines,d+=O.length+1,f.push(O))}function m(){h!=0&&(c.push(f.length==1?f[0]:Br.from(f,d)),d=-1,h=f.length=0)}for(let O of e)g(O);return m(),c.length==1?c[0]:new Br(c,i)}}dt.empty=new Ut([""],0);function uZ(t){let e=-1;for(let i of t)e+=i.length+1;return e}function jp(t,e,i=0,n=1e9){for(let r=0,s=0,a=!0;s<t.length&&r<=n;s++){let c=t[s],h=r+c.length;h>=i&&(h>n&&(c=c.slice(0,n-r)),r<i&&(c=c.slice(i-r)),a?(e[e.length-1]+=c,a=!1):e.push(c)),r=h+1}return e}function g2(t,e,i){return jp(t,[""],e,i)}class uu{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof Ut?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],a=s>>1,c=r instanceof Ut?r.text.length:r.children.length;if(a==(i>0?c:0)){if(n==0)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(i>0?0:1)){if(this.offsets[n]+=i,e==0)return this.lineBreak=!0,this.value=`
80
80
  `,this;e--}else if(r instanceof Ut){let h=r.text[a+(i<0?-1:0)];if(this.offsets[n]+=i,h.length>Math.max(0,e))return this.value=e==0?h:i>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=r.children[a+(i<0?-1:0)];e>h.length?(e-=h.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(i>0?1:(h instanceof Ut?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class BE{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new uu(e,i>n?-1:1),this.pos=i>n?e.length:0,this.from=Math.min(i,n),this.to=Math.max(i,n)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let n=i<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*i,this.value=r.length<=n?r:i<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class LE{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:n,value:r}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(dt.prototype[Symbol.iterator]=function(){return this.iter()},uu.prototype[Symbol.iterator]=BE.prototype[Symbol.iterator]=LE.prototype[Symbol.iterator]=function(){return this});let dZ=class{constructor(e,i,n,r){this.from=e,this.to=i,this.number=n,this.text=r}get length(){return this.to-this.from}};function _c(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function xi(t,e,i=!0,n=!0){return cZ(t,e,i,n)}function fZ(t){return t>=56320&&t<57344}function pZ(t){return t>=55296&&t<56320}function To(t,e){let i=t.charCodeAt(e);if(!pZ(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return fZ(n)?(i-55296<<10)+(n-56320)+65536:i}function XE(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Ca(t){return t<65536?1:2}const Ly=/\r\n?|\n/;var Ji=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Ji||(Ji={}));class Ir{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i+1];e+=n<0?this.sections[i]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,n=0,r=0;i<this.sections.length;){let s=this.sections[i++],a=this.sections[i++];a<0?(e(n,r,s),r+=s):r+=a,n+=s}}iterChangedRanges(e,i=!1){Xy(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];r<0?e.push(n,r):e.push(r,n)}return new Ir(e)}composeDesc(e){return this.empty?e:e.empty?this:NE(this,e)}mapDesc(e,i=!1){return e.empty?this:Ny(this,e,i)}mapPos(e,i=-1,n=Ji.Simple){let r=0,s=0;for(let a=0;a<this.sections.length;){let c=this.sections[a++],h=this.sections[a++],d=r+c;if(h<0){if(d>e)return s+(e-r);s+=c}else{if(n!=Ji.Simple&&d>=e&&(n==Ji.TrackDel&&r<e&&d>e||n==Ji.TrackBefore&&r<e||n==Ji.TrackAfter&&d>e))return null;if(d>e||d==e&&i<0&&!c)return e==r||i<0?s:s+h;s+=h}r=d}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,i=e){for(let n=0,r=0;n<this.sections.length&&r<=i;){let s=this.sections[n++],a=this.sections[n++],c=r+s;if(a>=0&&r<=i&&c>=e)return r<e&&c>i?"cover":!0;r=c}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ir(e)}static create(e){return new Ir(e)}}class fi extends Ir{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Xy(this,(i,n,r,s,a)=>e=e.replace(r,r+(n-i),a),!1),e}mapDesc(e,i=!1){return Ny(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,s=0;r<i.length;r+=2){let a=i[r],c=i[r+1];if(c>=0){i[r]=c,i[r+1]=a;let h=r>>1;for(;n.length<h;)n.push(dt.empty);n.push(a?e.slice(s,s+a):dt.empty)}s+=a}return new fi(i,n)}compose(e){return this.empty?e:e.empty?this:NE(this,e,!0)}map(e,i=!1){return e.empty?this:Ny(this,e,i,!0)}iterChanges(e,i=!1){Xy(this,e,i)}get desc(){return Ir.create(this.sections)}filter(e){let i=[],n=[],r=[],s=new $u(this);e:for(let a=0,c=0;;){let h=a==e.length?1e9:e[a++];for(;c<h||c==h&&s.len==0;){if(s.done)break e;let f=Math.min(s.len,h-c);Ni(r,f,-1);let g=s.ins==-1?-1:s.off==0?s.ins:0;Ni(i,f,g),g>0&&Ao(n,i,s.text),s.forward(f),c+=f}let d=e[a++];for(;c<d;){if(s.done)break e;let f=Math.min(s.len,d-c);Ni(i,f,-1),Ni(r,f,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(f),c+=f}}return{changes:new fi(i,n),filtered:Ir.create(r)}}toJSON(){let e=[];for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i],r=this.sections[i+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[i>>1].toJSON()))}return e}static of(e,i,n){let r=[],s=[],a=0,c=null;function h(f=!1){if(!f&&!r.length)return;a<i&&Ni(r,i-a,-1);let g=new fi(r,s);c=c?c.compose(g.map(c)):g,r=[],s=[],a=0}function d(f){if(Array.isArray(f))for(let g of f)d(g);else if(f instanceof fi){if(f.length!=i)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${i})`);h(),c=c?c.compose(f.map(c)):f}else{let{from:g,to:m=g,insert:O}=f;if(g>m||g<0||m>i)throw new RangeError(`Invalid change range ${g} to ${m} (in doc of length ${i})`);let S=O?typeof O=="string"?dt.of(O.split(n||Ly)):O:dt.empty,_=S.length;if(g==m&&_==0)return;g<a&&h(),g>a&&Ni(r,g-a,-1),Ni(r,m-g,_),Ao(s,r,S),a=m}}return d(e),h(!c),c}static empty(e){return new fi(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")i.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((a,c)=>c&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)i.push(s[0],0);else{for(;n.length<r;)n.push(dt.empty);n[r]=dt.of(s.slice(1)),i.push(s[0],n[r].length)}}}return new fi(i,n)}static createSet(e,i){return new fi(e,i)}}function Ni(t,e,i,n=!1){if(e==0&&i<=0)return;let r=t.length-2;r>=0&&i<=0&&i==t[r+1]?t[r]+=e:r>=0&&e==0&&t[r]==0?t[r+1]+=i:n?(t[r]+=e,t[r+1]+=i):t.push(e,i)}function Ao(t,e,i){if(i.length==0)return;let n=e.length-2>>1;if(n<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<n;)t.push(dt.empty);t.push(i)}}function Xy(t,e,i){let n=t.inserted;for(let r=0,s=0,a=0;a<t.sections.length;){let c=t.sections[a++],h=t.sections[a++];if(h<0)r+=c,s+=c;else{let d=r,f=s,g=dt.empty;for(;d+=c,f+=h,h&&n&&(g=g.append(n[a-2>>1])),!(i||a==t.sections.length||t.sections[a+1]<0);)c=t.sections[a++],h=t.sections[a++];e(r,d,s,f,g),r=d,s=f}}}function Ny(t,e,i,n=!1){let r=[],s=n?[]:null,a=new $u(t),c=new $u(e);for(let h=-1;;){if(a.done&&c.len||c.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&c.ins==-1){let d=Math.min(a.len,c.len);Ni(r,d,-1),a.forward(d),c.forward(d)}else if(c.ins>=0&&(a.ins<0||h==a.i||a.off==0&&(c.len<a.len||c.len==a.len&&!i))){let d=c.len;for(Ni(r,c.ins,-1);d;){let f=Math.min(a.len,d);a.ins>=0&&h<a.i&&a.len<=f&&(Ni(r,0,a.ins),s&&Ao(s,r,a.text),h=a.i),a.forward(f),d-=f}c.next()}else if(a.ins>=0){let d=0,f=a.len;for(;f;)if(c.ins==-1){let g=Math.min(f,c.len);d+=g,f-=g,c.forward(g)}else if(c.ins==0&&c.len<f)f-=c.len,c.next();else break;Ni(r,d,h<a.i?a.ins:0),s&&h<a.i&&Ao(s,r,a.text),h=a.i,a.forward(a.len-f)}else{if(a.done&&c.done)return s?fi.createSet(r,s):Ir.create(r);throw new Error("Mismatched change set lengths")}}}function NE(t,e,i=!1){let n=[],r=i?[]:null,s=new $u(t),a=new $u(e);for(let c=!1;;){if(s.done&&a.done)return r?fi.createSet(n,r):Ir.create(n);if(s.ins==0)Ni(n,s.len,0,c),s.next();else if(a.len==0&&!a.done)Ni(n,0,a.ins,c),r&&Ao(r,n,a.text),a.next();else{if(s.done||a.done)throw new Error("Mismatched change set lengths");{let h=Math.min(s.len2,a.len),d=n.length;if(s.ins==-1){let f=a.ins==-1?-1:a.off?0:a.ins;Ni(n,h,f,c),r&&f&&Ao(r,n,a.text)}else a.ins==-1?(Ni(n,s.off?0:s.len,h,c),r&&Ao(r,n,s.textBit(h))):(Ni(n,s.off?0:s.len,a.off?0:a.ins,c),r&&!a.off&&Ao(r,n,a.text));c=(s.ins>h||a.ins>=0&&a.len>h)&&(c||n.length>d),s.forward2(h),a.forward(h)}}}}class $u{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length?dt.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?dt.empty:i[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Pa{constructor(e,i,n){this.from=e,this.to=i,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,i=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,i):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new Pa(n,r,this.flags)}extend(e,i=e,n=0){if(e<=this.anchor&&i>=this.anchor)return le.range(e,i,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return le.range(this.anchor,r,void 0,void 0,n)}eq(e,i=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!i||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return le.range(e.anchor,e.head)}static create(e,i,n){return new Pa(e,i,n)}}class le{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:le.create(this.ranges.map(n=>n.map(e,i)),this.mainIndex)}eq(e,i=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],i))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new le([this.main],0)}addRange(e,i=!0){return le.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let n=this.ranges.slice();return n[i]=e,le.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new le(e.ranges.map(i=>Pa.fromJSON(i)),e.main)}static single(e,i=e){return new le([le.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=n:s.from<n)return le.normalized(e.slice(),i);n=s.to}return new le(e,i)}static cursor(e,i=0,n,r){return Pa.create(e,e,(i==0?0:i<0?8:16)|(n==null?7:Math.min(6,n))|(r??16777215)<<6)}static range(e,i,n,r,s){let a=(n??16777215)<<6|(r==null?7:Math.min(6,r));return!s&&e!=i&&(s=i<e?1:-1),i<e?Pa.create(i,e,48|a):Pa.create(e,i,(s?s<0?8:16:0)|a)}static normalized(e,i=0){let n=e[i];e.sort((r,s)=>r.from-s.from),i=e.indexOf(n);for(let r=1;r<e.length;r++){let s=e[r],a=e[r-1];if(s.empty?s.from<=a.to:s.from<a.to){let c=a.from,h=Math.max(s.to,a.to);r<=i&&i--,e.splice(--r,2,s.anchor>s.head?le.range(h,c):le.range(c,h))}}return new le(e,i)}}function ZE(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let G1=0;class xe{constructor(e,i,n,r,s){this.combine=e,this.compareInput=i,this.compare=n,this.isStatic=r,this.id=G1++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new xe(e.combine||(i=>i),e.compareInput||((i,n)=>i===n),e.compare||(e.combine?(i,n)=>i===n:F1),!!e.static,e.enables)}of(e){return new Dp([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dp(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dp(e,this,2,i)}from(e,i){return i||(i=n=>n),this.compute([e],n=>i(n.field(e)))}}function F1(t,e){return t==e||t.length==e.length&&t.every((i,n)=>i===e[n])}class Dp{constructor(e,i,n,r){this.dependencies=e,this.facet=i,this.type=n,this.value=r,this.id=G1++}dynamicSlot(e){var i;let n=this.value,r=this.facet.compareInput,s=this.id,a=e[s]>>1,c=this.type==2,h=!1,d=!1,f=[];for(let g of this.dependencies)g=="doc"?h=!0:g=="selection"?d=!0:(((i=e[g.id])!==null&&i!==void 0?i:1)&1)==0&&f.push(e[g.id]);return{create(g){return g.values[a]=n(g),1},update(g,m){if(h&&m.docChanged||d&&(m.docChanged||m.selection)||Zy(g,f)){let O=n(g);if(c?!m2(O,g.values[a],r):!r(O,g.values[a]))return g.values[a]=O,1}return 0},reconfigure:(g,m)=>{let O,S=m.config.address[s];if(S!=null){let _=gg(m,S);if(this.dependencies.every(w=>w instanceof xe?m.facet(w)===g.facet(w):w instanceof Nn?m.field(w,!1)==g.field(w,!1):!0)||(c?m2(O=n(g),_,r):r(O=n(g),_)))return g.values[a]=_,0}else O=n(g);return g.values[a]=O,1}}}}function m2(t,e,i){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!i(t[n],e[n]))return!1;return!0}function Zy(t,e){let i=!1;for(let n of e)du(t,n)&1&&(i=!0);return i}function gZ(t,e,i){let n=i.map(h=>t[h.id]),r=i.map(h=>h.type),s=n.filter(h=>!(h&1)),a=t[e.id]>>1;function c(h){let d=[];for(let f=0;f<n.length;f++){let g=gg(h,n[f]);if(r[f]==2)for(let m of g)d.push(m);else d.push(g)}return e.combine(d)}return{create(h){for(let d of n)du(h,d);return h.values[a]=c(h),1},update(h,d){if(!Zy(h,s))return 0;let f=c(h);return e.compare(f,h.values[a])?0:(h.values[a]=f,1)},reconfigure(h,d){let f=Zy(h,n),g=d.config.facets[e.id],m=d.facet(e);if(g&&!f&&F1(i,g))return h.values[a]=m,0;let O=c(h);return e.compare(O,m)?(h.values[a]=m,0):(h.values[a]=O,1)}}}const tp=xe.define({static:!0});class Nn{constructor(e,i,n,r,s){this.id=e,this.createF=i,this.updateF=n,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let i=new Nn(G1++,e.create,e.update,e.compare||((n,r)=>n===r),e);return e.provide&&(i.provides=e.provide(i)),i}create(e){let i=e.facet(tp).find(n=>n.field==this);return((i==null?void 0:i.create)||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:n=>(n.values[i]=this.create(n),1),update:(n,r)=>{let s=n.values[i],a=this.updateF(s,r);return this.compareF(s,a)?0:(n.values[i]=a,1)},reconfigure:(n,r)=>{let s=n.facet(tp),a=r.facet(tp),c;return(c=s.find(h=>h.field==this))&&c!=a.find(h=>h.field==this)?(n.values[i]=c.create(n),1):r.config.address[this.id]!=null?(n.values[i]=r.field(this),0):(n.values[i]=this.create(n),1)}}}init(e){return[this,tp.of({field:this,create:e})]}get extension(){return this}}const Ta={lowest:4,low:3,default:2,high:1,highest:0};function Lh(t){return e=>new WE(e,t)}const Bs={highest:Lh(Ta.highest),high:Lh(Ta.high),default:Lh(Ta.default),low:Lh(Ta.low),lowest:Lh(Ta.lowest)};class WE{constructor(e,i){this.inner=e,this.prec=i}}class nd{of(e){return new Wy(this,e)}reconfigure(e){return nd.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Wy{constructor(e,i){this.compartment=e,this.inner=i}}class pg{constructor(e,i,n,r,s,a){for(this.base=e,this.compartments=i,this.dynamicSlots=n,this.address=r,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let i=this.address[e.id];return i==null?e.default:this.staticValues[i>>1]}static resolve(e,i,n){let r=[],s=Object.create(null),a=new Map;for(let m of mZ(e,i,a))m instanceof Nn?r.push(m):(s[m.facet.id]||(s[m.facet.id]=[])).push(m);let c=Object.create(null),h=[],d=[];for(let m of r)c[m.id]=d.length<<1,d.push(O=>m.slot(O));let f=n==null?void 0:n.config.facets;for(let m in s){let O=s[m],S=O[0].facet,_=f&&f[m]||[];if(O.every(w=>w.type==0))if(c[S.id]=h.length<<1|1,F1(_,O))h.push(n.facet(S));else{let w=S.combine(O.map(x=>x.value));h.push(n&&S.compare(w,n.facet(S))?n.facet(S):w)}else{for(let w of O)w.type==0?(c[w.id]=h.length<<1|1,h.push(w.value)):(c[w.id]=d.length<<1,d.push(x=>w.dynamicSlot(x)));c[S.id]=d.length<<1,d.push(w=>gZ(w,S,O))}}let g=d.map(m=>m(c));return new pg(e,a,g,c,h,s)}}function mZ(t,e,i){let n=[[],[],[],[],[]],r=new Map;function s(a,c){let h=r.get(a);if(h!=null){if(h<=c)return;let d=n[h].indexOf(a);d>-1&&n[h].splice(d,1),a instanceof Wy&&i.delete(a.compartment)}if(r.set(a,c),Array.isArray(a))for(let d of a)s(d,c);else if(a instanceof Wy){if(i.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;i.set(a.compartment,d),s(d,c)}else if(a instanceof WE)s(a.inner,a.prec);else if(a instanceof Nn)n[c].push(a),a.provides&&s(a.provides,c);else if(a instanceof Dp)n[c].push(a),a.facet.extensions&&s(a.facet.extensions,Ta.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(d,c)}}return s(t,Ta.default),n.reduce((a,c)=>a.concat(c))}function du(t,e){if(e&1)return 2;let i=e>>1,n=t.status[i];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;t.status[i]=4;let r=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|r}function gg(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const qE=xe.define(),qy=xe.define({combine:t=>t.some(e=>e),static:!0}),VE=xe.define({combine:t=>t.length?t[0]:void 0,static:!0}),IE=xe.define(),YE=xe.define(),HE=xe.define(),UE=xe.define({combine:t=>t.length?t[0]:!1});class Ls{constructor(e,i){this.type=e,this.value=i}static define(){return new OZ}}class OZ{of(e){return new Ls(this,e)}}class vZ{constructor(e){this.map=e}of(e){return new et(this,e)}}class et{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new et(this.type,i)}is(e){return this.type==e}static define(e={}){return new vZ(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let n=[];for(let r of e){let s=r.map(i);s&&n.push(s)}return n}}et.reconfigure=et.define();et.appendConfig=et.define();class oi{constructor(e,i,n,r,s,a){this.startState=e,this.changes=i,this.selection=n,this.effects=r,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,n&&ZE(n,i.newLength),s.some(c=>c.type==oi.time)||(this.annotations=s.concat(oi.time.of(Date.now())))}static create(e,i,n,r,s,a){return new oi(e,i,n,r,s,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(oi.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}oi.time=Ls.define();oi.userEvent=Ls.define();oi.addToHistory=Ls.define();oi.remote=Ls.define();function yZ(t,e){let i=[];for(let n=0,r=0;;){let s,a;if(n<t.length&&(r==e.length||e[r]>=t[n]))s=t[n++],a=t[n++];else if(r<e.length)s=e[r++],a=e[r++];else return i;!i.length||i[i.length-1]<s?i.push(s,a):i[i.length-1]<a&&(i[i.length-1]=a)}}function GE(t,e,i){var n;let r,s,a;return i?(r=e.changes,s=fi.empty(e.changes.length),a=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),s=t.changes.mapDesc(e.changes,!0),a=t.changes.compose(r)),{changes:a,selection:e.selection?e.selection.map(s):(n=t.selection)===null||n===void 0?void 0:n.map(r),effects:et.mapEffects(t.effects,r).concat(et.mapEffects(e.effects,s)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Vy(t,e,i){let n=e.selection,r=sc(e.annotations);return e.userEvent&&(r=r.concat(oi.userEvent.of(e.userEvent))),{changes:e.changes instanceof fi?e.changes:fi.of(e.changes||[],i,t.facet(VE)),selection:n&&(n instanceof le?n:le.single(n.anchor,n.head)),effects:sc(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function FE(t,e,i){let n=Vy(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(i=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(i=!1);let a=!!e[s].sequential;n=GE(n,Vy(t,e[s],a?n.changes.newLength:t.doc.length),a)}let r=oi.create(t,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return bZ(i?SZ(r):r)}function SZ(t){let e=t.startState,i=!0;for(let r of e.facet(IE)){let s=r(t);if(s===!1){i=!1;break}Array.isArray(s)&&(i=i===!0?s:yZ(i,s))}if(i!==!0){let r,s;if(i===!1)s=t.changes.invertedDesc,r=fi.empty(e.doc.length);else{let a=t.changes.filter(i);r=a.changes,s=a.filtered.mapDesc(a.changes).invertedDesc}t=oi.create(e,r,t.selection&&t.selection.map(s),et.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(YE);for(let r=n.length-1;r>=0;r--){let s=n[r](t);s instanceof oi?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof oi?t=s[0]:t=FE(e,sc(s),!1)}return t}function bZ(t){let e=t.startState,i=e.facet(HE),n=t;for(let r=i.length-1;r>=0;r--){let s=i[r](t);s&&Object.keys(s).length&&(n=GE(n,Vy(e,s,t.changes.newLength),!0))}return n==t?t:oi.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}const _Z=[];function sc(t){return t==null?_Z:Array.isArray(t)?t:[t]}var Gt=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Gt||(Gt={}));const xZ=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Iy;try{Iy=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function wZ(t){if(Iy)return Iy.test(t);for(let e=0;e<t.length;e++){let i=t[e];if(/\w/.test(i)||i>"€"&&(i.toUpperCase()!=i.toLowerCase()||xZ.test(i)))return!0}return!1}function kZ(t){return e=>{if(!/\S/.test(e))return Gt.Space;if(wZ(e))return Gt.Word;for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>-1)return Gt.Word;return Gt.Other}}class ct{constructor(e,i,n,r,s,a){this.config=e,this.doc=i,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)du(this,c<<1);this.computeSlot=null}field(e,i=!0){let n=this.config.address[e.id];if(n==null){if(i)throw new RangeError("Field is not present in this state");return}return du(this,n),gg(this,n)}update(...e){return FE(this,e,!0)}applyTransaction(e){let i=this.config,{base:n,compartments:r}=i;for(let c of e.effects)c.is(nd.reconfigure)?(i&&(r=new Map,i.compartments.forEach((h,d)=>r.set(d,h)),i=null),r.set(c.value.compartment,c.value.extension)):c.is(et.reconfigure)?(i=null,n=c.value):c.is(et.appendConfig)&&(i=null,n=sc(n).concat(c.value));let s;i?s=e.startState.values.slice():(i=pg.resolve(n,r,this),s=new ct(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(h,d)=>d.reconfigure(h,this),null).values);let a=e.startState.facet(qy)?e.newSelection:e.newSelection.asSingle();new ct(i,e.newDoc,a,s,(c,h)=>h.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:le.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,n=e(i.ranges[0]),r=this.changes(n.changes),s=[n.range],a=sc(n.effects);for(let c=1;c<i.ranges.length;c++){let h=e(i.ranges[c]),d=this.changes(h.changes),f=d.map(r);for(let m=0;m<c;m++)s[m]=s[m].map(f);let g=r.mapDesc(d,!0);s.push(h.range.map(g)),r=r.compose(f),a=et.mapEffects(a,f).concat(et.mapEffects(sc(h.effects),g))}return{changes:r,selection:le.create(s,i.mainIndex),effects:a}}changes(e=[]){return e instanceof fi?e:fi.of(e,this.doc.length,this.facet(ct.lineSeparator))}toText(e){return dt.of(e.split(this.facet(ct.lineSeparator)||Ly))}sliceDoc(e=0,i=this.doc.length){return this.doc.sliceString(e,i,this.lineBreak)}facet(e){let i=this.config.address[e.id];return i==null?e.default:(du(this,i),gg(this,i))}toJSON(e){let i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Nn&&this.config.address[r.id]!=null&&(i[n]=r.spec.toJSON(this.field(e[n]),this))}return i}static fromJSON(e,i={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let s in n)if(Object.prototype.hasOwnProperty.call(e,s)){let a=n[s],c=e[s];r.push(a.init(h=>a.spec.fromJSON(c,h)))}}return ct.create({doc:e.doc,selection:le.fromJSON(e.selection),extensions:i.extensions?r.concat([i.extensions]):r})}static create(e={}){let i=pg.resolve(e.extensions||[],new Map),n=e.doc instanceof dt?e.doc:dt.of((e.doc||"").split(i.staticFacet(ct.lineSeparator)||Ly)),r=e.selection?e.selection instanceof le?e.selection:le.single(e.selection.anchor,e.selection.head):le.single(0);return ZE(r,n.length),i.staticFacet(qy)||(r=r.asSingle()),new ct(i,n,r,i.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(ct.tabSize)}get lineBreak(){return this.facet(ct.lineSeparator)||`
@@ -126,7 +126,7 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
126
126
  `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(t){let e=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:e.scrollTop+t*this._renderService.dimensions.css.cell.height})}scrollToLine(t,e){e&&(this._latestYDisp=t),this._scrollableElement.setScrollPosition({reuseAnimation:!e,scrollTop:t*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var t;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((t=this._optionsService.rawOptions.overviewRuler)==null?void 0:t.width)||14}}queueSync(t){t!==void 0&&(this._latestYDisp=t),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(t=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,t!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:t*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(t){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let e=Math.round(t.scrollTop/this._renderService.dimensions.css.cell.height),i=e-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=e,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};r1=qt([be(2,tn),be(3,Xs),be(4,JM),be(5,Dc),be(6,nn),be(7,Ns)],r1);var s1=class extends Fe{constructor(t,e,i,n,r){super(),this._screenElement=t,this._bufferService=e,this._coreBrowserService=i,this._decorationService=n,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(zt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let t of this._decorationService.decorations)this._renderDecoration(t);this._dimensionsChanged=!1}_renderDecoration(t){this._refreshStyle(t),this._dimensionsChanged&&this._refreshXPosition(t)}_createElement(t){var n;let e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((n=t==null?void 0:t.options)==null?void 0:n.layer)==="top"),e.style.width=`${Math.round((t.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=`${(t.options.height||1)*this._renderService.dimensions.css.cell.height}px`,e.style.top=`${(t.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=t.options.x??0;return i&&i>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(t,e),e}_refreshStyle(t){let e=t.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)t.element&&(t.element.style.display="none",t.onRenderEmitter.fire(t.element));else{let i=this._decorationElements.get(t);i||(i=this._createElement(t),t.element=i,this._decorationElements.set(t,i),this._container.appendChild(i),t.onDispose(()=>{this._decorationElements.delete(t),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((t.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(t.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${e*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),t.onRenderEmitter.fire(i)}}_refreshXPosition(t,e=t.element){if(!e)return;let i=t.options.x??0;(t.options.anchor||"left")==="right"?e.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":e.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(t){var e;(e=this._decorationElements.get(t))==null||e.remove(),this._decorationElements.delete(t),t.dispose()}};s1=qt([be(1,tn),be(2,Xs),be(3,pd),be(4,Ns)],s1);var YK=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(t){if(t.options.overviewRulerOptions){for(let e of this._zones)if(e.color===t.options.overviewRulerOptions.color&&e.position===t.options.overviewRulerOptions.position){if(this._lineIntersectsZone(e,t.marker.line))return;if(this._lineAdjacentToZone(e,t.marker.line,t.options.overviewRulerOptions.position)){this._addLineToZone(e,t.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=t.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=t.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=t.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=t.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:t.options.overviewRulerOptions.color,position:t.options.overviewRulerOptions.position,startBufferLine:t.marker.line,endBufferLine:t.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(t){this._linePadding=t}_lineIntersectsZone(t,e){return e>=t.startBufferLine&&e<=t.endBufferLine}_lineAdjacentToZone(t,e,i){return e>=t.startBufferLine-this._linePadding[i||"full"]&&e<=t.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(t,e){t.startBufferLine=Math.min(t.startBufferLine,e),t.endBufferLine=Math.max(t.endBufferLine,e)}},Ar={full:0,left:0,center:0,right:0},wo={full:0,left:0,center:0,right:0},Yh={full:0,left:0,center:0,right:0},Ug=class extends Fe{constructor(t,e,i,n,r,s,a,c){var d;super(),this._viewportElement=t,this._screenElement=e,this._bufferService=i,this._decorationService=n,this._renderService=r,this._optionsService=s,this._themeService=a,this._coreBrowserService=c,this._colorZoneStore=new YK,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(d=this._viewportElement.parentElement)==null||d.insertBefore(this._canvas,this._viewportElement),this._register(zt(()=>{var f;return(f=this._canvas)==null?void 0:f.remove()}));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var t;return((t=this._optionsService.options.overviewRuler)==null?void 0:t.width)||0}_refreshDrawConstants(){let t=Math.floor((this._canvas.width-1)/3),e=Math.ceil((this._canvas.width-1)/3);wo.full=this._canvas.width,wo.left=t,wo.center=e,wo.right=t,this._refreshDrawHeightConstants(),Yh.full=1,Yh.left=1,Yh.center=1+wo.left,Yh.right=1+wo.left+wo.center}_refreshDrawHeightConstants(){Ar.full=Math.round(2*this._coreBrowserService.dpr);let t=this._canvas.height/this._bufferService.buffer.lines.length,e=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);Ar.left=e,Ar.center=e,Ar.right=e}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ar.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ar.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ar.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ar.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let t=this._colorZoneStore.zones;for(let e of t)e.position!=="full"&&this._renderColorZone(e);for(let e of t)e.position==="full"&&this._renderColorZone(e);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(Yh[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-Ar[t.position||"full"]/2),wo[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ar[t.position||"full"]))}_queueRefresh(t,e){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=e||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Ug=qt([be(2,tn),be(3,pd),be(4,Ns),be(5,nn),be(6,Dc),be(7,Xs)],Ug);var ue;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
127
127
  `,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(ue||(ue={}));var Jp;(t=>(t.PAD="€",t.HOP="",t.BPH="‚",t.NBH="ƒ",t.IND="„",t.NEL="…",t.SSA="†",t.ESA="‡",t.HTS="ˆ",t.HTJ="‰",t.VTS="Š",t.PLD="‹",t.PLU="Œ",t.RI="",t.SS2="Ž",t.SS3="",t.DCS="",t.PU1="‘",t.PU2="’",t.STS="“",t.CCH="”",t.MW="•",t.SPA="–",t.EPA="—",t.SOS="˜",t.SGCI="™",t.SCI="š",t.CSI="›",t.ST="œ",t.OSC="",t.PM="ž",t.APC="Ÿ"))(Jp||(Jp={}));var Sz;(t=>t.ST=`${ue.ESC}\\`)(Sz||(Sz={}));var o1=class{constructor(t,e,i,n,r,s){this._textarea=t,this._compositionView=e,this._bufferService=i,this._optionsService=n,this._coreService=r,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(t){this._compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(t){if(this._isComposing||this._isSendingComposition){if(t.keyCode===20||t.keyCode===229||t.keyCode===16||t.keyCode===17||t.keyCode===18)return!1;this._finalizeComposition(!1)}return t.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(t){if(this._compositionView.classList.remove("active"),this._isComposing=!1,t){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;e.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(e.start,this._compositionPosition.start):i=this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let t=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let e=this._textarea.value,i=e.replace(t,"");this._dataAlreadySent=i,e.length>t.length?this._coreService.triggerDataEvent(i,!0):e.length<t.length?this._coreService.triggerDataEvent(`${ue.DEL}`,!0):e.length===t.length&&e!==t&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(t){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}t||setTimeout(()=>this.updateCompositionElements(!0),0)}}};o1=qt([be(2,tn),be(3,nn),be(4,el),be(5,Ns)],o1);var yi=0,Si=0,bi=0,Zt=0,u$={css:"#00000000",rgba:0},si;(t=>{function e(r,s,a,c){return c!==void 0?`#${Sa(r)}${Sa(s)}${Sa(a)}${Sa(c)}`:`#${Sa(r)}${Sa(s)}${Sa(a)}`}t.toCss=e;function i(r,s,a,c=255){return(r<<24|s<<16|a<<8|c)>>>0}t.toRgba=i;function n(r,s,a,c){return{css:t.toCss(r,s,a,c),rgba:t.toRgba(r,s,a,c)}}t.toColor=n})(si||(si={}));var Et;(t=>{function e(h,d){if(Zt=(d.rgba&255)/255,Zt===1)return{css:d.css,rgba:d.rgba};let f=d.rgba>>24&255,g=d.rgba>>16&255,m=d.rgba>>8&255,O=h.rgba>>24&255,S=h.rgba>>16&255,_=h.rgba>>8&255;yi=O+Math.round((f-O)*Zt),Si=S+Math.round((g-S)*Zt),bi=_+Math.round((m-_)*Zt);let w=si.toCss(yi,Si,bi),x=si.toRgba(yi,Si,bi);return{css:w,rgba:x}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function n(h,d,f){let g=eg.ensureContrastRatio(h.rgba,d.rgba,f);if(g)return si.toColor(g>>24&255,g>>16&255,g>>8&255)}t.ensureContrastRatio=n;function r(h){let d=(h.rgba|255)>>>0;return[yi,Si,bi]=eg.toChannels(d),{css:si.toCss(yi,Si,bi),rgba:d}}t.opaque=r;function s(h,d){return Zt=Math.round(d*255),[yi,Si,bi]=eg.toChannels(h.rgba),{css:si.toCss(yi,Si,bi,Zt),rgba:si.toRgba(yi,Si,bi,Zt)}}t.opacity=s;function a(h,d){return Zt=h.rgba&255,s(h,Zt*d/255)}t.multiplyOpacity=a;function c(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=c})(Et||(Et={}));var Bt;(t=>{let e,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let s=r.getContext("2d",{willReadFrequently:!0});s&&(e=s,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function n(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return yi=parseInt(r.slice(1,2).repeat(2),16),Si=parseInt(r.slice(2,3).repeat(2),16),bi=parseInt(r.slice(3,4).repeat(2),16),si.toColor(yi,Si,bi);case 5:return yi=parseInt(r.slice(1,2).repeat(2),16),Si=parseInt(r.slice(2,3).repeat(2),16),bi=parseInt(r.slice(3,4).repeat(2),16),Zt=parseInt(r.slice(4,5).repeat(2),16),si.toColor(yi,Si,bi,Zt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let s=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return yi=parseInt(s[1]),Si=parseInt(s[2]),bi=parseInt(s[3]),Zt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),si.toColor(yi,Si,bi,Zt);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[yi,Si,bi,Zt]=e.getImageData(0,0,1,1).data,Zt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:si.toRgba(yi,Si,bi,Zt),css:r}}t.toColor=n})(Bt||(Bt={}));var Fi;(t=>{function e(n){return i(n>>16&255,n>>8&255,n&255)}t.relativeLuminance=e;function i(n,r,s){let a=n/255,c=r/255,h=s/255,d=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+f*.7152+g*.0722}t.relativeLuminance2=i})(Fi||(Fi={}));var eg;(t=>{function e(a,c){if(Zt=(c&255)/255,Zt===1)return c;let h=c>>24&255,d=c>>16&255,f=c>>8&255,g=a>>24&255,m=a>>16&255,O=a>>8&255;return yi=g+Math.round((h-g)*Zt),Si=m+Math.round((d-m)*Zt),bi=O+Math.round((f-O)*Zt),si.toRgba(yi,Si,bi)}t.blend=e;function i(a,c,h){let d=Fi.relativeLuminance(a>>8),f=Fi.relativeLuminance(c>>8);if(_s(d,f)<h){if(f<d){let O=n(a,c,h),S=_s(d,Fi.relativeLuminance(O>>8));if(S<h){let _=r(a,c,h),w=_s(d,Fi.relativeLuminance(_>>8));return S>w?O:_}return O}let g=r(a,c,h),m=_s(d,Fi.relativeLuminance(g>>8));if(m<h){let O=n(a,c,h),S=_s(d,Fi.relativeLuminance(O>>8));return m>S?g:O}return g}}t.ensureContrastRatio=i;function n(a,c,h){let d=a>>24&255,f=a>>16&255,g=a>>8&255,m=c>>24&255,O=c>>16&255,S=c>>8&255,_=_s(Fi.relativeLuminance2(m,O,S),Fi.relativeLuminance2(d,f,g));for(;_<h&&(m>0||O>0||S>0);)m-=Math.max(0,Math.ceil(m*.1)),O-=Math.max(0,Math.ceil(O*.1)),S-=Math.max(0,Math.ceil(S*.1)),_=_s(Fi.relativeLuminance2(m,O,S),Fi.relativeLuminance2(d,f,g));return(m<<24|O<<16|S<<8|255)>>>0}t.reduceLuminance=n;function r(a,c,h){let d=a>>24&255,f=a>>16&255,g=a>>8&255,m=c>>24&255,O=c>>16&255,S=c>>8&255,_=_s(Fi.relativeLuminance2(m,O,S),Fi.relativeLuminance2(d,f,g));for(;_<h&&(m<255||O<255||S<255);)m=Math.min(255,m+Math.ceil((255-m)*.1)),O=Math.min(255,O+Math.ceil((255-O)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),_=_s(Fi.relativeLuminance2(m,O,S),Fi.relativeLuminance2(d,f,g));return(m<<24|O<<16|S<<8|255)>>>0}t.increaseLuminance=r;function s(a){return[a>>24&255,a>>16&255,a>>8&255,a&255]}t.toChannels=s})(eg||(eg={}));function Sa(t){let e=t.toString(16);return e.length<2?"0"+e:e}function _s(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var HK=class extends fd{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Gg=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new rr}register(t){let e={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(e),e.id}deregister(t){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===t)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(t);if(!e||e.length===0)return[];let i=[],n=e.translateToString(!0),r=0,s=0,a=0,c=e.getFg(0),h=e.getBg(0);for(let d=0;d<e.getTrimmedLength();d++)if(e.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==h){if(d-r>1){let f=this._getJoinedRanges(n,a,s,e,r);for(let g=0;g<f.length;g++)i.push(f[g])}r=d,a=s,c=this._workCell.fg,h=this._workCell.bg}s+=this._workCell.getChars().length||Mo.length}if(this._bufferService.cols-r>1){let d=this._getJoinedRanges(n,a,s,e,r);for(let f=0;f<d.length;f++)i.push(d[f])}return i}_getJoinedRanges(t,e,i,n,r){let s=t.substring(e,i),a=[];try{a=this._characterJoiners[0].handler(s)}catch(c){console.error(c)}for(let c=1;c<this._characterJoiners.length;c++)try{let h=this._characterJoiners[c].handler(s);for(let d=0;d<h.length;d++)Gg._mergeRanges(a,h[d])}catch(h){console.error(h)}return this._stringRangesToCellRanges(a,n,r),a}_stringRangesToCellRanges(t,e,i){let n=0,r=!1,s=0,a=t[n];if(a){for(let c=i;c<this._bufferService.cols;c++){let h=e.getWidth(c),d=e.getString(c).length||Mo.length;if(h!==0){if(!r&&a[0]<=s&&(a[0]=c,r=!0),a[1]<=s){if(a[1]=c,a=t[++n],!a)break;a[0]<=s?(a[0]=c,r=!0):r=!1}s+=d}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(t,e){let i=!1;for(let n=0;n<t.length;n++){let r=t[n];if(i){if(e[1]<=r[0])return t[n-1][1]=e[1],t;if(e[1]<=r[1])return t[n-1][1]=Math.max(e[1],r[1]),t.splice(n,1),t;t.splice(n,1),n--}else{if(e[1]<=r[0])return t.splice(n,0,e),t;if(e[1]<=r[1])return r[0]=Math.min(e[0],r[0]),t;e[0]<r[1]&&(r[0]=Math.min(e[0],r[0]),i=!0);continue}}return i?t[t.length-1][1]=e[1]:t.push(e),t}};Gg=qt([be(0,tn)],Gg);function UK(t){return 57508<=t&&t<=57558}function GK(t){return 9472<=t&&t<=9631}function FK(t){return UK(t)||GK(t)}function KK(){return{css:{canvas:Tp(),cell:Tp()},device:{canvas:Tp(),cell:Tp(),char:{width:0,height:0,left:0,top:0}}}}function Tp(){return{width:0,height:0}}var a1=class{constructor(t,e,i,n,r,s,a){this._document=t,this._characterJoinerService=e,this._optionsService=i,this._coreBrowserService=n,this._coreService=r,this._decorationService=s,this._themeService=a,this._workCell=new rr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(t,e,i){this._selectionStart=t,this._selectionEnd=e,this._columnSelectMode=i}createRow(t,e,i,n,r,s,a,c,h,d,f){let g=[],m=this._characterJoinerService.getJoinedCharacters(e),O=this._themeService.colors,S=t.getNoBgTrimmedLength();i&&S<s+1&&(S=s+1);let _,w=0,x="",Q=0,k=0,T=0,M=0,$=!1,R=0,V=!1,H=0,ee=0,I=[],j=d!==-1&&f!==-1;for(let D=0;D<S;D++){t.loadCell(D,this._workCell);let E=this._workCell.getWidth();if(E===0)continue;let X=!1,P=D>=ee,Z=D,L=this._workCell;if(m.length>0&&D===m[0][0]&&P){let me=m.shift(),Be=this._isCellInSelection(me[0],e);for(Q=me[0]+1;Q<me[1];Q++)P&&(P=Be===this._isCellInSelection(Q,e));P&&(P=!i||s<me[0]||s>=me[1]),P?(X=!0,L=new HK(this._workCell,t.translateToString(!0,me[0],me[1]),me[1]-me[0]),Z=me[1]-1,E=L.getWidth()):ee=me[1]}let B=this._isCellInSelection(D,e),G=i&&D===s,z=j&&D>=d&&D<=f,q=!1;this._decorationService.forEachDecorationAtCell(D,e,void 0,me=>{q=!0});let K=L.getChars()||Mo;if(K===" "&&(L.isUnderline()||L.isOverline())&&(K=" "),H=E*c-h.get(K,L.isBold(),L.isItalic()),!_)_=this._document.createElement("span");else if(w&&(B&&V||!B&&!V&&L.bg===k)&&(B&&V&&O.selectionForeground||L.fg===T)&&L.extended.ext===M&&z===$&&H===R&&!G&&!X&&!q&&P){L.isInvisible()?x+=Mo:x+=K,w++;continue}else w&&(_.textContent=x),_=this._document.createElement("span"),w=0,x="";if(k=L.bg,T=L.fg,M=L.extended.ext,$=z,R=H,V=B,X&&s>=D&&s<=Z&&(s=D),!this._coreService.isCursorHidden&&G&&this._coreService.isCursorInitialized){if(I.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&I.push("xterm-cursor-blink"),I.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":I.push("xterm-cursor-outline");break;case"block":I.push("xterm-cursor-block");break;case"bar":I.push("xterm-cursor-bar");break;case"underline":I.push("xterm-cursor-underline");break}}if(L.isBold()&&I.push("xterm-bold"),L.isItalic()&&I.push("xterm-italic"),L.isDim()&&I.push("xterm-dim"),L.isInvisible()?x=Mo:x=L.getChars()||Mo,L.isUnderline()&&(I.push(`xterm-underline-${L.extended.underlineStyle}`),x===" "&&(x=" "),!L.isUnderlineColorDefault()))if(L.isUnderlineColorRGB())_.style.textDecorationColor=`rgb(${fd.toColorRGB(L.getUnderlineColor()).join(",")})`;else{let me=L.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&L.isBold()&&me<8&&(me+=8),_.style.textDecorationColor=O.ansi[me].css}L.isOverline()&&(I.push("xterm-overline"),x===" "&&(x=" ")),L.isStrikethrough()&&I.push("xterm-strikethrough"),z&&(_.style.textDecoration="underline");let ie=L.getFgColor(),ce=L.getFgColorMode(),de=L.getBgColor(),pe=L.getBgColorMode(),fe=!!L.isInverse();if(fe){let me=ie;ie=de,de=me;let Be=ce;ce=pe,pe=Be}let ve,De,Ee=!1;this._decorationService.forEachDecorationAtCell(D,e,void 0,me=>{me.options.layer!=="top"&&Ee||(me.backgroundColorRGB&&(pe=50331648,de=me.backgroundColorRGB.rgba>>8&16777215,ve=me.backgroundColorRGB),me.foregroundColorRGB&&(ce=50331648,ie=me.foregroundColorRGB.rgba>>8&16777215,De=me.foregroundColorRGB),Ee=me.options.layer==="top")}),!Ee&&B&&(ve=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,de=ve.rgba>>8&16777215,pe=50331648,Ee=!0,O.selectionForeground&&(ce=50331648,ie=O.selectionForeground.rgba>>8&16777215,De=O.selectionForeground)),Ee&&I.push("xterm-decoration-top");let ke;switch(pe){case 16777216:case 33554432:ke=O.ansi[de],I.push(`xterm-bg-${de}`);break;case 50331648:ke=si.toColor(de>>16,de>>8&255,de&255),this._addStyle(_,`background-color:#${d$((de>>>0).toString(16),"0",6)}`);break;case 0:default:fe?(ke=O.foreground,I.push("xterm-bg-257")):ke=O.background}switch(ve||L.isDim()&&(ve=Et.multiplyOpacity(ke,.5)),ce){case 16777216:case 33554432:L.isBold()&&ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ie+=8),this._applyMinimumContrast(_,ke,O.ansi[ie],L,ve,void 0)||I.push(`xterm-fg-${ie}`);break;case 50331648:let me=si.toColor(ie>>16&255,ie>>8&255,ie&255);this._applyMinimumContrast(_,ke,me,L,ve,De)||this._addStyle(_,`color:#${d$(ie.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(_,ke,O.foreground,L,ve,De)||fe&&I.push("xterm-fg-257")}I.length&&(_.className=I.join(" "),I.length=0),!G&&!X&&!q&&P?w++:_.textContent=x,H!==this.defaultSpacing&&(_.style.letterSpacing=`${H}px`),g.push(_),D=Z}return _&&w&&(_.textContent=x),g}_applyMinimumContrast(t,e,i,n,r,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||FK(n.getCode()))return!1;let a=this._getContrastCache(n),c;if(!r&&!s&&(c=a.getColor(e.rgba,i.rgba)),c===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);c=Et.ensureContrastRatio(r||e,s||i,h),a.setColor((r||e).rgba,(s||i).rgba,c??null)}return c?(this._addStyle(t,`color:${c.css}`),!0):!1}_getContrastCache(t){return t.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(t,e){t.setAttribute("style",`${t.getAttribute("style")||""}${e};`)}_isCellInSelection(t,e){let i=this._selectionStart,n=this._selectionEnd;return!i||!n?!1:this._columnSelectMode?i[0]<=n[0]?t>=i[0]&&e>=i[1]&&t<n[0]&&e<=n[1]:t<i[0]&&e>=i[1]&&t>=n[0]&&e<=n[1]:e>i[1]&&e<n[1]||i[1]===n[1]&&e===i[1]&&t>=i[0]&&t<n[0]||i[1]<n[1]&&e===n[1]&&t<n[0]||i[1]<n[1]&&e===i[1]&&t>=i[0]}};a1=qt([be(1,iz),be(2,nn),be(3,Xs),be(4,el),be(5,pd),be(6,Dc)],a1);function d$(t,e,i){for(;t.length<i;)t=e+t;return t}var JK=class{constructor(t,e){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=t.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let i=t.createElement("span");i.classList.add("xterm-char-measure-element");let n=t.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let r=t.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let s=t.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[i,n,r,s],this._container.appendChild(i),this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(s),e.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(t,e,i,n){t===this._font&&e===this._fontSize&&i===this._weight&&n===this._weightBold||(this._font=t,this._fontSize=e,this._weight=i,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(t,e,i){let n=0;if(!e&&!i&&t.length===1&&(n=t.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let a=this._measure(t,0);return a>0&&(this._flat[n]=a),a}let r=t;e&&(r+="B"),i&&(r+="I");let s=this._holey.get(r);if(s===void 0){let a=0;e&&(a|=1),i&&(a|=2),s=this._measure(t,a),s>0&&this._holey.set(r,s)}return s}_measure(t,e){let i=this._measureElements[e];return i.textContent=t.repeat(32),i.offsetWidth/32}},eJ=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,e,i,n=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let r=t.buffers.active.ydisp,s=e[1]-r,a=i[1]-r,c=Math.max(s,0),h=Math.min(a,t.rows-1);if(c>=t.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=s,this.viewportEndRow=a,this.viewportCappedStartRow=c,this.viewportCappedEndRow=h,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e<this.endCol&&i<=this.viewportCappedEndRow:e<this.startCol&&i>=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol):!1}};function tJ(){return new eJ}var py="xterm-dom-renderer-owner-",Gn="xterm-rows",Qp="xterm-fg-",f$="xterm-bg-",Hh="xterm-focus",$p="xterm-selection",iJ=1,l1=class extends Fe{constructor(t,e,i,n,r,s,a,c,h,d,f,g,m,O){super(),this._terminal=t,this._document=e,this._element=i,this._screenElement=n,this._viewportElement=r,this._helperContainer=s,this._linkifier2=a,this._charSizeService=h,this._optionsService=d,this._bufferService=f,this._coreService=g,this._coreBrowserService=m,this._themeService=O,this._terminalClass=iJ++,this._rowElements=[],this._selectionRenderModel=tJ(),this.onRequestRedraw=this._register(new Oe).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Gn),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add($p),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=KK(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(S=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=c.createInstance(a1,document),this._element.classList.add(py+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(S=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline(S=>this._handleLinkLeave(S))),this._register(zt(()=>{this._element.classList.remove(py+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new JK(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let t=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*t,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*t),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/t),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/t),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let e=`${this._terminalSelector} .${Gn} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=e,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(t){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let e=`${this._terminalSelector} .${Gn} { pointer-events: none; color: ${t.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;e+=`${this._terminalSelector} .${Gn} .xterm-dim { color: ${Et.multiplyOpacity(t.foreground,.5).css};}`,e+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let i=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;e+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,e+=`@keyframes ${n} { 50% { box-shadow: none; }}`,e+=`@keyframes ${r} { 0% { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css}; } 50% { background-color: inherit; color: ${t.cursor.css}; }}`,e+=`${this._terminalSelector} .${Gn}.${Hh} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Gn}.${Hh} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Gn}.${Hh} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Gn} .xterm-cursor.xterm-cursor-block { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css};}${this._terminalSelector} .${Gn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${t.cursor.css} !important; color: ${t.cursorAccent.css} !important;}${this._terminalSelector} .${Gn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${t.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Gn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${t.cursor.css} inset;}${this._terminalSelector} .${Gn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${t.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,e+=`${this._terminalSelector} .${$p} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${$p} div { position: absolute; background-color: ${t.selectionBackgroundOpaque.css};}${this._terminalSelector} .${$p} div { position: absolute; background-color: ${t.selectionInactiveBackgroundOpaque.css};}`;for(let[s,a]of t.ansi.entries())e+=`${this._terminalSelector} .${Qp}${s} { color: ${a.css}; }${this._terminalSelector} .${Qp}${s}.xterm-dim { color: ${Et.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${f$}${s} { background-color: ${a.css}; }`;e+=`${this._terminalSelector} .${Qp}257 { color: ${Et.opaque(t.background).css}; }${this._terminalSelector} .${Qp}257.xterm-dim { color: ${Et.multiplyOpacity(Et.opaque(t.background),.5).css}; }${this._terminalSelector} .${f$}257 { background-color: ${t.foreground.css}; }`,this._themeStyleElement.textContent=e}_setDefaultSpacing(){let t=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${t}px`,this._rowFactory.defaultSpacing=t}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(t,e){for(let i=this._rowElements.length;i<=e;i++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(t,e){this._refreshRowElements(t,e),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Hh),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Hh),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(t,e,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(t,e,i),this.renderRows(0,this._bufferService.rows-1),!t||!e||(this._selectionRenderModel.update(this._terminal,t,e,i),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,c=this._document.createDocumentFragment();if(i){let h=t[0]>e[0];c.appendChild(this._createSelectionElement(s,h?e[0]:t[0],h?t[0]:e[0],a-s+1))}else{let h=n===s?t[0]:0,d=s===r?e[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(s,h,d));let f=a-s-1;if(c.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,f)),s!==a){let g=r===a?e[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(a,0,g))}}this._selectionContainer.appendChild(c)}_createSelectionElement(t,e,i,n=1){let r=this._document.createElement("div"),s=e*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(i-e);return s+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-s),r.style.height=`${n*this.dimensions.css.cell.height}px`,r.style.top=`${t*this.dimensions.css.cell.height}px`,r.style.left=`${s}px`,r.style.width=`${a}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let t of this._rowElements)t.replaceChildren()}renderRows(t,e){let i=this._bufferService.buffer,n=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,c=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=t;h<=e;h++){let d=h+i.ydisp,f=this._rowElements[h],g=i.lines.get(d);if(!f||!g)break;f.replaceChildren(...this._rowFactory.createRow(g,d,d===n,a,c,r,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${py}${this._terminalClass}`}_handleLinkHover(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!0)}_handleLinkLeave(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!1)}_setCellUnderline(t,e,i,n,r,s){i<0&&(t=0),n<0&&(e=0);let a=this._bufferService.rows-1;i=Math.max(Math.min(i,a),0),n=Math.max(Math.min(n,a),0),r=Math.min(r,this._bufferService.cols);let c=this._bufferService.buffer,h=c.ybase+c.y,d=Math.min(c.x,r-1),f=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,m=this._optionsService.rawOptions.cursorInactiveStyle;for(let O=i;O<=n;++O){let S=O+c.ydisp,_=this._rowElements[O],w=c.lines.get(S);if(!_||!w)break;_.replaceChildren(...this._rowFactory.createRow(w,S,S===h,g,m,d,f,this.dimensions.css.cell.width,this._widthCache,s?O===i?t:0:-1,s?(O===n?e:r)-1:-1))}}};l1=qt([be(7,Gb),be(8,$m),be(9,nn),be(10,tn),be(11,el),be(12,Xs),be(13,Dc)],l1);var c1=class extends Fe{constructor(t,e,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Oe),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new rJ(this._optionsService))}catch{this._measureStrategy=this._register(new nJ(t,e,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let t=this._measureStrategy.measure();(t.width!==this.width||t.height!==this.height)&&(this.width=t.width,this.height=t.height,this._onCharSizeChange.fire())}};c1=qt([be(2,nn)],c1);var bz=class extends Fe{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},nJ=class extends bz{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},rJ=class extends bz{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let e=this._ctx.measureText("W");if(!("width"in e&&"fontBoundingBoxAscent"in e&&"fontBoundingBoxDescent"in e))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}},sJ=class extends Fe{constructor(t,e,i){super(),this._textarea=t,this._window=e,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new oJ(this._window)),this._onDprChange=this._register(new Oe),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Oe),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(Ai.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ne(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ne(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(t){this._window!==t&&(this._window=t,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},oJ=class extends Fe{constructor(t){super(),this._parentWindow=t,this._windowResizeListener=this._register(new Ac),this._onDprChange=this._register(new Oe),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(zt(()=>this.clearListener()))}setWindow(t){this._parentWindow=t,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ne(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var t;this._outerListener&&((t=this._resolutionMediaMatchList)==null||t.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},aJ=class extends Fe{constructor(){super(),this.linkProviders=[],this._register(zt(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function r_(t,e,i){let n=i.getBoundingClientRect(),r=t.getComputedStyle(i),s=parseInt(r.getPropertyValue("padding-left")),a=parseInt(r.getPropertyValue("padding-top"));return[e.clientX-n.left-s,e.clientY-n.top-a]}function lJ(t,e,i,n,r,s,a,c,h){if(!s)return;let d=r_(t,e,i);if(d)return d[0]=Math.ceil((d[0]+(h?a/2:0))/a),d[1]=Math.ceil(d[1]/c),d[0]=Math.min(Math.max(d[0],1),n+(h?1:0)),d[1]=Math.min(Math.max(d[1],1),r),d}var h1=class{constructor(t,e){this._renderService=t,this._charSizeService=e}getCoords(t,e,i,n,r){return lJ(window,t,e,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(t,e){let i=r_(window,t,e);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};h1=qt([be(0,Ns),be(1,$m)],h1);var cJ=class{constructor(t,e){this._renderCallback=t,this._coreBrowserService=e,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(t){return this._refreshCallbacks.push(t),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(t,e,i){this._rowCount=i,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let t of this._refreshCallbacks)t(0);this._refreshCallbacks=[]}},_z={};yF(_z,{getSafariVersion:()=>uJ,isChromeOS:()=>Cz,isFirefox:()=>xz,isIpad:()=>dJ,isIphone:()=>fJ,isLegacyEdge:()=>hJ,isLinux:()=>s_,isMac:()=>Fg,isNode:()=>Pm,isSafari:()=>wz,isWindows:()=>kz});var Pm=typeof process<"u"&&"title"in process,gd=Pm?"node":navigator.userAgent,md=Pm?"node":navigator.platform,xz=gd.includes("Firefox"),hJ=gd.includes("Edge"),wz=/^((?!chrome|android).)*safari/i.test(gd);function uJ(){if(!wz)return 0;let t=gd.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var Fg=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(md),dJ=md==="iPad",fJ=md==="iPhone",kz=["Windows","Win16","Win32","WinCE"].includes(md),s_=md.indexOf("Linux")>=0,Cz=/\bCrOS\b/.test(gd),Tz=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(t){this._idleCallback=void 0;let e=0,i=0,n=t.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),r=t.timeRemaining(),i*1.5>r){n-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-e))}ms`),this._start();return}n=r}this.clear()}},pJ=class extends Tz{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},gJ=class extends Tz{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Kg=!Pm&&"requestIdleCallback"in window?gJ:pJ,mJ=class{constructor(){this._queue=new Kg}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},u1=class extends Fe{constructor(t,e,i,n,r,s,a,c,h){super(),this._rowCount=t,this._optionsService=i,this._charSizeService=n,this._coreService=r,this._coreBrowserService=c,this._renderer=this._register(new Ac),this._pausedResizeTask=new mJ,this._observerDisposable=this._register(new Ac),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Oe),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Oe),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Oe),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Oe),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new cJ((d,f)=>this._renderRows(d,f),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new OJ(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(zt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,e),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,e)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(t,e){if("IntersectionObserver"in t){let i=new t.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});i.observe(e),this._observerDisposable.value=zt(()=>i.disconnect())}}_handleIntersectionChange(t){this._isPaused=t.isIntersecting===void 0?t.intersectionRatio===0:!t.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(t,e,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(t,e);return}let n=this._syncOutputHandler.flush();n&&(t=Math.min(t,n.start),e=Math.max(e,n.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(t,e,this._rowCount)}_renderRows(t,e){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(t,e);return}t=Math.min(t,this._rowCount-1),e=Math.min(e,this._rowCount-1),this._renderer.value.renderRows(t,e),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:t,end:e}),this._onRender.fire({start:t,end:e}),this._isNextRenderRedrawOnly=!0}}resize(t,e){this._rowCount=e,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(t){this._renderer.value=t,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(t){return this._renderDebouncer.addRefreshCallback(t)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var t,e;this._renderer.value&&((e=(t=this._renderer.value).clearTextureAtlas)==null||e.call(t),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(t,e){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(t,e)}):this._renderer.value.handleResize(t,e),this._fullRefresh())}handleCharSizeChanged(){var t;(t=this._renderer.value)==null||t.handleCharSizeChanged()}handleBlur(){var t;(t=this._renderer.value)==null||t.handleBlur()}handleFocus(){var t;(t=this._renderer.value)==null||t.handleFocus()}handleSelectionChanged(t,e,i){var n;this._selectionState.start=t,this._selectionState.end=e,this._selectionState.columnSelectMode=i,(n=this._renderer.value)==null||n.handleSelectionChanged(t,e,i)}handleCursorMove(){var t;(t=this._renderer.value)==null||t.handleCursorMove()}clear(){var t;(t=this._renderer.value)==null||t.clear()}};u1=qt([be(2,nn),be(3,$m),be(4,el),be(5,pd),be(6,tn),be(7,Xs),be(8,Dc)],u1);var OJ=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function vJ(t,e,i,n){let r=i.buffer.x,s=i.buffer.y;if(!i.buffer.hasScrollback)return bJ(r,s,t,e,i,n)+Em(s,e,i,n)+_J(r,s,t,e,i,n);let a;if(s===e)return a=r>t?"D":"C",Hu(Math.abs(r-t),Yu(a,n));a=s>e?"D":"C";let c=Math.abs(s-e),h=SJ(s>e?t:r,i)+(c-1)*i.cols+1+yJ(s>e?r:t);return Hu(h,Yu(a,n))}function yJ(t,e){return t-1}function SJ(t,e){return e.cols-t}function bJ(t,e,i,n,r,s){return Em(e,n,r,s).length===0?"":Hu($z(t,e,t,e-Fa(e,r),!1,r).length,Yu("D",s))}function Em(t,e,i,n){let r=t-Fa(t,i),s=e-Fa(e,i),a=Math.abs(r-s)-xJ(t,e,i);return Hu(a,Yu(Qz(t,e),n))}function _J(t,e,i,n,r,s){let a;Em(e,n,r,s).length>0?a=n-Fa(n,r):a=e;let c=n,h=wJ(t,e,i,n,r,s);return Hu($z(t,a,i,c,h==="C",r).length,Yu(h,s))}function xJ(t,e,i){var a;let n=0,r=t-Fa(t,i),s=e-Fa(e,i);for(let c=0;c<Math.abs(r-s);c++){let h=Qz(t,e)==="A"?-1:1;(a=i.buffer.lines.get(r+h*c))!=null&&a.isWrapped&&n++}return n}function Fa(t,e){let i=0,n=e.buffer.lines.get(t),r=n==null?void 0:n.isWrapped;for(;r&&t>=0&&t<e.rows;)i++,n=e.buffer.lines.get(--t),r=n==null?void 0:n.isWrapped;return i}function wJ(t,e,i,n,r,s){let a;return Em(i,n,r,s).length>0?a=n-Fa(n,r):a=e,t<i&&a<=n||t>=i&&a<n?"C":"D"}function Qz(t,e){return t>e?"A":"B"}function $z(t,e,i,n,r,s){let a=t,c=e,h="";for(;(a!==i||c!==n)&&c>=0&&c<s.buffer.lines.length;)a+=r?1:-1,r&&a>s.cols-1?(h+=s.buffer.translateBufferLineToString(c,!1,t,a),a=0,t=0,c++):!r&&a<0&&(h+=s.buffer.translateBufferLineToString(c,!1,0,t+1),a=s.cols-1,t=a,c--);return h+s.buffer.translateBufferLineToString(c,!1,t,a)}function Yu(t,e){let i=e?"O":"[";return ue.ESC+i+t}function Hu(t,e){t=Math.floor(t);let i="";for(let n=0;n<t;n++)i+=e;return i}var kJ=class{constructor(t){this._bufferService=t,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function p$(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var gy=50,CJ=15,TJ=50,QJ=500,$J=" ",PJ=new RegExp($J,"g"),d1=class extends Fe{constructor(t,e,i,n,r,s,a,c,h){super(),this._element=t,this._screenElement=e,this._linkifier=i,this._bufferService=n,this._coreService=r,this._mouseService=s,this._optionsService=a,this._renderService=c,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new rr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Oe),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Oe),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Oe),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Oe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new kJ(this._bufferService),this._activeSelectionMode=0,this._register(zt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;return!t||!e?!1:t[0]!==e[0]||t[1]!==e[1]}get selectionText(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;if(!t||!e)return"";let i=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(t[0]===e[0])return"";let r=t[0]<e[0]?t[0]:e[0],s=t[0]<e[0]?e[0]:t[0];for(let a=t[1];a<=e[1];a++){let c=i.translateBufferLineToString(a,!0,r,s);n.push(c)}}else{let r=t[1]===e[1]?e[0]:void 0;n.push(i.translateBufferLineToString(t[1],!0,t[0],r));for(let s=t[1]+1;s<=e[1]-1;s++){let a=i.lines.get(s),c=i.translateBufferLineToString(s,!0);a!=null&&a.isWrapped?n[n.length-1]+=c:n.push(c)}if(t[1]!==e[1]){let s=i.lines.get(e[1]),a=i.translateBufferLineToString(e[1],!0,0,e[0]);s&&s.isWrapped?n[n.length-1]+=a:n.push(a)}}return n.map(r=>r.replace(PJ," ")).join(kz?`\r
128
128
  `:`
129
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(t){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),s_&&t&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(t){let e=this._getMouseBufferCoords(t),i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n||!e?!1:this._areCoordsInSelection(e,i,n)}isCellInSelection(t,e){let i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n?!1:this._areCoordsInSelection([t,e],i,n)}_areCoordsInSelection(t,e,i){return t[1]>e[1]&&t[1]<i[1]||e[1]===i[1]&&t[1]===e[1]&&t[0]>=e[0]&&t[0]<i[0]||e[1]<i[1]&&t[1]===i[1]&&t[0]<i[0]||e[1]<i[1]&&t[1]===e[1]&&t[0]>=e[0]}_selectWordAtCursor(t,e){var r,s;let i=(s=(r=this._linkifier.currentLink)==null?void 0:r.link)==null?void 0:s.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=p$(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(t);return n?(this._selectWordAt(n,e),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(t,e){this._model.clearSelection(),t=Math.max(t,0),e=Math.min(e,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,t],this._model.selectionEnd=[this._bufferService.cols,e],this.refresh(),this._onSelectionChange.fire()}_handleTrim(t){this._model.handleTrim(t)&&this.refresh()}_getMouseBufferCoords(t){let e=this._mouseService.getCoords(t,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(e)return e[0]--,e[1]--,e[1]+=this._bufferService.buffer.ydisp,e}_getMouseEventScrollAmount(t){let e=r_(this._coreBrowserService.window,t,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return e>=0&&e<=i?0:(e>i&&(e-=i),e=Math.min(Math.max(e,-gy),gy),e/=gy,e/Math.abs(e)+Math.round(e*(CJ-1)))}shouldForceSelection(t){return Fg?t.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:t.shiftKey}handleMouseDown(t){if(this._mouseDownTimeStamp=t.timeStamp,!(t.button===2&&this.hasSelection)&&t.button===0){if(!this._enabled){if(!this.shouldForceSelection(t))return;t.stopPropagation()}t.preventDefault(),this._dragScrollAmount=0,this._enabled&&t.shiftKey?this._handleIncrementalClick(t):t.detail===1?this._handleSingleClick(t):t.detail===2?this._handleDoubleClick(t):t.detail===3&&this._handleTripleClick(t),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),TJ)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(t){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(t))}_handleSingleClick(t){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(t)?3:0,this._model.selectionStart=this._getMouseBufferCoords(t),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let e=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);e&&e.length!==this._model.selectionStart[0]&&e.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(t){this._selectWordAtCursor(t,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(t){let e=this._getMouseBufferCoords(t);e&&(this._activeSelectionMode=2,this._selectLineAt(e[1]))}shouldColumnSelect(t){return t.altKey&&!(Fg&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(t){if(t.stopImmediatePropagation(),!this._model.selectionStart)return;let e=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(t),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(t),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let n=i.lines.get(this._model.selectionEnd[1]);n&&n.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!e||e[0]!==this._model.selectionEnd[0]||e[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let t=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(t.ydisp+this._bufferService.rows,t.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=t.ydisp),this.refresh()}}_handleMouseUp(t){let e=t.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&e<QJ&&t.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(t,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let n=vJ(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd,i=!!t&&!!e&&(t[0]!==e[0]||t[1]!==e[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(t,e,i);return}!t||!e||(!this._oldSelectionStart||!this._oldSelectionEnd||t[0]!==this._oldSelectionStart[0]||t[1]!==this._oldSelectionStart[1]||e[0]!==this._oldSelectionEnd[0]||e[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(t,e,i)}_fireOnSelectionChange(t,e,i){this._oldSelectionStart=t,this._oldSelectionEnd=e,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(t){this.clearSelection(),this._trimListener.dispose(),this._trimListener=t.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(t,e){let i=e;for(let n=0;e>=n;n++){let r=t.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&e!==n&&(i+=r-1)}return i}setSelection(t,e,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[t,e],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(t){this._isClickInSelection(t)||(this._selectWordAtCursor(t,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(t,e,i=!0,n=!0){if(t[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,s=r.lines.get(t[1]);if(!s)return;let a=r.translateBufferLineToString(t[1],!1),c=this._convertViewportColToCharacterIndex(s,t[0]),h=c,d=t[0]-c,f=0,g=0,m=0,O=0;if(a.charAt(c)===" "){for(;c>0&&a.charAt(c-1)===" ";)c--;for(;h<a.length&&a.charAt(h+1)===" ";)h++}else{let w=t[0],x=t[0];s.getWidth(w)===0&&(f++,w--),s.getWidth(x)===2&&(g++,x++);let Q=s.getString(x).length;for(Q>1&&(O+=Q-1,h+=Q-1);w>0&&c>0&&!this._isCharWordSeparator(s.loadCell(w-1,this._workCell));){s.loadCell(w-1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===0?(f++,w--):k>1&&(m+=k-1,c-=k-1),c--,w--}for(;x<s.length&&h+1<a.length&&!this._isCharWordSeparator(s.loadCell(x+1,this._workCell));){s.loadCell(x+1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,x++):k>1&&(O+=k-1,h+=k-1),h++,x++}}h++;let S=c+d-f+m,_=Math.min(this._bufferService.cols,h-c+f+g-m-O);if(!(!e&&a.slice(c,h).trim()==="")){if(i&&S===0&&s.getCodePoint(0)!==32){let w=r.lines.get(t[1]-1);if(w&&s.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let x=this._getWordAt([this._bufferService.cols-1,t[1]-1],!1,!0,!1);if(x){let Q=this._bufferService.cols-x.start;S-=Q,_+=Q}}}if(n&&S+_===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let w=r.lines.get(t[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let x=this._getWordAt([0,t[1]+1],!1,!1,!0);x&&(_+=x.length)}}return{start:S,length:_}}}_selectWordAt(t,e){let i=this._getWordAt(t,e);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,t[1]--;this._model.selectionStart=[i.start,t[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(t){let e=this._getWordAt(t,!0);if(e){let i=t[1];for(;e.start<0;)e.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;e.start+e.length>this._bufferService.cols;)e.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?e.start:e.start+e.length,i]}}_isCharWordSeparator(t){return t.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(t.getChars())>=0}_selectLineAt(t){let e=this._bufferService.buffer.getWrappedRangeForLine(t),i={start:{x:0,y:e.first},end:{x:this._bufferService.cols-1,y:e.last}};this._model.selectionStart=[0,e.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=p$(i,this._bufferService.cols)}};d1=qt([be(3,tn),be(4,el),be(5,Fb),be(6,nn),be(7,Ns),be(8,Xs)],d1);var g$=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},m$=class{constructor(){this._color=new g$,this._css=new g$}setCss(t,e,i){this._css.set(t,e,i)}getCss(t,e){return this._css.get(t,e)}setColor(t,e,i){this._color.set(t,e,i)}getColor(t,e){return this._color.get(t,e)}clear(){this._color.clear(),this._css.clear()}},hi=Object.freeze((()=>{let t=[Bt.toColor("#2e3436"),Bt.toColor("#cc0000"),Bt.toColor("#4e9a06"),Bt.toColor("#c4a000"),Bt.toColor("#3465a4"),Bt.toColor("#75507b"),Bt.toColor("#06989a"),Bt.toColor("#d3d7cf"),Bt.toColor("#555753"),Bt.toColor("#ef2929"),Bt.toColor("#8ae234"),Bt.toColor("#fce94f"),Bt.toColor("#729fcf"),Bt.toColor("#ad7fa8"),Bt.toColor("#34e2e2"),Bt.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let n=e[i/36%6|0],r=e[i/6%6|0],s=e[i%6];t.push({css:si.toCss(n,r,s),rgba:si.toRgba(n,r,s)})}for(let i=0;i<24;i++){let n=8+i*10;t.push({css:si.toCss(n,n,n),rgba:si.toRgba(n,n,n)})}return t})()),xa=Bt.toColor("#ffffff"),su=Bt.toColor("#000000"),O$=Bt.toColor("#ffffff"),v$=su,Uh={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},EJ=xa,f1=class extends Fe{constructor(t){super(),this._optionsService=t,this._contrastCache=new m$,this._halfContrastCache=new m$,this._onChangeColors=this._register(new Oe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:xa,background:su,cursor:O$,cursorAccent:v$,selectionForeground:void 0,selectionBackgroundTransparent:Uh,selectionBackgroundOpaque:Et.blend(su,Uh),selectionInactiveBackgroundTransparent:Uh,selectionInactiveBackgroundOpaque:Et.blend(su,Uh),scrollbarSliderBackground:Et.opacity(xa,.2),scrollbarSliderHoverBackground:Et.opacity(xa,.4),scrollbarSliderActiveBackground:Et.opacity(xa,.5),overviewRulerBorder:xa,ansi:hi.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(t={}){let e=this._colors;if(e.foreground=xt(t.foreground,xa),e.background=xt(t.background,su),e.cursor=Et.blend(e.background,xt(t.cursor,O$)),e.cursorAccent=Et.blend(e.background,xt(t.cursorAccent,v$)),e.selectionBackgroundTransparent=xt(t.selectionBackground,Uh),e.selectionBackgroundOpaque=Et.blend(e.background,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundTransparent=xt(t.selectionInactiveBackground,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundOpaque=Et.blend(e.background,e.selectionInactiveBackgroundTransparent),e.selectionForeground=t.selectionForeground?xt(t.selectionForeground,u$):void 0,e.selectionForeground===u$&&(e.selectionForeground=void 0),Et.isOpaque(e.selectionBackgroundTransparent)&&(e.selectionBackgroundTransparent=Et.opacity(e.selectionBackgroundTransparent,.3)),Et.isOpaque(e.selectionInactiveBackgroundTransparent)&&(e.selectionInactiveBackgroundTransparent=Et.opacity(e.selectionInactiveBackgroundTransparent,.3)),e.scrollbarSliderBackground=xt(t.scrollbarSliderBackground,Et.opacity(e.foreground,.2)),e.scrollbarSliderHoverBackground=xt(t.scrollbarSliderHoverBackground,Et.opacity(e.foreground,.4)),e.scrollbarSliderActiveBackground=xt(t.scrollbarSliderActiveBackground,Et.opacity(e.foreground,.5)),e.overviewRulerBorder=xt(t.overviewRulerBorder,EJ),e.ansi=hi.slice(),e.ansi[0]=xt(t.black,hi[0]),e.ansi[1]=xt(t.red,hi[1]),e.ansi[2]=xt(t.green,hi[2]),e.ansi[3]=xt(t.yellow,hi[3]),e.ansi[4]=xt(t.blue,hi[4]),e.ansi[5]=xt(t.magenta,hi[5]),e.ansi[6]=xt(t.cyan,hi[6]),e.ansi[7]=xt(t.white,hi[7]),e.ansi[8]=xt(t.brightBlack,hi[8]),e.ansi[9]=xt(t.brightRed,hi[9]),e.ansi[10]=xt(t.brightGreen,hi[10]),e.ansi[11]=xt(t.brightYellow,hi[11]),e.ansi[12]=xt(t.brightBlue,hi[12]),e.ansi[13]=xt(t.brightMagenta,hi[13]),e.ansi[14]=xt(t.brightCyan,hi[14]),e.ansi[15]=xt(t.brightWhite,hi[15]),t.extendedAnsi){let i=Math.min(e.ansi.length-16,t.extendedAnsi.length);for(let n=0;n<i;n++)e.ansi[n+16]=xt(t.extendedAnsi[n],hi[n+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(t){this._restoreColor(t),this._onChangeColors.fire(this.colors)}_restoreColor(t){if(t===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(t){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[t]=this._restoreColors.ansi[t]}}modifyColors(t){t(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};f1=qt([be(0,nn)],f1);function xt(t,e){if(t!==void 0)try{return Bt.toColor(t)}catch{}return e}var RJ=class{constructor(...t){this._entries=new Map;for(let[e,i]of t)this.set(e,i)}set(t,e){let i=this._entries.get(t);return this._entries.set(t,e),i}forEach(t){for(let[e,i]of this._entries.entries())t(e,i)}has(t){return this._entries.has(t)}get(t){return this._entries.get(t)}},AJ=class{constructor(){this._services=new RJ,this._services.set(Gb,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=CF(t).sort((s,a)=>s.index-a.index),n=[];for(let s of i){let a=this._services.get(s.id);if(!a)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${s.id._id}.`);n.push(a)}let r=i.length>0?i[0].index:e.length;if(e.length!==r)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${r+1} conflicts with ${e.length} static arguments`);return new t(...e,...n)}},MJ={trace:0,debug:1,info:2,warn:3,error:4,off:5},zJ="xterm.js: ",p1=class extends Fe{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=MJ[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":zJ)+e,...i)}trace(t,...e){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,e)}debug(t,...e){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,e)}info(t,...e){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,e)}warn(t,...e){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,e)}error(t,...e){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,e)}};p1=qt([be(0,nn)],p1);var y$=class extends Fe{constructor(t){super(),this._maxLength=t,this.onDeleteEmitter=this._register(new Oe),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Oe),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Oe),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(t){if(this._maxLength===t)return;let e=new Array(t);for(let i=0;i<Math.min(t,this.length);i++)e[i]=this._array[this._getCyclicIndex(i)];this._array=e,this._maxLength=t,this._startIndex=0}get length(){return this._length}set length(t){if(t>this._length)for(let e=this._length;e<t;e++)this._array[e]=void 0;this._length=t}get(t){return this._array[this._getCyclicIndex(t)]}set(t,e){this._array[this._getCyclicIndex(t)]=e}push(t){this._array[this._getCyclicIndex(this._length)]=t,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(t,e,...i){if(e){for(let n=t;n<this._length-e;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+e)];this._length-=e,this.onDeleteEmitter.fire({index:t,amount:e})}for(let n=this._length-1;n>=t;n--)this._array[this._getCyclicIndex(n+i.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<i.length;n++)this._array[this._getCyclicIndex(t+n)]=i[n];if(i.length&&this.onInsertEmitter.fire({index:t,amount:i.length}),this._length+i.length>this._maxLength){let n=this._length+i.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=i.length}trimStart(t){t>this._length&&(t=this._length),this._startIndex+=t,this._length-=t,this.onTrimEmitter.fire(t)}shiftElements(t,e,i){if(!(e<=0)){if(t<0||t>=this._length)throw new Error("start argument out of range");if(t+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=e-1;r>=0;r--)this.set(t+r+i,this.get(t+r));let n=t+e+i-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<e;n++)this.set(t+n+i,this.get(t+n))}}_getCyclicIndex(t){return(this._startIndex+t)%this._maxLength}},Ge=3,ri=Object.freeze(new fd),Pp=0,my=2,ou=class Pz{constructor(e,i,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Ge);let r=i||rr.fromCharData([0,UM,1,0]);for(let s=0;s<e;++s)this.setCell(s,r);this.length=e}get(e){let i=this._data[e*Ge+0],n=i&2097151;return[this._data[e*Ge+1],i&2097152?this._combined[e]:n?Po(n):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,i){this._data[e*Ge+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*Ge+0]=e|2097152|i[2]<<22):this._data[e*Ge+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*Ge+0]>>22}hasWidth(e){return this._data[e*Ge+0]&12582912}getFg(e){return this._data[e*Ge+1]}getBg(e){return this._data[e*Ge+2]}hasContent(e){return this._data[e*Ge+0]&4194303}getCodePoint(e){let i=this._data[e*Ge+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*Ge+0]&2097152}getString(e){let i=this._data[e*Ge+0];return i&2097152?this._combined[e]:i&2097151?Po(i&2097151):""}isProtected(e){return this._data[e*Ge+2]&536870912}loadCell(e,i){return Pp=e*Ge,i.content=this._data[Pp+0],i.fg=this._data[Pp+1],i.bg=this._data[Pp+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*Ge+0]=i.content,this._data[e*Ge+1]=i.fg,this._data[e*Ge+2]=i.bg}setCellFromCodepoint(e,i,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Ge+0]=i|n<<22,this._data[e*Ge+1]=r.fg,this._data[e*Ge+2]=r.bg}addCodepointToCell(e,i,n){let r=this._data[e*Ge+0];r&2097152?this._combined[e]+=Po(i):r&2097151?(this._combined[e]=Po(r&2097151)+Po(i),r&=-2097152,r|=2097152):r=i|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*Ge+0]=r}insertCells(e,i,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length-e){let r=new rr;for(let s=this.length-e-i-1;s>=0;--s)this.setCell(e+i+s,this.loadCell(e+s,r));for(let s=0;s<i;++s)this.setCell(e+s,n)}else for(let r=e;r<this.length;++r)this.setCell(r,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,i,n){if(e%=this.length,i<this.length-e){let r=new rr;for(let s=0;s<this.length-e-i;++s)this.setCell(e+s,this.loadCell(e+i+s,r));for(let s=this.length-i;s<this.length;++s)this.setCell(s,n)}else for(let r=e;r<this.length;++r)this.setCell(r,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,i,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,n);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,n);e<i&&e<this.length;)this.setCell(e++,n)}resize(e,i){if(e===this.length)return this._data.length*4*my<this._data.buffer.byteLength;let n=e*Ge;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let r=new Uint32Array(n);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,n);let r=Object.keys(this._combined);for(let a=0;a<r.length;a++){let c=parseInt(r[a],10);c>=e&&delete this._combined[c]}let s=Object.keys(this._extendedAttrs);for(let a=0;a<s.length;a++){let c=parseInt(s[a],10);c>=e&&delete this._extendedAttrs[c]}}return this.length=e,n*4*my<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*my<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,e);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(let i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let e=new Pz(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let i in this._combined)e._combined[i]=this._combined[i];for(let i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Ge+0]&4194303)return e+(this._data[e*Ge+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Ge+0]&4194303||this._data[e*Ge+2]&50331648)return e+(this._data[e*Ge+0]>>22);return 0}copyCellsFrom(e,i,n,r,s){let a=e._data;if(s)for(let h=r-1;h>=0;h--){for(let d=0;d<Ge;d++)this._data[(n+h)*Ge+d]=a[(i+h)*Ge+d];a[(i+h)*Ge+2]&268435456&&(this._extendedAttrs[n+h]=e._extendedAttrs[i+h])}else for(let h=0;h<r;h++){for(let d=0;d<Ge;d++)this._data[(n+h)*Ge+d]=a[(i+h)*Ge+d];a[(i+h)*Ge+2]&268435456&&(this._extendedAttrs[n+h]=e._extendedAttrs[i+h])}let c=Object.keys(e._combined);for(let h=0;h<c.length;h++){let d=parseInt(c[h],10);d>=i&&(this._combined[d-i+n]=e._combined[d])}}translateToString(e,i,n,r){i=i??0,n=n??this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let s="";for(;i<n;){let a=this._data[i*Ge+0],c=a&2097151,h=a&2097152?this._combined[i]:c?Po(c):Mo;if(s+=h,r)for(let d=0;d<h.length;++d)r.push(i);i+=a>>22||1}return r&&r.push(i),s}};function jJ(t,e,i,n,r,s){let a=[];for(let c=0;c<t.length-1;c++){let h=c,d=t.get(++h);if(!d.isWrapped)continue;let f=[t.get(c)];for(;h<t.length&&d.isWrapped;)f.push(d),d=t.get(++h);if(!s&&n>=c&&n<h){c+=f.length-1;continue}let g=0,m=Uu(f,g,e),O=1,S=0;for(;O<f.length;){let w=Uu(f,O,e),x=w-S,Q=i-m,k=Math.min(x,Q);f[g].copyCellsFrom(f[O],S,m,k,!1),m+=k,m===i&&(g++,m=0),S+=k,S===w&&(O++,S=0),m===0&&g!==0&&f[g-1].getWidth(i-1)===2&&(f[g].copyCellsFrom(f[g-1],i-1,m++,1,!1),f[g-1].setCell(i-1,r))}f[g].replaceCells(m,i,r);let _=0;for(let w=f.length-1;w>0&&(w>g||f[w].getTrimmedLength()===0);w--)_++;_>0&&(a.push(c+f.length-_),a.push(_)),c+=f.length-1}return a}function DJ(t,e){let i=[],n=0,r=e[n],s=0;for(let a=0;a<t.length;a++)if(r===a){let c=e[++n];t.onDeleteEmitter.fire({index:a-s,amount:c}),a+=c-1,s+=c,r=e[++n]}else i.push(a);return{layout:i,countRemoved:s}}function BJ(t,e){let i=[];for(let n=0;n<e.length;n++)i.push(t.get(e[n]));for(let n=0;n<i.length;n++)t.set(n,i[n]);t.length=e.length}function LJ(t,e,i){let n=[],r=t.map((h,d)=>Uu(t,d,e)).reduce((h,d)=>h+d),s=0,a=0,c=0;for(;c<r;){if(r-c<i){n.push(r-c);break}s+=i;let h=Uu(t,a,e);s>h&&(s-=h,a++);let d=t[a].getWidth(s-1)===2;d&&s--;let f=d?i-1:i;n.push(f),c+=f}return n}function Uu(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let n=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,r=t[e+1].getWidth(0)===2;return n&&r?i-1:i}var Ez=class Rz{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=Rz._nextId++,this._onDispose=this.register(new Oe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ga(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Ez._nextId=1;var XJ=Ez,gi={},wa=gi.B;gi[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};gi.A={"#":"£"};gi.B=void 0;gi[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};gi.C=gi[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gi.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};gi.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};gi.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};gi.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};gi.E=gi[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};gi.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};gi.H=gi[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gi["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var S$=4294967295,b$=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ri.clone(),this.savedCharset=wa,this.markers=[],this._nullCell=rr.fromCharData([0,UM,1,0]),this._whitespaceCell=rr.fromCharData([0,Mo,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Kg,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new y$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Hg),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Hg),this._whitespaceCell}getBlankLine(t,e){return new ou(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>S$?S$:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=ri);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new y$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(ri),n=0,r=this._getCorrectBufferLength(e);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<t)for(let a=0;a<this.lines.length;a++)n+=+this.lines.get(a).resize(t,i);let s=0;if(this._rows<e)for(let a=this._rows;a<e;a++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new ou(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new ou(t,i)));else for(let a=this._rows;a>e;a--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let a=this.lines.length-r;a>0&&(this.lines.trimStart(a),this.ybase=Math.max(this.ybase-a,0),this.ydisp=Math.max(this.ydisp-a,0),this.savedY=Math.max(this.savedY-a,0)),this.lines.maxLength=r}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let s=0;s<this.lines.length;s++)n+=+this.lines.get(s).resize(t,i);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,n=jJ(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(ri),i);if(n.length>0){let r=DJ(this.lines,n);BJ(this.lines,r.layout),this._reflowLargerAdjustViewport(t,e,r.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let n=this.getNullCell(ri),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new ou(t,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(ri),r=[],s=0;for(let a=this.lines.length-1;a>=0;a--){let c=this.lines.get(a);if(!c||!c.isWrapped&&c.getTrimmedLength()<=t)continue;let h=[c];for(;c.isWrapped&&a>0;)c=this.lines.get(--a),h.unshift(c);if(!i){let k=this.ybase+this.y;if(k>=a&&k<a+h.length)continue}let d=h[h.length-1].getTrimmedLength(),f=LJ(h,this._cols,t),g=f.length-h.length,m;this.ybase===0&&this.y!==this.lines.length-1?m=Math.max(0,this.y-this.lines.maxLength+g):m=Math.max(0,this.lines.length-this.lines.maxLength+g);let O=[];for(let k=0;k<g;k++){let T=this.getBlankLine(ri,!0);O.push(T)}O.length>0&&(r.push({start:a+h.length+s,newLines:O}),s+=O.length),h.push(...O);let S=f.length-1,_=f[S];_===0&&(S--,_=f[S]);let w=h.length-g-1,x=d;for(;w>=0;){let k=Math.min(x,_);if(h[S]===void 0)break;if(h[S].copyCellsFrom(h[w],x-k,_-k,k,!0),_-=k,_===0&&(S--,_=f[S]),x-=k,x===0){w--;let T=Math.max(w,0);x=Uu(h,T,this._cols)}}for(let k=0;k<h.length;k++)f[k]<t&&h[k].setCell(f[k],n);let Q=g-m;for(;Q-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+e-1)}if(r.length>0){let a=[],c=[];for(let _=0;_<this.lines.length;_++)c.push(this.lines.get(_));let h=this.lines.length,d=h-1,f=0,g=r[f];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let m=0;for(let _=Math.min(this.lines.maxLength-1,h+s-1);_>=0;_--)if(g&&g.start>d+m){for(let w=g.newLines.length-1;w>=0;w--)this.lines.set(_--,g.newLines[w]);_++,a.push({index:d+1,amount:g.newLines.length}),m+=g.newLines.length,g=r[++f]}else this.lines.set(_,c[d--]);let O=0;for(let _=a.length-1;_>=0;_--)a[_].index+=O,this.lines.onInsertEmitter.fire(a[_]),O+=a[_].amount;let S=Math.max(0,h+s-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(t,e,i=0,n){let r=this.lines.get(t);return r?r.translateToString(e,i,n):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:e,last:i}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new XJ(t);return this.markers.push(e),e.register(this.lines.onTrim(i=>{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.line<i.index+i.amount&&e.dispose(),e.line>i.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},NJ=class extends Fe{constructor(t,e){super(),this._optionsService=t,this._bufferService=e,this._onBufferActivate=this._register(new Oe),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new b$(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new b$(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(t){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(t),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(t,e){this._normal.resize(t,e),this._alt.resize(t,e),this.setupTabStops(t)}setupTabStops(t){this._normal.setupTabStops(t),this._alt.setupTabStops(t)}},Az=2,Mz=1,g1=class extends Fe{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new Oe),this.onResize=this._onResize.event,this._onScroll=this._register(new Oe),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,Az),this.rows=Math.max(t.rawOptions.rows||0,Mz),this.buffers=this._register(new NJ(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,n=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==t.fg||n.getBg(0)!==t.bg)&&(n=i.getBlankLine(t,e),this._cachedBlankLine=n),n.isWrapped=e;let r=i.ybase+i.scrollTop,s=i.ybase+i.scrollBottom;if(i.scrollTop===0){let a=i.lines.isFull;s===i.lines.length-1?a?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(s+1,0,n.clone()),a?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let a=s-r+1;i.lines.shiftElements(r+1,a-1,-1),i.lines.set(s,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let n=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),n!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};g1=qt([be(0,nn)],g1);var Vl={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Fg,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},ZJ=["normal","bold","100","200","300","400","500","600","700","800","900"],WJ=class extends Fe{constructor(t){super(),this._onOptionChange=this._register(new Oe),this.onOptionChange=this._onOptionChange.event;let e={...Vl};for(let i in t)if(i in e)try{let n=t[i];e[i]=this._sanitizeAndValidateOption(i,n)}catch(n){console.error(n)}this.rawOptions=e,this.options={...e},this._setupOptions(),this._register(zt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(t,e){return this.onOptionChange(i=>{i===t&&e(this.rawOptions[t])})}onMultipleOptionChange(t,e){return this.onOptionChange(i=>{t.indexOf(i)!==-1&&e()})}_setupOptions(){let t=i=>{if(!(i in Vl))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},e=(i,n)=>{if(!(i in Vl))throw new Error(`No option with key "${i}"`);n=this._sanitizeAndValidateOption(i,n),this.rawOptions[i]!==n&&(this.rawOptions[i]=n,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let n={get:t.bind(this,i),set:e.bind(this,i)};Object.defineProperty(this.options,i,n)}}_sanitizeAndValidateOption(t,e){switch(t){case"cursorStyle":if(e||(e=Vl[t]),!qJ(e))throw new Error(`"${e}" is not a valid value for ${t}`);break;case"wordSeparator":e||(e=Vl[t]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=ZJ.includes(e)?e:Vl[t];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${t} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(e*10)/10));break;case"scrollback":if(e=Math.min(e,4294967295),e<0)throw new Error(`${t} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${t} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${t} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{};break}return e}};function qJ(t){return t==="block"||t==="underline"||t==="bar"}function au(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let n in t)i[n]=e<=1?t[n]:t[n]&&au(t[n],e-1);return i}var _$=Object.freeze({insertMode:!1}),x$=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),m1=class extends Fe{constructor(t,e,i){super(),this._bufferService=t,this._logService=e,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Oe),this.onData=this._onData.event,this._onUserInput=this._register(new Oe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Oe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Oe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=au(_$),this.decPrivateModes=au(x$)}reset(){this.modes=au(_$),this.decPrivateModes=au(x$)}triggerDataEvent(t,e=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;e&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),e&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`),this._logService.trace("sending data (codes)",()=>t.split("").map(n=>n.charCodeAt(0))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`),this._logService.trace("sending binary (codes)",()=>t.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(t))}};m1=qt([be(0,tn),be(1,ez),be(2,nn)],m1);var w$={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function Oy(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var vy=String.fromCharCode,k$={DEFAULT:t=>{let e=[Oy(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${vy(e[0])}${vy(e[1])}${vy(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Oy(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Oy(t,!0)};${t.x};${t.y}${e}`}},O1=class extends Fe{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Oe),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(w$))this.addProtocol(n,w$[n]);for(let n of Object.keys(k$))this.addEncoding(n,k$[n]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let n=e/i,r=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=n+0,Math.abs(t.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};O1=qt([be(0,tn),be(1,el),be(2,nn)],O1);var yy=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],VJ=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],ui;function IJ(t,e){let i=0,n=e.length-1,r;if(t<e[0][0]||t>e[n][1])return!1;for(;n>=i;)if(r=i+n>>1,t>e[r][1])i=r+1;else if(t<e[r][0])n=r-1;else return!0;return!1}var YJ=class{constructor(){if(this.version="6",!ui){ui=new Uint8Array(65536),ui.fill(1),ui[0]=0,ui.fill(0,1,32),ui.fill(0,127,160),ui.fill(2,4352,4448),ui[9001]=2,ui[9002]=2,ui.fill(2,11904,42192),ui[12351]=1,ui.fill(2,44032,55204),ui.fill(2,63744,64256),ui.fill(2,65040,65050),ui.fill(2,65072,65136),ui.fill(2,65280,65377),ui.fill(2,65504,65511);for(let t=0;t<yy.length;++t)ui.fill(0,yy[t][0],yy[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?ui[t]:IJ(t,VJ)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,e){let i=this.wcwidth(t),n=i===0&&e!==0;if(n){let r=Aa.extractWidth(e);r===0?n=!1:r>i&&(i=r)}return Aa.createPropertyValue(0,i,n)}},Aa=class tg{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Oe,this.onChange=this._onChange.event;let e=new YJ;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,n=!1){return(e&16777215)<<3|(i&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,n=0,r=e.length;for(let s=0;s<r;++s){let a=e.charCodeAt(s);if(55296<=a&&a<=56319){if(++s>=r)return i+this.wcwidth(a);let d=e.charCodeAt(s);56320<=d&&d<=57343?a=(a-55296)*1024+d-56320+65536:i+=this.wcwidth(d)}let c=this.charProperties(a,n),h=tg.extractWidth(c);tg.extractShouldJoin(c)&&(h-=tg.extractWidth(n)),i+=h,n=c}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},HJ=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(t){this.glevel=t,this.charset=this._charsets[t]}setgCharset(t,e){this._charsets[t]=e,this.glevel===t&&(this.charset=e)}};function C$(t){var n;let e=(n=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1))==null?void 0:n.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var Gh=2147483647,UJ=256,zz=class v1{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>UJ)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new v1;if(!e.length)return i;for(let n=Array.isArray(e[0])?1:0;n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let s=0;s<r.length;++s)i.addSubParam(r[s]);else i.addParam(r)}return i}clone(){let e=new v1(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let n=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Gh?Gh:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Gh?Gh:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-i>0?this._subParams.subarray(i,n):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let n=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-n>0&&(e[i]=this._subParams.slice(n,r))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[i-1];n[i-1]=~r?Math.min(r*10+e,Gh):e}},Fh=[],GJ=class{constructor(){this._state=0,this._active=Fh,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let n=i.indexOf(e);n!==-1&&i.splice(n,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Fh}reset(){if(this._state===2)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].end(!1);this._stack.paused=!1,this._active=Fh,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Fh,!this._active.length)this._handlerFb(this._id,"START");else for(let t=this._active.length-1;t>=0;t--)this._active[t].start()}_put(t,e,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Qm(t,e,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(t,e,i)}start(){this.reset(),this._state=1}put(t,e,i){if(this._state!==3){if(this._state===1)for(;e<i;){let n=t[e++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&i-e>0&&this._put(t,e,i)}}end(t,e=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",t);else{let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=e,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].end(t),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=Fh,this._id=-1,this._state=0}}},Mn=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Qm(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data),e instanceof Promise))return e.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,e}},Kh=[],FJ=class{constructor(){this._handlers=Object.create(null),this._active=Kh,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Kh}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let n=i.indexOf(e);n!==-1&&i.splice(n,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}reset(){if(this._active.length)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].unhook(!1);this._stack.paused=!1,this._active=Kh,this._ident=0}hook(t,e){if(this.reset(),this._ident=t,this._active=this._handlers[t]||Kh,!this._active.length)this._handlerFb(this._ident,"HOOK",e);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(e)}put(t,e,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Qm(t,e,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(t,e,i)}unhook(t,e=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",t);else{let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=e,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].unhook(t),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=Kh,this._ident=0}},lu=new zz;lu.addParam(0);var T$=class{constructor(t){this._handler=t,this._data="",this._params=lu,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():lu,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Qm(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=lu,this._data="",this._hitLimit=!1,i));return this._params=lu,this._data="",this._hitLimit=!1,e}},KJ=class{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,i,n){this.table[e<<8|t]=i<<4|n}addMany(t,e,i,n){for(let r=0;r<t.length;r++)this.table[e<<8|t[r]]=i<<4|n}},Kn=160,JJ=(function(){let t=new KJ(4095),e=Array.apply(null,Array(256)).map((c,h)=>h),i=(c,h)=>e.slice(c,h),n=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let s=i(0,14),a;t.setDefault(1,0),t.addMany(n,0,2,0);for(a in s)t.addMany([24,26,153,154],a,3,0),t.addMany(i(128,144),a,3,0),t.addMany(i(144,152),a,3,0),t.add(156,a,0,0),t.add(27,a,11,1),t.add(157,a,4,8),t.addMany([152,158,159],a,0,7),t.add(155,a,11,3),t.add(144,a,11,9);return t.addMany(r,0,3,0),t.addMany(r,1,3,1),t.add(127,1,0,1),t.addMany(r,8,0,8),t.addMany(r,3,3,3),t.add(127,3,0,3),t.addMany(r,4,3,4),t.add(127,4,0,4),t.addMany(r,6,3,6),t.addMany(r,5,3,5),t.add(127,5,0,5),t.addMany(r,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(n,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(n,7,0,7),t.addMany(r,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(r,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(r,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(r,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(r,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(r,13,13,13),t.addMany(n,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(Kn,0,2,0),t.add(Kn,8,5,8),t.add(Kn,6,0,6),t.add(Kn,11,0,11),t.add(Kn,13,13,13),t})(),eee=class extends Fe{constructor(t=JJ){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new zz,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(zt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new GJ),this._dcsParser=this._register(new FJ),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(t,e=[64,126]){let i=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=t.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<t.intermediates.length;++r){let s=t.intermediates.charCodeAt(r);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(t.final.length!==1)throw new Error("final must be a single byte");let n=t.final.charCodeAt(0);if(e[0]>n||n>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return i<<=8,i|=n,i}identToString(t){let e=[];for(;t;)e.push(String.fromCharCode(t&255)),t>>=8;return e.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,e){let i=this._identifier(t,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let n=this._escHandlers[i];return n.push(e),{dispose:()=>{let r=n.indexOf(e);r!==-1&&n.splice(r,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,e){this._executeHandlers[t.charCodeAt(0)]=e}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,e){let i=this._identifier(t);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let n=this._csiHandlers[i];return n.push(e),{dispose:()=>{let r=n.indexOf(e);r!==-1&&n.splice(r,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,e){return this._dcsParser.registerHandler(this._identifier(t),e)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,e){return this._oscParser.registerHandler(t,e)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(t,e,i,n,r){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=i,this._parseStack.transition=n,this._parseStack.chunkPos=r}parse(t,e,i){let n=0,r=0,s=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let c=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&h>-1){for(;h>=0&&(a=c[h](this._params),a!==!0);h--)if(a instanceof Promise)return this._parseStack.handlerPos=h,a}this._parseStack.handlers=[];break;case 4:if(i===!1&&h>-1){for(;h>=0&&(a=c[h](),a!==!0);h--)if(a instanceof Promise)return this._parseStack.handlerPos=h,a}this._parseStack.handlers=[];break;case 6:if(n=t[this._parseStack.chunkPos],a=this._dcsParser.unhook(n!==24&&n!==26,i),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=t[this._parseStack.chunkPos],a=this._oscParser.end(n!==24&&n!==26,i),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let c=s;c<e;++c){switch(n=t[c],r=this._transitions.table[this.currentState<<8|(n<160?n:Kn)],r>>4){case 2:for(let m=c+1;;++m){if(m>=e||(n=t[m])<32||n>126&&n<Kn){this._printHandler(t,c,m),c=m-1;break}if(++m>=e||(n=t[m])<32||n>126&&n<Kn){this._printHandler(t,c,m),c=m-1;break}if(++m>=e||(n=t[m])<32||n>126&&n<Kn){this._printHandler(t,c,m),c=m-1;break}if(++m>=e||(n=t[m])<32||n>126&&n<Kn){this._printHandler(t,c,m),c=m-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:c,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|n],d=h?h.length-1:-1;for(;d>=0&&(a=h[d](this._params),a!==!0);d--)if(a instanceof Promise)return this._preserveStack(3,h,d,r,c),a;d<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++c<e&&(n=t[c])>47&&n<60);c--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let f=this._escHandlers[this._collect<<8|n],g=f?f.length-1:-1;for(;g>=0&&(a=f[g](),a!==!0);g--)if(a instanceof Promise)return this._preserveStack(4,f,g,r,c),a;g<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let m=c+1;;++m)if(m>=e||(n=t[m])===24||n===26||n===27||n>127&&n<Kn){this._dcsParser.put(t,c,m),c=m-1;break}break;case 14:if(a=this._dcsParser.unhook(n!==24&&n!==26),a)return this._preserveStack(6,[],0,r,c),a;n===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let m=c+1;;m++)if(m>=e||(n=t[m])<32||n>127&&n<Kn){this._oscParser.put(t,c,m),c=m-1;break}break;case 6:if(a=this._oscParser.end(n!==24&&n!==26),a)return this._preserveStack(5,[],0,r,c),a;n===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},tee=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,iee=/^[\da-f]+$/;function Q$(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=tee.exec(e);if(i){let n=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/n*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/n*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/n*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),iee.exec(e)&&[3,6,9,12].includes(e.length))){let i=e.length/3,n=[0,0,0];for(let r=0;r<3;++r){let s=parseInt(e.slice(i*r,i*r+i),16);n[r]=i===1?s<<4:i===2?s:i===3?s>>4:s>>8}return n}}function Sy(t,e){let i=t.toString(16),n=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function nee(t,e=16){let[i,n,r]=t;return`rgb:${Sy(i,e)}/${Sy(n,e)}/${Sy(r,e)}`}var ree={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ko=131072,$$=10;function P$(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var E$=5e3,R$=0,see=class extends Fe{constructor(t,e,i,n,r,s,a,c,h=new eee){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=n,this._optionsService=r,this._oscLinkService=s,this._coreMouseService=a,this._unicodeService=c,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new wF,this._utf8Decoder=new kF,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ri.clone(),this._eraseAttrDataInternal=ri.clone(),this._onRequestBell=this._register(new Oe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Oe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Oe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Oe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Oe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Oe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Oe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Oe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Oe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Oe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Oe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Oe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Oe),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new y1(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,f)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:f.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,f,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:f,data:g})}),this._parser.setDcsHandlerFallback((d,f,g)=>{f==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:f,payload:g})}),this._parser.setPrintHandler((d,f,g)=>this.print(d,f,g)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(ue.BEL,()=>this.bell()),this._parser.setExecuteHandler(ue.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ue.BS,()=>this.backspace()),this._parser.setExecuteHandler(ue.HT,()=>this.tab()),this._parser.setExecuteHandler(ue.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ue.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Jp.IND,()=>this.index()),this._parser.setExecuteHandler(Jp.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Jp.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Mn(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Mn(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Mn(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Mn(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Mn(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Mn(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Mn(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Mn(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Mn(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Mn(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Mn(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Mn(d=>this.restoreCursorColor(d))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let d in gi)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T$((d,f)=>this.requestStatusString(d,f)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=n}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),E$))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${E$} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,n=this._activeBuffer.x,r=this._activeBuffer.y,s=0,a=this._parseStack.paused;if(a){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;n=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>ko&&(s=this._parseStack.position+ko)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(d=>d.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<ko&&(this._parseBuffer=new Uint32Array(Math.min(t.length,ko))),a||this._dirtyRowTracker.clearRange(),t.length>ko)for(let d=s;d<t.length;d+=ko){let f=d+ko<t.length?d+ko:t.length,g=typeof t=="string"?this._stringDecoder.decode(t.substring(d,f),this._parseBuffer):this._utf8Decoder.decode(t.subarray(d,f),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,g))return this._preserveStack(n,r,g,d),this._logSlowResolvingAsync(i),i}else if(!a){let d=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,d))return this._preserveStack(n,r,d,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==n||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let c=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(c,this._bufferService.rows-1)})}print(t,e,i){let n,r,s=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,c=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,f=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-e>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,f);let m=this._parser.precedingJoinState;for(let O=e;O<i;++O){if(n=t[O],n<127&&s){let x=s[String.fromCharCode(n)];x&&(n=x.charCodeAt(0))}let S=this._unicodeService.charProperties(n,m);r=Aa.extractWidth(S);let _=Aa.extractShouldJoin(S),w=_?Aa.extractWidth(m):0;if(m=S,a&&this._onA11yChar.fire(Po(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-w>c){if(h){let x=g,Q=this._activeBuffer.x-w;for(this._activeBuffer.x=w,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),w>0&&g instanceof ou&&g.copyCellsFrom(x,Q,0,w,!1);Q<c;)x.setCellFromCodepoint(Q++,0,1,f)}else if(this._activeBuffer.x=c-1,r===2)continue}if(_&&this._activeBuffer.x){let x=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-x,n,r);for(let Q=r-w;--Q>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,f);continue}if(d&&(g.insertCells(this._activeBuffer.x,r-w,this._activeBuffer.getNullCell(f)),g.getWidth(c-1)===2&&g.setCellFromCodepoint(c-1,0,1,f)),g.setCellFromCodepoint(this._activeBuffer.x++,n,r,f),r>0)for(;--r;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,f)}this._parser.precedingJoinState=m,this._activeBuffer.x<c&&i-e>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,f),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>P$(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new T$(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Mn(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var t;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&t.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,n=!1,r=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),n&&(s.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){var n;this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i<this._bufferService.rows;i++)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&n.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;e--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;e--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(ri));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let i=t.params[0]||1,n=Aa.extractWidth(e),r=this._activeBuffer.x-n,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),a=new Uint32Array(s.length*i),c=0;for(let d=0;d<s.length;){let f=s.codePointAt(d)||0;a[c++]=f,d+=f>65535?2:1}let h=c;for(let d=1;d<i;++d)a.copyWithin(h,0,c),h+=c;return this.print(a,0,h),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ue.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ue.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ue.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ue.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ue.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,wa),this._charsetService.setgCharset(1,wa),this._charsetService.setgCharset(2,wa),this._charsetService.setgCharset(3,wa);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),t.params[e]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(t,e){(_=>(_[_.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",_[_.SET=1]="SET",_[_.RESET=2]="RESET",_[_.PERMANENTLY_SET=3]="PERMANENTLY_SET",_[_.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:s}=this._coreMouseService,a=this._coreService,{buffers:c,cols:h}=this._bufferService,{active:d,alt:f}=c,g=this._optionsService.rawOptions,m=(_,w)=>(a.triggerDataEvent(`${ue.ESC}[${e?"":"?"}${_};${w}$y`),!0),O=_=>_?1:2,S=t.params[0];return e?S===2?m(S,4):S===4?m(S,O(a.modes.insertMode)):S===12?m(S,3):S===20?m(S,O(g.convertEol)):m(S,0):S===1?m(S,O(n.applicationCursorKeys)):S===3?m(S,g.windowOptions.setWinLines?h===80?2:h===132?1:0:0):S===6?m(S,O(n.origin)):S===7?m(S,O(n.wraparound)):S===8?m(S,3):S===9?m(S,O(r==="X10")):S===12?m(S,O(g.cursorBlink)):S===25?m(S,O(!a.isCursorHidden)):S===45?m(S,O(n.reverseWraparound)):S===66?m(S,O(n.applicationKeypad)):S===67?m(S,4):S===1e3?m(S,O(r==="VT200")):S===1002?m(S,O(r==="DRAG")):S===1003?m(S,O(r==="ANY")):S===1004?m(S,O(n.sendFocus)):S===1005?m(S,4):S===1006?m(S,O(s==="SGR")):S===1015?m(S,4):S===1016?m(S,O(s==="SGR_PIXELS")):S===1048?m(S,1):S===47||S===1047||S===1049?m(S,O(d===f)):S===2004?m(S,O(n.bracketedPasteMode)):S===2026?m(S,O(n.synchronizedOutput)):m(S,0)}_updateAttrColor(t,e,i,n,r){return e===2?(t|=50331648,t&=-16777216,t|=fd.fromColorRGB([i,n,r])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let n=[0,0,-1,0,0,0],r=0,s=0;do{if(n[s+r]=t.params[e+s],t.hasSubParams(e+s)){let a=t.getSubParams(e+s),c=0;do n[1]===5&&(r=1),n[s+c+1+r]=a[c];while(++c<a.length&&c+s+1+r<n.length);break}if(n[1]===5&&s+r>=2||n[1]===2&&s+r>=5)break;n[1]&&(r=1)}while(++s+e<t.length&&s+r<n.length);for(let a=2;a<n.length;++a)n[a]===-1&&(n[a]=0);switch(n[0]){case 38:i.fg=this._updateAttrColor(i.fg,n[1],n[3],n[4],n[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,n[1],n[3],n[4],n[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,n[1],n[3],n[4],n[5])}return s}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=ri.fg,t.bg=ri.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,n=this._curAttrData;for(let r=0;r<e;r++)i=t.params[r],i>=30&&i<=37?(n.fg&=-50331904,n.fg|=16777216|i-30):i>=40&&i<=47?(n.bg&=-50331904,n.bg|=16777216|i-40):i>=90&&i<=97?(n.fg&=-50331904,n.fg|=16777216|i-90|8):i>=100&&i<=107?(n.bg&=-50331904,n.bg|=16777216|i-100|8):i===0?this._processSGR0(n):i===1?n.fg|=134217728:i===3?n.bg|=67108864:i===4?(n.fg|=268435456,this._processUnderline(t.hasSubParams(r)?t.getSubParams(r)[0]:1,n)):i===5?n.fg|=536870912:i===7?n.fg|=67108864:i===8?n.fg|=1073741824:i===9?n.fg|=2147483648:i===2?n.bg|=134217728:i===21?this._processUnderline(2,n):i===22?(n.fg&=-134217729,n.bg&=-134217729):i===23?n.bg&=-67108865:i===24?(n.fg&=-268435457,this._processUnderline(0,n)):i===25?n.fg&=-536870913:i===27?n.fg&=-67108865:i===28?n.fg&=-1073741825:i===29?n.fg&=2147483647:i===39?(n.fg&=-67108864,n.fg|=ri.fg&16777215):i===49?(n.bg&=-67108864,n.bg|=ri.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(t,r,n):i===53?n.bg|=1073741824:i===55?n.bg&=-1073741825:i===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):i===100?(n.fg&=-67108864,n.fg|=ri.fg&16777215,n.bg&=-67108864,n.bg|=ri.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${ue.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){switch(t.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.ESC}[?${e};${i}R`);break}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ri.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!P$(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ue.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>$$&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>$$&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(t){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let n=i.shift(),r=i.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(A$(s))if(r==="?")e.push({type:0,index:s});else{let a=Q$(r);a&&e.push({type:1,index:s,color:a})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),n=t.slice(e+1);return n?this._createHyperlink(i,n):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),n,r=i.findIndex(s=>s.startsWith("id="));return r!==-1&&(n=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let n=0;n<i.length&&!(e>=this._specialColors.length);++n,++e)if(i[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let r=Q$(i[n]);r&&this._onColor.fire([{type:1,index:this._specialColors[e],color:r}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let n=0;n<i.length;++n)if(/^\d+$/.exec(i[n])){let r=parseInt(i[n]);A$(r)&&e.push({type:2,index:r})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,wa),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(ree[t[0]],gi[t[1]]||wa),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=ri.clone(),this._eraseAttrDataInternal=ri.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new rr;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let i=this._activeBuffer.ybase+this._activeBuffer.y+e,n=this._activeBuffer.lines.get(i);n&&(n.fill(t),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let i=a=>(this._coreService.triggerDataEvent(`${ue.ESC}${a}${ue.ESC}\\`),!0),n=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},y1=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(R$=t,t=e,e=R$),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};y1=qt([be(0,tn)],y1);function A$(t){return 0<=t&&t<256}var oee=5e7,M$=12,aee=50,lee=class extends Fe{constructor(t){super(),this._action=t,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Oe),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(t,e){if(e!==void 0&&this._syncCalls>e){this._syncCalls=0;return}if(this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(t,e){if(this._pendingData>oee)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(e),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(e)}_innerWrite(t=0,e=!0){let i=t||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],r=this._action(n,e);if(r){let a=c=>performance.now()-i>=M$?setTimeout(()=>this._innerWrite(0,c)):this._innerWrite(i,c);r.catch(c=>(queueMicrotask(()=>{throw c}),Promise.resolve(!1))).then(a);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-i>=M$)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>aee&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},S1=class{constructor(t){this._bufferService=t,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(t){let e=this._bufferService.buffer;if(t.id===void 0){let c=e.addMarker(e.ybase+e.y),h={data:t,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._dataByLinkId.set(h.id,h),h.id}let i=t,n=this._getEntryIdKey(i),r=this._entriesWithId.get(n);if(r)return this.addLineToLink(r.id,e.ybase+e.y),r.id;let s=e.addMarker(e.ybase+e.y),a={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(a,s)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(t,e){let i=this._dataByLinkId.get(t);if(i&&i.lines.every(n=>n.line!==e)){let n=this._bufferService.buffer.addMarker(e);i.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(i,n))}}getLinkData(t){var e;return(e=this._dataByLinkId.get(t))==null?void 0:e.data}_getEntryIdKey(t){return`${t.id};;${t.uri}`}_removeMarkerFromLink(t,e){let i=t.lines.indexOf(e);i!==-1&&(t.lines.splice(i,1),t.lines.length===0&&(t.data.id!==void 0&&this._entriesWithId.delete(t.key),this._dataByLinkId.delete(t.id)))}};S1=qt([be(0,tn)],S1);var z$=!1,cee=class extends Fe{constructor(t){super(),this._windowsWrappingHeuristics=this._register(new Ac),this._onBinary=this._register(new Oe),this.onBinary=this._onBinary.event,this._onData=this._register(new Oe),this.onData=this._onData.event,this._onLineFeed=this._register(new Oe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Oe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Oe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Oe),this._instantiationService=new AJ,this.optionsService=this._register(new WJ(t)),this._instantiationService.setService(nn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(g1)),this._instantiationService.setService(tn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(p1)),this._instantiationService.setService(ez,this._logService),this.coreService=this._register(this._instantiationService.createInstance(m1)),this._instantiationService.setService(el,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(O1)),this._instantiationService.setService(JM,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Aa)),this._instantiationService.setService($F,this.unicodeService),this._charsetService=this._instantiationService.createInstance(HJ),this._instantiationService.setService(QF,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S1),this._instantiationService.setService(tz,this._oscLinkService),this._inputHandler=this._register(new see(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ai.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ai.forward(this._bufferService.onResize,this._onResize)),this._register(Ai.forward(this.coreService.onData,this._onData)),this._register(Ai.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new lee((e,i)=>this._inputHandler.parse(e,i))),this._register(Ai.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Oe),this._onScroll.event(t=>{var e;(e=this._onScrollApi)==null||e.fire(t.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(t){for(let e in t)this.optionsService.options[e]=t[e]}write(t,e){this._writeBuffer.write(t,e)}writeSync(t,e){this._logService.logLevel<=3&&!z$&&(this._logService.warn("writeSync is unreliable and will be removed soon."),z$=!0),this._writeBuffer.writeSync(t,e)}input(t,e=!0){this.coreService.triggerDataEvent(t,e)}resize(t,e){isNaN(t)||isNaN(e)||(t=Math.max(t,Az),e=Math.max(e,Mz),this._bufferService.resize(t,e))}scroll(t,e=!1){this._bufferService.scroll(t,e)}scrollLines(t,e){this._bufferService.scrollLines(t,e)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let e=t-this._bufferService.buffer.ydisp;e!==0&&this.scrollLines(e)}registerEscHandler(t,e){return this._inputHandler.registerEscHandler(t,e)}registerDcsHandler(t,e){return this._inputHandler.registerDcsHandler(t,e)}registerCsiHandler(t,e){return this._inputHandler.registerCsiHandler(t,e)}registerOscHandler(t,e){return this._inputHandler.registerOscHandler(t,e)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let t=!1,e=this.optionsService.rawOptions.windowsPty;e&&e.buildNumber!==void 0&&e.buildNumber!==void 0?t=e.backend==="conpty"&&e.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(t=!0),t?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let t=[];t.push(this.onLineFeed(C$.bind(null,this._bufferService))),t.push(this.registerCsiHandler({final:"H"},()=>(C$(this._bufferService),!1))),this._windowsWrappingHeuristics.value=zt(()=>{for(let e of t)e.dispose()})}}},hee={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function uee(t,e,i,n){var a;let r={type:0,cancel:!1,key:void 0},s=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?r.key=ue.ESC+"OA":r.key=ue.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?r.key=ue.ESC+"OD":r.key=ue.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?r.key=ue.ESC+"OC":r.key=ue.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?r.key=ue.ESC+"OB":r.key=ue.ESC+"[B");break;case 8:r.key=t.ctrlKey?"\b":ue.DEL,t.altKey&&(r.key=ue.ESC+r.key);break;case 9:if(t.shiftKey){r.key=ue.ESC+"[Z";break}r.key=ue.HT,r.cancel=!0;break;case 13:r.key=t.altKey?ue.ESC+ue.CR:ue.CR,r.cancel=!0;break;case 27:r.key=ue.ESC,t.altKey&&(r.key=ue.ESC+ue.ESC),r.cancel=!0;break;case 37:if(t.metaKey)break;s?r.key=ue.ESC+"[1;"+(s+1)+"D":e?r.key=ue.ESC+"OD":r.key=ue.ESC+"[D";break;case 39:if(t.metaKey)break;s?r.key=ue.ESC+"[1;"+(s+1)+"C":e?r.key=ue.ESC+"OC":r.key=ue.ESC+"[C";break;case 38:if(t.metaKey)break;s?r.key=ue.ESC+"[1;"+(s+1)+"A":e?r.key=ue.ESC+"OA":r.key=ue.ESC+"[A";break;case 40:if(t.metaKey)break;s?r.key=ue.ESC+"[1;"+(s+1)+"B":e?r.key=ue.ESC+"OB":r.key=ue.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(r.key=ue.ESC+"[2~");break;case 46:s?r.key=ue.ESC+"[3;"+(s+1)+"~":r.key=ue.ESC+"[3~";break;case 36:s?r.key=ue.ESC+"[1;"+(s+1)+"H":e?r.key=ue.ESC+"OH":r.key=ue.ESC+"[H";break;case 35:s?r.key=ue.ESC+"[1;"+(s+1)+"F":e?r.key=ue.ESC+"OF":r.key=ue.ESC+"[F";break;case 33:t.shiftKey?r.type=2:t.ctrlKey?r.key=ue.ESC+"[5;"+(s+1)+"~":r.key=ue.ESC+"[5~";break;case 34:t.shiftKey?r.type=3:t.ctrlKey?r.key=ue.ESC+"[6;"+(s+1)+"~":r.key=ue.ESC+"[6~";break;case 112:s?r.key=ue.ESC+"[1;"+(s+1)+"P":r.key=ue.ESC+"OP";break;case 113:s?r.key=ue.ESC+"[1;"+(s+1)+"Q":r.key=ue.ESC+"OQ";break;case 114:s?r.key=ue.ESC+"[1;"+(s+1)+"R":r.key=ue.ESC+"OR";break;case 115:s?r.key=ue.ESC+"[1;"+(s+1)+"S":r.key=ue.ESC+"OS";break;case 116:s?r.key=ue.ESC+"[15;"+(s+1)+"~":r.key=ue.ESC+"[15~";break;case 117:s?r.key=ue.ESC+"[17;"+(s+1)+"~":r.key=ue.ESC+"[17~";break;case 118:s?r.key=ue.ESC+"[18;"+(s+1)+"~":r.key=ue.ESC+"[18~";break;case 119:s?r.key=ue.ESC+"[19;"+(s+1)+"~":r.key=ue.ESC+"[19~";break;case 120:s?r.key=ue.ESC+"[20;"+(s+1)+"~":r.key=ue.ESC+"[20~";break;case 121:s?r.key=ue.ESC+"[21;"+(s+1)+"~":r.key=ue.ESC+"[21~";break;case 122:s?r.key=ue.ESC+"[23;"+(s+1)+"~":r.key=ue.ESC+"[23~";break;case 123:s?r.key=ue.ESC+"[24;"+(s+1)+"~":r.key=ue.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?r.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?r.key=ue.NUL:t.keyCode>=51&&t.keyCode<=55?r.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?r.key=ue.DEL:t.keyCode===219?r.key=ue.ESC:t.keyCode===220?r.key=ue.FS:t.keyCode===221&&(r.key=ue.GS);else if((!i||n)&&t.altKey&&!t.metaKey){let c=(a=hee[t.keyCode])==null?void 0:a[t.shiftKey?1:0];if(c)r.key=ue.ESC+c;else if(t.keyCode>=65&&t.keyCode<=90){let h=t.ctrlKey?t.keyCode-64:t.keyCode+32,d=String.fromCharCode(h);t.shiftKey&&(d=d.toUpperCase()),r.key=ue.ESC+d}else if(t.keyCode===32)r.key=ue.ESC+(t.ctrlKey?ue.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let h=t.code.slice(3,4);t.shiftKey||(h=h.toLowerCase()),r.key=ue.ESC+h,r.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(r.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?r.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(r.key=ue.US),t.key==="@"&&(r.key=ue.NUL));break}return r}var Yt=0,dee=class{constructor(t){this._getKey=t,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Kg,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Kg,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(t){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(t)}_flushInserted(){let t=this._insertedValues.sort((r,s)=>this._getKey(r)-this._getKey(s)),e=0,i=0,n=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<n.length;r++)i>=this._array.length||this._getKey(t[e])<=this._getKey(this._array[i])?(n[r]=t[e],e++):n[r]=this._array[i++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(t){if(this._flushCleanupInserted(),this._array.length===0)return!1;let e=this._getKey(t);if(e===void 0||(Yt=this._search(e),Yt===-1)||this._getKey(this._array[Yt])!==e)return!1;do if(this._array[Yt]===t)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Yt),!0;while(++Yt<this._array.length&&this._getKey(this._array[Yt])===e);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let t=this._deletedIndices.sort((r,s)=>r-s),e=0,i=new Array(this._array.length-t.length),n=0;for(let r=0;r<this._array.length;r++)t[e]===r?e++:i[n++]=this._array[r];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Yt=this._search(t),!(Yt<0||Yt>=this._array.length)&&this._getKey(this._array[Yt])===t))do yield this._array[Yt];while(++Yt<this._array.length&&this._getKey(this._array[Yt])===t)}forEachByKey(t,e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Yt=this._search(t),!(Yt<0||Yt>=this._array.length)&&this._getKey(this._array[Yt])===t))do e(this._array[Yt]);while(++Yt<this._array.length&&this._getKey(this._array[Yt])===t)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(t){let e=0,i=this._array.length-1;for(;i>=e;){let n=e+i>>1,r=this._getKey(this._array[n]);if(r>t)i=n-1;else if(r<t)e=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===t;)n--;return n}}return e}},by=0,j$=0,fee=class extends Fe{constructor(){super(),this._decorations=new dee(t=>t==null?void 0:t.marker.line),this._onDecorationRegistered=this._register(new Oe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Oe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(zt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new pee(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),n=e.onDispose(()=>{n.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let n=0,r=0;for(let s of this._decorations.getKeyIterator(e))n=s.options.x??0,r=n+(s.options.width??1),t>=n&&t<r&&(!i||(s.options.layer??"bottom")===i)&&(yield s)}forEachDecorationAtCell(t,e,i,n){this._decorations.forEachByKey(e,r=>{by=r.options.x??0,j$=by+(r.options.width??1),t>=by&&t<j$&&(!i||(r.options.layer??"bottom")===i)&&n(r)})}},pee=class extends Do{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new Oe),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Oe),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Bt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Bt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},gee=1e3,mee=class{constructor(t,e=gee){this._renderCallback=t,this._debounceThresholdMS=e,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(t,e,i){this._rowCount=i,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=n-this._lastRefreshMs,s=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e)}},D$=20,Jg=class extends Fe{constructor(t,e,i,n){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new mee(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
129
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(t){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),s_&&t&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(t){let e=this._getMouseBufferCoords(t),i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n||!e?!1:this._areCoordsInSelection(e,i,n)}isCellInSelection(t,e){let i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n?!1:this._areCoordsInSelection([t,e],i,n)}_areCoordsInSelection(t,e,i){return t[1]>e[1]&&t[1]<i[1]||e[1]===i[1]&&t[1]===e[1]&&t[0]>=e[0]&&t[0]<i[0]||e[1]<i[1]&&t[1]===i[1]&&t[0]<i[0]||e[1]<i[1]&&t[1]===e[1]&&t[0]>=e[0]}_selectWordAtCursor(t,e){var r,s;let i=(s=(r=this._linkifier.currentLink)==null?void 0:r.link)==null?void 0:s.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=p$(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(t);return n?(this._selectWordAt(n,e),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(t,e){this._model.clearSelection(),t=Math.max(t,0),e=Math.min(e,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,t],this._model.selectionEnd=[this._bufferService.cols,e],this.refresh(),this._onSelectionChange.fire()}_handleTrim(t){this._model.handleTrim(t)&&this.refresh()}_getMouseBufferCoords(t){let e=this._mouseService.getCoords(t,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(e)return e[0]--,e[1]--,e[1]+=this._bufferService.buffer.ydisp,e}_getMouseEventScrollAmount(t){let e=r_(this._coreBrowserService.window,t,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return e>=0&&e<=i?0:(e>i&&(e-=i),e=Math.min(Math.max(e,-gy),gy),e/=gy,e/Math.abs(e)+Math.round(e*(CJ-1)))}shouldForceSelection(t){return Fg?t.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:t.shiftKey}handleMouseDown(t){if(this._mouseDownTimeStamp=t.timeStamp,!(t.button===2&&this.hasSelection)&&t.button===0){if(!this._enabled){if(!this.shouldForceSelection(t))return;t.stopPropagation()}t.preventDefault(),this._dragScrollAmount=0,this._enabled&&t.shiftKey?this._handleIncrementalClick(t):t.detail===1?this._handleSingleClick(t):t.detail===2?this._handleDoubleClick(t):t.detail===3&&this._handleTripleClick(t),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),TJ)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(t){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(t))}_handleSingleClick(t){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(t)?3:0,this._model.selectionStart=this._getMouseBufferCoords(t),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let e=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);e&&e.length!==this._model.selectionStart[0]&&e.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(t){this._selectWordAtCursor(t,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(t){let e=this._getMouseBufferCoords(t);e&&(this._activeSelectionMode=2,this._selectLineAt(e[1]))}shouldColumnSelect(t){return t.altKey&&!(Fg&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(t){if(t.stopImmediatePropagation(),!this._model.selectionStart)return;let e=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(t),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(t),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let n=i.lines.get(this._model.selectionEnd[1]);n&&n.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!e||e[0]!==this._model.selectionEnd[0]||e[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let t=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(t.ydisp+this._bufferService.rows,t.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=t.ydisp),this.refresh()}}_handleMouseUp(t){let e=t.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&e<QJ&&t.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(t,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let n=vJ(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd,i=!!t&&!!e&&(t[0]!==e[0]||t[1]!==e[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(t,e,i);return}!t||!e||(!this._oldSelectionStart||!this._oldSelectionEnd||t[0]!==this._oldSelectionStart[0]||t[1]!==this._oldSelectionStart[1]||e[0]!==this._oldSelectionEnd[0]||e[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(t,e,i)}_fireOnSelectionChange(t,e,i){this._oldSelectionStart=t,this._oldSelectionEnd=e,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(t){this.clearSelection(),this._trimListener.dispose(),this._trimListener=t.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(t,e){let i=e;for(let n=0;e>=n;n++){let r=t.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&e!==n&&(i+=r-1)}return i}setSelection(t,e,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[t,e],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(t){this._isClickInSelection(t)||(this._selectWordAtCursor(t,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(t,e,i=!0,n=!0){if(t[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,s=r.lines.get(t[1]);if(!s)return;let a=r.translateBufferLineToString(t[1],!1),c=this._convertViewportColToCharacterIndex(s,t[0]),h=c,d=t[0]-c,f=0,g=0,m=0,O=0;if(a.charAt(c)===" "){for(;c>0&&a.charAt(c-1)===" ";)c--;for(;h<a.length&&a.charAt(h+1)===" ";)h++}else{let w=t[0],x=t[0];s.getWidth(w)===0&&(f++,w--),s.getWidth(x)===2&&(g++,x++);let Q=s.getString(x).length;for(Q>1&&(O+=Q-1,h+=Q-1);w>0&&c>0&&!this._isCharWordSeparator(s.loadCell(w-1,this._workCell));){s.loadCell(w-1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===0?(f++,w--):k>1&&(m+=k-1,c-=k-1),c--,w--}for(;x<s.length&&h+1<a.length&&!this._isCharWordSeparator(s.loadCell(x+1,this._workCell));){s.loadCell(x+1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,x++):k>1&&(O+=k-1,h+=k-1),h++,x++}}h++;let S=c+d-f+m,_=Math.min(this._bufferService.cols,h-c+f+g-m-O);if(!(!e&&a.slice(c,h).trim()==="")){if(i&&S===0&&s.getCodePoint(0)!==32){let w=r.lines.get(t[1]-1);if(w&&s.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let x=this._getWordAt([this._bufferService.cols-1,t[1]-1],!1,!0,!1);if(x){let Q=this._bufferService.cols-x.start;S-=Q,_+=Q}}}if(n&&S+_===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let w=r.lines.get(t[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let x=this._getWordAt([0,t[1]+1],!1,!1,!0);x&&(_+=x.length)}}return{start:S,length:_}}}_selectWordAt(t,e){let i=this._getWordAt(t,e);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,t[1]--;this._model.selectionStart=[i.start,t[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(t){let e=this._getWordAt(t,!0);if(e){let i=t[1];for(;e.start<0;)e.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;e.start+e.length>this._bufferService.cols;)e.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?e.start:e.start+e.length,i]}}_isCharWordSeparator(t){return t.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(t.getChars())>=0}_selectLineAt(t){let e=this._bufferService.buffer.getWrappedRangeForLine(t),i={start:{x:0,y:e.first},end:{x:this._bufferService.cols-1,y:e.last}};this._model.selectionStart=[0,e.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=p$(i,this._bufferService.cols)}};d1=qt([be(3,tn),be(4,el),be(5,Fb),be(6,nn),be(7,Ns),be(8,Xs)],d1);var g$=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},m$=class{constructor(){this._color=new g$,this._css=new g$}setCss(t,e,i){this._css.set(t,e,i)}getCss(t,e){return this._css.get(t,e)}setColor(t,e,i){this._color.set(t,e,i)}getColor(t,e){return this._color.get(t,e)}clear(){this._color.clear(),this._css.clear()}},hi=Object.freeze((()=>{let t=[Bt.toColor("#2e3436"),Bt.toColor("#cc0000"),Bt.toColor("#4e9a06"),Bt.toColor("#c4a000"),Bt.toColor("#3465a4"),Bt.toColor("#75507b"),Bt.toColor("#06989a"),Bt.toColor("#d3d7cf"),Bt.toColor("#555753"),Bt.toColor("#ef2929"),Bt.toColor("#8ae234"),Bt.toColor("#fce94f"),Bt.toColor("#729fcf"),Bt.toColor("#ad7fa8"),Bt.toColor("#34e2e2"),Bt.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let n=e[i/36%6|0],r=e[i/6%6|0],s=e[i%6];t.push({css:si.toCss(n,r,s),rgba:si.toRgba(n,r,s)})}for(let i=0;i<24;i++){let n=8+i*10;t.push({css:si.toCss(n,n,n),rgba:si.toRgba(n,n,n)})}return t})()),xa=Bt.toColor("#ffffff"),su=Bt.toColor("#000000"),O$=Bt.toColor("#ffffff"),v$=su,Uh={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},EJ=xa,f1=class extends Fe{constructor(t){super(),this._optionsService=t,this._contrastCache=new m$,this._halfContrastCache=new m$,this._onChangeColors=this._register(new Oe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:xa,background:su,cursor:O$,cursorAccent:v$,selectionForeground:void 0,selectionBackgroundTransparent:Uh,selectionBackgroundOpaque:Et.blend(su,Uh),selectionInactiveBackgroundTransparent:Uh,selectionInactiveBackgroundOpaque:Et.blend(su,Uh),scrollbarSliderBackground:Et.opacity(xa,.2),scrollbarSliderHoverBackground:Et.opacity(xa,.4),scrollbarSliderActiveBackground:Et.opacity(xa,.5),overviewRulerBorder:xa,ansi:hi.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(t={}){let e=this._colors;if(e.foreground=xt(t.foreground,xa),e.background=xt(t.background,su),e.cursor=Et.blend(e.background,xt(t.cursor,O$)),e.cursorAccent=Et.blend(e.background,xt(t.cursorAccent,v$)),e.selectionBackgroundTransparent=xt(t.selectionBackground,Uh),e.selectionBackgroundOpaque=Et.blend(e.background,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundTransparent=xt(t.selectionInactiveBackground,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundOpaque=Et.blend(e.background,e.selectionInactiveBackgroundTransparent),e.selectionForeground=t.selectionForeground?xt(t.selectionForeground,u$):void 0,e.selectionForeground===u$&&(e.selectionForeground=void 0),Et.isOpaque(e.selectionBackgroundTransparent)&&(e.selectionBackgroundTransparent=Et.opacity(e.selectionBackgroundTransparent,.3)),Et.isOpaque(e.selectionInactiveBackgroundTransparent)&&(e.selectionInactiveBackgroundTransparent=Et.opacity(e.selectionInactiveBackgroundTransparent,.3)),e.scrollbarSliderBackground=xt(t.scrollbarSliderBackground,Et.opacity(e.foreground,.2)),e.scrollbarSliderHoverBackground=xt(t.scrollbarSliderHoverBackground,Et.opacity(e.foreground,.4)),e.scrollbarSliderActiveBackground=xt(t.scrollbarSliderActiveBackground,Et.opacity(e.foreground,.5)),e.overviewRulerBorder=xt(t.overviewRulerBorder,EJ),e.ansi=hi.slice(),e.ansi[0]=xt(t.black,hi[0]),e.ansi[1]=xt(t.red,hi[1]),e.ansi[2]=xt(t.green,hi[2]),e.ansi[3]=xt(t.yellow,hi[3]),e.ansi[4]=xt(t.blue,hi[4]),e.ansi[5]=xt(t.magenta,hi[5]),e.ansi[6]=xt(t.cyan,hi[6]),e.ansi[7]=xt(t.white,hi[7]),e.ansi[8]=xt(t.brightBlack,hi[8]),e.ansi[9]=xt(t.brightRed,hi[9]),e.ansi[10]=xt(t.brightGreen,hi[10]),e.ansi[11]=xt(t.brightYellow,hi[11]),e.ansi[12]=xt(t.brightBlue,hi[12]),e.ansi[13]=xt(t.brightMagenta,hi[13]),e.ansi[14]=xt(t.brightCyan,hi[14]),e.ansi[15]=xt(t.brightWhite,hi[15]),t.extendedAnsi){let i=Math.min(e.ansi.length-16,t.extendedAnsi.length);for(let n=0;n<i;n++)e.ansi[n+16]=xt(t.extendedAnsi[n],hi[n+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(t){this._restoreColor(t),this._onChangeColors.fire(this.colors)}_restoreColor(t){if(t===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(t){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[t]=this._restoreColors.ansi[t]}}modifyColors(t){t(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};f1=qt([be(0,nn)],f1);function xt(t,e){if(t!==void 0)try{return Bt.toColor(t)}catch{}return e}var RJ=class{constructor(...t){this._entries=new Map;for(let[e,i]of t)this.set(e,i)}set(t,e){let i=this._entries.get(t);return this._entries.set(t,e),i}forEach(t){for(let[e,i]of this._entries.entries())t(e,i)}has(t){return this._entries.has(t)}get(t){return this._entries.get(t)}},AJ=class{constructor(){this._services=new RJ,this._services.set(Gb,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=CF(t).sort((s,a)=>s.index-a.index),n=[];for(let s of i){let a=this._services.get(s.id);if(!a)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${s.id._id}.`);n.push(a)}let r=i.length>0?i[0].index:e.length;if(e.length!==r)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${r+1} conflicts with ${e.length} static arguments`);return new t(...e,...n)}},MJ={trace:0,debug:1,info:2,warn:3,error:4,off:5},zJ="xterm.js: ",p1=class extends Fe{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=MJ[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":zJ)+e,...i)}trace(t,...e){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,e)}debug(t,...e){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,e)}info(t,...e){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,e)}warn(t,...e){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,e)}error(t,...e){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,e)}};p1=qt([be(0,nn)],p1);var y$=class extends Fe{constructor(t){super(),this._maxLength=t,this.onDeleteEmitter=this._register(new Oe),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Oe),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Oe),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(t){if(this._maxLength===t)return;let e=new Array(t);for(let i=0;i<Math.min(t,this.length);i++)e[i]=this._array[this._getCyclicIndex(i)];this._array=e,this._maxLength=t,this._startIndex=0}get length(){return this._length}set length(t){if(t>this._length)for(let e=this._length;e<t;e++)this._array[e]=void 0;this._length=t}get(t){return this._array[this._getCyclicIndex(t)]}set(t,e){this._array[this._getCyclicIndex(t)]=e}push(t){this._array[this._getCyclicIndex(this._length)]=t,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(t,e,...i){if(e){for(let n=t;n<this._length-e;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+e)];this._length-=e,this.onDeleteEmitter.fire({index:t,amount:e})}for(let n=this._length-1;n>=t;n--)this._array[this._getCyclicIndex(n+i.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<i.length;n++)this._array[this._getCyclicIndex(t+n)]=i[n];if(i.length&&this.onInsertEmitter.fire({index:t,amount:i.length}),this._length+i.length>this._maxLength){let n=this._length+i.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=i.length}trimStart(t){t>this._length&&(t=this._length),this._startIndex+=t,this._length-=t,this.onTrimEmitter.fire(t)}shiftElements(t,e,i){if(!(e<=0)){if(t<0||t>=this._length)throw new Error("start argument out of range");if(t+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=e-1;r>=0;r--)this.set(t+r+i,this.get(t+r));let n=t+e+i-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<e;n++)this.set(t+n+i,this.get(t+n))}}_getCyclicIndex(t){return(this._startIndex+t)%this._maxLength}},Ue=3,ri=Object.freeze(new fd),Pp=0,my=2,ou=class Pz{constructor(e,i,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Ue);let r=i||rr.fromCharData([0,UM,1,0]);for(let s=0;s<e;++s)this.setCell(s,r);this.length=e}get(e){let i=this._data[e*Ue+0],n=i&2097151;return[this._data[e*Ue+1],i&2097152?this._combined[e]:n?Po(n):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,i){this._data[e*Ue+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*Ue+0]=e|2097152|i[2]<<22):this._data[e*Ue+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*Ue+0]>>22}hasWidth(e){return this._data[e*Ue+0]&12582912}getFg(e){return this._data[e*Ue+1]}getBg(e){return this._data[e*Ue+2]}hasContent(e){return this._data[e*Ue+0]&4194303}getCodePoint(e){let i=this._data[e*Ue+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*Ue+0]&2097152}getString(e){let i=this._data[e*Ue+0];return i&2097152?this._combined[e]:i&2097151?Po(i&2097151):""}isProtected(e){return this._data[e*Ue+2]&536870912}loadCell(e,i){return Pp=e*Ue,i.content=this._data[Pp+0],i.fg=this._data[Pp+1],i.bg=this._data[Pp+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*Ue+0]=i.content,this._data[e*Ue+1]=i.fg,this._data[e*Ue+2]=i.bg}setCellFromCodepoint(e,i,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Ue+0]=i|n<<22,this._data[e*Ue+1]=r.fg,this._data[e*Ue+2]=r.bg}addCodepointToCell(e,i,n){let r=this._data[e*Ue+0];r&2097152?this._combined[e]+=Po(i):r&2097151?(this._combined[e]=Po(r&2097151)+Po(i),r&=-2097152,r|=2097152):r=i|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*Ue+0]=r}insertCells(e,i,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length-e){let r=new rr;for(let s=this.length-e-i-1;s>=0;--s)this.setCell(e+i+s,this.loadCell(e+s,r));for(let s=0;s<i;++s)this.setCell(e+s,n)}else for(let r=e;r<this.length;++r)this.setCell(r,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,i,n){if(e%=this.length,i<this.length-e){let r=new rr;for(let s=0;s<this.length-e-i;++s)this.setCell(e+s,this.loadCell(e+i+s,r));for(let s=this.length-i;s<this.length;++s)this.setCell(s,n)}else for(let r=e;r<this.length;++r)this.setCell(r,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,i,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,n);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,n);e<i&&e<this.length;)this.setCell(e++,n)}resize(e,i){if(e===this.length)return this._data.length*4*my<this._data.buffer.byteLength;let n=e*Ue;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let r=new Uint32Array(n);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,n);let r=Object.keys(this._combined);for(let a=0;a<r.length;a++){let c=parseInt(r[a],10);c>=e&&delete this._combined[c]}let s=Object.keys(this._extendedAttrs);for(let a=0;a<s.length;a++){let c=parseInt(s[a],10);c>=e&&delete this._extendedAttrs[c]}}return this.length=e,n*4*my<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*my<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,e);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(let i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let e=new Pz(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let i in this._combined)e._combined[i]=this._combined[i];for(let i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Ue+0]&4194303)return e+(this._data[e*Ue+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Ue+0]&4194303||this._data[e*Ue+2]&50331648)return e+(this._data[e*Ue+0]>>22);return 0}copyCellsFrom(e,i,n,r,s){let a=e._data;if(s)for(let h=r-1;h>=0;h--){for(let d=0;d<Ue;d++)this._data[(n+h)*Ue+d]=a[(i+h)*Ue+d];a[(i+h)*Ue+2]&268435456&&(this._extendedAttrs[n+h]=e._extendedAttrs[i+h])}else for(let h=0;h<r;h++){for(let d=0;d<Ue;d++)this._data[(n+h)*Ue+d]=a[(i+h)*Ue+d];a[(i+h)*Ue+2]&268435456&&(this._extendedAttrs[n+h]=e._extendedAttrs[i+h])}let c=Object.keys(e._combined);for(let h=0;h<c.length;h++){let d=parseInt(c[h],10);d>=i&&(this._combined[d-i+n]=e._combined[d])}}translateToString(e,i,n,r){i=i??0,n=n??this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let s="";for(;i<n;){let a=this._data[i*Ue+0],c=a&2097151,h=a&2097152?this._combined[i]:c?Po(c):Mo;if(s+=h,r)for(let d=0;d<h.length;++d)r.push(i);i+=a>>22||1}return r&&r.push(i),s}};function jJ(t,e,i,n,r,s){let a=[];for(let c=0;c<t.length-1;c++){let h=c,d=t.get(++h);if(!d.isWrapped)continue;let f=[t.get(c)];for(;h<t.length&&d.isWrapped;)f.push(d),d=t.get(++h);if(!s&&n>=c&&n<h){c+=f.length-1;continue}let g=0,m=Uu(f,g,e),O=1,S=0;for(;O<f.length;){let w=Uu(f,O,e),x=w-S,Q=i-m,k=Math.min(x,Q);f[g].copyCellsFrom(f[O],S,m,k,!1),m+=k,m===i&&(g++,m=0),S+=k,S===w&&(O++,S=0),m===0&&g!==0&&f[g-1].getWidth(i-1)===2&&(f[g].copyCellsFrom(f[g-1],i-1,m++,1,!1),f[g-1].setCell(i-1,r))}f[g].replaceCells(m,i,r);let _=0;for(let w=f.length-1;w>0&&(w>g||f[w].getTrimmedLength()===0);w--)_++;_>0&&(a.push(c+f.length-_),a.push(_)),c+=f.length-1}return a}function DJ(t,e){let i=[],n=0,r=e[n],s=0;for(let a=0;a<t.length;a++)if(r===a){let c=e[++n];t.onDeleteEmitter.fire({index:a-s,amount:c}),a+=c-1,s+=c,r=e[++n]}else i.push(a);return{layout:i,countRemoved:s}}function BJ(t,e){let i=[];for(let n=0;n<e.length;n++)i.push(t.get(e[n]));for(let n=0;n<i.length;n++)t.set(n,i[n]);t.length=e.length}function LJ(t,e,i){let n=[],r=t.map((h,d)=>Uu(t,d,e)).reduce((h,d)=>h+d),s=0,a=0,c=0;for(;c<r;){if(r-c<i){n.push(r-c);break}s+=i;let h=Uu(t,a,e);s>h&&(s-=h,a++);let d=t[a].getWidth(s-1)===2;d&&s--;let f=d?i-1:i;n.push(f),c+=f}return n}function Uu(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let n=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,r=t[e+1].getWidth(0)===2;return n&&r?i-1:i}var Ez=class Rz{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=Rz._nextId++,this._onDispose=this.register(new Oe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ga(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Ez._nextId=1;var XJ=Ez,gi={},wa=gi.B;gi[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};gi.A={"#":"£"};gi.B=void 0;gi[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};gi.C=gi[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gi.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};gi.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};gi.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};gi.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};gi.E=gi[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};gi.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};gi.H=gi[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gi["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var S$=4294967295,b$=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ri.clone(),this.savedCharset=wa,this.markers=[],this._nullCell=rr.fromCharData([0,UM,1,0]),this._whitespaceCell=rr.fromCharData([0,Mo,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Kg,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new y$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Hg),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Hg),this._whitespaceCell}getBlankLine(t,e){return new ou(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>S$?S$:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=ri);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new y$(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(ri),n=0,r=this._getCorrectBufferLength(e);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<t)for(let a=0;a<this.lines.length;a++)n+=+this.lines.get(a).resize(t,i);let s=0;if(this._rows<e)for(let a=this._rows;a<e;a++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new ou(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new ou(t,i)));else for(let a=this._rows;a>e;a--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let a=this.lines.length-r;a>0&&(this.lines.trimStart(a),this.ybase=Math.max(this.ybase-a,0),this.ydisp=Math.max(this.ydisp-a,0),this.savedY=Math.max(this.savedY-a,0)),this.lines.maxLength=r}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let s=0;s<this.lines.length;s++)n+=+this.lines.get(s).resize(t,i);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,n=jJ(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(ri),i);if(n.length>0){let r=DJ(this.lines,n);BJ(this.lines,r.layout),this._reflowLargerAdjustViewport(t,e,r.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let n=this.getNullCell(ri),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new ou(t,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(ri),r=[],s=0;for(let a=this.lines.length-1;a>=0;a--){let c=this.lines.get(a);if(!c||!c.isWrapped&&c.getTrimmedLength()<=t)continue;let h=[c];for(;c.isWrapped&&a>0;)c=this.lines.get(--a),h.unshift(c);if(!i){let k=this.ybase+this.y;if(k>=a&&k<a+h.length)continue}let d=h[h.length-1].getTrimmedLength(),f=LJ(h,this._cols,t),g=f.length-h.length,m;this.ybase===0&&this.y!==this.lines.length-1?m=Math.max(0,this.y-this.lines.maxLength+g):m=Math.max(0,this.lines.length-this.lines.maxLength+g);let O=[];for(let k=0;k<g;k++){let T=this.getBlankLine(ri,!0);O.push(T)}O.length>0&&(r.push({start:a+h.length+s,newLines:O}),s+=O.length),h.push(...O);let S=f.length-1,_=f[S];_===0&&(S--,_=f[S]);let w=h.length-g-1,x=d;for(;w>=0;){let k=Math.min(x,_);if(h[S]===void 0)break;if(h[S].copyCellsFrom(h[w],x-k,_-k,k,!0),_-=k,_===0&&(S--,_=f[S]),x-=k,x===0){w--;let T=Math.max(w,0);x=Uu(h,T,this._cols)}}for(let k=0;k<h.length;k++)f[k]<t&&h[k].setCell(f[k],n);let Q=g-m;for(;Q-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+e-1)}if(r.length>0){let a=[],c=[];for(let _=0;_<this.lines.length;_++)c.push(this.lines.get(_));let h=this.lines.length,d=h-1,f=0,g=r[f];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let m=0;for(let _=Math.min(this.lines.maxLength-1,h+s-1);_>=0;_--)if(g&&g.start>d+m){for(let w=g.newLines.length-1;w>=0;w--)this.lines.set(_--,g.newLines[w]);_++,a.push({index:d+1,amount:g.newLines.length}),m+=g.newLines.length,g=r[++f]}else this.lines.set(_,c[d--]);let O=0;for(let _=a.length-1;_>=0;_--)a[_].index+=O,this.lines.onInsertEmitter.fire(a[_]),O+=a[_].amount;let S=Math.max(0,h+s-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(t,e,i=0,n){let r=this.lines.get(t);return r?r.translateToString(e,i,n):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:e,last:i}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new XJ(t);return this.markers.push(e),e.register(this.lines.onTrim(i=>{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.line<i.index+i.amount&&e.dispose(),e.line>i.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},NJ=class extends Fe{constructor(t,e){super(),this._optionsService=t,this._bufferService=e,this._onBufferActivate=this._register(new Oe),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new b$(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new b$(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(t){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(t),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(t,e){this._normal.resize(t,e),this._alt.resize(t,e),this.setupTabStops(t)}setupTabStops(t){this._normal.setupTabStops(t),this._alt.setupTabStops(t)}},Az=2,Mz=1,g1=class extends Fe{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new Oe),this.onResize=this._onResize.event,this._onScroll=this._register(new Oe),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,Az),this.rows=Math.max(t.rawOptions.rows||0,Mz),this.buffers=this._register(new NJ(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,n=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==t.fg||n.getBg(0)!==t.bg)&&(n=i.getBlankLine(t,e),this._cachedBlankLine=n),n.isWrapped=e;let r=i.ybase+i.scrollTop,s=i.ybase+i.scrollBottom;if(i.scrollTop===0){let a=i.lines.isFull;s===i.lines.length-1?a?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(s+1,0,n.clone()),a?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let a=s-r+1;i.lines.shiftElements(r+1,a-1,-1),i.lines.set(s,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let n=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),n!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};g1=qt([be(0,nn)],g1);var Vl={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Fg,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},ZJ=["normal","bold","100","200","300","400","500","600","700","800","900"],WJ=class extends Fe{constructor(t){super(),this._onOptionChange=this._register(new Oe),this.onOptionChange=this._onOptionChange.event;let e={...Vl};for(let i in t)if(i in e)try{let n=t[i];e[i]=this._sanitizeAndValidateOption(i,n)}catch(n){console.error(n)}this.rawOptions=e,this.options={...e},this._setupOptions(),this._register(zt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(t,e){return this.onOptionChange(i=>{i===t&&e(this.rawOptions[t])})}onMultipleOptionChange(t,e){return this.onOptionChange(i=>{t.indexOf(i)!==-1&&e()})}_setupOptions(){let t=i=>{if(!(i in Vl))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},e=(i,n)=>{if(!(i in Vl))throw new Error(`No option with key "${i}"`);n=this._sanitizeAndValidateOption(i,n),this.rawOptions[i]!==n&&(this.rawOptions[i]=n,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let n={get:t.bind(this,i),set:e.bind(this,i)};Object.defineProperty(this.options,i,n)}}_sanitizeAndValidateOption(t,e){switch(t){case"cursorStyle":if(e||(e=Vl[t]),!qJ(e))throw new Error(`"${e}" is not a valid value for ${t}`);break;case"wordSeparator":e||(e=Vl[t]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=ZJ.includes(e)?e:Vl[t];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${t} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(e*10)/10));break;case"scrollback":if(e=Math.min(e,4294967295),e<0)throw new Error(`${t} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${t} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${t} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{};break}return e}};function qJ(t){return t==="block"||t==="underline"||t==="bar"}function au(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let n in t)i[n]=e<=1?t[n]:t[n]&&au(t[n],e-1);return i}var _$=Object.freeze({insertMode:!1}),x$=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),m1=class extends Fe{constructor(t,e,i){super(),this._bufferService=t,this._logService=e,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Oe),this.onData=this._onData.event,this._onUserInput=this._register(new Oe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Oe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Oe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=au(_$),this.decPrivateModes=au(x$)}reset(){this.modes=au(_$),this.decPrivateModes=au(x$)}triggerDataEvent(t,e=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;e&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),e&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`),this._logService.trace("sending data (codes)",()=>t.split("").map(n=>n.charCodeAt(0))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`),this._logService.trace("sending binary (codes)",()=>t.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(t))}};m1=qt([be(0,tn),be(1,ez),be(2,nn)],m1);var w$={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function Oy(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var vy=String.fromCharCode,k$={DEFAULT:t=>{let e=[Oy(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${vy(e[0])}${vy(e[1])}${vy(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Oy(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Oy(t,!0)};${t.x};${t.y}${e}`}},O1=class extends Fe{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Oe),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(w$))this.addProtocol(n,w$[n]);for(let n of Object.keys(k$))this.addEncoding(n,k$[n]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let n=e/i,r=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=n+0,Math.abs(t.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};O1=qt([be(0,tn),be(1,el),be(2,nn)],O1);var yy=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],VJ=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],ui;function IJ(t,e){let i=0,n=e.length-1,r;if(t<e[0][0]||t>e[n][1])return!1;for(;n>=i;)if(r=i+n>>1,t>e[r][1])i=r+1;else if(t<e[r][0])n=r-1;else return!0;return!1}var YJ=class{constructor(){if(this.version="6",!ui){ui=new Uint8Array(65536),ui.fill(1),ui[0]=0,ui.fill(0,1,32),ui.fill(0,127,160),ui.fill(2,4352,4448),ui[9001]=2,ui[9002]=2,ui.fill(2,11904,42192),ui[12351]=1,ui.fill(2,44032,55204),ui.fill(2,63744,64256),ui.fill(2,65040,65050),ui.fill(2,65072,65136),ui.fill(2,65280,65377),ui.fill(2,65504,65511);for(let t=0;t<yy.length;++t)ui.fill(0,yy[t][0],yy[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?ui[t]:IJ(t,VJ)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,e){let i=this.wcwidth(t),n=i===0&&e!==0;if(n){let r=Aa.extractWidth(e);r===0?n=!1:r>i&&(i=r)}return Aa.createPropertyValue(0,i,n)}},Aa=class tg{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Oe,this.onChange=this._onChange.event;let e=new YJ;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,n=!1){return(e&16777215)<<3|(i&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,n=0,r=e.length;for(let s=0;s<r;++s){let a=e.charCodeAt(s);if(55296<=a&&a<=56319){if(++s>=r)return i+this.wcwidth(a);let d=e.charCodeAt(s);56320<=d&&d<=57343?a=(a-55296)*1024+d-56320+65536:i+=this.wcwidth(d)}let c=this.charProperties(a,n),h=tg.extractWidth(c);tg.extractShouldJoin(c)&&(h-=tg.extractWidth(n)),i+=h,n=c}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},HJ=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(t){this.glevel=t,this.charset=this._charsets[t]}setgCharset(t,e){this._charsets[t]=e,this.glevel===t&&(this.charset=e)}};function C$(t){var n;let e=(n=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1))==null?void 0:n.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var Gh=2147483647,UJ=256,zz=class v1{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>UJ)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new v1;if(!e.length)return i;for(let n=Array.isArray(e[0])?1:0;n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let s=0;s<r.length;++s)i.addSubParam(r[s]);else i.addParam(r)}return i}clone(){let e=new v1(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let n=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Gh?Gh:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Gh?Gh:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-i>0?this._subParams.subarray(i,n):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let n=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-n>0&&(e[i]=this._subParams.slice(n,r))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[i-1];n[i-1]=~r?Math.min(r*10+e,Gh):e}},Fh=[],GJ=class{constructor(){this._state=0,this._active=Fh,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let n=i.indexOf(e);n!==-1&&i.splice(n,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Fh}reset(){if(this._state===2)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].end(!1);this._stack.paused=!1,this._active=Fh,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Fh,!this._active.length)this._handlerFb(this._id,"START");else for(let t=this._active.length-1;t>=0;t--)this._active[t].start()}_put(t,e,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Qm(t,e,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(t,e,i)}start(){this.reset(),this._state=1}put(t,e,i){if(this._state!==3){if(this._state===1)for(;e<i;){let n=t[e++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&i-e>0&&this._put(t,e,i)}}end(t,e=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",t);else{let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=e,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].end(t),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=Fh,this._id=-1,this._state=0}}},Mn=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Qm(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data),e instanceof Promise))return e.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,e}},Kh=[],FJ=class{constructor(){this._handlers=Object.create(null),this._active=Kh,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Kh}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let n=i.indexOf(e);n!==-1&&i.splice(n,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}reset(){if(this._active.length)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].unhook(!1);this._stack.paused=!1,this._active=Kh,this._ident=0}hook(t,e){if(this.reset(),this._ident=t,this._active=this._handlers[t]||Kh,!this._active.length)this._handlerFb(this._ident,"HOOK",e);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(e)}put(t,e,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Qm(t,e,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(t,e,i)}unhook(t,e=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",t);else{let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=e,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].unhook(t),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=Kh,this._ident=0}},lu=new zz;lu.addParam(0);var T$=class{constructor(t){this._handler=t,this._data="",this._params=lu,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():lu,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Qm(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=lu,this._data="",this._hitLimit=!1,i));return this._params=lu,this._data="",this._hitLimit=!1,e}},KJ=class{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,i,n){this.table[e<<8|t]=i<<4|n}addMany(t,e,i,n){for(let r=0;r<t.length;r++)this.table[e<<8|t[r]]=i<<4|n}},Kn=160,JJ=(function(){let t=new KJ(4095),e=Array.apply(null,Array(256)).map((c,h)=>h),i=(c,h)=>e.slice(c,h),n=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let s=i(0,14),a;t.setDefault(1,0),t.addMany(n,0,2,0);for(a in s)t.addMany([24,26,153,154],a,3,0),t.addMany(i(128,144),a,3,0),t.addMany(i(144,152),a,3,0),t.add(156,a,0,0),t.add(27,a,11,1),t.add(157,a,4,8),t.addMany([152,158,159],a,0,7),t.add(155,a,11,3),t.add(144,a,11,9);return t.addMany(r,0,3,0),t.addMany(r,1,3,1),t.add(127,1,0,1),t.addMany(r,8,0,8),t.addMany(r,3,3,3),t.add(127,3,0,3),t.addMany(r,4,3,4),t.add(127,4,0,4),t.addMany(r,6,3,6),t.addMany(r,5,3,5),t.add(127,5,0,5),t.addMany(r,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(n,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(n,7,0,7),t.addMany(r,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(r,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(r,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(r,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(r,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(r,13,13,13),t.addMany(n,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(Kn,0,2,0),t.add(Kn,8,5,8),t.add(Kn,6,0,6),t.add(Kn,11,0,11),t.add(Kn,13,13,13),t})(),eee=class extends Fe{constructor(t=JJ){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new zz,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(zt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new GJ),this._dcsParser=this._register(new FJ),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(t,e=[64,126]){let i=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=t.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<t.intermediates.length;++r){let s=t.intermediates.charCodeAt(r);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=s}}if(t.final.length!==1)throw new Error("final must be a single byte");let n=t.final.charCodeAt(0);if(e[0]>n||n>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return i<<=8,i|=n,i}identToString(t){let e=[];for(;t;)e.push(String.fromCharCode(t&255)),t>>=8;return e.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,e){let i=this._identifier(t,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let n=this._escHandlers[i];return n.push(e),{dispose:()=>{let r=n.indexOf(e);r!==-1&&n.splice(r,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,e){this._executeHandlers[t.charCodeAt(0)]=e}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,e){let i=this._identifier(t);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let n=this._csiHandlers[i];return n.push(e),{dispose:()=>{let r=n.indexOf(e);r!==-1&&n.splice(r,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,e){return this._dcsParser.registerHandler(this._identifier(t),e)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,e){return this._oscParser.registerHandler(t,e)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(t,e,i,n,r){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=i,this._parseStack.transition=n,this._parseStack.chunkPos=r}parse(t,e,i){let n=0,r=0,s=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let c=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&h>-1){for(;h>=0&&(a=c[h](this._params),a!==!0);h--)if(a instanceof Promise)return this._parseStack.handlerPos=h,a}this._parseStack.handlers=[];break;case 4:if(i===!1&&h>-1){for(;h>=0&&(a=c[h](),a!==!0);h--)if(a instanceof Promise)return this._parseStack.handlerPos=h,a}this._parseStack.handlers=[];break;case 6:if(n=t[this._parseStack.chunkPos],a=this._dcsParser.unhook(n!==24&&n!==26,i),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=t[this._parseStack.chunkPos],a=this._oscParser.end(n!==24&&n!==26,i),a)return a;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let c=s;c<e;++c){switch(n=t[c],r=this._transitions.table[this.currentState<<8|(n<160?n:Kn)],r>>4){case 2:for(let m=c+1;;++m){if(m>=e||(n=t[m])<32||n>126&&n<Kn){this._printHandler(t,c,m),c=m-1;break}if(++m>=e||(n=t[m])<32||n>126&&n<Kn){this._printHandler(t,c,m),c=m-1;break}if(++m>=e||(n=t[m])<32||n>126&&n<Kn){this._printHandler(t,c,m),c=m-1;break}if(++m>=e||(n=t[m])<32||n>126&&n<Kn){this._printHandler(t,c,m),c=m-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:c,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|n],d=h?h.length-1:-1;for(;d>=0&&(a=h[d](this._params),a!==!0);d--)if(a instanceof Promise)return this._preserveStack(3,h,d,r,c),a;d<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++c<e&&(n=t[c])>47&&n<60);c--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let f=this._escHandlers[this._collect<<8|n],g=f?f.length-1:-1;for(;g>=0&&(a=f[g](),a!==!0);g--)if(a instanceof Promise)return this._preserveStack(4,f,g,r,c),a;g<0&&this._escHandlerFb(this._collect<<8|n),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|n,this._params);break;case 13:for(let m=c+1;;++m)if(m>=e||(n=t[m])===24||n===26||n===27||n>127&&n<Kn){this._dcsParser.put(t,c,m),c=m-1;break}break;case 14:if(a=this._dcsParser.unhook(n!==24&&n!==26),a)return this._preserveStack(6,[],0,r,c),a;n===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let m=c+1;;m++)if(m>=e||(n=t[m])<32||n>127&&n<Kn){this._oscParser.put(t,c,m),c=m-1;break}break;case 6:if(a=this._oscParser.end(n!==24&&n!==26),a)return this._preserveStack(5,[],0,r,c),a;n===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},tee=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,iee=/^[\da-f]+$/;function Q$(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=tee.exec(e);if(i){let n=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/n*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/n*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/n*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),iee.exec(e)&&[3,6,9,12].includes(e.length))){let i=e.length/3,n=[0,0,0];for(let r=0;r<3;++r){let s=parseInt(e.slice(i*r,i*r+i),16);n[r]=i===1?s<<4:i===2?s:i===3?s>>4:s>>8}return n}}function Sy(t,e){let i=t.toString(16),n=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function nee(t,e=16){let[i,n,r]=t;return`rgb:${Sy(i,e)}/${Sy(n,e)}/${Sy(r,e)}`}var ree={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ko=131072,$$=10;function P$(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var E$=5e3,R$=0,see=class extends Fe{constructor(t,e,i,n,r,s,a,c,h=new eee){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=n,this._optionsService=r,this._oscLinkService=s,this._coreMouseService=a,this._unicodeService=c,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new wF,this._utf8Decoder=new kF,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ri.clone(),this._eraseAttrDataInternal=ri.clone(),this._onRequestBell=this._register(new Oe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Oe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Oe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Oe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Oe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Oe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Oe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Oe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Oe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Oe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Oe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Oe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Oe),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new y1(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,f)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:f.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,f,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:f,data:g})}),this._parser.setDcsHandlerFallback((d,f,g)=>{f==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:f,payload:g})}),this._parser.setPrintHandler((d,f,g)=>this.print(d,f,g)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(ue.BEL,()=>this.bell()),this._parser.setExecuteHandler(ue.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ue.BS,()=>this.backspace()),this._parser.setExecuteHandler(ue.HT,()=>this.tab()),this._parser.setExecuteHandler(ue.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ue.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Jp.IND,()=>this.index()),this._parser.setExecuteHandler(Jp.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Jp.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Mn(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Mn(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Mn(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Mn(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Mn(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Mn(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Mn(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Mn(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Mn(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Mn(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Mn(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Mn(d=>this.restoreCursorColor(d))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let d in gi)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T$((d,f)=>this.requestStatusString(d,f)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=n}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),E$))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${E$} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,n=this._activeBuffer.x,r=this._activeBuffer.y,s=0,a=this._parseStack.paused;if(a){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;n=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>ko&&(s=this._parseStack.position+ko)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(d=>d.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<ko&&(this._parseBuffer=new Uint32Array(Math.min(t.length,ko))),a||this._dirtyRowTracker.clearRange(),t.length>ko)for(let d=s;d<t.length;d+=ko){let f=d+ko<t.length?d+ko:t.length,g=typeof t=="string"?this._stringDecoder.decode(t.substring(d,f),this._parseBuffer):this._utf8Decoder.decode(t.subarray(d,f),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,g))return this._preserveStack(n,r,g,d),this._logSlowResolvingAsync(i),i}else if(!a){let d=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,d))return this._preserveStack(n,r,d,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==n||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let c=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(c,this._bufferService.rows-1)})}print(t,e,i){let n,r,s=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,c=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,f=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-e>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,f);let m=this._parser.precedingJoinState;for(let O=e;O<i;++O){if(n=t[O],n<127&&s){let x=s[String.fromCharCode(n)];x&&(n=x.charCodeAt(0))}let S=this._unicodeService.charProperties(n,m);r=Aa.extractWidth(S);let _=Aa.extractShouldJoin(S),w=_?Aa.extractWidth(m):0;if(m=S,a&&this._onA11yChar.fire(Po(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-w>c){if(h){let x=g,Q=this._activeBuffer.x-w;for(this._activeBuffer.x=w,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),w>0&&g instanceof ou&&g.copyCellsFrom(x,Q,0,w,!1);Q<c;)x.setCellFromCodepoint(Q++,0,1,f)}else if(this._activeBuffer.x=c-1,r===2)continue}if(_&&this._activeBuffer.x){let x=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-x,n,r);for(let Q=r-w;--Q>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,f);continue}if(d&&(g.insertCells(this._activeBuffer.x,r-w,this._activeBuffer.getNullCell(f)),g.getWidth(c-1)===2&&g.setCellFromCodepoint(c-1,0,1,f)),g.setCellFromCodepoint(this._activeBuffer.x++,n,r,f),r>0)for(;--r;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,f)}this._parser.precedingJoinState=m,this._activeBuffer.x<c&&i-e>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,f),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>P$(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new T$(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Mn(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var t;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&t.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,n=!1,r=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),n&&(s.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){var n;this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i<this._bufferService.rows;i++)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&n.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;e--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;e--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(ri));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let i=t.params[0]||1,n=Aa.extractWidth(e),r=this._activeBuffer.x-n,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),a=new Uint32Array(s.length*i),c=0;for(let d=0;d<s.length;){let f=s.codePointAt(d)||0;a[c++]=f,d+=f>65535?2:1}let h=c;for(let d=1;d<i;++d)a.copyWithin(h,0,c),h+=c;return this.print(a,0,h),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ue.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ue.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ue.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ue.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ue.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,wa),this._charsetService.setgCharset(1,wa),this._charsetService.setgCharset(2,wa),this._charsetService.setgCharset(3,wa);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),t.params[e]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(t,e){(_=>(_[_.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",_[_.SET=1]="SET",_[_.RESET=2]="RESET",_[_.PERMANENTLY_SET=3]="PERMANENTLY_SET",_[_.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:s}=this._coreMouseService,a=this._coreService,{buffers:c,cols:h}=this._bufferService,{active:d,alt:f}=c,g=this._optionsService.rawOptions,m=(_,w)=>(a.triggerDataEvent(`${ue.ESC}[${e?"":"?"}${_};${w}$y`),!0),O=_=>_?1:2,S=t.params[0];return e?S===2?m(S,4):S===4?m(S,O(a.modes.insertMode)):S===12?m(S,3):S===20?m(S,O(g.convertEol)):m(S,0):S===1?m(S,O(n.applicationCursorKeys)):S===3?m(S,g.windowOptions.setWinLines?h===80?2:h===132?1:0:0):S===6?m(S,O(n.origin)):S===7?m(S,O(n.wraparound)):S===8?m(S,3):S===9?m(S,O(r==="X10")):S===12?m(S,O(g.cursorBlink)):S===25?m(S,O(!a.isCursorHidden)):S===45?m(S,O(n.reverseWraparound)):S===66?m(S,O(n.applicationKeypad)):S===67?m(S,4):S===1e3?m(S,O(r==="VT200")):S===1002?m(S,O(r==="DRAG")):S===1003?m(S,O(r==="ANY")):S===1004?m(S,O(n.sendFocus)):S===1005?m(S,4):S===1006?m(S,O(s==="SGR")):S===1015?m(S,4):S===1016?m(S,O(s==="SGR_PIXELS")):S===1048?m(S,1):S===47||S===1047||S===1049?m(S,O(d===f)):S===2004?m(S,O(n.bracketedPasteMode)):S===2026?m(S,O(n.synchronizedOutput)):m(S,0)}_updateAttrColor(t,e,i,n,r){return e===2?(t|=50331648,t&=-16777216,t|=fd.fromColorRGB([i,n,r])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let n=[0,0,-1,0,0,0],r=0,s=0;do{if(n[s+r]=t.params[e+s],t.hasSubParams(e+s)){let a=t.getSubParams(e+s),c=0;do n[1]===5&&(r=1),n[s+c+1+r]=a[c];while(++c<a.length&&c+s+1+r<n.length);break}if(n[1]===5&&s+r>=2||n[1]===2&&s+r>=5)break;n[1]&&(r=1)}while(++s+e<t.length&&s+r<n.length);for(let a=2;a<n.length;++a)n[a]===-1&&(n[a]=0);switch(n[0]){case 38:i.fg=this._updateAttrColor(i.fg,n[1],n[3],n[4],n[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,n[1],n[3],n[4],n[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,n[1],n[3],n[4],n[5])}return s}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=ri.fg,t.bg=ri.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,n=this._curAttrData;for(let r=0;r<e;r++)i=t.params[r],i>=30&&i<=37?(n.fg&=-50331904,n.fg|=16777216|i-30):i>=40&&i<=47?(n.bg&=-50331904,n.bg|=16777216|i-40):i>=90&&i<=97?(n.fg&=-50331904,n.fg|=16777216|i-90|8):i>=100&&i<=107?(n.bg&=-50331904,n.bg|=16777216|i-100|8):i===0?this._processSGR0(n):i===1?n.fg|=134217728:i===3?n.bg|=67108864:i===4?(n.fg|=268435456,this._processUnderline(t.hasSubParams(r)?t.getSubParams(r)[0]:1,n)):i===5?n.fg|=536870912:i===7?n.fg|=67108864:i===8?n.fg|=1073741824:i===9?n.fg|=2147483648:i===2?n.bg|=134217728:i===21?this._processUnderline(2,n):i===22?(n.fg&=-134217729,n.bg&=-134217729):i===23?n.bg&=-67108865:i===24?(n.fg&=-268435457,this._processUnderline(0,n)):i===25?n.fg&=-536870913:i===27?n.fg&=-67108865:i===28?n.fg&=-1073741825:i===29?n.fg&=2147483647:i===39?(n.fg&=-67108864,n.fg|=ri.fg&16777215):i===49?(n.bg&=-67108864,n.bg|=ri.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(t,r,n):i===53?n.bg|=1073741824:i===55?n.bg&=-1073741825:i===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):i===100?(n.fg&=-67108864,n.fg|=ri.fg&16777215,n.bg&=-67108864,n.bg|=ri.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${ue.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){switch(t.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.ESC}[?${e};${i}R`);break}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ri.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!P$(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ue.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>$$&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>$$&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(t){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let n=i.shift(),r=i.shift();if(/^\d+$/.exec(n)){let s=parseInt(n);if(A$(s))if(r==="?")e.push({type:0,index:s});else{let a=Q$(r);a&&e.push({type:1,index:s,color:a})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),n=t.slice(e+1);return n?this._createHyperlink(i,n):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),n,r=i.findIndex(s=>s.startsWith("id="));return r!==-1&&(n=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let n=0;n<i.length&&!(e>=this._specialColors.length);++n,++e)if(i[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let r=Q$(i[n]);r&&this._onColor.fire([{type:1,index:this._specialColors[e],color:r}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let n=0;n<i.length;++n)if(/^\d+$/.exec(i[n])){let r=parseInt(i[n]);A$(r)&&e.push({type:2,index:r})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,wa),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(ree[t[0]],gi[t[1]]||wa),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=ri.clone(),this._eraseAttrDataInternal=ri.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new rr;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let i=this._activeBuffer.ybase+this._activeBuffer.y+e,n=this._activeBuffer.lines.get(i);n&&(n.fill(t),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let i=a=>(this._coreService.triggerDataEvent(`${ue.ESC}${a}${ue.ESC}\\`),!0),n=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},y1=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(R$=t,t=e,e=R$),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};y1=qt([be(0,tn)],y1);function A$(t){return 0<=t&&t<256}var oee=5e7,M$=12,aee=50,lee=class extends Fe{constructor(t){super(),this._action=t,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Oe),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(t,e){if(e!==void 0&&this._syncCalls>e){this._syncCalls=0;return}if(this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(t,e){if(this._pendingData>oee)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(e),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(e)}_innerWrite(t=0,e=!0){let i=t||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],r=this._action(n,e);if(r){let a=c=>performance.now()-i>=M$?setTimeout(()=>this._innerWrite(0,c)):this._innerWrite(i,c);r.catch(c=>(queueMicrotask(()=>{throw c}),Promise.resolve(!1))).then(a);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-i>=M$)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>aee&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},S1=class{constructor(t){this._bufferService=t,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(t){let e=this._bufferService.buffer;if(t.id===void 0){let c=e.addMarker(e.ybase+e.y),h={data:t,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._dataByLinkId.set(h.id,h),h.id}let i=t,n=this._getEntryIdKey(i),r=this._entriesWithId.get(n);if(r)return this.addLineToLink(r.id,e.ybase+e.y),r.id;let s=e.addMarker(e.ybase+e.y),a={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(a,s)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(t,e){let i=this._dataByLinkId.get(t);if(i&&i.lines.every(n=>n.line!==e)){let n=this._bufferService.buffer.addMarker(e);i.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(i,n))}}getLinkData(t){var e;return(e=this._dataByLinkId.get(t))==null?void 0:e.data}_getEntryIdKey(t){return`${t.id};;${t.uri}`}_removeMarkerFromLink(t,e){let i=t.lines.indexOf(e);i!==-1&&(t.lines.splice(i,1),t.lines.length===0&&(t.data.id!==void 0&&this._entriesWithId.delete(t.key),this._dataByLinkId.delete(t.id)))}};S1=qt([be(0,tn)],S1);var z$=!1,cee=class extends Fe{constructor(t){super(),this._windowsWrappingHeuristics=this._register(new Ac),this._onBinary=this._register(new Oe),this.onBinary=this._onBinary.event,this._onData=this._register(new Oe),this.onData=this._onData.event,this._onLineFeed=this._register(new Oe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Oe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Oe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Oe),this._instantiationService=new AJ,this.optionsService=this._register(new WJ(t)),this._instantiationService.setService(nn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(g1)),this._instantiationService.setService(tn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(p1)),this._instantiationService.setService(ez,this._logService),this.coreService=this._register(this._instantiationService.createInstance(m1)),this._instantiationService.setService(el,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(O1)),this._instantiationService.setService(JM,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Aa)),this._instantiationService.setService($F,this.unicodeService),this._charsetService=this._instantiationService.createInstance(HJ),this._instantiationService.setService(QF,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S1),this._instantiationService.setService(tz,this._oscLinkService),this._inputHandler=this._register(new see(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ai.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ai.forward(this._bufferService.onResize,this._onResize)),this._register(Ai.forward(this.coreService.onData,this._onData)),this._register(Ai.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new lee((e,i)=>this._inputHandler.parse(e,i))),this._register(Ai.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Oe),this._onScroll.event(t=>{var e;(e=this._onScrollApi)==null||e.fire(t.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(t){for(let e in t)this.optionsService.options[e]=t[e]}write(t,e){this._writeBuffer.write(t,e)}writeSync(t,e){this._logService.logLevel<=3&&!z$&&(this._logService.warn("writeSync is unreliable and will be removed soon."),z$=!0),this._writeBuffer.writeSync(t,e)}input(t,e=!0){this.coreService.triggerDataEvent(t,e)}resize(t,e){isNaN(t)||isNaN(e)||(t=Math.max(t,Az),e=Math.max(e,Mz),this._bufferService.resize(t,e))}scroll(t,e=!1){this._bufferService.scroll(t,e)}scrollLines(t,e){this._bufferService.scrollLines(t,e)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let e=t-this._bufferService.buffer.ydisp;e!==0&&this.scrollLines(e)}registerEscHandler(t,e){return this._inputHandler.registerEscHandler(t,e)}registerDcsHandler(t,e){return this._inputHandler.registerDcsHandler(t,e)}registerCsiHandler(t,e){return this._inputHandler.registerCsiHandler(t,e)}registerOscHandler(t,e){return this._inputHandler.registerOscHandler(t,e)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let t=!1,e=this.optionsService.rawOptions.windowsPty;e&&e.buildNumber!==void 0&&e.buildNumber!==void 0?t=e.backend==="conpty"&&e.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(t=!0),t?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let t=[];t.push(this.onLineFeed(C$.bind(null,this._bufferService))),t.push(this.registerCsiHandler({final:"H"},()=>(C$(this._bufferService),!1))),this._windowsWrappingHeuristics.value=zt(()=>{for(let e of t)e.dispose()})}}},hee={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function uee(t,e,i,n){var a;let r={type:0,cancel:!1,key:void 0},s=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?r.key=ue.ESC+"OA":r.key=ue.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?r.key=ue.ESC+"OD":r.key=ue.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?r.key=ue.ESC+"OC":r.key=ue.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?r.key=ue.ESC+"OB":r.key=ue.ESC+"[B");break;case 8:r.key=t.ctrlKey?"\b":ue.DEL,t.altKey&&(r.key=ue.ESC+r.key);break;case 9:if(t.shiftKey){r.key=ue.ESC+"[Z";break}r.key=ue.HT,r.cancel=!0;break;case 13:r.key=t.altKey?ue.ESC+ue.CR:ue.CR,r.cancel=!0;break;case 27:r.key=ue.ESC,t.altKey&&(r.key=ue.ESC+ue.ESC),r.cancel=!0;break;case 37:if(t.metaKey)break;s?r.key=ue.ESC+"[1;"+(s+1)+"D":e?r.key=ue.ESC+"OD":r.key=ue.ESC+"[D";break;case 39:if(t.metaKey)break;s?r.key=ue.ESC+"[1;"+(s+1)+"C":e?r.key=ue.ESC+"OC":r.key=ue.ESC+"[C";break;case 38:if(t.metaKey)break;s?r.key=ue.ESC+"[1;"+(s+1)+"A":e?r.key=ue.ESC+"OA":r.key=ue.ESC+"[A";break;case 40:if(t.metaKey)break;s?r.key=ue.ESC+"[1;"+(s+1)+"B":e?r.key=ue.ESC+"OB":r.key=ue.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(r.key=ue.ESC+"[2~");break;case 46:s?r.key=ue.ESC+"[3;"+(s+1)+"~":r.key=ue.ESC+"[3~";break;case 36:s?r.key=ue.ESC+"[1;"+(s+1)+"H":e?r.key=ue.ESC+"OH":r.key=ue.ESC+"[H";break;case 35:s?r.key=ue.ESC+"[1;"+(s+1)+"F":e?r.key=ue.ESC+"OF":r.key=ue.ESC+"[F";break;case 33:t.shiftKey?r.type=2:t.ctrlKey?r.key=ue.ESC+"[5;"+(s+1)+"~":r.key=ue.ESC+"[5~";break;case 34:t.shiftKey?r.type=3:t.ctrlKey?r.key=ue.ESC+"[6;"+(s+1)+"~":r.key=ue.ESC+"[6~";break;case 112:s?r.key=ue.ESC+"[1;"+(s+1)+"P":r.key=ue.ESC+"OP";break;case 113:s?r.key=ue.ESC+"[1;"+(s+1)+"Q":r.key=ue.ESC+"OQ";break;case 114:s?r.key=ue.ESC+"[1;"+(s+1)+"R":r.key=ue.ESC+"OR";break;case 115:s?r.key=ue.ESC+"[1;"+(s+1)+"S":r.key=ue.ESC+"OS";break;case 116:s?r.key=ue.ESC+"[15;"+(s+1)+"~":r.key=ue.ESC+"[15~";break;case 117:s?r.key=ue.ESC+"[17;"+(s+1)+"~":r.key=ue.ESC+"[17~";break;case 118:s?r.key=ue.ESC+"[18;"+(s+1)+"~":r.key=ue.ESC+"[18~";break;case 119:s?r.key=ue.ESC+"[19;"+(s+1)+"~":r.key=ue.ESC+"[19~";break;case 120:s?r.key=ue.ESC+"[20;"+(s+1)+"~":r.key=ue.ESC+"[20~";break;case 121:s?r.key=ue.ESC+"[21;"+(s+1)+"~":r.key=ue.ESC+"[21~";break;case 122:s?r.key=ue.ESC+"[23;"+(s+1)+"~":r.key=ue.ESC+"[23~";break;case 123:s?r.key=ue.ESC+"[24;"+(s+1)+"~":r.key=ue.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?r.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?r.key=ue.NUL:t.keyCode>=51&&t.keyCode<=55?r.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?r.key=ue.DEL:t.keyCode===219?r.key=ue.ESC:t.keyCode===220?r.key=ue.FS:t.keyCode===221&&(r.key=ue.GS);else if((!i||n)&&t.altKey&&!t.metaKey){let c=(a=hee[t.keyCode])==null?void 0:a[t.shiftKey?1:0];if(c)r.key=ue.ESC+c;else if(t.keyCode>=65&&t.keyCode<=90){let h=t.ctrlKey?t.keyCode-64:t.keyCode+32,d=String.fromCharCode(h);t.shiftKey&&(d=d.toUpperCase()),r.key=ue.ESC+d}else if(t.keyCode===32)r.key=ue.ESC+(t.ctrlKey?ue.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let h=t.code.slice(3,4);t.shiftKey||(h=h.toLowerCase()),r.key=ue.ESC+h,r.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(r.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?r.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(r.key=ue.US),t.key==="@"&&(r.key=ue.NUL));break}return r}var Yt=0,dee=class{constructor(t){this._getKey=t,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Kg,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Kg,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(t){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(t)}_flushInserted(){let t=this._insertedValues.sort((r,s)=>this._getKey(r)-this._getKey(s)),e=0,i=0,n=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<n.length;r++)i>=this._array.length||this._getKey(t[e])<=this._getKey(this._array[i])?(n[r]=t[e],e++):n[r]=this._array[i++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(t){if(this._flushCleanupInserted(),this._array.length===0)return!1;let e=this._getKey(t);if(e===void 0||(Yt=this._search(e),Yt===-1)||this._getKey(this._array[Yt])!==e)return!1;do if(this._array[Yt]===t)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Yt),!0;while(++Yt<this._array.length&&this._getKey(this._array[Yt])===e);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let t=this._deletedIndices.sort((r,s)=>r-s),e=0,i=new Array(this._array.length-t.length),n=0;for(let r=0;r<this._array.length;r++)t[e]===r?e++:i[n++]=this._array[r];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Yt=this._search(t),!(Yt<0||Yt>=this._array.length)&&this._getKey(this._array[Yt])===t))do yield this._array[Yt];while(++Yt<this._array.length&&this._getKey(this._array[Yt])===t)}forEachByKey(t,e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Yt=this._search(t),!(Yt<0||Yt>=this._array.length)&&this._getKey(this._array[Yt])===t))do e(this._array[Yt]);while(++Yt<this._array.length&&this._getKey(this._array[Yt])===t)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(t){let e=0,i=this._array.length-1;for(;i>=e;){let n=e+i>>1,r=this._getKey(this._array[n]);if(r>t)i=n-1;else if(r<t)e=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===t;)n--;return n}}return e}},by=0,j$=0,fee=class extends Fe{constructor(){super(),this._decorations=new dee(t=>t==null?void 0:t.marker.line),this._onDecorationRegistered=this._register(new Oe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Oe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(zt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new pee(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),n=e.onDispose(()=>{n.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let n=0,r=0;for(let s of this._decorations.getKeyIterator(e))n=s.options.x??0,r=n+(s.options.width??1),t>=n&&t<r&&(!i||(s.options.layer??"bottom")===i)&&(yield s)}forEachDecorationAtCell(t,e,i,n){this._decorations.forEachByKey(e,r=>{by=r.options.x??0,j$=by+(r.options.width??1),t>=by&&t<j$&&(!i||(r.options.layer??"bottom")===i)&&n(r)})}},pee=class extends Do{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new Oe),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Oe),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Bt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Bt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},gee=1e3,mee=class{constructor(t,e=gee){this._renderCallback=t,this._debounceThresholdMS=e,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(t,e,i){this._rowCount=i,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=n-this._lastRefreshMs,s=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e)}},D$=20,Jg=class extends Fe{constructor(t,e,i,n){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new mee(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
130
130
  `))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ne(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(zt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e<t;e++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<D$+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
131
131
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===D$+1&&(this._liveRegion.textContent+=XS.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,n=i.lines.length.toString();for(let r=t;r<=e;r++){let s=i.lines.get(i.ydisp+r),a=[],c=(s==null?void 0:s.translateToString(!0,void 0,void 0,a))||"",h=(i.ydisp+r+1).toString(),d=this._rowElements[r];d&&(c.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=c,this._rowColumns.set(d,a)),d.setAttribute("aria-posinset",h),d.setAttribute("aria-setsize",n),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,n=this._rowElements[e===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),s=e===0?"1":`${this._terminal.buffer.lines.length}`;if(r===s||t.relatedTarget!==n)return;let a,c;if(e===0?(a=i,c=this._rowElements.pop(),this._rowContainer.removeChild(c)):(a=this._rowElements.shift(),c=i,this._rowContainer.removeChild(a)),a.removeEventListener("focus",this._topBoundaryFocusListener),c.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){var c;if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let n=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:n,offset:((c=n.textContent)==null?void 0:c.length)??0}),!this._rowContainer.contains(i.node))return;let r=({node:h,offset:d})=>{let f=h instanceof Text?h.parentNode:h,g=parseInt(f==null?void 0:f.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let m=this._rowColumns.get(f);if(!m)return console.warn("columns is null. Race condition?"),null;let O=d<m.length?m[d]:m.slice(-1)[0]+1;return O>=this._terminal.cols&&(++g,O=0),{row:g,column:O}},s=r(e),a=r(i);if(!(!s||!a)){if(s.row>a.row||s.row===a.row&&s.column>=a.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(a.row-s.row)*this._terminal.cols-s.column+a.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){var r,s;t.style.transform="";let e=t.getBoundingClientRect().width,i=(s=(r=this._rowColumns.get(t))==null?void 0:r.slice(-1))==null?void 0:s[0];if(!i)return;let n=i*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${n/e})`}};Jg=qt([be(1,Gb),be(2,Xs),be(3,Ns)],Jg);var b1=class extends Fe{constructor(t,e,i,n,r){super(),this._element=t,this._mouseService=e,this._renderService=i,this._bufferService=n,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Oe),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Oe),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(zt(()=>{var s;Ga(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ne(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ne(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ne(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ne(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let n=0;n<i.length;n++){let r=i[n];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){var n,r;(!this._activeProviderReplies||!e)&&((n=this._activeProviderReplies)==null||n.forEach(s=>{s==null||s.forEach(a=>{a.link.dispose&&a.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[s,a]of this._linkProviderService.linkProviders.entries())e?(r=this._activeProviderReplies)!=null&&r.get(s)&&(i=this._checkLinkProviderResult(s,t,i)):a.provideLinks(t.y,c=>{var d,f;if(this._isMouseOut)return;let h=c==null?void 0:c.map(g=>({link:g}));(d=this._activeProviderReplies)==null||d.set(s,h),i=this._checkLinkProviderResult(s,t,i),((f=this._activeProviderReplies)==null?void 0:f.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let n=0;n<e.size;n++){let r=e.get(n);if(r)for(let s=0;s<r.length;s++){let a=r[s],c=a.link.range.start.y<t?0:a.link.range.start.x,h=a.link.range.end.y>t?this._bufferService.cols:a.link.range.end.x;for(let d=c;d<=h;d++){if(i.has(d)){r.splice(s--,1);break}i.add(d)}}}}_checkLinkProviderResult(t,e,i){var s;if(!this._activeProviderReplies)return i;let n=this._activeProviderReplies.get(t),r=!1;for(let a=0;a<t;a++)(!this._activeProviderReplies.has(a)||this._activeProviderReplies.get(a))&&(r=!0);if(!r&&n){let a=n.find(c=>this._linkAtPosition(c.link,e));a&&(i=!0,this._handleNewLink(a))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let a=0;a<this._activeProviderReplies.size;a++){let c=(s=this._activeProviderReplies.get(a))==null?void 0:s.find(h=>this._linkAtPosition(h.link,e));if(c){i=!0,this._handleNewLink(c);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&Oee(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Ga(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>{var i,n;return(n=(i=this._currentLink)==null?void 0:i.state)==null?void 0:n.decorations.pointerCursor},set:i=>{var n;(n=this._currentLink)!=null&&n.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,n;return(n=(i=this._currentLink)==null?void 0:i.state)==null?void 0:n.decorations.underline},set:i=>{var n,r,s;(n=this._currentLink)!=null&&n.state&&((s=(r=this._currentLink)==null?void 0:r.state)==null?void 0:s.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let n=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(n,r),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(t,e,i){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,n=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-n-1,i.end.x,i.end.y-n-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(t,e,i){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,n=t.range.end.y*this._bufferService.cols+t.range.end.x,r=e.y*this._bufferService.cols+e.x;return i<=r&&r<=n}_positionFromMouseEvent(t,e,i){let n=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,n,r){return{x1:t,y1:e,x2:i,y2:n,cols:this._bufferService.cols,fg:r}}};b1=qt([be(1,Fb),be(2,Ns),be(3,tn),be(4,nz)],b1);function Oee(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var vee=class extends cee{constructor(t={}){super(t),this._linkifier=this._register(new Ac),this.browser=_z,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ac),this._onCursorMove=this._register(new Oe),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Oe),this.onKey=this._onKey.event,this._onRender=this._register(new Oe),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Oe),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Oe),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Oe),this.onBell=this._onBell.event,this._onFocus=this._register(new Oe),this._onBlur=this._register(new Oe),this._onA11yCharEmitter=this._register(new Oe),this._onA11yTabEmitter=this._register(new Oe),this._onWillOpen=this._register(new Oe),this._setup(),this._decorationService=this._instantiationService.createInstance(fee),this._instantiationService.setService(pd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(aJ),this._instantiationService.setService(nz,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(ZS)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh((e==null?void 0:e.start)??0,(e==null?void 0:e.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Ai.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ai.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ai.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ai.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(zt(()=>{var e,i;this._customKeyEventHandler=void 0,(i=(e=this.element)==null?void 0:e.parentNode)==null||i.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(t){if(this._themeService)for(let e of t){let i,n="";switch(e.index){case 256:i="foreground",n="10";break;case 257:i="background",n="11";break;case 258:i="cursor",n="12";break;default:i="ansi",n="4;"+e.index}switch(e.type){case 0:let r=Et.toColorRGB(i==="ansi"?this._themeService.colors.ansi[e.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${ue.ESC}]${n};${nee(r)}${Sz.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(s=>s.ansi[e.index]=si.toColor(...e.color));else{let s=i;this._themeService.modifyColors(a=>a[s]=si.toColor(...e.color))}break;case 2:this._themeService.restoreColor(e.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(t){t?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Jg,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(t){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ue.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var t;return(t=this.textarea)==null?void 0:t.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ue.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let t=this.buffer.ybase+this.buffer.y,e=this.buffer.lines.get(t);if(!e)return;let i=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,r=e.getWidth(i),s=this._renderService.dimensions.css.cell.width*r,a=this.buffer.y*this._renderService.dimensions.css.cell.height,c=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=c+"px",this.textarea.style.top=a+"px",this.textarea.style.width=s+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ne(this.element,"copy",e=>{this.hasSelection()&&_F(e,this._selectionService)}));let t=e=>xF(e,this.textarea,this.coreService,this.optionsService);this._register(Ne(this.textarea,"paste",t)),this._register(Ne(this.element,"paste",t)),xz?this._register(Ne(this.element,"mousedown",e=>{e.button===2&&YQ(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ne(this.element,"contextmenu",e=>{YQ(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),s_&&this._register(Ne(this.element,"auxclick",e=>{e.button===1&&HM(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ne(this.textarea,"keyup",t=>this._keyUp(t),!0)),this._register(Ne(this.textarea,"keydown",t=>this._keyDown(t),!0)),this._register(Ne(this.textarea,"keypress",t=>this._keyPress(t),!0)),this._register(Ne(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ne(this.textarea,"compositionupdate",t=>this._compositionHelper.compositionupdate(t))),this._register(Ne(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ne(this.textarea,"input",t=>this._inputEvent(t),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(t){var r;if(!t)throw new Error("Terminal requires a parent element.");if(t.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((r=this.element)==null?void 0:r.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=t.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),t.appendChild(this.element);let e=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),e.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ne(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),e.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",LS.get()),Cz||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(sJ,this.textarea,t.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Xs,this._coreBrowserService),this._register(Ne(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(Ne(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(c1,this._document,this._helperContainer),this._instantiationService.setService($m,this._charSizeService),this._themeService=this._instantiationService.createInstance(f1),this._instantiationService.setService(Dc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Gg),this._instantiationService.setService(iz,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(u1,this.rows,this.screenElement)),this._instantiationService.setService(Ns,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o1,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(h1),this._instantiationService.setService(Fb,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(b1,this.screenElement));this.element.appendChild(e);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(r1,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(d1,this.element,this.screenElement,n)),this._instantiationService.setService(EF,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(Ai.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(s1,this.screenElement)),this._register(Ne(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Jg,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ug,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ug,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l1,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let t=this,e=this.element;function i(s){var d,f,g,m,O;let a=t._mouseService.getMouseReportCoords(s,t.screenElement);if(!a)return!1;let c,h;switch(s.overrideType||s.type){case"mousemove":h=32,s.buttons===void 0?(c=3,s.button!==void 0&&(c=s.button<3?s.button:3)):c=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":h=0,c=s.button<3?s.button:3;break;case"mousedown":h=1,c=s.button<3?s.button:3;break;case"wheel":if(t._customWheelEventHandler&&t._customWheelEventHandler(s)===!1)return!1;let S=s.deltaY;if(S===0||t.coreMouseService.consumeWheelEvent(s,(m=(g=(f=(d=t._renderService)==null?void 0:d.dimensions)==null?void 0:f.device)==null?void 0:g.cell)==null?void 0:m.height,(O=t._coreBrowserService)==null?void 0:O.dpr)===0)return!1;h=S<0?0:1,c=4;break;default:return!1}return h===void 0||c===void 0||c>4?!1:t.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:c,action:h,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:s=>(i(s),s.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(s)),wheel:s=>(i(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&i(s)},mousemove:s=>{s.buttons||i(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?n.mousemove||(e.addEventListener("mousemove",r.mousemove),n.mousemove=r.mousemove):(e.removeEventListener("mousemove",n.mousemove),n.mousemove=null),s&16?n.wheel||(e.addEventListener("wheel",r.wheel,{passive:!1}),n.wheel=r.wheel):(e.removeEventListener("wheel",n.wheel),n.wheel=null),s&2?n.mouseup||(n.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),s&4?n.mousedrag||(n.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ne(e,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return i(s),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(s)})),this._register(Ne(e,"wheel",s=>{var a,c,h,d,f;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(t.coreMouseService.consumeWheelEvent(s,(d=(h=(c=(a=t._renderService)==null?void 0:a.dimensions)==null?void 0:c.device)==null?void 0:h.cell)==null?void 0:d.height,(f=t._coreBrowserService)==null?void 0:f.dpr)===0)return this.cancel(s,!0);let g=ue.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(g,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(t,e){var i;(i=this._renderService)==null||i.refreshRows(t,e)}updateCursorStyle(t){var e;(e=this._selectionService)!=null&&e.shouldColumnSelect(t)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(t,e){this._viewport?this._viewport.scrollLines(t):super.scrollLines(t,e),this.refresh(0,this.rows-1)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){t&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let e=t-this._bufferService.buffer.ydisp;e!==0&&this.scrollLines(e)}paste(t){YM(t,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(t){this._customKeyEventHandler=t}attachCustomWheelEventHandler(t){this._customWheelEventHandler=t}registerLinkProvider(t){return this._linkProviderService.registerLinkProvider(t)}registerCharacterJoiner(t){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let e=this._characterJoinerService.register(t);return this.refresh(0,this.rows-1),e}deregisterCharacterJoiner(t){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(t)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(t){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+t)}registerDecoration(t){return this._decorationService.registerDecoration(t)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(t,e,i){this._selectionService.setSelection(t,e,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var t;(t=this._selectionService)==null||t.clearSelection()}selectAll(){var t;(t=this._selectionService)==null||t.selectAll()}selectLines(t,e){var i;(i=this._selectionService)==null||i.selectLines(t,e)}_keyDown(t){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)return!1;let e=this.browser.isMac&&this.options.macOptionIsMeta&&t.altKey;if(!e&&!this._compositionHelper.keydown(t))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!e&&(t.key==="Dead"||t.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=uee(t,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(t),i.type===3||i.type===2){let n=this.rows-1;return this.scrollLines(i.type===2?-n:n),this.cancel(t,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,t)||(i.cancel&&this.cancel(t,!0),!i.key)||t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.key.length===1&&t.key.charCodeAt(0)>=65&&t.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((i.key===ue.ETX||i.key===ue.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:t}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||t.altKey||t.ctrlKey)return this.cancel(t,!0);this._keyDownHandled=!0}_isThirdLevelShift(t,e){let i=t.isMac&&!this.options.macOptionIsMeta&&e.altKey&&!e.ctrlKey&&!e.metaKey||t.isWindows&&e.altKey&&e.ctrlKey&&!e.metaKey||t.isWindows&&e.getModifierState("AltGraph");return e.type==="keypress"?i:i&&(!e.keyCode||e.keyCode>47)}_keyUp(t){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)&&(yee(t)||this.focus(),this.updateCursorStyle(t),this._keyPressHandled=!1)}_keyPress(t){let e;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)return!1;if(this.cancel(t),t.charCode)e=t.charCode;else if(t.which===null||t.which===void 0)e=t.keyCode;else if(t.which!==0&&t.charCode!==0)e=t.which;else return!1;return!e||(t.altKey||t.ctrlKey||t.metaKey)&&!this._isThirdLevelShift(this.browser,t)?!1:(e=String.fromCharCode(e),this._onKey.fire({key:e,domEvent:t}),this._showCursor(),this.coreService.triggerDataEvent(e,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(t){if(t.data&&t.inputType==="insertText"&&(!t.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let e=t.data;return this.coreService.triggerDataEvent(e,!0),this.cancel(t),!0}return!1}resize(t,e){if(t===this.cols&&e===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(t,e)}_afterResize(t,e){var i;(i=this._charSizeService)==null||i.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let t=1;t<this.rows;t++)this.buffer.lines.push(this.buffer.getBlankLine(ri));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var e;this.options.rows=this.rows,this.options.cols=this.cols;let t=this._customKeyEventHandler;this._setup(),super.reset(),(e=this._selectionService)==null||e.reset(),this._decorationService.reset(),this._customKeyEventHandler=t,this.refresh(0,this.rows-1)}clearTextureAtlas(){var t;(t=this._renderService)==null||t.clearTextureAtlas()}_reportFocus(){var t;(t=this.element)!=null&&t.classList.contains("focus")?this.coreService.triggerDataEvent(ue.ESC+"[I"):this.coreService.triggerDataEvent(ue.ESC+"[O")}_reportWindowsOptions(t){if(this._renderService)switch(t){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ue.ESC}[4;${i};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ue.ESC}[6;${r};${n}t`);break}}cancel(t,e){if(!(!this.options.cancelEvents&&!e))return t.preventDefault(),t.stopPropagation(),!1}};function yee(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var See=class{constructor(){this._addons=[]}dispose(){for(let t=this._addons.length-1;t>=0;t--)this._addons[t].instance.dispose()}loadAddon(t,e){let i={instance:e,dispose:e.dispose,isDisposed:!1};this._addons.push(i),e.dispose=()=>this._wrappedAddonDispose(i),e.activate(t)}_wrappedAddonDispose(t){if(t.isDisposed)return;let e=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===t){e=i;break}if(e===-1)throw new Error("Could not dispose an addon that has not been loaded");t.isDisposed=!0,t.dispose.apply(t.instance),this._addons.splice(e,1)}},bee=class{constructor(t){this._line=t}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(t,e){if(!(t<0||t>=this._line.length))return e?(this._line.loadCell(t,e),e):this._line.loadCell(t,new rr)}translateToString(t,e,i){return this._line.translateToString(t,e,i)}},B$=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(t){let e=this._buffer.lines.get(t);if(e)return new bee(e)}getNullCell(){return new rr}},_ee=class extends Fe{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new Oe),this.onBufferChange=this._onBufferChange.event,this._normal=new B$(this._core.buffers.normal,"normal"),this._alternate=new B$(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},xee=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,n)=>e(i,n.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},wee=class{constructor(t){this._core=t}register(t){this._core.unicodeService.register(t)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(t){this._core.unicodeService.activeVersion=t}},kee=["cols","rows"],Mr=0,Cee=class extends Fe{constructor(t){super(),this._core=this._register(new vee(t)),this._addonManager=this._register(new See),this._publicOptions={...this._core.options};let e=n=>this._core.options[n],i=(n,r)=>{this._checkReadonlyOptions(n),this._core.options[n]=r};for(let n in this._core.options){let r={get:e.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this._publicOptions,n,r)}}_checkReadonlyOptions(t){if(kee.includes(t))throw new Error(`Option "${t}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new xee(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new wee(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new _ee(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
132
132
  `,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return LS.get()},set promptLabel(t){LS.set(t)},get tooMuchOutput(){return XS.get()},set tooMuchOutput(t){XS.set(t)}}}_verifyIntegers(...t){for(Mr of t)if(Mr===1/0||isNaN(Mr)||Mr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(Mr of t)if(Mr&&(Mr===1/0||isNaN(Mr)||Mr%1!==0||Mr<0))throw new Error("This API only accepts positive integers")}};/**