PageSourceSearch

https://alsak.ru/assets/index-CUBeUIZy.js

js alsak.ru collected 2026-09-24 23:32:26 UTC 1,055,396 bytes, 99 lines download raw bytes

1(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const u of r)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function l(r){const u={};return r.integrity&&(u.integrity=r.integrity),r.referrerPolicy&&(u.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?u.credentials="include":r.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(r){if(r.ep)return;r.ep=!0;const u=l(r);fetch(r.href,u)}})();function cj(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tm={exports:{}},Gr={};var N0;function hC(){if(N0)return Gr;N0=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function l(i,r,u){var d=null;if(u!==void 0&&(d=""+u),r.key!==void 0&&(d=""+r.key),"key"in r){u={};for(var h in r)h!=="key"&&(u[h]=r[h])}else u=r;return r=u.ref,{$$typeof:e,type:i,key:d,ref:r!==void 0?r:null,props:u}}return Gr.Fragment=a,Gr.jsx=l,Gr.jsxs=l,Gr}var k0;function fC(){return k0||(k0=1,Tm.exports=hC()),Tm.exports}var s=fC(),Mm={exports:{}},at={};var S0;function mC(){if(S0)return at;S0=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),v=Symbol.for("react.view_transition"),k=Symbol.iterator;function T(R){return R===null||typeof R!="object"?null:(R=k&&R[k]||R["@@iterator"],typeof R=="function"?R:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,z={};function E(R,Q,le){this.props=R,this.context=Q,this.refs=z,this.updater=le||S}E.prototype.isReactComponent={},E.prototype.setState=function(R,Q){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,Q,"setState")},E.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function j(){}j.prototype=E.prototype;function O(R,Q,le){this.props=R,this.context=Q,this.refs=z,this.updater=le||S}var w=O.prototype=new j;w.constructor=O,C(w,E.prototype),w.isPureReactComponent=!0;var b=Array.isArray;function A(){}var D={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function U(R,Q,le){var se=le.ref;return{$$typeof:e,type:R,key:Q,ref:se!==void 0?se:null,props:le}}function Y(R,Q){return U(R.type,Q,R.props)}function q(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function W(R){var Q={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(le){return Q[le]})}var L=/\/+/g;function V(R,Q){return typeof R=="object"&&R!==null&&R.key!=null?W(""+R.key):Q.toString(36)}function I(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(A,A):(R.status="pending",R.then(function(Q){R.status==="pending"&&(R.status="fulfilled",R.value=Q)},function(Q){R.status==="pending"&&(R.status="rejected",R.reason=Q)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function F(R,Q,le,se,ie){var K=typeof R;(K==="undefined"||K==="boolean")&&(R=null);var ue=!1;if(R===null)ue=!0;else switch(K){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(R.$$typeof){case e:case a:ue=!0;break;case x:return ue=R._init,F(ue(R._payload),Q,le,se,ie)}}if(ue)return ie=ie(R),ue=se===""?"."+V(R,0):se,b(ie)?(le="",ue!=null&&(le=ue.replace(L,"$&/")+"/"),F(ie,Q,le,"",function(He){return He})):ie!=null&&(q(ie)&&(ie=Y(ie,le+(ie.key==null||R&&R.key===ie.key?"":(""+ie.key).replace(L,"$&/")+"/")+ue)),Q.push(ie)),1;ue=0;var xe=se===""?".":se+":";if(b(R))for(var Ne=0;Ne<R.length;
vendor: 5,145 bytes, line 1
1Ne++)se=R[Ne],K=xe+V(se,Ne),ue+=F(se,Q,le,K,ie);else if(Ne=T(R),typeof Ne=="function")for(R=Ne.call(R),Ne=0;!(se=R.next()).done;)se=se.value,K=xe+V(se,Ne++),ue+=F(se,Q,le,K,ie);else if(K==="object"){if(typeof R.then=="function")return F(I(R),Q,le,se,ie);throw Q=String(R),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return ue}function _(R,Q,le){if(R==null)return R;var se=[],ie=0;return F(R,se,"","",function(K){return Q.call(le,K,ie++)}),se}function H(R){if(R._status===-1){var Q=R._result,le=Q();le.then(function(se){(R._status===0||R._status===-1)&&(R._status=1,R._result=se,le.status===void 0&&(le.status="fulfilled",le.value=se))},function(se){(R._status===0||R._status===-1)&&(R._status=2,R._result=se,le.status===void 0&&(le.status="rejected",le.reason=se))}),R._status===-1&&(R._status=0,R._result=le)}if(R._status===1)return R._result.default;throw R._result}var P=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)};function X(R){var Q=D.T,le={};le.types=Q!==null?Q.types:null,D.T=le;try{var se=R(),ie=D.S;ie!==null&&ie(le,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(A,P)}catch(K){P(K)}finally{Q!==null&&le.types!==null&&(Q.types=le.types),D.T=Q}}function ne(R){var Q=D.T;if(Q!==null){var le=Q.types;le===null?Q.types=[R]:le.indexOf(R)===-1&&le.push(R)}else X(ne.bind(null,R))}var pe={map:_,forEach:function(R,Q,le){_(R,function(){Q.apply(this,arguments)},le)},count:function(R){var Q=0;return _(R,function(){Q++}),Q},toArray:function(R){return _(R,function(Q){return Q})||[]},only:function(R){if(!q(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return at.Activity=m,at.Children=pe,at.Component=E,at.Fragment=l,at.Profiler=r,at.PureComponent=O,at.StrictMode=i,at.Suspense=g,at.ViewTransition=v,at.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,at.__COMPILER_RUNTIME={__proto__:null,c:function(R){return D.H.useMemoCache(R)}},at.addTransitionType=ne,at.cache=function(R){return function(){return R.apply(null,arguments)}},at.cacheSignal=function(){return null},at.cloneElement=function(R,Q,le){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var se=C({},R.props),ie=R.key;if(Q!=null)for(K in Q.key!==void 0&&(ie=""+Q.key),Q)!M.call(Q,K)||K==="key"||K==="__self"||K==="__source"||K==="ref"&&Q.ref===void 0||(se[K]=Q[K]);var K=arguments.length-2;if(K===1)se.children=le;else if(1<K){for(var ue=Array(K),xe=0;xe<K;xe++)ue[xe]=arguments[xe+2];se.children=ue}return U(R.type,ie,se)},at.createContext=function(R){return R={$$typeof:d,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},at.createElement=function(R,Q,le){var se,ie={},K=null;if(Q!=null)for(se in Q.key!==void 0&&(K=""+Q.key),Q)M.call(Q,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(ie[se]=Q[se]);var ue=arguments.length-2;if(ue===1)ie.children=le;else if(1<ue){for(var xe=Array(ue),Ne=0;Ne<ue;Ne++)xe[Ne]=arguments[Ne+2];ie.children=xe}if(R&&R.defaultProps)for(se in ue=R.defaultProps,ue)ie[se]===void 0&&(ie[se]=ue[se]);return U(R,K,ie)},at.createRef=function(){return{current:null}},at.forwardRef=function(R){return{$$typeof:h,render:R}},at.isValidElement=q,at.lazy=function(R){return{$$typeof:x,_payload:{_status:-1,_result:R},_init:H}},at.memo=function(R,Q){return{$$typeof:p,type:R,compare:Q===void 0?null:Q}},at.startTransition=X,at.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},at.use=function(R){return D.H.use(R)},at.useActionState=function(R,Q,le){return D.H.useActionState(R,Q,le)},at.useCallback=function(R,Q){return D.H.useCallback(R,Q)},at.useContext=function(R){return D.H.useContext(R)},at.useDebugValue=function(){},at.useDeferredValue=function(R,Q){return D.H.useDeferredValue(R,Q)},at.useEffect=function(R,Q){return D.H.useEffect(R,Q)},at.useEffectEvent=function(R){return D.H.useEffectEvent(R)},at.useId=function(){return D.H.useId()},at.useImperativeHandle=function(R,Q,le){return D.H.useImperativeHandle(R,Q,le)},at.useInsertionEffect=function(R,Q){return D.H.useInsertionEffect(R,Q)},at.useLayoutEffect=function(R,Q){return D.H.useLayoutEffect(R,Q)},at.useMemo=function(R,Q){return D.H.useMemo(R,Q)},at.useOptimistic=function(R,Q){return D.H.useOptimistic(R,Q)},at.useReducer=function(R,Q,le){return D.H.useReducer(R,Q,le)},at.useRef=function(R){return D.H.useRef(R)},at.useState=function(R){return D.H.useState(R)},at.useSyncExternalStore=function(R,Q,le){return D.H.useSyncExternalStore(R,Q,le)},at.useTransition=function(){return D.H.useTransition()}
vendor: 5,180 bytes, line 1
1,at.version="19.3.0",at}var C0;function vc(){return C0||(C0=1,Mm.exports=mC()),Mm.exports}var N=vc();const pC=cj(N);var Dm={exports:{}},Xr={},_m={exports:{}},Om={};var E0;function gC(){return E0||(E0=1,(function(e){function a(I,F){var _=I.length;I.push(F);e:for(;0<_;){var H=_-1>>>1,P=I[H];if(0<r(P,F))I[H]=F,I[_]=P,_=H;else break e}}function l(I){return I.length===0?null:I[0]}function i(I){if(I.length===0)return null;var F=I[0],_=I.pop();if(_!==F){I[0]=_;e:for(var H=0,P=I.length,X=P>>>1;H<X;){var ne=2*(H+1)-1,pe=I[ne],R=ne+1,Q=I[R];if(0>r(pe,_))R<P&&0>r(Q,pe)?(I[H]=Q,I[R]=_,H=R):(I[H]=pe,I[ne]=_,H=ne);else if(R<P&&0>r(Q,_))I[H]=Q,I[R]=_,H=R;else break e}}return F}function r(I,F){var _=I.sortIndex-F.sortIndex;return _!==0?_:I.id-F.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var g=[],p=[],x=1,m=null,v=3,k=!1,T=!1,S=!1,C=!1,z=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function O(I){for(var F=l(p);F!==null;){if(F.callback===null)i(p);else if(F.startTime<=I)i(p),F.sortIndex=F.expirationTime,a(g,F);else break;F=l(p)}}function w(I){if(S=!1,O(I),!T)if(l(g)!==null)T=!0,b||(b=!0,q());else{var F=l(p);F!==null&&V(w,F.startTime-I)}}var b=!1,A=-1,D=5,M=-1;function U(){return C?!0:!(e.unstable_now()-M<D)}function Y(){if(C=!1,b){var I=e.unstable_now();M=I;var F=!0;try{e:{T=!1,S&&(S=!1,E(A),A=-1),k=!0;var _=v;try{t:{for(O(I),m=l(g);m!==null&&!(m.expirationTime>I&&U());){var H=m.callback;if(typeof H=="function"){m.callback=null,v=m.priorityLevel;var P=H(m.expirationTime<=I);if(I=e.unstable_now(),typeof P=="function"){m.callback=P,O(I),F=!0;break t}m===l(g)&&i(g),O(I)}else i(g);m=l(g)}if(m!==null)F=!0;else{var X=l(p);X!==null&&V(w,X.startTime-I),F=!1}}break e}finally{m=null,v=_,k=!1}F=void 0}}finally{F?q():b=!1}}}var q;if(typeof j=="function")q=function(){j(Y)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,L=W.port2;W.port1.onmessage=Y,q=function(){L.postMessage(null)}}else q=function(){z(Y,0)};function V(I,F){A=z(function(){I(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(I){switch(v){case 1:case 2:case 3:var F=3;break;default:F=v}var _=v;v=F;try{return I()}finally{v=_}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(I,F){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var _=v;v=I;try{return F()}finally{v=_}},e.unstable_scheduleCallback=function(I,F,_){var H=e.unstable_now();switch(typeof _=="object"&&_!==null?(_=_.delay,_=typeof _=="number"&&0<_?H+_:H):_=H,I){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=_+P,I={id:x++,callback:F,priorityLevel:I,startTime:_,expirationTime:P,sortIndex:-1},_>H?(I.sortIndex=_,a(p,I),l(g)===null&&I===l(p)&&(S?(E(A),A=-1):S=!0,V(w,_-H))):(I.sortIndex=P,a(g,I),T||k||(T=!0,b||(b=!0,q()))),I},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(I){var F=v;return function(){var _=v;v=F;try{return I.apply(this,arguments)}finally{v=_}}}})(Om)),Om}var T0;function yC(){return T0||(T0=1,_m.exports=gC()),_m.exports}var Am={exports:{}},Rn={};var M0;function xC(){if(M0)return Rn;M0=1;var e=vc();function a(x){var m="https://react.dev/errors/"+x;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)m+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+x+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(){}var i={d:{f:l,r:function(){throw Error(a(522))},D:l,C:l,L:l,m:l,X:l,S:l,M:l},p:0,findDOMNode:null},r=Symbol.for("react.portal"),u=Symbol.for("react.recoverable"),d=Symbol.for("react.optimistic_key");function h(x,m,v){var k=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:k==null?null:k===d?d:""+k,children:x,containerInfo:m,implementation:v}}var g=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(x,m){if(x==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Rn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Rn.browser=function(x){return{$$typeof:u,_reason:x}},Rn.createPortal=function(x,m){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(a(299));return h(x,m,null,v)},Rn.flushSync=function(x){var m=g.T,v=i.p;try{if(g.T=null,i.p=2,x)return x()}finally{g.T=m,i.p=v,i.d.f()}}
1,Rn.preconnect=function(x,m){typeof x=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,i.d.C(x,m))},Rn.prefetchDNS=function(x){typeof x=="string"&&i.d.D(x)},Rn.preinit=function(x,m){if(typeof x=="string"&&m&&typeof m.as=="string"){var v=m.as,k=p(v,m.crossOrigin),T=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;v==="style"?i.d.S(x,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:k,integrity:T,fetchPriority:S}):v==="script"&&i.d.X(x,{crossOrigin:k,integrity:T,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Rn.preinitModule=function(x,m){if(typeof x=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var v=p(m.as,m.crossOrigin);i.d.M(x,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0})}}else m==null&&i.d.M(x)},Rn.preload=function(x,m){if(typeof x=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var v=m.as,k=p(v,m.crossOrigin);i.d.L(x,v,{crossOrigin:k,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Rn.preloadModule=function(x,m){if(typeof x=="string")if(m){var v=p(m.as,m.crossOrigin);i.d.m(x,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0})}else i.d.m(x)},Rn.requestFormReset=function(x){i.d.r(x)},Rn.unstable_batchedUpdates=function(x,m){return x(m)},Rn.useFormState=function(x,m,v){return g.H.useFormState(x,m,v)},Rn.useFormStatus=function(){return g.H.useHostTransitionStatus()},Rn.version="19.3.0",Rn}var D0;function uj(){if(D0)return Am.exports;D0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(a){console.error(a)}}return e(),Am.exports=xC(),Am.exports}var _0;function vC(){if(_0)return Xr;_0=1;var e=yC(),a=vc(),l=uj();function i(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)n+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){for(var n=t,o=n;o&&!o.alternate;)n=o,(n.flags&4098)!==0&&(t=n.return),o=n.return;for(;n.return;)n=n.return;return n.tag===3?t:null}function d(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function h(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function g(t){if(u(t)!==t)throw Error(i(188))}function p(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(i(188));return n!==t?null:t}for(var o=t,c=n;;){var f=o.return;if(f===null)break;var y=f.alternate;if(y===null){if(c=f.return,c!==null){o=c;continue}break}if(f.child===y.child){for(y=f.child;y;){if(y===o)return g(f),t;if(y===c)return g(f),n;y=y.sibling}throw Error(i(188))}if(o.return!==c.return)o=f,c=y;else{for(var $=!1,Z=f.child;Z;){if(Z===o){$=!0,o=f,c=y;break}if(Z===c){$=!0,c=f,o=y;break}Z=Z.sibling}if(!$){for(Z=y.child;Z;){if(Z===o){$=!0,o=y,c=f;break}if(Z===c){$=!0,c=y,o=f;break}Z=Z.sibling}if(!$)throw Error(i(189))}}if(o.alternate!==c)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?t:n}function x(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=x(t),n!==null)return n;t=t.sibling}return null}function m(t,n,o,c,f,y){for(;t!==null;){if((t.tag===5||t.tag===27||t.tag===6)&&o(t,c,f,y)||(t.tag!==22||t.memoizedState===null)&&(n||t.tag!==5&&t.tag!==27)&&m(t.child,n,o,c,f,y))return!0;t=t.sibling}return!1}function v(t){for(t=t.return;t!==null;){if(t.tag===3||t.tag===5||t.tag===27)return t;t=t.return}return null}function k(t){var n=!1;for(t=t.return;t!==null&&(t.tag===4&&(n=!0),!(t.tag===3||t.tag===5||t.tag===27));)t=t.return;return n}function T(t){var n=[null,null],o=v(t);return o===null||S(n,t,o.child,{foundSelf:!1}),n}function S(t,n,o,c){for(;o!==null;){if(o===n)c.foundSelf=!0;else if(o.tag===5||o.tag===27||o.tag===6){if(c.foundSelf)return t[1]=o,!0;t[0]=o}else if((o.tag!==22||o.memoizedState===null)&&S(t,n,o.child,c))return!0;o=o.sibling}return!1}function C(t){switch(t.tag){case 5:case 27:case 6:return t.stateNode;case 3:return t.stateNode.containerInfo;default:throw Error(i(559))}}var z=null,E=null;function j(t,n,o){return t===o?!0:t===n?(z=t,!0):!1}function O(t,n,o){return t===o?(E=t,!1):t===n?(E!==null&&(z=t),!0):!1}function w(t){if(t===null)return null;do t=t===null?null:t.return;while(t&&t.tag!==5&&t.tag!==27&&t.tag!==3);return t||null}function b(t,n,o){for(var c=0,f=t;f;f=o(f))c++;f=0;for(var y=n;y;y=o(y))f++;for(;0<c-f;)t=o(t),c--;for(;0<f-c;)n=o(n),f--;for(;c--;){if(t===n||n!==null&&t===n.alternate)return t;t=o(t),n=o(n)}return null}var A=Object.assign,D=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),Y=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),W=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),V=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),ne=Symbol.for("react.legacy_hidden"),pe=Symbol.for("react.memo_cache_sentinel"),R=Symbol.for("react.view_transition"),Q=Symbol.for("react.recoverable"),le=Symbol.iterator;function se(t){return t===null||typeof t!="object"?null:(t=le&&t[le]||t["@@iterator"],typeof t=="function"?t:null)}var ie=Symbol.for("react.client.reference");function K(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ie?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Y:return"Fragment";case W:return"Profiler";case q:return"StrictMode";case F:return"Suspense";case _:return"SuspenseList";case X:return"Activity";case R:return"ViewTransition"}if(typeof t=="object")switch(t.$$typeof){case U:return"Portal";case V:return t.displayName||"Context";case L:return(t._context.displayName||"Context")+".Consumer";case I:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case H:return n=t.displayName||null,n!==null?n:K(t.type)||"Memo";case P:n=t._payload,t=t._init;try{return K(t(n))}catch{}}return null}var ue=Array.isArray,xe=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ne=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,He={pending:!1,data:null,method:null,action:null},ee=[],ge=-1;function Le(t){return{current:t}}function me(t){0>ge||(t.current=ee[ge],ee[ge]=null,ge--)}function _e(t,n){ge++,ee[ge]=t.current,t.current=n}var ke=Le(null),re=Le(null),te=Le(null),Ce=Le(null);function Ee(t,n){switch(_e(te,n),_e(re,t),_e(ke,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Ov(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Ov(n),t=Av(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}me(ke),_e(ke,t)}function Re(){me(ke),me(re),me(te)}function Ke(t){var n=t.memoizedState;n!==null&&(Ei._currentValue=n.memoizedState,_e(Ce,t)),n=ke.current;var o=Av(n,t.type);n!==o&&(_e(re,t),_e(ke,o))}function mt(t){re.current===t&&(me(ke),me(re)),Ce.current===t&&(me(Ce),Ei._currentValue=He)}var dt,En;function Ue(t){if(dt===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);dt=n&&n[1]||"",En=-1<o.stack.indexOf(`
2    at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
3`+dt+t+En}var ea=!1;function Ae(t,n){if(!t||ea)return"";ea=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(n){var Me=function(){throw Error()};if(Object.defineProperty(Me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Me,[])}catch(Pe){var de=Pe}Reflect.construct(t,[],Me)}else{try{Me.call()}catch(Pe){de=Pe}Me=!1;try{var ve=Object.getOwnPropertyDescriptor(t.prototype,"props");Object.defineProperty(t.prototype,"props",{configurable:!0,set:function(){throw Error()}}),Me=!0,new t}finally{Me&&(ve!==void 0?Object.defineProperty(t.prototype,"props",ve):delete t.prototype.props)}}}else{try{throw Error()}catch(Pe){de=Pe}(Me=t())&&typeof Me.catch=="function"&&Me.catch(function(){})}}
vendor: 1,947 bytes, lines 3-8
3catch(Pe){if(Pe&&de&&typeof Pe.stack=="string")return[Pe.stack,de.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=c.DetermineComponentFrameRoot(),$=y[0],Z=y[1];if($&&Z){var ae=$.split(`
4`),fe=Z.split(`
5`);for(f=c=0;c<ae.length&&!ae[c].includes("DetermineComponentFrameRoot");)c++;for(;f<fe.length&&!fe[f].includes("DetermineComponentFrameRoot");)f++;if(c===ae.length||f===fe.length)for(c=ae.length-1,f=fe.length-1;1<=c&&0<=f&&ae[c]!==fe[f];)f--;for(;1<=c&&0<=f;c--,f--)if(ae[c]!==fe[f]){if(c!==1||f!==1)do if(c--,f--,0>f||ae[c]!==fe[f]){var je=`
6`+ae[c].replace(" at new "," at ");return t.displayName&&je.includes("<anonymous>")&&(je=je.replace("<anonymous>",t.displayName)),je}while(1<=c&&0<=f);break}}}finally{ea=!1,Error.prepareStackTrace=o}return(o=t?t.displayName||t.name:"")?Ue(o):""}function Be(t,n){switch(t.tag){case 26:case 27:case 5:return Ue(t.type);case 16:return Ue("Lazy");case 13:return t.child!==n&&n!==null?Ue("Suspense Fallback"):Ue("Suspense");case 19:return Ue("SuspenseList");case 0:case 15:return Ae(t.type,!1);case 11:return Ae(t.type.render,!1);case 1:return Ae(t.type,!0);case 31:return Ue("Activity");case 30:return Ue("ViewTransition");default:return""}}function st(t){try{var n="",o=null;do n+=Be(t,o),o=t,t=t.return;while(t);return n}catch(c){return`
7Error generating stack: `+c.message+`
8`+c.stack}}var _t=Object.prototype.hasOwnProperty,gn=e.unstable_scheduleCallback,ut=e.unstable_cancelCallback,ta=e.unstable_shouldYield,Et=e.unstable_requestPaint,qt=e.unstable_now,Tn=e.unstable_getCurrentPriorityLevel,Ln=e.unstable_ImmediatePriority,Ht=e.unstable_UserBlockingPriority,pt=e.unstable_NormalPriority,gt=e.unstable_LowPriority,Un=e.unstable_IdlePriority,Ls=e.log,
vendor: 4,548 bytes, line 8
8sn=e.unstable_setDisableYieldValue,Ta=null,Qt=null;function Bt(t){if(typeof Ls=="function"&&sn(t),Qt&&typeof Qt.setStrictMode=="function")try{Qt.setStrictMode(Ta,t)}catch{}}var Jt=Math.clz32?Math.clz32:Us,ys=Math.log,qa=Math.LN2;function Us(t){return t>>>=0,t===0?32:31-(ys(t)/qa|0)|0}var Ma=256,yn=262144,na=4194304;function wn(t){var n=t&42;if(n!==0)return n;switch(t&-t){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 t&-t;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Rt(t,n,o){var c=t.pendingLanes;if(c===0)return 0;var f=0,y=t.suspendedLanes,$=t.pingedLanes;t=t.warmLanes;var Z=c&134217727;return Z!==0?(c=Z&~y,c!==0?f=wn(c):($&=Z,$!==0?f=wn($):o||(o=Z&~t,o!==0&&(f=wn(o))))):(Z=c&~y,Z!==0?f=wn(Z):$!==0?f=wn($):o||(o=c&~t,o!==0&&(f=wn(o)))),f===0?0:n!==0&&n!==f&&(n&y)===0&&(y=f&-f,o=n&-n,y>=o||y===32&&(o&4194048)!==0)?n:f}function Da(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Ga(t,n){(n&8)!==0&&(n|=n&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=n;0<o;){var c=31-Jt(o),f=1<<c;n|=t[c],o&=~f}return n}function Gt(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 Xa(){var t=na;return na<<=1,(na&62914560)===0&&(na=4194304),t}function ln(t){for(var n=[],o=0;31>o;o++)n.push(t);return n}function Mn(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function jn(t,n,o,c,f,y){var $=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var Z=t.entanglements,ae=t.expirationTimes,fe=t.hiddenUpdates;for(o=$&~o;0<o;){var je=31-Jt(o),Me=1<<je;Z[je]=0,ae[je]=-1;var de=fe[je];if(de!==null)for(fe[je]=null,je=0;je<de.length;je++){var ve=de[je];ve!==null&&(ve.lane&=-536870913)}o&=~Me}c!==0&&Hs(t,c,0),y!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=y&~($&~n))}function Hs(t,n,o){t.pendingLanes|=n,t.suspendedLanes&=~n;var c=31-Jt(n);t.entangledLanes|=n,t.entanglements[c]=t.entanglements[c]|1073741824|o&261930}function Bs(t,n){var o=t.entangledLanes|=n;for(t=t.entanglements;o;){var c=31-Jt(o),f=1<<c;f&n|t[c]&n&&(t[c]|=n),o&=~f}}function Za(t,n){var o=n&-n;return o=(o&42)!==0?1:aa(o),(o&(t.suspendedLanes|n))!==0?0:o}function aa(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function xs(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function G(){var t=Ne.p;return t!==0?t:(t=window.event,t===void 0?32:g0(t.type))}function $e(t,n){var o=Ne.p;try{return Ne.p=t,n()}finally{Ne.p=o}}var Ge=Math.random().toString(36).slice(2),ot="__reactFiber$"+Ge,ht="__reactProps$"+Ge,Ie="__reactContainer$"+Ge,nt="__reactEvents$"+Ge,Tt="__reactListeners$"+Ge,sa="__reactHandles$"+Ge,Hn="__reactResources$"+Ge,Ot="__reactMarker$"+Ge,en="__reactLoad$"+Ge;function Pt(t){delete t[ot],delete t[ht],delete t[Tt],delete t[sa]}function Nn(t){var n;if(n=t[ot])return n;for(var o=t.parentNode;o;){if(n=o[Ie]||o[ot]){if(o=n.alternate,n.child!==null||o!==null&&o.child!==null)for(t=Kv(t);t!==null;){if(o=t[ot])return o;t=Kv(t)}return n}t=o,o=t.parentNode}return null}function Fa(t){if(t=t[ot]||t[Ie]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function _a(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(i(33))}function Bn(t){var n=t[Hn];return n||(n=t[Hn]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Xt(t){t[Ot]=!0}
vendor: 6,908 bytes, line 8
8function Ka(t){t[en]=void 0}var cl=new Set,Uo={};function pa(t,n){Yn(t,n),Yn(t+"Capture",n)}function Yn(t,n){for(Uo[t]=n,t=0;t<n.length;t++)cl.add(n[t])}var Lt=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]*$"),Qa={},_c={};function rh(t){return _t.call(_c,t)?!0:_t.call(Qa,t)?!1:Lt.test(t)?_c[t]=!0:(Qa[t]=!0,!1)}var Nt=!1;function Ki(){var t=Nt;return Nt=!1,t}function Ho(t,n,o){if(rh(n))if(o===null)t.removeAttribute(n);else{switch(typeof o){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var c=n.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,o)}}function Bo(t,n,o){if(o===null)t.removeAttribute(n);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,o)}}function Wa(t,n,o,c){if(c===null)t.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(o);return}t.setAttributeNS(n,o,c)}}function Vn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Qi(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Oc(t,n,o){var c=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var f=c.get,y=c.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return f.call(this)},set:function($){o=""+$,y.call(this,$)}}),Object.defineProperty(t,n,{enumerable:c.enumerable}),{getValue:function(){return o},setValue:function($){o=""+$},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Wi(t){if(!t._valueTracker){var n=Qi(t)?"checked":"value";t._valueTracker=Oc(t,n,""+t[n])}}function Ac(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var o=n.getValue(),c="";return t&&(c=Qi(t)?t.checked?"true":"false":t.value),t=c,t!==o?(n.setValue(t),!0):!1}var ch=/[\n"\\]/g;function la(t){return t.replace(ch,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function vs(t,n,o,c,f,y,$,Z){t.name="",$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?t.type=$:t.removeAttribute("type"),n!=null?$==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Vn(n)):t.value!==""+Vn(n)&&(t.value=""+Vn(n)):$!=="submit"&&$!=="reset"||t.removeAttribute("value"),n!=null?$==="number"&&t.value==n?Ji(t,Vn(t.value)):Ji(t,Vn(n)):o!=null?Ji(t,Vn(o)):c!=null&&t.removeAttribute("value"),f==null&&y!=null&&(t.defaultChecked=!!y),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),Z!=null&&typeof Z!="function"&&typeof Z!="symbol"&&typeof Z!="boolean"?t.name=""+Vn(Z):t.removeAttribute("name")}function Po(t,n,o,c,f,y,$,Z){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),n!=null||o!=null){if(!(y!=="submit"&&y!=="reset"||n!=null)){Wi(t);return}o=o!=null?""+Vn(o):"",n=n!=null?""+Vn(n):o,Z||n===t.value||(t.value=n),t.defaultValue=n}c=c??f,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=Z?t.checked:!!c,t.defaultChecked=!!c,$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"&&(t.name=$),Wi(t)}function Ji(t,n){t.defaultValue!==""+n&&(t.defaultValue=""+n)}function Ja(t,n,o,c){if(t=t.options,n){n={};for(var f=0;f<o.length;f++)n["$"+o[f]]=!0;for(o=0;o<t.length;o++)f=n.hasOwnProperty("$"+t[o].value),t[o].selected!==f&&(t[o].selected=f),f&&c&&(t[o].defaultSelected=!0)}else{for(o=""+Vn(o),n=null,f=0;f<t.length;f++){if(t[f].value===o){t[f].selected=!0,c&&(t[f].defaultSelected=!0);return}n!==null||t[f].disabled||(n=t[f])}n!==null&&(n.selected=!0)}}function ul(t,n,o){if(n!=null&&(n=""+Vn(n),n!==t.value&&(t.value=n),o==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=o!=null?""+Vn(o):""}function qn(t,n,o,c){if(n==null){if(c!=null){if(o!=null)throw Error(i(92));if(ue(c)){if(1<c.length)throw Error(i(93));c=c[0]}o=c}o==null&&(o=""),n=o}o=Vn(n),t.defaultValue=o,c=t.textContent,c===o&&c!==""&&c!==null&&(t.value=c),Wi(t)}function bs(t,n){if(n){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=n;return}}t.textContent=n}var Ic=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 Yo(t,n,o){var c=n.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?c?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":c?t.setProperty(n,o):typeof o!="number"||o===0||Ic.has(n)?n==="float"?t.cssFloat=o:t[n]=(""+o).trim():t[n]=o+"px"}function Zl(t,n,o){if(n!=null&&typeof n!="object")throw Error(i(62));if(t=t.style,o!=null){for(var c in o)!o.hasOwnProperty(c)||n!=null&&n.hasOwnProperty(c)||(c.indexOf("--")===0?t.setProperty(c,""):c==="float"?t.cssFloat="":t[c]="",Nt=!0);for(var f in n)c=n[f],n.hasOwnProperty(f)&&o[f]!==c&&(Yo(t,f,c),Nt=!0)}else for(var y in n)n.hasOwnProperty(y)&&Yo(t,y,n[y])}function Vo(t){if(t.indexOf("-")===-1)return!1;switch(t){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 er=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"],["colorRen
8dering","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"],["maskType","mask-type"],["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"]]),on=/^[\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 dl(t){return on.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function oa(){}var tr=null;function nr(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ws=null,Ps=null;function Fl(t){var n=Fa(t);if(n&&(t=n.stateNode)){var o=t[ht]||null;e:switch(t=n.stateNode,n.type){case"input":if(vs(t,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),n=o.name,o.type==="radio"&&n!=null){for(o=t;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+la(""+n)+'"][type="radio"]'),n=0;n<o.length;n++){var c=o[n];if(c!==t&&c.form===t.form){var f=c[ht]||null;if(!f)throw Error(i(90));vs(c,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<o.length;n++)c=o[n],c.form===t.form&&Ac(c)}break e;case"textarea":ul(t,o.value,o.defaultValue);break e;case"select":n=o.value,n!=null&&Ja(t,!!o.multiple,n,!1)}}}var Oa=!1;function qo(t,n,o){if(Oa)return t(n,o);Oa=!0;try{var c=t(n);return c}finally{if(Oa=!1,(ws!==null||Ps!==null)&&(Iu(),ws&&(n=ws,t=Ps,Ps=ws=null,Fl(n),t)))for(n=0;n<t.length;n++)Fl(t[n])}}function Ys(t,n){var o=t.stateNode;if(o===null)return null;var c=o[ht]||null;if(c===null)return null;o=c[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(o&&typeof o!="function")throw Error(i(231,n,typeof o));return o}var Gn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Go=!1;if(Gn)try{var xn={};Object.defineProperty(xn,"passive",{get:function(){Go=!0}}),window.addEventListener("test",xn,xn),window.removeEventListener("test",xn,xn)}catch{Go=!1}var Aa=null,Vs=null,Xo=null;function Kl(){if(Xo)return Xo;var t,n=Vs,o=n.length,c,f="value"in Aa?Aa.value:Aa.textContent,y=f.length;for(t=0;t<o&&n[t]===f[t];t++);var $=o-t;for(c=1;c<=$&&n[o-c]===f[y-c];c++);return Xo=f.slice(t,1<c?1-c:void 0)}function Ql(t){var n=t.keyCode;
vendor: 4,166 bytes, line 8
8return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function hl(){return!0}function zc(){return!1}function rn(t){function n(o,c,f,y,$){this._reactName=o,this._targetInst=f,this.type=c,this.nativeEvent=y,this.target=$,this.currentTarget=null;for(var Z in t)t.hasOwnProperty(Z)&&(o=t[Z],this[Z]=o?o(y):y[Z]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?hl:zc,this.isPropagationStopped=zc,this}return A(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=hl)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=hl)},persist:function(){},isPersistent:hl}),n}var Ia={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zo=rn(Ia),qs=A({},Ia,{view:0,detail:0}),Wl=rn(qs),ar,sr,fl,Gs=A({},qs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:B,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==fl&&(fl&&t.type==="mousemove"?(ar=t.screenX-fl.screenX,sr=t.screenY-fl.screenY):sr=ar=0,fl=t),ar)},movementY:function(t){return"movementY"in t?t.movementY:sr}}),lr=rn(Gs),ia=A({},Gs,{dataTransfer:0}),Rc=rn(ia),uh=A({},qs,{relatedTarget:0}),Jl=rn(uh),dh=A({},Ia,{animationName:0,elapsedTime:0,pseudoElement:0}),hh=rn(dh),fh=A({},Ia,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),$c=rn(fh),mh=A({},Ia,{data:0}),or=rn(mh),ph={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Dn={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"},Lc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Uc(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=Lc[t])?!!n[t]:!1}function B(){return Uc}var J=A({},qs,{key:function(t){if(t.key){var n=ph[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=Ql(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Dn[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:B,charCode:function(t){return t.type==="keypress"?Ql(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Ql(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),oe=rn(J),be=A({},Gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),De=rn(be),we=A({},Ia,{submitter:0}),ze=rn(we),Ve=A({},qs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:B}),it=rn(Ve),kt=A({},Ia,{propertyName:0,elapsedTime:0,pseudoElement:0}),Je=rn(kt),ra=A({},Gs,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),ir=rn(ra),ik=A({},Ia,{newState:0,oldState:0,source:0}),rk=rn(ik),ck=[9,13,27,32],gh=Gn&&"CompositionEvent"in window,rr=null;Gn&&"documentMode"in document&&(rr=document.documentMode);var uk=Gn&&"TextEvent"in window&&!rr,Ag=Gn&&(!gh||rr&&8<rr&&11>=rr),Ig=" ",zg=!1;
vendor: 4,686 bytes, line 8
8function Rg(t,n){switch(t){case"keyup":return ck.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $g(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Fo=!1;function dk(t,n){switch(t){case"compositionend":return $g(n);case"keypress":return n.which!==32?null:(zg=!0,Ig);case"textInput":return t=n.data,t===Ig&&zg?null:t;default:return null}}function hk(t,n){if(Fo)return t==="compositionend"||!gh&&Rg(t,n)?(t=Kl(),Xo=Vs=Aa=null,Fo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Ag&&n.locale!=="ko"?null:n.data;default:return null}}var fk={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 Lg(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!fk[t.type]:n==="textarea"}function Ug(t,n,o,c){ws?Ps?Ps.push(c):Ps=[c]:ws=c,n=Hu(n,"onChange"),0<n.length&&(o=new Zo("onChange","change",null,o,c),t.push({event:o,listeners:n}))}var cr=null,ur=null;function mk(t){Cv(t,0)}function Hc(t){var n=_a(t);if(Ac(n))return t}function Hg(t,n){if(t==="change")return n}var Bg=!1;if(Gn){var yh;if(Gn){var xh="oninput"in document;if(!xh){var Pg=document.createElement("div");Pg.setAttribute("oninput","return;"),xh=typeof Pg.oninput=="function"}yh=xh}else yh=!1;Bg=yh&&(!document.documentMode||9<document.documentMode)}function Yg(){cr&&(cr.detachEvent("onpropertychange",Vg),ur=cr=null)}function Vg(t){if(t.propertyName==="value"&&Hc(ur)){var n=[];Ug(n,ur,t,nr(t)),qo(mk,n)}}function pk(t,n,o){t==="focusin"?(Yg(),cr=n,ur=o,cr.attachEvent("onpropertychange",Vg)):t==="focusout"&&Yg()}function gk(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Hc(ur)}function yk(t,n){if(t==="click")return Hc(n)}function xk(t,n){if(t==="input"||t==="change")return Hc(n)}function vk(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var ga=typeof Object.is=="function"?Object.is:vk;function dr(t,n){if(ga(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var o=Object.keys(t),c=Object.keys(n);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var f=o[c];if(!_t.call(n,f)||!ga(t[f],n[f]))return!1}return!0}function vh(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function qg(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Gg(t,n){var o=qg(t);t=0;for(var c;o;){if(o.nodeType===3){if(c=t+o.textContent.length,t<=n&&c>=n)return{node:o,offset:n-t};t=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=qg(o)}}function Xg(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Xg(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Zg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=vh(t.document);n instanceof t.HTMLIFrameElement;){try{var o=typeof n.contentWindow.location.href=="string"}catch{o=!1}if(o)t=n.contentWindow;else break;n=vh(t.document)}return n}function bh(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var bk=Gn&&"documentMode"in document&&11>=document.documentMode,Ko=null,wh=null,hr=null,jh=!1;function Fg(t,n,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;jh||Ko==null||Ko!==vh(c)||(c=Ko,"selectionStart"in c&&bh(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),hr&&dr(hr,c)||(hr=c,c=Hu(wh,"onSelect"),0<c.length&&(n=new Zo("onSelect","select",null,n,o),t.push({event:n,listeners:c}),n.target=Ko)))}function eo(t,n){var o={};return o[t.toLowerCase()]=n.toLowerCase(),o["Webkit"+t]="webkit"+n,o["Moz"+t]="moz"+n,o}var Qo={animationend:eo("Animation","AnimationEnd"),animationiteration:eo("Animation","AnimationIteration"),animationstart:eo("Animation","AnimationStart"),transitionrun:eo("Transition","TransitionRun"),transitionstart:eo("Transition","TransitionStart"),transitioncancel:eo("Transition","TransitionCancel"),transitionend:eo("Transition","TransitionEnd")},Nh={},Kg={};
8Gn&&(Kg=document.createElement("div").style,"AnimationEvent"in window||(delete Qo.animationend.animation,delete Qo.animationiteration.animation,delete Qo.animationstart.animation),"TransitionEvent"in window||delete Qo.transitionend.transition);function to(t){if(Nh[t])return Nh[t];if(!Qo[t])return t;var n=Qo[t],o;for(o in n)if(n.hasOwnProperty(o)&&o in Kg)return Nh[t]=n[o];return t}var Qg=to("animationend"),Wg=to("animationiteration"),Jg=to("animationstart"),wk=to("transitionrun"),jk=to("transitionstart"),Nk=to("transitioncancel"),ey=to("transitionend"),ty=new Map,kh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");kh.push("scrollEnd");function es(t,n){ty.set(t,n),pa(n,[t])}var kk=0;function Xs(t,n){if(t.name!=null&&t.name!=="auto")return t.name;if(n.autoName!==null)return n.autoName;t=ss.identifierPrefix;var o=kk++;return t="_"+t+"t_"+o.toString(32)+"_",n.autoName=t}function ny(t){if(t==null||typeof t=="string")return t;var n=null,o=yi;if(o!==null)for(var c=0;c<o.length;c++){var f=t[o[c]];if(f!=null){if(f==="none")return"none";n=n==null?f:n+(" "+f)}}return n??t.default}function Zs(t,n){return t=ny(t),n=ny(n),n==null?t==="auto"?null:t:n==="auto"?null:n}var Bc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},za=[],Wo=0,Sh=0;function Pc(){for(var t=Wo,n=Sh=Wo=0;n<t;){var o=za[n];za[n++]=null;var c=za[n];za[n++]=null;var f=za[n];za[n++]=null;var y=za[n];if(za[n++]=null,c!==null&&f!==null){var $=c.pending;
vendor: 8,428 bytes, line 8
8$===null?f.next=f:(f.next=$.next,$.next=f),c.pending=f}y!==0&&ay(o,f,y)}}function Yc(t,n,o,c){za[Wo++]=t,za[Wo++]=n,za[Wo++]=o,za[Wo++]=c,Sh|=c,t.lanes|=c,t=t.alternate,t!==null&&(t.lanes|=c)}function Ch(t,n,o,c){return Yc(t,n,o,c),Vc(t)}function no(t,n){return Yc(t,null,null,n),Vc(t)}function ay(t,n,o){t.lanes|=o;var c=t.alternate;c!==null&&(c.lanes|=o);for(var f=!1,y=t.return;y!==null;)y.childLanes|=o,c=y.alternate,c!==null&&(c.childLanes|=o),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(f=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,f&&n!==null&&(f=31-Jt(o),t=y.hiddenUpdates,c=t[f],c===null?t[f]=[n]:c.push(n),n.lane=o|536870912),y):null}function Vc(t){if(50<Ir)throw Ir=0,Au=null,Error(i(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Jo={};function Sk(t,n,o,c){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ca(t,n,o,c){return new Sk(t,n,o,c)}function Eh(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Fs(t,n){var o=t.alternate;return o===null?(o=ca(t.tag,n,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=n,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&1206910976,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,n=t.dependencies,o.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o.refCleanup=t.refCleanup,o}function sy(t,n){t.flags&=1206910978;var o=t.alternate;return o===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=o.childLanes,t.lanes=o.lanes,t.child=o.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=o.memoizedProps,t.memoizedState=o.memoizedState,t.updateQueue=o.updateQueue,t.type=o.type,n=o.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function qc(t,n,o,c,f,y){var $=0;if(c=t,typeof c=="function")Eh(c)&&($=1);else if(typeof c=="string")$=JS(t,o,ke.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(c){case X:return t=ca(31,o,n,f),t.elementType=X,t.lanes=y,t;case Y:return ao(o.children,f,y,n);case q:$=8,f|=24;break;case W:return t=ca(12,o,n,f|2),t.elementType=W,t.lanes=y,t;case F:return t=ca(13,o,n,f),t.elementType=F,t.lanes=y,t;case _:return t=ca(19,o,n,f),t.elementType=_,t.lanes=y,t;case ne:case R:return t=f|32,t=ca(30,o,n,t),t.elementType=R,t.lanes=y,t.stateNode={autoName:null,paired:null,clones:null,ref:null},t;default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case V:$=10;break e;case L:$=9;break e;case I:$=11;break e;case H:$=14;break e;case P:$=16,c=null;break e}$=29,o=Error(i(130,t===null?"null":typeof t,"")),c=null}return n=ca($,o,n,f),n.elementType=t,n.type=c,n.lanes=y,n}function ao(t,n,o,c){return t=ca(7,t,c,n),t.lanes=o,t}function Th(t,n,o){return t=ca(6,t,null,n),t.lanes=o,t}function ly(t){var n=ca(18,null,null,0);return n.stateNode=t,n}function Mh(t,n,o){return n=ca(4,t.children!==null?t.children:[],t.key,n),n.lanes=o,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var oy=new WeakMap;function Ra(t,n){if(typeof t=="object"&&t!==null){var o=oy.get(t);return o!==void 0?o:(n={value:t,source:n,stack:st(n)},oy.set(t,n),n)}return{value:t,source:n,stack:st(n)}}var ei=[],ti=0,Gc=null,fr=0,$a=[],La=0,ml=null,js=1,Ns="";function Ks(t,n){ei[ti++]=fr,ei[ti++]=Gc,Gc=t,fr=n}function iy(t,n,o){$a[La++]=js,$a[La++]=Ns,$a[La++]=ml,ml=t;var c=js;t=Ns;var f=32-Jt(c)-1;c&=~(1<<f),o+=1;var y=32-Jt(n)+f;if(30<y){var $=f-f%5;y=(c&(1<<$)-1).toString(32),c>>=$,f-=$,js=1<<32-Jt(n)+f|o<<f|c,Ns=y+t}else js=1<<y|o<<f|c,Ns=t}function Xc(t){t.return!==null&&(Ks(t,1),iy(t,1,0))}function Dh(t){for(;t===Gc;)Gc=ei[--ti],ei[ti]=null,fr=ei[--ti],ei[ti]=null;for(;t===ml;)ml=$a[--La],$a[La]=null,Ns=$a[--La],$a[La]=null,js=$a[--La],$a[La]=null}function ry(t,n){$a[La++]=js,$a[La++]=Ns,$a[La++]=ml,js=n.id,Ns=n.overflow,ml=t}var kn=null,Yt=null,ft=!1,pl=null,Ua=!1,_h=Error(i(519));function gl(t){var n=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw mr(Ra(n,t)),_h}function cy(t){var n=t.stateNode,o=t.type,c=t.memoizedProps;switch(n[ot]=t,n[ht]=c,o){case"dialog":vt("cancel",n),vt("close",n);break;case"iframe":case"object":case"embed":vt("load",n);break;case"video":case"audio":for(o=0;o<Rr.length;o++)vt(Rr[o],n);break;case"source":vt("error",n);break;case"img":case"image":case"link":vt("error",n),vt("load",n);break;case"details":vt("toggle",n);break;case"input":vt("invalid",n),Po(n,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":vt("invalid",n);break;case"textarea":vt("invalid",n),qn(n,c.value,c.defaultValue,c.children)}o=c.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||n.textContent===""+o||c.suppressHydrationWarning===!0||Dv(n.textContent,o)?(c.popover!=null&&(vt("beforetoggle",n),vt("toggle",n)),c.onScroll!=null&&vt("scroll",n),c.onScrollEnd!=null&&vt("scrollend",n),c.onClick!=null&&(n.onclick=oa),n=!0):n=!1,n||gl(t,!0)}function Zc(t){for(kn=t.return;kn;)switch(kn.tag){case 5:case 31:case 13:Ua=!1;return;case 27:case 3:Ua=!0;return;default:kn=kn.return}}function ni(t){if(t!==kn)return!1;if(!ft)return Zc(t),ft=!0,!1;var n=t.tag,o;if((o=n!==3&&n!==27)&&((o=n===5)&&(o=t.type,o=!(o!=="form"&&o!=="button")||rm(t.type,t.memoizedProps)),o=!o),o&&Yt&&gl(t),Zc(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));Yt=Fv(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));Yt=Fv(t)}else n===27?(n=Yt,Ol(t.type)?(t=ym,ym=null,Yt=t):Yt=n):Yt=kn?Ba(t.stateNode.nextSibling):null;return!0}function so(){Yt=kn=null,ft=!1}function Oh(){var t=pl;return t!==null&&(ha===null?ha=t:ha.push.apply(ha,t),pl=null),t}function mr(t){pl===null?pl=[t]:pl.push(t)}var Ah=Le(null),lo=null,Qs=null;function yl(t,n,o){_e(Ah,n._currentValue),n._currentValue=o}function Ws(t){t._currentValue=Ah.current,me(Ah)}function Fc(t,n,o){for(;t!==null;){var c=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),t===o)break;t=t.return}}function Ih(t,n,o,c){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var y=f.dependencies;if(y!==null){var $=f.child;y=y.firstContext;e:for(;y!==null;){var Z=y;y=f;for(var ae=0;ae<n.length;ae++)if(Z.context===n[ae]){y.lanes|=o,Z=y.alternate,Z!==null&&(Z.lanes|=o),Fc(y.return,o,t),c||($=null);break e}y=Z.next}}else if(f.tag===18){if($=f.return,$===null)throw Error(i(341));$.lanes|=o,y=$.alternate,y!==null&&(y.lanes|=o),Fc($,o,t),$=null}else f.tag===13&&f.memoizedState!==null&&f.memoizedState.dehydrated===null?(f.lanes|=o,$=f.alternate,$!==null&&($.lanes|=o),Fc(f.return,o,t),$=f.child,$=$!==null?$.sibling:null):$=f.child;if($!==null)$.return=f;else for($=f;$!==null;){if($===t){$=null;break}if(f=$.sibling,f!==null){f.return=$.return,$=f;break}$=$.return}f=$}}function oo(t,n,o,c){t=null;for(var f=n,y=!1;f!==null;){if(!y){if((f.flags&524288)!==0)y=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var $=f.alternate;if($===null)throw Error(i(387));if($=$.memoizedProps,$!==null){var Z=f.type;ga(f.pendingProps.value,$.value)||(t!==null?t.push(Z):t=[Z])}}else if(f===Ce.current){if($=f.alternate,$===null)throw Error(i(387));$.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(t!==null?t.push(Ei):t=[Ei])}f=f.return}return t!==null&&Ih(n,t,o,c),n.flags|=262144,t!==null}function Kc(t){for(t=t.firstContext;t!==null;){if(!ga(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function io(t){lo=t,Qs=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function _n(t){return uy(lo,t)}function Qc(t,n){return lo===null&&io(t),uy(t,n)}function uy(t,n){var o=n._currentValue;if(n={context:n,memoizedValue:o,next:null},Qs===null){if(t===null)throw Error(i(308));
vendor: 6,202 bytes, line 8
8Qs=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else Qs=Qs.next=n;return o}var Ck=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(o,c){t.push(c)}};this.abort=function(){n.aborted=!0,t.forEach(function(o){return o()})}},Ek=e.unstable_scheduleCallback,Tk=e.unstable_NormalPriority,hn={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zh(){return{controller:new Ck,data:new Map,refCount:0}}function pr(t){t.refCount--,t.refCount===0&&Ek(Tk,function(){t.controller.abort()})}function dy(t,n){if((t.pendingLanes&4194048)!==0){var o=t.transitionTypes;for(o===null&&(o=t.transitionTypes=[]),t=0;t<n.length;t++){var c=n[t];o.indexOf(c)===-1&&o.push(c)}}}var gr=null;function Mk(t){var n=t.transitionTypes;return t.transitionTypes=null,n}var yr=null,Rh=0,ro=0,ai=null;function Dk(t,n){if(yr===null){var o=yr=[];Rh=0,ro=Jf(),ai={status:"pending",value:void 0,then:function(c){o.push(c)}}}return Rh++,n.then(hy,hy),n}function hy(){if(--Rh===0&&(gr=null,yr!==null)){ai!==null&&(ai.status="fulfilled");var t=yr;yr=null,ro=0,ai=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function _k(t,n){var o=[],c={status:"pending",value:null,reason:null,then:function(f){o.push(f)}};return t.then(function(){c.status="fulfilled",c.value=n;for(var f=0;f<o.length;f++)(0,o[f])(n)},function(f){for(c.status="rejected",c.reason=f,f=0;f<o.length;f++)(0,o[f])(void 0)}),c}var fy=xe.S;xe.S=function(t,n){if(lv=qt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Dk(t,n),gr!==null)for(var o=wi;o!==null;)dy(o,gr),o=o.next;if(o=t.types,o!==null){for(var c=wi;c!==null;)dy(c,o),c=c.next;if(ro!==0){c=gr,c===null&&(c=gr=[]);for(var f=0;f<o.length;f++){var y=o[f];c.indexOf(y)===-1&&c.push(y)}}}fy!==null&&fy(t,n)};var co=Le(null);function $h(){var t=co.current;return t!==null?t:Ut.pooledCache}function Wc(t,n){n===null?_e(co,co.current):_e(co,n.pool)}function my(){var t=$h();return t===null?null:{parent:hn._currentValue,pool:t}}var si=Error(i(460)),Lh=Error(i(474)),Jc=Error(i(542)),eu={then:function(){}};function py(t){return t=t.status,t==="fulfilled"||t==="rejected"}function gy(t,n,o){switch(o=t[o],o===void 0?t.push(n):o!==n&&(n.then(oa,oa),n=o),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,xy(t),t===void 0&&!("reason"in n)?Error(i(600)):t;default:if(typeof n.status=="string")n.then(oa,oa);else{if(t=Ut,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=n,t.status="pending",t.then(function(c){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=c}},function(c){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=c}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,xy(t),t}throw ho=n,si}}function uo(t){try{var n=t._init;return n(t._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(ho=o,si):o}}var ho=null;function yy(){if(ho===null)throw Error(i(459));var t=ho;return ho=null,t}function xy(t){if(t===si||t===Jc)throw Error(i(483))}var li=null,xr=0;function tu(t){var n=xr;return xr+=1,li===null&&(li=[]),gy(li,t,n)}function xl(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function nu(t,n){throw n.$$typeof===D?Error(i(525)):(t=Object.prototype.toString.call(n),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function vy(t){function n(he,ce){if(t){var ye=he.deletions;ye===null?(he.deletions=[ce],he.flags|=16):ye.push(ce)}}function o(he,ce){if(!t)return null;for(;ce!==null;)n(he,ce),ce=ce.sibling;return null}function c(he){for(var ce=new Map;he!==null;)he.key===null?ce.set(he.index,he):ce.set(he.key,he),he=he.sibling;return ce}function f(he,ce){return he=Fs(he,ce),he.index=0,he.sibling=null,he}function y(he,ce,ye){return he.index=ye,t?(ye=he.alternate,ye!==null?(ye=ye.index,ye<ce?(he.flags|=2,ce):ye):(he.flags|=134217730,ce)):(he.flags|=1048576,ce)}function $(he){return t&&he.alternate===null&&(he.flags|=134217730),he}function Z(he,ce,ye,Te){return ce===null||ce.tag!==6?(ce=Th(ye,he.mode,Te),ce.return=he,ce):(ce=f(ce,ye),ce.return=he,ce)}function ae(he,ce,ye,Te){var Ze=ye.type;return Ze===Y?(he=je(he,ce,ye.props.children,Te,ye.key),xl(he,ye),he):ce!==null&&(ce.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===P&&uo(Ze)===ce.type)?(ce=f(ce,ye.props),xl(ce,ye),ce.return=he,ce):(ce=qc(ye.type,ye.key,ye.props,null,he.mode,Te),xl(ce,ye),ce.return=he,ce)}function fe(he,ce,ye,Te){return ce===null||ce.tag!==4||ce.stateNode.containerInfo!==ye.containerInfo||ce.stateNode.implementation!==ye.implementation?(ce=Mh(ye,he.mode,Te),ce.return=he,ce):(ce=f(ce,ye.children||[]),ce.return=he,ce)}function je(he,ce,ye,Te,Ze){return ce===null||ce.tag!==7?(ce=ao(ye,he.mode,Te,Ze),ce.return=he,ce):(ce=f(ce,ye),ce.return=he,ce)}function Me(he,ce,ye){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return ce=Th(""+ce,he.mode,ye),ce.return=he,ce;if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case M:return ye=qc(ce.type,ce.key,ce.props,null,he.mode,ye),xl(ye,ce),ye.return=he,ye;case U:return ce=Mh(ce,he.mode,ye),ce.return=he,ce;case P:return ce=uo(ce),Me(he,ce,ye)}if(ue(ce)||se(ce))return ce=ao(ce,he.mode,ye,null),ce.return=he,ce;if(typeof ce.then=="function")return Me(he,tu(ce),ye);if(ce.$$typeof===V)return Me(he,Qc(he,ce),ye);nu(he,ce)}return null}function de(he,ce,ye,Te){var Ze=ce!==null?ce.key:null;if(typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint")return Ze!==null?null:Z(he,ce,""+ye,Te);if(typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case M:return ye.key===Ze?ae(he,ce,ye,Te):null;case U:return ye.key===Ze?fe(he,ce,ye,Te):null;case P:return ye=uo(ye),de(he,ce,ye,Te)}if(ue(ye)||se(ye))return Ze!==null?null:je(he,ce,ye,Te,null);if(typeof ye.then=="function")return de(he,ce,tu(ye),Te);if(ye.$$typeof===V)return de(he,ce,Qc(he,ye),Te);nu(he,ye)}return null}function ve(he,ce,ye,Te,Ze){if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return he=he.get(ye)||null,Z(ce,he,""+Te,Ze);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case M:return he=he.get(Te.key===null?ye:Te.key)||null,ae(ce,he,Te,Ze);
vendor: 4,446 bytes, line 8
8case U:return he=he.get(Te.key===null?ye:Te.key)||null,fe(ce,he,Te,Ze);case P:return Te=uo(Te),ve(he,ce,ye,Te,Ze)}if(ue(Te)||se(Te))return he=he.get(ye)||null,je(ce,he,Te,Ze,null);if(typeof Te.then=="function")return ve(he,ce,ye,tu(Te),Ze);if(Te.$$typeof===V)return ve(he,ce,ye,Qc(ce,Te),Ze);nu(ce,Te)}return null}function Pe(he,ce,ye,Te){for(var Ze=null,jt=null,We=ce,tt=ce=0,pn=null;We!==null&&tt<ye.length;tt++){We.index>tt?(pn=We,We=null):pn=We.sibling;var St=de(he,We,ye[tt],Te);if(St===null){We===null&&(We=pn);break}t&&We&&St.alternate===null&&n(he,We),ce=y(St,ce,tt),jt===null?Ze=St:jt.sibling=St,jt=St,We=pn}if(tt===ye.length)return o(he,We),ft&&Ks(he,tt),Ze;if(We===null){for(;tt<ye.length;tt++)We=Me(he,ye[tt],Te),We!==null&&(ce=y(We,ce,tt),jt===null?Ze=We:jt.sibling=We,jt=We);return ft&&Ks(he,tt),Ze}for(We=c(We);tt<ye.length;tt++)pn=ve(We,he,tt,ye[tt],Te),pn!==null&&(t&&(St=pn.alternate,St!==null&&We.delete(St.key===null?tt:St.key)),ce=y(pn,ce,tt),jt===null?Ze=pn:jt.sibling=pn,jt=pn);return t&&We.forEach(function($l){return n(he,$l)}),ft&&Ks(he,tt),Ze}function Fe(he,ce,ye,Te){if(ye==null)throw Error(i(151));for(var Ze=null,jt=null,We=ce,tt=ce=0,pn=null,St=ye.next();We!==null&&!St.done;tt++,St=ye.next()){We.index>tt?(pn=We,We=null):pn=We.sibling;var $l=de(he,We,St.value,Te);if($l===null){We===null&&(We=pn);break}t&&We&&$l.alternate===null&&n(he,We),ce=y($l,ce,tt),jt===null?Ze=$l:jt.sibling=$l,jt=$l,We=pn}if(St.done)return o(he,We),ft&&Ks(he,tt),Ze;if(We===null){for(;!St.done;tt++,St=ye.next())St=Me(he,St.value,Te),St!==null&&(ce=y(St,ce,tt),jt===null?Ze=St:jt.sibling=St,jt=St);return ft&&Ks(he,tt),Ze}for(We=c(We);!St.done;tt++,St=ye.next())St=ve(We,he,tt,St.value,Te),St!==null&&(t&&(pn=St.alternate,pn!==null&&We.delete(pn.key===null?tt:pn.key)),ce=y(St,ce,tt),jt===null?Ze=St:jt.sibling=St,jt=St);return t&&We.forEach(function(dC){return n(he,dC)}),ft&&Ks(he,tt),Ze}function ct(he,ce,ye,Te){if(typeof ye=="object"&&ye!==null&&ye.type===Y&&ye.key===null&&ye.props.ref===void 0&&(ye=ye.props.children),typeof ye=="object"&&ye!==null){switch(ye.$$typeof){case M:e:{for(var Ze=ye.key;ce!==null;){if(ce.key===Ze){if(Ze=ye.type,Ze===Y){if(ce.tag===7){o(he,ce.sibling),Te=f(ce,ye.props.children),xl(Te,ye),Te.return=he,he=Te;break e}}else if(ce.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===P&&uo(Ze)===ce.type){o(he,ce.sibling),Te=f(ce,ye.props),xl(Te,ye),Te.return=he,he=Te;break e}o(he,ce);break}else n(he,ce);ce=ce.sibling}ye.type===Y?(Te=ao(ye.props.children,he.mode,Te,ye.key),xl(Te,ye),Te.return=he,he=Te):(Te=qc(ye.type,ye.key,ye.props,null,he.mode,Te),xl(Te,ye),Te.return=he,he=Te)}return $(he);case U:e:{for(Ze=ye.key;ce!==null;){if(ce.key===Ze)if(ce.tag===4&&ce.stateNode.containerInfo===ye.containerInfo&&ce.stateNode.implementation===ye.implementation){o(he,ce.sibling),Te=f(ce,ye.children||[]),Te.return=he,he=Te;break e}else{o(he,ce);break}else n(he,ce);ce=ce.sibling}Te=Mh(ye,he.mode,Te),Te.return=he,he=Te}return $(he);case P:return ye=uo(ye),ct(he,ce,ye,Te)}if(ue(ye))return Pe(he,ce,ye,Te);if(se(ye)){if(Ze=se(ye),typeof Ze!="function")throw Error(i(150));return ye=Ze.call(ye),Fe(he,ce,ye,Te)}if(typeof ye.then=="function")return ct(he,ce,tu(ye),Te);if(ye.$$typeof===V)return ct(he,ce,Qc(he,ye),Te);nu(he,ye)}return typeof ye=="string"&&ye!==""||typeof ye=="number"||typeof ye=="bigint"?(ye=""+ye,ce!==null&&ce.tag===6?(o(he,ce.sibling),Te=f(ce,ye),Te.return=he,he=Te):(o(he,ce),Te=Th(ye,he.mode,Te),Te.return=he,he=Te),$(he)):o(he,ce)}return function(he,ce,ye,Te){try{xr=0;var Ze=ct(he,ce,ye,Te);return li=null,Ze}catch(We){if(We===si||We===Jc)throw We;var jt=ca(29,We,null,he.mode);return jt.lanes=Te,jt.return=he,jt}}}var fo=vy(!0),by=vy(!1),vl=!1;function Uh(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hh(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function bl(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function wl(t,n,o){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(Ct&2)!==0){var f=c.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),c.pending=n,n=Vc(t),ay(t,null,o),n}return Yc(t,c,n,o),Vc(t)}function vr(t,n,o){if(n=n.updateQueue,n!==null&&(n=n.shared,(o&4194048)!==0)){var c=n.lanes;
vendor: 7,141 bytes, line 8
8c&=t.pendingLanes,o|=c,n.lanes=o,Bs(t,o)}}function Bh(t,n){var o=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var f=null,y=null;if(o=o.firstBaseUpdate,o!==null){do{var $={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};y===null?f=y=$:y=y.next=$,o=o.next}while(o!==null);y===null?f=y=n:y=y.next=n}else f=y=n;o={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:y,shared:c.shared,callbacks:c.callbacks},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=n:t.next=n,o.lastBaseUpdate=n}var Ph=!1;function br(){if(Ph){var t=ai;if(t!==null)throw t}}function wr(t,n,o,c){Ph=!1;var f=t.updateQueue;vl=!1;var y=f.firstBaseUpdate,$=f.lastBaseUpdate,Z=f.shared.pending;if(Z!==null){f.shared.pending=null;var ae=Z,fe=ae.next;ae.next=null,$===null?y=fe:$.next=fe,$=ae;var je=t.alternate;je!==null&&(je=je.updateQueue,Z=je.lastBaseUpdate,Z!==$&&(Z===null?je.firstBaseUpdate=fe:Z.next=fe,je.lastBaseUpdate=ae))}if(y!==null){var Me=f.baseState;$=0,je=fe=ae=null,Z=y;do{var de=Z.lane&-536870913,ve=de!==Z.lane;if(ve?(wt&de)===de:(c&de)===de){de!==0&&de===ro&&(Ph=!0),je!==null&&(je=je.next={lane:0,tag:Z.tag,payload:Z.payload,callback:null,next:null});e:{var Pe=t,Fe=Z;de=n;var ct=o;switch(Fe.tag){case 1:if(Pe=Fe.payload,typeof Pe=="function"){Me=Pe.call(ct,Me,de);break e}Me=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=Fe.payload,de=typeof Pe=="function"?Pe.call(ct,Me,de):Pe,de==null)break e;Me=A({},Me,de);break e;case 2:vl=!0}}de=Z.callback,de!==null&&(t.flags|=64,ve&&(t.flags|=8192),ve=f.callbacks,ve===null?f.callbacks=[de]:ve.push(de))}else ve={lane:de,tag:Z.tag,payload:Z.payload,callback:Z.callback,next:null},je===null?(fe=je=ve,ae=Me):je=je.next=ve,$|=de;if(Z=Z.next,Z===null){if(Z=f.shared.pending,Z===null)break;ve=Z,Z=ve.next,ve.next=null,f.lastBaseUpdate=ve,f.shared.pending=null}}while(!0);je===null&&(ae=Me),f.baseState=ae,f.firstBaseUpdate=fe,f.lastBaseUpdate=je,y===null&&(f.shared.lanes=0),Tl|=$,t.lanes=$,t.memoizedState=Me}}function wy(t,n){if(typeof t!="function")throw Error(i(191,t));t.call(n)}function jy(t,n){var o=t.callbacks;if(o!==null)for(t.callbacks=null,t=0;t<o.length;t++)wy(o[t],n)}var jl=Le(null),au=Le(0);function Ny(t,n){t=al,_e(au,t),_e(jl,n),al=t|n.baseLanes}function Yh(){_e(au,al),_e(jl,jl.current)}function Vh(){al=au.current,me(jl),me(au)}var On=Le(null),Pn=null;function Nl(t){var n=t.alternate;_e(An,An.current&1),_e(On,t),Pn===null&&(n===null||jl.current!==null||n.memoizedState!==null)&&(Pn=t)}function qh(t){_e(An,An.current),_e(On,t),Pn===null&&(Pn=t)}function ky(t){t.tag===22?(_e(An,An.current),_e(On,t),Pn===null&&(Pn=t)):kl()}function kl(){_e(An,An.current),_e(On,On.current)}function ya(t){me(On),Pn===t&&(Pn=null),me(An)}var An=Le(0);function jr(t,n){_e(On,On.current),_e(An,n)}function Gh(t){me(An),me(On),Pn===t&&(Pn=null)}function su(t){for(var n=t;n!==null;){if(n.tag===13){var o=n.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||pm(o)||gm(o)))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!=="independent"){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Js=0,rt=null,$t=null,fn=null,lu=!1,oi=!1,mo=!1,ou=0,Nr=0,ii=null,Ok=0;function tn(){throw Error(i(321))}function Xh(t,n){if(n===null)return!1;for(var o=0;o<n.length&&o<t.length;o++)if(!ga(t[o],n[o]))return!1;return!0}function Zh(t,n,o,c,f,y){return Js=y,rt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,xe.H=t===null||t.memoizedState===null?ix:rx,mo=!1,y=o(c,f),mo=!1,oi&&(y=Cy(n,o,c,f)),Sy(t),y}function Sy(t){xe.H=fu;var n=$t!==null&&$t.next!==null;if(Js=0,fn=$t=rt=null,lu=!1,Nr=0,ii=null,n)throw Error(i(300));t===null||mn||(t=t.dependencies,t!==null&&Kc(t)&&(mn=!0))}function Cy(t,n,o,c){rt=t;var f=0;do{if(oi&&(ii=null),Nr=0,oi=!1,25<=f)throw Error(i(301));if(f+=1,fn=$t=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}xe.H=Hk,y=n(o,c)}while(oi);return y}function Ak(){var t=xe.H,n=t.useState()[0];return n=typeof n.then=="function"?kr(n):n,t=t.useState()[0],($t!==null?$t.memoizedState:null)!==t&&(rt.flags|=1024),n}function Fh(){var t=ou!==0;return ou=0,t}function Kh(t,n,o){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~o}function Qh(t){if(lu){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}lu=!1}Js=0,fn=$t=rt=null,oi=!1,Nr=ou=0,ii=null}function Xn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fn===null?rt.memoizedState=fn=t:fn=fn.next=t,fn}function cn(){if($t===null){var t=rt.alternate;t=t!==null?t.memoizedState:null}else t=$t.next;var n=fn===null?rt.memoizedState:fn.next;if(n!==null)fn=n,$t=t;else{if(t===null)throw rt.alternate===null?Error(i(467)):Error(i(310));$t=t,t={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},fn===null?rt.memoizedState=fn=t:fn=fn.next=t}return fn}function iu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function kr(t){var n=Nr;return Nr+=1,ii===null&&(ii=[]),t=gy(ii,t,n),n=rt,(fn===null?n.memoizedState:fn.next)===null&&(n=n.alternate,xe.H=n===null||n.memoizedState===null?ix:rx),t}function ru(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return kr(t);if(t.$$typeof===Q)return;if(t.$$typeof===V)return _n(t)}throw Error(i(438,String(t)))}function Wh(t){var n=null,o=rt.updateQueue;if(o!==null&&(n=o.memoCache),n==null){var c=rt.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(n={data:c.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),o===null&&(o=iu(),rt.updateQueue=o),o.memoCache=n,o=n.data[n.index],o===void 0)for(o=n.data[n.index]=Array(t),c=0;c<t;c++)o[c]=pe;return n.index++,o}function el(t,n){return typeof n=="function"?n(t):n}function cu(t){var n=cn();return Jh(n,$t,t)}function Jh(t,n,o){var c=t.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=o;var f=t.baseQueue,y=c.pending;if(y!==null){if(f!==null){var $=f.next;f.next=y.next,y.next=$}n.baseQueue=f=y,c.pending=null}if(y=t.baseState,f===null)t.memoizedState=y;else{n=f.next;var Z=$=null,ae=null,fe=n,je=!1;do{var Me=fe.lane&-536870913;if(Me!==fe.lane?(wt&Me)===Me:(Js&Me)===Me){var de=fe.revertLane;if(de===0)ae!==null&&(ae=ae.next={lane:0,revertLane:0,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),Me===ro&&(je=!0);else if((Js&de)===de){fe=fe.next,de===ro&&(je=!0);continue}else Me={lane:0,revertLane:fe.revertLane,gesture:null,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},ae===null?(Z=ae=Me,$=y):ae=ae.next=Me,rt.lanes|=de,Tl|=de;Me=fe.action,mo&&o(y,Me),y=fe.hasEagerState?fe.eagerState:o(y,Me)}else de={lane:Me,revertLane:fe.revertLane,gesture:fe.gesture,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null},ae===null?(Z=ae=de,$=y):ae=ae.next=de,rt.lanes|=Me,Tl|=Me;fe=fe.next}
8while(fe!==null&&fe!==n);if(ae===null?$=y:ae.next=Z,!ga(y,t.memoizedState)&&(mn=!0,je&&(o=ai,o!==null)))throw o;t.memoizedState=y,t.baseState=$,t.baseQueue=ae,c.lastRenderedState=y}return f===null&&(c.lanes=0),[t.memoizedState,c.dispatch]}function ef(t){var n=cn(),o=n.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=t;var c=o.dispatch,f=o.pending,y=n.memoizedState;if(f!==null){o.pending=null;var $=f=f.next;do y=t(y,$.action),$=$.next;while($!==f);ga(y,n.memoizedState)||(mn=!0),n.memoizedState=y,n.baseQueue===null&&(n.baseState=y),o.lastRenderedState=y}return[y,c]}function Ey(t,n,o){var c=rt,f=cn(),y=ft;if(y){if(o===void 0)throw Error(i(407));o=o()}else o=n();var $=!ga(($t||f).memoizedState,o);if($&&(f.memoizedState=o,mn=!0),f=f.queue,af(Dy.bind(null,c,f,t),[t]),t=f.getSnapshot!==n||$||fn!==null&&(fn.memoizedState.tag&1)!==0,ri(t?9:8,{destroy:void 0},My.bind(null,c,f,o,n),null),t){if(c.flags|=2048,Ut===null)throw Error(i(349));y||(Js&127)!==0||Ty(c,n,o)}return o}function Ty(t,n,o){t.flags|=16384,t={getSnapshot:n,value:o},n=rt.updateQueue,n===null?(n=iu(),rt.updateQueue=n,n.stores=[t]):(o=n.stores,o===null?n.stores=[t]:o.push(t))}function My(t,n,o,c){n.value=o,n.getSnapshot=c,_y(n)&&Oy(t)}function Dy(t,n,o){return o(function(){_y(n)&&Oy(t)})}function _y(t){var n=t.getSnapshot;t=t.value;try{var o=n();return!ga(t,o)}catch{return!0}}function Oy(t){var n=no(t,2);
vendor: 4,829 bytes, line 8
8n!==null&&fa(n,t,2)}function tf(t){var n=Xn();if(typeof t=="function"){var o=t;if(t=o(),mo){Bt(!0);try{o()}finally{Bt(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:el,lastRenderedState:t},n}function Ay(t,n,o,c){return t.baseState=o,Jh(t,$t,typeof c=="function"?c:el)}function Ik(t,n,o,c,f){if(hu(t))throw Error(i(485));if(t=n.action,t!==null){var y={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function($){y.listeners.push($)}};xe.T!==null?o(!0):y.isTransition=!1,c(y),o=n.pending,o===null?(y.next=n.pending=y,Iy(n,y)):(y.next=o.next,n.pending=o.next=y)}}function Iy(t,n){var o=n.action,c=n.payload,f=t.state;if(n.isTransition){var y=xe.T,$={};$.types=y!==null?y.types:null,xe.T=$;try{var Z=o(f,c),ae=xe.S;ae!==null&&ae($,Z),zy(t,n,Z)}catch(fe){nf(t,n,fe)}finally{y!==null&&$.types!==null&&(y.types=$.types),xe.T=y}}else try{y=o(f,c),zy(t,n,y)}catch(fe){nf(t,n,fe)}}function zy(t,n,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(c){Ry(t,n,c)},function(c){return nf(t,n,c)}):Ry(t,n,o)}function Ry(t,n,o){n.status="fulfilled",n.value=o,$y(n),t.state=o,n=t.pending,n!==null&&(o=n.next,o===n?t.pending=null:(o=o.next,n.next=o,Iy(t,o)))}function nf(t,n,o){var c=t.pending;if(t.pending=null,c!==null){c=c.next;do n.status="rejected",n.reason=o,$y(n),n=n.next;while(n!==c)}t.action=null}function $y(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Ly(t,n){return n}function Uy(t,n){if(ft){var o=Ut.formState;if(o!==null){e:{var c=rt;if(ft){if(Yt){t:{for(var f=Yt,y=Ua;f.nodeType!==8;){if(!y){f=null;break t}if(f=Ba(f.nextSibling),f===null){f=null;break t}}y=f.data,f=y==="F!"||y==="F"?f:null}if(f){Yt=Ba(f.nextSibling),c=f.data==="F!";break e}}gl(c)}c=!1}c&&(n=o[0])}}return o=Xn(),o.memoizedState=o.baseState=n,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ly,lastRenderedState:n},o.queue=c,o=sx.bind(null,rt,c),c.dispatch=o,c=tf(!1),y=cf.bind(null,rt,!1,c.queue),c=Xn(),f={state:n,dispatch:null,action:t,pending:null},c.queue=f,o=Ik.bind(null,rt,f,y,o),f.dispatch=o,c.memoizedState=t,[n,o,!1]}function Hy(t){var n=cn();return By(n,$t,t)}function By(t,n,o){if(n=Jh(t,n,Ly)[0],t=cu(el)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var c=kr(n)}catch($){throw $===si?Jc:$}else c=n;n=cn();var f=n.queue,y=f.dispatch;return o!==n.memoizedState&&(rt.flags|=2048,ri(9,{destroy:void 0},zk.bind(null,f,o),null)),[c,y,t]}function zk(t,n){t.action=n}function Py(t){var n=cn(),o=$t;if(o!==null)return By(n,o,t);cn(),n=n.memoizedState,o=cn();var c=o.queue.dispatch;return o.memoizedState=t,[n,c,!1]}function ri(t,n,o,c){return t={tag:t,create:o,deps:c,inst:n,next:null},n=rt.updateQueue,n===null&&(n=iu(),rt.updateQueue=n),o=n.lastEffect,o===null?n.lastEffect=t.next=t:(c=o.next,o.next=t,t.next=c,n.lastEffect=t),t}function Yy(){return cn().memoizedState}function uu(t,n,o,c){var f=Xn();rt.flags|=t,f.memoizedState=ri(1|n,{destroy:void 0},o,c===void 0?null:c)}function du(t,n,o,c){var f=cn();c=c===void 0?null:c;var y=f.memoizedState.inst;$t!==null&&c!==null&&Xh(c,$t.memoizedState.deps)?f.memoizedState=ri(n,y,o,c):(rt.flags|=t,f.memoizedState=ri(1|n,y,o,c))}function Vy(t,n){uu(8390656,8,t,n)}function af(t,n){du(2048,8,t,n)}function Rk(t){rt.flags|=4;var n=rt.updateQueue;if(n===null)n=iu(),rt.updateQueue=n,n.events=[t];else{var o=n.events;o===null?n.events=[t]:o.push(t)}}function qy(t){var n=cn().memoizedState;return Rk({ref:n,nextImpl:t}),function(){if((Ct&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}function Gy(t,n){return du(4,2,t,n)}function Xy(t,n){return du(4,4,t,n)}function Zy(t,n){if(typeof n=="function"){t=t();var o=n(t);return function(){typeof o=="function"?o():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Fy(t,n,o){o=o!=null?o.concat([t]):null,du(4,4,Zy.bind(null,n,t),o)}function sf(){}function Ky(t,n){var o=cn();n=n===void 0?null:n;var c=o.memoizedState;return n!==null&&Xh(n,c[1])?c[0]:(o.memoizedState=[t,n],t)}function Qy(t,n){var o=cn();n=n===void 0?null:n;var c=o.memoizedState;if(n!==null&&Xh(n,c[1]))return c[0];if(c=t(),mo){Bt(!0);try{t()}finally{Bt(!1)}}return o.memoizedState=[c,n],c}function lf(t,n,o){return o===void 0||(Js&1073741824)!==0&&(wt&261930)===0?t.memoizedState=n:(t.memoizedState=o,t=iv(),rt.lanes|=t,Tl|=t,o)}function Wy(t,n,o,c){return ga(o,n)?o:jl.current!==null?(t=lf(t,o,c),ga(t,n)||(mn=!0),t):(Js&106)===0||(Js&1073741824)!==0&&(wt&261930)===0?(mn=!0,t.memoizedState=o):(t=iv(),rt.lanes|=t,Tl|=t,n)}function Jy(t,n,o,c,f){var y=Ne.p;Ne.p=y!==0&&8>y?y:8;var $=xe.T,Z={};Z.types=$!==null?$.types:null,xe.T=Z,cf(t,!1,n,o);try{var ae=f(),fe=xe.S;if(fe!==null&&fe(Z,ae),ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var je=_k(ae,c);
vendor: 10,418 bytes, line 8
8Sr(t,n,je,wa(t))}else Sr(t,n,c,wa(t))}catch(Me){Sr(t,n,{then:function(){},status:"rejected",reason:Me},wa())}finally{Ne.p=y,$!==null&&Z.types!==null&&($.types=Z.types),xe.T=$}}function $k(){}function of(t,n,o,c){if(t.tag!==5)throw Error(i(476));var f=ex(t).queue;Jy(t,f,n,He,o===null?$k:function(){return tx(t),o(c)})}function ex(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:He,baseState:He,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:el,lastRenderedState:He},next:null};var o={};return n.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:el,lastRenderedState:o},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function tx(t){var n=ex(t);n.next===null&&(n=t.alternate.memoizedState),Sr(t,n.next.queue,{},wa())}function rf(){return _n(Ei)}function nx(){return cn().memoizedState}function ax(){return cn().memoizedState}function Lk(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var o=wa();t=bl(o);var c=wl(n,t,o);c!==null&&(fa(c,n,o),vr(c,n,o)),n={cache:zh()},t.payload=n;return}n=n.return}}function Uk(t,n,o){var c=wa();o={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},hu(t)?lx(n,o):(o=Ch(t,n,o,c),o!==null&&(fa(o,t,c),ox(o,n,c)))}function sx(t,n,o){var c=wa();Sr(t,n,o,c)}function Sr(t,n,o,c){var f={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(hu(t))lx(n,f);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=n.lastRenderedReducer,y!==null))try{var $=n.lastRenderedState,Z=y($,o);if(f.hasEagerState=!0,f.eagerState=Z,ga(Z,$))return Yc(t,n,f,0),Ut===null&&Pc(),!1}catch{}if(o=Ch(t,n,f,c),o!==null)return fa(o,t,c),ox(o,n,c),!0}return!1}function cf(t,n,o,c){if(c={lane:2,revertLane:Jf(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},hu(t)){if(n)throw Error(i(479))}else n=Ch(t,o,c,2),n!==null&&fa(n,t,2)}function hu(t){var n=t.alternate;return t===rt||n!==null&&n===rt}function lx(t,n){oi=lu=!0;var o=t.pending;o===null?n.next=n:(n.next=o.next,o.next=n),t.pending=n}function ox(t,n,o){if((o&4194048)!==0){var c=n.lanes;c&=t.pendingLanes,o|=c,n.lanes=o,Bs(t,o)}}var fu={readContext:_n,use:ru,useCallback:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useLayoutEffect:tn,useInsertionEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useSyncExternalStore:tn,useId:tn,useHostTransitionStatus:tn,useFormState:tn,useActionState:tn,useOptimistic:tn,useMemoCache:tn,useCacheRefresh:tn,useEffectEvent:tn},ix={readContext:_n,use:ru,useCallback:function(t,n){return Xn().memoizedState=[t,n===void 0?null:n],t},useContext:_n,useEffect:Vy,useImperativeHandle:function(t,n,o){o=o!=null?o.concat([t]):null,uu(4194308,4,Zy.bind(null,n,t),o)},useLayoutEffect:function(t,n){return uu(4194308,4,t,n)},useInsertionEffect:function(t,n){uu(4,2,t,n)},useMemo:function(t,n){var o=Xn();n=n===void 0?null:n;var c=t();if(mo){Bt(!0);try{t()}finally{Bt(!1)}}return o.memoizedState=[c,n],c},useReducer:function(t,n,o){var c=Xn();if(o!==void 0){var f=o(n);if(mo){Bt(!0);try{o(n)}finally{Bt(!1)}}}else f=n;return c.memoizedState=c.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},c.queue=t,t=t.dispatch=Uk.bind(null,rt,t),[c.memoizedState,t]},useRef:function(t){var n=Xn();return t={current:t},n.memoizedState=t},useState:function(t){t=tf(t);var n=t.queue,o=sx.bind(null,rt,n);return n.dispatch=o,[t.memoizedState,o]},useDebugValue:sf,useDeferredValue:function(t,n){var o=Xn();return lf(o,t,n)},useTransition:function(){var t=tf(!1);return t=Jy.bind(null,rt,t.queue,!0,!1),Xn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,o){var c=rt,f=Xn();if(ft){if(o===void 0)throw Error(i(407));o=o()}else{if(o=n(),Ut===null)throw Error(i(349));(wt&127)!==0||Ty(c,n,o)}f.memoizedState=o;var y={value:o,getSnapshot:n};return f.queue=y,Vy(Dy.bind(null,c,y,t),[t]),c.flags|=2048,ri(9,{destroy:void 0},My.bind(null,c,y,o,n),null),o},useId:function(){var t=Xn(),n=Ut.identifierPrefix;if(ft){var o=Ns,c=js;o=(c&~(1<<32-Jt(c)-1)).toString(32)+o,n="_"+n+"R_"+o,o=ou++,0<o&&(n+="H"+o.toString(32)),n+="_"}else o=Ok++,n="_"+n+"r_"+o.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:rf,useFormState:Uy,useActionState:Uy,useOptimistic:function(t){var n=Xn();n.memoizedState=n.baseState=t;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=o,n=cf.bind(null,rt,!0,o),o.dispatch=n,[t,n]},useMemoCache:Wh,useCacheRefresh:function(){return Xn().memoizedState=Lk.bind(null,rt)},useEffectEvent:function(t){var n=Xn(),o={impl:t};return n.memoizedState=o,function(){if((Ct&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},rx={readContext:_n,use:ru,useCallback:Ky,useContext:_n,useEffect:af,useImperativeHandle:Fy,useInsertionEffect:Gy,useLayoutEffect:Xy,useMemo:Qy,useReducer:cu,useRef:Yy,useState:function(){return cu(el)},useDebugValue:sf,useDeferredValue:function(t,n){var o=cn();return Wy(o,$t.memoizedState,t,n)},useTransition:function(){var t=cu(el)[0],n=cn().memoizedState;return[typeof t=="boolean"?t:kr(t),n]},useSyncExternalStore:Ey,useId:nx,useHostTransitionStatus:rf,useFormState:Hy,useActionState:Hy,useOptimistic:function(t,n){var o=cn();return Ay(o,$t,t,n)},useMemoCache:Wh,useCacheRefresh:ax,useEffectEvent:qy},Hk={readContext:_n,use:ru,useCallback:Ky,useContext:_n,useEffect:af,useImperativeHandle:Fy,useInsertionEffect:Gy,useLayoutEffect:Xy,useMemo:Qy,useReducer:ef,useRef:Yy,useState:function(){return ef(el)},useDebugValue:sf,useDeferredValue:function(t,n){var o=cn();return $t===null?lf(o,t,n):Wy(o,$t.memoizedState,t,n)},useTransition:function(){var t=ef(el)[0],n=cn().memoizedState;return[typeof t=="boolean"?t:kr(t),n]},useSyncExternalStore:Ey,useId:nx,useHostTransitionStatus:rf,useFormState:Py,useActionState:Py,useOptimistic:function(t,n){var o=cn();return $t!==null?Ay(o,$t,t,n):(o.baseState=t,[t,o.queue.dispatch])},useMemoCache:Wh,useCacheRefresh:ax,useEffectEvent:qy};function uf(t,n,o,c){n=t.memoizedState,o=o(c,n),o=o==null?n:A({},n,o),t.memoizedState=o,t.lanes===0&&(t.updateQueue.baseState=o)}var df={enqueueSetState:function(t,n,o){t=t._reactInternals;var c=wa(),f=bl(c);f.payload=n,o!=null&&(f.callback=o),n=wl(t,f,c),n!==null&&(fa(n,t,c),vr(n,t,c))},enqueueReplaceState:function(t,n,o){t=t._reactInternals;var c=wa(),f=bl(c);f.tag=1,f.payload=n,o!=null&&(f.callback=o),n=wl(t,f,c),n!==null&&(fa(n,t,c),vr(n,t,c))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var o=wa(),c=bl(o);c.tag=2,n!=null&&(c.callback=n),n=wl(t,c,o),n!==null&&(fa(n,t,o),vr(n,t,o))}};function cx(t,n,o,c,f,y,$){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,y,$):n.prototype&&n.prototype.isPureReactComponent?!dr(o,c)||!dr(f,y):!0}function ux(t,n,o,c){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(o,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(o,c),n.state!==t&&df.enqueueReplaceState(n,n.state,null)}function po(t,n){var o=n;if("ref"in n){o={};for(var c in n)c!=="ref"&&(o[c]=n[c])}if(t=t.defaultProps){o===n&&(o=A({},o));for(var f in t)o[f]===void 0&&(o[f]=t[f])}return o}function dx(t){Bc(t)}function hx(t){console.error(t)}function fx(t){Bc(t)}function mu(t,n){try{var o=t.onUncaughtError;o(n.value,{componentStack:n.stack})}catch(c){setTimeout(function(){throw c})}}function mx(t,n,o){try{var c=t.onCaughtError;c(o.value,{componentStack:o.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function hf(t,n,o){return o=bl(o),o.tag=3,o.payload={element:null},o.callback=function(){mu(t,n)},o}function px(t){return t=bl(t),t.tag=3,t}function gx(t,n,o,c){var f=o.type.getDerivedStateFromError;if(typeof f=="function"){var y=c.value;t.payload=function(){return f(y)},t.callback=function(){mx(n,o,c)}}var $=o.stateNode;$!==null&&typeof $.componentDidCatch=="function"&&(t.callback=function(){mx(n,o,c),typeof f!="function"&&(Ml===null?Ml=new Set([this]):Ml.add(this));var Z=c.stack;this.componentDidCatch(c.value,{componentStack:Z!==null?Z:""})})}function Bk(t,n,o,c,f){if(o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(n=o.alternate,n!==null&&oo(n,o,f,!0),o=On.current,o!==null){switch(o.tag){case 31:case 13:case 19:return Pn===null?zu():o.alternate===null&&nn===0&&(nn=3),o.flags&=-257,o.flags|=65536,o.lanes=f,c===eu?o.flags|=16384:(n=o.updateQueue,n===null?o.updateQueue=new Set([c]):n.add(c),Kf(t,c,f)),!1;case 22:return o.flags|=65536,c===eu?o.flags|=16384:(n=o.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([c])},o.updateQueue=n):(o=n.retryQueue,o===null?n.retryQueue=new Set([c]):o.add(c)),Kf(t,c,f)),!1}throw Error(i(435,o.tag))}return Kf(t,c,f),zu(),!1}if(ft)return n=On.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,c!==_h&&(t=Error(i(422),{cause:c}),mr(Ra(t,o)))):(c!==_h&&(n=Error(i(423),{cause:c}),mr(Ra(n,o))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,c=Ra(c,o),f=hf(t.stateNode,c,f),Bh(t,f),nn!==4&&(nn=2)),!1;var y=Error(i(520),{cause:c});if(y=Ra(y,o),Ar===null?Ar=[y]:Ar.push(y),nn!==4&&(nn=2),n===null)return!0;c=Ra(c,o),o=n;do{switch(o.tag){case 3:return o.flags|=65536,t=f&-f,o.lanes|=t,t=hf(o.stateNode,c,t),Bh(o,t),!1;case 1:if(n=o.type,y=o.stateNode,(o.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Ml===null||!Ml.has(y))))return o.flags|=65536,f&=-f,o.lanes|=f,f=px(f),gx(f,t,o,c),Bh(o,f),!1;break;case 22:if(o.memoizedState!==null)return o.flags|=65536,!1}o=o.return}while(o!==null);return!1}var ff=Error(i(461)),mn=!1;function vn(t,n,o,c){n.child=t===null?by(n,null,o,c):fo(n,t.child,o,c)}function yx(t,n,o,c,f){o=o.render;var y=n.ref;if("ref"in c){var $={};for(var Z in c)Z!=="ref"&&($[Z]=c[Z])}else $=c;return io(n),c=Zh(t,n,o,$,y,f),Z=Fh(),t!==null&&!mn?(Kh(t,n,f),tl(t,n,f)):(ft&&Z&&Xc(n),n.flags|=1,vn(t,n,c,f),n.child)}function xx(t,n,o,c,f){if(t===null){var y=o.type;return typeof y=="function"&&!Eh(y)&&y.defaultProps===void 0&&o.compare===null?(n.tag=15,n.type=y,vx(t,n,y,c,f)):(t=qc(o.type,null,c,n,n.mode,f),t.ref=n.ref,t.return=n,n.child=t)}if(y=t.child,!wf(t,f)){var $=y.memoizedProps;
vendor: 5,820 bytes, line 8
8if(o=o.compare,o=o!==null?o:dr,o($,c)&&t.ref===n.ref)return tl(t,n,f)}return n.flags|=1,t=Fs(y,c),t.ref=n.ref,t.return=n,n.child=t}function vx(t,n,o,c,f){if(t!==null){var y=t.memoizedProps;if(dr(y,c)&&t.ref===n.ref)if(mn=!1,n.pendingProps=c=y,wf(t,f))(t.flags&131072)!==0&&(mn=!0);else return n.lanes=t.lanes,tl(t,n,f)}return mf(t,n,o,c,f)}function bx(t,n,o,c){var f=c.children,y=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((n.flags&128)!==0){if(y=y!==null?y.baseLanes|o:o,t!==null){for(c=n.child=t.child,f=0;c!==null;)f=f|c.lanes|c.childLanes,c=c.sibling;c=f&~y}else c=0,n.child=null;return wx(t,n,y,o,c)}if((o&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Wc(n,y!==null?y.cachePool:null),y!==null?Ny(n,y):Yh(),ky(n);else return c=n.lanes=536870912,wx(t,n,y!==null?y.baseLanes|o:o,o,c)}else y!==null?(Wc(n,y.cachePool),Ny(n,y),kl(),n.memoizedState=null):(t!==null&&Wc(n,null),Yh(),kl());return vn(t,n,f,o),n.child}function Cr(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function wx(t,n,o,c,f){var y=$h();return y=y===null?null:{parent:hn._currentValue,pool:y},n.memoizedState={baseLanes:o,cachePool:y},t!==null&&Wc(n,null),Yh(),ky(n),t!==null&&oo(t,n,c,!0),n.childLanes=f,null}function pu(t,n){return n=gu({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function jx(t,n,o){return fo(n,t.child,null,o),t=pu(n,n.pendingProps),t.flags|=2,ya(n),n.memoizedState=null,t}function Pk(t,n,o){var c=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(ft){if(c.mode==="hidden")return t=pu(n,c),n.lanes=536870912,t.memoizedState={baseLanes:0,cachePool:null},Cr(null,t);if(qh(n),(t=Yt)?(t=Zv(t,Ua),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:ml!==null?{id:js,overflow:Ns}:null,retryLane:536870912,hydrationErrors:null},o=ly(t),o.return=n,n.child=o,kn=n,Yt=null)):t=null,t===null)throw gl(n);return n.lanes=536870912,null}return pu(n,c)}var y=t.memoizedState;if(y!==null){var $=y.dehydrated;if(qh(n),f)if(n.flags&256)n.flags&=-257,n=jx(t,n,o);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(i(558));else if(mn||oo(t,n,o,!1),f=(o&t.childLanes)!==0,mn||f){if(jl.current===null){if(c=Ut,c!==null&&($=Za(c,o),$!==0&&$!==y.retryLane))throw y.retryLane=$,no(t,$),fa(c,t,$),ff;zu()}n=jx(t,n,o)}else t=y.treeContext,Yt=Ba($.nextSibling),kn=n,ft=!0,pl=null,Ua=!1,t!==null&&ry(n,t),n=pu(n,c),n.flags|=134221824;return n}return t=Fs(t.child,{mode:c.mode,children:c.children}),t.ref=n.ref,n.child=t,t.return=n,t}function ci(t,n){var o=n.ref;if(o===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(t===null||t.ref!==o)&&(n.flags|=4194816)}}function mf(t,n,o,c,f){return io(n),o=Zh(t,n,o,c,void 0,f),c=Fh(),t!==null&&!mn?(Kh(t,n,f),tl(t,n,f)):(ft&&c&&Xc(n),n.flags|=1,vn(t,n,o,f),n.child)}function Nx(t,n,o,c,f,y){return io(n),n.updateQueue=null,o=Cy(n,c,o,f),Sy(t),c=Fh(),t!==null&&!mn?(Kh(t,n,y),tl(t,n,y)):(ft&&c&&Xc(n),n.flags|=1,vn(t,n,o,y),n.child)}function kx(t,n,o,c,f){if(io(n),n.stateNode===null){var y=Jo,$=o.contextType;typeof $=="object"&&$!==null&&(y=_n($)),y=new o(c,y),n.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=df,n.stateNode=y,y._reactInternals=n,y=n.stateNode,y.props=c,y.state=n.memoizedState,y.refs={},Uh(n),$=o.contextType,y.context=typeof $=="object"&&$!==null?_n($):Jo,y.state=n.memoizedState,$=o.getDerivedStateFromProps,typeof $=="function"&&(uf(n,o,$,c),y.state=n.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||($=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),$!==y.state&&df.enqueueReplaceState(y,y.state,null),wr(n,c,y,f),br(),y.state=n.memoizedState),typeof y.componentDidMount=="function"&&(n.flags|=4194308),c=!0}else if(t===null){y=n.stateNode;var Z=n.memoizedProps,ae=po(o,Z);y.props=ae;var fe=y.context,je=o.contextType;$=Jo,typeof je=="object"&&je!==null&&($=_n(je));var Me=o.getDerivedStateFromProps;je=typeof Me=="function"||typeof y.getSnapshotBeforeUpdate=="function",Z=n.pendingProps!==Z,je||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(Z||fe!==$)&&ux(n,y,c,$),vl=!1;var de=n.memoizedState;y.state=de,wr(n,c,y,f),br(),fe=n.memoizedState,Z||de!==fe||vl?(typeof Me=="function"&&(uf(n,o,Me,c),fe=n.memoizedState),(ae=vl||cx(n,o,ae,c,de,fe,$))?(je||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(n.flags|=4194308)):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=fe),y.props=c,y.state=fe,y.context=$,c=ae):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{y=n.stateNode,Hh(t,n),$=n.memoizedProps,je=po(o,$),y.props=je,Me=n.pendingProps,de=y.context,fe=o.contextType,ae=Jo,typeof fe=="object"&&fe!==null&&(ae=_n(fe)),Z=o.getDerivedStateFromProps,(fe=typeof Z=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||($!==Me||de!==ae)&&ux(n,y,c,ae),vl=!1,de=n.memoizedState,y.state=de,wr(n,c,y,f),br();var ve=n.memoizedState;
8$!==Me||de!==ve||vl||t!==null&&t.dependencies!==null&&Kc(t.dependencies)?(typeof Z=="function"&&(uf(n,o,Z,c),ve=n.memoizedState),(je=vl||cx(n,o,je,c,de,ve,ae)||t!==null&&t.dependencies!==null&&Kc(t.dependencies))?(fe||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(c,ve,ae),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(c,ve,ae)),typeof y.componentDidUpdate=="function"&&(n.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof y.componentDidUpdate!="function"||$===t.memoizedProps&&de===t.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||$===t.memoizedProps&&de===t.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=ve),y.props=c,y.state=ve,y.context=ae,c=je):(typeof y.componentDidUpdate!="function"||$===t.memoizedProps&&de===t.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||$===t.memoizedProps&&de===t.memoizedState||(n.flags|=1024),c=!1)}return y=c,ci(t,n),c=(n.flags&128)!==0,y||c?(y=n.stateNode,o=c&&typeof o.getDerivedStateFromError!="function"?null:y.render(),n.flags|=1,t!==null&&c?(n.child=fo(n,t.child,null,f),n.child=fo(n,null,o,f)):vn(t,n,o,f),n.memoizedState=y.state,t=n.child):t=tl(t,n,f),t}function Sx(t,n,o,c){return so(),n.flags|=256,vn(t,n,o,c),n.child}var pf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gf(t){return{baseLanes:t,cachePool:my()}}function yf(t,n,o){return t=t!==null?t.childLanes&~o:0,n&&(t|=ba),t}function Cx(t,n,o){var c=n.pendingProps,f=!1,y=(n.flags&128)!==0,$;if(($=y)||($=t!==null&&t.memoizedState===null?!1:(An.current&2)!==0),$&&(f=!0,n.flags&=-129),$=(n.flags&32)!==0,n.flags&=-33,t===null){if(ft){if(f?Nl(n):kl(),(t=Yt)?(t=Zv(t,Ua),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:ml!==null?{id:js,overflow:Ns}:null,retryLane:536870912,hydrationErrors:null},o=ly(t),o.return=n,n.child=o,kn=n,Yt=null)):t=null,t===null)throw gl(n);return gm(t)?n.lanes=32:n.lanes=536870912,null}return y=c.children,c=c.fallback,f?(kl(),f=n.mode,y=gu({mode:"hidden",children:y},f),c=ao(c,f,o,null),y.return=n,c.return=n,y.sibling=c,n.child=y,c=n.child,c.memoizedState=gf(o),c.childLanes=yf(t,$,o),n.memoizedState=pf,Cr(null,c)):(Nl(n),xf(n,y))}var Z=t.memoizedState;if(Z!==null){var ae=Z.dehydrated;if(ae!==null)return Yk(t,n,y,$,c,ae,Z,o)}return f?(kl(),f=c.fallback,y=n.mode,Z=t.child,ae=Z.sibling,c=Fs(Z,{mode:"hidden",children:c.children}),c.subtreeFlags=Z.subtreeFlags&1206910976,ae!==null?f=Fs(ae,f):(f=ao(f,y,o,null),f.flags|=2),f.return=n,c.return=n,c.sibling=f,n.child=c,Cr(null,c),c=n.child,f=t.child.memoizedState,f===null?f=gf(o):(y=f.cachePool,y!==null?(Z=hn._currentValue,y=y.parent!==Z?{parent:Z,pool:Z}:y):y=my(),f={baseLanes:f.baseLanes|o,cachePool:y}),c.memoizedState=f,c.childLanes=yf(t,$,o),n.memoizedState=pf,Cr(t.child,c)):(Nl(n),o=t.child,t=o.sibling,o=Fs(o,{mode:"visible",children:c.children}),o.return=n,o.sibling=null,t!==null&&($=n.deletions,$===null?(n.deletions=[t],n.flags|=16):$.push(t)),n.child=o,n.memoizedState=null,o)}function xf(t,n){return n=gu({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function gu(t,n){return t=ca(22,t,null,n),t.lanes=0,t}function yu(t,n,o){return fo(n,t.child,null,o),t=xf(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Yk(t,n,o,c,f,y,$,Z){if(o)return n.flags&256?(Nl(n),n.flags&=-257,yu(t,n,Z)):n.memoizedState!==null?(kl(),n.child=t.child,n.flags|=128,null):(kl(),y=f.fallback,$=n.mode,f=gu({mode:"visible",children:f.children},$),y=ao(y,$,Z,null),y.flags|=2,f.return=n,y.return=n,f.sibling=y,n.child=f,fo(n,t.child,null,Z),f=n.child,f.memoizedState=gf(Z),f.childLanes=yf(t,c,Z),n.memoizedState=pf,Cr(null,f));if(Nl(n),gm(y)){if(c=y.nextSibling&&y.nextSibling.dataset,c)var ae=c.dgst;return c=ae,c!==""&&(f=Error(i(419)),f.stack="",f.digest=c,mr({value:f,source:null,stack:null})),yu(t,n,Z)}if(mn||oo(t,n,Z,!1),c=(Z&t.childLanes)!==0,mn||c){if(jl.current!==null)return yu(t,n,Z);if(c=Ut,c!==null&&(f=Za(c,Z),f!==0&&f!==$.retryLane))throw $.retryLane=f,no(t,f),fa(c,t,f),ff;return pm(y)||zu(),yu(t,n,Z)}return pm(y)?(n.flags|=192,n.child=t.child,null):(t=$.treeContext,Yt=Ba(y.nextSibling),kn=n,ft=!0,pl=null,Ua=!1,t!==null&&ry(n,t),n=xf(n,f.children),n.flags|=134221824,n)}function Ex(t,n,o){t.lanes|=n;var c=t.alternate;c!==null&&(c.lanes|=n),Fc(t.return,n,o)}function Tx(t){for(var n=null;t!==null;){var o=t.alternate;o!==null&&su(o)===null&&(n=t),t=t.sibling}return n}function xu(t,n,o,c,f,y){var $=t.memoizedState;$===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:f,treeForkCount:y}
8:($.isBackwards=n,$.rendering=null,$.renderingStartTime=0,$.last=c,$.tail=o,$.tailMode=f,$.treeForkCount=y)}function vf(t){var n=t.child;for(t.child=null;n!==null;){var o=n.sibling;n.sibling=t.child,t.child=n,n=o}}function bf(t,n,o){var c=n.pendingProps,f=c.revealOrder,y=c.tail;c=c.children;var $=An.current;if(n.flags&128)return jr(n,$),null;var Z=($&2)!==0;if(Z?($=$&1|2,n.flags|=128):$&=1,jr(n,$),f==="backwards"&&t!==null?(vf(t),vn(t,n,c,o),vf(t)):vn(t,n,c,o),c=ft?fr:0,!Z&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Ex(t,o,n);else if(t.tag===19)Ex(t,o,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(f){case"backwards":o=Tx(n.child),o===null?(f=n.child,n.child=null):(f=o.sibling,o.sibling=null,vf(n)),xu(n,!0,f,null,y,c);break;case"unstable_legacy-backwards":for(o=null,f=n.child,n.child=null;f!==null;){if(t=f.alternate,t!==null&&su(t)===null){n.child=f;break}t=f.sibling,f.sibling=o,o=f,f=t}xu(n,!0,o,null,y,c);break;case"together":xu(n,!1,null,null,void 0,c);break;case"independent":n.memoizedState=null;break;default:o=Tx(n.child),o===null?(f=n.child,n.child=null):(f=o.sibling,o.sibling=null),xu(n,!1,f,o,y,c)}return n.child}function Mx(t,n,o){var c=n.pendingProps;return yl(n,n.type,c.value),vn(t,n,c.children,o),n.child}function tl(t,n,o){if(t!==null&&(n.dependencies=t.dependencies),Tl|=n.lanes,(o&n.childLanes)===0)if(t!==null){if(oo(t,n,o,!1),(o&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(i(153));if(n.child!==null){for(t=n.child,o=Fs(t,t.pendingProps),n.child=o,o.return=n;t.sibling!==null;)t=t.sibling,o=o.sibling=Fs(t,t.pendingProps),o.return=n;o.sibling=null}return n.child}function wf(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Kc(t)))}function Vk(t,n,o){switch(n.tag){case 3:Ee(n,n.stateNode.containerInfo),yl(n,hn,t.memoizedState.cache),so();break;case 27:case 5:Ke(n);break;case 4:Ee(n,n.stateNode.containerInfo);break;case 10:yl(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,qh(n),null;break;case 13:var c=n.memoizedState;if(c!==null){if(c.dehydrated!==null)return Nl(n),n.flags|=128,null;c=oo(t,n,o,!1);var f=n.child.childLanes;return c||(o&f)!==0?Cx(t,n,o):(Nl(n),t=tl(t,n,o),t!==null?t.sibling:null)}Nl(n);break;case 19:if(n.flags&128)return bf(t,n,o);if(f=(t.flags&128)!==0,c=(o&n.childLanes)!==0,c||(oo(t,n,o,!1),c=(o&n.childLanes)!==0),f){if(c)return bf(t,n,o);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),jr(n,An.current),c)break;return null;case 22:return n.lanes=0,bx(t,n,o,n.pendingProps);case 24:yl(n,hn,t.memoizedState.cache)}return tl(t,n,o)}function Dx(t,n,o){if(t!==null)if(t.memoizedProps!==n.pendingProps)mn=!0;else{if(!wf(t,o)&&(n.flags&128)===0)return mn=!1,Vk(t,n,o);mn=(t.flags&131072)!==0}else mn=!1,ft&&(n.flags&1048576)!==0&&iy(n,fr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var c=n.pendingProps;if(t=uo(n.elementType),n.type=t,typeof t=="function")Eh(t)?(c=po(t,c),n.tag=1,n=kx(null,n,t,c,o)):(n.tag=0,n=mf(null,n,t,c,o));else{if(t!=null){var f=t.$$typeof;if(f===I){n.tag=11,n=yx(null,n,t,c,o);break e}else if(f===H){n.tag=14,n=xx(null,n,t,c,o);break e}else if(f===V){n.tag=10,n.type=t,n=Mx(null,n,o);break e}}throw n=K(t)||t,Error(i(306,n,""))}}return n;case 0:return mf(t,n,n.type,n.pendingProps,o);case 1:return c=n.type,f=po(c,n.pendingProps),kx(t,n,c,f,o);case 3:e:{if(Ee(n,n.stateNode.containerInfo),t===null)throw Error(i(387));c=n.pendingProps;var y=n.memoizedState;f=y.element,Hh(t,n),wr(n,c,null,o);var $=n.memoizedState;if(c=$.cache,yl(n,hn,c),c!==y.cache&&Ih(n,[hn],o,!0),br(),c=$.element,y.isDehydrated)if(y={element:c,isDehydrated:!1,cache:$.cache},n.updateQueue.baseState=y,n.memoizedState=y,n.flags&256){n=Sx(t,n,c,o);break e}else if(c!==f){f=Ra(Error(i(424)),n),mr(f),n=Sx(t,n,c,o);break e}else for(t=n.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,Yt=Ba(t.firstChild),kn=n,ft=!0,pl=null,Ua=!0,o=by(n,null,c,o),n.child=o;o;)o.flags=o.flags&-3|134221824,o=o.sibling;else{if(so(),c===f){n=tl(t,n,o);break e}vn(t,n,c,o)}n=n.child}return n;case 26:return ci(t,n),t===null?(o=t0(n.type,null,n.pendingProps,null))?n.memoizedState=o:ft||(n.stateNode=Iv(n.type,n.pendingProps,te.current,n)):n.memoizedState=t0(n.t
vendor: 1,636 bytes, line 8
8ype,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return Ke(n),t===null&&ft&&(c=n.stateNode=Qv(n.type,n.pendingProps,te.current),kn=n,Ua=!0,f=Yt,Ol(n.type)?(ym=f,Yt=Ba(c.firstChild)):Yt=f),vn(t,n,n.pendingProps.children,o),ci(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&ft&&((f=c=Yt)&&(c=LS(c,n.type,n.pendingProps,Ua),c!==null?(n.stateNode=c,kn=n,Yt=Ba(c.firstChild),Ua=!1,f=!0):f=!1),f||gl(n)),Ke(n),f=n.type,y=n.pendingProps,$=t!==null?t.memoizedProps:null,c=y.children,rm(f,y)?c=null:$!==null&&rm(f,$)&&(n.flags|=32),n.memoizedState!==null&&(f=Zh(t,n,Ak,null,null,o),Ei._currentValue=f),ci(t,n),vn(t,n,c,o),n.child;case 6:return t===null&&ft&&((t=o=Yt)&&(o=US(o,n.pendingProps,Ua),o!==null?(n.stateNode=o,kn=n,Yt=null,t=!0):t=!1),t||gl(n)),null;case 13:return Cx(t,n,o);case 4:return Ee(n,n.stateNode.containerInfo),c=n.pendingProps,t===null?n.child=fo(n,null,c,o):vn(t,n,c,o),n.child;case 11:return yx(t,n,n.type,n.pendingProps,o);case 7:return c=n.pendingProps,ci(t,n),vn(t,n,c,o),n.child;case 8:return vn(t,n,n.pendingProps.children,o),n.child;case 12:return vn(t,n,n.pendingProps.children,o),n.child;case 10:return Mx(t,n,o);case 9:return f=n.type._context,c=n.pendingProps.children,io(n),f=_n(f),c=c(f),n.flags|=1,vn(t,n,c,o),n.child;case 14:return xx(t,n,n.type,n.pendingProps,o);case 15:return vx(t,n,n.type,n.pendingProps,o);case 19:return bf(t,n,o);case 31:return Pk(t,n,o);case 22:return bx(t,n,o,n.pendingProps);case 24:return io(n),c=_n(hn),t===null?(f=$h(),f===null&&(f=Ut,y=zh(),f.pooledCache=y,y.refCount++,y!==null&&(f.pooledCacheLanes|=o),f=y),n.memoizedState={parent:c,cache:f}
8,Uh(n),yl(n,hn,f)):((t.lanes&o)!==0&&(Hh(t,n),wr(n,null,null,o),br()),f=t.memoizedState,y=n.memoizedState,f.parent!==c?(f={parent:c,cache:c},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),yl(n,hn,c)):(c=y.cache,yl(n,hn,c),c!==f.cache&&Ih(n,[hn],o,!0))),vn(t,n,n.pendingProps.children,o),n.child;case 30:return n.stateNode===null&&(n.stateNode={autoName:null,paired:null,clones:null,ref:null}),c=n.pendingProps,c.name!=null&&c.name!=="auto"?n.flags|=t===null?18882560:18874368:ft&&Xc(n),t!==null&&t.memoizedProps.name!==c.name?n.flags|=4194816:ci(t,n),vn(t,n,c.children,o),n.child;case 29:throw n.pendingProps}throw Error(i(156,n.tag))}function nl(t){t.flags|=4}function jf(t,n,o,c,f){var y;if((y=(t.mode&32)!==0)&&(y=o===null?l0(n,c):l0(n,c)&&(c.src!==o.src||c.srcSet!==o.srcSet)),y){if(t.flags|=16777216,(f&335544128)===f)if(t.stateNode.complete)t.flags|=8192;else if(dv())t.flags|=8192;else throw ho=eu,Lh}else t.flags&=-16777217}function _x(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!o0(n))if(dv())t.flags|=8192;else throw ho=eu,Lh}function vu(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Xa():536870912,t.lanes|=n,mi|=n)}function Er(t,n){if(!ft)switch(t.tailMode){case"visible":break;case"collapsed":for(var o=t.tail,c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null;break;default:for(n=t.tail,o=null;n!==null;)n.alternate!==null&&(o=n),n=n.sibling;o===null?t.tail=null:o.sibling=null}}function Vt(t){var n=t.alternate!==null&&t.alternate.child===t.child,o=0,c=0;if(n)for(var f=t.child;f!==null;)o|=f.lanes|f.childLanes,c|=f.subtreeFlags&1206910976,c|=f.flags&1206910976,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)o|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=c,t.childLanes=o,n}function qk(t,n,o){var c=n.pendingProps;switch(Dh(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vt(n),null;case 1:return Vt(n),null;case 3:return o=n.stateNode,c=null,t!==null&&(c=t.memoizedState.cache),n.memoizedState.cache!==c&&(n.flags|=2048),Ws(hn),Re(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(t===null||t.child===null)&&(ni(n)?nl(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Oh())),Vt(n),null;case 26:var f=n.type,y=n.memoizedState;return t===null?(nl(n),y!==null?(Vt(n),_x(n,y)):(Vt(n),jf(n,f,null,c,o))):y?y!==t.memoizedState?(nl(n),Vt(n),_x(n,y)):(Vt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==c&&nl(n),Vt(n),jf(n,f,t,c,o)),null;case 27:if(mt(n),o=te.current,f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==c&&nl(n);else{if(!c){if(n.stateNode===null)throw Error(i(166));return Vt(n),n.subtreeFlags&=-33554433,null}t=ke.current,ni(n)?cy(n):(t=Qv(f,c,o),n.stateNode=t,nl(n))}return Vt(n),n.subtreeFlags&=-33554433,null;case 5:if(mt(n),f=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==c&&nl(n);else{if(!c){if(n.stateNode===null)throw Error(i(166));return Vt(n),n.subtreeFlags&=-33554433,null}if(y=ke.current,ni(n))cy(n);else{var $=Lr(te.current);switch(y){case 1:y=$.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:y=$.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":y=$.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":y=$.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":y=$.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof c.is=="string"?$.createElement("select",{is:c.is}):$.createElement("select"),c.multiple?y.multiple=!0:c.size&&(y.size=c.size);break;default:y=typeof c.is=="string"?$.createElement(f,{is:c.is}):$.createElement(f)}}y[ot]=n,y[ht]=c;e:for($=n.child;$!==null;){if($.tag===5||$.tag===6)y.appendChild($.stateNode);else if($.tag!==4&&$.tag!==27&&$.child!==null){$.child.return=$,$=$.child;continue}if($===n)break e;for(;$.sibling===null;){if($.return===null||$.return===n)break e;$=$.return}$.sibling.return=$.return,$=$.sibling}n.stateNode=y;e:switch(zn(y,f,c),f){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}
8c&&nl(n)}}return Vt(n),n.subtreeFlags&=-33554433,jf(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,o),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==c&&nl(n);else{if(typeof c!="string"&&n.stateNode===null)throw Error(i(166));if(t=te.current,ni(n)){if(t=n.stateNode,o=n.memoizedProps,c=null,f=kn,f!==null)switch(f.tag){case 27:case 5:c=f.memoizedProps}t[ot]=n,t=!!(t.nodeValue===o||c!==null&&c.suppressHydrationWarning===!0||Dv(t.nodeValue,o)),t||gl(n,!0)}else t=Lr(t).createTextNode(c),t[ot]=n,n.stateNode=t}return Vt(n),null;case 31:if(o=n.memoizedState,t===null||t.memoizedState!==null){if(c=ni(n),o!==null){if(t===null){if(!c)throw Error(i(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[ot]=n}else so(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Vt(n),t=!1}else o=Oh(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),t=!0;if(!t)return n.flags&256?(ya(n),n):(ya(n),null);if((n.flags&128)!==0)throw Error(i(558))}return Vt(n),null;case 13:if(c=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=ni(n),c!==null&&c.dehydrated!==null){if(t===null){if(!f)throw Error(i(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[ot]=n}else so(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Vt(n),f=!1}else f=Oh(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(ya(n),n):(ya(n),null)}return ya(n),(n.flags&128)!==0?(n.lanes=o,n):(o=c!==null,t=t!==null&&t.memoizedState!==null,o&&(c=n.child,f=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(f=c.alternate.memoizedState.cachePool.pool),y=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(y=c.memoizedState.cachePool.pool),y!==f&&(c.flags|=2048)),o!==t&&o&&(n.child.flags|=8192),vu(n,n.updateQueue),Vt(n),null);case 4:return Re(),t===null&&am(n.stateNode.containerInfo),n.flags|=67108864,Vt(n),null;case 10:return Ws(n.type),Vt(n),null;case 19:if(Gh(n),c=n.memoizedState,c===null)return Vt(n),null;if(f=(n.flags&128)!==0,y=c.rendering,y===null)if(f)Er(c,!1);else{if(nn!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(y=su(t),y!==null){for(n.flags|=128,Er(c,!1),t=y.updateQueue,n.updateQueue=t,vu(n,t),n.subtreeFlags=0,t=o,o=n.child;o!==null;)sy(o,t),o=o.sibling;return jr(n,An.current&1|2),ft&&Ks(n,c.treeForkCount),n.child}t=t.sibling}c.tail!==null&&qt()>_u&&(n.flags|=128,f=!0,Er(c,!1),n.lanes=4194304)}else{if(!f)if(t=su(y),t!==null){if(n.flags|=128,f=!0,t=t.updateQueue,n.updateQueue=t,vu(n,t),Er(c,!0),c.tail===null&&c.tailMode!=="collapsed"&&c.tailMode!=="visible"&&!y.alternate&&!ft)return Vt(n),null}else 2*qt()-c.renderingStartTime>_u&&o!==536870912&&(n.flags|=128,f=!0,Er(c,!1),n.lanes=4194304);c.isBackwards?(y.sibling=n.child,n.child=y):(t=c.last,t!==null?t.sibling=y:n.child=y,c.last=y)}if(c.tail!==null){t=c.tail;e:{for(o=t;o!==null;){if(o.alternate!==null){o=!1;break e}o=o.sibling}o=!0}return c.rendering=t,c.tail=t.sibling,c.renderingStartTime=qt(),t.sibling=null,y=An.current,y=f?y&1|2:y&1,c.tailMode==="visible"||c.tailMode==="collapsed"||!o||ft?jr(n,y):(o=y,_e(On,n),_e(An,o),Pn===null&&(Pn=n)),ft&&Ks(n,c.treeForkCount),t}return Vt(n),null;case 22:case 23:return ya(n),Vh(),c=n.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(n.flags|=8192):c&&(n.flags|=8192),c?(o&536870912)!==0&&(n.flags&128)===0&&(Vt(n),n.subtreeFlags&6&&(n.flags|=8192)):Vt(n),o=n.updateQueue,o!==null&&vu(n,o.retryQueue),o=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),c=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),c!==o&&(n.flags|=2048),t!==null&&me(co),null;case 24:return o=null,t!==null&&(o=t.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),Ws(hn),Vt(n),null;case 25:return null;case 30:return n.flags|=33554432,Vt(n),null}throw Error(i(156,n.tag))}function Gk(t,n){switch(Dh(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Ws(hn),Re(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return mt(n),null;case 31:if(n.memoizedState!==null){if(ya(n),n.alternate===null)throw Error(i(340));so()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(ya(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(i(340));so()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return Gh(n),t=n.flags,t&65536?(n.flags=t&-65537|128,t=n.memoizedState,t!==null&&(t.rendering=null,t.tail
8=null),n.flags|=4,n):null;case 4:return Re(),null;case 10:return Ws(n.type),null;case 22:case 23:return ya(n),Vh(),t!==null&&me(co),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return Ws(hn),null;case 25:return null;default:return null}}function Ox(t,n){switch(Dh(n),n.tag){case 3:Ws(hn),Re();break;case 26:case 27:case 5:mt(n);break;case 4:Re();break;case 31:n.memoizedState!==null&&ya(n);break;case 13:ya(n);break;case 19:Gh(n);break;case 10:Ws(n.type);break;case 22:case 23:ya(n),Vh(),t!==null&&me(co);break;case 24:Ws(hn)}}function Tr(t,n){try{var o=n.updateQueue,c=o!==null?o.lastEffect:null;if(c!==null){var f=c.next;o=f;do{if((o.tag&t)===t){c=void 0;var y=o.create,$=o.inst;c=y(),$.destroy=c}o=o.next}while(o!==f)}}catch(Z){It(n,n.return,Z)}}function Sl(t,n,o){try{var c=n.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var y=f.next;c=y;do{if((c.tag&t)===t){var $=c.inst,Z=$.destroy;if(Z!==void 0){$.destroy=void 0,f=n;var ae=o,fe=Z;try{fe()}catch(je){It(f,ae,je)}}}c=c.next}while(c!==y)}}catch(je){It(n,n.return,je)}}function Ax(t){var n=t.updateQueue;if(n!==null){var o=t.stateNode;try{jy(n,o)}catch(c){It(t,t.return,c)}}}function Ix(t,n,o){o.props=po(t.type,t.memoizedProps),o.state=t.memoizedState;try{o.componentWillUnmount()}catch(c){It(t,n,c)}}function ks(t,n){try{var o=t.ref;if(o!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:var f=t.stateNode,y=Xs(t.memoizedProps,f);(f.ref===null||f.ref.name!==y)&&(f.ref=Bv(y)),c=f.ref;break;case 7:if(t.stateNode===null){var $=new ja(t);m(t.child,!1,RS,$,void 0,void 0),t.stateNode=$}c=t.stateNode;break;default:c=t.stateNode}typeof o=="function"?t.refCleanup=o(c):o.current=c}}catch(Z){It(t,n,Z)}}function In(t,n){var o=t.ref,c=t.refCleanup;if(o!==null)if(typeof c=="function")try{c()}catch(f){It(t,n,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(f){It(t,n,f)}else o.current=null}function bu(t,n){if((t.tag===5||t.tag===27||t.tag===6)&&t.alternate===null&&n!==null)for(var o=0;o<n.length;o++)Xv(t.stateNode,n[o])}function zx(t){for(var n=t.return;n!==null&&(kf(n)&&Xv(t.stateNode,n.stateNode),!Nf(n));)n=n.return}function Mr(t){for(var n=t.return;n!==null&&(kf(n)&&$S(t.stateNode,n.stateNode),!Nf(n));)n=n.return}function Nf(t){return t.tag===5||t.tag===3||t.tag===27}function kf(t){return t&&t.tag===7&&t.stateNode!==null}function Sf(t){var n=t.type,o=t.memoizedProps,c=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":o.autoFocus&&c.focus();break e;case"img":o.src?c.src=o.src:o.srcSet&&(c.srcset=o.srcSet)}}catch(f){It(t,t.return,f)}}function Cf(t,n,o){try{var c=t.stateNode;xS(c,t.type,o,n),c[ht]=n}catch(f){It(t,t.return,f)}}function Rx(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ol(t.type)||t.tag===4}function Ef(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Rx(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ol(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Tf(t,n,o,c){var f=t.tag;if(f===5||f===6)f=t.stateNode,n?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(f,n):(n=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,n.appendChild(f),o=o._reactRootContainer,o!=null||n.onclick!==null||(n.onclick=oa)),bu(t,c),Nt=!0;else if(f!==4&&(f===27&&(bu(t,c),c=null,Ol(t.type)&&(o=t.stateNode,n=null)),t=t.child,t!==null))for(Tf(t,n,o,c),t=t.sibling;t!==null;)Tf(t,n,o,c),t=t.sibling}function wu(t,n,o,c){var f=t.tag;if(f===5||f===6)f=t.stateNode,n?o.insertBefore(f,n):o.appendChild(f),bu(t,c),Nt=!0;else if(f!==4&&(f===27&&(bu(t,c),c=null,Ol(t.type)&&(o=t.stateNode)),t=t.child,t!==null))for(wu(t,n,o,c),t=t.sibling;t!==null;)wu(t,n,o,c),t=t.sibling}function $x(t){var n=t.stateNode,o=t.memoizedProps;try{for(var c=t.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);zn(n,c,o),n[ot]=t,n[ht]=o}catch(y){It(t,t.return,y)}}var ju=!1,xa=null;function Lx(t){(t.tag===30||(t.subtreeFlags&33554432)!==0)&&(ju=!0)}var Ss=null;function Ux(){var t=Ss;return Ss=null,t}var ua=0;function ui(t,n,o,c,f){return ua=0,Hx(t.child,n,o,c,f)}function Hx(t,n,o,c,f){for(var y=!1;t!==null;){if(t.tag===5){var $=t.stateNode;if(c!==null){var Z=dm($);c.push(Z),Z.view&&(y=!0)}else y||dm($).view&&(y=!0);ju=!0,Uv($,ua===0?n:n+"_"+ua,o),ua++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&f||Hx(t.child,n,o,c,f)&&(y=!0));t=t.sibling}return y}function Cs(t,n){for(;t!==null;)t.tag===5?Hv(t.stateNode,t.memoizedProps):(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&n||Cs(t.child,n)),t=t.sibling}function Nu(t){if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if((t.tag!==22||t.memoizedState===null)&&(Nu(t),t.tag===30&&(t.flags&18874368)!==0&&t.stateNode.paired)){var n=t.memoizedProps;if(n.name==null||n.name==="auto")throw Error(i(544));var o=n.name;n=Zs(n.default,n.share),n!=="none"&&(ui(t,o,n,null,!1)||Cs(t.child,!1))}t=t.sibling}}function Mf(t,n){if(t.tag===30){var o=t.stateNode,c=t.memoizedProps,f=Xs(c,o),y=Zs(c.default,o.paired?c.share:c.enter);y!=="none"?ui(t,f,y,null,!1)?(Nu(t),o.paired||n||xi(t,c.onEnter)):Cs(t.child,!1):Nu(t)}else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)Mf(t,n),t=t.sibling;else Nu(t)}function Df(t){if(xa!==null&&xa.size!==0){var n=xa;if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if(t.tag!==22||t.memoizedState===null){if(t.tag===30&&(t.flags&18874368)!==0){var o=t.memoizedProps,c=o.name;if(c!=null&&c!=="auto"){var f=n.get(c);if(f!==void 0){var y=Zs(o.default,o.share);if(y!=="none"&&(ui(t,c,y,null,!1)?(y=t.stateNode,f.paired=y,y.paired=f,xi(t,o.onShare)):Cs(t.child,!1)),n.delete(c),n.size===0)break}}}Df(t)}t=t.sibling}}}function _f(t){if(t.tag===30){var n=t.memoizedProps,o=Xs(n,t.stateNode),c=xa!==null?xa.get(o):void 0,f=Zs(n.default,c!==void 0?n.share:n.exit);f!=="none"&&(ui(t,o,f,null,!1)?c!==void 0?(f=t.stateNode,c.paired=f,f.paired=c,xa.delete(o),xi(t,n.onShare)):xi(t,n.onExit):Cs(t.child,!1)),xa!==null&&Df(t)}else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)_f(t),t=t.sibling;else xa!==null&&Df(t)}function Bx(t){for(t=t.child;t!==null;){if(t.tag===30){var n=t.memoizedProps,o=Xs(n,t.stateNode);n=Zs(n.default,n.update),t.flags&=-5,n!=="none"&&ui(t,o,n,t.memoizedState=[],!1)}
8else(t.subtreeFlags&33554432)!==0&&Bx(t);t=t.sibling}}function Of(t){if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if(t.tag!==22||t.memoizedState===null){if(t.tag===30&&(t.flags&18874368)!==0){var n=t.stateNode;n.paired!==null&&(n.paired=null,Cs(t.child,!1))}Of(t)}t=t.sibling}}function ku(t){if(t.tag===30)t.stateNode.paired=null,Cs(t.child,!1),Of(t);else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)ku(t),t=t.sibling;else Of(t)}function Px(t){for(t=t.child;t!==null;)t.tag===30?Cs(t.child,!1):(t.subtreeFlags&33554432)!==0&&Px(t),t=t.sibling}function Af(t,n,o,c,f,y,$){for(var Z=!1;n!==null;){if(n.tag===5){var ae=n.stateNode;if(y!==null&&ua<y.length){var fe=y[ua],je=dm(ae);(fe.view||je.view)&&(Z=!0);var Me;if(Me=(t.flags&4)===0)if(je.clip)Me=!0;else{Me=fe.rect;var de=je.rect;Me=Me.y!==de.y||Me.x!==de.x||Me.height!==de.height||Me.width!==de.width}Me&&(t.flags|=4),je.abs?je=!fe.abs:(fe=fe.rect,je=je.rect,je=fe.height!==je.height||fe.width!==je.width),je&&(t.flags|=32)}else t.flags|=32;(t.flags&4)!==0&&Uv(ae,ua===0?o:o+"_"+ua,f),Z&&(t.flags&4)!==0||(Ss===null&&(Ss=[]),Ss.push(ae,ua===0?c:c+"_"+ua,n.memoizedProps)),ua++}else(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&$?t.flags|=n.flags&32:Af(t,n.child,o,c,f,y,$)&&(Z=!0));n=n.sibling}return Z}function Yx(t,n){for(t=t.child;t!==null;){if(t.tag===30){var o=t.memoizedProps,c=t.stateNode,f=Xs(o,c),y=Zs(o.default,o.update),$;$=t.memoizedState,t.memoizedState=null,c=t;var Z=t.child;ua=0,f=Af(c,Z,f,f,y,$,!1),(t.flags&4)!==0&&f&&xi(t,o.onUpdate)}else(t.subtreeFlags&33554432)!==0&&Yx(t);t=t.sibling}}var Sn=!1,Mt=!1,Es=!1,If=!1,Vx=typeof WeakSet=="function"?WeakSet:Set,Cn=null,Ts=!1,Dr=!1,Su=!1,zf=!1;function Xk(t,n,o){if(t=t.containerInfo,om=Ti,t=Zg(t),bh(t)){if("selectionStart"in t)var c={start:t.selectionStart,end:t.selectionEnd};else e:{c=(c=t.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var y=f.anchorOffset,$=f.focusNode;f=f.focusOffset;try{c.nodeType,$.nodeType}catch{c=null;break e}var Z=0,ae=-1,fe=-1,je=0,Me=0,de=t,ve=null;t:for(;;){for(var Pe;de!==c||y!==0&&de.nodeType!==3||(ae=Z+y),de!==$||f!==0&&de.nodeType!==3||(fe=Z+f),de.nodeType===3&&(Z+=de.nodeValue.length),(Pe=de.firstChild)!==null;)ve=de,de=Pe;for(;;){if(de===t)break t;if(ve===c&&++je===y&&(ae=Z),ve===$&&++Me===f&&(fe=Z),(Pe=de.nextSibling)!==null)break;de=ve,ve=de.parentNode}de=Pe}c=ae===-1||fe===-1?null:{start:ae,end:fe}}else c=null}c=c||{start:0,end:0}}else c=null;for(im={focusedElem:t,selectionRange:c},Ti=!1,o=(o&335544064)===o,Cn=n,n=o?9270:1024;Cn!==null;){if(t=Cn,o&&(c=t.deletions,c!==null))for(y=0;y<c.length;y++)o&&_f(c[y]);if(t.alternate===null&&(t.flags&2)!==0)o&&Lx(t),Cu(o);else{if(t.tag===22){if(c=t.alternate,t.memoizedState!==null){c!==null&&c.memoizedState===null&&o&&_f(c),Cu(o);continue}else if(c!==null&&c.memoizedState!==null){o&&Lx(t),Cu(o);continue}}c=t.child,(t.subtreeFlags&n)!==0&&c!==null?(c.return=t,Cn=c):(o&&Bx(t),Cu(o))}}xa=null}function Cu(t){for(;Cn!==null;){var n=Cn,o=t,c=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 15:break;case 1:if((f&1024)!==0&&c!==null){o=void 0,f=c.memoizedProps,c=c.memoizedState;var y=n.stateNode;try{var $=po(n.type,f);o=y.getSnapshotBeforeUpdate($,c),y.__reactInternalSnapshotBeforeUpdate=o}catch(Z){It(n,n.return,Z)}}break;case 3:if((f&1024)!==0){if(c=n.stateNode.containerInfo,o=c.nodeType,o===9)mm(c);else if(o===1)switch(c.nodeName){case"HEAD":case"HTML":case"BODY":mm(c);break;default:c.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:o&&c!==null&&(o=Xs(c.memoizedProps,c.stateNode),f=n.memoizedProps,f=Zs(f.default,f.update),f!=="none"&&ui(c,o,f,c.memoizedState=[],!0));break;default:if((f&1024)!==0)throw Error(i(163))}if(c=n.sibling,c!==null){c.return=n.return,Cn=c;break}Cn=n.return}}function qx(t,n,o){var c=o.flags;switch(o.tag){case 0:case 11:case 15:Ms(t,o),c&4&&Tr(5,o);break;case 1:if(Ms(t,o),c&4)if(t=o.stateNode,n===null)try{t.componentDidMount()}catch($){It(o,o.return,$)}else{var f=po(o.type,n.memoizedProps);n=n.memoizedState;
8try{t.componentDidUpdate(f,n,t.__reactInternalSnapshotBeforeUpdate)}catch($){It(o,o.return,$)}}c&64&&Ax(o),c&512&&ks(o,o.return);break;case 3:if(Ms(t,o),c&64&&(t=o.updateQueue,t!==null)){if(n=null,o.child!==null)switch(o.child.tag){case 27:case 5:n=o.child.stateNode;break;case 1:n=o.child.stateNode}try{jy(t,n)}catch($){It(o,o.return,$)}}break;case 27:n===null&&c&4&&$x(o);case 26:case 5:Ms(t,o),n===null&&c&4&&Sf(o),c&512&&ks(o,o.return);break;case 12:Ms(t,o);break;case 31:Ms(t,o),c&4&&Fx(t,o);break;case 13:Ms(t,o),c&4&&Kx(t,o),c&64&&(t=o.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(o=lS.bind(null,o),HS(t,o))));break;case 22:if(c=o.memoizedState!==null||Sn,!c){var y=n!==null&&n.memoizedState!==null||Mt;n=Sn,f=Mt,Sn=c,(Mt=y)&&!f?(c=2,(o.subtreeFlags&8772)!==0&&(c|=1),as(t,o,c)):Ms(t,o),Sn=n,Mt=f}break;case 30:Ms(t,o),c&512&&ks(o,o.return);break;case 7:c&512&&ks(o,o.return);default:Ms(t,o)}}function Rf(t,n){for(t=t.child;t!==null;)Gx(t,n),t=t.sibling}function Gx(t,n){switch(t.tag){case 5:case 26:try{var o=t.stateNode;if(n){var c=o.style;typeof c.setProperty=="function"?c.setProperty("display","none","important"):c.display="none"}else{var f=t.stateNode,y=t.memoizedProps.style,$=y!=null&&y.hasOwnProperty("display")?y.display:null;f.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(ae){It(t,t.return,ae)}$f(t,n);break;case 6:try{t.stateNode.nodeValue=n?"":t.memoizedProps,Nt=!0}catch(ae){It(t,t.return,ae)}break;case 18:try{var Z=t.stateNode;n?Lv(Z,!0):Lv(t.stateNode,!1)}catch(ae){It(t,t.return,ae)}break;case 22:case 23:t.memoizedState===null&&Rf(t,n);break;default:Rf(t,n)}}function $f(t,n){if(t.subtreeFlags&67108864)for(t=t.child;t!==null;){e:{var o=t,c=n;switch(o.tag){case 4:Gx(o,c);break e;case 22:o.memoizedState===null&&$f(o,c);break e;default:$f(o,c)}}t=t.sibling}}function Xx(t){var n=t.alternate;n!==null&&(t.alternate=null,Xx(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Pt(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Ft=null,da=!1;function ts(t,n,o){for(o=o.child;o!==null;)Zx(t,n,o),o=o.sibling}function Zx(t,n,o){if(Qt&&typeof Qt.onCommitFiberUnmount=="function")try{Qt.onCommitFiberUnmount(Ta,o)}catch{}switch(o.tag){case 26:Mt||In(o,n),ts(t,n,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&!Mt&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Mt||In(o,n),Mr(o);var c=Ft,f=da;Ol(o.type)&&(Ft=o.stateNode,da=!1),ts(t,n,o),Wv(o.stateNode,o.type,o.memoizedProps),Ft=c,da=f;break;case 5:Mt||In(o,n),Mr(o);case 6:if(o.tag===6&&Mr(o),c=Ft,f=da,Ft=null,ts(t,n,o),Ft=c,da=f,Ft!==null)if(da)try{(Ft.nodeType===9?Ft.body:Ft.nodeName==="HTML"?Ft.ownerDocument.body:Ft).removeChild(o.stateNode),Nt=!0}catch(y){It(o,n,y)}else try{Ft.removeChild(o.stateNode),Nt=!0}catch(y){It(o,n,y)}break;case 18:Ft!==null&&(da?(t=Ft,$v(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,o.stateNode),Mi(t)):$v(Ft,o.stateNode));break;case 4:c=Ft,f=da,Ft=o.stateNode.containerInfo,da=!0,ts(t,n,o),Ft=c,da=f;break;case 0:case 11:case 14:case 15:Sl(2,o,n),Mt||Sl(4,o,n),ts(t,n,o);break;case 1:Mt||(In(o,n),c=o.stateNode,typeof c.componentWillUnmount=="function"&&Ix(o,n,c)),ts(t,n,o);break;case 21:ts(t,n,o);break;case 22:Mt=(c=Mt)||o.memoizedState!==null,ts(t,n,o),Mt=c;break;case 30:In(o,n),ts(t,n,o);break;case 7:Mt||In(o,n),ts(t,n,o);break;default:ts(t,n,o)}}function Fx(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Mi(t)}catch(o){It(n,n.return,o)}}}function Kx(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Mi(t)}catch(o){It(n,n.return,o)}}function Zk(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Vx),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Vx),n;default:throw Error(i(435,t.tag))}}function Eu(t,n){var o=Zk(t);n.forEach(function(c){if(!o.has(c)){o.add(c);var f=oS.bind(null,t,c);c.then(f,f)}})}function Zn(t,n,o){var c=n.deletions;if(c!==null)for(var f=0;f<c.length;f++){var y=c[f],$=t,Z=n,ae=Z;e:for(;ae!==null;){switch(ae.tag){case 27:if(Ol(ae.type)){Ft=ae.stateNode,da=!1;break e}break;case 5:Ft=ae.stateNode,da=!1;break e;case 3:case 4:Ft=ae.stateNode.containerInfo,da=!0;break e}ae=ae.return}if(Ft===null)throw Error(i(160));Zx($,Z,y),Ft=null,da=!1,$=y.alternate,$!==null&&($.return=null),y.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Qx(n,t,o),n=n.sibling}var ns=null;function Qx(t,n,o){var c=t.alternate,f=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(f&4&&(c=t.updateQueue,c=c!==null?c.events:null,c!==null))for(var y=0;y<c.length;y++){var $=c[y];$.ref.impl=$.nextImpl}Zn(n,t,o),Fn(t),f&4&&(Sl(3,t,t.return),Tr(3,t),Sl(5,t,t.return));break;case 1:Zn(n,t,o),Fn(t),f&512&&(Mt||c===null||In(c,c.return)),f&64&&Sn&&(t=t.updateQueue,t!==null&&(n=t.callbacks,n!==null&&(o=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=o===null?n:o.concat(n))));break;case 26:if(y=ns,Zn(n,t,o),Fn(t),f&512&&(Mt||c===null||In(c,c.return)),f&4)if(f=c!==null?c.memoizedState:null,o=t.memoizedState,c===null)if(o===null)if(t.stateNode===null)if(Sn)t.stateNode=Iv(t.type,t.memoizedProps,n.containerInfo,t);else{e:{n=t.type,o=t.memoizedProps,f=y.ownerDocument||y;t:switch(n){case"title":c=f.getElementsByTagName("title")[0],(!c||c[Ot]||c[ot]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=f.createElement(n),f.head.insertBefore(c,f.querySelector("head > title"))),zn(c,n,o),c[ot]=t,Xt(c),n=c;break e;case"link":if(y=s0("link","href",f).get(n+(o.href||""))){for($=0;$<y.length;$++)if(c=y[$],c.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&c.getAttribute("rel")===(o.rel==null?null:o.rel)&&c.getAttribute("title")===(o.title==null?null:o.title)&&
8c.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){y.splice($,1);break t}}c=f.createElement(n),zn(c,n,o),f.head.appendChild(c);break;case"meta":if(y=s0("meta","content",f).get(n+(o.content||""))){for($=0;$<y.length;$++)if(c=y[$],c.getAttribute("content")===(o.content==null?null:""+o.content)&&c.getAttribute("name")===(o.name==null?null:o.name)&&c.getAttribute("property")===(o.property==null?null:o.property)&&c.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&c.getAttribute("charset")===(o.charSet==null?null:o.charSet)){y.splice($,1);break t}}c=f.createElement(n),zn(c,n,o),f.head.appendChild(c);break;default:throw Error(i(468,n))}c[ot]=t,Xt(c),n=c}t.stateNode=n}else Sn||wm(y,t.type,t.stateNode);else t.stateNode=a0(y,o,t.memoizedProps);else f!==o?(f===null?(n=c.stateNode,n===null||Mt||n.parentNode.removeChild(n)):f.count--,o===null?Sn||wm(y,t.type,t.stateNode):a0(y,o,t.memoizedProps)):o===null&&t.stateNode!==null&&Cf(t,t.memoizedProps,c.memoizedProps);break;case 27:Zn(n,t,o),Fn(t),f&512&&(Mt||c===null||In(c,c.return)),c!==null&&f&4&&Cf(t,t.memoizedProps,c.memoizedProps);break;case 5:if(y=Es,Es=!1,Zn(n,t,o),Es=y,Fn(t),f&512&&(Mt||c===null||In(c,c.return)),t.flags&32){n=t.stateNode;try{bs(n,""),Nt=!0}catch(je){It(t,t.return,je)}}f&4&&t.stateNode!=null&&(n=t.memoizedProps,Cf(t,n,c!==null?c.memoizedProps:n)),f&1024&&(If=!0);break;case 6:if(Zn(n,t,o),Fn(t),f&4){if(t.stateNode===null)throw Error(i(162));n=t.memoizedProps,o=t.stateNode;try{o.nodeValue=n,Nt=!0}catch(je){It(t,t.return,je)}}break;case 3:if(Nt=!1,Pu=null,y=ns,ns=Ur(n.containerInfo),Zn(n,t,o),ns=y,Fn(t),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Mi(n.containerInfo)}catch(je){It(t,t.return,je)}If&&(If=!1,Wx(t)),Nt=!1;break;case 4:f=Es,Es=Sn,c=Ki(),y=ns,ns=Ur(t.stateNode.containerInfo),Zn(n,t,o),Fn(t),ns=y,Nt&&Dr&&(Su=!0),Nt=c,Es=f;break;case 12:Zn(n,t,o),Fn(t);break;case 31:Zn(n,t,o),Fn(t),f&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,Eu(t,n)));break;case 13:Zn(n,t,o),Fn(t),t.child.flags&8192&&t.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Du=qt()),f&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,Eu(t,n)));break;case 22:y=t.memoizedState!==null,$=c!==null&&c.memoizedState!==null;var Z=Sn,ae=Mt,fe=Es;Sn=Z||y,Es=fe||y,Mt=ae||$,Zn(n,t,o),Mt=ae,Es=fe,Sn=Z,Fn(t),f&8192&&(n=t.stateNode,n._visibility=y?n._visibility&-2:n._visibility|1,!y||c===null||$||Sn||Mt||(n=$||Mt,o=Sn,c=Mt,Sn=y||Sn,Mt=n,Cl(t,2),Sn=o,Mt=c),!y&&Es||Rf(t,y)),f&4&&(n=t.updateQueue,n!==null&&(o=n.retryQueue,o!==null&&(n.retryQueue=null,Eu(t,o))));break;case 19:Zn(n,t,o),Fn(t),f&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,Eu(t,n)));break;case 30:f&512&&(Mt||c===null||In(c,c.return)),f=Ki(),y=Dr,$=(o&335544064)===o,Z=t.memoizedProps,Dr=$&&Zs(Z.default,Z.update)!=="none",Zn(n,t,o),Fn(t),$&&c!==null&&Nt&&(t.flags|=4),Dr=y,Nt=f;break;case 21:break;case 7:f&512&&(Mt||c===null||In(c,c.return)),c&&c.stateNode!==null&&(c.stateNode._fragmentFiber=t);default:Zn(n,t,o),Fn(t)}}function Fn(t){var n=t.flags;if(n&2){try{for(var o,c=t.return;c!==null;){if(Rx(c)){o=c;break}c=c.return}c=null;for(var f=t.return;f!==null;){if(kf(f)){var y=f.stateNode;c===null?c=[y]:c.push(y)}if(Nf(f))break;f=f.return}var $=c;if(o==null)throw Error(i(160));switch(o.tag){case 27:var Z=o.stateNode,ae=Ef(t);wu(t,ae,Z,$);break;case 5:var fe=o.stateNode;o.flags&32&&(bs(fe,""),o.flags&=-33);var je=Ef(t);wu(t,je,fe,$);break;case 3:case 4:var Me=o.stateNode.containerInfo,de=Ef(t);Tf(t,de,Me,$);break;default:throw Error(i(161))}}catch(ve){It(t,t.return,ve)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Wx(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Wx(n),n.tag===5&&n.flags&1024&&(n=n.stateNode,Ti=!0,n.reset(),Ti=!1),t=t.sibling}}function di(t,n){if(n.subtreeFlags&9270)for(n=n.child;n!==null;)Jx(n,t),n=n.sibling;else Yx(n)}function Jx(t,n){var o=t.alternate;if(o===null)Mf(t,!1);else switch(t.tag){case 3:if(zf=Ts=!1,Ux(),di(n,t),!Ts&&!Su){if(t=Ss,t!==null)for(var c=0;c<t.length;c+=3){o=t[c];var f=t[c+1];Hv(o,t[c+2]),o=o.ownerDocument.documentElement,o!==null&&o.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+f+")"})}t=n.containerInfo,t=t.nodeType===9?t.documentElement:t.ownerDocument.documentElement,t!==null&&t.style.viewTransitionName===""&&(t.style.viewTransitionName="none",t.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),t.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),zf=!0}Ss=null;break;case 5:di(n,t);break;case 4:c=Ts,Ts=!1,di(n,t),Ts&&(Su=!0),Ts=c;break;case 22:t.memoizedState===null&&(o.memoizedState!==null?Mf(t,!1):di(n,t));break;case 30:c=Ts,f=Ux(),Ts=!1,di(n,t),Ts&&(t.flags|=4);var y=t.memoizedProps,$=t.stateNode;n=Xs(y,$),$=Xs(o.memoizedProps,$);var Z=Zs(y.default,y.update);Z==="none"?n=!1:(y=o.memoizedState,o.memoizedState=null,o=t.child,ua=0,n=Af(t,o,n,$,Z,y,!0),ua!==(y===null?0:y.length)&&(t.flags|=32)),(t.flags&4)!==0&&n?(xi(t,t.memoizedProps.onUpdate),Ss=f):f!==null&&(f.push.apply(f,Ss),Ss=f),Ts=(t.flags&32)!==0?!0:c;break;default:di(n,t)}}function Ms(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)qx(t,n.alternate,n),n=n.sibling}function Cl(t,n){for(t=t.child;t!==null;){var o=t,c=n;switch(o.tag){case 0:case 11:case 14:case 15:Sl(4,o,o.return),Cl(o,c);break;case 1:In(o,o.return);var f=o.stateNode;typeof f.componentWillUnmount=="function"&&Ix(o,o.return,f),Cl(o,c);break;case 27:(c&2)!==0&&Wv(o.stateNode,o.type,o.memoizedProps);case 5:In(o,o.return),o.tag!==5&&o.tag!==27||Mr(o),Cl(o,c);break;case 6:Mr(o);break;case 26:In(o,o.return),f=o.stateNode,o.memoizedState!==null||f===null||Mt||f.parentNode.removeChild(f),Cl(o,c);break;case 22:o.memoizedState===null&&Cl(o,c);break;case 30:In(o,o.return),Cl(o,c);break;case 7:In(o,o.return);default:Cl(o,c)}t=t.sibling}}function as(t,n,o){for(o=(n.subtreeFlags&8772)!==0?o:o&-2,n=n.child;n!==null;){var c=n.alternate,f=t,y=n,$=y.flags,Z=(o&1)!==0;switch(y.tag){case 0:case 11:case 15:as(f,y,o),Tr(4,y);break;case 1:if(as(f,y,o),c=y,f=c.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(je){It(c,c.return,je)}if(c=y,f=c.updateQueue,f!==null){var ae=c.stateNode;try{var fe=f.shared.hiddenCallbacks;
8if(fe!==null)for(f.shared.hiddenCallbacks=null,f=0;f<fe.length;f++)wy(fe[f],ae)}catch(je){It(c,c.return,je)}}Z&&$&64&&Ax(y),ks(y,y.return);break;case 27:(o&2)!==0&&$x(y);case 5:y.tag!==5&&y.tag!==27||zx(y),as(f,y,o),Z&&c===null&&$&4&&Sf(y),ks(y,y.return);break;case 6:zx(y);break;case 26:ae=y.stateNode,y.memoizedState!==null||ae===null||Sn||wm(Ur(ae.ownerDocument),y.type,ae),as(f,y,o),Z&&c===null&&$&4&&Sf(y),ks(y,y.return);break;case 12:as(f,y,o);break;case 31:as(f,y,o),Z&&$&4&&Fx(f,y);break;case 13:as(f,y,o),Z&&$&4&&Kx(f,y);break;case 22:y.memoizedState===null&&as(f,y,o),ks(y,y.return);break;case 30:as(f,y,o),ks(y,y.return);break;case 7:ks(y,y.return);default:as(f,y,o)}n=n.sibling}}function Lf(t,n){var o=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==o&&(t!=null&&t.refCount++,o!=null&&pr(o))}function Uf(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&pr(t))}function Ha(t,n,o,c){var f=(o&335544064)===o;if(n.subtreeFlags&(f?10262:10256))for(n=n.child;n!==null;)ev(t,n,o,c),n=n.sibling;else f&&Px(n)}function ev(t,n,o,c){var f=(o&335544064)===o;f&&n.alternate===null&&n.return!==null&&n.return.alternate!==null&&ku(n);var y=n.flags;switch(n.tag){case 0:case 11:case 15:Ha(t,n,o,c),y&2048&&Tr(9,n);break;case 1:Ha(t,n,o,c);break;case 3:Ha(t,n,o,c),f&&zf&&(t=t.containerInfo,t=t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,t.style.viewTransitionName==="root"&&(t.style.viewTransitionName=""),t=t.ownerDocument.documentElement,t!==null&&t.style.viewTransitionName==="none"&&(t.style.viewTransitionName="")),y&2048&&(y=null,n.alternate!==null&&(y=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==y&&(n.refCount++,y!=null&&pr(y)));break;case 12:if(y&2048){Ha(t,n,o,c),y=n.stateNode;try{var $=n.memoizedProps,Z=$.id,ae=$.onPostCommit;typeof ae=="function"&&ae(Z,n.alternate===null?"mount":"update",y.passiveEffectDuration,-0)}catch(fe){It(n,n.return,fe)}}else Ha(t,n,o,c);break;case 31:Ha(t,n,o,c);break;case 13:Ha(t,n,o,c);break;case 23:break;case 22:$=n.stateNode,Z=n.alternate,n.memoizedState!==null?(f&&Z!==null&&Z.memoizedState===null&&ku(Z),$._visibility&2?Ha(t,n,o,c):_r(t,n)):(f&&Z!==null&&Z.memoizedState!==null&&ku(n),$._visibility&2?Ha(t,n,o,c):($._visibility|=2,hi(t,n,o,c,(n.subtreeFlags&10256)!==0||!1))),y&2048&&Lf(Z,n);break;case 24:Ha(t,n,o,c),y&2048&&Uf(n.alternate,n);break;case 30:f&&(y=n.alternate,y!==null&&(Cs(y.child,!0),Cs(n.child,!0))),Ha(t,n,o,c);break;default:Ha(t,n,o,c)}}function hi(t,n,o,c,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var y=t,$=n,Z=o,ae=c,fe=$.flags;switch($.tag){case 0:case 11:case 15:hi(y,$,Z,ae,f),Tr(8,$);break;case 23:break;case 22:var je=$.stateNode;$.memoizedState!==null?je._visibility&2?hi(y,$,Z,ae,f):_r(y,$):(je._visibility|=2,hi(y,$,Z,ae,f)),f&&fe&2048&&Lf($.alternate,$);break;case 24:hi(y,$,Z,ae,f),f&&fe&2048&&Uf($.alternate,$);break;default:hi(y,$,Z,ae,f)}n=n.sibling}}function _r(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var o=t,c=n,f=c.flags;switch(c.tag){case 22:_r(o,c),f&2048&&Lf(c.alternate,c);break;case 24:_r(o,c),f&2048&&Uf(c.alternate,c);break;default:_r(o,c)}n=n.sibling}}var go=8192;function yo(t,n,o){if(t.subtreeFlags&go)for(t=t.child;t!==null;)tv(t,n,o),t=t.sibling}function tv(t,n,o){switch(t.tag){case 26:yo(t,n,o),t.flags&go&&(t.memoizedState!==null?eC(o,ns,t.memoizedState,t.memoizedProps):(t=t.stateNode,(n&335544128)===n&&r0(o,t)));break;case 5:yo(t,n,o),t.flags&go&&(t=t.stateNode,(n&335544128)===n&&r0(o,t));break;case 3:case 4:var c=ns;ns=Ur(t.stateNode.containerInfo),yo(t,n,o),ns=c;break;case 22:t.memoizedState===null&&(c=t.alternate,c!==null&&c.memoizedState!==null?(c=go,go=16777216,yo(t,n,o),go=c):yo(t,n,o));break;case 30:if((t.flags&go)!==0&&(c=t.memoizedProps.name,c!=null&&c!=="auto")){var f=t.stateNode;f.paired=null,xa===null&&(xa=new Map),xa.set(c,f)}yo(t,n,o);break;default:yo(t,n,o)}}function nv(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function Or(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var o=0;o<n.length;o++){var c=n[o];Cn=c,sv(c,t)}nv(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)av(t),t=t.sibling}function av(t){switch(t.tag){case 0:case 11:case 15:Or(t),t.flags&2048&&Sl(9,t,t.return);break;case 3:Or(t);break;case 12:Or(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Tu(t)):Or(t);break;default:Or(t)}}function Tu(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var o=0;o<n.length;o++){var c=n[o];Cn=c,sv(c,t)}nv(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Sl(8,n,n.return),Tu(n);break;case 22:o=n.stateNode,o._visibility&2&&(o._visibility&=-3,Tu(n));break;default:Tu(n)}t=t.sibling}}function sv(t,n){for(;Cn!==null;){var o=Cn;switch(o.tag){case 0:case 11:case 15:Sl(8,o,n);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var c=o.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;
vendor: 5,518 bytes, line 8
8case 24:pr(o.memoizedState.cache)}if(c=o.child,c!==null)c.return=o,Cn=c;else e:for(o=t;Cn!==null;){c=Cn;var f=c.sibling,y=c.return;if(Xx(c),c===o){Cn=null;break e}if(f!==null){f.return=y,Cn=f;break e}Cn=y}}}var Fk={getCacheForType:function(t){var n=_n(hn),o=n.data.get(t);return o===void 0&&(o=t(),n.data.set(t,o)),o},cacheSignal:function(){return _n(hn).controller.signal}},Kk=typeof WeakMap=="function"?WeakMap:Map,Ct=0,Ut=null,xt=null,wt=0,At=0,va=null,El=!1,fi=!1,Hf=!1,al=0,nn=0,Tl=0,xo=0,Mu=0,ba=0,mi=0,Ar=null,ha=null,Bf=!1,Du=0,lv=0,_u=1/0,Ou=null,Ml=null,Wt=0,ss=null,vo=null,Ds=0,Pf=0,Yf=null,ov=null,pi=null,gi=null,yi=null,Ir=0,Au=null;function wa(){return(Ct&2)!==0&&wt!==0?wt&-wt:xe.T!==null?Jf():G()}function iv(){if(ba===0)if((wt&536870912)===0||ft){var t=yn;yn<<=1,(yn&3932160)===0&&(yn=262144),ba=t}else ba=536870912;return t=On.current,t!==null&&(t.flags|=32),ba}function xi(t,n){if(n!=null){var o=t.stateNode,c=o.ref;c===null&&(c=o.ref=Bv(Xs(t.memoizedProps,o))),gi===null&&(gi=[]),gi.push(n.bind(null,c))}}function fa(t,n,o){(t===Ut&&(At===2||At===9)||t.cancelPendingCommit!==null)&&(vi(t,0),Dl(t,wt,ba,!1)),Mn(t,o),((Ct&2)===0||t!==Ut)&&(t===Ut&&((Ct&2)===0&&(xo|=o),nn===4&&Dl(t,wt,ba,!1)),_s(t))}function rv(t,n,o){if((Ct&6)!==0)throw Error(i(327));var c=!o&&(n&127)===0&&(n&t.expiredLanes)===0||Da(t,n),f=c?Jk(t,n):qf(t,n,!0),y=c;do{if(f===0){fi&&!c&&Dl(t,n,0,!1);break}else{if(o=t.current.alternate,y&&!Qk(o)){f=qf(t,n,!1),y=!1;continue}if(f===2){if(y=n,t.errorRecoveryDisabledLanes&y)var $=0;else $=t.pendingLanes&-536870913,$=$!==0?$:$&536870912?536870912:0;if($!==0){n=$;e:{var Z=t;f=Ar;var ae=Z.current.memoizedState.isDehydrated;if(ae&&(vi(Z,$).flags|=256),$=qf(Z,$,!1),$!==2&&$!==6){if(Hf&&!ae){Z.errorRecoveryDisabledLanes|=y,xo|=y,f=4;break e}y=ha,ha=f,y!==null&&(ha===null?ha=y:ha.push.apply(ha,y))}f=$}if(y=!1,f!==2)continue}}if(f===1){vi(t,0),Dl(t,n,0,!0);break}e:{switch(c=t,y=f,y){case 0:case 1:throw Error(i(345));case 4:if((n&4194048)!==n&&(n&62914560)!==n)break;case 6:Dl(c,n,ba,!El);break e;case 2:ha=null;break;case 3:case 5:break;default:throw Error(i(329))}if((n&62914560)===n&&(f=Du+300-qt(),10<f)){if(Dl(c,n,ba,!El),Rt(c,0,!0)!==0)break e;Ds=n,c.timeoutHandle=um(cv.bind(null,c,o,ha,Ou,Bf,n,ba,xo,mi,El,y,"Throttled",-0,0),f);break e}cv(c,o,ha,Ou,Bf,n,ba,xo,mi,El,y,null,-0,0)}}break}while(!0);_s(t)}function cv(t,n,o,c,f,y,$,Z,ae,fe,je,Me,de,ve){t.timeoutHandle=-1;var Pe=n.subtreeFlags,Fe=(y&335544064)===y;if(Me=null,(Fe||Pe&8192||(Pe&16785408)===16785408)&&(Me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:oa},xa=null,tv(n,y,Me),Fe&&(Pe=Me,Fe=t.containerInfo,Fe=(Fe.nodeType===9?Fe:Fe.ownerDocument).__reactViewTransition,Fe!=null&&(Pe.count++,Pe.waitingForViewTransition=!0,Pe=Pr.bind(Pe),Fe.finished.then(Pe,Pe))),Pe=(y&62914560)===y?Du-qt():(y&4194048)===y?lv-qt():0,Pe=tC(Me,Pe),Pe!==null)){Ds=y,t.cancelPendingCommit=Pe(yv.bind(null,t,n,y,o,c,f,$,Z,ae,fe,je,Me,null,de,ve)),Dl(t,y,$,!fe);return}yv(t,n,y,o,c,f,$,Z,ae,fe,je,Me)}function Qk(t){for(var n=t;;){var o=n.tag;if((o===0||o===11||o===15)&&n.flags&16384&&(o=n.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var c=0;c<o.length;c++){var f=o[c],y=f.getSnapshot;f=f.value;try{if(!ga(y(),f))return!1}catch{return!1}}if(o=n.child,n.subtreeFlags&16384&&o!==null)o.return=n,n=o;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Dl(t,n,o,c){n=Ga(t,n),n&=~Mu,n&=~xo,t.suspendedLanes|=n,t.pingedLanes&=~n,c&&(t.warmLanes|=n),c=t.expirationTimes;for(var f=n;0<f;){var y=31-Jt(f),$=1<<y;c[y]=-1,f&=~$}o!==0&&Hs(t,o,n)}function Iu(){return(Ct&6)===0?(zr(0),!1):!0}function Vf(){if(xt!==null){if(At===0)var t=xt.return;else t=xt,Qs=lo=null,Qh(t),li=null,xr=0,t=xt;for(;t!==null;)Ox(t.alternate,t),t=t.return;xt=null}}function vi(t,n){var o=t.timeoutHandle;return o!==-1&&(t.timeoutHandle=-1,wS(o)),o=t.cancelPendingCommit,o!==null&&(t.cancelPendingCommit=null,o()),Ds=0,Vf(),Ut=t,xt=o=Fs(t.current,null),wt=n,At=0,va=null,El=!1,fi=Da(t,n),Hf=!1,mi=ba=Mu=xo=Tl=nn=0,ha=Ar=null,Bf=!1,al=Ga(t,n),Pc(),o}function uv(t,n){rt=null,xe.H=fu,n===si||n===Jc?(n=yy(),At=3):n===Lh?(n=yy(),At=4):At=n===ff?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,va=n,xt===null&&(nn=1,mu(t,Ra(n,t.current)))}function dv(){var t=On.current;return t===null?!0:(wt&4194048)===wt?Pn===null:(wt&62914560)===wt||(wt&536870912)!==0?t===Pn:!1}function hv(){var t=xe.H;return xe.H=fu,t===null?fu:t}function fv(){var t=xe.A;return xe.A=Fk,t}function zu(){nn=4,El||(wt&4194048)!==wt&&On.current!==null||(fi=!0),(Tl&134217727)===0&&(xo&134217727)===0||Ut===null||Dl(Ut,wt,ba,!1)}function qf(t,n,o){var c=Ct;Ct|=2;var f=hv(),y=fv();(Ut!==t||wt!==n)&&(Ou=null,vi(t,n)),n=!1;var $=nn;e:do try{if(At!==0&&xt!==null){var Z=xt,ae=va;switch(At){case 8:Vf(),$=6;break e;case 3:case 2:case 9:case 6:On.current===null&&(n=!0);var fe=At;if(At=0,va=null,bi(t,Z,ae,fe),o&&fi){$=0;break e}break;default:fe=At,At=0,va=null,bi(t,Z,ae,fe)}}Wk(),$=nn;break}catch(je){uv(t,je)}while(!0);return n&&t.shellSuspendCounter++,Qs=lo=null,Ct=c,xe.H=f,xe.A=y,xt===null&&(Ut=null,wt=0,Pc()),$}function Wk(){for(;xt!==null;)mv(xt)}function Jk(t,n){var o=Ct;Ct|=2;var c=hv(),f=fv();Ut!==t||wt!==n?(Ou=null,_u=qt()+500,vi(t,n)):fi=Da(t,n);e:do try{if(At!==0&&xt!==null){n=xt;var y=va;t:switch(At){case 1:At=0,va=null,bi(t,n,y,1);break;case 2:case 9:if(py(y)){At=0,va=null,pv(n);break}
8n=function(){At!==2&&At!==9||Ut!==t||(At=7),_s(t)},y.then(n,n);break e;case 3:At=7;break e;case 4:At=5;break e;case 7:py(y)?(At=0,va=null,pv(n)):(At=0,va=null,bi(t,n,y,7));break;case 5:var $=null;switch(xt.tag){case 26:$=xt.memoizedState;case 5:case 27:var Z=xt;if($?o0($):Z.stateNode.complete){At=0,va=null;var ae=Z.sibling;if(ae!==null)xt=ae;else{var fe=Z.return;fe!==null?(xt=fe,Ru(fe)):xt=null}break t}}At=0,va=null,bi(t,n,y,5);break;case 6:At=0,va=null,bi(t,n,y,6);break;case 8:Vf(),nn=6;break e;default:throw Error(i(462))}}eS();break}catch(je){uv(t,je)}while(!0);return Qs=lo=null,xe.H=c,xe.A=f,Ct=o,xt!==null?0:(Ut=null,wt=0,Pc(),nn)}function eS(){for(;xt!==null&&!ta();)mv(xt)}function mv(t){var n=Dx(t.alternate,t,al);t.memoizedProps=t.pendingProps,n===null?Ru(t):xt=n}function pv(t){var n=t,o=n.alternate;switch(n.tag){case 15:case 0:n=Nx(o,n,n.pendingProps,n.type,void 0,wt);break;case 11:n=Nx(o,n,n.pendingProps,n.type.render,n.ref,wt);break;case 5:Qh(n);var c=n;c===kn&&(ft?(Zc(c),c.tag===5&&c.stateNode!=null&&(Yt=c.stateNode)):(Zc(c),ft=!0));default:Ox(o,n),n=xt=sy(n,al),n=Dx(o,n,al)}t.memoizedProps=t.pendingProps,n===null?Ru(t):xt=n}function bi(t,n,o,c){Qs=lo=null,Qh(n),li=null,xr=0;var f=n.return;try{if(Bk(t,f,n,o,wt)){nn=1,mu(t,Ra(o,t.current)),xt=null;return}}catch(y){if(f!==null)throw xt=f,y;nn=1,mu(t,Ra(o,t.current)),xt=null;return}n.flags&32768?(ft||c===1?t=!0:fi||(wt&536870912)!==0?t=!1:(El=t=!0,(c===2||c===9||c===3||c===6)&&(c=On.current,c!==null&&c.tag===13&&(c.flags|=16384))),gv(n,t)):Ru(n)}function Ru(t){var n=t;do{if((n.flags&32768)!==0){gv(n,El);return}t=n.return;var o=qk(n.alternate,n,al);if(o!==null){xt=o;return}if(n=n.sibling,n!==null){xt=n;return}xt=n=t}while(n!==null);nn===0&&(nn=5)}function gv(t,n){do{var o=Gk(t.alternate,t);if(o!==null){o.flags&=32767,xt=o;return}if(o=t.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!n&&(t=t.sibling,t!==null)){xt=t;return}xt=t=o}while(t!==null);nn=6,xt=null}function yv(t,n,o,c,f,y,$,Z,ae,fe,je,Me){t.cancelPendingCommit=null;do $u();while(Wt!==0);if((Ct&6)!==0)throw Error(i(327));if(n!==null){if(n===t.current)throw Error(i(177));t===Ut&&(xt=Ut=null,wt=0),vo=n,ss=t,Ds=o,Yf=f,ov=c,tS(t,n,o,$,Z,ae,Me)}}function tS(t,n,o,c,f,y,$){var Z=n.lanes|n.childLanes;if(Pf=Z,Z|=Sh,jn(t,o,Z,c,f,y),gi=null,(o&335544064)===o?(yi=Mk(t),c=10262):(yi=null,c=10256),(n.subtreeFlags&c)!==0||(n.flags&c)!==0?(t.callbackNode=null,t.callbackPriority=0,iS(pt,function(){return Ff(),null})):(t.callbackNode=null,t.callbackPriority=0),ju=!1,c=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||c){c=xe.T,xe.T=null,f=Ne.p,Ne.p=2,y=Ct,Ct|=4;try{Xk(t,n,o)}finally{Ct=y,Ne.p=f,xe.T=c}}Wt=1,ju?pi=ES($,t.containerInfo,yi,Gf,Xf,aS,Zf,Ff,nS):(Gf(),Xf(),Zf())}function nS(t){if(Wt!==0){var n=ss.onRecoverableError;n(t,{componentStack:null})}}function aS(){Wt===3&&(Wt=0,Jx(vo,ss),Wt=4)}function Gf(){if(Wt===1){Wt=0;var t=ss,n=vo,o=Ds,c=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||c){c=xe.T,xe.T=null;var f=Ne.p;Ne.p=2;var y=Ct;Ct|=4;try{Dr=Su=!1,Qx(n,t,o),o=im;var $=Zg(t.containerInfo),Z=o.focusedElem,ae=o.selectionRange;if($!==Z&&Z&&Z.ownerDocument&&Xg(Z.ownerDocument.documentElement,Z)){if(ae!==null&&bh(Z)){var fe=ae.start,je=ae.end;if(je===void 0&&(je=fe),"selectionStart"in Z)Z.selectionStart=fe,Z.selectionEnd=Math.min(je,Z.value.length);else{var Me=Z.ownerDocument||document,de=Me&&Me.defaultView||window;if(de.getSelection){var ve=de.getSelection(),Pe=Z.textContent.length,Fe=Math.min(ae.start,Pe),ct=ae.end===void 0?Fe:Math.min(ae.end,Pe);!ve.extend&&Fe>ct&&($=ct,ct=Fe,Fe=$);var he=Gg(Z,Fe),ce=Gg(Z,ct);if(he&&ce&&(ve.rangeCount!==1||ve.anchorNode!==he.node||ve.anchorOffset!==he.offset||ve.focusNode!==ce.node||ve.focusOffset!==ce.offset)){var ye=Me.createRange();ye.setStart(he.node,he.offset),ve.removeAllRanges(),Fe>ct?(ve.addRange(ye),ve.extend(ce.node,ce.offset)):(ye.setEnd(ce.node,ce.offset),ve.addRange(ye))}}}}for(Me=[],ve=Z;ve=ve.parentNode;)ve.nodeType===1&&Me.push({element:ve,left:ve.scrollLeft,top:ve.scrollTop});for(typeof Z.focus=="function"&&Z.focus(),Z=0;Z<Me.length;Z++){var Te=Me[Z];Te.element.scrollLeft=Te.left,Te.element.scrollTop=Te.top}}Ti=!!om,im=om=null}finally{Ct=y,Ne.p=f,xe.T=c}}t.current=n,Wt=2}}function Xf(){if(Wt===2){Wt=0;var t=ss,n=vo,o=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||o){o=xe.T,xe.T=null;var c=Ne.p;Ne.p=2;var f=Ct;Ct|=4;try{qx(t,n.alternate,n)}finally{Ct=f,Ne.p=c,xe.T=o}}Wt=3}}
8function Zf(){if(Wt===4||Wt===3){Wt=0;var t=pi;pi=null,Et();var n=ss,o=vo,c=Ds,f=ov,y=(c&335544064)===c?10262:10256;if((o.subtreeFlags&y)!==0||(o.flags&y)!==0?Wt=5:(Wt=0,vo=ss=null,xv(n,n.pendingLanes)),y=n.pendingLanes,y===0&&(Ml=null),xs(c),o=o.stateNode,Qt&&typeof Qt.onCommitFiberRoot=="function")try{Qt.onCommitFiberRoot(Ta,o,void 0,(o.current.flags&128)===128)}catch{}if(f!==null){o=xe.T,y=Ne.p,Ne.p=2,xe.T=null;try{for(var $=n.onRecoverableError,Z=0;Z<f.length;Z++){var ae=f[Z];$(ae.value,{componentStack:ae.stack})}}finally{xe.T=o,Ne.p=y}}if(f=gi,$=yi,yi=null,f!==null&&(gi=null,$===null&&($=[]),t!==null))for(ae=0;ae<f.length;ae++)o=(0,f[ae])($),o!==void 0&&t.finished.finally(o);(Ds&3)!==0&&$u(),_s(n),y=n.pendingLanes,(c&261930)!==0&&(y&42)!==0?n===Au?Ir++:(Ir=0,Au=n):(Ir=0,Au=null),zr(0)}}function xv(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,pr(n)))}function $u(){return pi!==null&&(pi.skipTransition(),pi=null),Gf(),Xf(),Zf(),Ff()}function Ff(){if(Wt!==5)return!1;var t=ss,n=Pf;Pf=0;var o=xs(Ds),c=xe.T,f=Ne.p;try{Ne.p=32>o?32:o,xe.T=null,o=Yf,Yf=null;var y=ss,$=Ds;if(Wt=0,vo=ss=null,Ds=0,(Ct&6)!==0)throw Error(i(331));var Z=Ct;if(Ct|=4,av(y.current),ev(y,y.current,$,o),Ct=Z,zr(0,!1),Qt&&typeof Qt.onPostCommitFiberRoot=="function")try{Qt.onPostCommitFiberRoot(Ta,y)}catch{}return!0}finally{Ne.p=f,xe.T=c,xv(t,n)}}function vv(t,n,o){n=Ra(o,n),n=hf(t.stateNode,n,2),t=wl(t,n,2),t!==null&&(Mn(t,2),_s(t))}function It(t,n,o){if(t.tag===3)vv(t,t,o);else for(;n!==null;){if(n.tag===3){vv(n,t,o);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Ml===null||!Ml.has(c))){t=Ra(o,t),o=px(2),c=wl(n,o,2),c!==null&&(gx(o,c,n,t),Mn(c,2),_s(c));break}}n=n.return}}function Kf(t,n,o){var c=t.pingCache;if(c===null){c=t.pingCache=new Kk;var f=new Set;c.set(n,f)}else f=c.get(n),f===void 0&&(f=new Set,c.set(n,f));f.has(o)||(Hf=!0,f.add(o),t=sS.bind(null,t,n,o),n.then(t,t))}function sS(t,n,o){var c=t.pingCache;c!==null&&c.delete(n),t.pingedLanes|=t.suspendedLanes&o,t.warmLanes&=~o,Ut===t&&(wt&o)===o&&((nn===4||nn===3&&(wt&62914560)===wt&&300>qt()-Du)&&(Ct&2)===0?vi(t,0):Mu|=o,mi===wt&&(mi=0)),_s(t)}function bv(t,n){n===0&&(n=Xa()),t=no(t,n),t!==null&&(Mn(t,n),_s(t))}function lS(t){var n=t.memoizedState,o=0;n!==null&&(o=n.retryLane),bv(t,o)}function oS(t,n){var o=0;switch(t.tag){case 31:case 13:var c=t.stateNode,f=t.memoizedState;f!==null&&(o=f.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(n),bv(t,o)}function iS(t,n){return gn(t,n)}var wi=null,ji=null,Qf=!1,Lu=!1,Wf=!1,_l=0;function _s(t){t!==ji&&t.next===null&&(ji===null?wi=ji=t:ji=ji.next=t),Lu=!0,Qf||(Qf=!0,cS())}function zr(t,n){if(!Wf&&Lu){Wf=!0;do for(var o=!1,c=wi;c!==null;){if(t!==0){var f=c.pendingLanes;if(f===0)var y=0;else{var $=c.suspendedLanes,Z=c.pingedLanes;y=(1<<31-Jt(42|t)+1)-1,y&=f&~($&~Z),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(o=!0,kv(c,y))}else y=wt,y=Rt(c,c===Ut?y:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(y&3)===0||Da(c,y)||(o=!0,kv(c,y));c=c.next}while(o);Wf=!1}}function rS(){wv()}function wv(){Lu=Qf=!1;var t=0;_l!==0&&bS()&&(t=_l);for(var n=qt(),o=null,c=wi;c!==null;){var f=c.next,y=jv(c,n);y===0?(c.next=null,o===null?wi=f:o.next=f,f===null&&(ji=o)):(o=c,(t!==0||(y&3)!==0)&&(Lu=!0)),c=f}Wt!==0&&Wt!==5||zr(t),_l!==0&&(_l=0)}function jv(t,n){for(var o=t.suspendedLanes,c=t.pingedLanes,f=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var $=31-Jt(y),Z=1<<$,ae=f[$];ae===-1?((Z&o)===0||(Z&c)!==0)&&(f[$]=Gt(Z,n)):ae<=n&&(t.expiredLanes|=Z),y&=~Z}if(n=Ut,o=wt,o=Rt(t,t===n?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c=t.callbackNode,o===0||t===n&&(At===2||At===9)||t.cancelPendingCommit!==null)return c!==null&&c!==null&&ut(c),t.callbackNode=null,t.callbackPriority=0;if((o&3)===0||Da(t,o)){if(n=o&-o,n===t.callbackPriority)return n;switch(c!==null&&ut(c),xs(o)){case 2:case 8:o=Ht;break;case 32:o=pt;break;case 268435456:o=Un;break;default:o=pt}return c=Nv.bind(null,t),o=gn(o,c),t.callbackPriority=n,t.callbackNode=o,n}return c!==null&&c!==null&&ut(c),t.callbackPriority=2,t.callbackNode=null,2}function Nv(t,n){if(Wt!==0&&Wt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var o=t.callbackNode;if($u()&&t.callbackNode!==o)return null;var c=wt;return c=Rt(t,t===Ut?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c===0?null:(rv(t,c,n),jv(t,qt()),t.callbackNode!=null&&t.callbackNode===o?Nv.bind(null,t):null)}function kv(t,n){if($u())return null;
vendor: 11,546 bytes, lines 8-9
8rv(t,n,!0)}function cS(){jS(function(){(Ct&6)!==0?gn(Ln,rS):wv()})}function Jf(){if(_l===0){var t=ro;t===0&&(t=Ma,Ma<<=1,(Ma&261888)===0&&(Ma=256)),_l=t}return _l}function Sv(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:dl(t)}function uS(t,n,o,c,f){if(n==="submit"&&o&&o.stateNode===f){var y=Sv((f[ht]||null).action),$=c.submitter;$&&(n=(n=$[ht]||null)?Sv(n.formAction):$.getAttribute("formAction"),n!==null&&(y=n,$=null));var Z=new Zo("action","action",null,c,f);t.push({event:Z,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(_l!==0){var ae=new FormData(f,$);of(o,{pending:!0,data:ae,method:f.method,action:y},null,ae)}}else typeof y=="function"&&(Z.preventDefault(),ae=new FormData(f,$),of(o,{pending:!0,data:ae,method:f.method,action:y},y,ae))},currentTarget:f}]})}}for(var em=0;em<kh.length;em++){var tm=kh[em],dS=tm.toLowerCase(),hS=tm[0].toUpperCase()+tm.slice(1);es(dS,"on"+hS)}es(Qg,"onAnimationEnd"),es(Wg,"onAnimationIteration"),es(Jg,"onAnimationStart"),es("dblclick","onDoubleClick"),es("focusin","onFocus"),es("focusout","onBlur"),es(wk,"onTransitionRun"),es(jk,"onTransitionStart"),es(Nk,"onTransitionCancel"),es(ey,"onTransitionEnd"),Yn("onMouseEnter",["mouseout","mouseover"]),Yn("onMouseLeave",["mouseout","mouseover"]),Yn("onPointerEnter",["pointerout","pointerover"]),Yn("onPointerLeave",["pointerout","pointerover"]),pa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),pa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),pa("onBeforeInput",["compositionend","keypress","textInput","paste"]),pa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),pa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),pa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Rr="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(" "),fS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Rr));function Cv(t,n){n=(n&4)!==0;for(var o=0;o<t.length;o++){var c=t[o],f=c.event;c=c.listeners;e:{var y=void 0;if(n)for(var $=c.length-1;0<=$;$--){var Z=c[$],ae=Z.instance,fe=Z.currentTarget;if(Z=Z.listener,ae!==y&&f.isPropagationStopped())break e;y=Z,f.currentTarget=fe;try{y(f)}catch(je){Bc(je)}f.currentTarget=null,y=ae}else for($=0;$<c.length;$++){if(Z=c[$],ae=Z.instance,fe=Z.currentTarget,Z=Z.listener,ae!==y&&f.isPropagationStopped())break e;y=Z,f.currentTarget=fe;try{y(f)}catch(je){Bc(je)}f.currentTarget=null,y=ae}}}}function vt(t,n){var o=n[nt];o===void 0&&(o=n[nt]=new Set);var c=t+"__bubble";o.has(c)||(Ev(n,t,2,!1),o.add(c))}function nm(t,n,o){var c=0;n&&(c|=4),Ev(o,t,c,n)}var Uu="_reactListening"+Math.random().toString(36).slice(2);function am(t){if(!t[Uu]){t[Uu]=!0,cl.forEach(function(o){o!=="selectionchange"&&(fS.has(o)||nm(o,!1,t),nm(o,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Uu]||(n[Uu]=!0,nm("selectionchange",!1,n))}}function Ev(t,n,o,c){switch(g0(n)){case 2:var f=lC;break;case 8:f=oC;break;default:f=Nm}o=f.bind(null,n,o,t),f=void 0,!Go||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),c?f!==void 0?t.addEventListener(n,o,{capture:!0,passive:f}):t.addEventListener(n,o,!0):f!==void 0?t.addEventListener(n,o,{passive:f}):t.addEventListener(n,o,!1)}function sm(t,n,o,c,f){var y=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var $=c.tag;if($===3||$===4){var Z=c.stateNode.containerInfo;if(Z===f)break;if($===4)for($=c.return;$!==null;){var ae=$.tag;if((ae===3||ae===4)&&$.stateNode.containerInfo===f)return;$=$.return}for(;Z!==null;){if($=Nn(Z),$===null)return;if(ae=$.tag,ae===5||ae===6||ae===26||ae===27){c=y=$;continue e}Z=Z.parentNode}}c=c.return}qo(function(){var fe=y,je=nr(o),Me=[];e:{var de=ty.get(t);if(de!==void 0){var ve=Zo,Pe=t;switch(t){case"keypress":if(Ql(o)===0)break e;case"keydown":case"keyup":ve=oe;break;case"focusin":Pe="focus",ve=Jl;break;case"focusout":Pe="blur",ve=Jl;break;case"beforeblur":case"afterblur":ve=Jl;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ve=lr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ve=Rc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ve=it;break;case Qg:case Wg:case Jg:ve=hh;break;case ey:ve=Je;break;case"scroll":case"scrollend":ve=Wl;break;case"wheel":ve=ir;break;case"copy":case"cut":case"paste":ve=$c;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ve=De;break;case"submit":ve=ze;break;case"toggle":case"beforetoggle":ve=rk}var Fe=(n&4)!==0,ct=!Fe&&(t==="scroll"||t==="scrollend"),he=Fe?de!==null?de+"Capture":null:de;Fe=[];for(var ce=fe,ye;ce!==null;){var Te=ce;if(ye=Te.stateNode,Te=Te.tag,Te!==5&&Te!==26&&Te!==27||ye===null||he===null||(Te=Ys(ce,he),Te!=null&&Fe.push($r(ce,Te,ye))),ct)break;ce=ce.return}0<Fe.length&&(de=new ve(de,Pe,null,o,je),Me.push({event:de,listeners:Fe}))}}if((n&7)===0){e:{if(ve=t==="mouseover"||t==="pointerover",de=t==="mouseout"||t==="pointerout",ve&&o!==tr&&(Pe=o.relatedTarget||o.fromElement)&&(Nn(Pe)||Pe[Ie]))break e;(de||ve)&&(Pe=je.window===je?je:(ve=je.ownerDocument)?ve.defaultView||ve.parentWindow:window,de?(ve=o.relatedTarget||o.toElement,de=fe,ve=ve?Nn(ve):null,ve!==null&&(ct=u(ve),Fe=ve.tag,ve!==ct||Fe!==5&&Fe!==27&&Fe!==6)&&(ve=null)):(de=null,ve=fe),de!==ve&&(Fe=lr,Te="onMouseLeave",he="onMouseEnter",ce="mouse",(t==="pointerout"||t==="pointerover")&&(Fe=De,Te="onPointerLeave",he="onPointerEnter",ce="pointer"),ct=de==null?Pe:_a(de),ye=ve==null?Pe:_a(ve),Pe=new Fe(Te,ce+"leave",de,o,je),Pe.target=ct,Pe.relatedTarget=ye,Te=null,Nn(je)===fe&&(Fe=new Fe(he,ce+"enter",ve,o,je),Fe.target=ye,Fe.relatedTarget=ct,Te=Fe),ct=Te,Fe=de&&ve?b(de,ve,mS):null,de!==null&&Tv(Me,Pe,de,Fe,!1),ve!==null&&ct!==null&&Tv(Me,ct,ve,Fe,!0)))}e:{if(de=fe?_a(fe):window,ve=de.nodeName&&de.nodeName.toLowerCase(),ve==="select"||ve==="input"&&de.type==="file")var Ze=Hg;else if(Lg(de))if(Bg)Ze=xk;else{Ze=gk;var jt=pk}else ve=de.nodeName,!ve||ve.toLowerCase()!=="input"||de.type!=="checkbox"&&de.type!=="radio"?fe&&Vo(fe.elementType)&&(Ze=Hg):Ze=yk;if(Ze&&(Ze=Ze(t,fe))){Ug(Me,Ze,o,je);break e}jt&&jt(t,de,fe)}switch(jt=fe?_a(fe):window,t){case"focusin":(Lg(jt)||jt.contentEditable==="true")&&(Ko=jt,wh=fe,hr=null);break;case"focusout":hr=wh=Ko=null;break;case"mousedown":jh=!0;break;case"contextmenu":case"mouseup":case"dragend":jh=!1,Fg(Me,o,je);break;case"selectionchange":if(bk)break;case"keydown":case"keyup":Fg(Me,o,je)}var We;if(gh)e:{switch(t){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else Fo?Rg(t,o)&&(tt="onCompositionEnd"):t==="keydown"&&o.keyCode===229&&(tt="onCompositionStart");tt&&(Ag&&o.locale!=="ko"&&(Fo||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&Fo&&(We=Kl()):(Aa=je,Vs="value"in Aa?Aa.value:Aa.textContent,Fo=!0)),jt=Hu(fe,tt),0<jt.length&&(tt=new or(tt,t,null,o,je),Me.push({event:tt,listeners:jt}),We?tt.data=We:(We=$g(o),We!==null&&(tt.data=We)))),(We=uk?dk(t,o):hk(t,o))&&(tt=Hu(fe,"onBeforeInput"),0<tt.length&&(jt=new or("onBeforeInput","beforeinput",null,o,je),Me.push({event:jt,listeners:tt}),jt.data=We)),uS(Me,t,fe,o,je)}Cv(Me,n)})}function $r(t,n,o){return{instance:t,listener:n,currentTarget:o}}function Hu(t,n){for(var o=n+"Capture",c=[];t!==null;){var f=t,y=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||y===null||(f=Ys(t,o),f!=null&&c.unshift($r(t,f,y)),f=Ys(t,n),f!=null&&c.push($r(t,f,y))),t.tag===3)return c;t=t.return}return[]}function mS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Tv(t,n,o,c,f){for(var y=n._reactName,$=[];o!==null&&o!==c;){var Z=o,ae=Z.alternate,fe=Z.stateNode;if(Z=Z.tag,ae!==null&&ae===c)break;Z!==5&&Z!==26&&Z!==27||fe===null||(ae=fe,f?(fe=Ys(o,y),fe!=null&&$.unshift($r(o,fe,ae))):f||(fe=Ys(o,y),fe!=null&&$.push($r(o,fe,ae)))),o=o.return}$.length!==0&&t.push({event:n,listeners:$})}var pS=/\r\n?/g,gS=/\u0000|\uFFFD/g;function Mv(t){return(typeof t=="string"?t:""+t).replace(pS,`
9`).replace(gS,"")}function Dv(t,n){return n=Mv(n),Mv(t)===n}function zt(t,n,o,c,f,y){switch(o){case"children":if(typeof c=="string")n==="body"||n==="textarea"&&c===""||bs(t,c);else if(typeof c=="number"||typeof c=="bigint")n!=="body"&&bs(t,""+c);else return;break;case"className":Bo(t,"class",c);break;case"tabIndex":Bo(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Bo(t,o,c);break;case"style":Zl(t,c,y);return;case"data":if(n!=="object"){Bo(t,"data",c);break}case"src":case"href":if(c===""&&(n!=="a"||o!=="href")){t.removeAttribute(o);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(o);break}c=dl(c),t.setAttribute(o,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(o,"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 y=="function"&&(o==="formAction"?(n!=="input"&&zt(t,n,"name",f.name,f,null),zt(t,n,"formEncType",f.formEncType,f,null),zt(t,n,"formMethod",f.formMethod,f,null),zt(t,n,"formTarget",f.formTarget,f,null)):(zt(t,n,"encType",f.encType,f,null),zt(t,n,"method",f.method,f,null),zt(t,n,"target",f.target,f,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(o);break}c=dl(c),t.setAttribute(o,c);break;case"onClick":c!=null&&(t.onclick=oa);return;case"onScroll":c!=null&&vt("scroll",t);return;case"onScrollEnd":c!=null&&vt("scrollend",t);return;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(o=c.__html,o!=null){if(f.children!=null)throw Error(i(60));y?.__html!==o&&(t.innerHTML=o)}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}o=dl(c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(o,c):t.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInl
9ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(o,""):t.removeAttribute(o);break;case"capture":case"download":c===!0?t.setAttribute(o,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(o,c):t.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(o,c):t.removeAttribute(o);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(o):t.setAttribute(o,c);break;case"popover":vt("beforetoggle",t),vt("toggle",t),Ho(t,"popover",c);break;case"xlinkActuate":Wa(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Wa(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Wa(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Wa(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Wa(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Wa(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Wa(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Wa(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Wa(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Ho(t,"is",c);break;case"innerText":case"textContent":return;default:if(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")o=er.get(o)||o,Ho(t,o,c);else return}Nt=!0}function lm(t,n,o,c,f,y){switch(o){case"style":Zl(t,c,y);return;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(o=c.__html,o!=null){if(f.children!=null)throw Error(i(60));y?.__html!==o&&(t.innerHTML=o)}}break;case"children":if(typeof c=="string")bs(t,c);else if(typeof c=="number"||typeof c=="bigint")bs(t,""+c);else return;break;case"onScroll":c!=null&&vt("scroll",t);return;case"onScrollEnd":c!=null&&vt("scrollend",t);return;case"onClick":c!=null&&(t.onclick=oa);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Uo.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(f=o.endsWith("Capture"),y=o.slice(2,f?o.length-7:void 0),n=t[ht]||null,n=n!=null?n[o]:null,typeof n=="function"&&t.removeEventListener(y,n,f),typeof c=="function")){typeof n!="function"&&n!==null&&(o in t?t[o]=null:t.hasAttribute(o)&&t.removeAttribute(o)),t.addEventListener(y,c,f);break e}Nt=!0,o in t?t[o]=c:c===!0?t.setAttribute(o,""):Ho(t,o,c)}return}Nt=!0}function zn(t,n,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vt("error",t),vt("load",t);var c=!1,f=!1,y;for(y in o)if(o.hasOwnProperty(y)){var $=o[y];if($!=null)switch(y){case"src":c=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:zt(t,n,y,$,o,null)}}f&&zt(t,n,"srcSet",o.srcSet,o,null),c&&zt(t,n,"src",o.src,o,null);return;case"input":vt("invalid",t);var Z=y=$=f=null,ae=null,fe=null;for(c in o)if(o.hasOwnProperty(c)){var je=o[c];if(je!=null)switch(c){case"name":f=je;break;case"type":$=je;break;case"checked":ae=je;break;case"defaultChecked":fe=je;break;case"value":y=je;break;case"defaultValue":Z=je;break;case"children":case"dangerouslySetInnerHTML":if(je!=null)throw Error(i(137,n));break;default:zt(t,n,c,je,o,null)}}Po(t,y,Z,ae,fe,$,f,!1);return;case"select":vt("invalid",t),c=$=y=null;for(f in o)if(o.hasOwnProperty(f)&&(Z=o[f],Z!=null))switch(f){case"value":y=Z;break;case"defaultValue":$=Z;break;case"multiple":c=Z;default:zt(t,n,f,Z,o,null)}n=y,o=$,t.multiple=!!c,n!=null?Ja(t,!!c,n,!1):o!=null&&Ja(t,!!c,o,!0);return;case"textarea":vt("invalid",t),y=f=c=null;for($ in o)if(o.hasOwnProperty($)&&(Z=o[$],Z!=null))switch($){case"value":c=Z;break;case"defaultValue":f=Z;break;case"children":y=Z;break;case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(91));break;default:zt(t,n,$,Z,o,null)}qn(t,c,f,y);return;case"option":for(ae in o)o.hasOwnProperty(ae)&&(c=o[ae],c!=null)&&(ae==="selected"?t.selected=c&&typeof c!="function"&&typeof c!="symbol":zt(t,n,ae,c,o,null));return;case"dialog":vt("beforetoggle",t),vt("toggle",t),vt("cancel",t),vt("close",t);break;case"iframe":case"object":vt("load",t);break;case"video":case"audio":for(c=0;c<Rr.length;c++)vt(Rr[c],t);break;case"image":vt("error",t),vt("load",t);break;case"details":vt("toggle",t);break;case"embed":case"source":case"link":vt("error",t),vt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(fe in o)if(o.hasOwnProperty(fe)&&(c=o[fe],c!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,n));default:zt(t,n,fe,c,o,null)}return;default:if(Vo(n)){for(je in o)o.hasOwnProperty(je)&&(c=o[je],c!==void 0&&lm(t,n,je,c,o,void 0));return}}for(Z in o)o.hasOwnProperty(Z)&&(c=o[Z],c!=null&&zt(t,n,Z,c,o,null))}var yS={};function xS(t,n,o,c){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,y=null,$=null,Z=null,ae=null,fe=null,je=null;for(ve in o){var Me=o[ve];if(o.hasOwnProperty(ve)&&Me!=null)switch(ve){case"checked":break;case"value":break;case"defaultValue":ae=Me;default:c.hasOwnProperty(ve)||zt(t,n,ve,null,c,Me)}}for(var de in c){var ve=c[de];if(Me=o[de],c.hasOwnProperty(de)&&(ve!=null||Me!=null))switch(de){case"type":ve!==Me&&(Nt=!0),y=ve;break;case"name":ve!==Me&&(Nt=!0),f=ve;break;case"checked":ve!==Me&&(Nt=!0),fe=ve;break;case"defaultChecked":ve!==Me&&(Nt=!0),je=ve;break;case"value":ve!==Me&&(Nt=!0),$=ve;break;case"defaultValue":ve!==Me&&(Nt=!0),Z=ve;break;case"children":case"dangerouslySetInnerHTML":if(ve!=null)throw Error(i(137,n));break;default:ve!==Me&&zt(t,n,de,ve,c,Me)}}
9vs(t,$,Z,ae,fe,je,y,f);return;case"select":ve=$=Z=de=null;for(y in o)if(ae=o[y],o.hasOwnProperty(y)&&ae!=null)switch(y){case"value":break;case"multiple":ve=ae;default:c.hasOwnProperty(y)||zt(t,n,y,null,c,ae)}for(f in c)if(y=c[f],ae=o[f],c.hasOwnProperty(f)&&(y!=null||ae!=null))switch(f){case"value":y!==ae&&(Nt=!0),de=y;break;case"defaultValue":y!==ae&&(Nt=!0),Z=y;break;case"multiple":y!==ae&&(Nt=!0),$=y;default:y!==ae&&zt(t,n,f,y,c,ae)}n=Z,o=$,c=ve,de!=null?Ja(t,!!o,de,!1):!!c!=!!o&&(n!=null?Ja(t,!!o,n,!0):Ja(t,!!o,o?[]:"",!1));return;case"textarea":ve=de=null;for(Z in o)if(f=o[Z],o.hasOwnProperty(Z)&&f!=null&&!c.hasOwnProperty(Z))switch(Z){case"value":break;case"children":break;default:zt(t,n,Z,null,c,f)}for($ in c)if(f=c[$],y=o[$],c.hasOwnProperty($)&&(f!=null||y!=null))switch($){case"value":f!==y&&(Nt=!0),de=f;break;case"defaultValue":f!==y&&(Nt=!0),ve=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(i(91));break;default:f!==y&&zt(t,n,$,f,c,y)}ul(t,de,ve);return;case"option":for(var Pe in o)de=o[Pe],o.hasOwnProperty(Pe)&&de!=null&&!c.hasOwnProperty(Pe)&&(Pe==="selected"?t.selected=!1:zt(t,n,Pe,null,c,de));for(ae in c)de=c[ae],ve=o[ae],c.hasOwnProperty(ae)&&de!==ve&&(de!=null||ve!=null)&&(ae==="selected"?(de!==ve&&(Nt=!0),t.selected=de&&typeof de!="function"&&typeof de!="symbol"):zt(t,n,ae,de,c,ve));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 Fe in o)de=o[Fe],o.hasOwnProperty(Fe)&&de!=null&&!c.hasOwnProperty(Fe)&&zt(t,n,Fe,null,c,de);for(fe in c)if(de=c[fe],ve=o[fe],c.hasOwnProperty(fe)&&de!==ve&&(de!=null||ve!=null))switch(fe){case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(i(137,n));break;default:zt(t,n,fe,de,c,ve)}return;default:if(Vo(n)){for(var ct in o)de=o[ct],o.hasOwnProperty(ct)&&de!==void 0&&!c.hasOwnProperty(ct)&&lm(t,n,ct,void 0,c,de);for(je in c)de=c[je],ve=o[je],!c.hasOwnProperty(je)||de===ve||de===void 0&&ve===void 0||lm(t,n,je,de,c,ve);return}}for(var he in o)de=o[he],o.hasOwnProperty(he)&&de!=null&&!c.hasOwnProperty(he)&&zt(t,n,he,null,c,de);for(Me in c)de=c[Me],ve=o[Me],!c.hasOwnProperty(Me)||de===ve||de==null&&ve==null||zt(t,n,Me,de,c,ve)}function _v(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function vS(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,o=performance.getEntriesByType("resource"),c=0;c<o.length;c++){var f=o[c],y=f.transferSize,$=f.initiatorType,Z=f.duration;if(y&&Z&&_v($)){for($=0,Z=f.responseEnd,c+=1;c<o.length;c++){var ae=o[c],fe=ae.startTime;if(fe>Z)break;var je=ae.transferSize,Me=ae.initiatorType;je&&_v(Me)&&(ae=ae.responseEnd,$+=je*(ae<Z?1:(Z-fe)/(ae-fe)))}if(--c,n+=8*(y+$)/(f.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var om=null,im=null;function Lr(t){return t.nodeType===9?t:t.ownerDocument}function Ov(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Av(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function Iv(t,n,o,c){return o=Lr(o).createElement(t),o[ot]=c,o[ht]=n,zn(o,t,n),Xt(o),o}function rm(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var cm=null;function bS(){var t=window.event;return t&&t.type==="popstate"?t===cm?!1:(cm=t,!0):(cm=null,!1)}var um=typeof setTimeout=="function"?setTimeout:void 0,wS=typeof clearTimeout=="function"?clearTimeout:void 0,zv=typeof Promise=="function"?Promise:void 0,Rv=typeof requestAnimationFrame=="function"?requestAnimationFrame:um,jS=typeof queueMicrotask=="function"?queueMicrotask:typeof zv<"u"?function(t){return zv.resolve(null).then(t).cat
9ch(NS)}:um;function NS(t){setTimeout(function(){throw t})}function Ol(t){return t==="head"}function $v(t,n){var o=n,c=0;do{var f=o.nextSibling;if(t.removeChild(o),f&&f.nodeType===8)if(o=f.data,o==="/$"||o==="/&"){if(c===0){t.removeChild(f),Mi(n);return}c--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")c++;else if(o==="html")xm(t.ownerDocument.documentElement);else if(o==="head"){o=t.ownerDocument.head,xm(o);for(var y=o.firstChild;y;){var $=y.nextSibling,Z=y.nodeName;y[Ot]||Z==="SCRIPT"||Z==="STYLE"||Z==="LINK"&&y.rel.toLowerCase()==="stylesheet"||o.removeChild(y),y=$}}else o==="body"&&xm(t.ownerDocument.body);o=f}while(o);Mi(n)}function Lv(t,n){var o=t;t=0;do{var c=o.nextSibling;if(o.nodeType===1?n?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(n?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),c&&c.nodeType===8)if(o=c.data,o==="/$"){if(t===0)break;t--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||t++;o=c}while(o)}function Uv(t,n,o){if(n=CSS.escape(n)!==n?"r-"+btoa(n).replace(/=/g,""):n,t.style.viewTransitionName=n,o!=null&&(t.style.viewTransitionClass=o),o=getComputedStyle(t),o.display==="inline"){if(n=t.getClientRects(),n.length===1)var c=1;else for(var f=c=0;f<n.length;f++){var y=n[f];0<y.width&&0<y.height&&c++}c===1&&(t=t.style,t.display=n.length===1?"inline-block":"block",t.marginTop="-"+o.paddingTop,t.marginBottom="-"+o.paddingBottom)}}function Hv(t,n){t=t.style,n=n.style;var o=n!=null?n.hasOwnProperty("viewTransitionName")?n.viewTransitionName:n.hasOwnProperty("view-transition-name")?n["view-transition-name"]:null:null;t.viewTransitionName=o==null||typeof o=="boolean"?"":(""+o).trim(),o=n!=null?n.hasOwnProperty("viewTransitionClass")?n.viewTransitionClass:n.hasOwnProperty("view-transition-class")?n["view-transition-class"]:null:null,t.viewTransitionClass=o==null||typeof o=="boolean"?"":(""+o).trim(),t.display==="inline-block"&&(n==null?t.display=t.margin="":(o=n.display,t.display=o==null||typeof o=="boolean"?"":o,o=n.margin,o!=null?t.margin=o:(o=n.hasOwnProperty("marginTop")?n.marginTop:n["margin-top"],t.marginTop=o==null||typeof o=="boolean"?"":o,n=n.hasOwnProperty("marginBottom")?n.marginBottom:n["margin-bottom"],t.marginBottom=n==null||typeof n=="boolean"?"":n)))}function kS(t,n,o){return o=o.ownerDocument.defaultView,{rect:t,abs:n.position==="absolute"||n.position==="fixed",clip:n.clipPath!=="none"||n.overflow!=="visible"||n.filter!=="none"||n.mask!=="none"||n.mask!=="none"||n.borderRadius!=="0px",view:0<=t.bottom&&0<=t.right&&t.top<=o.innerHeight&&t.left<=o.innerWidth}}function dm(t){var n=t.getBoundingClientRect(),o=getComputedStyle(t);return kS(n,o,t)}function SS(t){return t.documentElement.clientHeight}function CS(t){this.addEventListener("load",t),this.addEventListener("error",t)}function ES(t,n,o,c,f,y,$,Z,ae){var fe=n.nodeType===9?n:n.ownerDocument;try{var je=fe.startViewTransition({update:function(){var de=fe.defaultView,ve=de.navigation&&de.navigation.transition,Pe=fe.fonts.status;c();var Fe=[];if(Pe==="loaded"&&(SS(fe),fe.fonts.status==="loading"&&Fe.push(fe.fonts.ready)),Pe=Fe.length,t!==null)for(var ct=t.suspenseyImages,he=0,ce=0;ce<ct.length;ce++){var ye=ct[ce];if(!ye.complete){var Te=ye.getBoundingClientRect();if(0<Te.bottom&&0<Te.right&&Te.top<de.innerHeight&&Te.left<de.innerWidth){if(he+=i0(ye),he>Yu){Fe.length=Pe;break}ye=new Promise(CS.bind(ye)),Fe.push(ye)}}}if(0<Fe.length)return de=Promise.race([Promise.all(Fe),new Promise(function(Ze){return setTimeout(Ze,500)})]).then(f,f),(ve?Promise.allSettled([ve.finished,de]):de).then(y,y);if(f(),ve)return ve.finished.then(y,y);y()},types:o});fe.__reactViewTransition=je;var Me=[];return je.ready.then(function(){for(var de=fe.documentElement.getAnimations({subtree:!0}),ve=0;ve<de.length;ve++){var Pe=de[ve],Fe=Pe.effect,ct=Fe.pseudoElement;if(ct!=null&&ct.startsWith("::view-transition")){Me.push(Pe),Pe=Fe.getKeyframes();for(var he=ct=void 0,ce=!0,ye=0;ye<Pe.length;ye++){var Te=Pe[ye],Ze=Te.width;if(ct===void 0)ct=Ze;else if(ct!==Ze){ce=!1;break}if(Ze=Te.height,he===void 0)he=Ze;else if(he!==Ze){ce=!1;break}delete Te.width,delete Te.height,Te.transform==="none"&&delete Te.transform}ce&&ct!==void 0&&he!==void 0&&(Fe.setKeyframes(Pe),ce=getComputedStyle(Fe.target,Fe.pseudoElement),ce.width!==ct||ce.height!==he)&&(ce=Pe[0],ce.width=ct,ce.height=he,ce=Pe[Pe.length-1],ce.width=ct,ce.height=he,Fe.setKeyframes(Pe))}}$()},function(de){fe.__reactViewTransition===je&&(fe.__reactViewTransition=null);try{typeof de=="object"&&de!==null&&de.name==="InvalidStateError"&&(de.message==="View transition was skipped because document visibility state is hidden."||de.message==="Skipping view transition because document visibility state has become hidden."||de.message==="Skipping view transition because viewport size changed."||de.message==="Transition was aborted because of invalid state")&&(de=null),de!==null&&ae(de)}finally{c(),f(),$()}}),je.finished.finally(function(){for(var de=0;de<Me.length;de++)Me[de].cancel();fe.__reactViewTransition===je&&(fe.__reactViewTransition=null),Z()}),je}catch{return c(),f(),$(),null}}function bo(t,n){this._scope=document.documentElement,this._selector="::view-transition-"+t+"("+n+")"}bo.prototype.animate=function(t,n){return n=typeof n=="number"?{duration:n}:A({},n),n.pseudoElement=this._selector,this._scope.animate(t,n)},bo.prototype.getAnimations=function(){for(var t=this._scope,n=this._selector,o=t.getAnimations({subtree:!0}),c=[],f=0;f<o.length;f++){var y=o[f].effect;y!==null&&y.target===t&&y.pseudoElement===n&&c.push(o[f])}return c},bo.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Bv(t){return{name:t,group:new bo("group",t),imagePair:ne
9w bo("image-pair",t),old:new bo("old",t),new:new bo("new",t)}}function ja(t){this._fragmentFiber=t,this._observers=this._eventListeners=null}ja.prototype.addEventListener=function(t,n,o){var c=null,f=null;if(!(o!=null&&typeof o!="boolean"&&(c=o.signal||null,c!==null&&c.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var y=this._eventListeners;if(Yv(y,t,n,o)===-1){var $=this,Z=n;o!=null&&typeof o!="boolean"&&o.once===!0&&(Z=function(ae){$.removeEventListener(t,n,o),typeof n=="function"?n.call(this,ae):n.handleEvent(ae)}),c!==null&&(f=$.removeEventListener.bind($,t,n,o),c.addEventListener("abort",f,{once:!0}),f=c.removeEventListener.bind(c,"abort",f)),c=Ni(o),y.push({type:t,listener:n,optionsOrUseCapture:o,attachedListener:Z,cleanup:f}),m(this._fragmentFiber.child,!1,TS,t,Z,c)}this._eventListeners=y}};function TS(t,n,o,c){return C(t).addEventListener(n,o,c),!1}ja.prototype.removeEventListener=function(t,n,o){var c=this._eventListeners;if(c!==null&&(n=Yv(c,t,n,o),n!==-1)){var f=c[n];o=f.attachedListener;var y=f.cleanup;f=Ni(f.optionsOrUseCapture),m(this._fragmentFiber.child,!1,MS,t,o,f),c.splice(n,1),y!==null&&y()}};function MS(t,n,o,c){return C(t).removeEventListener(n,o,c),!1}function Ni(t){return t!=null&&typeof t!="boolean"&&(t.once===!0||t.signal instanceof AbortSignal)?{capture:t.capture,passive:t.passive}:t}function Pv(t){return t==null?"c=0":typeof t=="boolean"?"c="+(t?"1":"0"):"c="+(t.capture?"1":"0")}function Yv(t,n,o,c){if(t.length===0)return-1;c=Pv(c);for(var f=0;f<t.length;f++){var y=t[f];if(y.type===n&&y.listener===o&&Pv(y.optionsOrUseCapture)===c)return f}return-1}ja.prototype.dispatchEvent=function(t){var n=v(this._fragmentFiber);if(n===null)return!0;n=C(n);var o=this._eventListeners;if(o!==null&&0<o.length||!t.bubbles){var c=n.nodeType===9?n.createComment(""):document.createTextNode("");if(o)for(var f=0;f<o.length;f++){var y=o[f];c.addEventListener(y.type,y.attachedListener,Ni(y.optionsOrUseCapture))}if(n.appendChild(c),t=c.dispatchEvent(t),o)for(f=0;f<o.length;f++)y=o[f],c.removeEventListener(y.type,y.attachedListener,Ni(y.optionsOrUseCapture));return n.removeChild(c),t}return n.dispatchEvent(t)},ja.prototype.focus=function(t){m(this._fragmentFiber.child,!0,Vv,t,void 0,void 0)};function Vv(t,n){return t.tag===6?!1:(t=C(t),BS(t,n))}ja.prototype.focusLast=function(t){var n=[];m(this._fragmentFiber.child,!0,hm,n,void 0,void 0);for(var o=n.length-1;0<=o&&!Vv(n[o],t);o--);};function hm(t,n){return n.push(t),!1}ja.prototype.blur=function(){var t=v(this._fragmentFiber);t!==null&&(t=C(t),t=Lr(t).activeElement,t!==null&&m(this._fragmentFiber.child,!1,DS,t,void 0,void 0))};function DS(t,n){return t.tag===6?!1:(t=C(t),t===n||t.contains(n)?(n.blur(),!0):!1)}ja.prototype.observeUsing=function(t){this._observers===null&&(this._observers=new Set),this._observers.add(t),m(this._fragmentFiber.child,!1,_S,t,void 0,void 0)};function _S(t,n){return t.tag===6||(t=C(t),n.observe(t)),!1}ja.prototype.unobserveUsing=function(t){var n=this._observers;if(n!==null&&n.has(t)){n.delete(t),m(this._fragmentFiber.child,!1,OS,t,void 0,void 0);for(var o=n=0;o<ls.length;o++){var c=ls[o];c.fragmentInstance===this&&c.observer===t?t.unobserve(c.instance):ls[n++]=c}ls.length=n}};function OS(t,n){return t.tag===6||(t=C(t),n.unobserve(t)),!1}var ls=[],fm=!1;function AS(t,n,o){ls.push({fragmentInstance:t,observer:n,instance:o}),fm||(fm=!0,PS(function(){fm=!1;var c=ls;ls=[];for(var f=0;f<c.length;f++){var y=c[f];y.observer.unobserve(y.instance)}}))}ja.prototype.getClientRects=function(){var t=[];return m(this._fragmentFiber.child,!1,IS,t,void 0,void 0),t};function IS(t,n){if(t.tag===6){t=t.stateNode;var o=t.ownerDocument.createRange();o.selectNodeContents(t),n.push.apply(n,o.getClientRects())}else t=C(t),n.push.apply(n,t.getClientRects());return!1}ja.prototype.getRootNode=function(t){var n=v(this._fragmentFiber);return n===null?this:C(n).getRootNode(t)},ja.prototype.compareDocumentPosition=function(t){var n=v(this._fragmentFiber);if(n===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var o=[];m(this._fragmentFiber.child,!1,hm,o,void 0,void 0);var c=C(n);if(o.length===0){if(o=c,k(this._fragmentFiber)){e:{for(n=this._fragmentFiber.return;n!==null;){if(n.tag===4){n=n.stateNode.containerInfo;break e}if(n.tag===3||n.tag===5||n.tag===27)break;n=n.return}n=null}n!=null&&(o=n)}n=this._fragmentFiber;var f=c=o.compareDocumentPosition(t);return o===t?f=Node.DOCUMENT_POSITION_CONTAINS:c&Node.DOCUMENT_POSITION_CONTAINED_BY&&(o=T(n)[1],o===null?f=Node.DOCUMENT_POSITION_PRECEDING:(t=C(o).compareDocumentPosition(t),f=t===0||t&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),f|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}n=C(o[0]),f=C(o[o.length-1]);var y=k(this._fragmentFiber)?n.parentElement:c;
9if(y==null)return Node.DOCUMENT_POSITION_DISCONNECTED;c=y.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_CONTAINED_BY,y=y.compareDocumentPosition(f)&Node.DOCUMENT_POSITION_CONTAINED_BY;var $=n.compareDocumentPosition(t),Z=f.compareDocumentPosition(t),ae=$&Node.DOCUMENT_POSITION_CONTAINED_BY||Z&Node.DOCUMENT_POSITION_CONTAINED_BY;return Z=c&&y&&$&Node.DOCUMENT_POSITION_FOLLOWING&&Z&Node.DOCUMENT_POSITION_PRECEDING,n=c&&n===t||y&&f===t||ae||Z?Node.DOCUMENT_POSITION_CONTAINED_BY:!c&&n===t||!y&&f===t?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:$,n&Node.DOCUMENT_POSITION_DISCONNECTED||n&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||zS(n,this._fragmentFiber,o[0],o[o.length-1],t)?n:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function zS(t,n,o,c,f){var y=Nn(f);if(t&Node.DOCUMENT_POSITION_CONTAINED_BY){if(o=!!y)e:{for(;y!==null;){if(y.tag===7&&(y===n||y.alternate===n)){o=!0;break e}y=y.return}o=!1}return o}if(t&Node.DOCUMENT_POSITION_CONTAINS){if(y===null)return y=f.ownerDocument,f===y||f===y.documentElement||f===y.body;e:{for(y=n,n=v(n);y!==null;){if(!(y.tag!==5&&y.tag!==3&&y.tag!==27||y!==n&&y.alternate!==n)){y=!0;break e}y=y.return}y=!1}return y}return t&Node.DOCUMENT_POSITION_PRECEDING?((n=!!y)&&!(n=y===o)&&(n=b(o,y,w),n===null?n=!1:(m(n,!0,j,y,o),y=z,z=null,n=y!==null)),n):t&Node.DOCUMENT_POSITION_FOLLOWING?((n=!!y)&&!(n=y===c)&&(n=b(c,y,w),n===null?n=!1:(m(n,!0,O,y,c),y=z,E=z=null,n=y!==null)),n):!1}function qv(t,n){var o=t.ownerDocument.createRange();o.selectNodeContents(t),t=o.getBoundingClientRect(),window.scrollTo(window.scrollX+t.left,n?window.scrollY+t.top:window.scrollY+t.bottom-window.innerHeight)}ja.prototype.scrollIntoView=function(t){if(typeof t=="object")throw Error(i(566));var n=[];m(this._fragmentFiber.child,!1,hm,n,void 0,void 0);var o=t!==!1;if(n.length===0){var c=T(this._fragmentFiber);if(c=o?c[1]||c[0]||v(this._fragmentFiber):c[0]||c[1],c===null)return;if(c.tag===6){t=C(c),qv(t,o);return}if(c=C(c),c.nodeType!==9){if(c.nodeType===11){o="host"in c?c.host:null,o!==null&&o.scrollIntoView(t);return}c.scrollIntoView(t)}}for(c=o?n.length-1:0;c!==(o?-1:n.length);){var f=n[c];f.tag===6?(f=C(f),qv(f,o)):C(f).scrollIntoView(t),c+=o?-1:1}};function RS(t,n){return t=C(t),Gv(t,n),!1}function Gv(t,n){t.reactFragments==null&&(t.reactFragments=new Set),t.reactFragments.add(n)}function Xv(t,n){var o=n._eventListeners;if(o!==null)for(var c=0;c<o.length;c++){var f=o[c];t.addEventListener(f.type,f.attachedListener,Ni(f.optionsOrUseCapture))}t.nodeType!==3&&(o=n._observers,o!==null&&o.forEach(function(y){for(var $=0,Z=0;Z<ls.length;Z++){var ae=ls[Z];(ae.fragmentInstance!==n||ae.observer!==y||ae.instance!==t)&&(ls[$++]=ae)}ls.length=$,y.observe(t)}),Gv(t,n))}function $S(t,n){var o=n._eventListeners;if(o!==null)for(var c=0;c<o.length;c++){var f=o[c];t.removeEventListener(f.type,f.attachedListener,Ni(f.optionsOrUseCapture))}t.nodeType!==3&&(o=n._observers,o!==null&&o.forEach(function(y){typeof y.rootMargin=="str
9ing"?AS(n,y,t):y.unobserve(t)}),t.reactFragments!=null&&t.reactFragments.delete(n))}function mm(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var o=n;switch(n=n.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":mm(o),Pt(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}t.removeChild(o)}}function LS(t,n,o,c){for(;t.nodeType===1;){var f=o;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!c&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(c){if(!t[Ot])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var y=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Ba(t.nextSibling),t===null)break}return null}function US(t,n,o){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!o||(t=Ba(t.nextSibling),t===null))return null;return t}function Zv(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Ba(t.nextSibling),t===null))return null;return t}function pm(t){return t.data==="$?"||t.data==="$~"}function gm(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function HS(t,n){var o=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||o.readyState!=="loading")n();else{var c=function(){n(),o.removeEventListener("DOMContentLoaded",c)};o.addEventListener("DOMContentLoaded",c),t._reactRetry=c}}function Ba(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var ym=null;function Fv(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var o=t.data;if(o==="/$"||o==="/&"){if(n===0)return Ba(t.nextSibling);n--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||n++}t=t.nextSibling}return null}function Kv(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var o=t.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(n===0)return t;n--}else o!=="/$"&&o!=="/&"||n++}t=t.previousSibling}return null}function BS(t,n){function o(){c=!0}if(t.ownerDocument.activeElement===t)return!0;var c=!1;try{t.ownerDocument.addEventListener("focus",o,!0),(t.focus||HTMLElement.prototype.focus).call(t,n)}finally{t.ownerDocument.removeEventListener("focus",o,!0)}return c}function PS(t){Rv(function(){Rv(function(n){return t(n)})})}function Qv(t,n,o){switch(n=Lr(o),t){case"html":if(t=n.documentElement,!t)throw Error(i(452));return t;case"head":if(t=n.head,!t)throw Error(i(453));return t;case"body":if(t=n.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function Wv(t,n,o){for(var c in o){var f=o[c];o.hasOwnProperty(c)&&f!=null&&zt(t,n,c,null,yS,f)}o.dangerouslySetInnerHTML!=null&&(t.textContent=""),t.onclick===oa&&(t.onclick=null),Pt(t)}function xm(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Pt(t)}var Pa=new Map,Jv=new Set;function Ur(t){if(typeof t.getRootNode=="function"){var n=t.getRootNode();if(n.nodeType===9||n.nodeType===11)return n}return t.nodeType===9?t:t.ownerDocument}var sl=Ne.d;Ne.d={f:YS,r:VS,D:qS,C:GS,L:XS,m:ZS,X:KS,S:FS,M:QS};function YS(){var t=sl.f(),n=Iu();return t||n}function VS(t){var n=Fa(t);n!==null&&n.tag===5&&n.type==="form"?tx(n):sl.r(t)}var ki=typeof document>"u"?null:document;function e0(t,n,o){var c=ki;if(c&&typeof n=="string"&&n){var f=la(n);
vendor: 6,580 bytes, line 9
9f='link[rel="'+t+'"][href="'+f+'"]',typeof o=="string"&&(f+='[crossorigin="'+o+'"]'),Jv.has(f)||(Jv.add(f),t={rel:t,crossOrigin:o,href:n},c.querySelector(f)===null&&(n=c.createElement("link"),zn(n,"link",t),Xt(n),c.head.appendChild(n)))}}function qS(t){sl.D(t),e0("dns-prefetch",t,null)}function GS(t,n){sl.C(t,n),e0("preconnect",t,n)}function XS(t,n,o){sl.L(t,n,o);var c=ki;if(c&&t&&n){var f='link[rel="preload"][as="'+la(n)+'"]';n==="image"&&o&&o.imageSrcSet?(f+='[imagesrcset="'+la(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(f+='[imagesizes="'+la(o.imageSizes)+'"]')):f+='[href="'+la(t)+'"]';var y=f;switch(n){case"style":y=Si(t);break;case"script":y=Ci(t)}if(!(Pa.has(y)||(t=A({rel:"preload",href:n==="image"&&o&&o.imageSrcSet?void 0:t,as:n},o),Pa.set(y,t),c.querySelector(f)!==null||n==="style"&&c.querySelector(Hr(y))||n==="script"&&c.querySelector(Br(y))))){var $=c.createElement("link");zn($,"link",t),n==="style"&&($[en]=!0,$.onload=$.onerror=function(){Ka($)}),Xt($),c.head.appendChild($)}}}function ZS(t,n){sl.m(t,n);var o=ki;if(o&&t){var c=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+la(c)+'"][href="'+la(t)+'"]',y=f;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Ci(t)}if(!Pa.has(y)&&(t=A({rel:"modulepreload",href:t},n),Pa.set(y,t),o.querySelector(f)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Br(y)))return}c=o.createElement("link"),zn(c,"link",t),Xt(c),o.head.appendChild(c)}}}function FS(t,n,o){sl.S(t,n,o);var c=ki;if(c&&t){var f=Bn(c).hoistableStyles,y=Si(t);n=n||"default";var $=f.get(y);if(!$){var Z={loading:0,preload:null};if($=c.querySelector(Hr(y)))Z.loading=5;else{t=A({rel:"stylesheet",href:t,"data-precedence":n},o),(o=Pa.get(y))&&vm(t,o);var ae=$=c.createElement("link");Xt(ae),zn(ae,"link",t),ae._p=new Promise(function(fe,je){ae.onload=fe,ae.onerror=je}),ae.addEventListener("load",function(){Z.loading|=1}),ae.addEventListener("error",function(){Z.loading|=2}),Z.loading|=4,Bu($,n,c)}$={type:"stylesheet",instance:$,count:1,state:Z},f.set(y,$)}}}function KS(t,n){sl.X(t,n);var o=ki;if(o&&t){var c=Bn(o).hoistableScripts,f=Ci(t),y=c.get(f);y||(y=o.querySelector(Br(f)),y||(t=A({src:t,async:!0},n),(n=Pa.get(f))&&bm(t,n),y=o.createElement("script"),Xt(y),zn(y,"link",t),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},c.set(f,y))}}function QS(t,n){sl.M(t,n);var o=ki;if(o&&t){var c=Bn(o).hoistableScripts,f=Ci(t),y=c.get(f);y||(y=o.querySelector(Br(f)),y||(t=A({src:t,async:!0,type:"module"},n),(n=Pa.get(f))&&bm(t,n),y=o.createElement("script"),Xt(y),zn(y,"link",t),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},c.set(f,y))}}function t0(t,n,o,c){var f=(f=te.current)?Ur(f):null;if(!f)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(o=Si(o.href),n=Bn(f).hoistableStyles,c=n.get(o),c||(c={type:"style",instance:null,count:0,state:null},n.set(o,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){t=Si(o.href);var y=Bn(f).hoistableStyles,$=y.get(t);if($||(f=f.ownerDocument||f,$={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,$),(y=f.querySelector(Hr(t)))?y._p||($.instance=y,$.state.loading=5):(y=Pa.get(t),y||(y={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Pa.set(t,y)),WS(f,t,y,$.state))),n&&c===null)throw Error(i(528,""));return $}if(n&&c!==null)throw Error(i(529,""));return null;case"script":return n=o.async,o=o.src,typeof o=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(o=Ci(o),n=Bn(f).hoistableScripts,c=n.get(o),c||(c={type:"script",instance:null,count:0,state:null},n.set(o,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function Si(t){return'href="'+la(t)+'"'}function Hr(t){return'link[rel="stylesheet"]['+t+"]"}function n0(t){return A({},t,{"data-precedence":t.precedence,precedence:null})}function WS(t,n,o,c){if(n=t.querySelector('link[rel="preload"][as="style"]['+n+"]")){if(n[en]!==!0){c.loading=1;return}}else n=t.createElement("link"),n[en]=!0,n.onload=n.onerror=Ka.bind(null,n),zn(n,"link",o),Xt(n),t.head.appendChild(n);c.preload=n,n.addEventListener("load",function(){return c.loading|=1}),n.addEventListener("error",function(){return c.loading|=2})}function Ci(t){return'[src="'+la(t)+'"]'}function Br(t){return"script[async]"+t}function a0(t,n,o){if(n.count++,n.instance===null)switch(n.type){case"style":var c=t.querySelector('style[data-href~="'+la(o.href)+'"]');if(c)return n.instance=c,Xt(c),c;var f=A({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),Xt(c),zn(c,"style",f),Bu(c,o.precedence,t),n.instance=c;case"stylesheet":f=Si(o.href);var y=t.querySelector(Hr(f));if(y)return n.state.loading|=4,n.instance=y,Xt(y),y;c=n0(o),(f=Pa.get(f))&&vm(c,f),y=(t.ownerDocument||t).createElement("link"),Xt(y);var $=y;return $._p=new Promise(function(Z,ae){$.onload=Z,$.onerror=ae}),zn(y,"link",c),n.state.loading|=4,Bu(y,o.precedence,t),n.instance=y;case"script":return y=Ci(o.src),(f=t.querySelector(Br(y)))?(n.instance=f,Xt(f),f):(c=o,(f=Pa.get(y))&&(c=A({},o),bm(c,f)),t=t.ownerDocument||t,f=t.createElement("script"),Xt(f),zn(f,"link",c),t.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(i(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(c=n.instance,n.state.loading|=4,Bu(c,o.precedence,t));return n.instance}function Bu(t,n,o){for(var c=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=c.length?c[c.length-1]:null,y=f,$=0;$<c.length;$++){var Z=c[$];if(Z.dataset.precedence===n)y=Z;else if(y!==f)break}y?y.parentNode.insertBefore(t,y.nextSibling):(n=o.nodeType===9?o.head:o,n.insertBefore(t,n.firstChild))}function vm(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function bm(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var Pu=null;function s0(t,n,o){if(Pu===null){var c=new Map,f=Pu=new Map;f.set(o,c)}
9else f=Pu,c=f.get(o),c||(c=new Map,f.set(o,c));if(c.has(t))return c;for(c.set(t,null),o=o.getElementsByTagName(t),f=0;f<o.length;f++){var y=o[f];if(!(y[Ot]||y[ot]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var $=y.getAttribute(n)||"";$=t+$;var Z=c.get($);Z?Z.push(y):c.set($,[y])}}return c}function wm(t,n,o){t=t.ownerDocument||t,t.head.insertBefore(o,n==="title"?t.querySelector("head > title"):null)}function JS(t,n,o){if(o===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function l0(t,n){return t==="img"&&n.src!=null&&n.src!==""&&n.onLoad==null&&n.loading!=="lazy"}function o0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function i0(t){return(t.width||100)*(t.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function r0(t,n){typeof n.decode=="function"&&(t.imgCount++,n.complete||(t.imgBytes+=i0(n),t.suspenseyImages.push(n)),t=nC.bind(t),n.decode().then(t,t))}function eC(t,n,o,c){if(o.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var f=Si(c.href),y=n.querySelector(Hr(f));if(y){n=y._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=Pr.bind(t),n.then(t,t)),o.state.loading|=4,o.instance=y,Xt(y);return}y=n.ownerDocument||n,c=n0(c),(f=Pa.get(f))&&vm(c,f),y=y.createElement("link"),Xt(y);var $=y;$._p=new Promise(function(Z,ae){$.onload=Z,$.onerror=ae}),zn(y,"link",c),o.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(o,n),(n=o.state.preload)&&(o.state.loading&3)===0&&(t.count++,o=Pr.bind(t),n.addEventListener("load",o),n.addEventListener("error",o))}}var Yu=0;function tC(t,n){return t.stylesheets&&t.count===0&&qu(t,t.stylesheets),0<t.count||0<t.imgCount?function(o){var c=setTimeout(function(){if(t.stylesheets&&qu(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+n);0<t.imgBytes&&Yu===0&&(Yu=62500*vS());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&qu(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>Yu?50:800)+n);return t.unsuspend=o,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(f)}}:null}function c0(t){if(t.count===0&&(t.imgCount===0||!t.waitingForImages)){if(t.stylesheets)qu(t,t.stylesheets);else if(t.unsuspend){var n=t.unsuspend;t.unsuspend=null,n()}}}function Pr(){this.count--,c0(this)}function nC(){this.imgCount--,c0(this)}var Vu=null;function qu(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Vu=new Map,n.forEac
vendor: 11,085 bytes, line 9
9h(aC,t),Vu=null,Pr.call(t))}function aC(t,n){if(!(n.state.loading&4)){var o=Vu.get(t);if(o)var c=o.get(null);else{o=new Map,Vu.set(t,o);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<f.length;y++){var $=f[y];($.nodeName==="LINK"||$.getAttribute("media")!=="not all")&&(o.set($.dataset.precedence,$),c=$)}c&&o.set(null,c)}f=n.instance,$=f.getAttribute("data-precedence"),y=o.get($)||c,y===c&&o.set(null,f),o.set($,f),this.count++,c=Pr.bind(this),f.addEventListener("load",c),f.addEventListener("error",c),y?y.parentNode.insertBefore(f,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),n.state.loading|=4}}var Ei={$$typeof:V,Provider:null,Consumer:null,_currentValue:He,_currentValue2:He,_threadCount:0};function sC(t,n,o,c,f,y,$,Z,ae){this.tag=1,this.containerInfo=t,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=ln(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ln(0),this.hiddenUpdates=ln(null),this.identifierPrefix=c,this.onUncaughtError=f,this.onCaughtError=y,this.onRecoverableError=$,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ae,this.transitionTypes=null,this.incompleteTransitions=new Map}function u0(t,n,o,c,f,y,$,Z,ae,fe,je,Me){return t=new sC(t,n,o,$,ae,fe,je,Me,Z),n=1,y===!0&&(n|=24),y=ca(3,null,null,n),t.current=y,y.stateNode=t,n=zh(),n.refCount++,t.pooledCache=n,n.refCount++,y.memoizedState={element:c,isDehydrated:o,cache:n},Uh(y),t}function d0(t){return t?(t=Jo,t):Jo}function h0(t,n,o,c,f,y){f=d0(f),c.context===null?c.context=f:c.pendingContext=f,c=bl(n),c.payload={element:o},y=y===void 0?null:y,y!==null&&(c.callback=y),o=wl(t,c,n),o!==null&&(fa(o,t,n),vr(o,t,n))}function f0(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var o=t.retryLane;t.retryLane=o!==0&&o<n?o:n}}function jm(t,n){f0(t,n),(t=t.alternate)&&f0(t,n)}function m0(t){if(t.tag===13||t.tag===31){var n=no(t,67108864);n!==null&&fa(n,t,67108864),jm(t,67108864)}}function p0(t){if(t.tag===13||t.tag===31){var n=wa();n=aa(n);var o=no(t,n);o!==null&&fa(o,t,n),jm(t,n)}}var Ti=!0;function lC(t,n,o,c){var f=xe.T;xe.T=null;var y=Ne.p;try{Ne.p=2,Nm(t,n,o,c)}finally{Ne.p=y,xe.T=f}}function oC(t,n,o,c){var f=xe.T;xe.T=null;var y=Ne.p;try{Ne.p=8,Nm(t,n,o,c)}finally{Ne.p=y,xe.T=f}}function Nm(t,n,o,c){if(Ti){var f=km(c);if(f===null)sm(t,n,c,Gu,o),y0(t,c);else if(rC(f,t,n,o,c))c.stopPropagation();else if(y0(t,c),n&4&&-1<iC.indexOf(t)){for(;f!==null;){var y=Fa(f);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var $=wn(y.pendingLanes);if($!==0){var Z=y;for(Z.pendingLanes|=2,Z.entangledLanes|=2;$;){var ae=1<<31-Jt($);Z.entanglements[1]|=ae,$&=~ae}_s(y),(Ct&6)===0&&(_u=qt()+500,zr(0))}}break;case 31:case 13:Z=no(y,2),Z!==null&&fa(Z,y,2),Iu(),jm(y,2)}if(y=km(c),y===null&&sm(t,n,c,Gu,o),y===f)break;f=y}f!==null&&c.stopPropagation()}else sm(t,n,c,null,o)}}function km(t){return t=nr(t),Sm(t)}var Gu=null;function Sm(t){if(Gu=null,t=Nn(t),t!==null){var n=u(t);if(n===null)t=null;else{var o=n.tag;if(o===13){if(t=d(n),t!==null)return t;t=null}else if(o===31){if(t=h(n),t!==null)return t;t=null}else if(o===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return Gu=t,null}function g0(t){switch(t){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"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"fullscreenerror":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"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Tn()){case Ln:return 2;case Ht:return 8;case pt:case gt:return 32;case Un:return 268435456;default:return 32}default:return 32}}var Cm=!1,Al=null,Il=null,zl=null,Yr=new Map,Vr=new Map,Rl=[],iC="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 y0(t,n){switch(t){case"focusin":case"focusout":Al=null;break;case"dragenter":case"dragleave":Il=null;break;case"mouseover":case"mouseout":zl=null;break;case"pointerover":case"pointerout":Yr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vr.delete(n.pointerId)}}function qr(t,n,o,c,f,y){return t===null||t.nativeEvent!==y?(t={blockedOn:n,domEventName:o,eventSystemFlags:c,nativeEvent:y,targetContainers:[f]},n!==null&&(n=Fa(n),n!==null&&m0(n)),t):(t.eventSystemFlags|=c,n=t.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),t)}function rC(t,n,o,c,f){switch(n){case"focusin":return Al=qr(Al,t,n,o,c,f),!0;case"dragenter":return Il=qr(Il,t,n,o,c,f),!0;case"mouseover":return zl=qr(zl,t,n,o,c,f),!0;case"pointerover":var y=f.pointerId;return Yr.set(y,qr(Yr.get(y)||null,t,n,o,c,f)),!0;case"gotpointercapture":return y=f.pointerId,Vr.set(y,qr(Vr.get(y)||null,t,n,o,c,f)),!0}return!1}function x0(t){var n=Nn(t.target);if(n!==null){var o=u(n);if(o!==null){if(n=o.tag,n===13){if(n=d(o),n!==null){t.blockedOn=n,$e(t.priority,function(){p0(o)});return}}else if(n===31){if(n=h(o),n!==null){t.blockedOn=n,$e(t.priority,function(){p0(o)});return}}else if(n===3&&o.stateNode.current.memoizedState.isDehydrated){t.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Xu(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var o=km(t.nativeEvent);if(o===null){o=t.nativeEvent;var c=new o.constructor(o.type,o);tr=c,o.target.dispatchEvent(c),tr=null}else return n=Fa(o),n!==null&&m0(n),t.blockedOn=o,!1;n.shift()}return!0}function v0(t,n,o){Xu(t)&&o.delete(n)}function cC(){Cm=!1,Al!==null&&Xu(Al)&&(Al=null),Il!==null&&Xu(Il)&&(Il=null),zl!==null&&Xu(zl)&&(zl=null),Yr.forEach(v0),Vr.forEach(v0)}function Zu(t,n){t.blockedOn===n&&(t.blockedOn=null,Cm||(Cm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,cC)))}var Fu=null;function b0(t){Fu!==t&&(Fu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Fu===t&&(Fu=null);for(var n=0;n<t.length;n+=3){var o=t[n],c=t[n+1],f=t[n+2];if(typeof c!="function"){if(Sm(c||o)===null)continue;break}var y=Fa(o);y!==null&&(t.splice(n,3),n-=3,of(y,{pending:!0,data:f,method:o.method,action:c},c,f))}}))}function Mi(t){function n(ae){return Zu(ae,t)}Al!==null&&Zu(Al,t),Il!==null&&Zu(Il,t),zl!==null&&Zu(zl,t),Yr.forEach(n),Vr.forEach(n);for(var o=0;o<Rl.length;o++){var c=Rl[o];c.blockedOn===t&&(c.blockedOn=null)}for(;0<Rl.length&&(o=Rl[0],o.blockedOn===null);)x0(o),o.blockedOn===null&&Rl.shift();if(o=(t.ownerDocument||t).$$reactFormReplay,o!=null)for(c=0;c<o.length;c+=3){var f=o[c],y=o[c+1],$=f[ht]||null;if(typeof y=="function")$||b0(o);else if($){var Z=null;if(y&&y.hasAttribute("formAction")){if(f=y,$=y[ht]||null)Z=$.formAction;else if(Sm(f)!==null)continue}else Z=$.action;typeof Z=="function"?o[c+1]=Z:(o.splice(c,3),c-=3),b0(o)}}}function w0(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function($){return f=$})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),c||setTimeout(o,20)}function o(){if(!c&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(o,100),function(){c=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Em(t){this._internalRoot=t}Ku.prototype.render=Em.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(i(409));var o=n.current,c=wa();h0(o,c,t,n,null,null)},Ku.prototype.unmount=Em.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;h0(t.current,2,null,t,null,null),Iu(),n[Ie]=null}};function Ku(t){this._internalRoot=t}Ku.prototype.unstable_scheduleHydration=function(t){if(t){var n=G();t={blockedOn:null,target:t,priority:n};for(var o=0;o<Rl.length&&n!==0&&n<Rl[o].priority;o++);Rl.splice(o,0,t),o===0&&x0(t)}};var j0=a.version;if(j0!=="19.3.0")throw Error(i(527,j0,"19.3.0"));Ne.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=p(n),t=t!==null?x(t):null,t=t===null?null:t.stateNode,t};var uC={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:xe,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qu.isDisabled&&Qu.supportsFiber)try{Ta=Qu.inject(uC),Qt=Qu}catch{}}return Xr.createRoot=function(t,n){if(!r(t))throw Error(i(299));var o=!1,c="",f=dx,y=hx,$=fx;return n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(y=n.onCaughtError),n.onRecoverableError!==void 0&&($=n.onRecoverableError)),n=u0(t,1,!1,null,null,o,c,null,f,y,$,w0),t[Ie]=n.current,am(t),new Em(n)},Xr.hydrateRoot=function(t,n,o){if(!r(t))throw Error(i(299));var c=!1,f="",y=dx,$=hx,Z=fx,ae=null;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(f=o.identifierPrefix),o.onUncaughtError!==void 0&&(y=o.onUncaughtError),o.onCaughtError!==void 0&&($=o.onCaughtError),o.onRecoverableError!==void 0&&(Z=o.onRecoverableError),o.formState!==void 0&&(ae=o.formState)),n=u0(t,1,!0,n,o??null,c,f,ae,y,$,Z,w0),n.context=d0(null),o=n.current,c=wa(),c=aa(c),f=bl(c),f.callback=null,wl(o,f,c),o=c,n.current.lanes=o,Mn(n,o),_s(n),t[Ie]=n.current,am(t),new 
9Ku(n)},Xr.version="19.3.0",Xr}var O0;function bC(){if(O0)return Dm.exports;O0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(a){console.error(a)}}return e(),Dm.exports=vC(),Dm.exports}var wC=bC();function dn(e){if(typeof e=="string"||typeof e=="number")return""+e;let a="";if(Array.isArray(e))for(let l=0,i;l<e.length;l++)(i=dn(e[l]))!==""&&(a+=(a&&" ")+i);else for(let l in e)e[l]&&(a+=(a&&" ")+l);return a}var jC={value:()=>{}};function qd(){for(var e=0,a=arguments.length,l={},i;e<a;++e){if(!(i=arguments[e]+"")||i in l||/[\s.]/.test(i))throw new Error("illegal type: "+i);l[i]=[]}return new fd(l)}function fd(e){this._=e}function NC(e,a){return e.trim().split(/^|\s+/).map(function(l){var i="",r=l.indexOf(".");if(r>=0&&(i=l.slice(r+1),l=l.slice(0,r)),l&&!a.hasOwnProperty(l))throw new Error("unknown type: "+l);return{type:l,name:i}})}fd.prototype=qd.prototype={constructor:fd,on:function(e,a){var l=this._,i=NC(e+"",l),r,u=-1,d=i.length;if(arguments.length<2){for(;++u<d;)if((r=(e=i[u]).type)&&(r=kC(l[r],e.name)))return r;return}if(a!=null&&typeof a!="function")throw new Error("invalid callback: "+a);for(;++u<d;)if(r=(e=i[u]).type)l[r]=A0(l[r],e.name,a);else if(a==null)for(r in l)l[r]=A0(l[r],e.name,null);return this},copy:function(){var e={},a=this._;for(var l in a)e[l]=a[l].slice();return new fd(e)},call:function(e,a){if((r=arguments.length-2)>0)for(var l=new Array(r),i=0,r,u;i<r;++i)l[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(u=this._[e],i=0,r=u.length;i<r;++i)u[i].value.apply(a,l)},apply:function(e,a,l){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],r=0,u=i.length;r<u;++r)i[r].value.apply(a,l)}};function kC(e,a){for(var l=0,i=e.length,r;l<i;++l)if((r=e[l]).name===a)return r.value}function A0(e,a,l){for(var i=0,r=e.length;i<r;++i)if(e[i].name===a){e[i]=jC,e=e.slice(0,i).concat(e.slice(i+1));break}return l!=null&&e.push({name:a,value:l}),e}var Np="http://www.w3.org/1999/xhtml";const I0={svg:"http://www.w3.org/2000/svg",xhtml:Np,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Gd(e){var a=e+="",l=a.indexOf(":");return l>=0&&(a=e.slice(0,l))!=="xmlns"&&(e=e.slice(l+1)),I0.hasOwnProperty(a)?{space:I0[a],local:e}:e}function SC(e){return function(){var a=this.ownerDocument,l=this.namespaceURI;return l===Np&&a.documentElement.namespaceURI===Np?a.createElement(e):a.createElementNS(l,e)}}function CC(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function dj(e){var a=Gd(e);return(a.local?CC:SC)(a)}function EC(){}function Fp(e){return e==null?EC:function(){return this.querySelector(e)}}function TC(e){typeof e!="function"&&(e=Fp(e));for(var a=this._groups,l=a.length,i=new Array(l),r=0;r<l;++r)for(var u=a[r],d=u.length,h=i[r]=new Array(d),g,p,x=0;x<d;++x)(g=u[x])&&(p=e.call(g,g.__data__,x,u))&&("__data__"in g&&(p.__data__=g.__data__),h[x]=p);return new Ca(i,this._parents)}function MC(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function DC(){return[]}function hj(e){return e==null?DC:function(){return this.querySelectorAll(e)}}function _C(e){return function(){return MC(e.apply(this,arguments))}}function OC(e){typeof e=="function"?e=_C(e):e=hj(e);for(var a=this._groups,l=a.length,i=[],r=[],u=0;u<l;++u)for(var d=a[u],h=d.length,g,p=0;p<h;++p)(g=d[p])&&(i.push(e.call(g,g.__data__,p,d)),r.push(g));return new Ca(i,r)}function fj(e){return function(){return this.matches(e)}}function mj(e){return function(a){return a.matches(e)}}var AC=Array.prototype.find;function IC(e){return function(){return AC.call(this.children,e)}}function zC(){return this.firstElementChild}function RC(e){return this.select(e==null?zC:IC(typeof e=="function"?e:mj(e)))}var $C=Array.prototype.filter;function LC(){return Array.from(this.children)}function UC(e){return function(){return $C.call(this.children,e)}}function HC(e){return this.selectAll(e==null?LC:UC(typeof e=="function"?e:mj(e)))}function BC(e){typeof e!="function"&&(e=fj(e));for(var a=this._groups,l=a.length,i=new Array(l),r=0;r<l;++r)for(var u=a[r],d=u.length,h=i[r]=[],g,p=0;p<d;++p)(g=u[p])&&e.call(g,g.__data__,p,u)&&h.push(g);return new Ca(i,this._parents)}function pj(e){return new Array(e.length)}function PC(){return new Ca(this._enter||this._groups.map(pj),this._parents)}function Nd(e,a){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=a}Nd.prototype={constructor:Nd,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,a){return this._parent.insertBefore(e,a)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function YC(e){return function(){return e}}function VC(e,a,l,i,r,u){for(var d=0,h,g=a.length,p=u.length;d<p;++d)(h=a[d])?(h.__data__=u[d],i[d]=h):l[d]=new Nd(e,u[d]);for(;d<g;++d)(h=a[d])&&(r[d]=h)}function qC(e,a,l,i,r,u,d){var h,g,p=new Map,x=a.length,m=u.length,v=new Array(x),k;for(h=0;h<x;
vendor: 27,680 bytes, line 9
9++h)(g=a[h])&&(v[h]=k=d.call(g,g.__data__,h,a)+"",p.has(k)?r[h]=g:p.set(k,g));for(h=0;h<m;++h)k=d.call(e,u[h],h,u)+"",(g=p.get(k))?(i[h]=g,g.__data__=u[h],p.delete(k)):l[h]=new Nd(e,u[h]);for(h=0;h<x;++h)(g=a[h])&&p.get(v[h])===g&&(r[h]=g)}function GC(e){return e.__data__}function XC(e,a){if(!arguments.length)return Array.from(this,GC);var l=a?qC:VC,i=this._parents,r=this._groups;typeof e!="function"&&(e=YC(e));for(var u=r.length,d=new Array(u),h=new Array(u),g=new Array(u),p=0;p<u;++p){var x=i[p],m=r[p],v=m.length,k=ZC(e.call(x,x&&x.__data__,p,i)),T=k.length,S=h[p]=new Array(T),C=d[p]=new Array(T),z=g[p]=new Array(v);l(x,m,S,C,z,k,a);for(var E=0,j=0,O,w;E<T;++E)if(O=S[E]){for(E>=j&&(j=E+1);!(w=C[j])&&++j<T;);O._next=w||null}}return d=new Ca(d,i),d._enter=h,d._exit=g,d}function ZC(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function FC(){return new Ca(this._exit||this._groups.map(pj),this._parents)}function KC(e,a,l){var i=this.enter(),r=this,u=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),a!=null&&(r=a(r),r&&(r=r.selection())),l==null?u.remove():l(u),i&&r?i.merge(r).order():r}function QC(e){for(var a=e.selection?e.selection():e,l=this._groups,i=a._groups,r=l.length,u=i.length,d=Math.min(r,u),h=new Array(r),g=0;g<d;++g)for(var p=l[g],x=i[g],m=p.length,v=h[g]=new Array(m),k,T=0;T<m;++T)(k=p[T]||x[T])&&(v[T]=k);for(;g<r;++g)h[g]=l[g];return new Ca(h,this._parents)}function WC(){for(var e=this._groups,a=-1,l=e.length;++a<l;)for(var i=e[a],r=i.length-1,u=i[r],d;--r>=0;)(d=i[r])&&(u&&d.compareDocumentPosition(u)^4&&u.parentNode.insertBefore(d,u),u=d);return this}function JC(e){e||(e=eE);function a(m,v){return m&&v?e(m.__data__,v.__data__):!m-!v}for(var l=this._groups,i=l.length,r=new Array(i),u=0;u<i;++u){for(var d=l[u],h=d.length,g=r[u]=new Array(h),p,x=0;x<h;++x)(p=d[x])&&(g[x]=p);g.sort(a)}return new Ca(r,this._parents).order()}function eE(e,a){return e<a?-1:e>a?1:e>=a?0:NaN}function tE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function nE(){return Array.from(this)}function aE(){for(var e=this._groups,a=0,l=e.length;a<l;++a)for(var i=e[a],r=0,u=i.length;r<u;++r){var d=i[r];if(d)return d}return null}function sE(){let e=0;for(const a of this)++e;return e}function lE(){return!this.node()}function oE(e){for(var a=this._groups,l=0,i=a.length;l<i;++l)for(var r=a[l],u=0,d=r.length,h;u<d;++u)(h=r[u])&&e.call(h,h.__data__,u,r);return this}function iE(e){return function(){this.removeAttribute(e)}}function rE(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cE(e,a){return function(){this.setAttribute(e,a)}}function uE(e,a){return function(){this.setAttributeNS(e.space,e.local,a)}}function dE(e,a){return function(){var l=a.apply(this,arguments);l==null?this.removeAttribute(e):this.setAttribute(e,l)}}function hE(e,a){return function(){var l=a.apply(this,arguments);l==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,l)}}function fE(e,a){var l=Gd(e);if(arguments.length<2){var i=this.node();return l.local?i.getAttributeNS(l.space,l.local):i.getAttribute(l)}return this.each((a==null?l.local?rE:iE:typeof a=="function"?l.local?hE:dE:l.local?uE:cE)(l,a))}function gj(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function mE(e){return function(){this.style.removeProperty(e)}}function pE(e,a,l){return function(){this.style.setProperty(e,a,l)}}function gE(e,a,l){return function(){var i=a.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,l)}}function yE(e,a,l){return arguments.length>1?this.each((a==null?mE:typeof a=="function"?gE:pE)(e,a,l??"")):Ui(this.node(),e)}function Ui(e,a){return e.style.getPropertyValue(a)||gj(e).getComputedStyle(e,null).getPropertyValue(a)}function xE(e){return function(){delete this[e]}}function vE(e,a){return function(){this[e]=a}}function bE(e,a){return function(){var l=a.apply(this,arguments);l==null?delete this[e]:this[e]=l}}function wE(e,a){return arguments.length>1?this.each((a==null?xE:typeof a=="function"?bE:vE)(e,a)):this.node()[e]}function yj(e){return e.trim().split(/^|\s+/)}function Kp(e){return e.classList||new xj(e)}function xj(e){this._node=e,this._names=yj(e.getAttribute("class")||"")}xj.prototype={add:function(e){var a=this._names.indexOf(e);a<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var a=this._names.indexOf(e);a>=0&&(this._names.splice(a,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function vj(e,a){for(var l=Kp(e),i=-1,r=a.length;++i<r;)l.add(a[i])}function bj(e,a){for(var l=Kp(e),i=-1,r=a.length;++i<r;)l.remove(a[i])}function jE(e){return function(){vj(this,e)}}function NE(e){return function(){bj(this,e)}}function kE(e,a){return function(){(a.apply(this,arguments)?vj:bj)(this,e)}}function SE(e,a){var l=yj(e+"");if(arguments.length<2){for(var i=Kp(this.node()),r=-1,u=l.length;++r<u;)if(!i.contains(l[r]))return!1;return!0}return this.each((typeof a=="function"?kE:a?jE:NE)(l,a))}function CE(){this.textContent=""}function EE(e){return function(){this.textContent=e}}function TE(e){return function(){var a=e.apply(this,arguments);this.textContent=a??""}}function ME(e){return arguments.length?this.each(e==null?CE:(typeof e=="function"?TE:EE)(e)):this.node().textContent}function DE(){this.innerHTML=""}function _E(e){return function(){this.innerHTML=e}}function OE(e){return function(){var a=e.apply(this,arguments);this.innerHTML=a??""}}function AE(e){return arguments.length?this.each(e==null?DE:(typeof e=="function"?OE:_E)(e)):this.node().innerHTML}function IE(){this.nextSibling&&this.parentNode.appendChild(this)}function zE(){return this.each(IE)}function RE(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $E(){return this.each(RE)}function LE(e){var a=typeof e=="function"?e:dj(e);return this.select(function(){return this.appendChild(a.apply(this,arguments))})}function UE(){return null}function HE(e,a){var l=typeof e=="function"?e:dj(e),i=a==null?UE:typeof a=="function"?a:Fp(a);return this.select(function(){return this.insertBefore(l.apply(this,arguments),i.apply(this,arguments)||null)})}function BE(){var e=this.parentNode;e&&e.removeChild(this)}function PE(){return this.each(BE)}function YE(){var e=this.cloneNode(!1),a=this.parentNode;return a?a.insertBefore(e,this.nextSibling):e}function VE(){var e=this.cloneNode(!0),a=this.parentNode;return a?a.insertBefore(e,this.nextSibling):e}function qE(e){return this.select(e?VE:YE)}function GE(e){return arguments.length?this.property("__data__",e):this.node().__data__}function XE(e){return function(a){e.call(this,a,this.__data__)}}function ZE(e){return e.trim().split(/^|\s+/).map(function(a){var l="",i=a.indexOf(".");return i>=0&&(l=a.slice(i+1),a=a.slice(0,i)),{type:a,name:l}})}function FE(e){return function(){var a=this.__on;if(a){for(var l=0,i=-1,r=a.length,u;l<r;++l)u=a[l],(!e.type||u.type===e.type)&&u.name===e.name?this.removeEventListener(u.type,u.listener,u.options):a[++i]=u;++i?a.length=i:delete this.__on}}}function KE(e,a,l){return function(){var i=this.__on,r,u=XE(a);if(i){for(var d=0,h=i.length;d<h;++d)if((r=i[d]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=u,r.options=l),r.value=a;return}}this.addEventListener(e.type,u,l),r={type:e.type,name:e.name,value:a,listener:u,options:l},i?i.push(r):this.__on=[r]}}function QE(e,a,l){var i=ZE(e+""),r,u=i.length,d;if(arguments.length<2){var h=this.node().__on;if(h){for(var g=0,p=h.length,x;g<p;++g)for(r=0,x=h[g];r<u;++r)if((d=i[r]).type===x.type&&d.name===x.name)return x.value}return}for(h=a?KE:FE,r=0;r<u;++r)this.each(h(i[r],a,l));return this}function wj(e,a,l){var i=gj(e),r=i.CustomEvent;typeof r=="function"?r=new r(a,l):(r=i.document.createEvent("Event"),l?(r.initEvent(a,l.bubbles,l.cancelable),r.detail=l.detail):r.initEvent(a,!1,!1)),e.dispatchEvent(r)}function WE(e,a){return function(){return wj(this,e,a)}}function JE(e,a){return function(){return wj(this,e,a.apply(this,arguments))}}function e2(e,a){return this.each((typeof a=="function"?JE:WE)(e,a))}function*t2(){for(var e=this._groups,a=0,l=e.length;a<l;++a)for(var i=e[a],r=0,u=i.length,d;r<u;++r)(d=i[r])&&(yield d)}var jj=[null];function Ca(e,a){this._groups=e,this._parents=a}function bc(){return new Ca([[document.documentElement]],jj)}function n2(){return this}Ca.prototype=bc.prototype={constructor:Ca,select:TC,selectAll:OC,selectChild:RC,selectChildren:HC,filter:BC,data:XC,enter:PC,exit:FC,join:KC,merge:QC,selection:n2,order:WC,sort:JC,call:tE,nodes:nE,node:aE,size:sE,empty:lE,each:oE,attr:fE,style:yE,property:wE,classed:SE,text:ME,html:AE,raise:zE,lower:$E,append:LE,insert:HE,remove:PE,clone:qE,datum:GE,on:QE,dispatch:e2,[Symbol.iterator]:t2};function Na(e){return typeof e=="string"?new Ca([[document.querySelector(e)]],[document.documentElement]):new Ca([[e]],jj)}function a2(e){let a;for(;a=e.sourceEvent;)e=a;return e}function os(e,a){if(e=a2(e),a===void 0&&(a=e.currentTarget),a){var l=a.ownerSVGElement||a;if(l.createSVGPoint){var i=l.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(a.getScreenCTM().inverse()),[i.x,i.y]}if(a.getBoundingClientRect){var r=a.getBoundingClientRect();return[e.clientX-r.left-a.clientLeft,e.clientY-r.top-a.clientTop]}}return[e.pageX,e.pageY]}const s2={passive:!1},ic={capture:!0,passive:!1};function Im(e){e.stopImmediatePropagation()}function $i(e){e.preventDefault(),e.stopImmediatePropagation()}function Nj(e){var a=e.document.documentElement,l=Na(e).on("dragstart.drag",$i,ic);"onselectstart"in a?l.on("selectstart.drag",$i,ic):(a.__noselect=a.style.MozUserSelect,a.style.MozUserSelect="none")}function kj(e,a){var l=e.document.documentElement,i=Na(e).on("dragstart.drag",null);a&&(i.on("click.drag",$i,ic),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in l?i.on("selectstart.drag",null):(l.style.MozUserSelect=l.__noselect,delete l.__noselect)}const Wu=e=>()=>e;function kp(e,{sourceEvent:a,subject:l,target:i,identifier:r,active:u,x:d,y:h,dx:g,dy:p,dispatch:x}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:a,enumerable:!0,configurable:!0},subject:{value:l,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:u,enumerable:!0,configurable:!0},x:{value:d,enumerable:!0,configurable:!0},y:{value:h,enumerable:!0,configurable:!0},dx:{value:g,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:x}})}kp.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function l2(e){return!e.ctrlKey&&!e.button}function o2(){return this.parentNode}function i2(e,a){return a??{x:e.x,y:e.y}}function r2(){return navigator.maxTouchPoints||"ontouchstart"in this}function Sj(){var e=l2,a=o2,l=i2,i=r2,r={},u=qd("start","drag","end"),d=0,h,g,p,x,m=0;function v(O){O.on("mousedown.drag",k).filter(i).on("touchstart.drag",C).on("touchmove.drag",z,s2).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function k(O,w){if(!(x||!e.call(this,O,w))){var b=j(this,a.call(this,O,w),O,w,"mouse");b&&(Na(O.view).on("mousemove.drag",T,ic).on("mouseup.drag",S,ic),Nj(O.view),Im(O),p=!1,h=O.clientX,g=O.clientY,b("start",O))}}function T(O){if($i(O),!p){var w=O.clientX-h,b=O.clientY-g;p=w*w+b*b>m}r.mouse("drag",O)}function S(O){Na(O.view).on("mousemove.drag mouseup.drag",null),kj(O.view,p),$i(O),r.mouse("end",O)}function C(O,w){if(e.call(this,O,w)){var b=O.changedTouches,A=a.call(this,O,w),D=b.length,M,U;for(M=0;M<D;++M)(U=j(this,A,O,w,b[M].identifier,b[M]))&&(Im(O),U("start",O,b[M]))}}function z(O){var w=O.changedTouches,b=w.length,A,D;for(A=0;A<b;++A)(D=r[w[A].identifier])&&($i(O),D("drag",O,w[A]))}function E(O){var w=O.changedTouches,b=w.length,A,D;for(x&&clearTimeout(x),x=setTimeout(function(){x=null},500),A=0;A<b;++A)(D=r[w[A].identifier])&&(Im(O),D("end",O,w[A]))}function j(O,w,b,A,D,M){var U=u.copy(),Y=os(M||b,w),q,W,L;if((L=l.call(O,new kp("beforestart",{sourceEvent:b,target:v,identifier:D,active:d,x:Y[0],y:Y[1],dx:0,dy:0,dispatch:U}),A))!=null)return q=L.x-Y[0]||0,W=L.y-Y[1]||0,function V(I,F,_){var H=Y,P;switch(I){case"start":r[D]=V,P=d++;break;case"end":delete r[D],--d;case"drag":Y=os(_||F,w),P=d;break}U.call(I,O,new kp(I,{sourceEvent:F,subject:L,target:v,identifier:D,active:P,x:Y[0]+q,y:Y[1]+W,dx:Y[0]-H[0],dy:Y[1]-H[1],dispatch:U}),A)}}return v.filter=function(O){return arguments.length?(e=typeof O=="function"?O:Wu(!!O),v):e},v.container=function(O){return arguments.length?(a=typeof O=="function"?O:Wu(O),v):a},v.subject=function(O){return arguments.length?(l=typeof O=="function"?O:Wu(O),v):l},v.touchable=function(O){return arguments.length?(i=typeof O=="function"?O:Wu(!!O),v):i},v.on=function(){var O=u.on.apply(u,arguments);return O===u?v:O},v.clickDistance=function(O){return arguments.length?(m=(O=+O)*O,v):Math.sqrt(m)},v}function Qp(e,a,l){e.prototype=a.prototype=l,l.constructor=e}function Cj(e,a){var l=Object.create(e.prototype);for(var i in a)l[i]=a[i];return l}function wc(){}var rc=.7,kd=1/rc,Li="\\s*([+-]?\\d+)\\s*",cc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",zs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",c2=/^#([0-9a-f]{3,8})$/,u2=new RegExp(`^rgb\\(${Li},${Li},${Li}\\)$`),d2=new RegExp(`^rgb\\(${zs},${zs},${zs}\\)$`),h2=new RegExp(`^rgba\\(${Li},${Li},${Li},${cc}\\)$`),f2=new RegExp(`^rgba\\(${zs},${zs},${zs},${cc}\\)$`),m2=new RegExp(`^hsl\\(${cc},${zs},${zs}\\)$`),p2=new RegExp(`^hsla\\(${cc},${zs},${zs},${cc}\\)$`),z0={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};Qp(wc,Oo,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:R0,formatHex:R0,formatHex8:g2,formatHsl:y2,formatRgb:$0,toString:$0});function R0(){return this.rgb().formatHex()}function g2(){return this.rgb().formatHex8()}function y2(){return Ej(this).formatHsl()}function $0(){return this.rgb().formatRgb()}function Oo(e){var a,l;return e=(e+"").trim().toLowerCase(),(a=c2.exec(e))?(l=a[1].length,a=parseInt(a[1],16),l===6?L0(a):l===3?new ma(a>>8&15|a>>4&240,a>>4&15|a&240,(a&15)<<4|a&15,1):l===8?Ju(a>>24&255,a>>16&255,a>>8&255,(a&255)/255):l===4?Ju(a>>12&15|a>>8&240,a>>8&15|a>>4&240,a>>4&15|a&240,((a&15)<<4|a&15)/255):null):(a=u2.exec(e))?new ma(a[1],a[2],a[3],1):(a=d2.exec(e))?new ma(a[1]*255/100,a[2]*255/100,a[3]*255/100,1):(a=h2.exec(e))?Ju(a[1],a[2],a[3],a[4]):(a=f2.exec(e))?Ju(a[1]*255/100,a[2]*255/100,a[3]*255/100,a[4]):(a=m2.exec(e))?B0(a[1],a[2]/100,a[3]/100,1):(a=p2.exec(e))?B0(a[1],a[2]/100,a[3]/100,a[4]):z0.hasOwnProperty(e)?L0(z0[e]):e==="transparent"?new ma(NaN,NaN,NaN,0):null}function L0(e){return new ma(e>>16&255,e>>8&255,e&255,1)}function Ju(e,a,l,i){return i<=0&&(e=a=l=NaN),new ma(e,a,l,i)}function x2(e){return e instanceof wc||(e=Oo(e)),e?(e=e.rgb(),new ma(e.r,e.g,e.b,e.opacity)):new ma}function Sp(e,a,l,i){return arguments.length===1?x2(e):new ma(e,a,l,i??1)}function ma(e,a,l,i){this.r=+e,this.g=+a,this.b=+l,this.opacity=+i}Qp(ma,Sp,Cj(wc,{brighter(e){return e=e==null?kd:Math.pow(kd,e),new ma(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?rc:Math.pow(rc,e),new ma(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ma(Do(this.r),Do(this.g),Do(this.b),Sd(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:U0,formatHex:U0,formatHex8:v2,formatRgb:H0,toString:H0}));function U0(){return`#${Mo(this.r)}${Mo(this.g)}${Mo(this.b)}`}function v2(){return`#${Mo(this.r)}${Mo(this.g)}${Mo(this.b)}${Mo((isNaN(this.opacity)?1:this.opacity)*255)}`}function H0(){const e=Sd(this.opacity);return`${e===1?"rgb(":"rgba("}${Do(this.r)}, ${Do(this.g)}, ${Do(this.b)}${e===1?")":`, ${e})`}`}function Sd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Do(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mo(e){return e=Do(e),(e<16?"0":"")+e.toString(16)}function B0(e,a,l,i){return i<=0?e=a=l=NaN:l<=0||l>=1?e=a=NaN:a<=0&&(e=NaN),new is(e,a,l,i)}function Ej(e){if(e instanceof is)return new is(e.h,e.s,e.l,e.opacity);if(e instanceof wc||(e=Oo(e)),!e)return new is;if(e instanceof is)return e;e=e.rgb();var a=e.r/255,l=e.g/255,i=e.b/255,r=Math.min(a,l,i),u=Math.max(a,l,i),d=NaN,h=u-r,g=(u+r)/2;return h?(a===u?d=(l-i)/h+(l<i)*6:l===u?d=(i-a)/h+2:d=(a-l)/h+4,h/=g<.5?u+r:2-u-r,d*=60):h=g>0&&g<1?0:d,new is(d,h,g,e.opacity)}function b2(e,a,l,i){return arguments.length===1?Ej(e):new is(e,a,l,i??1)}function is(e,a,l,i){this.h=+e,this.s=+a,this.l=+l,this.opacity=+i}Qp(is,b2,Cj(wc,{brighter(e){return e=e==null?kd:Math.pow(kd,e),new is(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?rc:Math.pow(rc,e),new is(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,a=isNaN(e)||isNaN(this.s)?0:this.s,l=this.l,i=l+(l<.5?l:1-l)*a,r=2*l-i;return new ma(zm(e>=240?e-240:e+120,r,i),zm(e,r,i),zm(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new is(P0(this.h),ed(this.s),ed(this.l),Sd(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 e=Sd(this.opacity);return`${e===1?"hsl(":"hsla("}${P0(this.h)}, ${ed(this.s)*100}%, ${ed(this.l)*100}%${e===1?")":`, ${e})`}`}}));function P0(e){return e=(e||0)%360,e<0?e+360:e}function ed(e){return Math.max(0,Math.min(1,e||0))}function zm(e,a,l){return(e<60?a+(l-a)*e/60:e<180?l:e<240?a+(l-a)*(240-e)/60:a)*255}const Wp=e=>()=>e;function w2(e,a){return function(l){return e+l*a}}function j2(e,a,l){return e=Math.pow(e,l),a=Math.pow(a,l)-e,l=1/l,function(i){return Math.pow(e+i*a,l)}}function N2(e){return(e=+e)==1?Tj:function(a,l){return l-a?j2(a,l,e):Wp(isNaN(a)?l:a)}}function Tj(e,a){var l=a-e;return l?w2(e,l):Wp(isNaN(e)?a:e)}const Cd=(function e(a){var l=N2(a);function i(r,u){var d=l((r=Sp(r)).r,(u=Sp(u)).r),h=l(r.g,u.g),g=l(r.b,u.b),p=Tj(r.opacity,u.opacity);return function(x){return r.r=d(x),r.g=h(x),r.b=g(x),r.opacity=p(x),r+""}}return i.gamma=e,i})(1);function k2(e,a){a||(a=[]);var l=e?Math.min(a.length,e.length):0,i=a.slice(),r;return function(u){for(r=0;r<l;++r)i[r]=e[r]*(1-u)+a[r]*u;return i}}function S2(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function C2(e,a){var l=a?a.length:0,i=e?Math.min(l,e.length):0,r=new Array(i),u=new Array(l),d;for(d=0;d<i;++d)r[d]=nc(e[d],a[d]);for(;d<l;++d)u[d]=a[d];return function(h){for(d=0;d<i;++d)u[d]=r[d](h);return u}}function E2(e,a){var l=new Date;return e=+e,a=+a,function(i){return l.setTime(e*(1-i)+a*i),l}}function As(e,a){return e=+e,a=+a,function(l){return e*(1-l)+a*l}}function T2(e,a){var l={},i={},r;(e===null||typeof e!="object")&&(e={}),(a===null||typeof a!="object")&&(a={});for(r in a)r in e?l[r]=nc(e[r],a[r]):i[r]=a[r];return function(u){for(r in l)i[r]=l[r](u);return i}}var Cp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Rm=new RegExp(Cp.source,"g");function M2(e){return function(){return e}}function D2(e){return function(a){return e(a)+""}}function Mj(e,a){var l=Cp.lastIndex=Rm.lastIndex=0,i,r,u,d=-1,h=[],g=[];for(e=e+"",a=a+"";(i=Cp.exec(e))&&(r=Rm.exec(a));)(u=r.index)>l&&(u=a.slice(l,u),h[d]?h[d]+=u:h[++d]=u),(i=i[0])===(r=r[0])?h[d]?h[d]+=r:h[++d]=r:(h[++d]=null,g.push({i:d,x:As(i,r)})),l=Rm.lastIndex;return l<a.length&&(u=a.slice(l),h[d]?h[d]+=u:h[++d]=u),h.length<2?g[0]?D2(g[0].x):M2(a):(a=g.length,function(p){for(var x=0,m;x<a;++x)h[(m=g[x]).i]=m.x(p);return h.join("")})}function nc(e,a){var l=typeof a,i;return a==null||l==="boolean"?Wp(a):(l==="number"?As:l==="string"?(i=Oo(a))?(a=i,Cd):Mj:a instanceof Oo?Cd:a instanceof Date?E2:S2(a)?k2:Array.isArray(a)?C2:typeof a.valueOf!="function"&&typeof a.toString!="function"||isNaN(a)?T2:As)(e,a)}var Y0=180/Math.PI,Ep={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Dj(e,a,l,i,r,u){var d,h,g;return(d=Math.sqrt(e*e+a*a))&&(e/=d,a/=d),(g=e*l+a*i)&&(l-=e*g,i-=a*g),(h=Math.sqrt(l*l+i*i))&&(l/=h,i/=h,g/=h),e*i<a*l&&(e=-e,a=-a,g=-g,d=-d),{translateX:r,translateY:u,rotate:Math.atan2(a,e)*Y0,skewX:Math.atan(g)*Y0,scaleX:d,scaleY:h}}var td;function _2(e){const a=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return a.isIdentity?Ep:Dj(a.a,a.b,a.c,a.d,a.e,a.f)}function O2(e){return e==null||(td||(td=document.createElementNS("http://www.w3.org/2000/svg","g")),td.setAttribute("transform",e),!(e=td.transform.baseVal.consolidate()))?Ep:(e=e.matrix,Dj(e.a,e.b,e.c,e.d,e.e,e.f))}function _j(e,a,l,i){function r(p){return p.length?p.pop()+" ":""}function u(p,x,m,v,k,T){if(p!==m||x!==v){var S=k.push("translate(",null,a,null,l);T.push({i:S-4,x:As(p,m)},{i:S-2,x:As(x,v)})}else(m||v)&&k.push("translate("+m+a+v+l)}function d(p,x,m,v){p!==x?(p-x>180?x+=360:x-p>180&&(p+=360),v.push({i:m.push(r(m)+"rotate(",null,i)-2,x:As(p,x)})):x&&m.push(r(m)+"rotate("+x+i)}function h(p,x,m,v){p!==x?v.push({i:m.push(r(m)+"skewX(",null,i)-2,x:As(p,x)}):x&&m.push(r(m)+"skewX("+x+i)}function g(p,x,m,v,k,T){if(p!==m||x!==v){var S=k.push(r(k)+"scale(",null,",",null,")");T.push({i:S-4,x:As(p,m)},{i:S-2,x:As(x,v)})}else(m!==1||v!==1)&&k.push(r(k)+"scale("+m+","+v+")")}return function(p,x){var m=[],v=[];return p=e(p),x=e(x),u(p.translateX,p.translateY,x.translateX,x.translateY,m,v),d(p.rotate,x.rotate,m,v),h(p.skewX,x.skewX,m,v),g(p.scaleX,p.scaleY,x.scaleX,x.scaleY,m,v),p=x=null,function(k){for(var T=-1,S=v.length,C;++T<S;)m[(C=v[T]).i]=C.x(k);return m.join("")}}}var A2=_j(_2,"px, ","px)","deg)"),I2=_j(O2,", ",")",")"),z2=1e-12;function V0(e){return((e=Math.exp(e))+1/e)/2}function R2(e){return((e=Math.exp(e))-1/e)/2}function $2(e){return((e=Math.exp(2*e))-1)/(e+1)}const md=(function e(a,l,i){function r(u,d){var h=u[0],g=u[1],p=u[2],x=d[0],m=d[1],v=d[2],k=x-h,T=m-g,S=k*k+T*T,C,z;if(S<z2)z=Math.log(v/p)/a,C=function(A){return[h+A*k,g+A*T,p*Math.exp(a*A*z)]};else{var E=Math.sqrt(S),j=(v*v-p*p+i*S)/(2*p*l*E),O=(v*v-p*p-i*S)/(2*v*l*E),w=Math.log(Math.sqrt(j*j+1)-j),b=Math.log(Math.sqrt(O*O+1)-O);z=(b-w)/a,C=function(A){var D=A*z,M=V0(w),U=p/(l*E)*(M*$2(a*D+w)-R2(w));return[h+U*k,g+U*T,p*M/V0(a*D+w)]}}return C.duration=z*1e3*a/Math.SQRT2,C}return r.rho=function(u){var d=Math.max(.001,+u),h=d*d,g=h*h;return e(d,h,g)},r})(Math.SQRT2,2,4);var Hi=0,Jr=0,Zr=0,Oj=1e3,Ed,ec,Td=0,Ao=0,Xd=0,uc=typeof performance=="object"&&performance.now?performance:Date,Aj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Jp(){return Ao||(Aj(L2),Ao=uc.now()+Xd)}function L2(){Ao=0}function Md(){this._call=this._time=this._next=null}Md.prototype=Ij.prototype={constructor:Md,restart:function(e,a,l){if(typeof e!="function")throw new TypeError("callback is not a function");l=(l==null?Jp():+l)+(a==null?0:+a),!this._next&&ec!==this&&(ec?ec._next=this:Ed=this,ec=this),this._call=e,this._time=l,Tp()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tp())}};function Ij(e,a,l){var i=new Md;return i.restart(e,a,l),i}function U2(){Jp(),++Hi;for(var e=Ed,a;e;)(a=Ao-e._time)>=0&&e._call.call(void 0,a),e=e._next;--Hi}function q0(){Ao=(Td=uc.now())+Xd,Hi=Jr=0;try{U2()}finally{Hi=0,B2(),Ao=0}}function H2(){var e=uc.now(),a=e-Td;a>Oj&&(Xd-=a,Td=e)}function B2(){for(var e,a=Ed,l,i=1/0;a;)a._call?(i>a._time&&(i=a._time),e=a,a=a._next):(l=a._next,a._next=null,a=e?e._next=l:Ed=l);ec=e,Tp(i)}function Tp(e){if(!Hi){Jr&&(Jr=clearTimeout(Jr));var a=e-Ao;a>24?(e<1/0&&(Jr=setTimeout(q0,e-uc.now()-Xd)),Zr&&(Zr=clearInterval(Zr))):(Zr||(Td=uc.now(),Zr=setInterval(H2,Oj)),Hi=1,Aj(q0))}}function G0(e,a,l){var i=new Md;return a=a==null?0:+a,i.restart(r=>{i.stop(),e(r+a)},a,l),i}var P2=qd("start","end","cancel","interrupt"),Y2=[],zj=0,X0=1,Mp=2,pd=3,Z0=4,Dp=5,gd=6;function Zd(e,a,l,i,r,u){var d=e.__transition;if(!d)e.__transition={};else if(l in d)return;V2(e,l,{name:a,index:i,group:r,on:P2,tween:Y2,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:zj})}function eg(e,a){var l=ms(e,a);if(l.state>zj)throw new Error("too late; already scheduled");return l}function $s(e,a){var l=ms(e,a);if(l.state>pd)throw new Error("too late; already running");return l}function ms(e,a){var l=e.__transition;if(!l||!(l=l[a]))throw new Error("transition not found");return l}function V2(e,a,l){var i=e.__transition,r;i[a]=l,l.timer=Ij(u,0,l.time);function u(p){l.state=X0,l.timer.restart(d,l.delay,l.time),l.delay<=p&&d(p-l.delay)}function d(p){var x,m,v,k;if(l.state!==X0)return g();for(x in i)if(k=i[x],k.name===l.name){if(k.state===pd)return G0(d);k.state===Z0?(k.state=gd,k.timer.stop(),k.on.call("interrupt",e,e.__data__,k.index,k.group),delete i[x]):+x<a&&(k.state=gd,k.timer.stop(),k.on.call("cancel",e,e.__data__,k.index,k.group),delete i[x])}
vendor: 8,505 bytes, line 9
9if(G0(function(){l.state===pd&&(l.state=Z0,l.timer.restart(h,l.delay,l.time),h(p))}),l.state=Mp,l.on.call("start",e,e.__data__,l.index,l.group),l.state===Mp){for(l.state=pd,r=new Array(v=l.tween.length),x=0,m=-1;x<v;++x)(k=l.tween[x].value.call(e,e.__data__,l.index,l.group))&&(r[++m]=k);r.length=m+1}}function h(p){for(var x=p<l.duration?l.ease.call(null,p/l.duration):(l.timer.restart(g),l.state=Dp,1),m=-1,v=r.length;++m<v;)r[m].call(e,x);l.state===Dp&&(l.on.call("end",e,e.__data__,l.index,l.group),g())}function g(){l.state=gd,l.timer.stop(),delete i[a];for(var p in i)return;delete e.__transition}}function yd(e,a){var l=e.__transition,i,r,u=!0,d;if(l){a=a==null?null:a+"";for(d in l){if((i=l[d]).name!==a){u=!1;continue}r=i.state>Mp&&i.state<Dp,i.state=gd,i.timer.stop(),i.on.call(r?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete l[d]}u&&delete e.__transition}}function q2(e){return this.each(function(){yd(this,e)})}function G2(e,a){var l,i;return function(){var r=$s(this,e),u=r.tween;if(u!==l){i=l=u;for(var d=0,h=i.length;d<h;++d)if(i[d].name===a){i=i.slice(),i.splice(d,1);break}}r.tween=i}}function X2(e,a,l){var i,r;if(typeof l!="function")throw new Error;return function(){var u=$s(this,e),d=u.tween;if(d!==i){r=(i=d).slice();for(var h={name:a,value:l},g=0,p=r.length;g<p;++g)if(r[g].name===a){r[g]=h;break}g===p&&r.push(h)}u.tween=r}}function Z2(e,a){var l=this._id;if(e+="",arguments.length<2){for(var i=ms(this.node(),l).tween,r=0,u=i.length,d;r<u;++r)if((d=i[r]).name===e)return d.value;return null}return this.each((a==null?G2:X2)(l,e,a))}function tg(e,a,l){var i=e._id;return e.each(function(){var r=$s(this,i);(r.value||(r.value={}))[a]=l.apply(this,arguments)}),function(r){return ms(r,i).value[a]}}function Rj(e,a){var l;return(typeof a=="number"?As:a instanceof Oo?Cd:(l=Oo(a))?(a=l,Cd):Mj)(e,a)}function F2(e){return function(){this.removeAttribute(e)}}function K2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Q2(e,a,l){var i,r=l+"",u;return function(){var d=this.getAttribute(e);return d===r?null:d===i?u:u=a(i=d,l)}}function W2(e,a,l){var i,r=l+"",u;return function(){var d=this.getAttributeNS(e.space,e.local);return d===r?null:d===i?u:u=a(i=d,l)}}function J2(e,a,l){var i,r,u;return function(){var d,h=l(this),g;return h==null?void this.removeAttribute(e):(d=this.getAttribute(e),g=h+"",d===g?null:d===i&&g===r?u:(r=g,u=a(i=d,h)))}}function eT(e,a,l){var i,r,u;return function(){var d,h=l(this),g;return h==null?void this.removeAttributeNS(e.space,e.local):(d=this.getAttributeNS(e.space,e.local),g=h+"",d===g?null:d===i&&g===r?u:(r=g,u=a(i=d,h)))}}function tT(e,a){var l=Gd(e),i=l==="transform"?I2:Rj;return this.attrTween(e,typeof a=="function"?(l.local?eT:J2)(l,i,tg(this,"attr."+e,a)):a==null?(l.local?K2:F2)(l):(l.local?W2:Q2)(l,i,a))}function nT(e,a){return function(l){this.setAttribute(e,a.call(this,l))}}function aT(e,a){return function(l){this.setAttributeNS(e.space,e.local,a.call(this,l))}}function sT(e,a){var l,i;function r(){var u=a.apply(this,arguments);return u!==i&&(l=(i=u)&&aT(e,u)),l}return r._value=a,r}function lT(e,a){var l,i;function r(){var u=a.apply(this,arguments);return u!==i&&(l=(i=u)&&nT(e,u)),l}return r._value=a,r}function oT(e,a){var l="attr."+e;if(arguments.length<2)return(l=this.tween(l))&&l._value;if(a==null)return this.tween(l,null);if(typeof a!="function")throw new Error;var i=Gd(e);return this.tween(l,(i.local?sT:lT)(i,a))}function iT(e,a){return function(){eg(this,e).delay=+a.apply(this,arguments)}}function rT(e,a){return a=+a,function(){eg(this,e).delay=a}}function cT(e){var a=this._id;return arguments.length?this.each((typeof e=="function"?iT:rT)(a,e)):ms(this.node(),a).delay}function uT(e,a){return function(){$s(this,e).duration=+a.apply(this,arguments)}}function dT(e,a){return a=+a,function(){$s(this,e).duration=a}}function hT(e){var a=this._id;return arguments.length?this.each((typeof e=="function"?uT:dT)(a,e)):ms(this.node(),a).duration}function fT(e,a){if(typeof a!="function")throw new Error;return function(){$s(this,e).ease=a}}function mT(e){var a=this._id;return arguments.length?this.each(fT(a,e)):ms(this.node(),a).ease}function pT(e,a){return function(){var l=a.apply(this,arguments);if(typeof l!="function")throw new Error;$s(this,e).ease=l}}function gT(e){if(typeof e!="function")throw new Error;return this.each(pT(this._id,e))}function yT(e){typeof e!="function"&&(e=fj(e));for(var a=this._groups,l=a.length,i=new Array(l),r=0;r<l;++r)for(var u=a[r],d=u.length,h=i[r]=[],g,p=0;p<d;++p)(g=u[p])&&e.call(g,g.__data__,p,u)&&h.push(g);return new rl(i,this._parents,this._name,this._id)}function xT(e){if(e._id!==this._id)throw new Error;for(var a=this._groups,l=e._groups,i=a.length,r=l.length,u=Math.min(i,r),d=new Array(i),h=0;h<u;++h)for(var g=a[h],p=l[h],x=g.length,m=d[h]=new Array(x),v,k=0;k<x;++k)(v=g[k]||p[k])&&(m[k]=v);for(;h<i;++h)d[h]=a[h];return new rl(d,this._parents,this._name,this._id)}function vT(e){return(e+"").trim().split(/^|\s+/).every(function(a){var l=a.indexOf(".");return l>=0&&(a=a.slice(0,l)),!a||a==="start"})}function bT(e,a,l){var i,r,u=vT(a)?eg:$s;return function(){var d=u(this,e),h=d.on;h!==i&&(r=(i=h).copy()).on(a,l),d.on=r}}function wT(e,a){var l=this._id;return arguments.length<2?ms(this.node(),l).on.on(e):this.each(bT(l,e,a))}function jT(e){return function(){var a=this.parentNode;for(var l in this.__transition)if(+l!==e)return;a&&a.removeChild(this)}}function NT(){return this.on("end.remove",jT(this._id))}function kT(e){var a=this._name,l=this._id;typeof e!="function"&&(e=Fp(e));for(var i=this._groups,r=i.length,u=new Array(r),d=0;d<r;++d)for(var h=i[d],g=h.length,p=u[d]=new Array(g),x,m,v=0;v<g;++v)(x=h[v])&&(m=e.call(x,x.__data__,v,h))&&("__data__"in x&&(m.__data__=x.__data__),p[v]=m,Zd(p[v],a,l,v,p,ms(x,l)));return new rl(u,this._parents,a,l)}function ST(e){var a=this._name,l=this._id;typeof e!="function"&&(e=hj(e));for(var i=this._groups,r=i.length,u=[],d=[],h=0;h<r;++h)for(var g=i[h],p=g.length,x,m=0;m<p;++m)if(x=g[m]){for(var v=e.call(x,x.__data__,m,g),k,T=ms(x,l),S=0,C=v.length;S<C;++S)(k=v[S])&&Zd(k,a,l,S,v,T);u.push(v),d.push(x)}return new rl(u,d,a,l)}var CT=bc.prototype.constructor;function ET(){return new CT(this._groups,this._parents)}function TT(e,a){var l,i,r;return function(){var u=Ui(this,e),d=(this.style.removeProperty(e),Ui(this,e));return u===d?null:u===l&&d===i?r:r=a(l=u,i=d)}}function $j(e){return function(){this.style.removeProperty(e)}}function MT(e,a,l){var i,r=l+"",u;return function(){var d=Ui(this,e);return d===r?null:d===i?u:u=a(i=d,l)}}function DT(e,a,l){var i,r,u;return function(){var d=Ui(this,e),h=l(this),g=h+"";return h==null&&(g=h=(this.style.removeProperty(e),Ui(this,e))),d===g?null:d===i&&g===r?u:(r=g,u=a(i=d,h))}}function _T(e,a){var l,i,r,u="style."+a,d="end."+u,h;return function(){var g=$s(this,e),p=g.on,x=g.value[u]==null?h||(h=$j(a)):void 0;(p!==l||r!==x)&&(i=(l=p).copy()).on(d,r=x),g.on=i}}function OT(e,a,l){var i=(e+="")=="transform"?A2:Rj;return a==null?this.styleTween(e,TT(e,i)).on("end.style."+e,$j(e)):typeof a=="function"?this.styleTween(e,DT(e,i,tg(this,"style."+e,a))).each(_T(this._id,e)):this.styleTween(e,MT(e,i,a),l).on("end.style."+e,null)}function AT(e,a,l){return function(i){this.style.setProperty(e,a.call(this,i),l)}}function IT(e,a,l){var i,r;function u(){var d=a.apply(this,arguments);return d!==r&&(i=(r=d)&&AT(e,d,l)),i}return u._value=a,u}function zT(e,a,l){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(a==null)return this.tween(i,null);if(typeof a!="function")throw new Error;return this.tween(i,IT(e,a,l??""))}function RT(e){return function(){this.textContent=e}}function $T(e){return function(){var a=e(this);this.textContent=a??""}}function LT(e){return this.tween("text",typeof e=="function"?$T(tg(this,"text",e)):RT(e==null?"":e+""))}function UT(e){return function(a){this.textContent=e.call(this,a)}}function HT(e){var a,l;function i(){var r=e.apply(this,arguments);return r!==l&&(a=(l=r)&&UT(r)),a}return i._value=e,i}function BT(e){var a="text";if(arguments.length<1)return(a=this.tween(a))&&a._value;if(e==null)return this.tween(a,null);if(typeof e!="function")throw new Error;return this.tween(a,HT(e))}function PT(){for(var e=this._name,a=this._id,l=Lj(),i=this._groups,r=i.length,u=0;u<r;++u)for(var d=i[u],h=d.length,g,p=0;p<h;++p)if(g=d[p]){var x=ms(g,a);Zd(g,e,l,p,d,{time:x.time+x.delay+x.duration,delay:0,duration:x.duration,ease:x.ease})}return new rl(i,this._parents,e,l)}
vendor: 11,745 bytes, line 9
9function YT(){var e,a,l=this,i=l._id,r=l.size();return new Promise(function(u,d){var h={value:d},g={value:function(){--r===0&&u()}};l.each(function(){var p=$s(this,i),x=p.on;x!==e&&(a=(e=x).copy(),a._.cancel.push(h),a._.interrupt.push(h),a._.end.push(g)),p.on=a}),r===0&&u()})}var VT=0;function rl(e,a,l,i){this._groups=e,this._parents=a,this._name=l,this._id=i}function Lj(){return++VT}var ll=bc.prototype;rl.prototype={constructor:rl,select:kT,selectAll:ST,selectChild:ll.selectChild,selectChildren:ll.selectChildren,filter:yT,merge:xT,selection:ET,transition:PT,call:ll.call,nodes:ll.nodes,node:ll.node,size:ll.size,empty:ll.empty,each:ll.each,on:wT,attr:tT,attrTween:oT,style:OT,styleTween:zT,text:LT,textTween:BT,remove:NT,tween:Z2,delay:cT,duration:hT,ease:mT,easeVarying:gT,end:YT,[Symbol.iterator]:ll[Symbol.iterator]};function qT(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var GT={time:null,delay:0,duration:250,ease:qT};function XT(e,a){for(var l;!(l=e.__transition)||!(l=l[a]);)if(!(e=e.parentNode))throw new Error(`transition ${a} not found`);return l}function ZT(e){var a,l;e instanceof rl?(a=e._id,e=e._name):(a=Lj(),(l=GT).time=Jp(),e=e==null?null:e+"");for(var i=this._groups,r=i.length,u=0;u<r;++u)for(var d=i[u],h=d.length,g,p=0;p<h;++p)(g=d[p])&&Zd(g,e,a,p,d,l||XT(g,a));return new rl(i,this._parents,e,a)}bc.prototype.interrupt=q2;bc.prototype.transition=ZT;const nd=e=>()=>e;function FT(e,{sourceEvent:a,target:l,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:a,enumerable:!0,configurable:!0},target:{value:l,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function ol(e,a,l){this.k=e,this.x=a,this.y=l}ol.prototype={constructor:ol,scale:function(e){return e===1?this:new ol(this.k*e,this.x,this.y)},translate:function(e,a){return e===0&a===0?this:new ol(this.k,this.x+this.k*e,this.y+this.k*a)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Fd=new ol(1,0,0);Uj.prototype=ol.prototype;function Uj(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Fd;return e.__zoom}function $m(e){e.stopImmediatePropagation()}function Fr(e){e.preventDefault(),e.stopImmediatePropagation()}function KT(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function QT(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function F0(){return this.__zoom||Fd}function WT(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function JT(){return navigator.maxTouchPoints||"ontouchstart"in this}function eM(e,a,l){var i=e.invertX(a[0][0])-l[0][0],r=e.invertX(a[1][0])-l[1][0],u=e.invertY(a[0][1])-l[0][1],d=e.invertY(a[1][1])-l[1][1];return e.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),d>u?(u+d)/2:Math.min(0,u)||Math.max(0,d))}function Hj(){var e=KT,a=QT,l=eM,i=WT,r=JT,u=[0,1/0],d=[[-1/0,-1/0],[1/0,1/0]],h=250,g=md,p=qd("start","zoom","end"),x,m,v,k=500,T=150,S=0,C=10;function z(L){L.property("__zoom",F0).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",U).filter(r).on("touchstart.zoom",Y).on("touchmove.zoom",q).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}z.transform=function(L,V,I,F){var _=L.selection?L.selection():L;_.property("__zoom",F0),L!==_?w(L,V,I,F):_.interrupt().each(function(){b(this,arguments).event(F).start().zoom(null,typeof V=="function"?V.apply(this,arguments):V).end()})},z.scaleBy=function(L,V,I,F){z.scaleTo(L,function(){var _=this.__zoom.k,H=typeof V=="function"?V.apply(this,arguments):V;return _*H},I,F)},z.scaleTo=function(L,V,I,F){z.transform(L,function(){var _=a.apply(this,arguments),H=this.__zoom,P=I==null?O(_):typeof I=="function"?I.apply(this,arguments):I,X=H.invert(P),ne=typeof V=="function"?V.apply(this,arguments):V;return l(j(E(H,ne),P,X),_,d)},I,F)},z.translateBy=function(L,V,I,F){z.transform(L,function(){return l(this.__zoom.translate(typeof V=="function"?V.apply(this,arguments):V,typeof I=="function"?I.apply(this,arguments):I),a.apply(this,arguments),d)},null,F)},z.translateTo=function(L,V,I,F,_){z.transform(L,function(){var H=a.apply(this,arguments),P=this.__zoom,X=F==null?O(H):typeof F=="function"?F.apply(this,arguments):F;return l(Fd.translate(X[0],X[1]).scale(P.k).translate(typeof V=="function"?-V.apply(this,arguments):-V,typeof I=="function"?-I.apply(this,arguments):-I),H,d)},F,_)};function E(L,V){return V=Math.max(u[0],Math.min(u[1],V)),V===L.k?L:new ol(V,L.x,L.y)}function j(L,V,I){var F=V[0]-I[0]*L.k,_=V[1]-I[1]*L.k;return F===L.x&&_===L.y?L:new ol(L.k,F,_)}function O(L){return[(+L[0][0]+ +L[1][0])/2,(+L[0][1]+ +L[1][1])/2]}function w(L,V,I,F){L.on("start.zoom",function(){b(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(F).end()}).tween("zoom",function(){var _=this,H=arguments,P=b(_,H).event(F),X=a.apply(_,H),ne=I==null?O(X):typeof I=="function"?I.apply(_,H):I,pe=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),R=_.__zoom,Q=typeof V=="function"?V.apply(_,H):V,le=g(R.invert(ne).concat(pe/R.k),Q.invert(ne).concat(pe/Q.k));return function(se){if(se===1)se=Q;else{var ie=le(se),K=pe/ie[2];se=new ol(K,ne[0]-ie[0]*K,ne[1]-ie[1]*K)}P.zoom(null,se)}})}function b(L,V,I){return!I&&L.__zooming||new A(L,V)}function A(L,V){this.that=L,this.args=V,this.active=0,this.sourceEvent=null,this.extent=a.apply(L,V),this.taps=0}A.prototype={event:function(L){return L&&(this.sourceEvent=L),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(L,V){return this.mouse&&L!=="mouse"&&(this.mouse[1]=V.invert(this.mouse[0])),this.touch0&&L!=="touch"&&(this.touch0[1]=V.invert(this.touch0[0])),this.touch1&&L!=="touch"&&(this.touch1[1]=V.invert(this.touch1[0])),this.that.__zoom=V,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(L){var V=Na(this.that).datum();p.call(L,this.that,new FT(L,{sourceEvent:this.sourceEvent,target:z,transform:this.that.__zoom,dispatch:p}),V)}};function D(L,...V){if(!e.apply(this,arguments))return;var I=b(this,V).event(L),F=this.__zoom,_=Math.max(u[0],Math.min(u[1],F.k*Math.pow(2,i.apply(this,arguments)))),H=os(L);if(I.wheel)(I.mouse[0][0]!==H[0]||I.mouse[0][1]!==H[1])&&(I.mouse[1]=F.invert(I.mouse[0]=H)),clearTimeout(I.wheel);else{if(F.k===_)return;I.mouse=[H,F.invert(H)],yd(this),I.start()}Fr(L),I.wheel=setTimeout(P,T),I.zoom("mouse",l(j(E(F,_),I.mouse[0],I.mouse[1]),I.extent,d));function P(){I.wheel=null,I.end()}}function M(L,...V){if(v||!e.apply(this,arguments))return;var I=L.currentTarget,F=b(this,V,!0).event(L),_=Na(L.view).on("mousemove.zoom",ne,!0).on("mouseup.zoom",pe,!0),H=os(L,I),P=L.clientX,X=L.clientY;Nj(L.view),$m(L),F.mouse=[H,this.__zoom.invert(H)],yd(this),F.start();function ne(R){if(Fr(R),!F.moved){var Q=R.clientX-P,le=R.clientY-X;F.moved=Q*Q+le*le>S}F.event(R).zoom("mouse",l(j(F.that.__zoom,F.mouse[0]=os(R,I),F.mouse[1]),F.extent,d))}function pe(R){_.on("mousemove.zoom mouseup.zoom",null),kj(R.view,F.moved),Fr(R),F.event(R).end()}}function U(L,...V){if(e.apply(this,arguments)){var I=this.__zoom,F=os(L.changedTouches?L.changedTouches[0]:L,this),_=I.invert(F),H=I.k*(L.shiftKey?.5:2),P=l(j(E(I,H),F,_),a.apply(this,V),d);Fr(L),h>0?Na(this).transition().duration(h).call(w,P,F,L):Na(this).call(z.transform,P,F,L)}}function Y(L,...V){if(e.apply(this,arguments)){var I=L.touches,F=I.length,_=b(this,V,L.changedTouches.length===F).event(L),H,P,X,ne;for($m(L),P=0;P<F;++P)X=I[P],ne=os(X,this),ne=[ne,this.__zoom.invert(ne),X.identifier],_.touch0?!_.touch1&&_.touch0[2]!==ne[2]&&(_.touch1=ne,_.taps=0):(_.touch0=ne,H=!0,_.taps=1+!!x);x&&(x=clearTimeout(x)),H&&(_.taps<2&&(m=ne[0],x=setTimeout(function(){x=null},k)),yd(this),_.start())}}function q(L,...V){if(this.__zooming){var I=b(this,V).event(L),F=L.changedTouches,_=F.length,H,P,X,ne;for(Fr(L),H=0;H<_;++H)P=F[H],X=os(P,this),I.touch0&&I.touch0[2]===P.identifier?I.touch0[0]=X:I.touch1&&I.touch1[2]===P.identifier&&(I.touch1[0]=X);if(P=I.that.__zoom,I.touch1){var pe=I.touch0[0],R=I.touch0[1],Q=I.touch1[0],le=I.touch1[1],se=(se=Q[0]-pe[0])*se+(se=Q[1]-pe[1])*se,ie=(ie=le[0]-R[0])*ie+(ie=le[1]-R[1])*ie;P=E(P,Math.sqrt(se/ie)),X=[(pe[0]+Q[0])/2,(pe[1]+Q[1])/2],ne=[(R[0]+le[0])/2,(R[1]+le[1])/2]}else if(I.touch0)X=I.touch0[0],ne=I.touch0[1];else return;I.zoom("touch",l(j(P,X,ne),I.extent,d))}}function W(L,...V){if(this.__zooming){var I=b(this,V).event(L),F=L.changedTouches,_=F.length,H,P;for($m(L),v&&clearTimeout(v),v=setTimeout(function(){v=null},k),H=0;H<_;++H)P=F[H],I.touch0&&I.touch0[2]===P.identifier?delete I.touch0:I.touch1&&I.touch1[2]===P.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(P=os(P,this),Math.hypot(m[0]-P[0],m[1]-P[1])<C)){var X=Na(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return z.wheelDelta=function(L){return arguments.length?(i=typeof L=="function"?L:nd(+L),z):i},z.filter=function(L){return arguments.length?(e=typeof L=="function"?L:nd(!!L),z):e},z.touchable=function(L){return arguments.length?(r=typeof L=="function"?L:nd(!!L),z):r},z.extent=function(L){return arguments.length?(a=typeof L=="function"?L:nd([[+L[0][0],+L[0][1]],[+L[1][0],+L[1][1]]]),z):a},z.scaleExtent=function(L){return arguments.length?(u[0]=+L[0],u[1]=+L[1],z):[u[0],u[1]]},z.translateExtent=function(L){return arguments.length?(d[0][0]=+L[0][0],d[1][0]=+L[1][0],d[0][1]=+L[0][1],d[1][1]=+L[1][1],z):[[d[0][0],d[0][1]],[d[1][0],d[1][1]]]},z.constrain=function(L){return arguments.length?(l=L,z):l},z.duration=function(L){return arguments.length?(h=+L,z):h},z.interpolate=function(L){return arguments.length?(g=L,z):g},z.on=function(){var L=p.on.apply(p,arguments);return L===p?z:L},z.clickDistance=function(L){return arguments.length?(S=(L=+L)*L,z):Math.sqrt(S)},z.tapDistance=function(L){return arguments.length?(C=+L,z):C},z}const ds={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.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:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The 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:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:a,sourceHandle:l,targetHandle:i})=>`Couldn't create edge for ${e} handle id: "${e==="source"?l:i}", edge id: ${a}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>
9`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},dc=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Bj=["Enter"," ","Escape"],Pj={"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:e,x:a,y:l})=>`Moved selected node ${e}. New position, x: ${a}, y: ${l}`,"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 Bi;(function(e){e.Strict="strict",e.Loose="loose"})(Bi||(Bi={}));var _o;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(_o||(_o={}));var hc;(function(e){e.Partial="partial",e.Full="full"})(hc||(hc={}));const Yj={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pl||(Pl={}));var Dd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Dd||(Dd={}));var Ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ye||(Ye={}));const K0={[Ye.Left]:Ye.Right,[Ye.Right]:Ye.Left,[Ye.Top]:Ye.Bottom,[Ye.Bottom]:Ye.Top},Vj=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,tM=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),ng=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),jc=(e,a=[0,0])=>{const{width:l,height:i}=ps(e),r=e.origin??a,u=l*r[0],d=i*r[1];return{x:e.position.x-u,y:e.position.y-d}},nM=(e,a={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let l=!1;const i=e.reduce((r,u)=>{const d=typeof u=="string";let h=!a.nodeLookup&&!d?u:void 0;return a.nodeLookup&&(h=d?a.nodeLookup.get(u):ng(u)?u:a.nodeLookup.get(u.id)),h?(l=!0,Kd(r,_d(h,a.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return l?Qd(i):{x:0,y:0,width:0,height:0}},Xi=(e,a={})=>{let l={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return e.forEach(r=>{(a.filter===void 0||a.filter(r))&&(l=Kd(l,_d(r)),i=!0)}),i?Qd(l):{x:0,y:0,width:0,height:0}},ag=(e,a,[l,i,r]=[0,0,1],u=!1,d=!1)=>{const h=(a.x-l)/r,g=(a.y-i)/r,p=a.width/r,x=a.height/r,m=[];for(const v of e.values()){const{measured:k,selectable:T=!0,hidden:S=!1}=v;if(d&&!T||S)continue;const C=k.width??v.width??v.initialWidth??0,z=k.height??v.height??v.initialHeight??0,{x:E,y:j}=v.internals.positionAbsolute,O=Zj(h,g,p,x,E,j,C,z),w=C*z,b=u&&O>0;(!v.internals.handleBounds||b||O>=w||v.dragging)&&m.push(v)}return m},aM=(e,a)=>{const l=new Set;return e.forEach(i=>{l.add(i.id)}),a.filter(i=>l.has(i.source)||l.has(i.target))};function sM(e,a){const l=new Map,i=a?.nodes?new Set(a.nodes.map(r=>r.id)):null;return e.forEach(r=>{let u;if(a?.includeHiddenNodes){const{width:d,height:h}=ps(r);u=d>0&&h>0}else u=!!(r.measured.width&&r.measured.height&&!r.hidden);u&&(!i||i.has(r.id))&&l.set(r.id,r)}),l}async function lM({nodes:e,width:a,height:l,panZoom:i,minZoom:r,maxZoom:u},d){if(e.size===0)return!0;const h=sM(e,d),g=Xi(h),p=lg(g,a,l,d?.minZoom??r,d?.maxZoom??u,d?.padding??.1);
9return await i.setViewport(p,{duration:d?.duration,ease:d?.ease,interpolate:d?.interpolate}),!0}function qj({nodeId:e,nextPosition:a,nodeLookup:l,nodeOrigin:i=[0,0],nodeExtent:r,onError:u}){const d=l.get(e),h=d.parentId?l.get(d.parentId):void 0,{x:g,y:p}=h?h.internals.positionAbsolute:{x:0,y:0},x=d.origin??i;let m=d.extent||r;if(d.extent==="parent"&&!d.expandParent)if(!h)u?.("005",ds.error005());else{const{width:k,height:T}=ps(h);k&&T&&(m=[[g,p],[g+k,p+T]])}else h&&zo(d.extent)&&(m=[[d.extent[0][0]+g,d.extent[0][1]+p],[d.extent[1][0]+g,d.extent[1][1]+p]]);const v=zo(m)?Io(a,m,d.measured):a;return(d.measured.width===void 0||d.measured.height===void 0)&&u?.("015",ds.error015()),{position:{x:v.x-g+(d.measured.width??0)*x[0],y:v.y-p+(d.measured.height??0)*x[1]},positionAbsolute:v}}async function oM({nodesToRemove:e=[],edgesToRemove:a=[],nodes:l,edges:i,onBeforeDelete:r}){const u=new Set(e.map(v=>v.id)),d=[];for(const v of l){if(v.deletable===!1)continue;const k=u.has(v.id),T=!k&&v.parentId&&d.find(S=>S.id===v.parentId);(k||T)&&d.push(v)}const h=new Set(a.map(v=>v.id)),g=i.filter(v=>v.deletable!==!1),x=aM(d,g);for(const v of g)h.has(v.id)&&!x.find(T=>T.id===v.id)&&x.push(v);if(!r)return{edges:x,nodes:d};const m=await r({nodes:d,edges:x});return typeof m=="boolean"?m?{edges:x,nodes:d}:{edges:[],nodes:[]}:m}const Pi=(e,a=0,l=1)=>Math.min(Math.max(e,a),l),Io=(e={x:0,y:0},a,l)=>({x:Pi(e.x,a[0][0],a[1][0]-(l?.width??0)),y:Pi(e.y,a[0][1],a[1][1]-(l?.height??0))});function Gj(e,a,l){const{width:i,height:r}=ps(l),{x:u,y:d}=l.internals.positionAbsolute;return Io(e,[[u,d],[u+i,d+r]],a)}const Q0=(e,a,l)=>e<a?Pi(Math.abs(e-a),1,a)/a:e>l?-Pi(Math.abs(e-l),1,a)/a:0,sg=(e,a,l=15,i=40)=>{const r=Q0(e.x,i,a.width-i)*l,u=Q0(e.y,i,a.height-i)*l;return[r,u]},Kd=(e,a)=>({x:Math.min(e.x,a.x),y:Math.min(e.y,a.y),x2:Math.max(e.x2,a.x2),y2:Math.max(e.y2,a.y2)}),_p=({x:e,y:a,width:l,height:i})=>({x:e,y:a,x2:e+l,y2:a+i}),Qd=({x:e,y:a,x2:l,y2:i})=>({x:e,y:a,width:l-e,height:i-a}),fc=(e,a=[0,0])=>{const{x:l,y:i}=ng(e)?e.internals.positionAbsolute:jc(e,a);return{x:l,y:i,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},_d=(e,a=[0,0])=>{const{x:l,y:i}=ng(e)?e.internals.positionAbsolute:jc(e,a);return{x:l,y:i,x2:l+(e.measured?.width??e.width??e.initialWidth??0),y2:i+(e.measured?.height??e.height??e.initialHeight??0)}},Xj=(e,a)=>Qd(Kd(_p(e),_p(a))),Zj=(e,a,l,i,r,u,d,h)=>{const g=Math.max(0,Math.min(e+l,r+d)-Math.max(e,r)),p=Math.max(0,Math.min(a+i,u+h)-Math.max(a,u));return Math.ceil(g*p)},Od=(e,a)=>Zj(e.x,e.y,e.width,e.height,a.x,a.y,a.width,a.height),W0=e=>rs(e.width)&&rs(e.height)&&rs(e.x)&&rs(e.y),rs=e=>!isNaN(e)&&isFinite(e),Fj=(e,a)=>(l,i)=>{},Nc=(e,a=[1,1])=>({x:a[0]*Math.round(e.x/a[0]),y:a[1]*Math.round(e.y/a[1])}),kc=({x:e,y:a},[l,i,r],u=!1,d=[1,1])=>{const h={x:(e-l)/r,y:(a-i)/r};return u?Nc(h,d):h},Yi=({x:e,y:a},[l,i,r])=>({x:e*r+l,y:a*r+i});function Di(e,a){if(typeof e=="number")return Math.floor((a-a/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const l=parseFloat(e);if(!Number.isNaN(l))return Math.floor(l)}if(typeof e=="string"&&e.endsWith("%")){const l=parseFloat(e);if(!Number.isNaN(l))return Math.floor(a*l*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function iM(e,a,l){if(typeof e=="string"||typeof e=="number"){const i=Di(e,l),r=Di(e,a);return{top:i,right:r,bottom:i,left:r,x:r*2,y:i*2}}if(typeof e=="object"){const i=Di(e.top??e.y??0,l),r=Di(e.bottom??e.y??0,l),u=Di(e.left??e.x??0,a),d=Di(e.right??e.x??0,a);return{top:i,right:d,bottom:r,left:u,x:u+d,y:i+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function rM(e,a,l,i,r,u){const{x:d,y:h}=Yi(e,[a,l,i]),{x:g,y:p}=Yi({x:e.x+e.width,y:e.y+e.height},[a,l,i]),x=r-g,m=u-p;return{left:Math.floor(d),top:Math.floor(h),right:Math.floor(x),bottom:Math.floor(m)}}const lg=(e,a,l,i,r,u)=>{const d=iM(u,a,l),h=(a-d.x)/e.width,g=(l-d.y)/e.height,p=Math.min(h,g),x=Pi(p,i,r),m=e.x+e.width/2,v=e.y+e.height/2,k=a/2-m*x,T=l/2-v*x,S=rM(e,k,T,x,a,l),C={left:Math.min(S.left-d.left,0),top:Math.min(S.top-d.top,0),right:Math.min(S.right-d.right,0),bottom:Math.min(S.bottom-d.bottom,0)};return{x:k-C.left+C.right,y:T-C.top+C.bottom,zoom:x}},mc=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function zo(e){return e!=null&&e!=="parent"}function ps(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Kj(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Qj(e,a={width:0,height:0},l,i,r){const u={...e},d=i.get(l);if(d){const h=d.origin||r;u.x+=d.internals.positionAbsolute.x-(a.width??0)*h[0],u.y+=d.internals.positionAbsolute.y-(a.height??0)*h[1]}return u}function J0(e,a){if(e.size!==a.size)return!1;for(const l of e)if(!a.has(l))return!1;return!0}function cM(){let e,a;return{promise:new Promise((i,r)=>{e=i,a=r}),resolve:e,reject:a}}function uM(e){return{...Pj,...e||{}}}function Wj(e){return e===null?null:e?"valid":"invalid"}
9function ac(e,{snapGrid:a=[0,0],snapToGrid:l=!1,transform:i,containerBounds:r}){const{x:u,y:d}=cs(e),h=kc({x:u-(r?.left??0),y:d-(r?.top??0)},i),{x:g,y:p}=l?Nc(h,a):h;return{xSnapped:g,ySnapped:p,...h}}const og=e=>({width:e.offsetWidth,height:e.offsetHeight}),Jj=e=>e?.getRootNode?.()||window?.document,dM=["INPUT","SELECT","TEXTAREA"];function eN(e){const a=e.composedPath?.()?.[0]||e.target;return a?.nodeType!==1?!1:dM.includes(a.nodeName)||a.hasAttribute("contenteditable")||!!a.closest(".nokey")}const tN=e=>"clientX"in e,cs=(e,a)=>{const l=tN(e),i=l?e.clientX:e.touches?.[0].clientX,r=l?e.clientY:e.touches?.[0].clientY;return{x:i-(a?.left??0),y:r-(a?.top??0)}},eb=(e,a,l,i,r)=>{const u=a.querySelectorAll(`.${e}`);return!u||!u.length?null:Array.from(u).map(d=>{const h=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),type:e,nodeId:r,position:d.getAttribute("data-handlepos"),x:(h.left-l.left)/i,y:(h.top-l.top)/i,...og(d)}})};function nN({sourceX:e,sourceY:a,targetX:l,targetY:i,sourceControlX:r,sourceControlY:u,targetControlX:d,targetControlY:h}){const g=e*.125+r*.375+d*.375+l*.125,p=a*.125+u*.375+h*.375+i*.125,x=Math.abs(g-e),m=Math.abs(p-a);return[g,p,x,m]}function ad(e,a){return e>=0?.5*e:a*25*Math.sqrt(-e)}function tb({pos:e,x1:a,y1:l,x2:i,y2:r,c:u}){switch(e){case Ye.Left:return[a-ad(a-i,u),l];case Ye.Right:return[a+ad(i-a,u),l];case Ye.Top:return[a,l-ad(l-r,u)];case Ye.Bottom:return[a,l+ad(r-l,u)]}}function ig({sourceX:e,sourceY:a,sourcePosition:l=Ye.Bottom,targetX:i,targetY:r,targetPosition:u=Ye.Top,curvature:d=.25}){const[h,g]=tb({pos:l,x1:e,y1:a,x2:i,y2:r,c:d}),[p,x]=tb({pos:u,x1:i,y1:r,x2:e,y2:a,c:d}),[m,v,k,T]=nN({sourceX:e,sourceY:a,targetX:i,targetY:r,sourceControlX:h,sourceControlY:g,targetControlX:p,targetControlY:x});return[`M${e},${a} C${h},${g} ${p},${x} ${i},${r}`,m,v,k,T]}function aN({sourceX:e,sourceY:a,targetX:l,targetY:i}){const r=Math.abs(l-e)/2,u=l<e?l+r:l-r,d=Math.abs(i-a)/2,h=i<a?i+d:i-d;return[u,h,r,d]}function hM({sourceNode:e,targetNode:a,selected:l=!1,zIndex:i=0,elevateOnSelect:r=!1,zIndexMode:u="basic"}){if(u==="manual")return i;const d=r&&l?i+1e3:i,h=Math.max(e.parentId||r&&e.selected?e.internals.z:0,a.parentId||r&&a.selected?a.internals.z:0);return d+h}function fM({sourceNode:e,targetNode:a,width:l,height:i,transform:r}){const u=Kd(_d(e),_d(a));u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const d={x:-r[0]/r[2],y:-r[1]/r[2],width:l/r[2],height:i/r[2]};return Od(d,Qd(u))>0}const mM=({source:e,sourceHandle:a,target:l,targetHandle:i})=>`xy-edge__${e}${a||""}-${l}${i||""}`,pM=(e,a)=>a.some(l=>l.source===e.source&&l.target===e.target&&(l.sourceHandle===e.sourceHandle||!l.sourceHandle&&!e.sourceHandle)&&(l.targetHandle===e.targetHandle||!l.targetHandle&&!e.targetHandle)),gM=(e,a,l={})=>{if(!e.source||!e.target)return l.onError?.("006",ds.error006()),a;const i=l.getEdgeId||mM;let r;return Vj(e)?r={...e}:r={...e,id:i(e)},pM(r,a)?a:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,a.concat(r))};function rg({sourceX:e,sourceY:a,targetX:l,targetY:i}){const[r,u,d,h]=aN({sourceX:e,sourceY:a,targetX:l,targetY:i});return[`M ${e},${a}L ${l},${i}`,r,u,d,h]}const nb={[Ye.Left]:{x:-1,y:0},[Ye.Right]:{x:1,y:0},[Ye.Top]:{x:0,y:-1},[Ye.Bottom]:{x:0,y:1}},yM=({source:e,sourcePosition:a=Ye.Bottom,target:l})=>a===Ye.Left||a===Ye.Right?e.x<l.x?{x:1,y:0}:{x:-1,y:0}:e.y<l.y?{x:0,y:1}:{x:0,y:-1},ab=(e,a)=>Math.sqrt(Math.pow(a.x-e.x,2)+Math.pow(a.y-e.y,2));function xM({source:e,sourcePosition:a=Ye.Bottom,target:l,targetPosition:i=Ye.Top,center:r,offset:u,stepPosition:d}){const h=nb[a],g=nb[i],p={x:e.x+h.x*u,y:e.y+h.y*u},x={x:l.x+g.x*u,y:l.y+g.y*u},m=yM({source:p,sourcePosition:a,target:x}),v=m.x!==0?"x":"y",k=m[v];let T=[],S,C;const z={x:0,y:0},E={x:0,y:0},[,,j,O]=aN({sourceX:e.x,sourceY:e.y,targetX:l.x,targetY:l.y});if(h[v]*g[v]===-1){v==="x"?(S=r.x??p.x+(x.x-p.x)*d,C=r.y??(p.y+x.y)/2):(S=r.x??(p.x+x.x)/2,C=r.y??p.y+(x.y-p.y)*d);const D=[{x:S,y:p.y},{x:S,y:x.y}],M=[{x:p.x,y:C},{x:x.x,y:C}];h[v]===k?T=v==="x"?D:M:T=v==="x"?M:D}else{const D=[{x:p.x,y:x.y}],M=[{x:x.x,y:p.y}];if(v==="x"?T=h.x===k?M:D:T=h.y===k?D:M,a===i){const L=Math.abs(e[v]-l[v]);if(L<=u){const V=Math.min(u-1,u-L);h[v]===k?z[v]=(p[v]>e[v]?-1:1)*V:E[v]=(x[v]>l[v]?-1:1)*V}}if(a!==i){const L=v==="x"?"y":"x",V=h[v]===g[L],I=p[L]>x[L],F=p[L]<x[L];(h[v]===1&&(!V&&I||V&&F)||h[v]!==1&&(!V&&F||V&&I))&&(T=v==="x"?D:M)}const U={x:p.x+z.x,y:p.y+z.y},Y={x:x.x+E.x,y:x.y+E.y},q=Math.max(Math.abs(U.x-T[0].x),Math.abs(Y.x-T[0].x)),W=Math.max(Math.abs(U.y-T[0].y),Math.abs(Y.y-T[0].y));q>=W?(S=(U.x+Y.x)/2,C=T[0].y):(S=T[0].x,C=(U.y+Y.y)/2)}const w={x:p.x+z.x,y:p.y+z.y},b={x:x.x+E.x,y:x.y+E.y};return[[e,...w.x!==T[0].x||w.y!==T[0].y?[w]:[],...T,...b.x!==T[T.length-1].x||b.y!==T[T.length-1].y?[b]:[],l],S,C,j,O]}function vM(e,a,l,i){const r=Math.min(ab(e,a)/2,ab(a,l)/2,i),{x:u,y:d}=a;if(e.x===u&&u===l.x||e.y===d&&d===l.y)return`L${u} ${d}`;if(e.y===d){const p=e.x<l.x?-1:1,x=e.y<l.y?1:-1;return`L ${u+r*p},${d}Q ${u},${d} ${u},${d+r*x}`}const h=e.x<l.x?1:-1,g=e.y<l.y?-1:1;return`L ${u},${d+r*g}Q ${u},${d} ${u+r*h},${d}`}function Ad({sourceX:e,sourceY:a,sourcePosition:l=Ye.Bottom,targetX:i,targetY:r,targetPosition:u=Ye.Top,borderRadius:d=5,centerX:h,centerY:g,offset:p=20,stepPosition:x=.5}){const[m,v,k,T,S]=xM({source:{x:e,y:a},sourcePosition:l,target:{x:i,y:r},targetPosition:u,center:{x:h,y:g},offset:p,stepPosition:x});let C=`M${m[0].x} ${m[0].y}`;for(let z=1;z<m.length-1;z++)C+=vM(m[z-1],m[z],m[z+1],d);return C+=`L${m[m.length-1].x} ${m[m.length-1].y}`,[C,v,k,T,S]}
9function sb(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function bM(e){const{sourceNode:a,targetNode:l}=e;if(!sb(a)||!sb(l))return null;const i=a.internals.handleBounds||lb(a.handles),r=l.internals.handleBounds||lb(l.handles),u=ob(i?.source??[],e.sourceHandle),d=ob(e.connectionMode===Bi.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!u||!d)return e.onError?.("008",ds.error008(u?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const h=u?.position||Ye.Bottom,g=d?.position||Ye.Top,p=Ro(a,u,h),x=Ro(l,d,g);return{sourceX:p.x,sourceY:p.y,targetX:x.x,targetY:x.y,sourcePosition:h,targetPosition:g}}function lb(e){if(!e)return null;const a=[],l=[];for(const i of e)i.width=i.width??1,i.height=i.height??1,i.type==="source"?a.push(i):i.type==="target"&&l.push(i);return{source:a,target:l}}function Ro(e,a,l=Ye.Left,i=!1){const r=(a?.x??0)+e.internals.positionAbsolute.x,u=(a?.y??0)+e.internals.positionAbsolute.y,{width:d,height:h}=a??ps(e);if(i)return{x:r+d/2,y:u+h/2};switch(a?.position??l){case Ye.Top:return{x:r+d/2,y:u};case Ye.Right:return{x:r+d,y:u+h/2};case Ye.Bottom:return{x:r+d/2,y:u+h};case Ye.Left:return{x:r,y:u+h/2}}}function ob(e,a){return e&&(a?e.find(l=>l.id===a):e[0])||null}function Op(e,a){return e?typeof e=="string"?e:`${a?`${a}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function wM(e,{id:a,defaultColor:l,defaultMarkerStart:i,defaultMarkerEnd:r}){const u=new Set;return e.reduce((d,h)=>([h.markerStart||i,h.markerEnd||r].forEach(g=>{if(g&&typeof g=="object"){const p=Op(g,a);u.has(p)||(d.push({id:p,color:g.color||l,...g}),u.add(p))}}),d),[]).sort((d,h)=>d.id.localeCompare(h.id))}function jM(e,a,l,i,r){let u=.5;r==="start"?u=0:r==="end"&&(u=1);let d=[(e.x+e.width*u)*a.zoom+a.x,e.y*a.zoom+a.y-i],h=[-100*u,-100];switch(l){case Ye.Right:d=[(e.x+e.width)*a.zoom+a.x+i,(e.y+e.height*u)*a.zoom+a.y],h=[0,-100*u];break;case Ye.Bottom:d[1]=(e.y+e.height)*a.zoom+a.y+i,h[1]=0;break;case Ye.Left:d=[e.x*a.zoom+a.x-i,(e.y+e.height*u)*a.zoom+a.y],h=[-100,-100*u];break}return`translate(${d[0]}px, ${d[1]}px) translate(${h[0]}%, ${h[1]}%)`}const sN=1e3,NM=10,cg={nodeOrigin:[0,0],nodeExtent:dc,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},kM={...cg,checkEquality:!0};function ug(e,a){const l={...e};for(const i in a)a[i]!==void 0&&(l[i]=a[i]);return l}function SM(e,a,l){const i=ug(cg,l);for(const r of e.values())if(r.parentId)hg(r,e,a,i);else{const u=jc(r,i.nodeOrigin),d=zo(r.extent)?r.extent:i.nodeExtent,h=Io(u,d,ps(r));r.internals.positionAbsolute=h}}function CM(e,a){if(!e.handles)return e.measured?a?.internals.handleBounds:void 0;const l=[],i=[];for(const r of e.handles){const u={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?l.push(u):r.type==="target"&&i.push(u)}return{source:l,target:i}}function dg(e){return e==="manual"}function Ap(e,a,l,i={}){const r=ug(kM,i),u={i:0},d=new Map(a),h=r?.elevateNodesOnSelect&&!dg(r.zIndexMode)?sN:0;let g=e.length>0,p=!1;a.clear(),l.clear();for(const x of e){let m=d.get(x.id);if(r.checkEquality&&x===m?.internals.userNode)a.set(x.id,m);else{const v=jc(x,r.nodeOrigin),k=zo(x.extent)?x.extent:r.nodeExtent,T=Io(v,k,ps(x));m={...r.defaults,...x,measured:{width:x.measured?.width,height:x.measured?.height},internals:{positionAbsolute:T,handleBounds:CM(x,m),z:lN(x,h,r.zIndexMode),userNode:x}},a.set(x.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(g=!1),x.parentId&&hg(m,a,l,i,u),p||=x.selected??!1}return{nodesInitialized:g,hasSelectedNodes:p}}function EM(e,a){if(!e.parentId)return;const l=a.get(e.parentId);l?l.set(e.id,e):a.set(e.parentId,new Map([[e.id,e]]))}function hg(e,a,l,i,r){const{elevateNodesOnSelect:u,nodeOrigin:d,nodeExtent:h,zIndexMode:g}=ug(cg,i),p=e.parentId,x=a.get(p);if(!x){console.warn(`Parent node ${p} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}EM(e,l),r&&!x.parentId&&x.internals.rootParentIndex===void 0&&g==="auto"&&(x.internals.rootParentIndex=++r.i,x.internals.z=x.internals.z+r.i*NM),r&&x.internals.rootParentIndex!==void 0&&(r.i=x.internals.rootParentIndex);const m=u&&!dg(g)?sN:0,{x:v,y:k,z:T}=TM(e,x,d,h,m,g),{positionAbsolute:S}=e.internals,C=v!==S.x||k!==S.y;(C||T!==e.internals.z)&&a.set(e.id,{...e,internals:{...e.internals,positionAbsolute:C?{x:v,y:k}:S,z:T}})}function lN(e,a,l){const i=rs(e.zIndex)?e.zIndex:0;return dg(l)?i:i+(e.selected?a:0)}function TM(e,a,l,i,r,u){const{x:d,y:h}=a.internals.positionAbsolute,g=ps(e),p=jc(e,l),x=zo(e.extent)?Io(p,e.extent,g):p;let m=Io({x:d+x.x,y:h+x.y},i,g);e.extent==="parent"&&(m=Gj(m,g,a));const v=lN(e,r,u),k=a.internals.z??0;
9return{x:m.x,y:m.y,z:k>=v?k+1:v}}function fg(e,a,l,i=[0,0]){const r=[],u=new Map;for(const d of e){const h=a.get(d.parentId);if(!h)continue;const g=u.get(d.parentId)?.expandedRect??fc(h),p=Xj(g,d.rect);u.set(d.parentId,{expandedRect:p,parent:h})}return u.size>0&&u.forEach(({expandedRect:d,parent:h},g)=>{const p=h.internals.positionAbsolute,x=ps(h),m=h.origin??i,v=d.x<p.x?Math.round(Math.abs(p.x-d.x)):0,k=d.y<p.y?Math.round(Math.abs(p.y-d.y)):0,T=Math.max(x.width,Math.round(d.width)),S=Math.max(x.height,Math.round(d.height)),C=(T-x.width)*m[0],z=(S-x.height)*m[1];(v>0||k>0||C||z)&&(r.push({id:g,type:"position",position:{x:h.position.x-v+C,y:h.position.y-k+z}}),l.get(g)?.forEach(E=>{e.some(j=>j.id===E.id)||r.push({id:E.id,type:"position",position:{x:E.position.x+v,y:E.position.y+k}})})),(x.width<d.width||x.height<d.height||v||k)&&r.push({id:g,type:"dimensions",setAttributes:!0,dimensions:{width:T+(v?m[0]*v-C:0),height:S+(k?m[1]*k-z:0)}})}),r}function MM(e,a,l,i,r,u,d){const h=i?.querySelector(".xyflow__viewport");let g=!1;if(!h)return{changes:[],updatedInternals:g};const p=[],x=window.getComputedStyle(h),{m22:m}=new window.DOMMatrixReadOnly(x.transform),v=[];for(const k of e.values()){const T=a.get(k.id);if(!T)continue;if(T.hidden){a.set(T.id,{...T,internals:{...T.internals,handleBounds:void 0}}),g=!0;continue}const S=og(k.nodeElement),C=T.measured.width!==S.width||T.measured.height!==S.height;if(!!(S.width&&S.height&&(C||!T.internals.handleBounds||k.force))){const E=k.nodeElement.getBoundingClientRect(),j=zo(T.extent)?T.extent:u;let{positionAbsolute:O}=T.internals;if(T.parentId&&T.extent==="parent"){const b=a.get(T.parentId);b&&(O=Gj(O,S,b))}else j&&(O=Io(O,j,S));const w={...T,measured:S,internals:{...T.internals,positionAbsolute:O,handleBounds:{source:eb("source",k.nodeElement,E,m,T.id),target:eb("target",k.nodeElement,E,m,T.id)}}};a.set(T.id,w),T.parentId&&hg(w,a,l,{nodeOrigin:r,zIndexMode:d}),g=!0,C&&(p.push({id:T.id,type:"dimensions",dimensions:S}),T.expandParent&&T.parentId&&v.push({id:T.id,parentId:T.parentId,rect:fc(w,r)}))}}if(v.length>0){const k=fg(v,a,l,r);p.push(...k)}return{changes:p,updatedInternals:g}}async function DM({delta:e,panZoom:a,transform:l,translateExtent:i,width:r,height:u}){if(!a||!e.x&&!e.y)return!1;const d=await a.setViewportConstrained({x:l[0]+e.x,y:l[1]+e.y,zoom:l[2]},[[0,0],[r,u]],i);return!!d&&(d.x!==l[0]||d.y!==l[1]||d.k!==l[2])}function ib(e,a,l,i,r,u){let d=r;const h=i.get(d)||new Map;i.set(d,h.set(l,a)),d=`${r}-${e}`;const g=i.get(d)||new Map;if(i.set(d,g.set(l,a)),u){d=`${r}-${e}-${u}`;const p=i.get(d)||new Map;i.set(d,p.set(l,a))}}function oN(e,a,l){e.clear(),a.clear();for(const i of l){const{source:r,target:u,sourceHandle:d=null,targetHandle:h=null}=i,g={edgeId:i.id,source:r,target:u,sourceHandle:d,targetHandle:h},p=`${r}-${d}--${u}-${h}`,x=`${u}-${h}--${r}-${d}`;ib("source",g,x,e,r,d),ib("target",g,p,e,u,h),a.set(i.id,i)}}function iN(e,a){if(!e.parentId)return!1;const l=a.get(e.parentId);return l?l.selected?!0:iN(l,a):!1}function rb(e,a,l){let i=e;do{if(i?.matches?.(a))return!0;if(i===l)return!1;i=i?.parentElement}while(i);return!1}function _M(e,a,l,i){const r=new Map;for(const[u,d]of e)if((d.selected||d.id===i)&&(!d.parentId||!iN(d,e))&&(d.draggable||a&&typeof d.draggable>"u")){const h=e.get(u);h&&r.set(u,{id:u,position:h.position||{x:0,y:0},distance:{x:l.x-h.internals.positionAbsolute.x,y:l.y-h.internals.positionAbsolute.y},extent:h.extent,parentId:h.parentId,origin:h.origin,expandParent:h.expandParent,internals:{positionAbsolute:h.internals.positionAbsolute||{x:0,y:0}},measured:{width:h.measured.width??0,height:h.measured.height??0}})}return r}function Lm({nodeId:e,dragItems:a,nodeLookup:l,dragging:i=!0}){const r=[];for(const[d,h]of a){const g=l.get(d)?.internals.userNode;g&&r.push({...g,position:h.position,dragging:i})}if(!e)return[r[0],r];const u=l.get(e)?.internals.userNode;return[u?{...u,position:a.get(e)?.position||u.position,dragging:i}:r[0],r]}function OM({dragItems:e,snapGrid:a,x:l,y:i}){const r=e.values().next().value;if(!r)return null;const u={x:l-r.distance.x,y:i-r.distance.y},d=Nc(u,a);return{x:d.x-u.x,y:d.y-u.y}}function AM({onNodeMouseDown:e,getStoreItems:a,onDragStart:l,onDrag:i,onDragStop:r}){let u={x:null,y:null},d=0,h=new Map,g=!1,p={x:0,y:0},x=null,m=!1,v=null,k=!1,T=!1,S=null;function C({noDragClassName:E,handleSelector:j,domNode:O,isSelectable:w,nodeId:b,nodeClickDistance:A=0}){v=Na(O);function D({x:q,y:W}
9){const{nodeLookup:L,nodeExtent:V,snapGrid:I,snapToGrid:F,nodeOrigin:_,onNodeDrag:H,onSelectionDrag:P,onError:X,updateNodePositions:ne}=a();u={x:q,y:W};let pe=!1;const R=h.size>1,Q=R&&V?_p(Xi(h)):null,le=R&&F?OM({dragItems:h,snapGrid:I,x:q,y:W}):null;for(const[se,ie]of h){if(!L.has(se))continue;let K={x:q-ie.distance.x,y:W-ie.distance.y};F&&(K=le?{x:Math.round(K.x+le.x),y:Math.round(K.y+le.y)}:Nc(K,I));let ue=null;if(R&&V&&!ie.extent&&Q){const{positionAbsolute:He}=ie.internals,ee=He.x-Q.x+V[0][0],ge=He.x+ie.measured.width-Q.x2+V[1][0],Le=He.y-Q.y+V[0][1],me=He.y+ie.measured.height-Q.y2+V[1][1];ue=[[ee,Le],[ge,me]]}const{position:xe,positionAbsolute:Ne}=qj({nodeId:se,nextPosition:K,nodeLookup:L,nodeExtent:ue||V,nodeOrigin:_,onError:X});pe=pe||ie.position.x!==xe.x||ie.position.y!==xe.y,ie.position=xe,ie.internals.positionAbsolute=Ne}if(T=T||pe,!!pe&&(ne(h,!0),S&&(i||H||!b&&P))){const[se,ie]=Lm({nodeId:b,dragItems:h,nodeLookup:L});i?.(S,h,se,ie),H?.(S,se,ie),b||P?.(S,ie)}}async function M(){if(!x)return;const{transform:q,panBy:W,autoPanSpeed:L,autoPanOnNodeDrag:V}=a();if(!V){g=!1,cancelAnimationFrame(d);return}const[I,F]=sg(p,x,L);(I!==0||F!==0)&&(u.x=(u.x??0)-I/q[2],u.y=(u.y??0)-F/q[2],await W({x:I,y:F})&&D(u)),d=requestAnimationFrame(M)}function U(q){const{nodeLookup:W,multiSelectionActive:L,nodesDraggable:V,transform:I,snapGrid:F,snapToGrid:_,selectNodesOnDrag:H,onNodeDragStart:P,onSelectionDragStart:X,unselectNodesAndEdges:ne}=a();m=!0,(!H||!w)&&!L&&b&&(W.get(b)?.selected||ne()),w&&H&&b&&e?.(b);const pe=ac(q.sourceEvent,{transform:I,snapGrid:F,snapToGrid:_,containerBounds:x});if(u=pe,h=_M(W,V,pe,b),h.size>0&&(l||P||!b&&X)){const[R,Q]=Lm({nodeId:b,dragItems:h,nodeLookup:W});l?.(q.sourceEvent,h,R,Q),P?.(q.sourceEvent,R,Q),b||X?.(q.sourceEvent,Q)}}const Y=Sj().clickDistance(A).on("start",q=>{const{domNode:W,nodeDragThreshold:L,transform:V,snapGrid:I,snapToGrid:F}=a();x=W?.getBoundingClientRect()||null,k=!1,T=!1,S=q.sourceEvent,L===0&&U(q),u=ac(q.sourceEvent,{transform:V,snapGrid:I,snapToGrid:F,containerBounds:x}),p=cs(q.sourceEvent,x)}).on("drag",q=>{const{autoPanOnNodeDrag:W,transform:L,snapGrid:V,snapToGrid:I,nodeDragThreshold:F,nodeLookup:_}=a(),H=ac(q.sourceEvent,{transform:L,snapGrid:V,snapToGrid:I,containerBounds:x});if(S=q.sourceEvent,(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1||b&&!_.has(b))&&(k=!0),!k){if(!g&&W&&m&&(g=!0,M()),!m){const P=cs(q.sourceEvent,x),X=P.x-p.x,ne=P.y-p.y;Math.sqrt(X*X+ne*ne)>F&&U(q)}(u.x!==H.xSnapped||u.y!==H.ySnapped)&&h&&m&&(p=cs(q.sourceEvent,x),D(H))}}).on("end",q=>{if(!m||k){k&&h.size>0&&a().updateNodePositions(h,!1);return}if(g=!1,m=!1,cancelAnimationFrame(d),h.size>0){const{nodeLookup:W,updateNodePositions:L,onNodeDragStop:V,onSelectionDragStop:I}=a();if(T&&(L(h,!1),T=!1),r||V||!b&&I){const[F,_]=Lm({nodeId:b,dragItems:h,nodeLookup:W,dragging:!1});r?.(q.sourceEvent,h,F,_),V?.(q.sourceEvent,F,_),b||I?.(q.sourceEvent,_)}}}).filter(q=>{const W=q.target;return!q.button&&(!E||!rb(W,`.${E}`,O))&&(!j||rb(W,j,O))});v.call(Y)}function z(){v?.on(".drag",null)}return{update:C,destroy:z}}function IM(e,a,l){const i=[],r={x:e.x-l,y:e.y-l,width:l*2,height:l*2};for(const u of a.values())Od(r,fc(u))>0&&i.push(u);return i}const zM=250;function RM(e,a,l,i){let r=[],u=1/0;const d=IM(e,l,a+zM);for(const h of d){const g=[...h.internals.handleBounds?.source??[],...h.internals.handleBounds?.target??[]];for(const p of g){if(i.nodeId===p.nodeId&&i.type===p.type&&i.id===p.id)continue;const{x,y:m}=Ro(h,p,p.position,!0),v=Math.sqrt(Math.pow(x-e.x,2)+Math.pow(m-e.y,2));v>a||(v<u?(r=[{...p,x,y:m}],u=v):v===u&&r.push({...p,x,y:m}))}}if(!r.length)return null;if(r.length>1){const h=i.type==="source"?"target":"source";return r.find(g=>g.type===h)??r[0]}return r[0]}function rN(e,a,l,i,r,u=!1){const d=i.get(e);if(!d)return null;const h=r==="strict"?d.internals.handleBounds?.[a]:[...d.internals.handleBounds?.source??[],...d.internals.handleBounds?.target??[]],g=(l?h?.find(p=>p.id===l):h?.[0])??null;return g&&u?{...g,...Ro(d,g,g.position,!0)}:g}function cN(e,a){return e||(a?.classList.contains("target")?"target":a?.classList.contains("source")?"
9source":null)}function $M(e,a){let l=null;return a?l=!0:e&&!a&&(l=!1),l}const uN=()=>!0;function LM(e,{connectionMode:a,connectionRadius:l,handleId:i,nodeId:r,edgeUpdaterType:u,isTarget:d,domNode:h,nodeLookup:g,lib:p,autoPanOnConnect:x,flowId:m,panBy:v,cancelConnection:k,onConnectStart:T,onConnect:S,onConnectEnd:C,isValidConnection:z=uN,onReconnectEnd:E,updateConnection:j,getTransform:O,getFromHandle:w,autoPanSpeed:b,dragThreshold:A=1,handleDomNode:D}){const M=Jj(e.target);let U=0,Y;const{x:q,y:W}=cs(e),L=cN(u,D),V=h?.getBoundingClientRect();let I=!1;if(!V||!L)return;const F=rN(r,L,i,g,a);if(!F)return;let _=cs(e,V),H=!1,P=null,X=!1,ne=null;function pe(){if(!x||!V)return;const[xe,Ne]=sg(_,V,b);v({x:xe,y:Ne}),U=requestAnimationFrame(pe)}const R={...F,nodeId:r,type:L,position:F.position},Q=g.get(r);let se={inProgress:!0,isValid:null,from:Ro(Q,R,Ye.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:Q,to:_,toHandle:null,toPosition:K0[R.position],toNode:null,pointer:_};function ie(){I=!0,j(se),T?.(e,{nodeId:r,handleId:i,handleType:L})}A===0&&ie();function K(xe){if(!I){const{x:me,y:_e}=cs(xe),ke=me-q,re=_e-W;if(!(ke*ke+re*re>A*A))return;ie()}if(!w()||!R){ue(xe);return}const Ne=O();_=cs(xe,V),Y=RM(kc(_,Ne,!1,[1,1]),l,g,R),H||(pe(),H=!0);const He=dN(xe,{handle:Y,connectionMode:a,fromNodeId:r,fromHandleId:i,fromType:d?"target":"source",isValidConnection:z,doc:M,lib:p,flowId:m,nodeLookup:g});ne=He.handleDomNode,P=He.connection,X=$M(!!Y,He.isValid);const ee=g.get(r),ge=ee?Ro(ee,R,Ye.Left,!0):se.from,Le={...se,from:ge,isValid:X,to:He.toHandle&&X?Yi({x:He.toHandle.x,y:He.toHandle.y},Ne):_,toHandle:He.toHandle,toPosition:X&&He.toHandle?He.toHandle.position:K0[R.position],toNode:He.toHandle?g.get(He.toHandle.nodeId):null,pointer:_};j(Le),se=Le}function ue(xe){if(!("touches"in xe&&xe.touches.length>0)){if(I){(Y||ne)&&P&&X&&S?.(P);const{inProgress:Ne,...He}=se,ee={...He,toPosition:se.toHandle?se.toPosition:null};C?.(xe,ee),u&&E?.(xe,ee)}k(),cancelAnimationFrame(U),H=!1,X=!1,P=null,ne=null,M.removeEventListener("mousemove",K),M.removeEventListener("mouseup",ue),M.removeEventListener("touchmove",K),M.removeEventListener("touchend",ue)}}M.addEventListener("mousemove",K),M.addEventListener("mouseup",ue),M.addEventListener("touchmove",K),M.addEventListener("touchend",ue)}function dN(e,{handle:a,connectionMode:l,fromNodeId:i,fromHandleId:r,fromType:u,doc:d,lib:h,flowId:g,isValidConnection:p=uN,nodeLookup:x}){const m=u==="target",v=a?d.querySelector(`.${h}-flow__handle[data-id="${g}-${a?.nodeId}-${a?.id}-${a?.type}"]`):null,{x:k,y:T}=cs(e),S=d.elementFromPoint(k,T),C=S?.classList.contains(`${h}-flow__handle`)?S:v,z={handleDomNode:C,isValid:!1,connection:null,toHandle:null};if(C){const E=cN(void 0,C),j=C.getAttribute("data-nodeid"),O=C.getAttribute("data-handleid"),w=C.classList.contains("connectable"),b=C.classList.contains("connectableend");if(!j||!E)return z;const A={source:m?j:i,sourceHandle:m?O:r,target:m?i:j,targetHandle:m?r:O};z.connection=A;const M=w&&b&&(l===Bi.Strict?m&&E==="source"||!m&&E==="target":j!==i||O!==r);z.isValid=M&&p(A),z.toHandle=rN(j,E,O,x,l,!0)}return z}const Ip={onPointerDown:LM,isValid:dN};function UM({domNode:e,panZoom:a,getTransform:l,getViewScale:i}){const r=Na(e);function u({translateExtent:h,width:g,height:p,zoomStep:x=1,pannable:m=!0,zoomable:v=!0,inversePan:k=!1}){const T=j=>{if(j.sourceEvent.type!=="wheel"||!a)return;const O=l(),w=j.sourceEvent.ctrlKey&&mc()?10:1,b=-j.sourceEvent.deltaY*(j.sourceEvent.deltaMode===1?.05:j.sourceEvent.deltaMode?1:.002)*x,A=O[2]*Math.pow(2,b*w);a.scaleTo(A)};let S=[0,0];const C=j=>{(j.sourceEvent.type==="mousedown"||j.sourceEvent.type==="touchstart")&&(S=[j.sourceEvent.clientX??j.sourceEvent.touches[0].clientX,j.sourceEvent.clientY??j.sourceEvent.touches[0].clientY])},z=j=>{const O=l();if(j.sourceEvent.type!=="mousemove"&&j.sourceEvent.type!=="touchmove"||!a)return;const w=[j.sourceEvent.clientX??j.sourceEvent.touches[0].clientX,j.sourceEvent.clientY??j.sourceEvent.touches[0].clientY],b=[w[0]-S[0],w[1]-S[1]];S=w;const A=i()*Math.max(O[2],Math.log(O[2]))*(k?-1:1),D={x:O[0]-b[0]*A,y:O[1]-b[1]*A},M=[[0,0],[g,p]];a.setViewportConstrained({x:D.x,y:D.y,zoom:O[2]},M,h)},E=Hj().on("start",C).on("zoom",m?z:null).on("zoom.wheel",v?T:null);r.call(E,{})}function d(){r.on("zoom",null)}return{update:u,destroy:d,pointer:os}}const Wd=e=>({x:e.x,y:e.y,zoom:e.k}),Um=({x:e,y:a,zoom:l})=>Fd.translate(e,a).scale(l),Bl=(e,a)=>e.target.closest(`.${a}`),hN=(e,a)=>a===2&&Array.isArray(e)&&e.includes(2),HM=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Hm=(e,a=0,l=HM,i=()=>{})=>{const r=typeof a=="number"&&a>0;return r||i(),r?e.transition().duration(a).ease(l).on("end",i):e},fN=e=>{const a=e.ctrlKey&&mc()?10:1;
9return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*a};function BM({zoomPanValues:e,noWheelClassName:a,d3Selection:l,d3Zoom:i,panOnScrollMode:r,panOnScrollSpeed:u,zoomOnPinch:d,onPanZoomStart:h,onPanZoom:g,onPanZoomEnd:p}){return x=>{if(Bl(x,a))return x.ctrlKey&&x.preventDefault(),!1;x.preventDefault(),x.stopImmediatePropagation();const m=l.property("__zoom").k||1;if(x.ctrlKey&&d){const C=os(x),z=fN(x),E=m*Math.pow(2,z);i.scaleTo(l,E,C,x);return}const v=x.deltaMode===1?20:1;let k=r===_o.Vertical?0:x.deltaX*v,T=r===_o.Horizontal?0:x.deltaY*v;!mc()&&x.shiftKey&&r!==_o.Vertical&&(k=x.deltaY*v,T=0),i.translateBy(l,-(k/m)*u,-(T/m)*u,{internal:!0});const S=Wd(l.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?g?.(x,S):(e.isPanScrolling=!0,h?.(x,S)),e.panScrollTimeout=setTimeout(()=>{p?.(x,S),e.isPanScrolling=!1},150)}}function PM({noWheelClassName:e,preventScrolling:a,d3ZoomHandler:l}){return function(i,r){const u=i.type==="wheel",d=!a&&u&&!i.ctrlKey,h=Bl(i,e);if(i.ctrlKey&&u&&h&&i.preventDefault(),d||h)return null;i.preventDefault(),l.call(this,i,r)}}function YM({zoomPanValues:e,onDraggingChange:a,onPanZoomStart:l}){return i=>{if(i.sourceEvent?.internal)return;const r=Wd(i.transform);e.mouseButton=i.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,i.sourceEvent?.type==="mousedown"&&a(!0),l&&l?.(i.sourceEvent,r)}}function VM({zoomPanValues:e,panOnDrag:a,onPaneContextMenu:l,onTransformChange:i,onPanZoom:r}){return u=>{e.usedRightMouseButton=!!(l&&hN(a,e.mouseButton??0)),u.sourceEvent?.sync||i([u.transform.x,u.transform.y,u.transform.k]),r&&!u.sourceEvent?.internal&&r?.(u.sourceEvent,Wd(u.transform))}}function qM({zoomPanValues:e,panOnDrag:a,panOnScroll:l,onDraggingChange:i,onPanZoomEnd:r,onPaneContextMenu:u}){return d=>{if(!d.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,u&&hN(a,e.mouseButton??0)&&!e.usedRightMouseButton&&d.sourceEvent&&u(d.sourceEvent),e.usedRightMouseButton=!1,i(!1),r)){const h=Wd(d.transform);e.prevViewport=h,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(d.sourceEvent,h)},l?150:0)}}}function GM({panActivationKeyPressed:e,zoomActivationKeyPressed:a,zoomOnScroll:l,zoomOnPinch:i,panOnDrag:r,panOnScroll:u,zoomOnDoubleClick:d,userSelectionActive:h,noWheelClassName:g,noPanClassName:p,lib:x,connectionInProgress:m}){return v=>{const k=a||l,T=i&&v.ctrlKey,S=v.type==="wheel";if(v.button===1&&v.type==="mousedown"&&(Bl(v,`${x}-flow__node`)||Bl(v,`${x}-flow__edge`)||Bl(v,`${x}-flow__selection`)||Bl(v,`${x}-flow__nodesselection`)))return!0;if(!r&&!k&&!u&&!d&&!i||h||m&&!S||Bl(v,g)&&S||Bl(v,p)&&(!S||u&&S&&!a)||!i&&v.ctrlKey&&S)return!1;if(!i&&v.type==="touchstart"&&v.touches?.length>1)return v.preventDefault(),!1;if(!k&&!u&&!T&&S||!r&&(v.type==="mousedown"||v.type==="touchstart")||Array.isArray(r)&&!r.includes(v.button)&&v.type==="mousedown")return!1;const C=Array.isArray(r)&&r.includes(v.button)||!v.button||v.button<=1;return(!v.ctrlKey||S||e)&&C}}function XM({domNode:e,minZoom:a,maxZoom:l,translateExtent:i,viewport:r,onPanZoom:u,onPanZoomStart:d,onPanZoomEnd:h,onDraggingChange:g}){const p={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},x=e.getBoundingClientRect();let m=[[0,0],[x.width,x.height]];(typeof ResizeObserver<"u"?new ResizeObserver(W=>{const L=W[0];L&&(m=[[0,0],[L.contentRect.width,L.contentRect.height]])}):null)?.observe(e);const k=Hj().extent(()=>m).scaleExtent([a,l]).translateExtent(i),T=Na(e).call(k);O({x:r.x,y:r.y,zoom:Pi(r.zoom,a,l)},[[0,0],[x.width,x.height]],i);const S=T.on("wheel.zoom"),C=T.on("dblclick.zoom");k.wheelDelta(fN);async function z(W,L){return T?new Promise(V=>{k?.interpolate(L?.interpolate==="linear"?nc:md).transform(Hm(T,L?.duration,L?.ease,()=>V(!0)),W)}):!1}function E({noWheelClassName:W,noPanClassName:L,onPaneContextMenu:V,userSelectionActive:I,panOnScroll:F,panOnDrag:_,panOnScrollMode:H,panOnScrollSpeed:P,preventScrolling:X,zoomOnPinch:ne,zoomOnScroll:pe,zoomOnDoubleClick:R,panActivationKeyPressed:Q=!1,zoomActivationKeyPressed:le,lib:se,onTransformChange:ie,connectionInProgress:K,paneClickDistance:ue,selectionOnDrag:xe}){I&&!p.isZoomingOrPanning&&j();const Ne=F&&!le&&!I;k.clickDistance(xe?1/0:!rs(ue)||ue<0?0:ue);const He=Ne?BM({zoomPanValues:p,noWheelClassName:W,d3Selection:T,d3Zoom:k,panOnScrollMode:H,panOnScrollSpeed:P,zoomOnPinch:ne,onPanZoomStart:d,onPanZoom:u,onPanZoomEnd:h}):PM({noWheelClassName:W,preventScrolling:X,d3ZoomHandler:S});T.on("wheel.zoom",He,{passive:!1});const ee=YM({zoomPanValues:p,onDraggingChange:g,onPanZoomStart:d});k.on("start",ee);const ge=VM({zoomPanValues:p,panOnDrag:_,onPaneContextMenu:!!V,onPanZoom:u,onTransformChange:ie});k.on("zoom",ge);const Le=qM({zoomPanValues:p,panOnDrag:_,panOnScroll:F,onPaneContextMenu:V,onPanZoomEnd:h,onDraggingChange:g});k.on("end",Le);const me=GM({panActivationKeyPressed:Q,zoomActivationKeyPressed:le,panOnDrag:_,zoomOnScroll:pe,panOnScroll:F,zoomOnDoubleClick:R,zoomOnPinch:ne,userSelectionActive:I,noPanClassName:L,noWheelClassName:W,lib:se,connectionInProgress:K});k.filter(me),R?T.on("dblclick.zoom",C):T.on("dblclick.zoom",null)}function j(){k.on("zoom",null)}
9async function O(W,L,V){const I=Um(W),F=k?.constrain()(I,L,V);return F&&await z(F),F}async function w(W,L){const V=Um(W);return await z(V,L),V}function b(W){if(T){const L=Um(W),V=T.property("__zoom");(V.k!==W.zoom||V.x!==W.x||V.y!==W.y)&&k?.transform(T,L,null,{sync:!0})}}function A(){const W=T?Uj(T.node()):{x:0,y:0,k:1};return{x:W.x,y:W.y,zoom:W.k}}async function D(W,L){return T?new Promise(V=>{k?.interpolate(L?.interpolate==="linear"?nc:md).scaleTo(Hm(T,L?.duration,L?.ease,()=>V(!0)),W)}):!1}async function M(W,L){return T?new Promise(V=>{k?.interpolate(L?.interpolate==="linear"?nc:md).scaleBy(Hm(T,L?.duration,L?.ease,()=>V(!0)),W)}):!1}function U(W){k?.scaleExtent(W)}function Y(W){k?.translateExtent(W)}function q(W){const L=!rs(W)||W<0?0:W;k?.clickDistance(L)}return{update:E,destroy:j,setViewport:w,setViewportConstrained:O,getViewport:A,scaleTo:D,scaleBy:M,setScaleExtent:U,setTranslateExtent:Y,syncViewport:b,setClickDistance:q}}var Vi;(function(e){e.Line="line",e.Handle="handle"})(Vi||(Vi={}));function ZM({width:e,prevWidth:a,height:l,prevHeight:i,affectsX:r,affectsY:u}){const d=e-a,h=l-i,g=[d>0?1:d<0?-1:0,h>0?1:h<0?-1:0];return d&&r&&(g[0]=g[0]*-1),h&&u&&(g[1]=g[1]*-1),g}function cb(e){const a=e.includes("right")||e.includes("left"),l=e.includes("bottom")||e.includes("top"),i=e.includes("left"),r=e.includes("top");return{isHorizontal:a,isVertical:l,affectsX:i,affectsY:r}}function Ll(e,a){return Math.max(0,a-e)}function Ul(e,a){return Math.max(0,e-a)}function sd(e,a,l){return Math.max(0,a-e,e-l)}function ub(e,a){return e?!a:a}function FM(e,a,l,i,r,u,d,h){let{affectsX:g,affectsY:p}=a;const{isHorizontal:x,isVertical:m}=a,v=x&&m,{xSnapped:k,ySnapped:T}=l,{minWidth:S,maxWidth:C,minHeight:z,maxHeight:E}=i,{x:j,y:O,width:w,height:b,aspectRatio:A}=e;let D=Math.floor(x?k-e.pointerX:0),M=Math.floor(m?T-e.pointerY:0);const U=w+(g?-D:D),Y=b+(p?-M:M),q=-u[0]*w,W=-u[1]*b;let L=sd(U,S,C),V=sd(Y,z,E);if(d){let _=0,H=0;g&&D<0?_=Ll(j+D+q,d[0][0]):!g&&D>0&&(_=Ul(j+U+q,d[1][0])),p&&M<0?H=Ll(O+M+W,d[0][1]):!p&&M>0&&(H=Ul(O+Y+W,d[1][1])),L=Math.max(L,_),V=Math.max(V,H)}if(h){let _=0,H=0;g&&D>0?_=Ul(j+D,h[0][0]):!g&&D<0&&(_=Ll(j+U,h[1][0])),p&&M>0?H=Ul(O+M,h[0][1]):!p&&M<0&&(H=Ll(O+Y,h[1][1])),L=Math.max(L,_),V=Math.max(V,H)}if(r){if(x){const _=sd(U/A,z,E)*A;if(L=Math.max(L,_),d){let H=0;!g&&!p||g&&!p&&v?H=Ul(O+W+U/A,d[1][1])*A:H=Ll(O+W+(g?D:-D)/A,d[0][1])*A,L=Math.max(L,H)}if(h){let H=0;!g&&!p||g&&!p&&v?H=Ll(O+U/A,h[1][1])*A:H=Ul(O+(g?D:-D)/A,h[0][1])*A,L=Math.max(L,H)}}if(m){const _=sd(Y*A,S,C)/A;if(V=Math.max(V,_),d){let H=0;!g&&!p||p&&!g&&v?H=Ul(j+Y*A+q,d[1][0])/A:H=Ll(j+(p?M:-M)*A+q,d[0][0])/A,V=Math.max(V,H)}if(h){let H=0;!g&&!p||p&&!g&&v?H=Ll(j+Y*A,h[1][0])/A:H=Ul(j+(p?M:-M)*A,h[0][0])/A,V=Math.max(V,H)}}}M=M+(M<0?V:-V),D=D+(D<0?L:-L),r&&(v?U>Y*A?M=(ub(g,p)?-D:D)/A:D=(ub(g,p)?-M:M)*A:x?(M=D/A,p=g):(D=M*A,g=p));const I=g?j+D:j,F=p?O+M:O;return{width:w+(g?-D:D),height:b+(p?-M:M),x:u[0]*D*(g?-1:1)+I,y:u[1]*M*(p?-1:1)+F}}const mN={width:0,height:0,x:0,y:0},KM={...mN,pointerX:0,pointerY:0,aspectRatio:1};function QM(e,a,l){const i=a.position.x+e.position.x,r=a.position.y+e.position.y,u=e.measured.width??0,d=e.measured.height??0,h=l[0]*u,g=l[1]*d;return[[i-h,r-g],[i+u-h,r+d-g]]}function WM({domNode:e,nodeId:a,getStoreItems:l,onChange:i,onEnd:r}){const u=Na(e);let d={controlDirection:cb("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function h({controlPosition:p,boundaries:x,keepAspectRatio:m,resizeDirection:v,onResizeStart:k,onResize:T,onResizeEnd:S,shouldResize:C}){let z={...mN},E={...KM};d={boundaries:x,resizeDirection:v,keepAspectRatio:m,controlDirection:cb(p)};let j,O=null,w=[],b,A,D,M=!1;const U=Sj().on("start",Y=>
9{const{nodeLookup:q,transform:W,snapGrid:L,snapToGrid:V,nodeOrigin:I,paneDomNode:F}=l();if(j=q.get(a),!j)return;O=F?.getBoundingClientRect()??null;const{xSnapped:_,ySnapped:H}=ac(Y.sourceEvent,{transform:W,snapGrid:L,snapToGrid:V,containerBounds:O});z={width:j.measured.width??0,height:j.measured.height??0,x:j.position.x??0,y:j.position.y??0},E={...z,pointerX:_,pointerY:H,aspectRatio:z.width/z.height},b=void 0,A=zo(j.extent)?j.extent:void 0,j.parentId&&(j.extent==="parent"||j.expandParent)&&(b=q.get(j.parentId)),b&&j.extent==="parent"&&(A=[[0,0],[b.measured.width,b.measured.height]]),w=[],D=void 0;for(const[P,X]of q)if(X.parentId===a&&(w.push({id:P,position:{...X.position},extent:X.extent}),X.extent==="parent"||X.expandParent)){const ne=QM(X,j,X.origin??I);D?D=[[Math.min(ne[0][0],D[0][0]),Math.min(ne[0][1],D[0][1])],[Math.max(ne[1][0],D[1][0]),Math.max(ne[1][1],D[1][1])]]:D=ne}k?.(Y,{...z})}).on("drag",Y=>{const{transform:q,snapGrid:W,snapToGrid:L,nodeOrigin:V}=l(),I=ac(Y.sourceEvent,{transform:q,snapGrid:W,snapToGrid:L,containerBounds:O}),F=[];if(!j)return;const{x:_,y:H,width:P,height:X}=z,ne={},pe=j.origin??V,{width:R,height:Q,x:le,y:se}=FM(E,d.controlDirection,I,d.boundaries,d.keepAspectRatio,pe,A,D),ie=R!==P,K=Q!==X,ue=le!==_&&ie,xe=se!==H&&K;if(!ue&&!xe&&!ie&&!K)return;if((ue||xe||pe[0]===1||pe[1]===1)&&(ne.x=ue?le:z.x,ne.y=xe?se:z.y,z.x=ne.x,z.y=ne.y,w.length>0)){const ge=le-_,Le=se-H;for(const me of w)me.position={x:me.position.x-ge+pe[0]*(R-P),y:me.position.y-Le+pe[1]*(Q-X)},F.push(me)}if((ie||K)&&(ne.width=ie&&(!d.resizeDirection||d.resizeDirection==="horizontal")?R:z.width,ne.height=K&&(!d.resizeDirection||d.resizeDirection==="vertical")?Q:z.height,z.width=ne.width,z.height=ne.height),b&&j.expandParent){const ge=pe[0]*(ne.width??0);ne.x&&ne.x<ge&&(z.x=ge,E.x=E.x-(ne.x-ge));const Le=pe[1]*(ne.height??0);ne.y&&ne.y<Le&&(z.y=Le,E.y=E.y-(ne.y-Le))}const Ne=ZM({width:z.width,prevWidth:P,height:z.height,prevHeight:X,affectsX:d.controlDirection.affectsX,affectsY:d.controlDirection.affectsY}),He={...z,direction:Ne};C?.(Y,He)!==!1&&(M=!0,T?.(Y,He),i(ne,F))}).on("end",Y=>{M&&(S?.(Y,{...z}),r?.({...z}),M=!1)});u.call(U)}function g(){u.on(".drag",null)}return{update:h,destroy:g}}var Bm={exports:{}},Pm={},Ym={exports:{}},Vm={};var db;function JM(){if(db)return Vm;db=1;var e=vc();function a(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var l=typeof Object.is=="function"?Object.is:a,i=e.useState,r=e.useEffect,u=e.useLayoutEffect,d=e.useDebugValue;function h(m,v){var k=v(),T=i({inst:{value:k,getSnapshot:v}}),S=T[0].inst,C=T[1];return u(function(){S.value=k,S.getSnapshot=v,g(S)&&C({inst:S})},[m,k,v]),r(function(){return g(S)&&C({inst:S}),m(function(){g(S)&&C({inst:S})})},[m]),d(k),k}function g(m){var v=m.getSnapshot;m=m.value;try{var k=v();return!l(m,k)}catch{return!0}}function p(m,v){return v()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:h;return Vm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,Vm}var hb;function eD(){return hb||(hb=1,Ym.exports=JM()),Ym.exports}var fb;function tD(){if(fb)return Pm;fb=1;var e=vc(),a=eD();function l(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var i=typeof Object.is=="function"?Object.is:l,r=a.useSyncExternalStore,u=e.useRef,d=e.useEffect,h=e.useMemo,g=e.useDebugValue;return Pm.useSyncExternalStoreWithSelector=function(p,x,m,v,k){var T=u(null);if(T.current===null){var S={hasValue:!1,value:null};T.current=S}else S=T.current;T=h(function(){function z(b){if(!E){if(E=!0,j=b,b=v(b),k!==void 0&&S.hasValue){var A=S.value;if(k(A,b))return O=A}return O=b}if(A=O,i(j,b))return A;var D=v(b);return k!==void 0&&k(A,D)?(j=b,A):(j=b,O=D)}var E=!1,j,O,w=m===void 0?null:m;return[function(){return z(x())},w===null?void 0:function(){return z(w())}]},[x,m,v,k]);var C=r(p,T[0],T[1]);return d(function(){S.hasValue=!0,S.value=C},[C]),g(C),C},Pm}var mb;function nD(){return mb||(mb=1,Bm.exports=tD()),Bm.exports}var aD=nD();const sD=cj(aD),lD={},pb=e=>{let a;const l=new Set,i=(x,m)=>{const v=typeof x=="function"?x(a):x;if(!Object.is(v,a)){const k=a;a=m??(typeof v!="object"||v===null)?v:Object.assign({},a,v),l.forEach(T=>T(a,k))}},r=()=>a,g={setState:i,getState:r,getInitialState:()=>p,subscribe:x=>(l.add(x),()=>l.delete(x)),destroy:()=>{(lD?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),l.clear()}},p=a=e(i,r,g);return g},oD=e=>e?pb(e):pb,{useDebugValue:iD}=pC,{useSyncExternalStoreWithSelector:rD}=sD,cD=e=>e;function pN(e,a=cD,l){const i=rD(e.subscribe,e.getState,e.getServerState||e.getInitialState,a,l);return iD(i),i}const gb=(e,a)=>{const l=oD(e),i=(r,u=a)=>pN(l,r,u);return Object.assign(i,l),i},uD=(e,a)=>e?gb(e,a):gb;function Kt(e,a){if(Object.is(e,a))return!0;
9if(typeof e!="object"||e===null||typeof a!="object"||a===null)return!1;if(e instanceof Map&&a instanceof Map){if(e.size!==a.size)return!1;for(const[i,r]of e)if(!Object.is(r,a.get(i)))return!1;return!0}if(e instanceof Set&&a instanceof Set){if(e.size!==a.size)return!1;for(const i of e)if(!a.has(i))return!1;return!0}const l=Object.keys(e);if(l.length!==Object.keys(a).length)return!1;for(const i of l)if(!Object.prototype.hasOwnProperty.call(a,i)||!Object.is(e[i],a[i]))return!1;return!0}var Sc=uj();const Jd=N.createContext(null),dD=Jd.Provider,gN=ds.error001("react");function bt(e,a){const l=N.useContext(Jd);if(l===null)throw new Error(gN);return pN(l,e,a)}function Zt(){const e=N.useContext(Jd);if(e===null)throw new Error(gN);return N.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const yb={display:"none"},hD={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},yN="react-flow__node-desc",xN="react-flow__edge-desc",fD="react-flow__aria-live",mD=e=>e.ariaLiveMessage,pD=e=>e.ariaLabelConfig;function gD({rfId:e}){const a=bt(mD);return s.jsx("div",{id:`${fD}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:hD,children:a})}function yD({rfId:e,disableKeyboardA11y:a}){const l=bt(pD);return s.jsxs(s.Fragment,{children:[s.jsx("div",{id:`${yN}-${e}`,style:yb,children:a?l["node.a11yDescription.default"]:l["node.a11yDescription.keyboardDisabled"]}),s.jsx("div",{id:`${xN}-${e}`,style:yb,children:l["edge.a11yDescription.default"]}),!a&&s.jsx(gD,{rfId:e})]})}const eh=N.forwardRef(({position:e="top-left",children:a,className:l,style:i,...r},u)=>{const d=`${e}`.split("-");return s.jsx("div",{className:dn(["react-flow__panel",l,...d]),style:i,ref:u,...r,children:a})});eh.displayName="Panel";const xb="https://reactflow.dev?utm_source=attribution";function xD({proOptions:e,position:a="bottom-right"}){return N.useEffect(()=>{},[]),e?.hideAttribution?null:s.jsx(eh,{position:a,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${xb}`,children:s.jsx("a",{href:xb,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const vD=e=>{const a=[],l=[];for(const[,i]of e.nodeLookup)i.selected&&a.push(i.internals.userNode);for(const[,i]of e.edgeLookup)i.selected&&l.push(i);return{selectedNodes:a,selectedEdges:l}},ld=e=>e.id;function bD(e,a){return Kt(e.selectedNodes.map(ld),a.selectedNodes.map(ld))&&Kt(e.selectedEdges.map(ld),a.selectedEdges.map(ld))}function wD({onSelectionChange:e}){const a=Zt(),{selectedNodes:l,selectedEdges:i}=bt(vD,bD);return N.useEffect(()=>{const r={nodes:l,edges:i};e?.(r),a.getState().onSelectionChangeHandlers.forEach(u=>u(r))},[l,i,e]),null}const jD=e=>!!e.onSelectionChangeHandlers;function ND({onSelectionChange:e}){const a=bt(jD);return e||a?s.jsx(wD,{onSelectionChange:e}):null}const vN=[0,0],kD={x:0,y:0,zoom:1},SD=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],vb=[...SD,"rfId"],CD=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setN
9odeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),bb={translateExtent:dc,nodeOrigin:vN,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ED(e){const{setNodes:a,setEdges:l,setMinZoom:i,setMaxZoom:r,setTranslateExtent:u,setNodeExtent:d,reset:h,setDefaultNodesAndEdges:g}=bt(CD,Kt),p=Zt();N.useEffect(()=>(g(e.defaultNodes,e.defaultEdges),()=>{x.current=bb,h()}),[]);const x=N.useRef(bb);return N.useEffect(()=>{for(const m of vb){const v=e[m],k=x.current[m];v!==k&&(typeof e[m]>"u"||(m==="nodes"?a(v):m==="edges"?l(v):m==="minZoom"?i(v):m==="maxZoom"?r(v):m==="translateExtent"?u(v):m==="nodeExtent"?d(v):m==="ariaLabelConfig"?p.setState({ariaLabelConfig:uM(v)}):m==="fitView"?p.setState({fitViewQueued:v}):m==="fitViewOptions"?p.setState({fitViewOptions:v}):p.setState({[m]:v})))}x.current=e},vb.map(m=>e[m])),null}function wb(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function TD(e){const[a,l]=N.useState(e==="system"?null:e);return N.useEffect(()=>{if(e!=="system"){l(e);return}const i=wb(),r=()=>l(i?.matches?"dark":"light");return r(),i?.addEventListener("change",r),()=>{i?.removeEventListener("change",r)}},[e]),a!==null?a:wb()?.matches?"dark":"light"}const jb=typeof document<"u"?document:null;function pc(e=null,a={target:jb,actInsideInputWithModifier:!0}){const[l,i]=N.useState(!1),r=N.useRef(!1),u=N.useRef(new Set([])),[d,h]=N.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.replace(/\+/g,`
10`).replace(`
11
12`,`
13+`).split(`
14`)),x=p.reduce((m,v)=>m.concat(...v),[]);return[p,x]}return[[],[]]},[e]);return N.useEffect(()=>{const g=a?.target??jb,p=a?.actInsideInputWithModifier??!0;if(e!==null){const x=k=>{if(r.current=k.ctrlKey||k.metaKey||k.shiftKey||k.altKey,(!r.current||r.current&&!p)&&eN(k))return!1;const S=kb(k.code,h);if(u.current.add(k[S]),Nb(d,u.current,!1)){const C=k.composedPath?.()?.[0]||k.target,z=C?.nodeName==="BUTTON"||C?.nodeName==="A";a.preventDefault!==!1&&(r.current||!z)&&k.preventDefault(),i(!0)}},m=k=>{const T=kb(k.code,h);Nb(d,u.current,!0)?(i(!1),u.current.clear()):u.current.delete(k[T]),k.key==="Meta"&&u.current.clear(),r.current=!1},v=()=>{u.current.clear(),i(!1)};return g?.addEventListener("keydown",x),g?.addEventListener("keyup",m),window.addEventListener("blur",v),window.addEventListener("contextmenu",v),()=>{g?.removeEventListener("keydown",x),g?.removeEventListener("keyup",m),window.removeEventListener("blur",v),window.removeEventListener("contextmenu",v)}}},[e,i]),l}function Nb(e,a,l){return e.filter(i=>l||i.length===a.size).some(i=>i.every(r=>a.has(r)))}function kb(e,a){return a.includes(e)?"code":"key"}const MD=()=>{const e=Zt();return N.useMemo(()=>({zoomIn:async a=>{const{panZoom:l}=e.getState();return l?l.scaleBy(1.2,a):!1},zoomOut:async a=>{const{panZoom:l}=e.getState();return l?l.scaleBy(1/1.2,a):!1},zoomTo:async(a,l)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(a,l):!1},getZoom:()=>e.getState().transform[2],setViewport:async(a,l)=>{const{transform:[i,r,u],panZoom:d}=e.getState();return d?(await d.setViewport({x:a.x??i,y:a.y??r,zoom:a.zoom??u},l),!0):!1},getViewport:()=>{const[a,l,i]=e.getState().transform;return{x:a,y:l,zoom:i}},setCenter:async(a,l,i)=>e.getState().setCenter(a,l,i),fitBounds:async(a,l)=>{const{width:i,height:r,minZoom:u,maxZoom:d,panZoom:h}=e.getState(),g=lg(a,i,r,u,d,l?.padding??.1);return h?(await h.setViewport(g,{duration:l?.duration,ease:l?.ease,interpolate:l?.interpolate}),!0):!1},screenToFlowPosition:(a,l={})=>{const{transform:i,snapGrid:r,snapToGrid:u,domNode:d}=e.getState();if(!d)return a;const{x:h,y:g}=d.getBoundingClientRect(),p={x:a.x-h,y:a.y-g},x=l.snapGrid??r,m=l.snapToGrid??u;return kc(p,i,m,x)},flowToScreenPosition:a=>{const{transform:l,domNode:i}=e.getState();if(!i)return a;const{x:r,y:u}=i.getBoundingClientRect(),d=Yi(a,l);return{x:d.x+r,y:d.y+u}}}),[])};function bN(e,a){const l=[],i=new Map,r=[];for(const u of e)if(u.type==="add"){r.push(u);continue}else if(u.type==="remove"||u.type==="replace")i.set(u.id,[u]);else{const d=i.get(u.id);d?d.push(u):i.set(u.id,[u])}for(const u of a){const d=i.get(u.id);if(!d){l.push(u);continue}if(d[0].type==="remove")continue;if(d[0].type==="replace"){l.push({...d[0].item});continue}const h={...u};for(const g of d)DD(g,h);l.push(h)}return r.length&&r.forEach(u=>{u.index!==void 0?l.splice(u.index,0,{...u.item}):l.push({...u.item})}),l}function DD(e,a){switch(e.type){case"select":{a.selected=e.selected;break}case"position":{typeof e.position<"u"&&(a.position=e.position),typeof e.dragging<"u"&&(a.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(a.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(a.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(a.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(a.resizing=e.resizing);break}}}function wN(e,a){return bN(e,a)}function jN(e,a){return bN(e,a)}function Co(e,a){return{id:e,type:"select",selected:a}}function Ri(e,a=new Set,l=!1){const i=[];for(const[r,u]of e){const d=a.has(r);!(u.selected===void 0&&!d)&&u.selected!==d&&(l&&(u.selected=d),i.push(Co(u.id,d)))}return i}function Sb({items:e=[],lookup:a}){const l=[],i=new Map(e.map(r=>[r.id,r]));for(const[r,u]of e.entries()){const d=a.get(u.id),h=d?.internals?.userNode??d;h!==void 0&&h!==u&&l.push({id:u.id,item:u,type:"replace"}),h===void 0&&l.push({item:u,type:"add",index:r})}for(const[r]of a)i.get(r)===void 0&&l.push({id:r,type:"remove"});return l}function Cb(e){return{id:e.id,type:"remove"}}const _D=Fj();function OD(e,a,l={}){return gM(e,a,{...l,onError:l.onError??_D})}const Eb=e=>tM(e),AD=e=>Vj(e);function NN(e){return N.forwardRef(e)}const kN=typeof window<"u"?N.useLayoutEffect:N.useEffect;function Tb(e){const[a,l]=N.useState(BigInt(0)),[i]=N.useState(()=>ID(()=>l(r=>r+BigInt(1))));return kN(()=>{const r=i.get();r.length&&(e(r),i.reset())},[a]),i}function ID(e){let a=[];return{get:()=>a,reset:()=>{a=[]},push:l=>{a.push(l),e()}}}const SN=N.createContext(null);function zD({children:e}){const a=Zt(),l=N.useCallback(h=>{const{nodes:g=[],setNodes:p,hasDefaultNodes:x,onNodesChange:m,nodeLookup:v,fitViewQueued:k,onNodesChangeMiddlewareMap:T}=a.getState();let S=g;for(const z of h)S=typeof z=="function"?z(S):z;let C=Sb({items:S,lookup:v});for(const z of T.values())C=z(C);x&&p(S),C.length>0?m?.(C):k&&window.requestAnimationFrame(()=>{const{fitViewQueued:z,nodes:E,setNodes:j}=a.getState();z&&j(E)})},[]),i=Tb(l),r=N.useCallback(h=>{const{edges:g=[],setEdges:p,hasDefaultEdges:x,onEdgesChange:m,edgeLookup:v}=a.getState();let k=g;for(const T of h)k=typeof T=="function"?T(k):T;x?p(k):m&&m(Sb({items:k,lookup:v}))},[]),u=Tb(r),d=N.useMemo(()=>({nodeQueue:i,edgeQueue:u}),[]);return s.jsx(SN.Provider,{value:d,children:e})}function RD(){const e=N.useContext(SN);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const $D=e=>!!e.panZoom;function Zi(){const e=MD(),a=Zt(),l=RD(),i=bt($D),r=N.useMemo(()=>{const u=m=>a.getState().nodeLookup.get(m),d=m=>{l.nodeQueue.push(m)},h=m=>{l.edgeQueue.push(m)},g=m=>{const{nodeLookup:v,nodeOrigin:k}=a.getState(),T=Eb(m)?m:v.get(m.id),S=T.parentId?Qj(T.position,T.measured,T.parentId,v,k):T.position,C={...T,position:S,width:T.measured?.width??T.width,height:T.measured?.height??T.height};return fc(C)},p=(m,v,k={replace:!1})=>{d(T=>T.map(S=>{if(S.id===m){const C=typeof v=="function"?v(S):v;return k.replace&&Eb(C)?C:{...S,...C}}return S}))},x=(m,v,k={replace:!1})=>{h(T=>T.map(S=>{if(S.id===m){const C=typeof v=="function"?v(S):v;return k.replace&&AD(C)?C:{...S,...C}}return S}))};return{getNodes:()=>a.getState().nodes.map(m=>({...m})),getNode:m=>u(m)?.internals.userNode,getInternalNode:u,getEdges:()=>{const{edges:m=[]}=a.getState();return m.map(v=>({...v}))},getEdge:m=>a.getState().edgeLookup.get(m),setNodes:d,setEdges:h,addNodes:m=>{const v=Array.isArray(m)?m:[m];l.nodeQueue.push(k=>[...k,...v])},addEdges:m=>{const v=Array.isArray(m)?m:[m];l.edgeQueue.push(k=>[...k,...v])},toObject:()=>{const{nodes:m=[],edges:v=[],transform:k}=a.getState(),[T,S,C]=k;return{nodes:m.map(z=>({...z})),edges:v.map(z=>({...z})),viewport:{x:T,y:S,zoom:C}}},deleteElements:async({nodes:m=[],edges:v=[]})=>{const{nodes:k,edges:T,onNodesDelete:S,onEdgesDelete:C,triggerNodeChanges:z,triggerEdgeChanges:E,onDelete:j,onBeforeDelete:O}=a.getState(),{nodes:w,edges:b}=await oM({nodesToRemove:m,edgesToRemove:v,nodes:k,edges:T,onBeforeDelete:O}),A=b.length>0,D=w.length>0;if(A){const M=b.map(Cb);C?.(b),E(M)}if(D){const M=w.map(Cb);S?.(w),z(M)}return(D||A)&&j?.({nodes:w,edges:b}),{deletedNodes:w,deletedEdges:b}},getIntersectingNodes:(m,v=!0,k)=>{const T=W0(m),S=T?m:g(m),C=k!==void 0;return S?(k||a.getState().nodes).filter(z=>{const E=a.getState().nodeLookup.get(z.id);if(E&&!T&&(z.id===m.id||!E.internals.positionAbsolute))return!1;
14const j=fc(C?z:E),O=Od(j,S);return v&&O>0||O>=j.width*j.height||O>=S.width*S.height}):[]},isNodeIntersecting:(m,v,k=!0)=>{const S=W0(m)?m:g(m);if(!S)return!1;const C=Od(S,v);return k&&C>0||C>=v.width*v.height||C>=S.width*S.height},updateNode:p,updateNodeData:(m,v,k={replace:!1})=>{p(m,T=>{const S=typeof v=="function"?v(T):v;return k.replace?{...T,data:S}:{...T,data:{...T.data,...S}}},k)},updateEdge:x,updateEdgeData:(m,v,k={replace:!1})=>{x(m,T=>{const S=typeof v=="function"?v(T):v;return k.replace?{...T,data:S}:{...T,data:{...T.data,...S}}},k)},getNodesBounds:m=>{const{nodeLookup:v,nodeOrigin:k}=a.getState();return nM(m,{nodeLookup:v,nodeOrigin:k})},getHandleConnections:({type:m,id:v,nodeId:k})=>Array.from(a.getState().connectionLookup.get(`${k}-${m}${v?`-${v}`:""}`)?.values()??[]),getNodeConnections:({type:m,handleId:v,nodeId:k})=>Array.from(a.getState().connectionLookup.get(`${k}${m?v?`-${m}-${v}`:`-${m}`:""}`)?.values()??[]),fitView:async m=>{const v=a.getState().fitViewResolver??cM();return a.setState({fitViewQueued:!0,fitViewOptions:m,fitViewResolver:v}),l.nodeQueue.push(k=>[...k]),v.promise}}},[]);return N.useMemo(()=>({...r,...e,viewportInitialized:i}),[i])}const Mb=e=>e.selected,LD=typeof window<"u"?window:void 0;function UD({deleteKeyCode:e,multiSelectionKeyCode:a}){const l=Zt(),{deleteElements:i}=Zi(),r=pc(e,{actInsideInputWithModifier:!1}),u=pc(a,{target:LD});N.useEffect(()=>{if(r){const{edges:d,nodes:h}=l.getState();i({nodes:h.filter(Mb),edges:d.filter(Mb)}),l.setState({nodesSelectionActive:!1})}},[r]),N.useEffect(()=>{l.setState({multiSelectionActive:u})},[u])}function HD(e){const a=Zt();N.useEffect(()=>{const l=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const i=og(e.current);(i.height===0||i.width===0)&&a.getState().onError?.("004",ds.error004()),a.setState({width:i.width||500,height:i.height||500})};if(e.current){l(),window.addEventListener("resize",l);const i=new ResizeObserver(()=>l());return i.observe(e.current),()=>{window.removeEventListener("resize",l),i&&e.current&&i.unobserve(e.current)}}},[])}const th={position:"absolute",width:"100%",height:"100%",top:0,left:0},BD=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function PD({onPaneContextMenu:e,zoomOnScroll:a=!0,zoomOnPinch:l=!0,panOnScroll:i=!1,panActivationKeyPressed:r,panOnScrollSpeed:u=.5,panOnScrollMode:d=_o.Free,zoomOnDoubleClick:h=!0,panOnDrag:g=!0,defaultViewport:p,translateExtent:x,minZoom:m,maxZoom:v,zoomActivationKeyCode:k,preventScrolling:T=!0,children:S,noWheelClassName:C,noPanClassName:z,onViewportChange:E,isControlledViewport:j,paneClickDistance:O,selectionOnDrag:w}){const b=Zt(),A=N.useRef(null),{userSelectionActive:D,lib:M,connectionInProgress:U}=bt(BD,Kt),Y=pc(k),q=N.useRef();HD(A);const W=N.useCallback(L=>{E?.({x:L[0],y:L[1],zoom:L[2]}),j||b.setState({transform:L})},[E,j]);return N.useEffect(()=>{if(A.current){q.current=XM({domNode:A.current,minZoom:m,maxZoom:v,translateExtent:x,viewport:p,onDraggingChange:F=>b.setState(_=>_.paneDragging===F?_:{paneDragging:F}),onPanZoomStart:(F,_)=>{const{onViewportChangeStart:H,onMoveStart:P}=b.getState();P?.(F,_),H?.(_)},onPanZoom:(F,_)=>{const{onViewportChange:H,onMove:P}=b.getState();P?.(F,_),H?.(_)},onPanZoomEnd:(F,_)=>{const{onViewportChangeEnd:H,onMoveEnd:P}=b.getState();P?.(F,_),H?.(_)}});const{x:L,y:V,zoom:I}=q.current.getViewport();return b.setState({panZoom:q.current,transform:[L,V,I],domNode:A.current.closest(".react-flow")}),()=>{q.current?.destroy()}}},[]),N.useEffect(()=>{q.current?.update({onPaneContextMenu:e,zoomOnScroll:a,zoomOnPinch:l,panOnScroll:i,panActivationKeyPressed:r,panOnScrollSpeed:u,panOnScrollMode:d,zoomOnDoubleClick:h,panOnDrag:g,zoomActivationKeyPressed:Y,preventScrolling:T,noPanClassName:z,userSelectionActive:D,noWheelClassName:C,lib:M,onTransformChange:W,connectionInProgress:U,selectionOnDrag:w,paneClickDistance:O})},[e,a,l,i,r,u,d,h,g,Y,T,z,D,C,M,W,U,w,O]),s.jsx("div",{className:"react-flow__renderer",ref:A,style:th,children:S})}const YD=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function VD(){const{userSelectionActive:e,userSelectionRect:a}=bt(YD,Kt);return e&&a?s.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:a.width,height:a.height,transform:`translate(${a.x}px, ${a.y}px)`}}):null}const qm=(e,a)=>l=>{l.target===a.current&&e?.(l)},qD=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function GD({isSelecting:e,selectionKeyPressed:a,selectionMode:l=hc.Full,panOnDrag:i,autoPanOnSelection:r,paneClickDistance:u,selectionOnDrag:d,onSelectionStart:h,onSelectionEnd:g,onPaneClick:p,onPaneContextMenu:x,onPaneScroll:m,onPaneMouseEnter:v,onPaneMouseMove:k,onPaneMouseLeave:T,children:S}){const C=N.useRef(0),z=Zt(),{userSelectionActive:E,elementsSelectable:j,dragging:O,panBy:w,autoPanSpeed:b}=bt(qD,Kt),A=j&&(e||E),D=N.useRef(null),M=N.useRef(),U=N.useRef(new Set),Y=N.useRef(new Set),q=N.useRef(!1),W=N.useRef(!1),L=N.useRef({x:0,y:0}),V=N.useRef(!1),I=ie=>{if(W.current||q.current||z.getState().connection.inProgress){W.current=!1,q.current=!1;return}p?.(ie),z.getState().resetSelectedElements(),z.setState({nodesSelectionActive:!1})},F=ie=>{if(Array.isArray(i)&&i?.includes(2)){ie.preventDefault();return}x?.(ie)},_=m?ie=>m(ie):void 0,H=ie=>{W.current&&(ie.stopPropagation(),W.current=!1)},P=ie=>{if(ie.pointerType==="touch"&&i!==!1&&!a)return;const{domNode:K,transform:ue}=z.getState();if(M.current=K?.getBoundingClientRect(),!M.current)return;const xe=ie.target===D.current;
14if(!xe&&!!ie.target.closest(".nokey")||!e||!(d&&xe||a)||ie.button!==0||!ie.isPrimary)return;ie.target?.setPointerCapture?.(ie.pointerId),W.current=!1;const{x:ee,y:ge}=cs(ie.nativeEvent,M.current),Le=kc({x:ee,y:ge},ue);z.setState({userSelectionRect:{width:0,height:0,startX:Le.x,startY:Le.y,x:ee,y:ge}}),xe||(ie.stopPropagation(),ie.preventDefault())};function X(ie,K){const{userSelectionRect:ue}=z.getState();if(!ue)return;const{transform:xe,nodeLookup:Ne,edgeLookup:He,connectionLookup:ee,triggerNodeChanges:ge,triggerEdgeChanges:Le,defaultEdgeOptions:me}=z.getState(),_e={x:ue.startX,y:ue.startY},{x:ke,y:re}=Yi(_e,xe),te={startX:_e.x,startY:_e.y,x:ie<ke?ie:ke,y:K<re?K:re,width:Math.abs(ie-ke),height:Math.abs(K-re)},Ce=U.current,Ee=Y.current;U.current=new Set(ag(Ne,te,xe,l===hc.Partial,!0).map(Ke=>Ke.id)),Y.current=new Set;const Re=me?.selectable??!0;for(const Ke of U.current){const mt=ee.get(Ke);if(mt)for(const{edgeId:dt}of mt.values()){const En=He.get(dt);En&&(En.selectable??Re)&&Y.current.add(dt)}}if(!J0(Ce,U.current)){const Ke=Ri(Ne,U.current,!0);ge(Ke)}if(!J0(Ee,Y.current)){const Ke=Ri(He,Y.current);Le(Ke)}z.setState({userSelectionRect:te,userSelectionActive:!0,nodesSelectionActive:!1})}function ne(){if(!r||!M.current)return;const[ie,K]=sg(L.current,M.current,b);w({x:ie,y:K}).then(ue=>{if(!W.current||!ue){C.current=requestAnimationFrame(ne);return}const{x:xe,y:Ne}=L.current;X(xe,Ne),C.current=requestAnimationFrame(ne)})}const pe=()=>{cancelAnimationFrame(C.current),C.current=0,V.current=!1};N.useEffect(()=>()=>pe(),[]);const R=ie=>{const{userSelectionRect:K,transform:ue,resetSelectedElements:xe}=z.getState();if(!M.current||!K)return;const{x:Ne,y:He}=cs(ie.nativeEvent,M.current);L.current={x:Ne,y:He};const ee=Yi({x:K.startX,y:K.startY},ue);if(!W.current){const ge=a?0:u;if(Math.hypot(Ne-ee.x,He-ee.y)<=ge)return;xe(),h?.(ie)}W.current=!0,V.current||(ne(),V.current=!0),X(Ne,He)},Q=ie=>{if(!A){ie.target===D.current&&z.getState().connection.inProgress&&(q.current=!0);return}ie.button===0&&(ie.target?.releasePointerCapture?.(ie.pointerId),!E&&ie.target===D.current&&z.getState().userSelectionRect&&I?.(ie),z.setState({userSelectionActive:!1,userSelectionRect:null}),W.current&&(g?.(ie),z.setState({nodesSelectionActive:U.current.size>0})),pe())},le=ie=>{ie.target?.releasePointerCapture?.(ie.pointerId),pe()},se=i===!0||Array.isArray(i)&&i.includes(0);return s.jsxs("div",{className:dn(["react-flow__pane",{draggable:se,dragging:O,selection:e}]),onClick:A?void 0:qm(I,D),onContextMenu:qm(F,D),onWheel:qm(_,D),onPointerEnter:A?void 0:v,onPointerMove:A?R:k,onPointerUp:Q,onPointerCancel:A?le:void 0,onPointerDownCapture:A?P:void 0,onClickCapture:A?H:void 0,onPointerLeave:T,ref:D,style:th,children:[S,s.jsx(VD,{})]})}function zp({id:e,store:a,unselect:l=!1,nodeRef:i}){const{addSelectedNodes:r,unselectNodesAndEdges:u,multiSelectionActive:d,nodeLookup:h,onError:g}=a.getState(),p=h.get(e);if(!p){g?.("012",ds.error012(e));return}a.setState({nodesSelectionActive:!1}),p.selected?(l||p.selected&&d)&&(u({nodes:[p],edges:[]}),requestAnimationFrame(()=>i?.current?.blur())):r([e])}function CN({nodeRef:e,disabled:a=!1,noDragClassName:l,handleSelector:i,nodeId:r,isSelectable:u,nodeClickDistance:d}){const h=Zt(),[g,p]=N.useState(!1),x=N.useRef();return N.useEffect(()=>{if(!a)return x.current=AM({getStoreItems:()=>h.getState(),onNodeMouseDown:m=>{zp({id:m,store:h,nodeRef:e})},onDragStart:()=>{p(!0)},onDragStop:()=>{p(!1)}}),()=>{x.current?.destroy(),x.current=void 0}},[a,h,e]),N.useEffect(()=>{a||!e.current||!x.current||x.current.update({noDragClassName:l,handleSelector:i,domNode:e.current,isSelectable:u,nodeId:r,nodeClickDistance:d})},[l,i,a,u,e,r,d]),g}const XD=e=>a=>a.selected&&(a.draggable||e&&typeof a.draggable>"u");function EN(){const e=Zt();return N.useCallback(l=>{const{nodeExtent:i,snapToGrid:r,snapGrid:u,nodesDraggable:d,onError:h,updateNodePositions:g,nodeLookup:p,nodeOrigin:x}=e.getState(),m=new Map,v=XD(d),k=r?u[0]:5,T=r?u[1]:5,S=l.direction.x*k*l.factor,C=l.direction.y*T*l.factor;for(const[,z]of p){if(!v(z))continue;let E={x:z.internals.positionAbsolute.x+S,y:z.internals.positionAbsolute.y+C};r&&(E=Nc(E,u));const{position:j,positionAbsolute:O}=qj({nodeId:z.id,nextPosition:E,nodeLookup:p,nodeExtent:i,nodeOrigin:x,onError:h});z.position=j,z.internals.positionAbsolute=O,m.set(z.id,z)}g(m)},[])}const mg=N.createContext(null),ZD=mg.Provider;mg.Consumer;const pg=()=>N.useContext(mg),FD=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),TN=N.createContext(null);function KD({children:e}){const a=bt(FD,Kt);return s.jsx(TN.Provider,{value:a,children:e})}function QD(){const e=N.useContext(TN);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const WD={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},JD=(e,a,l)=>i=>{const{connectionClickStartHandle:r,connectionMode:u,connection:d}=i,{fromHandle:h,toHandle:g,isValid:p}=d;if(!h&&!r)return WD;const x=g?.nodeId===e&&g?.id===a&&g?.type===l;return{connectingFrom:h?.nodeId===e&&h?.id===a&&h?.type===l,connectingTo:x,clickConnecting:r?.nodeId===e&&r?.id===a&&r?.type===l,isPossibleEndHandle:u===Bi.Strict?h?.type!==l:e!==h?.nodeId||a!==h?.id,connectionInProcess:!!h,clickConnectionInProcess:!!r,valid:x&&p}};function e_({type:e="source",position:a=Ye.Top,isValidConnection:l,isConnectable:i=!0,isConnectableStart:r=!0,isConnectableEnd:u=!0,id:d,onConnect:h,children:g,className:p,onMouseDown:x,onTouchStart:m,...v},k){const T=d||null,S=e==="target",C=Zt(),z=pg(),{connectOnClick:E,noPanClassName:j,rfId:O}=QD(),{connectingFrom:w,connectingTo:b,clickConnecting:A,isPossibleEndHandle:D,connectionInProcess:M,clickConnectionInProcess:U,valid:Y}=bt(JD(z,T,e),Kt);z||C.getState().onError?.("010",ds.error010());const q=V=>{const{defaultEdgeOptions:I,onConnect:F,hasDefaultEdges:_}=C.getState(),H={...I,...V};if(_){const{edges:P,setEdges:X,onError:ne}=C.getState();X(OD(H,P,{onError:ne}))}F?.(H),h?.(H)},W=V=>{if(!z)return;const I=tN(V.nativeEvent);if(r&&(I&&V.button===0||!I)){const F=C.getState();
14Ip.onPointerDown(V.nativeEvent,{handleDomNode:V.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:S,handleId:T,nodeId:z,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(..._)=>C.getState().onConnectEnd?.(..._),updateConnection:F.updateConnection,onConnect:q,isValidConnection:l||((..._)=>C.getState().isValidConnection?.(..._)??!0),getTransform:()=>C.getState().transform,getFromHandle:()=>C.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}I?x?.(V):m?.(V)},L=V=>{const{onClickConnectStart:I,onClickConnectEnd:F,connectionClickStartHandle:_,connectionMode:H,isValidConnection:P,lib:X,rfId:ne,nodeLookup:pe,connection:R}=C.getState();if(!z||!_&&!r)return;if(!_){I?.(V.nativeEvent,{nodeId:z,handleId:T,handleType:e}),C.setState({connectionClickStartHandle:{nodeId:z,type:e,id:T}});return}const Q=Jj(V.target),le=l||P,{connection:se,isValid:ie}=Ip.isValid(V.nativeEvent,{handle:{nodeId:z,id:T,type:e},connectionMode:H,fromNodeId:_.nodeId,fromHandleId:_.id||null,fromType:_.type,isValidConnection:le,flowId:ne,doc:Q,lib:X,nodeLookup:pe});ie&&se&&q(se);const K=structuredClone(R);delete K.inProgress,K.toPosition=K.toHandle?K.toHandle.position:null,F?.(V,K),C.setState({connectionClickStartHandle:null})};return s.jsx("div",{"data-handleid":T,"data-nodeid":z,"data-handlepos":a,"data-id":`${O}-${z}-${T}-${e}`,className:dn(["react-flow__handle",`react-flow__handle-${a}`,"nodrag",j,p,{source:!S,target:S,connectable:i,connectablestart:r,connectableend:u,clickconnecting:A,connectingfrom:w,connectingto:b,valid:Y,connectionindicator:i&&(!M||D)&&(M||U?u:r)}]),onMouseDown:W,onTouchStart:W,onClick:E?L:void 0,ref:k,...v,children:g})}const hs=N.memo(NN(e_));function t_({data:e,isConnectable:a,sourcePosition:l=Ye.Bottom}){return s.jsxs(s.Fragment,{children:[e?.label,s.jsx(hs,{type:"source",position:l,isConnectable:a})]})}function n_({data:e,isConnectable:a,targetPosition:l=Ye.Top,sourcePosition:i=Ye.Bottom}){return s.jsxs(s.Fragment,{children:[s.jsx(hs,{type:"target",position:l,isConnectable:a}),e?.label,s.jsx(hs,{type:"source",position:i,isConnectable:a})]})}function a_(){return null}function s_({data:e,isConnectable:a,targetPosition:l=Ye.Top}){return s.jsxs(s.Fragment,{children:[s.jsx(hs,{type:"target",position:l,isConnectable:a}),e?.label]})}const Id={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Db={input:t_,default:n_,output:s_,group:a_};function l_(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const o_=e=>{const{width:a,height:l,x:i,y:r}=Xi(e.nodeLookup,{filter:u=>!!u.selected});return{width:rs(a)?a:null,height:rs(l)?l:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${r}px)`}};function i_({onSelectionContextMenu:e,noPanClassName:a,disableKeyboardA11y:l}){const i=Zt(),{width:r,height:u,transformString:d,userSelectionActive:h}=bt(o_,Kt),g=EN(),p=N.useRef(null);N.useEffect(()=>{l||p.current?.focus({preventScroll:!0})},[l]);const x=!h&&r!==null&&u!==null;if(CN({nodeRef:p,disabled:!x}),!x)return null;const m=e?k=>{const T=i.getState().nodes.filter(S=>S.selected);e(k,T)}:void 0,v=k=>{Object.prototype.hasOwnProperty.call(Id,k.key)&&(k.preventDefault(),g({direction:Id[k.key],factor:k.shiftKey?4:1}))};return s.jsx("div",{className:dn(["react-flow__nodesselection","react-flow__container",a]),style:{transform:d},children:s.jsx("div",{ref:p,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:l?void 0:-1,onKeyDown:l?void 0:v,style:{width:r,height:u}})})}const _b=typeof window<"u"?window:void 0,r_=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function MN({children:e,onPaneClick:a,onPaneMouseEnter:l,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:u,onPaneScroll:d,paneClickDistance:h,deleteKeyCode:g,selectionKeyCode:p,selectionOnDrag:x,selectionMode:m,onSelectionStart:v,onSelectionEnd:k,multiSelectionKeyCode:T,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:z,zoomOnScroll:E,zoomOnPinch:j,panOnScroll:O,panOnScrollSpeed:w,panOnScrollMode:b,zoomOnDoubleClick:A,panOnDrag:D,autoPanOnSelection:M,defaultViewport:U,translateExtent:Y,minZoom:q,maxZoom:W,preventScrolling:L,onSelectionContextMenu:V,noWheelClassName:I,noPanClassName:F,disableKeyboardA11y:_,onViewportChange:H,isControlledViewport:P}){const{nodesSelectionActive:X,userSelectionActive:ne}=bt(r_,Kt),pe=pc(p,{target:_b}),R=pc(S,{target:_b}),Q=R||D,le=R||O,se=x&&Q!==!0,ie=pe||ne||se;return UD({deleteKeyCode:g,multiSelectionKeyCode:T}),s.jsx(PD,{onPaneContextMenu:u,elementsSelectable:z,zoomOnScroll:E,zoomOnPinch:j,panOnScroll:le,panActivationKeyPressed:R,panOnScrollSpeed:w,panOnScrollMode:b,zoomOnDoubleClick:A,panOnDrag:!pe&&Q,defaultViewport:U,translateExtent:Y,minZoom:q,maxZoom:W,zoomActivationKeyCode:C,preventScrolling:L,noWheelClassName:I,noPanClassName:F,onViewportChange:H,isControlledViewport:P,paneClickDistance:h,selectionOnDrag:se,children:s.jsxs(GD,{onSelectionStart:v,onSelectionEnd:k,onPaneClick:a,onPaneMouseEnter:l,onPaneMouseMove:i,onPaneMouseLeave:r,onPaneContextMenu:u,onPaneScroll:d,panOnDrag:Q,autoPanOnSelection:M,isSelecting:!!ie,selectionMode:m,selectionKeyPressed:pe,paneClickDistance:h,selectionOnDrag:se,children:[e,X&&s.jsx(i_,{onSelectionContextMenu:V,noPanClassName:F,disableKeyboardA11y:_})]})})}MN.displayName="FlowRenderer";const c_=N.memo(MN),u_=e=>a=>e?ag(a.nodeLookup,{x:0,y:0,width:a.width,height:a.height}
14,a.transform,!0).map(l=>l.id):Array.from(a.nodeLookup.keys());function d_(e){return bt(N.useCallback(u_(e),[e]),Kt)}const h_=e=>e.updateNodeInternals;function f_(){const e=bt(h_),[a]=N.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(l=>{const i=new Map;l.forEach(r=>{const u=r.target.getAttribute("data-id");i.set(u,{id:u,nodeElement:r.target,force:!0})}),e(i)}));return N.useEffect(()=>()=>{a?.disconnect()},[a]),a}function m_({node:e,nodeType:a,hasDimensions:l,resizeObserver:i}){const r=Zt(),u=N.useRef(null),d=N.useRef(null),h=N.useRef(e.sourcePosition),g=N.useRef(e.targetPosition),p=N.useRef(a),x=l&&!!e.internals.handleBounds;return N.useEffect(()=>{u.current&&!e.hidden&&(!x||d.current!==u.current)&&(d.current&&i?.unobserve(d.current),i?.observe(u.current),d.current=u.current)},[x,e.hidden]),N.useEffect(()=>()=>{d.current&&(i?.unobserve(d.current),d.current=null)},[]),N.useEffect(()=>{if(u.current){const m=p.current!==a,v=h.current!==e.sourcePosition,k=g.current!==e.targetPosition;(m||v||k)&&(p.current=a,h.current=e.sourcePosition,g.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:u.current,force:!0}]])))}},[e.id,a,e.sourcePosition,e.targetPosition]),u}function p_({id:e,onClick:a,onMouseEnter:l,onMouseMove:i,onMouseLeave:r,onContextMenu:u,onDoubleClick:d,nodesDraggable:h,elementsSelectable:g,nodesConnectable:p,nodesFocusable:x,resizeObserver:m,noDragClassName:v,noPanClassName:k,disableKeyboardA11y:T,rfId:S,nodeTypes:C,nodeClickDistance:z,onError:E}){const{node:j,internals:O,isParent:w}=bt(ie=>{const K=ie.nodeLookup.get(e),ue=ie.parentLookup.has(e);return{node:K,internals:K.internals,isParent:ue}},Kt);let b=j.type||"default",A=C?.[b]||Db[b];A===void 0&&(E?.("003",ds.error003(b)),b="default",A=C?.default||Db.default);const D=!!(j.draggable||h&&typeof j.draggable>"u"),M=!!(j.selectable||g&&typeof j.selectable>"u"),U=!!(j.connectable||p&&typeof j.connectable>"u"),Y=!!(j.focusable||x&&typeof j.focusable>"u"),q=Zt(),W=Kj(j),L=m_({node:j,nodeType:b,hasDimensions:W,resizeObserver:m}),V=CN({nodeRef:L,disabled:j.hidden||!D,noDragClassName:v,handleSelector:j.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:z}),I=EN();if(j.hidden)return null;const F=ps(j),_=l_(j),H=M||D||a||l||i||r,P=l?ie=>l(ie,{...O.userNode}):void 0,X=i?ie=>i(ie,{...O.userNode}):void 0,ne=r?ie=>r(ie,{...O.userNode}):void 0,pe=u?ie=>u(ie,{...O.userNode}):void 0,R=d?ie=>d(ie,{...O.userNode}):void 0,Q=ie=>{const{selectNodesOnDrag:K,nodeDragThreshold:ue}=q.getState();M&&(!K||!D||ue>0)&&zp({id:e,store:q,nodeRef:L}),a&&a(ie,{...O.userNode})},le=ie=>{if(!(eN(ie.nativeEvent)||T)){if(Bj.includes(ie.key)&&M){const K=ie.key==="Escape";zp({id:e,store:q,unselect:K,nodeRef:L})}else if(D&&j.selected&&Object.prototype.hasOwnProperty.call(Id,ie.key)){ie.preventDefault();const{ariaLabelConfig:K}=q.getState();q.setState({ariaLiveMessage:K["node.a11yDescription.ariaLiveMessage"]({direction:ie.key.replace("Arrow","").toLowerCase(),x:~~O.positionAbsolute.x,y:~~O.positionAbsolute.y})}),I({direction:Id[ie.key],factor:ie.shiftKey?4:1})}}},se=()=>{if(T||!L.current?.matches(":focus-visible"))return;const{transform:ie,width:K,height:ue,autoPanOnNodeFocus:xe,setCenter:Ne}=q.getState();if(!xe)return;ag(new Map([[e,j]]),{x:0,y:0,width:K,height:ue},ie,!0).length>0||Ne(j.position.x+F.width/2,j.position.y+F.height/2,{zoom:ie[2]})};return s.jsx("div",{className:dn(["react-flow__node",`react-flow__node-${b}`,{[k]:D},j.className,{selected:j.selected,selectable:M,parent:w,draggable:D,dragging:V}]),ref:L,style:{zIndex:O.z,transform:`translate(${O.positionAbsolute.x}px,${O.positionAbsolute.y}px)`,pointerEvents:H?"all":"none",visibility:W?"visible":"hidden",...j.style,..._},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:P,onMouseMove:X,onMouseLeave:ne,onContextMenu:pe,onClick:Q,onDoubleClick:R,onKeyDown:Y?le:void 0,tabIndex:Y?0:void 0,onFocus:Y?se:void 0,role:j.ariaRole??(Y?"group":void 0),"aria-roledescription":"node","aria-describedby":T?void 0:`${yN}-${S}`,"aria-label":j.ariaLabel,...j.domAttributes,children:s.jsx(ZD,{value:e,children:s.jsx(A,{id:e,data:j.data,t
14ype:b,positionAbsoluteX:O.positionAbsolute.x,positionAbsoluteY:O.positionAbsolute.y,selected:j.selected??!1,selectable:M,draggable:D,deletable:j.deletable??!0,isConnectable:U,sourcePosition:j.sourcePosition,targetPosition:j.targetPosition,dragging:V,dragHandle:j.dragHandle,zIndex:O.z,parentId:j.parentId,...F})})})}var g_=N.memo(p_);const y_=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function DN(e){const{nodesConnectable:a,nodesFocusable:l,elementsSelectable:i,onError:r}=bt(y_,Kt),u=d_(e.onlyRenderVisibleElements),d=f_();return s.jsx("div",{className:"react-flow__nodes",style:th,children:u.map(h=>s.jsx(g_,{id:h,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:d,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:a,nodesFocusable:l,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:r},h))})}DN.displayName="NodeRenderer";const x_=N.memo(DN);function v_(e){return bt(N.useCallback(l=>{if(!e)return l.edges.map(r=>r.id);const i=[];if(l.width&&l.height)for(const r of l.edges){const u=l.nodeLookup.get(r.source),d=l.nodeLookup.get(r.target);u&&d&&fM({sourceNode:u,targetNode:d,width:l.width,height:l.height,transform:l.transform})&&i.push(r.id)}return i},[e]),Kt)}const b_=({color:e="none",strokeWidth:a=1})=>{const l={strokeWidth:a,...e&&{stroke:e}};return s.jsx("polyline",{className:"arrow",style:l,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},w_=({color:e="none",strokeWidth:a=1})=>{const l={strokeWidth:a,...e&&{stroke:e,fill:e}};return s.jsx("polyline",{className:"arrowclosed",style:l,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ob={[Dd.Arrow]:b_,[Dd.ArrowClosed]:w_};function j_(e){const a=Zt();return N.useMemo(()=>Object.prototype.hasOwnProperty.call(Ob,e)?Ob[e]:(a.getState().onError?.("009",ds.error009(e)),null),[e])}const N_=({id:e,type:a,color:l,width:i=12.5,height:r=12.5,markerUnits:u="strokeWidth",strokeWidth:d,orient:h="auto-start-reverse"})=>{const g=j_(a);return g?s.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:u,orient:h,refX:"0",refY:"0",children:s.jsx(g,{color:l,strokeWidth:d})}):null},_N=({defaultColor:e,rfId:a})=>{const l=bt(u=>u.edges),i=bt(u=>u.defaultEdgeOptions),r=N.useMemo(()=>wM(l,{id:a,defaultColor:e,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd}),[l,i,a,e]);return r.length?s.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:s.jsx("defs",{children:r.map(u=>s.jsx(N_,{id:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,strokeWidth:u.strokeWidth,orient:u.orient},u.id))})}):null};_N.displayName="MarkerDefinitions";var k_=N.memo(_N);function ON({x:e,y:a,label:l,labelStyle:i,labelShowBg:r=!0,labelBgStyle:u,labelBgPadding:d=[2,4],labelBgBorderRadius:h=2,children:g,className:p,...x}){const[m,v]=N.useState({x:1,y:0,width:0,height:0}),k=dn(["react-flow__edge-textwrapper",p]),T=N.useRef(null);return N.useEffect(()=>{if(T.current){const S=T.current.getBBox();v({x:S.x,y:S.y,width:S.width,height:S.height})}},[l]),l?s.jsxs("g",{transform:`translate(${e-m.width/2} ${a-m.height/2})`,className:k,visibility:m.width?"visible":"hidden",...x,children:[r&&s.jsx("rect",{width:m.width+2*d[0],x:-d[0],y:-d[1],height:m.height+2*d[1],className:"react-flow__edge-textbg",style:u,rx:h,ry:h}),s.jsx("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:T,style:i,children:l}),g]}):null}ON.displayName="EdgeText";const S_=N.memo(ON);function Cc({path:e,labelX:a,labelY:l,label:i,labelStyle:r,labelShowBg:u,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,interactionWidth:p=20,...x}){return s.jsxs(s.Fragment,{children:[s.jsx("path",{...x,d:e,fill:"none",className:dn(["react-flow__edge-path",x.className])}),p?s.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}):null,i&&rs(a)&&rs(l)?s.jsx(S_,{x:a,y:l,label:i,labelStyle:r,labelShowBg:u,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g}):null]})}function Ab({pos:e,x1:a,y1:l,x2:i,y2:r}){return e===Ye.Left||e===Ye.Right?[.5*(a+i),l]:[a,.5*(l+r)]}function AN({sourceX:e,sourceY:a,sourcePosition:l=Ye.Bottom,targetX:i,targetY:r,targetPosition:u=Ye.Top}){const[d,h]=Ab({pos:l,x1:e,y1:a,x2:i,y2:r}),[g,p]=Ab({pos:u,x1:i,y1:r,x2:e,y2:a}),[x,m,v,k]=nN({sourceX:e,sourceY:a,targetX:i,targetY:r,sourceControlX:d,sourceControlY:h,targetControlX:g,targetControlY:p});return[`M${e},${a} C${d},${h} ${g},${p} ${i},${r}`,x,m,v,k]}function IN(e){return N.memo(({id:a,sourceX:l,sourceY:i,targetX:r,targetY:u,sourcePosition:d,targetPosition:h,label:g,labelStyle:p,labelShowBg:x,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:k,style:T,markerEnd:S,markerStart:C,interactionWidth:z})=>{const[E,j,O]=AN({sourceX:l,sourceY:i,sourcePosition:d,targetX:r,targetY:u,targetPosition:h}),w=e.isInternal?void 0:a;return s.jsx(Cc,{id:w,path:E,labelX:j,labelY:O,label:g,labelStyle:p,labelShowBg:x,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:k,style:T,markerEnd:S,markerStart:C,interactionWidth:z})})}const C_=IN({isInternal:!1}),zN=IN({isInternal:!0});C_.displayName="SimpleBezierEdge";zN.displayName="SimpleBezierEdgeInternal";function RN(e){return N.memo(({id:a,sourceX:l,sourceY:i,targetX:r,targetY:u,label:d,labelStyle:h,labelShowBg:g,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:m,style:v,sourcePosition:k=Ye.Bottom,targetPosition:T=Ye.Top,markerEnd:S,markerStart:C,pathOptions:z,interactionWidth:E})=>{const[j,O,w]=Ad({sourceX:l,sourceY:i,sourcePosition:k,targetX:r,targetY:u,targetPosition:T,borderRadius:z?.borderRadius,offset:z?.offset,stepPosition:z?.stepPosition}),b=e.isInternal?void 0:a;return s.jsx(Cc,{id:b,path:j,labelX:O,labelY:w,label:d,labelStyle:h,labelShowBg:g,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:m,style:v,markerEnd:S,markerStart:C,interactionWidth:E})})}const $N=RN({isInternal:!1}),LN=RN({isInternal:!0});$N.displayName="SmoothStepEdge";LN.displayName="SmoothStepEdgeInternal";function UN(e){return N.memo(({id:a,...l})=>{const i=e.isInternal?void 0:a;return s.jsx($N,{...l,id:i,pathOptions:N.useMemo(()=>({borderRadius:0,offset:l.pathOptions?.offset}),[l.pathOptions?.offset])})})}const E_=UN({isInternal:!1}),HN=UN({isInternal:!0});
14E_.displayName="StepEdge";HN.displayName="StepEdgeInternal";function BN(e){return N.memo(({id:a,sourceX:l,sourceY:i,targetX:r,targetY:u,label:d,labelStyle:h,labelShowBg:g,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:m,style:v,markerEnd:k,markerStart:T,interactionWidth:S})=>{const[C,z,E]=rg({sourceX:l,sourceY:i,targetX:r,targetY:u}),j=e.isInternal?void 0:a;return s.jsx(Cc,{id:j,path:C,labelX:z,labelY:E,label:d,labelStyle:h,labelShowBg:g,labelBgStyle:p,labelBgPadding:x,labelBgBorderRadius:m,style:v,markerEnd:k,markerStart:T,interactionWidth:S})})}const T_=BN({isInternal:!1}),PN=BN({isInternal:!0});T_.displayName="StraightEdge";PN.displayName="StraightEdgeInternal";function YN(e){return N.memo(({id:a,sourceX:l,sourceY:i,targetX:r,targetY:u,sourcePosition:d=Ye.Bottom,targetPosition:h=Ye.Top,label:g,labelStyle:p,labelShowBg:x,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:k,style:T,markerEnd:S,markerStart:C,pathOptions:z,interactionWidth:E})=>{const[j,O,w]=ig({sourceX:l,sourceY:i,sourcePosition:d,targetX:r,targetY:u,targetPosition:h,curvature:z?.curvature}),b=e.isInternal?void 0:a;return s.jsx(Cc,{id:b,path:j,labelX:O,labelY:w,label:g,labelStyle:p,labelShowBg:x,labelBgStyle:m,labelBgPadding:v,labelBgBorderRadius:k,style:T,markerEnd:S,markerStart:C,interactionWidth:E})})}const M_=YN({isInternal:!1}),VN=YN({isInternal:!0});M_.displayName="BezierEdge";VN.displayName="BezierEdgeInternal";const Ib={default:VN,straight:PN,step:HN,smoothstep:LN,simplebezier:zN},zb={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},D_=(e,a,l)=>l===Ye.Left?e-a:l===Ye.Right?e+a:e,__=(e,a,l)=>l===Ye.Top?e-a:l===Ye.Bottom?e+a:e,Rb="react-flow__edgeupdater";function $b({position:e,centerX:a,centerY:l,radius:i=10,onMouseDown:r,onMouseEnter:u,onMouseOut:d,type:h}){return s.jsx("circle",{onMouseDown:r,onMouseEnter:u,onMouseOut:d,className:dn([Rb,`${Rb}-${h}`]),cx:D_(a,i,e),cy:__(l,i,e),r:i,stroke:"transparent",fill:"transparent"})}function O_({isReconnectable:e,reconnectRadius:a,edge:l,sourceX:i,sourceY:r,targetX:u,targetY:d,sourcePosition:h,targetPosition:g,onReconnect:p,onReconnectStart:x,onReconnectEnd:m,setReconnecting:v,setUpdateHover:k}){const T=Zt(),S=(O,w)=>{if(O.button!==0)return;const{autoPanOnConnect:b,domNode:A,connectionMode:D,connectionRadius:M,lib:U,onConnectStart:Y,cancelConnection:q,nodeLookup:W,rfId:L,panBy:V,updateConnection:I}=T.getState(),F=w.type==="target",_=(X,ne)=>{v(!1),m?.(X,l,w.type,ne)},H=X=>p?.(l,X),P=(X,ne)=>{v(!0),x?.(O,l,w.type),Y?.(X,ne)};Ip.onPointerDown(O.nativeEvent,{autoPanOnConnect:b,connectionMode:D,connectionRadius:M,domNode:A,handleId:w.id,nodeId:w.nodeId,nodeLookup:W,isTarget:F,edgeUpdaterType:w.type,lib:U,flowId:L,cancelConnection:q,panBy:V,isValidConnection:(...X)=>T.getState().isValidConnection?.(...X)??!0,onConnect:H,onConnectStart:P,onConnectEnd:(...X)=>T.getState().onConnectEnd?.(...X),onReconnectEnd:_,updateConnection:I,getTransform:()=>T.getState().transform,getFromHandle:()=>T.getState().connection.fromHandle,dragThreshold:T.getState().connectionDragThreshold,handleDomNode:O.currentTarget})},C=O=>S(O,{nodeId:l.target,id:l.targetHandle??null,type:"target"}),z=O=>S(O,{nodeId:l.source,id:l.sourceHandle??null,type:"source"}),E=()=>k(!0),j=()=>k(!1);return s.jsxs(s.Fragment,{children:[(e===!0||e==="source")&&s.jsx($b,{position:h,centerX:i,centerY:r,radius:a,onMouseDown:C,onMouseEnter:E,onMouseOut:j,type:"source"}),(e===!0||e==="target")&&s.jsx($b,{position:g,centerX:u,centerY:d,radius:a,onMouseDown:z,onMouseEnter:E,onMouseOut:j,type:"target"})]})}function A_({id:e,edgesFocusable:a,edgesReconnectable:l,elementsSelectable:i,onClick:r,onDoubleClick:u,onContextMenu:d,onMouseEnter:h,onMouseMove:g,onMouseLeave:p,reconnectRadius:x,onReconnect:m,onReconnectStart:v,onReconnectEnd:k,rfId:T,edgeTypes:S,noPanClassName:C,onError:z,disableKeyboardA11y:E}){let j=bt(Ne=>Ne.edgeLookup.get(e));const O=bt(Ne=>Ne.defaultEdgeOptions);j=O?{...O,...j}:j;let w=j.type||"default",b=S?.[w]||Ib[w];b===void 0&&(z?.("011",ds.error011(w)),w="default",b=S?.default||Ib.default);const A=!!(j.focusable||a&&typeof j.focusable>"u"),D=typeof m<"u"&&(j.reconnectable||l&&typeof j.reconnectable>"u"),M=!!(j.selectable||i&&typeof j.selectable>"u"),U=N.useRef(null),[Y,q]=N.useState(!1),[W,L]=N.useState(!1),V=Zt(),{zIndex:I=j.zIndex,sourceX:F,sourceY:_,targetX:H,targetY:P,sourcePosition:X,targetPosition:ne}=bt(N.useCallback(Ne=>{const He=Ne.nodeLookup.get(j.source),ee=Ne.nodeLookup.get(j.target);if(!He||!ee)return zb;const ge=bM({id:e,sourceNode:He,targetNode:ee,sourceHandle:j.sourceHandle||null,targetHandle:j.targetHandle||null,connectionMode:Ne.connectionMode,onError:z}),Le=hM({selected:j.selected,zIndex:j.zIndex,sourceNode:He,targetNode:ee,elevateOnSelect:Ne.elevateEdgesOnSelect,zIndexMode:Ne.zIndexMode});return{...ge||zb,zIndex:Le}},[j.source,j.target,j.sourceHandle,j.targetHandle,j.selected,j.zIndex,z]),Kt),pe=N.useMemo(()=>j.markerStart?`url('#${Op(j.markerStart,T)}')`:void 0,[j.markerStart,T]),R=N.useMemo(()=>j.markerEnd?`url('#${Op(j.markerEnd,T)}')`:void 0,[j.markerEnd,T]);if(j.hidden||F===null||_===null||H===null||P===null)return null;const Q=Ne=>{const{addSelectedEdges:He,unselectNodesAndEdges:ee,multiSelectionActive:ge}=V.getState();M&&(V.setState({nodesSelectionActive:!1}),j.selected&&ge?(ee({nodes:[],edges:[j]}),U.current?.blur()):He([e])),r&&r(Ne,j)},le=u?Ne=>{u(Ne,{...j})}:void 0,se=d?Ne=>{d(Ne,{...j})}:void 0,ie=h?Ne=>{h(Ne,{...j})}:void 0,K=g?Ne=>{g(Ne,{...j})}:void 0,ue=p?Ne=>{p(Ne,{...j})}:void 0,xe=Ne=>{if(!E&&Bj.includes(Ne.key)&&M){const{unselectNodesAndEdges:He,addSelectedEdges:ee}=V.getState();Ne.key==="Escape"?(U.current?.blur(),He({edges:[j]})):ee([e])}};return s.jsx("svg",{style:{zIndex:I},children:s.jsxs("g",{className:dn(["react-flow__edge",`react-flow__edge-${w}`,j.className,C,{selected:j.selected,animated:j.animated,inactive:!M&&
14!r,updating:Y,selectable:M}]),onClick:Q,onDoubleClick:le,onContextMenu:se,onMouseEnter:ie,onMouseMove:K,onMouseLeave:ue,onKeyDown:A?xe:void 0,tabIndex:A?0:void 0,role:j.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":j.ariaLabel===null?void 0:j.ariaLabel||`Edge from ${j.source} to ${j.target}`,"aria-describedby":A?`${xN}-${T}`:void 0,ref:U,...j.domAttributes,children:[!W&&s.jsx(b,{id:e,source:j.source,target:j.target,type:j.type,selected:j.selected,animated:j.animated,selectable:M,deletable:j.deletable??!0,label:j.label,labelStyle:j.labelStyle,labelShowBg:j.labelShowBg,labelBgStyle:j.labelBgStyle,labelBgPadding:j.labelBgPadding,labelBgBorderRadius:j.labelBgBorderRadius,sourceX:F,sourceY:_,targetX:H,targetY:P,sourcePosition:X,targetPosition:ne,data:j.data,style:j.style,sourceHandleId:j.sourceHandle,targetHandleId:j.targetHandle,markerStart:pe,markerEnd:R,pathOptions:"pathOptions"in j?j.pathOptions:void 0,interactionWidth:j.interactionWidth}),D&&s.jsx(O_,{edge:j,isReconnectable:D,reconnectRadius:x,onReconnect:m,onReconnectStart:v,onReconnectEnd:k,sourceX:F,sourceY:_,targetX:H,targetY:P,sourcePosition:X,targetPosition:ne,setUpdateHover:q,setReconnecting:L})]})})}var I_=N.memo(A_);const z_=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function qN({defaultMarkerColor:e,onlyRenderVisibleElements:a,rfId:l,edgeTypes:i,noPanClassName:r,onReconnect:u,onEdgeContextMenu:d,onEdgeMouseEnter:h,onEdgeMouseMove:g,onEdgeMouseLeave:p,onEdgeClick:x,reconnectRadius:m,onEdgeDoubleClick:v,onReconnectStart:k,onReconnectEnd:T,disableKeyboardA11y:S}){const{edgesFocusable:C,edgesReconnectable:z,elementsSelectable:E,onError:j}=bt(z_,Kt),O=v_(a);return s.jsxs("div",{className:"react-flow__edges",children:[s.jsx(k_,{defaultColor:e,rfId:l}),O.map(w=>s.jsx(I_,{id:w,edgesFocusable:C,edgesReconnectable:z,elementsSelectable:E,noPanClassName:r,onReconnect:u,onContextMenu:d,onMouseEnter:h,onMouseMove:g,onMouseLeave:p,onClick:x,reconnectRadius:m,onDoubleClick:v,onReconnectStart:k,onReconnectEnd:T,rfId:l,onError:j,edgeTypes:i,disableKeyboardA11y:S},w))]})}qN.displayName="EdgeRenderer";const R_=N.memo(qN),Lb=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function $_({children:e}){const a=Zt(),l=N.useRef(null),[i]=N.useState(()=>a.getState().transform);return kN(()=>{let r=null;const u=()=>{const d=a.getState().transform;r&&d[0]===r[0]&&d[1]===r[1]&&d[2]===r[2]||(r=d,l.current&&(l.current.style.transform=Lb(d)))};return u(),a.subscribe(u)},[a]),s.jsx("div",{ref:l,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Lb(i)},children:e})}function L_(e){const a=Zi(),l=N.useRef(!1);N.useEffect(()=>{!l.current&&a.viewportInitialized&&e&&(setTimeout(()=>e(a),1),l.current=!0)},[e,a.viewportInitialized])}const U_=e=>e.panZoom?.syncViewport;function H_(e){const a=bt(U_),l=Zt();return N.useEffect(()=>{e&&(a?.(e),l.setState({transform:[e.x,e.y,e.zoom]}))},[e,a]),null}function B_(e){return e.connection.inProgress?{...e.connection,to:kc(e.connection.to,e.transform)}:{...e.connection}}function P_(e){return B_}function Y_(e){const a=P_();return bt(a,Kt)}const V_=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function q_({containerStyle:e,style:a,type:l,component:i}){const{nodesConnectable:r,width:u,height:d,isValid:h,inProgress:g}=bt(V_,Kt);return!(u&&r&&g)?null:s.jsx("svg",{style:e,width:u,height:d,className:"react-flow__connectionline react-flow__container",children:s.jsx("g",{className:dn(["react-flow__connection",Wj(h)]),children:s.jsx(GN,{style:a,type:l,CustomComponent:i,isValid:h})})})}const GN=({style:e,type:a=Pl.Bezier,CustomComponent:l,isValid:i})=>{const{inProgress:r,from:u,fromNode:d,fromHandle:h,fromPosition:g,to:p,toNode:x,toHandle:m,toPosition:v,pointer:k}=Y_();if(!r)return;if(l)return s.jsx(l,{connectionLineType:a,connectionLineStyle:e,fromNode:d,fromHandle:h,fromX:u.x,fromY:u.y,toX:p.x,toY:p.y,fromPosition:g,toPosition:v,connectionStatus:Wj(i),toNode:x,toHandle:m,pointer:k});let T="";const S={sourceX:u.x,sourceY:u.y,sourcePosition:g,targetX:p.x,targetY:p.y,targetPosition:v};switch(a){case Pl.Bezier:[T]=ig(S);break;case Pl.SimpleBezier:[T]=AN(S);break;case Pl.Step:[T]=Ad({...S,borderRadius:0});break;case Pl.SmoothStep:[T]=Ad(S);break;default:[T]=rg(S)}return s.jsx("path",{d:T,fill:"none",className:"react-flow__connection-path",style:e})};GN.displayName="ConnectionLine";const G_={};function Ub(e=G_){N.useRef(e),Zt(),N.useEffect(()=>{},[e])}function X_(){Zt(),N.useRef(!1),N.useEffect(()=>{},[])}function XN({nodeTypes:e,edgeTypes:a,onInit:l,onNodeClick:i,onEdgeClick:r,onNodeDoubleClick:u,onEdgeDoubleClick:d,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:p,onNodeContextMenu:x,onSelectionContextMenu:m,onSelectionStart:v,onSelectionEnd:k,connectionLineType:T,connectionLineStyle:S,connectionLineComponent:C,connectionLineContainerStyle:z,selectionKeyCode:E,selectionOnDrag:j,selectionMode:O,multiSelectionKeyCode:w,panActivationKeyCode:b,zoomActivationKeyCode:A,deleteKeyCode:D,onlyRenderVisibleElements:M,elementsSelectable:U,defaultViewport:Y,translateExtent:q,minZoom:W,maxZoom:L,preventScrolling:V,defaultMarkerColor:I,zoomOnScroll:F,zoomOnPinch:_,panOnScroll:H,panOnScrollSpeed:P,panOnScrollMode:X,zoomOnDoubleClick:ne,panOnDrag:pe,autoPanOnSelection:R,onPaneClick:Q,onPaneMouseEnter:le,onPaneMouseMove:se,onPaneMouseLeave:ie,onPaneScroll:K,onPaneContextMenu:ue,paneClickDistance:xe,nodeClickDistance:Ne,onEdgeContextMenu:He,onEdgeMouseEnter:ee,onEdgeMouseMove:ge,onEdgeMouseLeave:Le,reconnectRadius:me,onReconnect:_e,onReconnectStart:ke,onReconnectEnd:re,noDragClassName:te,noWheelClassName:Ce,noPanClassName:Ee,disableKeyboardA11y:Re,nodeExtent:Ke,rfId:mt,viewport:dt,onViewportChange:En,nodesDraggable:Ue}){return Ub(e),Ub(a),X_(),L_(l),H_(dt),s.jsx(c_,{onPaneClick:Q,onPaneMouseEnter:le,onPaneMouseMove:se,onPaneMouseLeave:ie,onPaneContextMenu:ue,onPaneScroll:K,paneClickDistance:xe,deleteKeyCode:D,selectionKeyCode:E,selectionOnDrag:j,selectionMode:O,onSelectionStart:v,onSelectionEnd:k,multiSelectionKeyCode:w,panActivationKeyCode:b,zoomActivationKeyCode:A,elementsSelectable:U,zoomOnScroll:F,zoomOnPinch:_,zoomOnDoubleClick:ne,panOnScroll:H,panOnScrollSpeed:P,panOnScrollMode:X,panOnDrag:pe,autoPanOnSelection:R,defaultViewport:Y,translateExtent:q,minZoom:W,maxZoom:L,onSelectionContextMenu:m,preventScrolling:V,noDragClassName:te,noWheelClassName:Ce,noPanClassName:Ee,disableKeyboardA11y:Re,onViewportChange:En,isControlledViewport:!!dt,children:s.jsxs($_,{children:[s.jsx(R_,{edgeTypes:a,onEdgeClick:r,onEdgeDoubleClick:d,onReconnect:_e,onReconnectStart:ke,onReconnectEnd:re,onlyRenderVisibleElements:M,onEdgeContextMenu:He,onEdgeMouseEnter:ee,onEdgeMouseMove:ge,onEdgeMouseLeave:Le,reconnectRadius:me,defaultMarkerColor:I,noPanClassName:Ee,disableKeyboardA11y:Re,rfId:mt}),s.jsx(q_,{style:S,type:T,component:C,containerStyle:z}),s.jsx("div",{className:"react-flow__edgelabel-renderer"}),s.jsx(x_,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:u,onNodeMouseEnter:h,onNodeMouseMove:g,onNodeMouseLeave:p,onNodeContextMenu:x,nodeClickDistance:Ne,onlyRenderVisibleElements:M,noPanClassName:Ee,noDragClassName:te,disableKeyboardA11y:Re,nodeExtent:Ke,rfId:mt,nodesDraggable:Ue}),s.jsx("div",{className:"react-flow__viewport-portal"})]})})}XN.displayName="GraphView";const Z_=N.memo(XN),F_=Fj(),Hb=({nodes:e,edges:a,defaultNodes:l,defaultEdges:i,width:r,height:u,fitView:d,fitViewOptions:h,minZoom:g=.5,maxZoom:p=2,nodeOrigin:x,nodeExtent:m,zIndexMode:v="basic"}={})=>{const k=new Map,T=new Map,S=new Map,C=new Map,z=i??a??[],E=l??e??[],j=x??[0,0],O=m??dc;oN(S,C,z);const{nodesInitialized:w}=Ap(E,k,T,{nodeOrigin:j,nodeExtent:O,zIndexMode:v});let b=[0,0,1];if(d&&r&&u){const A=Xi(k,{filter:Y=>!!((Y.width||Y.initialWidth)&&(Y.height||Y.initialHeight))}),{x:D,y:M,zoom:U}=lg(A,r,u,g,p,h?.padding??.1);b=[D,M,U]}return{rfId:"1",width:r??0,height:u??0,transform:b,nodes:E,nodesInitialized:w,nodeLookup:k,parentLookup:T,edges:z,edgeLookup:C,connectionLookup:S,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:l!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:g,maxZoom:p,translateExtent:dc,nodeExtent:O,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Bi.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:j,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGri
14d:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:d??!1,fitViewOptions:h,fitViewResolver:null,connection:{...Yj},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:F_,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Pj,zIndexMode:v,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},K_=({nodes:e,edges:a,defaultNodes:l,defaultEdges:i,width:r,height:u,fitView:d,fitViewOptions:h,minZoom:g,maxZoom:p,nodeOrigin:x,nodeExtent:m,zIndexMode:v})=>uD((k,T)=>{async function S(){const{nodeLookup:C,panZoom:z,fitViewOptions:E,fitViewResolver:j,width:O,height:w,minZoom:b,maxZoom:A}=T();z&&(await lM({nodes:C,width:O,height:w,panZoom:z,minZoom:b,maxZoom:A},E),j?.resolve(!0),k({fitViewResolver:null}))}return{...Hb({nodes:e,edges:a,width:r,height:u,fitView:d,fitViewOptions:h,minZoom:g,maxZoom:p,nodeOrigin:x,nodeExtent:m,defaultNodes:l,defaultEdges:i,zIndexMode:v}),setNodes:C=>{const{nodeLookup:z,parentLookup:E,nodeOrigin:j,nodeExtent:O,elevateNodesOnSelect:w,fitViewQueued:b,zIndexMode:A,nodesSelectionActive:D}=T(),{nodesInitialized:M,hasSelectedNodes:U}=Ap(C,z,E,{nodeOrigin:j,nodeExtent:O,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:A}),Y=D&&U;b&&M?(S(),k({nodes:C,nodesInitialized:M,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:Y})):k({nodes:C,nodesInitialized:M,nodesSelectionActive:Y})},setEdges:C=>{const{connectionLookup:z,edgeLookup:E}=T();oN(z,E,C),k({edges:C})},setDefaultNodesAndEdges:(C,z)=>{if(C){const{setNodes:E}=T();E(C),k({hasDefaultNodes:!0})}if(z){const{setEdges:E}=T();E(z),k({hasDefaultEdges:!0})}},updateNodeInternals:C=>{const{triggerNodeChanges:z,nodeLookup:E,parentLookup:j,domNode:O,nodeOrigin:w,nodeExtent:b,debug:A,fitViewQueued:D,zIndexMode:M}=T(),{changes:U,updatedInternals:Y}=MM(C,E,j,O,w,b,M);Y&&(SM(E,j,{nodeOrigin:w,nodeExtent:b,zIndexMode:M}),D?(S(),k({fitViewQueued:!1,fitViewOptions:void 0})):k({}),U?.length>0&&(A&&console.log("React Flow: trigger node changes",U),z?.(U)))},updateNodePositions:(C,z=!1)=>{const E=[];let j=[];const{nodeLookup:O,triggerNodeChanges:w,connection:b,updateConnection:A,onNodesChangeMiddlewareMap:D}=T();for(const[M,U]of C){const Y=O.get(M),q=!!(Y?.expandParent&&Y?.parentId&&U?.position),W={id:M,type:"position",position:q?{x:Math.max(0,U.position.x),y:Math.max(0,U.position.y)}:U.position,dragging:z};if(Y&&b.inProgress&&b.fromNode.id===Y.id){const L=Ro(Y,b.fromHandle,Ye.Left,!0);A({...b,from:L})}q&&Y.parentId&&E.push({id:M,parentId:Y.parentId,rect:{...U.internals.positionAbsolute,width:U.measured.width??0,height:U.measured.height??0}}),j.push(W)}if(E.length>0){const{parentLookup:M,nodeOrigin:U}=T(),Y=fg(E,O,M,U);j.push(...Y)}for(const M of D.values())j=M(j);w(j)},triggerNodeChanges:C=>{const{onNodesChange:z,setNodes:E,nodes:j,hasDefaultNodes:O,debug:w}=T();if(C?.length){if(O){const b=wN(C,j);E(b)}w&&console.log("React Flow: trigger node changes",C),z?.(C)}},triggerEdgeChanges:C=>{const{onEdgesChange:z,setEdges:E,edges:j,hasDefaultEdges:O,debug:w}=T();if(C?.length){if(O){const b=jN(C,j);E(b)}w&&console.log("React Flow: trigger edge changes",C),z?.(C)}},addSelectedNodes:C=>{const{multiSelectionActive:z,edgeLookup:E,nodeLookup:j,triggerNodeChanges:O,triggerEdgeChanges:w}=T();if(z){const b=C.map(A=>Co(A,!0));O(b);return}O(Ri(j,new Set([...C]),!0)),w(Ri(E))},addSelectedEdges:C=>{const{multiSelectionActive:z,edgeLookup:E,nodeLookup:j,triggerNodeChanges:O,triggerEdgeChanges:w}=T();if(z){const b=C.map(A=>Co(A,!0));w(b);return}w(Ri(E,new Set([...C]))),O(Ri(j,new Set,!0))},unselectNodesAndEdges:({nodes:C,edges:z}={})=>{const{edges:E,nodes:j,nodeLookup:O,triggerNodeChanges:w,triggerEdgeChanges:b}=T(),A=C||j,D=z||E,M=[];for(const Y of A){if(!Y.selected)continue;const q=O.get(Y.id);q&&(q.selected=!1),M.push(Co(Y.id,!1))}const U=[];for(const Y of D)Y.selected&&U.push(Co(Y.id,!1));w(M),b(U)},setMinZoom:C=>
14{const{panZoom:z,maxZoom:E}=T();z?.setScaleExtent([C,E]),k({minZoom:C})},setMaxZoom:C=>{const{panZoom:z,minZoom:E}=T();z?.setScaleExtent([E,C]),k({maxZoom:C})},setTranslateExtent:C=>{T().panZoom?.setTranslateExtent(C),k({translateExtent:C})},resetSelectedElements:()=>{const{edges:C,nodes:z,triggerNodeChanges:E,triggerEdgeChanges:j,elementsSelectable:O}=T();if(!O)return;const w=z.reduce((A,D)=>D.selected?[...A,Co(D.id,!1)]:A,[]),b=C.reduce((A,D)=>D.selected?[...A,Co(D.id,!1)]:A,[]);E(w),j(b)},setNodeExtent:C=>{const{nodes:z,nodeLookup:E,parentLookup:j,nodeOrigin:O,elevateNodesOnSelect:w,nodeExtent:b,zIndexMode:A}=T();C[0][0]===b[0][0]&&C[0][1]===b[0][1]&&C[1][0]===b[1][0]&&C[1][1]===b[1][1]||(Ap(z,E,j,{nodeOrigin:O,nodeExtent:C,elevateNodesOnSelect:w,checkEquality:!1,zIndexMode:A}),k({nodeExtent:C}))},panBy:C=>{const{transform:z,width:E,height:j,panZoom:O,translateExtent:w}=T();return DM({delta:C,panZoom:O,transform:z,translateExtent:w,width:E,height:j})},setCenter:async(C,z,E)=>{const{width:j,height:O,maxZoom:w,panZoom:b}=T();if(!b)return!1;const A=typeof E?.zoom<"u"?E.zoom:w;return await b.setViewport({x:j/2-C*A,y:O/2-z*A,zoom:A},{duration:E?.duration,ease:E?.ease,interpolate:E?.interpolate}),!0},cancelConnection:()=>{k({connection:{...Yj}})},updateConnection:C=>{k({connection:C})},reset:()=>k({...Hb()})}},Object.is);function gg({initialNodes:e,initialEdges:a,defaultNodes:l,defaultEdges:i,initialWidth:r,initialHeight:u,initialMinZoom:d,initialMaxZoom:h,initialFitViewOptions:g,fitView:p,nodeOrigin:x,nodeExtent:m,zIndexMode:v,children:k}){const[T]=N.useState(()=>K_({nodes:e,edges:a,defaultNodes:l,defaultEdges:i,width:r,height:u,fitView:p,minZoom:d,maxZoom:h,fitViewOptions:g,nodeOrigin:x,nodeExtent:m,zIndexMode:v}));return s.jsx(dD,{value:T,children:s.jsx(zD,{children:s.jsx(KD,{children:k})})})}function Q_({children:e,nodes:a,edges:l,defaultNodes:i,defaultEdges:r,width:u,height:d,fitView:h,fitViewOptions:g,minZoom:p,maxZoom:x,nodeOrigin:m,nodeExtent:v,zIndexMode:k}){return N.useContext(Jd)?s.jsx(s.Fragment,{children:e}):s.jsx(gg,{initialNodes:a,initialEdges:l,defaultNodes:i,defaultEdges:r,initialWidth:u,initialHeight:d,fitView:h,initialFitViewOptions:g,initialMinZoom:p,initialMaxZoom:x,nodeOrigin:m,nodeExtent:v,zIndexMode:k,children:e})}const W_={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function J_({nodes:e,edges:a,defaultNodes:l,defaultEdges:i,className:r,nodeTypes:u,edgeTypes:d,onNodeClick:h,onEdgeClick:g,onInit:p,onMove:x,onMoveStart:m,onMoveEnd:v,onConnect:k,onConnectStart:T,onConnectEnd:S,onClickConnectStart:C,onClickConnectEnd:z,onNodeMouseEnter:E,onNodeMouseMove:j,onNodeMouseLeave:O,onNodeContextMenu:w,onNodeDoubleClick:b,onNodeDragStart:A,onNodeDrag:D,onNodeDragStop:M,onNodesDelete:U,onEdgesDelete:Y,onDelete:q,onSelectionChange:W,onSelectionDragStart:L,onSelectionDrag:V,onSelectionDragStop:I,onSelectionContextMenu:F,onSelectionStart:_,onSelectionEnd:H,onBeforeDelete:P,connectionMode:X,connectionLineType:ne=Pl.Bezier,connectionLineStyle:pe,connectionLineComponent:R,connectionLineContainerStyle:Q,deleteKeyCode:le="Backspace",selectionKeyCode:se="Shift",selectionOnDrag:ie=!1,selectionMode:K=hc.Full,panActivationKeyCode:ue="Space",multiSelectionKeyCode:xe=mc()?"Meta":"Control",zoomActivationKeyCode:Ne=mc()?"Meta":"Control",snapToGrid:He,snapGrid:ee,onlyRenderVisibleElements:ge=!1,selectNodesOnDrag:Le,nodesDraggable:me,autoPanOnNodeFocus:_e,nodesConnectable:ke,nodesFocusable:re,nodeOrigin:te=vN,edgesFocusable:Ce,edgesReconnectable:Ee,elementsSelectable:Re=!0,defaultViewport:Ke=kD,minZoom:mt=.5,maxZoom:dt=2,translateExtent:En=dc,preventScrolling:Ue=!0,nodeExtent:ea,defaultMarkerColor:Ae="#b1b1b7",zoomOnScroll:Be=!0,zoomOnPinch:st=!0,panOnScroll:_t=!1,panOnScrollSpeed:gn=.5,panOnScrollMode:ut=_o.Free,zoomOnDoubleClick:ta=!0,panOnDrag:Et=!0,onPaneClick:qt,onPaneMouseEnter:Tn,onPaneMouseMove:Ln,onPaneMouseLeave:Ht,onPaneScroll:pt,onPaneContextMenu:gt,paneClickDistance:Un=1,nodeClickDistance:Ls=0,children:sn,onReconnect:Ta,onReconnectStart:Qt,onReconnectEnd:Bt,onEdgeContextMenu:Jt,onEdgeDoubleClick:ys,onEdgeMouseEnter:qa,onEdgeMouseMove:Us,onEdgeMouseLeave:Ma,reconnectRadius:yn=10,onNodesChange:na,onEdgesChange:wn,noDragClassName:Rt="nodrag",noWheelClassName:Da="nowheel",noPanClassName:Ga="nopan",fitView:Gt,fitViewOptions:Xa,connectOnClick:ln,attributionPosition:Mn,proOptions:jn,defaultEdgeOptions:Hs,elevateNodesOnSelect:Bs=!0,elevateEdgesOnSelect:Za=!1,disableKeyboardA11y:aa=!1,autoPanOnConnect:xs,autoPanOnNodeDrag:G,autoPanOnSelection:$e=!0,autoPanSpeed:Ge,connectionRadius:ot,isValidConnection:ht,onError:Ie,style:nt,id:Tt,nodeDragThreshold:sa,connectionDragThreshold:Hn,viewport:Ot,onViewportChange:en,width:Pt,height:Nn,colorMode:Fa="light",debug:_a,onScroll:Bn,ariaLabelConfig:Xt,zIndexMode:Ka="basic",...cl},Uo){const pa=Tt||"1",Yn=TD(Fa),Lt=N.useCallback(Qa=>{Qa.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Bn?.(Qa)},[Bn]);return s.jsx("div",{"data-testid":"rf__wrapper",...cl,onScroll:Lt,style:{...nt,...W_},ref:Uo,className:dn(["react-flow",r,Yn]),id:Tt,role:"application",children:s.jsxs(Q_,{nodes:e,edges:a,width:Pt,height:Nn,fitView:Gt,fitViewOptions:Xa,minZoom:mt,maxZoom:dt,nodeOrigin:te,nodeExtent:ea,zIndexMode:Ka,children:[s.jsx(ED,{nodes:e,edges:a,defaultNodes:l,defaultEdges:i,onConnect:k,onConnectStart:T,onConnectEnd:S,onClickConnectStart:C,onClickConnectEnd:z,
14nodesDraggable:me,autoPanOnNodeFocus:_e,nodesConnectable:ke,nodesFocusable:re,edgesFocusable:Ce,edgesReconnectable:Ee,elementsSelectable:Re,elevateNodesOnSelect:Bs,elevateEdgesOnSelect:Za,minZoom:mt,maxZoom:dt,nodeExtent:ea,onNodesChange:na,onEdgesChange:wn,snapToGrid:He,snapGrid:ee,connectionMode:X,translateExtent:En,connectOnClick:ln,defaultEdgeOptions:Hs,fitView:Gt,fitViewOptions:Xa,onNodesDelete:U,onEdgesDelete:Y,onDelete:q,onNodeDragStart:A,onNodeDrag:D,onNodeDragStop:M,onSelectionDrag:V,onSelectionDragStart:L,onSelectionDragStop:I,onMove:x,onMoveStart:m,onMoveEnd:v,noPanClassName:Ga,nodeOrigin:te,rfId:pa,autoPanOnConnect:xs,autoPanOnNodeDrag:G,autoPanSpeed:Ge,onError:Ie,connectionRadius:ot,isValidConnection:ht,selectNodesOnDrag:Le,nodeDragThreshold:sa,connectionDragThreshold:Hn,onBeforeDelete:P,debug:_a,ariaLabelConfig:Xt,zIndexMode:Ka}),s.jsx(Z_,{onInit:p,onNodeClick:h,onEdgeClick:g,onNodeMouseEnter:E,onNodeMouseMove:j,onNodeMouseLeave:O,onNodeContextMenu:w,onNodeDoubleClick:b,nodeTypes:u,edgeTypes:d,connectionLineType:ne,connectionLineStyle:pe,connectionLineComponent:R,connectionLineContainerStyle:Q,selectionKeyCode:se,selectionOnDrag:ie,selectionMode:K,deleteKeyCode:le,multiSelectionKeyCode:xe,panActivationKeyCode:ue,zoomActivationKeyCode:Ne,onlyRenderVisibleElements:ge,defaultViewport:Ke,translateExtent:En,minZoom:mt,maxZoom:dt,preventScrolling:Ue,zoomOnScroll:Be,zoomOnPinch:st,zoomOnDoubleClick:ta,panOnScroll:_t,panOnScrollSpeed:gn,panOnScrollMode:ut,panOnDrag:Et,autoPanOnSelection:$e,onPaneClick:qt,onPaneMouseEnter:Tn,onPaneMouseMove:Ln,onPaneMouseLeave:Ht,onPaneScroll:pt,onPaneContextMenu:gt,paneClickDistance:Un,nodeClickDistance:Ls,onSelectionContextMenu:F,onSelectionStart:_,onSelectionEnd:H,onReconnect:Ta,onReconnectStart:Qt,onReconnectEnd:Bt,onEdgeContextMenu:Jt,onEdgeDoubleClick:ys,onEdgeMouseEnter:qa,onEdgeMouseMove:Us,onEdgeMouseLeave:Ma,reconnectRadius:yn,defaultMarkerColor:Ae,noDragClassName:Rt,noWheelClassName:Da,noPanClassName:Ga,rfId:pa,disableKeyboardA11y:aa,nodeExtent:ea,viewport:Ot,onViewportChange:en,nodesDraggable:me}),s.jsx(ND,{onSelectionChange:W}),sn,s.jsx(xD,{proOptions:jn,position:Mn}),s.jsx(yD,{rfId:pa,disableKeyboardA11y:aa})]})})}var ZN=NN(J_);const eO=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function tO({children:e}){const a=bt(eO);return a?Sc.createPortal(e,a):null}function FN(e){const[a,l]=N.useState(e),i=N.useCallback(r=>l(u=>wN(r,u)),[]);return[a,l,i]}function nO(e){const[a,l]=N.useState(e),i=N.useCallback(r=>l(u=>jN(r,u)),[]);return[a,l,i]}function aO({dimensions:e,lineWidth:a,variant:l,className:i}){return s.jsx("path",{strokeWidth:a,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:dn(["react-flow__background-pattern",l,i])})}function sO({radius:e,className:a}){return s.jsx("circle",{cx:e,cy:e,r:e,className:dn(["react-flow__background-pattern","dots",a])})}var Qn;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Qn||(Qn={}));const lO={[Qn.Dots]:1,[Qn.Lines]:1,[Qn.Cross]:6},oO=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function KN({id:e,variant:a=Qn.Dots,gap:l=20,size:i,lineWidth:r=1,offset:u=0,color:d,bgColor:h,style:g,className:p,patternClassName:x}){const m=N.useRef(null),{transform:v,patternId:k}=bt(oO,Kt),T=i||lO[a],S=a===Qn.Dots,C=a===Qn.Cross,z=Array.isArray(l)?l:[l,l],E=[z[0]*v[2]||1,z[1]*v[2]||1],j=T*v[2],O=Array.isArray(u)?u:[u,u],w=C?[j,j]:E,b=[O[0]*v[2]+w[0]/2,O[1]*v[2]+w[1]/2],A=`${k}${e||""}`;return s.jsxs("svg",{className:dn(["react-flow__background",p]),style:{...g,...th,"--xy-background-color-props":h,"--xy-background-pattern-color-props":d},ref:m,"data-testid":"rf__background",children:[s.jsx("pattern",{id:A,x:v[0]%E[0],y:v[1]%E[1],width:E[0],height:E[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${b[0]},-${b[1]})`,children:S?s.jsx(sO,{radius:j/2,className:x}):s.jsx(aO,{dimensions:w,lineWidth:r,variant:a,className:x})}),s.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}KN.displayName="Background";const wo=N.memo(KN);function iO(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:s.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function rO(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:s.jsx("path",{d:"M0 0h32v4.2H0z"})})}function cO(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:s.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 uO(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:s.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 dO(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:s.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 od({children:e,className:a,...l}){return s.jsx("button",{type:"button",className:dn(["react-flow__controls-button",a]),...l,children:e})}const hO=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});
14function QN({style:e,showZoom:a=!0,showFitView:l=!0,showInteractive:i=!0,fitViewOptions:r,onZoomIn:u,onZoomOut:d,onFitView:h,onInteractiveChange:g,className:p,children:x,position:m="bottom-left",orientation:v="vertical","aria-label":k}){const T=Zt(),{isInteractive:S,minZoomReached:C,maxZoomReached:z,ariaLabelConfig:E}=bt(hO,Kt),{zoomIn:j,zoomOut:O,fitView:w}=Zi(),b=()=>{j(),u?.()},A=()=>{O(),d?.()},D=()=>{w(r),h?.()},M=()=>{T.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),g?.(!S)},U=v==="horizontal"?"horizontal":"vertical";return s.jsxs(eh,{className:dn(["react-flow__controls",U,p]),position:m,style:e,"data-testid":"rf__controls","aria-label":k??E["controls.ariaLabel"],children:[a&&s.jsxs(s.Fragment,{children:[s.jsx(od,{onClick:b,className:"react-flow__controls-zoomin",title:E["controls.zoomIn.ariaLabel"],"aria-label":E["controls.zoomIn.ariaLabel"],disabled:z,children:s.jsx(iO,{})}),s.jsx(od,{onClick:A,className:"react-flow__controls-zoomout",title:E["controls.zoomOut.ariaLabel"],"aria-label":E["controls.zoomOut.ariaLabel"],disabled:C,children:s.jsx(rO,{})})]}),l&&s.jsx(od,{className:"react-flow__controls-fitview",onClick:D,title:E["controls.fitView.ariaLabel"],"aria-label":E["controls.fitView.ariaLabel"],children:s.jsx(cO,{})}),i&&s.jsx(od,{className:"react-flow__controls-interactive",onClick:M,title:E["controls.interactive.ariaLabel"],"aria-label":E["controls.interactive.ariaLabel"],children:S?s.jsx(dO,{}):s.jsx(uO,{})}),x]})}QN.displayName="Controls";const WN=N.memo(QN);function fO({id:e,x:a,y:l,width:i,height:r,style:u,color:d,strokeColor:h,strokeWidth:g,className:p,borderRadius:x,shapeRendering:m,selected:v,onClick:k}){const{background:T,backgroundColor:S}=u||{},C=d||T||S;return s.jsx("rect",{className:dn(["react-flow__minimap-node",{selected:v},p]),x:a,y:l,rx:x,ry:x,width:i,height:r,style:{fill:C,stroke:h,strokeWidth:g},shapeRendering:m,onClick:k?z=>k(z,e):void 0})}const mO=N.memo(fO),pO=e=>e.nodes.map(a=>a.id),Gm=e=>e instanceof Function?e:()=>e;function gO({nodeStrokeColor:e,nodeColor:a,nodeClassName:l="",nodeBorderRadius:i=5,nodeStrokeWidth:r,nodeComponent:u=mO,onClick:d}){const h=bt(pO,Kt),g=Gm(a),p=Gm(e),x=Gm(l),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return s.jsx(s.Fragment,{children:h.map(v=>s.jsx(xO,{id:v,nodeColorFunc:g,nodeStrokeColorFunc:p,nodeClassNameFunc:x,nodeBorderRadius:i,nodeStrokeWidth:r,NodeComponent:u,onClick:d,shapeRendering:m},v))})}function yO({id:e,nodeColorFunc:a,nodeStrokeColorFunc:l,nodeClassNameFunc:i,nodeBorderRadius:r,nodeStrokeWidth:u,shapeRendering:d,NodeComponent:h,onClick:g}){const{node:p,x,y:m,width:v,height:k}=bt(T=>{const S=T.nodeLookup.get(e);if(!S)return{node:void 0,x:0,y:0,width:0,height:0};const C=S.internals.userNode,{x:z,y:E}=S.internals.positionAbsolute,{width:j,height:O}=ps(C);return{node:C,x:z,y:E,width:j,height:O}},Kt);return!p||p.hidden||!Kj(p)?null:s.jsx(h,{x,y:m,width:v,height:k,style:p.style,selected:!!p.selected,className:i(p),color:a(p),borderRadius:r,strokeColor:l(p),strokeWidth:u,shapeRendering:d,onClick:g,id:p.id})}const xO=N.memo(yO);var vO=N.memo(gO);const bO=200,wO=150,jO=e=>!e.hidden,NO=e=>{const a={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};let l=!1;for(const i of e.nodeLookup.values())if(!i.hidden){l=!0;break}return{viewBB:a,boundingRect:l?Xj(Xi(e.nodeLookup,{filter:jO}),a):a,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Bb=(e,a)=>e.x===a.x&&e.y===a.y&&e.width===a.width&&e.height===a.height,kO=(e,a)=>Bb(e.viewBB,a.viewBB)&&Bb(e.boundingRect,a.boundingRect)&&e.rfId===a.rfId&&e.panZoom===a.panZoom&&e.translateExtent===a.translateExtent&&e.flowWidth===a.flowWidth&&e.flowHeight===a.flowHeight&&e.ariaLabelConfig===a.ariaLabelConfig,SO="react-flow__minimap-desc";function JN({style:e,className:a,nodeStrokeColor:l,nodeColor:i,nodeClassName:r="",nodeBorderRadius:u=5,nodeStrokeWidth:d,nodeComponent:h,bgColor:g,maskColor:p,maskStrokeColor:x,maskStrokeWidth:m,position:v="bottom-right",onClick:k,onNodeClick:T,pannable:S=!1,zoomable:C=!1,ariaLabel:z,inversePan:E,zoomStep:j=1,offsetScale:O=5}){const w=Zt(),b=N.useRef(null),{boundingRect:A,panZoom:D,viewBB:M,rfId:U,translateExtent:Y,flowWidth:q,flowHeight:W,ariaLabelConfig:L}=bt(NO,kO),V=e?.width??bO,I=e?.height??wO,F=A.width/V,_=A.height/I,H=Math.max(F,_),P=H*V,X=H*I,ne=O*H,pe=A.x-(P-A.width)/2-ne,R=A.y-(X-A.height)/2-ne,Q=P+ne*2,le=X+ne*2,
14se=`${SO}-${U}`,ie=N.useRef(0),K=N.useRef();ie.current=H,N.useEffect(()=>{const ee=w.getState().panZoom;if(b.current&&ee)return K.current=UM({domNode:b.current,panZoom:ee,getTransform:()=>w.getState().transform,getViewScale:()=>ie.current}),()=>{K.current?.destroy()}},[D]),N.useEffect(()=>{K.current?.update({translateExtent:Y,width:q,height:W,inversePan:E,pannable:S,zoomStep:j,zoomable:C})},[S,C,E,j,Y,q,W]);const ue=k?ee=>{const[ge,Le]=K.current?.pointer(ee)||[0,0];k(ee,{x:ge,y:Le})}:void 0,xe=N.useCallback((ee,ge)=>{const Le=w.getState().nodeLookup.get(ge).internals.userNode;T?.(ee,Le)},[T]),Ne=T?xe:void 0,He=z??L["minimap.ariaLabel"];return s.jsx(eh,{position:v,style:{...e,"--xy-minimap-background-color-props":typeof g=="string"?g:void 0,"--xy-minimap-mask-background-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-color-props":typeof x=="string"?x:void 0,"--xy-minimap-mask-stroke-width-props":typeof m=="number"?m*H:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof l=="string"?l:void 0,"--xy-minimap-node-stroke-width-props":typeof d=="number"?d:void 0},className:dn(["react-flow__minimap",a]),"data-testid":"rf__minimap",children:s.jsxs("svg",{width:V,height:I,viewBox:`${pe} ${R} ${Q} ${le}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":se,ref:b,onClick:ue,children:[He&&s.jsx("title",{id:se,children:He}),s.jsx(vO,{onClick:Ne,nodeColor:i,nodeStrokeColor:l,nodeBorderRadius:u,nodeClassName:r,nodeStrokeWidth:d,nodeComponent:h}),s.jsx("path",{className:"react-flow__minimap-mask",d:`M${pe-ne},${R-ne}h${Q+ne*2}v${le+ne*2}h${-Q-ne*2}z
15        M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}JN.displayName="MiniMap";N.memo(JN);const CO=e=>a=>e?`${Math.max(1/a.transform[2],1)}`:void 0,EO={[Vi.Line]:"right",[Vi.Handle]:"bottom-right"};function TO({nodeId:e,position:a,variant:l=Vi.Handle,className:i,style:r=void 0,children:u,color:d,minWidth:h=10,minHeight:g=10,maxWidth:p=Number.MAX_VALUE,maxHeight:x=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:v,autoScale:k=!0,shouldResize:T,onResizeStart:S,onResize:C,onResizeEnd:z}){const E=pg(),j=typeof e=="string"?e:E,O=Zt(),w=N.useRef(null),b=l===Vi.Handle,A=bt(N.useCallback(CO(b&&k),[b,k]),Kt),D=N.useRef(null),M=a??EO[l];N.useEffect(()=>{if(!(!w.current||!j))return D.current||(D.current=WM({domNode:w.current,nodeId:j,getStoreItems:()=>{const{nodeLookup:Y,transform:q,snapGrid:W,snapToGrid:L,nodeOrigin:V,domNode:I}=O.getState();return{nodeLookup:Y,transform:q,snapGrid:W,snapToGrid:L,nodeOrigin:V,paneDomNode:I}},onChange:(Y,q)=>{const{triggerNodeChanges:W,nodeLookup:L,parentLookup:V,nodeOrigin:I}=O.getState(),F=[],_={x:Y.x,y:Y.y},H=L.get(j);if(H&&H.expandParent&&H.parentId){const P=H.origin??I,X=Y.width??H.measured.width??0,ne=Y.height??H.measured.height??0,pe={id:H.id,parentId:H.parentId,rect:{width:X,height:ne,...Qj({x:Y.x??H.position.x,y:Y.y??H.position.y},{width:X,height:ne},H.parentId,L,P)}},R=fg([pe],L,V,I);F.push(...R),_.x=Y.x?Math.max(P[0]*X,Y.x):void 0,_.y=Y.y?Math.max(P[1]*ne,Y.y):void 0}if(_.x!==void 0&&_.y!==void 0){const P={id:j,type:"position",position:{..._}};F.push(P)}if(Y.width!==void 0&&Y.height!==void 0){const X={id:j,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:Y.width,height:Y.height}};F.push(X)}for(const P of q){const X={...P,type:"position"};F.push(X)}W(F)},onEnd:({width:Y,height:q})=>{const W={id:j,type:"dimensions",resizing:!1,dimensions:{width:Y,height:q}};O.getState().triggerNodeChanges([W])}})),D.current.update({controlPosition:M,boundaries:{minWidth:h,minHeight:g,maxWidth:p,maxHeight:x},keepAspectRatio:m,resizeDirection:v,onResizeStart:S,onResize:C,onResizeEnd:z,shouldResize:T}),()=>{D.current?.destroy()}},[M,h,g,p,x,m,S,C,z,T]);const U=M.split("-");return s.jsx("div",{className:dn(["react-flow__resize-control","nodrag",...U,l,i]),ref:w,style:{...r,scale:A,...d&&{[b?"backgroundColor":"borderColor"]:d}},children:u})}N.memo(TO);const MO=e=>e.domNode?.querySelector(".react-flow__renderer");function DO({children:e}){const a=bt(MO);return a?Sc.createPortal(e,a):null}const _O=(e,a)=>e?.internals.positionAbsolute.x!==a?.internals.positionAbsolute.x||e?.internals.positionAbsolute.y!==a?.internals.positionAbsolute.y||e?.measured.width!==a?.measured.width||e?.measured.height!==a?.measured.height||e?.selected!==a?.selected||e?.internals.z!==a?.internals.z,OO=(e,a)=>{if(e.size!==a.size)return!1;for(const[l,i]of e)if(_O(i,a.get(l)))return!1;return!0},AO=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2],selectedNodesCount:e.nodes.filter(a=>a.selected).length});function nh({nodeId:e,children:a,className:l,style:i,isVisible:r,position:u=Ye.Top,offset:d=10,align:h="center",...g}){const p=pg(),x=N.useCallback(w=>(Array.isArray(e)?e:[e||p||""]).reduce((D,M)=>{const U=w.nodeLookup.get(M);return U&&D.set(U.id,U),D},new Map),[e,p]),m=bt(x,OO),{x:v,y:k,zoom:T,selectedNodesCount:S}=bt(AO,Kt);if(!(typeof r=="boolean"?r:m.size===1&&m.values().next().value?.selected&&S===1)||!m.size)return null;const z=Xi(m),E=Array.from(m.values()),j=Math.max(...E.map(w=>w.internals.z+1)),O={position:"absolute",transform:jM(z,{x:v,y:k,zoom:T},u,d,h),zIndex:j,...i};return s.jsx(DO,{children:s.jsx("div",{style:O,className:dn(["react-flow__node-toolbar",l]),...g,"data-id":E.reduce((w,b)=>`${w}${b.id} `,"").trim(),children:a})})}
15class ah extends Error{status;data;constructor(a,l,i={}){super(a),this.status=l,this.data=i}}async function Oe(e,a){const l=await fetch("/api"+e,{headers:{"Content-Type":"application/json"},...a});if(!l.ok){let i=l.statusText,r={};try{r=await l.json(),i=r.error??i}catch{}throw l.status===401&&!e.startsWith("/auth/")&&window.dispatchEvent(new Event("orgami:signed-out")),new ah(i,l.status,r)}return l.status===204?void 0:l.json()}const lt=(e,a)=>({method:e,body:JSON.stringify(a)}),Se={assistantChat:(e,a,l,i)=>Oe("/assistant/chat",lt("POST",{messages:e,where:a,threadId:l,context:i})),assistantApply:(e,a,l,i={})=>Oe("/assistant/apply",lt("POST",{tool:e,args:a,title:l,...i})),assistantSkip:(e,a)=>Oe("/assistant/skip",lt("POST",{messageId:e,actionId:a})),assistantThreads:()=>Oe("/assistant/threads"),assistantThread:e=>Oe(`/assistant/threads/${e}`),assistantDeleteThread:e=>Oe(`/assistant/threads/${e}`,{method:"DELETE"}),assistantLog:()=>Oe("/assistant/log"),assistantSpend:()=>Oe("/assistant/spend"),me:()=>Oe("/auth/me"),ssoConfig:()=>Oe("/auth/sso"),sso:e=>Oe("/auth/sso",lt("POST",{token:e})),logout:()=>Oe("/auth/logout",{method:"POST"}),listUsers:()=>Oe("/users"),updateUser:(e,a)=>Oe(`/users/${e}`,lt("PATCH",a)),deleteUser:e=>Oe(`/users/${e}`,{method:"DELETE"}),syncUsers:()=>Oe("/users/sync",{method:"POST"}),impersonate:e=>Oe(`/users/${e}/impersonate`,{method:"POST"}),stopImpersonating:()=>Oe("/auth/return",{method:"POST"}),holders:e=>({list:()=>Oe(`/${e}`),create:a=>Oe(`/${e}`,lt("POST",a)),update:(a,l)=>Oe(`/${e}/${a}`,lt("PATCH",l)),remove:a=>Oe(`/${e}/${a}`,{method:"DELETE"}),close:a=>Oe(`/${e}/${a}/close`,{method:"POST"}),reopen:a=>Oe(`/${e}/${a}/reopen`,{method:"POST"}),createArea:(a,l)=>Oe(`/${e}/${a}/areas`,lt("POST",{name:l})),updateArea:(a,l,i)=>Oe(`/${e}/${a}/areas/${l}`,lt("PATCH",i)),deleteArea:(a,l)=>Oe(`/${e}/${a}/areas/${l}`,{method:"DELETE"}),createMember:(a,l)=>Oe(`/${e}/${a}/members`,lt("POST",l)),updateMember:(a,l,i)=>Oe(`/${e}/${a}/members/${l}`,lt("PATCH",i)),deleteMember:(a,l)=>Oe(`/${e}/${a}/members/${l}`,{method:"DELETE"})}),planning:()=>Oe("/planning"),goalUpdates:e=>Oe(`/planning/goals/${e}/updates`),writeGoalUpdate:(e,a)=>Oe(`/planning/goals/${e}/updates`,lt("POST",a)),createGoal:e=>Oe("/planning/goals",lt("POST",e)),updateGoal:(e,a)=>Oe(`/planning/goals/${e}`,lt("PATCH",a)),carryGoal:e=>Oe(`/planning/goals/${e}/carry`,{method:"POST"}),deleteGoal:e=>Oe(`/planning/goals/${e}`,{method:"DELETE"}),listTasks:()=>Oe("/tasks"),createTask:e=>Oe("/tasks",lt("POST",e)),updateTask:(e,a)=>Oe(`/tasks/${e}`,lt("PATCH",a)),taskDone:(e,a={})=>Oe(`/tasks/${e}/done`,lt("POST",a)),taskUndo:(e,a)=>Oe(`/tasks/${e}/done/${a}`,{method:"DELETE"}),deleteTask:e=>Oe(`/tasks/${e}`,{method:"DELETE"}),restoreTask:e=>Oe(`/tasks/${e}/restore`,{method:"POST"}),listTaskGroups:()=>Oe("/tasks/groups"),createTaskGroup:e=>Oe("/tasks/groups",lt("POST",e)),renameTaskGroup:(e,a)=>Oe(`/tasks/groups/${e}`,lt("PATCH",{name:a})),deleteTaskGroup:e=>Oe(`/tasks/groups/${e}`,{method:"DELETE"}),orderTasks:e=>Oe("/tasks/order",lt("PUT",{ids:e})),task:e=>Oe(`/tasks/one/${e}`),taskEvents:e=>Oe(`/tasks/${e}/events`),taskTimer:(e,a)=>Oe(`/tasks/${e}/timer`,lt("POST",{run:a})),personStats:e=>Oe(`/people/${e}/stats`),docs:(e,a)=>({list:()=>Oe(`/${e}/${a}/docs`),read:l=>Oe(`/${e}/${a}/docs/${l}`),create:l=>Oe(`/${e}/${a}/docs`,lt("POST",l)),update:(l,i)=>Oe(`/${e}/${a}/docs/${l}`,lt("PATCH",i)),remove:l=>Oe(`/${e}/${a}/docs/${l}`,{method:"DELETE"}),addFolder:l=>Oe(`/${e}/${a}/docs/folders`,lt("POST",l)),patchFolder:(l,i)=>Oe(`/${e}/${a}/docs/folders/${l}`,lt("PATCH",i)),removeFolder:l=>Oe(`/${e}/${a}/docs/folders/${l}`,{method:"DELETE"})}),notices:()=>Oe("/notices"),readNotices:e=>Oe("/notices/read",lt("POST",{ids:e})),readAllNotices:()=>Oe("/notices/read-all",{method:"POST"}),taskComments:e=>Oe(`/tasks/${e}/comments`),addTaskComment:(e,a,l=[])=>Oe(`/tasks/${e}/comments`,lt("POST",{body:a,fileIds:l})),uploadTaskFile:async(e,a)=>{const l=`name=${encodeURIComponent(a.name)}&mime=${encodeURIComponent(a.type||"application/octet-stream")}`,i=await fetch(`/api/tasks/${e}/files?${l}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:a});if(!i.ok)throw new Error((await i.json().catch(()=>({}))).error??i.statusText);return await i.json()},addTaskCheck:(e,a)=>Oe(`/tasks/${e}/checks`,lt("POST",{title:a})),patchTaskCheck:(e,a,l)=>Oe(`/tasks/${e}/checks/${a}`,lt("PATCH",l)),deleteTaskCheck:(e,a)=>Oe(`/tasks/${e}/checks/${a}`,{method:"DELETE"}),linkTask:(e,a,l)=>Oe(`/tasks/${e}/links`,lt("POST",{taskId:a,kind:l})),unlinkTask:(e,a)=>Oe(`/tasks/${e}/links/${a}`,{method:"DELETE"}),pinTaskFile:async(e,a)=>{const l=`name=${encodeURIComponent(a.name)}&mime=${encodeURIComponent(a.type||"application/octet-stream")}&pin=1`,i=await fetch(`/api/tasks/${e}/files?${l}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:a});if(!i.ok)throw new Error((await i.json().catch(()=>({}))).error??i.statusText);return await i.json()},unpinTaskFile:(e,a)=>Oe(`/tasks/${e}/files/${a}`,{method:"DELETE"}),taskFileUrl:(e,a,l=!1)=>`/api/tasks/${e}/files/${a}${l?"?download=1":""}`,editTaskComment:(e,a,l)=>Oe(`/tasks/${e}/comments/${a}`,lt("PATCH",{body:l})),deleteTaskComment:(e,a)=>Oe(`/tasks/${e}/comments/${a}`,{method:"DELETE"}),listTrash:()=>Oe("/trash"),personEvents:e=>Oe(`/people/${e}/events`),personPast:e=>Oe(`/people/${e}/past`),archivePerson:(e,a)=>Oe(`/people/${e}/archive`,lt("POST",a)),unarchivePerson:e=>Oe(`/people/${e}/unarchive`,{method:"POST"}),archivedPeople:()=>Oe("/people/archived"),restoreTrash:e=>Oe(`/trash/${e}/restore`,{method:"POST"}),listBackups:()=>Oe("/backup"),backupNow:()=>Oe("/backup",{method:"POST"}),listCompanies:()=>Oe("/companies"),createCompany:e=>Oe("/companies",lt("POST",e)),updateCompany:(e,a)=>Oe(`/companies/${e}`,lt("PATCH",a)),deleteCompany:e=>Oe(`/companies/${e}`,{method:"DELETE"}),savePositions:e=>Oe("/companies/positions",lt("PUT",e)),listAssignments:()=>Oe("/assignments"),createAssignment:e=>Oe("/assignments",lt("POST",e)),updateAssignment:(e,a)=>Oe(`/assignments/${e}`,lt("PATCH",a)),deleteAssignment:e=>Oe(`/assignments/${e}`,{method:"DELETE"}),listPeople:()=>Oe("/people"),createPerson:e=>Oe("/people",lt("POST",e)),updatePerson:(e,a)=>Oe(`/people/${e}`,lt("PATCH",a)),deletePerson:e=>Oe(`/people/${e}`,{method:"DELETE"}),savePeoplePositions:e=>Oe("/people/positions",lt("PUT",e)),uploadPhoto:(e,a)=>Oe(`/people/${e}/photo`,{method:"PUT",headers:{"Content-Type":a.type},body:a}),deletePhoto:e=>Oe(`/people/${e}/photo`,{method:"DELETE"}),photoUrl:e=>e.photoVersion==null?null:`/api/people/${e.id}/photo?v=${e.photoVersion}`,listDepartments:()=>Oe("/departments"),createDepartment:e=>Oe("/departments",lt("POST",e)),updateDepartment:(e,a)=>Oe(`/departments/${e}`,lt("PATCH",a)),deleteDepartment:e=>Oe(`/departments/${e}`,{method:"DELETE"}),saveDepartmentPositions:e=>Oe("/departments/positions",lt("PUT",e)),getSettings:()=>Oe("/settings"),setSetting:(e,a)=>Oe(`/settings/${e}`,lt("PUT",{value:a}))},sh=[{value:"dots",label:"Dots"},{value:"dots-large",label:"Big dots"},{value:"grid",label:"Grid"},{value:"graph",label:"Graph paper"},{value:"cross",label:"Crosses"},{value:"paper",label:"Paper"},{value:"blueprint",label:"Blueprint"},{value:"none",label:"Plain"}],IO={tags:"dict_tags",titles:"dict_titles",departments:"dict_departments"},Rs=[{name:"Teal",value:"#0f5f7a"},{name:"Blue",value:"#1565c0"},{name:"Purple",value:"#6a1b9a"},{name:"Pink",value:"#ad1457"},{name:"Red",value:"#c62828"},{name:"Orange",value:"#ef6c00"},{name:"Yellow",value:"#f9a825"},{name:"Green",value:"#2e7d32"},{name:"Brown",value:"#5d4037"},{name:"Slate",value:"#455a64"}],zO=["on_track","at_risk","stuck","done","dropped"],RO=["core","partial","advisor"],Ec=["backlog","todo","in_progress","review","done","cancelled"],$O=e=>e==="done"||e==="cancelled",Wn=e=>!$O(e),$n=e=>"leadPersonId"in e?e.leadPersonId:e.responsiblePersonId??null,Pb=(e,a)=>e.filter(l=>l.parentId===a);async function LO(e,a=320){const l=await createImageBitmap(e).catch(()=>{throw new Error("That file is not an image the browser can read")}
15),i=Math.min(l.width,l.height),r=Math.min(a,i),u=document.createElement("canvas");u.width=r,u.height=r;const d=u.getContext("2d");return d.fillStyle="#fff",d.fillRect(0,0,r,r),d.drawImage(l,(l.width-i)/2,(l.height-i)/2,i,i,0,0,r,r),l.close(),new Promise((h,g)=>u.toBlob(p=>p?h(p):g(new Error("Could not encode image")),"image/jpeg",.86))}function Gl(e,a,l){const i=new Map(e.map(u=>[u.id,u]));let r=i.get(a);for(let u=0;r?.parentId&&u<100;u++){if(r.parentId===l)return!0;r=i.get(r.parentId)}return!1}function UO(e,a,l){return a!==l&&!Gl(e,l,a)}const HO=(e,a)=>e.managerIds.filter(l=>a.has(l));function BO(e){const a=new Set(e.map(d=>d.id)),l=new Map;for(const d of e){const h=HO(d,a)[0]??null;l.set(h,[...l.get(h)??[],d])}const i=[],r=new Set,u=(d,h)=>{for(const g of l.get(d)??[])r.has(g.id)||(r.add(g.id),i.push({person:g,depth:h}),u(g.id,h+1))};u(null,0);for(const d of e)r.has(d.id)||i.push({person:d,depth:0});return i}function PO(e,a,l){const i=new Map(e.map(d=>[d.id,d])),r=new Set,u=[a];for(;u.length;){const d=u.pop();if(!r.has(d)){r.add(d);for(const h of i.get(d)?.managerIds??[]){if(h===l)return!0;u.push(h)}}}return!1}function e1(e,a,l){return a!==l&&!PO(e,l,a)}var t1=Object.defineProperty,YO=(e,a,l)=>a in e?t1(e,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[a]=l,VO=(e,a)=>{for(var l in a)t1(e,l,{get:a[l],enumerable:!0})},qO=(e,a,l)=>YO(e,a+"",l),n1={};VO(n1,{Graph:()=>gs,alg:()=>xg});var GO=Object.defineProperty,a1=(e,a)=>{for(var l in a)GO(e,l,{get:a[l],enumerable:!0})},yg=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&
15(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,a){return e.forEach(l=>{a!==void 0?this.setNode(l,a):this.setNode(l)}),this}setNode(e,a){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=a),this):(this._nodes[e]=arguments.length>1?a:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let a=l=>this.removeEdge(this._edgeObjs[l]);
15delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(l=>{this.setParent(l)}),delete this._children[e]),Object.keys(this._in[e]).forEach(a),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(a),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,a){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(a===void 0)a="\0";else{a+="";for(let l=a;l!==void 0;l=this.parent(l))if(l===e)throw new Error("Setting "+a+" as parent of "+e+" would create a cycle");this.setNode(a)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=a,this._children[a][e]=!0,this}parent(e){if(this._isCompound){let a=this._parent[e];if(a!=="\0")return a}}children(e="\0"){if(this._isCompound){let a=this._children[e];if(a)return Object.keys(a)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let a=this._preds[e];if(a)return Object.keys(a)}successors(e){let a=this._sucs[e];if(a)return Object.keys(a)}neighbors(e){let a=this.predecessors(e);if(a){let l=new Set(a),i=this.successors(e);if(i)for(let r of i)l.add(r);return Array.from(l.values())}}isLeaf(e){var a;let l;return this.isDirected()?l=this.successors(e):l=this.neighbors(e),((a=l?.length)!=null?a:0)===0}filterNodes(e){let a=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});a.setGraph(this.graph()),Object.entries(this._nodes).forEach(([r,u])=>{e(r)&&a.setNode(r,u)}),Object.values(this._edgeObjs).forEach(r=>{a.hasNode(r.v)&&a.hasNode(r.w)&&a.setEdge(r,this.edge(r))});let l={},i=r=>{let u=this.parent(r);return!u||a.hasNode(u)?(l[r]=u,u):u in l?l[u]:i(u)};return this._isCompound&&a.nodes().forEach(r=>a.setParent(r,i(r))),a}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,a){return e.reduce((l,i)=>(a!==void 0?this.setEdge(l,i,a):this.setEdge(l,i),i)),this}setEdge(e,a,l,i){let r,u,d,h,g=!1;typeof e=="object"&&e!==null&&"v"in e?(r=e.v,u=e.w,d=e.name,arguments.length===2&&(h=a,g=!0)):(r=e,u=a,d=i,arguments.length>2&&(h=l,g=!0)),r=""+r,u=""+u,d!==void 0&&(d=""+d);let p=tc(this._isDirected,r,u,d);if(p in this._edgeLabels)return g&&(this._edgeLabels[p]=h),this;if(d!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(u),this._edgeLabels[p]=g?h:this._defaultEdgeLabelFn(r,u,d);let x=XO(this._isDirected,r,u,d);return r=x.v,u=x.w,Object.freeze(x),this._edgeObjs[p]=x,Yb(this._preds[u],r),Yb(this._sucs[r],u),this._in[u][p]=x,this._out[r][p]=x,this._edgeCount++,this}edge(e,a,l){let i=arguments.length===1?Xm(this._isDirected,e):tc(this._isDirected,e,a,l);return this._edgeLabels[i]}edgeAsObj(e,a,l){let i=arguments.length===1?this.edge(e):this.edge(e,a,l);return typeof i!="object"||i===null?{label:i}:i}hasEdge(e,a,l){return(arguments.length===1?Xm(this._isDirected,e):tc(this._isDirected,e,a,l))in this._edgeLabels}removeEdge(e,a,l){let i=arguments.length===1?Xm(this._isDirected,e):tc(this._isDirected,e,a,l),r=this._edgeObjs[i];if(r){let u=r.v,d=r.w;delete this._edgeLabels[i],delete this._edgeObjs[i],Vb(this._preds[d],u),Vb(this._sucs[u],d),delete this._in[d][i],delete this._out[u][i],this._edgeCount--}return this}inEdges(e,a){return this.isDirected()?this.filterEdges(this._in[e],e,a):this.nodeEdges(e,a)}outEdges(e,a){return this.isDirected()?this.filterEdges(this._out[e],e,a):this.nodeEdges(e,a)}nodeEdges(e,a){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,a)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,a,l){if(!e)return;let i=Object.values(e);return l?i.filter(r=>r.v===a&&r.w===l||r.v===l&&r.w===a):i}};function Yb(e,a){e[a]?e[a]++:e[a]=1}function Vb(e,a){e[a]!==void 0&&!--e[a]&&delete e[a]}function tc(e,a,l,i){let r=""+a,u=""+l;if(!e&&r>u){let d=r;r=u,u=d}return r+"�"+u+"�"+(i===void 0?"\0":i)}function XO(e,a,l,i){let r=""+a,u=""+l;if(!e&&r>u){let h=r;r=u,u=h}let d={v:r,w:u};return i&&(d.name=i),d}function Xm(e,a){return tc(e,a.v,a.w,a.name)}var ZO={};a1(ZO,{read:()=>WO,write:()=>FO});function FO(e){let a={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:KO(e),edges:QO(e)},l=e.graph();return l!==void 0&&(a.value=structuredClone(l)),a}
15function KO(e){return e.nodes().map(a=>{let l=e.node(a),i=e.parent(a),r={v:a};return l!==void 0&&(r.value=l),i!==void 0&&(r.parent=i),r})}function QO(e){return e.edges().map(a=>{let l=e.edge(a),i={v:a.v,w:a.w};return a.name!==void 0&&(i.name=a.name),l!==void 0&&(i.value=l),i})}function WO(e){let a=new yg(e.options);return e.value!==void 0&&a.setGraph(e.value),e.nodes.forEach(l=>{a.setNode(l.v,l.value),l.parent&&a.setParent(l.v,l.parent)}),e.edges.forEach(l=>{a.setEdge({v:l.v,w:l.w,name:l.name},l.value)}),a}var xg={};a1(xg,{CycleException:()=>Rd,bellmanFord:()=>s1,components:()=>t5,dijkstra:()=>zd,dijkstraAll:()=>s5,findCycles:()=>l5,floydWarshall:()=>i5,isAcyclic:()=>c5,postorder:()=>d5,preorder:()=>h5,prim:()=>f5,shortestPaths:()=>m5,tarjan:()=>o1,topsort:()=>i1});var JO=()=>1;function s1(e,a,l,i){return e5(e,String(a),l||JO,i||function(r){var u;return(u=e.outEdges(r))!=null?u:[]})}function e5(e,a,l,i){let r={},u,d=0,h=e.nodes(),g=function(m){let v=r[m.v],k=r[m.w];if(!v||!k)return;let T=l(m);v.distance+T<k.distance&&(r[m.w]={distance:v.distance+T,predecessor:m.v},u=!0)},p=function(){h.forEach(function(m){i(m).forEach(function(v){let k=v.v===m?v.v:v.w,T=k===v.v?v.w:v.v;g({v:k,w:T})})})};h.forEach(function(m){let v=m===a?0:Number.POSITIVE_INFINITY;r[m]={distance:v,predecessor:""}});let x=h.length;for(let m=1;m<x&&(u=!1,d++,p(),!!u);m++);if(d===x-1&&(u=!1,p(),u))throw new Error("The graph contains a negative weight cycle");return r}function t5(e){let a={},l=[],i;function r(u){var d,h;u in a||(a[u]=!0,i.push(u),(d=e.successors(u))==null||d.forEach(r),(h=e.predecessors(u))==null||h.forEach(r))}return e.nodes().forEach(function(u){i=[],r(u),i.length&&l.push(i)}),l}var l1=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let a=this._keyIndices[e];if(a!==void 0)return this._arr[a].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,a){let l=this._keyIndices,i=String(e);if(!(i in l)){let r=this._arr,u=r.length;return l[i]=u,r.push({key:i,priority:a}),this._decrease(u),!0}return!1}removeMin(){if(this.size()===0)throw new Error("Queue underflow");this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,a){let l=this._keyIndices[e];if(l===void 0)throw new Error(`Key not found: ${e}`);let i=this._arr[l].priority;if(a>i)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${i} New: ${a}`);this._arr[l].priority=a,this._decrease(l)}_heapify(e){let a=this._arr,l=2*e,i=l+1,r=e;l<a.length&&(r=a[l].priority<a[r].priority?l:r,i<a.length&&(r=a[i].priority<a[r].priority?i:r),r!==e&&(this._swap(e,r),this._heapify(r)))}_decrease(e){let a=this._arr,l=a[e].priority,i;for(;e!==0&&(i=e>>1,!(a[i].priority<l));)this._swap(e,i),e=i}_swap(e,a){let l=this._arr,i=this._keyIndices,r=l[e],u=l[a];l[e]=u,l[a]=r,i[u.key]=e,i[r.key]=a}},n5=()=>1;function zd(e,a,l,i){let r=function(u){var d;return(d=e.outEdges(u))!=null?d:[]};return a5(e,String(a),l||n5,i||r)}function a5(e,a,l,i){let r={},u=new l1,d,h,g=function(p){let x=p.v!==d?p.v:p.w,m=r[x];if(!m)return;let v=l(p),k=h.distance+v;if(v<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+v);k<m.distance&&(m.distance=k,m.predecessor=d,u.decrease(x,k))};for(e.nodes().forEach(function(p){let x=p===a?0:Number.POSITIVE_INFINITY;r[p]={distance:x,predecessor:""},u.add(p,x)});u.size()>0;){d=u.removeMin();let p=r[d];if(!p||p.distance===Number.POSITIVE_INFINITY)break;h=p,i(d).forEach(g)}return r}function s5(e,a,l){return e.nodes().reduce(function(i,r){return i[r]=zd(e,r,a,l),i},{})}function o1(e){let a=0,l=[],i={},r=[];function u(d){var h;let g=i[d]={onStack:!0,lowlink:a,index:a++};if(l.push(d),(h=e.successors(d))==null||h.forEach(function(p){if(p in i){let x=i[p];x!=null&&x.onStack&&(g.lowlink=Math.min(g.lowlink,x.index))}else{u(p);let x=i[p];x&&(g.lowlink=Math.min(g.lowlink,x.lowlink))}}),g.lowlink===g.index){let p=[],x;do{x=l.pop();let m=i[x];m&&(m.onStack=!1),p.push(x)}while(d!==x);r.push(p)}}
15return e.nodes().forEach(function(d){d in i||u(d)}),r}function l5(e){return o1(e).filter(function(a){var l;let i=a[0];return i?a.length>1||a.length===1&&((l=e.outEdges(i,i))!=null?l:[]).length>0:!1})}var o5=()=>1;function i5(e,a,l){return r5(e,a||o5,l||function(i){var r;return(r=e.outEdges(i))!=null?r:[]})}function r5(e,a,l){let i={},r=e.nodes();return r.forEach(function(u){let d={};i[u]=d,d[u]={distance:0,predecessor:""},r.forEach(function(h){u!==h&&(d[h]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),l(u).forEach(function(h){let g=h.v===u?h.w:h.v,p=a(h);d[g]={distance:p,predecessor:u}})}),r.forEach(function(u){let d=i[u];d&&r.forEach(function(h){let g=i[h];g&&r.forEach(function(p){let x=g[u],m=d[p],v=g[p];if(x&&m&&v){let k=x.distance+m.distance;k<v.distance&&(v.distance=k,v.predecessor=m.predecessor)}})})}),i}var Rd=class extends Error{constructor(e){super(e),this.name="CycleException"}};function i1(e){let a={},l={},i=[];function r(u){var d;if(u in l)throw new Rd;u in a||(l[u]=!0,a[u]=!0,(d=e.predecessors(u))==null||d.forEach(r),delete l[u],i.push(u))}if(e.sinks().forEach(r),Object.keys(a).length!==e.nodeCount())throw new Rd;return i}function c5(e){try{i1(e)}catch(a){if(a instanceof Rd)return!1;throw a}return!0}function u5(e,a,l,i,r){Array.isArray(a)||(a=[a]);let u=(h=>{var g;return(g=e.isDirected()?e.successors(h):e.neighbors(h))!=null?g:[]}),d={};return a.forEach(function(h){if(!e.hasNode(h))throw new Error("Graph does not have node: "+h);r=r1(e,h,l==="post",d,u,i,r)}),r}function r1(e,a,l,i,r,u,d){return a in i||(i[a]=!0,l||(d=u(d,a)),r(a).forEach(function(h){d=r1(e,h,l,i,r,u,d)}),l&&(d=u(d,a))),d}function c1(e,a,l){return u5(e,a,l,function(i,r){return i.push(r),i},[])}function d5(e,a){return c1(e,a,"post")}function h5(e,a){return c1(e,a,"pre")}function f5(e,a){var l;let i=new yg,r={},u=new l1,d;function h(x){let m=x.v===d?x.w:x.v,v=u.priority(m);if(v!==void 0){let k=a(x);k<v&&(r[m]=d,u.decrease(m,k))}}if(e.nodeCount()===0)return i;e.nodes().forEach(function(x){u.add(x,Number.POSITIVE_INFINITY),i.setNode(x)});let g=e.nodes()[0];g!==void 0&&u.decrease(g,0);let p=!1;for(;u.size()>0;){if(d=u.removeMin(),d in r)i.setEdge(d,r[d]);else{if(p)throw new Error("Input graph is not connected: "+e);p=!0}(l=e.nodeEdges(d))==null||l.forEach(h)}return i}function m5(e,a,l,i){return p5(e,a,l,i??(r=>{var u;return(u=e.outEdges(r))!=null?u:[]}))}function p5(e,a,l,i){if(l===void 0)return zd(e,a,l,i);let r=!1,u=e.nodes();for(let d=0;d<u.length;d++){let h=u[d];if(h===void 0)continue;let g=i(h);for(let p=0;p<g.length;p++){let x=g[p];if(!x)continue;let m=x.v===h?x.v:x.w,v=m===x.v?x.w:x.v;l({v:m,w:v})<0&&(r=!0)}if(r)return s1(e,a,l,i)}return zd(e,a,l,i)}var gs=yg;function Fi(e,a,l,i){let r=i;for(;e.hasNode(r);)r=vg(i);return l.dummy=a,e.setNode(r,l),r}function g5(e){let a=new gs().setGraph(e.graph());return e.nodes().forEach(l=>
15a.setNode(l,e.node(l))),e.edges().forEach(l=>{let i=a.edge(l.v,l.w)||{weight:0,minlen:1},r=e.edge(l);a.setEdge(l.v,l.w,{weight:i.weight+r.weight,minlen:Math.max(i.minlen,r.minlen)})}),a}function u1(e){let a=new gs({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(l=>{e.children(l).length||a.setNode(l,e.node(l))}),e.edges().forEach(l=>{a.setEdge(l,e.edge(l))}),a}function qb(e,a){let l=e.x,i=e.y,r=a.x-l,u=a.y-i,d=e.width/2,h=e.height/2;if(!r&&!u)throw new Error("Not possible to find intersection inside of the rectangle");let g,p;return Math.abs(u)*d>Math.abs(r)*h?(u<0&&(h=-h),g=h*r/u,p=h):(r<0&&(d=-d),g=d,p=d*u/r),{x:l+g,y:i+p}}function Tc(e){let a=gc(h1(e)+1).map(()=>[]);return e.nodes().forEach(l=>{let i=e.node(l),r=i.rank;r!==void 0&&(a[r]||(a[r]=[]),a[r][i.order]=l)}),a}function y5(e){let a=e.nodes().map(i=>{let r=e.node(i).rank;return r===void 0?Number.MAX_VALUE:r}),l=Is(Math.min,a);e.nodes().forEach(i=>{let r=e.node(i);Object.hasOwn(r,"rank")&&(r.rank-=l)})}function x5(e){let a=e.nodes().map(d=>e.node(d).rank).filter(d=>d!==void 0),l=Is(Math.min,a),i=[];e.nodes().forEach(d=>{let h=e.node(d).rank-l;i[h]||(i[h]=[]),i[h].push(d)});let r=0,u=e.graph().nodeRankFactor;Array.from(i).forEach((d,h)=>{d===void 0&&h%u!==0?--r:d!==void 0&&r&&d.forEach(g=>e.node(g).rank+=r)})}function Gb(e,a,l,i){let r={width:0,height:0};return arguments.length>=4&&(r.rank=l,r.order=i),Fi(e,"border",r,a)}function v5(e,a=d1){let l=[];for(let i=0;i<e.length;i+=a){let r=e.slice(i,i+a);l.push(r)}return l}var d1=65535;function Is(e,a){if(a.length>d1){let l=v5(a);return e(...l.map(i=>e(...i)))}else return e(...a)}function h1(e){let a=e.nodes().map(l=>{let i=e.node(l).rank;return i===void 0?Number.MIN_VALUE:i});return Is(Math.max,a)}function b5(e,a){let l={lhs:[],rhs:[]};return e.forEach(i=>{a(i)?l.lhs.push(i):l.rhs.push(i)}),l}function w5(e,a){let l=Date.now();try{return a()}finally{console.log(e+" time: "+(Date.now()-l)+"ms")}}function f1(e,a){return a()}var j5=0;function vg(e){let a=++j5;return e+(""+a)}function gc(e,a,l=1){a==null&&(a=e,e=0);let i=u=>u<a;l<0&&(i=u=>a<u);let r=[];for(let u=e;i(u);u+=l)r.push(u);return r}function $d(e,a){let l={};for(let i of a)e[i]!==void 0&&(l[i]=e[i]);return l}function lh(e,a){let l;return typeof a=="string"?l=i=>i[a]:l=a,Object.entries(e).reduce((i,[r,u])=>(i[r]=l(u,r),i),{})}function N5(e,a){return e.reduce((l,i,r)=>(l[i]=a[r],l),{})}var oh="\0";function m1(e,a,l){var i,r,u,d,h,g;if(!(e&&a&&l&&a.dummy==="edge"&&l.dummy==="edge"&&a.edgeObj&&l.edgeObj&&e[a.edgeObj.v]&&e[l.edgeObj.v]&&e[a.edgeObj.w]&&e[l.edgeObj.w]))return 0;let p=!0;
15a.edgeObj.w===l.edgeObj.w&&(p=!1);let x=p?(r=(i=e[a.edgeObj.v])==null?void 0:i.rank)!=null?r:NaN+1:(d=(u=e[a.edgeObj.w])==null?void 0:u.rank)!=null?d:NaN-1,m=Object.entries(e).find(S=>{var C,z;return((C=S[1].edgeObj)==null?void 0:C.v)===a.edgeObj.v&&((z=S[1].edgeObj)==null?void 0:z.w)===a.edgeObj.w&&S[1].rank===x}),v=Object.entries(e).find(S=>{var C,z;return((C=S[1].edgeObj)==null?void 0:C.v)===l.edgeObj.v&&((z=S[1].edgeObj)==null?void 0:z.w)===l.edgeObj.w&&S[1].rank===x});if(!m||!v)return 0;let k=(h=m[1].order)!=null?h:NaN,T=(g=v[1].order)!=null?g:NaN;return isNaN(k-T)?0:k-T}var k5="3.1.1",S5=class{constructor(){qO(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,a=e._prev;if(a!==e)return Xb(a),a}enqueue(e){let a=this._sentinel;e._prev&&e._next&&Xb(e),e._next=a._next,a._next._prev=e,a._next=e,e._prev=a}toString(){let e=[],a=this._sentinel,l=a._prev;for(;l!==a;)e.push(JSON.stringify(l,C5)),l=l._prev;return"["+e.join(", ")+"]"}};function Xb(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function C5(e,a){if(e!=="_next"&&e!=="_prev")return a}var E5=S5,T5=()=>1;function M5(e,a){if(e.nodeCount()<=1)return[];let l=_5(e,a||T5);return D5(l.graph,l.buckets,l.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w)||[])}function D5(e,a,l){var i;let r=[],u=a[a.length-1],d=a[0],h;for(;e.nodeCount();){for(;h=d.dequeue();)Zm(e,a,l,h);for(;h=u.dequeue();)Zm(e,a,l,h);if(e.nodeCount()){for(let g=a.length-2;g>0;--g)if(h=(i=a[g])==null?void 0:i.dequeue(),h){r=r.concat(Zm(e,a,l,h,!0)||[]);break}}}return r}function Zm(e,a,l,i,r){let u=[],d=r?u:void 0;return(e.inEdges(i.v)||[]).forEach(h=>{let g=e.edge(h),p=e.node(h.v);r&&u.push({v:h.v,w:h.w}),p.out-=g,Rp(a,l,p)}),(e.outEdges(i.v)||[]).forEach(h=>{let g=e.edge(h),p=h.w,x=e.node(p);x.in-=g,Rp(a,l,x)}),e.removeNode(i.v),d}function _5(e,a){let l=new gs,i=0,r=0;e.nodes().forEach(h=>{l.setNode(h,{v:h,in:0,out:0})}
15),e.edges().forEach(h=>{let g=l.edge(h.v,h.w)||0,p=a(h),x=g+p;l.setEdge(h.v,h.w,x);let m=l.node(h.v),v=l.node(h.w);r=Math.max(r,m.out+=p),i=Math.max(i,v.in+=p)});let u=O5(r+i+3).map(()=>new E5),d=i+1;return l.nodes().forEach(h=>{Rp(u,d,l.node(h))}),{graph:l,buckets:u,zeroIdx:d}}function Rp(e,a,l){var i,r,u;l.out?l.in?(u=e[l.out-l.in+a])==null||u.enqueue(l):(r=e[e.length-1])==null||r.enqueue(l):(i=e[0])==null||i.enqueue(l)}function O5(e){let a=[];for(let l=0;l<e;l++)a.push(l);return a}function A5(e,a){(e.graph().acyclicer==="greedy"?M5(e,l(e)):I5(e,a??null)).forEach(i=>{let r=e.edge(i);e.removeEdge(i),r.forwardName=i.name,r.reversed=!0,e.setEdge(i.w,i.v,r,vg("rev"))});function l(i){return r=>i.edge(r).weight}}function I5(e,a){let l=[],i={},r={};function u(g){Object.hasOwn(r,g)||(r[g]=!0,i[g]=!0,e.outEdges(g).forEach(p=>{Object.hasOwn(i,p.w)?l.push(p):u(p.w)}),delete i[g])}function d(g){var p;Object.hasOwn(r,g)||(r[g]=!0,i[g]=!0,(p=e.outEdges(g))==null||p.forEach(x=>{var m,v;Object.hasOwn(i,x.w)||((m=a.node(g))==null?void 0:m.rank)>((v=a.node(x.w))==null?void 0:v.rank)&&R5(e,x.w,x)?l.push(x):d(x.w)}),delete i[g])}let h=u;return a&&typeof a.node=="function"&&(h=d),e.sources().forEach(h),e.nodes().forEach(h),l}
15function z5(e){e.edges().forEach(a=>{let l=e.edge(a);if(l.reversed){e.removeEdge(a);let i=l.forwardName;delete l.reversed,delete l.forwardName,e.setEdge(a.w,a.v,l,i)}})}function R5(e,a,l){let i=new Set;function r(u){var d;if(e.sources().includes(u))return!0;i.add(u);for(let h of(d=e.inEdges(u))!=null?d:[])if(!(h.v===l.v&&h.w===l.w)&&!i.has(h.v)&&r(h.v))return!0;return!1}return r(a)}function $5(e){e.graph().dummyChains=[],e.edges().forEach(a=>L5(e,a))}function L5(e,a){let l=a.v,i=e.node(l).rank,r=a.w,u=e.node(r).rank,d=a.name,h=e.edge(a),g=h.labelRank;if(u===i+1)return;e.removeEdge(a);let p,x,m;for(m=0,++i;i<u;++m,++i)h.points=[],x={width:0,height:0,edgeLabel:h,edgeObj:a,rank:i},p=Fi(e,"edge",x,"_d"),i===g&&(x.width=h.width,x.height=h.height,x.dummy="edge-label",x.labelpos=h.labelpos),e.setEdge(l,p,{weight:h.weight},d),m===0&&e.graph().dummyChains.push(p),l=p;e.setEdge(l,r,{weight:h.weight},d)}function U5(e){e.graph().dummyChains.forEach(a=>{let l=e.node(a),i=l.edgeLabel,r;for(e.setEdge(l.edgeObj,i);l.dummy;)r=e.successors(a)[0],e.removeNode(a),i.points.push({x:l.x,y:l.y}),l.dummy==="edge-label"&&(i.x=l.x,i.y=l.y,i.width=l.width,i.height=l.height),a=r,l=e.node(a)})}function bg(e){let a={};function l(i){let r=e.node(i);if(Object.hasOwn(a,i))return r.rank;a[i]=!0;let u=e.outEdges(i),d=u?u.map(g=>g==null?Number.POSITIVE_INFINITY:l(g.w)-e.edge(g).minlen):[],h=Is(Math.min,d);return h===Number.POSITIVE_INFINITY&&(h=0),r.rank=h}e.sources().forEach(l)}function qi(e,a){return e.node(a.w).rank-e.node(a.v).rank-e.edge(a).minlen}var p1=H5;function H5(e){let a=new gs({directed:!1}),l=e.nodes();if(l.length===0)throw new Error("Graph must have at least one node");let i=l[0],r=e.nodeCount();a.setNode(i,{});let u,d;for(;B5(a,e)<r&&(u=P5(a,e),!!u);)d=a.hasNode(u.v)?qi(e,u):-qi(e,u),Y5(a,e,d);return a}function B5(e,a){function l(i){let r=a.nodeEdges(i);r&&r.forEach(u=>{let d=u.v,h=i===d?u.w:d;!e.hasNode(h)&&!qi(a,u)&&(e.setNode(h,{}),e.setEdge(i,h,{}),l(h))})}return e.nodes().forEach(l),e.nodeCount()}function P5(e,a){return a.edges().reduce((l,i)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(r=qi(a,i)),r<l[0]?[r,i]:l},[Number.POSITIVE_INFINITY,null])[1]}function Y5(e,a,l){e.nodes().forEach(i=>a.node(i).rank+=l)}var{preorder:V5,postorder:q5}=xg,G5=Lo;Lo.initLowLimValues=jg;Lo.initCutValues=wg;Lo.calcCutValue=g1;Lo.leaveEdge=x1;Lo.enterEdge=v1;Lo.exchangeEdges=b1;function Lo(e){e=g5(e),bg(e);let a=p1(e);jg(a),wg(a,e);let l,i;for(;l=x1(a);)i=v1(a,e,l),b1(a,e,l,i)}
15function wg(e,a){let l=q5(e,e.nodes());l=l.slice(0,l.length-1),l.forEach(i=>X5(e,a,i))}function X5(e,a,l){let i=e.node(l).parent,r=e.edge(l,i);r.cutvalue=g1(e,a,l)}function g1(e,a,l){let i=e.node(l).parent,r=!0,u=a.edge(l,i),d=0;u||(r=!1,u=a.edge(i,l)),d=u.weight;let h=a.nodeEdges(l);return h&&h.forEach(g=>{let p=g.v===l,x=p?g.w:g.v;if(x!==i){let m=p===r,v=a.edge(g).weight;if(d+=m?v:-v,F5(e,l,x)){let k=e.edge(l,x).cutvalue;d+=m?-k:k}}}),d}function jg(e,a){arguments.length<2&&(a=e.nodes()[0]),y1(e,{},1,a)}function y1(e,a,l,i,r){let u=l,d=e.node(i);a[i]=!0;let h=e.neighbors(i);return h&&h.forEach(g=>{Object.hasOwn(a,g)||(l=y1(e,a,l,g,i))}),d.low=u,d.lim=l++,r?d.parent=r:delete d.parent,l}function x1(e){return e.edges().find(a=>e.edge(a).cutvalue<0)}function v1(e,a,l){let i=l.v,r=l.w;a.hasEdge(i,r)||(i=l.w,r=l.v);let u=e.node(i),d=e.node(r),h=u,g=!1;return u.lim>d.lim&&(h=d,g=!0),a.edges().filter(p=>g===Zb(e,e.node(p.v),h)&&g!==Zb(e,e.node(p.w),h)).reduce((p,x)=>qi(a,x)<qi(a,p)?x:p)}function b1(e,a,l,i){let r=l.v,u=l.w;e.removeEdge(r,u),e.setEdge(i.v,i.w,{}),jg(e),wg(e,a),Z5(e,a)}function Z5(e,a){let l=e.nodes().find(r=>!e.node(r).parent);if(!l)return;let i=V5(e,[l]);i=i.slice(1),i.forEach(r=>{let u=e.node(r).parent,d=a.edge(r,u),h=!1;d||(d=a.edge(u,r),h=!0),a.node(r).rank=a.node(u).rank+(h?d.minlen:-d.minlen)})}function F5(e,a,l){return e.hasEdge(a,l)}function Zb(e,a,l){return l.low<=a.lim&&a.lim<=l.lim}var K5=Q5;function Q5(e){let a=e.graph().ranker;if(typeof a=="function")return a(e);switch(a){case"network-simplex":Fb(e);break;case"tight-tree":J5(e);break;case"longest-path":W5(e);break;case"none":break;default:Fb(e)}}var W5=bg;function J5(e){bg(e),p1(e)}function Fb(e){G5(e)}var eA=tA;function tA(e){let a=aA(e),l=e.graph();Array.isArray(l.dummyChains)&&l.dummyChains.forEach(i=>{let r=e.node(i),u=r.edgeObj,d=nA(e,a,u.v,u.w),h=d.path,g=d.lca,p=0,x=h[p],m=!0;for(;i!==u.w;){if(r=e.node(i),m){for(;(x=h[p])!==g&&e.node(x).maxRank<r.rank;)p++;x===g&&(m=!1)}if(!m){for(;p<h.length-1&&e.node(h[p+1]).minRank<=r.rank;)p++;x=h[p]}x!==void 0&&e.setParent(i,x),i=e.successors(i)[0]}})}function nA(e,a,l,i){let r=[],u=[],d=Math.min(a[l].low,a[i].low),h=Math.max(a[l].lim,a[i].lim),g;g=l;do g=e.parent(g),r.push(g);while(g&&(a[g].low>d||h>a[g].lim));let p=g,x=i;for(;(x=e.parent(x))!==p;)u.push(x);return{path:r.concat(u.reverse()),lca:p}}function aA(e){let a={},l=0;function i(r){let u=l;e.children(r).forEach(i),a[r]={low:u,lim:l++}}return e.children(oh).forEach(i),a}function sA(e){let a=Fi(e,"root",{},"_root"),l=lA(e),i=Object.values(l),r=Is(Math.max,i)-1,u=2*r+1;
15e.graph().nestingRoot=a,e.edges().forEach(h=>e.edge(h).minlen*=u);let d=oA(e)+1;e.children(oh).forEach(h=>{w1(e,a,u,d,r,l,h)}),e.graph().nodeRankFactor=u}function w1(e,a,l,i,r,u,d){var h;let g=e.children(d);if(!g.length){d!==a&&e.setEdge(a,d,{weight:0,minlen:l});return}let p=Gb(e,"_bt"),x=Gb(e,"_bb"),m=e.node(d);e.setParent(p,d),m.borderTop=p,e.setParent(x,d),m.borderBottom=x,g.forEach(v=>{var k;w1(e,a,l,i,r,u,v);let T=e.node(v),S=T.borderTop?T.borderTop:v,C=T.borderBottom?T.borderBottom:v,z=T.borderTop?i:2*i,E=S!==C?1:r-((k=u[d])!=null?k:0)+1;e.setEdge(p,S,{weight:z,minlen:E,nestingEdge:!0}),e.setEdge(C,x,{weight:z,minlen:E,nestingEdge:!0})}),e.parent(d)||e.setEdge(a,p,{weight:0,minlen:r+((h=u[d])!=null?h:0)})}function lA(e){let a={};function l(i,r){let u=e.children(i);u&&u.length&&u.forEach(d=>l(d,r+1)),a[i]=r}return e.children(oh).forEach(i=>l(i,1)),a}function oA(e){return e.edges().reduce((a,l)=>a+e.edge(l).weight,0)}function iA(e){let a=e.graph();e.removeNode(a.nestingRoot),delete a.nestingRoot,e.edges().forEach(l=>{e.edge(l).nestingEdge&&e.removeEdge(l)})}var rA=cA;function cA(e){function a(l){let i=e.children(l),r=e.node(l);if(i.length&&i.forEach(a),r&&Object.hasOwn(r,"minRank")){r.borderLeft=[],r.borderRight=[];for(let u=r.minRank,d=r.maxRank+1;u<d;++u)Kb(e,"borderLeft","_bl",l,r,u),Kb(e,"borderRight","_br",l,r,u)}}e.children(oh).forEach(a)}function Kb(e,a,l,i,r,u){let d={width:0,height:0,rank:u,borderType:a},h=r[a][u-1],g=Fi(e,"border",d,l);r[a][u]=g,e.setParent(g,i),h&&e.setEdge(h,g,{weight:1})}function uA(e){var a;let l=(a=e.graph().rankdir)==null?void 0:a.toLowerCase();(l==="lr"||l==="rl")&&j1(e)}function dA(e){var a;let l=(a=e.graph().rankdir)==null?void 0:a.toLowerCase();(l==="bt"||l==="rl")&&hA(e),(l==="lr"||l==="rl")&&(fA(e),j1(e))}function j1(e){e.nodes().forEach(a=>
15Qb(e.node(a))),e.edges().forEach(a=>Qb(e.edge(a)))}function Qb(e){let a=e.width;e.width=e.height,e.height=a}function hA(e){e.nodes().forEach(a=>Fm(e.node(a))),e.edges().forEach(a=>{var l;let i=e.edge(a);(l=i.points)==null||l.forEach(Fm),Object.hasOwn(i,"y")&&Fm(i)})}function Fm(e){e.y=-e.y}function fA(e){e.nodes().forEach(a=>Km(e.node(a))),e.edges().forEach(a=>{var l;let i=e.edge(a);(l=i.points)==null||l.forEach(Km),Object.hasOwn(i,"x")&&Km(i)})}function Km(e){let a=e.x;e.x=e.y,e.y=a}function mA(e,a=null){let l={},i=e.nodes().filter(p=>!e.children(p).length),r=i.map(p=>e.node(p).rank),u=Is(Math.max,r),d=gc(u+1).map(()=>[]);function h(p){if(l[p])return;l[p]=!0;let x=e.node(p);d[x.rank].push(p);let m=e.successors(p);m&&[...m].sort((v,k)=>g(v,k)).forEach(h)}i.sort((p,x)=>e.node(p).rank-e.node(x).rank).forEach(h);function g(p,x){let m=e.node(p),v=e.node(x);return m1(a,m,v)}return d}function pA(e,a){let l=0;for(let i=1;i<a.length;++i)l+=gA(e,a[i-1],a[i]);return l}function gA(e,a,l){let i=N5(l,l.map((p,x)=>x)),r=a.flatMap(p=>{let x=e.outEdges(p);return x?x.map(m=>({pos:i[m.w],weight:e.edge(m).weight})).sort((m,v)=>m.pos-v.pos):[]}),u=1;for(;u<l.length;)u<<=1;let d=2*u-1;u-=1;let h=new Array(d).fill(0),g=0;return r.forEach(p=>{let x=p.pos+u;h[x]+=p.weight;let m=0;for(;x>0;)x%2&&(m+=h[x+1]),x=x-1>>1,h[x]+=p.weight;g+=p.weight*m}),g}function yA(e,a=[]){return a.map(l=>{let i=e.inEdges(l);if(!i||!i.length)return{v:l};{let r=i.reduce((u,d)=>{let h=e.edge(d),g=e.node(d.v);return{sum:u.sum+h.weight*g.order,weight:u.weight+h.weight}},{sum:0,weight:0});return{v:l,barycenter:r.sum/r.weight,weight:r.weight}}})}function xA(e,a){let l={};e.forEach((r,u)=>{let d={indegree:0,in:[],out:[],vs:[r.v],i:u};r.barycenter!==void 0&&(d.barycenter=r.barycenter,d.weight=r.weight),l[r.v]=d}
15),a.edges().forEach(r=>{let u=l[r.v],d=l[r.w];u!==void 0&&d!==void 0&&(d.indegree++,u.out.push(d))});let i=Object.values(l).filter(r=>!r.indegree);return vA(i)}function vA(e){let a=[];function l(r){return u=>{u.merged||(u.barycenter===void 0||r.barycenter===void 0||u.barycenter>=r.barycenter)&&bA(r,u)}}function i(r){return u=>{u.in.push(r),--u.indegree===0&&e.push(u)}}for(;e.length;){let r=e.pop();a.push(r),r.in.reverse().forEach(l(r)),r.out.forEach(i(r))}return a.filter(r=>!r.merged).map(r=>$d(r,["vs","i","barycenter","weight"]))}function bA(e,a){let l=0,i=0;e.weight&&(l+=e.barycenter*e.weight,i+=e.weight),a.weight&&(l+=a.barycenter*a.weight,i+=a.weight),e.vs=a.vs.concat(e.vs),e.barycenter=l/i,e.weight=i,e.i=Math.min(a.i,e.i),a.merged=!0}function wA(e,a,l,i,r){let u={},d=null,h=null,g=r;typeof a=="boolean"?(g=a,u={}):a&&(u=a,d=l??null,h=i??null);let p=b5(e,z=>Object.hasOwn(z,"barycenter")),x=p.lhs,m=p.rhs.sort((z,E)=>E.i-z.i),v=[],k=0,T=0,S=0;x.sort(jA(h,d,!!g));for(let[z,E]of Object.entries(u)){let j=x.findIndex(O=>O.vs[0]===z);x.splice(j+1,0,E)}S=Wb(v,m,S),x.forEach(z=>{S+=z.vs.length,v.push(z.vs),k+=z.barycenter*z.weight,T+=z.weight,S=Wb(v,m,S)});let C={vs:v.flat(1)};return T&&(C.barycenter=k/T,C.weight=T),C}function Wb(e,a,l){let i;for(;a.length&&(i=a[a.length-1]).i<=l;)a.pop(),e.push(i.vs),l++;return l}function jA(e,a,l){return(i,r)=>{if(i.barycenter<r.barycenter)return-1;if(i.barycenter>r.barycenter)return 1;if(e&&(typeof i.vs[0]=="string"||typeof r.vs[0]=="string")){let u=e.node(i.vs[0]),d=e.node(r.vs[0]),h=m1(a,u,d);if(h!==0)return h}return l?r.i-i.i:i.i-r.i}}function N1(e,a,l,i,r){var u,d,h,g,p,x,m,v,k,T,S;let C=null,z=r;typeof i=="boolean"?(z=i,C=null):i!==void 0&&(C=i);let E=e.children(a),j=e.node(a),O=j?j.borderLeft:void 0,w=j?j.borderRight:void 0,b={};O&&(E=E.filter(q=>q!==O&&q!==w));let A=yA(e,E);A.forEach(q=>{if(e.children(q.v).length){let{result:W}=N1(e,q.v,l,C,z);b[q.v]=W,Object.hasOwn(W,"barycenter")&&kA(q,W)}});let D=xA(A,l);NA(D,b);let M={},U=!1;for(let q=0;q<D.length;q++)for(let W=q+1;W<D.length;W++)if(!(!D[q]||!D[W]||!((u=D[q])!=null&&u.barycenter)||!((d=D[W])!=null&&d.barycenter))&&((h=D[q])==null?void 0:h.barycenter)===D[W].barycenter){let L=(p=(g=D[q])==null?void 0:g.vs[0])!=null?p:"",V=(m=(x=D[W])==null?void 0:x.vs[0])!=null?m:"",I=e.node(L),F=e.node(V);if(I.dummy==="edge"&&F.dummy==="edge"&&((v=I.edgeObj)==null?void 0:v.v)===((k=F.edgeObj)==null?void 0:k.v)&&((T=I.edgeObj)==null?void 0:T.w)===((S=F.edgeObj)==null?void 0:S.w))if(I.edgeLabel.reversed){M[V]=D[q],D.splice(q,1),q--;break}else M[L]=D[W],D.splice(W,1),W--;else U=!0}let Y=wA(D,M,C,e,z);if(O&&w){Y.vs=[O,Y.vs,w].flat(1);let q=e.predecessors(O);if(q&&q.length){let W=e.node(q[0]),L=e.predecessors(w),V=e.node(L[0]);Object.hasOwn(Y,"barycenter")||(Y.barycenter=0,Y.weight=0),Y.barycenter=(Y.barycenter*Y.weight+W.order+V.order)/(Y.weight+2),Y.weight+=2}}return Object.defineProperty(Y,"result",{value:Y,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(Y,"usedBias",{value:U,enumerable:!1,configurable:!0,writable:!0}),Y}function NA(e,a){e.forEach(l=>{l.vs=l.vs.flatMap(i=>a[i]?a[i].vs:i)})}function kA(e,a){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+a.barycenter*a.weight)/(e.weight+a.weight),e.weight+=a.weight):(e.barycenter=a.barycenter,e.weight=a.weight)}function SA(e,a,l,i){i||(i=e.nodes());let r=CA(e),u=new gs({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(d=>e.node(d));return i.forEach(d=>{let h=e.node(d),g=e.parent(d);if(h.rank===a||h.minRank<=a&&a<=h.maxRank){u.setNode(d),u.setParent(d,g||r);let p=e[l](d);p&&p.forEach(x=>{let m=x.v===d?x.w:x.v,v=u.edge(m,d),k=v!==void 0?v.weight:0;u.setEdge(m,d,{weight:e.edge(x).weight+k})}),Object.hasOwn(h,"minRank")&&u.setNode(d,{borderLeft:h.borderLeft[a],borderRight:h.borderRight[a]})}}),u}function CA(e){let a;for(;e.hasNode(a=vg("_root")););return a}function EA(e,a,l){let i={},r;l.forEach(u=>{let d=e.parent(u),h,g;for(;d;){if(h=e.parent(d),h?(g=i[h],i[h]=d):(g=r,r=d),g&&g!==d){a.setEdge(g,d);return}d=h}})}function k1(e,a={},l=null){if(typeof a.customOrder=="function"){a.customOrder(e,k1);return}let i=h1(e),r=Jb(e,gc(1,i+1),"inEdges"),u=Jb(e,gc(i-1,-1,-1),"outEdges"),d=mA(e,l);if(ew(e,d),a.disableOptimalOrderHeuristic)return;let h=Number.POSITIVE_INFINITY,g,p=a.constraints||[];for(let x=0,m=0;m<4;++x,++m){TA(x%2?r:u,x%4>=2,p,l),d=Tc(e);let v=pA(e,d);v<h?(m=0,g=Object.assign({},d),h=v):v===h&&(g=structuredClone(d))}ew(e,g)}function Jb(e,a,l){let i=new Map,r=(u,d)=>{i.has(u)||i.set(u,[]),i.get(u).push(d)};for(let u of e.nodes()){let d=e.node(u);if(typeof d.rank=="number"&&r(d.rank,u),typeof d.minRank=="number"&&typeof d.maxRank=="number")for(let h=d.minRank;h<=d.maxRank;h++)h!==d.rank&&r(h,u)}return a.map(function(u){return SA(e,u,l,i.get(u)||[])})}function TA(e,a,l,i){let r=!0,u=new gs;e.forEach(function(d){l.forEach(x=>u.setEdge(x.left,x.right));let h=d.graph().root,{result:g,usedBias:p}=N1(d,h,u,i,r);
15a&&p&&(r=!r),g.vs.forEach((x,m)=>d.node(x).order=m),EA(d,u,g.vs)})}function ew(e,a){Object.values(a).forEach(l=>l.forEach((i,r)=>e.node(i).order=r))}function MA(e,a){let l={};function i(r,u){let d=0,h=0,g=r.length,p=u[u.length-1];return u.forEach((x,m)=>{let v=_A(e,x),k=v?e.node(v).order:g;(v||x===p)&&(u.slice(h,m+1).forEach(T=>{let S=e.predecessors(T);S&&S.forEach(C=>{let z=e.node(C),E=z.order;(E<d||k<E)&&!(z.dummy&&e.node(T).dummy)&&S1(l,C,T)})}),h=m+1,d=k)}),u}return a.length&&a.reduce(i),l}function DA(e,a){let l={};function i(u,d,h,g,p){gc(d,h).forEach(x=>{let m=u[x];if(m!==void 0&&e.node(m).dummy){let v=e.predecessors(m);v&&v.forEach(k=>{if(k===void 0)return;let T=e.node(k);T.dummy&&(T.order<g||T.order>p)&&S1(l,k,m)})}})}function r(u,d){let h=-1,g=-1,p=0;return d.forEach((x,m)=>{if(e.node(x).dummy==="border"){let v=e.predecessors(x);if(v&&v.length){let k=v[0];if(k===void 0)return;g=e.node(k).order,i(d,p,m,h,g),p=m,h=g}}i(d,p,d.length,g,u.length)}),d}return a.length&&a.reduce(r),l}function _A(e,a){if(e.node(a).dummy){let l=e.predecessors(a);if(l)return l.find(i=>e.node(i).dummy)}}function S1(e,a,l){if(a>l){let r=a;a=l,l=r}let i=e[a];i||(e[a]=i={}),i[l]=!0}function OA(e,a,l){if(a>l){let r=a;a=l,l=r}let i=e[a];return i!==void 0&&Object.hasOwn(i,l)}function AA(e,a,l,i,r){let u={},d={},h={};return a.forEach(g=>{g.forEach((p,x)=>{u[p]=p,d[p]=p,h[p]=x})}),a.forEach(g=>{let p=-1,x=-1,m=!1,v=g,k=g.findIndex(T=>r?.includes(T)||tw(T,e,r));k>0&&(v=[g[k],...g.slice(0,k),...g.slice(k+1)],m=!0),v.forEach(T=>{var S;let C=i(T);if(C&&C.length){r!=null&&r.includes(T)&&(C=C.filter(j=>tw(j,e,r)));let z=C.sort((j,O)=>{let w=h[j],b=h[O];return(w!==void 0?w:0)-(b!==void 0?b:0)}),E=(z.length-1)/2;for(let j=Math.floor(E),O=Math.ceil(E);j<=O;++j){let w=z[j];if(w===void 0)continue;let b=h[w];if(b!==void 0&&d[T]===T&&p<b&&h[w]!==x&&!OA(l,T,w)){let A=u[w];A!==void 0&&(d[w]=T,d[T]=u[T]=A,p=b,m&&(p=-1,x=(S=h[w])!=null?S:-1,m=!1))}}}})}),{root:u,align:d}}function IA(e,a,l,i,r=!1){let u={},d=zA(e,a,l,r),h=r?"borderLeft":"borderRight";function g(k,T){let S=d.nodes().slice(),C={},z=S.pop();for(;z;){if(C[z])k(z);else{C[z]=!0,S.push(z);for(let E of T(z))S.push(E)}z=S.pop()}}function p(k){let T=d.inEdges(k);T?u[k]=T.reduce((S,C)=>{var z;let E=(z=u[C.v])!=null?z:0,j=d.edge(C);return Math.max(S,E+(j!==void 0?j:0))},0):u[k]=0}function x(k){let T=d.outEdges(k),S=Number.POSITIVE_INFINITY;T&&(S=T.reduce((z,E)=>{let j=u[E.w],O=d.edge(E);return Math.min(z,(j!==void 0?j:0)-(O!==void 0?O:0))},Number.POSITIVE_INFINITY));let C=e.node(k);S!==Number.POSITIVE_INFINITY&&C.borderType!==h&&(u[k]=Math.max(u[k]!==void 0?u[k]:0,S))}function m(k){return d.predecessors(k)||[]}function v(k){return d.successors(k)||[]}
15return g(p,m),g(x,v),Object.keys(i).forEach(k=>{var T;let S=l[k];S!==void 0&&(u[k]=(T=u[S])!=null?T:0)}),u}function zA(e,a,l,i){let r=new gs,u=e.graph(),d=HA(u.nodesep,u.edgesep,i);return a.forEach(h=>{let g;h.forEach(p=>{let x=l[p];if(x!==void 0){if(r.setNode(x),g!==void 0){let m=l[g];if(m!==void 0){let v=r.edge(m,x);r.setEdge(m,x,Math.max(d(e,p,g),v||0))}}g=p}})}),r}function RA(e,a){return Object.values(a).reduce((l,i)=>{let r=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY;Object.entries(i).forEach(([h,g])=>{let p=BA(e,h)/2;r=Math.max(g+p,r),u=Math.min(g-p,u)});let d=r-u;return d<l[0]&&(l=[d,i]),l},[Number.POSITIVE_INFINITY,null])[1]}function $A(e,a){let l=Object.values(a),i=Is(Math.min,l),r=Is(Math.max,l);["u","d"].forEach(u=>{["l","r"].forEach(d=>{let h=u+d,g=e[h];if(!g||g===a)return;let p=Object.values(g),x=i-Is(Math.min,p);d!=="l"&&(x=r-Is(Math.max,p)),x&&(e[h]=lh(g,m=>m+x))})})}function LA(e,a=void 0){let l=e.ul;return l?lh(l,(i,r)=>{var u,d;if(a){let g=a.toLowerCase(),p=e[g];if(p&&p[r]!==void 0)return p[r]}let h=Object.values(e).map(g=>{let p=g[r];return p!==void 0?p:0}).sort((g,p)=>g-p);return(((u=h[1])!=null?u:0)+((d=h[2])!=null?d:0))/2}):{}}function UA(e,a){let l=Tc(e),i=Object.assign(MA(e,l),DA(e,l)),r={},u;["u","d"].forEach(h=>{u=h==="u"?l:Object.values(l).reverse(),["l","r"].forEach(g=>{g==="r"&&(u=u.map(m=>Object.values(m).reverse()));let p=AA(e,u,i,m=>(h==="u"?e.predecessors(m):e.successors(m))||[],a),x=IA(e,u,p.root,p.align,g==="r");g==="r"&&(x=lh(x,m=>-m)),r[h+g]=x})});let d=RA(e,r);return $A(r,d),LA(r,e.graph().align)}function HA(e,a,l){return(i,r,u)=>{let d=i.node(r),h=i.node(u),g=0,p;if(g+=d.width/2,Object.hasOwn(d,"labelpos"))switch(d.labelpos.toLowerCase()){case"l":p=-d.width/2;break;case"r":p=d.width/2;break}if(p&&(g+=l?p:-p),p=void 0,g+=(d.dummy?a:e)/2,g+=(h.dummy?a:e)/2,g+=h.width/2,Object.hasOwn(h,"labelpos"))switch(h.labelpos.toLowerCase()){case"l":p=h.width/2;break;case"r":p=-h.width/2;break}return p&&(g+=l?p:-p),g}}function BA(e,a){return e.node(a).width}function tw(e,a,l){var i;if(!l)return!1;let r=(i=a.node(e))==null?void 0:i.edgeObj;if(!r||a.node(e).edgeLabel.reversed)return!1;let u=l.indexOf(r?.v),d=l.indexOf(r?.w);return u!==-1&&d!==-1&&u===(d+1)%l.length||u===(d-1)%l.length}function PA(e,a){e=u1(e),YA(e),Object.entries(UA(e,a)).forEach(([l,i])=>e.node(l).x=i)}function YA(e){let a=Tc(e),l=e.graph(),i=l.ranksep,r=l.rankalign,u=0;a.forEach(d=>{let h=d.reduce((g,p)=>{var x;let m=(x=e.node(p).height)!=null?x:0;return g>m?g:m},0);d.forEach(g=>{let p=e.node(g);r==="top"?p.y=u+p.height/2:r==="bottom"?p.y=u+h-p.height/2:p.y=u+h/2}),u+=h+i})}var nw=new WeakMap;function VA(e,a={}){return C1(e,f1,a),e}function aw(e,a,l){let i=a;for(;i!==void 0;){let r=e.parent(i);if(r===l)return i;i=r}}function C1(e,a,l){var i;let r=e.nodes().filter(E=>e.children(E).length),u={};r.forEach(E=>{let j=e.node(E);if(j&&j.rankdir){let O=new gs({multigraph:!0,compound:!0});O.setGraph({rankdir:j.rankdir});let w=e.children(E);w.forEach(L=>{let V={...e.node(L)};O.setNode(L,V);let I=e.parent(L);I&&I!==E&&w.includes(I)&&O.setParent(L,I)});let b=new Set;
15e.edges().forEach(L=>{let V=aw(e,L.v,E),I=aw(e,L.w,E);if(V&&I&&V!==I){let F=`${V}\0${I}`;b.has(F)||(b.add(F),O.setEdge(V,I,{...e.edge(L)}))}}),C1(O,a,l);let A=iw(O);sw(A,a,l,null),lw(O,A);let D=1/0,M=1/0,U=-1/0,Y=-1/0;O.nodes().forEach(L=>{if(L===E)return;let V=O.node(L);V&&typeof V.x=="number"&&typeof V.y=="number"&&typeof V.width=="number"&&typeof V.height=="number"&&(D=Math.min(D,V.x-V.width/2),U=Math.max(U,V.x+V.width/2),M=Math.min(M,V.y-V.height/2),Y=Math.max(Y,V.y+V.height/2))}),(!isFinite(D)||!isFinite(M)||!isFinite(U)||!isFinite(Y))&&(D=M=0,U=Y=0);let q=U-D,W=Y-M;u[E]={minX:D,minY:M,maxX:U,maxY:Y,width:q,height:W,offsetX:D,offsetY:M},j._dagreClusterSubgraph=O}});let d=[],h=E=>{let j=[],O=(e.children(E)||[]).filter(w=>w!==E);for(;O.length>0;){let w=O.shift();j.push(w),(e.children(w)||[]).filter(b=>b!==w).forEach(b=>O.push(b))}return j},g=new Map;r.forEach(E=>{let j=e.node(E);j&&j.rankdir&&u[E]&&g.set(E,(e.children(E)||[]).filter(O=>O!==E))});let p=new Set([...g.values()].flat()),x=new Map;g.forEach((E,j)=>{p.has(j)||x.set(j,h(j))});let m=new Set([...x.values()].flat()),v=E=>{for(let[j,O]of x)if(O.includes(E))return j;return E},k=[];
15e.edges().forEach(E=>{(m.has(E.v)||m.has(E.w))&&k.push({edge:E,label:e.edge(E)})});let T=new Map;m.forEach(E=>{let j=e.parent(E);T.set(E,typeof j=="string"?j:void 0)}),x.forEach((E,j)=>{let O=e.node(j),w=[];E.forEach(D=>{let M=e.node(D);M&&(w.push({id:D,node:M,parent:T.get(D)}),e.removeNode(D))});let b=k.filter(({edge:D})=>E.includes(D.v)||E.includes(D.w)),A=u[j];O&&(d.push({clusterId:j,subgraph:O._dagreClusterSubgraph,bounds:A,children:E,removedNodes:w,removedEdges:b}),O.width=A.width,O.height=A.height)});let S=new Set;k.forEach(({edge:E,label:j})=>{let O=v(E.v),w=v(E.w);if(O!==w&&e.hasNode(O)&&e.hasNode(w)){let b=`${O}\0${w}`;S.has(b)||(S.add(b),e.setEdge(O,w,{...j,width:0,height:0}))}});let C=iw(e),z=sw(C,a,l,(i=nw.get(e))!=null?i:null);nw.set(e,z),lw(e,C),S.forEach(E=>{let j=E.indexOf("\0"),O=E.slice(0,j),w=E.slice(j+1);e.hasEdge(O,w)&&e.removeEdge(O,w)}),d.forEach(({clusterId:E,subgraph:j,bounds:O,removedNodes:w,removedEdges:b})=>{var A,D;let M=e.node(E),U=(A=M?.x)!=null?A:0,Y=(D=M?.y)!=null?D:0,q=(O.minX+O.maxX)/2,W=(O.minY+O.maxY)/2;
15w.forEach(({id:L,node:V,parent:I})=>{e.setNode(L,V),I!==void 0&&e.setParent(L,I)}),b.forEach(({edge:L,label:V})=>{e.setEdge(L,V)}),j.nodes().forEach(L=>{if(L===E)return;let V=j.node(L),I=e.node(L);I&&V&&typeof V.x=="number"&&typeof V.y=="number"&&(I.x=U+(V.x-q),I.y=Y+(V.y-W))}),delete M._dagreClusterSubgraph}),r.forEach(E=>{var j,O;let w=e.node(E),b=u[E];if(w&&w.rankdir&&w._dagreClusterSubgraph&&b){let A=w._dagreClusterSubgraph,D=(j=w.x)!=null?j:0,M=(O=w.y)!=null?O:0,U=(b.minX+b.maxX)/2,Y=(b.minY+b.maxY)/2;A.nodes().forEach(q=>{if(q===E)return;let W=A.node(q),L=e.node(q);if(L&&W&&typeof W.x=="number"&&typeof W.y=="number"){let V=W.x-U,I=W.y-Y;L.x=D+V,L.y=M+I}}),delete w._dagreClusterSubgraph}})}function sw(e,a,l,i=null){var r,u;let d=l?.useDynamic!==!1,h=d&&(r=i?.graph)!=null?r:null,g=d&&(u=i?.rawNodes)!=null?u:null;a("    makeSpaceForEdgeLabels",()=>WA(e)),a("    removeSelfEdges",()=>i3(e)),a("    acyclic",()=>A5(e,h)),a("    nestingGraph.run",()=>sA(e)),a("    rank",()=>K5(u1(e))),a("    injectEdgeLabelProxies",()=>JA(e)),a("    removeEmptyRanks",()=>x5(e)),a("    nestingGraph.cleanup",()=>iA(e)),a("    normalizeRanks",()=>y5(e)),a("    assignRankMinMax",()=>e3(e)),a("    removeEdgeLabelProxies",()=>t3(e)),a("    normalize.run",()=>$5(e)),a("    parentDummyChains",()=>eA(e)),a("    addBorderSegments",()=>rA(e)),a("    order",()=>k1(e,l,g)),a("    insertSelfEdges",()=>r3(e)),a("    adjustCoordinateSystem",()=>uA(e)),a("    position",()=>PA(e,l.corePath)),a("    positionSelfEdges",()=>c3(e));let p=JSON.parse(JSON.stringify(e._nodes));return a("    removeBorderNodes",()=>o3(e)),a("    normalize.undo",()=>U5(e)),a("    fixupEdgeLabelCoords",()=>s3(e)),a("    undoCoordinateSystem",()=>dA(e)),a("    translateGraph",()=>n3(e)),a("    assignNodeIntersects",()=>a3(e)),a("    reversePoints",()=>l3(e)),a("    acyclic.undo",()=>z5(e)),{graph:e,rawNodes:p}}function lw(e,a){e.nodes().forEach(l=>{let i=e.node(l),r=a.node(l);i&&(i.x=r.x,i.y=r.y,i.order=r.order,i.rank=r.rank,a.children(l).length&&(i.width=r.width,i.height=r.height))}
15),e.edges().forEach(l=>{let i=e.edge(l),r=a.edge(l);i.points=r.points,Object.hasOwn(r,"x")&&(i.x=r.x,i.y=r.y)}),e.graph().width=a.graph().width,e.graph().height=a.graph().height}var qA=["nodesep","edgesep","ranksep","marginx","marginy"],GA={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},XA=["acyclicer","ranker","rankdir","align","rankalign"],ZA=["width","height","rank"],ow={width:0,height:0},FA=["minlen","weight","width","height","labeloffset"],KA={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},QA=["labelpos"];function iw(e){let a=new gs({multigraph:!0,compound:!0}),l=Wm(e.graph());return a.setGraph(Object.assign({},GA,Qm(l,qA),$d(l,XA))),e.nodes().forEach(i=>{let r=Wm(e.node(i)),u=Qm(r,ZA);Object.keys(ow).forEach(h=>{u[h]===void 0&&(u[h]=ow[h])}),a.setNode(i,u);let d=e.parent(i);d!==void 0&&a.setParent(i,d)}),e.edges().forEach(i=>{let r=Wm(e.edge(i));a.setEdge(i,Object.assign({},KA,Qm(r,FA),$d(r,QA)))}),a}function WA(e){let a=e.graph();a.ranksep/=2,e.edges().forEach(l=>{var i;let r=e.edge(l);r.minlen*=2,((i=r.labelpos)!=null?i:"r").toLowerCase()!=="c"&&(a.rankdir==="TB"||a.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}
15function JA(e){e.edges().forEach(a=>{let l=e.edge(a);if(l.width&&l.height){let i=e.node(a.v),r={rank:(e.node(a.w).rank-i.rank)/2+i.rank,e:a};Fi(e,"edge-proxy",r,"_ep")}})}function e3(e){let a=0;e.nodes().forEach(l=>{let i=e.node(l);i.borderTop&&(i.minRank=e.node(i.borderTop).rank,i.maxRank=e.node(i.borderBottom).rank,a=Math.max(a,i.maxRank))}),e.graph().maxRank=a}function t3(e){e.nodes().forEach(a=>{let l=e.node(a);if(l.dummy==="edge-proxy"){let i=l;e.edge(i.e).labelRank=l.rank,e.removeNode(a)}})}function n3(e){let a=Number.POSITIVE_INFINITY,l=0,i=Number.POSITIVE_INFINITY,r=0,u=e.graph(),d=u.marginx||0,h=u.marginy||0;function g(p){let x=p.x,m=p.y,v=p.width,k=p.height;a=Math.min(a,x-v/2),l=Math.max(l,x+v/2),i=Math.min(i,m-k/2),r=Math.max(r,m+k/2)}e.nodes().forEach(p=>g(e.node(p))),e.edges().forEach(p=>{let x=e.edge(p);Object.hasOwn(x,"x")&&g(x)}),a-=d,i-=h,e.nodes().forEach(p=>{let x=e.node(p);x.x-=a,x.y-=i}),e.edges().forEach(p=>{let x=e.edge(p);x.points.forEach(m=>{m.x-=a,m.y-=i}),Object.hasOwn(x,"x")&&(x.x-=a),Object.hasOwn(x,"y")&&(x.y-=i)}),u.width=l-a+d,u.height=r-i+h}
15function a3(e){e.edges().forEach(a=>{if(a.v===a.w)return;let l=e.edge(a),i=e.node(a.v),r=e.node(a.w),u,d;l.points?(u=l.points[0],d=l.points[l.points.length-1]):(l.points=[],u=r,d=i),l.points.unshift(qb(i,u)),l.points.push(qb(r,d))})}function s3(e){e.edges().forEach(a=>{let l=e.edge(a);if(Object.hasOwn(l,"x"))switch((l.labelpos==="l"||l.labelpos==="r")&&(l.width-=l.labeloffset),l.labelpos){case"l":l.x-=l.width/2+l.labeloffset;break;case"r":l.x+=l.width/2+l.labeloffset;break}})}function l3(e){e.edges().forEach(a=>{let l=e.edge(a);l.reversed&&l.points.reverse()})}function o3(e){e.nodes().forEach(a=>{if(e.children(a).length){let l=e.node(a),i=e.node(l.borderTop),r=e.node(l.borderBottom),u=e.node(l.borderLeft[l.borderLeft.length-1]),d=e.node(l.borderRight[l.borderRight.length-1]);l.width=Math.abs(d.x-u.x),l.height=Math.abs(r.y-i.y),l.x=u.x+l.width/2,l.y=i.y+l.height/2}}),e.nodes().forEach(a=>{e.node(a).dummy==="border"&&e.removeNode(a)})}function i3(e){e.edges().forEach(a=>{if(a.v===a.w){let l=e.node(a.v);l.selfEdges||(l.selfEdges=[]),l.selfEdges.push({e:a,label:e.edge(a)}),e.removeEdge(a)}})}function r3(e){Tc(e).forEach(a=>{let l=0;a.forEach((i,r)=>{let u=e.node(i);typeof u.rank!="number"&&(u.rank=0),u.order=r+l,(u.selfEdges||[]).forEach(d=>{Fi(e,"selfedge",{width:d.label.width,height:d.label.height,rank:u.rank,order:r+ ++l,e:d.e,edgeLabel:d.label},"_se"),(!Array.isArray(d.label.points)||d.label.points.length!==7)&&(d.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete u.selfEdges})})}function c3(e){e.nodes().forEach(a=>{let l=e.node(a),i=r=>typeof r=="number"&&isFinite(r);if(l.dummy==="selfedge"){let r=l,u=e.node(r.e.v),d=i(u?.x)?u.x:0,h=i(u?.y)?u.y:0,g=i(u?.width)?u.width:0,p=i(u?.height)?u.height:0,x=i(l.x)?l.x:d,m=i(l.y)?l.y:h,v=g/2,k=p/2;r.edgeLabel.points=[{x:x+v,y:m-k},{x:x+v,y:m-k},{x,y:m},{x:x-v,y:m+k},{x:x-v,y:m+k},{x,y:m},{x,y:m}],r.edgeLabel.x=x,r.edgeLabel.y=m,e.setEdge(r.e,r.edgeLabel),e.removeNode(a)}else l&&Array.isArray(l.selfEdges)&&l.selfEdges.forEach(r=>{if(!Array.isArray(r.label.points)||r.label.points.length!==7){let u=i(l.x)?l.x:0,d=i(l.y)?l.y:0,h=i(l.width)?l.width:0,g=i(l.height)?l.height:0,p=h/2,x=g/2;r.label.points=[{x:u+p,y:d-x},{x:u+p,y:d-x},{x:u,y:d},{x:u-p,y:d+x},{x:u-p,y:d+x},{x:u,y:d},{x:u,y:d}]}})})}function Qm(e,a){return lh($d(e,a),Number)}function Wm(e){let a={};return e&&Object.entries(e).forEach(([l,i])=>{typeof l=="string"&&(l=l.toLowerCase()),a[l]=i}),a}function u3(e){let a=Tc(e),l=new gs({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(i=>{l.setNode(i,{label:i}),l.setParent(i,"layer"+e.node(i).rank)}
15),e.edges().forEach(i=>l.setEdge(i.v,i.w,{},i.name)),a.forEach((i,r)=>{let u="layer"+r;l.setNode(u,{rank:"same"}),i.reduce((d,h)=>(l.setEdge(d,h,{style:"invis"}),h))}),l}var d3={graphlib:n1,version:k5,layout:VA,debug:u3,util:{time:w5,notime:f1}},sc=d3;const rw={width:280,height:120},cw={width:260,height:56},uw={width:240,height:56},Ya=e=>Math.round(e/8)*8;function Ld(e,a){return e.managerIds.map(l=>a.find(i=>i.id===l)).find(l=>!!l&&l.companyId===e.companyId&&(l.departmentId??null)===(e.departmentId??null))}function yc(e,a){if(e.parentId)return e.parentId;const l=d=>d.managerIds.map(h=>a.find(g=>g.id===h)).find(h=>!!h&&h.companyId===e.companyId&&!h.departmentId),i=e.headId?a.find(d=>d.id===e.headId):void 0;if(i)return l(i)?.id??e.companyId;const r=new Map;for(const d of a){if(d.departmentId!==e.id||Ld(d,a))continue;const h=l(d);h&&r.set(h.id,(r.get(h.id)??0)+1)}return[...r.entries()].sort((d,h)=>h[1]-d[1])[0]?.[0]??e.companyId}const dw=24,h3=56,hw=28,fw=12,f3=3,Jm=96,m3=3;function $p(e,a,l){if(e.children.length===0)return{size:{...e.box},nodes:[{id:e.id,x:0,y:0}]};const i=e.children.filter(m=>m.children.length===0),r=e.children.filter(m=>m.children.length>0),u=[];if(i.length===1)u.push($p(i[0],a,l));else if(i.length>1){const m=Math.min(f3,i.length<=3?1:i.length<=8?2:3),v=Math.max(...i.map(C=>C.box.w)),k=Math.max(...i.map(C=>C.box.h)),T=i.map((C,z)=>(a.add(C.id),{id:C.id,x:16+z%m*(v+hw),y:Math.floor(z/m)*(k+fw)})),S=Math.ceil(i.length/m);u.push({size:{w:16+m*v+(m-1)*hw,h:S*k+(S-1)*fw},nodes:T})}for(const m of r)u.push($p(m,a,l));const d=m=>m.reduce((v,k)=>v+k.size.w,0)+Math.max(0,m.length-1)*dw;let h=[u];if(l.has(e.id)&&u.length>2){const m=d(u),v=u.reduce((T,S)=>T+S.size.h,0)/u.length+Jm,k=Math.max(1,Math.min(m3,u.length,Math.round(Math.sqrt(m/(2*v)))));if(k>1){h=Array.from({length:k},()=>[]);for(const T of[...u].sort((S,C)=>C.size.w-S.size.w))h.reduce((S,C)=>d(C)<d(S)?C:S,h[0]).push(T);h=h.filter(T=>T.length>0)}}const g=Math.max(e.box.w,...h.map(d)),p=[{id:e.id,x:(g-e.box.w)/2,y:0}];let x=e.box.h+h3;for(const m of h){let v=(g-d(m))/2;const k=Math.max(...m.map(T=>T.size.h));for(const T of m){for(const S of T.nodes)p.push({id:S.id,x:v+S.x,y:x+S.y});v+=T.size.w+dw}x+=k+Jm}return{size:{w:g,h:x-Jm},nodes:p}}function p3(e,a,l,i,r){const u=(E,j)=>({width:i.get(E)?.width??j.width,height:i.get(E)?.height??j.height}),d=new Set(e.map(E=>E.id)),h=(E,j,O,w=0)=>{const b=new sc.graphlib.Graph;return b.setGraph({rankdir:E,nodesep:j,ranksep:O,marginx:w,marginy:w}),b.setDefaultEdgeLabel(()=>({})),b},g=[],p=[],x=new Set,m=new Map,v=new Map;for(const E of e){const j=u(E.id,rw),O=a.filter(_=>_.companyId===E.id),w=l.filter(_=>_.companyId===E.id);if(w.length===0&&O.length===0){v.set(E.id,{width:j.width,height:j.height,cardDx:0,cardDy:0});continue}const b=r==="right";if(!b){const _=new Map,H=(se,ie)=>_.set(se,[..._.get(se)??[],ie]);for(const se of O)H(yc(se,w),se.id);for(const se of w){const ie=Ld(se,w);H(ie?ie.id:se.departmentId&&O.some(K=>K.id===se.departmentId)?se.departmentId:E.id,se.id)}const P=se=>{const ie=se===E.id?j:O.some(K=>K.id===se)?u(se,cw):u(se,uw);return{w:ie.width,h:ie.height}},X=(se,ie=new Set)=>(ie.add(se),{id:se,box:P(se),leafGrid:!1,children:(_.get(se)??[]).filter(K=>!ie.has(K)).map(K=>X(K,ie))}),ne=new Set([E.id,...w.filter(se=>!se.departmentId).map(se=>se.id)]),{size:pe,nodes:R}=$p(X(E.id),x,ne),Q=new Map(R.map(se=>[se.id,se])),le=Q.get(E.id);for(const se of O){const ie=Q.get(se.id);
15ie&&g.push({id:se.id,x:Ya(ie.x-le.x),y:Ya(ie.y-le.y)})}for(const se of w){const ie=Q.get(se.id);if(!ie)continue;const K=se.departmentId&&Q.has(se.departmentId)?Q.get(se.departmentId):le;p.push({id:se.id,x:Ya(ie.x-K.x),y:Ya(ie.y-K.y)}),m.set(se.id,ie.x-le.x)}v.set(E.id,{width:pe.w,height:pe.h,cardDx:le.x,cardDy:0});continue}const A=h("LR",16,64);A.setNode(E.id,j);for(const _ of O)A.setNode(_.id,u(_.id,cw));for(const _ of w)A.setNode(_.id,u(_.id,uw));for(const _ of O)A.setEdge(yc(_,w),_.id);for(const _ of w){const H=Ld(_,w);A.setEdge(H?H.id:_.departmentId&&O.some(P=>P.id===_.departmentId)?_.departmentId:E.id,_.id)}sc.layout(A);const D=A.node(E.id),M=D.x-D.width/2,U=D.y-D.height/2,Y=_=>{const H=A.node(_);return{x:H.x-H.width/2,y:H.y-H.height/2,w:H.width,h:H.height}},q=[...O.map(_=>({id:_.id,...Y(_.id)})),...w.map(_=>({id:_.id,...Y(_.id)}))].map(_=>({..._,x:_.x-M,y:_.y-U})),W=Math.max(0,-Math.min(...q.map(_=>_.y)));for(const _ of q)_.y+=W;const L=new Map(q.map(_=>[_.id,_]));for(const _ of O)g.push({id:_.id,x:Ya(L.get(_.id).x),y:Ya(L.get(_.id).y)});for(const _ of w){const H=L.get(_.id),P=_.departmentId&&L.has(_.departmentId)?L.get(_.departmentId):{x:0,y:0};p.push({id:_.id,x:Ya(H.x)-Ya(P.x),y:Ya(H.y)-Ya(P.y)}),m.set(_.id,H.x)}const V=Math.min(0,...q.map(_=>_.x)),I=Math.max(j.width,...q.map(_=>_.x+_.w)),F=Math.max(j.height,...q.map(_=>_.y+_.h));if(b){const _=I-j.width;v.set(E.id,{width:j.width+2*_,height:F,cardDx:_,cardDy:0})}else v.set(E.id,{width:I-V,height:F,cardDx:-V,cardDy:0})}const k=h("TB",48,88,40),T=E=>E.leadId&&m.has(E.leadId)?m.get(E.leadId):(E.parentId?u(E.parentId,rw).width/2:0)-1,S=[...e].sort((E,j)=>T(j)-T(E)||(j.leadId??"").localeCompare(E.leadId??""));for(const E of S)k.setNode(E.id,v.get(E.id));for(const E of S)E.parentId&&d.has(E.parentId)&&k.setEdge(E.parentId,E.id);sc.layout(k);const C=new Map;for(const E of e){const j=k.node(E.id);C.set(j.y,Math.min(C.get(j.y)??1/0,j.y-j.height/2))}return{companies:e.map(E=>{const j=k.node(E.id),O=v.get(E.id);return{id:E.id,x:Ya(j.x-j.width/2+O.cardDx),y:Ya(C.get(j.y)+O.cardDy)}}),departments:g,people:p,stacked:x}}const yt=e=>"$"+Math.round(e).toLocaleString("en-US"),E1=e=>"₴"+Math.round(e).toLocaleString("en-US"),g3=e=>"€"+Math.round(e).toLocaleString("en-US"),Ng=(e,a)=>a==="UAH"?E1(e):a==="EUR"?g3(e):yt(e);function un(e,a){if(!e.salary)return 0;const l=typeof a=="number"?{uah:a,eur:1.148}:a;return e.salaryCurrency==="UAH"?e.salary/l.uah:e.salaryCurrency==="EUR"?e.salary*l.eur:e.salary}function ep(e,a){return e.salary?e.salaryCurrency==="USD"?{main:yt(e.salary),sub:""}:{main:`~${yt(un(e,a))}`,sub:Ng(e.salary,e.salaryCurrency)}:{main:"",sub:""}}function Yl(e){let a=0;for(const l of e.trim().toLowerCase())a=(a*31+l.codePointAt(0))%1e5;return a%8}const Mc=N.createContext(null),T1="orgami:lang",y3={"What is going on":"Сводка","Slack and doubles":"Простои и дублирование",Idle:"Без назначений","look at them":"показать","On projects":"В проектах","What they work on":"Проекты","{n} timed":"со сроком: {n}","{busy} of {all} engaged":"задействовано {busy} из {all}","A row opens its departments; a department opens the team filtered down to it.":"Строка компании раскрывает её отделы; отдел открывает состав в разделе «Команда».","Nobody is using them":"Сотрудники без назначений","{n} people carry no project, no duty and no timed work":"{n} сотрудников без проектов, обязанностей и задач со сроком","Everyone carries something.":"Все сотрудники задействованы","{idle} of {all}":"{idle} из {all}","Doing the same thing":"Дублирование","The same duty on several people, and areas with no single owner.":"Одинаковые обязанности у нескольких сотрудников и зоны ответственности без единственного владельца","Nothing doubled up so far.":"Дублирование не выявлено","{n} owners":"владельцев: {n}","{n} people with the same job title, none of them engaged":"{n} сотрудников с одинаковой должностью, ни один не задействован","Click a person to open their card; click a department to see it in the team.":"Сотрудник открывает карточку, отдел — состав в разделе «Команда».",Work:"Задачи",Zones:"ЗоÐ
15½Ñ‹","Put in a zone":"Добавить в зону","Remove {n} people from the project?":"Снять с проекта сотрудников: {n}?","{n} open":"открытых: {n}","{n} tasks inside go with it.":"Вместе с ней удалятся задачи: {n}.","no area":"зона не назначена","no zone":"без зоны","Person-days set aside for the open work":"Человеко-дни, заложенные на открытые задачи",Days:"Дней","{n} person-days":"{n} чел.-дней","{n} d":"{n} д",Planned:"Заложено","Work handed to this person":"Задачи, назначенные на сотрудника",Due:"Срок","{n} overdue":"просрочено: {n}","Nearest deadline":"Ближайший срок",overdue:"просрочено","and {n} more":"и ещё {n}","Everything handed to them is done.":"Все задачи закрыты","In progress":"В работе",Task:"Задача","Task name":"Название задачи","+ Task":"+ Задача","Who else":"Кто ещё","no part":"роль не указана","Open the area":"Открыть зону","e.g. stakeholder, lead developer, PM":"например: стейкхолдер, ведущий разработчик, PM","Search the work…":"Поиск по задачам…",Open:"Открытые","All areas":"Все зоны",Anyone:"Любой исполнитель","Nobody yet":"Без исполнителя","{shown} of {all}":"показано {shown} из {all}","{n} picked":"выбрано: {n}",State:"Состояние","Hand over to":"Передать","Move to area":"Перенести в зону","Who does it":"Исполнитель","Delete {n} pieces of work?":"Удалить задачи: {n}?","Work inside":"Задачи зоны","{n} works":"задач: {n}","{n} in progress":"в работе: {n}","{n} done":"готово: {n}","+ Piece of work":"Добавить задачу","Nothing here yet.":"Задач пока нет","{running} in progress · {done} done":"в работе: {running} · готово: {done}","{n} pieces inside go with it.":"Вместе с ней удалятся вложенные задачи: {n}.",Backlog:"Отложена","To do":"К выполнению","In review":"На проверке",Scheme:"Схема","Stream name":"Название направления","Area name":"Название зоны ответственности","Delete stream “{name}”?":"Удалить направление «{name}»?","Delete area “{name}”?":"Удалить зону «{name}»?","New area":"Новая зона ответственности","Who is on it":"Состав",Area:"Зона ответственности",Owns:"Владеет","Works on":"Участвует","Nobody is on this project yet — add people above.":"В проекте пока никого нет — добавьте людей выше.","Worth a look":"Обратить внимание","no project lead":"руководитель проекта не назначен","{n} people without an area":"участников без зоны: {n}","{n} empty streams":"направлений без людей и зон: {n}","{n} people own more than three areas":"владеют более чем тремя зонами: {n}","No areas in this project yet — add them on the scheme.":"Зон ответственности пока нет — добавьте их на схеме.","Find a department":"Поиск отдела","Sort A→Z":"Сортировать А→Я","Sort Z→A":"Сортировать Я→А","Back to the engaged first":"Вернуть: сначала задействованные",Backdrop:"Подложка","Search a person…":"Поиск сотрудника…","from {where}":"по {where}",Chart:"Схема","Pick a department on the left.":"Выберите отдел в списке слева","{n} units inside":"подразделений: {n}","{n} of them here":"непосредственно в отделе: {n}","{n} people, {idle} idle":"сотрудников: {n}, без назначений: {idle}","Nobody sits directly in this department.":"Напрямую в отделе сотрудников нет — только в подразделениях","no job title":"должность не указана",head:"руководитель",Team:"Команда","Open as a page":"Открыть на отдельной странице","Back to the team":"К списку сотрудников",Card:"Карточка","Everything this person is engaged in":"Все назначения сотрудника","Open the card":"Открыть карточку сотрудника",Engaged:"Задействованы",Free:"Без назначений","{busy} of {all} are engaged":"Задействованы: {busy} из {all}",Duties:"Обязанности",Timed:"Со сроком","Work with a start and an end":"Работа с датами Ð
15½Ð°Ñ‡Ð°Ð»Ð° и завершения","Standing duties":"Постоянные обязанности","Timed work":"Задачи со сроком","Nothing standing yet.":"Постоянных обязанностей нет","Nothing timed yet.":"Задач со сроком нет","+ Duty":"Добавить обязанность","+ Timed work":"Добавить задачу со сроком","What the person does":"Формулировка обязанности","e.g. keeps the SEO reports":"например: ведёт SEO-отчётность по своим сайтам","e.g. moves the catalogue to the new template":"например: переносит каталог на новый шаблон",from:"с",to:"по",finished:"завершена","Remove “{name}”?":"Удалить «{name}»?","In their team":"В подчинении","show all {n}":"показать всех ({n})","show fewer":"свернуть","Engaged in":"Задействован в","All projects":"Все проекты и инструменты","Main work":"основная занятость","Part of the time":"частичная занятость",Advises:"консультирование","Remove from the project":"Снять с проекта","Put on the project":"Назначить на проект","Open the project":"Перейти к проекту","Search a person, a job title, a department…":"Поиск по сотрудникам, должностям, отделам","All departments":"Все отделы","Not on any project.":"Не участвует в проектах","works on":"работает над","reports to":"подчиняется","More than one main project":"Более одной основной занятости","worth a look":"требует внимания","{a} main · {b} partial · {c} advisory":"основных: {a} · частичных: {b} · консультирование: {c}","Counted from involvement: a main project weighs three, a partial one two, an advisory one one, plus the areas a person owns and the projects they lead.":"Расчёт по глубине участия: основная занятость — 3 балла, частичная — 2, консультирование — 1; плюс зоны ответственности во владении и руководство проектами.","In projects":"Задействованы","In none":"Без назначений","Areas this person owns":"Зоны ответственности во владении сотрудника","Remove {name} from “{project}”?":"Снять сотрудника {name} с проекта «{project}»?",Involvement:"Глубина участия",Map:"Карта",Projects:"Проекты",Insights:"Аналитика",Settings:"Настройки",Tool:"Инструмент",Tools:"Инструменты","+ Tool":"+ Инструмент","New tool":"Новый инструмент",Responsible:"Ответственный","Tool settings":"Настройки инструмента","What the tool is for…":"Для чего инструмент…","Part of the project":"Входит в проект","— on its own —":"— сам по себе —","On its own":"Сам по себе","Pick a tool on the left, or create one.":"Выберите инструмент слева или создайте новый",'Delete tool "{name}"? People stay where they are; only the tool is removed.':"Удалить инструмент «{name}»? Люди останутся на своих местах, удалится только инструмент.","People and money":"Люди и деньги",Workload:"Нагрузка",Load:"Загрузка","of {n} people":"из {n} человек","busiest first":"сначала загруженные","free first":"сначала свободные","by name":"по алфавиту",lead:"руководитель","Project settings":"Настройки проекта","In this project":"Состав проекта",Streams:"Направления","Not set":"не назначен","People stay":"сотрудники остаются в системе",Code:"Код",List:"Список",Link:"Ссылка",bold:"жирный",italic:"к
15урсив",link:"ссылка",Edit:"Редактировать","Search…":"Поиск…",Filter:"Фильтр",All:"Все",Columns:"Колонки",done:"готово",edit:"править","by department":"по отделам","Nothing has changed since the history was kept.":"С тех пор как ведётся история, ничего не менялось.","Added to the map":"Заведён в системе",Managers:"Руководители",set:"поставлена",cleared:"снята","Somebody with this name already works here:":"Человек с таким именем уже есть:","Add a second record anyway?":"Всё равно завести вторую запись?","Add anyway":"Всё равно завести","{name} will report to {to}":"{name} будет подчиняться: {to}","{name} moves to the department {to}":"Перевести {name} в отдел «{to}»","{name} will hang straight off the company card: no department, no manager":"{name} будет висеть прямо под карточкой компании: без отдела и без руководителя","{name} becomes responsible for {to}":"{name} станет ответственным за «{to}»","{name} becomes part of {to}":"«{name}» войдёт в «{to}»","next {date}":"следующий {date}","Head of the company":"Руководитель компании","Somebody who works in this company and runs it.":"Человек из этой же компании, который ею руководит.","— not set —":"— не назначен —","{name} leaves the department {from}":"Убрать {name} из отдела «{from}»","{name} stops reporting to {from}":"{name} перестанет подчиняться: {from}","{to} is left without a responsible person":"«{to}» останется без ответственного","{name} leaves {from}":"«{name}» выйдет из «{from}»","Send to the archive":"В архив","The person leaves the company: out of the lists, kept in the history":"Человек ушёл из компании: пропадает из рабочих списков, но история и авторство остаются","Without a successor the archiving cannot finish: the reporting tree must not be broken.":"Без преемника архивация не завершится: дерево подчинения рвать нельзя.","{n} open tasks are on {name}. Who takes them?":"На {name} открытых задач: {n}. Кому они переходят?","Nobody — the tasks stay on them and will be visible as ownerless.":"«Никому» — задачи останутся на ушедшем и будут видны как без хозяина.","Nobody — leave the tasks as they are":"Никому — оставить задачи как есть","Send {name} to the archive?":"Отправить {name} в архив?","{name} is in the archive":"{name} — в архиве","Former employees":"Бывшие сотрудники","Back to work":"Вернуть в строй","Nobody has left yet.":"Пока никто не уходил.","Left {date}":"Ушёл {date}","Bring {name} back to work?":"Вернуть {name} в строй?","Worked before":"Работал раньше","This project no longer exists":"Этого проекта больше нет","Which columns to show":"Какие колонки показывать",Started:"В компании с","{n} without a photo":"{n} без фото","Nobody found":"Никого не найдено","{name} has {n} reports. Who takes them over?":"У {name} подчинённых: {n}. Кому они переходят?","Whoever is chosen becomes their manager. Nobody — they are left without one.":"Выбранный человек станет их руководителем. «Никому» — останутся без руководителя.","Nobody — leave them without a manager":"Никому — оставить без руководителя","Reports moved to {name}":"Подчинённые переданы: {name}",Undo:"Отменить","Deleted: {what}":"Удалено: {what}","Deleted tasks: {n}":"Удалено задач: {n}","Expand in full":"Развернуть полностью","Built {when}":"Собрано {when}",Sections:"Разделы","Map menu":"Меню карты","Companies, background, layout":"Компании, подложка, расстановка",Collapse:"Свернуть","Collapse the menu":"Свернуть меню","Expand the menu":"Развернуть меню",Everyone:"В
15се",New:"Новая",Done:"Готово",Low:"Низкий",High:"Высокий",Status:"Статус","Job title":"Должность","nobody yet":"не назначено","+ Project":"+ Проект","New project":"Новый проект","New stream":"Новое направление","+ Stream":"+ Направление","No stream":"Без направления","no owner":"без владельца","— no owner —":"— без владельца —",Owner:"Владелец","Delete project":"Удалить проект",'Delete project "{name}"? People stay where they are; only the project is removed.':"Удалить проект «{name}»? Люди остаются на своих местах, удаляется только проект.","{n} people stay in the project without a stream.":"{n} чел. останутся в проекте без направления.",'Delete stream "{name}"?':"Удалить направление «{name}»?","Delete stream":"Удалить направление","What the project is about…":"О чём проект…","Add a person to the project…":"Добавить человека в проект…","Nobody matches":"Никого не найдено","Add streams (Management, SEO, Content, Backend…) — the columns of the board — then people.":"Добавь направления (Management, SEO, Content, Backend…) — колонки доски, — затем людей.","Pick a project on the left, or create one.":"Выбери проект слева или создай новый.",Approval:"Согласование",Coordination:"Координация",Execution:"Исполнение","Signs off the stream's results and takes the final decisions":"Согласовывает результаты направления и принимает финальные решения","Runs the work: sets tasks, checks results, hands over for approval":"Ведёт работу: ставит задачи, проверяет результат, отдаёт на согласование","Does the work":"Выполняет работу","In the project":"В проекте","Role on the project":"Роль в проекте","e.g. SEO Manager":"например, SEO Manager",Stream:"Направление",Tier:"Уровень","Area of responsibility":"Зона ответственности","What this person answers for on the project":"За что этот человек отвечает в проекте","Remove from project":"Убрать из проекта",Project:"Проект","Project lead":"Руководитель проекта","— nobody yet —":"— не назначен —","No project lead yet":"Руководитель проекта не назначен","Who reports to whom":"Подчинённость","Who owns what":"Зоны ответственности",Board:"Направления",area:"область",areas:"области","{n} areas without an owner":"зон без владельца: {n}","Gets tasks from":"Получает задачи от","— nobody in particular (the stream) —":"— ни от кого конкретно (направление) —","Sets tasks for: {names}":"Ставит задачи: {names}",Areas:"Зоны ответственности","No areas in this project yet — add them in “Who owns what”.":"Зоны ответственности не заданы — добавьте их во вкладке «Зоны ответственности».",works:"работает",owns:"владеет","Owns this area":"Владеет областью","Works on this area":"Работает в области",approves:"согласует",coordinates:"координирует",executes:"выполняет","New area: Каталог+, Адмін+, site…":"Новая зона: Каталог+, Адмін+, сайт…","+ Area":"+ Зона","No area":"Без зоны","★ owns the area · plain = works on it · “no owner” = nobody answers for that area. Areas are assigned in the person's editor.":"★ — владеет областью, без звезды — работает в ней; «нет владельца» — за область никто не отвечает. Области назначаются в редакторе человека.","Add the areas the project delivers (Каталог+, Адмін+, Контент+, the site…) — then mark who owns and who works on each.":"Добавь области, которые проект делает (Каталог+, Адмін+, Контент+, сайт…) — затем отметь, кто владеет и кто работает в каждой.","area ↓ · stream →":"область ↓ · направление →","Nobody owns this area":"У области нет владельца",'Delete area "{name}"? People stay in the project.':"Удалить область «{name}»? Люди остаются в проекте.","Delete area":"Удалить область","Click: edit role and responsibility · double-click: everything":"Клик — роль и зона ответственности; двойной клик — всё","Esc or click outside saves":"Esc или клик снаружи — сохранить",Clear:"Очистить","Remove {name} from the project?":"Убрать {name} из проекта?",Menu:"Меню","Close menu":"Закрыть меню","Auto-arrange":"Авторасстановка","Lay the cards out again":"Расставить карточки заново","Lay out the tree so nothing overlaps":"Разложить дерево так, чтобы ничего не пересекалось","+ Add company":"+ Компания",Refresh:"Обновить","Refresh data from the server (F5) — keeps full screen":"Обновить данные с сервера (F5) — не сбрасывает полноэкранный режим","Full screen":"Полный экран","Exit full screen":"Выйти из полноэкранного режима","Exit full screen (or press and hold Esc)":"Выйти из полноэкранного режима (или удерживать Esc)","Search…  Ctrl+K":"Поиск…  Ctrl+K","Search companies and people":"Поиск компаний и людей","Nothing found":"Ничего не найдено",Group:"Группа",Company:"Компания",Department:"Отдел",Unit:"Подразделение",'Close the project "{name}"? It leaves the working lists but stays whole — tasks, history, who was on it.':"Закрыть проект «{name}»? Он уйдёт из рабочих списков, но останется целиком — задачи, история, кто в нём был.",'Close the tool "{name}"? It leaves the working lists but stays whole — tasks, history, who was on it.':"Закрыть инструмент «{name}»? Он уйдёт из рабочих списков, но останется целиком — задачи, история, кто в нём был.","There are {n} unfinished tasks here. Finish them, cancel them or move them to another project first.":"Ð
15’нутри осталось незакрытых задач: {n}. Сначала доделайте их, отмените или перенесите в другой проект.","Project closed {on}":"Проект закрыт {on}","Tool closed {on}":"Инструмент закрыт {on}","open it again":"открыть снова","Open it again":"Открыть снова","Close the project":"Закрыть проект","closed {on}":"закрыт {on}","it stays whole":"останется целиком","Got it":"Понятно","How long will it take, in working days?":"Сколько это займёт, в рабочих днях?","for example 0.5 or 3":"например 0.5 или 3","over the estimate of {plan} — {times}×":"больше оценки {plan} — в {times} раза","went over the estimate — {times}× of it":"вышла за оценку — в {times} раза","silent for {n} weeks":"молчит {n} нед.","nothing said about it yet":"о ней ещё не писали","A goal is spoken about once a week — by whoever answers for it":"О цели пишут раз в неделю — тот, кто за неё отвечает","carried over ×{n}":"переносов: {n}","It has been carried into another quarter {n} times":"Цель переносили в следующий квартал раз: {n}","carry into the next quarter":"перенести в следующий квартал","Carry “{name}” into the next quarter?":"Перенести цель «{name}» в следующий квартал?","Carry “{name}” into the next quarter? It has already been carried over {n} times.":"Перенести цель «{name}» в следующий квартал? Её уже переносили раз: {n}.","Carry over":"Перенести","Carried over":"Перенесена","overloaded: {n} days short":"перегружен: не хватает {n} дн.","The estimates of what is promised by {day} need {n} working days more than there are":"Обещанного к {day} по оценкам на {n} рабочих дн. больше, чем есть времени","Answers for it":"Отвечает",Connected:"Подключено",Refreshed:"Обновлено",Saved:"Сохранено",Added:"Добавлено",Deleted:"Удалено",Removed:"Удалено","Closed the project":"Проект закрыт",Reopened:"Снова в работе",Arranged:"Разложено",Undone:"Отменено",Redone:"Возвращено","Nothing to undo":"Отменять нечего","Nothing to redo":"Возвращать нечего","Photo saved":"Фото сохранено","Photo removed":"Фото удалено","Uploading…":"Загрузка…","Marks cleared":"Пометки сняты","Something went wrong":"Что-то пошло не так","That would create a loop":"Так получится петля","The responsible person must work for the parent company":"Ответственный должен работать в родительской компании","That department belongs to another company":"Этот отдел принадлежит другой компании","Drop the line on a person, a department or the person's own company card":"Отпустите линию на человеке, отделе или карточке его компании","Fullscreen is not available here":"Полноэкранный режим здесь недоступен","Updated {n} people":"Обновлено: {n} чел.","Deleted {n} people":"Удалено: {n} чел.",OK:"ОК",Cancel:"Отмена",Delete:"Удалить",Remove:"Удалить",Merge:"Объединить",'Delete "{name}"? Companies under it will move up one level.':"Удалить «{name}»? Компании под ней поднимутся на уровень выше."," {n} people will be removed with it.":" Вместе с ней будет удалено людей: {n}.","Remove {name}?":"Удалить {name}?"," {n} reports move up one level.":" Подчинённых поднимется на уровень выше: {n}.",'Delete department "{name}"?':"Удалить отдел «{name}»?"," {n} people stay in the company without a department.":" Людей останется в компании без отдела: {n}.","Delete {n} people? Their reports move up one level.":"Удалить {n} чел.? Их подчинённые поднимутся на уровень выше.",Companies:"Компании",View:"Вид",Backgroun
15d:"Подложка","People branches grow":"Ветки людей растут",Down:"Вниз",Right:"Вправо","Org chart: people under the card":"Оргструктура: люди под карточкой","Mind map: people to the right of the card":"Майндмэп: люди справа от карточки","Changing the direction re-arranges the whole map.":"Смена направления перекладывает всю карту.",Dots:"Точки","Big dots":"Крупные точки",Grid:"Сетка","Graph paper":"Миллиметровка",Crosses:"Крестики",Paper:"Бумага",Blueprint:"Чертёж",Plain:"Без узора","The eye hides a company and everything under it.":"«Глаз» скрывает компанию и всё под ней.","{n} of {total} hidden":"Скрыто {n} из {total}","Show all":"Показать все","Hide all":"Скрыть все","Show on the map":"Показать на схеме компании","Hide from the map":"Скрыть с карты",group:"группа","No companies yet.":"Компаний нет","{n} in the company · {total} including companies below":"{n} в компании · {total} с дочерними","Total: {n} people in {c} companies":"Всего: {n} чел. в {c} компаниях","{n} shown":"показано {n}","Payroll: {m}/mo · {y}/yr":"ФОТ: {m}/мес · {y}/год","Payroll per month: own people / including the companies below":"ФОТ в месяц: свои люди / с дочерними компаниями","What-if":"Что если","Mark the dismissals you are weighing (✂ on a person, or the checkbox in the panel) to see what they would save. Nobody is deleted.":"Отметьте людей, которых считаете без учёта (✂ на карточке или галочка в панели), чтобы увидеть, как меняется фонд оплаты. Ничего в данных не происходит.","{n} marked for dismissal":"Исключено из расчёта: {n}","saves {m}/mo ({y}/yr)":"экономия {m}/мес ({y}/год)","Keep everyone (clear marks)":"Вернуть всех в расчёт","✂ {n} for dismissal":"без них: {n}","? {n} under review":"? под вопросом: {n}","What-if scenario: the dismissals being weighed":"Прикидка: сколько стоит команда без этих людей. В данных ничего не меняется","under review":"под вопросом",Decided:"Решено",Keep:"Оставить","Keep everyone":"Оставить всех","S
15aves {m}/mo · {y}/yr":"Экономия {m}/мес · {y}/год","{n} selected":"Выбрано: {n}","✓ Keep all":"Вернуть в расчёт","✂ Dismiss all?":"Посчитать без них","What-if: mark all for dismissal / keep all":"Прикидка: временно исключить выбранных из расчёта фонда оплаты — или вернуть обратно","? Review all":"Пометить «под вопросом»","✓ Decided":"Снять пометку","Mark all as under review / decided":"Служебная пометка «решение не принято» — видна только в карточке и на карте","Move to department…":"Перевести в отдел…","— no department —":"— без отдела —","Delete all":"Удалить всех","Clear selection (Esc)":"Снять выделение (Esc)","Clear selection":"Снять выделение","+ Person":"+ Человек","+ Department":"+ Отдел","+ Sub-company":"+ Дочерняя компания","+ Report":"+ Подчинённый","+ Unit":"+ Подразделение","? Review":"? Под вопрос","Under review: not sure yet whether this person is needed":"На рассмотрении: решение о необходимости сотрудника не принято","Decided: remove the question mark":"Решено: убрать знак вопроса","✂ Dismiss?":"Считать без него","✓ Keep":"Вернуть в расчёт","Keep this person (clear the mark)":"Вернуть человека в расчёт","What-if: a possible dismissal — stays on the map, out of the totals":"Прикидка: человек остаётся на схеме и в данных, но не учитывается в фонде оплаты",dismissal:"исключён из расчёта","? Under review":"Под вопросом","A possible dismissal (what-if)":"Не учитывается в расчёте фонда оплаты (прикидка)","Under review: is this person needed?":"Служебная пометка: решение по человеку не принято","Card color":"Цвет карточки","Default color":"Цвет по умолчанию","Company color":"Цвет компании","Department color":"Цвет отдела","Show people":"Показать людей","Hide people":"Скрыть людей","Hide people and departments":"Скрыть людей и отделы","Show {label}":"Показать: {label}","Hide the companies below":"Скрыть компании ниже","Show {n} companies below":"Показать компании ниже: {n}","Show 1 company below":"Показать компанию ниже","Show {n} reports":"Показать подчинённых: {n}","Hide reports":"Скрыть подчинённых","Show {n} people":"Показать людей: {n}","{n} people":"{n} чел.","{n} companies":"компаний: {n}","1 company":"1 компания",Untitled:"Без названия","What it does…":"Чем занимается…",Name:"Имя",Title:"Должность","Click to change photo":"Нажмите, чтобы сменить фото","Run by {name}":"Отвечает {name}","Head: {name}":"Руководитель: {name}","Managed by {name}":"Руководит {name}","Reports to {names}":"Подчиняется: {names}",staff:"штаб","Double-click to edit":"Двойной клик — редактировать","Double-click to rename":"Двойной клик — переименовать","+ tag":"+ тег",tag:"тег","Remove tag {t}":"Удалить тег {t}","Profit share":"Доля прибыли","Add a direct report":"Добавить подчинённого",Step:"Ступенькой",Curve:"Кривая",Straight:"Прямая",Solid:"Сплошная",Dashed:"Пунктир",Dotted:"Точками","Width {n}":"Толщина {n}","Line shape":"Форма линии","Line dash":"Штрих линии","Line width":"Толщина линии","Line color":"Цвет линии",out:"из",in:"в","Leaves the parent from":"Выходит из родителя","Enters this node on":"Входит в узел","Side of the parent the line leaves from":"Сторона родителя, откуда выходит линия","Side of this node the line enters on":"Сторона узла, куда входит линия","Leaves from the {s}":"Выходит: {s}","Enters on the {s}":"Входит: {s}
15",top:"сверху",bottom:"снизу",left:"слева",right:"справа",Person:"Человек","Show the company and all its people":"Показать компанию и всех её людей",Close:"Закрыть","All {n} people of {company}":"Все {n} чел. компании {company}","What it does":"Чем занимается",Type:"Тип","Holding (group level)":"Холдинг (уровень группы)","Reports to":"Подчиняется","— none (standalone) —":"— никому (отдельная) —","Responsible person":"Ответственный","— the parent company itself —":"— сама родительская компания —","Someone at {parent} who runs this company; the line then starts from them.":"Человек из {parent}, который отвечает за эту компанию; линия пойдёт от него.","the parent":"родительской компании",Tags:"Теги",Color:"Цвет",Default:"По умолчанию",Departments:"Отделы","Department name":"Название отдела","Head of department":"Руководитель отдела","Head of the department":"Руководитель отдела","— no head —":"— без руководителя —","Part of":"Входит в","Part of which department (makes this a unit)":"В какой отдел входит (делает подразделением)","— top level —":"— верхний уровень —","in {name}":"в {name}","People in the department":"Людей в отделе","Delete department":"Удалить отдел","Delete {name}":"Удалить {name}","New department…":"Новый отдел…",Add:"Добавить",People:"Люди","+ Add person":"+ Человек","Payroll {m}/mo ≈ {u} at {r} UAH/USD":"ФОТ {m}/мес ≈ {u} по курсу {r} UAH/USD","What-if: {a}/mo after cuts, saving {b}/mo ({c}/yr)":"Что если: {a}/мес после сокращений, экономия {b}/мес ({c}/год)","No people yet.":"Людей пока нет.","Delete company":"Удалить компанию","Full name":"ФИО","Upload photo":"Загрузить фото","Change photo":"Сменить фото","Remove photo":"Удалить фото","Possible dism
15issal":"Не учитывать в расчёте","(what-if: dimmed on the map, out of the totals)":"(прикидка: на схеме приглушён, из сумм исключён)","Under review":"Под вопросом","(not decided yet whether the person is needed; payroll unchanged)":"(ещё не решено, нужен ли человек; ФОТ не меняется)","Start date":"Дата начала","— none (reports to the company) —":"— нет (подчиняется компании) —",Unnamed:"Без имени","Stop reporting to {name}":"Убрать руководителя {name}","this person":"этого человека","Add a manager":"Добавить руководителя","+ another…":"+ ещё…","+ manager…":"+ руководитель…",nobody:"никто","Pay is hidden in confidential mode.":"Оплата скрыта в конфиденциальном режиме.","Salary / month":"Зарплата / месяц","Salary currency":"Валюта зарплаты","Profit share, %":"Доля прибыли, %","Share from":"Доля от","Share to":"Доля до",Currency:"Валюта","USD / UAH exchange rate":"Курс USD / UAH","EUR → USD rate (USD per 1 EUR)":"Курс EUR → USD (USD за 1 EUR)","Salaries can be entered in USD, UAH or EUR; payroll totals are always in USD at these rates.":"Зарплаты можно вводить в USD, UAH или EUR; итоги всегда в USD по этим курсам.",Dictionaries:"Справочники","Tags, job titles and departments offered as suggestions while typing.":"Теги, должности и отделы, предлагаемые при вводе.","Confidential mode":"Конфиденциальный режим","Hide salaries, profit shares and payroll totals everywhere in the app.":"Скрыть зарплаты, доли и ФОТ во всём приложении.","Interface language":"Язык интерфейса","Data (names, titles, departments, tags) stays as entered.":"Данные (имена, должности, отделы, теги) остаются как введены.",General:"Общие",Money:"Деньги",Data:"Данные",Assistant:"Ассистент",tokens:"токенов",history:"история",back:"назад","new chat":"новый чат","Past conversations, with the page they happened on.":"Прошлые разговоры и страница, на которой они были.","Without a question":"Без вопроса","Apply all ({n})":"Применить все ({n})","Skip all":"Пропустить все",Applied:"Применено","Try again":"Повторить","Ask about the structure, or say what to change — every change is shown as a card and applied only after you confirm it. The data (names, titles, salaries if you may see them) is sent to OpenAI with each question.":"Задайте вопрос о структуре или сформулируйте изменение — каждое изменение показывается карточкой и применяется только после подтверждения. Данные (имена, должности, зарплаты — если они вам доступны) передаются в OpenAI с каждым запросом.","What the ✦ assistant was asked and what it cost. Questions and applied actions are both logged.":"Что спрашивали у ассистента ✦ и сколько это стоило. В журнал попадают и вопросы, и применённые действия.","Model: {model}":"Модель: {model}","Not configured: OPENAI_API_KEY is missing on the server.":"Не настроено: на сервере нет OPENAI_API_KEY.","your own requests":"твои запросы",Today:"Сегодня","30 days":"30 дней","All time":"За всё время","{n} requests · {k}K tokens":"{n} запросов · {k}K токенов","7 days":"7 дней","Who spent it":"Кто сколько потратил",Requests:"Запросов",Spent:"Потрачено","Last asked":"Последний запрос","Everyone sees what the assistant costs the group.":"Расходы на ассистента видны всем.","For the peri
15od chosen above. A request is a question to the assistant; applying a change costs nothing.":"За выбранный период. Запрос — это вопрос ассистенту; применение предложенного изменения ничего не стоит.","Nobody has asked the assistant in this period.":"За этот период к ассистенту никто не обращался","Price per 1M tokens, {model}":"Цена за 1M токенов, {model}","cached input ${n}":"кэш входа ${n}",input:"вход",output:"выход",Save:"Сохранить","Until the prices are filled in, the cost shows as $0 — take them from platform.openai.com/docs/pricing.":"Пока цены не заполнены, стоимость показывается как $0 — возьми их на platform.openai.com/docs/pricing.","Hide the log":"Скрыть журнал","Show the log ({n})":"Показать журнал ({n})",When:"Когда",Who:"Кто",Request:"Запрос",Result:"Результат",Tokens:"Токены",Cost:"Стоимость",question:"вопрос",action:"действие","Nothing yet.":"Пока пусто.","Sees: {where}":"Видит: {where}","Thinking…":"Думаю…","What does payroll look like?":"Какой у нас ФОТ?","Who has no manager?":"Кто без руководителя?","Add a person to Affiliate Prime":"Добавь человека в Affiliate Prime","Which project areas have no owner?":"У каких областей проекта нет владельца?","Ask, or say what to change…":"Спроси или скажи, что поменять…",Send:"Отправить","Enter sends · Shift+Enter is a new line":"Enter — отправить, Shift+Enter — новая строка",Create:"Создать",Change:"Изменить",Apply:"Применить",Skip:"Пропустить","Yes, delete":"Да, удалить",Skipped:"Пропущено",Email:"Email","Sign in through the admin panel":"Войти через админ-панель","Sign out":"Выйти","Too many attempts, try again in 15 minutes":"Слишком много попыток, попробуй через 15 минут","Sign in required":"Нужно войти","Your admin-panel account gets you in. Roles are set here, in Settings → Users.":"Вход — по аккаунту админ-панели. Роли задаются здесь, в Настройки → Пользователи.","Sign-in is not set up on this server: the admin panel is not configured.":"Вход на этом сервере не настроен: не указана админ-панель.","The sign-in window was blocked — allow pop-ups for this site":"Окно входа заблокировано — разреши всплывающие окна для этого сайта","The admin panel did not confirm the sign-in":"Админ-панель не подтвердила вход","The admin panel did not answer, try again":"Админ-панель не ответила, попробуй ещё раз","Your admin-panel account is not active":"Твой аккаунт в админ-панели не активен","View only":"Только просмотр","view only":"только просмотр","Admins only":"Только для админов","You can't change salaries":"Тебе нельзя менять зарплаты",admin:"админ",editor:"редактор",viewer:"наблюдатель",Admin:"Админ",Editor:"Редактор",Viewer:"Наблюдатель","Everything, including users and backups":"Всё, включая пользователей и бэкапы","Edits the map and projects":"Правит карту и проекты","Read only":"Только чтение",Account:"Аккаунт","Account settings":"Настройки аккаунта",You:"Ты","Who you are signed in as. The role and money access are set by an admin.":"Под кем ты вошёл. Роль и доступ к деньгам задаёт админ.","Who you are signed in as. The role is set by an admin.":"Под кем ты вошёл. Роль задаёт админ.","Ends this session on this device. Other devices stay signed in.":"Завершает сессию на этом устройстве. На других ты останешься в системе.",Users:"Пользователи","sees money":"видит деньги","money hidden":"деньги скрыты","Sees money":"Видит деньги",Role:"Роль","Last seen":"Был(а)",never:"никогда",you:"ты",delete:"удалить","Delete user {email}?":"Удалить пользователя {email}?","Who can sign in is decided in the admin panel; everyone arrives as an admin. Admin: everything. Editor: changes the map and projects. Viewer: read only. “Sees money” shows salaries, shares and payroll; for everyone else they are hidden by the server, not just the screen.":"Кто может войти, решает админ-панель; каждый приходит администратором. Администратор — полный доступ. Редактор — правит схему и проекты. Наблюдатель — только просмотр. «Видит деньги» — показывать зарплаты, доли и ФОТ; остальным сервер их не передаёт вообще, а не скрывает на экране.","Who can sign in is decided in the admin panel; everyone arrives as an admin. Admin: everything. Editor: changes the map and projects. Viewer: read only. This instance keeps no salaries at all.":"Кто может войти, решает админ-панель; каждый приходит администратором. Администратор — полный доступ. Редактор — правит схему и проекты. Наблюдатель — только просмотр. На этом сервере зарплаты не хранятся.","a user with this email already exists":"пользователь с таким email уже есть","you can't demote yourself":"нельзя понизить самого себя","you can't delete yourself":"нельзя удалить самого себя","Show all {n}":"Показать всех ({n})","Show fewer":"Свернуть",Tasks:"Задачи",Recurring:"Регулярные","All tasks":"Все задачи","Next 7 days":"Ближайшие 7 дней",Overdue:"Просрочено","Open the task":"Открыть задачу","Recurring task":"Регулярная задача",Subtasks:"Подзадачи","+ Subtask":"+ Подзадача","— nobody —":"— никого —",Empty:"Не задано",Description:"Описание","Attach a file":"Прикрепить файл","Write something, or drop a file…":"Напиши что-нибудь или перетащи файл…","only the author can change a message":"править сообщение может только его автор","only the author can delete a message":"удалить сообщение может только его автор","New task":"Новая задача","New recurring task":"Новая регулярная задача","Every week on the day chosen; anything finer is set on the task itself.":"Каждую неделю в выбранный день; более тонкое правило задаётся уже в самой задаче.","by {d}":"до {d}","no date":"без срока","My tasks":"Мои задачи","Tasks of the department":"Задачи отдела","Every task of this department":"Все задачи этого отдела","Show only what is late":"Только просроченные","Show only what is being done":"Только те, что в работе","Show only the recurring ones":"Только регулярные","Show only what is finished":"Только выполненные","Open in Tasks":"Открыть в задачах","Task inside a project or a tool":"Задача в рамках проекта или инструмента","Project or tool":"Проект или инструмент","{n} y":"{n} г.","{n} mo":"{n} мес.",About:"О сотруднике",fewer:"свернуть","The card":"Карточка","Nothing is handed to them.":"Задач на сотруднике нет.",Numbers:"Показатели","Closing in time":"Закрытие в срок","Counting…":"Считаем…","The numbers could not be read.":"Показатели не удалось прочитать.","Nothing to count from yet: none of the closed work had a date to meet.":"Считать пока не из чего: у закрытых задач не было срока.","Nothing to count from yet: nothing has been closed.":"Считать пока не из чего: закрытых задач нет.","{a} of {b} closed by the day they were due":"{a} из {b} закрыты не позже срока","{n} late":"с опозданием: {n}","{n} of them are dated by the task's last change: they were closed before the history was kept.":"Из них {n} посчитаны по дате последнего изменения задачи — их закрыли до того, как мы начали вести историю.",Dates:"Срок",Start:"Начало","From when it is worked on":"С какого дня задача в работе","By when it must be done":"К какому дню должна быть сделана","{n} days":"{n} дн.","Who set it":"Кто поставил","on some of them":"есть не у всех","Assistant sees it":"Ассистент видит","Hidden from the assistant":"Скрыта от ассистента","The assistant reads this task. Press to close it.":"Ассистент читает эту задачу. Нажмите, чтобы закрыть.","Closed from the assistant: it neither reads nor changes this task. Press to open it.":"Задача закрыта от ассистента: он её не читает и не меняет. Нажмите, чтобы открыть.","Show how it will read":"Показать, как будет выглядеть","Time estimate":"Оценка","{n} w":"{n} нед.",min:"мин",hours:"часы",days:"дни","Carry on":"Продолжить","Hold the clock — the task stays in work":"Остановить время — задача остаётся в работе","Pick the clock up again":"Продолжить отсчёт","Take it into work — the clock starts":"Взять в работу — время пойдёт","The clock is running":"Время идёт","Paused: the task is on review":"Пауза: задача на проверке","Paused by hand: the task is still in 
15work":"Пауза вручную: задача остаётся в работе",Paused:"Пауза","The clock is paused":"Время на паузе","paused the clock":"поставил(а) время на паузу","started the clock again":"снова включил(а) время","A working day is {h} hours, a week is {d} days":"рабочий день — {h} ч, неделя — {d} дн.","of {n} estimated":"из {n} по оценке","The clock has not started":"Ещё не начинали",Pause:"Пауза","Pause: put it on review":"Пауза: отправить на проверку","Start: take it into work":"Начать: взять в работу","Time in work":"Время в работе","less than a minute":"меньше минуты","{n} h":"{n} ч","{n} min":"{n} мин","The clock is running: the task is in progress":"Время идёт: задача в работе","On hold: the task is in review":"Пауза: задача на проверке","The clock has stopped: the task is finished":"Время остановлено: задача завершена","On hold":"На паузе",Contacts:"Контакты","In the company":"В компании","no department":"без отдела","in the group {n}":"в компании {n}","Marked as a possible dismissal":"Исключён из расчёта фонда оплаты","Marked as under review":"Под вопросом","Both are what-ifs: the person stays where they are, and the totals show what would change.":"Обе пометки — прикидка: человек остаётся на месте, а в итогах видно, что изменилось бы.","Open now":"Открыто","Closed in total":"Закрыто всего","Pulled into":"Привлечён к","Person-days":"Человеко-дней","Average delay":"Среднее опоздание","From making to closing":"От создания до закрытия","The last six months":"Последние полгода","Nothing closed in this time.":"За это время ничего не закрыто.","{a} of {b} in time":"{a} из {b} в срок","Where the work is":"Где работа","Outside the projects":"Вне проектов","{n} closed":"закрыто: {n}","Recurring work":"Регулярные задачи","Answered in time":"Отвечено вовремя","{a} of {b}":"{a} из {b}","{n} skipped":"пропущено: {n}",Icon:"Иконка","No icon":"Без иконки","All {n} icons":"Все иконки ({n})","Fewer icons":"Свернуть список",Documents:"Документы",Pages:"Страницы",Page:"Страница",Folder:"Папка",Rename:"Переименовать","New page here":"Новая страница здесь","Page inside":"Страница внутри","Untitled page":"Без названия","Name of the folder":"Название папки","Find a page…":"Найти страницу…","Pick a page on the left, or make one.":"Выберите страницу слева или создайте новую.","No documents yet. A folder holds them; a page is where they are written.":"Документов пока нет. Папка их хранит, страница — то, где пишут.","Delete the folder “{name}”?":"Удалить папку «{name}»?","{n} pages inside stay, one level up.":"Страницы внутри останутся, уровнем выше: {n}.","Delete the page “{name}”?":"Удалить страницу «{name}»?","{n} pages inside go with it.":"Вместе с ней удалятся вложенные страницы: {n}.","Last written in by {who}":"Последним писал(а) {who}","Started it":"Создал(а) страницу","Written in by":"Писали","wrote in it":"писали","updated {when}":"обновлено {when}","Not written in yet":"Ещё не писали","Opening…":"Открываем…","Write here. “/” puts in a heading, a list, a table…":"Пишите здесь. «/» вставит заголовок, список, таблицу…","Blocks to put in":"Блоки","Normal text":"Обычный текст","Heading 1":"Заголовок 1","Heading 2":"Заголовок 2","Heading 3":"Заголовок 3","Block quote":"Цитата","Code block":"Блок кода",Divider:"Разделитель",Fold:"Свернуть",Unfold:"Развернуть","Who is working on it":"Кто работает над целью","This week":"На этой неделе","written by {who}":"написал(а) {who}","not written yet":"отчёта ещё нет","How is it going, in your own words…":"Как идёт, своими словами…","Earlier weeks":"Прошлые недели","{n} projects":"проектов: {n}","or a date of its own":"или своя дата",Goal:"Цель","New goal":"Новая цель","What it means":"Что это значит","How anybody will know it is reached…":"Как поймём, что цель достигнута…","Whose goal":"Чья цель","Who answers for it":"Кто отвечает","By when":"К какому сроку","— none —":"— нет —","Work on the goal":"Работа над целью","no tasks yet":"задач пока нет","{n} recurring":"регулярных: {n}","{done} of {all} tasks done":"сделано {done} из {all} задач","+ A task for this goal":"+ Задача для этой цели","Take it off the goal":"Убрать с цели",recurring:"регулярная","{steps} of {allSteps} steps · {tasks} of {allTasks} tasks":"шагов {steps} из {allSteps} · задач {tasks} из {allTasks}",Planner:"Планнер",Everybody:"Все",Me:"Я","My calendar":"Мой календарь",Doing:"Исполнитель","Pulled in":"Привлечён","Set it":"Поставил","Doing it":"исполнитель","Pulled into it":"привлечён","Set the task":"поставил(а) задачу","I am doing":"Делаю","I was pulled in":"Привлечён","I set it":"Я поставил","You are doing it":"Вы исполнитель","You were pulled in":"Вас привлекли","You set it":"Вы поставили задачу","In work now":"Сейчас в работе","Nothing is in progress.":"В работе ничего нет.","Nothing is overdue.":"Просроченного нет.","No date":"Без срока","Everything has a date.":"У всего есть срок.",Notifications:"Оповещения","mark all read":"отметить прочитанным","due today":"срок сегодня","Move the deadline of everything picked":"Сдвинуть срок у всех выделенных","due tomorrow":"срок завтра","{n} new messages":"новых сообщений: {n}","Nothing yet. Tasks handed to you, replies in a conversation and dates coming up will appear here.":"Пока пусто. Здесь будут задачи, которые вам передали, ответы в обсуждениях и подходящие сроки.","Mark all read":"Отметить всё прочитанным","{n} unread":"непрочитанных: {n}","Needs you":"Требует внимания",Everything:"Всё",Unread:"Непрочитанные",Messages:"Сообщения",Changes:"Изменения",Yesterday:"Вчера","wrote in the conversation":"написал(а) в обсуждении","Nothing under this filter.":"По этому фильтру ничего нет.","Nothing yet. A task handed to you, a reply in a conversation, a change to work of yours — all of it appears here.":"Пока пусто. Здесь появится всё, что происходит с вашими задачами: их передали вам, ответили в обсуждении, что-то изменили.","This account is not tied to anybody on the map yet, so there is no work of its own to hear about. Settings → Users.":"Аккаунт пока не связан с сотрудником, поэтому своих задач у него нет. Настройки → Пользователи.","This account is not linked to anyone on the map yet — put its corporate email on that person's card.":"Этот аккаунт ещё не связан с сотрудником: впишите его корпоративную почту в карточке человека.","Delete “{name}”?":"Удалить «{name}»?","you see everyone's requests":"вам видны запросы всех",name:"название",used:"использований","Without a department":"Без отдела","Select all":"Выбрать все",Salary:"Зарплата","created the task":"создал задачу","added a subtask":"добавил подзадачу","moved it to {to}":"перевёл в «{to}»","renamed it":"переименовал задачу","changed the description":"изменил описание","handed it to {who}":"назначил исполнителем: {who}","left it to nobody":"снял исполнителя","set the date to {day}":"поставил срок: {day}","took the date off":"убрал срок","moved it to the {dept} department":"перенёс в отдел «{dept}»","took it out of the department":"убрал из отдела","moved it into {name}":"перенёс в «{name}»","took it out of the project":"убрал из проекта","filed it under {name}":"положил в группу «{name}»","took it out of the group":"убрал из группы","put it in the zone {name}":"отнёс к зоне «{name}»","took it out of the zone {name}":"убрал из зоны «{name}»","tagged it {tags}":"добавил тег: {tags}","removed the tag {tags}":"убрал тег: {tags}","pulled in {who}":"добавил участника: {who}","took {who} off it":"убрал участника: {who}","changed how often it comes round":"изменил правило повтора","added “{title}” to the checklist":"добавил в чек-лист: «{title}»","ticked off “{title}”":"отметил в чек-листе: «{title}»","unticked “{title}”":"снял отметку в чек-листе: «{title}»","removed “{title}” from the checklist":"убрал из чек-листа: «{title}»","attached {name}":"прикрепил файл: {name}","removed the file {name}":"удалил файл: {name}","changed something":"что-то изменил",Kanban:"Канбан","N
15othing here":"Пусто","New zone…":"Новая зона…","New zone":"Новая зона","Zone name":"Название зоны","no zones yet":"зон пока нет","Not started":"Не начато",Active:"В работе сейчас","Done and closed":"Закрыто",Collapsed:"Свёрнуты",Separate:"Отдельно","The assistant":"Ассистент","may read this and answer about it":"видит этот проект и отвечает о нём","may read its tasks":"видит его задачи",Share:"Поделиться","Link copied":"Ссылка скопирована","Copy the link":"Скопируйте ссылку","Delete {n} tasks?":"Удалить задачи ({n})?",Select:"Выбрать",Hide:"Свернуть","sees the project":"видит проект","sees the tasks":"видит задачи","Whether the assistant is shown this project at all":"Показывать ли ассистенту этот проект","Whether the assistant is shown its tasks":"Показывать ли ассистенту его задачи","Any state":"Любое состояние","Any project":"Любой проект","Outside any project":"Вне проектов","Outside any tool":"Вне инструментов","Any zone":"Любая зона","No zone":"Без зоны","Any group":"Любая группа","Outside a group":"Без группы","Zone of responsibility":"Зона ответственности","Task group":"Группа задач","New group":"Новая группа","New group…":"Новая группа…","Delete the group":"Удалить группу","Delete the group “{name}”?":"Удалить группу «{name}»?","Delete the group “{name}”? {n} tasks will stay, but outside it.":"Удалить группу «{name}»? Задачи останутся ({n}), но окажутся без группы.","New tag…":"Новый тег…","New tag":"Новый тег","Previous month":"Предыдущий месяц","Next month":"Следующий месяц","not set":"не задана","Tag name":"Название тега","Group name":"Название группы","Add a tag":"Добавить тег","Back to {where}":"Назад в «{where}»",Back:"Назад",Groups:"Группы",Closed:"Выполненные",Expanded:"Раскрыть всё","Any tag":"Любой тег","Show only this tag":"Показать только этот тег",Checklist:"Чек-лист","+ Checklist item":"+ Пункт",Files:"Файлы","+ Attach file":"+ Прикрепить файл","Linked tasks":"Связанные задачи","+ Link a task":"+ Связать задачу",Related:"Связана",Blocks:"Блокирует","Blocked by":"Заблокирована","Click to edit":"Нажми, чтобы редактировать",Bold:"Жирный",Italic:"Курсив",Strikethrough:"Зачёркнутый",Heading:"Заголовок","Bulleted list":"Список","Numbered list":"Нумерованный список",Quote:"Цитата",Table:"Таблица","Picture or file":"Картинка или файл",text:"текст","marked it done":"отметил выполнение","skipped it":"пропустил этот раз",Download:"Скачать",File:"Файл","files of this kind can't be attached":"файлы такого типа прикреплять нельзя","Corporate email":"Корпоративная почта","no card with this address":"нет карточки с такой почтой","sign in as":"войти как","See Orgamini exactly as {email} does, with their role and access. A bar at the bottom brings you back.":"Увидеть Orgamini так, как видит {email}: с его ролью и доступами. Вернуться — кнопкой на плашке внизу.","You are signed in as {who}":"Вы вошли как {who}","Back to my account":"Вернуться к себе","access from the admin panel":"доступ из админ-панели","sees everything":"видит всё","sees own work and department":"видит своё и свой отдел",Access:"Доступ","no keys from the panel yet":"панель ещё не выдавала ключей","no access":"нет доступа","{n} keys":"ключей: {n}","No access":"Нет доступа","Only your own department":"Только в пределах своего отдела","The admin panel gives you no access to Orgamini":"В админ-панели у вас нет доступа к Orgamini","Who can sign in and what they may do is decided in the admin panel, key by key: the keys are listed in docs/07-доступы.md. Without “scope.all” a person sees only their own work and their department. Keys are read again at every sign-in and every ten minutes.":"Кто входит и что может — решает админ-панель, по ключам; список ключей — в docs/07-доступы.md. Без «scope.all» человек видит только своё и свой отдел. Ключи перечитываются при каждом входе и раз в десять минут.","keys asked of the panel: {n} of {m}":"ключи от панели: {n} из {m}","“Sees money” is set here, not in the panel: salaries, shares, payroll and the what-if marks (possible dism
15issal, under review) are hidden by the server for everyone it is off for, and it is off until turned on.":"«Видит деньги» включается здесь, а не в панели: зарплаты, доли, фонд оплаты и отметки «что если» (возможное увольнение, под вопросом) сервер скрывает от всех, у кого галочка снята, — а снята она, пока её не поставят.","“Sees what-if marks” is set here, not in the panel: the marks “possible dismissal” and “under review” are hidden by the server for everyone it is off for, and it is off until turned on. This instance keeps no salaries at all.":"«Видит отметки „что если“» включается здесь, а не в панели: отметки «возможное увольнение» и «под вопросом» сервер скрывает от всех, у кого галочка снята, — а снята она, пока её не поставят. Зарплат на этом сервере нет вовсе.","Sees what-if marks":"Видит отметки «что если»","You can't mark people for dismissal or review":"Вы не можете ставить отметки об увольнении и «под вопросом»","An account for every working person whose card has a corporate email, before they sign in, with the keys the admin panel gives them. Existing accounts stay as they are.":"Учётка каждому работающему сотруднику, у кого в карточке есть корпоративная почта, — ещё до первого входа, с ключами, которые выдаёт админ-панель. Существующие не меняются.","See Orgamini exactly as {email} does, with their access. A bar at the bottom brings you back.":"Увидеть Orgamini так, как видит {email}, с его доступом. Вернуться — кнопкой на плашке внизу.","Sync with the team":"Синхронизировать с командой","Accounts added: {n}":"Добавлено учёток: {n}","tied to their card: {n}":"привязано к карточкам: {n}","people without a corporate email: {n}":"без корпоративной почты: {n}","An account for every working person whose card has a corporate email, before they sign in. New accounts are viewers; existing ones stay as they are.":"Учётка каждому работающему сотруднику, у кого в карточке есть корпоративная почта, — ещё до первого входа. Новые получают роль «Наблюдатель»; существующие не меняются.","return to your own account first":"сначала вернитесь в свою учётку","you are already yourself":"это и так вы","you are not signed in as someone else":"вы и так в своей учётке","Whoever signs in with this address is this person: their photo and name appear in task chats":"Кто зайдёт с этой почты — тот и есть этот человек: его фото и имя появятся в чатах задач","someone else already has that email":"эта почта уже указана у другого человека","that does not look like an email address":"это не похоже на адрес почты","Whose account is whose is decided by the corporate email on the person's card: fill it in on the team screen and the photo and the name follow by themselves.":"Кто есть кто — определяется корпоративной почтой в карточке сотрудника: впишите её в команде, и фото с именем подтянутся сами.",Where:"Где","No grouping":"Без группировки",Expand:"Развернуть","Has a description":"Есть описание",Discussion:"Обсуждение","Nothing said yet.":"Пока ничего не написано.","Write something about this task…":"Напиши что-нибудь по задаче…","Change the message…":"Изменить сообщение…","Delete this message?":"Удалить сообщение?",edited:"изменено","Back to the tasks":"Назад к задачам","Back to the recurring ones":"Назад к регулярным","What has to be done, in detail…":"Что нужно сделать, подробно…","Next time":"Следующий раз",History:"История","It has not come round yet.":"Ещё ни разу не наступала.","take back":"снять","Skip this time":"Пропустить этот раз","How often":"Как часто","How many":"Сколько",every:"каждые",day:"день",week:"неделю",month:"месяц",year:"год","on the":"числа","last day":"последний день",Repeat:"Повторять","once every":"раз в","On days":"По дням","On the day":"В день","Mon–Fri":"пн–пт","Starting from":"Начиная с",skip:"пропустить","Skipped this time":"Пропущено в этот раз","Taken back":"Отметка снята","Not this time — and it moves on":"Не в этот раз — задача перейдёт к следующему сроку","times in a row":"раз подряд","click to take it back":"нажми, чтобы снять отметку","What has to be done again and again…":"Что надо делать снова и снова…","show all ({n})":"показать все ({n})","The task":"Задача","Kind of task":"Вид задачи","One-off":"Разовая","A task for this department…":"Задача для этого отдела…","What has to be done…":"Что надо сделать…","No department":"Без отдела","No project":"Без проекта","Search the tasks…":"Поиск по задачам…","show what is done":"показывать выполненные","nothing overdue":"просрочек нет","answers for this department's tasks":"отвечает за задачи этого отдела","Every day":"Каждый день","Every week":"Каждую неделю","Every month":"Каждый месяц","change the day":"сменить день","Day of the month":"Число месяца","was due {date}":"нужно было {date}","next time {date}":"следующий раз {date}","last done {date}":"последний раз {date}","Done for this time round":"Сделано на этот раз","Delete the task “{name}”?":"Удалить задачу «{name}»?",Planning:"Цели",goal:"цель",goals:"целей","{n} need attention":"требуют внимания: {n}","{n} outside the goals":"вне целей: {n}","+ Goal":"+ Цель","The goal":"Цель","What it means, in a sentence…":"Что это значит, одной фразой…","The whole group":"Вся группа","nobody answers for it":"никто не отвечает","+ What works on it":"+ Что на неё работает","+ more":"+ ещё","How it is going":"Как идёт","What is happening…":"Что происходит…","as of {date}":"на {date}","To plan":"По плану","At risk":"Под риском","Not moving":"Не движется",Achieved:"Достигнута",Cancelled:"Отменена","Which goals":"Какие цели",Running:"Активные",Finished:"Закрытые","everything is accounted for":"всё распределено","What has to be true by the end of the peri
15od…":"Что должно стать правдой к концу периода…","No goals yet. Five to ten at a time is plenty — they are what everything else is measured against.":"Целей пока нет. Пяти-десяти одновременно достаточно — именно с ними потом сверяется всё остальное.","Nothing here. Look at “All”.":"Здесь пусто. Посмотри во «Всех».","This month":"Этот месяц","This quarter":"Этот квартал","Next quarter":"Следующий квартал","Half a year":"Полгода","This year":"Этот год",From:"С",To:"По","Runs whatever the goals are: upkeep, production, support.":"Идёт независимо от целей: поддержание, производство, поддержка.","This period it is goal work":"В этом периоде это работа на цель","Working outside the goals":"Работает мимо целей","Not wrong in itself — but each of these should be a decision, not an oversight.":"Само по себе не плохо — но каждый такой пункт должен быть решением, а не недосмотром.","Goals nothing is working on":"Цели, над которыми никто не работает","Usually means nobody has started — or that the work is there but not tied to the goal.":"Обычно значит, что к цели не приступали — или что работа есть, но не привязана к цели.","Delete the goal “{name}”?":"Удалить цель «{name}»?","What has to happen":"Что должно случиться","{done} of {all}":"{done} из {all}","+ Step":"+ Шаг","+ What has to happen for this to be true":"+ Что должно случиться, чтобы это стало правдой","Works on it":"Работает","+ Existing work":"+ Существующая работа","+ New project for it":"+ Новый проект под неё","Name of the project…":"Название проекта…","Unaccounted for":"Не распределено","Serves no goal and is not marked as routine. Tie it to a goal, call it routine, or close it.":"Не работает ни на одну цель и не помечено как текущая работа. Привяжи к цели, признай текущей работой или закрывай.","Nothing — every piece of work is either on a goal or marked routine.":"Пусто — вся работа либо на цели, либо помечена как текущая.",Routine:"Текущая работа",routine:"текущая","Runs whatever this quarter's goals are: upkeep, production, support.":"Идёт независимо от целей квартала: поддержание, производство, поддержка.","Work that runs whatever the goals are":"Работа, которая идёт независимо от целей","This quarter it is goal work":"В этом квартале это работа на цель","{n} unaccounted for":"не распределено: {n}","More than ten goals is a to-do list — nobody checks against it":"Больше десяти целей — это список дел, с ним никто не сверяется","Everyone who sits in this department":"Все, кто в этом отделе","Show only those on a project":"Показать только тех, кто в проектах","Show only those with a standing duty":"Показать только тех, у кого есть постоянные обязанности","Show only those with nothing on them":"Показать только тех, на ком ничего не числится","Showing {n} of {all} — the department and its units.":"Показаны {n} из {all} — отдел вместе с подразделениями.","show everyone":"показать всех","Nobody here matches that.":"Здесь таких нет.","{n} highlighted here · {k} more sit in the units":"Подсвечены {n} здесь · ещё {k} в подразделениях","{n} of {all} highlighted":"Подсвечены {n} из {all}","see the list":"смотреть списком","Find a project":"Найти проект","Find a tool":"Найти инструмент","Nothing matches":"Ничего не найдено","How the map works":"Как работает карта","How projects work":"Как работают проекты","How tools work":"Как работают инструменты","How departments work":"Как работают отделы","How planning works":"Как работают цели","The team and a person's card":"Команда и карточка человека",Direction:"Направление",Directions:"Направления",Module:"Модуль",Modules:"Модули",direction:"направление",directions:"направления",module:"модуль",modules:"модули","+ Direction":"+ Направление","+ Module":"+ Модуль","Direction name":"НаÐ
15·Ð²Ð°Ð½Ð¸Ðµ направления","Module name":"Название модуля","Direction of":"Направление проекта","Module of":"Модуль инструмента","Part of the tool":"Часть инструмента","It has parts of its own":"У него есть свои части","Its {n} parts go with it: {names}.":"Вместе с ним удалятся его части ({n}): {names}.","a project cannot be part of itself":"проект не может быть частью самого себя","a tool cannot be part of itself":"инструмент не может быть частью самого себя","a direction cannot hold another direction — only one level":"направление не может содержать другое направление — только один уровень","a module cannot hold another module — only one level":"модуль не может содержать другой модуль — только один уровень","this project has parts of its own, so it cannot become a direction":"у этого проекта есть свои направления, поэтому он не может стать направлением","this tool has parts of its own, so it cannot become a module":"у этого инструмента есть свои модули, поэтому он не может стать модулем",Trash:"Корзина",Restore:"Восстановить",Restored:"Восстановлено","Nothing deleted lately.":"В последнее время ничего не удалялось.","Deleted — Settings → Trash brings it back":"Удалено — вернуть можно в Настройки → Корзина","Whatever a delete took away — people, photos, project and task memberships — kept whole for 30 days. Restore puts it back under the same ids.":"Всё, что унесло удаление — люди, фото, участие в проектах и задачах, — хранится целиком 30 дней. «Восстановить» возвращает это под теми же id.",company:"компания",person:"человек",department:"отдел","{n} departments":"отделов: {n}","{n} sub-companies":"дочерних компаний: {n}","Their company is gone — restore the company first":"Компании больше нет — сначала восстанови компанию","Its company is gone — restore the company first":"Компании больше нет — сначала восстанови компанию",Backups:"Бэкапы","Back up now":"Сделать бэкап","Saving…":"Сохраняю…","No backups yet.":"Бэкапов пока нет.","Latest: {when} · {kb} KB · {n} kept":"Последний: {when} · {kb} КБ · хранится {n}","pg_dump into the backups/ folder of the project: on start, 5 minutes after the last edit, and daily. All of today, then one per day for a month, then one per month.":"pg_dump в папку backups/ проекта: при запуске, через 5 минут после последней правки и раз в сутки. Хранятся все за сегодня, затем по одному в день за месяц, дальше по одному в месяц.","Restore: npm run db:restore -- backups/<file>":"Восстановить: npm run db:restore -- backups/<файл>","UAH per 1 USD. Example: ₴18,000 → {usd}":"Гривен за 1 доллар. Пример: ₴18,000 → {usd}","Example: €1,153 → {usd}":"Пример: €1,153 → {usd}","{c} companies · {d} departments · {p} people. Everything is stored in PostgreSQL on this machine; Ctrl+Z undoes the last 50 changes.":"{c} компаний · {d} отделов · {p} человек. Всё хранится в PostgreSQL на этой машине; Ctrl+Z отменяет последние 50 изменений.","Keyboard: Ctrl+K search · Ctrl+Z / Ctrl+Shift+Z undo / redo · F5 refresh data · Esc close panels · right-drag selects, left-drag pans.":"Клавиши: Ctrl+K поиск · Ctrl+Z / Ctrl+Shift+Z отмена / возврат · F5 обновить данные · Esc закрыть панели · правая кнопка — выделение, левая — перемещение холста.","Job titles":"Должности",companies:"компаний",people:"людей","Search {what}…":"Поиск: {what}…","New value":"Новое значение",Used:"Исп.","Rename (updates every card that uses it)":"Переименовать (обновит все карточки, где используется)","N
15ot used":"Не используется","Used by {n} {what}":"Используется: {n} {what}","Nothing matches.":"Ничего не найдено.","No {what} yet.":"Пока нет: {what}.","Click a name to rename it everywhere. New values typed on a card are added here automatically.":"Клик по названию — переименовать везде. Новые значения с карточек попадают сюда автоматически.",'"{target}" already exists. Merge "{from}" into it?':"«{target}» уже есть. Объединить «{from}» с ним?",'"{value}" is used by {n} {what}. Remove it from them as well?':"«{value}» используется: {n} {what}. Убрать и у них?","Confidential mode is on — amounts are hidden, counts and shares are shown.":"Включён конфиденциальный режим — суммы скрыты, показаны количества и доли.","{n} on payroll · {s} with profit share":"{n} на зарплате · {s} с долей","Payroll / month":"ФОТ / месяц","{y} / year":"{y} / год","Average salary":"Средняя зарплата","median {m}":"медиана {m}","{a} for dismissal · {b} under review":"не в расчёте: {a} · под вопросом: {b}","saves {m}/mo":"экономия {m}/мес","Data gaps":"Пробелы в данных","{n} without pay":"{n} без зарплаты","{a} without manager · {b} departments without head":"{a} без руководителя · отделов без руководителя: {b}","Payroll by company":"ФОТ по компаниям","Own people only; the right column adds the companies below. Bars: monthly payroll.":"Только свои люди; в подписи — с дочерними. Бары: ФОТ в месяц.","with subsidiaries {p}, {m}/mo":"с дочерними {p}, {m}/мес","Payroll by department":"ФОТ по отделам","Units are listed as “Department › Unit”; a department's bar includes its units. {n} people hang directly from a company card ({m}/mo).":"Подразделения записаны как «Отдел › Подразделение»; бар отдела включает подразделения. Прямо на карточках компаний: {n} чел. ({m}/мес).","no head":"без руководителя","By currency":"По валютам","FX exposure: salaries set in UAH and EUR move with the rate (now {u} UAH/USD, {e} USD/EUR).":"Валютный риск: зарплаты в UAH и EUR зависят от курса (сейчас {u} UAH/USD, {e} USD/EUR).","Salary bands":"Зарплатные диапазоны","How many people earn how much (USD equivalent, per month).":"Сколько людей сколько получает (в USD, в месяц).","Widest spans of control":"Больше всего прямых подчинённых","Direct reports per manager. Above ~8 is worth a look.":"Прямых подчинённых у руководителя. Больше ~8 стоит посмотреть.","{n} reports":"подчинённых: {n}","Most common titles":"Самые частые должности","Top salaries":"Топ зарплат","All companies":"Все компании","Include people marked for dismissal":"Учитывать исключённых из расчёта","Click a bar to see the people behind it; click a person to find them on the map.":"Клик по бару — список людей за ним; клик по человеку — найти на карте.",Sort:"Сортировка","by payroll":"по ФОТ","by people":"по людям","by average":"по средней",avg:"в среднем","No department (executives)":"Без отдела (штаб)","What if the rate were {r} UAH/USD?":"А если курс будет {r} UAH/USD?","UAH salaries would cost {a}/mo instead of {b} ({d}); total payroll {tot}/mo.":"Гривневые зарплаты будут стоить {a}/мес вместо {b} ({d}); общий ФОТ {tot}/мес.",reset:"сбросить","{a} people report to nobody":"Никому не подчиняются: {a}","{b} report across companies":"через компании: {b}","{c} across departments":"через отделы: {c}","Report to nobody":"Никому не подчиняются","Report across companies":"Подчиняются через компании","Report across departments":"Подчиняются через отделы"},mw={person:["человек","человека","человек"],company:["компания","компании","компаний"],report:["подчинённый","подчинённых","подчинённых"],card:["карточка","карточки","карточек"],stream:["направление","направления","направлений"],question:["вопрос","вопроса","вопросов"],area:["область","области","областей"]};function x3(e,a){const l=e%10,i=e%100;return l===1&&i!==11?a[0]:l>=2&&l<=4&&(i<12||i>14)?a[1]:a[2]}function M1(e){const a=(i,r)=>r?i.replace(/\{(\w+)\}/g,(u,d)=>d in r?String(r[d]):u):i,l=((i,r)=>a(e==="ru"?y3[i]??i:i,r));return l.lang=e,l.n=(i,r,u)=>e==="ru"&&mw[r]?`${i} ${x3(i,mw[r])}`:`${i} ${i===1?r:u}`,l}const Lp=N.createContext(M1("en")),qe=()=>N.useContext(Lp);function bn({value:e,onCommit:a,placeholder:l,className:i="",multiline:r,numeric:u,dis
15play:d,autoEdit:h}){const[g,p]=N.useState(!!h),x=qe(),[m,v]=N.useState(e),k=N.useRef(null);N.useEffect(()=>{g&&(k.current?.focus(),k.current?.select())},[g]);function T(){p(!1),m.trim()!==e&&a(m.trim())}function S(C){C.stopPropagation(),C.key==="Enter"&&!(r&&C.shiftKey)?(C.preventDefault(),T()):C.key==="Escape"&&p(!1)}if(g){const C={ref:k,value:m,className:`inline-edit nodrag nowheel ${i}`,onChange:z=>v(z.target.value),onBlur:T,onKeyDown:S,onPointerDown:z=>z.stopPropagation()};return r?s.jsx("textarea",{...C,rows:2}):s.jsx("input",{...C,type:u?"number":"text"})}return s.jsx("span",{className:`inline ${i} ${e?"":"placeholder"}`,title:x("Double-click to edit"),onDoubleClick:C=>{C.stopPropagation(),v(e),p(!0)},children:e?d??e:l})}function v3(e){return e.trim().split(/\s+/).filter(Boolean).slice(0,2).map(l=>[...l][0].toUpperCase()).join("")||"?"}function Xe({person:e,size:a,className:l="",title:i,onClick:r}){const u=Se.photoUrl(e),d={width:a,height:a,fontSize:Math.round(a*.38)};u||(l=`${l} no-photo`.trim(),i=i??"Нет фотографии");const h=u?s.jsx("img",{src:u,alt:"",width:a,height:a,draggable:!1}):s.jsx("span",{"aria-hidden":"true",children:v3(e.fullName)});return r?s.jsx("button",{type:"button",className:`avatar ${l}`,style:d,title:i,onClick:r,children:h}):s.jsx("span",{className:`avatar ${l}`,style:d,title:i,children:h})}const xc=["top","right","bottom","left"],pw={top:Ye.Top,right:Ye.Right,bottom:Ye.Bottom,left:Ye.Left},xd=e=>`in-${e}`,vd=e=>`out-${e}`;function gw(e){const a=e?.replace(/^(in|out)-/,"");return xc.includes(a)?a:null}function D1(e,a){return e!=="company"&&a==="right"?{from:"right",to:"left"}:{from:"bottom",to:"top"}}function bd(e,a,l){const i=D1(a,l);return{from:e.from??i.from,to:e.to??i.to}}function kg(){return s.jsxs(s.Fragment,{children:[xc.map(e=>s.jsx(hs,{type:"target",id:xd(e),position:pw[e],className:`h-${e}`},`in-${e}`)),xc.map(e=>s.jsx(hs,{type:"source",id:vd(e),position:pw[e],className:`h-${e}`},`out-${e}`))]})}function b3({id:e,data:a,selected:l}){const i=N.useContext(Mc),r=qe(),u=r.lang==="ru"?"мес":"mo",d=a.color??a.companyColor,h=d?{"--card-color":d}:void 0,g=[];a.peopleCount>0&&g.push(r.n(a.peopleCount,"person","people")),a.payrollUsd>0&&!i.confidential&&g.push(a.cutCount?`${yt(a.payrollUsd)} → ${yt(a.payrollAfterUsd)}/${u}`:`${yt(a.payrollUsd)}/${u}`);const p=a.collapsed?r("Show {n} people",{n:a.peopleCount}):r("Hide people");return s.jsxs(s.Fragment,{children:[s.jsxs(nh,{isVisible:l&&!i.multiSelect,position:Ye.Top,className:"toolbar",offset:6,children:[s.jsxs("div",{className:"toolbar-swatches",role:"radiogroup","aria-label":r("Department color"),children:[s.jsx("button",{type:"button",role:"radio","aria-checked":a.color===null,className:`dot none ${a.color===null?"on":""}`,title:r("Company color"),onClick:()=>i.patchDepartment(e,{color:null})}),Rs.map(x=>s.jsx("button",{type:"button",role:"radio","aria-checked":a.color===x.value,className:`dot ${a.color===x.value?"on":""}`,style:{background:x.value},title:x.name,onClick:()=>i.patchDepartment(e,{color:x.value})},x.value))]}),s.jsx("span",{className:"toolbar-sep"}),s.jsx("button",{type:"button",className:"tb",onClick:()=>i.addPerson(a.companyId,null,e),children:r("+ Person")}),s.jsx("button",{type:"button",className:"tb",onClick:()=>i.addDepartment(a.companyId,"New unit",e),children:r("+ Unit")}),s.jsx("button",{type:"button",className:"tb danger",onClick:()=>i.deleteDepartment(e),children:r("Delete")})]}),s.jsxs("div",{className:`dept-node ${l?"selected":""}`,style:h,children:[s.jsx(kg,{}),s.jsxs("div",{className:"dept-main",children:[s.jsx("span",{className:"dept-kind",children:a.parentId?r("Unit"):r("Department")}),s.jsx(bn,{className:"dept-name",value:a.name,placeholder:r("Department"),onCommit:x=>x&&i.patchDepartment(e,{name:x})}),g.length>0&&s.jsx("span",{className:"dept-meta",children:g.join(" · ")}),!a.head&&a.managedBy&&s.jsxs("span",{className:"dept-managed",title:r("Managed by {name}",{name:a.managedBy.person.fullName})+(a.managedBy.where?` (${a.managedBy.where})`:""),children:["↑ ",a.managedBy.person.fullName,a.managedBy.where?s.jsxs("span",{className:"dept-managed-where",children:[" · ",a.managedBy.where]}):null]})]}),a.head?s.jsx("div",{className:"dept-head",title:r("Head: {name}",{name:a.head.fullName})+(a.head.title?` · ${a.head.title}`:""),children:s.jsx(Xe,{person:a.head,size:26})}):a.managedBy?s.jsx("div",{className:"dept-head managed",title:r("Managed by {name}",{name:a.managedBy.person.fullName})+(a.managedBy.where?` (${a.managedBy.where})`:""),children:s.jsx(Xe,{person:a.managedBy.person,size:26})}):null,a.peopleCount>0&&s.jsx("button",{type:"button",className:`fold tree nodrag ${a.collapsed?"closed":""}`,title:p,"aria-label":p,"aria-expanded":!a.collapsed,onClick:x=>{x.stopPropagation(),i.toggleCollapsed(e)},children:a.collapsed?a.peopleCount:"−"})]})]})}const w3=8;
15function Sg({value:e,onChange:a,suggestions:l,onPick:i,onKeyDown:r,onFocus:u,onBlur:d,className:h="",ref:g,...p}){const[x,m]=N.useState(!1),[v,k]=N.useState(-1),T=N.useRef(null),S=e.trim().toLowerCase(),C=l.filter(O=>O.toLowerCase()!==S&&(!S||O.toLowerCase().includes(S))).sort((O,w)=>+!O.toLowerCase().startsWith(S)-+!w.toLowerCase().startsWith(S)||O.localeCompare(w)).slice(0,w3),z=x&&C.length>0;N.useEffect(()=>{v>=C.length&&k(C.length-1)},[C.length,v]),N.useEffect(()=>{T.current?.querySelector(".on")?.scrollIntoView({block:"nearest"})},[v]);function E(O){m(!1),k(-1),a(O),i?.(O)}function j(O){if(z&&(O.key==="ArrowDown"||O.key==="ArrowUp")){O.preventDefault(),O.stopPropagation();const w=O.key==="ArrowDown"?1:-1;k(b=>(b+w+C.length)%C.length);return}if(z&&O.key==="Enter"&&v>=0){O.preventDefault(),O.stopPropagation(),E(C[v]);return}if(z&&O.key==="Escape"){O.stopPropagation(),m(!1);return}r?.(O)}return s.jsxs("span",{className:"suggest nodrag nowheel",children:[s.jsx("input",{...p,ref:g,className:h,value:e,autoComplete:"off",onChange:O=>{a(O.target.value),m(!0),k(-1)},onFocus:O=>{m(!0),u?.(O)},onBlur:O=>{m(!1),d?.(O)},onKeyDown:j,role:"combobox","aria-expanded":z,"aria-autocomplete":"list"}),z&&s.jsx("ul",{className:"suggest-list nodrag nowheel",ref:T,role:"listbox",children:C.map((O,w)=>{const b=S?O.toLowerCase().indexOf(S):-1;return s.jsx("li",{role:"option","aria-selected":w===v,className:w===v?"on":"",onMouseDown:A=>A.preventDefault(),onMouseEnter:()=>k(w),onClick:()=>E(O),children:b<0?O:s.jsxs(s.Fragment,{children:[O.slice(0,b),s.jsx("b",{children:O.slice(b,b+S.length)}),O.slice(b+S.length)]})},O)})})]})}function Cg({tags:e,onChange:a,suggestions:l=[]}){const[i,r]=N.useState(-1),[u,d]=N.useState(""),h=N.useRef(null),g=qe();N.useEffect(()=>{i>=0&&(h.current?.focus(),h.current?.select())},[i]);function p(v=u){const k=v.trim(),T=i;if(r(-1),d(""),T<0)return;if(T>=e.length){k&&!e.includes(k)&&a([...e,k]);return}if(k===e[T])return;const S=e.filter((C,z)=>z!==T);k&&!S.includes(k)&&S.splice(T,0,k),a(S)}function x(v){v.stopPropagation(),v.key==="Enter"&&p(),v.key==="Escape"&&(r(-1),d(""))}const m=s.jsx(Sg,{ref:h,className:"tag-input nodrag nowheel",value:u,placeholder:g("tag"),suggestions:l.filter(v=>!e.includes(v)),onChange:d,onPick:v=>p(v),onBlur:()=>p(),onPointerDown:v=>v.stopPropagation(),onKeyDown:x});return s.jsxs("div",{className:"tags",children:[e.map((v,k)=>i===k?s.jsx("span",{children:m},v):s.jsxs("span",{className:`tag hue-${Yl(v)}`,title:g("Double-click to rename"),onDoubleClick:T=>{T.stopPropagation(),d(v),r(k)},children:[v,s.jsx("button",{type:"button",className:"tag-x nodrag","aria-label":g("Remove tag {t}",{t:v}),onClick:T=>{T.stopPropagation(),a(e.filter(S=>S!==v))},children:"×"})]},v)),i===e.length?m:s.jsx("button",{type:"button",className:"tag add nodrag",onClick:v=>{v.stopPropagation(),d(""),r(e.length)},children:g("+ tag")})]})}function j3({id:e,data:a,selected:l}){const i=N.useContext(Mc),r=qe(),u=r.lang==="ru"?"мес":"mo",d=a.kind==="holding",h=a.color?{"--card-color":a.color}:void 0,g=[];a.childCount>0&&g.push(r.n(a.childCount,"company","companies")),a.payrollUsd>0&&!i.confidential&&g.push(a.cutCount?`${yt(a.payrollUsd)} → ${yt(a.payrollAfterUsd)}/${u}`:`${yt(a.payrollUsd)}/${u}`);const p=r.n(a.peopleCount,"person","people"),x=a.treeCollapsed?a.descendantCount===1?r("Show 1 company below"):r("Show {n} companies below",{n:a.descendantCount}):r("Hide the companies below"),m=a.collapsed?r("Show {label}",{label:p}):r("Hide people and departments");return s.jsxs(s.Fragment,{children:[s.jsxs(nh,{isVisible:l&&!i.multiSelect,position:Ye.Top,className:"toolbar",offset:8,children:[s.jsxs("div",{className:"toolbar-swatches",role:"radiogroup","aria-label":r("Card color"),children:[s.jsx("button",{type:"button",role:"radio","aria-checked":a.color===null,className:`dot none ${a.color===null?"on":""}`,title:r("Default color"),onClick:()=>i.patchCompany(e,{color:null})}),Rs.map(v=>s.jsx("button",{type:"button",role:"radio","aria-checked":a.color===v.value,className:`dot ${a.color===v.value?"on":""}`,style:{background:v.value},title:v.name,onClick:()=>i.patchCompany(e,{color:v.value})},v.value))]}),s.jsx("span",{className:"toolbar-sep"}),s.jsx("button",{type:"button",className:"tb",onClick:()=>i.addPerson(e),children:r("+ Person")}),s.jsx("button",{type:"button",className:"tb",onClick:()=>i.addDepartment(e),children:r("+ Department")}),s.jsx("button",{type:"button",className:"tb",onClick:()=>i.addChild(e),children:r("+ Sub-company")}),s.jsx("button",{type:"button",className:"tb danger",onClick:()=>i.deleteCompany(e),children:r("Delete")})]}),s.jsxs("div",{className:`card ${d?"holding":""} ${l?"selected":""}`,style:h,children:[s.jsx(kg,{}),s.jsxs("div",{className:"head",children:[s.jsx("span",{className:"kind",children:r(d?"Group":"Company")}),s.jsx(Cg,{tags:a.tags,suggestions:i.suggestions.tags,onChange:v=>i.patchCompany(e,{tags:v})})]}),s.jsx(bn,{className:"name",value:a.name,placeholder:r("Untitled"),onCommit:v=>i.patchCompany(e,{name:v})}),s.jsx(bn,{className:"focus",multiline:!0,value:a.focus,placeholder:r("What it does…"),onCommit:v=>i.patchCompany(e,{focus:v})}),a.peopleCount>0&&s.jsx("button",{type:"button",className:`fold people nodrag ${a.collapsed?"closed":""}`,title:m,"aria-label":m,"aria-expanded":!a.collapsed,onClick:v=>{v.stopPropagation(),i.toggleCollapsed(e)},children:a.collapsed?a.peopleCount:"−"}),a.childCount>0&&s.jsx("button",{type:"button",className:`fold tree nodrag ${a.treeCollapsed?"closed":""}`,title:x,"aria-label":x,"aria-expanded":!a.treeCollapsed,onClick:v=>{v.stopPropagation(),i.toggleTreeCollapsed(e)},children:a.treeCollapsed?a.descendantCount:"−"}),a.lead&&s.jsxs("div",{className:"lead",title:r("Run by {name}",{name:a.lead.fullName})+(a.lead.title?` · ${a.lead.title}`:""),children:[s.jsx(Xe,{person:a.lead,size:18}),s.jsxs("span",{className:"lead-name",children:[a.lead.fullName||r("Unnamed"),a.lead.title?s.jsxs("span",{className:"lead-title",children:[" · ",a.lead.title]}):null]})]}),(g.length>0||a.peopleCount>0)&&s.jsxs("div",{className:"meta",children:[a.peopleCount>0&&s.jsx("button",{type:"button",className:`fold-people nodrag ${a.collapsed?"closed":""}`,title:a.collapsed?r("Show people"):r("Hide people"),"aria-expanded":!a.collapsed,onClick:v=>{v.stopPropagation(),i.toggleCollapsed(e)},children:p}),g.length>0&&(a.peopleCount>0?" · ":"")+g.join(" · ")]})]})]})}function tp(e){return e.sharePctMin==null&&e.sharePctMax==null?"":e.sharePctMin!=null&&e.sharePctMax!=null&&e.sharePctMin!==e.sharePctMax?`${e.sharePctMin}–${e.sharePctMax}%`:`${e.sharePctMin??e.sharePctMax}%`}function N3({id:e,data:a,selected:l}){const i=N.useContext(Mc),r=qe(),u=i.dir==="down",d=a.color?{"--card-color":a.color}:void 0,h=a.collapsed?r("Show {n} reports",{n:a.reportCount}):r("Hide reports");return s.jsxs(s.Fragment,{children:[s.jsxs(nh,{isVisible:l&&!i.multiSelect,position:Ye.Top,className:"toolbar",offset:6,children:[s.jsx("button",{type:"button",className:"tb",onClick:()=>i.openCard(e),title:r("Everything this person is engaged in"),children:r("Card")}),s.jsx("button",{type:"button",className:"tb",onClick:()=>i.addPerson(a.companyId,e),children:r("+ Report")}),s.jsx("button",{type:"button",className:`tb ${a.underReview?"on":""}`,title:a.underReview?r("Decided: remove the question mark"):r("Under review: not sure yet whether this person is needed"),onClick:()=>i.patchPerson(e,{underReview:!a.underReview}),children:a.underReview?r("✓ Decided"):r("? Review")}),s.jsx("button",{type:"button",className:`tb ${a.plannedOut?"on":""}`,title:a.plannedOut?r("Keep this person (clear the mark)"):r("What-if: a possible dism
15issal — stays on the map, out of the totals"),onClick:()=>i.patchPerson(e,{plannedOut:!a.plannedOut}),children:a.plannedOut?r("✓ Keep"):r("✂ Dismiss?")}),s.jsx("button",{type:"button",className:"tb danger",onClick:()=>i.deletePerson(e),children:r("Delete")})]}),s.jsxs("div",{className:`person-node ${u?"down":"right"} ${l?"selected":""} ${a.plannedOut?"out":""} ${a.underReview?"review":""}`,style:d,children:[a.plannedOut?s.jsx("span",{className:"out-badge",title:r("A possible dismissal (what-if)"),children:r("dismissal")}):a.underReview?s.jsx("span",{className:"out-badge review",title:r("Under review: is this person needed?"),children:"?"}):null,s.jsx(kg,{}),s.jsx(Xe,{person:a,size:40,className:"nodrag",title:r("Click to change photo"),onClick:()=>i.pickPhoto(e)}),s.jsxs("div",{className:"pmain",children:[s.jsx(bn,{className:"pname",value:a.fullName,placeholder:r("Name"),onCommit:g=>i.patchPerson(e,{fullName:g})}),s.jsx(bn,{className:"ptitle",value:a.title,placeholder:r("Title"),display:a.title,onCommit:g=>i.patchPerson(e,{title:g})}),a.outside.length>0&&s.jsxs("span",{className:"pmanager",title:r("Reports to {names}",{names:a.outside.map(g=>`${g.name} (${g.where==="staff"?r("staff"):g.where})`).join(", ")}),children:["↑ ",a.outside.map(g=>g.name).join(", "),s.jsxs("span",{className:"pmanager-where",children:[" · ",a.outside[0].where==="staff"?r("staff"):a.outside[0].where]})]})]}),!i.confidential&&s.jsxs("div",{className:"pay-col",children:[(a.salary!=null||!tp(a))&&s.jsx(bn,{className:"pay",numeric:!0,value:a.salary==null?"":String(a.salary),display:ep(a,i.rate).main,placeholder:a.salaryCurrency==="UAH"?"₴":"$",onCommit:g=>i.patchPerson(e,{salary:g===""?null:Number(g)})}),ep(a,i.rate).sub&&s.jsx("span",{className:"pay-sub",children:ep(a,i.rate).sub}),tp(a)&&s.jsx("span",{className:"pay share",title:r("Profit share"),children:tp(a)})]}),a.reportCount>0&&s.jsx("button",{type:"button",className:`fold nodrag ${a.collapsed?"closed":""}`,title:h,"aria-label":h,"aria-expanded":!a.collapsed,onClick:g=>{g.stopPropagation(),i.toggleCollapsed(e)},children:a.collapsed?a.reportCount:"−"})]})]})}const Eg=28;function _1(e,a=8){let l=`M ${e[0].x} ${e[0].y}`;for(let d=1;d<e.length-1;d++){const h=e[d-1],g=e[d],p=e[d+1],x=Math.min(a,Math.hypot(g.x-h.x,g.y-h.y)/2,Math.hypot(p.x-g.x,p.y-g.y)/2),m=g.x-Math.sign(g.x-h.x)*x,v=g.y-Math.sign(g.y-h.y)*x,k=g.x+Math.sign(p.x-g.x)*x,T=g.y+Math.sign(p.y-g.y)*x;l+=` L ${m} ${v} Q ${g.x} ${g.y} ${k} ${T}`}const i=e[e.length-1];l+=` L ${i.x} ${i.y}`;let r=0,u={x:e[0].x,y:e[0].y};for(let d=1;d<e.length;d++){const h=Math.hypot(e[d].x-e[d-1].x,e[d].y-e[d-1].y);h>r&&(r=h,u={x:(e[d].x+e[d-1].x)/2,y:(e[d].y+e[d-1].y)/2})}return[l,u.x,u.y]}const k3=14;function S3(e){const a=e.targetPosition===Ye.Left?-1:1,l=e.targetX+a*k3,i=e.sourceY+16;return _1([{x:e.sourceX,y:e.sourceY},{x:e.sourceX,y:i},{x:l,y:i},{x:l,y:e.targetY},{x:e.targetX,y:e.targetY}])}function C3(e,a,l=0){const i=e.targetY-Eg,r=e.sourceY+l;return _1([{x:e.sourceX,y:e.sourceY},...l?[{x:e.sourceX,y:r}]:[],{x:a,y:r},{x:a,y:i},{x:e.targetX,y:i},{x:e.targetX,y:e.targetY}])}const E3=48;function T3(e,a=Eg){const{sourceX:l,sourceY:i,targetX:r,targetY:u,targetPosition:d}=e;switch(d){case Ye.Top:return u-i>a*2?{centerY:u-a}:{};case Ye.Bottom:return i-u>a*2?{centerY:u+a}:{};case Ye.Left:return r-l>a*2?{centerX:r-a}:{};case Ye.Right:return l-r>a*2?{centerX:r+a}:{}}}const M3=[{value:"step",label:"⌐",title:"Step"},{value:"curve",label:"∫",title:"Curve"},{value:"straight",label:"/",title:"Straight"}],D3=[{value:"solid",label:"━",title:"Solid"},{value:"dashed",label:"╍",title:"Dashed"},{value:"dotted",label:"┅",title:"Dotted"}],_3=[1,2,3,4],yw={top:"▲",right:"▶",bottom:"▼",left:"◀"};function O3(e,a,l=!1,i=!1){return{shape:e.shape??(i?"curve":"step"),dash:e.dash??(a==="person"?"dashed":"solid"),width:e.width??(a==="person"||a==="department"?1.5:l?2.5:2),color:e.color??null}}function A3({id:e,sourceX:a,sourceY:l,targetX:i,targetY:r,sourcePosition:u,targetPosition:d,data:h,selected:g}){const p=N.useContext(Mc),x=qe(),m=h,v=O3(m.link,m.kind,m.lead,m.cross),k=bd(m.link,m.kind,p.dir),T={sourceX:a,sourceY:l,targetX:i,targetY:r,sourcePosition:u,targetPosition:d},[S,C,z]=v.shape==="curve"?ig(T):v.shape==="straight"?rg(T):m.via?C3(T,m.via.x,m.via.drop):u===Ye.Bottom&&(d===Ye.Left||d===Ye.Right)&&r>l?S3(T):Ad({...T,borderRadius:8,...T3(T,m.lead?E3:Eg)}),E=v.width,j=v.dash==="dashed"?`${E*4} ${E*3}`:v.dash==="dotted"?`0 ${E*2.5}`:void 0,O=v.color??(g||m.hl||m.cross?"var(--accent)":m.lead?"var(--lead)":m.tint??"var(--line-strong)"),w=b=>p.patchLink(m.kind,m.ownerId,{...m.link,...b});return s.jsxs(s.Fragment,{children:[s.jsx(Cc,{id:e,path:S,interactionWidth:18,style:{stroke:O,strokeWidth:g?E+1:E,strokeDasharray:j,strokeLinecap:v.dash==="dotted"?"round":"butt",opacity:g||m.hl||v.color||m.lead?1:m.tint?.8:.85}}),g&&s.jsx(tO,{children:s.jsxs("div",{className:"edge-tools nodrag nopan",style:{transform:`translate(-50%, -50%) translate(${C}px, ${z}px)`},onPointerDown:b=>b.stopPropagation(),children:[s.jsxs("div",{className:"edge-row",children:[s.jsx("div",{className:"edge-group",role:"radiogroup","aria-label":x("Line shape"),children:M3.map(b=>s.jsx("button",{type:"button",role:"radio","aria-checked":v.shape===b.value,className:`tb ${v.shape===b.value?"on":""}
15`,title:x(b.title),onClick:()=>w({shape:b.value}),children:b.label},b.value))}),s.jsx("span",{className:"toolbar-sep"}),s.jsx("div",{className:"edge-group",role:"radiogroup","aria-label":x("Line dash"),children:D3.map(b=>s.jsx("button",{type:"button",role:"radio","aria-checked":v.dash===b.value,className:`tb ${v.dash===b.value?"on":""}`,title:x(b.title),onClick:()=>w({dash:b.value}),children:b.label},b.value))}),s.jsx("span",{className:"toolbar-sep"}),s.jsx("div",{className:"edge-group",role:"radiogroup","aria-label":x("Line width"),children:_3.map(b=>s.jsx("button",{type:"button",role:"radio","aria-checked":v.width===b,className:`tb ${v.width===b?"on":""}`,title:x("Width {n}",{n:b}),onClick:()=>w({width:b}),children:s.jsx("span",{className:"width-sample",style:{height:b}})},b))})]}),s.jsxs("div",{className:"edge-row",children:[s.jsxs("div",{className:"edge-group",role:"radiogroup","aria-label":x("Leaves the parent from"),title:x("Side of the parent the line leaves from"),children:[s.jsx("span",{className:"edge-label",children:x("out")}),xc.map(b=>s.jsx("button",{type:"button",role:"radio","aria-checked":k.from===b,className:`tb ${k.from===b?"on":""}`,title:x("Leaves from the {s}",{s:x(b)}),onClick:()=>w({from:b}),children:yw[b]},b))]}),s.jsx("span",{className:"toolbar-sep"}),s.jsxs("div",{className:"edge-group",role:"radiogroup","aria-label":x("Enters this node on"),title:x("Side of this node the line enters on"),children:[s.jsx("span",{className:"edge-label",children:x("in")}),xc.map(b=>s.jsx("button",{type:"button",role:"radio","aria-checked":k.to===b,className:`tb ${k.to===b?"on":""}`,title:x("Enters on the {s}",{s:x(b)}),onClick:()=>w({to:b}),children:yw[b]},b))]}),s.jsx("span",{className:"toolbar-sep"}),s.jsxs("div",{className:"toolbar-swatches",role:"radiogroup","aria-label":x("Line color"),children:[s.jsx("button",{type:"button",role:"radio","aria-checked":v.color===null,className:`dot none ${v.color===null?"on":""}`,title:x("Default color"),onClick:()=>w({color:null})}),Rs.map(b=>s.jsx("button",{type:"button",role:"radio","aria-checked":v.color===b.value,className:`dot ${v.color===b.value?"on":""}`,style:{background:b.value},title:b.name,onClick:()=>w({color:b.value})},b.value))]})]})]})})]})}function O1({kind:e}){switch(e){case"dots":case"paper":return s.jsx(wo,{variant:Qn.Dots,gap:24,size:1});case"dots-large":return s.jsx(wo,{variant:Qn.Dots,gap:40,size:2});case"grid":return s.jsx(wo,{variant:Qn.Lines,gap:24});case"graph":return s.jsxs(s.Fragment,{children:[s.jsx(wo,{id:"fine",variant:Qn.Lines,gap:16,color:"var(--bg-fine)"}),s.jsx(wo,{id:"coarse",variant:Qn.Lines,gap:80,color:"var(--bg-coarse)"})]});case"blueprint":return s.jsx(wo,{variant:Qn.Lines,gap:24,color:"var(--bg-fine)"});case"cross":return s.jsx(wo,{variant:Qn.Cross,gap:24,size:4});default:return null}}const np=e=>e.toISOString().slice(0,10),xw=e=>new Date(`${e}T00:00:00Z`),I3=e=>e.getUTCDay()===0?7:e.getUTCDay();function z3(e,a){const l=new Date(Date.UTC(e,a,1)),i=new Date(l.getTime()-(I3(l)-1)*864e5);return Array.from({length:42},(r,u)=>new Date(i.getTime()+u*864e5))}function ka({value:e,onChange:a,placeholder:l,className:i="",title:r,late:u=!1,clearable:d=!0}){const h=qe(),[g,p]=N.useState(!1),[x,m]=N.useState(()=>e?xw(e):new Date),v=N.useRef(null),k=N.useRef(null),[T,S]=N.useState(null),C=h.lang==="ru"?"ru-RU":"en-GB";N.useEffect(()=>{g&&m(e?xw(e):new Date)},[g,e]),N.useLayoutEffect(()=>{if(!g)return S(null);const b=()=>{const A=v.current?.getBoundingClientRect();if(!A)return;const D=k.current?.offsetHeight??320,M=k.current?.offsetWidth??264,U=window.innerHeight-A.bottom-8<D&&A.top>D;S({top:U?Math.max(8,A.top-D-4):A.bottom+4,left:Math.min(Math.max(8,A.left),Math.max(8,window.innerWidth-M-8))})};return b(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),()=>{window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b)}},[g]),N.useEffect(()=>{if(!g)return;const b=D=>{const M=D.target;!v.current?.contains(M)&&!k.current?.contains(M)&&p(!1)},A=D=>{D.key==="Escape"&&(D.stopPropagation(),p(!1))};return document.addEventListener("mousedown",b),window.addEventListener("keydown",A,!0),()=>{document.removeEventListener("mousedown",b),window.removeEventListener("keydown",A,!0)}},[g]);const z=np(new Date),E=z3(x.getUTCFullYear(),x.getUTCMonth()),j=x.toLocaleDateString(C,{month:"long",year:"numeric",timeZone:"UTC"}),O=b=>
15m(new Date(Date.UTC(x.getUTCFullYear(),x.getUTCMonth()+b,1))),w=b=>{a(np(b)),p(!1)};return s.jsxs("span",{className:`datepick ${i}`,ref:v,children:[s.jsx("button",{type:"button",className:`due-chip ${u?"late":""} ${e?"":"empty"}`,title:r,"aria-haspopup":"dialog","aria-expanded":g,onClick:()=>p(b=>!b),children:e?e.split("-").reverse().join("."):l??h("no date")}),g&&Sc.createPortal(s.jsxs("div",{className:"cal",ref:k,role:"dialog","aria-label":h("Due"),style:T?{top:T.top,left:T.left}:{visibility:"hidden"},children:[s.jsxs("header",{className:"cal-head",children:[s.jsx("button",{type:"button",className:"cal-step",onClick:()=>O(-1),"aria-label":h("Previous month"),children:"‹"}),s.jsx("span",{className:"cal-month",children:j}),s.jsx("button",{type:"button",className:"cal-step",onClick:()=>O(1),"aria-label":h("Next month"),children:"›"})]}),s.jsxs("div",{className:"cal-grid",children:[[1,2,3,4,5,6,7].map(b=>s.jsx("span",{className:"cal-wd",children:new Date(Date.UTC(2024,0,b)).toLocaleDateString(C,{weekday:"short",timeZone:"UTC"})},b)),E.map(b=>{const A=np(b);return s.jsx("button",{type:"button",className:`cal-day ${b.getUTCMonth()===x.getUTCMonth()?"":"other"} ${A===z?"today":""} ${A===e?"on":""}`,onClick:()=>w(b),children:b.getUTCDate()},A)})]}),s.jsxs("footer",{className:"cal-foot",children:[s.jsx("button",{type:"button",className:"link",onClick:()=>w(new Date),children:h("Today")}),d&&e&&s.jsx("button",{type:"button",className:"link",onClick:()=>{a(null),p(!1)},children:h("Clear")})]})]}),document.body)]})}const ap=e=>e===""?null:Number(e);function R3({person:e,depth:a,rate:l,confidential:i,money:r,marks:u,managers:d,managerOptions:h,companyNameOf:g,onChange:p,onLearn:x,suggestions:m,departments:v,onPickPhoto:k,onRemovePhoto:T,onAddReport:S,onDelete:C,projects:z,onOpenCard:E}){const[j,O]=N.useState(e),w=qe(),b=N.useRef(0);function A(D,M=!1){O(U=>({...U,...D})),window.clearTimeout(b.current),b.current=window.setTimeout(()=>p(D),M?0:400)}return s.jsxs("div",{className:"person",style:{"--depth":Math.min(a,4)},children:[s.jsxs("div",{className:"person-head",children:[s.jsx(Xe,{person:e,size:40,title:w("Change photo"),onClick:k}),s.jsx("input",{className:"person-name",value:j.fullName,placeholder:w("Full name"),"aria-label":w("Full name"),onChange:D=>A({fullName:D.target.value})}),E&&s.jsx("button",{className:"icon-btn",type:"button",title:w("Open the card"),"aria-label":w("Open the card"),onClick:E,children:"⊞"}),s.jsx("button",{className:"icon-btn",type:"button",title:w("Add a direct report"),"aria-label":w("Add a direct report"),onClick:S,children:"+"}),s.jsx("button",{className:"icon-btn",type:"button",title:w("Remove"),"aria-label":w("Remove"),onClick:C,children:"×"})]}),z&&z.length>0&&s.jsxs("p",{className:"hint person-projects",children:[w("Projects"),": ",z.map(D=>`${D.name}${D.role?` — ${D.role}`:""}`).join(" · ")]}),u&&s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"whatif",children:[s.jsx("input",{type:"checkbox",checked:e.plannedOut,onChange:D=>A({plannedOut:D.target.checked},!0)}
15),s.jsxs("span",{children:[w("Possible dismissal")," ",s.jsx("span",{className:"hint",children:w("(what-if: dimmed on the map, out of the totals)")})]})]}),s.jsxs("label",{className:"whatif",children:[s.jsx("input",{type:"checkbox",checked:e.underReview,onChange:D=>A({underReview:D.target.checked},!0)}),s.jsxs("span",{children:[w("Under review")," ",s.jsx("span",{className:"hint",children:w("(not decided yet whether the person is needed; payroll unchanged)")})]})]})]}),s.jsxs("div",{className:"photo-row",children:[s.jsx("button",{type:"button",className:"link",onClick:k,children:e.photoVersion==null?w("Upload photo"):w("Change photo")}),e.photoVersion!=null&&s.jsx("button",{type:"button",className:"link",onClick:T,children:w("Remove photo")})]}),s.jsxs("div",{className:"grid-2",children:[s.jsxs("label",{className:"mini",children:[w("Title"),s.jsx(Sg,{value:j.title,suggestions:m.titles,onChange:D=>A({title:D}),onPick:D=>A({title:D},!0),onBlur:()=>x("titles",j.title)})]}),s.jsxs("label",{className:"mini",children:[w("Department"),s.jsxs("select",{value:e.departmentId??"",onChange:D=>A({departmentId:D.target.value||null},!0),children:[s.jsx("option",{value:"",children:w("— none (reports to the company) —")}),v.map(D=>s.jsx("option",{value:D.id,children:D.name},D.id))]})]}),s.jsxs("label",{className:"mini",children:[w("Corporate email"),s.jsx("input",{type:"email",value:j.email,placeholder:"[email protected]",title:w("Whoever signs in with this address is this person: their photo and name appear in task chats"),onChange:D=>A({email:D.target.value}),onBlur:()=>A({email:j.email.trim()},!0)})]}),s.jsxs("label",{className:"mini",children:[w("Start date"),s.jsx(ka,{value:j.startDate,onChange:D=>A({startDate:D},!0),placeholder:w("not set")})]}),s.jsxs("div",{className:"mini",children:[w("Reports to"),s.jsxs("div",{className:"managers",children:[d.map(D=>s.jsxs("span",{className:"tag",title:D.companyId!==e.companyId?g(D.companyId):void 0,children:[D.fullName||w("Unnamed"),D.companyId!==e.companyId?` · ${g(D.companyId)}`:"",s.jsx("button",{type:"button",className:"tag-x","aria-label":w("Stop reporting to {name}",{name:D.fullName||w("this person")}),onClick:()=>A({managerIds:e.managerIds.filter(M=>M!==D.id)},!0),children:"×"})]},D.id)),h.length>0&&s.jsxs("select",{className:"add-manager",value:"","aria-label":w("Add a manager"),onChange:D=>D.target.value&&A({managerIds:[...e.managerIds,D.target.value]},!0),children:[s.jsx("option",{value:"",children:d.length?w("+ another…"):w("+ manager…")}),h.map(D=>s.jsxs("option",{value:D.id,children:[D.fullName||w("Unnamed"),D.title?` · ${D.title}`:"",D.companyId!==e.companyId?` (${g(D.companyId)})`:""]},D.id))]}),d.length===0&&h.length===0&&s.jsx("span",{className:"hint",children:w("nobody")})]})]}),r?i?s.jsx("p",{className:"mini hint",children:w("Pay is hidden in confidential mode.")}):s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"mini",children:[w("Salary / month"),s.jsxs("span",{className:"money",children:[s.jsx("input",{type:"number",min:"0",step:j.salaryCurrency==="UAH"?500:(j.salaryCurrency==="EUR",50),value:j.salary??"",onChange:D=>A({salary:ap(D.target.value)})}),s.jsxs("select",{className:"currency","aria-label":w("Salary currency"),value:j.salaryCurrency,onChange:D=>A({salaryCurrency:D.target.value},!0),children:[s.jsx("option",{value:"USD",children:"$"}),s.jsx("option",{value:"UAH",children:"₴"}),s.jsx("option",{value:"EUR",children:"€"})]})]}),s.jsx("span",{className:"sub",children:j.salary?j.salaryCurrency==="USD"?`≈ ${Ng(j.salary*l.uah,"UAH")}`:`≈ ${yt(un(j,l))}`:" "})]}),s.jsxs("label",{className:"mini",children:[w("Profit share, %"),s.jsxs("span",{className:"range",children:[s.jsx("input",{type:"number",min:"0",max:"100",step:"0.5",value:j.sharePctMin??"","aria-label":w("Share from"),onChange:D=>A({sharePctMin:ap(D.target.value)})}),"–",s.jsx("input",{type:"number",min:"0",max:"100",step:"0.5",value:j.sharePctMax??"","aria-label":w("Share to"),onChange:D=>A({sharePctMax:ap(D.target.value)})})]})]})]}):null]})]})}function $3(e){const{company:a,all:l,allPeople:i,departments:r,people:u,rate:d,confidential:h,money:g}=e,[p,x]=N.useState(""),m=qe(),v=N.useMemo(()=>{const U=(q,W)=>q.name.localeCompare(W.name),Y=(q,W)=>[{d:q,depth:W},...r.filter(L=>L.parentId===q.id).sort(U).flatMap(L=>Y(L,W+1))];return r.filter(q=>!q.parentId||!r.some(W=>W.id===q.parentId)).sort(U).flatMap(q=>Y(q,0))},[r]),k=i.filter(U=>U.companyId===a.parentId).sort((U,Y)=>U.fullName.localeCompare(Y.fullName)),[T,S]=N.useState(a.name),[C,z]=N.useState(a.focus),E=N.useRef(0),j=N.useRef(null);N.useEffect(()=>{a.name==="New company"&&j.current?.select()},[a.id]);function O(U){window.clearTimeout(E.current),E.current=window.setTimeout(()=>e.onChange(U),400)}const w=l.filter(U=>U.id!==a.id&&!Gl(l,U.id,a.id)).sort((U,Y)=>U.name.localeCompare(Y.name)),b=u.reduce((U,Y)=>U+un(Y,d),0),A=u.filter(U=>U.plannedOut).reduce((U,Y)=>U+un(Y,d),0),D=e.focusPersonId?u.find(U=>U.id===e.focusPersonId):void 0,M=(U,Y)=>s.jsx(R3,{person:U,depth:Y,rate:d,confidential:h,money:g,marks:e.marks,managers:U.managerIds.map(q=>i.find(W=>W.id===q)).filter(q=>!!q),managerOptions:i.filter(q=>q.id!==U.id&&!U.managerIds.includes(q.id)&&e1(i,U.id,q.id)).sort((q,W)=>+(W.companyId===a.id)-+(q.companyId===a.id)||q.fullName.localeCompare(W.fullName)),companyNameOf:q=>l.find(W=>W.id===q)?.name??"",onChange:q=>e.onChangePerson(U.id,q),onLearn:e.onLearn,suggestions:e.suggestions,departments:r,onOpenCard:e.onOpenCard?()=>e.onOpenCard(U.id):void 0,onPickPhoto:()=>
15e.onPickPhoto(U.id),onRemovePhoto:()=>e.onRemovePhoto(U.id),onAddReport:()=>e.onAddPerson(U.id),onDelete:()=>e.onDeletePerson(U.id),projects:e.projects.flatMap(q=>q.members.filter(W=>W.personId===U.id).map(W=>({name:q.name,role:W.role})))},U.id);return D?s.jsx("aside",{className:"panel",children:s.jsxs("section",{className:"panel-section panel-body",children:[s.jsxs("div",{className:"section-head",children:[s.jsxs("h3",{children:[s.jsx("button",{type:"button",className:"crumb",onClick:e.onShowAllPeople,title:m("Show the company and all its people"),children:a.name||m("Untitled")}),s.jsx("span",{className:"crumb-sep",children:"›"})," ",m("Person")]}),s.jsx("button",{className:"icon-btn",type:"button",title:m("Close"),"aria-label":m("Close"),onClick:e.onClose,children:"×"})]}),M(D,0),s.jsx("button",{type:"button",className:"link",onClick:e.onShowAllPeople,children:m("All {n} people of {company}",{n:u.length,company:a.name||"—"})})]})}):s.jsxs("aside",{className:"panel",children:[s.jsxs("div",{className:"panel-body",children:[s.jsxs("section",{className:"panel-section",children:[s.jsx("h3",{children:m("Company")}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"f-name",children:m("Name")}),s.jsx("input",{id:"f-name",ref:j,value:T,autoComplete:"off",onChange:U=>{S(U.target.value),O({name:U.target.value.trim()})}})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"f-focus",children:m("What it does")}),s.jsx("textarea",{id:"f-focus",value:C,onChange:U=>{z(U.target.value),O({focus:U.target.value.trim()})}})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"f-kind",children:m("Type")}),s.jsxs("select",{id:"f-kind",value:a.kind,onChange:U=>e.onChange({kind:U.target.value}),children:[s.jsx("option",{value:"holding",children:m("Holding (group level)")}),s.jsx("option",{value:"company",children:m("Company")})]})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"f-parent",children:m("Reports to")}),s.jsxs("select",{id:"f-parent",value:a.parentId??"",onChange:U=>e.onChange({parentId:U.target.value||null}),children:[s.jsx("option",{value:"",children:m("— none (standalone) —")}),w.map(U=>s.jsx("option",{value:U.id,children:U.name||m("Untitled")},U.id))]})]}),a.parentId&&s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"f-lead",children:m("Responsible person")}),s.jsxs("select",{id:"f-lead",value:a.leadId??"",onChange:U=>e.onChange({leadId:U.target.value||null}),children:[s.jsx("option",{value:"",children:m("— the parent company itself —")}),k.map(U=>s.jsxs("option",{value:U.id,children:[U.fullName||m("Unnamed"),U.title?` · ${U.title}`:""]},U.id))]}),s.jsx("span",{className:"hint",children:m("Someone at {parent} who runs this company; the line then starts from them.",{parent:l.find(U=>U.id===a.parentId)?.name||m("the parent")})})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{className:"label",htmlFor:"f-ceo",children:m("Head of the company")}),s.jsxs("select",{id:"f-ceo",value:a.ceoId??"",onChange:U=>e.onChange({ceoId:U.target.value||null}),children:[s.jsx("option",{value:"",children:m("— not set —")}),u.filter(U=>U.companyId===a.id).map(U=>s.jsxs("option",{value:U.id,children:[U.fullName||m("Unnamed"),U.title?` · ${U.title}`:""]},U.id))]}),s.jsx("span",{className:"hint",children:m("Somebody who works in this company and runs it.")})]}),s.jsxs("div",{className:"field",children:[s.jsx("span",{className:"label",children:m("Tags")}),s.jsx(Cg,{tags:a.tags,suggestions:e.suggestions.tags,onChange:U=>e.onChange({tags:U})})]}),s.jsxs("div",{className:"field",children:[s.jsx("span",{className:"label",children:m("Color")}),s.jsxs("div",{className:"swatches",role:"radiogroup","aria-label":m("Card color"),children:[s.jsx("button",{type:"button",role:"radio","aria-checked":a.color===null,className:`swatch none ${a.color===null?"on":""}`,title:m("Default"),onClick:()=>e.onChange({color:null})}),Rs.map(U=>s.jsx("button",{type:"button",role:"radio","aria-checked":a.color===U.value,className:`swatch ${a.color===U.value?"on":""}`,style:{background:U.value},title:U.name,onClick:()=>e.onChange({color:U.value})},U.value))]})]})]}),s.jsxs("section",{className:"panel-section",children:[s.jsxs("h3",{children:[m("Departments")," ",r.length>0&&s.jsx("span",{className:"count",children:r.length})]}),v.map(({d:U,depth:Y})=>{const q=u.filter(L=>L.departmentId===U.id),W=L=>{for(let V=L,I=0;V&&I<50;I++){if(V.id===U.id)return!0;V=r.find(F=>F.id===V.parentId)}return!1};return s.jsxs("div",{className:"dept-row",style:{"--depth":Y},children:[s.jsx("span",{className:"swatch-mini",style:{background:U.color??a.color??"var(--accent)"}}),s.jsx("input",{className:"dept-input",defaultValue:U.name,"aria-label":m("Department name"),onBlur:L=>{const V=L.target.value.trim();V&&V!==U.name?e.onChangeDepartment(U.id,{name:V}):L.target.value=U.name},onKeyDown:L=>L.key==="Enter"&&L.target.blur()},U.name),s.jsx("span",{className:"pick-count",title:m("People in the department"),children:q.length}),s.jsx("button",{className:"icon-btn",type:"button",title:m("Delete department"),"aria-label":m("Delete {name}",{name:U.name}),onClick:()=>e.onDeleteDepartment(U.id),children:"×"}),s.jsxs("div",{className:"dept-links",children:[s.jsxs("select",{className:"dept-head-select",value:U.parentId??"","aria-label":m("Part of"),title:m("Part of which department (makes this a unit)"),onChange:L=>e.onChangeDepartment(U.id,{parentId:L.target.value||null}),children:[s.jsx("option",{value:"",children:m("— top level —")}),r.filter(L=>L.id!==U.id&&!W(L)).map(L=>s.jsx("option",{value:L.id,children:m("in {name}",{name:L.name})},L.id))]}),s.jsxs("select",{className:"dept-head-select",value:U.headId??"","aria-label":m("Head of department"),title:m("Head of the department"),onChange:L=>e.onChangeDepartment(U.id,{headId:L.target.value||null}),children:[s.jsx("option",{value:"",children:m("— no head —")}),q.map(L=>s.jsx("option",{value:L.id,children:L.fullName||m("Unnamed")},L.id))]})]})]},U.id)}),s.jsxs("form",{className:"dept-add",onSubmit:U=>{U.preventDefault();const Y=p.trim();Y&&(e.onAddDepartment(Y),x(""))},children:[s.jsx(Sg,{value:p,placeholder:m("New department…"),suggestions:e.suggestions.departments.filter(U=>
15!r.some(Y=>Y.name===U)),onChange:x,onPick:U=>{e.onAddDepartment(U),x("")}}),s.jsx("button",{className:"btn small",type:"submit",disabled:!p.trim(),children:m("Add")})]})]}),s.jsxs("section",{className:"panel-section",children:[s.jsxs("div",{className:"section-head",children:[s.jsxs("h3",{children:[m("People")," ",u.length>0&&s.jsx("span",{className:"count",children:u.length})]}),s.jsx("button",{className:"btn small",type:"button",onClick:()=>e.onAddPerson(null),children:m("+ Add person")})]}),b>0&&!h&&s.jsxs("p",{className:"hint",children:[m("Payroll {m}/mo ≈ {u} at {r} UAH/USD",{m:yt(b),u:E1(b*d.uah),r:d.uah}),A>0&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),m("What-if: {a}/mo after cuts, saving {b}/mo ({c}/yr)",{a:yt(b-A),b:yt(A),c:yt(A*12)})]})]}),BO(u).map(({person:U,depth:Y})=>M(U,Y)),u.length===0&&s.jsx("p",{className:"hint",children:m("No people yet.")})]})]}),s.jsxs("div",{className:"actions",children:[s.jsx("button",{className:"btn danger",type:"button",onClick:e.onDelete,children:m("Delete company")}),s.jsx("button",{className:"btn",type:"button",onClick:e.onClose,children:m("Close")})]})]})}const L3=[{value:"down",label:"Down",hint:"Org chart: people under the card"},{value:"right",label:"Right",hint:"Mind map: people to the right of the card"}];function U3(e,a){const l=new Set(e.map(d=>d.id)),i=new Map;for(const d of e){const h=d.parentId&&l.has(d.parentId)?d.parentId:null;i.set(h,[...i.get(h)??[],d])}const r=[],u=(d,h,g)=>{const p=(i.get(d)??[]).sort((x,m)=>x.name.localeCompare(m.name));for(const x of p){const m=g||a.has(x.id);r.push({company:x,depth:h,off:m}),u(x.id,h+1,m)}};return u(null,0,!1),r}function H3({label:e,value:a,options:l,onChange:i}){return s.jsxs("div",{className:"field",children:[s.jsx("span",{className:"label",children:e}),s.jsx("div",{className:"tabs",role:"radiogroup","aria-label":e,children:l.map(r=>s.jsx("button",{type:"button",role:"radio","aria-checked":a===r.value,className:a===r.value?"on":"",title:r.hint,onClick:()=>i(r.value),children:r.label},r.value))})]})}function B3(e){const a=qe(),l=U3(e.companies,e.hidden),i=l.filter(u=>u.off).length,r=a.lang==="ru"?"мес":"mo";return s.jsxs("aside",{className:"sidebar",children:[s.jsxs("section",{className:"sidebar-section",children:[s.jsxs("div",{className:"section-head",children:[s.jsx("h3",{children:a("Companies")}),s.jsx("button",{className:"icon-btn",type:"button",title:a("Close menu"),"aria-label":a("Close menu"),onClick:e.onClose,children:"×"})]}),s.jsxs("p",{className:"hint",children:[i?a("{n} of {total} hidden",{n:i,total:l.length}):a("The eye hides a company and everything under it.")," · ",s.jsx("button",{type:"button",className:"link",onClick:e.onShowAll,disabled:i===0,children:a("Show all")})," · ",s.jsx("button",{type:"button",className:"link",onClick:e.onHideAll,disabled:i===l.length,children:a("Hide all")})]}),s.jsxs("ul",{className:"company-list",children:[l.map(({company:u,depth:d,off:h})=>s.jsxs("li",{className:h?"off":"",style:{"--depth":d},children:[s.jsx("button",{type:"button",className:`eye ${e.hidden.has(u.id)?"closed":""}`,role:"switch","aria-checked":!e.hidden.has(u.id),title:e.hidden.has(u.id)?a("Show on the map"):a("Hide from the map"),onClick:()=>e.onToggle(u.id),children:e.hidden.has(u.id)?"◌":"◉"}),s.jsxs("button",{type:"button",className:"pick",onClick:()=>e.onPick(u.id),disabled:h,children:[s.jsx("span",{className:"swatch-mini",style:{background:u.color??"var(--accent)"}}),s.jsxs("span",{className:"pick-main",children:[s.jsx("span",{className:"pick-name",children:u.name||a("Untitled")}),e.payrollOwn&&(e.payrollTotal?.get(u.id)??0)>0&&s.jsxs("span",{className:"pick-pay",title:a("Payroll per month: own people / including the companies below"),children:[yt(e.payrollOwn.get(u.id)??0),(e.payrollTotal?.get(u.id)??0)!==(e.payrollOwn.get(u.id)??0)&&` / ${yt(e.payrollTotal.get(u.id))}`,"/",r]})]}),u.kind==="holding"&&s.jsx("span",{className:"pick-kind",children:a("group")}),(e.peopleTotal.get(u.id)??0)>0&&s.jsxs("span",{className:"pick-count",title:a("{n} in the company · {total} including companies below",{n:e.peopleCount.get(u.id)??0,total:e.peo
15pleTotal.get(u.id)??0}),children:[e.peopleCount.get(u.id)??0,(e.peopleTotal.get(u.id)??0)!==(e.peopleCount.get(u.id)??0)&&s.jsxs("span",{className:"pick-total",children:[" / ",e.peopleTotal.get(u.id)]})]})]})]},u.id)),l.length===0&&s.jsx("li",{className:"hint",children:a("No companies yet.")})]}),l.length>0&&s.jsxs("p",{className:"hint company-total",children:[a("Total: {n} people in {c} companies",{n:[...e.peopleCount.values()].reduce((u,d)=>u+d,0),c:l.length}),i>0&&` · ${a("{n} shown",{n:l.filter(u=>!u.off).reduce((u,d)=>u+(e.peopleCount.get(d.company.id)??0),0)})}`,e.payrollOwn&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),a("Payroll: {m}/mo · {y}/yr",{m:yt([...e.payrollOwn.values()].reduce((u,d)=>u+d,0)),y:yt([...e.payrollOwn.values()].reduce((u,d)=>u+d,0)*12)})]})]})]}),s.jsxs("section",{className:"sidebar-section",children:[s.jsx("h3",{children:a("What-if")}),e.whatIf.count===0?s.jsx("p",{className:"hint",children:a("Mark the dismissals you are weighing (✂ on a person, or the checkbox in the panel) to see what they would save. Nobody is deleted.")}):s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"hint",children:[a("{n} marked for dismissal",{n:e.whatIf.count}),e.whatIf.savingMonth&&` · ${a("saves {m}/mo ({y}/yr)",{m:e.whatIf.savingMonth,y:e.whatIf.savingYear})}`]}),s.jsx("button",{type:"button",className:"btn small",onClick:e.onClearWhatIf,children:a("Keep everyone (clear marks)")})]})]}),s.jsxs("section",{className:"sidebar-section",children:[s.jsx("h3",{children:a("View")}),s.jsxs("div",{className:"field",children:[s.jsx("span",{className:"label",children:a("Background")}),s.jsx("div",{className:"bg-grid",role:"radiogroup","aria-label":a("Background"),children:sh.map(u=>s.jsx("button",{type:"button",role:"radio","aria-checked":e.background===u.value,className:`bg-swatch bg-${u.value} ${e.background===u.value?"on":""}`,title:a(u.label),onClick:()=>e.onBackground(u.value),children:s.jsx("span",{className:"bg-name",children:a(u.label)})},u.value))})]}),s.jsx(H3,{label:a("People branches grow"),value:e.dir,options:L3.map(u=>({...u,label:a(u.label),hint:a(u.hint)})),onChange:e.onDir}),s.jsx("p",{className:"hint",children:a("Changing the direction re-arranges the whole map.")})]})]})}const Sa={backlog:"Backlog",todo:"To do",in_progress:"In progress",review:"In review",done:"Done",cancelled:"Cancelled"},P3={backlog:"Not started",todo:"Not started",in_progress:"Active",review:"Active",done:"Done and closed",cancelled:"Done and closed"},Y3={backlog:"#9aa3b8",todo:"#2f6fd0",in_progress:"#e29a2d",review:"#8b5cd6",done:"#43a047",cancelled:"#9aa3b8"};function Jn({state:e,size:a=14}){const l=Y3[e],i={width:a,height:a,viewBox:"0 0 16 16","aria-hidden":!0};return e==="cancelled"?s.jsxs("svg",{...i,className:"state-icon",children:[s.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:l,strokeWidth:"1.6"}),s.jsx("path",{d:"M5.4 5.4l5.2 5.2M10.6 5.4l-5.2 5.2",fill:"none",stroke:l,strokeWidth:"1.6",strokeLinecap:"round"})]}):e==="done"?s.jsxs("svg",{...i,className:"state-icon",children:[s.jsx("circle",{cx:"8",cy:"8",r:"7",fill:l}),s.jsx("path",{d:"M4.8 8.2l2.1 2.1 4.2-4.4",fill:"none",stroke:"#fff",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]}):e==="backlog"?s.jsx("svg",{...i,className:"state-icon",children:s.jsx("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:l,strokeWidth:"1.6",strokeDasharray:"2.6 2.4"})}):s.jsxs("svg",{...i,className:"state-icon",children:[s.jsx("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:l,strokeWidth:"1.6"}),e!=="todo"&&s.jsx("path",{d:e==="in_progress"?"M8 8 V2.6 A5.4 5.4 0 0 1 13.4 8 Z":"M8 8 V2.6 A5.4 5.4 0 0 1 8 13.4 Z",fill:l})]})}const vw=320;function Qe({value:e,options:a,onChange:l,children:i,title:r,disabled:u,className:d="",searchPlaceholder:h="Поиск…",emptyLabel:g="Ничего не найдено",keepOpen:p=!1}){const[x,m]=N.useState(!1),[v,k]=N.useState(""),T=N.useRef(null),S=N.useRef(null),[C,z]=N.useState(null),E=a.length>12,j=v.trim().toLowerCase(),O=j?a.filter(w=>w.label.toLowerCase().includes(j)):a;return N.useLayoutEffect(()=>{if(!x)return z(null);const w=()=>{const b=T.current?.getBoundingClientRect();if(!b)return;const A=window.innerHeight-b.bottom-8,D=Math.min(vw,S.current?.scrollHeight??vw),M=A<D&&b.top>A,U=Math.max(b.width,240),Y=b.left+U>window.innerWidth-8?b.right-U:b.left;z({top:M?Math.max(8,b.top-D-4):b.bottom+4,left:Math.min(Math.max(8,Y),Math.max(8,window.innerWidth-U-8)),width:U})};return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[x,a.length,v]),N.useEffect(()=>{if(!x)return;const w=A=>{const D=A.target;!T.current?.contains(D)&&!S.current?.contains(D)&&m(!1)},b=A=>{A.key==="Escape"&&(A.stopPropagation(),m(!1))};return document.addEventListener("mousedown",w),window.addEventListener("keydown",b,!0),()=>{document.removeEventListener("mousedown",w),window.removeEventListener("keydown",b,!0)}},[x]),N.useEffect(()=>{x||k("")},[x]),s.jsxs("span",{className:`qpick ${d}`,ref:T,children:[s.jsx("button",{type:"button",className:"pick-btn",title:r,disabled:u,"aria-haspopup":"listbox","aria-expanded":x,onClick:w=>{w.stopPropagation(),m(b=>!b)},children:i}),x&&Sc.createPortal(s.jsxs("ul",{ref:S,className:`pick-menu over ${E?"tall":""}
15`,role:"listbox",style:C?{top:C.top,left:C.left,minWidth:C.width}:{visibility:"hidden"},children:[E&&s.jsx("li",{className:"pick-find",children:s.jsx("input",{autoFocus:!0,value:v,onChange:w=>k(w.target.value),placeholder:h,onClick:w=>w.stopPropagation()})}),O.length===0&&s.jsx("li",{className:"pick-empty",children:g}),O.map((w,b)=>s.jsxs(N.Fragment,{children:[w.heading&&w.heading!==O[b-1]?.heading&&s.jsx("li",{className:"pick-head",children:w.heading}),s.jsxs("li",{className:`pick-row ${w.divider?"apart":""}`,children:[s.jsxs("button",{type:"button",role:"option","aria-selected":w.value===e,className:`pick-opt ${w.value===e?"on":""} ${w.className??""}`,onClick:A=>{A.stopPropagation(),p||m(!1),(p||w.value!==e)&&l(w.value)},children:[w.icon,s.jsxs("span",{className:"pick-text",children:[w.label,w.sub&&s.jsx("span",{className:"pick-sub",children:w.sub})]})]}),w.onRemove&&s.jsx("button",{type:"button",className:"pick-x",title:w.removeTitle,"aria-label":w.removeTitle,onClick:A=>{A.stopPropagation(),w.onRemove()},children:"×"})]})]},w.value))]}),document.body)]})}let Ud=null,Hd=null,Bd=null;function Dt(e,a={}){return Ud?new Promise(l=>Ud({message:e,...a,resolve:l})):Promise.resolve(window.confirm(e))}function us(e,a={}){return Hd?new Promise(l=>Hd({message:e,...a,resolve:l})):Promise.resolve(window.prompt(e,a.value??""))}function Up(e,a){return Bd?new Promise(l=>Bd({message:e,...a,resolve:l})):Promise.resolve(void 0)}function V3(){const[e,a]=N.useState(null);return N.useEffect(()=>(Bd=a,()=>{Bd=null}),[]),{pending:e,answer:i=>{e?.resolve(i),a(null)}}}function q3(){const[e,a]=N.useState(null);return N.useEffect(()=>(Hd=a,()=>{Hd=null}),[]),{pending:e,answer:i=>{e?.resolve(i),a(null)}}}function G3(){const[e,a]=N.useState(null);return N.useEffect(()=>(Ud=a,()=>{Ud=null}),[]),{pending:e,answer:i=>{e?.resolve(i),a(null)}}}const bw={on_track:"To plan",at_risk:"At risk",stuck:"Not moving",done:"Achieved",dropped:"Cancelled"},X3=10,A1=()=>new Date().toISOString().slice(0,10);function Hp(){const e=new Date,a=h=>h.toISOString().slice(0,10),l=(h,g)=>a(new Date(Date.UTC(h,g,1))),i=(h,g)=>a(new Date(Date.UTC(h,g+1,0))),r=e.getUTCFullYear(),u=e.getUTCMonth(),d=Math.floor(u/3)*3;return[{label:"This month",startsOn:l(r,u),endsOn:i(r,u)},{label:"This quarter",startsOn:l(r,d),endsOn:i(r,d+2)},{label:"Next quarter",startsOn:l(r,d+3),endsOn:i(r,d+5)},{label:"Half a year",startsOn:l(r,u),endsOn:i(r,u+5)},{label:"This year",startsOn:l(r,0),endsOn:i(r,11)}]}function ww(e){if(e.state==="done"||e.state==="dropped")return 0;const a=r=>{const u=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()));return u.setUTCDate(u.getUTCDate()-(u.getUTCDay()+6)%7),u.getTime()},l=e.lastWeek?Date.parse(`${e.lastWeek}T00:00:00Z`):a(new Date(`${e.startsOn}T00:00:00Z`)),i=Math.floor((a(new Date)-l)/(7*864e5));return Math.max(0,i)}function Z3({companies:e,people:a,projects:l,tools:i,tasks:r,taskActions:u,onOpenTask:d,onOpenHolder:h,onCreateProject:g,onStatus:p,fail:x}){const m=qe(),[v,k]=N.useState([]),[T,S]=N.useState("open"),[C,z]=N.useState(!1),[E,j]=N.useState(!1),O=()=>Se.planning().then(_=>k(_.goals)).catch(x);N.useEffect(()=>{O()},[]);const w=N.useMemo(()=>new Map(a.map(_=>[_.id,_])),[a]),b=N.useMemo(()=>[...l,...i],[l,i]),A=N.useMemo(()=>new Map(b.map(_=>[_.id,_])),[b]),D=_=>l.some(H=>H.id===_)?"project":"tool",M=_=>_.state==="done"||_.state==="dropped"||_.endsOn<A1(),U=v.filter(_=>T==="all"?!0:T==="over"?M(_):!M(_)),Y=v.filter(_=>!M(_)),q=Y.filter(_=>_.state==="at_risk"||_.state==="stuck").length,W=async(_,H)=>{k(P=>P.map(X=>X.id===_?{...X,...H}:X));try{const P=await Se.updateGoal(_,H);k(X=>X.map(ne=>ne.id===_?P:ne)),p("Saved")}catch(P){x(P),O()}};async function L(_){j(!0);try{const H=await Se.createGoal(_);k(P=>[...P,H]),z(!1),p("Added")}catch(H){x(H)}finally{j(!1)}}async function V(_){if(await Dt(m("Delete the goal “{name}”?",{name:_.title}),{okLabel:"Delete",danger:!0}))try{await Se.deleteGoal(_.id),k(H=>H.filter(P=>P.id!==_.id)),p("Deleted")}catch(H){x(H)}}async function I(_){const H=_.carriedOver?m("Carry “{name}” into the next quarter? It has already been carried over {n} times.",{name:_.title,n:_.carriedOver}):m("Carry “{name}” into the next quarter?",{name:_.title});if(await Dt(H,{okLabel:"Carry over"}))try{const P=await Se.carryGoal(_.id);k(X=>X.map(ne=>ne.id===_.id?P:ne)),p("Carried over")}catch(P){x(P),O()}}async function F(_,H){const P=await g(H,_.companyId);P&&(await W(_.id,{holders:[..._.holders,{kind:"project",id:P.id}]}),h(P.id))}return s.jsxs("div",{className:"planning",children:[s.jsxs("header",{className:"plan-head",children:[s.jsx("div",{className:"tabs",role:"tablist","aria-label":m("Which goals"),children:["open","all","over"].map(_=>s.jsxs("button",{type:"button",role:"tab","aria-selected":T===_,className:T===_?"on":"",onClick:()=>S(_),children:[m(_==="open"?"Running":_==="all"?"All":"Finished"),_==="open"&&Y.length>0&&s.jsx("span",{className:"count",children:Y.length})]},_))}),q>0&&s.jsx("p",{className:"hint",children:m("{n} need attention",{n:q})}),Y.length>X3&&s.jsx("span",{className:"gap warn",children:m("More than ten goals is a to-do list — nobody checks against it")}),s.jsx("button",{type:"button",className:"btn primary",disabled:E,onClick:()=>z(!0),children:m("+ Goal")})]}),C&&s.jsx(F3,{companies:e,people:a,busy:E,onClose:()=>z(!1),onCreate:L}),U.length===0&&s.jsx("p",{className:"hint pad",children:v.length===0?m("No goals yet. Five to ten at a time is plenty — they are what everything else is measured against."):m("Nothing here. Look at “All”.")}),s.jsx("ul",{className:"goal-list",children:U.map(_=>s.jsx(J3,{goal:_,companies:e,people:a,tasks:r,taskActions:u,onOpenTask:d,personById:w,everything:b,holderById:A,tools:i,kindOf:D,onPatch:H=>W(_.id,H),onOpenHolder:h,onNewProject:H=>F(_,H),onDelete:()=>V(_),onCarry:()=>I(_)},_.id))})]})}function F3({companies:e,people:a,busy:l,onClose:i,onCreate:r}){const u=qe(),[d,h]=N.useState(""),[g,p]=N.useState(""),[x,m]=N.useState(""),[v,k]=N.useState(""),[T,S]=N.useState(()=>Hp()[0]),C=()=>{d.trim()&&r({title:d.trim(),detail:g.trim(),companyId:x||null,ownerPersonId:v||null,startsOn:T.startsOn,endsOn:T.endsOn})};return Sc.createPortal(s.jsx("div",{className:"modal-back",onMouseDown:i,children:s.jsxs("div",{className:"modal new-goal",role:"dialog","aria-label":u("New goal"),onMouseDown:z=>z.stopPropagation(),children:[s.jsxs("header",{className:"panel-head",children:[s.jsx("h3",{children:u("New goal")}),s.jsx("button",{type:"button",className:"icon-btn",title:u("Close"),onClick:i,children:"×"})]}),s.jsxs("div",{className:"panel-body ng-body",children:[s.jsxs("label",{className:"ng-row",children:[s.jsx("span",{className:"nt-label",children:u("The goal")}),s.jsx("input",{autoFocus:!0,maxLength:300,value:d,placeholder:u("What has to be true by the end of the peri
15od…"),onChange:z=>h(z.target.value),onKeyDown:z=>{z.key==="Enter"&&C()}})]}),s.jsxs("label",{className:"ng-row",children:[s.jsx("span",{className:"nt-label",children:u("What it means")}),s.jsx("textarea",{rows:3,value:g,placeholder:u("How anybody will know it is reached…"),onChange:z=>p(z.target.value)})]}),s.jsxs("div",{className:"ng-pair",children:[s.jsxs("div",{className:"ng-row",children:[s.jsx("span",{className:"nt-label",children:u("Whose goal")}),s.jsx(Qe,{className:"ng-pick",value:x,options:[{value:"",label:u("The whole group")},...e.map(z=>({value:z.id,label:z.name}))],onChange:m,children:s.jsx("span",{className:x?"":"muted",children:e.find(z=>z.id===x)?.name??u("The whole group")})})]}),s.jsxs("div",{className:"ng-row",children:[s.jsx("span",{className:"nt-label",children:u("Who answers for it")}),s.jsx(Qe,{className:"ng-pick",value:v,searchPlaceholder:u("Search a person…"),options:[{value:"",label:u("— nobody yet —")},...a.filter(z=>z.fullName&&!z.plannedOut).map(z=>({value:z.id,label:z.fullName,sub:z.title,icon:s.jsx(Xe,{person:z,size:22})}))],onChange:k,children:v&&a.find(z=>z.id===v)?s.jsxs("span",{className:"goal-owner",children:[s.jsx(Xe,{person:a.find(z=>z.id===v),size:20})," ",a.find(z=>z.id===v).fullName]}):s.jsx("span",{className:"muted",children:u("— nobody yet —")})})]})]}),s.jsxs("div",{className:"ng-row",children:[s.jsx("span",{className:"nt-label",children:u("By when")}),s.jsxs("div",{className:"ng-when",children:[Hp().map(z=>s.jsx("button",{type:"button",className:`goal-chip ${T.startsOn===z.startsOn&&T.endsOn===z.endsOn?"on":""}`,onClick:()=>S(z),children:u(z.label)},z.label)),s.jsxs("span",{className:"ng-own-date",children:[s.jsx("span",{className:"hint",children:u("or a date of its own")}),s.jsx(ka,{value:T.endsOn,clearable:!1,onChange:z=>z&&S({...T,endsOn:z}),title:u("To")})]})]})]})]}),s.jsxs("div",{className:"actions ng-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:i,children:u("Cancel")}),s.jsx("button",{type:"button",className:"btn primary",disabled:l||!d.trim(),onClick:C,children:u("+ Goal")})]})]})}),document.body)}function K3({goalId:e,state:a}){const l=qe(),[i,r]=N.useState(""),[u,d]=N.useState(null),[h,g]=N.useState(""),[p,x]=N.useState(!1),[m,v]=N.useState(!1);N.useEffect(()=>{let E=!0;return Se.goalUpdates(e).then(j=>{E&&(r(j.week),d(j.updates),g(j.updates.find(O=>O.week===j.week)?.body??""))},()=>E&&d([])),()=>{E=!1}},[e]);const k=u?.find(E=>E.week===i)??null,T=(u??[]).filter(E=>E.week!==i),S=l.lang==="ru"?"ru-RU":"en-GB",C=E=>{const j=new Date(`${E}T00:00:00Z`),O=new Date(j.getTime()+6*864e5),w=b=>b.toLocaleDateString(S,{day:"numeric",month:"short",timeZone:"UTC"});return`${w(j)} — ${w(O)}`};async function z(){const E=h.trim();if(!(!E||E===k?.body)){v(!0);try{const j=await Se.writeGoalUpdate(e,{body:E,state:a});d(O=>[j,...(O??[]).filter(w=>w.week!==j.week)])}finally{v(!1)}}}return s.jsxs("div",{className:"goal-reports",children:[s.jsxs("div",{className:"goal-work-head",children:[s.jsx("span",{className:"panel-label",children:l("This week")}),s.jsxs("span",{className:"hint",children:[C(i||new Date().toISOString().slice(0,10)),k?` · ${l("written by {who}",{who:k.byName??"—"})}`:` · ${l("not written yet")}`]})]}),s.jsx("textarea",{className:"goal-report-box",rows:k||h?3:2,value:h,placeholder:l("How is it going, in your own words…"),onChange:E=>g(E.target.value),onBlur:z,onKeyDown:E=>{E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&E.target.blur()}}),m&&s.jsx("span",{className:"hint",children:l("Saving…")}),T.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"goal-report-more","aria-expanded":p,onClick:()=>x(E=>!E),children:[s.jsx("span",{"aria-hidden":"true",children:p?"▾":"▸"}),l("Earlier weeks"),s.jsx("span",{className:"hint",children:T.length})]}),p&&s.jsx("ul",{className:"goal-report-list",children:T.map(E=>s.jsxs("li",{children:[s.jsx("span",{className:"goal-report-when",children:C(E.week)}),s.jsx("span",{className:"goal-report-body",children:E.body}),s.jsx("span",{className:"hint",children:E.byName})]},E.id))})]})]})}function Q3(e,a){const l=new Date(e);return Number.isNaN(l.getTime())?e:l.toLocaleDateString(a==="ru"?"ru-RU":"en-GB",{day:"numeric",month:"short",year:"numeric"})}function W3(e,a,l){const i=l==="ru"?"ru-RU":"en-GB",r=new Date(`${e}T00:00:00Z`),u=new Date(`${a}T00:00:00Z`),d=(g,p=!1)=>g.toLocaleDateString(i,{month:p?"long":"short",timeZone:"UTC"}),h=r.getUTCFullYear()===u.getUTCFullYear();return h&&r.getUTCMonth()===u.getUTCMonth()?`${d(r,!0)} ${u.getUTCFullYear()}`:`${d(r)}
15${h?"":` ${r.getUTCFullYear()}`} — ${d(u)} ${u.getUTCFullYear()}`}function J3({goal:e,companies:a,people:l,tasks:i,taskActions:r,onOpenTask:u,personById:d,everything:h,holderById:g,tools:p,kindOf:x,onPatch:m,onOpenHolder:v,onNewProject:k,onDelete:T,onCarry:S}){const C=qe(),[z,E]=N.useState(""),[j,O]=N.useState(""),[w,b]=N.useState(!1),A=N.useMemo(()=>i.filter(_=>_.goalId===e.id),[i,e.id]),D=N.useMemo(()=>{const _=new Set(e.holders.map(H=>H.id));return i.filter(H=>H.goalId===e.id||_.has(H.projectId??H.toolId??""))},[i,e.id,e.holders]),M=N.useMemo(()=>{const _=new Map;for(const H of D){const P=new Set([H.assigneeId,...H.people.map(X=>X.personId)].filter(X=>!!X));for(const X of P){const ne=_.get(X)??{tasks:0,done:0};ne.tasks++,H.state==="done"&&ne.done++,_.set(X,ne)}}return[..._.entries()].map(([H,P])=>({person:d.get(H),...P})).filter(H=>!!H.person).sort((H,P)=>P.tasks-H.tasks)},[D,d]),[U,Y]=N.useState(null),[q,W]=N.useState(!1),L=e.steps.filter(_=>_.done).length,V=e.endsOn<A1()&&e.state!=="done"&&e.state!=="dropped",I=_=>_&&a.find(H=>H.id===_)?.name||"",F=_=>m({steps:_});return s.jsxs("li",{className:`goal ${e.state}`,children:[s.jsxs("header",{className:"goal-head",children:[s.jsx("span",{className:`goal-ring ${e.progress.percent===null?"empty":e.progress.percent>=100?"full":""}`,style:{"--pct":`${e.progress.percent??0}%`},title:C("{steps} of {allSteps} steps · {tasks} of {allTasks} tasks",{steps:e.progress.stepsDone,allSteps:e.progress.steps,tasks:e.progress.tasksDone,allTasks:e.progress.tasks}),children:s.jsx("span",{className:"goal-ring-n",children:e.progress.percent===null?"—":`${e.progress.percent}%`})}),s.jsx(bn,{className:"goal-title",value:e.title,placeholder:C("The goal"),onCommit:_=>_.trim()&&m({title:_.trim()})}),s.jsx(Qe,{className:`goal-status ${e.state}`,value:e.state,options:zO.map(_=>({value:_,label:C(bw[_])})),onChange:_=>m({state:_}),children:s.jsx("span",{children:C(bw[e.state])})})]}),s.jsx(bn,{className:"goal-detail",multiline:!0,value:e.detail,placeholder:C("What it means, in a sentence…"),onCommit:_=>m({detail:_})}),s.jsxs("div",{className:"goal-meta",children:[s.jsxs("button",{type:"button",className:`goal-period ${V?"late":""}`,onClick:()=>W(_=>!_),title:`${e.startsOn} — ${e.endsOn}`,children:[W3(e.startsOn,e.endsOn,C.lang),V&&` · ${C("overdue")}`]}),ww(e)>0&&s.jsx("span",{className:"gap warn",title:C("A goal is spoken about once a week — by whoever answers for it"),children:e.lastWeek?C("silent for {n} weeks",{n:ww(e)}):C("nothing said about it yet")}),e.carriedOver>0&&s.jsx("span",{className:"goal-carried",title:C("It has been carried into another quarter {n} times",{n:e.carriedOver}),children:C("carried over ×{n}",{n:e.carriedOver})}),s.jsx(Qe,{className:"goal-pick",value:e.companyId??"",options:[{value:"",label:C("The whole group")},...a.map(_=>({value:_.id,label:_.name}))],onChange:_=>m({companyId:_||null}),children:s.jsx("span",{className:e.companyId?"":"muted",children:I(e.companyId)||C("The whole group")})}),s.jsx(Qe,{className:"goal-pick",value:e.ownerPersonId??"",searchPlaceholder:C("Search a person…"),options:[{value:"",label:C("— nobody yet —")},...l.filter(_=>_.fullName&&!_.plannedOut).map(_=>({value:_.id,label:_.fullName,sub:_.title,icon:s.jsx(Xe,{person:_,size:22})}))],onChange:_=>m({ownerPersonId:_||null}),children:e.ownerPersonId&&d.get(e.ownerPersonId)?s.jsxs("span",{className:"goal-owner",children:[s.jsx(Xe,{person:d.get(e.ownerPersonId),size:20})," ",d.get(e.ownerPersonId).fullName]}):s.jsx("span",{className:"muted matrix-warn",children:C("nobody answers for it")})})]}),q&&s.jsxs("div",{className:"goal-dates",children:[Hp().map(_=>s.jsx("button",{type:"button",className:`goal-chip ${e.startsOn===_.startsOn&&e.endsOn===_.endsOn?"on":""}`,onClick:()=>m({startsOn:_.startsOn,endsOn:_.endsOn}),children:C(_.label)},_.label)),s.jsx(ka,{value:e.startsOn,clearable:!1,onChange:_=>_&&m({startsOn:_}),title:C("From")}),s.jsx(ka,{value:e.endsOn,clearable:!1,onChange:_=>_&&m({endsOn:_}),title:C("To")})]}),s.jsxs("div",{className:"goal-doing",children:[s.jsxs("div",{className:"goal-doing-head",children:[s.jsx("span",{className:"panel-label",children:C("Work on the goal")}),s.jsxs("span",{className:"hint",children:[e.progress.tasks>0?C("{done} of {all} tasks done",{done:e.progress.tasksDone,all:e.progress.tasks}):C("no tasks yet"),e.progress.recurring>0&&` · ${C("{n} recurring",{n:e.progress.recurring})}`]})]}),A.length>0&&s.jsxs("ul",{className:"goal-tasks",children:[A.slice(0,8).map(_=>s.jsxs("li",{children:[s.jsxs("button",{type:"button",className:"goal-task",onClick:()=>u(_.id),children:[s.jsx(Jn,{state:_.state,size:12}),s.jsx("span",{className:`goal-task-title ${_.state==="done"?"done":""}`,children:_.title}),_.kind==="recurring"&&s.jsx("span",{className:"goal-task-mark",children:C("recurring")}),_.dueOn&&s.jsx("span",{className:`goal-task-when ${_.late?"late":""}`,children:_.dueOn.split("-").reverse().join(".")})]}),s.jsx("button",{type:"button",className:"icon-btn small",title:C("Take it off the goal"),onClick:()=>r.patch(_.id,{goalId:null}),children:"×"})]},_.id)),A.length>8&&s.jsx("li",{className:"hint pad",children:C("and {n} more",{n:A.length-8})})]}),s.jsx("input",{className:"goal-step-add",value:j,placeholder:C("+ A task for this goal"),onChange:_=>O(_.target.value),onKeyDown:async _=>{_.key!=="Enter"||!j.trim()||(await r.create({title:j.trim(),goalId:e.id,departmentId:null}),O(""))}})]}),s.jsxs("div",{className:`goal-steps ${e.steps.length?"filled":""}`,children:[e.steps.length>0&&s.jsxs("div",{className:"goal-steps-head",children:[s.jsx("span",{className:"panel-label",children:C("What has to happen")}),s.jsxs("span",{className:"goal-progress",title:C("{done} of {all}",{done:L,all:e.steps.length}),children:[s.jsx("span",{className:"goal-bar",children:s.jsx("span",{style:{width:`${Math.round(L/e.steps.length*100)}%`}})}),C("{done} of {all}",{done:L,all:e.steps.length})]})]}),e.steps.map(_=>s.jsxs("label",{className:"goal-step",children:[s.jsx("input",{type:"checkbox",checked:_.done,onChange:H=>F(e.steps.map(P=>P.id===_.id?{...P,done:H.target.checked}:P))}),s.jsx(bn,{className:`goal-step-title ${_.done?"done":""}`,value:_.title,placeholder:C("What has to happen"),onCommit:H=>H.trim()?F(e.steps.map(P=>P.id===_.id?{...P,title:H.trim()}:P)):F(e.steps.filter(P=>P.id!==_.id))}),s.jsx("button",{type:"button",className:"icon-btn small",title:C("Remove"),onClick:()=>F(e.steps.filter(H=>H.id!==_.id)),children:"×"})]},_.id)),s.jsx("input",{className:"goal-step-add",value:z,placeholder:e.steps.length?C("+ Step"):C("+ What has to happen for this to be true"),onChange:_=>E(_.target.value),onKeyDown:_=>{_.key!=="Enter"||!z.trim()||(F([...e.steps,{title:z.trim(),done:!1}]),E(""))}})]}),s.jsx(K3,{goalId:e.id,state:e.state}),M.length>0&&s.jsxs("div",{className:`goal-crew ${w?"open":""}`,children:[s.jsxs("button",{type:"button",className:"goal-crew-head","aria-expanded":w,onClick:()=>b(_=>!_),children:[s.jsx("span",{className:"goal-crew-arrow","aria-hidden":"true",children:w?"▾":"▸"}),s.jsx("span",{className:"panel-label",children:C("Who is working on it")}),s.jsxs("span",{className:"goal-crew-faces",children:[M.slice(0,5).map(_=>s.jsx(Xe,{person:_.person,size:20,title:_.person.fullName},_.person.id)),M.length>5&&s.jsxs("span",{className:"goal-crew-more",children:["+",M.length-5]})]}),s.jsx("span",{className:"hint",children:C("{n} people",{n:M.length})})]}),w&&s.jsx("ul",{className:"goal-crew-list",children:M.map(_=>s.jsxs("li",{children:[s.jsx(Xe,{person:_.person,size:22}),s.jsx("span",{className:"goal-crew-name",children:_.person.fullName}),s.jsx("span",{className:"hint",children:_.person.title}),s.jsx("span",{className:"goal-crew-n",children:C("{done} of {all}",{done:_.done,all:_.tasks})})]},_.person.id))})]}),s.jsxs("div",{className:"goal-work",children:[s.jsxs("div",{className:"goal-work-head",children:[s.jsx("span",{className:"panel-label",children:C("Works on it")}),e.holders.length>0&&s.jsx("span",{className:"hint",children:C("{n} projects",{n:e.holders.length})})]}),s.jsxs("div",{className:"goal-work-row",children:[e.holders.map(_=>s.jsx("button",{type:"button",className:`goal-chip ${g.get(_.id)?.routine?"routine":""}`,title:C("Open"),onClick:()=>v(_.id),children:g.get(_.id)?.name||C("Untitled")},_.id)),s.jsx(Qe,{className:"goal-pick add",value:"",keepOpen:!0,searchPlaceholder:C("Search…"),options:h.map(_=>({value:_.id,label:_.name,sub:p.some(H=>H.id===_.id)?C("Tool"):C("Project"),icon:s.jsx("span",{className:`tick ${e.holders.some(H=>H.id===_.id)?"on":""}`,"aria-hidden":"true"})})),onChange:_=>{const H=e.holders.some(P=>P.id===_);m({holders:H?e.holders.filter(P=>P.id!==_):[...e.holders,{kind:x(_),id:_}]})},children:s.jsx("span",{className:"hint",children:e.holders.length?C("+ more"):C("+ Existing work")})}),U===null?s.jsx("button",{type:"button",className:"link",onClick:()=>Y(""),children:C("+ New project for it")}
15):s.jsx("input",{className:"goal-step-add",autoFocus:!0,value:U,placeholder:C("Name of the project…"),onChange:_=>Y(_.target.value),onBlur:()=>Y(null),onKeyDown:_=>{_.key==="Escape"&&Y(null),!(_.key!=="Enter"||!U.trim())&&(k(U.trim()),Y(null))}})]})]}),s.jsxs("footer",{className:"goal-foot",children:[e.note?s.jsx("span",{className:"goal-note hint",children:e.note}):s.jsx("span",{}),s.jsxs("span",{className:"goal-foot-right",children:[e.stateAt&&s.jsx("span",{className:"hint",children:C("as of {date}",{date:Q3(e.stateAt,C.lang)})}),V&&e.state!=="done"&&e.state!=="dropped"&&s.jsx("button",{type:"button",className:"link",onClick:S,children:C("carry into the next quarter")}),s.jsx("button",{type:"button",className:"link danger",onClick:T,children:C("delete")})]})]})]})}const e4=[1,2,3,4,5,6,7],t4=(e,a)=>new Date(Date.UTC(2024,0,e%7+1)).toLocaleDateString(a==="ru"?"ru-RU":"en-GB",{weekday:"short",timeZone:"UTC"});function I1({kind:e,departmentId:a,departments:l,companies:i,people:r,holders:u,tools:d,needsHolder:h=!1,holderId:g,onClose:p,onCreate:x}){const m=qe(),[v,k]=N.useState(""),[T,S]=N.useState(""),[C,z]=N.useState(a??""),[E,j]=N.useState(""),[O,w]=N.useState(g??""),[b,A]=N.useState(""),[D,M]=N.useState(1),U=e==="recurring",Y=V=>V&&i.find(I=>I.id===V)?.name||"",q=[{value:"",label:m("— no department —")},...l.map(V=>({value:V.id,label:V.name,sub:Y(V.companyId)}))],W=V=>q.find(I=>I.value===V)?.label??"";function L(){!v.trim()||h&&!O||x({title:v.trim(),kind:e,details:T.trim(),departmentId:C||null,assigneeId:E||null,projectId:O&&!d.some(V=>V.id===O)?O:null,toolId:O&&d.some(V=>V.id===O)?O:null,...U?{repeat:"week",weekdays:[D]}:{dueOn:b||null}})}return s.jsx("div",{className:"modal-back",onMouseDown:p,children:s.jsxs("div",{className:"modal nt",role:"dialog","aria-label":m(U?"New recurring task":"New task"),onMouseDown:V=>V.stopPropagation(),children:[s.jsxs("header",{className:"panel-head",children:[s.jsx("h3",{children:m(U?"New recurring task":"New task")}),s.jsx("button",{type:"button",className:"icon-btn",title:m("Close"),onClick:p,children:"×"})]}),s.jsxs("div",{className:"panel-body nt-body",children:[s.jsxs("label",{className:"nt-row",children:[s.jsx("span",{className:"nt-label",children:m("Task")}),s.jsx("input",{autoFocus:!0,maxLength:300,value:v,placeholder:m(U?"What has to be done again and again…":"What has to be done…"),onChange:V=>k(V.target.value),onKeyDown:V=>{V.key==="Enter"&&L()}})]}),s.jsxs("label",{className:"nt-row",children:[s.jsx("span",{className:"nt-label",children:m("Description")}),s.jsx("textarea",{rows:3,value:T,placeholder:m("What has to be done, in detail…"),onChange:V=>S(V.target.value)})]}),s.jsxs("div",{className:"nt-two",children:[s.jsxs("div",{className:"nt-row",children:[s.jsx("span",{className:"nt-label",children:m("Department")}),s.jsx(Qe,{className:"task-pick",value:C,options:q,onChange:z,searchPlaceholder:m("Search…"),children:s.jsx("span",{className:C?"":"muted",children:C?W(C):m("— no department —")})})]}),s.jsxs("div",{className:"nt-row",children:[s.jsx("span",{className:"nt-label",children:m("Who does it")}),s.jsx(Qe,{className:"task-pick",value:E,searchPlaceholder:m("Search a person…"),options:[{value:"",label:m("— nobody yet —")},...r.filter(V=>V.fullName&&!V.plannedOut).map(V=>({value:V.id,label:V.fullName,sub:V.title,icon:s.jsx(Xe,{person:V,size:22})}))],onChange:j,children:E?s.jsxs("span",{className:"twho",children:[s.jsx(Xe,{person:r.find(V=>V.id===E),size:20}),s.jsx("span",{className:"twho-name",children:r.find(V=>V.id===E)?.fullName})]}):s.jsx("span",{className:"muted",children:m("— nobody yet —")})})]}),s.jsxs("div",{className:"nt-row",children:[s.jsx("span",{className:"nt-label",children:m(h?"Project or tool":"Project")}),s.jsx(Qe,{className:"task-pick",value:O,searchPlaceholder:m("Search…"),options:[{value:"",label:m("No project")},...u.map(V=>({value:V.id,label:V.name,sub:d.some(I=>I.id===V.id)?m("Tool"):m("Project")}))],onChange:w,children:s.jsx("span",{className:O?"":"muted",children:O?u.find(V=>V.id===O)?.name:m("No project")})})]}),s.jsxs("div",{className:"nt-row",children:[s.jsx("span",{className:"nt-label",children:m(U?"How often":"Due")}),U?s.jsx("span",{className:"rule-days",children:e4.map(V=>s.jsx("button",{type:"button",className:`rule-day ${D===V?"on":""}`,onClick:()=>M(V),children:t4(V,m.lang)},V))}):s.jsx(ka,{value:b||null,onChange:V=>A(V??"")})]})]}),U&&s.jsx("p",{className:"hint",children:m("Every week on the day chosen; anything finer is set on the task itself.")})]}),s.jsxs("div",{className:"actions nt-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:p,children:m("Cancel")}),s.jsx("button",{type:"button",className:"btn primary",disabled:!v.trim()||h&&!O,onClick:L,children:m("Create")})]})]})})}const Dc=e=>s.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e}),z1=()=>Dc(s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M6 3v11a3 3 0 0 0 3 3h9"}),s.jsx("path",{d:"M14 13l4 4-4 4"})]})),n4=()=>Dc(s.jsx(s.Fragment,{children:s.jsx("path",{d:"M4 6h16M4 12h16M4 18h10"})})),R1=()=>Dc(s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"3"}),s.jsx("path",{d:"M8 12.2l2.8 2.8L16.5 9"})]})),jw=()=>Dc(s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M14 4h6v6"}),s.jsx("path",{d:"M20 4l-9 9"}),s.jsx("path",{d:"M19 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h4"})]})),$1=()=>Dc(s.jsx("path",{d:"M21 11.5a8 8 0 0 1-8.5 8 9 9 0 0 1-3.4-.6L3 21l1.5-4.6A8 8 0 0 1 12.5 3.5a8 8 0 0 1 8.5 8z"})),Kr=["when","who","author","dept","project","zone","group","time"],a4={when:"minmax(170px, 230px)",who:"minmax(130px, 170px
15)",author:"minmax(130px, 170px)",dept:"minmax(110px, 200px)",project:"minmax(110px, 200px)",zone:"minmax(110px, 190px)",group:"minmax(110px, 190px)",time:"minmax(80px, 110px)"},Nw={when:"Dates",who:"Who does it",author:"Who set it",dept:"Department",project:"Project",zone:"Zone of responsibility",group:"Task group",time:"Time in work"},s4={once:["when","who","project","group"],recurring:["when","who","dept"],holder:["when","who","zone","group"]},Bp=(e,a,l=!1)=>new Date(Date.UTC(2024,0,e)).toLocaleDateString(a==="ru"?"ru-RU":"en-GB",{weekday:l?"short":"long",timeZone:"UTC"});function Pd(e,a){const l=a==="ru",i=e.every>1?`${e.every} `:"",r=(e.weekdays??[]).slice().sort((d,h)=>d-h),u=r.length===5&&r.every((d,h)=>d===h+1);if(e.repeat==="day")return l?e.every>1?`каждые ${e.every} дня`:"каждый день":e.every>1?`every ${e.every} days`:"every day";if(e.repeat==="week"){if(u&&e.every===1)return l?"по будням":"every weekday";const d=r.map(h=>Bp(h,a,r.length>2)).join(", ")||Bp(1,a);return e.every>1?l?`каждые ${i}недели: ${d}`:`every ${e.every} weeks: ${d}`:l?`каждый${r.length>1?"е":""} ${d}`:`every ${d}`}if(e.repeat==="month"){const d=e.monthday===0?l?"последний день":"the last day":l?`${e.monthday??1} число`:`the ${e.monthday??1}`;return l?e.every>1?`${d}, раз в ${e.every} мес.`:`${d} каждого месяца`:e.every>1?`${d}, every ${e.every} months`:`${d} of every month`}if(e.repeat==="year"){const h=new Date(Date.UTC(2024,(e.month??1)-1,Math.max(1,e.monthday??1))).toLocaleDateString(l?"ru-RU":"en-GB",{day:"numeric",month:"long",timeZone:"UTC"});return l?`ежегодно ${h}`:`every year on ${h}`}return""}function lc(e,a){return Ec.map(l=>({value:l,label:e(a&&l==="done"?"Done for this time round":Sa[l]),className:`opt-state ${l}`,heading:e(P3[l]),icon:s.jsx(Jn,{state:l})}))}const Tg=(e,a=Date.now())=>(e.workedMs??0)+(e.workStartedAt?Math.max(0,a-Date.parse(e.workStartedAt)):0),Ea=8,Mg=5,kw=Ea*Mg;function L1(e,a){const l=Math.round(e*60);if(l<=0)return a("less than a minute");if(l<60)return a("{n} min",{n:l});const i=Math.floor(l/(kw*60)),r=l-i*kw*60,u=Math.floor(r/(Ea*60)),d=r-u*Ea*60,h=Math.floor(d/60),g=d%60;return[i?a("{n} w",{n:i}):"",u?a("{n} d",{n:u}):"",h?a("{n} h",{n:h}):"",g&&!i&&!u?a("{n} min",{n:g}):""].filter(Boolean).slice(0,2).join(" ")}const l4=e=>e("A working day is {h} hours, a week is {d} days",{h:Ea,d:Mg}),o4=(e,a)=>L1(e/36e5,a),i4=(e,a)=>Math.max(1,Math.round((Date.parse(a)-Date.parse(e))/864e5)+1);function U1(e){const a=e.trim().toLowerCase().replace(/,/g,".");if(!a)return null;let l=0,i=!1;for(const r of a.matchAll(/(\d+(?:\.\d+)?)\s*([a-zа-яії]*)/g)){const u=Number(r[1]);if(!Number.isFinite(u))continue;const d=r[2];i=!0,d.startsWith("w")||d.startsWith("н")||d.startsWith("тиж")?l+=u*Mg:d.startsWith("d")||d.startsWith("д")?l+=u:d.startsWith("h")||d.startsWith("ч")||d.startsWith("г")?l+=u/Ea:d.startsWith("m")||d.startsWith("м")||d.startsWith("хв")?l+=u/(Ea*60):l+=u}return i?Math.round(l*1e3)/1e3:null}const $o=(e,a)=>L1(e*Ea,a),r4=["min","h","d"],Sw={min:"min",h:"hours",d:"days"},Pp={min:Ea*60,h:Ea,d:1},_i=(e,a)=>a==="min"?Math.round(e*Pp.min):Math.round(e*Pp[a]*100)/100,c4=(e,a)=>Math.round(e/Pp[a]*1e6)/1e6,sp=e=>e==null||e<=0?"h":e>=1?"d":e*Ea>=1?"h":"min",u4=1.5;function d4(e,a=Date.now()){const l=(e.effortDays??0)*Ea*36e5;if(!l)return null;const i=Tg(e,a)/l;return i>u4?i:null}function ih({task:e,bare:a=!1}){const l=qe(),i=!!e.workStartedAt,[,r]=N.useState(0);N.useEffect(()=>{if(!i)return;const m=window.setInterval(()=>r(v=>v+1),3e4);return()=>window.clearInterval(m)},[i]);const u=Tg(e);if((!u||a&&u<6e4)&&!i)return a?null:s.jsx("span",{className:"hint",children:"—"});const d=o4(u,l),h=i?l("The clock is running: the task is in progress"):e.state==="review"?l("On hold: the task is in review"):e.state==="done"?l("Finished"):l("On hold"),g=!i&&e.state==="in_progress"&&u>0,p=d4(e),x=p?` · ${l("over the estimate of {plan} — {times}×",{plan:$o(e.effortDays??0,l),times:p.toFixed(1)})}`:"";return s.jsxs("span",{className:`worked ${i?"running":""} ${g?"paused":""} ${p?"over":""}`,title:`${l("Time in work")}: ${d} · ${h}${x} · ${l4(l)}`,children:[i&&s.jsx("span",{className:"worked-dot","aria-hidden":"true"}),g&&s.jsx("span",{className:"worked-pause","aria-hidden":"true",children:"⏸"}),d]})}const Cw=e=>e.toISOString().slice(0,10),Yp=(e,a)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+a),Ew=e=>Yp(e,-((e.getDay()+6)%7));function H1({tasks:e,people:a,holders:l,departments:i,me:r,holderId:u,onOpenTask:d}){const h=qe(),g=Cw(new Date),[p,x]=N.useState(()=>new Date(new Date().getFullYear(),new Date().getMonth(),1)),[m,v]=N.useState(()=>new Set(["doing","pulled","set"])),[k,T]=N.useState(!1),[S,C]=N.useState(!1),[z,E]=N.useState(!1),[j,O]=N.useState(!1),[w,b]=N.useState(()=>new Set(u?[]:r.personId?[r.personId]:[])),[A,D]=N.useState(null);N.useEffect(()=>{if(!A)return;const R=se=>{se.target.closest(".plan-pop, .plan-task")||D(null)},Q=se=>se.key==="Escape"&&D(null),le=()=>D(null);return document.addEventListener("mousedown",R),window.addEventListener("keydown",Q,!0),window.addEventListener("resize",le),window.addEventListener("scroll",le,!0),()=>{document.removeEventListener("mousedown",R),window.removeEventListener("keydown",Q,!0),window.removeEventListener("resize",le),window.removeEventListener("scroll",le,!0)}},[A]);const M=r.personId?a.find(R=>R.id===r.personId)??null:null,U=N.useMemo(()=>u?e.filter(R=>(R.projectId??R.toolId)===u):e,[e,u]),Y=N.useMemo(()=>{const R=new Set;for(const Q of U){Q.assigneeId&&R.add(Q.assigneeId),Q.authorId&&R.add(Q.authorId);for(const le of Q.people)R.add(le.personId)}return a.filter(Q=>R.has(Q.id)||w.has(Q.id)).sort((Q,le)=>Q.fullName.localeCompare(le.fullName))},[U,a,w]),q=R=>{if(!w.size)return"doing";for(const Q of w){if(R.assigneeId===Q)return"doing";if(R.people.some(le=>le.personId===Q))return"pulled";if(R.authorId===Q)return"set"}return null},W=N.useMemo(()=>U.map(R=>({x:R,how:q(R)})).filter(R=>!!R.how&&(!w.size||m.has(R.how))).filter(({x:R})=>z||R.kind==="recurring"?!0:Wn(R.state)).filter(({x:R})=>k?R.late&&Wn(R.state):!0).filter(({x:R})=>S?R.state==="in_progress":!0),[U,w,m,z,k,S]),L=N.useMemo(()=>U.map(R=>({x:R,how:q(R)})).filter(R=>!!R.how&&(!w.size||m.has(R.how))),[U,w,m]),V=N.useMemo(()=>{const R=Ew(p),Q=new Date(p.getFullYear(),p.getMonth()+1,0),le=[];for(let se=R;se<=Q||le.length%7!==0;se=Yp(se,1))le.push(se);return le},[p]),I=R=>{const Q=le=>le.kind==="recurring"?le.nextDue:le.dueOn;
15return W.filter(({x:le})=>{const se=Q(le);return le.startsOn&&se?R>=le.startsOn&&R<=se:(se??le.startsOn)===R}).sort((le,se)=>+(Q(se.x)===R)-+(Q(le.x)===R))},F=W.filter(({x:R})=>!R.dueOn&&!R.startsOn&&R.kind==="once"&&R.state!=="done"),_=h.lang==="ru"?"ru-RU":"en-GB",H=p.toLocaleDateString(_,{month:"long",year:"numeric"}),P=N.useMemo(()=>{const R=Ew(new Date);return[...Array(7)].map((Q,le)=>Yp(R,le).toLocaleDateString(_,{weekday:"short"}))},[_]),X=R=>l.find(Q=>Q.id===(R.projectId??R.toolId))?.name??i.find(Q=>Q.id===R.departmentId)?.name??"",ne=({x:R,how:Q},le)=>{const se=R.kind==="recurring"?R.nextDue:R.dueOn,ie=!le||se===le,K=R.assigneeId?a.find(ue=>ue.id===R.assigneeId):null;return s.jsxs("button",{type:"button",className:`plan-task ${R.state} ${Q} ${ie?"ends":"runs"} ${R.late&&Wn(R.state)?"late":""}`,title:R.title,onClick:ue=>{const xe=ue.currentTarget.getBoundingClientRect();D({x:R,how:Q,top:Math.min(xe.bottom+6,window.innerHeight-260),left:Math.min(Math.max(8,xe.left),window.innerWidth-320-8)})},children:[s.jsx(Jn,{state:R.state,size:11}),s.jsx("span",{className:"plan-task-title",children:R.title}),Q!=="doing"&&K&&s.jsx(Xe,{person:K,size:16})]},R.id)},pe=[{key:"doing",label:"Doing"},{key:"pulled",label:"Pulled in"},{key:"set",label:"Set it"}];return s.jsxs("div",{className:"planner",children:[s.jsxs("header",{className:"planner-head",children:[s.jsxs("div",{className:"planner-when",children:[s.jsx("button",{type:"button",className:"icon-btn",title:h("Previous month"),onClick:()=>x(new Date(p.getFullYear(),p.getMonth()-1,1)),children:"←"}),s.jsx("h2",{children:H}),s.jsx("button",{type:"button",className:"icon-btn",title:h("Next month"),onClick:()=>x(new Date(p.getFullYear(),p.getMonth()+1,1)),children:"→"}),s.jsx("button",{type:"button",className:"btn small",onClick:()=>x(new Date(new Date().getFullYear(),new Date().getMonth(),1)),children:h("Today")})]}),s.jsxs("div",{className:"planner-filters",children:[s.jsx(Qe,{className:"team-filter plan-who",value:"",keepOpen:!0,searchPlaceholder:h("Search a person…"),options:[{value:"",label:(w.size,h("Everybody")),icon:s.jsx("span",{className:`tick ${w.size?"":"on"}`,"aria-hidden":"true"})},...M?[{value:M.id,label:h("Me"),sub:M.fullName,icon:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`tick ${w.has(M.id)?"on":""}`,"aria-hidden":"true"}),s.jsx(Xe,{person:M,size:20})]})}]:[],...Y.filter(R=>R.id!==r.personId).map(R=>({value:R.id,label:R.fullName,sub:R.title,icon:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`tick ${w.has(R.id)?"on":""}`,"aria-hidden":"true"}),s.jsx(Xe,{person:R,size:20})]})}))],onChange:R=>b(Q=>{if(!R)return new Set;const le=new Set(Q);return le.has(R)?le.delete(R):le.add(R),le}),children:s.jsx("span",{className:"plan-whose",children:w.size===0?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"plan-whose-all","aria-hidden":"true",children:"👥"}),h("Everybody")]}):s.jsxs(s.Fragment,{children:[[...w].slice(0,3).map(R=>{const Q=a.find(le=>le.id===R);return Q?s.jsx(Xe,{person:Q,size:20},R):null}),w.size===1?a.find(R=>R.id===[...w][0])?.fullName??"":h("{n} people",{n:w.size})]})})}),s.jsx("span",{className:"plan-sep","aria-hidden":"true"}),s.jsxs("button",{type:"button",className:`tfilter tfilter-late ${k?"on":""}`,"aria-pressed":k,onClick:()=>T(R=>!R),children:[s.jsx("span",{className:"tfilter-dot","aria-hidden":"true"}),h("Overdue"),s.jsx("span",{className:"tfilter-n",children:L.filter(({x:R})=>R.late&&Wn(R.state)).length})]}),s.jsxs("button",{type:"button",className:`tfilter tfilter-doing ${S?"on":""}`,"aria-pressed":S,onClick:()=>C(R=>!R),children:[s.jsx("span",{className:"tfilter-dot","aria-hidden":"true"}),h("In work now"),s.jsx("span",{className:"tfilter-n",children:L.filter(({x:R})=>R.state==="in_progress").length})]}),s.jsxs("button",{type:"button",className:`tfilter tfilter-done ${z?"on":""}`,"aria-pressed":z,onClick:()=>E(R=>!R),children:[s.jsx("span",{className:"tfilter-dot","aria-hidden":"true"}),h("Closed")]}),s.jsxs("button",{type:"button",className:`tfilter ${j?"on":""}`,"aria-pressed":j,onClick:()=>O(R=>!R),children:[h("No date"),s.jsx("span",{className:"tfilter-n",children:F.length})]}),w.size>0&&s.jsx("span",{className:"plan-sep","aria-hidden":"true"}),w.size>0&&pe.map(R=>s.jsxs("button",{type:"button",className:`tfilter ${m.has(R.key)?"on":""}`,"aria-pressed":m.has(R.key),onClick:()=>v(Q=>{const le=new Set(Q);return le.has(R.key)?le.delete(R.key):le.add(R.key),le}),children:[h(R.label),s.jsx("span",{className:"tfilter-n",children:U.filter(Q=>q(Q)===R.key).length})]},R.key))]})]}),!u&&!r.personId&&w.size===0&&s.jsx("p",{className:"hint pad",children:h("This account is not tied to anybody on the map yet, so there is no work of its own to hear about. Settings → Users.")}),s.jsxs("div",{className:"planner-body",children:[s.jsxs("div",{className:"planner-cal",children:[s.jsx("div",{className:"pmonth-week pmonth-head",children:P.map(R=>s.jsx("span",{className:"pmonth-weekday",children:R},R))}),s.jsx("div",{className:"pmonth-grid",children:V.map(R=>{const Q=Cw(R),le=I(Q);return s.jsxs("div",{className:`pmonth-day ${R.getMonth()===p.getMonth()?"":"other"} ${Q===g?"today":""} ${(R.getDay()+6)%7>=5?"rest":""}`,children:[s.jsx("span",{className:"pmonth-n",children:R.getDate()}),s.jsxs("div",{className:"pmonth-tasks",children:[le.slice(0,3).map(se=>ne(se,Q)),le.length>3&&s.jsx("span",{className:"pmonth-more",children:h("and {n} more",{n:le.length-3})})]})]},Q)})})]}),j&&s.jsxs("section",{className:"plan-undated",children:[s.jsxs("h4",{children:[h("No date"),s.jsx("span",{className:"head-count",children:F.length})]}),F.length===0?s.jsx("p",{className:"hint pad",children:h("Everything has a date.")}):s.jsx("div",{className:"plan-list",children:F.map(R=>{const Q=R.x.assigneeId?a.find(le=>le.id===R.x.assigneeId):null;return s.jsxs("button",{type:"button",className:"plan-list-row",onClick:le=>{const se=le.currentTarget.getBoundingClientRect();D({x:R.x,how:R.how,top:Math.min(se.bottom+6,window.innerHeight-260),left:Math.min(Math.max(8,se.left),window.innerWidth-328)})},children:[s.jsx(Jn,{state:R.x.state,size:12}),s.jsx("span",{className:"plan-list-title",children:R.x.title}),s.jsx("span",{className:"plan-list-who",children:Q?s.jsxs(s.Fragment,{children:[s.jsx(Xe,{person:Q,size:18})," ",Q.fullName]}):s.jsx("span",{className:"hint",children:h("Empty")})}),s.jsx("span",{className:"plan-list-where hint",children:X(R.x)})]},R.x.id)})})]})]}
15),A&&s.jsxs("div",{className:"plan-pop",style:{top:A.top,left:A.left},role:"dialog","aria-label":A.x.title,children:[s.jsxs("div",{className:"plan-pop-head",children:[s.jsx(Jn,{state:A.x.state,size:14}),s.jsx("span",{className:"plan-pop-state",children:h(Sa[A.x.state])}),s.jsx("span",{className:"plan-pop-how",children:h(A.how==="set"?"Set the task":A.how==="pulled"?"Pulled into it":"Doing it")}),s.jsx("button",{type:"button",className:"icon-btn small",title:h("Close"),onClick:()=>D(null),children:"×"})]}),s.jsx("p",{className:"plan-pop-title",children:A.x.title}),s.jsxs("dl",{className:"plan-pop-facts",children:[X(A.x)&&s.jsxs("div",{children:[s.jsx("dt",{children:h("Where")}),s.jsx("dd",{children:X(A.x)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:h("Dates")}),s.jsxs("dd",{className:A.x.late&&Wn(A.x.state)?"late":"",children:[[A.x.startsOn,A.x.kind==="recurring"?A.x.nextDue:A.x.dueOn].filter(Boolean).map(R=>R.split("-").reverse().join(".")).join(" → ")||h("no date"),A.x.late&&Wn(A.x.state)&&` · ${h("overdue")}`]})]}),A.x.assigneeId&&s.jsxs("div",{children:[s.jsx("dt",{children:h("Who does it")}),s.jsx("dd",{children:(()=>{const R=a.find(Q=>Q.id===A.x.assigneeId);return R?s.jsxs("span",{className:"task-who",children:[s.jsx(Xe,{person:R,size:18})," ",R.fullName]}):null})()})]}),(A.x.effortDays!=null||A.x.workedMs>0||A.x.workStartedAt)&&s.jsxs("div",{children:[s.jsx("dt",{children:h("Time in work")}),s.jsxs("dd",{children:[s.jsx(ih,{task:A.x}),A.x.effortDays!=null&&s.jsx("span",{className:"hint",children:h("of {n} estimated",{n:$o(A.x.effortDays,h)})})]})]}),A.x.tags.length>0&&s.jsxs("div",{children:[s.jsx("dt",{children:h("Tags")}),s.jsx("dd",{className:"plan-pop-tags",children:A.x.tags.slice(0,4).map(R=>s.jsx("span",{className:"tag",children:R},R))})]})]}),s.jsx("button",{type:"button",className:"btn small primary plan-pop-go",onClick:()=>{const R=A.x.id;D(null),d(R)},children:h("Open the task")})]})]})}function Tw({onDone:e,label:a="+ Task"}){const l=qe(),[i,r]=N.useState(!1),[u,d]=N.useState("");if(!i)return s.jsx("button",{type:"button",className:"board-add",onClick:()=>r(!0),children:l(a)});const h=()=>{u.trim()&&e(u.trim()),d(""),r(!1)};return s.jsx("input",{className:"board-add-input",autoFocus:!0,value:u,maxLength:300,placeholder:l("Task name"),onChange:g=>d(g.target.value),onBlur:h,onKeyDown:g=>{g.key==="Enter"&&h(),g.key==="Escape"&&(d(""),r(!1))}})}function B1(e,a,l,i){return[...a.map(r=>({value:r.id,label:r.name,icon:s.jsx("span",{className:`tick ${l.includes(r.id)?"on":""}`,"aria-hidden":"true"}),removeTitle:e("Delete the group"),onRemove:()=>i(r)})),{value:"+",label:e("New group…"),divider:a.length>0}]}const h4=e=>e.name.includes(".")?e.name.split(".").pop().slice(0,4).toUpperCase():e.mime.split("/").pop().slice(0,4).toUpperCase(),f4=e=>e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`,id=e=>e.byName||e.byEmail||"—",Mw=e=>e.trim().slice(0,1).toUpperCase()||"?",lp=e=>e.mime.startsWith("image/"),Dw=e=>e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`,_w=e=>e.name.includes(".")?e.name.split(".").pop().slice(0,4).toUpperCase():e.mime.split("/").pop().slice(0,4).toUpperCase(),m4=()=>s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"M15.5 7.5v9a4.5 4.5 0 0 1-9 0V6a3 3 0 0 1 6 0v10a1.5 1.5 0 0 1-3 0V7.5"})}),p4=()=>s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M12 20h9"}),s.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z"})]}),g4=()=>s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("path",{d:"M3 6h18"}),s.jsx("path",{d:"M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2"}),s.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"})]});function y4({taskId:e,me:a,people:l,events:i=[],onUndo:r,say:u,version:d}){const h=qe(),[g,p]=N.useState(null),[x,m]=N.useState([]),[v,k]=N.useState(""),[T,S]=N.useState(null),[C,z]=N.useState(null),[E,j]=N.useState([]),[O,w]=N.useState(!1),[b,A]=N.useState(null),D=N.useRef(null),M=N.useRef(null),U=N.useMemo(()=>{const R=new Map;for(const Q of g??[]){const le=Q.byUser??Q.byEmail??"—";R.has(le)||R.set(le,R.size%2===1)}return R},[g]),Y=R=>U.get(R.byUser??R.byEmail??"—")===!0,q=N.useMemo(()=>{const R=(g??[]).map(Q=>({at:new Date(Q.at).getTime(),msg:Q}));for(const Q of i)R.push({at:new Date(`${Q.at}T12:00:00Z`).getTime(),run:Q});for(const Q of x)R.push({at:new Date(Q.at).getTime(),did:Q});return R.sort((Q,le)=>Q.at-le.at)},[g,i,x]),W=N.useMemo(()=>a.personId?l.find(R=>R.id===a.personId)??null:null,[a.personId,l]);async function L(R){const Q=[...R??[]];if(!Q.length)return;const le=await Promise.all(Q.map(K=>Se.uploadTaskFile(e,K).then(ue=>({up:ue,no:null}),ue=>({up:null,no:`${K.name} — ${h(ue.message)}`})))),se=le.map(K=>K.up).filter(K=>K!==null);se.length&&j(K=>[...K,...se]);const ie=le.map(K=>
15K.no).filter(Boolean);z(ie.length?ie.join("; "):null)}const V=N.useCallback((R=!0)=>{Se.taskComments(e).then(p,Q=>!R&&z(h(Q.message))),Se.taskEvents(e).then(m,()=>{})},[e]);N.useEffect(()=>{p(null),V(!1)},[e,V]),N.useEffect(()=>{const R=window.setInterval(()=>{document.hidden||V()},5e3),Q=()=>!document.hidden&&V();return document.addEventListener("visibilitychange",Q),()=>{window.clearInterval(R),document.removeEventListener("visibilitychange",Q)}},[V]),N.useEffect(()=>{d&&V()},[d,V]),N.useEffect(()=>{const R=D.current;R&&(R.style.height="auto",R.style.height=`${Math.min(R.scrollHeight+2,200)}px`)},[v]);async function I(){const R=v.trim();if(!(!R&&!E.length))try{if(T){const Q=await Se.editTaskComment(e,T,R);p(le=>(le??[]).map(se=>se.id===T?{...Q,files:se.files}:se)),S(null)}else{const Q=await Se.addTaskComment(e,R,E.map(le=>le.id));p(le=>[...le??[],Q]),j([])}k(""),z(null)}catch(Q){z(h(Q instanceof Error?Q.message:"Something went wrong"))}}async function F(R){if(await Dt(h("Delete this message?"),{okLabel:"Delete",danger:!0}))try{await Se.deleteTaskComment(e,R.id),p(Q=>(Q??[]).filter(le=>le.id!==R.id))}catch(Q){z(h(Q instanceof Error?Q.message:"Something went wrong"))}}const _=h.lang==="ru"?"ru-RU":"en-GB",H=R=>new Date(R).toLocaleTimeString(_,{hour:"2-digit",minute:"2-digit"}),P=R=>new Date(R).toLocaleString(_,{dateStyle:"medium",timeStyle:"short"}),X=R=>{const Q=new Date(R),le=Q.getFullYear()===new Date().getFullYear()?{day:"numeric",month:"long"}:{dateStyle:"long"};return Q.toLocaleDateString(_,le)},ne=R=>R.byPerson?s.jsx(Xe,{person:{id:R.byPerson,fullName:id(R),photoVersion:R.byPhoto},size:32,className:"chat-face",title:id(R)}):s.jsx("span",{className:`chat-ava ${R.byUser===a.id?"mine":""}`,"aria-hidden":"true",children:Mw(id(R))}),pe=R=>{const Q=R.filter(lp),le=R.filter(se=>!lp(se));return s.jsxs(s.Fragment,{children:[Q.length>0&&s.jsx("div",{className:"chat-shots",children:Q.map(se=>s.jsx("button",{type:"button",className:"chat-shot",title:se.name||h("Open"),onClick:()=>A(Se.taskFileUrl(e,se.id)),children:s.jsx("img",{src:Se.taskFileUrl(e,se.id),alt:se.name,loading:"lazy"})},se.id))}),le.length>0&&s.jsx("div",{className:"chat-files",children:le.map(se=>s.jsxs("a",{className:"chat-file",href:Se.taskFileUrl(e,se.id,!0),download:se.name||void 0,title:h("Download"),children:[s.jsx("span",{className:"chat-file-ext","aria-hidden":"true",children:_w(se)}),s.jsxs("span",{className:"chat-file-main",children:[s.jsx("span",{className:"chat-file-name",children:se.name||h("File")}),s.jsx("span",{className:"hint",children:Dw(se.size)})]})]},se.id))})]})};return s.jsxs("section",{className:"chat-card",children:[s.jsxs("header",{className:"chat-card-head",children:[s.jsx("h4",{children:h("Discussion")}),g&&g.length>0&&s.jsx("span",{className:"chat-count",children:g.length})]}),s.jsxs("div",{className:"chat-card-body",children:[C&&s.jsx("p",{className:"error",children:C}),g===null&&s.jsx("p",{className:"hint",children:"…"}),g?.length===0&&s.jsx("p",{className:"hint",children:h("Nothing said yet.")}),s.jsx("ul",{className:"chat-list",children:q.map((R,Q)=>{const le=q[Q-1],se=new Date(R.at).toDateString(),K=(!le||new Date(le.at).toDateString()!==se)&&s.jsx("li",{className:"chat-day",children:s.jsx("span",{children:X(new Date(R.at).toISOString())})},`d${R.at}`);if("did"in R){const ge=R.did;return s.jsxs(N.Fragment,{children:[K,s.jsxs("li",{className:"chat-event",children:[ge.byPerson?s.jsx(Xe,{person:{id:ge.byPerson,fullName:ge.byName??"",photoVersion:ge.byPhoto},size:20,className:"chat-face"}):s.jsx("span",{className:"chat-event-mark","aria-hidden":"true"}),s.jsxs("span",{className:"chat-event-text",children:[ge.byName&&s.jsx("strong",{children:ge.byName})," ",u(ge)]}),s.jsx("span",{className:"chat-when",title:P(ge.at),children:H(ge.at)})]})]},`e${ge.id}`)}if("run"in R){const ge=R.run;return s.jsxs(N.Fragment,{children:[K,s.jsxs("li",{className:`chat-event ${ge.state}`,children:[ge.byPerson?s.jsx(Xe,{person:{id:ge.byPerson,fullName:ge.by??"",photoVersion:ge.byPhoto},size:20,className:"chat-face"}):s.jsx("span",{className:`run ${ge.state}`,"aria-hidden":"true"}),s.jsxs("span",{className:"chat-event-text",children:[ge.by&&s.jsx("strong",{children:ge.by})," ",ge.state==="done"?h("marked it done"):h("skipped it")," · ",ge.on]}),s.jsx("span",{className:"chat-when",title:P(`${ge.at}T12:00:00Z`),children:ge.at.split("-").reverse().join(".")}),r&&s.jsx("button",{type:"button",className:"link",onClick:()=>r(ge.on),children:h("take back")})]})]},`r${ge.on}`)}const ue=R.msg,xe=le&&"msg"in le?le.msg:null,Ne=!!xe&&xe.byUser===ue.byUser&&new Date(ue.at).getTime()-new Date(xe.at).getTime()<10*6e4,He=ue.byUser===a.id,ee=Y(ue);return s.jsxs(N.Fragment,{children:[K,s.jsxs("li",{className:`chat-msg ${ee?"right":"left"} ${Ne?"run":""}`,children:[Ne?s.jsx("span",{className:"chat-gutter","aria-hidden":"true"}):ne(ue),s.jsxs("div",{className:"chat-bubble",children:[!Ne&&s.jsxs("strong",{className:"chat-who",children:[id(ue),He&&s.jsxs("span",{className:"chat-you",children:[" · ",h("you")]})]}),ue.body&&s.jsx("p",{className:"chat-body",children:ue.body}),ue.files.length>0&&pe(ue.files),s.jsxs("span",{className:"chat-when",title:P(ue.at),children:[H(ue.at),ue.editedAt&&` · ${h("edited")}`]})]}),He&&s.jsxs("span",{className:"chat-acts",children:[s.jsx("button",{type:"button",className:"chat-act",title:h("edit"),"aria-label":h("edit"),onClick:()=>{S(ue.id),k(ue.body),D.current?.focus()},children:s.jsx(p4,{})}),s.jsx("button",{type:"button",className:"chat-act danger",title:h("delete"),"aria-label":h("delete"),onClick:()=>F(ue),children:s.jsx(g4,{})})]})]})]},ue.id)})})]}),s.jsxs("div",{className:`chat-compose ${O?"dropping":""}`,onDragOver:R=>{R.preventDefault(),w(!0)},onDragLeave:()=>w(!1),onDrop:R=>{R.preventDefault(),w(!1),L(R.dataTransfer.files)},children:[s.jsxs("div",{className:"chat-compose-side",children:[W?s.jsx(Xe,{person:W,size:32,className:"chat-face",title:W.fullName}):s.jsx("span",{className:"chat-ava mine","aria-hidden":"true",children:Mw(a.name||a.email)}),s.jsx("button",{type:"button",className:"chat-clip",title:h("Attach a file"),"aria-label":h("Attach a file"),onClick:()=>M.current?.click(),children:s.jsx(m4,{})}),s.jsx("input",{ref:M,type:"file",multiple:!0,hidden:!0,onChange:R=>{L(R.target.files),R.target.value=""}})]}),s.jsxs("div",{className:"chat-compose-main",children:[E.length>0&&s.jsx("div",{className:"chat-pending",children:E.map(R=>lp(R)?s.jsxs("span",{className:"chat-shot",children:[s.jsx("img",{src:Se.taskFileUrl(e,R.id),alt:R.name}),s.jsx("button",{type:"button",className:"shot-x",title:h("Remove"),onClick:()=>j(Q=>Q.filter(le=>le.id!==R.id)),children:"×"})]},R.id):s.jsxs("span",{className:"chat-file pending",children:[s.jsx("span",{className:"chat-file-ext","aria-hidden":"true",children:_w(R)}),s.jsxs("span",{className:"chat-file-main",children:[s.jsx("span",{className:"chat-file-name",children:R.name||h("File")}),s.jsx("span",{className:"hint",children:Dw(R.size)})]}),s.jsx("button",{type:"button",className:"shot-x",title:h("Remove"),onClick:()=>j(Q=>Q.filter(le=>le.id!==R.id)),children:"×"})]},R.id))}),s.jsx("textarea",{ref:D,rows:1,value:v,placeholder:h(T?"Change the message…":"Write something, or drop a file…"),onChange:R=>k(R.target.value),onPaste:R=>{R.clipboardData.files.length&&(R.preventDefault(),L(R.clipboardData.files))},onKeyDown:R=>
15{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),I()),R.key==="Escape"&&T&&(S(null),k(""))}}),s.jsx("div",{className:"chat-compose-foot",children:s.jsxs("span",{className:"chat-acts",children:[T&&s.jsx("button",{type:"button",className:"btn small",onClick:()=>{S(null),k("")},children:h("Cancel")}),s.jsx("button",{type:"button",className:"btn small primary",disabled:!v.trim()&&!E.length,onClick:I,children:h(T?"Save":"Send")})]})})]})]}),b&&s.jsx("div",{className:"shot-zoom",role:"dialog",onClick:()=>A(null),children:s.jsx("img",{src:b,alt:""})})]})}const x4=/^(https?:\/\/|mailto:|\/)/i,v4=/^\/api\/tasks\/[\w-]+\/files\/[\w-]+/;function To(e,a=0){const l=[];let i=e,r=a;const u=[{re:/!\[([^\]]*)\]\(([^)\s]+)\)/,make:h=>v4.test(h[2])?s.jsx("img",{src:h[2],alt:h[1]},r++):s.jsx("span",{children:h[0]},r++)},{re:/\[([^\]]+)\]\(([^)\s]+)\)/,make:h=>x4.test(h[2])?s.jsx("a",{href:h[2],target:"_blank",rel:"noopener noreferrer",children:h[1]},r++):s.jsx("span",{children:h[0]},r++)},{re:/`([^`]+)`/,make:h=>s.jsx("code",{children:h[1]},r++)},{re:/<((?:https?:\/\/|mailto:)[^>\s]+)>/,make:h=>s.jsx("a",{href:h[1],target:"_blank",rel:"noopener noreferrer",children:h[1]},r++)},{re:/\*\*([^*]+)\*\*/,make:h=>s.jsx("strong",{children:h[1]},r++)},{re:/__([^_]+)__/,make:h=>s.jsx("strong",{children:h[1]},r++)},{re:new RegExp("(?<![\\w*])\\*([^*\\n]+)\\*(?![\\w*])"),make:h=>s.jsx("em",{children:h[1]},r++)},{re:new RegExp("(?<![\\w_])_([^_\\n]+)_(?![\\w_])"),make:h=>s.jsx("em",{children:h[1]},r++)},{re:/~~([^~]+)~~/,make:h=>s.jsx("s",{children:h[1]},r++)},{re:/(https?:\/\/[^\s<]+)/,make:h=>s.jsx("a",{href:h[1],target:"_blank",rel:"noopener noreferrer",children:h[1]},r++)}];let d=0;for(;i&&d++<500;){let h=null;for(const g of u){const p=i.match(g.re);p&&p.index!==void 0&&(!h||p.index<h.at)&&(h={at:p.index,m:p,make:g.make})}if(!h)break;h.at>0&&l.push(i.slice(0,h.at)),l.push(h.make(h.m)),i=i.slice(h.at+h.m[0].length)}return i&&l.push(i),l}const Ow=e=>e.replace(/^\||\|$/g,"").split("|").map(a=>a.trim()),wd=/^(\s*)([-*+•·–—]|\d+[.)])\s+(.*)$/;function P1({lines:e}){const a=[];let l=null;for(const u of e){const d=u.match(wd),h=u.match(/^\s*/)[0].length;d&&(l===null||h<=l)?(l=l===null?h:l,a.push({ordered:/\d/.test(d[2]),body:d[3],kids:[]})):a.length&&a[a.length-1].kids.push(u.slice(Math.min(u.length-u.trimStart().length,(l??0)+1)))}if(!a.length)return null;const r=a[0].ordered?"ol":"ul";return s.jsx(r,{children:a.map((u,d)=>{const h=u.body.match(/^\[([ xX])\]\s+(.*)$/);return s.jsxs("li",{className:h?"md-tick":void 0,children:[h?s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"checkbox",checked:h[1]!==" ",readOnly:!0})," ",To(h[2])]}):To(u.body),u.kids.length>0&&s.jsx(P1,{lines:u.kids})]},d)})})}function Aw({text:e}){const a=e.replace(/\r\n/g,`
16`).split(`
17`),l=[];let i=0,r=0;for(;i<a.length;){const u=a[i];if(!u.trim()){i++;continue}if(u.trim().startsWith("```")){const g=[];for(i++;i<a.length&&!a[i].trim().startsWith("```");)g.push(a[i++]);i++,l.push(s.jsx("pre",{children:s.jsx("code",{children:g.join(`
18`)})},r++));continue}if(/^\s*(---|\*\*\*|___)\s*$/.test(u)){l.push(s.jsx("hr",{},r++)),i++;continue}const d=u.match(/^(#{1,4})\s+(.*)$/);if(d){const g=d[1].length,p=["h2","h3","h4","h5"][g-1];l.push(s.jsx(p,{children:To(d[2])},r++)),i++;continue}if(u.includes("|")&&/^\s*\|?[^|]*\|/.test(u)&&i+1<a.length&&/^\s*\|?[\s:-]*-[\s:|-]*$/.test(a[i+1])){const g=Ow(u);i+=2;const p=[];for(;i<a.length&&a[i].includes("|");)p.push(Ow(a[i++]));l.push(s.jsx("div",{className:"md-table",children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsx("tr",{children:g.map((x,m)=>s.jsx("th",{children:To(x)},m))})}),s.jsx("tbody",{children:p.map((x,m)=>s.jsx("tr",{children:x.map((v,k)=>s.jsx("td",{children:To(v)},k))},m))})]})},r++));continue}if(/^\s*>\s?/.test(u)){const g=[];for(;i<a.length&&/^\s*>\s?/.test(a[i]);)g.push(a[i++].replace(/^\s*>\s?/,""));l.push(s.jsx("blockquote",{children:To(g.join(" "))},r++));continue}if(wd.test(u)){const g=[];for(;i<a.length&&(wd.test(a[i])||g.length&&/^\s{2,}\S/.test(a[i]));)g.push(a[i++]);l.push(s.jsx(P1,{lines:g},r++));continue}const h=[];for(;i<a.length&&a[i].trim()&&!/^\s*(#{1,4}\s|>|```)/.test(a[i])&&!wd.test(a[i]);)h.push(a[i++]);l.push(s.jsx("p",{children:h.map((g,p)=>s.jsxs("span",{children:[To(g),p<h.length-1&&s.jsx("br",{})]},p))},r++))}return s.jsx("div",{className:"md",children:l})}const Dg=e=>e instanceof HTMLElement&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.tagName==="SELECT"||e.isContentEditable),Qr=e=>e.preventDefault(),op=(e,a)=>({x:Math.min(e.x,a.x),y:Math.min(e.y,a.y),width:Math.abs(e.x-a.x),height:Math.abs(e.y-a.y)}),ql=(e,a)=>e.code===`Key${a.toUpperCase()}`||e.key.toLowerCase()===a.toLowerCase(),b4=new Set(["P","DIV","SECTION","ARTICLE","HEADER","FOOTER","TR","BR"]);function w4(e,a){const l=e.tagName;if(!a.trim())return a;
18if(l==="STRONG"||l==="B")return`**${a}**`;if(l==="EM"||l==="I")return`*${a}*`;if(l==="S"||l==="DEL"||l==="STRIKE")return`~~${a}~~`;if(l==="CODE")return a.includes("`")?a:`\`${a}\``;if(l==="A"){const i=e.getAttribute("href")??"";return/^(https?:\/\/|mailto:|\/)/i.test(i)?`[${a}](${i})`:a}return a}const Iw=e=>`| ${e.map(a=>a.replace(/\|/g,"\\|").replace(/\n+/g," ").trim()).join(" | ")} |`;function Ii(e,a){if(e.nodeType===3)return(e.textContent??"").replace(/\s+/g," ");if(e.nodeType!==1)return"";const l=e,i=l.tagName;if(i==="SCRIPT"||i==="STYLE"||i==="NOSCRIPT")return"";const r=()=>[...l.childNodes].map(u=>Ii(u,a)).join("");if(i==="BR")return`
19`;if(/^H[1-6]$/.test(i)){const u=Math.min(4,Number(i[1]));return`
20
21${"#".repeat(u)} ${r().trim()}
22
23`}if(i==="PRE")return`
24
25\`\`\`
26${(l.textContent??"").replace(/\n+$/,"")}
27\`\`\`
28
29`;if(i==="BLOCKQUOTE")return`
30
31${[...l.childNodes].map(d=>Ii(d,a)).join("").trim().split(`
32`).map(d=>`> ${d}`).join(`
33`)}
34
35`;if(i==="HR")return`
36
37---
38
39`;if(i==="UL"||i==="OL"){const u=i==="OL";let d=0;return`
40${[...l.children].filter(g=>g.tagName==="LI").map(g=>{d++;const p=[...g.childNodes].filter(T=>!(T.nodeType===1&&(T.tagName==="UL"||T.tagName==="OL"))).map(T=>Ii(T,a)).join("").trim(),x=[...g.children].filter(T=>T.tagName==="UL"||T.tagName==="OL").map(T=>Ii(T,a+1)).join("").trim(),m=g.querySelector('input[type="checkbox"]'),v=m?`- [${m.checked?"x":" "}] `:u?`${d}. `:"- ";return`${"  ".repeat(a)}${v}${p}${x?`
41${x.split(`
42`).map(T=>T.startsWith("  ")?T:`  ${T}`).join(`
43`)}`:""}`}).join(`
44`)}
45`}if(i==="TABLE"){const u=[...l.querySelectorAll("tr")].map(g=>[...g.children].map(p=>Ii(p,a).trim()));if(!u.length)return"";const d=u[0],h=u.slice(1);return`
46
47${Iw(d)}
48| ${d.map(()=>"---").join(" | ")} |
49${h.map(Iw).join(`
50`)}
51
52`}if(i==="IMG"){const u=l.getAttribute("src")??"",d=l.getAttribute("alt")||"image";return/^https?:\/\//i.test(u)?`[${d}](${u})`:""}if(b4.has(i)){const u=r();return u.trim()?`
53
54${u.trim()}
55
56`:""}return w4(l,r())}function j4(e){return N4(Ii(e,0))}const N4=e=>e.replace(/\u00a0/g," ").replace(/[ \t]+\n/g,`
57`).replace(/\n{3,}/g,`
58
59`).trim();function k4(e){try{return j4(new DOMParser().parseFromString(e,"text/html").body)}catch{return""}}function S4(e){return/<(h[1-6]|strong|b|em|i|ul|ol|li|a|table|blockquote|pre|code|s|del)\b/i.test(e)}const Y1=`
60| Колонка | Колонка |
61| --- | --- |
62|  |  |
63`,zw="orgami.richPreview",C4=Y1,E4=[{key:"text",label:"Normal text",mark:""},{key:"h1",label:"Heading 1",mark:"# "},{key:"h2",label:"Heading 2",mark:"## "},{key:"h3",label:"Heading 3",mark:"### "},{key:"bullets",label:"Bulleted list",mark:"- "},{key:"numbers",label:"Numbered list",mark:"1. "},{key:"ticks",label:"Checklist",mark:"- [ ] "},{key:"quote",label:"Block quote",mark:"> "},{key:"code",label:"Code block",block:"```\n\n```\n"},{key:"table",label:"Table",block:Y1},{key:"rule",label:"Divider",block:`
64---
65`}],Xl=e=>s.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e}),T4=()=>Xl(s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"4",cy:"6.5",r:"1.2",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"4",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"4",cy:"17.5",r:"1.2",fill:"currentColor",stroke:"none"}),s.jsx("path",{d:"M9 6.5h11M9 12h11M9 17.5h11"})]})),M4=()=>Xl(s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M9 6.5h11M9 12h11M9 17.5h11"}),s.jsx("path",{d:"M3 5.5l1.3-.8V8"}),s.jsx("path",{d:"M3 11h2.2L3 14h2.4"}),s.jsx("path",{d:"M3.1 16.6h2.1L3.4 18.4h.6a1 1 0 1 1 0 2H3.1"})]})),D4=()=>Xl(s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M9 6.5h11M9 12h11M9 17.5h11"}),s.jsx("path",{d:"M2.6 6.2l1 1 2-2.2"}),s.jsx("path",{d:"M2.6 16.9l1 1 2-2.2"})]})),_4=()=>Xl(s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M7 7H4.5A1.5 1.5 0 0 0 3 8.5V11h4V7z"}),s.jsx("path",{d:"M7 11c0 3-1.4 4.6-3.5 5.3"}),s.jsx("path",{d:"M17 7h-2.5A1.5 1.5 0 0 0 13 8.5V11h4V7z"}),s.jsx("path",{d:"M17 11c0 3-1.4 4.6-3.5 5.3"})]})),O4=()=>Xl(s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M10 13.5a4 4 0 0 0 5.7 0l2.8-2.8a4 4 0 1 0-5.7-5.7l-1.6 1.6"}),s.jsx("path",{d:"M14 10.5a4 4 0 0 0-5.7 0l-2.8 2.8a4 4 0 1 0 5.7 5.7l1.6-1.6"})]})),A4=()=>Xl(s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"4.5",width:"18",height:"15",rx:"2"}),s.jsx("path",{d:"M3 9.5h18M3 14.5h18M9.5 9.5v10M15 9.5v10"})]})),I4=()=>Xl(s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M2.5 12S6 6.5 12 6.5 21.5 12 21.5 12 18 17.5 12 17.5 2.5 12 2.5 12z"}),s.jsx("circle",{cx:"12",cy:"12",r:"2.8"})]})),z4=()=>Xl(s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"4.5",width:"18",height:"15",rx:"2"}),s.jsx("circle",{cx:"8.5",cy:"9.5",r:"1.6"}),s.jsx("path",{d:"M21 15.5l-4.5-4.2L8 19.5"})]}));function V1({value:e,onCommit:a,placeholder:l,onUpload:i,big:r,clamp:u}){const d=qe(),[h,g]=N.useState(!1),[p,x]=N.useState(e),[m,v]=N.useState(!1),[k,T]=N.useState(()=>{try{return localStorage.getItem(zw)==="1"}catch{return!1}}),S=N.useRef(null),C=N.useRef(null),[z,E]=N.useState(!1),[j,O]=N.useState(!1),w=N.useRef(null),[b,A]=N.useState(null);N.useEffect(()=>x(e),[e]),N.useEffect(()=>{const I=C.current;if(!u||!I)return;const F=()=>E(I.scrollHeight>u+24);F();const _=new ResizeObserver(F);return _.observe(I),()=>_.disconnect()},[u,e,h,j]),N.useEffect(()=>{const I=S.current;!h||!I||(I.style.height="auto",I.style.height=`${Math.max(I.scrollHeight+2,r?420:200)}px`)},[p,h,r]);function D(I=p){g(!1),I!==e&&a(I)}function M(I,F=I,_=""){const H=S.current;if(!H)return;const{selectionStart:P,selectionEnd:X}=H,ne=p.slice(P,X),pe=ne.startsWith(I)&&ne.endsWith(F)&&ne.length>=I.length+F.length,R=p.slice(P-I.length,P)===I&&p.slice(X,X+F.length)===F;if(ne&&(pe||R)){const se=pe?P:P-I.length,ie=pe?X:X+F.length,K=pe?ne.slice(I.length,ne.length-F.length):ne;x(p.slice(0,se)+K+p.slice(ie)),requestAnimationFrame(()=>{H.focus(),H.setSelectionRange(se,se+K.length)});return}const Q=ne||_,le=p.slice(0,P)+I+Q+F+p.slice(X);x(le),requestAnimationFrame(()=>{H.focus(),H.setSelectionRange(P+I.length,P+I.length+Q.length)})}function U(I){const F=S.current;if(!F)return;const _=p.lastIndexOf(`
66`,F.selectionStart-1)+1,H=p.indexOf(`
67`,F.selectionEnd),P=H===-1?p.length:H,X=p.slice(_,P).split(`
68`).map(ne=>ne.startsWith(I)?ne.slice(I.length):I+ne).join(`
69`);x(p.slice(0,_)+X+p.slice(P)),requestAnimationFrame(()=>F.focus())}const Y=b?E4.filter(I=>d(I.label).toLowerCase().includes(b.find.toLowerCase())):[];function q(I){const F=S.current;if(!F||!b)return;const _=p.slice(0,b.at),H=p.slice(b.at+1+b.find.length),P=_.lastIndexOf(`
70`)+1,X=_.slice(P),ne=I.block?_+I.block+H:_.slice(0,P)+(I.mark??"")+X.replace(/^(#{1,4}\s|[-*+]\s(\[[ xX]\]\s)?|\d+\.\s|>\s)/,"")+H,pe=I.block?P+X.length+I.block.length:P+(I.mark??"").length+X.length;A(null),x(ne),requestAnimationFrame(()=>{F.focus(),F.setSelectionRange(pe,pe)})}const W=()=>{const I=S.current;if(!I||!b)return 0;const F=p.slice(0,b.at).split(`
71`).length,_=parseFloat(getComputedStyle(I).lineHeight)||24;return Math.max(0,F*_-I.scrollTop+8)};function L(I,F){if(x(I),I[F-1]==="/"&&(F===1||I[F-2]===`
72`||I[F-2]===" ")){A({at:F-1,find:""});return}if(!b)return;const H=I.slice(b.at+1,F);F<=b.at||/[\n\s]/.test(H)||I[b.at]!=="/"?A(null):A({at:b.at,find:H})}async function V(I){const F=[...I??[]];if(!(!F.length||!i)){v(!0);try{for(const _ of F){const H=await i(_),P=_.type.startsWith("image/")?`
73![${_.name}](${H})
74`:`
75[${_.name}](${H})
76`;x(X=>X+P)}}finally{v(!1)}}}if(!h){const I=!!u&&z&&!j;return s.jsxs("div",{className:"rich-fold",children:[s.jsx("div",{ref:C,className:`rich-read ${r?"doc-body":""} ${e?"":"empty"} ${I?"folded":""}`,style:I?{maxHeight:u}:void 0,role:"button",tabIndex:0,title:d("Click to edit"),onClick:()=>g(!0),onKeyDown:F=>{F.key==="Enter"&&g(!0)},children:e?s.jsx(Aw,{text:e}):s.jsx("span",{className:"hint",children:l})}),!!u&&z&&s.jsx("button",{type:"button",className:"rich-more",onClick:F=>{F.stopPropagation(),O(_=>!_)},children:d(j?"Collapse":"Expand in full")})]})}return s.jsxs("div",{className:`rich ${r?"rich-big":""}`,children:[s.jsxs("div",{className:"rich-bar",children:[s.jsx("button",{type:"button",title:`${d("Bold")} · Ctrl+B`,onClick:()=>M("**","**",d("bold")),children:s.jsx("b",{children:"B"})}),s.jsx("button",{type:"button",title:`${d("Italic")} · Ctrl+I`,onClick:()=>M("*","*",d("italic")),children:s.jsx("i",{children:"I"})}),s.jsx("button",{type:"button",title:d("Strikethrough"),onClick:()=>M("~~","~~",d("text")),children:s.jsx("s",{children:"S"})}),s.jsx("span",{className:"rich-sep"}),s.jsx("button",{type:"button",title:d("Heading"),onClick:()=>U("## "),children:"H"}),s.jsx("button",{type:"button",title:d("Bulleted list"),onClick:()=>U("- "),children:s.jsx(T4,{})}),s.jsx("button",{type:"button",title:d("Numbered list"),onClick:()=>U("1. "),children:s.jsx(M4,{})}),s.jsx("button",{type:"button",title:d("Checklist"),onClick:()=>U("- [ ] "),children:s.jsx(D4,{})}),s.jsx("button",{type:"button",title:d("Quote"),onClick:()=>U("> "),children:s.jsx(_4,{})}),s.jsx("span",{className:"rich-sep"}),s.jsx("button",{type:"button",title:`${d("Link")} · Ctrl+K`,onClick:()=>M("[","](https://)",d("link")),children:s.jsx(O4,{})}),s.jsx("button",{type:"button",title:d("Code"),onClick:()=>M("`","`","code"),children:"</>"}),s.jsx("button",{type:"button",title:d("Table"),onClick:()=>M(C4,"",""),children:s.jsx(A4,{})}),i&&s.jsx("button",{type:"button",title:d("Picture or file"),disabled:m,onClick:()=>w.current?.click(),children:s.jsx(z4,{})}),s.jsx("input",{ref:w,type:"file",multiple:!0,hidden:!0,onChange:I=>{V(I.target.files),I.target.value=""}}),s.jsx("span",{className:"rich-sep"}),s.jsx("button",{type:"button",className:k?"on":"",title:d("Show how it will read"),"aria-pressed":k,onClick:()=>{T(I=>{try{localStorage.setItem(zw,I?"0":"1")}catch{}return!I})},children:s.jsx(I4,{})}),s.jsxs("span",{className:"rich-acts",children:[s.jsx("button",{type:"button",className:"btn small",onClick:()=>{x(e),g(!1)},children:d("Cancel")}),s.jsx("button",{type:"button",className:"btn small primary",onClick:()=>D(),children:d("Done")})]})]}),b&&Y.length>
760&&s.jsx("div",{className:"slash-menu",style:{top:W()},role:"listbox","aria-label":d("Blocks to put in"),children:Y.map(I=>s.jsx("button",{type:"button",role:"option","aria-selected":!1,onMouseDown:F=>{F.preventDefault(),q(I)},children:d(I.label)},I.key))}),s.jsxs("div",{className:`rich-split ${k?"with-preview":""}`,children:[s.jsx("textarea",{ref:S,autoFocus:!0,className:`rich-box ${r?"doc-text":""}`,value:p,placeholder:l,onChange:I=>L(I.target.value,I.target.selectionStart),onPaste:I=>{if(i&&I.clipboardData.files.length){I.preventDefault(),V(I.clipboardData.files);return}const F=I.clipboardData.getData("text/html");if(!F||!S4(F))return;const _=k4(F);if(!_)return;I.preventDefault();const H=I.currentTarget,{selectionStart:P,selectionEnd:X}=H,ne=p.slice(0,P)+_+p.slice(X);x(ne),requestAnimationFrame(()=>{H.focus(),H.setSelectionRange(P+_.length,P+_.length)})},onDrop:I=>{i&&I.dataTransfer.files.length&&(I.preventDefault(),V(I.dataTransfer.files))},onKeyDown:I=>{I.stopPropagation();const F=I.currentTarget,_=I.metaKey||I.ctrlKey;if(_&&!I.altKey){if(ql(I,"b"))return I.preventDefault(),M("**","**",d("bold"));if(ql(I,"i"))return I.preventDefault(),M("*","*",d("italic"));if(ql(I,"k"))return I.preventDefault(),M("[","](https://)",d("link"))}if(I.key==="Enter"&&!I.shiftKey&&!_&&!b){const H=p.lastIndexOf(`
77`,F.selectionStart-1)+1,X=p.slice(H,F.selectionStart).match(/^(\s*)([-*+]\s\[[ xX]\]\s|[-*+]\s|\d+[.)]\s|>\s)(.*)$/);if(X){if(I.preventDefault(),!X[3].trim()){const Q=p.slice(0,H)+p.slice(F.selectionStart);x(Q),requestAnimationFrame(()=>{F.focus(),F.setSelectionRange(H,H)});return}const ne=/^\s*\d/.test(X[2])?`${Number.parseInt(X[2],10)+1}${X[2].includes(")")?")":"."} `:X[2].replace(/\[[xX]\]/,"[ ]"),pe=`
78${X[1]}${ne}`,R=F.selectionStart;x(p.slice(0,R)+pe+p.slice(F.selectionEnd)),requestAnimationFrame(()=>{F.focus(),F.setSelectionRange(R+pe.length,R+pe.length)});return}}if(I.key==="Tab"&&!_){const H=p.lastIndexOf(`
79`,F.selectionStart-1)+1,P=p.slice(H,p.indexOf(`
80`,H)===-1?p.length:p.indexOf(`
81`,H));if(/^\s*([-*+]|\d+[.)])\s/.test(P)){I.preventDefault();const X=F.selectionStart;if(I.shiftKey){const ne=P.replace(/^ {1,2}/,""),pe=P.length-ne.length;x(p.slice(0,H)+ne+p.slice(H+P.length)),requestAnimationFrame(()=>{F.focus(),F.setSelectionRange(Math.max(H,X-pe),Math.max(H,X-pe))})}else x(p.slice(0,H)+"  "+p.slice(H)),requestAnimationFrame(()=>{F.focus(),F.setSelectionRange(X+2,X+2)});return}}if(I.key==="Escape"){if(b){A(null);return}x(e),g(!1)}if(b&&(I.key==="Enter"||I.key==="Tab")&&Y.length){I.preventDefault(),q(Y[0]);return}I.key==="Enter"&&(I.metaKey||I.ctrlKey)&&D()}}),k&&s.jsx("div",{className:"rich-preview","aria-label":d("Show how it will read"),children:p.trim()?s.jsx(Aw,{text:p}):s.jsx("span",{className:"hint",children:l})})]})]})}function q1({children:e,onClose:a}){const l=N.useRef(null);return N.useEffect(()=>{const i=u=>{l.current?.parentElement?.contains(u.target)||a()},r=u=>{u.key==="Escape"&&a()};return document.addEventListener("mousedown",i),window.addEventListener("keydown",r,!0),()=>{document.removeEventListener("mousedown",i),window.removeEventListener("keydown",r,!0)}},[a]),s.jsx("span",{className:"rule-pop",ref:l,children:e})}const R4={planner:"/",notices:"/notices",team:"/team",departments:"/departments",map:"/map",projects:"/projects",tools:"/tools",planning:"/planning",tasks:"/tasks",recurring:"/recurring",stats:"/insights",settings:"/settings"},$4={planner:"planner",notices:"notices",team:"team",people:"team",departments:"departments",map:"map",projects:"projects",tools:"tools",planning:"planning",tasks:"tasks",recurring:"recurring",insights:"stats",settings:"settings"};function Rw(e=new URL(window.location.href)){const[a,l]=e.pathname.split("/").filter(Boolean),i=$4[a??""]??"planner";return{tab:i,projectId:i==="projects"||i==="tools"?l??null:null,personId:i==="team"?l??null:null,departmentId:i==="departments"?l??null:null,taskId:i==="tasks"||i==="recurring"?l??null:null,view:e.searchParams.get("view"),dept:e.searchParams.get("dept"),only:e.searchParams.get("only"),from:e.searchParams.get("from")}}function Kn(e){const a=e.tab==="team"&&e.personId?`/people/${e.personId}`:R4[e.tab]+((e.tab==="projects"||e.tab==="tools")&&e.projectId?`/${e.projectId}`:e.tab==="departments"&&e.departmentId?`/${e.departmentId}`:(e.tab==="tasks"||e.tab==="recurring")&&e.taskId?`/${e.taskId}`:""),l=new URLSearchParams;e.view&&l.set("view",e.view),e.dept&&l.set("dept",e.dept),e.only&&l.set("only",e.only),e.from&&l.set("from",e.from);const i=l.toString();return a+(i?`?${i}`:"")}const Vp="orgami:route";function L4(e,{replace:a=!1}={}){e!==window.location.pathname+window.location.search&&(window.history[a?"replaceState":"pushState"]({},"",e),window.dispatchEvent(new Event(Vp)))}function U4(){const[e,a]=N.useState(()=>Rw());N.useEffect(()=>{const i=()=>a(Rw());return window.addEventListener("popstate",i),window.addEventListener(Vp,i),()=>{window.removeEventListener("popstate",i),window.removeEventListener(Vp,i)}},[]);const l=N.useCallback((i,r)=>L4(Kn(i),r),[]);return{route:e,go:l}}function G1({task:e,onChange:a,onClose:l}){const i=qe(),r=e.repeat??"week",u=e.weekdays??[],d=h=>{const g=u.includes(h)?u.filter(p=>p!==h):[...u,h].sort((p,x)=>p-x);a({weekdays:g.length?g:u})};return s.jsxs("div",{className:"rule-editor",role:"group","aria-label":i("How often"),children:[s.jsxs("span",{className:"rule-line",children:[s.jsx("span",{className:"rule-label",children:i("Repeat")}),i("once every"),s.jsx("input",{className:"task-day",type:"number",min:1,max:99,value:e.every,"aria-label":i("How many"),onChange:h=>a({every:Math.min(99,Math.max(1,Number(h.target.value)||1))})}),s.jsx(Qe,{className:"task-pick",value:r,options:[{value:"day",label:i("day")},{value:"week",label:i("week")},{value:"month",label:i("month")},{value:"year",label:i("year")}],onChange:h=>a({repeat:h,weekdays:h==="week"?u.length?u:[1]:null,monthday:h==="month"||h==="year"?e.monthday??1:null,month:h==="year"?e.month??1:null}),children:s.jsx("span",{children:i(r)})})]}),r==="week"&&s.jsxs("span",{className:"rule-line",children:[s.jsx("span",{className:"rule-label",children:i("On days")}),s.jsxs("span",{className:"rule-days",children:[[1,2,3,4,5,6,7].map(h=>s.jsx("button",{type:"button",className:`rule-day ${u.includes(h)?"on":""}`,onClick:()=>d(h),children:Bp(h,i.lang,!0)},h)),s.jsx("button",{type:"button",className:"rule-day wide",onClick:()=>a({weekdays:[1,2,3,4,5]}),children:i("Mon–Fri")})]})]}),(r==="month"||r==="year")&&s.jsxs("span",{className:"rule-line",children:[s.jsx("span",{className:"rule-label",children:i("On the day")}),r==="year"&&s.jsx(Qe,{className:"task-pick",value:String(e.month??1),options:Array.from({length:12},(h,g)=>({value:String(g+1),label:new Date(Date.UTC(2024,g,1)).toLocaleDateString(i.lang==="ru"?"ru-RU":"en-GB",{month:"long",timeZone:"UTC"})})),onChange:h=>a({month:Number(h)}),children:s.jsx("span",{children:new Date(Date.UTC(2024,(e.month??1)-1,1)).toLocaleDateString(i.lang==="ru"?"ru-RU":"en-GB",{month:"long",timeZone:"UTC"})})}),s.jsx("input",{className:"task-day",type:"number",min:1,max:31,value:e.monthday===0?"":e.monthday??1,"aria-label":i("Day of the month"),onChange:h=>a({monthday:Math.min(31,Math.max(1,Number(h.target.value)||1))})}),r==="month"&&s.jsx("button",{type:"button",className:`rule-day wide ${e.monthday===0?"on":""}`,onClick:()=>a({monthday:e.monthday===0?1:0}),children:i("last day")})]}),s.jsxs("span",{className:"rule-line",children:[s.jsx("span",{className:"rule-label",children:i("Starting from")}),s.jsx(ka,{value:e.anchorOn,clearable:!1,onChange:h=>h&&a({anchorOn:h}),title:i("Starting from")}),s.jsx("button",{type:"button",className:"btn small primary rule-done",onClick:l,children:i("Done")})]})]})}function X1(e,a){const l=r=>typeof r=="string"&&r?r.split("-").reverse().join("."):"",i=(r,u)=>Array.isArray(r)?r.map(d=>
81u(String(d))).filter(Boolean).join(", "):"";return r=>{const u=r.data;switch(r.kind){case"created":return u.parentId?e("added a subtask"):e("created the task");case"state":return e("moved it to {to}",{to:e(Sa[u.to]??String(u.to))});case"title":return e("renamed it");case"details":return e("changed the description");case"assignee":return u.to?e("handed it to {who}",{who:a.person(u.to)}):e("left it to nobody");case"due":return u.to?e("set the date to {day}",{day:l(u.to)}):e("took the date off");case"dept":return u.to?e("moved it to the {dept} department",{dept:a.dept(u.to)}):e("took it out of the department");case"holder":return u.to?e("moved it into {name}",{name:a.holder(u.to)}):e("took it out of the project");case"group":return u.to?e("filed it under {name}",{name:a.group(u.to)}):e("took it out of the group");case"zones":return u.added?.length?e("put it in the zone {name}",{name:i(u.added,a.zone)}):e("took it out of the zone {name}",{name:i(u.removed,a.zone)});case"tags":return u.added?.length?e("tagged it {tags}",{tags:i(u.added,d=>d)}):e("removed the tag {tags}",{tags:i(u.removed,d=>d)});case"crew":return u.added?.length?e("pulled in {who}",{who:i(u.added,a.person)}):e("took {who} off it",{who:i(u.removed,a.person)});case"time":return u.action==="pause"?e("paused the clock"):e("started the clock again");case"overrun":return e("went over the estimate — {times}× of it",{times:String(u.times??"")});case"repeat":return e("changed how often it comes round");case"check":return u.action==="add"?e("added “{title}” to the checklist",{title:String(u.title??"")}):u.action==="done"?e("ticked off “{title}”",{title:String(u.title??"")}):u.action==="undone"?e("unticked “{title}”",{title:String(u.title??"")}):e("removed “{title}” from the checklist",{title:String(u.title??"")});case"file":return u.action==="add"?e("attached {name}",{name:String(u.name??"")}):e("removed the file {name}",{name:String(u.name??"")});default:return e("changed something")}}}function H4({task:e,all:a,groups:l,actions:i,onOpen:r,departments:u,companies:d,people:h,projects:g,tools:p,goals:x,onOpenHolder:m,onOpenPerson:v,back:k,onAddZone:T,me:S,refresh:C,onBack:z,onDelete:E}){const j=qe(),[O,w]=N.useState(null),[b,A]=N.useState(!1),[D,M]=N.useState(""),[U,Y]=N.useState(""),[q,W]=N.useState(!1),L=N.useRef(null),V=!!O&&O.id===e.id&&Date.parse(O.updatedAt)>Date.parse(e.updatedAt),I=O?.id===e.id?V?{...e,...O}:{...e,details:O.details,checks:O.checks,files:O.files,links:O.links,runs:O.runs}:e,F=[e.updatedAt,C,e.state,e.title,e.hasDetails,e.assigneeId,e.dueOn,e.groupIds.join(","),e.tags.join(","),e.areaIds.join(","),e.people.length,e.checksTotal,e.checksDone,e.filesTotal,e.subtasks,e.nextDue,e.projectId,e.toolId,e.departmentId].join("|"),[_,H]=N.useState(()=>sp(e.effortDays)),[P,X]=N.useState(()=>e.effortDays!=null?String(_i(e.effortDays,sp(e.effortDays))):"");N.useEffect(()=>{const ee=I.effortDays,ge=ee==null||_i(ee,_)>=.01?_:sp(ee);H(ge),X(ee!=null?String(_i(ee,ge)):"")},[I.id,I.effortDays]);function ne(){const ee=P.trim().replace(",","."),ge=ee?Number(ee):null,Le=ge!=null&&Number.isFinite(ge)&&ge>0?c4(ge,_):null;Le!==(I.effortDays??null)&&ue({effortDays:Le}),X(Le!=null?String(_i(Le,_)):"")}N.useEffect(()=>{let ee=!0;return Se.task(e.id).then(ge=>ee&&w(ge),()=>{}),()=>{ee=!1}},[e.id,F]);const pe=a.filter(ee=>ee.parentId===I.id),R=[...new Set(a.flatMap(ee=>ee.tags))].sort();N.useEffect(()=>{const ee=ge=>{ge.key==="Escape"&&!Dg(ge.target)&&z()};return window.addEventListener("keydown",ee),()=>window.removeEventListener("keydown",ee)},[z]);const Q=new Map(h.map(ee=>[ee.id,ee])),le=[...g,...p],se=ee=>ee&&d.find(ge=>ge.id===ee)?.name||"",ie=I.departmentId?u.find(ee=>ee.id===I.departmentId):null,K=I.projectId||I.toolId?le.find(ee=>ee.id===(I.projectId??I.toolId)):null,ue=ee=>i.patch(I.id,ee),xe=I.kind==="recurring",Ne=I.assigneeId?Q.get(I.assigneeId):null,He=K?l.filter(ee=>ee.projectId===K.id||ee.toolId===K.id):[];return s.jsxs("div",{className:"task-page",children:[s.jsxs("div",{className:"task-page-main",children:[s.jsxs("div",{className:"task-page-head",children:[s.jsxs("button",{type:"button",className:"back-link",onClick:z,children:["← ",k?j("Back to {where}",{where:k.label}):j(xe?"Back to the recurring ones":"Back to the tasks")]}),s.jsx("span",{className:`task-kind ${xe?"recurring":""}`,children:j(xe?"Recurring task":"Task")}),s.jsxs("div",{className:"task-page-actions",children:[s.jsx("button",{type:"button",className:"btn small",onClick:async()=>{const ee=window.location.origin+Kn({tab:xe?"recurring":"tasks",taskId:I.id});try{await navigator.clipboard.writeText(ee),W(!0),window.setTimeout(()=>W(!1),2e3)}catch{window.prompt(j("Copy the link"),ee)}},children:j(q?"Link copied":"Share")}),s.jsx("button",{type:"button",className:`btn small ${I.aiReads?"":"on"}`,title:I.aiReads?j("The assistant reads this task. Press to close it."):j("Closed from the assistant: it neither reads nor changes this task. Press to open it."),onClick:()=>ue({aiReads:!I.aiReads}),children:I.aiReads?j("Assistant sees it"):j("Hidden from the assistant")}),s.jsx("button",{type:"button",className:"btn small danger",onClick:E,children:j("Delete")})]})]}),s.jsx(bn,{className:"task-page-title",value:I.title,placeholder:j("The task"),onCommit:ee=>ee.trim()&&ue({title:ee.trim()})}),s.jsxs("div",{className:"task-props",children:[s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("State")}),s.jsx("span",{className:"prop-value",children:s.jsx(Qe,{className:`task-state ${I.state}`,value:I.state,options:lc(j,xe),onChange:ee=>xe&&ee==="done"?i.done(I.id):ue({state:ee}),children:s.jsxs("span",{className:"state-chip",children:[s.jsx(Jn,{state:I.state}),j(Sa[I.state])]})})})]}),!xe&&s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("Time in work")}),s.jsxs("span",{className:"prop-value",children:[I.workedMs>0||I.workStartedAt?s.jsx(ih,{task:I}):s.jsx("span",{className:"muted",children:j("The clock has not started")}),I.state!=="done"&&s.jsxs("button",{type:"button",className:`time-btn ${I.workStartedAt?"on":""}`,title:I.workStartedAt?j("Hold the clock — the task stays in work"):I.state==="in_progress"?j("Pick the clock up again"):j("Take it into work — the clock starts"),onClick:()=>I.state==="in_progress"?i.timer(I.id,!I.workStartedAt):ue({state:"in_progress"}),children:[s.jsx("span",{"aria-hidden":"true",children:I.workStartedAt?"⏸":"▶"}),I.workStartedAt?j("Pause"):I.state==="in_progress"&&I.workedMs>0?j("Carry on"):j("Start")]}),I.effortDays!=null&&(I.workedMs>0||I.workStartedAt)&&s.jsx("span",{className:"hint",children:j("of {n} estimated",{n:$o(I.effortDays,j)})}),I.workedMs>0&&!I.workStartedAt&&s.jsx("button",{type:"button",className:"ghost-btn small",title:j("Correct the time by hand"),onClick:async()=>{const ee=await us(j("How much time was really spent?"),{value:$o(I.workedMs/(Ea*36e5),j),placeholder:j("for example: 3ч 20м"),okLabel:"Save"});if(ee===null)return;const ge=U1(ee);ge!=null&&ue({workedMs:Math.round(ge*Ea*36e5)})},children:j("Correct")})]})]}),xe&&s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("How often")}),s.jsxs("span",{className:"prop-value rule-anchor",children:[s.jsx("button",{type:"button",className:`task-rule ${b?"on":""}`,onClick:()=>A(ee=>!ee),children:Pd(I,j.lang)}),b&&s.jsx(q1,{onClose:()=>A(!1),children:s.jsx(G1,{task:I,onChange:ue,onClose:()=>A(!1)})})]})]}),xe&&I.missed.length>0&&s.jsxs("div",{className:"prop missed-prop",children:[s.jsx("span",{className:"prop-label",children:j("Missed")}),s.jsxs("span",{className:"prop-value",children:[s.jsx("span",{className:`missed-count ${I.missed.length>=3?"many":""}`,children:j("{n} times in a row",{n:I.missed.length})}),s.jsxs("span",{className:"missed-list",children:[I.missed.slice(0,8).map(ee=>s.jsxs("span",{className:"missed-day",children:[ee.slice(5).split("-").reverse().join("."),s.jsx("button",{type:"button",title:j("Mark this one done"),onClick:()=>i.done(I.id,"done",ee),children:"✓"}),s.jsx("button",{type:"button",title:j("Skip this one"),onClick:()=>i.done(I.id,"skipped",ee),children:"×"})]},ee)),I.missed.length>8&&s.jsx("span",{className:"hint",children:j("and {n} more",{n:I.missed.length-8})})]})]})]}),s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j(xe?"Next time":"Dates")}),s.jsx("span",{className:"prop-value",children:xe?s.jsxs("span",{className:I.late?"task-due late":"",children:[I.nextDue,I.late&&` · ${j("overdue")}`,I.streak>1&&s.jsxs("span",{className:"task-streak",children:[" ×",I.streak]})]}):s.jsxs("span",{className:"task-span",children:[s.jsx(ka,{value:
81I.startsOn,onChange:ee=>ue({startsOn:ee}),placeholder:j("Start"),title:j("From when it is worked on")}),s.jsx("span",{className:"task-span-arrow","aria-hidden":"true",children:"→"}),s.jsx(ka,{value:I.dueOn,late:I.late,onChange:ee=>ue({dueOn:ee}),placeholder:j("Due"),title:j("By when it must be done")}),I.startsOn&&I.dueOn&&s.jsx("span",{className:"hint",children:j("{n} days",{n:i4(I.startsOn,I.dueOn)})})]})})]}),s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("Time estimate")}),s.jsx("span",{className:"prop-value",children:s.jsxs("span",{className:"estimate",children:[s.jsx("input",{className:"estimate-n",inputMode:"decimal",value:P,placeholder:"—",onChange:ee=>X(ee.target.value),onBlur:()=>ne(),onKeyDown:ee=>{ee.key==="Enter"&&ee.target.blur(),ee.key==="Escape"&&X(I.effortDays!=null?String(_i(I.effortDays,_)):"")}}),s.jsx(Qe,{className:"estimate-unit",value:_,options:r4.map(ee=>({value:ee,label:j(Sw[ee])})),onChange:ee=>{const ge=ee;H(ge),I.effortDays!=null&&X(String(_i(I.effortDays,ge)))},children:s.jsx("span",{children:j(Sw[_])})})]})})]}),s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("Goal")}),s.jsx("span",{className:"prop-value",children:s.jsx(Qe,{className:"task-pick",value:I.goalId??"",searchPlaceholder:j("Search…"),options:[{value:"",label:j("— none —")},...x.map(ee=>({value:ee.id,label:ee.title,sub:ee.endsOn.split("-").reverse().join(".")}))],onChange:ee=>ue({goalId:ee||null}),children:I.goalId&&x.find(ee=>ee.id===I.goalId)?s.jsx("span",{className:"chip-value",children:x.find(ee=>ee.id===I.goalId).title}):s.jsx("span",{className:"muted",children:j("Empty")})})})]}),s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("Who does it")}),s.jsxs("span",{className:"prop-value",children:[s.jsx(Qe,{className:"task-pick",value:I.assigneeId??"",searchPlaceholder:j("Search a person…"),options:[{value:"",label:j("— nobody yet —")},...h.filter(ee=>ee.fullName&&!ee.plannedOut).map(ee=>({value:ee.id,label:ee.fullName,sub:ee.title,icon:s.jsx(Xe,{person:ee,size:22})}))],onChange:ee=>ue({assigneeId:ee||null}),children:Ne?s.jsxs("span",{className:"task-who",children:[s.jsx(Xe,{person:Ne,size:20})," ",Ne.fullName]}):s.jsx("span",{className:"muted",children:j("Empty")})}),Ne&&s.jsx("button",{type:"button",className:"icon-open",title:j("Open the card"),"aria-label":j("Open the card"),onClick:()=>v(Ne.id),children:s.jsx(jw,{})}),!Ne&&S.personId&&s.jsx("button",{type:"button",className:"ghost-btn",onClick:()=>ue({assigneeId:S.personId}),children:j("Take it")})]})]}),s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("Who else")}),s.jsx("span",{className:"prop-value",children:s.jsx(Qe,{className:"task-pick",value:"",keepOpen:!0,searchPlaceholder:j("Search a person…"),options:h.filter(ee=>ee.fullName&&ee.id!==I.assigneeId).map(ee=>({value:ee.id,label:ee.fullName,sub:ee.title,icon:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`tick ${I.people.some(ge=>ge.personId===ee.id)?"on":""}`,"aria-hidden":"true"}),s.jsx(Xe,{person:ee,size:22})]})})),onChange:ee=>{const ge=I.people.some(Le=>Le.personId===ee);ue({people:ge?I.people.filter(Le=>Le.personId!==ee):[...I.people,{personId:ee,role:""}]})},children:I.people.length?s.jsx("span",{className:"task-who",children:I.people.map(ee=>Q.get(ee.personId)).filter(Boolean).map(ee=>s.jsx(Xe,{person:ee,size:20,title:ee.fullName},ee.id))}):s.jsx("span",{className:"muted",children:j("Empty")})})})]}),s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("Department")}),s.jsx("span",{className:"prop-value",children:s.jsx(Qe,{className:"task-pick",value:I.departmentId??"",searchPlaceholder:j("Search…"),options:[{value:"",label:j("No department")},...u.map(ee=>({value:ee.id,label:ee.name,sub:se(ee.companyId)}))],onChange:ee=>ue({departmentId:ee||null}),children:s.jsx("span",{className:ie?"":"muted",children:ie?`${ie.name}${se(ie.companyId)?` · ${se(ie.companyId)}`:""}`:j("Empty")})})})]}),s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("Project")}),s.jsxs("span",{className:"prop-value",children:[s.jsx(Qe,{className:"task-pick",value:I.projectId??I.toolId??"",searchPlaceholder:j("Search…"),options:[{value:"",label:j("No project")},...le.map(ee=>({value:ee.id,label:ee.name,sub:p.some(ge=>
81ge.id===ee.id)?j("Tool"):j("Project")}))],onChange:ee=>{const ge=p.some(Le=>Le.id===ee);ue({projectId:ee&&!ge?ee:null,toolId:ee&&ge?ee:null})},children:s.jsx("span",{className:K?"":"muted",children:K?K.name:j("Empty")})}),K&&s.jsx("button",{type:"button",className:"icon-open",title:j("Open"),"aria-label":j("Open"),onClick:()=>m(K.id),children:s.jsx(jw,{})})]})]}),K&&s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("Zone of responsibility")}),s.jsx("span",{className:"prop-value",children:s.jsx(Qe,{className:"task-pick",value:"",keepOpen:!0,searchPlaceholder:j("Search…"),options:[...K.areas.map(ee=>({value:ee.id,label:ee.name,icon:s.jsx("span",{className:`tick ${I.areaIds.includes(ee.id)?"on":""}`,"aria-hidden":"true"})})),{value:"+",label:j("New zone…"),divider:K.areas.length>0}],onChange:async ee=>{if(ee!=="+"){ue({areaIds:I.areaIds.includes(ee)?I.areaIds.filter(me=>me!==ee):[...I.areaIds,ee]});return}const ge=await us(j("New zone"),{placeholder:j("Zone name")});if(!ge||!T)return;const Le=await T(K.id,ge);Le&&ue({areaIds:[...I.areaIds,Le.id]})},children:I.areaIds.length?s.jsx("span",{className:"chip-value",children:I.areaIds.map(ee=>K.areas.find(ge=>ge.id===ee)?.name).filter(Boolean).join(", ")}):s.jsx("span",{className:"muted",children:K.areas.length?j("No zone"):j("no zones yet")})})})]}),K&&s.jsxs("div",{className:"prop",children:[s.jsx("span",{className:"prop-label",children:j("Task group")}),s.jsx("span",{className:"prop-value",children:s.jsx(Qe,{className:"task-pick",value:"",keepOpen:!0,searchPlaceholder:j("Search…"),options:B1(j,He,I.groupIds,async ee=>{const ge=a.filter(me=>me.groupIds.includes(ee.id)).length,Le=ge?j("Delete the group “{name}”? {n} tasks will stay, but outside it.",{name:ee.name,n:ge}):j("Delete the group “{name}”?",{name:ee.name});await Dt(Le,{okLabel:"Delete",danger:!0})&&i.removeGroup(ee.id)}),onChange:async ee=>{if(ee!=="+"){ue({groupIds:I.groupIds.includes(ee)?I.groupIds.filter(_e=>_e!==ee):[...I.groupIds,ee]});return}const ge=await us(j("New group"),{placeholder:j("Group name")});if(!ge)return;const Le=p.some(_e=>_e.id===K.id),me=await i.addGroup({name:ge,projectId:Le?null:K.id,toolId:Le?K.id:null});me&&ue({groupIds:[...I.groupIds,me.id]})},children:I.groupIds.length?s.jsx("span",{className:"chip-value",children:I.groupIds.map(ee=>He.find(ge=>ge.id===ee)?.name).filter(Boolean).join(", ")}):s.jsx("span",{className:"muted",children:j("Outside a group")})})})]}),s.jsxs("div",{className:"prop wide",children:[s.jsx("span",{className:"prop-label",children:j("Tags")}),s.jsx("span",{className:"prop-value",children:s.jsx(Cg,{tags:I.tags,suggestions:R,onChange:ee=>ue({tags:ee})})})]})]}),s.jsxs("div",{className:"task-sections",children:[s.jsxs("section",{className:"task-page-section wide",children:[s.jsx("h4",{children:j("Description")}),s.jsx(V1,{value:I.details,clamp:340,placeholder:j("What has to be done, in detail…"),onCommit:ee=>ue({details:ee}),onUpload:async ee=>{const ge=await Se.pinTaskFile(I.id,ee);return Se.taskFileUrl(I.id,ge.id)}})]}),s.jsxs("section",{className:"task-page-section wide",children:[s.jsxs("h4",{children:[j("Subtasks"),pe.length>0&&s.jsx("span",{className:"hint",children:j("{done} of {all}",{done:pe.filter(ee=>ee.state==="done").length,all:pe.length})})]}),s.jsx("ul",{className:"subtask-list",children:pe.map(ee=>s.jsxs("li",{className:`subtask ${ee.state==="done"?"is-done":""}`,children:[s.jsx(Qe,{className:`task-state ${ee.state}`,value:ee.state,options:lc(j,!1),onChange:ge=>i.patch(ee.id,{state:ge}),children:s.jsxs("span",{className:"state-chip",children:[s.jsx(Jn,{state:ee.state}),j(Sa[ee.state])]})}),s.jsx("a",{className:"task-title",href:Kn({tab:"tasks",taskId:ee.id}),onClick:ge=>{ge.metaKey||ge.ctrlKey||ge.shiftKey||ge.altKey||ge.button!==0||(ge.preventDefault(),r(ee.id))},children:ee.title}),s.jsxs("span",{className:"subtask-side",children:[ee.tags.map(ge=>s.jsx("span",{className:`tag hue-${Yl(ge)}`,children:ge},ge)),s.jsx(Qe,{className:"task-pick",value:ee.assigneeId??"",searchPlaceholder:j("Search a person…"),options:[{value:"",label:j("— nobody yet —")},...h.filter(ge=>ge.fullName&&!ge.plannedOut).map(ge=>({value:ge.id,label:ge.fullName,sub:ge.title,icon:s.jsx(Xe,{person:ge,size:22})}))],onChange:ge=>i.patch(ee.id,{assigneeId:ge||null}),children:ee.assigneeId&&Q.get(ee.assigneeId)?s.jsx(Xe,{person:Q.get(ee.assigneeId),size:20,title:Q.get(ee.assigneeId).fullName}):s.jsx("span",{className:"ava-empty","aria-hidden":"true"})}),s.jsx(ka,{value:ee.dueOn,late:ee.late,onChange:ge=>i.patch(ee.id,{dueOn:ge})})]})]},ee.id))}),s.jsx("input",{className:"goal-step-add",value:D,placeholder:j("+ Subtask"),onChange:ee=>M(ee.target.value),onKeyDown:async ee=>{ee.key!=="Enter"||!D.trim()||(await i.create({title:D.trim(),kind:"once",parentId:I.id,departmentId:I.departmentId,projectId:I.projectId,toolId:I.toolId,areaIds:I.areaIds}),M(""))}})]}),s.jsxs("section",{className:"task-page-section",children:[s.jsxs("h4",{children:[j("Checklist"),I.checks.length>0&&s.jsx("span",{className:"hint",children:j("{done} of {all}",{done:I.checks.filter(ee=>ee.done).length,all:I.checks.length})})]}),I.checks.length>0&&s.jsx("ul",{className:"check-list",children:I.checks.map(ee=>s.jsxs("li",{className:ee.done?"is-done":"",children:[s.jsx("input",{type:"checkbox",checked:ee.done,onChange:ge=>i.patchCheck(I.id,ee.id,{done:ge.target.checked})}),s.jsx(bn,{value:ee.title,onCommit:ge=>ge&&i.patchCheck(I.id,ee.id,{title:ge})}),s.jsx("button",{type:"button",className:"icon-btn small",title:j("Delete"),onClick:()=>i.removeCheck(I.id,ee.id),children:"×"})]},ee.id))}),s.jsx("input",{className:"goal-step-add",value:U,placeholder:j("+ Checklist item"),onChange:ee=>Y(ee.target.value),onKeyDown:ee=>{ee.key!=="Enter"||!U.trim()||(i.addCheck(I.id,U.trim()),Y(""))}})]}),s.jsxs("section",{className:"task-page-section",children:[s.jsxs("h4",{children:[j("Files"),I.files.length>0&&s.jsx("span",{className:"hint",children:I.files.length})]}),I.files.length>0&&s.jsx("ul",{className:"file-list",children:I.files.map(ee=>s.jsxs("li",{children:[s.jsxs("a",{className:"chat-file",href:Se.taskFileUrl(I.id,ee.id,!0),download:ee.name||void 0,children:[s.jsx("span",{className:"chat-file-ext","aria-hidden":"true",children:h4(ee)}),s.jsxs("span",{className:"chat-file-main",children:[s.jsx("span",{className:"chat-file-name",children:ee.name||j("File")}),s.jsx("span",{className:"hint",children:f4(ee.size)})]})]}),s.jsx("button",{type:"button",className:"icon-btn small",title:j("Delete"),onClick:()=>i.removeFile(I.id,ee.id),children:"×"})]},ee.id))}),s.jsx("button",{type:"button",className:"ghost-btn",onClick:()=>L.current?.click(),children:j("+ Attach file")}
81),s.jsx("input",{ref:L,type:"file",multiple:!0,hidden:!0,onChange:async ee=>{for(const ge of[...ee.target.files??[]])await i.addFile(I.id,ge);ee.target.value=""}})]})]})]}),s.jsx(y4,{taskId:I.id,me:S,people:h,events:xe?[...I.runs].reverse():[],onUndo:ee=>i.undo(I.id,ee),version:F,say:X1(j,{person:ee=>Q.get(ee)?.fullName??"",holder:ee=>le.find(ge=>ge.id===ee)?.name??"",dept:ee=>u.find(ge=>ge.id===ee)?.name??"",group:ee=>l.find(ge=>ge.id===ee)?.name??"",zone:ee=>le.flatMap(ge=>ge.areas).find(ge=>ge.id===ee)?.name??""})})]})}function B4({rows:e,all:a,actions:l,kind:i,isRecurring:r,departmentId:u,holderId:d,tools:h,personById:g,unfolded:p,setUnfolded:x,onOpen:m,patch:v,remove:k}){const T=qe(),[S,C]=N.useState(null),[z,E]=N.useState(null);return s.jsx("div",{className:"board",children:Ec.map(j=>{const O=e.filter(w=>w.state===j);return s.jsxs("section",{className:`board-col ${z===j?"over":""}`,onDragOver:w=>{w.preventDefault(),E(j)},onDragLeave:()=>E(w=>w===j?null:w),onDrop:w=>{w.preventDefault(),E(null);const b=w.dataTransfer.getData("text/task")||S,A=b?a.find(D=>D.id===b):null;C(null),!(!A||A.state===j)&&(A.kind==="recurring"&&j==="done"?l.done(A.id):v(A.id,{state:j}))},children:[s.jsxs("header",{className:"board-head",children:[s.jsx(Jn,{state:j,size:15}),T(r&&j==="done"?"Done for this time round":Sa[j]),s.jsx("span",{className:"board-count",children:O.length})]}),s.jsxs("div",{className:"board-cards",children:[O.map(w=>{const b=w.assigneeId?g.get(w.assigneeId):null,A=a.filter(D=>D.parentId===w.id);return s.jsxs("article",{className:`card-task ${S===w.id?"lifted":""} ${w.late?"late":""}`,draggable:!0,onDragStart:D=>{D.dataTransfer.setData("text/task",w.id),D.dataTransfer.effectAllowed="move",C(w.id
81)},onDragEnd:()=>C(null),children:[s.jsx("a",{className:"task-title",href:Kn({tab:w.kind==="recurring"?"recurring":"tasks",taskId:w.id}),onClick:D=>{D.metaKey||D.ctrlKey||D.shiftKey||D.altKey||D.button!==0||(D.preventDefault(),m(w.id))},children:w.title}),s.jsx("button",{type:"button",className:"card-x",title:T("Delete"),onClick:()=>k(w),children:"×"}),w.tags.length>0&&s.jsx("span",{className:"card-tags",children:w.tags.map(D=>s.jsx("span",{className:`tag hue-${Yl(D)}`,children:D},D))}),s.jsxs("footer",{className:"card-foot",children:[b?s.jsx(Xe,{person:b,size:20,title:b.fullName}):s.jsx("span",{className:"ava-empty","aria-hidden":"true"}),A.length>0&&s.jsxs("button",{type:"button",className:"tmark card-kids-toggle",title:T("Subtasks"),"aria-expanded":p.has(w.id),onClick:()=>x(D=>{const M=new Set(D);return M.has(w.id)?M.delete(w.id):M.add(w.id),M}),children:[s.jsx(z1,{})," ",A.filter(D=>D.state==="done").length,"/",A.length]}),w.checksTotal>0&&s.jsxs("span",{className:"tmark",title:T("Checklist"),children:[s.jsx(R1,{})," ",w.checksDone,"/",w.checksTotal]}),w.comments>0&&s.jsxs("span",{className:"tmark",title:T("Discussion"),children:[s.jsx($1,{})," ",w.comments]}),s.jsx(ih,{task:w,bare:!0}),s.jsx("span",{className:"card-when",children:w.kind==="recurring"?s.jsx("span",{className:`task-due ${w.late?"late":""}`,children:w.nextDue}):s.jsx(ka,{value:w.dueOn,late:w.late,onChange:D=>v(w.id,{dueOn:D})})})]}),(p.has(w.id)||A.length===0)&&s.jsxs("div",{className:"card-kids",children:[p.has(w.id)&&A.map(D=>s.jsxs("span",{className:`card-kid ${D.state==="done"?"is-done":""}`,children:[s.jsx("span",{title:T(Sa[D.state]),children:s.jsx(Jn,{state:D.state,size:12})}),s.jsx("a",{className:"task-title",href:Kn({tab:"tasks",taskId:D.id}),onClick:M=>{M.metaKey||M.ctrlKey||M.shiftKey||M.altKey||M.button!==0||(M.preventDefault(),m(D.id))},children:D.title})]},D.id)),s.jsx(Tw,{label:"+ Subtask",onDone:D=>l.create({title:D,kind:"once",parentId:w.id,departmentId:w.departmentId,projectId:w.projectId,toolId:w.toolId}).then(()=>x(M=>new Set([...M,w.id])))})]})]},w.id)}),O.length===0&&s.jsx("p",{className:"hint board-empty",children:T("Nothing here")}),s.jsx(Tw,{onDone:w=>l.create({title:w,kind:i,state:j,departmentId:u,projectId:d&&!h.some(b=>b.id===d)?d:null,toolId:d&&h.some(b=>b.id===d)?d:null})})]})]},j)})})}function fs(e,a,l){const[i,r]=N.useState(l?{key:l.key,dir:l.dir??"asc"}:null),u=(h,g="asc")=>r(p=>p?.key===h?p.dir===g?{key:h,dir:g==="asc"?"desc":"asc"}:null:{key:h,dir:g});return{sorted:N.useMemo(()=>{if(!i||!a[i.key])return e;const h=a[i.key],g=i.dir==="asc"?1:-1;return[...e].sort((p,x)=>{const m=h(p),v=h(x),k=m==null||m==="",T=v==null||v==="";return k||T?k&&T?0:k?1:-1:typeof m=="number"&&typeof v=="number"?(m-v)*g:typeof m=="boolean"&&typeof v=="boolean"?(Number(m)-Number(v))*g:String(m).localeCompare(String(v),void 0,{numeric:!0})*g})},[e,a,i]),by:i,toggle:u}}const qp=(e,a)=>e?.key!==a?"":e.dir==="asc"?" ↑":" ↓",P4=()=>new Date().toISOString().slice(0,10);function $w({kind:e,tasks:a,groups:l,actions:i,refresh:r,dept:u,onDept:d,openId:h,onOpen:g,departments:p,companies:x,people:m,projects:v,tools:k,goals:T,onOpenHolder:S,onOpenPerson:C,onlyMine:z=!1,back:E,holderId:j,onAddZone:O,me:w}){const b=qe(),[A,D]=N.useState(u??"all"),[M,U]=N.useState("all"),[Y,q]=N.useState(""),[W,L]=N.useState(!1),[V,I]=N.useState(!1),[F,_]=N.useState(!1),[H,P]=N.useState(null),[X,ne]=N.useState(new Set),[pe,R]=N.useState("none"),[Q,le]=N.useState("all"),[se,ie]=N.useState([]),[K,ue]=N.useState(()=>{try{const G=localStorage.getItem(`orgami.taskShape.${j?"holder":e}`);return G==="board"||G==="planner"?G:"list"}catch{return"list"}});N.useEffect(()=>{try{localStorage.setItem(`orgami.taskShape.${j?"holder":e}`,K)}catch{}},[K,e,j]);const[xe,Ne]=N.useState("collapsed"),[He,ee]=N.useState(null),[ge,Le]=N.useState(null),[me,_e]=N.useState(new Set),[ke,re]=N.useState(new Set),te=G=>_e($e=>{const Ge=new Set($e);return Ge.has(G)?Ge.delete(G):Ge.add(G),Ge}),Ce=G=>ie($e=>$e.includes(G)?$e.filter(Ge=>Ge!==G):[...$e,G]),[Ee,Re]=N.useState("all"),[Ke,mt]=N.useState("all"),[dt,En]=N.useState("all"),[Ue,ea]=N.useState("all"),[Ae,Be]=N.useState(()=>{try{const G=JSON.parse(localStorage.getItem(`orgami.taskCols.v2.${j?"holder":e}`)??"null");if(Array.isArray(G)&&G.length&&G.every($e=>Kr.includes($e)))return G}catch{}return s4[j?"holder":e]});N.useEffect(()=>{try{localStorage.setItem(`orgami.taskCols.v2.${j?"holder":e}`,JSON.stringify(Ae))}catch{}},[Ae,e,j]);const st=G=>Ae.includes(G)&&(j?G!=="project":G!=="zone"),gn=["78px","minmax(220px, 1fr)",...Kr.filter(G=>Ae.includes(G)&&(j?G!=="project":G!=="zone")).map(G=>a4[G]),"74px"].join(" "),ut=e==="recurring";N.useEffect(()=>D(u??"all"),[u]);const ta=G=>{D(G),d(G==="all"||G==="none"?null:G)},Et=N.useMemo(()=>new Map(m.map(G=>[G.id,G])),[m]),qt=N.useMemo(()=>[...v,...k],[v,k]),Tn=N.useMemo(()=>new Map(qt.map(G=>[G.id,G])),[qt]),Ln=N.useMemo(()=>new Map(p.map(G=>[G.id,G])),[p]),Ht=G=>G&&x.find($e=>$e.id===G)?.name||"",pt=G=>{let $e=G?Ln.get(G):null;for(;$e;){const Ge=$e.headId?Et.get($e.headId):null;if(Ge)return Ge;$e=$e.parentId?Ln.get($e.parentId)??null:null}return null},gt=async G=>{const $e=a.filter(ot=>ot.groupIds.includes(G.id)).length,Ge=$e?b("Delete the group “{name}”? {n} tasks will stay, but outside it.",{name:G.name,n:$e}):b("Delete the group “{name}”?",{name:G.name});await Dt(Ge,{okLabel:"Delete",danger:!0})&&i.removeGroup(G.id)},Un=j?Tn.get(j)??null:Ke!=="all"&&Ke!=="none"?Tn.get(Ke)??null:null,Ls=N.useMemo(()=>Un?l.filter(G=>G.projectId===Un.id||G.toolId===Un.id):[],[l,Un]),sn=N.useMemo(()=>[...new Set(a.filter(G=>G.kind===e).flatMap(G=>G.tags))].sort(),[a,e]),Ta=N.useMemo(()=>new Set(a.filter(G=>G.parentId&&G.kind===e).map(G=>G.parentId)),[a,e]),Qt=G=>xe==="expanded"?!0:X.has(G),Bt=a.find(G=>
81G.id===h)??null,Jt=G=>G&&Et.get(G)?.fullName||"",ys=Y.trim().toLowerCase(),qa=a.filter(G=>!(!z&&G.kind!==e||(A==="none"?G.departmentId:A!=="all"&&G.departmentId!==A)||M!=="all"&&G.assigneeId!==M||se.length&&!G.tags.some($e=>se.includes($e))||j&&G.projectId!==j&&G.toolId!==j||!j&&(Ke==="none"?G.projectId||G.toolId:Ke!=="all"&&G.projectId!==Ke&&G.toolId!==Ke)||dt!=="all"&&!(dt==="none"?G.areaIds.length===0:G.areaIds.includes(dt))||Ue!=="all"&&!(Ue==="none"?G.groupIds.length===0:G.groupIds.includes(Ue))||Ee!=="all"&&G.state!==Ee||z&&!(w.personId&&(G.assigneeId===w.personId||G.people.some($e=>$e.personId===w.personId)))||ys&&!G.title.toLowerCase().includes(ys))),Us=G=>{const $e=new Date;return $e.setUTCDate($e.getUTCDate()+G),$e.toISOString().slice(0,10)},Ma=G=>{if(Q==="all")return!0;if(Q==="late")return G.late;if(Q==="stalled")return G.notStarted;const $e=G.nextDue;return $e?Q==="today"?$e<=P4():$e<=Us(7):Q!=="today"&&Q!=="week"},yn=(ut?qa:qa.filter(G=>W||Wn(G.state))).filter(Ma),na=qa.filter(G=>G.late).length,wn=qa.filter(G=>G.notStarted).length,Rt=(G,$e)=>i.patch(G,$e),Da=G=>i.done(G.id);async function Ga(G){return await Dt(b("Delete the task “{name}”?",{name:G.title}),{okLabel:"Delete",danger:!0})?(await i.remove(G.id),!0):!1}const Gt=xe==="separate"?yn:yn.filter(G=>!G.parentId),Xa=N.useMemo(()=>({name:G=>G.title.toLowerCase(),state:G=>Ec.indexOf(G.state),when:G=>G.kind==="recurring"?G.nextDue??"":G.dueOn??"",who:G=>Jt(G.assigneeId).toLowerCase(),author:G=>Jt(G.authorId).toLowerCase(),dept:G=>Za(G.departmentId).toLowerCase(),project:G=>(Tn.get(G.projectId??G.toolId??"")?.name??"").toLowerCase(),time:G=>Tg(G)}),[m,p,Tn]),{sorted:ln,by:Mn,toggle:jn}=fs(Gt,Xa),Hs=(()=>
81{if(pe==="none")return[{key:"all",name:"",rows:ln}];const G=Ge=>pe==="state"?b(Sa[Ge.state]):pe==="who"?Jt(Ge.assigneeId)||b("— nobody yet —"):pe==="pile"?Ge.groupIds.map(ot=>l.find(ht=>ht.id===ot)?.name).filter(Boolean).join(", ")||b("Outside a group"):pe==="project"?Ge.projectId?Tn.get(Ge.projectId)?.name??"":b("Outside any project"):pe==="tool"?Ge.toolId?Tn.get(Ge.toolId)?.name??"":b("Outside any tool"):Ge.departmentId?Za(Ge.departmentId):b("No department");return[...new Set(ln.map(G))].sort((Ge,ot)=>Ge.localeCompare(ot)).map(Ge=>({key:Ge,name:Ge,rows:ln.filter(ot=>G(ot)===Ge)}))})(),Bs=[{value:"all",label:b("All departments")},...p.map(G=>({value:G.id,label:G.name,sub:Ht(G.companyId)})),{value:"none",label:b("No department")}],Za=G=>{const $e=G?Ln.get(G):null;return $e?p.filter(ot=>ot.name===$e.name).length>1?`${$e.name} · ${Ht($e.companyId)}`:$e.name:""},aa=A!=="all"&&A!=="none"?pt(A):null,xs=(G,$e=0)=>{const Ge=xe==="separate"?[]:a.filter(Ie=>Ie.parentId===G.id),ot=Qt(G.id),ht=!Mn&&pe==="none"&&xe!=="separate"&&!$e;return s.jsxs("div",{className:`trow ${G.late?"late":""} ${G.notStarted?"stalled":""} ${G.state==="done"?"is-done":""} ${$e?"child":""} ${He===G.id?"lifted":""} ${ge===G.id?"drop-here":""}`,draggable:ht,onDragStart:Ie=>{ht&&(Ie.dataTransfer.setData("text/task",G.id),Ie.dataTransfer.effectAllowed="move",ee(G.id))},onDragEnd:()=>{ee(null),Le(null)},onDragOver:Ie=>{!ht||!He||He===G.id||(Ie.preventDefault(),Le(G.id))},onDragLeave:()=>Le(Ie=>Ie===G.id?null:Ie),onDrop:Ie=>{if(!ht||!He)return;Ie.preventDefault();const nt=He;if(ee(null),Le(null),nt===G.id)return;const Tt=ln.map(Hn=>Hn.id).filter(Hn=>Hn!==nt),sa=Tt.indexOf(G.id);Tt.splice(sa<0?Tt.length:sa,0,nt),i.reorder(Tt)},children:[s.jsxs("span",{className:"tcell tick",children:[s.jsx("input",{type:"checkbox",className:"row-pick",checked:me.has(G.id),"aria-label":b("Select"),onChange:()=>te(G.id)}),Ge.length>0?s.jsx("button",{type:"button",className:`twist ${ot?"on":""}`,"aria-expanded":ot,title:b(ot?"Collapse":"Expand"),onClick:()=>ne(Ie=>{const nt=new Set(Ie);return nt.has(G.id)?nt.delete(G.id):nt.add(G.id),nt}),children:"▸"}):s.jsx("span",{className:"twist empty","aria-hidden":"true"}),s.jsx(Qe,{className:`task-state state-only ${G.state}`,value:G.state,title:b(Sa[G.state]),options:lc(b,G.kind==="recurring"),onChange:Ie=>G.kind==="recurring"&&Ie==="done"?Da(G):Rt(G.id,{state:Ie}),children:s.jsx(Jn,{state:G.state,size:15})})]}),s.jsxs("span",{className:"tcell name",children:[s.jsx("a",{className:"task-title",href:Kn({tab:G.kind==="recurring"?"recurring":"tasks",taskId:G.id}),title:b("Open the task"),onClick:Ie=>{Ie.metaKey||Ie.ctrlKey||Ie.shiftKey||Ie.altKey||Ie.button!==0||(Ie.preventDefault(),g(G.id))},children:G.title}),Ge.length>0&&s.jsxs("span",{className:"tmark",title:b("Subtasks"),children:[s.jsx(z1,{})," ",Ge.filter(Ie=>Ie.state==="done").length,"/",Ge.length]}),G.hasDetails&&s.jsx("span",{className:"tmark",title:b("Has a description"),children:s.jsx(n4,{})}),G.checksTotal>0&&s.jsxs("span",{className:"tmark",title:b("Checklist"),children:[s.jsx(R1,{})," ",G.checksDone,"/",G.checksTotal]}),G.comments>0&&s.jsxs("span",{className:"tmark",title:b("Discussion"),children:[s.jsx($1,{})," ",G.comments]}),xe==="separate"&&G.parentId&&s.jsxs("span",{className:"hint work-parent",children:[" ↳ ",a.find(Ie=>Ie.id===G.parentId)?.title??""]}),z&&G.kind==="recurring"&&s.jsx("span",{className:"tchip",children:b("Recurring")}),(ke.has(G.id)?G.tags:G.tags.slice(0,2)).map(Ie=>s.jsx("button",{type:"button",className:`tag hue-${Yl(Ie)} ${se.includes(Ie)?"picked":""}`,title:b("Show only this tag"),onClick:()=>Ce(Ie),children:Ie},Ie)),G.tags.length>2&&s.jsx("button",{type:"button",className:"tag more",title:ke.has(G.id)?b("Hide"):G.tags.slice(2).join(", "),onClick:()=>re(Ie=>{const nt=new Set(Ie);return nt.has(G.id)?nt.delete(G.id):nt.add(G.id),nt}),children:ke.has(G.id)?"−":`+${G.tags.length-2}`}),s.jsx(Qe,{className:"tag-add",value:"",keepOpen:!0,searchPlaceholder:b("Search…"),options:[...sn.map(Ie=>({value:Ie,label:Ie,icon:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`tick ${G.tags.includes(Ie)?"on":""}`,"aria-hidden":"true"}),s.jsx("span",{className:`tag-dot hue-${Yl(Ie)}`,"aria-hidden":"true"})]})})),{value:"+",label:b("New tag…")}],onChange:async Ie=>{if(Ie!=="+")return Rt(G.id,{tags:G.tags.includes(Ie)?G.tags.filter(Tt=>Tt!==Ie):[...G.tags,Ie]}
81);const nt=await us(b("New tag"),{placeholder:b("Tag name"),okLabel:"Add"});nt&&!G.tags.includes(nt)&&Rt(G.id,{tags:[...G.tags,nt]})},children:s.jsx("span",{className:"tag add",title:b("Add a tag"),children:b("+ tag")})})]}),st("when")&&s.jsx("span",{className:"tcell when rule-anchor",children:G.kind==="recurring"?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:`task-rule ${H===G.id?"on":""}`,title:Pd(G,b.lang),onClick:()=>P(H===G.id?null:G.id),children:Pd(G,b.lang)}),s.jsx("span",{className:`task-due ${G.late?"late":""}`,children:G.nextDue}),H===G.id&&s.jsx(q1,{onClose:()=>P(null),children:s.jsx(G1,{task:G,onChange:Ie=>Rt(G.id,Ie),onClose:()=>P(null)})})]}):s.jsx(ka,{value:G.dueOn,late:G.late,onChange:Ie=>Rt(G.id,{dueOn:Ie})})}),st("who")&&s.jsx("span",{className:"tcell who",children:s.jsx(Qe,{className:"task-pick",value:G.assigneeId??"",searchPlaceholder:b("Search a person…"),options:[{value:"",label:b("— nobody yet —")},...m.filter(Ie=>Ie.fullName&&!Ie.plannedOut).map(Ie=>({value:Ie.id,label:Ie.fullName,sub:Ie.title,icon:s.jsx(Xe,{person:Ie,size:22})}))],onChange:Ie=>Rt(G.id,{assigneeId:Ie||null}),children:G.assigneeId&&Et.get(G.assigneeId)?s.jsxs("span",{className:"twho",children:[s.jsx(Xe,{person:Et.get(G.assigneeId),size:22}),s.jsx("span",{className:"twho-name",children:Et.get(G.assigneeId).fullName})]}):s.jsxs("span",{className:"twho",children:[s.jsx("span",{className:"ava-empty","aria-hidden":"true"}),s.jsx("span",{className:"twho-name hint",children:b("Empty")})]})})}),st("author")&&s.jsx("span",{className:"tcell who",children:(()=>{const Ie=G.authorId?m.find(nt=>nt.id===G.authorId):null;return Ie?s.jsxs("span",{className:"task-who",title:Ie.title||void 0,children:[s.jsx(Xe,{person:Ie,size:20})," ",Ie.fullName]}):s.jsx("span",{className:"hint",children:"—"})})()}),st("dept")&&s.jsx("span",{className:"tcell where",children:G.departmentId?s.jsx("span",{className:"tchip",title:Za(G.departmentId),children:Za(G.departmentId)}):s.jsx("span",{className:"hint",children:"—"})}),st("zone")&&s.jsx("span",{className:"tcell where",children:(()=>{const Ie=Tn.get(G.projectId??G.toolId??"");return Ie?s.jsx(Qe,{className:"task-pick",value:"",keepOpen:!0,searchPlaceholder:b("Search…"),options:[...Ie.areas.map(nt=>({value:nt.id,label:nt.name,icon:s.jsx("span",{className:`tick ${G.areaIds.includes(nt.id)?"on":""}`,"aria-hidden":"true"})})),{value:"+",label:b("New zone…"),divider:Ie.areas.length>0}],onChange:async nt=>{if(nt!=="+"){Rt(G.id,{areaIds:G.areaIds.includes(nt)?G.areaIds.filter(Hn=>Hn!==nt):[...G.areaIds,nt]});return}const Tt=await us(b("New zone"),{placeholder:b("Zone name")});if(!Tt||!O)return;const sa=await O(Ie.id,Tt);sa&&Rt(G.id,{areaIds:[...G.areaIds,sa.id]})},children:G.areaIds.length?s.jsx("span",{className:"chip-value",children:G.areaIds.map(nt=>Ie.areas.find(Tt=>Tt.id===nt)?.name).filter(Boolean).join(", ")}):s.jsx("span",{className:"hint",children:Ie.areas.length?b("No zone"):b("no zones yet")})}):s.jsx("span",{className:"hint",children:"—"})})()}),st("project")&&s.jsx("span",{className:"tcell where",children:G.projectId||G.toolId?s.jsx("button",{type:"button",className:"tchip project",onClick:()=>S(G.projectId??G.toolId),children:Tn.get(G.projectId??G.toolId)?.name??""}):s.jsx("span",{className:"hint",children:"—"})}),!G.aiReads&&s.jsx("span",{className:"tcell shut",title:b("Hidden from the assistant"),"aria-label":b("Hidden from the assistant"),children:s.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[s.jsx("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),s.jsx("path",{d:"M8.5 10.5V8a3.5 3.5 0 0 1 7 0v2.5"})]})}),st("group")&&s.jsx("span",{className:"tcell where",children:(()=>{const Ie=Tn.get(G.projectId??G.toolId??"");if(!Ie)return s.jsx("span",{className:"hint",children:"—"});const nt=l.filter(Tt=>Tt.projectId===Ie.id||Tt.toolId===Ie.id);return s.jsx(Qe,{className:"task-pick",value:"",keepOpen:!0,searchPlaceholder:b("Search…"),options:B1(b,nt,G.groupIds,Tt=>gt(Tt)),onChange:async Tt=>{if(Tt!=="+"){Rt(G.id,{groupIds:G.groupIds.includes(Tt)?G.groupIds.filter(en=>en!==Tt):[...G.groupIds,Tt]});return}const sa=await us(b("New group"),{placeholder:b("Group name")});if(!sa)return;const Hn=k.some(en=>en.id===Ie.id),Ot=await i.addGroup({name:sa,projectId:Hn?null:Ie.id,toolId:Hn?Ie.id:null});Ot&&Rt(G.id,{groupIds:[...G.groupIds,Ot.id]})},children:G.groupIds.length?s.jsxs("span",{className:"chip-value",children:[nt.find(Tt=>Tt.id===G.groupIds[0])?.name??"",G.groupIds.length>1?` +${G.groupIds.length-1}`:""]}):s.jsx("span",{className:"hint",children:b("Outside a group")})})})()}),st("time")&&s.jsx("span",{className:"tcell time",children:s.jsx(ih,{task:G})}),s.jsx("span",{className:"tcell acts",children:s.jsx("button",{type:"button",className:"icon-btn small",title:b("Delete"),onClick:()=>Ga(G),children:"×"})}),ot&&s.jsx("span",{className:"tcell kids",children:Ge.map(Ie=>xs(Ie,$e+1))})]},G.id)};return Bt?s.jsx(H4,{task:Bt,refresh:r,all:a,groups:l,actions:i,onOpen:g,departments:p,companies:x,people:m,projects:v,tools:k,goals:T,onOpenHolder:S,onOpenPerson:C,me:w,onAddZone:O,back:E,onBack:()=>E?E.go():g(null),onDelete:async()=>{await Ga(Bt)&&(E?E.go():g(null))}},Bt.id):s.jsxs("div",{className:"tasks-view",children:[s.jsxs("header",{className:"tasks-head",children:[ut&&s.jsx("div",{className:"tabs",role:"tablist","aria-label":b("When"),children:["all","today","week","late","stalled"].map(G=>s.jsxs("button",{type:"button",role:"tab","aria-selected":Q===G,className:Q===G?"on":"",onClick:()=>le(G),children:[b(G==="all"?"All":G==="today"?"Today":G==="week"?"Next 7 days":G==="late"?"Overdue":"Not started"),G==="late"&&na>0&&s.jsx("span",{className:"count",children:na}),G==="stalled"&&wn>0&&s.jsx("span",{className:"count",children:wn})]},G))}),s.jsx("div",{className:"seg shape-seg",children:["list","board","planner"].map(G=>s.jsx("button",{type:"button",className:K===G?"on":"",onClick:()=>ue(G),children:b(G==="list"?"List":G==="board"?"Kanban":"Planner")},G))}),s.jsx(Qe,{className:"team-filter",value:A,options:Bs,onChange:ta,searchPlaceholder:b("Search…"),children:s.jsx("span",{className:A==="all"?"muted":"",children:Bs.find(G=>G.value===A)?.label})}),!j&&s.jsx(Qe,{className:"team-filter",value:Ke,searchPlaceholder:b("Search…"),options:[{value:"all",label:b("Any project")},{value:"none",label:b("Outside any project")},...qt.map(G=>({value:G.id,label:G.name,sub:k.some($e=>$e.id===G.id)?b("Tool"):b("Project")}))],onChange:G=>{mt(G),En("all"),ea("all")},children:s.jsx("span",{className:Ke==="all"?"muted":"",children:Ke==="all"?b("Any project"):Ke==="none"?b("Outside any project"):Tn.get(Ke)?.name??""})}),Un&&Un.areas.length>0&&s.jsx(Qe,{className:"team-filter",value:dt,searchPlaceholder:b("Search…"),options:[{value:"all",label:b("Any zone")},{value:"none",label:b("No zone")},...Un.areas.map(G=>({value:G.id,label:G.name}))],onChange:En,children:s.jsx("span",{className:dt==="all"?"muted":"",children:dt==="all"?b("Any zone"):dt==="none"?b("No zone"):Un.areas.find(G=>
81G.id===dt)?.name??""})}),Un&&Ls.length>0&&s.jsx(Qe,{className:"team-filter",value:Ue,options:[{value:"all",label:b("Any group")},{value:"none",label:b("Outside a group")},...Ls.map(G=>({value:G.id,label:G.name}))],onChange:ea,children:s.jsx("span",{className:Ue==="all"?"muted":"",children:Ue==="all"?b("Any group"):Ue==="none"?b("Outside a group"):Ls.find(G=>G.id===Ue)?.name??""})}),s.jsx(Qe,{className:"team-filter",value:M,options:[{value:"all",label:b("Anyone")},...m.filter(G=>G.fullName).map(G=>({value:G.id,label:G.fullName,sub:G.title,icon:s.jsx(Xe,{person:G,size:22})}))],onChange:U,searchPlaceholder:b("Search a person…"),children:s.jsx("span",{className:M==="all"?"muted":"",children:M==="all"?b("Anyone"):Et.get(M)?.fullName??""})}),sn.length>0&&s.jsx(Qe,{className:"team-filter",value:"",keepOpen:!0,options:[{value:"",label:b("Any tag"),icon:s.jsx("span",{className:`tick ${se.length?"":"on"}`,"aria-hidden":"true"})},...sn.map(G=>({value:G,label:G,icon:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`tick ${se.includes(G)?"on":""}`,"aria-hidden":"true"}),s.jsx("span",{className:`tag-dot hue-${Yl(G)}`,"aria-hidden":"true"})]})}))],onChange:G=>G?Ce(G):ie([]),searchPlaceholder:b("Search…"),children:se.length===0?s.jsx("span",{className:"muted",children:b("Any tag")}):s.jsxs("span",{className:"tag-picked",children:[se.slice(0,2).map(G=>s.jsx("span",{className:`tag hue-${Yl(G)}`,children:G},G)),se.length>2&&s.jsxs("span",{className:"hint",children:["+",se.length-2]})]})}),s.jsx("input",{className:"team-search",value:Y,onChange:G=>q(G.target.value),placeholder:b("Search the tasks…")}),s.jsx(Qe,{className:"team-filter",value:pe,options:[{value:"none",label:b("No grouping")},{value:"state",label:b("State")},{value:"who",label:b("Who does it")},{value:"dept",label:b("Department")},{value:"pile",label:b("Task group")},{value:"project",label:b("Project")},{value:"tool",label:b("Tool")}],onChange:G=>R(G),children:s.jsxs("span",{className:pe==="none"?"muted":"",children:[b("Group"),":"," ",b(pe==="none"?"No grouping":pe==="state"?"State":pe==="who"?"Who does it":pe==="pile"?"Task group":pe==="project"?"Project":pe==="tool"?"Tool":"Department")]})}),!ut&&s.jsx(Qe,{className:"team-filter",value:Ee,options:[{value:"all",label:b("Any state")},...lc(b,!1)],onChange:G=>Re(G),children:Ee==="all"?s.jsx("span",{className:"muted",children:b("Any state")}):s.jsxs("span",{className:"state-chip",children:[s.jsx(Jn,{state:Ee}),b(Sa[Ee])]})}),!ut&&s.jsx("button",{type:"button",className:`chip-toggle ${W?"on":""}`,onClick:()=>L(G=>!G),children:b("Closed")}),Ta.size>0&&s.jsx(Qe,{className:"team-filter",value:xe,options:[{value:"collapsed",label:b("Collapsed")},{value:"expanded",label:b("Expanded")},{value:"separate",label:b("Separate")}],onChange:G=>Ne(G),children:s.jsxs("span",{className:xe==="collapsed"?"muted":"",children:[b("Subtasks"),": ",b(xe==="collapsed"?"Collapsed":xe==="expanded"?"Expanded":"Separate")]})}),s.jsx(Qe,{className:"team-filter",value:"",keepOpen:!0,options:Kr.filter(G=>j?G!=="project":G!=="zone").map(G=>({value:G,label:b(G==="when"&&ut?"How often":Nw[G]),icon:s.jsx("span",{className:`tick ${st(G)?"on":""}`,"aria-hidden":"true"})})),onChange:G=>Be($e=>$e.includes(G)?$e.filter(Ge=>Ge!==G):Kr.filter(Ge=>$e.includes(Ge)||Ge===G)),children:s.jsx("span",{className:"muted",children:b("Columns")})}),s.jsxs("span",{className:"tasks-head-right",children:[s.jsx("span",{className:"hint tasks-summary",children:na>0?s.jsx("span",{className:"gap warn",children:b("{n} overdue",{n:na})}):b("nothing overdue")}),aa&&s.jsxs("button",{type:"button",className:"owner-line",onClick:()=>C(aa.id),title:b("Open the card"),children:[s.jsx(Xe,{person:aa,size:22}),s.jsxs("span",{className:"owner-text",children:[s.jsx("span",{className:"owner-name",children:aa.fullName}),s.jsx("span",{className:"hint",children:b("answers for this department's tasks")})]})]}),s.jsx("button",{type:"button",className:"btn primary tasks-new",disabled:F,onClick:()=>I(!0),children:b("+ Task")})]})]}),V&&s.jsx(I1,{kind:e,holderId:j,departmentId:A!=="all"&&A!=="none"?A:null,departments:p,companies:x,people:m,holders:qt,tools:k,onClose:()=>I(!1),onCreate:async G=>{_(!0);const $e=await i.create(G);_(!1),I(!1),$e&&g($e.id)}}),me.size>0&&s.jsxs("div",{className:"bulk-bar",children:[s.jsx("span",{className:"bulk-n",children:b("{n} picked",{n:me.size})}),s.jsx(Qe,{className:"team-filter",value:"",options:lc(b,ut),onChange:G=>{for(const $e of me)Rt($e,{state:G});_e(new Set)},children:s.jsx("span",{children:b("State")})}),s.jsx(Qe,{className:"team-filter",value:"",searchPlaceholder:b("Search a person…"),options:[{value:"",label:b("— nobody yet —")},...m.filter(G=>G.fullName&&!G.plannedOut).map(G=>({value:G.id,label:G.fullName,sub:G.title,icon:s.jsx(Xe,{person:G,size:22})}))],onChange:G=>{for(const $e of me)Rt($e,{assigneeId:G||null});_e(new Set)},children:s.jsx("span",{children:b("Who does it")})}),s.jsx(ka,{value:null,placeholder:b("Due"),title:b("Move the deadline of everything picked"),onChange:G=>{for(const $e of me)Rt($e,{dueOn:G});_e(new Set)}}),s.jsx(Qe,{className:"team-filter",value:"",searchPlaceholder:b("Search…"),options:[{value:"",label:b("No department")},...p.map(G=>({value:G.id,label:G.name,sub:Ht(G.companyId)}))],onChange:G=>{for(const $e of me)Rt($e,{departmentId:G||null});_e(new Set)},children:s.jsx("span",{children:b("Department")})}),s.jsx(Qe,{className:"team-filter",value:"",keepOpen:!0,searchPlaceholder:b("Search…"),options:[...sn.map(G=>{const $e=[...me].every(ot=>a.find(ht=>
81ht.id===ot)?.tags.includes(G)),Ge=!$e&&[...me].some(ot=>a.find(ht=>ht.id===ot)?.tags.includes(G));return{value:G,label:G,sub:Ge?b("on some of them"):void 0,icon:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`tick ${$e?"on":Ge?"some":""}`,"aria-hidden":"true"}),s.jsx("span",{className:`tag-dot hue-${Yl(G)}`,"aria-hidden":"true"})]})}}),{value:"+",label:b("New tag…")}],onChange:async G=>{let $e=G;if(G==="+"){const ht=await us(b("New tag"),{placeholder:b("Tag name"),okLabel:"Add"});if(!ht)return;$e=ht}const Ge=[...me],ot=Ge.every(ht=>a.find(Ie=>Ie.id===ht)?.tags.includes($e));for(const ht of Ge){const Ie=a.find(nt=>nt.id===ht);Ie&&(ot?Rt(ht,{tags:Ie.tags.filter(nt=>nt!==$e)}):Ie.tags.includes($e)||Rt(ht,{tags:[...Ie.tags,$e]}))}},children:s.jsx("span",{children:b("Tags")})}),s.jsx("button",{type:"button",className:"ghost-btn danger",onClick:async()=>{await Dt(b("Delete {n} tasks?",{n:me.size}),{okLabel:"Delete",danger:!0})&&(await i.removeMany([...me]),_e(new Set))},children:b("Delete")}),s.jsx("button",{type:"button",className:"link",onClick:()=>_e(new Set),children:b("Clear")})]}),K==="planner"?s.jsx(H1,{tasks:yn,people:m,holders:[...v,...k],departments:p,me:w,holderId:j,onOpenTask:g}):K==="board"?s.jsx(B4,{rows:ln,all:a,actions:i,kind:e,isRecurring:ut,departmentId:A!=="all"&&A!=="none"?A:null,holderId:j,tools:k,personById:Et,unfolded:X,setUnfolded:ne,onOpen:g,patch:Rt,remove:Ga}):s.jsxs("div",{className:"ttable",style:{"--tcols":gn},children:[s.jsxs("div",{className:"trow thead",children:[s.jsx("span",{className:"tcell tick",children:s.jsx("input",{type:"checkbox",className:"row-pick",checked:ln.length>0&&ln.every(G=>me.has(G.id)),ref:G=>{G&&(G.indeterminate=ln.some($e=>me.has($e.id))&&!ln.every($e=>me.has($e.id)))},"aria-label":b("Select all"),onChange:G=>_e(G.target.checked?new Set(ln.map($e=>$e.id)):new Set)})}),s.jsxs("span",{className:"tcell name",children:[s.jsxs("button",{type:"button",className:"tsort",onClick:()=>jn("name"),children:[b("Task"),qp(Mn,"name")]}),s.jsx("span",{className:"tcount",children:ln.length})]}),Kr.filter(G=>st(G)&&(j?G!=="project":G!=="zone")).map(G=>s.jsx("span",{className:`tcell ${G==="dept"||G==="project"?"where":G}`,children:s.jsxs("button",{type:"button",className:"tsort",onClick:()=>jn(G),children:[b(G==="when"&&ut?"How often":Nw[G]),qp(Mn,G)]})},G)),s.jsx("span",{className:"tcell acts"})]}),Hs.map(G=>s.jsxs("div",{className:"tgroup",children:[pe!=="none"&&s.jsxs("div",{className:"tgroup-head",children:[G.name,s.jsx("span",{className:"tcount",children:G.rows.length})]}),G.rows.map($e=>xs($e))]},G.key)),ln.length===0&&s.jsx("p",{className:"hint pad",children:z&&!w.personId?b("This account is not linked to anyone on the map yet — put its corporate email on that person's card."):b("Nothing here yet.")})]})]})}const Y4=[{title:"Что это",intro:"Карта — схема группы компаний и людей в ней. Компании стоят друг под другом по подчинению, от каждой карточки вниз (или вправо) растут её отделы и люди. Всё, что видно на карте, можно править прямо на ней: название, должность, связи, цвет.",items:[]},{title:"Как двигаться",items:[{term:"Левая кнопка",text:"выделяет: клик по карточке или рамка протяжкой по пустому месту."},{term:"Правая или средняя",text:"двигает полотно."},{term:"Колесо",text:"приближает и отдаляет."},{term:"Перетаскивание карточки",text:"уносит с собой всю ветку под ней — отдел уедет с людьми, компания с дочерними."},{term:"Ctrl + K",text:"поиск по компаниям, отделам и людям: выбранное подсвечивается, свёрнутые ветки раскрываются сами."},{term:"Кружок под карточкой",text:"сворачивает и разворачивает ветку — так прячут то, что сейчас не нужно."},{term:"Esc",text:"закрывает панель справа и меню."}]},{title:"Компании",items:[{term:"+ Компания",text:"кнопка наверху добавляет новую карточку верхнего уровня."},{term:"Наведи на карточку",text:"и над ней появится полоска: цвет, + Человек, + Отдел, + Дочерняя компания, Удалить."},{term:"Подчинение",text:"задаётся линией: потяни от края одной карточки к другой. Дочерняя компания может висеть не от карточки, а от конкретного человека в родительской — это её ответственный."},{term:"Клик по карточке",text:"открывает панель справа: отделы, люди, кто чем занят."}]},{title:"Отделы и люди",items:[{term:"Отдел",text:"стоит между компанией и её людьми. Внутри отдела бывают подразделения (+ Подразделение на карточке отдела). У отдела можно наÐ
81·Ð½Ð°Ñ‡Ð¸Ñ‚ÑŒ руководителя — одного из его людей."},{term:"Руководители",text:"человек висит от своего руководителя; руководителей может быть несколько. Руководитель из другого отдела рисуется тонкой перекрёстной линией — она видна, только когда выделен один из двух."},{term:"+ Подчинённый",text:"на карточке человека заводит нового прямо под ним."},{term:"Фото",text:"клик по кружку с инициалами — выбрать файл. Картинка обрежется в квадрат сама."},{term:"Карточка",text:"кнопка на человеке открывает его страницу: проекты, зоны ответственности, задачи и обязанности."}]},{title:"Линии",items:[{term:"Клик по линии",text:"открывает её настройки: форма (ступенька, кривая, прямая), пунктир, толщина, цвет и то, с какой стороны карточки она выходит и куда входит."},{text:"Настройка действует на линии, входящие в эту карточку, — так ветку целиком можно отличить от остальных."}]},{title:"Что если: возможные увольнения",items:[{term:"✂ на человеке",text:"помечает его как возможное увольнение. Человек остаётся на карте, но блёкнет и выпадает из подсчётов — это черновик решения, а не увольнение и не удаление."},{term:"? на человеке",text:"ставит вопрос: ещё не решено, нужен ли он. На подсчёты не влияет, просто видно."},{money:!0,term:"Итоги",text:"карточки показывают «было → стало», а в меню ☰ видна общая экономия за месяц и за год."},{term:"Вернуть",text:"та же кнопка снимает пометку; «Оставить всех» в меню ☰ снимает сразу все."}]},{title:"Меню карты (☰)",items:[{term:"Компании",text:"список с глазами: любую можно убрать с карты, не удаляя. Спрятанное считается отдельно."},{term:"Фон",text:"точки, сетка, миллиметровка, чертёж и так далее — на данные не влияет, только на глаза."},{term:"Направление веток",text:"вниз (оргсхема) или вправо (майндмэп)."},{money:!0,term:"Итоги",text:"сколько людей и какой фонд оплаты в месяц и в год, с учётом спрятанного."}]},{title:"Если что-то пошло не так",items:[{term:"Ctrl + Z",text:"отменяет последнее: перемещение, правку, добавление, удаление. Ctrl + Shift + Z возвращает обратно."},{term:"Настройки → Данные → Корзина",text:"удалённые компании, люди и отделы лежат там 30 дней целиком — с фото, участием в проектах и задачами — и возвращаются кнопкой «Восстановить». Это то, что переживает перезагрузку страницы, в отличие от Ctrl + Z."},{term:"Автоматическая раскладка",text:"кнопка наверху расставляет всё заново, если карта расползлась."},{term:"F5",text:"перечитывает данные с сервера, не перезагружая страницу."}]}],V4=[{title:"What this is",intro:"The map is the group drawn out: companies under the company they answer to, and from each card its departments and its people. Everything on it is edited in place — a name, a title, a line, a colour.",items:[]},{title:"Moving around",items:[{term:"Left button",text:"selects: click a card, or drag a box over empty space."},{term:"Right or middle",text:"pans the canvas."},{term:"Wheel",text:"zooms in and out."},{term:"Dragging a card",text:"carries its whole branch — a department moves with its people, a company with the ones below it."},{term:"Ctrl + K",text:"searches companies, departments and people; whatever hides the answer unfolds on its own."},{term:"The circle under a card",text:"folds and unfolds that branch — the way to put aside what you are not looking at."},{term:"Esc",text:"closes the panel on the right and the menu."}]},{title:"Companies",items:[{term:"+ Add company",text:"at the top adds a new top-level card."},{term:"Hover a card",text:"and a strip appears above it: colour, + Person, + Department, + Sub-company, Delete."},{term:"Who answers to whom",text:"is the line: drag from the edge of one card to another. A sub-company can hang off a particular person in the parent instead of off the card — that person is responsible for it."},{term:"Clicking a card",text:"opens the panel on the right: departments, people, who does what."}]},{title:"Departments and people",items:[{term:"A department",text:"sits between the company and its people. Departments hold units of their own (+ Unit on the department card), and one of its people can be named its head."},{term:"Managers",text:"a person hangs from their manager, and there may be several. A manager in another department is drawn as a light cross line, shown only while one of the two is selected."}
81,{term:"+ Report",text:"on a person's card creates someone under them."},{term:"Photo",text:"click the initials to pick a file; it is cropped to a square for you."},{term:"Card",text:"on a person opens their page: projects, zones of responsibility, tasks and duties."}]},{title:"Lines",items:[{term:"Clicking a line",text:"opens its settings: shape (step, curve, straight), dash, width, colour, and which side of each card it leaves from and enters."},{text:"It applies to the lines coming into that card, so one branch can be told apart from the rest."}]},{title:"What-if: dismissals you are weighing",items:[{term:"✂ on a person",text:"marks them as a dismissal you are weighing. They stay on the map, dimmed, and drop out of the totals — a draft of a decision, not the decision and not a deletion."},{term:"? on a person",text:"raises a question instead: not decided yet whether they are needed. It changes no total, it just shows."},{money:!0,term:"Totals",text:"cards show “before → after”, and the ☰ menu has the saving per month and per year."},{term:"Undo",text:"the same ✂ clears the mark; “Keep everyone” in the ☰ menu clears them all."}]},{title:"The map menu (☰)",items:[{term:"Companies",text:"a list with eyes: any of them can be taken off the map without being deleted. What is hidden is counted separately."},{term:"Background",text:"dots, grid, graph paper, blueprint and so on — the eyes only, never the data."},{term:"Branch direction",text:"down (an org chart) or to the right (a mind map)."},{money:!0,term:"Totals",text:"how many people and what the payroll is per month and per year, hidden companies accounted for."}]},{title:"When something goes wrong",items:[{term:"Ctrl + Z",text:"undoes the last thing: a move, an edit, an addition, a deletion. Ctrl + Shift + Z puts it back."},{term:"Settings → Data → Trash",text:"deleted companies, people and departments are kept there whole for 30 days — photos, project memberships and tasks included — and come back with Restore. Unlike Ctrl + Z, it survives a reload."},{term:"Auto-arrange",text:"at the top lays everything out again when the map has sprawled."},{term:"F5",text:"re-reads the data from the server without reloading the page."}]}],q4={ru:Y4,en:V4},G4=[{title:"Что это",intro:"Проект — работа с концом: у него есть руководитель, компания-владелец и люди из любых компаний группы. Инструмент — то, что группа строит для себя и улучшает без конца: у него не руководитель, а ответственный, и он может принадлежать одному проекту или никому. Устроены они одинаково: люди, зоны ответственности, задачи — поэтому и экраны одни и те же.",items:[]},{title:"Три вида одного и того же",items:[{term:"Схема",text:"проект как дерево: от карточки проекта — его люди, выстроенные по реальному подчинению (кто чей руководитель на карте), и зоны, за которые никто не отвечает. Карточку можно перетащить — место запомнится; «Автоматическая раскладка» расставляет заново."},{term:"Работа",text:"таблица всех задач: статус, название, зоны, исполнитель, кто ещё привлечён, человеко-дни, срок. Есть поиск, фильтр по статусу и по человеку, отметка просроченных и групповые действия — отметить несколько строк и разом сменить статус, передать другому, перенести в зону или удалить."},{term:"Зоны",text:"список зон ответственности: у каждой один владелец (★) и те, кто в ней работает, плюс счётчик задач. ЗоÐ
81½Ð° без владельца подсвечена — это дыра, а не мелочь."}]},{title:"Люди",items:[{term:"Добавить",text:"поле со списком в строке вкладок: начни печатать имя — человек из любой компании группы."},{term:"Вовлечённость",text:"основная работа (●), часть времени (◐) или советует (○). Это то, из чего потом складывается загрузка человека на его карточке."},{term:"Роль",text:"как человек называется именно здесь — «SEO-менеджер», «техлид». Должность на карте от этого не меняется."},{term:"Зоны человека",text:"в его карточке: по каждой зоне — «—», «работает» или «★ владеет». Владелец у зоны один, работать в ней могут многие."},{term:"Убрать из проекта",text:"не трогает карту: человек остаётся в своей компании и у своего руководителя."},{term:"Что если",text:"на схеме у выделенной карточки появляются те же ✂ и ?, что на карте: возможное увольнение и «под вопросом». Помеченный человек виден сразу — карточка блёкнет и получает плашку."}]},{title:"Зоны ответственности",items:[{term:"Что это",text:"куски, из которых состоит проект: «Каталог+», «Сайт», «Контент». Не отделы и не этапы — участки, за каждый из которых кто-то отвечает головой."},{term:"+ Зона",text:"кнопка в строке вкладок. Название правится кликом по нему."},{term:"Клик по зоне",text:"открывает панель: владелец, кто работает, и все задачи внутри."},{term:"Удаление зоны",text:"уносит её задачи — об этом спросят и скажут, сколько их."}]},{title:"Задачи",items:[{term:"Статусы",text:"бэклог → к работе → в работе → на проверке → готово. Меняется кликом по статусу прямо в таблице."},{term:"Зоны у задачи",text:"их может быть несколько — модуль, который трогает и каталог, и админку, честно принадлежит обеим. Может не быть ни одной: тогда задача просто в проекте."},{term:"Кто делает",text:"один исполнитель, и отдельно «кто ещё» — консультант, техлид, приёмщик, менеджер. Роль пишется словами, привлечь можно любого, не только участника проекта."},{term:"Дни и срок",text:"человеко-дни — это оценка объёма, срок — дата. Просроченные видны отдельным счётчиком наверху."},{term:"Подзадачи",text:"в панели зоны у задачи могут быть свои части; удаление родителя уносит их."}]},{title:"Направления и модули",items:[{term:"Зачем",text:"большой проект делится на направления, большой инструмент — на модули. У каждого свои люди, свои зоны и свои задачи, но это часть целого, а не отдельный проект рядом."},{term:"+ Направление",text:"кнопка рядом с «+ Зона» (у инструмента — «+ Модуль»). Часть появл
81яется в левом меню под своим целым."},{term:"На схеме",text:"части нарисованы пунктирными карточками от корня — клик открывает схему самой части."},{term:"Один уровень",text:"внутри направления направлений уже не бывает."},{term:"Удаление целого",text:"удаляет и его части — в вопросе они перечислены поимённо."},{term:"Перенести",text:"⚙ → «Часть проекта»: так существующий проект становится направлением другого или выносится обратно."}]},{title:"Настройки (⚙)",items:[{term:"Владелец",text:"компания, за которой числится проект."},{term:"Руководитель / ответственный",text:"один человек, который за это отвечает. Обычно из числа участников, но можно назначить любого."},{term:"Инструмент в проекте",text:"у инструмента отдельно указывается, для какого проекта он сделан — или что он служит всей группе."},{term:"Фон",text:"общий с большой картой."},{term:"Удалить",text:"люди остаются на своих местах; исчезают зоны, задачи и части."}]},{title:"Стоит посмотреть",items:[{text:"Полоска под названием показывает дыры: нет руководителя, зоны без владельца, люди без единой зоны, и те, кто владеет больше чем тремя зонами. Это не ошибки, а повод задать вопрос."},{text:"Правки в проектах не отменяются через Ctrl + Z и не попадают в Корзину — их страхуют только бэкапы. Удаляй проект осознанно."}]}],X4=[{title:"What this is",intro:"A project is work with an end: a lead, an owner company, and people from anywhere in the group. A tool is what the group builds for itself and keeps improving: no end, one person answerable for it, and it may belong to one project or to none. They are run the same way — people, zones of responsibility, tasks — which is why the screens are the same.",items:[]},{title:"Three views of the same thing",items:[{term:"Scheme",text:"the project as a tree: its people under the project card, arranged by who actually reports to whom on the org map, plus the zones nobody owns. Drag a card and it stays where you put it; Auto-arrange lays them out again."},{term:"Work",text:"every task in a table: state, title, zones, who does it, who else is pulled in, person-days, due date. Search, filter by state and by person, a count of what is overdue, and bulk actions — tick a few rows and change the state, hand them over, move them to a zone or delete them."},{term:"Zones",text:"the zones of responsibility: one owner each (★), whoever else works in them, and how much work is inside. A zone without an owner is flagged — it is a hole, not a detail."}]},{title:"People",items:[{term:"Adding",text:"the picker in the tab strip: start typing a name — anyone in the group will do."},{term:"Involvement",text:"their main work (●), part of their time (◐) or advice only (○). This is what a person's workload is made of on their own page."},{term:"Role",text:"what they are called here — “SEO Manager”, “tech lead”. Their title on the map is untouched."},{term:"Their zones",text:"in the person's editor: per zone, “—”, “works” or “★ owns”. One owner per zone, any number of people working in it."},{term:"Removing someone",text:"does not touch the map: they stay in their company, under their manager."},{term:"What-if",text:"a selected card on the scheme carries the same ✂ and ? as the map: a possible dism
81issal, and a question about it. Anyone marked is plain to see — the card fades and takes a badge."}]},{title:"Zones of responsibility",items:[{term:"What they are",text:"the pieces the project is made of: “Catalogue+”, “the site”, “content”. Not departments and not stages — parts that someone answers for."},{term:"+ Area",text:"in the tab strip. The name is edited by clicking it."},{term:"Clicking a zone",text:"opens its panel: the owner, who works in it, and all the work inside."},{term:"Deleting a zone",text:"takes its tasks with it — you are asked first, and told how many."}]},{title:"Tasks",items:[{term:"States",text:"backlog → to do → in progress → in review → done, changed by clicking the state in the table."},{term:"Zones per task",text:"a task may answer to several — a module that touches the catalogue and the admin panel belongs to both — or to none, and then it simply belongs to the project."},{term:"Who does it",text:"one assignee, and separately “who else”: a consultant, a lead developer, whoever accepts the work, a PM. The part is free text, and anyone can be pulled in, member or not."},{term:"Days and due date",text:"person-days are the size of it, the date is when it is due. What is overdue is counted at the top."},{term:"Subtasks",text:"in a zone's panel a task can hold pieces of its own; deleting the parent takes them."}]},{title:"Directions and modules",items:[{term:"Why",text:"a large project splits into directions, a large tool into modules. Each has its own people, zones and tasks, and is still part of the whole rather than a project beside it."},{term:"+ Direction",text:"next to + Area (a tool says + Module). The part appears in the left rail under its whole."},{term:"On the scheme",text:"parts are dashed cards off the root — clicking one opens its own scheme."},{term:"One level",text:"a direction holds no directions of its own."},{term:"Deleting the whole",text:"deletes its parts too — they are named in the question."},{term:"Moving one",text:"⚙ → “Part of the project”: an existing project becomes a direction of another, or goes back to being on its own."}]},{title:"Settings (⚙)",items:[{term:"Owner",text:"the company the project belongs to."},{term:"Lead / responsible",text:"the one person answerable for it. Usually someone on it, but anyone can be named."},{term:"A tool in a project",text:"a tool says separately which project it was built for — or that it serves the whole group."},{term:"Background",text:"shared with the big map."},{term:"Delete",text:"people stay where they are; the zones, the tasks and the parts go."}]},{title:"Worth a look",items:[{text:"The strip under the name shows the holes: no lead, zones without an owner, people without a single zone, and anyone owning more than three. Not errors — questions worth asking."},{text:"Edits here are not part of Ctrl + Z and do not go to the Trash; only the backups cover them. Delete a project deliberately."}]}],Lw={ru:G4,en:X4},Z4=[{title:"Что это",intro:"Отделы — взгляд на группу не по схеме, а по подразделениям: слева дерево компаний и отделов внутри них, справа — выбранный отдел и всё, чем заняты его люди. Карта отвечает «кто кому подчиняется», этот экран — «чем занят отдел».",items:[]},{title:"Дерево слева",items:[{term:"Поиск",text:"поле сверху отбирает отделы по названию — по всем компаниям сразу."},{term:"Вложенность",text:"подразделения показаны под своим отделом. Создаются они на карте («+ Подразделение» на карточке отдела)."},{term:"Клик",text:"открывает отдел справа; адрес меняется, так что ссылку на отдел можно отправить."}]},{title:"Шапка отдела",items:[{term:"Руководитель",text:"тот, кто наÐ
81·Ð½Ð°Ñ‡ÐµÐ½ главой отдела. Если своего нет, показан руководитель отдела выше с пометкой, откуда он — и это повод назначить своего."},{term:"Назначается",text:"не здесь, а на карте: на карточке отдела выбирается один из его людей."},{term:"Подразделения",text:"если внутри есть свои, это написано рядом с названием."}]},{title:"Четыре числа",items:[{term:"Люди",text:"сколько человек в отделе с учётом подразделений, и отдельно — сколько сидит непосредственно здесь."},{term:"На проектах",text:"сколько людей отдела заняты хотя бы в одном проекте или инструменте."},{term:"Постоянные обязанности",text:"сколько у отдела стоячих обязанностей — работа без даты окончания."},{term:"Простаивают",text:"у скольких нет ни проекта, ни обязанности, ни работы со сроком. Это не обвинение, а вопрос: либо человек и правда свободен, либо его работу просто не внесли."},{term:"Клик по числу",text:"оставляет в списке ровно тех, кого оно посчитало — включая людей из подразделений, ведь считает оно их тоже. На схеме дерево не режется: остальные просто гаснут, так что видно и кто, и где он стоит. Повторный клик или «показать всех» снимает отбор."}]},{title:"Список и схема",items:[{term:"Список",text:"таблица людей отдела: проекты с пометкой вовлечённости, постоянные обязанности и работа со сроком. Клик по человеку открывает его карточку, клик по проекту — сам проект."},{term:"Схема",text:"те же люди деревом по подчинению внутри отдела — видно, кто на ком замкнут. При наведении на карточку появляются ✂ и ?: те же пометки «возможное увольнение» и «под вопросом», что на карте."},{term:"Подразделения",text:"их люди показаны отдельными группами со своим счётчиком простаивающих."}]},{title:"Где что менять",items:[{text:"Этот экран — чтение. Состав, руководитель, подразделения и подчинение правятся на Карте; проекты и задачи — в разделе Проекты."},{term:"Кто-то не в том отделе",text:"перетащи его на карте к нужному отделу или смени отдел в его панели."},{term:"Отдел пуст",text:"значит, люди есть в компании, но отдел им не проставлен — на карте они висят прямо от карточки компании."}]}],F4=[{title:"What this is",intro:"Departments is the group seen by unit rather than by the chart: the tree of companies and their departments on the left, the chosen department and everything its people carry on the right. The map answers “who reports to whom”; this screen answers “what is this department busy with”.",items:[]},{title:"The tree on the left",items:[{term:"Search",text:"the field at the top picks departments by name, across every company at once."},{term:"Units",text:"a department's own units sit under it. They are created on the map (+ Unit on a department card)."},{term:"Clicking one",text:"opens it on the right; the address changes, so a link to a department can be sent to someone."}]},{title:"The department's header",items:[{term:"Head",text:"whoever is named head of it. With none of its own, the head of the department above is shown with a note of where they come from — which is a reason to name one."},{term:"Naming one",text:"happens on the map, not here: the department card picks one of its own people."},{term:"Units",text:"if it holds units of its own, that is said next to the name."}]}
81,{title:"Four numbers",items:[{term:"People",text:"how many are in it counting its units, and separately how many sit in it directly."},{term:"On projects",text:"how many of them are on at least one project or tool."},{term:"Standing duties",text:"how many standing responsibilities the department carries — work with no end date."},{term:"Idle",text:"how many have no project, no duty and no timed work. Not an accusation but a question: either they really are free, or their work was never written down."},{term:"Clicking a number",text:"leaves exactly the people it counted in the list — those in the units included, since it counts them too. On the chart the tree is not cut apart: the rest simply fade, so you see both who and where they stand. Clicking it again, or “show everyone”, clears it."}]},{title:"List and chart",items:[{term:"List",text:"a table of its people: projects with how involved they are, standing duties, and work with a deadline. Clicking a person opens their page, clicking a project opens it."},{term:"Chart",text:"the same people as a tree by who reports to whom inside the department. Hovering a card brings up ✂ and ? — the same “possible dismissal” and “under review” marks as on the map."},{term:"Units",text:"their people are shown as groups of their own, each with its own count of the idle."}]},{title:"Where things are changed",items:[{text:"This screen reads. Who is in a department, its head, its units and who reports to whom are edited on the Map; projects and tasks in Projects."},{term:"Someone in the wrong department",text:"drag them to it on the map, or change the department in their panel."},{term:"An empty department",text:"means the people are in the company but have no department set — on the map they hang straight off the company card."}]}],K4={ru:Z4,en:F4},Q4=[{title:"Что это",intro:"Команда — таблица всех людей группы и того, чем каждый занят: проекты, работа с исполнением, постоянные обязанности, зоны ответственности. Карта показывает, кто где числится; здесь видно, кто чем реально загружен и у кого руки свободны.",items:[]},{title:"Как отобрать нужных",items:[{term:"Поиск",text:"по имени, должности и отделу сразу."},{term:"Фильтры",text:"компания, отдел, участие в конкретном проекте."},{term:"Все / Заняты / Свободны",text:"«Свободны» — те, у кого нет ни проекта, ни обязанности, ни работы со сроком."},{term:"Сортировка",text:"клик по «Человек» переключает: сначала занятые → А-Я → Я-А."}]},{title:"Колонки",items:[{term:"Занят в",text:"проекты и инструменты человека. Значок показывает вовлечённость: ● основная работа, ◐ часть времени, ○ советует. Значок кликается — вовлечённость меняется прямо в таблице, а «+» рядом ставит человека на новый проект."},{term:"Работа",text:"сколько задач на человеке; рядом отмечено, сколько просрочено."},{term:"План",text:"человеко-дни, отложенные на его незакрытые задачи, — грубая мера объёма."},{term:"Срок",text:"ближайшая дата из его задач."},{term:"Обязанности",text:"постоянные дела без даты окончания."},{term:"Со сроком",text:"работа с началом и концом, не привязанная к проекту."},{term:"Зоны",text:"сколько зон ответственности человек держит как владелец."}]},{title:"Карточка человека",intro:"Клик по имени открывает его страницу — у неё свой адрес, ссылку можно отправить.",items:[{term:"Подчинение",text:"кому подчиняется и кто в его команде; по именам можно ходить дальше."}
81,{term:"Работа",text:"его незакрытые задачи: статус, человеко-дни, срок, просрочка. Клик ведёт в проект, где задача живёт."},{term:"Проекты",text:"где он участвует, с ролью, вовлечённостью, пометкой руководителя и списком зон: чем владеет и где просто работает."},{term:"Постоянные обязанности",text:"то, что человек делает всегда и что не является проектом: «ведёт отчёты по SEO», «отвечает за доступы». Добавляются прямо здесь."},{term:"Работа со сроком",text:"отдельный кусок работы с началом и концом, вне проектов. Тоже добавляется здесь."},{term:"Что если",text:"здесь же помечают возможное увольнение (✂) и «под вопросом» (?) — те же пометки, что ставятся на карте. Если пометку поставили там, на карточке она видна плашкой у имени."},{term:"Показать на карте",text:"переводит на карту и подсвечивает этого человека."}]},{title:"Что считается загрузкой",items:[{text:"Загрузка складывается из проектов с весом вовлечённости (основная работа весит больше советов), плюс зоны во владении и руководство проектами. Это не часы и не процент занятости — это способ увидеть перекос: у кого пять основных проектов, а у кого ни одного."},{text:"«Свободен» почти всегда значит не «бездельничает», а «его работа не внесена». Первое, что стоит сделать с таким человеком, — спросить, чем он занят, и записать это обязанностью."}]},{title:"Где что менять",items:[{term:"Здесь",text:"вовлечённость в проекте, постановка на проект, постоянные обязанности и работа со сроком."},{term:"На карте",text:"имя, должность, фото, отдел, компания и подчинение."},{term:"В проекте",text:"роль, зоны ответственности и задачи."},{text:"Обязанности и работа со сроком не отменяются через Ctrl + Z — удаляй их осознанно, вопрос об этом задаётся."}]}],W4=[{title:"What this is",intro:"Team is every person in the group and what each of them carries: projects, work with a deadline, standing duties, zones of responsibility. The map shows where people sit; this shows who is actually loaded and whose hands are free.",items:[]},{title:"Narrowing it down",items:[{term:"Search",text:"by name, job title and department at once."},{term:"Filters",text:"company, department, and being on one particular project."},{term:"Everyone / Engaged / Free",text:"“Free” means no project, no duty and no timed work."},{term:"Sorting",text:"clicking “Person” cycles: the engaged first → A-Z → Z-A."}]},{title:"The columns",items:[{term:"Engaged in",text:"their projects and tools. The mark is how involved they are: ● main work, ◐ part of the time, ○ advises. The mark is clickable — involvement changes right in the table, and “+” beside it puts them on another project."},{term:"Work",text:"how many tasks are on them, with how many are overdue noted beside it."},{term:"Planned",text:"person-days set aside for their open tasks — a rough measure of size."},{term:"Due",text:"the nearest date among their tasks."},{term:"Duties",text:"standing things with no end date."},{term:"Timed",text:"work with a start and an end that belongs to no project."},{term:"Areas",text:"how many zones of responsibility they own."}]},{title:"A person's card",intro:"Clicking a name opens their page; it has an address of its own, so the link can be sent.",items:[{term:"Reporting",text:"who they report to and who is in their team; the names lead on."},{term:"Work",text:"their open tasks: state, person-days, due date, what is late. Clicking one opens the project it lives in."},{term:"Projects",text:"where they are, with role, involvement, a lead badge, and their zones: what they own and where they merely work."},{term:"Standing duties",text:"what a person always does and what is not a project: “keeps the SEO reports”, “looks after access”. Added right here."},{term:"Timed work",text:"a separate piece of work with a start and an end, outside any project. Added here too."}
81,{term:"What-if",text:"a possible dismissal (✂) and “under review” (?) are set from here too — the same marks the map sets. A mark put on the map shows as a badge beside the name here."},{term:"Show on the map",text:"jumps to the map with them highlighted."}]},{title:"What counts as load",items:[{text:"Load is the projects weighted by involvement (main work weighs more than advice), plus the zones owned and the projects led. Not hours and not a percentage — a way to see the skew: who has five main projects and who has none."},{text:"“Free” almost always means “their work was never written down”, not “they are idle”. The first move with such a person is to ask what they do and record it as a duty."}]},{title:"Where things are changed",items:[{term:"Here",text:"involvement in a project, putting someone on one, standing duties and timed work."},{term:"On the map",text:"name, job title, photo, department, company and who they report to."},{term:"In the project",text:"their role, the zones and the tasks."},{text:"Duties and timed work are not part of Ctrl + Z — delete them deliberately; you are asked first."}]}],J4={ru:Q4,en:W4},eI=[{title:"Что это",intro:"Планирование отвечает на один вопрос: делаем ли мы правильные вещи. Для этого ставятся цели — то, что должно стать правдой к концу своего периода, — и к каждой привязывается работа, которая на неё идёт. Всё остальное на экране выводится из этого сопоставления.",items:[]},{title:"Период",items:[{term:"У каждой цели свой",text:"что-то делается месяц, что-то год — общего квартала нет. По умолчанию новая цель берёт текущий квартал; клик по периоду открывает пресеты (месяц, квартал, следующий квартал, полгода, год) и два поля с датами."},{term:"Срок прошёл",text:"период закончился, а цель не закрыта — период подсвечен и цель уходит в «Завершённые» только после того, как ей поставят «Достигнута» или «Отменена»."},{term:"Идут / Все / Завершённые",text:"переключатель сверху. «Идут» — то, чем занимаются сейчас; счётчики внизу считаются по ним."}]},{title:"Цель",items:[{term:"Формулировка",text:"то, что должно стать правдой: «20 новых сайтов запущено», «Monoslots вышел на самоокупаемость». Не задача и не проект — результат."},{term:"Сколько",text:"пять-десять на квартал — на компанию, не на всю группу. Больше десяти экран скажет вслух: это уже список дел, с ним никто не сверяется."},{term:"Чья",text:"у каждой компании свои цели — экран сгруппирован по ним. Цель, общая для всех, заводится на «всю группу»."},{term:"Кто отвечает",text:"один человек. Цель без ответственного подсвечена — это самая частая причина, по которой цель никуда не движется."},{term:"Пояснение",text:"одна фраза о том, что имеется в виду, если из формулировки не очевидно."}]},{title:"Как идёт",items:[{term:"Пять состояний",text:"по плану · под риском · не движется · достигнута · отменена. Плашка справа от названия и цвет левого края карточки — это оно: видно до того, как что-то прочитано."},{term:"«Что происходит»",text:"строка рядом с состоянием. Без неё «под риском» — просто красный кружок; с ней — разговор по существу."},{term:"Дата",text:"проставляется сама при смене состояния, чтобы было видно, насколько свежая оценка."},{term:"Ритм",text:"раз в неделю пройтись по целям и поправить состояние — это и есть вся работа по ведению."},{term:"«Отменена»",text:"нормальный исход. Отменить цель осознанно лучше, чем тащить её мёртвой до конца периода."}]},{title:"Что должно случиться",items:[{term:"Шаги",text:"три-семь строк внутри цели, каждая с галочкой. Прогресс читается как «3 из 5» — без процентов и метрик, которые надо обновлять."},{term:"Заодно проверка",text:"если к цели не придумывается ни одного шаÐ
81³Ð°, это почти наверняка не цель, а лозунг. Перепиши формулировку в результат."},{term:"Шаги подсказывают работу",text:"из них обычно и видно, каких проектов не хватает."}]},{title:"Работа вокруг цели",items:[{term:"+ Существующая работа",text:"список проектов и инструментов с галочками. Один проект может тянуть несколько целей."},{term:"+ Новый проект под неё",text:"заводит проект в компании цели, сразу привязывает его и открывает. Это и есть порядок работы: сначала цель, потом проекты вокруг неё."},{term:"Чипы",text:"под целью показывают привязанное; клик открывает проект. Пунктирный чип — текущая работа."},{term:"Направления и модули",text:"привязываются так же, как целые проекты — если на цель работает только одно направление, честнее указать его."}]},{title:"Три кучки внизу",intro:"Вся работа группы раскладывается на три, и вопрос вызывает только одна.",items:[{term:"Не распределено",text:"не работает ни на одну цель и не помечено текущей работой. Это единственная настоящая дыра: привяжи к цели, признай текущей работой или закрывай. Ссылка «текущая» рядом помечает одним кликом."},{term:"Текущая работа",text:"идёт независимо от целей квартала: поддержание, производство, поддержка. Это нормально и вопросов не вызывает. Инструменты помечены так по умолчанию — у инструмента по определению нет конца; если инструмент и есть работа квартала, сними пометку крестиком."},{term:"Цели, над которыми никто не работает",text:"цель есть, работы под ней нет. Либо к ней не приступали, либо работа идёт, но не привязана."},{term:"Почему не загнать рутину под цели",text:"тогда появятся цели вида «обеспечивать работу Каталог+», и слово «цель» обесценится за один квартал. Лучше честно назвать рутину рутиной."}]},{title:"Чего здесь нет",items:[{text:"Ни сроков, ни оценок в человеко-днях, ни задач. Это сделано нарочно: в системе пока не ведут задачи, и планирование на них рассыпалось бы. Даты у проектов и дорожная карта — следующий слой, когда этот приживётся."},{text:"Ассистент умеет заводить цели, менять их состояние и привязывать проекты — «поставь цель на квартал…», «отметь, что цель под риском, потому что…»."}]}],tI=[{title:"What this is",intro:"Planning answers one question: are we doing the right things. Goals say what has to be true by the end of their period, and each goal gets the work that serves it. Everything else on the screen follows from that comparison.",items:[]},{title:"The period",items:[{term:"Each goal has its own",text:"some of this takes a month, some a year — there is no shared quarter. A new goal takes the current quarter by default;
81 clicking the period offers presets (month, quarter, next quarter, half a year, year) and two date fields."},{term:"Overdue",text:"the period is over and the goal is not closed — the period is flagged, and the goal only moves to “Finished” once it is marked achieved or cancelled."},{term:"Running / All / Finished",text:"the switch at the top. “Running” is what is being worked on now, and the counts below are taken from it."}]},{title:"A goal",items:[{term:"The sentence",text:"what has to be true: “20 new sites launched”, “Monoslots pays for itself”. Not a task and not a project — an outcome."},{term:"How many",text:"five to ten a quarter. Twenty goals are not goals but a to-do list, and nobody will check against them."},{term:"Whose",text:"each company keeps its own goals and the screen is grouped by them. A goal shared by everyone belongs to “the whole group”."},{term:"Who answers for it",text:"one person. A goal with nobody on it is flagged — it is the commonest reason a goal goes nowhere."},{term:"The note under it",text:"one line on what it means, when the sentence alone is not obvious."}]}
81,{title:"How it is going",items:[{term:"Five states",text:"to plan · at risk · not moving · achieved · cancelled. The pill beside the title and the colour of the card's left edge are that state: visible before anything is read."},{term:"“What is happening”",text:"the line beside the state. Without it “at risk” is a red dot; with it, it is a conversation."},{term:"The date",text:"set by itself when the state changes, so it is clear how fresh the reading is."},{term:"The rhythm",text:"walk the goals once a week and correct the states — that is the whole of the upkeep."},{term:"“Cancelled”",text:"a fine outcome. Killing a goal deliberately beats dragging a dead one to the end of its period."}]},{title:"What has to happen",items:[{term:"Steps",text:"three to seven lines inside the goal, each with a tick. Progress reads as “3 of 5” — no percentages, no metrics to keep up to date."},{term:"Also a test",text:"if no step comes to mind, what you have is almost certainly a slogan rather than a goal. Rewrite it as an outcome."},{term:"Steps suggest the work",text:"they are usually what shows which projects are missing."}]},{title:"The work around a goal",items:[{term:"+ Existing work",text:"lists projects and tools with ticks. One project may pull several goals."},{term:"+ New project for it",text:"creates a project in the goal's company, ties it in and opens it. That is the order of work: the goal first, the projects around it."},{term:"The chips",text:"under a goal are what is tied to it; clicking one opens it. A dashed chip is routine work."},{term:"Directions and modules",text:"tie in like whole projects — when only one direction serves the goal, naming it is the honest thing."}]},{title:"The three piles at the bottom",intro:"All the group's work falls into three, and only one of them is a question.",items:[{term:"Unaccounted for",text:"serves no goal and is not marked routine. The only real hole: tie it to a goal, call it routine, or close it. The “routine” link beside it marks it in one click."},{term:"Routine",text:"runs whatever this quarter's goals are: upkeep, production, support. Fine, and not a question. Tools start marked this way — a tool has no end by definition; when a tool is this quarter's work, clear the mark with the ×."},{term:"Goals nothing is working on",text:"the goal is there, the work is not. Either nobody has started, or the work exists and was never tied in."},{term:"Why routine is not forced under goals",text:"because then goals like “keep Каталог+ running” appear, and the word “goal” means nothing by the end of the quarter. Better to call routine what it is."}]},{title:"What is not here",items:[{text:"No deadlines, no person-day estimates, no tasks. Deliberately: tasks are not kept in this system yet, and planning built on them would collapse. Project dates and a roadmap are the next layer, once this one has taken."},{text:"The assistant can add goals, change their state and tie projects to them — “set a goal for the quarter…”, “mark that goal at risk because…”."}]}],nI={ru:eI,en:tI},ip={map:{title:"How the map works",sections:q4},projects:{title:"How projects work",sections:Lw},tools:{title:"How tools work",sections:Lw},departments:{title:"How departments work",sections:K4},team:{title:"The team and a person's card",sections:J4},planning:{title:"How planning works",sections:nI}};function aI({topic:e,money:a,onClose:l}){const i=qe(),[r,u]=N.useState(0);N.useEffect(()=>{const h=()=>u(document.querySelector(".bar")?.getBoundingClientRect().bottom??0);h();const g=p=>{p.key==="Escape"&&l()};return window.addEventListener("keydown",g),window.addEventListener("resize",h),()=>{window.removeEventListener("keydown",g),window.removeEventListener("resize",h)}},[l]);const d=ip[e].sections[i.lang];return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"panel-scrim",style:{top:r},onClick:l}),s.jsxs("aside",{className:"side-panel help-sheet",style:{top:r},role:"dialog","aria-label":i(ip[e].title),children:[s.jsxs("header",{className:"panel-head",children:[s.jsx("strong",{children:i(ip[e].title)}),s.jsx("button",{type:"button",className:"icon-btn",title:i("Close"),"aria-label":i("Close"),onClick:l,children:"×"})]}),s.jsx("div",{className:"panel-body help-body",children:d.map(h=>{const g=h.items.filter(p=>a||!p.money);return!g.length&&!h.intro?null:s.jsxs("section",{className:"help-section",children:[s.jsx("h4",{children:h.title}),h.intro&&s.jsx("p",{className:"help-intro",children:h.intro}),g.length>0&&s.jsx("dl",{className:"help-list",children:g.map(p=>s.jsxs("div",{className:"help-row",children:[p.term&&s.jsx("dt",{children:p.term}),s.jsx("dd",{children:p.text})]},(p.term??"")+p.text))})]},h.title)})})]})]})}const Uw=[{kind:"tags",label:"Tags",usedIn:"companies"},{kind:"titles",label:"Job titles",usedIn:"people"},{kind:"departments",label:"Departments",usedIn:"people"}];function sI({entries:e,onAdd:a,onRename:l,onRemove:i}){const[r,u]=N.useState("tags"),[d,h]=N.useState(""),[g,p]=N.useState("name"),[x,m]=N.useState(""),[v,k]=N.useState(null),[T,S]=N.useState(""),C=N.useRef(null),z=qe(),E=Uw.find(U=>
81U.kind===r),j=z(E.label),O=z(E.usedIn);N.useEffect(()=>{v!==null&&(C.current?.focus(),C.current?.select())},[v]);const w=N.useMemo(()=>{const U=d.trim().toLowerCase();return e[r].filter(q=>!U||q.value.toLowerCase().includes(U)).sort((q,W)=>g==="used"&&W.used-q.used||q.value.localeCompare(W.value))},[e,r,d,g]),b=U=>e[r].some(Y=>Y.value.toLowerCase()===U.toLowerCase());function A(){const U=x.trim();!U||b(U)||(a(r,U),m(""))}async function D(){const U=v,Y=T.trim();if(k(null),!(!U||!Y||Y===U)){if(b(Y)&&Y.toLowerCase()!==U.toLowerCase()){const q=e[r].find(W=>W.value.toLowerCase()===Y.toLowerCase()).value;if(!await Dt(z('"{target}" already exists. Merge "{from}" into it?',{target:q,from:U}),{okLabel:"Merge"}))return;l(r,U,q);return}l(r,U,Y)}}async function M(U){U.used>0&&!await Dt(z('"{value}" is used by {n} {what}. Remove it from them as well?',{value:U.value,n:U.used,what:O}),{okLabel:"Remove",danger:!0})||i(r,U.value)}return s.jsxs("div",{className:"dict",children:[s.jsx("div",{className:"tabs dict-tabs",role:"tablist",children:Uw.map(U=>s.jsxs("button",{type:"button",role:"tab","aria-selected":r===U.kind,className:r===U.kind?"on":"",onClick:()=>{u(U.kind),h(""),k(null)},children:[z(U.label)," ",s.jsx("span",{className:"count",children:e[U.kind].length})]},U.kind))}),s.jsxs("div",{className:"dict-bar",children:[s.jsx("input",{type:"search",className:"dict-search",placeholder:z("Search {what}…",{what:j.toLowerCase()}),value:d,onChange:U=>h(U.target.value)}),s.jsxs("form",{className:"dict-add",onSubmit:U=>{U.preventDefault(),A()},children:[s.jsx("input",{value:x,placeholder:z("New value"),onChange:U=>m(U.target.value)}),s.jsx("button",{className:"btn small",type:"submit",disabled:!x.trim()||b(x.trim()),children:z("Add")})]})]}),s.jsxs("div",{className:"dict-table",role:"table",children:[s.jsxs("div",{className:"dict-head",role:"row",children:[s.jsx("button",{type:"button",className:`dict-sort ${g==="name"?"on":""}`,onClick:()=>p("name"),children:z("Name")}),s.jsx("button",{type:"button",className:`dict-sort ${g==="used"?"on":""}`,onClick:()=>p("used"),children:z("Used")}),s.jsx("span",{})]}),s.jsxs("div",{className:"dict-rows",children:[w.map(U=>s.jsxs("div",{className:"dict-row",role:"row",children:[v===U.value?s.jsx("input",{ref:C,className:"dict-edit",value:T,onChange:Y=>S(Y.target.value),onBlur:D,onKeyDown:Y=>{Y.key==="Enter"&&D(),Y.key==="Escape"&&k(null)}}):s.jsx("button",{type:"button",className:"dict-name",title:z("Rename (updates every card that uses it)"),onClick:()=>{k(U.value),S(U.value)},children:U.value}),s.jsx("span",{className:`dict-used ${U.used?"":"zero"}`,title:U.used?z("Used by {n} {what}",{n:U.used,what:O}):z("Not used"),children:U.used||"–"}),s.jsx("button",{type:"button",className:"icon-btn",title:z("Remove"),"aria-label":`${z("Remove")} ${U.value}`,onClick:()=>M(U),children:"×"})]},U.value)),w.length===0&&s.jsx("p",{className:"hint dict-empty",children:d?z("Nothing matches."):z("No {what} yet.",{what:j.toLowerCase()})})]})]}),s.jsx("p",{className:"hint",children:z("Click a name to rename it everywhere. New values typed on a card are added here automatically.")})]})}const Z1=N.createContext(!1),_g=()=>N.useContext(Z1),an=(e,a)=>!!e?.permissions?.includes(a),Yd=e=>an(e,"scope.all"),Hw=e=>!!e?.permissions?.some(a=>/\.(create|update|delete)$/.test(a)&&!a.startsWith("assistant.")),rp=e=>e.filter(a=>!a.context);function et({label:e,k:a,by:l,toggle:i,firstDir:r,className:u,colSpan:d}){return s.jsx("th",{className:u,colSpan:d,"aria-sort":l?.key===a?l.dir==="asc"?"ascending":"descending":"none",children:s.jsxs("button",{type:"button",className:"tsort",onClick:()=>i(a,r),children:[e,qp(l,a)]})})}function lI(e,a){return e.permissions==null?a("no keys from the panel yet"):e.permissions.length===0?a("no access"):`${e.permissions.includes("scope.all")?a("sees everything"):a("sees own work and department")} · ${a("{n} keys",{n:e.permissions.length})}`}function oI({me:e,people:a,onStatus:l}){const i=qe(),[r,u]=N.useState([]),[d,h]=N.useState(null),g=()=>Se.listUsers().then(u).catch(w=>h(w.message));N.useEffect(()=>{g()},[]);const p=async(w,b)=>{try{const A=await Se.updateUser(w.id,b);u(D=>D.map(M=>M.id===w.id?{...M,...A}:M)),l("Saved")}catch(A){h(A instanceof Error?A.message:"Something went wrong")}},{sorted:x,by:m,toggle:v}=fs(r,{email:w=>w.email.toLowerCase(),name:w=>w.name.toLowerCase(),person:w=>(a.find(b=>b.id===w.personId)?.fullName??"").toLowerCase(),access:w=>w.permissions==null?-1:(w.permissions.includes("scope.all")?1e3:0)+w.permissions.length,money:w=>!!w.seeMoney,seen:w=>w.lastSeenAt??""}),k=e.money!==!1,T=i(k?"Sees money":"Sees what-if marks"),S=w=>
81w?new Date(w).toLocaleString(i.lang==="ru"?"ru-RU":"en-GB",{dateStyle:"medium",timeStyle:"short"}):i("never"),[C,z]=N.useState(!1),[E,j]=N.useState(null),O=async()=>{z(!0),h(null);try{const w=await Se.syncUsers();await g(),j([i("Accounts added: {n}",{n:w.added}),w.linked?i("tied to their card: {n}",{n:w.linked}):"",w.withoutEmail?i("people without a corporate email: {n}",{n:w.withoutEmail}):"",w.asked?i("keys asked of the panel: {n} of {m}",{n:w.answered,m:w.asked}):""].filter(Boolean).join(" · ")),l("Saved")}catch(w){h(w instanceof Error?w.message:"Something went wrong")}finally{z(!1)}};return s.jsxs("div",{className:"users",children:[d&&s.jsx("p",{className:"error",children:i(d)}),an(e,"users.update")&&s.jsxs("div",{className:"users-sync",children:[s.jsx("button",{type:"button",className:"btn",onClick:O,disabled:C,title:i("An account for every working person whose card has a corporate email, before they sign in, with the keys the admin panel gives them. Existing accounts stay as they are."),children:C?"…":i("Sync with the team")}),E&&s.jsx("span",{className:"hint",children:E})]}),s.jsx("div",{className:"users-scroll",children:s.jsxs("table",{className:"stats-table users-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx(et,{label:i("Email"),k:"email",by:m,toggle:v}),s.jsx(et,{label:i("Name"),k:"name",by:m,toggle:v}),s.jsx(et,{label:i("Person"),k:"person",by:m,toggle:v}),s.jsx(et,{label:i("Access"),k:"access",by:m,toggle:v,firstDir:"desc"}),s.jsx(et,{label:T,k:"money",by:m,toggle:v,firstDir:"desc",className:"user-flag"}),s.jsx(et,{label:i("Last seen"),k:"seen",by:m,toggle:v,firstDir:"desc"}),s.jsx("th",{})]})}),s.jsx("tbody",{children:x.map(w=>s.jsxs("tr",{children:[s.jsxs("td",{className:"user-email",children:[w.email,w.id===e.id?s.jsxs("span",{className:"hint",children:[" · ",i("you")]}):null]}),s.jsx("td",{children:s.jsx("input",{value:w.name,disabled:!an(e,"users.update"),onChange:b=>u(A=>A.map(D=>D.id===w.id?{...D,name:b.target.value}:D)),onBlur:b=>b.target.value!==w.name&&p(w,{name:b.target.value}),placeholder:"—"})}),s.jsx("td",{children:(()=>{const b=a.find(A=>A.id===w.personId);return b?s.jsxs("span",{className:"user-person",children:[s.jsx(Xe,{person:b,size:20}),b.fullName]}):s.jsx("span",{className:"hint",children:i("no card with this address")})})()}),s.jsx("td",{className:"dim user-access",title:(w.permissions??[]).join(", "),children:lI(w,i)}),s.jsx("td",{className:"user-flag",children:s.jsx("input",{type:"checkbox",checked:!!w.seeMoney,disabled:!an(e,"users.update"),onChange:b=>p(w,{seeMoney:b.target.checked}),"aria-label":T})}),s.jsx("td",{className:"dim user-seen",children:S(w.lastSeenAt)}),s.jsxs("td",{className:"row-actions",children:[w.id!==e.id&&!e.impersonator&&an(e,"users.impersonate")&&s.jsx("button",{type:"button",className:"link",title:i("See Orgamini exactly as {email} does, with their access. A bar at the bottom brings you back.",{email:w.email}),onClick:async()=>{try{await Se.impersonate(w.id),window.location.assign("/")}catch(b){h(b instanceof Error?b.message:"Something went wrong")}},children:i("sign in as")}),w.id!==e.id&&an(e,"users.delete")&&s.jsx("button",{type:"button",className:"link danger",onClick:async()=>{if(await Dt(i("Delete user {email}?",{email:w.email}),{okLabel:"Delete",danger:!0}))try{await Se.deleteUser(w.id),u(b=>b.filter(A=>A.id!==w.id)),l("Deleted")}catch(b){h(b instanceof Error?b.message:"Something went wrong")}},children:i("delete")})]})]},w.id))})]})}),s.jsx("p",{className:"hint",children:i("Whose account is whose is decided by the corporate email on the person's card: fill it in on the team screen and the photo and the name follow by themselves.")}),s.jsx("p",{className:"hint",children:i("Who can sign in and what they may do is decided in the admin panel, key by key: the keys are listed in docs/07-доступы.md. Without “scope.all” a person sees only their own work and their department. Keys are read again at every sign-in and every ten minutes.")}),s.jsx("p",{className:"hint",children:i(k?"“Sees money” is set here, not in the panel: salaries, shares, payroll and the what-if marks (possible dism
81issal, under review) are hidden by the server for everyone it is off for, and it is off until turned on.":"“Sees what-if marks” is set here, not in the panel: the marks “possible dismissal” and “under review” are hidden by the server for everyone it is off for, and it is off until turned on. This instance keeps no salaries at all.")})]})}function iI({me:e,onStatus:a}){const l=qe(),[i,r]=N.useState(null),[u,d]=N.useState(null),[h,g]=N.useState(!1),p=()=>Se.assistantLog().then(r).catch(E=>d(E.message));N.useEffect(()=>{p()},[]);const x=E=>E>=1?`$${E.toFixed(2)}`:`$${E.toFixed(4)}`,{sorted:m,by:v,toggle:k}=fs(i?.entries??[],{at:E=>E.at,user:E=>(E.user??"").toLowerCase(),request:E=>E.request.toLowerCase(),ok:E=>E.ok?1:0,tokens:E=>E.promptTokens+E.completionTokens,cost:E=>E.cost??0},{key:"at",dir:"desc"}),T=E=>new Date(E).toLocaleString(l.lang==="ru"?"ru-RU":"en-GB",{dateStyle:"short",timeStyle:"short"}),S=i?.model??"",C=i?.prices?.[S]??i?.prices?.[S.replace(/-\d{4}-\d{2}-\d{2}$/,"")];async function z(E){const j={...i?.prices??{},[S]:{...i?.prices?.[S]??{},...E}};try{await Se.setSetting("assistant_prices",j),r(O=>O&&{...O,prices:j}),a("Saved"),p()}catch(O){d(O instanceof Error?O.message:"Something went wrong")}}return u?s.jsx("p",{className:"error",children:l(u)}):i?s.jsxs("div",{className:"assistant-settings",children:[s.jsxs("p",{className:"hint",children:[i.configured?l("Model: {model}",{model:i.model}):l("Not configured: OPENAI_API_KEY is missing on the server."),an(e,"users.read")?` · ${l("you see everyone's requests")}`:` · ${l("your own requests")}`]}),s.jsxs("div",{className:"tiles small",children:[s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:l("Today")}),s.jsx("span",{className:"tile-value",children:x(i.totals.costToday)})]}),s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:l("30 days")}),s.jsx("span",{className:"tile-value",children:x(i.totals.cost30)})]}),s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:l("All time")}),s.jsx("span",{className:"tile-value",children:x(i.totals.costAll)}),s.jsx("span",{className:"tile-sub",children:l("{n} requests · {k}K tokens",{n:i.totals.requests,k:Math.round(i.totals.tokens/1e3)})})]})]}),an(e,"settings.update")&&an(e,"users.read")&&s.jsx(rI,{model:S,value:C??{in:0,out:0},cached:C?.cached,onSave:z,known:!!C}),s.jsx("button",{type:"button",className:"link",onClick:()=>g(E=>!E),children:h?l("Hide the log"):l("Show the log ({n})",{n:i.entries.length})}),h&&s.jsxs("table",{className:"stats-table log-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx(et,{label:l("When"),k:"at",by:v,toggle:k,firstDir:"desc"}),an(e,"users.read")&&s.jsx(et,{label:l("Who"),k:"user",by:v,toggle:k}),s.jsx(et,{label:l("Request"),k:"request",by:v,toggle:k}),s.jsx(et,{label:l("Result"),k:"ok",by:v,toggle:k}),s.jsx(et,{label:l("Tokens"),k:"tokens",by:v,toggle:k,firstDir:"desc",className:"num"}),s.jsx(et,{label:l("Cost"),k:"cost",by:v,toggle:k,firstDir:"desc",className:"num"})]})}),s.jsxs("tbody",{children:[m.map(E=>s.jsxs("tr",{className:E.ok?"":"failed",children:[s.jsx("td",{className:"dim",children:T(E.at)}),an(e,"users.read")&&s.jsx("td",{className:"dim",children:E.user??"—"}),s.jsxs("td",{children:[s.jsx("span",{className:`log-kind ${E.kind}`,children:l(E.kind==="chat"?"question":"action")})," ",E.request]}),s.jsx("td",{className:"dim",children:E.ok?E.result:E.error}),s.jsx("td",{className:"num dim",children:E.promptTokens+E.completionTokens||"—"}),s.jsx("td",{className:"num",children:E.cost?x(E.cost):"—"})]},E.id)),i.entries.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"hint",children:l("Nothing yet.")})})]})]})]}):s.jsx("p",{className:"hint",children:"…"})}function rI({model:e,value:a,cached:l,known:i,onSave:r}){const u=qe(),[d,h]=N.useState(String(a.in||"")),[g,p]=N.useState(String(a.out||""));return s.jsxs("form",{className:"price-form",onSubmit:x=>{x.preventDefault(),r({in:Number(d)||0,out:Number(g)||0})},children:[s.jsx("span",{className:"label",children:u("Price per 1M tokens, {model}",{model:e})}),s.jsx("input",{type:"number",step:"0.01",min:"0",value:d,onChange:x=>h(x.target.value),placeholder:u("input")}),s.jsx("input",{type:"number",step:"0.01",min:"0",value:g,onChange:x=>p(x.target.value),placeholder:u("output")}),s.jsx("button",{type:"submit",className:"btn small",children:u("Save")}),l!==void 0&&s.jsx("span",{className:"hint",children:u("cached input ${n}",{n:l})}),!i&&s.jsx("span",{className:"hint",children:u("Until the prices are filled 
81in, the cost shows as $0 — take them from platform.openai.com/docs/pricing.")})]})}const cI={company:"company",person:"person",department:"department"};function uI({canRestore:e,onRestored:a,onStatus:l}){const i=qe(),[r,u]=N.useState(null),[d,h]=N.useState(null),[g,p]=N.useState(null),x=()=>Se.listTrash().then(u).catch(k=>p(k.message));N.useEffect(()=>{x()},[]);const m=k=>new Date(k).toLocaleString(i.lang==="ru"?"ru-RU":"en-GB",{dateStyle:"medium",timeStyle:"short"}),v=k=>{const T=[];return k.kind!=="person"&&k.summary.people&&T.push(i("{n} people",{n:k.summary.people})),k.kind==="company"&&k.summary.departments&&T.push(i("{n} departments",{n:k.summary.departments})),k.kind==="company"&&k.summary.companies&&T.push(i("{n} sub-companies",{n:k.summary.companies})),T.join(" · ")};return s.jsx(Os,{label:i("Trash"),hint:i("Whatever a delete took away — people, photos, project and task memberships — kept whole for 30 days. Restore puts it back under the same ids."),children:s.jsxs("div",{className:"trash",children:[g&&s.jsx("span",{className:"error",children:i(g)}),r&&r.length===0&&s.jsx("span",{className:"hint",children:i("Nothing deleted lately.")}),r?.map(k=>s.jsxs("div",{className:"trash-row",children:[s.jsx("span",{className:"trash-kind",children:i(cI[k.kind])}),s.jsx("span",{className:"trash-name",children:k.name||i("Untitled")}),s.jsxs("span",{className:"hint",children:[v(k),v(k)?" · ":"",m(k.deletedAt),k.deletedBy?` · ${k.deletedBy}`:""]}),e&&s.jsx("button",{type:"button",className:"btn small",disabled:d!==null,onClick:()=>{h(k.id),p(null),Se.restoreTrash(k.id).then(()=>(l("Restored"),a(),x())).catch(T=>p(T.message)).finally(()=>h(null))},children:d===k.id?"…":i("Restore")})]},k.id))]})})}function dI(){const e=qe(),[a,l]=N.useState(null),[i,r]=N.useState(!1),[u,d]=N.useState(null),h=()=>Se.listBackups().then(l).catch(x=>d(x.message));N.useEffect(()=>{h()},[]);const g=a?.backups[0],p=x=>new Date(x).toLocaleString(e.lang==="ru"?"ru-RU":"en-GB",{dateStyle:"medium",timeStyle:"short"});return s.jsx(Os,{label:e("Backups"),hint:e("pg_dump into the backups/ folder of the project: on start, 5 minutes after the last edit, and daily. All of today, then one per day for a month, then one per month."),children:s.jsxs("div",{className:"backups",children:[s.jsx("div",{children:u?s.jsx("span",{className:"error",children:u}):g?e("Latest: {when} · {kb} KB · {n} kept",{when:p(g.at),kb:Math.round(g.bytes/1024),n:a.backups.length}):a?e("No backups yet."):"…"}),s.jsx("button",{type:"button",className:"btn small",disabled:i,onClick:()=>{r(!0),d(null),Se.backupNow().then(h).catch(x=>d(x.message)).finally(()=>r(!1))},children:e(i?"Saving…":"Back up now")}),a&&s.jsx("span",{className:"hint mono",children:a.dir}),s.jsx("span",{className:"hint",children:e("Restore: npm run db:restore -- backups/<file>")})]})})}function Bw({id:e,value:a,step:l,onCommit:i}){const[r,u]=N.useState(String(a)),d=N.useRef(0);return s.jsx("input",{id:e,type:"number",step:l,min:"0",value:r,onChange:h=>{u(h.target.value),window.clearTimeout(d.current),d.current=window.setTimeout(()=>{const g=Number(h.target.value);g>0&&i(g)},500)}})}function Os({label:e,hint:a,htmlFor:l,children:i}){return s.jsxs("div",{className:"srow",children:[s.jsxs("div",{className:"srow-label",children:[l?s.jsx("label",{htmlFor:l,children:e}):s.jsx("span",{children:e}),a&&s.jsx("span",{className:"hint",children:a})]}),s.jsx("div",{className:"srow-control",children:i})]})}function Pw({value:e,options:a,onChange:l,label:i}){return s.jsx("div",{className:"tabs",role:"radiogroup","aria-label":i,children:a.map(r=>s.jsx("button",{type:"button",role:"radio","aria-checked":e===r.value,className:e===r.value?"on":"",title:r.hint,onClick:()=>l(r.value),children:r.label},r.value))})}const Gp="orgami.settingsTab";function hI(e){const a=qe(),l=e.me.money!==!1,i=[{id:"general",label:a("General")},...l?[{id:"money",label:a("Money")}]:[],{id:"dicts",label:a("Dictionaries")},{id:"assistant",label:a("Assistant")},{id:"account",label:a("Account")},...an(e.me,"users.read")?[{id:"users",label:a("Users")}]:[],{id:"about",label:a("Data")}],[r,u]=N.useState(()=>{try{const g=localStorage.getItem(Gp);return g&&i.some(p=>p.id===g)?g:"general"}catch{return"general"}}),d=i.some(g=>g.id===r)?r:"general",h=g=>{u(g);try{localStorage.setItem(Gp,g)}catch{}};return s.jsxs("div",{className:"settings",children:[s.jsxs("nav",{className:"settings-nav",role:"tablist","aria-label":a("Settings"),children:[s.jsx("h2",{children:a("Settings")}),i.map(g=>s.jsx("button",{type:"button",role:"tab","aria-selected":d===g.id,className:`settings-tab ${d===g.id?"on":""}`,onClick:()=>
81h(g.id),children:g.label},g.id))]}),s.jsxs("div",{className:"settings-body",children:[s.jsxs("section",{className:"settings-section",id:"s-general",hidden:d!=="general","aria-label":a("General"),children:[s.jsx(Os,{label:a("Interface language"),hint:a("Data (names, titles, departments, tags) stays as entered."),children:s.jsx(Pw,{value:e.lang,label:a("Interface language"),onChange:e.onLangChange,options:[{value:"en",label:"English"},{value:"ru",label:"Русский"}]})}),s.jsx(Os,{label:a("People branches grow"),hint:a("Changing the direction re-arranges the whole map."),children:s.jsx(Pw,{value:e.dir,label:a("People branches grow"),onChange:e.onDirChange,options:[{value:"down",label:a("Down"),hint:a("Org chart: people under the card")},{value:"right",label:a("Right"),hint:a("Mind map: people to the right of the card")}]})}),s.jsx(Os,{label:a("Background"),children:s.jsx("div",{className:"bg-grid wide",role:"radiogroup","aria-label":a("Background"),children:sh.map(g=>s.jsx("button",{type:"button",role:"radio","aria-checked":e.background===g.value,className:`bg-swatch bg-${g.value} ${e.background===g.value?"on":""}`,title:a(g.label),onClick:()=>e.onBackgroundChange(g.value),children:s.jsx("span",{className:"bg-name",children:a(g.label)})},g.value))})})]}),l&&s.jsxs("section",{className:"settings-section",id:"s-money",hidden:d!=="money","aria-label":a("Money"),children:[s.jsx(Os,{label:a("USD / UAH exchange rate"),htmlFor:"s-rate",hint:a("UAH per 1 USD. Example: ₴18,000 → {usd}",{usd:yt(18e3/e.rate)}),children:s.jsxs("div",{className:"unit-input",children:[s.jsx(Bw,{id:"s-rate",value:e.rate,step:"0.01",onCommit:e.onRateChange}),s.jsx("span",{className:"unit",children:"₴ / $"})]})}),s.jsx(Os,{label:a("EUR → USD rate (USD per 1 EUR)"),htmlFor:"s-eur",hint:a("Example: €1,153 → {usd}",{usd:yt(1153*e.eurRate)}),children:s.jsxs("div",{className:"unit-input",children:[s.jsx(Bw,{id:"s-eur",value:e.eurRate,step:"0.001",onCommit:e.onEurRateChange}),s.jsx("span",{className:"unit",children:"$ / €"})]})}),s.jsx("p",{className:"hint",children:a("Salaries can be entered in USD, UAH or EUR; payroll totals are always in USD at these rates.")}),s.jsx(Os,{label:a("Confidential mode"),hint:a("Hide salaries, profit shares and payroll totals everywhere in the app."),children:s.jsxs("label",{className:"switch",children:[s.jsx("input",{type:"checkbox",role:"switch",checked:e.confidential,onChange:g=>e.onConfidentialChange(g.target.checked)}),s.jsx("span",{className:"track","aria-hidden":"true"})]})})]}),s.jsxs("section",{className:"settings-section",id:"s-dicts",hidden:d!=="dicts","aria-label":a("Dictionaries"),children:[s.jsx("p",{className:"hint",children:a("Tags, job titles and departments offered as suggestions while typing.")}),s.jsx(sI,{entries:e.dictEntries,onAdd:e.onDictAdd,onRename:e.onDictRename,onRemove:e.onDictRemove})]}),s.jsxs("section",{className:"settings-section",id:"s-assistant",hidden:d!=="assistant","aria-label":a("Assistant"),children:[s.jsx("p",{className:"hint",children:a("What the ✦ assistant was asked and what it cost. Questions and applied actions are both logged.")}),s.jsx(iI,{me:e.me,onStatus:e.onStatus})]}),s.jsxs("section",{className:"settings-section",id:"s-account",hidden:d!=="account","aria-label":a("Account"),children:[s.jsx(Os,{label:a("You"),hint:a(l?"Who you are signed in as. The role and money access are set by an admin.":"Who you are signed in as. The role is set by an admin."),children:s.jsxs("div",{className:"account-who",children:[s.jsx("span",{className:"me-initial big","aria-hidden":"true",children:(e.me.name||e.me.email).slice(0,1).toUpperCase()}),s.jsxs("span",{children:[s.jsx("span",{className:"account-name",children:e.me.name||e.me.email}),s.jsxs("span",{className:"hint",children:[e.me.name?`${e.me.email} · `:"",a("access from the admin panel"),` · ${Yd(e.me)?a("sees everything"):a("sees own work and department")}`,l?` · ${e.me.seeMoney?a("sees money"):a("money hidden")}`:""]})]})]})}),s.jsx(Os,{label:a("Sign out"),hint:a("Ends this session on this device. Other devices stay signed in."),children:s.jsx("button",{type:"button",className:"btn",onClick:e.onSignOut,children:a("Sign out")})})]}),an(e.me,"users.read")&&s.jsx("section",{className:"settings-section",id:"s-users",hidden:d!=="users","aria-label":a("Users"),children:s.jsx(oI,{me:e.me,people:e.people,onStatus:e.onStatus})}),s.jsxs("section",{className:"settings-section",id:"s-about",hidden:d!=="about","aria-label":a("Data"),children:[s.jsx("p",{className:"hint",children:a("{c} companies · {d} departments · {p} people. Everything is stored in PostgreSQL on this machine; Ctrl+Z undoes the last 50 changes.",{c:e.counts.companies,d:e.counts.departments,p:e.counts.people})}),an(e.me,"trash.read")&&Yd(e.me)&&s.jsx(uI,{canRestore:an(e.me,"trash.update"),onRestored:e.onRestored,onStatus:e.onStatus}),an(e.me,"backup.read")&&s.jsx(dI,{}),s.jsx("p",{className:"hint",children:a("Keyboard: Ctrl+K search · Ctrl+Z / Ctrl+Shift+Z undo / redo · F5 refresh data · Esc close panels · right-drag selects, left-drag pans.")})]})]})]})}const F1={rocket:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 3c3 2 4.5 5 4.5 8.5L12 16l-4.5-4.5C7.5 8 9 5 12 3z"}),s.jsx("path",{d:"M7.5 11.5 5 13l1 4 3-1.5"}),s.jsx("path",{d:"M16.5 11.5 19 13l-1 4-3-1.5"}),s.jsx("circle",{cx:"12",cy:"9",r:"1.5"})]}),site:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"4.5",width:"18",height:"15",rx:"2"}),s.jsx("path",{d:"M3 9h18"}),s.jsx("circle",{cx:"6.2",cy:"6.8",r:".7",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"8.6",cy:"6.8",r:".7",fill:"currentColor",stroke:"none"})]}),search:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"10.5",cy:"10.5",r:"6"}),s.jsx("path",{d:"m15 15 4.5 4.5"})]}),chart:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 19.5V4"}),s.jsx("path",{d:"M4 19.5h16"}),s.jsx("path",{d:"M8 16V11"}),s.jsx("path",{d:"M12.5 16V7.5"}),s.jsx("path",{d:"M17 16v-3.5"})]}),money:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"8"}),s.jsx("path",{d:"M12 7.5v9"}),s.jsx("path",{d:"M14.5 9.8c-.5-.8-1.5-1.2-2.6-1.2-1.4 0-2.4.7-2.4 1.8 0 2.6 5 1.2 5 3.8 0 1.1-1.1 1.8-2.5 1.8-1.2 0-2.2-.5-2.7-1.3"})]}),bag:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3.5",y:"7.5",width:"17",height:"12",rx:"2"}),s.jsx("path",{d:"M8.5 7.5V6a3.5 3.5 0 0 1 7 0v1.5"})]}),people:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"9",cy:"9",r:"3"}),s.jsx("path",{d:"M3.5 19c.6-3 2.8-4.5 5.5-4.5S13.9 16 14.5 19"}),s.jsx("path",{d:"M16 6.2a3 3 0 0 1 0 5.6"}),s.jsx("path",{d:"M17.5 14.8c1.7.6 2.8 2 3.2 4.2"})]}),chat:s.jsx("path",{d:"M20 12.5c0 3.6-3.6 6.5-8 6.5-1 0-2-.15-2.9-.43L4.5 20l1.2-3.2C4.6 15.65 4 14.15 4 12.5 4 8.9 7.6 6 12 6s8 2.9 8 6.5z"}),doc:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M14 3.5H7.5a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2V8z"}),s.jsx("path",{d:"M14 3.5V8h4.5"}),s.jsx("path",{d:"M9 13h6M9 16.5h4"})]}),code:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"m8.5 8.5-4 3.5 4 3.5"}),s.jsx("path",{d:"m15.5 8.5 4 3.5-4 3.5"}),s.jsx("path",{d:"m13.5 5.5-3 13"})]}),bug:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"8",y:"7.5",width:"8",he
81ight:"11",rx:"4"}),s.jsx("path",{d:"M9.5 7.5a2.5 2.5 0 0 1 5 0"}),s.jsx("path",{d:"M8 11H4.5M16 11H19.5M8 15H4.5M16 15H19.5M8.5 8 6 5.5M15.5 8 18 5.5"})]}),gear:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M12 3.5v2.2M12 18.3v2.2M20.5 12h-2.2M5.7 12H3.5M18 6l-1.6 1.6M7.6 16.4 6 18M18 18l-1.6-1.6M7.6 7.6 6 6"})]}),flag:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M6 20.5V4"}),s.jsx("path",{d:"M6 5h9.5l-1.5 3 1.5 3H6"})]}),star:s.jsx("path",{d:"m12 4 2.4 4.9 5.4.8-3.9 3.8.9 5.4-4.8-2.5-4.8 2.5.9-5.4L4.2 9.7l5.4-.8z"}),heart:s.jsx("path",{d:"M12 19.5s-7-4.2-7-9A3.8 3.8 0 0 1 12 8.2 3.8 3.8 0 0 1 19 10.5c0 4.8-7 9-7 9z"}),shield:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 3.5 5 6v6c0 4 3 7 7 8.5 4-1.5 7-4.5 7-8.5V6z"}),s.jsx("path",{d:"m9 12 2 2 4-4"})]}),box:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 8.5 12 4.5l8 4v7l-8 4-8-4z"}),s.jsx("path",{d:"M4 8.5 12 12.5l8-4"}),s.jsx("path",{d:"M12 12.5v7.5"})]}),layers:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"m12 3.5 8.5 4.2L12 12 3.5 7.7z"}),s.jsx("path",{d:"m3.5 12.2 8.5 4.3 8.5-4.3"}),s.jsx("path",{d:"m3.5 16.5 8.5 4.3 8.5-4.3"})]}),bolt:s.jsx("path",{d:"M13.5 3 6 13.5h5L10.5 21 18 10.5h-5z"}),calendar:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3.5",y:"5.5",width:"17",height:"15",rx:"2"}),s.jsx("path",{d:"M3.5 10h17M8.5 3.5v4M15.5 3.5v4"})]}),pin:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 21c4-5.5 6-8.7 6-11a6 6 0 1 0-12 0c0 2.3 2 5.5 6 11z"}),s.jsx("circle",{cx:"12",cy:"10",r:"2.3"})]}),cart:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"10",cy:"19",r:"1.4"}),s.jsx("circle",{cx:"17",cy:"19",r:"1.4"}),s.jsx("path",{d:"M3 4.5h2.5l2.2 10.5h10l2-7.5H6.2"})]}),camera:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"7",width:"18",height:"12.5",rx:"2"}),s.jsx("circle",{cx:"12",cy:"13.2",r:"3.4"}),s.jsx("path",{d:"M8.5 7 10 4.5h4L15.5 7"})]}),book:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 5.5A2 2 0 0 1 6 3.5h13v14H6a2 2 0 0 0-2 2z"}),s.jsx("path",{d:"M4 5.5v14"}),s.jsx("path",{d:"M8 7.5h7"})]}),folder:s.jsx("path",{d:"M3.5 7.5a2 2 0 0 1 2-2h3.2l2 2.5h7.8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z"}),pen:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 20h4L19 9a2.5 2.5 0 0 0-3.5-3.5L4.5 16.5z"}),s.jsx("path",{d:"M14.5 6.5 17.5 9.5"})]}),brush:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 20c2.5 0 4.5-1.6 4.5-4a2.5 2.5 0 1 0-4.5 1.5z"}),s.jsx("path",{d:"M9.5 15 19 5.5a2 2 0 0 0-3-3L6.5 12"})]}),bulb:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M9 16.5a6 6 0 1 1 6 0v1.5H9z"}),s.jsx("path",{d:"M10 21h4"})]}),target:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"8"}),s.jsx("circle",{cx:"12",cy:"12",r:"4.5"}),s.jsx("circle",{cx:"12",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"})]}),compass:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),s.jsx("path",{d:"m15.5 8.5-2 5-5 2 2-5z"})]}),globe:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),s.jsx("path",{d:"M3.5 12h17"}),s.jsx("path",{d:"M12 3.5c2.2 2.4 3.4 5.4 3.4 8.5s-1.2 6.1-3.4 8.5c-2.2-2.4-3.4-5.4-3.4-8.5S9.8 5.9 12 3.5z"})]}),building:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4.5 20.5V6l7-2.5V20.5"}),s.jsx("path",{d:"M11.5 9.5h6a2 2 0 0 1 2 2v9"}),s.jsx("path",{d:"M7.5 8.5h1M7.5 12h1M7.5 15.5h1M14.5 13h2M14.5 16.5h2"}),s.jsx("path",{d:"M3 20.5h18"})]}),mail:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"5.5",width:"18",height:"13",rx:"2"}),s.jsx("path",{d:"m3.5 7 8.5 6 8.5-6"})]}),phone:s.jsx("path",{d:"M7 3.5 9.5 8l-2 2c1 2.2 2.8 4 5 5l2-2 4.5 2.5-1 3.5c-7-.4-13-6.4-13.4-13.4z"}),bell:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-2 8-2 8h16s-2-1-2-8"}),s.jsx("path",{d:"M13.7 20a2 2 0 0 1-3.4 0"})]}),clock:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),s.jsx("path",{d:"M12 7v5.2l3.2 2"})]}),timer:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"13.5",r:"7"}),s.jsx("path",{d:"M9.5 3.5h5M12 10v3.5"})]}),filter:s.jsx("path",{d:"M4 5.5h16l-6.2 7.2v5.6l-3.6 2v-7.6z"}),link:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M10 13.5a4 4 0 0 0 5.7 0l2.8-2.8a4 4 0 1 0-5.7-5.7l-1.6 1.6"}),s.jsx("path",{d:"M14 10.5a4 4 0 0 0-5.7 0l-2.8 2.8a4 4 0 1 0 5.7 5.7l1.6-1.6"})]}),key:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"8",cy:"15",r:"3.5"}),s.jsx("path",{d:"m10.5 12.5 8-8M16 7l2 2M18.5 4.5l2 2"})]}),lock:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),s.jsx("path",{d:"M8.5 10.5V8a3.5 3.5 0 0 1 7 0v2.5"})]}),eye:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M2.5 12S6 6.5 12 6.5 21.5 12 21.5 12 18 17.5 12 17.5 2.5 12 2.5 12z"}),s.jsx("circle",{cx:"12",cy:"12",r:"2.8"})]}),cloud:s.jsx("path",{d:"M7.5 18.5a4 4 0 0 1-.4-8A5.5 5.5 0 0 1 18 11.2a3.7 3.7 0 0 1-.6 7.3z"}),database:s.jsxs(s.Fragment,{children:[s.jsx("ellipse",{cx:"12",cy:"6.5",rx:"7",ry:"3"}),s.jsx("path",{d:"M5 6.5v11c0 1.7 3.1 3 7 3s7-1.3 7-3v-11"}),s.jsx("path",{d:"M5 12c0 1.7 3.1 3 7 3s7-1.3 7-3"})]}),server:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"6",rx:"2"}),s.jsx("rect",{x:"3.5",y:"13.5",width:"17",height:"6",rx:"2"}
81),s.jsx("path",{d:"M7 7.5h.01M7 16.5h.01"})]}),terminal:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"4.5",width:"18",height:"15",rx:"2"}),s.jsx("path",{d:"m7 9.5 3 2.5-3 2.5M12.5 15h4"})]}),puzzle:s.jsx("path",{d:"M9.5 4.5h5v2a2 2 0 1 0 3 1.7V13h2.5a2 2 0 1 1 0 4H17v2.5H9.5V17a2 2 0 1 0-3-1.7V8.2h3z"}),wrench:s.jsx("path",{d:"M20 5.5a5 5 0 0 1-6.6 6.6L6 19.5 4.5 18l7.4-7.4A5 5 0 0 1 18.5 4z"}),truck:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"2.5",y:"7",width:"11",height:"9",rx:"1.5"}),s.jsx("path",{d:"M13.5 10h3.8l3.2 3v3h-7z"}),s.jsx("circle",{cx:"7",cy:"18",r:"1.8"}),s.jsx("circle",{cx:"17",cy:"18",r:"1.8"})]}),plane:s.jsx("path",{d:"M10 21h2l2-7 6 1.5v-2L14 10l1-5.5A1.5 1.5 0 0 0 12 4L11 10 4 13v2l7-1.5z"}),game:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"2.5",y:"7.5",width:"19",height:"9",rx:"4.5"}),s.jsx("path",{d:"M7 10.5v3M5.5 12h3M15.5 11.5h.01M18 13.5h.01"})]}),music:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"7",cy:"17",r:"2.5"}),s.jsx("circle",{cx:"18",cy:"15",r:"2.5"}),s.jsx("path",{d:"M9.5 17V6l11-2v11"})]}),video:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"6",width:"12.5",height:"12",rx:"2"}),s.jsx("path",{d:"m15.5 11 5.5-3v8l-5.5-3z"})]}),award:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"9",r:"5.5"}),s.jsx("path",{d:"m8.5 13.5-1.5 7 5-2.5 5 2.5-1.5-7"})]}),scales:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M12 4v16M7 20h10"}),s.jsx("path",{d:"m4 10 3-5 3 5a3 3 0 0 1-6 0z"}),s.jsx("path",{d:"m14 10 3-5 3 5a3 3 0 0 1-6 0z"})]}),leaf:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 19c-2-6 2-13 14-14 1 9-3 14-9.5 14A4.5 4.5 0 0 1 5 19z"}),s.jsx("path",{d:"M9 15c1.5-3 4-5.5 7.5-7"})]}),fire:s.jsx("path",{d:"M12 21c3.5 0 6-2.3 6-5.5 0-4-3.5-5-3-9.5-2.5 1-4 3.5-4 6-1 0-2-1-2.2-2.5C7.2 11 6 13 6 15.5 6 18.7 8.5 21 12 21z"}),sun:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"4"}),s.jsx("path",{d:"M12 2.5v2.5M12 19v2.5M21.5 12H19M5 12H2.5M18.4 5.6l-1.8 1.8M7.4 16.6l-1.8 1.8M18.4 18.4l-1.8-1.8M7.4 7.4 5.6 5.6"})]}),moon:s.jsx("path",{d:"M20 14.5A8.5 8.5 0 0 1 9.5 4 8.5 8.5 0 1 0 20 14.5z"}),cup:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 5.5h12v7a6 6 0 0 1-12 0z"}),s.jsx("path",{d:"M17 7.5h1.8a2.2 2.2 0 1 1 0 4.4H17"}),s.jsx("path",{d:"M4 20.5h14"})]}),tag:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M3.5 11.5V4.5h7l10 10-7 7z"}),s.jsx("circle",{cx:"7.5",cy:"8.5",r:"1.4"})]}),grid:s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"4",y:"4",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"13",y:"4",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"4",y:"13",width:"7",height:"7",rx:"1.5"}),s.jsx("rect",{x:"13",y:"13",width:"7",height:"7",rx:"1.5"})]}),list:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M9 6.5h11M9 12h11M9 17.5h11"}),s.jsx("circle",{cx:"4.5",cy:"6.5",r:"1.2",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"4.5",cy:"17.5",r:"1.2",fill:"currentColor",stroke:"none"})]}),check:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),s.jsx("path",{d:"m8.5 12.2 2.4 2.4 4.6-4.8"})]}),plus:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"8.5"}),s.jsx("path",{d:"M12 8.5v7M8.5 12h7"})]})},jd=Object.keys(F1);function Vl({name:e,size:a=16}){const l=F1[e];return l?s.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l}):null}function fI({personId:e,holders:a}){const l=qe(),[i,r]=N.useState(null),[u,d]=N.useState(!1);if(N.useEffect(()=>{let v=!0;return r(null),d(!1),Se.personStats(e).then(k=>v&&r(k),()=>v&&d(!0)),()=>{v=!1}},[e]),u)return s.jsx("p",{className:"hint pad",children:l("The numbers could not be read.")});if(!i)return s.jsx("p",{className:"hint pad",children:l("Counting…")});const h=i.judged?Math.round(i.onTime/i.judged*100):null,g=l.lang==="ru"?"ru-RU":"en-GB",p=v=>new Date(`${v}-01T00:00:00`).toLocaleDateString(g,{month:"short"}),x=Math.max(1,...i.months.map(v=>v.closed)),m=[{label:"Open now",value:String(i.open)},{label:"Overdue",value:String(i.overdue),warn:i.overdue>0},{label:"Closed in total",value:String(i.closed)},{label:"Pulled into",value:String(i.pulledIn)}];return i.plannedDays>0&&m.push({label:"Person-days",value:l("{n} d",{n:i.plannedDays})}),i.avgLateDays!=null&&m.push({label:"Average delay",value:l("{n} d",{n:i.avgLateDays}),warn:!0}),i.avgDaysToClose!=null&&m.push({label:"From making to closing",value:l("{n} d",{n:i.avgDaysToClose})}),s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel-group",children:[s.jsx("h4",{children:l("Closing in time")}),h===null?s.jsx("p",{className:"hint pad",children:i.closed?l("Nothing to count from yet: none of the closed work had a date to meet."):l("Nothing to count from yet: nothing has been closed.")}
81):s.jsxs("div",{className:"stat-lead",children:[s.jsxs("span",{className:`stat-share ${h>=80?"good":h>=50?"soso":"bad"}`,children:[h,"%"]}),s.jsxs("span",{className:"stat-of",children:[l("{a} of {b} closed by the day they were due",{a:i.onTime,b:i.judged}),i.late>0&&` · ${l("{n} late",{n:i.late})}`]}),s.jsx("span",{className:"stat-bar","aria-hidden":"true",children:s.jsx("span",{className:`stat-fill ${h>=80?"good":h>=50?"soso":"bad"}`,style:{width:`${h}%`}})})]}),i.guessed>0&&s.jsx("p",{className:"hint pad",children:l("{n} of them are dated by the task's last change: they were closed before the history was kept.",{n:i.guessed})})]}),s.jsx("section",{className:"panel-group",children:s.jsx("div",{className:"stat-tiles",children:m.map(v=>s.jsxs("div",{className:`stat-tile ${v.warn?"warn":""}`,children:[s.jsx("span",{className:"stat-value",children:v.value}),s.jsx("span",{className:"stat-label",children:l(v.label)})]},v.label))})}),s.jsxs("section",{className:"panel-group",children:[s.jsx("h4",{children:l("The last six months")}),i.months.every(v=>!v.closed)?s.jsx("p",{className:"hint pad",children:l("Nothing closed in this time.")}):s.jsx("div",{className:"stat-months",children:i.months.map(v=>s.jsxs("div",{className:"stat-month",title:l("{a} of {b} in time",{a:v.onTime,b:v.closed}),children:[s.jsx("span",{className:"stat-col",style:{height:`${Math.round(v.closed/x*100)}%`},children:s.jsx("span",{className:"stat-col-on",style:{height:`${v.closed?Math.round(v.onTime/v.closed*100):0}%`}})}),s.jsx("span",{className:"stat-n",children:v.closed||""}),s.jsx("span",{className:"stat-when",children:p(v.month)})]},v.month))})]}),i.byHolder.length>0&&s.jsxs("section",{className:"panel-group",children:[s.jsx("h4",{children:l("Where the work is")}),i.byHolder.map(v=>{const k=a.find(T=>T.id===v.holderId);return s.jsxs("div",{className:"panel-row",children:[s.jsxs("span",{className:"panel-label",children:[k?.icon?s.jsx("span",{className:"stat-mark",style:k.color?{color:k.color}:void 0,children:s.jsx(Vl,{name:k.icon,size:14})}):s.jsx("span",{className:"rail-dot",style:{background:k?.color??"var(--accent)"},"aria-hidden":"true"}),k?.name??l("Outside the projects")]}),s.jsxs("span",{className:"hint",children:[v.open>0&&l("{n} open",{n:v.open}),v.open>0&&v.done>0&&" · ",v.done>0&&l("{n} closed",{n:v.done})]})]},v.holderId)})]}),i.recurring.answered+i.recurring.skipped>0&&s.jsxs("section",{className:"panel-group",children:[s.jsx("h4",{children:l("Recurring work")}),s.jsxs("div",{className:"panel-row",children:[s.jsx("span",{className:"panel-label",children:l("Answered in time")}),s.jsxs("span",{className:"hint",children:[l("{a} of {b}",{a:i.recurring.onTime,b:i.recurring.answered}),i.recurring.skipped>0&&` · ${l("{n} skipped",{n:i.recurring.skipped})}`]})]})]})]})}const mI=e=>new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"long",year:"numeric"});function pI(e,a,l){const i=e.data,r=(u,d,h=!1)=>{const g=p=>p==null||p===""?a("not set"):h?l(p):String(p);return`${g(u)} → ${g(d)}`};switch(e.kind){case"created":return{what:a("Added to the map")};case"name":return{what:a("Name"),detail:r(i.from,i.to)};case"title":return{what:a("Job title"),detail:r(i.from,i.to)};case"company":return{what:a("Company"),detail:r(i.from,i.to,!0)};case"department":return{what:a("Department"),detail:r(i.from,i.to,!0)};case"email":return{what:a("Email"),detail:r(i.from,i.to)};case"started":return{what:a("Started"),detail:r(i.from,i.to)};case"managers":return{what:a("Managers"),detail:[i.added?.length?`+ ${i.added.map(l).join(", ")}`:"",i.removed?.length?`− ${i.removed.map(l).join(", ")}`:""].filter(Boolean).join("  ")};
81case"mark":return{what:i.mark==="out"?a("Possible dismissal"):a("Under review"),detail:i.on?a("set"):a("cleared")};default:return{what:e.kind}}}function gI({person:e,people:a,departments:l,companies:i}){const r=qe(),[u,d]=N.useState(null);N.useEffect(()=>{let g=!0;return Se.personEvents(e.id).then(p=>g&&d(p),()=>g&&d([])),()=>{g=!1}},[e.id,e.title,e.departmentId,e.companyId,e.email,e.startDate,e.managerIds]);const h=g=>typeof g!="string"?r("not set"):a.find(p=>p.id===g)?.fullName??l.find(p=>p.id===g)?.name??i.find(p=>p.id===g)?.name??r("not set");return u?u.length?s.jsx("ol",{className:"person-history",children:u.map(g=>{const{what:p,detail:x}=pI(g,r,h);return s.jsxs("li",{children:[s.jsx("span",{className:"ph-day",children:mI(g.at)}),s.jsx("span",{className:"ph-what",children:p}),x&&s.jsx("span",{className:"ph-detail",children:x}),g.byName&&s.jsx("span",{className:"ph-who",children:g.byName})]},g.id)})}):s.jsx("p",{className:"hint pad",children:r("Nothing has changed since the history was kept.")}):s.jsx("p",{className:"hint pad",children:"…"})}const Yw=e=>e?e.split("-").reverse().join("."):"";function yI({personId:e,onOpenProject:a}){const l=qe(),[i,r]=N.useState(null);return N.useEffect(()=>{let u=!0;return Se.personPast(e).then(d=>u&&r(d),()=>u&&r([])),()=>{u=!1}},[e]),i?.length?s.jsxs("section",{className:"panel-group",children:[s.jsxs("h4",{children:[l("Worked before"),s.jsx("span",{className:"head-count",children:i.length})]}),i.map(u=>{const d=u.projectId??u.toolId,h=[Yw(u.joinedOn),Yw(u.leftOn)].filter(Boolean).join(" — ");return s.jsxs("div",{className:"card-row past-row",children:[s.jsxs("div",{className:"card-row-head",children:[u.stillThere&&d?s.jsx("button",{type:"button",className:"card-title link",onClick:()=>a(d),children:u.holderName}):s.jsx("span",{className:"card-title",title:l("This project no longer exists"),children:u.holderName}),s.jsx("span",{className:"hint",children:h})]}),u.role&&s.jsx("div",{className:"card-row-facts hint",children:u.role})]},u.id)})]}):null}function xI({onBack:e,onRestored:a}){const l=qe(),[i,r]=N.useState(null),[u,d]=N.useState(null),h=()=>Se.archivedPeople().then(r,()=>r([]));N.useEffect(()=>{h()},[]);async function g(p){if(await Dt(l("Bring {name} back to work?",{name:p.fullName}),{okLabel:"Back to work"})){d(p.id);try{await Se.unarchivePerson(p.id),await h(),a()}finally{d(null)}}}return s.jsxs("section",{className:"panel-group archived",children:[s.jsxs("h4",{children:[l("Former employees"),i&&i.length>0&&s.jsx("span",{className:"head-count",children:i.length}),s.jsx("button",{type:"button",className:"ghost-btn",onClick:e,children:l("Team")})]}),!i&&s.jsx("p",{className:"hint pad",children:"…"}),i?.length===0&&s.jsx("p",{className:"hint pad",children:l("Nobody has left yet.")}),i?.map(p=>s.jsxs("div",{className:"card-row",children:[s.jsxs("div",{className:"card-row-head",children:[s.jsx(Xe,{person:p,size:26}),s.jsx("span",{className:"card-title",children:p.fullName}),s.jsx("span",{className:"hint",children:p.title}),s.jsx("button",{type:"button",className:"ghost-btn",disabled:u===p.id,onClick:()=>g(p),children:l("Back to work")})]}),s.jsxs("div",{className:"card-row-facts hint",children:[s.jsx("span",{children:l("Left {date}",{date:(p.archivedOn??"").split("-").reverse().join(".")})}),p.archivedBy&&s.jsx("span",{children:p.archivedBy}),p.email&&s.jsx("span",{children:p.email})]})]},p.id))]})}function vI(e,a=new Date){const l=new Date(`${e}T00:00:00Z`),i=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));if(l.getTime()<i.getTime())return 0;let r=0;for(;i.getTime()<=l.getTime();){const u=i.getUTCDay();u!==0&&u!==6&&r++,i.setUTCDate(i.getUTCDate()+1)}return r}function K1(e,a,l=new Date){const i=e.filter(h=>h.kind==="once"&&Wn(h.state)&&h.assigneeId===a&&h.dueOn&&h.effortDays).sort((h,g)=>(h.dueOn??"").localeCompare(g.dueOn??""));let r=0,u=0,d=null;for(const h of i){r+=h.effortDays??0;const g=vI(h.dueOn,l),p=r-g;p>u&&(u=p,d=h.dueOn)}return{shortBy:Math.round(u*10)/10,on:d,planned:Math.round(r*10)/10}}const bI=()=>new Date().toISOString().slice(0,10),Q1=e=>e.kind==="task"&&(!e.endsOn||e.endsOn>=bI()),wI=()=>({memberships:[],duties:[],timed:[],past:[],owned:0,leads:0,core:0,partial:0,advisor:0,total:0,idle:!0});function Gi(e,a,l){const i=new Map,r=u=>{const d=i.get(u);if(d)return d;const h=wI();return i.set(u,h),h};for(const u of e)r(u.id);for(const u of a){for(const h of u.members){const g=r(h.personId);g.memberships.push({project:u,member:h}),g.owned+=h.areas.filter(p=>p.kind==="owns").length,g[h.involvement]++}const d=$n(u);d&&r(d).leads++}for(const u of l){const d=r(u.personId);u.kind==="duty"?d.duties.push(u):Q1(u)?d.timed.push(u):d.past.push(u)}for(const u of i.values())u.total=u.memberships.length+u.duties.length+u.timed.length,u.idle=u.total===0;return i}const cp=(e,a)=>e?.memberships.find(l=>l.project.id===a)?.member??null,jI=e=>e.core*3+e.partial*2+e.advisor+e.owned+e.leads,Vd={core:"●",partial:"◐",advisor:"○"},Vw=new Date().toISOString().slice(0,10),up=2,W1=[{key:"where",label:"Engaged in"},{key:"works",label:"Work"},{key:"days",label:"Planned"},{key:"due",label:"Due"},{key:"duties",label:"Duties"},{key:"timed",label:"Timed"},{key:"owned",label:"Areas"},{key:"email",label:"Email"},{key:"started",label:"Started"}],J1="orgami:team-columns",qw=["where","works","due","email"];function NI(){try{const e=localStorage.getItem(J1);if(!e)return new Set(qw);const a=JSON.parse(e);return new Set(a.filter(l=>W1.some(i=>i.key===l)))}catch{return new Set(qw)}}function kI(e){try{localStorage.setItem(J1,JSON.stringify([...e]))}catch{}}function SI({people:e,companies:a,departments:l,projects:i,tasks:r,assignments:u,actions:d,assignmentActions:h,openId:g,onOpen:p,dept:x,only:m,onShowPerson:v,onOpenProject:k,onOpenTask:T,onPatchPerson:S,onArchivePerson:C,onRestored:z}){const E=qe(),[j,O]=N.useState(""),[w,b]=N.useState("all"),[A,D]=N.useState(x??"all"),[M,U]=N.useState(m==="free"||m==="busy"?m:"all"),[Y,q]=N.useState("all"),[W,L]=N.useState(null),[V,I]=N.useState("az"),[F,_]=N.useState(()=>NI()),[H,P]=N.useState(!1),X=re=>F.has(re),ne=re=>_(te=>{const Ce=new Set(te);return Ce.has(re)?Ce.delete(re):Ce.add(re),kI(Ce),Ce});N.useEffect(()=>{x&&D(x),(m==="free"||m==="busy")&&U(m)},[x,m]);const pe=re=>re&&l.find(te=>te.id===re)?.name||"",R=re=>{const te=re.parentId?i.find(Ce=>Ce.id===re.parentId):null;return te?`${te.name} › ${re.name}`:re.name},Q=re=>a.find(te=>te.id===re)?.name??"",le=re=>E(re==="core"?"Main work":re==="partial"?"Part of the time":"Advises"),se=N.useMemo(()=>Gi(e,i,u),[e,i,u]),ie=N.useMemo(()=>{const re=j.trim().toLowerCase();return e.filter(te=>te.fullName).filter(te=>w==="all"?!0:te.companyId===w).filter(te=>A==="all"?!0:te.departmentId===A).filter(te=>!re||`${te.fullName} ${te.title} ${pe(te.departmentId)} ${Q(te.companyId)}`.toLowerCase().includes(re)).map(te=>{const Ce=r.filter(mt=>mt.assigneeId===te.id&&Wn(mt.state)&&mt.kind!=="recurring"),Ee=Ce.map(mt=>mt.dueOn).filter(mt=>!!mt).sort()[0]??null,Re=Ce.reduce((mt,dt)=>mt+(dt.effortDays??0),0),Ke=K1(r,te.id);return{p:te,e:se.get(te.id),works:Ce.length,days:Re,due:Ee,load:Ke,overdue:Ce.filter(mt=>mt.dueOn&&mt.dueOn<Vw).length}}).sort((te,Ce)=>V==="az"?te.p.fullName.localeCompare(Ce.p.fullName):V==="za"?Ce.p.fullName.localeCompare(te.p.fullName):Ce.e.total-te.e.total||Ce.e.owned-te.e.owned||te.p.fullName.localeCompare(Ce.p.fullName))},[e,se,i,r,l,a,j,w,A,V]),K=ie.filter(re=>!re.e.idle),ue=ie.filter(re=>re.e.idle),xe=M==="busy"?K:M==="free"?ue:ie,Ne=Y==="all"?xe:xe.filter(re=>!!cp(re.e,Y)),{sorted:He,by:ee,toggle:ge}=fs(Ne,{where:re=>re.e.memberships.length,works:re=>re.works,days:re=>re.days,due:re=>re.due??"",duties:re=>re.e.duties.length,timed:re=>re.e.timed.length,owned:re=>re.e.owned,email:re=>re.p.email??"",started:re=>re.p.startDate??""});async function Le(re,te,Ce){const Ee=te.members.find(Re=>Re.personId===re.id)??null;if(Ce===""){if(!Ee)return;const Re=[Ee.role,Ee.areas.length?E.n(Ee.areas.length,"area","areas"):""].filter(
81Boolean).join(" · ");if(!await Dt(E("Remove {name} from “{project}”?",{name:re.fullName,project:te.name})+(Re?`
82${Re}`:""),{okLabel:"Remove",danger:!0}))return;await d.removeMember(te.id,Ee.id);return}Ee?await d.patchMember(te.id,Ee.id,{involvement:Ce}):await d.addMember(te.id,{personId:re.id,involvement:Ce})}const me=re=>[...["core","partial","advisor"].map(te=>({value:te,label:`${Vd[te]}  ${le(te)}`})),{value:"",label:E("Remove from the project"),className:"danger"}],_e=e.find(re=>re.id===g)??null,ke=!!_e;return s.jsxs("div",{className:`team ${ke?"as-page":""}`,children:[!ke&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"team-tools",children:[s.jsx("input",{className:"team-search",value:j,onChange:re=>O(re.target.value),placeholder:E("Search a person, a job title, a department…")}),s.jsx(Qe,{className:"team-filter",value:w,options:[{value:"all",label:E("All companies")},...a.map(re=>({value:re.id,label:re.name}))],onChange:b,children:s.jsx("span",{className:w==="all"?"muted":"",children:w==="all"?E("All companies"):Q(w)})}),s.jsx(Qe,{className:"team-filter",value:A,options:[{value:"all",label:E("All departments")},...l.map(re=>({value:re.id,label:re.name}))],onChange:D,children:s.jsx("span",{className:A==="all"?"muted":"",children:A==="all"?E("All departments"):pe(A)})}),s.jsx(Qe,{className:"team-filter",value:Y,options:[{value:"all",label:E("All projects")},...i.map(re=>({value:re.id,label:R(re)}))],onChange:q,searchPlaceholder:E("Search…"),children:s.jsx("span",{className:Y==="all"?"muted":"",children:Y==="all"?E("All projects"):(()=>{const re=i.find(te=>te.id===Y);return re?R(re):""})()})}),s.jsx("div",{className:"seg",children:["all","busy","free","gone"].map(re=>s.jsx("button",{type:"button",className:M===re?"on":"",onClick:()=>U(re),children:E(re==="all"?"Everyone":re==="busy"?"Engaged":re==="free"?"Free":"Former employees")},re))}),s.jsxs("div",{className:"cols-pick",children:[s.jsxs("button",{type:"button",className:`ghost-btn ${H?"on":""}`,onClick:()=>P(!H),title:E("Which columns to show"),children:["▦ ",E("Columns")]}),H&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"cols-away",onClick:()=>P(!1)}),s.jsx("div",{className:"cols-menu",children:W1.map(re=>s.jsxs("label",{className:"cols-row",children:[s.jsx("input",{type:"checkbox",checked:X(re.key),onChange:()=>ne(re.key)}),s.jsx("span",{children:E(re.label)})]},re.key))})]})]}),s.jsx("span",{className:"hint team-summary",children:E("{busy} of {all} are engaged",{busy:K.length,all:ie.length})})]}),M==="gone"?s.jsx("div",{className:"team-scroll",children:s.jsx(xI,{onBack:()=>U("all"),onRestored:z})}):s.jsx("div",{className:"team-scroll",children:s.jsxs("table",{className:"team-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"team-person",children:s.jsxs("button",{type:"button",className:`sort-by ${V==="az"?"":"on"}`,title:E(V==="az"?"Sort Z→A":V==="za"?"Back to the engaged first":"Sort A→Z"),onClick:()=>I(V==="az"?"za":V==="za"?"engaged":"az"),children:[E("Person"),s.jsx("span",{className:"sort-mark","aria-hidden":"true",children:V==="az"?"↑":V==="za"?"↓":"⇅"})]})}),X("where")&&s.jsx(et,{label:E("Engaged in"),k:"where",by:ee,toggle:ge,firstDir:"desc",className:"team-where"}),X("works")&&s.jsx(et,{label:E("Work"),k:"works",by:ee,toggle:ge,firstDir:"desc",className:"team-num"}),X("days")&&s.jsx(et,{label:E("Planned"),k:"days",by:ee,toggle:ge,firstDir:"desc",className:"team-num"}),X("due")&&s.jsx(et,{label:E("Due"),k:"due",by:ee,toggle:ge,className:"team-due"}),X("duties")&&s.jsx(et,{label:E("Duties"),k:"duties",by:ee,toggle:ge,firstDir:"desc",className:"team-num"}),X("timed")&&s.jsx(et,{label:E("Timed"),k:"timed",by:ee,toggle:ge,firstDir:"desc",className:"team-num"}),X("owned")&&s.jsx(et,{label:E("Areas"),k:"owned",by:ee,toggle:ge,firstDir:"desc",className:"team-num"}),X("email")&&s.jsx(et,{label:E("Email"),k:"email",by:ee,toggle:ge,className:"team-mail"}),X("started")&&s.jsx(et,{label:E("Started"),k:"started",by:ee,toggle:ge,className:"team-due"}),s.jsx("th",{className:"team-pad"})]})}),s.jsx("tbody",{children:He.map(re=>
82s.jsxs("tr",{className:`${re.e.idle?"idle":""} ${re.p.id===g?"on":""}`,children:[s.jsx("th",{className:"team-person",children:s.jsxs("button",{type:"button",className:"team-name",onClick:()=>p(re.p.id),title:E("Open the card"),children:[s.jsx(Xe,{person:re.p,size:26}),s.jsxs("span",{children:[s.jsx("span",{className:"team-full",children:re.p.fullName}),s.jsx("span",{className:"team-sub",children:[re.p.title,pe(re.p.departmentId)||Q(re.p.companyId)].filter(Boolean).join(" · ")})]})]})}),X("where")&&s.jsx("td",{className:"team-where",children:s.jsxs("span",{className:`where-list ${W===re.p.id?"all":""}`,children:[(()=>{const te=i.map(Ee=>({pr:Ee,m:cp(re.e,Ee.id)})).filter(({m:Ee})=>Ee),Ce=W===re.p.id?te:te.slice(0,up);return s.jsxs(s.Fragment,{children:[Ce.map(({pr:Ee,m:Re})=>s.jsx(Qe,{className:"where-pick",value:Re.involvement,options:me(),onChange:Ke=>Le(re.p,Ee,Ke),children:s.jsxs("span",{className:`where-chip inv-${Re.involvement}`,title:[R(Ee),le(Re.involvement),Re.role,$n(Ee)===re.p.id?E("Project lead"):""].filter(Boolean).join(" · "),children:[s.jsx("span",{className:"inv-mark","aria-hidden":"true",children:Vd[Re.involvement]}),R(Ee)]})},Ee.id)),te.length>up&&s.jsx("button",{type:"button",className:"where-more",title:W===re.p.id?E("show fewer"):E("show all {n}",{n:te.length}),onClick:()=>L(W===re.p.id?null:re.p.id),children:W===re.p.id?E("fewer"):`+${te.length-up}`})]})})(),s.jsx(Qe,{className:"where-add",value:"",options:i.filter(te=>!cp(re.e,te.id)).map(te=>({value:te.id,label:R(te)})),onChange:te=>{const Ce=i.find(Ee=>Ee.id===te);Ce&&Le(re.p,Ce,"core")},searchPlaceholder:E("Search…"),emptyLabel:E("Nobody matches"),title:E("Put on the project"),children:s.jsx("span",{className:"muted",children:"+"})})]})}),X("works")&&s.jsx("td",{className:`team-num ${re.overdue?"matrix-warn":""}`,children:re.works||""}),X("days")&&s.jsxs("td",{className:`team-num ${re.load.shortBy>0?"over":""}`,title:re.load.shortBy>0?E("The estimates of what is promised by {day} need {n} working days more than there are",{day:re.load.on??"",n:re.load.shortBy}):void 0,children:[re.days?E("{n} d",{n:re.days}):"",re.load.shortBy>0&&` · −${re.load.shortBy}`]}),s.jsxs("td",{className:`team-due ${re.due&&re.due<Vw?"matrix-warn":""}`,children:[re.due??"",re.overdue>0&&s.jsxs("span",{className:"hint",children:[" · ",E("{n} overdue",{n:re.overdue})]})]}),X("duties")&&s.jsx("td",{className:"team-num",children:re.e.duties.length||""}),X("timed")&&s.jsx("td",{className:"team-num",children:re.e.timed.length||""}),X("owned")&&s.jsx("td",{className:"team-num",children:re.e.owned||""}),X("email")&&s.jsx("td",{className:"team-mail",children:re.p.email?s.jsx("a",{href:`mailto:${re.p.email}`,children:re.p.email}):s.jsx("span",{className:"hint",children:"—"})}),X("started")&&s.jsx("td",{className:"team-due",children:re.p.startDate?re.p.startDate.split("-").reverse().join("."):""}),s.jsx("td",{className:"team-pad"})]},re.p.id))})]})})]}),_e&&s.jsx(CI,{page:ke,person:_e,departments:l,companies:a,where:[_e.title,pe(_e.departmentId),Q(_e.companyId)].filter(Boolean).join(" · "),company:Q(_e.companyId),department:pe(_e.departmentId),managers:_e.managerIds.map(re=>e.find(te=>te.id===re)).filter(re=>!!re),reports:e.filter(re=>re.managerIds.includes(_e.id)),projects:i,tasks:r,carries:se.get(_e.id),people:e,actions:d,assignmentActions:h,onClose:()=>p(null),onOpenProject:k,onOpenTask:T,onOpenPerson:p,onShowOnMap:()=>v(_e.id),onArchive:async(re,te)=>{await C(_e.id,re,te),p(null)},onPatch:re=>S(_e.id,re)})]})}const Gw=new Date().toISOString().slice(0,10);function CI({page:e,person:a,where:l,company:i,department:r,managers:u,reports:d,projects:h,tasks:g,carries:p,people:x,departments:m,companies:v,actions:k,assignmentActions:T,onClose:S,onOpenProject:C,onOpenTask:z,onOpenPerson:E,onShowOnMap:j,onPatch:O,onArchive:w}){const b=qe(),A=_g(),[D,M]=N.useState(0),[U,Y]=N.useState(null),[q,W]=N.useState(!1),[L,V]=N.useState("");N.useEffect(()=>{const ke=()=>M(document.querySelector(".bar")?.getBoundingClientRect().bottom??0);ke();const re=te=>{te.key==="Escape"&&S()};return window.addEventListener("keydown",re),window.addEventListener("resize",ke),()=>{window.removeEventListener("keydown",re),window.removeEventListener("resize",ke)}},[S]),N.useEffect(()=>{Y(null),V("")},[a.id]);const I=ke=>b(ke==="core"?"Main work":ke==="partial"?"Part of the time":"Advises"),F=p.memberships,_=g.filter(ke=>ke.assigneeId===a.id||(ke.people??[]).some(re=>re.personId===a.id)).map(ke=>{const re=h.find(te=>te.id===(ke.projectId??ke.toolId))??null;return{w:ke,area:re?.areas.find(te=>
82ke.areaIds.includes(te.id))??null,project:re,part:ke.assigneeId===a.id?"":(ke.people??[]).find(te=>te.personId===a.id)?.role??""}}),H=_.filter(({w:ke})=>Wn(ke.state)).sort((ke,re)=>(ke.w.dueOn??"9999").localeCompare(re.w.dueOn??"9999")),P=H.filter(({w:ke})=>ke.dueOn&&ke.dueOn<Gw).length,X=g.filter(ke=>ke.kind==="recurring"&&(ke.assigneeId===a.id||(ke.people??[]).some(re=>re.personId===a.id))),ne=H.reduce((ke,{w:re})=>ke+(re.effortDays??0),0),pe=K1(g,a.id),R=p.duties,Q=(ke,re)=>ke.areas.find(te=>te.id===re)?.name??"",[le,se]=N.useState("about"),ie=ke=>{const re=new Date(ke),te=new Date;let Ce=(te.getFullYear()-re.getFullYear())*12+(te.getMonth()-re.getMonth());if(te.getDate()<re.getDate()&&Ce--,Ce<0)return"";const Ee=Math.floor(Ce/12),Re=Ce%12;return[Ee?b("{n} y",{n:Ee}):"",Re||!Ee?b("{n} mo",{n:Re}):""].filter(Boolean).join(" ")};async function K(ke){const re=L.trim();if(!re)return Y(null);await T.add({personId:a.id,kind:ke,title:re,...ke==="task"?{startsOn:new Date().toISOString().slice(0,10)}:{}}),V(""),Y(null)}async function ue(ke){await Dt(b("Remove “{name}”?",{name:ke.title}),{okLabel:"Remove",danger:!0})&&await T.remove(ke.id)}const xe=ke=>s.jsxs("button",{type:"button",className:"who-chip",onClick:()=>E(ke.id),title:ke.title||void 0,children:[s.jsx(Xe,{person:ke,size:22}),ke.fullName]},ke.id),Ne=s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"card-sheet",children:[s.jsx("h5",{className:"sheet-title",children:b("Contacts")}),s.jsxs("dl",{className:"facts",children:[s.jsxs("div",{className:"fact",children:[s.jsx("dt",{children:b("Corporate email")}),s.jsx("dd",{children:s.jsx(bn,{className:"card-mail",value:a.email??"",placeholder:b("not set"),onCommit:ke=>O({email:ke.trim()})})})]}),s.jsxs("div",{className:"fact",children:[s.jsx("dt",{children:b("Start date")}),s.jsxs("dd",{children:[s.jsx(ka,{value:a.startDate??null,onChange:ke=>O({startDate:ke}),placeholder:b("not set")}),a.startDate&&s.jsxs("span",{className:"hint",children:["· ",b("in the group {n}",{n:ie(a.startDate)})]})]})]})]})]}),s.jsxs("section",{className:"card-sheet",children:[s.jsx("h5",{className:"sheet-title",children:b("In the company")}),s.jsxs("dl",{className:"facts",children:[a.title&&s.jsxs("div",{className:"fact",children:[s.jsx("dt",{children:b("Job title")}),s.jsx("dd",{children:a.title})]}),s.jsxs("div",{className:"fact",children:[s.jsx("dt",{children:b("Company")}),s.jsx("dd",{children:i||s.jsx("span",{className:"hint",children:b("not set")})})]}),s.jsxs("div",{className:"fact",children:[s.jsx("dt",{children:b("Department")}),s.jsx("dd",{children:r||s.jsx("span",{className:"hint",children:b("no department")})})]}),u.length>0&&s.jsxs("div",{className:"fact",children:[s.jsx("dt",{children:b("Reports to")}),s.jsx("dd",{className:"who-list",children:u.map(xe)})]}),d.length>0&&s.jsxs("div",{className:"fact",children:[s.jsx("dt",{children:b("In their team")}),s.jsxs("dd",{className:"who-list",children:[(q?d:d.slice(0,6)).map(xe),d.length>6&&s.jsx("button",{type:"button",className:"who-more",onClick:()=>W(ke=>!ke),children:q?b("fewer"):`+${d.length-6}`})]})]})]})]}),A&&s.jsxs("section",{className:"card-sheet",children:[s.jsx("h5",{className:"sheet-title",children:b("What-if")}),s.jsxs("div",{className:"card-marks",children:[s.jsxs("button",{type:"button",className:`mark-toggle ${a.plannedOut?"on out":""}`,title:a.plannedOut?b("Keep this person (clear the mark)"):b("What-if: a possible dismissal — stays on the map, out of the totals"),onClick:()=>O({plannedOut:!a.plannedOut}),children:[s.jsx("span",{"aria-hidden":"true",children:"✂"}),a.plannedOut?b("Marked as a possible dismissal"):b("Possible dism
82issal")]}),s.jsxs("button",{type:"button",className:`mark-toggle ${a.underReview?"on review":""}`,title:a.underReview?b("Decided: remove the question mark"):b("Under review: not sure yet whether this person is needed"),onClick:()=>O({underReview:!a.underReview}),children:[s.jsx("span",{"aria-hidden":"true",children:"?"}),a.underReview?b("Marked as under review"):b("Under review")]})]}),s.jsx("p",{className:"hint pad",children:b("Both are what-ifs: the person stays where they are, and the totals show what would change.")})]}),s.jsxs("div",{className:"card-foot",children:[s.jsxs("button",{type:"button",className:"card-away",onClick:j,children:[b("Show on the map"),s.jsx("span",{"aria-hidden":"true",children:"→"})]}),s.jsx("button",{type:"button",className:"ghost-btn",onClick:ge,title:b("The person leaves the company: out of the lists, kept in the history"),children:b("Send to the archive")})]})]}),He=s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel-group",children:[s.jsxs("h4",{children:[b("Work"),H.length>0&&s.jsx("span",{className:"head-count",children:H.length}),ne>0&&s.jsx("span",{className:"head-count",children:b("{n} person-days",{n:ne})}),P>0&&s.jsx("span",{className:"head-warn",children:b("{n} overdue",{n:P})}),pe.shortBy>0&&s.jsx("span",{className:"head-warn",title:b("The estimates of what is promised by {day} need {n} working days more than there are",{day:pe.on??"",n:pe.shortBy}),children:b("overloaded: {n} days short",{n:pe.shortBy})})]}),H.slice(0,12).map(({w:ke,area:re,project:te,part:Ce})=>s.jsxs("button",{type:"button",className:"panel-row work-line",onClick:()=>z(ke.id),title:b("Open the task"),children:[s.jsxs("span",{className:"panel-label",children:[s.jsx(Jn,{state:ke.state,size:12})," ",ke.title]}),s.jsxs("span",{className:`hint ${ke.dueOn&&ke.dueOn<Gw?"matrix-warn":""}`,children:[ke.effortDays!=null&&`${$o(ke.effortDays,b)} · `,Ce?`${Ce} · `:"",[te?.name,re?.name,ke.dueOn].filter(Boolean).join(" · ")]})]},ke.id)),H.length>12&&s.jsx("p",{className:"hint pad",children:b("and {n} more",{n:H.length-12})}),H.length===0&&s.jsx("p",{className:"hint pad",children:_.length?b("Everything handed to them is done."):b("Nothing is handed to them.")})]}),X.length>0&&s.jsxs("section",{className:"panel-group",children:[s.jsxs("h4",{children:[b("Recurring"),s.jsx("span",{className:"head-count",children:X.length})]}),X.map(ke=>s.jsxs("div",{className:"card-row",children:[s.jsx("div",{className:"card-row-head",children:s.jsx("button",{type:"button",className:"card-title link",onClick:()=>z(ke.id),children:ke.title})}),s.jsxs("div",{className:"card-row-facts hint",children:[s.jsx("span",{children:Pd(ke,b.lang)}),ke.nextDue&&s.jsx("span",{children:b("next {date}",{date:ke.nextDue.split("-").reverse().join(".")})})]})]},ke.id))]}),["duty"].map(ke=>{const re=R;return s.jsxs("section",{className:"panel-group",children:[s.jsxs("h4",{children:[b(ke==="duty"?"Standing duties":"Timed work"),re.length>0&&s.jsx("span",{className:"head-count",children:re.length})]}),re.length===0&&U!==ke&&s.jsx("p",{className:"hint pad",children:b("Nothing standing yet.")}),re.map(te=>s.jsxs("div",{className:"card-row",children:[s.jsxs("div",{className:"card-row-head",children:[s.jsx(bn,{className:"card-title",value:te.title,placeholder:b("What the person does"),onCommit:Ce=>Ce.trim()&&T.patch(te.id,{title:Ce.trim()})}),s.jsx("button",{type:"button",className:"icon-btn small",title:b("Remove"),onClick:()=>ue(te),children:"×"})]}),s.jsx("div",{className:"card-row-facts hint",children:te.projectId&&s.jsx("span",{children:h.find(Ce=>Ce.id===te.projectId)?.name})})]},te.id)),U===ke?s.jsx("div",{className:"card-add",children:s.jsx("input",{autoFocus:!0,value:L,onChange:te=>V(te.target.value),placeholder:b("e.g. keeps the SEO reports"),onKeyDown:te=>{te.key==="Enter"&&K(ke),te.key==="Escape"&&(Y(null),V(""))},onBlur:()=>K(ke)})}):s.jsx("button",{type:"button",className:"panel-row add",onClick:()=>{V(""),Y(ke)},children:s.jsx("span",{className:"panel-label",children:b("+ Duty")})})]},ke)})]}),ee=s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"panel-group",children:[s.jsx("h4",{children:b("Projects")}),F.length===0&&s.jsx("p",{className:"hint pad",children:b("Not on any project.")}),F.map(({project:ke,member:re})=>{const te=re.areas.filter(Ee=>Ee.kind==="owns").map(Ee=>
82Q(ke,Ee.areaId)).filter(Boolean),Ce=re.areas.filter(Ee=>Ee.kind==="works").map(Ee=>Q(ke,Ee.areaId)).filter(Boolean);return s.jsxs("div",{className:"card-row",children:[s.jsxs("div",{className:"card-row-head",children:[s.jsxs("button",{type:"button",className:"link",onClick:()=>C(ke.id),children:[s.jsx("span",{className:"rail-dot",style:{background:ke.color??"var(--accent)"},"aria-hidden":"true"}),ke.name]}),s.jsx(Qe,{className:"panel-pick",value:re.involvement,options:["core","partial","advisor"].map(Ee=>({value:Ee,label:`${Vd[Ee]}  ${I(Ee)}`})),onChange:Ee=>k.patchMember(ke.id,re.id,{involvement:Ee}),children:s.jsxs("span",{className:`inv inv-${re.involvement}`,children:[s.jsx("span",{className:"inv-mark","aria-hidden":"true",children:Vd[re.involvement]}),I(re.involvement)]})})]}),s.jsxs("div",{className:"card-row-facts hint",children:[$n(ke)===a.id&&s.jsx("span",{className:"chip",children:b("Project lead")}),re.role&&s.jsx("span",{children:re.role}),te.length>0&&s.jsxs("span",{children:[b("owns"),": ",te.join(", ")]}),Ce.length>0&&s.jsxs("span",{children:[b("works on"),": ",Ce.join(", ")]})]})]},ke.id)})]}),s.jsx(yI,{personId:a.id,onOpenProject:C})]});async function ge(){const ke=x.filter(Ee=>Ee.id!==a.id&&Ee.companyId===a.companyId&&!d.some(Re=>Re.id===Ee.id)),re=Ee=>({value:Ee.id,label:Ee.fullName,sub:Ee.title||void 0});let te=null;if(d.length){const Ee=await Up(b("{name} has {n} reports. Who takes them over?",{name:a.fullName,n:d.length}),{label:b("Without a successor the archiving cannot finish: the reporting tree must not be broken."),options:ke.map(re),okLabel:"Send to the archive"});if(!Ee)return;te=Ee}let Ce=null;if(H.length){const Ee=await Up(b("{n} open tasks are on {name}. Who takes them?",{n:H.length,name:a.fullName}),{label:b("Nobody — the tasks stay on them and will be visible as ownerless."),options:ke.map(re),noneLabel:b("Nobody — leave the tasks as they are"),okLabel:"Send to the archive"});if(Ee===void 0)return;Ce=Ee}await Dt(b("Send {name} to the archive?",{name:a.fullName}),{okLabel:"Send to the archive"})&&await w(te,Ce)}const Le=[{key:"about",label:"About",n:0},{key:"work",label:"Work",n:H.length+R.length},{key:"projects",label:"Projects",n:F.length},{key:"stats",label:"Numbers",n:0},{key:"history",label:"History",n:0}],me=s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"tabs card-tabs",role:"tablist","aria-label":b("The card"),children:Le.map(ke=>s.jsxs("button",{type:"button",role:"tab","aria-selected":le===ke.key,className:le===ke.key?"on":"",onClick:()=>se(ke.key),children:[b(ke.label),ke.n>0&&s.jsx("span",{className:"count",children:ke.n})]},ke.key))}),le==="about"?Ne:le==="work"?He:le==="projects"?ee:le==="stats"?s.jsx(fI,{personId:a.id,holders:h}):s.jsx(gI,{person:a,people:x,departments:m,companies:v})]}),_e=s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"team-name plain",children:[s.jsx(Xe,{person:a,size:e?48:36}),s.jsxs("span",{children:[s.jsxs("span",{className:"team-full",children:[a.fullName,a.plannedOut&&s.jsx("span",{className:"card-mark out",title:b("A possible dismissal (what-if)"),children:b("dismissal")}),a.underReview&&s.jsx("span",{className:"card-mark review",title:b("Under review: is this person needed?"),children:"?"})]}),s.jsx("span",{className:"team-sub",children:l})]})]}),!e&&s.jsx("span",{className:"head-actions",children:s.jsx("button",{type:"button",className:"icon-btn",title:b("Close"),onClick:S,children:"×"})})]});return e?s.jsxs("div",{className:"person-page",children:[s.jsxs("button",{type:"button",className:"back-link",onClick:S,children:["← ",b("Back to the team")]}),s.jsx("header",{className:"panel-head",children:_e}),s.jsx("div",{className:"panel-body",children:me})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"panel-scrim",style:{top:D},onClick:S}),s.jsxs("aside",{className:"side-panel wide",style:{top:D},role:"dialog","aria-label":a.fullName,children:[s.jsx("header",{className:"panel-head",children:_e}),s.jsx("div",{className:"panel-body",children:me})]})]})}const jo=e=>e.kind==="comment";function EI({items:e,due:a,tasks:l,people:i,holders:r,departments:u,taskGroups:d,linked:h,onOpenTask:g,onReadAll:p}){const x=qe(),[m,v]=N.useState("all"),k=N.useMemo(()=>new Map(i.map(q=>
82[q.id,q])),[i]),T=N.useMemo(()=>new Map(l.map(q=>[q.id,q])),[l]),S=N.useMemo(()=>X1(x,{person:q=>k.get(q)?.fullName??"",holder:q=>r.find(W=>W.id===q)?.name??"",dept:q=>u.find(W=>W.id===q)?.name??"",group:q=>d.find(W=>W.id===q)?.name??"",zone:q=>r.flatMap(W=>W.areas).find(W=>W.id===q)?.name??""}),[x,k,r,u,d]),C=e.filter(q=>!q.read).length,z=e.filter(q=>m==="unread"?!q.read:m==="said"?jo(q):m==="changed"?!jo(q):!0),E=x.lang==="ru"?"ru-RU":"en-GB",j=q=>new Date(q).toLocaleTimeString(E,{hour:"2-digit",minute:"2-digit"}),O=q=>new Date(q).toLocaleString(E,{dateStyle:"medium",timeStyle:"short"}),w=q=>new Date(q).toISOString().slice(0,10),b=q=>{const W=new Date,L=W.toISOString().slice(0,10),V=new Date(W.getTime()-864e5).toISOString().slice(0,10);if(q===L)return x("Today");if(q===V)return x("Yesterday");const I=new Date(`${q}T00:00:00`),F=I.getFullYear()===W.getFullYear()?{day:"numeric",month:"long"}:{dateStyle:"long"};return I.toLocaleDateString(E,F)},A=q=>q.split("-").reverse().join("."),D=q=>{const W=r.find(L=>L.id===(q.projectId??q.toolId));return W?W.name:u.find(L=>L.id===q.departmentId)?.name??""},M=[];for(const q of z){const W=w(q.at),L=M[M.length-1];L&&L.day===W?L.rows.push(q):M.push({day:W,rows:[q]})}const U=q=>g(q),Y=[{key:"all",label:"Everything",n:e.length},{key:"unread",label:"Unread",n:C},{key:"said",label:"Messages",n:e.filter(jo).length},{key:"changed",label:"Changes",n:e.filter(q=>!jo(q)).length}];return s.jsxs("div",{className:"notices",children:[s.jsxs("header",{className:"notices-head",children:[s.jsxs("div",{className:"notices-title",children:[s.jsx("h2",{children:x("Notifications")}),C>0&&s.jsx("span",{className:"notices-badge",children:x("{n} unread",{n:C})})]}),C>0&&s.jsx("button",{type:"button",className:"btn",onClick:p,children:x("Mark all read")})]}),!h&&s.jsx("p",{className:"hint pad",children:x("This account is not tied to anybody on the map yet, so there is no work of its own to hear about. Settings → Users.")}),a.length>0&&s.jsxs("section",{className:"notices-block",children:[s.jsx("h3",{className:"notices-when",children:x("Needs you")}),s.jsx("div",{className:"notice-list",children:a.map(q=>{const W=T.get(q.taskId);return s.jsxs("button",{type:"button",className:`notice-row due ${q.kind}`,onClick:()=>U(q.taskId),children:[s.jsx("span",{className:"notice-mark","aria-hidden":"true",children:W?s.jsx(Jn,{state:W.state,size:15}):null}),s.jsxs("span",{className:"notice-text",children:[s.jsx("span",{className:"notice-line",children:q.title}),s.jsxs("span",{className:"notice-sub",children:[s.jsx("span",{className:q.kind==="late"?"late":"",children:q.kind==="late"?x("overdue"):q.kind==="today"?x("due today"):x("due tomorrow")}),q.on&&` · ${A(q.on)}`,W&&D(W)&&` · ${D(W)}`]})]})]},q.id)})})]}),s.jsxs("section",{className:"notices-block",children:[s.jsx("div",{className:"notices-filters",children:Y.map(q=>s.jsxs("button",{type:"button",className:`tfilter ${m===q.key?"on":""}`,"aria-pressed":m===q.key,onClick:()=>v(q.key),children:[x(q.label),!!q.n&&s.jsx("span",{className:"tfilter-n",children:q.n})]},q.key))}),z.length===0?s.jsx("p",{className:"hint pad",children:e.length===0?x("Nothing yet. A task handed to you, a reply in a conversation, a change to work of yours — all of it appears here."):x("Nothing under this filter.")}):M.map(({day:q,rows:W})=>s.jsxs("div",{children:[s.jsx("h3",{className:"notices-when",children:b(q)}),s.jsx("div",{className:"notice-list",children:W.map(L=>s.jsxs("button",{type:"button",className:`notice-row ${L.read?"":"unread"} ${jo(L)?"said":""}`,onClick:()=>U(L.taskId),title:O(L.at),children:[s.jsx("span",{className:"notice-mark","aria-hidden":"true",children:L.byPerson?s.jsx(Xe,{person:{id:L.byPerson,fullName:L.byName??"",photoVersion:L.byPhoto},size:26}):s.jsx("span",{className:"notice-ava",children:(L.byName??"?").trim().charAt(0).toUpperCase()})}),s.jsxs("span",{className:"notice-text",children:[s.jsxs("span",{className:"notice-line",children:[L.byName&&s.jsx("strong",{children:L.byName})," ",jo(L)?x("wrote in the conversation"):S(L)]}),jo(L)&&s.jsx("span",{className:"notice-said",children:String(L.data.text??"")}),s.jsxs("span",{className:"notice-sub",children:[L.taskTitle,D(L)&&` · ${D(L)}`]})]}),s.jsx("span",{className:"notice-at",children:j(L.at)})]},L.id))})]},q))]})]})}function TI({people:e,companies:a,departments:l,projects:i,tools:r,tasks:u,assignments:d,onCreateTask:h,onOpenTasks:g,onOpenTask:p,openId:x,onOpen:m,onOpenCard:v,onOpenProject:k,onPatchPerson:T}){const S=qe(),[C,z]=N.useState(null),E=N.useMemo(()=>e.filter(te=>te.fullName&&!te.plannedOut),[e]),j=N.useMemo(()=>Gi(e,i,d),[e,i,d]),O=te=>j.get(te)??Gi([],[],[]).get(te)??{memberships:[],duties:[],timed:[],past:[],owned:0,leads:0,core:0,partial:0,advisor:0,total:0,idle:!0},w=te=>te.filter(Ce=>O(Ce.id).idle).length,b=te=>{const Ce=l.filter(Ee=>Ee.parentId===te);return[...Ce,...Ce.flatMap(Ee=>b(Ee.id))]},A=(te,Ce=!1)=>{const Ee=new Set([te,...Ce?b(te).map(Re=>Re.id):[]]);return E.filter(Re=>Re.departmentId&&Ee.has(Re.departmentId))},D=te=>E.filter(Ce=>Ce.companyId===te&&!Ce.managerIds.some(Ee=>E.some(Re=>Re.id===Ee&&Re.companyId===te))).sort((Ce,Ee)=>E.filter(Re=>Re.managerIds.includes(Ee.id)).length-E.filter(Re=>Re.managerIds.includes(Ce.id)).length)[0]??null,[M,U]=N.useState("all");N.useEffect(()=>U("all"),[x]);const Y=l.find(te=>te.id===x)??null,q=Y?a.find(te=>te.id===Y.companyId):null,W=Y?A(Y.id):[],L=Y?A(Y.id,!0):[],V={projects:te=>O(te.id).memberships.length>0,duties:te=>O(te.id).duties.length>0,idle:te=>O(te.id).idle},I=M==="all"?W:L.filter(V[M]),[F,_]=N.useState("all"),H=N.useMemo(()=>Y?u.filter(te=>te.departmentId===Y.id&&!te.parentId):[],[u,Y]),P=N.useMemo(()=>H.filter(te=>F==="all"?!0:F==="late"?te.late:F==="doing"?te.state==="in_progress":F==="recurring"?te.kind==="recurring":te.state==="done"&&te.kind==="once"),[H,F]),{sorted:X,by:ne,toggle:pe}=fs(P,{title:te=>te.title.toLowerCase(),state:te=>Ec.indexOf(te.state),when:te=>te.kind==="recurring"?te.nextDue??"":te.dueOn??"",who:te=>te.assigneeId?(e.find(Ce=>Ce.id===te.assigneeId)?.fullName??"").toLowerCase():""}),{sorted:R,by:Q,toggle:le}=fs(I,{person:te=>te.fullName.toLowerCase(),projects:te=>O(te.id).memberships.length,duties:te=>O(te.id).duties.length,timed:te=>O(te.id).timed.length}),se=M==="all"?0:I.length-W.filter(V[M]).length,ie=te=>te.departmentId&&te.departmentId!==Y?.id?l.find(Ce=>Ce.id===te.departmentId)?.name??"":"",ue=Y?(te=>{if(te.headId){const Re=e.find(Ke=>Ke.id===te.headId);if(Re)return{person:Re,from:""}}let Ce=te.parentId?l.find(Re=>Re.id===te.parentId):null;for(;Ce;){const Re=Ce.headId?e.find(Ke=>Ke.id===Ce.headId):null;if(Re)return{person:Re,from:Ce.name};Ce=Ce.parentId?l.find(Ke=>Ke.id===Ce.parentId):null}let Ee=a.find(Re=>Re.id===te.companyId)??null;for(;Ee;){const Re=Ee.ceoId?e.find(dt=>dt.id===Ee.ceoId):null;if(Re)return{person:Re,from:Ee.name};const Ke=Ee.leadId?e.find(dt=>dt.id===Ee.leadId):null;if(Ke)return{person:Ke,from:Ee.name};const mt=D(Ee.id);if(mt)return{person:mt,from:Ee.name};Ee=Ee.parentId?a.find(dt=>dt.id===Ee.parentId)??null:null}return null})(Y):null,xe=Y?l.filter(te=>te.parentId===Y.id):[],[Ne,He]=N.useState(()=>{try{const te=localStorage.getItem("orgami:dept-view");return te==="chart"||te==="tasks"?te:"list"}catch{return"list"}});N.useEffect(()=>{try{localStorage.setItem("orgami:dept-view",Ne)}catch{}},[Ne]);const[ee,ge]=N.useState(""),[Le,me]=N.useState(new Set),_e=ee.trim().toLowerCase(),ke=te=>!_e||te.name.toLowerCase().includes(_e)||l.filter(Ce=>Ce.parentId===te.id).some(ke),re=(te,Ce,Ee)=>l.filter(Re=>Re.companyId===te&&Re.parentId===Ce&&ke(Re)).sort((Re,Ke)=>Re.name.localeCompare(Ke.name)).map(Re=>{const Ke=A(Re.id,!0),mt=l.filter(dt=>dt.parentId===Re.id&&ke(dt));return s.jsxs("li",{children:[s.jsxs("button",{type:"button",className:`unit-item ${Re.id===x?"on":""}`,onClick:()=>m(Re.id),children:[s.jsx("span",{className:"unit-dot",style:{background:Re.color??"var(--line-strong)"},"aria-hidden":"true"}
82),s.jsx("span",{className:"unit-name",children:Re.name}),s.jsx("span",{className:"unit-count",children:Ke.length})]}),mt.length>0&&s.jsx("ul",{className:"unit-sub",children:re(te,Re.id)})]},Re.id)});return s.jsxs("div",{className:"departments",children:[s.jsxs("nav",{className:"unit-tree","aria-label":S("Departments"),children:[s.jsx("input",{className:"unit-search",value:ee,onChange:te=>ge(te.target.value),placeholder:S("Find a department")}),a.filter(te=>l.some(Ce=>Ce.companyId===te.id&&ke(Ce))).map(te=>{const Ce=Le.has(te.id),Ee=E.filter(Re=>Re.companyId===te.id&&Re.departmentId).length;return s.jsxs("section",{className:"unit-group",children:[s.jsxs("button",{type:"button",className:"unit-group-head",onClick:()=>me(Re=>{const Ke=new Set(Re);return Ke.has(te.id)?Ke.delete(te.id):Ke.add(te.id),Ke}),children:[s.jsx("span",{className:`caret ${Ce?"shut":""}`,"aria-hidden":"true"}),s.jsx("span",{className:"unit-name",children:te.name}),s.jsx("span",{className:"unit-count",children:Ee})]}),!Ce&&s.jsx("ul",{children:re(te.id,null)})]},te.id)})]}),Y?s.jsxs("div",{className:"unit-main",children:[s.jsxs("header",{className:"unit-head",children:[s.jsxs("div",{children:[s.jsx("h2",{children:Y.name}),s.jsxs("p",{className:"hint",children:[q?.name,xe.length>0&&` · ${S("{n} units inside",{n:xe.length})}`]})]}),s.jsxs("div",{className:"unit-lead",children:[s.jsx("span",{className:"label",children:S(ue?.from?"Answers for it":"Head of the department")}),ue?s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"person-chip",onClick:()=>v(ue.person.id),children:[s.jsx(Xe,{person:ue.person,size:22}),ue.person.fullName]}),ue.from&&s.jsx("span",{className:"hint",children:S("from {where}",{where:ue.from})})]}):s.jsx("span",{className:"hint matrix-warn",children:S("nobody yet")})]}),s.jsxs("div",{className:"unit-acts",children:[s.jsx("button",{type:"button",className:"ghost-btn",onClick:()=>g(Y.id,"once"),children:S("Tasks of the department")}),s.jsx(Qe,{className:"unit-add",value:"",options:[{value:"once",label:S("Task")},{value:"recurring",label:S("Recurring task")},{value:"holder",label:S("Task inside a project or a tool")}],onChange:te=>z({kind:te==="recurring"?"recurring":"once",needsHolder:te==="holder"}),children:s.jsx("span",{children:S("+ Task")})})]})]}),C&&s.jsx(I1,{kind:C.kind,needsHolder:C.needsHolder,departmentId:Y.id,departments:l,companies:a,people:e,holders:i,tools:r,onClose:()=>z(null),onCreate:async te=>{const Ce=await h(te);z(null),Ce&&g(Y.id,Ce.kind)}}),s.jsx("div",{className:"unit-views",children:s.jsx("div",{className:"seg",children:["list","chart","tasks"].map(te=>s.jsxs("button",{type:"button",className:Ne===te?"on":"",onClick:()=>He(te),children:[S(te==="list"?"List":te==="chart"?"Chart":"Tasks"),te==="tasks"&&H.length>0&&s.jsx("span",{className:"count",children:H.length})]},te))})}),Ne==="tasks"?s.jsx("div",{className:"task-filters",children:[["all",S("Tasks"),H.length,S("Every task of this department")],["late",S("Overdue"),H.filter(te=>te.late).length,S("Show only what is late")],["doing",S("In progress"),H.filter(te=>te.state==="in_progress").length,S("Show only what is being done")],["recurring",S("Recurring"),H.filter(te=>te.kind==="recurring").length,S("Show only the recurring ones")],["done",S("Done"),H.filter(te=>te.state==="done"&&te.kind==="once").length,S("Show only what is finished")]].map(([te,Ce,Ee,Re])=>s.jsxs("button",{type:"button",className:`tfilter tfilter-${te} ${F===te?"on":""} ${Ee===0&&te!=="all"?"empty":""}`,"aria-pressed":F===te,title:Re,disabled:Ee===0&&te!=="all",onClick:()=>_(Ke=>Ke===te||te==="all"?"all":te),children:[s.jsx("span",{className:"tfilter-dot","aria-hidden":"true"}),Ce,s.jsx("span",{className:"tfilter-n",children:Ee})]},te))}):s.jsxs("div",{className:"tiles small",children:[s.jsxs("button",{type:"button",className:`tile ${M==="all"?"on":""}`,onClick:()=>U("all"),title:S("Everyone who sits in this department"),children:[s.jsx("span",{className:"tile-label",children:S("People")}),s.jsx("span",{className:"tile-value",children:L.length}),xe.length>0&&s.jsx("span",{className:"tile-sub",children:S("{n} of them here",{n:W.length})})]}),[["projects",S("On projects"),L.filter(te=>O(te.id).memberships.length).length,S("Show only those on a project")],["duties",S("Standing duties"),L.reduce((te,Ce)=>te+O(Ce.id).duties.length,0),S("Show only those with a standing duty")],["idle",S("Idle"),w(L),S("Show only those with nothing on them")]].map(([te,Ce,Ee,Re])=>s.jsxs("button",{type:"button",className:`tile ${M===te?"on":""}`,"aria-pressed":M===te,title:Re,onClick:()=>U(Ke=>
82Ke===te?"all":te),children:[s.jsx("span",{className:"tile-label",children:Ce}),s.jsx("span",{className:"tile-value",children:Ee})]},te))]}),xe.length>0&&s.jsx("div",{className:"unit-kids",children:xe.map(te=>{const Ce=A(te.id,!0);return s.jsxs("button",{type:"button",className:"unit-kid",onClick:()=>m(te.id),children:[s.jsx("span",{className:"unit-kid-name",children:te.name}),s.jsx("span",{className:"hint",children:S("{n} people, {idle} idle",{n:Ce.length,idle:w(Ce)})})]},te.id)})}),M!=="all"&&s.jsxs("p",{className:"hint unit-filter",children:[Ne==="list"?S("Showing {n} of {all} — the department and its units.",{n:I.length,all:L.length}):se>0?S("{n} highlighted here · {k} more sit in the units",{n:I.length-se,k:se}):S("{n} of {all} highlighted",{n:I.length,all:W.length})," ",Ne==="chart"&&se>0&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"link",onClick:()=>He("list"),children:S("see the list")})," · "]}),s.jsx("button",{type:"button",className:"link",onClick:()=>U("all"),children:S("show everyone")})]}),Ne==="tasks"?s.jsxs("div",{className:"unit-tasks",children:[X.length===0?s.jsx("p",{className:"hint",children:S("Nothing here yet.")}):s.jsxs("table",{className:"stats-table dept-tasks",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx(et,{label:S("Task"),k:"title",by:ne,toggle:pe}),s.jsx(et,{label:S("State"),k:"state",by:ne,toggle:pe}),s.jsx(et,{label:S("Due"),k:"when",by:ne,toggle:pe}),s.jsx(et,{label:S("Who does it"),k:"who",by:ne,toggle:pe})]})}),s.jsx("tbody",{children:X.map(te=>{const Ce=te.assigneeId?e.find(Re=>Re.id===te.assigneeId):null,Ee=te.kind==="recurring"?te.nextDue:te.dueOn;return s.jsxs("tr",{className:"clickable",onClick:()=>p(te.id,te.kind),title:S("Open the task"),children:[s.jsxs("td",{children:[te.title,te.kind==="recurring"&&s.jsxs("span",{className:"tchip",children:[" ",S("Recurring")]})]}),s.jsx("td",{children:s.jsxs("span",{className:"state-chip",children:[s.jsx(Jn,{state:te.state}),S(Sa[te.state])]})}),s.jsx("td",{className:te.late?"task-due late":"dim",children:Ee??"—"}),s.jsx("td",{children:Ce?s.jsxs("span",{className:"twho",children:[s.jsx(Xe,{person:Ce,size:20}),s.jsx("span",{className:"twho-name",children:Ce.fullName})]}):s.jsx("span",{className:"hint",children:"—"})})]},te.id)})})]}),s.jsx("button",{type:"button",className:"ghost-btn",onClick:()=>g(Y.id,"once"),children:S("Open in Tasks")})]}):Ne==="list"?s.jsxs("table",{className:"stats-table unit-people",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx(et,{label:S("Person"),k:"person",by:Q,toggle:le,colSpan:2}),s.jsx(et,{label:S("Projects"),k:"projects",by:Q,toggle:le,firstDir:"desc"}),s.jsx(et,{label:S("Standing duties"),k:"duties",by:Q,toggle:le,firstDir:"desc"}),s.jsx(et,{label:S("Timed work"),k:"timed",by:Q,toggle:le,firstDir:"desc"})]})}),s.jsxs("tbody",{children:[R.map(te=>{const Ce=O(te.id);return s.jsxs("tr",{className:Ce.idle?"idle":"",children:[s.jsx("td",{className:"avatar-cell",children:s.jsx(Xe,{person:te,size:24})}),s.jsxs("td",{children:[s.jsx("button",{type:"button",className:"link",onClick:()=>v(te.id),children:te.fullName}),s.jsxs("span",{className:"dim",children:[" · ",te.title||S("no job title")]}),ue?.person.id===te.id&&!ue.from&&s.jsx("span",{className:"chip",children:S("head")}),M!=="all"&&ie(te)&&s.jsxs("span",{className:"hint",children:[" · ",ie(te)]})]}),s.jsxs("td",{children:[Ce.memberships.length===0&&s.jsx("span",{className:"hint",children:"—"}),Ce.memberships.map(({project:Ee,member:Re})=>s.jsxs("button",{type:"button",className:"link small",onClick:()=>k(Ee.id),title:Re.role,children:[Ee.name,s.jsxs("span",{className:"hint",children:[" · ",S(Re.involvement==="core"?"Main work":Re.involvement==="partial"?"Part of the time":"Advises")]})]},Ee.id))]}),s.jsx("td",{children:Ce.duties.length?Ce.duties.map(Ee=>s.jsx("div",{children:Ee.title},Ee.id)):s.jsx("span",{className:"hint",children:"—"})}),s.jsx("td",{children:Ce.timed.length?Ce.timed.map(Ee=>s.jsxs("div",{children:[Ee.title,Ee.endsOn&&s.jsxs("span",{className:"hint",children:[" · ",S("to")," ",Ee.endsOn]})]},Ee.id)):s.jsx("span",{className:"hint",children:"—"})})]},te.id)}),I.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"hint",children:S(M==="all"?"Nobody sits directly in this department.":"Nobody here matches that.")})})]})]}):s.jsx(MI,{people:W,head:ue?.from?null:ue?.person??null,carries:O,onOpenCard:v,match:M==="all"?void 0:V[M],onPatchPerson:T})]}):s.jsx("div",{className:"unit-main hint empty-main",children:S("Pick a department on the left.")})]})}
82function MI({people:e,head:a,carries:l,onOpenCard:i,match:r,onPatchPerson:u}){const d=qe(),h=_g(),g=new Set(e.map(k=>k.id)),p=k=>e.filter(T=>T.managerIds.includes(k)&&T.id!==k),x=e.filter(k=>!k.managerIds.some(T=>g.has(T))),m=a&&x.some(k=>k.id===a.id)?[a,...x.filter(k=>k.id!==a.id)]:x,v=(k,T,S)=>{const C=l(k.id),z=p(k.id);return s.jsxs("li",{children:[s.jsxs("span",{className:"chart-slot",children:[s.jsxs("button",{type:"button",className:`chart-card ${C.idle?"idle":""} ${a?.id===k.id?"lead":""} ${r&&!r(k)?"off":""} ${k.plannedOut?"out":""} ${k.underReview?"review":""}`,onClick:()=>i(k.id),children:[s.jsx(Xe,{person:k,size:28}),s.jsxs("span",{className:"chart-main",children:[s.jsxs("span",{className:"chart-name",children:[k.fullName,k.plannedOut&&s.jsx("span",{className:"card-mark out",title:d("A possible dismissal (what-if)"),children:d("dismissal")}),!k.plannedOut&&k.underReview&&s.jsx("span",{className:"card-mark review",title:d("Under review: is this person needed?"),children:"?"})]}),s.jsx("span",{className:"chart-title",children:k.title||d("no job title")}),C.total>0&&s.jsxs("span",{className:"chart-load",children:[C.memberships.map(E=>E.project.name).join(", "),C.duties.length>0&&` · ${d("Duties")}: ${C.duties.length}`,C.timed.length>0&&` · ${d("Timed")}: ${C.timed.length}`]})]})]}),h&&s.jsxs("span",{className:"chart-marks",children:[s.jsx("button",{type:"button",className:`tb ${k.plannedOut?"on":""}`,title:k.plannedOut?d("Keep this person (clear the mark)"):d("What-if: a possible dismissal — stays on the map, out of the totals"),onClick:()=>u(k.id,{plannedOut:!k.plannedOut}),children:k.plannedOut?"✓":"✂"}),s.jsx("button",{type:"button",className:`tb ${k.underReview?"on":""}`,title:k.underReview?d("Decided: remove the question mark"):d("Under review: not sure yet whether this person is needed"),onClick:()=>u(k.id,{underReview:!k.underReview}),children:"?"})]})]}),z.length>0&&T<6&&s.jsx("ul",{className:S||z.length>3?"stack":"",children:z.map(E=>v(E,T+1,S||z.length>3))})]},k.id)};return e.length===0?s.jsx("p",{className:"hint",children:d("Nobody sits directly in this department.")}):s.jsx("div",{className:"unit-chart",children:s.jsx("ul",{className:"chart-root",children:m.map(k=>v(k,0,!1))})})}function DI(){const e=qe(),[a,l]=N.useState(null),[i,r]=N.useState(null),[u,d]=N.useState("d30");N.useEffect(()=>{Se.assistantSpend().then(l).catch(S=>r(S.message))},[]);const h=S=>S>=1?`$${S.toFixed(2)}`:S>0?`$${S.toFixed(4)}`:"—",g=S=>S?new Date(S).toLocaleDateString(e.lang==="ru"?"ru-RU":"en-GB",{day:"2-digit",month:"short"}):"—",p=[["today",e("Today")],["d7",e("7 days")],["d30",e("30 days")],["all",e("All time")]],x=(a?.people??[]).filter(S=>S.cost[u]>0||S.req[u]>0),{sorted:m,by:v,toggle:k}=fs(x,{name:S=>S.name.toLowerCase(),req:S=>S.req[u],cost:S=>S.cost[u],last:S=>S.lastAt??""},{key:"cost",dir:"desc"});if(i)return s.jsx("p",{className:"error",children:e(i)});if(!a)return s.jsx("p",{className:"hint",children:"…"});const T=Math.max(...x.map(S=>S.cost[u]),1e-6);return s.jsxs("div",{className:"spend-view",children:[s.jsxs("p",{className:"hint",children:[a.configured?e("Model: {model}",{model:a.model}):e("Not configured: OPENAI_API_KEY is missing on the server.")," · ",e("Everyone sees what the assistant costs the group.")]}),s.jsx("div",{className:"tiles",children:p.map(([S,C])=>s.jsxs("button",{type:"button",className:`tile clickable ${u===S?"on":""}`,"aria-pressed":u===S,onClick:()=>d(S),children:[s.jsx("span",{className:"tile-label",children:C}),s.jsx("span",{className:"tile-value",children:h(a.cost[S])}),s.jsx("span",{className:"tile-sub",children:e("{n} requests · {k}K tokens",{n:a.req[S],k:Math.round(a.tokens[S]/1e3)})})]},S))}),s.jsxs("section",{className:"stats-section",children:[s.jsx("h3",{children:e("Who spent it")}),s.jsx("p",{className:"hint",children:e("For the period chosen above. A request is a question to the assistant; applying a change costs nothing.")}),x.length===0?s.jsx("p",{className:"hint",children:e("Nobody has asked the assistant in this period.")}):s.jsxs("table",{className:"stats-table spend-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx(et,{label:e("Person"),k:"name",by:v,toggle:k}),s.jsx(et,{label:e("Requests"),k:"req",by:v,toggle:k,firstDir:"desc",className:"num"}),s.jsx(et,{label:e("Spent"),k:"cost",by:v,toggle:k,firstDir:"desc",className:"num"}),s.jsx("th",{}),s.jsx(et,{label:e("Last asked"),k:"last",by:v,toggle:k,firstDir:"desc",className:"num"})]})}),s.jsx("tbody",{children:m.map(S=>s.jsxs("tr",{children:[s.jsxs("td",{children:[S.name,S.email&&S.email!==S.name?s.jsxs("span",{className:"hint",children:[" · ",S.email]}):null]}),s.jsx("td",{className:"num dim",children:S.req[u]}),s.jsx("td",{className:"num",children:h(S.cost[u])}),s.jsx("td",{className:"bar-cell",children:s.jsx("span",{className:"bar-track","aria-hidden":"true",children:s.jsx("span",{className:"bar-fill",style:{width:`${Math.round(S.cost[u]/T*100)}%`}})})}),s.jsx("td",{className:"num dim",children:g(S.lastAt)}
82)]},S.id??S.name))})]})]})]})}function _I({people:e,companies:a,departments:l,projects:i,onShowPerson:r}){const u=qe(),[d,h]=N.useState("load"),g=N.useMemo(()=>new Map(l.map(j=>[j.id,j])),[l]),p=j=>a.find(O=>O.id===j)?.name??"",m=[...N.useMemo(()=>{const j=Gi(e,i,[]);return e.filter(O=>O.fullName&&!O.plannedOut).map(O=>{const w=j.get(O.id);return{p:O,projects:w.memberships.length,core:w.core,partial:w.partial,advisor:w.advisor,owned:w.owned,leads:w.leads,load:jI(w)}})},[e,i])].sort((j,O)=>d==="name"?j.p.fullName.localeCompare(O.p.fullName):d==="free"?j.load-O.load||j.p.fullName.localeCompare(O.p.fullName):O.load-j.load||j.p.fullName.localeCompare(O.p.fullName)),{sorted:v,by:k,toggle:T}=fs(m,{person:j=>j.p.fullName.toLowerCase(),projects:j=>j.projects,core:j=>j.core,owned:j=>j.owned,load:j=>j.load}),S=Math.max(...v.map(j=>j.load),1),C=v.filter(j=>j.load>0).length,z=v.length-C,E=v.filter(j=>j.core>1).length;return s.jsxs("div",{className:"workload",children:[s.jsxs("div",{className:"stats-head",children:[s.jsxs("div",{children:[s.jsx("h3",{children:u("Workload")}),s.jsx("p",{className:"hint",children:u("Counted from involvement: a main project weighs three, a partial one two, an advisory one one, plus the areas a person owns and the projects they lead.")})]}),s.jsx("div",{className:"stats-filters",children:s.jsx("div",{className:"tabs small",role:"radiogroup","aria-label":u("Sort"),children:[["load",u("busiest first")],["free",u("free first")],["name",u("by name")]].map(([j,O])=>s.jsx("button",{type:"button",role:"radio","aria-checked":d===j,className:d===j?"on":"",onClick:()=>h(j),children:O},j))})})]}),s.jsxs("div",{className:"tiles small",children:[s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:u("In projects")}),s.jsx("span",{className:"tile-value",children:C}),s.jsx("span",{className:"tile-sub",children:u("of {n} people",{n:v.length})})]}),s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:u("In none")}),s.jsx("span",{className:"tile-value",children:z})]}),s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:u("More than one main project")}),s.jsx("span",{className:"tile-value",children:E}),s.jsx("span",{className:"tile-sub",children:u("worth a look")})]})]}),s.jsxs("table",{className:"stats-table workload-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx(et,{label:u("Person"),k:"person",by:k,toggle:T,colSpan:2}),s.jsx(et,{label:u("Projects"),k:"projects",by:k,toggle:T,firstDir:"desc",className:"num"}),s.jsx(et,{label:u("Main work"),k:"core",by:k,toggle:T,firstDir:"desc",className:"num"}),s.jsx(et,{label:u("Areas"),k:"owned",by:k,toggle:T,firstDir:"desc",className:"num"}),s.jsx(et,{label:u("Load"),k:"load",by:k,toggle:T,firstDir:"desc"})]})}),s.jsx("tbody",{children:v.map(j=>s.jsxs("tr",{className:"clickable",onClick:()=>r(j.p.id),title:u("Show on the map"),children:[s.jsx("td",{className:"avatar-cell",children:s.jsx(Xe,{person:j.p,size:22})}),s.jsxs("td",{children:[j.p.fullName,s.jsxs("span",{className:"dim",children:[" · ",[j.p.title,j.p.departmentId?g.get(j.p.departmentId)?.name:"",p(j.p.companyId)].filter(Boolean).join(" · ")]})]}),s.jsxs("td",{className:"num",title:j.projects?u("{a} main · {b} partial · {c} advisory",{a:j.core,b:j.partial,c:j.advisor}):void 0,children:[j.projects||"—",j.leads?` (${u("lead")})`:""]}),s.jsx("td",{className:`num ${j.core>1?"matrix-warn":""}`,children:j.core||"—"}),s.jsx("td",{className:"num",children:j.owned||"—"}),s.jsx("td",{children:s.jsx("span",{className:"bar-track small",children:s.jsx("span",{className:"bar-fill",style:{width:`${j.load/S*100}%`}})})})]},j.p.id))})]})]})}function OI({people:e,companies:a,departments:l,projects:i,assignments:r,onDrill:u}){const d=qe(),[h,g]=N.useState(null),p=N.useMemo(()=>Gi(e,i,r),[e,i,r]),x=(w,b,A,D,M)=>{const U=new Set;let Y=0,q=0,W=0,L=0;for(const V of w){const I=p.get(V.id);if(I){I.memberships.length&&Y++,q+=I.duties.length,W+=I.timed.length,I.idle&&L++;for(const F of I.memberships)U.add(F.project.name)}}return{id:b,name:A,kind:D,companyId:M,people:w.length,onProjects:Y,duties:q,timed:W,free:L,projects:[...U]}},m=N.useMemo(()=>{const w=e.filter(b=>b.fullName&&!b.plannedOut);return a.map(b=>{const A=w.filter(Y=>Y.companyId===b.id),D=x(A,b.id,b.name,"company",b.id),M=l.filter(Y=>Y.companyId===b.id).map(Y=>x(A.filter(q=>q.departmentId===Y.id),Y.id,Y.name,"department",b.id)).filter(Y=>Y.people>0).sort((Y,q)=>q.people-Y.people),U=A.filter(Y=>!Y.departmentId);return U.length&&M.push(x(U,`${b.id}-none`,d("Without a department"),"department",b.id)),{row:D,deps:M}}).filter(b=>b.row.people>0).sort((b,A)=>A.row.people-b.row.people)},[e,a,l,p,d]),v=m.reduce((w,b)=>w+b.row.people,0),k=m.reduce((w,b)=>w+(b.row.people-b.row.free),0),T=i.length,S=r.filter(w=>w.kind==="duty").length,C=r.filter(Q1).length,z=w=>{const b=w.people-w.free;return s.jsx("span",{className:"bar-track small",title:d("{busy} of {all} engaged",{busy:b,all:w.people}),children:s.jsx("span",{className:"bar-fill",style:{width:`${b/Math.max(w.people,1)*100}%`}})})},{sorted:E,by:j,toggle:O}=fs(m,{name:w=>w.row.name.toLowerCase(),people:w=>w.row.people,onProjects:w=>w.row.onProjects,duties:w=>w.row.duties,timed:w=>w.row.timed,free:w=>w.row.free,engaged:w=>w.row.people?(w.row.people-w.row.free)/w.row.people:0});return s.jsxs("div",{className:"overview",children:[s.jsxs("div",{className:"tiles small",children:[s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:d("Engaged")}),s.jsx("span",{className:"tile-value",children:k}),s.jsx("span",{className:"tile-sub",children:d("of {n} people",{n:v})})]}),s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:d("Idle")}
82),s.jsx("span",{className:"tile-value",children:v-k}),s.jsx("span",{className:"tile-sub",children:s.jsx("button",{type:"button",className:"link",onClick:()=>u({only:"free"}),children:d("look at them")})})]}),s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:d("Projects")}),s.jsx("span",{className:"tile-value",children:T})]}),s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:d("Standing duties")}),s.jsx("span",{className:"tile-value",children:S}),s.jsx("span",{className:"tile-sub",children:d("{n} timed",{n:C})})]})]}),s.jsxs("table",{className:"stats-table overview-table",children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"name"}),s.jsx("col",{className:"num"}),s.jsx("col",{className:"num"}),s.jsx("col",{className:"num"}),s.jsx("col",{className:"num"}),s.jsx("col",{className:"num"}),s.jsx("col",{className:"bar"}),s.jsx("col",{})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx(et,{label:d("Company"),k:"name",by:j,toggle:O}),s.jsx(et,{label:d("People"),k:"people",by:j,toggle:O,firstDir:"desc",className:"num"}),s.jsx(et,{label:d("On projects"),k:"onProjects",by:j,toggle:O,firstDir:"desc",className:"num"}),s.jsx(et,{label:d("Duties"),k:"duties",by:j,toggle:O,firstDir:"desc",className:"num"}),s.jsx(et,{label:d("Timed"),k:"timed",by:j,toggle:O,firstDir:"desc",className:"num"}),s.jsx(et,{label:d("Idle"),k:"free",by:j,toggle:O,firstDir:"desc",className:"num"}),s.jsx(et,{label:d("Engaged"),k:"engaged",by:j,toggle:O,firstDir:"desc"}),s.jsx("th",{children:d("What they work on")})]})}),s.jsx("tbody",{children:E.map(({row:w,deps:b})=>s.jsxs(N.Fragment,{children:[s.jsxs("tr",{className:"clickable org-row",onClick:()=>g(h===w.id?null:w.id),children:[s.jsxs("td",{children:[s.jsx("span",{className:"fold-mark","aria-hidden":"true",children:h===w.id?"▾":"▸"}),w.name]}),s.jsx("td",{className:"num",children:w.people}),s.jsx("td",{className:"num",children:w.onProjects||"—"}),s.jsx("td",{className:"num",children:w.duties||"—"}),s.jsx("td",{className:"num",children:w.timed||"—"}),s.jsx("td",{className:`num ${w.free===w.people?"matrix-warn":""}`,children:w.free||"—"}),s.jsx("td",{children:z(w)}),s.jsx("td",{className:"work",children:w.projects.join(", ")||"—"})]}),h===w.id&&b.map(A=>s.jsxs("tr",{className:"clickable unit-row",onClick:()=>u(A.id.endsWith("-none")?{companyId:A.companyId}:{departmentId:A.id}),children:[s.jsx("td",{className:"indent",children:A.name}),s.jsx("td",{className:"num",children:A.people}),s.jsx("td",{className:"num",children:A.onProjects||"—"}),s.jsx("td",{className:"num",children:A.duties||"—"}),s.jsx("td",{className:"num",children:A.timed||"—"}),s.jsx("td",{className:`num ${A.free===A.people?"matrix-warn":""}`,children:A.free||"—"}),s.jsx("td",{children:z(A)}),s.jsx("td",{className:"work",children:A.projects.join(", ")||"—"})]},A.id))]},w.id))})]}),s.jsx("p",{className:"hint",children:d("A row opens its departments; a department opens the team filtered down to it.")})]})}const Xw=e=>e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim();function AI({people:e,companies:a,departments:l,projects:i,assignments:r,onOpenCard:u,onDrill:d}){const h=qe(),g=E=>a.find(j=>j.id===E)?.name??"",p=N.useMemo(()=>new Map(l.map(E=>[E.id,E])),[l]),x=N.useMemo(()=>Gi(e,i,r),[e,i,r]),m=e.filter(E=>E.fullName&&!E.plannedOut),v=m.filter(E=>x.get(E.id)?.idle??!0),k=N.useMemo(()=>{const E=new Map;for(const j of v){const O=j.departmentId??`c:${j.companyId}`;E.set(O,[...E.get(O)??[],j])}return[...E.entries()].map(([j,O])=>({key:j,name:j.startsWith("c:")?`${g(j.slice(2))}
82 · ${h("Without a department")}`:`${p.get(j)?.name??""} · ${g(p.get(j)?.companyId??"")}`,departmentId:j.startsWith("c:")?null:j,list:O,total:m.filter(w=>j.startsWith("c:")?w.companyId===j.slice(2)&&!w.departmentId:w.departmentId===j).length})).sort((j,O)=>O.list.length-j.list.length)},[v,m,p,a,h]),T=N.useMemo(()=>{const E=new Map;for(const j of r){if(j.kind!=="duty")continue;const O=e.find(A=>A.id===j.personId);if(!O)continue;const w=Xw(j.title),b=E.get(w)??{title:j.title,people:[]};b.people.some(A=>A.id===O.id)||b.people.push(O),E.set(w,b)}return[...E.values()].filter(j=>j.people.length>1).sort((j,O)=>O.people.length-j.people.length)},[r,e]),S=N.useMemo(()=>{const E=[];for(const j of i)for(const O of j.areas){const w=j.members.filter(b=>b.areas.some(A=>A.areaId===O.id&&A.kind==="owns")).map(b=>e.find(A=>A.id===b.personId)).filter(b=>!!b);w.length!==1&&E.push({project:j,area:O.name,owners:w})}return E},[i,e]),C=N.useMemo(()=>{const E=new Map;for(const j of v){if(!j.title)continue;const O=`${j.departmentId??j.companyId}|${Xw(j.title)}`;E.set(O,[...E.get(O)??[],j])}return[...E.values()].filter(j=>j.length>1).sort((j,O)=>O.length-j.length)},[v]),z=E=>s.jsxs("button",{type:"button",className:"person-chip",onClick:()=>u(E.id),title:[E.title,p.get(E.departmentId??"")?.name,g(E.companyId)].filter(Boolean).join(" · "),children:[s.jsx(Xe,{person:E,size:20}),E.fullName]},E.id);return s.jsxs("div",{className:"idle-view",children:[s.jsxs("section",{className:"stats-section",children:[s.jsxs("div",{className:"section-head",children:[s.jsx("h3",{children:h("Nobody is using them")}),s.jsx("span",{className:"hint",children:h("{n} people carry no project, no duty and no timed work",{n:v.length})})]}),v.length===0&&s.jsx("p",{className:"hint",children:h("Everyone carries something.")}),k.slice(0,12).map(E=>s.jsxs("div",{className:"pocket",children:[s.jsxs("div",{className:"pocket-head",children:[s.jsx("button",{type:"button",className:"link",onClick:()=>d(E.departmentId?{departmentId:E.departmentId,only:"free"}:{only:"free"}),children:E.name}),s.jsx("span",{className:"hint",children:h("{idle} of {all}",{idle:E.list.length,all:E.total})})]}),s.jsxs("div",{className:"chips",children:[E.list.slice(0,14).map(z),E.list.length>14&&s.jsxs("span",{className:"hint",children:["+",E.list.length-14]})]})]},E.key))]}),s.jsxs("section",{className:"stats-section",children:[s.jsxs("div",{className:"section-head",children:[s.jsx("h3",{children:h("Doing the same thing")}),s.jsx("span",{className:"hint",children:h("The same duty on several people, and areas with no single owner.")})]}),T.length===0&&S.length===0&&C.length===0&&s.jsx("p",{className:"hint",children:h("Nothing doubled up so far.")}),T.map(E=>s.jsxs("div",{className:"pocket",children:[s.jsxs("div",{className:"pocket-head",children:[s.jsx("span",{children:E.title}),s.jsx("span",{className:"hint",children:h("{n} people",{n:E.people.length})})]}),s.jsx("div",{className:"chips",children:E.people.map(z)})]},E.title)),S.map(E=>s.jsxs("div",{className:"pocket",children:[s.jsxs("div",{className:"pocket-head",children:[s.jsxs("span",{children:[E.project.name," · ",E.area]}),s.jsx("span",{className:`hint ${E.owners.length===0?"matrix-warn":""}`,children:E.owners.length===0?h("no owner"):h("{n} owners",{n:E.owners.length})})]}),E.owners.length>0&&s.jsx("div",{className:"chips",children:E.owners.map(z)})]},`${E.project.id}-${E.area}`)),C.slice(0,8).map(E=>s.jsxs("div",{className:"pocket",children:[s.jsxs("div",{className:"pocket-head",children:[s.jsxs("span",{children:[E[0].title," · ",p.get(E[0].departmentId??"")?.name??g(E[0].companyId)]}),s.jsx("span",{className:"hint",children:h("{n} people with the same job title, none of them engaged",{n:E.length})})]}),s.jsx("div",{className:"chips",children:E.slice(0,14).map(z)})]},E[0].id))]}),s.jsx("p",{className:"hint",children:h("Click a person to open their card; click a department to see it in the team.")})]})}const dp=(e,a)=>a?`${Math.round(e/a*100)}%`:"–",II=e=>{if(!e.length)return 0;const a=[...e].sort((i,r)=>i-r),l=Math.floor(a.length/2);return a.length%2?a[l]:(a[l-1]+a[l])/2};function Hl({label:e,sub:a,value:l,max:i,text:r,muted:u,active:d,onClick:h}){return s.jsxs("button",{type:"button",className:`bar-row ${u?"muted":""} ${d?"active":""} ${h?"clickable":""}`,title:`${e}: ${r}`,onClick:h,children:[s.jsxs("span",{className:"bar-label",children:[e,a&&s.jsxs("span",{className:"bar-sub",children:[" · ",a]})]}),s.jsx("span",{className:"bar-track",children:s.jsx("span",{className:"bar-fill",style:{width:`${i?Math.max(1,l/i*100):0}%`}})}),s.jsx("span",{className:"bar-value",children:r})]})}function rd({label:e,value:a,sub:l}){return s.jsxs("div",{className:"tile",children:[s.jsx("span",{className:"tile-label",children:e}),s.jsx("span",{className:"tile-value",children:a}),l&&s.jsx("span",{className:"tile-sub",children:l})]})}function zI({companies:e,departments:a,people:l,projects:i,assignments:r,rates:u,confidential:d,money:h,onJump:g,onDrill:p,onOpenCard:x}){const m=qe(),v=m.lang==="ru"?"мес":"mo",k=K=>m.n(K,"person","people"),[T,S]=N.useState("all"),[C,z]=N.useState(!1),[E,j]=N.useState("pay"),[O,w]=N.useState(null),[b,A]=N.useState(null),[D,M]=N.useState("overview"),U=N.useMemo(()=>{const K=T==="all"?null:new Set(e.filter(ue=>ue.id===T||Gl(e,ue.id,T)).map(ue=>ue.id));return l.filter(ue=>(C||!ue.plannedOut)&&(!K||K.has(ue.companyId)))},[l,e,T,C]),Y=N.useMemo(()=>{const K=Ae=>un(Ae,u),ue=U,xe=ue.filter(Ae=>K(Ae)>0),Ne=xe.reduce((Ae,Be)=>
82Ae+K(Be),0),He=l.filter(Ae=>Ae.plannedOut).reduce((Ae,Be)=>Ae+K(Be),0),ee=new Map(e.map(Ae=>[Ae.id,Ae.name])),ge=new Map(a.map(Ae=>[Ae.id,Ae])),Le=e.map(Ae=>{const Be=ue.filter(ut=>ut.companyId===Ae.id),st=Be.reduce((ut,ta)=>ut+K(ta),0),_t=e.filter(ut=>ut.id===Ae.id||Gl(e,ut.id,Ae.id)).map(ut=>ut.id),gn=ue.filter(ut=>_t.includes(ut.companyId));return{id:Ae.id,name:Ae.name,people:Be.length,pay:st,own:Be,allPeople:gn.length,allPay:gn.reduce((ut,ta)=>ut+K(ta),0),hasChildren:_t.length>1}}).filter(Ae=>Ae.people>0||Ae.allPeople>0).sort((Ae,Be)=>Be.pay-Ae.pay),me=a.map(Ae=>{const Be=ue.filter(Et=>Et.departmentId===Ae.id),st=a.filter(Et=>Et.parentId===Ae.id).map(Et=>Et.id),_t=ue.filter(Et=>Et.departmentId===Ae.id||Et.departmentId&&st.includes(Et.departmentId)),gn=Ae.parentId?ge.get(Ae.parentId):void 0,ut=_t.reduce((Et,qt)=>Et+K(qt),0),ta=_t.filter(Et=>K(Et)>0).length;return{id:Ae.id,name:gn?`${gn.name} › ${Ae.name}`:Ae.name,company:ee.get(Ae.companyId)??"",people:Be.length,allPeople:_t.length,members:_t,allPay:ut,avg:ta?ut/ta:0,unit:!!gn,headless:!Ae.headId}}).filter(Ae=>Ae.allPeople>0),_e=ue.filter(Ae=>!Ae.departmentId),ke=["USD","UAH","EUR"].map(Ae=>{const Be=xe.filter(st=>st.salaryCurrency===Ae);return{cur:Ae,people:Be.length,list:Be,pay:Be.reduce((st,_t)=>st+K(_t),0),raw:Be.reduce((st,_t)=>st+(_t.salary??0),0)}}),re=[{label:"< $500",lo:0,hi:500},{label:"$500–1,000",lo:500,hi:1e3},{label:"$1,000–1,500",lo:1e3,hi:1500},{label:"$1,500–2,500",lo:1500,hi:2500},{label:"$2,500–4,000",lo:2500,hi:4e3},{label:"$4,000+",lo:4e3,hi:1/0}].map(Ae=>{const Be=xe.filter(st=>K(st)>=Ae.lo&&K(st)<Ae.hi);return{...Ae,people:Be.length,list:Be,pay:Be.reduce((st,_t)=>st+K(_t),0)}}),te=[...xe].sort((Ae,Be)=>K(Be)-K(Ae)).slice(0,10),Ce=new Map;for(const Ae of ue)for(const Be of Ae.managerIds)Ce.set(Be,[...Ce.get(Be)??[],Ae]);const Ee=[...Ce.entries()].map(([Ae,Be])=>({p:l.find(st=>st.id===Ae),list:Be})).filter(Ae=>Ae.p).sort((Ae,Be)=>Be.list.length-Ae.list.length).slice(0,10),Re=ue.filter(Ae=>Ae.managerIds.length===0),Ke=ue.filter(Ae=>Ae.photoVersion==null),mt=ue.filter(Ae=>Ae.managerIds.some(Be=>l.find(st=>st.id===Be)?.companyId!==Ae.companyId)),dt=ue.filter(Ae=>Ae.managerIds.some(Be=>{const st=l.find(_t=>_t.id===Be);return st&&st.companyId===Ae.companyId&&(st.departmentId??null)!==(Ae.departmentId??null)})),En=[...ue.reduce((Ae,Be)=>Ae.set(Be.title||"—",[...Ae.get(Be.title||"—")??[],Be]),new Map).entries()].sort((Ae,Be)=>Be[1].length-Ae[1].length).slice(0,12),Ue=ue.filter(Ae=>Ae.sharePctMin!=null||Ae.sharePctMax!=null),ea=ue.filter(Ae=>K(Ae)===0&&Ae.sharePctMin==null&&Ae.sharePctMax==null);return{active:ue,paid:xe,total:Ne,cut:He,byCompany:Le,byDept:me,noDept:_e,byCurrency:ke,bands:re,top:te,managers:Ee,noManager:Re,noPhoto:Ke,cross:mt,crossDept:dt,titles:En,share:Ue,noPayList:ea,avg:xe.length?Ne/xe.length:0,med:II(xe.map(K)),review:l.filter(Ae=>Ae.underReview&&!Ae.plannedOut).length,leaving:l.filter(Ae=>Ae.plannedOut).length,headless:a.filter(Ae=>!Ae.headId).length}},[U,l,e,a,u]),q=K=>d?"•••":yt(K),W=N.useMemo(()=>[...Y.byDept].sort((K,ue)=>E==="pay"?ue.allPay-K.allPay:E==="people"?ue.allPeople-K.allPeople:ue.avg-K.avg),[Y.byDept,E]),L=Math.max(...Y.byCompany.map(K=>K.pay),1),V=Math.max(...W.map(K=>E==="people"?K.allPeople:E==="avg"?K.avg:K.allPay),1),I=Math.max(...Y.bands.map(K=>K.people),1),F=Math.max(...Y.managers.map(K=>K.list.length),1),_=Y.byCurrency[1].pay,H=O??u.uah,P=_*(u.uah/H),X=K=>b?.title===K,ne=(K,ue)=>A(X(K)?null:{title:K,people:ue}),pe=K=>K&&a.find(ue=>ue.id===K)?.name||"",R=K=>e.find(ue=>ue.id===K)?.name??"",{sorted:Q,by:le,toggle:se}=fs(b?.people??[],{name:K=>(K.fullName||"").toLowerCase(),title:K=>K.title.toLowerCase(),where:K=>[pe(K.departmentId),R(K.companyId)].filter(Boolean).join(" · ").toLowerCase(),pay:K=>un(K,u)},{key:"pay",dir:"desc"}),ie=b&&s.jsxs("div",{className:"pick-list",children:[s.jsxs("div",{className:"section-head",children:[s.jsxs("h4",{children:[b.title," ",s.jsx("span",{className:"count",children:b.people.length}),!d&&s.jsxs("span",{className:"hint",children:[" · ",yt(b.people.reduce((K,ue)=>K+un(ue,u),0)),"/",v]})]}),s.jsx("button",{type:"button",className:"icon-btn",title:m("Close"),"aria-label":m("Close"),onClick:()=>A(null),children:"×"})]}),s.jsxs("table",{className:"stats-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{}),s.jsx(et,{label:m("Name"),k:"name",by:le,toggle:se}),s.jsx(et,{label:m("Title"),k:"title",by:le,toggle:se}),s.jsx(et,{label:m("Where"),k:"where",by:le,toggle:se}),!d&&s.jsx(et,{label:m("Salary"),k:"pay",by:le,toggle:se,firstDir:"desc",className:"num"}),d&&s.jsx("th",{className:"num"})]})}),s.jsx("tbody",{children:Q.map(K=>s.jsxs("tr",{className:"clickable",onClick:()=>g("person",K.id),title:m("Show on the map"),children:[s.jsx("td",{className:"avatar-cell",children:s.jsx(Xe,{person:K,size:22})}),s.jsxs("td",{children:[K.fullName||m("Unnamed"),K.plannedOut?` · ${m("dismissal")}`:"",K.underReview?" · ?":""]}),s.jsx("td",{className:"dim",children:K.title}),s.jsx("td",{className:"dim",children:[pe(K.departmentId),R(K.companyId)].filter(
82Boolean).join(" · ")}),s.jsx("td",{className:"num",children:d?"•••":un(K,u)?`${yt(un(K,u))}${K.salaryCurrency!=="USD"?` (${Ng(K.salary??0,K.salaryCurrency)})`:""}`:"—"})]},K.id))})]})]});return s.jsxs("div",{className:"stats",children:[s.jsxs("div",{className:"stats-head",children:[s.jsxs("div",{className:"tabs",role:"tablist","aria-label":m("Insights"),children:[s.jsx("button",{type:"button",role:"tab","aria-selected":D==="overview",className:D==="overview"?"on":"",onClick:()=>M("overview"),children:m("What is going on")}),s.jsx("button",{type:"button",role:"tab","aria-selected":D==="idle",className:D==="idle"?"on":"",onClick:()=>M("idle"),children:m("Slack and doubles")}),h&&s.jsx("button",{type:"button",role:"tab","aria-selected":D==="money",className:D==="money"?"on":"",onClick:()=>M("money"),children:m("People and money")}),s.jsx("button",{type:"button",role:"tab","aria-selected":D==="workload",className:D==="workload"?"on":"",onClick:()=>M("workload"),children:m("Workload")}),s.jsx("button",{type:"button",role:"tab","aria-selected":D==="spend",className:D==="spend"?"on":"",onClick:()=>M("spend"),children:m("Assistant")})]}),s.jsxs("div",{className:"stats-filters",children:[s.jsxs("select",{value:T,onChange:K=>{S(K.target.value),A(null)},"aria-label":m("Company"),children:[s.jsx("option",{value:"all",children:m("All companies")}),e.map(K=>s.jsx("option",{value:K.id,children:K.name},K.id))]}),s.jsxs("label",{className:"check",children:[s.jsx("input",{type:"checkbox",checked:C,onChange:K=>z(K.target.checked)}),m("Include people marked for dismissal")]})]})]}),D==="overview"||D==="money"&&!h?s.jsx(OI,{people:U,companies:e,departments:a,projects:i,assignments:r,onDrill:p}):D==="idle"?s.jsx(AI,{people:U,companies:e,departments:a,projects:i,assignments:r,onOpenCard:x,onDrill:p}):D==="spend"?s.jsx(DI,{}):D==="workload"?s.jsx(_I,{people:U,companies:e,departments:a,projects:i,onShowPerson:K=>g("person",K)}):s.jsxs(s.Fragment,{children:[d&&s.jsx("p",{className:"hint",children:m("Confidential mode is on — amounts are hidden, counts and shares are shown.")}),s.jsx("p",{className:"hint",children:m("Click a bar to see the people behind it; click a person to find them on the map.")}),s.jsxs("div",{className:"tiles",children:[s.jsx(rd,{label:m("People"),value:String(Y.active.length),sub:m("{n} on payroll · {s} with profit share",{n:Y.paid.length,s:Y.share.length})}),s.jsx(rd,{label:m("Payroll / month"),value:q(Y.total),sub:d?void 0:m("{y} / year",{y:yt(Y.total*12)})}),s.jsx(rd,{label:m("Average salary"),value:q(Y.avg),sub:d?void 0:m("median {m}",{m:yt(Y.med)})}),s.jsx(rd,{label:m("What-if"),value:m("{a} for dismissal · {b} under review",{a:Y.leaving,b:Y.review}),sub:Y.cut&&!d?m("saves {m}/mo",{m:yt(Y.cut)}):void 0}),s.jsxs("button",{type:"button",className:"tile clickable",onClick:()=>{const K=[...Y.noPayList,...Y.noManager,...Y.noPhoto];ne(m("Data gaps"),K.filter((ue,xe)=>K.indexOf(ue)===xe))},children:[s.jsx("span",{className:"tile-label",children:m("Data gaps")}),s.jsx("span",{className:"tile-value",children:m("{n} without pay",{n:Y.noPayList.length})}),s.jsxs("span",{className:"tile-sub",children:[m("{a} without manager · {b} departments without head",{a:Y.noManager.length,b:Y.headless}),Y.noPhoto.length>0&&` · ${m("{n} without a photo",{n:Y.noPhoto.length})}`]})]})]}),b?.title===m("Data gaps")&&ie,s.jsxs("section",{className:"stats-section",children:[s.jsx("h3",{children:m("Payroll by company")}),s.jsx("p",{className:"hint",children:m("Own people only; the right column adds the companies below. Bars: monthly payroll.")}),Y.byCompany.map(K=>s.jsx(Hl,{label:K.name,sub:`${k(K.people)}${K.hasChildren?` · ${m("with subsidiaries {p}, {m}/mo",{p:k(K.allPeople),m:q(K.allPay)})}`:""}`,value:K.pay,max:L,text:`${q(K.pay)}/${v} · ${dp(K.pay,Y.total)}`,muted:K.people===0,active:X(K.name),onClick:()=>ne(K.name,K.own)},K.id)),Y.byCompany.some(K=>X(K.name))&&ie]}),s.jsxs("section",{className:"stats-section",children:[s.jsxs("div",{className:"section-head",children:[s.jsx("h3",{children:m("Payroll by department")}),s.jsx("div",{className:"tabs small",role:"radiogroup","aria-label":m("Sort"),children:[["pay",m("by payroll")],["people",m("by people")],["avg",m("by average")]].map(([K,ue])=>s.jsx("button",{type:"button",role:"radio","aria-checked":E===K,className:E===K?"on":"",onClick:()=>j(K),children:ue},K))})]}),s.jsx("p",{className:"hint",children:m("Units are listed as “Department › Unit”; a department's bar includes its units. {n} people hang directly from a company card ({m}/mo).",{n:Y.noDept.length,m:q(Y.noDept.reduce((K,ue)=>K+un(ue,u),0))})}),W.map(K=>s.jsx(Hl,{label:K.name,sub:`${K.company} · ${K.allPeople}${K.headless?` · ${m("no head")}
82`:""}`,value:E==="people"?K.allPeople:E==="avg"?K.avg:K.allPay,max:V,text:E==="avg"?`${q(K.avg)}/${v} ${m("avg")}`:`${q(K.allPay)}/${v} · ${dp(K.allPay,Y.total)}`,muted:K.unit,active:X(K.name),onClick:()=>ne(K.name,K.members)},K.id)),Y.noDept.length>0&&s.jsx(Hl,{label:m("No department (executives)"),value:Y.noDept.reduce((K,ue)=>K+un(ue,u),0),max:V,text:`${q(Y.noDept.reduce((K,ue)=>K+un(ue,u),0))}/${v}`,muted:!0,active:X(m("No department (executives)")),onClick:()=>ne(m("No department (executives)"),Y.noDept)}),(W.some(K=>X(K.name))||X(m("No department (executives)")))&&ie]}),s.jsxs("div",{className:"stats-cols",children:[s.jsxs("section",{className:"stats-section",children:[s.jsx("h3",{children:m("By currency")}),s.jsx("p",{className:"hint",children:m("FX exposure: salaries set in UAH and EUR move with the rate (now {u} UAH/USD, {e} USD/EUR).",{u:u.uah,e:u.eur})}),Y.byCurrency.map(K=>s.jsx(Hl,{label:K.cur,sub:`${k(K.people)}${!d&&K.cur!=="USD"?` · ${K.cur==="UAH"?"₴":"€"}${Math.round(K.raw).toLocaleString("en-US")}`:""}`,value:K.pay,max:Y.total,text:`${q(K.pay)}/${v} · ${dp(K.pay,Y.total)}`,active:X(K.cur),onClick:()=>ne(K.cur,K.list)},K.cur)),!d&&_>0&&s.jsxs("div",{className:"fx-scenario",children:[s.jsx("label",{htmlFor:"fx",children:m("What if the rate were {r} UAH/USD?",{r:H})}),s.jsx("input",{id:"fx",type:"range",min:Math.floor(u.uah*.7),max:Math.ceil(u.uah*1.4),step:"0.5",value:H,onChange:K=>w(Number(K.target.value))}),s.jsxs("span",{className:"hint",children:[m("UAH salaries would cost {a}/mo instead of {b} ({d}); total payroll {tot}/mo.",{a:yt(P),b:yt(_),d:(P-_>=0?"+":"−")+yt(Math.abs(P-_)),tot:yt(Y.total-_+P)}),O!==null&&s.jsxs(s.Fragment,{children:[" · ",s.jsx("button",{type:"button",className:"link",onClick:()=>w(null),children:m("reset")})]})]})]}),Y.byCurrency.some(K=>X(K.cur))&&ie]}),s.jsxs("section",{className:"stats-section",children:[s.jsx("h3",{children:m("Salary bands")}),s.jsx("p",{className:"hint",children:m("How many people earn how much (USD equivalent, per month).")}),Y.bands.map(K=>s.jsx(Hl,{label:K.label,value:K.people,max:I,text:`${K.people} · ${q(K.pay)}/${v}`,active:X(K.label),onClick:()=>ne(K.label,K.list)},K.label)),Y.bands.some(K=>X(K.label))&&ie]})]}),s.jsxs("div",{className:"stats-cols",children:[s.jsxs("section",{className:"stats-section",children:[s.jsx("h3",{children:m("Widest spans of control")}),s.jsx("p",{className:"hint",children:m("Direct reports per manager. Above ~8 is worth a look.")}),Y.managers.map(({p:K,list:ue})=>s.jsx(Hl,{label:K.fullName,sub:K.title,value:ue.length,max:F,text:m("{n} reports",{n:ue.length}),active:X(K.fullName),onClick:()=>ne(K.fullName,ue)},K.id)),s.jsxs("p",{className:"hint",children:[s.jsx("button",{type:"button",className:"link",onClick:()=>ne(m("Report to nobody"),Y.noManager),children:m("{a} people report to nobody",{a:Y.noManager.length})})," · ",s.jsx("button",{type:"button",className:"link",onClick:()=>ne(m("Report across companies"),Y.cross),children:m("{b} report across companies",{b:Y.cross.length})})," · ",s.jsx("button",{type:"button",className:"link",onClick:()=>ne(m("Report across departments"),Y.crossDept),children:m("{c} across departments",{c:Y.crossDept.length})})]}),(Y.managers.some(K=>X(K.p.fullName))||[m("Report to nobody"),m("Report across companies"),m("Report across departments")].some(X))&&ie]}),s.jsxs("section",{className:"stats-section",children:[s.jsx("h3",{children:m(d?"Most common titles":"Top salaries")}),d?Y.titles.map(([K,ue])=>s.jsx(Hl,{label:K,value:ue.length,max:Y.titles[0]?.[1].length??1,text:String(ue.length),active:X(K),onClick:()=>ne(K,ue)},K)):s.jsx("table",{className:"stats-table",children:s.jsx("tbody",{children:Y.top.map(K=>s.jsxs("tr",{className:"clickable",onClick:()=>g("person",K.id),title:m("Show on the map"),children:[s.jsx("td",{className:"avatar-cell",children:s.jsx(Xe,{person:K,size:22})}),s.jsx("td",{children:K.fullName}),s.jsx("td",{className:"dim",children:K.title}),s.jsx("td",{className:"dim",children:R(K.companyId)}),s.jsx("td",{className:"num",children:yt(un(K,u))})]},K.id))})}),d&&Y.titles.some(([K])=>X(K))&&ie]})]}),!d&&s.jsxs("section",{className:"stats-section",children:[s.jsx("h3",{children:m("Most common titles")}),Y.titles.map(([K,ue])=>s.jsx(Hl,{label:K,value:ue.length,max:Y.titles[0]?.[1].length??1,text:String(ue.length),active:X(K),onClick:()=>ne(K,ue)},K)),Y.titles.some(([K])=>X(K))&&ie]})]})]})}
82const RI=10,Zw=e=>e.toLowerCase().trim();function $I({companies:e,departments:a,people:l,onPick:i}){const[r,u]=N.useState(""),[d,h]=N.useState(!1),[g,p]=N.useState(0),x=N.useRef(null),m=qe();N.useEffect(()=>{const S=C=>{(C.ctrlKey||C.metaKey)&&ql(C,"k")&&(C.preventDefault(),x.current?.focus(),x.current?.select())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[]);const v=N.useMemo(()=>{const S=Zw(r);if(!S)return[];const C=new Map(e.map(O=>[O.id,O])),z=O=>{let w=0;for(const b of O){const A=Zw(b);A&&(A===S?w=Math.max(w,3):A.startsWith(S)?w=Math.max(w,2):A.includes(S)&&(w=Math.max(w,1)))}return w},E=[];for(const O of e){const w=z([O.name,O.focus,...O.tags]);w&&E.push({hit:{kind:"company",id:O.id,company:O},score:w+.5})}const j=new Map(a.map(O=>[O.id,O]));for(const O of a){const w=z([O.name]);w&&E.push({hit:{kind:"department",id:O.id,department:O,company:C.get(O.companyId)},score:w+.25})}for(const O of l){const w=O.departmentId?j.get(O.departmentId):void 0,b=z([O.fullName,O.title,w?.name??""]);b&&E.push({hit:{kind:"person",id:O.id,person:O,company:C.get(O.companyId),department:w},score:b})}return E.sort((O,w)=>w.score-O.score).slice(0,RI).map(O=>O.hit)},[r,e,a,l]);N.useEffect(()=>p(0),[r]);const k=d&&r.trim().length>0;function T(S){i(S),u(""),h(!1),x.current?.blur()}return s.jsxs("div",{className:"search",children:[s.jsx("input",{ref:x,type:"search",className:"search-input",placeholder:m("Search…  Ctrl+K"),"aria-label":m("Search companies and people"),value:r,autoComplete:"off",onChange:S=>{u(S.target.value),h(!0)},onFocus:()=>h(!0),onBlur:()=>h(!1),onKeyDown:S=>{S.key==="ArrowDown"||S.key==="ArrowUp"?(S.preventDefault(),v.length&&p(C=>(C+(S.key==="ArrowDown"?1:-1)+v.length)%v.length)):S.key==="Enter"&&v[g]?(S.preventDefault(),T(v[g])):S.key==="Escape"&&(S.stopPropagation(),r?u(""):x.current?.blur())}}),k&&s.jsxs("ul",{className:"suggest-list search-list",role:"listbox",children:[v.map((S,C)=>s.jsx("li",{role:"option","aria-selected":C===g,className:C===g?"on":"",onMouseDown:z=>z.preventDefault(),onMouseEnter:()=>p(C),onClick:()=>T(S),children:S.kind==="company"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"hit-swatch",style:{background:S.company.color??"var(--accent)"}}),s.jsxs("span",{className:"hit-main",children:[s.jsx("span",{className:"hit-name",children:S.company.name||"Untitled"}),s.jsxs("span",{className:"hit-sub",children:[S.company.kind==="holding"?m("Group"):m("Company"),S.company.tags.length?` · ${S.company.tags.join(", ")}`:""]})]})]}):S.kind==="department"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"hit-swatch dept",style:{background:S.department.color??S.company?.color??"var(--accent)"}}),s.jsxs("span",{className:"hit-main",children:[s.jsx("span",{className:"hit-name",children:S.department.name}),s.jsxs("span",{className:"hit-sub",children:[S.department.parentId?m("Unit"):m("Department"),S.company?` · ${S.company.name}`:""]})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Xe,{person:S.person,size:22}),s.jsxs("span",{className:"hit-main",children:[s.jsx("span",{className:"hit-name",children:S.person.fullName||"Unnamed"}),s.jsx("span",{className:"hit-sub",children:[S.person.title,S.department?.name,S.company?.name].filter(Boolean).join(" · ")})]})]})},S.id)),v.length===0&&s.jsx("li",{className:"hint search-empty",children:m("Nothing found")})]})]})}function LI({people:e,companies:a,rate:l,confidential:i,onKeep:r,onKeepAll:u,onDecide:d}){const[h,g]=N.useState(!1),p=N.useRef(null),x=qe(),m=e.filter(S=>S.plannedOut),v=e.filter(S=>S.underReview&&!S.plannedOut),k=m.reduce((S,C)=>S+un(C,l),0);if(N.useEffect(()=>{if(!h)return;const S=C=>{p.current?.contains(C.target)||g(!1)};return window.addEventListener("mousedown",S),()=>window.removeEventListener("mousedown",S)},[h]),N.useEffect(()=>{m.length+v.length===0&&g(!1)},[m.length,v.length]),m.length+v.length===0)return null;const T=S=>a.find(C=>C.id===S)?.name??"";return s.jsxs("div",{className:"whatif-wrap",ref:p,children:[s.jsxs("button",{type:"button",className:"badge whatif-pill","aria-expanded":h,title:x("What-if scenario: the dismissals being weighed"),onClick:()=>g(S=>!S),children:[m.length>0&&`${x("✂ {n} for dismissal",{n:m.length})}${i?"":` · −${yt(k)}/${x.lang==="ru"?"мес":"mo"}`}`,m.length>0&&v.length>0&&" · ",v.length>0&&x("? {n} under review",{n:v.length})]}),h&&s.jsxs("div",{className:"whatif-menu",children:[s.jsxs("ul",{children:[v.map(S=>s.jsxs("li",{className:"review-row",children:[s.jsx(Xe,{person:S,size:22}),s.jsxs("span",{className:"hit-main",children:[s.jsxs("span",{className:"hit-name",children:["? ",S.fullName||x("Unnamed")]}),s.jsxs("span",{className:"hit-sub",children:[[S.title,T(S.companyId)].filter(
82Boolean).join(" · ")," · ",x("under review")]})]}),!i&&s.jsx("span",{className:"whatif-sum review",children:un(S,l)?yt(un(S,l)):"—"}),s.jsx("button",{type:"button",className:"link",onClick:()=>d(S.id),children:x("Decided")})]},S.id)),m.map(S=>s.jsxs("li",{children:[s.jsx(Xe,{person:S,size:22}),s.jsxs("span",{className:"hit-main",children:[s.jsx("span",{className:"hit-name",children:S.fullName||x("Unnamed")}),s.jsx("span",{className:"hit-sub",children:[S.title,T(S.companyId)].filter(Boolean).join(" · ")})]}),!i&&s.jsx("span",{className:"whatif-sum",children:un(S,l)?`−${yt(un(S,l))}`:"—"}),s.jsx("button",{type:"button",className:"link",onClick:()=>r(S.id),children:x("Keep")})]},S.id))]}),s.jsxs("div",{className:"whatif-foot",children:[!i&&m.length>0&&s.jsx("span",{className:"hint",children:x("Saves {m}/mo · {y}/yr",{m:yt(k),y:yt(k*12)})}),m.length>0&&s.jsx("button",{type:"button",className:"btn small",onClick:u,children:x("Keep everyone")})]})]})]})}const UI={planner:"Planner",notices:"Notifications",team:"Team",departments:"Departments",map:"Map",projects:"Projects",tools:"Tools",planning:"Planning",tasks:"Tasks",recurring:"Recurring",stats:"Insights",settings:"Settings"};function HI(e){const a=qe();return s.jsxs("header",{className:"bar",children:[s.jsx("h1",{className:"bar-title",children:a(UI[e.tab])}),s.jsxs("div",{className:"bar-right",children:[s.jsx($I,{companies:e.companies,departments:e.departments,people:e.people,onPick:e.onSearchPick}),e.tab==="map"&&!e.readOnly&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn",type:"button",onClick:e.onArrange,title:a("Lay out the tree so nothing overlaps"),children:a("Auto-arrange")}),s.jsx("button",{className:"btn primary",type:"button",onClick:e.onAddCompany,children:a("+ Add company")})]}),e.tab==="map"&&s.jsx(LI,{people:e.people,companies:e.companies,rate:e.rates,confidential:e.confidential,onKeep:e.onKeep,onKeepAll:e.onKeepAll,onDecide:e.onDecide}),s.jsx("span",{className:"status",children:e.status==="Connected"?"":a(e.status)}),e.fullscreen&&s.jsx("button",{className:`icon-btn ${e.refreshing?"spin":""}`,type:"button",title:a("Refresh data from the server (F5) — keeps full screen"),"aria-label":"Refresh",disabled:e.refreshing,onClick:e.onRefresh,children:"↻"}),s.jsx("button",{className:"icon-btn",type:"button","aria-pressed":e.fullscreen,title:e.fullscreen?a("Exit full screen (or press and hold Esc)"):a("Full screen"),"aria-label":e.fullscreen?a("Exit full screen"):a("Full screen"),onClick:e.onToggleFullscreen,children:e.fullscreen?"⤢":"⛶"}),s.jsx("button",{className:`icon-btn assistant-btn ${e.assistantOpen?"on":""}`,type:"button","aria-pressed":e.assistantOpen,title:a("Assistant"),"aria-label":a("Assistant"),onClick:e.onToggleAssistant,children:"✦"}),s.jsxs("button",{className:"me",type:"button",title:`${e.me.email}${e.viewOnly?` · ${a("view only")}`:""} — ${a("Account settings")}`,"aria-label":a("Account settings"),onClick:()=>e.onTab("settings"),children:[s.jsx("span",{className:"me-initial","aria-hidden":"true",children:(e.me.name||e.me.email).slice(0,1).toUpperCase()}),e.viewOnly&&s.jsx("span",{className:"me-badge",children:a("view only")})]})]})]})}const Og="Orgamini",BI="0.1.1",PI="2026-09-24T18:21:24.958Z";function YI(){const{pending:e,answer:a}=G3(),l=qe(),i=N.useRef(null);return N.useEffect(()=>{if(!e)return;i.current?.focus();const r=u=>{u.key==="Escape"&&(u.stopPropagation(),a(!1))};return window.addEventListener("keydown",r,!0),()=>window.removeEventListener("keydown",r,!0)},[e]),e?s.jsx("div",{className:"modal-backdrop",onMouseDown:()=>a(!1),children:s.jsxs("div",{className:"modal",role:"alertdialog","aria-modal":"true","aria-describedby":"confirm-message",onMouseDown:r=>r.stopPropagation(),children:[s.jsx("p",{id:"confirm-message",className:"modal-message",children:e.message}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>a(!1),children:l("Cancel")}),s.jsx("button",{ref:i,type:"button",className:`btn ${e.danger?"danger":"primary"}`,onClick:()=>a(!0),children:l(e.okLabel??"OK")})]})]})}):null}function VI(){const{pending:e,answer:a}=q3(),l=qe(),[i,r]=N.useState("");
82if(N.useEffect(()=>{r(e?.value??"")},[e]),N.useEffect(()=>{if(!e)return;const d=h=>{h.key==="Escape"&&(h.stopPropagation(),a(null))};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[e]),!e)return null;const u=()=>a(i.trim()?i.trim():null);return s.jsx("div",{className:"modal-backdrop",onMouseDown:()=>a(null),children:s.jsxs("div",{className:"modal name-modal",role:"dialog","aria-modal":"true","aria-label":e.message,onMouseDown:d=>d.stopPropagation(),children:[s.jsxs("label",{className:"name-field",children:[s.jsx("span",{className:"nt-label",children:e.message}),s.jsx("input",{autoFocus:!0,value:i,maxLength:120,placeholder:e.placeholder,onChange:d=>r(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),u())}})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>a(null),children:l("Cancel")}),s.jsx("button",{type:"button",className:"btn primary",disabled:!i.trim(),onClick:u,children:l(e.okLabel??"Create")})]})]})})}function qI(){const{pending:e,answer:a}=V3(),l=qe(),[i,r]=N.useState(null),[u,d]=N.useState("");if(N.useEffect(()=>{r(null),d("")},[e]),N.useEffect(()=>{if(!e)return;const p=x=>{x.key==="Escape"&&(x.stopPropagation(),a(void 0))};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[e]),!e)return null;const h=u.trim().toLowerCase(),g=h?e.options.filter(p=>`${p.label} ${p.sub??""}`.toLowerCase().includes(h)):e.options;return s.jsx("div",{className:"modal-backdrop",onMouseDown:()=>a(void 0),children:s.jsxs("div",{className:"modal pick-modal",role:"dialog","aria-modal":"true",onMouseDown:p=>p.stopPropagation(),children:[s.jsx("p",{className:"modal-message",children:e.message}),e.label&&s.jsx("p",{className:"pick-label",children:e.label}),e.options.length>6&&s.jsx("input",{className:"pick-find",autoFocus:!0,value:u,placeholder:l("Search a person…"),onChange:p=>d(p.target.value)}),s.jsxs("div",{className:"pick-list",children:[e.noneLabel&&s.jsx("button",{type:"button",className:`pick-row none ${i===null?"on":""}`,onClick:()=>r(null),children:e.noneLabel}),g.map(p=>s.jsxs("button",{type:"button",className:`pick-row ${i===p.value?"on":""}`,onClick:()=>r(p.value),children:[s.jsx("span",{className:"pick-name",children:p.label}),p.sub&&s.jsx("span",{className:"pick-sub",children:p.sub})]},p.value)),!g.length&&s.jsx("p",{className:"hint pad",children:l("Nobody found")})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:()=>a(void 0),children:l("Cancel")}),s.jsx("button",{type:"button",className:`btn ${e.danger?"danger":"primary"}`,onClick:()=>a(i),children:l(e.okLabel??"OK")})]})]})})}function GI({people:e,departments:a,onPatchAll:l,onClear:i,marks:r}){const u=qe();if(e.length<2)return null;const d=e.every(g=>g.plannedOut),h=e.every(g=>g.underReview);return s.jsxs("div",{className:"bulk-bar",role:"toolbar","aria-label":"Selected people",children:[s.jsx("span",{className:"bulk-count",children:u("{n} selected",{n:e.length})}),s.jsx("span",{className:"toolbar-sep"}),r&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"tb",onClick:()=>l({plannedOut:!d}),title:u("What-if: mark all for dismissal / keep all"),children:u(d?"✓ Keep all":"✂ Dismiss all?")}),s.jsx("button",{type:"button",className:"tb",onClick:()=>l({underReview:!h}),title:u("Mark all as under review / decided"),children:u(h?"✓ Decided":"? Review all")})]}),a.length>0&&s.jsxs("select",{className:"bulk-select",value:"","aria-label":u("Move to department…"),onChange:g=>g.target.value&&l({departmentId:g.target.value==="none"?null:g.target.value}),children:[s.jsx("option",{value:"",children:u("Move to department…")}),a.map(g=>s.jsx("option",{value:g.id,children:g.name},g.id)),s.jsx("option",{value:"none",children:u("— no department —")})]}),s.jsx("span",{className:"toolbar-sep"}),s.jsx("button",{type:"button",className:"icon-btn",title:u("Clear selection (Esc)"),"aria-label":u("Clear selection"),onClick:i,children:"×"})]})}const Oi="orgami:collapsed",cd="orgami:collapsed-tree",Wr="orgami:hidden",ek="orgami:background",Fw="orgami:branch-dir",tk="orgami:anchors";function XI(){try{const e=localStorage.getItem(tk);return e?JSON.parse(e):{}}catch{return{}}}function Kw(e){try{localStorage.setItem(tk,JSON.stringify(e))}catch{}}function hp(e){try{return new Set(JSON.parse(localStorage.getItem(e)??"[]"))}catch{return new Set}}function zi(e,a){try{localStorage.setItem(e,JSON.stringify([...a]))}catch{}}function ud(e,a){try{localStorage.setItem(e,a)}catch{}}function ZI(){try{return localStorage.getItem(T1)==="ru"?"ru":"en"}catch{return"en"}}function FI(){try{const e=localStorage.getItem(ek);return sh.some(a=>a.value===e)?e:"dots"}catch{return"dots"}}function fp(e,a){const l=new Set(e);return l.has(a)?l.delete(a):l.add(a),l}function No(e,a,l){const i=new Set([...e].filter(r=>!a(r)));return i.size===e.size?e:(zi(l,i),i)}function Qw(e,a){const l=new Set,i=[...a];for(;i.length;){const r=i.pop();for(const u of e)u.managerIds.includes(r)&&!l.has(u.id)&&(l.add(u.id),i.push(u.id))}return l}function nk(e,a){const l=new Set;for(const i of e)(a.has(i.id)||[...a].some(r=>Gl(e,i.id,r)))&&l.add(i.id);return l}function KI(e,a,l){const i=nk(e,a);for(const r of e)!i.has(r.id)&&[...l].some(u=>u!==r.id&&Gl(e,r.id,u))&&i.add(r.id);return i}function QI(e){const a=new Map;for(const l of e){let i=l.parentId;const r=new Set;for(;i&&!r.has(i);)r.add(i),a.set(i,(a.get(i)??0)+1),i=e.find(u=>u.id===i)?.parentId??null}return a}function WI(e,a,l){const i=new Map(e.map(h=>[h.id,h])),r=new Map,u=new Set,d=h=>{const g=r.get(h);if(g!==void 0)return g;if(u.has(h))return!1;const p=i.get(h);u.add(h);let x;if(l.has(p.companyId)||a.has(p.companyId)||p.departmentId&&a.has(p.departmentId))x=!0;
82else{const m=p.managerIds.map(v=>i.get(v)).filter(v=>!!v&&v.companyId===p.companyId&&(v.departmentId??null)===(p.departmentId??null));x=m.length>0&&m.every(v=>a.has(v.id)||d(v.id))}return u.delete(h),r.set(h,x),x};return new Set(e.filter(h=>d(h.id)).map(h=>h.id))}function JI(e,a,l,i,r){const u=new Set,d=new Map(e.map(g=>[g.id,g])),h=(g,p=0)=>{if(u.has(g.id)||i.has(g.companyId)||l.has(g.companyId))return!0;const x=yc(g,a);if(x===g.companyId)return!1;if(l.has(x)||r.has(x))return!0;const m=d.get(x);return!!m&&p<50&&h(m,p+1)};for(const g of e)h(g)&&u.add(g.id);return u}function ez(e,a,l){if(a.size===0)return e;const i=new Set(e);for(const r of l)r.departmentId&&a.has(r.departmentId)&&i.add(r.id);return i}function tz(e){const a=new Map;for(const l of e)a.set(l.companyId,(a.get(l.companyId)??0)+1);return a}function nz(e,a){const l=new Map;for(const i of e){if(i.plannedOut)continue;const r=un(i,a);r&&l.set(i.companyId,(l.get(i.companyId)??0)+r)}return l}function Ww(e,a){const l=new Map;for(const i of e){let r=0;for(const u of e)(u.id===i.id||Gl(e,u.id,i.id))&&(r+=a.get(u.id)??0);l.set(i.id,r)}return l}function az(e,a,l,i){const r=(u,d)=>[...new Set([...u,...d].map(h=>h.trim()).filter(Boolean))].sort((h,g)=>h.localeCompare(g));return{tags:r(e.tags,a.flatMap(u=>u.tags)),titles:r(e.titles,i.map(u=>u.title)),departments:r(e.departments,l.map(u=>u.name))}}function sz(e,a,l,i){const r=x=>{const m=new Map;for(const v of x)v&&m.set(v,(m.get(v)??0)+1);return m},u=r(a.flatMap(x=>x.tags)),d=r(i.map(x=>x.title)),h=new Map(l.map(x=>[x.id,x.name])),g=r(i.map(x=>x.departmentId&&h.get(x.departmentId)||"")),p=(x,m)=>e[x].map(v=>({value:v,used:m.get(v)??0}));return{tags:p("tags",u),titles:p("titles",d),departments:p("departments",g)}}function lz(e,a,l){const i=e.filter(u=>u.plannedOut),r=i.reduce((u,d)=>u+un(d,a),0);return{count:i.length,savingMonth:l?"":yt(r),savingYear:l?"":yt(r*12)}}function ko(e,a,l){const i=new Map;for(const r of e){const u=a(r),d=l(r);u&&d&&i.set(u,(i.get(u)??0)+d)}return i}function oz(e,a){const{companies:l,departments:i,people:r,rates:u,collapsed:d,treeCollapsed:h,descendantCount:g,hiddenCompanies:p,hiddenDepartments:x,hiddenPeople:m,peopleCount:v}=a,k=new Map;for(const H of l)H.parentId&&k.set(H.parentId,(k.get(H.parentId)??0)+1);const T=new Map;for(const H of r)for(const P of H.managerIds)T.set(P,(T.get(P)??0)+1);const S=H=>un(H,u),C=()=>1,z=ko(r,H=>H.companyId,S),E=ko(r,H=>H.companyId,H=>H.plannedOut?0:S(H)),j=ko(r,H=>H.companyId,H=>H.plannedOut?1:0),O=ko(r,H=>H.departmentId,C),w=ko(r,H=>H.departmentId,S),b=ko(r,H=>H.departmentId,H=>H.plannedOut?0:S(H)),A=ko(r,H=>H.departmentId,H=>H.plannedOut?1:0),D=new Map(l.map(H=>[H.id,H.color])),M=new Map(r.map(H=>[H.id,H])),U=new Set(i.map(H=>H.id)),Y=new Map(l.map(H=>[H.id,H.name])),q=new Map(i.map(H=>[H.id,H.name])),W=H=>{const P=new Map;for(const R of r)if(!(R.departmentId!==H.id||Ld(R,r)))for(const Q of R.managerIds){const le=M.get(Q);le&&le.departmentId!==H.id&&P.set(Q,(P.get(Q)??0)+1)}const X=[...P.entries()].sort((R,Q)=>Q[1]-R[1])[0],ne=X&&M.get(X[0]);if(!ne)return null;const pe=ne.companyId!==H.companyId?Y.get(ne.companyId)??"":ne.departmentId?q.get(ne.departmentId)??"":"";return{person:ne,where:pe}},L=new Map(e.map(H=>[H.id,H])),V=(H,P,X)=>{const ne=L.get(H);return{position:ne?.dragging?ne.position:{x:P,y:X},dragging:ne?.dragging,selected:ne?.selected,measured:ne?.measured}},I=l.map(H=>({id:H.id,type:"company",zIndex:1,hidden:p.has(H.id),...V(H.id,H.x,H.y),data:{...H,childCount:k.get(H.id)??0,peopleCount:v.get(H.id)??0,payrollUsd:z.get(H.id)??0,payrollAfterUsd:E.get(H.id)??0,cutCount:j.get(H.id)??0,collapsed:d.has(H.id),treeCollapsed:h.has(H.id),descendantCount:g.get(H.id)??0,lead:H.leadId&&M.get(H.leadId)||null}})),F=i.map(H=>({id:H.id,type:"department",zIndex:2,parentId:H.companyId,hidden:x.has(H.id),...V(H.id,H.x,H.y),data:{...H,head:H.headId&&M.get(H.headId)||null,managedBy:H.headId?null:W(H),peopleCount:O.get(H.id)??0,payrollUsd:w.get(H.id)??0,payrollAfterUsd:b.get(H.id)??0,cutCount:A.get(H.id)??0,collapsed:d.has(H.id),companyColor:D.get(H.companyId)??null}})),_=r.map(H=>({id:H.id,type:"person",zIndex:3,parentId:H.departmentId&&U.has(H.departmentId)?H.departmentId:H.companyId,hidden:m.has(H.id),...V(H.id,H.x,H.y),data:{...H,departmentName:H.departmentId&&q.get(H.departmentId)||"",outside:H.managerIds.map(P=>M.get(P)).filter(P=>!!P&&(P.companyId!==H.companyId||(P.departmentId??null)!==(H.departmentId??null))).map(P=>({name:P.fullName,where:P.companyId!==H.companyId?Y.get(P.companyId)??"":P.departmentId?q.get(P.departmentId)??"":"staff"})),color:D.get(H.companyId)??null,reportCount:T.get(H.id)??0,collapsed:d.has(H.id)}}));return[...I,...F,..._]}const dd={width:280,height:120},Jw={width:260,height:56},hd={width:240,height:56};
82function iz(e){const{companies:a,departments:l,people:i,dir:r,hiddenCompanies:u,hiddenDepartments:d,hiddenPeople:h,selectedId:g,selectedPersonId:p,selectedEdgeIds:x,selectedNodeIds:m,measured:v,anchors:k}=e,T=new Set(i.map(M=>M.id)),S=new Map(a.map(M=>[M.id,M])),C=new Map(i.map(M=>[M.id,M])),z=new Map(l.map(M=>[M.id,M])),E=(M,U,Y)=>{if(r!=="down")return;const q=v(M.id,dd);let W=M.x,L=M.x+q.width,V=M.y+q.height,I=!1;for(const H of l){if(H.companyId!==M.id||d.has(H.id))continue;const P=v(H.id,Jw);W=Math.min(W,M.x+H.x),L=Math.max(L,M.x+H.x+P.width),V=Math.max(V,M.y+H.y+P.height),I=!0}for(const H of i){if(H.companyId!==M.id||h.has(H.id))continue;const P=H.departmentId&&z.get(H.departmentId)?z.get(H.departmentId):{x:0,y:0},X=v(H.id,hd),ne=M.x+P.x+H.x,pe=M.y+P.y+H.y;W=Math.min(W,ne),L=Math.max(L,ne+X.width),V=Math.max(V,pe+X.height),I=!0}if(!I||U.y<V)return;const _=U.x+v(U.id,dd).width/2<Y;return{side:_?"left":"right",x:_?W-24:L+24}},j=M=>{const U=S.get(M.companyId),Y=M.departmentId?z.get(M.departmentId):void 0;return(U?.x??0)+(Y?.x??0)+M.x+v(M.id,hd).width/2},O=[];for(const M of a){if(!M.parentId)continue;const U=S.get(M.parentId),Y=M.leadId?C.get(M.leadId):void 0,q=!!Y&&Y.companyId===M.parentId&&!h.has(Y.id),W=U&&!k(M.id,M.link).from?E(U,M,q?j(Y):U.x+v(U.id,dd).width/2):void 0,L=bd(k(M.id,M.link),"company",r);O.push({id:`${M.parentId}->${M.id}`,source:q?Y.id:M.parentId,sourceHandle:vd(W?q?"bottom":W.side:L.from),target:M.id,targetHandle:xd(L.to),type:"link",hidden:u.has(M.id)||u.has(M.parentId),data:{kind:"company",ownerId:M.id,link:M.link,hl:M.id===g||M.parentId===g||!!p&&M.leadId===p,via:W?{x:W.x,drop:q?20:0}:void 0,lead:q,tint:M.color??U?.color??null}})}const w=new Map;{const M=i.filter(Y=>i.some(q=>q.managerIds.includes(Y.id))),U=new Map;for(const Y of M){const q=Y.departmentId??Y.companyId;U.set(q,[...U.get(q)??[],Y])}for(const Y of U.values())Y.sort((q,W)=>q.x-W.x||q.y-W.y),Y.forEach((q,W)=>w.set(q.id,Rs[W%Rs.length].value))}const b=M=>M.color??S.get(M.companyId)?.color??null,A=M=>{if(d.has(M.id))return null;const U=S.get(M.companyId);if(!U)return null;const Y=v(M.id,Jw),q={left:U.x+M.x,right:U.x+M.x+Y.width,top:U.y+M.y,bottom:U.y+M.y+Y.height};for(const W of i){if(W.departmentId!==M.id||h.has(W.id))continue;const L=v(W.id,hd);q.left=Math.min(q.left,U.x+M.x+W.x),q.right=Math.max(q.right,U.x+M.x+W.x+L.width),q.bottom=Math.max(q.bottom,U.y+M.y+W.y+L.height)}for(const W of l){if(W.parentId!==M.id)continue;const L=A(W);L&&(q.left=Math.min(q.left,L.left),q.right=Math.max(q.right,L.right),q.bottom=Math.max(q.bottom,L.bottom))}return q};for(const M of l){const U=bd(k(M.id,M.link),"department",r),Y=yc(M,i);let q,W=null;const L=A(M);if(r==="down"&&L&&!k(M.id,M.link).from){const V=l.filter(I=>I.id!==M.id&&yc(I,i)===Y).map(A).filter(I=>!!I&&I.bottom<=L.top-8&&I.right>L.left-1&&I.left<L.right+1);if(V.length){const I=Math.min(...V.map(X=>X.left)),F=Math.max(...V.map(X=>X.right)),_=C.get(Y),H=_?(S.get(_.companyId)?.x??0)+_.x+v(Y,hd).width/2:(S.get(Y)?.x??0)+v(Y,dd).width/2,P=(L.left+L.right)/2<H;q={x:P?I-24:F+24,drop:_?20:0},W=_?"bottom":P?"left":"right"}}O.push({id:`d:${Y}->${M.id}`,source:Y,sourceHandle:vd(W??U.from),target:M.id,targetHandle:xd(U.to),type:"link",hidden:d.has(M.id),deletable:!1,reconnectable:!1,data:{kind:"department",ownerId:M.id,link:M.link,hl:M.companyId===g,tint:b(M),via:q}})}const D=new Set(l.map(M=>M.id));for(const M of i){const U=M.managerIds.filter(V=>T.has(V)),Y=M.departmentId&&D.has(M.departmentId)?M.departmentId:M.companyId,q=U.filter(V=>C.get(V).companyId===M.companyId&&(C.get(V).departmentId??null)===(M.departmentId??null)),W=q.length?U:[Y,...U],L=bd(k(M.id,M.link),"person",r);for(const V of W){const I=V===Y,F=!I&&!q.includes(V);O.push({id:`p:${V}->${M.id}`,source:V,sourceHandle:vd(L.from),target:M.id,targetHandle:xd(L.to),type:"link",hidden:h.has(M.id)||!I&&h.has(V)||F&&!m.has(V)&&!m.has(M.id)&&p!==V&&p!==M.id,deletable:V!==M.companyId,reconnectable:V!==M.companyId,data:{kind:"person",ownerId:M.id,link:M.link,hl:M.companyId===g,cross:F,tint:I?M.departmentId&&z.get(M.departmentId)?b(z.get(M.departmentId)):S.get(M.companyId)?.color??null:w.get(V)??null}})}}return O.map(M=>({...M,selected:x.has(M.id)}))}let Xp=null,il=[],rz=0;const ak=()=>Xp?.(il);function oc(e,a,l=10){il=[...il,{id:++rz,message:e,undo:a,seconds:l}],ak()}function sk(e){const a=e===void 0?il[il.length-1]:il.find(l=>l.id===e);return a?(Zp(a.id),a.undo(),!0):!1}function Zp(e){il=il.filter(a=>a.id!==e),ak()}function cz(){const[e,a]=N.useState(il);return N.useEffect(()=>(Xp=a,()=>{Xp=null}),[]),e}function uz(){const e=cz();return e.length?s.jsx("div",{className:"undo-stack",children:e.map(a=>s.jsx(dz,{offer:a},a.id))}):null}function dz({offer:e}){const a=qe(),[l,i]=N.useState(1);return N.useEffect(()=>{const r=Date.now(),u=e.seconds*1e3,d=window.setInterval(()=>{const h=Math.max(0,1-(Date.now()-r)/u);
82i(h),h===0&&Zp(e.id)},100);return()=>window.clearInterval(d)},[e.id,e.seconds]),s.jsxs("div",{className:"undo-bar",role:"status","aria-live":"polite",children:[s.jsx("span",{className:"undo-what",children:e.message}),s.jsxs("button",{type:"button",className:"undo-take",onClick:()=>sk(e.id),children:[a("Undo"),s.jsx("span",{className:"undo-key",children:"Ctrl+Z"})]}),s.jsx("span",{className:"undo-left","aria-hidden":"true",children:Math.ceil(l*e.seconds)}),s.jsx("button",{type:"button",className:"undo-close",title:a("Close"),onClick:()=>Zp(e.id),children:"×"}),s.jsx("span",{className:"undo-time",style:{"--left":l},"aria-hidden":"true"})]})}function hz({me:e}){const a=qe(),[l,i]=N.useState(!1);if(!e.impersonator)return null;const r=async()=>{i(!0);try{await Se.stopImpersonating(),localStorage.setItem(Gp,"users")}catch{}window.location.assign("/settings")};return s.jsxs("div",{className:"impersonation-bar",role:"status",children:[s.jsxs("span",{className:"impersonation-what",children:[a("You are signed in as {who}",{who:e.name?`${e.name} · ${e.email}`:e.email}),s.jsxs("span",{className:"impersonation-role",children:[" · ",Yd(e)?a("sees everything"):a("sees own work and department")]})]}),s.jsx("button",{type:"button",className:"impersonation-back",onClick:r,disabled:l,title:e.impersonator.name?`${e.impersonator.name} · ${e.impersonator.email}`:e.impersonator.email,children:a("Back to my account")})]})}const lk=["salary","salaryCurrency","sharePctMin","sharePctMax"],ej=e=>{const a={...e};for(const l of lk)delete a[l];return a},mp=(e,a,l=[])=>Object.keys(e).every(i=>l.includes(i)||JSON.stringify(e[i])===JSON.stringify(a[i]));function fz({companiesRef:e,departmentsRef:a,peopleRef:l,setCompanies:i,setDepartments:r,setPeople:u,setStatus:d,fail:h}){const g=N.useRef([]),p=N.useRef([]),x=N.useRef(0),m=N.useRef(!1),v=()=>({companies:e.current.map(E=>({...E})),departments:a.current.map(E=>({...E})),people:l.current.map(E=>({...E}))}),k=N.useCallback(()=>{if(m.current)return;const E=Date.now();E-x.current<1e3&&g.current.length||(x.current=E,g.current.push(v()),g.current.length>50&&g.current.shift(),p.current=[])},[]),T=()=>Promise.all([Se.listCompanies(),Se.listDepartments(),Se.listPeople()]).then(([E,j,O])=>{i(E),r(j),u(O)}),S=N.useCallback(async E=>{m.current=!0;try{const j=new Map(e.current.map(M=>[M.id,M])),O=new Map(a.current.map(M=>[M.id,M])),w=new Map(l.current.map(M=>[M.id,M])),b=new Map(E.companies.map(M=>[M.id,M])),A=new Map(E.departments.map(M=>[M.id,M])),D=new Map(E.people.map(M=>[M.id,M]));for(const M of w.values())D.has(M.id)||await Se.deletePerson(M.id);for(const M of O.values())A.has(M.id)||await Se.deleteDepartment(M.id);for(const M of j.values())b.has(M.id)||await Se.deleteCompany(M.id);for(const M of E.companies)j.has(M.id)||await Se.createCompany({...M,parentId:null,leadId:null});for(const M of E.departments)O.has(M.id)||await Se.createDepartment({...M,parentId:null,headId:null});for(const M of E.people)w.has(M.id)||await Se.createPerson({...ej(M),managerIds:[],departmentId:null,photoVersion:null});for(const M of E.companies){const U=j.get(M.id);(!U||!mp(M,U))&&await Se.updateCompany(M.id,M)}for(const M of E.departments){const U=O.get(M.id),{companyId:Y,...q}=M;(!U||!mp(M,U))&&await Se.updateDepartment(M.id,q)}for(const M of E.people){const U=w.get(M.id),{photoVersion:Y,...q}=ej(M);(!U||!mp(M,U,["photoVersion",...lk]))&&await Se.updatePerson(M.id,q)}return await T(),!0}catch(j){return h(j),T().catch(()=>{}),!1}finally{m.current=!1}},[]),C=N.useCallback(async()=>{const E=g.current.pop();if(!E)return d("Nothing to undo");p.current.push(v()),await S(E)&&d("Undone")},[S]),z=N.useCallback(async()=>{const E=p.current.pop();if(!E)return d("Nothing to redo");g.current.push(v()),await S(E)&&d("Redone")},[S]);return N.useEffect(()=>{const E=j=>{if(!(!(j.ctrlKey||j.metaKey)||Dg(j.target)))if(ql(j,"z")&&!j.shiftKey){if(j.preventDefault(),sk())return;C()}else(ql(j,"z")&&j.shiftKey||ql(j,"y"))&&(j.preventDefault(),z())};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[C,z]),{remember:k,undo:C,redo:z}}function mz(e,a,l,i){const{getNodes:r,getIntersectingNodes:u,screenToFlowPosition:d}=Zi(),[h,g]=N.useState(null);return N.useEffect(()=>{const p=e.current;
82if(!p)return;let x=null;const m=S=>{const C=p.getBoundingClientRect();return{x:S.clientX-C.left,y:S.clientY-C.top}},v=S=>{S.button!==2||S.pointerType!=="mouse"||(x=m(S),S.preventDefault())},k=S=>{x&&g(op(x,m(S)))},T=S=>{if(!x)return;const C=op(x,m(S));if(x=null,g(null),C.width<4&&C.height<4)return;const z=p.getBoundingClientRect(),E=d({x:z.left+C.x,y:z.top+C.y}),j=d({x:z.left+C.x+C.width,y:z.top+C.y+C.height}),O=new Set(u(op(E,j),!0).filter(w=>!w.hidden).map(w=>w.id));l(r().map(w=>({type:"select",id:w.id,selected:O.has(w.id)}))),i()};return p.addEventListener("pointerdown",v),window.addEventListener("pointermove",k),window.addEventListener("pointerup",T),()=>{p.removeEventListener("pointerdown",v),window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",T)}},[e,a,u,r,l,d,i]),h}function pz(e){const[a,l]=N.useState(!!document.fullscreenElement);N.useEffect(()=>{const r=navigator.keyboard,u=()=>{const d=!!document.fullscreenElement;l(d),d?r?.lock?.(["Escape"]).catch(()=>{}):r?.unlock?.()};return document.addEventListener("fullscreenchange",u),()=>document.removeEventListener("fullscreenchange",u)},[]);const i=N.useCallback(()=>{document.fullscreenElement?document.exitFullscreen().catch(r=>e(r instanceof Error?r.message:"Something went wrong")):document.documentElement.requestFullscreen().catch(()=>e("Fullscreen is not available here"))},[e]);return{fullscreen:a,toggle:i}}function tj({base:e,setStatus:a,fail:l}){const i=N.useMemo(()=>Se.holders(e),[e]),[r,u]=N.useState([]),d=N.useCallback(()=>i.list().then(u),[i]),h=N.useCallback(w=>{l(w),d().catch(()=>{})},[l,d]),g=(w,b)=>u(A=>A.map(D=>D.id===w?b(D):D)),p=N.useCallback(async w=>{try{const b=await i.create(w);return u(A=>[...A,b]),a("Added"),b}catch(b){return l(b),null}},[l,a]),x=N.useCallback(async(w,b)=>{g(w,A=>({...A,...b}));try{const A=await i.update(w,b);g(w,()=>A),a("Saved")}catch(A){h(A)}},[h,a]),m=N.useCallback(async w=>{try{await i.remove(w),u(b=>b.filter(A=>A.id!==w&&A.parentId!==w)),a("Deleted")}catch(b){h(b)}},[h,a]),v=N.useCallback(async w=>{try{const b=await i.close(w);return u(A=>A.map(D=>D.id===w?b:D.parentId===w?{...D,closedOn:b.closedOn}:D)),a("Closed the project"),{ok:!0}}catch(b){const A=b instanceof ah&&b.status===409?b.data.open:void 0;return A?{ok:!1,open:A}:(h(b),{ok:!1,open:[]})}},[h,a]),k=N.useCallback(async w=>{try{const b=await i.reopen(w);u(A=>A.map(D=>D.id===w?b:D.parentId===w?{...D,closedOn:null}:D)),a("Reopened")}catch(b){h(b)}},[h,a]),T=N.useCallback(async(w,b)=>{try{const A=await i.createArea(w,b);return g(w,D=>({...D,areas:[...D.areas,A]})),a("Added"),A}catch(A){return h(A),null}},[h,a]),S=N.useCallback(async(w,b,A)=>{g(w,D=>({...D,areas:D.areas.map(M=>M.id===b?{...M,...A}:M)}));try{const D=await i.updateArea(w,b,A);g(w,M=>({...M,areas:M.areas.map(U=>U.id===b?D:U)})),a("Saved")}catch(D){h(D)}},[h,a]),C=N.useCallback(async(w,b)=>{try{await i.deleteArea(w,b),g(w,A=>({...A,areas:A.areas.filter(D=>D.id!==b),members:A.members.map(D=>({...D,areas:D.areas.filter(M=>M.areaId!==b)}))})),a("Deleted")}catch(A){h(A)}},[h,a]),z=N.useCallback(async(w,b)=>{try{const A=await i.createMember(w,b);return g(w,D=>({...D,members:[...D.members,A]})),a("Added"),A}catch(A){return h(A),null}},[h,a]),E=N.useCallback(async(w,b,A)=>{g(w,D=>({...D,members:D.members.map(M=>M.id===b?{...M,...A}:M)}));try{const D=await i.updateMember(w,b,A);g(w,M=>({...M,members:M.members.map(U=>U.id===b?D:U)})),a("Saved")}catch(D){h(D)}},[h,a]),j=N.useCallback(async(w,b)=>{try{await i.deleteMember(w,b),g(w,A=>({...A,members:A.members.filter(D=>D.id!==b)})),a("Removed")}catch(A){h(A)}},[h,a]),O=N.useMemo(()=>({createProject:p,patchProject:x,deleteProject:m,closeProject:v,reopenProject:k,addArea:T,patchArea:S,deleteArea:C,addMember:z,patchMember:E,removeMember:j}),[p,x,m,v,k,T,S,C,z,E,j]);return{projects:r,load:d,actions:O}}function gz({setStatus:e,fail:a}){const[l,i]=N.useState([]),r=N.useRef([]);r.current=l;const u=qe(),[d,h]=N.useState([]),g=N.useCallback(async()=>{const[b,A]=await Promise.all([Se.listTasks(),Se.listTaskGroups()]);i(b),h(A)},[]),p=N.useCallback(b=>{a(b),g().catch(()=>{})},[a,g]),x=N.useCallback(async b=>{try{const A=await Se.createTask(b);return i(D=>[...D,A]),e("Added"),A}catch(A){return a(A),null}},[a,e]),m=N.useCallback(async(b,A)=>{i(D=>D.map(M=>M.id===b?{...M,...A}:M));try{const D=await Se.updateTask(b,A);i(M=>M.map(U=>U.id===b?D:U)),e("Saved")}catch(D){if(D instanceof ah&&D.data.needEstimate){const M=await us(u("How long will it take, in working days?"),{placeholder:u("for example 0.5 or 3"),okLabel:"Start"}),U=M===null?null:Number(M.replace(",","."));if(U!==null&&Number.isFinite(U)&&U>0)return v.current(b,{...A,effortDays:U})}p(D)}},[p,e,u]),v=N.useRef(m);v.current=m;const k=N.useCallback(async(b,A="done",D)=>{try{const M=await Se.taskDone(b,{state:A,...D?{on:D}:{}}
82);i(U=>U.map(Y=>Y.id===b?M:Y)),e(M.kind==="once"?"Done":A==="skipped"?"Skipped this time":"Done for this time round")}catch(M){p(M)}},[p,e]),T=N.useCallback(async(b,A)=>{try{const D=await Se.taskTimer(b,A);i(M=>M.map(U=>U.id===b?{...U,...D}:U)),e(A?"The clock is running":"The clock is paused")}catch(D){p(D)}},[p,e]),S=N.useCallback(async(b,A)=>{try{const D=await Se.taskUndo(b,A);i(M=>M.map(U=>U.id===b?D:U)),e("Taken back")}catch(D){p(D)}},[p,e]),C=N.useCallback(b=>i(A=>A.map(D=>D.id===b.id?b:D)),[]),z=N.useMemo(()=>({addCheck:(b,A)=>Se.addTaskCheck(b,A).then(C,a),patchCheck:(b,A,D)=>Se.patchTaskCheck(b,A,D).then(C,a),removeCheck:(b,A)=>Se.deleteTaskCheck(b,A).then(C,a),link:(b,A,D)=>Se.linkTask(b,A,D).then(C,a),unlink:(b,A)=>Se.unlinkTask(b,A).then(C,a),addFile:async(b,A)=>{await Se.pinTaskFile(b,A),await g()},removeFile:(b,A)=>Se.unpinTaskFile(b,A).then(C,a),reorder:async b=>{i(A=>{const D=new Map(b.map((M,U)=>[M,U]));return[...A].sort((M,U)=>(D.get(M.id)??M.position)-(D.get(U.id)??U.position))});try{await Se.orderTasks(b)}catch(A){a(A),await g()}},addGroup:async b=>{try{const A=await Se.createTaskGroup(b);return h(D=>[...D,A]),A}catch(A){return a(A),null}},renameGroup:(b,A)=>Se.renameTaskGroup(b,A).then(D=>h(M=>M.map(U=>U.id===b?D:U)),a),removeGroup:async b=>{try{await Se.deleteTaskGroup(b),h(A=>A.filter(D=>D.id!==b)),i(A=>A.map(D=>D.groupIds.includes(b)?{...D,groupIds:D.groupIds.filter(M=>M!==b)}:D))}catch(A){a(A)}}}),[a,g,C]),E=N.useCallback(b=>{i(A=>A.map(D=>D.areaIds.includes(b)?{...D,areaIds:D.areaIds.filter(M=>M!==b)}:D))},[]),j=N.useCallback(async b=>{const A=r.current.find(D=>D.id===b);try{await Se.deleteTask(b),i(D=>D.filter(M=>M.id!==b&&M.parentId!==b)),oc(u("Deleted: {what}",{what:A?.title||u("Task")}),async()=>{try{await Se.restoreTask(b),await g(),e("Restored")}catch(D){p(D)}})}catch(D){p(D)}},[p,e,g,u]),O=N.useCallback(async b=>{const A=b.filter(D=>r.current.some(M=>M.id===D));if(A.length)try{for(const D of A)await Se.deleteTask(D);i(D=>D.filter(M=>!A.includes(M.id)&&!(M.parentId&&A.includes(M.parentId)))),oc(u("Deleted tasks: {n}",{n:A.length}),async()=>{try{for(const D of A)await Se.restoreTask(D);await g(),e("Restored")}catch(D){p(D)}})}catch(D){p(D)}},[p,e,g,u]),w=N.useMemo(()=>({create:x,patch:m,done:k,undo:S,remove:j,removeMany:O,forgetArea:E,timer:T,...z}),[x,m,k,S,j,O,E,T,z]);return{tasks:l,groups:d,load:g,actions:w}}const yz=3e4,xz=()=>new Date().toISOString().slice(0,10),vz=()=>new Date(Date.now()+864e5).toISOString().slice(0,10);function bz(e,a){const[l,i]=N.useState([]),r=N.useRef(l);r.current=l;const u=N.useCallback(async()=>{try{const{items:m}=await Se.notices();i(m)}catch{}},[]);N.useEffect(()=>{u();const m=window.setInterval(()=>{document.hidden||u()},yz),v=()=>!document.hidden&&u();return document.addEventListener("visibilitychange",v),window.addEventListener("focus",v),()=>{window.clearInterval(m),document.removeEventListener("visibilitychange",v),window.removeEventListener("focus",v)}},[u]);const d=N.useMemo(()=>{if(!a)return[];const m=xz(),v=vz(),k=[];for(const S of e){if(S.assigneeId!==a&&!S.people.some(z=>z.personId===a)||S.state==="done"&&S.kind==="once")continue;const C=S.kind==="recurring"?S.nextDue:S.dueOn;S.late?k.push({id:`late:${S.id}`,kind:"late",taskId:S.id,title:S.title,on:C??""}):C===m?k.push({id:`today:${S.id}`,kind:"today",taskId:S.id,title:S.title,on:C}):C===v&&k.push({id:`soon:${S.id}`,kind:"tomorrow",taskId:S.id,title:S.title,on:C})}const T={late:0,today:1,tomorrow:2};return k.sort((S,C)=>T[S.kind]-T[C.kind])},[e,a]),h=N.useMemo(()=>l.filter(m=>!m.read),[l]),g=d.length+h.length,p=N.useCallback(m=>{const v=r.current.filter(k=>k.taskId===m&&!k.read).map(k=>k.id);v.length&&(i(k=>k.map(T=>v.includes(T.id)?{...T,read:!0}:T)),Se.readNotices(v).catch(()=>{}))},[]),x=N.useCallback(()=>{i(m=>m.map(v=>v.read?v:{...v,read:!0})),Se.readAllNotices().catch(()=>{})},[]);return{items:l,due:d,unread:h.length,count:g,markRead:p,markAllRead:x,reload:u}}const Va={proot:{w:320,h:92},pmember:{w:300,h:74},pzone:{w:260,h:46},ppart:{w:300,h:68}},wz=e=>48+19*(e===0?1:Math.min(e,3)+(e>3?1:0));function jz({data:e}){const a=qe();return s.jsxs("div",{className:"pnode proot",children:[s.jsxs("div",{className:"pnode-kind",children:[e.partOf?`${e.partOf} ›`:a("Project")," · ",e.owner||a("no owner")]}),s.jsx("div",{className:"pnode-title",children:e.name}),s.jsxs("div",{className:"pnode-sub",children:[e.lead?s.jsxs(s.Fragment,{children:[s.jsx(Xe,{person:e.lead,size:18})," ",a("Run by {name}",{name:e.lead.fullName})]}):a("No project lead yet")," · ",a.n(e.people,"person","people")]}),s.jsx(hs,{type:"source",position:Ye.Right,id:"out"})]})}function Nz({data:e,selected:a}){const l=qe(),i=e.person;return s.jsxs("div",{className:`pnode pmember ${e.selected?"on":""} ${e.lead?"lead":""} ${i.plannedOut?"out":""} ${i.underReview?"review":""}`,children:[s.jsxs(nh,{isVisible:a,position:Ye.Top,className:"toolbar",offset:6,children:[s.jsx("button",{type:"button",className:`tb ${i.plannedOut?"on":""}`,title:i.plannedOut?l("Keep this person (clear the mark)"):l("What-if: a possible dism
82issal — stays on the map, out of the totals"),onClick:()=>e.onMark({plannedOut:!i.plannedOut}),children:i.plannedOut?l("✓ Keep"):l("✂ Dismiss?")}),s.jsx("button",{type:"button",className:`tb ${i.underReview?"on":""}`,title:i.underReview?l("Decided: remove the question mark"):l("Under review: not sure yet whether this person is needed"),onClick:()=>e.onMark({underReview:!i.underReview}),children:"?"})]}),s.jsx(hs,{type:"target",position:Ye.Left,id:"in"}),i.plannedOut&&s.jsx("span",{className:"out-badge",title:l("A possible dismissal (what-if)"),children:l("dismissal")}),!i.plannedOut&&i.underReview&&s.jsx("span",{className:"out-badge review",title:l("Under review: is this person needed?"),children:"?"}),s.jsxs("div",{className:"pmember-head",children:[s.jsx(Xe,{person:e.person,size:28}),s.jsx("span",{className:"pnode-title",children:e.person.fullName})]}),s.jsxs("div",{className:"pmember-zones",title:[...e.owns.map(r=>`★ ${r}`),...e.works].join(`
83`),children:[[...e.owns.map(r=>({n:r,owns:!0})),...e.works.map(r=>({n:r,owns:!1}))].slice(0,3).map(({n:r,owns:u})=>s.jsxs("span",{className:`zone-chip ${u?"owns":""}`,children:[u?"★ ":"",r]},r)),e.owns.length+e.works.length>3&&s.jsxs("span",{className:"zone-chip more",children:["+",e.owns.length+e.works.length-3]}),e.owns.length===0&&e.works.length===0&&s.jsx("span",{className:"zone-chip none",children:l("no area")})]}),s.jsx(hs,{type:"source",position:Ye.Right,id:"out"})]})}function kz({data:e}){const a=qe();return s.jsxs("div",{className:"pnode pzone",onDoubleClick:e.onOpen,children:[s.jsx(hs,{type:"target",position:Ye.Left,id:"in"}),s.jsx("span",{className:"pnode-title",children:e.name}),s.jsx("span",{className:"matrix-warn",children:a("no owner")})]})}function Sz({data:e}){const a=qe();return s.jsxs("div",{className:"pnode ppart",onClick:e.onOpen,onDoubleClick:e.onOpen,title:a("Open"),children:[s.jsx(hs,{type:"target",position:Ye.Left,id:"in"}),s.jsx("div",{className:"pnode-title",children:e.name}),s.jsxs("div",{className:"pnode-sub",children:[e.lead?s.jsxs(s.Fragment,{children:[s.jsx(Xe,{person:e.lead,size:18})," ",e.lead.fullName," ·"," "]}):null,a.n(e.people,"person","people")," · ",a.n(e.areas,"area","areas")]})]})}const Cz={proot:jz,pmember:Nz,pzone:kz,ppart:Sz};function Ez(e,a,l,i,r,u,d,h,g,p){const x=new sc.graphlib.Graph;x.setGraph({rankdir:"LR",nodesep:14,ranksep:56,marginx:20,marginy:20}),x.setDefaultEdgeLabel(()=>({}));const m=[],v=[],k=new Map(e.areas.map(C=>[C.id,C.name]));m.push({id:"root",type:"proot",position:{x:0,y:0},draggable:!1,data:{name:e.name,owner:i.find(C=>C.id===e.ownerCompanyId)?.name??"",lead:$n(e)&&r.get($n(e))||null,people:e.members.length,partOf:l?.name??""}}),x.setNode("root",{width:Va.proot.w,height:Va.proot.h});const T=new Map(e.members.map(C=>[C.personId,C])),S=C=>r.get(C)?.managerIds.find(z=>T.has(z)&&z!==C)??null;for(const C of e.members){const z=r.get(C.personId);if(!z)continue;const E=S(C.personId),j=E?`m:${T.get(E).id}`:"root";m.push({id:`m:${C.id}`,type:"pmember",position:{x:C.x??0,y:C.y??0},data:{person:z,owns:C.areas.filter(O=>O.kind==="owns").map(O=>k.get(O.areaId)??"").filter(Boolean),works:C.areas.filter(O=>O.kind==="works").map(O=>k.get(O.areaId)??"").filter(Boolean),lead:$n(e)===C.personId,selected:C.id===u,onMark:O=>p(C.personId,O)}}),x.setNode(`m:${C.id}`,{width:Va.pmember.w,height:wz(C.areas.length)}),v.push({id:`e:${j}->m:${C.id}`,source:j,target:`m:${C.id}`,type:"smoothstep",deletable:!1,reconnectable:!1,className:"pedge",data:{memberId:C.id}}),x.setEdge(j,`m:${C.id}`)}for(const C of e.areas)e.members.some(z=>z.areas.some(E=>E.areaId===C.id&&E.kind==="owns"))||(m.push({id:`a:${C.id}`,type:"pzone",position:{x:C.x??0,y:C.y??0},data:{name:C.name,onOpen:()=>h(C.id)}}),x.setNode(`a:${C.id}`,{width:Va.pzone.w,height:Va.pzone.h}),v.push({id:`e:root->a:${C.id}`,source:"root",target:`a:${C.id}`,type:"smoothstep",deletable:!1,reconnectable:!1,className:"pedge gap",style:{strokeDasharray:"5 4"}}),x.setEdge("root",`a:${C.id}`));for(const C of a)m.push({id:`p:${C.id}`,type:"ppart",position:{x:0,y:0},data:{name:C.name,people:C.members.length,areas:C.areas.length,lead:$n(C)&&r.get($n(C))||null,onOpen:()=>g(C.id)}}),x.setNode(`p:${C.id}`,{width:Va.ppart.w,height:Va.ppart.h}),v.push({id:`e:root->p:${C.id}`,source:"root",target:`p:${C.id}
83`,type:"smoothstep",deletable:!1,reconnectable:!1,className:"pedge part"}),x.setEdge("root",`p:${C.id}`);sc.layout(x);for(const C of m){if(C.position.x||C.position.y)continue;const z=x.node(C.id),E=Va[C.type];C.position={x:z.x-E.w/2,y:z.y-E.h/2}}return{nodes:m,edges:v,t:d}}function Tz({project:e,parts:a,partOf:l,onOpenPart:i,companies:r,personById:u,actions:d,memberId:h,onOpen:g,onOpenArea:p,background:x,onPatchPerson:m}){const v=qe(),[k,T,S]=FN([]),[C,z,E]=nO([]),{fitView:j,getNodes:O,setViewport:w,screenToFlowPosition:b}=Zi(),A=N.useMemo(()=>Ez(e,a,l,r,u,h,v,F=>p(F),i,m),[e,a,l,r,u,h,v,p,i,m]);N.useEffect(()=>{T(F=>{const _=new Set(F.filter(H=>H.selected).map(H=>H.id));return _.size?A.nodes.map(H=>_.has(H.id)?{...H,selected:!0}:H):A.nodes}),z(A.edges)},[A,T,z]);const D=`${e.id}:${e.members.length}:${e.areas.length}:${a.length}`;N.useEffect(()=>{const F=window.setTimeout(()=>{const _=document.querySelector(".project-map")?.getBoundingClientRect(),H=O();if(!_||H.length===0)return j({padding:.12,duration:200});const P=Math.min(...H.map(le=>le.position.x)),X=Math.max(...H.map(le=>le.position.x+(le.measured?.width??Va[le.type]?.w??0))),ne=Math.min(...H.map(le=>le.position.y)),pe=X-P||1,R=Math.min(1,Math.max(.55,(_.width-48)/pe));if((Math.max(...H.map(le=>le.position.y+(le.measured?.height??Va[le.type]?.h??0)))-ne)*R<_.height-48)return j({padding:.12,duration:200,maxZoom:1});w({x:24-P*R,y:24-ne*R,zoom:R},{duration:200})},60);return()=>window.clearTimeout(F)},[D,j,O,w]);const M=F=>F?.startsWith("m:")?F.split(":").pop():null,U=F=>F?.startsWith("a:")?F.slice(2):null,Y=N.useRef(null),[q,W]=N.useState(null),L=N.useRef(k);L.current=k,N.useEffect(()=>{const F=Y.current;if(!F)return;let _=null;const H=R=>{const Q=F.getBoundingClientRect();return{x:R.clientX-Q.left,y:R.clientY-Q.top}},P=(R,Q)=>({x:Math.min(R.x,Q.x),y:Math.min(R.y,Q.y),width:Math.abs(R.x-Q.x),height:Math.abs(R.y-Q.y)}),X=R=>{R.button!==2||R.pointerType!=="mouse"||(_=H(R),R.preventDefault())},ne=R=>{_&&W(P(_,H(R)))},pe=R=>{if(!_)return;const Q=P(_,H(R));if(_=null,W(null),Q.width<4&&Q.height<4)return;const le=F.getBoundingClientRect(),se=b({x:le.left+Q.x,y:le.top+Q.y}),ie=b({x:le.left+Q.x+Q.width,y:le.top+Q.y+Q.height}),K=P(se,ie),ue=L.current.filter(Ne=>{const He=Ne.measured?.width??Va[Ne.type]?.w??0,ee=Ne.measured?.height??Va[Ne.type]?.h??0;return Ne.position.x<K.x+K.width&&Ne.position.x+He>K.x&&Ne.position.y<K.y+K.height&&Ne.position.y+ee>K.y}),xe=new Set(ue.map(Ne=>Ne.id));S(L.current.map(Ne=>({type:"select",id:Ne.id,selected:xe.has(Ne.id)})))};return F.addEventListener("pointerdown",X),window.addEventListener("pointermove",ne),window.addEventListener("pointerup",pe),()=>{F.removeEventListener("pointerdown",X),window.removeEventListener("pointermove",ne),window.removeEventListener("pointerup",pe)}},[S,b]);const V=k.filter(F=>F.selected&&F.type==="pmember").map(F=>M(F.id)),I=()=>S(k.map(F=>({type:"select",id:F.id,selected:!1})));return s.jsxs("div",{className:"project-flow",ref:Y,onContextMenu:F=>F.preventDefault(),children:[s.jsxs(ZN,{nodes:k,edges:C,nodeTypes:Cz,onNodesChange:S,onEdgesChange:E,onNodeClick:(F,_)=>U(_.id)?p(U(_.id)):g(M(_.id)),onNodeDragStop:(F,_,H)=>{for(const P of H){const X={x:Math.round(P.position.x),y:Math.round(P.position.y)},ne=M(P.id),pe=U(P.id),R=ne?e.members.find(Q=>Q.id===ne):pe?e.areas.find(Q=>Q.id===pe):null;!R||R.x===X.x&&R.y===X.y||(ne?d.patchMember(e.id,ne,X):pe&&d.patchArea(e.id,pe,X))}},onPaneClick:()=>g(null),deleteKeyCode:["Delete","Backspace"],minZoom:.2,connectionRadius:40,zoomOnDoubleClick:!1,colorMode:"system",proOptions:{hideAttribution:!0},children:[s.jsx(O1,{kind:x}),s.jsx(WN,{showInteractive:!1})]}),q&&s.jsx("div",{className:"marquee",style:{left:q.x,top:q.y,width:q.width,height:q.height}}),V.length>0&&s.jsxs("div",{className:"pick-bar",children:[s.jsx("span",{children:v("{n} picked",{n:V.length})}),s.jsx(Qe,{className:"bulk-pick",value:"",options:e.areas.map(F=>({value:F.id,label:F.name})),onChange:async F=>{for(const _ of V){const H=e.members.find(P=>P.id===_);!H||H.areas.some(P=>P.areaId===F)||await d.patchMember(e.id,H.id,{areas:[...H.areas,{areaId:F,kind:"works"}]})}I()},children:s.jsx("span",{children:v("Put in a zone")})}),s.jsx("button",{type:"button",className:"btn small danger",onClick:async()=>
83{if(await Dt(v("Remove {n} people from the project?",{n:V.length}),{okLabel:"Remove",danger:!0})){for(const F of V)await d.removeMember(e.id,F);I()}},children:v("Remove from project")}),s.jsx("button",{type:"button",className:"btn small",onClick:I,children:v("Clear")})]})]})}function Mz(e){return s.jsx("div",{className:`project-map bg-${e.background}`,children:s.jsx(gg,{children:s.jsx(Tz,{...e})})})}const pp=5;function Dz({project:e,people:a,actions:l,tasks:i,onAreaGone:r,onOpenArea:u}){const d=qe(),[h,g]=N.useState(!1),[p,x]=N.useState(""),[m,v]=N.useState(null),k=new Map(a.map(M=>[M.id,M])),T=e.members.map(M=>k.get(M.personId)).filter(M=>!!M),S=M=>e.members.find(U=>U.areas.some(Y=>Y.areaId===M.id&&Y.kind==="owns"))??null,C=M=>e.members.filter(U=>U.areas.some(Y=>Y.areaId===M.id&&Y.kind==="works")).map(U=>k.get(U.personId)).filter(U=>!!U),{sorted:z,by:E,toggle:j}=fs(e.areas,{area:M=>M.name.toLowerCase(),owner:M=>(k.get(S(M)?.personId??"")?.fullName??"").toLowerCase(),people:M=>C(M).length,work:M=>i.filter(U=>U.areaIds.includes(M.id)).length});async function O(M,U){const Y=S(M);if(Y&&await l.patchMember(e.id,Y.id,{areas:Y.areas.filter(L=>L.areaId!==M.id)}),!U)return;let q=e.members.find(L=>L.personId===U);if(q||(q=await l.addMember(e.id,{personId:U,involvement:"partial"})??void 0),!q)return;const W=q.areas.filter(L=>L.areaId!==M.id);await l.patchMember(e.id,q.id,{areas:[...W,{areaId:M.id,kind:"owns"}]})}async function w(M,U){if(S(M)?.personId===U)return;let q=e.members.find(L=>L.personId===U);if(q?.areas.some(L=>L.areaId===M.id&&L.kind==="works")){await l.patchMember(e.id,q.id,{areas:q.areas.filter(L=>L.areaId!==M.id)});return}if(q||(q=await l.addMember(e.id,{personId:U,involvement:"partial"})??void 0),!q)return;const W=q.areas.filter(L=>L.areaId!==M.id);await l.patchMember(e.id,q.id,{areas:[...W,{areaId:M.id,kind:"works"}]})}async function b(M){const U=i.filter(Y=>Y.areaIds.includes(M.id)).length;await Dt(d("Delete area “{name}”?",{name:M.name})+(U?`
84${d("{n} tasks inside go with it.",{n:U})}`:""),{okLabel:"Delete",danger:!0})&&(await l.deleteArea(e.id,M.id),r(M.id))}async function A(){const M=p.trim();if(!M)return g(!1);await l.addArea(e.id,M),x(""),g(!1)}const D=[{value:"",label:d("— nobody yet —")},...T.map(M=>({value:M.id,label:M.fullName,sub:M.title,icon:s.jsx(Xe,{person:M,size:20})})),...a.filter(M=>M.fullName&&!T.some(U=>U.id===M.id)).sort((M,U)=>M.fullName.localeCompare(U.fullName)).map(M=>({value:M.id,label:M.fullName,sub:M.title,icon:s.jsx(Xe,{person:M,size:20})}))];return s.jsxs("div",{className:"zones",children:[s.jsxs("table",{className:"stats-table zones-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx(et,{label:d("Area"),k:"area",by:E,toggle:j}),s.jsx(et,{label:d("Owner"),k:"owner",by:E,toggle:j,className:"owner-col"}),s.jsx(et,{label:d("Works on"),k:"people",by:E,toggle:j,firstDir:"desc",className:"people-col"}),s.jsx(et,{label:d("Work"),k:"work",by:E,toggle:j,firstDir:"desc",className:"num-col"}),s.jsx("th",{className:"act-col"})]})}),s.jsxs("tbody",{children:[z.map(M=>{const U=S(M),Y=U?k.get(U.personId):null,q=C(M),W=i.filter(L=>L.areaIds.includes(M.id)&&Wn(L.state)).length;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(bn,{className:"zone-name",value:M.name,placeholder:d("Area name"),onCommit:L=>L.trim()&&l.patchArea(e.id,M.id,{name:L.trim()})})}),s.jsx("td",{className:"owner-col",children:s.jsx(Qe,{className:"zone-owner",value:Y?.id??"",options:D,onChange:L=>O(M,L),searchPlaceholder:d("Search a person…"),children:Y?s.jsxs("span",{className:"who-cell",children:[s.jsx(Xe,{person:Y,size:20}),Y.fullName]}):s.jsx("span",{className:"matrix-warn",children:d("no owner")})})}),s.jsx("td",{className:"people-col",children:s.jsxs("span",{className:"zone-people-cell",children:[s.jsx(Qe,{className:"zone-workers",value:"",keepOpen:!0,options:a.filter(L=>L.fullName&&L.id!==Y?.id).map(L=>({value:L.id,label:L.fullName,sub:L.title,icon:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:`tick ${q.some(V=>V.id===L.id)?"on":""}`,"aria-hidden":"true"}),s.jsx(Xe,{person:L,size:22})]})})),onChange:L=>w(M,L),searchPlaceholder:d("Search a person…"),emptyLabel:d("Nobody matches"),children:q.length===0?s.jsx("span",{className:"hint",children:"—"}):s.jsx("span",{className:"zone-people",title:q.map(L=>L.fullName).join(`
85`),children:(m===M.id?q:q.slice(0,pp)).map(L=>s.jsx(Xe,{person:L,size:22,title:L.fullName},L.id))})}),q.length>pp&&s.jsx("button",{type:"button",className:"zone-more","aria-expanded":m===M.id,title:m===M.id?d("Show fewer"):d("Show all {n}",{n:q.length}),onClick:()=>v(L=>L===M.id?null:M.id),children:m===M.id?"−":`+${q.length-pp}`})]})}),s.jsx("td",{className:"num-col",children:s.jsx("button",{type:"button",className:"link",onClick:()=>u(M.id),children:W?d("{n} open",{n:W}):d("Nothing here yet.")})}),s.jsx("td",{className:"act-col",children:s.jsx("button",{type:"button",className:"icon-btn small",title:d("Delete"),onClick:()=>b(M),children:"×"})})]},M.id)}),e.areas.length===0&&!h&&s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"hint pad",children:d("No areas in this project yet — add them on the scheme.")})})]})]}),h?s.jsx("div",{className:"card-add",children:s.jsx("input",{autoFocus:!0,value:p,onChange:M=>x(M.target.value),placeholder:d("Area name"),onKeyDown:M=>{M.key==="Enter"&&A(),M.key==="Escape"&&(g(!1),x(""))},onBlur:A})}):s.jsx("button",{type:"button",className:"btn small",onClick:()=>{x(""),g(!0)},children:d("+ Area")})]})}const _z=new Date().toISOString().slice(0,10);function Oz({project:e,area:a,people:l,actions:i,tasks:r,taskActions:u,isTool:d,onClose:h,onOpenPerson:g}){const p=qe(),[x,m]=N.useState(0),[v,k]=N.useState(!1),[T,S]=N.useState("");N.useEffect(()=>{const L=()=>m(document.querySelector(".bar")?.getBoundingClientRect().bottom??0);L();const V=I=>{I.key==="Escape"&&h()};return window.addEventListener("keydown",V),window.addEventListener("resize",L),(
85)=>{window.removeEventListener("keydown",V),window.removeEventListener("resize",L)}},[h]);const C=new Map(l.map(L=>[L.id,L])),z=e.members.find(L=>L.areas.some(V=>V.areaId===a.id&&V.kind==="owns")),E=z?C.get(z.personId):null,j=e.members.filter(L=>L.areas.some(V=>V.areaId===a.id&&V.kind==="works")).map(L=>C.get(L.personId)).filter(L=>!!L),O=r.filter(L=>L.areaIds.includes(a.id)),w=O.filter(L=>!L.parentId||!O.some(V=>V.id===L.parentId)),b=L=>O.filter(V=>V.parentId===L),A=O.filter(L=>L.state==="done").length,D=O.reduce((L,V)=>L+(V.effortDays??0),0),M=O.filter(L=>L.state==="in_progress"||L.state==="review").length,U=[{value:"",label:p("— nobody yet —")},...e.members.map(L=>C.get(L.personId)).filter(L=>!!L).map(L=>({value:L.id,label:L.fullName,sub:L.title,icon:s.jsx(Xe,{person:L,size:20})}))];async function Y(L){const V=T.trim();if(!V)return k(!1);await u.create({title:V,kind:"once",parentId:L,areaIds:[a.id],...d?{toolId:e.id}:{projectId:e.id}}),S(""),k(!1)}async function q(L){const V=b(L.id).length;await Dt(p("Delete “{name}”?",{name:L.title})+(V?`
86${p("{n} pieces inside go with it.",{n:V})}`:""),{okLabel:"Delete",danger:!0})&&await u.remove(L.id)}const W=(L,V)=>s.jsxs("div",{className:`work-row ${L.state}`,style:{paddingLeft:8+V*18},children:[s.jsx(Qe,{className:"work-state",value:L.state,options:Ec.map(I=>({value:I,label:p(Sa[I])})),onChange:I=>u.patch(L.id,{state:I}),children:s.jsx("span",{title:p(Sa[L.state]),children:s.jsx(Jn,{state:L.state,size:13})})}),s.jsx(bn,{className:"work-title",value:L.title,placeholder:p("Task name"),onCommit:I=>I.trim()&&u.patch(L.id,{title:I.trim()})}),s.jsx(bn,{className:"work-days",value:L.effortDays!=null?$o(L.effortDays,p):"",display:L.effortDays!=null?$o(L.effortDays,p):"—",placeholder:"—",onCommit:I=>u.patch(L.id,{effortDays:I.trim()?U1(I):null})}),L.dueOn&&s.jsx("span",{className:`work-due ${L.dueOn<_z&&Wn(L.state)?"matrix-warn":""}`,children:L.dueOn.slice(5)}),s.jsx(Qe,{className:"work-who",value:L.assigneeId??"",options:U,onChange:I=>u.patch(L.id,{assigneeId:I||null}),searchPlaceholder:p("Search a person…"),children:L.assigneeId&&C.get(L.assigneeId)?s.jsx(Xe,{person:C.get(L.assigneeId),size:20,title:C.get(L.assigneeId).fullName}):s.jsx("span",{className:"work-nobody",children:"+"})}),s.jsx("button",{type:"button",className:"icon-btn small",title:p("Remove"),onClick:()=>q(L),children:"×"})]},L.id);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"panel-scrim",style:{top:x},onClick:h}),s.jsxs("aside",{className:"side-panel wide",style:{top:x},role:"dialog","aria-label":a.name,children:[s.jsxs("header",{className:"panel-head",children:[s.jsx("span",{children:s.jsx(bn,{className:"area-title",value:a.name,placeholder:p("Area name"),onCommit:L=>L.trim()&&i.patchArea(e.id,a.id,{name:L.trim()})})}),s.jsx("button",{type:"button",className:"icon-btn",title:p("Close"),onClick:h,children:"×"})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("section",{className:"panel-group",children:[s.jsxs("div",{className:"panel-row",children:[s.jsx("span",{className:"panel-label",children:p("Owner")}),E?s.jsxs("button",{type:"button",className:"person-chip",onClick:()=>g(E.id),children:[s.jsx(Xe,{person:E,size:20}),E.fullName]}):s.jsx("span",{className:"hint matrix-warn",children:p("no owner")})]}),j.length>0&&s.jsxs("div",{className:"panel-row",children:[s.jsx("span",{className:"panel-label",children:p("Works on")}),s.jsx("span",{className:"card-people",children:j.map(L=>s.jsx("button",{type:"button",className:"link",onClick:()=>g(L.id),children:L.fullName},L.id))})]})]}),s.jsxs("section",{className:"panel-group",children:[s.jsxs("h4",{children:[p("Work inside"),O.length>0&&s.jsx("span",{className:"head-count",children:O.length})]}),O.length>0&&s.jsxs("p",{className:"hint pad",children:[p("{running} in progress · {done} done",{running:M,done:A}),D>0&&` · ${p("{n} person-days",{n:D})}`]}),w.length===0&&!v&&s.jsx("p",{className:"hint pad",children:p("Nothing here yet.")}),s.jsx("div",{className:"work-list",children:w.map(L=>s.jsxs("div",{children:[W(L,0),b(L.id).map(V=>W(V,1))]},L.id))}),v?s.jsx("div",{className:"card-add",children:s.jsx("input",{autoFocus:!0,value:T,onChange:L=>S(L.target.value),placeholder:p("Task name"),onKeyDown:L=>{L.key==="Enter"&&Y(null),L.key==="Escape"&&(k(!1),S(""))},onBlur:()=>Y(null)})}):s.jsx("button",{type:"button",className:"panel-row add",onClick:()=>{S(""),k(!0)}
86,children:s.jsx("span",{className:"panel-label",children:p("+ Piece of work")})})]})]})]})]})}function Az({kind:e,holderId:a,fail:l,setStatus:i}){const r=e==="tool"?"tools":"projects",u=N.useRef(Se.docs(r,a));u.current=Se.docs(r,a);const[d,h]=N.useState([]),[g,p]=N.useState([]),[x,m]=N.useState(!1),v=N.useCallback(async()=>{try{const{folders:O,docs:w}=await u.current.list();h(O),p(b=>w.map(A=>({...A,body:b.find(D=>D.id===A.id)?.body})))}catch(O){l(O)}finally{m(!0)}},[l]);N.useEffect(()=>{m(!1),h([]),p([]),v()},[a,v]);const k=N.useCallback(async O=>{try{const w=await u.current.read(O);p(b=>b.map(A=>A.id===O?{...A,...w}:A))}catch(w){l(w)}},[l]),T=N.useCallback(async O=>{try{const w=await u.current.create(O);return p(b=>[...b,w]),i("Added"),w}catch(w){return l(w),null}},[l,i]),S=N.useCallback(async(O,w)=>{p(b=>b.map(A=>A.id===O?{...A,...w}:A));try{const b=await u.current.update(O,w);p(A=>A.map(D=>D.id===O?{...D,...b}:D)),i("Saved")}catch(b){l(b),v()}},[l,v,i]),C=N.useCallback(async O=>{try{await u.current.remove(O),await v(),i("Deleted")}catch(w){l(w)}},[l,v,i]),z=N.useCallback(async(O,w=null)=>{try{const b=await u.current.addFolder({name:O,parentId:w});return h(A=>[...A,b]),b}catch(b){return l(b),null}},[l]),E=N.useCallback(async(O,w)=>{h(b=>b.map(A=>A.id===O?{...A,name:w}:A));try{await u.current.patchFolder(O,{name:w}),i("Saved")}catch(b){l(b),v()}},[l,v,i]),j=N.useCallback(async O=>{try{await u.current.removeFolder(O),await v(),i("Deleted")}catch(w){l(w)}},[l,v,i]);return{folders:d,docs:g,loaded:x,load:v,read:k,create:T,patch:S,remove:C,addFolder:z,renameFolder:E,removeFolder:j}}const gp=(e,a)=>e.position-a.position;function Iz({project:e,isTool:a,fail:l,setStatus:i}){const r=qe(),u=Az({kind:a?"tool":"project",holderId:e.id,fail:l,setStatus:i}),[d,h]=N.useState(null),[g,p]=N.useState(new Set),[x,m]=N.useState(""),[v,k]=N.useState(!1),T=N.useRef(null),[S,C]=N.useState(null),z=u.docs.find(P=>P.id===d)??null;N.useEffect(()=>{d&&z&&z.body===void 0&&u.read(d)},[d,z,u]),N.useEffect(()=>{!d&&u.loaded&&u.docs.length&&h(u.docs[0].id)},[d,u.loaded,u.docs]),N.useEffect(()=>h(null),[e.id]);const E=x.trim().toLowerCase(),j=P=>!E||P.title.toLowerCase().includes(E),O=P=>u.docs.filter(X=>X.folderId===P&&!X.parentId&&j(X)).sort(gp),w=P=>u.docs.filter(X=>X.parentId===P&&j(X)).sort(gp),b=P=>u.folders.filter(X=>X.parentId===P).sort(gp),A=P=>p(X=>{const ne=new Set(X);return ne.has(P)?ne.delete(P):ne.add(P),ne}),D=(P,X)=>X?s.jsx("button",{type:"button",className:"doc-twist","aria-label":g.has(P)?r("Unfold"):r("Fold"),onClick:()=>A(P),children:s.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10","aria-hidden":"true",className:g.has(P)?"":"down",children:s.jsx("path",{d:"M3 1.5 7 5l-4 3.5z",fill:"
86currentColor"})})}):s.jsx("span",{className:"doc-twist empty","aria-hidden":"true"});async function M(P,X=null){const ne=await u.create({title:"",folderId:P,parentId:X});ne&&(h(ne.id),C(ne.id),X&&p(pe=>{const R=new Set(pe);return R.delete(X),R}),P&&p(pe=>{const R=new Set(pe);return R.delete(P),R}))}async function U(P=null){const X=await us(r("Name of the folder"),{okLabel:"Create"});X?.trim()&&await u.addFolder(X.trim(),P)}async function Y(P){const X=u.docs.filter(pe=>pe.folderId===P.id).length,ne=X?`
87${r("{n} pages inside stay, one level up.",{n:X})}`:"";await Dt(r("Delete the folder “{name}”?",{name:P.name})+ne,{okLabel:"Delete",danger:!0})&&await u.removeFolder(P.id)}async function q(P){const X=w(P.id).length,ne=X?`
88${r("{n} pages inside go with it.",{n:X})}`:"";await Dt(r("Delete the page “{name}”?",{name:P.title||r("Untitled page")})+ne,{okLabel:"Delete",danger:!0})&&(await u.remove(P.id),d===P.id&&h(null))}const W=(P,X)=>{const ne=w(P.id);return s.jsxs("li",{children:[s.jsxs("div",{className:`doc-row ${d===P.id?"on":""}`,style:{"--depth":X},children:[D(P.id,ne.length>0),s.jsxs("button",{type:"button",className:"doc-name",onClick:()=>h(P.id),title:P.title||r("Untitled page"),children:[s.jsx("span",{className:"doc-icon","aria-hidden":"true",children:s.jsx(Vl,{name:P.icon||"doc",size:14})}),s.jsx("span",{className:`doc-label ${P.title?"":"unnamed"}`,children:P.title||r("Untitled page")})]}),s.jsxs("span",{className:"doc-acts",children:[s.jsx("button",{type:"button",className:"icon-btn tiny",title:r("Page inside"),onClick:()=>M(P.folderId,P.id),children:"+"}),s.jsx("button",{type:"button",className:"icon-btn tiny",title:r("Delete"),onClick:()=>q(P),children:"×"})]})]}),ne.length>0&&!g.has(P.id)&&s.jsx("ul",{children:ne.map(pe=>W(pe,X+1))})]},P.id)},L=(P,X)=>{const ne=b(P.id),pe=O(P.id),R=ne.length+pe.length>0;return s.jsxs("li",{children:[s.jsxs("div",{className:"doc-row folder",style:{"--depth":X},children:[D(P.id,R),s.jsxs("button",{type:"button",className:"doc-name",title:P.name,onDoubleClick:async()=>{const Q=await us(r("Name of the folder"),{value:P.name,okLabel:"Save"});Q?.trim()&&u.renameFolder(P.id,Q.trim())},onClick:()=>R&&p(Q=>{const le=new Set(Q);return le.has(P.id)?le.delete(P.id):le.add(P.id),le}),children:[s.jsx("span",{className:"doc-folder-mark","aria-hidden":"true",children:s.jsx(Vl,{name:"folder",size:14})}),s.jsx("span",{className:"doc-label",children:P.name}),pe.length>0&&s.jsx("span",{className:"doc-count",children:pe.length})]}),s.jsxs("span",{className:"doc-acts",children:[s.jsx("button",{type:"button",className:"icon-btn tiny",title:r("New page here"),onClick:()=>M(P.id),children:"+"}),s.jsx("button",{type:"button",className:"icon-btn tiny",title:r("Rename"),onClick:async()=>{const Q=await us(r("Name of the folder"),{value:P.name,okLabel:"Save"});Q?.trim()&&u.renameFolder(P.id,Q.trim())},children:"✎"}),s.jsx("button",{type:"button",className:"icon-btn tiny",title:r("Delete"),onClick:()=>Y(P),children:"×"})]})]}),R&&!g.has(P.id)&&s.jsxs("ul",{children:[ne.map(Q=>L(Q,X+1)),pe.map(Q=>W(Q,X+1))]})]},P.id)};N.useEffect(()=>{S&&z?.id===S&&T.current&&(T.current.focus(),C(null))},[S,z]);const V=O(null),I=u.loaded&&!u.folders.length&&!u.docs.length,F=r.lang==="ru"?"ru-RU":"en-GB",_=P=>new Date(P).toLocaleString(F,{dateStyle:"medium",timeStyle:"short"}),H=N.useMemo(()=>z?.editors??[],[z]);return s.jsxs("div",{className:"docs",children:[s.jsxs("aside",{className:"docs-list",children:[s.jsxs("div",{className:"docs-top",children:[s.jsx("span",{className:"docs-label",children:r("Pages")}),u.docs.length>0&&s.jsx("span",{className:"docs-n",children:u.docs.length})]}),u.docs.length>5&&s.jsx("input",{className:"doc-search",value:x,placeholder:r("Find a page…"),onChange:P=>m(P.target.value)}),s.jsxs("ul",{className:"doc-tree",children:[b(null).map(P=>L(P,0)),V.map(P=>W(P,0))]}),I&&s.jsx("p",{className:"hint",children:r("No documents yet. A folder holds them; a page is where they are written.")}),s.jsxs("div",{className:"docs-add",children:[s.jsxs("button",{type:"button",className:"doc-add",onClick:()=>M(null),children:[s.jsx("span",{"aria-hidden":"true",children:"+"})," ",r("Page")]}),s.jsxs("button",{type:"button",className:"doc-add",onClick:()=>U(null),children:[s.jsx("span",{"aria-hidden":"true",children:"+"})," ",r("Folder")]})]})]}),z?s.jsxs("article",{className:"doc-page",children:[s.jsxs("header",{className:"doc-head",children:[s.jsxs("div",{className:"doc-icon-pick",children:[s.jsx("button",{type:"button",className:"doc-icon big",title:r("Icon"),onClick:()=>k(P=>!P),children:s.jsx(Vl,{name:z.icon||"doc",size:30})}),v&&s.jsxs("div",{className:"icon-pop",role:"dialog","aria-label":r("Icon"),children:[s.jsx("button",{type:"button",title:r("No icon"),onClick:()=>{u.patch(z.id,{icon:""}),k(!1)},children:"—"}),jd.map(P=>s.jsx("button",{type:"button",title:P,onClick:()=>{u.patch(z.id,{icon:P}),k(!1)},children:s.jsx(Vl,{name:P,size:18})},P))]})]}),s.jsx("input",{ref:T,className:"doc-title",value:z.title,placeholder:r("Untitled page"),onChange:P=>u.patch(z.id,{title:P.target.value}),onBlur:P=>u.patch(z.id,{title:P.target.value.trim()})}),s.jsx("button",{type:"button",className:"icon-btn",title:r("Delete"),onClick:()=>q(z),children:"×"})]}),s.jsxs("div",{className:"doc-meta",children:[z.authorName&&s.jsxs("span",{className:"doc-by",title:r("Started it"),children:[s.jsx(Xe,{person:{id:z.authorPerson??z.authorName,fullName:z.authorName,photoVersion:z.authorPhoto},size:22}),s.jsx("span",{className:"doc-by-name",children:z.authorName})]}),H.length>0&&s.jsxs("span",{className:"doc-crew",title:`${r("Written in by")}: ${H.map(P=>P.name).join(", ")}`,children:[H.slice(0,5).map(P=>s.jsx(Xe,{person:{id:P.personId??P.name,fullName:P.name,photoVersion:P.photo},size:22,title:P.name},P.name)),H.length>5&&s.jsxs("span",{className:"doc-crew-more",children:["+",H.length-5]}),s.jsx("span",{className:"hint",children:r("wrote in it")})]}),s.jsx("span",{className:"hint doc-when",title:z.updatedName?r("Last written in by {who}",{who:z.updatedName}):void 0,children:r("updated {when}",{when:_(z.updatedAt)})})]}),z.body===void 0?s.jsx("p",{className:"hint pad",children:r("Opening…")}):s.jsx("div",{className:"doc-body-wrap",children:s.jsx(V1,{big:!0,value:z.body,placeholder:r("Write here. “/” puts in a heading, a list, a table…"),onCommit:P=>u.patch(z.id,{body:P})})})]}):s.jsx("p",{className:"hint pad",children:u.loaded?r("Pick a page on the left, or make one."):r("Opening…")})]})}function zz({kind:e,others:a,onOpenOther:l,projects:i,companies:r,people:u,actions:d,selectedId:h,onSelect:g,view:p,onView:x,onShowPerson:m,renderTasks:v,tasks:k,taskActions:T,setStatus:S,fail:C,onOpenCard:z,background:E,onBackgroun
88d:j,onPatchPerson:O}){const w=e==="tool",b=w?"Tool settings":"Project settings",A=w?"Module":"Direction",D=w?"Modules":"Directions",M=a,U=qe(),[Y,q]=N.useState(null),[W,L]=N.useState(null),I=(me=>me==="map"||me==="works"||me==="zones"||me==="docs")(p)?p:"map",[F,_]=N.useState(""),[H,P]=N.useState(!1),X=i.find(me=>me.id===h)??null,ne=N.useMemo(()=>X?k.filter(me=>w?me.toolId===X.id:me.projectId===X.id):[],[k,X,w]),pe=X?Pb(i,X.id):[],R=X?.parentId?i.find(me=>me.id===X.parentId)??null:null,Q=w&&X?M.find(me=>me.id===X.projectId)??null:null,le=!w&&X?M.filter(me=>me.projectId===X.id):[];N.useEffect(()=>{!X&&i.length&&g((i.find(me=>!me.parentId)??i[0]).id,!0)},[X,i]),N.useEffect(()=>{q(null),_(""),P(!1)},[h]);const se=N.useMemo(()=>new Map(u.map(me=>[me.id,me])),[u]),ie=me=>me&&r.find(_e=>_e.id===me)?.name||"",K=me=>x(me),ue=N.useMemo(()=>{if(!X)return[];const me=new Set(X.members.map(_e=>_e.personId));return u.filter(_e=>!me.has(_e.id)&&_e.fullName)},[X,u]);async function xe(me){if(!X)return;const _e=await d.addMember(X.id,{personId:me.id,role:me.title});_(""),_e&&q(_e.id)}async function Ne(me){const _e=Pb(i,me.id),ke=_e.length?" "+U("Its {n} parts go with it: {names}.",{n:_e.length,names:_e.map(te=>te.name).join(", ")}):"",re=(w?U('Delete tool "{name}"? People stay where they are; only the tool is removed.',{name:me.name}):U('Delete project "{name}"? People stay where they are; only the project is removed.',{name:me.name}))+ke;await Dt(re,{okLabel:"Delete",danger:!0})&&(await d.deleteProject(me.id),g(me.parentId??null))}async function He(me){const _e=w?U('Close the tool "{name}"? It leaves the working lists but stays whole — tasks, history, who was on it.',{name:me.name}):U('Close the project "{name}"? It leaves the working lists but stays whole — tasks, history, who was on it.',{name:me.name});if(!await Dt(_e,{okLabel:"Close"}))return;const ke=await d.closeProject(me.id);if(ke.ok||!ke.open.length)return;const re=ke.open.slice(0,10).map(Ce=>`• ${Ce.title}`).join(`
89`),te=ke.open.length>10?`
90${U("and {n} more",{n:ke.open.length-10})}`:"";await Dt(U("There are {n} unfinished tasks here. Finish them, cancel them or move them to another project first.",{n:ke.open.length})+`
91
92${re}${te}`,{okLabel:"Got it"})}const ee=X?.members.find(me=>me.id===Y)??null,ge=X?[...new Map([...X.members.map(me=>se.get(me.personId)),$n(X)?se.get($n(X)):void 0,...u.filter(me=>me.fullName&&!me.plannedOut).sort((me,_e)=>me.fullName.localeCompare(_e.fullName))].filter(me=>!!me).map(me=>[me.id,me])).values()]:[],Le=X?{ownerless:X.areas.filter(me=>!X.members.some(_e=>_e.areas.some(ke=>ke.areaId===me.id&&ke.kind==="owns"))).length,idle:X.members.filter(me=>me.areas.length===0).length,noLead:!$n(X),overloaded:X.members.filter(me=>me.areas.filter(_e=>_e.kind==="owns").length>3).length}:null;return s.jsxs("div",{className:"projects",children:[X?s.jsxs("div",{className:"project-main",children:[s.jsxs("header",{className:"project-head",children:[X.icon&&s.jsx("span",{className:"project-mark",style:X.color?{color:X.color}:void 0,"aria-hidden":"true",children:s.jsx(Vl,{name:X.icon,size:26})}),s.jsxs("div",{className:"project-title",children:[s.jsx(bn,{className:"project-name",value:X.name,placeholder:U("Untitled"),onCommit:me=>d.patchProject(X.id,{name:me})}),s.jsx(bn,{className:"project-desc",multiline:!0,value:X.description,placeholder:U(w?"What the tool is for…":"What the project is about…"),onCommit:me=>d.patchProject(X.id,{description:me})})]}),s.jsxs("div",{className:"project-meta",children:[X.closedOn&&s.jsxs("span",{className:"hint closed-note",children:[U(w?"Tool closed {on}":"Project closed {on}",{on:X.closedOn})," · ",s.jsx("button",{type:"button",className:"link",onClick:()=>d.reopenProject(X.id),children:U("open it again")})]}),s.jsxs("span",{className:"hint",children:[ie(X.ownerCompanyId)||U("no owner"),$n(X)&&se.get($n(X))?` · ${se.get($n(X)).fullName}`:""]}),R&&s.jsxs("span",{className:"hint",children:[U(w?"Module of":"Direction of")," ",s.jsx("button",{type:"button",className:"link",onClick:()=>g(R.id),children:R.name})]}),pe.length>0&&s.jsxs("span",{className:"hint",children:[U(D),":"," ",pe.map((me,_e)=>s.jsxs("span",{children:[_e>0&&" · ",s.jsx("button",{type:"button",className:"link",onClick:()=>g(me.id),children:me.name})]},me.id))]}),w?Q&&s.jsxs("span",{className:"hint",children:[U("Part of")," ",s.jsx("button",{type:"button",className:"link",onClick:()=>l(Q.id),children:Q.name})]}):le.length>0&&s.jsxs("span",{className:"hint",children:[U("Tools"),":"," ",le.map((me,_e)=>s.jsxs("span",{children:[_e>0&&" · ",s.jsx("button",{type:"button",className:"link",onClick:()=>l(me.id),children:me.name})]},me.id))]})]})]}),Le&&(Le.ownerless>0||Le.idle>0||Le.noLead||Le.overloaded>0)&&s.jsxs("div",{className:"project-gaps",children:[s.jsx("span",{className:"gaps-label",children:U("Worth a look")}),Le.noLead&&s.jsx("span",{className:"gap warn",children:U("no project lead")}),Le.ownerless>0&&s.jsx("span",{className:"gap warn",children:U("{n} areas without an owner",{n:Le.ownerless})}),Le.idle>0&&s.jsx("span",{className:"gap",children:U("{n} people without an area",{n:Le.idle})}),Le.overloaded>0&&s.jsx("span",{className:"gap",children:U("{n} people own more than three areas",{n:Le.overloaded})})]}),s.jsxs("div",{className:"project-tools",children:[s.jsx("div",{className:"tabs",role:"tablist","aria-label":U("View"),children:["map","works","zones","docs"].map(me=>s.jsxs("button",{type:"button",role:"tab","aria-selected":I===me,className:I===me?"on":"",onClick:()=>K(me),children:[U(me==="map"?"Scheme":me==="works"?"Work":me==="zones"?"Zones":"Documents"),me==="works"&&ne.length>0&&s.jsx("span",{className:"count",children:ne.filter(_e=>Wn(_e.state)).length})]},me))}),s.jsx(Lz,{value:F,onChange:_,people:ue,companyName:ie,onPick:xe}),s.jsx(nj,{label:U("+ Area"),placeholder:U("Area name"),onDone:me=>d.addArea(X.id,me)}),!X.parentId&&s.jsx(nj,{label:U(`+ ${A}`),placeholder:U(`${A} name`),onDone:async me=>{const _e=await d.createProject({name:me,parentId:X.id,ownerCompanyId:X.ownerCompanyId});_e&&g(_e.id)}}),s.jsxs("span",{className:"hint project-summary",children:[U.n(X.members.length,"person","people")," · ",U.n(X.areas.length,"area","areas"),pe.length>0?` · ${U.n(pe.length,A.toLowerCase(),D.toLowerCase())}`:""]}),I==="map"&&s.jsx("button",{type:"button",className:"btn small",title:U("Lay the cards out again"),onClick:async()=>{for(const me of X.members)(me.x!==null||me.y!==null)&&await d.patchMember(X.id,me.id,{x:null,y:null});for(const me of X.areas)(me.x!==null||me.y!==null)&&await d.patchArea(X.id,me.id,{x:null,y:null})},children:U("Auto-arrange")}),s.jsx("button",{type:"button",className:`icon-btn settings-open ${H?"on":""}`,title:U(b),"aria-label":U(b),"aria-expanded":H,onClick:()=>P(me=>!me),children:"⚙"})]}),I==="map"&&s.jsx(Mz,{project:X,parts:pe,partOf:R,onOpenPart:me=>g(me),companies:r,personById:se,actions:d,memberId:Y,onOpen:q,onOpenArea:L,background:E,onPatchPerson:O}),I==="works"&&s.jsx("div",{className:"project-tasks",children:v(X.id)}),I==="docs"&&s.jsx(Iz,{project:X,isTool:w,fail:C,setStatus:S}),I==="zones"&&s.jsx(Dz,{project:X,people:u,actions:d,tasks:ne,onAreaGone:T.forgetArea,onOpenArea:L})]}):s.jsx("div",{className:"project-main empty-main hint",children:U(w?"Pick a tool on the left, or create one.":"Pick a project on the left, or create one.")}),X&&W&&X.areas.some(me=>me.id===W)&&s.jsx(Oz,{tasks:ne,taskActions:T,isTool:e==="tool",project:X,area:X.areas.find(me=>me.id===W),people:u,actions:d,onClose:()=>L(null),onOpenPerson:m}),X&&H&&s.jsx(Rz,{project:X,companies:r,leadOptions:ge,ownerName:ie(X.ownerCompanyId),leadName:$n(X)?se.get($n(X))?.fullName??"":"",leadLabel:U(w?"Responsible":"Project lead"),partOf:{label:U(w?"Part of the tool":"Part of the project"),name:R?.name??"",options:i.filter(me=>!me.parentId&&me.id!==X.id&&!pe.some(_e=>_e.id===me.id)),locked:pe.length>0},leadField:w?"responsiblePersonId":"leadPersonId",title:U(b),inProject:w?{name:M.find(me=>me.id===X.projectId)?.name??"",options:M}
92:null,background:E,onBackground:j,actions:d,onDelete:()=>Ne(X),onCloseProject:()=>He(X),onClose:()=>P(!1)}),X&&ee&&se.get(ee.personId)&&s.jsx($z,{project:X,member:ee,person:se.get(ee.personId),where:[se.get(ee.personId).title,ie(se.get(ee.personId).companyId)].filter(Boolean).join(" · "),actions:d,onShow:()=>m(ee.personId),onOpenCard:()=>z(ee.personId),onClose:()=>q(null),onPatchPerson:me=>O(ee.personId,me)},ee.id)]})}function Rz({project:e,companies:a,leadOptions:l,ownerName:i,leadName:r,leadLabel:u,leadField:d,title:h,inProject:g,partOf:p,background:x,onBackground:m,actions:v,onDelete:k,onCloseProject:T,onClose:S}){const C=qe(),[z,E]=N.useState(!1),j=15,O=N.useMemo(()=>{const D=jd.slice(0,j);return e.icon&&!D.includes(e.icon)?[...D.slice(0,j-1),e.icon]:D},[e.icon]),[w,b]=N.useState(0);N.useEffect(()=>{const D=()=>b(document.querySelector(".bar")?.getBoundingClientRect().bottom??0);D();const M=U=>{U.key==="Escape"&&S()};return window.addEventListener("keydown",M),window.addEventListener("resize",D),()=>{window.removeEventListener("keydown",M),window.removeEventListener("resize",D)}},[S]);const A=[[C("People"),e.members.length],[C("Areas"),e.areas.length]];return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"panel-scrim",style:{top:w},onClick:S}),s.jsxs("aside",{className:"side-panel",style:{top:w},role:"dialog","aria-label":h,children:[s.jsxs("header",{className:"panel-head",children:[s.jsx("strong",{children:h}),s.jsx("button",{type:"button",className:"icon-btn",title:C("Close"),onClick:S,children:"×"})]}),s.jsxs("div",{className:"panel-body",children:[s.jsxs("section",{className:"panel-group",children:[s.jsxs("div",{className:"panel-row",children:[s.jsx("span",{className:"panel-label",children:C("Owner")}),s.jsx(Qe,{className:"panel-pick",value:e.ownerCompanyId??"",options:[{value:"",label:C("— no owner —")},...a.map(D=>({value:D.id,label:D.name}))],onChange:D=>v.patchProject(e.id,{ownerCompanyId:D||null}),children:s.jsx("span",{className:i?"":"muted",children:i||C("Not set")})})]}),s.jsxs("div",{className:"panel-row",children:[s.jsx("span",{className:"panel-label",children:p.label}),p.locked?s.jsx("span",{className:"hint",children:C("It has parts of its own")}):s.jsx(Qe,{className:"panel-pick",value:e.parentId??"",options:[{value:"",label:C("— on its own —")},...p.options.map(D=>({value:D.id,label:D.name}))],onChange:D=>v.patchProject(e.id,{parentId:D||null}),children:s.jsx("span",{className:p.name?"":"muted",children:p.name||C("On its own")})})]}),g&&s.jsxs("div",{className:"panel-row",children:[s.jsx("span",{className:"panel-label",children:C("Part of the project")}),s.jsx(Qe,{className:"panel-pick",value:e.projectId??"",options:[{value:"",label:C("— on its own —")},...g.options.map(D=>({value:D.id,label:D.name}))],onChange:D=>v.patchProject(e.id,{projectId:D||null}),children:s.jsx("span",{className:g.name?"":"muted",children:g.name||C("On its own")})})]}),s.jsxs("div",{className:"panel-row",children:[s.jsx("span",{className:"panel-label",children:u}),s.jsx(Qe,{className:"panel-pick",value:$n(e)??"",options:[{value:"",label:C("— nobody yet —")},...l.map(D=>({value:D.id,label:D.fullName,sub:D.title,icon:s.jsx(Xe,{person:D,size:22})}))],searchPlaceholder:C("Search a person…"),emptyLabel:C("Nobody matches"),onChange:D=>v.patchProject(e.id,{[d]:D||null}),children:s.jsx("span",{className:r?"":"muted",children:r||C("Not set")})})]}),s.jsxs("div",{className:"panel-row",children:[s.jsx("span",{className:"panel-label",children:C("The assistant")}),s.jsxs("span",{className:"ai-switches",children:[s.jsx("button",{type:"button",className:`chip-toggle ${e.aiReads?"on":""}`,"aria-pressed":e.aiReads,title:C("Whether the assistant is shown this project at all"),onClick:()=>v.patchProject(e.id,{aiReads:!e.aiReads}),children:C("sees the project")}),s.jsx("button",{type:"button",className:`chip-toggle ${e.aiReads&&e.aiReadsTasks?"on":""}`,"aria-pressed":e.aiReadsTasks,disabled:!e.aiReads,title:C("Whether the assistant is shown its tasks"),onClick:()=>v.patchProject(e.id,{aiReadsTasks:!e.aiReadsTasks}),children:C("sees the tasks")})]})]}),s.jsxs("div",{className:"panel-row stacked",children:[s.jsx("span",{className:"panel-label",children:C("Backdrop")}),s.jsx("div",{className:"bg-grid",role:"radiogroup","aria-label":C("Backdrop"),children:sh.map(D=>s.jsx("button",{type:"button",role:"radio","aria-checked":x===D.value,className:`bg-swatch bg-${D.value} ${x===D.value?"on":""}`,title:C(D.label),onClick:()=>
92m(D.value),children:s.jsx("span",{className:"bg-name",children:C(D.label)})},D.value))})]}),s.jsxs("div",{className:"panel-row wide",children:[s.jsx("span",{className:"panel-label",children:C("Icon")}),s.jsxs("div",{className:`icon-pick ${z?"all":""}`,role:"radiogroup","aria-label":C("Icon"),children:[s.jsx("button",{type:"button",role:"radio","aria-checked":!e.icon,className:`icon-swatch none ${e.icon?"":"on"}`,title:C("No icon"),onClick:()=>v.patchProject(e.id,{icon:""}),children:"—"}),(z?jd:O).map(D=>s.jsx("button",{type:"button",role:"radio","aria-checked":e.icon===D,className:`icon-swatch ${e.icon===D?"on":""}`,style:e.color?{color:e.color}:void 0,title:D,onClick:()=>v.patchProject(e.id,{icon:D}),children:s.jsx(Vl,{name:D,size:17})},D))]}),s.jsx("button",{type:"button",className:"link icon-more",onClick:()=>E(D=>!D),children:z?C("Fewer icons"):C("All {n} icons",{n:jd.length})})]}),s.jsxs("div",{className:"panel-row",children:[s.jsx("span",{className:"panel-label",children:C("Color")}),s.jsxs("div",{className:"toolbar-swatches",role:"radiogroup","aria-label":C("Color"),children:[s.jsx("button",{type:"button",role:"radio","aria-checked":e.color===null,className:`dot none ${e.color===null?"on":""}`,title:C("Default color"),onClick:()=>v.patchProject(e.id,{color:null})}),Rs.map(D=>s.jsx("button",{type:"button",role:"radio","aria-checked":e.color===D.value,className:`dot ${e.color===D.value?"on":""}`,style:{background:D.value},title:D.name,onClick:()=>v.patchProject(e.id,{color:D.value})},D.value))]})]})]}),s.jsxs("section",{className:"panel-group",children:[s.jsx("h4",{children:C("In this project")}),A.map(([D,M])=>s.jsxs("div",{className:"panel-row",children:[s.jsx("span",{className:"panel-label",children:D}),s.jsx("span",{className:"panel-num",children:M})]},D))]}),s.jsxs("section",{className:"panel-group",children:[e.closedOn?s.jsxs("button",{type:"button",className:"panel-row",onClick:()=>v.reopenProject(e.id),children:[s.jsx("span",{className:"panel-label",children:C("Open it again")}),s.jsx("span",{className:"hint",children:C("closed {on}",{on:e.closedOn})})]}):s.jsxs("button",{type:"button",className:"panel-row",onClick:T,children:[s.jsx("span",{className:"panel-label",children:C("Close the project")}),s.jsx("span",{className:"hint",children:C("it stays whole")})]}),s.jsxs("button",{type:"button",className:"panel-row danger",onClick:k,children:[s.jsx("span",{className:"panel-label",children:C("Delete project")}),s.jsx("span",{className:"hint",children:C("People stay")})]})]})]})]})]})}function $z({project:e,member:a,person:l,where:i,actions:r,onShow:u,onOpenCard:d,onClose:h,onPatchPerson:g}){const p=qe(),x=_g(),[m,v]=N.useState(a.role),k=z=>r.patchMember(e.id,a.id,z);async function T(){await Dt(p("Remove {name} from the project?",{name:l.fullName}),{okLabel:"Remove",danger:!0})&&(await r.removeMember(e.id,a.id),h())}const S=z=>a.areas.find(E=>E.areaId===z)?.kind??null,C=(z,E)=>{const j=a.areas.filter(O=>O.areaId!==z);k({areas:E?[...j,{areaId:z,kind:E}]:j})};return s.jsxs("aside",{className:"panel member-editor",children:[s.jsxs("div",{className:"panel-body",children:[s.jsxs("section",{className:"panel-section",children:[s.jsxs("div",{className:"section-head",children:[s.jsx("h3",{children:p("In the project")}),s.jsx("button",{type:"button",className:"icon-btn",title:p("Close"),"aria-label":p("Close"),onClick:h,children:"×"})]}),s.jsxs("div",{className:"member-head",children:[s.jsx(Xe,{person:l,size:48}),s.jsxs("div",{children:[s.jsxs("div",{className:"member-name big",children:[l.fullName,l.plannedOut&&s.jsx("span",{className:"card-mark out",title:p("A possible dismissal (what-if)"),children:p("dismissal")}),l.underReview&&s.jsx("span",{className:"card-mark review",title:p("Under review: is this person needed?"),children:"?"})]}),s.jsx("div",{className:"hint",children:i}),s.jsxs("div",{className:"member-links",children:[s.jsx("button",{type:"button",className:"link",onClick:d,children:p("Open the card")}),s.jsx("button",{type:"button",className:"link",onClick:u,children:p("Show on the map")})]})]})]})]}),s.jsxs("section",{className:"panel-section",children:[s.jsxs("div",{className:"field",children:[s.jsx("span",{className:"label",children:p("Involvement")}),s.jsx("div",{className:"tabs",role:"radiogroup","aria-label":p("Involvement"),children:RO.map(z=>s.jsx("button",{type:"button",role:"radio","aria-checked":a.involvement===z,className:a.involvement===z?"on":"",onClick:()=>k({involvement:z}),children:p(z==="core"?"Main work":z==="partial"?"Part of the time":"Advises")},z))})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{className:"label",children:p("Role on the project")}),s.jsx("input",{value:m,onChange:z=>v(z.target.value),onBlur:()=>m!==a.role&&k({role:m}),placeholder:p("e.g. SEO Manager")})]})]}),s.jsxs("section",{className:"panel-section",children:[s.jsx("span",{className:"label",children:p("Areas")}),e.areas.length===0?s.jsx("span",{className:"hint",children:p("No areas in this project yet — add them on the scheme.")}):s.jsx("ul",{className:"area-list",children:e.areas.map(z=>{const E=S(z.id);return s.jsxs("li",{children:[s.jsx("span",{className:"area-list-name",children:z.name}),s.jsx("span",{className:"tabs small",role:"radiogroup","aria-label":z.name,children:[null,"works","owns"].map(j=>s.jsx("button",{type:"button",role:"radio","aria-checked":E===j,className:E===j?"on":"",onClick:()=>E!==j&&C(z.id,j),children:j===null?"—":j==="works"?p("works"):`★ ${p("owns")}`},j??"none"))})]},z.id)})})]})]}),s.jsxs("div",{className:"actions member-actions",children:[x&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:`mark-btn ${l.plannedOut?"on out":""}`,"aria-pressed":l.plannedOut,"aria-label":p("✂ Dismiss?"),title:l.plannedOut?p("Keep this person (clear the mark)"):p("What-if: a possible dism
92issal — stays on the map, out of the totals"),onClick:()=>g({plannedOut:!l.plannedOut}),children:"✂"}),s.jsx("button",{type:"button",className:`mark-btn ${l.underReview?"on review":""}`,"aria-pressed":l.underReview,"aria-label":p("? Under review"),title:l.underReview?p("Decided: remove the question mark"):p("Under review: not sure yet whether this person is needed"),onClick:()=>g({underReview:!l.underReview}),children:"?"})]}),s.jsx("button",{type:"button",className:"btn danger",onClick:T,children:p("Remove from project")})]})]})}function nj({label:e,placeholder:a,onDone:l}){const[i,r]=N.useState(!1),[u,d]=N.useState("");if(!i)return s.jsx("button",{type:"button",className:"btn small",onClick:()=>{d(""),r(!0)},children:e});const h=()=>{u.trim()&&l(u.trim()),r(!1),d("")};return s.jsx("input",{className:"name-it",autoFocus:!0,value:u,placeholder:a,onChange:g=>d(g.target.value),onBlur:h,onKeyDown:g=>{g.key==="Enter"&&h(),g.key==="Escape"&&(r(!1),d(""))}})}function Lz({value:e,onChange:a,people:l,companyName:i,onPick:r}){const u=qe(),[d,h]=N.useState(!1),[g,p]=N.useState(0),x=e.toLowerCase().split(/\s+/).filter(Boolean),m=T=>`${T.fullName} ${T.title} ${i(T.companyId)}`.toLowerCase(),v=x.length?l.filter(T=>x.every(S=>m(T).includes(S))):l;N.useEffect(()=>p(0),[e]);const k=T=>{h(!1),r(T)};return s.jsxs("span",{className:`suggest person-picker ${d?"open":""}`,children:[s.jsx("span",{className:"picker-icon","aria-hidden":"true",children:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"9",cy:"7",r:"4"}),s.jsx("line",{x1:"19",y1:"8",x2:"19",y2:"14"}),s.jsx("line",{x1:"22",y1:"11",x2:"16",y2:"11"})]})}),s.jsx("input",{value:e,placeholder:u("Add a person to the project…"),onChange:T=>{a(T.target.value),h(!0)},onFocus:()=>h(!0),onBlur:()=>setTimeout(()=>h(!1),150),onKeyDown:T=>{T.key==="ArrowDown"?(T.preventDefault(),p(S=>Math.min(S+1,v.length-1)),h(!0)):T.key==="ArrowUp"?(T.preventDefault(),p(S=>Math.max(S-1,0))):T.key==="Enter"&&d&&v[g]?(T.preventDefault(),k(v[g])):T.key==="Escape"&&h(!1)}}),e&&s.jsx("button",{type:"button",className:"picker-clear","aria-label":u("Clear"),onMouseDown:T=>T.preventDefault(),onClick:()=>a(""),children:"×"}),d&&s.jsxs("ul",{className:"suggest-list picker-list",role:"listbox",children:[v.map((T,S)=>s.jsxs("li",{role:"option","aria-selected":S===g,className:S===g?"on":"",onMouseDown:C=>C.preventDefault(),onClick:()=>k(T),children:[s.jsx(Xe,{person:T,size:24}),s.jsxs("span",{className:"picker-main",children:[s.jsx("span",{className:"picker-name",children:T.fullName}),s.jsx("span",{className:"picker-sub",children:[T.title,i(T.companyId)].filter(Boolean).join(" · ")})]})]},T.id)),v.length===0&&s.jsx("li",{className:"picker-empty",children:u("Nobody matches")})]})]})}function ok(){return s.jsxs("svg",{className:"logo",viewBox:"0 0 32 32",width:"26",height:"26","aria-hidden":"true",children:[s.jsx("rect",{width:"32",height:"32",rx:"7",fill:"var(--holding)"}),s.jsx("rect",{x:"12.5",y:"5",width:"7",height:"7",rx:"1.8",fill:"var(--accent)"}),s.jsx("rect",{x:"4",y:"20",width:"7",height:"7",rx:"1.8",fill:"var(--holding-ink)"}),s.jsx("rect",{x:"21",y:"20",width:"7",height:"7",rx:"1.8",fill:"var(--holding-ink)"}),s.jsx("path",{d:"M16 12v3.5M7.5 20v-2a2.5 2.5 0 0 1 2.5-2.5h12a2.5 2.5 0 0 1 2.5 2.5v2",fill:"none",stroke:"var(--holding-ink)",strokeWidth:"1.8",strokeLinecap:"round"})]})}const yp={planner:"▦",notices:"◉",team:"⊞",departments:"⊟",map:"◎",projects:"◆",tools:"◈",planning:"◇",tasks:"☑",recurring:"↻",stats:"▤",settings:"⚙"},Eo={planner:"Planner",notices:"Notifications",team:"Team",departments:"Departments",map:"Map",projects:"Projects",tools:"Tools",planning:"Planning",tasks:"Tasks",recurring:"Recurring",stats:"Insights",settings:"Settings"},Uz=["planner","planning","tasks","projects","tools","team","map","departments","stats"],aj={planning:"planning.read",tasks:"tasks.read",projects:"projects.read",tools:"tools.read",team:"team.read",map:"map.read",departments:"departments.read",stats:"insights.read"},Hz=["settings"],Bz=new Set(["projects","tools"]),xp=3,Pz=new Set(["projects","tools","tasks"]),Ai=e=>e==="recurring"?"tasks":e,So=e=>!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&e.button===0;
92function Yz(e){const a=qe(),l=new Date(PI).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}),i=w=>w==="projects"?e.counts.projects:w==="tools"?e.counts.tools:0,[r,u]=N.useState(""),[d,h]=N.useState(""),[g,p]=N.useState(!1),[x,m]=N.useState(()=>new Set([Ai(e.tab)]));N.useEffect(()=>{m(w=>w.has(Ai(e.tab))?w:new Set([...w,Ai(e.tab)]))},[e.tab]);const v=w=>m(b=>{const A=new Set(b);return A.has(w)?A.delete(w):A.add(w),A});N.useEffect(()=>u(""),[e.tab]);const k=r.trim().toLowerCase(),T=w=>{const b=M=>M.name.toLowerCase().includes(k),A=M=>M.closed&&M.id!==e.selectedProjectId,D=[];for(const M of w.filter(U=>!U.parentId)){const U=w.filter(W=>W.parentId===M.id);if(!k){if(A(M)&&U.every(A))continue;D.push({item:M,dim:!!M.closed},...U.filter(W=>!A(W)).map(W=>({item:W,dim:!!W.closed})));continue}const Y=b(M),q=U.filter(b);!Y&&!q.length||D.push({item:M,dim:!Y},...(Y?U:q).map(W=>({item:W,dim:!1})))}return D},S=e.taskItems.filter(w=>w.id!=="all"&&w.id!=="mine"&&w.id!=="recurring"),C=d.trim().toLowerCase(),z=C?S.filter(w=>`${w.name} ${w.company}`.toLowerCase().includes(C)):S,E=C||g?z:z.slice(0,xp),j=C||g?0:z.length-E.length,O=w=>Kn(w==="recurring"?{tab:"recurring"}:w==="all"?{tab:"tasks"}:w==="mine"?{tab:Ai(e.tab)==="tasks"?e.tab:"tasks",view:"mine"}:{tab:Ai(e.tab)==="tasks"?e.tab:"tasks",dept:w});return s.jsxs("nav",{className:`rail ${e.collapsed?"narrow":""}`,"aria-label":a("Sections"),children:[s.jsxs("a",{className:"rail-brand",href:Kn({tab:"planner"}),title:a("Planner"),onClick:w=>{So(w)&&(w.preventDefault(),e.onTab("planner"))},children:[s.jsx(ok,{}),!e.collapsed&&s.jsxs("span",{className:"rail-name",children:[Og,s.jsx("span",{className:"rail-ver",title:a("Built {when}",{when:l}),children:BI})]})]}),s.jsx("ul",{children:Uz.filter(w=>!aj[w]||an(e.me,aj[w])).map(w=>s.jsxs("li",{children:[Pz.has(w)?s.jsxs("button",{type:"button",className:`rail-item ${Ai(e.tab)===w?"on":""} ${x.has(w)?"unfolded":""}`,"aria-expanded":x.has(w),title:e.collapsed?a(Eo[w]):void 0,onClick:()=>v(w),children:[s.jsx("span",{className:"rail-icon","aria-hidden":"true",children:yp[w]}),!e.collapsed&&s.jsx("span",{className:"rail-label",children:a(Eo[w])}),i(w)>0&&s.jsx("span",{className:"rail-count",children:i(w)}),!e.collapsed&&s.jsx("span",{className:"rail-caret","aria-hidden":"true",children:"▸"})]}):s.jsxs("a",{className:`rail-item ${e.tab===w?"on":""}`,"aria-current":e.tab===w,href:Kn({tab:w}),title:e.collapsed?a(Eo[w]):void 0,onClick:b=>{So(b)&&(b.preventDefault(),e.onTab(w))},children:[s.jsx("span",{className:"rail-icon","aria-hidden":"true",children:yp[w]}),!e.collapsed&&s.jsx("span",{className:"rail-label",children:a(Eo[w])}),i(w)>0&&s.jsx("span",{className:"rail-count",children:i(w)})]}),w==="planner"&&s.jsxs("a",{className:`rail-item ${e.tab==="notices"?"on":""}`,"aria-current":e.tab==="notices",href:Kn({tab:"notices"}),title:e.collapsed?a("Notifications"):void 0,onClick:b=>{So(b)&&(b.preventDefault(),e.onTab("notices"))},children:[s.jsx("span",{className:"rail-icon","aria-hidden":"true",children:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-2 8-2 8h16s-2-1-2-8"}),s.jsx("path",{d:"M13.7 20a2 2 0 0 1-3.4 0"})]})}),!e.collapsed&&s.jsx("span",{className:"rail-label",children:a("Notifications")}),e.noticeCount>0&&s.jsx("span",{className:`rail-count ${e.noticeLate?"late":""}`,children:e.noticeCount})]}),w==="map"&&e.tab==="map"&&s.jsxs("button",{type:"button",className:`rail-sub ${e.mapMenuOpen?"on":""}`,onClick:e.onToggleMapMenu,title:a("Companies, background, layout"),children:[s.jsx("span",{className:"rail-icon","aria-hidden":"true",children:"☰"}),!e.collapsed&&s.jsx("span",{className:"rail-label",children:a("Map menu")}),e.hiddenCount>0&&s.jsx("span",{className:"rail-count",children:e.hiddenCount})]}),w==="tasks"&&x.has("tasks")&&s.jsxs(s.Fragment,{children:[e.taskItems.filter(b=>b.id==="all"||b.id==="mine"||b.id==="recurring").map(b=>s.jsxs("a",{className:`rail-sub ${b.id===e.selectedTaskId?"on":""}`,href:O(b.id),onClick:A=>{So(A)&&(A.preventDefault(),e.onPickTask(b.id))},title:b.name,children:[s.jsx("span",{className:"rail-icon","aria-hidden":"true",children:b.id==="recurring"?"↻":b.id==="mine"?"☆":"∷"}),!e.collapsed&&s.jsx("span",{className:"rail-label",children:b.name}),b.late>0?s.jsx("span",{className:"rail-count late",children:b.late}):b.count>0?s.jsx("span",{className:"rail-count",children:b.count}):null]},b.id)),S.length>0&&!e.collapsed&&s.jsxs("div",{className:"rail-group",children:[s.jsx("span",{className:"rail-group-head",children:a("Departments")}),S.length>xp&&s.jsx("input",{className:"rail-find",value:d,onChange:b=>h(b.target.value),placeholder:a("Find a department"),"aria-label":a("Find a department")}),E.map(b=>s.jsxs("a",{className:`rail-sub dept ${b.id===e.selectedTaskId?"on":""}`,href:O(b.id),onClick:A=>{So(A)&&(A.preventDefault(),e.onPickTask(b.id))},title:b.name,children:[s.jsx("span",{className:"rail-dot","aria-hidden":"true"}),s.jsxs("span",{className:"rail-label stacked",children:[s.jsx("span",{className:"rail-name-line",children:b.name}),b.company&&s.jsx("span",{className:"rail-note",children:b.company})]}),b.late>0?s.jsx("span",{className:"rail-count late",children:b.late}):b.count>0?s.jsx("span",{className:"rail-count",children:b.count}):null]},b.id)),j>0&&s.jsx("button",{type:"button",className:"rail-more",onClick:()=>p(!0),children:a("show all ({n})",{n:S.length})}),g&&S.length>
92xp&&!C&&s.jsx("button",{type:"button",className:"rail-more collapse",onClick:()=>p(!1),children:a("show fewer")}),E.length===0&&s.jsx("span",{className:"rail-empty",children:a("Nothing matches")})]})]}),Bz.has(w)&&x.has(w)&&s.jsxs(s.Fragment,{children:[!e.collapsed&&s.jsx("input",{className:"rail-find",value:r,onChange:b=>u(b.target.value),placeholder:a(w==="projects"?"Find a project":"Find a tool"),"aria-label":a(w==="projects"?"Find a project":"Find a tool"),onKeyDown:b=>{const A=T(w==="projects"?e.projects:e.tools)[0];b.key==="Enter"&&A&&e.onPickProject(A.item.id,w==="tools"?"tools":"projects"),b.key==="Escape"&&u("")}}),T(w==="projects"?e.projects:e.tools).map(({item:b,dim:A})=>s.jsxs("a",{className:`rail-sub ${b.parentId?"part":""} ${A?"dim":""} ${b.id===e.selectedProjectId?"on":""}`,href:Kn({tab:w,projectId:b.id}),onClick:D=>{So(D)&&(D.preventDefault(),e.onPickProject(b.id,w==="tools"?"tools":"projects"))},title:b.name,children:[b.icon?s.jsx("span",{className:"rail-mark",style:{color:b.color??"var(--accent)"},"aria-hidden":"true",children:s.jsx(Vl,{name:b.icon,size:15})}):s.jsx("span",{className:"rail-dot",style:{background:b.color??"var(--accent)"},"aria-hidden":"true"}),!e.collapsed&&s.jsx("span",{className:"rail-label",children:b.name})]},b.id)),!e.collapsed&&k&&T(w==="projects"?e.projects:e.tools).length===0&&s.jsx("p",{className:"rail-empty",children:a("Nothing matches")}),an(e.me,w==="projects"?"projects.create":"tools.create")&&s.jsxs("button",{type:"button",className:"rail-sub add",onClick:w==="projects"?e.onNewProject:e.onNewTool,title:a(w==="projects"?"+ Project":"+ Tool"),children:[s.jsx("span",{className:"rail-icon","aria-hidden":"true",children:"+"}),!e.collapsed&&s.jsx("span",{className:"rail-label",children:a(w==="projects"?"+ Project":"+ Tool")})]})]})]},w))}),s.jsxs("div",{className:"rail-foot",children:[Hz.map(w=>s.jsxs("a",{className:`rail-item ${e.tab===w?"on":""}`,href:Kn({tab:w}),title:e.collapsed?a(Eo[w]):void 0,onClick:b=>{So(b)&&(b.preventDefault(),e.onTab(w))},children:[s.jsx("span",{className:"rail-icon","aria-hidden":"true",children:yp[w]}),!e.collapsed&&s.jsx("span",{className:"rail-label",children:a(Eo[w])})]},w)),s.jsxs("button",{type:"button",className:"rail-item",onClick:e.onSignOut,title:`${a("Sign out")} — ${e.me.name?`${e.me.name} · ${e.me.email}`:e.me.email}`,children:[s.jsx("span",{className:"rail-icon","aria-hidden":"true",children:"⎋"}),!e.collapsed&&s.jsx("span",{className:"rail-label",children:a("Sign out")})]}),s.jsxs("button",{type:"button",className:"rail-item",onClick:e.onToggleCollapsed,title:e.collapsed?a("Expand the menu"):a("Collapse the menu"),children:[s.jsx("span",{className:"rail-icon","aria-hidden":"true",children:e.collapsed?"»":"«"}),!e.collapsed&&s.jsx("span",{className:"rail-label",children:a("Collapse")})]})]})]})}function Vz({setStatus:e,fail:a}){const[l,i]=N.useState([]),r=N.useCallback(()=>Se.listAssignments().then(i).then(()=>{}),[]),u=N.useCallback(x=>{a(x),r().catch(()=>{})},[a,r]),d=N.useCallback(async x=>{try{const m=await Se.createAssignment(x);return i(v=>[...v,m]),e("Added"),m}catch(m){return a(m),null}},[a,e]),h=N.useCallback(async(x,m)=>{i(v=>v.map(k=>k.id===x?{...k,...m}:k));try{const v=await Se.updateAssignment(x,m);i(k=>k.map(T=>T.id===x?v:T)),e("Saved")}catch(v){u(v)}},[u,e]),g=N.useCallback(async x=>{try{await Se.deleteAssignment(x),i(m=>m.filter(v=>v.id!==x)),e("Removed")}catch(m){u(m)}},[u,e]),p=N.useMemo(()=>({add:d,patch:h,remove:g}),[d,h,g]);return{assignments:l,load:r,actions:p}}function qz({onSignedIn:e}){const a=qe(),[l,i]=N.useState(void 0),[r,u]=N.useState(null),[d,h]=N.useState(!1),g=N.useRef(null);N.useEffect(()=>{Se.ssoConfig().then(x=>i(x.url),x=>{i(null),u(x.message)})},[]),N.useEffect(()=>{if(!l)return;const x=async m=>{if(m.origin!==l||m.source!==g.current)return;const v=m.data;if(!(!v||v.status!=="ok"||typeof v.token!="string")){g.current?.close(),g.current=null,h(!0),u(null);try{e(await Se.sso(v.token))}catch(k){u(k instanceof Error?k.message:"Something went wrong")}finally{h(!1)}}};return window.addEventListener("message",x),()=>window.removeEventListener("message",x)},[l,e]);const p=()=>
92{if(!l)return;u(null);const x=500,m=600,v=Math.max(0,window.screenX+(window.outerWidth-x)/2),k=Math.max(0,window.screenY+(window.outerHeight-m)/2),T=window.open(`${l}/sso/login?origin=${encodeURIComponent(window.location.origin)}`,"orgami-sso",`popup,width=${x},height=${m},left=${v},top=${k}`);if(!T)return u("The sign-in window was blocked — allow pop-ups for this site");g.current=T,T.focus()};return s.jsx("div",{className:"login",children:s.jsxs("div",{className:"login-card",children:[s.jsxs("div",{className:"brand",children:[s.jsx(ok,{}),Og]}),l===null&&!r?s.jsx("p",{className:"error",children:a("Sign-in is not set up on this server: the admin panel is not configured.")}):s.jsx("button",{type:"button",className:"btn primary",disabled:!l||d,onClick:p,children:d||l===void 0?"…":a("Sign in through the admin panel")}),r&&s.jsx("p",{className:"error",children:a(r)})]})})}function vp(e,a){const l=[],i=new RegExp("(\\*\\*|__)(.+?)\\1|(\\*|_)(?!\\s)(.+?)(?<!\\s)\\3|`([^`]+)`|(https?:\\/\\/[^\\s)]+)","g");let r=0;for(let u=i.exec(e);u;u=i.exec(e)){u.index>r&&l.push(e.slice(r,u.index));const d=`${a}-${u.index}`;u[2]!==void 0?l.push(s.jsx("strong",{children:u[2]},d)):u[4]!==void 0?l.push(s.jsx("em",{children:u[4]},d)):u[5]!==void 0?l.push(s.jsx("code",{children:u[5]},d)):u[6]!==void 0&&l.push(s.jsx("a",{href:u[6],target:"_blank",rel:"noreferrer",children:u[6]},d)),r=u.index+u[0].length}return r<e.length&&l.push(e.slice(r)),l}const sj=/^\s*[-*•]\s+/,lj=/^\s*\d+[.)]\s+/;function Gz({text:e}){const a=e.split(`
93`),l=[];let i=0,r=[],u=null;const d=()=>{r.length&&l.push(s.jsx("p",{children:vp(r.join(" "),`p${l.length}`)},`p${l.length}`)),r=[]},h=()=>{if(!u)return;const g=u.items.map((p,x)=>s.jsx("li",{children:vp(p,`l${l.length}-${x}`)},x));l.push(u.ordered?s.jsx("ol",{children:g},`l${l.length}`):s.jsx("ul",{children:g},`l${l.length}`)),u=null};for(const g of a){const p=g.trimEnd();if(!p.trim()){d(),h();continue}const x=p.match(/^(#{1,6})\s+(.*)$/);if(x){d(),h();const k=Math.min(x[1].length,4),T=["h2","h2","h3","h4"][k-1]??"h4";l.push(s.jsx(T,{id:`h-${i++}`,className:`rt-h${k}`,children:vp(x[2],`h${l.length}`)},`h${l.length}`));continue}const m=sj.test(p),v=!m&&lj.test(p);if(m||v){d();const k=p.replace(m?sj:lj,"");u&&u.ordered===v?u.items.push(k):(h(),u={ordered:v,items:[k]});continue}h(),r.push(p)}return d(),h(),s.jsx("div",{className:"rt",children:l})}const Xz=["What does payroll look like?","Who has no manager?","Add a person to Affiliate Prime","Which project areas have no owner?"],Zz={create:"Create",update:"Change",delete:"Delete"},bp=()=>crypto.randomUUID?crypto.randomUUID():`m${Date.now()}-${Math.random().toString(36).slice(2)}`;function Fz({where:e,context:a,readOnly:l,onApplied:i,onClose:r}){const u=qe(),[d,h]=N.useState([]),[g,p]=N.useState(""),[x,m]=N.useState(!1),[v,k]=N.useState(null),[T,S]=N.useState(null),[C,z]=N.useState(null),[E,j]=N.useState(null),O=N.useRef(new Map),w=N.useRef(null),b=N.useRef(null);N.useEffect(()=>{const _=()=>{const H=b.current;H&&(H.style.height="auto",H.style.height=`${Math.min(H.scrollHeight+2,Math.max(120,Math.round(window.innerHeight*.33)))}px`)};return _(),window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[g]),N.useEffect(()=>{b.current?.focus()},[]),N.useEffect(()=>{w.current?.scrollTo({top:w.current.scrollHeight,behavior:"smooth"})},[d]);async function A(){j([]);try{j(await Se.assistantThreads())}catch{j([])}}async function D(_){j(null),m(!0);try{const H=await Se.assistantThread(_);O.current=new Map,h(H.map(P=>{const X=bp();return O.current.set(X,P.id),P.role==="user"?{id:X,role:"user",text:P.text}:{id:X,role:"assistant",text:P.text,actions:P.actions,where:P.where}})),z(_),k(null)}finally{m(!1)}}function M(){h([]),z(null),j(null),k(null),O.current=new Map,b.current?.focus()}async function U(_){const H=_.trim();if(!H||x)return;p(""),m(!0);const P=bp(),X=[...d.filter(ne=>ne.role==="user"||!ne.pending&&!ne.error).map(ne=>{if(ne.role==="user")return{role:"user",content:ne.text};const pe=(ne.actions??[]).map(R=>R.state==="applied"?`[применено] ${R.summary||R.title}`:R.state==="rejected"?`[отклонено] ${R.title}`:`[предложено] ${R.title}${R.detail?` · ${R.detail}`:""}`);
93return{role:"assistant",content:[ne.text,...pe].filter(Boolean).join(`
94`)}}).filter(ne=>ne.content.trim()),{role:"user",content:H}];h(ne=>[...ne,{id:bp(),role:"user",text:H},{id:P,role:"assistant",text:"",pending:!0}]);try{const ne=await Se.assistantChat(X,e,C,a);k(ne.usage),z(ne.threadId),O.current.set(P,ne.messageId),h(pe=>pe.map(R=>R.id===P?{id:R.id,role:"assistant",text:ne.text,actions:ne.actions.map(Q=>({...Q,state:"proposed"})),where:e}:R))}catch(ne){const pe=ne instanceof Error?ne.message:"Something went wrong";h(R=>R.map(Q=>Q.id===P?{id:Q.id,role:"assistant",text:"",error:pe}:Q))}finally{m(!1)}}const Y=(_,H)=>h(P=>P.map(X=>X.role==="assistant"&&X.actions?{...X,actions:X.actions.map(ne=>ne.id===_?{...ne,...H}:ne)}:X)),q=_=>{const H=d.find(P=>P.role==="assistant"&&P.actions?.some(X=>X.id===_));return H?O.current.get(H.id):void 0};function W(_,H={}){const P=d.find(ne=>ne.role==="assistant"&&ne.actions?.some(pe=>pe.id===_)),X={};return P&&P.role==="assistant"&&P.actions?.forEach((ne,pe)=>ne.createdId&&(X[`#${pe+1}`]=ne.createdId)),{...X,...H}}async function L(_,H={}){S(_.id);try{const P=await Se.assistantApply(_.tool,_.args,_.title,{messageId:q(_.id),actionId:_.id,refs:W(_.id,H)});return Y(_.id,{state:"applied",error:void 0,summary:P.summary,createdId:P.createdId}),i(_),{ok:!0,id:P.createdId}}catch(P){return Y(_.id,{state:"failed",error:P instanceof Error?P.message:"Something went wrong"}),{ok:!1}}finally{S(null)}}function V(_){Y(_.id,{state:"rejected"});const H=q(_.id);H&&Se.assistantSkip(H,_.id).catch(()=>{})}const I=(_,H)=>{if(_.role!=="assistant"||!_.actions)return null;const P=_.actions.filter(X=>X.state==="proposed"||X.state==="failed");return P.length<2||H==="bottom"&&P.length<3?null:s.jsxs("div",{className:`action-bulk ${H}`,children:[s.jsx("button",{type:"button",className:"btn small primary",disabled:l||!!T,onClick:()=>F(_.actions),children:u("Apply all ({n})",{n:P.length})}),s.jsx("button",{type:"button",className:"btn small",disabled:!!T,onClick:()=>_.actions.filter(X=>X.state==="proposed").forEach(V),children:u("Skip all")})]})};async function F(_){const H={};for(const[P,X]of _.entries()){if(!((X.state==="proposed"||X.state==="failed")&&!X.warning))continue;const ne=await L(X,H);if(!ne.ok)break;ne.id&&(H[`#${P+1}`]=ne.id)}}return s.jsxs("aside",{className:"assistant","aria-label":u("Assistant"),children:[s.jsxs("header",{className:"assistant-head",children:[s.jsxs("div",{className:"assistant-head-main",children:[s.jsxs("h3",{children:[u("Assistant"),s.jsx("button",{type:"button",className:"link",onClick:()=>E?j(null):A(),children:u(E?"back":"history")}),d.length>0&&s.jsx("button",{type:"button",className:"link",onClick:M,children:u("new chat")})]}),s.jsxs("p",{className:"hint",children:[u("Sees: {where}",{where:e}),v&&` · ${v.cost>0?`$${v.cost.toFixed(3)} · `:""}${(v.promptTokens+v.completionTokens).toLocaleString("en-US")} ${u("tokens")} · ${(v.ms/1e3).toFixed(1)}s`]})]}),s.jsx("button",{type:"button",className:"icon-btn",title:u("Close"),"aria-label":u("Close"),onClick:r,children:"×"})]}),E?s.jsxs("div",{className:"assistant-list",children:[s.jsx("p",{className:"hint",children:u("Past conversations, with the page they happened on.")}),s.jsxs("ul",{className:"thread-list",children:[E.map(_=>s.jsxs("li",{children:[s.jsxs("button",{type:"button",className:`thread-row ${_.id===C?"on":""}`,onClick:()=>D(_.id),children:[s.jsx("span",{className:"thread-title",children:_.title||u("Without a question")}),s.jsxs("span",{className:"thread-sub",children:[_.where||u("Map")," · ",new Date(_.at).toLocaleString(u.lang==="ru"?"ru-RU":"en-GB",{dateStyle:"short",timeStyle:"short"})," · ",u.n(_.questions,"question","questions")]})]}),s.jsx("button",{type:"button",className:"icon-btn tiny",title:u("Delete"),"aria-label":u("Delete"),onClick:async()=>{await Se.assistantDeleteThread(_.id).catch(()=>{}),j(H=>(H??[]).filter(P=>P.id!==_.id)),_.id===C&&M()},children:"×"})]},_.id)),E.length===0&&s.jsx("li",{className:"hint",children:u("Nothing yet.")})]})]}):s.jsxs("div",{className:"assistant-list",ref:w,children:[d.length===0&&s.jsxs("div",{className:"assistant-empty",children:[s.jsx("p",{className:"hint",children:u("Ask about the structure, or say what to change — every change is shown as a card and applied only after you confirm it. The data (names, titles, salaries if you may see them) is sent to OpenAI with each question.")}),s.jsx("div",{className:"assistant-chips",children:Xz.map(_=>s.jsx("button",{type:"button",className:"assistant-chip",onClick:()=>U(u(_)),children:u(_)},_))})]}),d.map((_,H)=>s.jsxs("div",{className:`bubble ${_.role==="user"?"from-user":"from-bot"}`,children:[_.role==="assistant"&&_.where&&_.where!==d.slice(0,H).reverse().find(P=>P.role==="assistant")?.where&&s.jsx("span",{className:"bubble-where",children:_.where}),_.role==="assistant"&&_.error?s.jsx("p",{className:"error",children:u(_.error)}):_.role==="assistant"&&_.pending?s.jsxs("span",{className:"dots","aria-label":u("Thinking…"),children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}):_.role==="assistant"?s.jsx(Gz,{text:_.text}):s.jsx("p",{children:_.text}),I(_,"top"),_.role==="assistant"&&_.actions?.map(P=>s.jsxs("div",{className:`action-card ${P.kind} ${P.state}`,children:[s.jsxs("div",{className:"action-head",children:[s.jsx("span",{className:`action-kind ${P.kind}`,children:u(Zz[P.kind])}),s.jsx("span",{className:"action-title",children:P.title})]}),P.detail&&s.jsx("p",{className:"hint",children:P.detail}),P.warning&&P.state!=="applied"&&s.jsx("p",{className:"action-warning",children:P.warning}),P.state==="proposed"||P.state==="failed"?s.jsxs("div",{className:"action-buttons",children:[s.jsx("button",{type:"button",className:`btn small ${P.risky?"danger":"primary"}`,disabled:l||T===P.id,title:l?u("View only"):void 0,onClick:()=>L(P),children:T===P.id?"…":P.risky?u("Yes, delete"):P.state==="failed"?u("Try again"):u("Apply")}),s.jsx("button",{type:"button",className:"btn small",onClick:()=>V(P),children:u("Skip")}),l&&s.jsx("span",{className:"hint",children:u("View only")}),P.error&&s.jsx("span",{className:"error",children:u(P.error)})]}):s.jsx("p",{className:"action-state hint",children:P.state==="applied"?`${u("Applied")}${P.summary&&P.summary!==P.title?` · ${P.summary.replace(`${P.title} — `,"")}`:""}`:u("Skipped")})]},P.id)),I(_,"bottom")]},_.id))]}),s.jsxs("form",{className:"assistant-composer",onSubmit:_=>{_.preventDefault(),U(g)},children:[s.jsx("textarea",{ref:b,rows:1,value:g,placeholder:u("Ask, or say what to change…"),onChange:_=>p(_.target.value),onKeyDown:_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),U(g)),_.key==="Escape"&&_.stopPropagation()}}),s.jsxs("div",{className:"composer-foot",children:[s.jsx("span",{className:"hint",children:u("Enter sends · Shift+Enter is a new line")}),s.jsx("button",{type:"submit",className:"btn primary",disabled:x||!g.trim(),children:u("Send")})]})]})]})}const Kz={company:j3,department:b3,person:N3},Qz={link:A3},Wz=[8,8],oj="orgami:rail",wp="orgami:project",ij={map:"map",projects:"projects",tools:"tools",departments:"departments",team:"team",planning:"planning"},jp="orgami:tool";function rj(e,a,l){const i=D1(a,l),r=gw(e.sourceHandle),u=gw(e.targetHandle);return{...r&&r!==i.from?{from:r}:{},...u&&u!==i.to?{to:u}:{}}}function Jz(){const{route:e,go:a}=U4(),l=N.useRef(e);l.current=e,N.useEffect(()=>{e.personId&&window.location.pathname.startsWith("/team/")&&a({tab:"team",personId:e.personId},{replace:!0})},[e.personId,a]);const i=e.tab,r=N.useRef(i);r.current=i;const u=N.useCallback(B=>a({tab:B,projectId:(B==="projects"||B==="tools")&&localStorage.getItem(B==="tools"?jp:wp)||null}),[a]),[d,h]=N.useState([]),[g,p]=N.useState([]),[x,m]=N.useState([]),[v,k]=N.useState([]),T=N.useRef(x);T.current=x;
94const[S,C]=N.useState(!1),[z,E]=N.useState(45),[j,O]=N.useState(1.148),w=N.useMemo(()=>({uah:z,eur:j}),[z,j]),[b,A]=N.useState(!1),[D,M]=N.useState(void 0),U=N.useRef(D);U.current=D,N.useEffect(()=>{Se.me().then(M,()=>M(null));const B=()=>M(null);return window.addEventListener("orgami:signed-out",B),()=>window.removeEventListener("orgami:signed-out",B)},[]);const Y=b||!D?.seeMoney,q=D?.money!==!1,W=!an(D,"map.update"),L=Yd(D)&&an(D,"map.update")&&an(D,"map.create"),[V,I]=N.useState({tags:[],titles:[],departments:[]}),F=N.useRef(V);F.current=V;const[_,H]=N.useState(()=>{try{const B=localStorage.getItem(Fw);return B==="right"||B==="down"?B:"down"}catch{return"down"}}),P=N.useRef(_);P.current=_;const[X,ne]=N.useState(null),[pe,R]=N.useState(null),[Q,le]=N.useState(new Set),[se,ie]=N.useState(()=>hp(Oi)),[K,ue]=N.useState(()=>hp(cd)),[xe,Ne]=N.useState(()=>hp(Wr)),[He,ee]=N.useState(!1),[ge,Le]=N.useState(!1),[me,_e]=N.useState(!1);N.useEffect(()=>_e(!1),[i]);const ke=i==="tools"?jp:wp,re=e.projectId??((i==="projects"||i==="tools")&&localStorage.getItem(ke)||null),te=N.useRef(re);te.current=re;const Ce=N.useCallback((B,J=!1,oe)=>{const be=oe??(r.current==="tools"?"tools":"projects");ud(be==="tools"?jp:wp,B??"");const De=B===l.current.projectId;a({tab:be,projectId:B,view:De?l.current.view:null},{replace:J})},[a]),[Ee,Re]=N.useState(()=>{try{return localStorage.getItem(oj)==="narrow"}catch{return!1}}),[Ke,mt]=N.useState(FI),[dt,En]=N.useState(ZI),Ue=N.useMemo(()=>M1(dt),[dt]),ea=N.useCallback(B=>{En(B),ud(T1,B)},[]),[Ae,Be]=N.useState(""),[st,_t,gn]=FN([]),{fitView:ut,getNodes:ta}=Zi(),Et=N.useRef(null),qt=N.useRef(null),Tn=N.useRef(null),Ln=N.useRef(st);Ln.current=st;const Ht=N.useRef(d);Ht.current=d;const pt=N.useRef(g);pt.current=g;const gt=N.useCallback(B=>Be(B instanceof Error?B.message:"Something went wrong"),[]),{fullscreen:Un,toggle:Ls}=pz(Be),{projects:sn,load:Ta,actions:Qt}=tj({base:"projects",setStatus:Be,fail:gt}),{projects:Bt,load:Jt,actions:ys}=tj({base:"tools",setStatus:Be,fail:gt}),qa=i==="tools"?"tool":"project",Us=i==="tools"?Bt:sn,Ma=i==="tools"?ys:Qt,yn=N.useMemo(()=>[...sn,...Bt],[sn,Bt]),na=N.useRef(yn);na.current=yn;const wn=N.useCallback(B=>a({tab:na.current.some(J=>J.id===B)&&!sn.some(J=>J.id===B)?"tools":"projects",projectId:B}),[a,sn]),{assignments:Rt,load:Da,actions:Ga}=Vz({setStatus:Be,fail:gt}),{tasks:Gt,groups:Xa,load:ln,actions:Mn}=gz({setStatus:Be,fail:gt}),jn=bz(Gt,D?.personId),Hs=jn.markRead;N.useEffect(()=>{e.taskId&&Hs(e.taskId)},[e.taskId,Hs]);const Bs=N.useMemo(()=>{const B=Gt.filter(we=>i==="recurring"?we.kind==="recurring":we.kind==="once"&&Wn(we.state)),J=Gt.filter(we=>i==="recurring"?we.kind==="once"&&Wn(we.state):we.kind==="recurring"),oe=x.map(we=>{const ze=B.filter(Ve=>Ve.departmentId===we.id);return{id:we.id,name:we.name,company:d.find(Ve=>Ve.id===we.companyId)?.name??"",count:ze.length,late:ze.filter(Ve=>Ve.late).length}}).sort((we,ze)=>ze.late-we.late||ze.count-we.count||we.name.localeCompare(ze.name)),be=B.filter(we=>!we.departmentId),De=D?.personId?B.filter(we=>we.assigneeId===D.personId||we.people.some(ze=>ze.personId===D.personId)):[];return[{id:"all",name:Ue("All tasks"),company:"",count:i==="recurring"?J.length:B.length,late:0},{id:"mine",name:Ue("My tasks"),company:"",count:De.length,late:De.filter(we=>we.late).length},{id:"recurring",name:Ue("Recurring"),company:"",count:i==="recurring"?B.length:J.length,late:(i==="recurring"?B:J).filter(we=>we.late).length},...oe,...be.length?[{id:"none",name:Ue("No department"),company:"",count:be.length,late:0}]:[]]},[Gt,x,d,i,Ue,D?.personId]),[Za,aa]=N.useState(!1),[xs,G]=N.useState(0),$e=N.useCallback(async B=>{const J=B.filter(oe=>!!oe).reverse();if(J.length)try{for(const oe of J)await Se.restoreTrash(oe);await ot.current(),ia.current(),Be("Restored")}catch(oe){gt(oe)}},[gt]),Ge=N.useCallback(async(B=!1)=>{aa(!0);try{const J=kt=>an(U.current,kt),oe=kt=>Promise.resolve(kt),[be,De,we,ze,Ve]=await Promise.all([J("map.read")?Se.listCompanies():oe([]),J("team.read")?Se.listPeople():oe([]),J("settings.read")?Se.getSettings():oe({}),J("departments.read")?Se.listDepartments():oe([]),J("planning.read")?Se.planning():oe({goals:[]}),J("projects.read")?Ta():oe(void 0),J("tools.read")?Jt():oe(void 0),J("assignments.read")?Da():oe(void 0),J("tasks.read")?ln():oe(void 0)]);h(be),k(Ve.goals),p(De),m(ze),we.usd_rate!==void 0&&E(we.usd_rate),we.eur_rate!==void 0&&O(we.eur_rate),A(we.confidential===!0);const it=kt=>Array.isArray(kt)?kt.filter(Je=>typeof Je=="string"):[];I({tags:it(we.dict_tags),titles:it(we.dict_titles),departments:it(we.dict_departments)}),C(!0),Be(B?"Connected":"Refreshed")}catch(J){gt(J)}finally{aa(!1)}},[Ta,Jt,Da,ln,gt]),ot=N.useRef(Ge);ot.current=Ge,N.useEffect(()=>{D&&Ge(!0)},[Ge,D]),N.useEffect(()=>{window.location.pathname==="/"&&a({tab:"team"},{replace:!0})},[a]);const ht=N.useCallback(async()=>{try{await Se.logout()}catch{}window.location.assign("/")},[]);N.useEffect(()=>{const B=J=>{(J.key==="F5"||(J.ctrlKey||J.metaKey)&&ql(J,"r"))&&(J.preventDefault(),Ge())};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[Ge]);const Ie=N.useRef(null);N.useEffect(()=>{if(!S||i!=="map")return;const B=Ie.current;Ie.current=null;const J=()=>ut(B?{nodes:[{id:B}],padding:.5,duration:300,maxZoom:1.2}:{padding:.15}),oe=window.setTimeout(J,60),be=window.setTimeout(J,420);return()=>{window.clearTimeout(oe),window.clearTimeout(be)}},[S,i,ut]),N.useEffect(()=>{const B=J=>{if(J.key==="Escape"){if(Dg(J.target)){J.target.blur();return}ne(null),R(null),ee(!1),Le(!1)}};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]);const nt=N.useMemo(()=>az(V,d,x,g),[V,d,g,x]),Tt=N.useMemo(()=>sz(nt,d,x,g),[nt,d,g,x]),sa=N.useMemo(()=>lz(g,w,Y),[g,w,Y]),Hn=N.useCallback(async()=>{const B=pt.current.filter(J=>J.plannedOut);p(J=>J.map(oe=>oe.plannedOut?{...oe,plannedOut:!1}:oe));try{await Promise.all(B.map(J=>Se.updatePerson(J.id,{plannedOut:!1}))),Be("Marks cleared")}catch(J){gt(J),Se.listPeople().then(p).catch(()=>{})}},[]),Ot=N.useMemo(()=>rp(d),[d]),en=N.useMemo(()=>rp(x),[x]),Pt=N.useMemo(()=>rp(g),[g]),Nn=N.useMemo(()=>
94KI(Ot,xe,K),[Ot,xe,K]),Fa=N.useMemo(()=>QI(Ot),[Ot]),_a=N.useMemo(()=>WI(Pt,se,Nn),[Pt,se,Nn]),Bn=N.useMemo(()=>JI(en,Pt,se,Nn,_a),[en,Pt,se,Nn,_a]),Xt=N.useMemo(()=>ez(_a,Bn,Pt),[_a,Bn,Pt]),Ka=N.useMemo(()=>tz(Pt),[Pt]),cl=N.useMemo(()=>nz(Pt,w),[Pt,w]),Uo=N.useMemo(()=>Ww(Ot,cl),[Ot,cl]),pa=N.useMemo(()=>Ww(Ot,Ka),[Ot,Ka]);N.useEffect(()=>{_t(B=>oz(B,{companies:Ot,departments:en,people:Pt,rates:w,collapsed:se,treeCollapsed:K,descendantCount:Fa,hiddenCompanies:Nn,hiddenDepartments:Bn,hiddenPeople:Xt,peopleCount:Ka}))},[Ot,en,Pt,w,se,K,Fa,Nn,Bn,Xt,Ka,_t]);const Yn=N.useMemo(()=>new Set(st.filter(B=>B.selected).map(B=>B.id)),[st]),{remember:Lt}=fz({companiesRef:Ht,departmentsRef:T,peopleRef:pt,setCompanies:h,setDepartments:m,setPeople:p,setStatus:Be,fail:gt}),Qa=N.useMemo(()=>g.filter(B=>Yn.has(B.id)),[g,Yn]),_c=N.useMemo(()=>{const B=new Set(Qa.map(J=>J.companyId));return B.size===1?x.filter(J=>B.has(J.companyId)):[]},[Qa,x]),rh=N.useCallback(async B=>{const J=Qa.map(oe=>oe.id);Lt(),p(oe=>oe.map(be=>J.includes(be.id)?{...be,...B}:be));try{const oe=await Promise.all(J.map(be=>Se.updatePerson(be,B)));p(be=>be.map(De=>oe.find(we=>we.id===De.id)??De)),Be(Ue("Updated {n} people",{n:J.length}))}catch(oe){gt(oe),Se.listPeople().then(p).catch(()=>{})}},[Qa,Lt]),[Nt,Ki]=N.useState(()=>XI()),Ho=N.useCallback((B,J)=>({...J,...Nt[B]??{}}),[Nt]),Bo=N.useCallback(()=>_t(B=>B.map(J=>J.selected?{...J,selected:!1}:J)),[_t]),Wa=N.useMemo(()=>iz({companies:Ot,departments:en,people:Pt,dir:_,hiddenCompanies:Nn,hiddenDepartments:Bn,hiddenPeople:Xt,selectedId:X,selectedPersonId:pe,selectedEdgeIds:Q,selectedNodeIds:Yn,measured:(B,J)=>{const oe=Ln.current.find(be=>be.id===B)?.measured;return{width:oe?.width??J.width,height:oe?.height??J.height}},anchors:Ho}),[Ot,en,Pt,_,Nn,Bn,Xt,X,pe,Q,Yn]),Vn=N.useCallback(B=>{le(J=>{let oe=J;for(const be of B)be.type==="select"&&(oe===J&&(oe=new Set(J)),be.selected?oe.add(be.id):oe.delete(be.id));return oe})},[]),Qi=N.useCallback(B=>{ie(J=>{const oe=fp(J,B);return zi(Oi,oe),oe})},[]),Oc=N.useCallback(B=>{ue(J=>{const oe=fp(J,B);return zi(cd,oe),oe}),ne(J=>J&&J!==B&&Gl(Ht.current,J,B)?null:J)},[]),Wi=N.useCallback(B=>{Ne(J=>{const oe=fp(J,B);return zi(Wr,oe),oe}),ne(J=>J===B?null:J)},[]),Ac=N.useCallback(()=>{Ne(new Set),zi(Wr,new Set)},[]),ch=N.useCallback(()=>{const B=new Set(Ht.current.map(oe=>oe.id)),J=new Set(Ht.current.filter(oe=>!oe.parentId||!B.has(oe.parentId)).map(oe=>oe.id));Ne(J),zi(Wr,J),ne(null)},[]),la=N.useCallback(B=>ut({nodes:[{id:B}],padding:.6,duration:300,maxZoom:1}),[ut]),vs=N.useCallback(B=>{const J=Ht.current,oe=pt.current,be=B.kind==="company"?B.id:B.kind==="department"?B.department.companyId:B.person.companyId,De=[];for(let we=be,ze=0;we&&ze<100;ze++)De.push(we),we=J.find(Ve=>Ve.id===we)?.parentId??null;if(Ne(we=>No(we,ze=>De.includes(ze),Wr)),ue(we=>No(we,ze=>ze!==be&&De.includes(ze),cd)),B.kind==="department"&&ie(we=>No(we,ze=>ze===be,Oi)),B.kind==="person"){const we=new Set([be,...B.person.departmentId?[B.person.departmentId]:[]]),ze=[B.id];for(;ze.length;){const Ve=oe.find(it=>it.id===ze.pop());for(const it of Ve?.managerIds??[])we.has(it)||(we.add(it),ze.push(it))}ie(Ve=>No(Ve,it=>we.has(it),Oi))}u("map"),ne(null),R(null),_t(we=>we.map(ze=>({...ze,selected:ze.id===B.id}))),Ie.current=B.id,r.current==="map"&&(window.setTimeout(()=>ut({nodes:[{id:B.id}],padding:.5,duration:300,maxZoom:1.2}),80),Ie.current=null)},[ut,_t]),Po=N.useCallback(B=>{mt(B),ud(ek,B)},[]),Ji=N.useCallback(B=>{const J=new Map(Ln.current.map(we=>[we.id,we])),oe=B.filter(we=>we.type==="position"&&we.position&&J.get(we.id)?.type==="person");if(oe.length===0)return gn(B);const be=new Set(B.filter(we=>we.type==="position").map(we=>we.id)),De=[];for(const we of oe){if(we.type!=="position"||!we.position)continue;const ze=J.get(we.id),Ve=we.position.x-ze.position.x,it=we.position.y-ze.position.y;if(!(!Ve&&!it))for(const kt of Qw(pt.current,[we.id])){const Je=J.get(kt);!Je||be.has(kt)||(be.add(kt),De.push({type:"position",id:kt,position:{x:Je.position.x+Ve,y:Je.position.y+it},dragging:we.dragging}))}}gn([...B,...De])},[gn]),Ja=N.useCallback((B,J)=>{const oe=[...new Set(J.map(be=>
94be.trim()).filter(Boolean))];I(be=>({...be,[B]:oe})),Se.setSetting(IO[B],oe).then(()=>Be("Saved")).catch(gt)},[]),ul=N.useCallback((B,J)=>{const oe=J.trim();oe&&!F.current[B].includes(oe)&&Ja(B,[...F.current[B],oe])},[Ja]),qn=N.useCallback(async(B,J)=>{Lt();for(const oe of J.tags??[])ul("tags",oe);h(oe=>oe.map(be=>be.id===B?{...be,...J}:be));try{const oe=await Se.updateCompany(B,J);h(be=>be.map(De=>De.id===B?oe:De)),Be("Saved")}catch(oe){gt(oe),Se.listCompanies().then(h).catch(()=>{})}},[ul,Lt]),bs=N.useCallback(async B=>{Lt();try{const J=await Se.createCompany(B);h(oe=>[...oe,J]),ne(J.id),Be("Added")}catch(J){gt(J)}},[Lt]),Ic=N.useCallback(B=>{const J=Ln.current.find(De=>De.id===B),oe=J?.measured?.height??120,be=Ht.current.filter(De=>De.parentId===B).length;ue(De=>No(De,we=>we===B,cd)),bs({name:"New company",parentId:B,x:Math.round((J?.position.x??0)+be*300),y:Math.round((J?.position.y??0)+oe+96)})},[bs]),Yo=N.useCallback(async B=>{const J=Ht.current.find(De=>De.id===B);if(!J)return;const oe=pt.current.filter(De=>De.companyId===B).length,be=oe?Ue(" {n} people will be removed with it.",{n:oe}):"";if(await Dt(Ue('Delete "{name}"? Companies under it will move up one level.',{name:J.name||Ue("Untitled")})+be,{okLabel:"Delete",danger:!0})){Lt();try{const{trashId:De}=await Se.deleteCompany(B);ne(null),h(await Se.listCompanies()),m(await Se.listDepartments()),p(await Se.listPeople()),ia.current(),l.current.personId===B&&a({tab:"team"}),oc(Ue("Deleted: {what}",{what:J.name||Ue("Untitled")}),()=>$e([De]))}catch(De){gt(De)}}},[Lt,a,$e,Ue]),Zl=N.useCallback((B,J,oe={})=>{if(ia.current(),J&&!UO(Ht.current,B,J)){Be("That would create a loop");return}ws(B,oe),qn(B,{parentId:J})},[qn]),Vo=N.useCallback((B,J,oe,be)=>{const De=Ln.current.find(Je=>Je.id===(J??oe??B)),we=De?.measured?.width??(J?240:280),ze=De?.measured?.height??(J||oe?56:120),Ve=pt.current.filter(Je=>Je.id!==be&&Je.companyId===B&&(J?Je.managerIds.includes(J):Je.managerIds.length===0&&(Je.departmentId??null)===oe)).length,it=J?De?.position??{x:0,y:0}:{x:0,y:0},kt=_==="right"?{x:it.x+we+64,y:it.y+Ve*68}:{x:it.x+Ve*240,y:it.y+ze+56};return{x:Math.round(kt.x/8)*8,y:Math.round(kt.y/8)*8}},[_]),er=N.useCallback(async(B,J=null,oe)=>{const be=J?pt.current.find(ze=>ze.id===J):null,De=oe!==void 0?oe:be?.departmentId??null,we=Vo(B,J,De);Lt();try{const ze=await Se.createPerson({companyId:B,departmentId:De,managerIds:J?[J]:[],fullName:"",x:Math.round(we.x),y:Math.round(we.y)});p(Ve=>[...Ve,ze]),ne(B),R(ze.id),ia.current(),ie(Ve=>No(Ve,it=>it===B||it===J||it===De,Oi)),Be("Added")}catch(ze){gt(ze)}},[_,Lt,Vo]),on=N.useCallback(async(B,J)=>{Lt(),p(oe=>oe.map(be=>be.id===B?{...be,...J}:be));try{const oe=await Se.updatePerson(B,J);p(be=>be.map(De=>De.id===B?oe:De)),Be("Saved")}catch(oe){if(oe instanceof ah&&oe.status===409&&Array.isArray(oe.data.twins)){const De=oe.data.twins.map(we=>[we.fullName,we.title,we.company].filter(Boolean).join(" · ")).join(`
95`);if(await Dt(`${Ue("Somebody with this name already works here:")}
96${De}
97
98${Ue("Add a second record anyway?")}`,{okLabel:"Add anyway"}))try{const we=await Se.updatePerson(B,{...J,force:!0});p(ze=>ze.map(Ve=>Ve.id===B?we:Ve)),Be("Saved");return}catch(we){gt(we)}}else gt(oe);Se.listPeople().then(p).catch(()=>{})}},[Lt,Ue]),dl=N.useCallback(async B=>{const J=pt.current.find(we=>we.id===B);if(!J)return;const oe=pt.current.filter(we=>we.managerIds.includes(B)),be=oe.length?Ue(" {n} reports move up one level.",{n:oe.length}):"";if(J.fullName&&!await Dt(Ue("Remove {name}?",{name:J.fullName})+be,{okLabel:"Remove",danger:!0}))return;let De;if(oe.length){const we=pt.current.filter(ze=>ze.id!==B&&ze.companyId===J.companyId&&!oe.some(Ve=>Ve.id===ze.id)).sort((ze,Ve)=>+!J.managerIds.includes(ze.id)-+!J.managerIds.includes(Ve.id)||ze.fullName.localeCompare(Ve.fullName,"ru"));if(De=await Up(Ue("{name} has {n} reports. Who takes them over?",{name:J.fullName,n:oe.length}),{label:Ue("Whoever is chosen becomes their manager. Nobody — they are left without one."),options:we.map(ze=>({value:ze.id,label:ze.fullName,sub:ze.title||void 0})),noneLabel:Ue("Nobody — leave them without a manager"),okLabel:"Remove",danger:!0}),De===void 0)return}Lt();try{const{trashId:we}=await Se.deletePerson(B);if(De)for(const Ve of oe)await Se.updatePerson(Ve.id,{managerIds:[De]});p(oe.length?await Se.listPeople():pt.current.filter(Ve=>Ve.id!==B)),T.current.some(Ve=>Ve.headId===B)&&m(await Se.listDepartments()),ia.current();const ze=De?pt.current.find(Ve=>Ve.id===De)?.fullName:"";ze&&Be(Ue("Reports moved to {name}",{name:ze})),oc(Ue("Deleted: {what}",{what:J.fullName||Ue("Person")}),()=>$e([we]))}catch(we){gt(we)}},[Lt,$e,Ue]),oa=N.useCallback(B=>{qt.current=B,Et.current?.click()},[]);async function tr(B){const J=qt.current;
98if(Et.current&&(Et.current.value=""),!(!B||!J))try{Be("Uploading…");const oe=await Se.uploadPhoto(J,await LO(B));p(be=>be.map(De=>De.id===J?oe:De)),Be("Photo saved")}catch(oe){gt(oe)}}const nr=N.useCallback(async B=>{try{const J=await Se.deletePhoto(B);p(oe=>oe.map(be=>be.id===B?J:be)),Be("Photo removed")}catch(J){gt(J)}},[]),ws=(B,J)=>{Object.keys(J).length&&Ki(oe=>{const be={...oe,[B]:{...oe[B]??{},...J}};return Kw(be),be})},Ps=N.useCallback((B,J,oe={})=>{ia.current();const be=pt.current,De=be.find(it=>it.id===B),we=be.find(it=>it.id===J);if(!De||!we)return;if(!e1(be,B,J)){Be("That would create a loop");return}const ze=De.managerIds.includes(J)?De.managerIds:[...De.managerIds,J];ws(B,oe);const Ve=ze!==De.managerIds?{managerIds:ze}:{};Object.keys(Ve).length&&on(B,Ve)},[on]),Fl=N.useCallback((B,J,oe={})=>{ia.current();const be=pt.current.find(ze=>ze.id===B);if(!be)return;const De=J?be.managerIds.filter(ze=>ze!==J):[];ws(B,oe);const we=De.length!==be.managerIds.length?{managerIds:De}:{};Object.keys(we).length&&on(B,we)},[on]),Oa=N.useCallback(async(B,J)=>{Lt(),m(oe=>oe.map(be=>be.id===B?{...be,...J}:be));try{const oe=await Se.updateDepartment(B,J);m(be=>be.map(De=>De.id===B?oe:De)),Be("Saved")}catch(oe){gt(oe),Se.listDepartments().then(m).catch(()=>{})}},[Lt]),qo=N.useCallback(async(B,J="New department",oe=null)=>{const be=Ln.current.find(Je=>Je.id===(oe??B)),De=T.current.filter(Je=>Je.companyId===B&&(Je.parentId??null)===oe).length,we=be?.measured?.height??120,ze=be?.measured?.width??280,Ve=_==="right"?{x:ze+64,y:De*72}:{x:De*290,y:we+64},it=new Set([Ht.current.find(Je=>Je.id===B)?.color??"",...T.current.filter(Je=>Je.companyId===B).map(Je=>Je.color??"")]),kt=(Rs.find(Je=>!it.has(Je.value))??Rs[De%Rs.length]).value;Lt();try{const Je=await Se.createDepartment({companyId:B,name:J,color:kt,parentId:oe,x:Ve.x,y:Ve.y});return m(ra=>[...ra,Je]),ia.current(),ne(B),R(null),ie(ra=>No(ra,ir=>ir===B,Oi)),Be("Added"),Je}catch(Je){return gt(Je),null}},[_,Lt]),Ys=N.useCallback(async B=>{const J=T.current.find(De=>De.id===B);if(!J)return;const oe=pt.current.filter(De=>De.departmentId===B).length,be=oe?Ue(" {n} people stay in the company without a department.",{n:oe}):"";if(await Dt(Ue('Delete department "{name}"?',{name:J.name})+be,{okLabel:"Delete",danger:!0})){Lt();try{const{trashId:De}=await Se.deleteDepartment(B);m(we=>we.filter(ze=>ze.id!==B)),p(await Se.listPeople()),ia.current(),l.current.departmentId===B&&a({tab:"departments"}),oc(Ue("Deleted: {what}",{what:J.name}),()=>$e([De]))}catch(De){gt(De)}}},[Lt,a,$e,Ue]),Gn=N.useCallback((B,J)=>{ia.current();const oe=pt.current.find(De=>De.id===B),be=J?T.current.find(De=>De.id===J):null;if(!(!oe||J&&!be)){if(be&&be.companyId!==oe.companyId){Be("That department belongs to another company");return}(oe.departmentId??null)!==J&&on(B,{departmentId:J})}},[on]),Go=N.useCallback((B,J,oe)=>{const{from:be,to:De,...we}=oe;if((be!==void 0||De!==void 0)&&Ki(ze=>{const Ve={...ze[J]??{}};be!==void 0&&(Ve.from=be),De!==void 0&&(Ve.to=De);const it={...ze,[J]:Ve};return Kw(it),it}),!!Object.keys(we).length)return B==="company"?qn(J,{link:we}):B==="department"?Oa(J,{link:we}):on(J,{link:we})},[qn,on,Oa]),xn=B=>!!B&&pt.current.some(J=>J.id===B),Aa=B=>!!B&&Ht.current.some(J=>J.id===B),Vs=B=>!!B&&T.current.some(J=>J.id===B),Xo=N.useCallback(B=>B.source===B.target?!1:xn(B.target)?xn(B.source)||Aa(B.source)||Vs(B.source):Aa(B.target)?Aa(B.source)||xn(B.source):!1,[]),Kl=N.useCallback((B,J)=>{const oe=Ht.current.find(De=>De.id===B),be=J?pt.current.find(De=>De.id===J):null;if(!(!oe||J&&!be)){if(be&&be.companyId!==oe.parentId){Be("The responsible person must work for the parent company");return}(oe.leadId??null)!==J&&qn(B,{leadId:J})}},[qn]),Ql=N.useCallback(B=>{const J=oe=>pt.current.find(be=>be.id===oe)?.fullName??T.current.find(be=>be.id===oe)?.name??Ht.current.find(be=>be.id===oe)?.name??"";if(!B.source||!B.target)return null;if(xn(B.target)){const oe=pt.current.find(be=>be.id===B.target);return xn(B.source)?Ue("{name} will report to {to}",{name:J(B.target),to:J(B.source)}):Vs(B.source)?Ue("{name} moves to the department {to}",{name:J(B.target),to:J(B.source)}):oe?.companyId===B.source?Ue("{name} will hang straight off the company card: no department, no manager",{name:J(B.target)}):null}return xn(B.source)?Ue("{name} becomes responsible for {to}",{name:J(B.source),to:J(B.target)}):Ue("{name} becomes part of {to}",{name:J(B.target),to:J(B.source)})},[Ue]),hl=N.useCallback(async B=>{if(!B.source||!B.target)return;const J=Ql(B);if(!(J&&!await Dt(`${J}?`,{okLabel:"Change"})))if(xn(B.target)){const oe=rj(B,"person",_),be=pt.current.find(De=>De.id===B.target);xn(B.source)?Ps(B.target,B.source,oe):Vs(B.source)?Gn(B.target,B.source):be?.companyId===B.source?(Fl(B.target,null,oe),Gn(B.target,null)):Be("Drop the line on a person, a department or the person's own company card")}else xn(B.source)?Kl(B.target,B.source):Zl(B.target,B.source,rj(B,"company",_))},[Zl,Ps,Fl,Kl,Gn,_,Ql]),zc=N.useCallback(()=>le(new Set),[]),rn=mz(Tn,`${i}:${D?1:0}`,gn,zc),Ia=N.useRef(!1),Zo=N.useCallback(()=>{Ia.current=!1},[]),qs=N.useCallback(B=>{const J=oe=>pt.current.find(be=>be.id===oe)?.fullName??T.current.find(be=>be.id===oe)?.name??Ht.current.find(be=>be.id===oe)?.name??"";return xn(B.target)?Vs(B.source)?Ue("{name} leaves the department {from}",{name:J(B.target),from:J(B.source)}):Ue("{name} stops reporting to {from}",{name:J(B.target),from:J(B.source)}):xn(B.source)?Ue("{to}
98 is left without a responsible person",{to:J(B.target)}):Ue("{name} leaves {from}",{name:J(B.target),from:J(B.source)})},[Ue]),Wl=N.useCallback(async(B,J=!0)=>J&&!await Dt(`${qs(B)}?`,{okLabel:"Change"})?!1:(xn(B.target)?Vs(B.source)?Gn(B.target,null):Fl(B.target,B.source):xn(B.source)?Kl(B.target,null):Zl(B.target,null),!0),[Zl,Fl,Kl,Gn,qs]),ar=N.useCallback(async(B,J)=>{Ia.current=!0,!(!J.source||!J.target)&&((J.source!==B.source||J.target!==B.target)&&await Wl(B,!1),await hl(J))},[hl,Wl]),sr=N.useCallback((B,J)=>{Ia.current||Wl(J)},[Wl]),fl=N.useRef(L);fl.current=L;const Gs=N.useCallback(async(B,{fit:J=!0}={})=>{if(!fl.current)return;Lt();const oe=new Map(Ln.current.map(we=>[we.id,we.measured??{}])),be=p3(Ht.current,T.current,pt.current,oe,B),De=pt.current.filter(we=>we.link.to==="left"!==be.stacked.has(we.id)).map(we=>{const ze={...we.link};return be.stacked.has(we.id)?ze.to="left":delete ze.to,{id:we.id,link:ze}});h(we=>we.map(ze=>({...ze,...be.companies.find(Ve=>Ve.id===ze.id)}))),m(we=>we.map(ze=>({...ze,...be.departments.find(Ve=>Ve.id===ze.id)}))),p(we=>we.map(ze=>({...ze,...be.people.find(Ve=>Ve.id===ze.id),...De.find(Ve=>Ve.id===ze.id)??{}}))),await Promise.all(De.map(we=>Se.updatePerson(we.id,{link:we.link})));try{const[we,ze,Ve]=await Promise.all([Se.savePositions(be.companies),be.departments.length?Se.saveDepartmentPositions(be.departments):T.current,Se.savePeoplePositions(be.people)]);h(we),m(ze),p(Ve),Be("Arranged"),J&&window.setTimeout(()=>ut({padding:.15,duration:300}),50)}catch(we){gt(we)}},[ut,Lt]),lr=N.useRef(0),ia=N.useRef(()=>{}),Rc=N.useCallback(()=>{window.clearTimeout(lr.current),lr.current=window.setTimeout(()=>Gs(P.current,{fit:!1}),450)},[Gs]);ia.current=Rc;function uh(B,J,oe){const be=new Set(oe.map(kt=>kt.id));for(const kt of Qw(pt.current,oe.filter(Je=>Je.type==="person").map(Je=>Je.id)))be.add(kt);const De=new Map(ta().map(kt=>[kt.id,{x:Math.round(kt.position.x),y:Math.round(kt.position.y)}])),we=kt=>kt.filter(Je=>be.has(Je.id)).map(Je=>({id:Je.id,...De.get(Je.id)})).filter(Je=>{const ra=kt.find(ir=>ir.id===Je.id);return ra.x!==Je.x||ra.y!==Je.y}),ze=we(Ht.current),Ve=we(T.current),it=we(pt.current);(ze.length||Ve.length||it.length)&&Lt(),Ve.length===1?Oa(Ve[0].id,{x:Ve[0].x,y:Ve[0].y}):Ve.length>1&&(m(kt=>kt.map(Je=>({...Je,...Ve.find(ra=>ra.id===Je.id)}))),Se.saveDepartmentPositions(Ve).then(m).then(()=>Be("Saved")).catch(gt)),ze.length===1?qn(ze[0].id,{x:ze[0].x,y:ze[0].y}):ze.length>1&&(h(kt=>kt.map(Je=>({...Je,...ze.find(ra=>ra.id===Je.id)}))),Se.savePositions(ze).then(h).then(()=>Be("Saved")).catch(gt)),it.length===1?on(it[0].id,{x:it[0].x,y:it[0].y}):it.length>1&&(p(kt=>kt.map(Je=>({...Je,...it.find(ra=>ra.id===Je.id)}))),Se.savePeoplePositions(it).then(p).then(()=>Be("Saved")).catch(gt))}function Jl(B,J){Se.setSetting(B,J).then(()=>Be("Saved")).catch(gt)}function dh(B){E(B),Jl("usd_rate",B)}function hh(B){O(B),Jl("eur_rate",B)}const fh=N.useCallback((B,J)=>ul(B,J),[ul]),$c=N.useCallback(async(B,J,oe)=>{const be=F.current[B].filter(we=>we!==J);oe&&!be.includes(oe)&&be.push(oe),Ja(B,be);const De=[];if(B==="tags")for(const we of Ht.current){if(!we.tags.includes(J))continue;const ze=we.tags.filter(Ve=>Ve!==J);oe&&!ze.includes(oe)&&ze.splice(we.tags.indexOf(J),0,oe),De.push(qn(we.id,{tags:ze}))}else if(B==="titles")for(const we of pt.current)we.title===J&&De.push(on(we.id,{title:oe??""}));else{for(const we of T.current)we.name===J&&(oe?De.push(Oa(we.id,{name:oe})):De.push(Se.deleteDepartment(we.id)));!oe&&De.length&&De.push(Promise.all(De).then(()=>Promise.all([Se.listDepartments().then(m),Se.listPeople().then(p)])))}await Promise.all(De),Be(De.length?`${oe?"Renamed":"Removed"} on ${De.length} ${De.length===1?"card":"cards"}`:"Saved")},[Ja,qn,on,Oa]);function mh(B){A(B),Jl("confidential",B)}function or(B){B!==_&&(H(B),ud(Fw,B),Gs(B))}const ph=N.useMemo(()=>({rate:w,confidential:Y,dir:_,multiSelect:Yn.size>1,suggestions:nt,patchCompany:qn,addChild:Ic,deleteCompany:Yo,addPerson:er,patchPerson:on,deletePerson:dl,addDepartment:qo,patchDepartment:Oa,deleteDepartment:Ys,pickPhoto:oa,patchLink:Go,toggleCollapsed:Qi,toggleTreeCollapsed:Oc,openCard:B=>a({tab:"team",personId:B})}),[w,Y,_,Yn,nt,qn,Ic,Yo,er,on,dl,qo,Oa,Ys,oa,Go,Qi,Oc,a]),Dn=d.find(B=>B.id===X)??null,Lc=N.useMemo(()=>{const B=Ue(Eo[i]),J=(oe,be)=>oe?{label:`${B} · ${oe}`,context:`${B} · ${oe}${be?` (id: ${be})`:""}`}:{label:B,context:B};if(i==="projects"||i==="tools"){const oe=Us.find(be=>be.id===re);
98return J(oe?.name,oe?.id)}if(i==="map")return J(Dn?.name,Dn?.id);if(i==="tasks"||i==="recurring"){const oe=Gt.find(be=>be.id===e.taskId);return J(oe?.title,oe?.id)}if(i==="team"){const oe=g.find(be=>be.id===e.personId);return J(oe?.fullName,oe?.id)}if(i==="departments"){const oe=x.find(be=>be.id===e.departmentId);return J(oe?.name,oe?.id)}return J()},[Ue,i,Us,re,Dn,Gt,e.taskId,e.personId,e.departmentId,g,x]),Uc=N.useMemo(()=>nk(d,xe).size,[d,xe]);return N.useEffect(()=>{const B=i==="team"?Ue("Team"):i==="departments"?Ue("Departments"):i==="settings"?Ue("Settings"):i==="stats"?Ue("Insights"):i==="planning"?Ue("Planning"):i==="tasks"?Ue("Tasks"):i==="recurring"?Ue("Recurring"):i==="projects"?Ue("Projects"):i==="tools"?Ue("Tools"):Dn?Dn.name||Ue("Untitled"):Ue("Map");document.title=`${B} · ${Og}`},[i,Dn,Ue]),D===void 0?null:D===null?s.jsx(Lp.Provider,{value:Ue,children:s.jsx(qz,{onSignedIn:M})}):s.jsx(Lp.Provider,{value:Ue,children:s.jsx(Z1.Provider,{value:!!D.seesMarks,children:s.jsxs("div",{className:`app dir-${_}`,children:[s.jsx(Yz,{tab:i,onTab:u,counts:{projects:sn.filter(B=>!B.parentId&&!B.closedOn).length,tools:Bt.filter(B=>!B.parentId&&!B.closedOn).length},taskItems:Bs,noticeCount:jn.count,noticeLate:jn.due.filter(B=>B.kind==="late").length,selectedTaskId:e.view==="mine"?"mine":i==="recurring"?"recurring":e.dept??"all",onPickTask:B=>a(B==="recurring"?{tab:"recurring"}:B==="all"?{tab:"tasks"}:B==="mine"?{tab:i==="recurring"?"recurring":"tasks",view:"mine"}:{tab:i==="recurring"?"recurring":"tasks",dept:B}),collapsed:Ee,onToggleCollapsed:()=>Re(B=>{try{localStorage.setItem(oj,B?"wide":"narrow")}catch{}return!B}),mapMenuOpen:He,onToggleMapMenu:()=>ee(B=>!B),projects:sn.map(B=>({id:B.id,name:B.name,color:B.color,icon:B.icon,parentId:B.parentId,closed:!!B.closedOn})),tools:Bt.map(B=>({id:B.id,name:B.name,color:B.color,icon:B.icon,parentId:B.parentId,closed:!!B.closedOn})),selectedProjectId:re,onPickProject:(B,J)=>Ce(B,!1,J),onNewProject:async()=>{const B=await Qt.createProject({name:Ue("New project"),ownerCompanyId:d[0]?.id??null});B&&Ce(B.id)},onNewTool:async()=>{const B=await ys.createProject({name:Ue("New tool"),ownerCompanyId:d[0]?.id??null});B&&a({tab:"tools",projectId:B.id})},hiddenCount:Uc,me:D,onSignOut:ht}),s.jsxs("div",{className:"workspace",children:[s.jsx(HI,{tab:i,onTab:u,helpOpen:me,onToggleHelp:()=>_e(B=>!B),showSidebar:He,onToggleSidebar:()=>ee(B=>!B),hiddenCount:Uc,companies:Ot,departments:en,people:Pt,onSearchPick:vs,onArrange:()=>Gs(_),onAddCompany:()=>bs({name:"New company",x:60+Math.round(Math.random()*120),y:700+Math.round(Math.random()*120)}),rates:w,confidential:Y,onKeep:B=>on(B,{plannedOut:!1}),onKeepAll:Hn,onDecide:B=>on(B,{underReview:!1}),status:Ae,refreshing:Za,onRefresh:()=>Ge(),fullscreen:Un,onToggleFullscreen:Ls,me:D,readOnly:!L,viewOnly:!Hw(D),assistantOpen:ge,onToggleAssistant:()=>Le(B=>!B)}),i==="planner"?s.jsx(H1,{tasks:Gt,people:g,holders:yn,departments:x,me:D,onOpenTask:B=>{jn.markRead(B);const J=Gt.find(oe=>oe.id===B);a({tab:J?.kind==="recurring"?"recurring":"tasks",taskId:B,from:"planner"})}}):i==="notices"?s.jsx(EI,{items:jn.items,due:jn.due,tasks:Gt,people:g,holders:yn,departments:x,taskGroups:Xa,linked:!!D?.personId,onOpenTask:B=>{jn.markRead(B);const J=Gt.find(oe=>oe.id===B);a({tab:J?.kind==="recurring"?"recurring":"tasks",taskId:B,from:"notices"})},onReadAll:jn.markAllRead}):i==="team"?s.jsx(SI,{people:Pt,companies:Ot,departments:en,projects:yn,tasks:Gt,assignments:Rt,actions:Qt,assignmentActions:Ga,openId:e.personId,onOpen:B=>a({tab:"team",personId:B},{replace:!B}),dept:e.dept,only:e.only,onShowPerson:B=>{const J=g.find(oe=>oe.id===B);J&&vs({kind:"person",id:B,person:J})},onOpenProject:wn,onOpenTask:B=>{jn.markRead(B);const J=Gt.find(oe=>oe.id===B);a({tab:J?.kind==="recurring"?"recurring":"tasks",taskId:B,from:`person:${e.personId??""}`})},onPatchPerson:on,onRestored:()=>Ge(),onArchivePerson:async(B,J,oe)=>{const be=pt.current.find(De=>De.id===B);try{await Se.archivePerson(B,{heirId:J,taskHeirId:oe}),await Ge(),ia.current(),Be(Ue("{name} is in the archive",{name:be?.fullName??""}))}catch(De){gt(De)}}}):i==="departments"?s.jsx(TI,{people:Pt,companies:Ot,departments:en,projects:yn,tools:Bt,tasks:Gt,assignments:Rt,onCreateTask:Mn.create,onOpenTasks:(B,J)=>a({tab:J==="recurring"?"recurring":"tasks",dept:B}),onOpenTask:(B,J)=>a({tab:J==="recurring"?"recurring":"tasks",taskId:B}),openId:e.departmentId,onOpen:B=>a({tab:"departments",departmentId:B}),onOpenCard:B=>a({tab:"team",personId:B}),onPatchPerson:on,onOpenProject:wn}):i==="planning"?s.jsx(Z3,{companies:d,people:g,tasks:Gt,taskActions:Mn,onOpenTask:B=>{jn.markRead(B);const J=Gt.find(oe=>oe.id===B);a({tab:J?.kind==="recurring"?"recurring":"tasks",taskId:B,from:"planning"})},projects:sn,tools:Bt,onOpenHolder:wn,onCreateProject:(B,J)=>Qt.createProject({name:B,ownerCompanyId:J}),onPatchHolder:(B,J,oe)=>(J==="tool"?ys:Qt).patchProject(B,oe),onStatus:Be,fail:gt}):i==="tasks"||i==="recurring"?s.jsx($w,{kind:i==="recurring"?"recurring":"once",tasks:Gt,groups:Xa,actions:Mn,refresh:xs,dept:e.dept,onDept:B=>a({tab:i,dept:B}),onlyMine:e.view==="mine",back:e.from==="notices"?{label:Ue("Notifications"),go:()=>a({tab:"notices"})}:e.from==="planner"?{label:Ue("Planner"),go:()=>a({tab:"planner"})}:e.from==="planning"?{label:Ue("Planning"),go:()=>a({tab:"planning"})}:e.from?.startsWith("person:")?{label:g.find(B=>B.id===e.from.slice(7))?.fullName??Ue("Back"),go:()=>a({tab:"team",personId:e.from.slice(7)||null})}:e.from?.startsWith("projects:")||e.from?.startsWith("tools:")?{label:yn.find(B=>B.id===e.from.split(":")[1])?.name??Ue("Back"),go:()=>{const[B,J]=e.from.split(":");a({tab:B==="tools"?"tools":"projects",projectId:J,view:"works"})}}:void 0,openId:e.taskId,onOpen:B=>{B&&jn.markRead(B),a({tab:i,dept:e.dept,view:e.view,from:B?e.from:null,taskId:B},{replace:!B})},departments:x,companies:d,goals:v,people:g,projects:sn,tools:Bt,onOpenHolder:wn,onOpenPerson:B=>a({tab:"team",personId:B}),onAddZone:(B,J)=>Ma.addArea(B,J),me:D},i):i==="projects"||i==="tools"?s.jsx(zz,{kind:qa,projects:Us,others:i==="tools"?sn:Bt,onOpenOther:B=>a({tab:i==="tools"?"projects":"tools",projectId:B}),tasks:Gt,taskActions:Mn,setStatus:Be,fail:gt,renderTasks:B=>s.jsx($w,{kind:"once",holderId:B,tasks:Gt,groups:Xa,actions:Mn,dept:null,onDept:()=>{},openId:null,onOpen:J=>J&&a({tab:"tasks",taskId:J,from:`${i}:${re}`}),departments:x,companies:d,goals:v,people:g,projects:sn,tools:Bt,onOpenHolder:wn,onOpenPerson:J=>a({tab:"team",personId:J}),onAddZone:(J,oe)=>
98Ma.addArea(J,oe),me:D},B),companies:d,people:g,departments:x,actions:Ma,selectedId:re,onSelect:Ce,view:e.view,onView:B=>a({tab:i,projectId:re,view:B}),background:Ke,onBackground:Po,onShowPerson:B=>{const J=g.find(oe=>oe.id===B);J&&vs({kind:"person",id:B,person:J})},onPatchPerson:on,onOpenCard:B=>a({tab:"team",personId:B})},qa):i==="stats"?s.jsx(zI,{companies:Ot,departments:en,people:Pt,projects:yn,assignments:Rt,onDrill:B=>a({tab:"team",dept:B.departmentId??null,only:B.only??null}),onOpenCard:B=>a({tab:"team",personId:B}),rates:w,confidential:Y,money:q,onJump:(B,J)=>{if(B==="person"){const oe=g.find(be=>be.id===J);oe&&vs({kind:"person",id:J,person:oe})}else if(B==="department"){const oe=x.find(be=>be.id===J);oe&&vs({kind:"department",id:J,department:oe})}else{const oe=d.find(be=>be.id===J);oe&&vs({kind:"company",id:J,company:oe})}}}):i==="settings"?s.jsx(hI,{rate:z,onRateChange:dh,eurRate:j,onEurRateChange:hh,confidential:b,onConfidentialChange:mh,people:g,me:D,onStatus:Be,onSignOut:ht,onRestored:()=>Ge(),dictEntries:Tt,onDictAdd:fh,onDictRename:(B,J,oe)=>$c(B,J,oe),onDictRemove:(B,J)=>$c(B,J,null),lang:dt,onLangChange:ea,background:Ke,onBackgroundChange:Po,dir:_,onDirChange:or,counts:{companies:Ot.length,departments:en.length,people:Pt.length}}):s.jsx(Mc.Provider,{value:ph,children:s.jsxs("div",{className:"main",children:[He&&s.jsx(B3,{companies:Ot,hidden:xe,peopleCount:Ka,peopleTotal:pa,payrollOwn:Y?null:cl,payrollTotal:Y?null:Uo,onToggle:Wi,onShowAll:Ac,onHideAll:ch,onPick:la,background:Ke,onBackground:Po,dir:_,onDir:or,whatIf:sa,onClearWhatIf:Hn,onClose:()=>ee(!1)}),s.jsxs("div",{className:`flow bg-${Ke}`,ref:Tn,onContextMenu:Qr,children:[s.jsxs(ZN,{nodes:st,edges:Wa,nodeTypes:Kz,edgeTypes:Qz,onNodesChange:Ji,onEdgesChange:Vn,panOnDrag:[0,1],onPaneContextMenu:Qr,onNodeContextMenu:Qr,onEdgeContextMenu:Qr,onSelectionContextMenu:Qr,snapToGrid:!0,snapGrid:Wz,nodesDraggable:!W,nodesConnectable:!W,edgesReconnectable:!W,zIndexMode:"manual",onNodeDoubleClick:(B,J)=>{const oe=J.type==="person",be=J.type==="department";ne(oe||be?J.data.companyId:J.id),R(oe?J.id:null)},onNodeDragStop:uh,onPaneClick:()=>{ne(null),R(null)},isValidConnection:Xo,onConnect:hl,onReconnectStart:Zo,onReconnect:ar,onReconnectEnd:sr,onBeforeDelete:async({edges:B})=>({nodes:[],edges:B}),onEdgesDelete:async B=>{if(!B.length)return;const J=B.map(oe=>qs(oe)).join(`
99`);if(await Dt(`${J}?`,{okLabel:"Change"}))for(const oe of B)await Wl(oe,!1)},deleteKeyCode:["Delete","Backspace"],zoomOnDoubleClick:!1,colorMode:"system",minZoom:.2,connectionRadius:40,proOptions:{hideAttribution:!0},children:[s.jsx(O1,{kind:Ke}),s.jsx(WN,{showInteractive:!1})]}),s.jsx(GI,{people:Qa,departments:_c,onPatchAll:rh,onClear:Bo,marks:!!D?.seesMarks}),rn&&s.jsx("div",{className:"marquee",style:{left:rn.x,top:rn.y,width:rn.width,height:rn.height}}),S&&d.length===0&&s.jsx("div",{className:"map-empty",children:s.jsxs("div",{children:[s.jsx("h2",{children:Ue("No companies yet.")}),s.jsx("p",{children:Ue("+ Add company")})]})})]}),Dn&&s.jsx($3,{onOpenCard:B=>a({tab:"team",personId:B}),company:Dn,all:d,allPeople:g,projects:sn,departments:x.filter(B=>B.companyId===Dn.id),onAddDepartment:(B,J)=>qo(Dn.id,B,J??null),onChangeDepartment:Oa,onDeleteDepartment:Ys,people:g.filter(B=>B.companyId===Dn.id),rate:w,confidential:Y,money:q,marks:!!D?.seesMarks,focusPersonId:pe,onShowAllPeople:()=>R(null),onLearn:ul,suggestions:nt,onChange:B=>qn(Dn.id,B),onDelete:()=>Yo(Dn.id),onClose:()=>{ne(null),R(null)},onAddPerson:B=>er(Dn.id,B),onChangePerson:on,onPickPhoto:oa,onRemovePhoto:nr,onDeletePerson:dl},Dn.id)]})}),ge&&s.jsx(Fz,{where:Lc.label,context:Lc.context,readOnly:!Hw(D),onApplied:async B=>{await Ge(),G(be=>be+1);const J=["create_person","delete_person","create_department","delete_department","create_company","delete_company","update_department","update_company"];(B.tool==="update_person"&&("managerIds"in B.args||"departmentId"in B.args||"companyId"in B.args)||J.includes(B.tool))&&Rc()},onClose:()=>Le(!1)})]}),me&&ij[i]&&s.jsx(aI,{topic:ij[i],money:D.money!==!1,onClose:()=>_e(!1)}),s.jsx(uz,{}),s.jsx(hz,{me:D}),s.jsx(YI,{}),s.jsx(VI,{}),s.jsx(qI,{}),s.jsx("input",{ref:Et,type:"file",accept:"image/*",hidden:!0,onChange:B=>tr(B.target.files?.[0])})]})})})}wC.createRoot(document.getElementById("root")).render(s.jsx(N.StrictMode,{children:s.jsx(gg,{children:s.jsx(Jz,{})})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.