nx-kv 0.24.2 → 0.24.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/assets/kv-get/SKILL.md +9 -4
  3. package/package.json +1 -1
  4. package/src/core/workflow/readiness.js +10 -2
  5. package/src/core/workflow/types.js +3 -1
  6. package/src/modules/localtask/index.js +5 -3
  7. package/src/modules/localtask/task-lifecycle.js +63 -31
  8. package/src/modules/localtask/task-view.js +15 -4
  9. package/src/web/frontend/modules/board/board-view.js +7 -2
  10. package/src/web/frontend/modules/md/md-parse.js +7 -10
  11. package/src/web/frontend/modules/md/style.css +6 -14
  12. package/src/web/frontend/page/dir/index.jsx +8 -14
  13. package/src/web/frontend/page/dir/landing.jsx +8 -5
  14. package/src/web/frontend/page/dir/task.jsx +13 -17
  15. package/src/web/frontend/page/progress/index.jsx +15 -33
  16. package/src/web/public/assets/{Introduction-Dr99GN_o.js → Introduction-BBa-4_6Z.js} +1 -1
  17. package/src/web/public/assets/{cloud-BJbs3IuB.js → cloud-CwSnw032.js} +3 -3
  18. package/src/web/public/assets/dag-Bim4kjF5.js +1 -0
  19. package/src/web/public/assets/dir-BLYJYwXR.js +3 -0
  20. package/src/web/public/assets/{group-ji7zeaXJ.js → group-CuItVQ7O.js} +1 -1
  21. package/src/web/public/assets/{index-CHHRdALV.js → index-CHdHAdre.js} +4 -4
  22. package/src/web/public/assets/{index--c-rj9Y8.css → index-CZKjjAtp.css} +1 -1
  23. package/src/web/public/assets/{md-history-H16pOkv6.js → md-history-SmO9nIjG.js} +3 -3
  24. package/src/web/public/assets/{member-picker-BmVwgSWB.js → member-picker-ALREB8wV.js} +1 -1
  25. package/src/web/public/assets/{overview-BNovkb_k.js → overview-Cy57M5-L.js} +1 -1
  26. package/src/web/public/assets/progress-Cfoo3BaU.js +3 -0
  27. package/src/web/public/assets/{repos-A2URD6SC.js → repos-zVVQVKkN.js} +6 -6
  28. package/src/web/public/assets/{route-crumb-x1Za8gFU.js → route-crumb-BhxIQoEf.js} +1 -1
  29. package/src/web/public/assets/{settings-DNZkV_Be.js → settings-DWDjGIdJ.js} +3 -3
  30. package/src/web/public/assets/task-B7WFtHgb.js +5 -0
  31. package/src/web/public/assets/{template-slots-DTd6DvJ3.js → template-slots-BquXVLBT.js} +1 -1
  32. package/src/web/public/assets/{templates-CHvZ38Vw.js → templates-MH2eUUKs.js} +1 -1
  33. package/src/web/public/assets/{upload-BM8dlfZG.js → upload-Ct2hlWdn.js} +1 -1
  34. package/src/web/public/index.html +2 -2
  35. package/src/web/public/assets/dag-DBydHtGQ.js +0 -1
  36. package/src/web/public/assets/dir-DgWqKcbC.js +0 -3
  37. package/src/web/public/assets/progress-Ck-s4Ypp.js +0 -3
  38. package/src/web/public/assets/task-BqQw-96B.js +0 -5
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dir-DgWqKcbC.js","assets/attach-v8BxRJ7p.js","assets/attach-BZrdOH46.css","assets/route-crumb-x1Za8gFU.js","assets/graph-DM-zDRdL.js","assets/reopen-text-DSB76_rF.js","assets/Introduction-Dr99GN_o.js","assets/md-history-H16pOkv6.js","assets/md-edit-ops-Bl0Zx0aJ.js","assets/Introduction-B4k08SH9.css","assets/task-BqQw-96B.js","assets/upload-BM8dlfZG.js","assets/progress-Ck-s4Ypp.js","assets/group-ji7zeaXJ.js","assets/member-picker-BmVwgSWB.js","assets/repos-A2URD6SC.js","assets/cloud-BJbs3IuB.js","assets/overview-BNovkb_k.js","assets/templates-CHvZ38Vw.js","assets/template-slots-DTd6DvJ3.js","assets/template-slots-UVa4FnPn.css","assets/settings-DNZkV_Be.js","assets/settings-CRK86fnJ.css","assets/dag-DBydHtGQ.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dir-BLYJYwXR.js","assets/attach-v8BxRJ7p.js","assets/attach-BZrdOH46.css","assets/route-crumb-BhxIQoEf.js","assets/graph-DM-zDRdL.js","assets/reopen-text-DSB76_rF.js","assets/Introduction-BBa-4_6Z.js","assets/md-history-SmO9nIjG.js","assets/md-edit-ops-Bl0Zx0aJ.js","assets/Introduction-B4k08SH9.css","assets/task-B7WFtHgb.js","assets/upload-Ct2hlWdn.js","assets/progress-Cfoo3BaU.js","assets/group-CuItVQ7O.js","assets/member-picker-ALREB8wV.js","assets/repos-zVVQVKkN.js","assets/cloud-CwSnw032.js","assets/overview-Cy57M5-L.js","assets/templates-MH2eUUKs.js","assets/template-slots-BquXVLBT.js","assets/template-slots-UVa4FnPn.css","assets/settings-DWDjGIdJ.js","assets/settings-CRK86fnJ.css","assets/dag-Bim4kjF5.js"])))=>i.map(i=>d[i]);
2
2
  import{c as e,d as t,f as n,h as r,i,o as a,p as o,s,t as c,u as l}from"./attach-v8BxRJ7p.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},e.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.0`})),p=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=f()})),m=o((e=>{var t=d(),r=n(),i=p();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function f(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(a(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function E(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var D=Object.assign,O=Symbol.for(`react.element`),k=Symbol.for(`react.transitional.element`),A=Symbol.for(`react.portal`),j=Symbol.for(`react.fragment`),M=Symbol.for(`react.strict_mode`),N=Symbol.for(`react.profiler`),P=Symbol.for(`react.consumer`),F=Symbol.for(`react.context`),I=Symbol.for(`react.forward_ref`),ee=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),ne=Symbol.for(`react.memo`),re=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),ae=Symbol.for(`react.legacy_hidden`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.for(`react.view_transition`),L=Symbol.for(`react.recoverable`),ce=Symbol.iterator;function le(e){return typeof e!=`object`||!e?null:(e=ce&&e[ce]||e[`@@iterator`],typeof e==`function`?e:null)}var ue=Symbol.for(`react.client.reference`);function de(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ue?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case j:return`Fragment`;case N:return`Profiler`;case M:return`StrictMode`;case ee:return`Suspense`;case te:return`SuspenseList`;case ie:return`Activity`;case se:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case A:return`Portal`;case F:return e.displayName||`Context`;case P:return(e._context.displayName||`Context`)+`.Consumer`;case I:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ne:return t=e.displayName||null,t===null?de(e.type)||`Memo`:t;case re:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}var R=Array.isArray,z=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},pe=[],me=-1;function he(e){return{current:e}}function V(e){0>me||(e.current=pe[me],pe[me]=null,me--)}function H(e,t){me++,pe[me]=e.current,e.current=t}var U=he(null),W=he(null),G=he(null),ge=he(null);function _e(e,t){switch(H(G,t),H(W,e),H(U,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}V(U),H(U,e)}function ve(){V(U),V(W),V(G)}function ye(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,H(ge,e)),t=U.current;var n=dp(t,e.type);t!==n&&(H(W,e),H(U,n))}function be(e){W.current===e&&(V(U),V(W)),ge.current===e&&(V(ge),sh._currentValue=fe)}var xe,Se;function Ce(e){if(xe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);xe=t&&t[1]||``,Se=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+xe+e+Se}var we=!1;function Te(e,t){if(!e||we)return``;we=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -26,7 +26,7 @@ Error generating stack: `+e.message+`
26
26
  via the ui, and cannot be dragged out of their tabset (they can be reordered within the pinned group).
27
27
  Set via Actions.setTabPinned. Only applies to tabs in tabsets (not borders); pinned tabs should be
28
28
  listed first in the json`),t.addInherited(`enableClose`,`tabEnableClose`).setDescription(`whether the tab can be closed by the user via its close button`),t.addInherited(`closeType`,`tabCloseType`).setDescription(`when the tab's close button is active: Visible (default) active if selected or hovered (note: mobile doesnt support hovered), Always: always active, Selected only active on selected tab (clicking on the x button on a non-selected tab will just select it)`),t.addInherited(`enableDrag`,`tabEnableDrag`).setDescription(`whether the user can drag the tab to a new location`),t.addInherited(`enableRename`,`tabEnableRename`).setDescription(`whether the user can rename the tab by double clicking`),t.addInherited(`enablePin`,`tabEnablePin`).setDescription(`whether the user can pin/unpin the tab via the context menu`),t.addInherited(`className`,`tabClassName`).setDescription(`class applied to tab button`),t.addInherited(`contentClassName`,`tabContentClassName`).setDescription(`class applied to tab content`),t.addInherited(`icon`,`tabIcon`).setDescription(`the tab icon`),t.addInherited(`enableRenderOnDemand`,`tabEnableRenderOnDemand`).setDescription(`whether to avoid rendering component until tab is visible`),t.addInherited(`enablePopout`,`tabEnablePopout`).setDescription(`enable window popout (in popout capable browser), to show an icon in the tabset header also set the enablePopoutIcon attribute`),t.addInherited(`enableFloat`,`tabEnableFloat`).setDescription(`whether the user can move the tab to a floating window via the context menu`),t.addInherited(`enablePopoutIcon`,`tabEnablePopoutIcon`).setDescription(`whether to show the popout icon in the tabset header if this tab enables popouts`),t.addInherited(`enableFloatIcon`,`tabEnableFloatIcon`).setAlias(`enablePopoutFloatIcon`).setDescription(`whether to show the float icon in the tabset header if this tab enables floating`),t.addInherited(`enablePopoutOverlay`,`tabEnablePopoutOverlay`).setDescription(`if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)
29
- then enabling this option will gray out this tab`),t.addInherited(`borderWidth`,`tabBorderWidth`).setDescription(`the width of this tab when shown in a border; -1 uses the border's default size`),t.addInherited(`borderHeight`,`tabBorderHeight`).setDescription(`the height of this tab when shown in a border; -1 uses the border's default size`),t.addInherited(`minWidth`,`tabMinWidth`).setDescription(`the minimum width (in px) of this tab`),t.addInherited(`minHeight`,`tabMinHeight`).setDescription(`the minimum height (in px) of this tab`),t.addInherited(`maxWidth`,`tabMaxWidth`).setDescription(`the maximum width (in px) of this tab`),t.addInherited(`maxHeight`,`tabMaxHeight`).setDescription(`the maximum height (in px) of this tab`),t.addInherited(`enableScrollbars`,`tabEnableScrollbars`).setDescription(`whether the tab will be hosted in a scrollable container`),t}},G=function(e){return e.Close_Tab=`flexlayout.ui.close.tab`,e.Pinned_Tab=`flexlayout.ui.pinned.tab`,e.Rename_Tab=`flexlayout.ui.rename.tab`,e.Close_Tabset=`flexlayout.ui.close.tabset`,e.Active_Tabset=`flexlayout.ui.active.tabset`,e.Move_Tabset=`flexlayout.ui.move.tabset`,e.Move_Tabs=`flexlayout.ui.move.tabs (?)`,e.Move_Group=`flexlayout.ui.move.group (?)`,e.Maximize=`flexlayout.ui.maximize.tabset`,e.Restore=`flexlayout.ui.restore.tabset`,e.Popout_Tab=`flexlayout.ui.popout.tab`,e.Popout_Tab_Float=`flexlayout.ui.popout.tab.float`,e.Popout_Float_To_Window=`flexlayout.ui.popout.float.to.window`,e.Dock_Float_To_Layout=`flexlayout.ui.dock.float.to.layout`,e.Dock_Float_Tabs=`flexlayout.ui.dock.float.tabs (?)`,e.Overflow_Menu_Tooltip=`flexlayout.ui.overflow.menu.tooltip`,e.Splitter=`flexlayout.ui.splitter`,e.Error_rendering_component=`flexlayout.ui.error.rendering.component`,e.Error_rendering_component_retry=`flexlayout.ui.error.rendering.component.retry`,e.Popout_Window_Name=`flexlayout.ui.popout.window.name`,e.Menu_Rename=`flexlayout.ui.menu.rename`,e.Menu_Pin=`flexlayout.ui.menu.pin`,e.Menu_Unpin=`flexlayout.ui.menu.unpin`,e.Menu_Popout=`flexlayout.ui.menu.popout`,e.Menu_Float=`flexlayout.ui.menu.float`,e.Menu_Popout_Tabset=`flexlayout.ui.menu.popout.tabset`,e.Menu_Float_Tabset=`flexlayout.ui.menu.float.tabset`,e.Menu_Maximize=`flexlayout.ui.menu.maximize`,e.Menu_Restore=`flexlayout.ui.menu.restore`,e.Menu_Overlay=`flexlayout.ui.menu.overlay`,e.Menu_Split=`flexlayout.ui.menu.split`,e.Menu_Close_All=`flexlayout.ui.menu.close.all`,e.Menu_Close_Right=`flexlayout.ui.menu.close.right`,e.Menu_Close_Others=`flexlayout.ui.menu.close.others`,e.Menu_Add_To_New_Group=`flexlayout.ui.menu.add.to.new.group`,e.Menu_Add_To_Group=`flexlayout.ui.menu.add.to.group`,e.Menu_Remove_From_Group=`flexlayout.ui.menu.remove.from.group`,e.Menu_Ungroup=`flexlayout.ui.menu.ungroup`,e.Menu_Expand=`flexlayout.ui.menu.expand`,e.Menu_Collapse=`flexlayout.ui.menu.collapse`,e.Rename_Group=`flexlayout.ui.rename.group`,e.Group_Color=`flexlayout.ui.group.color`,e.Group_Pill_Tooltip=`flexlayout.ui.group.pill.tooltip`,e.Group_Name_Label=`flexlayout.ui.group.name.label`,e.Group_Name_Placeholder=`flexlayout.ui.group.name.placeholder`,e.Group_Color_N=`flexlayout.ui.group.color.n`,e.Group_Default_Name=`flexlayout.ui.group.default.name`,e}({}),ge={"flexlayout.ui.close.tab":`Close`,"flexlayout.ui.pinned.tab":`Pinned`,"flexlayout.ui.rename.tab":`Rename tab`,"flexlayout.ui.close.tabset":`Close tabset`,"flexlayout.ui.active.tabset":`Active tabset`,"flexlayout.ui.move.tabset":`Move tabset`,"flexlayout.ui.move.tabs (?)":`Move tabs (?)`,"flexlayout.ui.move.group (?)":`Move group (?)`,"flexlayout.ui.maximize.tabset":`Maximize tabset`,"flexlayout.ui.restore.tabset":`Restore tabset`,"flexlayout.ui.popout.tab":`Popout selected tab`,"flexlayout.ui.popout.tab.float":`Float selected tab`,"flexlayout.ui.popout.float.to.window":`Popout panel`,"flexlayout.ui.dock.float.to.layout":`Drag into another layout`,"flexlayout.ui.dock.float.tabs (?)":`Dock tabs (?)`,"flexlayout.ui.overflow.menu.tooltip":`Hidden tabs`,"flexlayout.ui.splitter":`Resize`,"flexlayout.ui.error.rendering.component":`Error rendering component`,"flexlayout.ui.error.rendering.component.retry":`Retry`,"flexlayout.ui.popout.window.name":`Popout Window`,"flexlayout.ui.menu.rename":`Rename`,"flexlayout.ui.menu.pin":`Pin`,"flexlayout.ui.menu.unpin":`Unpin`,"flexlayout.ui.menu.popout":`Popout`,"flexlayout.ui.menu.float":`Float`,"flexlayout.ui.menu.popout.tabset":`Pop out tabset`,"flexlayout.ui.menu.float.tabset":`Float tabset`,"flexlayout.ui.menu.maximize":`Maximize`,"flexlayout.ui.menu.restore":`Restore`,"flexlayout.ui.menu.overlay":`Overlay`,"flexlayout.ui.menu.split":`Split`,"flexlayout.ui.menu.close.all":`Close All`,"flexlayout.ui.menu.close.right":`Close to the Right`,"flexlayout.ui.menu.close.others":`Close Others`,"flexlayout.ui.menu.add.to.new.group":`Add to new group`,"flexlayout.ui.menu.add.to.group":`Add to group`,"flexlayout.ui.menu.remove.from.group":`Remove from group`,"flexlayout.ui.menu.ungroup":`Ungroup`,"flexlayout.ui.menu.expand":`Expand`,"flexlayout.ui.menu.collapse":`Collapse`,"flexlayout.ui.rename.group":`Rename group`,"flexlayout.ui.group.color":`Group color`,"flexlayout.ui.group.pill.tooltip":`Tab Group, click to expand/collapse`,"flexlayout.ui.group.name.label":`Name`,"flexlayout.ui.group.name.placeholder":`Group Name`,"flexlayout.ui.group.color.n":`Group color ?`,"flexlayout.ui.group.default.name":`Group`},_e={closeTab:`Ctrl+Delete`,renameTab:`F2`,focusTabToggle:void 0,focusNextTabset:void 0,focusPreviousTabset:void 0,closeOverlayBorder:`Escape`};function ve(){return typeof window<`u`&&window.matchMedia&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function ye(e,t,n){let r,i=t.getName(),a=t.getName();n===void 0&&(n=0),r===void 0&&t.getIcon()!==void 0&&(r=n===0?(0,_.jsx)(`img`,{style:{width:`1em`,height:`1em`},src:t.getIcon(),alt:``}):(0,_.jsx)(`img`,{style:{width:`1em`,height:`1em`,transform:`rotate(`+n+`deg)`},src:t.getIcon(),alt:``}));let o={leading:r,content:i,name:a,buttons:[]};return e.customizeTab(t,o),t.setRenderedName(o.name),o}function be(e,t){return e+t.replace(/\s/g,`_`)}function xe(e){return e.getPath().replace(/\/t(\d+)$/,`/tb$1`)}function Se(e,t){if(!t||typeof e.key!=`string`)return!1;let n=t.split(`+`),r=n.pop(),i=e=>n.some(t=>t.toLowerCase()===e);return e.key.toLowerCase()===r.toLowerCase()&&e.ctrlKey===i(`ctrl`)&&e.shiftKey===i(`shift`)&&e.altKey===i(`alt`)&&e.metaKey===i(`meta`)}function Ce(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}function we(e){return{..._e,...e}}function Te(e){return e?.replace(/\bctrl\b/i,`Control`)}function Ee(e){e&&(e.querySelector(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)??e).focus()}function De(e){let t=!1;return e.nativeEvent instanceof MouseEvent&&(e.nativeEvent.button!==0||e.ctrlKey||e.altKey||e.metaKey||e.shiftKey)&&(t=!0),t}function Oe(e,t){let n=[...ke(`iframe`,t),...ke(`webview`,t)];for(let t of n)t.style.pointerEvents=e?`auto`:`none`}function ke(e,t){return[...t.getElementsByTagName(e)]}var Ae=!1;function je(e,t,n,r,i){Ae=!0,t.preventDefault(),t.currentTarget&&typeof t.currentTarget.setPointerCapture==`function`&&t.currentTarget.setPointerCapture(t.pointerId);let a=e=>{e.preventDefault(),n(e.clientX,e.clientY)},o=()=>{e.removeEventListener(`pointermove`,a),e.removeEventListener(`pointerup`,c),e.removeEventListener(`pointercancel`,s)},s=e=>{e.preventDefault(),o(),Ae=!1,i()},c=()=>{o(),Ae=!1,r()};e.addEventListener(`pointermove`,a),e.addEventListener(`pointerup`,c),e.addEventListener(`pointercancel`,s)}function Me(e,t){let n=e.getAttribute(`style`);return n!==t.getAttribute(`style`)&&(n?t.setAttribute(`style`,n):t.removeAttribute(`style`),!0)}function Ne(){let e=navigator.userAgent;return e.includes(`Safari`)&&!e.includes(`Chrome`)&&!e.includes(`Chromium`)}function Pe(e=window){let t=e.document;return{scrollTop:e.pageYOffset||t.documentElement.scrollTop||t.body.scrollTop||0,scrollLeft:e.pageXOffset||t.documentElement.scrollLeft||t.body.scrollLeft||0,fullHeight:Math.max(t.body.scrollHeight,t.documentElement.scrollHeight,t.body.offsetHeight,t.documentElement.offsetHeight,t.body.clientHeight,t.documentElement.clientHeight),fullWidth:Math.max(t.body.scrollWidth,t.documentElement.scrollWidth,t.body.offsetWidth,t.documentElement.offsetWidth,t.body.clientWidth,t.documentElement.clientWidth),viewportHeight:e.innerHeight||t.documentElement.clientHeight,viewportWidth:e.innerWidth||t.documentElement.clientWidth}}var Fe=e=>{let{controller:t,show:n}=e;return(0,_.jsx)(`div`,{"aria-hidden":`true`,className:t.getClassName(A.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:n?`flex`:`none`}})};Fe.displayName=`Overlay`;var Ie=2e3,Le=750,Re=e=>{let{title:t,controller:n,layout:r,url:i,onCloseLayout:a,children:o}=e,s=g.useRef(null),[c,l]=g.useState(void 0),[u,d]=g.useState(void 0),[f,p]=g.useState(void 0),m=g.useMemo(()=>new Map,[]),h=g.useRef(!1),_=g.useRef(null),y=g.useRef(null),b=g.useRef(null),x=g.useRef(new Map);if(g.useLayoutEffect(()=>{!h.current&&c&&(h.current=!0,n.redrawLayout(),We(m))},[c,n,m]),g.useLayoutEffect(()=>{let e=()=>{if(s.current){let e=s.current;s.current=null,e.close()}};if(!s.current){let o=r.getLayoutId(),c=r.getRect();s.current=window.open(i,o,`left=${c.x},top=${c.y},width=${c.width},height=${c.height}`),s.current?(window.addEventListener(`beforeunload`,e),s.current.addEventListener(`load`,()=>{if(s.current){b.current?.(),h.current=!1;let e=s.current;s.current.focus(),s.current.resizeTo(c.width,c.height),s.current.moveTo(c.x,c.y);let i=s.current;i.resizeBy(c.width-i.outerWidth,c.height-i.outerHeight),i.moveBy(c.x-i.screenLeft,c.y-i.screenTop);let o=s.current.document;d(s.current),p(o),o.title=t,document.documentElement.lang&&(o.documentElement.lang=document.documentElement.lang),document.documentElement.dir&&(o.documentElement.dir=document.documentElement.dir);let u=o.createElement(`div`);u.className=A.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,o.body.appendChild(u),n.getProps().onPopoutOpen?.(r,s.current,o),Ve(o,m).then(()=>{l(u)}),_.current=new MutationObserver(e=>ze(e,o,m)),_.current.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),y.current=o.defaultView?.setInterval(()=>{Ge(m,x.current)},Le)??null;let f=()=>{s.current&&(n.getProps().onPopoutClose?.(r,s.current,o),a(r),s.current=null,b.current?.())};e.addEventListener(`beforeunload`,f),b.current=()=>{_.current?.disconnect(),_.current=null,y.current!=null&&(o.defaultView?.clearInterval(y.current),y.current=null),e.removeEventListener(`beforeunload`,f)}}})):(console.warn(`Unable to open window ${i}`),a(r))}return()=>{window.removeEventListener(`beforeunload`,e),s.current?.close(),s.current=null,b.current?.()}},[]),c!==void 0){let e=n.getProps().renderPopoutContent,t=o;return e&&f&&(t=e({children:o,layout:r,popoutWindow:u??window,popoutDocument:f})),(0,v.createPortal)(t,c)}return null};function ze(e,t,n){for(let r of e)if(r.type===`childList`&&r.target===document.head){for(let e of r.addedNodes)(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement)&&He(t,e,n);for(let e of r.removedNodes)if(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement){let t=n.get(e);t&&(t.remove(),n.delete(e))}}else{let e=Be(r.target),t=e&&n.get(e);e&&t&&Ue(e,t)}}function Be(e){let t=e instanceof HTMLElement?e:e.parentNode;for(;t&&!(t instanceof HTMLStyleElement);)t=t.parentNode;return t instanceof HTMLStyleElement?t:void 0}function Ve(e,t){let n=[],r=document.querySelectorAll(`style, link[rel="stylesheet"]`);for(let i of r)He(e,i,t,n);return Promise.all(n)}function He(e,t,n,r){if(t instanceof HTMLLinkElement){let i=t.cloneNode(!0);e.head.appendChild(i),n.set(t,i),r&&r.push(new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};i.onload=()=>r(!0),i.onerror=()=>r(!1),e.defaultView?.setTimeout(()=>r(!1),Ie)}))}else if(t instanceof HTMLStyleElement)try{let r=t.cloneNode(!0);e.head.appendChild(r),Ue(t,r),n.set(t,r)}catch{}}function Ue(e,t){let n=e.textContent??``;if(n.trim()!==``)t.textContent=n;else try{t.textContent=``;let n=e.sheet?.cssRules;if(n)for(let e of n)t.sheet.insertRule(e.cssText,t.sheet.cssRules.length)}catch{}}function We(e){for(let[t,n]of e)t instanceof HTMLStyleElement&&Ue(t,n)}function Ge(e,t){for(let[n,r]of e){if(!(n instanceof HTMLStyleElement)||(n.textContent??``).trim()!==``)continue;let e=0;try{e=n.sheet?.cssRules.length??0}catch{}e!==t.get(n)&&(t.set(n,e),Ue(n,r))}}Re.displayName=`PopoutWindow`;var Ke=10,qe=-4,Je=8,Ye=12,Xe=150,Ze=25,Qe=e=>{let{controller:t,layout:n,children:r}=e,[i,a]=g.useState(n.getRect()),o=g.useRef(E.empty()),s=t.getClassName,c=g.useRef(null),l=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useRef(null),p=g.useRef(null),m=g.useRef(null),h=g.useRef(null),v=g.useRef(null),y=g.useRef(null),b=g.useRef(!1),x=g.useRef(void 0);g.useEffect(()=>{o.current=i},[i]),g.useEffect(()=>{let e=requestAnimationFrame(()=>{a(n.getRect())});return()=>cancelAnimationFrame(e)},[n]);let S=g.useCallback(e=>{let n=t.getCurrentWindow()??window,r=E.fromDomRect(t.getRootDiv().getBoundingClientRect()),i;if(t.getProps().constrainFloatPanels)i=new E(0,0,r.width,r.height);else{let e=Pe(n),t=Math.max(e.fullWidth,n.innerWidth),a=Math.max(e.fullHeight,n.innerHeight);i=new E(-r.x,-r.y,t,a)}let a=e.clone();return a.clamp(i),a},[t]),C=g.useCallback(e=>{e.preventDefault(),e.stopImmediatePropagation()},[]);g.useEffect(()=>{let e=[l,u,d,f,p,m,h,v,y].map(e=>e.current).filter(e=>e!==null);return e.forEach(e=>e.addEventListener(`touchstart`,C,{passive:!1})),()=>{e.forEach(e=>e.removeEventListener(`touchstart`,C))}},[C]);let w=g.useRef(!1);g.useLayoutEffect(()=>{if(!w.current){w.current=!0;let e=S(i);e.equals(i)||(a(e),n.setRect(e))}},[S,i,n]),g.useEffect(()=>{let e=()=>{let e=[...t.getModel().getLayouts()],r=e[e.length-1][1];n!==r&&(b.current=!0)},r=t.getCurrentWindow()??window,i=()=>{b.current&&=(x.current=r.setTimeout(()=>{x.current=void 0,t.moveWindowToFront(n.getLayoutId())},10),!1)},a=c.current;return a&&(a.addEventListener(`pointerdown`,e,{capture:!0}),a.addEventListener(`pointerup`,i)),()=>{a&&(a.removeEventListener(`pointerdown`,e,{capture:!0}),a.removeEventListener(`pointerup`,i)),x.current!==void 0&&(r.clearTimeout(x.current),x.current=void 0)}},[t,n]);let T=e=>{e.stopPropagation();let r={x:e.clientX-i.x,y:e.clientY-i.y};t.showOverlayOnAllWindows(!0),je(t.getCurrentDocument()??document,e,(e,o)=>{b.current&&=(t.moveWindowToFront(n.getLayoutId()),!1);let s=new E(e-r.x,o-r.y,i.width,i.height),c=S(s);a(c),t.doAction(j.moveFloat(n.getLayoutId(),c).setAdjusting(!0))},()=>{t.doAction(j.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)},()=>{t.doAction(j.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)})},D=t.getIcons(),O=t.isSupportsPopout()&&n.getRootRow()?.isAllowedInWindow()===!0,k=e=>{e.stopPropagation(),n.getRootRow()?.getChildren().length?t.getDragDropManager().startDockLayoutDrag(e.nativeEvent,n,c.current??void 0):e.preventDefault()},M=e=>{t.getDragDropManager().onDragEnded()},N=e=>{e.stopPropagation()},P=e=>{e.stopPropagation();let r=t.getScreenRect(n.getRect());t.doAction(j.popoutFloat(n.getLayoutId(),r.toJson()))},F=(e,r)=>{let s=i,c={x:e.clientX,y:e.clientY};t.showOverlayOnAllWindows(!0),je(t.getCurrentDocument()??document,e,(e,i)=>{let o=e-c.x,l=i-c.y,u=s.x,d=s.y,f=s.width,p=s.height;r.includes(`n`)&&(d+=l,p-=l),r.includes(`s`)&&(p+=l),r.includes(`w`)&&(u+=o,f-=o),r.includes(`e`)&&(f+=o);let m=new E(u,d,Math.max(Xe,f),Math.max(Ze,p)),h=S(m);a(h),t.doAction(j.moveFloat(n.getLayoutId(),h).setAdjusting(!0))},()=>{t.doAction(j.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)},()=>{t.doAction(j.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)}),e.stopPropagation()};return(0,_.jsxs)(`div`,{ref:c,className:s(A.FLEXLAYOUT__FLOAT_WINDOW),style:{left:i.x,top:i.y,width:i.width,height:i.height,position:`absolute`},children:[(0,_.jsxs)(`div`,{ref:l,className:s(A.FLEXLAYOUT__FLOAT_WINDOW_HEADER),onPointerDown:T,children:[(0,_.jsx)(`div`,{"data-layout-path":`/floatwindow/drag-handle`,className:s(A.FLEXLAYOUT__FLOAT_WINDOW_DRAG_HANDLE),draggable:!0,title:t.i18nName(G.Dock_Float_To_Layout),"aria-label":t.i18nName(G.Dock_Float_To_Layout),onDragStart:k,onDragEnd:M,onPointerDown:N,children:D.dragToDock}),(0,_.jsx)(`div`,{style:{flexGrow:1,display:`flex`,justifyContent:`center`,alignItems:`center`,minWidth:0,overflow:`hidden`},children:n.getName()===void 0?(0,_.jsx)(`div`,{style:{width:50,height:8,display:`flex`,flexDirection:`column`,justifyContent:`space-around`,opacity:.5},children:(0,_.jsx)(`div`,{style:{height:2,backgroundColor:`gray`,borderRadius:1}})}):(0,_.jsx)(`span`,{"data-layout-path":`/floatwindow/title`,className:s(A.FLEXLAYOUT__FLOAT_WINDOW_HEADER_TITLE),title:n.getName(),children:n.getName()})}),O&&(0,_.jsx)(`button`,{type:`button`,"data-layout-path":`/floatwindow/button/popout`,className:s(A.FLEXLAYOUT__FLOAT_WINDOW_BUTTON),title:t.i18nName(G.Popout_Float_To_Window),"aria-label":t.i18nName(G.Popout_Float_To_Window),onClick:P,onPointerDown:N,children:D.popoutFloatWindow})]}),(0,_.jsx)(`div`,{className:s(A.FLEXLAYOUT__FLOAT_WINDOW_CONTENT),children:r}),(0,_.jsx)(`div`,{ref:u,style:{position:`absolute`,zIndex:Ke,top:qe,left:Je,right:Je,height:Je,cursor:`ns-resize`},onPointerDown:e=>F(e,`n`)}),(0,_.jsx)(`div`,{ref:m,style:{position:`absolute`,zIndex:Ke,bottom:qe,left:Je,right:Je,height:Je,cursor:`ns-resize`},onPointerDown:e=>F(e,`s`)}),(0,_.jsx)(`div`,{ref:f,style:{position:`absolute`,zIndex:Ke,top:Je,bottom:Je,right:qe,width:Je,cursor:`ew-resize`},onPointerDown:e=>F(e,`e`)}),(0,_.jsx)(`div`,{ref:v,style:{position:`absolute`,zIndex:Ke,top:Je,bottom:Je,left:qe,width:Je,cursor:`ew-resize`},onPointerDown:e=>F(e,`w`)}),(0,_.jsx)(`div`,{ref:y,style:{position:`absolute`,zIndex:Ke,top:qe,left:qe,width:Ye,height:Ye,cursor:`nwse-resize`},onPointerDown:e=>F(e,`nw`)}),(0,_.jsx)(`div`,{ref:d,style:{position:`absolute`,zIndex:Ke,top:qe,right:qe,width:Ye,height:Ye,cursor:`nesw-resize`},onPointerDown:e=>F(e,`ne`)}),(0,_.jsx)(`div`,{ref:h,style:{position:`absolute`,zIndex:Ke,bottom:qe,left:qe,width:Ye,height:Ye,cursor:`nesw-resize`},onPointerDown:e=>F(e,`sw`)}),(0,_.jsx)(`div`,{ref:p,style:{position:`absolute`,zIndex:Ke,bottom:0,right:0,width:Ye,height:Ye,cursor:`nwse-resize`},onPointerDown:e=>F(e,`se`)})]})},$e=({controller:e})=>{let t=[],n=e.getModel().getLayouts(),r=2e3;for(let[i,a]of n)a.isMainLayout()||(a.getType()===`window`&&e.isSupportsPopout()?t.push((0,_.jsx)(Re,{controller:e,layout:a,title:e.getPopoutWindowName()+` `+i,url:e.getPopoutURL()+`?id=`+encodeURIComponent(i),onCloseLayout:e.onCloseLayout,children:(0,_.jsx)(`div`,{className:e.getProps().popoutClassName,children:(0,_.jsx)(Wt,{...e.getProps(),layoutId:i,path:a.getPath(),mainLayoutController:e})})},i)):a.getType()===`float`&&(t.push((0,_.jsx)(Qe,{controller:e,layout:a,zIndex:r,onCloseLayout:e.onCloseLayout,children:(0,_.jsx)(Wt,{...e.getProps(),layoutId:i,path:a.getPath(),mainLayoutController:e})},i+`float`)),r++));return(0,_.jsx)(_.Fragment,{children:t})};$e.displayName=`FloatingWindowContainer`;var et=e=>{let{controller:t,tabNode:n,selected:r,border:i,icons:a,path:o}=e,s=g.useRef(null),c=g.useRef(null),l=t.getKeyMap(),u=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},d=e=>{e.stopPropagation(),t.getDragDropManager().onDragEnded()},f=e=>{De(e)&&t.auxMouseClick(n,e)},p=e=>{t.showContextMenu(n,e)},m=()=>{t.doAction(j.selectTab(n.getId()))},h=e=>{let t=s.current?.closest(`[role="tablist"]`);if(t){let n=Array.from(t.querySelectorAll(`[role="tab"]`));n[n.indexOf(s.current)+e]?.focus()}},v=()=>{let e=s.current.ownerDocument,t=()=>Ee(e.getElementById(be(`flexlayout-tab-`,n.getId())));r?t():(m(),requestAnimationFrame(t))},y=e=>{t.getEditingTab()!==n&&(Se(e,l.focusTabToggle)?(v(),e.preventDefault()):e.key===`Enter`||e.key===` `?(m(),e.preventDefault()):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&!Ce(e)?(h(-1),e.preventDefault()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&!Ce(e)?(h(1),e.preventDefault()):Se(e,l.closeTab)&&n.isCloseable()&&(h(1),t.doAction(j.deleteTab(n.getId())),e.preventDefault()))},b=()=>{let e=n.getCloseType();return!!(r||e===F.Always||e===F.Visible&&t.getCurrentWindow()?.matchMedia(`(hover: hover) and (pointer: fine)`).matches)},x=e=>{b()&&(t.doAction(j.deleteTab(n.getId())),e.stopPropagation())},S=e=>{e.stopPropagation()},C=()=>{if(r)return!0;let e=n.getTabContainer();return e instanceof U&&e.getSelected()===-1&&e.getTabNodes()[0]===n},w=t.getEditingTab()===n,T=g.useCallback(e=>{s.current=e,t.registerMeasurable(n,`tabbutton`,e)},[t,n]);g.useLayoutEffect(()=>{w&&c.current.select()},[w]),g.useEffect(()=>{if(w){let e=t.getCurrentDocument().body,n=e=>{e.target!==c.current&&t.setEditingTab(void 0)};return e.addEventListener(`pointerdown`,n),()=>e.removeEventListener(`pointerdown`,n)}},[w,t]);let E=e=>{e.stopPropagation()},D=e=>{e.code===`Escape`?(t.setEditingTab(void 0),s.current?.focus()):(e.code===`Enter`||e.code===`NumpadEnter`)&&(t.setEditingTab(void 0),t.doAction(j.renameTab(n.getId(),e.target.value)),s.current?.focus())},O=t.getClassName,k=O(A.FLEXLAYOUT__BORDER_BUTTON)+` `+O(A.FLEXLAYOUT__BORDER_BUTTON_+i);k+=r?` `+O(A.FLEXLAYOUT__BORDER_BUTTON__SELECTED):` `+O(A.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED);let M=n.getParent()instanceof V?n.getParent():void 0;M!==void 0&&(k+=` `+O(A.FLEXLAYOUT__TAB_BUTTON_GROUPED),n.getModel().getTabGroupType()===`underline`&&(k+=` `+O(A.FLEXLAYOUT__TAB_BUTTON_GROUPED_UNDERLINE))),n.getClassName()!==void 0&&(k+=` `+n.getClassName());let N=0;n.getModel().isEnableRotateBorderIcons()===!1&&(i===`left`?N=n.getModel().getBorderLeftTabDirection()===`down`?-90:90:i===`right`&&(N=-90));let P=ye(t,n,N),I=P.content?(0,_.jsx)(`div`,{className:O(A.FLEXLAYOUT__BORDER_BUTTON_CONTENT),children:P.content}):null,ee=P.leading?(0,_.jsx)(`div`,{className:O(A.FLEXLAYOUT__BORDER_BUTTON_LEADING),children:P.leading}):null;if(w&&(I=(0,_.jsx)(`input`,{ref:c,className:O(A.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":o+`/textbox`,type:`text`,"aria-label":t.i18nName(G.Rename_Tab),autoFocus:!0,defaultValue:n.getName(),onKeyDown:D,onPointerDown:E})),n.isCloseable()){let e=t.i18nName(G.Close_Tab);P.buttons.push((0,_.jsx)(`div`,{"data-layout-path":o+`/button/close`,title:e,"aria-hidden":`true`,className:O(A.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:S,onClick:x,children:typeof a.close==`function`?a.close(n):a.close},`close`))}let te=[Te(l.focusTabToggle),n.isCloseable()?Te(l.closeTab):void 0].filter(Boolean).join(` `)||void 0,ne={};return M!==void 0&&(ne[`--flexlayout-group-color`]=M.getColor()),(0,_.jsxs)(`div`,{ref:T,id:be(`flexlayout-tabbutton-`,n.getId()),role:w?void 0:`tab`,"aria-selected":w?void 0:r,"aria-controls":w?void 0:be(`flexlayout-tab-`,n.getId()),"aria-label":w?void 0:P.name,"aria-keyshortcuts":w?void 0:te,tabIndex:w?-1:C()?0:-1,onKeyDown:y,"data-layout-path":o,className:k,style:ne,onClick:m,onAuxClick:f,onContextMenu:p,title:n.getHelpText(),draggable:!0,onDragStart:u,onDragEnd:d,children:[ee,I,P.buttons]})};et.displayName=`BorderButton`;var tt=e=>{let{controller:t,groupNode:n,path:r}=e,i=g.useRef(null),a=g.useCallback(e=>{i.current=e,t.registerMeasurable(n,`grouppill`,e)},[t,n]),o=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},s=e=>{t.getDragDropManager().onDragEnded()},c=e=>{t.showContextMenu(n,e)},l=()=>{t.doAction(j.updateNodeAttributes(n.getId(),{opened:!n.isOpened()}))},u=e=>{l(),e.stopPropagation()},d=e=>{if(e.key===`Enter`||e.key===` `)l(),e.preventDefault();else if(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`){let t=i.current.getBoundingClientRect();i.current.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:t.x+t.width/2,clientY:t.y+t.height/2})),e.preventDefault()}},f=t.getClassName,p=f(A.FLEXLAYOUT__GROUP_PILL);n.isOpened()?t.getModel().getTabGroupType()===`underline`&&(p+=` `+f(A.FLEXLAYOUT__GROUP_PILL_UNDERLINE)):p+=` `+f(A.FLEXLAYOUT__GROUP_PILL_COLLAPSED);let m=n.getColor(),h={backgroundColor:m,borderColor:m},v=t.i18nName(G.Group_Pill_Tooltip);return(0,_.jsxs)(`div`,{ref:a,"data-layout-path":r,role:`button`,"aria-label":n.getName(),"aria-expanded":n.isOpened(),tabIndex:0,title:v,className:p,style:h,draggable:!0,onDragStart:o,onDragEnd:s,onClick:u,onKeyDown:d,onContextMenu:c,children:[(0,_.jsx)(`span`,{className:f(A.FLEXLAYOUT__GROUP_PILL_NAME),children:n.getName()}),!n.isOpened()&&(0,_.jsx)(`span`,{"aria-hidden":`true`,className:f(A.FLEXLAYOUT__GROUP_PILL_COUNT),children:n.getChildren().length})]})};tt.displayName=`GroupPill`;var nt=e=>{let{controller:t,groupNode:n,path:r}=e,i=g.useRef(null),a=g.useCallback(e=>{i.current=e,t.registerMeasurable(n,`groupendmarker`,e)},[t,n]),o=e=>{t.doAction(j.updateNodeAttributes(n.getId(),{opened:!n.isOpened()})),e.stopPropagation()},s=n.getColor(),c={backgroundColor:s,borderColor:s};return(0,_.jsx)(`div`,{ref:a,"data-layout-path":r,title:n.getName(),"aria-hidden":!0,className:t.getClassName(A.FLEXLAYOUT__GROUP_END_MARKER),style:c,onClick:o})};nt.displayName=`GroupEndMarker`;var rt=e=>{let{controller:t,tabNode:n}=e,r=t.getClassName,i=r(A.FLEXLAYOUT__TAB_BUTTON_STAMP),a=ye(t,n),o=a.content?(0,_.jsx)(`div`,{className:r(A.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:a.content}):n.getNameForOverflowMenu(),s=a.leading?(0,_.jsx)(`div`,{className:r(A.FLEXLAYOUT__TAB_BUTTON_LEADING),children:a.leading}):null;return(0,_.jsxs)(`div`,{className:i,title:n.getHelpText(),children:[s,o]})};rt.displayName=`TabButtonStamp`;var it=500;function at(e){return typeof e.getBoundingClientRect==`function`}function ot(e){return e.container?e.container:at(e.anchor)?e.anchor.ownerDocument.body:document.body}function st(e){if(at(e))return e.getBoundingClientRect();if(`right`in e&&`bottom`in e)return e;let t=e;return new DOMRect(t.x,t.y,0,0)}function ct(e,t){let n=t,{left:r,right:i,top:a,bottom:o}=e,s={};return(r+i)/2<n.left+n.width/2?s.left=r-n.left:s.right=n.right-i,(a+o)/2<n.top+n.height/2?s.top=a-n.top:s.bottom=n.bottom-o,s}var lt=e=>{let{anchor:t,items:n,onSelect:r,onClose:i,renderItem:a,title:o}=e,s=e.classNameMapper??(e=>e),c=ot(e),l=g.useRef(null),u=g.useRef(null),d=g.useRef({buffer:``,timer:void 0});g.useEffect(()=>()=>{d.current.timer&&clearTimeout(d.current.timer)},[]);let f=g.useCallback(e=>{e.disabled||((e.onSelect??r)?.(e),i())},[r,i]);g.useEffect(()=>{let n=c.ownerDocument;u.current?.contains(n.activeElement)||(u.current?.querySelector(`[role="menuitem"]:not([aria-disabled="true"])`)??u.current)?.focus();let r=e.returnFocusTo??(at(t)?t:void 0);return()=>{r?.focus?.()}},[]),g.useEffect(()=>{let e=c.ownerDocument,t=e=>{l.current?.contains(e.target)||i()};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[c,i]);let p=e=>{let t=Array.from(u.current?.querySelectorAll(`[role="menuitem"]:not([aria-disabled="true"])`)??[]),n=e.target.closest?.(`[role="menuitem"]`),r=n?t.indexOf(n):-1;if(e.key===`Escape`||e.key===`Tab`)i(),e.preventDefault();else if(e.key===`ArrowDown`||e.key===`ArrowUp`)t.length>0&&t[(r+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus(),e.preventDefault();else if(e.key===`Home`||e.key===`End`)(e.key===`Home`?t[0]:t[t.length-1])?.focus(),e.preventDefault();else if(e.key.length===1&&e.key!==` `&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let n=d.current;n.timer&&clearTimeout(n.timer),n.buffer+=e.key.toLowerCase(),n.timer=setTimeout(()=>{n.buffer=``},it);let i=[...n.buffer].every(e=>e===n.buffer[0]),a=i?n.buffer[0]:n.buffer,o=i?r+1:Math.max(r,0);for(let e=0;e<t.length;e++){let n=(o+e)%t.length;if((t[n].textContent??``).trim().toLowerCase().startsWith(a)){t[n].focus();break}}e.preventDefault()}else(e.key===`Enter`||e.key===` `)&&n&&(n.click(),e.preventDefault())},m=e=>({select:()=>f(e),close:i}),h=e=>(0,_.jsx)(`div`,{className:s(A.FLEXLAYOUT__POPUP_MENU_ITEM)+(e.disabled?` `+s(A.FLEXLAYOUT__POPUP_MENU_ITEM__DISABLED):``),role:`menuitem`,tabIndex:-1,"aria-disabled":e.disabled||void 0,onClick:t=>{f(e),t.stopPropagation()},children:e.content??(0,_.jsxs)(_.Fragment,{children:[e.icon,e.label]})},e.key),y=(0,_.jsx)(`div`,{ref:l,className:s(A.FLEXLAYOUT__POPUP_MENU_CONTAINER),style:ct(st(t),c.getBoundingClientRect()),children:(0,_.jsx)(`div`,{ref:u,className:s(A.FLEXLAYOUT__POPUP_MENU),role:`menu`,"aria-label":o,tabIndex:0,onKeyDown:p,"data-layout-path":`/popup-menu`,children:n.map((e,t)=>e.type===`divider`?(0,_.jsx)(`div`,{className:s(A.FLEXLAYOUT__POPUP_MENU_DIVIDER),role:`separator`},e.key):a?a(e,t,m(e)):h(e))})});return(0,v.createPortal)(y,c)};function ut(e){let t=ot(e),n=at(e.anchor)?e.anchor.getBoundingClientRect():e.anchor,r=t.ownerDocument.createElement(`div`);t.appendChild(r);let i=(0,y.createRoot)(r),a=!1,o=()=>{a||(a=!0,i.unmount(),r.remove(),e.onClose())};return i.render((0,_.jsx)(lt,{...e,anchor:n,container:t,onClose:o})),o}function dt(e,t,n,r,i,a){let o=i.getClassName,s=n.map(e=>({key:e.node.getId()}));return i.showOverlayOnAllWindows(!0),ut({anchor:e,container:i.getRootDiv()??void 0,classNameMapper:o,returnFocusTo:e,title:i.i18nName(G.Overflow_Menu_Tooltip),items:s,onSelect:e=>{let t=s.indexOf(e);t>=0&&r(n[t])},renderItem:(e,r,a)=>{let s=n[r],c=s.node.getParent()instanceof V?s.node.getParent():void 0,l=c!==void 0,u=o(A.FLEXLAYOUT__POPUP_MENU_ITEM);l&&(u+=` `+o(A.FLEXLAYOUT__POPUP_MENU_ITEM_GROUPED)),t.getSelected()===s.index&&(u+=` `+o(A.FLEXLAYOUT__POPUP_MENU_ITEM__SELECTED));let d={};return l&&(d[`--flexlayout-group-color`]=c.getColor()),(0,_.jsx)(`div`,{className:u,role:`menuitem`,"aria-label":s.node.getNameForOverflowMenu(),tabIndex:-1,"data-layout-path":`/popup-menu/tb`+r,style:d,onClick:e=>{a.select(),e.stopPropagation()},draggable:!0,onDragStart:e=>{e.stopPropagation(),i.getDragDropManager().setDragNode(e.nativeEvent,s.node)},onDragEnd:()=>{i.getDragDropManager().onDragEnded(),a.close()},title:s.node.getHelpText(),children:(0,_.jsx)(rt,{tabNode:s.node,controller:i})},e.key)},onClose:()=>{i.showOverlayOnAllWindows(!1),a?.()}})}lt.displayName=`PopupMenu`;var ft=(e,t,n,r,i,a,o,s)=>{let[c,l]=g.useState([]),[u,d]=g.useState(!1),[f,p]=g.useState(!1),m=g.useRef(!1),h=g.useRef(void 0),_=g.useRef([]),v=g.useRef(0),y=g.useRef(!1),b=g.useRef(0);g.useEffect(()=>()=>{h.current!==void 0&&clearTimeout(h.current)},[]),g.useLayoutEffect(()=>{_.current=c});let x=g.useCallback(e=>{n===D.HORZ?r.current.scrollLeft=e:r.current.scrollTop=e},[n,r]),S=g.useCallback(e=>n===D.HORZ?e.scrollLeft:e.scrollTop,[n]),C=g.useCallback(e=>n===D.HORZ?e.clientWidth:e.clientHeight,[n]),w=g.useCallback(e=>n===D.HORZ?e.scrollWidth:e.scrollHeight,[n]),T=g.useCallback(e=>n===D.HORZ?e.width:e.height,[n]),E=g.useCallback(e=>n===D.HORZ?e.x:e.y,[n]),O=g.useCallback(e=>n===D.HORZ?e.right:e.bottom,[n]),k=g.useCallback(()=>{let e=[];if(r.current){let t=r.current,n=t.getBoundingClientRect(),i=E(n)-1,a=O(n)+1,s=t.firstElementChild,c=0;Array.from(s.children).forEach(t=>{let n=t.getBoundingClientRect();t.classList.contains(o)&&((E(n)<i||O(n)>a)&&e.push(c),c++)})}return e},[o,r,E,O]),A=g.useCallback(()=>{if(r.current&&i.current){let e=r.current,t=i.current,a=C(e),o=w(e),s=S(e);if(o>a&&o>0){let e=a*a/o,r=0;e<20&&(r=20-e,e=20);let i=s*(a-r)/o;n===D.HORZ?(t.style.width=e+`px`,t.style.left=i+`px`):(t.style.height=e+`px`,t.style.top=i+`px`),t.style.display=`block`}else t.style.display=`none`;n===D.HORZ?t.style.bottom=`0px`:t.style.right=`0px`}},[n,r,i,C,w,S]),j=g.useCallback((e=!1)=>{let t=k(),n=t.length>0;n!==u&&d(n),e?l(t):h.current===void 0&&(h.current=setTimeout(()=>{let e=k();pt(e,_.current)||l(e),h.current=void 0},100))},[k,u]),M=g.useCallback(()=>{let n=t.getSelectedNode();if(n&&r.current){let t=e.getBoundingClientRect(r.current),i=r.current.ownerDocument.getElementById(be(`flexlayout-tabbutton-`,n.getId()));if(!i)return;let a=e.getBoundingClientRect(i),o=E(t)-E(a);o>0||T(a)>T(t)?(x(S(r.current)-o),y.current=!0):(o=O(a)-O(t),o>0&&(x(S(r.current)+o),y.current=!0))}},[t,e,r,E,O,T,S,x]),N=g.useCallback(()=>{if(r.current){let e=r.current,t=0;for(let n of Array.from(e.children))t+=C(n);if(s?.current){let e=C(s.current);e>0&&(b.current=e)}let n=b.current,i=t+(f?n:0)>C(r.current);i!==f&&p(i)}},[r,s,f,C]),P=g.useCallback(()=>{y.current||(m.current=!0),y.current=!1,A(),j()},[A,j]),F=g.useCallback((e,t)=>{if(r.current&&i.current){let a=r.current,o=i.current,s=C(a),c=w(a),l=C(o),u=a.getBoundingClientRect(),d;if(d=n===D.HORZ?e-u.x-v.current:t-u.y-v.current,d=Math.max(0,Math.min(c-l,d)),s>0){let e=d*c/s;x(e)}}},[r,i,n,C,w,x]),I=g.useCallback(()=>{},[]),ee=g.useCallback(()=>{},[]),te=g.useCallback(e=>{e.stopPropagation(),i.current.setPointerCapture(e.pointerId);let t=i.current.getBoundingClientRect();n===D.HORZ?v.current=e.clientX-t.x:v.current=e.clientY-t.y,je(e.currentTarget.ownerDocument,e,F,I,ee)},[i,n,F,I,ee]),ne=g.useCallback(e=>{if(!r.current||t.getChildren().length===0)return;let i=Math.abs(e.deltaX),a=Math.abs(e.deltaY);if(i===0&&a===0)return;let o;o=n===D.HORZ?i>a?e.deltaX:e.deltaY:a>i?e.deltaY:e.deltaX,e.deltaMode===1&&(o*=40);let s=w(r.current)-C(r.current);if(s<=0)return;let c=S(r.current)+o;x(Math.max(0,Math.min(s,c))),e.stopPropagation()},[t,r,n,S,w,C,x]),re=g.useCallback(e=>{let t=r.current;t&&(w(t)-C(t)<=0||e.preventDefault())},[r,w,C]),ie=t.getId(),ae=t.getSelectedNode();return g.useLayoutEffect(()=>{r.current&&x(0)},[ie,r,x]),g.useLayoutEffect(()=>{m.current=!1},[ae]),g.useLayoutEffect(()=>{N(),m.current===!1&&M(),A(),j(!0);let e=requestAnimationFrame(()=>{j()});return()=>cancelAnimationFrame(e)},[N,M,A,j,n,ae]),g.useLayoutEffect(()=>{let t=r.current;if(!t)return;let n=t.ownerDocument.defaultView,i=new n.ResizeObserver(()=>{N();let t=e.isSplitterDragging();(!m.current||t)&&(t&&(m.current=!1),M()),A(),j()});i.observe(t);let a=t.firstElementChild,o=new n.MutationObserver(()=>{j()});return a&&o.observe(a,{childList:!0,subtree:!0}),()=>{i.disconnect(),o.disconnect()}},[N,M,A,j,r,e]),g.useLayoutEffect(()=>{let e=s?.current;if(!e)return;let t=new e.ownerDocument.defaultView.ResizeObserver(()=>{N()});return t.observe(e),()=>t.disconnect()},[N,s,f]),g.useEffect(()=>{if(t instanceof R&&t.isEnableTabWrap())return;let e=a.current;return e?.addEventListener(`wheel`,re,{passive:!1}),()=>{e?.removeEventListener(`wheel`,re)}}),{userControlledPositionRef:m,onScroll:P,onScrollPointerDown:te,hiddenTabs:c,onMouseWheel:ne,isDockStickyButtons:f,isShowHiddenTabs:u}};function pt(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}var mt=e=>{let{borderNode:t,controller:n,size:r}=e,i=g.useRef(null),a=g.useRef(null),o=g.useRef(null),s=g.useRef(null),c=g.useRef(null),l=g.useRef(null),[u,d]=g.useState(!1),f=g.useRef(null),p=n.getIcons();g.useEffect(()=>()=>f.current?.(),[]);let{userControlledPositionRef:m,onScroll:h,onScrollPointerDown:v,hiddenTabs:y,onMouseWheel:b,isDockStickyButtons:x,isShowHiddenTabs:S}=ft(n,t,D.flip(t.getOrientation()),l,o,i,n.getClassName(A.FLEXLAYOUT__BORDER_BUTTON),c),C=g.useCallback(e=>{i.current=e,n.registerMeasurable(t,`borderheader`,e)},[n,t]),w=e=>{De(e)&&n.auxMouseClick(t,e)},T=e=>{n.showContextMenu(t,e)},E=e=>{e.stopPropagation()},k=e=>{let r=n.getShowOverflowMenu(),i=t.getTabNodes(),a=y.map(e=>({index:e,node:i[e]}));if(r!==void 0)r(t,e,a,M);else{let e=s.current;d(!0),f.current=dt(e,t,a,M,n,()=>{d(!1),f.current=null})}e.stopPropagation()},M=e=>{n.doAction(j.selectTab(e.node.getId())),m.current=!1},N=e=>{let r=t.getSelectedNode();r!==void 0&&n.doAction(j.popoutTab(r.getId(),`window`)),e.stopPropagation()},P=e=>{let r=t.getSelectedNode();r!==void 0&&n.doAction(j.popoutTab(r.getId(),`float`)),e.stopPropagation()},F=n.getClassName,I=()=>{let e=[],r=n.getModel().getTabGroupType()===`splitpill`,i=0,a=!1,o=0,s=()=>(0,_.jsx)(`div`,{className:F(A.FLEXLAYOUT__BORDER_TAB_DIVIDER)},`divider`+o++),c=t.getLocation()===O.LEFT&&n.getModel().getBorderLeftTabDirection()!==`down`;for(let o of t.getChildren()){if(o instanceof V){let l=o.getChildren();if(c&&o.isOpened()){a&&e.push(s()),r&&e.push((0,_.jsx)(nt,{controller:n,groupNode:o,path:o.getPath()+`/end`},o.getId()+`/end`));let c=i;for(let r=l.length-1;r>=0;r--){let i=t.getSelected()===c+r;r<l.length-1&&e.push(s()),e.push((0,_.jsx)(et,{controller:n,border:t.getLocation().getName(),tabNode:l[r],path:xe(l[r]),selected:i,icons:p},l[r].getId()))}i+=l.length,e.push((0,_.jsx)(tt,{controller:n,groupNode:o,path:o.getPath()},o.getId())),a=!0}else if(a&&e.push(s()),e.push((0,_.jsx)(tt,{controller:n,groupNode:o,path:o.getPath()},o.getId())),a=!0,o.isOpened()){for(let r=0;r<l.length;r++){let a=t.getSelected()===i;r>0&&e.push(s()),e.push((0,_.jsx)(et,{controller:n,border:t.getLocation().getName(),tabNode:l[r],path:xe(l[r]),selected:a,icons:p},l[r].getId())),i++}r&&e.push((0,_.jsx)(nt,{controller:n,groupNode:o,path:o.getPath()+`/end`},o.getId()+`/end`))}continue}let l=o,u=t.getSelected()===i;a&&e.push(s()),e.push((0,_.jsx)(et,{controller:n,border:t.getLocation().getName(),tabNode:l,path:xe(l),selected:u,icons:p},l.getId())),a=!0,i++}return e},ee=()=>{let e,r=[],i=[],o,l={leading:e,buttons:r,stickyButtons:i,overflowPosition:void 0};if(n.customizeTabSet(t,l),e=l.leading,i=l.stickyButtons,r=l.buttons,l.overflowPosition===void 0&&(l.overflowPosition=i.length),i.length>0&&(x?r=[...i,...r]:o=(0,_.jsx)(`div`,{ref:c,onPointerDown:E,onDragStart:e=>{e.preventDefault()},className:F(A.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:i},`sticky_buttons_container`)),S){let e=n.i18nName(G.Overflow_Menu_Tooltip),i;if(typeof p.more==`function`){let e=t.getTabNodes(),n=y.map(t=>({index:t,node:e[t]}));i=p.more(t,n)}else i=(0,_.jsxs)(_.Fragment,{children:[p.more,(0,_.jsx)(`div`,{className:F(A.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:y.length>0?y.length:``})]});r.splice(Math.min(l.overflowPosition,r.length),0,(0,_.jsx)(`button`,{tabIndex:0,"aria-haspopup":`menu`,"aria-expanded":u,"aria-label":e,ref:s,className:F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+` `+F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+t.getLocation().getName()),title:e,onClick:k,onPointerDown:E,children:i},`overflowbutton`))}if(t.getSelected()!==-1){let e=t.getSelectedNode();if(e!==void 0&&n.isMainLayout()){if(e.isEnableFloat()&&e.isEnableFloatIcon()){let t=n.i18nName(G.Popout_Tab_Float);r.push((0,_.jsx)(`button`,{tabIndex:0,title:t,"aria-label":t,className:F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:P,onPointerDown:E,children:typeof p.popoutFloat==`function`?p.popoutFloat(e):p.popoutFloat},`popout-float`))}if(n.isSupportsPopout()&&e.isEnablePopoutIcon()&&e.isAllowedInWindow()){let t=n.i18nName(G.Popout_Tab);r.push((0,_.jsx)(`button`,{tabIndex:0,title:t,"aria-label":t,className:F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:N,onPointerDown:E,children:typeof p.popout==`function`?p.popout(e):p.popout},`popout`))}}}let d=(0,_.jsx)(`div`,{ref:a,className:F(A.FLEXLAYOUT__BORDER_TOOLBAR)+` `+F(A.FLEXLAYOUT__BORDER_TOOLBAR_+t.getLocation().getName()),children:r},`toolbar`);return{leading:e,toolbar:d,stickyBar:o}},te=I(),{leading:ne,toolbar:re,stickyBar:ie}=ee(),ae=F(A.FLEXLAYOUT__BORDER)+` `+F(A.FLEXLAYOUT__BORDER_+t.getLocation().getName());t.getClassName()!==void 0&&(ae+=` `+t.getClassName());let oe,se,L=r-1;t.getLocation()===O.LEFT?(oe=n.getModel().getBorderLeftTabDirection()===`down`?{left:`100%`,top:0}:{right:`100%`,top:0},se={width:L,overflowY:`auto`}):t.getLocation()===O.RIGHT?(oe={left:`100%`,top:0},se={width:L,overflowY:`auto`}):(oe={left:0},se={height:L,overflowX:`auto`});let ce;t.isEnableTabScrollbar()&&(ce=(0,_.jsx)(`div`,{ref:o,"aria-hidden":`true`,className:F(A.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:v}));let le;ne&&(le=(0,_.jsx)(`div`,{className:F(A.FLEXLAYOUT__BORDER_LEADING),children:ne}));let ue=F(A.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+` `+F(A.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+t.getLocation().getName())+(t.getLocation()===O.LEFT&&n.getModel().getBorderLeftTabDirection()===`down`?` `+F(A.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_LEFT_DOWN):``);return(0,_.jsxs)(`div`,{ref:C,style:{display:`flex`,flexDirection:t.getOrientation()===D.VERT?`row`:`column`},className:ae,"data-layout-path":t.getPath(),onClick:w,onAuxClick:w,onContextMenu:T,onWheel:b,children:[le,(0,_.jsxs)(`div`,{className:F(A.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,_.jsxs)(`div`,{ref:l,className:F(A.FLEXLAYOUT__BORDER_INNER)+` `+F(A.FLEXLAYOUT__BORDER_INNER_+t.getLocation().getName()),style:se,onScroll:h,children:[(0,_.jsx)(`div`,{style:oe,role:n.getEditingTab()?.getParent()===t?void 0:`tablist`,"aria-orientation":n.getEditingTab()?.getParent()!==t&&(t.getLocation()===O.LEFT||t.getLocation()===O.RIGHT)?`vertical`:void 0,className:ue,children:te}),ie]}),ce]}),re]})};mt.displayName=`BorderTabSet`;var ht=e=>{let{controller:t,node:n,index:r,horizontal:i}=e,a=g.useRef(null),o=g.useRef([]),s=g.useRef(void 0),c=g.useRef(void 0),l=g.useRef(0),u=g.useRef(0),d=g.useRef({initialSizes:[],sum:0,startPosition:0}),f=g.useRef(void 0),p=g.useCallback(e=>{e.preventDefault(),e.stopImmediatePropagation()},[]);g.useEffect(()=>{let e=a.current;return e?.addEventListener(`touchstart`,p,{passive:!1}),()=>{e?.removeEventListener(`touchstart`,p),f.current!==void 0&&(clearTimeout(f.current),f.current=void 0),s.current&&(t.getRootDiv()?.removeChild(s.current),s.current=void 0,Oe(!0,t.getCurrentDocument()),t.setSplitterDragging(!1))}},[p,t]);let m=e=>{e.stopPropagation(),n instanceof z&&(d.current=n.getSplitterInitials(r)),t.setSplitterDragging(!0),Oe(!1,t.getCurrentDocument()),je(e.currentTarget.ownerDocument,e,y,b,v),o.current=n instanceof U?n.getSplitterBounds(!0):n.getSplitterBounds(r);let f=t.getRootDiv();s.current=t.getCurrentDocument().createElement(`div`),s.current.style.flexDirection=i?`row`:`column`,s.current.className=t.getClassName(A.FLEXLAYOUT__SPLITTER_DRAG)+(n instanceof U?` `+t.getClassName(A.FLEXLAYOUT__SPLITTER_BORDER):``),s.current.style.cursor=n.getOrientation()===D.VERT?`ns-resize`:`ew-resize`,c.current=t.getCurrentDocument().createElement(`div`),c.current.className=C(A.FLEXLAYOUT__SPLITTER_HANDLE)+` `+C(i?A.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:A.FLEXLAYOUT__SPLITTER_HANDLE_VERT),s.current.appendChild(c.current);let p=a.current.getBoundingClientRect(),m=new E(p.x-t.getDomRect().x,p.y-t.getDomRect().y,p.width,p.height);l.current=e.clientX-p.x,u.current=e.clientY-p.y,m.positionElement(s.current),f&&f.appendChild(s.current)},h=e=>{if(Ce(e))return;let a=0;if(i?(e.key===`ArrowLeft`&&(a=-10),e.key===`ArrowRight`&&(a=10)):(e.key===`ArrowUp`&&(a=-10),e.key===`ArrowDown`&&(a=10)),a!==0){if(e.preventDefault(),t.setSplitterDragging(!0),n instanceof U){let e=n.getLocation(),r=e===O.BOTTOM||e===O.RIGHT?-a:a,i=Math.max(n.getMinSize(),Math.min(n.getMaxSize(),n.getSize()+r));t.doAction(j.adjustBorderSplit(n.getId(),i))}else{let e=n.getSplitterInitials(r);if(e.sum<=0){t.setSplitterDragging(!1);return}let i=n.getSplitterBounds(r),o=Math.max(i[0],Math.min(i[1],e.startPosition+a)),s=n.calculateSplit(r,o,e.initialSizes,e.sum,e.startPosition);t.doAction(j.adjustWeights(n.getId(),s))}setTimeout(()=>t.setSplitterDragging(!1),300)}},v=()=>{if(s.current){t.isRealtimeResize()&&x(!1);let e=t.getRootDiv();e&&s.current&&e.removeChild(s.current),s.current=void 0}f.current=window.setTimeout(()=>t.setSplitterDragging(!1),300),Oe(!0,t.getCurrentDocument())},y=(e,r)=>{if(s.current){let i=t.getDomRect();if(!i)return;n.getOrientation()===D.VERT?s.current.style.top=S(r-i.y-u.current)+`px`:s.current.style.left=S(e-i.x-l.current)+`px`,t.isRealtimeResize()&&x(!0)}},b=()=>{if(s.current){x(!1);let e=t.getRootDiv();e&&s.current&&e.removeChild(s.current),s.current=void 0}f.current=window.setTimeout(()=>t.setSplitterDragging(!1),300),Oe(!0,t.getCurrentDocument())},x=e=>{(()=>{if(s.current){let i;if(i=n.getOrientation()===D.VERT?s.current.offsetTop:s.current.offsetLeft,n instanceof U){let r=n.calculateSplit(n,i);t.doAction(j.adjustBorderSplit(n.getId(),r).setAdjusting(e))}else{let a=d.current;if(a.sum<=0)return;let o=n.calculateSplit(r,i,a.initialSizes,a.sum,a.startPosition);t.doAction(j.adjustWeights(n.getId(),o).setAdjusting(e))}}})()},S=e=>{let t=o.current,n=e;return e<t[0]&&(n=t[0]),e>t[1]&&(n=t[1]),n},C=t.getClassName,w={cursor:i?`ew-resize`:`ns-resize`,flexDirection:i?`column`:`row`},T=C(A.FLEXLAYOUT__SPLITTER)+` `+C(A.FLEXLAYOUT__SPLITTER_+n.getOrientation().getName());n instanceof U?T+=` `+C(A.FLEXLAYOUT__SPLITTER_BORDER):n.getModel().getMaximizedTabset(t.getLayoutId())!==void 0&&(w.display=`none`),ve()||(w[`--fl-splitter-active-size`]=`30px`);let k,M,N,P;if(n instanceof z){let e=n.getRect(),t=n.getChildren()[r-1],a=i?e.width:e.height;if(t&&a>0){let n=t.getRect();k=Math.round((i?n.getRight()-e.x:n.getBottom()-e.y)/a*100),M=0,N=100,P=k+`%`}}else k=Math.round(n.getSize()),M=Math.round(n.getMinSize()),N=Math.round(n.getMaxSize()),P=k+`px`;return(0,_.jsx)(`div`,{className:T,style:w,ref:a,role:`separator`,"aria-label":t.i18nName(G.Splitter),"aria-orientation":i?`vertical`:`horizontal`,"aria-valuenow":k,"aria-valuemin":M,"aria-valuemax":N,"aria-valuetext":P,tabIndex:0,onKeyDown:h,"data-layout-path":n.getPath()+`/s`+(r-1),onPointerDown:m,children:(0,_.jsx)(`div`,{className:C(A.FLEXLAYOUT__SPLITTER_HANDLE)+` `+C(i?A.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:A.FLEXLAYOUT__SPLITTER_HANDLE_VERT)})})};ht.displayName=`Splitter`;function gt(e){let{controller:t,borderNode:n,show:r}=e,i=g.useRef(null),a=g.useCallback(e=>{i.current=e,t.registerMeasurable(n,`bordercontent`,e)},[t,n]),o=!0,s={};n.getOrientation()===D.HORZ?(s.width=n.getSize(),s.minWidth=n.getMinSize(),s.maxWidth=n.getMaxSize()):(s.height=n.getSize(),s.minHeight=n.getMinSize(),s.maxHeight=n.getMaxSize(),o=!1);let c=t.getClassName(A.FLEXLAYOUT__BORDER_TAB_CONTENTS),l=n.getLocation()===O.LEFT||n.getLocation()===O.TOP;if(n.isOverlay()){s.display=`flex`;let e={display:r?`flex`:`none`};if(o){let r=t.getModel();for(let t of r.getBorderSet().getBorders())if(t!==n&&t.isOverlay()&&t.isShowing()&&t.getSelected()!==-1){let n=t.getSize()+r.getSplitterSize();t.getLocation()===O.TOP?e.top=n:t.getLocation()===O.BOTTOM&&(e.bottom=n)}}let i=t.getClassName(A.FLEXLAYOUT__BORDER_TAB_OVERLAY)+` `+t.getClassName(A.FLEXLAYOUT__BORDER_TAB_OVERLAY_+n.getLocation().getName());return(0,_.jsxs)(`div`,{className:i,style:e,children:[l&&(0,_.jsx)(`div`,{ref:a,style:s,className:c}),r&&(0,_.jsx)(ht,{controller:t,node:n,index:0,horizontal:o}),!l&&(0,_.jsx)(`div`,{ref:a,style:s,className:c})]})}return s.display=r?`flex`:`none`,l?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{ref:a,style:s,className:c}),r&&(0,_.jsx)(ht,{controller:t,node:n,index:0,horizontal:o})]}):(0,_.jsxs)(_.Fragment,{children:[r&&(0,_.jsx)(ht,{controller:t,node:n,index:0,horizontal:o}),(0,_.jsx)(`div`,{ref:a,style:s,className:c})]})}gt.displayName=`BorderTab`;var _t=({controller:e,inner:t})=>{let n=e.getClassName(A.FLEXLAYOUT__LAYOUT_MAIN),r=e.getModel().getBorderSet().getBorderMap();if(e.isMainLayout()&&r.size>0){let i=(0,_.jsx)(`div`,{className:n,ref:e.getMainRef(),children:t}),a=new Map,o=new Map;for(let[t,n]of O.values){let t=r.get(n);t&&t.isShowing()&&(!t.isAutoHide()||t.isAutoHide()&&(t.getChildren().length>0||e.getState().showHiddenBorder===n))&&(a.set(n,(0,_.jsx)(mt,{controller:e,borderNode:t,size:e.getState().calculatedBorderBarSize})),o.set(n,(0,_.jsx)(gt,{controller:e,borderNode:t,show:t.getSelected()!==-1})))}let s=e.getClassName(A.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),c=e.getClassName(A.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER),l=(0,_.jsxs)(`div`,{className:c,style:{flexDirection:`column`},children:[o.get(O.TOP),(0,_.jsxs)(`div`,{className:c,style:{flexDirection:`row`},children:[o.get(O.LEFT),i,o.get(O.RIGHT)]}),o.get(O.BOTTOM)]});return(0,_.jsxs)(`div`,{className:s,style:{flexDirection:`column`},children:[a.get(O.TOP),(0,_.jsxs)(`div`,{className:c,style:{flexDirection:`row`},children:[a.get(O.LEFT),l,a.get(O.RIGHT)]}),a.get(O.BOTTOM)]})}return(0,_.jsx)(`div`,{className:n,ref:e.getMainRef(),style:{position:`absolute`,top:0,left:0,bottom:0,right:0,display:`flex`},children:t})};_t.displayName=`BorderContainer`;var vt={width:`1em`,height:`1em`,display:`flex`,alignItems:`center`},yt=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 24 24`,children:[(0,_.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,_.jsx)(`path`,{stroke:`var(--fl-color-icon)`,fill:`var(--fl-color-icon)`,d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`})]});yt.displayName=`CloseIcon`;var bt=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,_.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,_.jsx)(`path`,{transform:`rotate(45 12 12)`,d:`M16 9V4h1a1 1 0 000-2H7a1 1 0 000 2h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z`})]});bt.displayName=`PinIcon`;var xt=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,_.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,_.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z`})]});xt.displayName=`MaximizeIcon`;var St=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,_.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,_.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M7 10l5 5 5-5z`})]});St.displayName=`OverflowIcon`;var Ct=()=>(0,_.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:{display:`block`,width:10,height:10},preserveAspectRatio:`none`,viewBox:`0 0 100 100`,children:(0,_.jsx)(`path`,{fill:`var(--fl-color-edge-icon)`,stroke:`var(--fl-color-edge-icon)`,d:`M10 30 L90 30 l-40 40 Z`})});Ct.displayName=`EdgeIcon`;var wt=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 20 20`,fill:`var(--fl-color-icon)`,children:[(0,_.jsx)(`path`,{d:`M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z`}),(0,_.jsx)(`path`,{d:`M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z`})]});wt.displayName=`PopoutIcon`;var Tt=()=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 -960 960 960`,style:vt,fill:`var(--fl-color-icon)`,children:(0,_.jsx)(`path`,{d:`M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z`})});Tt.displayName=`PopoutFloatIcon`;var Et=()=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,style:vt,fill:`var(--fl-color-icon)`,children:(0,_.jsx)(`path`,{d:`M4 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm6-12a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm6-12a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z`})});Et.displayName=`GripIcon`;var Dt=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,_.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,_.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z`})]});Dt.displayName=`RestoreIcon`;var Ot=()=>(0,_.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,height:`24px`,viewBox:`0 -960 960 960`,width:`24px`,children:(0,_.jsx)(`path`,{fill:`var(--fl-color-icon)`,stroke:`var(--fl-color-icon)`,d:`M440-120v-264L254-197l-57-57 187-186H120v-80h264L197-706l57-57 186 187v-264h80v264l186-187 57 57-187 186h264v80H576l187 186-57 57-186-187v264h-80Z`})});Ot.displayName=`AsterickIcon`;var kt=e=>{let{controller:t,tabNode:n,selected:r,path:i}=e,a=g.useRef(null),o=g.useRef(null),s=t.getIcons(),c=t.getKeyMap(),l=t.getEditingTab()===n,u=g.useCallback(e=>{a.current=e,t.registerMeasurable(n,`tabbutton`,e)},[t,n]);g.useLayoutEffect(()=>{l&&o.current.select()},[l]),g.useEffect(()=>{if(l){let e=t.getCurrentDocument().body,n=e=>{e.target!==o.current&&t.setEditingTab(void 0)};return e.addEventListener(`pointerdown`,n),()=>e.removeEventListener(`pointerdown`,n)}},[l,t]);let d=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},f=e=>{t.getDragDropManager().onDragEnded()},p=e=>{De(e)&&t.auxMouseClick(n,e)},m=e=>{t.showContextMenu(n,e)},h=()=>{n.isSelected()||t.doAction(j.selectTab(n.getId()))},v=e=>{let t=a.current?.closest(`[role="tablist"]`);if(t){let n=Array.from(t.querySelectorAll(`[role="tab"]`));n[n.indexOf(a.current)+e]?.focus()}},y=()=>{let e=a.current.ownerDocument,t=()=>Ee(e.getElementById(be(`flexlayout-tab-`,n.getId())));r?t():(h(),requestAnimationFrame(t))},b=e=>{l||(Se(e,c.focusTabToggle)?(y(),e.preventDefault()):e.key===`Enter`||e.key===` `?(r?y():h(),e.preventDefault()):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&!Ce(e)?(v(-1),e.preventDefault()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&!Ce(e)?(v(1),e.preventDefault()):Se(e,c.closeTab)&&n.isCloseable()?(v(1),t.doAction(j.deleteTab(n.getId())),e.preventDefault()):Se(e,c.renameTab)&&n.isEnableRename()&&(S(),e.preventDefault()))},x=e=>{n.isEnableRename()&&(S(),e.stopPropagation())},S=()=>{t.setEditingTab(n)},C=()=>{let e=n.getCloseType();return!!(r||e===F.Always||e===F.Visible&&t.getCurrentWindow()?.matchMedia(`(hover: hover) and (pointer: fine)`).matches)},w=e=>{C()&&(t.doAction(j.deleteTab(n.getId())),e.stopPropagation())},T=e=>{e.stopPropagation()},E=e=>{e.stopPropagation()},D=e=>{e.code===`Escape`?(t.setEditingTab(void 0),a.current?.focus()):(e.code===`Enter`||e.code===`NumpadEnter`)&&(t.setEditingTab(void 0),t.doAction(j.renameTab(n.getId(),e.target.value)),a.current?.focus())},O=t.getClassName,k=n.getTabContainer(),M=n.getParent()instanceof V?n.getParent():void 0,N=k.isEnableSingleTabStretch()&&k.getChildren().length===1&&k.getChildren()[0]===n,P=N?A.FLEXLAYOUT__TAB_BUTTON_STRETCH:A.FLEXLAYOUT__TAB_BUTTON,I=O(P);I+=` `+O(P+`_`+k.getTabLocation()),N||(I+=r?` `+O(P+`--selected`):` `+O(P+`--unselected`)),n.isPinned()&&(I+=` `+O(P+`--pinned`)),M!==void 0&&(I+=` `+O(A.FLEXLAYOUT__TAB_BUTTON_GROUPED),n.getModel().getTabGroupType()===`underline`&&(I+=` `+O(A.FLEXLAYOUT__TAB_BUTTON_GROUPED_UNDERLINE))),n.getClassName()!==void 0&&(I+=` `+n.getClassName());let ee=ye(t,n),te=r||k.getSelectedNode()===void 0&&k.getTabNodes()[0]===n,ne=[Te(c.focusTabToggle),n.isCloseable()?Te(c.closeTab):void 0,n.isEnableRename()?Te(c.renameTab):void 0].filter(Boolean).join(` `)||void 0,re=ee.content?(0,_.jsx)(`div`,{className:O(A.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:ee.content}):null,ie=ee.leading?(0,_.jsx)(`div`,{className:O(A.FLEXLAYOUT__TAB_BUTTON_LEADING),children:ee.leading}):null;if(l&&(re=(0,_.jsx)(`input`,{ref:o,className:O(A.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":i+`/textbox`,type:`text`,"aria-label":t.i18nName(G.Rename_Tab),autoFocus:!0,defaultValue:n.getName(),onKeyDown:D,onPointerDown:E})),n.isPinned()){let e=t.i18nName(G.Pinned_Tab);ee.buttons.push((0,_.jsx)(`div`,{"data-layout-path":i+`/button/pin`,title:e,"aria-hidden":`true`,className:O(A.FLEXLAYOUT__TAB_BUTTON_PIN),children:typeof s.pin==`function`?s.pin(n):s.pin},`pin`))}if(n.isCloseable()&&!N){let e=t.i18nName(G.Close_Tab);ee.buttons.push((0,_.jsx)(`div`,{"data-layout-path":i+`/button/close`,title:e,"aria-hidden":`true`,className:O(A.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:T,onClick:w,children:typeof s.close==`function`?s.close(n):s.close},`close`))}let ae={};return M!==void 0&&(ae[`--flexlayout-group-color`]=M.getColor()),(0,_.jsxs)(`div`,{ref:u,id:be(`flexlayout-tabbutton-`,n.getId()),role:l?void 0:`tab`,"aria-selected":l?void 0:r,"aria-controls":l?void 0:be(`flexlayout-tab-`,n.getId()),"aria-label":l?void 0:n.isPinned()?ee.name+` (`+t.i18nName(G.Pinned_Tab)+`)`:ee.name,"aria-keyshortcuts":l?void 0:ne,tabIndex:l?-1:te?0:-1,onKeyDown:b,"data-layout-path":i,className:I,style:ae,onClick:h,onAuxClick:p,onContextMenu:m,title:n.getHelpText(),draggable:!0,onDragStart:d,onDragEnd:f,onDoubleClick:x,children:[ie,re,ee.buttons]})};kt.displayName=`TabButton`;var At=e=>{let{tabsetNode:t,controller:n}=e,r=g.useRef(null),i=g.useRef(null),a=g.useRef(null),o=g.useRef(null),s=g.useRef(null),c=g.useRef(null),l=g.useRef(null),u=g.useRef(null),[d,f]=g.useState(!1),p=g.useRef(null),m=n.getIcons();g.useEffect(()=>()=>p.current?.(),[]);let{userControlledPositionRef:h,onScroll:y,onScrollPointerDown:b,hiddenTabs:x,onMouseWheel:S,isDockStickyButtons:C,isShowHiddenTabs:w}=ft(n,t,D.HORZ,o,a,i,n.getClassName(A.FLEXLAYOUT__TAB_BUTTON),u),T=g.useCallback(e=>{r.current=e,n.registerMeasurable(t,`tabset`,e)},[n,t]),E=g.useCallback(e=>{i.current=e,n.registerMeasurable(t,`tabstrip`,e)},[n,t]),O=g.useCallback(e=>{s.current=e,n.registerMeasurable(t,`tabsetcontent`,e)},[n,t]),k=e=>{let r=n.getShowOverflowMenu(),i=t.getTabNodes(),a=x.map(e=>({index:e,node:i[e]}));if(r!==void 0)r(t,e,a,M);else{let e=l.current;f(!0),p.current=dt(e,t,a,M,n,()=>{f(!1),p.current=null})}e.stopPropagation()},M=e=>{n.doAction(j.selectTab(e.node.getId())),h.current=!1},N=e=>{n.getEditingTab()?e.preventDefault():t.isEnableDrag()?(e.stopPropagation(),n.getDragDropManager().setDragNode(e.nativeEvent,t)):e.preventDefault()},P=e=>{n.getDragDropManager().onDragEnded()},F=e=>{!De(e)&&!t.isActive()&&n.doAction(j.setActiveTabset(t.getId(),n.getLayoutId()))},I=e=>{De(e)&&n.auxMouseClick(t,e)},ee=e=>{n.showContextMenu(t,e)},te=e=>{e.stopPropagation()},ne=e=>{t.canMaximize()&&n.maximize(t),e.stopPropagation()},re=e=>{n.doAction(j.deleteTabset(t.getId())),e.stopPropagation()},ie=e=>{n.doAction(j.deleteTab(t.getChildren()[0].getId())),e.stopPropagation()},ae=e=>{ce!==void 0&&n.doAction(j.popoutTab(ce.getId(),`window`)),e.stopPropagation()},oe=e=>{ce!==void 0&&n.doAction(j.popoutTab(ce.getId(),`float`)),e.stopPropagation()},se=e=>{t.canMaximize()&&n.maximize(t)},L=n.getClassName,ce=t.getSelectedNode(),le=t.getPath(),ue=t.getChildren(),de=t.isEnableSingleTabStretch()&&ue.length===1&&ue[0]instanceof W,R=(e,n,r,i)=>{let a=L(A.FLEXLAYOUT__TABSET_TAB_SPACER);return i&&(a+=` `+L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER)),!t.isEnableTabWrap()&&!de&&(n?a+=` `+L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_BEFORE):r&&(a+=` `+L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER))),(0,_.jsx)(`div`,{className:a,children:(0,_.jsx)(`div`,{className:L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},`divider`+e)},z=()=>{let e=[],r=n.getModel().getTabGroupType()===`splitpill`,i=0,a=0,o=!1,s=!1,c=!1;if(t.isEnableTabStrip()){for(let l of ue){if(l instanceof V){if(e.push(R(a++,!1,o,c)),e.push((0,_.jsx)(tt,{controller:n,groupNode:l,path:l.getPath()},l.getId())),c=!0,s=!1,l.isOpened()){let u=l.getChildren();for(let r=0;r<u.length;r++){let l=u[r],d=t.getSelected()===i;e.push(R(a++,d,o,r>0)),e.push((0,_.jsx)(kt,{controller:n,tabNode:l,path:xe(l),selected:d},l.getId())),o=d,s=!0,c=!0,i++}r&&(e.push(R(a++,!1,o,!1)),e.push((0,_.jsx)(nt,{controller:n,groupNode:l,path:l.getPath()+`/end`},l.getId()+`/end`)),o=!1)}continue}let u=l,d=t.getSelected()===i;e.push(R(a++,d,o,c)),e.push((0,_.jsx)(kt,{controller:n,tabNode:u,path:xe(u),selected:d},u.getId())),o=d,s=!0,c=!0,i++}if(s){let n=L(A.FLEXLAYOUT__TABSET_TAB_SPACER);!t.isEnableTabWrap()&&!de&&o&&(n+=` `+L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER)),e.push((0,_.jsx)(`div`,{className:n,children:(0,_.jsx)(`div`,{className:L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},`divider`+a))}}return e},B=()=>{let e,r=[],i=[],a={leading:e,stickyButtons:r,buttons:i,overflowPosition:void 0};n.customizeTabSet(t,a),e=a.leading,r=a.stickyButtons,i=a.buttons;let o=de,s=o&&t.getChildren()[0].isCloseable()||t.isCloseable();s&&=t.isEnableCloseButton(),a.overflowPosition===void 0&&(a.overflowPosition=r.length);let f;if(r.length>0&&(!t.isEnableTabWrap()&&(C||o)?i=[...r,...i]:f=(0,_.jsx)(`div`,{ref:u,onPointerDown:te,onDragStart:e=>{e.preventDefault()},className:L(A.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:r},`sticky_buttons_container`)),!t.isEnableTabWrap()&&w){let e=n.i18nName(G.Overflow_Menu_Tooltip),r;if(typeof m.more==`function`){let e=t.getTabNodes(),n=x.map(t=>({index:t,node:e[t]}));r=m.more(t,n)}else r=(0,_.jsxs)(_.Fragment,{children:[m.more,(0,_.jsx)(`div`,{className:L(A.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:x.length>0?x.length:``})]});i.splice(Math.min(a.overflowPosition,i.length),0,(0,_.jsx)(`button`,{tabIndex:0,"data-layout-path":le+`/button/overflow`,"aria-haspopup":`menu`,"aria-expanded":d,"aria-label":e,ref:l,className:L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+L(A.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:e,onClick:k,onPointerDown:te,children:r},`overflowbutton`))}if(ce!==void 0&&!ce.isPinned()){if(ce.isEnableFloat()&&ce.isEnableFloatIcon()){let e=n.i18nName(G.Popout_Tab_Float);i.push((0,_.jsx)(`button`,{tabIndex:0,"data-layout-path":le+`/button/popout-float`,title:e,"aria-label":e,className:L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:oe,onPointerDown:te,children:typeof m.popoutFloat==`function`?m.popoutFloat(ce):m.popoutFloat},`popout-float`))}if(n.isSupportsPopout()&&ce.isAllowedInWindow()&&ce.isEnablePopoutIcon()){let e=n.i18nName(G.Popout_Tab);i.push((0,_.jsx)(`button`,{tabIndex:0,"data-layout-path":le+`/button/popout`,title:e,"aria-label":e,className:L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:ae,onPointerDown:te,children:typeof m.popout==`function`?m.popout(ce):m.popout},`popout`))}}if(t.canMaximize()){let e=n.i18nName(G.Restore),r=n.i18nName(G.Maximize);i.push((0,_.jsx)(`button`,{tabIndex:0,"data-layout-path":le+`/button/max`,title:t.isMaximized()?e:r,"aria-label":t.isMaximized()?e:r,"aria-pressed":t.isMaximized(),className:L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(t.isMaximized()?`max`:`min`)),onClick:ne,onPointerDown:te,children:t.isMaximized()?typeof m.restore==`function`?m.restore(t):m.restore:typeof m.maximize==`function`?m.maximize(t):m.maximize},`max`))}if(!t.isMaximized()&&s){let e=o?n.i18nName(G.Close_Tab):n.i18nName(G.Close_Tabset);i.push((0,_.jsx)(`button`,{tabIndex:0,"data-layout-path":le+`/button/close`,title:e,"aria-label":e,className:L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:o?ie:re,onPointerDown:te,children:typeof m.closeTabset==`function`?m.closeTabset(t):m.closeTabset},`close`))}if(t.isActive()&&t.isEnableActiveIcon()){let e=n.i18nName(G.Active_Tabset);i.push((0,_.jsx)(`div`,{"data-layout-path":le+`/button/active`,title:e,"aria-hidden":`true`,className:L(A.FLEXLAYOUT__TAB_TOOLBAR_ICON),children:typeof m.activeTabset==`function`?m.activeTabset(t):m.activeTabset},`active`))}let p=(0,_.jsx)(`div`,{ref:c,className:L(A.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:te,onDragStart:e=>{e.preventDefault()},children:i},`buttonbar`);return{leading:e,buttonbar:p,stickyBar:f}},fe=(e,r,i,s)=>{let c,l=n.getKeyMap(),u=[Te(l.focusNextTabset),Te(l.focusPreviousTabset)].filter(Boolean).join(` `)||void 0,d=n.getEditingTab()?.getParent()===t,f=d?void 0:`tablist`,p=L(A.FLEXLAYOUT__TABSET_TABBAR_OUTER);t.getClassNameTabStrip()!==void 0&&(p+=` `+t.getClassNameTabStrip()),p+=` `+L(A.FLEXLAYOUT__TABSET_TABBAR_OUTER_+t.getTabLocation()),t.isActive()&&(p+=` `+L(A.FLEXLAYOUT__TABSET_SELECTED)),t.isMaximized()&&(p+=` `+L(A.FLEXLAYOUT__TABSET_MAXIMIZED));let m=de;if(m){let e=t.getChildren()[0];e.getTabSetClassName()!==void 0&&(p+=` `+e.getTabSetClassName())}let h;if(r&&(h=(0,_.jsx)(`div`,{className:L(A.FLEXLAYOUT__TABSET_LEADING),children:r})),t.isEnableTabWrap())t.isEnableTabStrip()&&(c=(0,_.jsxs)(`div`,{className:p,style:{flexWrap:`wrap`,gap:`1px`,marginTop:`2px`},ref:E,"data-layout-path":le+`/tabstrip`,onPointerDown:F,onDoubleClick:se,onContextMenu:ee,onClick:I,onAuxClick:I,draggable:!0,onDragStart:N,onDragEnd:P,children:[h,(0,_.jsx)(`div`,{role:f,"aria-orientation":d?void 0:`horizontal`,"aria-label":d?void 0:t.getName(),"aria-keyshortcuts":d?void 0:u,style:{display:`contents`},children:e}),s,(0,_.jsx)(`div`,{style:{flexGrow:1,display:`flex`,justifyContent:`flex-end`},children:i})]}));else if(t.isEnableTabStrip()){let n;t.isEnableTabScrollbar()&&(n=(0,_.jsx)(`div`,{ref:a,"aria-hidden":`true`,className:L(A.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:b})),c=(0,_.jsxs)(`div`,{className:p,ref:E,"data-layout-path":le+`/tabstrip`,onPointerDown:F,onDoubleClick:se,onContextMenu:ee,onClick:I,onAuxClick:I,draggable:!0,onWheel:S,onDragStart:N,onDragEnd:P,children:[h,(0,_.jsxs)(`div`,{className:L(A.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,_.jsxs)(`div`,{ref:o,className:L(A.FLEXLAYOUT__TABSET_TABBAR_INNER)+` `+L(A.FLEXLAYOUT__TABSET_TABBAR_INNER_+t.getTabLocation()),style:{overflowX:`auto`,overflowY:`hidden`},onScroll:y,children:[(0,_.jsx)(`div`,{style:{width:m?`100%`:`none`},role:f,"aria-orientation":d?void 0:`horizontal`,"aria-label":d?void 0:t.getName(),"aria-keyshortcuts":d?void 0:u,className:L(A.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+` `+L(A.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+t.getTabLocation()),children:e}),s]}),n]}),i]})}return c},pe=e=>{let r;if(t.getTabNodes().length===0){let e=n.getTabSetPlaceHolderCallback();e&&(r=e(t))}let i=(0,_.jsx)(`div`,{ref:O,className:L(A.FLEXLAYOUT__TABSET_CONTENT),children:r});return i=t.getTabLocation()===`top`?(0,_.jsxs)(_.Fragment,{children:[e,i]}):(0,_.jsxs)(_.Fragment,{children:[i,e]}),i},me=z(),{leading:he,buttonbar:H,stickyBar:U}=B(),ge=pe(fe(me,he,H,U)),_e={flexGrow:Math.max(1,t.getWeight()*1e3),minWidth:t.getMinWidth(),minHeight:t.getMinHeight(),maxWidth:t.getMaxWidth(),maxHeight:t.getMaxHeight()};t.getModel().getMaximizedTabset(n.getLayoutId())!==void 0&&!t.isMaximized()&&(_e.display=`none`);let ve=(0,_.jsx)(`div`,{ref:T,className:L(A.FLEXLAYOUT__TABSET_CONTAINER),style:_e,children:(0,_.jsx)(`div`,{className:L(A.FLEXLAYOUT__TABSET),"data-layout-path":le,children:ge})});return t.isMaximized()&&n.getMainElement()?(0,v.createPortal)((0,_.jsx)(`div`,{style:{position:`absolute`,display:`flex`,top:0,left:0,bottom:0,right:0},children:ve}),n.getMainElement()):ve};At.displayName=`TabSet`;var jt=e=>{let{controller:t,rowNode:n}=e,r=g.useRef(null),i=n.getOrientation()===D.HORZ,a=g.useCallback(e=>{r.current=e,t.registerMeasurable(n,`row`,e)},[t,n]),o=[],s=0;for(let e of n.getChildren())s>0&&o.push((0,_.jsx)(ht,{controller:t,node:n,index:s,horizontal:i},`splitter`+s)),e instanceof z?o.push((0,_.jsx)(jt,{controller:t,rowNode:e},e.getId())):e instanceof R&&o.push((0,_.jsx)(At,{controller:t,tabsetNode:e},e.getId())),s++;let c={flexGrow:Math.max(1,n.getWeight()*1e3),minWidth:n.getMinWidth(),minHeight:n.getMinHeight(),maxWidth:n.getMaxWidth(),maxHeight:n.getMaxHeight()};return c.flexDirection=i?`row`:`column`,(0,_.jsx)(`div`,{ref:a,className:t.getClassName(A.FLEXLAYOUT__ROW),style:c,children:o})};jt.displayName=`Row`;var Mt=e=>{let{controller:t,selected:n,tabNode:r}=e,i=g.useRef(null),a=g.useRef(!0),o=g.useCallback(()=>{let e=r.getParent();e instanceof R&&(e.isActive()||t.doAction(j.setActiveTabset(e.getId(),t.getLayoutId())))},[r,t]),s=r.getParent(),c=t.getKeyMap().focusTabToggle,l=e=>{if(Se(e,c)){let t=e.currentTarget.ownerDocument.getElementById(be(`flexlayout-tabbutton-`,r.getId()));t&&(t.focus(),e.preventDefault(),e.stopPropagation())}};g.useLayoutEffect(()=>{let e=r.getMoveableElement(),n=i.current.ownerDocument,a=e.ownerDocument!==n;a&&n.adoptNode(e),e.parentElement!==i.current&&i.current.appendChild(e),a&&t.redrawLayoutAndTabContent();let s=()=>{r.saveScrollPosition()};e.addEventListener(`scroll`,s);let c=i.current;return c&&c.addEventListener(`pointerdown`,o),()=>{c&&c.removeEventListener(`pointerdown`,o),e.removeEventListener(`scroll`,s),e.isConnected||(t.getModel().getNodeById(r.getId())&&(r.isEnableWindowReMount()||t.getMainController()?.getMoveablesHome()?.appendChild(e)),r.setVisible(!1))}},[r,t,o]),g.useEffect(()=>{r.isSelected()&&(a.current&&=(r.restoreScrollPosition(),!1))}),g.useLayoutEffect(()=>(t.registerTabPanel(r,i.current),()=>{t.registerTabPanel(r,null)}),[t,r]);let u=t.getClassName,d=null;if(n&&document.hidden&&r.isEnablePopoutOverlay()){let e={};s.getContentRect().styleWithPosition(e);let t=u(A.FLEXLAYOUT__TAB_OVERLAY);s instanceof U&&s.isOverlay()&&(t+=` `+u(A.FLEXLAYOUT__TAB_OVERLAY_RAISED)),d=(0,_.jsx)(`div`,{style:e,className:t})}let f=u(A.FLEXLAYOUT__TAB);return s instanceof U&&(f+=` `+u(A.FLEXLAYOUT__TAB_BORDER),f+=` `+u(A.FLEXLAYOUT__TAB_BORDER_+s.getLocation().getName()),s.isOverlay()&&(f+=` `+u(A.FLEXLAYOUT__TAB_BORDER_OVERLAY))),r.getContentClassName()!==void 0&&(f+=` `+r.getContentClassName()),(0,_.jsxs)(_.Fragment,{children:[d,(0,_.jsx)(`div`,{ref:i,id:be(`flexlayout-tab-`,r.getId()),role:`tabpanel`,"aria-labelledby":be(`flexlayout-tabbutton-`,r.getId()),"aria-keyshortcuts":Te(c),tabIndex:-1,onKeyDown:c?l:void 0,className:f,"data-layout-path":r.getPath()})]})};Mt.displayName=`Tab`;var Nt=class extends g.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){}retry=()=>{this.setState({hasError:!1})};render(){return this.state.hasError?(0,_.jsx)(`div`,{className:A.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER,children:(0,_.jsx)(`div`,{role:`alert`,className:A.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT,children:(0,_.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`},children:[this.props.message,(0,_.jsx)(`p`,{children:(0,_.jsx)(`button`,{tabIndex:0,onClick:this.retry,children:this.props.retryText})})]})})}):this.props.children}},Pt=g.memo(({controller:e,tabNode:t})=>{let n;if(t.getComponent())n=e.getFactory()(t);else if(t.getSubLayoutId()){let r=t.getModel().getLayouts().get(t.getSubLayoutId());n=(0,_.jsx)(`div`,{className:e.getClassName(A.FLEXLAYOUT__TAB_LAYOUT_CONTAINER),children:(0,_.jsx)(Wt,{...e.getProps(),layoutId:t.getSubLayoutId(),path:t.getPath()+r.getPath(),mainLayoutController:e.getMainController()})})}return(0,_.jsx)(Nt,{message:e.i18nName(G.Error_rendering_component),retryText:e.i18nName(G.Error_rendering_component_retry),children:n})},Ft);Pt.displayName=`TabContentRenderer`;function Ft(e,t){return!t.visible||e.windowId===t.windowId&&e.fullRedrawRevision===t.fullRedrawRevision&&e.parentRedrawRevision===t.parentRedrawRevision&&e.tabNode===t.tabNode&&t.tabNode.getSubLayoutId()===void 0}var It=class e{static dragState=void 0;_controller;_dragEnterCount=0;_dragging=!1;_active=!1;_dropInfo;_outlineDiv;_mainController;constructor(e){this._controller=e,this._mainController=e.getMainController()}isDockTarget(){return this._controller.getLayout().getLayoutId()!==e.dragState?.floatLayoutId}isExcludeCenter(){if(e.dragState?.dockFloatToMain)return!0;let t=e.dragState?.dragNode;return t instanceof R?!t.isEnableClose()||t.getPinnedRunLength()>0:!1}addTabWithDragAndDrop(t,n,r){let i=W.fromJson(n,this._controller.getModel(),!1);e.dragState=new Lt(this._controller.getMainController(),`add`,i,n,r)}onDragEnded(){this.clearDragMain(),e.dragState=void 0}moveTabWithDragAndDrop(e,t){this.setDragNode(e,t)}startDockLayoutDrag(t,n,r){let i=n.getRootRow();e.dragState=new Lt(this._controller.getMainController(),`float`,i,void 0,void 0,!0,n.getLayoutId(),r),t.dataTransfer.setData(`text/plain`,`--flexlayout--`),t.dataTransfer.effectAllowed=`copyMove`,t.dataTransfer.dropEffect=`move`,this._dragEnterCount=0,this._controller.getModel().sortLayouts();let a=0;n.getRootRow()?.forEachNode(e=>{e instanceof W&&a++},0);let o=this._controller.i18nName(G.Dock_Float_Tabs).replace(`?`,String(a)),s=!1;if(this._controller.getProps().onRenderDragRect){let e=this._controller.getProps().onRenderDragRect(o,i,void 0);e&&(this.setDragComponent(t,e,10,10),s=!0)}s||this.setDragComponent(t,o,10,10)}setDragNode=(t,n)=>{if(e.dragState=new Lt(this._controller.getMainController(),`internal`,n,void 0,void 0),t.dataTransfer.setData(`text/plain`,`--flexlayout--`),t.dataTransfer.effectAllowed=`copyMove`,t.dataTransfer.dropEffect=`move`,this._dragEnterCount=0,this._controller.getModel().sortLayouts(),n instanceof R){let e=!1,r=this._controller.i18nName(G.Move_Tabset);if(n.getChildren().length>0&&(r=this._controller.i18nName(G.Move_Tabs).replace(`?`,String(n.getChildren().length))),this._controller.getProps().onRenderDragRect){let i=this._controller.getProps().onRenderDragRect(r,n,void 0);i&&(this.setDragComponent(t,i,10,10),e=!0)}e||this.setDragComponent(t,r,10,10)}else if(n instanceof V){let e=!1,r=this._controller.i18nName(G.Move_Group).replace(`?`,String(n.getChildren().length));if(this._controller.getProps().onRenderDragRect){let i=this._controller.getProps().onRenderDragRect(r,n,void 0);i&&(this.setDragComponent(t,i,10,10),e=!0)}e||this.setDragComponent(t,r,10,10)}else{let e=t.target;if(e&&typeof e.getBoundingClientRect==`function`){let r=e.getBoundingClientRect(),i=t.clientX-r.left,a=t.clientY-r.top,o=n?.getParent(),s=o instanceof U&&o.getOrientation()===D.HORZ,c=s?10:i,l=s?10:a,u=!1;if(this._controller.getProps().onRenderDragRect){let e=(0,_.jsx)(rt,{controller:this._controller,tabNode:n},n.getId()),r=this._controller.getProps().onRenderDragRect(e,n,void 0);r&&(this.setDragComponent(t,r,c,l),u=!0)}u||(Ne()?this.setDragComponent(t,(0,_.jsx)(rt,{tabNode:n,controller:this._controller}),c,l):t.dataTransfer.setDragImage(n.getTabStamp(),c,l))}}};setDragComponent(e,t,n,r){let i=(0,_.jsx)(`div`,{style:{position:`unset`},className:this._controller.getClassName(A.FLEXLAYOUT__LAYOUT)+` `+this._controller.getClassName(A.FLEXLAYOUT__DRAG_RECT),children:t}),a=this._controller.getCurrentDocument(),o=a.createElement(`div`);o.setAttribute(`data-layout-path`,`/drag-rectangle`),o.style.position=`absolute`,o.style.left=`-10000px`,o.style.top=`-10000px`,a.body.appendChild(o);let s=(0,y.createRoot)(o);(0,v.flushSync)(()=>s.render(i)),e.dataTransfer.setDragImage(o,n,r),setTimeout(()=>{s.unmount(),a.body.removeChild(o)},0)}updateActive(t){let n=Array.from(this._controller.getModel().getLayouts().values()),r=e.dragState?.dockFloatToMain===!0,i,a;for(let t=n.length-1;t>=0;t--){let o=n[t];if(r&&o.getLayoutId()===e.dragState?.floatLayoutId)continue;let s=Ut(o)?.getDragDropManager();s&&s.getDragEnterCount()>0&&(o.getType()===`tab`?a=o:!i&&!a&&(i=o))}if(a){let e=a.findParentLayout();(i===e||!i)&&(i=a)}i&&Ut(i).getDragDropManager().setActive(!0,t);for(let e of n)e!==i&&Ut(e)?.getDragDropManager().setActive(!1,t)}setActive(e,t){this._active!==e&&(this._active=e,this._active?this.onDragEnter(t):this.onDragLeave(t))}onDragEnterRaw=e=>{this._dragEnterCount++,this.updateActive(e)};onDragLeaveRaw=e=>{this._dragEnterCount--,this.updateActive(e)};clearDragMain(){this._controller.showOverlayOnAllWindows(!1);for(let[,e]of this._controller.getModel().getLayouts()){let t=Ut(e);t&&t.getDragDropManager().clearDragLocal()}}clearDragLocal(){this._dragEnterCount=0,this._active=!1,this.clearDragLocalVisuals()}clearDragLocalVisuals(){this._controller.setState({showEdges:!1}),this._dragging=!1,this._outlineDiv&&=(this._controller.getRootDiv().removeChild(this._outlineDiv),void 0)}onDragEnter=t=>{if(!e.dragState&&this._controller.getProps().onExternalDrag){let n=this._controller.getProps().onExternalDrag(t);if(n){let t=W.fromJson(n.json,this._controller.getModel(),!1);e.dragState=new Lt(this._controller.getMainController(),`external`,t,n.json,n.onDrop)}}if(this._mainController===e.dragState?.mainLayoutController&&(!e.dragState?.dockFloatToMain||this.isDockTarget())&&e.dragState){t.preventDefault(),this._dropInfo=void 0;let e=this._controller.getRootDiv(),n=this._controller.getCurrentDocument();this._outlineDiv=n.createElement(`div`),this._outlineDiv.className=this._controller.getClassName(A.FLEXLAYOUT__OUTLINE_RECT),this._outlineDiv.style.visibility=`hidden`;let r=this._controller.getTabDragSpeed();this._outlineDiv.style.transition=`top ${r}s, left ${r}s, width ${r}s, height ${r}s`,e.appendChild(this._outlineDiv),this._dragging=!0,this._controller.showOverlayOnAllWindows(!0),this._controller.getModel().getMaximizedTabset(this._controller.getLayoutId())===void 0&&this._controller.setState({showEdges:this._controller.getModel().isEnableEdgeDock()});let i=this._controller.getRootDiv().getBoundingClientRect();new E(t.clientX-i.left,t.clientY-i.top,1,1).positionElement(this._outlineDiv)}};onDragOver=t=>{if(this._mainController===e.dragState?.mainLayoutController&&(!e.dragState?.dockFloatToMain||this.isDockTarget())&&this._active){if(e.dragState?.dockFloatToMain){let n=t.target;if(n&&e.dragState.sourceFloatElement?.contains(n)){this._dropInfo=void 0;return}}let n=this._controller.getRootDiv()?.getBoundingClientRect(),r={x:t.clientX-(n?.left??0),y:t.clientY-(n?.top??0)};e.dragState.dockFloatToMain||this._controller.checkForBorderToShow(r.x,r.y);let i=this._controller.getModel().findDropTargetNode(this._controller.getLayoutId(),e.dragState.dragNode,r.x,r.y,this.isExcludeCenter());if(i){if(e.dragState.dockFloatToMain&&(i.location===O.CENTER||!(i.node instanceof R)&&!(i.node instanceof z)))return;t.preventDefault(),this._dropInfo=i,this._outlineDiv&&(this._outlineDiv.className=this._controller.getClassName(i.className),i.rect.positionElement(this._outlineDiv),this._outlineDiv.style.visibility=`visible`)}}};onDragLeave=t=>{if(this._mainController===e.dragState?.mainLayoutController&&(this.clearDragLocalVisuals(),this._controller.isMainLayout())){let e=!1;for(let[,t]of this._controller.getModel().getLayouts()){let n=Ut(t);if(n&&n.getDragDropManager().isDragging()){e=!0;break}}e===!1&&this.clearDragMain()}};onDrop=t=>{if(this._mainController!==e.dragState?.mainLayoutController){this.clearDragLocal();return}if(!e.dragState?.dockFloatToMain||this.isDockTarget()){if(this._active){t.preventDefault();let n=e.dragState;if(this._dropInfo&&n.dockFloatToMain){let e=t.target;e&&n.sourceFloatElement?.contains(e)&&(this._dropInfo=void 0)}if(this._dropInfo){if(n.dragJson!==void 0){let e=this._controller.doAction(j.addTab(n.dragJson,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));n.fnNewNodeDropped!==void 0&&n.fnNewNodeDropped(e,t)}else n.dragNode!==void 0&&(n.dockFloatToMain?this._controller.doAction(j.dockFloatToLayout(n.floatLayoutId,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index)):this._controller.doAction(j.moveNode(n.dragNode.getId(),this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index)))}this.clearDragMain(),e.dragState=void 0}this._dragEnterCount=0}};getDragEnterCount(){return this._dragEnterCount}isDragging(){return this._dragging}},Lt=class{mainLayoutController;dragSource;dragNode;dragJson;fnNewNodeDropped;dockFloatToMain;floatLayoutId;sourceFloatElement;constructor(e,t,n,r,i,a=!1,o=void 0,s=void 0){this.mainLayoutController=e,this.dragSource=t,this.dragNode=n,this.dragJson=r,this.fnNewNodeDropped=i,this.dockFloatToMain=a,this.floatLayoutId=o,this.sourceFloatElement=s}},Rt=({controller:e})=>{let t=[],n=e.getIcons().edgeArrow;if(e.getState().showEdges&&e.getModel().isEnableEdgeDockIndicators()){let r=e.getModel().getRootRow(e.getLayoutId()).getRect(),i=e.getClassName(A.FLEXLAYOUT__EDGE_RECT);t.push((0,_.jsx)(`div`,{"aria-hidden":`true`,style:{top:0,left:r.width/2-50,width:100,height:10,borderBottomLeftRadius:50,borderBottomRightRadius:50},className:i+` `+e.getClassName(A.FLEXLAYOUT__EDGE_RECT_TOP),children:(0,_.jsx)(`div`,{style:{transform:`rotate(180deg)`},children:n})},`North`)),t.push((0,_.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height/2-50,left:0,width:10,height:100,borderTopRightRadius:50,borderBottomRightRadius:50},className:i+` `+e.getClassName(A.FLEXLAYOUT__EDGE_RECT_LEFT),children:(0,_.jsx)(`div`,{style:{transform:`rotate(90deg)`},children:n})},`West`)),t.push((0,_.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height-10,left:r.width/2-50,width:100,height:10,borderTopLeftRadius:50,borderTopRightRadius:50},className:i+` `+e.getClassName(A.FLEXLAYOUT__EDGE_RECT_BOTTOM),children:(0,_.jsx)(`div`,{children:n})},`South`)),t.push((0,_.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height/2-50,left:r.width-10,width:10,height:100,borderTopLeftRadius:50,borderBottomLeftRadius:50},className:i+` `+e.getClassName(A.FLEXLAYOUT__EDGE_RECT_RIGHT),children:(0,_.jsx)(`div`,{style:{transform:`rotate(-90deg)`},children:n})},`East`))}return(0,_.jsx)(_.Fragment,{children:t})};Rt.displayName=`EdgeIndicators`;var K=g.memo(e=>{K.displayName=`DragTabButton`;let{controller:t,tabNode:n}=e,r=g.useRef(null);g.useEffect(()=>(n.setTabStamp(r.current),()=>{n.setTabStamp(null)}),[n]);let i=t.getClassName,a=i(A.FLEXLAYOUT__DRAG_RECT);return(0,_.jsx)(`div`,{ref:r,className:a,children:(0,_.jsx)(rt,{controller:t,tabNode:n},n.getId())})},zt);function zt(e,t){return t.dragging}var Bt=class e{static Windows=new WeakMap;_props;_state;_setState;_layoutRef;_moveablesHomeRef;_findBorderBarSizeRef;_findSplitterSizeRef;_mainRef;_orderedTabIds;_orderedTabMoveableIds;_currentDocument;_currentWindow;_showOverlay=!1;_supportsPopout;_popoutURL;_icons;_dragDropManager;_layoutId;_layout;_mainController;_popoutWindowName;_cachedLayoutDOMRect;_reLayout;_measurables=new Map;_tabPanels=new Map;_lastRect=E.empty();_lastSplitterSize=8;_geometryResizeObserver;_splitterDragging=!1;constructor(e,t,n){this._props=e,this._state=t,this._setState=n,this._orderedTabIds=[],this._orderedTabMoveableIds=[],this._supportsPopout=e.supportsPopout===void 0?Ht:e.supportsPopout,this._popoutURL=e.popoutURL?e.popoutURL:`popout.html`,this._icons={...Vt,...e.icons},this._layoutId=e.layoutId?e.layoutId:me.MAIN_LAYOUT_ID,this._mainController=e.mainLayoutController?e.mainLayoutController:this,this._dragDropManager=new It(this),this._layout=e.model.getLayouts().get(this._layoutId),this._layout.setController(this),this._popoutWindowName=e.popoutWindowName,this._reLayout=!1}renderLayout(){return this._cachedLayoutDOMRect=void 0,(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(jt,{controller:this,rowNode:this._props.model.getRootRow(this._layoutId)},`__row__`),(0,_.jsx)(Rt,{controller:this})]})}renderTabContainers(){let e=new Map;return this._props.model.visitLayoutNodes(this._layoutId,t=>{if(t instanceof W){let n=t,r=n.isSelected(),i=n.isRendered(),a=n.isEnableRenderOnDemand();(i||r||!a)&&e.set(n.getId(),(0,_.jsx)(Mt,{controller:this,tabNode:n,selected:r},n.getId()))}}),e}renderTabContents(){let e=new Map;for(let[t,n]of this._props.model.getLayouts())this._props.model.visitLayoutNodes(t,t=>{if(t instanceof W){let r=t,i=r.isSelected(),a=r.isRendered(),o=r.isEnableRenderOnDemand(),s=r.getTabContainer().getContentRect(),c=i||!o;if(a||c&&s.width>0&&s.height>0){let t=r.getMoveableElement();t.style.overflow=r.isEnableScrollbars()?`auto`:`hidden`;let i=n.getWindowId()||``,a=r.getId()+(r.isEnableWindowReMount()?i:``);e.set(r.getId(),(0,v.createPortal)((0,_.jsx)(Pt,{controller:this,tabNode:r,windowId:i,visible:c,fullRedrawRevision:this._state.fullRedrawRevision,parentRedrawRevision:this._props.parentRedrawRevision},a),t,a)),r.setRendered(!0)}}});return e}renderDragTabButtons(){let e=[];return this._props.model.visitNodes(t=>{if(t instanceof W){let n=t;e.push((0,_.jsx)(K,{controller:this,tabNode:n,dragging:Ae},n.getId()))}}),e}redrawLayout(){this._mainController?.setState(e=>({layoutRedrawRevision:e.layoutRedrawRevision+1}))}redrawLayoutAndTabContent(){this._mainController?.setState(e=>({fullRedrawRevision:e.fullRedrawRevision+1}))}doAction(e){if(this._props.onAction!==void 0){let t=this._props.onAction(e);return t===void 0?void 0:this._props.model.doAction(t)}return this._props.model.doAction(e)}updateRect=()=>{if(this._layoutRef.current){let e=this._layoutRef.current;if(!this._layout.isMainLayout()&&this._layout.getType()===`float`){let t=e.closest(`.`+this.getClassName(A.FLEXLAYOUT__FLOAT_WINDOW));t instanceof HTMLDivElement&&(e=t)}let t=E.fromDomRect(e.getBoundingClientRect());if(!this._layout.isMainLayout()&&this._layout.getType()===`float`){let e=this._mainController.getDomRect();t=t.relativeTo(e)}!t.equalsWhenRounded(this._lastRect)&&t.width!==0&&t.height!==0&&(this._lastRect=t,this._layout.setRect(t),this.redrawLayout())}};onModelChange=e=>{let t=e instanceof N?e.actions:[e];for(let e of t)if(e.type==j.DELETE_TAB&&this._state.showHiddenBorder!==O.CENTER){let e=this._props.model.getBorderSet().getBorderMap().get(this._state.showHiddenBorder);if(!e||e.getChildren().length===0){this._setState({showHiddenBorder:O.CENTER});break}}if(e.isAdjusting()&&(e.type===j.ADJUST_WEIGHTS||e.type===j.ADJUST_BORDER_SPLIT)){e.type===j.ADJUST_WEIGHTS?this.applyAdjustingWeights(e):this.applyAdjustingBorderSplit(e),this._props.onModelChange&&this._props.onModelChange(this._props.model,e);return}this.redrawLayout(),this._props.onModelChange&&this._props.onModelChange(this._props.model,e)};applyMeasuredGeometry(){this.syncLayoutMetrics(),this.positionTabPanels(),this.isReLayout()&&(this.redrawLayout(),this.setReLayout(!1))}applyAdjustingWeights(e){let t=this._props.model.getNodeById(e.data.nodeId);if(!(t instanceof z)){this.redrawLayout();return}let n=e.data.weights,r=t.getChildren();for(let e=0;e<r.length;e++){let t=r[e];if(typeof n?.[e]!=`number`||!Number.isFinite(n[e]))continue;let i=t instanceof z?`row`:`tabset`,a=this._measurables.get(i+`:`+t.getId())?.element;if(!a){this.redrawLayout();return}a.style.flexGrow=String(Math.max(1,n[e]*1e3))}this.applyMeasuredGeometry()}applyAdjustingBorderSplit(e){let t=this._props.model.getNodeById(e.data.node);if(!(t instanceof U)){this.redrawLayout();return}if(t.isOverlay()){this.redrawLayout();return}let n=this._measurables.get(`bordercontent:`+t.getId())?.element;if(!n){this.redrawLayout();return}let r=t.getSize();t.isHorizontal()?(n.style.width=r+`px`,n.style.minWidth=t.getMinSize()+`px`,n.style.maxWidth=t.getMaxSize()+`px`):(n.style.height=r+`px`,n.style.minHeight=t.getMinSize()+`px`,n.style.maxHeight=t.getMaxSize()+`px`),this.applyMeasuredGeometry()}reorderComponents(e,t){let n=t.filter(t=>e.has(t)),r=new Set(n);for(let t of e.keys())r.has(t)||n.push(t);return t===this._orderedTabIds?this._orderedTabIds=n:t===this._orderedTabMoveableIds&&(this._orderedTabMoveableIds=n),n.map(t=>e.get(t))}checkForBorderToShow(e,t){let n=this.getBoundingClientRect(this._mainRef.current),r=n.getCenter(),i=!1;this._props.model.isEnableEdgeDock()&&this._state.showHiddenBorder===O.CENTER&&(t>r.y-50&&t<r.y+50||e>r.x-50&&e<r.x+50)&&(i=!0);let a=O.CENTER;i||(e<=n.x+10?a=O.LEFT:e>=n.getRight()-10?a=O.RIGHT:t<=n.y+10?a=O.TOP:t>=n.getBottom()-10&&(a=O.BOTTOM)),a!==O.CENTER&&!this._props.model.getBorderSet().getBorderMap().has(a)&&(a=O.CENTER),a!==this._state.showHiddenBorder&&this.setState({showHiddenBorder:a})}onOverlayBorderPointerDown=e=>{let t=this._props.model.getBorderSet().getBorders().filter(e=>e.isOverlay()&&e.getSelected()!==-1);if(t.length===0||e.target?.closest?.(`.`+this.getClassName(A.FLEXLAYOUT__POPUP_MENU_CONTAINER)+`,.`+this.getClassName(A.FLEXLAYOUT__FLOAT_WINDOW)+`,.`+this.getClassName(A.FLEXLAYOUT__FLOATING_WINDOW_CONTENT)+`,.`+this.getClassName(A.FLEXLAYOUT__BORDER_TAB_OVERLAY)))return;let n=this.getDomRect();if(!n)return;let r=e.clientX-n.x,i=e.clientY-n.y,a=this._props.model.getRootRow(me.MAIN_LAYOUT_ID)?.getRect();if(a&&a.contains(r,i))for(let e of t)e.getContentRect()?.contains(r,i)||this.closeOverlayBorder(e)};closeOverlayBorder(e){let t=e.getSelectedNode();if(t===void 0)return;let n=this._currentDocument,r=n?.getElementById(be(`flexlayout-tab-`,t.getId())),i=!!n&&!!r&&r.contains(n.activeElement);this.doAction(j.selectTab(t.getId())),i&&n.getElementById(be(`flexlayout-tabbutton-`,t.getId()))?.focus()}onOverlayBorderKeyDown=e=>{if(!Se(e,this.getKeyMap().closeOverlayBorder))return;let t=this._currentDocument?.activeElement;if(!t)return;let n=this._props.model.getBorderSet().getBorders().filter(e=>e.isOverlay()&&e.getSelected()!==-1);for(let r of n){let n=r.getSelectedNode(),i=this._currentDocument.getElementById(be(`flexlayout-tab-`,n.getId())),a=this._currentDocument.getElementById(be(`flexlayout-tabbutton-`,n.getId()));if(i&&i.contains(t)||t===a){this.closeOverlayBorder(r),e.preventDefault();break}}};onTabsetNavKeyDown=e=>{if(e.defaultPrevented)return;let t=this.getKeyMap(),n;if(Se(e,t.focusNextTabset))n=1;else if(Se(e,t.focusPreviousTabset))n=-1;else return;this.focusAdjacentTabset(n)&&e.preventDefault()};focusAdjacentTabset(e){let t=this._currentDocument,n=t?.activeElement;if(!t||!n||!this.getRootDiv()?.contains(n))return!1;let r=n.tagName;if(r===`INPUT`||r===`TEXTAREA`||n.isContentEditable||n.closest(`[role="menu"]`)||this._props.model.getMaximizedTabset(this._layoutId)!==void 0)return!1;let i=[];if(this._props.model.visitLayoutNodes(this._layoutId,e=>{e instanceof R&&e.getSelectedNode()!==void 0&&i.push(e)}),i.length<2)return!1;let a=i.findIndex(e=>this._measurables.get(`tabset:`+e.getId())?.element.contains(n)?!0:!!t.getElementById(be(`flexlayout-tab-`,e.getSelectedNode().getId()))?.contains(n));if(a===-1){let e=this._props.model.getActiveTabset(this._layoutId);a=e===void 0?0:i.indexOf(e),a===-1&&(a=0)}let o=i[(a+e+i.length)%i.length];return t.getElementById(be(`flexlayout-tabbutton-`,o.getSelectedNode().getId()))?.focus(),this.doAction(j.setActiveTabset(o.getId(),this._layoutId)),!0}registerMeasurable(e,t,n){let r=t+`:`+e.getId(),i=this._measurables.get(r);n?this._measurables.set(r,{kind:t,node:e,element:n}):(this._measurables.delete(r),t===`grouppill`?e.setPillRect(E.empty()):t===`groupendmarker`&&e.setEndMarkerRect(E.empty())),t!==`tabbutton`&&(i&&this._geometryResizeObserver?.unobserve(i.element),n&&this._geometryResizeObserver?.observe(n))}setGeometryResizeObserver(e){if(this._geometryResizeObserver=e,e)for(let{kind:t,element:n}of this._measurables.values())t!==`tabbutton`&&e.observe(n)}syncLayoutMetrics(){this._cachedLayoutDOMRect=void 0;let e=!1;for(let{kind:t,node:n,element:r}of this._measurables.values()){if(!r.isConnected)continue;let i=this.getBoundingClientRect(r);switch(t){case`row`:case`tabset`:i.equalsWhenRounded(n.getRect())||(n.setRect(i),e=!0);break;case`tabstrip`:i.equalsWhenRounded(n.getTabStripRect())||(n.setTabStripRect(i),e=!0);break;case`tabsetcontent`:{let t=n;if(!isNaN(i.x)&&!t.getContentRect().equalsWhenRounded(i)){let n=t.getContentRect().width>0&&t.getContentRect().height>0;t.setContentRect(i),e=!0,!n&&i.width>0&&i.height>0&&this.setReLayout(!0)}break}case`tabbutton`:i.equalsWhenRounded(n.getTabRect())||(n.setTabRect(i),e=!0);break;case`grouppill`:i.equalsWhenRounded(n.getPillRect())||(n.setPillRect(i),e=!0);break;case`groupendmarker`:i.equalsWhenRounded(n.getEndMarkerRect())||(n.setEndMarkerRect(i),e=!0);break;case`borderheader`:i.equalsWhenRounded(n.getRect())||(n.setTabHeaderRect(i),e=!0);break;case`bordercontent`:{let t=n;if(!isNaN(i.x)&&i.width>0&&!t.getContentRect().equalsWhenRounded(i)){let n=t.getContentRect().width>0&&t.getContentRect().height>0;t.setContentRect(i),e=!0,!n&&i.height>0&&this.setReLayout(!0)}break}}}for(let{kind:t,node:n}of this._measurables.values())if(t===`grouppill`){let t=n,r=t.getDropRegion();r.equalsWhenRounded(t.getRect())||(t.setRect(r),e=!0)}return e}registerTabPanel(e,t){t?this._tabPanels.set(e.getId(),{node:e,element:t}):this._tabPanels.delete(e.getId())}positionTabPanels(){for(let{node:e,element:t}of this._tabPanels.values()){let n=e.getTabContainer(),r=n.getContentRect(),i=e.isSelected();n instanceof R?this._props.model.getMaximizedTabset(this._layoutId)!==void 0&&!n.isMaximized()&&(i=!1):n instanceof U&&(n.isShowing()||(i=!1)),r.positionElement(t),t.style.display=i?``:`none`,e.setRect(r),e.setVisible(i)}}updateLayoutMetrics=()=>{if(this._findBorderBarSizeRef.current){let e=this._findBorderBarSizeRef.current.getBoundingClientRect().height;Math.abs(e-this._state.calculatedBorderBarSize)>.5&&this.setState({calculatedBorderBarSize:e})}if(this._findSplitterSizeRef.current){let e=this._findSplitterSizeRef.current.getBoundingClientRect().width;Math.abs(e-this._lastSplitterSize)>.5&&(this._lastSplitterSize=e,this._props.model.setSplitterSize(e),this.redrawLayout())}};addTabWithDragAndDrop(e,t,n){this._dragDropManager.addTabWithDragAndDrop(e,t,n)}moveTabWithDragAndDrop(e,t){this._dragDropManager.moveTabWithDragAndDrop(e,t)}setDragComponent(e,t,n,r){this._dragDropManager.setDragComponent(e,t,n,r)}getMoveablesHome(){return this._moveablesHomeRef.current}getProps(){return this._props}getKeyMap(){return we(this._props.keyMap)}setProps(e){this._props=e}getState(){return this._state}setStateRaw(e){this._state=e}setState(e){this._setState(e)}setSetState(e){this._setState=e}setLayoutRef(e){this._layoutRef=e}setMoveablesHomeRef(e){this._moveablesHomeRef=e}setFindBorderBarSizeRef(e){this._findBorderBarSizeRef=e}setFindSplitterSizeRef(e){this._findSplitterSizeRef=e}getMainRef(){return this._mainRef}setMainRef(e){this._mainRef=e}getOrderedTabIds(){return this._orderedTabIds}getOrderedTabMoveableIds(){return this._orderedTabMoveableIds}getCurrentDocument(){return this._currentDocument}setCurrentDocument(e){this._currentDocument=e}getCurrentWindow(){return this._currentWindow}setCurrentWindow(t){this._currentWindow=t,t&&!e.Windows.has(t)&&e.Windows.set(t,de())}getWindowId(){if(this.getCurrentWindow())return e.Windows.get(this.getCurrentWindow())}isSupportsPopout(){return this._supportsPopout}getPopoutURL(){return this._popoutURL}getIcons(){return this._icons}getDragDropManager(){return this._dragDropManager}getLayoutId(){return this._layoutId}getLayout(){return this._layout}setLayout(e){this._layout=e}getMainController(){return this._mainController}isMainLayout(){return this._layout.isMainLayout()}getPopoutWindowName(){return this._popoutWindowName??this.i18nName(G.Popout_Window_Name)}isReLayout(){return this._reLayout}setReLayout(e){this._reLayout=e}getBoundingClientRect(e){let t=this.getDomRect();return t?E.getBoundingClientRect(e).relativeTo(t):E.empty()}getClassName=e=>this._props.classNameMapper===void 0?e:this._props.classNameMapper(e);getLayoutRef(){return this._layoutRef.current}getDomRect(){return this._cachedLayoutDOMRect===void 0?this._layoutRef.current?(this._cachedLayoutDOMRect=E.fromDomRect(this._layoutRef.current.getBoundingClientRect()),this._cachedLayoutDOMRect):E.empty():this._cachedLayoutDOMRect}getRootDiv(){return this._layoutRef.current}getMainElement(){return this._mainRef.current}getFactory(){return this._props.factory}isRealtimeResize(){return this._props.realtimeResize??!0}isSplitterDragging(){return this._mainController?this._mainController._splitterDragging:this._splitterDragging}setSplitterDragging(e){let t=this._mainController??this;t._splitterDragging=e}setEditingTab(e){this.setState({editingTab:e})}getEditingTab(){return this._state.editingTab}getModel(){return this._props.model}getTabDragSpeed(){return this._props.tabDragSpeed?this._props.tabDragSpeed:.3}onCloseLayout=e=>{this.doAction(j.closePopout(e.getLayoutId()))};getScreenRect(e){let t=e.clone(),n=this.getDomRect(),r=this._currentWindow.outerHeight-this._currentWindow.innerHeight,i=this._currentWindow.outerWidth-this._currentWindow.innerWidth,a=r>=0&&r<=200?r:60,o=i>=0&&i<=100?i:2;return t.x=this._currentWindow.screenX+this._currentWindow.scrollX+o/2+n.x+t.x,t.y=this._currentWindow.screenY+this._currentWindow.scrollY+(a-o/2)+n.y+t.y,t.height+=a,t.width+=o,t}getRelativeRect(e){let t=e.clone();if(!this._layout.isMainLayout()){let e=this._layout.getRect();t.x+=e.x,t.y+=e.y}return t}moveWindowToFront(e){this.doAction(j.movePopoutToFront(e))}addTabToTabSet(e,t){if(this._props.model.getNodeById(e)!==void 0)return this.doAction(j.addTab(t,e,O.CENTER,-1))}addTabToActiveTabSet(e){let t=this._props.model.getActiveTabset(this._layoutId);if(t!==void 0)return this.doAction(j.addTab(e,t.getId(),O.CENTER,-1))}maximize(e){this.doAction(j.maximizeToggle(e.getId(),this.getLayoutId()))}customizeTab(e,t){this._props.onRenderTab&&this._props.onRenderTab(e,t)}customizeTabSet(e,t){this._props.onRenderTabSet&&this._props.onRenderTabSet(e,t)}i18nName(e,t){let n=this._props.model.translate(e);return n===e&&(n=ge[e]??e),n===void 0&&(n=e+(t===void 0?``:t)),n}getShowOverflowMenu(){return this._props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this._props.onTabSetPlaceHolder}showContextMenu(e,t){this._props.onContextMenu&&this._props.onContextMenu(e,t)}auxMouseClick(e,t){this._props.onAuxMouseClick&&this._props.onAuxMouseClick(e,t)}showOverlay(e){this._showOverlay!==e&&(this._showOverlay=e,this.setState({showOverlay:e}),Oe(!e,this._currentDocument))}showOverlayOnAllWindows(e){for(let[,t]of this._props.model.getLayouts()){let n=Ut(t);n&&n.showOverlay(e)}}},Vt={close:(0,_.jsx)(yt,{}),pin:(0,_.jsx)(bt,{}),closeTabset:(0,_.jsx)(yt,{}),closeFloatPopout:(0,_.jsx)(yt,{}),popout:(0,_.jsx)(wt,{}),popoutFloat:(0,_.jsx)(Tt,{}),maximize:(0,_.jsx)(xt,{}),restore:(0,_.jsx)(Dt,{}),more:(0,_.jsx)(St,{}),edgeArrow:(0,_.jsx)(Ct,{}),activeTabset:(0,_.jsx)(Ot,{}),dragToDock:(0,_.jsx)(Et,{}),popoutFloatWindow:(0,_.jsx)(wt,{})},Ht=ve();function Ut(e){return e.getController()}var Wt=g.forwardRef((e,t)=>{let[n,r]=g.useState({editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRedrawRevision:0,fullRedrawRevision:0,showHiddenBorder:O.CENTER}),i=g.useCallback(t=>{r(n=>({...n,...typeof t==`function`?t(n,e):t}))},[e]),a=g.useRef(null),[o,s]=g.useState(0),c=g.useRef(null),l=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useMemo(()=>new Bt(e,n,i),[]);f.setProps(e),f.setStateRaw(n),f.setSetState(i),f.setLayoutRef(a),f.setMoveablesHomeRef(c),f.setFindBorderBarSizeRef(l),f.setFindSplitterSizeRef(u),f.setMainRef(d);let p=e.model.getLayouts().get(f.getLayoutId());p.setController(f),g.useImperativeHandle(t,()=>f,[f]),g.useLayoutEffect(()=>{let e=f.syncLayoutMetrics();if(f.positionTabPanels(),f.isMainLayout()&&f.updateLayoutMetrics(),f.isReLayout()&&(f.redrawLayout(),f.setReLayout(!1)),a.current&&f.getCurrentDocument()!==void 0&&f.getCurrentDocument()!==a.current.ownerDocument&&s(e=>e+1),e){let e=a.current?.ownerDocument.defaultView??window,t=e.requestAnimationFrame(()=>{f.syncLayoutMetrics(),f.positionTabPanels(),f.isReLayout()&&(f.redrawLayout(),f.setReLayout(!1))});return()=>e.cancelAnimationFrame(t)}}),g.useEffect(()=>{let e=a.current.ownerDocument,t=e.defaultView;f.setCurrentDocument(e),f.setCurrentWindow(t);let n=new t.ResizeObserver(()=>{f.updateRect(),f.syncLayoutMetrics(),f.positionTabPanels(),f.updateLayoutMetrics(),f.isReLayout()&&(f.redrawLayout(),f.setReLayout(!1))});n.observe(a.current),f.setGeometryResizeObserver(n),l.current&&n.observe(l.current),u.current&&n.observe(u.current);let r=()=>{f.updateRect()};t.addEventListener(`resize`,r);let i=()=>{for(let[e,t]of f.getProps().model.getLayouts()){let e=t.getController();e&&e.redrawLayout()}};return f.isMainLayout()&&(e.addEventListener(`visibilitychange`,i),e.addEventListener(`pointerdown`,f.onOverlayBorderPointerDown,!0),e.addEventListener(`keydown`,f.onOverlayBorderKeyDown)),(f.isMainLayout()||f.getLayout()?.getType()===`window`)&&e.addEventListener(`keydown`,f.onTabsetNavKeyDown),()=>{f.setGeometryResizeObserver(void 0),n.disconnect(),t.removeEventListener(`resize`,r),e.removeEventListener(`visibilitychange`,i),e.removeEventListener(`pointerdown`,f.onOverlayBorderPointerDown,!0),e.removeEventListener(`keydown`,f.onOverlayBorderKeyDown),e.removeEventListener(`keydown`,f.onTabsetNavKeyDown)}},[f,o]),g.useEffect(()=>{let e;if(!f.isMainLayout()&&f.getLayout().getType()===`window`){let t=f.getProps().mainLayoutController?.getRootDiv();if(t){let n=t,r=a.current;Me(n,r),e=new MutationObserver(()=>{Me(n,r)&&f.redrawLayout()}),e.observe(n,{attributeFilter:[`style`]})}}return()=>{e&&e.disconnect()}},[f]),g.useEffect(()=>{let t=e.model;if(p.setToExportRectFunction((e,t)=>t===`window`?f.getScreenRect(e):f.getRelativeRect(e)),f.setLayout(p),f.isMainLayout()){let e={onAfterAction:f.onModelChange};return t.addChangeListener(e),()=>{t.removeChangeListener(e)}}},[e.model,f,p]);let m=f.isMainLayout()?(0,_.jsxs)(`div`,{className:f.getClassName(A.FLEXLAYOUT__LAYOUT_METRICS),children:[(0,_.jsx)(`div`,{ref:l,className:f.getClassName(A.FLEXLAYOUT__BORDER_SIZER),children:`FindBorderBarSize`},`findBorderBarSize`),(0,_.jsx)(`div`,{ref:u,className:f.getClassName(A.FLEXLAYOUT__SPLITTER_+`horz`)},`findSplitterSize`)]}):null;if(!a.current)return(0,_.jsx)(`div`,{ref:a,className:f.getClassName(A.FLEXLAYOUT__LAYOUT),children:m});let h=e.model,v=f.getLayoutId();h.getRootRow(v).calcMinMaxSize(),h.getRootRow(v).setPaths(e.path||``),f.isMainLayout()&&h.getBorderSet().setPaths();let y=(0,_.jsx)(Fe,{controller:f,show:n.showOverlay},`__overlay__`),b=f.renderLayout(),x=(0,_.jsx)(_t,{controller:f,inner:b}),S=f.renderTabContainers(),C=f.reorderComponents(S,f.getOrderedTabIds()),w=null,T=null,E=null,D=null;return f.isMainLayout()&&(w=(0,_.jsx)($e,{controller:f}),T=f.reorderComponents(f.renderTabContents(),f.getOrderedTabMoveableIds()),E=(0,_.jsx)(`div`,{"aria-hidden":`true`,className:f.getClassName(A.FLEXLAYOUT__LAYOUT_TAB_STAMPS),children:f.renderDragTabButtons()},`__dragTabButtons__`),D=(0,_.jsx)(`div`,{ref:c,className:f.getClassName(A.FLEXLAYOUT__LAYOUT_MOVEABLES_HOME)},`__moveables_home__`)),(0,_.jsxs)(`div`,{ref:a,className:f.getClassName(A.FLEXLAYOUT__LAYOUT),onDragEnter:f.getDragDropManager().onDragEnterRaw,onDragLeave:f.getDragDropManager().onDragLeaveRaw,onDragOver:f.getDragDropManager().onDragOver,onDrop:f.getDragDropManager().onDrop,children:[m,D,y,x,C,T,w,E]})});Wt.displayName=`LayoutInternal`;var Gt=g.forwardRef((e,t)=>{let n=(0,g.useRef)(null),r=(0,g.useRef)(e.model),i=(0,g.useRef)(0);r.current!==e.model&&(e.model.getAdoptedFromModel()!==r.current&&i.current++,r.current=e.model),(0,g.useEffect)(()=>(e.model.setI18nDefaults(ge),e.model.setI18nTranslator(e.i18nTranslator),()=>{e.model.setI18nDefaults(void 0),e.model.setI18nTranslator(void 0)}),[e.model,e.i18nTranslator]),Gt.displayName=`Layout`,(0,g.useImperativeHandle)(t,()=>({redraw:()=>{n.current?.redrawLayoutAndTabContent()},addTabToTabSet:(e,t)=>n.current?.addTabToTabSet(e,t),addTabWithDragAndDrop:(e,t,r)=>{n.current?.addTabWithDragAndDrop(e,t,r)},moveTabWithDragAndDrop:(e,t)=>{n.current?.moveTabWithDragAndDrop(e,t)},addTabToActiveTabSet:e=>n.current?.addTabToActiveTabSet(e),setDragComponent:(e,t,r,i)=>{n.current?.setDragComponent(e,t,r,i)},editTabName:e=>{let t=n.current?.getModel().getNodeById(e);t instanceof W&&t.isEnableRename()&&Ut(t.getLayout())?.setEditingTab(t)},getRootDiv:()=>n.current.getRootDiv()}));let a=(0,g.useRef)({}),o=e.invalidateTabContentOnParentRender===!1?a.current:{};return(0,_.jsx)(Wt,{ref:n,...e,parentRedrawRevision:o},i.current)}),Kt=[j.SET_ACTIVE_TABSET];function qt(e,t){let n=t?.maxBufferSize??100,r=g.useRef(t?.ignoreActionTypes??Kt);g.useEffect(()=>{r.current=t?.ignoreActionTypes??Kt});let[i,a]=g.useState(()=>typeof e==`function`?e():e??null),[o,s]=g.useState(0),[c,l]=g.useState(0),u=g.useRef(i),d=g.useRef([]),f=g.useRef([]),p=g.useRef(null);g.useEffect(()=>{if(!i)return;u.current=i;let e={onBeforeAction:e=>{e.isAdjusting()?p.current===null&&(p.current=JSON.stringify(u.current.toJson())):(r.current.includes(e.type)||(d.current.push(p.current??JSON.stringify(u.current.toJson())),d.current.length>n&&d.current.shift(),f.current=[],s(d.current.length),l(0)),p.current=null)}};return i.addChangeListener(e),()=>{i.removeChangeListener(e)}},[i,n]);let m=g.useCallback((e,t=!0)=>{u.current=e,a(e),t&&(d.current=[],f.current=[],p.current=null,s(0),l(0))},[]),h=g.useCallback(()=>{let e=u.current;if(!e)return;let t=d.current.pop();if(t===void 0)return;f.current.push(JSON.stringify(e.toJson()));let n=me.fromJson(JSON.parse(t),e);u.current=n,s(d.current.length),l(f.current.length),a(n)},[]),_=g.useCallback(()=>{let e=u.current;if(!e)return;let t=f.current.pop();if(t===void 0)return;d.current.push(JSON.stringify(e.toJson()));let n=me.fromJson(JSON.parse(t),e);u.current=n,s(d.current.length),l(f.current.length),a(n)},[]),v=g.useCallback(()=>{d.current=[],f.current=[],p.current=null,s(0),l(0)},[]);return{model:i,setModel:m,undo:h,redo:_,canUndo:o>0,canRedo:c>0,undoCount:o,redoCount:c,reset:v}}var Jt=3e4;async function Yt(e,t={}){let n=new AbortController,r=setTimeout(()=>n.abort(),t.timeoutMs||Jt);try{let r=await fetch(e,{method:t.method||`GET`,headers:t.body?{"content-type":`application/json`}:void 0,body:t.body?JSON.stringify(t.body):void 0,signal:n.signal}),i;try{i=await r.json()}catch{throw Error(`HTTP ${r.status}`)}if(!i.ok){let e=Error(i.error||`请求失败`);throw e.code=i.code,e.details=i.details,e}return i.data}catch(e){throw e&&e.name===`AbortError`?Error(`请求超时(本地服务无响应)`):e}finally{clearTimeout(r)}}var Xt=`nx-kv-ui`,Zt={view:`todo`,topic:``};function Qt(){try{let e=localStorage.getItem(Xt);return e?{...Zt,...JSON.parse(e)}:{...Zt}}catch{return{...Zt}}}var $t=(0,g.createContext)(null);function en({children:e}){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(Qt);(0,g.useEffect)(()=>{try{localStorage.setItem(Xt,JSON.stringify(a))}catch{}},[a]);let s=(0,g.useCallback)(async()=>{let e=await Yt(`/api/bootstrap`);return n(e),e},[]),c=(0,g.useCallback)(async()=>{i(await Yt(`/api/bundled`).catch(()=>null))},[]);(0,g.useEffect)(()=>{s(),c()},[s,c]);let l=(0,g.useCallback)(e=>{o(t=>typeof e==`function`?{...t,...e(t)}:{...t,...e})},[]),u=(0,g.useCallback)((e,t)=>{o(n=>{let r=new Set(n[e]);return r.has(t)?r.delete(t):r.add(t),{...n,[e]:[...r]}})},[]),d=(0,g.useMemo)(()=>({boot:t,bundled:r,ui:a,patchUi:l,toggleSel:u,refreshBoot:s,refreshBundled:c}),[t,r,a,l,u,s,c]);return(0,_.jsx)($t.Provider,{value:d,children:e})}function tn(){let e=(0,g.useContext)($t);if(!e)throw Error(`useStore 必须在 StoreProvider 内使用`);return e}function nn({text:e,className:t=``,title:n,children:r}){let i=l();return(0,_.jsx)(`span`,{className:`copyable`+(t?` `+t:``),title:n||`点击复制`,onClick:async()=>{let t=String(e??``);try{await navigator.clipboard.writeText(t),i(`已复制: `+(t.length>60?t.slice(0,57)+`...`:t))}catch{try{let e=document.createElement(`textarea`);e.value=t,e.style.cssText=`position:fixed;opacity:0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),e.remove(),i(`已复制: `+(t.length>60?t.slice(0,57)+`...`:t))}catch{i(`复制失败(剪贴板不可用)`)}}},children:r===void 0?e:r})}var rn=class extends g.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[nx-kv] 视图渲染失败:`,e,t)}render(){return this.state.error?(0,_.jsxs)(`div`,{className:`card`,style:{padding:16},children:[(0,_.jsx)(`div`,{className:`colhead`,children:(0,_.jsx)(`h3`,{children:`这个面板出错了`})}),(0,_.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,wordBreak:`break-all`,marginBottom:10},children:String(this.state.error?.message||this.state.error)}),(0,_.jsx)(`div`,{className:`muted`,style:{marginBottom:10},children:`其他面板不受影响,可以切到别的 tab 继续操作;控制台有完整堆栈。`}),(0,_.jsx)(`button`,{className:`btn`,onClick:()=>this.setState({error:null}),children:`重试`})]}):this.props.children}},an=(0,g.createContext)(null);function on(){return(0,g.useContext)(an)}var sn=`__GLOBAL__`;function cn(e=[]){let t=Array.isArray(e)?e:[];return{pending:t.filter(e=>e.status!==`consumed`&&!e.deletedAt&&!e.migratedTo),consumed:t.filter(e=>e.status===`consumed`&&!e.deletedAt).slice().reverse(),deleted:t.filter(e=>!!e.deletedAt).slice().reverse(),migrated:t.filter(e=>!!e.migratedTo&&!e.deletedAt&&e.status!==`consumed`)}}function ln(e=[]){let t=Array.isArray(e)?e:[],n=[],r=[],i=[],a=[];for(let e of t)e.deletedAt?a.push(e):e.status===`consumed`?r.push(e):e.migratedTo?i.push(e):n.push(e);return[...n,...r.reverse(),...i,...a.reverse()]}var un=0,dn={docs:{}},fn=new Set,pn=()=>{for(let e of fn)e()},mn=e=>(fn.add(e),()=>fn.delete(e)),hn=()=>dn.docs,gn=e=>e||`__GLOBAL__`,_n=(e,t)=>`${e}::${t}`,vn=e=>/^draft/.test(String(e||``)),yn=()=>`draft-${++un}`;function bn(){return(0,g.useSyncExternalStore)(mn,hn,hn)}function xn(e,t){return dn.docs[e]||(dn={...dn,docs:{...dn.docs,[e]:{title:``,body:``,attachments:[],mode:`split`,...t||{}}}},pn()),dn.docs[e]}function Sn(e){return dn.docs[e]||null}function Cn(e,t){let n=dn.docs[e]||{title:``,body:``,attachments:[],mode:`split`};dn={...dn,docs:{...dn.docs,[e]:{...n,...t}}},pn()}function wn(e,t,n){let r=dn.docs[e]||{},i={...dn.docs,[t]:{...r,...n||{}}};delete i[e],dn={...dn,docs:i},pn()}var Tn=1.2,En=2.5;function Dn(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`expanded`:t<2?`closed`:t<8?`collapsed`:`expanded`}function On(e){let t=Number(e);return!Number.isFinite(t)||t<=0?16:t<.5?Tn:kn(Dn(t)).weight}function kn(e){return{weight:e===`closed`?Tn:e===`collapsed`?En:16,enableTabStrip:!1}}var q={SIDEBAR:`sidebar`,MAIN:`maincontent`,RIGHT:`rightSidebar`,FLOAT:`float`},An={sidebar:q.SIDEBAR,dir:q.MAIN,page:q.MAIN,group:q.MAIN,repos:q.MAIN,cloud:q.MAIN,overview:q.MAIN,templates:q.MAIN,doc:q.MAIN,dag:q.MAIN,progress:q.RIGHT,settings:q.FLOAT},jn=new Set([`sidebar`,`repos`,`cloud`,`overview`,`templates`,`progress`,`settings`]);function Mn(e){return An[e]||q.MAIN}function Nn(e){return jn.has(e)}var Pn=`nx-kv-ui.workspace`,Fn={tabEnableClose:!0,tabEnableDrag:!0,tabEnableRename:!1,tabEnablePopout:!0,tabEnablePopoutIcon:!1,tabEnableFloat:!0,tabEnableFloatIcon:!1,tabEnablePin:!1,tabSetEnableClose:!1,tabSetEnableCloseButton:!0,tabSetEnableMaximize:!1,tabSetEnableDrag:!0,tabSetEnableDrop:!0,tabSetEnableTabGroups:!1,tabSetAutoSelectTab:!0,borderEnableClose:!0,enableEdgeDock:!0,enableEdgeDockIndicators:!0,rootOrientationVertical:!1};function In(){return{global:{...Fn},borders:[],layout:{type:`row`,children:[{type:`tabset`,id:`ts_sidebar`,weight:16,enableTabStrip:!1,children:[{type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1}]},{type:`tabset`,id:`ts_main`,weight:68,enableTabStrip:!1,children:[{type:`tab`,id:`t_welcome`,name:`开始`,component:`welcome`}]},{type:`tabset`,id:`ts_right`,weight:16,enableTabStrip:!1,children:[]}]}}}function Ln(e){return e.updateAttrs({...Fn}),e}function Rn(e){if(!e||e.type!==`row`||!Array.isArray(e.children))return e;let t=e=>(e.type===`row`&&(e.children=(e.children||[]).map(e=>e.type===`row`?t(e):e).filter(e=>e.type===`tabset`||e.type===`row`?(e.children||[]).length>0:!0)),e);return t(e).children.length?e:null}function zn(e){if(!e||typeof e!=`object`)return e;if(Array.isArray(e.borders)&&(e.borders=e.borders.filter(e=>Array.isArray(e.children)&&e.children.length>0)),e.subLayouts&&typeof e.subLayouts==`object`){for(let t of Object.keys(e.subLayouts)){let n=e.subLayouts[t],r=n&&n.layout;(!r||!Array.isArray(r.children)||r.children.length===0||r.children.length===1&&r.children[0]&&r.children[0].type===`tabset`&&(r.children[0].children||[]).length===0)&&delete e.subLayouts[t]}Object.keys(e.subLayouts).length===0&&delete e.subLayouts}return e}function Bn(e){if(!e||!e.layout)return!1;let t=!1,n=null,r=null,i=(e,t)=>{if(e&&(e.type===`tab`&&e.component===`sidebar`&&(n=e,t&&t.type===`tabset`&&(r=t)),Array.isArray(e.children)))for(let t of e.children)i(t,e)};i(e.layout,null);let a=e.layout,o=a&&a.type===`row`&&Array.isArray(a.children);if(!n)return o&&(a.children.unshift({type:`tabset`,id:`ts_sidebar`,weight:kn(`expanded`).weight,enableTabStrip:!1,children:[{type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1}]}),t=!0),t;if(n.enableClose!==!1&&(n.enableClose=!1,t=!0),r&&Array.isArray(r.children)&&r.children.some(e=>e&&e.component!==`sidebar`)&&o){let e=r.children,i=e.indexOf(n);i>=0&&e.splice(i,1),typeof r.selected==`number`&&(i>=0&&r.selected>i?--r.selected:i>=0&&r.selected===i&&(r.selected=Math.max(0,Math.min(e.length-1,i))),e.length===0?delete r.selected:r.selected>=e.length&&(r.selected=e.length-1)),r.enableTabStrip=!0;let o=Number(r.weight);return(!Number.isFinite(o)||o<8)&&(r.weight=84),a.children.unshift({type:`tabset`,id:`ts_sidebar`,weight:kn(`expanded`).weight,enableTabStrip:!1,children:[n]}),t=!0,t}if(r){let e=Number(r.weight);if(!Number.isFinite(e)||e<2){let e=kn(`expanded`);(r.weight!==e.weight||r.enableTabStrip!==e.enableTabStrip)&&(r.weight=e.weight,r.enableTabStrip=e.enableTabStrip,t=!0)}else{let n=On(e);e!==n&&(r.weight=n,r.enableTabStrip=kn(n<8?`collapsed`:`expanded`).enableTabStrip,t=!0)}}return t}function Vn(e){if(!e||!e.layout)return!1;let t=!1,n=e=>{if(e.type===`tabset`&&e.enableTabStrip!==!1&&(e.enableTabStrip=!1,t=!0),Array.isArray(e.children))for(let t of e.children)n(t)};n(e.layout);let r=e.layout;return r&&r.type===`row`&&Array.isArray(r.children)&&!r.children.some(e=>e&&e.id===`ts_right`)&&(r.children.push({type:`tabset`,id:`ts_right`,weight:16,enableTabStrip:!1,children:[]}),t=!0),t}function Hn(){try{let e=localStorage.getItem(Pn);if(!e)return Ln(me.fromJson(In()));let t=JSON.parse(e);return!t||!t.layout||!Rn(t.layout)?Ln(me.fromJson(In())):(zn(t),Bn(t),Vn(t),Ln(me.fromJson(t)))}catch{return Ln(me.fromJson(In()))}}function Un(e){try{let t=e.toJson();t.layout&&Rn(t.layout)&&(zn(t),localStorage.setItem(Pn,JSON.stringify(t)))}catch{}}function Wn(e){if(!e)return 0;let t=[];e.visitNodes(e=>{e.getType()===`tabset`&&(e.getChildren()||[]).length===0&&t.push(e.getId())});for(let n of t)e.doAction(j.deleteTabset(n));return t.length}function Gn(){try{localStorage.removeItem(Pn)}catch{}}function Kn(e,t,n){let r=JSON.stringify(n||{}),i=null;return e.visitNodes(e=>{i||e.getType()===`tab`&&e.getComponent()===t&&JSON.stringify(e.getConfig()||{})===r&&(i=e)}),i}function qn(e){let t=[];return e.visitNodes(e=>{e.getType()===`tabset`&&t.push(e)}),t}function Jn(e,t){let n=null;return e.visitNodes(e=>{n||e.getType()===`tab`&&e.getComponent()===t&&(n=e)}),n}function Yn(e,t){return!t||!t.length?!1:(e.getTabNodes()||[]).some(e=>t.includes(e.getComponent()))}function Xn(e,t=[]){let n=e.getActiveTabset()||e.getFirstTabSet();if(n&&!Yn(n,t))return n.getId();let r=[...qn(e)].reverse().find(e=>!Yn(e,t));return r?r.getId():n?n.getId():void 0}function Zn(e){if(!e)return null;let t=null;return e.visitNodes(e=>{if(t||e.getType()!==`tabset`)return;let n=e.getId();if(n===`ts_main`){t=n;return}n!==`ts_sidebar`&&n!==`ts_right`&&!Yn(e,[`sidebar`])&&(t=n)}),t}function Qn(e){if(!e)return null;let t=null;return e.visitNodes(e=>{t||e.getType()===`tabset`&&e.getId()===`ts_right`&&(t=e.getId())}),t}var $n=16,er=0;function tr(e,t){let n=Qn(e);return n?dr(e,n,{weight:t?$n:er,enableTabStrip:!1}):!1}function nr(e){if(!e)return;let t=[];e.visitNodes(e=>{e.getType()===`tab`&&e.getComponent()===`progress`&&t.push(e.getId())});for(let n of t)e.doAction(j.deleteTab(n));tr(e,!1)}function rr(e,{dirKey:t,task:n}={}){if(!e)return;let r=Jn(e,`progress`);if(!r)return;let i=r.getConfig()||{},a={dirKey:t||``};n!=null&&String(n)!==``&&(a.task=String(n)),JSON.stringify(i)!==JSON.stringify(a)&&(e.doAction(j.updateNodeAttributes(r.getId(),{config:a})),t&&tr(e,!0))}function ir(e){if(!e)return 0;let t=Qn(e),n=[];e.visitNodes(e=>{if(e.getType()!==`tab`)return;let r=e.getComponent();if(r===`sidebar`||r===`progress`)return;let i=e.getParent&&e.getParent();if(!i||i.getType()!==`tabset`)return;let a=i.getId();a===`ts_sidebar`||t&&a===t||typeof e.getWindowId==`function`&&e.getWindowId()||n.push(e.getId())});for(let t of n)e.doAction(j.deleteTab(t));return n.length}function ar(e){if(!e)return 0;let t=[];e.visitNodes(e=>{e.getType()===`tab`&&(e.getConfig()||{}).beside&&t.push(e.getId())});for(let n of t)e.doAction(j.deleteTab(n));return t.length}function or(e,t){let{component:n,name:r,config:i={}}=t||{};if(!e||!n)return{tabId:null,reused:!1};let a=Zn(e);if(!a)return{tabId:null,reused:!1};let o={...i,beside:!0},s=Kn(e,n,o);if(s)return e.doAction(j.selectTab(s.getId())),r&&s.getName()!==r&&e.doAction(j.renameTab(s.getId(),r)),{tabId:s.getId(),reused:!0};ar(e),e.doAction(j.addTab({type:`tab`,name:r||n,component:n,config:o,enableClose:!0},a,O.getByName(`right`),-1,!0));let c=Kn(e,n,o);return{tabId:c?c.getId():null,reused:!1}}function sr(e,t){let{component:n,name:r,config:i={}}=t;if(!e)return{tabId:null,reused:!1};let a=t.area||Mn(n),o=Kn(e,n,i);if(o)return e.doAction(j.selectTab(o.getId())),r&&o.getName()!==r&&e.doAction(j.renameTab(o.getId(),r)),a===q.RIGHT&&tr(e,!0),a===q.MAIN&&(n===`page`||n===`dir`)&&rr(e,{dirKey:i.dirKey,task:i.task}),{tabId:o.getId(),reused:!0};if(a===q.RIGHT&&Nn(n)){let t=Jn(e,n);if(t)return e.doAction(j.updateNodeAttributes(t.getId(),{config:i})),e.doAction(j.selectTab(t.getId())),r&&t.getName()!==r&&e.doAction(j.renameTab(t.getId(),r)),tr(e,!0),{tabId:t.getId(),reused:!0}}if(a===q.MAIN){ir(e);let t=Zn(e);if(!t)return{tabId:null,reused:!1};e.doAction(j.addTab({type:`tab`,name:r,component:n,config:i},t,O.getByName(`center`),-1,!0));let a=Kn(e,n,i);return a&&(n===`page`||n===`dir`)&&rr(e,{dirKey:i.dirKey,task:i.task}),{tabId:a?a.getId():null,reused:!1}}if(a===q.RIGHT){let t=Qn(e);if(t){tr(e,!0),e.doAction(j.addTab({type:`tab`,name:r,component:n,config:i},t,O.getByName(`center`),-1,!0));let a=Kn(e,n,i);return{tabId:a?a.getId():null,reused:!1}}}if(a===q.FLOAT)return cr(e,{...t,component:n,name:r,config:i});let s=Xn(e,[`sidebar`]);if(!s)return{tabId:null,reused:!1};let c=O.getByName(t.location||`center`);e.doAction(j.addTab({type:`tab`,name:r,component:n,config:i},s,c,-1,!0));let l=Kn(e,n,i);return{tabId:l?l.getId():null,reused:!1}}function cr(e,t){let n=sr(e,{...t,area:q.MAIN,location:t.location||`center`});if(!n||!n.tabId||n.reused)return n;let r=new Set([...e.getLayouts().keys()]);e.doAction(j.popoutTab(n.tabId,`float`));let i=typeof window<`u`?window.innerWidth:1280,a=typeof window<`u`?window.innerHeight:800,o=Math.min(760,Math.max(560,i-160)),s=Math.min(700,Math.max(460,a-160));for(let[t,n]of e.getLayouts()){if(r.has(t)||n.getType()!==`float`)continue;let i=n.getRect(),a=new E(Math.round(i.x+(i.width-o)/2),Math.round(i.y+(i.height-s)/2),o,s);e.doAction(j.moveFloat(n.getLayoutId(),a))}return n}function lr(e,t){if(!e)return null;let n=null;return e.visitNodes(e=>{if(n||e.getType()!==`tab`||e.getComponent()!==t)return;let r=e.getParent();r&&r.getType()===`tabset`&&(n=r)}),n?n.getId():null}function ur(e,t){if(!e||!t)return null;let n=null;return e.visitNodes(e=>{n===null&&e.getType()===`tabset`&&e.getId()===t&&(n=e.getWeight())}),n}function dr(e,t,n){if(!e||!t)return!1;let r=!1;return e.visitNodes(e=>{r||e.getType()===`tabset`&&e.getId()===t&&(r=!0)}),r?(e.doAction(j.updateNodeAttributes(t,n)),!0):!1}function fr(e){if(!e)return null;let t=lr(e,`sidebar`);if(t)return t;let n=e.getFirstTabSet&&e.getFirstTabSet(),r=n?n.getId():null;if(!r)return null;e.doAction(j.addTab({type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1},r,O.getByName(`left`),-1,!0));let i=lr(e,`sidebar`);return i&&dr(e,i,kn(`expanded`)),i}function pr(e){let t=e&&e.getActiveTabset();return t&&t.getSelectedNode()||null}function mr(e){return String(e||``).trim().replace(/\.md$/i,``).replace(/\s+/g,` `).toLowerCase()}function hr(e,t){let n=Array.isArray(t)?t:[];if(!n.length)return null;let r=mr(e);if(!r)return null;let i=r.replace(/\\/g,`/`),a=n.find(e=>e.rel&&mr(e.rel)===i||e.path&&String(e.path).replace(/\\/g,`/`).toLowerCase()===i);if(a)return{docId:a.docId};let o=n.filter(e=>e.name===i.split(`/`).pop());return o.length===1?{docId:o[0].docId}:o.length>1?{candidates:o.map(e=>e.docId)}:null}var gr=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/,_r=/^([A-Za-z][\w-]*)\s*:\s*(.*)$/,vr=[`board`,`project`,`boardIntro`,`boardDesc`,`projectIntro`,`projectDesc`];function yr(e){if(!e||typeof e!=`object`)return{};let t={...e};for(let e of vr){if(t[e]!=null&&String(t[e]).trim()!==``)continue;let n=null;for(let r of Object.keys(t)){if(r===e||!e.endsWith(r)||r.length<1||r.length>=e.length)continue;let i=t[r];if(i!=null&&String(i).trim()!==``){n=r;break}}n&&(t[e]=t[n],delete t[n])}return t}function br(e){let t=String(e??``).match(gr);if(!t)return{};let n={},r=0;for(let e of t[1].split(/\r?\n/)){let t=e.match(_r);t&&(n[t[1]]=t[2].trim(),r+=1)}return r?yr(n):{}}function xr(e){return String(e??``).replace(gr,(e,t)=>String(t||``).split(/\r?\n/).some(e=>_r.test(e))?``:e)}function Sr(e,t={}){let n=xr(e),r=Object.entries(t).filter(([,e])=>e!=null&&`${e}`.trim()!==``).map(([e,t])=>`${e}: ${`${t}`.trim()}`);return r.length?`---\n${r.join(`
29
+ then enabling this option will gray out this tab`),t.addInherited(`borderWidth`,`tabBorderWidth`).setDescription(`the width of this tab when shown in a border; -1 uses the border's default size`),t.addInherited(`borderHeight`,`tabBorderHeight`).setDescription(`the height of this tab when shown in a border; -1 uses the border's default size`),t.addInherited(`minWidth`,`tabMinWidth`).setDescription(`the minimum width (in px) of this tab`),t.addInherited(`minHeight`,`tabMinHeight`).setDescription(`the minimum height (in px) of this tab`),t.addInherited(`maxWidth`,`tabMaxWidth`).setDescription(`the maximum width (in px) of this tab`),t.addInherited(`maxHeight`,`tabMaxHeight`).setDescription(`the maximum height (in px) of this tab`),t.addInherited(`enableScrollbars`,`tabEnableScrollbars`).setDescription(`whether the tab will be hosted in a scrollable container`),t}},G=function(e){return e.Close_Tab=`flexlayout.ui.close.tab`,e.Pinned_Tab=`flexlayout.ui.pinned.tab`,e.Rename_Tab=`flexlayout.ui.rename.tab`,e.Close_Tabset=`flexlayout.ui.close.tabset`,e.Active_Tabset=`flexlayout.ui.active.tabset`,e.Move_Tabset=`flexlayout.ui.move.tabset`,e.Move_Tabs=`flexlayout.ui.move.tabs (?)`,e.Move_Group=`flexlayout.ui.move.group (?)`,e.Maximize=`flexlayout.ui.maximize.tabset`,e.Restore=`flexlayout.ui.restore.tabset`,e.Popout_Tab=`flexlayout.ui.popout.tab`,e.Popout_Tab_Float=`flexlayout.ui.popout.tab.float`,e.Popout_Float_To_Window=`flexlayout.ui.popout.float.to.window`,e.Dock_Float_To_Layout=`flexlayout.ui.dock.float.to.layout`,e.Dock_Float_Tabs=`flexlayout.ui.dock.float.tabs (?)`,e.Overflow_Menu_Tooltip=`flexlayout.ui.overflow.menu.tooltip`,e.Splitter=`flexlayout.ui.splitter`,e.Error_rendering_component=`flexlayout.ui.error.rendering.component`,e.Error_rendering_component_retry=`flexlayout.ui.error.rendering.component.retry`,e.Popout_Window_Name=`flexlayout.ui.popout.window.name`,e.Menu_Rename=`flexlayout.ui.menu.rename`,e.Menu_Pin=`flexlayout.ui.menu.pin`,e.Menu_Unpin=`flexlayout.ui.menu.unpin`,e.Menu_Popout=`flexlayout.ui.menu.popout`,e.Menu_Float=`flexlayout.ui.menu.float`,e.Menu_Popout_Tabset=`flexlayout.ui.menu.popout.tabset`,e.Menu_Float_Tabset=`flexlayout.ui.menu.float.tabset`,e.Menu_Maximize=`flexlayout.ui.menu.maximize`,e.Menu_Restore=`flexlayout.ui.menu.restore`,e.Menu_Overlay=`flexlayout.ui.menu.overlay`,e.Menu_Split=`flexlayout.ui.menu.split`,e.Menu_Close_All=`flexlayout.ui.menu.close.all`,e.Menu_Close_Right=`flexlayout.ui.menu.close.right`,e.Menu_Close_Others=`flexlayout.ui.menu.close.others`,e.Menu_Add_To_New_Group=`flexlayout.ui.menu.add.to.new.group`,e.Menu_Add_To_Group=`flexlayout.ui.menu.add.to.group`,e.Menu_Remove_From_Group=`flexlayout.ui.menu.remove.from.group`,e.Menu_Ungroup=`flexlayout.ui.menu.ungroup`,e.Menu_Expand=`flexlayout.ui.menu.expand`,e.Menu_Collapse=`flexlayout.ui.menu.collapse`,e.Rename_Group=`flexlayout.ui.rename.group`,e.Group_Color=`flexlayout.ui.group.color`,e.Group_Pill_Tooltip=`flexlayout.ui.group.pill.tooltip`,e.Group_Name_Label=`flexlayout.ui.group.name.label`,e.Group_Name_Placeholder=`flexlayout.ui.group.name.placeholder`,e.Group_Color_N=`flexlayout.ui.group.color.n`,e.Group_Default_Name=`flexlayout.ui.group.default.name`,e}({}),ge={"flexlayout.ui.close.tab":`Close`,"flexlayout.ui.pinned.tab":`Pinned`,"flexlayout.ui.rename.tab":`Rename tab`,"flexlayout.ui.close.tabset":`Close tabset`,"flexlayout.ui.active.tabset":`Active tabset`,"flexlayout.ui.move.tabset":`Move tabset`,"flexlayout.ui.move.tabs (?)":`Move tabs (?)`,"flexlayout.ui.move.group (?)":`Move group (?)`,"flexlayout.ui.maximize.tabset":`Maximize tabset`,"flexlayout.ui.restore.tabset":`Restore tabset`,"flexlayout.ui.popout.tab":`Popout selected tab`,"flexlayout.ui.popout.tab.float":`Float selected tab`,"flexlayout.ui.popout.float.to.window":`Popout panel`,"flexlayout.ui.dock.float.to.layout":`Drag into another layout`,"flexlayout.ui.dock.float.tabs (?)":`Dock tabs (?)`,"flexlayout.ui.overflow.menu.tooltip":`Hidden tabs`,"flexlayout.ui.splitter":`Resize`,"flexlayout.ui.error.rendering.component":`Error rendering component`,"flexlayout.ui.error.rendering.component.retry":`Retry`,"flexlayout.ui.popout.window.name":`Popout Window`,"flexlayout.ui.menu.rename":`Rename`,"flexlayout.ui.menu.pin":`Pin`,"flexlayout.ui.menu.unpin":`Unpin`,"flexlayout.ui.menu.popout":`Popout`,"flexlayout.ui.menu.float":`Float`,"flexlayout.ui.menu.popout.tabset":`Pop out tabset`,"flexlayout.ui.menu.float.tabset":`Float tabset`,"flexlayout.ui.menu.maximize":`Maximize`,"flexlayout.ui.menu.restore":`Restore`,"flexlayout.ui.menu.overlay":`Overlay`,"flexlayout.ui.menu.split":`Split`,"flexlayout.ui.menu.close.all":`Close All`,"flexlayout.ui.menu.close.right":`Close to the Right`,"flexlayout.ui.menu.close.others":`Close Others`,"flexlayout.ui.menu.add.to.new.group":`Add to new group`,"flexlayout.ui.menu.add.to.group":`Add to group`,"flexlayout.ui.menu.remove.from.group":`Remove from group`,"flexlayout.ui.menu.ungroup":`Ungroup`,"flexlayout.ui.menu.expand":`Expand`,"flexlayout.ui.menu.collapse":`Collapse`,"flexlayout.ui.rename.group":`Rename group`,"flexlayout.ui.group.color":`Group color`,"flexlayout.ui.group.pill.tooltip":`Tab Group, click to expand/collapse`,"flexlayout.ui.group.name.label":`Name`,"flexlayout.ui.group.name.placeholder":`Group Name`,"flexlayout.ui.group.color.n":`Group color ?`,"flexlayout.ui.group.default.name":`Group`},_e={closeTab:`Ctrl+Delete`,renameTab:`F2`,focusTabToggle:void 0,focusNextTabset:void 0,focusPreviousTabset:void 0,closeOverlayBorder:`Escape`};function ve(){return typeof window<`u`&&window.matchMedia&&window.matchMedia(`(hover: hover) and (pointer: fine)`).matches}function ye(e,t,n){let r,i=t.getName(),a=t.getName();n===void 0&&(n=0),r===void 0&&t.getIcon()!==void 0&&(r=n===0?(0,_.jsx)(`img`,{style:{width:`1em`,height:`1em`},src:t.getIcon(),alt:``}):(0,_.jsx)(`img`,{style:{width:`1em`,height:`1em`,transform:`rotate(`+n+`deg)`},src:t.getIcon(),alt:``}));let o={leading:r,content:i,name:a,buttons:[]};return e.customizeTab(t,o),t.setRenderedName(o.name),o}function be(e,t){return e+t.replace(/\s/g,`_`)}function xe(e){return e.getPath().replace(/\/t(\d+)$/,`/tb$1`)}function Se(e,t){if(!t||typeof e.key!=`string`)return!1;let n=t.split(`+`),r=n.pop(),i=e=>n.some(t=>t.toLowerCase()===e);return e.key.toLowerCase()===r.toLowerCase()&&e.ctrlKey===i(`ctrl`)&&e.shiftKey===i(`shift`)&&e.altKey===i(`alt`)&&e.metaKey===i(`meta`)}function Ce(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}function we(e){return{..._e,...e}}function Te(e){return e?.replace(/\bctrl\b/i,`Control`)}function Ee(e){e&&(e.querySelector(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)??e).focus()}function De(e){let t=!1;return e.nativeEvent instanceof MouseEvent&&(e.nativeEvent.button!==0||e.ctrlKey||e.altKey||e.metaKey||e.shiftKey)&&(t=!0),t}function Oe(e,t){let n=[...ke(`iframe`,t),...ke(`webview`,t)];for(let t of n)t.style.pointerEvents=e?`auto`:`none`}function ke(e,t){return[...t.getElementsByTagName(e)]}var Ae=!1;function je(e,t,n,r,i){Ae=!0,t.preventDefault(),t.currentTarget&&typeof t.currentTarget.setPointerCapture==`function`&&t.currentTarget.setPointerCapture(t.pointerId);let a=e=>{e.preventDefault(),n(e.clientX,e.clientY)},o=()=>{e.removeEventListener(`pointermove`,a),e.removeEventListener(`pointerup`,c),e.removeEventListener(`pointercancel`,s)},s=e=>{e.preventDefault(),o(),Ae=!1,i()},c=()=>{o(),Ae=!1,r()};e.addEventListener(`pointermove`,a),e.addEventListener(`pointerup`,c),e.addEventListener(`pointercancel`,s)}function Me(e,t){let n=e.getAttribute(`style`);return n!==t.getAttribute(`style`)&&(n?t.setAttribute(`style`,n):t.removeAttribute(`style`),!0)}function Ne(){let e=navigator.userAgent;return e.includes(`Safari`)&&!e.includes(`Chrome`)&&!e.includes(`Chromium`)}function Pe(e=window){let t=e.document;return{scrollTop:e.pageYOffset||t.documentElement.scrollTop||t.body.scrollTop||0,scrollLeft:e.pageXOffset||t.documentElement.scrollLeft||t.body.scrollLeft||0,fullHeight:Math.max(t.body.scrollHeight,t.documentElement.scrollHeight,t.body.offsetHeight,t.documentElement.offsetHeight,t.body.clientHeight,t.documentElement.clientHeight),fullWidth:Math.max(t.body.scrollWidth,t.documentElement.scrollWidth,t.body.offsetWidth,t.documentElement.offsetWidth,t.body.clientWidth,t.documentElement.clientWidth),viewportHeight:e.innerHeight||t.documentElement.clientHeight,viewportWidth:e.innerWidth||t.documentElement.clientWidth}}var Fe=e=>{let{controller:t,show:n}=e;return(0,_.jsx)(`div`,{"aria-hidden":`true`,className:t.getClassName(A.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:n?`flex`:`none`}})};Fe.displayName=`Overlay`;var Ie=2e3,Le=750,Re=e=>{let{title:t,controller:n,layout:r,url:i,onCloseLayout:a,children:o}=e,s=g.useRef(null),[c,l]=g.useState(void 0),[u,d]=g.useState(void 0),[f,p]=g.useState(void 0),m=g.useMemo(()=>new Map,[]),h=g.useRef(!1),_=g.useRef(null),y=g.useRef(null),b=g.useRef(null),x=g.useRef(new Map);if(g.useLayoutEffect(()=>{!h.current&&c&&(h.current=!0,n.redrawLayout(),We(m))},[c,n,m]),g.useLayoutEffect(()=>{let e=()=>{if(s.current){let e=s.current;s.current=null,e.close()}};if(!s.current){let o=r.getLayoutId(),c=r.getRect();s.current=window.open(i,o,`left=${c.x},top=${c.y},width=${c.width},height=${c.height}`),s.current?(window.addEventListener(`beforeunload`,e),s.current.addEventListener(`load`,()=>{if(s.current){b.current?.(),h.current=!1;let e=s.current;s.current.focus(),s.current.resizeTo(c.width,c.height),s.current.moveTo(c.x,c.y);let i=s.current;i.resizeBy(c.width-i.outerWidth,c.height-i.outerHeight),i.moveBy(c.x-i.screenLeft,c.y-i.screenTop);let o=s.current.document;d(s.current),p(o),o.title=t,document.documentElement.lang&&(o.documentElement.lang=document.documentElement.lang),document.documentElement.dir&&(o.documentElement.dir=document.documentElement.dir);let u=o.createElement(`div`);u.className=A.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,o.body.appendChild(u),n.getProps().onPopoutOpen?.(r,s.current,o),Ve(o,m).then(()=>{l(u)}),_.current=new MutationObserver(e=>ze(e,o,m)),_.current.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),y.current=o.defaultView?.setInterval(()=>{Ge(m,x.current)},Le)??null;let f=()=>{s.current&&(n.getProps().onPopoutClose?.(r,s.current,o),a(r),s.current=null,b.current?.())};e.addEventListener(`beforeunload`,f),b.current=()=>{_.current?.disconnect(),_.current=null,y.current!=null&&(o.defaultView?.clearInterval(y.current),y.current=null),e.removeEventListener(`beforeunload`,f)}}})):(console.warn(`Unable to open window ${i}`),a(r))}return()=>{window.removeEventListener(`beforeunload`,e),s.current?.close(),s.current=null,b.current?.()}},[]),c!==void 0){let e=n.getProps().renderPopoutContent,t=o;return e&&f&&(t=e({children:o,layout:r,popoutWindow:u??window,popoutDocument:f})),(0,v.createPortal)(t,c)}return null};function ze(e,t,n){for(let r of e)if(r.type===`childList`&&r.target===document.head){for(let e of r.addedNodes)(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement)&&He(t,e,n);for(let e of r.removedNodes)if(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement){let t=n.get(e);t&&(t.remove(),n.delete(e))}}else{let e=Be(r.target),t=e&&n.get(e);e&&t&&Ue(e,t)}}function Be(e){let t=e instanceof HTMLElement?e:e.parentNode;for(;t&&!(t instanceof HTMLStyleElement);)t=t.parentNode;return t instanceof HTMLStyleElement?t:void 0}function Ve(e,t){let n=[],r=document.querySelectorAll(`style, link[rel="stylesheet"]`);for(let i of r)He(e,i,t,n);return Promise.all(n)}function He(e,t,n,r){if(t instanceof HTMLLinkElement){let i=t.cloneNode(!0);e.head.appendChild(i),n.set(t,i),r&&r.push(new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};i.onload=()=>r(!0),i.onerror=()=>r(!1),e.defaultView?.setTimeout(()=>r(!1),Ie)}))}else if(t instanceof HTMLStyleElement)try{let r=t.cloneNode(!0);e.head.appendChild(r),Ue(t,r),n.set(t,r)}catch{}}function Ue(e,t){let n=e.textContent??``;if(n.trim()!==``)t.textContent=n;else try{t.textContent=``;let n=e.sheet?.cssRules;if(n)for(let e of n)t.sheet.insertRule(e.cssText,t.sheet.cssRules.length)}catch{}}function We(e){for(let[t,n]of e)t instanceof HTMLStyleElement&&Ue(t,n)}function Ge(e,t){for(let[n,r]of e){if(!(n instanceof HTMLStyleElement)||(n.textContent??``).trim()!==``)continue;let e=0;try{e=n.sheet?.cssRules.length??0}catch{}e!==t.get(n)&&(t.set(n,e),Ue(n,r))}}Re.displayName=`PopoutWindow`;var Ke=10,qe=-4,Je=8,Ye=12,Xe=150,Ze=25,Qe=e=>{let{controller:t,layout:n,children:r}=e,[i,a]=g.useState(n.getRect()),o=g.useRef(E.empty()),s=t.getClassName,c=g.useRef(null),l=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useRef(null),p=g.useRef(null),m=g.useRef(null),h=g.useRef(null),v=g.useRef(null),y=g.useRef(null),b=g.useRef(!1),x=g.useRef(void 0);g.useEffect(()=>{o.current=i},[i]),g.useEffect(()=>{let e=requestAnimationFrame(()=>{a(n.getRect())});return()=>cancelAnimationFrame(e)},[n]);let S=g.useCallback(e=>{let n=t.getCurrentWindow()??window,r=E.fromDomRect(t.getRootDiv().getBoundingClientRect()),i;if(t.getProps().constrainFloatPanels)i=new E(0,0,r.width,r.height);else{let e=Pe(n),t=Math.max(e.fullWidth,n.innerWidth),a=Math.max(e.fullHeight,n.innerHeight);i=new E(-r.x,-r.y,t,a)}let a=e.clone();return a.clamp(i),a},[t]),C=g.useCallback(e=>{e.preventDefault(),e.stopImmediatePropagation()},[]);g.useEffect(()=>{let e=[l,u,d,f,p,m,h,v,y].map(e=>e.current).filter(e=>e!==null);return e.forEach(e=>e.addEventListener(`touchstart`,C,{passive:!1})),()=>{e.forEach(e=>e.removeEventListener(`touchstart`,C))}},[C]);let w=g.useRef(!1);g.useLayoutEffect(()=>{if(!w.current){w.current=!0;let e=S(i);e.equals(i)||(a(e),n.setRect(e))}},[S,i,n]),g.useEffect(()=>{let e=()=>{let e=[...t.getModel().getLayouts()],r=e[e.length-1][1];n!==r&&(b.current=!0)},r=t.getCurrentWindow()??window,i=()=>{b.current&&=(x.current=r.setTimeout(()=>{x.current=void 0,t.moveWindowToFront(n.getLayoutId())},10),!1)},a=c.current;return a&&(a.addEventListener(`pointerdown`,e,{capture:!0}),a.addEventListener(`pointerup`,i)),()=>{a&&(a.removeEventListener(`pointerdown`,e,{capture:!0}),a.removeEventListener(`pointerup`,i)),x.current!==void 0&&(r.clearTimeout(x.current),x.current=void 0)}},[t,n]);let T=e=>{e.stopPropagation();let r={x:e.clientX-i.x,y:e.clientY-i.y};t.showOverlayOnAllWindows(!0),je(t.getCurrentDocument()??document,e,(e,o)=>{b.current&&=(t.moveWindowToFront(n.getLayoutId()),!1);let s=new E(e-r.x,o-r.y,i.width,i.height),c=S(s);a(c),t.doAction(j.moveFloat(n.getLayoutId(),c).setAdjusting(!0))},()=>{t.doAction(j.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)},()=>{t.doAction(j.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)})},D=t.getIcons(),O=t.isSupportsPopout()&&n.getRootRow()?.isAllowedInWindow()===!0,k=e=>{e.stopPropagation(),n.getRootRow()?.getChildren().length?t.getDragDropManager().startDockLayoutDrag(e.nativeEvent,n,c.current??void 0):e.preventDefault()},M=e=>{t.getDragDropManager().onDragEnded()},N=e=>{e.stopPropagation()},P=e=>{e.stopPropagation();let r=t.getScreenRect(n.getRect());t.doAction(j.popoutFloat(n.getLayoutId(),r.toJson()))},F=(e,r)=>{let s=i,c={x:e.clientX,y:e.clientY};t.showOverlayOnAllWindows(!0),je(t.getCurrentDocument()??document,e,(e,i)=>{let o=e-c.x,l=i-c.y,u=s.x,d=s.y,f=s.width,p=s.height;r.includes(`n`)&&(d+=l,p-=l),r.includes(`s`)&&(p+=l),r.includes(`w`)&&(u+=o,f-=o),r.includes(`e`)&&(f+=o);let m=new E(u,d,Math.max(Xe,f),Math.max(Ze,p)),h=S(m);a(h),t.doAction(j.moveFloat(n.getLayoutId(),h).setAdjusting(!0))},()=>{t.doAction(j.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)},()=>{t.doAction(j.moveFloat(n.getLayoutId(),o.current).setAdjusting(!1)),t.redrawLayout(),t.showOverlayOnAllWindows(!1)}),e.stopPropagation()};return(0,_.jsxs)(`div`,{ref:c,className:s(A.FLEXLAYOUT__FLOAT_WINDOW),style:{left:i.x,top:i.y,width:i.width,height:i.height,position:`absolute`},children:[(0,_.jsxs)(`div`,{ref:l,className:s(A.FLEXLAYOUT__FLOAT_WINDOW_HEADER),onPointerDown:T,children:[(0,_.jsx)(`div`,{"data-layout-path":`/floatwindow/drag-handle`,className:s(A.FLEXLAYOUT__FLOAT_WINDOW_DRAG_HANDLE),draggable:!0,title:t.i18nName(G.Dock_Float_To_Layout),"aria-label":t.i18nName(G.Dock_Float_To_Layout),onDragStart:k,onDragEnd:M,onPointerDown:N,children:D.dragToDock}),(0,_.jsx)(`div`,{style:{flexGrow:1,display:`flex`,justifyContent:`center`,alignItems:`center`,minWidth:0,overflow:`hidden`},children:n.getName()===void 0?(0,_.jsx)(`div`,{style:{width:50,height:8,display:`flex`,flexDirection:`column`,justifyContent:`space-around`,opacity:.5},children:(0,_.jsx)(`div`,{style:{height:2,backgroundColor:`gray`,borderRadius:1}})}):(0,_.jsx)(`span`,{"data-layout-path":`/floatwindow/title`,className:s(A.FLEXLAYOUT__FLOAT_WINDOW_HEADER_TITLE),title:n.getName(),children:n.getName()})}),O&&(0,_.jsx)(`button`,{type:`button`,"data-layout-path":`/floatwindow/button/popout`,className:s(A.FLEXLAYOUT__FLOAT_WINDOW_BUTTON),title:t.i18nName(G.Popout_Float_To_Window),"aria-label":t.i18nName(G.Popout_Float_To_Window),onClick:P,onPointerDown:N,children:D.popoutFloatWindow})]}),(0,_.jsx)(`div`,{className:s(A.FLEXLAYOUT__FLOAT_WINDOW_CONTENT),children:r}),(0,_.jsx)(`div`,{ref:u,style:{position:`absolute`,zIndex:Ke,top:qe,left:Je,right:Je,height:Je,cursor:`ns-resize`},onPointerDown:e=>F(e,`n`)}),(0,_.jsx)(`div`,{ref:m,style:{position:`absolute`,zIndex:Ke,bottom:qe,left:Je,right:Je,height:Je,cursor:`ns-resize`},onPointerDown:e=>F(e,`s`)}),(0,_.jsx)(`div`,{ref:f,style:{position:`absolute`,zIndex:Ke,top:Je,bottom:Je,right:qe,width:Je,cursor:`ew-resize`},onPointerDown:e=>F(e,`e`)}),(0,_.jsx)(`div`,{ref:v,style:{position:`absolute`,zIndex:Ke,top:Je,bottom:Je,left:qe,width:Je,cursor:`ew-resize`},onPointerDown:e=>F(e,`w`)}),(0,_.jsx)(`div`,{ref:y,style:{position:`absolute`,zIndex:Ke,top:qe,left:qe,width:Ye,height:Ye,cursor:`nwse-resize`},onPointerDown:e=>F(e,`nw`)}),(0,_.jsx)(`div`,{ref:d,style:{position:`absolute`,zIndex:Ke,top:qe,right:qe,width:Ye,height:Ye,cursor:`nesw-resize`},onPointerDown:e=>F(e,`ne`)}),(0,_.jsx)(`div`,{ref:h,style:{position:`absolute`,zIndex:Ke,bottom:qe,left:qe,width:Ye,height:Ye,cursor:`nesw-resize`},onPointerDown:e=>F(e,`sw`)}),(0,_.jsx)(`div`,{ref:p,style:{position:`absolute`,zIndex:Ke,bottom:0,right:0,width:Ye,height:Ye,cursor:`nwse-resize`},onPointerDown:e=>F(e,`se`)})]})},$e=({controller:e})=>{let t=[],n=e.getModel().getLayouts(),r=2e3;for(let[i,a]of n)a.isMainLayout()||(a.getType()===`window`&&e.isSupportsPopout()?t.push((0,_.jsx)(Re,{controller:e,layout:a,title:e.getPopoutWindowName()+` `+i,url:e.getPopoutURL()+`?id=`+encodeURIComponent(i),onCloseLayout:e.onCloseLayout,children:(0,_.jsx)(`div`,{className:e.getProps().popoutClassName,children:(0,_.jsx)(Wt,{...e.getProps(),layoutId:i,path:a.getPath(),mainLayoutController:e})})},i)):a.getType()===`float`&&(t.push((0,_.jsx)(Qe,{controller:e,layout:a,zIndex:r,onCloseLayout:e.onCloseLayout,children:(0,_.jsx)(Wt,{...e.getProps(),layoutId:i,path:a.getPath(),mainLayoutController:e})},i+`float`)),r++));return(0,_.jsx)(_.Fragment,{children:t})};$e.displayName=`FloatingWindowContainer`;var et=e=>{let{controller:t,tabNode:n,selected:r,border:i,icons:a,path:o}=e,s=g.useRef(null),c=g.useRef(null),l=t.getKeyMap(),u=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},d=e=>{e.stopPropagation(),t.getDragDropManager().onDragEnded()},f=e=>{De(e)&&t.auxMouseClick(n,e)},p=e=>{t.showContextMenu(n,e)},m=()=>{t.doAction(j.selectTab(n.getId()))},h=e=>{let t=s.current?.closest(`[role="tablist"]`);if(t){let n=Array.from(t.querySelectorAll(`[role="tab"]`));n[n.indexOf(s.current)+e]?.focus()}},v=()=>{let e=s.current.ownerDocument,t=()=>Ee(e.getElementById(be(`flexlayout-tab-`,n.getId())));r?t():(m(),requestAnimationFrame(t))},y=e=>{t.getEditingTab()!==n&&(Se(e,l.focusTabToggle)?(v(),e.preventDefault()):e.key===`Enter`||e.key===` `?(m(),e.preventDefault()):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&!Ce(e)?(h(-1),e.preventDefault()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&!Ce(e)?(h(1),e.preventDefault()):Se(e,l.closeTab)&&n.isCloseable()&&(h(1),t.doAction(j.deleteTab(n.getId())),e.preventDefault()))},b=()=>{let e=n.getCloseType();return!!(r||e===F.Always||e===F.Visible&&t.getCurrentWindow()?.matchMedia(`(hover: hover) and (pointer: fine)`).matches)},x=e=>{b()&&(t.doAction(j.deleteTab(n.getId())),e.stopPropagation())},S=e=>{e.stopPropagation()},C=()=>{if(r)return!0;let e=n.getTabContainer();return e instanceof U&&e.getSelected()===-1&&e.getTabNodes()[0]===n},w=t.getEditingTab()===n,T=g.useCallback(e=>{s.current=e,t.registerMeasurable(n,`tabbutton`,e)},[t,n]);g.useLayoutEffect(()=>{w&&c.current.select()},[w]),g.useEffect(()=>{if(w){let e=t.getCurrentDocument().body,n=e=>{e.target!==c.current&&t.setEditingTab(void 0)};return e.addEventListener(`pointerdown`,n),()=>e.removeEventListener(`pointerdown`,n)}},[w,t]);let E=e=>{e.stopPropagation()},D=e=>{e.code===`Escape`?(t.setEditingTab(void 0),s.current?.focus()):(e.code===`Enter`||e.code===`NumpadEnter`)&&(t.setEditingTab(void 0),t.doAction(j.renameTab(n.getId(),e.target.value)),s.current?.focus())},O=t.getClassName,k=O(A.FLEXLAYOUT__BORDER_BUTTON)+` `+O(A.FLEXLAYOUT__BORDER_BUTTON_+i);k+=r?` `+O(A.FLEXLAYOUT__BORDER_BUTTON__SELECTED):` `+O(A.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED);let M=n.getParent()instanceof V?n.getParent():void 0;M!==void 0&&(k+=` `+O(A.FLEXLAYOUT__TAB_BUTTON_GROUPED),n.getModel().getTabGroupType()===`underline`&&(k+=` `+O(A.FLEXLAYOUT__TAB_BUTTON_GROUPED_UNDERLINE))),n.getClassName()!==void 0&&(k+=` `+n.getClassName());let N=0;n.getModel().isEnableRotateBorderIcons()===!1&&(i===`left`?N=n.getModel().getBorderLeftTabDirection()===`down`?-90:90:i===`right`&&(N=-90));let P=ye(t,n,N),I=P.content?(0,_.jsx)(`div`,{className:O(A.FLEXLAYOUT__BORDER_BUTTON_CONTENT),children:P.content}):null,ee=P.leading?(0,_.jsx)(`div`,{className:O(A.FLEXLAYOUT__BORDER_BUTTON_LEADING),children:P.leading}):null;if(w&&(I=(0,_.jsx)(`input`,{ref:c,className:O(A.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":o+`/textbox`,type:`text`,"aria-label":t.i18nName(G.Rename_Tab),autoFocus:!0,defaultValue:n.getName(),onKeyDown:D,onPointerDown:E})),n.isCloseable()){let e=t.i18nName(G.Close_Tab);P.buttons.push((0,_.jsx)(`div`,{"data-layout-path":o+`/button/close`,title:e,"aria-hidden":`true`,className:O(A.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:S,onClick:x,children:typeof a.close==`function`?a.close(n):a.close},`close`))}let te=[Te(l.focusTabToggle),n.isCloseable()?Te(l.closeTab):void 0].filter(Boolean).join(` `)||void 0,ne={};return M!==void 0&&(ne[`--flexlayout-group-color`]=M.getColor()),(0,_.jsxs)(`div`,{ref:T,id:be(`flexlayout-tabbutton-`,n.getId()),role:w?void 0:`tab`,"aria-selected":w?void 0:r,"aria-controls":w?void 0:be(`flexlayout-tab-`,n.getId()),"aria-label":w?void 0:P.name,"aria-keyshortcuts":w?void 0:te,tabIndex:w?-1:C()?0:-1,onKeyDown:y,"data-layout-path":o,className:k,style:ne,onClick:m,onAuxClick:f,onContextMenu:p,title:n.getHelpText(),draggable:!0,onDragStart:u,onDragEnd:d,children:[ee,I,P.buttons]})};et.displayName=`BorderButton`;var tt=e=>{let{controller:t,groupNode:n,path:r}=e,i=g.useRef(null),a=g.useCallback(e=>{i.current=e,t.registerMeasurable(n,`grouppill`,e)},[t,n]),o=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},s=e=>{t.getDragDropManager().onDragEnded()},c=e=>{t.showContextMenu(n,e)},l=()=>{t.doAction(j.updateNodeAttributes(n.getId(),{opened:!n.isOpened()}))},u=e=>{l(),e.stopPropagation()},d=e=>{if(e.key===`Enter`||e.key===` `)l(),e.preventDefault();else if(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`){let t=i.current.getBoundingClientRect();i.current.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:t.x+t.width/2,clientY:t.y+t.height/2})),e.preventDefault()}},f=t.getClassName,p=f(A.FLEXLAYOUT__GROUP_PILL);n.isOpened()?t.getModel().getTabGroupType()===`underline`&&(p+=` `+f(A.FLEXLAYOUT__GROUP_PILL_UNDERLINE)):p+=` `+f(A.FLEXLAYOUT__GROUP_PILL_COLLAPSED);let m=n.getColor(),h={backgroundColor:m,borderColor:m},v=t.i18nName(G.Group_Pill_Tooltip);return(0,_.jsxs)(`div`,{ref:a,"data-layout-path":r,role:`button`,"aria-label":n.getName(),"aria-expanded":n.isOpened(),tabIndex:0,title:v,className:p,style:h,draggable:!0,onDragStart:o,onDragEnd:s,onClick:u,onKeyDown:d,onContextMenu:c,children:[(0,_.jsx)(`span`,{className:f(A.FLEXLAYOUT__GROUP_PILL_NAME),children:n.getName()}),!n.isOpened()&&(0,_.jsx)(`span`,{"aria-hidden":`true`,className:f(A.FLEXLAYOUT__GROUP_PILL_COUNT),children:n.getChildren().length})]})};tt.displayName=`GroupPill`;var nt=e=>{let{controller:t,groupNode:n,path:r}=e,i=g.useRef(null),a=g.useCallback(e=>{i.current=e,t.registerMeasurable(n,`groupendmarker`,e)},[t,n]),o=e=>{t.doAction(j.updateNodeAttributes(n.getId(),{opened:!n.isOpened()})),e.stopPropagation()},s=n.getColor(),c={backgroundColor:s,borderColor:s};return(0,_.jsx)(`div`,{ref:a,"data-layout-path":r,title:n.getName(),"aria-hidden":!0,className:t.getClassName(A.FLEXLAYOUT__GROUP_END_MARKER),style:c,onClick:o})};nt.displayName=`GroupEndMarker`;var rt=e=>{let{controller:t,tabNode:n}=e,r=t.getClassName,i=r(A.FLEXLAYOUT__TAB_BUTTON_STAMP),a=ye(t,n),o=a.content?(0,_.jsx)(`div`,{className:r(A.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:a.content}):n.getNameForOverflowMenu(),s=a.leading?(0,_.jsx)(`div`,{className:r(A.FLEXLAYOUT__TAB_BUTTON_LEADING),children:a.leading}):null;return(0,_.jsxs)(`div`,{className:i,title:n.getHelpText(),children:[s,o]})};rt.displayName=`TabButtonStamp`;var it=500;function at(e){return typeof e.getBoundingClientRect==`function`}function ot(e){return e.container?e.container:at(e.anchor)?e.anchor.ownerDocument.body:document.body}function st(e){if(at(e))return e.getBoundingClientRect();if(`right`in e&&`bottom`in e)return e;let t=e;return new DOMRect(t.x,t.y,0,0)}function ct(e,t){let n=t,{left:r,right:i,top:a,bottom:o}=e,s={};return(r+i)/2<n.left+n.width/2?s.left=r-n.left:s.right=n.right-i,(a+o)/2<n.top+n.height/2?s.top=a-n.top:s.bottom=n.bottom-o,s}var lt=e=>{let{anchor:t,items:n,onSelect:r,onClose:i,renderItem:a,title:o}=e,s=e.classNameMapper??(e=>e),c=ot(e),l=g.useRef(null),u=g.useRef(null),d=g.useRef({buffer:``,timer:void 0});g.useEffect(()=>()=>{d.current.timer&&clearTimeout(d.current.timer)},[]);let f=g.useCallback(e=>{e.disabled||((e.onSelect??r)?.(e),i())},[r,i]);g.useEffect(()=>{let n=c.ownerDocument;u.current?.contains(n.activeElement)||(u.current?.querySelector(`[role="menuitem"]:not([aria-disabled="true"])`)??u.current)?.focus();let r=e.returnFocusTo??(at(t)?t:void 0);return()=>{r?.focus?.()}},[]),g.useEffect(()=>{let e=c.ownerDocument,t=e=>{l.current?.contains(e.target)||i()};return e.addEventListener(`pointerdown`,t),()=>e.removeEventListener(`pointerdown`,t)},[c,i]);let p=e=>{let t=Array.from(u.current?.querySelectorAll(`[role="menuitem"]:not([aria-disabled="true"])`)??[]),n=e.target.closest?.(`[role="menuitem"]`),r=n?t.indexOf(n):-1;if(e.key===`Escape`||e.key===`Tab`)i(),e.preventDefault();else if(e.key===`ArrowDown`||e.key===`ArrowUp`)t.length>0&&t[(r+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus(),e.preventDefault();else if(e.key===`Home`||e.key===`End`)(e.key===`Home`?t[0]:t[t.length-1])?.focus(),e.preventDefault();else if(e.key.length===1&&e.key!==` `&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let n=d.current;n.timer&&clearTimeout(n.timer),n.buffer+=e.key.toLowerCase(),n.timer=setTimeout(()=>{n.buffer=``},it);let i=[...n.buffer].every(e=>e===n.buffer[0]),a=i?n.buffer[0]:n.buffer,o=i?r+1:Math.max(r,0);for(let e=0;e<t.length;e++){let n=(o+e)%t.length;if((t[n].textContent??``).trim().toLowerCase().startsWith(a)){t[n].focus();break}}e.preventDefault()}else(e.key===`Enter`||e.key===` `)&&n&&(n.click(),e.preventDefault())},m=e=>({select:()=>f(e),close:i}),h=e=>(0,_.jsx)(`div`,{className:s(A.FLEXLAYOUT__POPUP_MENU_ITEM)+(e.disabled?` `+s(A.FLEXLAYOUT__POPUP_MENU_ITEM__DISABLED):``),role:`menuitem`,tabIndex:-1,"aria-disabled":e.disabled||void 0,onClick:t=>{f(e),t.stopPropagation()},children:e.content??(0,_.jsxs)(_.Fragment,{children:[e.icon,e.label]})},e.key),y=(0,_.jsx)(`div`,{ref:l,className:s(A.FLEXLAYOUT__POPUP_MENU_CONTAINER),style:ct(st(t),c.getBoundingClientRect()),children:(0,_.jsx)(`div`,{ref:u,className:s(A.FLEXLAYOUT__POPUP_MENU),role:`menu`,"aria-label":o,tabIndex:0,onKeyDown:p,"data-layout-path":`/popup-menu`,children:n.map((e,t)=>e.type===`divider`?(0,_.jsx)(`div`,{className:s(A.FLEXLAYOUT__POPUP_MENU_DIVIDER),role:`separator`},e.key):a?a(e,t,m(e)):h(e))})});return(0,v.createPortal)(y,c)};function ut(e){let t=ot(e),n=at(e.anchor)?e.anchor.getBoundingClientRect():e.anchor,r=t.ownerDocument.createElement(`div`);t.appendChild(r);let i=(0,y.createRoot)(r),a=!1,o=()=>{a||(a=!0,i.unmount(),r.remove(),e.onClose())};return i.render((0,_.jsx)(lt,{...e,anchor:n,container:t,onClose:o})),o}function dt(e,t,n,r,i,a){let o=i.getClassName,s=n.map(e=>({key:e.node.getId()}));return i.showOverlayOnAllWindows(!0),ut({anchor:e,container:i.getRootDiv()??void 0,classNameMapper:o,returnFocusTo:e,title:i.i18nName(G.Overflow_Menu_Tooltip),items:s,onSelect:e=>{let t=s.indexOf(e);t>=0&&r(n[t])},renderItem:(e,r,a)=>{let s=n[r],c=s.node.getParent()instanceof V?s.node.getParent():void 0,l=c!==void 0,u=o(A.FLEXLAYOUT__POPUP_MENU_ITEM);l&&(u+=` `+o(A.FLEXLAYOUT__POPUP_MENU_ITEM_GROUPED)),t.getSelected()===s.index&&(u+=` `+o(A.FLEXLAYOUT__POPUP_MENU_ITEM__SELECTED));let d={};return l&&(d[`--flexlayout-group-color`]=c.getColor()),(0,_.jsx)(`div`,{className:u,role:`menuitem`,"aria-label":s.node.getNameForOverflowMenu(),tabIndex:-1,"data-layout-path":`/popup-menu/tb`+r,style:d,onClick:e=>{a.select(),e.stopPropagation()},draggable:!0,onDragStart:e=>{e.stopPropagation(),i.getDragDropManager().setDragNode(e.nativeEvent,s.node)},onDragEnd:()=>{i.getDragDropManager().onDragEnded(),a.close()},title:s.node.getHelpText(),children:(0,_.jsx)(rt,{tabNode:s.node,controller:i})},e.key)},onClose:()=>{i.showOverlayOnAllWindows(!1),a?.()}})}lt.displayName=`PopupMenu`;var ft=(e,t,n,r,i,a,o,s)=>{let[c,l]=g.useState([]),[u,d]=g.useState(!1),[f,p]=g.useState(!1),m=g.useRef(!1),h=g.useRef(void 0),_=g.useRef([]),v=g.useRef(0),y=g.useRef(!1),b=g.useRef(0);g.useEffect(()=>()=>{h.current!==void 0&&clearTimeout(h.current)},[]),g.useLayoutEffect(()=>{_.current=c});let x=g.useCallback(e=>{n===D.HORZ?r.current.scrollLeft=e:r.current.scrollTop=e},[n,r]),S=g.useCallback(e=>n===D.HORZ?e.scrollLeft:e.scrollTop,[n]),C=g.useCallback(e=>n===D.HORZ?e.clientWidth:e.clientHeight,[n]),w=g.useCallback(e=>n===D.HORZ?e.scrollWidth:e.scrollHeight,[n]),T=g.useCallback(e=>n===D.HORZ?e.width:e.height,[n]),E=g.useCallback(e=>n===D.HORZ?e.x:e.y,[n]),O=g.useCallback(e=>n===D.HORZ?e.right:e.bottom,[n]),k=g.useCallback(()=>{let e=[];if(r.current){let t=r.current,n=t.getBoundingClientRect(),i=E(n)-1,a=O(n)+1,s=t.firstElementChild,c=0;Array.from(s.children).forEach(t=>{let n=t.getBoundingClientRect();t.classList.contains(o)&&((E(n)<i||O(n)>a)&&e.push(c),c++)})}return e},[o,r,E,O]),A=g.useCallback(()=>{if(r.current&&i.current){let e=r.current,t=i.current,a=C(e),o=w(e),s=S(e);if(o>a&&o>0){let e=a*a/o,r=0;e<20&&(r=20-e,e=20);let i=s*(a-r)/o;n===D.HORZ?(t.style.width=e+`px`,t.style.left=i+`px`):(t.style.height=e+`px`,t.style.top=i+`px`),t.style.display=`block`}else t.style.display=`none`;n===D.HORZ?t.style.bottom=`0px`:t.style.right=`0px`}},[n,r,i,C,w,S]),j=g.useCallback((e=!1)=>{let t=k(),n=t.length>0;n!==u&&d(n),e?l(t):h.current===void 0&&(h.current=setTimeout(()=>{let e=k();pt(e,_.current)||l(e),h.current=void 0},100))},[k,u]),M=g.useCallback(()=>{let n=t.getSelectedNode();if(n&&r.current){let t=e.getBoundingClientRect(r.current),i=r.current.ownerDocument.getElementById(be(`flexlayout-tabbutton-`,n.getId()));if(!i)return;let a=e.getBoundingClientRect(i),o=E(t)-E(a);o>0||T(a)>T(t)?(x(S(r.current)-o),y.current=!0):(o=O(a)-O(t),o>0&&(x(S(r.current)+o),y.current=!0))}},[t,e,r,E,O,T,S,x]),N=g.useCallback(()=>{if(r.current){let e=r.current,t=0;for(let n of Array.from(e.children))t+=C(n);if(s?.current){let e=C(s.current);e>0&&(b.current=e)}let n=b.current,i=t+(f?n:0)>C(r.current);i!==f&&p(i)}},[r,s,f,C]),P=g.useCallback(()=>{y.current||(m.current=!0),y.current=!1,A(),j()},[A,j]),F=g.useCallback((e,t)=>{if(r.current&&i.current){let a=r.current,o=i.current,s=C(a),c=w(a),l=C(o),u=a.getBoundingClientRect(),d;if(d=n===D.HORZ?e-u.x-v.current:t-u.y-v.current,d=Math.max(0,Math.min(c-l,d)),s>0){let e=d*c/s;x(e)}}},[r,i,n,C,w,x]),I=g.useCallback(()=>{},[]),ee=g.useCallback(()=>{},[]),te=g.useCallback(e=>{e.stopPropagation(),i.current.setPointerCapture(e.pointerId);let t=i.current.getBoundingClientRect();n===D.HORZ?v.current=e.clientX-t.x:v.current=e.clientY-t.y,je(e.currentTarget.ownerDocument,e,F,I,ee)},[i,n,F,I,ee]),ne=g.useCallback(e=>{if(!r.current||t.getChildren().length===0)return;let i=Math.abs(e.deltaX),a=Math.abs(e.deltaY);if(i===0&&a===0)return;let o;o=n===D.HORZ?i>a?e.deltaX:e.deltaY:a>i?e.deltaY:e.deltaX,e.deltaMode===1&&(o*=40);let s=w(r.current)-C(r.current);if(s<=0)return;let c=S(r.current)+o;x(Math.max(0,Math.min(s,c))),e.stopPropagation()},[t,r,n,S,w,C,x]),re=g.useCallback(e=>{let t=r.current;t&&(w(t)-C(t)<=0||e.preventDefault())},[r,w,C]),ie=t.getId(),ae=t.getSelectedNode();return g.useLayoutEffect(()=>{r.current&&x(0)},[ie,r,x]),g.useLayoutEffect(()=>{m.current=!1},[ae]),g.useLayoutEffect(()=>{N(),m.current===!1&&M(),A(),j(!0);let e=requestAnimationFrame(()=>{j()});return()=>cancelAnimationFrame(e)},[N,M,A,j,n,ae]),g.useLayoutEffect(()=>{let t=r.current;if(!t)return;let n=t.ownerDocument.defaultView,i=new n.ResizeObserver(()=>{N();let t=e.isSplitterDragging();(!m.current||t)&&(t&&(m.current=!1),M()),A(),j()});i.observe(t);let a=t.firstElementChild,o=new n.MutationObserver(()=>{j()});return a&&o.observe(a,{childList:!0,subtree:!0}),()=>{i.disconnect(),o.disconnect()}},[N,M,A,j,r,e]),g.useLayoutEffect(()=>{let e=s?.current;if(!e)return;let t=new e.ownerDocument.defaultView.ResizeObserver(()=>{N()});return t.observe(e),()=>t.disconnect()},[N,s,f]),g.useEffect(()=>{if(t instanceof R&&t.isEnableTabWrap())return;let e=a.current;return e?.addEventListener(`wheel`,re,{passive:!1}),()=>{e?.removeEventListener(`wheel`,re)}}),{userControlledPositionRef:m,onScroll:P,onScrollPointerDown:te,hiddenTabs:c,onMouseWheel:ne,isDockStickyButtons:f,isShowHiddenTabs:u}};function pt(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}var mt=e=>{let{borderNode:t,controller:n,size:r}=e,i=g.useRef(null),a=g.useRef(null),o=g.useRef(null),s=g.useRef(null),c=g.useRef(null),l=g.useRef(null),[u,d]=g.useState(!1),f=g.useRef(null),p=n.getIcons();g.useEffect(()=>()=>f.current?.(),[]);let{userControlledPositionRef:m,onScroll:h,onScrollPointerDown:v,hiddenTabs:y,onMouseWheel:b,isDockStickyButtons:x,isShowHiddenTabs:S}=ft(n,t,D.flip(t.getOrientation()),l,o,i,n.getClassName(A.FLEXLAYOUT__BORDER_BUTTON),c),C=g.useCallback(e=>{i.current=e,n.registerMeasurable(t,`borderheader`,e)},[n,t]),w=e=>{De(e)&&n.auxMouseClick(t,e)},T=e=>{n.showContextMenu(t,e)},E=e=>{e.stopPropagation()},k=e=>{let r=n.getShowOverflowMenu(),i=t.getTabNodes(),a=y.map(e=>({index:e,node:i[e]}));if(r!==void 0)r(t,e,a,M);else{let e=s.current;d(!0),f.current=dt(e,t,a,M,n,()=>{d(!1),f.current=null})}e.stopPropagation()},M=e=>{n.doAction(j.selectTab(e.node.getId())),m.current=!1},N=e=>{let r=t.getSelectedNode();r!==void 0&&n.doAction(j.popoutTab(r.getId(),`window`)),e.stopPropagation()},P=e=>{let r=t.getSelectedNode();r!==void 0&&n.doAction(j.popoutTab(r.getId(),`float`)),e.stopPropagation()},F=n.getClassName,I=()=>{let e=[],r=n.getModel().getTabGroupType()===`splitpill`,i=0,a=!1,o=0,s=()=>(0,_.jsx)(`div`,{className:F(A.FLEXLAYOUT__BORDER_TAB_DIVIDER)},`divider`+o++),c=t.getLocation()===O.LEFT&&n.getModel().getBorderLeftTabDirection()!==`down`;for(let o of t.getChildren()){if(o instanceof V){let l=o.getChildren();if(c&&o.isOpened()){a&&e.push(s()),r&&e.push((0,_.jsx)(nt,{controller:n,groupNode:o,path:o.getPath()+`/end`},o.getId()+`/end`));let c=i;for(let r=l.length-1;r>=0;r--){let i=t.getSelected()===c+r;r<l.length-1&&e.push(s()),e.push((0,_.jsx)(et,{controller:n,border:t.getLocation().getName(),tabNode:l[r],path:xe(l[r]),selected:i,icons:p},l[r].getId()))}i+=l.length,e.push((0,_.jsx)(tt,{controller:n,groupNode:o,path:o.getPath()},o.getId())),a=!0}else if(a&&e.push(s()),e.push((0,_.jsx)(tt,{controller:n,groupNode:o,path:o.getPath()},o.getId())),a=!0,o.isOpened()){for(let r=0;r<l.length;r++){let a=t.getSelected()===i;r>0&&e.push(s()),e.push((0,_.jsx)(et,{controller:n,border:t.getLocation().getName(),tabNode:l[r],path:xe(l[r]),selected:a,icons:p},l[r].getId())),i++}r&&e.push((0,_.jsx)(nt,{controller:n,groupNode:o,path:o.getPath()+`/end`},o.getId()+`/end`))}continue}let l=o,u=t.getSelected()===i;a&&e.push(s()),e.push((0,_.jsx)(et,{controller:n,border:t.getLocation().getName(),tabNode:l,path:xe(l),selected:u,icons:p},l.getId())),a=!0,i++}return e},ee=()=>{let e,r=[],i=[],o,l={leading:e,buttons:r,stickyButtons:i,overflowPosition:void 0};if(n.customizeTabSet(t,l),e=l.leading,i=l.stickyButtons,r=l.buttons,l.overflowPosition===void 0&&(l.overflowPosition=i.length),i.length>0&&(x?r=[...i,...r]:o=(0,_.jsx)(`div`,{ref:c,onPointerDown:E,onDragStart:e=>{e.preventDefault()},className:F(A.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:i},`sticky_buttons_container`)),S){let e=n.i18nName(G.Overflow_Menu_Tooltip),i;if(typeof p.more==`function`){let e=t.getTabNodes(),n=y.map(t=>({index:t,node:e[t]}));i=p.more(t,n)}else i=(0,_.jsxs)(_.Fragment,{children:[p.more,(0,_.jsx)(`div`,{className:F(A.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:y.length>0?y.length:``})]});r.splice(Math.min(l.overflowPosition,r.length),0,(0,_.jsx)(`button`,{tabIndex:0,"aria-haspopup":`menu`,"aria-expanded":u,"aria-label":e,ref:s,className:F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+` `+F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+t.getLocation().getName()),title:e,onClick:k,onPointerDown:E,children:i},`overflowbutton`))}if(t.getSelected()!==-1){let e=t.getSelectedNode();if(e!==void 0&&n.isMainLayout()){if(e.isEnableFloat()&&e.isEnableFloatIcon()){let t=n.i18nName(G.Popout_Tab_Float);r.push((0,_.jsx)(`button`,{tabIndex:0,title:t,"aria-label":t,className:F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:P,onPointerDown:E,children:typeof p.popoutFloat==`function`?p.popoutFloat(e):p.popoutFloat},`popout-float`))}if(n.isSupportsPopout()&&e.isEnablePopoutIcon()&&e.isAllowedInWindow()){let t=n.i18nName(G.Popout_Tab);r.push((0,_.jsx)(`button`,{tabIndex:0,title:t,"aria-label":t,className:F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+` `+F(A.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:N,onPointerDown:E,children:typeof p.popout==`function`?p.popout(e):p.popout},`popout`))}}}let d=(0,_.jsx)(`div`,{ref:a,className:F(A.FLEXLAYOUT__BORDER_TOOLBAR)+` `+F(A.FLEXLAYOUT__BORDER_TOOLBAR_+t.getLocation().getName()),children:r},`toolbar`);return{leading:e,toolbar:d,stickyBar:o}},te=I(),{leading:ne,toolbar:re,stickyBar:ie}=ee(),ae=F(A.FLEXLAYOUT__BORDER)+` `+F(A.FLEXLAYOUT__BORDER_+t.getLocation().getName());t.getClassName()!==void 0&&(ae+=` `+t.getClassName());let oe,se,L=r-1;t.getLocation()===O.LEFT?(oe=n.getModel().getBorderLeftTabDirection()===`down`?{left:`100%`,top:0}:{right:`100%`,top:0},se={width:L,overflowY:`auto`}):t.getLocation()===O.RIGHT?(oe={left:`100%`,top:0},se={width:L,overflowY:`auto`}):(oe={left:0},se={height:L,overflowX:`auto`});let ce;t.isEnableTabScrollbar()&&(ce=(0,_.jsx)(`div`,{ref:o,"aria-hidden":`true`,className:F(A.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:v}));let le;ne&&(le=(0,_.jsx)(`div`,{className:F(A.FLEXLAYOUT__BORDER_LEADING),children:ne}));let ue=F(A.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+` `+F(A.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+t.getLocation().getName())+(t.getLocation()===O.LEFT&&n.getModel().getBorderLeftTabDirection()===`down`?` `+F(A.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_LEFT_DOWN):``);return(0,_.jsxs)(`div`,{ref:C,style:{display:`flex`,flexDirection:t.getOrientation()===D.VERT?`row`:`column`},className:ae,"data-layout-path":t.getPath(),onClick:w,onAuxClick:w,onContextMenu:T,onWheel:b,children:[le,(0,_.jsxs)(`div`,{className:F(A.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,_.jsxs)(`div`,{ref:l,className:F(A.FLEXLAYOUT__BORDER_INNER)+` `+F(A.FLEXLAYOUT__BORDER_INNER_+t.getLocation().getName()),style:se,onScroll:h,children:[(0,_.jsx)(`div`,{style:oe,role:n.getEditingTab()?.getParent()===t?void 0:`tablist`,"aria-orientation":n.getEditingTab()?.getParent()!==t&&(t.getLocation()===O.LEFT||t.getLocation()===O.RIGHT)?`vertical`:void 0,className:ue,children:te}),ie]}),ce]}),re]})};mt.displayName=`BorderTabSet`;var ht=e=>{let{controller:t,node:n,index:r,horizontal:i}=e,a=g.useRef(null),o=g.useRef([]),s=g.useRef(void 0),c=g.useRef(void 0),l=g.useRef(0),u=g.useRef(0),d=g.useRef({initialSizes:[],sum:0,startPosition:0}),f=g.useRef(void 0),p=g.useCallback(e=>{e.preventDefault(),e.stopImmediatePropagation()},[]);g.useEffect(()=>{let e=a.current;return e?.addEventListener(`touchstart`,p,{passive:!1}),()=>{e?.removeEventListener(`touchstart`,p),f.current!==void 0&&(clearTimeout(f.current),f.current=void 0),s.current&&(t.getRootDiv()?.removeChild(s.current),s.current=void 0,Oe(!0,t.getCurrentDocument()),t.setSplitterDragging(!1))}},[p,t]);let m=e=>{e.stopPropagation(),n instanceof z&&(d.current=n.getSplitterInitials(r)),t.setSplitterDragging(!0),Oe(!1,t.getCurrentDocument()),je(e.currentTarget.ownerDocument,e,y,b,v),o.current=n instanceof U?n.getSplitterBounds(!0):n.getSplitterBounds(r);let f=t.getRootDiv();s.current=t.getCurrentDocument().createElement(`div`),s.current.style.flexDirection=i?`row`:`column`,s.current.className=t.getClassName(A.FLEXLAYOUT__SPLITTER_DRAG)+(n instanceof U?` `+t.getClassName(A.FLEXLAYOUT__SPLITTER_BORDER):``),s.current.style.cursor=n.getOrientation()===D.VERT?`ns-resize`:`ew-resize`,c.current=t.getCurrentDocument().createElement(`div`),c.current.className=C(A.FLEXLAYOUT__SPLITTER_HANDLE)+` `+C(i?A.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:A.FLEXLAYOUT__SPLITTER_HANDLE_VERT),s.current.appendChild(c.current);let p=a.current.getBoundingClientRect(),m=new E(p.x-t.getDomRect().x,p.y-t.getDomRect().y,p.width,p.height);l.current=e.clientX-p.x,u.current=e.clientY-p.y,m.positionElement(s.current),f&&f.appendChild(s.current)},h=e=>{if(Ce(e))return;let a=0;if(i?(e.key===`ArrowLeft`&&(a=-10),e.key===`ArrowRight`&&(a=10)):(e.key===`ArrowUp`&&(a=-10),e.key===`ArrowDown`&&(a=10)),a!==0){if(e.preventDefault(),t.setSplitterDragging(!0),n instanceof U){let e=n.getLocation(),r=e===O.BOTTOM||e===O.RIGHT?-a:a,i=Math.max(n.getMinSize(),Math.min(n.getMaxSize(),n.getSize()+r));t.doAction(j.adjustBorderSplit(n.getId(),i))}else{let e=n.getSplitterInitials(r);if(e.sum<=0){t.setSplitterDragging(!1);return}let i=n.getSplitterBounds(r),o=Math.max(i[0],Math.min(i[1],e.startPosition+a)),s=n.calculateSplit(r,o,e.initialSizes,e.sum,e.startPosition);t.doAction(j.adjustWeights(n.getId(),s))}setTimeout(()=>t.setSplitterDragging(!1),300)}},v=()=>{if(s.current){t.isRealtimeResize()&&x(!1);let e=t.getRootDiv();e&&s.current&&e.removeChild(s.current),s.current=void 0}f.current=window.setTimeout(()=>t.setSplitterDragging(!1),300),Oe(!0,t.getCurrentDocument())},y=(e,r)=>{if(s.current){let i=t.getDomRect();if(!i)return;n.getOrientation()===D.VERT?s.current.style.top=S(r-i.y-u.current)+`px`:s.current.style.left=S(e-i.x-l.current)+`px`,t.isRealtimeResize()&&x(!0)}},b=()=>{if(s.current){x(!1);let e=t.getRootDiv();e&&s.current&&e.removeChild(s.current),s.current=void 0}f.current=window.setTimeout(()=>t.setSplitterDragging(!1),300),Oe(!0,t.getCurrentDocument())},x=e=>{(()=>{if(s.current){let i;if(i=n.getOrientation()===D.VERT?s.current.offsetTop:s.current.offsetLeft,n instanceof U){let r=n.calculateSplit(n,i);t.doAction(j.adjustBorderSplit(n.getId(),r).setAdjusting(e))}else{let a=d.current;if(a.sum<=0)return;let o=n.calculateSplit(r,i,a.initialSizes,a.sum,a.startPosition);t.doAction(j.adjustWeights(n.getId(),o).setAdjusting(e))}}})()},S=e=>{let t=o.current,n=e;return e<t[0]&&(n=t[0]),e>t[1]&&(n=t[1]),n},C=t.getClassName,w={cursor:i?`ew-resize`:`ns-resize`,flexDirection:i?`column`:`row`},T=C(A.FLEXLAYOUT__SPLITTER)+` `+C(A.FLEXLAYOUT__SPLITTER_+n.getOrientation().getName());n instanceof U?T+=` `+C(A.FLEXLAYOUT__SPLITTER_BORDER):n.getModel().getMaximizedTabset(t.getLayoutId())!==void 0&&(w.display=`none`),ve()||(w[`--fl-splitter-active-size`]=`30px`);let k,M,N,P;if(n instanceof z){let e=n.getRect(),t=n.getChildren()[r-1],a=i?e.width:e.height;if(t&&a>0){let n=t.getRect();k=Math.round((i?n.getRight()-e.x:n.getBottom()-e.y)/a*100),M=0,N=100,P=k+`%`}}else k=Math.round(n.getSize()),M=Math.round(n.getMinSize()),N=Math.round(n.getMaxSize()),P=k+`px`;return(0,_.jsx)(`div`,{className:T,style:w,ref:a,role:`separator`,"aria-label":t.i18nName(G.Splitter),"aria-orientation":i?`vertical`:`horizontal`,"aria-valuenow":k,"aria-valuemin":M,"aria-valuemax":N,"aria-valuetext":P,tabIndex:0,onKeyDown:h,"data-layout-path":n.getPath()+`/s`+(r-1),onPointerDown:m,children:(0,_.jsx)(`div`,{className:C(A.FLEXLAYOUT__SPLITTER_HANDLE)+` `+C(i?A.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:A.FLEXLAYOUT__SPLITTER_HANDLE_VERT)})})};ht.displayName=`Splitter`;function gt(e){let{controller:t,borderNode:n,show:r}=e,i=g.useRef(null),a=g.useCallback(e=>{i.current=e,t.registerMeasurable(n,`bordercontent`,e)},[t,n]),o=!0,s={};n.getOrientation()===D.HORZ?(s.width=n.getSize(),s.minWidth=n.getMinSize(),s.maxWidth=n.getMaxSize()):(s.height=n.getSize(),s.minHeight=n.getMinSize(),s.maxHeight=n.getMaxSize(),o=!1);let c=t.getClassName(A.FLEXLAYOUT__BORDER_TAB_CONTENTS),l=n.getLocation()===O.LEFT||n.getLocation()===O.TOP;if(n.isOverlay()){s.display=`flex`;let e={display:r?`flex`:`none`};if(o){let r=t.getModel();for(let t of r.getBorderSet().getBorders())if(t!==n&&t.isOverlay()&&t.isShowing()&&t.getSelected()!==-1){let n=t.getSize()+r.getSplitterSize();t.getLocation()===O.TOP?e.top=n:t.getLocation()===O.BOTTOM&&(e.bottom=n)}}let i=t.getClassName(A.FLEXLAYOUT__BORDER_TAB_OVERLAY)+` `+t.getClassName(A.FLEXLAYOUT__BORDER_TAB_OVERLAY_+n.getLocation().getName());return(0,_.jsxs)(`div`,{className:i,style:e,children:[l&&(0,_.jsx)(`div`,{ref:a,style:s,className:c}),r&&(0,_.jsx)(ht,{controller:t,node:n,index:0,horizontal:o}),!l&&(0,_.jsx)(`div`,{ref:a,style:s,className:c})]})}return s.display=r?`flex`:`none`,l?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{ref:a,style:s,className:c}),r&&(0,_.jsx)(ht,{controller:t,node:n,index:0,horizontal:o})]}):(0,_.jsxs)(_.Fragment,{children:[r&&(0,_.jsx)(ht,{controller:t,node:n,index:0,horizontal:o}),(0,_.jsx)(`div`,{ref:a,style:s,className:c})]})}gt.displayName=`BorderTab`;var _t=({controller:e,inner:t})=>{let n=e.getClassName(A.FLEXLAYOUT__LAYOUT_MAIN),r=e.getModel().getBorderSet().getBorderMap();if(e.isMainLayout()&&r.size>0){let i=(0,_.jsx)(`div`,{className:n,ref:e.getMainRef(),children:t}),a=new Map,o=new Map;for(let[t,n]of O.values){let t=r.get(n);t&&t.isShowing()&&(!t.isAutoHide()||t.isAutoHide()&&(t.getChildren().length>0||e.getState().showHiddenBorder===n))&&(a.set(n,(0,_.jsx)(mt,{controller:e,borderNode:t,size:e.getState().calculatedBorderBarSize})),o.set(n,(0,_.jsx)(gt,{controller:e,borderNode:t,show:t.getSelected()!==-1})))}let s=e.getClassName(A.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),c=e.getClassName(A.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER),l=(0,_.jsxs)(`div`,{className:c,style:{flexDirection:`column`},children:[o.get(O.TOP),(0,_.jsxs)(`div`,{className:c,style:{flexDirection:`row`},children:[o.get(O.LEFT),i,o.get(O.RIGHT)]}),o.get(O.BOTTOM)]});return(0,_.jsxs)(`div`,{className:s,style:{flexDirection:`column`},children:[a.get(O.TOP),(0,_.jsxs)(`div`,{className:c,style:{flexDirection:`row`},children:[a.get(O.LEFT),l,a.get(O.RIGHT)]}),a.get(O.BOTTOM)]})}return(0,_.jsx)(`div`,{className:n,ref:e.getMainRef(),style:{position:`absolute`,top:0,left:0,bottom:0,right:0,display:`flex`},children:t})};_t.displayName=`BorderContainer`;var vt={width:`1em`,height:`1em`,display:`flex`,alignItems:`center`},yt=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 24 24`,children:[(0,_.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,_.jsx)(`path`,{stroke:`var(--fl-color-icon)`,fill:`var(--fl-color-icon)`,d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`})]});yt.displayName=`CloseIcon`;var bt=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,_.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,_.jsx)(`path`,{transform:`rotate(45 12 12)`,d:`M16 9V4h1a1 1 0 000-2H7a1 1 0 000 2h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z`})]});bt.displayName=`PinIcon`;var xt=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,_.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,_.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z`})]});xt.displayName=`MaximizeIcon`;var St=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,_.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,_.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M7 10l5 5 5-5z`})]});St.displayName=`OverflowIcon`;var Ct=()=>(0,_.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:{display:`block`,width:10,height:10},preserveAspectRatio:`none`,viewBox:`0 0 100 100`,children:(0,_.jsx)(`path`,{fill:`var(--fl-color-edge-icon)`,stroke:`var(--fl-color-edge-icon)`,d:`M10 30 L90 30 l-40 40 Z`})});Ct.displayName=`EdgeIcon`;var wt=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 20 20`,fill:`var(--fl-color-icon)`,children:[(0,_.jsx)(`path`,{d:`M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z`}),(0,_.jsx)(`path`,{d:`M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z`})]});wt.displayName=`PopoutIcon`;var Tt=()=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 -960 960 960`,style:vt,fill:`var(--fl-color-icon)`,children:(0,_.jsx)(`path`,{d:`M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z`})});Tt.displayName=`PopoutFloatIcon`;var Et=()=>(0,_.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,style:vt,fill:`var(--fl-color-icon)`,children:(0,_.jsx)(`path`,{d:`M4 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm6-12a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm6-12a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 6a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z`})});Et.displayName=`GripIcon`;var Dt=()=>(0,_.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,viewBox:`0 0 24 24`,fill:`var(--fl-color-icon)`,children:[(0,_.jsx)(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),(0,_.jsx)(`path`,{stroke:`var(--fl-color-icon)`,d:`M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z`})]});Dt.displayName=`RestoreIcon`;var Ot=()=>(0,_.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,style:vt,height:`24px`,viewBox:`0 -960 960 960`,width:`24px`,children:(0,_.jsx)(`path`,{fill:`var(--fl-color-icon)`,stroke:`var(--fl-color-icon)`,d:`M440-120v-264L254-197l-57-57 187-186H120v-80h264L197-706l57-57 186 187v-264h80v264l186-187 57 57-187 186h264v80H576l187 186-57 57-186-187v264h-80Z`})});Ot.displayName=`AsterickIcon`;var kt=e=>{let{controller:t,tabNode:n,selected:r,path:i}=e,a=g.useRef(null),o=g.useRef(null),s=t.getIcons(),c=t.getKeyMap(),l=t.getEditingTab()===n,u=g.useCallback(e=>{a.current=e,t.registerMeasurable(n,`tabbutton`,e)},[t,n]);g.useLayoutEffect(()=>{l&&o.current.select()},[l]),g.useEffect(()=>{if(l){let e=t.getCurrentDocument().body,n=e=>{e.target!==o.current&&t.setEditingTab(void 0)};return e.addEventListener(`pointerdown`,n),()=>e.removeEventListener(`pointerdown`,n)}},[l,t]);let d=e=>{n.isEnableDrag()?(e.stopPropagation(),t.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},f=e=>{t.getDragDropManager().onDragEnded()},p=e=>{De(e)&&t.auxMouseClick(n,e)},m=e=>{t.showContextMenu(n,e)},h=()=>{n.isSelected()||t.doAction(j.selectTab(n.getId()))},v=e=>{let t=a.current?.closest(`[role="tablist"]`);if(t){let n=Array.from(t.querySelectorAll(`[role="tab"]`));n[n.indexOf(a.current)+e]?.focus()}},y=()=>{let e=a.current.ownerDocument,t=()=>Ee(e.getElementById(be(`flexlayout-tab-`,n.getId())));r?t():(h(),requestAnimationFrame(t))},b=e=>{l||(Se(e,c.focusTabToggle)?(y(),e.preventDefault()):e.key===`Enter`||e.key===` `?(r?y():h(),e.preventDefault()):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&!Ce(e)?(v(-1),e.preventDefault()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&!Ce(e)?(v(1),e.preventDefault()):Se(e,c.closeTab)&&n.isCloseable()?(v(1),t.doAction(j.deleteTab(n.getId())),e.preventDefault()):Se(e,c.renameTab)&&n.isEnableRename()&&(S(),e.preventDefault()))},x=e=>{n.isEnableRename()&&(S(),e.stopPropagation())},S=()=>{t.setEditingTab(n)},C=()=>{let e=n.getCloseType();return!!(r||e===F.Always||e===F.Visible&&t.getCurrentWindow()?.matchMedia(`(hover: hover) and (pointer: fine)`).matches)},w=e=>{C()&&(t.doAction(j.deleteTab(n.getId())),e.stopPropagation())},T=e=>{e.stopPropagation()},E=e=>{e.stopPropagation()},D=e=>{e.code===`Escape`?(t.setEditingTab(void 0),a.current?.focus()):(e.code===`Enter`||e.code===`NumpadEnter`)&&(t.setEditingTab(void 0),t.doAction(j.renameTab(n.getId(),e.target.value)),a.current?.focus())},O=t.getClassName,k=n.getTabContainer(),M=n.getParent()instanceof V?n.getParent():void 0,N=k.isEnableSingleTabStretch()&&k.getChildren().length===1&&k.getChildren()[0]===n,P=N?A.FLEXLAYOUT__TAB_BUTTON_STRETCH:A.FLEXLAYOUT__TAB_BUTTON,I=O(P);I+=` `+O(P+`_`+k.getTabLocation()),N||(I+=r?` `+O(P+`--selected`):` `+O(P+`--unselected`)),n.isPinned()&&(I+=` `+O(P+`--pinned`)),M!==void 0&&(I+=` `+O(A.FLEXLAYOUT__TAB_BUTTON_GROUPED),n.getModel().getTabGroupType()===`underline`&&(I+=` `+O(A.FLEXLAYOUT__TAB_BUTTON_GROUPED_UNDERLINE))),n.getClassName()!==void 0&&(I+=` `+n.getClassName());let ee=ye(t,n),te=r||k.getSelectedNode()===void 0&&k.getTabNodes()[0]===n,ne=[Te(c.focusTabToggle),n.isCloseable()?Te(c.closeTab):void 0,n.isEnableRename()?Te(c.renameTab):void 0].filter(Boolean).join(` `)||void 0,re=ee.content?(0,_.jsx)(`div`,{className:O(A.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:ee.content}):null,ie=ee.leading?(0,_.jsx)(`div`,{className:O(A.FLEXLAYOUT__TAB_BUTTON_LEADING),children:ee.leading}):null;if(l&&(re=(0,_.jsx)(`input`,{ref:o,className:O(A.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":i+`/textbox`,type:`text`,"aria-label":t.i18nName(G.Rename_Tab),autoFocus:!0,defaultValue:n.getName(),onKeyDown:D,onPointerDown:E})),n.isPinned()){let e=t.i18nName(G.Pinned_Tab);ee.buttons.push((0,_.jsx)(`div`,{"data-layout-path":i+`/button/pin`,title:e,"aria-hidden":`true`,className:O(A.FLEXLAYOUT__TAB_BUTTON_PIN),children:typeof s.pin==`function`?s.pin(n):s.pin},`pin`))}if(n.isCloseable()&&!N){let e=t.i18nName(G.Close_Tab);ee.buttons.push((0,_.jsx)(`div`,{"data-layout-path":i+`/button/close`,title:e,"aria-hidden":`true`,className:O(A.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:T,onClick:w,children:typeof s.close==`function`?s.close(n):s.close},`close`))}let ae={};return M!==void 0&&(ae[`--flexlayout-group-color`]=M.getColor()),(0,_.jsxs)(`div`,{ref:u,id:be(`flexlayout-tabbutton-`,n.getId()),role:l?void 0:`tab`,"aria-selected":l?void 0:r,"aria-controls":l?void 0:be(`flexlayout-tab-`,n.getId()),"aria-label":l?void 0:n.isPinned()?ee.name+` (`+t.i18nName(G.Pinned_Tab)+`)`:ee.name,"aria-keyshortcuts":l?void 0:ne,tabIndex:l?-1:te?0:-1,onKeyDown:b,"data-layout-path":i,className:I,style:ae,onClick:h,onAuxClick:p,onContextMenu:m,title:n.getHelpText(),draggable:!0,onDragStart:d,onDragEnd:f,onDoubleClick:x,children:[ie,re,ee.buttons]})};kt.displayName=`TabButton`;var At=e=>{let{tabsetNode:t,controller:n}=e,r=g.useRef(null),i=g.useRef(null),a=g.useRef(null),o=g.useRef(null),s=g.useRef(null),c=g.useRef(null),l=g.useRef(null),u=g.useRef(null),[d,f]=g.useState(!1),p=g.useRef(null),m=n.getIcons();g.useEffect(()=>()=>p.current?.(),[]);let{userControlledPositionRef:h,onScroll:y,onScrollPointerDown:b,hiddenTabs:x,onMouseWheel:S,isDockStickyButtons:C,isShowHiddenTabs:w}=ft(n,t,D.HORZ,o,a,i,n.getClassName(A.FLEXLAYOUT__TAB_BUTTON),u),T=g.useCallback(e=>{r.current=e,n.registerMeasurable(t,`tabset`,e)},[n,t]),E=g.useCallback(e=>{i.current=e,n.registerMeasurable(t,`tabstrip`,e)},[n,t]),O=g.useCallback(e=>{s.current=e,n.registerMeasurable(t,`tabsetcontent`,e)},[n,t]),k=e=>{let r=n.getShowOverflowMenu(),i=t.getTabNodes(),a=x.map(e=>({index:e,node:i[e]}));if(r!==void 0)r(t,e,a,M);else{let e=l.current;f(!0),p.current=dt(e,t,a,M,n,()=>{f(!1),p.current=null})}e.stopPropagation()},M=e=>{n.doAction(j.selectTab(e.node.getId())),h.current=!1},N=e=>{n.getEditingTab()?e.preventDefault():t.isEnableDrag()?(e.stopPropagation(),n.getDragDropManager().setDragNode(e.nativeEvent,t)):e.preventDefault()},P=e=>{n.getDragDropManager().onDragEnded()},F=e=>{!De(e)&&!t.isActive()&&n.doAction(j.setActiveTabset(t.getId(),n.getLayoutId()))},I=e=>{De(e)&&n.auxMouseClick(t,e)},ee=e=>{n.showContextMenu(t,e)},te=e=>{e.stopPropagation()},ne=e=>{t.canMaximize()&&n.maximize(t),e.stopPropagation()},re=e=>{n.doAction(j.deleteTabset(t.getId())),e.stopPropagation()},ie=e=>{n.doAction(j.deleteTab(t.getChildren()[0].getId())),e.stopPropagation()},ae=e=>{ce!==void 0&&n.doAction(j.popoutTab(ce.getId(),`window`)),e.stopPropagation()},oe=e=>{ce!==void 0&&n.doAction(j.popoutTab(ce.getId(),`float`)),e.stopPropagation()},se=e=>{t.canMaximize()&&n.maximize(t)},L=n.getClassName,ce=t.getSelectedNode(),le=t.getPath(),ue=t.getChildren(),de=t.isEnableSingleTabStretch()&&ue.length===1&&ue[0]instanceof W,R=(e,n,r,i)=>{let a=L(A.FLEXLAYOUT__TABSET_TAB_SPACER);return i&&(a+=` `+L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER)),!t.isEnableTabWrap()&&!de&&(n?a+=` `+L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_BEFORE):r&&(a+=` `+L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER))),(0,_.jsx)(`div`,{className:a,children:(0,_.jsx)(`div`,{className:L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},`divider`+e)},z=()=>{let e=[],r=n.getModel().getTabGroupType()===`splitpill`,i=0,a=0,o=!1,s=!1,c=!1;if(t.isEnableTabStrip()){for(let l of ue){if(l instanceof V){if(e.push(R(a++,!1,o,c)),e.push((0,_.jsx)(tt,{controller:n,groupNode:l,path:l.getPath()},l.getId())),c=!0,s=!1,l.isOpened()){let u=l.getChildren();for(let r=0;r<u.length;r++){let l=u[r],d=t.getSelected()===i;e.push(R(a++,d,o,r>0)),e.push((0,_.jsx)(kt,{controller:n,tabNode:l,path:xe(l),selected:d},l.getId())),o=d,s=!0,c=!0,i++}r&&(e.push(R(a++,!1,o,!1)),e.push((0,_.jsx)(nt,{controller:n,groupNode:l,path:l.getPath()+`/end`},l.getId()+`/end`)),o=!1)}continue}let u=l,d=t.getSelected()===i;e.push(R(a++,d,o,c)),e.push((0,_.jsx)(kt,{controller:n,tabNode:u,path:xe(u),selected:d},u.getId())),o=d,s=!0,c=!0,i++}if(s){let n=L(A.FLEXLAYOUT__TABSET_TAB_SPACER);!t.isEnableTabWrap()&&!de&&o&&(n+=` `+L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER)),e.push((0,_.jsx)(`div`,{className:n,children:(0,_.jsx)(`div`,{className:L(A.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},`divider`+a))}}return e},B=()=>{let e,r=[],i=[],a={leading:e,stickyButtons:r,buttons:i,overflowPosition:void 0};n.customizeTabSet(t,a),e=a.leading,r=a.stickyButtons,i=a.buttons;let o=de,s=o&&t.getChildren()[0].isCloseable()||t.isCloseable();s&&=t.isEnableCloseButton(),a.overflowPosition===void 0&&(a.overflowPosition=r.length);let f;if(r.length>0&&(!t.isEnableTabWrap()&&(C||o)?i=[...r,...i]:f=(0,_.jsx)(`div`,{ref:u,onPointerDown:te,onDragStart:e=>{e.preventDefault()},className:L(A.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:r},`sticky_buttons_container`)),!t.isEnableTabWrap()&&w){let e=n.i18nName(G.Overflow_Menu_Tooltip),r;if(typeof m.more==`function`){let e=t.getTabNodes(),n=x.map(t=>({index:t,node:e[t]}));r=m.more(t,n)}else r=(0,_.jsxs)(_.Fragment,{children:[m.more,(0,_.jsx)(`div`,{className:L(A.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:x.length>0?x.length:``})]});i.splice(Math.min(a.overflowPosition,i.length),0,(0,_.jsx)(`button`,{tabIndex:0,"data-layout-path":le+`/button/overflow`,"aria-haspopup":`menu`,"aria-expanded":d,"aria-label":e,ref:l,className:L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+L(A.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:e,onClick:k,onPointerDown:te,children:r},`overflowbutton`))}if(ce!==void 0&&!ce.isPinned()){if(ce.isEnableFloat()&&ce.isEnableFloatIcon()){let e=n.i18nName(G.Popout_Tab_Float);i.push((0,_.jsx)(`button`,{tabIndex:0,"data-layout-path":le+`/button/popout-float`,title:e,"aria-label":e,className:L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:oe,onPointerDown:te,children:typeof m.popoutFloat==`function`?m.popoutFloat(ce):m.popoutFloat},`popout-float`))}if(n.isSupportsPopout()&&ce.isAllowedInWindow()&&ce.isEnablePopoutIcon()){let e=n.i18nName(G.Popout_Tab);i.push((0,_.jsx)(`button`,{tabIndex:0,"data-layout-path":le+`/button/popout`,title:e,"aria-label":e,className:L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:ae,onPointerDown:te,children:typeof m.popout==`function`?m.popout(ce):m.popout},`popout`))}}if(t.canMaximize()){let e=n.i18nName(G.Restore),r=n.i18nName(G.Maximize);i.push((0,_.jsx)(`button`,{tabIndex:0,"data-layout-path":le+`/button/max`,title:t.isMaximized()?e:r,"aria-label":t.isMaximized()?e:r,"aria-pressed":t.isMaximized(),className:L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(t.isMaximized()?`max`:`min`)),onClick:ne,onPointerDown:te,children:t.isMaximized()?typeof m.restore==`function`?m.restore(t):m.restore:typeof m.maximize==`function`?m.maximize(t):m.maximize},`max`))}if(!t.isMaximized()&&s){let e=o?n.i18nName(G.Close_Tab):n.i18nName(G.Close_Tabset);i.push((0,_.jsx)(`button`,{tabIndex:0,"data-layout-path":le+`/button/close`,title:e,"aria-label":e,className:L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+` `+L(A.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:o?ie:re,onPointerDown:te,children:typeof m.closeTabset==`function`?m.closeTabset(t):m.closeTabset},`close`))}if(t.isActive()&&t.isEnableActiveIcon()){let e=n.i18nName(G.Active_Tabset);i.push((0,_.jsx)(`div`,{"data-layout-path":le+`/button/active`,title:e,"aria-hidden":`true`,className:L(A.FLEXLAYOUT__TAB_TOOLBAR_ICON),children:typeof m.activeTabset==`function`?m.activeTabset(t):m.activeTabset},`active`))}let p=(0,_.jsx)(`div`,{ref:c,className:L(A.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:te,onDragStart:e=>{e.preventDefault()},children:i},`buttonbar`);return{leading:e,buttonbar:p,stickyBar:f}},fe=(e,r,i,s)=>{let c,l=n.getKeyMap(),u=[Te(l.focusNextTabset),Te(l.focusPreviousTabset)].filter(Boolean).join(` `)||void 0,d=n.getEditingTab()?.getParent()===t,f=d?void 0:`tablist`,p=L(A.FLEXLAYOUT__TABSET_TABBAR_OUTER);t.getClassNameTabStrip()!==void 0&&(p+=` `+t.getClassNameTabStrip()),p+=` `+L(A.FLEXLAYOUT__TABSET_TABBAR_OUTER_+t.getTabLocation()),t.isActive()&&(p+=` `+L(A.FLEXLAYOUT__TABSET_SELECTED)),t.isMaximized()&&(p+=` `+L(A.FLEXLAYOUT__TABSET_MAXIMIZED));let m=de;if(m){let e=t.getChildren()[0];e.getTabSetClassName()!==void 0&&(p+=` `+e.getTabSetClassName())}let h;if(r&&(h=(0,_.jsx)(`div`,{className:L(A.FLEXLAYOUT__TABSET_LEADING),children:r})),t.isEnableTabWrap())t.isEnableTabStrip()&&(c=(0,_.jsxs)(`div`,{className:p,style:{flexWrap:`wrap`,gap:`1px`,marginTop:`2px`},ref:E,"data-layout-path":le+`/tabstrip`,onPointerDown:F,onDoubleClick:se,onContextMenu:ee,onClick:I,onAuxClick:I,draggable:!0,onDragStart:N,onDragEnd:P,children:[h,(0,_.jsx)(`div`,{role:f,"aria-orientation":d?void 0:`horizontal`,"aria-label":d?void 0:t.getName(),"aria-keyshortcuts":d?void 0:u,style:{display:`contents`},children:e}),s,(0,_.jsx)(`div`,{style:{flexGrow:1,display:`flex`,justifyContent:`flex-end`},children:i})]}));else if(t.isEnableTabStrip()){let n;t.isEnableTabScrollbar()&&(n=(0,_.jsx)(`div`,{ref:a,"aria-hidden":`true`,className:L(A.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:b})),c=(0,_.jsxs)(`div`,{className:p,ref:E,"data-layout-path":le+`/tabstrip`,onPointerDown:F,onDoubleClick:se,onContextMenu:ee,onClick:I,onAuxClick:I,draggable:!0,onWheel:S,onDragStart:N,onDragEnd:P,children:[h,(0,_.jsxs)(`div`,{className:L(A.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,_.jsxs)(`div`,{ref:o,className:L(A.FLEXLAYOUT__TABSET_TABBAR_INNER)+` `+L(A.FLEXLAYOUT__TABSET_TABBAR_INNER_+t.getTabLocation()),style:{overflowX:`auto`,overflowY:`hidden`},onScroll:y,children:[(0,_.jsx)(`div`,{style:{width:m?`100%`:`none`},role:f,"aria-orientation":d?void 0:`horizontal`,"aria-label":d?void 0:t.getName(),"aria-keyshortcuts":d?void 0:u,className:L(A.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+` `+L(A.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+t.getTabLocation()),children:e}),s]}),n]}),i]})}return c},pe=e=>{let r;if(t.getTabNodes().length===0){let e=n.getTabSetPlaceHolderCallback();e&&(r=e(t))}let i=(0,_.jsx)(`div`,{ref:O,className:L(A.FLEXLAYOUT__TABSET_CONTENT),children:r});return i=t.getTabLocation()===`top`?(0,_.jsxs)(_.Fragment,{children:[e,i]}):(0,_.jsxs)(_.Fragment,{children:[i,e]}),i},me=z(),{leading:he,buttonbar:H,stickyBar:U}=B(),ge=pe(fe(me,he,H,U)),_e={flexGrow:Math.max(1,t.getWeight()*1e3),minWidth:t.getMinWidth(),minHeight:t.getMinHeight(),maxWidth:t.getMaxWidth(),maxHeight:t.getMaxHeight()};t.getModel().getMaximizedTabset(n.getLayoutId())!==void 0&&!t.isMaximized()&&(_e.display=`none`);let ve=(0,_.jsx)(`div`,{ref:T,className:L(A.FLEXLAYOUT__TABSET_CONTAINER),style:_e,children:(0,_.jsx)(`div`,{className:L(A.FLEXLAYOUT__TABSET),"data-layout-path":le,children:ge})});return t.isMaximized()&&n.getMainElement()?(0,v.createPortal)((0,_.jsx)(`div`,{style:{position:`absolute`,display:`flex`,top:0,left:0,bottom:0,right:0},children:ve}),n.getMainElement()):ve};At.displayName=`TabSet`;var jt=e=>{let{controller:t,rowNode:n}=e,r=g.useRef(null),i=n.getOrientation()===D.HORZ,a=g.useCallback(e=>{r.current=e,t.registerMeasurable(n,`row`,e)},[t,n]),o=[],s=0;for(let e of n.getChildren())s>0&&o.push((0,_.jsx)(ht,{controller:t,node:n,index:s,horizontal:i},`splitter`+s)),e instanceof z?o.push((0,_.jsx)(jt,{controller:t,rowNode:e},e.getId())):e instanceof R&&o.push((0,_.jsx)(At,{controller:t,tabsetNode:e},e.getId())),s++;let c={flexGrow:Math.max(1,n.getWeight()*1e3),minWidth:n.getMinWidth(),minHeight:n.getMinHeight(),maxWidth:n.getMaxWidth(),maxHeight:n.getMaxHeight()};return c.flexDirection=i?`row`:`column`,(0,_.jsx)(`div`,{ref:a,className:t.getClassName(A.FLEXLAYOUT__ROW),style:c,children:o})};jt.displayName=`Row`;var Mt=e=>{let{controller:t,selected:n,tabNode:r}=e,i=g.useRef(null),a=g.useRef(!0),o=g.useCallback(()=>{let e=r.getParent();e instanceof R&&(e.isActive()||t.doAction(j.setActiveTabset(e.getId(),t.getLayoutId())))},[r,t]),s=r.getParent(),c=t.getKeyMap().focusTabToggle,l=e=>{if(Se(e,c)){let t=e.currentTarget.ownerDocument.getElementById(be(`flexlayout-tabbutton-`,r.getId()));t&&(t.focus(),e.preventDefault(),e.stopPropagation())}};g.useLayoutEffect(()=>{let e=r.getMoveableElement(),n=i.current.ownerDocument,a=e.ownerDocument!==n;a&&n.adoptNode(e),e.parentElement!==i.current&&i.current.appendChild(e),a&&t.redrawLayoutAndTabContent();let s=()=>{r.saveScrollPosition()};e.addEventListener(`scroll`,s);let c=i.current;return c&&c.addEventListener(`pointerdown`,o),()=>{c&&c.removeEventListener(`pointerdown`,o),e.removeEventListener(`scroll`,s),e.isConnected||(t.getModel().getNodeById(r.getId())&&(r.isEnableWindowReMount()||t.getMainController()?.getMoveablesHome()?.appendChild(e)),r.setVisible(!1))}},[r,t,o]),g.useEffect(()=>{r.isSelected()&&(a.current&&=(r.restoreScrollPosition(),!1))}),g.useLayoutEffect(()=>(t.registerTabPanel(r,i.current),()=>{t.registerTabPanel(r,null)}),[t,r]);let u=t.getClassName,d=null;if(n&&document.hidden&&r.isEnablePopoutOverlay()){let e={};s.getContentRect().styleWithPosition(e);let t=u(A.FLEXLAYOUT__TAB_OVERLAY);s instanceof U&&s.isOverlay()&&(t+=` `+u(A.FLEXLAYOUT__TAB_OVERLAY_RAISED)),d=(0,_.jsx)(`div`,{style:e,className:t})}let f=u(A.FLEXLAYOUT__TAB);return s instanceof U&&(f+=` `+u(A.FLEXLAYOUT__TAB_BORDER),f+=` `+u(A.FLEXLAYOUT__TAB_BORDER_+s.getLocation().getName()),s.isOverlay()&&(f+=` `+u(A.FLEXLAYOUT__TAB_BORDER_OVERLAY))),r.getContentClassName()!==void 0&&(f+=` `+r.getContentClassName()),(0,_.jsxs)(_.Fragment,{children:[d,(0,_.jsx)(`div`,{ref:i,id:be(`flexlayout-tab-`,r.getId()),role:`tabpanel`,"aria-labelledby":be(`flexlayout-tabbutton-`,r.getId()),"aria-keyshortcuts":Te(c),tabIndex:-1,onKeyDown:c?l:void 0,className:f,"data-layout-path":r.getPath()})]})};Mt.displayName=`Tab`;var Nt=class extends g.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){}retry=()=>{this.setState({hasError:!1})};render(){return this.state.hasError?(0,_.jsx)(`div`,{className:A.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER,children:(0,_.jsx)(`div`,{role:`alert`,className:A.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT,children:(0,_.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`},children:[this.props.message,(0,_.jsx)(`p`,{children:(0,_.jsx)(`button`,{tabIndex:0,onClick:this.retry,children:this.props.retryText})})]})})}):this.props.children}},Pt=g.memo(({controller:e,tabNode:t})=>{let n;if(t.getComponent())n=e.getFactory()(t);else if(t.getSubLayoutId()){let r=t.getModel().getLayouts().get(t.getSubLayoutId());n=(0,_.jsx)(`div`,{className:e.getClassName(A.FLEXLAYOUT__TAB_LAYOUT_CONTAINER),children:(0,_.jsx)(Wt,{...e.getProps(),layoutId:t.getSubLayoutId(),path:t.getPath()+r.getPath(),mainLayoutController:e.getMainController()})})}return(0,_.jsx)(Nt,{message:e.i18nName(G.Error_rendering_component),retryText:e.i18nName(G.Error_rendering_component_retry),children:n})},Ft);Pt.displayName=`TabContentRenderer`;function Ft(e,t){return!t.visible||e.windowId===t.windowId&&e.fullRedrawRevision===t.fullRedrawRevision&&e.parentRedrawRevision===t.parentRedrawRevision&&e.tabNode===t.tabNode&&t.tabNode.getSubLayoutId()===void 0}var It=class e{static dragState=void 0;_controller;_dragEnterCount=0;_dragging=!1;_active=!1;_dropInfo;_outlineDiv;_mainController;constructor(e){this._controller=e,this._mainController=e.getMainController()}isDockTarget(){return this._controller.getLayout().getLayoutId()!==e.dragState?.floatLayoutId}isExcludeCenter(){if(e.dragState?.dockFloatToMain)return!0;let t=e.dragState?.dragNode;return t instanceof R?!t.isEnableClose()||t.getPinnedRunLength()>0:!1}addTabWithDragAndDrop(t,n,r){let i=W.fromJson(n,this._controller.getModel(),!1);e.dragState=new Lt(this._controller.getMainController(),`add`,i,n,r)}onDragEnded(){this.clearDragMain(),e.dragState=void 0}moveTabWithDragAndDrop(e,t){this.setDragNode(e,t)}startDockLayoutDrag(t,n,r){let i=n.getRootRow();e.dragState=new Lt(this._controller.getMainController(),`float`,i,void 0,void 0,!0,n.getLayoutId(),r),t.dataTransfer.setData(`text/plain`,`--flexlayout--`),t.dataTransfer.effectAllowed=`copyMove`,t.dataTransfer.dropEffect=`move`,this._dragEnterCount=0,this._controller.getModel().sortLayouts();let a=0;n.getRootRow()?.forEachNode(e=>{e instanceof W&&a++},0);let o=this._controller.i18nName(G.Dock_Float_Tabs).replace(`?`,String(a)),s=!1;if(this._controller.getProps().onRenderDragRect){let e=this._controller.getProps().onRenderDragRect(o,i,void 0);e&&(this.setDragComponent(t,e,10,10),s=!0)}s||this.setDragComponent(t,o,10,10)}setDragNode=(t,n)=>{if(e.dragState=new Lt(this._controller.getMainController(),`internal`,n,void 0,void 0),t.dataTransfer.setData(`text/plain`,`--flexlayout--`),t.dataTransfer.effectAllowed=`copyMove`,t.dataTransfer.dropEffect=`move`,this._dragEnterCount=0,this._controller.getModel().sortLayouts(),n instanceof R){let e=!1,r=this._controller.i18nName(G.Move_Tabset);if(n.getChildren().length>0&&(r=this._controller.i18nName(G.Move_Tabs).replace(`?`,String(n.getChildren().length))),this._controller.getProps().onRenderDragRect){let i=this._controller.getProps().onRenderDragRect(r,n,void 0);i&&(this.setDragComponent(t,i,10,10),e=!0)}e||this.setDragComponent(t,r,10,10)}else if(n instanceof V){let e=!1,r=this._controller.i18nName(G.Move_Group).replace(`?`,String(n.getChildren().length));if(this._controller.getProps().onRenderDragRect){let i=this._controller.getProps().onRenderDragRect(r,n,void 0);i&&(this.setDragComponent(t,i,10,10),e=!0)}e||this.setDragComponent(t,r,10,10)}else{let e=t.target;if(e&&typeof e.getBoundingClientRect==`function`){let r=e.getBoundingClientRect(),i=t.clientX-r.left,a=t.clientY-r.top,o=n?.getParent(),s=o instanceof U&&o.getOrientation()===D.HORZ,c=s?10:i,l=s?10:a,u=!1;if(this._controller.getProps().onRenderDragRect){let e=(0,_.jsx)(rt,{controller:this._controller,tabNode:n},n.getId()),r=this._controller.getProps().onRenderDragRect(e,n,void 0);r&&(this.setDragComponent(t,r,c,l),u=!0)}u||(Ne()?this.setDragComponent(t,(0,_.jsx)(rt,{tabNode:n,controller:this._controller}),c,l):t.dataTransfer.setDragImage(n.getTabStamp(),c,l))}}};setDragComponent(e,t,n,r){let i=(0,_.jsx)(`div`,{style:{position:`unset`},className:this._controller.getClassName(A.FLEXLAYOUT__LAYOUT)+` `+this._controller.getClassName(A.FLEXLAYOUT__DRAG_RECT),children:t}),a=this._controller.getCurrentDocument(),o=a.createElement(`div`);o.setAttribute(`data-layout-path`,`/drag-rectangle`),o.style.position=`absolute`,o.style.left=`-10000px`,o.style.top=`-10000px`,a.body.appendChild(o);let s=(0,y.createRoot)(o);(0,v.flushSync)(()=>s.render(i)),e.dataTransfer.setDragImage(o,n,r),setTimeout(()=>{s.unmount(),a.body.removeChild(o)},0)}updateActive(t){let n=Array.from(this._controller.getModel().getLayouts().values()),r=e.dragState?.dockFloatToMain===!0,i,a;for(let t=n.length-1;t>=0;t--){let o=n[t];if(r&&o.getLayoutId()===e.dragState?.floatLayoutId)continue;let s=Ut(o)?.getDragDropManager();s&&s.getDragEnterCount()>0&&(o.getType()===`tab`?a=o:!i&&!a&&(i=o))}if(a){let e=a.findParentLayout();(i===e||!i)&&(i=a)}i&&Ut(i).getDragDropManager().setActive(!0,t);for(let e of n)e!==i&&Ut(e)?.getDragDropManager().setActive(!1,t)}setActive(e,t){this._active!==e&&(this._active=e,this._active?this.onDragEnter(t):this.onDragLeave(t))}onDragEnterRaw=e=>{this._dragEnterCount++,this.updateActive(e)};onDragLeaveRaw=e=>{this._dragEnterCount--,this.updateActive(e)};clearDragMain(){this._controller.showOverlayOnAllWindows(!1);for(let[,e]of this._controller.getModel().getLayouts()){let t=Ut(e);t&&t.getDragDropManager().clearDragLocal()}}clearDragLocal(){this._dragEnterCount=0,this._active=!1,this.clearDragLocalVisuals()}clearDragLocalVisuals(){this._controller.setState({showEdges:!1}),this._dragging=!1,this._outlineDiv&&=(this._controller.getRootDiv().removeChild(this._outlineDiv),void 0)}onDragEnter=t=>{if(!e.dragState&&this._controller.getProps().onExternalDrag){let n=this._controller.getProps().onExternalDrag(t);if(n){let t=W.fromJson(n.json,this._controller.getModel(),!1);e.dragState=new Lt(this._controller.getMainController(),`external`,t,n.json,n.onDrop)}}if(this._mainController===e.dragState?.mainLayoutController&&(!e.dragState?.dockFloatToMain||this.isDockTarget())&&e.dragState){t.preventDefault(),this._dropInfo=void 0;let e=this._controller.getRootDiv(),n=this._controller.getCurrentDocument();this._outlineDiv=n.createElement(`div`),this._outlineDiv.className=this._controller.getClassName(A.FLEXLAYOUT__OUTLINE_RECT),this._outlineDiv.style.visibility=`hidden`;let r=this._controller.getTabDragSpeed();this._outlineDiv.style.transition=`top ${r}s, left ${r}s, width ${r}s, height ${r}s`,e.appendChild(this._outlineDiv),this._dragging=!0,this._controller.showOverlayOnAllWindows(!0),this._controller.getModel().getMaximizedTabset(this._controller.getLayoutId())===void 0&&this._controller.setState({showEdges:this._controller.getModel().isEnableEdgeDock()});let i=this._controller.getRootDiv().getBoundingClientRect();new E(t.clientX-i.left,t.clientY-i.top,1,1).positionElement(this._outlineDiv)}};onDragOver=t=>{if(this._mainController===e.dragState?.mainLayoutController&&(!e.dragState?.dockFloatToMain||this.isDockTarget())&&this._active){if(e.dragState?.dockFloatToMain){let n=t.target;if(n&&e.dragState.sourceFloatElement?.contains(n)){this._dropInfo=void 0;return}}let n=this._controller.getRootDiv()?.getBoundingClientRect(),r={x:t.clientX-(n?.left??0),y:t.clientY-(n?.top??0)};e.dragState.dockFloatToMain||this._controller.checkForBorderToShow(r.x,r.y);let i=this._controller.getModel().findDropTargetNode(this._controller.getLayoutId(),e.dragState.dragNode,r.x,r.y,this.isExcludeCenter());if(i){if(e.dragState.dockFloatToMain&&(i.location===O.CENTER||!(i.node instanceof R)&&!(i.node instanceof z)))return;t.preventDefault(),this._dropInfo=i,this._outlineDiv&&(this._outlineDiv.className=this._controller.getClassName(i.className),i.rect.positionElement(this._outlineDiv),this._outlineDiv.style.visibility=`visible`)}}};onDragLeave=t=>{if(this._mainController===e.dragState?.mainLayoutController&&(this.clearDragLocalVisuals(),this._controller.isMainLayout())){let e=!1;for(let[,t]of this._controller.getModel().getLayouts()){let n=Ut(t);if(n&&n.getDragDropManager().isDragging()){e=!0;break}}e===!1&&this.clearDragMain()}};onDrop=t=>{if(this._mainController!==e.dragState?.mainLayoutController){this.clearDragLocal();return}if(!e.dragState?.dockFloatToMain||this.isDockTarget()){if(this._active){t.preventDefault();let n=e.dragState;if(this._dropInfo&&n.dockFloatToMain){let e=t.target;e&&n.sourceFloatElement?.contains(e)&&(this._dropInfo=void 0)}if(this._dropInfo){if(n.dragJson!==void 0){let e=this._controller.doAction(j.addTab(n.dragJson,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));n.fnNewNodeDropped!==void 0&&n.fnNewNodeDropped(e,t)}else n.dragNode!==void 0&&(n.dockFloatToMain?this._controller.doAction(j.dockFloatToLayout(n.floatLayoutId,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index)):this._controller.doAction(j.moveNode(n.dragNode.getId(),this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index)))}this.clearDragMain(),e.dragState=void 0}this._dragEnterCount=0}};getDragEnterCount(){return this._dragEnterCount}isDragging(){return this._dragging}},Lt=class{mainLayoutController;dragSource;dragNode;dragJson;fnNewNodeDropped;dockFloatToMain;floatLayoutId;sourceFloatElement;constructor(e,t,n,r,i,a=!1,o=void 0,s=void 0){this.mainLayoutController=e,this.dragSource=t,this.dragNode=n,this.dragJson=r,this.fnNewNodeDropped=i,this.dockFloatToMain=a,this.floatLayoutId=o,this.sourceFloatElement=s}},Rt=({controller:e})=>{let t=[],n=e.getIcons().edgeArrow;if(e.getState().showEdges&&e.getModel().isEnableEdgeDockIndicators()){let r=e.getModel().getRootRow(e.getLayoutId()).getRect(),i=e.getClassName(A.FLEXLAYOUT__EDGE_RECT);t.push((0,_.jsx)(`div`,{"aria-hidden":`true`,style:{top:0,left:r.width/2-50,width:100,height:10,borderBottomLeftRadius:50,borderBottomRightRadius:50},className:i+` `+e.getClassName(A.FLEXLAYOUT__EDGE_RECT_TOP),children:(0,_.jsx)(`div`,{style:{transform:`rotate(180deg)`},children:n})},`North`)),t.push((0,_.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height/2-50,left:0,width:10,height:100,borderTopRightRadius:50,borderBottomRightRadius:50},className:i+` `+e.getClassName(A.FLEXLAYOUT__EDGE_RECT_LEFT),children:(0,_.jsx)(`div`,{style:{transform:`rotate(90deg)`},children:n})},`West`)),t.push((0,_.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height-10,left:r.width/2-50,width:100,height:10,borderTopLeftRadius:50,borderTopRightRadius:50},className:i+` `+e.getClassName(A.FLEXLAYOUT__EDGE_RECT_BOTTOM),children:(0,_.jsx)(`div`,{children:n})},`South`)),t.push((0,_.jsx)(`div`,{"aria-hidden":`true`,style:{top:r.height/2-50,left:r.width-10,width:10,height:100,borderTopLeftRadius:50,borderBottomLeftRadius:50},className:i+` `+e.getClassName(A.FLEXLAYOUT__EDGE_RECT_RIGHT),children:(0,_.jsx)(`div`,{style:{transform:`rotate(-90deg)`},children:n})},`East`))}return(0,_.jsx)(_.Fragment,{children:t})};Rt.displayName=`EdgeIndicators`;var K=g.memo(e=>{K.displayName=`DragTabButton`;let{controller:t,tabNode:n}=e,r=g.useRef(null);g.useEffect(()=>(n.setTabStamp(r.current),()=>{n.setTabStamp(null)}),[n]);let i=t.getClassName,a=i(A.FLEXLAYOUT__DRAG_RECT);return(0,_.jsx)(`div`,{ref:r,className:a,children:(0,_.jsx)(rt,{controller:t,tabNode:n},n.getId())})},zt);function zt(e,t){return t.dragging}var Bt=class e{static Windows=new WeakMap;_props;_state;_setState;_layoutRef;_moveablesHomeRef;_findBorderBarSizeRef;_findSplitterSizeRef;_mainRef;_orderedTabIds;_orderedTabMoveableIds;_currentDocument;_currentWindow;_showOverlay=!1;_supportsPopout;_popoutURL;_icons;_dragDropManager;_layoutId;_layout;_mainController;_popoutWindowName;_cachedLayoutDOMRect;_reLayout;_measurables=new Map;_tabPanels=new Map;_lastRect=E.empty();_lastSplitterSize=8;_geometryResizeObserver;_splitterDragging=!1;constructor(e,t,n){this._props=e,this._state=t,this._setState=n,this._orderedTabIds=[],this._orderedTabMoveableIds=[],this._supportsPopout=e.supportsPopout===void 0?Ht:e.supportsPopout,this._popoutURL=e.popoutURL?e.popoutURL:`popout.html`,this._icons={...Vt,...e.icons},this._layoutId=e.layoutId?e.layoutId:me.MAIN_LAYOUT_ID,this._mainController=e.mainLayoutController?e.mainLayoutController:this,this._dragDropManager=new It(this),this._layout=e.model.getLayouts().get(this._layoutId),this._layout.setController(this),this._popoutWindowName=e.popoutWindowName,this._reLayout=!1}renderLayout(){return this._cachedLayoutDOMRect=void 0,(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(jt,{controller:this,rowNode:this._props.model.getRootRow(this._layoutId)},`__row__`),(0,_.jsx)(Rt,{controller:this})]})}renderTabContainers(){let e=new Map;return this._props.model.visitLayoutNodes(this._layoutId,t=>{if(t instanceof W){let n=t,r=n.isSelected(),i=n.isRendered(),a=n.isEnableRenderOnDemand();(i||r||!a)&&e.set(n.getId(),(0,_.jsx)(Mt,{controller:this,tabNode:n,selected:r},n.getId()))}}),e}renderTabContents(){let e=new Map;for(let[t,n]of this._props.model.getLayouts())this._props.model.visitLayoutNodes(t,t=>{if(t instanceof W){let r=t,i=r.isSelected(),a=r.isRendered(),o=r.isEnableRenderOnDemand(),s=r.getTabContainer().getContentRect(),c=i||!o;if(a||c&&s.width>0&&s.height>0){let t=r.getMoveableElement();t.style.overflow=r.isEnableScrollbars()?`auto`:`hidden`;let i=n.getWindowId()||``,a=r.getId()+(r.isEnableWindowReMount()?i:``);e.set(r.getId(),(0,v.createPortal)((0,_.jsx)(Pt,{controller:this,tabNode:r,windowId:i,visible:c,fullRedrawRevision:this._state.fullRedrawRevision,parentRedrawRevision:this._props.parentRedrawRevision},a),t,a)),r.setRendered(!0)}}});return e}renderDragTabButtons(){let e=[];return this._props.model.visitNodes(t=>{if(t instanceof W){let n=t;e.push((0,_.jsx)(K,{controller:this,tabNode:n,dragging:Ae},n.getId()))}}),e}redrawLayout(){this._mainController?.setState(e=>({layoutRedrawRevision:e.layoutRedrawRevision+1}))}redrawLayoutAndTabContent(){this._mainController?.setState(e=>({fullRedrawRevision:e.fullRedrawRevision+1}))}doAction(e){if(this._props.onAction!==void 0){let t=this._props.onAction(e);return t===void 0?void 0:this._props.model.doAction(t)}return this._props.model.doAction(e)}updateRect=()=>{if(this._layoutRef.current){let e=this._layoutRef.current;if(!this._layout.isMainLayout()&&this._layout.getType()===`float`){let t=e.closest(`.`+this.getClassName(A.FLEXLAYOUT__FLOAT_WINDOW));t instanceof HTMLDivElement&&(e=t)}let t=E.fromDomRect(e.getBoundingClientRect());if(!this._layout.isMainLayout()&&this._layout.getType()===`float`){let e=this._mainController.getDomRect();t=t.relativeTo(e)}!t.equalsWhenRounded(this._lastRect)&&t.width!==0&&t.height!==0&&(this._lastRect=t,this._layout.setRect(t),this.redrawLayout())}};onModelChange=e=>{let t=e instanceof N?e.actions:[e];for(let e of t)if(e.type==j.DELETE_TAB&&this._state.showHiddenBorder!==O.CENTER){let e=this._props.model.getBorderSet().getBorderMap().get(this._state.showHiddenBorder);if(!e||e.getChildren().length===0){this._setState({showHiddenBorder:O.CENTER});break}}if(e.isAdjusting()&&(e.type===j.ADJUST_WEIGHTS||e.type===j.ADJUST_BORDER_SPLIT)){e.type===j.ADJUST_WEIGHTS?this.applyAdjustingWeights(e):this.applyAdjustingBorderSplit(e),this._props.onModelChange&&this._props.onModelChange(this._props.model,e);return}this.redrawLayout(),this._props.onModelChange&&this._props.onModelChange(this._props.model,e)};applyMeasuredGeometry(){this.syncLayoutMetrics(),this.positionTabPanels(),this.isReLayout()&&(this.redrawLayout(),this.setReLayout(!1))}applyAdjustingWeights(e){let t=this._props.model.getNodeById(e.data.nodeId);if(!(t instanceof z)){this.redrawLayout();return}let n=e.data.weights,r=t.getChildren();for(let e=0;e<r.length;e++){let t=r[e];if(typeof n?.[e]!=`number`||!Number.isFinite(n[e]))continue;let i=t instanceof z?`row`:`tabset`,a=this._measurables.get(i+`:`+t.getId())?.element;if(!a){this.redrawLayout();return}a.style.flexGrow=String(Math.max(1,n[e]*1e3))}this.applyMeasuredGeometry()}applyAdjustingBorderSplit(e){let t=this._props.model.getNodeById(e.data.node);if(!(t instanceof U)){this.redrawLayout();return}if(t.isOverlay()){this.redrawLayout();return}let n=this._measurables.get(`bordercontent:`+t.getId())?.element;if(!n){this.redrawLayout();return}let r=t.getSize();t.isHorizontal()?(n.style.width=r+`px`,n.style.minWidth=t.getMinSize()+`px`,n.style.maxWidth=t.getMaxSize()+`px`):(n.style.height=r+`px`,n.style.minHeight=t.getMinSize()+`px`,n.style.maxHeight=t.getMaxSize()+`px`),this.applyMeasuredGeometry()}reorderComponents(e,t){let n=t.filter(t=>e.has(t)),r=new Set(n);for(let t of e.keys())r.has(t)||n.push(t);return t===this._orderedTabIds?this._orderedTabIds=n:t===this._orderedTabMoveableIds&&(this._orderedTabMoveableIds=n),n.map(t=>e.get(t))}checkForBorderToShow(e,t){let n=this.getBoundingClientRect(this._mainRef.current),r=n.getCenter(),i=!1;this._props.model.isEnableEdgeDock()&&this._state.showHiddenBorder===O.CENTER&&(t>r.y-50&&t<r.y+50||e>r.x-50&&e<r.x+50)&&(i=!0);let a=O.CENTER;i||(e<=n.x+10?a=O.LEFT:e>=n.getRight()-10?a=O.RIGHT:t<=n.y+10?a=O.TOP:t>=n.getBottom()-10&&(a=O.BOTTOM)),a!==O.CENTER&&!this._props.model.getBorderSet().getBorderMap().has(a)&&(a=O.CENTER),a!==this._state.showHiddenBorder&&this.setState({showHiddenBorder:a})}onOverlayBorderPointerDown=e=>{let t=this._props.model.getBorderSet().getBorders().filter(e=>e.isOverlay()&&e.getSelected()!==-1);if(t.length===0||e.target?.closest?.(`.`+this.getClassName(A.FLEXLAYOUT__POPUP_MENU_CONTAINER)+`,.`+this.getClassName(A.FLEXLAYOUT__FLOAT_WINDOW)+`,.`+this.getClassName(A.FLEXLAYOUT__FLOATING_WINDOW_CONTENT)+`,.`+this.getClassName(A.FLEXLAYOUT__BORDER_TAB_OVERLAY)))return;let n=this.getDomRect();if(!n)return;let r=e.clientX-n.x,i=e.clientY-n.y,a=this._props.model.getRootRow(me.MAIN_LAYOUT_ID)?.getRect();if(a&&a.contains(r,i))for(let e of t)e.getContentRect()?.contains(r,i)||this.closeOverlayBorder(e)};closeOverlayBorder(e){let t=e.getSelectedNode();if(t===void 0)return;let n=this._currentDocument,r=n?.getElementById(be(`flexlayout-tab-`,t.getId())),i=!!n&&!!r&&r.contains(n.activeElement);this.doAction(j.selectTab(t.getId())),i&&n.getElementById(be(`flexlayout-tabbutton-`,t.getId()))?.focus()}onOverlayBorderKeyDown=e=>{if(!Se(e,this.getKeyMap().closeOverlayBorder))return;let t=this._currentDocument?.activeElement;if(!t)return;let n=this._props.model.getBorderSet().getBorders().filter(e=>e.isOverlay()&&e.getSelected()!==-1);for(let r of n){let n=r.getSelectedNode(),i=this._currentDocument.getElementById(be(`flexlayout-tab-`,n.getId())),a=this._currentDocument.getElementById(be(`flexlayout-tabbutton-`,n.getId()));if(i&&i.contains(t)||t===a){this.closeOverlayBorder(r),e.preventDefault();break}}};onTabsetNavKeyDown=e=>{if(e.defaultPrevented)return;let t=this.getKeyMap(),n;if(Se(e,t.focusNextTabset))n=1;else if(Se(e,t.focusPreviousTabset))n=-1;else return;this.focusAdjacentTabset(n)&&e.preventDefault()};focusAdjacentTabset(e){let t=this._currentDocument,n=t?.activeElement;if(!t||!n||!this.getRootDiv()?.contains(n))return!1;let r=n.tagName;if(r===`INPUT`||r===`TEXTAREA`||n.isContentEditable||n.closest(`[role="menu"]`)||this._props.model.getMaximizedTabset(this._layoutId)!==void 0)return!1;let i=[];if(this._props.model.visitLayoutNodes(this._layoutId,e=>{e instanceof R&&e.getSelectedNode()!==void 0&&i.push(e)}),i.length<2)return!1;let a=i.findIndex(e=>this._measurables.get(`tabset:`+e.getId())?.element.contains(n)?!0:!!t.getElementById(be(`flexlayout-tab-`,e.getSelectedNode().getId()))?.contains(n));if(a===-1){let e=this._props.model.getActiveTabset(this._layoutId);a=e===void 0?0:i.indexOf(e),a===-1&&(a=0)}let o=i[(a+e+i.length)%i.length];return t.getElementById(be(`flexlayout-tabbutton-`,o.getSelectedNode().getId()))?.focus(),this.doAction(j.setActiveTabset(o.getId(),this._layoutId)),!0}registerMeasurable(e,t,n){let r=t+`:`+e.getId(),i=this._measurables.get(r);n?this._measurables.set(r,{kind:t,node:e,element:n}):(this._measurables.delete(r),t===`grouppill`?e.setPillRect(E.empty()):t===`groupendmarker`&&e.setEndMarkerRect(E.empty())),t!==`tabbutton`&&(i&&this._geometryResizeObserver?.unobserve(i.element),n&&this._geometryResizeObserver?.observe(n))}setGeometryResizeObserver(e){if(this._geometryResizeObserver=e,e)for(let{kind:t,element:n}of this._measurables.values())t!==`tabbutton`&&e.observe(n)}syncLayoutMetrics(){this._cachedLayoutDOMRect=void 0;let e=!1;for(let{kind:t,node:n,element:r}of this._measurables.values()){if(!r.isConnected)continue;let i=this.getBoundingClientRect(r);switch(t){case`row`:case`tabset`:i.equalsWhenRounded(n.getRect())||(n.setRect(i),e=!0);break;case`tabstrip`:i.equalsWhenRounded(n.getTabStripRect())||(n.setTabStripRect(i),e=!0);break;case`tabsetcontent`:{let t=n;if(!isNaN(i.x)&&!t.getContentRect().equalsWhenRounded(i)){let n=t.getContentRect().width>0&&t.getContentRect().height>0;t.setContentRect(i),e=!0,!n&&i.width>0&&i.height>0&&this.setReLayout(!0)}break}case`tabbutton`:i.equalsWhenRounded(n.getTabRect())||(n.setTabRect(i),e=!0);break;case`grouppill`:i.equalsWhenRounded(n.getPillRect())||(n.setPillRect(i),e=!0);break;case`groupendmarker`:i.equalsWhenRounded(n.getEndMarkerRect())||(n.setEndMarkerRect(i),e=!0);break;case`borderheader`:i.equalsWhenRounded(n.getRect())||(n.setTabHeaderRect(i),e=!0);break;case`bordercontent`:{let t=n;if(!isNaN(i.x)&&i.width>0&&!t.getContentRect().equalsWhenRounded(i)){let n=t.getContentRect().width>0&&t.getContentRect().height>0;t.setContentRect(i),e=!0,!n&&i.height>0&&this.setReLayout(!0)}break}}}for(let{kind:t,node:n}of this._measurables.values())if(t===`grouppill`){let t=n,r=t.getDropRegion();r.equalsWhenRounded(t.getRect())||(t.setRect(r),e=!0)}return e}registerTabPanel(e,t){t?this._tabPanels.set(e.getId(),{node:e,element:t}):this._tabPanels.delete(e.getId())}positionTabPanels(){for(let{node:e,element:t}of this._tabPanels.values()){let n=e.getTabContainer(),r=n.getContentRect(),i=e.isSelected();n instanceof R?this._props.model.getMaximizedTabset(this._layoutId)!==void 0&&!n.isMaximized()&&(i=!1):n instanceof U&&(n.isShowing()||(i=!1)),r.positionElement(t),t.style.display=i?``:`none`,e.setRect(r),e.setVisible(i)}}updateLayoutMetrics=()=>{if(this._findBorderBarSizeRef.current){let e=this._findBorderBarSizeRef.current.getBoundingClientRect().height;Math.abs(e-this._state.calculatedBorderBarSize)>.5&&this.setState({calculatedBorderBarSize:e})}if(this._findSplitterSizeRef.current){let e=this._findSplitterSizeRef.current.getBoundingClientRect().width;Math.abs(e-this._lastSplitterSize)>.5&&(this._lastSplitterSize=e,this._props.model.setSplitterSize(e),this.redrawLayout())}};addTabWithDragAndDrop(e,t,n){this._dragDropManager.addTabWithDragAndDrop(e,t,n)}moveTabWithDragAndDrop(e,t){this._dragDropManager.moveTabWithDragAndDrop(e,t)}setDragComponent(e,t,n,r){this._dragDropManager.setDragComponent(e,t,n,r)}getMoveablesHome(){return this._moveablesHomeRef.current}getProps(){return this._props}getKeyMap(){return we(this._props.keyMap)}setProps(e){this._props=e}getState(){return this._state}setStateRaw(e){this._state=e}setState(e){this._setState(e)}setSetState(e){this._setState=e}setLayoutRef(e){this._layoutRef=e}setMoveablesHomeRef(e){this._moveablesHomeRef=e}setFindBorderBarSizeRef(e){this._findBorderBarSizeRef=e}setFindSplitterSizeRef(e){this._findSplitterSizeRef=e}getMainRef(){return this._mainRef}setMainRef(e){this._mainRef=e}getOrderedTabIds(){return this._orderedTabIds}getOrderedTabMoveableIds(){return this._orderedTabMoveableIds}getCurrentDocument(){return this._currentDocument}setCurrentDocument(e){this._currentDocument=e}getCurrentWindow(){return this._currentWindow}setCurrentWindow(t){this._currentWindow=t,t&&!e.Windows.has(t)&&e.Windows.set(t,de())}getWindowId(){if(this.getCurrentWindow())return e.Windows.get(this.getCurrentWindow())}isSupportsPopout(){return this._supportsPopout}getPopoutURL(){return this._popoutURL}getIcons(){return this._icons}getDragDropManager(){return this._dragDropManager}getLayoutId(){return this._layoutId}getLayout(){return this._layout}setLayout(e){this._layout=e}getMainController(){return this._mainController}isMainLayout(){return this._layout.isMainLayout()}getPopoutWindowName(){return this._popoutWindowName??this.i18nName(G.Popout_Window_Name)}isReLayout(){return this._reLayout}setReLayout(e){this._reLayout=e}getBoundingClientRect(e){let t=this.getDomRect();return t?E.getBoundingClientRect(e).relativeTo(t):E.empty()}getClassName=e=>this._props.classNameMapper===void 0?e:this._props.classNameMapper(e);getLayoutRef(){return this._layoutRef.current}getDomRect(){return this._cachedLayoutDOMRect===void 0?this._layoutRef.current?(this._cachedLayoutDOMRect=E.fromDomRect(this._layoutRef.current.getBoundingClientRect()),this._cachedLayoutDOMRect):E.empty():this._cachedLayoutDOMRect}getRootDiv(){return this._layoutRef.current}getMainElement(){return this._mainRef.current}getFactory(){return this._props.factory}isRealtimeResize(){return this._props.realtimeResize??!0}isSplitterDragging(){return this._mainController?this._mainController._splitterDragging:this._splitterDragging}setSplitterDragging(e){let t=this._mainController??this;t._splitterDragging=e}setEditingTab(e){this.setState({editingTab:e})}getEditingTab(){return this._state.editingTab}getModel(){return this._props.model}getTabDragSpeed(){return this._props.tabDragSpeed?this._props.tabDragSpeed:.3}onCloseLayout=e=>{this.doAction(j.closePopout(e.getLayoutId()))};getScreenRect(e){let t=e.clone(),n=this.getDomRect(),r=this._currentWindow.outerHeight-this._currentWindow.innerHeight,i=this._currentWindow.outerWidth-this._currentWindow.innerWidth,a=r>=0&&r<=200?r:60,o=i>=0&&i<=100?i:2;return t.x=this._currentWindow.screenX+this._currentWindow.scrollX+o/2+n.x+t.x,t.y=this._currentWindow.screenY+this._currentWindow.scrollY+(a-o/2)+n.y+t.y,t.height+=a,t.width+=o,t}getRelativeRect(e){let t=e.clone();if(!this._layout.isMainLayout()){let e=this._layout.getRect();t.x+=e.x,t.y+=e.y}return t}moveWindowToFront(e){this.doAction(j.movePopoutToFront(e))}addTabToTabSet(e,t){if(this._props.model.getNodeById(e)!==void 0)return this.doAction(j.addTab(t,e,O.CENTER,-1))}addTabToActiveTabSet(e){let t=this._props.model.getActiveTabset(this._layoutId);if(t!==void 0)return this.doAction(j.addTab(e,t.getId(),O.CENTER,-1))}maximize(e){this.doAction(j.maximizeToggle(e.getId(),this.getLayoutId()))}customizeTab(e,t){this._props.onRenderTab&&this._props.onRenderTab(e,t)}customizeTabSet(e,t){this._props.onRenderTabSet&&this._props.onRenderTabSet(e,t)}i18nName(e,t){let n=this._props.model.translate(e);return n===e&&(n=ge[e]??e),n===void 0&&(n=e+(t===void 0?``:t)),n}getShowOverflowMenu(){return this._props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this._props.onTabSetPlaceHolder}showContextMenu(e,t){this._props.onContextMenu&&this._props.onContextMenu(e,t)}auxMouseClick(e,t){this._props.onAuxMouseClick&&this._props.onAuxMouseClick(e,t)}showOverlay(e){this._showOverlay!==e&&(this._showOverlay=e,this.setState({showOverlay:e}),Oe(!e,this._currentDocument))}showOverlayOnAllWindows(e){for(let[,t]of this._props.model.getLayouts()){let n=Ut(t);n&&n.showOverlay(e)}}},Vt={close:(0,_.jsx)(yt,{}),pin:(0,_.jsx)(bt,{}),closeTabset:(0,_.jsx)(yt,{}),closeFloatPopout:(0,_.jsx)(yt,{}),popout:(0,_.jsx)(wt,{}),popoutFloat:(0,_.jsx)(Tt,{}),maximize:(0,_.jsx)(xt,{}),restore:(0,_.jsx)(Dt,{}),more:(0,_.jsx)(St,{}),edgeArrow:(0,_.jsx)(Ct,{}),activeTabset:(0,_.jsx)(Ot,{}),dragToDock:(0,_.jsx)(Et,{}),popoutFloatWindow:(0,_.jsx)(wt,{})},Ht=ve();function Ut(e){return e.getController()}var Wt=g.forwardRef((e,t)=>{let[n,r]=g.useState({editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRedrawRevision:0,fullRedrawRevision:0,showHiddenBorder:O.CENTER}),i=g.useCallback(t=>{r(n=>({...n,...typeof t==`function`?t(n,e):t}))},[e]),a=g.useRef(null),[o,s]=g.useState(0),c=g.useRef(null),l=g.useRef(null),u=g.useRef(null),d=g.useRef(null),f=g.useMemo(()=>new Bt(e,n,i),[]);f.setProps(e),f.setStateRaw(n),f.setSetState(i),f.setLayoutRef(a),f.setMoveablesHomeRef(c),f.setFindBorderBarSizeRef(l),f.setFindSplitterSizeRef(u),f.setMainRef(d);let p=e.model.getLayouts().get(f.getLayoutId());p.setController(f),g.useImperativeHandle(t,()=>f,[f]),g.useLayoutEffect(()=>{let e=f.syncLayoutMetrics();if(f.positionTabPanels(),f.isMainLayout()&&f.updateLayoutMetrics(),f.isReLayout()&&(f.redrawLayout(),f.setReLayout(!1)),a.current&&f.getCurrentDocument()!==void 0&&f.getCurrentDocument()!==a.current.ownerDocument&&s(e=>e+1),e){let e=a.current?.ownerDocument.defaultView??window,t=e.requestAnimationFrame(()=>{f.syncLayoutMetrics(),f.positionTabPanels(),f.isReLayout()&&(f.redrawLayout(),f.setReLayout(!1))});return()=>e.cancelAnimationFrame(t)}}),g.useEffect(()=>{let e=a.current.ownerDocument,t=e.defaultView;f.setCurrentDocument(e),f.setCurrentWindow(t);let n=new t.ResizeObserver(()=>{f.updateRect(),f.syncLayoutMetrics(),f.positionTabPanels(),f.updateLayoutMetrics(),f.isReLayout()&&(f.redrawLayout(),f.setReLayout(!1))});n.observe(a.current),f.setGeometryResizeObserver(n),l.current&&n.observe(l.current),u.current&&n.observe(u.current);let r=()=>{f.updateRect()};t.addEventListener(`resize`,r);let i=()=>{for(let[e,t]of f.getProps().model.getLayouts()){let e=t.getController();e&&e.redrawLayout()}};return f.isMainLayout()&&(e.addEventListener(`visibilitychange`,i),e.addEventListener(`pointerdown`,f.onOverlayBorderPointerDown,!0),e.addEventListener(`keydown`,f.onOverlayBorderKeyDown)),(f.isMainLayout()||f.getLayout()?.getType()===`window`)&&e.addEventListener(`keydown`,f.onTabsetNavKeyDown),()=>{f.setGeometryResizeObserver(void 0),n.disconnect(),t.removeEventListener(`resize`,r),e.removeEventListener(`visibilitychange`,i),e.removeEventListener(`pointerdown`,f.onOverlayBorderPointerDown,!0),e.removeEventListener(`keydown`,f.onOverlayBorderKeyDown),e.removeEventListener(`keydown`,f.onTabsetNavKeyDown)}},[f,o]),g.useEffect(()=>{let e;if(!f.isMainLayout()&&f.getLayout().getType()===`window`){let t=f.getProps().mainLayoutController?.getRootDiv();if(t){let n=t,r=a.current;Me(n,r),e=new MutationObserver(()=>{Me(n,r)&&f.redrawLayout()}),e.observe(n,{attributeFilter:[`style`]})}}return()=>{e&&e.disconnect()}},[f]),g.useEffect(()=>{let t=e.model;if(p.setToExportRectFunction((e,t)=>t===`window`?f.getScreenRect(e):f.getRelativeRect(e)),f.setLayout(p),f.isMainLayout()){let e={onAfterAction:f.onModelChange};return t.addChangeListener(e),()=>{t.removeChangeListener(e)}}},[e.model,f,p]);let m=f.isMainLayout()?(0,_.jsxs)(`div`,{className:f.getClassName(A.FLEXLAYOUT__LAYOUT_METRICS),children:[(0,_.jsx)(`div`,{ref:l,className:f.getClassName(A.FLEXLAYOUT__BORDER_SIZER),children:`FindBorderBarSize`},`findBorderBarSize`),(0,_.jsx)(`div`,{ref:u,className:f.getClassName(A.FLEXLAYOUT__SPLITTER_+`horz`)},`findSplitterSize`)]}):null;if(!a.current)return(0,_.jsx)(`div`,{ref:a,className:f.getClassName(A.FLEXLAYOUT__LAYOUT),children:m});let h=e.model,v=f.getLayoutId();h.getRootRow(v).calcMinMaxSize(),h.getRootRow(v).setPaths(e.path||``),f.isMainLayout()&&h.getBorderSet().setPaths();let y=(0,_.jsx)(Fe,{controller:f,show:n.showOverlay},`__overlay__`),b=f.renderLayout(),x=(0,_.jsx)(_t,{controller:f,inner:b}),S=f.renderTabContainers(),C=f.reorderComponents(S,f.getOrderedTabIds()),w=null,T=null,E=null,D=null;return f.isMainLayout()&&(w=(0,_.jsx)($e,{controller:f}),T=f.reorderComponents(f.renderTabContents(),f.getOrderedTabMoveableIds()),E=(0,_.jsx)(`div`,{"aria-hidden":`true`,className:f.getClassName(A.FLEXLAYOUT__LAYOUT_TAB_STAMPS),children:f.renderDragTabButtons()},`__dragTabButtons__`),D=(0,_.jsx)(`div`,{ref:c,className:f.getClassName(A.FLEXLAYOUT__LAYOUT_MOVEABLES_HOME)},`__moveables_home__`)),(0,_.jsxs)(`div`,{ref:a,className:f.getClassName(A.FLEXLAYOUT__LAYOUT),onDragEnter:f.getDragDropManager().onDragEnterRaw,onDragLeave:f.getDragDropManager().onDragLeaveRaw,onDragOver:f.getDragDropManager().onDragOver,onDrop:f.getDragDropManager().onDrop,children:[m,D,y,x,C,T,w,E]})});Wt.displayName=`LayoutInternal`;var Gt=g.forwardRef((e,t)=>{let n=(0,g.useRef)(null),r=(0,g.useRef)(e.model),i=(0,g.useRef)(0);r.current!==e.model&&(e.model.getAdoptedFromModel()!==r.current&&i.current++,r.current=e.model),(0,g.useEffect)(()=>(e.model.setI18nDefaults(ge),e.model.setI18nTranslator(e.i18nTranslator),()=>{e.model.setI18nDefaults(void 0),e.model.setI18nTranslator(void 0)}),[e.model,e.i18nTranslator]),Gt.displayName=`Layout`,(0,g.useImperativeHandle)(t,()=>({redraw:()=>{n.current?.redrawLayoutAndTabContent()},addTabToTabSet:(e,t)=>n.current?.addTabToTabSet(e,t),addTabWithDragAndDrop:(e,t,r)=>{n.current?.addTabWithDragAndDrop(e,t,r)},moveTabWithDragAndDrop:(e,t)=>{n.current?.moveTabWithDragAndDrop(e,t)},addTabToActiveTabSet:e=>n.current?.addTabToActiveTabSet(e),setDragComponent:(e,t,r,i)=>{n.current?.setDragComponent(e,t,r,i)},editTabName:e=>{let t=n.current?.getModel().getNodeById(e);t instanceof W&&t.isEnableRename()&&Ut(t.getLayout())?.setEditingTab(t)},getRootDiv:()=>n.current.getRootDiv()}));let a=(0,g.useRef)({}),o=e.invalidateTabContentOnParentRender===!1?a.current:{};return(0,_.jsx)(Wt,{ref:n,...e,parentRedrawRevision:o},i.current)}),Kt=[j.SET_ACTIVE_TABSET];function qt(e,t){let n=t?.maxBufferSize??100,r=g.useRef(t?.ignoreActionTypes??Kt);g.useEffect(()=>{r.current=t?.ignoreActionTypes??Kt});let[i,a]=g.useState(()=>typeof e==`function`?e():e??null),[o,s]=g.useState(0),[c,l]=g.useState(0),u=g.useRef(i),d=g.useRef([]),f=g.useRef([]),p=g.useRef(null);g.useEffect(()=>{if(!i)return;u.current=i;let e={onBeforeAction:e=>{e.isAdjusting()?p.current===null&&(p.current=JSON.stringify(u.current.toJson())):(r.current.includes(e.type)||(d.current.push(p.current??JSON.stringify(u.current.toJson())),d.current.length>n&&d.current.shift(),f.current=[],s(d.current.length),l(0)),p.current=null)}};return i.addChangeListener(e),()=>{i.removeChangeListener(e)}},[i,n]);let m=g.useCallback((e,t=!0)=>{u.current=e,a(e),t&&(d.current=[],f.current=[],p.current=null,s(0),l(0))},[]),h=g.useCallback(()=>{let e=u.current;if(!e)return;let t=d.current.pop();if(t===void 0)return;f.current.push(JSON.stringify(e.toJson()));let n=me.fromJson(JSON.parse(t),e);u.current=n,s(d.current.length),l(f.current.length),a(n)},[]),_=g.useCallback(()=>{let e=u.current;if(!e)return;let t=f.current.pop();if(t===void 0)return;d.current.push(JSON.stringify(e.toJson()));let n=me.fromJson(JSON.parse(t),e);u.current=n,s(d.current.length),l(f.current.length),a(n)},[]),v=g.useCallback(()=>{d.current=[],f.current=[],p.current=null,s(0),l(0)},[]);return{model:i,setModel:m,undo:h,redo:_,canUndo:o>0,canRedo:c>0,undoCount:o,redoCount:c,reset:v}}var Jt=3e4;async function Yt(e,t={}){let n=new AbortController,r=setTimeout(()=>n.abort(),t.timeoutMs||Jt);try{let r=await fetch(e,{method:t.method||`GET`,headers:t.body?{"content-type":`application/json`}:void 0,body:t.body?JSON.stringify(t.body):void 0,signal:n.signal}),i;try{i=await r.json()}catch{throw Error(`HTTP ${r.status}`)}if(!i.ok){let e=Error(i.error||`请求失败`);throw e.code=i.code,e.details=i.details,e}return i.data}catch(e){throw e&&e.name===`AbortError`?Error(`请求超时(本地服务无响应)`):e}finally{clearTimeout(r)}}var Xt=`nx-kv-ui`,Zt={view:`todo`,topic:``};function Qt(){try{let e=localStorage.getItem(Xt);return e?{...Zt,...JSON.parse(e)}:{...Zt}}catch{return{...Zt}}}var $t=(0,g.createContext)(null);function en({children:e}){let[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(Qt);(0,g.useEffect)(()=>{try{localStorage.setItem(Xt,JSON.stringify(a))}catch{}},[a]);let s=(0,g.useCallback)(async()=>{let e=await Yt(`/api/bootstrap`);return n(e),e},[]),c=(0,g.useCallback)(async()=>{i(await Yt(`/api/bundled`).catch(()=>null))},[]);(0,g.useEffect)(()=>{s(),c()},[s,c]);let l=(0,g.useCallback)(e=>{o(t=>typeof e==`function`?{...t,...e(t)}:{...t,...e})},[]),u=(0,g.useCallback)((e,t)=>{o(n=>{let r=new Set(n[e]);return r.has(t)?r.delete(t):r.add(t),{...n,[e]:[...r]}})},[]),d=(0,g.useMemo)(()=>({boot:t,bundled:r,ui:a,patchUi:l,toggleSel:u,refreshBoot:s,refreshBundled:c}),[t,r,a,l,u,s,c]);return(0,_.jsx)($t.Provider,{value:d,children:e})}function tn(){let e=(0,g.useContext)($t);if(!e)throw Error(`useStore 必须在 StoreProvider 内使用`);return e}function nn({text:e,className:t=``,title:n,children:r}){let i=l();return(0,_.jsx)(`span`,{className:`copyable`+(t?` `+t:``),title:n||`点击复制`,onClick:async()=>{let t=String(e??``);try{await navigator.clipboard.writeText(t),i(`已复制: `+(t.length>60?t.slice(0,57)+`...`:t))}catch{try{let e=document.createElement(`textarea`);e.value=t,e.style.cssText=`position:fixed;opacity:0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),e.remove(),i(`已复制: `+(t.length>60?t.slice(0,57)+`...`:t))}catch{i(`复制失败(剪贴板不可用)`)}}},children:r===void 0?e:r})}var rn=class extends g.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[nx-kv] 视图渲染失败:`,e,t)}render(){return this.state.error?(0,_.jsxs)(`div`,{className:`card`,style:{padding:16},children:[(0,_.jsx)(`div`,{className:`colhead`,children:(0,_.jsx)(`h3`,{children:`这个面板出错了`})}),(0,_.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,wordBreak:`break-all`,marginBottom:10},children:String(this.state.error?.message||this.state.error)}),(0,_.jsx)(`div`,{className:`muted`,style:{marginBottom:10},children:`其他面板不受影响,可以切到别的 tab 继续操作;控制台有完整堆栈。`}),(0,_.jsx)(`button`,{className:`btn`,onClick:()=>this.setState({error:null}),children:`重试`})]}):this.props.children}},an=(0,g.createContext)(null);function on(){return(0,g.useContext)(an)}var sn=`__GLOBAL__`;function cn(e=[]){let t=Array.isArray(e)?e:[];return{pending:t.filter(e=>e.status!==`consumed`&&e.status!==`archived`&&!e.deletedAt&&!e.migratedTo),consumed:t.filter(e=>e.status===`consumed`&&!e.deletedAt).slice().reverse(),archived:t.filter(e=>e.status===`archived`&&!e.deletedAt).slice().reverse(),deleted:t.filter(e=>!!e.deletedAt).slice().reverse(),migrated:t.filter(e=>!!e.migratedTo&&!e.deletedAt&&e.status!==`consumed`)}}function ln(e=[]){let t=Array.isArray(e)?e:[],n=[],r=[],i=[],a=[],o=[];for(let e of t)e.deletedAt?o.push(e):e.status===`consumed`?r.push(e):e.status===`archived`?i.push(e):e.migratedTo?a.push(e):n.push(e);return[...n,...r.reverse(),...a,...i.reverse(),...o.reverse()]}var un=0,dn={docs:{}},fn=new Set,pn=()=>{for(let e of fn)e()},mn=e=>(fn.add(e),()=>fn.delete(e)),hn=()=>dn.docs,gn=e=>e||`__GLOBAL__`,_n=(e,t)=>`${e}::${t}`,vn=e=>/^draft/.test(String(e||``)),yn=()=>`draft-${++un}`;function bn(){return(0,g.useSyncExternalStore)(mn,hn,hn)}function xn(e,t){return dn.docs[e]||(dn={...dn,docs:{...dn.docs,[e]:{title:``,body:``,attachments:[],mode:`split`,...t||{}}}},pn()),dn.docs[e]}function Sn(e){return dn.docs[e]||null}function Cn(e,t){let n=dn.docs[e]||{title:``,body:``,attachments:[],mode:`split`};dn={...dn,docs:{...dn.docs,[e]:{...n,...t}}},pn()}function wn(e,t,n){let r=dn.docs[e]||{},i={...dn.docs,[t]:{...r,...n||{}}};delete i[e],dn={...dn,docs:i},pn()}var Tn=1.2,En=2.5;function Dn(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`expanded`:t<2?`closed`:t<8?`collapsed`:`expanded`}function On(e){let t=Number(e);return!Number.isFinite(t)||t<=0?16:t<.5?Tn:kn(Dn(t)).weight}function kn(e){return{weight:e===`closed`?Tn:e===`collapsed`?En:16,enableTabStrip:!1}}var q={SIDEBAR:`sidebar`,MAIN:`maincontent`,RIGHT:`rightSidebar`,FLOAT:`float`},An={sidebar:q.SIDEBAR,dir:q.MAIN,page:q.MAIN,group:q.MAIN,repos:q.MAIN,cloud:q.MAIN,overview:q.MAIN,templates:q.MAIN,doc:q.MAIN,dag:q.MAIN,progress:q.RIGHT,settings:q.FLOAT},jn=new Set([`sidebar`,`repos`,`cloud`,`overview`,`templates`,`progress`,`settings`]);function Mn(e){return An[e]||q.MAIN}function Nn(e){return jn.has(e)}var Pn=`nx-kv-ui.workspace`,Fn={tabEnableClose:!0,tabEnableDrag:!0,tabEnableRename:!1,tabEnablePopout:!0,tabEnablePopoutIcon:!1,tabEnableFloat:!0,tabEnableFloatIcon:!1,tabEnablePin:!1,tabSetEnableClose:!1,tabSetEnableCloseButton:!0,tabSetEnableMaximize:!1,tabSetEnableDrag:!0,tabSetEnableDrop:!0,tabSetEnableTabGroups:!1,tabSetAutoSelectTab:!0,borderEnableClose:!0,enableEdgeDock:!0,enableEdgeDockIndicators:!0,rootOrientationVertical:!1};function In(){return{global:{...Fn},borders:[],layout:{type:`row`,children:[{type:`tabset`,id:`ts_sidebar`,weight:16,enableTabStrip:!1,children:[{type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1}]},{type:`tabset`,id:`ts_main`,weight:68,enableTabStrip:!1,children:[{type:`tab`,id:`t_welcome`,name:`开始`,component:`welcome`}]},{type:`tabset`,id:`ts_right`,weight:16,enableTabStrip:!1,children:[]}]}}}function Ln(e){return e.updateAttrs({...Fn}),e}function Rn(e){if(!e||e.type!==`row`||!Array.isArray(e.children))return e;let t=e=>(e.type===`row`&&(e.children=(e.children||[]).map(e=>e.type===`row`?t(e):e).filter(e=>e.type===`tabset`||e.type===`row`?(e.children||[]).length>0:!0)),e);return t(e).children.length?e:null}function zn(e){if(!e||typeof e!=`object`)return e;if(Array.isArray(e.borders)&&(e.borders=e.borders.filter(e=>Array.isArray(e.children)&&e.children.length>0)),e.subLayouts&&typeof e.subLayouts==`object`){for(let t of Object.keys(e.subLayouts)){let n=e.subLayouts[t],r=n&&n.layout;(!r||!Array.isArray(r.children)||r.children.length===0||r.children.length===1&&r.children[0]&&r.children[0].type===`tabset`&&(r.children[0].children||[]).length===0)&&delete e.subLayouts[t]}Object.keys(e.subLayouts).length===0&&delete e.subLayouts}return e}function Bn(e){if(!e||!e.layout)return!1;let t=!1,n=null,r=null,i=(e,t)=>{if(e&&(e.type===`tab`&&e.component===`sidebar`&&(n=e,t&&t.type===`tabset`&&(r=t)),Array.isArray(e.children)))for(let t of e.children)i(t,e)};i(e.layout,null);let a=e.layout,o=a&&a.type===`row`&&Array.isArray(a.children);if(!n)return o&&(a.children.unshift({type:`tabset`,id:`ts_sidebar`,weight:kn(`expanded`).weight,enableTabStrip:!1,children:[{type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1}]}),t=!0),t;if(n.enableClose!==!1&&(n.enableClose=!1,t=!0),r&&Array.isArray(r.children)&&r.children.some(e=>e&&e.component!==`sidebar`)&&o){let e=r.children,i=e.indexOf(n);i>=0&&e.splice(i,1),typeof r.selected==`number`&&(i>=0&&r.selected>i?--r.selected:i>=0&&r.selected===i&&(r.selected=Math.max(0,Math.min(e.length-1,i))),e.length===0?delete r.selected:r.selected>=e.length&&(r.selected=e.length-1)),r.enableTabStrip=!0;let o=Number(r.weight);return(!Number.isFinite(o)||o<8)&&(r.weight=84),a.children.unshift({type:`tabset`,id:`ts_sidebar`,weight:kn(`expanded`).weight,enableTabStrip:!1,children:[n]}),t=!0,t}if(r){let e=Number(r.weight);if(!Number.isFinite(e)||e<2){let e=kn(`expanded`);(r.weight!==e.weight||r.enableTabStrip!==e.enableTabStrip)&&(r.weight=e.weight,r.enableTabStrip=e.enableTabStrip,t=!0)}else{let n=On(e);e!==n&&(r.weight=n,r.enableTabStrip=kn(n<8?`collapsed`:`expanded`).enableTabStrip,t=!0)}}return t}function Vn(e){if(!e||!e.layout)return!1;let t=!1,n=e=>{if(e.type===`tabset`&&e.enableTabStrip!==!1&&(e.enableTabStrip=!1,t=!0),Array.isArray(e.children))for(let t of e.children)n(t)};n(e.layout);let r=e.layout;return r&&r.type===`row`&&Array.isArray(r.children)&&!r.children.some(e=>e&&e.id===`ts_right`)&&(r.children.push({type:`tabset`,id:`ts_right`,weight:16,enableTabStrip:!1,children:[]}),t=!0),t}function Hn(){try{let e=localStorage.getItem(Pn);if(!e)return Ln(me.fromJson(In()));let t=JSON.parse(e);return!t||!t.layout||!Rn(t.layout)?Ln(me.fromJson(In())):(zn(t),Bn(t),Vn(t),Ln(me.fromJson(t)))}catch{return Ln(me.fromJson(In()))}}function Un(e){try{let t=e.toJson();t.layout&&Rn(t.layout)&&(zn(t),localStorage.setItem(Pn,JSON.stringify(t)))}catch{}}function Wn(e){if(!e)return 0;let t=[];e.visitNodes(e=>{e.getType()===`tabset`&&(e.getChildren()||[]).length===0&&t.push(e.getId())});for(let n of t)e.doAction(j.deleteTabset(n));return t.length}function Gn(){try{localStorage.removeItem(Pn)}catch{}}function Kn(e,t,n){let r=JSON.stringify(n||{}),i=null;return e.visitNodes(e=>{i||e.getType()===`tab`&&e.getComponent()===t&&JSON.stringify(e.getConfig()||{})===r&&(i=e)}),i}function qn(e){let t=[];return e.visitNodes(e=>{e.getType()===`tabset`&&t.push(e)}),t}function Jn(e,t){let n=null;return e.visitNodes(e=>{n||e.getType()===`tab`&&e.getComponent()===t&&(n=e)}),n}function Yn(e,t){return!t||!t.length?!1:(e.getTabNodes()||[]).some(e=>t.includes(e.getComponent()))}function Xn(e,t=[]){let n=e.getActiveTabset()||e.getFirstTabSet();if(n&&!Yn(n,t))return n.getId();let r=[...qn(e)].reverse().find(e=>!Yn(e,t));return r?r.getId():n?n.getId():void 0}function Zn(e){if(!e)return null;let t=null;return e.visitNodes(e=>{if(t||e.getType()!==`tabset`)return;let n=e.getId();if(n===`ts_main`){t=n;return}n!==`ts_sidebar`&&n!==`ts_right`&&!Yn(e,[`sidebar`])&&(t=n)}),t}function Qn(e){if(!e)return null;let t=null;return e.visitNodes(e=>{t||e.getType()===`tabset`&&e.getId()===`ts_right`&&(t=e.getId())}),t}var $n=16,er=0;function tr(e,t){let n=Qn(e);return n?dr(e,n,{weight:t?$n:er,enableTabStrip:!1}):!1}function nr(e){if(!e)return;let t=[];e.visitNodes(e=>{e.getType()===`tab`&&e.getComponent()===`progress`&&t.push(e.getId())});for(let n of t)e.doAction(j.deleteTab(n));tr(e,!1)}function rr(e,{dirKey:t,task:n}={}){if(!e)return;let r=Jn(e,`progress`);if(!r)return;let i=r.getConfig()||{},a={dirKey:t||``};n!=null&&String(n)!==``&&(a.task=String(n)),JSON.stringify(i)!==JSON.stringify(a)&&(e.doAction(j.updateNodeAttributes(r.getId(),{config:a})),t&&tr(e,!0))}function ir(e){if(!e)return 0;let t=Qn(e),n=[];e.visitNodes(e=>{if(e.getType()!==`tab`)return;let r=e.getComponent();if(r===`sidebar`||r===`progress`)return;let i=e.getParent&&e.getParent();if(!i||i.getType()!==`tabset`)return;let a=i.getId();a===`ts_sidebar`||t&&a===t||typeof e.getWindowId==`function`&&e.getWindowId()||n.push(e.getId())});for(let t of n)e.doAction(j.deleteTab(t));return n.length}function ar(e){if(!e)return 0;let t=[];e.visitNodes(e=>{e.getType()===`tab`&&(e.getConfig()||{}).beside&&t.push(e.getId())});for(let n of t)e.doAction(j.deleteTab(n));return t.length}function or(e,t){let{component:n,name:r,config:i={}}=t||{};if(!e||!n)return{tabId:null,reused:!1};let a=Zn(e);if(!a)return{tabId:null,reused:!1};let o={...i,beside:!0},s=Kn(e,n,o);if(s)return e.doAction(j.selectTab(s.getId())),r&&s.getName()!==r&&e.doAction(j.renameTab(s.getId(),r)),{tabId:s.getId(),reused:!0};ar(e),e.doAction(j.addTab({type:`tab`,name:r||n,component:n,config:o,enableClose:!0},a,O.getByName(`right`),-1,!0));let c=Kn(e,n,o);return{tabId:c?c.getId():null,reused:!1}}function sr(e,t){let{component:n,name:r,config:i={}}=t;if(!e)return{tabId:null,reused:!1};let a=t.area||Mn(n),o=Kn(e,n,i);if(o)return e.doAction(j.selectTab(o.getId())),r&&o.getName()!==r&&e.doAction(j.renameTab(o.getId(),r)),a===q.RIGHT&&tr(e,!0),a===q.MAIN&&(n===`page`||n===`dir`)&&rr(e,{dirKey:i.dirKey,task:i.task}),{tabId:o.getId(),reused:!0};if(a===q.RIGHT&&Nn(n)){let t=Jn(e,n);if(t)return e.doAction(j.updateNodeAttributes(t.getId(),{config:i})),e.doAction(j.selectTab(t.getId())),r&&t.getName()!==r&&e.doAction(j.renameTab(t.getId(),r)),tr(e,!0),{tabId:t.getId(),reused:!0}}if(a===q.MAIN){ir(e);let t=Zn(e);if(!t)return{tabId:null,reused:!1};e.doAction(j.addTab({type:`tab`,name:r,component:n,config:i},t,O.getByName(`center`),-1,!0));let a=Kn(e,n,i);return a&&(n===`page`||n===`dir`)&&rr(e,{dirKey:i.dirKey,task:i.task}),{tabId:a?a.getId():null,reused:!1}}if(a===q.RIGHT){let t=Qn(e);if(t){tr(e,!0),e.doAction(j.addTab({type:`tab`,name:r,component:n,config:i},t,O.getByName(`center`),-1,!0));let a=Kn(e,n,i);return{tabId:a?a.getId():null,reused:!1}}}if(a===q.FLOAT)return cr(e,{...t,component:n,name:r,config:i});let s=Xn(e,[`sidebar`]);if(!s)return{tabId:null,reused:!1};let c=O.getByName(t.location||`center`);e.doAction(j.addTab({type:`tab`,name:r,component:n,config:i},s,c,-1,!0));let l=Kn(e,n,i);return{tabId:l?l.getId():null,reused:!1}}function cr(e,t){let n=sr(e,{...t,area:q.MAIN,location:t.location||`center`});if(!n||!n.tabId||n.reused)return n;let r=new Set([...e.getLayouts().keys()]);e.doAction(j.popoutTab(n.tabId,`float`));let i=typeof window<`u`?window.innerWidth:1280,a=typeof window<`u`?window.innerHeight:800,o=Math.min(760,Math.max(560,i-160)),s=Math.min(700,Math.max(460,a-160));for(let[t,n]of e.getLayouts()){if(r.has(t)||n.getType()!==`float`)continue;let i=n.getRect(),a=new E(Math.round(i.x+(i.width-o)/2),Math.round(i.y+(i.height-s)/2),o,s);e.doAction(j.moveFloat(n.getLayoutId(),a))}return n}function lr(e,t){if(!e)return null;let n=null;return e.visitNodes(e=>{if(n||e.getType()!==`tab`||e.getComponent()!==t)return;let r=e.getParent();r&&r.getType()===`tabset`&&(n=r)}),n?n.getId():null}function ur(e,t){if(!e||!t)return null;let n=null;return e.visitNodes(e=>{n===null&&e.getType()===`tabset`&&e.getId()===t&&(n=e.getWeight())}),n}function dr(e,t,n){if(!e||!t)return!1;let r=!1;return e.visitNodes(e=>{r||e.getType()===`tabset`&&e.getId()===t&&(r=!0)}),r?(e.doAction(j.updateNodeAttributes(t,n)),!0):!1}function fr(e){if(!e)return null;let t=lr(e,`sidebar`);if(t)return t;let n=e.getFirstTabSet&&e.getFirstTabSet(),r=n?n.getId():null;if(!r)return null;e.doAction(j.addTab({type:`tab`,id:`t_sidebar`,name:`目录`,component:`sidebar`,enableClose:!1},r,O.getByName(`left`),-1,!0));let i=lr(e,`sidebar`);return i&&dr(e,i,kn(`expanded`)),i}function pr(e){let t=e&&e.getActiveTabset();return t&&t.getSelectedNode()||null}function mr(e){return String(e||``).trim().replace(/\.md$/i,``).replace(/\s+/g,` `).toLowerCase()}function hr(e,t){let n=Array.isArray(t)?t:[];if(!n.length)return null;let r=mr(e);if(!r)return null;let i=r.replace(/\\/g,`/`),a=n.find(e=>e.rel&&mr(e.rel)===i||e.path&&String(e.path).replace(/\\/g,`/`).toLowerCase()===i);if(a)return{docId:a.docId};let o=n.filter(e=>e.name===i.split(`/`).pop());return o.length===1?{docId:o[0].docId}:o.length>1?{candidates:o.map(e=>e.docId)}:null}var gr=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/,_r=/^([A-Za-z][\w-]*)\s*:\s*(.*)$/,vr=[`board`,`project`,`boardIntro`,`boardDesc`,`projectIntro`,`projectDesc`];function yr(e){if(!e||typeof e!=`object`)return{};let t={...e};for(let e of vr){if(t[e]!=null&&String(t[e]).trim()!==``)continue;let n=null;for(let r of Object.keys(t)){if(r===e||!e.endsWith(r)||r.length<1||r.length>=e.length)continue;let i=t[r];if(i!=null&&String(i).trim()!==``){n=r;break}}n&&(t[e]=t[n],delete t[n])}return t}function br(e){let t=String(e??``).match(gr);if(!t)return{};let n={},r=0;for(let e of t[1].split(/\r?\n/)){let t=e.match(_r);t&&(n[t[1]]=t[2].trim(),r+=1)}return r?yr(n):{}}function xr(e){return String(e??``).replace(gr,(e,t)=>String(t||``).split(/\r?\n/).some(e=>_r.test(e))?``:e)}function Sr(e,t={}){let n=xr(e),r=Object.entries(t).filter(([,e])=>e!=null&&`${e}`.trim()!==``).map(([e,t])=>`${e}: ${`${t}`.trim()}`);return r.length?`---\n${r.join(`
30
30
  `)}\n---\n${n}`:n}function Cr(e,t=`未命名任务`){let n=xr(e).split(`
31
31
  `);for(let e of n){let t=e.match(/^#\s+(.+)$/);if(t)return t[1].trim();if(e.trim())return e.trim().slice(0,48)}return t}function wr(e){let t=(e||`untitled`).trim().replace(/[\\/:*?"<>|]+/g,`-`).slice(0,48);return t.endsWith(`.md`)?t:`${t}.md`}function Tr(e,t){let n=String(e||``).trim().toLowerCase().replace(/\s+/g,`-`).replace(/[^\w\u4e00-\u9fff-]+/g,``).slice(0,48)||`h`,r=n,i=2;for(;t&&t.has(r);)r=`${n}-${i}`,i+=1;return t&&t.add(r),r}function Er(e){let t=[],n=new Set,r=!1;for(let i of String(e||``).split(`
32
32
  `)){if(i.startsWith("```")){r=!r;continue}if(r)continue;let e=i.match(/^(#{1,3})\s+(.+)$/);if(!e)continue;let a=e[2].trim();t.push({level:e[1].length,text:a,id:Tr(a,n)})}return t}function Dr(e){return String(e).replace(/[&<>"']/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[e])}function Or(e){let t=br(e),n=Object.keys(t);return n.length?`<div class="mdw-fm">${n.map(e=>`<div class="mdw-fm-row"><span class="mdw-fm-k">${Dr(e)}</span><span class="mdw-fm-v">${Dr(t[e])}</span></div>`).join(``)}</div>`:``}function kr(e,t){let n=mr(e);return!n||t.has(n)||t.has(n.split(`/`).pop())}function Ar(e,t){return Dr(e).replace(/`([^`]+)`/g,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/g,`<b>$1</b>`).replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g,(e,t,n)=>{let r=String(n??``).trim();return c(r)?`<img class="md-att-img" src="/api/file/content/${r}" alt="${t}">`:e}).replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(e,t,n)=>{let r=String(n??``).trim();return c(r)?`<a class="md-att" href="/api/file/content/${r}" download="${t}" title="附件:${t}">${t}</a>`:e}).replace(/\[\[([^\[\]|]+)(?:\|([^\[\]]+))?\]\]/g,(e,n,r)=>{let i=n.trim(),a=(r||n).trim(),o=t&&!kr(i,t);return`<a class="md-wl${o?` md-wl-miss`:``}" data-wl="${Dr(i)}" title="${o?`未解析:`:`双链:`}${Dr(i)}">${Dr(a)}</a>`})}function jr(e,t=[],n=null){let r={};for(let e of t)e.type===`image`&&e.url&&(r[e.name]=e.url);let i=Or(e),a=xr(e).split(`
@@ -46,5 +46,5 @@ Error generating stack: `+e.message+`
46
46
  `);r.push(Fr(e)),i=[]};for(let e=0;e<n.length;e++){let t=n[e];if(t===`​`){i.length&&a(),r.push(``);continue}if(!t.trim()){i.length&&a();continue}if(!r.length&&!i.length&&t.trim()===`---`){let t=e+1;for(;t<n.length&&n[t].trim()!==`---`;)t+=1;if(t<n.length){let i=n.slice(e,t+1).join(`
47
47
  `);r.push(Pr(i)?``:Fr(i)),e=t;continue}}let o=/^#{1,3}\s/.test(t);o&&i.length&&a(),i.push(t),o&&a()}return i.length&&a(),r.length?r:[``]}function Rr(e){return(e||[]).map(e=>{let t=Fr(e).replace(/[\r\n]+$/g,``);return t?t.trim()?t:`​`+t:`​`}).join(`
48
48
 
49
- `)}function zr(e){let t=Lr(e),n=t.findIndex(e=>/^# (?!#)/.test(String(e).trim()));return n<0?t:t.filter((e,t)=>t!==n)}function Br(e){return Object.keys(br(String(e??``))).length>0}function Vr(e){let t=String(e??``);if(!Object.keys(br(t)).length)return 0;let n=t.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);return n?n[0].length:0}function Hr(e,t){if(!t)return Rr(e);let n=[],r=0;return e[0]&&Br(e[0])&&(n.push(e[0]),r=1),n.push(t),n.push(...e.slice(r)),Rr(n)}function Ur(e,t,n={}){let r=String(t||``),i=String(e||``);if(!r)return{body:i,insertAt:i.length};if(n.mode===`live`){let e=Lr(i),t=e.findIndex(e=>/^# (?!#)/.test(String(e).trim())),a=t>=0?e[t]:null,o=zr(i),s=n.focusIndex;if(s==null||s<0||!o.length){let e=r.replace(/^\n+/,``).replace(/\n+$/,``);o.push(e);let t=Hr(o,a);return{body:t,insertAt:Math.max(0,t.length-e.length)}}if(s=Math.min(s,o.length-1),Br(o[s])){let e=r.replace(/^\n+/,``).replace(/\n+$/,``);s+1<o.length?o[s+1]=e+(o[s+1]?`\n${o[s+1]}`:``):o.push(e);let t=Hr(o,a);return{body:t,insertAt:Vr(t)}}let c=o[s]||``,l=n.caretInBlock,u=l==null?c.length:Math.min(Math.max(0,l),c.length);o[s]=c.slice(0,u)+r+c.slice(u);let d=Hr(o,a),f=[];return a&&o[0]&&Br(o[0])?f.push(o[0],a,...o.slice(1,s)):a?f.push(a,...o.slice(0,s)):f.push(...o.slice(0,s)),{body:d,insertAt:(f.length?`${Rr(f)}\n\n`:``).length+u}}let a=n.insertAt;if(a==null||a<0)return{body:i+r,insertAt:i.length};a=Math.min(Math.max(0,a),i.length);let o=Vr(i);return a<o&&(a=o),{body:i.slice(0,a)+r+i.slice(a),insertAt:a}}var Wr=[`接收`,`解析`,`执行`,`验证`,`回填`];function Gr(e){let t=Cr(e.text||``,String(e.id)),n=e.status===`consumed`||!!e.consumedAt,r=n?String(e.consumedAt||``):``;return e.deletedAt?{id:e.id,title:t,status:`done`,pct:100,stageIdx:4,detail:`已删除`,receivedAt:r}:e.migratedTo?{id:e.id,title:t,status:`done`,pct:100,stageIdx:4,detail:`已迁移 → ${e.migratedTo}`,receivedAt:r}:e.completedAt?{id:e.id,title:t,status:`done`,pct:100,stageIdx:4,detail:e.roundSummary?String(e.roundSummary).slice(0,48):`已回填`,receivedAt:r}:n?{id:e.id,title:t,status:`run`,pct:55,stageIdx:2,detail:`执行中 / 待回填`,receivedAt:r}:{id:e.id,title:t,status:`wait`,pct:12,stageIdx:0,detail:`待领取`,receivedAt:``}}var Kr=`__GLOBAL__`;function qr(e,t,n,r,i=``){let a=String(i||``).trim().toLowerCase(),o=new Set(r.hidden||[]),s=new Map;for(let e of n||[]){if(e.isGlobal)continue;let t=e.repo&&e.repo.id;t&&(s.has(t)||s.set(t,[]),s.get(t).push(e))}let c=(e||[]).filter(e=>!o.has(e.key||e.id)).map(e=>{let t=s.get(e.id)||[];return{type:`repo`,key:e.key||e.id,repoId:e.id,topicKey:t.length?t[0].key:``,name:e.name,icon:e.icon||``,cwd:e.path||``,desc:e.desc||``,boards:e.boards||[],summary:t.map(e=>e.summary).filter(Boolean).join(` / `),pending:t.reduce((e,t)=>e+(t.pending||0),0),waiting:t.some(e=>e.waiting),topics:t}}),l=new Map(c.map(e=>[e.key,e])),u=e=>!a||String(e.name||``).toLowerCase().includes(a)||String(e.key||``).toLowerCase().includes(a)||String(e.cwd||``).toLowerCase().includes(a)||String(e.desc||``).toLowerCase().includes(a)||String(e.summary||``).toLowerCase().includes(a),d=c.filter(u),f=[],p=t||[];for(let e of p){let t=(e.repos||[]).map(e=>l.get(e.key)).filter(Boolean),n=t.some(u);(!a||u(e)||n)&&f.push({type:`board`,id:e.id,key:e.key||e.id,name:e.name,desc:e.desc||``,count:(e.repos||[]).length,pending:t.reduce((e,t)=>e+(t.pending||0),0),waiting:t.some(e=>e.waiting),members:(e.repos||[]).map(e=>e.key)})}let m=new Set;for(let e of p)for(let t of e.repos||[])m.add(t.key);for(let e of d)m.has(e.key)||f.push({...e,groupId:``});let h=new Map((r.order||[]).map((e,t)=>[e,t])),g=new Map;p.forEach((e,t)=>g.set(e.id,t));let _=p.length,v=e=>e.type===`board`?g.has(e.id)?g.get(e.id):_:e.groupId&&g.has(e.groupId)?g.get(e.groupId):_,y=f.map((e,t)=>({r:e,i:t})).sort((e,t)=>{let n=h.has(Jr(e.r))?h.get(Jr(e.r)):1/0,r=h.has(Jr(t.r))?h.get(Jr(t.r)):1/0;if(n!==r)return n-r;let i=v(e.r),a=v(t.r);if(i!==a)return i-a;let o=e.r.type===`board`?0:1,s=t.r.type===`board`?0:1;return o===s?String(e.r.name||``).localeCompare(String(t.r.name||``)):o-s}).map(e=>e.r),b=(n||[]).find(e=>e.isGlobal),x=[];return b&&x.push({type:`global`,key:Kr,name:b.name||`全局任务`,topic:b,pending:b.pending||0,waiting:!!b.waiting,topics:(b.tasks||[]).filter(e=>!e.deletedAt)}),x.push(...y),{rows:x,matchCount:a?x.filter(e=>e.type===`board`||e.type===`repo`&&!e.groupId).length:0}}function Jr(e){return e.type===`board`?`board:`+e.id:e.key}function Yr(e){let t=xr(String(e?.text||``)),n=t.match(/^#\s+(.+)$/m);return n?n[1].trim().slice(0,40):(t.split(`
50
- `).find(e=>e.trim())||`#${e?.id}`).trim().slice(0,40)}function Xr(e,t){let n=t.getBoundingClientRect(),r=e.clientY-n.top,i=n.height;return r<i*.3?`before`:r>i*.7?`after`:`into`}function Zr(e,t,n){return e?e.type===`repo`?t.type===`board`?n===`into`:t.type===`repo`?n===`before`||n===`after`:!1:e.type===`board`&&t.type===`board`&&t.id!==e.id&&(n===`before`||n===`after`):!1}function Qr(e,t,n,r){let i=[...e.order||[]],a=e=>e.type===`board`?`board:`+e.id:e.key;if(t.type===`repo`&&n.type===`repo`){let e=i.filter(e=>e!==a(t)),o=e.indexOf(a(n));return o<0?{order:i}:(e.splice(r===`before`?o:o+1,0,a(t)),{order:e})}if(t.type===`board`&&n.type===`board`){let e=i.filter(e=>e!==a(t)),o=e.indexOf(a(n));return o<0?{order:i}:(e.splice(r===`before`?o:o+1,0,a(t)),{order:e})}return{}}async function $r({row:e,onNavigate:t,refreshLocal:n,toast:r,draft:i=!1}){let a=e=>i?`${e}?task=draft`:e;if(e.type===`global`||e.topicKey){t(a(e.type===`global`?`#/global`:`#/dir/${encodeURIComponent(e.topicKey)}`));return}if(!e.cwd){r&&r(`「${e.name}」没有目录路径,无法创建任务队列`);return}try{let i=await Yt(`/api/localtasks/topic`,{method:`POST`,body:{cwd:e.cwd}});await n?.(),i&&i.existed===!1&&r&&r(`已为「${e.name}」创建任务队列`),t(a(`#/dir/${encodeURIComponent(i.key)}`))}catch(e){r&&r(`创建任务队列失败: `+(e.message||e))}}function ei({row:e,prefs:t,patchPrefs:n,onNavigate:r,boards:i,onDataChanged:a,refreshLocal:o,toast:s,dialog:c}){if(e.type===`repo`){let c=i||[],l=t=>(e.boards||[]).some(e=>e.key===t.key||e.id===t.id),u=async(t,n)=>{try{await Yt(`/api/boards/assign`,{method:`POST`,body:n?{key:e.key,board:t.key||t.id,remove:!0}:{key:e.key,board:t.key||t.id}}),a&&a()}catch(e){s(`归属变更失败: `+e.message)}};return[{label:`打开详情`,icon:`folder`,onClick:()=>$r({row:e,onNavigate:r,refreshLocal:o,toast:s})},{label:`置顶`,icon:`pin`,onClick:()=>n({order:[e.key,...(t.order||[]).filter(t=>t!==e.key)]})},`sep`,...c.map(e=>({label:(l(e)?`✓ `:``)+(l(e)?`移出「`:`归入「`)+e.name+`」`,icon:`folder`,onClick:()=>u(e,l(e))})),`sep`,{label:`从侧边栏隐藏(不删登记)`,icon:`x`,onClick:()=>n(t=>({hidden:[...t.hidden||[],e.key]}))}]}return e.type===`board`?[{label:`在仓库页打开该看板`,icon:`repo`,onClick:()=>r(`#/repos`)},`sep`,{label:`删除看板(成员仓库回到未分组)`,icon:`trash`,danger:!0,onClick:async()=>{if(await c({title:`删除看板「${e.name}」`,message:`它的 ${e.count} 个仓库会回到未分组(登记不动)。`,danger:!0,okText:`删除`}))try{await Yt(`/api/boards/${encodeURIComponent(e.id)}`,{method:`DELETE`,body:{}}),a&&a()}catch(e){s(`删除失败: `+e.message)}}}]:[{label:`打开全局任务池`,icon:`globe`,onClick:()=>r(`#/global`)}]}function ti({dialog:e,toast:t,onDataChanged:n}){return[{label:`登记仓库…`,icon:`folder`,onClick:async()=>{let r=await e({title:`登记仓库`,input:!0,placeholder:`仓库绝对路径,如 D:/a_js/js_proj/nx-kv`});if(r)try{await Yt(`/api/repos`,{method:`POST`,body:{path:r.trim()}}),t(`已登记仓库 `+r.trim()),n&&n()}catch(e){t(`登记失败: `+e.message)}}},{label:`新建看板(项目组)…`,icon:`plus`,onClick:async()=>{let r=await e({title:`新建看板`,input:!0,placeholder:`看板名,如 前端 / nx 家族`});if(r)try{await Yt(`/api/boards`,{method:`POST`,body:{name:r.trim()}}),t(`已新建看板 `+r.trim()),n&&n()}catch(e){t(`新建失败: `+e.message)}}}]}function ni(e,t){let n=Array.isArray(e)?e:[],[r,i]=(0,g.useState)(0),a=Math.max(1,Number(t)||1),o=Math.max(1,Math.ceil(n.length/a)),s=Math.min(Math.max(0,r),o-1),c=s*a;return{page:s,pageCount:o,total:n.length,items:n.slice(c,c+a),setPage:i}}function ri({page:e=0,pageCount:t=1,total:n=0,onPage:r,unit:i=`条`}){let a=e=>r&&r(Math.max(0,Math.min(e,t-1)));return t<=1?(0,_.jsxs)(`span`,{className:`pager-n`,children:[`共 `,n,` `,i]}):(0,_.jsxs)(`span`,{className:`pager`,children:[(0,_.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:e<=0,onClick:()=>a(e-1),"aria-label":`上一页`,title:`上一页`,children:`‹`}),(0,_.jsxs)(`span`,{className:`pager-n`,children:[`第 `,e+1,`/`,t,` 页 · 共 `,n,` `,i]}),(0,_.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:e>=t-1,onClick:()=>a(e+1),"aria-label":`下一页`,title:`下一页`,children:`›`})]})}var ii=12;function ai({row:e,onNavigate:t,refreshLocal:n,limit:r=ii}){let i=l(),a=ni((0,g.useMemo)(()=>ln(e.type===`global`?e.tasks||[]:(e.topics||[]).flatMap(e=>(e.tasks||[]).filter(e=>!e.deletedAt))),[e]),r),o=a.items,c=e.type===`global`?`#/global`:`#/dir/${encodeURIComponent(e.topicKey||e.key)}`;return(0,_.jsxs)(_.Fragment,{children:[o.map(n=>(0,_.jsxs)(`button`,{type:`button`,className:`trow child task-child`,title:String(n.text||``).slice(0,200),onClick:e=>{e.stopPropagation(),t(`${c}?task=${encodeURIComponent(n.id)}`)},children:[(0,_.jsx)(`span`,{className:`gico`,children:(0,_.jsx)(s,{name:`list`,size:12})}),(0,_.jsx)(`span`,{className:`nm`,children:Yr(n)}),(0,_.jsx)(`span`,{className:`cnt`,children:n.status===`consumed`?`完`:n.from?`跑`:`等`})]},`${e.topicKey||e.key}:t:${n.id}`)),a.pageCount>1&&(0,_.jsx)(`div`,{className:`trow child task-pager`,children:(0,_.jsx)(ri,{page:a.page,pageCount:a.pageCount,total:a.total,onPage:a.setPage,unit:`条任务`})}),(0,_.jsxs)(`button`,{type:`button`,className:`trow child task-new`,title:`新建一页 MD(新页签打开;仓库还没有任务队列时先创建队列)`,onClick:r=>{r.stopPropagation(),$r({row:e,onNavigate:t,refreshLocal:n,toast:i,draft:!0})},children:[(0,_.jsx)(`span`,{className:`gico`,children:(0,_.jsx)(s,{name:`plus`,size:12})}),(0,_.jsx)(`span`,{className:`nm`,children:`新建页`})]})]})}function oi({repos:e,boards:t,topics:n,route:r,onNavigate:o,refreshLocal:c,waitingCount:u,prefs:d,patchPrefs:f,refreshRepos:p,onCollapse:m,onClose:h,shell:v}){let y=l(),{dialog:b,node:x}=a(),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)(-1),[O,k]=(0,g.useState)(()=>new Set),A=(0,g.useRef)(null),[j,M]=(0,g.useState)(null),N=(0,g.useRef)(null),{rows:P,matchCount:F}=(0,g.useMemo)(()=>qr(e,t,n,d,S),[e,t,n,d,S]),I=e=>e.type===`global`?r.view===`global`:e.type===`repo`?r.view===`dir`&&r.key===e.topicKey:e.type===`board`&&r.view===`group`&&r.key===e.id;(0,g.useEffect)(()=>{r.view===`dir`&&r.key&&k(e=>{if(e.has(r.key))return e;let t=new Set(e);return t.add(r.key),t})},[r.view,r.key]);let ee=(0,g.useCallback)(e=>{k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),te=(0,g.useCallback)(e=>{e.type===`board`?o(`#/group/`+encodeURIComponent(e.id)):e.type===`global`?o(`#/global`):e.topicKey?o(`#/dir/`+encodeURIComponent(e.topicKey)):$r({row:e,onNavigate:o,refreshLocal:c,toast:y})},[o,c,y]),ne=(0,g.useCallback)(e=>{e.type===`global`?o(`#/global`):ee(e.topicKey||e.key)},[o,ee]),re=e=>{w||(e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),D(t=>t<0?e.key===`ArrowDown`?0:P.length-1:Math.min(P.length-1,Math.max(0,t+(e.key===`ArrowDown`?1:-1))))):e.key===`Home`?(e.preventDefault(),D(0)):e.key===`End`?(e.preventDefault(),D(P.length-1)):e.key===`Enter`?E>=0&&P[E]&&te(P[E]):e.key===`Escape`&&D(-1))},ie=(e,t)=>{A.current={type:t.type,key:t.key,id:t.id,name:t.name},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.type+`:`+(t.key||t.id)),e.currentTarget.classList.add(`dragging`)},ae=e=>{A.current=null,M(null),e.currentTarget?.classList?.remove(`dragging`)},oe=(e,t)=>{if(!A.current)return;e.preventDefault();let n=Xr(e,e.currentTarget);Zr(A.current,t,n)?(e.dataTransfer.dropEffect=`move`,M({id:t.key||t.id,zone:n})):M(null)},se=()=>M(e=>e&&null),L=(e,t)=>{e.preventDefault();let n=A.current;if(A.current=null,M(null),!n)return;let r=Xr(e,e.currentTarget);Zr(n,t,r)&&f(Qr(d,n,t,r))},ce=e=>{let t=A.current;if(A.current=null,M(null),!t||t.type!==`repo`)return;e.preventDefault();let n=t.key,r=(d.order||[]).filter(e=>e!==n);r.push(n),f({order:r})},le=(e,n)=>{e.preventDefault(),e.stopPropagation(),T({x:e.clientX,y:e.clientY,items:ei({row:n,prefs:d,patchPrefs:f,onNavigate:o,boards:t,onDataChanged:p,refreshLocal:c,toast:y,dialog:b})})},ue=e=>{T({x:e.clientX,y:e.clientY,items:ti({dialog:b,toast:y,onDataChanged:p})})},de=(e,t,n)=>(0,_.jsxs)(`button`,{className:`trow`+(r.view===e.replace(`#/`,``)?` active`:``),onClick:()=>o(e),children:[(0,_.jsx)(`span`,{className:`gico`,children:(0,_.jsx)(s,{name:t})}),(0,_.jsx)(`span`,{className:`nm`,children:n})]});return(0,_.jsxs)(`aside`,{id:`side`,children:[(0,_.jsxs)(`div`,{className:`shead`,children:[(0,_.jsxs)(`div`,{className:`brandrow`,children:[(0,_.jsx)(`span`,{className:`nx-logo`,"aria-hidden":!0,children:`nx`}),(0,_.jsx)(`span`,{className:`nx-title`,children:`nx-kv`}),(0,_.jsx)(`span`,{className:`grow`}),(0,_.jsx)(`button`,{className:`iconbtn undo`,title:`撤销上一次布局操作`,"aria-label":`撤销上一次布局操作`,disabled:!v||!v.canUndo,onClick:v&&v.undo,children:`↶`}),(0,_.jsx)(`button`,{className:`iconbtn redo`,title:`重做`,"aria-label":`重做`,disabled:!v||!v.canRedo,onClick:v&&v.redo,children:`↷`}),(0,_.jsx)(`button`,{className:`iconbtn`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>v&&v.openSettings(),children:(0,_.jsx)(s,{name:`gear`,size:15})}),(0,_.jsx)(`button`,{className:`iconbtn collapse`,title:`收起目录(变窄轨;点窄轨可展开)`,"aria-label":`收起目录`,onClick:m,children:(0,_.jsx)(s,{name:`back`,size:15})}),(0,_.jsx)(`button`,{className:`iconbtn collapse`,title:`关闭目录(完全隐藏,左缘把手可展开)`,"aria-label":`关闭目录`,onClick:h,children:(0,_.jsx)(s,{name:`x`,size:14})})]}),(0,_.jsxs)(`div`,{className:`searchrow`,children:[(0,_.jsxs)(`label`,{className:`sbox`,children:[(0,_.jsx)(s,{name:`search`}),(0,_.jsx)(`input`,{value:S,placeholder:`搜索仓库(命中自动展开)`,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`&&C(``)}})]}),S&&(0,_.jsxs)(`span`,{className:`kwcount`,children:[F,` 个匹配`]}),(0,_.jsx)(`button`,{className:`iconbtn add`,title:`添加目录 / 新建分组`,"aria-label":`添加目录或新建分组`,onClick:ue,children:(0,_.jsx)(s,{name:`plus`})})]})]}),(0,_.jsxs)(`div`,{id:`tree`,ref:N,tabIndex:0,onKeyDown:re,onDragOver:e=>{A.current?.type===`repo`&&e.preventDefault()},onDrop:ce,children:[P.map((e,t)=>e.type===`board`?(0,_.jsxs)(`button`,{className:`trow group`+(I(e)?` active`:``)+(E===t?` kb-focus`:``),onClick:()=>te(e),onContextMenu:t=>le(t,e),draggable:!0,onDragStart:t=>ie(t,e),onDragEnd:ae,onDragOver:t=>oe(t,e),onDragLeave:se,onDrop:t=>L(t,e),"data-drop":j?.id===e.id?j.zone:void 0,title:`${e.name} · ${e.count} 个目录\n${e.desc||`项目组:点进去操作组下的项目`}`,children:[(0,_.jsx)(`span`,{className:`tw`,"aria-hidden":!0}),(0,_.jsx)(`span`,{className:`gico`,children:(0,_.jsx)(s,{name:`folder`})}),(0,_.jsxs)(`span`,{className:`nm`,children:[e.name,e.waiting?(0,_.jsx)(`span`,{className:`wdot`,title:`组内有 agent 等待回填`}):null]}),(0,_.jsx)(`span`,{className:`cnt`,title:`待领取 ${e.pending} · 成员 ${e.count} 个`,children:e.pending>0?e.pending:e.count}),(0,_.jsx)(`span`,{className:`more`,role:`button`,tabIndex:-1,"aria-label":`看板菜单`,onClick:t=>le(t,e),children:(0,_.jsx)(s,{name:`dots`,size:13})})]},`b:`+e.id):(0,_.jsxs)(`div`,{className:`tblock`,children:[(0,_.jsxs)(`button`,{className:`trow`+(e.type===`repo`&&e.groupId?` child`:``)+(e.type===`repo`&&O.has(e.topicKey)?` open`:``)+(I(e)?` active`:``)+(e.pending>0?` pinned`:``)+(E===t?` kb-focus`:``),onClick:()=>te(e),onContextMenu:t=>le(t,e),title:e.cwd?`${e.name}\n${e.cwd}\n${e.desc||e.summary||``}`:e.name,draggable:!0,onDragStart:t=>ie(t,e),onDragEnd:ae,onDragOver:t=>oe(t,e),onDragLeave:se,onDrop:t=>L(t,e),"data-drop":j?.id===e.key?j.zone:void 0,children:[(0,_.jsx)(`span`,{className:`tw`,role:`button`,tabIndex:-1,"aria-label":`展开子任务`,onClick:t=>{t.stopPropagation(),ne(e)},children:(0,_.jsx)(s,{name:`chevron`,size:10})}),(0,_.jsx)(`span`,{className:`gico`,children:e.icon?(0,_.jsx)(`span`,{className:`trow-icon`,"aria-hidden":!0,children:e.icon}):(0,_.jsx)(s,{name:e.type===`global`?`globe`:`folder`})}),(0,_.jsxs)(`span`,{className:`nm`,children:[e.name,e.type===`global`&&e.waiting?(0,_.jsx)(`span`,{className:`wdot`,title:`有等待中的主题`}):null]}),e.pending>0&&(0,_.jsx)(`span`,{className:`cnt`,children:e.pending}),e.type===`repo`&&e.waiting&&(0,_.jsx)(`span`,{className:`wdot`,title:`agent 等待回填中`}),(0,_.jsx)(`span`,{className:`more`,role:`button`,tabIndex:-1,"aria-label":`行菜单`,onClick:t=>le(t,e),children:(0,_.jsx)(s,{name:`dots`,size:13})})]}),(e.type===`global`?I(e):O.has(e.topicKey||e.key))&&(0,_.jsx)(ai,{row:e,onNavigate:o,refreshLocal:c})]},e.type+`:`+e.key)),!P.length&&(0,_.jsx)(`div`,{className:`tree-empty`,children:S?`没有匹配的仓库`:`还没有登记仓库:点右上 + 登记,或去「仓库管理」`}),(0,_.jsx)(`div`,{className:`droptail`,"aria-hidden":`true`})]}),(0,_.jsxs)(`div`,{className:`sfoot`,children:[de(`#/overview`,`overview`,`全部目录总览`),de(`#/cloud`,`cloud`,`云端总览`),de(`#/repos`,`repo`,`仓库管理`),u>0&&(0,_.jsxs)(`button`,{className:`trow`,onClick:()=>o(`#/overview`),title:`有 agent 正在等待回填`,children:[(0,_.jsx)(`span`,{className:`gico`,children:(0,_.jsx)(s,{name:`warn`})}),(0,_.jsxs)(`span`,{className:`nm`,children:[u,` 个 agent 等待回填`]})]})]}),w&&(0,_.jsx)(i,{x:w.x,y:w.y,items:w.items,onClose:()=>T(null)}),x]})}var si=46,ci=120;function li(e){let t=e&&lr(e,`sidebar`);if(!t)return`expanded`;let n=e.getNodeById?e.getNodeById(t):null;return Dn(n?typeof n.getWeight==`function`?n.getWeight():Number(n.getAttributes()?.weight)||0:0)}function ui(){let e=on()||{},{model:t}=e,[n,r]=(0,g.useState)(()=>li(t)),[i,a]=(0,g.useState)(null),o=(0,g.useCallback)(e=>a(e),[]),c=(0,g.useRef)(null),l=(0,g.useCallback)(e=>{if(!t)return;let n=lr(t,`sidebar`);n&&dr(t,n,kn(e))},[t]),u=(0,g.useCallback)(e=>{c.current={state:e,until:Date.now()+600},l(e),r(e)},[l]),d=(0,g.useCallback)(()=>u(`collapsed`),[u]),f=(0,g.useCallback)(()=>u(`expanded`),[u]),p=(0,g.useCallback)(()=>u(`closed`),[u]);(0,g.useEffect)(()=>{if(!i||window.ResizeObserver===void 0)return;let e=new window.ResizeObserver(e=>{for(let t of e){let e=Math.round(t.contentRect.width);r(t=>{let n=c.current;if(n){if(Date.now()>n.until)c.current=null;else if(n.state===`closed`)return`closed`;else if(n.state===`expanded`)return e>=ci&&(c.current=null),`expanded`;else if(n.state===`collapsed`)return e<si&&(c.current=null),`collapsed`}return t===`closed`?t:e<si?`collapsed`:e>=ci?`expanded`:t})}});return e.observe(i),()=>e.disconnect()},[i]),(0,g.useEffect)(()=>{if(n!==`closed`||!t)return;let e=setInterval(()=>{let e=lr(t,`sidebar`),n=e&&t.getNodeById?t.getNodeById(e):null;Dn(n?typeof n.getWeight==`function`?n.getWeight():Number(n.getAttributes()?.weight)||0:0)===`expanded`&&(c.current=null,r(`expanded`))},200);return()=>clearInterval(e)},[n,t]);let m=(0,g.useRef)(null);return(0,g.useEffect)(()=>{if(m.current===null){m.current=n;return}m.current!==n&&(m.current=n,l(n))},[n,l]),(0,g.useEffect)(()=>(document.body.classList.toggle(`nx-side-is-closed`,n===`closed`),()=>document.body.classList.remove(`nx-side-is-closed`)),[n]),n===`closed`?(0,_.jsx)(`div`,{ref:o,className:`nx-side-closed-host`,"aria-hidden":!0}):n===`collapsed`?(0,_.jsxs)(`div`,{ref:o,className:`nx-rail-host`,children:[(0,_.jsxs)(`button`,{className:`nx-rail`,title:`展开目录`,"aria-label":`展开目录`,onClick:f,children:[(0,_.jsx)(`span`,{className:`nx-rail-btn`,"aria-hidden":!0,children:`»`}),(0,_.jsx)(`span`,{className:`nx-rail-label`,children:`目录`})]}),(0,_.jsxs)(`div`,{className:`nx-rail-acts`,children:[(0,_.jsx)(`button`,{className:`nx-rail-act`,title:`关闭目录(完全隐藏,左缘把手可展开)`,"aria-label":`关闭目录`,onClick:p,children:(0,_.jsx)(s,{name:`x`,size:14})}),(0,_.jsx)(`button`,{className:`nx-rail-act`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>e.shell&&e.shell.openSettings(),children:(0,_.jsx)(s,{name:`gear`,size:15})})]})]}):(0,_.jsx)(`div`,{ref:o,className:`nx-side-host`,children:(0,_.jsx)(oi,{repos:e.repoData?e.repoData.repos:[],boards:e.repoData?e.repoData.boards:[],topics:e.rows||[],route:e.route,onNavigate:e.onNavigate,refreshLocal:e.refreshLocal,refreshRepos:e.refreshRepos,prefs:e.prefs,patchPrefs:e.patchPrefs,onCollapse:d,onClose:p,shell:e.shell})})}var di=`modulepreload`,fi=function(e){return`/`+e},pi={},mi=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=fi(t,n),t=s(t),t in pi)return;pi[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:di,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},hi=(0,g.lazy)(()=>mi(()=>import(`./dir-DgWqKcbC.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),gi=(0,g.lazy)(()=>mi(()=>import(`./task-BqQw-96B.js`),__vite__mapDeps([10,1,2,3,11,5,8,7]))),_i=(0,g.lazy)(()=>mi(()=>import(`./progress-Ck-s4Ypp.js`),__vite__mapDeps([12,1,2]))),vi=(0,g.lazy)(()=>mi(()=>import(`./group-ji7zeaXJ.js`),__vite__mapDeps([13,1,2,3,6,7,8,9,14]))),yi=(0,g.lazy)(()=>mi(()=>import(`./repos-A2URD6SC.js`),__vite__mapDeps([15,1,2,3,7,8,6,9,14]))),bi=(0,g.lazy)(()=>mi(()=>import(`./cloud-BJbs3IuB.js`),__vite__mapDeps([16,1,2,3,11]))),xi=(0,g.lazy)(()=>mi(()=>import(`./overview-BNovkb_k.js`),__vite__mapDeps([17,1,2,3]))),Si=(0,g.lazy)(()=>mi(()=>import(`./templates-CHvZ38Vw.js`),__vite__mapDeps([18,1,2,3,8,19,20]))),Ci=(0,g.lazy)(()=>mi(()=>import(`./Introduction-Dr99GN_o.js`).then(e=>e.n),__vite__mapDeps([6,1,2,7,8,9]))),wi=(0,g.lazy)(()=>mi(()=>import(`./settings-DNZkV_Be.js`),__vite__mapDeps([21,1,2,19,20,22]))),Ti=(0,g.lazy)(()=>mi(()=>import(`./dag-DBydHtGQ.js`),__vite__mapDeps([23,1,2,4]))),Ei=e=>(0,_.jsx)(g.Suspense,{fallback:(0,_.jsx)(`div`,{className:`pad muted`,children:`加载中…`}),children:e});function Di(){return(0,_.jsxs)(`div`,{className:`pad stack welcome`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`strong`,{children:`从左边目录选一个项目组或目录`}),`——选中的内容显示在中间主内容区。`]}),(0,_.jsx)(`div`,{className:`hint`,children:`主内容区一次只放一块面板(顶部面包屑告诉你现在在哪);设置这类临时面板以浮窗形式出现。`}),(0,_.jsx)(`div`,{className:`hint`,children:`目录在左、并发进程在右;两边都能收起或关掉,需要时再开。`})]})}function Oi({dirKey:e}){return Ei((0,_.jsx)(hi,{dirKey:e}))}function ki({dirKey:e,task:t,beside:n,tabId:r,model:i}){return Ei((0,_.jsx)(gi,{dirKey:e,task:t,beside:!!n,tabId:r,model:i}))}function Ai({dirKey:e,task:t,groupKey:n}){let r=on()||{},i=n&&(r.repoData&&r.repoData.boards||[]).find(e=>e&&(e.id===n||e.key===n))||null;return Ei((0,_.jsx)(_i,{dirKey:e,task:t,group:i,rows:r.rows,refreshLocal:r.refreshLocal,model:r.model,onOpenTask:(t,n)=>r.openPage&&r.openPage({dirKey:n||e,task:String(t),name:`#${t}`}),onClosePage:e=>r.closePanel&&r.closePanel(e)}))}function ji({boardId:e,model:t}){let n=on()||{};return Ei((0,_.jsx)(vi,{dirKey:e,rows:n.rows,repoData:n.repoData,onNavigate:n.onNavigate,refreshLocal:n.refreshLocal,model:t||n.model}))}function Mi(){let e=on()||{};return Ei((0,_.jsx)(xi,{rows:e.rows,onNavigate:e.onNavigate,refreshLocal:e.refreshLocal}))}var Ni={sidebar:{title:`目录`,render:()=>(0,_.jsx)(ui,{})},welcome:{title:`开始`,render:()=>(0,_.jsx)(Di,{})},dir:{title:`目录`,render:e=>(0,_.jsx)(Oi,{dirKey:e&&e.dirKey})},page:{title:`页面`,render:(e,t)=>(0,_.jsx)(ki,{dirKey:e&&e.dirKey,task:e&&e.task,beside:e&&e.beside,tabId:t&&t.tabId,model:t&&t.model})},progress:{title:`进程`,render:e=>(0,_.jsx)(Ai,{dirKey:e&&e.dirKey,task:e&&e.task,groupKey:e&&e.groupKey})},group:{title:`项目组`,render:(e,t)=>(0,_.jsx)(ji,{boardId:e&&e.boardId,model:t&&t.model})},repos:{title:`仓库管理`,render:()=>Ei((0,_.jsx)(yi,{}))},cloud:{title:`云端总览`,render:()=>Ei((0,_.jsx)(bi,{}))},overview:{title:`全部目录总览`,render:()=>(0,_.jsx)(Mi,{})},templates:{title:`任务模板`,render:()=>Ei((0,_.jsx)(Si,{}))},doc:{title:`文档`,render:(e,t)=>Ei((0,_.jsx)(Ci,{docId:e&&e.docId,repoKey:e&&e.repoKey,boardKey:e&&e.boardKey,boardName:e&&e.boardName,tabId:t&&t.tabId,model:t&&t.model}))},settings:{title:`设置`,render:()=>Ei((0,_.jsx)(wi,{}))},dag:{title:`编排`,render:e=>Ei((0,_.jsx)(Ti,{dirKey:e&&e.dirKey,groupId:e&&e.groupId}))}};function Pi(e){return e?cr(e,{component:`settings`,name:`设置`,config:{}}):null}function Fi(e){let t=Ni[e.getComponent()];return t?t.render(e.getConfig()||{},{tabId:e.getId(),model:e.getModel(),node:e}):(0,_.jsxs)(`div`,{className:`muted`,style:{padding:12},children:[`未知面板:`,e.getComponent()]})}function Ii(e){if(!e)return null;let t=e.getConfig()||{};switch(e.getComponent()){case`page`:return t.beside?null:`#/dir/${encodeURIComponent(t.dirKey||``)}?task=${encodeURIComponent(t.task||``)}`;case`dir`:return t.dirKey===`__GLOBAL__`?`#/global`:`#/dir/${encodeURIComponent(t.dirKey||``)}`;case`group`:return`#/group/${encodeURIComponent(t.boardId||``)}`;case`repos`:return`#/repos`;case`cloud`:return`#/cloud`;case`overview`:return`#/overview`;case`templates`:return`#/templates`;default:return null}}function Li(e){let t=String(e&&e.task||``);if(!t.startsWith(`draft`))return``;let n=Sn(_n(gn(e.key),t));return String(n&&n.title||``).trim()}function Ri(e,t={}){if(!e)return null;switch(e.view){case`dir`:return e.task?{component:`page`,name:t.pageTitle||Li(e)||`页 ${e.task}`,config:{dirKey:e.key,task:e.task}}:{component:`dir`,name:t.dirName||`目录`,config:{dirKey:e.key}};case`group`:return{component:`group`,name:t.boardName||`项目组`,config:{boardId:e.key}};case`repos`:return{component:`repos`,name:`仓库管理`,config:{}};case`cloud`:return{component:`cloud`,name:`云端总览`,config:{}};case`overview`:return{component:`overview`,name:`全部目录总览`,config:{}};case`templates`:return{component:`templates`,name:`任务模板`,config:{}};default:return null}}var zi=[{label:`任务`,items:[{token:`task.id`,desc:`任务号`},{token:`task.text`,desc:`任务正文`},{token:`task.title`,desc:`任务标题`}]},{label:`时间目标`,items:[{token:`goal.name`,desc:`目标名`},{token:`goal.deadline`,desc:`截止时间`},{token:`goal.remainingHuman`,desc:`剩余时长(人话)`},{token:`goal.prompt`,desc:`目标的附加要求`}]},{label:`本次上下文`,items:[{token:`source`,desc:`来源(local/global)`},{token:`summary`,desc:`本轮现状`},{token:`cwd`,desc:`工作目录`},{token:`name`,desc:`主题名`}]}],Bi=[{label:`任务段(无任务时整段消失)`,token:`{{#task}}…{{/task}}`},{label:`目标段(无目标时整段消失)`,token:`{{#goal}}…{{/goal}}`}];zi.flatMap(e=>e.items.map(e=>[e.token,e.desc])).reduce((e,[t,n])=>Object.assign(e,{[t]:n}),{});function Vi(e,t,n){let r=String(e??``),i=Number.isInteger(n)&&n>=0&&n<=r.length?n:r.length;return{text:r.slice(0,i)+t+r.slice(i),caret:i+t.length}}function Hi(e){let t=[],n=/\{\{\s*([A-Za-z0-9_.]+)\s*\}\}/g,r=n.exec(String(e??``));for(;r;)t.includes(r[1])||t.push(r[1]),r=n.exec(String(e??``));return t}function Ui(e){let t=[],n=/\{\{\s*([^}{\s][^{}]*?)\s*\}\}/g,r=n.exec(String(e??``));for(;r;){let i=r[1].trim();i&&!t.includes(i)&&t.push(i),r=n.exec(String(e??``))}return t}function Wi(e,t){let n=t&&typeof t==`object`?t:{};return String(e??``).replace(/\{\{\s*([^}{\s][^{}]*?)\s*\}\}/g,(e,t)=>{let r=String(t).trim(),i=n[r];return i==null?``:String(i)})}function Gi(){let[e,t]=(0,g.useState)({defaultId:``,templates:null,unsupported:!1}),n=(0,g.useCallback)(async()=>{try{let e=await Yt(`/api/templates`);t({defaultId:e.defaultId,templates:e.templates,unsupported:!1})}catch(e){t(t=>({...t,templates:null,unsupported:String(e.message||e).includes(`接口不存在`)}))}},[]);(0,g.useEffect)(()=>{n()},[n]);let r=(0,g.useCallback)(()=>{let t=(e.templates||[]).find(t=>t.id===e.defaultId);return t?Wi(t.body,{...Nr,...t.values||{}}):Wi(Mr,Nr)},[e]),i=(0,g.useCallback)(async(e,t,r)=>{let i=await Yt(`/api/templates`,{method:`POST`,body:{name:e,body:t,setDefault:r}});return await n(),i},[n]),a=(0,g.useCallback)(async e=>{let t=await Yt(`/api/templates/${encodeURIComponent(e)}`,{method:`DELETE`,body:{}});return await n(),t},[n]),o=(0,g.useCallback)(async(e,t)=>{let r=await Yt(`/api/templates/${encodeURIComponent(e)}`,{method:`PATCH`,body:t});return await n(),r},[n]),s=(0,g.useCallback)(async e=>{let t=await Yt(`/api/templates/default`,{method:`PATCH`,body:{id:e}});return await n(),t},[n]);return{defaultId:e.defaultId,templates:e.templates,unsupported:e.unsupported,defaultBody:r,refetch:n,add:i,remove:a,update:o,setDefault:s}}var Ki=`nx-kv-sidebar-v1`,qi={order:[],hidden:[],folded:!1,defaultFolded:!1};function Ji(e){if(!e||typeof e!=`object`)return e;let{groups:t,dirGroups:n,...r}=e;return r}function Yi(){try{let e=localStorage.getItem(Ki);if(!e)return{...qi};let t=Ji(JSON.parse(e)),n={...qi,...t};if(t&&typeof t==`object`&&(`groups`in t||`dirGroups`in t))try{localStorage.setItem(Ki,JSON.stringify(n))}catch{}return n}catch{return{...qi}}}function Xi(e){try{localStorage.setItem(Ki,JSON.stringify(e))}catch{}}function J(e){let t={...Yi(),...typeof e==`function`?e(Yi()):e};return Xi(t),t}function Zi({model:e}){let t=on()||{},[n,r]=(0,g.useState)(!1),i=(0,g.useCallback)(()=>{if(!e){r(!1);return}if(!Jn(e,`sidebar`)){r(!0);return}let t=ur(e,lr(e,`sidebar`));r(Dn(t)===`closed`)},[e]);(0,g.useEffect)(()=>{if(!e)return;i();let t={onAfterAction:()=>i()};e.addChangeListener(t);let n=setInterval(i,400);return()=>{e.removeChangeListener(t),clearInterval(n)}},[e,i]);let a=(0,g.useCallback)(()=>{if(!e)return;let t=lr(e,`sidebar`);t||=fr(e),t&&(dr(e,t,kn(`expanded`)),Un(e))},[e]);return!n||typeof document>`u`?null:(0,v.createPortal)((0,_.jsxs)(`div`,{className:`nx-side-fab-layer nx-side-fab-fixed`,role:`navigation`,"aria-label":`目录已关闭`,children:[(0,_.jsx)(`button`,{type:`button`,className:`nx-side-fab`,title:`展开目录`,"aria-label":`展开目录`,onClick:a,children:(0,_.jsx)(s,{name:`sidebar`,size:14})}),(0,_.jsx)(`button`,{type:`button`,className:`nx-side-fab-gear`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>t.shell&&t.shell.openSettings(),children:(0,_.jsx)(s,{name:`gear`,size:14})})]}),document.body)}var Qi=[];function $i(e){e&&(Qi[Qi.length-1]!==e&&Qi.push(e),Qi.length>30&&Qi.shift())}function ea(){return Qi.length>1?(Qi.pop(),Qi[Qi.length-1]):``}function ta(){let[e,t]=(location.hash||``).replace(/^#\/?/,``).split(`?`),n=new URLSearchParams(t||``).get(`task`)||``;return e.startsWith(`dir/`)?{view:`dir`,key:decodeURIComponent(e.slice(4)),task:n}:e.startsWith(`group/`)?{view:`group`,key:decodeURIComponent(e.slice(6)),task:``}:[`global`,`overview`,`cloud`,`todo`,`repos`,`templates`].includes(e)?{view:e===`todo`?`cloud`:e,key:e===`global`?`__GLOBAL__`:``,task:e===`global`?n:``}:{view:`overview`,key:``,task:``}}var na={close:`关闭`,rename:`重命名`,float:`浮窗`,dock:`停靠`,popout:`弹出到新窗口`,Close:`关闭`,Rename:`重命名`,Float:`浮窗`,Dock:`停靠`,Popout:`弹出到新窗口`,"flexlayout.ui.dock.float.to.layout":`迁回主布局(点按钮直接停靠;也可拖到面板边缘)`,"flexlayout.ui.popout.float.to.window":`弹出到浏览器窗口`,"flexlayout.ui.dock.float.tabs (?)":`迁回 ? 个页签`},ra=e=>na[e]||e;function ia(){let{boot:e}=tn(),t=l(),[n,r]=(0,g.useState)(ta),[i,o]=(0,g.useState)(Yi),[,c]=(0,g.useState)(0),[u,d]=(0,g.useState)(null),f=Gi(),p=(0,g.useRef)(null),{model:m,setModel:h,undo:v,redo:y,canUndo:b,canRedo:x}=qt(()=>Hn(),{ignoreActionTypes:[j.SET_ACTIVE_TABSET,j.DELETE_TABSET]});(0,g.useEffect)(()=>{m&&(window.__nxkv={model:m,Actions:j,DockLocation:O})},[m]);let S=(0,g.useCallback)(e=>o(J(e)),[]);(0,g.useEffect)(()=>{let e=()=>r(ta());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let C=(0,g.useCallback)(e=>{location.hash!==e&&(location.hash=e),r(e=>{let t=ta();return e.view===t.view&&e.key===t.key&&e.task===t.task?e:t})},[]),w=(0,g.useCallback)(async()=>{try{d(await Yt(`/api/localtasks`))}catch{}},[]);(0,g.useEffect)(()=>{w();let e=setInterval(w,15e3);return()=>clearInterval(e)},[w]);let[T,E]=(0,g.useState)({repos:[],boards:[]}),D=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([Yt(`/api/repos`),Yt(`/api/boards`)]);E({repos:(e||[]).filter(e=>(e.type||`dev`)!==`ref`),boards:t&&t.boards||[]})}catch{}},[]);(0,g.useEffect)(()=>{D();let e=setInterval(D,3e4);return()=>clearInterval(e)},[D]),(0,g.useEffect)(()=>{let e=!1,n=async()=>{try{let n=await Yt(`/api/localtasks/presence`),r=Math.max(0,Number(n&&n.waiting)||0);if(e)return;c(e=>(e===0&&r>0&&t(`有 agent 正在等待回填,请查看对应目录`),r))}catch{}};n();let r=setInterval(n,15e3);return()=>{e=!0,clearInterval(r)}},[t]),(0,g.useEffect)(()=>{let e=!1,t=()=>{e||Yt(`/api/ping`).catch(()=>{})};t();let n=setInterval(t,15e3);return()=>{e=!0,clearInterval(n)}},[]);let k=(0,g.useMemo)(()=>u?.topics||[],[u]),A=(0,g.useRef)(!1);(0,g.useEffect)(()=>{if(!m)return;let e={onAfterAction:()=>{if(!A.current){A.current=!0;try{Wn(m),Un(m)}finally{A.current=!1}}}};return m.addChangeListener(e),()=>m.removeChangeListener(e)},[m]);let M=(0,g.useCallback)(e=>{if(!m)return;let t=[...m.getLayouts().entries()].filter(([,e])=>e.getType()===`float`);if(!t.length)return;let n=e.currentTarget.closest(`.flexlayout__float_window`),r=t[0][0];if(t.length>1&&n){let e=n.offsetParent?n.offsetParent.getBoundingClientRect():{left:0,top:0},i=n.getBoundingClientRect(),a=null;for(let[n,r]of t){let t=r.getRect(),o=Math.abs(t.x-(i.left-e.left))+Math.abs(t.y-(i.top-e.top));(!a||o<a.d)&&(a={id:n,d:o})}r=a.id}let i=m.getActiveTabset()||m.getFirstTabSet();if(!i)return;let a=`right`,o=m.getLayouts().get(r)?.getRect(),s=typeof i.getRect==`function`?i.getRect():null;if(o&&s){let e=o.x+o.width/2-(s.x+s.width/2),t=o.y+o.height/2-(s.y+s.height/2);a=Math.abs(e)>Math.abs(t)?e<0?`left`:`right`:t<0?`top`:`bottom`}m.doAction(j.dockFloatToLayout(r,i.getId(),O.getByName(a),-1))},[m]),N=(0,g.useMemo)(()=>{let e=(T.boards||[]).find(e=>e.id===n.key),t=k.find(e=>e.key===n.key),r=t&&t.repo||(T.repos||[]).find(e=>t&&(e.id===t.repo?.id||e.path===t.cwd))||null,i=r&&r.boards&&r.boards[0]||null,a=t&&n.task?(t.tasks||[]).find(e=>String(e.id)===String(n.task)):null;return{boardName:e&&e.name||i&&i.name||``,boardId:e&&e.id||i&&i.id||``,dirName:t?t.name:``,pageTitle:a?`#${a.id}`:``}},[T.boards,T.repos,k,n.key,n.task]);(0,g.useEffect)(()=>{$i(location.hash)},[n.view,n.key,n.task]);let P=(0,g.useRef)(m);(0,g.useEffect)(()=>{P.current=m},[m]);let F=(0,g.useRef)(N);(0,g.useEffect)(()=>{F.current=N},[N]);let I=`${N.boardName}|${N.dirName}|${N.pageTitle}`,ee=(0,g.useRef)({route:``,key:``});(0,g.useEffect)(()=>{let e=P.current;if(!e)return;let t=Ri(n,F.current);if(!t)return;let r=`${n.view}|${n.key}|${n.task}`,i=ee.current;(i.route!==r||i.key!==I)&&(ee.current={route:r,key:I},sr(e,t))},[n,I]);let te=(0,g.useCallback)(e=>{m&&sr(m,{component:`page`,name:e.name||`页面`,config:{dirKey:e.dirKey,task:e.task},location:e.location||`center`})},[m]),ne=(0,g.useCallback)(e=>{m&&e&&m.doAction(j.deleteTab(e))},[m]),re=(0,g.useRef)(null),ie=(0,g.useCallback)(()=>{if(!m)return;let e=pr(m);if(!e)return;let t=e.getId(),n=re.current;if(re.current=t,n===t)return;let i=Ii(e);if(!i)return;let a=Ri(ta(),N);if(a&&a.component===e.getComponent()&&JSON.stringify(a.config||{})===JSON.stringify(e.getConfig()||{}))return;history.replaceState(null,``,i);let o=ta();r(e=>e.view===o.view&&e.key===o.key&&e.task===o.task?e:o)},[m,N]),{dialog:ae,node:oe}=a(),se=(0,g.useCallback)(async()=>{await ae({title:`重置为初始两栏`,message:`丢掉存下来的布局,回到初始的两栏(目录 + 开始)?`,okText:`重置`})&&(Gn(),h(Hn()))},[ae,h]),L=(0,g.useMemo)(()=>({undo:v,redo:y,canUndo:b,canRedo:x,resetLayout:se,openSettings:()=>Pi(m)}),[v,y,b,x,se,m]),ce=(0,g.useMemo)(()=>({boot:e,rows:k,repoData:T,prefs:i,patchPrefs:S,onNavigate:C,refreshLocal:w,refreshRepos:D,tpl:f,model:m,route:n,localReady:u!==null,openPage:te,closePanel:ne,shell:L}),[e,k,T,i,S,C,w,D,f,m,n,te,ne,L]);return(0,_.jsx)(an.Provider,{value:ce,children:(0,_.jsx)(`div`,{id:`app-shell`,className:`nx-shell`,children:(0,_.jsx)(`div`,{className:`nx-workarea`,children:m?(0,_.jsxs)(rn,{children:[(0,_.jsx)(Gt,{ref:p,model:m,factory:Fi,onAction:e=>e,onModelChange:ie,i18nTranslator:ra,keyMap:{..._e,focusTabToggle:`F6`,focusNextTabset:`Ctrl+F6`,focusPreviousTabset:`Ctrl+Shift+F6`},icons:{dragToDock:(0,_.jsx)(`button`,{type:`button`,className:`flx-dockback`,title:`迁回主布局(也可拖到面板边缘停靠)`,"aria-label":`迁回主布局`,onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),M(e)},children:(0,_.jsx)(s,{name:`dock`,size:14})})}}),(0,_.jsx)(Zi,{model:m}),oe]},`workspace`):(0,_.jsx)(`div`,{className:`pad muted`,children:`正在装载工作区…`})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,_.jsx)(g.StrictMode,{children:(0,_.jsx)(en,{children:(0,_.jsx)(e,{children:(0,_.jsx)(ia,{})})})}));export{or as A,bn as B,Cr as C,hr as D,Sr as E,yn as F,nn as G,ln as H,Sn as I,j as J,tn as K,wn as L,_n as M,xn as N,nr as O,vn as P,Cn as R,Gr as S,xr as T,cn as U,sn as V,on as W,p as Y,zr as _,Vi as a,wr as b,Hi as c,Yr as d,Wr as f,Rr as g,Pr as h,Bi as i,sr as j,Kn as k,ri as l,Ur as m,Gi as n,Wi as o,Er as p,Yt as q,zi as r,Ui as s,ea as t,ni as u,Fr as v,br as w,Ir as x,jr as y,gn as z};
49
+ `)}function zr(e){let t=Lr(e),n=t.findIndex(e=>/^# (?!#)/.test(String(e).trim()));return n<0?t:t.filter((e,t)=>t!==n)}function Br(e){return Object.keys(br(String(e??``))).length>0}function Vr(e){let t=String(e??``);if(!Object.keys(br(t)).length)return 0;let n=t.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);return n?n[0].length:0}function Hr(e,t){if(!t)return Rr(e);let n=[],r=0;return e[0]&&Br(e[0])&&(n.push(e[0]),r=1),n.push(t),n.push(...e.slice(r)),Rr(n)}function Ur(e,t,n={}){let r=String(t||``),i=String(e||``);if(!r)return{body:i,insertAt:i.length};if(n.mode===`live`){let e=Lr(i),t=e.findIndex(e=>/^# (?!#)/.test(String(e).trim())),a=t>=0?e[t]:null,o=zr(i),s=n.focusIndex;if(s==null||s<0||!o.length){let e=r.replace(/^\n+/,``).replace(/\n+$/,``);o.push(e);let t=Hr(o,a);return{body:t,insertAt:Math.max(0,t.length-e.length)}}if(s=Math.min(s,o.length-1),Br(o[s])){let e=r.replace(/^\n+/,``).replace(/\n+$/,``);s+1<o.length?o[s+1]=e+(o[s+1]?`\n${o[s+1]}`:``):o.push(e);let t=Hr(o,a);return{body:t,insertAt:Vr(t)}}let c=o[s]||``,l=n.caretInBlock,u=l==null?c.length:Math.min(Math.max(0,l),c.length);o[s]=c.slice(0,u)+r+c.slice(u);let d=Hr(o,a),f=[];return a&&o[0]&&Br(o[0])?f.push(o[0],a,...o.slice(1,s)):a?f.push(a,...o.slice(0,s)):f.push(...o.slice(0,s)),{body:d,insertAt:(f.length?`${Rr(f)}\n\n`:``).length+u}}let a=n.insertAt;if(a==null||a<0)return{body:i+r,insertAt:i.length};a=Math.min(Math.max(0,a),i.length);let o=Vr(i);return a<o&&(a=o),{body:i.slice(0,a)+r+i.slice(a),insertAt:a}}function Wr(e){let t=Cr(e.text||``,String(e.id)),n=e.status===`consumed`||!!e.consumedAt,r=n?String(e.consumedAt||``):``;return e.deletedAt?{id:e.id,title:t,status:`done`,detail:`已删除`,receivedAt:r}:e.migratedTo?{id:e.id,title:t,status:`done`,detail:`已迁移 → ${e.migratedTo}`,receivedAt:r}:e.completedAt?{id:e.id,title:t,status:`done`,detail:e.roundSummary?String(e.roundSummary).slice(0,48):`已回填`,receivedAt:r}:n?{id:e.id,title:t,status:`run`,detail:`执行中 / 待回填`,receivedAt:r}:{id:e.id,title:t,status:`wait`,detail:`待领取`,receivedAt:``}}var Gr=`__GLOBAL__`;function Kr(e,t,n,r,i=``){let a=String(i||``).trim().toLowerCase(),o=new Set(r.hidden||[]),s=new Map;for(let e of n||[]){if(e.isGlobal)continue;let t=e.repo&&e.repo.id;t&&(s.has(t)||s.set(t,[]),s.get(t).push(e))}let c=(e||[]).filter(e=>!o.has(e.key||e.id)).map(e=>{let t=s.get(e.id)||[];return{type:`repo`,key:e.key||e.id,repoId:e.id,topicKey:t.length?t[0].key:``,name:e.name,icon:e.icon||``,cwd:e.path||``,desc:e.desc||``,boards:e.boards||[],summary:t.map(e=>e.summary).filter(Boolean).join(` / `),pending:t.reduce((e,t)=>e+(t.pending||0),0),waiting:t.some(e=>e.waiting),topics:t}}),l=new Map(c.map(e=>[e.key,e])),u=e=>!a||String(e.name||``).toLowerCase().includes(a)||String(e.key||``).toLowerCase().includes(a)||String(e.cwd||``).toLowerCase().includes(a)||String(e.desc||``).toLowerCase().includes(a)||String(e.summary||``).toLowerCase().includes(a),d=c.filter(u),f=[],p=t||[];for(let e of p){let t=(e.repos||[]).map(e=>l.get(e.key)).filter(Boolean),n=t.some(u);(!a||u(e)||n)&&f.push({type:`board`,id:e.id,key:e.key||e.id,name:e.name,desc:e.desc||``,count:(e.repos||[]).length,pending:t.reduce((e,t)=>e+(t.pending||0),0),waiting:t.some(e=>e.waiting),members:(e.repos||[]).map(e=>e.key)})}let m=new Set;for(let e of p)for(let t of e.repos||[])m.add(t.key);for(let e of d)m.has(e.key)||f.push({...e,groupId:``});let h=new Map((r.order||[]).map((e,t)=>[e,t])),g=new Map;p.forEach((e,t)=>g.set(e.id,t));let _=p.length,v=e=>e.type===`board`?g.has(e.id)?g.get(e.id):_:e.groupId&&g.has(e.groupId)?g.get(e.groupId):_,y=f.map((e,t)=>({r:e,i:t})).sort((e,t)=>{let n=h.has(qr(e.r))?h.get(qr(e.r)):1/0,r=h.has(qr(t.r))?h.get(qr(t.r)):1/0;if(n!==r)return n-r;let i=v(e.r),a=v(t.r);if(i!==a)return i-a;let o=e.r.type===`board`?0:1,s=t.r.type===`board`?0:1;return o===s?String(e.r.name||``).localeCompare(String(t.r.name||``)):o-s}).map(e=>e.r),b=(n||[]).find(e=>e.isGlobal),x=[];return b&&x.push({type:`global`,key:Gr,name:b.name||`全局任务`,topic:b,pending:b.pending||0,waiting:!!b.waiting,topics:(b.tasks||[]).filter(e=>!e.deletedAt)}),x.push(...y),{rows:x,matchCount:a?x.filter(e=>e.type===`board`||e.type===`repo`&&!e.groupId).length:0}}function qr(e){return e.type===`board`?`board:`+e.id:e.key}function Jr(e){let t=xr(String(e?.text||``)),n=t.match(/^#\s+(.+)$/m);return n?n[1].trim().slice(0,40):(t.split(`
50
+ `).find(e=>e.trim())||`#${e?.id}`).trim().slice(0,40)}function Yr(e,t){let n=t.getBoundingClientRect(),r=e.clientY-n.top,i=n.height;return r<i*.3?`before`:r>i*.7?`after`:`into`}function Xr(e,t,n){return e?e.type===`repo`?t.type===`board`?n===`into`:t.type===`repo`?n===`before`||n===`after`:!1:e.type===`board`&&t.type===`board`&&t.id!==e.id&&(n===`before`||n===`after`):!1}function Zr(e,t,n,r){let i=[...e.order||[]],a=e=>e.type===`board`?`board:`+e.id:e.key;if(t.type===`repo`&&n.type===`repo`){let e=i.filter(e=>e!==a(t)),o=e.indexOf(a(n));return o<0?{order:i}:(e.splice(r===`before`?o:o+1,0,a(t)),{order:e})}if(t.type===`board`&&n.type===`board`){let e=i.filter(e=>e!==a(t)),o=e.indexOf(a(n));return o<0?{order:i}:(e.splice(r===`before`?o:o+1,0,a(t)),{order:e})}return{}}async function Qr({row:e,onNavigate:t,refreshLocal:n,toast:r,draft:i=!1}){let a=e=>i?`${e}?task=draft`:e;if(e.type===`global`||e.topicKey){t(a(e.type===`global`?`#/global`:`#/dir/${encodeURIComponent(e.topicKey)}`));return}if(!e.cwd){r&&r(`「${e.name}」没有目录路径,无法创建任务队列`);return}try{let i=await Yt(`/api/localtasks/topic`,{method:`POST`,body:{cwd:e.cwd}});await n?.(),i&&i.existed===!1&&r&&r(`已为「${e.name}」创建任务队列`),t(a(`#/dir/${encodeURIComponent(i.key)}`))}catch(e){r&&r(`创建任务队列失败: `+(e.message||e))}}function $r({row:e,prefs:t,patchPrefs:n,onNavigate:r,boards:i,onDataChanged:a,refreshLocal:o,toast:s,dialog:c}){if(e.type===`repo`){let c=i||[],l=t=>(e.boards||[]).some(e=>e.key===t.key||e.id===t.id),u=async(t,n)=>{try{await Yt(`/api/boards/assign`,{method:`POST`,body:n?{key:e.key,board:t.key||t.id,remove:!0}:{key:e.key,board:t.key||t.id}}),a&&a()}catch(e){s(`归属变更失败: `+e.message)}};return[{label:`打开详情`,icon:`folder`,onClick:()=>Qr({row:e,onNavigate:r,refreshLocal:o,toast:s})},{label:`置顶`,icon:`pin`,onClick:()=>n({order:[e.key,...(t.order||[]).filter(t=>t!==e.key)]})},`sep`,...c.map(e=>({label:(l(e)?`✓ `:``)+(l(e)?`移出「`:`归入「`)+e.name+`」`,icon:`folder`,onClick:()=>u(e,l(e))})),`sep`,{label:`从侧边栏隐藏(不删登记)`,icon:`x`,onClick:()=>n(t=>({hidden:[...t.hidden||[],e.key]}))}]}return e.type===`board`?[{label:`在仓库页打开该看板`,icon:`repo`,onClick:()=>r(`#/repos`)},`sep`,{label:`删除看板(成员仓库回到未分组)`,icon:`trash`,danger:!0,onClick:async()=>{if(await c({title:`删除看板「${e.name}」`,message:`它的 ${e.count} 个仓库会回到未分组(登记不动)。`,danger:!0,okText:`删除`}))try{await Yt(`/api/boards/${encodeURIComponent(e.id)}`,{method:`DELETE`,body:{}}),a&&a()}catch(e){s(`删除失败: `+e.message)}}}]:[{label:`打开全局任务池`,icon:`globe`,onClick:()=>r(`#/global`)}]}function ei({dialog:e,toast:t,onDataChanged:n}){return[{label:`登记仓库…`,icon:`folder`,onClick:async()=>{let r=await e({title:`登记仓库`,input:!0,placeholder:`仓库绝对路径,如 D:/a_js/js_proj/nx-kv`});if(r)try{await Yt(`/api/repos`,{method:`POST`,body:{path:r.trim()}}),t(`已登记仓库 `+r.trim()),n&&n()}catch(e){t(`登记失败: `+e.message)}}},{label:`新建看板(项目组)…`,icon:`plus`,onClick:async()=>{let r=await e({title:`新建看板`,input:!0,placeholder:`看板名,如 前端 / nx 家族`});if(r)try{await Yt(`/api/boards`,{method:`POST`,body:{name:r.trim()}}),t(`已新建看板 `+r.trim()),n&&n()}catch(e){t(`新建失败: `+e.message)}}}]}function ti(e,t){let n=Array.isArray(e)?e:[],[r,i]=(0,g.useState)(0),a=Math.max(1,Number(t)||1),o=Math.max(1,Math.ceil(n.length/a)),s=Math.min(Math.max(0,r),o-1),c=s*a;return{page:s,pageCount:o,total:n.length,items:n.slice(c,c+a),setPage:i}}function ni({page:e=0,pageCount:t=1,total:n=0,onPage:r,unit:i=`条`}){let a=e=>r&&r(Math.max(0,Math.min(e,t-1)));return t<=1?(0,_.jsxs)(`span`,{className:`pager-n`,children:[`共 `,n,` `,i]}):(0,_.jsxs)(`span`,{className:`pager`,children:[(0,_.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:e<=0,onClick:()=>a(e-1),"aria-label":`上一页`,title:`上一页`,children:`‹`}),(0,_.jsxs)(`span`,{className:`pager-n`,children:[`第 `,e+1,`/`,t,` 页 · 共 `,n,` `,i]}),(0,_.jsx)(`button`,{type:`button`,className:`pager-btn`,disabled:e>=t-1,onClick:()=>a(e+1),"aria-label":`下一页`,title:`下一页`,children:`›`})]})}var ri=12;function ii({row:e,onNavigate:t,refreshLocal:n,limit:r=ri}){let i=l(),a=ti((0,g.useMemo)(()=>ln(e.type===`global`?e.tasks||[]:(e.topics||[]).flatMap(e=>(e.tasks||[]).filter(e=>!e.deletedAt))),[e]),r),o=a.items,c=e.type===`global`?`#/global`:`#/dir/${encodeURIComponent(e.topicKey||e.key)}`;return(0,_.jsxs)(_.Fragment,{children:[o.map(n=>(0,_.jsxs)(`button`,{type:`button`,className:`trow child task-child`,title:String(n.text||``).slice(0,200),onClick:e=>{e.stopPropagation(),t(`${c}?task=${encodeURIComponent(n.id)}`)},children:[(0,_.jsx)(`span`,{className:`gico`,children:(0,_.jsx)(s,{name:`list`,size:12})}),(0,_.jsx)(`span`,{className:`nm`,children:Jr(n)}),(0,_.jsx)(`span`,{className:`cnt`,children:n.status===`consumed`?`完`:n.from?`跑`:`等`})]},`${e.topicKey||e.key}:t:${n.id}`)),a.pageCount>1&&(0,_.jsx)(`div`,{className:`trow child task-pager`,children:(0,_.jsx)(ni,{page:a.page,pageCount:a.pageCount,total:a.total,onPage:a.setPage,unit:`条任务`})}),(0,_.jsxs)(`button`,{type:`button`,className:`trow child task-new`,title:`新建一页 MD(新页签打开;仓库还没有任务队列时先创建队列)`,onClick:r=>{r.stopPropagation(),Qr({row:e,onNavigate:t,refreshLocal:n,toast:i,draft:!0})},children:[(0,_.jsx)(`span`,{className:`gico`,children:(0,_.jsx)(s,{name:`plus`,size:12})}),(0,_.jsx)(`span`,{className:`nm`,children:`新建页`})]})]})}function ai({repos:e,boards:t,topics:n,route:r,onNavigate:o,refreshLocal:c,waitingCount:u,prefs:d,patchPrefs:f,refreshRepos:p,onCollapse:m,onClose:h,shell:v}){let y=l(),{dialog:b,node:x}=a(),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)(-1),[O,k]=(0,g.useState)(()=>new Set),A=(0,g.useRef)(null),[j,M]=(0,g.useState)(null),N=(0,g.useRef)(null),{rows:P,matchCount:F}=(0,g.useMemo)(()=>Kr(e,t,n,d,S),[e,t,n,d,S]),I=e=>e.type===`global`?r.view===`global`:e.type===`repo`?r.view===`dir`&&r.key===e.topicKey:e.type===`board`&&r.view===`group`&&r.key===e.id;(0,g.useEffect)(()=>{r.view===`dir`&&r.key&&k(e=>{if(e.has(r.key))return e;let t=new Set(e);return t.add(r.key),t})},[r.view,r.key]);let ee=(0,g.useCallback)(e=>{k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),te=(0,g.useCallback)(e=>{e.type===`board`?o(`#/group/`+encodeURIComponent(e.id)):e.type===`global`?o(`#/global`):e.topicKey?o(`#/dir/`+encodeURIComponent(e.topicKey)):Qr({row:e,onNavigate:o,refreshLocal:c,toast:y})},[o,c,y]),ne=(0,g.useCallback)(e=>{e.type===`global`?o(`#/global`):ee(e.topicKey||e.key)},[o,ee]),re=e=>{w||(e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),D(t=>t<0?e.key===`ArrowDown`?0:P.length-1:Math.min(P.length-1,Math.max(0,t+(e.key===`ArrowDown`?1:-1))))):e.key===`Home`?(e.preventDefault(),D(0)):e.key===`End`?(e.preventDefault(),D(P.length-1)):e.key===`Enter`?E>=0&&P[E]&&te(P[E]):e.key===`Escape`&&D(-1))},ie=(e,t)=>{A.current={type:t.type,key:t.key,id:t.id,name:t.name},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.type+`:`+(t.key||t.id)),e.currentTarget.classList.add(`dragging`)},ae=e=>{A.current=null,M(null),e.currentTarget?.classList?.remove(`dragging`)},oe=(e,t)=>{if(!A.current)return;e.preventDefault();let n=Yr(e,e.currentTarget);Xr(A.current,t,n)?(e.dataTransfer.dropEffect=`move`,M({id:t.key||t.id,zone:n})):M(null)},se=()=>M(e=>e&&null),L=(e,t)=>{e.preventDefault();let n=A.current;if(A.current=null,M(null),!n)return;let r=Yr(e,e.currentTarget);Xr(n,t,r)&&f(Zr(d,n,t,r))},ce=e=>{let t=A.current;if(A.current=null,M(null),!t||t.type!==`repo`)return;e.preventDefault();let n=t.key,r=(d.order||[]).filter(e=>e!==n);r.push(n),f({order:r})},le=(e,n)=>{e.preventDefault(),e.stopPropagation(),T({x:e.clientX,y:e.clientY,items:$r({row:n,prefs:d,patchPrefs:f,onNavigate:o,boards:t,onDataChanged:p,refreshLocal:c,toast:y,dialog:b})})},ue=e=>{T({x:e.clientX,y:e.clientY,items:ei({dialog:b,toast:y,onDataChanged:p})})},de=(e,t,n)=>(0,_.jsxs)(`button`,{className:`trow`+(r.view===e.replace(`#/`,``)?` active`:``),onClick:()=>o(e),children:[(0,_.jsx)(`span`,{className:`gico`,children:(0,_.jsx)(s,{name:t})}),(0,_.jsx)(`span`,{className:`nm`,children:n})]});return(0,_.jsxs)(`aside`,{id:`side`,children:[(0,_.jsxs)(`div`,{className:`shead`,children:[(0,_.jsxs)(`div`,{className:`brandrow`,children:[(0,_.jsx)(`span`,{className:`nx-logo`,"aria-hidden":!0,children:`nx`}),(0,_.jsx)(`span`,{className:`nx-title`,children:`nx-kv`}),(0,_.jsx)(`span`,{className:`grow`}),(0,_.jsx)(`button`,{className:`iconbtn undo`,title:`撤销上一次布局操作`,"aria-label":`撤销上一次布局操作`,disabled:!v||!v.canUndo,onClick:v&&v.undo,children:`↶`}),(0,_.jsx)(`button`,{className:`iconbtn redo`,title:`重做`,"aria-label":`重做`,disabled:!v||!v.canRedo,onClick:v&&v.redo,children:`↷`}),(0,_.jsx)(`button`,{className:`iconbtn`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>v&&v.openSettings(),children:(0,_.jsx)(s,{name:`gear`,size:15})}),(0,_.jsx)(`button`,{className:`iconbtn collapse`,title:`收起目录(变窄轨;点窄轨可展开)`,"aria-label":`收起目录`,onClick:m,children:(0,_.jsx)(s,{name:`back`,size:15})}),(0,_.jsx)(`button`,{className:`iconbtn collapse`,title:`关闭目录(完全隐藏,左缘把手可展开)`,"aria-label":`关闭目录`,onClick:h,children:(0,_.jsx)(s,{name:`x`,size:14})})]}),(0,_.jsxs)(`div`,{className:`searchrow`,children:[(0,_.jsxs)(`label`,{className:`sbox`,children:[(0,_.jsx)(s,{name:`search`}),(0,_.jsx)(`input`,{value:S,placeholder:`搜索仓库(命中自动展开)`,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`&&C(``)}})]}),S&&(0,_.jsxs)(`span`,{className:`kwcount`,children:[F,` 个匹配`]}),(0,_.jsx)(`button`,{className:`iconbtn add`,title:`添加目录 / 新建分组`,"aria-label":`添加目录或新建分组`,onClick:ue,children:(0,_.jsx)(s,{name:`plus`})})]})]}),(0,_.jsxs)(`div`,{id:`tree`,ref:N,tabIndex:0,onKeyDown:re,onDragOver:e=>{A.current?.type===`repo`&&e.preventDefault()},onDrop:ce,children:[P.map((e,t)=>e.type===`board`?(0,_.jsxs)(`button`,{className:`trow group`+(I(e)?` active`:``)+(E===t?` kb-focus`:``),onClick:()=>te(e),onContextMenu:t=>le(t,e),draggable:!0,onDragStart:t=>ie(t,e),onDragEnd:ae,onDragOver:t=>oe(t,e),onDragLeave:se,onDrop:t=>L(t,e),"data-drop":j?.id===e.id?j.zone:void 0,title:`${e.name} · ${e.count} 个目录\n${e.desc||`项目组:点进去操作组下的项目`}`,children:[(0,_.jsx)(`span`,{className:`tw`,"aria-hidden":!0}),(0,_.jsx)(`span`,{className:`gico`,children:(0,_.jsx)(s,{name:`folder`})}),(0,_.jsxs)(`span`,{className:`nm`,children:[e.name,e.waiting?(0,_.jsx)(`span`,{className:`wdot`,title:`组内有 agent 等待回填`}):null]}),(0,_.jsx)(`span`,{className:`cnt`,title:`待领取 ${e.pending} · 成员 ${e.count} 个`,children:e.pending>0?e.pending:e.count}),(0,_.jsx)(`span`,{className:`more`,role:`button`,tabIndex:-1,"aria-label":`看板菜单`,onClick:t=>le(t,e),children:(0,_.jsx)(s,{name:`dots`,size:13})})]},`b:`+e.id):(0,_.jsxs)(`div`,{className:`tblock`,children:[(0,_.jsxs)(`button`,{className:`trow`+(e.type===`repo`&&e.groupId?` child`:``)+(e.type===`repo`&&O.has(e.topicKey)?` open`:``)+(I(e)?` active`:``)+(e.pending>0?` pinned`:``)+(E===t?` kb-focus`:``),onClick:()=>te(e),onContextMenu:t=>le(t,e),title:e.cwd?`${e.name}\n${e.cwd}\n${e.desc||e.summary||``}`:e.name,draggable:!0,onDragStart:t=>ie(t,e),onDragEnd:ae,onDragOver:t=>oe(t,e),onDragLeave:se,onDrop:t=>L(t,e),"data-drop":j?.id===e.key?j.zone:void 0,children:[(0,_.jsx)(`span`,{className:`tw`,role:`button`,tabIndex:-1,"aria-label":`展开子任务`,onClick:t=>{t.stopPropagation(),ne(e)},children:(0,_.jsx)(s,{name:`chevron`,size:10})}),(0,_.jsx)(`span`,{className:`gico`,children:e.icon?(0,_.jsx)(`span`,{className:`trow-icon`,"aria-hidden":!0,children:e.icon}):(0,_.jsx)(s,{name:e.type===`global`?`globe`:`folder`})}),(0,_.jsxs)(`span`,{className:`nm`,children:[e.name,e.type===`global`&&e.waiting?(0,_.jsx)(`span`,{className:`wdot`,title:`有等待中的主题`}):null]}),e.pending>0&&(0,_.jsx)(`span`,{className:`cnt`,children:e.pending}),e.type===`repo`&&e.waiting&&(0,_.jsx)(`span`,{className:`wdot`,title:`agent 等待回填中`}),(0,_.jsx)(`span`,{className:`more`,role:`button`,tabIndex:-1,"aria-label":`行菜单`,onClick:t=>le(t,e),children:(0,_.jsx)(s,{name:`dots`,size:13})})]}),(e.type===`global`?I(e):O.has(e.topicKey||e.key))&&(0,_.jsx)(ii,{row:e,onNavigate:o,refreshLocal:c})]},e.type+`:`+e.key)),!P.length&&(0,_.jsx)(`div`,{className:`tree-empty`,children:S?`没有匹配的仓库`:`还没有登记仓库:点右上 + 登记,或去「仓库管理」`}),(0,_.jsx)(`div`,{className:`droptail`,"aria-hidden":`true`})]}),(0,_.jsxs)(`div`,{className:`sfoot`,children:[de(`#/overview`,`overview`,`全部目录总览`),de(`#/cloud`,`cloud`,`云端总览`),de(`#/repos`,`repo`,`仓库管理`),u>0&&(0,_.jsxs)(`button`,{className:`trow`,onClick:()=>o(`#/overview`),title:`有 agent 正在等待回填`,children:[(0,_.jsx)(`span`,{className:`gico`,children:(0,_.jsx)(s,{name:`warn`})}),(0,_.jsxs)(`span`,{className:`nm`,children:[u,` 个 agent 等待回填`]})]})]}),w&&(0,_.jsx)(i,{x:w.x,y:w.y,items:w.items,onClose:()=>T(null)}),x]})}var oi=46,si=120;function ci(e){let t=e&&lr(e,`sidebar`);if(!t)return`expanded`;let n=e.getNodeById?e.getNodeById(t):null;return Dn(n?typeof n.getWeight==`function`?n.getWeight():Number(n.getAttributes()?.weight)||0:0)}function li(){let e=on()||{},{model:t}=e,[n,r]=(0,g.useState)(()=>ci(t)),[i,a]=(0,g.useState)(null),o=(0,g.useCallback)(e=>a(e),[]),c=(0,g.useRef)(null),l=(0,g.useCallback)(e=>{if(!t)return;let n=lr(t,`sidebar`);n&&dr(t,n,kn(e))},[t]),u=(0,g.useCallback)(e=>{c.current={state:e,until:Date.now()+600},l(e),r(e)},[l]),d=(0,g.useCallback)(()=>u(`collapsed`),[u]),f=(0,g.useCallback)(()=>u(`expanded`),[u]),p=(0,g.useCallback)(()=>u(`closed`),[u]);(0,g.useEffect)(()=>{if(!i||window.ResizeObserver===void 0)return;let e=new window.ResizeObserver(e=>{for(let t of e){let e=Math.round(t.contentRect.width);r(t=>{let n=c.current;if(n){if(Date.now()>n.until)c.current=null;else if(n.state===`closed`)return`closed`;else if(n.state===`expanded`)return e>=si&&(c.current=null),`expanded`;else if(n.state===`collapsed`)return e<oi&&(c.current=null),`collapsed`}return t===`closed`?t:e<oi?`collapsed`:e>=si?`expanded`:t})}});return e.observe(i),()=>e.disconnect()},[i]),(0,g.useEffect)(()=>{if(n!==`closed`||!t)return;let e=setInterval(()=>{let e=lr(t,`sidebar`),n=e&&t.getNodeById?t.getNodeById(e):null;Dn(n?typeof n.getWeight==`function`?n.getWeight():Number(n.getAttributes()?.weight)||0:0)===`expanded`&&(c.current=null,r(`expanded`))},200);return()=>clearInterval(e)},[n,t]);let m=(0,g.useRef)(null);return(0,g.useEffect)(()=>{if(m.current===null){m.current=n;return}m.current!==n&&(m.current=n,l(n))},[n,l]),(0,g.useEffect)(()=>(document.body.classList.toggle(`nx-side-is-closed`,n===`closed`),()=>document.body.classList.remove(`nx-side-is-closed`)),[n]),n===`closed`?(0,_.jsx)(`div`,{ref:o,className:`nx-side-closed-host`,"aria-hidden":!0}):n===`collapsed`?(0,_.jsxs)(`div`,{ref:o,className:`nx-rail-host`,children:[(0,_.jsxs)(`button`,{className:`nx-rail`,title:`展开目录`,"aria-label":`展开目录`,onClick:f,children:[(0,_.jsx)(`span`,{className:`nx-rail-btn`,"aria-hidden":!0,children:`»`}),(0,_.jsx)(`span`,{className:`nx-rail-label`,children:`目录`})]}),(0,_.jsxs)(`div`,{className:`nx-rail-acts`,children:[(0,_.jsx)(`button`,{className:`nx-rail-act`,title:`关闭目录(完全隐藏,左缘把手可展开)`,"aria-label":`关闭目录`,onClick:p,children:(0,_.jsx)(s,{name:`x`,size:14})}),(0,_.jsx)(`button`,{className:`nx-rail-act`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>e.shell&&e.shell.openSettings(),children:(0,_.jsx)(s,{name:`gear`,size:15})})]})]}):(0,_.jsx)(`div`,{ref:o,className:`nx-side-host`,children:(0,_.jsx)(ai,{repos:e.repoData?e.repoData.repos:[],boards:e.repoData?e.repoData.boards:[],topics:e.rows||[],route:e.route,onNavigate:e.onNavigate,refreshLocal:e.refreshLocal,refreshRepos:e.refreshRepos,prefs:e.prefs,patchPrefs:e.patchPrefs,onCollapse:d,onClose:p,shell:e.shell})})}var ui=`modulepreload`,di=function(e){return`/`+e},fi={},pi=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=di(t,n),t=s(t),t in fi)return;fi[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ui,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},mi=(0,g.lazy)(()=>pi(()=>import(`./dir-BLYJYwXR.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),hi=(0,g.lazy)(()=>pi(()=>import(`./task-B7WFtHgb.js`),__vite__mapDeps([10,1,2,3,11,5,8,7]))),gi=(0,g.lazy)(()=>pi(()=>import(`./progress-Cfoo3BaU.js`),__vite__mapDeps([12,1,2]))),_i=(0,g.lazy)(()=>pi(()=>import(`./group-CuItVQ7O.js`),__vite__mapDeps([13,1,2,3,6,7,8,9,14]))),vi=(0,g.lazy)(()=>pi(()=>import(`./repos-zVVQVKkN.js`),__vite__mapDeps([15,1,2,3,7,8,6,9,14]))),yi=(0,g.lazy)(()=>pi(()=>import(`./cloud-CwSnw032.js`),__vite__mapDeps([16,1,2,3,11]))),bi=(0,g.lazy)(()=>pi(()=>import(`./overview-Cy57M5-L.js`),__vite__mapDeps([17,1,2,3]))),xi=(0,g.lazy)(()=>pi(()=>import(`./templates-MH2eUUKs.js`),__vite__mapDeps([18,1,2,3,8,19,20]))),Si=(0,g.lazy)(()=>pi(()=>import(`./Introduction-BBa-4_6Z.js`).then(e=>e.n),__vite__mapDeps([6,1,2,7,8,9]))),Ci=(0,g.lazy)(()=>pi(()=>import(`./settings-DWDjGIdJ.js`),__vite__mapDeps([21,1,2,19,20,22]))),wi=(0,g.lazy)(()=>pi(()=>import(`./dag-Bim4kjF5.js`),__vite__mapDeps([23,1,2,4]))),Ti=e=>(0,_.jsx)(g.Suspense,{fallback:(0,_.jsx)(`div`,{className:`pad muted`,children:`加载中…`}),children:e});function Ei(){return(0,_.jsxs)(`div`,{className:`pad stack welcome`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`strong`,{children:`从左边目录选一个项目组或目录`}),`——选中的内容显示在中间主内容区。`]}),(0,_.jsx)(`div`,{className:`hint`,children:`主内容区一次只放一块面板(顶部面包屑告诉你现在在哪);设置这类临时面板以浮窗形式出现。`}),(0,_.jsx)(`div`,{className:`hint`,children:`目录在左、并发进程在右;两边都能收起或关掉,需要时再开。`})]})}function Di({dirKey:e}){return Ti((0,_.jsx)(mi,{dirKey:e}))}function Oi({dirKey:e,task:t,beside:n,tabId:r,model:i}){return Ti((0,_.jsx)(hi,{dirKey:e,task:t,beside:!!n,tabId:r,model:i}))}function ki({dirKey:e,task:t,groupKey:n}){let r=on()||{},i=n&&(r.repoData&&r.repoData.boards||[]).find(e=>e&&(e.id===n||e.key===n))||null;return Ti((0,_.jsx)(gi,{dirKey:e,task:t,group:i,rows:r.rows,refreshLocal:r.refreshLocal,model:r.model,onOpenTask:(t,n)=>r.openPage&&r.openPage({dirKey:n||e,task:String(t),name:`#${t}`}),onClosePage:e=>r.closePanel&&r.closePanel(e)}))}function Ai({boardId:e,model:t}){let n=on()||{};return Ti((0,_.jsx)(_i,{dirKey:e,rows:n.rows,repoData:n.repoData,onNavigate:n.onNavigate,refreshLocal:n.refreshLocal,model:t||n.model}))}function ji(){let e=on()||{};return Ti((0,_.jsx)(bi,{rows:e.rows,onNavigate:e.onNavigate,refreshLocal:e.refreshLocal}))}var Mi={sidebar:{title:`目录`,render:()=>(0,_.jsx)(li,{})},welcome:{title:`开始`,render:()=>(0,_.jsx)(Ei,{})},dir:{title:`目录`,render:e=>(0,_.jsx)(Di,{dirKey:e&&e.dirKey})},page:{title:`页面`,render:(e,t)=>(0,_.jsx)(Oi,{dirKey:e&&e.dirKey,task:e&&e.task,beside:e&&e.beside,tabId:t&&t.tabId,model:t&&t.model})},progress:{title:`进程`,render:e=>(0,_.jsx)(ki,{dirKey:e&&e.dirKey,task:e&&e.task,groupKey:e&&e.groupKey})},group:{title:`项目组`,render:(e,t)=>(0,_.jsx)(Ai,{boardId:e&&e.boardId,model:t&&t.model})},repos:{title:`仓库管理`,render:()=>Ti((0,_.jsx)(vi,{}))},cloud:{title:`云端总览`,render:()=>Ti((0,_.jsx)(yi,{}))},overview:{title:`全部目录总览`,render:()=>(0,_.jsx)(ji,{})},templates:{title:`任务模板`,render:()=>Ti((0,_.jsx)(xi,{}))},doc:{title:`文档`,render:(e,t)=>Ti((0,_.jsx)(Si,{docId:e&&e.docId,repoKey:e&&e.repoKey,boardKey:e&&e.boardKey,boardName:e&&e.boardName,tabId:t&&t.tabId,model:t&&t.model}))},settings:{title:`设置`,render:()=>Ti((0,_.jsx)(Ci,{}))},dag:{title:`编排`,render:e=>Ti((0,_.jsx)(wi,{dirKey:e&&e.dirKey,groupId:e&&e.groupId}))}};function Ni(e){return e?cr(e,{component:`settings`,name:`设置`,config:{}}):null}function Pi(e){let t=Mi[e.getComponent()];return t?t.render(e.getConfig()||{},{tabId:e.getId(),model:e.getModel(),node:e}):(0,_.jsxs)(`div`,{className:`muted`,style:{padding:12},children:[`未知面板:`,e.getComponent()]})}function Fi(e){if(!e)return null;let t=e.getConfig()||{};switch(e.getComponent()){case`page`:return t.beside?null:`#/dir/${encodeURIComponent(t.dirKey||``)}?task=${encodeURIComponent(t.task||``)}`;case`dir`:return t.dirKey===`__GLOBAL__`?`#/global`:`#/dir/${encodeURIComponent(t.dirKey||``)}`;case`group`:return`#/group/${encodeURIComponent(t.boardId||``)}`;case`repos`:return`#/repos`;case`cloud`:return`#/cloud`;case`overview`:return`#/overview`;case`templates`:return`#/templates`;default:return null}}function Ii(e){let t=String(e&&e.task||``);if(!t.startsWith(`draft`))return``;let n=Sn(_n(gn(e.key),t));return String(n&&n.title||``).trim()}function Li(e,t={}){if(!e)return null;switch(e.view){case`dir`:return e.task?{component:`page`,name:t.pageTitle||Ii(e)||`页 ${e.task}`,config:{dirKey:e.key,task:e.task}}:{component:`dir`,name:t.dirName||`目录`,config:{dirKey:e.key}};case`group`:return{component:`group`,name:t.boardName||`项目组`,config:{boardId:e.key}};case`repos`:return{component:`repos`,name:`仓库管理`,config:{}};case`cloud`:return{component:`cloud`,name:`云端总览`,config:{}};case`overview`:return{component:`overview`,name:`全部目录总览`,config:{}};case`templates`:return{component:`templates`,name:`任务模板`,config:{}};default:return null}}var Ri=[{label:`任务`,items:[{token:`task.id`,desc:`任务号`},{token:`task.text`,desc:`任务正文`},{token:`task.title`,desc:`任务标题`}]},{label:`时间目标`,items:[{token:`goal.name`,desc:`目标名`},{token:`goal.deadline`,desc:`截止时间`},{token:`goal.remainingHuman`,desc:`剩余时长(人话)`},{token:`goal.prompt`,desc:`目标的附加要求`}]},{label:`本次上下文`,items:[{token:`source`,desc:`来源(local/global)`},{token:`summary`,desc:`本轮现状`},{token:`cwd`,desc:`工作目录`},{token:`name`,desc:`主题名`}]}],zi=[{label:`任务段(无任务时整段消失)`,token:`{{#task}}…{{/task}}`},{label:`目标段(无目标时整段消失)`,token:`{{#goal}}…{{/goal}}`}];Ri.flatMap(e=>e.items.map(e=>[e.token,e.desc])).reduce((e,[t,n])=>Object.assign(e,{[t]:n}),{});function Bi(e,t,n){let r=String(e??``),i=Number.isInteger(n)&&n>=0&&n<=r.length?n:r.length;return{text:r.slice(0,i)+t+r.slice(i),caret:i+t.length}}function Vi(e){let t=[],n=/\{\{\s*([A-Za-z0-9_.]+)\s*\}\}/g,r=n.exec(String(e??``));for(;r;)t.includes(r[1])||t.push(r[1]),r=n.exec(String(e??``));return t}function Hi(e){let t=[],n=/\{\{\s*([^}{\s][^{}]*?)\s*\}\}/g,r=n.exec(String(e??``));for(;r;){let i=r[1].trim();i&&!t.includes(i)&&t.push(i),r=n.exec(String(e??``))}return t}function Ui(e,t){let n=t&&typeof t==`object`?t:{};return String(e??``).replace(/\{\{\s*([^}{\s][^{}]*?)\s*\}\}/g,(e,t)=>{let r=String(t).trim(),i=n[r];return i==null?``:String(i)})}function Wi(){let[e,t]=(0,g.useState)({defaultId:``,templates:null,unsupported:!1}),n=(0,g.useCallback)(async()=>{try{let e=await Yt(`/api/templates`);t({defaultId:e.defaultId,templates:e.templates,unsupported:!1})}catch(e){t(t=>({...t,templates:null,unsupported:String(e.message||e).includes(`接口不存在`)}))}},[]);(0,g.useEffect)(()=>{n()},[n]);let r=(0,g.useCallback)(()=>{let t=(e.templates||[]).find(t=>t.id===e.defaultId);return t?Ui(t.body,{...Nr,...t.values||{}}):Ui(Mr,Nr)},[e]),i=(0,g.useCallback)(async(e,t,r)=>{let i=await Yt(`/api/templates`,{method:`POST`,body:{name:e,body:t,setDefault:r}});return await n(),i},[n]),a=(0,g.useCallback)(async e=>{let t=await Yt(`/api/templates/${encodeURIComponent(e)}`,{method:`DELETE`,body:{}});return await n(),t},[n]),o=(0,g.useCallback)(async(e,t)=>{let r=await Yt(`/api/templates/${encodeURIComponent(e)}`,{method:`PATCH`,body:t});return await n(),r},[n]),s=(0,g.useCallback)(async e=>{let t=await Yt(`/api/templates/default`,{method:`PATCH`,body:{id:e}});return await n(),t},[n]);return{defaultId:e.defaultId,templates:e.templates,unsupported:e.unsupported,defaultBody:r,refetch:n,add:i,remove:a,update:o,setDefault:s}}var Gi=`nx-kv-sidebar-v1`,Ki={order:[],hidden:[],folded:!1,defaultFolded:!1};function qi(e){if(!e||typeof e!=`object`)return e;let{groups:t,dirGroups:n,...r}=e;return r}function Ji(){try{let e=localStorage.getItem(Gi);if(!e)return{...Ki};let t=qi(JSON.parse(e)),n={...Ki,...t};if(t&&typeof t==`object`&&(`groups`in t||`dirGroups`in t))try{localStorage.setItem(Gi,JSON.stringify(n))}catch{}return n}catch{return{...Ki}}}function Yi(e){try{localStorage.setItem(Gi,JSON.stringify(e))}catch{}}function Xi(e){let t={...Ji(),...typeof e==`function`?e(Ji()):e};return Yi(t),t}function J({model:e}){let t=on()||{},[n,r]=(0,g.useState)(!1),i=(0,g.useCallback)(()=>{if(!e){r(!1);return}if(!Jn(e,`sidebar`)){r(!0);return}let t=ur(e,lr(e,`sidebar`));r(Dn(t)===`closed`)},[e]);(0,g.useEffect)(()=>{if(!e)return;i();let t={onAfterAction:()=>i()};e.addChangeListener(t);let n=setInterval(i,400);return()=>{e.removeChangeListener(t),clearInterval(n)}},[e,i]);let a=(0,g.useCallback)(()=>{if(!e)return;let t=lr(e,`sidebar`);t||=fr(e),t&&(dr(e,t,kn(`expanded`)),Un(e))},[e]);return!n||typeof document>`u`?null:(0,v.createPortal)((0,_.jsxs)(`div`,{className:`nx-side-fab-layer nx-side-fab-fixed`,role:`navigation`,"aria-label":`目录已关闭`,children:[(0,_.jsx)(`button`,{type:`button`,className:`nx-side-fab`,title:`展开目录`,"aria-label":`展开目录`,onClick:a,children:(0,_.jsx)(s,{name:`sidebar`,size:14})}),(0,_.jsx)(`button`,{type:`button`,className:`nx-side-fab-gear`,title:`设置(浮动面板)`,"aria-label":`设置`,onClick:()=>t.shell&&t.shell.openSettings(),children:(0,_.jsx)(s,{name:`gear`,size:14})})]}),document.body)}var Zi=[];function Qi(e){e&&(Zi[Zi.length-1]!==e&&Zi.push(e),Zi.length>30&&Zi.shift())}function $i(){return Zi.length>1?(Zi.pop(),Zi[Zi.length-1]):``}function ea(){let[e,t]=(location.hash||``).replace(/^#\/?/,``).split(`?`),n=new URLSearchParams(t||``).get(`task`)||``;return e.startsWith(`dir/`)?{view:`dir`,key:decodeURIComponent(e.slice(4)),task:n}:e.startsWith(`group/`)?{view:`group`,key:decodeURIComponent(e.slice(6)),task:``}:[`global`,`overview`,`cloud`,`todo`,`repos`,`templates`].includes(e)?{view:e===`todo`?`cloud`:e,key:e===`global`?`__GLOBAL__`:``,task:e===`global`?n:``}:{view:`overview`,key:``,task:``}}var ta={close:`关闭`,rename:`重命名`,float:`浮窗`,dock:`停靠`,popout:`弹出到新窗口`,Close:`关闭`,Rename:`重命名`,Float:`浮窗`,Dock:`停靠`,Popout:`弹出到新窗口`,"flexlayout.ui.dock.float.to.layout":`迁回主布局(点按钮直接停靠;也可拖到面板边缘)`,"flexlayout.ui.popout.float.to.window":`弹出到浏览器窗口`,"flexlayout.ui.dock.float.tabs (?)":`迁回 ? 个页签`},na=e=>ta[e]||e;function ra(){let{boot:e}=tn(),t=l(),[n,r]=(0,g.useState)(ea),[i,o]=(0,g.useState)(Ji),[,c]=(0,g.useState)(0),[u,d]=(0,g.useState)(null),f=Wi(),p=(0,g.useRef)(null),{model:m,setModel:h,undo:v,redo:y,canUndo:b,canRedo:x}=qt(()=>Hn(),{ignoreActionTypes:[j.SET_ACTIVE_TABSET,j.DELETE_TABSET]});(0,g.useEffect)(()=>{m&&(window.__nxkv={model:m,Actions:j,DockLocation:O})},[m]);let S=(0,g.useCallback)(e=>o(Xi(e)),[]);(0,g.useEffect)(()=>{let e=()=>r(ea());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let C=(0,g.useCallback)(e=>{location.hash!==e&&(location.hash=e),r(e=>{let t=ea();return e.view===t.view&&e.key===t.key&&e.task===t.task?e:t})},[]),w=(0,g.useCallback)(async()=>{try{d(await Yt(`/api/localtasks`))}catch{}},[]);(0,g.useEffect)(()=>{w();let e=setInterval(w,15e3);return()=>clearInterval(e)},[w]);let[T,E]=(0,g.useState)({repos:[],boards:[]}),D=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([Yt(`/api/repos`),Yt(`/api/boards`)]);E({repos:(e||[]).filter(e=>(e.type||`dev`)!==`ref`),boards:t&&t.boards||[]})}catch{}},[]);(0,g.useEffect)(()=>{D();let e=setInterval(D,3e4);return()=>clearInterval(e)},[D]),(0,g.useEffect)(()=>{let e=!1,n=async()=>{try{let n=await Yt(`/api/localtasks/presence`),r=Math.max(0,Number(n&&n.waiting)||0);if(e)return;c(e=>(e===0&&r>0&&t(`有 agent 正在等待回填,请查看对应目录`),r))}catch{}};n();let r=setInterval(n,15e3);return()=>{e=!0,clearInterval(r)}},[t]),(0,g.useEffect)(()=>{let e=!1,t=()=>{e||Yt(`/api/ping`).catch(()=>{})};t();let n=setInterval(t,15e3);return()=>{e=!0,clearInterval(n)}},[]);let k=(0,g.useMemo)(()=>u?.topics||[],[u]),A=(0,g.useRef)(!1);(0,g.useEffect)(()=>{if(!m)return;let e={onAfterAction:()=>{if(!A.current){A.current=!0;try{Wn(m),Un(m)}finally{A.current=!1}}}};return m.addChangeListener(e),()=>m.removeChangeListener(e)},[m]);let M=(0,g.useCallback)(e=>{if(!m)return;let t=[...m.getLayouts().entries()].filter(([,e])=>e.getType()===`float`);if(!t.length)return;let n=e.currentTarget.closest(`.flexlayout__float_window`),r=t[0][0];if(t.length>1&&n){let e=n.offsetParent?n.offsetParent.getBoundingClientRect():{left:0,top:0},i=n.getBoundingClientRect(),a=null;for(let[n,r]of t){let t=r.getRect(),o=Math.abs(t.x-(i.left-e.left))+Math.abs(t.y-(i.top-e.top));(!a||o<a.d)&&(a={id:n,d:o})}r=a.id}let i=m.getActiveTabset()||m.getFirstTabSet();if(!i)return;let a=`right`,o=m.getLayouts().get(r)?.getRect(),s=typeof i.getRect==`function`?i.getRect():null;if(o&&s){let e=o.x+o.width/2-(s.x+s.width/2),t=o.y+o.height/2-(s.y+s.height/2);a=Math.abs(e)>Math.abs(t)?e<0?`left`:`right`:t<0?`top`:`bottom`}m.doAction(j.dockFloatToLayout(r,i.getId(),O.getByName(a),-1))},[m]),N=(0,g.useMemo)(()=>{let e=(T.boards||[]).find(e=>e.id===n.key),t=k.find(e=>e.key===n.key),r=t&&t.repo||(T.repos||[]).find(e=>t&&(e.id===t.repo?.id||e.path===t.cwd))||null,i=r&&r.boards&&r.boards[0]||null,a=t&&n.task?(t.tasks||[]).find(e=>String(e.id)===String(n.task)):null;return{boardName:e&&e.name||i&&i.name||``,boardId:e&&e.id||i&&i.id||``,dirName:t?t.name:``,pageTitle:a?`#${a.id}`:``}},[T.boards,T.repos,k,n.key,n.task]);(0,g.useEffect)(()=>{Qi(location.hash)},[n.view,n.key,n.task]);let P=(0,g.useRef)(m);(0,g.useEffect)(()=>{P.current=m},[m]);let F=(0,g.useRef)(N);(0,g.useEffect)(()=>{F.current=N},[N]);let I=`${N.boardName}|${N.dirName}|${N.pageTitle}`,ee=(0,g.useRef)({route:``,key:``});(0,g.useEffect)(()=>{let e=P.current;if(!e)return;let t=Li(n,F.current);if(!t)return;let r=`${n.view}|${n.key}|${n.task}`,i=ee.current;(i.route!==r||i.key!==I)&&(ee.current={route:r,key:I},sr(e,t))},[n,I]);let te=(0,g.useCallback)(e=>{m&&sr(m,{component:`page`,name:e.name||`页面`,config:{dirKey:e.dirKey,task:e.task},location:e.location||`center`})},[m]),ne=(0,g.useCallback)(e=>{m&&e&&m.doAction(j.deleteTab(e))},[m]),re=(0,g.useRef)(null),ie=(0,g.useCallback)(()=>{if(!m)return;let e=pr(m);if(!e)return;let t=e.getId(),n=re.current;if(re.current=t,n===t)return;let i=Fi(e);if(!i)return;let a=Li(ea(),N);if(a&&a.component===e.getComponent()&&JSON.stringify(a.config||{})===JSON.stringify(e.getConfig()||{}))return;history.replaceState(null,``,i);let o=ea();r(e=>e.view===o.view&&e.key===o.key&&e.task===o.task?e:o)},[m,N]),{dialog:ae,node:oe}=a(),se=(0,g.useCallback)(async()=>{await ae({title:`重置为初始两栏`,message:`丢掉存下来的布局,回到初始的两栏(目录 + 开始)?`,okText:`重置`})&&(Gn(),h(Hn()))},[ae,h]),L=(0,g.useMemo)(()=>({undo:v,redo:y,canUndo:b,canRedo:x,resetLayout:se,openSettings:()=>Ni(m)}),[v,y,b,x,se,m]),ce=(0,g.useMemo)(()=>({boot:e,rows:k,repoData:T,prefs:i,patchPrefs:S,onNavigate:C,refreshLocal:w,refreshRepos:D,tpl:f,model:m,route:n,localReady:u!==null,openPage:te,closePanel:ne,shell:L}),[e,k,T,i,S,C,w,D,f,m,n,te,ne,L]);return(0,_.jsx)(an.Provider,{value:ce,children:(0,_.jsx)(`div`,{id:`app-shell`,className:`nx-shell`,children:(0,_.jsx)(`div`,{className:`nx-workarea`,children:m?(0,_.jsxs)(rn,{children:[(0,_.jsx)(Gt,{ref:p,model:m,factory:Pi,onAction:e=>e,onModelChange:ie,i18nTranslator:na,keyMap:{..._e,focusTabToggle:`F6`,focusNextTabset:`Ctrl+F6`,focusPreviousTabset:`Ctrl+Shift+F6`},icons:{dragToDock:(0,_.jsx)(`button`,{type:`button`,className:`flx-dockback`,title:`迁回主布局(也可拖到面板边缘停靠)`,"aria-label":`迁回主布局`,onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),M(e)},children:(0,_.jsx)(s,{name:`dock`,size:14})})}}),(0,_.jsx)(J,{model:m}),oe]},`workspace`):(0,_.jsx)(`div`,{className:`pad muted`,children:`正在装载工作区…`})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,_.jsx)(g.StrictMode,{children:(0,_.jsx)(en,{children:(0,_.jsx)(e,{children:(0,_.jsx)(ra,{})})})}));export{sr as A,sn as B,br as C,nr as D,hr as E,Sn as F,tn as G,cn as H,wn as I,p as J,Yt as K,Cn as L,xn as M,vn as N,Kn as O,yn as P,gn as R,Cr as S,Sr as T,on as U,ln as V,nn as W,Fr as _,Bi as a,Ir as b,Vi as c,Jr as d,Er as f,zr as g,Rr as h,zi as i,_n as j,or as k,ni as l,Pr as m,Wi as n,Ui as o,Ur as p,j as q,Ri as r,Hi as s,$i as t,ti as u,jr as v,xr as w,Wr as x,wr as y,bn as z};