pixel-react 1.21.87 → 1.21.89

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 Ey(){return yy||(yy=1,e=by,"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 a=r-1>>>1,o=e[a];if(!(i(o,t)>0))return;e[a]=t,e[r]=o,r=a}}(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,a=e.length,o=a>>>1;r<o;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(i(s,t)<0)c<a&&i(d,s)<0?(e[r]=d,e[c]=t,r=c):(e[r]=s,e[l]=t,r=l);else{if(!(c<a&&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 a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var s=[],c=[],d=1,u=null,f=3,h=!1,C=!1,p=!1,m="function"==typeof setTimeout?setTimeout:null,A="function"==typeof clearTimeout?clearTimeout:null,g="undefined"!=typeof setImmediate?setImmediate:null;function v(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 y(e){if(p=!1,v(e),!C)if(null!==n(s))C=!0,O(w);else{var t=n(c);null!==t&&z(y,t.startTime-e)}}function w(t,i){C=!1,p&&(p=!1,N()),h=!0;var a=f;try{return function(t,i){var a=i;for(v(a),u=n(s);null!==u&&(!(u.expirationTime>a)||t&&!x());){var o=u.callback;if("function"==typeof o){u.callback=null,f=u.priorityLevel;var l=o(u.expirationTime<=a);a=e.unstable_now(),"function"==typeof l?u.callback=l:u===n(s)&&r(s),v(a)}else r(s);u=n(s)}if(null!==u)return!0;var d=n(c);return null!==d&&z(y,d.startTime-a),!1}(t,i)}finally{u=null,f=a,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var b=!1,E=null,M=-1,L=5,H=-1;function x(){return!(e.unstable_now()-H<L)}var V,k=function(){if(null!==E){var t=e.unstable_now();H=t;var n=!0;try{n=E(!0,t)}finally{n?V():(b=!1,E=null)}}else b=!1};if("function"==typeof g)V=function(){g(k)};else if("undefined"!=typeof MessageChannel){var S=new MessageChannel,Z=S.port2;S.port1.onmessage=k,V=function(){Z.postMessage(null)}}else V=function(){m(k,0)};function O(e){E=e,b||(b=!0,V())}function z(t,n){M=m(function(){t(e.unstable_now())},n)}function N(){A(M),M=-1}var I=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(){C||h||(C=!0,O(w))},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"):L=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=I,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o,l,u=e.unstable_now();if("object"==typeof a&&null!==a){var f=a.delay;o="number"==typeof f&&f>0?u+f:u}else o=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=o+l,A={id:d++,callback:i,priorityLevel:r,startTime:o,expirationTime:m,sortIndex:-1};return o>u?(A.sortIndex=o,t(c,A),null===n(s)&&A===n(c)&&(p?N():p=!0,z(y,o-u))):(A.sortIndex=m,t(s,A),C||h||(C=!0,O(w))),A},e.unstable_shouldYield=x,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)}()),by;var e}var My=(wy||(wy=1,"production"===process.env.NODE_ENV?gy.exports=(Ay||(Ay=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,a=e[r];if(!(0<i(a,t)))break e;e[r]=t,e[n]=a,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,a=e.length,o=a>>>1;r<o;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(0>i(s,n))c<a&&0>i(d,s)?(e[r]=d,e[c]=n,r=c):(e[r]=s,e[l]=n,r=l);else{if(!(c<a&&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 a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var s=[],c=[],d=1,u=null,f=3,h=!1,C=!1,p=!1,m="function"==typeof setTimeout?setTimeout:null,A="function"==typeof clearTimeout?clearTimeout:null,g="undefined"!=typeof setImmediate?setImmediate:null;function v(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 y(e){if(p=!1,v(e),!C)if(null!==n(s))C=!0,O(w);else{var t=n(c);null!==t&&z(y,t.startTime-e)}}function w(t,i){C=!1,p&&(p=!1,A(L),L=-1),h=!0;var a=f;try{for(v(i),u=n(s);null!==u&&(!(u.expirationTime>i)||t&&!V());){var o=u.callback;if("function"==typeof o){u.callback=null,f=u.priorityLevel;var l=o(u.expirationTime<=i);i=e.unstable_now(),"function"==typeof l?u.callback=l:u===n(s)&&r(s),v(i)}else r(s);u=n(s)}if(null!==u)var d=!0;else{var m=n(c);null!==m&&z(y,m.startTime-i),d=!1}return d}finally{u=null,f=a,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var b,E=!1,M=null,L=-1,H=5,x=-1;function V(){return!(e.unstable_now()-x<H)}function k(){if(null!==M){var t=e.unstable_now();x=t;var n=!0;try{n=M(!0,t)}finally{n?b():(E=!1,M=null)}}else E=!1}if("function"==typeof g)b=function(){g(k)};else if("undefined"!=typeof MessageChannel){var S=new MessageChannel,Z=S.port2;S.port1.onmessage=k,b=function(){Z.postMessage(null)}}else b=function(){m(k,0)};function O(e){M=e,E||(E=!0,b())}function z(t,n){L=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(){C||h||(C=!0,O(w))},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"):H=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,a){var o=e.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?o+a:o,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:a,expirationTime:l=a+l,sortIndex:-1},a>o?(r.sortIndex=a,t(c,r),null===n(s)&&r===n(c)&&(p?(A(L),L=-1):p=!0,z(y,a-o))):(r.sortIndex=l,t(s,r),C||h||(C=!0,O(w))),r},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(vy)),vy):gy.exports=Ey()),gy.exports);const Ly=Symbol(),Hy=Symbol(),xy="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?l:u,Vy=My.unstable_runWithPriority?e=>{try{My.unstable_runWithPriority(My.unstable_NormalPriority,e)}catch(t){if("Not implemented."!==t.message)throw t;e()}}:e=>e();function ky(e,t){const n=d(e)[Ly];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:a}=n,o=t(r),[l,s]=v((e,n)=>{if(!n)return[r,o];if("p"in n)throw n.p;if(n.n===i)return Object.is(e[1],o)?e:[r,o];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,o]);return Object.is(l[1],o)||s(),xy(()=>(a.add(s),()=>{a.delete(s)}),[a]),l[1]}const Sy=function(e){const t=s({[Ly]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});var n;return t[Hy]=t.Provider,t.Provider=(n=t.Provider,({value:e,children:t})=>{const r=o(e),i=o(0),[a,l]=c(null);a&&(a(e),l(null));const s=o();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={[Ly]:{v:r,n:i,l:e,u:t}}}return xy(()=>{r.current=e,i.current+=1,Vy(()=>{s.current[Ly].l.forEach(t=>{t({n:i.current,v:e})})})},[e]),m(n,{value:s.current},t)}),delete t.Consumer,t}([py,()=>{}]),Zy=({children:t,useTableRef:n,totalWidth:r})=>{const i=o(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})},Oy=t=>e("tr",{...t}),zy=t=>e("tr",{className:"ff-spreadsheet-row-header",...t});function Ny(){return ky(Sy,([,e])=>e)}function Iy(e){return ky(Sy,([t])=>e(t))}const Ty=({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:I("corner-header",{"ff-spreadsheet-header--selected":t}),children:e(q,{variant:t?"dark":"light",color:t?"var(--hover-color)":"var(--text-color)",name:"excel_corner_menu"})})})},Dy=t=>function(n){const i=Ny(),a=r.useCallback(()=>i({type:EA}),[i]),o=Iy(e=>e.selected instanceof sv);return e(t,{...n,selected:o,onSelect:a})},Fy=t=>function(n){const i=Ny(),a=r.useCallback((e,t)=>i(function(e,t){return{type:bA,payload:{column:e,extend:t}}}(e,t)),[i]),o=Iy(e=>e.selected.hasEntireColumn(n.column)),l=Iy(e=>e.selectedColumn??void 0),s=Iy(e=>e.active?qg(e.active,e.model.data):void 0);return e(t,{...n,cell:s,selected:o,selectedColumn:l,onSelect:a,scrollToColumn:n.scrollToColumn})},Ry=Fy(({column:t,label:i,selected:a,onSelect:o,setContextMenu:l,deleteColumn:s,addColumnLeft:c,addColumnRight:d,columnContextEnable:u,cell:f,selectedColumn:h,minimumColumnWidth:p,maxColLimit:m,disableDeleteOption:A,contextMenu:g,onAddColumn:v,onDeleteColumn:y,setVisibleRange:w,scrollToColumn:b})=>{const E=Ny(),M=Iy(e=>e.model.data),L=Iy(e=>e.columnDimensions[t]?.width??p),H=Iy(e=>e.model.data),{columnCount:x}=Dv(H),V=e=>{w(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return h&&b(h),n})},k=C(()=>[{label:"Add Column Left",value:"Add Column Left",iconName:"plus_icon",action:()=>{V("increment"),c(p),v?.(h??t,!0)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Left"]??!1,disable:x>=m},{label:"Add Column Right",value:"Add Column Right",iconName:"plus_icon",action:()=>{V("increment"),d(p),v?.(h??t,!1)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Right"]??!1,disable:x>=m},...A?[]:[{label:"Delete Column",value:"Delete Column",iconName:"delete",action:()=>{V("decrement"),s(),y?.(h??t)},disableTooltip:"",visible:f?.contextDisable?.["Delete Column"]??!1,disable:!1}]],[h,t,M]),S=r.useCallback((e,n)=>{const r=n?t-1:t,i=Math.max(r,0);o(i,e.shiftKey);const a=e.clientX,l=Number(L),s=e=>{const t=e.clientX-a,n=Math.max(p,l+t);E(function(e,t){return{type:rg,payload:{column:e,width:t}}}(i,n))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),E(Rg())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),E(Fg())},[t,L]),Z=r.useCallback(e=>E(zg(e)),[E]),O=r.useCallback(e=>{o(t,e.shiftKey)},[o,t]),z=r.useCallback(e=>{e.preventDefault(),o(t,e.shiftKey),l({open:u,contextType:"column",options:k})},[t,h,u,k]);return r.useEffect(()=>{void 0!==h&&"column"===g?.contextType&&l(e=>({open:e.open,contextType:"column",options:k}))},[t,h,u,k,"column"===g?.contextType]),n("th",{className:I("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":a}),style:{width:`${L}px`,minWidth:"100px"},onClick:O,onContextMenu:z,tabIndex:0,children:[e(U,{fontWeight:"medium",children:i??Py(t)}),e("div",{className:"drag-column-selector drag-column-left",onMouseDown:e=>S(e,!1),onDoubleClick:()=>E(fg(t,L)),onClick:()=>Z({row:-1,column:t})}),e("div",{className:"drag-column-selector drag-column-right",onMouseDown:e=>S(e,!0),onDoubleClick:()=>E(fg(t,L)),onClick:()=>Z({row:-1,column:t})})]},t)});function Py(e){let t="",n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}const By=({row:t,label:i,selected:a,onSelect:o,setContextMenu:l,addRowTop:s,addRowBottom:c,deleteRow:d,rowContextEnable:u,selectedRow:f,cell:h,maxRowLimit:C,disableDeleteOption:p,contextMenu:m,setVisibleRange:A,scrollToRow:g})=>{const v=Ny(),y=Iy(e=>e.rowDimensions[t]?.height||32),w=Iy(e=>e.model.data),{rowCount:b}=Dv(w),E=e=>{A(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return f&&g(f),n})},M=r.useMemo(()=>[{label:"Add Row Top",value:"Add Row Top",iconName:"plus_icon",action:()=>{E("increment"),s()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Top"]??!1,disable:b>=C},{label:"Add Row Bottom",value:"Add Row Bottom",iconName:"plus_icon",action:()=>{E("increment"),c()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Bottom"]??!1,disable:b>=C},...p?[]:[{label:"Delete Row",value:"Delete Row",iconName:"delete",action:()=>{E("decrement"),d()},disableTooltip:"",visible:h?.contextDisable?.["Delete Row"]??!1,disable:!1}]],[f,t]),L=r.useCallback((e,n)=>{const r=n?t:t-1,i=Math.max(r,0);o(i,e.shiftKey);const a=e.clientY,l=y,s=e=>{const t=e.clientY-a,n=Math.max(32,l+t);v(ug(i,n))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),v(Rg())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c)},[y,t]),H=r.useCallback(e=>v(zg(e)),[v]),x=r.useCallback(e=>{o(t,e.shiftKey)},[t]),V=r.useCallback(e=>{e.preventDefault(),o(t,e.shiftKey),l({open:u,contextType:"row",options:M})},[t,u,M,f]);return r.useEffect(()=>{void 0!==f&&"row"===m?.contextType&&l(e=>({open:e.open,contextType:"row",options:M}))},[t,u,M,f,"row"===m?.contextType]),n("th",{className:I("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":a}),style:{height:`${y}px`,minHeight:"32px"},onClick:x,onContextMenu:V,tabIndex:0,children:[e(U,{fontWeight:"medium",children:void 0!==i?i:t+1}),e("div",{className:"drag-row-selector drag-row-down",onMouseDown:e=>L(e,!0),onDoubleClick:()=>v(ug(t,y)),onClick:()=>H({row:t,column:-1})}),e("div",{className:"drag-row-selector drag-row-up",onMouseDown:e=>L(e,!1),onDoubleClick:()=>v(ug(t,y)),onClick:()=>H({row:t,column:-1})})]})},jy=t=>function(n){const i=Ny(),a=Iy(e=>e.selected.hasEntireRow(n.row)),o=Iy(e=>e.active?qg(e.active,e.model.data):void 0),l=Iy(e=>e.selectedRow??void 0),s=r.useCallback((e,t)=>i(function(e,t){return{type:wA,payload:{row:e,extend:t}}}(e,t)),[i]);return e(t,{...n,selected:a,cell:o,selectedRow:l,onSelect:s,scrollToRow:n.scrollToRow})},_y=r.memo(({row:t,column:n,DataViewer:i,active:a,dragging:o,mode:l,data:s,evaluatedData:c,select:d,activate:u,edit:f,editable:h,setCellDimensions:C,setCellData:p})=>{const m=r.useRef(null),A=r.useMemo(()=>({row:t,column:n}),[t,n]),g=r.useCallback(e=>{e.preventDefault(),window.getSelection()?.removeAllRanges(),"view"===l&&(C(A,gv(e.currentTarget)),e.shiftKey?d(A):(u(A),"dropDown"===s?.inputType?.type&&h&&!s?.readOnly&&f()))},[l,C,A,d,u,f,h,s]),v=r.useCallback(e=>{o&&(C(A,gv(e.currentTarget)),d(A))},[C,d,o,A]);return r.useEffect(()=>{const e=m.current;if(!e)return;const t=()=>{o||C(A,gv(e))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[C,A,o]),s&&s.DataViewer&&(i=s.DataViewer),e("td",{ref:m,style:{...s?.style,..."dropDown"===s?.inputType?.type&&{fontSize:"12px"},textDecoration:"underline"===s?.style?.textDecoration?s?.style?.textDecoration:"none"},className:I("ff-spreadsheet-cell",s?.className,{"ff-spreadsheet-active-cell":a||o}),onMouseEnter:v,onMouseDown:g,tabIndex:0,children:e(i,{row:t,column:n,cell:s,active:a,evaluatedCell:c,setCellData:p,inputValue:()=>null})})}),qy=t=>function(n){const{row:i,column:a}=n,o=Ny(),l=r.useMemo(()=>({row:i,column:a}),[i,a]),s=r.useCallback(e=>o(Ng(l,e)),[o,l]),c=r.useCallback(e=>o(function(e){return{type:LA,payload:{point:e}}}(e)),[o]),d=r.useCallback(e=>o(zg(e)),[o]),u=r.useCallback(()=>o(jg()),[o]),f=r.useCallback((e,t)=>o(Ig(e,t)),[o]),h=Iy(e=>Av(e.active,l)),C=Iy(e=>h?e.mode:"view"),p=Iy(e=>e.editable),m=Iy(e=>qg(l,e.model.data)),A=Iy(e=>qg(l,e.model.evaluatedData)),g=Iy(e=>e.dragging),v=Iy(e=>e.copied?.has(l)||!1);return e(t,{...n,active:h,copied:v,dragging:g,mode:C,evaluatedData:A,data:m,select:c,activate:d,edit:u,editable:p,setCellDimensions:f,setCellData:s})},Uy=({cell:r,evaluatedCell:i,active:a})=>{const o=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 o?{className:"ff-spreadsheet-data-viewer ff-spreadsheet-data-viewer--boolean",children:Wy(o)}:{className:I("ff-spreadsheet-data-viewer",{"ff-spreadsheet-data-viewer--preserve-breaks":Sv(o)}),children:a||"dropDown"!==r?.inputType?.type?a||"file"!==r?.inputType?.type?!a&&o:e(t,{children:K(r?.value)?n("div",{className:"ff-spreadsheet-data-viewer--without-fileType",children:[e(q,{name:"attachment_icon"})," Attachment"]}):(n=>{if(K(n))return e(t,{});return JSON.parse(n).map(t=>e("div",{className:"ff-spreadsheet-data-viewer--fileType",children:e(zi,{width:r?.style?.width??100,title:t?.name?.split("*")?.[0]??""})},t.name))})(o)}):n("div",{className:"ff-spreadsheet-data-viewer--dropdownType",children:[o,e(q,{name:"arrow_down",height:8,className:"dropdownType-icon"})]})})};function Wy(e){return e?"TRUE":"FALSE"}const Xy=i.forwardRef(({initialValue:t="",onChange:n,className:r="",style:a={}},s)=>{const c=o(null);i.useImperativeHandle(s,()=>c.current),l(()=>{if(c.current&&document.activeElement!==c.current){const e=String(t)?.endsWith("\n")?`${t}\n`:t;e!==c.current.innerText&&(c.current.innerText=e)}},[t]);return e("div",{style:a,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"}})})}),Qy=({onChange:t,cell:n})=>{const i=r.useRef(null),a=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(Xy,{ref:i,initialValue:n?.value??"",onChange:a,className:"ff-spreadsheet-cell-textarea",style:{...n?.style,width:"100%",height:"100%",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})})},Gy=t=>{const i=r.useRef(null),a=r.useRef(null),o=Ny(),l=r.useCallback((e,t)=>o(Ng(e,t)),[o]),s=r.useCallback(e=>o(zg(e)),[o]),c=r.useCallback(()=>o(jg()),[o]),d=r.useCallback(e=>o({type:ag,payload:{autofill:e}}),[o]),u=r.useCallback(e=>o(function(e){return{type:RA,payload:{changes:e}}}(e)),[o]),f=r.useCallback(()=>{o({type:zA})},[o]),h=Iy(e=>e.rowDimensions),C=Iy(e=>e.active),p=Iy(e=>e.mode),m=Iy(e=>e.active?qg(e.active,e.model.data):void 0),A=Iy(e=>e.selected),g=Iy(e=>A&&Hv(e.rowDimensions,e.columnDimensions,e.model.data,e.selected)),v=Iy(e=>{let t=C?Mv(C,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}),y=r.useMemo(()=>!C||!v||C.row<t.visibleRowRange.start||C.row>=t.visibleRowRange.end||C.column<t.visibleColRange.start||C.column>=t.visibleColRange.end,[C,v,t.visibleRowRange,t.visibleColRange]),w=r.useRef(void 0),b=r.useRef(null),E=r.useRef(void 0),M=r.useCallback(e=>{C&&l(C,e)},[l,C]),[L,H]=r.useState({value:"",name:""}),[x,V]=r.useState(!1),[k,S]=r.useState(),[Z,O]=r.useState([]),[z,N]=r.useState("var(--ff-select-text-color)");r.useEffect(()=>{m&&C&&t.getActiveCell({value:m.value,active:C});const n=i.current;if(!y&&n&&(n.focus({preventScroll:!0}),"dropDown"===m?.inputType?.type)){H({value:m?.value,name:m?.value}),N(m?.style?.color),V(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,color:t.color}));S(t)}},[i,y,C?.row,C?.column]),r.useEffect(()=>{if("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([])},[m?.inputType?.type,m?.value]),r.useEffect(()=>{"dropDown"===m?.inputType?.type&&m?.value!==L.value&&H({value:m?.value,name:m?.value})},[m?.value,m?.inputType?.type,L.value]),r.useEffect(()=>{const e=b.current,t=E.current;if(b.current=C,E.current=m,!e||!t)return;const n=C?.row!==e.row||C?.column!==e.column;if(n||"edit"!==p){const e=w.current;t!==e?u([{prevCell:e||null,nextCell:t}]):n||m===t||u([{prevCell:t,nextCell:m||null}]),w.current=m}});const T=m&&m.DataEditor||t.DataEditor,D=m&&m.readOnly,F=r.useCallback(e=>{if(!C)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 a=()=>{i&&(cancelAnimationFrame(i),i=null)},o=e=>{const n=t.getBoundingClientRect();let r=0,o=0;e.clientY<n.top+50?o=-12:e.clientY>n.bottom-50&&(o=12),e.clientX<n.left+50?r=-12:e.clientX>n.right-50&&(r=12),0!==r||0!==o?(e=>{a();const n=()=>{const{x:r,y:a}=e;0!==r&&(t.scrollLeft+=r),0!==a&&(t.scrollTop+=a),i=requestAnimationFrame(n)};i=requestAnimationFrame(n)})({x:r,y:o}):a()},l=()=>{a(),document.body.style.userSelect=n,document.body.style.overflow=r,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",l),d(!0)},[s,d,C]),R=r.useCallback(e=>{e.preventDefault(),t.setContextMenu({open:t.contextOption?.open??!1,contextType:t.contextOption?.contextType??null,options:t.contextOption?.options||[]})},[t]),P=g?.height!==v?.height||g?.width!==v?.width,B=r.useCallback(e=>{C&&P&&(Ig(C,gv(e.currentTarget)),s(C))},[C,P]),j=t.isAtRight?t.maxWidth-(v?.left-t.scrollPos.left)+100:t.maxWidth,_=t.isAtBottom?t.maxHeight-(v?.top-t.scrollPos.top)+64:t.maxHeight,q=["file","dropDown"].includes(m?.inputType?.type||""),U="dropDown"===m?.inputType?.type;return n("div",{ref:i,className:I("ff-spreadsheet-active-cell",`ff-spreadsheet-active-cell--${p}`,{"ff-spreadsheet-active-cell--hidden":y,"ff-spreadsheet-active-cell--dragging":P&&"text"!==m?.inputType?.type}),onMouseDown:B,style:{...v,backgroundColor:m?.style?.backgroundColor,...q?{display:"flex",alignItems:U?"center":m?.style?.alignContent,justifyContent:U?"flex-start":m?.style?.textAlign}:{},..."edit"===p&&C?{minWidth:Math.min(v?.width,t.maxWidth),minHeight:Math.min(v?.height,t.maxHeight),height:"auto",maxWidth:`${j}px`,maxHeight:`${_}px`,overflow:"auto",..."dropDown"===m?.inputType?.type?{}:{padding:"2px 4px 0px 4px",width:"max-content"}}:{}},onContextMenu:R,onClick:"view"!==p||D?void 0:c,tabIndex:0,children:[e("div",{className:q?"":"active-cell-main",style:U?{width:"100%"}:void 0,children:"dropDown"===m?.inputType?.type?e(Za,{...m?.inputType?.inputProps,dropDownRef:a,showOptions:{open:!("edit"!==p||!C),toggle:x},selectedOption:L,optionsList:k||[],height:26,showLabel:!1,disabled:!t.editable,showBorder:!1,selectedOptionColor:z,optionZIndex:5e3,onChange:e=>{const t=K(e.color)?m?.style:{...m?.style,color:e.color};H({value:e.value,name:e.label}),N(e.color||"var(--ff-select-text-color)"),M({...m,value:e.value,style:t,inputType:m?.inputType})}}):"file"===m?.inputType?.type?e(oA,{...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 a=e[i];t.attachmentAction.viewAttachment(a.id,a.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:Z,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 a=e.name.split("*")[0],o=i.findIndex(e=>e.name.split("*")[0]===a)!==t,l=n.some(e=>e.name.split("*")[0]===a);return!o&&!l||(r++,!1)});if(n.length+i.length>5)return void dc.info("Cannot upload more than 5 files.");if(t.attachmentAction?.addAttachment&&i.length>0)try{let e=0,r=0,a=0;const l=Z?.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?a++:r++}else r++}),e>0||c.length>n.length){const e=c.length>0?JSON.stringify(c):"";M({...m,value:e,style:m?.style,inputType:m?.inputType}),o(ug(C?.row||0,Math.max(s,h?.[C.row]?.height||s))),O(c.map(e=>new File([new Blob],e.name?.split("*")[0]??"default")))}a>0&&dc.info("No memory available to add the file"),e>0&&dc.success(`${e} file${e>1?"s":""} uploaded successfully`),r>0&&dc.info(`${r} unsupported ${r>1?"files":"file"}. Please check the file formats.`)}catch(e){console.error("Upload operation failed:",e),dc.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]),a=e[n]?.id;if(-1!==n&&a&&t.attachmentAction?.deleteAttachment)try{const o=await t.attachmentAction.deleteAttachment(a);"SUCCESS"===o||"object"==typeof o&&null!==o&&("status"in o&&"SUCCESS"===o.status||"responseCode"in o&&200===o.responseCode)?(e.splice(n,1),r++):console.error(`Delete failed for ${i.name}: Invalid response`,o)}catch(e){console.error(`Delete error for ${i.name}:`,e),dc.error("Error deleting file")}else console.error(`Cannot delete ${i.name}: Invalid fileId or no match`,{index:n,fileId:a,hasDeleteAttachment:!!t.attachmentAction?.deleteAttachment}),dc.error("Failed to delete file: Invalid file data")}if(r>0){const t=e.length>0?JSON.stringify(e):"";M({...m,value:t,style:m?.style,inputType:m?.inputType}),O(e?.map(e=>new File([new Blob],e.name.split("*")[0]))),dc.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):"";M({...m,value:e,style:m?.style,inputType:m?.inputType}),O(t.map(e=>new File([new Blob],e.name.split("*")[0]))),dc.error("Failed to delete file(s). Invalid file data detected.")}else dc.error("Failed to delete file(s). No valid files removed.")}}catch(e){console.error("Delete operation failed:",e),dc.error("Delete operation failed")}}catch(e){console.error("handleFilesChange error:",e),dc.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:(v?.width??0)-60}):"edit"===p&&C&&t.editable?e(T,{row:C.row,column:C.column,cell:m,onChange:M,exitEditMode:f}):e(Xy,{initialValue:m?.value,onChange:()=>{},className:"ff-spreadsheet-cell-textarea",style:{...m?.style,height:"100%",width:"100%",textDecoration:"underline"===m?.style?.textDecoration?"underline":"none",backgroundColor:P?"#1e161f00":m?.style?.backgroundColor,pointerEvents:"none",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})}),!["file"].includes(m?.inputType?.type??"")&&("edit"===p||C&&e("div",{onMouseDown:F,className:"select_dot"}))]},`${C?.row}-${C?.column}`)},Ky=({dimensions:t,dragging:n,hidden:r,variant:i})=>{const a=Iy(e=>e.active),o=Iy(e=>e.autoFill),l=Iy(e=>a?Mv(a,e.rowDimensions,e.columnDimensions):void 0),{width:s,height:c,top:d,left:u}=t||{};let f=l?.height??0,h=l?.width??0,C=s,p=c;return o.open&&s&&c&&l&&(s-h>c-f?(C=s,p=l.height):(p=c,C=l.width)),e("div",{className:I("ff-spreadsheet-floating-rect",{[`ff-spreadsheet-floating-rect--${i}`]:i,"ff-spreadsheet-floating-rect--dragging":n,"ff-spreadsheet-floating-rect--hidden":r}),style:{width:(C??0)+1,height:(p??0)+1,top:d,left:u}})},Yy=({scrollPos:t={top:0,left:0}})=>{const n=Iy(e=>e.selected),i=Iy(e=>e.dragging),a=Iy(e=>e.selected.size(e.model.data)<2),o=Iy(e=>n&&Hv(e.rowDimensions,e.columnDimensions,e.model.data,e.selected)),l=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(Ky,{variant:"selected",dimensions:l,dragging:i,hidden:a||!o})},Jy=({scrollPos:t={top:0,left:0}})=>{const n=Iy(e=>e.copied),i=null===n,a=Iy(e=>n&&Lv(e.rowDimensions,e.columnDimensions,n)),o=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(Ky,{variant:"copied",dimensions:o,hidden:i||!a,dragging:!1})},$y=i.forwardRef(({getColorValue:t,disabled:n,initialColor:r},a)=>{const l=o(null);i.useImperativeHandle(a,()=>l.current);const[s,d]=c(r);return e("div",{className:I("ff-excel-color-selector",{"color-selector-disabled":n}),style:{backgroundColor:s},onClick:()=>{l.current&&!n&&l.current.click()},"aria-label":"Select color"+(n?"":`, current color ${s}`),"aria-disabled":n,children:e("input",{type:"color",disabled:n,className:I("ff-excel-color-selector-picker",{"color-selector-disabled":n}),ref:l,"aria-label":"Color picker",onChange:e=>{d(e.target.value),t(e.target.value.replace("#",""))}})})});$y.displayName="ColorBarSelector";const ew=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"}},tw=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"}},nw=e=>Iv.reduce((t,n)=>Math.abs(n-parseFloat(e))<Math.abs(t-parseFloat(e))?n:t);function rw(e,t=100){const{border:n}=e;let r="",i="",a="",o="";return"THIN"!==n.top&&(r="MEDIUM"===n.top?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.right&&(i="MEDIUM"===n.right?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.bottom&&(a="MEDIUM"===n.bottom?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.left&&(o="MEDIUM"===n.left?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),{fontSize:Zv(nw(String(e.size))),fontFamily:(l=e.name,Nv.some(e=>e.label===l)?l:"Poppins"),color:`#${e.color}`,backgroundColor:`#${e.backgroundColor}`,fontWeight:e.bold?"bold":"normal",fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":"normal",borderTop:r,borderRight:i,borderBottom:a,borderLeft:o,textAlign:ew(e.alignment.horizontal),alignContent:ew(e.alignment.vertical),height:e.height??32,width:e.width??t};var l}const iw=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"},aw=(e,t=100)=>({name:e.fontFamily||"Arial",size:Ov(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:iw(e.borderTop?e.borderTop.toString():void 0),right:iw(e.borderRight?e.borderRight.toString():void 0),bottom:iw(e.borderBottom?e.borderBottom.toString():void 0),left:iw(e.borderLeft?e.borderLeft.toString():void 0)},alignment:{horizontal:tw(e.textAlign),vertical:tw(e.alignContent),wrapText:!1},width:e.width||t,height:e.height||32}),ow=({toolbar:t="show",editable:r,onBold:i,onItalic:a,setUnderlineType:s,setColor:d,setFontSize:u,setFontFamily:f,setTextAlign:h,setBackgroundColor:p,setBorderType:m,setFormatePainter:A})=>{const g=Iy(e=>e.selected instanceof sv),[v,y]=c("disable"===t||!r),w=Iy(e=>e.active?qg(e.active,e.model.data):null),b=Iy(e=>e.model.data),E=Iy(e=>e.formattedStyle.open),M={...zv.style,color:"#1e161f",backgroundColor:"#ffffff",borderColor:"#1e161f"},[L,H]=c(w?.style||M),x=o(null);l(()=>{w?.style&&JSON.stringify(w.style)!==JSON.stringify(L)&&H(w?.style||M),g?y(!r):w&&"boolean"==typeof w.readOnly&&y(w.readOnly||"disable"===t||!r||"dropDown"===w?.inputType?.type)},[w,r]);const V=aw(L),[k,S]=c("border-none"),Z=C(()=>{const e=L.fontFamily||"Times New Roman";return{label:e,value:e}},[L.fontFamily]),O=C(()=>{const e=`${Math.round(Ov(L.fontSize))||11}`;return{label:e,value:e}},[L.fontSize]),[z,N]=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"}],T=Iv.map(e=>({label:e,value:e})),D=o(null),F=o(null);l(()=>{let e=setTimeout(()=>{d(b,z.color)},0);return()=>{clearTimeout(e)}},[z.color]),l(()=>{let e=setTimeout(()=>{p(b,z.backgroundColor)},0);return()=>{clearTimeout(e)}},[z.backgroundColor]);return n("div",{className:"ff-excel-toolbar",role:"toolbar","aria-label":"Excel formatting toolbar",children:[n("div",{className:"ff-excel-toolbar-font ","aria-label":"Font controls",children:[e("div",{className:"ff-excel-toolbar-font-family","aria-label":"Font family selector",children:e(Za,{disabled:v,height:24,tooltip:!0,showToolTip:!0,showLabel:!1,optionZIndex:2e3,onChange:e=>{H(t=>({...t,fontFamily:e.value})),f(b,e.value)},required:!1,optionsList:Nv,selectedOption:Z})}),e("div",{className:"ff-excel-toolbar-font-size","aria-label":"Font size selector",children:e(Za,{disabled:v,height:24,showLabel:!1,optionZIndex:2e3,required:!1,onChange:e=>{H(t=>({...t,fontSize:Zv(Number(e.value))})),u(b,e.value)},optionsList:T,selectedOption:O})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon","aria-label":"Text alignment controls",children:[e(Y,{placement:"top",title:"Text Left",children:e(q,{disabled:v,variant:"left"===L.textAlign?"dark":"light",hoverEffect:"left"!==L.textAlign,onClick:()=>h(b,"left"),name:"text_align_left"})}),e(Y,{placement:"top",title:"Text Center",children:e(q,{disabled:v,variant:"center"===L.textAlign?"dark":"light",hoverEffect:"center"!==L.textAlign,onClick:()=>h(b,"center"),name:"text_align_center"})}),e(Y,{placement:"top",title:"Text Right",children:e(q,{disabled:v,variant:"right"===L.textAlign?"dark":"light",hoverEffect:"right"!==L.textAlign,onClick:()=>h(b,"right"),name:"text_align_right"})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-text","aria-label":"Text styling controls",children:[e(Y,{placement:"top",title:"Bold",children:e(q,{disabled:v,variant:V.bold?"dark":"light",hoverEffect:!V.bold,onClick:()=>i(b),name:"bold"})}),e(Y,{placement:"top",title:"Italic",children:e(q,{disabled:v,variant:V.italic?"dark":"light",hoverEffect:!V.italic,onClick:()=>a(b),name:"italic"})}),e(Y,{placement:"top",title:"Underline",children:e("div",{className:"ff-excel-toolbar-icon-underline",children:e(q,{disabled:v,variant:"underline"===L.textDecoration?"dark":"light",hoverEffect:"underline"!==L.textDecoration,onClick:()=>s(b),name:"underline"})})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon","aria-label":"Formatting tools",children:[e(Y,{placement:"top",title:"Format Painter",children:e(q,{disabled:v,variant:E?"dark":"light",hoverEffect:!E,onClick:()=>{A(b)},name:"formate_painter"})}),e(Y,{placement:"top",title:"Text Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(q,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{d(b,z.color),D.current?.click()},name:"text_color"}),e($y,{ref:D,disabled:v,getColorValue:e=>{N(t=>({...t,color:e}))},initialColor:z.color})]})}),e(Y,{placement:"top",title:"Background Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(q,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{p(b,z.backgroundColor),F.current?.click()},name:"fill_color"}),e($y,{ref:F,disabled:v,getColorValue:e=>{N(t=>({...t,backgroundColor:e}))},initialColor:z.backgroundColor})]})})]}),e("div",{className:"ff-excel-toolbar-divider"}),e("div",{className:"ff-excel-toolbar-menu","aria-label":"Border controls",children:n("div",{className:"ff-excel-toolbar-menu-option",children:[e(Y,{placement:"top",title:"Border Type",children:e(q,{hoverEffect:!0,disabled:v,onClick:()=>m(b,k,"var(--input-hover-border-color)"),name:(()=>{const e=I.find(e=>e.value===k);return e?e.icon:""})()})}),e("span",{ref:x,children:e(Da,{disabled:v,iconName:"arrow_down",targetRef:x,iconSize:12,zIndex:2e3,options:I,tooltipTitle:"Border Type",tooltipPlacement:"top",onOptionClick:e=>{let t=e.value;m(b,t,"var(--input-hover-border-color)"),S(t)}})})]})})]})},lw=(e,t)=>{let n,r=null;const i=function(...i){const a=this;null===r||Date.now()-r>=t?(e.apply(a,i),r=Date.now()):(n&&clearTimeout(n),n=setTimeout(()=>{e.apply(a,i),r=Date.now()},t-(Date.now()-r)))};return i.cancel=()=>{n&&clearTimeout(n),n=null,r=null},i},sw=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab"]),cw=new Set(["Tab","Enter"]),dw=r.forwardRef(function(t,i){const{className:a,columnLabels:o=[],rowLabels:l=[],toolbar:s,editable:c,onKeyDown:d,Table:u=Zy,Row:f=Oy,sheetHeight:h,HeaderRow:C=zy,DataEditor:p=Qy,DataViewer:m=Uy,onSelect:A=()=>{},onActivate:g=()=>{},onEvaluatedDataChange:v=()=>{},contextOption:y,attachmentAction:w,workRef:b,minimumColumnWidth:E,setContextMenu:M,maxRowLimit:L,maxColLimit:H,disableDeleteOption:x,contextMenu:V,getActiveCell:k,onAddColumn:S,onDeleteColumn:Z}=t,O=32,z=E||100,N=r.useRef(!1),T=Iy(e=>e.model.data),[D,F]=r.useState(!1),[R,P]=r.useState(0),[B,j]=r.useState(0),[_,q]=r.useState({top:0,left:0}),[U,W]=r.useState(!1),[X,Q]=r.useState(!1),G=r.useMemo(()=>{const e=t.createFormulaParser||Rv,n=new qv(e,t.data);let r={},i={};t.data.forEach((e,t)=>{let n=O;e.forEach(e=>{if(e){const t=parseFloat(String(e.style?.height).replace("px",""))||O;n=Math.max(n,t)}}),r[t]={top:0,height:n}});const a=t.data[0]?t.data[0].length:0;for(let e=0;e<a;e++){let n=z;t.data.forEach(t=>{const r=t[e];if(r){const e=parseFloat(String(r.style?.width).replace("px",""))||z;n=Math.max(n,e)}}),i[e]={left:0,width:n}}return F(e=>!e),{...py,model:n,selected:t.selected||py.selected,rowDimensions:r,columnDimensions:i}},[t.createFormulaParser,t.data,t.selected]),K=r.useReducer(my,G),[Y,J]=K,$=r.useMemo(()=>function(e,t,n){const{columns:r,rows:i}=Jg(e);return{rows:t?Math.max(i,t.length):i,columns:n?Math.max(r,n.length):r}}(Y.model.data,l,o),[Y.model.data,l,o]),[ee,te]=r.useState({start:0,end:Math.min(20,$.rows)}),[ne,re]=r.useState({start:0,end:Math.min(15,$.columns)}),ie=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.rowDimensions[n]?.height||O;return t},[Y.rowDimensions,O]),ae=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.columnDimensions[n]?.width||z;return t},[Y.columnDimensions,z]),oe=r.useRef(!0);r.useEffect(()=>{oe.current?oe.current=!1:J(function(e){return{type:og,payload:{minimumColumnWidth:e}}}(E))},[E]);const le=ie($.rows),se=ae($.columns),ce=ie(ee.start),de=le-ie(ee.end),ue=ae(ne.start),fe=se-ae(ne.end),he=Y.mode,Ce=r.useRef(null),pe=r.useRef(!1),me=e=>r.useCallback((...t)=>J(e(...t)),[e]),Ae=me(dg),ge=me(Bg),ve=me(Pg),ye=me(_g),we=me(Tg),be=me(Dg),Ee=me(kg),Me=me(Fg),Le=me(Rg),He=me(Sg),xe=me(Zg),Ve=me(Og),ke=me(hg),Se=me(Cg),Ze=me(mg),Oe=me(vg),ze=me(Ag),Ne=me(gg),Ie=me(pg),Te=me(yg),De=me(wg),Fe=me(bg),Re=me(cg),Pe=me(Eg),Be=me(Mg),je=me(Lg),_e=me(Hg),qe=me(xg),Ue=me(Vg);r.useImperativeHandle(i,()=>({removeSelect:ye}));const We=r.useRef(Y.active);r.useEffect(()=>{if(Y.active!==We.current)if(Y.active)g(Y.active);else{const e=b.current;e&&kv(e)&&document.activeElement&&document.activeElement.blur()}We.current=Y.active},[g,Y.active]);const Xe=r.useRef(Y.model.evaluatedData);r.useEffect(()=>{Y?.model?.evaluatedData!==Xe?.current&&v(Y?.model?.evaluatedData),Xe.current=Y.model.evaluatedData},[Y?.model?.evaluatedData,v]);const Qe=r.useRef(Y.selected);r.useEffect(()=>{Y.selected.equals(Qe.current)||t.selected&&Y.selected.equals(t.selected)||A(Y.selected),Qe.current=Y.selected},[Y.selected,A,t.selected]);const Ge=r.useRef(t.selected);r.useEffect(()=>{t.selected&&Ge.current&&!t.selected.equals(Ge.current)&&Ve(t.selected),Ge.current=t.selected},[t.selected,Ve]);let Ke=r.useRef();r.useEffect(()=>{Ae(c),void 0!==Ke.current&&t.data!==Ke.current&&He(t.data),Ke.current=t.data},[t.data,He,c]);const Ye=r.useRef(t.createFormulaParser);r.useEffect(()=>{t.createFormulaParser!==Ye.current&&t.createFormulaParser&&xe(t.createFormulaParser),Ye.current=t.createFormulaParser},[t.createFormulaParser,xe]);const Je=r.useCallback(e=>{const{model:t,selected:n}=Y,{data:r}=t,i=n.toRange(r);if(i){!function(e,t){e.clipboardData?.setData(pv,t)}(e,xv(function(e,t,n){const r=[],i=t.column-e.column;for(let a=e.row;a<=t.row;a++){const o=a-e.row;r[o]=r[o]||Array(i);for(let i=e.column;i<=t.column;i++)r[o][i-e.column]=qg({row:a,column:i},n)}return r}(i.start,i.end,r)))}},[Y]),$e=r.useCallback(e=>{Vv(Ce.current,he)&&(e.preventDefault(),e.stopPropagation(),Je(e),ge())},[he,Je,ge]),et=r.useCallback(e=>{Vv(Ce.current,he)&&(e.preventDefault(),e.stopPropagation(),Je(e),ve())},[he,Je,ve]),tt=r.useCallback(e=>{if(Vv(Ce.current,he)&&(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(pv):""}(e);we(t)}},[he,we]),nt=r.useCallback(e=>{e.persist(),pe.current="edit"===Y.mode?cw.has(e.key):sw.has(e.key);const t=e.ctrlKey||e.metaKey,n=e.key.toLowerCase();t&&"b"===n?(e.preventDefault(),ke(T)):t&&"i"===n?(e.preventDefault(),Se(T)):t&&"u"===n&&(e.preventDefault(),Ze(T)),d&&d(e),e.defaultPrevented||(function(e,t){return void 0!==dy(e,t)}(Y,e)&&e.nativeEvent.preventDefault(),be(e))},[Y,d,be]),rt=r.useCallback(()=>{Y.formattedStyle.open&&Y.active&&Re(Y.active)},[Y]),it=r.useCallback(()=>{Le(),document.removeEventListener("mouseup",it)},[Le]),at=r.useCallback(e=>{Y.dragging||1!==e.buttons||"view"!==he||(Me(),document.addEventListener("mouseup",it))},[Y,Me,it,he]),ot=r.useMemo(()=>qy(t.Cell||_y),[t.Cell,D,c]),lt=r.useMemo(()=>Dy(t.CornerIndicator||Ty),[t.CornerIndicator,D]),st=r.useMemo(()=>jy(t.RowIndicator||By),[t.RowIndicator,D]),ct=r.useMemo(()=>Fy(t.ColumnIndicator||Ry),[t.ColumnIndicator,D]);r.useEffect(()=>(document.addEventListener("cut",$e),document.addEventListener("copy",et),document.addEventListener("paste",tt),()=>{document.removeEventListener("cut",$e),document.removeEventListener("copy",et),document.removeEventListener("paste",tt)}),[$e,et,tt]);const dt=e=>{const t=new ResizeObserver(e=>{const t=e[0];if(t&&Ce.current){const e=t.target;if(e){const{clientWidth:t,clientHeight:n}=e;j(Math.min(Ce.current.clientHeight,n)),P(Math.min(Ce.current.clientWidth,t))}}}),n=e.current;n&&t.observe(n)},ut=r.useCallback(e=>{const t=e.target,{scrollTop:n,clientHeight:r,scrollLeft:i,clientWidth:a}=t;q({top:n,left:i});let o=0;for(;o<$.rows&&ie(o)<n;)o++;let l=o;for(;l<$.rows&&ie(l)<n+r;)l++;o=Math.max(0,o-10),l=Math.min($.rows,l+10),te({start:o,end:l});const s=l===$.rows;W(s);let c=0;for(;c<$.columns&&ae(c)<i;)c++;let d=c;for(;d<$.columns&&ae(d)<i+a;)d++;c=Math.max(0,c-10),d=Math.min($.columns,d+10),re({start:c,end:d});const u=d===$.columns;Q(u),V.open&&M({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},[$.rows,$.columns,ie,ae]),ft=r.useMemo(()=>lw(ut,16),[ut]),ht=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.rowDimensions?.[n]?.height||O;requestAnimationFrame(()=>{Ce.current&&e>=$.rows-1&&Ce?.current?.scrollTo({top:t+O,behavior:"smooth"})})})},Ct=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.columnDimensions?.[n]?.width||z;requestAnimationFrame(()=>{Ce.current&&e>=$.columns-1&&Ce.current.scrollTo({left:t+60,behavior:"smooth"})})})},pt=r.useCallback(e=>{const t=Ce.current;if(!t)return;const n=32+ie(e.row),r=n+(Y.rowDimensions[e.row]?.height||O),i=60+ae(e.column),a=i+(Y.columnDimensions[e.column]?.width||z);let o=t.scrollTop;n<t.scrollTop+32?o=n-32:r>t.scrollTop+t.clientHeight&&(o=r-t.clientHeight);let l=t.scrollLeft;i<t.scrollLeft+60?l=i-60:a>t.scrollLeft+t.clientWidth&&(l=a-t.clientWidth),o=Math.max(0,Math.min(o,t.scrollHeight-t.clientHeight)),l=Math.max(0,Math.min(l,t.scrollWidth-t.clientWidth)),Math.round(o)===Math.round(t.scrollTop)&&Math.round(l)===Math.round(t.scrollLeft)||(N.current=!0,t.scrollTo({top:o,left:l}))},[ie,ae,Y.rowDimensions,Y.columnDimensions,O,z]);r.useEffect(()=>{pe.current&&(pe.current=!1,Y.active&&pt(Y.active))},[Y.active,pt]),r.useEffect(()=>{N.current||(te({start:0,end:Math.min(20,$.rows)}),re({start:0,end:Math.min(15,$.columns)}))},[$.rows,$.columns,N.current]);const mt=mv(ee.end,ee.start),At=mv(ne.end,ne.start),gt=n("colgroup",{children:[e("col",{style:{width:"60px"}},"row-indicator")," ",e("col",{style:{width:`${ue}px`}},"left-spacer")," ",At.map(t=>e("col",{style:{width:`${Y.columnDimensions[t]?.width||z}px`}},t)),e("col",{style:{width:`${fe}px`}},"right-spacer")," "]}),vt=r.useMemo(()=>n(u,{useTableRef:dt,totalWidth:se,children:[gt,n("tbody",{children:[n(C,{children:[e(lt,{}),e("div",{className:"spacer left"}),At.map(n=>e(ct,{column:n,minimumColumnWidth:E,setContextMenu:t.setContextMenu,label:n in o?o[n]:void 0,deleteColumn:Ue,addColumnLeft:je,addColumnRight:_e,columnContextEnable:t.columnContextEnable,maxColLimit:H,disableDeleteOption:x,contextMenu:V,onAddColumn:S,onDeleteColumn:Z,setVisibleRange:re,scrollToColumn:Ct},n)),e("div",{className:"spacer right"})]}),e("tr",{style:{height:`${ce}px`}}),mt.map(r=>n(f,{row:r,children:[e(st,{label:r in l?l?.[r]:void 0,row:r,addRowTop:Pe,addRowBottom:Be,deleteRow:qe,setContextMenu:t.setContextMenu,rowContextEnable:t.rowContextEnable,maxRowLimit:L,disableDeleteOption:x,contextMenu:V,setVisibleRange:te,scrollToRow:ht},r),e("div",{className:"spacer left"}),At.map(t=>e(ot,{row:r,column:t,DataViewer:m},`${r}-${t}`)),e("div",{className:"spacer right"})]},r)),e("tr",{style:{height:`${de}px`}})]})]}),[u,$.rows,$.columns,f,C,lt,o,ct,l,st,ot,m,ee,ne,ce,de,ue,fe,Y.rowDimensions,Y.columnDimensions]),yt=r.useMemo(()=>e(Gy,{attachmentAction:w,contextOption:y,getActiveCell:k,setContextMenu:t.setContextMenu,DataEditor:p,visibleRowRange:ee,visibleColRange:ne,maxHeight:B-64,maxWidth:R-E,totalHeight:le,totalWidth:se,isAtBottom:U,isAtRight:X,scrollPos:_,editable:c},Y.active?`${Y.active.row}-${Y.active.column}`:"no-active"),[p,ee,ne,Y.active,B,R,le,se,U,X,c]),wt=r.useMemo(()=>n("div",{className:"ff-excel-spreadsheet-container",children:[e("div",{style:{width:`${R}px`},className:I("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),e("div",{style:{height:`${B}px`},className:I("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(ow,{editable:c,toolbar:s,onBold:ke,onItalic:Se,setUnderlineType:Ze,setColor:Te,setBorderType:Ie,setFontSize:ze,setFontFamily:Ne,setTextAlign:Oe,setBackgroundColor:De,setFormatePainter:Fe})}),n("div",{ref:Ce,style:{height:h},className:I("ff-excel-spreadsheet",a),onKeyPress:Ee,onKeyDown:nt,onClick:rt,onMouseMove:at,onScroll:e=>ft(e),children:[vt,yt,e(Yy,{scrollPos:_}),e(Jy,{scrollPos:_})]})]}),[a,Ee,nt,at,vt,yt,R]);return e(Sy.Provider,{value:K,children:wt})}),uw=({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",role:"menu","aria-label":"Excel context 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(Y,{title:i?t.disableTooltip:"",children:n("div",{className:"ff-excel-menu-options "+(i?"disabled":""),role:"menuitem","aria-label":t.label,"aria-disabled":i,onClick:()=>{i||t.action()},children:[t.iconName&&e(q,{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(U,{as:"label",children:t.label})]})},t.label)}var r;return null})})},fw=({excelData:r,contextOption:a,toolbar:s="show",sheetBar:d="show",rowCount:u=26,colCount:f=26,sheetHeight:h="100%",editable:C=!0,contextHeightPositioning:p=0,contextWidthPositioning:m=0,onSave:A=()=>Promise.resolve(),onSaveInfoChange:g,attachmentAction:v={addAttachment:()=>Promise.resolve(""),deleteAttachment:()=>Promise.resolve(""),viewAttachment:()=>Promise.resolve()},onSaveDelay:y=3e3,scroller:w=!1,columnContextEnable:b=!0,rowContextEnable:E=!0,sheetBarContextEnable:M=!0,minimumColumnWidth:L=100,disableDeleteOption:H=!1,maxRowLimit:x=1/0,maxColLimit:V=1/0,maxSheetLimit:k=1/0,getActiveCell:S=()=>{},activeSheet:Z})=>{const O=o(null),[z,N]=c([]),[T,D]=c(""),[F,R]=i.useState({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",disable:!1,visible:!1}]}),[P,B]=c({name:"defaultSheet",index:0}),[j,_]=c({defaultSheet:[[zv]]}),[W,X]=c([[zv]]),[Q,G]=c((A.length,{})),[J,$]=c({x:0,y:0}),ee=o(""),te=o(null),ne=o(null),re=o(null);l(()=>{const e=r;if(e){const t=e.map(e=>e.sheetName);if(N(t),!K(t.length)){let e,n;ee.current&&t.includes(ee.current)?(e=ee.current,n=t.indexOf(ee.current)):Z&&t.includes(Z)?(e=Z,n=t.indexOf(Z)):(e=t[0]||"",n=0),ee.current=e,B({name:e,index:n})}const n={},r={};e.forEach(e=>{const t=e.sheetName,i=e.data,a=Math.max(u,i.length),o=Math.max(f,Math.max(...i.map(e=>e.length)));let l=Array.from({length:a},()=>Array(o).fill({value:"",style:zv.style,readOnly:!1,inputType:void 0}));i.forEach((e,t)=>{e.forEach((e,n)=>{var r;t<a&&n<o&&(l[t]||(l[t]=[]),l[t][n]={value:(r=e.value,null==r?null:r),style:K(e?.style)?zv.style:rw(e?.style,L),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}`),a=((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||zv);l[n][r]={...t,value:t?.value??"",readOnly:t?.readOnly?t.readOnly:i,inputType:a,contextDisable:t?.contextDisable}})}),n[t]=l,A.length>2){const e=i[0]||[];r[t]=Array.from({length:o},(t,n)=>({newData:"",oldData:e[n]?.value||""}))}}),_(n),A.length>2&&G(r);const i=ee.current&&n[ee.current]?ee.current:Z&&n[Z]?Z:Object.keys(n)[0];i&&void 0!==n[i]&&X(n[i])}},[r]),l(()=>{g&&g(T),"File saved"===T&&setTimeout(()=>{D("")},2e3)},[T]),l(()=>{D("Saving..."),ie(oe())},[j,ee.current]);const ie=i.useCallback(Js(e=>{if(A.length>2){const t={...Q};z.forEach((n,r)=>{const i=(e[r].data[0]||[]).map(e=>e?.value||"");t[n]=(t[n]||[]).map((e,t)=>({...e,newData:i[t]||""}))}),G(t);const n=z.map(e=>({sheetName:e,headers:t[e]||[]}));A(e,ee.current,n)}else A(e,ee.current);D("File saved")},y),[A,Q,z]),ae=i.useCallback(e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),e.stopPropagation(),ie(oe()))},[A]);i.useEffect(()=>(document.addEventListener("keydown",ae),()=>{document.removeEventListener("keydown",ae)}),[ae]);const oe=()=>z.map(e=>{const t=j[e]?.map(e=>{const t=e.reduce((e,t,n)=>{const r=""!==String(t?.value??"").trim(),i=t?.style?.width,a=t?.style?.height;return r||(void 0!==i&&i!==L||void 0!==a&&32!==a)?n:e},-1),n=e.map((e,n)=>e&&e.style&&n<=t?{value:e.value,style:aw(e.style,L),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:K(n.length)?[[]]:n}}),[le,se]=c(null),ce=()=>z.length>=k,de=()=>{if(ce())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",z),t=Array.from({length:u},()=>Array.from({length:f},()=>zv));N(t=>[...t,e]),B({index:z?.length,name:e}),_({...j,[e]:t}),X(t),A.length>2&&G(t=>({...t,[e]:Array.from({length:f},()=>({newData:"",oldData:""}))})),ee.current=e},ue=(e=[[zv]])=>{X(e)},fe=(e,t,n)=>{const r=e.target;if(!r||r?.textContent?.trim()===n?.trim())return void se(null);const i=(r.textContent||"").trim();if(!i)return dc.warning("Sheet name cannot be empty."),r.textContent=P.name,void se(null);if(i.length>50)return dc.warning("The sheet name cannot be greater than 50 characters"),r.textContent=P.name,void se(null);if(z.map(e=>e.toLowerCase()).includes(i.toLowerCase())&&n.trim()?.toLowerCase()!==i?.toLowerCase())return dc.warning("Sheet name already exists"),r.textContent=P.name,void se(null);let a=z;ue(j?.[n]),a.splice(t,1,i);const o=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??[]}}(j,n,i);ee.current=i,B(e=>({...e,name:i})),_(o),A.length>2&&G(e=>{const t={...e},r=t[n];return delete t[n],t[i]=r??[],t}),se(null)};const he=(e,t)=>{e!==P.name&&t!==P.index&&(B({index:t,name:e}),N(n=>{const r=[...n];return r[t]=e,r}),ue(j[e]),ee.current=e)},Ce=i.useCallback((e,t=!1)=>{const n=e.target;(!n.closest(".ff-excel-tab-list")&&!n.closest(".ff-excel-sheet")||t)&&F.open&&(R({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]}),t||(e.preventDefault(),e.stopPropagation()))},[F.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 pe=(e,t,n)=>{e.preventDefault();const r=[{label:"Add Sheet",value:"Add Sheet",iconName:"plus_icon",action:()=>de(),disableTooltip:"Sheet limit reached",visible:!1,disable:ce()},...H?[]:[{label:"Delete Sheet",value:"Delete Sheet",iconName:"delete",action:()=>((e,t)=>{if(z.length>1){let n=z.slice();n.splice(t,1);const r={...j};delete r[e];const i=Math.min(t,n.length-1);N(n),_(r),A.length>2&&G(t=>{const n={...t};return delete n[e],n});const a=n[i]?n[i]:"";B({index:i,name:a}),ue(r?.[a]),ee.current=a}else dc.warning("Cannot delete the last sheet.")})(t,n),disableTooltip:"",visible:!1,disable:!1}]];R(e=>({...e,open:!0,contextType:"sheet",options:r}))};l(()=>{re.current?.removeSelect()},[P.name]);return e(t,{children:z.length>0&&n("section",{ref:te,className:"ff-excel",onContextMenu:e=>{e.preventDefault();const t=ne.current?.parentElement?.getBoundingClientRect(),n=window.scrollX,r=window.scrollY;let i=e.clientX-(t?.left||0)+n,a=e.clientY-(t?.top||0)+r;const o=300,l=window.innerWidth,s=window.innerHeight,c=l-e.clientX,d=e.clientX,u=s-e.clientY,f=e.clientY;c<o&&d>=o?i=e.clientX-(t?.left||0)+n-150:i+=2,u<200&&f>=200?a=e.clientY-(t?.top||0)+r-20:a+=2,e.target.classList.contains("ff-excel-tab-list")?$({x:i,y:a-(H?32:65)}):(i+o>l&&(i=l-o-2),i<0&&(i=2),$({x:i+m,y:a+p}))},onClick:e=>{e.stopPropagation(),F.open&&R({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},"aria-label":"Excel spreadsheet workspace",role:"region",children:[e("div",{ref:ne,className:"ff-excel-sheet","aria-label":"Spreadsheet content",children:e(dw,{ref:re,editable:C,attachmentAction:v,toolbar:s,sheetHeight:h,setContextMenu:R,contextOption:a,data:W,columnContextEnable:b,rowContextEnable:E,minimumColumnWidth:L,onEvaluatedDataChange:e=>{_(t=>({...t,[ee.current]:e}))},workRef:te,scroller:w,maxRowLimit:x,maxColLimit:V,disableDeleteOption:H,contextMenu:F,getActiveCell:S,onAddColumn:(e,t)=>{A.length>2&&G(n=>{const r=P.name,i=[...n[r]||[]],a=t?e:e+1;return i.splice(a,0,{newData:"",oldData:""}),{...n,[r]:i}})},onDeleteColumn:e=>{A.length>2&&G(t=>{const n=P.name,r=[...t[n]||[]];return r.splice(e,1),{...t,[n]:r}})}},P.name)}),"hide"!==d&&n("nav",{className:"ff-excel-sheet-bar","aria-label":"Sheet navigation",children:["show"===d&&n("div",{className:"ff-excel-add-sheet-set","aria-label":"Sheet actions",children:[e(Y,{title:ce()?"Sheet limit reached":"Add Sheet",placement:"top",children:e(q,{disabled:!C||ce(),className:"ff-excel-add-sheet-icon",hoverEffect:!0,onClick:de,name:"plus_icon",height:20,width:20})}),e(Da,{options:(t=>t.map((t,r)=>({label:n("div",{style:{display:"flex",gap:"8px"},children:[P?.name===t?e(q,{height:16,width:16,name:"tick"}):e("div",{style:{height:"16px",width:"24px"}}),e(Y,{title:xn(t,20,"count")?t:"",children:e(U,{children:Hn(t,20,"count")})})]}),name:r,value:t})))(z),targetRef:O,onOptionClick:e=>{const{value:t,name:n=""}=e;he(t,parseInt(n))},dropdownPlacement:"top",iconName:"show_script",tooltipTitle:"All Sheets",tooltipPlacement:"top",dropdownHeight:215,selectedValue:P.name})]}),e("div",{className:"ff-excel-tab-container",role:"tablist","aria-label":"Worksheet tabs",children:z.map((t,n)=>e(U,{lineHeight:"16px",children:e("div",{onContextMenu:e=>{he(t,n),M&&pe(e,t,n)},className:I("ff-excel-tab-list",{active:t===P.name}),role:"tab","aria-selected":t===P.name,"aria-label":`Sheet ${t}`,onClick:()=>{he(t,n)},suppressContentEditableWarning:le===n,onDoubleClick:e=>{"show"===d&&(se(n),null===le&&setTimeout(()=>(e=>{const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n?.removeAllRanges(),n?.addRange(t)})(e.target),0))},contentEditable:C&&le===n,onBlur:e=>{fe(e,n,t)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),fe(e,n,t))},children:t})},t))})]}),F.open&&e(uw,{contextMenu:F,position:J,editable:C}),e(cc,{})]})})},hw=({label:t="",isActive:n=!0,onClick:r=()=>{},isFilterChip:i=!1})=>{const a=i?"filter":"module";return e("div",{className:I("ff-module-chip",{"ff-filter-chip":i,[`ff-${a}-chip--active`]:n,[`ff-${a}-chip--hover`]:!n}),onClick:r,"aria-label":t||`${a} chip`,children:e(U,{lineHeight:"18px",className:"module-typography",children:t})})},Cw=({x:e,y:t,radius:n,startAngle:r,endAngle:i})=>{const a=e+n*Math.cos(r),o=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 ${a} ${o} A ${n} ${n} 0 ${c} 1 ${l} ${s}`},pw=({radius:t=15,lineWidth:r=5,label:i,percentageValue:a,icon:l,fontSize:s=10,labelColor:d="",arcColor:u="var(--brand-color)",backgroundArcColor:f="var(--ff-select-scroll-thumb-color)",isSelectedArch:h=!1,onSelect:C})=>{const[p,m]=c({x:0,y:0}),[A,g]=c(!1),v=o(null);let y=-Math.PI/2;const w=2*(t+r),{backgroundArcPath:b,foregroundArcPath:E}=((e,t,n)=>{const r=t,i=r+Math.max(0,Math.min(e,100))/100*2*Math.PI;return{backgroundArcPath:Cw({x:0,y:0,radius:n,startAngle:0,endAngle:2*Math.PI}),foregroundArcPath:Cw({x:0,y:0,radius:n,startAngle:r,endAngle:i})}})(a,y,t),M=()=>{g(!0)},L=()=>{m({x:0,y:0}),g(!1)},H=e=>{if(v.current){const t=v.current.getBoundingClientRect();m({x:e.clientX-t.left,y:e.clientY-t.top})}},x=i?`${i} radial chart at ${a}%`:`Radial chart at ${a}%`;return n("section",{ref:v,className:"ff-icon-radial-chart-container",style:{"--fontSize":`${s}px`},onClick:C,"aria-label":x,children:[e("svg",{width:w,height:w,viewBox:`0 0 ${w} ${w}`,role:"img","aria-label":x,children:n("g",{transform:`translate(${t+r}, ${t+r})`,children:[e("path",{d:b,fill:"none",stroke:f,strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:H}),e("path",{d:E,fill:"none",stroke:u,strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:H}),h&&e("path",{d:E,fill:"none",stroke:"var(--dotted-border-color)",strokeOpacity:"0.4",strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:H}),l?e("foreignObject",{x:"-10",y:"-10",width:"20",height:"20",children:e(q,{className:"ff-radial-chart-icon-padding",name:l,height:20,width:20,withPadding:!1})}):e("text",{x:"0",y:"0",fill:d||u,textAnchor:"middle",dominantBaseline:"central",children:`${Math.round(a)}%`})]})}),A&&n("div",{className:"ff-icon-radial-chart-tooltip",style:{position:"absolute",left:`${p.x+15}px`,top:p.y-5+"px"},children:[e(U,{children:`${i} : `}),n(U,{children:[a,"%"]})]})]})},mw=({mediaSrc:t,fileId:r,onExpandClick:i,onDeleteClick:a,onDownloadClick:o,height:l="75px",width:s="79px",fileName:c,thumbnailMediaSrc:d,isDelete:u})=>e("figure",{className:"ff-attach-media-container",style:{height:l,width:s},"aria-label":c?`Attached media ${c}`:"Attached media",children:n("div",{className:"ff-media-wrapper",style:{height:l,width:s},children:[e("img",{src:d||t,alt:c?`Preview of ${c}`:"Attached media preview"}),n("div",{className:"ff-hover-icons","aria-label":"Media actions",children:[n("div",{className:"ff-top-icons",children:[e("div",{className:"ff-icon-container",children:e(Y,{title:"Download File",placement:"bottom",children:e(q,{name:"download_file_icon",height:10,width:10,onClick:o,color:"var(--icons-default-color)","aria-label":"Download file"})})}),u&&e("div",{className:"ff-icon-container",children:e(Y,{title:"Delete",placement:"bottom",children:e(q,{name:"delete",height:10,width:10,color:"var(--ff-delete-button-attachment)",onClick:()=>{a&&a(r)},"aria-label":"Delete file"})})})]}),e("div",{className:"ff-expand-icon-container",children:e(Y,{title:"Maximize",placement:"bottom",children:e(q,{name:"expand_icon",height:16,width:16,onClick:i,"aria-label":"Expand media"})})})]}),e(U,{color:"var(--text-area-default-color)",fontWeight:"medium",className:"ff-media-text",children:c})]})}),Aw=({icon:r,status:i,count:a,text:o,style:s={width:"196.4px"},resetToggle:d,onSelectedStatus:u=e=>{}})=>{const[f,h]=c(!1),C=["total defects","defect density","open defects","closed defects","quality score"],p=C.includes(i.toLowerCase()),m=C.includes(i.toLowerCase());l(()=>{h(!d)},[d]);return n("article",{className:`ff-card-container ${i.toLowerCase()} ${f?"toggled":""}`,style:s,onClick:()=>(e=>{C.includes(e.toLowerCase())||(h(!0),u(e))})(i),"aria-pressed":f,"aria-disabled":C.includes(i.toLowerCase()),"aria-label":`${i} status card count ${a}`,children:[n("header",{className:"ff-status-bar","aria-label":"Status summary",children:[e("div",{"aria-label":`${i} icon`,children:e(q,{name:r,height:20,width:20,hoverEffect:!1,"aria-label":`${i} status icon`})}),!C.includes(i.toLowerCase())&&e(U,{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("section",{className:"ff-content "+(m?"red-background":""),"aria-label":"Status details",children:n(t,p?{children:[e(U,{fontWeight:"semi-bold",fontSize:"10px",className:"ff-text",lineHeight:"15px",color:"var(--ff-chip-text-color)",children:o}),e(U,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"36px",children:"defect density"===i.toLowerCase()?n(t,{children:[a.toString().padStart(2,"0"),e(U,{fontSize:"15px",fontWeight:"semi-bold",children:"/ Modules"})]}):"quality score"===i.toLowerCase()?`${parseFloat(a.toString()).toFixed(2)}%`:a.toString().padStart(2,"0")})]}:{children:[e(U,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"24px",color:f?"var(--base-bg-color)":"",children:a.toString().padStart(2,"0")}),e(U,{className:"ff-text",lineHeight:"18px",color:f?"var(--base-bg-color)":"var(--ff-chip-text-color)",children:o})]})})]})},gw=({option:t})=>{const r=o(null),[i,a]=c(!1);l(()=>{const e=r.current;if(!e)return;const t=()=>{a(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",role:"option","aria-label":d(t),children:[e(Y,{title:i?d(t):"",style:{width:"calc(100% - 32px)"},children:e("span",{ref:r,className:"ff-truncated_text","aria-label":d(t),children:d(t)})}),e(q,{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})]})};function vw(e){return()=>e}function yw(e){e()}function ww(e,t){return n=>e(t(n))}function bw(e,t){return()=>e(t)}function Ew(e){return void 0!==e}function Mw(){}function Lw(e,t){return t(e),e}function Hw(e,t){return t(e)}function xw(...e){return e}function Vw(e,t){return e(1,t)}function kw(e,t){e(0,t)}function Sw(e){e(2)}function Zw(e){return e(4)}function Ow(e,t){return Vw(e,function(e,t){return n=>e(t,n)}(t,0))}function zw(e,t){const n=e(1,e=>{n(),t(e)});return n}function Nw(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Iw(e,t){return e===t}function Tw(e=Iw){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Dw(e){return t=>n=>{e(n)&&t(n)}}function Fw(e){return t=>ww(t,e)}function Rw(e){return t=>()=>{t(e)}}function Pw(e,...t){const n=function(...e){return t=>e.reduceRight(Hw,t)}(...t);return(t,r)=>{switch(t){case 2:return void Sw(e);case 1:return Vw(e,n(r))}}}function Bw(e,t){return n=>r=>{n(t=e(t,r))}}function jw(e){return t=>n=>{e>0?e--:t(n)}}function _w(e){let t,n=null;return r=>i=>{n=i,!t&&(t=setTimeout(()=>{t=void 0,r(n)},e))}}function qw(...e){const t=Array.from({length:e.length});let n=0,r=null;const i=2**e.length-1;return e.forEach((e,a)=>{const o=2**a;Vw(e,e=>{const l=n;n|=o,t[a]=e,l!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{const o=()=>{e([a].concat(t))};n===i?o():r=o}}function Uw(e){let t=e;const n=Xw();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function Ww(e,t){return Lw(Uw(t),t=>Ow(e,t))}function Xw(){const e=[];return(t,n)=>{switch(t){case 0:return void e.slice().forEach(e=>{e(n)});case 2:return void e.splice(0);case 1:return e.push(n),()=>{const t=e.indexOf(n);t>-1&&e.splice(t,1)}}}}function Qw(e){return Lw(Xw(),t=>Ow(e,t))}const Gw={singleton:!0};function Kw(e,t=[],n=Gw){const{singleton:r}=n;return{constructor:e,dependencies:t,id:Yw(),singleton:r}}const Yw=()=>Symbol("id");function Jw(...e){const t=Xw(),n=Array.from({length:e.length});let r=0;const i=2**e.length-1;return e.forEach((e,a)=>{const o=2**a;Vw(e,e=>{n[a]=e,r|=o,r===i&&kw(t,n)})}),function(e,a){switch(e){case 2:return void Sw(t);case 1:return r===i&&a(n),Vw(t,a)}}}function $w(e,t=Iw){return Pw(e,Tw(t))}function eb(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(yw)}}(...e.map(e=>Vw(e,n)))}}}const tb=0,nb=1,rb=2,ib=3,ab={[tb]:"debug",[ib]:"error",[nb]:"log",[rb]:"warn"},ob=Kw(()=>{const e=Uw(ib);return{log:Uw((t,n,r=nb)=>{r>=((typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL??Zw(e))&&console[ab[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function lb(e){const t=function(e){return"self"in e?e.document.documentElement:e}(e);return"rtl"===t.ownerDocument.defaultView.getComputedStyle(t).direction}function sb(e,t){return lb(e)?-t:t}function cb(e,t){return lb(e)?-t:t}function db(e,t,n){return ub(e,t,n).callbackRef}function ub(e,t,n){const r=i.useRef(null);let a=e=>{};const o=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 a=e=>{e&&t?(o?.observe(e),r.current=e):(r.current&&o?.unobserve(r.current),r.current=null)},{callbackRef:a,ref:r}}function fb(e,t,n,r,a,o,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 a=[];for(let o=0;o<i;o++){const i=e.item(o);if(void 0===i.dataset.index)continue;const l=parseInt(i.dataset.index,10),s=parseFloat(i.dataset.knownSize),c=t(i,n);if(0===c&&r("Zero-sized element, this should not happen",{child:i},ib),c===s)continue;const d=a[a.length-1];0===a.length||d.size!==c||d.endIndex!==l-1?a.push({endIndex:l,size:c,startIndex:l}):a[a.length-1].endIndex++}return a}(n.children,t,s?"offsetWidth":"offsetHeight",a);let c=n.parentElement;for(;void 0===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.scrollWidth:l.scrollHeight:d?s?u.document.documentElement.scrollWidth:u.document.documentElement.scrollHeight:s?c.scrollWidth:c.scrollHeight,h=l?s?l.offsetWidth:l.offsetHeight:d?s?u.innerWidth:u.innerHeight:s?c.offsetWidth:c.offsetHeight,C=l?s?sb(l,l.scrollLeft):l.scrollTop:d?s?sb(u,u.scrollX||u.document.documentElement.scrollLeft):u.scrollY||u.document.documentElement.scrollTop:s?sb(c,c.scrollLeft):c.scrollTop;r({scrollHeight:f,scrollTop:Math.max(C,0),viewportHeight:h}),o?.(s?hb("column-gap",getComputedStyle(n).columnGap,a):hb("row-gap",getComputedStyle(n).rowGap,a)),null!==i&&e(i)},[e,t,a,o,l,r,s]);return ub(d,n,c)}function hb(e,t,n){return"normal"!==t&&!0!==t?.endsWith("px")&&n(`${e} was not resolved to pixel value correctly`,t,rb),"normal"===t?0:parseInt(t??"0",10)}function Cb(e,t,n){const r=i.useRef(null),a=i.useCallback(n=>{if(!n?.offsetParent)return;const i=n.getBoundingClientRect(),a=i.width;let o,s;if(t){const e=t.getBoundingClientRect(),n=i.top-e.top;s=e.height-Math.max(0,n),o=n+t.scrollTop}else{const e=l.current.ownerDocument.defaultView;s=e.innerHeight-Math.max(0,i.top),o=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:o,visibleHeight:s,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:o,ref:l}=ub(a,!0,n),s=i.useCallback(()=>{a(l.current)},[a,l]);return i.useEffect(()=>{if(t){t.addEventListener("scroll",s);const e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener("scroll",s),e.unobserve(t)}}const e=l.current?.ownerDocument.defaultView;return e?.addEventListener("scroll",s),e?.addEventListener("resize",s),()=>{e?.removeEventListener("scroll",s),e?.removeEventListener("resize",s)}},[s,t,l]),o}const pb=Kw(()=>{const e=Xw(),t=Xw(),n=Uw(0),r=Xw(),i=Uw(0),a=Xw(),o=Xw(),l=Uw(0),s=Uw(0),c=Uw(0),d=Uw(0),u=Xw(),f=Xw(),h=Uw(!1),C=Uw(!1),p=Uw(!1);return Ow(Pw(e,Fw(({scrollTop:e})=>e)),t),Ow(Pw(e,Fw(({scrollHeight:e})=>e)),o),Ow(t,i),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:s,footerHeight:d,headerHeight:l,horizontalDirection:C,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:h,scrollTo:u,scrollTop:t,skipAnimationFrameInResizeObserver:p,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),mb={lvl:0};function Ab(e,t){const n=e.length;if(0===n)return[];let{index:r,value:i}=t(e[0]);const a=[];for(let o=1;o<n;o++){const{index:n,value:l}=t(e[o]);a.push({end:n-1,start:r,value:i}),r=n,i=l}return a.push({end:1/0,start:r,value:i}),a}function gb(e){return e===mb}function vb(e,t){if(!gb(e))return t===e.k?e.v:t<e.k?vb(e.l,t):vb(e.r,t)}function yb(e,t,n="k"){if(gb(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=yb(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return yb(e.l,t,n)}function wb(e,t,n){return gb(e)?Ob(t,n,1):t===e.k?Vb(e,{k:t,v:n}):t<e.k?zb(Vb(e,{l:wb(e.l,t,n)})):zb(Vb(e,{r:wb(e.r,t,n)}))}function bb(){return mb}function Eb(e,t,n){if(gb(e))return[];return function(e){return Ab(e,({k:e,v:t})=>({index:e,value:t}))}(Hb(e,yb(e,t)[0],n))}function Mb(e,t){if(gb(e))return mb;const{k:n,l:r,r:i}=e;if(t===n){if(gb(r))return i;if(gb(i))return r;const[t,n]=Zb(r);return xb(Vb(e,{k:t,l:kb(r),v:n}))}return xb(Vb(e,t<n?{l:Mb(r,t)}:{r:Mb(i,t)}))}function Lb(e){return gb(e)?[]:[...Lb(e.l),{k:e.k,v:e.v},...Lb(e.r)]}function Hb(e,t,n){if(gb(e))return[];const{k:r,l:i,r:a,v:o}=e;let l=[];return r>t&&(l=l.concat(Hb(i,t,n))),r>=t&&r<=n&&l.push({k:r,v:o}),r<=n&&(l=l.concat(Hb(a,t,n))),l}function xb(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(Sb(t))return Nb(Vb(e,{lvl:n-1}));if(!gb(t)&&!gb(t.r))return Vb(t.r,{l:Vb(t,{r:t.r.l}),lvl:n,r:Vb(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(Sb(e))return Ib(Vb(e,{lvl:n-1}));if(!gb(r)&&!gb(r.l)){const t=r.l,i=Sb(t)?r.lvl-1:r.lvl;return Vb(t,{l:Vb(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:Ib(Vb(r,{l:t.r,lvl:i}))})}throw new Error("Unexpected empty nodes")}function Vb(e,t){return Ob(void 0===t.k?e.k:t.k,void 0===t.v?e.v:t.v,void 0===t.lvl?e.lvl:t.lvl,void 0===t.l?e.l:t.l,void 0===t.r?e.r:t.r)}function kb(e){return gb(e.r)?e.l:xb(Vb(e,{r:kb(e.r)}))}function Sb(e){return gb(e)||e.lvl>e.r.lvl}function Zb(e){return gb(e.r)?[e.k,e.v]:Zb(e.r)}function Ob(e,t,n,r=mb,i=mb){return{k:e,l:r,lvl:n,r:i,v:t}}function zb(e){return Ib(Nb(e))}function Nb(e){const{l:t}=e;return gb(t)||t.lvl!==e.lvl?e:Vb(t,{r:Vb(e,{l:t.r})})}function Ib(e){const{lvl:t,r:n}=e;return gb(n)||gb(n.r)||n.lvl!==t||n.r.lvl!==t?e:Vb(n,{l:Vb(e,{r:n.l}),lvl:t+1})}function Tb(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function Db(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}const Fb=Kw(()=>({recalcInProgress:Uw(!1)}),[],{singleton:!0});function Rb(e,t,n){return e[Pb(e,t,n)]}function Pb(e,t,n,r=0){let i=e.length-1;for(;r<=i;){const a=Math.floor((r+i)/2),o=n(e[a],t);if(0===o)return a;if(-1===o){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Bb(e,t){return Math.round(e.getBoundingClientRect()[t])}function jb(e){return!gb(e.groupOffsetTree)}function _b({index:e},t){return t===e?0:t<e?-1:1}function qb({offset:e},t){return t===e?0:t<e?-1:1}function Ub(e,t,n){if(0===t.length)return 0;const{index:r,offset:i,size:a}=Rb(t,e,_b),o=e-r,l=a*o+(o-1)*n+i;return l>0?l+n:l}function Wb(e,t){if(!jb(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Xb(e,t,n){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;let r=Wb("LAST"===e.index?n:e.index,t);return r=Math.max(0,Math.min(n,r)),r}function Qb(e,t,n,r=0){return r>0&&(t=Math.max(t,Rb(e,r,_b).offset)),Ab(function(e,t,n,r){const i=Pb(e,t,r),a=Pb(e,n,r,i);return e.slice(i,a+1)}(e,t,n,qb),Jb)}function Gb(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,tb);const a=e.sizeTree;let o=a,l=0;if(n.length>0&&gb(a)&&2===t.length){const e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>wb(wb(t,n,e),n+1,r),o)}else[o,l]=function(e,t){let n=gb(e)?0:1/0;for(const r of t){const{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),gb(e)){e=wb(e,0,i);continue}const o=Eb(e,a-1,t+1);if(o.some($b(r)))continue;let l=!1,s=!1;for(const{end:n,start:r,value:a}of o)l?(t>=r||i===a)&&(e=Mb(e,r)):(s=a!==i,l=!0),n>t&&t>=r&&a!==i&&(e=wb(e,t+1,a));s&&(e=wb(e,a,i))}return[e,n]}(o,t);if(o===a)return e;const{lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u}=Yb(e.offsetTree,l,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>wb(e,t,Ub(t,u,i)),bb()),lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u,sizeTree:o}}function Kb(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 Yb(e,t,n,r){let i=e,a=0,o=0,l=0,s=0;if(0===t)i=[];else{s=Pb(i,t-1,_b),l=i[s].offset;const e=yb(n,t-1);a=e[0],o=e[1],i.length&&i[s].size===yb(n,t)[1]&&(s-=1),i=i.slice(0,s+1)}for(const{start:e,value:s}of Eb(n,t,1/0)){const t=e-a,n=t*o+l+t*r;i.push({index:e,offset:n,size:s}),a=e,l=n,o=s}return{lastIndex:a,lastOffset:l,lastSize:o,offsetTree:i}}function Jb(e){return{index:e.index,value:e}}function $b(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 eE={offsetHeight:"height",offsetWidth:"width"},tE=Kw(([{log:e},{recalcInProgress:t}])=>{const n=Xw(),r=Xw(),i=Ww(r,0),a=Xw(),o=Xw(),l=Uw(0),s=Uw([]),c=Uw(void 0),d=Uw(void 0),u=Uw(void 0),f=Uw(void 0),h=Uw((e,t)=>Bb(e,eE[t])),C=Uw(void 0),p=Uw(0),m={groupIndices:[],groupOffsetTree:bb(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:bb()},A=Ww(Pw(n,qw(s,e,p),Bw(Gb,m),Tw()),m),g=Ww(Pw(s,Tw(),Bw((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),Fw(({prev:e})=>e)),[]);Ow(Pw(s,Dw(e=>e.length>0),qw(A,p),Fw(([e,t,n])=>{const r=e.reduce((e,r,i)=>wb(e,r,Ub(r,t.offsetTree,n)||i),bb());return{...t,groupIndices:e,groupOffsetTree:r}})),A),Ow(Pw(r,qw(A),Dw(([e,{lastIndex:t}])=>e<t),Fw(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),Ow(c,d);const v=Ww(Pw(c,Fw(e=>void 0===e)),!0);Ow(Pw(d,Dw(e=>void 0!==e&&gb(Zw(A).sizeTree)),Fw(e=>{const t=Zw(u),n=Zw(s).length>0;return void 0!==t&&0!==t?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),Ow(Pw(f,Dw(e=>void 0!==e&&e.length>0&&gb(Zw(A).sizeTree)),Fw(e=>{const t=[];let n=e[0],r=0;for(let i=1;i<e.length;i++){const a=e[i];a!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=a,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),Ow(Pw(s,qw(u,d),Dw(([,e,t])=>void 0!==e&&void 0!==t),Fw(([e,t,n])=>{const r=[];for(let i=0;i<e.length;i++){const a=e[i],o=e[i+1];r.push({startIndex:a,endIndex:a,size:t}),void 0!==o&&r.push({startIndex:a+1,endIndex:o-1,size:n})}return r})),n);const y=Qw(Pw(n,qw(A),Bw(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:m}),Fw(e=>e.changed)));Vw(Pw(l,Bw((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),Fw(e=>e.diff)),e=>{const{groupIndices:n}=Zw(A);if(e>0)kw(t,!0),kw(a,e+Kb(e,n));else if(e<0){const t=Zw(g);t.length>0&&(e-=Kb(-e,t)),kw(o,e)}}),Vw(Pw(l,qw(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},ib)});const w=Qw(a);Ow(Pw(a,qw(A),Fw(([e,t])=>{const n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){const n=vb(t.sizeTree,0);let a=0,o=0;for(;a<e;){const e=t.groupIndices[o],l=t.groupIndices.length===o+1?1/0:t.groupIndices[o+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+l-1,size:i,startIndex:e+1}),o++,a+=l+1}const l=Lb(t.sizeTree);return a!==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 Lb(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 b=Qw(Pw(o,qw(A,p),Fw(([e,{offsetTree:t},n])=>Ub(-e,t,n))));return Ow(Pw(o,qw(A,p),Fw(([e,t,n])=>{if(t.groupIndices.length>0){if(gb(t.sizeTree))return t;let r=bb();const i=Zw(g);let a=0,o=0,l=0;for(;a<-e;){l=i[o];const e=i[o+1]-l-1;o++,a+=e+1}if(r=Lb(t.sizeTree).reduce((t,{k:n,v:r})=>wb(t,Math.max(0,n+e),r),r),a!==-e){r=wb(r,0,vb(t.sizeTree,l));r=wb(r,1,yb(t.sizeTree,1-e)[1])}return{...t,sizeTree:r,...Yb(t.offsetTree,0,r,n)}}const r=Lb(t.sizeTree).reduce((t,{k:n,v:r})=>wb(t,Math.max(0,n+e),r),bb());return{...t,sizeTree:r,...Yb(t.offsetTree,0,r,n)}})),A),{beforeUnshiftWith:w,data:C,defaultItemSize:d,firstItemIndex:l,fixedItemSize:c,fixedGroupSize:u,gap:p,groupIndices:s,heightEstimates:f,itemSize:h,listRefresh:y,shiftWith:o,shiftWithOffset:b,sizeRanges:n,sizes:A,statefulTotalCount:i,totalCount:r,trackItemSizes:v,unshiftWith:a}},xw(ob,Fb),{singleton:!0});function nE(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}const rE=Kw(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{const a=Xw(),o=Xw(),l=Qw(Pw(a,Fw(nE)));return Ow(Pw(l,Fw(e=>e.totalCount)),n),Ow(Pw(l,Fw(e=>e.groupIndices)),e),Ow(Pw(Jw(i,t,r),Dw(([e,t])=>jb(t)),Fw(([e,t,n])=>yb(t.groupOffsetTree,Math.max(e-n,0),"v")[0]),Tw(),Fw(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},xw(tE,pb)),iE=Kw(([{log:e}])=>{const t=Uw(!1),n=Qw(Pw(t,Dw(e=>e),Tw()));return Vw(t,t=>{t&&Zw(e)("props updated",{},tb)}),{didMount:n,propsReady:t}},xw(ob),{singleton:!0}),aE=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function oE(e){const t="number"==typeof e?{index:e}:{...e};return t.align||(t.align="start"),(!t.behavior||!aE)&&(t.behavior="auto"),void 0===t.offset&&(t.offset=0),t}const lE=Kw(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:l,scrollingInProgress:s,scrollTo:c,smoothScrollTargetReached:d,viewportHeight:u},{log:f}])=>{const h=Xw(),C=Xw(),p=Uw(0);let m=null,A=null,g=null;function v(){null!==m&&(m(),m=null),null!==g&&(g(),g=null),A&&(clearTimeout(A),A=null),kw(s,!1)}return Ow(Pw(h,qw(n,u,r,p,l,o,f),qw(e,a,i),Fw(([[e,n,r,i,a,o,l,c],u,f,p])=>{const y=oE(e),{align:w,behavior:b,offset:E}=y,M=i-1,L=Xb(y,n,M);let H=Ub(L,n.offsetTree,u)+o;"end"===w?(H+=f+yb(n.sizeTree,L)[1]-r+p,L===M&&(H+=l)):"center"===w?H+=(f+yb(n.sizeTree,L)[1]-r+p)/2:H-=a,void 0!==E&&0!==E&&(H+=E);const x=t=>{v(),t?(c("retrying to scroll to",{location:e},tb),kw(h,e)):(kw(C,!0),c("list did not change, scroll successful",{},tb))};if(v(),"smooth"===b){let e=!1;g=Vw(t,t=>{e=e||t}),m=zw(d,()=>{x(e)})}else m=zw(Pw(t,function(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}(150)),x);return A=setTimeout(()=>{v()},1200),kw(s,!0),c("scrolling from index to",{behavior:b,index:L,top:H},tb),{behavior:b,top:H}})),c),{scrollTargetReached:C,scrollToIndex:h,topListHeight:p}},xw(tE,pb,ob),{singleton:!0});function sE(e,t){0===e?t():requestAnimationFrame(()=>{sE(e-1,t)})}function cE(e,t){if(void 0===e)return 0;const n=t-1,r="number"==typeof e?e:"LAST"===e.index?n:e.index;return Math.max(0,Math.min(r,n))}function dE(e){return void 0===e||("number"==typeof e?0===e:!(0!==e.index||void 0!==e.align&&"start"!==e.align||void 0!==e.offset&&0!==e.offset))}const uE=Kw(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{const l=Uw(!0),s=Uw(0),c=Uw(!0);return Ow(Pw(o,qw(s),Dw(([e,t])=>!dE(t)),Rw(!1)),l),Ow(Pw(o,qw(s),Dw(([e,t])=>!dE(t)),Rw(!1)),c),Vw(Pw(Jw(t,o),qw(l,n,e,c),Dw(([[,e],t,{sizeTree:n},r,i])=>e&&(!gb(n)||Ew(r))&&!t&&!i),qw(s)),([,e])=>{if(void 0===e)return kw(l,!0),void kw(c,!0);zw(i,()=>{kw(c,!0)}),sE(4,()=>{zw(r,()=>{kw(l,!0)}),kw(a,e)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:s,scrolledToInitialItem:l}},xw(tE,pb,lE,iE),{singleton:!0});function fE(e,t){return Math.abs(e-t)<1.01}const hE="up",CE="down",pE={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},mE=Kw(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{const o=Uw(!1),l=Uw(!0),s=Xw(),c=Xw(),d=Uw(4),u=Uw(0),f=Ww(Pw(eb(Pw($w(i),jw(1),Rw(!0)),Pw($w(i),jw(1),Rw(!1),Nw(100))),Tw()),!1),h=Ww(Pw(eb(Pw(n,Rw(!0)),Pw(n,Rw(!1),Nw(200))),Tw()),!1);Ow(Pw(Jw($w(i),$w(u)),Fw(([e,t])=>e<=t),Tw()),l),Ow(Pw(l,_w(50)),c);const C=Qw(Pw(Jw(r,$w(a),$w(t),$w(e),$w(d)),Bw((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{const l={scrollHeight:t,scrollTop:n,viewportHeight:r};if(n+r-t>-o){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}},pE),Tw((e,t)=>void 0!==e&&e.atBottom===t.atBottom))),p=Ww(Pw(r,Bw((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!fE(e.scrollHeight,t)){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}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Dw(e=>e.changed),Fw(e=>e.jump)),0);Ow(Pw(C,Fw(e=>e.atBottom)),o),Ow(Pw(o,_w(50)),s);const m=Uw(CE);Ow(Pw(r,Fw(({scrollTop:e})=>e),Tw(),Bw((e,t)=>Zw(h)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?hE:CE,prevScrollTop:t},{direction:CE,prevScrollTop:0}),Fw(e=>e.direction)),m),Ow(Pw(r,_w(50),Rw("none")),m);const A=Uw(0);return Ow(Pw(f,Dw(e=>!e),Rw(0)),A),Ow(Pw(i,_w(100),qw(f),Dw(([e,t])=>t),Bw(([e,t],[n])=>[t,n],[0,0]),Fw(([e,t])=>t-e)),A),{atBottomState:C,atBottomStateChange:s,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:u,isAtBottom:o,isAtTop:l,isScrolling:f,lastJumpDueToItemResize:p,scrollDirection:m,scrollVelocity:A}},xw(pb)),AE="top",gE="bottom",vE="none";function yE(e,t,n){return"number"==typeof e?n===hE&&t===AE||n===CE&&t===gE?e:0:n===hE?t===AE?e.main:e.reverse:t===gE?e.main:e.reverse}function wE(e,t){return"number"==typeof e?e:e[t]??0}const bE=Kw(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{const a=Xw(),o=Uw(0),l=Uw(0),s=Uw(0);return{increaseViewportBy:l,listBoundary:a,overscan:s,topListHeight:o,visibleRange:Ww(Pw(Jw($w(r),$w(i),$w(n),$w(a,Db),$w(s),$w(o),$w(t),$w(e),$w(l)),Fw(([e,t,n,[r,i],a,o,l,s,c])=>{const d=e-s,u=o+l,f=Math.max(n-d,0);let h=vE;const C=wE(c,AE),p=wE(c,gE);return r-=s,i+=n+l,(r+=n+l)>e+u-C&&(h=hE),(i-=s)<e-f+t+p&&(h=CE),h!==vE?[Math.max(d-n-yE(a,AE,h)-C,0),d-f-l+t+yE(a,gE,h)+p]:null}),Dw(e=>null!==e),Tw(Db)),[0,0])}},xw(pb),{singleton:!0});const EE={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ME(e,t,n,r,i,a){const{lastIndex:o,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-o,f=c,h=l+u*s+(u-1)*r-d;return{bottom:d,firstItemIndex:a,items:HE(e,i,a),offsetBottom:h,offsetTop:c,top:f,topItems:HE(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function LE(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(const t of n.groupIndices){if(t-o>=e)break;o++}const l=e+o,s=cE(t,l);return ME(Array.from({length:l}).map((e,t)=>({data:a[t+s],index:t+s,offset:0,size:0})),[],l,i,n,r)}function HE(e,t,n){if(0===e.length)return[];if(!jb(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));const r=e[0].index,i=e[e.length-1].index,a=[],o=Eb(t.groupOffsetTree,r,i);let l,s=0;for(const r of e){let e;(!l||l.end<r.index)&&(l=o.shift(),s=t.groupIndices.indexOf(l.start)),e=r.index===l.start?{index:s,type:"group"}:{groupIndex:s,index:r.index-(s+1)+n},a.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return a}function xE(e,t){return void 0===e?0:"number"==typeof e?e:e[t]??0}const VE=Kw(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},a,{listBoundary:o,topListHeight:l,visibleRange:s},{initialTopMostItemIndex:c,scrolledToInitialItem:d},{topListHeight:u},f,{didMount:h},{recalcInProgress:C}])=>{const p=Uw([]),m=Uw(0),A=Xw(),g=Uw(0);Ow(a.topItemsIndexes,p);const v=Ww(Pw(Jw(h,C,$w(s,Db),$w(i),$w(r),$w(c),d,$w(p),$w(t),$w(n),$w(g),e),Dw(([e,t,,n,,,,,,,,r])=>{const i=void 0!==r&&r.length!==n;return e&&!t&&!i}),Fw(([,,[e,t],n,r,i,a,o,l,s,c,d])=>{const u=r,{offsetTree:f,sizeTree:h}=u,C=Zw(m);if(0===n)return{...EE,totalCount:n};if(0===e&&0===t)return 0===C?{...EE,totalCount:n}:LE(C,i,r,l,s,d||[]);if(gb(h))return C>0?null:ME(function(e,t,n){if(jb(t)){const r=Wb(e,t);return[{index:yb(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}(cE(i,n),u,d),[],n,s,u,l);const p=[];if(o.length>0){const e=o[0],t=o[o.length-1];let n=0;for(const r of Eb(h,e,t)){const i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)p.push({data:d?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return ME([],p,n,s,u,l);const A=o.length>0?o[o.length-1]+1:0,g=Qb(f,e,t,A);if(0===g.length)return null;const v=n-1,y=Lw([],n=>{for(const r of g){const i=r.value;let a=i.offset,o=r.start;const l=i.size;if(i.offset<e){o+=Math.floor((e-i.offset+s)/(l+s));const t=o-r.start;a+=t*l+t*s}o<A&&(a+=(A-o)*l,o=A);const c=Math.min(r.end,v);for(let e=o;e<=c&&!(a>=t);e++)n.push({data:d?.[e],index:e,offset:a,size:l}),a+=l+s}}),w=xE(c,AE),b=xE(c,gE);if(y.length>0&&(w>0||b>0)){const e=y[0],t=y[y.length-1];if(w>0&&e.index>A){const t=Math.min(w,e.index-A),n=[];let r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){const t=Eb(h,i,i)[0]?.value??e.size;r-=t+s,n.unshift({data:d?.[i],index:i,offset:r,size:t})}y.unshift(...n)}if(b>0&&t.index<v){const e=Math.min(b,v-t.index);let n=t.offset+t.size+s;for(let r=t.index+1;r<=t.index+e;r++){const e=Eb(h,r,r)[0]?.value??t.size;y.push({data:d?.[r],index:r,offset:n,size:e}),n+=e+s}}}return ME(y,p,n,s,u,l)}),Dw(e=>null!==e),Tw()),EE);Ow(Pw(e,Dw(Ew),Fw(e=>e?.length)),i),Ow(Pw(v,Fw(e=>e.topListHeight)),u),Ow(u,l),Ow(Pw(v,Fw(e=>[e.top,e.bottom])),o),Ow(Pw(v,Fw(e=>e.items)),A);const y=Qw(Pw(v,Dw(({items:e})=>e.length>0),qw(i,e),Dw(([{items:e},t])=>e[e.length-1].originalIndex===t-1),Fw(([,e,t])=>[e-1,t]),Tw(Db),Fw(([e])=>e))),w=Qw(Pw(v,_w(200),Dw(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),Fw(({items:e})=>e[0].index),Tw())),b=Qw(Pw(v,Dw(({items:e})=>e.length>0),Fw(({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}}),Tw(Tb)));return{endReached:y,initialItemCount:m,itemsRendered:A,listState:v,minOverscanItemCount:g,rangeChanged:b,startReached:w,topItemsIndexes:p,...f}},xw(tE,rE,bE,uE,lE,mE,iE,Fb),{singleton:!0}),kE=Kw(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{const a=Xw(),o=Ww(Pw(Jw(n,e,r,t,i),Fw(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return Ow($w(o),a),{totalListHeight:o,totalListHeightChanged:a}},xw(pb,VE),{singleton:!0}),SE=Kw(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Uw(!1);return{alignToBottom:n,paddingTopAddition:Ww(Pw(Jw(n,e,t),Dw(([e])=>e),Fw(([,e,t])=>Math.max(0,e-t)),_w(0),Tw()),0)}},xw(pb,kE),{singleton:!0}),ZE=Kw(()=>({context:Uw(null)})),OE=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>t<o?{...i,align:n??"start",...void 0===r?{}:{behavior:r}}:e>a?{...i,align:n??"end",...void 0===r?{}:{behavior:r}}:null,zE=Kw(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:l,viewportHeight:s},{scrollToIndex:c}])=>{const d=Xw();return Ow(Pw(d,qw(t,s,n,a,i,r,l),qw(e),Fw(([[e,t,n,r,i,a,l,s],c])=>{const{calculateViewLocation:d=OE,done:u,...f}=e,h=Xb(e,t,r-1),C=Ub(h,t.offsetTree,c)+i+a,p=d({itemBottom:C+yb(t.sizeTree,h)[1],itemTop:C,locationParams:f,viewportBottom:s+n-l,viewportTop:s+a});return null===p?u?.():u&&zw(Pw(o,Dw(e=>!e),jw(Zw(o)?1:2)),u),p}),Dw(e=>null!==e)),c),{scrollIntoView:d}},xw(tE,pb,lE,VE,ob),{singleton:!0});function NE(e){return!1!==e&&("smooth"===e?"smooth":"auto")}const IE=Kw(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:l},{didMount:s,propsReady:c},{log:d},{scrollingInProgress:u},{context:f},{scrollIntoView:h}])=>{const C=Uw(!1),p=Xw();let m=null;function A(e){kw(o,{align:"end",behavior:e,index:"LAST"})}function g(e){const t=zw(i,t=>{e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&null===m&&(Zw(d)("scrolling to bottom due to increased size",{},tb),A("auto"))});setTimeout(t,100)}Vw(Pw(Jw(Pw($w(t),jw(1)),s),qw($w(C),a,l,u),Fw(([[e,t],n,r,i,a])=>{let o=t&&i,l="auto";return o&&(l=((e,t)=>"function"==typeof e?NE(e(t)):t&&NE(e))(n,r||a),o=o&&!1!==l),{followOutputBehavior:l,shouldFollow:o,totalCount:e}}),Dw(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{null!==m&&(m(),m=null),void 0===Zw(n)?m=zw(e,()=>{Zw(d)("following output to ",{totalCount:r},tb),A(t),m=null}):requestAnimationFrame(()=>{Zw(d)("following output to ",{totalCount:r},tb),A(t)})}),Vw(Pw(Jw($w(C),t,c),Dw(([e,,t])=>!1!==e&&t),Bw(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),Dw(({refreshed:e})=>e),qw(C,t)),([,e])=>{Zw(l)&&g(!1!==e)}),Vw(p,()=>{g(!1!==Zw(C))}),Vw(Jw($w(C),i),([e,t])=>{!1!==e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&A("auto")});const v=Uw(null),y=Xw();return Ow(eb(Pw($w(r),Fw(e=>e?.length??0)),Pw($w(t))),y),Vw(Pw(Jw(Pw(y,jw(1)),s),qw($w(v),l,u,f),Fw(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),Dw(e=>!!e),_w(0)),t=>{null!==m&&(m(),m=null),void 0===Zw(n)?m=zw(e,()=>{Zw(d)("scrolling into view",{}),kw(h,t),m=null}):requestAnimationFrame(()=>{Zw(d)("scrolling into view",{}),kw(h,t)})}),{autoscrollToBottom:p,followOutput:C,scrollIntoViewOnChange:v}},xw(tE,mE,lE,uE,iE,ob,pb,ZE,zE)),TE=Kw(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:l}])=>(Ow(Pw(l,qw(a),Dw(([,e])=>0!==e),qw(i,r,t,n,e),Fw(([[,e],t,n,r,i,a=[]])=>LE(e,t,n,r,i,a))),o),{}),xw(tE,uE,VE,iE),{singleton:!0}),DE=Kw(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Uw(0);return Vw(Pw(e,qw(r),Dw(([,e])=>0!==e),Fw(([,e])=>({top:e}))),e=>{zw(Pw(n,jw(1),Dw(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{kw(t,e)})})}),{initialScrollTop:r}},xw(iE,pb,VE),{singleton:!0}),FE=Kw(([{scrollVelocity:e}])=>{const t=Uw(!1),n=Xw(),r=Uw(!1);return Ow(Pw(e,qw(r,t,n),Dw(([e,t])=>!1!==t&&void 0!==t),Fw(([e,t,n,r])=>{const{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),Tw()),t),Vw(Pw(Jw(t,e,n),qw(r)),([[e,t,n],r])=>{e&&!1!==r&&void 0!==r&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},xw(mE),{singleton:!0}),RE=Kw(([{scrollContainerState:e,scrollTo:t}])=>{const n=Xw(),r=Xw(),i=Xw(),a=Uw(!1),o=Uw(void 0);return Ow(Pw(Jw(n,r),Fw(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),Ow(Pw(t,qw(r),Fw(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},xw(pb)),PE=Kw(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:l,windowViewportRect:s}])=>{const c=Xw(),d=Uw(void 0),u=Uw(null),f=Uw(null);return Ow(l,u),Ow(s,f),Vw(Pw(c,qw(t,r,o,u,f,n)),([e,t,n,r,i,a,o])=>{const l=function(e){return Lb(e).map(({k:e,v:t},n,r)=>{const i=r[n+1];return{endIndex:void 0===i?1/0:i.k-1,size:t,startIndex:e}})}(t.sizeTree);r&&null!==i&&null!==a&&(n=i.scrollTop-a.offsetTop),e({ranges:l,scrollTop:n-=o})}),Ow(Pw(d,Dw(Ew),Fw(BE)),i),Ow(Pw(a,qw(d),Dw(([,e])=>void 0!==e),Tw(),Fw(([,e])=>e.ranges)),e),{getState:c,restoreStateFrom:d}},xw(tE,pb,uE,iE,RE));function BE(e){return{align:"start",index:0,offset:e.scrollTop}}const jE=Kw(([{topItemsIndexes:e}])=>{const t=Uw(0);return Ow(Pw(t,Dw(e=>e>=0),Fw(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},xw(VE));function _E(e){let t,n=!1;return()=>(n||(n=!0,t=e()),t)}const qE=_E(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),UE=Kw(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:l},{listState:s},{beforeUnshiftWith:c,gap:d,shiftWithOffset:u,sizes:f},{log:h},{recalcInProgress:C}])=>{const p=Qw(Pw(s,qw(o),Bw(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},l])=>{const s=r+a;let c=0;return t===o&&e.length>0&&i.length>0&&(0===i[0].originalIndex&&0===e[0].originalIndex||(c=s-n,0!==c&&(c+=l))),[c,i,o,s]},[0,[],0,0]),Dw(([e])=>0!==e),qw(r,l,n,i,h,C),Dw(([,e,t,n,,,r])=>!r&&!n&&0!==e&&t===hE),Fw(([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},tb),e))));function m(n){n>0?(kw(t,{behavior:"auto",top:-n}),kw(e,0)):(kw(e,0),kw(t,{behavior:"auto",top:-n}))}return Vw(Pw(p,qw(e,a)),([t,n,r])=>{r&&qE()?kw(e,n-t):m(-t)}),Vw(Pw(Jw(Ww(a,!1),e,C),Dw(([e,t,n])=>!e&&!n&&0!==t),Fw(([e,t])=>t),_w(1)),m),Ow(Pw(u,Fw(e=>({top:-e}))),t),Vw(Pw(c,qw(f,d),Fw(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(0===t.length)return a(e);let o=0;const l=vb(r,0);let s=0,c=0;for(;s<e;){s++,o+=l;let n=t.length===c+1?1/0:t[c+1]-t[c]-1;s+n>e&&(o-=l,n=e-s+1),s+=n,o+=a(n),c++}return o})),n=>{kw(e,n),requestAnimationFrame(()=>{kw(t,{top:n}),requestAnimationFrame(()=>{kw(e,0),kw(C,!1)})})}),{deviation:e}},xw(pb,mE,VE,tE,ob,Fb)),WE=Kw(([e,t,n,r,i,a,o,l,s,c,d])=>({...e,...t,...n,...r,...i,...a,...o,...l,...s,...c,...d}),xw(bE,TE,iE,FE,kE,DE,SE,RE,zE,ob,ZE)),XE=Kw(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:l,itemSize:s,sizeRanges:c,sizes:d,statefulTotalCount:u,totalCount:f,trackItemSizes:h},{initialItemFinalLocationReached:C,initialTopMostItemIndex:p,scrolledToInitialItem:m},A,g,v,y,{scrollToIndex:w},b,{topItemCount:E},{groupCounts:M},L])=>{const{listState:H,minOverscanItemCount:x,topItemsIndexes:V,rangeChanged:k,...S}=y;return Ow(k,L.scrollSeekRangeChanged),Ow(Pw(Jw(L.windowViewportRect,A.headerHeight,A.fixedHeaderHeight),Fw(([e,t,n])=>Math.max(t+n+1,e.visibleHeight))),A.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:M,heightEstimates:l,initialItemFinalLocationReached:C,initialTopMostItemIndex:p,scrolledToInitialItem:m,sizeRanges:c,topItemCount:E,topItemsIndexes:V,totalCount:f,...v,groupIndices:o,itemSize:s,listState:H,minOverscanItemCount:x,scrollToIndex:w,statefulTotalCount:u,trackItemSizes:h,rangeChanged:k,...S,...L,...A,sizes:d,...g}},xw(tE,uE,pb,PE,IE,VE,lE,UE,jE,rE,WE));function QE(e,t){const n={},r={};let i=0;const a=e.length;for(;i<a;)r[e[i]]=1,i+=1;for(const e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}const GE=typeof document>"u"?i.useEffect:i.useLayoutEffect;function KE(t,n,r){const a=Object.keys(n.required||{}),o=Object.keys(n.optional||{}),l=Object.keys(n.methods||{}),s=Object.keys(n.events||{}),c=i.createContext({});function d(e,t){void 0!==e.propsReady&&kw(e.propsReady,!1);for(const r of a){kw(e[n.required[r]],t[r])}for(const r of o)if(r in t){kw(e[n.optional[r]],t[r])}void 0!==e.propsReady&&kw(e.propsReady,!0)}function u(e){return s.reduce((t,r)=>(t[r]=function(e){let t,n;const r=()=>t?.();return function(i,a){switch(i){case 1:return a?n===a?void 0:(r(),n=a,t=Vw(e,a),t):(r(),Mw);case 2:return r(),void(n=null)}}}(e[n.events[r]]),t),{})}const f=i.forwardRef(function(f,h){const{children:C,...p}=f,[m]=i.useState(()=>Lw(function(e){const t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);const o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}(t),e=>{d(e,p)})),[A]=i.useState(bw(u,m));var g;GE(()=>{for(const e of s)e in p&&Vw(A[e],p[e]);return()=>{Object.values(A).map(Sw)}},[p,A,m]),GE(()=>{d(m,p)}),i.useImperativeHandle(h,vw((g=m,l.reduce((e,t)=>(e[t]=e=>{kw(g[n.methods[t]],e)},e),{}))));const v=r;return e(c.Provider,{value:m,children:void 0===r?C:e(v,{...QE([...a,...o,...s],p),children:C})})});return{Component:f,useEmitter:(e,t)=>{const n=i.useContext(c)[e];GE(()=>Vw(n,t),[t,n])},useEmitterValue:parseInt(i.version,10)>=18?e=>{const t=i.useContext(c)[e],n=i.useCallback(e=>Vw(t,e),[t]);return i.useSyncExternalStore(n,()=>Zw(t),()=>Zw(t))}:e=>{const t=i.useContext(c)[e],[n,r]=i.useState(bw(Zw,t));return GE(()=>Vw(t,e=>{e!==n&&r(vw(e))}),[t,n]),n},usePublisher:e=>{const t=i.useContext(c);return i.useCallback(n=>{kw(t[e],n)},[t,e])}}}const YE=i.createContext(void 0),JE=i.createContext(void 0),$E="-webkit-sticky",eM="sticky",tM=_E(()=>{if(typeof document>"u")return eM;const e=document.createElement("div");return e.style.position=$E,e.style.position===$E?$E:eM}),nM=typeof document>"u"?i.useEffect:i.useLayoutEffect;function rM(e){return"self"in e}function iM(e,t,n,r=Mw,a,o){const l=i.useRef(null),s=i.useRef(null),c=i.useRef(null),d=i.useCallback(n=>{let r,i,a;const l=n.target;if(function(e){return"body"in e}(l)||rM(l)){const e=rM(l)?l:l.defaultView;a=!0===o?sb(e,e.scrollX):e.scrollY,r=!0===o?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=!0===o?e.innerWidth:e.innerHeight}else a=!0===o?sb(l,l.scrollLeft):l.scrollTop,r=!0===o?l.scrollWidth:l.scrollHeight,i=!0===o?l.offsetWidth:l.offsetHeight;const d=()=>{e({scrollHeight:r,scrollTop:Math.max(a,0),viewportHeight:i})};!0===n.suppressFlushSync?d():M.flushSync(d),null!==s.current&&(a===s.current||a<=0||a===r-i)&&(s.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t,o]);return i.useEffect(()=>{const e=a??l.current;return r(a??l.current),d({suppressFlushSync:!0,target:e}),e.addEventListener("scroll",d,{passive:!0}),()=>{r(null),e.removeEventListener("scroll",d)}},[l,d,n,r,a]),{scrollByCallback:function(e){!0===o&&(e={...void 0===e.behavior?{}:{behavior:e.behavior},...void 0===e.top?{}:{left:cb(l.current,e.top)}}),l.current.scrollBy(e)},scrollerRef:l,scrollToCallback:function(n){const r=l.current;if(!r||(!0===o?"offsetWidth"in r&&0===r.offsetWidth:"offsetHeight"in r&&0===r.offsetHeight))return;const i="smooth"===n.behavior;let a,d,u;rM(r)?(d=Math.max(Bb(r.document.documentElement,!0===o?"width":"height"),!0===o?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),a=!0===o?r.innerWidth:r.innerHeight,u=!0===o?sb(r,r.scrollX):r.scrollY):(d=r[!0===o?"scrollWidth":"scrollHeight"],a=Bb(r,!0===o?"width":"height"),u=!0===o?sb(r,r.scrollLeft):r.scrollTop);const f=d-a;if(void 0===n.top)return void r.scrollTo(n);const h=Math.ceil(Math.max(Math.min(f,n.top),0));if(n.top=h,fE(a,d)||h===u)return e({scrollHeight:d,scrollTop:u,viewportHeight:a}),void(i&&t(!0));i?(s.current=h,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,!0===o&&(n={...void 0===n.behavior?{}:{behavior:n.behavior},left:cb(r,h)}),r.scrollTo(n)}}}function aM(e){return e}const oM=Kw(()=>{const e=Uw(e=>`Item ${e}`),t=Uw(e=>`Group ${e}`),n=Uw({}),r=Uw(aM),i=Uw("div"),a=Uw(Mw),o=(e,t=null)=>Ww(Pw(n,Fw(t=>t[e]),Tw()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o("EmptyPlaceholder"),FooterComponent:o("Footer"),GroupComponent:o("Group","div"),groupContent:t,HeaderComponent:o("Header"),HeaderFooterTag:i,ItemComponent:o("Item","div"),itemContent:e,ListComponent:o("List","div"),ScrollerComponent:o("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:o("ScrollSeekPlaceholder"),TopItemListComponent:o("TopItemList")}}),lM=Kw(([e,t])=>({...e,...t}),xw(XE,oM)),sM=({height:t})=>e("div",{style:{height:t}}),cM={overflowAnchor:"none",position:tM(),zIndex:1},dM={overflowAnchor:"none"},uM={...dM,display:"inline-block",height:"100%"},fM=i.memo(function({showTopList:t=!1}){const n=SM("listState"),r=ZM("sizeRanges"),a=SM("useWindowScroll"),o=SM("customScrollParent"),l=ZM("windowScrollContainerState"),s=ZM("scrollContainerState"),c=o||a?l:s,d=SM("itemContent"),u=SM("context"),f=SM("groupContent"),h=SM("trackItemSizes"),C=SM("itemSize"),p=SM("log"),A=ZM("gap"),g=SM("horizontalDirection"),{callbackRef:v}=fb(r,C,h,t?Mw:c,p,A,o,g,SM("skipAnimationFrameInResizeObserver")),[y,w]=i.useState(0);kM("deviation",e=>{y!==e&&w(e)});const b=SM("EmptyPlaceholder"),E=SM("ScrollSeekPlaceholder")??sM,M=SM("ListComponent"),L=SM("ItemComponent"),H=SM("GroupComponent"),x=SM("computeItemKey"),V=SM("isSeeking"),k=SM("groupIndices").length>0,S=SM("alignToBottom"),Z=SM("initialItemFinalLocationReached"),O=t?{}:{boxSizing:"border-box",...g?{display:"inline-block",height:"100%",marginInlineStart:0===y?S?"auto":0:y,paddingInlineEnd:n.offsetBottom,paddingInlineStart:n.offsetTop,whiteSpace:"nowrap"}:{marginTop:0===y?S?"auto":0:y,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...Z?{}:{visibility:"hidden"}};return t||0!==n.totalCount||null==b?e(M,{...gM(M,u),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:v,style:O,children:(t?n.topItems:n.items).map(e=>{const t=e.originalIndex,r=x(t+n.firstItemIndex,e.data,u);return V?m(E,{...gM(E,u),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?m(H,{...gM(H,u),"data-index":t,"data-item-index":e.index,"data-known-size":e.size,key:r,style:cM},f(e.index,u)):m(L,{...gM(L,u),...vM(L,e.data),"data-index":t,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:g?uM:dM},k?d(e.index,e.groupIndex,e.data,u):d(e.index,e.data,u))})}):e(b,{...gM(b,u)})}),hM={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},CM={outline:"none",overflowX:"auto",position:"relative"},pM=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),mM=(e,t,n=0)=>({...pM(e),position:t?"relative":"absolute",top:t?-n:0}),AM={position:tM(),top:0,width:"100%",zIndex:1};function gM(e,t){if("string"!=typeof e)return{context:t}}function vM(e,t){return{item:"string"==typeof e?void 0:t}}const yM=i.memo(function(){const t=SM("HeaderComponent"),n=ZM("headerHeight"),r=SM("HeaderFooterTag"),a=db(i.useMemo(()=>e=>{n(Bb(e,"height"))},[n]),!0,SM("skipAnimationFrameInResizeObserver")),o=SM("context");return null!=t?e(r,{ref:a,children:e(t,{...gM(t,o)})}):null}),wM=i.memo(function(){const t=SM("FooterComponent"),n=ZM("footerHeight"),r=SM("HeaderFooterTag"),a=db(i.useMemo(()=>e=>{n(Bb(e,"height"))},[n]),!0,SM("skipAnimationFrameInResizeObserver")),o=SM("context");return null!=t?e(r,{ref:a,children:e(t,{...gM(t,o)})}):null});function bM({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:i,style:a,context:o,...l}){const s=r("scrollContainerState"),c=n("ScrollerComponent"),d=r("smoothScrollTargetReached"),u=n("scrollerRef"),f=n("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:C,scrollToCallback:p}=iM(s,d,c,u,void 0,f);return t("scrollTo",p),t("scrollBy",h),e(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:C,style:{...f?CM:hM,...a},tabIndex:0,...l,...gM(c,o),children:i})})}function EM({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:a,style:o,context:l,...s}){const c=r("windowScrollContainerState"),d=n("ScrollerComponent"),u=r("smoothScrollTargetReached"),f=n("totalListHeight"),h=n("deviation"),C=n("customScrollParent"),p=i.useRef(null),m=n("scrollerRef"),{scrollByCallback:A,scrollerRef:g,scrollToCallback:v}=iM(c,u,d,m,C);return nM(()=>(g.current=C??p.current?.ownerDocument.defaultView,()=>{g.current=null}),[g,C]),t("windowScrollTo",v),t("scrollBy",A),e(d,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...0===f?void 0:{height:f+h}},...s,...gM(d,l),children:a})})}const MM=({children:t})=>{const n=i.useContext(YE),r=ZM("viewportHeight"),a=ZM("fixedItemHeight"),o=SM("alignToBottom"),l=SM("horizontalDirection"),s=db(i.useMemo(()=>ww(r,e=>Bb(e,l?"width":"height")),[r,l]),!0,SM("skipAnimationFrameInResizeObserver"));return i.useEffect(()=>{n&&(r(n.viewportHeight),a(n.itemHeight))},[n,r,a]),e("div",{"data-viewport-type":"element",ref:s,style:pM(o),children:t})},LM=({children:t})=>{const n=i.useContext(YE),r=ZM("windowViewportRect"),a=ZM("fixedItemHeight"),o=SM("customScrollParent"),l=SM("useWindowScroll"),s=SM("topListHeight"),c=Cb(r,o,SM("skipAnimationFrameInResizeObserver")),d=SM("alignToBottom");return i.useEffect(()=>{n&&(a(n.itemHeight),r({listHeight:0,offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:100}))},[n,r,a]),e("div",{"data-viewport-type":"window",ref:c,style:mM(d,l,s),children:t})},HM=({children:t})=>{const n=SM("TopItemListComponent")??"div",r=SM("headerHeight"),i={...AM,marginTop:`${r}px`},a=SM("context");return e(n,{style:i,...gM(n,a),children:t})},xM=i.memo(function(t){const r=SM("useWindowScroll"),i=SM("topItemsIndexes").length>0,a=SM("customScrollParent"),o=SM("context");return n(a||r?zM:OM,{...t,context:o,children:[i&&e(HM,{children:e(fM,{showTopList:!0})}),n(a||r?LM:MM,{children:[e(yM,{}),e(fM,{}),e(wM,{})]})]})}),{Component:VM,useEmitter:kM,useEmitterValue:SM,usePublisher:ZM}=KE(lM,{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"}},xM),OM=bM({useEmitter:kM,useEmitterValue:SM,usePublisher:ZM}),zM=EM({useEmitter:kM,useEmitterValue:SM,usePublisher:ZM}),NM=VM,IM=Kw(()=>{const e=Uw(e=>n("td",{children:["Item $",e]})),t=Uw(null),r=Uw(e=>n("td",{colSpan:1e3,children:["Group ",e]})),i=Uw(null),a=Uw(null),o=Uw({}),l=Uw(aM),s=Uw(Mw),c=(e,t=null)=>Ww(Pw(o,Fw(t=>t[e]),Tw()),t);return{components:o,computeItemKey:l,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:a,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")}});xw(XE,IM),tM();const TM={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},DM={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:FM,floor:RM,max:PM,min:BM,round:jM}=Math;function _M(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:null===n?null:n[r+e],index:r+e}))}function qM(e,t){return void 0!==e&&e.width===t.width&&e.height===t.height}function UM(e,t){return void 0!==e&&e.column===t.column&&e.row===t.row}const WM=Kw(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:l,scrollTo:s,scrollTop:c,smoothScrollTargetReached:d,viewportHeight:u},f,h,{didMount:C,propsReady:p},{customScrollParent:m,useWindowScroll:A,windowScrollContainerState:g,windowScrollTo:v,windowViewportRect:y},w])=>{const b=Uw(0),E=Uw(0),M=Uw(TM),L=Uw({height:0,width:0}),H=Uw({height:0,width:0}),x=Xw(),V=Xw(),k=Uw(0),S=Uw(null),Z=Uw({column:0,row:0}),O=Xw(),z=Xw(),N=Uw(!1),I=Uw(0),T=Uw(!0),D=Uw(!1),F=Uw(!1);Vw(Pw(C,qw(I),Dw(([e,t])=>!dE(t))),()=>{kw(T,!1)}),Vw(Pw(Jw(C,T,H,L,I,D),Dw(([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i)),([,,,,e])=>{void 0!==e?(kw(D,!0),sE(1,()=>{kw(x,e)}),zw(Pw(c),()=>{kw(t,[0,0]),kw(T,!0)})):kw(T,!0)}),Ow(Pw(z,Dw(e=>null!=e&&e.scrollTop>0),Rw(0)),E),Vw(Pw(C,qw(z),Dw(([,e])=>null!=e)),([,e])=>{e&&(kw(L,e.viewport),kw(H,e.item),kw(Z,e.gap),e.scrollTop>0&&(kw(N,!0),zw(Pw(c,jw(1)),e=>{kw(N,!1)}),kw(s,{top:e.scrollTop})))}),Ow(Pw(L,Fw(({height:e})=>e)),u),Ow(Pw(Jw($w(L,qM),$w(H,qM),$w(Z,(e,t)=>void 0!==e&&e.column===t.column&&e.row===t.row),$w(c)),Fw(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),O),Ow(Pw(Jw($w(b),r,$w(Z,UM),$w(H,qM),$w(L,qM),$w(S),$w(E),$w(N),$w(T),$w(I)),Dw(([,,,,,,,e])=>!e),Fw(([e,[t,n],r,i,a,o,l,,s,c])=>{const{column:d,row:u}=r,{height:f,width:h}=i,{width:C}=a;if(0===l&&(0===e||0===C))return TM;if(0===h){const t=cE(c,e);return function(e){return{...DM,items:e}}(_M(t,t+Math.max(l-1,0),o))}const p=XM(C,h,d);let m,A;s?0===t&&0===n&&l>0?(m=0,A=l-1):(m=p*RM((t+u)/(f+u)),A=p*FM((n+u)/(f+u))-1,A=BM(e-1,PM(A,p-1)),m=BM(A,PM(0,m))):(m=0,A=-1);const g=_M(m,A,o),{bottom:v,top:y}=QM(a,r,i,g),w=FM(e/p);return{bottom:v,itemHeight:f,items:g,itemWidth:h,offsetBottom:w*f+(w-1)*u-v,offsetTop:y,top:y}})),M),Ow(Pw(S,Dw(e=>null!==e),Fw(e=>e.length)),b),Ow(Pw(Jw(L,H,M,Z),Dw(([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height),Fw(([e,t,{items:n},r])=>{const{bottom:i,top:a}=QM(e,r,t,n);return[a,i]}),Tw(Db)),t);const R=Uw(!1);Ow(Pw(c,qw(R),Fw(([e,t])=>t||0!==e)),R);const P=Qw(Pw(Jw(M,b),Dw(([{items:e}])=>e.length>0),qw(R),Dw(([[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}),Fw(([[,e]])=>e-1),Tw())),B=Qw(Pw($w(M),Dw(({items:e})=>e.length>0&&0===e[0].index),Rw(0),Tw())),j=Qw(Pw($w(M),qw(N),Dw(([{items:e},t])=>e.length>0&&!t),Fw(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),Tw(Tb),_w(0)));Ow(j,h.scrollSeekRangeChanged),Ow(Pw(x,qw(L,H,b,Z),Fw(([e,t,n,r,i])=>{const a=oE(e),{align:o,behavior:l,offset:s}=a;let c=a.index;"LAST"===c&&(c=r-1),c=PM(0,c,BM(r-1,c));let d=GM(t,i,n,c);return"end"===o?d=jM(d-t.height+n.height):"center"===o&&(d=jM(d-t.height/2+n.height/2)),void 0!==s&&0!==s&&(d+=s),{behavior:l,top:d}})),s);const _=Ww(Pw(M,Fw(e=>e.offsetBottom+e.bottom)),0);return Ow(Pw(y,Fw(e=>({height:e.visibleHeight,width:e.visibleWidth}))),L),{customScrollParent:m,data:S,deviation:k,footerHeight:i,gap:Z,headerHeight:a,increaseViewportBy:e,initialItemCount:E,itemDimensions:H,overscan:n,restoreStateFrom:z,scrollBy:o,scrollContainerState:l,scrollHeight:V,scrollTo:s,scrollToIndex:x,scrollTop:c,smoothScrollTargetReached:d,totalCount:b,useWindowScroll:A,viewportDimensions:L,windowScrollContainerState:g,windowScrollTo:v,windowViewportRect:y,...h,gridState:M,horizontalDirection:F,initialTopMostItemIndex:I,totalListHeight:_,...f,endReached:P,propsReady:p,rangeChanged:j,startReached:B,stateChanged:O,stateRestoreInProgress:N,...w}},xw(bE,pb,mE,FE,iE,RE,ob));function XM(e,t,n){return PM(1,RM((e+n)/(RM(t)+n)))}function QM(e,t,n,r){const{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};const a=GM(e,t,n,r[0].index);return{bottom:GM(e,t,n,r[r.length-1].index)+i,top:a}}function GM(e,t,n,r){const i=XM(e.width,n.width,t.column),a=RM(r/i),o=a*n.height+PM(0,a-1)*t.row;return o>0?o+t.row:o}const KM=Kw(()=>{const e=Uw(e=>`Item ${e}`),t=Uw({}),n=Uw(null),r=Uw("virtuoso-grid-item"),i=Uw("virtuoso-grid-list"),a=Uw(aM),o=Uw("div"),l=Uw(Mw),s=(e,n=null)=>Ww(Pw(t,Fw(t=>t[e]),Tw()),n),c=Uw(!1),d=Uw(!1);return Ow($w(d),c),{components:t,computeItemKey:a,context:n,FooterComponent:s("Footer"),HeaderComponent:s("Header"),headerFooterTag:o,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")}}),YM=Kw(([e,t])=>({...e,...t}),xw(WM,KM)),JM=i.memo(function(){const t=aL("gridState"),n=aL("listClassName"),r=aL("itemClassName"),a=aL("itemContent"),o=aL("computeItemKey"),l=aL("isSeeking"),s=oL("scrollHeight"),c=aL("ItemComponent"),d=aL("ListComponent"),u=aL("ScrollSeekPlaceholder"),f=aL("context"),h=oL("itemDimensions"),C=oL("gap"),p=aL("log"),A=aL("stateRestoreInProgress"),g=oL("reportReadyState"),v=db(i.useMemo(()=>e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const n=e.firstChild;if(null!==n){const{height:e,width:t}=n.getBoundingClientRect();h({height:e,width:t})}C({column:cL("column-gap",getComputedStyle(e).columnGap,p),row:cL("row-gap",getComputedStyle(e).rowGap,p)})},[s,h,C,p]),!0,!1);return nM(()=>{t.itemHeight>0&&t.itemWidth>0&&g(!0)},[t]),A?null:e(d,{className:n,ref:v,...gM(d,f),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map(n=>{const i=o(n.index,n.data,f);return l?e(u,{...gM(u,f),height:t.itemHeight,index:n.index,width:t.itemWidth},i):m(c,{...gM(c,f),className:r,"data-index":n.index,key:i},a(n.index,n.data,f))})})}),$M=i.memo(function(){const t=aL("HeaderComponent"),n=oL("headerHeight"),r=aL("headerFooterTag"),a=db(i.useMemo(()=>e=>{n(Bb(e,"height"))},[n]),!0,!1),o=aL("context");return null!=t?e(r,{ref:a,children:e(t,{...gM(t,o)})}):null}),eL=i.memo(function(){const t=aL("FooterComponent"),n=oL("footerHeight"),r=aL("headerFooterTag"),a=db(i.useMemo(()=>e=>{n(Bb(e,"height"))},[n]),!0,!1),o=aL("context");return null!=t?e(r,{ref:a,children:e(t,{...gM(t,o)})}):null}),tL=({children:t})=>{const n=i.useContext(JE),r=oL("itemDimensions"),a=oL("viewportDimensions"),o=db(i.useMemo(()=>e=>{a(e.getBoundingClientRect())},[a]),!0,!1);return i.useEffect(()=>{n&&(a({height:n.viewportHeight,width:n.viewportWidth}),r({height:n.itemHeight,width:n.itemWidth}))},[n,a,r]),e("div",{ref:o,style:pM(!1),children:t})},nL=({children:t})=>{const n=i.useContext(JE),r=oL("windowViewportRect"),a=oL("itemDimensions"),o=aL("customScrollParent"),l=aL("useWindowScroll"),s=Cb(r,o,!1);return i.useEffect(()=>{n&&(a({height:n.itemHeight,width:n.itemWidth}),r({listHeight:0,offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:n.viewportWidth}))},[n,r,a]),e("div",{ref:s,style:mM(!1,l),children:t})},rL=i.memo(function({...t}){const r=aL("useWindowScroll"),i=aL("customScrollParent"),a=i||r?sL:lL,o=i||r?nL:tL,l=aL("context");return e(a,{...t,...gM(a,l),children:n(o,{children:[e($M,{}),e(JM,{}),e(eL,{})]})})}),{useEmitter:iL,useEmitterValue:aL,usePublisher:oL}=KE(YM,{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"}},rL),lL=bM({useEmitter:iL,useEmitterValue:aL,usePublisher:oL}),sL=EM({useEmitter:iL,useEmitterValue:aL,usePublisher:oL});function cL(e,t,n){return"normal"!==t&&!0!==t?.endsWith("px")&&n(`${e} was not resolved to pixel value correctly`,t,rb),"normal"===t?0:parseInt(t??"0",10)}const dL=({optionsList:r=[],onSelectVariable:i,dropdownPosition:a,position:s="relative",width:c,height:d="160px",zIndex:u=9999,highlightedIndex:f})=>{const h={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},C=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":h[e.type||""]||"":"step_group_variable"},p=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;function m(e){if(e.endsWith("px")){const t=parseInt(e.slice(0,-2),10);return isNaN(t)?212:t-66}return 212}const A=o(null);l(()=>{void 0!==f&&f>=0&&requestAnimationFrame(()=>{A.current?.scrollToIndex({index:f,behavior:"auto",align:"center"})})},[f,r]);return e("div",{className:I("ff-variable-dropdown",s),role:"listbox","aria-label":"Variable suggestions",style:a?{top:a.top,left:a.left,width:c,height:d,zIndex:u}:{width:c,height:d,zIndex:u},children:K(r)?e("div",{className:"ff-variable-option ff-variable-option-no-data",role:"status","aria-live":"polite","aria-label":"No variable options available",children:e(U,{as:"span",fontSize:12,children:"No Option"})}):e(NM,{"aria-label":"Variable options",totalCount:r.length,ref:A,data:r,itemContent:a=>{const o=r[a];return o?e("div",{className:I("ff-variable-data",{"ff-variable-data--highlighted":f===a}),onMouseDown:()=>i(o),role:"option","aria-selected":f===a,"aria-label":p(o),children:c.endsWith("px")?n(t,{children:[e(Y,{title:xn(p(o),m(c),"pixel")?p(o):"",placement:"bottom",style:{width:`${m(c)}px`},children:e(U,{as:"span",fontSize:12,className:"ff-truncated_text",children:p(o)})}),e(q,{name:C(o),height:24,width:24})]}):e(gw,{option:o})},`${o.id}-${a}`):null},style:{height:d,fontSize:"12px"},overscan:10,fixedItemHeight:32})})},uL=({data:r=[],width:i,height:a,lineChartWidth:o,yAxisLabel:s,xAxisLabel:d,yAxisValueColor:u,xAxisColor:f,yAxisColor:h,yAxisLabelColor:C,textSize:p,fontWeight:m,numberSize:A,chartName:g,shouldCenterSinglePoint:v,xAxisLabelGap:y=16,isLeftOverflow:w=!1})=>{const b=40,E=i-80,M=a-80,[L,H]=c(!1),[x,V]=c({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});l(()=>{const e=()=>{H(!1),V(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,o=6,l=7;return n("div",{className:"ff-line-chart-text",style:{width:i+20+y,gap:y},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:a},children:e(U,{className:"ff-line-chart-yAxisLabel",fontSize:p,fontWeight:"semi-bold",children:s})}),e("div",{className:"ff-line-chart-svg",children:e("svg",{height:a,width:i,className:"ff-line-chart-svg",children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:M,x2:E,y2:M,stroke:f,strokeWidth:1}),e("text",{x:E/2.1,y:M+b/1.2,textAnchor:"middle",fill:C,className:"ff-line-chart-x-axis-label",style:{fontSize:p,fontWeight:m},children:d}),t.map((t,n)=>e("text",{x:n*(E/(l-1)),y:M+15,textAnchor:0===n?"start":n===l-1?"end":"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:t},t)),Array.from({length:o}).map((t,n)=>{const i=n*r/(o-1),a=i/1024;return e("text",{x:-10,y:M-i*M/r,textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:a?.toFixed(1)},`y-${n}`)})]})})})]})}function k(e){if(!isNaN(e))return parseFloat(e);const t=Vr,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 S=r?.[0]?.data?.[0]?.hasOwnProperty("date")&&r?.[0]?.data?.[0]?.hasOwnProperty("totalMemory"),Z="date",O=S?"totalMemory":"value",z=e=>{const t=r?.[0]?.data?.length;if(1===t)return v?E/2:E;const n=r[0].data.findIndex(t=>t[Z]===e);return-1===n?0:n/(t-1)*E},N=Math.max(...r?.flatMap(e=>e?.data?.map(e=>k(e[O]))),5),I=e=>{if("memory"===g){const t=Math.max(...r?.flatMap(e=>e?.data?.map(e=>k(e[O]))));return M-e*M/(t>1024?t:1024)}return M-e*M/(0===N?1024:N)},T=e=>{if(1===e?.length){const t=e?.[0],n=z(t[Z]),r=I(k(t[O]));return`M 0 ${I(0)} L ${n} ${r}`}return e?.reduce((t,n,r)=>{const i=z(n[Z]),a=I(k(n[O]));if(0===r)return`M ${i} ${a}`;const o=e[r-1],l=o?z(o[Z]):0;return`${t} C ${l+(i-l)/2} ${o?I(k(o[O])):0}, ${i-(i-l)/2} ${a}, ${i} ${a}`},"")},D=r[0].data,F=g?`${g} line chart`:"Line chart";return n("section",{className:"ff-line-chart-text",style:{width:i+20+y,gap:y},"aria-label":F,children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:a},children:e(U,{className:"ff-line-chart-yAxisLabel",fontSize:p,fontWeight:"semi-bold",children:s})}),n("div",{className:"ff-line-chart-svg",children:[e("svg",{height:a,width:i,onMouseMove:e=>{const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-b;if(e.clientY-t.top-b>M)return H(!1),void V({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});let i={hoverValues:{},dotPositions:{}},a=null;r.forEach((e,t)=>{const r=e.data.reduce((e,t)=>{const r=Math.abs(n-z(t[Z]));return r<e.distance?{point:t,distance:r}:e},{point:null,distance:1/0}).point;r&&(a=r[Z],i.hoverValues[t]=((e,t=2)=>{let n="";if("string"==typeof e){const t=e.match(Lr),r=e.match(Hr);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[Z]),y:I(k(r[O]))})}),H(!0),V({cursorX:n,hoverValues:i.hoverValues,dotPositions:i.dotPositions,currentXValue:a,tooltip:a?{visible:!0,left:e.clientX+10,top:e.clientY-20}:{visible:!1,left:0,top:0}})},onMouseLeave:()=>V({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null}),className:"ff-line-chart-svg",role:"img","aria-label":F,children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:0,x2:0,y2:M,strokeWidth:2}),e("line",{x1:0,y1:M,x2:E,y2:M,stroke:f,strokeWidth:1}),e("text",{x:E/2.1,y:M+b/1.2,textAnchor:"middle",fill:C,className:"ff-line-chart-x-axis-label",style:{fontSize:p,fontWeight:m},children:d}),r.map((r,i)=>{return!1!==r.show?n("g",{children:[e("path",{d:T(r.data),fill:"none",stroke:r.color,strokeWidth:o,opacity:(a=r.data,a.every(e=>0===k(e[O]))?.5:1)}),x.dotPositions[i]&&n(t,{children:[e("line",{x1:x.dotPositions[i].x,y1:0,x2:x.dotPositions[i].x,y2:M,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"}),e("circle",{cx:x.dotPositions[i].x,cy:x.dotPositions[i].y,r:5,fill:"white",stroke:r.color,strokeWidth:o,style:{transition:"cx 0.1s, cy 0.1s"}}),e("line",{x1:0,y1:x.dotPositions[i].y,x2:E,y2:x.dotPositions[i].y,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"})]})]},i):null;var a}),(()=>{if(1===D.length){const t=D?.[0];return e("text",{x:v?E/2:E,y:M+15,textAnchor:v?"middle":"end",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=t[Z]?String(t[Z]):""},String(t[Z]))}if(D.length<7)return D.map(t=>e("text",{x:z(t[Z]),y:M+15,textAnchor:"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=t[Z]?String(t[Z]):""},String(t[Z])));{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),a=D[i];return e("text",{x:r*t,y:M+15,fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=a?.[Z]?String(a?.[Z]):""},String(a?.[Z]))})}})(),(()=>{if("memory"===g){const t=Math.max(N,1024);return Array.from({length:6}).map((n,r)=>{const i=r*t/5,a=i/1024;return e("text",{x:-10,y:I(i),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:a.toFixed(1)},`y-${r}`)})}return Array.from({length:6}).map((t,n)=>{const r=n*N/5;return e("text",{x:-10,y:I(r),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:r.toFixed(0)},`y-${n}`)})})()]})}),L&&x.tooltip.visible&&n("div",{className:"ff-line-chart-tooltip",role:"tooltip","aria-live":"polite",style:{left:w&&x.tooltip.left/2>i/1.75?x.tooltip.left-180:x.tooltip.left,top:x.tooltip.top},children:[e("div",{className:"ff-line-chart-date",children:x.currentXValue}),Object.entries(x.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))]})]})]})},fL=({onClose:t,top:r="100px",left:i="0px",className:a,description:o="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("section",{className:`ff-download-client-wrapper ${a}`,role:"dialog","aria-label":"Download client",style:{top:r,left:i,zIndex:c},children:[n("header",{className:"ff-download-client-header-wrapper",children:[e("div",{className:"ff-download-client-hollow-triangle"}),e(U,{fontWeight:"semi-bold",lineHeight:"32px",className:"ff-download-client-header-text",id:"download-client-title",children:"Download client"}),e(q,{name:"close",color:"var(--brand-color)",className:"ff-download-client-close-icon",height:12,width:12,"aria-label":"Close download client"})]}),n("div",{className:"ff-download-client-content-text",role:"group","aria-labelledby":"download-client-title",children:[e(U,{as:"div",color:"var(--download-client-content-text-color)",fontWeight:"semi-bold",textAlign:"center",lineHeight:"26px",children:o}),e(U,{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",role:"group","aria-label":"Choose operating system",children:["windows","mac_icon","linux"]?.map(t=>e("button",{type:"button",className:"ff-os-version-wrapper",onClick:()=>{s("mac_icon"===t?"mac":t)},"aria-label":`Download for ${"mac_icon"===t?"macOS":t}`,children:e(q,{name:t,height:36,width:36})},t))})]})]})},hL=({legendName:t,height:r,width:i,children:a})=>e("div",{className:"ff_fieldSet_container",role:"group","aria-label":t||"Fieldset",children:n("fieldset",{className:"ff_fieldSet",style:{height:r,width:i},"aria-label":t||"Fieldset",children:[e("legend",{className:"ff_legend_container",children:e(U,{color:"var(--license_header_text_color)",fontSize:8,lineHeight:"12px",children:t})}),e("div",{className:"ff_children_container",role:"region","aria-label":`${t||"Fieldset"} content`,children:a})]})}),CL=({onSelectVariable:t,dropdownPosition:n,filteredOptions:r=[],position:i="relative",width:a="100%",zIndex:s,truncateTextValue:c=34,highlightedIndex:d})=>{const u=o(null);return l(()=>{u.current?.scrollIntoView({block:"nearest"})},[d]),e("section",{className:I(`ff-variable-dropdown-container ${i}`),style:n?{top:n.top+30,left:n.left-30,width:a,zIndex:s}:{width:a,zIndex:s},role:"listbox","aria-label":"Options dropdown",children:K(r)?e("div",{className:"ff-variable-option no-data",role:"status","aria-label":"No option",children:e(U,{as:"div",children:"No Option",fontSize:14})}):r?.map((n,r)=>e("div",{className:I("ff-variable-option",{"ff-variable-option--highlighted":d===r}),onMouseDown:()=>t(n),ref:d===r?u:null,role:"option","aria-selected":d===r,"aria-label":n?.name,children:e(Y,{title:xn(n?.name,c,"pixel")?n?.name:"",children:e(U,{children:Hn(n?.name,c,"pixel")})})},n?.id))})},pL=a(({label:t="",hashInputValue:r="",setHashInputValue:i,variableList:a=[],placeholder:s="Enter text",onChange:d,onPaste:u,onCreateVariableClick:f,handleClearInput:h,value:C="",dropdownWidth:p="100%",dropdownHeight:m="160px",isHash:A=!1,isOnlyHash:g=!1,dataFiles:v=[],showAddVariableIcon:y=!0,helperText:w="",error:E,autoComplete:M="off",required:L=!1,zIndex:H=9999,truncateTextValue:x=34,formProps:V={},getSelectedVariable:k=()=>{},symbol:S="$",type:Z="text",clearIcon:O=!0,inputTitle:z="",onBlur:N,helperTextWidth:T,iconProps:D={isShowIcon:!1,iconName:"",iconToolTipTitle:"",isIconDisable:!1,iconColor:"",onIconClick:()=>{}},isCapitalize:F=!1,...R},P)=>{const[B,j]=c(!1),[_,W]=c(!1),[X,Q]=c(0),[G,J]=c(!1),[$,ee]=c(null),[te,ne]=c(0),[re,ie]=c(!1),[ae,oe]=c([]),[le,se]=c(!1),ce=o(null),de=o(null),[ue,fe]=c("auto"),he=D?.isShowIcon;l(()=>{const e=de.current?.querySelector(".ff-input-container");if(!e)return;const t=new ResizeObserver(e=>{for(let t of e){const e=`${t.contentRect.width}px`;fe(e)}});return t.observe(e),()=>{t.disconnect()}},[]),b(P,()=>ce.current),l(()=>{null!==$&&ce.current&&(ce.current.setSelectionRange($,$),ce.current.focus())},[$]),l(()=>{A&&j(C.startsWith("#"));const e=v?.find(e=>e.name===C),t=a?.find(e=>e?.name===C);if(C.startsWith("#")&&A){const e=C.slice(1).toLowerCase(),t=v.filter(t=>t.name.toLowerCase().includes(e));oe(t),j(!0)}const n=null!==e&&C.startsWith("#"),r=null!==t&&C.startsWith("$"),i=C.length>(t?.name.length||0),o=C.length>0&&!r||C.startsWith("#");g?ie(!1):r||n||C.includes("$")||C.includes("#")?(ie(!1),o&&ie(!0)):i&&!C.includes("$")&&ie(!0)},[C]);const Ce=()=>{ce.current&&ne(ce.current.selectionStart||0)},pe=Ce,me=Ce;l(()=>{ce.current&&ne(ce.current.selectionStart||0)},[C]);const Ae=e=>{if(ce.current){const{selectionStart:t,selectionEnd:n}=ce.current,r=`${e.name}`;let a;if(a=A&&"#"===C[0]?e.name+C.slice(n||1):e.name,d){d({target:{value:a}},e),k(e.name)}ce.current.value=a,i?.(e),ee((t||0)+r.length),j(!1),W(!0)}};const ge=function(e,t,n){let r=!1,i="";const a="}"===C[t-1];if(t<0||t>e.length)return{showDropdown:r,searchString:i};const o=e.lastIndexOf(S,t-1),l=e.indexOf(S,t);if(-1!==o&&(g&&"$"===e[o]?r=!1:t===o+1?(r=!0,i=""):(i=e.slice(o+1,-1===l?void 0:l),t>o+1&&(i=e.slice(o+1,t)),r=!0),_&&a&&(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}}(C,te,a),ve=C.startsWith("#"),ye=ve?ae:a?.filter(e=>e?.name?.toLowerCase()?.includes(ge?.searchString?.toLowerCase()));l(()=>{Q(0)},[A,ge?.showDropdown]);const we=Boolean(ge?.showDropdown&&G),be=Boolean(B&&A&&G),Ee=Boolean((ve?be:we)&&ye.length),Me=Boolean(ve?be:we);l(()=>{if(!Me)return void se(!1);const e=()=>{if(!de.current)return;const e=de.current.getBoundingClientRect(),t=window.innerHeight-e.bottom,n=e.top,r=Math.max(ye.length,1),i=r<4?40*r+10:parseInt(m,10)||160;se(t<i+10&&n>t)};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[Me,m,ye.length]);return n("section",{className:I("ff-add-variable-container",{"ff-dropdown-flip":le}),"aria-label":t||"Variable suggestion input dropdown",children:[n("div",{className:"ff-add-variable-input",ref:de,"aria-label":"Variable input controls",children:[e(Y,{title:z,style:{width:"100%"},children:e(Vi,{...R,name:"add_variable",ref:ce,type:Z,className:I("ff-variable-input-container",{"ff-variable-input-container--show-icon":he}),value:C,onKeyDown:e=>{switch(e.key){case"ArrowDown":if(!Ee)return;e.preventDefault(),e.stopPropagation(),Q(e=>e<ye.length-1?e+1:e);break;case"ArrowUp":if(!Ee)return;e.preventDefault(),e.stopPropagation(),Q(e=>e>0?e-1:0);break;case"Enter":{if(!Ee)return;e.preventDefault(),e.stopPropagation();const t=ye[X];t&&Ae(t);break}case"Escape":if(!Ee)return;e.preventDefault(),e.stopPropagation(),j(!1),J(!1),Q(0)}},onChange:d,onPaste:()=>{ie(!0)},variant:"primary",label:t,placeholder:s,onClick:pe,onKeyUp:me,onFocus:()=>J(!0),onBlur:e=>{(e=>{e.relatedTarget&&e.relatedTarget.closest(".dropdown-container")||J(!1)})(e),N?.(e)},autoComplete:M,helperText:w,error:E,required:L,helperTextWidth:T,isCapitalize:F,...V})}),!E&&!K(C)&&re&&y&&e("div",{className:"ff-create-variable-container",onClick:f,role:"button","aria-label":"Create variable",children:e(U,{fontWeight:"regular",fontSize:"10px",color:"var(--brand-color)",cursor:"pointer",children:"Create Variable"})}),!K(C)&&!g&&e("div",{className:I("ff-cancel-icon-container",{"ff-cancel-icon-container--show-icon":he}),"aria-label":"Clear input container",children:O&&e(Y,{title:"Cancel",style:{zIndex:99999},children:e(q,{onClick:h,name:"close",height:16,width:16,hoverEffect:!0,"aria-label":"Clear input"})})}),he&&e("div",{className:"ff-info-icon-container","aria-label":"Info icon container",children:e(Y,{title:he&&!D?.isIconDisable?D?.iconToolTipTitle:"",children:e(q,{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","aria-label":D?.iconToolTipTitle||"Info action"})})})]}),ge?.showDropdown&&G&&e(dL,{position:"absolute",zIndex:H,truncateTextValue:x,width:ue,height:0===ye.length?"auto":m,optionsList:ye,onSelectVariable:Ae,highlightedIndex:X},ge?.searchString||""),B&&A&&G&&e(CL,{position:"relative",zIndex:H,truncateTextValue:x,width:ue,filteredOptions:ye,onSelectVariable:Ae,highlightedIndex:X})]})}),mL=({isOpen:t,variableTypesList:r=[],onClose:i,onNameChange:a,onValueChange:o,variableName:s,variableValue:d,onVariableTypeChange:u,selectedVariableType:f,hideValue:h=!1,onHideChange:C,handleSubmit:p,mode:m="create",disabled:A,dataFiles:g=[],truncateTextValue:v=34,isEnterKeySubmit:y=!1,showHideValueOption:w=!0})=>{const[b,E]=c(!1),[M,L]=c(""),[H,x]=c(),[V,k]=c(!1),[S,Z]=c(!1),[O,z]=c({name:"",value:"",isChecked:!1});l(()=>{t&&"edit"===m&&z({name:s,value:d,isChecked:h})},[]);const N=e=>e&&0!==e.length?" "===e[0]||" "===e[e.length-1]?"Space is not allowed at starting and at the end":qn.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 I(e){const t=!!e,n=qn.test(e),r=$r.test(e),i=e.length>=3&&e.length<=25;return t&&n&&r&&i}l(()=>{const e=N(s);E(!!e),L(e)},[s]),l(()=>{if("edit"!==m)return;const{name:e,value:t,isChecked:n}=O;Z(s!==e||d!==t||h!==n)},[m,s,d,h,O]);const T=()=>{!V&&I(s)&&(k(!0),p())};l(()=>{if(!y)return;const e=e=>{if("Enter"===e.key){e.preventDefault();!I(s)||V||"edit"===m&&!S||T()}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[y,s,d,h,V,m,S,f]);return e(vn,{zIndex:1350,onClose:i,isOpen:t,title:"create"===m?"Create Variable":"Edit Variable",width:"284px",height:w?"280px":"250px",top:"30%",right:8,isFooterRequired:!0,overlay:!0,footerContent:e(()=>n("div",{className:"ff-create-slider-footer",role:"group","aria-label":"Form actions",children:[e(W,{onClick:i,label:"Cancel",variant:"tertiary"}),e(W,{variant:"primary",label:"create"===m?"Create":"Update",type:"submit",onClick:T,disabled:!I(s)||V||"edit"===m&&!S})]}),{}),children:n("div",{className:"ff-create-variable-slider",role:"form","aria-label":"Create or edit variable form",children:[e("div",{className:"ff-create-variable-slider-input",role:"group","aria-label":"Variable name input",children:e(Vi,{label:"Variable Name",required:!0,type:"text",name:"variableName",value:s||"",onChange:e=>{k(!1),a(e.target.value)},error:b,helperText:M,onBlur:e=>{const t=e.target.value,n=N(t);E(!!n),L(n)}})}),e("div",{role:"group","aria-label":"Variable type selection",children:e(Za,{label:"Variable Type",required:!0,onChange:e=>{u(e),k(!1)},selectedOption:f,optionsList:r,optionZIndex:99999,valueAccessor:"label",disabled:"edit"===m})}),e("div",{role:"group","aria-label":"Variable value input",children:e(pL,{label:"Variable Value",placeholder:"Enter Variable value or select path using #",isHash:!0,isOnlyHash:!0,zIndex:99999,truncateTextValue:v,dataFiles:g,dropdownWidth:"100%",setHashInputValue:x,hashInputValue:H||{},value:d||"",type:h?"password":"text",onChange:(e,t)=>{const n=e.target.value;o(n,t)},showAddVariableIcon:!1})}),w&&n("div",{className:"ff-hide-value-content",role:"group","aria-label":"Hide value option",children:[e(En,{onChange:e=>C(e.target.checked),name:"hideValue",label:"Hide Value",checked:h,disabled:A}),e(Y,{title:"Once the value is hidden, it cannot be undone",children:e(q,{name:"info",width:12,height:12})})]})]})})},AL=e=>{if(null==e||""===e)return{};return{width:e,flex:`0 0 ${"number"==typeof e?`${e}px`:e}`}},gL=({highlightText:t="",tableMeta:r=[],tableData:i=[],accordionType:a="row",noDataContent:o,height:l="100%",withFixedHeader:s=!1,headerType:d,TableAccordionStateIconWidth:u=4,TableAccordionStateIconHeight:f=8})=>{const[h,C]=c(-1),p="number"==typeof r[0]?.width?Math.max(r[0]?.width-8,0):void 0,m=(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:"--"},A=t=>t.map((t,n)=>e("table",{className:"ff-table-accordion__table",cellSpacing:0,children:e("tbody",{className:"ff-table-accordion__tbody",children:e("tr",{className:"ff-table-accordion__body-row",children:r.map((n,r)=>e("td",{className:"ff-table-accordion__body-cell",style:AL(n.width),children:"column"===a&&0===r?"":e(U,{as:"div",className:"ff-table-accordion__cell-typography",children:n.cell?m(t,n):e(Qs,{placement:"bottom",children:m(t,n)})})},n.accessor+r))},t.id||n)})},`accordion-table-${n}`));return n("section",{style:{height:l},className:I("ff-table-accordion",{"ff-table-accordion--fixed-header":s}),"aria-label":"Table with accordion",children:[e("table",{cellSpacing:0,className:I("ff-table-accordion__table",{"ff-table-accordion__table--fixed-header":s}),"aria-label":"Accordion table header",children:e("thead",{"aria-label":"Table header",children:e("tr",{className:"ff-table-accordion__header-row",children:r.map(t=>e("th",{style:AL(t.width),className:I("ff-table-accordion__header-cell",d&&`ff-table-accordion__header-cell--${d}`),"aria-label":t.header,children:e("div",{"aria-label":"Header label",children:e(U,{fontWeight:"semi-bold",fontSize:12,children:t.header})})},`header-${t.header}`))})})}),"row"===a&&i.map((n,r)=>e(wn,{highlightText:t,headerTitle:"string"==typeof n.title?e("div",{style:{maxWidth:void 0!==p?`${p}px`:"100%"},children:e(Qs,{children:e(yn,{text:n.title,highlight:t})})}):e(Qs,{children:"row.title"}),color:"var(--text-color)",accordionContent:A(n.data),disable:n.disable,disableInfoMessage:n.disableInfoMessage,accordionStateIconName:"arrows_down_icon",AccordionStateIconWidth:u,AccordionStateIconHeight:f,className:"ff-table-accordion__row-accordion"},`accordion-row-${r}`)),"column"===a&&i.map((i,a)=>n("article",{className:"ff-table-accordion__column-group","aria-label":`${"string"==typeof i.title?i.title:"Accordion row"} group`,children:[e("div",{className:"ff-display-flex",children:n("div",{className:`ff-table-accordion__column-header ${i.disable&&"ff-table-accordion__column-header--disabled"}`,style:r[0]?AL(r[0].width):{},"aria-label":"Accordion column header",children:[e("div",{className:"ff-table-accordion__column-label",children:e(U,{as:"div",children:e(Qs,{children:e(yn,{text:"string"==typeof i.title?i.title:"",highlight:t})})})}),e("div",{className:"ff-table-accordion__column-toggle",onClick:()=>{!i.disable&&(e=>{C(e===h?-1:e)})(a)},"aria-label":`${"string"==typeof i.title?i.title:"Row"} toggle`,"aria-expanded":h===a,"aria-disabled":i.disable,children:e(q,{name:h===a?"arrows_down_icon":"arrows_right_icon",color:"var(--table-with-accordion-icon-color)",width:u,height:f,hoverEffect:!1,"aria-label":h===a?"Collapse row":"Expand row"})})]})}),h===a&&e("section",{"aria-label":"Accordion content",children:A(i.data)})]},`column-accordion-${a}`)),K(i)&&e("div",{className:"ff-table-accordion__empty-state",style:{height:`calc(${l} - 50px)`},"aria-label":"No data available",children:o})]})},vL=({progressPercentage:t,totalMemory:r,usedMemory:i,color:a="var(--brand-color)",trackColor:o="#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:C="200px"})=>{const p=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,A=s;if(void 0!==r&&void 0!==i){const e=p(i),t=p(r);t>0?(m=e/t*100,A=s||i):(m=0,A="0MB")}else m=t||0;const g=Math.max(0,Math.min(m,100));return n("section",{className:"ff-progress-bar-container "+(A?"ff-has-label":""),style:{width:C},"aria-label":"Progress bar container",children:[e("div",{className:"ff-progress-bar-track",style:{backgroundColor:o,height:`${l}px`},"aria-label":A?`${A} progress`:"Progress",children:e("div",{className:"ff-progress-bar",style:{width:`${g}%`,backgroundColor:a,height:`${l}px`},children:u&&e(U,{className:"ff-progress-bar-percentage",fontSize:f,color:h,children:`${Math.round(g)}%`})})}),A&&e("div",{className:"ff-progress-bar-label","aria-label":"Progress label",children:e(U,{fontSize:c,color:d,children:e(Y,{title:xn(A,10,"count")?A:"",children:Hn(A,10,"count")})})})]})},yL=({variant:t="primary",size:n="small",onClick:r,label:i="Choose File",disabled:a=!1,type:l="button",className:s="",style:d={},iconName:f,isChooseFile:h=!1,buttonWidth:C="auto",buttonHeight:p="auto",selectedFile:m={},handleCloseIcon:A,isMandatory:g=!1})=>{const v=o(null),[y,w]=c(0);u(()=>{v.current&&w(v.current.getBoundingClientRect().width-10)},[C]);const b=m?.name||i,E=y?Hn(b,y,"pixel"):b,M=!!y&&xn(b,y,"pixel"),L=m?.name?`Choose file, selected ${m.name}`:`Choose file, ${i}`;return e("div",{ref:v,style:{width:C},role:"group","aria-label":L,children:e(Y,{title:M?b:"",children:e(W,{variant:t,label:E,type:l,onClick:r,buttonWidth:C,buttonHeight:p,isChooseFile:h,size:n,disabled:a,className:s,iconName:f,style:d,iconPosition:"right",selectedFile:m,handleCloseIcon:A,isMandatory:g})})})},wL=({selected:t="text",handleClick:r,tabList:i})=>{const a=i?.includes("Automation"),o=i?.includes("Manual"),l=a?"Automation":"Add Automation",s=o?"Manual":"Add Manual";return n("div",{className:"ff-script-switch-container","aria-label":"Script switch options",children:[e(Y,{title:l,zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Automation"===t?"active":""),onClick:()=>r(l),"aria-label":l,"aria-pressed":"Automation"===t,children:e(q,{name:a?"automation_testcase":"add_testcase",color:"Automation"===t?"var(--primary-button-text-color)":"var(--description-text)","aria-label":l})})}),e(Y,{title:o?"Manual":"Add Manual",zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Manual"===t?"active":""),onClick:()=>r(s),"aria-label":s,"aria-pressed":"Manual"===t,children:e(q,{name:o?"manual_testcase":"add_testcase",color:"Manual"===t?"var(--primary-button-text-color)":"var(--description-text)","aria-label":s})})})]})},bL=({selected:t,handleClick:n,tabList:r})=>e("section",{className:"ff-switch-container","aria-label":"Switch button group",children:r.map(r=>e(Y,{title:t===r.name?null:r.tooltip,zIndex:1e3,children:e("div",{className:"ff-switch-button "+(t===r.name?"active":""),onClick:()=>n(r.name),"aria-label":r.name,"aria-pressed":t===r.name,children:e(q,{name:r.icon,color:t===r.name?"var(--primary-button-text-color)":"var(--description-text)","aria-label":`${r.name} icon`})})},r.name))}),EL=({onModalClose:t,MediaSrc:r,fileName:a,onDeleteClick:o,mediaType:s,fileId:d,thumbnailMediaSrc:u,isDelete:f=!0,onExpandClick:h,onDownloadClick:C,isMediaIcon:p=!1,previewOnly:m=!1,iconName:A="video_preview",isDisabled:g=!1})=>{const[v,y]=c(!1),w=i.useRef(null),b=()=>{y(!0),h&&h(d)},E=()=>{t?.(),y(!1)},M=()=>{C&&C(d)};return l(()=>{m&&y(!0)},[m]),n("section",{"aria-label":"Media preview",role:"region",children:[!m&&(p?e(q,{name:A,hoverEffect:!0,onClick:b,disabled:g,"aria-label":"Open media preview"}):e(mw,{mediaSrc:r,mediaType:s,onDownloadClick:M,onDeleteClick:()=>o?.(r),onExpandClick:b,fileName:a,fileId:d,thumbnailMediaSrc:u,isDelete:f})),v&&e(Ip,{isOpen:v,onClose:E,isFooterDisplayed:!1,isHeaderDisplayed:!1,customWidth:"1130px",customHeight:"570px",zIndex:1e4,children:n("div",{className:"media-wrapper","aria-label":"Media preview modal",children:[n("div",{className:"ff-expand-icons","aria-label":"Media preview actions",children:[e(Y,{title:"Download File",children:e(q,{name:"download_file_icon",onClick:M,color:"var(--icons-default-color)",className:"header-icons","aria-label":"Download media file"})}),e(Y,{title:"Expand",children:e(q,{name:"expand",onClick:b,color:"var(--icons-default-color)",className:"header-icons","aria-label":"Expand media preview"})}),e(Y,{title:"close",children:e(q,{name:"close",onClick:E,color:"var(--icons-default-color)",className:"header-icons","aria-label":"Close media preview"})})]}),"image"===s&&e("img",{src:r,alt:a||"Media preview image",height:"auto"}),"video"===s&&e("video",{src:r,controls:!0,controlsList:"nodownload",className:"ff-video-preview",ref:w,onCanPlay:()=>{if(w.current){const e=w.current.play();void 0!==e&&e.catch(e=>{console.error("Autoplay failed:",e)})}}})]})})]})},ML=({children:t,orientation:r="",navBarIcons:a=[],mobileHeight:o=448,mobileWidth:l=220,UtilityBar:s,tooltip:c={},background:d,navBarPosition:u="bottom"})=>{const f="portrait"===r,h=f?o:l,C=f?l:o,p=s&&"top"===u,m=s&&"bottom"===u,A=s&&"left"===u;return n("section",{className:["ff-mobileskin-wrapper",f?"portrait":"landscape",A?"ff-side-nav-left":"",p?"navbar-top":"",m?"navbar-bottom":""].filter(Boolean).join(" "),"aria-label":"Mobile preview",children:[p&&e("nav",{className:"ff-nav-bar top-nav-bar","aria-label":"Top navigation bar",children:a.map(({title:t,name:n,className:r,...i},o)=>{const l=c?.[n]??o;return e(Y,{title:c?.[n]||"",placement:"top",children:e("div",{className:`ff-nav-bar-icon ${r||""} ${o===a.length-1?"last-icon":""} ${p?"navbar-top":""}`,"aria-label":t||n||"Navigation icon",children:e(q,{name:n,...i})})},l)})}),e("main",{className:"ff-mobileskin-container",style:{height:h+16,width:C+16},"aria-label":"Mobile device frame",children:e("div",{className:"ff-mobile-container",style:{width:C,height:h,background:d||"transparent"},children:e("div",{className:"ff-mobile-image-container","aria-label":"Mobile screen content",children:i.isValidElement(t)?t:e("img",{src:t,alt:"Mobile content",style:{width:f?"100%":2.1*l+"px",height:f?"100%":.5*o+"px"}})})})}),s&&m&&e("nav",{className:"ff-nav-bar","aria-label":"Bottom navigation bar",children:a?.map((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-nav-bar-icon ${t?.className||""} ${n===a.length-1?"last-icon":""}`,"aria-label":r||i?.name||"Navigation icon",children:e(Y,{title:r,children:e(q,{...i})})},n)})}),s&&A&&e("aside",{className:"ff-side-nav-bar","aria-label":"Side navigation bar",children:a?.map((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-sidebar ${t?.className||""} ${n===a.length-1?"last-icon":""}`,"aria-label":r||i?.name||"Navigation icon",children:e(Y,{title:r,placement:"bottom",children:e(q,{...i})})},n)})})]})},LL=a(({width:t=300,height:r=40,iconHeight:i=16,iconWidth:a=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:C="send",submitPrompt:p,onPromptChange:m,onBlur:A,onFocus:g,disableInput:v,isAdditionalIcon:y=!1,additionalIconName:w,additionIconToolTip:b,onAdditionalIconClick:E},M)=>{const L=o(null);Zn([{key:"Enter",action:()=>H()}],L);const H=e=>{f&&p?.(f.trim())};return n("section",{className:I("ff-prompt-container",{"icon-left":"left"===c,"icon-right":"left"!==c}),style:{width:`${t}px`,height:`${r}px`,borderRadius:d},ref:L,"aria-label":"Prompt input container",children:[e(Y,{placement:"top",title:C,children:e(q,{name:s,className:"ff-prompt-icon",height:i,width:a,onClick:p,color:h,disabled:K(f),"aria-label":C||"Send prompt"})}),e("input",{ref:M,className:"ff-prompt-input",type:"text",placeholder:l,autoFocus:u,onChange:m,onFocus:g,onBlur:A,value:f,readOnly:v,"aria-label":l||"Prompt input"}),y&&w&&e(Y,{placement:"top",title:b,children:e(q,{name:w,className:"ff-prompt-icon additional-icon",height:i,width:a,onClick:E,"aria-label":b||"Additional action"})})]})}),HL=({content:t,isVisible:n,maxWidth:r=300,onClick:i,isClickable:a=!0,arrowPosition:o="left"})=>e("section",{onClick:i,style:{width:`${r}px`,"--triangle-position":r-4+"px"},className:I("ff-chat-msg-box",{visible:n,hidden:!n,pointer:a,default:!a,"chat-arrow-left":"left"===o,"chat-arrow-right":"left"!==o}),role:"note","aria-label":"Message box",children:e("div",{className:I("content",`arrow-${o}`),"aria-label":"Message content",children:e(U,{children:t})})}),xL=({iconName:r,iconPosition:{top:i,left:a,bottom:o,right:l},hoverIconPosition:{top:s,left:d,bottom:u,right:f},modalPosition:{top:h,left:C,bottom:p,right:m},modalWidth:A,modalHeight:g,headerContent:v="Header Content",footerContent:y="Footer Content",iconWidth:w,iconHeight:b,modalHeading:E="Ask Fia",children:M,onClearChat:H})=>{const[x,V]=c(!1),[k,S]=c(!1),Z=`${E} chat window`;return n(t,{children:[n("div",{style:{top:void 0!==i?`${i}px`:void 0,left:void 0!==a?`${a}px`:void 0,bottom:void 0!==o?`${o}px`:void 0,right:void 0!==l?`${l}px`:void 0},className:"ff-dynamic-icon-container",children:[e(q,{className:"ff-dynamic-icon",name:r,onClick:()=>{S(e=>!e),setTimeout(()=>V(e=>!e),10)},height:b,width:w,"aria-label":"Open chat modal"}),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(q,{name:"ask_fia_icon",height:32,width:82})})]}),k&&L(e("div",{className:I("ff-dynamic-modal",{open:x}),role:"dialog","aria-modal":"true","aria-label":Z,style:{top:void 0!==h?`${h}px`:void 0,left:void 0!==C?`${C}px`:void 0,bottom:void 0!==p?`${p}px`:void 0,right:void 0!==m?`${m}px`:void 0,position:"fixed",height:g,width:A},children:n("div",{className:"ff-dynamic-modal-content",children:[v&&e("header",{className:"ff-dynamic-modal-header",children:n("div",{className:"header-container",children:[n("div",{className:"header-left",children:[e(q,{height:16,width:16,name:"fia_icon"}),e(U,{fontWeight:"medium",children:E})]}),n("div",{className:"header-right",children:[e("span",{className:"action",children:e(Y,{title:"Clear chat",placement:"bottom",children:e(q,{height:16,width:16,name:"delete",color:"var(--tooltip-text-color)",onClick:H,"aria-label":"Clear chat"})})}),e("span",{className:"action",children:e(Y,{title:"Close",placement:"bottom",children:e(q,{height:16,width:16,name:"close",color:"var(--tooltip-text-color)",onClick:()=>(V(!1),void setTimeout(()=>S(!1),300)),"aria-label":"Close chat modal"})})})]})]})}),e("div",{className:"ff-dynamic-modal-body",children:M}),y&&e("footer",{className:"ff-dynamic-modal-footer",children:y})]})}),document.body)]})},VL=a(({iconName:r,hoverTitle:i,iconPosition:{top:a,left:o,bottom:l,right:s},hoverIconPosition:{top:c,left:d,bottom:u,right:f},modalPosition:{top:h,left:C,bottom:p,right:m},modalWidth:A,modalHeight:g,headerContent:v="Header Content",footerContent:y="Footer Content",iconWidth:w,iconHeight:E,children:M,isVisible:H,isOpen:x,onOpen:V,onClose:k,isIconVisible:S},Z)=>{b(Z,()=>({closeModal:k}));const O=i?`${i} chat window`:"AI chat window";return n(t,{children:[S&&n("div",{style:{top:void 0!==a?`${a}px`:void 0,left:void 0!==o?`${o}px`:void 0,bottom:void 0!==l?`${l}px`:void 0,right:void 0!==s?`${s}px`:void 0},className:"ff-ai-dynamic-icon-container",children:[e(q,{className:"ff-ai-dynamic-icon",name:r,onClick:V,height:E,width:w,"aria-label":"Open AI chat modal"}),e("div",{style:{top:void 0!==c?`${c}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-ai-chat-icon-hover",children:e("div",{className:"ai-hover-leaf",children:e(U,{fontWeight:"bold",fontSize:14,color:"var(--chatbot-leaf-text)",children:i})})})]}),H&&L(e("div",{className:I("ff-ai-dynamic-modal",{open:x}),role:"dialog","aria-modal":"true","aria-label":O,style:{top:void 0!==h?`${h}px`:void 0,left:void 0!==C?`${C}px`:void 0,bottom:void 0!==p?`${p}px`:void 0,right:void 0!==m?`${m}px`:void 0,position:"fixed",height:g,width:A},children:n("div",{className:"ff-ai-dynamic-modal-content",children:[v&&e("header",{className:"ff-ai-dynamic-modal-header",children:v}),e("div",{className:"ff-ai-dynamic-modal-body",children:M}),y&&e("footer",{className:"ff-ai-dynamic-modal-footer",children:y})]})}),document.body)]})}),kL=({variant:t,title:r,tabTitle:i,comment:a,profileShortName:o})=>n("article",{className:"ff-history-card","aria-label":`History card for ${i}`,children:[e("header",{className:I("header",`header--${t}`),children:e(U,{fontWeight:"semi-bold",children:i})}),n("div",{className:"body",children:[e("section",{className:"title","aria-label":"History card title",children:n("div",{className:"profile",children:[e(U,{className:I("avatar",`avatar--${t}`),children:o}),e(U,{children:r})]})}),n("section",{className:"comment-container","aria-label":"History card comments",children:[e(U,{fontWeight:"semi-bold",className:"heading",children:"Comments:"}),e(U,{color:"var(--details-page-value-color)",className:"comment",children:a})]})]})]}),SL=({onChange:t,disabled:r,checked:i=!1,id:a="toggle",path:o})=>{const l=`ff-toggle-${a}`;return n("div",{className:"ff--ai-switch-container",role:"group","aria-label":r?"AI toggle disabled":i?"AI toggle on":"AI toggle off",children:[e("input",{className:"ff--ai-switch-checkbox",id:l,type:"checkbox",disabled:!!r,onChange:e=>{t&&t(e)},checked:i,"aria-label":"AI toggle","aria-checked":i}),e("label",{className:I("ff--ai-switch-label",{"ff--ai-switch-label--disabled":r}),htmlFor:l,children:e("span",{className:"ff--ai-switch-content",children:n("span",{className:"ff--ai-switch-content",children:[e(U,{className:I("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:o,alt:"AI image"})]})})})]})},ZL=a(({name:t,height:n=30,width:r=30,path:i="",onClick:a,color:s="var(--brand-color)",hoverEffect:c=!1,className:d="",disabled:u=!1,variant:f="light",isSelected:h=!1,x:C,y:p,tabIndex:m=-1,...A},g)=>{if(!_[t])return null;const v=o(null);l(()=>{v.current&&(void 0!==C&&v.current.setAttribute("x",String(C)),void 0!==p&&v.current.setAttribute("y",String(p)))},[C,p]);const y="function"==typeof a&&!u,w={ref:g,onClick:u?void 0:a,style:{height:`${n}px`,width:`${r}px`,cursor:u?"not-allowed":"pointer",opacity:u?.3:1},role:y?"button":void 0,"aria-label":t?`Animated setting ${t}`:"Animated setting","aria-disabled":!(!u&&y)||void 0,...A};return e("span",{...w,children:e("img",{height:n,width:r,src:i,alt:"","aria-hidden":"true"})})}),OL=({id:r=0,serialNumber:i,activeId:a,setActiveId:s,children:d,onIconClick:u,numberChildren:f,onContainerClick:h,onNextClick:C,onPreviousClick:p,disabled:m,isEditAccess:A,versionsLength:g,count:v,hiddenActions:y=[]})=>{const[w,b]=c(!1),[E,M]=c(!1),L=o(null),H=Array.isArray(y)?y:y?[y]:[],x=(e,t)=>{e.stopPropagation(),t()};l(()=>{L.current&&(()=>{if(L.current){const e=getComputedStyle(L.current),t=1.2*parseFloat(e.fontSize)*6;L.current.scrollHeight>t&&M(!0)}})()},[]);const V=e=>{e.stopPropagation(),b(!w)};return n("section",{className:`ff-prompt-container-Block ${a===r?"active":"inactive"} `,onClick:()=>{s(r),h()},"aria-label":`Prompt container ${i}`,children:[e(U,{fontSize:8,className:"ff-prompt-number-bg-color",as:"span",children:`Test cases ${i}`}),n(t,{children:[n("article",{className:"ff-prompt-content "+(w?"expanded":""),ref:L,"aria-label":"Prompt content",children:[d,w&&n(t,{children:[e("span",{role:"button","aria-label":"Collapse content",onClick:V,className:"read-less-btn",children:e(U,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read Less"})})," "]})]}),E&&!w&&e("div",{role:"button","aria-label":"Expand content",onClick:V,className:"read-more-btn",children:e(U,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read More"})})]}),n("footer",{className:"ff-prompt-icons","aria-label":"Prompt actions",children:[e("div",{className:"ff-prompt-icons-leftside","aria-label":"Prompt action icons",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=>!H.includes(e.action)).map((t,n)=>{const r=A&&"delete"===t?.action||"regenerate"===t?.action&&(g??0)>=3||m;return e(Y,{title:t.title,placement:"bottom",children:e(q,{disabled:r,name:t.action,color:t.color,hoverEffect:!0,onClick:e=>((e,t)=>{e.stopPropagation(),u(t)})(e,t.action),"aria-label":t.title})},`${t?.title}-${n}`)})}),n("nav",{className:"ff-prompt-icons-rightside","aria-label":"Prompt navigation",children:[e(q,{disabled:1===v,className:"ff-prompt-icons-style",name:"arrow_left_accordian",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>x(e,p),cursorType:"pointer","aria-label":"Previous"}),f,e(q,{disabled:v===g,className:"ff-prompt-icons-style",name:"arrow_right_icon",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>x(e,C),cursorType:"pointer","aria-label":"Next"})]})]})]})},zL=a(({type:t="text",variant:r="primary",name:i="",label:a,disabled:o=!1,disableLinkIcon:l=!1,required:s=!1,placeholder:c="Attach Link",value:d,error:u,helperText:f,noBorder:h,className:C="",onChange:p,onBlur:m,onFocus:A,autoComplete:g="off",autoFocus:v=!1,minValue:y=-1/0,maxValue:w=1/0,transparentBackground:b=!1,size:E="small",isLabelRequired:M=!0,onClick:L,onKeyUp:H,isViewMode:x=!1,...V},k)=>{const S=!K(d);return n("fieldset",{className:I("ff-link-input-fieldset",{"ff-link-input-fieldset--disabled":o}),"aria-label":a||i||"Link input",children:[n("div",{className:I("ff-link-input-container",{"ff-link-input-container--float":S,"ff-link-input-container--disabled":!!o}),children:[M&&n("label",{className:I(`ff-link-input-label-container ff-link-input-label-container--${E}`,{"ff-link-input-label-container--danger":!!u}),htmlFor:i,children:[s&&e("span",{className:"required-asterisk",children:"*"}),e("span",{className:I(`ff-link-input-label ff-link-input-label--${r}`,{"ff-link-input-label--no-hover":!!d,"ff-link-input-label--disabled":!!o,"ff-link-input-label--danger":!!u}),children:a})]}),e("input",{ref:k,name:i,value:d,type:t,spellCheck:!1,id:i,className:I(`ff-link-input ff-link-input-${r} default-input ff-link-input--${E}`,{"ff-link-input--transparentBackground":!!b,"ff-link-input--no-hover":!!d,"ff-link-input--disabled":!!o,"ff-link-input--danger":!!u,"ff-link-input--no-border":!!h,"ff-link-input--placeholder":!M},`${C}`),placeholder:c,disabled:x||o,onChange:p,onFocus:A,onBlur:m,autoComplete:g,autoFocus:v,min:y,max:w,onClick:L,onKeyUp:H,"aria-label":a||i||"Link input",...V}),e("div",{className:"input-link-icon","aria-label":"Link action",children:l||u||!S?e(q,{name:"link",disabled:!0,"aria-label":"Link icon"}):e(Y,{title:"Click here to navigate",children:e("span",{"aria-label":"Open link in new tab",children:e(q,{name:"link",disabled:!1,onClick:()=>{d&&!u&&window.open(d,"_blank")},"aria-label":"Open link"})})})})]}),f&&u&&e("span",{className:I("ff-link-input-message",{"ff-link-input-message--danger":!!u}),children:f})]})}),NL=({labelsList:r=[],height:i=""})=>{const a=Ai(),o=r[0]||"Chip",l=r.length>1?`plus ${r.length-1} additional labels`:"No additional labels",s=e("div",{className:"ff-chip-tooltip",children:r.filter((e,t)=>t>0).map((t,n)=>e(U,{as:"div",className:"ff-chip-tooltip-label",children:t},`label-${n}-${t}`))});return e(t,{children:!K(r)&&n("div",{className:"ff-chip-with-count-container",role:"group","aria-label":`${o} with count`,children:[e(U,{as:"div",fontWeight:"medium",className:"ff-chip-label",style:i?{height:i}:void 0,children:e(Qs,{children:r[0]||""})}),r.length>1&&n(t,{children:[n(U,{as:"div",className:"ff-chip-count","data-tooltip-id":`tooltip-${a}`,fontWeight:"medium",role:"status","aria-label":l,children:["+",r.length-1]}),e("div",{id:`tooltip-${a}`,className:"ff-chip-tooltip-template",children:e(U,{as:"div",children:s})})]})]})})};class IL 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 TL=({iconName:t="",onButtonClick:r,buttonLabel:i="Label",buttonText:a="To Add Group",disableButton:o=!1,stepCount:l=1,iconWidth:s=120,iconHeight:c=120,addContentLabel:d="step"})=>{const u=`${d}${l}: ${i} ${a}`.trim();return n("section",{className:"add-content-button "+(o?"disabled":""),"aria-label":u,children:[!K(t)&&e("div",{className:"icon-container",children:e(q,{name:t,width:s,height:c})}),n("div",{className:"typography-label-button",children:[n(U,{fontSize:"12px",fontWeight:"regular",lineHeight:"18px",children:[d+l," :"]}),e(U,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:"Click"}),e(Np,{label:i,onClick:r,iconName:"plus_user_icon",isDisable:o}),e(U,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:a})]})]})},DL=({variant:t="default",tabsData:r,activeTabId:i,onTabClick:a,noBorder:o=!1,noPadding:l=!1,titleSize:s="12px"})=>{const[d,u]=c(0),f=r.find(e=>e.id===i);return n("section",{className:"ff-tabs-slider-container","aria-label":"Tabs with slider",children:[n("nav",{className:I(`ff-tab-row--${t} ff-tab-row-section`,{"ff-tab-row--no-border":o,"ff-tab-row--no-padding":l,"ff-tab-row--position":r.length>4}),role:"tablist","aria-label":"Slider tabs list",children:[r.length>4&&e(q,{className:"ff-tab-icon ff-tab-icon--previous",name:""+(d?"arrow_left_accordian":""),onClick:()=>{d>0&&u(e=>e-1)},hoverEffect:!0,"aria-label":"Previous tabs"}),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&&a(r.id),disabled:r.disabled,id:`tab-slider-${r.id}`,role:"tab","aria-selected":i===r.id,"aria-controls":`tab-slider-panel-${r.id}`,"aria-label":r.label,className:I(`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(Y,{title:r.label.length>9?r.label:"",children:e(U,{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:I("ff-tab-label",{"ff-tab-label--active":i===r.id})})}),"default"===t&&r.count&&e("span",{className:I("tab-count",{"tab-count--active":i===r.id}),children:r.count})]}),e("div",{className:I("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(q,{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,"aria-label":"Next tabs"})]}),e("section",{className:"ff-tab-content",role:"tabpanel",id:`tab-slider-panel-${i}`,"aria-labelledby":i?`tab-slider-${i}`:void 0,"aria-label":f?.label||"Active tab content",children:f?.component})]})},FL=a(({label:t="Status",iconName:r="update_icon",onClick:i,isDisable:a=!1,variant:o="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:a,onClick:i,"aria-label":t||`${o} status indicator`,className:`\n ff-status-indicator\n ff-status-indicator--${o}\n ${l?`ff-status-indicator--with-bg ff-status-indicator--${o}-bg`:""}\n ${s?`ff-status-indicator--with-border ff-status-indicator--${o}-border`:""}\n `,ref:c,children:n("div",{className:"ff-status-indicator__content","aria-label":"Status indicator content",children:[e(q,{name:"danger"===o?"close":r,color:d[o]||d.default,className:`ff-status-indicator__icon ff-status-indicator__icon--${o}`,"aria-label":`${o} status icon`}),e(U,{as:"div",fontSize:12,className:`ff-status-indicator__label ff-status-indicator__label--${o}`,fontWeight:"medium",lineHeight:"20px",children:t})]})})}),RL=({rootLabel:t,childrenLabels:r,align:i="center",direction:a="horizontal"})=>{const o=r.length;return n("section","vertical"===a?{className:"ff-os-tree-vertical",style:{"--child-count":o},"aria-label":"Operating system tree",children:[n("header",{className:`ff-os-tree-vertical__row ff-os-tree-vertical__row--${i}`,"aria-label":"Root node",children:[e("div",{className:"ff-os-tree-vertical__root-label","aria-label":String(t),children:t}),e("div",{className:"ff-os-tree-vertical__horizontal-line"})]}),n("div",{className:"ff-os-tree-vertical__vertical-line-wrapper","aria-label":"Child nodes",children:[e("div",{className:"ff-os-tree-vertical__vertical-line"}),r.map((t,r)=>n("article",{className:"ff-os-tree-vertical__child","aria-label":`Child node ${r+1}`,children:[e("div",{className:"ff-os-tree-vertical__child-connector"}),e("div",{className:"ff-os-tree-vertical__child-label","aria-label":String(t),children:t})]},r))]})]}:{className:`ff-os-tree ff-os-tree--${i}`,style:{"--child-count":o},"aria-label":"Operating system tree",children:[n("header",{className:"ff-os-tree__root-wrapper","aria-label":"Root node",children:[e("div",{className:"ff-os-tree__root-label","aria-label":String(t),children:t}),e("div",{className:"ff-os-tree__vertical-root"})]}),e("div",{className:"ff-os-tree__horizontal-connector","aria-label":"Connectors",children:r.map((t,n)=>e("div",{className:"ff-os-tree__vertical-child"},n))}),e("div",{className:"ff-os-tree__children","aria-label":"Child nodes",children:r.map((t,n)=>e("article",{className:"ff-os-tree__child-container","aria-label":`Child node ${n+1}`,children:e("div",{className:"ff-os-tree__child-label","aria-label":String(t),children:t})},n))})]})},PL=({handleClose:t,handleResend:r,handleOtp:i,resendTimeout:a=30})=>{const[s,d]=c(Array(6).fill("")),[u,f]=c(a),[h,C]=c(!0),p=o(Array(6).fill(null));l(()=>{h||p.current[0]?.focus()},[h]),l(()=>{let e;return u>0&&(e=window.setInterval(()=>f(e=>e-1),1e3)),0===u&&C(!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);p.current[r]?.focus()};return e(Ip,{isOpen:!0,onClose:t,isFooterDisplayed:!1,isHeaderDisplayed:!1,zIndex:999999,customWidth:"340px",children:n("section",{className:"ff-otp-popup","aria-label":"OTP verification modal",children:[n("header",{className:"ff-otp-header","aria-label":"OTP header",children:[e(U,{fontSize:24,lineHeight:"36px",fontWeight:"semi-bold",children:"OTP Verification"}),e(q,{name:"close",height:16,width:16,onClick:t,className:"ff-close-icon","aria-label":"Close OTP verification"})]}),e("div",{className:"ff-otp-boxes","aria-label":"OTP input fields",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&&p.current[t+1]?.focus()}else if("Backspace"===n){e.preventDefault();const n=[...s];n[t]="",d(n),t>0&&p.current[t-1]?.focus()}})(e,n),onPaste:m,ref:e=>p.current[n]=e,readOnly:!0,"aria-label":`OTP digit ${n+1}`},n))}),e(W,{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(a),C(!0),d(Array(6).fill("")),r()},"aria-label":h?"Resend OTP disabled"+(u>0?` for ${u} seconds`:""):"Resend OTP","aria-disabled":h,children:["Re-send OTP",u>0?` (${u}s)`:""]})]})})},BL=({isOpen:t,onClose:r,isPlaying:i,onTogglePlay:a,mediaType:s,src:d,headerTitle:u,onDownload:f,onExpand:h,showHeader:C=!0,showDownload:m=!0,showExpand:A=!0,width:g="800px",height:v="432px",showControls:y=!0,customStyle:w,overlay:b=!0,children:E,showControlDownload:M=!1,showControlExpand:L=!1,isFullscreen:H=!1})=>{const x=o(null),V=o(null),[k,S]=c(0),[Z,O]=c(0),[z,N]=c(!1),[I,T]=c(0);l(()=>{"video"===s&&x.current&&!E&&(i?x.current.play():x.current.pause())},[i,s,E]);const D=p(()=>{if(x.current&&!z){const e=x.current.currentTime/x.current.duration*100;T(e||0),S(x.current.currentTime)}},[z]),F=p(()=>{x.current&&O(x.current.duration)},[]),R=p(()=>{S(0),T(0),a?.()},[a]),P=p(e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`,[]),B=p(e=>{if(x.current){const t=e/100*x.current.duration;x.current.currentTime=t,T(e),S(t)}},[]),j=p(e=>{if(z||!V.current)return;const t=V.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[B,z]),_=p(e=>{if(!V.current)return;N(!0);const t=V.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||!V.current||!x.current)return;const t=V.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[z,B]),X=p(()=>{N(!1)},[]);return l(()=>{if(z)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",X),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",X)}},[z,W,X]),t?e(su,{isOpen:t,onClose:r,isMaximized:!1,showHeader:C,overlay:b,downloadHandler:()=>{},customStyle:w,header:n("header",{className:"ff-header-content","aria-label":"Media viewer header",children:[e(q,{width:23,height:23,name:"automatic_locator"}),e(U,{children:e("span",{className:"ff-header-title",children:u})})]}),icons:e(Y,{title:"Close",children:e(q,{name:"close",onClick:r,"aria-label":"Close media viewer"})}),width:g,height:v,zIndex:999,children:n("section",{className:"ff-video-wrapper","aria-label":"Media viewer content",children:[E||("video"===s?e("video",{ref:x,src:d,className:"ff-media-video",onTimeUpdate:D,onLoadedMetadata:F,onEnded:R}):e("img",{src:d,alt:"Preview image",className:"ff-media-image"})),n("nav",{className:"ff-top-right-icons","aria-label":"Media viewer actions",children:[m&&e(Y,{title:"Download",children:e(q,{name:"download_file",color:"white",onClick:f,"aria-label":"Download media"})}),A&&e(Y,{title:H?"Minimize":"Maximize",children:e(q,{name:H?"collapse_icon":"expand_icon",color:"white",onClick:h,"aria-label":H?"Minimize media viewer":"Maximize media viewer"})})]}),"video"===s&&y&&!E&&n("section",{className:"ff-media-controls","aria-label":"Video controls",children:[e("button",{onClick:a,className:"ff-play-pause-btn","aria-label":i?"Pause video":"Play video",children:e(Y,{title:i?"Pause":"Play",children:e(q,{width:35,height:35,name:i?"pause_button":"play_button",color:"white","aria-label":i?"Pause video":"Play video"})})}),n("div",{className:"ff-progress-bar","aria-label":"Video progress",children:[e("span",{className:"ff-current-time",children:P(k)}),e("input",{type:"range",className:"ff-seek-bar",min:0,max:100,value:I,onChange:e=>B(parseFloat(e.target.value)),onClick:j,onMouseDown:_,ref:V,"aria-label":"Seek video"}),e("span",{className:"ff-total-time",children:P(Z)})]}),n("nav",{className:"ff-control-icons","aria-label":"Additional video actions",children:[M&&e(Y,{title:"Download",children:e(q,{name:"download_file",color:"white",onClick:f,cursorType:"pointer","aria-label":"Download video"})}),L&&e(Y,{title:H?"Minimize":"Maximize",children:e(q,{name:H?"collapse_icon":"expand_icon",color:"white",onClick:h,cursorType:"pointer","aria-label":H?"Minimize video":"Maximize video"})})]})]})]})}):null},jL=({header:r,secondaryHeader:i,primaryCount:a,secondaryCount:o,primaryItems:l,secondaryItems:s,width:c,activeTab:d="primary",activeTabId:u,onPrimaryTabClick:f,onSecondaryTabClick:h,onTabClick:C,actions:p,tabsData:m,notchPosition:A="top-left"})=>{const g=i&&"secondary"===d?s:l,v=o&&parseInt(o)>0,y=a&&parseInt(a)>0,w=i&&(y||v),{tooltip:b="Download",iconName:E="download_file",disabled:M=!1,onClick:L,className:H=""}=p?.download||{},{tooltip:x="Delete",iconName:V="delete_icon",disabled:k=!1,onClick:S,className:Z=""}=p?.delete||{},O=()=>n("div",{className:"ff-dropdown-header-icons","aria-label":"Session actions",children:[p?.download&&e(Y,{title:b,children:e(q,{name:E||"",className:`ff-dropdown-icon ff-download-icon ${H}`,onClick:L,width:18,height:20,disabled:M,hoverEffect:!0,"aria-label":b||"Download"})}),p?.delete&&e(Y,{title:x,children:e(q,{name:V||"",className:`ff-dropdown-icon ff-delete-icon ${Z}`,onClick:S,width:25,height:25,disabled:k,hoverEffect:!0,"aria-label":x||"Delete"})})]});return n("section",{className:"ff-resolution-dropdown",style:c?{minWidth:c}:{},"aria-label":r||"Session dropdown",children:[e("div",{className:"ff-dropdown-notch "+("bottom-center"===A?"bottom-center":"top-left"),"aria-label":"Dropdown notch"}),e("header",{className:"ff-dropdown-header","aria-label":"Session dropdown header",children:e("div",{className:"ff-dropdown-header-content","aria-label":"Session header content",children:i&&m&&u?n(t,{children:[e(wu,{tabsData:m,activeTabId:u,onTabClick:e=>{C&&C(e),"tab-1"===e&&f?f():"tab-2"===e&&h&&h()}}),w&&O()]}):i&&w?n("div",{className:"ff-dropdown-header-dual","aria-label":"Session tabs",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,"aria-label":`${r}${"primary"===d?" selected":""}`,"aria-pressed":"primary"===d,children:[e(U,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),a&&e("span",{className:"ff-dropdown-count",children:a})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,"aria-label":`${i}${"secondary"===d?" selected":""}`,"aria-pressed":"secondary"===d,children:[e(U,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),o&&e("span",{className:"ff-dropdown-count",children:o})]}),O()]}):i?n("div",{className:"ff-dropdown-header-dual","aria-label":"Session tabs",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,"aria-label":`${r}${"primary"===d?" selected":""}`,"aria-pressed":"primary"===d,children:[e(U,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),a&&e("span",{className:"ff-dropdown-count",children:a})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,"aria-label":`${i}${"secondary"===d?" selected":""}`,"aria-pressed":"secondary"===d,children:[e(U,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),o&&e("span",{className:"ff-dropdown-count",children:o})]})]}):e(U,{fontSize:16,fontWeight:"semi-bold",children:r})})}),e("ul",{className:"ff-dropdown-list","aria-label":"Session items list",children:g?.map((t,n)=>e("li",{className:"ff-dropdown-item","aria-label":`Session item ${n+1}`,children:t},n))})]})},_L=(e,t,n,r)=>{const i=e[t.accessor];if(t.cell){const a=e._id||e.id;return t.cell({value:i,row:e,column:t.accessor,index:n,tableType:r,...a&&{refId:a}})}return t.accessor||i&&"object"!=typeof i?i:"--"},qL=(t,n)=>{const r=Number.isFinite(t)?Math.max(0,t):0;return e("div",{className:"tree-table-fn-space-container",children:Array.from({length:r},(t,r)=>e("span",{className:`tree-table-fn-space-block tree-table-fn-space-block-${r} ${n?"folder":""}`},r))})},UL=i.memo(({treeRowRef:r,col:i,colIndex:a,columnMeta:o,node:l,selected:s,select:c,onCheckBoxChange:d,onToggleExpand:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,isExpanding:p,columnTextColor:m,hideOnDisable:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:b})=>{const E={color:`${m||"var(--ff-primary-text-color)"}`,width:o?.width??i?.width,position:o?.sticky?"sticky":void 0,left:o?.sticky?o.left:void 0,zIndex:o?.sticky?o.zIndex:void 0};return n("div",{className:`ff-table-tree-fn-td ${i.isTree&&l.container?"folder":""} ${o?.sticky?"sticky-tree-column":""}`,"data-col-index":a,style:E,children:[i.isTree&&qL(l.hierarchy,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(p?pu:T,{})]})}),n("span",{className:"tree-table-fn-td-content "+(i.isTree&&l.container?"folder":""),children:[!l?.isNewNode&&n(t,{children:[i.isTree&&"checkbox"===c&&!(A&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:"none"===l.selectedStatus?e(Y,{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(En,{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(En,{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&&!(A&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:e(fc,{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})})]}),e("div",{className:"tree-table-cell-flex",children:l.isNewNode&&i.isTree?e(Cu,{onCancel:h,onConfirm:f,value:l.value,label:l?.label,optionsList:l.options,selectedOption:l.selectedOption,withDropdown:"inputWithDropdown"===l.type,handleCustomError:C,inputFieldWidth:g,selectFieldWidth:v,confirmIconTooltip:l.confirmIconTooltip,cancelIconTooltip:l.cancelIconTooltip,isEditable:w,setIsEditable:b,isOnBlurTrue:!1,isDisable:{confirm:y},isTableTree:!0}):n(t,{children:[e("span",{className:"tree-table-fn-td-content-text",children:_L(l,i)}),i.actions&&!l?.isNewNode&&e("div",{className:"table-tree-fn-row-action",children:i.actions(l,r)})]})})]})]})]})});UL.displayName="TableCell";const WL=i.memo(({node:t,columnsData:n,columnMeta:r,selected:i,select:a,onRowClick:l,onToggleExpand:s,onCheckBoxChange:c,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,index:C,selectedNode:p,hideOnDisable:m,addModuleInputWidth:A,addModuleSelectWidth:g,disableEditLabelConfirmIcon:v,isEditable:y,setIsEditable:w,style:b})=>{const E=o(null);return e("div",{"data-level":t.hierarchy,ref:E,className:"ff-table-tree-fn-row show-tree "+(p&&p===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===C?"table-fn-first-row":t.key,style:b,children:n.map((n,o)=>e(UL,{treeRowRef:E,col:n,colIndex:o,node:t,selected:i,select:a,onCheckBoxChange:c,onToggleExpand:s,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,hideOnDisable:m,addModuleInputWidth:A,addModuleSelectWidth:g,disableEditLabelConfirmIcon:v,isEditable:y,setIsEditable:w,columnMeta:r?.[o]},n.name))})});WL.displayName="TableRow";const XL=({flattenedTreeData:t,columnsData:n,columnMeta:r,rowHeight:i=32,startIndex:a=0,totalHeight:o=0,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,expanding:p,selectedNode:m,hideOnDisable:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:b})=>e("div",{className:"ff-table-tree-fn-body",style:{height:`${o}px`,position:"relative"},children:t?.map((t,o)=>e(WL,{node:t,columnsData:n,columnMeta:r,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,isExpanding:t.key===p,index:a+o,selectedNode:m,hideOnDisable:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:b,style:{transform:`translateY(${(a+o)*i}px)`,height:`${i}px`,position:"absolute",top:0,left:0,right:0}},t.key))}),QL=i.memo(({columnsData:t,columnMeta:r,totalWidth:i,rootNode:a,selected:s,onCheckBoxChange:d,selectedNode:u,tableHeaderBgColor:f,hideOnDisable:h,transparentHeader:C,showHeader:p=!0,showRootNodeColumnActions:m})=>{const A=o(null),[g,v]=c(!1);l(()=>{v(!0)},[]);const y=(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:[p&&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:{...y(i,n),backgroundColor:C?"transparent":f,pointerEvents:C?"none":"auto"},children:t},t))}),a&&e("div",{className:"ff-table-tree-fn-row show-tree "+(u&&u===a?.node?.key?"hover":""),ref:A,children:t.map((t,i)=>e("div",{className:"ff-table-tree-fn-td "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:y(i,t.width),children:n("span",{className:"tree-table-fn-default-content "+(0===i?"ff-table-root-index-0":""),children:[0===i&&"checkbox"===a.select&&!(h&&a.node.isDisabled)&&e(En,{checked:"partially"!==a?.node?.selectedStatus&&("completely"===a?.node?.selectedStatus||!1),partial:"partially"===a?.node?.selectedStatus,onChange:e=>d(e,a?.node),disabled:a?.node?.isDisabled}),0===i&&"radio"===a.select&&!(h&&a.node.isDisabled)&&e(fc,{name:a.node.key,checked:s.includes(a.node.key),value:a.node.key,onChange:e=>d(e,a.node),disabled:a.node.isDisabled}),n("div",{className:"tree-table-cell-flex",children:[e(Qs,{children:"name"===t.accessor?a.node[t.accessor]:_L(a.node,t)}),a.cell&&0===i&&e("span",{className:"table-tree--fn-root-cell",children:a.cell(a.node)}),a.actions&&0===i&&g&&A.current&&e("div",{className:"table-tree-fn-row-action",children:a.actions(a.node,A)}),m&&t.actions&&"name"!==t.accessor&&e("div",{className:"table-tree-fn-row-action",children:t.actions(a.node,A)})]})]})},i))})]})});QL.displayName="TableHead";const GL=32,KL="__root__",YL=a(({treeData:t,columnsData:r,selected:i=[],select:a=null,onChange:s=()=>{},onClick:d=()=>{},onExpand:f=()=>{},loadMore:h=()=>{},tableBorder:m,height:A="calc(100vh - 134px)",newNode:g,onAddConfirm:v=()=>{},onAddCancel:y=()=>{},handleEditFieldError:w,loading:b=!1,rootNode:E,pagination:M=!0,selectedNode:L,tableHeaderBgColor:H="var(--border-color-as-bg)",hideOnDisable:x=!1,freezeColumns:V,addModuleInputWidth:k=150,addModuleSelectWidth:S,onScroll:Z,onScrollEnd:O,disableEditLabelConfirmIcon:z=!1,transparentHeader:N=!1,navigateTreeNode:I=null,handleRemoveNavigateTreeNode:T=()=>{},scrollThreshold:D=128,showHeader:F=!0,resetScroll:R=!1,setResetScroll:P=()=>{},showRootNodeColumnActions:B=!1},j)=>{const[_,q]=c(null),[U,W]=c(null),[X,Q]=c({start:0,end:20}),[G,Y]=c(!1),J=o(null),$=o(null),ee=o(0),te=o(b),ne=o(null),re=o(null),ie=o({lastScrollTop:0}),ae=o([]),oe=o(0),le=o(null),se=o(null),ce=o(null),de=o({key:null,attempts:0}),ue=o(null),fe=(e,t)=>{const n=String(e??t);return n.endsWith("%")?{value:parseFloat(n),unit:"%"}:{value:parseFloat(n)||0,unit:"px"}},he=C(()=>{let e=0,t=0;return r.map((n,r)=>{const{value:i,unit:a}=fe(n.width,400),o=!!V&&r<V,l="%"===a?`${i}%`:`${i}px`,s=`calc(${e}px + ${t}%)`;return o&&("%"===a?t+=i:e+=i),{width:l,sticky:o,left:s,zIndex:o?100+(V??0)-r:1}})},[r,V]),Ce=C(()=>{let e=0,t=0;return r.forEach(n=>{const{value:r,unit:i}=fe(n.width,400);"%"===i?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[r]),pe=C(()=>{if(!V)return"0px";let e=0,t=0;return he.slice(0,V).forEach(n=>{const r=parseFloat(n.width)||0;n.width.endsWith("%")?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[he,V]),me=C(()=>((e,t,n)=>{if(!t?.sourceId||!t.action)return e;const{sourceId:r,action:i,value:a="",error:o="",label:l,type:s,options:c,selectedOption:d,confirmIconTooltip:u,cancelIconTooltip:f,payloadSourceId:h}=t,C=t?.parentId,p=t?.hierarchy,m=c?.map(e=>({label:e,value:e})),A=d?{label:d,value:d}:void 0,g=new Map;e.forEach(e=>g.set(e.key,e)),n&&g.set(n.key,n);const v=g.get(r);let y;h&&(y=g.get(h));let w=v??("addInside"===i?y:void 0);!w&&"addInside"===i&&C&&(w=g.get(C));const b="addInside"===i&&!w&&e.length>=0;if(!w&&!b)return e;const E=[...e],M=w?e.findIndex(e=>e.key===w.key):-1;let L=null,H=0,x=M+1;switch(i){case"addAbove":{const t=w;if(!t)return e;L=t.parentId,H=t.hierarchy;break}case"addBelow":{const t=w;if(!t)return e;L=y?.parentId??t.parentId,H=y?.hierarchy??t.hierarchy;break}case"addInside":{if(b){L=C??h??r??null,H=p??1,x=E.length;break}const t=y??w;if(!t)return e;L=t.key,H=(t.hierarchy??0)+1;const n=E.findIndex(e=>e.key===r);-1!==n&&(x=n+1);const i=E.findIndex(e=>e.key===t.key),a=E[i];a&&(E[i]={...a,expandable:!0,expanded:!0});break}}const V={hierarchy:H,parentId:L,sourceId:w?.key??r??h??"new-node",isNewNode:!0,key:"new-node",value:a,error:o,label:l,type:s,options:m,selectedOption:A,confirmIconTooltip:u,cancelIconTooltip:f};switch(i){case"addAbove":E.splice(M,0,V);break;case"addBelow":E.splice(M+1,0,V);break;case"addInside":E.splice(Math.max(0,x),0,V)}return E})(t,g,E?.node),[t,g,E]),Ae=C(()=>((e,t)=>{if(!e?.length)return[];const n=new Map,r=new Map,i=new Map,a=new Map;t&&t.key&&n.set(String(t.key),t),e.forEach(e=>{n.set(String(e.key),e);const t=e.parentId?String(e.parentId):KL;r.has(t)||(r.set(t,[]),a.set(t,{container:0,resource:0})),r.get(t)?.push(e);const i=a.get(t);i&&(e.container?i.container++:i.resource++)}),r.forEach(e=>{e.forEach((e,t)=>{i.set(String(e.key),t)})});const o=e=>{const t=e.parentId?String(e.parentId):KL,o=r.get(t);if(!o||0===o.length)return!1;if((i.get(String(e.key))??0)<o.length-1)return!0;const l=n.get(t),s=a.get(t);if(l&&s){const t=o.filter(e=>e.container).reduce((e,t)=>e+(t.totalResourceCount??0),0),n=o.filter(e=>!e.container).length,r=Math.max(0,(l.totalResourceCount??0)-(t+n));return e.container?s.container<(l.subContainerCount??0)||r>0: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(String(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=>({...e,lastChild:!o(e),selectedStatus:l(e)}))})(me,E?.node),[me,E?.node]),ge=C(()=>Ae.filter(e=>!e.hide),[Ae]),ve=C(()=>{const e=new Map;return Ae.forEach(t=>e.set(t.key,t)),e},[Ae]),ye=C(()=>{const e=new Map;return ge.forEach((t,n)=>e.set(t.key,n)),e},[ge]),we=p(e=>{q(t=>t?e&&t!==e?t:null:t),e&&se.current?.key!==e||(se.current=null),ce.current&&(clearTimeout(ce.current),ce.current=null)},[]);l(()=>{te.current=b},[b]),l(()=>{ne.current=U},[U]);const be=p(e=>{ne.current=e,W(e)},[]),Ee=p(()=>{const e=J.current;if(!e)return;const t=ee.current||0,n=Math.max(0,e.scrollTop-t),r=e.clientHeight-t;let i=Math.floor(n/GL)-6,a=Math.ceil((n+r)/GL)+6;i=Math.max(0,i),a=Math.min(ge.length,a),Q(e=>e.start===i&&e.end===a?e:{start:i,end:a})},[ge.length]),Me=p(()=>{null===re.current&&(re.current=requestAnimationFrame(()=>{re.current=null,Ee()}))},[Ee]),Le=p(()=>{const e=J.current;if(!e)return;const n=e.scrollTop,r=n>ie.current.lastScrollTop?"down":"up";if(ie.current.lastScrollTop=n,Me(),Z?.(),le.current?.(),!M||b||ne.current||K(t))return;const i=e.scrollHeight,a=e.clientHeight;"down"===r&&i-(n+a)<D&&!t[t.length-1]?.lastResource&&(be("below"),h("below"))},[t,M,b,U,D,Me,Z,h,be]);l(()=>{if(b||!M||K(t))return;const e=t[0],n=!e?.lastResource,{totalSubContainerCount:r=0,totalResourceCount:i=0}=E?.node||{},a=r+i,o=ge.length<10&&ge.length<a;n&&o&&(be("above"),h("above"))},[b,M,t,ge.length,E,h,be]),u(()=>{const e=ae.current,t=ge,n=J.current;if(R&&n)return n.scrollTop=0,ie.current.lastScrollTop=0,void P(!1);if(n&&e.length>0&&t.length>0&&!b){const r=ie.current.lastScrollTop,i=Math.max(0,Math.floor(r/GL));let a=-1,o=-1;for(let t=i;t<e.length;t++){const n=e[t]?.key,r=ye.get(n??"");if(void 0!==r){a=t,o=r;break}}if(-1===a)for(let t=i-1;t>=0;t--){const n=e[t]?.key,r=ye.get(n??"");if(void 0!==r){a=t,o=r;break}}if(-1!==a&&-1!==o){const e=o-a,t=Math.max(0,r+e*GL);n.scrollTop!==t&&(n.scrollTop=t,ie.current.lastScrollTop=n.scrollTop,Ee())}else if("above"===U)0!==n.scrollTop&&(n.scrollTop=0,ie.current.lastScrollTop=0,Ee());else{const e=ee.current||0,r=Math.max(0,t.length*GL-(n.clientHeight-e));n.scrollTop>r&&(n.scrollTop=r,ie.current.lastScrollTop=r,Ee())}U&&be(null)}ae.current=t},[b,U,ye,ge,be,Ee,R,P]),l(()=>{const e=J.current;if(!e)return;const n=n=>{n.deltaY>=0||!M||K(t)||te.current||ne.current||e.scrollTop>1||t[0]?.lastResource||(be("above"),h("above"))};return e.addEventListener("wheel",n,{passive:!0}),()=>{e.removeEventListener("wheel",n)}},[M,t,h,be]),l(()=>{const e=J.current;if(e)return le.current=O?Js(()=>{O?.()},150):null,e.addEventListener("scroll",Le,{passive:!0}),()=>{e.removeEventListener("scroll",Le),le.current?.cancel()}},[Le,O]),l(()=>{const e=J.current;if(!e)return;const t=e=>{Date.now()<oe.current&&e.stopImmediatePropagation()};return e.addEventListener("scroll",t,{passive:!0,capture:!0}),()=>{e.removeEventListener("scroll",t,!0)}},[]),l(()=>{const e=$.current;if(!e)return;const t=new ResizeObserver(()=>{ee.current=e.getBoundingClientRect().height,Ee()});return t.observe(e),()=>t.disconnect()},[Ee]),u(()=>{if(!g||!J.current)return;const e=J.current,t=ye.get("new-node");if(void 0===t)return;const n=ee.current||0,r=e.clientHeight-n;if(r<=0)return;const i=t*GL,a=i+GL,o=Math.max(0,e.scrollTop-n);let l=o;i<o?l=i:a>o+r&&(l=Math.max(0,a-r)),l!==o&&(oe.current=Date.now()+300,e.scrollTop=l+n,ie.current.lastScrollTop=e.scrollTop,Ee());const s=requestAnimationFrame(()=>{Y(!0)});return()=>cancelAnimationFrame(s)},[g,ye,Ee]),l(()=>{g||Y(!1)},[g]),u(()=>{if(!_||b)return;const e=se.current;if(!e||e.key!==_){const e=requestAnimationFrame(()=>{we(_)});return()=>cancelAnimationFrame(e)}const t=ve.get(e.key);if(!t){const t=requestAnimationFrame(()=>{we(e.key)});return()=>cancelAnimationFrame(t)}if(Boolean(t.expanded)!==e.expanded)return;const n=requestAnimationFrame(()=>{we(e.key)});return()=>cancelAnimationFrame(n)},[ve,_,b,we]),l(()=>{de.current.key!==I&&(de.current={key:I,attempts:0}),!I&&ue.current&&(clearTimeout(ue.current),ue.current=null)},[I]),u(()=>{if(!I||g)return;const e=J.current;if(!e)return;const n=ye.get(I);if(void 0!==n){de.current={key:I,attempts:0};const t=ee.current||0,r=Math.max(GL,e.clientHeight-t),i=n*GL+16,a=Math.max(0,i-r/2)+t;return oe.current=Date.now()+400,e.scrollTo({top:a,behavior:"smooth"}),Me(),ue.current&&clearTimeout(ue.current),void(ue.current=setTimeout(()=>{T?.()},350))}if(b||U)return;const r=de.current;if(r.key!==I&&(r.key=I,r.attempts=0),r.attempts+=1,!(r.attempts>30))return M&&!0!==t[0]?.lastResource?(be("above"),void h("above")):void(r.attempts>2&&T?.());T?.()},[I,g,ye,b,U,M,t,h,Me,T,be]);const He=p(e=>{if(_)return;const t=!e?.expanded;q(e.key),se.current={key:e.key,expanded:t},ce.current&&clearTimeout(ce.current);const n=Date.now(),r=()=>{if(se.current?.key!==e.key)return;const t=te.current,i=Date.now()-n>=2e3;!t||i?we(e.key):ce.current=setTimeout(r,1e3)};ce.current=setTimeout(r,1e3),f?.(e)},[_,f,we]),xe=p((e,t)=>{_||s?.(e,t)},[s,_]),Ve=p((e,t)=>{_||d?.(e,t)},[d,_]);l(()=>()=>{null!==re.current&&(cancelAnimationFrame(re.current),re.current=null),ce.current&&clearTimeout(ce.current),ue.current&&clearTimeout(ue.current)},[]);const ke=ge.length*GL,Se=ge.slice(X.start,X.end);return e("section",{className:"tree-table-wrapper-container table-tree-fn","aria-label":"Tree table function wrapper",children:e("div",{className:"tree-table-fn-wrap",ref:j,"aria-label":"Tree table container",children:e("div",{className:"table-fn-scrollable "+(ge.length?"":"table-fn-empty"),ref:J,"aria-label":"Tree table scroll area",style:{"--table-height":ge.length?A:"auto","--frozen-column-width":pe,border:m},children:n("div",{className:"tree-table-fn",style:{width:Ce},role:"table","aria-label":"Tree table",children:[e("div",{ref:$,style:{position:"sticky",top:0,zIndex:98},role:"rowgroup","aria-label":"Tree table header",children:e(QL,{columnsData:r,columnMeta:he,totalWidth:Ce,rootNode:E,onCheckBoxChange:xe,selected:i,selectedNode:L,tableHeaderBgColor:H,hideOnDisable:x,transparentHeader:N,showHeader:F,showRootNodeColumnActions:B})}),e("div",{role:"rowgroup","aria-label":"Tree table body",children:e(XL,{flattenedTreeData:Se,columnsData:r,columnMeta:he,totalWidth:Ce,rowHeight:GL,startIndex:X.start,totalHeight:ke,selected:i,select:a,onRowClick:Ve,onToggleExpand:He,onCheckBoxChange:xe,onAddConfirm:v,onAddCancel:y,handleEditFieldError:w,expanding:_,selectedNode:L,hideOnDisable:x,addModuleInputWidth:k,addModuleSelectWidth:S,disableEditLabelConfirmIcon:z,isEditable:g?G:void 0,setIsEditable:g?e=>{Y(Boolean(e))}:void 0})})]})})})})});YL.displayName="TableTreeFn";const JL=t=>e(cA,{logo:()=>"FireFlink"===t?.name?e(q,{height:100,width:100,name:"fire_flink_loader_logo","aria-label":"Loader logo"}):e("img",{src:t?.loaderName,width:100,height:100,alt:"loader"})}),$L=({isVisible:t})=>t?n("section",{className:"no_data_message","aria-live":"polite","aria-label":"No data available message",children:[e(q,{name:"no_content",width:120,height:120,"aria-label":"No data illustration"}),e(U,{fontSize:"20px",lineHeight:"30px",fontWeight:"semi-bold",children:"No Data Available"})]}):null,eH=({text:t=" No Results Found",iconName:r="no_license_found",fontSize:i="24px",textAlign:a="left",direction:o="column",iconWidth:l=120,iconHeight:s=120,fontWeight:c="semi-bold",marginTop:d="0px"})=>e("article",{className:"no_results_container","aria-live":"polite","aria-label":"No result found",children:n("section",{className:`no_results_container__${o}`,style:{marginTop:d},"aria-label":"No result content",children:[e(q,{name:r,width:l,height:s,"aria-label":"No result illustration"}),e("div",{"aria-label":"No result message",children:e(U,{as:"div",fontSize:i,lineHeight:"36px",fontWeight:c,color:"var(--text-color)",textAlign:a,children:t})})]})}),tH=({drawerProps:t,showDrawer:n,children:r,zIndex:i=1200,top:a="56px"})=>e("div",n?{"aria-label":"Layout with drawer",role:"region",children:e(vn,{isOpen:t?.isOpen??!0,...t,zIndex:i,top:a,children:r})}:{"aria-label":"Layout content",role:"region",children:r});const nH=({children:n,offlineContent:r,hasError:i=!1,onNetworkStatusChange:a,overlayClassName:o,overlayZIndex:s=99998,iconWidth:d=300,iconHeight:u=300})=>{const f=function(){const[e,t]=c(navigator.onLine);return l(()=>{const e=()=>{t(!0)},n=()=>{t(!1)};return window.addEventListener("online",e),window.addEventListener("offline",n),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}},[]),e}();return l(()=>{a&&a(f)},[f,a]),i||!f?e("section",{className:`offlineOverlay ${o??""}`,style:{zIndex:s},"aria-live":"polite","aria-label":"Network error overlay",children:r||e(q,{name:"offline_404_icon",height:u,width:d,"aria-label":"Offline error illustration"})}):e(t,{children:n})},rH=e=>{const t=Number.isFinite(e)&&e>0?e:0,n=Math.floor(t/60),r=Math.floor(t%60);return`${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`},iH=[.5,1,1.5,2],aH=({duration:r,currentTime:i,isPlaying:a=!1,onPlayPause:l=()=>{},onSeek:s=()=>{},isMuted:d=!1,onMuteToggle:u=()=>{},menuOptions:f,showCaptions:h=!1,onMenuOptionClick:C=()=>{},playbackRate:p=1,onPlaybackRateChange:m=()=>{},disabled:A=!1,seekStep:g=5,formatTime:v=rH,className:y="",style:w={}})=>{const b=r>0?i/r*100:0,E=o(null),M=o(null),[H,x]=c(!1),[V,k]=c({top:0,left:0}),[S,Z]=c(0),O=o(null),z=f??[...h?[{label:"Captions",value:"captions",icon:"captions"}]:[],{label:n("div",{ref:M,className:"playback-menu-option",children:["Playback Speed ",e(xi,{label:`${p.toFixed(1)} x`})]}),value:"playback-speed",icon:"playback",keepMenuOpen:!0}],N=e=>Math.min(Math.max(e,0),r||0);return n("div",{className:`ff-audio-player ${y}`,style:w,"aria-disabled":A,tabIndex:A?-1:0,role:"group","aria-label":A?"Audio player disabled":"Audio player",onKeyDown:e=>{if(A)return;if("INPUT"!==e.target.tagName)switch(e.key){case" ":case"Spacebar":e.preventDefault(),l();break;case"m":case"M":e.preventDefault(),u();break;case"ArrowRight":e.preventDefault(),s(N(i+g));break;case"ArrowLeft":e.preventDefault(),s(N(i-g))}},children:[e("button",{type:"button",className:"ff-audio-play-btn",onClick:l,disabled:A,"aria-label":a?"Pause":"Play",children:a?n("span",{className:"ff-audio-pause-shape",children:[e("span",{className:"ff-audio-pause-bar"}),e("span",{className:"ff-audio-pause-bar"})]}):e(q,{name:"play",width:8,height:8,cursorType:"pointer",withPadding:!1,className:"ff-audio-play"})}),e(U,{fontSize:8,className:"ff-audio-time",children:v(i)}),n("div",{className:"ff-audio-seek-wrap",children:[e("div",{className:"ff-audio-seek-track"}),e("div",{className:"ff-audio-seek-fill",style:{width:`${b}%`}}),e("input",{type:"range",className:"ff-audio-seek",min:0,max:r||0,step:1,value:i,disabled:A,onChange:e=>{s(Number(e.target.value))},"aria-label":"Seek"})]}),e(U,{fontSize:8,className:"ff-audio-time",children:v(r)}),e(q,{name:"speaker",onClick:A?()=>{}:u,disabled:A,withPadding:!1,className:"ff-audio-speaker-icon"+(d?" ff-audio-speaker-muted":""),cursorType:"pointer","aria-label":d?"Unmute audio":"Mute audio"}),e("div",{className:"ff-audio-more-wrap",ref:E,children:e(Da,{iconName:"more","aria-label":"More audio options",options:z,onOptionClick:e=>{if("playback-speed"===e.value){const e=M.current?.getBoundingClientRect();if(e){let t=e.top,n=e.right+8;t+102>window.innerHeight-8&&(t=Math.max(8,e.bottom-102)),n+36>window.innerWidth-8&&(n=Math.max(8,e.left-36-8)),k({top:t,left:n})}const t=iH.indexOf(p);return Z(t>=0?t:0),x(!0),void requestAnimationFrame(()=>O.current?.focus())}C(e)},dropdownPlacement:"bottomLeft",displayCard:!0,disabled:A,iconSize:12})}),H&&L(n(t,{children:[e("div",{className:"ff-audio-speed-overlay",onClick:()=>x(!1)}),e("div",{className:"ff-audio-speed-menu",style:{top:V.top,left:V.left},ref:O,tabIndex:-1,role:"listbox","aria-label":"Playback speed",onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),Z(e=>(e+1)%iH.length);break;case"ArrowUp":e.preventDefault(),Z(e=>(e-1+iH.length)%iH.length);break;case"Enter":e.preventDefault(),m(iH[S]),x(!1);break;case"Escape":e.preventDefault(),x(!1)}},children:iH.map((t,r)=>{const i=t===p;return e("button",{type:"button",role:"option","aria-selected":i,className:["ff-audio-speed-option",r===S&&"ff-audio-speed-option-highlighted",i&&"ff-audio-speed-option-selected"].filter(Boolean).join(" "),onMouseEnter:()=>Z(r),onMouseDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation(),m(t),x(!1)},children:n(U,{fontSize:10,children:[t.toFixed(1),"x"]})},t)})})]}),document.body)]})};function oH(e,t,n,r,i,a="children"){return function e(o){for(let l=0;l<o.length;l++){const s=o[l];if(s&&s[t]===n){const e=[...o];return"replace"===i?e[l]=r:e.splice("above"===i?l:l+1,0,r),{updatedArray:e}}if(s&&s[a]&&Array.isArray(s[a])){const t=e(s[a]);if(t)return{updatedArray:o.map((e,n)=>n===l?{...e,[a]:t.updatedArray}:e)}}}return null}(e)}const lH=(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),a=r?t:Object.keys(t);if(i.length!==a.length)return!1;if(n)return i.every((e,t)=>lH(e,a[t]));{const n=new Set(a);return i.every(r=>n.has(r)&&lH(e[r],t[r]))}},sH=(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every((e,n)=>{const r=t[n];return lH(e,r)}));function cH(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function dH(e,t){return e&t}function uH(e,t){return e|t}function fH(e,t){return e^t}function hH(e,t){return e&~t}function CH(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 pH(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var mH,AH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function gH(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=AH.charAt(n>>6)+AH.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=AH.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=AH.charAt(n>>2)+AH.charAt((3&n)<<4));(3&r.length)>0;)r+="=";return r}function vH(e){var t,n="",r=0,i=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var a=AH.indexOf(e.charAt(t));a<0||(0==r?(n+=cH(a>>2),i=3&a,r=1):1==r?(n+=cH(i<<2|a>>4),i=15&a,r=2):2==r?(n+=cH(i),n+=cH(a>>2),i=3&a,r=3):(n+=cH(i<<2|a>>4),n+=cH(15&a),r=0))}return 1==r&&(n+=cH(i<<2)),n}var yH,wH=function(e){var t;if(void 0===mH){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(mH={},t=0;t<16;++t)mH[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)mH[n.charAt(t)]=t;for(t=0;t<8;++t)mH[r.charAt(t)]=-1}var i=[],a=0,o=0;for(t=0;t<e.length;++t){var l=e.charAt(t);if("="==l)break;if(-1!=(l=mH[l])){if(void 0===l)throw new Error("Illegal character at offset "+t);a|=l,++o>=2?(i[i.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return i},bH={decode:function(e){var t;if(void 0===yH){var n="= \f\n\r\t \u2028\u2029";for(yH=Object.create(null),t=0;t<64;++t)yH["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(yH["-"]=62,yH._=63,t=0;t<9;++t)yH[n.charAt(t)]=-1}var r=[],i=0,a=0;for(t=0;t<e.length;++t){var o=e.charAt(t);if("="==o)break;if(-1!=(o=yH[o])){if(void 0===o)throw new Error("Illegal character at offset "+t);i|=o,++a>=4?(r[r.length]=i>>16,r[r.length]=i>>8&255,r[r.length]=255&i,i=0,a=0):i<<=6}}switch(a){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=bH.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 bH.decode(e)}},EH=1e13,MH=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,r,i=this.buf,a=i.length;for(n=0;n<a;++n)(r=i[n]*e+t)<EH?t=0:r-=(t=0|r/EH)*EH,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+=EH,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+=(EH+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*EH+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),LH=/^(\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)?)?$/,HH=/^(\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 xH(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}var VH,kH=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="",a=e;a<t;)n=this.get(a++),r=this.get(a++),i+=String.fromCharCode(n<<8|r);return i},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),i=(n?LH:HH).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,a=i?255:0,o="";r==a&&++e<t;)r=this.get(e);if(0===(n=t-e))return i?-1:0;if(n>4){for(o=r,n<<=3;!(128&(+o^a));)o=+o<<1,--n;o="("+n+" bit)\n"}i&&(r-=256);for(var l=new MH(r),s=e+1;s<t;++s)l.mulAdd(256,this.get(s));return o+l.toString()},e.prototype.parseBitString=function(e,t,n){for(var r=this.get(e),i="("+((t-e-1<<3)-r)+" bit)\n",a="",o=e+1;o<t;++o){for(var l=this.get(o),s=o==t-1?r:0,c=7;c>=s;--c)a+=l>>c&1?"1":"0";if(a.length>n)return i+xH(a,n)}return i+a},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return xH(this.parseStringISO(e,t),n);var r=t-e,i="("+r+" byte)\n";r>(n/=2)&&(t=e+n);for(var a=e;a<t;++a)i+=this.hexByte(this.get(a));return r>n&&(i+="…"),i},e.prototype.parseOID=function(e,t,n){for(var r="",i=new MH,a=0,o=e;o<t;++o){var l=this.get(o);if(i.mulAdd(128,127&l),a+=7,!(128&l)){if(""===r)if((i=i.simplify())instanceof MH)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 xH(r,n);i=new MH,a=0}}return a>0&&(r+=".incomplete"),r},e}(),SH=function(){function e(e,t,n,r,i){if(!(r instanceof ZH))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 xH(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return xH(this.stream.parseStringISO(t,t+n),e);case 30:return xH(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 kH?t:new kH(t,0);var r=new kH(n),i=new ZH(n),a=e.decodeLength(n),o=n.pos,l=o-r.pos,s=null,c=function(){var t=[];if(null!==a){for(var r=o+a;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 "+o)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}a=o-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===a)throw new Error("We can't skip over an invalid tag with undefined length at offset "+o);n.pos=o+Math.abs(a)}return new e(r,l,a,i,s)},e}(),ZH=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 MH;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}(),OH=[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],zH=(1<<26)/OH[OH.length-1],NH=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,a="",o=this.t,l=this.DB-o*this.DB%t;if(o-- >0)for(l<this.DB&&(n=this[o]>>l)>0&&(i=!0,a=cH(n));o>=0;)l<t?(n=(this[o]&(1<<l)-1)<<t-l,n|=this[--o]>>(l+=this.DB-t)):(n=this[o]>>(l-=t)&r,l<=0&&(l+=this.DB,--o)),n>0&&(i=!0),i&&(a+=cH(n));return i?a:"0"},e.prototype.negate=function(){var t=RH();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)+XH(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=RH();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 TH(t):new DH(t),this.exp(e,n)},e.prototype.clone=function(){var e=RH();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=RH();return this.bitwiseTo(e,dH,t),t},e.prototype.or=function(e){var t=RH();return this.bitwiseTo(e,uH,t),t},e.prototype.xor=function(e){var t=RH();return this.bitwiseTo(e,fH,t),t},e.prototype.andNot=function(e){var t=RH();return this.bitwiseTo(e,hH,t),t},e.prototype.not=function(){for(var e=RH(),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=RH();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=RH();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+CH(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+=pH(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,uH)},e.prototype.clearBit=function(e){return this.changeBit(e,hH)},e.prototype.flipBit=function(e){return this.changeBit(e,fH)},e.prototype.add=function(e){var t=RH();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=RH();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=RH();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=RH();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=RH();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=RH(),n=RH();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,r,i=e.bitLength(),a=WH(1);if(i<=0)return a;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new TH(t):t.isEven()?new FH(t):new DH(t);var o=[],l=3,s=n-1,c=(1<<n)-1;if(o[1]=r.convert(this),n>1){var d=RH();for(r.sqrTo(o[1],d);l<=c;)o[l]=RH(),r.mulTo(d,o[l-2],o[l]),l+=2}var u,f,h=e.t-1,C=!0,p=RH();for(i=XH(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),C)o[u].copyTo(a),C=!1;else{for(;l>1;)r.sqrTo(a,p),r.sqrTo(p,a),l-=2;l>0?r.sqrTo(a,p):(f=a,a=p,p=f),r.mulTo(p,o[u],a)}for(;h>=0&&!(e[h]&1<<i);)r.sqrTo(a,p),f=a,a=p,p=f,--i<0&&(i=this.DB-1,--h)}return r.revert(a)},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(),a=WH(1),o=WH(0),l=WH(0),s=WH(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),n?(a.isEven()&&o.isEven()||(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);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&&a.subTo(l,a),o.subTo(s,o)):(i.subTo(r,i),n&&l.subTo(a,l),s.subTo(o,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 IH)},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(),a=n.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),n.rShiftTo(a,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 a>0&&n.lShiftTo(a,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=OH[OH.length-1]){for(t=0;t<OH.length;++t)if(n[0]==OH[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<OH.length;){for(var r=OH[t],i=t+1;i<OH.length&&r<zH;)r*=OH[i++];for(r=n.modInt(r);t<i;)if(r%OH[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,a=!1,o=0;--i>=0;){var l=8==r?255&+t[i]:UH(t,i);l<0?"-"==t.charAt(i)&&(a=!0):(a=!1,0==o?this[this.t++]=l:o+r>this.DB?(this[this.t-1]|=(l&(1<<this.DB-o)-1)<<o,this[this.t++]=l>>this.DB-o):this[this.t-1]|=l<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&128&+t[0]&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),a&&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,a=Math.floor(e/this.DB),o=this.s<<n&this.DM,l=this.t-1;l>=0;--l)t[l+a+1]=this[l]>>r|o,o=(this[l]&i)<<n;for(l=a-1;l>=0;--l)t[l]=0;t[a]=o,t.t=this.t+a+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,a=(1<<r)-1;t[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&a)<<i,t[o-n]=this[o]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<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(),a=r.t;for(n.t=a+i.t;--a>=0;)n[a]=0;for(a=0;a<i.t;++a)n[a+r.t]=r.am(0,i[a],n,a,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 a=this.abs();if(a.t<i.t)return null!=n&&n.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=RH());var o=RH(),l=this.s,s=t.s,c=this.DB-XH(i[i.t-1]);c>0?(i.lShiftTo(c,o),a.lShiftTo(c,r)):(i.copyTo(o),a.copyTo(r));var d=o.t,u=o[d-1];if(0!=u){var f=u*(1<<this.F1)+(d>1?o[d-2]>>this.F2:0),h=this.FV/f,C=(1<<this.F1)/f,p=1<<this.F2,m=r.t,A=m-d,g=null==n?RH():n;for(o.dlShiftTo(A,g),r.compareTo(g)>=0&&(r[r.t++]=1,r.subTo(g,r)),e.ONE.dlShiftTo(d,g),g.subTo(o,o);o.t<d;)o[o.t++]=0;for(;--A>=0;){var v=r[--m]==u?this.DM:Math.floor(r[m]*h+(r[m-1]+p)*C);if((r[m]+=o.am(0,v,r,A,0,d))<v)for(o.dlShiftTo(A,g),r.subTo(g,r);r[m]<--v;)r.subTo(g,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=RH(),i=RH(),a=n.convert(this),o=XH(t)-1;for(a.copyTo(r);--o>=0;)if(n.sqrTo(r,i),(t&1<<o)>0)n.mulTo(i,a,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=WH(n),i=RH(),a=RH(),o="";for(this.divRemTo(r,i,a);i.signum()>0;)o=(n+a.intValue()).toString(e).substring(1)+o,i.divRemTo(r,i,a);return a.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),i=Math.pow(n,r),a=!1,o=0,l=0,s=0;s<t.length;++s){var c=UH(t,s);c<0?"-"==t.charAt(s)&&0==this.signum()&&(a=!0):(l=n*l+c,++o>=r&&(this.dMultiply(i),this.dAddOffset(l,0),o=0,l=0))}o>0&&(this.dMultiply(Math.pow(n,o)),this.dAddOffset(l,0)),a&&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),uH,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=[],a=7&t;i.length=1+(t>>3),n.nextBytes(i),a>0?i[0]&=(1<<a)-1:i[0]=0,this.fromString(i,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,i,a=Math.min(e.t,this.t);for(r=0;r<a;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=a;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=a;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)>OH.length&&(t=OH.length);for(var a=RH(),o=0;o<t;++o){a.fromInt(OH[Math.floor(Math.random()*OH.length)]);var l=a.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=RH();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 a=n.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)t(n);else{a<o&&(o=a),o>0&&(n.rShiftTo(o,n),r.rShiftTo(o,r));var l=function(){(a=n.getLowestSetBit())>0&&n.rShiftTo(a,n),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,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):(o>0&&r.lShiftTo(o,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),uH,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>t&&a.subTo(e.ONE.shiftLeft(t-1),a),a.isProbablePrime(n)?setTimeout(function(){i()},0):setTimeout(o,0)};setTimeout(o,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}(),IH=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}(),TH=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}(),DH=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=RH();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(NH.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=RH();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}(),FH=function(){function e(e){this.m=e,this.r2=RH(),this.q3=RH(),NH.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=RH();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 RH(){return new NH(null)}function PH(e,t){return new NH(e,t)}var BH="undefined"!=typeof navigator;BH&&"Microsoft Internet Explorer"==navigator.appName?(NH.prototype.am=function(e,t,n,r,i,a){for(var o=32767&t,l=t>>15;--a>=0;){var s=32767&this[e],c=this[e++]>>15,d=l*s+c*o;i=((s=o*s+((32767&d)<<15)+n[r]+(1073741823&i))>>>30)+(d>>>15)+l*c+(i>>>30),n[r++]=1073741823&s}return i},VH=30):BH&&"Netscape"!=navigator.appName?(NH.prototype.am=function(e,t,n,r,i,a){for(;--a>=0;){var o=t*this[e++]+n[r]+i;i=Math.floor(o/67108864),n[r++]=67108863&o}return i},VH=26):(NH.prototype.am=function(e,t,n,r,i,a){for(var o=16383&t,l=t>>14;--a>=0;){var s=16383&this[e],c=this[e++]>>14,d=l*s+c*o;i=((s=o*s+((16383&d)<<14)+n[r]+i)>>28)+(d>>14)+l*c,n[r++]=268435455&s}return i},VH=28),NH.prototype.DB=VH,NH.prototype.DM=(1<<VH)-1,NH.prototype.DV=1<<VH;NH.prototype.FV=Math.pow(2,52),NH.prototype.F1=52-VH,NH.prototype.F2=2*VH-52;var jH,_H,qH=[];for(jH="0".charCodeAt(0),_H=0;_H<=9;++_H)qH[jH++]=_H;for(jH="a".charCodeAt(0),_H=10;_H<36;++_H)qH[jH++]=_H;for(jH="A".charCodeAt(0),_H=10;_H<36;++_H)qH[jH++]=_H;function UH(e,t){var n=qH[e.charCodeAt(t)];return null==n?-1:n}function WH(e){var t=RH();return t.fromInt(e),t}function XH(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}NH.ZERO=WH(0),NH.ONE=WH(1);var QH=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 GH,KH,YH=null;if(null==YH){YH=[],KH=0;var JH=void 0;if("undefined"!=typeof window&&self.crypto&&self.crypto.getRandomValues){var $H=new Uint32Array(256);for(self.crypto.getRandomValues($H),JH=0;JH<$H.length;++JH)YH[KH++]=255&$H[JH]}var ex=0,tx=function(e){if((ex=ex||0)>=256||KH>=256)self.removeEventListener?self.removeEventListener("mousemove",tx,!1):self.detachEvent&&self.detachEvent("onmousemove",tx);else try{var t=e.x+e.y;YH[KH++]=255&t,ex+=1}catch(e){}};"undefined"!=typeof window&&(self.addEventListener?self.addEventListener("mousemove",tx,!1):self.attachEvent&&self.attachEvent("onmousemove",tx))}function nx(){if(null==GH){for(GH=new QH;KH<256;){var e=Math.floor(65536*Math.random());YH[KH++]=255&e}for(GH.init(YH),KH=0;KH<YH.length;++KH)YH[KH]=0;KH=0}return GH.next()}var rx=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=nx()},e}();function ix(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,a,o,l,s,c,d,u,f,h,C=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),p=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=C[0],r=C[1],i=C[2],a=C[3],o=C[4],l=C[5],s=C[6],c=C[7],u=0;u<64;u++)p[u]=u<16?e[u+d]:px(px(px(hx(p[u-2]),p[u-7]),fx(p[u-15])),p[u-16]),f=px(px(px(px(c,ux(o)),sx(o,l,s)),Cx[u]),p[u]),h=px(dx(n),cx(n,r,i)),c=s,s=l,l=o,o=px(a,f),a=i,i=r,r=n,n=px(f,h);C[0]=px(n,C[0]),C[1]=px(r,C[1]),C[2]=px(i,C[2]),C[3]=px(a,C[3]),C[4]=px(o,C[4]),C[5]=px(l,C[5]),C[6]=px(s,C[6]),C[7]=px(c,C[7])}return C}(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 ax(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 ox(e,t){return e>>>t|e<<32-t}function lx(e,t){return e>>>t}function sx(e,t,n){return e&t^~e&n}function cx(e,t,n){return e&t^e&n^t&n}function dx(e){return ox(e,2)^ox(e,13)^ox(e,22)}function ux(e){return ox(e,6)^ox(e,11)^ox(e,25)}function fx(e){return ox(e,7)^ox(e,18)^lx(e,3)}function hx(e){return ox(e,17)^ox(e,19)^lx(e,10)}var Cx=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 px(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function mx(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 a=new rx,o=[];t>2;){for(o[0]=0;0==o[0];)a.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new NH(n)}function Ax(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 gx(e,t){var n=ix;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 a=n("")+i+""+e,o=new Array(32);(new rx).nextBytes(o);var l=Ax(o,a.length,n),s=[];for(r=0;r<a.length;r+=1)s[r]=a.charCodeAt(r)^l.charCodeAt(r);var c=Ax(s,o.length,n),d=[0];for(r=0;r<o.length;r+=1)d[r+1]=o[r]^c.charCodeAt(r);return new NH(d.concat(s))}var vx=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=PH(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e,t){void 0===t&&(t=mx);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 a=i.toString(16),o=a.length,l=0;l<2*n-o;l++)a="0"+a;return a},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=PH(e,16),this.e=parseInt(t,16),this.d=PH(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,r,i,a,o,l){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=PH(e,16),this.e=parseInt(t,16),this.d=PH(n,16),this.p=PH(r,16),this.q=PH(i,16),this.dmp1=PH(a,16),this.dmq1=PH(o,16),this.coeff=PH(l,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new rx,r=e>>1;this.e=parseInt(t,16);for(var i=new NH(t,16);;){for(;this.p=new NH(e-r,1,n),0!=this.p.subtract(NH.ONE).gcd(i).compareTo(NH.ONE)||!this.p.isProbablePrime(10););for(;this.q=new NH(r,1,n),0!=this.q.subtract(NH.ONE).gcd(i).compareTo(NH.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var o=this.p.subtract(NH.ONE),l=this.q.subtract(NH.ONE),s=o.multiply(l);if(0==s.gcd(i).compareTo(NH.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(s),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(l),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=PH(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 a=255&n[r];a<128?i+=String.fromCharCode(a):a>191&&a<224?(i+=String.fromCharCode((31&a)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&a)<<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 rx,i=e>>1;this.e=parseInt(t,16);var a=new NH(t,16),o=this,l=function(){var t=function(){if(o.p.compareTo(o.q)<=0){var e=o.p;o.p=o.q,o.q=e}var t=o.p.subtract(NH.ONE),r=o.q.subtract(NH.ONE),i=t.multiply(r);0==i.gcd(a).compareTo(NH.ONE)?(o.n=o.p.multiply(o.q),o.d=a.modInverse(i),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout(function(){n()},0)):setTimeout(l,0)},s=function(){o.q=RH(),o.q.fromNumberAsync(i,1,r,function(){o.q.subtract(NH.ONE).gcda(a,function(e){0==e.compareTo(NH.ONE)&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(s,0)})})},c=function(){o.p=RH(),o.p.fromNumberAsync(e-i,1,r,function(){o.p.subtract(NH.ONE).gcda(a,function(e){0==e.compareTo(NH.ONE)&&o.p.isProbablePrime(10)?setTimeout(s,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(l,0)},e.prototype.sign=function(e,t,n){var r=(yx[n]||"")+t(e).toString(),i=this.n.bitLength()/4,a=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 PH("0001"+r+"00"+e,16)}(r,i);if(null==a)return null;var o=this.doPrivate(a);if(null==o)return null;for(var l=o.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=PH(t,16),i=this.doPublic(r);return null==i?null:function(e){for(var t in yx)if(yx.hasOwnProperty(t)){var n=yx[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 yx={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function wx(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 Ey(){return yy||(yy=1,e=by,"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 a=r-1>>>1,o=e[a];if(!(i(o,t)>0))return;e[a]=t,e[r]=o,r=a}}(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,a=e.length,o=a>>>1;r<o;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(i(s,t)<0)c<a&&i(d,s)<0?(e[r]=d,e[c]=t,r=c):(e[r]=s,e[l]=t,r=l);else{if(!(c<a&&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 a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var s=[],c=[],d=1,u=null,f=3,h=!1,C=!1,p=!1,m="function"==typeof setTimeout?setTimeout:null,A="function"==typeof clearTimeout?clearTimeout:null,g="undefined"!=typeof setImmediate?setImmediate:null;function v(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 y(e){if(p=!1,v(e),!C)if(null!==n(s))C=!0,O(w);else{var t=n(c);null!==t&&z(y,t.startTime-e)}}function w(t,i){C=!1,p&&(p=!1,N()),h=!0;var a=f;try{return function(t,i){var a=i;for(v(a),u=n(s);null!==u&&(!(u.expirationTime>a)||t&&!x());){var o=u.callback;if("function"==typeof o){u.callback=null,f=u.priorityLevel;var l=o(u.expirationTime<=a);a=e.unstable_now(),"function"==typeof l?u.callback=l:u===n(s)&&r(s),v(a)}else r(s);u=n(s)}if(null!==u)return!0;var d=n(c);return null!==d&&z(y,d.startTime-a),!1}(t,i)}finally{u=null,f=a,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var b=!1,E=null,M=-1,L=5,H=-1;function x(){return!(e.unstable_now()-H<L)}var V,k=function(){if(null!==E){var t=e.unstable_now();H=t;var n=!0;try{n=E(!0,t)}finally{n?V():(b=!1,E=null)}}else b=!1};if("function"==typeof g)V=function(){g(k)};else if("undefined"!=typeof MessageChannel){var S=new MessageChannel,Z=S.port2;S.port1.onmessage=k,V=function(){Z.postMessage(null)}}else V=function(){m(k,0)};function O(e){E=e,b||(b=!0,V())}function z(t,n){M=m(function(){t(e.unstable_now())},n)}function N(){A(M),M=-1}var I=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(){C||h||(C=!0,O(w))},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"):L=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=I,e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o,l,u=e.unstable_now();if("object"==typeof a&&null!==a){var f=a.delay;o="number"==typeof f&&f>0?u+f:u}else o=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=o+l,A={id:d++,callback:i,priorityLevel:r,startTime:o,expirationTime:m,sortIndex:-1};return o>u?(A.sortIndex=o,t(c,A),null===n(s)&&A===n(c)&&(p?N():p=!0,z(y,o-u))):(A.sortIndex=m,t(s,A),C||h||(C=!0,O(w))),A},e.unstable_shouldYield=x,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)}()),by;var e}var My=(wy||(wy=1,"production"===process.env.NODE_ENV?gy.exports=(Ay||(Ay=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,a=e[r];if(!(0<i(a,t)))break e;e[r]=t,e[n]=a,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,a=e.length,o=a>>>1;r<o;){var l=2*(r+1)-1,s=e[l],c=l+1,d=e[c];if(0>i(s,n))c<a&&0>i(d,s)?(e[r]=d,e[c]=n,r=c):(e[r]=s,e[l]=n,r=l);else{if(!(c<a&&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 a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var s=[],c=[],d=1,u=null,f=3,h=!1,C=!1,p=!1,m="function"==typeof setTimeout?setTimeout:null,A="function"==typeof clearTimeout?clearTimeout:null,g="undefined"!=typeof setImmediate?setImmediate:null;function v(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 y(e){if(p=!1,v(e),!C)if(null!==n(s))C=!0,O(w);else{var t=n(c);null!==t&&z(y,t.startTime-e)}}function w(t,i){C=!1,p&&(p=!1,A(L),L=-1),h=!0;var a=f;try{for(v(i),u=n(s);null!==u&&(!(u.expirationTime>i)||t&&!V());){var o=u.callback;if("function"==typeof o){u.callback=null,f=u.priorityLevel;var l=o(u.expirationTime<=i);i=e.unstable_now(),"function"==typeof l?u.callback=l:u===n(s)&&r(s),v(i)}else r(s);u=n(s)}if(null!==u)var d=!0;else{var m=n(c);null!==m&&z(y,m.startTime-i),d=!1}return d}finally{u=null,f=a,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var b,E=!1,M=null,L=-1,H=5,x=-1;function V(){return!(e.unstable_now()-x<H)}function k(){if(null!==M){var t=e.unstable_now();x=t;var n=!0;try{n=M(!0,t)}finally{n?b():(E=!1,M=null)}}else E=!1}if("function"==typeof g)b=function(){g(k)};else if("undefined"!=typeof MessageChannel){var S=new MessageChannel,Z=S.port2;S.port1.onmessage=k,b=function(){Z.postMessage(null)}}else b=function(){m(k,0)};function O(e){M=e,E||(E=!0,b())}function z(t,n){L=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(){C||h||(C=!0,O(w))},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"):H=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,a){var o=e.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?o+a:o,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:a,expirationTime:l=a+l,sortIndex:-1},a>o?(r.sortIndex=a,t(c,r),null===n(s)&&r===n(c)&&(p?(A(L),L=-1):p=!0,z(y,a-o))):(r.sortIndex=l,t(s,r),C||h||(C=!0,O(w))),r},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(vy)),vy):gy.exports=Ey()),gy.exports);const Ly=Symbol(),Hy=Symbol(),xy="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?l:u,Vy=My.unstable_runWithPriority?e=>{try{My.unstable_runWithPriority(My.unstable_NormalPriority,e)}catch(t){if("Not implemented."!==t.message)throw t;e()}}:e=>e();function ky(e,t){const n=d(e)[Ly];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:a}=n,o=t(r),[l,s]=v((e,n)=>{if(!n)return[r,o];if("p"in n)throw n.p;if(n.n===i)return Object.is(e[1],o)?e:[r,o];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,o]);return Object.is(l[1],o)||s(),xy(()=>(a.add(s),()=>{a.delete(s)}),[a]),l[1]}const Sy=function(e){const t=s({[Ly]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});var n;return t[Hy]=t.Provider,t.Provider=(n=t.Provider,({value:e,children:t})=>{const r=o(e),i=o(0),[a,l]=c(null);a&&(a(e),l(null));const s=o();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={[Ly]:{v:r,n:i,l:e,u:t}}}return xy(()=>{r.current=e,i.current+=1,Vy(()=>{s.current[Ly].l.forEach(t=>{t({n:i.current,v:e})})})},[e]),m(n,{value:s.current},t)}),delete t.Consumer,t}([py,()=>{}]),Zy=({children:t,useTableRef:n,totalWidth:r})=>{const i=o(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})},Oy=t=>e("tr",{...t}),zy=t=>e("tr",{className:"ff-spreadsheet-row-header",...t});function Ny(){return ky(Sy,([,e])=>e)}function Iy(e){return ky(Sy,([t])=>e(t))}const Ty=({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:I("corner-header",{"ff-spreadsheet-header--selected":t}),children:e(q,{variant:t?"dark":"light",color:t?"var(--hover-color)":"var(--text-color)",name:"excel_corner_menu"})})})},Dy=t=>function(n){const i=Ny(),a=r.useCallback(()=>i({type:EA}),[i]),o=Iy(e=>e.selected instanceof sv);return e(t,{...n,selected:o,onSelect:a})},Fy=t=>function(n){const i=Ny(),a=r.useCallback((e,t)=>i(function(e,t){return{type:bA,payload:{column:e,extend:t}}}(e,t)),[i]),o=Iy(e=>e.selected.hasEntireColumn(n.column)),l=Iy(e=>e.selectedColumn??void 0),s=Iy(e=>e.active?qg(e.active,e.model.data):void 0);return e(t,{...n,cell:s,selected:o,selectedColumn:l,onSelect:a,scrollToColumn:n.scrollToColumn})},Ry=Fy(({column:t,label:i,selected:a,onSelect:o,setContextMenu:l,deleteColumn:s,addColumnLeft:c,addColumnRight:d,columnContextEnable:u,cell:f,selectedColumn:h,minimumColumnWidth:p,maxColLimit:m,disableDeleteOption:A,contextMenu:g,onAddColumn:v,onDeleteColumn:y,setVisibleRange:w,scrollToColumn:b})=>{const E=Ny(),M=Iy(e=>e.model.data),L=Iy(e=>e.columnDimensions[t]?.width??p),H=Iy(e=>e.model.data),{columnCount:x}=Dv(H),V=e=>{w(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return h&&b(h),n})},k=C(()=>[{label:"Add Column Left",value:"Add Column Left",iconName:"plus_icon",action:()=>{V("increment"),c(p),v?.(h??t,!0)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Left"]??!1,disable:x>=m},{label:"Add Column Right",value:"Add Column Right",iconName:"plus_icon",action:()=>{V("increment"),d(p),v?.(h??t,!1)},disableTooltip:"Column limit reached",visible:f?.contextDisable?.["Add Column Right"]??!1,disable:x>=m},...A?[]:[{label:"Delete Column",value:"Delete Column",iconName:"delete",action:()=>{V("decrement"),s(),y?.(h??t)},disableTooltip:"",visible:f?.contextDisable?.["Delete Column"]??!1,disable:!1}]],[h,t,M]),S=r.useCallback((e,n)=>{const r=n?t-1:t,i=Math.max(r,0);o(i,e.shiftKey);const a=e.clientX,l=Number(L),s=e=>{const t=e.clientX-a,n=Math.max(p,l+t);E(function(e,t){return{type:rg,payload:{column:e,width:t}}}(i,n))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),E(Rg())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),E(Fg())},[t,L]),Z=r.useCallback(e=>E(zg(e)),[E]),O=r.useCallback(e=>{o(t,e.shiftKey)},[o,t]),z=r.useCallback(e=>{e.preventDefault(),o(t,e.shiftKey),l({open:u,contextType:"column",options:k})},[t,h,u,k]);return r.useEffect(()=>{void 0!==h&&"column"===g?.contextType&&l(e=>({open:e.open,contextType:"column",options:k}))},[t,h,u,k,"column"===g?.contextType]),n("th",{className:I("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":a}),style:{width:`${L}px`,minWidth:"100px"},onClick:O,onContextMenu:z,tabIndex:0,children:[e(U,{fontWeight:"medium",children:i??Py(t)}),e("div",{className:"drag-column-selector drag-column-left",onMouseDown:e=>S(e,!1),onDoubleClick:()=>E(fg(t,L)),onClick:()=>Z({row:-1,column:t})}),e("div",{className:"drag-column-selector drag-column-right",onMouseDown:e=>S(e,!0),onDoubleClick:()=>E(fg(t,L)),onClick:()=>Z({row:-1,column:t})})]},t)});function Py(e){let t="",n=e;for(;n>=0;)t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26)-1;return t}const By=({row:t,label:i,selected:a,onSelect:o,setContextMenu:l,addRowTop:s,addRowBottom:c,deleteRow:d,rowContextEnable:u,selectedRow:f,cell:h,maxRowLimit:C,disableDeleteOption:p,contextMenu:m,setVisibleRange:A,scrollToRow:g})=>{const v=Ny(),y=Iy(e=>e.rowDimensions[t]?.height||32),w=Iy(e=>e.model.data),{rowCount:b}=Dv(w),E=e=>{A(t=>{const n={...t,end:"increment"===e?t.end+1:t.end-1};return f&&g(f),n})},M=r.useMemo(()=>[{label:"Add Row Top",value:"Add Row Top",iconName:"plus_icon",action:()=>{E("increment"),s()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Top"]??!1,disable:b>=C},{label:"Add Row Bottom",value:"Add Row Bottom",iconName:"plus_icon",action:()=>{E("increment"),c()},disableTooltip:"Row limit reached",visible:h?.contextDisable?.["Add Row Bottom"]??!1,disable:b>=C},...p?[]:[{label:"Delete Row",value:"Delete Row",iconName:"delete",action:()=>{E("decrement"),d()},disableTooltip:"",visible:h?.contextDisable?.["Delete Row"]??!1,disable:!1}]],[f,t]),L=r.useCallback((e,n)=>{const r=n?t:t-1,i=Math.max(r,0);o(i,e.shiftKey);const a=e.clientY,l=y,s=e=>{const t=e.clientY-a,n=Math.max(32,l+t);v(ug(i,n))},c=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),v(Rg())};document.addEventListener("mousemove",s),document.addEventListener("mouseup",c)},[y,t]),H=r.useCallback(e=>v(zg(e)),[v]),x=r.useCallback(e=>{o(t,e.shiftKey)},[t]),V=r.useCallback(e=>{e.preventDefault(),o(t,e.shiftKey),l({open:u,contextType:"row",options:M})},[t,u,M,f]);return r.useEffect(()=>{void 0!==f&&"row"===m?.contextType&&l(e=>({open:e.open,contextType:"row",options:M}))},[t,u,M,f,"row"===m?.contextType]),n("th",{className:I("ff-spreadsheet-header",{"ff-spreadsheet-header--selected":a}),style:{height:`${y}px`,minHeight:"32px"},onClick:x,onContextMenu:V,tabIndex:0,children:[e(U,{fontWeight:"medium",children:void 0!==i?i:t+1}),e("div",{className:"drag-row-selector drag-row-down",onMouseDown:e=>L(e,!0),onDoubleClick:()=>v(ug(t,y)),onClick:()=>H({row:t,column:-1})}),e("div",{className:"drag-row-selector drag-row-up",onMouseDown:e=>L(e,!1),onDoubleClick:()=>v(ug(t,y)),onClick:()=>H({row:t,column:-1})})]})},jy=t=>function(n){const i=Ny(),a=Iy(e=>e.selected.hasEntireRow(n.row)),o=Iy(e=>e.active?qg(e.active,e.model.data):void 0),l=Iy(e=>e.selectedRow??void 0),s=r.useCallback((e,t)=>i(function(e,t){return{type:wA,payload:{row:e,extend:t}}}(e,t)),[i]);return e(t,{...n,selected:a,cell:o,selectedRow:l,onSelect:s,scrollToRow:n.scrollToRow})},_y=r.memo(({row:t,column:n,DataViewer:i,active:a,dragging:o,mode:l,data:s,evaluatedData:c,select:d,activate:u,edit:f,editable:h,setCellDimensions:C,setCellData:p})=>{const m=r.useRef(null),A=r.useMemo(()=>({row:t,column:n}),[t,n]),g=r.useCallback(e=>{e.preventDefault(),window.getSelection()?.removeAllRanges(),"view"===l&&(C(A,gv(e.currentTarget)),e.shiftKey?d(A):(u(A),"dropDown"===s?.inputType?.type&&h&&!s?.readOnly&&f()))},[l,C,A,d,u,f,h,s]),v=r.useCallback(e=>{o&&(C(A,gv(e.currentTarget)),d(A))},[C,d,o,A]);return r.useEffect(()=>{const e=m.current;if(!e)return;const t=()=>{o||C(A,gv(e))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[C,A,o]),s&&s.DataViewer&&(i=s.DataViewer),e("td",{ref:m,style:{...s?.style,..."dropDown"===s?.inputType?.type&&{fontSize:"12px"},textDecoration:"underline"===s?.style?.textDecoration?s?.style?.textDecoration:"none"},className:I("ff-spreadsheet-cell",s?.className,{"ff-spreadsheet-active-cell":a||o}),onMouseEnter:v,onMouseDown:g,tabIndex:0,children:e(i,{row:t,column:n,cell:s,active:a,evaluatedCell:c,setCellData:p,inputValue:()=>null})})}),qy=t=>function(n){const{row:i,column:a}=n,o=Ny(),l=r.useMemo(()=>({row:i,column:a}),[i,a]),s=r.useCallback(e=>o(Ng(l,e)),[o,l]),c=r.useCallback(e=>o(function(e){return{type:LA,payload:{point:e}}}(e)),[o]),d=r.useCallback(e=>o(zg(e)),[o]),u=r.useCallback(()=>o(jg()),[o]),f=r.useCallback((e,t)=>o(Ig(e,t)),[o]),h=Iy(e=>Av(e.active,l)),C=Iy(e=>h?e.mode:"view"),p=Iy(e=>e.editable),m=Iy(e=>qg(l,e.model.data)),A=Iy(e=>qg(l,e.model.evaluatedData)),g=Iy(e=>e.dragging),v=Iy(e=>e.copied?.has(l)||!1);return e(t,{...n,active:h,copied:v,dragging:g,mode:C,evaluatedData:A,data:m,select:c,activate:d,edit:u,editable:p,setCellDimensions:f,setCellData:s})},Uy=({cell:r,evaluatedCell:i,active:a})=>{const o=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 o?{className:"ff-spreadsheet-data-viewer ff-spreadsheet-data-viewer--boolean",children:Wy(o)}:{className:I("ff-spreadsheet-data-viewer",{"ff-spreadsheet-data-viewer--preserve-breaks":Sv(o)}),children:a||"dropDown"!==r?.inputType?.type?a||"file"!==r?.inputType?.type?!a&&o:e(t,{children:K(r?.value)?n("div",{className:"ff-spreadsheet-data-viewer--without-fileType",children:[e(q,{name:"attachment_icon"})," Attachment"]}):(n=>{if(K(n))return e(t,{});return JSON.parse(n).map(t=>e("div",{className:"ff-spreadsheet-data-viewer--fileType",children:e(zi,{width:r?.style?.width??100,title:t?.name?.split("*")?.[0]??""})},t.name))})(o)}):n("div",{className:"ff-spreadsheet-data-viewer--dropdownType",children:[o,e(q,{name:"arrow_down",height:8,className:"dropdownType-icon"})]})})};function Wy(e){return e?"TRUE":"FALSE"}const Xy=i.forwardRef(({initialValue:t="",onChange:n,className:r="",style:a={}},s)=>{const c=o(null);i.useImperativeHandle(s,()=>c.current),l(()=>{if(c.current&&document.activeElement!==c.current){const e=String(t)?.endsWith("\n")?`${t}\n`:t;e!==c.current.innerText&&(c.current.innerText=e)}},[t]);return e("div",{style:a,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"}})})}),Qy=({onChange:t,cell:n})=>{const i=r.useRef(null),a=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(Xy,{ref:i,initialValue:n?.value??"",onChange:a,className:"ff-spreadsheet-cell-textarea",style:{...n?.style,width:"100%",height:"100%",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})})},Gy=t=>{const i=r.useRef(null),a=r.useRef(null),o=Ny(),l=r.useCallback((e,t)=>o(Ng(e,t)),[o]),s=r.useCallback(e=>o(zg(e)),[o]),c=r.useCallback(()=>o(jg()),[o]),d=r.useCallback(e=>o({type:ag,payload:{autofill:e}}),[o]),u=r.useCallback(e=>o(function(e){return{type:RA,payload:{changes:e}}}(e)),[o]),f=r.useCallback(()=>{o({type:zA})},[o]),h=Iy(e=>e.rowDimensions),C=Iy(e=>e.active),p=Iy(e=>e.mode),m=Iy(e=>e.active?qg(e.active,e.model.data):void 0),A=Iy(e=>e.selected),g=Iy(e=>A&&Hv(e.rowDimensions,e.columnDimensions,e.model.data,e.selected)),v=Iy(e=>{let t=C?Mv(C,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}),y=r.useMemo(()=>!C||!v||C.row<t.visibleRowRange.start||C.row>=t.visibleRowRange.end||C.column<t.visibleColRange.start||C.column>=t.visibleColRange.end,[C,v,t.visibleRowRange,t.visibleColRange]),w=r.useRef(void 0),b=r.useRef(null),E=r.useRef(void 0),M=r.useCallback(e=>{C&&l(C,e)},[l,C]),[L,H]=r.useState({value:"",name:""}),[x,V]=r.useState(!1),[k,S]=r.useState(),[Z,O]=r.useState([]),[z,N]=r.useState("var(--ff-select-text-color)");r.useEffect(()=>{m&&C&&t.getActiveCell({value:m.value,active:C});const n=i.current;if(!y&&n&&(n.focus({preventScroll:!0}),"dropDown"===m?.inputType?.type)){H({value:m?.value,name:m?.value}),N(m?.style?.color),V(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,color:t.color}));S(t)}},[i,y,C?.row,C?.column]),r.useEffect(()=>{if("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([])},[m?.inputType?.type,m?.value]),r.useEffect(()=>{"dropDown"===m?.inputType?.type&&m?.value!==L.value&&H({value:m?.value,name:m?.value})},[m?.value,m?.inputType?.type,L.value]),r.useEffect(()=>{const e=b.current,t=E.current;if(b.current=C,E.current=m,!e||!t)return;const n=C?.row!==e.row||C?.column!==e.column;if(n||"edit"!==p){const e=w.current;t!==e?u([{prevCell:e||null,nextCell:t}]):n||m===t||u([{prevCell:t,nextCell:m||null}]),w.current=m}});const T=m&&m.DataEditor||t.DataEditor,D=m&&m.readOnly,F=r.useCallback(e=>{if(!C)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 a=()=>{i&&(cancelAnimationFrame(i),i=null)},o=e=>{const n=t.getBoundingClientRect();let r=0,o=0;e.clientY<n.top+50?o=-12:e.clientY>n.bottom-50&&(o=12),e.clientX<n.left+50?r=-12:e.clientX>n.right-50&&(r=12),0!==r||0!==o?(e=>{a();const n=()=>{const{x:r,y:a}=e;0!==r&&(t.scrollLeft+=r),0!==a&&(t.scrollTop+=a),i=requestAnimationFrame(n)};i=requestAnimationFrame(n)})({x:r,y:o}):a()},l=()=>{a(),document.body.style.userSelect=n,document.body.style.overflow=r,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",l),d(!0)},[s,d,C]),R=r.useCallback(e=>{e.preventDefault(),t.setContextMenu({open:t.contextOption?.open??!1,contextType:t.contextOption?.contextType??null,options:t.contextOption?.options||[]})},[t]),P=g?.height!==v?.height||g?.width!==v?.width,B=r.useCallback(e=>{C&&P&&(Ig(C,gv(e.currentTarget)),s(C))},[C,P]),j=t.isAtRight?t.maxWidth-(v?.left-t.scrollPos.left)+100:t.maxWidth,_=t.isAtBottom?t.maxHeight-(v?.top-t.scrollPos.top)+64:t.maxHeight,q=["file","dropDown"].includes(m?.inputType?.type||""),U="dropDown"===m?.inputType?.type;return n("div",{ref:i,className:I("ff-spreadsheet-active-cell",`ff-spreadsheet-active-cell--${p}`,{"ff-spreadsheet-active-cell--hidden":y,"ff-spreadsheet-active-cell--dragging":P&&"text"!==m?.inputType?.type}),onMouseDown:B,style:{...v,backgroundColor:m?.style?.backgroundColor,...q?{display:"flex",alignItems:U?"center":m?.style?.alignContent,justifyContent:U?"flex-start":m?.style?.textAlign}:{},..."edit"===p&&C?{minWidth:Math.min(v?.width,t.maxWidth),minHeight:Math.min(v?.height,t.maxHeight),height:"auto",maxWidth:`${j}px`,maxHeight:`${_}px`,overflow:"auto",..."dropDown"===m?.inputType?.type?{}:{padding:"2px 4px 0px 4px",width:"max-content"}}:{}},onContextMenu:R,onClick:"view"!==p||D?void 0:c,tabIndex:0,children:[e("div",{className:q?"":"active-cell-main",style:U?{width:"100%"}:void 0,children:"dropDown"===m?.inputType?.type?e(Za,{...m?.inputType?.inputProps,dropDownRef:a,showOptions:{open:!("edit"!==p||!C),toggle:x},selectedOption:L,optionsList:k||[],height:26,showLabel:!1,disabled:!t.editable,showBorder:!1,selectedOptionColor:z,optionZIndex:5e3,onChange:e=>{const t=K(e.color)?m?.style:{...m?.style,color:e.color};H({value:e.value,name:e.label}),N(e.color||"var(--ff-select-text-color)"),M({...m,value:e.value,style:t,inputType:m?.inputType})}}):"file"===m?.inputType?.type?e(oA,{...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 a=e[i];t.attachmentAction.viewAttachment(a.id,a.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:Z,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 a=e.name.split("*")[0],o=i.findIndex(e=>e.name.split("*")[0]===a)!==t,l=n.some(e=>e.name.split("*")[0]===a);return!o&&!l||(r++,!1)});if(n.length+i.length>5)return void dc.info("Cannot upload more than 5 files.");if(t.attachmentAction?.addAttachment&&i.length>0)try{let e=0,r=0,a=0;const l=Z?.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?a++:r++}else r++}),e>0||c.length>n.length){const e=c.length>0?JSON.stringify(c):"";M({...m,value:e,style:m?.style,inputType:m?.inputType}),o(ug(C?.row||0,Math.max(s,h?.[C.row]?.height||s))),O(c.map(e=>new File([new Blob],e.name?.split("*")[0]??"default")))}a>0&&dc.info("No memory available to add the file"),e>0&&dc.success(`${e} file${e>1?"s":""} uploaded successfully`),r>0&&dc.info(`${r} unsupported ${r>1?"files":"file"}. Please check the file formats.`)}catch(e){console.error("Upload operation failed:",e),dc.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]),a=e[n]?.id;if(-1!==n&&a&&t.attachmentAction?.deleteAttachment)try{const o=await t.attachmentAction.deleteAttachment(a);"SUCCESS"===o||"object"==typeof o&&null!==o&&("status"in o&&"SUCCESS"===o.status||"responseCode"in o&&200===o.responseCode)?(e.splice(n,1),r++):console.error(`Delete failed for ${i.name}: Invalid response`,o)}catch(e){console.error(`Delete error for ${i.name}:`,e),dc.error("Error deleting file")}else console.error(`Cannot delete ${i.name}: Invalid fileId or no match`,{index:n,fileId:a,hasDeleteAttachment:!!t.attachmentAction?.deleteAttachment}),dc.error("Failed to delete file: Invalid file data")}if(r>0){const t=e.length>0?JSON.stringify(e):"";M({...m,value:t,style:m?.style,inputType:m?.inputType}),O(e?.map(e=>new File([new Blob],e.name.split("*")[0]))),dc.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):"";M({...m,value:e,style:m?.style,inputType:m?.inputType}),O(t.map(e=>new File([new Blob],e.name.split("*")[0]))),dc.error("Failed to delete file(s). Invalid file data detected.")}else dc.error("Failed to delete file(s). No valid files removed.")}}catch(e){console.error("Delete operation failed:",e),dc.error("Delete operation failed")}}catch(e){console.error("handleFilesChange error:",e),dc.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:(v?.width??0)-60}):"edit"===p&&C&&t.editable?e(T,{row:C.row,column:C.column,cell:m,onChange:M,exitEditMode:f}):e(Xy,{initialValue:m?.value,onChange:()=>{},className:"ff-spreadsheet-cell-textarea",style:{...m?.style,height:"100%",width:"100%",textDecoration:"underline"===m?.style?.textDecoration?"underline":"none",backgroundColor:P?"#1e161f00":m?.style?.backgroundColor,pointerEvents:"none",borderTop:"",borderBottom:"",borderLeft:"",borderRight:""}})}),!["file"].includes(m?.inputType?.type??"")&&("edit"===p||C&&e("div",{onMouseDown:F,className:"select_dot"}))]},`${C?.row}-${C?.column}`)},Ky=({dimensions:t,dragging:n,hidden:r,variant:i})=>{const a=Iy(e=>e.active),o=Iy(e=>e.autoFill),l=Iy(e=>a?Mv(a,e.rowDimensions,e.columnDimensions):void 0),{width:s,height:c,top:d,left:u}=t||{};let f=l?.height??0,h=l?.width??0,C=s,p=c;return o.open&&s&&c&&l&&(s-h>c-f?(C=s,p=l.height):(p=c,C=l.width)),e("div",{className:I("ff-spreadsheet-floating-rect",{[`ff-spreadsheet-floating-rect--${i}`]:i,"ff-spreadsheet-floating-rect--dragging":n,"ff-spreadsheet-floating-rect--hidden":r}),style:{width:(C??0)+1,height:(p??0)+1,top:d,left:u}})},Yy=({scrollPos:t={top:0,left:0}})=>{const n=Iy(e=>e.selected),i=Iy(e=>e.dragging),a=Iy(e=>e.selected.size(e.model.data)<2),o=Iy(e=>n&&Hv(e.rowDimensions,e.columnDimensions,e.model.data,e.selected)),l=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(Ky,{variant:"selected",dimensions:l,dragging:i,hidden:a||!o})},Jy=({scrollPos:t={top:0,left:0}})=>{const n=Iy(e=>e.copied),i=null===n,a=Iy(e=>n&&Lv(e.rowDimensions,e.columnDimensions,n)),o=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(Ky,{variant:"copied",dimensions:o,hidden:i||!a,dragging:!1})},$y=i.forwardRef(({getColorValue:t,disabled:n,initialColor:r},a)=>{const l=o(null);i.useImperativeHandle(a,()=>l.current);const[s,d]=c(r);return e("div",{className:I("ff-excel-color-selector",{"color-selector-disabled":n}),style:{backgroundColor:s},onClick:()=>{l.current&&!n&&l.current.click()},"aria-label":"Select color"+(n?"":`, current color ${s}`),"aria-disabled":n,children:e("input",{type:"color",disabled:n,className:I("ff-excel-color-selector-picker",{"color-selector-disabled":n}),ref:l,"aria-label":"Color picker",onChange:e=>{d(e.target.value),t(e.target.value.replace("#",""))}})})});$y.displayName="ColorBarSelector";const ew=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"}},tw=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"}},nw=e=>Iv.reduce((t,n)=>Math.abs(n-parseFloat(e))<Math.abs(t-parseFloat(e))?n:t);function rw(e,t=100){const{border:n}=e;let r="",i="",a="",o="";return"THIN"!==n.top&&(r="MEDIUM"===n.top?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.right&&(i="MEDIUM"===n.right?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.bottom&&(a="MEDIUM"===n.bottom?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),"THIN"!==n.left&&(o="MEDIUM"===n.left?"2px solid var(--input-hover-border-color)":"1px solid var(--excel-header-border)"),{fontSize:Zv(nw(String(e.size))),fontFamily:(l=e.name,Nv.some(e=>e.label===l)?l:"Poppins"),color:`#${e.color}`,backgroundColor:`#${e.backgroundColor}`,fontWeight:e.bold?"bold":"normal",fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":"normal",borderTop:r,borderRight:i,borderBottom:a,borderLeft:o,textAlign:ew(e.alignment.horizontal),alignContent:ew(e.alignment.vertical),height:e.height??32,width:e.width??t};var l}const iw=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"},aw=(e,t=100)=>({name:e.fontFamily||"Arial",size:Ov(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:iw(e.borderTop?e.borderTop.toString():void 0),right:iw(e.borderRight?e.borderRight.toString():void 0),bottom:iw(e.borderBottom?e.borderBottom.toString():void 0),left:iw(e.borderLeft?e.borderLeft.toString():void 0)},alignment:{horizontal:tw(e.textAlign),vertical:tw(e.alignContent),wrapText:!1},width:e.width||t,height:e.height||32}),ow=({toolbar:t="show",editable:r,onBold:i,onItalic:a,setUnderlineType:s,setColor:d,setFontSize:u,setFontFamily:f,setTextAlign:h,setBackgroundColor:p,setBorderType:m,setFormatePainter:A})=>{const g=Iy(e=>e.selected instanceof sv),[v,y]=c("disable"===t||!r),w=Iy(e=>e.active?qg(e.active,e.model.data):null),b=Iy(e=>e.model.data),E=Iy(e=>e.formattedStyle.open),M={...zv.style,color:"#1e161f",backgroundColor:"#ffffff",borderColor:"#1e161f"},[L,H]=c(w?.style||M),x=o(null);l(()=>{w?.style&&JSON.stringify(w.style)!==JSON.stringify(L)&&H(w?.style||M),g?y(!r):w&&"boolean"==typeof w.readOnly&&y(w.readOnly||"disable"===t||!r||"dropDown"===w?.inputType?.type)},[w,r]);const V=aw(L),[k,S]=c("border-none"),Z=C(()=>{const e=L.fontFamily||"Times New Roman";return{label:e,value:e}},[L.fontFamily]),O=C(()=>{const e=`${Math.round(Ov(L.fontSize))||11}`;return{label:e,value:e}},[L.fontSize]),[z,N]=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"}],T=Iv.map(e=>({label:e,value:e})),D=o(null),F=o(null);l(()=>{let e=setTimeout(()=>{d(b,z.color)},0);return()=>{clearTimeout(e)}},[z.color]),l(()=>{let e=setTimeout(()=>{p(b,z.backgroundColor)},0);return()=>{clearTimeout(e)}},[z.backgroundColor]);return n("div",{className:"ff-excel-toolbar",role:"toolbar","aria-label":"Excel formatting toolbar",children:[n("div",{className:"ff-excel-toolbar-font ","aria-label":"Font controls",children:[e("div",{className:"ff-excel-toolbar-font-family","aria-label":"Font family selector",children:e(Za,{disabled:v,height:24,tooltip:!0,showToolTip:!0,showLabel:!1,optionZIndex:2e3,onChange:e=>{H(t=>({...t,fontFamily:e.value})),f(b,e.value)},required:!1,optionsList:Nv,selectedOption:Z})}),e("div",{className:"ff-excel-toolbar-font-size","aria-label":"Font size selector",children:e(Za,{disabled:v,height:24,showLabel:!1,optionZIndex:2e3,required:!1,onChange:e=>{H(t=>({...t,fontSize:Zv(Number(e.value))})),u(b,e.value)},optionsList:T,selectedOption:O})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon","aria-label":"Text alignment controls",children:[e(Y,{placement:"top",title:"Text Left",children:e(q,{disabled:v,variant:"left"===L.textAlign?"dark":"light",hoverEffect:"left"!==L.textAlign,onClick:()=>h(b,"left"),name:"text_align_left"})}),e(Y,{placement:"top",title:"Text Center",children:e(q,{disabled:v,variant:"center"===L.textAlign?"dark":"light",hoverEffect:"center"!==L.textAlign,onClick:()=>h(b,"center"),name:"text_align_center"})}),e(Y,{placement:"top",title:"Text Right",children:e(q,{disabled:v,variant:"right"===L.textAlign?"dark":"light",hoverEffect:"right"!==L.textAlign,onClick:()=>h(b,"right"),name:"text_align_right"})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-text","aria-label":"Text styling controls",children:[e(Y,{placement:"top",title:"Bold",children:e(q,{disabled:v,variant:V.bold?"dark":"light",hoverEffect:!V.bold,onClick:()=>i(b),name:"bold"})}),e(Y,{placement:"top",title:"Italic",children:e(q,{disabled:v,variant:V.italic?"dark":"light",hoverEffect:!V.italic,onClick:()=>a(b),name:"italic"})}),e(Y,{placement:"top",title:"Underline",children:e("div",{className:"ff-excel-toolbar-icon-underline",children:e(q,{disabled:v,variant:"underline"===L.textDecoration?"dark":"light",hoverEffect:"underline"!==L.textDecoration,onClick:()=>s(b),name:"underline"})})})]}),e("div",{className:"ff-excel-toolbar-divider"}),n("div",{className:"ff-excel-toolbar-icon","aria-label":"Formatting tools",children:[e(Y,{placement:"top",title:"Format Painter",children:e(q,{disabled:v,variant:E?"dark":"light",hoverEffect:!E,onClick:()=>{A(b)},name:"formate_painter"})}),e(Y,{placement:"top",title:"Text Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(q,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{d(b,z.color),D.current?.click()},name:"text_color"}),e($y,{ref:D,disabled:v,getColorValue:e=>{N(t=>({...t,color:e}))},initialColor:z.color})]})}),e(Y,{placement:"top",title:"Background Color",children:n("div",{className:"ff-excel-toolbar-icon-color",children:[e(q,{disabled:v,hoverEffect:!0,width:12,height:10,onClick:()=>{p(b,z.backgroundColor),F.current?.click()},name:"fill_color"}),e($y,{ref:F,disabled:v,getColorValue:e=>{N(t=>({...t,backgroundColor:e}))},initialColor:z.backgroundColor})]})})]}),e("div",{className:"ff-excel-toolbar-divider"}),e("div",{className:"ff-excel-toolbar-menu","aria-label":"Border controls",children:n("div",{className:"ff-excel-toolbar-menu-option",children:[e(Y,{placement:"top",title:"Border Type",children:e(q,{hoverEffect:!0,disabled:v,onClick:()=>m(b,k,"var(--input-hover-border-color)"),name:(()=>{const e=I.find(e=>e.value===k);return e?e.icon:""})()})}),e("span",{ref:x,children:e(Da,{disabled:v,iconName:"arrow_down",targetRef:x,iconSize:12,zIndex:2e3,options:I,tooltipTitle:"Border Type",tooltipPlacement:"top",onOptionClick:e=>{let t=e.value;m(b,t,"var(--input-hover-border-color)"),S(t)}})})]})})]})},lw=(e,t)=>{let n,r=null;const i=function(...i){const a=this;null===r||Date.now()-r>=t?(e.apply(a,i),r=Date.now()):(n&&clearTimeout(n),n=setTimeout(()=>{e.apply(a,i),r=Date.now()},t-(Date.now()-r)))};return i.cancel=()=>{n&&clearTimeout(n),n=null,r=null},i},sw=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab"]),cw=new Set(["Tab","Enter"]),dw=r.forwardRef(function(t,i){const{className:a,columnLabels:o=[],rowLabels:l=[],toolbar:s,editable:c,onKeyDown:d,Table:u=Zy,Row:f=Oy,sheetHeight:h,HeaderRow:C=zy,DataEditor:p=Qy,DataViewer:m=Uy,onSelect:A=()=>{},onActivate:g=()=>{},onEvaluatedDataChange:v=()=>{},contextOption:y,attachmentAction:w,workRef:b,minimumColumnWidth:E,setContextMenu:M,maxRowLimit:L,maxColLimit:H,disableDeleteOption:x,contextMenu:V,getActiveCell:k,onAddColumn:S,onDeleteColumn:Z}=t,O=32,z=E||100,N=r.useRef(!1),T=Iy(e=>e.model.data),[D,F]=r.useState(!1),[R,P]=r.useState(0),[B,j]=r.useState(0),[_,q]=r.useState({top:0,left:0}),[U,W]=r.useState(!1),[X,Q]=r.useState(!1),G=r.useMemo(()=>{const e=t.createFormulaParser||Rv,n=new qv(e,t.data);let r={},i={};t.data.forEach((e,t)=>{let n=O;e.forEach(e=>{if(e){const t=parseFloat(String(e.style?.height).replace("px",""))||O;n=Math.max(n,t)}}),r[t]={top:0,height:n}});const a=t.data[0]?t.data[0].length:0;for(let e=0;e<a;e++){let n=z;t.data.forEach(t=>{const r=t[e];if(r){const e=parseFloat(String(r.style?.width).replace("px",""))||z;n=Math.max(n,e)}}),i[e]={left:0,width:n}}return F(e=>!e),{...py,model:n,selected:t.selected||py.selected,rowDimensions:r,columnDimensions:i}},[t.createFormulaParser,t.data,t.selected]),K=r.useReducer(my,G),[Y,J]=K,$=r.useMemo(()=>function(e,t,n){const{columns:r,rows:i}=Jg(e);return{rows:t?Math.max(i,t.length):i,columns:n?Math.max(r,n.length):r}}(Y.model.data,l,o),[Y.model.data,l,o]),[ee,te]=r.useState({start:0,end:Math.min(20,$.rows)}),[ne,re]=r.useState({start:0,end:Math.min(15,$.columns)}),ie=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.rowDimensions[n]?.height||O;return t},[Y.rowDimensions,O]),ae=r.useCallback(e=>{let t=0;for(let n=0;n<e;n++)t+=Y.columnDimensions[n]?.width||z;return t},[Y.columnDimensions,z]),oe=r.useRef(!0);r.useEffect(()=>{oe.current?oe.current=!1:J(function(e){return{type:og,payload:{minimumColumnWidth:e}}}(E))},[E]);const le=ie($.rows),se=ae($.columns),ce=ie(ee.start),de=le-ie(ee.end),ue=ae(ne.start),fe=se-ae(ne.end),he=Y.mode,Ce=r.useRef(null),pe=r.useRef(!1),me=e=>r.useCallback((...t)=>J(e(...t)),[e]),Ae=me(dg),ge=me(Bg),ve=me(Pg),ye=me(_g),we=me(Tg),be=me(Dg),Ee=me(kg),Me=me(Fg),Le=me(Rg),He=me(Sg),xe=me(Zg),Ve=me(Og),ke=me(hg),Se=me(Cg),Ze=me(mg),Oe=me(vg),ze=me(Ag),Ne=me(gg),Ie=me(pg),Te=me(yg),De=me(wg),Fe=me(bg),Re=me(cg),Pe=me(Eg),Be=me(Mg),je=me(Lg),_e=me(Hg),qe=me(xg),Ue=me(Vg);r.useImperativeHandle(i,()=>({removeSelect:ye}));const We=r.useRef(Y.active);r.useEffect(()=>{if(Y.active!==We.current)if(Y.active)g(Y.active);else{const e=b.current;e&&kv(e)&&document.activeElement&&document.activeElement.blur()}We.current=Y.active},[g,Y.active]);const Xe=r.useRef(Y.model.evaluatedData);r.useEffect(()=>{Y?.model?.evaluatedData!==Xe?.current&&v(Y?.model?.evaluatedData),Xe.current=Y.model.evaluatedData},[Y?.model?.evaluatedData,v]);const Qe=r.useRef(Y.selected);r.useEffect(()=>{Y.selected.equals(Qe.current)||t.selected&&Y.selected.equals(t.selected)||A(Y.selected),Qe.current=Y.selected},[Y.selected,A,t.selected]);const Ge=r.useRef(t.selected);r.useEffect(()=>{t.selected&&Ge.current&&!t.selected.equals(Ge.current)&&Ve(t.selected),Ge.current=t.selected},[t.selected,Ve]);let Ke=r.useRef();r.useEffect(()=>{Ae(c),void 0!==Ke.current&&t.data!==Ke.current&&He(t.data),Ke.current=t.data},[t.data,He,c]);const Ye=r.useRef(t.createFormulaParser);r.useEffect(()=>{t.createFormulaParser!==Ye.current&&t.createFormulaParser&&xe(t.createFormulaParser),Ye.current=t.createFormulaParser},[t.createFormulaParser,xe]);const Je=r.useCallback(e=>{const{model:t,selected:n}=Y,{data:r}=t,i=n.toRange(r);if(i){!function(e,t){e.clipboardData?.setData(pv,t)}(e,xv(function(e,t,n){const r=[],i=t.column-e.column;for(let a=e.row;a<=t.row;a++){const o=a-e.row;r[o]=r[o]||Array(i);for(let i=e.column;i<=t.column;i++)r[o][i-e.column]=qg({row:a,column:i},n)}return r}(i.start,i.end,r)))}},[Y]),$e=r.useCallback(e=>{Vv(Ce.current,he)&&(e.preventDefault(),e.stopPropagation(),Je(e),ge())},[he,Je,ge]),et=r.useCallback(e=>{Vv(Ce.current,he)&&(e.preventDefault(),e.stopPropagation(),Je(e),ve())},[he,Je,ve]),tt=r.useCallback(e=>{if(Vv(Ce.current,he)&&(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(pv):""}(e);we(t)}},[he,we]),nt=r.useCallback(e=>{e.persist(),pe.current="edit"===Y.mode?cw.has(e.key):sw.has(e.key);const t=e.ctrlKey||e.metaKey,n=e.key.toLowerCase();t&&"b"===n?(e.preventDefault(),ke(T)):t&&"i"===n?(e.preventDefault(),Se(T)):t&&"u"===n&&(e.preventDefault(),Ze(T)),d&&d(e),e.defaultPrevented||(function(e,t){return void 0!==dy(e,t)}(Y,e)&&e.nativeEvent.preventDefault(),be(e))},[Y,d,be]),rt=r.useCallback(()=>{Y.formattedStyle.open&&Y.active&&Re(Y.active)},[Y]),it=r.useCallback(()=>{Le(),document.removeEventListener("mouseup",it)},[Le]),at=r.useCallback(e=>{Y.dragging||1!==e.buttons||"view"!==he||(Me(),document.addEventListener("mouseup",it))},[Y,Me,it,he]),ot=r.useMemo(()=>qy(t.Cell||_y),[t.Cell,D,c]),lt=r.useMemo(()=>Dy(t.CornerIndicator||Ty),[t.CornerIndicator,D]),st=r.useMemo(()=>jy(t.RowIndicator||By),[t.RowIndicator,D]),ct=r.useMemo(()=>Fy(t.ColumnIndicator||Ry),[t.ColumnIndicator,D]);r.useEffect(()=>(document.addEventListener("cut",$e),document.addEventListener("copy",et),document.addEventListener("paste",tt),()=>{document.removeEventListener("cut",$e),document.removeEventListener("copy",et),document.removeEventListener("paste",tt)}),[$e,et,tt]);const dt=e=>{const t=new ResizeObserver(e=>{const t=e[0];if(t&&Ce.current){const e=t.target;if(e){const{clientWidth:t,clientHeight:n}=e;j(Math.min(Ce.current.clientHeight,n)),P(Math.min(Ce.current.clientWidth,t))}}}),n=e.current;n&&t.observe(n)},ut=r.useCallback(e=>{const t=e.target,{scrollTop:n,clientHeight:r,scrollLeft:i,clientWidth:a}=t;q({top:n,left:i});let o=0;for(;o<$.rows&&ie(o)<n;)o++;let l=o;for(;l<$.rows&&ie(l)<n+r;)l++;o=Math.max(0,o-10),l=Math.min($.rows,l+10),te({start:o,end:l});const s=l===$.rows;W(s);let c=0;for(;c<$.columns&&ae(c)<i;)c++;let d=c;for(;d<$.columns&&ae(d)<i+a;)d++;c=Math.max(0,c-10),d=Math.min($.columns,d+10),re({start:c,end:d});const u=d===$.columns;Q(u),V.open&&M({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},[$.rows,$.columns,ie,ae]),ft=r.useMemo(()=>lw(ut,16),[ut]),ht=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.rowDimensions?.[n]?.height||O;requestAnimationFrame(()=>{Ce.current&&e>=$.rows-1&&Ce?.current?.scrollTo({top:t+O,behavior:"smooth"})})})},Ct=e=>{N.current=!0,requestAnimationFrame(()=>{let t=0;for(let n=0;n<=e;n++)t+=Y.columnDimensions?.[n]?.width||z;requestAnimationFrame(()=>{Ce.current&&e>=$.columns-1&&Ce.current.scrollTo({left:t+60,behavior:"smooth"})})})},pt=r.useCallback(e=>{const t=Ce.current;if(!t)return;const n=32+ie(e.row),r=n+(Y.rowDimensions[e.row]?.height||O),i=60+ae(e.column),a=i+(Y.columnDimensions[e.column]?.width||z);let o=t.scrollTop;n<t.scrollTop+32?o=n-32:r>t.scrollTop+t.clientHeight&&(o=r-t.clientHeight);let l=t.scrollLeft;i<t.scrollLeft+60?l=i-60:a>t.scrollLeft+t.clientWidth&&(l=a-t.clientWidth),o=Math.max(0,Math.min(o,t.scrollHeight-t.clientHeight)),l=Math.max(0,Math.min(l,t.scrollWidth-t.clientWidth)),Math.round(o)===Math.round(t.scrollTop)&&Math.round(l)===Math.round(t.scrollLeft)||(N.current=!0,t.scrollTo({top:o,left:l}))},[ie,ae,Y.rowDimensions,Y.columnDimensions,O,z]);r.useEffect(()=>{pe.current&&(pe.current=!1,Y.active&&pt(Y.active))},[Y.active,pt]),r.useEffect(()=>{N.current||(te({start:0,end:Math.min(20,$.rows)}),re({start:0,end:Math.min(15,$.columns)}))},[$.rows,$.columns,N.current]);const mt=mv(ee.end,ee.start),At=mv(ne.end,ne.start),gt=n("colgroup",{children:[e("col",{style:{width:"60px"}},"row-indicator")," ",e("col",{style:{width:`${ue}px`}},"left-spacer")," ",At.map(t=>e("col",{style:{width:`${Y.columnDimensions[t]?.width||z}px`}},t)),e("col",{style:{width:`${fe}px`}},"right-spacer")," "]}),vt=r.useMemo(()=>n(u,{useTableRef:dt,totalWidth:se,children:[gt,n("tbody",{children:[n(C,{children:[e(lt,{}),e("div",{className:"spacer left"}),At.map(n=>e(ct,{column:n,minimumColumnWidth:E,setContextMenu:t.setContextMenu,label:n in o?o[n]:void 0,deleteColumn:Ue,addColumnLeft:je,addColumnRight:_e,columnContextEnable:t.columnContextEnable,maxColLimit:H,disableDeleteOption:x,contextMenu:V,onAddColumn:S,onDeleteColumn:Z,setVisibleRange:re,scrollToColumn:Ct},n)),e("div",{className:"spacer right"})]}),e("tr",{style:{height:`${ce}px`}}),mt.map(r=>n(f,{row:r,children:[e(st,{label:r in l?l?.[r]:void 0,row:r,addRowTop:Pe,addRowBottom:Be,deleteRow:qe,setContextMenu:t.setContextMenu,rowContextEnable:t.rowContextEnable,maxRowLimit:L,disableDeleteOption:x,contextMenu:V,setVisibleRange:te,scrollToRow:ht},r),e("div",{className:"spacer left"}),At.map(t=>e(ot,{row:r,column:t,DataViewer:m},`${r}-${t}`)),e("div",{className:"spacer right"})]},r)),e("tr",{style:{height:`${de}px`}})]})]}),[u,$.rows,$.columns,f,C,lt,o,ct,l,st,ot,m,ee,ne,ce,de,ue,fe,Y.rowDimensions,Y.columnDimensions]),yt=r.useMemo(()=>e(Gy,{attachmentAction:w,contextOption:y,getActiveCell:k,setContextMenu:t.setContextMenu,DataEditor:p,visibleRowRange:ee,visibleColRange:ne,maxHeight:B-64,maxWidth:R-E,totalHeight:le,totalWidth:se,isAtBottom:U,isAtRight:X,scrollPos:_,editable:c},Y.active?`${Y.active.row}-${Y.active.column}`:"no-active"),[p,ee,ne,Y.active,B,R,le,se,U,X,c]),wt=r.useMemo(()=>n("div",{className:"ff-excel-spreadsheet-container",children:[e("div",{style:{width:`${R}px`},className:I("ff-excel-header-column-hider",{"ff-excel-header-extend":["show","disable"].includes(s||""),"ff-excel-header-hider":"hide"===s})}),e("div",{style:{height:`${B}px`},className:I("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(ow,{editable:c,toolbar:s,onBold:ke,onItalic:Se,setUnderlineType:Ze,setColor:Te,setBorderType:Ie,setFontSize:ze,setFontFamily:Ne,setTextAlign:Oe,setBackgroundColor:De,setFormatePainter:Fe})}),n("div",{ref:Ce,style:{height:h},className:I("ff-excel-spreadsheet",a),onKeyPress:Ee,onKeyDown:nt,onClick:rt,onMouseMove:at,onScroll:e=>ft(e),children:[vt,yt,e(Yy,{scrollPos:_}),e(Jy,{scrollPos:_})]})]}),[a,Ee,nt,at,vt,yt,R]);return e(Sy.Provider,{value:K,children:wt})}),uw=({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",role:"menu","aria-label":"Excel context 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(Y,{title:i?t.disableTooltip:"",children:n("div",{className:"ff-excel-menu-options "+(i?"disabled":""),role:"menuitem","aria-label":t.label,"aria-disabled":i,onClick:()=>{i||t.action()},children:[t.iconName&&e(q,{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(U,{as:"label",children:t.label})]})},t.label)}var r;return null})})},fw=({excelData:r,contextOption:a,toolbar:s="show",sheetBar:d="show",rowCount:u=26,colCount:f=26,sheetHeight:h="100%",editable:C=!0,contextHeightPositioning:p=0,contextWidthPositioning:m=0,onSave:A=()=>Promise.resolve(),onSaveInfoChange:g,attachmentAction:v={addAttachment:()=>Promise.resolve(""),deleteAttachment:()=>Promise.resolve(""),viewAttachment:()=>Promise.resolve()},onSaveDelay:y=3e3,scroller:w=!1,columnContextEnable:b=!0,rowContextEnable:E=!0,sheetBarContextEnable:M=!0,minimumColumnWidth:L=100,disableDeleteOption:H=!1,maxRowLimit:x=1/0,maxColLimit:V=1/0,maxSheetLimit:k=1/0,getActiveCell:S=()=>{},activeSheet:Z})=>{const O=o(null),[z,N]=c([]),[T,D]=c(""),[F,R]=i.useState({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",disable:!1,visible:!1}]}),[P,B]=c({name:"defaultSheet",index:0}),[j,_]=c({defaultSheet:[[zv]]}),[W,X]=c([[zv]]),[Q,G]=c((A.length,{})),[J,$]=c({x:0,y:0}),ee=o(""),te=o(null),ne=o(null),re=o(null);l(()=>{const e=r;if(e){const t=e.map(e=>e.sheetName);if(N(t),!K(t.length)){let e,n;ee.current&&t.includes(ee.current)?(e=ee.current,n=t.indexOf(ee.current)):Z&&t.includes(Z)?(e=Z,n=t.indexOf(Z)):(e=t[0]||"",n=0),ee.current=e,B({name:e,index:n})}const n={},r={};e.forEach(e=>{const t=e.sheetName,i=e.data,a=Math.max(u,i.length),o=Math.max(f,Math.max(...i.map(e=>e.length)));let l=Array.from({length:a},()=>Array(o).fill({value:"",style:zv.style,readOnly:!1,inputType:void 0}));i.forEach((e,t)=>{e.forEach((e,n)=>{var r;t<a&&n<o&&(l[t]||(l[t]=[]),l[t][n]={value:(r=e.value,null==r?null:r),style:K(e?.style)?zv.style:rw(e?.style,L),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}`),a=((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||zv);l[n][r]={...t,value:t?.value??"",readOnly:t?.readOnly?t.readOnly:i,inputType:a,contextDisable:t?.contextDisable}})}),n[t]=l,A.length>2){const e=i[0]||[];r[t]=Array.from({length:o},(t,n)=>({newData:"",oldData:e[n]?.value||""}))}}),_(n),A.length>2&&G(r);const i=ee.current&&n[ee.current]?ee.current:Z&&n[Z]?Z:Object.keys(n)[0];i&&void 0!==n[i]&&X(n[i])}},[r]),l(()=>{g&&g(T),"File saved"===T&&setTimeout(()=>{D("")},2e3)},[T]),l(()=>{D("Saving..."),ie(oe())},[j,ee.current]);const ie=i.useCallback(Js(e=>{if(A.length>2){const t={...Q};z.forEach((n,r)=>{const i=(e[r].data[0]||[]).map(e=>e?.value||"");t[n]=(t[n]||[]).map((e,t)=>({...e,newData:i[t]||""}))}),G(t);const n=z.map(e=>({sheetName:e,headers:t[e]||[]}));A(e,ee.current,n)}else A(e,ee.current);D("File saved")},y),[A,Q,z]),ae=i.useCallback(e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),e.stopPropagation(),ie(oe()))},[A]);i.useEffect(()=>(document.addEventListener("keydown",ae),()=>{document.removeEventListener("keydown",ae)}),[ae]);const oe=()=>z.map(e=>{const t=j[e]?.map(e=>{const t=e.reduce((e,t,n)=>{const r=""!==String(t?.value??"").trim(),i=t?.style?.width,a=t?.style?.height;return r||(void 0!==i&&i!==L||void 0!==a&&32!==a)?n:e},-1),n=e.map((e,n)=>e&&e.style&&n<=t?{value:e.value,style:aw(e.style,L),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:K(n.length)?[[]]:n}}),[le,se]=c(null),ce=()=>z.length>=k,de=()=>{if(ce())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",z),t=Array.from({length:u},()=>Array.from({length:f},()=>zv));N(t=>[...t,e]),B({index:z?.length,name:e}),_({...j,[e]:t}),X(t),A.length>2&&G(t=>({...t,[e]:Array.from({length:f},()=>({newData:"",oldData:""}))})),ee.current=e},ue=(e=[[zv]])=>{X(e)},fe=(e,t,n)=>{const r=e.target;if(!r||r?.textContent?.trim()===n?.trim())return void se(null);const i=(r.textContent||"").trim();if(!i)return dc.warning("Sheet name cannot be empty."),r.textContent=P.name,void se(null);if(i.length>50)return dc.warning("The sheet name cannot be greater than 50 characters"),r.textContent=P.name,void se(null);if(z.map(e=>e.toLowerCase()).includes(i.toLowerCase())&&n.trim()?.toLowerCase()!==i?.toLowerCase())return dc.warning("Sheet name already exists"),r.textContent=P.name,void se(null);let a=z;ue(j?.[n]),a.splice(t,1,i);const o=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??[]}}(j,n,i);ee.current=i,B(e=>({...e,name:i})),_(o),A.length>2&&G(e=>{const t={...e},r=t[n];return delete t[n],t[i]=r??[],t}),se(null)};const he=(e,t)=>{e!==P.name&&t!==P.index&&(B({index:t,name:e}),N(n=>{const r=[...n];return r[t]=e,r}),ue(j[e]),ee.current=e)},Ce=i.useCallback((e,t=!1)=>{const n=e.target;(!n.closest(".ff-excel-tab-list")&&!n.closest(".ff-excel-sheet")||t)&&F.open&&(R({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]}),t||(e.preventDefault(),e.stopPropagation()))},[F.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 pe=(e,t,n)=>{e.preventDefault();const r=[{label:"Add Sheet",value:"Add Sheet",iconName:"plus_icon",action:()=>de(),disableTooltip:"Sheet limit reached",visible:!1,disable:ce()},...H?[]:[{label:"Delete Sheet",value:"Delete Sheet",iconName:"delete",action:()=>((e,t)=>{if(z.length>1){let n=z.slice();n.splice(t,1);const r={...j};delete r[e];const i=Math.min(t,n.length-1);N(n),_(r),A.length>2&&G(t=>{const n={...t};return delete n[e],n});const a=n[i]?n[i]:"";B({index:i,name:a}),ue(r?.[a]),ee.current=a}else dc.warning("Cannot delete the last sheet.")})(t,n),disableTooltip:"",visible:!1,disable:!1}]];R(e=>({...e,open:!0,contextType:"sheet",options:r}))};l(()=>{re.current?.removeSelect()},[P.name]);return e(t,{children:z.length>0&&n("section",{ref:te,className:"ff-excel",onContextMenu:e=>{e.preventDefault();const t=ne.current?.parentElement?.getBoundingClientRect(),n=window.scrollX,r=window.scrollY;let i=e.clientX-(t?.left||0)+n,a=e.clientY-(t?.top||0)+r;const o=300,l=window.innerWidth,s=window.innerHeight,c=l-e.clientX,d=e.clientX,u=s-e.clientY,f=e.clientY;c<o&&d>=o?i=e.clientX-(t?.left||0)+n-150:i+=2,u<200&&f>=200?a=e.clientY-(t?.top||0)+r-20:a+=2,e.target.classList.contains("ff-excel-tab-list")?$({x:i,y:a-(H?32:65)}):(i+o>l&&(i=l-o-2),i<0&&(i=2),$({x:i+m,y:a+p}))},onClick:e=>{e.stopPropagation(),F.open&&R({open:!1,contextType:null,options:[{label:"",value:"",iconName:"",action:()=>{},disableTooltip:"",visible:!1,disable:!1}]})},"aria-label":"Excel spreadsheet workspace",role:"region",children:[e("div",{ref:ne,className:"ff-excel-sheet","aria-label":"Spreadsheet content",children:e(dw,{ref:re,editable:C,attachmentAction:v,toolbar:s,sheetHeight:h,setContextMenu:R,contextOption:a,data:W,columnContextEnable:b,rowContextEnable:E,minimumColumnWidth:L,onEvaluatedDataChange:e=>{_(t=>({...t,[ee.current]:e}))},workRef:te,scroller:w,maxRowLimit:x,maxColLimit:V,disableDeleteOption:H,contextMenu:F,getActiveCell:S,onAddColumn:(e,t)=>{A.length>2&&G(n=>{const r=P.name,i=[...n[r]||[]],a=t?e:e+1;return i.splice(a,0,{newData:"",oldData:""}),{...n,[r]:i}})},onDeleteColumn:e=>{A.length>2&&G(t=>{const n=P.name,r=[...t[n]||[]];return r.splice(e,1),{...t,[n]:r}})}},P.name)}),"hide"!==d&&n("nav",{className:"ff-excel-sheet-bar","aria-label":"Sheet navigation",children:["show"===d&&n("div",{className:"ff-excel-add-sheet-set","aria-label":"Sheet actions",children:[e(Y,{title:ce()?"Sheet limit reached":"Add Sheet",placement:"top",children:e(q,{disabled:!C||ce(),className:"ff-excel-add-sheet-icon",hoverEffect:!0,onClick:de,name:"plus_icon",height:20,width:20})}),e(Da,{options:(t=>t.map((t,r)=>({label:n("div",{style:{display:"flex",gap:"8px"},children:[P?.name===t?e(q,{height:16,width:16,name:"tick"}):e("div",{style:{height:"16px",width:"24px"}}),e(Y,{title:xn(t,20,"count")?t:"",children:e(U,{children:Hn(t,20,"count")})})]}),name:r,value:t})))(z),targetRef:O,onOptionClick:e=>{const{value:t,name:n=""}=e;he(t,parseInt(n))},dropdownPlacement:"top",iconName:"show_script",tooltipTitle:"All Sheets",tooltipPlacement:"top",dropdownHeight:215,selectedValue:P.name})]}),e("div",{className:"ff-excel-tab-container",role:"tablist","aria-label":"Worksheet tabs",children:z.map((t,n)=>e(U,{lineHeight:"16px",children:e("div",{onContextMenu:e=>{he(t,n),M&&pe(e,t,n)},className:I("ff-excel-tab-list",{active:t===P.name}),role:"tab","aria-selected":t===P.name,"aria-label":`Sheet ${t}`,onClick:()=>{he(t,n)},suppressContentEditableWarning:le===n,onDoubleClick:e=>{"show"===d&&(se(n),null===le&&setTimeout(()=>(e=>{const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n?.removeAllRanges(),n?.addRange(t)})(e.target),0))},contentEditable:C&&le===n,onBlur:e=>{fe(e,n,t)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),fe(e,n,t))},children:t})},t))})]}),F.open&&e(uw,{contextMenu:F,position:J,editable:C}),e(cc,{})]})})},hw=({label:t="",isActive:n=!0,onClick:r=()=>{},isFilterChip:i=!1})=>{const a=i?"filter":"module";return e("div",{className:I("ff-module-chip",{"ff-filter-chip":i,[`ff-${a}-chip--active`]:n,[`ff-${a}-chip--hover`]:!n}),onClick:r,"aria-label":t||`${a} chip`,children:e(U,{lineHeight:"18px",className:"module-typography",children:t})})},Cw=({x:e,y:t,radius:n,startAngle:r,endAngle:i})=>{const a=e+n*Math.cos(r),o=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 ${a} ${o} A ${n} ${n} 0 ${c} 1 ${l} ${s}`},pw=({radius:t=15,lineWidth:r=5,label:i,percentageValue:a,icon:l,fontSize:s=10,labelColor:d="",arcColor:u="var(--brand-color)",backgroundArcColor:f="var(--ff-select-scroll-thumb-color)",isSelectedArch:h=!1,onSelect:C})=>{const[p,m]=c({x:0,y:0}),[A,g]=c(!1),v=o(null);let y=-Math.PI/2;const w=2*(t+r),{backgroundArcPath:b,foregroundArcPath:E}=((e,t,n)=>{const r=t,i=r+Math.max(0,Math.min(e,100))/100*2*Math.PI;return{backgroundArcPath:Cw({x:0,y:0,radius:n,startAngle:0,endAngle:2*Math.PI}),foregroundArcPath:Cw({x:0,y:0,radius:n,startAngle:r,endAngle:i})}})(a,y,t),M=()=>{g(!0)},L=()=>{m({x:0,y:0}),g(!1)},H=e=>{if(v.current){const t=v.current.getBoundingClientRect();m({x:e.clientX-t.left,y:e.clientY-t.top})}},x=i?`${i} radial chart at ${a}%`:`Radial chart at ${a}%`;return n("section",{ref:v,className:"ff-icon-radial-chart-container",style:{"--fontSize":`${s}px`},onClick:C,"aria-label":x,children:[e("svg",{width:w,height:w,viewBox:`0 0 ${w} ${w}`,role:"img","aria-label":x,children:n("g",{transform:`translate(${t+r}, ${t+r})`,children:[e("path",{d:b,fill:"none",stroke:f,strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:H}),e("path",{d:E,fill:"none",stroke:u,strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:H}),h&&e("path",{d:E,fill:"none",stroke:"var(--dotted-border-color)",strokeOpacity:"0.4",strokeWidth:r,onMouseEnter:M,onMouseLeave:L,onMouseMove:H}),l?e("foreignObject",{x:"-10",y:"-10",width:"20",height:"20",children:e(q,{className:"ff-radial-chart-icon-padding",name:l,height:20,width:20,withPadding:!1})}):e("text",{x:"0",y:"0",fill:d||u,textAnchor:"middle",dominantBaseline:"central",children:`${Math.round(a)}%`})]})}),A&&n("div",{className:"ff-icon-radial-chart-tooltip",style:{position:"absolute",left:`${p.x+15}px`,top:p.y-5+"px"},children:[e(U,{children:`${i} : `}),n(U,{children:[a,"%"]})]})]})},mw=({mediaSrc:t,fileId:r,onExpandClick:i,onDeleteClick:a,onDownloadClick:o,height:l="75px",width:s="79px",fileName:c,thumbnailMediaSrc:d,isDelete:u})=>e("figure",{className:"ff-attach-media-container",style:{height:l,width:s},"aria-label":c?`Attached media ${c}`:"Attached media",children:n("div",{className:"ff-media-wrapper",style:{height:l,width:s},children:[e("img",{src:d||t,alt:c?`Preview of ${c}`:"Attached media preview"}),n("div",{className:"ff-hover-icons","aria-label":"Media actions",children:[n("div",{className:"ff-top-icons",children:[e("div",{className:"ff-icon-container",children:e(Y,{title:"Download File",placement:"bottom",children:e(q,{name:"download_file_icon",height:10,width:10,onClick:o,color:"var(--icons-default-color)","aria-label":"Download file"})})}),u&&e("div",{className:"ff-icon-container",children:e(Y,{title:"Delete",placement:"bottom",children:e(q,{name:"delete",height:10,width:10,color:"var(--ff-delete-button-attachment)",onClick:()=>{a&&a(r)},"aria-label":"Delete file"})})})]}),e("div",{className:"ff-expand-icon-container",children:e(Y,{title:"Maximize",placement:"bottom",children:e(q,{name:"expand_icon",height:16,width:16,onClick:i,"aria-label":"Expand media"})})})]}),e(U,{color:"var(--text-area-default-color)",fontWeight:"medium",className:"ff-media-text",children:c})]})}),Aw=({icon:r,status:i,count:a,text:o,style:s={width:"196.4px"},resetToggle:d,onSelectedStatus:u=e=>{}})=>{const[f,h]=c(!1),C=["total defects","defect density","open defects","closed defects","quality score"],p=C.includes(i.toLowerCase()),m=C.includes(i.toLowerCase());l(()=>{h(!d)},[d]);return n("article",{className:`ff-card-container ${i.toLowerCase()} ${f?"toggled":""}`,style:s,onClick:()=>(e=>{C.includes(e.toLowerCase())||(h(!0),u(e))})(i),"aria-pressed":f,"aria-disabled":C.includes(i.toLowerCase()),"aria-label":`${i} status card count ${a}`,children:[n("header",{className:"ff-status-bar","aria-label":"Status summary",children:[e("div",{"aria-label":`${i} icon`,children:e(q,{name:r,height:20,width:20,hoverEffect:!1,"aria-label":`${i} status icon`})}),!C.includes(i.toLowerCase())&&e(U,{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("section",{className:"ff-content "+(m?"red-background":""),"aria-label":"Status details",children:n(t,p?{children:[e(U,{fontWeight:"semi-bold",fontSize:"10px",className:"ff-text",lineHeight:"15px",color:"var(--ff-chip-text-color)",children:o}),e(U,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"36px",children:"defect density"===i.toLowerCase()?n(t,{children:[a.toString().padStart(2,"0"),e(U,{fontSize:"15px",fontWeight:"semi-bold",children:"/ Modules"})]}):"quality score"===i.toLowerCase()?`${parseFloat(a.toString()).toFixed(2)}%`:a.toString().padStart(2,"0")})]}:{children:[e(U,{fontWeight:"semi-bold",fontSize:"24px",className:"ff-number",lineHeight:"24px",color:f?"var(--base-bg-color)":"",children:a.toString().padStart(2,"0")}),e(U,{className:"ff-text",lineHeight:"18px",color:f?"var(--base-bg-color)":"var(--ff-chip-text-color)",children:o})]})})]})},gw=({option:t})=>{const r=o(null),[i,a]=c(!1);l(()=>{const e=r.current;if(!e)return;const t=()=>{a(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",role:"option","aria-label":d(t),children:[e(Y,{title:i?d(t):"",style:{width:"calc(100% - 32px)"},children:e("span",{ref:r,className:"ff-truncated_text","aria-label":d(t),children:d(t)})}),e(q,{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})]})};function vw(e){return()=>e}function yw(e){e()}function ww(e,t){return n=>e(t(n))}function bw(e,t){return()=>e(t)}function Ew(e){return void 0!==e}function Mw(){}function Lw(e,t){return t(e),e}function Hw(e,t){return t(e)}function xw(...e){return e}function Vw(e,t){return e(1,t)}function kw(e,t){e(0,t)}function Sw(e){e(2)}function Zw(e){return e(4)}function Ow(e,t){return Vw(e,function(e,t){return n=>e(t,n)}(t,0))}function zw(e,t){const n=e(1,e=>{n(),t(e)});return n}function Nw(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Iw(e,t){return e===t}function Tw(e=Iw){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Dw(e){return t=>n=>{e(n)&&t(n)}}function Fw(e){return t=>ww(t,e)}function Rw(e){return t=>()=>{t(e)}}function Pw(e,...t){const n=function(...e){return t=>e.reduceRight(Hw,t)}(...t);return(t,r)=>{switch(t){case 2:return void Sw(e);case 1:return Vw(e,n(r))}}}function Bw(e,t){return n=>r=>{n(t=e(t,r))}}function jw(e){return t=>n=>{e>0?e--:t(n)}}function _w(e){let t,n=null;return r=>i=>{n=i,!t&&(t=setTimeout(()=>{t=void 0,r(n)},e))}}function qw(...e){const t=Array.from({length:e.length});let n=0,r=null;const i=2**e.length-1;return e.forEach((e,a)=>{const o=2**a;Vw(e,e=>{const l=n;n|=o,t[a]=e,l!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{const o=()=>{e([a].concat(t))};n===i?o():r=o}}function Uw(e){let t=e;const n=Xw();return(e,r)=>{switch(e){case 0:t=r;break;case 1:r(t);break;case 4:return t}return n(e,r)}}function Ww(e,t){return Lw(Uw(t),t=>Ow(e,t))}function Xw(){const e=[];return(t,n)=>{switch(t){case 0:return void e.slice().forEach(e=>{e(n)});case 2:return void e.splice(0);case 1:return e.push(n),()=>{const t=e.indexOf(n);t>-1&&e.splice(t,1)}}}}function Qw(e){return Lw(Xw(),t=>Ow(e,t))}const Gw={singleton:!0};function Kw(e,t=[],n=Gw){const{singleton:r}=n;return{constructor:e,dependencies:t,id:Yw(),singleton:r}}const Yw=()=>Symbol("id");function Jw(...e){const t=Xw(),n=Array.from({length:e.length});let r=0;const i=2**e.length-1;return e.forEach((e,a)=>{const o=2**a;Vw(e,e=>{n[a]=e,r|=o,r===i&&kw(t,n)})}),function(e,a){switch(e){case 2:return void Sw(t);case 1:return r===i&&a(n),Vw(t,a)}}}function $w(e,t=Iw){return Pw(e,Tw(t))}function eb(...e){return function(t,n){switch(t){case 2:return;case 1:return function(...e){return()=>{e.map(yw)}}(...e.map(e=>Vw(e,n)))}}}const tb=0,nb=1,rb=2,ib=3,ab={[tb]:"debug",[ib]:"error",[nb]:"log",[rb]:"warn"},ob=Kw(()=>{const e=Uw(ib);return{log:Uw((t,n,r=nb)=>{r>=((typeof globalThis>"u"?window:globalThis).VIRTUOSO_LOG_LEVEL??Zw(e))&&console[ab[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function lb(e){const t=function(e){return"self"in e?e.document.documentElement:e}(e);return"rtl"===t.ownerDocument.defaultView.getComputedStyle(t).direction}function sb(e,t){return lb(e)?-t:t}function cb(e,t){return lb(e)?-t:t}function db(e,t,n){return ub(e,t,n).callbackRef}function ub(e,t,n){const r=i.useRef(null);let a=e=>{};const o=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 a=e=>{e&&t?(o?.observe(e),r.current=e):(r.current&&o?.unobserve(r.current),r.current=null)},{callbackRef:a,ref:r}}function fb(e,t,n,r,a,o,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 a=[];for(let o=0;o<i;o++){const i=e.item(o);if(void 0===i.dataset.index)continue;const l=parseInt(i.dataset.index,10),s=parseFloat(i.dataset.knownSize),c=t(i,n);if(0===c&&r("Zero-sized element, this should not happen",{child:i},ib),c===s)continue;const d=a[a.length-1];0===a.length||d.size!==c||d.endIndex!==l-1?a.push({endIndex:l,size:c,startIndex:l}):a[a.length-1].endIndex++}return a}(n.children,t,s?"offsetWidth":"offsetHeight",a);let c=n.parentElement;for(;void 0===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.scrollWidth:l.scrollHeight:d?s?u.document.documentElement.scrollWidth:u.document.documentElement.scrollHeight:s?c.scrollWidth:c.scrollHeight,h=l?s?l.offsetWidth:l.offsetHeight:d?s?u.innerWidth:u.innerHeight:s?c.offsetWidth:c.offsetHeight,C=l?s?sb(l,l.scrollLeft):l.scrollTop:d?s?sb(u,u.scrollX||u.document.documentElement.scrollLeft):u.scrollY||u.document.documentElement.scrollTop:s?sb(c,c.scrollLeft):c.scrollTop;r({scrollHeight:f,scrollTop:Math.max(C,0),viewportHeight:h}),o?.(s?hb("column-gap",getComputedStyle(n).columnGap,a):hb("row-gap",getComputedStyle(n).rowGap,a)),null!==i&&e(i)},[e,t,a,o,l,r,s]);return ub(d,n,c)}function hb(e,t,n){return"normal"!==t&&!0!==t?.endsWith("px")&&n(`${e} was not resolved to pixel value correctly`,t,rb),"normal"===t?0:parseInt(t??"0",10)}function Cb(e,t,n){const r=i.useRef(null),a=i.useCallback(n=>{if(!n?.offsetParent)return;const i=n.getBoundingClientRect(),a=i.width;let o,s;if(t){const e=t.getBoundingClientRect(),n=i.top-e.top;s=e.height-Math.max(0,n),o=n+t.scrollTop}else{const e=l.current.ownerDocument.defaultView;s=e.innerHeight-Math.max(0,i.top),o=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:o,visibleHeight:s,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:o,ref:l}=ub(a,!0,n),s=i.useCallback(()=>{a(l.current)},[a,l]);return i.useEffect(()=>{if(t){t.addEventListener("scroll",s);const e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener("scroll",s),e.unobserve(t)}}const e=l.current?.ownerDocument.defaultView;return e?.addEventListener("scroll",s),e?.addEventListener("resize",s),()=>{e?.removeEventListener("scroll",s),e?.removeEventListener("resize",s)}},[s,t,l]),o}const pb=Kw(()=>{const e=Xw(),t=Xw(),n=Uw(0),r=Xw(),i=Uw(0),a=Xw(),o=Xw(),l=Uw(0),s=Uw(0),c=Uw(0),d=Uw(0),u=Xw(),f=Xw(),h=Uw(!1),C=Uw(!1),p=Uw(!1);return Ow(Pw(e,Fw(({scrollTop:e})=>e)),t),Ow(Pw(e,Fw(({scrollHeight:e})=>e)),o),Ow(t,i),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:s,footerHeight:d,headerHeight:l,horizontalDirection:C,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:h,scrollTo:u,scrollTop:t,skipAnimationFrameInResizeObserver:p,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),mb={lvl:0};function Ab(e,t){const n=e.length;if(0===n)return[];let{index:r,value:i}=t(e[0]);const a=[];for(let o=1;o<n;o++){const{index:n,value:l}=t(e[o]);a.push({end:n-1,start:r,value:i}),r=n,i=l}return a.push({end:1/0,start:r,value:i}),a}function gb(e){return e===mb}function vb(e,t){if(!gb(e))return t===e.k?e.v:t<e.k?vb(e.l,t):vb(e.r,t)}function yb(e,t,n="k"){if(gb(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=yb(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return yb(e.l,t,n)}function wb(e,t,n){return gb(e)?Ob(t,n,1):t===e.k?Vb(e,{k:t,v:n}):t<e.k?zb(Vb(e,{l:wb(e.l,t,n)})):zb(Vb(e,{r:wb(e.r,t,n)}))}function bb(){return mb}function Eb(e,t,n){if(gb(e))return[];return function(e){return Ab(e,({k:e,v:t})=>({index:e,value:t}))}(Hb(e,yb(e,t)[0],n))}function Mb(e,t){if(gb(e))return mb;const{k:n,l:r,r:i}=e;if(t===n){if(gb(r))return i;if(gb(i))return r;const[t,n]=Zb(r);return xb(Vb(e,{k:t,l:kb(r),v:n}))}return xb(Vb(e,t<n?{l:Mb(r,t)}:{r:Mb(i,t)}))}function Lb(e){return gb(e)?[]:[...Lb(e.l),{k:e.k,v:e.v},...Lb(e.r)]}function Hb(e,t,n){if(gb(e))return[];const{k:r,l:i,r:a,v:o}=e;let l=[];return r>t&&(l=l.concat(Hb(i,t,n))),r>=t&&r<=n&&l.push({k:r,v:o}),r<=n&&(l=l.concat(Hb(a,t,n))),l}function xb(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(Sb(t))return Nb(Vb(e,{lvl:n-1}));if(!gb(t)&&!gb(t.r))return Vb(t.r,{l:Vb(t,{r:t.r.l}),lvl:n,r:Vb(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(Sb(e))return Ib(Vb(e,{lvl:n-1}));if(!gb(r)&&!gb(r.l)){const t=r.l,i=Sb(t)?r.lvl-1:r.lvl;return Vb(t,{l:Vb(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:Ib(Vb(r,{l:t.r,lvl:i}))})}throw new Error("Unexpected empty nodes")}function Vb(e,t){return Ob(void 0===t.k?e.k:t.k,void 0===t.v?e.v:t.v,void 0===t.lvl?e.lvl:t.lvl,void 0===t.l?e.l:t.l,void 0===t.r?e.r:t.r)}function kb(e){return gb(e.r)?e.l:xb(Vb(e,{r:kb(e.r)}))}function Sb(e){return gb(e)||e.lvl>e.r.lvl}function Zb(e){return gb(e.r)?[e.k,e.v]:Zb(e.r)}function Ob(e,t,n,r=mb,i=mb){return{k:e,l:r,lvl:n,r:i,v:t}}function zb(e){return Ib(Nb(e))}function Nb(e){const{l:t}=e;return gb(t)||t.lvl!==e.lvl?e:Vb(t,{r:Vb(e,{l:t.r})})}function Ib(e){const{lvl:t,r:n}=e;return gb(n)||gb(n.r)||n.lvl!==t||n.r.lvl!==t?e:Vb(n,{l:Vb(e,{r:n.l}),lvl:t+1})}function Tb(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function Db(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}const Fb=Kw(()=>({recalcInProgress:Uw(!1)}),[],{singleton:!0});function Rb(e,t,n){return e[Pb(e,t,n)]}function Pb(e,t,n,r=0){let i=e.length-1;for(;r<=i;){const a=Math.floor((r+i)/2),o=n(e[a],t);if(0===o)return a;if(-1===o){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Bb(e,t){return Math.round(e.getBoundingClientRect()[t])}function jb(e){return!gb(e.groupOffsetTree)}function _b({index:e},t){return t===e?0:t<e?-1:1}function qb({offset:e},t){return t===e?0:t<e?-1:1}function Ub(e,t,n){if(0===t.length)return 0;const{index:r,offset:i,size:a}=Rb(t,e,_b),o=e-r,l=a*o+(o-1)*n+i;return l>0?l+n:l}function Wb(e,t){if(!jb(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Xb(e,t,n){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;let r=Wb("LAST"===e.index?n:e.index,t);return r=Math.max(0,Math.min(n,r)),r}function Qb(e,t,n,r=0){return r>0&&(t=Math.max(t,Rb(e,r,_b).offset)),Ab(function(e,t,n,r){const i=Pb(e,t,r),a=Pb(e,n,r,i);return e.slice(i,a+1)}(e,t,n,qb),Jb)}function Gb(e,[t,n,r,i]){t.length>0&&r("received item sizes",t,tb);const a=e.sizeTree;let o=a,l=0;if(n.length>0&&gb(a)&&2===t.length){const e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>wb(wb(t,n,e),n+1,r),o)}else[o,l]=function(e,t){let n=gb(e)?0:1/0;for(const r of t){const{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),gb(e)){e=wb(e,0,i);continue}const o=Eb(e,a-1,t+1);if(o.some($b(r)))continue;let l=!1,s=!1;for(const{end:n,start:r,value:a}of o)l?(t>=r||i===a)&&(e=Mb(e,r)):(s=a!==i,l=!0),n>t&&t>=r&&a!==i&&(e=wb(e,t+1,a));s&&(e=wb(e,a,i))}return[e,n]}(o,t);if(o===a)return e;const{lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u}=Yb(e.offsetTree,l,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>wb(e,t,Ub(t,u,i)),bb()),lastIndex:s,lastOffset:c,lastSize:d,offsetTree:u,sizeTree:o}}function Kb(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 Yb(e,t,n,r){let i=e,a=0,o=0,l=0,s=0;if(0===t)i=[];else{s=Pb(i,t-1,_b),l=i[s].offset;const e=yb(n,t-1);a=e[0],o=e[1],i.length&&i[s].size===yb(n,t)[1]&&(s-=1),i=i.slice(0,s+1)}for(const{start:e,value:s}of Eb(n,t,1/0)){const t=e-a,n=t*o+l+t*r;i.push({index:e,offset:n,size:s}),a=e,l=n,o=s}return{lastIndex:a,lastOffset:l,lastSize:o,offsetTree:i}}function Jb(e){return{index:e.index,value:e}}function $b(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 eE={offsetHeight:"height",offsetWidth:"width"},tE=Kw(([{log:e},{recalcInProgress:t}])=>{const n=Xw(),r=Xw(),i=Ww(r,0),a=Xw(),o=Xw(),l=Uw(0),s=Uw([]),c=Uw(void 0),d=Uw(void 0),u=Uw(void 0),f=Uw(void 0),h=Uw((e,t)=>Bb(e,eE[t])),C=Uw(void 0),p=Uw(0),m={groupIndices:[],groupOffsetTree:bb(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:bb()},A=Ww(Pw(n,qw(s,e,p),Bw(Gb,m),Tw()),m),g=Ww(Pw(s,Tw(),Bw((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),Fw(({prev:e})=>e)),[]);Ow(Pw(s,Dw(e=>e.length>0),qw(A,p),Fw(([e,t,n])=>{const r=e.reduce((e,r,i)=>wb(e,r,Ub(r,t.offsetTree,n)||i),bb());return{...t,groupIndices:e,groupOffsetTree:r}})),A),Ow(Pw(r,qw(A),Dw(([e,{lastIndex:t}])=>e<t),Fw(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),Ow(c,d);const v=Ww(Pw(c,Fw(e=>void 0===e)),!0);Ow(Pw(d,Dw(e=>void 0!==e&&gb(Zw(A).sizeTree)),Fw(e=>{const t=Zw(u),n=Zw(s).length>0;return void 0!==t&&0!==t?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),Ow(Pw(f,Dw(e=>void 0!==e&&e.length>0&&gb(Zw(A).sizeTree)),Fw(e=>{const t=[];let n=e[0],r=0;for(let i=1;i<e.length;i++){const a=e[i];a!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=a,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),Ow(Pw(s,qw(u,d),Dw(([,e,t])=>void 0!==e&&void 0!==t),Fw(([e,t,n])=>{const r=[];for(let i=0;i<e.length;i++){const a=e[i],o=e[i+1];r.push({startIndex:a,endIndex:a,size:t}),void 0!==o&&r.push({startIndex:a+1,endIndex:o-1,size:n})}return r})),n);const y=Qw(Pw(n,qw(A),Bw(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:m}),Fw(e=>e.changed)));Vw(Pw(l,Bw((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),Fw(e=>e.diff)),e=>{const{groupIndices:n}=Zw(A);if(e>0)kw(t,!0),kw(a,e+Kb(e,n));else if(e<0){const t=Zw(g);t.length>0&&(e-=Kb(-e,t)),kw(o,e)}}),Vw(Pw(l,qw(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},ib)});const w=Qw(a);Ow(Pw(a,qw(A),Fw(([e,t])=>{const n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){const n=vb(t.sizeTree,0);let a=0,o=0;for(;a<e;){const e=t.groupIndices[o],l=t.groupIndices.length===o+1?1/0:t.groupIndices[o+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+l-1,size:i,startIndex:e+1}),o++,a+=l+1}const l=Lb(t.sizeTree);return a!==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 Lb(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 b=Qw(Pw(o,qw(A,p),Fw(([e,{offsetTree:t},n])=>Ub(-e,t,n))));return Ow(Pw(o,qw(A,p),Fw(([e,t,n])=>{if(t.groupIndices.length>0){if(gb(t.sizeTree))return t;let r=bb();const i=Zw(g);let a=0,o=0,l=0;for(;a<-e;){l=i[o];const e=i[o+1]-l-1;o++,a+=e+1}if(r=Lb(t.sizeTree).reduce((t,{k:n,v:r})=>wb(t,Math.max(0,n+e),r),r),a!==-e){r=wb(r,0,vb(t.sizeTree,l));r=wb(r,1,yb(t.sizeTree,1-e)[1])}return{...t,sizeTree:r,...Yb(t.offsetTree,0,r,n)}}const r=Lb(t.sizeTree).reduce((t,{k:n,v:r})=>wb(t,Math.max(0,n+e),r),bb());return{...t,sizeTree:r,...Yb(t.offsetTree,0,r,n)}})),A),{beforeUnshiftWith:w,data:C,defaultItemSize:d,firstItemIndex:l,fixedItemSize:c,fixedGroupSize:u,gap:p,groupIndices:s,heightEstimates:f,itemSize:h,listRefresh:y,shiftWith:o,shiftWithOffset:b,sizeRanges:n,sizes:A,statefulTotalCount:i,totalCount:r,trackItemSizes:v,unshiftWith:a}},xw(ob,Fb),{singleton:!0});function nE(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}const rE=Kw(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{const a=Xw(),o=Xw(),l=Qw(Pw(a,Fw(nE)));return Ow(Pw(l,Fw(e=>e.totalCount)),n),Ow(Pw(l,Fw(e=>e.groupIndices)),e),Ow(Pw(Jw(i,t,r),Dw(([e,t])=>jb(t)),Fw(([e,t,n])=>yb(t.groupOffsetTree,Math.max(e-n,0),"v")[0]),Tw(),Fw(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},xw(tE,pb)),iE=Kw(([{log:e}])=>{const t=Uw(!1),n=Qw(Pw(t,Dw(e=>e),Tw()));return Vw(t,t=>{t&&Zw(e)("props updated",{},tb)}),{didMount:n,propsReady:t}},xw(ob),{singleton:!0}),aE=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function oE(e){const t="number"==typeof e?{index:e}:{...e};return t.align||(t.align="start"),(!t.behavior||!aE)&&(t.behavior="auto"),void 0===t.offset&&(t.offset=0),t}const lE=Kw(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:l,scrollingInProgress:s,scrollTo:c,smoothScrollTargetReached:d,viewportHeight:u},{log:f}])=>{const h=Xw(),C=Xw(),p=Uw(0);let m=null,A=null,g=null;function v(){null!==m&&(m(),m=null),null!==g&&(g(),g=null),A&&(clearTimeout(A),A=null),kw(s,!1)}return Ow(Pw(h,qw(n,u,r,p,l,o,f),qw(e,a,i),Fw(([[e,n,r,i,a,o,l,c],u,f,p])=>{const y=oE(e),{align:w,behavior:b,offset:E}=y,M=i-1,L=Xb(y,n,M);let H=Ub(L,n.offsetTree,u)+o;"end"===w?(H+=f+yb(n.sizeTree,L)[1]-r+p,L===M&&(H+=l)):"center"===w?H+=(f+yb(n.sizeTree,L)[1]-r+p)/2:H-=a,void 0!==E&&0!==E&&(H+=E);const x=t=>{v(),t?(c("retrying to scroll to",{location:e},tb),kw(h,e)):(kw(C,!0),c("list did not change, scroll successful",{},tb))};if(v(),"smooth"===b){let e=!1;g=Vw(t,t=>{e=e||t}),m=zw(d,()=>{x(e)})}else m=zw(Pw(t,function(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}(150)),x);return A=setTimeout(()=>{v()},1200),kw(s,!0),c("scrolling from index to",{behavior:b,index:L,top:H},tb),{behavior:b,top:H}})),c),{scrollTargetReached:C,scrollToIndex:h,topListHeight:p}},xw(tE,pb,ob),{singleton:!0});function sE(e,t){0===e?t():requestAnimationFrame(()=>{sE(e-1,t)})}function cE(e,t){if(void 0===e)return 0;const n=t-1,r="number"==typeof e?e:"LAST"===e.index?n:e.index;return Math.max(0,Math.min(r,n))}function dE(e){return void 0===e||("number"==typeof e?0===e:!(0!==e.index||void 0!==e.align&&"start"!==e.align||void 0!==e.offset&&0!==e.offset))}const uE=Kw(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{const l=Uw(!0),s=Uw(0),c=Uw(!0);return Ow(Pw(o,qw(s),Dw(([e,t])=>!dE(t)),Rw(!1)),l),Ow(Pw(o,qw(s),Dw(([e,t])=>!dE(t)),Rw(!1)),c),Vw(Pw(Jw(t,o),qw(l,n,e,c),Dw(([[,e],t,{sizeTree:n},r,i])=>e&&(!gb(n)||Ew(r))&&!t&&!i),qw(s)),([,e])=>{if(void 0===e)return kw(l,!0),void kw(c,!0);zw(i,()=>{kw(c,!0)}),sE(4,()=>{zw(r,()=>{kw(l,!0)}),kw(a,e)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:s,scrolledToInitialItem:l}},xw(tE,pb,lE,iE),{singleton:!0});function fE(e,t){return Math.abs(e-t)<1.01}const hE="up",CE="down",pE={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},mE=Kw(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{const o=Uw(!1),l=Uw(!0),s=Xw(),c=Xw(),d=Uw(4),u=Uw(0),f=Ww(Pw(eb(Pw($w(i),jw(1),Rw(!0)),Pw($w(i),jw(1),Rw(!1),Nw(100))),Tw()),!1),h=Ww(Pw(eb(Pw(n,Rw(!0)),Pw(n,Rw(!1),Nw(200))),Tw()),!1);Ow(Pw(Jw($w(i),$w(u)),Fw(([e,t])=>e<=t),Tw()),l),Ow(Pw(l,_w(50)),c);const C=Qw(Pw(Jw(r,$w(a),$w(t),$w(e),$w(d)),Bw((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{const l={scrollHeight:t,scrollTop:n,viewportHeight:r};if(n+r-t>-o){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}},pE),Tw((e,t)=>void 0!==e&&e.atBottom===t.atBottom))),p=Ww(Pw(r,Bw((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!fE(e.scrollHeight,t)){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}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Dw(e=>e.changed),Fw(e=>e.jump)),0);Ow(Pw(C,Fw(e=>e.atBottom)),o),Ow(Pw(o,_w(50)),s);const m=Uw(CE);Ow(Pw(r,Fw(({scrollTop:e})=>e),Tw(),Bw((e,t)=>Zw(h)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?hE:CE,prevScrollTop:t},{direction:CE,prevScrollTop:0}),Fw(e=>e.direction)),m),Ow(Pw(r,_w(50),Rw("none")),m);const A=Uw(0);return Ow(Pw(f,Dw(e=>!e),Rw(0)),A),Ow(Pw(i,_w(100),qw(f),Dw(([e,t])=>t),Bw(([e,t],[n])=>[t,n],[0,0]),Fw(([e,t])=>t-e)),A),{atBottomState:C,atBottomStateChange:s,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:u,isAtBottom:o,isAtTop:l,isScrolling:f,lastJumpDueToItemResize:p,scrollDirection:m,scrollVelocity:A}},xw(pb)),AE="top",gE="bottom",vE="none";function yE(e,t,n){return"number"==typeof e?n===hE&&t===AE||n===CE&&t===gE?e:0:n===hE?t===AE?e.main:e.reverse:t===gE?e.main:e.reverse}function wE(e,t){return"number"==typeof e?e:e[t]??0}const bE=Kw(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{const a=Xw(),o=Uw(0),l=Uw(0),s=Uw(0);return{increaseViewportBy:l,listBoundary:a,overscan:s,topListHeight:o,visibleRange:Ww(Pw(Jw($w(r),$w(i),$w(n),$w(a,Db),$w(s),$w(o),$w(t),$w(e),$w(l)),Fw(([e,t,n,[r,i],a,o,l,s,c])=>{const d=e-s,u=o+l,f=Math.max(n-d,0);let h=vE;const C=wE(c,AE),p=wE(c,gE);return r-=s,i+=n+l,(r+=n+l)>e+u-C&&(h=hE),(i-=s)<e-f+t+p&&(h=CE),h!==vE?[Math.max(d-n-yE(a,AE,h)-C,0),d-f-l+t+yE(a,gE,h)+p]:null}),Dw(e=>null!==e),Tw(Db)),[0,0])}},xw(pb),{singleton:!0});const EE={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ME(e,t,n,r,i,a){const{lastIndex:o,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-o,f=c,h=l+u*s+(u-1)*r-d;return{bottom:d,firstItemIndex:a,items:HE(e,i,a),offsetBottom:h,offsetTop:c,top:f,topItems:HE(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function LE(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(const t of n.groupIndices){if(t-o>=e)break;o++}const l=e+o,s=cE(t,l);return ME(Array.from({length:l}).map((e,t)=>({data:a[t+s],index:t+s,offset:0,size:0})),[],l,i,n,r)}function HE(e,t,n){if(0===e.length)return[];if(!jb(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));const r=e[0].index,i=e[e.length-1].index,a=[],o=Eb(t.groupOffsetTree,r,i);let l,s=0;for(const r of e){let e;(!l||l.end<r.index)&&(l=o.shift(),s=t.groupIndices.indexOf(l.start)),e=r.index===l.start?{index:s,type:"group"}:{groupIndex:s,index:r.index-(s+1)+n},a.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return a}function xE(e,t){return void 0===e?0:"number"==typeof e?e:e[t]??0}const VE=Kw(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},a,{listBoundary:o,topListHeight:l,visibleRange:s},{initialTopMostItemIndex:c,scrolledToInitialItem:d},{topListHeight:u},f,{didMount:h},{recalcInProgress:C}])=>{const p=Uw([]),m=Uw(0),A=Xw(),g=Uw(0);Ow(a.topItemsIndexes,p);const v=Ww(Pw(Jw(h,C,$w(s,Db),$w(i),$w(r),$w(c),d,$w(p),$w(t),$w(n),$w(g),e),Dw(([e,t,,n,,,,,,,,r])=>{const i=void 0!==r&&r.length!==n;return e&&!t&&!i}),Fw(([,,[e,t],n,r,i,a,o,l,s,c,d])=>{const u=r,{offsetTree:f,sizeTree:h}=u,C=Zw(m);if(0===n)return{...EE,totalCount:n};if(0===e&&0===t)return 0===C?{...EE,totalCount:n}:LE(C,i,r,l,s,d||[]);if(gb(h))return C>0?null:ME(function(e,t,n){if(jb(t)){const r=Wb(e,t);return[{index:yb(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}(cE(i,n),u,d),[],n,s,u,l);const p=[];if(o.length>0){const e=o[0],t=o[o.length-1];let n=0;for(const r of Eb(h,e,t)){const i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)p.push({data:d?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return ME([],p,n,s,u,l);const A=o.length>0?o[o.length-1]+1:0,g=Qb(f,e,t,A);if(0===g.length)return null;const v=n-1,y=Lw([],n=>{for(const r of g){const i=r.value;let a=i.offset,o=r.start;const l=i.size;if(i.offset<e){o+=Math.floor((e-i.offset+s)/(l+s));const t=o-r.start;a+=t*l+t*s}o<A&&(a+=(A-o)*l,o=A);const c=Math.min(r.end,v);for(let e=o;e<=c&&!(a>=t);e++)n.push({data:d?.[e],index:e,offset:a,size:l}),a+=l+s}}),w=xE(c,AE),b=xE(c,gE);if(y.length>0&&(w>0||b>0)){const e=y[0],t=y[y.length-1];if(w>0&&e.index>A){const t=Math.min(w,e.index-A),n=[];let r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){const t=Eb(h,i,i)[0]?.value??e.size;r-=t+s,n.unshift({data:d?.[i],index:i,offset:r,size:t})}y.unshift(...n)}if(b>0&&t.index<v){const e=Math.min(b,v-t.index);let n=t.offset+t.size+s;for(let r=t.index+1;r<=t.index+e;r++){const e=Eb(h,r,r)[0]?.value??t.size;y.push({data:d?.[r],index:r,offset:n,size:e}),n+=e+s}}}return ME(y,p,n,s,u,l)}),Dw(e=>null!==e),Tw()),EE);Ow(Pw(e,Dw(Ew),Fw(e=>e?.length)),i),Ow(Pw(v,Fw(e=>e.topListHeight)),u),Ow(u,l),Ow(Pw(v,Fw(e=>[e.top,e.bottom])),o),Ow(Pw(v,Fw(e=>e.items)),A);const y=Qw(Pw(v,Dw(({items:e})=>e.length>0),qw(i,e),Dw(([{items:e},t])=>e[e.length-1].originalIndex===t-1),Fw(([,e,t])=>[e-1,t]),Tw(Db),Fw(([e])=>e))),w=Qw(Pw(v,_w(200),Dw(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),Fw(({items:e})=>e[0].index),Tw())),b=Qw(Pw(v,Dw(({items:e})=>e.length>0),Fw(({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}}),Tw(Tb)));return{endReached:y,initialItemCount:m,itemsRendered:A,listState:v,minOverscanItemCount:g,rangeChanged:b,startReached:w,topItemsIndexes:p,...f}},xw(tE,rE,bE,uE,lE,mE,iE,Fb),{singleton:!0}),kE=Kw(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{const a=Xw(),o=Ww(Pw(Jw(n,e,r,t,i),Fw(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return Ow($w(o),a),{totalListHeight:o,totalListHeightChanged:a}},xw(pb,VE),{singleton:!0}),SE=Kw(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Uw(!1);return{alignToBottom:n,paddingTopAddition:Ww(Pw(Jw(n,e,t),Dw(([e])=>e),Fw(([,e,t])=>Math.max(0,e-t)),_w(0),Tw()),0)}},xw(pb,kE),{singleton:!0}),ZE=Kw(()=>({context:Uw(null)})),OE=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>t<o?{...i,align:n??"start",...void 0===r?{}:{behavior:r}}:e>a?{...i,align:n??"end",...void 0===r?{}:{behavior:r}}:null,zE=Kw(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:l,viewportHeight:s},{scrollToIndex:c}])=>{const d=Xw();return Ow(Pw(d,qw(t,s,n,a,i,r,l),qw(e),Fw(([[e,t,n,r,i,a,l,s],c])=>{const{calculateViewLocation:d=OE,done:u,...f}=e,h=Xb(e,t,r-1),C=Ub(h,t.offsetTree,c)+i+a,p=d({itemBottom:C+yb(t.sizeTree,h)[1],itemTop:C,locationParams:f,viewportBottom:s+n-l,viewportTop:s+a});return null===p?u?.():u&&zw(Pw(o,Dw(e=>!e),jw(Zw(o)?1:2)),u),p}),Dw(e=>null!==e)),c),{scrollIntoView:d}},xw(tE,pb,lE,VE,ob),{singleton:!0});function NE(e){return!1!==e&&("smooth"===e?"smooth":"auto")}const IE=Kw(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:l},{didMount:s,propsReady:c},{log:d},{scrollingInProgress:u},{context:f},{scrollIntoView:h}])=>{const C=Uw(!1),p=Xw();let m=null;function A(e){kw(o,{align:"end",behavior:e,index:"LAST"})}function g(e){const t=zw(i,t=>{e&&!t.atBottom&&"SIZE_INCREASED"===t.notAtBottomBecause&&null===m&&(Zw(d)("scrolling to bottom due to increased size",{},tb),A("auto"))});setTimeout(t,100)}Vw(Pw(Jw(Pw($w(t),jw(1)),s),qw($w(C),a,l,u),Fw(([[e,t],n,r,i,a])=>{let o=t&&i,l="auto";return o&&(l=((e,t)=>"function"==typeof e?NE(e(t)):t&&NE(e))(n,r||a),o=o&&!1!==l),{followOutputBehavior:l,shouldFollow:o,totalCount:e}}),Dw(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{null!==m&&(m(),m=null),void 0===Zw(n)?m=zw(e,()=>{Zw(d)("following output to ",{totalCount:r},tb),A(t),m=null}):requestAnimationFrame(()=>{Zw(d)("following output to ",{totalCount:r},tb),A(t)})}),Vw(Pw(Jw($w(C),t,c),Dw(([e,,t])=>!1!==e&&t),Bw(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),Dw(({refreshed:e})=>e),qw(C,t)),([,e])=>{Zw(l)&&g(!1!==e)}),Vw(p,()=>{g(!1!==Zw(C))}),Vw(Jw($w(C),i),([e,t])=>{!1!==e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&A("auto")});const v=Uw(null),y=Xw();return Ow(eb(Pw($w(r),Fw(e=>e?.length??0)),Pw($w(t))),y),Vw(Pw(Jw(Pw(y,jw(1)),s),qw($w(v),l,u,f),Fw(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),Dw(e=>!!e),_w(0)),t=>{null!==m&&(m(),m=null),void 0===Zw(n)?m=zw(e,()=>{Zw(d)("scrolling into view",{}),kw(h,t),m=null}):requestAnimationFrame(()=>{Zw(d)("scrolling into view",{}),kw(h,t)})}),{autoscrollToBottom:p,followOutput:C,scrollIntoViewOnChange:v}},xw(tE,mE,lE,uE,iE,ob,pb,ZE,zE)),TE=Kw(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:l}])=>(Ow(Pw(l,qw(a),Dw(([,e])=>0!==e),qw(i,r,t,n,e),Fw(([[,e],t,n,r,i,a=[]])=>LE(e,t,n,r,i,a))),o),{}),xw(tE,uE,VE,iE),{singleton:!0}),DE=Kw(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Uw(0);return Vw(Pw(e,qw(r),Dw(([,e])=>0!==e),Fw(([,e])=>({top:e}))),e=>{zw(Pw(n,jw(1),Dw(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{kw(t,e)})})}),{initialScrollTop:r}},xw(iE,pb,VE),{singleton:!0}),FE=Kw(([{scrollVelocity:e}])=>{const t=Uw(!1),n=Xw(),r=Uw(!1);return Ow(Pw(e,qw(r,t,n),Dw(([e,t])=>!1!==t&&void 0!==t),Fw(([e,t,n,r])=>{const{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),Tw()),t),Vw(Pw(Jw(t,e,n),qw(r)),([[e,t,n],r])=>{e&&!1!==r&&void 0!==r&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},xw(mE),{singleton:!0}),RE=Kw(([{scrollContainerState:e,scrollTo:t}])=>{const n=Xw(),r=Xw(),i=Xw(),a=Uw(!1),o=Uw(void 0);return Ow(Pw(Jw(n,r),Fw(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),Ow(Pw(t,qw(r),Fw(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},xw(pb)),PE=Kw(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:l,windowViewportRect:s}])=>{const c=Xw(),d=Uw(void 0),u=Uw(null),f=Uw(null);return Ow(l,u),Ow(s,f),Vw(Pw(c,qw(t,r,o,u,f,n)),([e,t,n,r,i,a,o])=>{const l=function(e){return Lb(e).map(({k:e,v:t},n,r)=>{const i=r[n+1];return{endIndex:void 0===i?1/0:i.k-1,size:t,startIndex:e}})}(t.sizeTree);r&&null!==i&&null!==a&&(n=i.scrollTop-a.offsetTop),e({ranges:l,scrollTop:n-=o})}),Ow(Pw(d,Dw(Ew),Fw(BE)),i),Ow(Pw(a,qw(d),Dw(([,e])=>void 0!==e),Tw(),Fw(([,e])=>e.ranges)),e),{getState:c,restoreStateFrom:d}},xw(tE,pb,uE,iE,RE));function BE(e){return{align:"start",index:0,offset:e.scrollTop}}const jE=Kw(([{topItemsIndexes:e}])=>{const t=Uw(0);return Ow(Pw(t,Dw(e=>e>=0),Fw(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},xw(VE));function _E(e){let t,n=!1;return()=>(n||(n=!0,t=e()),t)}const qE=_E(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),UE=Kw(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:l},{listState:s},{beforeUnshiftWith:c,gap:d,shiftWithOffset:u,sizes:f},{log:h},{recalcInProgress:C}])=>{const p=Qw(Pw(s,qw(o),Bw(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},l])=>{const s=r+a;let c=0;return t===o&&e.length>0&&i.length>0&&(0===i[0].originalIndex&&0===e[0].originalIndex||(c=s-n,0!==c&&(c+=l))),[c,i,o,s]},[0,[],0,0]),Dw(([e])=>0!==e),qw(r,l,n,i,h,C),Dw(([,e,t,n,,,r])=>!r&&!n&&0!==e&&t===hE),Fw(([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},tb),e))));function m(n){n>0?(kw(t,{behavior:"auto",top:-n}),kw(e,0)):(kw(e,0),kw(t,{behavior:"auto",top:-n}))}return Vw(Pw(p,qw(e,a)),([t,n,r])=>{r&&qE()?kw(e,n-t):m(-t)}),Vw(Pw(Jw(Ww(a,!1),e,C),Dw(([e,t,n])=>!e&&!n&&0!==t),Fw(([e,t])=>t),_w(1)),m),Ow(Pw(u,Fw(e=>({top:-e}))),t),Vw(Pw(c,qw(f,d),Fw(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(0===t.length)return a(e);let o=0;const l=vb(r,0);let s=0,c=0;for(;s<e;){s++,o+=l;let n=t.length===c+1?1/0:t[c+1]-t[c]-1;s+n>e&&(o-=l,n=e-s+1),s+=n,o+=a(n),c++}return o})),n=>{kw(e,n),requestAnimationFrame(()=>{kw(t,{top:n}),requestAnimationFrame(()=>{kw(e,0),kw(C,!1)})})}),{deviation:e}},xw(pb,mE,VE,tE,ob,Fb)),WE=Kw(([e,t,n,r,i,a,o,l,s,c,d])=>({...e,...t,...n,...r,...i,...a,...o,...l,...s,...c,...d}),xw(bE,TE,iE,FE,kE,DE,SE,RE,zE,ob,ZE)),XE=Kw(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:l,itemSize:s,sizeRanges:c,sizes:d,statefulTotalCount:u,totalCount:f,trackItemSizes:h},{initialItemFinalLocationReached:C,initialTopMostItemIndex:p,scrolledToInitialItem:m},A,g,v,y,{scrollToIndex:w},b,{topItemCount:E},{groupCounts:M},L])=>{const{listState:H,minOverscanItemCount:x,topItemsIndexes:V,rangeChanged:k,...S}=y;return Ow(k,L.scrollSeekRangeChanged),Ow(Pw(Jw(L.windowViewportRect,A.headerHeight,A.fixedHeaderHeight),Fw(([e,t,n])=>Math.max(t+n+1,e.visibleHeight))),A.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:M,heightEstimates:l,initialItemFinalLocationReached:C,initialTopMostItemIndex:p,scrolledToInitialItem:m,sizeRanges:c,topItemCount:E,topItemsIndexes:V,totalCount:f,...v,groupIndices:o,itemSize:s,listState:H,minOverscanItemCount:x,scrollToIndex:w,statefulTotalCount:u,trackItemSizes:h,rangeChanged:k,...S,...L,...A,sizes:d,...g}},xw(tE,uE,pb,PE,IE,VE,lE,UE,jE,rE,WE));function QE(e,t){const n={},r={};let i=0;const a=e.length;for(;i<a;)r[e[i]]=1,i+=1;for(const e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}const GE=typeof document>"u"?i.useEffect:i.useLayoutEffect;function KE(t,n,r){const a=Object.keys(n.required||{}),o=Object.keys(n.optional||{}),l=Object.keys(n.methods||{}),s=Object.keys(n.events||{}),c=i.createContext({});function d(e,t){void 0!==e.propsReady&&kw(e.propsReady,!1);for(const r of a){kw(e[n.required[r]],t[r])}for(const r of o)if(r in t){kw(e[n.optional[r]],t[r])}void 0!==e.propsReady&&kw(e.propsReady,!0)}function u(e){return s.reduce((t,r)=>(t[r]=function(e){let t,n;const r=()=>t?.();return function(i,a){switch(i){case 1:return a?n===a?void 0:(r(),n=a,t=Vw(e,a),t):(r(),Mw);case 2:return r(),void(n=null)}}}(e[n.events[r]]),t),{})}const f=i.forwardRef(function(f,h){const{children:C,...p}=f,[m]=i.useState(()=>Lw(function(e){const t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);const o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}(t),e=>{d(e,p)})),[A]=i.useState(bw(u,m));var g;GE(()=>{for(const e of s)e in p&&Vw(A[e],p[e]);return()=>{Object.values(A).map(Sw)}},[p,A,m]),GE(()=>{d(m,p)}),i.useImperativeHandle(h,vw((g=m,l.reduce((e,t)=>(e[t]=e=>{kw(g[n.methods[t]],e)},e),{}))));const v=r;return e(c.Provider,{value:m,children:void 0===r?C:e(v,{...QE([...a,...o,...s],p),children:C})})});return{Component:f,useEmitter:(e,t)=>{const n=i.useContext(c)[e];GE(()=>Vw(n,t),[t,n])},useEmitterValue:parseInt(i.version,10)>=18?e=>{const t=i.useContext(c)[e],n=i.useCallback(e=>Vw(t,e),[t]);return i.useSyncExternalStore(n,()=>Zw(t),()=>Zw(t))}:e=>{const t=i.useContext(c)[e],[n,r]=i.useState(bw(Zw,t));return GE(()=>Vw(t,e=>{e!==n&&r(vw(e))}),[t,n]),n},usePublisher:e=>{const t=i.useContext(c);return i.useCallback(n=>{kw(t[e],n)},[t,e])}}}const YE=i.createContext(void 0),JE=i.createContext(void 0),$E="-webkit-sticky",eM="sticky",tM=_E(()=>{if(typeof document>"u")return eM;const e=document.createElement("div");return e.style.position=$E,e.style.position===$E?$E:eM}),nM=typeof document>"u"?i.useEffect:i.useLayoutEffect;function rM(e){return"self"in e}function iM(e,t,n,r=Mw,a,o){const l=i.useRef(null),s=i.useRef(null),c=i.useRef(null),d=i.useCallback(n=>{let r,i,a;const l=n.target;if(function(e){return"body"in e}(l)||rM(l)){const e=rM(l)?l:l.defaultView;a=!0===o?sb(e,e.scrollX):e.scrollY,r=!0===o?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=!0===o?e.innerWidth:e.innerHeight}else a=!0===o?sb(l,l.scrollLeft):l.scrollTop,r=!0===o?l.scrollWidth:l.scrollHeight,i=!0===o?l.offsetWidth:l.offsetHeight;const d=()=>{e({scrollHeight:r,scrollTop:Math.max(a,0),viewportHeight:i})};!0===n.suppressFlushSync?d():M.flushSync(d),null!==s.current&&(a===s.current||a<=0||a===r-i)&&(s.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t,o]);return i.useEffect(()=>{const e=a??l.current;return r(a??l.current),d({suppressFlushSync:!0,target:e}),e.addEventListener("scroll",d,{passive:!0}),()=>{r(null),e.removeEventListener("scroll",d)}},[l,d,n,r,a]),{scrollByCallback:function(e){!0===o&&(e={...void 0===e.behavior?{}:{behavior:e.behavior},...void 0===e.top?{}:{left:cb(l.current,e.top)}}),l.current.scrollBy(e)},scrollerRef:l,scrollToCallback:function(n){const r=l.current;if(!r||(!0===o?"offsetWidth"in r&&0===r.offsetWidth:"offsetHeight"in r&&0===r.offsetHeight))return;const i="smooth"===n.behavior;let a,d,u;rM(r)?(d=Math.max(Bb(r.document.documentElement,!0===o?"width":"height"),!0===o?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),a=!0===o?r.innerWidth:r.innerHeight,u=!0===o?sb(r,r.scrollX):r.scrollY):(d=r[!0===o?"scrollWidth":"scrollHeight"],a=Bb(r,!0===o?"width":"height"),u=!0===o?sb(r,r.scrollLeft):r.scrollTop);const f=d-a;if(void 0===n.top)return void r.scrollTo(n);const h=Math.ceil(Math.max(Math.min(f,n.top),0));if(n.top=h,fE(a,d)||h===u)return e({scrollHeight:d,scrollTop:u,viewportHeight:a}),void(i&&t(!0));i?(s.current=h,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,!0===o&&(n={...void 0===n.behavior?{}:{behavior:n.behavior},left:cb(r,h)}),r.scrollTo(n)}}}function aM(e){return e}const oM=Kw(()=>{const e=Uw(e=>`Item ${e}`),t=Uw(e=>`Group ${e}`),n=Uw({}),r=Uw(aM),i=Uw("div"),a=Uw(Mw),o=(e,t=null)=>Ww(Pw(n,Fw(t=>t[e]),Tw()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o("EmptyPlaceholder"),FooterComponent:o("Footer"),GroupComponent:o("Group","div"),groupContent:t,HeaderComponent:o("Header"),HeaderFooterTag:i,ItemComponent:o("Item","div"),itemContent:e,ListComponent:o("List","div"),ScrollerComponent:o("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:o("ScrollSeekPlaceholder"),TopItemListComponent:o("TopItemList")}}),lM=Kw(([e,t])=>({...e,...t}),xw(XE,oM)),sM=({height:t})=>e("div",{style:{height:t}}),cM={overflowAnchor:"none",position:tM(),zIndex:1},dM={overflowAnchor:"none"},uM={...dM,display:"inline-block",height:"100%"},fM=i.memo(function({showTopList:t=!1}){const n=SM("listState"),r=ZM("sizeRanges"),a=SM("useWindowScroll"),o=SM("customScrollParent"),l=ZM("windowScrollContainerState"),s=ZM("scrollContainerState"),c=o||a?l:s,d=SM("itemContent"),u=SM("context"),f=SM("groupContent"),h=SM("trackItemSizes"),C=SM("itemSize"),p=SM("log"),A=ZM("gap"),g=SM("horizontalDirection"),{callbackRef:v}=fb(r,C,h,t?Mw:c,p,A,o,g,SM("skipAnimationFrameInResizeObserver")),[y,w]=i.useState(0);kM("deviation",e=>{y!==e&&w(e)});const b=SM("EmptyPlaceholder"),E=SM("ScrollSeekPlaceholder")??sM,M=SM("ListComponent"),L=SM("ItemComponent"),H=SM("GroupComponent"),x=SM("computeItemKey"),V=SM("isSeeking"),k=SM("groupIndices").length>0,S=SM("alignToBottom"),Z=SM("initialItemFinalLocationReached"),O=t?{}:{boxSizing:"border-box",...g?{display:"inline-block",height:"100%",marginInlineStart:0===y?S?"auto":0:y,paddingInlineEnd:n.offsetBottom,paddingInlineStart:n.offsetTop,whiteSpace:"nowrap"}:{marginTop:0===y?S?"auto":0:y,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...Z?{}:{visibility:"hidden"}};return t||0!==n.totalCount||null==b?e(M,{...gM(M,u),"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",ref:v,style:O,children:(t?n.topItems:n.items).map(e=>{const t=e.originalIndex,r=x(t+n.firstItemIndex,e.data,u);return V?m(E,{...gM(E,u),height:e.size,index:e.index,key:r,type:e.type||"item",..."group"===e.type?{}:{groupIndex:e.groupIndex}}):"group"===e.type?m(H,{...gM(H,u),"data-index":t,"data-item-index":e.index,"data-known-size":e.size,key:r,style:cM},f(e.index,u)):m(L,{...gM(L,u),...vM(L,e.data),"data-index":t,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:g?uM:dM},k?d(e.index,e.groupIndex,e.data,u):d(e.index,e.data,u))})}):e(b,{...gM(b,u)})}),hM={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},CM={outline:"none",overflowX:"auto",position:"relative"},pM=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),mM=(e,t,n=0)=>({...pM(e),position:t?"relative":"absolute",top:t?-n:0}),AM={position:tM(),top:0,width:"100%",zIndex:1};function gM(e,t){if("string"!=typeof e)return{context:t}}function vM(e,t){return{item:"string"==typeof e?void 0:t}}const yM=i.memo(function(){const t=SM("HeaderComponent"),n=ZM("headerHeight"),r=SM("HeaderFooterTag"),a=db(i.useMemo(()=>e=>{n(Bb(e,"height"))},[n]),!0,SM("skipAnimationFrameInResizeObserver")),o=SM("context");return null!=t?e(r,{ref:a,children:e(t,{...gM(t,o)})}):null}),wM=i.memo(function(){const t=SM("FooterComponent"),n=ZM("footerHeight"),r=SM("HeaderFooterTag"),a=db(i.useMemo(()=>e=>{n(Bb(e,"height"))},[n]),!0,SM("skipAnimationFrameInResizeObserver")),o=SM("context");return null!=t?e(r,{ref:a,children:e(t,{...gM(t,o)})}):null});function bM({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:i,style:a,context:o,...l}){const s=r("scrollContainerState"),c=n("ScrollerComponent"),d=r("smoothScrollTargetReached"),u=n("scrollerRef"),f=n("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:C,scrollToCallback:p}=iM(s,d,c,u,void 0,f);return t("scrollTo",p),t("scrollBy",h),e(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:C,style:{...f?CM:hM,...a},tabIndex:0,...l,...gM(c,o),children:i})})}function EM({useEmitter:t,useEmitterValue:n,usePublisher:r}){return i.memo(function({children:a,style:o,context:l,...s}){const c=r("windowScrollContainerState"),d=n("ScrollerComponent"),u=r("smoothScrollTargetReached"),f=n("totalListHeight"),h=n("deviation"),C=n("customScrollParent"),p=i.useRef(null),m=n("scrollerRef"),{scrollByCallback:A,scrollerRef:g,scrollToCallback:v}=iM(c,u,d,m,C);return nM(()=>(g.current=C??p.current?.ownerDocument.defaultView,()=>{g.current=null}),[g,C]),t("windowScrollTo",v),t("scrollBy",A),e(d,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...0===f?void 0:{height:f+h}},...s,...gM(d,l),children:a})})}const MM=({children:t})=>{const n=i.useContext(YE),r=ZM("viewportHeight"),a=ZM("fixedItemHeight"),o=SM("alignToBottom"),l=SM("horizontalDirection"),s=db(i.useMemo(()=>ww(r,e=>Bb(e,l?"width":"height")),[r,l]),!0,SM("skipAnimationFrameInResizeObserver"));return i.useEffect(()=>{n&&(r(n.viewportHeight),a(n.itemHeight))},[n,r,a]),e("div",{"data-viewport-type":"element",ref:s,style:pM(o),children:t})},LM=({children:t})=>{const n=i.useContext(YE),r=ZM("windowViewportRect"),a=ZM("fixedItemHeight"),o=SM("customScrollParent"),l=SM("useWindowScroll"),s=SM("topListHeight"),c=Cb(r,o,SM("skipAnimationFrameInResizeObserver")),d=SM("alignToBottom");return i.useEffect(()=>{n&&(a(n.itemHeight),r({listHeight:0,offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:100}))},[n,r,a]),e("div",{"data-viewport-type":"window",ref:c,style:mM(d,l,s),children:t})},HM=({children:t})=>{const n=SM("TopItemListComponent")??"div",r=SM("headerHeight"),i={...AM,marginTop:`${r}px`},a=SM("context");return e(n,{style:i,...gM(n,a),children:t})},xM=i.memo(function(t){const r=SM("useWindowScroll"),i=SM("topItemsIndexes").length>0,a=SM("customScrollParent"),o=SM("context");return n(a||r?zM:OM,{...t,context:o,children:[i&&e(HM,{children:e(fM,{showTopList:!0})}),n(a||r?LM:MM,{children:[e(yM,{}),e(fM,{}),e(wM,{})]})]})}),{Component:VM,useEmitter:kM,useEmitterValue:SM,usePublisher:ZM}=KE(lM,{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"}},xM),OM=bM({useEmitter:kM,useEmitterValue:SM,usePublisher:ZM}),zM=EM({useEmitter:kM,useEmitterValue:SM,usePublisher:ZM}),NM=VM,IM=Kw(()=>{const e=Uw(e=>n("td",{children:["Item $",e]})),t=Uw(null),r=Uw(e=>n("td",{colSpan:1e3,children:["Group ",e]})),i=Uw(null),a=Uw(null),o=Uw({}),l=Uw(aM),s=Uw(Mw),c=(e,t=null)=>Ww(Pw(o,Fw(t=>t[e]),Tw()),t);return{components:o,computeItemKey:l,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:a,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")}});xw(XE,IM),tM();const TM={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},DM={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:FM,floor:RM,max:PM,min:BM,round:jM}=Math;function _M(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:null===n?null:n[r+e],index:r+e}))}function qM(e,t){return void 0!==e&&e.width===t.width&&e.height===t.height}function UM(e,t){return void 0!==e&&e.column===t.column&&e.row===t.row}const WM=Kw(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:l,scrollTo:s,scrollTop:c,smoothScrollTargetReached:d,viewportHeight:u},f,h,{didMount:C,propsReady:p},{customScrollParent:m,useWindowScroll:A,windowScrollContainerState:g,windowScrollTo:v,windowViewportRect:y},w])=>{const b=Uw(0),E=Uw(0),M=Uw(TM),L=Uw({height:0,width:0}),H=Uw({height:0,width:0}),x=Xw(),V=Xw(),k=Uw(0),S=Uw(null),Z=Uw({column:0,row:0}),O=Xw(),z=Xw(),N=Uw(!1),I=Uw(0),T=Uw(!0),D=Uw(!1),F=Uw(!1);Vw(Pw(C,qw(I),Dw(([e,t])=>!dE(t))),()=>{kw(T,!1)}),Vw(Pw(Jw(C,T,H,L,I,D),Dw(([e,t,n,r,,i])=>e&&!t&&0!==n.height&&0!==r.height&&!i)),([,,,,e])=>{void 0!==e?(kw(D,!0),sE(1,()=>{kw(x,e)}),zw(Pw(c),()=>{kw(t,[0,0]),kw(T,!0)})):kw(T,!0)}),Ow(Pw(z,Dw(e=>null!=e&&e.scrollTop>0),Rw(0)),E),Vw(Pw(C,qw(z),Dw(([,e])=>null!=e)),([,e])=>{e&&(kw(L,e.viewport),kw(H,e.item),kw(Z,e.gap),e.scrollTop>0&&(kw(N,!0),zw(Pw(c,jw(1)),e=>{kw(N,!1)}),kw(s,{top:e.scrollTop})))}),Ow(Pw(L,Fw(({height:e})=>e)),u),Ow(Pw(Jw($w(L,qM),$w(H,qM),$w(Z,(e,t)=>void 0!==e&&e.column===t.column&&e.row===t.row),$w(c)),Fw(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),O),Ow(Pw(Jw($w(b),r,$w(Z,UM),$w(H,qM),$w(L,qM),$w(S),$w(E),$w(N),$w(T),$w(I)),Dw(([,,,,,,,e])=>!e),Fw(([e,[t,n],r,i,a,o,l,,s,c])=>{const{column:d,row:u}=r,{height:f,width:h}=i,{width:C}=a;if(0===l&&(0===e||0===C))return TM;if(0===h){const t=cE(c,e);return function(e){return{...DM,items:e}}(_M(t,t+Math.max(l-1,0),o))}const p=XM(C,h,d);let m,A;s?0===t&&0===n&&l>0?(m=0,A=l-1):(m=p*RM((t+u)/(f+u)),A=p*FM((n+u)/(f+u))-1,A=BM(e-1,PM(A,p-1)),m=BM(A,PM(0,m))):(m=0,A=-1);const g=_M(m,A,o),{bottom:v,top:y}=QM(a,r,i,g),w=FM(e/p);return{bottom:v,itemHeight:f,items:g,itemWidth:h,offsetBottom:w*f+(w-1)*u-v,offsetTop:y,top:y}})),M),Ow(Pw(S,Dw(e=>null!==e),Fw(e=>e.length)),b),Ow(Pw(Jw(L,H,M,Z),Dw(([e,t,{items:n}])=>n.length>0&&0!==t.height&&0!==e.height),Fw(([e,t,{items:n},r])=>{const{bottom:i,top:a}=QM(e,r,t,n);return[a,i]}),Tw(Db)),t);const R=Uw(!1);Ow(Pw(c,qw(R),Fw(([e,t])=>t||0!==e)),R);const P=Qw(Pw(Jw(M,b),Dw(([{items:e}])=>e.length>0),qw(R),Dw(([[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}),Fw(([[,e]])=>e-1),Tw())),B=Qw(Pw($w(M),Dw(({items:e})=>e.length>0&&0===e[0].index),Rw(0),Tw())),j=Qw(Pw($w(M),qw(N),Dw(([{items:e},t])=>e.length>0&&!t),Fw(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),Tw(Tb),_w(0)));Ow(j,h.scrollSeekRangeChanged),Ow(Pw(x,qw(L,H,b,Z),Fw(([e,t,n,r,i])=>{const a=oE(e),{align:o,behavior:l,offset:s}=a;let c=a.index;"LAST"===c&&(c=r-1),c=PM(0,c,BM(r-1,c));let d=GM(t,i,n,c);return"end"===o?d=jM(d-t.height+n.height):"center"===o&&(d=jM(d-t.height/2+n.height/2)),void 0!==s&&0!==s&&(d+=s),{behavior:l,top:d}})),s);const _=Ww(Pw(M,Fw(e=>e.offsetBottom+e.bottom)),0);return Ow(Pw(y,Fw(e=>({height:e.visibleHeight,width:e.visibleWidth}))),L),{customScrollParent:m,data:S,deviation:k,footerHeight:i,gap:Z,headerHeight:a,increaseViewportBy:e,initialItemCount:E,itemDimensions:H,overscan:n,restoreStateFrom:z,scrollBy:o,scrollContainerState:l,scrollHeight:V,scrollTo:s,scrollToIndex:x,scrollTop:c,smoothScrollTargetReached:d,totalCount:b,useWindowScroll:A,viewportDimensions:L,windowScrollContainerState:g,windowScrollTo:v,windowViewportRect:y,...h,gridState:M,horizontalDirection:F,initialTopMostItemIndex:I,totalListHeight:_,...f,endReached:P,propsReady:p,rangeChanged:j,startReached:B,stateChanged:O,stateRestoreInProgress:N,...w}},xw(bE,pb,mE,FE,iE,RE,ob));function XM(e,t,n){return PM(1,RM((e+n)/(RM(t)+n)))}function QM(e,t,n,r){const{height:i}=n;if(void 0===i||0===r.length)return{bottom:0,top:0};const a=GM(e,t,n,r[0].index);return{bottom:GM(e,t,n,r[r.length-1].index)+i,top:a}}function GM(e,t,n,r){const i=XM(e.width,n.width,t.column),a=RM(r/i),o=a*n.height+PM(0,a-1)*t.row;return o>0?o+t.row:o}const KM=Kw(()=>{const e=Uw(e=>`Item ${e}`),t=Uw({}),n=Uw(null),r=Uw("virtuoso-grid-item"),i=Uw("virtuoso-grid-list"),a=Uw(aM),o=Uw("div"),l=Uw(Mw),s=(e,n=null)=>Ww(Pw(t,Fw(t=>t[e]),Tw()),n),c=Uw(!1),d=Uw(!1);return Ow($w(d),c),{components:t,computeItemKey:a,context:n,FooterComponent:s("Footer"),HeaderComponent:s("Header"),headerFooterTag:o,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")}}),YM=Kw(([e,t])=>({...e,...t}),xw(WM,KM)),JM=i.memo(function(){const t=aL("gridState"),n=aL("listClassName"),r=aL("itemClassName"),a=aL("itemContent"),o=aL("computeItemKey"),l=aL("isSeeking"),s=oL("scrollHeight"),c=aL("ItemComponent"),d=aL("ListComponent"),u=aL("ScrollSeekPlaceholder"),f=aL("context"),h=oL("itemDimensions"),C=oL("gap"),p=aL("log"),A=aL("stateRestoreInProgress"),g=oL("reportReadyState"),v=db(i.useMemo(()=>e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const n=e.firstChild;if(null!==n){const{height:e,width:t}=n.getBoundingClientRect();h({height:e,width:t})}C({column:cL("column-gap",getComputedStyle(e).columnGap,p),row:cL("row-gap",getComputedStyle(e).rowGap,p)})},[s,h,C,p]),!0,!1);return nM(()=>{t.itemHeight>0&&t.itemWidth>0&&g(!0)},[t]),A?null:e(d,{className:n,ref:v,...gM(d,f),"data-testid":"virtuoso-item-list",style:{paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},children:t.items.map(n=>{const i=o(n.index,n.data,f);return l?e(u,{...gM(u,f),height:t.itemHeight,index:n.index,width:t.itemWidth},i):m(c,{...gM(c,f),className:r,"data-index":n.index,key:i},a(n.index,n.data,f))})})}),$M=i.memo(function(){const t=aL("HeaderComponent"),n=oL("headerHeight"),r=aL("headerFooterTag"),a=db(i.useMemo(()=>e=>{n(Bb(e,"height"))},[n]),!0,!1),o=aL("context");return null!=t?e(r,{ref:a,children:e(t,{...gM(t,o)})}):null}),eL=i.memo(function(){const t=aL("FooterComponent"),n=oL("footerHeight"),r=aL("headerFooterTag"),a=db(i.useMemo(()=>e=>{n(Bb(e,"height"))},[n]),!0,!1),o=aL("context");return null!=t?e(r,{ref:a,children:e(t,{...gM(t,o)})}):null}),tL=({children:t})=>{const n=i.useContext(JE),r=oL("itemDimensions"),a=oL("viewportDimensions"),o=db(i.useMemo(()=>e=>{a(e.getBoundingClientRect())},[a]),!0,!1);return i.useEffect(()=>{n&&(a({height:n.viewportHeight,width:n.viewportWidth}),r({height:n.itemHeight,width:n.itemWidth}))},[n,a,r]),e("div",{ref:o,style:pM(!1),children:t})},nL=({children:t})=>{const n=i.useContext(JE),r=oL("windowViewportRect"),a=oL("itemDimensions"),o=aL("customScrollParent"),l=aL("useWindowScroll"),s=Cb(r,o,!1);return i.useEffect(()=>{n&&(a({height:n.itemHeight,width:n.itemWidth}),r({listHeight:0,offsetTop:0,visibleHeight:n.viewportHeight,visibleWidth:n.viewportWidth}))},[n,r,a]),e("div",{ref:s,style:mM(!1,l),children:t})},rL=i.memo(function({...t}){const r=aL("useWindowScroll"),i=aL("customScrollParent"),a=i||r?sL:lL,o=i||r?nL:tL,l=aL("context");return e(a,{...t,...gM(a,l),children:n(o,{children:[e($M,{}),e(JM,{}),e(eL,{})]})})}),{useEmitter:iL,useEmitterValue:aL,usePublisher:oL}=KE(YM,{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"}},rL),lL=bM({useEmitter:iL,useEmitterValue:aL,usePublisher:oL}),sL=EM({useEmitter:iL,useEmitterValue:aL,usePublisher:oL});function cL(e,t,n){return"normal"!==t&&!0!==t?.endsWith("px")&&n(`${e} was not resolved to pixel value correctly`,t,rb),"normal"===t?0:parseInt(t??"0",10)}const dL=({optionsList:r=[],onSelectVariable:i,dropdownPosition:a,position:s="relative",width:c,height:d="160px",zIndex:u=9999,highlightedIndex:f})=>{const h={LOCAL:"local_variable_icon",GLOBAL:"global_variable_icon",PROJECT_ENVIRONMENT:"project_env_variable_icon"},C=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":h[e.type||""]||"":"step_group_variable"},p=e=>"_startforloop"===e?.type?`FLV_for:${e?.name}`:"DATAPROVIDER"===e?.type?`${e?.dpName}:${e?.varname}`:e?.name;function m(e){if(e.endsWith("px")){const t=parseInt(e.slice(0,-2),10);return isNaN(t)?212:t-66}return 212}const A=o(null);l(()=>{void 0!==f&&f>=0&&requestAnimationFrame(()=>{A.current?.scrollToIndex({index:f,behavior:"auto",align:"center"})})},[f,r]);return e("div",{className:I("ff-variable-dropdown",s),role:"listbox","aria-label":"Variable suggestions",style:a?{top:a.top,left:a.left,width:c,height:d,zIndex:u}:{width:c,height:d,zIndex:u},children:K(r)?e("div",{className:"ff-variable-option ff-variable-option-no-data",role:"status","aria-live":"polite","aria-label":"No variable options available",children:e(U,{as:"span",fontSize:12,children:"No Option"})}):e(NM,{"aria-label":"Variable options",totalCount:r.length,ref:A,data:r,itemContent:a=>{const o=r[a];return o?e("div",{className:I("ff-variable-data",{"ff-variable-data--highlighted":f===a}),onMouseDown:()=>i(o),role:"option","aria-selected":f===a,"aria-label":p(o),children:c.endsWith("px")?n(t,{children:[e(Y,{title:xn(p(o),m(c),"pixel")?p(o):"",placement:"bottom",style:{width:`${m(c)}px`},children:e(U,{as:"span",fontSize:12,className:"ff-truncated_text",children:p(o)})}),e(q,{name:C(o),height:24,width:24})]}):e(gw,{option:o})},`${o.id}-${a}`):null},style:{height:d,fontSize:"12px"},overscan:10,fixedItemHeight:32})})},uL=({data:r=[],width:i,height:a,lineChartWidth:o,yAxisLabel:s,xAxisLabel:d,yAxisValueColor:u,xAxisColor:f,yAxisColor:h,yAxisLabelColor:C,textSize:p,fontWeight:m,numberSize:A,chartName:g,shouldCenterSinglePoint:v,xAxisLabelGap:y=16,isLeftOverflow:w=!1})=>{const b=40,E=i-80,M=a-80,[L,H]=c(!1),[x,V]=c({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});l(()=>{const e=()=>{H(!1),V(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,o=6,l=7;return n("div",{className:"ff-line-chart-text",style:{width:i+20+y,gap:y},children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:a},children:e(U,{className:"ff-line-chart-yAxisLabel",fontSize:p,fontWeight:"semi-bold",children:s})}),e("div",{className:"ff-line-chart-svg",children:e("svg",{height:a,width:i,className:"ff-line-chart-svg",children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:M,x2:E,y2:M,stroke:f,strokeWidth:1}),e("text",{x:E/2.1,y:M+b/1.2,textAnchor:"middle",fill:C,className:"ff-line-chart-x-axis-label",style:{fontSize:p,fontWeight:m},children:d}),t.map((t,n)=>e("text",{x:n*(E/(l-1)),y:M+15,textAnchor:0===n?"start":n===l-1?"end":"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:t},t)),Array.from({length:o}).map((t,n)=>{const i=n*r/(o-1),a=i/1024;return e("text",{x:-10,y:M-i*M/r,textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:a?.toFixed(1)},`y-${n}`)})]})})})]})}function k(e){if(!isNaN(e))return parseFloat(e);const t=Vr,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 S=r?.[0]?.data?.[0]?.hasOwnProperty("date")&&r?.[0]?.data?.[0]?.hasOwnProperty("totalMemory"),Z="date",O=S?"totalMemory":"value",z=e=>{const t=r?.[0]?.data?.length;if(1===t)return v?E/2:E;const n=r[0].data.findIndex(t=>t[Z]===e);return-1===n?0:n/(t-1)*E},N=Math.max(...r?.flatMap(e=>e?.data?.map(e=>k(e[O]))),5),I=e=>{if("memory"===g){const t=Math.max(...r?.flatMap(e=>e?.data?.map(e=>k(e[O]))));return M-e*M/(t>1024?t:1024)}return M-e*M/(0===N?1024:N)},T=e=>{if(1===e?.length){const t=e?.[0],n=z(t[Z]),r=I(k(t[O]));return`M 0 ${I(0)} L ${n} ${r}`}return e?.reduce((t,n,r)=>{const i=z(n[Z]),a=I(k(n[O]));if(0===r)return`M ${i} ${a}`;const o=e[r-1],l=o?z(o[Z]):0;return`${t} C ${l+(i-l)/2} ${o?I(k(o[O])):0}, ${i-(i-l)/2} ${a}, ${i} ${a}`},"")},D=r[0].data,F=g?`${g} line chart`:"Line chart";return n("section",{className:"ff-line-chart-text",style:{width:i+20+y,gap:y},"aria-label":F,children:[e("div",{className:"ff-line-chart-yAxisLabel-warpper",style:{height:a},children:e(U,{className:"ff-line-chart-yAxisLabel",fontSize:p,fontWeight:"semi-bold",children:s})}),n("div",{className:"ff-line-chart-svg",children:[e("svg",{height:a,width:i,onMouseMove:e=>{const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-b;if(e.clientY-t.top-b>M)return H(!1),void V({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null});let i={hoverValues:{},dotPositions:{}},a=null;r.forEach((e,t)=>{const r=e.data.reduce((e,t)=>{const r=Math.abs(n-z(t[Z]));return r<e.distance?{point:t,distance:r}:e},{point:null,distance:1/0}).point;r&&(a=r[Z],i.hoverValues[t]=((e,t=2)=>{let n="";if("string"==typeof e){const t=e.match(Lr),r=e.match(Hr);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[Z]),y:I(k(r[O]))})}),H(!0),V({cursorX:n,hoverValues:i.hoverValues,dotPositions:i.dotPositions,currentXValue:a,tooltip:a?{visible:!0,left:e.clientX+10,top:e.clientY-20}:{visible:!1,left:0,top:0}})},onMouseLeave:()=>V({cursorX:null,hoverValues:{},dotPositions:{},tooltip:{visible:!1,left:0,top:0},currentXValue:null}),className:"ff-line-chart-svg",role:"img","aria-label":F,children:n("g",{transform:"translate(40, 40)",children:[e("line",{x1:0,y1:0,x2:0,y2:M,strokeWidth:2}),e("line",{x1:0,y1:M,x2:E,y2:M,stroke:f,strokeWidth:1}),e("text",{x:E/2.1,y:M+b/1.2,textAnchor:"middle",fill:C,className:"ff-line-chart-x-axis-label",style:{fontSize:p,fontWeight:m},children:d}),r.map((r,i)=>{return!1!==r.show?n("g",{children:[e("path",{d:T(r.data),fill:"none",stroke:r.color,strokeWidth:o,opacity:(a=r.data,a.every(e=>0===k(e[O]))?.5:1)}),x.dotPositions[i]&&n(t,{children:[e("line",{x1:x.dotPositions[i].x,y1:0,x2:x.dotPositions[i].x,y2:M,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"}),e("circle",{cx:x.dotPositions[i].x,cy:x.dotPositions[i].y,r:5,fill:"white",stroke:r.color,strokeWidth:o,style:{transition:"cx 0.1s, cy 0.1s"}}),e("line",{x1:0,y1:x.dotPositions[i].y,x2:E,y2:x.dotPositions[i].y,stroke:"gray",strokeWidth:.5,strokeDasharray:"4"})]})]},i):null;var a}),(()=>{if(1===D.length){const t=D?.[0];return e("text",{x:v?E/2:E,y:M+15,textAnchor:v?"middle":"end",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=t[Z]?String(t[Z]):""},String(t[Z]))}if(D.length<7)return D.map(t=>e("text",{x:z(t[Z]),y:M+15,textAnchor:"middle",fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=t[Z]?String(t[Z]):""},String(t[Z])));{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),a=D[i];return e("text",{x:r*t,y:M+15,fill:h,className:"ff--line-chart-x-line-data",style:{fontSize:A},children:null!=a?.[Z]?String(a?.[Z]):""},String(a?.[Z]))})}})(),(()=>{if("memory"===g){const t=Math.max(N,1024);return Array.from({length:6}).map((n,r)=>{const i=r*t/5,a=i/1024;return e("text",{x:-10,y:I(i),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:a.toFixed(1)},`y-${r}`)})}return Array.from({length:6}).map((t,n)=>{const r=n*N/5;return e("text",{x:-10,y:I(r),textAnchor:"end",fill:u,className:"ff-line-chart-y-axis-text",style:{fontSize:A},children:r.toFixed(0)},`y-${n}`)})})()]})}),L&&x.tooltip.visible&&n("div",{className:"ff-line-chart-tooltip",role:"tooltip","aria-live":"polite",style:{left:w&&x.tooltip.left/2>i/1.75?x.tooltip.left-180:x.tooltip.left,top:x.tooltip.top},children:[e("div",{className:"ff-line-chart-date",children:x.currentXValue}),Object.entries(x.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))]})]})]})},fL=({onClose:t,top:r="100px",left:i="0px",className:a,description:o="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("section",{className:`ff-download-client-wrapper ${a}`,role:"dialog","aria-label":"Download client",style:{top:r,left:i,zIndex:c},children:[n("header",{className:"ff-download-client-header-wrapper",children:[e("div",{className:"ff-download-client-hollow-triangle"}),e(U,{fontWeight:"semi-bold",lineHeight:"32px",className:"ff-download-client-header-text",id:"download-client-title",children:"Download client"}),e(q,{name:"close",color:"var(--brand-color)",className:"ff-download-client-close-icon",height:12,width:12,"aria-label":"Close download client"})]}),n("div",{className:"ff-download-client-content-text",role:"group","aria-labelledby":"download-client-title",children:[e(U,{as:"div",color:"var(--download-client-content-text-color)",fontWeight:"semi-bold",textAlign:"center",lineHeight:"26px",children:o}),e(U,{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",role:"group","aria-label":"Choose operating system",children:["windows","mac_icon","linux"]?.map(t=>e("button",{type:"button",className:"ff-os-version-wrapper",onClick:()=>{s("mac_icon"===t?"mac":t)},"aria-label":`Download for ${"mac_icon"===t?"macOS":t}`,children:e(q,{name:t,height:36,width:36})},t))})]})]})},hL=({legendName:t,height:r,width:i,children:a})=>e("div",{className:"ff_fieldSet_container",role:"group","aria-label":t||"Fieldset",children:n("fieldset",{className:"ff_fieldSet",style:{height:r,width:i},"aria-label":t||"Fieldset",children:[e("legend",{className:"ff_legend_container",children:e(U,{color:"var(--license_header_text_color)",fontSize:8,lineHeight:"12px",children:t})}),e("div",{className:"ff_children_container",role:"region","aria-label":`${t||"Fieldset"} content`,children:a})]})}),CL=({onSelectVariable:t,dropdownPosition:n,filteredOptions:r=[],position:i="relative",width:a="100%",zIndex:s,truncateTextValue:c=34,highlightedIndex:d})=>{const u=o(null);return l(()=>{u.current?.scrollIntoView({block:"nearest"})},[d]),e("section",{className:I(`ff-variable-dropdown-container ${i}`),style:n?{top:n.top+30,left:n.left-30,width:a,zIndex:s}:{width:a,zIndex:s},role:"listbox","aria-label":"Options dropdown",children:K(r)?e("div",{className:"ff-variable-option no-data",role:"status","aria-label":"No option",children:e(U,{as:"div",children:"No Option",fontSize:14})}):r?.map((n,r)=>e("div",{className:I("ff-variable-option",{"ff-variable-option--highlighted":d===r}),onMouseDown:()=>t(n),ref:d===r?u:null,role:"option","aria-selected":d===r,"aria-label":n?.name,children:e(Y,{title:xn(n?.name,c,"pixel")?n?.name:"",children:e(U,{children:Hn(n?.name,c,"pixel")})})},n?.id))})},pL=a(({label:t="",hashInputValue:r="",setHashInputValue:i,variableList:a=[],placeholder:s="Enter text",onChange:d,onPaste:u,onCreateVariableClick:f,handleClearInput:h,value:C="",dropdownWidth:p="100%",dropdownHeight:m="160px",isHash:A=!1,isOnlyHash:g=!1,dataFiles:v=[],showAddVariableIcon:y=!0,helperText:w="",error:E,autoComplete:M="off",required:L=!1,zIndex:H=9999,truncateTextValue:x=34,formProps:V={},getSelectedVariable:k=()=>{},symbol:S="$",type:Z="text",clearIcon:O=!0,inputTitle:z="",onBlur:N,helperTextWidth:T,iconProps:D={isShowIcon:!1,iconName:"",iconToolTipTitle:"",isIconDisable:!1,iconColor:"",onIconClick:()=>{}},isCapitalize:F=!1,...R},P)=>{const[B,j]=c(!1),[_,W]=c(!1),[X,Q]=c(0),[G,J]=c(!1),[$,ee]=c(null),[te,ne]=c(0),[re,ie]=c(!1),[ae,oe]=c([]),[le,se]=c(!1),ce=o(null),de=o(null),[ue,fe]=c("auto"),he=D?.isShowIcon;l(()=>{const e=de.current?.querySelector(".ff-input-container");if(!e)return;const t=new ResizeObserver(e=>{for(let t of e){const e=`${t.contentRect.width}px`;fe(e)}});return t.observe(e),()=>{t.disconnect()}},[]),b(P,()=>ce.current),l(()=>{null!==$&&ce.current&&(ce.current.setSelectionRange($,$),ce.current.focus())},[$]),l(()=>{A&&j(C.startsWith("#"));const e=v?.find(e=>e.name===C),t=a?.find(e=>e?.name===C);if(C.startsWith("#")&&A){const e=C.slice(1).toLowerCase(),t=v.filter(t=>t.name.toLowerCase().includes(e));oe(t),j(!0)}const n=null!==e&&C.startsWith("#"),r=null!==t&&C.startsWith("$"),i=C.length>(t?.name.length||0),o=C.length>0&&!r||C.startsWith("#");g?ie(!1):r||n||C.includes("$")||C.includes("#")?(ie(!1),o&&ie(!0)):i&&!C.includes("$")&&ie(!0)},[C]);const Ce=()=>{ce.current&&ne(ce.current.selectionStart||0)},pe=Ce,me=Ce;l(()=>{ce.current&&ne(ce.current.selectionStart||0)},[C]);const Ae=e=>{if(ce.current){const{selectionStart:t,selectionEnd:n}=ce.current,r=`${e.name}`;let a;if(a=A&&"#"===C[0]?e.name+C.slice(n||1):e.name,d){d({target:{value:a}},e),k(e.name)}ce.current.value=a,i?.(e),ee((t||0)+r.length),j(!1),W(!0)}};const ge=function(e,t,n){let r=!1,i="";const a="}"===C[t-1];if(t<0||t>e.length)return{showDropdown:r,searchString:i};const o=e.lastIndexOf(S,t-1),l=e.indexOf(S,t);if(-1!==o&&(g&&"$"===e[o]?r=!1:t===o+1?(r=!0,i=""):(i=e.slice(o+1,-1===l?void 0:l),t>o+1&&(i=e.slice(o+1,t)),r=!0),_&&a&&(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}}(C,te,a),ve=C.startsWith("#"),ye=ve?ae:a?.filter(e=>e?.name?.toLowerCase()?.includes(ge?.searchString?.toLowerCase()));l(()=>{Q(0)},[A,ge?.showDropdown]);const we=Boolean(ge?.showDropdown&&G),be=Boolean(B&&A&&G),Ee=Boolean((ve?be:we)&&ye.length),Me=Boolean(ve?be:we);l(()=>{if(!Me)return void se(!1);const e=()=>{if(!de.current)return;const e=de.current.getBoundingClientRect(),t=window.innerHeight-e.bottom,n=e.top,r=Math.max(ye.length,1),i=r<4?40*r+10:parseInt(m,10)||160;se(t<i+10&&n>t)};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[Me,m,ye.length]);return n("section",{className:I("ff-add-variable-container",{"ff-dropdown-flip":le}),"aria-label":t||"Variable suggestion input dropdown",children:[n("div",{className:"ff-add-variable-input",ref:de,"aria-label":"Variable input controls",children:[e(Y,{title:z,style:{width:"100%"},children:e(Vi,{...R,name:"add_variable",ref:ce,type:Z,className:I("ff-variable-input-container",{"ff-variable-input-container--show-icon":he}),value:C,onKeyDown:e=>{switch(e.key){case"ArrowDown":if(!Ee)return;e.preventDefault(),e.stopPropagation(),Q(e=>e<ye.length-1?e+1:e);break;case"ArrowUp":if(!Ee)return;e.preventDefault(),e.stopPropagation(),Q(e=>e>0?e-1:0);break;case"Enter":{if(!Ee)return;e.preventDefault(),e.stopPropagation();const t=ye[X];t&&Ae(t);break}case"Escape":if(!Ee)return;e.preventDefault(),e.stopPropagation(),j(!1),J(!1),Q(0)}},onChange:d,onPaste:()=>{ie(!0)},variant:"primary",label:t,placeholder:s,onClick:pe,onKeyUp:me,onFocus:()=>J(!0),onBlur:e=>{(e=>{e.relatedTarget&&e.relatedTarget.closest(".dropdown-container")||J(!1)})(e),N?.(e)},autoComplete:M,helperText:w,error:E,required:L,helperTextWidth:T,isCapitalize:F,...V})}),!K(C)&&re&&y&&e("div",{className:"ff-create-variable-container",onClick:f,role:"button","aria-label":"Create variable",children:e(U,{fontWeight:"regular",fontSize:"10px",color:"var(--brand-color)",cursor:"pointer",children:"Create Variable"})}),!K(C)&&!g&&e("div",{className:I("ff-cancel-icon-container",{"ff-cancel-icon-container--show-icon":he}),"aria-label":"Clear input container",children:O&&e(Y,{title:"Cancel",style:{zIndex:99999},children:e(q,{onClick:h,name:"close",height:16,width:16,hoverEffect:!0,"aria-label":"Clear input"})})}),he&&e("div",{className:"ff-info-icon-container","aria-label":"Info icon container",children:e(Y,{title:he&&!D?.isIconDisable?D?.iconToolTipTitle:"",children:e(q,{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","aria-label":D?.iconToolTipTitle||"Info action"})})})]}),ge?.showDropdown&&G&&e(dL,{position:"absolute",zIndex:H,truncateTextValue:x,width:ue,height:0===ye.length?"auto":m,optionsList:ye,onSelectVariable:Ae,highlightedIndex:X},ge?.searchString||""),B&&A&&G&&e(CL,{position:"relative",zIndex:H,truncateTextValue:x,width:ue,filteredOptions:ye,onSelectVariable:Ae,highlightedIndex:X})]})}),mL=({isOpen:t,variableTypesList:r=[],onClose:i,onNameChange:a,onValueChange:o,variableName:s,variableValue:d,onVariableTypeChange:u,selectedVariableType:f,hideValue:h=!1,onHideChange:C,handleSubmit:p,mode:m="create",disabled:A,dataFiles:g=[],truncateTextValue:v=34,isEnterKeySubmit:y=!1,showHideValueOption:w=!0})=>{const[b,E]=c(!1),[M,L]=c(""),[H,x]=c(),[V,k]=c(!1),[S,Z]=c(!1),[O,z]=c({name:"",value:"",isChecked:!1});l(()=>{t&&"edit"===m&&z({name:s,value:d,isChecked:h})},[]);const N=e=>e&&0!==e.length?" "===e[0]||" "===e[e.length-1]?"Space is not allowed at starting and at the end":qn.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 I(e){const t=!!e,n=qn.test(e),r=$r.test(e),i=e.length>=3&&e.length<=25;return t&&n&&r&&i}l(()=>{const e=N(s);E(!!e),L(e)},[s]),l(()=>{if("edit"!==m)return;const{name:e,value:t,isChecked:n}=O;Z(s!==e||d!==t||h!==n)},[m,s,d,h,O]);const T=()=>{!V&&I(s)&&(k(!0),p())};l(()=>{if(!y)return;const e=e=>{if("Enter"===e.key){e.preventDefault();!I(s)||V||"edit"===m&&!S||T()}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[y,s,d,h,V,m,S,f]);return e(vn,{zIndex:1350,onClose:i,isOpen:t,title:"create"===m?"Create Variable":"Edit Variable",width:"284px",height:w?"280px":"250px",top:"30%",right:8,isFooterRequired:!0,overlay:!0,footerContent:e(()=>n("div",{className:"ff-create-slider-footer",role:"group","aria-label":"Form actions",children:[e(W,{onClick:i,label:"Cancel",variant:"tertiary"}),e(W,{variant:"primary",label:"create"===m?"Create":"Update",type:"submit",onClick:T,disabled:!I(s)||V||"edit"===m&&!S})]}),{}),children:n("div",{className:"ff-create-variable-slider",role:"form","aria-label":"Create or edit variable form",children:[e("div",{className:"ff-create-variable-slider-input",role:"group","aria-label":"Variable name input",children:e(Vi,{label:"Variable Name",required:!0,type:"text",name:"variableName",value:s||"",onChange:e=>{k(!1),a(e.target.value)},error:b,helperText:M,onBlur:e=>{const t=e.target.value,n=N(t);E(!!n),L(n)}})}),e("div",{role:"group","aria-label":"Variable type selection",children:e(Za,{label:"Variable Type",required:!0,onChange:e=>{u(e),k(!1)},selectedOption:f,optionsList:r,optionZIndex:99999,valueAccessor:"label",disabled:"edit"===m})}),e("div",{role:"group","aria-label":"Variable value input",children:e(pL,{label:"Variable Value",placeholder:"Enter Variable value or select path using #",isHash:!0,isOnlyHash:!0,zIndex:99999,truncateTextValue:v,dataFiles:g,dropdownWidth:"100%",setHashInputValue:x,hashInputValue:H||{},value:d||"",type:h?"password":"text",onChange:(e,t)=>{const n=e.target.value;o(n,t)},showAddVariableIcon:!1})}),w&&n("div",{className:"ff-hide-value-content",role:"group","aria-label":"Hide value option",children:[e(En,{onChange:e=>C(e.target.checked),name:"hideValue",label:"Hide Value",checked:h,disabled:A}),e(Y,{title:"Once the value is hidden, it cannot be undone",children:e(q,{name:"info",width:12,height:12})})]})]})})},AL=e=>{if(null==e||""===e)return{};return{width:e,flex:`0 0 ${"number"==typeof e?`${e}px`:e}`}},gL=({highlightText:t="",tableMeta:r=[],tableData:i=[],accordionType:a="row",noDataContent:o,height:l="100%",withFixedHeader:s=!1,headerType:d,TableAccordionStateIconWidth:u=4,TableAccordionStateIconHeight:f=8})=>{const[h,C]=c(-1),p="number"==typeof r[0]?.width?Math.max(r[0]?.width-8,0):void 0,m=(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:"--"},A=t=>t.map((t,n)=>e("table",{className:"ff-table-accordion__table",cellSpacing:0,children:e("tbody",{className:"ff-table-accordion__tbody",children:e("tr",{className:"ff-table-accordion__body-row",children:r.map((n,r)=>e("td",{className:"ff-table-accordion__body-cell",style:AL(n.width),children:"column"===a&&0===r?"":e(U,{as:"div",className:"ff-table-accordion__cell-typography",children:n.cell?m(t,n):e(Qs,{placement:"bottom",children:m(t,n)})})},n.accessor+r))},t.id||n)})},`accordion-table-${n}`));return n("section",{style:{height:l},className:I("ff-table-accordion",{"ff-table-accordion--fixed-header":s}),"aria-label":"Table with accordion",children:[e("table",{cellSpacing:0,className:I("ff-table-accordion__table",{"ff-table-accordion__table--fixed-header":s}),"aria-label":"Accordion table header",children:e("thead",{"aria-label":"Table header",children:e("tr",{className:"ff-table-accordion__header-row",children:r.map(t=>e("th",{style:AL(t.width),className:I("ff-table-accordion__header-cell",d&&`ff-table-accordion__header-cell--${d}`),"aria-label":t.header,children:e("div",{"aria-label":"Header label",children:e(U,{fontWeight:"semi-bold",fontSize:12,children:t.header})})},`header-${t.header}`))})})}),"row"===a&&i.map((n,r)=>e(wn,{highlightText:t,headerTitle:"string"==typeof n.title?e("div",{style:{maxWidth:void 0!==p?`${p}px`:"100%"},children:e(Qs,{children:e(yn,{text:n.title,highlight:t})})}):e(Qs,{children:"row.title"}),color:"var(--text-color)",accordionContent:A(n.data),disable:n.disable,disableInfoMessage:n.disableInfoMessage,accordionStateIconName:"arrows_down_icon",AccordionStateIconWidth:u,AccordionStateIconHeight:f,className:"ff-table-accordion__row-accordion"},`accordion-row-${r}`)),"column"===a&&i.map((i,a)=>n("article",{className:"ff-table-accordion__column-group","aria-label":`${"string"==typeof i.title?i.title:"Accordion row"} group`,children:[e("div",{className:"ff-display-flex",children:n("div",{className:`ff-table-accordion__column-header ${i.disable&&"ff-table-accordion__column-header--disabled"}`,style:r[0]?AL(r[0].width):{},"aria-label":"Accordion column header",children:[e("div",{className:"ff-table-accordion__column-label",children:e(U,{as:"div",children:e(Qs,{children:e(yn,{text:"string"==typeof i.title?i.title:"",highlight:t})})})}),e("div",{className:"ff-table-accordion__column-toggle",onClick:()=>{!i.disable&&(e=>{C(e===h?-1:e)})(a)},"aria-label":`${"string"==typeof i.title?i.title:"Row"} toggle`,"aria-expanded":h===a,"aria-disabled":i.disable,children:e(q,{name:h===a?"arrows_down_icon":"arrows_right_icon",color:"var(--table-with-accordion-icon-color)",width:u,height:f,hoverEffect:!1,"aria-label":h===a?"Collapse row":"Expand row"})})]})}),h===a&&e("section",{"aria-label":"Accordion content",children:A(i.data)})]},`column-accordion-${a}`)),K(i)&&e("div",{className:"ff-table-accordion__empty-state",style:{height:`calc(${l} - 50px)`},"aria-label":"No data available",children:o})]})},vL=({progressPercentage:t,totalMemory:r,usedMemory:i,color:a="var(--brand-color)",trackColor:o="#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:C="200px"})=>{const p=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,A=s;if(void 0!==r&&void 0!==i){const e=p(i),t=p(r);t>0?(m=e/t*100,A=s||i):(m=0,A="0MB")}else m=t||0;const g=Math.max(0,Math.min(m,100));return n("section",{className:"ff-progress-bar-container "+(A?"ff-has-label":""),style:{width:C},"aria-label":"Progress bar container",children:[e("div",{className:"ff-progress-bar-track",style:{backgroundColor:o,height:`${l}px`},"aria-label":A?`${A} progress`:"Progress",children:e("div",{className:"ff-progress-bar",style:{width:`${g}%`,backgroundColor:a,height:`${l}px`},children:u&&e(U,{className:"ff-progress-bar-percentage",fontSize:f,color:h,children:`${Math.round(g)}%`})})}),A&&e("div",{className:"ff-progress-bar-label","aria-label":"Progress label",children:e(U,{fontSize:c,color:d,children:e(Y,{title:xn(A,10,"count")?A:"",children:Hn(A,10,"count")})})})]})},yL=({variant:t="primary",size:n="small",onClick:r,label:i="Choose File",disabled:a=!1,type:l="button",className:s="",style:d={},iconName:f,isChooseFile:h=!1,buttonWidth:C="auto",buttonHeight:p="auto",selectedFile:m={},handleCloseIcon:A,isMandatory:g=!1})=>{const v=o(null),[y,w]=c(0);u(()=>{v.current&&w(v.current.getBoundingClientRect().width-10)},[C]);const b=m?.name||i,E=y?Hn(b,y,"pixel"):b,M=!!y&&xn(b,y,"pixel"),L=m?.name?`Choose file, selected ${m.name}`:`Choose file, ${i}`;return e("div",{ref:v,style:{width:C},role:"group","aria-label":L,children:e(Y,{title:M?b:"",children:e(W,{variant:t,label:E,type:l,onClick:r,buttonWidth:C,buttonHeight:p,isChooseFile:h,size:n,disabled:a,className:s,iconName:f,style:d,iconPosition:"right",selectedFile:m,handleCloseIcon:A,isMandatory:g})})})},wL=({selected:t="text",handleClick:r,tabList:i})=>{const a=i?.includes("Automation"),o=i?.includes("Manual"),l=a?"Automation":"Add Automation",s=o?"Manual":"Add Manual";return n("div",{className:"ff-script-switch-container","aria-label":"Script switch options",children:[e(Y,{title:l,zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Automation"===t?"active":""),onClick:()=>r(l),"aria-label":l,"aria-pressed":"Automation"===t,children:e(q,{name:a?"automation_testcase":"add_testcase",color:"Automation"===t?"var(--primary-button-text-color)":"var(--description-text)","aria-label":l})})}),e(Y,{title:o?"Manual":"Add Manual",zIndex:1e3,children:e("div",{className:"ff-script-switch-button "+("Manual"===t?"active":""),onClick:()=>r(s),"aria-label":s,"aria-pressed":"Manual"===t,children:e(q,{name:o?"manual_testcase":"add_testcase",color:"Manual"===t?"var(--primary-button-text-color)":"var(--description-text)","aria-label":s})})})]})},bL=({selected:t,handleClick:n,tabList:r})=>e("section",{className:"ff-switch-container","aria-label":"Switch button group",children:r.map(r=>e(Y,{title:t===r.name?null:r.tooltip,zIndex:1e3,children:e("div",{className:"ff-switch-button "+(t===r.name?"active":""),onClick:()=>n(r.name),"aria-label":r.name,"aria-pressed":t===r.name,children:e(q,{name:r.icon,color:t===r.name?"var(--primary-button-text-color)":"var(--description-text)","aria-label":`${r.name} icon`})})},r.name))}),EL=({onModalClose:t,MediaSrc:r,fileName:a,onDeleteClick:o,mediaType:s,fileId:d,thumbnailMediaSrc:u,isDelete:f=!0,onExpandClick:h,onDownloadClick:C,isMediaIcon:p=!1,previewOnly:m=!1,iconName:A="video_preview",isDisabled:g=!1})=>{const[v,y]=c(!1),w=i.useRef(null),b=()=>{y(!0),h&&h(d)},E=()=>{t?.(),y(!1)},M=()=>{C&&C(d)};return l(()=>{m&&y(!0)},[m]),n("section",{"aria-label":"Media preview",role:"region",children:[!m&&(p?e(q,{name:A,hoverEffect:!0,onClick:b,disabled:g,"aria-label":"Open media preview"}):e(mw,{mediaSrc:r,mediaType:s,onDownloadClick:M,onDeleteClick:()=>o?.(r),onExpandClick:b,fileName:a,fileId:d,thumbnailMediaSrc:u,isDelete:f})),v&&e(Ip,{isOpen:v,onClose:E,isFooterDisplayed:!1,isHeaderDisplayed:!1,customWidth:"1130px",customHeight:"570px",zIndex:1e4,children:n("div",{className:"media-wrapper","aria-label":"Media preview modal",children:[n("div",{className:"ff-expand-icons","aria-label":"Media preview actions",children:[e(Y,{title:"Download File",children:e(q,{name:"download_file_icon",onClick:M,color:"var(--icons-default-color)",className:"header-icons","aria-label":"Download media file"})}),e(Y,{title:"Expand",children:e(q,{name:"expand",onClick:b,color:"var(--icons-default-color)",className:"header-icons","aria-label":"Expand media preview"})}),e(Y,{title:"close",children:e(q,{name:"close",onClick:E,color:"var(--icons-default-color)",className:"header-icons","aria-label":"Close media preview"})})]}),"image"===s&&e("img",{src:r,alt:a||"Media preview image",height:"auto"}),"video"===s&&e("video",{src:r,controls:!0,controlsList:"nodownload",className:"ff-video-preview",ref:w,onCanPlay:()=>{if(w.current){const e=w.current.play();void 0!==e&&e.catch(e=>{console.error("Autoplay failed:",e)})}}})]})})]})},ML=({children:t,orientation:r="",navBarIcons:a=[],mobileHeight:o=448,mobileWidth:l=220,UtilityBar:s,tooltip:c={},background:d,navBarPosition:u="bottom"})=>{const f="portrait"===r,h=f?o:l,C=f?l:o,p=s&&"top"===u,m=s&&"bottom"===u,A=s&&"left"===u;return n("section",{className:["ff-mobileskin-wrapper",f?"portrait":"landscape",A?"ff-side-nav-left":"",p?"navbar-top":"",m?"navbar-bottom":""].filter(Boolean).join(" "),"aria-label":"Mobile preview",children:[p&&e("nav",{className:"ff-nav-bar top-nav-bar","aria-label":"Top navigation bar",children:a.map(({title:t,name:n,className:r,...i},o)=>{const l=c?.[n]??o;return e(Y,{title:c?.[n]||"",placement:"top",children:e("div",{className:`ff-nav-bar-icon ${r||""} ${o===a.length-1?"last-icon":""} ${p?"navbar-top":""}`,"aria-label":t||n||"Navigation icon",children:e(q,{name:n,...i})})},l)})}),e("main",{className:"ff-mobileskin-container",style:{height:h+16,width:C+16},"aria-label":"Mobile device frame",children:e("div",{className:"ff-mobile-container",style:{width:C,height:h,background:d||"transparent"},children:e("div",{className:"ff-mobile-image-container","aria-label":"Mobile screen content",children:i.isValidElement(t)?t:e("img",{src:t,alt:"Mobile content",style:{width:f?"100%":2.1*l+"px",height:f?"100%":.5*o+"px"}})})})}),s&&m&&e("nav",{className:"ff-nav-bar","aria-label":"Bottom navigation bar",children:a?.map((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-nav-bar-icon ${t?.className||""} ${n===a.length-1?"last-icon":""}`,"aria-label":r||i?.name||"Navigation icon",children:e(Y,{title:r,children:e(q,{...i})})},n)})}),s&&A&&e("aside",{className:"ff-side-nav-bar","aria-label":"Side navigation bar",children:a?.map((t,n)=>{const{title:r,...i}=t;return e("div",{className:`ff-sidebar ${t?.className||""} ${n===a.length-1?"last-icon":""}`,"aria-label":r||i?.name||"Navigation icon",children:e(Y,{title:r,placement:"bottom",children:e(q,{...i})})},n)})})]})},LL=a(({width:t=300,height:r=40,iconHeight:i=16,iconWidth:a=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:C="send",submitPrompt:p,onPromptChange:m,onBlur:A,onFocus:g,disableInput:v,isAdditionalIcon:y=!1,additionalIconName:w,additionIconToolTip:b,onAdditionalIconClick:E},M)=>{const L=o(null);Zn([{key:"Enter",action:()=>H()}],L);const H=e=>{f&&p?.(f.trim())};return n("section",{className:I("ff-prompt-container",{"icon-left":"left"===c,"icon-right":"left"!==c}),style:{width:`${t}px`,height:`${r}px`,borderRadius:d},ref:L,"aria-label":"Prompt input container",children:[e(Y,{placement:"top",title:C,children:e(q,{name:s,className:"ff-prompt-icon",height:i,width:a,onClick:p,color:h,disabled:K(f),"aria-label":C||"Send prompt"})}),e("input",{ref:M,className:"ff-prompt-input",type:"text",placeholder:l,autoFocus:u,onChange:m,onFocus:g,onBlur:A,value:f,readOnly:v,"aria-label":l||"Prompt input"}),y&&w&&e(Y,{placement:"top",title:b,children:e(q,{name:w,className:"ff-prompt-icon additional-icon",height:i,width:a,onClick:E,"aria-label":b||"Additional action"})})]})}),HL=({content:t,isVisible:n,maxWidth:r=300,onClick:i,isClickable:a=!0,arrowPosition:o="left"})=>e("section",{onClick:i,style:{width:`${r}px`,"--triangle-position":r-4+"px"},className:I("ff-chat-msg-box",{visible:n,hidden:!n,pointer:a,default:!a,"chat-arrow-left":"left"===o,"chat-arrow-right":"left"!==o}),role:"note","aria-label":"Message box",children:e("div",{className:I("content",`arrow-${o}`),"aria-label":"Message content",children:e(U,{children:t})})}),xL=({iconName:r,iconPosition:{top:i,left:a,bottom:o,right:l},hoverIconPosition:{top:s,left:d,bottom:u,right:f},modalPosition:{top:h,left:C,bottom:p,right:m},modalWidth:A,modalHeight:g,headerContent:v="Header Content",footerContent:y="Footer Content",iconWidth:w,iconHeight:b,modalHeading:E="Ask Fia",children:M,onClearChat:H})=>{const[x,V]=c(!1),[k,S]=c(!1),Z=`${E} chat window`;return n(t,{children:[n("div",{style:{top:void 0!==i?`${i}px`:void 0,left:void 0!==a?`${a}px`:void 0,bottom:void 0!==o?`${o}px`:void 0,right:void 0!==l?`${l}px`:void 0},className:"ff-dynamic-icon-container",children:[e(q,{className:"ff-dynamic-icon",name:r,onClick:()=>{S(e=>!e),setTimeout(()=>V(e=>!e),10)},height:b,width:w,"aria-label":"Open chat modal"}),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(q,{name:"ask_fia_icon",height:32,width:82})})]}),k&&L(e("div",{className:I("ff-dynamic-modal",{open:x}),role:"dialog","aria-modal":"true","aria-label":Z,style:{top:void 0!==h?`${h}px`:void 0,left:void 0!==C?`${C}px`:void 0,bottom:void 0!==p?`${p}px`:void 0,right:void 0!==m?`${m}px`:void 0,position:"fixed",height:g,width:A},children:n("div",{className:"ff-dynamic-modal-content",children:[v&&e("header",{className:"ff-dynamic-modal-header",children:n("div",{className:"header-container",children:[n("div",{className:"header-left",children:[e(q,{height:16,width:16,name:"fia_icon"}),e(U,{fontWeight:"medium",children:E})]}),n("div",{className:"header-right",children:[e("span",{className:"action",children:e(Y,{title:"Clear chat",placement:"bottom",children:e(q,{height:16,width:16,name:"delete",color:"var(--tooltip-text-color)",onClick:H,"aria-label":"Clear chat"})})}),e("span",{className:"action",children:e(Y,{title:"Close",placement:"bottom",children:e(q,{height:16,width:16,name:"close",color:"var(--tooltip-text-color)",onClick:()=>(V(!1),void setTimeout(()=>S(!1),300)),"aria-label":"Close chat modal"})})})]})]})}),e("div",{className:"ff-dynamic-modal-body",children:M}),y&&e("footer",{className:"ff-dynamic-modal-footer",children:y})]})}),document.body)]})},VL=a(({iconName:r,hoverTitle:i,iconPosition:{top:a,left:o,bottom:l,right:s},hoverIconPosition:{top:c,left:d,bottom:u,right:f},modalPosition:{top:h,left:C,bottom:p,right:m},modalWidth:A,modalHeight:g,headerContent:v="Header Content",footerContent:y="Footer Content",iconWidth:w,iconHeight:E,children:M,isVisible:H,isOpen:x,onOpen:V,onClose:k,isIconVisible:S},Z)=>{b(Z,()=>({closeModal:k}));const O=i?`${i} chat window`:"AI chat window";return n(t,{children:[S&&n("div",{style:{top:void 0!==a?`${a}px`:void 0,left:void 0!==o?`${o}px`:void 0,bottom:void 0!==l?`${l}px`:void 0,right:void 0!==s?`${s}px`:void 0},className:"ff-ai-dynamic-icon-container",children:[e(q,{className:"ff-ai-dynamic-icon",name:r,onClick:V,height:E,width:w,"aria-label":"Open AI chat modal"}),e("div",{style:{top:void 0!==c?`${c}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-ai-chat-icon-hover",children:e("div",{className:"ai-hover-leaf",children:e(U,{fontWeight:"bold",fontSize:14,color:"var(--chatbot-leaf-text)",children:i})})})]}),H&&L(e("div",{className:I("ff-ai-dynamic-modal",{open:x}),role:"dialog","aria-modal":"true","aria-label":O,style:{top:void 0!==h?`${h}px`:void 0,left:void 0!==C?`${C}px`:void 0,bottom:void 0!==p?`${p}px`:void 0,right:void 0!==m?`${m}px`:void 0,position:"fixed",height:g,width:A},children:n("div",{className:"ff-ai-dynamic-modal-content",children:[v&&e("header",{className:"ff-ai-dynamic-modal-header",children:v}),e("div",{className:"ff-ai-dynamic-modal-body",children:M}),y&&e("footer",{className:"ff-ai-dynamic-modal-footer",children:y})]})}),document.body)]})}),kL=({variant:t,title:r,tabTitle:i,comment:a,profileShortName:o})=>n("article",{className:"ff-history-card","aria-label":`History card for ${i}`,children:[e("header",{className:I("header",`header--${t}`),children:e(U,{fontWeight:"semi-bold",children:i})}),n("div",{className:"body",children:[e("section",{className:"title","aria-label":"History card title",children:n("div",{className:"profile",children:[e(U,{className:I("avatar",`avatar--${t}`),children:o}),e(U,{children:r})]})}),n("section",{className:"comment-container","aria-label":"History card comments",children:[e(U,{fontWeight:"semi-bold",className:"heading",children:"Comments:"}),e(U,{color:"var(--details-page-value-color)",className:"comment",children:a})]})]})]}),SL=({onChange:t,disabled:r,checked:i=!1,id:a="toggle",path:o})=>{const l=`ff-toggle-${a}`;return n("div",{className:"ff--ai-switch-container",role:"group","aria-label":r?"AI toggle disabled":i?"AI toggle on":"AI toggle off",children:[e("input",{className:"ff--ai-switch-checkbox",id:l,type:"checkbox",disabled:!!r,onChange:e=>{t&&t(e)},checked:i,"aria-label":"AI toggle","aria-checked":i}),e("label",{className:I("ff--ai-switch-label",{"ff--ai-switch-label--disabled":r}),htmlFor:l,children:e("span",{className:"ff--ai-switch-content",children:n("span",{className:"ff--ai-switch-content",children:[e(U,{className:I("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:o,alt:"AI image"})]})})})]})},ZL=a(({name:t,height:n=30,width:r=30,path:i="",onClick:a,color:s="var(--brand-color)",hoverEffect:c=!1,className:d="",disabled:u=!1,variant:f="light",isSelected:h=!1,x:C,y:p,tabIndex:m=-1,...A},g)=>{if(!_[t])return null;const v=o(null);l(()=>{v.current&&(void 0!==C&&v.current.setAttribute("x",String(C)),void 0!==p&&v.current.setAttribute("y",String(p)))},[C,p]);const y="function"==typeof a&&!u,w={ref:g,onClick:u?void 0:a,style:{height:`${n}px`,width:`${r}px`,cursor:u?"not-allowed":"pointer",opacity:u?.3:1},role:y?"button":void 0,"aria-label":t?`Animated setting ${t}`:"Animated setting","aria-disabled":!(!u&&y)||void 0,...A};return e("span",{...w,children:e("img",{height:n,width:r,src:i,alt:"","aria-hidden":"true"})})}),OL=({id:r=0,serialNumber:i,activeId:a,setActiveId:s,children:d,onIconClick:u,numberChildren:f,onContainerClick:h,onNextClick:C,onPreviousClick:p,disabled:m,isEditAccess:A,versionsLength:g,count:v,hiddenActions:y=[]})=>{const[w,b]=c(!1),[E,M]=c(!1),L=o(null),H=Array.isArray(y)?y:y?[y]:[],x=(e,t)=>{e.stopPropagation(),t()};l(()=>{L.current&&(()=>{if(L.current){const e=getComputedStyle(L.current),t=1.2*parseFloat(e.fontSize)*6;L.current.scrollHeight>t&&M(!0)}})()},[]);const V=e=>{e.stopPropagation(),b(!w)};return n("section",{className:`ff-prompt-container-Block ${a===r?"active":"inactive"} `,onClick:()=>{s(r),h()},"aria-label":`Prompt container ${i}`,children:[e(U,{fontSize:8,className:"ff-prompt-number-bg-color",as:"span",children:`Test cases ${i}`}),n(t,{children:[n("article",{className:"ff-prompt-content "+(w?"expanded":""),ref:L,"aria-label":"Prompt content",children:[d,w&&n(t,{children:[e("span",{role:"button","aria-label":"Collapse content",onClick:V,className:"read-less-btn",children:e(U,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read Less"})})," "]})]}),E&&!w&&e("div",{role:"button","aria-label":"Expand content",onClick:V,className:"read-more-btn",children:e(U,{color:"var(--brand-color)",fontWeight:"semi-bold",className:"read-more-btn-text",children:"Read More"})})]}),n("footer",{className:"ff-prompt-icons","aria-label":"Prompt actions",children:[e("div",{className:"ff-prompt-icons-leftside","aria-label":"Prompt action icons",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=>!H.includes(e.action)).map((t,n)=>{const r=A&&"delete"===t?.action||"regenerate"===t?.action&&(g??0)>=3||m;return e(Y,{title:t.title,placement:"bottom",children:e(q,{disabled:r,name:t.action,color:t.color,hoverEffect:!0,onClick:e=>((e,t)=>{e.stopPropagation(),u(t)})(e,t.action),"aria-label":t.title})},`${t?.title}-${n}`)})}),n("nav",{className:"ff-prompt-icons-rightside","aria-label":"Prompt navigation",children:[e(q,{disabled:1===v,className:"ff-prompt-icons-style",name:"arrow_left_accordian",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>x(e,p),cursorType:"pointer","aria-label":"Previous"}),f,e(q,{disabled:v===g,className:"ff-prompt-icons-style",name:"arrow_right_icon",color:"var(--table-column-text-color)",width:18,height:18,onClick:e=>x(e,C),cursorType:"pointer","aria-label":"Next"})]})]})]})},zL=a(({type:t="text",variant:r="primary",name:i="",label:a,disabled:o=!1,disableLinkIcon:l=!1,required:s=!1,placeholder:c="Attach Link",value:d,error:u,helperText:f,noBorder:h,className:C="",onChange:p,onBlur:m,onFocus:A,autoComplete:g="off",autoFocus:v=!1,minValue:y=-1/0,maxValue:w=1/0,transparentBackground:b=!1,size:E="small",isLabelRequired:M=!0,onClick:L,onKeyUp:H,isViewMode:x=!1,...V},k)=>{const S=!K(d);return n("fieldset",{className:I("ff-link-input-fieldset",{"ff-link-input-fieldset--disabled":o}),"aria-label":a||i||"Link input",children:[n("div",{className:I("ff-link-input-container",{"ff-link-input-container--float":S,"ff-link-input-container--disabled":!!o}),children:[M&&n("label",{className:I(`ff-link-input-label-container ff-link-input-label-container--${E}`,{"ff-link-input-label-container--danger":!!u}),htmlFor:i,children:[s&&e("span",{className:"required-asterisk",children:"*"}),e("span",{className:I(`ff-link-input-label ff-link-input-label--${r}`,{"ff-link-input-label--no-hover":!!d,"ff-link-input-label--disabled":!!o,"ff-link-input-label--danger":!!u}),children:a})]}),e("input",{ref:k,name:i,value:d,type:t,spellCheck:!1,id:i,className:I(`ff-link-input ff-link-input-${r} default-input ff-link-input--${E}`,{"ff-link-input--transparentBackground":!!b,"ff-link-input--no-hover":!!d,"ff-link-input--disabled":!!o,"ff-link-input--danger":!!u,"ff-link-input--no-border":!!h,"ff-link-input--placeholder":!M},`${C}`),placeholder:c,disabled:x||o,onChange:p,onFocus:A,onBlur:m,autoComplete:g,autoFocus:v,min:y,max:w,onClick:L,onKeyUp:H,"aria-label":a||i||"Link input",...V}),e("div",{className:"input-link-icon","aria-label":"Link action",children:l||u||!S?e(q,{name:"link",disabled:!0,"aria-label":"Link icon"}):e(Y,{title:"Click here to navigate",children:e("span",{"aria-label":"Open link in new tab",children:e(q,{name:"link",disabled:!1,onClick:()=>{d&&!u&&window.open(d,"_blank")},"aria-label":"Open link"})})})})]}),f&&u&&e("span",{className:I("ff-link-input-message",{"ff-link-input-message--danger":!!u}),children:f})]})}),NL=({labelsList:r=[],height:i=""})=>{const a=Ai(),o=r[0]||"Chip",l=r.length>1?`plus ${r.length-1} additional labels`:"No additional labels",s=e("div",{className:"ff-chip-tooltip",children:r.filter((e,t)=>t>0).map((t,n)=>e(U,{as:"div",className:"ff-chip-tooltip-label",children:t},`label-${n}-${t}`))});return e(t,{children:!K(r)&&n("div",{className:"ff-chip-with-count-container",role:"group","aria-label":`${o} with count`,children:[e(U,{as:"div",fontWeight:"medium",className:"ff-chip-label",style:i?{height:i}:void 0,children:e(Qs,{children:r[0]||""})}),r.length>1&&n(t,{children:[n(U,{as:"div",className:"ff-chip-count","data-tooltip-id":`tooltip-${a}`,fontWeight:"medium",role:"status","aria-label":l,children:["+",r.length-1]}),e("div",{id:`tooltip-${a}`,className:"ff-chip-tooltip-template",children:e(U,{as:"div",children:s})})]})]})})};class IL 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 TL=({iconName:t="",onButtonClick:r,buttonLabel:i="Label",buttonText:a="To Add Group",disableButton:o=!1,stepCount:l=1,iconWidth:s=120,iconHeight:c=120,addContentLabel:d="step"})=>{const u=`${d}${l}: ${i} ${a}`.trim();return n("section",{className:"add-content-button "+(o?"disabled":""),"aria-label":u,children:[!K(t)&&e("div",{className:"icon-container",children:e(q,{name:t,width:s,height:c})}),n("div",{className:"typography-label-button",children:[n(U,{fontSize:"12px",fontWeight:"regular",lineHeight:"18px",children:[d+l," :"]}),e(U,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:"Click"}),e(Np,{label:i,onClick:r,iconName:"plus_user_icon",isDisable:o}),e(U,{fontSize:"12px",fontWeight:"semi-bold",lineHeight:"18px",children:a})]})]})},DL=({variant:t="default",tabsData:r,activeTabId:i,onTabClick:a,noBorder:o=!1,noPadding:l=!1,titleSize:s="12px"})=>{const[d,u]=c(0),f=r.find(e=>e.id===i);return n("section",{className:"ff-tabs-slider-container","aria-label":"Tabs with slider",children:[n("nav",{className:I(`ff-tab-row--${t} ff-tab-row-section`,{"ff-tab-row--no-border":o,"ff-tab-row--no-padding":l,"ff-tab-row--position":r.length>4}),role:"tablist","aria-label":"Slider tabs list",children:[r.length>4&&e(q,{className:"ff-tab-icon ff-tab-icon--previous",name:""+(d?"arrow_left_accordian":""),onClick:()=>{d>0&&u(e=>e-1)},hoverEffect:!0,"aria-label":"Previous tabs"}),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&&a(r.id),disabled:r.disabled,id:`tab-slider-${r.id}`,role:"tab","aria-selected":i===r.id,"aria-controls":`tab-slider-panel-${r.id}`,"aria-label":r.label,className:I(`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(Y,{title:r.label.length>9?r.label:"",children:e(U,{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:I("ff-tab-label",{"ff-tab-label--active":i===r.id})})}),"default"===t&&r.count&&e("span",{className:I("tab-count",{"tab-count--active":i===r.id}),children:r.count})]}),e("div",{className:I("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(q,{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,"aria-label":"Next tabs"})]}),e("section",{className:"ff-tab-content",role:"tabpanel",id:`tab-slider-panel-${i}`,"aria-labelledby":i?`tab-slider-${i}`:void 0,"aria-label":f?.label||"Active tab content",children:f?.component})]})},FL=a(({label:t="Status",iconName:r="update_icon",onClick:i,isDisable:a=!1,variant:o="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:a,onClick:i,"aria-label":t||`${o} status indicator`,className:`\n ff-status-indicator\n ff-status-indicator--${o}\n ${l?`ff-status-indicator--with-bg ff-status-indicator--${o}-bg`:""}\n ${s?`ff-status-indicator--with-border ff-status-indicator--${o}-border`:""}\n `,ref:c,children:n("div",{className:"ff-status-indicator__content","aria-label":"Status indicator content",children:[e(q,{name:"danger"===o?"close":r,color:d[o]||d.default,className:`ff-status-indicator__icon ff-status-indicator__icon--${o}`,"aria-label":`${o} status icon`}),e(U,{as:"div",fontSize:12,className:`ff-status-indicator__label ff-status-indicator__label--${o}`,fontWeight:"medium",lineHeight:"20px",children:t})]})})}),RL=({rootLabel:t,childrenLabels:r,align:i="center",direction:a="horizontal"})=>{const o=r.length;return n("section","vertical"===a?{className:"ff-os-tree-vertical",style:{"--child-count":o},"aria-label":"Operating system tree",children:[n("header",{className:`ff-os-tree-vertical__row ff-os-tree-vertical__row--${i}`,"aria-label":"Root node",children:[e("div",{className:"ff-os-tree-vertical__root-label","aria-label":String(t),children:t}),e("div",{className:"ff-os-tree-vertical__horizontal-line"})]}),n("div",{className:"ff-os-tree-vertical__vertical-line-wrapper","aria-label":"Child nodes",children:[e("div",{className:"ff-os-tree-vertical__vertical-line"}),r.map((t,r)=>n("article",{className:"ff-os-tree-vertical__child","aria-label":`Child node ${r+1}`,children:[e("div",{className:"ff-os-tree-vertical__child-connector"}),e("div",{className:"ff-os-tree-vertical__child-label","aria-label":String(t),children:t})]},r))]})]}:{className:`ff-os-tree ff-os-tree--${i}`,style:{"--child-count":o},"aria-label":"Operating system tree",children:[n("header",{className:"ff-os-tree__root-wrapper","aria-label":"Root node",children:[e("div",{className:"ff-os-tree__root-label","aria-label":String(t),children:t}),e("div",{className:"ff-os-tree__vertical-root"})]}),e("div",{className:"ff-os-tree__horizontal-connector","aria-label":"Connectors",children:r.map((t,n)=>e("div",{className:"ff-os-tree__vertical-child"},n))}),e("div",{className:"ff-os-tree__children","aria-label":"Child nodes",children:r.map((t,n)=>e("article",{className:"ff-os-tree__child-container","aria-label":`Child node ${n+1}`,children:e("div",{className:"ff-os-tree__child-label","aria-label":String(t),children:t})},n))})]})},PL=({handleClose:t,handleResend:r,handleOtp:i,resendTimeout:a=30})=>{const[s,d]=c(Array(6).fill("")),[u,f]=c(a),[h,C]=c(!0),p=o(Array(6).fill(null));l(()=>{h||p.current[0]?.focus()},[h]),l(()=>{let e;return u>0&&(e=window.setInterval(()=>f(e=>e-1),1e3)),0===u&&C(!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);p.current[r]?.focus()};return e(Ip,{isOpen:!0,onClose:t,isFooterDisplayed:!1,isHeaderDisplayed:!1,zIndex:999999,customWidth:"340px",children:n("section",{className:"ff-otp-popup","aria-label":"OTP verification modal",children:[n("header",{className:"ff-otp-header","aria-label":"OTP header",children:[e(U,{fontSize:24,lineHeight:"36px",fontWeight:"semi-bold",children:"OTP Verification"}),e(q,{name:"close",height:16,width:16,onClick:t,className:"ff-close-icon","aria-label":"Close OTP verification"})]}),e("div",{className:"ff-otp-boxes","aria-label":"OTP input fields",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&&p.current[t+1]?.focus()}else if("Backspace"===n){e.preventDefault();const n=[...s];n[t]="",d(n),t>0&&p.current[t-1]?.focus()}})(e,n),onPaste:m,ref:e=>p.current[n]=e,readOnly:!0,"aria-label":`OTP digit ${n+1}`},n))}),e(W,{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(a),C(!0),d(Array(6).fill("")),r()},"aria-label":h?"Resend OTP disabled"+(u>0?` for ${u} seconds`:""):"Resend OTP","aria-disabled":h,children:["Re-send OTP",u>0?` (${u}s)`:""]})]})})},BL=({isOpen:t,onClose:r,isPlaying:i,onTogglePlay:a,mediaType:s,src:d,headerTitle:u,onDownload:f,onExpand:h,showHeader:C=!0,showDownload:m=!0,showExpand:A=!0,width:g="800px",height:v="432px",showControls:y=!0,customStyle:w,overlay:b=!0,children:E,showControlDownload:M=!1,showControlExpand:L=!1,isFullscreen:H=!1})=>{const x=o(null),V=o(null),[k,S]=c(0),[Z,O]=c(0),[z,N]=c(!1),[I,T]=c(0);l(()=>{"video"===s&&x.current&&!E&&(i?x.current.play():x.current.pause())},[i,s,E]);const D=p(()=>{if(x.current&&!z){const e=x.current.currentTime/x.current.duration*100;T(e||0),S(x.current.currentTime)}},[z]),F=p(()=>{x.current&&O(x.current.duration)},[]),R=p(()=>{S(0),T(0),a?.()},[a]),P=p(e=>`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`,[]),B=p(e=>{if(x.current){const t=e/100*x.current.duration;x.current.currentTime=t,T(e),S(t)}},[]),j=p(e=>{if(z||!V.current)return;const t=V.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[B,z]),_=p(e=>{if(!V.current)return;N(!0);const t=V.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||!V.current||!x.current)return;const t=V.current.getBoundingClientRect(),n=e.clientX-t.left,r=t.width,i=Math.max(0,Math.min(100,n/r*100));B(i)},[z,B]),X=p(()=>{N(!1)},[]);return l(()=>{if(z)return document.addEventListener("mousemove",W),document.addEventListener("mouseup",X),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",X)}},[z,W,X]),t?e(su,{isOpen:t,onClose:r,isMaximized:!1,showHeader:C,overlay:b,downloadHandler:()=>{},customStyle:w,header:n("header",{className:"ff-header-content","aria-label":"Media viewer header",children:[e(q,{width:23,height:23,name:"automatic_locator"}),e(U,{children:e("span",{className:"ff-header-title",children:u})})]}),icons:e(Y,{title:"Close",children:e(q,{name:"close",onClick:r,"aria-label":"Close media viewer"})}),width:g,height:v,zIndex:999,children:n("section",{className:"ff-video-wrapper","aria-label":"Media viewer content",children:[E||("video"===s?e("video",{ref:x,src:d,className:"ff-media-video",onTimeUpdate:D,onLoadedMetadata:F,onEnded:R}):e("img",{src:d,alt:"Preview image",className:"ff-media-image"})),n("nav",{className:"ff-top-right-icons","aria-label":"Media viewer actions",children:[m&&e(Y,{title:"Download",children:e(q,{name:"download_file",color:"white",onClick:f,"aria-label":"Download media"})}),A&&e(Y,{title:H?"Minimize":"Maximize",children:e(q,{name:H?"collapse_icon":"expand_icon",color:"white",onClick:h,"aria-label":H?"Minimize media viewer":"Maximize media viewer"})})]}),"video"===s&&y&&!E&&n("section",{className:"ff-media-controls","aria-label":"Video controls",children:[e("button",{onClick:a,className:"ff-play-pause-btn","aria-label":i?"Pause video":"Play video",children:e(Y,{title:i?"Pause":"Play",children:e(q,{width:35,height:35,name:i?"pause_button":"play_button",color:"white","aria-label":i?"Pause video":"Play video"})})}),n("div",{className:"ff-progress-bar","aria-label":"Video progress",children:[e("span",{className:"ff-current-time",children:P(k)}),e("input",{type:"range",className:"ff-seek-bar",min:0,max:100,value:I,onChange:e=>B(parseFloat(e.target.value)),onClick:j,onMouseDown:_,ref:V,"aria-label":"Seek video"}),e("span",{className:"ff-total-time",children:P(Z)})]}),n("nav",{className:"ff-control-icons","aria-label":"Additional video actions",children:[M&&e(Y,{title:"Download",children:e(q,{name:"download_file",color:"white",onClick:f,cursorType:"pointer","aria-label":"Download video"})}),L&&e(Y,{title:H?"Minimize":"Maximize",children:e(q,{name:H?"collapse_icon":"expand_icon",color:"white",onClick:h,cursorType:"pointer","aria-label":H?"Minimize video":"Maximize video"})})]})]})]})}):null},jL=({header:r,secondaryHeader:i,primaryCount:a,secondaryCount:o,primaryItems:l,secondaryItems:s,width:c,activeTab:d="primary",activeTabId:u,onPrimaryTabClick:f,onSecondaryTabClick:h,onTabClick:C,actions:p,tabsData:m,notchPosition:A="top-left"})=>{const g=i&&"secondary"===d?s:l,v=o&&parseInt(o)>0,y=a&&parseInt(a)>0,w=i&&(y||v),{tooltip:b="Download",iconName:E="download_file",disabled:M=!1,onClick:L,className:H=""}=p?.download||{},{tooltip:x="Delete",iconName:V="delete_icon",disabled:k=!1,onClick:S,className:Z=""}=p?.delete||{},O=()=>n("div",{className:"ff-dropdown-header-icons","aria-label":"Session actions",children:[p?.download&&e(Y,{title:b,children:e(q,{name:E||"",className:`ff-dropdown-icon ff-download-icon ${H}`,onClick:L,width:18,height:20,disabled:M,hoverEffect:!0,"aria-label":b||"Download"})}),p?.delete&&e(Y,{title:x,children:e(q,{name:V||"",className:`ff-dropdown-icon ff-delete-icon ${Z}`,onClick:S,width:25,height:25,disabled:k,hoverEffect:!0,"aria-label":x||"Delete"})})]});return n("section",{className:"ff-resolution-dropdown",style:c?{minWidth:c}:{},"aria-label":r||"Session dropdown",children:[e("div",{className:"ff-dropdown-notch "+("bottom-center"===A?"bottom-center":"top-left"),"aria-label":"Dropdown notch"}),e("header",{className:"ff-dropdown-header","aria-label":"Session dropdown header",children:e("div",{className:"ff-dropdown-header-content","aria-label":"Session header content",children:i&&m&&u?n(t,{children:[e(wu,{tabsData:m,activeTabId:u,onTabClick:e=>{C&&C(e),"tab-1"===e&&f?f():"tab-2"===e&&h&&h()}}),w&&O()]}):i&&w?n("div",{className:"ff-dropdown-header-dual","aria-label":"Session tabs",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,"aria-label":`${r}${"primary"===d?" selected":""}`,"aria-pressed":"primary"===d,children:[e(U,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),a&&e("span",{className:"ff-dropdown-count",children:a})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,"aria-label":`${i}${"secondary"===d?" selected":""}`,"aria-pressed":"secondary"===d,children:[e(U,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),o&&e("span",{className:"ff-dropdown-count",children:o})]}),O()]}):i?n("div",{className:"ff-dropdown-header-dual","aria-label":"Session tabs",children:[n("div",{className:"ff-dropdown-header-item "+("primary"===d?"active":""),onClick:f,"aria-label":`${r}${"primary"===d?" selected":""}`,"aria-pressed":"primary"===d,children:[e(U,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:r}),a&&e("span",{className:"ff-dropdown-count",children:a})]}),n("div",{className:"ff-dropdown-header-item "+("secondary"===d?"active":""),onClick:h,"aria-label":`${i}${"secondary"===d?" selected":""}`,"aria-pressed":"secondary"===d,children:[e(U,{fontWeight:"semi-bold",className:"ff-dropdown-text",children:i}),o&&e("span",{className:"ff-dropdown-count",children:o})]})]}):e(U,{fontSize:16,fontWeight:"semi-bold",children:r})})}),e("ul",{className:"ff-dropdown-list","aria-label":"Session items list",children:g?.map((t,n)=>e("li",{className:"ff-dropdown-item","aria-label":`Session item ${n+1}`,children:t},n))})]})},_L=(e,t,n,r)=>{const i=e[t.accessor];if(t.cell){const a=e._id||e.id;return t.cell({value:i,row:e,column:t.accessor,index:n,tableType:r,...a&&{refId:a}})}return t.accessor||i&&"object"!=typeof i?i:"--"},qL=(t,n)=>{const r=Number.isFinite(t)?Math.max(0,t):0;return e("div",{className:"tree-table-fn-space-container",children:Array.from({length:r},(t,r)=>e("span",{className:`tree-table-fn-space-block tree-table-fn-space-block-${r} ${n?"folder":""}`},r))})},UL=i.memo(({treeRowRef:r,col:i,colIndex:a,columnMeta:o,node:l,selected:s,select:c,onCheckBoxChange:d,onToggleExpand:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,isExpanding:p,columnTextColor:m,hideOnDisable:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:b})=>{const E={color:`${m||"var(--ff-primary-text-color)"}`,width:o?.width??i?.width,position:o?.sticky?"sticky":void 0,left:o?.sticky?o.left:void 0,zIndex:o?.sticky?o.zIndex:void 0};return n("div",{className:`ff-table-tree-fn-td ${i.isTree&&l.container?"folder":""} ${o?.sticky?"sticky-tree-column":""}`,"data-col-index":a,style:E,children:[i.isTree&&qL(l.hierarchy,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(p?pu:T,{})]})}),n("span",{className:"tree-table-fn-td-content "+(i.isTree&&l.container?"folder":""),children:[!l?.isNewNode&&n(t,{children:[i.isTree&&"checkbox"===c&&!(A&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:"none"===l.selectedStatus?e(Y,{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(En,{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(En,{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&&!(A&&l.unselectable)&&e("span",{className:"tree-table-fn-td-content-select",children:e(fc,{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})})]}),e("div",{className:"tree-table-cell-flex",children:l.isNewNode&&i.isTree?e(Cu,{onCancel:h,onConfirm:f,value:l.value,label:l?.label,optionsList:l.options,selectedOption:l.selectedOption,withDropdown:"inputWithDropdown"===l.type,handleCustomError:C,inputFieldWidth:g,selectFieldWidth:v,confirmIconTooltip:l.confirmIconTooltip,cancelIconTooltip:l.cancelIconTooltip,isEditable:w,setIsEditable:b,isOnBlurTrue:!1,isDisable:{confirm:y},isTableTree:!0}):n(t,{children:[e("span",{className:"tree-table-fn-td-content-text",children:_L(l,i)}),i.actions&&!l?.isNewNode&&e("div",{className:"table-tree-fn-row-action",children:i.actions(l,r)})]})})]})]})]})});UL.displayName="TableCell";const WL=i.memo(({node:t,columnsData:n,columnMeta:r,selected:i,select:a,onRowClick:l,onToggleExpand:s,onCheckBoxChange:c,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,index:C,selectedNode:p,hideOnDisable:m,addModuleInputWidth:A,addModuleSelectWidth:g,disableEditLabelConfirmIcon:v,isEditable:y,setIsEditable:w,style:b})=>{const E=o(null);return e("div",{"data-level":t.hierarchy,ref:E,className:"ff-table-tree-fn-row show-tree "+(p&&p===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===C?"table-fn-first-row":t.key,style:b,children:n.map((n,o)=>e(UL,{treeRowRef:E,col:n,colIndex:o,node:t,selected:i,select:a,onCheckBoxChange:c,onToggleExpand:s,onAddConfirm:d,onAddCancel:u,handleEditFieldError:f,isExpanding:h,hideOnDisable:m,addModuleInputWidth:A,addModuleSelectWidth:g,disableEditLabelConfirmIcon:v,isEditable:y,setIsEditable:w,columnMeta:r?.[o]},n.name))})});WL.displayName="TableRow";const XL=({flattenedTreeData:t,columnsData:n,columnMeta:r,rowHeight:i=32,startIndex:a=0,totalHeight:o=0,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,expanding:p,selectedNode:m,hideOnDisable:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:b})=>e("div",{className:"ff-table-tree-fn-body",style:{height:`${o}px`,position:"relative"},children:t?.map((t,o)=>e(WL,{node:t,columnsData:n,columnMeta:r,selected:l,select:s,onRowClick:c,onToggleExpand:d,onCheckBoxChange:u,onAddConfirm:f,onAddCancel:h,handleEditFieldError:C,isExpanding:t.key===p,index:a+o,selectedNode:m,hideOnDisable:A,addModuleInputWidth:g,addModuleSelectWidth:v,disableEditLabelConfirmIcon:y,isEditable:w,setIsEditable:b,style:{transform:`translateY(${(a+o)*i}px)`,height:`${i}px`,position:"absolute",top:0,left:0,right:0}},t.key))}),QL=i.memo(({columnsData:t,columnMeta:r,totalWidth:i,rootNode:a,selected:s,onCheckBoxChange:d,selectedNode:u,tableHeaderBgColor:f,hideOnDisable:h,transparentHeader:C,showHeader:p=!0,showRootNodeColumnActions:m})=>{const A=o(null),[g,v]=c(!1);l(()=>{v(!0)},[]);const y=(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:[p&&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:{...y(i,n),backgroundColor:C?"transparent":f,pointerEvents:C?"none":"auto"},children:t},t))}),a&&e("div",{className:"ff-table-tree-fn-row show-tree "+(u&&u===a?.node?.key?"hover":""),ref:A,children:t.map((t,i)=>e("div",{className:"ff-table-tree-fn-td "+(r?.[i]?.sticky?"sticky-tree-column":""),"data-col-index":i,style:y(i,t.width),children:n("span",{className:"tree-table-fn-default-content "+(0===i?"ff-table-root-index-0":""),children:[0===i&&"checkbox"===a.select&&!(h&&a.node.isDisabled)&&e(En,{checked:"partially"!==a?.node?.selectedStatus&&("completely"===a?.node?.selectedStatus||!1),partial:"partially"===a?.node?.selectedStatus,onChange:e=>d(e,a?.node),disabled:a?.node?.isDisabled}),0===i&&"radio"===a.select&&!(h&&a.node.isDisabled)&&e(fc,{name:a.node.key,checked:s.includes(a.node.key),value:a.node.key,onChange:e=>d(e,a.node),disabled:a.node.isDisabled}),n("div",{className:"tree-table-cell-flex",children:[e(Qs,{children:"name"===t.accessor?a.node[t.accessor]:_L(a.node,t)}),a.cell&&0===i&&e("span",{className:"table-tree--fn-root-cell",children:a.cell(a.node)}),a.actions&&0===i&&g&&A.current&&e("div",{className:"table-tree-fn-row-action",children:a.actions(a.node,A)}),m&&t.actions&&"name"!==t.accessor&&e("div",{className:"table-tree-fn-row-action",children:t.actions(a.node,A)})]})]})},i))})]})});QL.displayName="TableHead";const GL=32,KL="__root__",YL=a(({treeData:t,columnsData:r,selected:i=[],select:a=null,onChange:s=()=>{},onClick:d=()=>{},onExpand:f=()=>{},loadMore:h=()=>{},tableBorder:m,height:A="calc(100vh - 134px)",newNode:g,onAddConfirm:v=()=>{},onAddCancel:y=()=>{},handleEditFieldError:w,loading:b=!1,rootNode:E,pagination:M=!0,selectedNode:L,tableHeaderBgColor:H="var(--border-color-as-bg)",hideOnDisable:x=!1,freezeColumns:V,addModuleInputWidth:k=150,addModuleSelectWidth:S,onScroll:Z,onScrollEnd:O,disableEditLabelConfirmIcon:z=!1,transparentHeader:N=!1,navigateTreeNode:I=null,handleRemoveNavigateTreeNode:T=()=>{},scrollThreshold:D=128,showHeader:F=!0,resetScroll:R=!1,setResetScroll:P=()=>{},showRootNodeColumnActions:B=!1},j)=>{const[_,q]=c(null),[U,W]=c(null),[X,Q]=c({start:0,end:20}),[G,Y]=c(!1),J=o(null),$=o(null),ee=o(0),te=o(b),ne=o(null),re=o(null),ie=o({lastScrollTop:0}),ae=o([]),oe=o(0),le=o(null),se=o(null),ce=o(null),de=o({key:null,attempts:0}),ue=o(null),fe=(e,t)=>{const n=String(e??t);return n.endsWith("%")?{value:parseFloat(n),unit:"%"}:{value:parseFloat(n)||0,unit:"px"}},he=C(()=>{let e=0,t=0;return r.map((n,r)=>{const{value:i,unit:a}=fe(n.width,400),o=!!V&&r<V,l="%"===a?`${i}%`:`${i}px`,s=`calc(${e}px + ${t}%)`;return o&&("%"===a?t+=i:e+=i),{width:l,sticky:o,left:s,zIndex:o?100+(V??0)-r:1}})},[r,V]),Ce=C(()=>{let e=0,t=0;return r.forEach(n=>{const{value:r,unit:i}=fe(n.width,400);"%"===i?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[r]),pe=C(()=>{if(!V)return"0px";let e=0,t=0;return he.slice(0,V).forEach(n=>{const r=parseFloat(n.width)||0;n.width.endsWith("%")?t+=r:e+=r}),`calc(${e}px + ${t}%)`},[he,V]),me=C(()=>((e,t,n)=>{if(!t?.sourceId||!t.action)return e;const{sourceId:r,action:i,value:a="",error:o="",label:l,type:s,options:c,selectedOption:d,confirmIconTooltip:u,cancelIconTooltip:f,payloadSourceId:h}=t,C=t?.parentId,p=t?.hierarchy,m=c?.map(e=>({label:e,value:e})),A=d?{label:d,value:d}:void 0,g=new Map;e.forEach(e=>g.set(e.key,e)),n&&g.set(n.key,n);const v=g.get(r);let y;h&&(y=g.get(h));let w=v??("addInside"===i?y:void 0);!w&&"addInside"===i&&C&&(w=g.get(C));const b="addInside"===i&&!w&&e.length>=0;if(!w&&!b)return e;const E=[...e],M=w?e.findIndex(e=>e.key===w.key):-1;let L=null,H=0,x=M+1;switch(i){case"addAbove":{const t=w;if(!t)return e;L=t.parentId,H=t.hierarchy;break}case"addBelow":{const t=w;if(!t)return e;L=y?.parentId??t.parentId,H=y?.hierarchy??t.hierarchy;break}case"addInside":{if(b){L=C??h??r??null,H=p??1,x=E.length;break}const t=y??w;if(!t)return e;L=t.key,H=(t.hierarchy??0)+1;const n=E.findIndex(e=>e.key===r);-1!==n&&(x=n+1);const i=E.findIndex(e=>e.key===t.key),a=E[i];a&&(E[i]={...a,expandable:!0,expanded:!0});break}}const V={hierarchy:H,parentId:L,sourceId:w?.key??r??h??"new-node",isNewNode:!0,key:"new-node",value:a,error:o,label:l,type:s,options:m,selectedOption:A,confirmIconTooltip:u,cancelIconTooltip:f};switch(i){case"addAbove":E.splice(M,0,V);break;case"addBelow":E.splice(M+1,0,V);break;case"addInside":E.splice(Math.max(0,x),0,V)}return E})(t,g,E?.node),[t,g,E]),Ae=C(()=>((e,t)=>{if(!e?.length)return[];const n=new Map,r=new Map,i=new Map,a=new Map;t&&t.key&&n.set(String(t.key),t),e.forEach(e=>{n.set(String(e.key),e);const t=e.parentId?String(e.parentId):KL;r.has(t)||(r.set(t,[]),a.set(t,{container:0,resource:0})),r.get(t)?.push(e);const i=a.get(t);i&&(e.container?i.container++:i.resource++)}),r.forEach(e=>{e.forEach((e,t)=>{i.set(String(e.key),t)})});const o=e=>{const t=e.parentId?String(e.parentId):KL,o=r.get(t);if(!o||0===o.length)return!1;if((i.get(String(e.key))??0)<o.length-1)return!0;const l=n.get(t),s=a.get(t);if(l&&s){const t=o.filter(e=>e.container).reduce((e,t)=>e+(t.totalResourceCount??0),0),n=o.filter(e=>!e.container).length,r=Math.max(0,(l.totalResourceCount??0)-(t+n));return e.container?s.container<(l.subContainerCount??0)||r>0: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(String(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=>({...e,lastChild:!o(e),selectedStatus:l(e)}))})(me,E?.node),[me,E?.node]),ge=C(()=>Ae.filter(e=>!e.hide),[Ae]),ve=C(()=>{const e=new Map;return Ae.forEach(t=>e.set(t.key,t)),e},[Ae]),ye=C(()=>{const e=new Map;return ge.forEach((t,n)=>e.set(t.key,n)),e},[ge]),we=p(e=>{q(t=>t?e&&t!==e?t:null:t),e&&se.current?.key!==e||(se.current=null),ce.current&&(clearTimeout(ce.current),ce.current=null)},[]);l(()=>{te.current=b},[b]),l(()=>{ne.current=U},[U]);const be=p(e=>{ne.current=e,W(e)},[]),Ee=p(()=>{const e=J.current;if(!e)return;const t=ee.current||0,n=Math.max(0,e.scrollTop-t),r=e.clientHeight-t;let i=Math.floor(n/GL)-6,a=Math.ceil((n+r)/GL)+6;i=Math.max(0,i),a=Math.min(ge.length,a),Q(e=>e.start===i&&e.end===a?e:{start:i,end:a})},[ge.length]),Me=p(()=>{null===re.current&&(re.current=requestAnimationFrame(()=>{re.current=null,Ee()}))},[Ee]),Le=p(()=>{const e=J.current;if(!e)return;const n=e.scrollTop,r=n>ie.current.lastScrollTop?"down":"up";if(ie.current.lastScrollTop=n,Me(),Z?.(),le.current?.(),!M||b||ne.current||K(t))return;const i=e.scrollHeight,a=e.clientHeight;"down"===r&&i-(n+a)<D&&!t[t.length-1]?.lastResource&&(be("below"),h("below"))},[t,M,b,U,D,Me,Z,h,be]);l(()=>{if(b||!M||K(t))return;const e=t[0],n=!e?.lastResource,{totalSubContainerCount:r=0,totalResourceCount:i=0}=E?.node||{},a=r+i,o=ge.length<10&&ge.length<a;n&&o&&(be("above"),h("above"))},[b,M,t,ge.length,E,h,be]),u(()=>{const e=ae.current,t=ge,n=J.current;if(R&&n)return n.scrollTop=0,ie.current.lastScrollTop=0,void P(!1);if(n&&e.length>0&&t.length>0&&!b){const r=ie.current.lastScrollTop,i=Math.max(0,Math.floor(r/GL));let a=-1,o=-1;for(let t=i;t<e.length;t++){const n=e[t]?.key,r=ye.get(n??"");if(void 0!==r){a=t,o=r;break}}if(-1===a)for(let t=i-1;t>=0;t--){const n=e[t]?.key,r=ye.get(n??"");if(void 0!==r){a=t,o=r;break}}if(-1!==a&&-1!==o){const e=o-a,t=Math.max(0,r+e*GL);n.scrollTop!==t&&(n.scrollTop=t,ie.current.lastScrollTop=n.scrollTop,Ee())}else if("above"===U)0!==n.scrollTop&&(n.scrollTop=0,ie.current.lastScrollTop=0,Ee());else{const e=ee.current||0,r=Math.max(0,t.length*GL-(n.clientHeight-e));n.scrollTop>r&&(n.scrollTop=r,ie.current.lastScrollTop=r,Ee())}U&&be(null)}ae.current=t},[b,U,ye,ge,be,Ee,R,P]),l(()=>{const e=J.current;if(!e)return;const n=n=>{n.deltaY>=0||!M||K(t)||te.current||ne.current||e.scrollTop>1||t[0]?.lastResource||(be("above"),h("above"))};return e.addEventListener("wheel",n,{passive:!0}),()=>{e.removeEventListener("wheel",n)}},[M,t,h,be]),l(()=>{const e=J.current;if(e)return le.current=O?Js(()=>{O?.()},150):null,e.addEventListener("scroll",Le,{passive:!0}),()=>{e.removeEventListener("scroll",Le),le.current?.cancel()}},[Le,O]),l(()=>{const e=J.current;if(!e)return;const t=e=>{Date.now()<oe.current&&e.stopImmediatePropagation()};return e.addEventListener("scroll",t,{passive:!0,capture:!0}),()=>{e.removeEventListener("scroll",t,!0)}},[]),l(()=>{const e=$.current;if(!e)return;const t=new ResizeObserver(()=>{ee.current=e.getBoundingClientRect().height,Ee()});return t.observe(e),()=>t.disconnect()},[Ee]),u(()=>{if(!g||!J.current)return;const e=J.current,t=ye.get("new-node");if(void 0===t)return;const n=ee.current||0,r=e.clientHeight-n;if(r<=0)return;const i=t*GL,a=i+GL,o=Math.max(0,e.scrollTop-n);let l=o;i<o?l=i:a>o+r&&(l=Math.max(0,a-r)),l!==o&&(oe.current=Date.now()+300,e.scrollTop=l+n,ie.current.lastScrollTop=e.scrollTop,Ee());const s=requestAnimationFrame(()=>{Y(!0)});return()=>cancelAnimationFrame(s)},[g,ye,Ee]),l(()=>{g||Y(!1)},[g]),u(()=>{if(!_||b)return;const e=se.current;if(!e||e.key!==_){const e=requestAnimationFrame(()=>{we(_)});return()=>cancelAnimationFrame(e)}const t=ve.get(e.key);if(!t){const t=requestAnimationFrame(()=>{we(e.key)});return()=>cancelAnimationFrame(t)}if(Boolean(t.expanded)!==e.expanded)return;const n=requestAnimationFrame(()=>{we(e.key)});return()=>cancelAnimationFrame(n)},[ve,_,b,we]),l(()=>{de.current.key!==I&&(de.current={key:I,attempts:0}),!I&&ue.current&&(clearTimeout(ue.current),ue.current=null)},[I]),u(()=>{if(!I||g)return;const e=J.current;if(!e)return;const n=ye.get(I);if(void 0!==n){de.current={key:I,attempts:0};const t=ee.current||0,r=Math.max(GL,e.clientHeight-t),i=n*GL+16,a=Math.max(0,i-r/2)+t;return oe.current=Date.now()+400,e.scrollTo({top:a,behavior:"smooth"}),Me(),ue.current&&clearTimeout(ue.current),void(ue.current=setTimeout(()=>{T?.()},350))}if(b||U)return;const r=de.current;if(r.key!==I&&(r.key=I,r.attempts=0),r.attempts+=1,!(r.attempts>30))return M&&!0!==t[0]?.lastResource?(be("above"),void h("above")):void(r.attempts>2&&T?.());T?.()},[I,g,ye,b,U,M,t,h,Me,T,be]);const He=p(e=>{if(_)return;const t=!e?.expanded;q(e.key),se.current={key:e.key,expanded:t},ce.current&&clearTimeout(ce.current);const n=Date.now(),r=()=>{if(se.current?.key!==e.key)return;const t=te.current,i=Date.now()-n>=2e3;!t||i?we(e.key):ce.current=setTimeout(r,1e3)};ce.current=setTimeout(r,1e3),f?.(e)},[_,f,we]),xe=p((e,t)=>{_||s?.(e,t)},[s,_]),Ve=p((e,t)=>{_||d?.(e,t)},[d,_]);l(()=>()=>{null!==re.current&&(cancelAnimationFrame(re.current),re.current=null),ce.current&&clearTimeout(ce.current),ue.current&&clearTimeout(ue.current)},[]);const ke=ge.length*GL,Se=ge.slice(X.start,X.end);return e("section",{className:"tree-table-wrapper-container table-tree-fn","aria-label":"Tree table function wrapper",children:e("div",{className:"tree-table-fn-wrap",ref:j,"aria-label":"Tree table container",children:e("div",{className:"table-fn-scrollable "+(ge.length?"":"table-fn-empty"),ref:J,"aria-label":"Tree table scroll area",style:{"--table-height":ge.length?A:"auto","--frozen-column-width":pe,border:m},children:n("div",{className:"tree-table-fn",style:{width:Ce},role:"table","aria-label":"Tree table",children:[e("div",{ref:$,style:{position:"sticky",top:0,zIndex:98},role:"rowgroup","aria-label":"Tree table header",children:e(QL,{columnsData:r,columnMeta:he,totalWidth:Ce,rootNode:E,onCheckBoxChange:xe,selected:i,selectedNode:L,tableHeaderBgColor:H,hideOnDisable:x,transparentHeader:N,showHeader:F,showRootNodeColumnActions:B})}),e("div",{role:"rowgroup","aria-label":"Tree table body",children:e(XL,{flattenedTreeData:Se,columnsData:r,columnMeta:he,totalWidth:Ce,rowHeight:GL,startIndex:X.start,totalHeight:ke,selected:i,select:a,onRowClick:Ve,onToggleExpand:He,onCheckBoxChange:xe,onAddConfirm:v,onAddCancel:y,handleEditFieldError:w,expanding:_,selectedNode:L,hideOnDisable:x,addModuleInputWidth:k,addModuleSelectWidth:S,disableEditLabelConfirmIcon:z,isEditable:g?G:void 0,setIsEditable:g?e=>{Y(Boolean(e))}:void 0})})]})})})})});YL.displayName="TableTreeFn";const JL=t=>e(cA,{logo:()=>"FireFlink"===t?.name?e(q,{height:100,width:100,name:"fire_flink_loader_logo","aria-label":"Loader logo"}):e("img",{src:t?.loaderName,width:100,height:100,alt:"loader"})}),$L=({isVisible:t})=>t?n("section",{className:"no_data_message","aria-live":"polite","aria-label":"No data available message",children:[e(q,{name:"no_content",width:120,height:120,"aria-label":"No data illustration"}),e(U,{fontSize:"20px",lineHeight:"30px",fontWeight:"semi-bold",children:"No Data Available"})]}):null,eH=({text:t=" No Results Found",iconName:r="no_license_found",fontSize:i="24px",textAlign:a="left",direction:o="column",iconWidth:l=120,iconHeight:s=120,fontWeight:c="semi-bold",marginTop:d="0px"})=>e("article",{className:"no_results_container","aria-live":"polite","aria-label":"No result found",children:n("section",{className:`no_results_container__${o}`,style:{marginTop:d},"aria-label":"No result content",children:[e(q,{name:r,width:l,height:s,"aria-label":"No result illustration"}),e("div",{"aria-label":"No result message",children:e(U,{as:"div",fontSize:i,lineHeight:"36px",fontWeight:c,color:"var(--text-color)",textAlign:a,children:t})})]})}),tH=({drawerProps:t,showDrawer:n,children:r,zIndex:i=1200,top:a="56px"})=>e("div",n?{"aria-label":"Layout with drawer",role:"region",children:e(vn,{isOpen:t?.isOpen??!0,...t,zIndex:i,top:a,children:r})}:{"aria-label":"Layout content",role:"region",children:r});const nH=({children:n,offlineContent:r,hasError:i=!1,onNetworkStatusChange:a,overlayClassName:o,overlayZIndex:s=99998,iconWidth:d=300,iconHeight:u=300})=>{const f=function(){const[e,t]=c(navigator.onLine);return l(()=>{const e=()=>{t(!0)},n=()=>{t(!1)};return window.addEventListener("online",e),window.addEventListener("offline",n),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}},[]),e}();return l(()=>{a&&a(f)},[f,a]),i||!f?e("section",{className:`offlineOverlay ${o??""}`,style:{zIndex:s},"aria-live":"polite","aria-label":"Network error overlay",children:r||e(q,{name:"offline_404_icon",height:u,width:d,"aria-label":"Offline error illustration"})}):e(t,{children:n})},rH=e=>{const t=Number.isFinite(e)&&e>0?e:0,n=Math.floor(t/60),r=Math.floor(t%60);return`${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`},iH=[.5,1,1.5,2],aH=({duration:r,currentTime:i,isPlaying:a=!1,onPlayPause:l=()=>{},onSeek:s=()=>{},isMuted:d=!1,onMuteToggle:u=()=>{},menuOptions:f,showCaptions:h=!1,onMenuOptionClick:C=()=>{},playbackRate:p=1,onPlaybackRateChange:m=()=>{},disabled:A=!1,seekStep:g=5,formatTime:v=rH,className:y="",style:w={}})=>{const b=r>0?i/r*100:0,E=o(null),M=o(null),[H,x]=c(!1),[V,k]=c({top:0,left:0}),[S,Z]=c(0),O=o(null),z=f??[...h?[{label:"Captions",value:"captions",icon:"captions"}]:[],{label:n("div",{ref:M,className:"playback-menu-option",children:["Playback Speed ",e(xi,{label:`${p.toFixed(1)} x`})]}),value:"playback-speed",icon:"playback",keepMenuOpen:!0}],N=e=>Math.min(Math.max(e,0),r||0);return n("div",{className:`ff-audio-player ${y}`,style:w,"aria-disabled":A,tabIndex:A?-1:0,role:"group","aria-label":A?"Audio player disabled":"Audio player",onKeyDown:e=>{if(A)return;if("INPUT"!==e.target.tagName)switch(e.key){case" ":case"Spacebar":e.preventDefault(),l();break;case"m":case"M":e.preventDefault(),u();break;case"ArrowRight":e.preventDefault(),s(N(i+g));break;case"ArrowLeft":e.preventDefault(),s(N(i-g))}},children:[e("button",{type:"button",className:"ff-audio-play-btn",onClick:l,disabled:A,"aria-label":a?"Pause":"Play",children:a?n("span",{className:"ff-audio-pause-shape",children:[e("span",{className:"ff-audio-pause-bar"}),e("span",{className:"ff-audio-pause-bar"})]}):e(q,{name:"play",width:8,height:8,cursorType:"pointer",withPadding:!1,className:"ff-audio-play"})}),e(U,{fontSize:8,className:"ff-audio-time",children:v(i)}),n("div",{className:"ff-audio-seek-wrap",children:[e("div",{className:"ff-audio-seek-track"}),e("div",{className:"ff-audio-seek-fill",style:{width:`${b}%`}}),e("input",{type:"range",className:"ff-audio-seek",min:0,max:r||0,step:1,value:i,disabled:A,onChange:e=>{s(Number(e.target.value))},"aria-label":"Seek"})]}),e(U,{fontSize:8,className:"ff-audio-time",children:v(r)}),e(q,{name:"speaker",onClick:A?()=>{}:u,disabled:A,withPadding:!1,className:"ff-audio-speaker-icon"+(d?" ff-audio-speaker-muted":""),cursorType:"pointer","aria-label":d?"Unmute audio":"Mute audio"}),e("div",{className:"ff-audio-more-wrap",ref:E,children:e(Da,{iconName:"more","aria-label":"More audio options",options:z,onOptionClick:e=>{if("playback-speed"===e.value){const e=M.current?.getBoundingClientRect();if(e){let t=e.top,n=e.right+8;t+102>window.innerHeight-8&&(t=Math.max(8,e.bottom-102)),n+36>window.innerWidth-8&&(n=Math.max(8,e.left-36-8)),k({top:t,left:n})}const t=iH.indexOf(p);return Z(t>=0?t:0),x(!0),void requestAnimationFrame(()=>O.current?.focus())}C(e)},dropdownPlacement:"bottomLeft",displayCard:!0,disabled:A,iconSize:12})}),H&&L(n(t,{children:[e("div",{className:"ff-audio-speed-overlay",onClick:()=>x(!1)}),e("div",{className:"ff-audio-speed-menu",style:{top:V.top,left:V.left},ref:O,tabIndex:-1,role:"listbox","aria-label":"Playback speed",onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),Z(e=>(e+1)%iH.length);break;case"ArrowUp":e.preventDefault(),Z(e=>(e-1+iH.length)%iH.length);break;case"Enter":e.preventDefault(),m(iH[S]),x(!1);break;case"Escape":e.preventDefault(),x(!1)}},children:iH.map((t,r)=>{const i=t===p;return e("button",{type:"button",role:"option","aria-selected":i,className:["ff-audio-speed-option",r===S&&"ff-audio-speed-option-highlighted",i&&"ff-audio-speed-option-selected"].filter(Boolean).join(" "),onMouseEnter:()=>Z(r),onMouseDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation(),m(t),x(!1)},children:n(U,{fontSize:10,children:[t.toFixed(1),"x"]})},t)})})]}),document.body)]})};function oH(e,t,n,r,i,a="children"){return function e(o){for(let l=0;l<o.length;l++){const s=o[l];if(s&&s[t]===n){const e=[...o];return"replace"===i?e[l]=r:e.splice("above"===i?l:l+1,0,r),{updatedArray:e}}if(s&&s[a]&&Array.isArray(s[a])){const t=e(s[a]);if(t)return{updatedArray:o.map((e,n)=>n===l?{...e,[a]:t.updatedArray}:e)}}}return null}(e)}const lH=(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),a=r?t:Object.keys(t);if(i.length!==a.length)return!1;if(n)return i.every((e,t)=>lH(e,a[t]));{const n=new Set(a);return i.every(r=>n.has(r)&&lH(e[r],t[r]))}},sH=(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every((e,n)=>{const r=t[n];return lH(e,r)}));function cH(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function dH(e,t){return e&t}function uH(e,t){return e|t}function fH(e,t){return e^t}function hH(e,t){return e&~t}function CH(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 pH(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var mH,AH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function gH(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=AH.charAt(n>>6)+AH.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=AH.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=AH.charAt(n>>2)+AH.charAt((3&n)<<4));(3&r.length)>0;)r+="=";return r}function vH(e){var t,n="",r=0,i=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var a=AH.indexOf(e.charAt(t));a<0||(0==r?(n+=cH(a>>2),i=3&a,r=1):1==r?(n+=cH(i<<2|a>>4),i=15&a,r=2):2==r?(n+=cH(i),n+=cH(a>>2),i=3&a,r=3):(n+=cH(i<<2|a>>4),n+=cH(15&a),r=0))}return 1==r&&(n+=cH(i<<2)),n}var yH,wH=function(e){var t;if(void 0===mH){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(mH={},t=0;t<16;++t)mH[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)mH[n.charAt(t)]=t;for(t=0;t<8;++t)mH[r.charAt(t)]=-1}var i=[],a=0,o=0;for(t=0;t<e.length;++t){var l=e.charAt(t);if("="==l)break;if(-1!=(l=mH[l])){if(void 0===l)throw new Error("Illegal character at offset "+t);a|=l,++o>=2?(i[i.length]=a,a=0,o=0):a<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return i},bH={decode:function(e){var t;if(void 0===yH){var n="= \f\n\r\t \u2028\u2029";for(yH=Object.create(null),t=0;t<64;++t)yH["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(yH["-"]=62,yH._=63,t=0;t<9;++t)yH[n.charAt(t)]=-1}var r=[],i=0,a=0;for(t=0;t<e.length;++t){var o=e.charAt(t);if("="==o)break;if(-1!=(o=yH[o])){if(void 0===o)throw new Error("Illegal character at offset "+t);i|=o,++a>=4?(r[r.length]=i>>16,r[r.length]=i>>8&255,r[r.length]=255&i,i=0,a=0):i<<=6}}switch(a){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=bH.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 bH.decode(e)}},EH=1e13,MH=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,r,i=this.buf,a=i.length;for(n=0;n<a;++n)(r=i[n]*e+t)<EH?t=0:r-=(t=0|r/EH)*EH,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+=EH,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+=(EH+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*EH+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),LH=/^(\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)?)?$/,HH=/^(\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 xH(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}var VH,kH=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="",a=e;a<t;)n=this.get(a++),r=this.get(a++),i+=String.fromCharCode(n<<8|r);return i},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),i=(n?LH:HH).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,a=i?255:0,o="";r==a&&++e<t;)r=this.get(e);if(0===(n=t-e))return i?-1:0;if(n>4){for(o=r,n<<=3;!(128&(+o^a));)o=+o<<1,--n;o="("+n+" bit)\n"}i&&(r-=256);for(var l=new MH(r),s=e+1;s<t;++s)l.mulAdd(256,this.get(s));return o+l.toString()},e.prototype.parseBitString=function(e,t,n){for(var r=this.get(e),i="("+((t-e-1<<3)-r)+" bit)\n",a="",o=e+1;o<t;++o){for(var l=this.get(o),s=o==t-1?r:0,c=7;c>=s;--c)a+=l>>c&1?"1":"0";if(a.length>n)return i+xH(a,n)}return i+a},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return xH(this.parseStringISO(e,t),n);var r=t-e,i="("+r+" byte)\n";r>(n/=2)&&(t=e+n);for(var a=e;a<t;++a)i+=this.hexByte(this.get(a));return r>n&&(i+="…"),i},e.prototype.parseOID=function(e,t,n){for(var r="",i=new MH,a=0,o=e;o<t;++o){var l=this.get(o);if(i.mulAdd(128,127&l),a+=7,!(128&l)){if(""===r)if((i=i.simplify())instanceof MH)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 xH(r,n);i=new MH,a=0}}return a>0&&(r+=".incomplete"),r},e}(),SH=function(){function e(e,t,n,r,i){if(!(r instanceof ZH))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 xH(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return xH(this.stream.parseStringISO(t,t+n),e);case 30:return xH(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 kH?t:new kH(t,0);var r=new kH(n),i=new ZH(n),a=e.decodeLength(n),o=n.pos,l=o-r.pos,s=null,c=function(){var t=[];if(null!==a){for(var r=o+a;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 "+o)}else try{for(;;){var i=e.decode(n);if(i.tag.isEOC())break;t[t.length]=i}a=o-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===a)throw new Error("We can't skip over an invalid tag with undefined length at offset "+o);n.pos=o+Math.abs(a)}return new e(r,l,a,i,s)},e}(),ZH=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 MH;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}(),OH=[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],zH=(1<<26)/OH[OH.length-1],NH=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,a="",o=this.t,l=this.DB-o*this.DB%t;if(o-- >0)for(l<this.DB&&(n=this[o]>>l)>0&&(i=!0,a=cH(n));o>=0;)l<t?(n=(this[o]&(1<<l)-1)<<t-l,n|=this[--o]>>(l+=this.DB-t)):(n=this[o]>>(l-=t)&r,l<=0&&(l+=this.DB,--o)),n>0&&(i=!0),i&&(a+=cH(n));return i?a:"0"},e.prototype.negate=function(){var t=RH();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)+XH(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=RH();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 TH(t):new DH(t),this.exp(e,n)},e.prototype.clone=function(){var e=RH();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=RH();return this.bitwiseTo(e,dH,t),t},e.prototype.or=function(e){var t=RH();return this.bitwiseTo(e,uH,t),t},e.prototype.xor=function(e){var t=RH();return this.bitwiseTo(e,fH,t),t},e.prototype.andNot=function(e){var t=RH();return this.bitwiseTo(e,hH,t),t},e.prototype.not=function(){for(var e=RH(),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=RH();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=RH();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+CH(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+=pH(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,uH)},e.prototype.clearBit=function(e){return this.changeBit(e,hH)},e.prototype.flipBit=function(e){return this.changeBit(e,fH)},e.prototype.add=function(e){var t=RH();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=RH();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=RH();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=RH();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=RH();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=RH(),n=RH();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,r,i=e.bitLength(),a=WH(1);if(i<=0)return a;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new TH(t):t.isEven()?new FH(t):new DH(t);var o=[],l=3,s=n-1,c=(1<<n)-1;if(o[1]=r.convert(this),n>1){var d=RH();for(r.sqrTo(o[1],d);l<=c;)o[l]=RH(),r.mulTo(d,o[l-2],o[l]),l+=2}var u,f,h=e.t-1,C=!0,p=RH();for(i=XH(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),C)o[u].copyTo(a),C=!1;else{for(;l>1;)r.sqrTo(a,p),r.sqrTo(p,a),l-=2;l>0?r.sqrTo(a,p):(f=a,a=p,p=f),r.mulTo(p,o[u],a)}for(;h>=0&&!(e[h]&1<<i);)r.sqrTo(a,p),f=a,a=p,p=f,--i<0&&(i=this.DB-1,--h)}return r.revert(a)},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(),a=WH(1),o=WH(0),l=WH(0),s=WH(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),n?(a.isEven()&&o.isEven()||(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);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&&a.subTo(l,a),o.subTo(s,o)):(i.subTo(r,i),n&&l.subTo(a,l),s.subTo(o,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 IH)},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(),a=n.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>0&&(t.rShiftTo(a,t),n.rShiftTo(a,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 a>0&&n.lShiftTo(a,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=OH[OH.length-1]){for(t=0;t<OH.length;++t)if(n[0]==OH[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<OH.length;){for(var r=OH[t],i=t+1;i<OH.length&&r<zH;)r*=OH[i++];for(r=n.modInt(r);t<i;)if(r%OH[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,a=!1,o=0;--i>=0;){var l=8==r?255&+t[i]:UH(t,i);l<0?"-"==t.charAt(i)&&(a=!0):(a=!1,0==o?this[this.t++]=l:o+r>this.DB?(this[this.t-1]|=(l&(1<<this.DB-o)-1)<<o,this[this.t++]=l>>this.DB-o):this[this.t-1]|=l<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&128&+t[0]&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),a&&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,a=Math.floor(e/this.DB),o=this.s<<n&this.DM,l=this.t-1;l>=0;--l)t[l+a+1]=this[l]>>r|o,o=(this[l]&i)<<n;for(l=a-1;l>=0;--l)t[l]=0;t[a]=o,t.t=this.t+a+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,a=(1<<r)-1;t[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&a)<<i,t[o-n]=this[o]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<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(),a=r.t;for(n.t=a+i.t;--a>=0;)n[a]=0;for(a=0;a<i.t;++a)n[a+r.t]=r.am(0,i[a],n,a,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 a=this.abs();if(a.t<i.t)return null!=n&&n.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=RH());var o=RH(),l=this.s,s=t.s,c=this.DB-XH(i[i.t-1]);c>0?(i.lShiftTo(c,o),a.lShiftTo(c,r)):(i.copyTo(o),a.copyTo(r));var d=o.t,u=o[d-1];if(0!=u){var f=u*(1<<this.F1)+(d>1?o[d-2]>>this.F2:0),h=this.FV/f,C=(1<<this.F1)/f,p=1<<this.F2,m=r.t,A=m-d,g=null==n?RH():n;for(o.dlShiftTo(A,g),r.compareTo(g)>=0&&(r[r.t++]=1,r.subTo(g,r)),e.ONE.dlShiftTo(d,g),g.subTo(o,o);o.t<d;)o[o.t++]=0;for(;--A>=0;){var v=r[--m]==u?this.DM:Math.floor(r[m]*h+(r[m-1]+p)*C);if((r[m]+=o.am(0,v,r,A,0,d))<v)for(o.dlShiftTo(A,g),r.subTo(g,r);r[m]<--v;)r.subTo(g,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=RH(),i=RH(),a=n.convert(this),o=XH(t)-1;for(a.copyTo(r);--o>=0;)if(n.sqrTo(r,i),(t&1<<o)>0)n.mulTo(i,a,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=WH(n),i=RH(),a=RH(),o="";for(this.divRemTo(r,i,a);i.signum()>0;)o=(n+a.intValue()).toString(e).substring(1)+o,i.divRemTo(r,i,a);return a.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),i=Math.pow(n,r),a=!1,o=0,l=0,s=0;s<t.length;++s){var c=UH(t,s);c<0?"-"==t.charAt(s)&&0==this.signum()&&(a=!0):(l=n*l+c,++o>=r&&(this.dMultiply(i),this.dAddOffset(l,0),o=0,l=0))}o>0&&(this.dMultiply(Math.pow(n,o)),this.dAddOffset(l,0)),a&&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),uH,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=[],a=7&t;i.length=1+(t>>3),n.nextBytes(i),a>0?i[0]&=(1<<a)-1:i[0]=0,this.fromString(i,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,i,a=Math.min(e.t,this.t);for(r=0;r<a;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=a;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=a;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)>OH.length&&(t=OH.length);for(var a=RH(),o=0;o<t;++o){a.fromInt(OH[Math.floor(Math.random()*OH.length)]);var l=a.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=RH();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 a=n.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)t(n);else{a<o&&(o=a),o>0&&(n.rShiftTo(o,n),r.rShiftTo(o,r));var l=function(){(a=n.getLowestSetBit())>0&&n.rShiftTo(a,n),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,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):(o>0&&r.lShiftTo(o,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),uH,this),this.isEven()&&this.dAddOffset(1,0);var a=this,o=function(){a.dAddOffset(2,0),a.bitLength()>t&&a.subTo(e.ONE.shiftLeft(t-1),a),a.isProbablePrime(n)?setTimeout(function(){i()},0):setTimeout(o,0)};setTimeout(o,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}(),IH=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}(),TH=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}(),DH=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=RH();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(NH.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=RH();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}(),FH=function(){function e(e){this.m=e,this.r2=RH(),this.q3=RH(),NH.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=RH();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 RH(){return new NH(null)}function PH(e,t){return new NH(e,t)}var BH="undefined"!=typeof navigator;BH&&"Microsoft Internet Explorer"==navigator.appName?(NH.prototype.am=function(e,t,n,r,i,a){for(var o=32767&t,l=t>>15;--a>=0;){var s=32767&this[e],c=this[e++]>>15,d=l*s+c*o;i=((s=o*s+((32767&d)<<15)+n[r]+(1073741823&i))>>>30)+(d>>>15)+l*c+(i>>>30),n[r++]=1073741823&s}return i},VH=30):BH&&"Netscape"!=navigator.appName?(NH.prototype.am=function(e,t,n,r,i,a){for(;--a>=0;){var o=t*this[e++]+n[r]+i;i=Math.floor(o/67108864),n[r++]=67108863&o}return i},VH=26):(NH.prototype.am=function(e,t,n,r,i,a){for(var o=16383&t,l=t>>14;--a>=0;){var s=16383&this[e],c=this[e++]>>14,d=l*s+c*o;i=((s=o*s+((16383&d)<<14)+n[r]+i)>>28)+(d>>14)+l*c,n[r++]=268435455&s}return i},VH=28),NH.prototype.DB=VH,NH.prototype.DM=(1<<VH)-1,NH.prototype.DV=1<<VH;NH.prototype.FV=Math.pow(2,52),NH.prototype.F1=52-VH,NH.prototype.F2=2*VH-52;var jH,_H,qH=[];for(jH="0".charCodeAt(0),_H=0;_H<=9;++_H)qH[jH++]=_H;for(jH="a".charCodeAt(0),_H=10;_H<36;++_H)qH[jH++]=_H;for(jH="A".charCodeAt(0),_H=10;_H<36;++_H)qH[jH++]=_H;function UH(e,t){var n=qH[e.charCodeAt(t)];return null==n?-1:n}function WH(e){var t=RH();return t.fromInt(e),t}function XH(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}NH.ZERO=WH(0),NH.ONE=WH(1);var QH=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 GH,KH,YH=null;if(null==YH){YH=[],KH=0;var JH=void 0;if("undefined"!=typeof window&&self.crypto&&self.crypto.getRandomValues){var $H=new Uint32Array(256);for(self.crypto.getRandomValues($H),JH=0;JH<$H.length;++JH)YH[KH++]=255&$H[JH]}var ex=0,tx=function(e){if((ex=ex||0)>=256||KH>=256)self.removeEventListener?self.removeEventListener("mousemove",tx,!1):self.detachEvent&&self.detachEvent("onmousemove",tx);else try{var t=e.x+e.y;YH[KH++]=255&t,ex+=1}catch(e){}};"undefined"!=typeof window&&(self.addEventListener?self.addEventListener("mousemove",tx,!1):self.attachEvent&&self.attachEvent("onmousemove",tx))}function nx(){if(null==GH){for(GH=new QH;KH<256;){var e=Math.floor(65536*Math.random());YH[KH++]=255&e}for(GH.init(YH),KH=0;KH<YH.length;++KH)YH[KH]=0;KH=0}return GH.next()}var rx=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=nx()},e}();function ix(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,a,o,l,s,c,d,u,f,h,C=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),p=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=C[0],r=C[1],i=C[2],a=C[3],o=C[4],l=C[5],s=C[6],c=C[7],u=0;u<64;u++)p[u]=u<16?e[u+d]:px(px(px(hx(p[u-2]),p[u-7]),fx(p[u-15])),p[u-16]),f=px(px(px(px(c,ux(o)),sx(o,l,s)),Cx[u]),p[u]),h=px(dx(n),cx(n,r,i)),c=s,s=l,l=o,o=px(a,f),a=i,i=r,r=n,n=px(f,h);C[0]=px(n,C[0]),C[1]=px(r,C[1]),C[2]=px(i,C[2]),C[3]=px(a,C[3]),C[4]=px(o,C[4]),C[5]=px(l,C[5]),C[6]=px(s,C[6]),C[7]=px(c,C[7])}return C}(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 ax(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 ox(e,t){return e>>>t|e<<32-t}function lx(e,t){return e>>>t}function sx(e,t,n){return e&t^~e&n}function cx(e,t,n){return e&t^e&n^t&n}function dx(e){return ox(e,2)^ox(e,13)^ox(e,22)}function ux(e){return ox(e,6)^ox(e,11)^ox(e,25)}function fx(e){return ox(e,7)^ox(e,18)^lx(e,3)}function hx(e){return ox(e,17)^ox(e,19)^lx(e,10)}var Cx=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 px(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function mx(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 a=new rx,o=[];t>2;){for(o[0]=0;0==o[0];)a.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new NH(n)}function Ax(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 gx(e,t){var n=ix;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 a=n("")+i+""+e,o=new Array(32);(new rx).nextBytes(o);var l=Ax(o,a.length,n),s=[];for(r=0;r<a.length;r+=1)s[r]=a.charCodeAt(r)^l.charCodeAt(r);var c=Ax(s,o.length,n),d=[0];for(r=0;r<o.length;r+=1)d[r+1]=o[r]^c.charCodeAt(r);return new NH(d.concat(s))}var vx=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=PH(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e,t){void 0===t&&(t=mx);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 a=i.toString(16),o=a.length,l=0;l<2*n-o;l++)a="0"+a;return a},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=PH(e,16),this.e=parseInt(t,16),this.d=PH(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,r,i,a,o,l){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=PH(e,16),this.e=parseInt(t,16),this.d=PH(n,16),this.p=PH(r,16),this.q=PH(i,16),this.dmp1=PH(a,16),this.dmq1=PH(o,16),this.coeff=PH(l,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new rx,r=e>>1;this.e=parseInt(t,16);for(var i=new NH(t,16);;){for(;this.p=new NH(e-r,1,n),0!=this.p.subtract(NH.ONE).gcd(i).compareTo(NH.ONE)||!this.p.isProbablePrime(10););for(;this.q=new NH(r,1,n),0!=this.q.subtract(NH.ONE).gcd(i).compareTo(NH.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var o=this.p.subtract(NH.ONE),l=this.q.subtract(NH.ONE),s=o.multiply(l);if(0==s.gcd(i).compareTo(NH.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(s),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(l),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=PH(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 a=255&n[r];a<128?i+=String.fromCharCode(a):a>191&&a<224?(i+=String.fromCharCode((31&a)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&a)<<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 rx,i=e>>1;this.e=parseInt(t,16);var a=new NH(t,16),o=this,l=function(){var t=function(){if(o.p.compareTo(o.q)<=0){var e=o.p;o.p=o.q,o.q=e}var t=o.p.subtract(NH.ONE),r=o.q.subtract(NH.ONE),i=t.multiply(r);0==i.gcd(a).compareTo(NH.ONE)?(o.n=o.p.multiply(o.q),o.d=a.modInverse(i),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout(function(){n()},0)):setTimeout(l,0)},s=function(){o.q=RH(),o.q.fromNumberAsync(i,1,r,function(){o.q.subtract(NH.ONE).gcda(a,function(e){0==e.compareTo(NH.ONE)&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(s,0)})})},c=function(){o.p=RH(),o.p.fromNumberAsync(e-i,1,r,function(){o.p.subtract(NH.ONE).gcda(a,function(e){0==e.compareTo(NH.ONE)&&o.p.isProbablePrime(10)?setTimeout(s,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(l,0)},e.prototype.sign=function(e,t,n){var r=(yx[n]||"")+t(e).toString(),i=this.n.bitLength()/4,a=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 PH("0001"+r+"00"+e,16)}(r,i);if(null==a)return null;var o=this.doPrivate(a);if(null==o)return null;for(var l=o.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=PH(t,16),i=this.doPublic(r);return null==i?null:function(e){for(var t in yx)if(yx.hasOwnProperty(t)){var n=yx[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 yx={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function wx(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