abdul-react 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -25,7 +25,7 @@ object-assign
25
25
  *
26
26
  * This source code is licensed under the MIT license found in the
27
27
  * LICENSE file in the root directory of this source tree.
28
- */function Ig(){return zg||(zg=1,e=Tg,"production"!==process.env.NODE_ENV&&function(){function t(e,t){var n=e.length;e.push(t),function(e,t,n){for(var r=n;r>0;){var o=r-1>>>1,a=e[o];if(!(i(a,t)>0))return;e[o]=t,e[r]=a,r=o}}(e,t,n)}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();return n!==t&&(e[0]=n,function(e,t,n){for(var r=n,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(i(s,t)<0)c<o&&i(d,s)<0?(e[r]=d,e[c]=t,r=c):(e[r]=s,e[l]=t,r=l);else{if(!(c<o&&i(d,t)<0))return;e[r]=d,e[c]=t,r=c}}}(e,n,0)),t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error),"object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var s=[],c=[],d=1,u=null,f=3,h=!1,p=!1,C=!1,m="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function y(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))return;r(c),i.sortIndex=i.expirationTime,t(s,i)}i=n(c)}}function w(e){if(C=!1,y(e),!p)if(null!==n(s))p=!0,O(b);else{var t=n(c);null!==t&&z(w,t.startTime-e)}}function b(t,i){p=!1,C&&(C=!1,N()),h=!0;var o=f;try{return function(t,i){var o=i;for(y(o),u=n(s);null!==u&&(!(u.expirationTime>o)||t&&!k());){var a=u.callback;if("function"==typeof a){u.callback=null,f=u.priorityLevel;var l=a(u.expirationTime<=o);o=e.unstable_now(),"function"==typeof l?u.callback=l:u===n(s)&&r(s),y(o)}else r(s);u=n(s)}if(null!==u)return!0;var d=n(c);return null!==d&&z(w,d.startTime-o),!1}(t,i)}finally{u=null,f=o,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var E=!1,M=null,A=-1,x=5,L=-1;function k(){return!(e.unstable_now()-L<x)}var H,S=function(){if(null!==M){var t=e.unstable_now();L=t;var n=!0;try{n=M(!0,t)}finally{n?H():(E=!1,M=null)}}else E=!1};if("function"==typeof v)H=function(){v(S)};else if("undefined"!=typeof MessageChannel){var _=new MessageChannel,V=_.port2;_.port1.onmessage=S,H=function(){V.postMessage(null)}}else H=function(){m(S,0)};function O(e){M=e,E||(E=!0,H())}function z(t,n){A=m(function(){t(e.unstable_now())},n)}function N(){g(A),A=-1}var T=function(){};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_continueExecution=function(){p||h||(p=!0,O(b))},e.unstable_forceFrameRate=function(e){e<0||e>125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):x=e>0?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(s)},e.unstable_next=function(e){var t;switch(f){case 1:case 2:case 3:t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=T,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,o){var a,l,u=e.unstable_now();if("object"==typeof o&&null!==o){var f=o.delay;a="number"==typeof f&&f>0?u+f:u}else a=u;switch(r){case 1:l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}var m=a+l,g={id:d++,callback:i,priorityLevel:r,startTime:a,expirationTime:m,sortIndex:-1};return a>u?(g.sortIndex=a,t(c,g),null===n(s)&&g===n(c)&&(C?N():C=!0,z(w,a-u))):(g.sortIndex=m,t(s,g),p||h||(p=!0,O(b))),g},e.unstable_shouldYield=k,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Tg;var e}var Dg=(Ng||(Ng=1,"production"===process.env.NODE_ENV?Vg.exports=(_g||(_g=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(0>i(s,n))c<o&&0>i(d,s)?(e[r]=d,e[c]=n,r=c):(e[r]=s,e[l]=n,r=l);else{if(!(c<o&&0>i(d,n)))break e;e[r]=d,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var s=[],c=[],d=1,u=null,f=3,h=!1,p=!1,C=!1,m="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function y(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(s,i)}i=n(c)}}function w(e){if(C=!1,y(e),!p)if(null!==n(s))p=!0,O(b);else{var t=n(c);null!==t&&z(w,t.startTime-e)}}function b(t,i){p=!1,C&&(C=!1,g(x),x=-1),h=!0;var o=f;try{for(y(i),u=n(s);null!==u&&(!(u.expirationTime>i)||t&&!H());){var a=u.callback;if("function"==typeof a){u.callback=null,f=u.priorityLevel;var l=a(u.expirationTime<=i);i=e.unstable_now(),"function"==typeof l?u.callback=l:u===n(s)&&r(s),y(i)}else r(s);u=n(s)}if(null!==u)var d=!0;else{var m=n(c);null!==m&&z(w,m.startTime-i),d=!1}return d}finally{u=null,f=o,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var E,M=!1,A=null,x=-1,L=5,k=-1;function H(){return!(e.unstable_now()-k<L)}function S(){if(null!==A){var t=e.unstable_now();k=t;var n=!0;try{n=A(!0,t)}finally{n?E():(M=!1,A=null)}}else M=!1}if("function"==typeof v)E=function(){v(S)};else if("undefined"!=typeof MessageChannel){var _=new MessageChannel,V=_.port2;_.port1.onmessage=S,E=function(){V.postMessage(null)}}else E=function(){m(S,0)};function O(e){A=e,M||(M=!0,E())}function z(t,n){x=m(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_continueExecution=function(){p||h||(p=!0,O(b))},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"):L=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(s)},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_pauseExecution=function(){},e.unstable_requestPaint=function(){},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,o){var a=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?a+o:a,r){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return r={id:d++,callback:i,priorityLevel:r,startTime:o,expirationTime:l=o+l,sortIndex:-1},o>a?(r.sortIndex=o,t(c,r),null===n(s)&&r===n(c)&&(C?(g(x),x=-1):C=!0,z(w,o-a))):(r.sortIndex=l,t(s,r),p||h||(p=!0,O(b))),r},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(Og)),Og):Vg.exports=Ig()),Vg.exports);const Zg=Symbol(),jg=Symbol(),Rg="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?l:u,Bg=Dg.unstable_runWithPriority?e=>{try{Dg.unstable_runWithPriority(Dg.unstable_NormalPriority,e)}catch(t){if("Not implemented."!==t.message)throw t;e()}}:e=>e();function Pg(e,t){const n=d(e)[Zg];if("object"==typeof process&&"production"!==process.env.NODE_ENV&&!n)throw new Error("useContextSelector requires special context");const{v:{current:r},n:{current:i},l:o}=n,a=t(r),[l,s]=v((e,n)=>{if(!n)return[r,a];if("p"in n)throw n.p;if(n.n===i)return Object.is(e[1],a)?e:[r,a];try{if("v"in n){if(Object.is(e[0],n.v))return e;const r=t(n.v);return Object.is(e[1],r)?e:[n.v,r]}}catch(e){}return[...e]},[r,a]);return Object.is(l[1],a)||s(),Rg(()=>(o.add(s),()=>{o.delete(s)}),[o]),l[1]}const Fg=function(e){const t=s({[Zg]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});var n;return t[jg]=t.Provider,t.Provider=(n=t.Provider,({value:e,children:t})=>{const r=a(e),i=a(0),[o,l]=c(null);o&&(o(e),l(null));const s=a();if(!s.current){const e=new Set,t=(t,n)=>{i.current+=1;const r={n:i.current};(null==n?void 0:n.suspense)&&(r.n*=-1,r.p=new Promise(e=>{l(()=>t=>{r.v=t,delete r.p,e(t)})})),e.forEach(e=>e(r)),t()};s.current={[Zg]:{v:r,n:i,l:e,u:t}}}return Rg(()=>{r.current=e,i.current+=1,Bg(()=>{s.current[Zg].l.forEach(t=>{t({n:i.current,v:e})})})},[e]),C(n,{value:s.current},t)}),delete t.Consumer,t}([Hg,()=>{}]),Ug=({children:t,useTableRef:n,totalWidth:r})=>{const i=a(null);return l(()=>{n&&i.current&&n(i)},[n]),e("table",{className:"ff-spreadsheet-table",ref:i,style:{minWidth:`${60+r}px`,tableLayout:"fixed"},children:t})},qg=t=>e("tr",{...t}),Wg=t=>e("tr",{className:"ff-spreadsheet-row-header",...t});function Qg(){return Pg(Fg,([,e])=>e)}function Gg(e){return Pg(Fg,([t])=>e(t))}const Kg=({selected:t,onSelect:n})=>{const i=r.useCallback(()=>{n()},[n]);return e("th",{className:"ff-spreadsheet-corner-header",onClick:i,tabIndex:0,children:e("div",{className:z("corner-header",{"ff-spreadsheet-header--selected":t}),children:e(P,{variant:t?"dark":"light",color:t?"var(--hover-color)":"var(--text-color)",name:"excel_corner_menu"})})})},Yg=t=>function(n){const i=Qg(),o=r.useCallback(()=>i({type:Zp}),[i]),a=Gg(e=>e.selected instanceof bm);return e(t,{...n,selected:a,onSelect:o})},Xg=t=>function(n){const i=Qg(),o=r.useCallback((e,t)=>i(function(e,t){return{type:Dp,payload:{column:e,extend:t}}}(e,t)),[i]),a=Gg(e=>e.selected.hasEntireColumn(n.column)),l=Gg(e=>e.selectedColumn??void 0),s=Gg(e=>e.active?rm(e.active,e.model.data):void 0);return e(t,{...n,cell:s,selected:a,selectedColumn:l,onSelect:o,scrollToColumn:n.scrollToColumn})},Jg=Xg(({column:t,label:i,selected:o,onSelect:a,setContextMenu:l,deleteColumn:s,addColumnLeft:c,addColumnRight:d,columnContextEnable:u,cell:f,selectedColumn:p,minimumColumnWidth:C,maxColLimit:m,disableDeleteOption:g,contextMenu:v,onAddColumn:y,onDeleteColumn:w,setVisibleRange:b,scrollToColumn:E})=>{const M=Qg(),A=Gg(e=>e.model.data),x=C,L=Gg(e=>e.columnDimensions[t]?.width||x),k=Gg(e=>e.model.data),{columnCount:H}=Ym(k),S=e=>{b(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return p&&E(p),n})},_=h(()=>[{label:"Add Column Left",value:"Add Column Left",iconName:"plus_icon",action:()=>{S("increment"),c(x),y?.(p??t,!0)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Left"]??!1,disable:H>=m},{label:"Add Column Right",value:"Add Column Right",iconName:"plus_icon",action:()=>{S("increment"),d(x),y?.(p??t,!1)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Right"]??!1,disable:H>=m},...g?[]:[{label:"Delete Column",value:"Delete Column",iconName:"delete",action:()=>{S("decrement"),s(),w?.(p??t)},disableTooltip:"",visible:f?.contextDisable?.["Delete Column"]??!1,disable:!1}]],[p,t,A]),V=r.useCallback((e,n)=>{const r=n?t-1:t,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientX,l=L,s=e=>{const t=Math.max(x,l+(e.clientX-o));M(LC(i,t))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),M($C())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),M(JC())},[t,L]),O=r.useCallback(e=>M(QC(e)),[M]),N=r.useCallback(e=>{a(t,e.shiftKey)},[a,t]),T=r.useCallback(e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"column",options:_})},[t,p,u,_]);return r.useEffect(()=>{void 0!==p&&"column"===v?.contextType&&l(e=>({open:e.open,contextType:"column",options:_}))},[t,p,u,_,"column"===v?.contextType]),n("th",{className:z("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{minWidth:`${L}px`},onClick:N,onContextMenu:T,tabIndex:0,children:[e(F,{fontWeight:"medium",children:i??$g(t)}),e("div",{className:"drag-column-selector drag-column-left",onMouseDown:e=>V(e,!1),onDoubleClick:()=>M(LC(t,x)),onClick:()=>O({row:-1,column:t})}),e("div",{className:"drag-column-selector drag-column-right",onMouseDown:e=>V(e,!0),onDoubleClick:()=>M(LC(t,x)),onClick:()=>O({row:-1,column:t})})]},t)});function $g(e){let t="",n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}const ev=({row:t,label:i,selected:o,onSelect:a,setContextMenu:l,addRowTop:s,addRowBottom:c,deleteRow:d,rowContextEnable:u,selectedRow:f,cell:h,maxRowLimit:p,disableDeleteOption:C,contextMenu:m,setVisibleRange:g,scrollToRow:v})=>{const y=Qg(),w=Gg(e=>e.rowDimensions[t]?.height||32),b=Gg(e=>e.model.data),{rowCount:E}=Ym(b),M=e=>{g(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return f&&v(f),n})},A=r.useMemo(()=>[{label:"Add Row Top",value:"Add Row Top",iconName:"plus_icon",action:()=>{M("increment"),s()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Top"]??!1,disable:E>=p},{label:"Add Row Bottom",value:"Add Row Bottom",iconName:"plus_icon",action:()=>{M("increment"),c()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Bottom"]??!1,disable:E>=p},...C?[]:[{label:"Delete Row",value:"Delete Row",iconName:"delete",action:()=>{M("decrement"),d()},disableTooltip:"",visible:h?.contextDisable?.["Delete Row"]??!1,disable:!1}]],[f,t]),x=r.useCallback((e,n)=>{const r=n?t:t-1,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientY,l=w,s=e=>{const t=Math.max(32,l+(e.clientY-o));y(xC(i,t))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),y($C())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),y($C())},[w,t]),L=r.useCallback(e=>y(QC(e)),[y]),k=r.useCallback(e=>{a(t,e.shiftKey)},[t]),H=r.useCallback(e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"row",options:A})},[t,u,A,f]);return r.useEffect(()=>{void 0!==f&&"row"===m?.contextType&&l(e=>({open:e.open,contextType:"row",options:A}))},[t,u,A,f,"row"===m?.contextType]),n("th",{className:z("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{height:`${w}px`,minWidth:"60px"},onClick:k,onContextMenu:H,tabIndex:0,children:[e(F,{fontWeight:"medium",children:void 0!==i?i:t+1}),e("div",{className:"drag-row-selector drag-row-down",onMouseDown:e=>x(e,!0),onDoubleClick:()=>y(xC(t,32)),onClick:()=>L({row:t,column:-1})}),e("div",{className:"drag-row-selector drag-row-up",onMouseDown:e=>x(e,!1),onDoubleClick:()=>y(xC(t,32)),onClick:()=>L({row:t,column:-1})})]})},tv=t=>function(n){const i=Qg(),o=Gg(e=>e.selected.hasEntireRow(n.row)),a=Gg(e=>e.active?rm(e.active,e.model.data):void 0),l=Gg(e=>e.selectedRow??void 0),s=r.useCallback((e,t)=>i(function(e,t){return{type:Ip,payload:{row:e,extend:t}}}(e,t)),[i]);return e(t,{...n,selected:o,cell:a,selectedRow:l,onSelect:s,scrollToRow:n.scrollToRow})},nv=({row:t,column:n,DataViewer:i,active:o,dragging:a,mode:l,data:s,evaluatedData:c,select:d,activate:u,setCellDimensions:f,setCellData:h})=>{const p=r.useRef(null),C=r.useMemo(()=>({row:t,column:n}),[t,n]),m=r.useCallback(e=>{e.preventDefault(),window.getSelection()?.removeAllRanges(),"view"===l&&(f(C,Vm(e.currentTarget)),e.shiftKey?d(C):u(C))},[l,f,C,d,u]),g=r.useCallback(e=>{a&&(f(C,Vm(e.currentTarget)),d(C))},[f,d,a,C]);return r.useEffect(()=>{const e=p.current;if(!e)return;const t=()=>{f(C,Vm(e))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[f,C]),s&&s.DataViewer&&(i=s.DataViewer),e("td",{ref:p,style:{...s?.style,..."dropDown"===s?.inputType?.type&&{fontSize:"12px"},textDecoration:"underline"===s?.style?.textDecoration?s?.style?.textDecoration:"none"},className:z("ff-spreadsheet-cell",s?.className,{"ff-spreadsheet-active-cell":o||a}),onMouseEnter:g,onMouseDown:m,tabIndex:0,children:e(i,{row:t,column:n,cell:s,active:o,evaluatedCell:c,setCellData:h,inputValue:()=>null})})},rv=t=>function(n){const{row:i,column:o}=n,a=Qg(),l=r.useMemo(()=>({row:i,column:o}),[i,o]),s=r.useCallback(e=>a(GC(l,e)),[a,l]),c=r.useCallback(e=>a(function(e){return{type:Rp,payload:{point:e}}}(e)),[a]),d=r.useCallback(e=>a(QC(e)),[a]),u=r.useCallback((e,t)=>a(KC(e,t)),[a]),f=Gg(e=>_m(e.active,l)),h=Gg(e=>f?e.mode:"view"),p=Gg(e=>rm(l,e.model.data)),C=Gg(e=>rm(l,e.model.evaluatedData)),m=Gg(e=>e.dragging),g=Gg(e=>e.copied?.has(l)||!1);return e(t,{...n,active:f,copied:g,dragging:m,mode:h,evaluatedData:C,data:p,select:c,activate:d,setCellDimensions:u,setCellData:s})},iv=({cell:r,evaluatedCell:i,active:o})=>{const a=function(e,t){const n=t?.value??e?.value;if(n&&"object"==typeof n)return n.toString();return n}(r,i);return e("span","boolean"==typeof a?{className:"ff-spreadsheet-data-viewer ff-spreadsheet-data-viewer--boolean",children:ov(a)}:{className:z("ff-spreadsheet-data-viewer",{"ff-spreadsheet-data-viewer--preserve-breaks":Fm(a)}),children:o||"dropDown"!==r?.inputType?.type?o||"file"!==r?.inputType?.type?!o&&a:e(t,{children:G(r?.value)?n("div",{className:"ff-spreadsheet-data-viewer--without-fileType",children:[e(P,{name:"attachment_icon"})," Attachment"]}):(n=>{if(G(n))return e(t,{});return JSON.parse(n).map(t=>e("div",{className:"ff-spreadsheet-data-viewer--fileType",children:e(cn,{width:r?.style?.width??100,title:t?.name?.split("*")?.[0]??""})},t.name))})(a)}):n("div",{className:"ff-spreadsheet-data-viewer--dropdownType",children:[a,e(P,{name:"arrow_down",height:8,className:"dropdownType-icon"})]})})};function ov(e){return e?"TRUE":"FALSE"}const av=i.forwardRef(({initialValue:t="",onChange:n,className:r="",style:o={}},s)=>{const c=a(null);i.useImperativeHandle(s,()=>c.current),l(()=>{c.current&&t!==c.current.innerText&&(c.current.innerText=t)},[t]);const d=()=>{if(c.current){c.current.querySelectorAll("br").forEach(e=>{e.nextSibling&&(e.nextSibling.nodeType!==Node.TEXT_NODE||e.nextSibling.textContent?.trim())||e.remove()});const e=c.current.innerText;n?.(e)}};return e("div",{style:o,children:e("div",{ref:c,className:`editable-cell ${r}`,contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:e=>{if("Enter"===e.key){if(e.altKey||e.shiftKey)return e.preventDefault(),document.execCommand("insertLineBreak"),void d();c.current?.blur()}"Delete"!==e.key&&"Backspace"!==e.key||e.stopPropagation()},onInput:d,onPaste:e=>{e.preventDefault();const t=e.clipboardData.getData("text/plain"),n=window.getSelection();if(!n||!n.rangeCount)return;const r=n.getRangeAt(0);r.deleteContents();const i=document.createTextNode(t);r.insertNode(i),r.setStartAfter(i),r.collapse(!0),n.removeAllRanges(),n.addRange(r),d()},spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{outline:"none",transition:"border 0.2s",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"inherit",fontSize:"inherit",lineHeight:"normal",minHeight:"24px",verticalAlign:"middle",caretColor:"black",height:"inherit",maxHeight:"inherit",display:"block",position:"relative",paddingBottom:"2px"}})})}),lv=({onChange:t,cell:n})=>{const i=r.useRef(null),o=r.useCallback(e=>{const{contextDisable:r,...i}=n;t({...i,value:e,inputType:i.inputType??{type:"text"}})},[t,n]);r.useEffect(()=>{i.current&&function(e){if(e)if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)e.selectionStart=e.selectionEnd=e.value.length;else if(e.isContentEditable){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n?.removeAllRanges(),n?.addRange(t)}}(i.current)},[]);return e("div",{className:"ff-spreadsheet-data-editor",children:e(av,{ref:i,initialValue:n?.value??"",onChange:o,className:"ff-spreadsheet-cell-textarea",style:{...n?.style,borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})})},sv=t=>{const i=r.useRef(null),o=r.useRef(null),a=Qg(),l=r.useCallback((e,t)=>a(GC(e,t)),[a]),s=r.useCallback(e=>a(QC(e)),[a]),c=r.useCallback(()=>a({type:Qp}),[a]),d=r.useCallback(e=>a({type:yC,payload:{autofill:e}}),[a]),u=r.useCallback(e=>a(function(e){return{type:eC,payload:{changes:e}}}(e)),[a]),f=r.useCallback(()=>{a({type:Gp})},[a]),h=Gg(e=>e.rowDimensions),p=Gg(e=>e.active),C=Gg(e=>e.mode),m=Gg(e=>e.active?rm(e.active,e.model.data):void 0),g=Gg(e=>e.selected),v=Gg(e=>g&&jm(e.rowDimensions,e.columnDimensions,e.model.data,e.selected)),y=Gg(e=>{let t=p?Dm(p,e.rowDimensions,e.columnDimensions):void 0;return t={top:t?.top?t?.top:0,height:t?.height?t?.height:0,left:t?.left?t?.left:0,width:t?.width?t?.width:0},t}),w=r.useMemo(()=>!p||!y||p.row<t.visibleRowRange.start||p.row>=t.visibleRowRange.end||p.column<t.visibleColRange.start||p.column>=t.visibleColRange.end,[p,y,t.visibleRowRange,t.visibleColRange]),b=r.useRef(void 0),E=r.useRef(null),M=r.useRef(void 0),A=r.useCallback(e=>{p&&l(p,e)},[l,p]),[x,L]=r.useState({value:"",name:""}),[k,H]=r.useState(!1),[S,_]=r.useState(),[V,O]=r.useState([]);r.useEffect(()=>{m&&p&&t.getActiveCell({value:m.value,active:p});const n=i.current;if(!w&&n){if(n.focus({preventScroll:!0}),"file"===m?.inputType?.type&&m?.value)try{const e=JSON.parse(m.value).map(e=>new File([new Blob],e.name.split("*")[0]??"default"));O(e)}catch(e){console.error("Error parsing cell value for files:",e),O([])}else O([]);if("dropDown"===m?.inputType?.type){L({value:m?.value,name:m?.value}),H(e=>!e);const t=m?.inputType?.options?.map(t=>({disable:t.disable,label:e("span",{style:{color:t.color},children:t.label}),value:t.value}));_(t)}}},[i,w,p?.row,p?.column]),r.useEffect(()=>{"dropDown"===m?.inputType?.type&&m?.value!==x.value&&L({value:m?.value,name:m?.value})},[m?.value,m?.inputType?.type,x.value]),r.useEffect(()=>{const e=E.current,t=M.current;if(E.current=p,M.current=m,!e||!t)return;const n=p?.row!==e.row||p?.column!==e.column;if(n||"edit"!==C){const e=b.current;t!==e?u([{prevCell:e||null,nextCell:t}]):n||m===t||u([{prevCell:t,nextCell:m||null}]),b.current=m}});const N=m&&m.DataEditor||t.DataEditor,T=m&&m.readOnly,I=r.useCallback(e=>{if(!p)return;const t=e.currentTarget.closest(".ff-excel-spreadsheet");if(!t)return void e.preventDefault();e.stopPropagation();const n=document.body.style.userSelect,r=document.body.style.overflow;document.body.style.userSelect="none",document.body.style.overflow="hidden";let i=null;const o=()=>{i&&(cancelAnimationFrame(i),i=null)},a=e=>{const n=t.getBoundingClientRect();let r=0,a=0;e.clientY<n.top+50?a=-12:e.clientY>n.bottom-50&&(a=12),e.clientX<n.left+50?r=-12:e.clientX>n.right-50&&(r=12),0!==r||0!==a?(e=>{o();const n=()=>{const{x:r,y:o}=e;0!==r&&(t.scrollLeft+=r),0!==o&&(t.scrollTop+=o),i=requestAnimationFrame(n)};i=requestAnimationFrame(n)})({x:r,y:a}):o()},l=()=>{o(),document.body.style.userSelect=n,document.body.style.overflow=r,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",l),d(!0)},[s,d,p]),D=r.useCallback(e=>{e.preventDefault(),t.setContextMenu({open:t.contextOption?.open??!1,contextType:t.contextOption?.contextType??null,options:t.contextOption?.options||[]})},[t]),Z=v?.height!==y?.height||v?.width!==y?.width,j=r.useCallback(e=>{p&&Z&&(KC(p,Vm(e.currentTarget)),s(p))},[p,Z]),R=t.isAtRight?t.maxWidth-(y?.left-t.scrollPos.left)+100:t.maxWidth,B=t.isAtBottom?t.maxHeight-(y?.top-t.scrollPos.top)+64:t.maxHeight,P=["file","dropDown"].includes(m?.inputType?.type||"");return n("div",{ref:i,className:z("ff-spreadsheet-active-cell",`ff-spreadsheet-active-cell--${C}`,{"ff-spreadsheet-active-cell--hidden":w,"ff-spreadsheet-active-cell--dragging":Z&&"text"!==m?.inputType?.type}),onMouseDown:j,style:{...y,backgroundColor:m?.style?.backgroundColor,...P?{display:"flex",alignItems:m?.style?.alignContent,justifyContent:m?.style?.textAlign}:{},..."edit"===C&&p?{minWidth:Math.min(y?.width,t.maxWidth),minHeight:Math.min(y?.height,t.maxHeight),height:"auto",maxWidth:`${R}px`,maxHeight:`${B}px`,overflow:"auto",..."dropDown"===m?.inputType?.type?{}:{padding:"2px 4px 0px 4px",width:"max-content"}}:{}},onContextMenu:D,onClick:"view"!==C||T?void 0:c,tabIndex:0,children:[e("div",{className:P?"":"active-cell-main",children:"dropDown"===m?.inputType?.type?e(lr,{...m?.inputType?.inputProps,dropDownRef:o,showOptions:{open:!("edit"!==C||!p),toggle:k},selectedOption:x,optionsList:S||[],height:26,showLabel:!1,disabled:!t.editable,showBorder:!1,optionZIndex:5e3,onChange:e=>{L({value:e.value,name:e.label}),A({...m,value:e.value,style:m?.style,inputType:m?.inputType})}}):"file"===m?.inputType?.type?e(Lp,{...m?.inputType?.inputProps,label:"",onFileListClick:e=>{const n=e.target.closest(".ff-attachment-files"),r=e.target.closest(".ff-icon-container, .ff-icon-click, .ff-icon-danger");if(n&&!r&&m?.value&&t.attachmentAction?.viewAttachment)try{const e=JSON.parse(m.value),r=n.parentElement?.querySelectorAll(".ff-attachment-files")||[],i=Array.from(r).indexOf(n);if(-1===i||!e[i])return void console.error("File index not found or invalid");const o=e[i];t.attachmentAction.viewAttachment(o.id,o.name?.split("*")[0]??"default")}catch(e){console.error("Error parsing cell value:",e)}else console.warn("Missing file element, icon click, cell value, or viewAttachment action")},selectedFiles:V,onFilesChange:async(e,n,r)=>{try{if("ADD"===r&&"file"===m?.inputType?.type){let n=[];try{m?.value&&(n=JSON.parse(m.value))}catch(e){console.error("Error parsing cell.value:",e)}let r=0;const i=e.filter((e,t,i)=>{const o=e.name.split("*")[0],a=i.findIndex(e=>e.name.split("*")[0]===o)!==t,l=n.some(e=>e.name.split("*")[0]===o);return!a&&!l||(r++,!1)});if(n.length+i.length>5)return void Za.info("Cannot upload more than 5 files.");if(t.attachmentAction?.addAttachment&&i.length>0)try{let e=0,r=0,o=0;const l=V?.length+i?.length,s=l>0?25*l:1,c=[...n],d=i?.map(async e=>{try{if(e.name.includes("*"))return{file:e,status:"existing",data:{name:e.name}};const n=await(t?.attachmentAction?.addAttachment(e));if(!n||"string"==typeof n&&0===n.trim().length)return{file:e,status:"failed",reason:"no response"};if("string"==typeof n)try{const t=JSON.parse(n);return 507===t.responseCode?{file:e,status:"memory_full",reason:"no memory"}:400===t.responseCode?{file:e,status:"failed",reason:"invalid file"}:t?.id&&t?.name?{file:e,status:"success",data:t}:(console.error(`Invalid response structure for ${e.name}:`,t),{file:e,status:"failed",reason:"invalid response"})}catch(t){return console.error(`Parse error for ${e.name}:`,t),{file:e,status:"failed",reason:"parse error"}}if("object"==typeof n&&null!==n){const t=n;return t?.id&&t?.name?{file:e,status:"success",data:t}:(console.error(`Invalid response structure for ${e.name}:`,n),{file:e,status:"failed",reason:"invalid response"})}return console.error(`Unknown response for ${e.name}:`,n),{file:e,status:"failed",reason:"unknown"}}catch(t){return console.error(`Upload failed for ${e.name}:`,t),{file:e,status:"failed",reason:"upload error"}}});if((await Promise.allSettled(d)).forEach(t=>{if("fulfilled"===t.status&&t.value){const{status:n,data:i}=t.value;"success"===n&&i?.id&&i?.name?(c.push(i),e++):"existing"===n&&i?.name?c.push(i):"memory_full"===n?o++:r++}else r++}),e>0||c.length>n.length){const e=c.length>0?JSON.stringify(c):"";A({...m,value:e,style:m?.style,inputType:m?.inputType}),a(xC(p?.row||0,Math.max(s,h?.[p.row]?.height||s))),O(c.map(e=>new File([new Blob],e.name?.split("*")[0]??"default")))}o>0&&Za.info("No memory available to add the file"),e>0&&Za.success(`${e} file${e>1?"s":""} uploaded successfully`),r>0&&Za.info(`${r} unsupported ${r>1?"files":"file"}. Please check the file formats.`)}catch(e){console.error("Upload operation failed:",e),Za.error("Operation failed")}}else if("DELETE"===r&&"file"===m?.inputType?.type)try{let e=[...m&&JSON.parse(m.value)],r=0;for(const i of n||[]){const n=e.findIndex(e=>e.name.split("*")[0]===i.name.split("*")[0]),o=e[n]?.id;if(-1!==n&&o&&t.attachmentAction?.deleteAttachment)try{const a=await t.attachmentAction.deleteAttachment(o);"SUCCESS"===a||"object"==typeof a&&null!==a&&("status"in a&&"SUCCESS"===a.status||"responseCode"in a&&200===a.responseCode)?(e.splice(n,1),r++):console.error(`Delete failed for ${i.name}: Invalid response`,a)}catch(e){console.error(`Delete error for ${i.name}:`,e),Za.error("Error deleting file")}else console.error(`Cannot delete ${i.name}: Invalid fileId or no match`,{index:n,fileId:o,hasDeleteAttachment:!!t.attachmentAction?.deleteAttachment}),Za.error("Failed to delete file: Invalid file data")}if(r>0){const t=e.length>0?JSON.stringify(e):"";A({...m,value:t,style:m?.style,inputType:m?.inputType}),O(e?.map(e=>new File([new Blob],e.name.split("*")[0]))),Za.success(`${r} file${r>1?"s":""} deleted successfully`)}else if(n?.length){const t=e?.filter(e=>e.id&&e.name);if(t.length<e.length){const e=t.length>0?JSON.stringify(t):"";A({...m,value:e,style:m?.style,inputType:m?.inputType}),O(t.map(e=>new File([new Blob],e.name.split("*")[0]))),Za.error("Failed to delete file(s). Invalid file data detected.")}else Za.error("Failed to delete file(s). No valid files removed.")}}catch(e){console.error("Delete operation failed:",e),Za.error("Delete operation failed")}}catch(e){console.error("handleFilesChange error:",e),Za.error("Operation failed")}},disabled:!t.editable,maxFiles:5,buttonLabel:"+ Attachments",buttonVariant:"tertiary",deleteButton:t.editable,selectedFileMessage:"Duplicate attachments not allowed within the same row",addAttachmentButton:t.editable,isInfoIconRequired:!1,truncateMaxLimit:(y?.width??0)-60}):"edit"===C&&p&&t.editable?e(N,{row:p.row,column:p.column,cell:m,onChange:A,exitEditMode:f}):e(av,{initialValue:m?.value,onChange:()=>{},className:"ff-spreadsheet-cell-textarea",style:{...m?.style,textDecoration:"underline"===m?.style?.textDecoration?"underline":"none",backgroundColor:Z?"#1e161f00":m?.style?.backgroundColor,pointerEvents:"none",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})}),!["file"].includes(m?.inputType?.type??"")&&("edit"===C||p&&e("div",{onMouseDown:I,className:"select_dot"}))]},`${p?.row}-${p?.column}`)},cv=({dimensions:t,dragging:n,hidden:r,variant:i})=>{const o=Gg(e=>e.active),a=Gg(e=>e.autoFill),l=Gg(e=>o?Dm(o,e.rowDimensions,e.columnDimensions):void 0),{width:s,height:c,top:d,left:u}=t||{};let f=l?.height??0,h=l?.width??0,p=s,C=c;return a.open&&s&&c&&l&&(s-h>c-f?(p=s,C=l.height):(C=c,p=l.width)),e("div",{className:z("ff-spreadsheet-floating-rect",{[`ff-spreadsheet-floating-rect--${i}`]:i,"ff-spreadsheet-floating-rect--dragging":n,"ff-spreadsheet-floating-rect--hidden":r}),style:{width:(p??0)+1,height:(C??0)+1,top:d,left:u}})},dv=({scrollPos:t={top:0,left:0}})=>{const n=Gg(e=>e.selected),i=Gg(e=>e.dragging),o=Gg(e=>e.selected.size(e.model.data)<2),a=Gg(e=>n&&jm(e.rowDimensions,e.columnDimensions,e.model.data,e.selected)),l=r.useMemo(()=>{if(a)return{...a,top:a.top-1,left:a.left-1,height:a.height-1,width:a.width-1}},[a,t]);return e(cv,{variant:"selected",dimensions:l,dragging:i,hidden:o||!a})},uv=({scrollPos:t={top:0,left:0}})=>{const n=Gg(e=>e.copied),i=null===n,o=Gg(e=>n&&Zm(e.rowDimensions,e.columnDimensions,n)),a=r.useMemo(()=>{if(o)return{...o,top:o.top-1,left:o.left-1,height:o.height-1,width:o.width-1}},[o,t]);return e(cv,{variant:"copied",dimensions:a,hidden:i||!o,dragging:!1})},fv=i.forwardRef(({getColorValue:t,disabled:n,initialColor:r},o)=>{const l=a(null);i.useImperativeHandle(o,()=>l.current);const[s,d]=c(r);return e("div",{className:z("ff-excel-color-selector",{"color-selector-disabled":n}),style:{backgroundColor:s},onClick:()=>{l.current&&!n&&l.current.click()},children:e("input",{type:"color",disabled:n,className:z("ff-excel-color-selector-picker",{"color-selector-disabled":n}),ref:l,onChange:e=>{d(e.target.value),t(e.target.value.replace("#",""))}})})});fv.displayName="ColorBarSelector";const hv=e=>{switch(e.toUpperCase()){case"LEFT":default:return"left";case"RIGHT":return"right";case"CENTER":return"center";case"JUSTIFY":return"justify";case"BOTTOM":return"end";case"TOP":return"start"}},pv=e=>{switch(e){case"left":return"LEFT";case"right":return"RIGHT";case"center":return"CENTER";case"justify":return"JUSTIFY";case"end":default:return"BOTTOM";case"start":return"TOP"}},Cv=e=>Gm.reduce((t,n)=>Math.abs(n-parseFloat(e))<Math.abs(t-parseFloat(e))?n:t);function mv(e){const{border:t}=e;let n="",r="",i="",o="";return"THIN"!==t.top&&(n="MEDIUM"===t.top?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.right&&(r="MEDIUM"===t.right?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.bottom&&(i="MEDIUM"===t.bottom?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.left&&(o="MEDIUM"===t.left?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),{fontSize:Um(Cv(String(e.size))),fontFamily:(a=e.name,Qm.some(e=>e.label===a)?a:"Poppins"),color:`#${e.color}`,backgroundColor:`#${e.backgroundColor}`,fontWeight:e.bold?"bold":"normal",fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":"normal",borderTop:n,borderRight:r,borderBottom:i,borderLeft:o,textAlign:hv(e.alignment.horizontal),alignContent:hv(e.alignment.vertical)};var a}const gv=e=>{if(!e||"none"===e)return"THIN";if(e.includes("solid")||e.includes("dashed")||e.includes("dotted")){if(e.includes("2px")||e.includes("medium"))return"MEDIUM";if(e.includes("3px")||e.includes("medium"))return"THICK"}return"THIN"},vv=e=>({name:e.fontFamily||"Arial",size:qm(e.fontSize?.toString()||"12"),bold:"bold"===e.fontWeight,italic:"italic"===e.fontStyle,underline:"underline"===e.textDecoration,color:e.color?.replace("#","")||"000000",backgroundColor:e.backgroundColor?.replace("#","")||"FFFFFF",borderColor:"F2F2F2",border:{top:gv(e.borderTop?e.borderTop.toString():void 0),right:gv(e.borderRight?e.borderRight.toString():void 0),bottom:gv(e.borderBottom?e.borderBottom.toString():void 0),left:gv(e.borderLeft?e.borderLeft.toString():void 0)},alignment:{horizontal:pv(e.textAlign),vertical:pv(e.alignContent),wrapText:!1}}),yv=({toolbar:t="show",editable:r,onBold:i,onItalic:o,setUnderlineType:s,setColor:d,setFontSize:u,setFontFamily:f,setTextAlign:h,setBackgroundColor:p,setBorderType:C,setFormatePainter:m})=>{const g=Gg(e=>e.selected instanceof bm),[v,y]=c("disable"===t||!r),w=Gg(e=>e.active?rm(e.active,e.model.data):null),b=Gg(e=>e.model.data),E=Gg(e=>e.formattedStyle.open),M={...Wm.style,color:"#1e161f",backgroundColor:"#ffffff",borderColor:"#1e161f"},[A,x]=c(w?.style||M),L=a(null);l(()=>{w?.style&&JSON.stringify(w.style)!==JSON.stringify(A)&&x(w?.style||M),g?y(!r):w&&"boolean"==typeof w.readOnly&&y(w.readOnly||"disable"===t||!r||"dropDown"===w?.inputType?.type)},[w,r]);const k=vv(A),[H,S]=c("border-none"),[_,V]=c({label:"",value:""}),[O,z]=c({label:"",value:""}),[N,T]=c({color:M.color,backgroundColor:M.backgroundColor,borderColor:M.borderColor}),I=[{value:"border-all-sides",label:"All Border",icon:"all_borders"},{value:"border-bottom",label:"Border Bottom",icon:"border_bottom"},{value:"border-left",label:"Border Left",icon:"border_left"},{value:"border-right",label:"Border Right",icon:"border_right"},{value:"border-top",label:"Border Top",icon:"border_top"},{value:"border-none",label:"No Border",icon:"no_border"}],D=Gm.map(e=>({label:e,value:e})),Z=a(null),j=a(null);l(()=>{let e=setTimeout(()=>{d(b,N.color)},0);return()=>{clearTimeout(e)}},[N.color]),l(()=>{let e=setTimeout(()=>{p(b,N.backgroundColor)},0);return()=>{clearTimeout(e)}},[N.backgroundColor]);return l(()=>{const e=A.fontFamily,t=`${qm(A.fontSize)}`;V({label:e??"Times New Roman",value:e??"Times New Roman"}),z({label:t??"11",value:t??"11"})},[A]),n("div",{className:"ff-excel-toolbar",children:[n("div",{className:"ff-excel-toolbar-font ",children:[e("div",{className:"ff-excel-toolbar-font-family",children:e(lr,{disabled:v,height:24,tooltip:!0,showToolTip:!0,showLabel:!1,optionZIndex:2e3,onChange:e=>{V({label:e.label,value:e.label}),f(b,e.value)},required:!1,optionsList:Qm,selectedOption:_})}),e("div",{className:"ff-excel-toolbar-font-size",children:e(lr,{disabled:v,height:24,showLabel:!1,optionZIndex:2e3,required:!1,onChange:e=>{z({label:e.label,value:e.value}),u(b,e.value)},optionsList:D,selectedOption:O})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(K,{placement:"top",title:"Text Left",children:e(P,{disabled:v,variant:"left"===A.textAlign?"dark":"light",hoverEffect:"left"!==A.textAlign,onClick:()=>h(b,"left"),name:"text_align_left"})}),e(K,{placement:"top",title:"Text Center",children:e(P,{disabled:v,variant:"center"===A.textAlign?"dark":"light",hoverEffect:"center"!==A.textAlign,onClick:()=>h(b,"center"),name:"text_align_center"})}),e(K,{placement:"top",title:"Text Right",children:e(P,{disabled:v,variant:"right"===A.textAlign?"dark":"light",hoverEffect:"right"!==A.textAlign,onClick:()=>h(b,"right"),name:"text_align_right"})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-text",children:[e(K,{placement:"top",title:"Bold",children:e(P,{disabled:v,variant:k.bold?"dark":"light",hoverEffect:!k.bold,onClick:()=>i(b),name:"bold"})}),e(K,{placement:"top",title:"Italic",children:e(P,{disabled:v,variant:k.italic?"dark":"light",hoverEffect:!k.italic,onClick:()=>o(b),name:"italic"})}),e(K,{placement:"top",title:"Underline",children:e("div",{className:"ff-excel-toolbar-icon-underline",children:e(P,{disabled:v,variant:"underline"===A.textDecoration?"dark":"light",hoverEffect:"underline"!==A.textDecoration,onClick:()=>s(b),name:"underline"})})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(K,{placement:"top",title:"Format Painter",children:e(P,{disabled:v,variant:E?"dark":"light",hoverEffect:!E,onClick:()=>{m(b)},name:"formate_painter"})}),e(K,{placement:"top",title:"Text Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(P,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{d(b,N.color),Z.current?.click()},name:"text_color"}),e(fv,{ref:Z,disabled:v,getColorValue:e=>{T(t=>({...t,color:e}))},initialColor:N.color})]})}),e(K,{placement:"top",title:"Background Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(P,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{p(b,N.backgroundColor),j.current?.click()},name:"fill_color"}),e(fv,{ref:j,disabled:v,getColorValue:e=>{T(t=>({...t,backgroundColor:e}))},initialColor:N.backgroundColor})]})})]}),e("div",{className:"ff-excel-toolbar-divider"}),e("div",{className:"ff-excel-toolbar-menu",children:n("div",{className:"ff-excel-toolbar-menu-option",children:[e(K,{placement:"top",title:"Border Type",children:e(P,{hoverEffect:!0,disabled:v,onClick:()=>C(b,H,"var(--input-hover-border-color)"),name:(()=>{const e=I.find(e=>e.value===H);return e?e.icon:""})()})}),e("span",{ref:L,children:e(hr,{disabled:v,iconName:"arrow_down",targetRef:L,iconSize:12,zIndex:2e3,options:I,tooltipTitle:"Border Type",tooltipPlacement:"top",onOptionClick:e=>{let t=e.value;C(b,t,"var(--input-hover-border-color)"),S(t)}})})]})})]})},wv=(e,t)=>{let n,r=null;const i=function(...i){const o=this;null===r||Date.now()-r>=t?(e.apply(o,i),r=Date.now()):(n&&clearTimeout(n),n=setTimeout(()=>{e.apply(o,i),r=Date.now()},t-(Date.now()-r)))};return i.cancel=()=>{n&&clearTimeout(n),n=null,r=null},i},bv=r.forwardRef(function(t,i){const{className:o,columnLabels:a=[],rowLabels:l=[],toolbar:s,editable:c,onKeyDown:d,Table:u=Ug,Row:f=qg,sheetHeight:h,HeaderRow:p=Wg,DataEditor:C=lv,DataViewer:m=iv,onSelect:g=()=>{},onActivate:v=()=>{},onEvaluatedDataChange:y=()=>{},contextOption:w,attachmentAction:b,workRef:E,minimumColumnWidth:M,setContextMenu:A,maxRowLimit:x,maxColLimit:L,disableDeleteOption:k,contextMenu:H,getActiveCell:S,onAddColumn:_,onDeleteColumn:V}=t,O=M||100,N=r.useRef(!1),T=Gg(e=>e.model.data),[I,D]=r.useState(!1),[Z,j]=r.useState(0),[R,B]=r.useState(0),[P,F]=r.useState({top:0,left:0}),[U,q]=r.useState(!1),[W,Q]=r.useState(!1),G=r.useMemo(()=>{const e=t.createFormulaParser||Jm,n=new rg(e,t.data);return D(e=>!e),{...Hg,model:n,selected:t.selected||Hg.selected}},[t.createFormulaParser,t.data,t.selected]),K=r.useReducer(Sg,G),[Y,X]=K,J=r.useMemo(()=>function(e,t,n){const{columns:r,rows:i}=um(e);return{rows:t?Math.max(i,t.length):i,columns:n?Math.max(r,n.length):r}}(Y.model.data,l,a),[Y.model.data,l,a]),[$,ee]=r.useState({start:0,end:Math.min(20,J.rows)}),[te,ne]=r.useState({start:0,end:Math.min(15,J.columns)}),re=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.rowDimensions[n]?.height||32;return t},[Y.rowDimensions,32]),ie=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.columnDimensions[n]?.width||O;return t},[Y.columnDimensions,O]);r.useEffect(()=>{X(function(e){return{type:wC,payload:{minimumColumnWidth:e}}}(M))},[M]);const oe=re(J.rows),ae=ie(J.columns),le=re($.start),se=oe-re($.end),ce=ie(te.start),de=ae-ie(te.end),ue=Y.mode,fe=r.useRef(null),he=e=>r.useCallback((...t)=>X(e(...t)),[e]),pe=he(AC),Ce=he(tm),me=he(em),ge=he(nm),ve=he(YC),ye=he(XC),we=he(FC),be=he(JC),Ee=he($C),Me=he(UC),Ae=he(qC),xe=he(WC),Le=he(kC),ke=he(HC),He=he(_C),Se=he(zC),_e=he(VC),Ve=he(OC),Oe=he(SC),ze=he(NC),Ne=he(TC),Te=he(IC),Ie=he(MC),De=he(DC),Ze=he(ZC),je=he(jC),Re=he(RC),Be=he(BC),Pe=he(PC);r.useImperativeHandle(i,()=>({removeSelect:ge}));const Fe=r.useRef(Y.active);r.useEffect(()=>{if(Y.active!==Fe.current)if(Y.active)v(Y.active);else{const e=E.current;e&&Pm(e)&&document.activeElement&&document.activeElement.blur()}Fe.current=Y.active},[v,Y.active]);const Ue=r.useRef(Y.model.evaluatedData);r.useEffect(()=>{Y?.model?.evaluatedData!==Ue?.current&&y(Y?.model?.evaluatedData),Ue.current=Y.model.evaluatedData},[Y?.model?.evaluatedData,y]);const qe=r.useRef(Y.selected);r.useEffect(()=>{Y.selected.equals(qe.current)||t.selected&&Y.selected.equals(t.selected)||g(Y.selected),qe.current=Y.selected},[Y.selected,g,t.selected]);const We=r.useRef(t.selected);r.useEffect(()=>{t.selected&&We.current&&!t.selected.equals(We.current)&&xe(t.selected),We.current=t.selected},[t.selected,xe]);let Qe=r.useRef(t.data);r.useEffect(()=>{pe(c),t.data!==Qe.current&&Me(t.data),Qe.current=t.data},[t.data,Me,c]);const Ge=r.useRef(t.createFormulaParser);r.useEffect(()=>{t.createFormulaParser!==Ge.current&&t.createFormulaParser&&Ae(t.createFormulaParser),Ge.current=t.createFormulaParser},[t.createFormulaParser,Ae]);const Ke=r.useCallback(e=>{const{model:t,selected:n}=Y,{data:r}=t,i=n.toRange(r);if(i){!function(e,t){e.clipboardData?.setData(Hm,t)}(e,Rm(function(e,t,n){const r=[],i=t.column-e.column;for(let o=e.row;o<=t.row;o++){const a=o-e.row;r[a]=r[a]||Array(i);for(let i=e.column;i<=t.column;i++)r[a][i-e.column]=rm({row:o,column:i},n)}return r}(i.start,i.end,r)))}},[Y]),Ye=r.useCallback(e=>{Bm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),Ke(e),Ce())},[ue,Ke,Ce]),Xe=r.useCallback(e=>{Bm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),Ke(e),me())},[ue,Ke,me]),Je=r.useCallback(e=>{if(Bm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),e.clipboardData)){const t=function(e){return window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):e.clipboardData&&e.clipboardData.getData?e.clipboardData.getData(Hm):""}(e);ve(t)}},[ue,ve]),$e=r.useCallback(e=>{e.persist();const t=e.ctrlKey||e.metaKey,n=e.key.toLowerCase();t&&"b"===n?(e.preventDefault(),Le(T)):t&&"i"===n?(e.preventDefault(),ke(T)):t&&"u"===n&&(e.preventDefault(),He(T)),d&&d(e),e.defaultPrevented||(function(e,t){return void 0!==Mg(e,t)}(Y,e)&&e.nativeEvent.preventDefault(),ye(e))},[Y,d,ye]),et=r.useCallback(()=>{Y.formattedStyle.open&&Y.active&&Ie(Y.active)},[Y]),tt=r.useCallback(()=>{Ee(),document.removeEventListener("mouseup",tt)},[Ee]),nt=r.useCallback(e=>{Y.dragging||1!==e.buttons||"view"!==ue||(be(),document.addEventListener("mouseup",tt))},[Y,be,tt,ue]),rt=r.useMemo(()=>rv(t.Cell||nv),[t.Cell,I,c]),it=r.useMemo(()=>Yg(t.CornerIndicator||Kg),[t.CornerIndicator,I]),ot=r.useMemo(()=>tv(t.RowIndicator||ev),[t.RowIndicator,I]),at=r.useMemo(()=>Xg(t.ColumnIndicator||Jg),[t.ColumnIndicator,I]);r.useEffect(()=>(document.addEventListener("cut",Ye),document.addEventListener("copy",Xe),document.addEventListener("paste",Je),()=>{document.removeEventListener("cut",Ye),document.removeEventListener("copy",Xe),document.removeEventListener("paste",Je)}),[Ye,Xe,Je]);const lt=e=>{const t=new ResizeObserver(e=>{const t=e[0];if(t&&fe.current){const e=t.target;if(e){const{clientWidth:t,clientHeight:n}=e;B(Math.min(fe.current.clientHeight,n)),j(Math.min(fe.current.clientWidth,t))}}}),n=e.current;n&&t.observe(n)},st=r.useCallback(e=>{const t=e.target,{scrollTop:n,clientHeight:r,scrollLeft:i,clientWidth:o}=t;F({top:n,left:i});let a=0;for(;a<J.rows&&re(a)<n;)a++;let l=a;for(;l<J.rows&&re(l)<n+r;)l++;a=Math.max(0,a-10),l=Math.min(J.rows,l+10),ee({start:a,end:l});const s=l===J.rows;q(s);let c=0;for(;c<J.columns&&ie(c)<i;)c++;let d=c;for(;d<J.columns&&ie(d)<i+o;)d++;c=Math.max(0,c-10),d=Math.min(J.columns,d+10),ne({start:c,end:d});const u=d===J.columns;Q(u),H.open&&A({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},[J.rows,J.columns,re,ie]),ct=r.useMemo(()=>wv(st,16),[st]),dt=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.rowDimensions?.[n]?.height||32;requestAnimationFrame(()=>{fe.current&&e>=J.rows-1&&fe?.current?.scrollTo({top:t+32,behavior:"smooth"})})})},ut=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.columnDimensions?.[n]?.width||O;requestAnimationFrame(()=>{fe.current&&e>=J.columns-1&&fe.current.scrollTo({left:t+60,behavior:"smooth"})})})};r.useEffect(()=>{N.current||(ee({start:0,end:Math.min(20,J.rows)}),ne({start:0,end:Math.min(15,J.columns)}))},[J.rows,J.columns,N.current]);const ft=Sm($.end,$.start),ht=Sm(te.end,te.start),pt=n("colgroup",{children:[e("col",{style:{width:"60px"}},"row-indicator")," ",e("col",{style:{width:`${ce}px`}},"left-spacer")," ",ht.map(t=>e("col",{style:{width:`${Y.columnDimensions[t]?.width||O}px`}},t)),e("col",{style:{width:`${de}px`}},"right-spacer")," "]}),Ct=r.useMemo(()=>n(u,{useTableRef:lt,totalWidth:ae,children:[pt,n("tbody",{children:[n(p,{children:[e(it,{}),e("div",{className:"spacer left"}),ht.map(n=>e(at,{column:n,minimumColumnWidth:M,setContextMenu:t.setContextMenu,label:n in a?a[n]:void 0,deleteColumn:Pe,addColumnLeft:je,addColumnRight:Re,columnContextEnable:t.columnContextEnable,maxColLimit:L,disableDeleteOption:k,contextMenu:H,onAddColumn:_,onDeleteColumn:V,setVisibleRange:ne,scrollToColumn:ut},n)),e("div",{className:"spacer right"})]}),e("tr",{style:{height:`${le}px`}}),ft.map(r=>n(f,{row:r,children:[e(ot,{label:r in l?l?.[r]:void 0,row:r,addRowTop:De,addRowBottom:Ze,deleteRow:Be,setContextMenu:t.setContextMenu,rowContextEnable:t.rowContextEnable,maxRowLimit:x,disableDeleteOption:k,contextMenu:H,setVisibleRange:ee,scrollToRow:dt},r),e("div",{className:"spacer left"}),ht.map(t=>e(rt,{row:r,column:t,DataViewer:m},t)),e("div",{className:"spacer right"})]},r)),e("tr",{style:{height:`${se}px`}})]})]}),[u,J.rows,J.columns,f,p,it,a,at,l,ot,rt,m,$,te,le,se,ce,de,Y.rowDimensions,Y.columnDimensions]),mt=r.useMemo(()=>e(sv,{attachmentAction:b,contextOption:w,getActiveCell:S,setContextMenu:t.setContextMenu,DataEditor:C,visibleRowRange:$,visibleColRange:te,maxHeight:R-64,maxWidth:Z-M,totalHeight:oe,totalWidth:ae,isAtBottom:U,isAtRight:W,scrollPos:P,editable:c},Y.active?`${Y.active.row}-${Y.active.column}`:"no-active"),[C,$,te,Y.active,R,Z,oe,ae,U,W,c]),gt=r.useMemo(()=>n("div",{className:"ff-excel-spreadsheet-container",children:[e("div",{style:{width:`${Z}px`},className:z("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),e("div",{style:{height:`${R}px`},className:z("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),"hide"!==s&&e("div",{className:"ff-excel-toolbar-container",children:e(yv,{editable:c,toolbar:s,onBold:Le,onItalic:ke,setUnderlineType:He,setColor:ze,setBorderType:Oe,setFontSize:_e,setFontFamily:Ve,setTextAlign:Se,setBackgroundColor:Ne,setFormatePainter:Te})}),n("div",{ref:fe,style:{height:h},className:z("ff-excel-spreadsheet",o),onKeyPress:we,onKeyDown:$e,onClick:et,onMouseMove:nt,onScroll:e=>ct(e),children:[Ct,mt,e(dv,{scrollPos:P}),e(uv,{scrollPos:P})]})]}),[o,we,$e,nt,Ct,mt,Z]);return e(Fg.Provider,{value:K,children:gt})}),Ev=({contextMenu:t,position:r,editable:i})=>{if(!t.open)return null;return i&&e("div",{onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},className:"ff-excel-menu",style:{left:r.x,top:r.y,position:"absolute",zIndex:9999999999},children:t.options.map(t=>{if(!t.visible){const i=t.disable;return e(K,{title:i?t.disableTooltip:"",children:n("div",{className:"ff-excel-menu-options "+(i?"disabled":""),onClick:()=>{i||t.action()},children:[t.iconName&&e(P,{name:t.iconName,height:16,width:16,color:(r=t.label,r.includes("Delete")?"var(--label-edit-error-text)":"var(--brand-color)"),disabled:i}),e(F,{as:"label",children:t.label})]})},t.label)}var r;return null})})},Mv=({excelData:r,contextOption:o,toolbar:s="show",sheetBar:d="show",rowCount:u=26,colCount:f=26,sheetHeight:h="100%",editable:p=!0,contextHeightPositioning:C=0,contextWidthPositioning:m=0,onSave:g=()=>Promise.resolve(),onSaveInfoChange:v,attachmentAction:y={addAttachment:()=>Promise.resolve(""),deleteAttachment:()=>Promise.resolve(""),viewAttachment:()=>Promise.resolve()},onSaveDelay:w=3e3,scroller:b=!1,columnContextEnable:E=!0,rowContextEnable:M=!0,sheetBarContextEnable:A=!0,minimumColumnWidth:x=100,disableDeleteOption:L=!1,maxRowLimit:k=1/0,maxColLimit:H=1/0,maxSheetLimit:S=1/0,getActiveCell:_=()=>{}})=>{const V=a(null),[O,N]=c([]),[T,I]=c(""),[D,Z]=i.useState({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",disable:!1,visible:!1}]}),[j,R]=c({name:"defaultSheet",index:0}),[B,U]=c({defaultSheet:[[Wm]]}),[q,W]=c([[Wm]]),[Q,Y]=c((g.length,{})),[X,J]=c({x:0,y:0}),$=a(""),ee=a(null),te=a(null),ne=a(null);l(()=>{const e=r;if(e){const t=e.map(e=>e.sheetName);N(t),G(t.length)||($.current=t[0]||"",R({name:t[0]||"",index:0}));const n={},r={};e.forEach(e=>{const t=e.sheetName,i=e.data,o=Math.max(u,i.length),a=Math.max(f,Math.max(...i.map(e=>e.length)));let l=Array.from({length:o},()=>Array(a).fill({value:"",style:Wm.style,readOnly:!1,inputType:void 0}));i.forEach((e,t)=>{e.forEach((e,n)=>{var r;t<o&&n<a&&(l[t]||(l[t]=[]),l[t][n]={value:(r=e.value,null==r?null:r),style:G(e?.style)?Wm.style:mv(e?.style),readOnly:!!e?.readOnly&&e?.readOnly,inputType:e?.inputType??void 0,contextDisable:e.contextDisable})})});const s=new Set([...e?.rows?.readOnly?e.rows.readOnly.map(e=>`r${e}`):[],...e?.columns?.readOnly?e.columns.readOnly.map(e=>`c${e}`):[],...e?.cells?.readOnly?e.cells.readOnly.map(([e,t])=>`${e},${t}`):[]]);if(l.forEach((t,n)=>{t.forEach((t,r)=>{l[n]||(l[n]=[]);const i=s.has(`r${n+1}`)||s.has(`c${r+1}`)||s.has(`${n+1},${r+1}`),o=((t,n,r)=>r?.inputType?r.inputType:e?.rows?.inputType?.[t+1]||e?.columns?.inputType?.[n+1]||e?.cells?.inputType?.[`${t+1},${n+1}`]||{type:"text"})(n,r,t||Wm);l[n][r]={...t,value:t?.value??"",readOnly:t?.readOnly?t.readOnly:i,inputType:o,contextDisable:t?.contextDisable}})}),n[t]=l,g.length>1){const e=i[0]||[];r[t]=Array.from({length:a},(t,n)=>({newData:"",oldData:e[n]?.value||""}))}}),U(n),g.length>1&&Y(r);const i=Object.keys(n)[0];i&&void 0!==n[i]&&W(n[i])}},[r]),l(()=>{v&&v(T),"File saved"===T&&setTimeout(()=>{I("")},2e3)},[T]),l(()=>{I("Saving..."),re(le())},[B,$.current]);const re=i.useCallback(La(e=>{if(g.length>1){const t={...Q};O.forEach((n,r)=>{const i=(e[r].data[0]||[]).map(e=>e?.value||"");t[n]=(t[n]||[]).map((e,t)=>({...e,newData:i[t]||""}))}),Y(t);const n=O.map(e=>({sheetName:e,headers:t[e]||[]}));g(e,n)}else g(e);I("File saved")},w),[g,Q,O]),ae=i.useCallback(e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),e.stopPropagation(),re(le()))},[g]);i.useEffect(()=>(document.addEventListener("keydown",ae),()=>{document.removeEventListener("keydown",ae)}),[ae]);const le=()=>O.map(e=>{const t=B[e]?.map(e=>{const t=e.reduce((e,t,n)=>""!==String(t?.value??"").trim()?n:e,-1),n=e.map((e,n)=>e&&e.style&&n<=t?{value:e.value,style:vv(e.style),readOnly:e.readOnly,inputType:e.inputType,contextDisable:e.contextDisable}:null).filter(e=>null!==e);return n.length>0?n:[]})||[],n=t.filter((e,n)=>{const r=t.slice(n+1).some(e=>e.length>0);return e.length>0||r});return{sheetName:e,data:G(n.length)?[[]]:n}}),[se,ce]=c(null),de=()=>O.length>=S,ue=()=>{if(de())return;const e=((e,t)=>{const n=t.map(e=>e.toLowerCase());let r=`${e}1`,i=2;for(;n.includes(r.toLowerCase());)r=`${e}${i}`,i++;return r})("Sheet",O),t=Array.from({length:u},()=>Array.from({length:f},()=>Wm));N(t=>[...t,e]),R({index:O?.length,name:e}),U({...B,[e]:t}),W(t),g.length>1&&Y(t=>({...t,[e]:Array.from({length:f},()=>({newData:"",oldData:""}))})),$.current=e},fe=(e=[[Wm]])=>{W(e)},he=(e,t,n)=>{const r=e.target;if(!r||r?.textContent?.trim()===n?.trim())return void ce(null);const i=(r.textContent||"").trim();if(!i)return Za.warning("Sheet name cannot be empty."),r.textContent=j.name,void ce(null);if(i.length>50)return Za.warning("The sheet name cannot be greater than 50 characters"),r.textContent=j.name,void ce(null);if(O.map(e=>e.toLowerCase()).includes(i.toLowerCase())&&n.trim()?.toLowerCase()!==i?.toLowerCase())return Za.warning("Sheet name already exists"),r.textContent=j.name,void ce(null);let o=O;fe(B?.[n]),o.splice(t,1,i);const a=function(e,t,n){if(!(t in e))throw new Error(`Key "${t}" not found in object`);const{[t]:r,...i}=e;return{...i,[n]:r??[]}}(B,n,i);$.current=i,R(e=>({...e,name:i})),U(a),g.length>1&&Y(e=>{const t={...e},r=t[n];return delete t[n],t[i]=r??[],t}),ce(null)};const pe=(e,t)=>{e!==j.name&&t!==j.index&&(R({index:t,name:e}),N(n=>{const r=[...n];return r[t]=e,r}),fe(B[e]),$.current=e)},Ce=i.useCallback((e,t=!1)=>{const n=e.target;(!n.closest(".ff-excel-tab-list")&&!n.closest(".ff-excel-sheet")||t)&&D.open&&(Z({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]}),t||(e.preventDefault(),e.stopPropagation()))},[D.open]);i.useEffect(()=>(document.addEventListener("contextmenu",Ce),document.addEventListener("click",e=>Ce(e,!0)),()=>{document.removeEventListener("contextmenu",Ce),document.removeEventListener("click",e=>Ce(e,!0))}),[Ce]);const me=(e,t,n)=>{e.preventDefault();const r=[{label:"Add Sheet",value:"Add Sheet",iconName:"plus_icon",action:()=>ue(),disableTooltip:"Sheet limit reached",visible:!1,disable:de()},...L?[]:[{label:"Delete Sheet",value:"Delete Sheet",iconName:"delete",action:()=>((e,t)=>{if(O.length>1){let n=O.slice();n.splice(t,1);const r={...B};delete r[e];const i=Math.min(t,n.length-1);N(n),U(r),g.length>1&&Y(t=>{const n={...t};return delete n[e],n});const o=n[i]?n[i]:"";R({index:i,name:o}),fe(r?.[o]),$.current=o}else Za.warning("Cannot delete the last sheet.")})(t,n),disableTooltip:"",visible:!1,disable:!1}]];Z(e=>({...e,open:!0,contextType:"sheet",options:r}))};l(()=>{ne.current?.removeSelect()},[j.name]);return e(t,{children:O.length>0&&n("div",{ref:ee,className:"ff-excel",onContextMenu:e=>{e.preventDefault();const t=te.current?.parentElement?.getBoundingClientRect(),n=window.scrollX,r=window.scrollY;let i=e.clientX-(t?.left||0)+n,o=e.clientY-(t?.top||0)+r;const a=300,l=window.innerWidth,s=window.innerHeight,c=l-e.clientX,d=e.clientX,u=s-e.clientY,f=e.clientY;c<a&&d>=a?i=e.clientX-(t?.left||0)+n-150:i+=2,u<200&&f>=200?o=e.clientY-(t?.top||0)+r-20:o+=2,e.target.classList.contains("ff-excel-tab-list")?J({x:i,y:o-(L?32:65)}):(i+a>l&&(i=l-a-2),i<0&&(i=2),J({x:i+m,y:o+C}))},onClick:e=>{e.stopPropagation(),D.open&&Z({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},children:[e("div",{ref:te,className:"ff-excel-sheet",children:e(bv,{ref:ne,editable:p,attachmentAction:y,toolbar:s,sheetHeight:h,setContextMenu:Z,contextOption:o,data:q,columnContextEnable:E,rowContextEnable:M,minimumColumnWidth:x,onEvaluatedDataChange:e=>{U(t=>({...t,[$.current]:e}))},workRef:ee,scroller:b,maxRowLimit:k,maxColLimit:H,disableDeleteOption:L,contextMenu:D,getActiveCell:_,onAddColumn:(e,t)=>{g.length>1&&Y(n=>{const r=j.name,i=[...n[r]||[]],o=t?e:e+1;return i.splice(o,0,{newData:"",oldData:""}),{...n,[r]:i}})},onDeleteColumn:e=>{g.length>1&&Y(t=>{const n=j.name,r=[...t[n]||[]];return r.splice(e,1),{...t,[n]:r}})}},j.name)}),"hide"!==d&&n("div",{className:"ff-excel-sheet-bar",children:["show"===d&&n("div",{className:"ff-excel-add-sheet-set",children:[e(K,{title:de()?"Sheet limit reached":"Add Sheet",placement:"top",children:e(P,{disabled:!p||de(),className:"ff-excel-add-sheet-icon",hoverEffect:!0,onClick:ue,name:"plus_icon",height:20,width:20})}),e(hr,{options:(t=>t.map((t,r)=>({label:n("div",{style:{display:"flex",gap:"8px"},children:[j?.name===t?e(P,{height:16,width:16,name:"tick"}):e("div",{style:{height:"16px",width:"24px"}}),e(K,{title:oe(t,20,"count")?t:"",children:e(F,{children:ie(t,20,"count")})})]}),name:r,value:t})))(O),targetRef:V,onOptionClick:e=>{const{value:t,name:n=""}=e;pe(t,parseInt(n))},dropdownPlacement:"top",iconName:"show_script",tooltipTitle:"All Sheets",tooltipPlacement:"top",dropdownHeight:215,selectedValue:j.name})]}),e("div",{className:"ff-excel-tab-container",children:O.map((t,n)=>e(F,{lineHeight:"16px",children:e("div",{onContextMenu:e=>{pe(t,n),A&&me(e,t,n)},className:z("ff-excel-tab-list",{active:t===j.name}),onClick:()=>{pe(t,n)},suppressContentEditableWarning:se===n,onDoubleClick:e=>{"show"===d&&(ce(n),null===se&&setTimeout(()=>(e=>{const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n?.removeAllRanges(),n?.addRange(t)})(e.target),0))},contentEditable:p&&se===n,onBlur:e=>{he(e,n,t)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),he(e,n,t))},children:t})},t))})]}),D.open&&e(Ev,{contextMenu:D,position:X,editable:p}),e(Da,{})]})})},Av=({label:t="",isActive:n=!0,onClick:r=()=>{},isFilterChip:i=!1})=>{const o=i?"filter":"module";return e("div",{className:z("ff-module-chip",{"ff-filter-chip":i,[`ff-${o}-chip--active`]:n,[`ff-${o}-chip--hover`]:!n}),onClick:r,children:e(F,{lineHeight:"18px",className:"module-typography",children:t})})},xv=({x:e,y:t,radius:n,startAngle:r,endAngle:i})=>{const o=e+n*Math.cos(r),a=t+n*Math.sin(r),l=e+n*Math.cos(i),s=t+n*Math.sin(i),c=i-r>Math.PI?1:0;return i-r>=2*Math.PI?`\n M ${e+n} ${t}\n A ${n} ${n} 0 1 1 ${e-n} ${t} \n A ${n} ${n} 0 1 1 ${e+n} ${t}\n `:`M ${o} ${a} A ${n} ${n} 0 ${c} 1 ${l} ${s}`},Lv=({radius:t=15,lineWidth:r=5,label:i,percentageValue:o,icon:l,fontSize:s=10,labelColor:d="",arcColor:u="var(--brand-color)",backgroundArcColor:f="var(--ff-select-scroll-thumb-color)",isSelectedArch:h=!1,onSelect:p})=>{const[C,m]=c({x:0,y:0}),[g,v]=c(!1),y=a(null);let w=-Math.PI/2;const b=2*(t+r),{backgroundArcPath:E,foregroundArcPath:M}=((e,t,n)=>{const r=t,i=r+Math.max(0,Math.min(e,100))/100*2*Math.PI;return{backgroundArcPath:xv({x:0,y:0,radius:n,startAngle:0,endAngle:2*Math.PI}),foregroundArcPath:xv({x:0,y:0,radius:n,startAngle:r,endAngle:i})}})(o,w,t),A=()=>{v(!0)},x=()=>{m({x:0,y:0}),v(!1)},L=e=>{if(y.current){const t=y.current.getBoundingClientRect();m({x:e.clientX-t.left,y:e.clientY-t.top})}};return n("div",{ref:y,className:"ff-icon-radial-chart-container",style:{"--fontSize":`${s}px`},onClick:p,children:[e("svg",{width:b,height:b,viewBox:`0 0 ${b} ${b}`,role:"img",children:n("g",{transform:`translate(${t+r}, ${t+r})`,children:[e("path",{d:E,fill:"none",stroke:f,strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),e("path",{d:M,fill:"none",stroke:u,strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),h&&e("path",{d:M,fill:"none",stroke:"var(--dotted-border-color)",strokeOpacity:"0.4",strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),l?e("foreignObject",{x:"-10",y:"-10",width:"20",height:"20",children:e(P,{className:"ff-radial-chart-icon-padding",name:l,height:20,width:20})}):e("text",{x:"0",y:"0",fill:d||u,textAnchor:"middle",dominantBaseline:"central",children:`${Math.round(o)}%`})]})}),g&&n("div",{className:"ff-icon-radial-chart-tooltip",style:{position:"absolute",left:`${C.x+15}px`,top:C.y-5+"px"},children:[e(F,{children:`${i} : `}),n(F,{children:[o,"%"]})]})]})},kv=({mediaSrc:t,fileId:r,onExpandClick:i,onDeleteClick:o,onDownloadClick:a,height:l="75px",width:s="79px",fileName:c,thumbnailMediaSrc:d,isDelete:u})=>e("div",{className:"ff-attach-media-container",style:{height:l,width:s},children:n("div",{className:"ff-media-wrapper",style:{height:l,width:s},children:[e("img",{src:d||t,alt:"Attached"}),n("div",{className:"ff-hover-icons",children:[n("div",{className:"ff-top-icons",children:[e("div",{className:"ff-icon-container",children:e(K,{title:"Download File",placement:"bottom",children:e(P,{name:"download_file_icon",height:10,width:10,onClick:a,color:"var(--icons-default-color)"})})}),u&&e("div",{className:"ff-icon-container",children:e(K,{title:"Delete",placement:"bottom",children:e(P,{name:"delete",height:10,width:10,color:"var(--ff-delete-button-attachment)",onClick:()=>{o&&o(r)}})})})]}),e("div",{className:"ff-expand-icon-container",children:e(K,{title:"Maximize",placement:"bottom",children:e(P,{name:"expand_icon",height:16,width:16,onClick:i})})})]}),e(F,{color:"var(--text-area-default-color)",fontWeight:"medium",className:"ff-media-text",children:c})]})}),Hv=({icon:r,status:i,count:o,text:a,style:s={width:"196.4px"},resetToggle:d,onSelectedStatus:u=e=>{}})=>{const[f,h]=c(!1),p=["total defects","defect density","open defects","closed defects","quality score"],C=p.includes(i.toLowerCase()),m=p.includes(i.toLowerCase());l(()=>{h(!d)},[d]);return n("div",{className:`ff-card-container ${i.toLowerCase()} ${f?"toggled":""}`,style:s,onClick:()=>(e=>{p.includes(e.toLowerCase())||(h(!0),u(e))})(i),children:[n("div",{className:"ff-status-bar",children:[e("div",{children:e(P,{name:r,height:20,width:20,hoverEffect:!1})}),!p.includes(i.toLowerCase())&&e(F,{fontWeight:"semi-bold",fontSize:"10px",textAlign:"center",lineHeight:"15px",className:"ff-status-text",as:"div",children:i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()})]}),e("div",{className:"ff-content "+(m?"red-background":""),children:n(t,C?{children:[e(F,{fontWeight:"semi-bold",fontSize:"10px",className:"ff-text",lineHeight:"15px",color:"var(--ff-chip-text-color)",children:a}),e(F,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"36px",children:"defect density"===i.toLowerCase()?n(t,{children:[o.toString().padStart(2,"0"),e(F,{fontSize:"15px",fontWeight:"semi-bold",children:"/ Modules"})]}):"quality score"===i.toLowerCase()?`${parseFloat(o.toString()).toFixed(2)}%`:o.toString().padStart(2,"0")})]}:{children:[e(F,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"24px",color:f?"var(--base-bg-color)":"",children:o.toString().padStart(2,"0")}),e(F,{className:"ff-text",lineHeight:"18px",color:f?"var(--base-bg-color)":"var(--ff-chip-text-color)",children:a})]})})]})},Sv=({option:t})=>{const r=a(null),[i,o]=c(!1);l(()=>{const e=r.current;if(!e)return;const t=()=>{o(e.scrollWidth>e.clientWidth)},n=requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{cancelAnimationFrame(n),window.removeEventListener("resize",t)}},[t]);const s={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},d=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;return n("div",{style:{width:"-webkit-fill-available"},className:"ff-variable-option ff-variable-data",children:[e(K,{title:i?d(t):"",style:{width:"calc(100% - 32px)"},children:e("span",{ref:r,className:"ff-truncated_text",children:d(t)})}),e(P,{name:(e=>{if(!e)return"";const t=e._id||e.id;return t?.startsWith("PARAMETER")?"step_group_parameter":"LOCAL"===e.type&&"STEPGROUP"===e?.parentVariableType?"step_group_variable":"_startforloop"===e.type?"for_loop_variable":"DATAPROVIDER"===e.type?"data_provider_variable":s[e.type||""]||""})(t),height:24,width:24,hoverEffect:!0})]})};function _v(e){return()=>e}function Vv(e){e()}function Ov(e,t){return n=>e(t(n))}function zv(e,t){return()=>e(t)}function Nv(e){return void 0!==e}function Tv(){}function Iv(e,t){return t(e),e}function Dv(e,t){return t(e)}function Zv(...e){return e}function jv(e,t){return e(1,t)}function Rv(e,t){e(0,t)}function Bv(e){e(2)}function Pv(e){return e(4)}function Fv(e,t){return jv(e,function(e,t){return n=>e(t,n)}(t,0))}function Uv(e,t){const n=e(1,e=>{n(),t(e)});return n}function qv(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Wv(e,t){return e===t}function Qv(e=Wv){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Gv(e){return t=>n=>{e(n)&&t(n)}}function Kv(e){return t=>Ov(t,e)}function Yv(e){return t=>()=>{t(e)}}function Xv(e,...t){const n=function(...e){return t=>e.reduceRight(Dv,t)}(...t);return(t,r)=>{switch(t){case 2:return void Bv(e);case 1:return jv(e,n(r))}}}function Jv(e,t){return n=>r=>{n(t=e(t,r))}}function $v(e){return t=>n=>{e>0?e--:t(n)}}function ey(e){let t,n=null;return r=>i=>{n=i,!t&&(t=setTimeout(()=>{t=void 0,r(n)},e))}}function ty(...e){const t=new Array(e.length);let n=0,r=null;const i=Math.pow(2,e.length)-1;return e.forEach((e,o)=>{const a=Math.pow(2,o);jv(e,e=>{const l=n;n|=a,t[o]=e,l!==i&&n===i&&r&&(r(),r=null)})}),e=>o=>{const a=()=>{e([o].concat(t))};n===i?a():r=a}}function ny(e){let t=e;const n=iy();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function ry(e,t){return Iv(ny(t),t=>Fv(e,t))}function iy(){const e=[];return(t,n)=>{switch(t){case 0:return void e.slice().forEach(e=>{e(n)});case 2:return void e.splice(0,e.length);case 1:return e.push(n),()=>{const t=e.indexOf(n);t>-1&&e.splice(t,1)}}}}function oy(e){return Iv(iy(),t=>Fv(e,t))}function ay(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ly(),singleton:n}}const ly=()=>Symbol();function sy(...e){const t=iy(),n=new Array(e.length);let r=0;const i=Math.pow(2,e.length)-1;return e.forEach((e,o)=>{const a=Math.pow(2,o);jv(e,e=>{n[o]=e,r|=a,r===i&&Rv(t,n)})}),function(e,o){switch(e){case 2:return void Bv(t);case 1:return r===i&&o(n),jv(t,o)}}}function cy(e,t=Wv){return Xv(e,Qv(t))}function dy(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(Vv)}}(...e.map(e=>jv(e,n)))}}}var uy=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(uy||{});const fy={0:"debug",3:"error",1:"log",2:"warn"},hy=ay(()=>{const e=ny(3);return{log:ny((t,n,r=1)=>{var i;r>=(null!=(i=(typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:Pv(e))&&console[fy[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function py(e,t,n){return Cy(e,t,n).callbackRef}function Cy(e,t,n){const r=i.useRef(null);let o=e=>{};const a=i.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(t=>{const r=()=>{const n=t[0].target;null!==n.offsetParent&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return o=e=>{e&&t?(null==a||a.observe(e),r.current=e):(r.current&&(null==a||a.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function my(e,t,n,r,o,a,l,s,c){const d=i.useCallback(n=>{const i=function(e,t,n,r){const i=e.length;if(0===i)return null;const o=[];for(let a=0;a<i;a++){const i=e.item(a);if(void 0===i.dataset.index)continue;const l=parseInt(i.dataset.index),s=parseFloat(i.dataset.knownSize),c=t(i,n);if(0===c&&r("Zero-sized element, this should not happen",{child:i},uy.ERROR),c===s)continue;const d=o[o.length-1];0===o.length||d.size!==c||d.endIndex!==l-1?o.push({endIndex:l,size:c,startIndex:l}):o[o.length-1].endIndex++}return o}(n.children,t,s?"offsetWidth":"offsetHeight",o);let c=n.parentElement;for(;!c.dataset.virtuosoScroller;)c=c.parentElement;const d="window"===c.lastElementChild.dataset.viewportType;let u;d&&(u=c.ownerDocument.defaultView);const f=l?s?l.scrollLeft:l.scrollTop:d?s?u.scrollX||u.document.documentElement.scrollLeft:u.scrollY||u.document.documentElement.scrollTop:s?c.scrollLeft:c.scrollTop,h=l?s?l.scrollWidth:l.scrollHeight:d?s?u.document.documentElement.scrollWidth:u.document.documentElement.scrollHeight:s?c.scrollWidth:c.scrollHeight,p=l?s?l.offsetWidth:l.offsetHeight:d?s?u.innerWidth:u.innerHeight:s?c.offsetWidth:c.offsetHeight;r({scrollHeight:h,scrollTop:Math.max(f,0),viewportHeight:p}),null==a||a(s?gy("column-gap",getComputedStyle(n).columnGap,o):gy("row-gap",getComputedStyle(n).rowGap,o)),null!==i&&e(i)},[e,t,o,a,l,r,s]);return Cy(d,n,c)}function gy(e,t,n){return"normal"!==t&&!(null!=t&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,uy.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}function vy(e,t,n){const r=i.useRef(null),o=i.useCallback(n=>{if(null==n||!n.offsetParent)return;const i=n.getBoundingClientRect(),o=i.width;let a,s;if(t){const e=t.getBoundingClientRect(),n=i.top-e.top;s=e.height-Math.max(0,n),a=n+t.scrollTop}else{const e=l.current.ownerDocument.defaultView;s=e.innerHeight-Math.max(0,i.top),a=i.top+e.scrollY}r.current={offsetTop:a,visibleHeight:s,visibleWidth:o},e(r.current)},[e,t]),{callbackRef:a,ref:l}=Cy(o,!0,n),s=i.useCallback(()=>{o(l.current)},[o,l]);return i.useEffect(()=>{var e;if(t){t.addEventListener("scroll",s);const e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener("scroll",s),e.unobserve(t)}}{const t=null==(e=l.current)?void 0:e.ownerDocument.defaultView;return null==t||t.addEventListener("scroll",s),null==t||t.addEventListener("resize",s),()=>{null==t||t.removeEventListener("scroll",s),null==t||t.removeEventListener("resize",s)}}},[s,t,l]),a}const yy=ay(()=>{const e=iy(),t=iy(),n=ny(0),r=iy(),i=ny(0),o=iy(),a=iy(),l=ny(0),s=ny(0),c=ny(0),d=ny(0),u=iy(),f=iy(),h=ny(!1),p=ny(!1),C=ny(!1);return Fv(Xv(e,Kv(({scrollTop:e})=>e)),t),Fv(Xv(e,Kv(({scrollHeight:e})=>e)),a),Fv(t,i),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:s,footerHeight:d,headerHeight:l,horizontalDirection:p,scrollBy:f,scrollContainerState:e,scrollHeight:a,scrollingInProgress:h,scrollTo:u,scrollTop:t,skipAnimationFrameInResizeObserver:C,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:o}},[],{singleton:!0}),wy={lvl:0};function by(e,t){const n=e.length;if(0===n)return[];let{index:r,value:i}=t(e[0]);const o=[];for(let a=1;a<n;a++){const{index:n,value:l}=t(e[a]);o.push({end:n-1,start:r,value:i}),r=n,i=l}return o.push({end:1/0,start:r,value:i}),o}function Ey(e){return e===wy}function My(e,t){if(!Ey(e))return t===e.k?e.v:t<e.k?My(e.l,t):My(e.r,t)}function Ay(e,t,n="k"){if(Ey(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Ay(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Ay(e.l,t,n)}function xy(e,t,n){return Ey(e)?Iy(t,n,1):t===e.k?Oy(e,{k:t,v:n}):t<e.k?Dy(Oy(e,{l:xy(e.l,t,n)})):Dy(Oy(e,{r:xy(e.r,t,n)}))}function Ly(){return wy}function ky(e,t,n){if(Ey(e))return[];return function(e){return by(e,({k:e,v:t})=>({index:e,value:t}))}(_y(e,Ay(e,t)[0],n))}function Hy(e,t){if(Ey(e))return wy;const{k:n,l:r,r:i}=e;if(t===n){if(Ey(r))return i;if(Ey(i))return r;{const[t,n]=Ty(r);return Vy(Oy(e,{k:t,l:zy(r),v:n}))}}return Vy(Oy(e,t<n?{l:Hy(r,t)}:{r:Hy(i,t)}))}function Sy(e){return Ey(e)?[]:[...Sy(e.l),{k:e.k,v:e.v},...Sy(e.r)]}function _y(e,t,n){if(Ey(e))return[];const{k:r,l:i,r:o,v:a}=e;let l=[];return r>t&&(l=l.concat(_y(i,t,n))),r>=t&&r<=n&&l.push({k:r,v:a}),r<=n&&(l=l.concat(_y(o,t,n))),l}function Vy(e){const{l:t,lvl:n,r:r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(Ny(t))return Zy(Oy(e,{lvl:n-1}));if(!Ey(t)&&!Ey(t.r))return Oy(t.r,{l:Oy(t,{r:t.r.l}),lvl:n,r:Oy(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(Ny(e))return jy(Oy(e,{lvl:n-1}));if(Ey(r)||Ey(r.l))throw new Error("Unexpected empty nodes");{const t=r.l,i=Ny(t)?r.lvl-1:r.lvl;return Oy(t,{l:Oy(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:jy(Oy(r,{l:t.r,lvl:i}))})}}function Oy(e,t){return Iy(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function zy(e){return Ey(e.r)?e.l:Vy(Oy(e,{r:zy(e.r)}))}function Ny(e){return Ey(e)||e.lvl>e.r.lvl}function Ty(e){return Ey(e.r)?[e.k,e.v]:Ty(e.r)}function Iy(e,t,n,r=wy,i=wy){return{k:e,l:r,lvl:n,r:i,v:t}}function Dy(e){return jy(Zy(e))}function Zy(e){const{l:t}=e;return Ey(t)||t.lvl!==e.lvl?e:Oy(t,{r:Oy(e,{l:t.r})})}function jy(e){const{lvl:t,r:n}=e;return Ey(n)||Ey(n.r)||n.lvl!==t||n.r.lvl!==t?e:Oy(n,{l:Oy(e,{r:n.l}),lvl:t+1})}function Ry(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function By(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}const Py=ay(()=>({recalcInProgress:ny(!1)}),[],{singleton:!0});function Fy(e,t,n){return e[Uy(e,t,n)]}function Uy(e,t,n,r=0){let i=e.length-1;for(;r<=i;){const o=Math.floor((r+i)/2),a=n(e[o],t);if(0===a)return o;if(-1===a){if(i-r<2)return o-1;i=o-1}else{if(i===r)return o;r=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function qy(e,t){return Math.round(e.getBoundingClientRect()[t])}function Wy(e){return!Ey(e.groupOffsetTree)}function Qy({index:e},t){return t===e?0:t<e?-1:1}function Gy({offset:e},t){return t===e?0:t<e?-1:1}function Ky(e,t,n){if(0===t.length)return 0;const{index:r,offset:i,size:o}=Fy(t,e,Qy),a=e-r,l=o*a+(a-1)*n+i;return l>0?l+n:l}function Yy(e,t){if(!Wy(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Xy(e,t,n){if(function(e){return typeof e.groupIndex<"u"}(e))return t.groupIndices[e.groupIndex]+1;{let r=Yy("LAST"===e.index?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}}function Jy(e,t,n,r=0){return r>0&&(t=Math.max(t,Fy(e,r,Qy).offset)),by(function(e,t,n,r){const i=Uy(e,t,r),o=Uy(e,n,r,i);return e.slice(i,o+1)}(e,t,n,Gy),nw)}function $y(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,uy.DEBUG);const o=e.sizeTree;let a=o,l=0;if(n.length>0&&Ey(o)&&2===t.length){const e=t[0].size,r=t[1].size;a=n.reduce((t,n)=>xy(xy(t,n,e),n+1,r),a)}else[a,l]=function(e,t){let n=Ey(e)?0:1/0;for(const r of t){const{endIndex:t,size:i,startIndex:o}=r;if(n=Math.min(n,o),Ey(e)){e=xy(e,0,i);continue}const a=ky(e,o-1,t+1);if(a.some(rw(r)))continue;let l=!1,s=!1;for(const{end:n,start:r,value:o}of a)l?(t>=r||i===o)&&(e=Hy(e,r)):(s=o!==i,l=!0),n>t&&t>=r&&o!==i&&(e=xy(e,t+1,o));s&&(e=xy(e,o,i))}return[e,n]}(a,t);if(a===o)return e;const{lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u}=tw(e.offsetTree,l,a,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>xy(e,t,Ky(t,u,i)),Ly()),lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u,sizeTree:a}}function ew(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function tw(e,t,n,r){let i=e,o=0,a=0,l=0,s=0;if(0!==t){s=Uy(i,t-1,Qy),l=i[s].offset;const e=Ay(n,t-1);o=e[0],a=e[1],i.length&&i[s].size===Ay(n,t)[1]&&(s-=1),i=i.slice(0,s+1)}else i=[];for(const{start:e,value:s}of ky(n,t,1/0)){const t=e-o,n=t*a+l+t*r;i.push({index:e,offset:n,size:s}),o=e,l=n,a=s}return{lastIndex:o,lastOffset:l,lastSize:a,offsetTree:i}}function nw(e){return{index:e.index,value:e}}function rw(e){const{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}const iw={offsetHeight:"height",offsetWidth:"width"},ow=ay(([{log:e},{recalcInProgress:t}])=>{const n=iy(),r=iy(),i=ry(r,0),o=iy(),a=iy(),l=ny(0),s=ny([]),c=ny(void 0),d=ny(void 0),u=ny(void 0),f=ny(void 0),h=ny((e,t)=>qy(e,iw[t])),p=ny(void 0),C=ny(0),m={groupIndices:[],groupOffsetTree:Ly(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ly()},g=ry(Xv(n,ty(s,e,C),Jv($y,m),Qv()),m),v=ry(Xv(s,Qv(),Jv((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),Kv(({prev:e})=>e)),[]);Fv(Xv(s,Gv(e=>e.length>0),ty(g,C),Kv(([e,t,n])=>{const r=e.reduce((e,r,i)=>xy(e,r,Ky(r,t.offsetTree,n)||i),Ly());return{...t,groupIndices:e,groupOffsetTree:r}})),g),Fv(Xv(r,ty(g),Gv(([e,{lastIndex:t}])=>e<t),Kv(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),Fv(c,d);const y=ry(Xv(c,Kv(e=>void 0===e)),!0);Fv(Xv(d,Gv(e=>void 0!==e&&Ey(Pv(g).sizeTree)),Kv(e=>{const t=Pv(u),n=Pv(s).length>0;return t?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),Fv(Xv(f,Gv(e=>void 0!==e&&e.length>0&&Ey(Pv(g).sizeTree)),Kv(e=>{const t=[];let n=e[0],r=0;for(let i=1;i<e.length;i++){const o=e[i];o!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=o,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),Fv(Xv(s,ty(u,d),Gv(([,e,t])=>void 0!==e&&void 0!==t),Kv(([e,t,n])=>{const r=[];for(let i=0;i<e.length;i++){const o=e[i],a=e[i+1];r.push({startIndex:o,endIndex:o,size:t}),void 0!==a&&r.push({startIndex:o+1,endIndex:a-1,size:n})}return r})),n);const w=oy(Xv(n,ty(g),Jv(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:m}),Kv(e=>e.changed)));jv(Xv(l,Jv((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),Kv(e=>e.diff)),e=>{const{groupIndices:n}=Pv(g);if(e>0)Rv(t,!0),Rv(o,e+ew(e,n));else if(e<0){const t=Pv(v);t.length>0&&(e-=ew(-e,t)),Rv(a,e)}}),jv(Xv(l,ty(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},uy.ERROR)});const b=oy(o);Fv(Xv(o,ty(g),Kv(([e,t])=>{const n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){const n=My(t.sizeTree,0);let o=0,a=0;for(;o<e;){const e=t.groupIndices[a],l=t.groupIndices.length===a+1?1/0:t.groupIndices[a+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+l-1,size:i,startIndex:e+1}),a++,o+=l+1}const l=Sy(t.sizeTree);return o!==e&&l.shift(),l.reduce((t,{k:n,v:r})=>{let i=t.ranges;return 0!==t.prevSize&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return Sy(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);const E=oy(Xv(a,ty(g,C),Kv(([e,{offsetTree:t},n])=>Ky(-e,t,n))));return Fv(Xv(a,ty(g,C),Kv(([e,t,n])=>{if(t.groupIndices.length>0){if(Ey(t.sizeTree))return t;let r=Ly();const i=Pv(v);let o=0,a=0,l=0;for(;o<-e;){l=i[a];const e=i[a+1]-l-1;a++,o+=e+1}if(r=Sy(t.sizeTree).reduce((t,{k:n,v:r})=>xy(t,Math.max(0,n+e),r),r),o!==-e){r=xy(r,0,My(t.sizeTree,l));r=xy(r,1,Ay(t.sizeTree,1-e)[1])}return{...t,sizeTree:r,...tw(t.offsetTree,0,r,n)}}{const r=Sy(t.sizeTree).reduce((t,{k:n,v:r})=>xy(t,Math.max(0,n+e),r),Ly());return{...t,sizeTree:r,...tw(t.offsetTree,0,r,n)}}})),g),{beforeUnshiftWith:b,data:p,defaultItemSize:d,firstItemIndex:l,fixedItemSize:c,fixedGroupSize:u,gap:C,groupIndices:s,heightEstimates:f,itemSize:h,listRefresh:w,shiftWith:a,shiftWithOffset:E,sizeRanges:n,sizes:g,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:o}},Zv(hy,Py),{singleton:!0});function aw(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}const lw=ay(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{const o=iy(),a=iy(),l=oy(Xv(o,Kv(aw)));return Fv(Xv(l,Kv(e=>e.totalCount)),n),Fv(Xv(l,Kv(e=>e.groupIndices)),e),Fv(Xv(sy(i,t,r),Gv(([e,t])=>Wy(t)),Kv(([e,t,n])=>Ay(t.groupOffsetTree,Math.max(e-n,0),"v")[0]),Qv(),Kv(e=>[e])),a),{groupCounts:o,topItemsIndexes:a}},Zv(ow,yy)),sw=ay(([{log:e}])=>{const t=ny(!1),n=oy(Xv(t,Gv(e=>e),Qv()));return jv(t,t=>{t&&Pv(e)("props updated",{},uy.DEBUG)}),{didMount:n,propsReady:t}},Zv(hy),{singleton:!0}),cw=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function dw(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!cw)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const uw=ay(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:a,headerHeight:l,scrollingInProgress:s,scrollTo:c,smoothScrollTargetReached:d,viewportHeight:u},{log:f}])=>{const h=iy(),p=iy(),C=ny(0);let m=null,g=null,v=null;function y(){m&&(m(),m=null),v&&(v(),v=null),g&&(clearTimeout(g),g=null),Rv(s,!1)}return Fv(Xv(h,ty(n,u,r,C,l,a,f),ty(e,o,i),Kv(([[e,n,r,i,o,a,l,c],u,f,C])=>{const w=dw(e),{align:b,behavior:E,offset:M}=w,A=i-1,x=Xy(w,n,A);let L=Ky(x,n.offsetTree,u)+a;"end"===b?(L+=f+Ay(n.sizeTree,x)[1]-r+C,x===A&&(L+=l)):"center"===b?L+=(f+Ay(n.sizeTree,x)[1]-r+C)/2:L-=o,M&&(L+=M);const k=t=>{y(),t?(c("retrying to scroll to",{location:e},uy.DEBUG),Rv(h,e)):(Rv(p,!0),c("list did not change, scroll successful",{},uy.DEBUG))};if(y(),"smooth"===E){let e=!1;v=jv(t,t=>{e=e||t}),m=Uv(d,()=>{k(e)})}else m=Uv(Xv(t,function(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}(150)),k);return g=setTimeout(()=>{y()},1200),Rv(s,!0),c("scrolling from index to",{behavior:E,index:x,top:L},uy.DEBUG),{behavior:E,top:L}})),c),{scrollTargetReached:p,scrollToIndex:h,topListHeight:C}},Zv(ow,yy,hy),{singleton:!0});function fw(e,t){0==e?t():requestAnimationFrame(()=>{fw(e-1,t)})}function hw(e,t){const n=t-1;return"number"==typeof e?e:"LAST"===e.index?n:e.index}const pw=ay(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:a}])=>{const l=ny(!0),s=ny(0),c=ny(!0);return Fv(Xv(a,ty(s),Gv(([e,t])=>!!t),Yv(!1)),l),Fv(Xv(a,ty(s),Gv(([e,t])=>!!t),Yv(!1)),c),jv(Xv(sy(t,a),ty(l,n,e,c),Gv(([[,e],t,{sizeTree:n},r,i])=>e&&(!Ey(n)||Nv(r))&&!t&&!i),ty(s)),([,e])=>{Uv(i,()=>{Rv(c,!0)}),fw(4,()=>{Uv(r,()=>{Rv(l,!0)}),Rv(o,e)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:s,scrolledToInitialItem:l}},Zv(ow,yy,uw,sw),{singleton:!0});function Cw(e,t){return Math.abs(e-t)<1.01}const mw="up",gw="down",vw={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},yw=ay(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{const a=ny(!1),l=ny(!0),s=iy(),c=iy(),d=ny(4),u=ny(0),f=ry(Xv(dy(Xv(cy(i),$v(1),Yv(!0)),Xv(cy(i),$v(1),Yv(!1),qv(100))),Qv()),!1),h=ry(Xv(dy(Xv(n,Yv(!0)),Xv(n,Yv(!1),qv(200))),Qv()),!1);Fv(Xv(sy(cy(i),cy(u)),Kv(([e,t])=>e<=t),Qv()),l),Fv(Xv(l,ey(50)),c);const p=oy(Xv(sy(r,cy(o),cy(t),cy(e),cy(d)),Jv((e,[{scrollHeight:t,scrollTop:n},r,i,o,a])=>{const l={scrollHeight:t,scrollTop:n,viewportHeight:r};if(n+r-t>-a){let t,r;return n>e.state.scrollTop?(t="SCROLLED_DOWN",r=e.state.scrollTop-n):(t="SIZE_DECREASED",r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:l}}let s;return s=l.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":r<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":n<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:s,state:l}},vw),Qv((e,t)=>e&&e.atBottom===t.atBottom))),C=ry(Xv(r,Jv((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(Cw(e.scrollHeight,t))return{changed:!1,jump:0,scrollHeight:t,scrollTop:n};{const i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Gv(e=>e.changed),Kv(e=>e.jump)),0);Fv(Xv(p,Kv(e=>e.atBottom)),a),Fv(Xv(a,ey(50)),s);const m=ny(gw);Fv(Xv(r,Kv(({scrollTop:e})=>e),Qv(),Jv((e,t)=>Pv(h)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?mw:gw,prevScrollTop:t},{direction:gw,prevScrollTop:0}),Kv(e=>e.direction)),m),Fv(Xv(r,ey(50),Yv("none")),m);const g=ny(0);return Fv(Xv(f,Gv(e=>!e),Yv(0)),g),Fv(Xv(i,ey(100),ty(f),Gv(([e,t])=>t),Jv(([e,t],[n])=>[t,n],[0,0]),Kv(([e,t])=>t-e)),g),{atBottomState:p,atBottomStateChange:s,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:u,isAtBottom:a,isAtTop:l,isScrolling:f,lastJumpDueToItemResize:C,scrollDirection:m,scrollVelocity:g}},Zv(yy)),ww="top",bw="bottom",Ew="none";function Mw(e,t,n){return"number"==typeof e?n===mw&&t===ww||n===gw&&t===bw?e:0:n===mw?t===ww?e.main:e.reverse:t===bw?e.main:e.reverse}function Aw(e,t){var n;return"number"==typeof e?e:null!=(n=e[t])?n:0}const xw=ay(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{const o=iy(),a=ny(0),l=ny(0),s=ny(0),c=ry(Xv(sy(cy(r),cy(i),cy(n),cy(o,By),cy(s),cy(a),cy(t),cy(e),cy(l)),Kv(([e,t,n,[r,i],o,a,l,s,c])=>{const d=e-s,u=a+l,f=Math.max(n-d,0);let h=Ew;const p=Aw(c,ww),C=Aw(c,bw);return r-=s,i+=n+l,(r+=n+l)>e+u-p&&(h=mw),(i-=s)<e-f+t+C&&(h=gw),h!==Ew?[Math.max(d-n-Mw(o,ww,h)-p,0),d-f-l+t+Mw(o,bw,h)+C]:null}),Gv(e=>null!=e),Qv(By)),[0,0]);return{increaseViewportBy:l,listBoundary:o,overscan:s,topListHeight:a,visibleRange:c}},Zv(yy),{singleton:!0});const Lw={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function kw(e,t,n,r,i,o){const{lastIndex:a,lastOffset:l,lastSize:s}=i;let c=0,d=0;if(e.length>0){c=e[0].offset;const t=e[e.length-1];d=t.offset+t.size}const u=n-a,f=c,h=l+u*s+(u-1)*r-d;return{bottom:d,firstItemIndex:o,items:Sw(e,i,o),offsetBottom:h,offsetTop:c,top:f,topItems:Sw(t,i,o),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function Hw(e,t,n,r,i,o){let a=0;if(n.groupIndices.length>0)for(const t of n.groupIndices){if(t-a>=e)break;a++}const l=e+a,s=hw(t,l);return kw(Array.from({length:l}).map((e,t)=>({data:o[t+s],index:t+s,offset:0,size:0})),[],l,i,n,r)}function Sw(e,t,n){if(0===e.length)return[];if(!Wy(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));const r=e[0].index,i=e[e.length-1].index,o=[],a=ky(t.groupOffsetTree,r,i);let l,s=0;for(const r of e){let e;(!l||l.end<r.index)&&(l=a.shift(),s=t.groupIndices.indexOf(l.start)),e=r.index===l.start?{index:s,type:"group"}:{groupIndex:s,index:r.index-(s+1)+n},o.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return o}function _w(e,t){var n;return void 0===e?0:"number"==typeof e?e:null!=(n=e[t])?n:0}const Vw=ay(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},o,{listBoundary:a,topListHeight:l,visibleRange:s},{initialTopMostItemIndex:c,scrolledToInitialItem:d},{topListHeight:u},f,{didMount:h},{recalcInProgress:p}])=>{const C=ny([]),m=ny(0),g=iy(),v=ny(0);Fv(o.topItemsIndexes,C);const y=ry(Xv(sy(h,p,cy(s,By),cy(i),cy(r),cy(c),d,cy(C),cy(t),cy(n),cy(v),e),Gv(([e,t,,n,,,,,,,,r])=>{const i=r&&r.length!==n;return e&&!t&&!i}),Kv(([,,[e,t],n,r,i,o,a,l,s,c,d])=>{var u,f,h,p;const C=r,{offsetTree:g,sizeTree:v}=C,y=Pv(m);if(0===n)return{...Lw,totalCount:n};if(0===e&&0===t)return 0===y?{...Lw,totalCount:n}:Hw(y,i,r,l,s,d||[]);if(Ey(v))return y>0?null:kw(function(e,t,n){if(Wy(t)){const r=Yy(e,t);return[{index:Ay(t.groupOffsetTree,r)[0],offset:0,size:0},{data:null==n?void 0:n[0],index:r,offset:0,size:0}]}return[{data:null==n?void 0:n[0],index:e,offset:0,size:0}]}(hw(i,n),C,d),[],n,s,C,l);const w=[];if(a.length>0){const e=a[0],t=a[a.length-1];let n=0;for(const r of ky(v,e,t)){const i=r.value,o=Math.max(r.start,e),a=Math.min(r.end,t);for(let e=o;e<=a;e++)w.push({data:null==d?void 0:d[e],index:e,offset:n,size:i}),n+=i}}if(!o)return kw([],w,n,s,C,l);const b=a.length>0?a[a.length-1]+1:0,E=Jy(g,e,t,b);if(0===E.length)return null;const M=n-1,A=Iv([],n=>{for(const r of E){const i=r.value;let o=i.offset,a=r.start;const l=i.size;if(i.offset<e){a+=Math.floor((e-i.offset+s)/(l+s));const t=a-r.start;o+=t*l+t*s}a<b&&(o+=(b-a)*l,a=b);const c=Math.min(r.end,M);for(let e=a;e<=c&&!(o>=t);e++)n.push({data:null==d?void 0:d[e],index:e,offset:o,size:l}),o+=l+s}}),x=_w(c,ww),L=_w(c,bw);if(A.length>0&&(x>0||L>0)){const e=A[0],t=A[A.length-1];if(x>0&&e.index>b){const t=Math.min(x,e.index-b),n=[];let r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){const t=null!=(f=null==(u=ky(v,i,i)[0])?void 0:u.value)?f:e.size;r-=t+s,n.unshift({data:null==d?void 0:d[i],index:i,offset:r,size:t})}A.unshift(...n)}if(L>0&&t.index<M){const e=Math.min(L,M-t.index);let n=t.offset+t.size+s;for(let r=t.index+1;r<=t.index+e;r++){const e=null!=(p=null==(h=ky(v,r,r)[0])?void 0:h.value)?p:t.size;A.push({data:null==d?void 0:d[r],index:r,offset:n,size:e}),n+=e+s}}}return kw(A,w,n,s,C,l)}),Gv(e=>null!==e),Qv()),Lw);Fv(Xv(e,Gv(Nv),Kv(e=>null==e?void 0:e.length)),i),Fv(Xv(y,Kv(e=>e.topListHeight)),u),Fv(u,l),Fv(Xv(y,Kv(e=>[e.top,e.bottom])),a),Fv(Xv(y,Kv(e=>e.items)),g);const w=oy(Xv(y,Gv(({items:e})=>e.length>0),ty(i,e),Gv(([{items:e},t])=>e[e.length-1].originalIndex===t-1),Kv(([,e,t])=>[e-1,t]),Qv(By),Kv(([e])=>e))),b=oy(Xv(y,ey(200),Gv(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),Kv(({items:e})=>e[0].index),Qv())),E=oy(Xv(y,Gv(({items:e})=>e.length>0),Kv(({items:e})=>{let t=0,n=e.length-1;for(;"group"===e[t].type&&t<n;)t++;for(;"group"===e[n].type&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),Qv(Ry)));return{endReached:w,initialItemCount:m,itemsRendered:g,listState:y,minOverscanItemCount:v,rangeChanged:E,startReached:b,topItemsIndexes:C,...f}},Zv(ow,lw,xw,pw,uw,yw,sw,Py),{singleton:!0}),Ow=ay(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{const o=iy(),a=ry(Xv(sy(n,e,r,t,i),Kv(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return Fv(cy(a),o),{totalListHeight:a,totalListHeightChanged:o}},Zv(yy,Vw),{singleton:!0}),zw=ay(([{viewportHeight:e},{totalListHeight:t}])=>{const n=ny(!1);return{alignToBottom:n,paddingTopAddition:ry(Xv(sy(n,e,t),Gv(([e])=>e),Kv(([,e,t])=>Math.max(0,e-t)),ey(0),Qv()),0)}},Zv(yy,Ow),{singleton:!0}),Nw=ay(()=>({context:ny(null)})),Tw=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:o,viewportTop:a})=>t<a?{...i,align:null!=n?n:"start",behavior:r}:e>o?{...i,align:null!=n?n:"end",behavior:r}:null,Iw=ay(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:a,scrollTop:l,viewportHeight:s},{scrollToIndex:c}])=>{const d=iy();return Fv(Xv(d,ty(t,s,n,o,i,r,l),ty(e),Kv(([[e,t,n,r,i,o,l,s],c])=>{const{align:d,behavior:u,calculateViewLocation:f=Tw,done:h,...p}=e,C=Xy(e,t,r-1),m=Ky(C,t.offsetTree,c)+i+o,g=f({itemBottom:m+Ay(t.sizeTree,C)[1],itemTop:m,locationParams:{align:d,behavior:u,...p},viewportBottom:s+n-l,viewportTop:s+o});return g?h&&Uv(Xv(a,Gv(e=>!e),$v(Pv(a)?1:2)),h):null==h||h(),g}),Gv(e=>null!==e)),c),{scrollIntoView:d}},Zv(ow,yy,uw,Vw,hy),{singleton:!0});function Dw(e){return!!e&&("smooth"===e?"smooth":"auto")}const Zw=ay(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:o},{scrollToIndex:a},{scrolledToInitialItem:l},{didMount:s,propsReady:c},{log:d},{scrollingInProgress:u},{context:f},{scrollIntoView:h}])=>{const p=ny(!1),C=iy();let m=null;function g(e){Rv(a,{align:"end",behavior:e,index:"LAST"})}function v(e){const t=Uv(i,t=>{e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&!m&&(Pv(d)("scrolling to bottom due to increased size",{},uy.DEBUG),g("auto"))});setTimeout(t,100)}jv(Xv(sy(Xv(cy(t),$v(1)),s),ty(cy(p),o,l,u),Kv(([[e,t],n,r,i,o])=>{let a=t&&i,l="auto";return a&&(l=((e,t)=>"function"==typeof e?Dw(e(t)):t&&Dw(e))(n,r||o),a=a&&!!l),{followOutputBehavior:l,shouldFollow:a,totalCount:e}}),Gv(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{m&&(m(),m=null),Pv(n)?requestAnimationFrame(()=>{Pv(d)("following output to ",{totalCount:r},uy.DEBUG),g(t)}):m=Uv(e,()=>{Pv(d)("following output to ",{totalCount:r},uy.DEBUG),g(t),m=null})}),jv(Xv(sy(cy(p),t,c),Gv(([e,,t])=>e&&t),Jv(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),Gv(({refreshed:e})=>e),ty(p,t)),([,e])=>{Pv(l)&&v(!1!==e)}),jv(C,()=>{v(!1!==Pv(p))}),jv(sy(cy(p),i),([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&g("auto")});const y=ny(null),w=iy();return Fv(dy(Xv(cy(r),Kv(e=>{var t;return null!=(t=null==e?void 0:e.length)?t:0})),Xv(cy(t))),w),jv(Xv(sy(Xv(w,$v(1)),s),ty(cy(y),l,u,f),Kv(([[e,t],n,r,i,o])=>t&&r&&(null==n?void 0:n({context:o,totalCount:e,scrollingInProgress:i}))),Gv(e=>!!e),ey(0)),t=>{m&&(m(),m=null),Pv(n)?requestAnimationFrame(()=>{Pv(d)("scrolling into view",{}),Rv(h,t)}):m=Uv(e,()=>{Pv(d)("scrolling into view",{}),Rv(h,t),m=null})}),{autoscrollToBottom:C,followOutput:p,scrollIntoViewOnChange:y}},Zv(ow,yw,uw,pw,sw,hy,yy,Nw,Iw)),jw=ay(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:a},{didMount:l}])=>(Fv(Xv(l,ty(o),Gv(([,e])=>0!==e),ty(i,r,t,n,e),Kv(([[,e],t,n,r,i,o=[]])=>Hw(e,t,n,r,i,o))),a),{}),Zv(ow,pw,Vw,sw),{singleton:!0}),Rw=ay(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=ny(0);return jv(Xv(e,ty(r),Gv(([,e])=>0!==e),Kv(([,e])=>({top:e}))),e=>{Uv(Xv(n,$v(1),Gv(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{Rv(t,e)})})}),{initialScrollTop:r}},Zv(sw,yy,Vw),{singleton:!0}),Bw=ay(([{scrollVelocity:e}])=>{const t=ny(!1),n=iy(),r=ny(!1);return Fv(Xv(e,ty(r,t,n),Gv(([e,t])=>!!t),Kv(([e,t,n,r])=>{const{enter:i,exit:o}=t;if(n){if(o(e,r))return!1}else if(i(e,r))return!0;return n}),Qv()),t),jv(Xv(sy(t,e,n),ty(r)),([[e,t,n],r])=>{e&&r&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},Zv(yw),{singleton:!0}),Pw=ay(([{scrollContainerState:e,scrollTo:t}])=>{const n=iy(),r=iy(),i=iy(),o=ny(!1),a=ny(void 0);return Fv(Xv(sy(n,r),Kv(([{scrollHeight:e,scrollTop:t,viewportHeight:n},{offsetTop:r}])=>({scrollHeight:e,scrollTop:Math.max(0,t-r),viewportHeight:n}))),e),Fv(Xv(t,ty(r),Kv(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:a,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},Zv(yy)),Fw=ay(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:a,windowScrollContainerState:l,windowViewportRect:s}])=>{const c=iy(),d=ny(void 0),u=ny(null),f=ny(null);return Fv(l,u),Fv(s,f),jv(Xv(c,ty(t,r,a,u,f,n)),([e,t,n,r,i,o,a])=>{const l=function(e){return Sy(e).map(({k:e,v:t},n,r)=>{const i=r[n+1];return{endIndex:i?i.k-1:1/0,size:t,startIndex:e}})}(t.sizeTree);r&&null!==i&&null!==o&&(n=i.scrollTop-o.offsetTop),e({ranges:l,scrollTop:n-=a})}),Fv(Xv(d,Gv(Nv),Kv(Uw)),i),Fv(Xv(o,ty(d),Gv(([,e])=>void 0!==e),Qv(),Kv(([,e])=>e.ranges)),e),{getState:c,restoreStateFrom:d}},Zv(ow,yy,pw,sw,Pw));function Uw(e){return{align:"start",index:0,offset:e.scrollTop}}const qw=ay(([{topItemsIndexes:e}])=>{const t=ny(0);return Fv(Xv(t,Gv(e=>e>=0),Kv(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},Zv(Vw));function Ww(e){let t,n=!1;return()=>(n||(n=!0,t=e()),t)}const Qw=Ww(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Gw=ay(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:o,lastJumpDueToItemResize:a,scrollDirection:l},{listState:s},{beforeUnshiftWith:c,gap:d,shiftWithOffset:u,sizes:f},{log:h},{recalcInProgress:p}])=>{const C=oy(Xv(s,ty(a),Jv(([,e,t,n],[{bottom:r,items:i,offsetBottom:o,totalCount:a},l])=>{const s=r+o;let c=0;return t===a&&e.length>0&&i.length>0&&(0===i[0].originalIndex&&0===e[0].originalIndex||(c=s-n,0!==c&&(c+=l))),[c,i,a,s]},[0,[],0,0]),Gv(([e])=>0!==e),ty(r,l,n,i,h,p),Gv(([,e,t,n,,,r])=>!r&&!n&&0!==e&&t===mw),Kv(([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},uy.DEBUG),e))));function m(n){n>0?(Rv(t,{behavior:"auto",top:-n}),Rv(e,0)):(Rv(e,0),Rv(t,{behavior:"auto",top:-n}))}return jv(Xv(C,ty(e,o)),([t,n,r])=>{r&&Qw()?Rv(e,n-t):m(-t)}),jv(Xv(sy(ry(o,!1),e,p),Gv(([e,t,n])=>!e&&!n&&0!==t),Kv(([e,t])=>t),ey(1)),m),Fv(Xv(u,Kv(e=>({top:-e}))),t),jv(Xv(c,ty(f,d),Kv(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function o(e){return e*(n+i)}if(0===t.length)return o(e);{let n=0;const i=My(r,0);let a=0,l=0;for(;a<e;){a++,n+=i;let r=t.length===l+1?1/0:t[l+1]-t[l]-1;a+r>e&&(n-=i,r=e-a+1),a+=r,n+=o(r),l++}return n}})),n=>{Rv(e,n),requestAnimationFrame(()=>{Rv(t,{top:n}),requestAnimationFrame(()=>{Rv(e,0),Rv(p,!1)})})}),{deviation:e}},Zv(yy,yw,Vw,ow,hy,Py)),Kw=ay(([e,t,n,r,i,o,a,l,s,c,d])=>({...e,...t,...n,...r,...i,...o,...a,...l,...s,...c,...d}),Zv(xw,jw,sw,Bw,Ow,Rw,zw,Pw,Iw,hy,Nw)),Yw=ay(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:o,groupIndices:a,heightEstimates:l,itemSize:s,sizeRanges:c,sizes:d,statefulTotalCount:u,totalCount:f,trackItemSizes:h},{initialItemFinalLocationReached:p,initialTopMostItemIndex:C,scrolledToInitialItem:m},g,v,y,w,{scrollToIndex:b},E,{topItemCount:M},{groupCounts:A},x])=>{const{listState:L,minOverscanItemCount:k,topItemsIndexes:H,rangeChanged:S,..._}=w;return Fv(S,x.scrollSeekRangeChanged),Fv(Xv(x.windowViewportRect,Kv(e=>e.visibleHeight)),g.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:o,groupCounts:A,heightEstimates:l,initialItemFinalLocationReached:p,initialTopMostItemIndex:C,scrolledToInitialItem:m,sizeRanges:c,topItemCount:M,topItemsIndexes:H,totalCount:f,...y,groupIndices:a,itemSize:s,listState:L,minOverscanItemCount:k,scrollToIndex:b,statefulTotalCount:u,trackItemSizes:h,rangeChanged:S,..._,...x,...g,sizes:d,...v}},Zv(ow,pw,yy,Fw,Zw,Vw,uw,Gw,qw,lw,Kw));function Xw(e,t){const n={},r={};let i=0;const o=e.length;for(;i<o;)r[e[i]]=1,i+=1;for(const e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}const Jw=typeof document<"u"?i.useLayoutEffect:i.useEffect;function $w(t,n,r){const o=Object.keys(n.required||{}),a=Object.keys(n.optional||{}),l=Object.keys(n.methods||{}),s=Object.keys(n.events||{}),c=i.createContext({});function d(e,t){e.propsReady&&Rv(e.propsReady,!1);for(const r of o){Rv(e[n.required[r]],t[r])}for(const r of a)if(r in t){Rv(e[n.optional[r]],t[r])}e.propsReady&&Rv(e.propsReady,!0)}function u(e){return s.reduce((t,r)=>(t[r]=function(e){let t,n;const r=()=>null==t?void 0:t();return function(i,o){switch(i){case 1:return o?n===o?void 0:(r(),n=o,t=jv(e,o),t):(r(),Tv);case 2:return r(),void(n=null)}}}(e[n.events[r]]),t),{})}const f=i.forwardRef((f,h)=>{const{children:p,...C}=f,[m]=i.useState(()=>Iv(function(e){const t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:o})=>{if(o&&t.has(i))return t.get(i);const a=e(r.map(e=>n(e)));return o&&t.set(i,a),a};return n(e)}(t),e=>{d(e,C)})),[g]=i.useState(zv(u,m));Jw(()=>{for(const e of s)e in C&&jv(g[e],C[e]);return()=>{Object.values(g).map(Bv)}},[C,g,m]),Jw(()=>{d(m,C)}),i.useImperativeHandle(h,_v(function(e){return l.reduce((t,r)=>(t[r]=t=>{Rv(e[n.methods[r]],t)},t),{})}(m)));const v=r;return e(c.Provider,{value:m,children:r?e(v,{...Xw([...o,...a,...s],C),children:p}):p})}),h=i.version.startsWith("18")?e=>{const t=i.useContext(c)[e],n=i.useCallback(e=>jv(t,e),[t]);return i.useSyncExternalStore(n,()=>Pv(t),()=>Pv(t))}:e=>{const t=i.useContext(c)[e],[n,r]=i.useState(zv(Pv,t));return Jw(()=>jv(t,e=>{e!==n&&r(_v(e))}),[t,n]),n};return{Component:f,useEmitter:(e,t)=>{const n=i.useContext(c)[e];Jw(()=>jv(n,t),[t,n])},useEmitterValue:h,usePublisher:e=>{const t=i.useContext(c);return i.useCallback(n=>{Rv(t[e],n)},[t,e])}}}const eb=i.createContext(void 0),tb=i.createContext(void 0),nb=typeof document<"u"?i.useLayoutEffect:i.useEffect;function rb(e){return"self"in e}function ib(e,t,n,r=Tv,o,a){const l=i.useRef(null),s=i.useRef(null),c=i.useRef(null),d=i.useCallback(n=>{let r,i,o;const l=n.target;if(function(e){return"body"in e}(l)||rb(l)){const e=rb(l)?l:l.defaultView;o=a?e.scrollX:e.scrollY,r=a?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a?e.innerWidth:e.innerHeight}else o=a?l.scrollLeft:l.scrollTop,r=a?l.scrollWidth:l.scrollHeight,i=a?l.offsetWidth:l.offsetHeight;const d=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync?d():M.flushSync(d),null!==s.current&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t,a]);return i.useEffect(()=>{const e=o||l.current;return r(o||l.current),d({suppressFlushSync:!0,target:e}),e.addEventListener("scroll",d,{passive:!0}),()=>{r(null),e.removeEventListener("scroll",d)}},[l,d,n,r,o]),{scrollByCallback:function(e){a&&(e={behavior:e.behavior,left:e.top}),l.current.scrollBy(e)},scrollerRef:l,scrollToCallback:function(n){const r=l.current;if(!r||(a?"offsetWidth"in r&&0===r.offsetWidth:"offsetHeight"in r&&0===r.offsetHeight))return;const i="smooth"===n.behavior;let o,d,u;rb(r)?(d=Math.max(qy(r.document.documentElement,a?"width":"height"),a?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),o=a?r.innerWidth:r.innerHeight,u=a?window.scrollX:window.scrollY):(d=r[a?"scrollWidth":"scrollHeight"],o=qy(r,a?"width":"height"),u=r[a?"scrollLeft":"scrollTop"]);const f=d-o;if(n.top=Math.ceil(Math.max(Math.min(f,n.top),0)),Cw(o,d)||n.top===u)return e({scrollHeight:d,scrollTop:u,viewportHeight:o}),void(i&&t(!0));i?(s.current=n.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a&&(n={behavior:n.behavior,left:n.top}),r.scrollTo(n)}}}const ob="-webkit-sticky",ab="sticky",lb=Ww(()=>{if(typeof document>"u")return ab;const e=document.createElement("div");return e.style.position=ob,e.style.position===ob?ob:ab});function sb(e){return e}const cb=ay(()=>{const e=ny(e=>`Item ${e}`),t=ny(e=>`Group ${e}`),n=ny({}),r=ny(sb),i=ny("div"),o=ny(Tv),a=(e,t=null)=>ry(Xv(n,Kv(t=>t[e]),Qv()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:a("EmptyPlaceholder"),FooterComponent:a("Footer"),GroupComponent:a("Group","div"),groupContent:t,HeaderComponent:a("Header"),HeaderFooterTag:i,ItemComponent:a("Item","div"),itemContent:e,ListComponent:a("List","div"),ScrollerComponent:a("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TopItemListComponent:a("TopItemList")}}),db=ay(([e,t])=>({...e,...t}),Zv(Yw,cb)),ub=({height:t})=>e("div",{style:{height:t}}),fb={overflowAnchor:"none",position:lb(),zIndex:1},hb={overflowAnchor:"none"},pb={...hb,display:"inline-block",height:"100%"},Cb=i.memo(function({showTopList:t=!1}){const n=Ob("listState"),r=zb("sizeRanges"),o=Ob("useWindowScroll"),a=Ob("customScrollParent"),l=zb("windowScrollContainerState"),s=zb("scrollContainerState"),c=a||o?l:s,d=Ob("itemContent"),u=Ob("context"),f=Ob("groupContent"),h=Ob("trackItemSizes"),p=Ob("itemSize"),m=Ob("log"),g=zb("gap"),v=Ob("horizontalDirection"),{callbackRef:y}=my(r,p,h,t?Tv:c,m,g,a,v,Ob("skipAnimationFrameInResizeObserver")),[w,b]=i.useState(0);Vb("deviation",e=>{w!==e&&b(e)});const E=Ob("EmptyPlaceholder"),M=Ob("ScrollSeekPlaceholder")||ub,A=Ob("ListComponent"),x=Ob("ItemComponent"),L=Ob("GroupComponent"),k=Ob("computeItemKey"),H=Ob("isSeeking"),S=Ob("groupIndices").length>0,_=Ob("alignToBottom"),V=Ob("initialItemFinalLocationReached"),O=t?{}:{boxSizing:"border-box",...v?{display:"inline-block",height:"100%",marginLeft:0!==w?w:_?"auto":0,paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,whiteSpace:"nowrap"}:{marginTop:0!==w?w:_?"auto":0,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...V?{}:{visibility:"hidden"}};return!t&&0===n.totalCount&&E?e(E,{...wb(E,u)}):e(A,{...wb(A,u),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:y,style:O,children:(t?n.topItems:n.items).map(e=>{const t=e.originalIndex,r=k(t+n.firstItemIndex,e.data,u);return H?C(M,{...wb(M,u),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?C(L,{...wb(L,u),"data-index":t,"data-item-index":e.index,"data-known-size":e.size,key:r,style:fb},f(e.index,u)):C(x,{...wb(x,u),...bb(x,e.data),"data-index":t,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:v?pb:hb},S?d(e.index,e.groupIndex,e.data,u):d(e.index,e.data,u))})})}),mb={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},gb={outline:"none",overflowX:"auto",position:"relative"},vb=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),yb={position:lb(),top:0,width:"100%",zIndex:1};function wb(e,t){if("string"!=typeof e)return{context:t}}function bb(e,t){return{item:"string"==typeof e?void 0:t}}const Eb=i.memo(function(){const t=Ob("HeaderComponent"),n=zb("headerHeight"),r=Ob("HeaderFooterTag"),o=py(i.useMemo(()=>e=>{n(qy(e,"height"))},[n]),!0,Ob("skipAnimationFrameInResizeObserver")),a=Ob("context");return t?e(r,{ref:o,children:e(t,{...wb(t,a)})}):null}),Mb=i.memo(function(){const t=Ob("FooterComponent"),n=zb("footerHeight"),r=Ob("HeaderFooterTag"),o=py(i.useMemo(()=>e=>{n(qy(e,"height"))},[n]),!0,Ob("skipAnimationFrameInResizeObserver")),a=Ob("context");return t?e(r,{ref:o,children:e(t,{...wb(t,a)})}):null});function Ab({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:i,style:o,context:a,...l}){const s=r("scrollContainerState"),c=n("ScrollerComponent"),d=r("smoothScrollTargetReached"),u=n("scrollerRef"),f=n("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:p,scrollToCallback:C}=ib(s,d,c,u,void 0,f);return t("scrollTo",C),t("scrollBy",h),e(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:p,style:{...f?gb:mb,...o},tabIndex:0,...l,...wb(c,a),children:i})})}function xb({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:o,style:a,context:l,...s}){const c=r("windowScrollContainerState"),d=n("ScrollerComponent"),u=r("smoothScrollTargetReached"),f=n("totalListHeight"),h=n("deviation"),p=n("customScrollParent"),C=i.useRef(null),m=n("scrollerRef"),{scrollByCallback:g,scrollerRef:v,scrollToCallback:y}=ib(c,u,d,m,p);return nb(()=>{var e;return v.current=p||(null==(e=C.current)?void 0:e.ownerDocument.defaultView),()=>{v.current=null}},[v,p]),t("windowScrollTo",y),t("scrollBy",g),e(d,{ref:C,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...0!==f?{height:f+h}:{}},...s,...wb(d,l),children:o})})}const Lb=({children:t})=>{const n=i.useContext(eb),r=zb("viewportHeight"),o=zb("fixedItemHeight"),a=Ob("alignToBottom"),l=Ob("horizontalDirection"),s=py(i.useMemo(()=>Ov(r,e=>qy(e,l?"width":"height")),[r,l]),!0,Ob("skipAnimationFrameInResizeObserver"));return i.useEffect(()=>{n&&(r(n.viewportHeight),o(n.itemHeight))},[n,r,o]),e("div",{"data-viewport-type":"element",ref:s,style:vb(a),children:t})},kb=({children:t})=>{const n=i.useContext(eb),r=zb("windowViewportRect"),o=zb("fixedItemHeight"),a=Ob("customScrollParent"),l=vy(r,a,Ob("skipAnimationFrameInResizeObserver")),s=Ob("alignToBottom");return i.useEffect(()=>{n&&(o(n.itemHeight),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:100}))},[n,r,o]),e("div",{"data-viewport-type":"window",ref:l,style:vb(s),children:t})},Hb=({children:t})=>{const n=Ob("TopItemListComponent")||"div",r=Ob("headerHeight"),i={...yb,marginTop:`${r}px`},o=Ob("context");return e(n,{style:i,...wb(n,o),children:t})},Sb=i.memo(function(t){const r=Ob("useWindowScroll"),i=Ob("topItemsIndexes").length>0,o=Ob("customScrollParent"),a=Ob("context");return n(o||r?Tb:Nb,{...t,context:a,children:[i&&e(Hb,{children:e(Cb,{showTopList:!0})}),n(o||r?kb:Lb,{children:[e(Eb,{}),e(Cb,{}),e(Mb,{})]})]})}),{Component:_b,useEmitter:Vb,useEmitterValue:Ob,usePublisher:zb}=$w(db,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Sb),Nb=Ab({useEmitter:Vb,useEmitterValue:Ob,usePublisher:zb}),Tb=xb({useEmitter:Vb,useEmitterValue:Ob,usePublisher:zb}),Ib=_b,Db=ay(()=>{const e=ny(e=>n("td",{children:["Item $",e]})),t=ny(null),r=ny(e=>n("td",{colSpan:1e3,children:["Group ",e]})),i=ny(null),o=ny(null),a=ny({}),l=ny(sb),s=ny(Tv),c=(e,t=null)=>ry(Xv(a,Kv(t=>t[e]),Qv()),t);return{components:a,computeItemKey:l,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:o,fixedHeaderContent:i,itemContent:e,groupContent:r,ScrollerComponent:c("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}});Zv(Yw,Db),lb();const Zb={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},jb={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Rb,floor:Bb,max:Pb,min:Fb,round:Ub}=Math;function qb(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:null===n?null:n[r+e],index:r+e}))}function Wb(e,t){return e&&e.width===t.width&&e.height===t.height}function Qb(e,t){return e&&e.column===t.column&&e.row===t.row}const Gb=ay(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:o,scrollBy:a,scrollContainerState:l,scrollTo:s,scrollTop:c,smoothScrollTargetReached:d,viewportHeight:u},f,h,{didMount:p,propsReady:C},{customScrollParent:m,useWindowScroll:g,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:w},b])=>{const E=ny(0),M=ny(0),A=ny(Zb),x=ny({height:0,width:0}),L=ny({height:0,width:0}),k=iy(),H=iy(),S=ny(0),_=ny(null),V=ny({column:0,row:0}),O=iy(),z=iy(),N=ny(!1),T=ny(0),I=ny(!0),D=ny(!1),Z=ny(!1);jv(Xv(p,ty(T),Gv(([e,t])=>!!t)),()=>{Rv(I,!1)}),jv(Xv(sy(p,I,L,x,T,D),Gv(([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i)),([,,,,e])=>{Rv(D,!0),fw(1,()=>{Rv(k,e)}),Uv(Xv(c),()=>{Rv(t,[0,0]),Rv(I,!0)})}),Fv(Xv(z,Gv(e=>null!=e&&e.scrollTop>0),Yv(0)),M),jv(Xv(p,ty(z),Gv(([,e])=>null!=e)),([,e])=>{e&&(Rv(x,e.viewport),Rv(L,e.item),Rv(V,e.gap),e.scrollTop>0&&(Rv(N,!0),Uv(Xv(c,$v(1)),e=>{Rv(N,!1)}),Rv(s,{top:e.scrollTop})))}),Fv(Xv(x,Kv(({height:e})=>e)),u),Fv(Xv(sy(cy(x,Wb),cy(L,Wb),cy(V,(e,t)=>e&&e.column===t.column&&e.row===t.row),cy(c)),Kv(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),O),Fv(Xv(sy(cy(E),r,cy(V,Qb),cy(L,Wb),cy(x,Wb),cy(_),cy(M),cy(N),cy(I),cy(T)),Gv(([,,,,,,,e])=>!e),Kv(([e,[t,n],r,i,o,a,l,,s,c])=>{const{column:d,row:u}=r,{height:f,width:h}=i,{width:p}=o;if(0===l&&(0===e||0===p))return Zb;if(0===h){const t=hw(c,e);return function(e){return{...jb,items:e}}(qb(t,t+Math.max(l-1,0),a))}const C=Kb(p,h,d);let m,g;s?0===t&&0===n&&l>0?(m=0,g=l-1):(m=C*Bb((t+u)/(f+u)),g=C*Rb((n+u)/(f+u))-1,g=Fb(e-1,Pb(g,C-1)),m=Fb(g,Pb(0,m))):(m=0,g=-1);const v=qb(m,g,a),{bottom:y,top:w}=Yb(o,r,i,v),b=Rb(e/C);return{bottom:y,itemHeight:f,items:v,itemWidth:h,offsetBottom:b*f+(b-1)*u-y,offsetTop:w,top:w}})),A),Fv(Xv(_,Gv(e=>null!==e),Kv(e=>e.length)),E),Fv(Xv(sy(x,L,A,V),Gv(([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height),Kv(([e,t,{items:n},r])=>{const{bottom:i,top:o}=Yb(e,r,t,n);return[o,i]}),Qv(By)),t);const j=ny(!1);Fv(Xv(c,ty(j),Kv(([e,t])=>t||0!==e)),j);const R=oy(Xv(sy(A,E),Gv(([{items:e}])=>e.length>0),ty(j),Gv(([[e,t],n])=>{const r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&0===e.offsetBottom&&e.items.length===t)&&r}),Kv(([[,e]])=>e-1),Qv())),B=oy(Xv(cy(A),Gv(({items:e})=>e.length>0&&0===e[0].index),Yv(0),Qv())),P=oy(Xv(cy(A),ty(N),Gv(([{items:e},t])=>e.length>0&&!t),Kv(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),Qv(Ry),ey(0)));Fv(P,h.scrollSeekRangeChanged),Fv(Xv(k,ty(x,L,E,V),Kv(([e,t,n,r,i])=>{const o=dw(e),{align:a,behavior:l,offset:s}=o;let c=o.index;"LAST"===c&&(c=r-1),c=Pb(0,c,Fb(r-1,c));let d=Xb(t,i,n,c);return"end"===a?d=Ub(d-t.height+n.height):"center"===a&&(d=Ub(d-t.height/2+n.height/2)),s&&(d+=s),{behavior:l,top:d}})),s);const F=ry(Xv(A,Kv(e=>e.offsetBottom+e.bottom)),0);return Fv(Xv(w,Kv(e=>({height:e.visibleHeight,width:e.visibleWidth}))),x),{customScrollParent:m,data:_,deviation:S,footerHeight:i,gap:V,headerHeight:o,increaseViewportBy:e,initialItemCount:M,itemDimensions:L,overscan:n,restoreStateFrom:z,scrollBy:a,scrollContainerState:l,scrollHeight:H,scrollTo:s,scrollToIndex:k,scrollTop:c,smoothScrollTargetReached:d,totalCount:E,useWindowScroll:g,viewportDimensions:x,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:w,...h,gridState:A,horizontalDirection:Z,initialTopMostItemIndex:T,totalListHeight:F,...f,endReached:R,propsReady:C,rangeChanged:P,startReached:B,stateChanged:O,stateRestoreInProgress:N,...b}},Zv(xw,yy,yw,Bw,sw,Pw,hy));function Kb(e,t,n){return Pb(1,Bb((e+n)/(Bb(t)+n)))}function Yb(e,t,n,r){const{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};const o=Xb(e,t,n,r[0].index);return{bottom:Xb(e,t,n,r[r.length-1].index)+i,top:o}}function Xb(e,t,n,r){const i=Kb(e.width,n.width,t.column),o=Bb(r/i),a=o*n.height+Pb(0,o-1)*t.row;return a>0?a+t.row:a}const Jb=ay(()=>{const e=ny(e=>`Item ${e}`),t=ny({}),n=ny(null),r=ny("virtuoso-grid-item"),i=ny("virtuoso-grid-list"),o=ny(sb),a=ny("div"),l=ny(Tv),s=(e,n=null)=>ry(Xv(t,Kv(t=>t[e]),Qv()),n),c=ny(!1),d=ny(!1);return Fv(cy(d),c),{components:t,computeItemKey:o,context:n,FooterComponent:s("Footer"),HeaderComponent:s("Header"),headerFooterTag:a,itemClassName:r,ItemComponent:s("Item","div"),itemContent:e,listClassName:i,ListComponent:s("List","div"),readyStateChanged:c,reportReadyState:d,ScrollerComponent:s("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),$b=ay(([e,t])=>({...e,...t}),Zv(Gb,Jb)),eE=i.memo(function(){const t=lE("gridState"),n=lE("listClassName"),r=lE("itemClassName"),o=lE("itemContent"),a=lE("computeItemKey"),l=lE("isSeeking"),s=sE("scrollHeight"),c=lE("ItemComponent"),d=lE("ListComponent"),u=lE("ScrollSeekPlaceholder"),f=lE("context"),h=sE("itemDimensions"),p=sE("gap"),m=lE("log"),g=lE("stateRestoreInProgress"),v=sE("reportReadyState"),y=py(i.useMemo(()=>e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const n=e.firstChild;if(n){const{height:e,width:t}=n.getBoundingClientRect();h({height:e,width:t})}p({column:uE("column-gap",getComputedStyle(e).columnGap,m),row:uE("row-gap",getComputedStyle(e).rowGap,m)})},[s,h,p,m]),!0,!1);return nb(()=>{t.itemHeight>0&&t.itemWidth>0&&v(!0)},[t]),g?null:e(d,{className:n,ref:y,...wb(d,f),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map(n=>{const i=a(n.index,n.data,f);return l?e(u,{...wb(u,f),height:t.itemHeight,index:n.index,width:t.itemWidth},i):C(c,{...wb(c,f),className:r,"data-index":n.index,key:i},o(n.index,n.data,f))})})}),tE=i.memo(function(){const t=lE("HeaderComponent"),n=sE("headerHeight"),r=lE("headerFooterTag"),o=py(i.useMemo(()=>e=>{n(qy(e,"height"))},[n]),!0,!1),a=lE("context");return t?e(r,{ref:o,children:e(t,{...wb(t,a)})}):null}),nE=i.memo(function(){const t=lE("FooterComponent"),n=sE("footerHeight"),r=lE("headerFooterTag"),o=py(i.useMemo(()=>e=>{n(qy(e,"height"))},[n]),!0,!1),a=lE("context");return t?e(r,{ref:o,children:e(t,{...wb(t,a)})}):null}),rE=({children:t})=>{const n=i.useContext(tb),r=sE("itemDimensions"),o=sE("viewportDimensions"),a=py(i.useMemo(()=>e=>{o(e.getBoundingClientRect())},[o]),!0,!1);return i.useEffect(()=>{n&&(o({height:n.viewportHeight,width:n.viewportWidth}),r({height:n.itemHeight,width:n.itemWidth}))},[n,o,r]),e("div",{ref:a,style:vb(!1),children:t})},iE=({children:t})=>{const n=i.useContext(tb),r=sE("windowViewportRect"),o=sE("itemDimensions"),a=lE("customScrollParent"),l=vy(r,a,!1);return i.useEffect(()=>{n&&(o({height:n.itemHeight,width:n.itemWidth}),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:n.viewportWidth}))},[n,r,o]),e("div",{ref:l,style:vb(!1),children:t})},oE=i.memo(function({...t}){const r=lE("useWindowScroll"),i=lE("customScrollParent"),o=i||r?dE:cE,a=i||r?iE:rE,l=lE("context");return e(o,{...t,...wb(o,l),children:n(a,{children:[e(tE,{}),e(eE,{}),e(nE,{})]})})}),{useEmitter:aE,useEmitterValue:lE,usePublisher:sE}=$w($b,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},oE),cE=Ab({useEmitter:aE,useEmitterValue:lE,usePublisher:sE}),dE=xb({useEmitter:aE,useEmitterValue:lE,usePublisher:sE});function uE(e,t,n){return"normal"!==t&&!(null!=t&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,uy.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}const fE=({optionsList:r=[],onSelectVariable:i,dropdownPosition:o,position:a="relative",width:l,height:s="160px",zIndex:c=9999})=>{const d={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},u=e=>{if(!e)return"";const t=e._id||e.id;return t?.startsWith("PARAMETER")?"step_group_parameter":"STEPGROUP"!==e?.parentVariableType||"LOCAL"!==e.type&&"STEPGROUP"!==e?.type?"_startforloop"===e.type?"for_loop_variable":"DATAPROVIDER"===e.type?"data_provider_variable":d[e.type||""]||"":"step_group_variable"},f=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;function h(e){if(e.endsWith("px")){const t=parseInt(e.slice(0,-2),10);return isNaN(t)?212:t-66}return 212}return e("div",{className:z("ff-variable-dropdown",a),style:o?{top:o.top+30,left:o.left-30,width:l,height:s,zIndex:c}:{width:l,height:s,zIndex:c},children:G(r)?e("div",{className:"ff-variable-option ff-variable-option-no-data",children:e(F,{as:"span",fontSize:12,children:"No Option"})}):e(Ib,{totalCount:r.length,itemContent:o=>{const a=r[o];return a?e("div",{className:"ff-variable-data",onMouseDown:()=>i(a),children:l.endsWith("px")?n(t,{children:[e(K,{title:oe(f(a),h(l),"pixel")?f(a):"",style:{width:`${h(l)}px`},children:e(F,{as:"span",fontSize:12,className:"ff-truncated_text",children:f(a)})}),e(P,{name:u(a),height:24,width:24,hoverEffect:!0})]}):e(Sv,{option:a})},`${a.id}-${o}`):null},style:{height:s,fontSize:"12px"},overscan:10,fixedItemHeight:32})})},hE=({data:r=[],width:i,height:o,lineChartWidth:a,yAxisLabel:s,xAxisLabel:d,yAxisValueColor:u,xAxisColor:f,yAxisColor:h,yAxisLabelColor:p,textSize:C,fontWeight:m,numberSize:g,chartName:v,shouldCenterSinglePoint:y,xAxisLabelGap:w=16,isLeftOverflow:b=!1})=>{const E=40,M=i-80,A=o-80,[x,L]=c(!1),[k,H]=c({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});l(()=>{const e=()=>{L(!1),H(e=>({...e,tooltip:{...e.tooltip,visible:!1}}))};return window.addEventListener("scroll",e,!0),()=>window.removeEventListener("scroll",e,!0)},[]);if(!(r&&r.length>0&&r?.some(e=>Array.isArray(e?.data)&&e?.data?.length>0))){const t=[];for(let e=6;e>=0;e--){const n=new Date;n.setDate(n.getDate()-e);const r=n?.toLocaleDateString("en-US",{day:"numeric",month:"short"});t.push(r)}const r=1024,a=6,l=7;return n("div",{className:"ff-line-chart-text",style:{width:i+20+w,gap:w},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(F,{className:"ff-line-chart-yAxisLabel",fontSize:C,fontWeight:"semi-bold",children:s})}),e("div",{className:"ff-line-chart-svg",children:e("svg",{height:o,width:i,className:"ff-line-chart-svg",children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:A,x2:M,y2:A,stroke:f,strokeWidth:1}),e("text",{x:M/2.1,y:A+E/1.2,textAnchor:"middle",fill:p,className:"ff-line-chart-x-axis-label",style:{fontSize:C,fontWeight:m},children:d}),t.map((t,n)=>e("text",{x:n*(M/(l-1)),y:A+15,textAnchor:0===n?"start":n===l-1?"end":"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:t},t)),Array.from({length:a}).map((t,n)=>{const i=n*r/(a-1),o=i/1024;return e("text",{x:-10,y:A-i*A/r,textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:o?.toFixed(1)},`y-${n}`)})]})})})]})}function S(e){if(!isNaN(e))return parseFloat(e);const t=at,n=e.match(t);if(!n)throw new Error("Invalid input format. Use '<value> <unit>' format (e.g., '10.9580078125 KB') or just a number.");const r=parseFloat(n[1]);switch(n[2]?n[2].toUpperCase():null){case"GB":return parseFloat((1024*r).toFixed(2));case"MB":return parseFloat(r.toFixed(2));case"KB":return parseFloat((r/1024).toFixed(2));default:throw new Error("Invalid unit. Supported units are GB, MB, and KB.")}}const _=r?.[0]?.data?.[0]?.hasOwnProperty("date")&&r?.[0]?.data?.[0]?.hasOwnProperty("totalMemory"),V="date",O=_?"totalMemory":"value",z=e=>{const t=r?.[0]?.data?.length;if(1===t)return y?M/2:M;const n=r[0].data.findIndex(t=>t[V]===e);return-1===n?0:n/(t-1)*M},N=Math.max(...r?.flatMap(e=>e?.data?.map(e=>S(e[O]))),5),T=e=>{if("memory"===v){const t=Math.max(...r?.flatMap(e=>e?.data?.map(e=>S(e[O]))));return A-e*A/(t>1024?t:1024)}return A-e*A/(0===N?1024:N)},I=e=>{if(1===e?.length){const t=e?.[0],n=z(t[V]),r=T(S(t[O]));return`M 0 ${T(0)} L ${n} ${r}`}return e?.reduce((t,n,r)=>{const i=z(n[V]),o=T(S(n[O]));if(0===r)return`M ${i} ${o}`;const a=e[r-1],l=a?z(a[V]):0;return`${t} C ${l+(i-l)/2} ${a?T(S(a[O])):0}, ${i-(i-l)/2} ${o}, ${i} ${o}`},"")},D=r[0].data;return n("div",{className:"ff-line-chart-text",style:{width:i+20+w,gap:w},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(F,{className:"ff-line-chart-yAxisLabel",fontSize:C,fontWeight:"semi-bold",children:s})}),n("div",{className:"ff-line-chart-svg",children:[e("svg",{height:o,width:i,onMouseMove:e=>{const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-E;if(e.clientY-t.top-E>A)return L(!1),void H({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});let i={hoverValues:{},dotPositions:{}},o=null;r.forEach((e,t)=>{const r=e.data.reduce((e,t)=>{const r=Math.abs(n-z(t[V]));return r<e.distance?{point:t,distance:r}:e},{point:null,distance:1/0}).point;r&&(o=r[V],i.hoverValues[t]=((e,t=2)=>{let n="";if("string"==typeof e){const t=e.match(rt),r=e.match(it);t&&(e=parseFloat(t[0])),r&&(n=r[0])}const r=Math.pow(10,t);return`${Math.ceil(e*r)/r} ${n}`.trim()})(r[O]),i.dotPositions[t]={x:z(r[V]),y:T(S(r[O]))})}),L(!0),H({cursorX:n,hoverValues:i.hoverValues,dotPositions:i.dotPositions,currentXValue:o,tooltip:o?{visible:!0,left:e.clientX+10,top:e.clientY-20}:{visible:!1,left:0,top:0}})},onMouseLeave:()=>H({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null}),className:"ff-line-chart-svg",children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:0,x2:0,y2:A,strokeWidth:2}),e("line",{x1:0,y1:A,x2:M,y2:A,stroke:f,strokeWidth:1}),e("text",{x:M/2.1,y:A+E/1.2,textAnchor:"middle",fill:p,className:"ff-line-chart-x-axis-label",style:{fontSize:C,fontWeight:m},children:d}),r.map((r,i)=>{return!1!==r.show?n("g",{children:[e("path",{d:I(r.data),fill:"none",stroke:r.color,strokeWidth:a,opacity:(o=r.data,o.every(e=>0===S(e[O]))?.5:1)}),k.dotPositions[i]&&n(t,{children:[e("line",{x1:k.dotPositions[i].x,y1:0,x2:k.dotPositions[i].x,y2:A,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"}),e("circle",{cx:k.dotPositions[i].x,cy:k.dotPositions[i].y,r:5,fill:"white",stroke:r.color,strokeWidth:a,style:{transition:"cx 0.1s, cy 0.1s"}}),e("line",{x1:0,y1:k.dotPositions[i].y,x2:M,y2:k.dotPositions[i].y,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"})]})]},i):null;var o}),(()=>{if(1===D.length){const t=D?.[0];return e("text",{x:y?M/2:M,y:A+15,textAnchor:y?"middle":"end",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=t[V]?String(t[V]):""},String(t[V]))}if(D.length<7)return D.map(t=>e("text",{x:z(t[V]),y:A+15,textAnchor:"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=t[V]?String(t[V]):""},String(t[V])));{const t=(i-80-7*9.2)/6;return Array.from({length:7}).map((n,r)=>{const i=Math.floor(r*(D?.length-1)/6),o=D[i];return e("text",{x:r*t,y:A+15,fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=o?.[V]?String(o?.[V]):""},String(o?.[V]))})}})(),(()=>{if("memory"===v){const t=Math.max(N,1024);return Array.from({length:6}).map((n,r)=>{const i=r*t/5,o=i/1024;return e("text",{x:-10,y:T(i),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:o.toFixed(1)},`y-${r}`)})}return Array.from({length:6}).map((t,n)=>{const r=n*N/5;return e("text",{x:-10,y:T(r),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:r.toFixed(0)},`y-${n}`)})})()]})}),x&&k.tooltip.visible&&n("div",{className:"ff-line-chart-tooltip",style:{left:b&&k.tooltip.left/2>i/1.75?k.tooltip.left-180:k.tooltip.left,top:k.tooltip.top},children:[e("div",{className:"ff-line-chart-date",children:k.currentXValue}),Object.entries(k.hoverValues).map(([t,i])=>!1!==r[Number(t)]?.show&&n("div",{className:"ff-line-chart-inner-tooltip",children:["default"!==r[Number(t)]?.name&&e("div",{className:"ff-line-chart-status-dot",style:{backgroundColor:r[Number(t)]?.color}}),r[Number(t)]?.name,": ",i]},t))]})]})]})},pE=({onClose:t,top:r="100px",left:i="0px",className:o,description:a="Download and Install the fireflink client to run the script",onClick:s=()=>{},optionZIndex:c=10000001})=>{l(()=>{const e=e=>{"Escape"===e.key&&t?.()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[t]);return n("div",{className:`ff-download-client-wrapper ${o}`,style:{top:r,left:i,zIndex:c},children:[n("div",{className:"ff-download-client-header-wrapper",children:[e("div",{className:"ff-download-client-hollow-triangle"}),e(F,{fontWeight:"semi-bold",lineHeight:"32px",className:"ff-download-client-header-text",children:"Download client"}),e(P,{name:"close",color:"var(--brand-color)",className:"ff-download-client-close-icon",height:12,width:12})]}),n("div",{className:"ff-download-client-content-text",children:[e(F,{as:"div",color:"var(--download-client-content-text-color)",fontWeight:"semi-bold",textAlign:"center",lineHeight:"26px",children:a}),e(F,{as:"div",className:"ff-download-client-description-text",textAlign:"center",fontWeight:"medium",lineHeight:"26px",children:"Choose OS to Download"}),e("div",{className:"ff-download-client-os-wrapper",children:["windows","mac_icon","linux"].map(t=>e("div",{className:"ff-os-version-wrapper",onClick:()=>{s("mac_icon"===t?"mac":t)},children:e(P,{name:t,height:36,width:36})},t))})]})]})},CE=({legendName:t,height:r,width:i,children:o})=>e("div",{className:"ff_fieldSet_container",children:n("fieldset",{className:"ff_fieldSet",style:{height:r,width:i},children:[e("legend",{className:"ff_legend_container",children:e(F,{color:"var(--license_header_text_color)",fontSize:8,lineHeight:"12px",children:t})}),e("div",{className:"ff_children_container",children:o})]})}),mE=({onSelectVariable:t,dropdownPosition:n,filteredOptions:r=[],position:i="relative",width:o="100%",zIndex:a,truncateTextValue:l=34})=>e("div",{className:z(`ff-variable-dropdown-container ${i}`),style:n?{top:n.top+30,left:n.left-30,width:o,zIndex:a}:{width:o,zIndex:a},children:G(r)?e("div",{className:"ff-variable-option no-data",children:e(F,{as:"div",children:"No Option",fontSize:14})}):r?.map(n=>e("div",{className:"ff-variable-option",onMouseDown:()=>t(n),children:e(K,{title:oe(n?.name,l,"pixel")?n?.name:"",children:e(F,{children:ie(n?.name,l,"pixel")})})},n?.id))}),gE=o(({label:t="",hashInputValue:r="",setHashInputValue:i,variableList:o=[],placeholder:s="Enter text",onChange:d,onPaste:u,onCreateVariableClick:f,handleClearInput:h,value:p="",dropdownWidth:C="100%",dropdownHeight:m="160px",isHash:g=!1,isOnlyHash:v=!1,dataFiles:y=[],showAddVariableIcon:w=!0,helperText:E="",error:M,autoComplete:A="off",required:x=!1,zIndex:L=9999,truncateTextValue:k=34,formProps:H={},getSelectedVariable:S=()=>{},symbol:_="$",type:V="text",clearIcon:O=!0,inputTitle:N="",onBlur:T,helperTextWidth:I,iconProps:D={isShowIcon:!1,iconName:"",iconToolTipTitle:"",isIconDisable:!1,iconColor:"",onIconClick:()=>{}},...Z},j)=>{const[R,B]=c(!1),[U,q]=c(!1),[W,Q]=c(!1),[Y,X]=c(null),[J,$]=c(0),[ee,te]=c(!1),[ne,re]=c([]),ie=a(null),oe=a(null),[ae,le]=c("auto"),se=D?.isShowIcon;l(()=>{const e=oe.current?.querySelector(".ff-input-container");if(!e)return;const t=new ResizeObserver(e=>{for(let t of e){const e=`${t.contentRect.width}px`;le(e)}});return t.observe(e),()=>{t.disconnect()}},[]),b(j,()=>ie.current),l(()=>{null!==Y&&ie.current&&(ie.current.setSelectionRange(Y,Y),ie.current.focus())},[Y]),l(()=>{g&&B(p.startsWith("#"));const e=y?.find(e=>e.name===p),t=o?.find(e=>e?.name===p);if(p.startsWith("#")&&g){const e=p.slice(1).toLowerCase(),t=y.filter(t=>t.name.toLowerCase().includes(e));re(t),B(!0)}const n=null!==e&&p.startsWith("#"),r=null!==t&&p.startsWith("$"),i=p.length>(t?.name.length||0),a=p.length>0&&!r||p.startsWith("#");v?te(!1):r||n||p.includes("$")||p.includes("#")?(te(!1),a&&te(!0)):i&&!p.includes("$")&&te(!0)},[p]);const ce=()=>{ie.current&&$(ie.current.selectionStart||0)},de=ce,ue=ce;l(()=>{ie.current&&$(ie.current.selectionStart||0)},[p]);const fe=e=>{if(ie.current){const{selectionStart:t,selectionEnd:n}=ie.current,r=`${e.name}`;let o;if(o=g&&"#"===p[0]?e.name+p.slice(n||1):e.name,d){d({target:{value:o}},e),S(e.name)}ie.current.value=o,i?.(e),X((t||0)+r.length),B(!1),q(!0)}};const he=function(e,t,n){let r=!1,i="";const o="}"===p[t-1];if(t<0||t>e.length)return{showDropdown:r,searchString:i};const a=e.lastIndexOf(_,t-1),l=e.indexOf(_,t);if(-1!==a&&(v&&"$"===e[a]?r=!1:t===a+1?(r=!0,i=""):(i=e.slice(a+1,-1===l?void 0:l),t>a+1&&(i=e.slice(a+1,t)),r=!0),U&&o&&(r=!1),(/[{}]/.test(i)||0===t)&&(r=!1,i=""),i)){n.some(e=>e.name.toLowerCase().includes(i.toLowerCase()))||(n=[])}return{showDropdown:r,searchString:i}}(p,J,o),pe=()=>o?.filter(e=>e?.name?.toLowerCase()?.includes(he?.searchString?.toLowerCase()));return n("div",{className:"ff-add-variable-container",children:[n("div",{className:"ff-add-variable-input",ref:oe,children:[e(K,{title:N,style:{width:"100%"},children:e(rn,{...Z,name:"add_variable",ref:ie,type:V,className:z("ff-variable-input-container",{"ff-variable-input-container--show-icon":se}),value:p,onChange:d,onPaste:()=>{te(!0)},variant:"primary",label:t,placeholder:s,onClick:de,onKeyUp:ue,onFocus:()=>Q(!0),onBlur:e=>{(e=>{e.relatedTarget&&e.relatedTarget.closest(".dropdown-container")||Q(!1)})(e),T?.(e)},autoComplete:A,helperText:E,error:M,required:x,helperTextWidth:I,...H})}),!G(p)&&ee&&w&&e("div",{className:"ff-create-variable-container",onClick:f,children:e(F,{fontWeight:"regular",fontSize:"10px",color:"var(--brand-color)",cursor:"pointer",children:"Create Variable"})}),!G(p)&&!v&&e("div",{className:z("ff-cancel-icon-container",{"ff-cancel-icon-container--show-icon":se}),children:O&&e(K,{title:"Cancel",style:{zIndex:99999},children:e(P,{onClick:h,name:"close",height:16,width:16,hoverEffect:!0})})}),se&&e("div",{className:"ff-info-icon-container",children:e(K,{title:se&&!D?.isIconDisable?D?.iconToolTipTitle:"",children:e(P,{name:D?.iconName||"",hoverEffect:!1,height:16,width:16,color:D?.iconColor||"var(--text-area-default-color)",onClick:e=>{D?.onIconClick&&D?.onIconClick(e)},disabled:D?.isIconDisable,cursorType:"pointer"})})})]}),he?.showDropdown&&W&&e(fE,{position:"absolute",zIndex:L,truncateTextValue:k,width:ae,height:G(pe())?"auto":m,optionsList:pe(),onSelectVariable:fe}),R&&g&&W&&e(mE,{position:"relative",zIndex:L,truncateTextValue:k,width:ae,filteredOptions:ne,onSelectVariable:fe})]})}),vE=({isOpen:t,variableTypesList:r=[],onClose:i,onNameChange:o,onValueChange:a,variableName:s,variableValue:d,onVariableTypeChange:u,selectedVariableType:f,hideValue:h=!1,onHideChange:p,handleSubmit:C,mode:m="create",disabled:g,dataFiles:v=[],truncateTextValue:y=34,isEnterKeySubmit:w=!1})=>{const[b,E]=c(!1),[M,A]=c(""),[x,L]=c(),[k,H]=c(!1),[S,_]=c(!1),[V,O]=c({name:"",value:"",isChecked:!1});l(()=>{t&&"edit"===m&&O({name:s,value:d,isChecked:h})},[]);const z=e=>e&&0!==e.length?" "===e[0]||" "===e[e.length-1]?"Space is not allowed at starting and at the end":Ee.test(e)?e.length<3?"Name should contain at least 3 characters":e.length>25?"Name can contain at most 25 characters":"":"Name should be alphanumeric":"Variable Name is required";function N(e){const t=!!e,n=Ee.test(e),r=Vt.test(e),i=e.length>=3&&e.length<=25;return t&&n&&r&&i}l(()=>{const e=z(s);E(!!e),A(e)},[s]),l(()=>{if("edit"!==m)return;const{name:e,value:t,isChecked:n}=V;_(s!==e||d!==t||h!==n)},[m,s,d,h,V]);const T=()=>{!k&&N(s)&&(H(!0),C())};l(()=>{if(!w)return;const e=e=>{if("Enter"===e.key){e.preventDefault();!N(s)||k||"edit"===m&&!S||T()}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[w,s,d,h,k,m,S,f]);return e(X,{zIndex:1350,onClose:i,isOpen:t,title:"create"===m?"Create Variable":"Edit Variable",width:"284px",height:"280px",top:"30%",right:8,isFooterRequired:!0,overlay:!0,footerContent:e(()=>n("div",{className:"ff-create-slider-footer",children:[e(U,{onClick:i,label:"Cancel",variant:"tertiary"}),e(U,{variant:"primary",label:"create"===m?"Create":"Update",type:"submit",onClick:T,disabled:!N(s)||k||"edit"===m&&!S})]}),{}),children:n("div",{className:"ff-create-variable-slider",children:[e("div",{className:"ff-create-variable-slider-input",children:e(rn,{label:"Variable Name",required:!0,type:"text",name:"variableName",value:s||"",onChange:e=>{H(!1),o(e.target.value)},error:b,helperText:M,onBlur:e=>{const t=e.target.value,n=z(t);E(!!n),A(n)}})}),e(lr,{label:"Variable Type",required:!0,onChange:e=>{u(e),H(!1)},selectedOption:f,optionsList:r,optionZIndex:99999,valueAccessor:"label",disabled:"edit"===m}),e(gE,{label:"Variable Value",placeholder:"Enter Variable value or select path using #",isHash:!0,isOnlyHash:!0,zIndex:99999,truncateTextValue:y,dataFiles:v,dropdownWidth:"100%",setHashInputValue:L,hashInputValue:x||{},value:d||"",type:h?"password":"text",onChange:(e,t)=>{const n=e.target.value;a(n,t)},showAddVariableIcon:!1}),n("div",{className:"ff-hide-value-content",children:[e(te,{onChange:e=>p(e.target.checked),name:"hideValue",label:"Hide Value",checked:h,disabled:g}),e(K,{title:"Once the value is hidden, it cannot be undone",children:e(P,{name:"info",width:12,height:12})})]})]})})},yE=({highlightText:t="",tableMeta:r=[],tableData:i=[],accordionType:o="row",noDataContent:a,height:l="100%",withFixedHeader:s=!1,headerType:d,TableAccordionStateIconWidth:u=4,TableAccordionStateIconHeight:f=8})=>{const[h,p]=c(-1),C=(e,t)=>{let n=e[t.accessor];return t.cell?t.cell({value:n,row:e,column:t.accessor}):t.accessor||n&&"object"!=typeof n?n:"--"},m=t=>{const n=t.map((t,n)=>e("table",{className:"ff-accordion-table",cellSpacing:0,children:e("tbody",{className:"ff-table-body",children:e("tr",{className:"ff-table-row",children:r.map((n,r)=>e("td",{className:"ff-table-cell",style:{width:n.width},children:"column"===o&&0===r?"":e(F,{children:C(t,n)})},n.accessor+r))},t.id||n)})},`accordion-table-${n}`));return n};return n("div",{style:{height:l},className:z("ff-accordion-table-container",{"ff-accordion-fixed-header-table":s}),children:[e("table",{cellSpacing:0,className:z("ff-accordion-table",{"ff-accordion-fixed-header":s}),children:e("thead",{children:e("tr",{className:"ff-table-row",children:r.map(t=>e("th",{style:{width:t.width},className:z("ff-table-header",d&&`ff-accordion-table--${d}-bg`),children:e("div",{children:e(F,{fontWeight:"semi-bold",fontSize:12,children:t.header})})},`header-${t.header}`))})})}),"row"===o&&i.map((n,r)=>e($,{highlightText:t,headerTitle:n.title,color:"var(--text-color)",accordionContent:m(n.data),disable:n.disable,disableInfoMessage:n.disableInfoMessage,accordionStateIconName:"arrows_down_icon",AccordionStateIconWidth:u,AccordionStateIconHeight:f},`accordion-row-${r}`)),"column"===o&&i.map((i,o)=>n("div",{className:"column-table-accordion",children:[e("div",{className:"ff-display-flex",children:e(K,{title:i.disable?i?.disableInfoMessage:"string"==typeof i.title&&oe(i.title,r[0]?.width,"pixel")?i.title:"",placement:"bottom-start",children:n("div",{className:`accordion-header ${i.disable&&"accordion-header--disabled"}`,children:[e("div",{className:"header-title",children:e("span",{children:e(F,{children:e(J,{text:ie(i.title,r[0]?.width,"pixel"),highlight:t})})})}),e("div",{className:"accordion-arrow",onClick:()=>{!i.disable&&(e=>{p(e===h?-1:e)})(o)},children:e(P,{name:h===o?"arrows_down_icon":"arrows_right_icon",color:"var(--table-with-accordion-icon-color)",width:u,height:f,hoverEffect:!1})})]})})}),h===o&&e("div",{children:m(i.data)})]},`column-accordion-${o}`)),i.length<=0&&e("div",{className:"no-data-content",style:{height:`calc(${l} - 50px)`},children:a})]})},wE=({progressPercentage:t,totalMemory:r,usedMemory:i,color:o="var(--brand-color)",trackColor:a="#f0f0f0",height:l=10,label:s,labelFontSize:c=12,labelTextColor:d="var(--ff-card-status-text-color)",showPercentage:u=!1,percentageFontSize:f=10,percentageTextColor:h="var(--tooltip-text-color)",progressBarWidth:p="200px"})=>{const C=e=>{const t=e.trim().toLowerCase();if("0"===t)return 0;const n=t.match(/^(\d+(?:\.\d+)?)\s*(kb|mb|gb)$/);if(!n||!n[1])return 0;const r=parseFloat(n[1]),i=n[2];return"gb"===i?1024*r:"kb"===i?r/1024:r};let m=0,g=s;if(void 0!==r&&void 0!==i){const e=C(i),t=C(r);t>0?(m=e/t*100,g=s||i):(m=0,g="0MB")}else m=t||0;const v=Math.max(0,Math.min(m,100));return n("div",{className:"ff-progress-bar-container "+(g?"ff-has-label":""),style:{width:p},children:[e("div",{className:"ff-progress-bar-track",style:{backgroundColor:a,height:`${l}px`},children:e("div",{className:"ff-progress-bar",style:{width:`${v}%`,backgroundColor:o,height:`${l}px`},children:u&&e(F,{className:"ff-progress-bar-percentage",fontSize:f,color:h,children:`${Math.round(v)}%`})})}),g&&e("div",{className:"ff-progress-bar-label",children:e(F,{fontSize:c,color:d,children:e(K,{title:oe(g,10,"count")?g:"",children:ie(g,10,"count")})})})]})},bE=({variant:t="primary",size:n="small",onClick:r,label:i="Choose File",disabled:o=!1,type:l="button",className:s="",style:d={},iconName:f,isChooseFile:h=!1,buttonWidth:p="auto",buttonHeight:C="auto",selectedFile:m={},handleCloseIcon:g,isMandatory:v=!1})=>{const y=a(null),[w,b]=c(0);u(()=>{y.current&&b(y.current.getBoundingClientRect().width-10)},[p]);const E=m?.name||i,M=w?ie(E,w,"pixel"):E,A=!!w&&oe(E,w,"pixel");return e("div",{ref:y,style:{width:p},children:e(K,{title:A?E:"",children:e(U,{variant:t,label:M,type:l,onClick:r,buttonWidth:p,buttonHeight:C,isChooseFile:h,size:n,disabled:o,className:s,iconName:f,style:d,iconPosition:"right",selectedFile:m,handleCloseIcon:g,isMandatory:v})})})},EE=({selected:t="text",handleClick:r,tabList:i})=>{const o=i?.includes("Automation"),a=i?.includes("Manual");return n("div",{className:"ff-script-switch-container",children:[e(K,{title:o?"Automation":"Add Automation",zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Automation"===t?"active":""),onClick:()=>r(o?"Automation":"Add Automation"),children:e(P,{name:o?"automation_testcase":"add_testcase",color:"Automation"===t?"var(--primary-button-text-color)":"var(--description-text)"})})}),e(K,{title:a?"Manual":"Add Manual",zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Manual"===t?"active":""),onClick:()=>r(a?"Manual":"Add Manual"),children:e(P,{name:a?"manual_testcase":"add_testcase",color:"Manual"===t?"var(--primary-button-text-color)":"var(--description-text)"})})})]})},ME=({selected:t,handleClick:n,tabList:r})=>e("div",{className:"ff-switch-container",children:r.map(r=>e(K,{title:t===r.name?null:r.tooltip,zIndex:1e3,children:e("div",{className:"ff-switch-button "+(t===r.name?"active":""),onClick:()=>n(r.name),children:e(P,{name:r.icon,color:t===r.name?"var(--primary-button-text-color)":"var(--description-text)"})})},r.name))}),AE=({onModalClose:t,MediaSrc:r,fileName:o,onDeleteClick:a,mediaType:s,fileId:d,thumbnailMediaSrc:u,isDelete:f=!0,onExpandClick:h,onDownloadClick:p,isMediaIcon:C=!1,previewOnly:m=!1,iconName:g="video_preview",isDisabled:v=!1})=>{const[y,w]=c(!1),b=i.useRef(null),E=()=>{w(!0),h&&h(d)},M=()=>{t?.(),w(!1)},A=()=>{p&&p(d)};return l(()=>{m&&w(!0)},[m]),n("div",{children:[!m&&(C?e(P,{name:g,hoverEffect:!0,onClick:E,disabled:v}):e(kv,{mediaSrc:r,mediaType:s,onDownloadClick:A,onDeleteClick:()=>a?.(r),onExpandClick:E,fileName:o,fileId:d,thumbnailMediaSrc:u,isDelete:f})),y&&e(th,{isOpen:y,onClose:M,isFooterDisplayed:!1,isHeaderDisplayed:!1,customWidth:"1130px",customHeight:"570px",zIndex:1e4,children:n("div",{className:"media-wrapper",children:[n("div",{className:"ff-expand-icons",children:[e(K,{title:"Download File",children:e(P,{name:"download_file_icon",onClick:A,color:"var(--icons-default-color)",className:"header-icons"})}),e(K,{title:"Expand",children:e(P,{name:"expand",onClick:E,color:"var(--icons-default-color)",className:"header-icons"})}),e(K,{title:"close",children:e(P,{name:"close",onClick:M,color:"var(--icons-default-color)",className:"header-icons"})})]}),"image"===s&&e("img",{src:r,alt:"fileName",height:"auto"}),"video"===s&&e("video",{src:r,controls:!0,controlsList:"nodownload",className:"ff-video-preview",ref:b,onCanPlay:()=>{if(b.current){const e=b.current.play();void 0!==e&&e.catch(e=>{console.error("Autoplay failed:",e)})}}})]})})]})},xE=({children:t,orientation:r="",navBarIcons:o=[],mobileHeight:a=448,mobileWidth:l=220,UtilityBar:s,tooltip:c={},background:d,navBarPosition:u="bottom"})=>{const f="portrait"===r,h=f?a:l,p=f?l:a,C=s&&"top"===u,m=s&&"bottom"===u,g=s&&"left"===u;return n("div",{className:["ff-mobileskin-wrapper",f?"portrait":"landscape",g?"ff-side-nav-left":"",C?"navbar-top":"",m?"navbar-bottom":""].filter(Boolean).join(" "),children:[C&&e("div",{className:"ff-nav-bar top-nav-bar",children:o.map(({title:t,name:n,className:r,...i},a)=>{const l=c?.[n]??a;return e(K,{title:c?.[n]||"",placement:"top",children:e("div",{className:`ff-nav-bar-icon ${r||""} ${a===o.length-1?"last-icon":""} ${C?"navbar-top":""}`,children:e(P,{name:n,...i})})},l)})}),e("div",{className:"ff-mobileskin-container",style:{height:h+16,width:p+16},children:e("div",{className:"ff-mobile-container",style:{width:p,height:h,background:d||"transparent"},children:e("div",{className:"ff-mobile-image-container",children:i.isValidElement(t)?t:e("img",{src:t,alt:"Mobile content",style:{width:f?"100%":2.1*l+"px",height:f?"100%":.5*a+"px"}})})})}),s&&m&&e("div",{className:"ff-nav-bar",children:o?.map((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-nav-bar-icon ${t?.className||""} ${n===o.length-1?"last-icon":""}`,children:e(K,{title:r,children:e(P,{...i})})},n)})}),s&&g&&e("div",{className:"ff-side-nav-bar",children:o?.map((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-sidebar ${t?.className||""} ${n===o.length-1?"last-icon":""}`,children:e(K,{title:r,placement:"bottom",children:e(P,{...i})})},n)})})]})},LE=o(({width:t=300,height:r=40,iconHeight:i=16,iconWidth:o=16,placeholder:l="Enter text",iconName:s="right_arrow_filled_icon",iconPosition:c="left",borderRadius:d=4,autoFocus:u=!1,value:f="",iconColor:h="var(--brand-color)",tooltipTitle:p="send",submitPrompt:C,onPromptChange:m,onBlur:g,onFocus:v,disableInput:y,isAdditionalIcon:w=!1,additionalIconName:b,additionIconToolTip:E,onAdditionalIconClick:M},A)=>{const x=a(null);ce([{key:"Enter",action:()=>L()}],x);const L=e=>{f&&C?.(f.trim())};return n("div",{className:z("ff-prompt-container",{"icon-left":"left"===c,"icon-right":"left"!==c}),style:{width:`${t}px`,height:`${r}px`,borderRadius:d},ref:x,children:[e(K,{placement:"top",title:p,children:e(P,{name:s,className:"ff-prompt-icon",height:i,width:o,onClick:C,color:h,disabled:G(f)})}),e("input",{ref:A,className:"ff-prompt-input",type:"text",placeholder:l,autoFocus:u,onChange:m,onFocus:v,onBlur:g,value:f,readOnly:y}),w&&b&&e(K,{placement:"top",title:E,children:e(P,{name:b,className:"ff-prompt-icon additional-icon",height:i,width:o,onClick:M})})]})}),kE=({content:t,isVisible:n,maxWidth:r=300,onClick:i,isClickable:o=!0,arrowPosition:a="left"})=>e("div",{onClick:i,style:{width:`${r}px`,"--triangle-position":r-4+"px"},className:z("ff-chat-msg-box",{visible:n,hidden:!n,pointer:o,default:!o,"chat-arrow-left":"left"===a,"chat-arrow-right":"left"!==a}),children:e("div",{className:z("content",`arrow-${a}`),children:e(F,{children:t})})}),HE=({iconName:r,iconPosition:{top:i,left:o,bottom:a,right:l},hoverIconPosition:{top:s,left:d,bottom:u,right:f},modalPosition:{top:h,left:p,bottom:C,right:m},modalWidth:g,modalHeight:v,headerContent:y="Header Content",footerContent:w="Footer Content",iconWidth:b,iconHeight:E,modalHeading:M="Ask Fia",children:x,onClearChat:L})=>{const[k,H]=c(!1),[S,_]=c(!1);return n(t,{children:[n("div",{style:{top:void 0!==i?`${i}px`:void 0,left:void 0!==o?`${o}px`:void 0,bottom:void 0!==a?`${a}px`:void 0,right:void 0!==l?`${l}px`:void 0},className:"ff-dynamic-icon-container",children:[e(P,{className:"ff-dynamic-icon",name:r,onClick:()=>{_(e=>!e),setTimeout(()=>H(e=>!e),10)},height:E,width:b}),e("div",{style:{top:void 0!==s?`${s}px`:void 0,left:void 0!==d?`${d}px`:void 0,bottom:void 0!==u?`${u}px`:void 0,right:void 0!==f?`${f}px`:void 0},className:"ff-chat-icon-hover",children:e(P,{name:"ask_fia_icon",height:32,width:82})})]}),S&&A(e("div",{className:z("ff-dynamic-modal",{open:k}),style:{top:void 0!==h?`${h}px`:void 0,left:void 0!==p?`${p}px`:void 0,bottom:void 0!==C?`${C}px`:void 0,right:void 0!==m?`${m}px`:void 0,position:"fixed",height:v,width:g},children:n("div",{className:"ff-dynamic-modal-content",children:[y&&e("div",{className:"ff-dynamic-modal-header",children:n("div",{className:"header-container",children:[n("div",{className:"header-left",children:[e(P,{height:16,width:16,name:"fia_icon"}),e(F,{fontWeight:"medium",children:M})]}),n("div",{className:"header-right",children:[e("span",{className:"action",children:e(K,{title:"Clear chat",placement:"bottom",children:e(P,{height:16,width:16,name:"delete",color:"var(--tooltip-text-color)",onClick:L})})}),e("span",{className:"action",children:e(K,{title:"Close",placement:"bottom",children:e(P,{height:16,width:16,name:"close",color:"var(--tooltip-text-color)",onClick:()=>(H(!1),void setTimeout(()=>_(!1),300))})})})]})]})}),e("div",{className:"ff-dynamic-modal-body",children:x}),w&&e("div",{className:"ff-dynamic-modal-footer",children:w})]})}),document.body)]})},SE=o(({iconName:r,hoverTitle:i,iconPosition:{top:o,left:s,bottom:d,right:u},hoverIconPosition:{top:f,left:h,bottom:p,right:C},modalPosition:{top:m,left:g,bottom:v,right:y},modalWidth:w,modalHeight:E,headerContent:M="Header Content",footerContent:x="Footer Content",iconWidth:L,iconHeight:k,children:H,onVisibilityChange:S},_)=>{const[V,O]=c(!1),[N,T]=c(!1),I=a(null),D=()=>{I.current&&clearTimeout(I.current),O(!1),I.current=setTimeout(()=>{T(!1),S?.(!1)},300)};return b(_,()=>({closeModal:D})),l(()=>()=>{I.current&&clearTimeout(I.current)},[]),n(t,{children:[n("div",{style:{top:void 0!==o?`${o}px`:void 0,left:void 0!==s?`${s}px`:void 0,bottom:void 0!==d?`${d}px`:void 0,right:void 0!==u?`${u}px`:void 0},className:"ff-ai-dynamic-icon-container",children:[e(P,{className:"ff-ai-dynamic-icon",name:r,onClick:()=>{I.current&&clearTimeout(I.current),T(e=>!e),S?.(!N),I.current=setTimeout(()=>O(e=>!e),10)},height:k,width:L}),e("div",{style:{top:void 0!==f?`${f}px`:void 0,left:void 0!==h?`${h}px`:void 0,bottom:void 0!==p?`${p}px`:void 0,right:void 0!==C?`${C}px`:void 0},className:"ff-ai-chat-icon-hover",children:e("div",{className:"ai-hover-leaf",children:e(F,{fontWeight:"bold",fontSize:14,color:"var(--chatbot-leaf-text)",children:i})})})]}),N&&A(e("div",{className:z("ff-ai-dynamic-modal",{open:V}),style:{top:void 0!==m?`${m}px`:void 0,left:void 0!==g?`${g}px`:void 0,bottom:void 0!==v?`${v}px`:void 0,right:void 0!==y?`${y}px`:void 0,position:"fixed",height:E,width:w},children:n("div",{className:"ff-ai-dynamic-modal-content",children:[M&&e("div",{className:"ff-ai-dynamic-modal-header",children:M}),e("div",{className:"ff-ai-dynamic-modal-body",children:H}),x&&e("div",{className:"ff-ai-dynamic-modal-footer",children:x})]})}),document.body)]})}),_E=({variant:t,title:r,tabTitle:i,comment:o,profileShortName:a})=>n("div",{className:"ff-history-card",children:[e("div",{className:z("header",`header--${t}`),children:e(F,{fontWeight:"semi-bold",children:i})}),n("div",{className:"body",children:[e("div",{className:"title",children:n("div",{className:"profile",children:[e(F,{className:z("avatar",`avatar--${t}`),children:a}),e(F,{children:r})]})}),n("div",{className:"comment-container",children:[e(F,{fontWeight:"semi-bold",className:"heading",children:"Comments:"}),e(F,{color:"var(--details-page-value-color)",className:"comment",children:o})]})]})]}),VE=({onChange:t,disabled:r,checked:i=!1,id:o="toggle",path:a})=>n("div",{className:"ff--ai-switch-container",children:[e("input",{className:"ff--ai-switch-checkbox",id:`ff-toggle-${o}`,type:"checkbox",disabled:!!r,onChange:e=>{t&&t(e)},checked:i}),e("label",{className:z("ff--ai-switch-label",{"ff--ai-switch-label--disabled":r}),htmlFor:`ff-toggle-${o}`,children:e("span",{className:"ff--ai-switch-content",children:n("span",{className:"ff--ai-switch-content",children:[e(F,{className:z("ff--ai-switch-typography",{left:i,right:!i}),as:"div",fontWeight:"bold",fontSize:18,color:i?"var(--base-bg-color)":"var(--ff-ai-toggle-text-color)",children:"AI"}),e("img",{className:"ff--ai-switch-image",src:a,alt:"AI image"})]})})})]}),OE=o(({name:t,height:n=30,width:r=30,path:i="",onClick:o,color:s="var(--brand-color)",hoverEffect:c=!1,className:d="",disabled:u=!1,variant:f="light",isSelected:h=!1,x:p,y:C,tabIndex:m=-1,...g},v)=>{if(!B[t])return null;const y=a(null);l(()=>{y.current&&(void 0!==p&&y.current.setAttribute("x",String(p)),void 0!==C&&y.current.setAttribute("y",String(C)))},[p,C]);const w={ref:v,onClick:u?void 0:o,style:{height:`${n}px`,width:`${r}px`,cursor:u?"not-allowed":"pointer",opacity:u?.3:1},tabIndex:m,...g};return e("span",{...w,children:e("img",{height:n,width:r,src:i,alt:""})})}),zE=({id:r=0,serialNumber:i,activeId:o,setActiveId:s,children:d,onIconClick:u,numberChildren:f,onContainerClick:h,onNextClick:p,onPreviousClick:C,disabled:m,isEditAccess:g,versionsLength:v,count:y,hiddenActions:w=[]})=>{const[b,E]=c(!1),[M,A]=c(!1),x=a(null),L=Array.isArray(w)?w:w?[w]:[],k=(e,t)=>{e.stopPropagation(),t()};l(()=>{x.current&&(()=>{if(x.current){const e=getComputedStyle(x.current),t=1.2*parseFloat(e.fontSize)*6;x.current.scrollHeight>t&&A(!0)}})()},[]);const H=e=>{e.stopPropagation(),E(!b)};return n("div",{className:`ff-prompt-container-Block ${o===r?"active":"inactive"} `,onClick:()=>{s(r),h()},children:[e(F,{fontSize:8,className:"ff-prompt-number-bg-color",as:"span",children:`Test cases ${i}`}),n(t,{children:[n("div",{className:"ff-prompt-content "+(b?"expanded":""),ref:x,children:[d,b&&n(t,{children:[e("span",{role:"button","aria-label":"toggleExpand",onClick:H,className:"read-less-btn",children:e(F,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read Less"})})," "]})]}),M&&!b&&e("div",{role:"button","aria-label":"toggleExpand",onClick:H,className:"read-more-btn",children:e(F,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read More"})})]}),n("div",{className:"ff-prompt-icons",children:[e("div",{className:"ff-prompt-icons-leftside",children:[{action:"delete",title:"Delete",color:"var(--ff-delete-button-attachment)"},{action:"edit",title:"Edit",color:"var(--label-edit-text-label-color)"},{action:"regenerate",title:"Regenerate",color:"var(--label-edit-text-label-color)"}].filter(e=>!L.includes(e.action)).map((t,n)=>{const r=g&&"delete"===t?.action||"regenerate"===t?.action&&(v??0)>=3||m;return e(K,{title:t.title,placement:"bottom",children:e(P,{disabled:r,name:t.action,color:t.color,hoverEffect:!0,onClick:e=>((e,t)=>{e.stopPropagation(),u(t)})(e,t.action)})},`${t?.title}-${n}`)})}),n("div",{className:"ff-prompt-icons-rightside",children:[e(P,{disabled:1===y,className:"ff-prompt-icons-style",name:"arrow_left_accordian",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>k(e,C),cursorType:"pointer"}),f,e(P,{disabled:y===v,className:"ff-prompt-icons-style",name:"arrow_right_icon",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>k(e,p),cursorType:"pointer"})]})]})]})},NE=o(({type:t="text",variant:r="primary",name:i="",label:o,disabled:a=!1,disableLinkIcon:l=!1,required:s=!1,placeholder:c="Attach Link",value:d,error:u,helperText:f,noBorder:h,className:p="",onChange:C,onBlur:m,onFocus:g,autoComplete:v="off",autoFocus:y=!1,minValue:w=-1/0,maxValue:b=1/0,transparentBackground:E=!1,size:M="small",isLabelRequired:A=!0,onClick:x,onKeyUp:L,isViewMode:k=!1,...H},S)=>{const _=!G(d);return n("fieldset",{className:z("ff-link-input-fieldset",{"ff-link-input-fieldset--disabled":a}),children:[n("div",{className:z("ff-link-input-container",{"ff-link-input-container--float":_,"ff-link-input-container--disabled":!!a}),children:[A&&n("label",{className:z(`ff-link-input-label-container ff-link-input-label-container--${M}`,{"ff-link-input-label-container--danger":!!u}),htmlFor:i,children:[s&&e("span",{className:"required-asterisk",children:"*"}),e("span",{className:z(`ff-link-input-label ff-link-input-label--${r}`,{"ff-link-input-label--no-hover":!!d,"ff-link-input-label--disabled":!!a,"ff-link-input-label--danger":!!u}),children:o})]}),e("input",{ref:S,name:i,value:d,type:t,spellCheck:!1,id:i,className:z(`ff-link-input ff-link-input-${r} default-input ff-link-input--${M}`,{"ff-link-input--transparentBackground":!!E,"ff-link-input--no-hover":!!d,"ff-link-input--disabled":!!a,"ff-link-input--danger":!!u,"ff-link-input--no-border":!!h,"ff-link-input--placeholder":!A},`${p}`),placeholder:c,disabled:k||a,onChange:C,onFocus:g,onBlur:m,autoComplete:v,autoFocus:y,min:w,max:b,onClick:x,onKeyUp:L,...H}),e("div",{className:"input-link-icon",children:l||u||!_?e(P,{name:"link",disabled:!0}):e(K,{title:"Click here to navigate",children:e("span",{children:e(P,{name:"link",disabled:!1,onClick:()=>{d&&!u&&window.open(d,"_blank")}})})})})]}),f&&u&&e("span",{className:z("ff-link-input-message",{"ff-link-input-message--danger":!!u}),children:f})]})}),TE=({labelsList:r=[],height:i=""})=>{const o=e("div",{className:"ff-chip-tooltip",children:r.filter((e,t)=>t>0).map((t,n)=>e(F,{as:"div",className:"ff-chip-tooltip-label",children:t},`label-${n}-${t}`))});return e(t,{children:!G(r)&&n("div",{className:"ff-chip-with-count-container",children:[e(K,{title:r[0],children:e(F,{as:"div",children:ie(r[0]||"",10),className:"ff-chip-label",fontWeight:"medium",style:i?{height:i}:void 0})}),r.length>1&&e(K,{title:e(F,{as:"div",children:o}),children:e(F,{as:"div",children:"+"+(r.length-1),className:"ff-chip-count",fontWeight:"medium"})})]})})};class IE extends E{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error("ErrorBoundary caught an error:",e,t)}render(){return this.state.hasError?this.props.fallback:this.props.children}}const DE=({iconName:t="",onButtonClick:r,buttonLabel:i="Label",buttonText:o="To Add Group",disableButton:a=!1,stepCount:l=1,iconWidth:s=120,iconHeight:c=120,addContentLabel:d="step"})=>n("div",{className:"add-content-button "+(a?"disabled":""),children:[!G(t)&&e("div",{className:"icon-container",children:e(P,{name:t,width:s,height:c})}),n("div",{className:"typography-label-button",children:[n(F,{fontSize:"12px",fontWeight:"regular",lineHeight:"18px",children:[d+l," :"]}),e(F,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:"Click"}),e(eh,{label:i,onClick:r,iconName:"plus_user_icon",isDisable:a}),e(F,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:o})]})]}),ZE=({variant:t="default",tabsData:r,activeTabId:i,onTabClick:o,noBorder:a=!1,noPadding:l=!1,titleSize:s="12px"})=>{const[d,u]=c(0);return n("div",{className:"ff-tabs-slider-container",children:[n("div",{className:z(`ff-tab-row--${t} ff-tab-row-section`,{"ff-tab-row--no-border":a,"ff-tab-row--no-padding":l,"ff-tab-row--position":r.length>4}),children:[r.length>4&&e(P,{className:"ff-tab-icon ff-tab-icon--previous",name:""+(d?"arrow_left_accordian":""),onClick:()=>{d>0&&u(e=>e-1)},hoverEffect:!0}),e("div",{className:"ff-tab-row-carousel",children:e("div",{className:"carousel_inner",style:{transform:`translateX(-${100*d}%)`},children:r.map(r=>n("button",{onClick:()=>!r.disabled&&o(r.id),disabled:r.disabled,className:z(`ff-tab-button--${t}`,{disabled:r.disabled,active:i===r.id}),style:{flex:"0 0 25%"},children:[n("div",{className:"label-count-section",children:[e(K,{title:r.label.length>9?r.label:"",children:e(F,{children:r.label.length>9?r.label.slice(0,9)+"...":r.label,fontSize:s,lineHeight:"18px",fontWeight:i===r.id?"semi-bold":"regular",color:i===r.id?"var(--tabs-label-active-color)":"var(--tabs-label-default-color)",className:z("ff-tab-label",{"ff-tab-label--active":i===r.id})})}),"default"===t&&r.count&&e("span",{className:z("tab-count",{"tab-count--active":i===r.id}),children:r.count})]}),e("div",{className:z("ff-tab-bar",{"ff-tab-bar--active":i===r.id})}),e("span",{className:"ff-defaultStatus "+("success"===r.status?"ff-successStatus":"error"===r.status?"ff-dangerStatus":"")})]},r.id))})}),r.length>4&&e(P,{className:"ff-tab-icon ff-tab-icon--next",name:""+(d<Math.ceil(r.length/4)-1?"arrow_right_icon":""),onClick:()=>{d<Math.ceil(r.length/4)-1&&u(e=>e+1)},hoverEffect:!0})]}),e("div",{className:"ff-tab-content",children:r.find(e=>e.id===i)?.component})]})},jE=o(({label:t="Status",iconName:r="update_icon",onClick:i,isDisable:o=!1,variant:a="default",backgroundColor:l=!1,border:s=!1},c)=>{const d={default:"var(--ff-avatar-background-color)",success:"var(--status-success-text-color)",danger:"var(--ff-delete-button-attachment)"};return e("button",{disabled:o,onClick:i,className:`\n ff-status-indicator\n ff-status-indicator--${a}\n ${l?`ff-status-indicator--with-bg ff-status-indicator--${a}-bg`:""}\n ${s?`ff-status-indicator--with-border ff-status-indicator--${a}-border`:""}\n `,ref:c,children:n("div",{className:"ff-status-indicator__content",children:[e(P,{name:"danger"===a?"close":r,color:d[a]||d.default,className:`ff-status-indicator__icon ff-status-indicator__icon--${a}`}),e(F,{as:"div",fontSize:12,className:`ff-status-indicator__label ff-status-indicator__label--${a}`,fontWeight:"medium",lineHeight:"20px",children:t})]})})}),RE=({rootLabel:t,childrenLabels:r,align:i="center",direction:o="horizontal"})=>{const a=r.length;return n("div","vertical"===o?{className:"ff-os-tree-vertical",style:{"--child-count":a},children:[n("div",{className:`ff-os-tree-vertical__row ff-os-tree-vertical__row--${i}`,children:[e("div",{className:"ff-os-tree-vertical__root-label",children:t}),e("div",{className:"ff-os-tree-vertical__horizontal-line"})]}),n("div",{className:"ff-os-tree-vertical__vertical-line-wrapper",children:[e("div",{className:"ff-os-tree-vertical__vertical-line"}),r.map((t,r)=>n("div",{className:"ff-os-tree-vertical__child",children:[e("div",{className:"ff-os-tree-vertical__child-connector"}),e("div",{className:"ff-os-tree-vertical__child-label",children:t})]},r))]})]}:{className:`ff-os-tree ff-os-tree--${i}`,style:{"--child-count":a},children:[n("div",{className:"ff-os-tree__root-wrapper",children:[e("div",{className:"ff-os-tree__root-label",children:t}),e("div",{className:"ff-os-tree__vertical-root"})]}),e("div",{className:"ff-os-tree__horizontal-connector",children:r.map((t,n)=>e("div",{className:"ff-os-tree__vertical-child"},n))}),e("div",{className:"ff-os-tree__children",children:r.map((t,n)=>e("div",{className:"ff-os-tree__child-container",children:e("div",{className:"ff-os-tree__child-label",children:t})},n))})]})},BE=({handleClose:t,handleResend:r,handleOtp:i,resendTimeout:o=30})=>{const[s,d]=c(Array(6).fill("")),[u,f]=c(o),[h,p]=c(!0),C=a(Array(6).fill(null));l(()=>{h||C.current[0]?.focus()},[h]),l(()=>{let e;return u>0&&(e=window.setInterval(()=>f(e=>e-1),1e3)),0===u&&p(!1),()=>clearInterval(e)},[u]);const m=e=>{e.preventDefault();const t=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,6),n=Array(6).fill("");t.split("").forEach((e,t)=>{n[t]=e}),d(n);const r=Math.min(t.length,5);C.current[r]?.focus()};return e(th,{isOpen:!0,onClose:t,isFooterDisplayed:!1,isHeaderDisplayed:!1,zIndex:999999,customWidth:"340px",children:n("div",{className:"ff-otp-popup",children:[n("div",{className:"ff-otp-header",children:[e(F,{fontSize:24,lineHeight:"36px",fontWeight:"semi-bold",children:"OTP Verification"}),e(P,{name:"close",height:16,width:16,onClick:t,className:"ff-close-icon"})]}),e("div",{className:"ff-otp-boxes",children:s.map((t,n)=>e("input",{type:"text",maxLength:1,className:`ff-otp-input ${t?"filled":""} ${n===s.findIndex(e=>""===e)?"active":""}`,value:t,onKeyDown:e=>((e,t)=>{const{key:n}=e;if(/^[0-9]$/.test(n)){e.preventDefault();const r=[...s];r[t]=n,d(r),t<5&&C.current[t+1]?.focus()}else if("Backspace"===n){e.preventDefault();const n=[...s];n[t]="",d(n),t>0&&C.current[t-1]?.focus()}})(e,n),onPaste:m,ref:e=>C.current[n]=e,readOnly:!0},n))}),e(U,{variant:"primary",label:"Submit",onClick:()=>i(s.join("")),disabled:s.includes(""),className:"ff-submit-btn"}),n("div",{className:"ff-resend "+(h?"disabled":""),onClick:h?void 0:()=>{f(o),p(!0),d(Array(6).fill("")),r()},children:["Re-send OTP",u>0?` (${u}s)`:""]})]})})},PE=({isOpen:t,onClose:r,isPlaying:i,onTogglePlay:o,mediaType:s,src:d,headerTitle:u,onDownload:f,onExpand:h,showHeader:C=!0,showDownload:m=!0,showExpand:g=!0,width:v="800px",height:y="432px",showControls:w=!0,customStyle:b,overlay:E=!0,children:M,showControlDownload:A=!1,showControlExpand:x=!1,isFullscreen:L=!1})=>{const k=a(null),H=a(null),[S,_]=c(0),[V,O]=c(0),[z,N]=c(!1),[T,I]=c(0);l(()=>{"video"===s&&k.current&&!M&&(i?k.current.play():k.current.pause())},[i,s,M]);const D=p(()=>{if(k.current&&!z){const e=k.current.currentTime/k.current.duration*100;I(e||0),_(k.current.currentTime)}},[z]),Z=p(()=>{k.current&&O(k.current.duration)},[]),j=p(()=>{_(0),I(0),o?.()},[o]),R=p(e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`,[]),B=p(e=>{if(k.current){const t=e/100*k.current.duration;k.current.currentTime=t,I(e),_(t)}},[]),U=p(e=>{if(z||!H.current)return;const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[B,z]),q=p(e=>{if(!H.current)return;N(!0);const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[B]),W=p(e=>{if(!z||!H.current||!k.current)return;const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[z,B]),Q=p(()=>{N(!1)},[]);return l(()=>{if(z)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",Q)}},[z,W,Q]),t?e(zs,{isOpen:t,onClose:r,isMaximized:!1,showHeader:C,overlay:E,downloadHandler:()=>{},customStyle:b,header:n("div",{className:"ff-header-content",children:[e(P,{width:23,height:23,name:"automatic_locator"}),e(F,{children:e("span",{className:"ff-header-title",children:u})})]}),icons:e(K,{title:"Close",children:e(P,{name:"close",onClick:r})}),width:v,height:y,zIndex:999,children:n("div",{className:"ff-video-wrapper",children:[M||("video"===s?e("video",{ref:k,src:d,className:"ff-media-video",onTimeUpdate:D,onLoadedMetadata:Z,onEnded:j}):e("img",{src:d,alt:"Preview",className:"ff-media-image"})),n("div",{className:"ff-top-right-icons",children:[m&&e(K,{title:"Download",children:e(P,{name:"download_file",color:"white",onClick:f})}),g&&e(K,{title:L?"Minimize":"Maximize",children:e(P,{name:L?"collapse_icon":"expand_icon",color:"white",onClick:h})})]}),"video"===s&&w&&!M&&n("div",{className:"ff-media-controls",children:[e("button",{onClick:o,className:"ff-play-pause-btn",children:e(K,{title:i?"Pause":"Play",children:e(P,{width:35,height:35,name:i?"pause_button":"play_button",color:"white"})})}),n("div",{className:"ff-progress-bar",children:[e("span",{className:"ff-current-time",children:R(S)}),e("input",{type:"range",className:"ff-seek-bar",min:0,max:100,value:T,onChange:e=>B(parseFloat(e.target.value)),onClick:U,onMouseDown:q,ref:H}),e("span",{className:"ff-total-time",children:R(V)})]}),n("div",{className:"ff-control-icons",children:[A&&e(K,{title:"Download",children:e(P,{name:"download_file",color:"white",onClick:f,cursorType:"pointer"})}),x&&e(K,{title:L?"Minimize":"Maximize",children:e(P,{name:L?"collapse_icon":"expand_icon",color:"white",onClick:h,cursorType:"pointer"})})]})]})]})}):null},FE=({header:r,secondaryHeader:i,primaryCount:o,secondaryCount:a,primaryItems:l,secondaryItems:s,width:c,activeTab:d="primary",activeTabId:u,onPrimaryTabClick:f,onSecondaryTabClick:h,onTabClick:p,actions:C,tabsData:m,notchPosition:g="top-left"})=>{const v=i&&"secondary"===d?s:l,y=a&&parseInt(a)>0,w=o&&parseInt(o)>0,b=i&&(w||y),{tooltip:E="Download",iconName:M="download_file",disabled:A=!1,onClick:x,className:L=""}=C?.download||{},{tooltip:k="Delete",iconName:H="delete_icon",disabled:S=!1,onClick:_,className:V=""}=C?.delete||{},O=()=>n("div",{className:"ff-dropdown-header-icons",children:[C?.download&&e(K,{title:E,children:e(P,{name:M||"",className:`ff-dropdown-icon ff-download-icon ${L}`,onClick:x,width:18,height:20,disabled:A,hoverEffect:!0})}),C?.delete&&e(K,{title:k,children:e(P,{name:H||"",className:`ff-dropdown-icon ff-delete-icon ${V}`,onClick:_,width:25,height:25,disabled:S,hoverEffect:!0})})]});return n("div",{className:"ff-resolution-dropdown",style:c?{minWidth:c}:{},children:[e("div",{className:"ff-dropdown-notch "+("bottom-center"===g?"bottom-center":"top-left")}),e("div",{className:"ff-dropdown-header",children:e("div",{className:"ff-dropdown-header-content",children:i&&m&&u?n(t,{children:[e(qs,{tabsData:m,activeTabId:u,onTabClick:e=>{p&&p(e),"tab-1"===e&&f?f():"tab-2"===e&&h&&h()}}),b&&O()]}):i&&b?n("div",{className:"ff-dropdown-header-dual",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,children:[e(F,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),o&&e("span",{className:"ff-dropdown-count",children:o})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,children:[e(F,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),a&&e("span",{className:"ff-dropdown-count",children:a})]}),O()]}):i?n("div",{className:"ff-dropdown-header-dual",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,children:[e(F,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),o&&e("span",{className:"ff-dropdown-count",children:o})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,children:[e(F,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),a&&e("span",{className:"ff-dropdown-count",children:a})]})]}):e(F,{fontSize:16,fontWeight:"semi-bold",children:r})})}),e("ul",{className:"ff-dropdown-list",children:v?.map((t,n)=>e("li",{className:"ff-dropdown-item",children:t},n))})]})},UE=(e,t)=>"string"==typeof e?ie(e,t):i.isValidElement(e)?i.cloneElement(e,{},UE(e.props.children,t)):Array.isArray(e)?e.map(e=>UE(e,t)):e,qE=(e,t,n,r)=>{const i=e[t.accessor];if(t.cell){const o=e._id||e.id;return t.cell({value:i,row:e,column:t.accessor,index:n,tableType:r,...o&&{refId:o}})}return t.accessor||i&&"object"!=typeof i?i:"--"},WE=(t,n=[],r,i,o)=>{let a=n;const l=void 0!==i?!i:r;return G(n)&&(isNaN(t)||(a=Array(t).fill(!0))),e("div",{className:"tree-table-fn-space-container",children:a?.map((n,r)=>e("span",{className:`tree-table-fn-space-block tree-table-fn-space-block-${r} ${n?"":"no-lines"} ${l&&r===t-1?"last-node":""} ${o?"folder":""}`},r))})},QE=i.memo(({treeRowRef:r,col:i,colIndex:o,columnMeta:a,node:l,selected:s,select:c,onCheckBoxChange:d,onToggleExpand:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:p,isExpanding:C,columnTextColor:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M})=>{const A={color:`${m||"var(--ff-primary-text-color)"}`,width:a?.width??i?.width,position:a?.sticky?"sticky":void 0,left:a?.sticky?a.left:void 0,zIndex:a?.sticky?a.zIndex:void 0};return n("div",{className:`ff-table-tree-fn-td ${i.isTree&&l.container?"folder":""} ${a?.sticky?"sticky-tree-column":""}`,"data-col-index":o,style:A,children:[i.isTree&&WE(l.hierarchy,l.parentSiblings,l.lastChild,l.nextSibling,l.container),n("div",{className:"tree-fn-title-container",children:[i.isTree&&e("span",{className:`tree-table-fn-space-block last-tree-fn-block last-tree-fn-block tree-table-fn-space-block-${l.hierarchy} ${l?.expanded?"tree-fn-row-expanded":"tree-fn-row-collapsed"} ${l.container&&l.expandable?"":"no-tree-folder"}`,children:l.container&&l.expandable&&n("span",{onClick:()=>u(l),children:[" ",e(C?js:N,{})]})}),n("span",{className:"tree-table-fn-td-content "+(i.isTree&&l.container?"folder":""),children:[!l?.isNewNode&&n(t,{children:[i.isTree&&"checkbox"===c&&!(g&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:"none"===l.selectedStatus?e(K,{title:l?.currentEnvId&&l?.envId&&l?.currentEnvId!==l?.envId?"This script is assigned to another environment. Selecting it will reassign it to the current environment.":void 0,children:e(te,{checked:"completely"===l.selectedStatus,partial:"partially"===l.selectedStatus,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable,isDefaultHover:"none"===l.selectedStatus&&!!l.machine})}):e(te,{checked:"completely"===l.selectedStatus,partial:"partially"===l.selectedStatus,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable})}),i.isTree&&"radio"===c&&!(g&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:e(Ra,{name:l.key,checked:s.includes(l.key),value:l.key,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable})})]}),l.isNewNode&&i.isTree?e(Zs,{onCancel:h,onConfirm:f,value:l.value,label:l?.label,optionsList:l.options,selectedOption:l.selectedOption,withDropdown:"inputWithDropdown"===l.type,handleCustomError:p,inputFieldWidth:y,selectFieldWidth:w,confirmIconTooltip:l.confirmIconTooltip,cancelIconTooltip:l.cancelIconTooltip,isEditable:E,setIsEditable:M,isOnBlurTrue:!1,isDisable:{confirm:b},isTableTree:!0}):e("span",{className:"tree-table-fn-td-content-text",children:UE(qE(l,i),v)})]})]}),i.actions&&!l?.isNewNode&&e("div",{className:"table-tree-fn-row-action",children:i.actions(l,r)})]})});QE.displayName="TableCell";const GE=i.memo(({node:t,columnsData:n,columnMeta:r,selected:i,select:o,onRowClick:l,onToggleExpand:s,onCheckBoxChange:c,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,index:p,selectedNode:C,hideOnDisable:m,scriptLengthTruncate:g,addModuleInputWidth:v,addModuleSelectWidth:y,disableEditLabelConfirmIcon:w,isEditable:b,setIsEditable:E,style:M})=>{const A=a(null);return e("div",{"data-level":t.hierarchy,ref:A,className:"ff-table-tree-fn-row show-tree "+(C&&C===t.key?"fn-selected-node":""),onClick:e=>l(e,t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||l(e,t)},role:"button",tabIndex:0,id:0===p?"table-fn-first-row":t.key,style:M,children:n.map((n,a)=>e(QE,{treeRowRef:A,col:n,colIndex:a,node:t,selected:i,select:o,onCheckBoxChange:c,onToggleExpand:s,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,hideOnDisable:m,scriptLengthTruncate:g,addModuleInputWidth:v,addModuleSelectWidth:y,disableEditLabelConfirmIcon:w,isEditable:b,setIsEditable:E,columnMeta:r?.[a]},n.name))})});GE.displayName="TableRow";const KE=({flattenedTreeData:t,columnsData:n,columnMeta:r,rowHeight:i=32,startIndex:o=0,totalHeight:a=0,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:p,expanding:C,selectedNode:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M})=>e("div",{className:"ff-table-tree-fn-body",style:{height:`${a}px`,position:"relative"},children:t?.map((t,a)=>e(GE,{node:t,columnsData:n,columnMeta:r,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:p,isExpanding:t.key===C,index:o+a,selectedNode:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M,style:{transform:`translateY(${(o+a)*i}px)`,height:`${i}px`,position:"absolute",top:0,left:0,right:0}},t.key))}),YE=i.memo(({columnsData:t,columnMeta:r,totalWidth:i,rootNode:o,selected:s,onCheckBoxChange:d,selectedNode:u,tableHeaderBgColor:f,hideOnDisable:h,transparentHeader:p,scriptLengthTruncate:C=25,showHeader:m=!0})=>{const g=a(null),[v,y]=c(!1),[w,b]=c(!1);l(()=>{y(!0)},[]);const E=(e,t)=>{const n=r?.[e];return{width:n?.width??t,position:n?.sticky?"sticky":void 0,left:n?.sticky?n.left:void 0,zIndex:n?.sticky?n.zIndex:void 0}};return n("div",{className:"ff-table-tree-fn-head",children:[m&&e("div",{className:"ff-table-tree-fn-row no-hover",style:{minWidth:i},children:t.map(({name:t,width:n},i)=>e("div",{className:"ff-table-tree-fn-th "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:{...E(i,n),backgroundColor:p?"transparent":f,pointerEvents:p?"none":"auto"},children:t},t))}),o&&e("div",{className:"ff-table-tree-fn-row show-tree "+(u&&u===o?.node?.key?"hover":""),ref:g,onMouseEnter:e=>{e.stopPropagation(),b(!0)},onMouseLeave:e=>{e.stopPropagation(),b(!1)},children:t.map((t,i)=>e("div",{className:"ff-table-tree-fn-td "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:E(i,t.width),children:n("span",{className:"tree-table-fn-default-content",children:[0===i&&"checkbox"===o.select&&!(h&&o.node.isDisabled)&&e(te,{checked:"partially"!==o?.node?.selectedStatus&&("completely"===o?.node?.selectedStatus||!1),partial:"partially"===o.node.selectedStatus,onChange:e=>d(e,o.node),disabled:o.node.isDisabled}),0===i&&"radio"===o.select&&!(h&&o.node.isDisabled)&&e(Ra,{name:o.node.key,checked:s.includes(o.node.key),value:o.node.key,onChange:e=>d(e,o.node),disabled:o.node.isDisabled}),n("span",{className:"tree-table-fn-td-content-text",children:["name"===t.accessor?e("span",{children:o.node[t.accessor]}):e("span",{children:UE(qE(o.node,t),C)}),o.cell&&0===i&&e("span",{className:"table-tree--fn-root-cell",children:o.cell(o.node)})]}),w&&o.actions&&0===i&&v&&g.current&&e("div",{className:"table-tree-fn-row-action",children:o.actions(o.node,g)})]})},i))})]})});YE.displayName="TableHead";const XE=32,JE="__root__",$E=(e,t)=>{if(!e?.length)return[];const n=new Map,r=new Map,i=new Map,o=new Map;t&&t.key&&n.set(t.key,t),e.forEach(e=>{n.set(e.key,e);const t=e.parentId??JE;r.has(t)||(r.set(t,[]),o.set(t,{container:0,resource:0})),r.get(t)?.push(e);const i=o.get(t);i&&(e.container?i.container++:i.resource++)}),r.forEach(e=>{e.forEach((e,t)=>{i.set(e.key,t)})});const a=e=>{const t=e.parentId??JE,a=r.get(t);if(!a||0===a.length)return!1;if((i.get(e.key)??0)<a.length-1)return!0;const l=n.get(t),s=o.get(t);if(l&&s){const t=a.filter(e=>e.container).reduce((e,t)=>e+(t.totalResourceCount??0),0),n=a.filter(e=>!e.container).length,r=Math.max(0,(l.totalResourceCount??0)-(t+n));if(e.container){return s.container<(l.subContainerCount??0)||r>0}return s.resource<r}return!1},l=e=>{if(void 0!==e.selectedStatus)return e.selectedStatus;let r=e;for(;r?.parentId;){const e=n.get(r.parentId);if(!e)break;if("completely"===e.selectedStatus)return"completely";if("none"===e.selectedStatus)return"none";r=e}return"completely"===t?.selectedStatus?"completely":"none"===t?.selectedStatus?"none":e.selectedStatus};return e.map(e=>{const t=e,r=t.parentSiblings&&t.parentSiblings.length>0?t.parentSiblings:(e=>{const t=e.hierarchy??0;if(t<=0)return[];const r=[];let i=e;for(;i&&(r.unshift(i),i.parentId);){const e=n.get(i.parentId);if(!e)break;i=e}const o=r.map(e=>a(e));return o.length===t?o:o.length>t?o.slice(o.length-t):new Array(t-o.length).fill(!1).concat(o)})(e);return{...e,lastChild:!a(e),parentSiblings:r,selectedStatus:l(e)}})},eM=o(({treeData:t,columnsData:r,selected:i=[],select:o=null,onChange:s=()=>{},onClick:d=()=>{},onExpand:f=()=>{},loadMore:C=()=>{},tableBorder:m,height:g="calc(100vh - 134px)",newNode:v,onAddConfirm:y=()=>{},onAddCancel:w=()=>{},handleEditFieldError:b,loading:E=!1,rootNode:M,pagination:A=!0,selectedNode:x,tableHeaderBgColor:L="var(--border-color)",hideOnDisable:k=!1,freezeColumns:H,scriptLengthTruncate:S=25,addModuleInputWidth:_=150,addModuleSelectWidth:V,onScroll:O,onScrollEnd:z,disableEditLabelConfirmIcon:N=!1,transparentHeader:T=!1,navigateTreeNode:I=null,handleRemoveNavigateTreeNode:D=()=>{},scrollThreshold:Z=128,showHeader:j=!0},R)=>{const[B,P]=c(null),[F,U]=c(null),[q,W]=c({start:0,end:20}),[Q,K]=c(!1),Y=a(null),X=a(null),J=a(0),$=a(E),ee=a(null),te=a(null),ne=a({lastScrollTop:0}),re=a(null),ie=a(0),oe=a(null),ae=a(null),le=a(null),se=a({key:null,attempts:0}),ce=a(null),de=(e,t)=>{const n=String(e??t);return n.endsWith("%")?{value:parseFloat(n),unit:"%"}:{value:parseFloat(n)||0,unit:"px"}},ue=h(()=>{let e=0,t=0;return r.map((n,r)=>{const{value:i,unit:o}=de(n.width,400),a=!!H&&r<H,l="%"===o?`${i}%`:`${i}px`,s=`calc(${e}px + ${t}%)`;return a&&("%"===o?t+=i:e+=i),{width:l,sticky:a,left:s,zIndex:a?100+(H??0)-r:1}})},[r,H]),fe=h(()=>{let e=0,t=0;return r.forEach(n=>{const{value:r,unit:i}=de(n.width,400);"%"===i?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[r]),he=h(()=>{if(!H)return"0px";let e=0,t=0;return ue.slice(0,H).forEach(n=>{const r=parseFloat(n.width)||0;n.width.endsWith("%")?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[ue,H]),pe=h(()=>((e,t,n)=>{if(!t?.sourceId||!t.action)return e;const{sourceId:r,action:i,value:o="",error:a="",label:l,type:s,options:c,selectedOption:d,confirmIconTooltip:u,cancelIconTooltip:f,payloadSourceId:h}=t,p=t?.parentId,C=t?.hierarchy,m=c?.map(e=>({label:e,value:e})),g=d?{label:d,value:d}:void 0,v=new Map;e.forEach(e=>v.set(e.key,e)),n&&v.set(n.key,n);const y=v.get(r);let w;h&&(w=v.get(h));let b=y??("addInside"===i?w:void 0);!b&&"addInside"===i&&p&&(b=v.get(p));const E="addInside"===i&&!b&&e.length>=0;if(!b&&!E)return e;const M=[...e],A=b?e.findIndex(e=>e.key===b.key):-1;let x=null,L=0,k=A+1;switch(i){case"addAbove":{const t=b;if(!t)return e;x=t.parentId,L=t.hierarchy;break}case"addBelow":{const t=b;if(!t)return e;x=w?.parentId??t.parentId,L=w?.hierarchy??t.hierarchy;break}case"addInside":{if(E){x=p??h??r??null,L=C??1,k=M.length;break}const t=w??b;if(!t)return e;x=t.key,L=(t.hierarchy??0)+1;const n=M.findIndex(e=>e.key===r);-1!==n&&(k=n+1);break}}const H={hierarchy:L,parentId:x,sourceId:b?.key??r??h??"new-node",isNewNode:!0,key:"new-node",value:o,error:a,label:l,type:s,options:m,selectedOption:g,confirmIconTooltip:u,cancelIconTooltip:f};switch(i){case"addAbove":M.splice(A,0,H);break;case"addBelow":M.splice(A+1,0,H);break;case"addInside":M.splice(Math.max(0,k),0,H)}return M})(t,v,M?.node),[t,v,M]),Ce=h(()=>$E(pe,M?.node),[pe,M?.node]),me=h(()=>Ce.filter(e=>!e.hide),[Ce]),ge=h(()=>{const e=new Map;return Ce.forEach(t=>e.set(t.key,t)),e},[Ce]),ve=h(()=>{const e=new Map;return me.forEach((t,n)=>e.set(t.key,n)),e},[me]),ye=p(e=>{P(t=>t?e&&t!==e?t:null:t),e&&ae.current?.key!==e||(ae.current=null),le.current&&(clearTimeout(le.current),le.current=null)},[]);l(()=>{$.current=E},[E]),l(()=>{ee.current=F},[F]);const we=p(e=>{ee.current=e,U(e)},[]),be=p(()=>{const e=Y.current;if(!e)return;const t=J.current||0,n=Math.max(0,e.scrollTop-t),r=e.clientHeight-t;let i=Math.floor(n/XE)-6,o=Math.ceil((n+r)/XE)+6;i=Math.max(0,i),o=Math.min(me.length,o),W(e=>e.start===i&&e.end===o?e:{start:i,end:o})},[me.length]),Ee=p(()=>{null===te.current&&(te.current=requestAnimationFrame(()=>{te.current=null,be()}))},[be]);u(()=>{const e=Y.current;if(!e)return;const t=me.length*XE,n=Math.max(0,t-(e.clientHeight-J.current));ne.current.lastScrollTop>n&&me.length>0&&(v||I?(e.scrollTop=0,ne.current.lastScrollTop=0):B?(e.scrollTop=n,ne.current.lastScrollTop=n):ne.current.lastScrollTop-n>e.clientHeight&&(e.scrollTop=0,ne.current.lastScrollTop=0)),be()},[me.length,be,v,I,B]);const Me=p(()=>{const e=Y.current;if(!e)return;const n=e.scrollTop,r=n>ne.current.lastScrollTop?"down":"up";if(ne.current.lastScrollTop=n,Ee(),O?.(),oe.current?.(),!A||E||ee.current||G(t))return;const i=e.scrollHeight-(n+e.clientHeight)<Z,o=n<Z+J.current;"down"===r&&i&&!t[t.length-1]?.lastResource&&(we("below"),C("below")),"up"===r&&o&&!t[0]?.lastResource&&(we("above"),re.current=t[0]?.key??null,C("above"))},[t,A,E,F,Z,Ee,O,C,we]);l(()=>{if(E||!A||G(t))return;const e=t[0],n=!e?.lastResource,{totalSubContainerCount:r=0,totalResourceCount:i=0}=M?.node||{},o=r+i,a=me.length<10&&me.length<o;n&&a&&(re.current=e?.key??null,we("above"),C("above"))},[E,A,t,me.length,M,C,we]),u(()=>{if(E||"above"!==F)E||"below"!==F||we(null);else{const e=Y.current,t=re.current;if(e&&t){const n=ve.get(t);void 0!==n&&n>0&&(e.scrollTop+=n*XE)}re.current=null,we(null)}},[E,F,ve,we]),l(()=>{const e=Y.current;if(!e)return;const n=n=>{n.deltaY>=0||!A||G(t)||$.current||ee.current||e.scrollTop>1||t[0]?.lastResource||(re.current=t[0]?.key??null,we("above"),C("above"))};return e.addEventListener("wheel",n,{passive:!0}),()=>{e.removeEventListener("wheel",n)}},[A,t,C,we]),l(()=>{const e=Y.current;if(e)return oe.current=z?La(()=>{z?.()},150):null,e.addEventListener("scroll",Me,{passive:!0}),()=>{e.removeEventListener("scroll",Me),oe.current?.cancel()}},[Me,z]),l(()=>{const e=Y.current;if(!e)return;const t=e=>{Date.now()<ie.current&&e.stopImmediatePropagation()};return e.addEventListener("scroll",t,{passive:!0,capture:!0}),()=>{e.removeEventListener("scroll",t,!0)}},[]),l(()=>{const e=X.current;if(!e)return;const t=new ResizeObserver(()=>{J.current=e.getBoundingClientRect().height,be()});return t.observe(e),()=>t.disconnect()},[be]),u(()=>{if(!v||!Y.current)return;const e=Y.current,t=ve.get("new-node");if(void 0===t)return;const n=J.current||0,r=e.clientHeight-n;if(r<=0)return;const i=t*XE,o=i+XE,a=Math.max(0,e.scrollTop-n);let l=a;i<a?l=i:o>a+r&&(l=Math.max(0,o-r)),l!==a&&(ie.current=Date.now()+300,e.scrollTop=l+n,be());const s=requestAnimationFrame(()=>{K(!0)});return()=>cancelAnimationFrame(s)},[v,ve,be]),l(()=>{v||K(!1)},[v]),u(()=>{if(!B||E)return;const e=ae.current;if(!e||e.key!==B){const e=requestAnimationFrame(()=>{ye(B)});return()=>cancelAnimationFrame(e)}const t=ge.get(e.key);if(!t){const t=requestAnimationFrame(()=>{ye(e.key)});return()=>cancelAnimationFrame(t)}if(Boolean(t.expanded)!==e.expanded)return;const n=requestAnimationFrame(()=>{ye(e.key)});return()=>cancelAnimationFrame(n)},[ge,B,E,ye]),l(()=>{se.current.key!==I&&(se.current={key:I,attempts:0}),!I&&ce.current&&(clearTimeout(ce.current),ce.current=null)},[I]),u(()=>{if(!I||v)return;const e=Y.current;if(!e)return;const n=ve.get(I);if(void 0!==n){se.current={key:I,attempts:0};const t=J.current||0,r=Math.max(XE,e.clientHeight-t),i=n*XE+16,o=Math.max(0,i-r/2)+t;return ie.current=Date.now()+400,e.scrollTo({top:o,behavior:"smooth"}),Ee(),ce.current&&clearTimeout(ce.current),void(ce.current=setTimeout(()=>{D?.()},350))}if(E||F)return;const r=se.current;if(r.key!==I&&(r.key=I,r.attempts=0),r.attempts+=1,!(r.attempts>30))return A&&!0!==t[0]?.lastResource?(re.current=null,we("above"),void C("above")):void(r.attempts>2&&D?.());D?.()},[I,v,ve,E,F,A,t,C,Ee,D,we]);const Ae=p(e=>{if(B)return;const t=!e?.expanded;P(e.key),ae.current={key:e.key,expanded:t},le.current&&clearTimeout(le.current);const n=Date.now(),r=()=>{if(ae.current?.key!==e.key)return;const t=$.current,i=Date.now()-n>=2e3;!t||i?ye(e.key):le.current=setTimeout(r,1e3)};le.current=setTimeout(r,1e3),f?.(e)},[B,f,ye]),xe=p((e,t)=>{B||s?.(e,t)},[s,B]),Le=p((e,t)=>{B||d?.(e,t)},[d,B]);l(()=>()=>{null!==te.current&&(cancelAnimationFrame(te.current),te.current=null),le.current&&clearTimeout(le.current),ce.current&&clearTimeout(ce.current)},[]);const ke=me.length*XE,He=me.slice(q.start,q.end);return e("div",{className:"tree-table-wrapper-container table-tree-fn",children:e("div",{className:"tree-table-fn-wrap",ref:R,children:e("div",{className:"table-fn-scrollable "+(me.length?"":"table-fn-empty"),ref:Y,style:{"--table-height":me.length?g:"auto","--frozen-column-width":he,border:m},children:n("div",{className:"tree-table-fn",style:{width:fe},children:[e("div",{ref:X,style:{position:"sticky",top:0,zIndex:98},children:e(YE,{columnsData:r,columnMeta:ue,totalWidth:fe,rootNode:M,onCheckBoxChange:xe,selected:i,selectedNode:x,tableHeaderBgColor:L,hideOnDisable:k,transparentHeader:T,scriptLengthTruncate:S,showHeader:j})}),e(KE,{flattenedTreeData:He,columnsData:r,columnMeta:ue,totalWidth:fe,rowHeight:XE,startIndex:q.start,totalHeight:ke,selected:i,select:o,onRowClick:Le,onToggleExpand:Ae,onCheckBoxChange:xe,onAddConfirm:y,onAddCancel:w,handleEditFieldError:b,expanding:B,selectedNode:x,hideOnDisable:k,scriptLengthTruncate:S,addModuleInputWidth:_,addModuleSelectWidth:V,disableEditLabelConfirmIcon:N,isEditable:v?Q:void 0,setIsEditable:v?e=>{K(Boolean(e))}:void 0})]})})})})});function tM(e,t,n,r,i,o="children"){return function e(a){for(let l=0;l<a.length;l++){const s=a[l];if(s&&s[t]===n){const e=[...a];return"replace"===i?e[l]=r:e.splice("above"===i?l:l+1,0,r),{updatedArray:e}}if(s&&s[o]&&Array.isArray(s[o])){const t=e(s[o]);if(t)return{updatedArray:a.map((e,n)=>n===l?{...e,[o]:t.updatedArray}:e)}}}return null}(e)}eM.displayName="TableTreeFn";const nM=(e,t)=>{if(e===t)return!0;if(null==e||null==t||"object"!=typeof e||"object"!=typeof t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Array.isArray(e),r=Array.isArray(t);if(n!==r)return!1;const i=n?e:Object.keys(e),o=r?t:Object.keys(t);if(i.length!==o.length)return!1;if(n)return i.every((e,t)=>nM(e,o[t]));{const n=new Set(o);return i.every(r=>n.has(r)&&nM(e[r],t[r]))}},rM=(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every((e,n)=>{const r=t[n];return nM(e,r)}));function iM(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function oM(e,t){return e&t}function aM(e,t){return e|t}function lM(e,t){return e^t}function sM(e,t){return e&~t}function cM(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function dM(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var uM,fM="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function hM(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=fM.charAt(n>>6)+fM.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=fM.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=fM.charAt(n>>2)+fM.charAt((3&n)<<4));(3&r.length)>0;)r+="=";return r}function pM(e){var t,n="",r=0,i=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var o=fM.indexOf(e.charAt(t));o<0||(0==r?(n+=iM(o>>2),i=3&o,r=1):1==r?(n+=iM(i<<2|o>>4),i=15&o,r=2):2==r?(n+=iM(i),n+=iM(o>>2),i=3&o,r=3):(n+=iM(i<<2|o>>4),n+=iM(15&o),r=0))}return 1==r&&(n+=iM(i<<2)),n}var CM,mM=function(e){var t;if(void 0===uM){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(uM={},t=0;t<16;++t)uM[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)uM[n.charAt(t)]=t;for(t=0;t<8;++t)uM[r.charAt(t)]=-1}var i=[],o=0,a=0;for(t=0;t<e.length;++t){var l=e.charAt(t);if("="==l)break;if(-1!=(l=uM[l])){if(void 0===l)throw new Error("Illegal character at offset "+t);o|=l,++a>=2?(i[i.length]=o,o=0,a=0):o<<=4}}if(a)throw new Error("Hex encoding incomplete: 4 bits missing");return i},gM={decode:function(e){var t;if(void 0===CM){var n="= \f\n\r\t \u2028\u2029";for(CM=Object.create(null),t=0;t<64;++t)CM["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(CM["-"]=62,CM._=63,t=0;t<9;++t)CM[n.charAt(t)]=-1}var r=[],i=0,o=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=CM[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);i|=a,++o>=4?(r[r.length]=i>>16,r[r.length]=i>>8&255,r[r.length]=255&i,i=0,o=0):i<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=i>>10;break;case 3:r[r.length]=i>>16,r[r.length]=i>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=gM.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return gM.decode(e)}},vM=1e13,yM=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,r,i=this.buf,o=i.length;for(n=0;n<o;++n)(r=i[n]*e+t)<vM?t=0:r-=(t=0|r/vM)*vM,i[n]=r;t>0&&(i[n]=t)},e.prototype.sub=function(e){var t,n,r=this.buf,i=r.length;for(t=0;t<i;++t)(n=r[t]-e)<0?(n+=vM,e=1):e=0,r[t]=n;for(;0===r[r.length-1];)r.pop()},e.prototype.toString=function(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,n=t[t.length-1].toString(),r=t.length-2;r>=0;--r)n+=(vM+t[r]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*vM+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),wM=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,bM=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function EM(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}var MM,AM=function(){function e(t,n){this.hexDigits="0123456789ABCDEF",t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)},e.prototype.hexDump=function(e,t,n){for(var r="",i=e;i<t;++i)if(r+=this.hexByte(this.get(i)),!0!==n)switch(15&i){case 7:r+=" ";break;case 15:r+="\n";break;default:r+=" "}return r},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n="",r=e;r<t;++r)n+=String.fromCharCode(this.get(r));return n},e.prototype.parseStringUTF=function(e,t){for(var n="",r=e;r<t;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(r++)):String.fromCharCode((15&i)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return n},e.prototype.parseStringBMP=function(e,t){for(var n,r,i="",o=e;o<t;)n=this.get(o++),r=this.get(o++),i+=String.fromCharCode(n<<8|r);return i},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),i=(n?wM:bM).exec(r);return i?(n&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),r=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(r+=":"+i[5],i[6]&&(r+=":"+i[6],i[7]&&(r+="."+i[7]))),i[8]&&(r+=" UTC","Z"!=i[8]&&(r+=i[8],i[9]&&(r+=":"+i[9]))),r):"Unrecognized time: "+r},e.prototype.parseInteger=function(e,t){for(var n,r=this.get(e),i=r>127,o=i?255:0,a="";r==o&&++e<t;)r=this.get(e);if(0===(n=t-e))return i?-1:0;if(n>4){for(a=r,n<<=3;!(128&(+a^o));)a=+a<<1,--n;a="("+n+" bit)\n"}i&&(r-=256);for(var l=new yM(r),s=e+1;s<t;++s)l.mulAdd(256,this.get(s));return a+l.toString()},e.prototype.parseBitString=function(e,t,n){for(var r=this.get(e),i="("+((t-e-1<<3)-r)+" bit)\n",o="",a=e+1;a<t;++a){for(var l=this.get(a),s=a==t-1?r:0,c=7;c>=s;--c)o+=l>>c&1?"1":"0";if(o.length>n)return i+EM(o,n)}return i+o},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return EM(this.parseStringISO(e,t),n);var r=t-e,i="("+r+" byte)\n";r>(n/=2)&&(t=e+n);for(var o=e;o<t;++o)i+=this.hexByte(this.get(o));return r>n&&(i+="…"),i},e.prototype.parseOID=function(e,t,n){for(var r="",i=new yM,o=0,a=e;a<t;++a){var l=this.get(a);if(i.mulAdd(128,127&l),o+=7,!(128&l)){if(""===r)if((i=i.simplify())instanceof yM)i.sub(80),r="2."+i.toString();else{var s=i<80?i<40?0:1:2;r=s+"."+(i-40*s)}else r+="."+i.toString();if(r.length>n)return EM(r,n);i=new yM,o=0}}return o>0&&(r+=".incomplete"),r},e}(),xM=function(){function e(e,t,n,r,i){if(!(r instanceof LM))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=n,this.tag=r,this.sub=i}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+n,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return EM(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return EM(this.stream.parseStringISO(t,t+n),e);case 30:return EM(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,23==this.tag.tagNumber)}return null},e.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},e.prototype.toPrettyString=function(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var n=0,r=this.sub.length;n<r;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=127&t;if(n==t)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===n)return null;t=0;for(var r=0;r<n;++r)t=256*t+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=2*this.header,n=2*this.length;return e.substring(t,t+n)},e.decode=function(t){var n;n=t instanceof AM?t:new AM(t,0);var r=new AM(n),i=new LM(n),o=e.decodeLength(n),a=n.pos,l=a-r.pos,s=null,c=function(){var t=[];if(null!==o){for(var r=a+o;n.pos<r;)t[t.length]=e.decode(n);if(n.pos!=r)throw new Error("Content size is not correct for container starting at offset "+a)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}o=a-n.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return t};if(i.tagConstructed)s=c();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");s=c();for(var d=0;d<s.length;++d)if(s[d].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){s=null}if(null===s){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+a);n.pos=a+Math.abs(o)}return new e(r,l,o,i,s)},e}(),LM=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(32&t),this.tagNumber=31&t,31==this.tagNumber){var n=new yM;do{t=e.get(),n.mulAdd(128,127&t)}while(128&t);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return 0===this.tagClass},e.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},e}(),kM=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],HM=(1<<26)/kM[kM.length-1],SM=function(){function e(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,r=(1<<t)-1,i=!1,o="",a=this.t,l=this.DB-a*this.DB%t;if(a-- >0)for(l<this.DB&&(n=this[a]>>l)>0&&(i=!0,o=iM(n));a>=0;)l<t?(n=(this[a]&(1<<l)-1)<<t-l,n|=this[--a]>>(l+=this.DB-t)):(n=this[a]>>(l-=t)&r,l<=0&&(l+=this.DB,--a)),n>0&&(i=!0),i&&(o+=iM(n));return i?o:"0"},e.prototype.negate=function(){var t=NM();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+PM(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=NM();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new VM(t):new OM(t),this.exp(e,n)},e.prototype.clone=function(){var e=NM();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n,r=this.DB-e*this.DB%8,i=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),128&n&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t},e.prototype.equals=function(e){return 0==this.compareTo(e)},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=NM();return this.bitwiseTo(e,oM,t),t},e.prototype.or=function(e){var t=NM();return this.bitwiseTo(e,aM,t),t},e.prototype.xor=function(e){var t=NM();return this.bitwiseTo(e,lM,t),t},e.prototype.andNot=function(e){var t=NM();return this.bitwiseTo(e,sM,t),t},e.prototype.not=function(){for(var e=NM(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=NM();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=NM();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+cM(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=dM(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,aM)},e.prototype.clearBit=function(e){return this.changeBit(e,sM)},e.prototype.flipBit=function(e){return this.changeBit(e,lM)},e.prototype.add=function(e){var t=NM();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=NM();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=NM();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=NM();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=NM();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=NM(),n=NM();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,r,i=e.bitLength(),o=BM(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new VM(t):t.isEven()?new zM(t):new OM(t);var a=[],l=3,s=n-1,c=(1<<n)-1;if(a[1]=r.convert(this),n>1){var d=NM();for(r.sqrTo(a[1],d);l<=c;)a[l]=NM(),r.mulTo(d,a[l-2],a[l]),l+=2}var u,f,h=e.t-1,p=!0,C=NM();for(i=PM(e[h])-1;h>=0;){for(i>=s?u=e[h]>>i-s&c:(u=(e[h]&(1<<i+1)-1)<<s-i,h>0&&(u|=e[h-1]>>this.DB+i-s)),l=n;!(1&u);)u>>=1,--l;if((i-=l)<0&&(i+=this.DB,--h),p)a[u].copyTo(o),p=!1;else{for(;l>1;)r.sqrTo(o,C),r.sqrTo(C,o),l-=2;l>0?r.sqrTo(o,C):(f=o,o=C,C=f),r.mulTo(C,a[u],o)}for(;h>=0&&!(e[h]&1<<i);)r.sqrTo(o,C),f=o,o=C,C=f,--i<0&&(i=this.DB-1,--h)}return r.revert(o)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||0==t.signum())return e.ZERO;for(var r=t.clone(),i=this.clone(),o=BM(1),a=BM(0),l=BM(0),s=BM(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),n?(o.isEven()&&a.isEven()||(o.addTo(this,o),a.subTo(t,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);for(;i.isEven();)i.rShiftTo(1,i),n?(l.isEven()&&s.isEven()||(l.addTo(this,l),s.subTo(t,s)),l.rShiftTo(1,l)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);r.compareTo(i)>=0?(r.subTo(i,r),n&&o.subTo(l,o),a.subTo(s,a)):(i.subTo(r,i),n&&l.subTo(o,l),s.subTo(a,s))}return 0!=i.compareTo(e.ONE)?e.ZERO:s.compareTo(t)>=0?s.subtract(t):s.signum()<0?(s.addTo(t,s),s.signum()<0?s.add(t):s):s},e.prototype.pow=function(e){return this.exp(e,new _M)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=kM[kM.length-1]){for(t=0;t<kM.length;++t)if(n[0]==kM[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<kM.length;){for(var r=kM[t],i=t+1;i<kM.length&&r<HM;)r*=kM[i++];for(r=n.modInt(r);t<i;)if(r%kM[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var r;if(16==n)r=4;else if(8==n)r=3;else if(256==n)r=8;else if(2==n)r=1;else if(32==n)r=5;else{if(4!=n)return void this.fromRadix(t,n);r=2}this.t=0,this.s=0;for(var i=t.length,o=!1,a=0;--i>=0;){var l=8==r?255&+t[i]:RM(t,i);l<0?"-"==t.charAt(i)&&(o=!0):(o=!1,0==a?this[this.t++]=l:a+r>this.DB?(this[this.t-1]|=(l&(1<<this.DB-a)-1)<<a,this[this.t++]=l>>this.DB-a):this[this.t-1]|=l<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&128&+t[0]&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,o=Math.floor(e/this.DB),a=this.s<<n&this.DM,l=this.t-1;l>=0;--l)t[l+o+1]=this[l]>>r|a,a=(this[l]&i)<<n;for(l=o-1;l>=0;--l)t[l]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[n]>>r;for(var a=n+1;a<this.t;++a)t[a-n-1]|=(this[a]&o)<<i,t[a-n]=this[a]>>r;r>0&&(t[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}},e.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var r=this.abs(),i=t.abs(),o=r.t;for(n.t=o+i.t;--o>=0;)n[o]=0;for(o=0;o<i.t;++o)n[o+r.t]=r.am(0,i[o],n,o,0,r.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,r){var i=t.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=n&&n.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=NM());var a=NM(),l=this.s,s=t.s,c=this.DB-PM(i[i.t-1]);c>0?(i.lShiftTo(c,a),o.lShiftTo(c,r)):(i.copyTo(a),o.copyTo(r));var d=a.t,u=a[d-1];if(0!=u){var f=u*(1<<this.F1)+(d>1?a[d-2]>>this.F2:0),h=this.FV/f,p=(1<<this.F1)/f,C=1<<this.F2,m=r.t,g=m-d,v=null==n?NM():n;for(a.dlShiftTo(g,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),e.ONE.dlShiftTo(d,v),v.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--g>=0;){var y=r[--m]==u?this.DM:Math.floor(r[m]*h+(r[m-1]+C)*p);if((r[m]+=a.am(0,y,r,g,0,d))<y)for(a.dlShiftTo(g,v),r.subTo(v,r);r[m]<--y;)r.subTo(v,r)}null!=n&&(r.drShiftTo(d,n),l!=s&&e.ZERO.subTo(n,n)),r.t=d,r.clamp(),c>0&&r.rShiftTo(c,r),l<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},e.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var r=NM(),i=NM(),o=n.convert(this),a=PM(t)-1;for(o.copyTo(r);--a>=0;)if(n.sqrTo(r,i),(t&1<<a)>0)n.mulTo(i,o,r);else{var l=r;r=i,i=l}return n.revert(r)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=BM(n),i=NM(),o=NM(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substring(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),i=Math.pow(n,r),o=!1,a=0,l=0,s=0;s<t.length;++s){var c=RM(t,s);c<0?"-"==t.charAt(s)&&0==this.signum()&&(o=!0):(l=n*l+c,++a>=r&&(this.dMultiply(i),this.dAddOffset(l,0),a=0,l=0))}a>0&&(this.dMultiply(Math.pow(n,a)),this.dAddOffset(l,0)),o&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,r){if("number"==typeof n)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),aM,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var i=[],o=7&t;i.length=1+(t>>3),n.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r<o;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=o;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<e.t;++r)n[r]=t(i,e[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,n,r),r},e.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var r=Math.min(this.t+e.t,t);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,e[r],n,r,0,this.t);for(i=Math.min(e.t,t);r<i;++r)this.am(0,e[r],n,r,0,t-r);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var r=n.t=this.t+e.t-t;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n[this.t+r-t]=this.am(t-r,e[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);(t=t+1>>1)>kM.length&&(t=kM.length);for(var o=NM(),a=0;a<t;++a){o.fromInt(kM[Math.floor(Math.random()*kM.length)]);var l=o.modPow(i,this);if(0!=l.compareTo(e.ONE)&&0!=l.compareTo(n)){for(var s=1;s++<r&&0!=l.compareTo(n);)if(0==(l=l.modPowInt(2,this)).compareTo(e.ONE))return!1;if(0!=l.compareTo(n))return!1}}return!0},e.prototype.square=function(){var e=NM();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var o=n.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)t(n);else{o<a&&(a=o),a>0&&(n.rShiftTo(a,n),r.rShiftTo(a,r));var l=function(){(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(l,0):(a>0&&r.lShiftTo(a,r),setTimeout(function(){t(r)},0))};setTimeout(l,10)}},e.prototype.fromNumberAsync=function(t,n,r,i){if("number"==typeof n)if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),aM,this),this.isEven()&&this.dAddOffset(1,0);var o=this,a=function(){o.dAddOffset(2,0),o.bitLength()>t&&o.subTo(e.ONE.shiftLeft(t-1),o),o.isProbablePrime(n)?setTimeout(function(){i()},0):setTimeout(a,0)};setTimeout(a,0)}else{var l=[],s=7&t;l.length=1+(t>>3),n.nextBytes(l),s>0?l[0]&=(1<<s)-1:l[0]=0,this.fromString(l,256)}},e}(),_M=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),VM=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),OM=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=NM();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(SM.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=NM();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),zM=function(){function e(e){this.m=e,this.r2=NM(),this.q3=NM(),SM.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=NM();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function NM(){return new SM(null)}function TM(e,t){return new SM(e,t)}var IM="undefined"!=typeof navigator;IM&&"Microsoft Internet Explorer"==navigator.appName?(SM.prototype.am=function(e,t,n,r,i,o){for(var a=32767&t,l=t>>15;--o>=0;){var s=32767&this[e],c=this[e++]>>15,d=l*s+c*a;i=((s=a*s+((32767&d)<<15)+n[r]+(1073741823&i))>>>30)+(d>>>15)+l*c+(i>>>30),n[r++]=1073741823&s}return i},MM=30):IM&&"Netscape"!=navigator.appName?(SM.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var a=t*this[e++]+n[r]+i;i=Math.floor(a/67108864),n[r++]=67108863&a}return i},MM=26):(SM.prototype.am=function(e,t,n,r,i,o){for(var a=16383&t,l=t>>14;--o>=0;){var s=16383&this[e],c=this[e++]>>14,d=l*s+c*a;i=((s=a*s+((16383&d)<<14)+n[r]+i)>>28)+(d>>14)+l*c,n[r++]=268435455&s}return i},MM=28),SM.prototype.DB=MM,SM.prototype.DM=(1<<MM)-1,SM.prototype.DV=1<<MM;SM.prototype.FV=Math.pow(2,52),SM.prototype.F1=52-MM,SM.prototype.F2=2*MM-52;var DM,ZM,jM=[];for(DM="0".charCodeAt(0),ZM=0;ZM<=9;++ZM)jM[DM++]=ZM;for(DM="a".charCodeAt(0),ZM=10;ZM<36;++ZM)jM[DM++]=ZM;for(DM="A".charCodeAt(0),ZM=10;ZM<36;++ZM)jM[DM++]=ZM;function RM(e,t){var n=jM[e.charCodeAt(t)];return null==n?-1:n}function BM(e){var t=NM();return t.fromInt(e),t}function PM(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}SM.ZERO=BM(0),SM.ONE=BM(1);var FM=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){var t,n,r;for(t=0;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[n],this.S[n]=r;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();var UM,qM,WM=null;if(null==WM){WM=[],qM=0;var QM=void 0;if("undefined"!=typeof window&&self.crypto&&self.crypto.getRandomValues){var GM=new Uint32Array(256);for(self.crypto.getRandomValues(GM),QM=0;QM<GM.length;++QM)WM[qM++]=255&GM[QM]}var KM=0,YM=function(e){if((KM=KM||0)>=256||qM>=256)self.removeEventListener?self.removeEventListener("mousemove",YM,!1):self.detachEvent&&self.detachEvent("onmousemove",YM);else try{var t=e.x+e.y;WM[qM++]=255&t,KM+=1}catch(e){}};"undefined"!=typeof window&&(self.addEventListener?self.addEventListener("mousemove",YM,!1):self.attachEvent&&self.attachEvent("onmousemove",YM))}function XM(){if(null==UM){for(UM=new FM;qM<256;){var e=Math.floor(65536*Math.random());WM[qM++]=255&e}for(UM.init(WM),qM=0;qM<WM.length;++qM)WM[qM]=0;qM=0}return UM.next()}var JM=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=XM()},e}();function $M(e){return function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}(function(e,t){var n,r,i,o,a,l,s,c,d,u,f,h,p=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),C=new Array(64);for(e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t,d=0;d<e.length;d+=16){for(n=p[0],r=p[1],i=p[2],o=p[3],a=p[4],l=p[5],s=p[6],c=p[7],u=0;u<64;u++)C[u]=u<16?e[u+d]:dA(dA(dA(sA(C[u-2]),C[u-7]),lA(C[u-15])),C[u-16]),f=dA(dA(dA(dA(c,aA(a)),rA(a,l,s)),cA[u]),C[u]),h=dA(oA(n),iA(n,r,i)),c=s,s=l,l=a,a=dA(o,f),o=i,i=r,r=n,n=dA(f,h);p[0]=dA(n,p[0]),p[1]=dA(r,p[1]),p[2]=dA(i,p[2]),p[3]=dA(o,p[3]),p[4]=dA(a,p[4]),p[5]=dA(l,p[5]),p[6]=dA(s,p[6]),p[7]=dA(c,p[7])}return p}(function(e){for(var t=Array(e.length>>2),n=0;n<t.length;n++)t[n]=0;for(n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}(e),8*e.length))}function eA(e){for(var t="0123456789abcdef",n="",r=0;r<e.length;r++){var i=e.charCodeAt(r);n+=t.charAt(i>>>4&15)+t.charAt(15&i)}return n}function tA(e,t){return e>>>t|e<<32-t}function nA(e,t){return e>>>t}function rA(e,t,n){return e&t^~e&n}function iA(e,t,n){return e&t^e&n^t&n}function oA(e){return tA(e,2)^tA(e,13)^tA(e,22)}function aA(e){return tA(e,6)^tA(e,11)^tA(e,25)}function lA(e){return tA(e,7)^tA(e,18)^nA(e,3)}function sA(e){return tA(e,17)^tA(e,19)^nA(e,10)}var cA=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function dA(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function uA(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=63&i|128,n[--t]=i>>6|192):(n[--t]=63&i|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var o=new JM,a=[];t>2;){for(a[0]=0;0==a[0];)o.nextBytes(a);n[--t]=a[0]}return n[--t]=2,n[--t]=0,new SM(n)}function fA(e,t,n){for(var r="",i=0;r.length<t;)r+=n(String.fromCharCode.apply(String,e.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return r}function hA(e,t){var n=$M;if(e.length+64+2>t)throw"Message too long for RSA";var r,i="";for(r=0;r<t-e.length-64-2;r+=1)i+="\0";var o=n("")+i+""+e,a=new Array(32);(new JM).nextBytes(a);var l=fA(a,o.length,n),s=[];for(r=0;r<o.length;r+=1)s[r]=o.charCodeAt(r)^l.charCodeAt(r);var c=fA(s,a.length,n),d=[0];for(r=0;r<a.length;r+=1)d[r+1]=a[r]^c.charCodeAt(r);return new SM(d.concat(s))}var pA=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=TM(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e,t){void 0===t&&(t=uA);var n=this.n.bitLength()+7>>3,r=t(e,n);if(null==r)return null;var i=this.doPublic(r);if(null==i)return null;for(var o=i.toString(16),a=o.length,l=0;l<2*n-a;l++)o="0"+o;return o},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=TM(e,16),this.e=parseInt(t,16),this.d=TM(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,r,i,o,a,l){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=TM(e,16),this.e=parseInt(t,16),this.d=TM(n,16),this.p=TM(r,16),this.q=TM(i,16),this.dmp1=TM(o,16),this.dmq1=TM(a,16),this.coeff=TM(l,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new JM,r=e>>1;this.e=parseInt(t,16);for(var i=new SM(t,16);;){for(;this.p=new SM(e-r,1,n),0!=this.p.subtract(SM.ONE).gcd(i).compareTo(SM.ONE)||!this.p.isProbablePrime(10););for(;this.q=new SM(r,1,n),0!=this.q.subtract(SM.ONE).gcd(i).compareTo(SM.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var a=this.p.subtract(SM.ONE),l=this.q.subtract(SM.ONE),s=a.multiply(l);if(0==s.gcd(i).compareTo(SM.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(s),this.dmp1=this.d.mod(a),this.dmq1=this.d.mod(l),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=TM(e,16),n=this.doPrivate(t);return null==n?null:function(e,t){var n=e.toByteArray(),r=0;for(;r<n.length&&0==n[r];)++r;if(n.length-r!=t-1||2!=n[r])return null;++r;for(;0!=n[r];)if(++r>=n.length)return null;var i="";for(;++r<n.length;){var o=255&n[r];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&o)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return i}(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var r=new JM,i=e>>1;this.e=parseInt(t,16);var o=new SM(t,16),a=this,l=function(){var t=function(){if(a.p.compareTo(a.q)<=0){var e=a.p;a.p=a.q,a.q=e}var t=a.p.subtract(SM.ONE),r=a.q.subtract(SM.ONE),i=t.multiply(r);0==i.gcd(o).compareTo(SM.ONE)?(a.n=a.p.multiply(a.q),a.d=o.modInverse(i),a.dmp1=a.d.mod(t),a.dmq1=a.d.mod(r),a.coeff=a.q.modInverse(a.p),setTimeout(function(){n()},0)):setTimeout(l,0)},s=function(){a.q=NM(),a.q.fromNumberAsync(i,1,r,function(){a.q.subtract(SM.ONE).gcda(o,function(e){0==e.compareTo(SM.ONE)&&a.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(s,0)})})},c=function(){a.p=NM(),a.p.fromNumberAsync(e-i,1,r,function(){a.p.subtract(SM.ONE).gcda(o,function(e){0==e.compareTo(SM.ONE)&&a.p.isProbablePrime(10)?setTimeout(s,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(l,0)},e.prototype.sign=function(e,t,n){var r=(CA[n]||"")+t(e).toString(),i=this.n.bitLength()/4,o=function(e,t){if(t<e.length+22)return console.error("Message too long for RSA"),null;for(var n=t-e.length-6,r="",i=0;i<n;i+=2)r+="ff";return TM("0001"+r+"00"+e,16)}(r,i);if(null==o)return null;var a=this.doPrivate(o);if(null==a)return null;for(var l=a.toString(16),s=l.length,c=0;c<i-s;c++)l="0"+l;return l},e.prototype.verify=function(e,t,n){var r=TM(t,16),i=this.doPublic(r);return null==i?null:function(e){for(var t in CA)if(CA.hasOwnProperty(t)){var n=CA[t],r=n.length;if(e.substring(0,r)==n)return e.substring(r)}return e}(i.toString(16).replace(/^1f+00/,""))==n(e).toString()},e}();var CA={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function mA(e,t,n){if(!t||!e)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}
28
+ */function Ig(){return zg||(zg=1,e=Tg,"production"!==process.env.NODE_ENV&&function(){function t(e,t){var n=e.length;e.push(t),function(e,t,n){for(var r=n;r>0;){var o=r-1>>>1,a=e[o];if(!(i(a,t)>0))return;e[o]=t,e[r]=a,r=o}}(e,t,n)}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();return n!==t&&(e[0]=n,function(e,t,n){for(var r=n,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(i(s,t)<0)c<o&&i(d,s)<0?(e[r]=d,e[c]=t,r=c):(e[r]=s,e[l]=t,r=l);else{if(!(c<o&&i(d,t)<0))return;e[r]=d,e[c]=t,r=c}}}(e,n,0)),t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error),"object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var s=[],c=[],d=1,u=null,f=3,h=!1,p=!1,C=!1,m="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function y(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))return;r(c),i.sortIndex=i.expirationTime,t(s,i)}i=n(c)}}function w(e){if(C=!1,y(e),!p)if(null!==n(s))p=!0,O(b);else{var t=n(c);null!==t&&z(w,t.startTime-e)}}function b(t,i){p=!1,C&&(C=!1,N()),h=!0;var o=f;try{return function(t,i){var o=i;for(y(o),u=n(s);null!==u&&(!(u.expirationTime>o)||t&&!k());){var a=u.callback;if("function"==typeof a){u.callback=null,f=u.priorityLevel;var l=a(u.expirationTime<=o);o=e.unstable_now(),"function"==typeof l?u.callback=l:u===n(s)&&r(s),y(o)}else r(s);u=n(s)}if(null!==u)return!0;var d=n(c);return null!==d&&z(w,d.startTime-o),!1}(t,i)}finally{u=null,f=o,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var E=!1,M=null,A=-1,x=5,L=-1;function k(){return!(e.unstable_now()-L<x)}var H,S=function(){if(null!==M){var t=e.unstable_now();L=t;var n=!0;try{n=M(!0,t)}finally{n?H():(E=!1,M=null)}}else E=!1};if("function"==typeof v)H=function(){v(S)};else if("undefined"!=typeof MessageChannel){var _=new MessageChannel,V=_.port2;_.port1.onmessage=S,H=function(){V.postMessage(null)}}else H=function(){m(S,0)};function O(e){M=e,E||(E=!0,H())}function z(t,n){A=m(function(){t(e.unstable_now())},n)}function N(){g(A),A=-1}var T=function(){};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_continueExecution=function(){p||h||(p=!0,O(b))},e.unstable_forceFrameRate=function(e){e<0||e>125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):x=e>0?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(s)},e.unstable_next=function(e){var t;switch(f){case 1:case 2:case 3:t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=T,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,o){var a,l,u=e.unstable_now();if("object"==typeof o&&null!==o){var f=o.delay;a="number"==typeof f&&f>0?u+f:u}else a=u;switch(r){case 1:l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}var m=a+l,g={id:d++,callback:i,priorityLevel:r,startTime:a,expirationTime:m,sortIndex:-1};return a>u?(g.sortIndex=a,t(c,g),null===n(s)&&g===n(c)&&(C?N():C=!0,z(w,a-u))):(g.sortIndex=m,t(s,g),p||h||(p=!0,O(b))),g},e.unstable_shouldYield=k,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Tg;var e}var Dg=(Ng||(Ng=1,"production"===process.env.NODE_ENV?Vg.exports=(_g||(_g=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(0>i(s,n))c<o&&0>i(d,s)?(e[r]=d,e[c]=n,r=c):(e[r]=s,e[l]=n,r=l);else{if(!(c<o&&0>i(d,n)))break e;e[r]=d,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var s=[],c=[],d=1,u=null,f=3,h=!1,p=!1,C=!1,m="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function y(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(s,i)}i=n(c)}}function w(e){if(C=!1,y(e),!p)if(null!==n(s))p=!0,O(b);else{var t=n(c);null!==t&&z(w,t.startTime-e)}}function b(t,i){p=!1,C&&(C=!1,g(x),x=-1),h=!0;var o=f;try{for(y(i),u=n(s);null!==u&&(!(u.expirationTime>i)||t&&!H());){var a=u.callback;if("function"==typeof a){u.callback=null,f=u.priorityLevel;var l=a(u.expirationTime<=i);i=e.unstable_now(),"function"==typeof l?u.callback=l:u===n(s)&&r(s),y(i)}else r(s);u=n(s)}if(null!==u)var d=!0;else{var m=n(c);null!==m&&z(w,m.startTime-i),d=!1}return d}finally{u=null,f=o,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var E,M=!1,A=null,x=-1,L=5,k=-1;function H(){return!(e.unstable_now()-k<L)}function S(){if(null!==A){var t=e.unstable_now();k=t;var n=!0;try{n=A(!0,t)}finally{n?E():(M=!1,A=null)}}else M=!1}if("function"==typeof v)E=function(){v(S)};else if("undefined"!=typeof MessageChannel){var _=new MessageChannel,V=_.port2;_.port1.onmessage=S,E=function(){V.postMessage(null)}}else E=function(){m(S,0)};function O(e){A=e,M||(M=!0,E())}function z(t,n){x=m(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_continueExecution=function(){p||h||(p=!0,O(b))},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"):L=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(s)},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_pauseExecution=function(){},e.unstable_requestPaint=function(){},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,o){var a=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?a+o:a,r){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return r={id:d++,callback:i,priorityLevel:r,startTime:o,expirationTime:l=o+l,sortIndex:-1},o>a?(r.sortIndex=o,t(c,r),null===n(s)&&r===n(c)&&(C?(g(x),x=-1):C=!0,z(w,o-a))):(r.sortIndex=l,t(s,r),p||h||(p=!0,O(b))),r},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(Og)),Og):Vg.exports=Ig()),Vg.exports);const Zg=Symbol(),jg=Symbol(),Rg="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?l:u,Bg=Dg.unstable_runWithPriority?e=>{try{Dg.unstable_runWithPriority(Dg.unstable_NormalPriority,e)}catch(t){if("Not implemented."!==t.message)throw t;e()}}:e=>e();function Pg(e,t){const n=d(e)[Zg];if("object"==typeof process&&"production"!==process.env.NODE_ENV&&!n)throw new Error("useContextSelector requires special context");const{v:{current:r},n:{current:i},l:o}=n,a=t(r),[l,s]=v((e,n)=>{if(!n)return[r,a];if("p"in n)throw n.p;if(n.n===i)return Object.is(e[1],a)?e:[r,a];try{if("v"in n){if(Object.is(e[0],n.v))return e;const r=t(n.v);return Object.is(e[1],r)?e:[n.v,r]}}catch(e){}return[...e]},[r,a]);return Object.is(l[1],a)||s(),Rg(()=>(o.add(s),()=>{o.delete(s)}),[o]),l[1]}const Fg=function(e){const t=s({[Zg]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});var n;return t[jg]=t.Provider,t.Provider=(n=t.Provider,({value:e,children:t})=>{const r=a(e),i=a(0),[o,l]=c(null);o&&(o(e),l(null));const s=a();if(!s.current){const e=new Set,t=(t,n)=>{i.current+=1;const r={n:i.current};(null==n?void 0:n.suspense)&&(r.n*=-1,r.p=new Promise(e=>{l(()=>t=>{r.v=t,delete r.p,e(t)})})),e.forEach(e=>e(r)),t()};s.current={[Zg]:{v:r,n:i,l:e,u:t}}}return Rg(()=>{r.current=e,i.current+=1,Bg(()=>{s.current[Zg].l.forEach(t=>{t({n:i.current,v:e})})})},[e]),C(n,{value:s.current},t)}),delete t.Consumer,t}([Hg,()=>{}]),Ug=({children:t,useTableRef:n,totalWidth:r})=>{const i=a(null);return l(()=>{n&&i.current&&n(i)},[n]),e("table",{className:"ff-spreadsheet-table",ref:i,style:{minWidth:`${60+r}px`,tableLayout:"fixed"},children:t})},qg=t=>e("tr",{...t}),Wg=t=>e("tr",{className:"ff-spreadsheet-row-header",...t});function Qg(){return Pg(Fg,([,e])=>e)}function Gg(e){return Pg(Fg,([t])=>e(t))}const Kg=({selected:t,onSelect:n})=>{const i=r.useCallback(()=>{n()},[n]);return e("th",{className:"ff-spreadsheet-corner-header",onClick:i,tabIndex:0,children:e("div",{className:z("corner-header",{"ff-spreadsheet-header--selected":t}),children:e(P,{variant:t?"dark":"light",color:t?"var(--hover-color)":"var(--text-color)",name:"excel_corner_menu"})})})},Yg=t=>function(n){const i=Qg(),o=r.useCallback(()=>i({type:Zp}),[i]),a=Gg(e=>e.selected instanceof bm);return e(t,{...n,selected:a,onSelect:o})},Xg=t=>function(n){const i=Qg(),o=r.useCallback((e,t)=>i(function(e,t){return{type:Dp,payload:{column:e,extend:t}}}(e,t)),[i]),a=Gg(e=>e.selected.hasEntireColumn(n.column)),l=Gg(e=>e.selectedColumn??void 0),s=Gg(e=>e.active?rm(e.active,e.model.data):void 0);return e(t,{...n,cell:s,selected:a,selectedColumn:l,onSelect:o,scrollToColumn:n.scrollToColumn})},Jg=Xg(({column:t,label:i,selected:o,onSelect:a,setContextMenu:l,deleteColumn:s,addColumnLeft:c,addColumnRight:d,columnContextEnable:u,cell:f,selectedColumn:p,minimumColumnWidth:C,maxColLimit:m,disableDeleteOption:g,contextMenu:v,onAddColumn:y,onDeleteColumn:w,setVisibleRange:b,scrollToColumn:E})=>{const M=Qg(),A=Gg(e=>e.model.data),x=C,L=Gg(e=>e.columnDimensions[t]?.width||x),k=Gg(e=>e.model.data),{columnCount:H}=Ym(k),S=e=>{b(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return p&&E(p),n})},_=h(()=>[{label:"Add Column Left",value:"Add Column Left",iconName:"plus_icon",action:()=>{S("increment"),c(x),y?.(p??t,!0)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Left"]??!1,disable:H>=m},{label:"Add Column Right",value:"Add Column Right",iconName:"plus_icon",action:()=>{S("increment"),d(x),y?.(p??t,!1)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Right"]??!1,disable:H>=m},...g?[]:[{label:"Delete Column",value:"Delete Column",iconName:"delete",action:()=>{S("decrement"),s(),w?.(p??t)},disableTooltip:"",visible:f?.contextDisable?.["Delete Column"]??!1,disable:!1}]],[p,t,A]),V=r.useCallback((e,n)=>{const r=n?t-1:t,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientX,l=L,s=e=>{const t=Math.max(x,l+(e.clientX-o));M(LC(i,t))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),M($C())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),M(JC())},[t,L]),O=r.useCallback(e=>M(QC(e)),[M]),N=r.useCallback(e=>{a(t,e.shiftKey)},[a,t]),T=r.useCallback(e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"column",options:_})},[t,p,u,_]);return r.useEffect(()=>{void 0!==p&&"column"===v?.contextType&&l(e=>({open:e.open,contextType:"column",options:_}))},[t,p,u,_,"column"===v?.contextType]),n("th",{className:z("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{minWidth:`${L}px`},onClick:N,onContextMenu:T,tabIndex:0,children:[e(F,{fontWeight:"medium",children:i??$g(t)}),e("div",{className:"drag-column-selector drag-column-left",onMouseDown:e=>V(e,!1),onDoubleClick:()=>M(LC(t,x)),onClick:()=>O({row:-1,column:t})}),e("div",{className:"drag-column-selector drag-column-right",onMouseDown:e=>V(e,!0),onDoubleClick:()=>M(LC(t,x)),onClick:()=>O({row:-1,column:t})})]},t)});function $g(e){let t="",n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}const ev=({row:t,label:i,selected:o,onSelect:a,setContextMenu:l,addRowTop:s,addRowBottom:c,deleteRow:d,rowContextEnable:u,selectedRow:f,cell:h,maxRowLimit:p,disableDeleteOption:C,contextMenu:m,setVisibleRange:g,scrollToRow:v})=>{const y=Qg(),w=Gg(e=>e.rowDimensions[t]?.height||32),b=Gg(e=>e.model.data),{rowCount:E}=Ym(b),M=e=>{g(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return f&&v(f),n})},A=r.useMemo(()=>[{label:"Add Row Top",value:"Add Row Top",iconName:"plus_icon",action:()=>{M("increment"),s()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Top"]??!1,disable:E>=p},{label:"Add Row Bottom",value:"Add Row Bottom",iconName:"plus_icon",action:()=>{M("increment"),c()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Bottom"]??!1,disable:E>=p},...C?[]:[{label:"Delete Row",value:"Delete Row",iconName:"delete",action:()=>{M("decrement"),d()},disableTooltip:"",visible:h?.contextDisable?.["Delete Row"]??!1,disable:!1}]],[f,t]),x=r.useCallback((e,n)=>{const r=n?t:t-1,i=Math.max(r,0);a(i,e.shiftKey);const o=e.clientY,l=w,s=e=>{const t=Math.max(32,l+(e.clientY-o));y(xC(i,t))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),y($C())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),y($C())},[w,t]),L=r.useCallback(e=>y(QC(e)),[y]),k=r.useCallback(e=>{a(t,e.shiftKey)},[t]),H=r.useCallback(e=>{e.preventDefault(),a(t,e.shiftKey),l({open:u,contextType:"row",options:A})},[t,u,A,f]);return r.useEffect(()=>{void 0!==f&&"row"===m?.contextType&&l(e=>({open:e.open,contextType:"row",options:A}))},[t,u,A,f,"row"===m?.contextType]),n("th",{className:z("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":o}),style:{height:`${w}px`,minWidth:"60px"},onClick:k,onContextMenu:H,tabIndex:0,children:[e(F,{fontWeight:"medium",children:void 0!==i?i:t+1}),e("div",{className:"drag-row-selector drag-row-down",onMouseDown:e=>x(e,!0),onDoubleClick:()=>y(xC(t,32)),onClick:()=>L({row:t,column:-1})}),e("div",{className:"drag-row-selector drag-row-up",onMouseDown:e=>x(e,!1),onDoubleClick:()=>y(xC(t,32)),onClick:()=>L({row:t,column:-1})})]})},tv=t=>function(n){const i=Qg(),o=Gg(e=>e.selected.hasEntireRow(n.row)),a=Gg(e=>e.active?rm(e.active,e.model.data):void 0),l=Gg(e=>e.selectedRow??void 0),s=r.useCallback((e,t)=>i(function(e,t){return{type:Ip,payload:{row:e,extend:t}}}(e,t)),[i]);return e(t,{...n,selected:o,cell:a,selectedRow:l,onSelect:s,scrollToRow:n.scrollToRow})},nv=({row:t,column:n,DataViewer:i,active:o,dragging:a,mode:l,data:s,evaluatedData:c,select:d,activate:u,setCellDimensions:f,setCellData:h})=>{const p=r.useRef(null),C=r.useMemo(()=>({row:t,column:n}),[t,n]),m=r.useCallback(e=>{e.preventDefault(),window.getSelection()?.removeAllRanges(),"view"===l&&(f(C,Vm(e.currentTarget)),e.shiftKey?d(C):u(C))},[l,f,C,d,u]),g=r.useCallback(e=>{a&&(f(C,Vm(e.currentTarget)),d(C))},[f,d,a,C]);return r.useEffect(()=>{const e=p.current;if(!e)return;const t=()=>{f(C,Vm(e))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[f,C]),s&&s.DataViewer&&(i=s.DataViewer),e("td",{ref:p,style:{...s?.style,..."dropDown"===s?.inputType?.type&&{fontSize:"12px"},textDecoration:"underline"===s?.style?.textDecoration?s?.style?.textDecoration:"none"},className:z("ff-spreadsheet-cell",s?.className,{"ff-spreadsheet-active-cell":o||a}),onMouseEnter:g,onMouseDown:m,tabIndex:0,children:e(i,{row:t,column:n,cell:s,active:o,evaluatedCell:c,setCellData:h,inputValue:()=>null})})},rv=t=>function(n){const{row:i,column:o}=n,a=Qg(),l=r.useMemo(()=>({row:i,column:o}),[i,o]),s=r.useCallback(e=>a(GC(l,e)),[a,l]),c=r.useCallback(e=>a(function(e){return{type:Rp,payload:{point:e}}}(e)),[a]),d=r.useCallback(e=>a(QC(e)),[a]),u=r.useCallback((e,t)=>a(KC(e,t)),[a]),f=Gg(e=>_m(e.active,l)),h=Gg(e=>f?e.mode:"view"),p=Gg(e=>rm(l,e.model.data)),C=Gg(e=>rm(l,e.model.evaluatedData)),m=Gg(e=>e.dragging),g=Gg(e=>e.copied?.has(l)||!1);return e(t,{...n,active:f,copied:g,dragging:m,mode:h,evaluatedData:C,data:p,select:c,activate:d,setCellDimensions:u,setCellData:s})},iv=({cell:r,evaluatedCell:i,active:o})=>{const a=function(e,t){const n=t?.value??e?.value;if(n&&"object"==typeof n)return n.toString();return n}(r,i);return e("span","boolean"==typeof a?{className:"ff-spreadsheet-data-viewer ff-spreadsheet-data-viewer--boolean",children:ov(a)}:{className:z("ff-spreadsheet-data-viewer",{"ff-spreadsheet-data-viewer--preserve-breaks":Fm(a)}),children:o||"dropDown"!==r?.inputType?.type?o||"file"!==r?.inputType?.type?!o&&a:e(t,{children:G(r?.value)?n("div",{className:"ff-spreadsheet-data-viewer--without-fileType",children:[e(P,{name:"attachment_icon"})," Attachment"]}):(n=>{if(G(n))return e(t,{});return JSON.parse(n).map(t=>e("div",{className:"ff-spreadsheet-data-viewer--fileType",children:e(cn,{width:r?.style?.width??100,title:t?.name?.split("*")?.[0]??""})},t.name))})(a)}):n("div",{className:"ff-spreadsheet-data-viewer--dropdownType",children:[a,e(P,{name:"arrow_down",height:8,className:"dropdownType-icon"})]})})};function ov(e){return e?"TRUE":"FALSE"}const av=i.forwardRef(({initialValue:t="",onChange:n,className:r="",style:o={}},s)=>{const c=a(null);i.useImperativeHandle(s,()=>c.current),l(()=>{c.current&&document.activeElement!==c.current&&t!==c.current.innerText&&(c.current.innerText=t)},[t]);return e("div",{style:o,children:e("div",{ref:c,className:`editable-cell ${r}`,contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:e=>{if("Enter"===e.key){if(e.altKey||e.shiftKey)return e.preventDefault(),void document.execCommand("insertLineBreak");c.current?.blur()}"Delete"!==e.key&&"Backspace"!==e.key||e.stopPropagation()},onInput:()=>{if(c.current){let e=c.current.innerText;e.endsWith("\n")&&(e=e.slice(0,-1)),n?.(e)}},onPaste:e=>{e.preventDefault();const t=e.clipboardData.getData("text/plain");document.execCommand("insertText",!1,t)},spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{outline:"none",transition:"border 0.2s",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"inherit",fontSize:"inherit",lineHeight:"normal",minHeight:"24px",verticalAlign:"middle",caretColor:"black",height:"inherit",maxHeight:"inherit",display:"block",position:"relative",paddingBottom:"2px"}})})}),lv=({onChange:t,cell:n})=>{const i=r.useRef(null),o=r.useCallback(e=>{const{contextDisable:r,...i}=n;t({...i,value:e,inputType:i.inputType??{type:"text"}})},[t,n]);r.useEffect(()=>{i.current&&function(e){if(e)if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)e.selectionStart=e.selectionEnd=e.value.length;else if(e.isContentEditable){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n?.removeAllRanges(),n?.addRange(t)}}(i.current)},[]);return e("div",{className:"ff-spreadsheet-data-editor",children:e(av,{ref:i,initialValue:n?.value??"",onChange:o,className:"ff-spreadsheet-cell-textarea",style:{...n?.style,borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})})},sv=t=>{const i=r.useRef(null),o=r.useRef(null),a=Qg(),l=r.useCallback((e,t)=>a(GC(e,t)),[a]),s=r.useCallback(e=>a(QC(e)),[a]),c=r.useCallback(()=>a({type:Qp}),[a]),d=r.useCallback(e=>a({type:yC,payload:{autofill:e}}),[a]),u=r.useCallback(e=>a(function(e){return{type:eC,payload:{changes:e}}}(e)),[a]),f=r.useCallback(()=>{a({type:Gp})},[a]),h=Gg(e=>e.rowDimensions),p=Gg(e=>e.active),C=Gg(e=>e.mode),m=Gg(e=>e.active?rm(e.active,e.model.data):void 0),g=Gg(e=>e.selected),v=Gg(e=>g&&jm(e.rowDimensions,e.columnDimensions,e.model.data,e.selected)),y=Gg(e=>{let t=p?Dm(p,e.rowDimensions,e.columnDimensions):void 0;return t={top:t?.top?t?.top:0,height:t?.height?t?.height:0,left:t?.left?t?.left:0,width:t?.width?t?.width:0},t}),w=r.useMemo(()=>!p||!y||p.row<t.visibleRowRange.start||p.row>=t.visibleRowRange.end||p.column<t.visibleColRange.start||p.column>=t.visibleColRange.end,[p,y,t.visibleRowRange,t.visibleColRange]),b=r.useRef(void 0),E=r.useRef(null),M=r.useRef(void 0),A=r.useCallback(e=>{p&&l(p,e)},[l,p]),[x,L]=r.useState({value:"",name:""}),[k,H]=r.useState(!1),[S,_]=r.useState(),[V,O]=r.useState([]);r.useEffect(()=>{m&&p&&t.getActiveCell({value:m.value,active:p});const n=i.current;if(!w&&n){if(n.focus({preventScroll:!0}),"file"===m?.inputType?.type&&m?.value)try{const e=JSON.parse(m.value).map(e=>new File([new Blob],e.name.split("*")[0]??"default"));O(e)}catch(e){console.error("Error parsing cell value for files:",e),O([])}else O([]);if("dropDown"===m?.inputType?.type){L({value:m?.value,name:m?.value}),H(e=>!e);const t=m?.inputType?.options?.map(t=>({disable:t.disable,label:e("span",{style:{color:t.color},children:t.label}),value:t.value}));_(t)}}},[i,w,p?.row,p?.column]),r.useEffect(()=>{"dropDown"===m?.inputType?.type&&m?.value!==x.value&&L({value:m?.value,name:m?.value})},[m?.value,m?.inputType?.type,x.value]),r.useEffect(()=>{const e=E.current,t=M.current;if(E.current=p,M.current=m,!e||!t)return;const n=p?.row!==e.row||p?.column!==e.column;if(n||"edit"!==C){const e=b.current;t!==e?u([{prevCell:e||null,nextCell:t}]):n||m===t||u([{prevCell:t,nextCell:m||null}]),b.current=m}});const N=m&&m.DataEditor||t.DataEditor,T=m&&m.readOnly,I=r.useCallback(e=>{if(!p)return;const t=e.currentTarget.closest(".ff-excel-spreadsheet");if(!t)return void e.preventDefault();e.stopPropagation();const n=document.body.style.userSelect,r=document.body.style.overflow;document.body.style.userSelect="none",document.body.style.overflow="hidden";let i=null;const o=()=>{i&&(cancelAnimationFrame(i),i=null)},a=e=>{const n=t.getBoundingClientRect();let r=0,a=0;e.clientY<n.top+50?a=-12:e.clientY>n.bottom-50&&(a=12),e.clientX<n.left+50?r=-12:e.clientX>n.right-50&&(r=12),0!==r||0!==a?(e=>{o();const n=()=>{const{x:r,y:o}=e;0!==r&&(t.scrollLeft+=r),0!==o&&(t.scrollTop+=o),i=requestAnimationFrame(n)};i=requestAnimationFrame(n)})({x:r,y:a}):o()},l=()=>{o(),document.body.style.userSelect=n,document.body.style.overflow=r,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",l),d(!0)},[s,d,p]),D=r.useCallback(e=>{e.preventDefault(),t.setContextMenu({open:t.contextOption?.open??!1,contextType:t.contextOption?.contextType??null,options:t.contextOption?.options||[]})},[t]),Z=v?.height!==y?.height||v?.width!==y?.width,j=r.useCallback(e=>{p&&Z&&(KC(p,Vm(e.currentTarget)),s(p))},[p,Z]),R=t.isAtRight?t.maxWidth-(y?.left-t.scrollPos.left)+100:t.maxWidth,B=t.isAtBottom?t.maxHeight-(y?.top-t.scrollPos.top)+64:t.maxHeight,P=["file","dropDown"].includes(m?.inputType?.type||"");return n("div",{ref:i,className:z("ff-spreadsheet-active-cell",`ff-spreadsheet-active-cell--${C}`,{"ff-spreadsheet-active-cell--hidden":w,"ff-spreadsheet-active-cell--dragging":Z&&"text"!==m?.inputType?.type}),onMouseDown:j,style:{...y,backgroundColor:m?.style?.backgroundColor,...P?{display:"flex",alignItems:m?.style?.alignContent,justifyContent:m?.style?.textAlign}:{},..."edit"===C&&p?{minWidth:Math.min(y?.width,t.maxWidth),minHeight:Math.min(y?.height,t.maxHeight),height:"auto",maxWidth:`${R}px`,maxHeight:`${B}px`,overflow:"auto",..."dropDown"===m?.inputType?.type?{}:{padding:"2px 4px 0px 4px",width:"max-content"}}:{}},onContextMenu:D,onClick:"view"!==C||T?void 0:c,tabIndex:0,children:[e("div",{className:P?"":"active-cell-main",children:"dropDown"===m?.inputType?.type?e(lr,{...m?.inputType?.inputProps,dropDownRef:o,showOptions:{open:!("edit"!==C||!p),toggle:k},selectedOption:x,optionsList:S||[],height:26,showLabel:!1,disabled:!t.editable,showBorder:!1,optionZIndex:5e3,onChange:e=>{L({value:e.value,name:e.label}),A({...m,value:e.value,style:m?.style,inputType:m?.inputType})}}):"file"===m?.inputType?.type?e(Lp,{...m?.inputType?.inputProps,label:"",onFileListClick:e=>{const n=e.target.closest(".ff-attachment-files"),r=e.target.closest(".ff-icon-container, .ff-icon-click, .ff-icon-danger");if(n&&!r&&m?.value&&t.attachmentAction?.viewAttachment)try{const e=JSON.parse(m.value),r=n.parentElement?.querySelectorAll(".ff-attachment-files")||[],i=Array.from(r).indexOf(n);if(-1===i||!e[i])return void console.error("File index not found or invalid");const o=e[i];t.attachmentAction.viewAttachment(o.id,o.name?.split("*")[0]??"default")}catch(e){console.error("Error parsing cell value:",e)}else console.warn("Missing file element, icon click, cell value, or viewAttachment action")},selectedFiles:V,onFilesChange:async(e,n,r)=>{try{if("ADD"===r&&"file"===m?.inputType?.type){let n=[];try{m?.value&&(n=JSON.parse(m.value))}catch(e){console.error("Error parsing cell.value:",e)}let r=0;const i=e.filter((e,t,i)=>{const o=e.name.split("*")[0],a=i.findIndex(e=>e.name.split("*")[0]===o)!==t,l=n.some(e=>e.name.split("*")[0]===o);return!a&&!l||(r++,!1)});if(n.length+i.length>5)return void Za.info("Cannot upload more than 5 files.");if(t.attachmentAction?.addAttachment&&i.length>0)try{let e=0,r=0,o=0;const l=V?.length+i?.length,s=l>0?25*l:1,c=[...n],d=i?.map(async e=>{try{if(e.name.includes("*"))return{file:e,status:"existing",data:{name:e.name}};const n=await(t?.attachmentAction?.addAttachment(e));if(!n||"string"==typeof n&&0===n.trim().length)return{file:e,status:"failed",reason:"no response"};if("string"==typeof n)try{const t=JSON.parse(n);return 507===t.responseCode?{file:e,status:"memory_full",reason:"no memory"}:400===t.responseCode?{file:e,status:"failed",reason:"invalid file"}:t?.id&&t?.name?{file:e,status:"success",data:t}:(console.error(`Invalid response structure for ${e.name}:`,t),{file:e,status:"failed",reason:"invalid response"})}catch(t){return console.error(`Parse error for ${e.name}:`,t),{file:e,status:"failed",reason:"parse error"}}if("object"==typeof n&&null!==n){const t=n;return t?.id&&t?.name?{file:e,status:"success",data:t}:(console.error(`Invalid response structure for ${e.name}:`,n),{file:e,status:"failed",reason:"invalid response"})}return console.error(`Unknown response for ${e.name}:`,n),{file:e,status:"failed",reason:"unknown"}}catch(t){return console.error(`Upload failed for ${e.name}:`,t),{file:e,status:"failed",reason:"upload error"}}});if((await Promise.allSettled(d)).forEach(t=>{if("fulfilled"===t.status&&t.value){const{status:n,data:i}=t.value;"success"===n&&i?.id&&i?.name?(c.push(i),e++):"existing"===n&&i?.name?c.push(i):"memory_full"===n?o++:r++}else r++}),e>0||c.length>n.length){const e=c.length>0?JSON.stringify(c):"";A({...m,value:e,style:m?.style,inputType:m?.inputType}),a(xC(p?.row||0,Math.max(s,h?.[p.row]?.height||s))),O(c.map(e=>new File([new Blob],e.name?.split("*")[0]??"default")))}o>0&&Za.info("No memory available to add the file"),e>0&&Za.success(`${e} file${e>1?"s":""} uploaded successfully`),r>0&&Za.info(`${r} unsupported ${r>1?"files":"file"}. Please check the file formats.`)}catch(e){console.error("Upload operation failed:",e),Za.error("Operation failed")}}else if("DELETE"===r&&"file"===m?.inputType?.type)try{let e=[...m&&JSON.parse(m.value)],r=0;for(const i of n||[]){const n=e.findIndex(e=>e.name.split("*")[0]===i.name.split("*")[0]),o=e[n]?.id;if(-1!==n&&o&&t.attachmentAction?.deleteAttachment)try{const a=await t.attachmentAction.deleteAttachment(o);"SUCCESS"===a||"object"==typeof a&&null!==a&&("status"in a&&"SUCCESS"===a.status||"responseCode"in a&&200===a.responseCode)?(e.splice(n,1),r++):console.error(`Delete failed for ${i.name}: Invalid response`,a)}catch(e){console.error(`Delete error for ${i.name}:`,e),Za.error("Error deleting file")}else console.error(`Cannot delete ${i.name}: Invalid fileId or no match`,{index:n,fileId:o,hasDeleteAttachment:!!t.attachmentAction?.deleteAttachment}),Za.error("Failed to delete file: Invalid file data")}if(r>0){const t=e.length>0?JSON.stringify(e):"";A({...m,value:t,style:m?.style,inputType:m?.inputType}),O(e?.map(e=>new File([new Blob],e.name.split("*")[0]))),Za.success(`${r} file${r>1?"s":""} deleted successfully`)}else if(n?.length){const t=e?.filter(e=>e.id&&e.name);if(t.length<e.length){const e=t.length>0?JSON.stringify(t):"";A({...m,value:e,style:m?.style,inputType:m?.inputType}),O(t.map(e=>new File([new Blob],e.name.split("*")[0]))),Za.error("Failed to delete file(s). Invalid file data detected.")}else Za.error("Failed to delete file(s). No valid files removed.")}}catch(e){console.error("Delete operation failed:",e),Za.error("Delete operation failed")}}catch(e){console.error("handleFilesChange error:",e),Za.error("Operation failed")}},disabled:!t.editable,maxFiles:5,buttonLabel:"+ Attachments",buttonVariant:"tertiary",deleteButton:t.editable,selectedFileMessage:"Duplicate attachments not allowed within the same row",addAttachmentButton:t.editable,isInfoIconRequired:!1,truncateMaxLimit:(y?.width??0)-60}):"edit"===C&&p&&t.editable?e(N,{row:p.row,column:p.column,cell:m,onChange:A,exitEditMode:f}):e(av,{initialValue:m?.value,onChange:()=>{},className:"ff-spreadsheet-cell-textarea",style:{...m?.style,textDecoration:"underline"===m?.style?.textDecoration?"underline":"none",backgroundColor:Z?"#1e161f00":m?.style?.backgroundColor,pointerEvents:"none",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})}),!["file"].includes(m?.inputType?.type??"")&&("edit"===C||p&&e("div",{onMouseDown:I,className:"select_dot"}))]},`${p?.row}-${p?.column}`)},cv=({dimensions:t,dragging:n,hidden:r,variant:i})=>{const o=Gg(e=>e.active),a=Gg(e=>e.autoFill),l=Gg(e=>o?Dm(o,e.rowDimensions,e.columnDimensions):void 0),{width:s,height:c,top:d,left:u}=t||{};let f=l?.height??0,h=l?.width??0,p=s,C=c;return a.open&&s&&c&&l&&(s-h>c-f?(p=s,C=l.height):(C=c,p=l.width)),e("div",{className:z("ff-spreadsheet-floating-rect",{[`ff-spreadsheet-floating-rect--${i}`]:i,"ff-spreadsheet-floating-rect--dragging":n,"ff-spreadsheet-floating-rect--hidden":r}),style:{width:(p??0)+1,height:(C??0)+1,top:d,left:u}})},dv=({scrollPos:t={top:0,left:0}})=>{const n=Gg(e=>e.selected),i=Gg(e=>e.dragging),o=Gg(e=>e.selected.size(e.model.data)<2),a=Gg(e=>n&&jm(e.rowDimensions,e.columnDimensions,e.model.data,e.selected)),l=r.useMemo(()=>{if(a)return{...a,top:a.top-1,left:a.left-1,height:a.height-1,width:a.width-1}},[a,t]);return e(cv,{variant:"selected",dimensions:l,dragging:i,hidden:o||!a})},uv=({scrollPos:t={top:0,left:0}})=>{const n=Gg(e=>e.copied),i=null===n,o=Gg(e=>n&&Zm(e.rowDimensions,e.columnDimensions,n)),a=r.useMemo(()=>{if(o)return{...o,top:o.top-1,left:o.left-1,height:o.height-1,width:o.width-1}},[o,t]);return e(cv,{variant:"copied",dimensions:a,hidden:i||!o,dragging:!1})},fv=i.forwardRef(({getColorValue:t,disabled:n,initialColor:r},o)=>{const l=a(null);i.useImperativeHandle(o,()=>l.current);const[s,d]=c(r);return e("div",{className:z("ff-excel-color-selector",{"color-selector-disabled":n}),style:{backgroundColor:s},onClick:()=>{l.current&&!n&&l.current.click()},children:e("input",{type:"color",disabled:n,className:z("ff-excel-color-selector-picker",{"color-selector-disabled":n}),ref:l,onChange:e=>{d(e.target.value),t(e.target.value.replace("#",""))}})})});fv.displayName="ColorBarSelector";const hv=e=>{switch(e.toUpperCase()){case"LEFT":default:return"left";case"RIGHT":return"right";case"CENTER":return"center";case"JUSTIFY":return"justify";case"BOTTOM":return"end";case"TOP":return"start"}},pv=e=>{switch(e){case"left":return"LEFT";case"right":return"RIGHT";case"center":return"CENTER";case"justify":return"JUSTIFY";case"end":default:return"BOTTOM";case"start":return"TOP"}},Cv=e=>Gm.reduce((t,n)=>Math.abs(n-parseFloat(e))<Math.abs(t-parseFloat(e))?n:t);function mv(e){const{border:t}=e;let n="",r="",i="",o="";return"THIN"!==t.top&&(n="MEDIUM"===t.top?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.right&&(r="MEDIUM"===t.right?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.bottom&&(i="MEDIUM"===t.bottom?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==t.left&&(o="MEDIUM"===t.left?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),{fontSize:Um(Cv(String(e.size))),fontFamily:(a=e.name,Qm.some(e=>e.label===a)?a:"Poppins"),color:`#${e.color}`,backgroundColor:`#${e.backgroundColor}`,fontWeight:e.bold?"bold":"normal",fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":"normal",borderTop:n,borderRight:r,borderBottom:i,borderLeft:o,textAlign:hv(e.alignment.horizontal),alignContent:hv(e.alignment.vertical)};var a}const gv=e=>{if(!e||"none"===e)return"THIN";if(e.includes("solid")||e.includes("dashed")||e.includes("dotted")){if(e.includes("2px")||e.includes("medium"))return"MEDIUM";if(e.includes("3px")||e.includes("medium"))return"THICK"}return"THIN"},vv=e=>({name:e.fontFamily||"Arial",size:qm(e.fontSize?.toString()||"12"),bold:"bold"===e.fontWeight,italic:"italic"===e.fontStyle,underline:"underline"===e.textDecoration,color:e.color?.replace("#","")||"000000",backgroundColor:e.backgroundColor?.replace("#","")||"FFFFFF",borderColor:"F2F2F2",border:{top:gv(e.borderTop?e.borderTop.toString():void 0),right:gv(e.borderRight?e.borderRight.toString():void 0),bottom:gv(e.borderBottom?e.borderBottom.toString():void 0),left:gv(e.borderLeft?e.borderLeft.toString():void 0)},alignment:{horizontal:pv(e.textAlign),vertical:pv(e.alignContent),wrapText:!1}}),yv=({toolbar:t="show",editable:r,onBold:i,onItalic:o,setUnderlineType:s,setColor:d,setFontSize:u,setFontFamily:f,setTextAlign:h,setBackgroundColor:p,setBorderType:C,setFormatePainter:m})=>{const g=Gg(e=>e.selected instanceof bm),[v,y]=c("disable"===t||!r),w=Gg(e=>e.active?rm(e.active,e.model.data):null),b=Gg(e=>e.model.data),E=Gg(e=>e.formattedStyle.open),M={...Wm.style,color:"#1e161f",backgroundColor:"#ffffff",borderColor:"#1e161f"},[A,x]=c(w?.style||M),L=a(null);l(()=>{w?.style&&JSON.stringify(w.style)!==JSON.stringify(A)&&x(w?.style||M),g?y(!r):w&&"boolean"==typeof w.readOnly&&y(w.readOnly||"disable"===t||!r||"dropDown"===w?.inputType?.type)},[w,r]);const k=vv(A),[H,S]=c("border-none"),[_,V]=c({label:"",value:""}),[O,z]=c({label:"",value:""}),[N,T]=c({color:M.color,backgroundColor:M.backgroundColor,borderColor:M.borderColor}),I=[{value:"border-all-sides",label:"All Border",icon:"all_borders"},{value:"border-bottom",label:"Border Bottom",icon:"border_bottom"},{value:"border-left",label:"Border Left",icon:"border_left"},{value:"border-right",label:"Border Right",icon:"border_right"},{value:"border-top",label:"Border Top",icon:"border_top"},{value:"border-none",label:"No Border",icon:"no_border"}],D=Gm.map(e=>({label:e,value:e})),Z=a(null),j=a(null);l(()=>{let e=setTimeout(()=>{d(b,N.color)},0);return()=>{clearTimeout(e)}},[N.color]),l(()=>{let e=setTimeout(()=>{p(b,N.backgroundColor)},0);return()=>{clearTimeout(e)}},[N.backgroundColor]);return l(()=>{const e=A.fontFamily,t=`${qm(A.fontSize)}`;V({label:e??"Times New Roman",value:e??"Times New Roman"}),z({label:t??"11",value:t??"11"})},[A]),n("div",{className:"ff-excel-toolbar",children:[n("div",{className:"ff-excel-toolbar-font ",children:[e("div",{className:"ff-excel-toolbar-font-family",children:e(lr,{disabled:v,height:24,tooltip:!0,showToolTip:!0,showLabel:!1,optionZIndex:2e3,onChange:e=>{V({label:e.label,value:e.label}),f(b,e.value)},required:!1,optionsList:Qm,selectedOption:_})}),e("div",{className:"ff-excel-toolbar-font-size",children:e(lr,{disabled:v,height:24,showLabel:!1,optionZIndex:2e3,required:!1,onChange:e=>{z({label:e.label,value:e.value}),u(b,e.value)},optionsList:D,selectedOption:O})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(K,{placement:"top",title:"Text Left",children:e(P,{disabled:v,variant:"left"===A.textAlign?"dark":"light",hoverEffect:"left"!==A.textAlign,onClick:()=>h(b,"left"),name:"text_align_left"})}),e(K,{placement:"top",title:"Text Center",children:e(P,{disabled:v,variant:"center"===A.textAlign?"dark":"light",hoverEffect:"center"!==A.textAlign,onClick:()=>h(b,"center"),name:"text_align_center"})}),e(K,{placement:"top",title:"Text Right",children:e(P,{disabled:v,variant:"right"===A.textAlign?"dark":"light",hoverEffect:"right"!==A.textAlign,onClick:()=>h(b,"right"),name:"text_align_right"})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-text",children:[e(K,{placement:"top",title:"Bold",children:e(P,{disabled:v,variant:k.bold?"dark":"light",hoverEffect:!k.bold,onClick:()=>i(b),name:"bold"})}),e(K,{placement:"top",title:"Italic",children:e(P,{disabled:v,variant:k.italic?"dark":"light",hoverEffect:!k.italic,onClick:()=>o(b),name:"italic"})}),e(K,{placement:"top",title:"Underline",children:e("div",{className:"ff-excel-toolbar-icon-underline",children:e(P,{disabled:v,variant:"underline"===A.textDecoration?"dark":"light",hoverEffect:"underline"!==A.textDecoration,onClick:()=>s(b),name:"underline"})})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon",children:[e(K,{placement:"top",title:"Format Painter",children:e(P,{disabled:v,variant:E?"dark":"light",hoverEffect:!E,onClick:()=>{m(b)},name:"formate_painter"})}),e(K,{placement:"top",title:"Text Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(P,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{d(b,N.color),Z.current?.click()},name:"text_color"}),e(fv,{ref:Z,disabled:v,getColorValue:e=>{T(t=>({...t,color:e}))},initialColor:N.color})]})}),e(K,{placement:"top",title:"Background Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(P,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{p(b,N.backgroundColor),j.current?.click()},name:"fill_color"}),e(fv,{ref:j,disabled:v,getColorValue:e=>{T(t=>({...t,backgroundColor:e}))},initialColor:N.backgroundColor})]})})]}),e("div",{className:"ff-excel-toolbar-divider"}),e("div",{className:"ff-excel-toolbar-menu",children:n("div",{className:"ff-excel-toolbar-menu-option",children:[e(K,{placement:"top",title:"Border Type",children:e(P,{hoverEffect:!0,disabled:v,onClick:()=>C(b,H,"var(--input-hover-border-color)"),name:(()=>{const e=I.find(e=>e.value===H);return e?e.icon:""})()})}),e("span",{ref:L,children:e(hr,{disabled:v,iconName:"arrow_down",targetRef:L,iconSize:12,zIndex:2e3,options:I,tooltipTitle:"Border Type",tooltipPlacement:"top",onOptionClick:e=>{let t=e.value;C(b,t,"var(--input-hover-border-color)"),S(t)}})})]})})]})},wv=(e,t)=>{let n,r=null;const i=function(...i){const o=this;null===r||Date.now()-r>=t?(e.apply(o,i),r=Date.now()):(n&&clearTimeout(n),n=setTimeout(()=>{e.apply(o,i),r=Date.now()},t-(Date.now()-r)))};return i.cancel=()=>{n&&clearTimeout(n),n=null,r=null},i},bv=r.forwardRef(function(t,i){const{className:o,columnLabels:a=[],rowLabels:l=[],toolbar:s,editable:c,onKeyDown:d,Table:u=Ug,Row:f=qg,sheetHeight:h,HeaderRow:p=Wg,DataEditor:C=lv,DataViewer:m=iv,onSelect:g=()=>{},onActivate:v=()=>{},onEvaluatedDataChange:y=()=>{},contextOption:w,attachmentAction:b,workRef:E,minimumColumnWidth:M,setContextMenu:A,maxRowLimit:x,maxColLimit:L,disableDeleteOption:k,contextMenu:H,getActiveCell:S,onAddColumn:_,onDeleteColumn:V}=t,O=M||100,N=r.useRef(!1),T=Gg(e=>e.model.data),[I,D]=r.useState(!1),[Z,j]=r.useState(0),[R,B]=r.useState(0),[P,F]=r.useState({top:0,left:0}),[U,q]=r.useState(!1),[W,Q]=r.useState(!1),G=r.useMemo(()=>{const e=t.createFormulaParser||Jm,n=new rg(e,t.data);return D(e=>!e),{...Hg,model:n,selected:t.selected||Hg.selected}},[t.createFormulaParser,t.data,t.selected]),K=r.useReducer(Sg,G),[Y,X]=K,J=r.useMemo(()=>function(e,t,n){const{columns:r,rows:i}=um(e);return{rows:t?Math.max(i,t.length):i,columns:n?Math.max(r,n.length):r}}(Y.model.data,l,a),[Y.model.data,l,a]),[$,ee]=r.useState({start:0,end:Math.min(20,J.rows)}),[te,ne]=r.useState({start:0,end:Math.min(15,J.columns)}),re=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.rowDimensions[n]?.height||32;return t},[Y.rowDimensions,32]),ie=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.columnDimensions[n]?.width||O;return t},[Y.columnDimensions,O]);r.useEffect(()=>{X(function(e){return{type:wC,payload:{minimumColumnWidth:e}}}(M))},[M]);const oe=re(J.rows),ae=ie(J.columns),le=re($.start),se=oe-re($.end),ce=ie(te.start),de=ae-ie(te.end),ue=Y.mode,fe=r.useRef(null),he=e=>r.useCallback((...t)=>X(e(...t)),[e]),pe=he(AC),Ce=he(tm),me=he(em),ge=he(nm),ve=he(YC),ye=he(XC),we=he(FC),be=he(JC),Ee=he($C),Me=he(UC),Ae=he(qC),xe=he(WC),Le=he(kC),ke=he(HC),He=he(_C),Se=he(zC),_e=he(VC),Ve=he(OC),Oe=he(SC),ze=he(NC),Ne=he(TC),Te=he(IC),Ie=he(MC),De=he(DC),Ze=he(ZC),je=he(jC),Re=he(RC),Be=he(BC),Pe=he(PC);r.useImperativeHandle(i,()=>({removeSelect:ge}));const Fe=r.useRef(Y.active);r.useEffect(()=>{if(Y.active!==Fe.current)if(Y.active)v(Y.active);else{const e=E.current;e&&Pm(e)&&document.activeElement&&document.activeElement.blur()}Fe.current=Y.active},[v,Y.active]);const Ue=r.useRef(Y.model.evaluatedData);r.useEffect(()=>{Y?.model?.evaluatedData!==Ue?.current&&y(Y?.model?.evaluatedData),Ue.current=Y.model.evaluatedData},[Y?.model?.evaluatedData,y]);const qe=r.useRef(Y.selected);r.useEffect(()=>{Y.selected.equals(qe.current)||t.selected&&Y.selected.equals(t.selected)||g(Y.selected),qe.current=Y.selected},[Y.selected,g,t.selected]);const We=r.useRef(t.selected);r.useEffect(()=>{t.selected&&We.current&&!t.selected.equals(We.current)&&xe(t.selected),We.current=t.selected},[t.selected,xe]);let Qe=r.useRef(t.data);r.useEffect(()=>{pe(c),t.data!==Qe.current&&Me(t.data),Qe.current=t.data},[t.data,Me,c]);const Ge=r.useRef(t.createFormulaParser);r.useEffect(()=>{t.createFormulaParser!==Ge.current&&t.createFormulaParser&&Ae(t.createFormulaParser),Ge.current=t.createFormulaParser},[t.createFormulaParser,Ae]);const Ke=r.useCallback(e=>{const{model:t,selected:n}=Y,{data:r}=t,i=n.toRange(r);if(i){!function(e,t){e.clipboardData?.setData(Hm,t)}(e,Rm(function(e,t,n){const r=[],i=t.column-e.column;for(let o=e.row;o<=t.row;o++){const a=o-e.row;r[a]=r[a]||Array(i);for(let i=e.column;i<=t.column;i++)r[a][i-e.column]=rm({row:o,column:i},n)}return r}(i.start,i.end,r)))}},[Y]),Ye=r.useCallback(e=>{Bm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),Ke(e),Ce())},[ue,Ke,Ce]),Xe=r.useCallback(e=>{Bm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),Ke(e),me())},[ue,Ke,me]),Je=r.useCallback(e=>{if(Bm(fe.current,ue)&&(e.preventDefault(),e.stopPropagation(),e.clipboardData)){const t=function(e){return window.clipboardData&&window.clipboardData.getData?window.clipboardData.getData("Text"):e.clipboardData&&e.clipboardData.getData?e.clipboardData.getData(Hm):""}(e);ve(t)}},[ue,ve]),$e=r.useCallback(e=>{e.persist();const t=e.ctrlKey||e.metaKey,n=e.key.toLowerCase();t&&"b"===n?(e.preventDefault(),Le(T)):t&&"i"===n?(e.preventDefault(),ke(T)):t&&"u"===n&&(e.preventDefault(),He(T)),d&&d(e),e.defaultPrevented||(function(e,t){return void 0!==Mg(e,t)}(Y,e)&&e.nativeEvent.preventDefault(),ye(e))},[Y,d,ye]),et=r.useCallback(()=>{Y.formattedStyle.open&&Y.active&&Ie(Y.active)},[Y]),tt=r.useCallback(()=>{Ee(),document.removeEventListener("mouseup",tt)},[Ee]),nt=r.useCallback(e=>{Y.dragging||1!==e.buttons||"view"!==ue||(be(),document.addEventListener("mouseup",tt))},[Y,be,tt,ue]),rt=r.useMemo(()=>rv(t.Cell||nv),[t.Cell,I,c]),it=r.useMemo(()=>Yg(t.CornerIndicator||Kg),[t.CornerIndicator,I]),ot=r.useMemo(()=>tv(t.RowIndicator||ev),[t.RowIndicator,I]),at=r.useMemo(()=>Xg(t.ColumnIndicator||Jg),[t.ColumnIndicator,I]);r.useEffect(()=>(document.addEventListener("cut",Ye),document.addEventListener("copy",Xe),document.addEventListener("paste",Je),()=>{document.removeEventListener("cut",Ye),document.removeEventListener("copy",Xe),document.removeEventListener("paste",Je)}),[Ye,Xe,Je]);const lt=e=>{const t=new ResizeObserver(e=>{const t=e[0];if(t&&fe.current){const e=t.target;if(e){const{clientWidth:t,clientHeight:n}=e;B(Math.min(fe.current.clientHeight,n)),j(Math.min(fe.current.clientWidth,t))}}}),n=e.current;n&&t.observe(n)},st=r.useCallback(e=>{const t=e.target,{scrollTop:n,clientHeight:r,scrollLeft:i,clientWidth:o}=t;F({top:n,left:i});let a=0;for(;a<J.rows&&re(a)<n;)a++;let l=a;for(;l<J.rows&&re(l)<n+r;)l++;a=Math.max(0,a-10),l=Math.min(J.rows,l+10),ee({start:a,end:l});const s=l===J.rows;q(s);let c=0;for(;c<J.columns&&ie(c)<i;)c++;let d=c;for(;d<J.columns&&ie(d)<i+o;)d++;c=Math.max(0,c-10),d=Math.min(J.columns,d+10),ne({start:c,end:d});const u=d===J.columns;Q(u),H.open&&A({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},[J.rows,J.columns,re,ie]),ct=r.useMemo(()=>wv(st,16),[st]),dt=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.rowDimensions?.[n]?.height||32;requestAnimationFrame(()=>{fe.current&&e>=J.rows-1&&fe?.current?.scrollTo({top:t+32,behavior:"smooth"})})})},ut=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.columnDimensions?.[n]?.width||O;requestAnimationFrame(()=>{fe.current&&e>=J.columns-1&&fe.current.scrollTo({left:t+60,behavior:"smooth"})})})};r.useEffect(()=>{N.current||(ee({start:0,end:Math.min(20,J.rows)}),ne({start:0,end:Math.min(15,J.columns)}))},[J.rows,J.columns,N.current]);const ft=Sm($.end,$.start),ht=Sm(te.end,te.start),pt=n("colgroup",{children:[e("col",{style:{width:"60px"}},"row-indicator")," ",e("col",{style:{width:`${ce}px`}},"left-spacer")," ",ht.map(t=>e("col",{style:{width:`${Y.columnDimensions[t]?.width||O}px`}},t)),e("col",{style:{width:`${de}px`}},"right-spacer")," "]}),Ct=r.useMemo(()=>n(u,{useTableRef:lt,totalWidth:ae,children:[pt,n("tbody",{children:[n(p,{children:[e(it,{}),e("div",{className:"spacer left"}),ht.map(n=>e(at,{column:n,minimumColumnWidth:M,setContextMenu:t.setContextMenu,label:n in a?a[n]:void 0,deleteColumn:Pe,addColumnLeft:je,addColumnRight:Re,columnContextEnable:t.columnContextEnable,maxColLimit:L,disableDeleteOption:k,contextMenu:H,onAddColumn:_,onDeleteColumn:V,setVisibleRange:ne,scrollToColumn:ut},n)),e("div",{className:"spacer right"})]}),e("tr",{style:{height:`${le}px`}}),ft.map(r=>n(f,{row:r,children:[e(ot,{label:r in l?l?.[r]:void 0,row:r,addRowTop:De,addRowBottom:Ze,deleteRow:Be,setContextMenu:t.setContextMenu,rowContextEnable:t.rowContextEnable,maxRowLimit:x,disableDeleteOption:k,contextMenu:H,setVisibleRange:ee,scrollToRow:dt},r),e("div",{className:"spacer left"}),ht.map(t=>e(rt,{row:r,column:t,DataViewer:m},t)),e("div",{className:"spacer right"})]},r)),e("tr",{style:{height:`${se}px`}})]})]}),[u,J.rows,J.columns,f,p,it,a,at,l,ot,rt,m,$,te,le,se,ce,de,Y.rowDimensions,Y.columnDimensions]),mt=r.useMemo(()=>e(sv,{attachmentAction:b,contextOption:w,getActiveCell:S,setContextMenu:t.setContextMenu,DataEditor:C,visibleRowRange:$,visibleColRange:te,maxHeight:R-64,maxWidth:Z-M,totalHeight:oe,totalWidth:ae,isAtBottom:U,isAtRight:W,scrollPos:P,editable:c},Y.active?`${Y.active.row}-${Y.active.column}`:"no-active"),[C,$,te,Y.active,R,Z,oe,ae,U,W,c]),gt=r.useMemo(()=>n("div",{className:"ff-excel-spreadsheet-container",children:[e("div",{style:{width:`${Z}px`},className:z("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),e("div",{style:{height:`${R}px`},className:z("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),"hide"!==s&&e("div",{className:"ff-excel-toolbar-container",children:e(yv,{editable:c,toolbar:s,onBold:Le,onItalic:ke,setUnderlineType:He,setColor:ze,setBorderType:Oe,setFontSize:_e,setFontFamily:Ve,setTextAlign:Se,setBackgroundColor:Ne,setFormatePainter:Te})}),n("div",{ref:fe,style:{height:h},className:z("ff-excel-spreadsheet",o),onKeyPress:we,onKeyDown:$e,onClick:et,onMouseMove:nt,onScroll:e=>ct(e),children:[Ct,mt,e(dv,{scrollPos:P}),e(uv,{scrollPos:P})]})]}),[o,we,$e,nt,Ct,mt,Z]);return e(Fg.Provider,{value:K,children:gt})}),Ev=({contextMenu:t,position:r,editable:i})=>{if(!t.open)return null;return i&&e("div",{onContextMenu:e=>{e.preventDefault(),e.stopPropagation()},className:"ff-excel-menu",style:{left:r.x,top:r.y,position:"absolute",zIndex:9999999999},children:t.options.map(t=>{if(!t.visible){const i=t.disable;return e(K,{title:i?t.disableTooltip:"",children:n("div",{className:"ff-excel-menu-options "+(i?"disabled":""),onClick:()=>{i||t.action()},children:[t.iconName&&e(P,{name:t.iconName,height:16,width:16,color:(r=t.label,r.includes("Delete")?"var(--label-edit-error-text)":"var(--brand-color)"),disabled:i}),e(F,{as:"label",children:t.label})]})},t.label)}var r;return null})})},Mv=({excelData:r,contextOption:o,toolbar:s="show",sheetBar:d="show",rowCount:u=26,colCount:f=26,sheetHeight:h="100%",editable:p=!0,contextHeightPositioning:C=0,contextWidthPositioning:m=0,onSave:g=()=>Promise.resolve(),onSaveInfoChange:v,attachmentAction:y={addAttachment:()=>Promise.resolve(""),deleteAttachment:()=>Promise.resolve(""),viewAttachment:()=>Promise.resolve()},onSaveDelay:w=3e3,scroller:b=!1,columnContextEnable:E=!0,rowContextEnable:M=!0,sheetBarContextEnable:A=!0,minimumColumnWidth:x=100,disableDeleteOption:L=!1,maxRowLimit:k=1/0,maxColLimit:H=1/0,maxSheetLimit:S=1/0,getActiveCell:_=()=>{}})=>{const V=a(null),[O,N]=c([]),[T,I]=c(""),[D,Z]=i.useState({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",disable:!1,visible:!1}]}),[j,R]=c({name:"defaultSheet",index:0}),[B,U]=c({defaultSheet:[[Wm]]}),[q,W]=c([[Wm]]),[Q,Y]=c((g.length,{})),[X,J]=c({x:0,y:0}),$=a(""),ee=a(null),te=a(null),ne=a(null);l(()=>{const e=r;if(e){const t=e.map(e=>e.sheetName);N(t),G(t.length)||($.current=t[0]||"",R({name:t[0]||"",index:0}));const n={},r={};e.forEach(e=>{const t=e.sheetName,i=e.data,o=Math.max(u,i.length),a=Math.max(f,Math.max(...i.map(e=>e.length)));let l=Array.from({length:o},()=>Array(a).fill({value:"",style:Wm.style,readOnly:!1,inputType:void 0}));i.forEach((e,t)=>{e.forEach((e,n)=>{var r;t<o&&n<a&&(l[t]||(l[t]=[]),l[t][n]={value:(r=e.value,null==r?null:r),style:G(e?.style)?Wm.style:mv(e?.style),readOnly:!!e?.readOnly&&e?.readOnly,inputType:e?.inputType??void 0,contextDisable:e.contextDisable})})});const s=new Set([...e?.rows?.readOnly?e.rows.readOnly.map(e=>`r${e}`):[],...e?.columns?.readOnly?e.columns.readOnly.map(e=>`c${e}`):[],...e?.cells?.readOnly?e.cells.readOnly.map(([e,t])=>`${e},${t}`):[]]);if(l.forEach((t,n)=>{t.forEach((t,r)=>{l[n]||(l[n]=[]);const i=s.has(`r${n+1}`)||s.has(`c${r+1}`)||s.has(`${n+1},${r+1}`),o=((t,n,r)=>r?.inputType?r.inputType:e?.rows?.inputType?.[t+1]||e?.columns?.inputType?.[n+1]||e?.cells?.inputType?.[`${t+1},${n+1}`]||{type:"text"})(n,r,t||Wm);l[n][r]={...t,value:t?.value??"",readOnly:t?.readOnly?t.readOnly:i,inputType:o,contextDisable:t?.contextDisable}})}),n[t]=l,g.length>1){const e=i[0]||[];r[t]=Array.from({length:a},(t,n)=>({newData:"",oldData:e[n]?.value||""}))}}),U(n),g.length>1&&Y(r);const i=Object.keys(n)[0];i&&void 0!==n[i]&&W(n[i])}},[r]),l(()=>{v&&v(T),"File saved"===T&&setTimeout(()=>{I("")},2e3)},[T]),l(()=>{I("Saving..."),re(le())},[B,$.current]);const re=i.useCallback(La(e=>{if(g.length>1){const t={...Q};O.forEach((n,r)=>{const i=(e[r].data[0]||[]).map(e=>e?.value||"");t[n]=(t[n]||[]).map((e,t)=>({...e,newData:i[t]||""}))}),Y(t);const n=O.map(e=>({sheetName:e,headers:t[e]||[]}));g(e,n)}else g(e);I("File saved")},w),[g,Q,O]),ae=i.useCallback(e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),e.stopPropagation(),re(le()))},[g]);i.useEffect(()=>(document.addEventListener("keydown",ae),()=>{document.removeEventListener("keydown",ae)}),[ae]);const le=()=>O.map(e=>{const t=B[e]?.map(e=>{const t=e.reduce((e,t,n)=>""!==String(t?.value??"").trim()?n:e,-1),n=e.map((e,n)=>e&&e.style&&n<=t?{value:e.value,style:vv(e.style),readOnly:e.readOnly,inputType:e.inputType,contextDisable:e.contextDisable}:null).filter(e=>null!==e);return n.length>0?n:[]})||[],n=t.filter((e,n)=>{const r=t.slice(n+1).some(e=>e.length>0);return e.length>0||r});return{sheetName:e,data:G(n.length)?[[]]:n}}),[se,ce]=c(null),de=()=>O.length>=S,ue=()=>{if(de())return;const e=((e,t)=>{const n=t.map(e=>e.toLowerCase());let r=`${e}1`,i=2;for(;n.includes(r.toLowerCase());)r=`${e}${i}`,i++;return r})("Sheet",O),t=Array.from({length:u},()=>Array.from({length:f},()=>Wm));N(t=>[...t,e]),R({index:O?.length,name:e}),U({...B,[e]:t}),W(t),g.length>1&&Y(t=>({...t,[e]:Array.from({length:f},()=>({newData:"",oldData:""}))})),$.current=e},fe=(e=[[Wm]])=>{W(e)},he=(e,t,n)=>{const r=e.target;if(!r||r?.textContent?.trim()===n?.trim())return void ce(null);const i=(r.textContent||"").trim();if(!i)return Za.warning("Sheet name cannot be empty."),r.textContent=j.name,void ce(null);if(i.length>50)return Za.warning("The sheet name cannot be greater than 50 characters"),r.textContent=j.name,void ce(null);if(O.map(e=>e.toLowerCase()).includes(i.toLowerCase())&&n.trim()?.toLowerCase()!==i?.toLowerCase())return Za.warning("Sheet name already exists"),r.textContent=j.name,void ce(null);let o=O;fe(B?.[n]),o.splice(t,1,i);const a=function(e,t,n){if(!(t in e))throw new Error(`Key "${t}" not found in object`);const{[t]:r,...i}=e;return{...i,[n]:r??[]}}(B,n,i);$.current=i,R(e=>({...e,name:i})),U(a),g.length>1&&Y(e=>{const t={...e},r=t[n];return delete t[n],t[i]=r??[],t}),ce(null)};const pe=(e,t)=>{e!==j.name&&t!==j.index&&(R({index:t,name:e}),N(n=>{const r=[...n];return r[t]=e,r}),fe(B[e]),$.current=e)},Ce=i.useCallback((e,t=!1)=>{const n=e.target;(!n.closest(".ff-excel-tab-list")&&!n.closest(".ff-excel-sheet")||t)&&D.open&&(Z({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]}),t||(e.preventDefault(),e.stopPropagation()))},[D.open]);i.useEffect(()=>(document.addEventListener("contextmenu",Ce),document.addEventListener("click",e=>Ce(e,!0)),()=>{document.removeEventListener("contextmenu",Ce),document.removeEventListener("click",e=>Ce(e,!0))}),[Ce]);const me=(e,t,n)=>{e.preventDefault();const r=[{label:"Add Sheet",value:"Add Sheet",iconName:"plus_icon",action:()=>ue(),disableTooltip:"Sheet limit reached",visible:!1,disable:de()},...L?[]:[{label:"Delete Sheet",value:"Delete Sheet",iconName:"delete",action:()=>((e,t)=>{if(O.length>1){let n=O.slice();n.splice(t,1);const r={...B};delete r[e];const i=Math.min(t,n.length-1);N(n),U(r),g.length>1&&Y(t=>{const n={...t};return delete n[e],n});const o=n[i]?n[i]:"";R({index:i,name:o}),fe(r?.[o]),$.current=o}else Za.warning("Cannot delete the last sheet.")})(t,n),disableTooltip:"",visible:!1,disable:!1}]];Z(e=>({...e,open:!0,contextType:"sheet",options:r}))};l(()=>{ne.current?.removeSelect()},[j.name]);return e(t,{children:O.length>0&&n("div",{ref:ee,className:"ff-excel",onContextMenu:e=>{e.preventDefault();const t=te.current?.parentElement?.getBoundingClientRect(),n=window.scrollX,r=window.scrollY;let i=e.clientX-(t?.left||0)+n,o=e.clientY-(t?.top||0)+r;const a=300,l=window.innerWidth,s=window.innerHeight,c=l-e.clientX,d=e.clientX,u=s-e.clientY,f=e.clientY;c<a&&d>=a?i=e.clientX-(t?.left||0)+n-150:i+=2,u<200&&f>=200?o=e.clientY-(t?.top||0)+r-20:o+=2,e.target.classList.contains("ff-excel-tab-list")?J({x:i,y:o-(L?32:65)}):(i+a>l&&(i=l-a-2),i<0&&(i=2),J({x:i+m,y:o+C}))},onClick:e=>{e.stopPropagation(),D.open&&Z({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},children:[e("div",{ref:te,className:"ff-excel-sheet",children:e(bv,{ref:ne,editable:p,attachmentAction:y,toolbar:s,sheetHeight:h,setContextMenu:Z,contextOption:o,data:q,columnContextEnable:E,rowContextEnable:M,minimumColumnWidth:x,onEvaluatedDataChange:e=>{U(t=>({...t,[$.current]:e}))},workRef:ee,scroller:b,maxRowLimit:k,maxColLimit:H,disableDeleteOption:L,contextMenu:D,getActiveCell:_,onAddColumn:(e,t)=>{g.length>1&&Y(n=>{const r=j.name,i=[...n[r]||[]],o=t?e:e+1;return i.splice(o,0,{newData:"",oldData:""}),{...n,[r]:i}})},onDeleteColumn:e=>{g.length>1&&Y(t=>{const n=j.name,r=[...t[n]||[]];return r.splice(e,1),{...t,[n]:r}})}},j.name)}),"hide"!==d&&n("div",{className:"ff-excel-sheet-bar",children:["show"===d&&n("div",{className:"ff-excel-add-sheet-set",children:[e(K,{title:de()?"Sheet limit reached":"Add Sheet",placement:"top",children:e(P,{disabled:!p||de(),className:"ff-excel-add-sheet-icon",hoverEffect:!0,onClick:ue,name:"plus_icon",height:20,width:20})}),e(hr,{options:(t=>t.map((t,r)=>({label:n("div",{style:{display:"flex",gap:"8px"},children:[j?.name===t?e(P,{height:16,width:16,name:"tick"}):e("div",{style:{height:"16px",width:"24px"}}),e(K,{title:oe(t,20,"count")?t:"",children:e(F,{children:ie(t,20,"count")})})]}),name:r,value:t})))(O),targetRef:V,onOptionClick:e=>{const{value:t,name:n=""}=e;pe(t,parseInt(n))},dropdownPlacement:"top",iconName:"show_script",tooltipTitle:"All Sheets",tooltipPlacement:"top",dropdownHeight:215,selectedValue:j.name})]}),e("div",{className:"ff-excel-tab-container",children:O.map((t,n)=>e(F,{lineHeight:"16px",children:e("div",{onContextMenu:e=>{pe(t,n),A&&me(e,t,n)},className:z("ff-excel-tab-list",{active:t===j.name}),onClick:()=>{pe(t,n)},suppressContentEditableWarning:se===n,onDoubleClick:e=>{"show"===d&&(ce(n),null===se&&setTimeout(()=>(e=>{const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n?.removeAllRanges(),n?.addRange(t)})(e.target),0))},contentEditable:p&&se===n,onBlur:e=>{he(e,n,t)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),he(e,n,t))},children:t})},t))})]}),D.open&&e(Ev,{contextMenu:D,position:X,editable:p}),e(Da,{})]})})},Av=({label:t="",isActive:n=!0,onClick:r=()=>{},isFilterChip:i=!1})=>{const o=i?"filter":"module";return e("div",{className:z("ff-module-chip",{"ff-filter-chip":i,[`ff-${o}-chip--active`]:n,[`ff-${o}-chip--hover`]:!n}),onClick:r,children:e(F,{lineHeight:"18px",className:"module-typography",children:t})})},xv=({x:e,y:t,radius:n,startAngle:r,endAngle:i})=>{const o=e+n*Math.cos(r),a=t+n*Math.sin(r),l=e+n*Math.cos(i),s=t+n*Math.sin(i),c=i-r>Math.PI?1:0;return i-r>=2*Math.PI?`\n M ${e+n} ${t}\n A ${n} ${n} 0 1 1 ${e-n} ${t} \n A ${n} ${n} 0 1 1 ${e+n} ${t}\n `:`M ${o} ${a} A ${n} ${n} 0 ${c} 1 ${l} ${s}`},Lv=({radius:t=15,lineWidth:r=5,label:i,percentageValue:o,icon:l,fontSize:s=10,labelColor:d="",arcColor:u="var(--brand-color)",backgroundArcColor:f="var(--ff-select-scroll-thumb-color)",isSelectedArch:h=!1,onSelect:p})=>{const[C,m]=c({x:0,y:0}),[g,v]=c(!1),y=a(null);let w=-Math.PI/2;const b=2*(t+r),{backgroundArcPath:E,foregroundArcPath:M}=((e,t,n)=>{const r=t,i=r+Math.max(0,Math.min(e,100))/100*2*Math.PI;return{backgroundArcPath:xv({x:0,y:0,radius:n,startAngle:0,endAngle:2*Math.PI}),foregroundArcPath:xv({x:0,y:0,radius:n,startAngle:r,endAngle:i})}})(o,w,t),A=()=>{v(!0)},x=()=>{m({x:0,y:0}),v(!1)},L=e=>{if(y.current){const t=y.current.getBoundingClientRect();m({x:e.clientX-t.left,y:e.clientY-t.top})}};return n("div",{ref:y,className:"ff-icon-radial-chart-container",style:{"--fontSize":`${s}px`},onClick:p,children:[e("svg",{width:b,height:b,viewBox:`0 0 ${b} ${b}`,role:"img",children:n("g",{transform:`translate(${t+r}, ${t+r})`,children:[e("path",{d:E,fill:"none",stroke:f,strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),e("path",{d:M,fill:"none",stroke:u,strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),h&&e("path",{d:M,fill:"none",stroke:"var(--dotted-border-color)",strokeOpacity:"0.4",strokeWidth:r,onMouseEnter:A,onMouseLeave:x,onMouseMove:L}),l?e("foreignObject",{x:"-10",y:"-10",width:"20",height:"20",children:e(P,{className:"ff-radial-chart-icon-padding",name:l,height:20,width:20})}):e("text",{x:"0",y:"0",fill:d||u,textAnchor:"middle",dominantBaseline:"central",children:`${Math.round(o)}%`})]})}),g&&n("div",{className:"ff-icon-radial-chart-tooltip",style:{position:"absolute",left:`${C.x+15}px`,top:C.y-5+"px"},children:[e(F,{children:`${i} : `}),n(F,{children:[o,"%"]})]})]})},kv=({mediaSrc:t,fileId:r,onExpandClick:i,onDeleteClick:o,onDownloadClick:a,height:l="75px",width:s="79px",fileName:c,thumbnailMediaSrc:d,isDelete:u})=>e("div",{className:"ff-attach-media-container",style:{height:l,width:s},children:n("div",{className:"ff-media-wrapper",style:{height:l,width:s},children:[e("img",{src:d||t,alt:"Attached"}),n("div",{className:"ff-hover-icons",children:[n("div",{className:"ff-top-icons",children:[e("div",{className:"ff-icon-container",children:e(K,{title:"Download File",placement:"bottom",children:e(P,{name:"download_file_icon",height:10,width:10,onClick:a,color:"var(--icons-default-color)"})})}),u&&e("div",{className:"ff-icon-container",children:e(K,{title:"Delete",placement:"bottom",children:e(P,{name:"delete",height:10,width:10,color:"var(--ff-delete-button-attachment)",onClick:()=>{o&&o(r)}})})})]}),e("div",{className:"ff-expand-icon-container",children:e(K,{title:"Maximize",placement:"bottom",children:e(P,{name:"expand_icon",height:16,width:16,onClick:i})})})]}),e(F,{color:"var(--text-area-default-color)",fontWeight:"medium",className:"ff-media-text",children:c})]})}),Hv=({icon:r,status:i,count:o,text:a,style:s={width:"196.4px"},resetToggle:d,onSelectedStatus:u=e=>{}})=>{const[f,h]=c(!1),p=["total defects","defect density","open defects","closed defects","quality score"],C=p.includes(i.toLowerCase()),m=p.includes(i.toLowerCase());l(()=>{h(!d)},[d]);return n("div",{className:`ff-card-container ${i.toLowerCase()} ${f?"toggled":""}`,style:s,onClick:()=>(e=>{p.includes(e.toLowerCase())||(h(!0),u(e))})(i),children:[n("div",{className:"ff-status-bar",children:[e("div",{children:e(P,{name:r,height:20,width:20,hoverEffect:!1})}),!p.includes(i.toLowerCase())&&e(F,{fontWeight:"semi-bold",fontSize:"10px",textAlign:"center",lineHeight:"15px",className:"ff-status-text",as:"div",children:i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()})]}),e("div",{className:"ff-content "+(m?"red-background":""),children:n(t,C?{children:[e(F,{fontWeight:"semi-bold",fontSize:"10px",className:"ff-text",lineHeight:"15px",color:"var(--ff-chip-text-color)",children:a}),e(F,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"36px",children:"defect density"===i.toLowerCase()?n(t,{children:[o.toString().padStart(2,"0"),e(F,{fontSize:"15px",fontWeight:"semi-bold",children:"/ Modules"})]}):"quality score"===i.toLowerCase()?`${parseFloat(o.toString()).toFixed(2)}%`:o.toString().padStart(2,"0")})]}:{children:[e(F,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"24px",color:f?"var(--base-bg-color)":"",children:o.toString().padStart(2,"0")}),e(F,{className:"ff-text",lineHeight:"18px",color:f?"var(--base-bg-color)":"var(--ff-chip-text-color)",children:a})]})})]})},Sv=({option:t})=>{const r=a(null),[i,o]=c(!1);l(()=>{const e=r.current;if(!e)return;const t=()=>{o(e.scrollWidth>e.clientWidth)},n=requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{cancelAnimationFrame(n),window.removeEventListener("resize",t)}},[t]);const s={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},d=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;return n("div",{style:{width:"-webkit-fill-available"},className:"ff-variable-option ff-variable-data",children:[e(K,{title:i?d(t):"",style:{width:"calc(100% - 32px)"},children:e("span",{ref:r,className:"ff-truncated_text",children:d(t)})}),e(P,{name:(e=>{if(!e)return"";const t=e._id||e.id;return t?.startsWith("PARAMETER")?"step_group_parameter":"LOCAL"===e.type&&"STEPGROUP"===e?.parentVariableType?"step_group_variable":"_startforloop"===e.type?"for_loop_variable":"DATAPROVIDER"===e.type?"data_provider_variable":s[e.type||""]||""})(t),height:24,width:24,hoverEffect:!0})]})};function _v(e){return()=>e}function Vv(e){e()}function Ov(e,t){return n=>e(t(n))}function zv(e,t){return()=>e(t)}function Nv(e){return void 0!==e}function Tv(){}function Iv(e,t){return t(e),e}function Dv(e,t){return t(e)}function Zv(...e){return e}function jv(e,t){return e(1,t)}function Rv(e,t){e(0,t)}function Bv(e){e(2)}function Pv(e){return e(4)}function Fv(e,t){return jv(e,function(e,t){return n=>e(t,n)}(t,0))}function Uv(e,t){const n=e(1,e=>{n(),t(e)});return n}function qv(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Wv(e,t){return e===t}function Qv(e=Wv){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Gv(e){return t=>n=>{e(n)&&t(n)}}function Kv(e){return t=>Ov(t,e)}function Yv(e){return t=>()=>{t(e)}}function Xv(e,...t){const n=function(...e){return t=>e.reduceRight(Dv,t)}(...t);return(t,r)=>{switch(t){case 2:return void Bv(e);case 1:return jv(e,n(r))}}}function Jv(e,t){return n=>r=>{n(t=e(t,r))}}function $v(e){return t=>n=>{e>0?e--:t(n)}}function ey(e){let t,n=null;return r=>i=>{n=i,!t&&(t=setTimeout(()=>{t=void 0,r(n)},e))}}function ty(...e){const t=new Array(e.length);let n=0,r=null;const i=Math.pow(2,e.length)-1;return e.forEach((e,o)=>{const a=Math.pow(2,o);jv(e,e=>{const l=n;n|=a,t[o]=e,l!==i&&n===i&&r&&(r(),r=null)})}),e=>o=>{const a=()=>{e([o].concat(t))};n===i?a():r=a}}function ny(e){let t=e;const n=iy();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function ry(e,t){return Iv(ny(t),t=>Fv(e,t))}function iy(){const e=[];return(t,n)=>{switch(t){case 0:return void e.slice().forEach(e=>{e(n)});case 2:return void e.splice(0,e.length);case 1:return e.push(n),()=>{const t=e.indexOf(n);t>-1&&e.splice(t,1)}}}}function oy(e){return Iv(iy(),t=>Fv(e,t))}function ay(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ly(),singleton:n}}const ly=()=>Symbol();function sy(...e){const t=iy(),n=new Array(e.length);let r=0;const i=Math.pow(2,e.length)-1;return e.forEach((e,o)=>{const a=Math.pow(2,o);jv(e,e=>{n[o]=e,r|=a,r===i&&Rv(t,n)})}),function(e,o){switch(e){case 2:return void Bv(t);case 1:return r===i&&o(n),jv(t,o)}}}function cy(e,t=Wv){return Xv(e,Qv(t))}function dy(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(Vv)}}(...e.map(e=>jv(e,n)))}}}var uy=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(uy||{});const fy={0:"debug",3:"error",1:"log",2:"warn"},hy=ay(()=>{const e=ny(3);return{log:ny((t,n,r=1)=>{var i;r>=(null!=(i=(typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:Pv(e))&&console[fy[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function py(e,t,n){return Cy(e,t,n).callbackRef}function Cy(e,t,n){const r=i.useRef(null);let o=e=>{};const a=i.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(t=>{const r=()=>{const n=t[0].target;null!==n.offsetParent&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return o=e=>{e&&t?(null==a||a.observe(e),r.current=e):(r.current&&(null==a||a.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function my(e,t,n,r,o,a,l,s,c){const d=i.useCallback(n=>{const i=function(e,t,n,r){const i=e.length;if(0===i)return null;const o=[];for(let a=0;a<i;a++){const i=e.item(a);if(void 0===i.dataset.index)continue;const l=parseInt(i.dataset.index),s=parseFloat(i.dataset.knownSize),c=t(i,n);if(0===c&&r("Zero-sized element, this should not happen",{child:i},uy.ERROR),c===s)continue;const d=o[o.length-1];0===o.length||d.size!==c||d.endIndex!==l-1?o.push({endIndex:l,size:c,startIndex:l}):o[o.length-1].endIndex++}return o}(n.children,t,s?"offsetWidth":"offsetHeight",o);let c=n.parentElement;for(;!c.dataset.virtuosoScroller;)c=c.parentElement;const d="window"===c.lastElementChild.dataset.viewportType;let u;d&&(u=c.ownerDocument.defaultView);const f=l?s?l.scrollLeft:l.scrollTop:d?s?u.scrollX||u.document.documentElement.scrollLeft:u.scrollY||u.document.documentElement.scrollTop:s?c.scrollLeft:c.scrollTop,h=l?s?l.scrollWidth:l.scrollHeight:d?s?u.document.documentElement.scrollWidth:u.document.documentElement.scrollHeight:s?c.scrollWidth:c.scrollHeight,p=l?s?l.offsetWidth:l.offsetHeight:d?s?u.innerWidth:u.innerHeight:s?c.offsetWidth:c.offsetHeight;r({scrollHeight:h,scrollTop:Math.max(f,0),viewportHeight:p}),null==a||a(s?gy("column-gap",getComputedStyle(n).columnGap,o):gy("row-gap",getComputedStyle(n).rowGap,o)),null!==i&&e(i)},[e,t,o,a,l,r,s]);return Cy(d,n,c)}function gy(e,t,n){return"normal"!==t&&!(null!=t&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,uy.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}function vy(e,t,n){const r=i.useRef(null),o=i.useCallback(n=>{if(null==n||!n.offsetParent)return;const i=n.getBoundingClientRect(),o=i.width;let a,s;if(t){const e=t.getBoundingClientRect(),n=i.top-e.top;s=e.height-Math.max(0,n),a=n+t.scrollTop}else{const e=l.current.ownerDocument.defaultView;s=e.innerHeight-Math.max(0,i.top),a=i.top+e.scrollY}r.current={offsetTop:a,visibleHeight:s,visibleWidth:o},e(r.current)},[e,t]),{callbackRef:a,ref:l}=Cy(o,!0,n),s=i.useCallback(()=>{o(l.current)},[o,l]);return i.useEffect(()=>{var e;if(t){t.addEventListener("scroll",s);const e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener("scroll",s),e.unobserve(t)}}{const t=null==(e=l.current)?void 0:e.ownerDocument.defaultView;return null==t||t.addEventListener("scroll",s),null==t||t.addEventListener("resize",s),()=>{null==t||t.removeEventListener("scroll",s),null==t||t.removeEventListener("resize",s)}}},[s,t,l]),a}const yy=ay(()=>{const e=iy(),t=iy(),n=ny(0),r=iy(),i=ny(0),o=iy(),a=iy(),l=ny(0),s=ny(0),c=ny(0),d=ny(0),u=iy(),f=iy(),h=ny(!1),p=ny(!1),C=ny(!1);return Fv(Xv(e,Kv(({scrollTop:e})=>e)),t),Fv(Xv(e,Kv(({scrollHeight:e})=>e)),a),Fv(t,i),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:s,footerHeight:d,headerHeight:l,horizontalDirection:p,scrollBy:f,scrollContainerState:e,scrollHeight:a,scrollingInProgress:h,scrollTo:u,scrollTop:t,skipAnimationFrameInResizeObserver:C,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:o}},[],{singleton:!0}),wy={lvl:0};function by(e,t){const n=e.length;if(0===n)return[];let{index:r,value:i}=t(e[0]);const o=[];for(let a=1;a<n;a++){const{index:n,value:l}=t(e[a]);o.push({end:n-1,start:r,value:i}),r=n,i=l}return o.push({end:1/0,start:r,value:i}),o}function Ey(e){return e===wy}function My(e,t){if(!Ey(e))return t===e.k?e.v:t<e.k?My(e.l,t):My(e.r,t)}function Ay(e,t,n="k"){if(Ey(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Ay(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Ay(e.l,t,n)}function xy(e,t,n){return Ey(e)?Iy(t,n,1):t===e.k?Oy(e,{k:t,v:n}):t<e.k?Dy(Oy(e,{l:xy(e.l,t,n)})):Dy(Oy(e,{r:xy(e.r,t,n)}))}function Ly(){return wy}function ky(e,t,n){if(Ey(e))return[];return function(e){return by(e,({k:e,v:t})=>({index:e,value:t}))}(_y(e,Ay(e,t)[0],n))}function Hy(e,t){if(Ey(e))return wy;const{k:n,l:r,r:i}=e;if(t===n){if(Ey(r))return i;if(Ey(i))return r;{const[t,n]=Ty(r);return Vy(Oy(e,{k:t,l:zy(r),v:n}))}}return Vy(Oy(e,t<n?{l:Hy(r,t)}:{r:Hy(i,t)}))}function Sy(e){return Ey(e)?[]:[...Sy(e.l),{k:e.k,v:e.v},...Sy(e.r)]}function _y(e,t,n){if(Ey(e))return[];const{k:r,l:i,r:o,v:a}=e;let l=[];return r>t&&(l=l.concat(_y(i,t,n))),r>=t&&r<=n&&l.push({k:r,v:a}),r<=n&&(l=l.concat(_y(o,t,n))),l}function Vy(e){const{l:t,lvl:n,r:r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(Ny(t))return Zy(Oy(e,{lvl:n-1}));if(!Ey(t)&&!Ey(t.r))return Oy(t.r,{l:Oy(t,{r:t.r.l}),lvl:n,r:Oy(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(Ny(e))return jy(Oy(e,{lvl:n-1}));if(Ey(r)||Ey(r.l))throw new Error("Unexpected empty nodes");{const t=r.l,i=Ny(t)?r.lvl-1:r.lvl;return Oy(t,{l:Oy(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:jy(Oy(r,{l:t.r,lvl:i}))})}}function Oy(e,t){return Iy(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function zy(e){return Ey(e.r)?e.l:Vy(Oy(e,{r:zy(e.r)}))}function Ny(e){return Ey(e)||e.lvl>e.r.lvl}function Ty(e){return Ey(e.r)?[e.k,e.v]:Ty(e.r)}function Iy(e,t,n,r=wy,i=wy){return{k:e,l:r,lvl:n,r:i,v:t}}function Dy(e){return jy(Zy(e))}function Zy(e){const{l:t}=e;return Ey(t)||t.lvl!==e.lvl?e:Oy(t,{r:Oy(e,{l:t.r})})}function jy(e){const{lvl:t,r:n}=e;return Ey(n)||Ey(n.r)||n.lvl!==t||n.r.lvl!==t?e:Oy(n,{l:Oy(e,{r:n.l}),lvl:t+1})}function Ry(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function By(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}const Py=ay(()=>({recalcInProgress:ny(!1)}),[],{singleton:!0});function Fy(e,t,n){return e[Uy(e,t,n)]}function Uy(e,t,n,r=0){let i=e.length-1;for(;r<=i;){const o=Math.floor((r+i)/2),a=n(e[o],t);if(0===a)return o;if(-1===a){if(i-r<2)return o-1;i=o-1}else{if(i===r)return o;r=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function qy(e,t){return Math.round(e.getBoundingClientRect()[t])}function Wy(e){return!Ey(e.groupOffsetTree)}function Qy({index:e},t){return t===e?0:t<e?-1:1}function Gy({offset:e},t){return t===e?0:t<e?-1:1}function Ky(e,t,n){if(0===t.length)return 0;const{index:r,offset:i,size:o}=Fy(t,e,Qy),a=e-r,l=o*a+(a-1)*n+i;return l>0?l+n:l}function Yy(e,t){if(!Wy(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Xy(e,t,n){if(function(e){return typeof e.groupIndex<"u"}(e))return t.groupIndices[e.groupIndex]+1;{let r=Yy("LAST"===e.index?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}}function Jy(e,t,n,r=0){return r>0&&(t=Math.max(t,Fy(e,r,Qy).offset)),by(function(e,t,n,r){const i=Uy(e,t,r),o=Uy(e,n,r,i);return e.slice(i,o+1)}(e,t,n,Gy),nw)}function $y(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,uy.DEBUG);const o=e.sizeTree;let a=o,l=0;if(n.length>0&&Ey(o)&&2===t.length){const e=t[0].size,r=t[1].size;a=n.reduce((t,n)=>xy(xy(t,n,e),n+1,r),a)}else[a,l]=function(e,t){let n=Ey(e)?0:1/0;for(const r of t){const{endIndex:t,size:i,startIndex:o}=r;if(n=Math.min(n,o),Ey(e)){e=xy(e,0,i);continue}const a=ky(e,o-1,t+1);if(a.some(rw(r)))continue;let l=!1,s=!1;for(const{end:n,start:r,value:o}of a)l?(t>=r||i===o)&&(e=Hy(e,r)):(s=o!==i,l=!0),n>t&&t>=r&&o!==i&&(e=xy(e,t+1,o));s&&(e=xy(e,o,i))}return[e,n]}(a,t);if(a===o)return e;const{lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u}=tw(e.offsetTree,l,a,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>xy(e,t,Ky(t,u,i)),Ly()),lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u,sizeTree:a}}function ew(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function tw(e,t,n,r){let i=e,o=0,a=0,l=0,s=0;if(0!==t){s=Uy(i,t-1,Qy),l=i[s].offset;const e=Ay(n,t-1);o=e[0],a=e[1],i.length&&i[s].size===Ay(n,t)[1]&&(s-=1),i=i.slice(0,s+1)}else i=[];for(const{start:e,value:s}of ky(n,t,1/0)){const t=e-o,n=t*a+l+t*r;i.push({index:e,offset:n,size:s}),o=e,l=n,a=s}return{lastIndex:o,lastOffset:l,lastSize:a,offsetTree:i}}function nw(e){return{index:e.index,value:e}}function rw(e){const{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}const iw={offsetHeight:"height",offsetWidth:"width"},ow=ay(([{log:e},{recalcInProgress:t}])=>{const n=iy(),r=iy(),i=ry(r,0),o=iy(),a=iy(),l=ny(0),s=ny([]),c=ny(void 0),d=ny(void 0),u=ny(void 0),f=ny(void 0),h=ny((e,t)=>qy(e,iw[t])),p=ny(void 0),C=ny(0),m={groupIndices:[],groupOffsetTree:Ly(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ly()},g=ry(Xv(n,ty(s,e,C),Jv($y,m),Qv()),m),v=ry(Xv(s,Qv(),Jv((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),Kv(({prev:e})=>e)),[]);Fv(Xv(s,Gv(e=>e.length>0),ty(g,C),Kv(([e,t,n])=>{const r=e.reduce((e,r,i)=>xy(e,r,Ky(r,t.offsetTree,n)||i),Ly());return{...t,groupIndices:e,groupOffsetTree:r}})),g),Fv(Xv(r,ty(g),Gv(([e,{lastIndex:t}])=>e<t),Kv(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),Fv(c,d);const y=ry(Xv(c,Kv(e=>void 0===e)),!0);Fv(Xv(d,Gv(e=>void 0!==e&&Ey(Pv(g).sizeTree)),Kv(e=>{const t=Pv(u),n=Pv(s).length>0;return t?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),Fv(Xv(f,Gv(e=>void 0!==e&&e.length>0&&Ey(Pv(g).sizeTree)),Kv(e=>{const t=[];let n=e[0],r=0;for(let i=1;i<e.length;i++){const o=e[i];o!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=o,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),Fv(Xv(s,ty(u,d),Gv(([,e,t])=>void 0!==e&&void 0!==t),Kv(([e,t,n])=>{const r=[];for(let i=0;i<e.length;i++){const o=e[i],a=e[i+1];r.push({startIndex:o,endIndex:o,size:t}),void 0!==a&&r.push({startIndex:o+1,endIndex:a-1,size:n})}return r})),n);const w=oy(Xv(n,ty(g),Jv(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:m}),Kv(e=>e.changed)));jv(Xv(l,Jv((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),Kv(e=>e.diff)),e=>{const{groupIndices:n}=Pv(g);if(e>0)Rv(t,!0),Rv(o,e+ew(e,n));else if(e<0){const t=Pv(v);t.length>0&&(e-=ew(-e,t)),Rv(a,e)}}),jv(Xv(l,ty(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},uy.ERROR)});const b=oy(o);Fv(Xv(o,ty(g),Kv(([e,t])=>{const n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){const n=My(t.sizeTree,0);let o=0,a=0;for(;o<e;){const e=t.groupIndices[a],l=t.groupIndices.length===a+1?1/0:t.groupIndices[a+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+l-1,size:i,startIndex:e+1}),a++,o+=l+1}const l=Sy(t.sizeTree);return o!==e&&l.shift(),l.reduce((t,{k:n,v:r})=>{let i=t.ranges;return 0!==t.prevSize&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return Sy(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);const E=oy(Xv(a,ty(g,C),Kv(([e,{offsetTree:t},n])=>Ky(-e,t,n))));return Fv(Xv(a,ty(g,C),Kv(([e,t,n])=>{if(t.groupIndices.length>0){if(Ey(t.sizeTree))return t;let r=Ly();const i=Pv(v);let o=0,a=0,l=0;for(;o<-e;){l=i[a];const e=i[a+1]-l-1;a++,o+=e+1}if(r=Sy(t.sizeTree).reduce((t,{k:n,v:r})=>xy(t,Math.max(0,n+e),r),r),o!==-e){r=xy(r,0,My(t.sizeTree,l));r=xy(r,1,Ay(t.sizeTree,1-e)[1])}return{...t,sizeTree:r,...tw(t.offsetTree,0,r,n)}}{const r=Sy(t.sizeTree).reduce((t,{k:n,v:r})=>xy(t,Math.max(0,n+e),r),Ly());return{...t,sizeTree:r,...tw(t.offsetTree,0,r,n)}}})),g),{beforeUnshiftWith:b,data:p,defaultItemSize:d,firstItemIndex:l,fixedItemSize:c,fixedGroupSize:u,gap:C,groupIndices:s,heightEstimates:f,itemSize:h,listRefresh:w,shiftWith:a,shiftWithOffset:E,sizeRanges:n,sizes:g,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:o}},Zv(hy,Py),{singleton:!0});function aw(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}const lw=ay(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{const o=iy(),a=iy(),l=oy(Xv(o,Kv(aw)));return Fv(Xv(l,Kv(e=>e.totalCount)),n),Fv(Xv(l,Kv(e=>e.groupIndices)),e),Fv(Xv(sy(i,t,r),Gv(([e,t])=>Wy(t)),Kv(([e,t,n])=>Ay(t.groupOffsetTree,Math.max(e-n,0),"v")[0]),Qv(),Kv(e=>[e])),a),{groupCounts:o,topItemsIndexes:a}},Zv(ow,yy)),sw=ay(([{log:e}])=>{const t=ny(!1),n=oy(Xv(t,Gv(e=>e),Qv()));return jv(t,t=>{t&&Pv(e)("props updated",{},uy.DEBUG)}),{didMount:n,propsReady:t}},Zv(hy),{singleton:!0}),cw=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function dw(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!cw)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const uw=ay(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:o,footerHeight:a,headerHeight:l,scrollingInProgress:s,scrollTo:c,smoothScrollTargetReached:d,viewportHeight:u},{log:f}])=>{const h=iy(),p=iy(),C=ny(0);let m=null,g=null,v=null;function y(){m&&(m(),m=null),v&&(v(),v=null),g&&(clearTimeout(g),g=null),Rv(s,!1)}return Fv(Xv(h,ty(n,u,r,C,l,a,f),ty(e,o,i),Kv(([[e,n,r,i,o,a,l,c],u,f,C])=>{const w=dw(e),{align:b,behavior:E,offset:M}=w,A=i-1,x=Xy(w,n,A);let L=Ky(x,n.offsetTree,u)+a;"end"===b?(L+=f+Ay(n.sizeTree,x)[1]-r+C,x===A&&(L+=l)):"center"===b?L+=(f+Ay(n.sizeTree,x)[1]-r+C)/2:L-=o,M&&(L+=M);const k=t=>{y(),t?(c("retrying to scroll to",{location:e},uy.DEBUG),Rv(h,e)):(Rv(p,!0),c("list did not change, scroll successful",{},uy.DEBUG))};if(y(),"smooth"===E){let e=!1;v=jv(t,t=>{e=e||t}),m=Uv(d,()=>{k(e)})}else m=Uv(Xv(t,function(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}(150)),k);return g=setTimeout(()=>{y()},1200),Rv(s,!0),c("scrolling from index to",{behavior:E,index:x,top:L},uy.DEBUG),{behavior:E,top:L}})),c),{scrollTargetReached:p,scrollToIndex:h,topListHeight:C}},Zv(ow,yy,hy),{singleton:!0});function fw(e,t){0==e?t():requestAnimationFrame(()=>{fw(e-1,t)})}function hw(e,t){const n=t-1;return"number"==typeof e?e:"LAST"===e.index?n:e.index}const pw=ay(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:o},{didMount:a}])=>{const l=ny(!0),s=ny(0),c=ny(!0);return Fv(Xv(a,ty(s),Gv(([e,t])=>!!t),Yv(!1)),l),Fv(Xv(a,ty(s),Gv(([e,t])=>!!t),Yv(!1)),c),jv(Xv(sy(t,a),ty(l,n,e,c),Gv(([[,e],t,{sizeTree:n},r,i])=>e&&(!Ey(n)||Nv(r))&&!t&&!i),ty(s)),([,e])=>{Uv(i,()=>{Rv(c,!0)}),fw(4,()=>{Uv(r,()=>{Rv(l,!0)}),Rv(o,e)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:s,scrolledToInitialItem:l}},Zv(ow,yy,uw,sw),{singleton:!0});function Cw(e,t){return Math.abs(e-t)<1.01}const mw="up",gw="down",vw={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},yw=ay(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:o}])=>{const a=ny(!1),l=ny(!0),s=iy(),c=iy(),d=ny(4),u=ny(0),f=ry(Xv(dy(Xv(cy(i),$v(1),Yv(!0)),Xv(cy(i),$v(1),Yv(!1),qv(100))),Qv()),!1),h=ry(Xv(dy(Xv(n,Yv(!0)),Xv(n,Yv(!1),qv(200))),Qv()),!1);Fv(Xv(sy(cy(i),cy(u)),Kv(([e,t])=>e<=t),Qv()),l),Fv(Xv(l,ey(50)),c);const p=oy(Xv(sy(r,cy(o),cy(t),cy(e),cy(d)),Jv((e,[{scrollHeight:t,scrollTop:n},r,i,o,a])=>{const l={scrollHeight:t,scrollTop:n,viewportHeight:r};if(n+r-t>-a){let t,r;return n>e.state.scrollTop?(t="SCROLLED_DOWN",r=e.state.scrollTop-n):(t="SIZE_DECREASED",r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:l}}let s;return s=l.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":r<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":n<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:s,state:l}},vw),Qv((e,t)=>e&&e.atBottom===t.atBottom))),C=ry(Xv(r,Jv((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(Cw(e.scrollHeight,t))return{changed:!1,jump:0,scrollHeight:t,scrollTop:n};{const i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Gv(e=>e.changed),Kv(e=>e.jump)),0);Fv(Xv(p,Kv(e=>e.atBottom)),a),Fv(Xv(a,ey(50)),s);const m=ny(gw);Fv(Xv(r,Kv(({scrollTop:e})=>e),Qv(),Jv((e,t)=>Pv(h)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?mw:gw,prevScrollTop:t},{direction:gw,prevScrollTop:0}),Kv(e=>e.direction)),m),Fv(Xv(r,ey(50),Yv("none")),m);const g=ny(0);return Fv(Xv(f,Gv(e=>!e),Yv(0)),g),Fv(Xv(i,ey(100),ty(f),Gv(([e,t])=>t),Jv(([e,t],[n])=>[t,n],[0,0]),Kv(([e,t])=>t-e)),g),{atBottomState:p,atBottomStateChange:s,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:u,isAtBottom:a,isAtTop:l,isScrolling:f,lastJumpDueToItemResize:C,scrollDirection:m,scrollVelocity:g}},Zv(yy)),ww="top",bw="bottom",Ew="none";function Mw(e,t,n){return"number"==typeof e?n===mw&&t===ww||n===gw&&t===bw?e:0:n===mw?t===ww?e.main:e.reverse:t===bw?e.main:e.reverse}function Aw(e,t){var n;return"number"==typeof e?e:null!=(n=e[t])?n:0}const xw=ay(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{const o=iy(),a=ny(0),l=ny(0),s=ny(0),c=ry(Xv(sy(cy(r),cy(i),cy(n),cy(o,By),cy(s),cy(a),cy(t),cy(e),cy(l)),Kv(([e,t,n,[r,i],o,a,l,s,c])=>{const d=e-s,u=a+l,f=Math.max(n-d,0);let h=Ew;const p=Aw(c,ww),C=Aw(c,bw);return r-=s,i+=n+l,(r+=n+l)>e+u-p&&(h=mw),(i-=s)<e-f+t+C&&(h=gw),h!==Ew?[Math.max(d-n-Mw(o,ww,h)-p,0),d-f-l+t+Mw(o,bw,h)+C]:null}),Gv(e=>null!=e),Qv(By)),[0,0]);return{increaseViewportBy:l,listBoundary:o,overscan:s,topListHeight:a,visibleRange:c}},Zv(yy),{singleton:!0});const Lw={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function kw(e,t,n,r,i,o){const{lastIndex:a,lastOffset:l,lastSize:s}=i;let c=0,d=0;if(e.length>0){c=e[0].offset;const t=e[e.length-1];d=t.offset+t.size}const u=n-a,f=c,h=l+u*s+(u-1)*r-d;return{bottom:d,firstItemIndex:o,items:Sw(e,i,o),offsetBottom:h,offsetTop:c,top:f,topItems:Sw(t,i,o),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function Hw(e,t,n,r,i,o){let a=0;if(n.groupIndices.length>0)for(const t of n.groupIndices){if(t-a>=e)break;a++}const l=e+a,s=hw(t,l);return kw(Array.from({length:l}).map((e,t)=>({data:o[t+s],index:t+s,offset:0,size:0})),[],l,i,n,r)}function Sw(e,t,n){if(0===e.length)return[];if(!Wy(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));const r=e[0].index,i=e[e.length-1].index,o=[],a=ky(t.groupOffsetTree,r,i);let l,s=0;for(const r of e){let e;(!l||l.end<r.index)&&(l=a.shift(),s=t.groupIndices.indexOf(l.start)),e=r.index===l.start?{index:s,type:"group"}:{groupIndex:s,index:r.index-(s+1)+n},o.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return o}function _w(e,t){var n;return void 0===e?0:"number"==typeof e?e:null!=(n=e[t])?n:0}const Vw=ay(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},o,{listBoundary:a,topListHeight:l,visibleRange:s},{initialTopMostItemIndex:c,scrolledToInitialItem:d},{topListHeight:u},f,{didMount:h},{recalcInProgress:p}])=>{const C=ny([]),m=ny(0),g=iy(),v=ny(0);Fv(o.topItemsIndexes,C);const y=ry(Xv(sy(h,p,cy(s,By),cy(i),cy(r),cy(c),d,cy(C),cy(t),cy(n),cy(v),e),Gv(([e,t,,n,,,,,,,,r])=>{const i=r&&r.length!==n;return e&&!t&&!i}),Kv(([,,[e,t],n,r,i,o,a,l,s,c,d])=>{var u,f,h,p;const C=r,{offsetTree:g,sizeTree:v}=C,y=Pv(m);if(0===n)return{...Lw,totalCount:n};if(0===e&&0===t)return 0===y?{...Lw,totalCount:n}:Hw(y,i,r,l,s,d||[]);if(Ey(v))return y>0?null:kw(function(e,t,n){if(Wy(t)){const r=Yy(e,t);return[{index:Ay(t.groupOffsetTree,r)[0],offset:0,size:0},{data:null==n?void 0:n[0],index:r,offset:0,size:0}]}return[{data:null==n?void 0:n[0],index:e,offset:0,size:0}]}(hw(i,n),C,d),[],n,s,C,l);const w=[];if(a.length>0){const e=a[0],t=a[a.length-1];let n=0;for(const r of ky(v,e,t)){const i=r.value,o=Math.max(r.start,e),a=Math.min(r.end,t);for(let e=o;e<=a;e++)w.push({data:null==d?void 0:d[e],index:e,offset:n,size:i}),n+=i}}if(!o)return kw([],w,n,s,C,l);const b=a.length>0?a[a.length-1]+1:0,E=Jy(g,e,t,b);if(0===E.length)return null;const M=n-1,A=Iv([],n=>{for(const r of E){const i=r.value;let o=i.offset,a=r.start;const l=i.size;if(i.offset<e){a+=Math.floor((e-i.offset+s)/(l+s));const t=a-r.start;o+=t*l+t*s}a<b&&(o+=(b-a)*l,a=b);const c=Math.min(r.end,M);for(let e=a;e<=c&&!(o>=t);e++)n.push({data:null==d?void 0:d[e],index:e,offset:o,size:l}),o+=l+s}}),x=_w(c,ww),L=_w(c,bw);if(A.length>0&&(x>0||L>0)){const e=A[0],t=A[A.length-1];if(x>0&&e.index>b){const t=Math.min(x,e.index-b),n=[];let r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){const t=null!=(f=null==(u=ky(v,i,i)[0])?void 0:u.value)?f:e.size;r-=t+s,n.unshift({data:null==d?void 0:d[i],index:i,offset:r,size:t})}A.unshift(...n)}if(L>0&&t.index<M){const e=Math.min(L,M-t.index);let n=t.offset+t.size+s;for(let r=t.index+1;r<=t.index+e;r++){const e=null!=(p=null==(h=ky(v,r,r)[0])?void 0:h.value)?p:t.size;A.push({data:null==d?void 0:d[r],index:r,offset:n,size:e}),n+=e+s}}}return kw(A,w,n,s,C,l)}),Gv(e=>null!==e),Qv()),Lw);Fv(Xv(e,Gv(Nv),Kv(e=>null==e?void 0:e.length)),i),Fv(Xv(y,Kv(e=>e.topListHeight)),u),Fv(u,l),Fv(Xv(y,Kv(e=>[e.top,e.bottom])),a),Fv(Xv(y,Kv(e=>e.items)),g);const w=oy(Xv(y,Gv(({items:e})=>e.length>0),ty(i,e),Gv(([{items:e},t])=>e[e.length-1].originalIndex===t-1),Kv(([,e,t])=>[e-1,t]),Qv(By),Kv(([e])=>e))),b=oy(Xv(y,ey(200),Gv(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),Kv(({items:e})=>e[0].index),Qv())),E=oy(Xv(y,Gv(({items:e})=>e.length>0),Kv(({items:e})=>{let t=0,n=e.length-1;for(;"group"===e[t].type&&t<n;)t++;for(;"group"===e[n].type&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),Qv(Ry)));return{endReached:w,initialItemCount:m,itemsRendered:g,listState:y,minOverscanItemCount:v,rangeChanged:E,startReached:b,topItemsIndexes:C,...f}},Zv(ow,lw,xw,pw,uw,yw,sw,Py),{singleton:!0}),Ow=ay(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{const o=iy(),a=ry(Xv(sy(n,e,r,t,i),Kv(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return Fv(cy(a),o),{totalListHeight:a,totalListHeightChanged:o}},Zv(yy,Vw),{singleton:!0}),zw=ay(([{viewportHeight:e},{totalListHeight:t}])=>{const n=ny(!1);return{alignToBottom:n,paddingTopAddition:ry(Xv(sy(n,e,t),Gv(([e])=>e),Kv(([,e,t])=>Math.max(0,e-t)),ey(0),Qv()),0)}},Zv(yy,Ow),{singleton:!0}),Nw=ay(()=>({context:ny(null)})),Tw=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:o,viewportTop:a})=>t<a?{...i,align:null!=n?n:"start",behavior:r}:e>o?{...i,align:null!=n?n:"end",behavior:r}:null,Iw=ay(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:o,scrollingInProgress:a,scrollTop:l,viewportHeight:s},{scrollToIndex:c}])=>{const d=iy();return Fv(Xv(d,ty(t,s,n,o,i,r,l),ty(e),Kv(([[e,t,n,r,i,o,l,s],c])=>{const{align:d,behavior:u,calculateViewLocation:f=Tw,done:h,...p}=e,C=Xy(e,t,r-1),m=Ky(C,t.offsetTree,c)+i+o,g=f({itemBottom:m+Ay(t.sizeTree,C)[1],itemTop:m,locationParams:{align:d,behavior:u,...p},viewportBottom:s+n-l,viewportTop:s+o});return g?h&&Uv(Xv(a,Gv(e=>!e),$v(Pv(a)?1:2)),h):null==h||h(),g}),Gv(e=>null!==e)),c),{scrollIntoView:d}},Zv(ow,yy,uw,Vw,hy),{singleton:!0});function Dw(e){return!!e&&("smooth"===e?"smooth":"auto")}const Zw=ay(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:o},{scrollToIndex:a},{scrolledToInitialItem:l},{didMount:s,propsReady:c},{log:d},{scrollingInProgress:u},{context:f},{scrollIntoView:h}])=>{const p=ny(!1),C=iy();let m=null;function g(e){Rv(a,{align:"end",behavior:e,index:"LAST"})}function v(e){const t=Uv(i,t=>{e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&!m&&(Pv(d)("scrolling to bottom due to increased size",{},uy.DEBUG),g("auto"))});setTimeout(t,100)}jv(Xv(sy(Xv(cy(t),$v(1)),s),ty(cy(p),o,l,u),Kv(([[e,t],n,r,i,o])=>{let a=t&&i,l="auto";return a&&(l=((e,t)=>"function"==typeof e?Dw(e(t)):t&&Dw(e))(n,r||o),a=a&&!!l),{followOutputBehavior:l,shouldFollow:a,totalCount:e}}),Gv(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{m&&(m(),m=null),Pv(n)?requestAnimationFrame(()=>{Pv(d)("following output to ",{totalCount:r},uy.DEBUG),g(t)}):m=Uv(e,()=>{Pv(d)("following output to ",{totalCount:r},uy.DEBUG),g(t),m=null})}),jv(Xv(sy(cy(p),t,c),Gv(([e,,t])=>e&&t),Jv(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),Gv(({refreshed:e})=>e),ty(p,t)),([,e])=>{Pv(l)&&v(!1!==e)}),jv(C,()=>{v(!1!==Pv(p))}),jv(sy(cy(p),i),([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&g("auto")});const y=ny(null),w=iy();return Fv(dy(Xv(cy(r),Kv(e=>{var t;return null!=(t=null==e?void 0:e.length)?t:0})),Xv(cy(t))),w),jv(Xv(sy(Xv(w,$v(1)),s),ty(cy(y),l,u,f),Kv(([[e,t],n,r,i,o])=>t&&r&&(null==n?void 0:n({context:o,totalCount:e,scrollingInProgress:i}))),Gv(e=>!!e),ey(0)),t=>{m&&(m(),m=null),Pv(n)?requestAnimationFrame(()=>{Pv(d)("scrolling into view",{}),Rv(h,t)}):m=Uv(e,()=>{Pv(d)("scrolling into view",{}),Rv(h,t),m=null})}),{autoscrollToBottom:C,followOutput:p,scrollIntoViewOnChange:y}},Zv(ow,yw,uw,pw,sw,hy,yy,Nw,Iw)),jw=ay(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:o,listState:a},{didMount:l}])=>(Fv(Xv(l,ty(o),Gv(([,e])=>0!==e),ty(i,r,t,n,e),Kv(([[,e],t,n,r,i,o=[]])=>Hw(e,t,n,r,i,o))),a),{}),Zv(ow,pw,Vw,sw),{singleton:!0}),Rw=ay(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=ny(0);return jv(Xv(e,ty(r),Gv(([,e])=>0!==e),Kv(([,e])=>({top:e}))),e=>{Uv(Xv(n,$v(1),Gv(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{Rv(t,e)})})}),{initialScrollTop:r}},Zv(sw,yy,Vw),{singleton:!0}),Bw=ay(([{scrollVelocity:e}])=>{const t=ny(!1),n=iy(),r=ny(!1);return Fv(Xv(e,ty(r,t,n),Gv(([e,t])=>!!t),Kv(([e,t,n,r])=>{const{enter:i,exit:o}=t;if(n){if(o(e,r))return!1}else if(i(e,r))return!0;return n}),Qv()),t),jv(Xv(sy(t,e,n),ty(r)),([[e,t,n],r])=>{e&&r&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},Zv(yw),{singleton:!0}),Pw=ay(([{scrollContainerState:e,scrollTo:t}])=>{const n=iy(),r=iy(),i=iy(),o=ny(!1),a=ny(void 0);return Fv(Xv(sy(n,r),Kv(([{scrollHeight:e,scrollTop:t,viewportHeight:n},{offsetTop:r}])=>({scrollHeight:e,scrollTop:Math.max(0,t-r),viewportHeight:n}))),e),Fv(Xv(t,ty(r),Kv(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:a,useWindowScroll:o,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},Zv(yy)),Fw=ay(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:o},{useWindowScroll:a,windowScrollContainerState:l,windowViewportRect:s}])=>{const c=iy(),d=ny(void 0),u=ny(null),f=ny(null);return Fv(l,u),Fv(s,f),jv(Xv(c,ty(t,r,a,u,f,n)),([e,t,n,r,i,o,a])=>{const l=function(e){return Sy(e).map(({k:e,v:t},n,r)=>{const i=r[n+1];return{endIndex:i?i.k-1:1/0,size:t,startIndex:e}})}(t.sizeTree);r&&null!==i&&null!==o&&(n=i.scrollTop-o.offsetTop),e({ranges:l,scrollTop:n-=a})}),Fv(Xv(d,Gv(Nv),Kv(Uw)),i),Fv(Xv(o,ty(d),Gv(([,e])=>void 0!==e),Qv(),Kv(([,e])=>e.ranges)),e),{getState:c,restoreStateFrom:d}},Zv(ow,yy,pw,sw,Pw));function Uw(e){return{align:"start",index:0,offset:e.scrollTop}}const qw=ay(([{topItemsIndexes:e}])=>{const t=ny(0);return Fv(Xv(t,Gv(e=>e>=0),Kv(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},Zv(Vw));function Ww(e){let t,n=!1;return()=>(n||(n=!0,t=e()),t)}const Qw=Ww(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Gw=ay(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:o,lastJumpDueToItemResize:a,scrollDirection:l},{listState:s},{beforeUnshiftWith:c,gap:d,shiftWithOffset:u,sizes:f},{log:h},{recalcInProgress:p}])=>{const C=oy(Xv(s,ty(a),Jv(([,e,t,n],[{bottom:r,items:i,offsetBottom:o,totalCount:a},l])=>{const s=r+o;let c=0;return t===a&&e.length>0&&i.length>0&&(0===i[0].originalIndex&&0===e[0].originalIndex||(c=s-n,0!==c&&(c+=l))),[c,i,a,s]},[0,[],0,0]),Gv(([e])=>0!==e),ty(r,l,n,i,h,p),Gv(([,e,t,n,,,r])=>!r&&!n&&0!==e&&t===mw),Kv(([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},uy.DEBUG),e))));function m(n){n>0?(Rv(t,{behavior:"auto",top:-n}),Rv(e,0)):(Rv(e,0),Rv(t,{behavior:"auto",top:-n}))}return jv(Xv(C,ty(e,o)),([t,n,r])=>{r&&Qw()?Rv(e,n-t):m(-t)}),jv(Xv(sy(ry(o,!1),e,p),Gv(([e,t,n])=>!e&&!n&&0!==t),Kv(([e,t])=>t),ey(1)),m),Fv(Xv(u,Kv(e=>({top:-e}))),t),jv(Xv(c,ty(f,d),Kv(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function o(e){return e*(n+i)}if(0===t.length)return o(e);{let n=0;const i=My(r,0);let a=0,l=0;for(;a<e;){a++,n+=i;let r=t.length===l+1?1/0:t[l+1]-t[l]-1;a+r>e&&(n-=i,r=e-a+1),a+=r,n+=o(r),l++}return n}})),n=>{Rv(e,n),requestAnimationFrame(()=>{Rv(t,{top:n}),requestAnimationFrame(()=>{Rv(e,0),Rv(p,!1)})})}),{deviation:e}},Zv(yy,yw,Vw,ow,hy,Py)),Kw=ay(([e,t,n,r,i,o,a,l,s,c,d])=>({...e,...t,...n,...r,...i,...o,...a,...l,...s,...c,...d}),Zv(xw,jw,sw,Bw,Ow,Rw,zw,Pw,Iw,hy,Nw)),Yw=ay(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:o,groupIndices:a,heightEstimates:l,itemSize:s,sizeRanges:c,sizes:d,statefulTotalCount:u,totalCount:f,trackItemSizes:h},{initialItemFinalLocationReached:p,initialTopMostItemIndex:C,scrolledToInitialItem:m},g,v,y,w,{scrollToIndex:b},E,{topItemCount:M},{groupCounts:A},x])=>{const{listState:L,minOverscanItemCount:k,topItemsIndexes:H,rangeChanged:S,..._}=w;return Fv(S,x.scrollSeekRangeChanged),Fv(Xv(x.windowViewportRect,Kv(e=>e.visibleHeight)),g.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:o,groupCounts:A,heightEstimates:l,initialItemFinalLocationReached:p,initialTopMostItemIndex:C,scrolledToInitialItem:m,sizeRanges:c,topItemCount:M,topItemsIndexes:H,totalCount:f,...y,groupIndices:a,itemSize:s,listState:L,minOverscanItemCount:k,scrollToIndex:b,statefulTotalCount:u,trackItemSizes:h,rangeChanged:S,..._,...x,...g,sizes:d,...v}},Zv(ow,pw,yy,Fw,Zw,Vw,uw,Gw,qw,lw,Kw));function Xw(e,t){const n={},r={};let i=0;const o=e.length;for(;i<o;)r[e[i]]=1,i+=1;for(const e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}const Jw=typeof document<"u"?i.useLayoutEffect:i.useEffect;function $w(t,n,r){const o=Object.keys(n.required||{}),a=Object.keys(n.optional||{}),l=Object.keys(n.methods||{}),s=Object.keys(n.events||{}),c=i.createContext({});function d(e,t){e.propsReady&&Rv(e.propsReady,!1);for(const r of o){Rv(e[n.required[r]],t[r])}for(const r of a)if(r in t){Rv(e[n.optional[r]],t[r])}e.propsReady&&Rv(e.propsReady,!0)}function u(e){return s.reduce((t,r)=>(t[r]=function(e){let t,n;const r=()=>null==t?void 0:t();return function(i,o){switch(i){case 1:return o?n===o?void 0:(r(),n=o,t=jv(e,o),t):(r(),Tv);case 2:return r(),void(n=null)}}}(e[n.events[r]]),t),{})}const f=i.forwardRef((f,h)=>{const{children:p,...C}=f,[m]=i.useState(()=>Iv(function(e){const t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:o})=>{if(o&&t.has(i))return t.get(i);const a=e(r.map(e=>n(e)));return o&&t.set(i,a),a};return n(e)}(t),e=>{d(e,C)})),[g]=i.useState(zv(u,m));Jw(()=>{for(const e of s)e in C&&jv(g[e],C[e]);return()=>{Object.values(g).map(Bv)}},[C,g,m]),Jw(()=>{d(m,C)}),i.useImperativeHandle(h,_v(function(e){return l.reduce((t,r)=>(t[r]=t=>{Rv(e[n.methods[r]],t)},t),{})}(m)));const v=r;return e(c.Provider,{value:m,children:r?e(v,{...Xw([...o,...a,...s],C),children:p}):p})}),h=i.version.startsWith("18")?e=>{const t=i.useContext(c)[e],n=i.useCallback(e=>jv(t,e),[t]);return i.useSyncExternalStore(n,()=>Pv(t),()=>Pv(t))}:e=>{const t=i.useContext(c)[e],[n,r]=i.useState(zv(Pv,t));return Jw(()=>jv(t,e=>{e!==n&&r(_v(e))}),[t,n]),n};return{Component:f,useEmitter:(e,t)=>{const n=i.useContext(c)[e];Jw(()=>jv(n,t),[t,n])},useEmitterValue:h,usePublisher:e=>{const t=i.useContext(c);return i.useCallback(n=>{Rv(t[e],n)},[t,e])}}}const eb=i.createContext(void 0),tb=i.createContext(void 0),nb=typeof document<"u"?i.useLayoutEffect:i.useEffect;function rb(e){return"self"in e}function ib(e,t,n,r=Tv,o,a){const l=i.useRef(null),s=i.useRef(null),c=i.useRef(null),d=i.useCallback(n=>{let r,i,o;const l=n.target;if(function(e){return"body"in e}(l)||rb(l)){const e=rb(l)?l:l.defaultView;o=a?e.scrollX:e.scrollY,r=a?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a?e.innerWidth:e.innerHeight}else o=a?l.scrollLeft:l.scrollTop,r=a?l.scrollWidth:l.scrollHeight,i=a?l.offsetWidth:l.offsetHeight;const d=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync?d():M.flushSync(d),null!==s.current&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t,a]);return i.useEffect(()=>{const e=o||l.current;return r(o||l.current),d({suppressFlushSync:!0,target:e}),e.addEventListener("scroll",d,{passive:!0}),()=>{r(null),e.removeEventListener("scroll",d)}},[l,d,n,r,o]),{scrollByCallback:function(e){a&&(e={behavior:e.behavior,left:e.top}),l.current.scrollBy(e)},scrollerRef:l,scrollToCallback:function(n){const r=l.current;if(!r||(a?"offsetWidth"in r&&0===r.offsetWidth:"offsetHeight"in r&&0===r.offsetHeight))return;const i="smooth"===n.behavior;let o,d,u;rb(r)?(d=Math.max(qy(r.document.documentElement,a?"width":"height"),a?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),o=a?r.innerWidth:r.innerHeight,u=a?window.scrollX:window.scrollY):(d=r[a?"scrollWidth":"scrollHeight"],o=qy(r,a?"width":"height"),u=r[a?"scrollLeft":"scrollTop"]);const f=d-o;if(n.top=Math.ceil(Math.max(Math.min(f,n.top),0)),Cw(o,d)||n.top===u)return e({scrollHeight:d,scrollTop:u,viewportHeight:o}),void(i&&t(!0));i?(s.current=n.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a&&(n={behavior:n.behavior,left:n.top}),r.scrollTo(n)}}}const ob="-webkit-sticky",ab="sticky",lb=Ww(()=>{if(typeof document>"u")return ab;const e=document.createElement("div");return e.style.position=ob,e.style.position===ob?ob:ab});function sb(e){return e}const cb=ay(()=>{const e=ny(e=>`Item ${e}`),t=ny(e=>`Group ${e}`),n=ny({}),r=ny(sb),i=ny("div"),o=ny(Tv),a=(e,t=null)=>ry(Xv(n,Kv(t=>t[e]),Qv()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:a("EmptyPlaceholder"),FooterComponent:a("Footer"),GroupComponent:a("Group","div"),groupContent:t,HeaderComponent:a("Header"),HeaderFooterTag:i,ItemComponent:a("Item","div"),itemContent:e,ListComponent:a("List","div"),ScrollerComponent:a("Scroller","div"),scrollerRef:o,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TopItemListComponent:a("TopItemList")}}),db=ay(([e,t])=>({...e,...t}),Zv(Yw,cb)),ub=({height:t})=>e("div",{style:{height:t}}),fb={overflowAnchor:"none",position:lb(),zIndex:1},hb={overflowAnchor:"none"},pb={...hb,display:"inline-block",height:"100%"},Cb=i.memo(function({showTopList:t=!1}){const n=Ob("listState"),r=zb("sizeRanges"),o=Ob("useWindowScroll"),a=Ob("customScrollParent"),l=zb("windowScrollContainerState"),s=zb("scrollContainerState"),c=a||o?l:s,d=Ob("itemContent"),u=Ob("context"),f=Ob("groupContent"),h=Ob("trackItemSizes"),p=Ob("itemSize"),m=Ob("log"),g=zb("gap"),v=Ob("horizontalDirection"),{callbackRef:y}=my(r,p,h,t?Tv:c,m,g,a,v,Ob("skipAnimationFrameInResizeObserver")),[w,b]=i.useState(0);Vb("deviation",e=>{w!==e&&b(e)});const E=Ob("EmptyPlaceholder"),M=Ob("ScrollSeekPlaceholder")||ub,A=Ob("ListComponent"),x=Ob("ItemComponent"),L=Ob("GroupComponent"),k=Ob("computeItemKey"),H=Ob("isSeeking"),S=Ob("groupIndices").length>0,_=Ob("alignToBottom"),V=Ob("initialItemFinalLocationReached"),O=t?{}:{boxSizing:"border-box",...v?{display:"inline-block",height:"100%",marginLeft:0!==w?w:_?"auto":0,paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,whiteSpace:"nowrap"}:{marginTop:0!==w?w:_?"auto":0,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...V?{}:{visibility:"hidden"}};return!t&&0===n.totalCount&&E?e(E,{...wb(E,u)}):e(A,{...wb(A,u),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:y,style:O,children:(t?n.topItems:n.items).map(e=>{const t=e.originalIndex,r=k(t+n.firstItemIndex,e.data,u);return H?C(M,{...wb(M,u),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?C(L,{...wb(L,u),"data-index":t,"data-item-index":e.index,"data-known-size":e.size,key:r,style:fb},f(e.index,u)):C(x,{...wb(x,u),...bb(x,e.data),"data-index":t,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:v?pb:hb},S?d(e.index,e.groupIndex,e.data,u):d(e.index,e.data,u))})})}),mb={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},gb={outline:"none",overflowX:"auto",position:"relative"},vb=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),yb={position:lb(),top:0,width:"100%",zIndex:1};function wb(e,t){if("string"!=typeof e)return{context:t}}function bb(e,t){return{item:"string"==typeof e?void 0:t}}const Eb=i.memo(function(){const t=Ob("HeaderComponent"),n=zb("headerHeight"),r=Ob("HeaderFooterTag"),o=py(i.useMemo(()=>e=>{n(qy(e,"height"))},[n]),!0,Ob("skipAnimationFrameInResizeObserver")),a=Ob("context");return t?e(r,{ref:o,children:e(t,{...wb(t,a)})}):null}),Mb=i.memo(function(){const t=Ob("FooterComponent"),n=zb("footerHeight"),r=Ob("HeaderFooterTag"),o=py(i.useMemo(()=>e=>{n(qy(e,"height"))},[n]),!0,Ob("skipAnimationFrameInResizeObserver")),a=Ob("context");return t?e(r,{ref:o,children:e(t,{...wb(t,a)})}):null});function Ab({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:i,style:o,context:a,...l}){const s=r("scrollContainerState"),c=n("ScrollerComponent"),d=r("smoothScrollTargetReached"),u=n("scrollerRef"),f=n("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:p,scrollToCallback:C}=ib(s,d,c,u,void 0,f);return t("scrollTo",C),t("scrollBy",h),e(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:p,style:{...f?gb:mb,...o},tabIndex:0,...l,...wb(c,a),children:i})})}function xb({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:o,style:a,context:l,...s}){const c=r("windowScrollContainerState"),d=n("ScrollerComponent"),u=r("smoothScrollTargetReached"),f=n("totalListHeight"),h=n("deviation"),p=n("customScrollParent"),C=i.useRef(null),m=n("scrollerRef"),{scrollByCallback:g,scrollerRef:v,scrollToCallback:y}=ib(c,u,d,m,p);return nb(()=>{var e;return v.current=p||(null==(e=C.current)?void 0:e.ownerDocument.defaultView),()=>{v.current=null}},[v,p]),t("windowScrollTo",y),t("scrollBy",g),e(d,{ref:C,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...0!==f?{height:f+h}:{}},...s,...wb(d,l),children:o})})}const Lb=({children:t})=>{const n=i.useContext(eb),r=zb("viewportHeight"),o=zb("fixedItemHeight"),a=Ob("alignToBottom"),l=Ob("horizontalDirection"),s=py(i.useMemo(()=>Ov(r,e=>qy(e,l?"width":"height")),[r,l]),!0,Ob("skipAnimationFrameInResizeObserver"));return i.useEffect(()=>{n&&(r(n.viewportHeight),o(n.itemHeight))},[n,r,o]),e("div",{"data-viewport-type":"element",ref:s,style:vb(a),children:t})},kb=({children:t})=>{const n=i.useContext(eb),r=zb("windowViewportRect"),o=zb("fixedItemHeight"),a=Ob("customScrollParent"),l=vy(r,a,Ob("skipAnimationFrameInResizeObserver")),s=Ob("alignToBottom");return i.useEffect(()=>{n&&(o(n.itemHeight),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:100}))},[n,r,o]),e("div",{"data-viewport-type":"window",ref:l,style:vb(s),children:t})},Hb=({children:t})=>{const n=Ob("TopItemListComponent")||"div",r=Ob("headerHeight"),i={...yb,marginTop:`${r}px`},o=Ob("context");return e(n,{style:i,...wb(n,o),children:t})},Sb=i.memo(function(t){const r=Ob("useWindowScroll"),i=Ob("topItemsIndexes").length>0,o=Ob("customScrollParent"),a=Ob("context");return n(o||r?Tb:Nb,{...t,context:a,children:[i&&e(Hb,{children:e(Cb,{showTopList:!0})}),n(o||r?kb:Lb,{children:[e(Eb,{}),e(Cb,{}),e(Mb,{})]})]})}),{Component:_b,useEmitter:Vb,useEmitterValue:Ob,usePublisher:zb}=$w(db,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Sb),Nb=Ab({useEmitter:Vb,useEmitterValue:Ob,usePublisher:zb}),Tb=xb({useEmitter:Vb,useEmitterValue:Ob,usePublisher:zb}),Ib=_b,Db=ay(()=>{const e=ny(e=>n("td",{children:["Item $",e]})),t=ny(null),r=ny(e=>n("td",{colSpan:1e3,children:["Group ",e]})),i=ny(null),o=ny(null),a=ny({}),l=ny(sb),s=ny(Tv),c=(e,t=null)=>ry(Xv(a,Kv(t=>t[e]),Qv()),t);return{components:a,computeItemKey:l,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:o,fixedHeaderContent:i,itemContent:e,groupContent:r,ScrollerComponent:c("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}});Zv(Yw,Db),lb();const Zb={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},jb={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Rb,floor:Bb,max:Pb,min:Fb,round:Ub}=Math;function qb(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:null===n?null:n[r+e],index:r+e}))}function Wb(e,t){return e&&e.width===t.width&&e.height===t.height}function Qb(e,t){return e&&e.column===t.column&&e.row===t.row}const Gb=ay(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:o,scrollBy:a,scrollContainerState:l,scrollTo:s,scrollTop:c,smoothScrollTargetReached:d,viewportHeight:u},f,h,{didMount:p,propsReady:C},{customScrollParent:m,useWindowScroll:g,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:w},b])=>{const E=ny(0),M=ny(0),A=ny(Zb),x=ny({height:0,width:0}),L=ny({height:0,width:0}),k=iy(),H=iy(),S=ny(0),_=ny(null),V=ny({column:0,row:0}),O=iy(),z=iy(),N=ny(!1),T=ny(0),I=ny(!0),D=ny(!1),Z=ny(!1);jv(Xv(p,ty(T),Gv(([e,t])=>!!t)),()=>{Rv(I,!1)}),jv(Xv(sy(p,I,L,x,T,D),Gv(([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i)),([,,,,e])=>{Rv(D,!0),fw(1,()=>{Rv(k,e)}),Uv(Xv(c),()=>{Rv(t,[0,0]),Rv(I,!0)})}),Fv(Xv(z,Gv(e=>null!=e&&e.scrollTop>0),Yv(0)),M),jv(Xv(p,ty(z),Gv(([,e])=>null!=e)),([,e])=>{e&&(Rv(x,e.viewport),Rv(L,e.item),Rv(V,e.gap),e.scrollTop>0&&(Rv(N,!0),Uv(Xv(c,$v(1)),e=>{Rv(N,!1)}),Rv(s,{top:e.scrollTop})))}),Fv(Xv(x,Kv(({height:e})=>e)),u),Fv(Xv(sy(cy(x,Wb),cy(L,Wb),cy(V,(e,t)=>e&&e.column===t.column&&e.row===t.row),cy(c)),Kv(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),O),Fv(Xv(sy(cy(E),r,cy(V,Qb),cy(L,Wb),cy(x,Wb),cy(_),cy(M),cy(N),cy(I),cy(T)),Gv(([,,,,,,,e])=>!e),Kv(([e,[t,n],r,i,o,a,l,,s,c])=>{const{column:d,row:u}=r,{height:f,width:h}=i,{width:p}=o;if(0===l&&(0===e||0===p))return Zb;if(0===h){const t=hw(c,e);return function(e){return{...jb,items:e}}(qb(t,t+Math.max(l-1,0),a))}const C=Kb(p,h,d);let m,g;s?0===t&&0===n&&l>0?(m=0,g=l-1):(m=C*Bb((t+u)/(f+u)),g=C*Rb((n+u)/(f+u))-1,g=Fb(e-1,Pb(g,C-1)),m=Fb(g,Pb(0,m))):(m=0,g=-1);const v=qb(m,g,a),{bottom:y,top:w}=Yb(o,r,i,v),b=Rb(e/C);return{bottom:y,itemHeight:f,items:v,itemWidth:h,offsetBottom:b*f+(b-1)*u-y,offsetTop:w,top:w}})),A),Fv(Xv(_,Gv(e=>null!==e),Kv(e=>e.length)),E),Fv(Xv(sy(x,L,A,V),Gv(([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height),Kv(([e,t,{items:n},r])=>{const{bottom:i,top:o}=Yb(e,r,t,n);return[o,i]}),Qv(By)),t);const j=ny(!1);Fv(Xv(c,ty(j),Kv(([e,t])=>t||0!==e)),j);const R=oy(Xv(sy(A,E),Gv(([{items:e}])=>e.length>0),ty(j),Gv(([[e,t],n])=>{const r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&0===e.offsetBottom&&e.items.length===t)&&r}),Kv(([[,e]])=>e-1),Qv())),B=oy(Xv(cy(A),Gv(({items:e})=>e.length>0&&0===e[0].index),Yv(0),Qv())),P=oy(Xv(cy(A),ty(N),Gv(([{items:e},t])=>e.length>0&&!t),Kv(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),Qv(Ry),ey(0)));Fv(P,h.scrollSeekRangeChanged),Fv(Xv(k,ty(x,L,E,V),Kv(([e,t,n,r,i])=>{const o=dw(e),{align:a,behavior:l,offset:s}=o;let c=o.index;"LAST"===c&&(c=r-1),c=Pb(0,c,Fb(r-1,c));let d=Xb(t,i,n,c);return"end"===a?d=Ub(d-t.height+n.height):"center"===a&&(d=Ub(d-t.height/2+n.height/2)),s&&(d+=s),{behavior:l,top:d}})),s);const F=ry(Xv(A,Kv(e=>e.offsetBottom+e.bottom)),0);return Fv(Xv(w,Kv(e=>({height:e.visibleHeight,width:e.visibleWidth}))),x),{customScrollParent:m,data:_,deviation:S,footerHeight:i,gap:V,headerHeight:o,increaseViewportBy:e,initialItemCount:M,itemDimensions:L,overscan:n,restoreStateFrom:z,scrollBy:a,scrollContainerState:l,scrollHeight:H,scrollTo:s,scrollToIndex:k,scrollTop:c,smoothScrollTargetReached:d,totalCount:E,useWindowScroll:g,viewportDimensions:x,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:w,...h,gridState:A,horizontalDirection:Z,initialTopMostItemIndex:T,totalListHeight:F,...f,endReached:R,propsReady:C,rangeChanged:P,startReached:B,stateChanged:O,stateRestoreInProgress:N,...b}},Zv(xw,yy,yw,Bw,sw,Pw,hy));function Kb(e,t,n){return Pb(1,Bb((e+n)/(Bb(t)+n)))}function Yb(e,t,n,r){const{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};const o=Xb(e,t,n,r[0].index);return{bottom:Xb(e,t,n,r[r.length-1].index)+i,top:o}}function Xb(e,t,n,r){const i=Kb(e.width,n.width,t.column),o=Bb(r/i),a=o*n.height+Pb(0,o-1)*t.row;return a>0?a+t.row:a}const Jb=ay(()=>{const e=ny(e=>`Item ${e}`),t=ny({}),n=ny(null),r=ny("virtuoso-grid-item"),i=ny("virtuoso-grid-list"),o=ny(sb),a=ny("div"),l=ny(Tv),s=(e,n=null)=>ry(Xv(t,Kv(t=>t[e]),Qv()),n),c=ny(!1),d=ny(!1);return Fv(cy(d),c),{components:t,computeItemKey:o,context:n,FooterComponent:s("Footer"),HeaderComponent:s("Header"),headerFooterTag:a,itemClassName:r,ItemComponent:s("Item","div"),itemContent:e,listClassName:i,ListComponent:s("List","div"),readyStateChanged:c,reportReadyState:d,ScrollerComponent:s("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),$b=ay(([e,t])=>({...e,...t}),Zv(Gb,Jb)),eE=i.memo(function(){const t=lE("gridState"),n=lE("listClassName"),r=lE("itemClassName"),o=lE("itemContent"),a=lE("computeItemKey"),l=lE("isSeeking"),s=sE("scrollHeight"),c=lE("ItemComponent"),d=lE("ListComponent"),u=lE("ScrollSeekPlaceholder"),f=lE("context"),h=sE("itemDimensions"),p=sE("gap"),m=lE("log"),g=lE("stateRestoreInProgress"),v=sE("reportReadyState"),y=py(i.useMemo(()=>e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const n=e.firstChild;if(n){const{height:e,width:t}=n.getBoundingClientRect();h({height:e,width:t})}p({column:uE("column-gap",getComputedStyle(e).columnGap,m),row:uE("row-gap",getComputedStyle(e).rowGap,m)})},[s,h,p,m]),!0,!1);return nb(()=>{t.itemHeight>0&&t.itemWidth>0&&v(!0)},[t]),g?null:e(d,{className:n,ref:y,...wb(d,f),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map(n=>{const i=a(n.index,n.data,f);return l?e(u,{...wb(u,f),height:t.itemHeight,index:n.index,width:t.itemWidth},i):C(c,{...wb(c,f),className:r,"data-index":n.index,key:i},o(n.index,n.data,f))})})}),tE=i.memo(function(){const t=lE("HeaderComponent"),n=sE("headerHeight"),r=lE("headerFooterTag"),o=py(i.useMemo(()=>e=>{n(qy(e,"height"))},[n]),!0,!1),a=lE("context");return t?e(r,{ref:o,children:e(t,{...wb(t,a)})}):null}),nE=i.memo(function(){const t=lE("FooterComponent"),n=sE("footerHeight"),r=lE("headerFooterTag"),o=py(i.useMemo(()=>e=>{n(qy(e,"height"))},[n]),!0,!1),a=lE("context");return t?e(r,{ref:o,children:e(t,{...wb(t,a)})}):null}),rE=({children:t})=>{const n=i.useContext(tb),r=sE("itemDimensions"),o=sE("viewportDimensions"),a=py(i.useMemo(()=>e=>{o(e.getBoundingClientRect())},[o]),!0,!1);return i.useEffect(()=>{n&&(o({height:n.viewportHeight,width:n.viewportWidth}),r({height:n.itemHeight,width:n.itemWidth}))},[n,o,r]),e("div",{ref:a,style:vb(!1),children:t})},iE=({children:t})=>{const n=i.useContext(tb),r=sE("windowViewportRect"),o=sE("itemDimensions"),a=lE("customScrollParent"),l=vy(r,a,!1);return i.useEffect(()=>{n&&(o({height:n.itemHeight,width:n.itemWidth}),r({offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:n.viewportWidth}))},[n,r,o]),e("div",{ref:l,style:vb(!1),children:t})},oE=i.memo(function({...t}){const r=lE("useWindowScroll"),i=lE("customScrollParent"),o=i||r?dE:cE,a=i||r?iE:rE,l=lE("context");return e(o,{...t,...wb(o,l),children:n(a,{children:[e(tE,{}),e(eE,{}),e(nE,{})]})})}),{useEmitter:aE,useEmitterValue:lE,usePublisher:sE}=$w($b,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},oE),cE=Ab({useEmitter:aE,useEmitterValue:lE,usePublisher:sE}),dE=xb({useEmitter:aE,useEmitterValue:lE,usePublisher:sE});function uE(e,t,n){return"normal"!==t&&!(null!=t&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,uy.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}const fE=({optionsList:r=[],onSelectVariable:i,dropdownPosition:o,position:a="relative",width:l,height:s="160px",zIndex:c=9999})=>{const d={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},u=e=>{if(!e)return"";const t=e._id||e.id;return t?.startsWith("PARAMETER")?"step_group_parameter":"STEPGROUP"!==e?.parentVariableType||"LOCAL"!==e.type&&"STEPGROUP"!==e?.type?"_startforloop"===e.type?"for_loop_variable":"DATAPROVIDER"===e.type?"data_provider_variable":d[e.type||""]||"":"step_group_variable"},f=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;function h(e){if(e.endsWith("px")){const t=parseInt(e.slice(0,-2),10);return isNaN(t)?212:t-66}return 212}return e("div",{className:z("ff-variable-dropdown",a),style:o?{top:o.top+30,left:o.left-30,width:l,height:s,zIndex:c}:{width:l,height:s,zIndex:c},children:G(r)?e("div",{className:"ff-variable-option ff-variable-option-no-data",children:e(F,{as:"span",fontSize:12,children:"No Option"})}):e(Ib,{totalCount:r.length,itemContent:o=>{const a=r[o];return a?e("div",{className:"ff-variable-data",onMouseDown:()=>i(a),children:l.endsWith("px")?n(t,{children:[e(K,{title:oe(f(a),h(l),"pixel")?f(a):"",style:{width:`${h(l)}px`},children:e(F,{as:"span",fontSize:12,className:"ff-truncated_text",children:f(a)})}),e(P,{name:u(a),height:24,width:24,hoverEffect:!0})]}):e(Sv,{option:a})},`${a.id}-${o}`):null},style:{height:s,fontSize:"12px"},overscan:10,fixedItemHeight:32})})},hE=({data:r=[],width:i,height:o,lineChartWidth:a,yAxisLabel:s,xAxisLabel:d,yAxisValueColor:u,xAxisColor:f,yAxisColor:h,yAxisLabelColor:p,textSize:C,fontWeight:m,numberSize:g,chartName:v,shouldCenterSinglePoint:y,xAxisLabelGap:w=16,isLeftOverflow:b=!1})=>{const E=40,M=i-80,A=o-80,[x,L]=c(!1),[k,H]=c({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});l(()=>{const e=()=>{L(!1),H(e=>({...e,tooltip:{...e.tooltip,visible:!1}}))};return window.addEventListener("scroll",e,!0),()=>window.removeEventListener("scroll",e,!0)},[]);if(!(r&&r.length>0&&r?.some(e=>Array.isArray(e?.data)&&e?.data?.length>0))){const t=[];for(let e=6;e>=0;e--){const n=new Date;n.setDate(n.getDate()-e);const r=n?.toLocaleDateString("en-US",{day:"numeric",month:"short"});t.push(r)}const r=1024,a=6,l=7;return n("div",{className:"ff-line-chart-text",style:{width:i+20+w,gap:w},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(F,{className:"ff-line-chart-yAxisLabel",fontSize:C,fontWeight:"semi-bold",children:s})}),e("div",{className:"ff-line-chart-svg",children:e("svg",{height:o,width:i,className:"ff-line-chart-svg",children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:A,x2:M,y2:A,stroke:f,strokeWidth:1}),e("text",{x:M/2.1,y:A+E/1.2,textAnchor:"middle",fill:p,className:"ff-line-chart-x-axis-label",style:{fontSize:C,fontWeight:m},children:d}),t.map((t,n)=>e("text",{x:n*(M/(l-1)),y:A+15,textAnchor:0===n?"start":n===l-1?"end":"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:t},t)),Array.from({length:a}).map((t,n)=>{const i=n*r/(a-1),o=i/1024;return e("text",{x:-10,y:A-i*A/r,textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:o?.toFixed(1)},`y-${n}`)})]})})})]})}function S(e){if(!isNaN(e))return parseFloat(e);const t=at,n=e.match(t);if(!n)throw new Error("Invalid input format. Use '<value> <unit>' format (e.g., '10.9580078125 KB') or just a number.");const r=parseFloat(n[1]);switch(n[2]?n[2].toUpperCase():null){case"GB":return parseFloat((1024*r).toFixed(2));case"MB":return parseFloat(r.toFixed(2));case"KB":return parseFloat((r/1024).toFixed(2));default:throw new Error("Invalid unit. Supported units are GB, MB, and KB.")}}const _=r?.[0]?.data?.[0]?.hasOwnProperty("date")&&r?.[0]?.data?.[0]?.hasOwnProperty("totalMemory"),V="date",O=_?"totalMemory":"value",z=e=>{const t=r?.[0]?.data?.length;if(1===t)return y?M/2:M;const n=r[0].data.findIndex(t=>t[V]===e);return-1===n?0:n/(t-1)*M},N=Math.max(...r?.flatMap(e=>e?.data?.map(e=>S(e[O]))),5),T=e=>{if("memory"===v){const t=Math.max(...r?.flatMap(e=>e?.data?.map(e=>S(e[O]))));return A-e*A/(t>1024?t:1024)}return A-e*A/(0===N?1024:N)},I=e=>{if(1===e?.length){const t=e?.[0],n=z(t[V]),r=T(S(t[O]));return`M 0 ${T(0)} L ${n} ${r}`}return e?.reduce((t,n,r)=>{const i=z(n[V]),o=T(S(n[O]));if(0===r)return`M ${i} ${o}`;const a=e[r-1],l=a?z(a[V]):0;return`${t} C ${l+(i-l)/2} ${a?T(S(a[O])):0}, ${i-(i-l)/2} ${o}, ${i} ${o}`},"")},D=r[0].data;return n("div",{className:"ff-line-chart-text",style:{width:i+20+w,gap:w},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:o},children:e(F,{className:"ff-line-chart-yAxisLabel",fontSize:C,fontWeight:"semi-bold",children:s})}),n("div",{className:"ff-line-chart-svg",children:[e("svg",{height:o,width:i,onMouseMove:e=>{const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-E;if(e.clientY-t.top-E>A)return L(!1),void H({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});let i={hoverValues:{},dotPositions:{}},o=null;r.forEach((e,t)=>{const r=e.data.reduce((e,t)=>{const r=Math.abs(n-z(t[V]));return r<e.distance?{point:t,distance:r}:e},{point:null,distance:1/0}).point;r&&(o=r[V],i.hoverValues[t]=((e,t=2)=>{let n="";if("string"==typeof e){const t=e.match(rt),r=e.match(it);t&&(e=parseFloat(t[0])),r&&(n=r[0])}const r=Math.pow(10,t);return`${Math.ceil(e*r)/r} ${n}`.trim()})(r[O]),i.dotPositions[t]={x:z(r[V]),y:T(S(r[O]))})}),L(!0),H({cursorX:n,hoverValues:i.hoverValues,dotPositions:i.dotPositions,currentXValue:o,tooltip:o?{visible:!0,left:e.clientX+10,top:e.clientY-20}:{visible:!1,left:0,top:0}})},onMouseLeave:()=>H({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null}),className:"ff-line-chart-svg",children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:0,x2:0,y2:A,strokeWidth:2}),e("line",{x1:0,y1:A,x2:M,y2:A,stroke:f,strokeWidth:1}),e("text",{x:M/2.1,y:A+E/1.2,textAnchor:"middle",fill:p,className:"ff-line-chart-x-axis-label",style:{fontSize:C,fontWeight:m},children:d}),r.map((r,i)=>{return!1!==r.show?n("g",{children:[e("path",{d:I(r.data),fill:"none",stroke:r.color,strokeWidth:a,opacity:(o=r.data,o.every(e=>0===S(e[O]))?.5:1)}),k.dotPositions[i]&&n(t,{children:[e("line",{x1:k.dotPositions[i].x,y1:0,x2:k.dotPositions[i].x,y2:A,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"}),e("circle",{cx:k.dotPositions[i].x,cy:k.dotPositions[i].y,r:5,fill:"white",stroke:r.color,strokeWidth:a,style:{transition:"cx 0.1s, cy 0.1s"}}),e("line",{x1:0,y1:k.dotPositions[i].y,x2:M,y2:k.dotPositions[i].y,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"})]})]},i):null;var o}),(()=>{if(1===D.length){const t=D?.[0];return e("text",{x:y?M/2:M,y:A+15,textAnchor:y?"middle":"end",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=t[V]?String(t[V]):""},String(t[V]))}if(D.length<7)return D.map(t=>e("text",{x:z(t[V]),y:A+15,textAnchor:"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=t[V]?String(t[V]):""},String(t[V])));{const t=(i-80-7*9.2)/6;return Array.from({length:7}).map((n,r)=>{const i=Math.floor(r*(D?.length-1)/6),o=D[i];return e("text",{x:r*t,y:A+15,fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:g},children:null!=o?.[V]?String(o?.[V]):""},String(o?.[V]))})}})(),(()=>{if("memory"===v){const t=Math.max(N,1024);return Array.from({length:6}).map((n,r)=>{const i=r*t/5,o=i/1024;return e("text",{x:-10,y:T(i),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:o.toFixed(1)},`y-${r}`)})}return Array.from({length:6}).map((t,n)=>{const r=n*N/5;return e("text",{x:-10,y:T(r),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:g},children:r.toFixed(0)},`y-${n}`)})})()]})}),x&&k.tooltip.visible&&n("div",{className:"ff-line-chart-tooltip",style:{left:b&&k.tooltip.left/2>i/1.75?k.tooltip.left-180:k.tooltip.left,top:k.tooltip.top},children:[e("div",{className:"ff-line-chart-date",children:k.currentXValue}),Object.entries(k.hoverValues).map(([t,i])=>!1!==r[Number(t)]?.show&&n("div",{className:"ff-line-chart-inner-tooltip",children:["default"!==r[Number(t)]?.name&&e("div",{className:"ff-line-chart-status-dot",style:{backgroundColor:r[Number(t)]?.color}}),r[Number(t)]?.name,": ",i]},t))]})]})]})},pE=({onClose:t,top:r="100px",left:i="0px",className:o,description:a="Download and Install the fireflink client to run the script",onClick:s=()=>{},optionZIndex:c=10000001})=>{l(()=>{const e=e=>{"Escape"===e.key&&t?.()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[t]);return n("div",{className:`ff-download-client-wrapper ${o}`,style:{top:r,left:i,zIndex:c},children:[n("div",{className:"ff-download-client-header-wrapper",children:[e("div",{className:"ff-download-client-hollow-triangle"}),e(F,{fontWeight:"semi-bold",lineHeight:"32px",className:"ff-download-client-header-text",children:"Download client"}),e(P,{name:"close",color:"var(--brand-color)",className:"ff-download-client-close-icon",height:12,width:12})]}),n("div",{className:"ff-download-client-content-text",children:[e(F,{as:"div",color:"var(--download-client-content-text-color)",fontWeight:"semi-bold",textAlign:"center",lineHeight:"26px",children:a}),e(F,{as:"div",className:"ff-download-client-description-text",textAlign:"center",fontWeight:"medium",lineHeight:"26px",children:"Choose OS to Download"}),e("div",{className:"ff-download-client-os-wrapper",children:["windows","mac_icon","linux"].map(t=>e("div",{className:"ff-os-version-wrapper",onClick:()=>{s("mac_icon"===t?"mac":t)},children:e(P,{name:t,height:36,width:36})},t))})]})]})},CE=({legendName:t,height:r,width:i,children:o})=>e("div",{className:"ff_fieldSet_container",children:n("fieldset",{className:"ff_fieldSet",style:{height:r,width:i},children:[e("legend",{className:"ff_legend_container",children:e(F,{color:"var(--license_header_text_color)",fontSize:8,lineHeight:"12px",children:t})}),e("div",{className:"ff_children_container",children:o})]})}),mE=({onSelectVariable:t,dropdownPosition:n,filteredOptions:r=[],position:i="relative",width:o="100%",zIndex:a,truncateTextValue:l=34})=>e("div",{className:z(`ff-variable-dropdown-container ${i}`),style:n?{top:n.top+30,left:n.left-30,width:o,zIndex:a}:{width:o,zIndex:a},children:G(r)?e("div",{className:"ff-variable-option no-data",children:e(F,{as:"div",children:"No Option",fontSize:14})}):r?.map(n=>e("div",{className:"ff-variable-option",onMouseDown:()=>t(n),children:e(K,{title:oe(n?.name,l,"pixel")?n?.name:"",children:e(F,{children:ie(n?.name,l,"pixel")})})},n?.id))}),gE=o(({label:t="",hashInputValue:r="",setHashInputValue:i,variableList:o=[],placeholder:s="Enter text",onChange:d,onPaste:u,onCreateVariableClick:f,handleClearInput:h,value:p="",dropdownWidth:C="100%",dropdownHeight:m="160px",isHash:g=!1,isOnlyHash:v=!1,dataFiles:y=[],showAddVariableIcon:w=!0,helperText:E="",error:M,autoComplete:A="off",required:x=!1,zIndex:L=9999,truncateTextValue:k=34,formProps:H={},getSelectedVariable:S=()=>{},symbol:_="$",type:V="text",clearIcon:O=!0,inputTitle:N="",onBlur:T,helperTextWidth:I,iconProps:D={isShowIcon:!1,iconName:"",iconToolTipTitle:"",isIconDisable:!1,iconColor:"",onIconClick:()=>{}},...Z},j)=>{const[R,B]=c(!1),[U,q]=c(!1),[W,Q]=c(!1),[Y,X]=c(null),[J,$]=c(0),[ee,te]=c(!1),[ne,re]=c([]),ie=a(null),oe=a(null),[ae,le]=c("auto"),se=D?.isShowIcon;l(()=>{const e=oe.current?.querySelector(".ff-input-container");if(!e)return;const t=new ResizeObserver(e=>{for(let t of e){const e=`${t.contentRect.width}px`;le(e)}});return t.observe(e),()=>{t.disconnect()}},[]),b(j,()=>ie.current),l(()=>{null!==Y&&ie.current&&(ie.current.setSelectionRange(Y,Y),ie.current.focus())},[Y]),l(()=>{g&&B(p.startsWith("#"));const e=y?.find(e=>e.name===p),t=o?.find(e=>e?.name===p);if(p.startsWith("#")&&g){const e=p.slice(1).toLowerCase(),t=y.filter(t=>t.name.toLowerCase().includes(e));re(t),B(!0)}const n=null!==e&&p.startsWith("#"),r=null!==t&&p.startsWith("$"),i=p.length>(t?.name.length||0),a=p.length>0&&!r||p.startsWith("#");v?te(!1):r||n||p.includes("$")||p.includes("#")?(te(!1),a&&te(!0)):i&&!p.includes("$")&&te(!0)},[p]);const ce=()=>{ie.current&&$(ie.current.selectionStart||0)},de=ce,ue=ce;l(()=>{ie.current&&$(ie.current.selectionStart||0)},[p]);const fe=e=>{if(ie.current){const{selectionStart:t,selectionEnd:n}=ie.current,r=`${e.name}`;let o;if(o=g&&"#"===p[0]?e.name+p.slice(n||1):e.name,d){d({target:{value:o}},e),S(e.name)}ie.current.value=o,i?.(e),X((t||0)+r.length),B(!1),q(!0)}};const he=function(e,t,n){let r=!1,i="";const o="}"===p[t-1];if(t<0||t>e.length)return{showDropdown:r,searchString:i};const a=e.lastIndexOf(_,t-1),l=e.indexOf(_,t);if(-1!==a&&(v&&"$"===e[a]?r=!1:t===a+1?(r=!0,i=""):(i=e.slice(a+1,-1===l?void 0:l),t>a+1&&(i=e.slice(a+1,t)),r=!0),U&&o&&(r=!1),(/[{}]/.test(i)||0===t)&&(r=!1,i=""),i)){n.some(e=>e.name.toLowerCase().includes(i.toLowerCase()))||(n=[])}return{showDropdown:r,searchString:i}}(p,J,o),pe=()=>o?.filter(e=>e?.name?.toLowerCase()?.includes(he?.searchString?.toLowerCase()));return n("div",{className:"ff-add-variable-container",children:[n("div",{className:"ff-add-variable-input",ref:oe,children:[e(K,{title:N,style:{width:"100%"},children:e(rn,{...Z,name:"add_variable",ref:ie,type:V,className:z("ff-variable-input-container",{"ff-variable-input-container--show-icon":se}),value:p,onChange:d,onPaste:()=>{te(!0)},variant:"primary",label:t,placeholder:s,onClick:de,onKeyUp:ue,onFocus:()=>Q(!0),onBlur:e=>{(e=>{e.relatedTarget&&e.relatedTarget.closest(".dropdown-container")||Q(!1)})(e),T?.(e)},autoComplete:A,helperText:E,error:M,required:x,helperTextWidth:I,...H})}),!G(p)&&ee&&w&&e("div",{className:"ff-create-variable-container",onClick:f,children:e(F,{fontWeight:"regular",fontSize:"10px",color:"var(--brand-color)",cursor:"pointer",children:"Create Variable"})}),!G(p)&&!v&&e("div",{className:z("ff-cancel-icon-container",{"ff-cancel-icon-container--show-icon":se}),children:O&&e(K,{title:"Cancel",style:{zIndex:99999},children:e(P,{onClick:h,name:"close",height:16,width:16,hoverEffect:!0})})}),se&&e("div",{className:"ff-info-icon-container",children:e(K,{title:se&&!D?.isIconDisable?D?.iconToolTipTitle:"",children:e(P,{name:D?.iconName||"",hoverEffect:!1,height:16,width:16,color:D?.iconColor||"var(--text-area-default-color)",onClick:e=>{D?.onIconClick&&D?.onIconClick(e)},disabled:D?.isIconDisable,cursorType:"pointer"})})})]}),he?.showDropdown&&W&&e(fE,{position:"absolute",zIndex:L,truncateTextValue:k,width:ae,height:G(pe())?"auto":m,optionsList:pe(),onSelectVariable:fe}),R&&g&&W&&e(mE,{position:"relative",zIndex:L,truncateTextValue:k,width:ae,filteredOptions:ne,onSelectVariable:fe})]})}),vE=({isOpen:t,variableTypesList:r=[],onClose:i,onNameChange:o,onValueChange:a,variableName:s,variableValue:d,onVariableTypeChange:u,selectedVariableType:f,hideValue:h=!1,onHideChange:p,handleSubmit:C,mode:m="create",disabled:g,dataFiles:v=[],truncateTextValue:y=34,isEnterKeySubmit:w=!1})=>{const[b,E]=c(!1),[M,A]=c(""),[x,L]=c(),[k,H]=c(!1),[S,_]=c(!1),[V,O]=c({name:"",value:"",isChecked:!1});l(()=>{t&&"edit"===m&&O({name:s,value:d,isChecked:h})},[]);const z=e=>e&&0!==e.length?" "===e[0]||" "===e[e.length-1]?"Space is not allowed at starting and at the end":Ee.test(e)?e.length<3?"Name should contain at least 3 characters":e.length>25?"Name can contain at most 25 characters":"":"Name should be alphanumeric":"Variable Name is required";function N(e){const t=!!e,n=Ee.test(e),r=Vt.test(e),i=e.length>=3&&e.length<=25;return t&&n&&r&&i}l(()=>{const e=z(s);E(!!e),A(e)},[s]),l(()=>{if("edit"!==m)return;const{name:e,value:t,isChecked:n}=V;_(s!==e||d!==t||h!==n)},[m,s,d,h,V]);const T=()=>{!k&&N(s)&&(H(!0),C())};l(()=>{if(!w)return;const e=e=>{if("Enter"===e.key){e.preventDefault();!N(s)||k||"edit"===m&&!S||T()}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[w,s,d,h,k,m,S,f]);return e(X,{zIndex:1350,onClose:i,isOpen:t,title:"create"===m?"Create Variable":"Edit Variable",width:"284px",height:"280px",top:"30%",right:8,isFooterRequired:!0,overlay:!0,footerContent:e(()=>n("div",{className:"ff-create-slider-footer",children:[e(U,{onClick:i,label:"Cancel",variant:"tertiary"}),e(U,{variant:"primary",label:"create"===m?"Create":"Update",type:"submit",onClick:T,disabled:!N(s)||k||"edit"===m&&!S})]}),{}),children:n("div",{className:"ff-create-variable-slider",children:[e("div",{className:"ff-create-variable-slider-input",children:e(rn,{label:"Variable Name",required:!0,type:"text",name:"variableName",value:s||"",onChange:e=>{H(!1),o(e.target.value)},error:b,helperText:M,onBlur:e=>{const t=e.target.value,n=z(t);E(!!n),A(n)}})}),e(lr,{label:"Variable Type",required:!0,onChange:e=>{u(e),H(!1)},selectedOption:f,optionsList:r,optionZIndex:99999,valueAccessor:"label",disabled:"edit"===m}),e(gE,{label:"Variable Value",placeholder:"Enter Variable value or select path using #",isHash:!0,isOnlyHash:!0,zIndex:99999,truncateTextValue:y,dataFiles:v,dropdownWidth:"100%",setHashInputValue:L,hashInputValue:x||{},value:d||"",type:h?"password":"text",onChange:(e,t)=>{const n=e.target.value;a(n,t)},showAddVariableIcon:!1}),n("div",{className:"ff-hide-value-content",children:[e(te,{onChange:e=>p(e.target.checked),name:"hideValue",label:"Hide Value",checked:h,disabled:g}),e(K,{title:"Once the value is hidden, it cannot be undone",children:e(P,{name:"info",width:12,height:12})})]})]})})},yE=({highlightText:t="",tableMeta:r=[],tableData:i=[],accordionType:o="row",noDataContent:a,height:l="100%",withFixedHeader:s=!1,headerType:d,TableAccordionStateIconWidth:u=4,TableAccordionStateIconHeight:f=8})=>{const[h,p]=c(-1),C=(e,t)=>{let n=e[t.accessor];return t.cell?t.cell({value:n,row:e,column:t.accessor}):t.accessor||n&&"object"!=typeof n?n:"--"},m=t=>{const n=t.map((t,n)=>e("table",{className:"ff-accordion-table",cellSpacing:0,children:e("tbody",{className:"ff-table-body",children:e("tr",{className:"ff-table-row",children:r.map((n,r)=>e("td",{className:"ff-table-cell",style:{width:n.width},children:"column"===o&&0===r?"":e(F,{children:C(t,n)})},n.accessor+r))},t.id||n)})},`accordion-table-${n}`));return n};return n("div",{style:{height:l},className:z("ff-accordion-table-container",{"ff-accordion-fixed-header-table":s}),children:[e("table",{cellSpacing:0,className:z("ff-accordion-table",{"ff-accordion-fixed-header":s}),children:e("thead",{children:e("tr",{className:"ff-table-row",children:r.map(t=>e("th",{style:{width:t.width},className:z("ff-table-header",d&&`ff-accordion-table--${d}-bg`),children:e("div",{children:e(F,{fontWeight:"semi-bold",fontSize:12,children:t.header})})},`header-${t.header}`))})})}),"row"===o&&i.map((n,r)=>e($,{highlightText:t,headerTitle:n.title,color:"var(--text-color)",accordionContent:m(n.data),disable:n.disable,disableInfoMessage:n.disableInfoMessage,accordionStateIconName:"arrows_down_icon",AccordionStateIconWidth:u,AccordionStateIconHeight:f},`accordion-row-${r}`)),"column"===o&&i.map((i,o)=>n("div",{className:"column-table-accordion",children:[e("div",{className:"ff-display-flex",children:e(K,{title:i.disable?i?.disableInfoMessage:"string"==typeof i.title&&oe(i.title,r[0]?.width,"pixel")?i.title:"",placement:"bottom-start",children:n("div",{className:`accordion-header ${i.disable&&"accordion-header--disabled"}`,children:[e("div",{className:"header-title",children:e("span",{children:e(F,{children:e(J,{text:ie(i.title,r[0]?.width,"pixel"),highlight:t})})})}),e("div",{className:"accordion-arrow",onClick:()=>{!i.disable&&(e=>{p(e===h?-1:e)})(o)},children:e(P,{name:h===o?"arrows_down_icon":"arrows_right_icon",color:"var(--table-with-accordion-icon-color)",width:u,height:f,hoverEffect:!1})})]})})}),h===o&&e("div",{children:m(i.data)})]},`column-accordion-${o}`)),i.length<=0&&e("div",{className:"no-data-content",style:{height:`calc(${l} - 50px)`},children:a})]})},wE=({progressPercentage:t,totalMemory:r,usedMemory:i,color:o="var(--brand-color)",trackColor:a="#f0f0f0",height:l=10,label:s,labelFontSize:c=12,labelTextColor:d="var(--ff-card-status-text-color)",showPercentage:u=!1,percentageFontSize:f=10,percentageTextColor:h="var(--tooltip-text-color)",progressBarWidth:p="200px"})=>{const C=e=>{const t=e.trim().toLowerCase();if("0"===t)return 0;const n=t.match(/^(\d+(?:\.\d+)?)\s*(kb|mb|gb)$/);if(!n||!n[1])return 0;const r=parseFloat(n[1]),i=n[2];return"gb"===i?1024*r:"kb"===i?r/1024:r};let m=0,g=s;if(void 0!==r&&void 0!==i){const e=C(i),t=C(r);t>0?(m=e/t*100,g=s||i):(m=0,g="0MB")}else m=t||0;const v=Math.max(0,Math.min(m,100));return n("div",{className:"ff-progress-bar-container "+(g?"ff-has-label":""),style:{width:p},children:[e("div",{className:"ff-progress-bar-track",style:{backgroundColor:a,height:`${l}px`},children:e("div",{className:"ff-progress-bar",style:{width:`${v}%`,backgroundColor:o,height:`${l}px`},children:u&&e(F,{className:"ff-progress-bar-percentage",fontSize:f,color:h,children:`${Math.round(v)}%`})})}),g&&e("div",{className:"ff-progress-bar-label",children:e(F,{fontSize:c,color:d,children:e(K,{title:oe(g,10,"count")?g:"",children:ie(g,10,"count")})})})]})},bE=({variant:t="primary",size:n="small",onClick:r,label:i="Choose File",disabled:o=!1,type:l="button",className:s="",style:d={},iconName:f,isChooseFile:h=!1,buttonWidth:p="auto",buttonHeight:C="auto",selectedFile:m={},handleCloseIcon:g,isMandatory:v=!1})=>{const y=a(null),[w,b]=c(0);u(()=>{y.current&&b(y.current.getBoundingClientRect().width-10)},[p]);const E=m?.name||i,M=w?ie(E,w,"pixel"):E,A=!!w&&oe(E,w,"pixel");return e("div",{ref:y,style:{width:p},children:e(K,{title:A?E:"",children:e(U,{variant:t,label:M,type:l,onClick:r,buttonWidth:p,buttonHeight:C,isChooseFile:h,size:n,disabled:o,className:s,iconName:f,style:d,iconPosition:"right",selectedFile:m,handleCloseIcon:g,isMandatory:v})})})},EE=({selected:t="text",handleClick:r,tabList:i})=>{const o=i?.includes("Automation"),a=i?.includes("Manual");return n("div",{className:"ff-script-switch-container",children:[e(K,{title:o?"Automation":"Add Automation",zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Automation"===t?"active":""),onClick:()=>r(o?"Automation":"Add Automation"),children:e(P,{name:o?"automation_testcase":"add_testcase",color:"Automation"===t?"var(--primary-button-text-color)":"var(--description-text)"})})}),e(K,{title:a?"Manual":"Add Manual",zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Manual"===t?"active":""),onClick:()=>r(a?"Manual":"Add Manual"),children:e(P,{name:a?"manual_testcase":"add_testcase",color:"Manual"===t?"var(--primary-button-text-color)":"var(--description-text)"})})})]})},ME=({selected:t,handleClick:n,tabList:r})=>e("div",{className:"ff-switch-container",children:r.map(r=>e(K,{title:t===r.name?null:r.tooltip,zIndex:1e3,children:e("div",{className:"ff-switch-button "+(t===r.name?"active":""),onClick:()=>n(r.name),children:e(P,{name:r.icon,color:t===r.name?"var(--primary-button-text-color)":"var(--description-text)"})})},r.name))}),AE=({onModalClose:t,MediaSrc:r,fileName:o,onDeleteClick:a,mediaType:s,fileId:d,thumbnailMediaSrc:u,isDelete:f=!0,onExpandClick:h,onDownloadClick:p,isMediaIcon:C=!1,previewOnly:m=!1,iconName:g="video_preview",isDisabled:v=!1})=>{const[y,w]=c(!1),b=i.useRef(null),E=()=>{w(!0),h&&h(d)},M=()=>{t?.(),w(!1)},A=()=>{p&&p(d)};return l(()=>{m&&w(!0)},[m]),n("div",{children:[!m&&(C?e(P,{name:g,hoverEffect:!0,onClick:E,disabled:v}):e(kv,{mediaSrc:r,mediaType:s,onDownloadClick:A,onDeleteClick:()=>a?.(r),onExpandClick:E,fileName:o,fileId:d,thumbnailMediaSrc:u,isDelete:f})),y&&e(th,{isOpen:y,onClose:M,isFooterDisplayed:!1,isHeaderDisplayed:!1,customWidth:"1130px",customHeight:"570px",zIndex:1e4,children:n("div",{className:"media-wrapper",children:[n("div",{className:"ff-expand-icons",children:[e(K,{title:"Download File",children:e(P,{name:"download_file_icon",onClick:A,color:"var(--icons-default-color)",className:"header-icons"})}),e(K,{title:"Expand",children:e(P,{name:"expand",onClick:E,color:"var(--icons-default-color)",className:"header-icons"})}),e(K,{title:"close",children:e(P,{name:"close",onClick:M,color:"var(--icons-default-color)",className:"header-icons"})})]}),"image"===s&&e("img",{src:r,alt:"fileName",height:"auto"}),"video"===s&&e("video",{src:r,controls:!0,controlsList:"nodownload",className:"ff-video-preview",ref:b,onCanPlay:()=>{if(b.current){const e=b.current.play();void 0!==e&&e.catch(e=>{console.error("Autoplay failed:",e)})}}})]})})]})},xE=({children:t,orientation:r="",navBarIcons:o=[],mobileHeight:a=448,mobileWidth:l=220,UtilityBar:s,tooltip:c={},background:d,navBarPosition:u="bottom"})=>{const f="portrait"===r,h=f?a:l,p=f?l:a,C=s&&"top"===u,m=s&&"bottom"===u,g=s&&"left"===u;return n("div",{className:["ff-mobileskin-wrapper",f?"portrait":"landscape",g?"ff-side-nav-left":"",C?"navbar-top":"",m?"navbar-bottom":""].filter(Boolean).join(" "),children:[C&&e("div",{className:"ff-nav-bar top-nav-bar",children:o.map(({title:t,name:n,className:r,...i},a)=>{const l=c?.[n]??a;return e(K,{title:c?.[n]||"",placement:"top",children:e("div",{className:`ff-nav-bar-icon ${r||""} ${a===o.length-1?"last-icon":""} ${C?"navbar-top":""}`,children:e(P,{name:n,...i})})},l)})}),e("div",{className:"ff-mobileskin-container",style:{height:h+16,width:p+16},children:e("div",{className:"ff-mobile-container",style:{width:p,height:h,background:d||"transparent"},children:e("div",{className:"ff-mobile-image-container",children:i.isValidElement(t)?t:e("img",{src:t,alt:"Mobile content",style:{width:f?"100%":2.1*l+"px",height:f?"100%":.5*a+"px"}})})})}),s&&m&&e("div",{className:"ff-nav-bar",children:o?.map((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-nav-bar-icon ${t?.className||""} ${n===o.length-1?"last-icon":""}`,children:e(K,{title:r,children:e(P,{...i})})},n)})}),s&&g&&e("div",{className:"ff-side-nav-bar",children:o?.map((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-sidebar ${t?.className||""} ${n===o.length-1?"last-icon":""}`,children:e(K,{title:r,placement:"bottom",children:e(P,{...i})})},n)})})]})},LE=o(({width:t=300,height:r=40,iconHeight:i=16,iconWidth:o=16,placeholder:l="Enter text",iconName:s="right_arrow_filled_icon",iconPosition:c="left",borderRadius:d=4,autoFocus:u=!1,value:f="",iconColor:h="var(--brand-color)",tooltipTitle:p="send",submitPrompt:C,onPromptChange:m,onBlur:g,onFocus:v,disableInput:y,isAdditionalIcon:w=!1,additionalIconName:b,additionIconToolTip:E,onAdditionalIconClick:M},A)=>{const x=a(null);ce([{key:"Enter",action:()=>L()}],x);const L=e=>{f&&C?.(f.trim())};return n("div",{className:z("ff-prompt-container",{"icon-left":"left"===c,"icon-right":"left"!==c}),style:{width:`${t}px`,height:`${r}px`,borderRadius:d},ref:x,children:[e(K,{placement:"top",title:p,children:e(P,{name:s,className:"ff-prompt-icon",height:i,width:o,onClick:C,color:h,disabled:G(f)})}),e("input",{ref:A,className:"ff-prompt-input",type:"text",placeholder:l,autoFocus:u,onChange:m,onFocus:v,onBlur:g,value:f,readOnly:y}),w&&b&&e(K,{placement:"top",title:E,children:e(P,{name:b,className:"ff-prompt-icon additional-icon",height:i,width:o,onClick:M})})]})}),kE=({content:t,isVisible:n,maxWidth:r=300,onClick:i,isClickable:o=!0,arrowPosition:a="left"})=>e("div",{onClick:i,style:{width:`${r}px`,"--triangle-position":r-4+"px"},className:z("ff-chat-msg-box",{visible:n,hidden:!n,pointer:o,default:!o,"chat-arrow-left":"left"===a,"chat-arrow-right":"left"!==a}),children:e("div",{className:z("content",`arrow-${a}`),children:e(F,{children:t})})}),HE=({iconName:r,iconPosition:{top:i,left:o,bottom:a,right:l},hoverIconPosition:{top:s,left:d,bottom:u,right:f},modalPosition:{top:h,left:p,bottom:C,right:m},modalWidth:g,modalHeight:v,headerContent:y="Header Content",footerContent:w="Footer Content",iconWidth:b,iconHeight:E,modalHeading:M="Ask Fia",children:x,onClearChat:L})=>{const[k,H]=c(!1),[S,_]=c(!1);return n(t,{children:[n("div",{style:{top:void 0!==i?`${i}px`:void 0,left:void 0!==o?`${o}px`:void 0,bottom:void 0!==a?`${a}px`:void 0,right:void 0!==l?`${l}px`:void 0},className:"ff-dynamic-icon-container",children:[e(P,{className:"ff-dynamic-icon",name:r,onClick:()=>{_(e=>!e),setTimeout(()=>H(e=>!e),10)},height:E,width:b}),e("div",{style:{top:void 0!==s?`${s}px`:void 0,left:void 0!==d?`${d}px`:void 0,bottom:void 0!==u?`${u}px`:void 0,right:void 0!==f?`${f}px`:void 0},className:"ff-chat-icon-hover",children:e(P,{name:"ask_fia_icon",height:32,width:82})})]}),S&&A(e("div",{className:z("ff-dynamic-modal",{open:k}),style:{top:void 0!==h?`${h}px`:void 0,left:void 0!==p?`${p}px`:void 0,bottom:void 0!==C?`${C}px`:void 0,right:void 0!==m?`${m}px`:void 0,position:"fixed",height:v,width:g},children:n("div",{className:"ff-dynamic-modal-content",children:[y&&e("div",{className:"ff-dynamic-modal-header",children:n("div",{className:"header-container",children:[n("div",{className:"header-left",children:[e(P,{height:16,width:16,name:"fia_icon"}),e(F,{fontWeight:"medium",children:M})]}),n("div",{className:"header-right",children:[e("span",{className:"action",children:e(K,{title:"Clear chat",placement:"bottom",children:e(P,{height:16,width:16,name:"delete",color:"var(--tooltip-text-color)",onClick:L})})}),e("span",{className:"action",children:e(K,{title:"Close",placement:"bottom",children:e(P,{height:16,width:16,name:"close",color:"var(--tooltip-text-color)",onClick:()=>(H(!1),void setTimeout(()=>_(!1),300))})})})]})]})}),e("div",{className:"ff-dynamic-modal-body",children:x}),w&&e("div",{className:"ff-dynamic-modal-footer",children:w})]})}),document.body)]})},SE=o(({iconName:r,hoverTitle:i,iconPosition:{top:o,left:s,bottom:d,right:u},hoverIconPosition:{top:f,left:h,bottom:p,right:C},modalPosition:{top:m,left:g,bottom:v,right:y},modalWidth:w,modalHeight:E,headerContent:M="Header Content",footerContent:x="Footer Content",iconWidth:L,iconHeight:k,children:H,onVisibilityChange:S},_)=>{const[V,O]=c(!1),[N,T]=c(!1),I=a(null),D=()=>{I.current&&clearTimeout(I.current),O(!1),I.current=setTimeout(()=>{T(!1),S?.(!1)},300)};return b(_,()=>({closeModal:D})),l(()=>()=>{I.current&&clearTimeout(I.current)},[]),n(t,{children:[n("div",{style:{top:void 0!==o?`${o}px`:void 0,left:void 0!==s?`${s}px`:void 0,bottom:void 0!==d?`${d}px`:void 0,right:void 0!==u?`${u}px`:void 0},className:"ff-ai-dynamic-icon-container",children:[e(P,{className:"ff-ai-dynamic-icon",name:r,onClick:()=>{I.current&&clearTimeout(I.current),T(e=>!e),S?.(!N),I.current=setTimeout(()=>O(e=>!e),10)},height:k,width:L}),e("div",{style:{top:void 0!==f?`${f}px`:void 0,left:void 0!==h?`${h}px`:void 0,bottom:void 0!==p?`${p}px`:void 0,right:void 0!==C?`${C}px`:void 0},className:"ff-ai-chat-icon-hover",children:e("div",{className:"ai-hover-leaf",children:e(F,{fontWeight:"bold",fontSize:14,color:"var(--chatbot-leaf-text)",children:i})})})]}),N&&A(e("div",{className:z("ff-ai-dynamic-modal",{open:V}),style:{top:void 0!==m?`${m}px`:void 0,left:void 0!==g?`${g}px`:void 0,bottom:void 0!==v?`${v}px`:void 0,right:void 0!==y?`${y}px`:void 0,position:"fixed",height:E,width:w},children:n("div",{className:"ff-ai-dynamic-modal-content",children:[M&&e("div",{className:"ff-ai-dynamic-modal-header",children:M}),e("div",{className:"ff-ai-dynamic-modal-body",children:H}),x&&e("div",{className:"ff-ai-dynamic-modal-footer",children:x})]})}),document.body)]})}),_E=({variant:t,title:r,tabTitle:i,comment:o,profileShortName:a})=>n("div",{className:"ff-history-card",children:[e("div",{className:z("header",`header--${t}`),children:e(F,{fontWeight:"semi-bold",children:i})}),n("div",{className:"body",children:[e("div",{className:"title",children:n("div",{className:"profile",children:[e(F,{className:z("avatar",`avatar--${t}`),children:a}),e(F,{children:r})]})}),n("div",{className:"comment-container",children:[e(F,{fontWeight:"semi-bold",className:"heading",children:"Comments:"}),e(F,{color:"var(--details-page-value-color)",className:"comment",children:o})]})]})]}),VE=({onChange:t,disabled:r,checked:i=!1,id:o="toggle",path:a})=>n("div",{className:"ff--ai-switch-container",children:[e("input",{className:"ff--ai-switch-checkbox",id:`ff-toggle-${o}`,type:"checkbox",disabled:!!r,onChange:e=>{t&&t(e)},checked:i}),e("label",{className:z("ff--ai-switch-label",{"ff--ai-switch-label--disabled":r}),htmlFor:`ff-toggle-${o}`,children:e("span",{className:"ff--ai-switch-content",children:n("span",{className:"ff--ai-switch-content",children:[e(F,{className:z("ff--ai-switch-typography",{left:i,right:!i}),as:"div",fontWeight:"bold",fontSize:18,color:i?"var(--base-bg-color)":"var(--ff-ai-toggle-text-color)",children:"AI"}),e("img",{className:"ff--ai-switch-image",src:a,alt:"AI image"})]})})})]}),OE=o(({name:t,height:n=30,width:r=30,path:i="",onClick:o,color:s="var(--brand-color)",hoverEffect:c=!1,className:d="",disabled:u=!1,variant:f="light",isSelected:h=!1,x:p,y:C,tabIndex:m=-1,...g},v)=>{if(!B[t])return null;const y=a(null);l(()=>{y.current&&(void 0!==p&&y.current.setAttribute("x",String(p)),void 0!==C&&y.current.setAttribute("y",String(C)))},[p,C]);const w={ref:v,onClick:u?void 0:o,style:{height:`${n}px`,width:`${r}px`,cursor:u?"not-allowed":"pointer",opacity:u?.3:1},tabIndex:m,...g};return e("span",{...w,children:e("img",{height:n,width:r,src:i,alt:""})})}),zE=({id:r=0,serialNumber:i,activeId:o,setActiveId:s,children:d,onIconClick:u,numberChildren:f,onContainerClick:h,onNextClick:p,onPreviousClick:C,disabled:m,isEditAccess:g,versionsLength:v,count:y,hiddenActions:w=[]})=>{const[b,E]=c(!1),[M,A]=c(!1),x=a(null),L=Array.isArray(w)?w:w?[w]:[],k=(e,t)=>{e.stopPropagation(),t()};l(()=>{x.current&&(()=>{if(x.current){const e=getComputedStyle(x.current),t=1.2*parseFloat(e.fontSize)*6;x.current.scrollHeight>t&&A(!0)}})()},[]);const H=e=>{e.stopPropagation(),E(!b)};return n("div",{className:`ff-prompt-container-Block ${o===r?"active":"inactive"} `,onClick:()=>{s(r),h()},children:[e(F,{fontSize:8,className:"ff-prompt-number-bg-color",as:"span",children:`Test cases ${i}`}),n(t,{children:[n("div",{className:"ff-prompt-content "+(b?"expanded":""),ref:x,children:[d,b&&n(t,{children:[e("span",{role:"button","aria-label":"toggleExpand",onClick:H,className:"read-less-btn",children:e(F,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read Less"})})," "]})]}),M&&!b&&e("div",{role:"button","aria-label":"toggleExpand",onClick:H,className:"read-more-btn",children:e(F,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read More"})})]}),n("div",{className:"ff-prompt-icons",children:[e("div",{className:"ff-prompt-icons-leftside",children:[{action:"delete",title:"Delete",color:"var(--ff-delete-button-attachment)"},{action:"edit",title:"Edit",color:"var(--label-edit-text-label-color)"},{action:"regenerate",title:"Regenerate",color:"var(--label-edit-text-label-color)"}].filter(e=>!L.includes(e.action)).map((t,n)=>{const r=g&&"delete"===t?.action||"regenerate"===t?.action&&(v??0)>=3||m;return e(K,{title:t.title,placement:"bottom",children:e(P,{disabled:r,name:t.action,color:t.color,hoverEffect:!0,onClick:e=>((e,t)=>{e.stopPropagation(),u(t)})(e,t.action)})},`${t?.title}-${n}`)})}),n("div",{className:"ff-prompt-icons-rightside",children:[e(P,{disabled:1===y,className:"ff-prompt-icons-style",name:"arrow_left_accordian",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>k(e,C),cursorType:"pointer"}),f,e(P,{disabled:y===v,className:"ff-prompt-icons-style",name:"arrow_right_icon",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>k(e,p),cursorType:"pointer"})]})]})]})},NE=o(({type:t="text",variant:r="primary",name:i="",label:o,disabled:a=!1,disableLinkIcon:l=!1,required:s=!1,placeholder:c="Attach Link",value:d,error:u,helperText:f,noBorder:h,className:p="",onChange:C,onBlur:m,onFocus:g,autoComplete:v="off",autoFocus:y=!1,minValue:w=-1/0,maxValue:b=1/0,transparentBackground:E=!1,size:M="small",isLabelRequired:A=!0,onClick:x,onKeyUp:L,isViewMode:k=!1,...H},S)=>{const _=!G(d);return n("fieldset",{className:z("ff-link-input-fieldset",{"ff-link-input-fieldset--disabled":a}),children:[n("div",{className:z("ff-link-input-container",{"ff-link-input-container--float":_,"ff-link-input-container--disabled":!!a}),children:[A&&n("label",{className:z(`ff-link-input-label-container ff-link-input-label-container--${M}`,{"ff-link-input-label-container--danger":!!u}),htmlFor:i,children:[s&&e("span",{className:"required-asterisk",children:"*"}),e("span",{className:z(`ff-link-input-label ff-link-input-label--${r}`,{"ff-link-input-label--no-hover":!!d,"ff-link-input-label--disabled":!!a,"ff-link-input-label--danger":!!u}),children:o})]}),e("input",{ref:S,name:i,value:d,type:t,spellCheck:!1,id:i,className:z(`ff-link-input ff-link-input-${r} default-input ff-link-input--${M}`,{"ff-link-input--transparentBackground":!!E,"ff-link-input--no-hover":!!d,"ff-link-input--disabled":!!a,"ff-link-input--danger":!!u,"ff-link-input--no-border":!!h,"ff-link-input--placeholder":!A},`${p}`),placeholder:c,disabled:k||a,onChange:C,onFocus:g,onBlur:m,autoComplete:v,autoFocus:y,min:w,max:b,onClick:x,onKeyUp:L,...H}),e("div",{className:"input-link-icon",children:l||u||!_?e(P,{name:"link",disabled:!0}):e(K,{title:"Click here to navigate",children:e("span",{children:e(P,{name:"link",disabled:!1,onClick:()=>{d&&!u&&window.open(d,"_blank")}})})})})]}),f&&u&&e("span",{className:z("ff-link-input-message",{"ff-link-input-message--danger":!!u}),children:f})]})}),TE=({labelsList:r=[],height:i=""})=>{const o=e("div",{className:"ff-chip-tooltip",children:r.filter((e,t)=>t>0).map((t,n)=>e(F,{as:"div",className:"ff-chip-tooltip-label",children:t},`label-${n}-${t}`))});return e(t,{children:!G(r)&&n("div",{className:"ff-chip-with-count-container",children:[e(K,{title:r[0],children:e(F,{as:"div",children:ie(r[0]||"",10),className:"ff-chip-label",fontWeight:"medium",style:i?{height:i}:void 0})}),r.length>1&&e(K,{title:e(F,{as:"div",children:o}),children:e(F,{as:"div",children:"+"+(r.length-1),className:"ff-chip-count",fontWeight:"medium"})})]})})};class IE extends E{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error("ErrorBoundary caught an error:",e,t)}render(){return this.state.hasError?this.props.fallback:this.props.children}}const DE=({iconName:t="",onButtonClick:r,buttonLabel:i="Label",buttonText:o="To Add Group",disableButton:a=!1,stepCount:l=1,iconWidth:s=120,iconHeight:c=120,addContentLabel:d="step"})=>n("div",{className:"add-content-button "+(a?"disabled":""),children:[!G(t)&&e("div",{className:"icon-container",children:e(P,{name:t,width:s,height:c})}),n("div",{className:"typography-label-button",children:[n(F,{fontSize:"12px",fontWeight:"regular",lineHeight:"18px",children:[d+l," :"]}),e(F,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:"Click"}),e(eh,{label:i,onClick:r,iconName:"plus_user_icon",isDisable:a}),e(F,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:o})]})]}),ZE=({variant:t="default",tabsData:r,activeTabId:i,onTabClick:o,noBorder:a=!1,noPadding:l=!1,titleSize:s="12px"})=>{const[d,u]=c(0);return n("div",{className:"ff-tabs-slider-container",children:[n("div",{className:z(`ff-tab-row--${t} ff-tab-row-section`,{"ff-tab-row--no-border":a,"ff-tab-row--no-padding":l,"ff-tab-row--position":r.length>4}),children:[r.length>4&&e(P,{className:"ff-tab-icon ff-tab-icon--previous",name:""+(d?"arrow_left_accordian":""),onClick:()=>{d>0&&u(e=>e-1)},hoverEffect:!0}),e("div",{className:"ff-tab-row-carousel",children:e("div",{className:"carousel_inner",style:{transform:`translateX(-${100*d}%)`},children:r.map(r=>n("button",{onClick:()=>!r.disabled&&o(r.id),disabled:r.disabled,className:z(`ff-tab-button--${t}`,{disabled:r.disabled,active:i===r.id}),style:{flex:"0 0 25%"},children:[n("div",{className:"label-count-section",children:[e(K,{title:r.label.length>9?r.label:"",children:e(F,{children:r.label.length>9?r.label.slice(0,9)+"...":r.label,fontSize:s,lineHeight:"18px",fontWeight:i===r.id?"semi-bold":"regular",color:i===r.id?"var(--tabs-label-active-color)":"var(--tabs-label-default-color)",className:z("ff-tab-label",{"ff-tab-label--active":i===r.id})})}),"default"===t&&r.count&&e("span",{className:z("tab-count",{"tab-count--active":i===r.id}),children:r.count})]}),e("div",{className:z("ff-tab-bar",{"ff-tab-bar--active":i===r.id})}),e("span",{className:"ff-defaultStatus "+("success"===r.status?"ff-successStatus":"error"===r.status?"ff-dangerStatus":"")})]},r.id))})}),r.length>4&&e(P,{className:"ff-tab-icon ff-tab-icon--next",name:""+(d<Math.ceil(r.length/4)-1?"arrow_right_icon":""),onClick:()=>{d<Math.ceil(r.length/4)-1&&u(e=>e+1)},hoverEffect:!0})]}),e("div",{className:"ff-tab-content",children:r.find(e=>e.id===i)?.component})]})},jE=o(({label:t="Status",iconName:r="update_icon",onClick:i,isDisable:o=!1,variant:a="default",backgroundColor:l=!1,border:s=!1},c)=>{const d={default:"var(--ff-avatar-background-color)",success:"var(--status-success-text-color)",danger:"var(--ff-delete-button-attachment)"};return e("button",{disabled:o,onClick:i,className:`\n ff-status-indicator\n ff-status-indicator--${a}\n ${l?`ff-status-indicator--with-bg ff-status-indicator--${a}-bg`:""}\n ${s?`ff-status-indicator--with-border ff-status-indicator--${a}-border`:""}\n `,ref:c,children:n("div",{className:"ff-status-indicator__content",children:[e(P,{name:"danger"===a?"close":r,color:d[a]||d.default,className:`ff-status-indicator__icon ff-status-indicator__icon--${a}`}),e(F,{as:"div",fontSize:12,className:`ff-status-indicator__label ff-status-indicator__label--${a}`,fontWeight:"medium",lineHeight:"20px",children:t})]})})}),RE=({rootLabel:t,childrenLabels:r,align:i="center",direction:o="horizontal"})=>{const a=r.length;return n("div","vertical"===o?{className:"ff-os-tree-vertical",style:{"--child-count":a},children:[n("div",{className:`ff-os-tree-vertical__row ff-os-tree-vertical__row--${i}`,children:[e("div",{className:"ff-os-tree-vertical__root-label",children:t}),e("div",{className:"ff-os-tree-vertical__horizontal-line"})]}),n("div",{className:"ff-os-tree-vertical__vertical-line-wrapper",children:[e("div",{className:"ff-os-tree-vertical__vertical-line"}),r.map((t,r)=>n("div",{className:"ff-os-tree-vertical__child",children:[e("div",{className:"ff-os-tree-vertical__child-connector"}),e("div",{className:"ff-os-tree-vertical__child-label",children:t})]},r))]})]}:{className:`ff-os-tree ff-os-tree--${i}`,style:{"--child-count":a},children:[n("div",{className:"ff-os-tree__root-wrapper",children:[e("div",{className:"ff-os-tree__root-label",children:t}),e("div",{className:"ff-os-tree__vertical-root"})]}),e("div",{className:"ff-os-tree__horizontal-connector",children:r.map((t,n)=>e("div",{className:"ff-os-tree__vertical-child"},n))}),e("div",{className:"ff-os-tree__children",children:r.map((t,n)=>e("div",{className:"ff-os-tree__child-container",children:e("div",{className:"ff-os-tree__child-label",children:t})},n))})]})},BE=({handleClose:t,handleResend:r,handleOtp:i,resendTimeout:o=30})=>{const[s,d]=c(Array(6).fill("")),[u,f]=c(o),[h,p]=c(!0),C=a(Array(6).fill(null));l(()=>{h||C.current[0]?.focus()},[h]),l(()=>{let e;return u>0&&(e=window.setInterval(()=>f(e=>e-1),1e3)),0===u&&p(!1),()=>clearInterval(e)},[u]);const m=e=>{e.preventDefault();const t=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,6),n=Array(6).fill("");t.split("").forEach((e,t)=>{n[t]=e}),d(n);const r=Math.min(t.length,5);C.current[r]?.focus()};return e(th,{isOpen:!0,onClose:t,isFooterDisplayed:!1,isHeaderDisplayed:!1,zIndex:999999,customWidth:"340px",children:n("div",{className:"ff-otp-popup",children:[n("div",{className:"ff-otp-header",children:[e(F,{fontSize:24,lineHeight:"36px",fontWeight:"semi-bold",children:"OTP Verification"}),e(P,{name:"close",height:16,width:16,onClick:t,className:"ff-close-icon"})]}),e("div",{className:"ff-otp-boxes",children:s.map((t,n)=>e("input",{type:"text",maxLength:1,className:`ff-otp-input ${t?"filled":""} ${n===s.findIndex(e=>""===e)?"active":""}`,value:t,onKeyDown:e=>((e,t)=>{const{key:n}=e;if(/^[0-9]$/.test(n)){e.preventDefault();const r=[...s];r[t]=n,d(r),t<5&&C.current[t+1]?.focus()}else if("Backspace"===n){e.preventDefault();const n=[...s];n[t]="",d(n),t>0&&C.current[t-1]?.focus()}})(e,n),onPaste:m,ref:e=>C.current[n]=e,readOnly:!0},n))}),e(U,{variant:"primary",label:"Submit",onClick:()=>i(s.join("")),disabled:s.includes(""),className:"ff-submit-btn"}),n("div",{className:"ff-resend "+(h?"disabled":""),onClick:h?void 0:()=>{f(o),p(!0),d(Array(6).fill("")),r()},children:["Re-send OTP",u>0?` (${u}s)`:""]})]})})},PE=({isOpen:t,onClose:r,isPlaying:i,onTogglePlay:o,mediaType:s,src:d,headerTitle:u,onDownload:f,onExpand:h,showHeader:C=!0,showDownload:m=!0,showExpand:g=!0,width:v="800px",height:y="432px",showControls:w=!0,customStyle:b,overlay:E=!0,children:M,showControlDownload:A=!1,showControlExpand:x=!1,isFullscreen:L=!1})=>{const k=a(null),H=a(null),[S,_]=c(0),[V,O]=c(0),[z,N]=c(!1),[T,I]=c(0);l(()=>{"video"===s&&k.current&&!M&&(i?k.current.play():k.current.pause())},[i,s,M]);const D=p(()=>{if(k.current&&!z){const e=k.current.currentTime/k.current.duration*100;I(e||0),_(k.current.currentTime)}},[z]),Z=p(()=>{k.current&&O(k.current.duration)},[]),j=p(()=>{_(0),I(0),o?.()},[o]),R=p(e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`,[]),B=p(e=>{if(k.current){const t=e/100*k.current.duration;k.current.currentTime=t,I(e),_(t)}},[]),U=p(e=>{if(z||!H.current)return;const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[B,z]),q=p(e=>{if(!H.current)return;N(!0);const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[B]),W=p(e=>{if(!z||!H.current||!k.current)return;const t=H.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[z,B]),Q=p(()=>{N(!1)},[]);return l(()=>{if(z)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",Q)}},[z,W,Q]),t?e(zs,{isOpen:t,onClose:r,isMaximized:!1,showHeader:C,overlay:E,downloadHandler:()=>{},customStyle:b,header:n("div",{className:"ff-header-content",children:[e(P,{width:23,height:23,name:"automatic_locator"}),e(F,{children:e("span",{className:"ff-header-title",children:u})})]}),icons:e(K,{title:"Close",children:e(P,{name:"close",onClick:r})}),width:v,height:y,zIndex:999,children:n("div",{className:"ff-video-wrapper",children:[M||("video"===s?e("video",{ref:k,src:d,className:"ff-media-video",onTimeUpdate:D,onLoadedMetadata:Z,onEnded:j}):e("img",{src:d,alt:"Preview",className:"ff-media-image"})),n("div",{className:"ff-top-right-icons",children:[m&&e(K,{title:"Download",children:e(P,{name:"download_file",color:"white",onClick:f})}),g&&e(K,{title:L?"Minimize":"Maximize",children:e(P,{name:L?"collapse_icon":"expand_icon",color:"white",onClick:h})})]}),"video"===s&&w&&!M&&n("div",{className:"ff-media-controls",children:[e("button",{onClick:o,className:"ff-play-pause-btn",children:e(K,{title:i?"Pause":"Play",children:e(P,{width:35,height:35,name:i?"pause_button":"play_button",color:"white"})})}),n("div",{className:"ff-progress-bar",children:[e("span",{className:"ff-current-time",children:R(S)}),e("input",{type:"range",className:"ff-seek-bar",min:0,max:100,value:T,onChange:e=>B(parseFloat(e.target.value)),onClick:U,onMouseDown:q,ref:H}),e("span",{className:"ff-total-time",children:R(V)})]}),n("div",{className:"ff-control-icons",children:[A&&e(K,{title:"Download",children:e(P,{name:"download_file",color:"white",onClick:f,cursorType:"pointer"})}),x&&e(K,{title:L?"Minimize":"Maximize",children:e(P,{name:L?"collapse_icon":"expand_icon",color:"white",onClick:h,cursorType:"pointer"})})]})]})]})}):null},FE=({header:r,secondaryHeader:i,primaryCount:o,secondaryCount:a,primaryItems:l,secondaryItems:s,width:c,activeTab:d="primary",activeTabId:u,onPrimaryTabClick:f,onSecondaryTabClick:h,onTabClick:p,actions:C,tabsData:m,notchPosition:g="top-left"})=>{const v=i&&"secondary"===d?s:l,y=a&&parseInt(a)>0,w=o&&parseInt(o)>0,b=i&&(w||y),{tooltip:E="Download",iconName:M="download_file",disabled:A=!1,onClick:x,className:L=""}=C?.download||{},{tooltip:k="Delete",iconName:H="delete_icon",disabled:S=!1,onClick:_,className:V=""}=C?.delete||{},O=()=>n("div",{className:"ff-dropdown-header-icons",children:[C?.download&&e(K,{title:E,children:e(P,{name:M||"",className:`ff-dropdown-icon ff-download-icon ${L}`,onClick:x,width:18,height:20,disabled:A,hoverEffect:!0})}),C?.delete&&e(K,{title:k,children:e(P,{name:H||"",className:`ff-dropdown-icon ff-delete-icon ${V}`,onClick:_,width:25,height:25,disabled:S,hoverEffect:!0})})]});return n("div",{className:"ff-resolution-dropdown",style:c?{minWidth:c}:{},children:[e("div",{className:"ff-dropdown-notch "+("bottom-center"===g?"bottom-center":"top-left")}),e("div",{className:"ff-dropdown-header",children:e("div",{className:"ff-dropdown-header-content",children:i&&m&&u?n(t,{children:[e(qs,{tabsData:m,activeTabId:u,onTabClick:e=>{p&&p(e),"tab-1"===e&&f?f():"tab-2"===e&&h&&h()}}),b&&O()]}):i&&b?n("div",{className:"ff-dropdown-header-dual",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,children:[e(F,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),o&&e("span",{className:"ff-dropdown-count",children:o})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,children:[e(F,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),a&&e("span",{className:"ff-dropdown-count",children:a})]}),O()]}):i?n("div",{className:"ff-dropdown-header-dual",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,children:[e(F,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),o&&e("span",{className:"ff-dropdown-count",children:o})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,children:[e(F,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),a&&e("span",{className:"ff-dropdown-count",children:a})]})]}):e(F,{fontSize:16,fontWeight:"semi-bold",children:r})})}),e("ul",{className:"ff-dropdown-list",children:v?.map((t,n)=>e("li",{className:"ff-dropdown-item",children:t},n))})]})},UE=(e,t)=>"string"==typeof e?ie(e,t):i.isValidElement(e)?i.cloneElement(e,{},UE(e.props.children,t)):Array.isArray(e)?e.map(e=>UE(e,t)):e,qE=(e,t,n,r)=>{const i=e[t.accessor];if(t.cell){const o=e._id||e.id;return t.cell({value:i,row:e,column:t.accessor,index:n,tableType:r,...o&&{refId:o}})}return t.accessor||i&&"object"!=typeof i?i:"--"},WE=(t,n=[],r,i,o)=>{let a=n;const l=void 0!==i?!i:r;return G(n)&&(isNaN(t)||(a=Array(t).fill(!0))),e("div",{className:"tree-table-fn-space-container",children:a?.map((n,r)=>e("span",{className:`tree-table-fn-space-block tree-table-fn-space-block-${r} ${n?"":"no-lines"} ${l&&r===t-1?"last-node":""} ${o?"folder":""}`},r))})},QE=i.memo(({treeRowRef:r,col:i,colIndex:o,columnMeta:a,node:l,selected:s,select:c,onCheckBoxChange:d,onToggleExpand:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:p,isExpanding:C,columnTextColor:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M})=>{const A={color:`${m||"var(--ff-primary-text-color)"}`,width:a?.width??i?.width,position:a?.sticky?"sticky":void 0,left:a?.sticky?a.left:void 0,zIndex:a?.sticky?a.zIndex:void 0};return n("div",{className:`ff-table-tree-fn-td ${i.isTree&&l.container?"folder":""} ${a?.sticky?"sticky-tree-column":""}`,"data-col-index":o,style:A,children:[i.isTree&&WE(l.hierarchy,l.parentSiblings,l.lastChild,l.nextSibling,l.container),n("div",{className:"tree-fn-title-container",children:[i.isTree&&e("span",{className:`tree-table-fn-space-block last-tree-fn-block last-tree-fn-block tree-table-fn-space-block-${l.hierarchy} ${l?.expanded?"tree-fn-row-expanded":"tree-fn-row-collapsed"} ${l.container&&l.expandable?"":"no-tree-folder"}`,children:l.container&&l.expandable&&n("span",{onClick:()=>u(l),children:[" ",e(C?js:N,{})]})}),n("span",{className:"tree-table-fn-td-content "+(i.isTree&&l.container?"folder":""),children:[!l?.isNewNode&&n(t,{children:[i.isTree&&"checkbox"===c&&!(g&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:"none"===l.selectedStatus?e(K,{title:l?.currentEnvId&&l?.envId&&l?.currentEnvId!==l?.envId?"This script is assigned to another environment. Selecting it will reassign it to the current environment.":void 0,children:e(te,{checked:"completely"===l.selectedStatus,partial:"partially"===l.selectedStatus,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable,isDefaultHover:"none"===l.selectedStatus&&!!l.machine})}):e(te,{checked:"completely"===l.selectedStatus,partial:"partially"===l.selectedStatus,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable})}),i.isTree&&"radio"===c&&!(g&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:e(Ra,{name:l.key,checked:s.includes(l.key),value:l.key,onChange:e=>d(e,l),disabled:l.unselectable||"REVIEW"===l.state||!0===l?.isDisable})})]}),l.isNewNode&&i.isTree?e(Zs,{onCancel:h,onConfirm:f,value:l.value,label:l?.label,optionsList:l.options,selectedOption:l.selectedOption,withDropdown:"inputWithDropdown"===l.type,handleCustomError:p,inputFieldWidth:y,selectFieldWidth:w,confirmIconTooltip:l.confirmIconTooltip,cancelIconTooltip:l.cancelIconTooltip,isEditable:E,setIsEditable:M,isOnBlurTrue:!1,isDisable:{confirm:b},isTableTree:!0}):e("span",{className:"tree-table-fn-td-content-text",children:UE(qE(l,i),v)})]})]}),i.actions&&!l?.isNewNode&&e("div",{className:"table-tree-fn-row-action",children:i.actions(l,r)})]})});QE.displayName="TableCell";const GE=i.memo(({node:t,columnsData:n,columnMeta:r,selected:i,select:o,onRowClick:l,onToggleExpand:s,onCheckBoxChange:c,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,index:p,selectedNode:C,hideOnDisable:m,scriptLengthTruncate:g,addModuleInputWidth:v,addModuleSelectWidth:y,disableEditLabelConfirmIcon:w,isEditable:b,setIsEditable:E,style:M})=>{const A=a(null);return e("div",{"data-level":t.hierarchy,ref:A,className:"ff-table-tree-fn-row show-tree "+(C&&C===t.key?"fn-selected-node":""),onClick:e=>l(e,t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||l(e,t)},role:"button",tabIndex:0,id:0===p?"table-fn-first-row":t.key,style:M,children:n.map((n,a)=>e(QE,{treeRowRef:A,col:n,colIndex:a,node:t,selected:i,select:o,onCheckBoxChange:c,onToggleExpand:s,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,hideOnDisable:m,scriptLengthTruncate:g,addModuleInputWidth:v,addModuleSelectWidth:y,disableEditLabelConfirmIcon:w,isEditable:b,setIsEditable:E,columnMeta:r?.[a]},n.name))})});GE.displayName="TableRow";const KE=({flattenedTreeData:t,columnsData:n,columnMeta:r,rowHeight:i=32,startIndex:o=0,totalHeight:a=0,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:p,expanding:C,selectedNode:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M})=>e("div",{className:"ff-table-tree-fn-body",style:{height:`${a}px`,position:"relative"},children:t?.map((t,a)=>e(GE,{node:t,columnsData:n,columnMeta:r,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:p,isExpanding:t.key===C,index:o+a,selectedNode:m,hideOnDisable:g,scriptLengthTruncate:v,addModuleInputWidth:y,addModuleSelectWidth:w,disableEditLabelConfirmIcon:b,isEditable:E,setIsEditable:M,style:{transform:`translateY(${(o+a)*i}px)`,height:`${i}px`,position:"absolute",top:0,left:0,right:0}},t.key))}),YE=i.memo(({columnsData:t,columnMeta:r,totalWidth:i,rootNode:o,selected:s,onCheckBoxChange:d,selectedNode:u,tableHeaderBgColor:f,hideOnDisable:h,transparentHeader:p,scriptLengthTruncate:C=25,showHeader:m=!0})=>{const g=a(null),[v,y]=c(!1),[w,b]=c(!1);l(()=>{y(!0)},[]);const E=(e,t)=>{const n=r?.[e];return{width:n?.width??t,position:n?.sticky?"sticky":void 0,left:n?.sticky?n.left:void 0,zIndex:n?.sticky?n.zIndex:void 0}};return n("div",{className:"ff-table-tree-fn-head",children:[m&&e("div",{className:"ff-table-tree-fn-row no-hover",style:{minWidth:i},children:t.map(({name:t,width:n},i)=>e("div",{className:"ff-table-tree-fn-th "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:{...E(i,n),backgroundColor:p?"transparent":f,pointerEvents:p?"none":"auto"},children:t},t))}),o&&e("div",{className:"ff-table-tree-fn-row show-tree "+(u&&u===o?.node?.key?"hover":""),ref:g,onMouseEnter:e=>{e.stopPropagation(),b(!0)},onMouseLeave:e=>{e.stopPropagation(),b(!1)},children:t.map((t,i)=>e("div",{className:"ff-table-tree-fn-td "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:E(i,t.width),children:n("span",{className:"tree-table-fn-default-content",children:[0===i&&"checkbox"===o.select&&!(h&&o.node.isDisabled)&&e(te,{checked:"partially"!==o?.node?.selectedStatus&&("completely"===o?.node?.selectedStatus||!1),partial:"partially"===o.node.selectedStatus,onChange:e=>d(e,o.node),disabled:o.node.isDisabled}),0===i&&"radio"===o.select&&!(h&&o.node.isDisabled)&&e(Ra,{name:o.node.key,checked:s.includes(o.node.key),value:o.node.key,onChange:e=>d(e,o.node),disabled:o.node.isDisabled}),n("span",{className:"tree-table-fn-td-content-text",children:["name"===t.accessor?e("span",{children:o.node[t.accessor]}):e("span",{children:UE(qE(o.node,t),C)}),o.cell&&0===i&&e("span",{className:"table-tree--fn-root-cell",children:o.cell(o.node)})]}),w&&o.actions&&0===i&&v&&g.current&&e("div",{className:"table-tree-fn-row-action",children:o.actions(o.node,g)})]})},i))})]})});YE.displayName="TableHead";const XE=32,JE="__root__",$E=(e,t)=>{if(!e?.length)return[];const n=new Map,r=new Map,i=new Map,o=new Map;t&&t.key&&n.set(t.key,t),e.forEach(e=>{n.set(e.key,e);const t=e.parentId??JE;r.has(t)||(r.set(t,[]),o.set(t,{container:0,resource:0})),r.get(t)?.push(e);const i=o.get(t);i&&(e.container?i.container++:i.resource++)}),r.forEach(e=>{e.forEach((e,t)=>{i.set(e.key,t)})});const a=e=>{const t=e.parentId??JE,a=r.get(t);if(!a||0===a.length)return!1;if((i.get(e.key)??0)<a.length-1)return!0;const l=n.get(t),s=o.get(t);if(l&&s){const t=a.filter(e=>e.container).reduce((e,t)=>e+(t.totalResourceCount??0),0),n=a.filter(e=>!e.container).length,r=Math.max(0,(l.totalResourceCount??0)-(t+n));if(e.container){return s.container<(l.subContainerCount??0)||r>0}return s.resource<r}return!1},l=e=>{if(void 0!==e.selectedStatus)return e.selectedStatus;let r=e;for(;r?.parentId;){const e=n.get(r.parentId);if(!e)break;if("completely"===e.selectedStatus)return"completely";if("none"===e.selectedStatus)return"none";r=e}return"completely"===t?.selectedStatus?"completely":"none"===t?.selectedStatus?"none":e.selectedStatus};return e.map(e=>{const t=e,r=t.parentSiblings&&t.parentSiblings.length>0?t.parentSiblings:(e=>{const t=e.hierarchy??0;if(t<=0)return[];const r=[];let i=e;for(;i&&(r.unshift(i),i.parentId);){const e=n.get(i.parentId);if(!e)break;i=e}const o=r.map(e=>a(e));return o.length===t?o:o.length>t?o.slice(o.length-t):new Array(t-o.length).fill(!1).concat(o)})(e);return{...e,lastChild:!a(e),parentSiblings:r,selectedStatus:l(e)}})},eM=o(({treeData:t,columnsData:r,selected:i=[],select:o=null,onChange:s=()=>{},onClick:d=()=>{},onExpand:f=()=>{},loadMore:C=()=>{},tableBorder:m,height:g="calc(100vh - 134px)",newNode:v,onAddConfirm:y=()=>{},onAddCancel:w=()=>{},handleEditFieldError:b,loading:E=!1,rootNode:M,pagination:A=!0,selectedNode:x,tableHeaderBgColor:L="var(--border-color)",hideOnDisable:k=!1,freezeColumns:H,scriptLengthTruncate:S=25,addModuleInputWidth:_=150,addModuleSelectWidth:V,onScroll:O,onScrollEnd:z,disableEditLabelConfirmIcon:N=!1,transparentHeader:T=!1,navigateTreeNode:I=null,handleRemoveNavigateTreeNode:D=()=>{},scrollThreshold:Z=128,showHeader:j=!0},R)=>{const[B,P]=c(null),[F,U]=c(null),[q,W]=c({start:0,end:20}),[Q,K]=c(!1),Y=a(null),X=a(null),J=a(0),$=a(E),ee=a(null),te=a(null),ne=a({lastScrollTop:0}),re=a(null),ie=a(0),oe=a(null),ae=a(null),le=a(null),se=a({key:null,attempts:0}),ce=a(null),de=(e,t)=>{const n=String(e??t);return n.endsWith("%")?{value:parseFloat(n),unit:"%"}:{value:parseFloat(n)||0,unit:"px"}},ue=h(()=>{let e=0,t=0;return r.map((n,r)=>{const{value:i,unit:o}=de(n.width,400),a=!!H&&r<H,l="%"===o?`${i}%`:`${i}px`,s=`calc(${e}px + ${t}%)`;return a&&("%"===o?t+=i:e+=i),{width:l,sticky:a,left:s,zIndex:a?100+(H??0)-r:1}})},[r,H]),fe=h(()=>{let e=0,t=0;return r.forEach(n=>{const{value:r,unit:i}=de(n.width,400);"%"===i?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[r]),he=h(()=>{if(!H)return"0px";let e=0,t=0;return ue.slice(0,H).forEach(n=>{const r=parseFloat(n.width)||0;n.width.endsWith("%")?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[ue,H]),pe=h(()=>((e,t,n)=>{if(!t?.sourceId||!t.action)return e;const{sourceId:r,action:i,value:o="",error:a="",label:l,type:s,options:c,selectedOption:d,confirmIconTooltip:u,cancelIconTooltip:f,payloadSourceId:h}=t,p=t?.parentId,C=t?.hierarchy,m=c?.map(e=>({label:e,value:e})),g=d?{label:d,value:d}:void 0,v=new Map;e.forEach(e=>v.set(e.key,e)),n&&v.set(n.key,n);const y=v.get(r);let w;h&&(w=v.get(h));let b=y??("addInside"===i?w:void 0);!b&&"addInside"===i&&p&&(b=v.get(p));const E="addInside"===i&&!b&&e.length>=0;if(!b&&!E)return e;const M=[...e],A=b?e.findIndex(e=>e.key===b.key):-1;let x=null,L=0,k=A+1;switch(i){case"addAbove":{const t=b;if(!t)return e;x=t.parentId,L=t.hierarchy;break}case"addBelow":{const t=b;if(!t)return e;x=w?.parentId??t.parentId,L=w?.hierarchy??t.hierarchy;break}case"addInside":{if(E){x=p??h??r??null,L=C??1,k=M.length;break}const t=w??b;if(!t)return e;x=t.key,L=(t.hierarchy??0)+1;const n=M.findIndex(e=>e.key===r);-1!==n&&(k=n+1);break}}const H={hierarchy:L,parentId:x,sourceId:b?.key??r??h??"new-node",isNewNode:!0,key:"new-node",value:o,error:a,label:l,type:s,options:m,selectedOption:g,confirmIconTooltip:u,cancelIconTooltip:f};switch(i){case"addAbove":M.splice(A,0,H);break;case"addBelow":M.splice(A+1,0,H);break;case"addInside":M.splice(Math.max(0,k),0,H)}return M})(t,v,M?.node),[t,v,M]),Ce=h(()=>$E(pe,M?.node),[pe,M?.node]),me=h(()=>Ce.filter(e=>!e.hide),[Ce]),ge=h(()=>{const e=new Map;return Ce.forEach(t=>e.set(t.key,t)),e},[Ce]),ve=h(()=>{const e=new Map;return me.forEach((t,n)=>e.set(t.key,n)),e},[me]),ye=p(e=>{P(t=>t?e&&t!==e?t:null:t),e&&ae.current?.key!==e||(ae.current=null),le.current&&(clearTimeout(le.current),le.current=null)},[]);l(()=>{$.current=E},[E]),l(()=>{ee.current=F},[F]);const we=p(e=>{ee.current=e,U(e)},[]),be=p(()=>{const e=Y.current;if(!e)return;const t=J.current||0,n=Math.max(0,e.scrollTop-t),r=e.clientHeight-t;let i=Math.floor(n/XE)-6,o=Math.ceil((n+r)/XE)+6;i=Math.max(0,i),o=Math.min(me.length,o),W(e=>e.start===i&&e.end===o?e:{start:i,end:o})},[me.length]),Ee=p(()=>{null===te.current&&(te.current=requestAnimationFrame(()=>{te.current=null,be()}))},[be]);u(()=>{const e=Y.current;if(!e)return;const t=me.length*XE,n=Math.max(0,t-(e.clientHeight-J.current));ne.current.lastScrollTop>n&&me.length>0&&(v||I?(e.scrollTop=0,ne.current.lastScrollTop=0):B?(e.scrollTop=n,ne.current.lastScrollTop=n):ne.current.lastScrollTop-n>e.clientHeight&&(e.scrollTop=0,ne.current.lastScrollTop=0)),be()},[me.length,be,v,I,B]);const Me=p(()=>{const e=Y.current;if(!e)return;const n=e.scrollTop,r=n>ne.current.lastScrollTop?"down":"up";if(ne.current.lastScrollTop=n,Ee(),O?.(),oe.current?.(),!A||E||ee.current||G(t))return;const i=e.scrollHeight-(n+e.clientHeight)<Z,o=n<Z+J.current;"down"===r&&i&&!t[t.length-1]?.lastResource&&(we("below"),C("below")),"up"===r&&o&&!t[0]?.lastResource&&(we("above"),re.current=t[0]?.key??null,C("above"))},[t,A,E,F,Z,Ee,O,C,we]);l(()=>{if(E||!A||G(t))return;const e=t[0],n=!e?.lastResource,{totalSubContainerCount:r=0,totalResourceCount:i=0}=M?.node||{},o=r+i,a=me.length<10&&me.length<o;n&&a&&(re.current=e?.key??null,we("above"),C("above"))},[E,A,t,me.length,M,C,we]),u(()=>{if(E||"above"!==F)E||"below"!==F||we(null);else{const e=Y.current,t=re.current;if(e&&t){const n=ve.get(t);void 0!==n&&n>0&&(e.scrollTop+=n*XE)}re.current=null,we(null)}},[E,F,ve,we]),l(()=>{const e=Y.current;if(!e)return;const n=n=>{n.deltaY>=0||!A||G(t)||$.current||ee.current||e.scrollTop>1||t[0]?.lastResource||(re.current=t[0]?.key??null,we("above"),C("above"))};return e.addEventListener("wheel",n,{passive:!0}),()=>{e.removeEventListener("wheel",n)}},[A,t,C,we]),l(()=>{const e=Y.current;if(e)return oe.current=z?La(()=>{z?.()},150):null,e.addEventListener("scroll",Me,{passive:!0}),()=>{e.removeEventListener("scroll",Me),oe.current?.cancel()}},[Me,z]),l(()=>{const e=Y.current;if(!e)return;const t=e=>{Date.now()<ie.current&&e.stopImmediatePropagation()};return e.addEventListener("scroll",t,{passive:!0,capture:!0}),()=>{e.removeEventListener("scroll",t,!0)}},[]),l(()=>{const e=X.current;if(!e)return;const t=new ResizeObserver(()=>{J.current=e.getBoundingClientRect().height,be()});return t.observe(e),()=>t.disconnect()},[be]),u(()=>{if(!v||!Y.current)return;const e=Y.current,t=ve.get("new-node");if(void 0===t)return;const n=J.current||0,r=e.clientHeight-n;if(r<=0)return;const i=t*XE,o=i+XE,a=Math.max(0,e.scrollTop-n);let l=a;i<a?l=i:o>a+r&&(l=Math.max(0,o-r)),l!==a&&(ie.current=Date.now()+300,e.scrollTop=l+n,be());const s=requestAnimationFrame(()=>{K(!0)});return()=>cancelAnimationFrame(s)},[v,ve,be]),l(()=>{v||K(!1)},[v]),u(()=>{if(!B||E)return;const e=ae.current;if(!e||e.key!==B){const e=requestAnimationFrame(()=>{ye(B)});return()=>cancelAnimationFrame(e)}const t=ge.get(e.key);if(!t){const t=requestAnimationFrame(()=>{ye(e.key)});return()=>cancelAnimationFrame(t)}if(Boolean(t.expanded)!==e.expanded)return;const n=requestAnimationFrame(()=>{ye(e.key)});return()=>cancelAnimationFrame(n)},[ge,B,E,ye]),l(()=>{se.current.key!==I&&(se.current={key:I,attempts:0}),!I&&ce.current&&(clearTimeout(ce.current),ce.current=null)},[I]),u(()=>{if(!I||v)return;const e=Y.current;if(!e)return;const n=ve.get(I);if(void 0!==n){se.current={key:I,attempts:0};const t=J.current||0,r=Math.max(XE,e.clientHeight-t),i=n*XE+16,o=Math.max(0,i-r/2)+t;return ie.current=Date.now()+400,e.scrollTo({top:o,behavior:"smooth"}),Ee(),ce.current&&clearTimeout(ce.current),void(ce.current=setTimeout(()=>{D?.()},350))}if(E||F)return;const r=se.current;if(r.key!==I&&(r.key=I,r.attempts=0),r.attempts+=1,!(r.attempts>30))return A&&!0!==t[0]?.lastResource?(re.current=null,we("above"),void C("above")):void(r.attempts>2&&D?.());D?.()},[I,v,ve,E,F,A,t,C,Ee,D,we]);const Ae=p(e=>{if(B)return;const t=!e?.expanded;P(e.key),ae.current={key:e.key,expanded:t},le.current&&clearTimeout(le.current);const n=Date.now(),r=()=>{if(ae.current?.key!==e.key)return;const t=$.current,i=Date.now()-n>=2e3;!t||i?ye(e.key):le.current=setTimeout(r,1e3)};le.current=setTimeout(r,1e3),f?.(e)},[B,f,ye]),xe=p((e,t)=>{B||s?.(e,t)},[s,B]),Le=p((e,t)=>{B||d?.(e,t)},[d,B]);l(()=>()=>{null!==te.current&&(cancelAnimationFrame(te.current),te.current=null),le.current&&clearTimeout(le.current),ce.current&&clearTimeout(ce.current)},[]);const ke=me.length*XE,He=me.slice(q.start,q.end);return e("div",{className:"tree-table-wrapper-container table-tree-fn",children:e("div",{className:"tree-table-fn-wrap",ref:R,children:e("div",{className:"table-fn-scrollable "+(me.length?"":"table-fn-empty"),ref:Y,style:{"--table-height":me.length?g:"auto","--frozen-column-width":he,border:m},children:n("div",{className:"tree-table-fn",style:{width:fe},children:[e("div",{ref:X,style:{position:"sticky",top:0,zIndex:98},children:e(YE,{columnsData:r,columnMeta:ue,totalWidth:fe,rootNode:M,onCheckBoxChange:xe,selected:i,selectedNode:x,tableHeaderBgColor:L,hideOnDisable:k,transparentHeader:T,scriptLengthTruncate:S,showHeader:j})}),e(KE,{flattenedTreeData:He,columnsData:r,columnMeta:ue,totalWidth:fe,rowHeight:XE,startIndex:q.start,totalHeight:ke,selected:i,select:o,onRowClick:Le,onToggleExpand:Ae,onCheckBoxChange:xe,onAddConfirm:y,onAddCancel:w,handleEditFieldError:b,expanding:B,selectedNode:x,hideOnDisable:k,scriptLengthTruncate:S,addModuleInputWidth:_,addModuleSelectWidth:V,disableEditLabelConfirmIcon:N,isEditable:v?Q:void 0,setIsEditable:v?e=>{K(Boolean(e))}:void 0})]})})})})});function tM(e,t,n,r,i,o="children"){return function e(a){for(let l=0;l<a.length;l++){const s=a[l];if(s&&s[t]===n){const e=[...a];return"replace"===i?e[l]=r:e.splice("above"===i?l:l+1,0,r),{updatedArray:e}}if(s&&s[o]&&Array.isArray(s[o])){const t=e(s[o]);if(t)return{updatedArray:a.map((e,n)=>n===l?{...e,[o]:t.updatedArray}:e)}}}return null}(e)}eM.displayName="TableTreeFn";const nM=(e,t)=>{if(e===t)return!0;if(null==e||null==t||"object"!=typeof e||"object"!=typeof t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Array.isArray(e),r=Array.isArray(t);if(n!==r)return!1;const i=n?e:Object.keys(e),o=r?t:Object.keys(t);if(i.length!==o.length)return!1;if(n)return i.every((e,t)=>nM(e,o[t]));{const n=new Set(o);return i.every(r=>n.has(r)&&nM(e[r],t[r]))}},rM=(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every((e,n)=>{const r=t[n];return nM(e,r)}));function iM(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function oM(e,t){return e&t}function aM(e,t){return e|t}function lM(e,t){return e^t}function sM(e,t){return e&~t}function cM(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function dM(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var uM,fM="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function hM(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=fM.charAt(n>>6)+fM.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=fM.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=fM.charAt(n>>2)+fM.charAt((3&n)<<4));(3&r.length)>0;)r+="=";return r}function pM(e){var t,n="",r=0,i=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var o=fM.indexOf(e.charAt(t));o<0||(0==r?(n+=iM(o>>2),i=3&o,r=1):1==r?(n+=iM(i<<2|o>>4),i=15&o,r=2):2==r?(n+=iM(i),n+=iM(o>>2),i=3&o,r=3):(n+=iM(i<<2|o>>4),n+=iM(15&o),r=0))}return 1==r&&(n+=iM(i<<2)),n}var CM,mM=function(e){var t;if(void 0===uM){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(uM={},t=0;t<16;++t)uM[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)uM[n.charAt(t)]=t;for(t=0;t<8;++t)uM[r.charAt(t)]=-1}var i=[],o=0,a=0;for(t=0;t<e.length;++t){var l=e.charAt(t);if("="==l)break;if(-1!=(l=uM[l])){if(void 0===l)throw new Error("Illegal character at offset "+t);o|=l,++a>=2?(i[i.length]=o,o=0,a=0):o<<=4}}if(a)throw new Error("Hex encoding incomplete: 4 bits missing");return i},gM={decode:function(e){var t;if(void 0===CM){var n="= \f\n\r\t \u2028\u2029";for(CM=Object.create(null),t=0;t<64;++t)CM["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(CM["-"]=62,CM._=63,t=0;t<9;++t)CM[n.charAt(t)]=-1}var r=[],i=0,o=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=CM[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);i|=a,++o>=4?(r[r.length]=i>>16,r[r.length]=i>>8&255,r[r.length]=255&i,i=0,o=0):i<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=i>>10;break;case 3:r[r.length]=i>>16,r[r.length]=i>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=gM.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return gM.decode(e)}},vM=1e13,yM=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,r,i=this.buf,o=i.length;for(n=0;n<o;++n)(r=i[n]*e+t)<vM?t=0:r-=(t=0|r/vM)*vM,i[n]=r;t>0&&(i[n]=t)},e.prototype.sub=function(e){var t,n,r=this.buf,i=r.length;for(t=0;t<i;++t)(n=r[t]-e)<0?(n+=vM,e=1):e=0,r[t]=n;for(;0===r[r.length-1];)r.pop()},e.prototype.toString=function(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,n=t[t.length-1].toString(),r=t.length-2;r>=0;--r)n+=(vM+t[r]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*vM+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),wM=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,bM=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function EM(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}var MM,AM=function(){function e(t,n){this.hexDigits="0123456789ABCDEF",t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)},e.prototype.hexDump=function(e,t,n){for(var r="",i=e;i<t;++i)if(r+=this.hexByte(this.get(i)),!0!==n)switch(15&i){case 7:r+=" ";break;case 15:r+="\n";break;default:r+=" "}return r},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n="",r=e;r<t;++r)n+=String.fromCharCode(this.get(r));return n},e.prototype.parseStringUTF=function(e,t){for(var n="",r=e;r<t;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(r++)):String.fromCharCode((15&i)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return n},e.prototype.parseStringBMP=function(e,t){for(var n,r,i="",o=e;o<t;)n=this.get(o++),r=this.get(o++),i+=String.fromCharCode(n<<8|r);return i},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),i=(n?wM:bM).exec(r);return i?(n&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),r=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(r+=":"+i[5],i[6]&&(r+=":"+i[6],i[7]&&(r+="."+i[7]))),i[8]&&(r+=" UTC","Z"!=i[8]&&(r+=i[8],i[9]&&(r+=":"+i[9]))),r):"Unrecognized time: "+r},e.prototype.parseInteger=function(e,t){for(var n,r=this.get(e),i=r>127,o=i?255:0,a="";r==o&&++e<t;)r=this.get(e);if(0===(n=t-e))return i?-1:0;if(n>4){for(a=r,n<<=3;!(128&(+a^o));)a=+a<<1,--n;a="("+n+" bit)\n"}i&&(r-=256);for(var l=new yM(r),s=e+1;s<t;++s)l.mulAdd(256,this.get(s));return a+l.toString()},e.prototype.parseBitString=function(e,t,n){for(var r=this.get(e),i="("+((t-e-1<<3)-r)+" bit)\n",o="",a=e+1;a<t;++a){for(var l=this.get(a),s=a==t-1?r:0,c=7;c>=s;--c)o+=l>>c&1?"1":"0";if(o.length>n)return i+EM(o,n)}return i+o},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return EM(this.parseStringISO(e,t),n);var r=t-e,i="("+r+" byte)\n";r>(n/=2)&&(t=e+n);for(var o=e;o<t;++o)i+=this.hexByte(this.get(o));return r>n&&(i+="…"),i},e.prototype.parseOID=function(e,t,n){for(var r="",i=new yM,o=0,a=e;a<t;++a){var l=this.get(a);if(i.mulAdd(128,127&l),o+=7,!(128&l)){if(""===r)if((i=i.simplify())instanceof yM)i.sub(80),r="2."+i.toString();else{var s=i<80?i<40?0:1:2;r=s+"."+(i-40*s)}else r+="."+i.toString();if(r.length>n)return EM(r,n);i=new yM,o=0}}return o>0&&(r+=".incomplete"),r},e}(),xM=function(){function e(e,t,n,r,i){if(!(r instanceof LM))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=n,this.tag=r,this.sub=i}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+n,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return EM(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return EM(this.stream.parseStringISO(t,t+n),e);case 30:return EM(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,23==this.tag.tagNumber)}return null},e.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},e.prototype.toPrettyString=function(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var n=0,r=this.sub.length;n<r;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=127&t;if(n==t)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===n)return null;t=0;for(var r=0;r<n;++r)t=256*t+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=2*this.header,n=2*this.length;return e.substring(t,t+n)},e.decode=function(t){var n;n=t instanceof AM?t:new AM(t,0);var r=new AM(n),i=new LM(n),o=e.decodeLength(n),a=n.pos,l=a-r.pos,s=null,c=function(){var t=[];if(null!==o){for(var r=a+o;n.pos<r;)t[t.length]=e.decode(n);if(n.pos!=r)throw new Error("Content size is not correct for container starting at offset "+a)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}o=a-n.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return t};if(i.tagConstructed)s=c();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");s=c();for(var d=0;d<s.length;++d)if(s[d].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){s=null}if(null===s){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+a);n.pos=a+Math.abs(o)}return new e(r,l,o,i,s)},e}(),LM=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(32&t),this.tagNumber=31&t,31==this.tagNumber){var n=new yM;do{t=e.get(),n.mulAdd(128,127&t)}while(128&t);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return 0===this.tagClass},e.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},e}(),kM=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],HM=(1<<26)/kM[kM.length-1],SM=function(){function e(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,r=(1<<t)-1,i=!1,o="",a=this.t,l=this.DB-a*this.DB%t;if(a-- >0)for(l<this.DB&&(n=this[a]>>l)>0&&(i=!0,o=iM(n));a>=0;)l<t?(n=(this[a]&(1<<l)-1)<<t-l,n|=this[--a]>>(l+=this.DB-t)):(n=this[a]>>(l-=t)&r,l<=0&&(l+=this.DB,--a)),n>0&&(i=!0),i&&(o+=iM(n));return i?o:"0"},e.prototype.negate=function(){var t=NM();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+PM(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=NM();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new VM(t):new OM(t),this.exp(e,n)},e.prototype.clone=function(){var e=NM();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n,r=this.DB-e*this.DB%8,i=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),128&n&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t},e.prototype.equals=function(e){return 0==this.compareTo(e)},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=NM();return this.bitwiseTo(e,oM,t),t},e.prototype.or=function(e){var t=NM();return this.bitwiseTo(e,aM,t),t},e.prototype.xor=function(e){var t=NM();return this.bitwiseTo(e,lM,t),t},e.prototype.andNot=function(e){var t=NM();return this.bitwiseTo(e,sM,t),t},e.prototype.not=function(){for(var e=NM(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=NM();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=NM();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+cM(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=dM(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,aM)},e.prototype.clearBit=function(e){return this.changeBit(e,sM)},e.prototype.flipBit=function(e){return this.changeBit(e,lM)},e.prototype.add=function(e){var t=NM();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=NM();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=NM();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=NM();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=NM();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=NM(),n=NM();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,r,i=e.bitLength(),o=BM(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new VM(t):t.isEven()?new zM(t):new OM(t);var a=[],l=3,s=n-1,c=(1<<n)-1;if(a[1]=r.convert(this),n>1){var d=NM();for(r.sqrTo(a[1],d);l<=c;)a[l]=NM(),r.mulTo(d,a[l-2],a[l]),l+=2}var u,f,h=e.t-1,p=!0,C=NM();for(i=PM(e[h])-1;h>=0;){for(i>=s?u=e[h]>>i-s&c:(u=(e[h]&(1<<i+1)-1)<<s-i,h>0&&(u|=e[h-1]>>this.DB+i-s)),l=n;!(1&u);)u>>=1,--l;if((i-=l)<0&&(i+=this.DB,--h),p)a[u].copyTo(o),p=!1;else{for(;l>1;)r.sqrTo(o,C),r.sqrTo(C,o),l-=2;l>0?r.sqrTo(o,C):(f=o,o=C,C=f),r.mulTo(C,a[u],o)}for(;h>=0&&!(e[h]&1<<i);)r.sqrTo(o,C),f=o,o=C,C=f,--i<0&&(i=this.DB-1,--h)}return r.revert(o)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||0==t.signum())return e.ZERO;for(var r=t.clone(),i=this.clone(),o=BM(1),a=BM(0),l=BM(0),s=BM(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),n?(o.isEven()&&a.isEven()||(o.addTo(this,o),a.subTo(t,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);for(;i.isEven();)i.rShiftTo(1,i),n?(l.isEven()&&s.isEven()||(l.addTo(this,l),s.subTo(t,s)),l.rShiftTo(1,l)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);r.compareTo(i)>=0?(r.subTo(i,r),n&&o.subTo(l,o),a.subTo(s,a)):(i.subTo(r,i),n&&l.subTo(o,l),s.subTo(a,s))}return 0!=i.compareTo(e.ONE)?e.ZERO:s.compareTo(t)>=0?s.subtract(t):s.signum()<0?(s.addTo(t,s),s.signum()<0?s.add(t):s):s},e.prototype.pow=function(e){return this.exp(e,new _M)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=kM[kM.length-1]){for(t=0;t<kM.length;++t)if(n[0]==kM[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<kM.length;){for(var r=kM[t],i=t+1;i<kM.length&&r<HM;)r*=kM[i++];for(r=n.modInt(r);t<i;)if(r%kM[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var r;if(16==n)r=4;else if(8==n)r=3;else if(256==n)r=8;else if(2==n)r=1;else if(32==n)r=5;else{if(4!=n)return void this.fromRadix(t,n);r=2}this.t=0,this.s=0;for(var i=t.length,o=!1,a=0;--i>=0;){var l=8==r?255&+t[i]:RM(t,i);l<0?"-"==t.charAt(i)&&(o=!0):(o=!1,0==a?this[this.t++]=l:a+r>this.DB?(this[this.t-1]|=(l&(1<<this.DB-a)-1)<<a,this[this.t++]=l>>this.DB-a):this[this.t-1]|=l<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&128&+t[0]&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,o=Math.floor(e/this.DB),a=this.s<<n&this.DM,l=this.t-1;l>=0;--l)t[l+o+1]=this[l]>>r|a,a=(this[l]&i)<<n;for(l=o-1;l>=0;--l)t[l]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[n]>>r;for(var a=n+1;a<this.t;++a)t[a-n-1]|=(this[a]&o)<<i,t[a-n]=this[a]>>r;r>0&&(t[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}},e.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var r=this.abs(),i=t.abs(),o=r.t;for(n.t=o+i.t;--o>=0;)n[o]=0;for(o=0;o<i.t;++o)n[o+r.t]=r.am(0,i[o],n,o,0,r.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,r){var i=t.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=n&&n.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=NM());var a=NM(),l=this.s,s=t.s,c=this.DB-PM(i[i.t-1]);c>0?(i.lShiftTo(c,a),o.lShiftTo(c,r)):(i.copyTo(a),o.copyTo(r));var d=a.t,u=a[d-1];if(0!=u){var f=u*(1<<this.F1)+(d>1?a[d-2]>>this.F2:0),h=this.FV/f,p=(1<<this.F1)/f,C=1<<this.F2,m=r.t,g=m-d,v=null==n?NM():n;for(a.dlShiftTo(g,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),e.ONE.dlShiftTo(d,v),v.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--g>=0;){var y=r[--m]==u?this.DM:Math.floor(r[m]*h+(r[m-1]+C)*p);if((r[m]+=a.am(0,y,r,g,0,d))<y)for(a.dlShiftTo(g,v),r.subTo(v,r);r[m]<--y;)r.subTo(v,r)}null!=n&&(r.drShiftTo(d,n),l!=s&&e.ZERO.subTo(n,n)),r.t=d,r.clamp(),c>0&&r.rShiftTo(c,r),l<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},e.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var r=NM(),i=NM(),o=n.convert(this),a=PM(t)-1;for(o.copyTo(r);--a>=0;)if(n.sqrTo(r,i),(t&1<<a)>0)n.mulTo(i,o,r);else{var l=r;r=i,i=l}return n.revert(r)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=BM(n),i=NM(),o=NM(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substring(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),i=Math.pow(n,r),o=!1,a=0,l=0,s=0;s<t.length;++s){var c=RM(t,s);c<0?"-"==t.charAt(s)&&0==this.signum()&&(o=!0):(l=n*l+c,++a>=r&&(this.dMultiply(i),this.dAddOffset(l,0),a=0,l=0))}a>0&&(this.dMultiply(Math.pow(n,a)),this.dAddOffset(l,0)),o&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,r){if("number"==typeof n)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),aM,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var i=[],o=7&t;i.length=1+(t>>3),n.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r<o;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=o;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<e.t;++r)n[r]=t(i,e[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,n,r),r},e.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var r=Math.min(this.t+e.t,t);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,e[r],n,r,0,this.t);for(i=Math.min(e.t,t);r<i;++r)this.am(0,e[r],n,r,0,t-r);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var r=n.t=this.t+e.t-t;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n[this.t+r-t]=this.am(t-r,e[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);(t=t+1>>1)>kM.length&&(t=kM.length);for(var o=NM(),a=0;a<t;++a){o.fromInt(kM[Math.floor(Math.random()*kM.length)]);var l=o.modPow(i,this);if(0!=l.compareTo(e.ONE)&&0!=l.compareTo(n)){for(var s=1;s++<r&&0!=l.compareTo(n);)if(0==(l=l.modPowInt(2,this)).compareTo(e.ONE))return!1;if(0!=l.compareTo(n))return!1}}return!0},e.prototype.square=function(){var e=NM();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var o=n.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)t(n);else{o<a&&(a=o),a>0&&(n.rShiftTo(a,n),r.rShiftTo(a,r));var l=function(){(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(l,0):(a>0&&r.lShiftTo(a,r),setTimeout(function(){t(r)},0))};setTimeout(l,10)}},e.prototype.fromNumberAsync=function(t,n,r,i){if("number"==typeof n)if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),aM,this),this.isEven()&&this.dAddOffset(1,0);var o=this,a=function(){o.dAddOffset(2,0),o.bitLength()>t&&o.subTo(e.ONE.shiftLeft(t-1),o),o.isProbablePrime(n)?setTimeout(function(){i()},0):setTimeout(a,0)};setTimeout(a,0)}else{var l=[],s=7&t;l.length=1+(t>>3),n.nextBytes(l),s>0?l[0]&=(1<<s)-1:l[0]=0,this.fromString(l,256)}},e}(),_M=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),VM=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),OM=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=NM();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(SM.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=NM();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),zM=function(){function e(e){this.m=e,this.r2=NM(),this.q3=NM(),SM.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=NM();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function NM(){return new SM(null)}function TM(e,t){return new SM(e,t)}var IM="undefined"!=typeof navigator;IM&&"Microsoft Internet Explorer"==navigator.appName?(SM.prototype.am=function(e,t,n,r,i,o){for(var a=32767&t,l=t>>15;--o>=0;){var s=32767&this[e],c=this[e++]>>15,d=l*s+c*a;i=((s=a*s+((32767&d)<<15)+n[r]+(1073741823&i))>>>30)+(d>>>15)+l*c+(i>>>30),n[r++]=1073741823&s}return i},MM=30):IM&&"Netscape"!=navigator.appName?(SM.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var a=t*this[e++]+n[r]+i;i=Math.floor(a/67108864),n[r++]=67108863&a}return i},MM=26):(SM.prototype.am=function(e,t,n,r,i,o){for(var a=16383&t,l=t>>14;--o>=0;){var s=16383&this[e],c=this[e++]>>14,d=l*s+c*a;i=((s=a*s+((16383&d)<<14)+n[r]+i)>>28)+(d>>14)+l*c,n[r++]=268435455&s}return i},MM=28),SM.prototype.DB=MM,SM.prototype.DM=(1<<MM)-1,SM.prototype.DV=1<<MM;SM.prototype.FV=Math.pow(2,52),SM.prototype.F1=52-MM,SM.prototype.F2=2*MM-52;var DM,ZM,jM=[];for(DM="0".charCodeAt(0),ZM=0;ZM<=9;++ZM)jM[DM++]=ZM;for(DM="a".charCodeAt(0),ZM=10;ZM<36;++ZM)jM[DM++]=ZM;for(DM="A".charCodeAt(0),ZM=10;ZM<36;++ZM)jM[DM++]=ZM;function RM(e,t){var n=jM[e.charCodeAt(t)];return null==n?-1:n}function BM(e){var t=NM();return t.fromInt(e),t}function PM(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}SM.ZERO=BM(0),SM.ONE=BM(1);var FM=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){var t,n,r;for(t=0;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[n],this.S[n]=r;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();var UM,qM,WM=null;if(null==WM){WM=[],qM=0;var QM=void 0;if("undefined"!=typeof window&&self.crypto&&self.crypto.getRandomValues){var GM=new Uint32Array(256);for(self.crypto.getRandomValues(GM),QM=0;QM<GM.length;++QM)WM[qM++]=255&GM[QM]}var KM=0,YM=function(e){if((KM=KM||0)>=256||qM>=256)self.removeEventListener?self.removeEventListener("mousemove",YM,!1):self.detachEvent&&self.detachEvent("onmousemove",YM);else try{var t=e.x+e.y;WM[qM++]=255&t,KM+=1}catch(e){}};"undefined"!=typeof window&&(self.addEventListener?self.addEventListener("mousemove",YM,!1):self.attachEvent&&self.attachEvent("onmousemove",YM))}function XM(){if(null==UM){for(UM=new FM;qM<256;){var e=Math.floor(65536*Math.random());WM[qM++]=255&e}for(UM.init(WM),qM=0;qM<WM.length;++qM)WM[qM]=0;qM=0}return UM.next()}var JM=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=XM()},e}();function $M(e){return function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}(function(e,t){var n,r,i,o,a,l,s,c,d,u,f,h,p=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),C=new Array(64);for(e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t,d=0;d<e.length;d+=16){for(n=p[0],r=p[1],i=p[2],o=p[3],a=p[4],l=p[5],s=p[6],c=p[7],u=0;u<64;u++)C[u]=u<16?e[u+d]:dA(dA(dA(sA(C[u-2]),C[u-7]),lA(C[u-15])),C[u-16]),f=dA(dA(dA(dA(c,aA(a)),rA(a,l,s)),cA[u]),C[u]),h=dA(oA(n),iA(n,r,i)),c=s,s=l,l=a,a=dA(o,f),o=i,i=r,r=n,n=dA(f,h);p[0]=dA(n,p[0]),p[1]=dA(r,p[1]),p[2]=dA(i,p[2]),p[3]=dA(o,p[3]),p[4]=dA(a,p[4]),p[5]=dA(l,p[5]),p[6]=dA(s,p[6]),p[7]=dA(c,p[7])}return p}(function(e){for(var t=Array(e.length>>2),n=0;n<t.length;n++)t[n]=0;for(n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}(e),8*e.length))}function eA(e){for(var t="0123456789abcdef",n="",r=0;r<e.length;r++){var i=e.charCodeAt(r);n+=t.charAt(i>>>4&15)+t.charAt(15&i)}return n}function tA(e,t){return e>>>t|e<<32-t}function nA(e,t){return e>>>t}function rA(e,t,n){return e&t^~e&n}function iA(e,t,n){return e&t^e&n^t&n}function oA(e){return tA(e,2)^tA(e,13)^tA(e,22)}function aA(e){return tA(e,6)^tA(e,11)^tA(e,25)}function lA(e){return tA(e,7)^tA(e,18)^nA(e,3)}function sA(e){return tA(e,17)^tA(e,19)^nA(e,10)}var cA=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function dA(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function uA(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=63&i|128,n[--t]=i>>6|192):(n[--t]=63&i|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var o=new JM,a=[];t>2;){for(a[0]=0;0==a[0];)o.nextBytes(a);n[--t]=a[0]}return n[--t]=2,n[--t]=0,new SM(n)}function fA(e,t,n){for(var r="",i=0;r.length<t;)r+=n(String.fromCharCode.apply(String,e.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return r}function hA(e,t){var n=$M;if(e.length+64+2>t)throw"Message too long for RSA";var r,i="";for(r=0;r<t-e.length-64-2;r+=1)i+="\0";var o=n("")+i+""+e,a=new Array(32);(new JM).nextBytes(a);var l=fA(a,o.length,n),s=[];for(r=0;r<o.length;r+=1)s[r]=o.charCodeAt(r)^l.charCodeAt(r);var c=fA(s,a.length,n),d=[0];for(r=0;r<a.length;r+=1)d[r+1]=a[r]^c.charCodeAt(r);return new SM(d.concat(s))}var pA=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=TM(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e,t){void 0===t&&(t=uA);var n=this.n.bitLength()+7>>3,r=t(e,n);if(null==r)return null;var i=this.doPublic(r);if(null==i)return null;for(var o=i.toString(16),a=o.length,l=0;l<2*n-a;l++)o="0"+o;return o},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=TM(e,16),this.e=parseInt(t,16),this.d=TM(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,r,i,o,a,l){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=TM(e,16),this.e=parseInt(t,16),this.d=TM(n,16),this.p=TM(r,16),this.q=TM(i,16),this.dmp1=TM(o,16),this.dmq1=TM(a,16),this.coeff=TM(l,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new JM,r=e>>1;this.e=parseInt(t,16);for(var i=new SM(t,16);;){for(;this.p=new SM(e-r,1,n),0!=this.p.subtract(SM.ONE).gcd(i).compareTo(SM.ONE)||!this.p.isProbablePrime(10););for(;this.q=new SM(r,1,n),0!=this.q.subtract(SM.ONE).gcd(i).compareTo(SM.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var a=this.p.subtract(SM.ONE),l=this.q.subtract(SM.ONE),s=a.multiply(l);if(0==s.gcd(i).compareTo(SM.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(s),this.dmp1=this.d.mod(a),this.dmq1=this.d.mod(l),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=TM(e,16),n=this.doPrivate(t);return null==n?null:function(e,t){var n=e.toByteArray(),r=0;for(;r<n.length&&0==n[r];)++r;if(n.length-r!=t-1||2!=n[r])return null;++r;for(;0!=n[r];)if(++r>=n.length)return null;var i="";for(;++r<n.length;){var o=255&n[r];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&o)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return i}(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var r=new JM,i=e>>1;this.e=parseInt(t,16);var o=new SM(t,16),a=this,l=function(){var t=function(){if(a.p.compareTo(a.q)<=0){var e=a.p;a.p=a.q,a.q=e}var t=a.p.subtract(SM.ONE),r=a.q.subtract(SM.ONE),i=t.multiply(r);0==i.gcd(o).compareTo(SM.ONE)?(a.n=a.p.multiply(a.q),a.d=o.modInverse(i),a.dmp1=a.d.mod(t),a.dmq1=a.d.mod(r),a.coeff=a.q.modInverse(a.p),setTimeout(function(){n()},0)):setTimeout(l,0)},s=function(){a.q=NM(),a.q.fromNumberAsync(i,1,r,function(){a.q.subtract(SM.ONE).gcda(o,function(e){0==e.compareTo(SM.ONE)&&a.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(s,0)})})},c=function(){a.p=NM(),a.p.fromNumberAsync(e-i,1,r,function(){a.p.subtract(SM.ONE).gcda(o,function(e){0==e.compareTo(SM.ONE)&&a.p.isProbablePrime(10)?setTimeout(s,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(l,0)},e.prototype.sign=function(e,t,n){var r=(CA[n]||"")+t(e).toString(),i=this.n.bitLength()/4,o=function(e,t){if(t<e.length+22)return console.error("Message too long for RSA"),null;for(var n=t-e.length-6,r="",i=0;i<n;i+=2)r+="ff";return TM("0001"+r+"00"+e,16)}(r,i);if(null==o)return null;var a=this.doPrivate(o);if(null==a)return null;for(var l=a.toString(16),s=l.length,c=0;c<i-s;c++)l="0"+l;return l},e.prototype.verify=function(e,t,n){var r=TM(t,16),i=this.doPublic(r);return null==i?null:function(e){for(var t in CA)if(CA.hasOwnProperty(t)){var n=CA[t],r=n.length;if(e.substring(0,r)==n)return e.substring(r)}return e}(i.toString(16).replace(/^1f+00/,""))==n(e).toString()},e}();var CA={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function mA(e,t,n){if(!t||!e)throw new Error("extend failed, please check that all dependencies are included.");var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}
29
29
  /**
30
30
  * @fileOverview
31
31
  * @name asn1-1.0.js