diff --git a/frontend/dist/assets/index-BX9JKcmw.js b/frontend/dist/assets/index-CUmmU91j.js similarity index 59% rename from frontend/dist/assets/index-BX9JKcmw.js rename to frontend/dist/assets/index-CUmmU91j.js index c1958ac0..c0a6ca86 100644 --- a/frontend/dist/assets/index-BX9JKcmw.js +++ b/frontend/dist/assets/index-CUmmU91j.js @@ -48,15 +48,15 @@ Please change the parent to i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Hu=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Uu=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Wu=function(e,t){return e===`v`?zu(t):Bu(t)},Gu=function(e,t){return e===`v`?Hu(t):Uu(t)},Ku=function(e,t){return e===`h`&&t===`rtl`?-1:1},qu=function(e,t,n,r,i){var a=Ku(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Gu(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Wu(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Ju=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Yu=function(e){return[e.deltaX,e.deltaY]},Xu=function(e){return e&&`current`in e?e.current:e},Zu=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Qu=function(e){return` .block-interactivity-${e} {pointer-events: none;} .allow-interactivity-${e} {pointer-events: all;} -`},$u=0,ed=[];function td(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState($u++)[0],a=_.useState(Cu)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ql([e.lockRef.current],(e.shards||[]).map(Xu),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ju(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Vu(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Vu(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return qu(h,t,e,h===`h`?s:c,!0)},[]),c=_.useCallback(function(e){var n=e;if(!(!ed.length||ed[ed.length-1]!==a)){var r=`deltaY`in n?Yu(n):Ju(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Zu(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Xu).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=_.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:nd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=_.useCallback(function(e){n.current=Ju(e),r.current=void 0},[]),d=_.useCallback(function(t){l(t.type,Yu(t),t.target,s(t,e.lockRef.current))},[]),f=_.useCallback(function(t){l(t.type,Ju(t),t.target,s(t,e.lockRef.current))},[]);_.useEffect(function(){return ed.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Iu),document.addEventListener(`touchmove`,c,Iu),document.addEventListener(`touchstart`,u,Iu),function(){ed=ed.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Iu),document.removeEventListener(`touchmove`,c,Iu),document.removeEventListener(`touchstart`,u,Iu)}},[]);var p=e.removeScrollBar,m=e.inert;return _.createElement(_.Fragment,null,m?_.createElement(a,{styles:Qu(i)}):null,p?_.createElement(Nu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var rd=fu(pu,td),id=_.forwardRef(function(e,t){return _.createElement(hu,Xl({},e,{ref:t,sideCar:rd}))});id.classNames=hu.classNames;var ad=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},od=new WeakMap,sd=new WeakMap,cd={},ld=0,ud=function(e){return e&&(e.host||ud(e.parentNode))},dd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ud(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},fd=function(e,t,n,r){var i=dd(t,Array.isArray(e)?e:[e]);cd[n]||(cd[n]=new WeakMap);var a=cd[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(od.get(e)||0)+1,l=(a.get(e)||0)+1;od.set(e,c),a.set(e,l),o.push(e),c===1&&i&&sd.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ld++,function(){o.forEach(function(e){var t=od.get(e)-1,i=a.get(e)-1;od.set(e,t),a.set(e,i),t||(sd.has(e)||e.removeAttribute(r),sd.delete(e)),i||e.removeAttribute(n)}),ld--,ld||(od=new WeakMap,od=new WeakMap,sd=new WeakMap,cd={})}},pd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||ad(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),fd(r,i,n,`aria-hidden`)):function(){return null}};function md(e){let t=hd(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(_d);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function hd(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=yd(n),i=vd(r,n.props);return n.type!==_.Fragment&&(i.ref=t?na(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gd=Symbol(`radix.slottable`);function _d(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===gd}function vd(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function yd(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bd=`Dialog`,[xd,Sd]=aa(bd),[Cd,wd]=xd(bd),Td=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,u]=qa({prop:r,defaultProp:i??!1,onChange:a,caller:bd});return(0,B.jsx)(Cd,{scope:t,triggerRef:s,contentRef:c,contentId:Al(),titleId:Al(),descriptionId:Al(),open:l,onOpenChange:u,onOpenToggle:_.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Td.displayName=bd;var Ed=`DialogTrigger`,Dd=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=wd(Ed,n),a=ra(t,i.triggerRef);return(0,B.jsx)(H.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":qd(i.open),...r,ref:a,onClick:V(e.onClick,i.onOpenToggle)})});Dd.displayName=Ed;var Od=`DialogPortal`,[kd,Ad]=xd(Od,{forceMount:void 0}),jd=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=wd(Od,t);return(0,B.jsx)(kd,{scope:t,forceMount:n,children:_.Children.map(r,e=>(0,B.jsx)(Ha,{present:n||a.open,children:(0,B.jsx)(Ba,{asChild:!0,container:i,children:e})}))})};jd.displayName=Od;var Md=`DialogOverlay`,Nd=_.forwardRef((e,t)=>{let n=Ad(Md,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=wd(Md,e.__scopeDialog);return a.modal?(0,B.jsx)(Ha,{present:r||a.open,children:(0,B.jsx)(Fd,{...i,ref:t})}):null});Nd.displayName=Md;var Pd=md(`DialogOverlay.RemoveScroll`),Fd=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=wd(Md,n);return(0,B.jsx)(id,{as:Pd,allowPinchZoom:!0,shards:[i.contentRef],children:(0,B.jsx)(H.div,{"data-state":qd(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Id=`DialogContent`,Ld=_.forwardRef((e,t)=>{let n=Ad(Id,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=wd(Id,e.__scopeDialog);return(0,B.jsx)(Ha,{present:r||a.open,children:a.modal?(0,B.jsx)(Rd,{...i,ref:t}):(0,B.jsx)(zd,{...i,ref:t})})});Ld.displayName=Id;var Rd=_.forwardRef((e,t)=>{let n=wd(Id,e.__scopeDialog),r=_.useRef(null),i=ra(t,n.contentRef,r);return _.useEffect(()=>{let e=r.current;if(e)return pd(e)},[]),(0,B.jsx)(Bd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:V(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault())})}),zd=_.forwardRef((e,t)=>{let n=wd(Id,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return(0,B.jsx)(Bd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Bd=_.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=wd(Id,n),c=_.useRef(null),l=ra(t,c);return Jl(),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Fl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(ka,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":qd(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Zd,{titleId:s.titleId}),(0,B.jsx)($d,{contentRef:c,descriptionId:s.descriptionId})]})]})}),Vd=`DialogTitle`,Hd=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=wd(Vd,n);return(0,B.jsx)(H.h2,{id:i.titleId,...r,ref:t})});Hd.displayName=Vd;var Ud=`DialogDescription`,Wd=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=wd(Ud,n);return(0,B.jsx)(H.p,{id:i.descriptionId,...r,ref:t})});Wd.displayName=Ud;var Gd=`DialogClose`,Kd=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=wd(Gd,n);return(0,B.jsx)(H.button,{type:`button`,...r,ref:t,onClick:V(e.onClick,()=>i.onOpenChange(!1))})});Kd.displayName=Gd;function qd(e){return e?`open`:`closed`}var Jd=`DialogTitleWarning`,[Yd,Xd]=ia(Jd,{contentName:Id,titleName:Vd,docsSlug:`dialog`}),Zd=({titleId:e})=>{let t=Xd(Jd),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. +`},$u=0,ed=[];function td(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState($u++)[0],a=_.useState(Cu)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ql([e.lockRef.current],(e.shards||[]).map(Xu),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ju(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Vu(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Vu(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return qu(h,t,e,h===`h`?s:c,!0)},[]),c=_.useCallback(function(e){var n=e;if(!(!ed.length||ed[ed.length-1]!==a)){var r=`deltaY`in n?Yu(n):Ju(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Zu(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Xu).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=_.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:nd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=_.useCallback(function(e){n.current=Ju(e),r.current=void 0},[]),d=_.useCallback(function(t){l(t.type,Yu(t),t.target,s(t,e.lockRef.current))},[]),f=_.useCallback(function(t){l(t.type,Ju(t),t.target,s(t,e.lockRef.current))},[]);_.useEffect(function(){return ed.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Iu),document.addEventListener(`touchmove`,c,Iu),document.addEventListener(`touchstart`,u,Iu),function(){ed=ed.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Iu),document.removeEventListener(`touchmove`,c,Iu),document.removeEventListener(`touchstart`,u,Iu)}},[]);var p=e.removeScrollBar,m=e.inert;return _.createElement(_.Fragment,null,m?_.createElement(a,{styles:Qu(i)}):null,p?_.createElement(Nu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var rd=fu(pu,td),id=_.forwardRef(function(e,t){return _.createElement(hu,Xl({},e,{ref:t,sideCar:rd}))});id.classNames=hu.classNames;var ad=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},od=new WeakMap,sd=new WeakMap,cd={},ld=0,ud=function(e){return e&&(e.host||ud(e.parentNode))},dd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ud(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},eee=function(e,t,n,r){var i=dd(t,Array.isArray(e)?e:[e]);cd[n]||(cd[n]=new WeakMap);var a=cd[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(od.get(e)||0)+1,l=(a.get(e)||0)+1;od.set(e,c),a.set(e,l),o.push(e),c===1&&i&&sd.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ld++,function(){o.forEach(function(e){var t=od.get(e)-1,i=a.get(e)-1;od.set(e,t),a.set(e,i),t||(sd.has(e)||e.removeAttribute(r),sd.delete(e)),i||e.removeAttribute(n)}),ld--,ld||(od=new WeakMap,od=new WeakMap,sd=new WeakMap,cd={})}},fd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||ad(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),eee(r,i,n,`aria-hidden`)):function(){return null}};function tee(e){let t=nee(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(iee);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function nee(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=oee(n),i=aee(r,n.props);return n.type!==_.Fragment&&(i.ref=t?na(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ree=Symbol(`radix.slottable`);function iee(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ree}function aee(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function oee(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pd=`Dialog`,[md,hd]=aa(pd),[gd,_d]=md(pd),vd=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,u]=qa({prop:r,defaultProp:i??!1,onChange:a,caller:pd});return(0,B.jsx)(gd,{scope:t,triggerRef:s,contentRef:c,contentId:Al(),titleId:Al(),descriptionId:Al(),open:l,onOpenChange:u,onOpenToggle:_.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};vd.displayName=pd;var yd=`DialogTrigger`,bd=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=_d(yd,n),a=ra(t,i.triggerRef);return(0,B.jsx)(H.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Rd(i.open),...r,ref:a,onClick:V(e.onClick,i.onOpenToggle)})});bd.displayName=yd;var xd=`DialogPortal`,[Sd,Cd]=md(xd,{forceMount:void 0}),wd=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=_d(xd,t);return(0,B.jsx)(Sd,{scope:t,forceMount:n,children:_.Children.map(r,e=>(0,B.jsx)(Ha,{present:n||a.open,children:(0,B.jsx)(Ba,{asChild:!0,container:i,children:e})}))})};wd.displayName=xd;var Td=`DialogOverlay`,Ed=_.forwardRef((e,t)=>{let n=Cd(Td,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=_d(Td,e.__scopeDialog);return a.modal?(0,B.jsx)(Ha,{present:r||a.open,children:(0,B.jsx)(cee,{...i,ref:t})}):null});Ed.displayName=Td;var see=tee(`DialogOverlay.RemoveScroll`),cee=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=_d(Td,n);return(0,B.jsx)(id,{as:see,allowPinchZoom:!0,shards:[i.contentRef],children:(0,B.jsx)(H.div,{"data-state":Rd(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Dd=`DialogContent`,Od=_.forwardRef((e,t)=>{let n=Cd(Dd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=_d(Dd,e.__scopeDialog);return(0,B.jsx)(Ha,{present:r||a.open,children:a.modal?(0,B.jsx)(kd,{...i,ref:t}):(0,B.jsx)(Ad,{...i,ref:t})})});Od.displayName=Dd;var kd=_.forwardRef((e,t)=>{let n=_d(Dd,e.__scopeDialog),r=_.useRef(null),i=ra(t,n.contentRef,r);return _.useEffect(()=>{let e=r.current;if(e)return fd(e)},[]),(0,B.jsx)(jd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:V(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault())})}),Ad=_.forwardRef((e,t)=>{let n=_d(Dd,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return(0,B.jsx)(jd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),jd=_.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=_d(Dd,n),c=_.useRef(null),l=ra(t,c);return Jl(),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Fl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(ka,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Rd(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Hd,{titleId:s.titleId}),(0,B.jsx)(Wd,{contentRef:c,descriptionId:s.descriptionId})]})]})}),Md=`DialogTitle`,Nd=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=_d(Md,n);return(0,B.jsx)(H.h2,{id:i.titleId,...r,ref:t})});Nd.displayName=Md;var Pd=`DialogDescription`,Fd=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=_d(Pd,n);return(0,B.jsx)(H.p,{id:i.descriptionId,...r,ref:t})});Fd.displayName=Pd;var Id=`DialogClose`,Ld=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=_d(Id,n);return(0,B.jsx)(H.button,{type:`button`,...r,ref:t,onClick:V(e.onClick,()=>i.onOpenChange(!1))})});Ld.displayName=Id;function Rd(e){return e?`open`:`closed`}var zd=`DialogTitleWarning`,[Bd,Vd]=ia(zd,{contentName:Dd,titleName:Md,docsSlug:`dialog`}),Hd=({titleId:e})=>{let t=Vd(zd),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Qd=`DialogDescriptionWarning`,$d=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Xd(Qd).contentName}}.`;return _.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},ef=Td,tf=Dd,nf=jd,rf=Nd,af=Ld,of=Hd,sf=Wd,cf=Kd,lf=ef,uf=nf,df=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(rf,{ref:n,className:K(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));df.displayName=rf.displayName;var ff=_.forwardRef(({className:e,children:t,hideClose:n,...r},i)=>(0,B.jsxs)(uf,{children:[(0,B.jsx)(df,{}),(0,B.jsxs)(af,{ref:i,className:K(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...r,children:[t,!n&&(0,B.jsxs)(cf,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,B.jsx)(nc,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));ff.displayName=af.displayName;var pf=({className:e,...t})=>(0,B.jsx)(`div`,{className:K(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});pf.displayName=`DialogHeader`;var mf=({className:e,...t})=>(0,B.jsx)(`div`,{className:K(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});mf.displayName=`DialogFooter`;var hf=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(of,{ref:n,className:K(`text-lg font-semibold leading-none tracking-tight`,e),...t}));hf.displayName=of.displayName;var gf=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(sf,{ref:n,className:K(`text-sm text-muted-foreground`,e),...t}));gf.displayName=sf.displayName;var _f=({open:e,onOpenChange:t})=>{let{auth:n,refetch:r}=Dl(),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(!1);return n.status===`unauthenticated`?(0,B.jsx)(lf,{open:e,onOpenChange:t,children:(0,B.jsxs)(ff,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,B.jsxs)(pf,{children:[(0,B.jsx)(hf,{className:`text-amber-200`,children:`Hugging Face CLI not configured`}),(0,B.jsx)(gf,{className:`text-gray-400`,children:`Uploads, training, and replay-from-Hub require a logged-in HF CLI. Run this in a terminal:`})]}),(0,B.jsxs)(`pre`,{className:`bg-gray-950 p-3 rounded border border-gray-700 text-xs sm:text-sm overflow-x-auto flex items-center justify-between gap-2`,children:[(0,B.jsx)(`code`,{className:`text-green-400`,children:n.loginCommand}),(0,B.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(n.loginCommand),a(!0),setTimeout(()=>a(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},className:`flex-shrink-0 text-gray-400 hover:text-gray-200 transition-colors`,"aria-label":`Copy command`,children:i?(0,B.jsx)(ls,{className:`w-4 h-4 text-green-400`}):(0,B.jsx)(Cs,{className:`w-4 h-4`})})]}),(0,B.jsxs)(q,{variant:`outline`,size:`sm`,onClick:async()=>{s(!0);try{await r()}finally{s(!1)}},disabled:o,className:`border-amber-700 bg-transparent text-amber-100 hover:bg-amber-900/40 hover:text-amber-50`,children:[(0,B.jsx)(zs,{className:`w-4 h-4 mr-2 ${o?`animate-spin`:``}`}),`I've logged in — recheck`]})]})}):null},vf=()=>{let{auth:e}=Dl(),[t,n]=(0,_.useState)(!1);return e.status===`loading`?(0,B.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-400`,children:[(0,B.jsx)(Ns,{className:`w-3 h-3 animate-spin`}),(0,B.jsx)(`span`,{children:`Checking HF…`})]}):e.status===`authenticated`?(0,B.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-200`,title:`Hugging Face authenticated`,children:[(0,B.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-emerald-400`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:e.username})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-2 rounded-full border border-amber-700/60 bg-amber-950/40 px-3 py-1 text-xs text-amber-100 hover:bg-amber-900/40 transition-colors`,"aria-label":`Hugging Face not configured — show login instructions`,children:[(0,B.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`HF not configured`})]}),(0,B.jsx)(_f,{open:t,onOpenChange:n})]})},yf=[{id:`welcome`,route:`/`,placement:`center`,title:`Welcome to LeLab`,body:`This quick tour walks you from a fresh setup to a robot that runs a policy you trained yourself: calibrate, record, train, run. It takes about two minutes, and you can leave anytime with Esc.`},{id:`pick-robot`,route:`/`,target:`robot-selector`,placement:`bottom`,title:`Pick or name your arm`,body:`Start here. Choose an existing robot, or type a new name to create one. Everything else in the tour hangs off the arm you select.`,isComplete:e=>e.hasSelectedRobot},{id:`calibrate`,route:`/calibration`,target:`calibration-start`,placement:`bottom`,title:`Calibrate the arms`,body:`Calibration teaches the app each joint's range of motion so movements map correctly. Run it once for the leader arm, then the follower. Press Start and follow the on-screen steps.`,optional:!0,isComplete:e=>e.robotIsClean},{id:`cameras`,route:`/calibration`,target:`calibration-cameras`,placement:`top`,title:`Add cameras (if your task needs sight)`,body:`If the robot has to see what it's doing, add one or more cameras here. They're saved with this robot and reused when you record. Skip this if your task doesn't need vision.`,optional:!0},{id:`teleop`,route:`/`,target:`robot-teleop`,placement:`top`,title:`Try teleoperation (optional)`,body:`Drive the follower arm by moving the leader. It's a good way to confirm calibration feels right before you record anything. This button unlocks once the arm is calibrated.`,optional:!0,gate:e=>e.robotIsClean},{id:`record`,route:`/`,target:`dataset-picker`,placement:`bottom`,title:`Record a dataset`,body:`A dataset is a set of episodes: one attempt at your task each. Episode time is how long each attempt runs; reset time is the pause to reposition objects between attempts. Aim for 10 to 50 clean episodes to start.`,gate:e=>e.robotIsClean,isComplete:e=>e.hasLocalDataset},{id:`train`,route:`/`,target:`training-entry`,placement:`bottom`,title:`Train a policy`,body:`Turn your recorded episodes into a policy the robot can run. ACT is fast and a great first choice; SmolVLA is a larger vision-language model. You can train on your own GPU, or rent one in the cloud with a Hugging Face login.`,gate:e=>e.hasLocalDataset,isComplete:e=>e.hasTrainedModel},{id:`watch-training`,route:`/`,target:`jobs-section`,placement:`top`,title:`Watch it train`,body:`Your training job shows up here with live progress. Once it has a usable checkpoint, a green play button appears on the model so you can run it.`},{id:`inference`,route:`/`,target:`jobs-section`,placement:`top`,title:`Run your policy`,body:`Press the play button on a finished model to let the robot attempt the task on its own, using what it learned from your episodes. This is the payoff of the whole loop.`,optional:!0},{id:`upload`,route:`/`,target:`training-entry`,placement:`bottom`,title:`Share on the Hub (optional)`,body:`Log in to Hugging Face to push your datasets and trained models to the Hub, so you can back them up, share them, or train in the cloud.`,optional:!0,show:e=>!e.isAuthenticated},{id:`done`,route:`/`,placement:`center`,title:`That's the whole loop`,body:`Calibrate, record, train, run. You can reopen this tour anytime from the ? button in the corner. Happy building.`}],bf=class extends Error{status;detail;constructor(e,t,n){super(e),this.name=`ApiError`,this.status=t,this.detail=n}};async function xf(e,t,n,{method:r=`GET`,body:i,signal:a,action:o}={}){let s={method:r,signal:a};i!==void 0&&(s.body=JSON.stringify(i));let c=await t(`${e}${n}`,s);if(!c.ok){let e=null;try{let t=await c.json();e=t?.detail??t?.message??null}catch{}throw new bf(`${o||`${r} ${n}`} failed: ${e??c.status}`,c.status,e)}if(c.status!==204)return c.json()}async function Sf(e,t,n){return xf(e,t,`/datasets`,{signal:n,action:`List datasets`})}async function eee(e,t,n){return xf(e,t,`/datasets?scope=local`,{signal:n,action:`List local datasets`})}async function Cf(e,t,n=10,r){return(await xf(e,t,`/jobs?limit=${n}`,{signal:r,action:`List jobs`})).jobs}async function tee(e,t,n,r){return xf(e,t,`/jobs/${n}`,{signal:r,action:`Get job`})}async function nee(e,t,n,r){return(await xf(e,t,`/jobs/${n}/logs`,{signal:r,action:`Get job logs`})).logs}async function ree(e,t,n,r){return(await xf(e,t,`/jobs/${n}/log-file`,{signal:r,action:`Get job log file`})).logs}async function iee(e,t,n,r){return(await xf(e,t,`/jobs/${n}/metrics-history`,{signal:r,action:`Get job metrics history`})).points}async function aee(e,t,n){let{target:r,...i}=n,a=r?{config:i,target:r}:i;try{return await xf(e,t,`/jobs/training`,{method:`POST`,body:a,action:`Start training`})}catch(e){throw e instanceof bf&&e.status===409?Error(`Another training is already running. Stop it first.`):e}}async function oee(e,t,n,r){return xf(e,t,`/jobs/import`,{method:`POST`,body:r?{source:n,name:r}:{source:n},action:`Import model`})}async function wf(e,t,n){return xf(e,t,`/jobs/${n}/stop`,{method:`POST`,action:`Stop job`})}async function Tf(e,t,n){await xf(e,t,`/jobs/${n}`,{method:`DELETE`,action:`Delete job`})}var see={authenticated:!1,username:null,flavors:[]};async function cee(e,t,n){try{return await xf(e,t,`/jobs/runners/hardware`,{signal:n,action:`List runner hardware`})}catch(e){if(e instanceof bf)return see;throw e}}var lee={authenticated:!1,jobs:[],models:[]};async function uee(e,t,n){try{return await xf(e,t,`/jobs/hub`,{signal:n,action:`List hub jobs`})}catch(e){if(e instanceof bf)return lee;throw e}}var dee=`lelab.selectedRobot`,fee=3e3,Ef={hasSelectedRobot:!1,robotIsClean:!1,hasLocalDataset:!1,hasTrainedModel:!1,isAuthenticated:!1};function pee(e){let{baseUrl:t,fetchWithHeaders:n}=wl(),{auth:r}=Dl(),[i,a]=(0,_.useState)(Ef),o=r.status===`authenticated`,s=(0,_.useCallback)(async()=>{let e=null;try{e=localStorage.getItem(dee)}catch{}let[r,i,s]=await Promise.all([n(`${t}/robots`).then(e=>e.ok?e.json():null).catch(()=>null),eee(t,n).catch(()=>[]),Cf(t,n,20).catch(()=>[])]),c=r?.robots??[],l=e?c.find(t=>t.name===e)??null:null;a({hasSelectedRobot:!!l,robotIsClean:!!l?.is_clean,hasLocalDataset:i.some(e=>e.source===`local`||e.source===`both`),hasTrainedModel:s.some(e=>e.checkpoint_count>0||e.state===`done`),isAuthenticated:o})},[t,n,o]),c=(0,_.useRef)(s);return c.current=s,(0,_.useEffect)(()=>{if(!e){a(Ef);return}let t=!1,n=!1,r=async()=>{if(!(t||n||document.visibilityState===`hidden`)){n=!0;try{await c.current()}finally{n=!1}}};r();let i=setInterval(r,fee),o=()=>{document.visibilityState===`visible`&&r()};return document.addEventListener(`visibilitychange`,o),()=>{t=!0,clearInterval(i),document.removeEventListener(`visibilitychange`,o)}},[e]),i}var Df=()=>typeof window<`u`&&window.location.hostname.endsWith(`.hf.space`),Of=8,kf=12,mee=340,Af=(e,t,n)=>Math.max(t,Math.min(n,e)),jf=({rect:e})=>{let{currentStep:t,stepIndex:n,totalSteps:r,currentComplete:i,currentGated:a,next:o,back:s,skipStep:c,stop:l}=Uf(),u=(0,_.useRef)(null),[d,f]=(0,_.useState)({w:mee,h:0});if((0,_.useLayoutEffect)(()=>{if(u.current){let e=u.current.getBoundingClientRect();f({w:e.width,h:e.height})}},[t?.id,e]),(0,_.useEffect)(()=>{u.current?.focus()},[]),!t)return null;let p=t.placement??`bottom`,m=!e||p===`center`,h=n>=r-1,g=n<=0,v;if(m)v={top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`};else{let t=window.innerWidth,n=window.innerHeight,r=0,i=0;switch(p){case`top`:r=e.top-d.h-kf,i=e.left+e.width/2-d.w/2;break;case`left`:i=e.left-d.w-kf,r=e.top+e.height/2-d.h/2;break;case`right`:i=e.right+kf,r=e.top+e.height/2-d.h/2;break;default:r=e.bottom+kf,i=e.left+e.width/2-d.w/2;break}p===`bottom`&&r+d.h>n-Of&&(r=e.top-d.h-kf),p===`top`&&rt-Of&&(i=e.left-d.w-kf),p===`left`&&il(!1),"aria-label":`Exit tour`,className:`absolute right-2 top-2 rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-white`,children:(0,B.jsx)(nc,{className:`h-4 w-4`})}),(0,B.jsxs)(`div`,{className:`p-4 pt-5`,children:[(0,B.jsxs)(`div`,{className:`mb-1 flex items-center gap-2`,children:[(0,B.jsxs)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-blue-400`,children:[`Step `,n+1,` of `,r]}),i&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-green-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-green-400`,children:[(0,B.jsx)(ls,{className:`h-3 w-3`}),`Done`]})]}),(0,B.jsx)(`h3`,{className:`pr-6 text-base font-semibold text-white`,children:t.title}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-gray-300`,children:t.body}),a&&!i&&(0,B.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-amber-400`,children:[(0,B.jsx)(Ps,{className:`h-3 w-3 shrink-0`}),`Finish the earlier step to unlock this, or continue with Next whenever you like.`]}),(0,B.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2`,children:[(0,B.jsx)(q,{variant:`ghost`,size:`sm`,onClick:s,disabled:g,className:`text-gray-400 hover:text-white disabled:opacity-40`,children:`Back`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t.optional&&!h&&(0,B.jsx)(q,{variant:`ghost`,size:`sm`,onClick:c,className:`text-gray-400 hover:text-white`,children:`Skip`}),(0,B.jsx)(q,{size:`sm`,onClick:o,className:K(`text-white`,i?`bg-green-600 hover:bg-green-700`:`bg-blue-600 hover:bg-blue-700`),children:h?`Finish`:i?`Continue`:`Next`})]})]})]})]})},Mf=8,Nf=3e3,Pf=()=>{let{isActive:e,currentStep:t,stop:n}=Uf(),r=ft(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=t?.id??null,l=t?.target??null;if((0,_.useLayoutEffect)(()=>{if(s(!1),a(null),!e||!c)return;if(!l){s(!0);return}let t=0,n=null,r=null,i=performance.now(),o=()=>{if(r){if(!r.isConnected){a(null);return}a(r.getBoundingClientRect())}},u=e=>{r=e,e.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`}),o(),s(!0),window.addEventListener(`scroll`,o,!0),window.addEventListener(`resize`,o),n=new ResizeObserver(o),n.observe(e)},d=()=>{let e=document.querySelector(`[data-tour="${l}"]`);if(e){u(e);return}if(performance.now()-i>Nf){a(null),s(!0);return}t=requestAnimationFrame(d)};return d(),()=>{t&&cancelAnimationFrame(t),window.removeEventListener(`scroll`,o,!0),window.removeEventListener(`resize`,o),n?.disconnect()}},[e,c,l,r.pathname]),(0,_.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n]),!e||!t||!o)return null;let u=!!i&&i.width>0&&i.height>0;return(0,v.createPortal)((0,B.jsxs)(`div`,{className:`pointer-events-none fixed inset-0 z-40`,children:[u?(0,B.jsx)(`div`,{className:`pointer-events-none absolute rounded-lg ring-2 ring-blue-400/80 transition-all duration-200`,style:{top:i.top-Mf,left:i.left-Mf,width:i.width+Mf*2,height:i.height+Mf*2,boxShadow:`0 0 0 9999px rgba(0,0,0,0.6)`}}):(0,B.jsx)(`div`,{className:`absolute inset-0 bg-black/60`}),(0,B.jsx)(jf,{rect:u?i:null},t.id)]}),document.body)},Ff=[`Calibrate`,`Record`,`Train`,`Run`],If=({open:e,onStart:t,onDismiss:n})=>(0,B.jsx)(lf,{open:e,onOpenChange:e=>e?void 0:n(),children:(0,B.jsxs)(ff,{className:`bg-gray-900 border-gray-700 text-gray-300 sm:max-w-lg`,children:[(0,B.jsxs)(pf,{className:`text-center sm:text-center`,children:[(0,B.jsxs)(hf,{className:`flex items-center justify-center gap-2 text-xl text-white`,children:[(0,B.jsx)(Ss,{className:`h-6 w-6 text-blue-400`}),`Welcome to LeLab`]}),(0,B.jsx)(gf,{children:`New to teaching a robot arm? A two-minute guided tour walks you through the whole loop, no jargon required.`})]}),(0,B.jsx)(`div`,{className:`py-2`,children:(0,B.jsx)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-gray-400`,children:Ff.map((e,t)=>(0,B.jsxs)(_.Fragment,{children:[(0,B.jsx)(`span`,{className:`rounded-md bg-gray-800 px-2.5 py-1 font-medium text-gray-200`,children:e}),t{try{let e=localStorage.getItem(Lf);return e===`dismissed`||e===`completed`?e:null}catch{return null}},Bf=e=>{try{localStorage.setItem(Lf,e)}catch{}},Vf=(0,_.createContext)(null),Hf=({children:e})=>{let t=ht(),n=ft(),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(()=>zf()!==null),[l,u]=(0,_.useState)(!1),d=pee(r),f=(0,_.useMemo)(()=>yf.filter(e=>e.id===a||!e.show||e.show(d)),[d,a]),p=a?f.findIndex(e=>e.id===a):-1,m=r&&p>=0?f[p]:null,h=m?.isComplete?m.isComplete(d):!1,g=m?.gate?!m.gate(d):!1,v=(0,_.useCallback)(e=>{i(!1),o(null),Bf(e?`completed`:`dismissed`),c(!0)},[]),y=(0,_.useCallback)(()=>{u(!1),o(yf[0]?.id??null),i(!0)},[]),b=(0,_.useCallback)(()=>{u(!1),Bf(`dismissed`),c(!0)},[]);(0,_.useEffect)(()=>{zf()===null&&!Df()&&u(!0)},[]);let x=(0,_.useCallback)(()=>{let e=f.findIndex(e=>e.id===a);if(!(e<0)){if(e>=f.length-1){v(!0);return}o(f[e+1].id)}},[f,a,v]),S=(0,_.useCallback)(()=>{let e=f.findIndex(e=>e.id===a);e>0&&o(f[e-1].id)},[f,a]),C=x,w=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!r||!m){w.current=null;return}if(w.current!==m.id&&(w.current=m.id,n.pathname!==m.route)){if(m.route===`/calibration`){let e=null;try{e=localStorage.getItem(`lelab.selectedRobot`)}catch{}t(`/calibration`,e?{state:{robot_name:e}}:void 0);return}t(m.route)}},[r,m,n.pathname,t]);let T=(0,_.useRef)({id:null,done:!1});(0,_.useEffect)(()=>{if(!(!r||!m)){if(T.current.id!==m.id){T.current={id:m.id,done:h};return}if(!T.current.done&&h){T.current.done=!0;let e=setTimeout(()=>x(),Rf);return()=>clearTimeout(e)}}},[r,m,h,x]);let E=(0,_.useMemo)(()=>({isActive:r,currentStep:m,stepIndex:p,totalSteps:f.length,currentComplete:h,currentGated:g,hasSeen:s,start:y,next:x,back:S,skipStep:C,stop:v}),[r,m,p,f.length,h,g,s,y,x,S,C,v]);return(0,B.jsxs)(Vf.Provider,{value:E,children:[e,(0,B.jsx)(If,{open:l,onStart:y,onDismiss:b}),(0,B.jsx)(Pf,{}),(0,B.jsx)(Wf,{variant:`floating`})]})},Uf=()=>{let e=(0,_.useContext)(Vf);if(!e)throw Error(`useOnboarding must be used within an OnboardingProvider`);return e},Wf=({variant:e=`inline`,className:t})=>{let{start:n,isActive:r}=Uf();return e===`floating`&&r?null:e===`floating`?(0,B.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Start the guided tour`,title:`Guided tour`,className:K(`fixed bottom-4 right-4 z-30 flex h-11 w-11 items-center justify-center`,`rounded-full border border-gray-700 bg-gray-900 text-gray-300 shadow-lg`,`transition-colors hover:bg-gray-800 hover:text-white`,t),children:(0,B.jsx)(vs,{className:`h-5 w-5`})}):(0,B.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":`Start the guided tour`,className:K(`flex items-center gap-1.5 rounded-md border border-gray-700 px-2.5 py-1.5`,`text-xs font-medium text-gray-300 transition-colors hover:bg-gray-800 hover:text-white`,t),children:[(0,B.jsx)(vs,{className:`h-4 w-4`}),`Tour`]})},Gf=()=>(0,B.jsx)(`header`,{className:`sticky top-0 z-30 w-full border-b border-gray-800 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70`,children:(0,B.jsxs)(`div`,{className:`mx-auto flex h-12 max-w-7xl items-center justify-between px-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab`,className:`h-7 w-7`}),(0,B.jsx)(`span`,{className:`text-base font-semibold tracking-tight text-white`,children:`LeLab`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Wf,{variant:`inline`}),(0,B.jsx)(vf,{})]})]})}),Kf=[{href:`https://github.com/huggingface/lerobot`,label:`GitHub`,Icon:js},{href:`https://huggingface.co/docs/lerobot`,label:`Documentation`,Icon:ss},{href:`https://discord.com/invite/s3KuuzsPFb`,label:`Discord`,Icon:({className:e})=>(0,B.jsx)(`svg`,{role:`img`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,className:e,children:(0,B.jsx)(`path`,{d:`M20.317 4.369A19.79 19.79 0 0 0 16.558 3.2a.07.07 0 0 0-.074.035c-.211.375-.444.864-.608 1.249a18.27 18.27 0 0 0-5.487 0 12.51 12.51 0 0 0-.617-1.249.077.077 0 0 0-.074-.035 19.736 19.736 0 0 0-3.76 1.169.07.07 0 0 0-.032.027C2.533 8.046 1.79 11.624 2.155 15.157a.082.082 0 0 0 .031.056 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.027c.462-.63.873-1.295 1.226-1.994a.076.076 0 0 0-.041-.105 13.13 13.13 0 0 1-1.873-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.291a.074.074 0 0 1 .077-.01c3.927 1.793 8.18 1.793 12.061 0a.074.074 0 0 1 .078.009c.12.099.246.198.373.292a.077.077 0 0 1-.006.128 12.32 12.32 0 0 1-1.873.891.077.077 0 0 0-.04.106c.36.698.772 1.363 1.225 1.993a.076.076 0 0 0 .084.028 19.84 19.84 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-4.087-.838-7.636-3.548-10.787a.061.061 0 0 0-.031-.028zM8.02 12.997c-1.182 0-2.156-1.085-2.156-2.419 0-1.333.955-2.419 2.156-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.955 2.418-2.156 2.418zm7.974 0c-1.182 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.946 2.418-2.156 2.418z`})})}],qf=()=>(0,B.jsx)(`footer`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-gray-800 bg-black/95`,children:(0,B.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col items-center justify-between gap-3 px-4 py-4 text-sm text-gray-400 sm:flex-row`,children:[(0,B.jsxs)(`span`,{children:[`Powered by`,` `,(0,B.jsx)(`a`,{href:`https://github.com/huggingface/lerobot`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-gray-200 hover:text-white`,children:`LeRobot`})]}),(0,B.jsx)(`nav`,{className:`flex items-center gap-4`,children:Kf.map(({href:e,label:t,Icon:n})=>(0,B.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 text-gray-400 hover:text-white`,children:[(0,B.jsx)(n,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{children:t})]},t))})]})}),Jf=[`top`,`right`,`bottom`,`left`],Yf=Math.min,Xf=Math.max,Zf=Math.round,Qf=Math.floor,$f=e=>({x:e,y:e}),ep={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function tp(e,t,n){return Xf(e,Yf(t,n))}function np(e,t){return typeof e==`function`?e(t):e}function rp(e){return e.split(`-`)[0]}function ip(e){return e.split(`-`)[1]}function ap(e){return e===`x`?`y`:`x`}function op(e){return e===`y`?`height`:`width`}function sp(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function cp(e){return ap(sp(e))}function lp(e,t,n){n===void 0&&(n=!1);let r=ip(e),i=cp(e),a=op(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=vp(o)),[o,vp(o)]}function up(e){let t=vp(e);return[dp(e),t,dp(t)]}function dp(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var fp=[`left`,`right`],pp=[`right`,`left`],mp=[`top`,`bottom`],hp=[`bottom`,`top`];function gp(e,t,n){switch(e){case`top`:case`bottom`:return n?t?pp:fp:t?fp:pp;case`left`:case`right`:return t?mp:hp;default:return[]}}function _p(e,t,n,r){let i=ip(e),a=gp(rp(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(dp)))),a}function vp(e){let t=rp(e);return ep[t]+e.slice(t.length)}function yp(e){return{top:0,right:0,bottom:0,left:0,...e}}function bp(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:yp(e)}function xp(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Sp(e,t,n){let{reference:r,floating:i}=e,a=sp(t),o=cp(t),s=op(o),c=rp(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ip(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Cp(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=np(t,e),p=bp(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=xp(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=xp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var wp=50,Tp=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Cp},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Sp(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=np(e,t)||{};if(l==null)return{};let d=bp(u),f={x:n,y:r},p=cp(i),m=op(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Yf(d[_],T),D=Yf(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=tp(O,A,k),M=!c.arrow&&ip(i)!=null&&A!==j&&a.reference[m]/2-(Ae<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==sp(t))||T.every(e=>sp(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=sp(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Op(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kp(e){return Jf.some(t=>e[t]>=0)}var Ap=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=np(e,t);switch(i){case`referenceHidden`:{let e=Op(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:kp(e)}}}case`escaped`:{let e=Op(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:kp(e)}}}default:return{}}}}},jp=new Set([`left`,`top`]);async function hee(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=rp(n),s=ip(n),c=sp(n)===`y`,l=jp.has(o)?-1:1,u=a&&c?-1:1,d=np(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var gee=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await hee(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Mp=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=np(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=sp(rp(i)),p=ap(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=tp(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=tp(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Np=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=np(e,t),u={x:n,y:r},d=sp(i),f=ap(d),p=u[f],m=u[d],h=np(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=jp.has(rp(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},Pp=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=np(e,t),u=await o.detectOverflow(t,l),d=rp(i),f=ip(i),p=sp(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Yf(h-u[g],v),x=Yf(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Xf(u.left,0),t=Xf(u.right,0),n=Xf(u.top,0),r=Xf(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Xf(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Xf(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Fp(){return typeof window<`u`}function Ip(e){return zp(e)?(e.nodeName||``).toLowerCase():`#document`}function Lp(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rp(e){return((zp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function zp(e){return Fp()?e instanceof Node||e instanceof Lp(e).Node:!1}function Bp(e){return Fp()?e instanceof Element||e instanceof Lp(e).Element:!1}function Vp(e){return Fp()?e instanceof HTMLElement||e instanceof Lp(e).HTMLElement:!1}function Hp(e){return!Fp()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Lp(e).ShadowRoot}function Up(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=em(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Wp(e){return/^(table|td|th)$/.test(Ip(e))}function Gp(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Kp=/transform|translate|scale|rotate|perspective|filter/,qp=/paint|layout|strict|content/,Jp=e=>!!e&&e!==`none`,Yp;function Xp(e){let t=Bp(e)?em(e):e;return Jp(t.transform)||Jp(t.translate)||Jp(t.scale)||Jp(t.rotate)||Jp(t.perspective)||!Qp()&&(Jp(t.backdropFilter)||Jp(t.filter))||Kp.test(t.willChange||``)||qp.test(t.contain||``)}function Zp(e){let t=nm(e);for(;Vp(t)&&!$p(t);){if(Xp(t))return t;if(Gp(t))return null;t=nm(t)}return null}function Qp(){return Yp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Yp}function $p(e){return/^(html|body|#document)$/.test(Ip(e))}function em(e){return Lp(e).getComputedStyle(e)}function tm(e){return Bp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nm(e){if(Ip(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Hp(e)&&e.host||Rp(e);return Hp(t)?t.host:t}function rm(e){let t=nm(e);return $p(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vp(t)&&Up(t)?t:rm(t)}function im(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=rm(e),i=r===e.ownerDocument?.body,a=Lp(r);if(i){let e=am(a);return t.concat(a,a.visualViewport||[],Up(r)?r:[],e&&n?im(e):[])}else return t.concat(r,im(r,[],n))}function am(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function om(e){let t=em(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Vp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Zf(n)!==a||Zf(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function sm(e){return Bp(e)?e:e.contextElement}function cm(e){let t=sm(e);if(!Vp(t))return $f(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=om(t),o=(a?Zf(n.width):n.width)/r,s=(a?Zf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var lm=$f(0);function um(e){let t=Lp(e);return!Qp()||!t.visualViewport?lm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Lp(e)?!1:t}function fm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=sm(e),o=$f(1);t&&(r?Bp(r)&&(o=cm(r)):o=cm(e));let s=dm(a,n,r)?um(a):$f(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Lp(a),t=r&&Bp(r)?Lp(r):r,n=e,i=am(n);for(;i&&r&&t!==n;){let e=cm(i),t=i.getBoundingClientRect(),r=em(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Lp(i),i=am(n)}}return xp({width:u,height:d,x:c,y:l})}function pm(e,t){let n=tm(e).scrollLeft;return t?t.left+n:fm(Rp(e)).left+n}function mm(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-pm(e,n),y:n.top+t.scrollTop}}function hm(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Rp(r),s=t?Gp(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=$f(1),u=$f(0),d=Vp(r);if((d||!d&&!a)&&((Ip(r)!==`body`||Up(o))&&(c=tm(r)),d)){let e=fm(r);l=cm(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?mm(o,c):$f(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function gm(e){return Array.from(e.getClientRects())}function _m(e){let t=Rp(e),n=tm(e),r=e.ownerDocument.body,i=Xf(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Xf(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+pm(e),s=-n.scrollTop;return em(r).direction===`rtl`&&(o+=Xf(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var vm=25;function ym(e,t){let n=Lp(e),r=Rp(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Qp();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=pm(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=vm&&(a-=o)}else l<=vm&&(a+=l);return{width:a,height:o,x:s,y:c}}function bm(e,t){let n=fm(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Vp(e)?cm(e):$f(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function xm(e,t,n){let r;if(t===`viewport`)r=ym(e,n);else if(t===`document`)r=_m(Rp(e));else if(Bp(t))r=bm(t,n);else{let n=um(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return xp(r)}function Sm(e,t){let n=nm(e);return n===t||!Bp(n)||$p(n)?!1:em(n).position===`fixed`||Sm(n,t)}function Cm(e,t){let n=t.get(e);if(n)return n;let r=im(e,[],!1).filter(e=>Bp(e)&&Ip(e)!==`body`),i=null,a=em(e).position===`fixed`,o=a?nm(e):e;for(;Bp(o)&&!$p(o);){let t=em(o),n=Xp(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Up(o)&&!n&&Sm(e,o))?r=r.filter(e=>e!==o):i=t,o=nm(o)}return t.set(e,r),r}function wm(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Gp(t)?[]:Cm(t,this._c):[].concat(n),r],o=xm(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{o(!1,1e-7)},1e3)}n===1&&!km(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function See(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=sm(e),u=i||a?[...l?im(l):[],...t?im(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?xee(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?fm(e):null;c&&g();function g(){let t=fm(e);h&&!km(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Cee=gee,wee=Mp,Tee=Dp,Eee=Pp,Dee=Ap,Am=Ep,Oee=Np,kee=(e,t,n)=>{let r=new Map,i={platform:bee,...n},a={...i.platform,_c:r};return Tp(e,t,{...i,platform:a})},jm=typeof document<`u`?_.useLayoutEffect:function(){};function Mm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Mm(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Mm(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Nm(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pm(e,t){let n=Nm(e);return Math.round(t*n)/n}function Fm(e){let t=_.useRef(e);return jm(()=>{t.current=e}),t}function Im(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);Mm(f,r)||p(r);let[m,h]=_.useState(null),[g,y]=_.useState(null),b=_.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=_.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||m,C=o||g,w=_.useRef(null),T=_.useRef(null),E=_.useRef(u),D=c!=null,O=Fm(c),k=Fm(i),A=Fm(l),j=_.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),kee(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Mm(E.current,t)&&(E.current=t,v.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);jm(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=_.useRef(!1);jm(()=>(M.current=!0,()=>{M.current=!1}),[]),jm(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=_.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=_.useMemo(()=>({reference:S,floating:C}),[S,C]),F=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Pm(P.floating,u.x),r=Pm(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Nm(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Lm=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Am({element:r.current,padding:i}).fn(n):r?Am({element:r,padding:i}).fn(n):{}}}},Rm=(e,t)=>{let n=Cee(e);return{name:n.name,fn:n.fn,options:[e,t]}},zm=(e,t)=>{let n=wee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bm=(e,t)=>({fn:Oee(e).fn,options:[e,t]}),Vm=(e,t)=>{let n=Tee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hm=(e,t)=>{let n=Eee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Um=(e,t)=>{let n=Dee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wm=(e,t)=>{let n=Lm(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gm=`Arrow`,Km=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,B.jsx)(H.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,B.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Km.displayName=Gm;var qm=Km;function Jm(e){let[t,n]=_.useState(void 0);return Ra(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Ym=`Popper`,[Xm,Zm]=aa(Ym),[Qm,$m]=Xm(Ym),eh=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return(0,B.jsx)(Qm,{scope:t,anchor:r,onAnchorChange:i,children:n})};eh.displayName=Ym;var th=`PopperAnchor`,nh=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=$m(th,n),o=_.useRef(null),s=ra(t,o),c=_.useRef(null);return _.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,B.jsx)(H.div,{...i,ref:s})});nh.displayName=th;var rh=`PopperContent`,[ih,ah]=Xm(rh),oh=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=$m(rh,n),[v,y]=_.useState(null),b=ra(t,e=>y(e)),[x,S]=_.useState(null),C=Jm(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(uh),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Im({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>See(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Rm({mainAxis:i+T,alignmentAxis:o}),c&&zm({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Bm():void 0,...A}),c&&Vm({...A}),Hm({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Wm({element:x,padding:s}),dh({arrowWidth:w,arrowHeight:T}),f&&Um({strategy:`referenceHidden`,...A})]}),[ee,te]=fh(N),ne=xa(m);Ra(()=>{P&&ne?.()},[P,ne]);let re=F.arrow?.x,ie=F.arrow?.y,ae=F.arrow?.centerOffset!==0,[oe,se]=_.useState();return Ra(()=>{v&&se(window.getComputedStyle(v).zIndex)},[v]),(0,B.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,B.jsx)(ih,{scope:n,placedSide:ee,onArrowChange:S,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,B.jsx)(H.div,{"data-side":ee,"data-align":te,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});oh.displayName=rh;var sh=`PopperArrow`,ch={top:`bottom`,right:`left`,bottom:`top`,left:`right`},lh=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=ah(sh,n),a=ch[i.placedSide];return(0,B.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,B.jsx)(qm,{...r,ref:t,style:{...r.style,display:`block`}})})});lh.displayName=sh;function uh(e){return e!==null}var dh=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=fh(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function fh(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var ph=eh,mh=nh,hh=oh,gh=lh,_h=Symbol(`radix.slottable`);function vh(e){let t=({children:e})=>(0,B.jsx)(B.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=_h,t}var[yh,Aee]=aa(`Tooltip`,[Zm]),bh=Zm(),xh=`TooltipProvider`,Sh=700,Ch=`tooltip.open`,[wh,Th]=yh(xh),Eh=e=>{let{__scopeTooltip:t,delayDuration:n=Sh,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=_.useRef(!0),s=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(wh,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:_.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Eh.displayName=xh;var Dh=`Tooltip`,[Oh,kh]=yh(Dh),Ah=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Th(Dh,e.__scopeTooltip),l=bh(t),[u,d]=_.useState(null),f=Al(),p=_.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=_.useRef(!1),[v,y]=qa({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ch))):c.onClose(),a?.(e)},caller:Dh}),b=_.useMemo(()=>v?g.current?`delayed-open`:`instant-open`:`closed`,[v]),x=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=_.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return _.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(ph,{...l,children:(0,B.jsx)(Oh,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:_.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};Ah.displayName=Dh;var jh=`TooltipTrigger`,Mh=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=kh(jh,n),a=Th(jh,n),o=bh(n),s=ra(t,_.useRef(null),i.onTriggerChange),c=_.useRef(!1),l=_.useRef(!1),u=_.useCallback(()=>c.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(mh,{asChild:!0,...o,children:(0,B.jsx)(H.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:V(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:V(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:V(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:V(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:V(e.onBlur,i.onClose),onClick:V(e.onClick,i.onClose)})})});Mh.displayName=jh;var Nh=`TooltipPortal`,[Ph,Fh]=yh(Nh,{forceMount:void 0}),Ih=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=kh(Nh,t);return(0,B.jsx)(Ph,{scope:t,forceMount:n,children:(0,B.jsx)(Ha,{present:n||a.open,children:(0,B.jsx)(Ba,{asChild:!0,container:i,children:r})})})};Ih.displayName=Nh;var Lh=`TooltipContent`,Rh=_.forwardRef((e,t)=>{let n=Fh(Lh,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=kh(Lh,e.__scopeTooltip);return(0,B.jsx)(Ha,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(Uh,{side:i,...a,ref:t}):(0,B.jsx)(zh,{side:i,...a,ref:t})})}),zh=_.forwardRef((e,t)=>{let n=kh(Lh,e.__scopeTooltip),r=Th(Lh,e.__scopeTooltip),i=_.useRef(null),a=ra(t,i),[o,s]=_.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=_.useCallback(()=>{s(null),d(!1)},[d]),p=_.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=qh(r,Kh(r,n.getBoundingClientRect())),a=Jh(t.getBoundingClientRect());s(Xh([...i,...a])),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),_.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Yh(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(Uh,{...e,ref:a})}),[Bh,Vh]=yh(Dh,{isInside:!1}),Hh=vh(`TooltipContent`),Uh=_.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=kh(Lh,n),l=bh(n),{onClose:u}=c;return _.useEffect(()=>(document.addEventListener(Ch,u),()=>document.removeEventListener(Ch,u)),[u]),_.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(ka,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(hh,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(Hh,{children:r}),(0,B.jsx)(Bh,{scope:n,isInside:!0,children:(0,B.jsx)($a,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Rh.displayName=Lh;var Wh=`TooltipArrow`,Gh=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=bh(n);return Vh(Wh,n).isInside?null:(0,B.jsx)(gh,{...i,...r,ref:t})});Gh.displayName=Wh;function Kh(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function qh(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Jh(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Yh(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Xh(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y)),Zh(t)}function Zh(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Qh=Ah,$h=Mh,eg=Rh,tg=Qh,ng=$h,rg=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,B.jsx)(eg,{ref:r,sideOffset:t,className:K(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));rg.displayName=eg.displayName;function ig(e){let t=ag(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(sg);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function ag(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=lg(n),i=cg(r,n.props);return n.type!==_.Fragment&&(i.ref=t?na(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var og=Symbol(`radix.slottable`);function sg(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===og}function cg(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function lg(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ug=`Popover`,[dg,jee]=aa(ug,[Zm]),fg=Zm(),[pg,mg]=dg(ug),hg=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=fg(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=qa({prop:r,defaultProp:i??!1,onChange:a,caller:ug});return(0,B.jsx)(ph,{...s,children:(0,B.jsx)(pg,{scope:t,contentId:Al(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};hg.displayName=ug;var gg=`PopoverAnchor`,_g=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=mg(gg,n),a=fg(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,B.jsx)(mh,{...a,...r,ref:t})});_g.displayName=gg;var vg=`PopoverTrigger`,yg=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=mg(vg,n),a=fg(n),o=ra(t,i.triggerRef),s=(0,B.jsx)(H.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Pg(i.open),...r,ref:o,onClick:V(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,B.jsx)(mh,{asChild:!0,...a,children:s})});yg.displayName=vg;var bg=`PopoverPortal`,[xg,Sg]=dg(bg,{forceMount:void 0}),Cg=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=mg(bg,t);return(0,B.jsx)(xg,{scope:t,forceMount:n,children:(0,B.jsx)(Ha,{present:n||a.open,children:(0,B.jsx)(Ba,{asChild:!0,container:i,children:r})})})};Cg.displayName=bg;var wg=`PopoverContent`,Tg=_.forwardRef((e,t)=>{let n=Sg(wg,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=mg(wg,e.__scopePopover);return(0,B.jsx)(Ha,{present:r||a.open,children:a.modal?(0,B.jsx)(Dg,{...i,ref:t}):(0,B.jsx)(Og,{...i,ref:t})})});Tg.displayName=wg;var Eg=ig(`PopoverContent.RemoveScroll`),Dg=_.forwardRef((e,t)=>{let n=mg(wg,e.__scopePopover),r=_.useRef(null),i=ra(t,r),a=_.useRef(!1);return _.useEffect(()=>{let e=r.current;if(e)return pd(e)},[]),(0,B.jsx)(id,{as:Eg,allowPinchZoom:!0,children:(0,B.jsx)(kg,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:V(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Og=_.forwardRef((e,t)=>{let n=mg(wg,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,B.jsx)(kg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),kg=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=mg(wg,n),p=fg(n);return Jl(),(0,B.jsx)(Fl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(ka,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,B.jsx)(hh,{"data-state":Pg(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Ag=`PopoverClose`,jg=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=mg(Ag,n);return(0,B.jsx)(H.button,{type:`button`,...r,ref:t,onClick:V(e.onClick,()=>i.onOpenChange(!1))})});jg.displayName=Ag;var Mg=`PopoverArrow`,Ng=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=fg(n);return(0,B.jsx)(gh,{...i,...r,ref:t})});Ng.displayName=Mg;function Pg(e){return e?`open`:`closed`}var Fg=hg,Ig=yg,Lg=Cg,Rg=Tg,zg=Fg,Bg=Ig,Vg=_.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,B.jsx)(Lg,{children:(0,B.jsx)(Rg,{ref:i,align:t,sideOffset:n,className:K(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));Vg.displayName=Rg.displayName;var Hg=1,Ug=.9,Wg=.8,Gg=.17,Kg=.1,qg=.999,Jg=.9999,Yg=.99,Xg=/[\\\/_+.#"@\[\(\{&]/,Zg=/[\\\/_+.#"@\[\(\{&]/g,Qg=/[\s-]/,$g=/[\s-]/g;function e_(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Hg:Yg;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=e_(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Hg:Xg.test(e.charAt(l-1))?(d*=Wg,p=e.slice(i,l-1).match(Zg),p&&i>0&&(d*=qg**+p.length)):Qg.test(e.charAt(l-1))?(d*=Ug,m=e.slice(i,l-1).match($g),m&&i>0&&(d*=qg**+m.length)):(d*=Gg,i>0&&(d*=qg**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Jg)),(dd&&(d=f*Kg)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function t_(e){return e.toLowerCase().replace($g,` `)}function n_(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,e_(e,t,t_(e),t_(t),0,0,{})}var r_=`[cmdk-group=""]`,i_=`[cmdk-group-items=""]`,a_=`[cmdk-group-heading=""]`,o_=`[cmdk-item=""]`,s_=`${o_}:not([aria-disabled="true"])`,c_=`cmdk-item-select`,l_=`data-value`,u_=(e,t,n)=>n_(e,t,n),d_=_.createContext(void 0),f_=()=>_.useContext(d_),p_=_.createContext(void 0),m_=()=>_.useContext(p_),h_=_.createContext(void 0),g_=_.forwardRef((e,t)=>{let n=A_(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=A_(()=>new Set),i=A_(()=>new Map),a=A_(()=>new Map),o=A_(()=>new Set),s=O_(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,...v}=e,y=Al(),b=Al(),x=Al(),S=_.useRef(null),C=N_();k_(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),k_(()=>{C(6,A)},[]);let w=_.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=_.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??u_;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(i_);t?t.appendChild(e.parentElement===t?e:e.closest(`${i_} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${i_} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${r_}[${l_}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(l_);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(r_)?.querySelector(a_))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${o_}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(s_)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(l_))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(l_))}function F(e){let t=j()?.closest(r_),n;for(;t&&!n;)t=e>0?E_(t,r_):D_(t,r_),n=t?.querySelector(s_);n?w.setState(`value`,n.getAttribute(l_)):P(e)}let ee=()=>N(M().length-1),te=e=>{e.preventDefault(),e.metaKey?ee():e.altKey?F(1):P(1)},ne=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return _.createElement(H.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&te(e);break;case`ArrowDown`:te(e);break;case`p`:case`k`:g&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),ee();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(c_);t.dispatchEvent(e)}}}}},_.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:I_},c),F_(e,e=>_.createElement(p_.Provider,{value:w},_.createElement(d_.Provider,{value:T},e))))}),__=_.forwardRef((e,t)=>{let n=Al(),r=_.useRef(null),i=_.useContext(h_),a=f_(),o=O_(e),s=o.current?.forceMount??i?.forceMount;k_(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=M_(n,r,[e.value,e.children,r],e.keywords),l=m_(),u=j_(e=>e.value&&e.value===c.current),d=j_(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);_.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(c_,f),()=>t.removeEventListener(c_,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:v,keywords:y,...b}=e;return _.createElement(H.div,{ref:na(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),v_=_.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Al(),s=_.useRef(null),c=_.useRef(null),l=Al(),u=f_(),d=j_(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);k_(()=>u.group(o),[]),M_(o,s,[e.value,e.heading,c]);let f=_.useMemo(()=>({id:o,forceMount:i}),[i]);return _.createElement(H.div,{ref:na(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&_.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),F_(e,e=>_.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},_.createElement(h_.Provider,{value:f},e))))}),y_=_.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=_.useRef(null),a=j_(e=>!e.search);return!n&&!a?null:_.createElement(H.div,{ref:na(i,t),...r,"cmdk-separator":``,role:`separator`})}),b_=_.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=m_(),o=j_(e=>e.search),s=j_(e=>e.selectedItemId),c=f_();return _.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),_.createElement(H.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),x_=_.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=_.useRef(null),o=_.useRef(null),s=j_(e=>e.selectedItemId),c=f_();return _.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),_.createElement(H.div,{ref:na(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},F_(e,e=>_.createElement(`div`,{ref:na(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),S_=_.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return _.createElement(ef,{open:n,onOpenChange:r},_.createElement(nf,{container:o},_.createElement(rf,{"cmdk-overlay":``,className:i}),_.createElement(af,{"aria-label":e.label,"cmdk-dialog":``,className:a},_.createElement(g_,{ref:t,...s}))))}),C_=_.forwardRef((e,t)=>j_(e=>e.filtered.count===0)?_.createElement(H.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),w_=_.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return _.createElement(H.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},F_(e,e=>_.createElement(`div`,{"aria-hidden":!0},e)))}),T_=Object.assign(g_,{List:x_,Item:__,Input:b_,Group:v_,Separator:y_,Dialog:S_,Empty:C_,Loading:w_});function E_(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function D_(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function O_(e){let t=_.useRef(e);return k_(()=>{t.current=e}),t}var k_=typeof window>`u`?_.useEffect:_.useLayoutEffect;function A_(e){let t=_.useRef();return t.current===void 0&&(t.current=e()),t}function j_(e){let t=m_(),n=()=>e(t.snapshot());return _.useSyncExternalStore(t.subscribe,n,n)}function M_(e,t,n,r=[]){let i=_.useRef(),a=f_();return k_(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(l_,s),i.current=s}),i}var N_=()=>{let[e,t]=_.useState(),n=A_(()=>new Map);return k_(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function P_(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function F_({asChild:e,children:t},n){return e&&_.isValidElement(t)?_.cloneElement(P_(t),{ref:t.ref},n(t.props.children)):n(t)}var I_={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},L_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(T_,{ref:n,className:K(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));L_.displayName=T_.displayName;var R_=_.forwardRef(({className:e,...t},n)=>(0,B.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,B.jsx)(Hs,{className:`mr-2 h-4 w-4 shrink-0 text-slate-400`}),(0,B.jsx)(T_.Input,{ref:n,className:K(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));R_.displayName=T_.Input.displayName;var z_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(T_.List,{ref:n,className:K(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));z_.displayName=T_.List.displayName;var B_=_.forwardRef((e,t)=>(0,B.jsx)(T_.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));B_.displayName=T_.Empty.displayName;var V_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(T_.Group,{ref:n,className:K(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));V_.displayName=T_.Group.displayName;var H_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(T_.Separator,{ref:n,className:K(`-mx-1 h-px bg-border`,e),...t}));H_.displayName=T_.Separator.displayName;var U_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(T_.Item,{ref:n,className:K(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50`,e),...t}));U_.displayName=T_.Item.displayName;var W_=({className:e,...t})=>(0,B.jsx)(`span`,{className:K(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});W_.displayName=`CommandShortcut`;var G_=({selectedName:e,availableNames:t,onSelect:n,onCreateNew:r,isLoading:i})=>{let[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``),l=s.trim(),u=t.some(e=>e.toLowerCase()===l.toLowerCase()),d=l.length>0&&!u,f=!d,p=u?`Already exists`:l===``?`Create new robot…`:`Create "${l}"`,m=()=>{c(``),o(!1)},h=e=>{n(e),m()},g=async()=>{d&&await r(l)&&m()};return(0,B.jsxs)(zg,{open:a,onOpenChange:o,children:[(0,B.jsx)(Bg,{asChild:!0,children:(0,B.jsxs)(q,{variant:`outline`,role:`combobox`,"aria-expanded":a,disabled:i,className:`w-full justify-between bg-gray-900 border-gray-700 text-white hover:bg-gray-700 hover:text-white font-normal`,children:[(0,B.jsx)(`span`,{className:K(`truncate`,e?``:`text-gray-400`),children:i?`Loading...`:e??`Select a robot or type a new name`}),(0,B.jsx)(ms,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,B.jsx)(Vg,{className:`p-0 bg-gray-800 border-gray-700 text-white`,style:{width:`var(--radix-popover-trigger-width)`},align:`start`,children:(0,B.jsxs)(L_,{className:`bg-gray-800`,children:[(0,B.jsx)(R_,{placeholder:`Search or type new name...`,value:s,onValueChange:c,onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),g())},className:`text-white`}),(0,B.jsxs)(z_,{children:[t.length===0&&(0,B.jsx)(B_,{className:`py-4 text-sm text-gray-400 text-center`,children:`No robots yet. Type a name to create one.`}),t.length>0&&(0,B.jsx)(V_,{heading:`Existing`,children:t.map(t=>(0,B.jsxs)(U_,{value:t,onSelect:()=>h(t),className:`text-white aria-selected:bg-gray-700`,children:[(0,B.jsx)(ls,{className:K(`mr-2 h-4 w-4`,e===t?`opacity-100`:`opacity-0`)}),t]},t))})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:g,disabled:f,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,B.jsx)(Rs,{className:`h-4 w-4`}),p]})]})})]})},K_=({robot:e,selectedName:t,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:o,onTeleop:s,onDelete:c})=>{let[l,u]=(0,_.useState)(!1),d=e?e.is_clean?`Ready`:`Needs configuration`:null,f=!e||!e.is_clean;return(0,B.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2 relative`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`flex-1 min-w-0`,"data-tour":`robot-selector`,children:(0,B.jsx)(G_,{selectedName:t,availableNames:n,onSelect:i,onCreateNew:a,isLoading:r})}),d&&(0,B.jsx)(`p`,{className:`text-xs truncate shrink-0 ${e.is_clean?`text-green-400`:`text-amber-400`}`,children:d}),e&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,B.jsxs)(tg,{children:[(0,B.jsx)(ng,{asChild:!0,children:(0,B.jsx)(q,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-gray-300 hover:text-white`,onClick:()=>o(e.name),"aria-label":`Configure`,"data-tour":`robot-configure`,children:(0,B.jsx)(Us,{className:`w-4 h-4`})})}),(0,B.jsx)(rg,{children:`Configure (calibrate)`})]}),(0,B.jsxs)(tg,{children:[(0,B.jsx)(ng,{asChild:!0,children:(0,B.jsx)(q,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-900/20`,onClick:()=>u(!0),"aria-label":`Delete robot`,children:(0,B.jsx)(Xs,{className:`w-4 h-4`})})}),(0,B.jsx)(rg,{children:`Delete robot config`})]})]})]}),e&&(0,B.jsxs)(tg,{children:[(0,B.jsx)(ng,{asChild:!0,children:(0,B.jsx)(`div`,{className:`w-full`,"data-tour":`robot-teleop`,children:(0,B.jsx)(q,{onClick:()=>s(e),disabled:f,className:`w-full ${f?`bg-red-500/30 hover:bg-red-500/30 text-red-200 cursor-not-allowed`:`bg-yellow-500 hover:bg-yellow-600 text-white`}`,children:`Teleoperation`})})}),f&&(0,B.jsx)(rg,{children:`Configure the robot first.`})]}),e&&(0,B.jsx)(lf,{open:l,onOpenChange:u,children:(0,B.jsxs)(ff,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,B.jsxs)(pf,{children:[(0,B.jsx)(hf,{children:`Delete robot config?`}),(0,B.jsx)(gf,{className:`text-gray-400`,children:`This deletes the robot config file from disk. Calibration files are not removed. This cannot be undone.`})]}),(0,B.jsxs)(mf,{className:`flex gap-2 justify-end`,children:[(0,B.jsx)(q,{variant:`outline`,className:`border-gray-600 text-gray-300`,onClick:()=>u(!1),children:`Cancel`}),(0,B.jsx)(q,{className:`bg-red-500 hover:bg-red-600 text-white`,onClick:async()=>{u(!1),await c(e.name)},children:`Delete`})]})]})})]})},q_=({selectedName:e,selectedRecord:t,availableNames:n,isLoading:r,selectRobot:i,createRobot:a,deleteRobot:o})=>{let s=ht(),{baseUrl:c,fetchWithHeaders:l}=wl(),{toast:u}=ea();return(0,B.jsx)(K_,{robot:t,selectedName:e,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:e=>{s(`/calibration`,{state:{robot_name:e}})},onTeleop:async e=>{try{let t=await l(`${c}/move-arm`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config})}),n=await t.json();t.ok&&n.success?(u({title:`Teleoperation Started`,description:n.message||`Started teleoperation for ${e.name}.`}),s(`/teleoperation`)):u({title:`Error Starting Teleoperation`,description:n.message||`Failed to start.`,variant:`destructive`})}catch{u({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},onDelete:o})},J_=_.forwardRef(({className:e,type:t,...n},r)=>(0,B.jsx)(`input`,{type:t,className:K(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:r,...n}));J_.displayName=`Input`;var Y_=_.forwardRef(({value:e,onChange:t,integer:n=!0,className:r,...i},a)=>{let[o,s]=_.useState(e==null?``:String(e)),c=_.useRef(e);return _.useEffect(()=>{e!==c.current&&(c.current=e,s(e==null?``:String(e)))},[e]),(0,B.jsx)(J_,{ref:a,type:`number`,inputMode:n?`numeric`:`decimal`,value:o,onChange:e=>{let r=e.target.value;if(s(r),r===``){t(void 0);return}let i=n?parseInt(r,10):parseFloat(r);Number.isFinite(i)&&t(i)},className:K(`[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:m-0`,r),...i})});Y_.displayName=`NumberInput`;var X_=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ul(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Z_=`Label`,Q_=_.forwardRef((e,t)=>(0,B.jsx)(X_.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Q_.displayName=Z_;var $_=Q_,ev=es(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),J=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)($_,{ref:n,className:K(ev(),e),...t}));J.displayName=$_.displayName;function tv(e){let t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var nv=`Checkbox`,[rv,Mee]=aa(nv),[iv,av]=rv(nv);function ov(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=qa({prop:n,defaultProp:i??!1,onChange:c,caller:nv}),[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useRef(!1),b=m?!!o||!!m.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:hv(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:v};return(0,B.jsx)(iv,{scope:t,...x,children:mv(d)?d(x):r})}var sv=`CheckboxTrigger`,cv=_.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=av(sv,e),h=ra(i,u),g=_.useRef(c);return _.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,B.jsx)(H.button,{type:`button`,role:`checkbox`,"aria-checked":hv(c)?`mixed`:c,"aria-required":l,"data-state":gv(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:V(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:V(n,e=>{d(e=>hv(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});cv.displayName=sv;var lv=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,B.jsx)(ov,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(cv,{...d,ref:t,__scopeCheckbox:n}),e&&(0,B.jsx)(pv,{__scopeCheckbox:n})]})})});lv.displayName=nv;var uv=`CheckboxIndicator`,dv=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=av(uv,n);return(0,B.jsx)(Ha,{present:r||hv(a.checked)||a.checked===!0,children:(0,B.jsx)(H.span,{"data-state":gv(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});dv.displayName=uv;var fv=`CheckboxBubbleInput`,pv=_.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=av(fv,e),m=ra(n,p),h=tv(a),g=Jm(r);_.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=hv(a),n.call(e,hv(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let v=_.useRef(hv(a)?!1:a);return(0,B.jsx)(H.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});pv.displayName=fv;function mv(e){return typeof e==`function`}function hv(e){return e===`indeterminate`}function gv(e){return hv(e)?`indeterminate`:e?`checked`:`unchecked`}var _v=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(lv,{ref:n,className:K(`peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,B.jsx)(dv,{className:K(`flex items-center justify-center text-current`),children:(0,B.jsx)(ls,{className:`h-4 w-4`})})}));_v.displayName=lv.displayName;var vv=`Collapsible`,[yv,Nee]=aa(vv),[bv,xv]=yv(vv),Sv=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=qa({prop:r,defaultProp:i??!1,onChange:o,caller:vv});return(0,B.jsx)(bv,{scope:n,disabled:a,contentId:Al(),open:c,onOpenToggle:_.useCallback(()=>l(e=>!e),[l]),children:(0,B.jsx)(H.div,{"data-state":Ov(c),"data-disabled":a?``:void 0,...s,ref:t})})});Sv.displayName=vv;var Cv=`CollapsibleTrigger`,wv=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=xv(Cv,n);return(0,B.jsx)(H.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Ov(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:V(e.onClick,i.onOpenToggle)})});wv.displayName=Cv;var Tv=`CollapsibleContent`,Ev=_.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=xv(Tv,e.__scopeCollapsible);return(0,B.jsx)(Ha,{present:n||i.open,children:({present:e})=>(0,B.jsx)(Dv,{...r,ref:t,present:e})})});Ev.displayName=Tv;var Dv=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=xv(Tv,n),[s,c]=_.useState(r),l=_.useRef(null),u=ra(t,l),d=_.useRef(0),f=d.current,p=_.useRef(0),m=p.current,h=o.open||s,g=_.useRef(h),v=_.useRef(void 0);return _.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),Ra(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,B.jsx)(H.div,{"data-state":Ov(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function Ov(e){return e?`open`:`closed`}var kv=Sv,Av=wv,jv=Ev,Pee=es(`relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground`,{variants:{variant:{default:`bg-background text-foreground`,destructive:`border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive`}},defaultVariants:{variant:`default`}}),Mv=_.forwardRef(({className:e,variant:t,...n},r)=>(0,B.jsx)(`div`,{ref:r,role:`alert`,className:K(Pee({variant:t}),e),...n}));Mv.displayName=`Alert`;var Fee=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`h5`,{ref:n,className:K(`mb-1 font-medium leading-none tracking-tight`,e),...t}));Fee.displayName=`AlertTitle`;var Nv=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:K(`text-sm [&_p]:leading-relaxed`,e),...t}));Nv.displayName=`AlertDescription`;function Pv(e,[t,n]){return Math.min(n,Math.max(t,e))}var Iee=_.createContext(void 0);function Fv(e){let t=_.useContext(Iee);return e||t||`ltr`}function Lee(e){let t=Ree(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Bee);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ree(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Hee(n),i=Vee(r,n.props);return n.type!==_.Fragment&&(i.ref=t?na(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var zee=Symbol(`radix.slottable`);function Bee(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===zee}function Vee(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Hee(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Uee=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Wee=[` `,`Enter`],Iv=`Select`,[Lv,Rv,Gee]=pa(Iv),[zv,Kee]=aa(Iv,[Gee,Zm]),Bv=Zm(),[qee,Vv]=zv(Iv),[Jee,Yee]=zv(Iv),Hv=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Bv(t),[g,v]=_.useState(null),[y,b]=_.useState(null),[x,S]=_.useState(!1),C=Fv(l),[w,T]=qa({prop:r,defaultProp:i??!1,onChange:a,caller:Iv}),[E,D]=qa({prop:o,defaultProp:s,onChange:c,caller:Iv}),O=_.useRef(null),k=g?m||!!g.closest(`form`):!0,[A,j]=_.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,B.jsx)(ph,{...h,children:(0,B.jsxs)(qee,{required:p,scope:t,trigger:g,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Al(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,B.jsx)(Lv.Provider,{scope:t,children:(0,B.jsx)(Jee,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:_.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,B.jsxs)(wy,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,B.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};Hv.displayName=Iv;var Uv=`SelectTrigger`,Wv=_.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Bv(n),o=Vv(Uv,n),s=o.disabled||r,c=ra(t,o.onTriggerChange),l=Rv(n),u=_.useRef(`touch`),[d,f,p]=Ey(e=>{let t=l().filter(e=>!e.disabled),n=Dy(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,B.jsx)(mh,{asChild:!0,...a,children:(0,B.jsx)(H.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Ty(o.value)?``:void 0,...i,ref:c,onClick:V(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:V(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:V(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Uee.includes(e.key)&&(m(),e.preventDefault())})})})});Wv.displayName=Uv;var Gv=`SelectValue`,Kv=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Vv(Gv,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=ra(t,c.onValueNodeChange);return Ra(()=>{l(u)},[l,u]),(0,B.jsx)(H.span,{...s,ref:d,style:{pointerEvents:`none`},children:Ty(c.value)?(0,B.jsx)(B.Fragment,{children:o}):a})});Kv.displayName=Gv;var Xee=`SelectIcon`,qv=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(H.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});qv.displayName=Xee;var Zee=`SelectPortal`,Jv=e=>(0,B.jsx)(Ba,{asChild:!0,...e});Jv.displayName=Zee;var Yv=`SelectContent`,Xv=_.forwardRef((e,t)=>{let n=Vv(Yv,e.__scopeSelect),[r,i]=_.useState();if(Ra(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?v.createPortal((0,B.jsx)(Qv,{scope:e.__scopeSelect,children:(0,B.jsx)(Lv.Slot,{scope:e.__scopeSelect,children:(0,B.jsx)(`div`,{children:e.children})})}),t):null}return(0,B.jsx)(ey,{...e,ref:t})});Xv.displayName=Yv;var Zv=10,[Qv,$v]=zv(Yv),Qee=`SelectContentImpl`,$ee=Lee(`SelectContent.RemoveScroll`),ey=_.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...v}=e,y=Vv(Yv,n),[b,x]=_.useState(null),[S,C]=_.useState(null),w=ra(t,e=>x(e)),[T,E]=_.useState(null),[D,O]=_.useState(null),k=Rv(n),[A,j]=_.useState(!1),M=_.useRef(!1);_.useEffect(()=>{if(b)return pd(b)},[b]),Jl();let N=_.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=_.useCallback(()=>N([T,b]),[N,T,b]);_.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:ee}=y;_.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(ee.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ee.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),ee.current=null};return ee.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,ee]),_.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[te,ne]=Ey(e=>{let t=k().filter(e=>!e.disabled),n=Dy(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),re=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),ie=_.useCallback(()=>b?.focus(),[b]),ae=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),oe=r===`popper`?ny:ty,se=oe===ny?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,B.jsx)(Qv,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:re,selectedItem:T,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:te,children:(0,B.jsx)(id,{as:$ee,allowPinchZoom:!0,children:(0,B.jsx)(Fl,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:V(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(ka,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,B.jsx)(oe,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...se,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:V(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});ey.displayName=Qee;var ete=`SelectItemAlignedPosition`,ty=_.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Vv(Yv,n),o=$v(Yv,n),[s,c]=_.useState(null),[l,u]=_.useState(null),d=ra(t,e=>u(e)),f=Rv(n),p=_.useRef(!1),m=_.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,b=_.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Zv,d=Pv(a,[Zv,Math.max(Zv,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Zv,d=Pv(a,[Zv,Math.max(Zv,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Zv*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),_=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+_+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Zv,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+_+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Zv}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,v,a.dir,r]);Ra(()=>b(),[b]);let[x,S]=_.useState();return Ra(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,B.jsx)(nte,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:_.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,B.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,B.jsx)(H.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});ty.displayName=ete;var tte=`SelectPopperPosition`,ny=_.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Zv,...a}=e,o=Bv(n);return(0,B.jsx)(hh,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});ny.displayName=tte;var[nte,ry]=zv(Yv,{}),iy=`SelectViewport`,ay=_.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=$v(iy,n),o=ry(iy,n),s=ra(t,a.onViewportChange),c=_.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,B.jsx)(Lv.Slot,{scope:n,children:(0,B.jsx)(H.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:V(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Zv*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});ay.displayName=iy;var oy=`SelectGroup`,[rte,ite]=zv(oy),ate=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Al();return(0,B.jsx)(rte,{scope:n,id:i,children:(0,B.jsx)(H.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});ate.displayName=oy;var sy=`SelectLabel`,cy=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=ite(sy,n);return(0,B.jsx)(H.div,{id:i.id,...r,ref:t})});cy.displayName=sy;var ly=`SelectItem`,[ote,uy]=zv(ly),dy=_.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Vv(ly,n),c=$v(ly,n),l=s.value===r,[u,d]=_.useState(a??``),[f,p]=_.useState(!1),m=ra(t,e=>c.itemRefCallback?.(e,r,i)),h=Al(),g=_.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,B.jsx)(ote,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:_.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(Lv.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,B.jsx)(H.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:V(o.onFocus,()=>p(!0)),onBlur:V(o.onBlur,()=>p(!1)),onClick:V(o.onClick,()=>{g.current!==`mouse`&&v()}),onPointerUp:V(o.onPointerUp,()=>{g.current===`mouse`&&v()}),onPointerDown:V(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:V(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:V(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:V(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Wee.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});dy.displayName=ly;var fy=`SelectItemText`,py=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Vv(fy,n),s=$v(fy,n),c=uy(fy,n),l=Yee(fy,n),[u,d]=_.useState(null),f=ra(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=_.useMemo(()=>(0,B.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Ra(()=>(h(m),()=>g(m)),[h,g,m]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(H.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?v.createPortal(a.children,o.valueNode):null]})});py.displayName=fy;var my=`SelectItemIndicator`,hy=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return uy(my,n).isSelected?(0,B.jsx)(H.span,{"aria-hidden":!0,...r,ref:t}):null});hy.displayName=my;var gy=`SelectScrollUpButton`,_y=_.forwardRef((e,t)=>{let n=$v(gy,e.__scopeSelect),r=ry(gy,e.__scopeSelect),[i,a]=_.useState(!1),o=ra(t,r.onScrollButtonChange);return Ra(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(by,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});_y.displayName=gy;var vy=`SelectScrollDownButton`,yy=_.forwardRef((e,t)=>{let n=$v(vy,e.__scopeSelect),r=ry(vy,e.__scopeSelect),[i,a]=_.useState(!1),o=ra(t,r.onScrollButtonChange);return Ra(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(by,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});yy.displayName=vy;var by=_.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=$v(`SelectScrollButton`,n),o=_.useRef(null),s=Rv(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),Ra(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,B.jsx)(H.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:V(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:V(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:V(i.onPointerLeave,()=>{c()})})}),xy=`SelectSeparator`,Sy=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(H.div,{"aria-hidden":!0,...r,ref:t})});Sy.displayName=xy;var Cy=`SelectArrow`,ste=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Bv(n),a=Vv(Cy,n),o=$v(Cy,n);return a.open&&o.position===`popper`?(0,B.jsx)(gh,{...i,...r,ref:t}):null});ste.displayName=Cy;var cte=`SelectBubbleInput`,wy=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=_.useRef(null),a=ra(r,i),o=tv(t);return _.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,B.jsx)(H.select,{...n,style:{...Xa,...n.style},ref:a,defaultValue:t})});wy.displayName=cte;function Ty(e){return e===``||e===void 0}function Ey(e){let t=xa(e),n=_.useRef(``),r=_.useRef(0),i=_.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=_.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Dy(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Oy(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Oy(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ky=Hv,Ay=Wv,jy=Kv,My=qv,Ny=Jv,Py=Xv,Fy=ay,Iy=cy,Ly=dy,Ry=py,zy=hy,By=_y,Vy=yy,Hy=Sy,Uy=ky,Wy=jy,Gy=_.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(Ay,{ref:r,className:K(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,B.jsx)(My,{asChild:!0,children:(0,B.jsx)(us,{className:`h-4 w-4 text-slate-400`})})]}));Gy.displayName=Ay.displayName;var Ky=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(By,{ref:n,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(ps,{className:`h-4 w-4`})}));Ky.displayName=By.displayName;var qy=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Vy,{ref:n,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(us,{className:`h-4 w-4`})}));qy.displayName=Vy.displayName;var Jy=_.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,B.jsx)(Ny,{children:(0,B.jsxs)(Py,{ref:i,className:K(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,B.jsx)(Ky,{}),(0,B.jsx)(Fy,{className:K(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,B.jsx)(qy,{})]})}));Jy.displayName=Py.displayName;var Yy=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Iy,{ref:n,className:K(`py-1.5 pl-8 pr-2 text-sm font-semibold`,e),...t}));Yy.displayName=Iy.displayName;var Xy=_.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(Ly,{ref:r,className:K(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(zy,{children:(0,B.jsx)(ls,{className:`h-4 w-4`})})}),(0,B.jsx)(Ry,{children:t})]}));Xy.displayName=Ly.displayName;var Zy=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Hy,{ref:n,className:K(`-mx-1 my-1 h-px bg-muted`,e),...t}));Zy.displayName=Hy.displayName;var Qy=e=>e.toLowerCase().replace(/\s+/g,` `).trim();function $y({enabled:e=!0}={}){let{baseUrl:t,fetchWithHeaders:n}=wl(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(!1),s=(0,_.useCallback)(async()=>{o(!0);try{try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(e=>e.stop())}catch{}let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`).map(e=>({deviceId:e.deviceId,label:e.label})),r=await n(`${t}/available-cameras`);if(!r.ok)return i([]),[];let a=(await r.json()).cameras??[],o=new Set,s=a.map(t=>{let n=t.name||`Camera ${t.index}`,r=Qy(n),i=e.filter(e=>!o.has(e.deviceId)&&e.label),a=i.find(e=>Qy(e.label)===r)||i.find(e=>Qy(e.label).startsWith(r))||i.find(e=>Qy(e.label).includes(r)||r.includes(Qy(e.label)));return a&&o.add(a.deviceId),{index:t.index,name:n,deviceId:a?.deviceId??``,available:t.available}});return i(s),s}catch{return i([]),[]}finally{o(!1)}},[t,n]);return(0,_.useEffect)(()=>{if(!e)return;s();let t=()=>s();return navigator.mediaDevices.addEventListener(`devicechange`,t),()=>navigator.mediaDevices.removeEventListener(`devicechange`,t)},[e,s]),{cameras:r,isLoading:a,refresh:s}}var eb=4,tb=300,nb=new Set([`NotReadableError`,`AbortError`]);function rb(e,t){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(0),s=(0,_.useRef)(!1);return s.current=r,(0,_.useEffect)(()=>{let e=()=>{s.current&&o(e=>e+1)};return navigator.mediaDevices.addEventListener(`devicechange`,e),()=>navigator.mediaDevices.removeEventListener(`devicechange`,e)},[]),(0,_.useEffect)(()=>{if(t||!e){e||i(!0);return}let r=!1,a=null,o=null;i(!1);let s=async t=>{try{if(a=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:e}}}),r){a.getTracks().forEach(e=>e.stop());return}n.current&&(n.current.srcObject=a,await n.current.play().catch(()=>{}))}catch(e){if(r)return;let n=e instanceof DOMException?e.name:``;ts(t+1),tb*2**t):i(!0)}};return s(0),()=>{r=!0,o&&clearTimeout(o),a&&a.getTracks().forEach(e=>e.stop())}},[e,t,a]),{videoRef:n,hasError:r}}var ib=`__auto__`,ab=`__default__`,ob=[`MJPG`,`YUYV`,`I420`,`NV12`,`H264`,`MP4V`],sb=[`ANY`,`V4L2`,`DSHOW`,`PVAPI`,`ANDROID`,`AVFOUNDATION`,`MSMF`],cb=({cameras:e,onCamerasChange:t,releaseStreamsRef:n,readOnly:r=!1})=>{let{toast:i}=ea(),{cameras:a,isLoading:o,refresh:s}=$y(),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(``);(0,_.useEffect)(()=>{if(a.length===0||e.length===0)return;let n=!1,r=e.map(e=>{if(!e.device_id)return e;let t=a.find(t=>t.deviceId===e.device_id);return t&&t.index!==e.camera_index?(n=!0,{...e,camera_index:t.index}):e});n&&t(r)},[a]);let f=()=>{if(!c||!u.trim()){i({title:`Missing Information`,description:`Please select a camera and provide a name.`,variant:`destructive`});return}let n=parseInt(c),r=a.find(e=>e.index===n);if(!r){i({title:`Invalid Camera`,description:`Selected camera is not available.`,variant:`destructive`});return}if(e.some(e=>e.camera_index===r.index||r.deviceId&&e.device_id===r.deviceId)){i({title:`Camera Already Added`,description:`This camera is already in the configuration.`,variant:`destructive`});return}let o={id:`camera_${Date.now()}`,name:u.trim(),type:`opencv`,camera_index:r.index,device_id:r.deviceId,width:640,height:480,fps:30};t([...e,o]),l(``),d(``),i({title:`Camera Added`,description:`${o.name} has been added to the configuration.`})},p=n=>{t(e.filter(e=>e.id!==n)),i({title:`Camera Removed`,description:`Camera has been removed from the configuration.`})},m=(n,r)=>{t(e.map(e=>e.id===n?{...e,...r}:e))},[h,g]=(0,_.useState)(!1),v=(0,_.useCallback)(()=>{g(!0)},[]);return(0,_.useEffect)(()=>{n&&(n.current=v)},[n,v]),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:r?`Cameras`:`Camera Configuration`}),!r&&(0,B.jsxs)(`div`,{className:`bg-gray-800/50 rounded-lg p-4 space-y-4`,children:[(0,B.jsx)(`h4`,{className:`text-md font-medium text-gray-300`,children:`Add Camera`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(J,{className:`text-sm font-medium text-gray-300`,children:`Available Cameras`}),(0,B.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>s(),disabled:o,className:`h-6 w-6 text-gray-400 hover:text-white`,title:`Rescan for cameras (e.g. after plugging in a new USB camera)`,"aria-label":`Rescan for cameras`,children:(0,B.jsx)(zs,{className:`w-3.5 h-3.5 ${o?`animate-spin`:``}`})})]}),(0,B.jsxs)(Uy,{value:c,onValueChange:l,disabled:o,children:[(0,B.jsx)(Gy,{className:`bg-gray-800 border-gray-700 text-white`,children:(0,B.jsx)(Wy,{placeholder:o?`Loading cameras...`:`Select camera`})}),(0,B.jsx)(Jy,{className:`bg-gray-800 border-gray-700`,children:a.map(t=>{let n=e.some(e=>e.camera_index===t.index||t.deviceId&&e.device_id===t.deviceId);return(0,B.jsx)(Xy,{value:t.index.toString(),className:`text-white hover:bg-gray-700`,disabled:!t.available||n,children:(0,B.jsxs)(`div`,{className:`flex flex-col`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`Index `,t.index,n&&` · already added`]})]})},t.index)})})]})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{className:`text-sm font-medium text-gray-300`,children:`Camera Name`}),(0,B.jsx)(J_,{value:u,onChange:e=>d(e.target.value),placeholder:`e.g., workspace_cam`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,B.jsx)(`div`,{className:`space-y-2 flex flex-col justify-end`,children:(0,B.jsxs)(q,{onClick:f,className:`bg-blue-500 hover:bg-blue-600 text-white`,disabled:!c||!u.trim(),children:[(0,B.jsx)(Rs,{className:`w-4 h-4 mr-2`}),`Add Camera`]})})]})]}),e.length>0&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[!r&&(0,B.jsxs)(`h4`,{className:`text-md font-medium text-gray-300`,children:[`Configured Cameras (`,e.length,`)`]}),(0,B.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 gap-4`,children:e.map(e=>(0,B.jsx)(lb,{camera:e,paused:h,readOnly:r,onRemove:()=>p(e.id),onUpdate:t=>m(e.id,t)},e.id))})]}),e.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-8 text-gray-500`,children:[(0,B.jsx)(cs,{className:`w-12 h-12 mx-auto mb-4 text-gray-600`}),(0,B.jsx)(`p`,{children:r?`No cameras are configured for this robot.`:`No cameras configured. Add a camera to get started.`})]})]})},lb=({camera:e,paused:t,readOnly:n,onRemove:r,onUpdate:i})=>{let{videoRef:a,hasError:o}=rb(e.device_id,t);return(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`aspect-[4/3] bg-gray-800 relative`,children:!t&&e.device_id&&!o?(0,B.jsx)(`video`,{ref:a,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-full object-cover`}):(0,B.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center`,children:[(0,B.jsx)($s,{className:`w-8 h-8 text-gray-500 mb-2`}),(0,B.jsx)(`span`,{className:`text-gray-500 text-sm`,children:t?`Preview paused`:e.device_id?`Preview failed`:`No browser match`})]})}),(0,B.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h5`,{className:`font-medium text-white truncate`,children:e.name}),!n&&(0,B.jsx)(q,{onClick:r,size:`sm`,variant:`ghost`,className:`text-red-400 hover:text-red-300 hover:bg-red-900/20 p-1`,children:(0,B.jsx)(nc,{className:`w-4 h-4`})})]}),n?(0,B.jsxs)(`p`,{className:`text-xs text-gray-400`,children:[e.width,`×`,e.height,e.fps?` · ${e.fps} fps`:``]}):(0,B.jsxs)(kv,{children:[(0,B.jsxs)(Av,{className:`group flex items-center gap-1.5 text-xs font-medium text-gray-300 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Configuration`]}),(0,B.jsxs)(jv,{className:`pt-2 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 text-xs text-gray-400`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-16`,children:`Resolution:`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(Y_,{value:e.width,onChange:e=>{e!==void 0&&i({width:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`320`,max:`1920`}),(0,B.jsx)(`span`,{className:`flex items-center`,children:`×`}),(0,B.jsx)(Y_,{value:e.height,onChange:e=>{e!==void 0&&i({height:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`240`,max:`1080`})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-16`,children:`FPS:`}),(0,B.jsx)(Y_,{value:e.fps??30,onChange:e=>{e!==void 0&&i({fps:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`10`,max:`60`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-16`,children:`FOURCC:`}),(0,B.jsxs)(Uy,{value:e.fourcc??ib,onValueChange:e=>i({fourcc:e===ib?void 0:e}),children:[(0,B.jsx)(Gy,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,B.jsx)(Wy,{})}),(0,B.jsxs)(Jy,{className:`bg-gray-800 border-gray-700`,children:[(0,B.jsx)(Xy,{value:ib,className:`text-white hover:bg-gray-700 text-xs`,children:`Auto`}),ob.map(e=>(0,B.jsx)(Xy,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-16`,children:`Backend:`}),(0,B.jsxs)(Uy,{value:e.backend??ab,onValueChange:e=>i({backend:e===ab?void 0:e}),children:[(0,B.jsx)(Gy,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,B.jsx)(Wy,{})}),(0,B.jsxs)(Jy,{className:`bg-gray-800 border-gray-700`,children:[(0,B.jsx)(Xy,{value:ab,className:`text-white hover:bg-gray-700 text-xs`,children:`Default`}),sb.map(e=>(0,B.jsx)(Xy,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,B.jsx)(`p`,{className:`text-[10px] text-gray-500 leading-tight`,children:`Overriding the backend can reorder camera indices on macOS.`})]}),(0,B.jsxs)(`div`,{className:`text-xs text-gray-500`,children:[`Type: `,e.type,` | Device:`,` `,e.device_id?.substring(0,10),`...`]})]})]})]})]})},ub=({open:e,onOpenChange:t,robot:n,datasetName:r,setDatasetName:i,singleTask:a,setSingleTask:o,numEpisodes:s,setNumEpisodes:c,episodeTimeS:l,setEpisodeTimeS:u,resetTimeS:d,setResetTimeS:f,streamingEncoding:p,setStreamingEncoding:m,cameras:h,setCameras:g,onStart:_,releaseStreamsRef:v})=>{let{auth:y}=Dl(),b=!!n&&n.is_clean;return(0,B.jsx)(lf,{open:e,onOpenChange:t,children:(0,B.jsxs)(ff,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,B.jsxs)(pf,{children:[(0,B.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,B.jsx)(`div`,{className:`w-8 h-8 bg-red-500 rounded-full flex items-center justify-center`,children:(0,B.jsx)(`span`,{className:`text-white font-bold text-sm`,children:`REC`})})}),(0,B.jsx)(hf,{className:`text-white text-center text-2xl font-bold`,children:`Configure Recording`})]}),(0,B.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,B.jsx)(gf,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a configured robot and dataset parameters for recording.`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-6`,children:[(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,B.jsx)(gs,{className:`w-4 h-4 text-green-400`}),(0,B.jsxs)(`span`,{className:`text-slate-200`,children:[`Recording with `,(0,B.jsx)(`strong`,{children:n.name})]})]}):(0,B.jsxs)(Mv,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsxs)(Nv,{children:[(0,B.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before recording.`]})]}):(0,B.jsxs)(Mv,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsx)(Nv,{children:`Select and configure a robot on the Landing page before recording.`})]})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Dataset Configuration`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`datasetName`,className:`text-sm font-medium text-gray-300`,children:`Dataset Name *`}),(0,B.jsx)(J_,{id:`datasetName`,value:r,onChange:e=>i(e.target.value.replace(/[^A-Za-z0-9._-]/g,`_`)),placeholder:`my_dataset`,className:`bg-gray-800 border-gray-700 text-white`}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Letters, numbers, `,(0,B.jsx)(`code`,{children:`.`}),` `,(0,B.jsx)(`code`,{children:`_`}),` `,(0,B.jsx)(`code`,{children:`-`}),` only — other characters become`,` `,(0,B.jsx)(`code`,{children:`_`}),`.`]}),r&&(y.status===`authenticated`?(0,B.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Will be saved as`,` `,(0,B.jsxs)(`span`,{className:`text-gray-300 font-mono`,children:[y.username,`/`,r]})]}):y.status===`unauthenticated`?(0,B.jsx)(`p`,{className:`text-xs text-amber-400/80`,children:`Log in to Hugging Face to set the repository owner.`}):null)]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`singleTask`,className:`text-sm font-medium text-gray-300`,children:`Task Description *`}),(0,B.jsx)(J_,{id:`singleTask`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g., pick up the red block and place it on the blue square`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`numEpisodes`,className:`text-sm font-medium text-gray-300`,children:`Number of Episodes`}),(0,B.jsx)(Y_,{id:`numEpisodes`,min:`1`,max:`100`,value:s,onChange:e=>{e!==void 0&&c(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`episodeTimeS`,className:`text-sm font-medium text-gray-300`,children:`Episode duration (seconds)`}),(0,B.jsx)(Y_,{id:`episodeTimeS`,min:`1`,value:l,onChange:e=>{e!==void 0&&u(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`resetTimeS`,className:`text-sm font-medium text-gray-300`,children:`Reset duration (seconds)`}),(0,B.jsx)(Y_,{id:`resetTimeS`,min:`1`,value:d,onChange:e=>{e!==void 0&&f(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]})]})]}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(cb,{cameras:h,onCamerasChange:g,releaseStreamsRef:v,readOnly:!0}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`These are the cameras set up for this robot. To add or change a camera, configure it on the Calibration page.`})]}),(0,B.jsxs)(kv,{className:`space-y-4 group`,children:[(0,B.jsxs)(Av,{className:`flex items-center justify-between w-full text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:[(0,B.jsx)(`span`,{children:`Advanced Parameters`}),(0,B.jsx)(us,{className:`w-4 h-4 transition-transform group-data-[state=open]:rotate-180`})]}),(0,B.jsx)(jv,{className:`space-y-3`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(_v,{id:`streamingEncoding`,checked:p,onCheckedChange:e=>m(e===!0),className:`mt-0.5 border-gray-500 data-[state=checked]:bg-red-500 data-[state=checked]:border-red-500`}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(J,{htmlFor:`streamingEncoding`,className:`text-sm font-medium text-gray-200 cursor-pointer`,children:`Streaming video encoding`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Encodes frames in real time during capture so each episode saves almost instantly. Uncheck to fall back to the slower PNG-then-encode flow.`})]})]})})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,B.jsx)(q,{onClick:_,disabled:!b,className:`w-full sm:w-auto bg-red-500 hover:bg-red-600 text-white px-10 py-6 text-lg transition-all shadow-md shadow-red-500/30 hover:shadow-lg hover:shadow-red-500/40 disabled:opacity-40 disabled:cursor-not-allowed`,children:`Start Recording`}),(0,B.jsx)(q,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},db=/^[\w.\-]+\/[\w.\-]+$/,fb=/^[A-Za-z0-9._-]+$/,pb=({datasets:e,loading:t,onPickExisting:n,onCreateNew:r,onOpenCustom:i,children:a})=>{let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(``),u=c.trim(),d=e.some(e=>e.repo_id.toLowerCase()===u.toLowerCase()),f=db.test(u),p=fb.test(u)&&!u.includes(`/`),m=u.length>0&&p&&!d,h=f&&!d,g=d||u!==``&&!m,v=d?`Already exists`:u===``?`Create new dataset…`:m?`Create "${u}"`:`Use a name without "/"`,y=()=>{g||(r(u),S())},b=e.filter(e=>e.source===`local`||e.source===`both`),x=e.filter(e=>e.source===`hub`),S=()=>{l(``),s(!1)},C=e=>{n(e),S()},w=()=>{m&&(r(u),S())},T=()=>{h&&(i(u),S())},E=e=>(0,B.jsxs)(U_,{value:e.repo_id,onSelect:()=>C(e),className:`text-white aria-selected:bg-gray-700`,children:[(0,B.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,B.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,B.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return(0,B.jsxs)(zg,{open:o,onOpenChange:s,children:[(0,B.jsx)(Bg,{asChild:!0,children:a}),(0,B.jsx)(Vg,{className:`w-[320px] p-0 bg-gray-800 border-gray-700 text-white`,align:`end`,children:(0,B.jsxs)(L_,{className:`bg-gray-800`,children:[(0,B.jsx)(R_,{placeholder:`Search, type a new name, or org/name…`,value:c,onValueChange:e=>l(e.replace(/[^A-Za-z0-9._\-/]/g,`_`)),onKeyDown:e=>{e.key===`Enter`&&(m?(e.preventDefault(),w()):h&&(e.preventDefault(),T()))},className:`text-white`}),(0,B.jsxs)(z_,{children:[e.length===0&&!m&&!h&&(0,B.jsx)(B_,{className:`py-4 text-sm text-gray-400 text-center`,children:t?`Loading datasets…`:`No datasets yet. Type a name to create one.`}),b.length>0&&(0,B.jsx)(V_,{heading:`Local`,children:b.map(E)}),x.length>0&&(0,B.jsx)(V_,{heading:`Hugging Face`,children:x.map(E)}),h&&(0,B.jsx)(V_,{heading:`Custom repo`,children:(0,B.jsxs)(U_,{value:`__open__${u}`,onSelect:T,className:`text-white aria-selected:bg-gray-700`,children:[(0,B.jsx)(Ds,{className:`mr-2 h-4 w-4`}),`Open "`,u,`" in viewer`]})})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:y,disabled:g,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,B.jsx)(Rs,{className:`h-4 w-4`}),v]})]})})]})},mb=(e,t)=>{let{wsBaseUrl:n}=wl(),r=(0,_.useRef)(e);r.current=e;let i=(0,_.useRef)(t);i.current=t,(0,_.useEffect)(()=>{let e=!1,t=null,a=null,o=()=>{if(!e){try{t=new WebSocket(`${n}/ws/joint-data`)}catch{a=setTimeout(o,3e3);return}t.onmessage=e=>{try{let t=JSON.parse(e.data);t?.type===`jobs_changed`?r.current():t?.type===`job_progress`&&i.current&&Array.isArray(t?.jobs)&&i.current(t.jobs)}catch{}},t.onclose=()=>{e||(a=setTimeout(o,3e3))}}};return o(),()=>{e=!0,a&&clearTimeout(a),t&&t.close()}},[n])},hb=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:K(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));hb.displayName=`Card`;var gb=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:K(`flex flex-col space-y-1.5 p-6`,e),...t}));gb.displayName=`CardHeader`;var _b=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`h3`,{ref:n,className:K(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));_b.displayName=`CardTitle`;var vb=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`p`,{ref:n,className:K(`text-sm text-muted-foreground`,e),...t}));vb.displayName=`CardDescription`;var yb=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:K(`p-6 pt-0`,e),...t}));yb.displayName=`CardContent`;var lte=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:K(`flex items-center p-6 pt-0`,e),...t}));lte.displayName=`CardFooter`;async function bb(e,t,n,r){return(await xf(e,t,`/jobs/${n}/checkpoints`,{signal:r,action:`List checkpoints`})).checkpoints}async function ute(e,t,n,r,i){return xf(e,t,`/jobs/${n}/checkpoints/${r}/policy-config`,{signal:i,action:`Load policy config`})}var xb=({checkpoints:e,selectedStep:t,onChange:n,disabled:r,placeholder:i=`Select checkpoint`})=>{let a=e=>e===0?`latest`:`step ${e}`;return(0,B.jsxs)(Uy,{value:t==null?void 0:String(t),onValueChange:e=>n(Number(e)),disabled:r||e.length===0,children:[(0,B.jsx)(Gy,{className:`bg-slate-800 border-slate-700 text-white h-8 text-xs px-2 w-auto min-w-[110px]`,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(Wy,{placeholder:i})}),(0,B.jsx)(Jy,{className:`bg-slate-900 border-slate-700 text-white`,children:e.map(e=>(0,B.jsx)(Xy,{value:String(e.step),onClick:e=>e.stopPropagation(),children:a(e.step)},e.step))})]})};function Sb(e){let t=Math.max(0,Date.now()/1e3-e);return t<60?`${Math.floor(t)}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}var Cb={running:{label:`Running`,color:`text-green-400`,Icon:Ns},done:{label:`Done`,color:`text-slate-400`,Icon:_s},failed:{label:`Failed`,color:`text-red-400`,Icon:ys},interrupted:{label:`Interrupted`,color:`text-amber-400`,Icon:Zs}},wb=({job:e,onStop:t,onDelete:n,onPlay:r})=>{let i=ht(),{baseUrl:a,fetchWithHeaders:o}=wl(),s=Cb[e.state],c=s.Icon,l=e.state===`running`,u=e.runner===`imported`,d=e.hf_repo_id||e.output_dir,f=u?`Imported`:s.label,p=l&&e.metrics.total_steps===0,m=e.metrics.total_steps>0?Math.min(100,e.metrics.current_step/e.metrics.total_steps*100):0,h=u?d:p?`starting…`:l?`started ${Sb(e.started_at)}`:e.ended_at==null?s.label.toLowerCase():`ended ${Sb(e.ended_at)}`,[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(e.checkpoint_count<=0){v([]),b(null);return}let t=!1;return bb(a,o,e.id).then(e=>{if(!t)if(v(e),e.length>0){let t=e[e.length-1].step;b(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else b(null)}).catch(()=>{t||(v([]),b(null))}),()=>{t=!0}},[a,o,e.id,e.checkpoint_count]);let x=r=>{r.stopPropagation(),l?window.confirm(`Stop this run?`)&&t(e.id):u?window.confirm(`Remove this imported model? The source files are left untouched.`)&&n(e.id):window.confirm(`Delete this run? This wipes the output directory.`)&&n(e.id)},S=t=>{t.stopPropagation(),y!=null&&r(e,y)},C=l,w=g.length>0&&y!=null;return(0,B.jsx)(hb,{onClick:()=>{u||i(`/training/${e.id}`)},className:`bg-slate-800/50 border-slate-700 rounded-xl transition-colors ${u?``:`cursor-pointer hover:border-slate-500`}`,children:(0,B.jsxs)(yb,{className:`p-4 space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${s.color}`,children:[(0,B.jsx)(c,{className:`w-3.5 h-3.5 ${l?`animate-spin`:``}`}),f]}),e.runner===`hf_cloud`&&e.hf_job_url?(0,B.jsx)(q,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Open Hub job page`,children:(0,B.jsx)(`a`,{href:e.hf_job_url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(Ds,{className:`w-3.5 h-3.5`})})}):(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:x,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":l?`Stop job`:`Delete job`,children:l?(0,B.jsx)(Js,{className:`w-3.5 h-3.5`}):(0,B.jsx)(nc,{className:`w-3.5 h-3.5`})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-white font-semibold truncate`,title:e.name,children:e.name}),(0,B.jsx)(`div`,{className:`text-xs text-slate-400 truncate`,title:h,style:u?{direction:`rtl`,textAlign:`left`}:void 0,children:u?`‎`+h:h})]}),C?(0,B.jsxs)(`div`,{className:`relative h-5 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,B.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${m}%`}}),(0,B.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs font-semibold text-white tabular-nums drop-shadow`,children:p?`Training starting…`:`${m.toFixed(1)}%`})]}):null,w?(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(xb,{checkpoints:g,selectedStep:y,onChange:b}),(0,B.jsx)(q,{size:`icon`,onClick:S,className:`h-8 w-8 bg-green-500 hover:bg-green-600 text-white`,"aria-label":`Run inference with this checkpoint`,children:(0,B.jsx)(Ls,{className:`w-4 h-4`})})]}):null]})})};function Tb(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var Eb={RUNNING:{label:`Running`,color:`text-green-400`,Icon:Ns,spin:!0},QUEUED:{label:`Queued`,color:`text-amber-400`,Icon:xs},SCHEDULING:{label:`Scheduling`,color:`text-amber-400`,Icon:xs},COMPLETED:{label:`Done`,color:`text-slate-400`,Icon:_s},FAILED:{label:`Failed`,color:`text-red-400`,Icon:ys},CANCELED:{label:`Cancelled`,color:`text-amber-400`,Icon:Zs},CANCELLED:{label:`Cancelled`,color:`text-amber-400`,Icon:Zs}},Db=({job:e})=>{let t=e.status?.stage?.toUpperCase()??``,n=Eb[t]??{label:t||`Unknown`,color:`text-slate-400`,Icon:vs},r=n.Icon,i=e.docker_image??e.space_id??`Job ${e.id.slice(0,12)}…`;return(0,B.jsx)(hb,{onClick:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,B.jsxs)(yb,{className:`p-4 space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${n.color}`,children:[(0,B.jsx)(r,{className:`w-3.5 h-3.5 ${n.spin?`animate-spin`:``}`}),n.label]}),(0,B.jsx)(q,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,B.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(Ds,{className:`w-3.5 h-3.5`})})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-white font-semibold truncate`,title:i,children:i}),(0,B.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,children:[e.flavor??`—`,` · `,Tb(e.created_at),e.owner?` · ${e.owner}`:``]})]}),e.status?.message?(0,B.jsx)(`div`,{className:`text-xs text-slate-500 truncate`,title:e.status.message,children:e.status.message}):null]})})};function Ob(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var kb=({model:e})=>{let t=`https://huggingface.co/${e.repo_id}`,n=e.repo_id.includes(`/`)?e.repo_id.split(`/`).slice(1).join(`/`):e.repo_id;return(0,B.jsx)(hb,{onClick:()=>window.open(t,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,B.jsxs)(yb,{className:`p-4 space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-sky-400`,children:[(0,B.jsx)(Qs,{className:`w-3.5 h-3.5`}),`Uploaded`]}),(0,B.jsx)(q,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,B.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(Ds,{className:`w-3.5 h-3.5`})})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-white font-semibold truncate flex items-center gap-1.5`,title:e.repo_id,children:[e.private?(0,B.jsx)(Ps,{className:`w-3.5 h-3.5 text-slate-400 shrink-0`}):null,(0,B.jsx)(`span`,{className:`truncate`,children:n})]}),(0,B.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,title:e.repo_id,children:[e.repo_id,` · updated `,Ob(e.last_modified)]})]})]})})};async function Ab(e,t,n){return xf(e,t,`/start-inference`,{method:`POST`,body:n,action:`Start inference`})}async function jb(e,t){return xf(e,t,`/stop-inference`,{method:`POST`,action:`Stop inference`})}async function Mb(e,t,n){return xf(e,t,`/inference-status`,{signal:n,action:`Get inference status`})}var Nb=({deviceId:e,paused:t})=>{let{videoRef:n,hasError:r}=rb(e,t);return t||r||!e?(0,B.jsxs)(`div`,{className:`w-32 h-24 bg-gray-800 rounded border border-gray-700 flex flex-col items-center justify-center`,children:[(0,B.jsx)($s,{className:`w-5 h-5 text-gray-500 mb-1`}),(0,B.jsx)(`span`,{className:`text-[10px] text-gray-500`,children:t?`Released`:`No preview`})]}):(0,B.jsx)(`video`,{ref:n,autoPlay:!0,muted:!0,playsInline:!0,className:`w-32 h-24 object-cover rounded border border-gray-700 bg-black`})},Pb=30,Fb=({open:e,onOpenChange:t,robot:n,jobId:r,initialStep:i})=>{let{baseUrl:a,fetchWithHeaders:o}=wl(),{toast:s}=ea(),c=ht(),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(i),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(60),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)({}),{cameras:O}=$y({enabled:e});(0,_.useEffect)(()=>{if(!e)return;let t=!1;return bb(a,o,r).then(e=>{if(!t&&(u(e),e.length>0)){let t=e[e.length-1].step;f(e=>e??t)}}).catch(()=>{t||u([])}),()=>{t=!0}},[e,a,o,r]),(0,_.useEffect)(()=>{if(!e||d==null){x(null),T(null);return}let t=!1;return C(!0),T(null),ute(a,o,r,d).then(e=>{t||(x(e),D(t=>{let n={};for(let r of Object.keys(e.image_features))n[r]=t[r]??null;return n}))}).catch(e=>{t||(x(null),T(e instanceof Error?e.message:String(e)))}).finally(()=>{t||C(!1)}),()=>{t=!0}},[e,a,o,r,d]),(0,_.useEffect)(()=>{if(!b)return;let e=n?.cameras??[];e.length===0||O.length===0||D(t=>{let n=!1,r={...t};for(let t of Object.keys(b.image_features)){if(r[t]!=null)continue;let i=e.find(e=>e.name.toLowerCase()===t.toLowerCase());if(!i)continue;let a=i.device_id&&O.find(e=>e.deviceId===i.device_id)||O.find(e=>e.index===i.camera_index);a&&(r[t]=a.index,n=!0)}return n?r:t})},[b,n,O]);let k=d==null?null:l.find(e=>e.step===d)?.ref??null,A=b?Object.keys(b.image_features):[],j=A.every(e=>E[e]!=null),M=!!n&&n.is_clean&&k!=null&&!!b&&j&&!v,N=async()=>{if(!n||k==null||!b)return;y(!0),await new Promise(e=>setTimeout(e,300));let e={};for(let[t,n]of Object.entries(b.image_features)){let r=E[t];r!=null&&(e[t]={type:`opencv`,camera_index:r,width:n.width,height:n.height,fps:Pb})}try{await Ab(a,o,{follower_port:n.follower_port,follower_config:n.follower_config,policy_ref:k,task:p,cameras:e,duration_s:h}),t(!1),c(`/inference`)}catch(e){s({title:`Couldn't start inference`,description:e instanceof Error?e.message:String(e),variant:`destructive`}),y(!1)}},P=(e,t)=>{let n=Number(t);D(t=>({...t,[e]:n}))};return(0,B.jsx)(lf,{open:e,onOpenChange:t,children:(0,B.jsxs)(ff,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,B.jsxs)(pf,{children:[(0,B.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,B.jsx)(`div`,{className:`w-8 h-8 bg-green-500 rounded-full flex items-center justify-center`,children:(0,B.jsx)(Ls,{className:`w-4 h-4 text-white`})})}),(0,B.jsx)(hf,{className:`text-white text-center text-2xl font-bold`,children:`Configure Inference`})]}),(0,B.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,B.jsx)(gf,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a checkpoint and confirm hardware. The selected policy will drive the follower autonomously for the configured duration.`}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,B.jsx)(gs,{className:`w-4 h-4 text-green-400`}),(0,B.jsxs)(`span`,{className:`text-slate-200`,children:[`Running on `,(0,B.jsx)(`strong`,{children:n.name})]})]}):(0,B.jsxs)(Mv,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsxs)(Nv,{children:[(0,B.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before running inference.`]})]}):(0,B.jsxs)(Mv,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsx)(Nv,{children:`Select and configure a robot on the Landing page first.`})]})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Checkpoint`}),l.length===0?(0,B.jsxs)(Mv,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsx)(Nv,{children:`No checkpoints available for this job yet.`})]}):(0,B.jsx)(xb,{checkpoints:l,selectedStep:d,onChange:f})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Run parameters`}),b?.requires_task?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`task`,className:`text-sm font-medium text-gray-300`,children:`Task description`}),(0,B.jsx)(J_,{id:`task`,value:p,onChange:e=>m(e.target.value),placeholder:`e.g., pick up the red block`,className:`bg-gray-800 border-gray-700 text-white`}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`This policy is language-conditioned (`,b.policy_type,`).`]})]}):null,(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`durationS`,className:`text-sm font-medium text-gray-300`,children:`Max duration (seconds)`}),(0,B.jsx)(Y_,{id:`durationS`,min:1,value:h,onChange:e=>{e!==void 0&&g(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Cameras`}),S?(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-400`,children:[(0,B.jsx)(Ns,{className:`w-4 h-4 animate-spin`}),`Reading policy config…`]}):w?(0,B.jsxs)(Mv,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsxs)(Nv,{children:[`Couldn't load policy config: `,w]})]}):b?A.length===0?(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`This policy doesn't use cameras.`}):(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Bind a physical camera to each name the policy was trained with. Resolution comes from the checkpoint.`}),A.map(e=>{let t=b.image_features[e],n=E[e],r=n==null?void 0:O.find(e=>e.index===n);return(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsx)(J,{className:`text-sm font-medium text-gray-200`,children:e}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[t.width,`×`,t.height]})]}),(0,B.jsxs)(Uy,{value:n==null?void 0:String(n),onValueChange:t=>P(e,t),children:[(0,B.jsx)(Gy,{className:`bg-gray-800 border-gray-700 text-white w-56`,children:(0,B.jsx)(Wy,{placeholder:`Select a camera`})}),(0,B.jsx)(Jy,{className:`bg-gray-900 border-gray-700 text-white`,children:O.length===0?(0,B.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-gray-500`,children:`No cameras detected`}):O.map(e=>(0,B.jsxs)(Xy,{value:String(e.index),children:[`#`,e.index,` — `,e.name]},e.index))})]}),(0,B.jsx)(Nb,{deviceId:r?.deviceId??``,paused:v})]},e)})]}):null]}),(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,B.jsxs)(q,{onClick:N,disabled:!M,className:`w-full sm:w-auto bg-green-500 hover:bg-green-600 text-white px-10 py-6 text-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:[(0,B.jsx)(Ls,{className:`w-5 h-5 mr-2`}),v?`Starting…`:`Start Inference`]}),(0,B.jsx)(q,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Ib=({open:e,onOpenChange:t,onImported:n})=>{let{baseUrl:r,fetchWithHeaders:i}=wl(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);return(0,B.jsx)(lf,{open:e,onOpenChange:t,children:(0,B.jsxs)(ff,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[520px] p-8`,children:[(0,B.jsxs)(pf,{children:[(0,B.jsx)(hf,{className:`text-white text-center text-2xl font-bold`,children:`Import a model`}),(0,B.jsx)(gf,{className:`text-gray-400 text-center`,children:`Point at a local directory or a Hugging Face repo. It appears as a job you can run inference on.`})]}),(0,B.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`source`,className:`text-sm font-medium text-gray-300`,children:`Local path or Hugging Face repo id`}),(0,B.jsx)(J_,{id:`source`,value:a,onChange:e=>o(e.target.value),placeholder:`/path/to/pretrained_model or user/my-policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`name`,className:`text-sm font-medium text-gray-300`,children:`Display name (optional)`}),(0,B.jsx)(J_,{id:`name`,value:s,onChange:e=>c(e.target.value),placeholder:`My imported policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),d?(0,B.jsxs)(Mv,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsx)(Nv,{children:d})]}):null,(0,B.jsxs)(`div`,{className:`flex gap-3 justify-center pt-2`,children:[(0,B.jsxs)(q,{onClick:async()=>{let e=a.trim();if(e){u(!0),f(null);try{await oee(r,i,e,s.trim()||void 0),o(``),c(``),t(!1),n()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},disabled:!a.trim()||l,className:`bg-green-500 hover:bg-green-600 text-white px-8 disabled:opacity-40`,children:[l?(0,B.jsx)(Ns,{className:`w-4 h-4 mr-2 animate-spin`}):(0,B.jsx)(Ts,{className:`w-4 h-4 mr-2`}),l?`Importing…`:`Import`]}),(0,B.jsx)(q,{onClick:()=>t(!1),variant:`outline`,className:`border-gray-500 px-8 text-zinc-400 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Lb=`lelab.selectedRobot`,Rb=()=>{try{let e=localStorage.getItem(Lb);return e&&typeof e==`string`?e:null}catch{return null}},zb=e=>{try{e?localStorage.setItem(Lb,e):localStorage.removeItem(Lb)}catch{}},Bb=()=>{let{baseUrl:e,fetchWithHeaders:t}=wl(),{toast:n}=ea(),r=ft(),[i,a]=(0,_.useState)({}),[o,s]=(0,_.useState)(()=>Rb()),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let n=!1;return(async()=>{l(!0);try{let r=await(await t(`${e}/robots`)).json();if(n)return;let i={};for(let e of r.robots??[])i[e.name]=e;a(i),s(e=>e&&e in i?e:null)}catch(e){n||console.error(`Failed to fetch robots:`,e)}finally{n||l(!1)}})(),()=>{n=!0}},[e,t,r.key]),(0,_.useEffect)(()=>{zb(o)},[o]);let u=(0,_.useCallback)(e=>{s(e)},[]),d=(0,_.useCallback)(()=>{s(null)},[]),f=(0,_.useCallback)(async r=>{let i=r.trim();if(!i)return n({title:`Missing name`,description:`Robot name cannot be empty.`,variant:`destructive`}),!1;if(/[/\\]|\.\./.test(i))return n({title:`Invalid name`,description:`Robot names cannot contain '/', '\\', or '..'`,variant:`destructive`}),!1;try{let r=await t(`${e}/robots/${encodeURIComponent(i)}?create=true`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(r.status===409)return n({title:`Already exists`,description:`A robot named "${i}" already exists. Pick it from the dropdown or choose a different name.`,variant:`destructive`}),!1;if(!r.ok)return n({title:`Failed to create`,description:await r.text(),variant:`destructive`}),!1;let o=await r.json();return o.robot&&(a(e=>({...e,[i]:o.robot})),s(i)),!0}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]),p=(0,_.useCallback)(async r=>{try{let i=await t(`${e}/robots/${encodeURIComponent(r)}`,{method:`DELETE`});return i.ok?(a(e=>{let{[r]:t,...n}=e;return n}),s(e=>e===r?null:e),!0):(n({title:`Failed to delete`,description:await i.text(),variant:`destructive`}),!1)}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]);return{records:i,selectedName:o,selectedRecord:(0,_.useMemo)(()=>o?i[o]??null:null,[o,i]),availableNames:(0,_.useMemo)(()=>Object.keys(i).sort(),[i]),isLoading:c,selectRobot:u,clearSelection:d,createRobot:f,deleteRobot:p}},Vb=10,Hb=new Set([`RUNNING`,`QUEUED`,`SCHEDULING`]),Ub=e=>e.state===`running`||e.checkpoint_count>0,Wb=e=>Hb.has((e.status?.stage??``).toUpperCase()),Gb=()=>{let{baseUrl:e,fetchWithHeaders:t}=wl(),{toast:n}=ea(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(``),{selectedRecord:h}=Bb(),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),T=(0,_.useCallback)(async()=>{try{let[n,r]=await Promise.all([Cf(e,t,Vb),uee(e,t)]);i(n),o(r.jobs),c(r.models),u(r.authenticated),f(null)}catch(e){f(e instanceof Error?e.message:String(e))}},[e,t]);(0,_.useEffect)(()=>{T();let e=()=>{document.visibilityState===`visible`&&T()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,T),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,T)}},[T]),mb(T,(0,_.useCallback)(e=>{e.length!==0&&i(t=>{if(t.length===0)return t;let n=new Map(e.map(e=>[e.id,e])),r=!1,i=t.map(e=>{let t=n.get(e.id);return t?(r=!0,{...e,state:t.state,metrics:t.metrics,wandb_run_url:t.wandb_run_url,checkpoint_count:t.checkpoint_count}):e});return r?i:t})},[]));let E=async r=>{try{await wf(e,t,r),n({title:`Job stopping`}),T()}catch(e){n({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},D=(e,t)=>{S(e),w(t),v(!0)},O=async r=>{try{await Tf(e,t,r),n({title:`Job removed`}),T()}catch(e){n({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},k=p.trim().toLowerCase(),A=(0,_.useCallback)(e=>!k||(e??``).toLowerCase().includes(k),[k]),j=(0,_.useMemo)(()=>r.filter(e=>A(e.name)),[r,A]),M=(0,_.useMemo)(()=>a.filter(e=>A(e.docker_image??e.space_id??e.id)),[a,A]),N=(0,_.useMemo)(()=>s.filter(e=>A(e.repo_id)),[s,A]),P=(0,_.useMemo)(()=>j.filter(e=>e.runner===`local`),[j]),F=(0,_.useMemo)(()=>j.filter(e=>e.runner===`hf_cloud`),[j]),ee=(0,_.useMemo)(()=>j.filter(e=>e.runner===`imported`),[j]),te=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_job_id).filter(e=>!!e)),[F]),ne=(0,_.useMemo)(()=>M.filter(e=>!te.has(e.id)),[M,te]),re=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_repo_id).filter(e=>!!e)),[F]),ie=(0,_.useMemo)(()=>N.filter(e=>!re.has(e.repo_id)),[N,re]),ae=(0,_.useMemo)(()=>P.filter(Ub),[P]),oe=(0,_.useMemo)(()=>P.filter(e=>!Ub(e)),[P]),se=(0,_.useMemo)(()=>F.filter(Ub),[F]),ce=(0,_.useMemo)(()=>F.filter(e=>!Ub(e)),[F]),le=(0,_.useMemo)(()=>ne.filter(Wb),[ne]),ue=(0,_.useMemo)(()=>ne.filter(e=>!Wb(e)),[ne]),de=oe.length+ce.length+ue.length;return(0,B.jsxs)(`section`,{className:`space-y-6`,"data-tour":`jobs-section`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`Jobs`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(Hs,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-slate-400 pointer-events-none`}),(0,B.jsx)(J_,{value:p,onChange:e=>m(e.target.value),placeholder:`Search jobs`,className:`h-8 w-48 sm:w-60 pl-8 bg-slate-800/50 border-slate-700 text-sm text-white placeholder:text-slate-500`,"aria-label":`Search jobs`})]}),(0,B.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>b(!0),className:`h-8 border-slate-700 bg-slate-800/50 text-slate-200 hover:text-white`,children:[(0,B.jsx)(Ts,{className:`w-3.5 h-3.5 mr-1.5`}),`Import model`]}),(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:T,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Refresh jobs`,children:(0,B.jsx)(zs,{className:`w-4 h-4`})})]})]}),d?(0,B.jsxs)(`p`,{className:`text-sm text-red-300`,children:[`Couldn't load jobs: `,d]}):null,(0,B.jsxs)(kv,{defaultOpen:!0,children:[(0,B.jsxs)(Av,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Local jobs (`,ae.length,`)`]}),(0,B.jsx)(jv,{className:`pt-3`,children:ae.length===0?(0,B.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No local jobs match your search.`:`No active local jobs. Start one from the Training page.`}):(0,B.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:ae.map(e=>(0,B.jsx)(wb,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]}),ee.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`border-t border-slate-700`}),(0,B.jsxs)(kv,{defaultOpen:!0,children:[(0,B.jsxs)(Av,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Imported models (`,ee.length,`)`]}),(0,B.jsx)(jv,{className:`pt-3`,children:(0,B.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:ee.map(e=>(0,B.jsx)(wb,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]})]}):null,(0,B.jsx)(`div`,{className:`border-t border-slate-700`}),(0,B.jsxs)(kv,{defaultOpen:!0,children:[(0,B.jsxs)(Av,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Online jobs (`,se.length+le.length+ie.length,`)`]}),(0,B.jsx)(jv,{className:`pt-3`,children:!l&&F.length===0?(0,B.jsx)(`p`,{className:`text-sm text-slate-500`,children:`Sign in with Hugging Face to see your cloud jobs.`}):se.length===0&&le.length===0&&ie.length===0?(0,B.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No online jobs match your search.`:`No active cloud jobs.`}):(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[se.map(e=>(0,B.jsx)(wb,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),le.map(e=>(0,B.jsx)(Db,{job:e},e.id)),ie.map(e=>(0,B.jsx)(kb,{model:e},e.repo_id))]})})]}),de>0?(0,B.jsxs)(kv,{children:[(0,B.jsxs)(Av,{className:`group flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Untracked (`,de,`)`]}),(0,B.jsx)(jv,{className:`pt-3`,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[oe.map(e=>(0,B.jsx)(wb,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),ce.map(e=>(0,B.jsx)(wb,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),ue.map(e=>(0,B.jsx)(Db,{job:e},e.id))]})})]}):null,x?(0,B.jsx)(Fb,{open:g,onOpenChange:v,robot:h,jobId:x.id,initialStep:C}):null,(0,B.jsx)(Ib,{open:y,onOpenChange:b,onImported:T})]})},Kb=`uv tool install git+https://github.com/huggingface/leLab.git && lelab`,qb=`http://localhost:8000/`,Jb=({open:e,onOpenChange:t,dismissible:n=!0})=>{let[r,i]=(0,_.useState)(!1),a=e=>{n||e.preventDefault()};return(0,B.jsx)(lf,{open:e,onOpenChange:n?t:()=>void 0,children:(0,B.jsxs)(ff,{className:`bg-gray-900 border-gray-700 text-gray-300 sm:max-w-xl`,hideClose:!n,onEscapeKeyDown:a,onPointerDownOutside:a,onInteractOutside:a,children:[(0,B.jsxs)(pf,{className:`text-center sm:text-center min-w-0`,children:[(0,B.jsxs)(hf,{className:`text-white flex items-center justify-center gap-2 text-xl`,children:[(0,B.jsx)(Ys,{className:`w-6 h-6`}),`Get Started with LeLab`]}),(0,B.jsx)(gf,{children:`LeLab runs on your machine. Click the command to copy it, then paste in a terminal:`})]}),(0,B.jsxs)(`div`,{className:`space-y-4 py-2 min-w-0`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(Kb),i(!0),setTimeout(()=>i(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},"aria-label":`Copy command to clipboard`,className:`group relative w-full bg-gray-800 hover:bg-gray-750 rounded-lg border border-gray-700 hover:border-gray-600 text-left transition-colors cursor-pointer`,children:[(0,B.jsx)(`pre`,{className:`p-4 pr-12 text-xs sm:text-sm overflow-x-auto whitespace-pre-wrap break-all`,children:(0,B.jsx)(`code`,{className:`text-green-400`,children:Kb})}),(0,B.jsx)(`span`,{className:`absolute right-2 top-2 flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 group-hover:text-white bg-gray-900/80`,children:r?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ls,{className:`w-3.5 h-3.5 text-green-400`}),`Copied`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Cs,{className:`w-3.5 h-3.5`}),`Copy`]})})]}),(0,B.jsx)(`p`,{className:`text-gray-400 text-sm text-center`,children:`After running, your browser will open the local LeLab app.`}),(0,B.jsx)(q,{asChild:!0,className:`w-full bg-blue-600 hover:bg-blue-700 text-white`,children:(0,B.jsxs)(`a`,{href:qb,target:`_blank`,rel:`noopener noreferrer`,children:[(0,B.jsx)(Ds,{className:`w-4 h-4 mr-2`}),`Open LeLab`]})})]})]})})},Yb=()=>{let{baseUrl:e,fetchWithHeaders:t}=wl(),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),o=(0,_.useCallback)(()=>{a(!0),Sf(e,t).then(r).catch(()=>r([])).finally(()=>a(!1))},[e,t]);return(0,_.useEffect)(()=>{o()},[o]),{datasets:n,loading:i,refresh:o}},Xb=Df(),Zb=()=>{let[e,t]=(0,_.useState)(Xb),{auth:n}=Dl(),{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}=Bb(),{datasets:u,loading:d}=Yb(),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(5),[x,S]=(0,_.useState)(60),[C,w]=(0,_.useState)(15),[T,E]=(0,_.useState)(!0),[D,O]=(0,_.useState)([]),k=(0,_.useRef)(null),A=ht(),{toast:j}=ea();(0,_.useEffect)(()=>{D.length>0&&(console.log(`🧹 Landing page: Cleaning up camera state from previous session`),k.current&&k.current(),O([]))},[]),(0,_.useEffect)(()=>()=>{k.current&&(console.log(`🧹 Landing page: Cleaning up camera streams on unmount`),k.current())},[]);let M=()=>{O(i?[...i.cameras??[]]:[]),p(!0)},N=e=>{p(e),!e&&k.current&&(console.log(`🧹 Modal closed: Releasing camera streams`),k.current())},P=()=>A(`/training`),F=(e,t)=>{let n=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,r=t?`https://huggingface.co/login?next=${encodeURIComponent(n)}`:`https://huggingface.co${n}`;window.open(r,`_blank`,`noopener,noreferrer`)};return(0,B.jsxs)(`div`,{className:`min-h-screen bg-black text-white pb-16`,style:{"--lelab-topbar-h":`48px`},children:[(0,B.jsx)(Gf,{}),(0,B.jsx)(`div`,{className:`sticky z-20 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70 border-b border-gray-800`,style:{top:`var(--lelab-topbar-h)`},children:(0,B.jsxs)(`div`,{className:`mx-auto max-w-7xl px-4 py-4 grid gap-4 grid-cols-1 lg:grid-cols-[1.2fr_2fr]`,children:[(0,B.jsx)(q_,{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,"data-tour":`dataset-picker`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Dataset`}),(0,B.jsx)(pb,{datasets:u,loading:d,onPickExisting:e=>{if(e.source===`local`||e.source===`both`){A(`/edit-dataset?dataset=${encodeURIComponent(e.repo_id)}`);return}F(e.repo_id,e.private)},onOpenCustom:e=>{F(e,!0)},onCreateNew:e=>{h(e),M()},children:(0,B.jsxs)(q,{variant:`outline`,role:`combobox`,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[(0,B.jsx)(`span`,{className:`truncate text-gray-300`,children:d?`Loading datasets…`:`Select or create a dataset…`}),(0,B.jsx)(ms,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})})]}),(0,B.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,"data-tour":`training-entry`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Create a model`}),(0,B.jsx)(q,{onClick:P,className:`w-full bg-green-500 hover:bg-green-600 text-white`,children:`Training`})]})]})]})}),(0,B.jsx)(`main`,{className:`mx-auto max-w-7xl px-4 py-6`,children:(0,B.jsx)(Gb,{})}),(0,B.jsx)(qf,{}),(0,B.jsx)(Jb,{open:e,onOpenChange:t,dismissible:!Xb}),(0,B.jsx)(ub,{open:f,onOpenChange:N,robot:i,datasetName:m,setDatasetName:h,singleTask:g,setSingleTask:v,numEpisodes:y,setNumEpisodes:b,episodeTimeS:x,setEpisodeTimeS:S,resetTimeS:C,setResetTimeS:w,streamingEncoding:T,setStreamingEncoding:E,cameras:D,setCameras:O,onStart:async()=>{if(!i){j({title:`No robot selected`,description:`Select or create a robot on the Landing page first.`,variant:`destructive`});return}let e=i;if(!e.is_clean){j({title:`Robot not ready`,description:`${e.name} is missing a calibration. Configure it before recording.`,variant:`destructive`});return}if(!m||!g){j({title:`Missing dataset details`,description:`Please enter a dataset name and task description.`,variant:`destructive`});return}let t=n.status===`authenticated`?`${n.username}/${m}`:m;D.length>0&&k.current&&(console.log(`🔓 Releasing camera streams before starting recording...`),j({title:`Preparing Camera Resources`,description:`Releasing ${D.length} camera stream(s) for recording...`}),k.current(),await new Promise(e=>setTimeout(e,500)),console.log(`✅ Camera streams released, proceeding with recording...`),j({title:`Camera Resources Ready`,description:`Camera streams released successfully. Starting recording...`}));let r=D.reduce((e,t)=>(e[t.name]={type:t.type,camera_index:t.camera_index,width:t.width,height:t.height,fps:t.fps,...t.fourcc?{fourcc:t.fourcc}:{},...t.backend?{backend:t.backend}:{}},e),{}),a={leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config,dataset_repo_id:t,single_task:g,num_episodes:y,episode_time_s:x,reset_time_s:C,fps:30,video:!0,push_to_hub:!1,resume:!1,streaming_encoding:T,cameras:r};p(!1),A(`/recording`,{state:{recordingConfig:a}})},releaseStreamsRef:k})]})},Qb={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},$b={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ex=`attached`,tx=1e3,nx=1001,rx=1002,ix=1003,ax=1004,ox=1005,sx=1006,cx=1007,lx=1008,ux=1009,dx=1010,fx=1011,px=1012,mx=1013,hx=1014,gx=1015,_x=1016,vx=1017,yx=1018,bx=1020,xx=35902,Sx=1021,Cx=1022,wx=1023,Tx=1026,Ex=1027,Dx=1028,Ox=1029,kx=1030,Ax=1031,jx=1033,Mx=33776,Nx=33777,Px=33778,Fx=33779,Ix=35840,Lx=35841,Rx=35842,zx=35843,Bx=36196,Vx=37492,Hx=37496,Ux=37808,Wx=37809,Gx=37810,Kx=37811,qx=37812,Jx=37813,Yx=37814,dte=37815,fte=37816,pte=37817,mte=37818,hte=37819,gte=37820,_te=37821,vte=36492,yte=36494,bte=36495,xte=36283,Ste=36284,Cte=36285,wte=36286,Xx=2300,Zx=2301,Qx=2302,$x=2400,eS=2401,tS=2402,nS=2500,rS=3200,iS=3201,aS=`srgb`,oS=`srgb-linear`,sS=`linear`,cS=`srgb`,lS=7680,uS=35044,dS=2e3,fS=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+pS[e>>16&255]+pS[e>>24&255]+`-`+pS[t&255]+pS[t>>8&255]+`-`+pS[t>>16&15|64]+pS[t>>24&255]+`-`+pS[n&63|128]+pS[n>>8&255]+`-`+pS[n>>16&255]+pS[n>>24&255]+pS[r&255]+pS[r>>8&255]+pS[r>>16&255]+pS[r>>24&255]).toLowerCase()}function vS(e,t,n){return Math.max(t,Math.min(n,e))}function yS(e,t){return(e%t+t)%t}function bS(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function xS(e,t,n){return e===t?0:(n-e)/(t-e)}function SS(e,t,n){return(1-n)*e+n*t}function CS(e,t,n,r){return SS(e,t,1-Math.exp(-n*r))}function wS(e,t=1){return t-Math.abs(yS(e,t*2)-t)}function TS(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function ES(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function DS(e,t){return e+Math.floor(Math.random()*(t-e+1))}function OS(e,t){return e+Math.random()*(t-e)}function kS(e){return e*(.5-Math.random())}function AS(e){e!==void 0&&(mS=e);let t=mS+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function jS(e){return e*hS}function MS(e){return e*gS}function NS(e){return(e&e-1)==0&&e!==0}function PS(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function FS(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function IS(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:console.warn(`THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function LS(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function RS(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var zS={DEG2RAD:hS,RAD2DEG:gS,generateUUID:_S,clamp:vS,euclideanModulo:yS,mapLinear:bS,inverseLerp:xS,lerp:SS,damp:CS,pingpong:wS,smoothstep:TS,smootherstep:ES,randInt:DS,randFloat:OS,randFloatSpread:kS,seededRandom:AS,degToRad:jS,radToDeg:MS,isPowerOfTwo:NS,ceilPowerOfTwo:PS,floorPowerOfTwo:FS,setQuaternionFromProperEuler:IS,normalize:RS,denormalize:LS},BS=class e{constructor(t=0,n=0){e.prototype.isVector2=!0,this.x=t,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=vS(this.x,e.x,t.x),this.y=vS(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=vS(this.x,e,t),this.y=vS(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(vS(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(vS(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},VS=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(o===0){e[t+0]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(u!==m||s!==d||c!==f||l!==p){let e=1-o,t=s*d+c*f+l*p+u*m,n=t>=0?1:-1,r=1-t*t;if(r>2**-52){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,o=Math.sin(o*a)/i}let i=o*n;if(s=s*e+d*i,c=c*e+f*i,l=l*e+p*i,u=u*e+m*i,e===1-o){let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<2**-52?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(vS(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let s=1-o*o;if(s<=2**-52){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this}let c=Math.sqrt(s),l=Math.atan2(c,o),u=Math.sin((1-t)*l)/c,d=Math.sin(t*l)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=r*u+this._y*d,this._z=i*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Y=class e{constructor(t=0,n=0,r=0){e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(US.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(US.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=vS(this.x,e.x,t.x),this.y=vS(this.y,e.y,t.y),this.z=vS(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=vS(this.x,e,t),this.y=vS(this.y,e,t),this.z=vS(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(vS(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return HS.copy(this).projectOnVector(e),this.sub(HS)}reflect(e){return this.sub(HS.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(vS(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},HS=new Y,US=new VS,WS=class e{constructor(t,n,r,i,a,o,s,c,l){e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(GS.makeScale(e,t)),this}rotate(e){return this.premultiply(GS.makeRotation(-e)),this}translate(e,t){return this.premultiply(GS.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},GS=new WS;function KS(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function qS(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function JS(){let e=qS(`canvas`);return e.style.display=`block`,e}var YS={};function XS(e){e in YS||(YS[e]=!0,console.warn(e))}function ZS(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function QS(e){let t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function $S(e){let t=e.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}var eC=new WS().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),tC=new WS().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function nC(){let e={enabled:!0,workingColorSpace:oS,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=iC(e.r),e.g=iC(e.g),e.b=iC(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=aC(e.r),e.g=aC(e.g),e.b=aC(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?sS:this.spaces[e].transfer},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return XS(`THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return XS(`THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[oS]:{primaries:t,whitePoint:r,transfer:sS,toXYZ:eC,fromXYZ:tC,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:aS},outputColorSpaceConfig:{drawingBufferColorSpace:aS}},[aS]:{primaries:t,whitePoint:r,transfer:cS,toXYZ:eC,fromXYZ:tC,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:aS}}}),e}var rC=nC();function iC(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function aC(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var oC,sC=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{oC===void 0&&(oC=qS(`canvas`)),oC.width=e.width,oC.height=e.height;let t=oC.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=oC}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=qS(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0}get width(){return this.source.getSize(fC).x}get height(){return this.source.getSize(fC).y}get depth(){return this.source.getSize(fC).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case tx:e.x-=Math.floor(e.x);break;case nx:e.x=e.x<0?0:1;break;case rx:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case tx:e.y-=Math.floor(e.y);break;case nx:e.y=e.y<0?0:1;break;case rx:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};pC.DEFAULT_IMAGE=null,pC.DEFAULT_MAPPING=300,pC.DEFAULT_ANISOTROPY=1;var mC=class e{constructor(t=0,n=0,r=0,i=1){e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)s&&e>_?e_?s1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,xC),xC.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(kC),AC.subVectors(this.max,kC),CC.subVectors(e.a,kC),wC.subVectors(e.b,kC),TC.subVectors(e.c,kC),EC.subVectors(wC,CC),DC.subVectors(TC,wC),OC.subVectors(CC,TC);let t=[0,-EC.z,EC.y,0,-DC.z,DC.y,0,-OC.z,OC.y,EC.z,0,-EC.x,DC.z,0,-DC.x,OC.z,0,-OC.x,-EC.y,EC.x,0,-DC.y,DC.x,0,-OC.y,OC.x,0];return!NC(t,CC,wC,TC,AC)||(t=[1,0,0,0,1,0,0,0,1],!NC(t,CC,wC,TC,AC))?!1:(jC.crossVectors(EC,DC),t=[jC.x,jC.y,jC.z],NC(t,CC,wC,TC,AC))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,xC).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(xC).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(bC[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),bC[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),bC[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),bC[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),bC[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),bC[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),bC[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),bC[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(bC),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},bC=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],xC=new Y,SC=new yC,CC=new Y,wC=new Y,TC=new Y,EC=new Y,DC=new Y,OC=new Y,kC=new Y,AC=new Y,jC=new Y,MC=new Y;function NC(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){MC.fromArray(e,a);let o=i.x*Math.abs(MC.x)+i.y*Math.abs(MC.y)+i.z*Math.abs(MC.z),s=t.dot(MC),c=n.dot(MC),l=r.dot(MC);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var PC=new yC,FC=new Y,IC=new Y,LC=class{constructor(e=new Y,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?PC.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;FC.subVectors(e,this.center);let t=FC.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(FC,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(IC.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(FC.copy(e.center).add(IC)),this.expandByPoint(FC.copy(e.center).sub(IC))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},RC=new Y,zC=new Y,BC=new Y,VC=new Y,HC=new Y,UC=new Y,WC=new Y,GC=class{constructor(e=new Y,t=new Y(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,RC)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=RC.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(RC.copy(this.origin).addScaledVector(this.direction,t),RC.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){zC.copy(e).add(t).multiplyScalar(.5),BC.copy(t).sub(e).normalize(),VC.copy(this.origin).sub(zC);let i=e.distanceTo(t)*.5,a=-this.direction.dot(BC),o=VC.dot(this.direction),s=-VC.dot(BC),c=VC.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(zC).addScaledVector(BC,d),f}intersectSphere(e,t){RC.subVectors(e.center,this.origin);let n=RC.dot(this.direction),r=RC.dot(RC)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,RC)!==null}intersectTriangle(e,t,n,r,i){HC.subVectors(t,e),UC.subVectors(n,e),WC.crossVectors(HC,UC);let a=this.direction.dot(WC),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;VC.subVectors(this.origin,e);let s=o*this.direction.dot(UC.crossVectors(VC,UC));if(s<0)return null;let c=o*this.direction.dot(HC.cross(VC));if(c<0||s+c>a)return null;let l=-o*VC.dot(WC);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},KC=class e{constructor(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,r=1/qC.setFromMatrixColumn(e,0).length(),i=1/qC.setFromMatrixColumn(e,1).length(),a=1/qC.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(YC,e,XC)}lookAt(e,t,n){let r=this.elements;return $C.subVectors(e,t),$C.lengthSq()===0&&($C.z=1),$C.normalize(),ZC.crossVectors(n,$C),ZC.lengthSq()===0&&(Math.abs(n.z)===1?$C.x+=1e-4:$C.z+=1e-4,$C.normalize(),ZC.crossVectors(n,$C)),ZC.normalize(),QC.crossVectors($C,ZC),r[0]=ZC.x,r[4]=QC.x,r[8]=$C.x,r[1]=ZC.y,r[5]=QC.y,r[9]=$C.y,r[2]=ZC.z,r[6]=QC.z,r[10]=$C.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],ee=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*ee,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*ee,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*ee,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*ee,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=u*h*c-m*d*c+m*s*f-o*h*f-u*s*g+o*d*g,v=p*d*c-l*h*c-p*s*f+a*h*f+l*s*g-a*d*g,y=l*m*c-p*u*c+p*o*f-a*m*f-l*o*g+a*u*g,b=p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h,x=t*_+n*v+r*y+i*b;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/x;return e[0]=_*S,e[1]=(m*d*i-u*h*i-m*r*f+n*h*f+u*r*g-n*d*g)*S,e[2]=(o*h*i-m*s*i+m*r*c-n*h*c-o*r*g+n*s*g)*S,e[3]=(u*s*i-o*d*i-u*r*c+n*d*c+o*r*f-n*s*f)*S,e[4]=v*S,e[5]=(l*h*i-p*d*i+p*r*f-t*h*f-l*r*g+t*d*g)*S,e[6]=(p*s*i-a*h*i-p*r*c+t*h*c+a*r*g-t*s*g)*S,e[7]=(a*d*i-l*s*i+l*r*c-t*d*c-a*r*f+t*s*f)*S,e[8]=y*S,e[9]=(p*u*i-l*m*i-p*n*f+t*m*f+l*n*g-t*u*g)*S,e[10]=(a*m*i-p*o*i+p*n*c-t*m*c-a*n*g+t*o*g)*S,e[11]=(l*o*i-a*u*i-l*n*c+t*u*c+a*n*f-t*o*f)*S,e[12]=b*S,e[13]=(l*m*r-p*u*r+p*n*d-t*m*d-l*n*h+t*u*h)*S,e[14]=(p*o*r-a*m*r-p*n*s+t*m*s+a*n*h-t*o*h)*S,e[15]=(a*u*r-l*o*r+l*n*s-t*u*s-a*n*d+t*o*d)*S,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=qC.set(r[0],r[1],r[2]).length(),a=qC.set(r[4],r[5],r[6]).length(),o=qC.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],JC.copy(this);let s=1/i,c=1/a,l=1/o;return JC.elements[0]*=s,JC.elements[1]*=s,JC.elements[2]*=s,JC.elements[4]*=c,JC.elements[5]*=c,JC.elements[6]*=c,JC.elements[8]*=l,JC.elements[9]*=l,JC.elements[10]*=l,t.setFromRotationMatrix(JC),n.x=i,n.y=a,n.z=o,this}makePerspective(e,t,n,r,i,a,o=dS){let s=this.elements,c=2*i/(t-e),l=2*i/(n-r),u=(t+e)/(t-e),d=(n+r)/(n-r),f,p;if(o===2e3)f=-(a+i)/(a-i),p=-2*a*i/(a-i);else if(o===2001)f=-a/(a-i),p=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return s[0]=c,s[4]=0,s[8]=u,s[12]=0,s[1]=0,s[5]=l,s[9]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=f,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=dS){let s=this.elements,c=1/(t-e),l=1/(n-r),u=1/(a-i),d=(t+e)*c,f=(n+r)*l,p,m;if(o===2e3)p=(a+i)*u,m=-2*u;else if(o===2001)p=i*u,m=-1*u;else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return s[0]=2*c,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-f,s[2]=0,s[6]=0,s[10]=m,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},qC=new Y,JC=new KC,YC=new Y(0,0,0),XC=new Y(1,1,1),ZC=new Y,QC=new Y,$C=new Y,ew=new KC,tw=new VS,nw=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(vS(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-vS(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(vS(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-vS(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(vS(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-vS(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:console.warn(`THREE.Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ew.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ew,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return tw.setFromEuler(this),this.setFromQuaternion(tw,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};nw.DEFAULT_ORDER=`XYZ`;var rw=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){bw.subVectors(r,t),xw.subVectors(n,t),Sw.subVectors(e,t);let a=bw.dot(bw),o=bw.dot(xw),s=bw.dot(Sw),c=xw.dot(xw),l=xw.dot(Sw),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Cw)===null?!1:Cw.x>=0&&Cw.y>=0&&Cw.x+Cw.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Cw)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,Cw.x),s.addScaledVector(a,Cw.y),s.addScaledVector(o,Cw.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return Aw.setScalar(0),jw.setScalar(0),Mw.setScalar(0),Aw.fromBufferAttribute(e,t),jw.fromBufferAttribute(e,n),Mw.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Aw,i.x),a.addScaledVector(jw,i.y),a.addScaledVector(Mw,i.z),a}static isFrontFacing(e,t,n,r){return bw.subVectors(n,t),xw.subVectors(e,t),bw.cross(xw).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return bw.subVectors(this.c,this.b),xw.subVectors(this.a,this.b),bw.cross(xw).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;ww.subVectors(r,n),Tw.subVectors(i,n),Dw.subVectors(e,n);let s=ww.dot(Dw),c=Tw.dot(Dw);if(s<=0&&c<=0)return t.copy(n);Ow.subVectors(e,r);let l=ww.dot(Ow),u=Tw.dot(Ow);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(ww,a);kw.subVectors(e,i);let f=ww.dot(kw),p=Tw.dot(kw);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Tw,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return Ew.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(Ew,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(ww,a).addScaledVector(Tw,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Pw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Fw={h:0,s:0,l:0},Iw={h:0,s:0,l:0};function Lw(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var X=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=aS){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,rC.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=rC.workingColorSpace){return this.r=e,this.g=t,this.b=n,rC.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=rC.workingColorSpace){if(e=yS(e,1),t=vS(t,0,1),n=vS(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Lw(i,r,e+1/3),this.g=Lw(i,r,e),this.b=Lw(i,r,e-1/3)}return rC.colorSpaceToWorking(this,r),this}setStyle(e,t=aS){function n(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn(`THREE.Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);console.warn(`THREE.Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=aS){let n=Pw[e.toLowerCase()];return n===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=iC(e.r),this.g=iC(e.g),this.b=iC(e.b),this}copyLinearToSRGB(e){return this.r=aC(e.r),this.g=aC(e.g),this.b=aC(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=aS){return rC.workingToColorSpace(Rw.copy(this),e),Math.round(vS(Rw.r*255,0,255))*65536+Math.round(vS(Rw.g*255,0,255))*256+Math.round(vS(Rw.b*255,0,255))}getHexString(e=aS){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=rC.workingColorSpace){rC.workingToColorSpace(Rw.copy(this),t);let n=Rw.r,r=Rw.g,i=Rw.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},Vw=class extends Bw{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new nw,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Hw=new Y,Uw=new BS,Tte=0,Ww=class{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Tte++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=uS,this.updateRanges=[],this.gpuType=gx,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rt.count&&console.warn(`THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new yC);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error(`THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2))&&(tT.copy(i).invert(),nT.copy(e.ray).applyMatrix4(tT),!(n.boundingBox!==null&&nT.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,nT)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;in.far?null:{distance:l,point:dT.clone(),object:e}}function pT(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,aT),e.getVertexPosition(c,oT),e.getVertexPosition(l,sT);let u=Dte(e,t,n,r,aT,oT,sT,uT);if(u){let e=new Y;Nw.getBarycoord(uT,aT,oT,sT,e),i&&(u.uv=Nw.getInterpolatedAttribute(i,s,c,l,e,new BS)),a&&(u.uv1=Nw.getInterpolatedAttribute(a,s,c,l,e,new BS)),o&&(u.normal=Nw.getInterpolatedAttribute(o,s,c,l,e,new Y),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new Y,materialIndex:0};Nw.getNormal(aT,oT,sT,t.normal),u.face=t,u.barycoord=e}return u}var mT=class e extends eT{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new qw(c,3)),this.setAttribute(`normal`,new qw(l,3)),this.setAttribute(`uv`,new qw(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new Y;for(let a=0;a0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ud=`DialogDescriptionWarning`,Wd=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vd(Ud).contentName}}.`;return _.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Gd=vd,Kd=bd,qd=wd,Jd=Ed,Yd=Od,Xd=Nd,Zd=Fd,Qd=Ld,$d=Gd,ef=qd,tf=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Jd,{ref:n,className:K(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));tf.displayName=Jd.displayName;var nf=_.forwardRef(({className:e,children:t,hideClose:n,...r},i)=>(0,B.jsxs)(ef,{children:[(0,B.jsx)(tf,{}),(0,B.jsxs)(Yd,{ref:i,className:K(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...r,children:[t,!n&&(0,B.jsxs)(Qd,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,B.jsx)(nc,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));nf.displayName=Yd.displayName;var rf=({className:e,...t})=>(0,B.jsx)(`div`,{className:K(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});rf.displayName=`DialogHeader`;var af=({className:e,...t})=>(0,B.jsx)(`div`,{className:K(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});af.displayName=`DialogFooter`;var of=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Xd,{ref:n,className:K(`text-lg font-semibold leading-none tracking-tight`,e),...t}));of.displayName=Xd.displayName;var sf=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Zd,{ref:n,className:K(`text-sm text-muted-foreground`,e),...t}));sf.displayName=Zd.displayName;var lee=({open:e,onOpenChange:t})=>{let{auth:n,refetch:r}=Dl(),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(!1);return n.status===`unauthenticated`?(0,B.jsx)($d,{open:e,onOpenChange:t,children:(0,B.jsxs)(nf,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,B.jsxs)(rf,{children:[(0,B.jsx)(of,{className:`text-amber-200`,children:`Hugging Face CLI not configured`}),(0,B.jsx)(sf,{className:`text-gray-400`,children:`Uploads, training, and replay-from-Hub require a logged-in HF CLI. Run this in a terminal:`})]}),(0,B.jsxs)(`pre`,{className:`bg-gray-950 p-3 rounded border border-gray-700 text-xs sm:text-sm overflow-x-auto flex items-center justify-between gap-2`,children:[(0,B.jsx)(`code`,{className:`text-green-400`,children:n.loginCommand}),(0,B.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(n.loginCommand),a(!0),setTimeout(()=>a(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},className:`flex-shrink-0 text-gray-400 hover:text-gray-200 transition-colors`,"aria-label":`Copy command`,children:i?(0,B.jsx)(ls,{className:`w-4 h-4 text-green-400`}):(0,B.jsx)(Cs,{className:`w-4 h-4`})})]}),(0,B.jsxs)(q,{variant:`outline`,size:`sm`,onClick:async()=>{s(!0);try{await r()}finally{s(!1)}},disabled:o,className:`border-amber-700 bg-transparent text-amber-100 hover:bg-amber-900/40 hover:text-amber-50`,children:[(0,B.jsx)(zs,{className:`w-4 h-4 mr-2 ${o?`animate-spin`:``}`}),`I've logged in — recheck`]})]})}):null},uee=()=>{let{auth:e}=Dl(),[t,n]=(0,_.useState)(!1);return e.status===`loading`?(0,B.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-400`,children:[(0,B.jsx)(Ns,{className:`w-3 h-3 animate-spin`}),(0,B.jsx)(`span`,{children:`Checking HF…`})]}):e.status===`authenticated`?(0,B.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-200`,title:`Hugging Face authenticated`,children:[(0,B.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-emerald-400`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:e.username})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-2 rounded-full border border-amber-700/60 bg-amber-950/40 px-3 py-1 text-xs text-amber-100 hover:bg-amber-900/40 transition-colors`,"aria-label":`Hugging Face not configured — show login instructions`,children:[(0,B.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`HF not configured`})]}),(0,B.jsx)(lee,{open:t,onOpenChange:n})]})},cf=[{id:`welcome`,route:`/`,placement:`center`,title:`Welcome to LeLab`,body:`This quick tour walks you from a fresh setup to a robot that runs a policy you trained yourself: calibrate, record, train, run. It takes about two minutes, and you can leave anytime with Esc.`},{id:`pick-robot`,route:`/`,target:`robot-selector`,placement:`bottom`,title:`Pick or name your arm`,body:`Start here. Choose an existing robot, or type a new name to create one. Everything else in the tour hangs off the arm you select.`,isComplete:e=>e.hasSelectedRobot},{id:`calibrate`,route:`/calibration`,target:`calibration-start`,placement:`bottom`,title:`Calibrate the arms`,body:`Calibration teaches the app each joint's range of motion so movements map correctly. Run it once for the leader arm, then the follower. Press Start and follow the on-screen steps.`,optional:!0,isComplete:e=>e.robotIsClean},{id:`cameras`,route:`/calibration`,target:`calibration-cameras`,placement:`top`,title:`Add cameras (if your task needs sight)`,body:`If the robot has to see what it's doing, add one or more cameras here. They're saved with this robot and reused when you record. Skip this if your task doesn't need vision.`,optional:!0},{id:`teleop`,route:`/`,target:`robot-teleop`,placement:`top`,title:`Try teleoperation (optional)`,body:`Drive the follower arm by moving the leader. It's a good way to confirm calibration feels right before you record anything. This button unlocks once the arm is calibrated.`,optional:!0,gate:e=>e.robotIsClean},{id:`record`,route:`/`,target:`dataset-picker`,placement:`bottom`,title:`Record a dataset`,body:`A dataset is a set of episodes: one attempt at your task each. Episode time is how long each attempt runs; reset time is the pause to reposition objects between attempts. Aim for 10 to 50 clean episodes to start.`,gate:e=>e.robotIsClean,isComplete:e=>e.hasLocalDataset},{id:`train`,route:`/`,target:`training-entry`,placement:`bottom`,title:`Train a policy`,body:`Turn your recorded episodes into a policy the robot can run. ACT is fast and a great first choice; SmolVLA is a larger vision-language model. You can train on your own GPU, or rent one in the cloud with a Hugging Face login.`,gate:e=>e.hasLocalDataset,isComplete:e=>e.hasTrainedModel},{id:`watch-training`,route:`/`,target:`jobs-section`,placement:`top`,title:`Watch it train`,body:`Your training job shows up here with live progress. Once it has a usable checkpoint, a green play button appears on the model so you can run it.`},{id:`inference`,route:`/`,target:`jobs-section`,placement:`top`,title:`Run your policy`,body:`Press the play button on a finished model to let the robot attempt the task on its own, using what it learned from your episodes. This is the payoff of the whole loop.`,optional:!0},{id:`upload`,route:`/`,target:`training-entry`,placement:`bottom`,title:`Share on the Hub (optional)`,body:`Log in to Hugging Face to push your datasets and trained models to the Hub, so you can back them up, share them, or train in the cloud.`,optional:!0,show:e=>!e.isAuthenticated},{id:`done`,route:`/`,placement:`center`,title:`That's the whole loop`,body:`Calibrate, record, train, run. You can reopen this tour anytime from the ? button in the corner. Happy building.`}],lf=class extends Error{status;detail;constructor(e,t,n){super(e),this.name=`ApiError`,this.status=t,this.detail=n}};async function uf(e,t,n,{method:r=`GET`,body:i,signal:a,action:o}={}){let s={method:r,signal:a};i!==void 0&&(s.body=JSON.stringify(i));let c=await t(`${e}${n}`,s);if(!c.ok){let e=null;try{let t=await c.json();e=t?.detail??t?.message??null}catch{}throw new lf(`${o||`${r} ${n}`} failed: ${e??c.status}`,c.status,e)}if(c.status!==204)return c.json()}async function df(e,t,n){return uf(e,t,`/datasets`,{signal:n,action:`List datasets`})}async function dee(e,t,n){return uf(e,t,`/datasets?scope=local`,{signal:n,action:`List local datasets`})}async function ff(e,t,n=10,r){return(await uf(e,t,`/jobs?limit=${n}`,{signal:r,action:`List jobs`})).jobs}async function fee(e,t,n,r){return uf(e,t,`/jobs/${n}`,{signal:r,action:`Get job`})}async function pee(e,t,n,r){return(await uf(e,t,`/jobs/${n}/logs`,{signal:r,action:`Get job logs`})).logs}async function mee(e,t,n,r){return(await uf(e,t,`/jobs/${n}/log-file`,{signal:r,action:`Get job log file`})).logs}async function pf(e,t,n,r){return(await uf(e,t,`/jobs/${n}/metrics-history`,{signal:r,action:`Get job metrics history`})).points}async function mf(e,t,n){let{target:r,...i}=n,a=r?{config:i,target:r}:i;try{return await uf(e,t,`/jobs/training`,{method:`POST`,body:a,action:`Start training`})}catch(e){throw e instanceof lf&&e.status===409?Error(`Another training is already running. Stop it first.`):e}}async function hf(e,t,n,r){return uf(e,t,`/jobs/import`,{method:`POST`,body:r?{source:n,name:r}:{source:n},action:`Import model`})}async function gf(e,t,n){return uf(e,t,`/jobs/${n}/stop`,{method:`POST`,action:`Stop job`})}async function _f(e,t,n){await uf(e,t,`/jobs/${n}`,{method:`DELETE`,action:`Delete job`})}var vf={authenticated:!1,username:null,flavors:[]};async function yf(e,t,n){try{return await uf(e,t,`/jobs/runners/hardware`,{signal:n,action:`List runner hardware`})}catch(e){if(e instanceof lf)return vf;throw e}}var bf={authenticated:!1,jobs:[],models:[]};async function xf(e,t,n){try{return await uf(e,t,`/jobs/hub`,{signal:n,action:`List hub jobs`})}catch(e){if(e instanceof lf)return bf;throw e}}var Sf=`lelab.selectedRobot`,Cf=3e3,wf={hasSelectedRobot:!1,robotIsClean:!1,hasLocalDataset:!1,hasTrainedModel:!1,isAuthenticated:!1};function Tf(e){let{baseUrl:t,fetchWithHeaders:n}=wl(),{auth:r}=Dl(),[i,a]=(0,_.useState)(wf),o=r.status===`authenticated`,s=(0,_.useCallback)(async()=>{let e=null;try{e=localStorage.getItem(Sf)}catch{}let[r,i,s]=await Promise.all([n(`${t}/robots`).then(e=>e.ok?e.json():null).catch(()=>null),dee(t,n).catch(()=>[]),ff(t,n,20).catch(()=>[])]),c=r?.robots??[],l=e?c.find(t=>t.name===e)??null:null;a({hasSelectedRobot:!!l,robotIsClean:!!l?.is_clean,hasLocalDataset:i.some(e=>e.source===`local`||e.source===`both`),hasTrainedModel:s.some(e=>e.checkpoint_count>0||e.state===`done`),isAuthenticated:o})},[t,n,o]),c=(0,_.useRef)(s);return c.current=s,(0,_.useEffect)(()=>{if(!e){a(wf);return}let t=!1,n=!1,r=async()=>{if(!(t||n||document.visibilityState===`hidden`)){n=!0;try{await c.current()}finally{n=!1}}};r();let i=setInterval(r,Cf),o=()=>{document.visibilityState===`visible`&&r()};return document.addEventListener(`visibilitychange`,o),()=>{t=!0,clearInterval(i),document.removeEventListener(`visibilitychange`,o)}},[e]),i}var Ef=()=>typeof window<`u`&&window.location.hostname.endsWith(`.hf.space`),Df=8,Of=12,kf=340,Af=(e,t,n)=>Math.max(t,Math.min(n,e)),jf=({rect:e})=>{let{currentStep:t,stepIndex:n,totalSteps:r,currentComplete:i,currentGated:a,next:o,back:s,skipStep:c,stop:l}=Uf(),u=(0,_.useRef)(null),[d,f]=(0,_.useState)({w:kf,h:0});if((0,_.useLayoutEffect)(()=>{if(u.current){let e=u.current.getBoundingClientRect();f({w:e.width,h:e.height})}},[t?.id,e]),(0,_.useEffect)(()=>{u.current?.focus()},[]),!t)return null;let p=t.placement??`bottom`,m=!e||p===`center`,h=n>=r-1,g=n<=0,v;if(m)v={top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`};else{let t=window.innerWidth,n=window.innerHeight,r=0,i=0;switch(p){case`top`:r=e.top-d.h-Of,i=e.left+e.width/2-d.w/2;break;case`left`:i=e.left-d.w-Of,r=e.top+e.height/2-d.h/2;break;case`right`:i=e.right+Of,r=e.top+e.height/2-d.h/2;break;default:r=e.bottom+Of,i=e.left+e.width/2-d.w/2;break}p===`bottom`&&r+d.h>n-Df&&(r=e.top-d.h-Of),p===`top`&&rt-Df&&(i=e.left-d.w-Of),p===`left`&&il(!1),"aria-label":`Exit tour`,className:`absolute right-2 top-2 rounded p-1 text-gray-400 hover:bg-gray-800 hover:text-white`,children:(0,B.jsx)(nc,{className:`h-4 w-4`})}),(0,B.jsxs)(`div`,{className:`p-4 pt-5`,children:[(0,B.jsxs)(`div`,{className:`mb-1 flex items-center gap-2`,children:[(0,B.jsxs)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-blue-400`,children:[`Step `,n+1,` of `,r]}),i&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-green-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-green-400`,children:[(0,B.jsx)(ls,{className:`h-3 w-3`}),`Done`]})]}),(0,B.jsx)(`h3`,{className:`pr-6 text-base font-semibold text-white`,children:t.title}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-gray-300`,children:t.body}),a&&!i&&(0,B.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-amber-400`,children:[(0,B.jsx)(Ps,{className:`h-3 w-3 shrink-0`}),`Finish the earlier step to unlock this, or continue with Next whenever you like.`]}),(0,B.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2`,children:[(0,B.jsx)(q,{variant:`ghost`,size:`sm`,onClick:s,disabled:g,className:`text-gray-400 hover:text-white disabled:opacity-40`,children:`Back`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t.optional&&!h&&(0,B.jsx)(q,{variant:`ghost`,size:`sm`,onClick:c,className:`text-gray-400 hover:text-white`,children:`Skip`}),(0,B.jsx)(q,{size:`sm`,onClick:o,className:K(`text-white`,i?`bg-green-600 hover:bg-green-700`:`bg-blue-600 hover:bg-blue-700`),children:h?`Finish`:i?`Continue`:`Next`})]})]})]})]})},Mf=8,Nf=3e3,Pf=()=>{let{isActive:e,currentStep:t,stop:n}=Uf(),r=ft(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=t?.id??null,l=t?.target??null;if((0,_.useLayoutEffect)(()=>{if(s(!1),a(null),!e||!c)return;if(!l){s(!0);return}let t=0,n=null,r=null,i=performance.now(),o=()=>{if(r){if(!r.isConnected){a(null);return}a(r.getBoundingClientRect())}},u=e=>{r=e,e.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`}),o(),s(!0),window.addEventListener(`scroll`,o,!0),window.addEventListener(`resize`,o),n=new ResizeObserver(o),n.observe(e)},d=()=>{let e=document.querySelector(`[data-tour="${l}"]`);if(e){u(e);return}if(performance.now()-i>Nf){a(null),s(!0);return}t=requestAnimationFrame(d)};return d(),()=>{t&&cancelAnimationFrame(t),window.removeEventListener(`scroll`,o,!0),window.removeEventListener(`resize`,o),n?.disconnect()}},[e,c,l,r.pathname]),(0,_.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n]),!e||!t||!o)return null;let u=!!i&&i.width>0&&i.height>0;return(0,v.createPortal)((0,B.jsxs)(`div`,{className:`pointer-events-none fixed inset-0 z-40`,children:[u?(0,B.jsx)(`div`,{className:`pointer-events-none absolute rounded-lg ring-2 ring-blue-400/80 transition-all duration-200`,style:{top:i.top-Mf,left:i.left-Mf,width:i.width+Mf*2,height:i.height+Mf*2,boxShadow:`0 0 0 9999px rgba(0,0,0,0.6)`}}):(0,B.jsx)(`div`,{className:`absolute inset-0 bg-black/60`}),(0,B.jsx)(jf,{rect:u?i:null},t.id)]}),document.body)},Ff=[`Calibrate`,`Record`,`Train`,`Run`],If=({open:e,onStart:t,onDismiss:n})=>(0,B.jsx)($d,{open:e,onOpenChange:e=>e?void 0:n(),children:(0,B.jsxs)(nf,{className:`bg-gray-900 border-gray-700 text-gray-300 sm:max-w-lg`,children:[(0,B.jsxs)(rf,{className:`text-center sm:text-center`,children:[(0,B.jsxs)(of,{className:`flex items-center justify-center gap-2 text-xl text-white`,children:[(0,B.jsx)(Ss,{className:`h-6 w-6 text-blue-400`}),`Welcome to LeLab`]}),(0,B.jsx)(sf,{children:`New to teaching a robot arm? A two-minute guided tour walks you through the whole loop, no jargon required.`})]}),(0,B.jsx)(`div`,{className:`py-2`,children:(0,B.jsx)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-gray-400`,children:Ff.map((e,t)=>(0,B.jsxs)(_.Fragment,{children:[(0,B.jsx)(`span`,{className:`rounded-md bg-gray-800 px-2.5 py-1 font-medium text-gray-200`,children:e}),t{try{let e=localStorage.getItem(Lf);return e===`dismissed`||e===`completed`?e:null}catch{return null}},Bf=e=>{try{localStorage.setItem(Lf,e)}catch{}},Vf=(0,_.createContext)(null),Hf=({children:e})=>{let t=ht(),n=ft(),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(()=>zf()!==null),[l,u]=(0,_.useState)(!1),d=Tf(r),f=(0,_.useMemo)(()=>cf.filter(e=>e.id===a||!e.show||e.show(d)),[d,a]),p=a?f.findIndex(e=>e.id===a):-1,m=r&&p>=0?f[p]:null,h=m?.isComplete?m.isComplete(d):!1,g=m?.gate?!m.gate(d):!1,v=(0,_.useCallback)(e=>{i(!1),o(null),Bf(e?`completed`:`dismissed`),c(!0)},[]),y=(0,_.useCallback)(()=>{u(!1),o(cf[0]?.id??null),i(!0)},[]),b=(0,_.useCallback)(()=>{u(!1),Bf(`dismissed`),c(!0)},[]);(0,_.useEffect)(()=>{zf()===null&&!Ef()&&u(!0)},[]);let x=(0,_.useCallback)(()=>{let e=f.findIndex(e=>e.id===a);if(!(e<0)){if(e>=f.length-1){v(!0);return}o(f[e+1].id)}},[f,a,v]),S=(0,_.useCallback)(()=>{let e=f.findIndex(e=>e.id===a);e>0&&o(f[e-1].id)},[f,a]),C=x,w=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!r||!m){w.current=null;return}if(w.current!==m.id&&(w.current=m.id,n.pathname!==m.route)){if(m.route===`/calibration`){let e=null;try{e=localStorage.getItem(`lelab.selectedRobot`)}catch{}t(`/calibration`,e?{state:{robot_name:e}}:void 0);return}t(m.route)}},[r,m,n.pathname,t]);let T=(0,_.useRef)({id:null,done:!1});(0,_.useEffect)(()=>{if(!(!r||!m)){if(T.current.id!==m.id){T.current={id:m.id,done:h};return}if(!T.current.done&&h){T.current.done=!0;let e=setTimeout(()=>x(),Rf);return()=>clearTimeout(e)}}},[r,m,h,x]);let E=(0,_.useMemo)(()=>({isActive:r,currentStep:m,stepIndex:p,totalSteps:f.length,currentComplete:h,currentGated:g,hasSeen:s,start:y,next:x,back:S,skipStep:C,stop:v}),[r,m,p,f.length,h,g,s,y,x,S,C,v]);return(0,B.jsxs)(Vf.Provider,{value:E,children:[e,(0,B.jsx)(If,{open:l,onStart:y,onDismiss:b}),(0,B.jsx)(Pf,{}),(0,B.jsx)(Wf,{variant:`floating`})]})},Uf=()=>{let e=(0,_.useContext)(Vf);if(!e)throw Error(`useOnboarding must be used within an OnboardingProvider`);return e},Wf=({variant:e=`inline`,className:t})=>{let{start:n,isActive:r}=Uf();return e===`floating`&&r?null:e===`floating`?(0,B.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Start the guided tour`,title:`Guided tour`,className:K(`fixed bottom-4 right-4 z-30 flex h-11 w-11 items-center justify-center`,`rounded-full border border-gray-700 bg-gray-900 text-gray-300 shadow-lg`,`transition-colors hover:bg-gray-800 hover:text-white`,t),children:(0,B.jsx)(vs,{className:`h-5 w-5`})}):(0,B.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":`Start the guided tour`,className:K(`flex items-center gap-1.5 rounded-md border border-gray-700 px-2.5 py-1.5`,`text-xs font-medium text-gray-300 transition-colors hover:bg-gray-800 hover:text-white`,t),children:[(0,B.jsx)(vs,{className:`h-4 w-4`}),`Tour`]})},Gf=()=>(0,B.jsx)(`header`,{className:`sticky top-0 z-30 w-full border-b border-gray-800 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70`,children:(0,B.jsxs)(`div`,{className:`mx-auto flex h-12 max-w-7xl items-center justify-between px-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab`,className:`h-7 w-7`}),(0,B.jsx)(`span`,{className:`text-base font-semibold tracking-tight text-white`,children:`LeLab`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Wf,{variant:`inline`}),(0,B.jsx)(uee,{})]})]})}),Kf=[{href:`https://github.com/huggingface/lerobot`,label:`GitHub`,Icon:js},{href:`https://huggingface.co/docs/lerobot`,label:`Documentation`,Icon:ss},{href:`https://discord.com/invite/s3KuuzsPFb`,label:`Discord`,Icon:({className:e})=>(0,B.jsx)(`svg`,{role:`img`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,className:e,children:(0,B.jsx)(`path`,{d:`M20.317 4.369A19.79 19.79 0 0 0 16.558 3.2a.07.07 0 0 0-.074.035c-.211.375-.444.864-.608 1.249a18.27 18.27 0 0 0-5.487 0 12.51 12.51 0 0 0-.617-1.249.077.077 0 0 0-.074-.035 19.736 19.736 0 0 0-3.76 1.169.07.07 0 0 0-.032.027C2.533 8.046 1.79 11.624 2.155 15.157a.082.082 0 0 0 .031.056 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.027c.462-.63.873-1.295 1.226-1.994a.076.076 0 0 0-.041-.105 13.13 13.13 0 0 1-1.873-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.291a.074.074 0 0 1 .077-.01c3.927 1.793 8.18 1.793 12.061 0a.074.074 0 0 1 .078.009c.12.099.246.198.373.292a.077.077 0 0 1-.006.128 12.32 12.32 0 0 1-1.873.891.077.077 0 0 0-.04.106c.36.698.772 1.363 1.225 1.993a.076.076 0 0 0 .084.028 19.84 19.84 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-4.087-.838-7.636-3.548-10.787a.061.061 0 0 0-.031-.028zM8.02 12.997c-1.182 0-2.156-1.085-2.156-2.419 0-1.333.955-2.419 2.156-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.955 2.418-2.156 2.418zm7.974 0c-1.182 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.946 2.418-2.156 2.418z`})})}],qf=()=>(0,B.jsx)(`footer`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-gray-800 bg-black/95`,children:(0,B.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col items-center justify-between gap-3 px-4 py-4 text-sm text-gray-400 sm:flex-row`,children:[(0,B.jsxs)(`span`,{children:[`Powered by`,` `,(0,B.jsx)(`a`,{href:`https://github.com/huggingface/lerobot`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-gray-200 hover:text-white`,children:`LeRobot`})]}),(0,B.jsx)(`nav`,{className:`flex items-center gap-4`,children:Kf.map(({href:e,label:t,Icon:n})=>(0,B.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 text-gray-400 hover:text-white`,children:[(0,B.jsx)(n,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{children:t})]},t))})]})}),Jf=[`top`,`right`,`bottom`,`left`],Yf=Math.min,Xf=Math.max,Zf=Math.round,Qf=Math.floor,$f=e=>({x:e,y:e}),ep={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function tp(e,t,n){return Xf(e,Yf(t,n))}function np(e,t){return typeof e==`function`?e(t):e}function rp(e){return e.split(`-`)[0]}function ip(e){return e.split(`-`)[1]}function ap(e){return e===`x`?`y`:`x`}function op(e){return e===`y`?`height`:`width`}function sp(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function cp(e){return ap(sp(e))}function lp(e,t,n){n===void 0&&(n=!1);let r=ip(e),i=cp(e),a=op(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=vp(o)),[o,vp(o)]}function up(e){let t=vp(e);return[dp(e),t,dp(t)]}function dp(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var fp=[`left`,`right`],pp=[`right`,`left`],mp=[`top`,`bottom`],hp=[`bottom`,`top`];function gp(e,t,n){switch(e){case`top`:case`bottom`:return n?t?pp:fp:t?fp:pp;case`left`:case`right`:return t?mp:hp;default:return[]}}function _p(e,t,n,r){let i=ip(e),a=gp(rp(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(dp)))),a}function vp(e){let t=rp(e);return ep[t]+e.slice(t.length)}function yp(e){return{top:0,right:0,bottom:0,left:0,...e}}function bp(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:yp(e)}function xp(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Sp(e,t,n){let{reference:r,floating:i}=e,a=sp(t),o=cp(t),s=op(o),c=rp(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ip(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Cp(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=np(t,e),p=bp(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=xp(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=xp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var wp=50,Tp=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Cp},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Sp(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=np(e,t)||{};if(l==null)return{};let d=bp(u),f={x:n,y:r},p=cp(i),m=op(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Yf(d[_],T),D=Yf(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=tp(O,A,k),M=!c.arrow&&ip(i)!=null&&A!==j&&a.reference[m]/2-(Ae<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==sp(t))||T.every(e=>sp(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=sp(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Op(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kp(e){return Jf.some(t=>e[t]>=0)}var Ap=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=np(e,t);switch(i){case`referenceHidden`:{let e=Op(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:kp(e)}}}case`escaped`:{let e=Op(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:kp(e)}}}default:return{}}}}},jp=new Set([`left`,`top`]);async function Mp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=rp(n),s=ip(n),c=sp(n)===`y`,l=jp.has(o)?-1:1,u=a&&c?-1:1,d=np(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Np=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Mp(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Pp=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=np(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=sp(rp(i)),p=ap(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=tp(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=tp(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Fp=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=np(e,t),u={x:n,y:r},d=sp(i),f=ap(d),p=u[f],m=u[d],h=np(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=jp.has(rp(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},Ip=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=np(e,t),u=await o.detectOverflow(t,l),d=rp(i),f=ip(i),p=sp(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Yf(h-u[g],v),x=Yf(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Xf(u.left,0),t=Xf(u.right,0),n=Xf(u.top,0),r=Xf(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Xf(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Xf(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Lp(){return typeof window<`u`}function Rp(e){return Vp(e)?(e.nodeName||``).toLowerCase():`#document`}function zp(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Bp(e){return((Vp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Vp(e){return Lp()?e instanceof Node||e instanceof zp(e).Node:!1}function Hp(e){return Lp()?e instanceof Element||e instanceof zp(e).Element:!1}function Up(e){return Lp()?e instanceof HTMLElement||e instanceof zp(e).HTMLElement:!1}function Wp(e){return!Lp()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof zp(e).ShadowRoot}function Gp(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=nm(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Kp(e){return/^(table|td|th)$/.test(Rp(e))}function qp(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Jp=/transform|translate|scale|rotate|perspective|filter/,Yp=/paint|layout|strict|content/,Xp=e=>!!e&&e!==`none`,Zp;function Qp(e){let t=Hp(e)?nm(e):e;return Xp(t.transform)||Xp(t.translate)||Xp(t.scale)||Xp(t.rotate)||Xp(t.perspective)||!em()&&(Xp(t.backdropFilter)||Xp(t.filter))||Jp.test(t.willChange||``)||Yp.test(t.contain||``)}function $p(e){let t=im(e);for(;Up(t)&&!tm(t);){if(Qp(t))return t;if(qp(t))return null;t=im(t)}return null}function em(){return Zp??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Zp}function tm(e){return/^(html|body|#document)$/.test(Rp(e))}function nm(e){return zp(e).getComputedStyle(e)}function rm(e){return Hp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function im(e){if(Rp(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Wp(e)&&e.host||Bp(e);return Wp(t)?t.host:t}function am(e){let t=im(e);return tm(t)?e.ownerDocument?e.ownerDocument.body:e.body:Up(t)&&Gp(t)?t:am(t)}function om(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=am(e),i=r===e.ownerDocument?.body,a=zp(r);if(i){let e=sm(a);return t.concat(a,a.visualViewport||[],Gp(r)?r:[],e&&n?om(e):[])}else return t.concat(r,om(r,[],n))}function sm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cm(e){let t=nm(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Up(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Zf(n)!==a||Zf(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function lm(e){return Hp(e)?e:e.contextElement}function um(e){let t=lm(e);if(!Up(t))return $f(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=cm(t),o=(a?Zf(n.width):n.width)/r,s=(a?Zf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var dm=$f(0);function fm(e){let t=zp(e);return!em()||!t.visualViewport?dm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==zp(e)?!1:t}function mm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=lm(e),o=$f(1);t&&(r?Hp(r)&&(o=um(r)):o=um(e));let s=pm(a,n,r)?fm(a):$f(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=zp(a),t=r&&Hp(r)?zp(r):r,n=e,i=sm(n);for(;i&&r&&t!==n;){let e=um(i),t=i.getBoundingClientRect(),r=nm(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=zp(i),i=sm(n)}}return xp({width:u,height:d,x:c,y:l})}function hm(e,t){let n=rm(e).scrollLeft;return t?t.left+n:mm(Bp(e)).left+n}function gm(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-hm(e,n),y:n.top+t.scrollTop}}function hee(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Bp(r),s=t?qp(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=$f(1),u=$f(0),d=Up(r);if((d||!d&&!a)&&((Rp(r)!==`body`||Gp(o))&&(c=rm(r)),d)){let e=mm(r);l=um(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?gm(o,c):$f(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function gee(e){return Array.from(e.getClientRects())}function _ee(e){let t=Bp(e),n=rm(e),r=e.ownerDocument.body,i=Xf(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Xf(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+hm(e),s=-n.scrollTop;return nm(r).direction===`rtl`&&(o+=Xf(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var _m=25;function vee(e,t){let n=zp(e),r=Bp(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=em();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=hm(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=_m&&(a-=o)}else l<=_m&&(a+=l);return{width:a,height:o,x:s,y:c}}function yee(e,t){let n=mm(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Up(e)?um(e):$f(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function vm(e,t,n){let r;if(t===`viewport`)r=vee(e,n);else if(t===`document`)r=_ee(Bp(e));else if(Hp(t))r=yee(t,n);else{let n=fm(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return xp(r)}function ym(e,t){let n=im(e);return n===t||!Hp(n)||tm(n)?!1:nm(n).position===`fixed`||ym(n,t)}function bee(e,t){let n=t.get(e);if(n)return n;let r=om(e,[],!1).filter(e=>Hp(e)&&Rp(e)!==`body`),i=null,a=nm(e).position===`fixed`,o=a?im(e):e;for(;Hp(o)&&!tm(o);){let t=nm(o),n=Qp(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Gp(o)&&!n&&ym(e,o))?r=r.filter(e=>e!==o):i=t,o=im(o)}return t.set(e,r),r}function xee(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?qp(t)?[]:bee(t,this._c):[].concat(n),r],o=vm(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{o(!1,1e-7)},1e3)}n===1&&!Cm(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Oee(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=lm(e),u=i||a?[...l?om(l):[],...t?om(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Dee(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?mm(e):null;c&&g();function g(){let t=mm(e);h&&!Cm(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var kee=Np,Aee=Pp,jee=Dp,Mee=Ip,Nee=Ap,wm=Ep,Pee=Fp,Fee=(e,t,n)=>{let r=new Map,i={platform:Eee,...n},a={...i.platform,_c:r};return Tp(e,t,{...i,platform:a})},Tm=typeof document<`u`?_.useLayoutEffect:function(){};function Em(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Em(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Em(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Dm(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Om(e,t){let n=Dm(e);return Math.round(t*n)/n}function km(e){let t=_.useRef(e);return Tm(()=>{t.current=e}),t}function Iee(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);Em(f,r)||p(r);let[m,h]=_.useState(null),[g,y]=_.useState(null),b=_.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=_.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||m,C=o||g,w=_.useRef(null),T=_.useRef(null),E=_.useRef(u),D=c!=null,O=km(c),k=km(i),A=km(l),j=_.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),Fee(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Em(E.current,t)&&(E.current=t,v.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Tm(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=_.useRef(!1);Tm(()=>(M.current=!0,()=>{M.current=!1}),[]),Tm(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=_.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=_.useMemo(()=>({reference:S,floating:C}),[S,C]),F=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Om(P.floating,u.x),r=Om(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Dm(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Lee=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:wm({element:r.current,padding:i}).fn(n):r?wm({element:r,padding:i}).fn(n):{}}}},Ree=(e,t)=>{let n=kee(e);return{name:n.name,fn:n.fn,options:[e,t]}},zee=(e,t)=>{let n=Aee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bee=(e,t)=>({fn:Pee(e).fn,options:[e,t]}),Vee=(e,t)=>{let n=jee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hee=(e,t)=>{let n=Mee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Uee=(e,t)=>{let n=Nee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wee=(e,t)=>{let n=Lee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gee=`Arrow`,Am=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,B.jsx)(H.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,B.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Am.displayName=Gee;var Kee=Am;function jm(e){let[t,n]=_.useState(void 0);return Ra(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Mm=`Popper`,[Nm,Pm]=aa(Mm),[qee,Fm]=Nm(Mm),Im=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return(0,B.jsx)(qee,{scope:t,anchor:r,onAnchorChange:i,children:n})};Im.displayName=Mm;var Lm=`PopperAnchor`,Rm=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Fm(Lm,n),o=_.useRef(null),s=ra(t,o),c=_.useRef(null);return _.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,B.jsx)(H.div,{...i,ref:s})});Rm.displayName=Lm;var zm=`PopperContent`,[Jee,Yee]=Nm(zm),Bm=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Fm(zm,n),[v,y]=_.useState(null),b=ra(t,e=>y(e)),[x,S]=_.useState(null),C=jm(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Zee),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Iee({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Oee(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Ree({mainAxis:i+T,alignmentAxis:o}),c&&zee({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Bee():void 0,...A}),c&&Vee({...A}),Hee({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Wee({element:x,padding:s}),Qee({arrowWidth:w,arrowHeight:T}),f&&Uee({strategy:`referenceHidden`,...A})]}),[ee,te]=Um(N),ne=xa(m);Ra(()=>{P&&ne?.()},[P,ne]);let re=F.arrow?.x,ie=F.arrow?.y,ae=F.arrow?.centerOffset!==0,[oe,se]=_.useState();return Ra(()=>{v&&se(window.getComputedStyle(v).zIndex)},[v]),(0,B.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,B.jsx)(Jee,{scope:n,placedSide:ee,onArrowChange:S,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,B.jsx)(H.div,{"data-side":ee,"data-align":te,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});Bm.displayName=zm;var Vm=`PopperArrow`,Xee={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Hm=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Yee(Vm,n),a=Xee[i.placedSide];return(0,B.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,B.jsx)(Kee,{...r,ref:t,style:{...r.style,display:`block`}})})});Hm.displayName=Vm;function Zee(e){return e!==null}var Qee=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Um(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Um(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Wm=Im,Gm=Rm,Km=Bm,qm=Hm,Jm=Symbol(`radix.slottable`);function Ym(e){let t=({children:e})=>(0,B.jsx)(B.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=Jm,t}var[Xm,$ee]=aa(`Tooltip`,[Pm]),Zm=Pm(),Qm=`TooltipProvider`,$m=700,eh=`tooltip.open`,[th,nh]=Xm(Qm),rh=e=>{let{__scopeTooltip:t,delayDuration:n=$m,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=_.useRef(!0),s=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(th,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:_.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};rh.displayName=Qm;var ih=`Tooltip`,[ah,oh]=Xm(ih),sh=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=nh(ih,e.__scopeTooltip),l=Zm(t),[u,d]=_.useState(null),f=Al(),p=_.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=_.useRef(!1),[v,y]=qa({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(eh))):c.onClose(),a?.(e)},caller:ih}),b=_.useMemo(()=>v?g.current?`delayed-open`:`instant-open`:`closed`,[v]),x=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=_.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return _.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(Wm,{...l,children:(0,B.jsx)(ah,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:_.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};sh.displayName=ih;var ch=`TooltipTrigger`,lh=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=oh(ch,n),a=nh(ch,n),o=Zm(n),s=ra(t,_.useRef(null),i.onTriggerChange),c=_.useRef(!1),l=_.useRef(!1),u=_.useCallback(()=>c.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(Gm,{asChild:!0,...o,children:(0,B.jsx)(H.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:V(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:V(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:V(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:V(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:V(e.onBlur,i.onClose),onClick:V(e.onClick,i.onClose)})})});lh.displayName=ch;var uh=`TooltipPortal`,[dh,fh]=Xm(uh,{forceMount:void 0}),ph=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=oh(uh,t);return(0,B.jsx)(dh,{scope:t,forceMount:n,children:(0,B.jsx)(Ha,{present:n||a.open,children:(0,B.jsx)(Ba,{asChild:!0,container:i,children:r})})})};ph.displayName=uh;var mh=`TooltipContent`,hh=_.forwardRef((e,t)=>{let n=fh(mh,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=oh(mh,e.__scopeTooltip);return(0,B.jsx)(Ha,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(bh,{side:i,...a,ref:t}):(0,B.jsx)(gh,{side:i,...a,ref:t})})}),gh=_.forwardRef((e,t)=>{let n=oh(mh,e.__scopeTooltip),r=nh(mh,e.__scopeTooltip),i=_.useRef(null),a=ra(t,i),[o,s]=_.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=_.useCallback(()=>{s(null),d(!1)},[d]),p=_.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=wh(r,Ch(r,n.getBoundingClientRect())),a=Th(t.getBoundingClientRect());s(Dh([...i,...a])),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),_.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Eh(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(bh,{...e,ref:a})}),[_h,vh]=Xm(ih,{isInside:!1}),yh=Ym(`TooltipContent`),bh=_.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=oh(mh,n),l=Zm(n),{onClose:u}=c;return _.useEffect(()=>(document.addEventListener(eh,u),()=>document.removeEventListener(eh,u)),[u]),_.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(ka,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(Km,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(yh,{children:r}),(0,B.jsx)(_h,{scope:n,isInside:!0,children:(0,B.jsx)($a,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});hh.displayName=mh;var xh=`TooltipArrow`,Sh=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Zm(n);return vh(xh,n).isInside?null:(0,B.jsx)(qm,{...i,...r,ref:t})});Sh.displayName=xh;function Ch(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function wh(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Th(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Eh(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Dh(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y)),Oh(t)}function Oh(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var kh=sh,Ah=lh,jh=hh,Mh=kh,Nh=Ah,Ph=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,B.jsx)(jh,{ref:r,sideOffset:t,className:K(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));Ph.displayName=jh.displayName;function ete(e){let t=tte(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Ih);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function tte(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Rh(n),i=Lh(r,n.props);return n.type!==_.Fragment&&(i.ref=t?na(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Fh=Symbol(`radix.slottable`);function Ih(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Fh}function Lh(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Rh(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var zh=`Popover`,[Bh,nte]=aa(zh,[Pm]),Vh=Pm(),[Hh,Uh]=Bh(zh),Wh=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Vh(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=qa({prop:r,defaultProp:i??!1,onChange:a,caller:zh});return(0,B.jsx)(Wm,{...s,children:(0,B.jsx)(Hh,{scope:t,contentId:Al(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};Wh.displayName=zh;var Gh=`PopoverAnchor`,Kh=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Uh(Gh,n),a=Vh(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,B.jsx)(Gm,{...a,...r,ref:t})});Kh.displayName=Gh;var qh=`PopoverTrigger`,Jh=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Uh(qh,n),a=Vh(n),o=ra(t,i.triggerRef),s=(0,B.jsx)(H.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":lg(i.open),...r,ref:o,onClick:V(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,B.jsx)(Gm,{asChild:!0,...a,children:s})});Jh.displayName=qh;var Yh=`PopoverPortal`,[Xh,Zh]=Bh(Yh,{forceMount:void 0}),Qh=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Uh(Yh,t);return(0,B.jsx)(Xh,{scope:t,forceMount:n,children:(0,B.jsx)(Ha,{present:n||a.open,children:(0,B.jsx)(Ba,{asChild:!0,container:i,children:r})})})};Qh.displayName=Yh;var $h=`PopoverContent`,eg=_.forwardRef((e,t)=>{let n=Zh($h,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Uh($h,e.__scopePopover);return(0,B.jsx)(Ha,{present:r||a.open,children:a.modal?(0,B.jsx)(ng,{...i,ref:t}):(0,B.jsx)(rg,{...i,ref:t})})});eg.displayName=$h;var tg=ete(`PopoverContent.RemoveScroll`),ng=_.forwardRef((e,t)=>{let n=Uh($h,e.__scopePopover),r=_.useRef(null),i=ra(t,r),a=_.useRef(!1);return _.useEffect(()=>{let e=r.current;if(e)return fd(e)},[]),(0,B.jsx)(id,{as:tg,allowPinchZoom:!0,children:(0,B.jsx)(ig,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:V(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),rg=_.forwardRef((e,t)=>{let n=Uh($h,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,B.jsx)(ig,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),ig=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Uh($h,n),p=Vh(n);return Jl(),(0,B.jsx)(Fl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(ka,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,B.jsx)(Km,{"data-state":lg(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),ag=`PopoverClose`,og=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Uh(ag,n);return(0,B.jsx)(H.button,{type:`button`,...r,ref:t,onClick:V(e.onClick,()=>i.onOpenChange(!1))})});og.displayName=ag;var sg=`PopoverArrow`,cg=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Vh(n);return(0,B.jsx)(qm,{...i,...r,ref:t})});cg.displayName=sg;function lg(e){return e?`open`:`closed`}var ug=Wh,dg=Jh,fg=Qh,pg=eg,mg=ug,hg=dg,gg=_.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,B.jsx)(fg,{children:(0,B.jsx)(pg,{ref:i,align:t,sideOffset:n,className:K(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));gg.displayName=pg.displayName;var _g=1,rte=.9,ite=.8,ate=.17,vg=.1,yg=.999,bg=.9999,xg=.99,Sg=/[\\\/_+.#"@\[\(\{&]/,Cg=/[\\\/_+.#"@\[\(\{&]/g,wg=/[\s-]/,Tg=/[\s-]/g;function Eg(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?_g:xg;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Eg(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=_g:Sg.test(e.charAt(l-1))?(d*=ite,p=e.slice(i,l-1).match(Cg),p&&i>0&&(d*=yg**+p.length)):wg.test(e.charAt(l-1))?(d*=rte,m=e.slice(i,l-1).match(Tg),m&&i>0&&(d*=yg**+m.length)):(d*=ate,i>0&&(d*=yg**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=bg)),(dd&&(d=f*vg)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Dg(e){return e.toLowerCase().replace(Tg,` `)}function Og(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Eg(e,t,Dg(e),Dg(t),0,0,{})}var kg=`[cmdk-group=""]`,Ag=`[cmdk-group-items=""]`,jg=`[cmdk-group-heading=""]`,Mg=`[cmdk-item=""]`,Ng=`${Mg}:not([aria-disabled="true"])`,Pg=`cmdk-item-select`,Fg=`data-value`,Ig=(e,t,n)=>Og(e,t,n),Lg=_.createContext(void 0),Rg=()=>_.useContext(Lg),zg=_.createContext(void 0),Bg=()=>_.useContext(zg),Vg=_.createContext(void 0),Hg=_.forwardRef((e,t)=>{let n=n_(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=n_(()=>new Set),i=n_(()=>new Map),a=n_(()=>new Map),o=n_(()=>new Set),s=e_(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,...v}=e,y=Al(),b=Al(),x=Al(),S=_.useRef(null),C=a_();t_(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),t_(()=>{C(6,A)},[]);let w=_.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=_.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??Ig;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Ag);t?t.appendChild(e.parentElement===t?e:e.closest(`${Ag} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Ag} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${kg}[${Fg}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Fg);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(kg)?.querySelector(jg))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${Mg}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(Ng)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(Fg))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(Fg))}function F(e){let t=j()?.closest(kg),n;for(;t&&!n;)t=e>0?Qg(t,kg):$g(t,kg),n=t?.querySelector(Ng);n?w.setState(`value`,n.getAttribute(Fg)):P(e)}let ee=()=>N(M().length-1),te=e=>{e.preventDefault(),e.metaKey?ee():e.altKey?F(1):P(1)},ne=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return _.createElement(H.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&te(e);break;case`ArrowDown`:te(e);break;case`p`:case`k`:g&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),ee();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(Pg);t.dispatchEvent(e)}}}}},_.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:c_},c),s_(e,e=>_.createElement(zg.Provider,{value:w},_.createElement(Lg.Provider,{value:T},e))))}),Ug=_.forwardRef((e,t)=>{let n=Al(),r=_.useRef(null),i=_.useContext(Vg),a=Rg(),o=e_(e),s=o.current?.forceMount??i?.forceMount;t_(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=i_(n,r,[e.value,e.children,r],e.keywords),l=Bg(),u=r_(e=>e.value&&e.value===c.current),d=r_(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);_.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Pg,f),()=>t.removeEventListener(Pg,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:v,keywords:y,...b}=e;return _.createElement(H.div,{ref:na(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Wg=_.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Al(),s=_.useRef(null),c=_.useRef(null),l=Al(),u=Rg(),d=r_(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);t_(()=>u.group(o),[]),i_(o,s,[e.value,e.heading,c]);let f=_.useMemo(()=>({id:o,forceMount:i}),[i]);return _.createElement(H.div,{ref:na(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&_.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),s_(e,e=>_.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},_.createElement(Vg.Provider,{value:f},e))))}),Gg=_.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=_.useRef(null),a=r_(e=>!e.search);return!n&&!a?null:_.createElement(H.div,{ref:na(i,t),...r,"cmdk-separator":``,role:`separator`})}),Kg=_.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Bg(),o=r_(e=>e.search),s=r_(e=>e.selectedItemId),c=Rg();return _.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),_.createElement(H.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),qg=_.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=_.useRef(null),o=_.useRef(null),s=r_(e=>e.selectedItemId),c=Rg();return _.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),_.createElement(H.div,{ref:na(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},s_(e,e=>_.createElement(`div`,{ref:na(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Jg=_.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return _.createElement(Gd,{open:n,onOpenChange:r},_.createElement(qd,{container:o},_.createElement(Jd,{"cmdk-overlay":``,className:i}),_.createElement(Yd,{"aria-label":e.label,"cmdk-dialog":``,className:a},_.createElement(Hg,{ref:t,...s}))))}),Yg=_.forwardRef((e,t)=>r_(e=>e.filtered.count===0)?_.createElement(H.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Xg=_.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return _.createElement(H.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},s_(e,e=>_.createElement(`div`,{"aria-hidden":!0},e)))}),Zg=Object.assign(Hg,{List:qg,Item:Ug,Input:Kg,Group:Wg,Separator:Gg,Dialog:Jg,Empty:Yg,Loading:Xg});function Qg(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function $g(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function e_(e){let t=_.useRef(e);return t_(()=>{t.current=e}),t}var t_=typeof window>`u`?_.useEffect:_.useLayoutEffect;function n_(e){let t=_.useRef();return t.current===void 0&&(t.current=e()),t}function r_(e){let t=Bg(),n=()=>e(t.snapshot());return _.useSyncExternalStore(t.subscribe,n,n)}function i_(e,t,n,r=[]){let i=_.useRef(),a=Rg();return t_(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Fg,s),i.current=s}),i}var a_=()=>{let[e,t]=_.useState(),n=n_(()=>new Map);return t_(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function o_(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function s_({asChild:e,children:t},n){return e&&_.isValidElement(t)?_.cloneElement(o_(t),{ref:t.ref},n(t.props.children)):n(t)}var c_={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},l_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Zg,{ref:n,className:K(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));l_.displayName=Zg.displayName;var u_=_.forwardRef(({className:e,...t},n)=>(0,B.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,B.jsx)(Hs,{className:`mr-2 h-4 w-4 shrink-0 text-slate-400`}),(0,B.jsx)(Zg.Input,{ref:n,className:K(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));u_.displayName=Zg.Input.displayName;var d_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Zg.List,{ref:n,className:K(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));d_.displayName=Zg.List.displayName;var f_=_.forwardRef((e,t)=>(0,B.jsx)(Zg.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));f_.displayName=Zg.Empty.displayName;var p_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Zg.Group,{ref:n,className:K(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));p_.displayName=Zg.Group.displayName;var m_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Zg.Separator,{ref:n,className:K(`-mx-1 h-px bg-border`,e),...t}));m_.displayName=Zg.Separator.displayName;var h_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Zg.Item,{ref:n,className:K(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50`,e),...t}));h_.displayName=Zg.Item.displayName;var g_=({className:e,...t})=>(0,B.jsx)(`span`,{className:K(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});g_.displayName=`CommandShortcut`;var __=({selectedName:e,availableNames:t,onSelect:n,onCreateNew:r,isLoading:i})=>{let[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``),l=s.trim(),u=t.some(e=>e.toLowerCase()===l.toLowerCase()),d=l.length>0&&!u,f=!d,p=u?`Already exists`:l===``?`Create new robot…`:`Create "${l}"`,m=()=>{c(``),o(!1)},h=e=>{n(e),m()},g=async()=>{d&&await r(l)&&m()};return(0,B.jsxs)(mg,{open:a,onOpenChange:o,children:[(0,B.jsx)(hg,{asChild:!0,children:(0,B.jsxs)(q,{variant:`outline`,role:`combobox`,"aria-expanded":a,disabled:i,className:`w-full justify-between bg-gray-900 border-gray-700 text-white hover:bg-gray-700 hover:text-white font-normal`,children:[(0,B.jsx)(`span`,{className:K(`truncate`,e?``:`text-gray-400`),children:i?`Loading...`:e??`Select a robot or type a new name`}),(0,B.jsx)(ms,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,B.jsx)(gg,{className:`p-0 bg-gray-800 border-gray-700 text-white`,style:{width:`var(--radix-popover-trigger-width)`},align:`start`,children:(0,B.jsxs)(l_,{className:`bg-gray-800`,children:[(0,B.jsx)(u_,{placeholder:`Search or type new name...`,value:s,onValueChange:c,onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),g())},className:`text-white`}),(0,B.jsxs)(d_,{children:[t.length===0&&(0,B.jsx)(f_,{className:`py-4 text-sm text-gray-400 text-center`,children:`No robots yet. Type a name to create one.`}),t.length>0&&(0,B.jsx)(p_,{heading:`Existing`,children:t.map(t=>(0,B.jsxs)(h_,{value:t,onSelect:()=>h(t),className:`text-white aria-selected:bg-gray-700`,children:[(0,B.jsx)(ls,{className:K(`mr-2 h-4 w-4`,e===t?`opacity-100`:`opacity-0`)}),t]},t))})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:g,disabled:f,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,B.jsx)(Rs,{className:`h-4 w-4`}),p]})]})})]})},v_=({robot:e,selectedName:t,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:o,onTeleop:s,onDelete:c})=>{let[l,u]=(0,_.useState)(!1),d=e?e.is_clean?`Ready`:`Needs configuration`:null,f=!e||!e.is_clean;return(0,B.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2 relative`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`flex-1 min-w-0`,"data-tour":`robot-selector`,children:(0,B.jsx)(__,{selectedName:t,availableNames:n,onSelect:i,onCreateNew:a,isLoading:r})}),d&&(0,B.jsx)(`p`,{className:`text-xs truncate shrink-0 ${e.is_clean?`text-green-400`:`text-amber-400`}`,children:d}),e&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,B.jsxs)(Mh,{children:[(0,B.jsx)(Nh,{asChild:!0,children:(0,B.jsx)(q,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-gray-300 hover:text-white`,onClick:()=>o(e.name),"aria-label":`Configure`,"data-tour":`robot-configure`,children:(0,B.jsx)(Us,{className:`w-4 h-4`})})}),(0,B.jsx)(Ph,{children:`Configure (calibrate)`})]}),(0,B.jsxs)(Mh,{children:[(0,B.jsx)(Nh,{asChild:!0,children:(0,B.jsx)(q,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-900/20`,onClick:()=>u(!0),"aria-label":`Delete robot`,children:(0,B.jsx)(Xs,{className:`w-4 h-4`})})}),(0,B.jsx)(Ph,{children:`Delete robot config`})]})]})]}),e&&(0,B.jsxs)(Mh,{children:[(0,B.jsx)(Nh,{asChild:!0,children:(0,B.jsx)(`div`,{className:`w-full`,"data-tour":`robot-teleop`,children:(0,B.jsx)(q,{onClick:()=>s(e),disabled:f,className:`w-full ${f?`bg-red-500/30 hover:bg-red-500/30 text-red-200 cursor-not-allowed`:`bg-yellow-500 hover:bg-yellow-600 text-white`}`,children:`Teleoperation`})})}),f&&(0,B.jsx)(Ph,{children:`Configure the robot first.`})]}),e&&(0,B.jsx)($d,{open:l,onOpenChange:u,children:(0,B.jsxs)(nf,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,B.jsxs)(rf,{children:[(0,B.jsx)(of,{children:`Delete robot config?`}),(0,B.jsx)(sf,{className:`text-gray-400`,children:`This deletes the robot config file from disk. Calibration files are not removed. This cannot be undone.`})]}),(0,B.jsxs)(af,{className:`flex gap-2 justify-end`,children:[(0,B.jsx)(q,{variant:`outline`,className:`border-gray-600 text-gray-300`,onClick:()=>u(!1),children:`Cancel`}),(0,B.jsx)(q,{className:`bg-red-500 hover:bg-red-600 text-white`,onClick:async()=>{u(!1),await c(e.name)},children:`Delete`})]})]})})]})},y_=({selectedName:e,selectedRecord:t,availableNames:n,isLoading:r,selectRobot:i,createRobot:a,deleteRobot:o})=>{let s=ht(),{baseUrl:c,fetchWithHeaders:l}=wl(),{toast:u}=ea();return(0,B.jsx)(v_,{robot:t,selectedName:e,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:e=>{s(`/calibration`,{state:{robot_name:e}})},onTeleop:async e=>{try{let t=await l(`${c}/move-arm`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config})}),n=await t.json();t.ok&&n.success?(u({title:`Teleoperation Started`,description:n.message||`Started teleoperation for ${e.name}.`}),s(`/teleoperation`)):u({title:`Error Starting Teleoperation`,description:n.message||`Failed to start.`,variant:`destructive`})}catch{u({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},onDelete:o})},b_=_.forwardRef(({className:e,type:t,...n},r)=>(0,B.jsx)(`input`,{type:t,className:K(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:r,...n}));b_.displayName=`Input`;var x_=_.forwardRef(({value:e,onChange:t,integer:n=!0,className:r,...i},a)=>{let[o,s]=_.useState(e==null?``:String(e)),c=_.useRef(e);return _.useEffect(()=>{e!==c.current&&(c.current=e,s(e==null?``:String(e)))},[e]),(0,B.jsx)(b_,{ref:a,type:`number`,inputMode:n?`numeric`:`decimal`,value:o,onChange:e=>{let r=e.target.value;if(s(r),r===``){t(void 0);return}let i=n?parseInt(r,10):parseFloat(r);Number.isFinite(i)&&t(i)},className:K(`[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:m-0`,r),...i})});x_.displayName=`NumberInput`;var S_=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ul(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),C_=`Label`,w_=_.forwardRef((e,t)=>(0,B.jsx)(S_.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));w_.displayName=C_;var T_=w_,E_=es(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),J=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(T_,{ref:n,className:K(E_(),e),...t}));J.displayName=T_.displayName;function D_(e){let t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var O_=`Checkbox`,[k_,ote]=aa(O_),[ste,A_]=k_(O_);function cte(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=qa({prop:n,defaultProp:i??!1,onChange:c,caller:O_}),[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useRef(!1),b=m?!!o||!!m.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:R_(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:v};return(0,B.jsx)(ste,{scope:t,...x,children:lte(d)?d(x):r})}var j_=`CheckboxTrigger`,M_=_.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=A_(j_,e),h=ra(i,u),g=_.useRef(c);return _.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,B.jsx)(H.button,{type:`button`,role:`checkbox`,"aria-checked":R_(c)?`mixed`:c,"aria-required":l,"data-state":z_(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:V(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:V(n,e=>{d(e=>R_(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});M_.displayName=j_;var N_=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,B.jsx)(cte,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(M_,{...d,ref:t,__scopeCheckbox:n}),e&&(0,B.jsx)(L_,{__scopeCheckbox:n})]})})});N_.displayName=O_;var P_=`CheckboxIndicator`,F_=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=A_(P_,n);return(0,B.jsx)(Ha,{present:r||R_(a.checked)||a.checked===!0,children:(0,B.jsx)(H.span,{"data-state":z_(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});F_.displayName=P_;var I_=`CheckboxBubbleInput`,L_=_.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=A_(I_,e),m=ra(n,p),h=D_(a),g=jm(r);_.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=R_(a),n.call(e,R_(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let v=_.useRef(R_(a)?!1:a);return(0,B.jsx)(H.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});L_.displayName=I_;function lte(e){return typeof e==`function`}function R_(e){return e===`indeterminate`}function z_(e){return R_(e)?`indeterminate`:e?`checked`:`unchecked`}var B_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(N_,{ref:n,className:K(`peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,B.jsx)(F_,{className:K(`flex items-center justify-center text-current`),children:(0,B.jsx)(ls,{className:`h-4 w-4`})})}));B_.displayName=N_.displayName;var V_=`Collapsible`,[ute,dte]=aa(V_),[fte,H_]=ute(V_),U_=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=qa({prop:r,defaultProp:i??!1,onChange:o,caller:V_});return(0,B.jsx)(fte,{scope:n,disabled:a,contentId:Al(),open:c,onOpenToggle:_.useCallback(()=>l(e=>!e),[l]),children:(0,B.jsx)(H.div,{"data-state":J_(c),"data-disabled":a?``:void 0,...s,ref:t})})});U_.displayName=V_;var W_=`CollapsibleTrigger`,G_=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=H_(W_,n);return(0,B.jsx)(H.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":J_(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:V(e.onClick,i.onOpenToggle)})});G_.displayName=W_;var K_=`CollapsibleContent`,q_=_.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=H_(K_,e.__scopeCollapsible);return(0,B.jsx)(Ha,{present:n||i.open,children:({present:e})=>(0,B.jsx)(pte,{...r,ref:t,present:e})})});q_.displayName=K_;var pte=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=H_(K_,n),[s,c]=_.useState(r),l=_.useRef(null),u=ra(t,l),d=_.useRef(0),f=d.current,p=_.useRef(0),m=p.current,h=o.open||s,g=_.useRef(h),v=_.useRef(void 0);return _.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),Ra(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,B.jsx)(H.div,{"data-state":J_(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function J_(e){return e?`open`:`closed`}var Y_=U_,X_=G_,Z_=q_,mte=es(`relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground`,{variants:{variant:{default:`bg-background text-foreground`,destructive:`border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive`}},defaultVariants:{variant:`default`}}),Q_=_.forwardRef(({className:e,variant:t,...n},r)=>(0,B.jsx)(`div`,{ref:r,role:`alert`,className:K(mte({variant:t}),e),...n}));Q_.displayName=`Alert`;var $_=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`h5`,{ref:n,className:K(`mb-1 font-medium leading-none tracking-tight`,e),...t}));$_.displayName=`AlertTitle`;var ev=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:K(`text-sm [&_p]:leading-relaxed`,e),...t}));ev.displayName=`AlertDescription`;function tv(e,[t,n]){return Math.min(n,Math.max(t,e))}var nv=_.createContext(void 0);function rv(e){let t=_.useContext(nv);return e||t||`ltr`}function iv(e){let t=av(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(sv);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function av(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=lv(n),i=cv(r,n.props);return n.type!==_.Fragment&&(i.ref=t?na(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ov=Symbol(`radix.slottable`);function sv(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ov}function cv(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function lv(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var uv=[` `,`Enter`,`ArrowUp`,`ArrowDown`],dv=[` `,`Enter`],fv=`Select`,[pv,mv,hv]=pa(fv),[gv,hte]=aa(fv,[hv,Pm]),_v=Pm(),[vv,yv]=gv(fv),[bv,xv]=gv(fv),Sv=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=_v(t),[g,v]=_.useState(null),[y,b]=_.useState(null),[x,S]=_.useState(!1),C=rv(l),[w,T]=qa({prop:r,defaultProp:i??!1,onChange:a,caller:fv}),[E,D]=qa({prop:o,defaultProp:s,onChange:c,caller:fv}),O=_.useRef(null),k=g?m||!!g.closest(`form`):!0,[A,j]=_.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,B.jsx)(Wm,{...h,children:(0,B.jsxs)(vv,{required:p,scope:t,trigger:g,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Al(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,B.jsx)(pv.Provider,{scope:t,children:(0,B.jsx)(bv,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:_.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,B.jsxs)(_y,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,B.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};Sv.displayName=fv;var Cv=`SelectTrigger`,wv=_.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=_v(n),o=yv(Cv,n),s=o.disabled||r,c=ra(t,o.onTriggerChange),l=mv(n),u=_.useRef(`touch`),[d,f,p]=yy(e=>{let t=l().filter(e=>!e.disabled),n=by(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,B.jsx)(Gm,{asChild:!0,...a,children:(0,B.jsx)(H.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":vy(o.value)?``:void 0,...i,ref:c,onClick:V(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:V(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:V(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&uv.includes(e.key)&&(m(),e.preventDefault())})})})});wv.displayName=Cv;var Tv=`SelectValue`,Ev=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=yv(Tv,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=ra(t,c.onValueNodeChange);return Ra(()=>{l(u)},[l,u]),(0,B.jsx)(H.span,{...s,ref:d,style:{pointerEvents:`none`},children:vy(c.value)?(0,B.jsx)(B.Fragment,{children:o}):a})});Ev.displayName=Tv;var Dv=`SelectIcon`,Ov=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(H.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Ov.displayName=Dv;var kv=`SelectPortal`,Av=e=>(0,B.jsx)(Ba,{asChild:!0,...e});Av.displayName=kv;var jv=`SelectContent`,Mv=_.forwardRef((e,t)=>{let n=yv(jv,e.__scopeSelect),[r,i]=_.useState();if(Ra(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?v.createPortal((0,B.jsx)(Pv,{scope:e.__scopeSelect,children:(0,B.jsx)(pv.Slot,{scope:e.__scopeSelect,children:(0,B.jsx)(`div`,{children:e.children})})}),t):null}return(0,B.jsx)(Rv,{...e,ref:t})});Mv.displayName=jv;var Nv=10,[Pv,Fv]=gv(jv),Iv=`SelectContentImpl`,Lv=iv(`SelectContent.RemoveScroll`),Rv=_.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...v}=e,y=yv(jv,n),[b,x]=_.useState(null),[S,C]=_.useState(null),w=ra(t,e=>x(e)),[T,E]=_.useState(null),[D,O]=_.useState(null),k=mv(n),[A,j]=_.useState(!1),M=_.useRef(!1);_.useEffect(()=>{if(b)return fd(b)},[b]),Jl();let N=_.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=_.useCallback(()=>N([T,b]),[N,T,b]);_.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:ee}=y;_.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(ee.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ee.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),ee.current=null};return ee.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,ee]),_.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[te,ne]=yy(e=>{let t=k().filter(e=>!e.disabled),n=by(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),re=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),ie=_.useCallback(()=>b?.focus(),[b]),ae=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),oe=r===`popper`?Hv:Bv,se=oe===Hv?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,B.jsx)(Pv,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:re,selectedItem:T,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:te,children:(0,B.jsx)(id,{as:Lv,allowPinchZoom:!0,children:(0,B.jsx)(Fl,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:V(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(ka,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,B.jsx)(oe,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...se,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:V(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});Rv.displayName=Iv;var zv=`SelectItemAlignedPosition`,Bv=_.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=yv(jv,n),o=Fv(jv,n),[s,c]=_.useState(null),[l,u]=_.useState(null),d=ra(t,e=>u(e)),f=mv(n),p=_.useRef(!1),m=_.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,b=_.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Nv,d=tv(a,[Nv,Math.max(Nv,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Nv,d=tv(a,[Nv,Math.max(Nv,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Nv*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),_=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+_+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Nv,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+_+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Nv}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,v,a.dir,r]);Ra(()=>b(),[b]);let[x,S]=_.useState();return Ra(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,B.jsx)(Uv,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:_.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,B.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,B.jsx)(H.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Bv.displayName=zv;var Vv=`SelectPopperPosition`,Hv=_.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Nv,...a}=e,o=_v(n);return(0,B.jsx)(Km,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Hv.displayName=Vv;var[Uv,Wv]=gv(jv,{}),Gv=`SelectViewport`,Kv=_.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Fv(Gv,n),o=Wv(Gv,n),s=ra(t,a.onViewportChange),c=_.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,B.jsx)(pv.Slot,{scope:n,children:(0,B.jsx)(H.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:V(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Nv*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Kv.displayName=Gv;var qv=`SelectGroup`,[Jv,Yv]=gv(qv),Xv=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Al();return(0,B.jsx)(Jv,{scope:n,id:i,children:(0,B.jsx)(H.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Xv.displayName=qv;var Zv=`SelectLabel`,Qv=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Yv(Zv,n);return(0,B.jsx)(H.div,{id:i.id,...r,ref:t})});Qv.displayName=Zv;var $v=`SelectItem`,[ey,ty]=gv($v),ny=_.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=yv($v,n),c=Fv($v,n),l=s.value===r,[u,d]=_.useState(a??``),[f,p]=_.useState(!1),m=ra(t,e=>c.itemRefCallback?.(e,r,i)),h=Al(),g=_.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,B.jsx)(ey,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:_.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(pv.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,B.jsx)(H.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:V(o.onFocus,()=>p(!0)),onBlur:V(o.onBlur,()=>p(!1)),onClick:V(o.onClick,()=>{g.current!==`mouse`&&v()}),onPointerUp:V(o.onPointerUp,()=>{g.current===`mouse`&&v()}),onPointerDown:V(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:V(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:V(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:V(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(dv.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});ny.displayName=$v;var ry=`SelectItemText`,iy=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=yv(ry,n),s=Fv(ry,n),c=ty(ry,n),l=xv(ry,n),[u,d]=_.useState(null),f=ra(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=_.useMemo(()=>(0,B.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Ra(()=>(h(m),()=>g(m)),[h,g,m]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(H.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?v.createPortal(a.children,o.valueNode):null]})});iy.displayName=ry;var ay=`SelectItemIndicator`,oy=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ty(ay,n).isSelected?(0,B.jsx)(H.span,{"aria-hidden":!0,...r,ref:t}):null});oy.displayName=ay;var sy=`SelectScrollUpButton`,cy=_.forwardRef((e,t)=>{let n=Fv(sy,e.__scopeSelect),r=Wv(sy,e.__scopeSelect),[i,a]=_.useState(!1),o=ra(t,r.onScrollButtonChange);return Ra(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(dy,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});cy.displayName=sy;var ly=`SelectScrollDownButton`,uy=_.forwardRef((e,t)=>{let n=Fv(ly,e.__scopeSelect),r=Wv(ly,e.__scopeSelect),[i,a]=_.useState(!1),o=ra(t,r.onScrollButtonChange);return Ra(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(dy,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});uy.displayName=ly;var dy=_.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Fv(`SelectScrollButton`,n),o=_.useRef(null),s=mv(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),Ra(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,B.jsx)(H.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:V(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:V(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:V(i.onPointerLeave,()=>{c()})})}),fy=`SelectSeparator`,py=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(H.div,{"aria-hidden":!0,...r,ref:t})});py.displayName=fy;var my=`SelectArrow`,hy=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=_v(n),a=yv(my,n),o=Fv(my,n);return a.open&&o.position===`popper`?(0,B.jsx)(qm,{...i,...r,ref:t}):null});hy.displayName=my;var gy=`SelectBubbleInput`,_y=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=_.useRef(null),a=ra(r,i),o=D_(t);return _.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,B.jsx)(H.select,{...n,style:{...Xa,...n.style},ref:a,defaultValue:t})});_y.displayName=gy;function vy(e){return e===``||e===void 0}function yy(e){let t=xa(e),n=_.useRef(``),r=_.useRef(0),i=_.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=_.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function by(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=xy(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function xy(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Sy=Sv,Cy=wv,wy=Ev,Ty=Ov,Ey=Av,Dy=Mv,Oy=Kv,ky=Qv,Ay=ny,jy=iy,My=oy,Ny=cy,Py=uy,Fy=py,Iy=Sy,Ly=wy,Ry=_.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(Cy,{ref:r,className:K(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,B.jsx)(Ty,{asChild:!0,children:(0,B.jsx)(us,{className:`h-4 w-4 text-slate-400`})})]}));Ry.displayName=Cy.displayName;var zy=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Ny,{ref:n,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(ps,{className:`h-4 w-4`})}));zy.displayName=Ny.displayName;var By=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Py,{ref:n,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(us,{className:`h-4 w-4`})}));By.displayName=Py.displayName;var Vy=_.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,B.jsx)(Ey,{children:(0,B.jsxs)(Dy,{ref:i,className:K(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,B.jsx)(zy,{}),(0,B.jsx)(Oy,{className:K(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,B.jsx)(By,{})]})}));Vy.displayName=Dy.displayName;var Hy=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(ky,{ref:n,className:K(`py-1.5 pl-8 pr-2 text-sm font-semibold`,e),...t}));Hy.displayName=ky.displayName;var Uy=_.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(Ay,{ref:r,className:K(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(My,{children:(0,B.jsx)(ls,{className:`h-4 w-4`})})}),(0,B.jsx)(jy,{children:t})]}));Uy.displayName=Ay.displayName;var Wy=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(Fy,{ref:n,className:K(`-mx-1 my-1 h-px bg-muted`,e),...t}));Wy.displayName=Fy.displayName;var Gy=e=>e.toLowerCase().replace(/\s+/g,` `).trim();function Ky({enabled:e=!0}={}){let{baseUrl:t,fetchWithHeaders:n}=wl(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(!1),s=(0,_.useCallback)(async()=>{o(!0);try{try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(e=>e.stop())}catch{}let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`).map(e=>({deviceId:e.deviceId,label:e.label})),r=await n(`${t}/available-cameras`);if(!r.ok)return i([]),[];let a=(await r.json()).cameras??[],o=new Set,s=a.map(t=>{let n=t.name||`Camera ${t.index}`,r=Gy(n),i=e.filter(e=>!o.has(e.deviceId)&&e.label),a=i.find(e=>Gy(e.label)===r)||i.find(e=>Gy(e.label).startsWith(r))||i.find(e=>Gy(e.label).includes(r)||r.includes(Gy(e.label)));return a&&o.add(a.deviceId),{index:t.index,name:n,deviceId:a?.deviceId??``,available:t.available}});return i(s),s}catch{return i([]),[]}finally{o(!1)}},[t,n]);return(0,_.useEffect)(()=>{if(!e)return;s();let t=()=>s();return navigator.mediaDevices.addEventListener(`devicechange`,t),()=>navigator.mediaDevices.removeEventListener(`devicechange`,t)},[e,s]),{cameras:r,isLoading:a,refresh:s}}var qy=4,Jy=300,Yy=new Set([`NotReadableError`,`AbortError`]);function Xy(e,t){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(0),s=(0,_.useRef)(!1);return s.current=r,(0,_.useEffect)(()=>{let e=()=>{s.current&&o(e=>e+1)};return navigator.mediaDevices.addEventListener(`devicechange`,e),()=>navigator.mediaDevices.removeEventListener(`devicechange`,e)},[]),(0,_.useEffect)(()=>{if(t||!e){e||i(!0);return}let r=!1,a=null,o=null;i(!1);let s=async t=>{try{if(a=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:e}}}),r){a.getTracks().forEach(e=>e.stop());return}n.current&&(n.current.srcObject=a,await n.current.play().catch(()=>{}))}catch(e){if(r)return;let n=e instanceof DOMException?e.name:``;ts(t+1),Jy*2**t):i(!0)}};return s(0),()=>{r=!0,o&&clearTimeout(o),a&&a.getTracks().forEach(e=>e.stop())}},[e,t,a]),{videoRef:n,hasError:r}}var Zy=`__auto__`,Qy=`__default__`,$y=[`MJPG`,`YUYV`,`I420`,`NV12`,`H264`,`MP4V`],eb=[`ANY`,`V4L2`,`DSHOW`,`PVAPI`,`ANDROID`,`AVFOUNDATION`,`MSMF`],tb=({cameras:e,onCamerasChange:t,releaseStreamsRef:n,readOnly:r=!1})=>{let{toast:i}=ea(),{cameras:a,isLoading:o,refresh:s}=Ky(),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(``);(0,_.useEffect)(()=>{if(a.length===0||e.length===0)return;let n=!1,r=e.map(e=>{if(!e.device_id)return e;let t=a.find(t=>t.deviceId===e.device_id);return t&&t.index!==e.camera_index?(n=!0,{...e,camera_index:t.index}):e});n&&t(r)},[a]);let f=()=>{if(!c||!u.trim()){i({title:`Missing Information`,description:`Please select a camera and provide a name.`,variant:`destructive`});return}let n=parseInt(c),r=a.find(e=>e.index===n);if(!r){i({title:`Invalid Camera`,description:`Selected camera is not available.`,variant:`destructive`});return}if(e.some(e=>e.camera_index===r.index||r.deviceId&&e.device_id===r.deviceId)){i({title:`Camera Already Added`,description:`This camera is already in the configuration.`,variant:`destructive`});return}let o={id:`camera_${Date.now()}`,name:u.trim(),type:`opencv`,camera_index:r.index,device_id:r.deviceId,width:640,height:480,fps:30};t([...e,o]),l(``),d(``),i({title:`Camera Added`,description:`${o.name} has been added to the configuration.`})},p=n=>{t(e.filter(e=>e.id!==n)),i({title:`Camera Removed`,description:`Camera has been removed from the configuration.`})},m=(n,r)=>{t(e.map(e=>e.id===n?{...e,...r}:e))},[h,g]=(0,_.useState)(!1),v=(0,_.useCallback)(()=>{g(!0)},[]);return(0,_.useEffect)(()=>{n&&(n.current=v)},[n,v]),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:r?`Cameras`:`Camera Configuration`}),!r&&(0,B.jsxs)(`div`,{className:`bg-gray-800/50 rounded-lg p-4 space-y-4`,children:[(0,B.jsx)(`h4`,{className:`text-md font-medium text-gray-300`,children:`Add Camera`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(J,{className:`text-sm font-medium text-gray-300`,children:`Available Cameras`}),(0,B.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>s(),disabled:o,className:`h-6 w-6 text-gray-400 hover:text-white`,title:`Rescan for cameras (e.g. after plugging in a new USB camera)`,"aria-label":`Rescan for cameras`,children:(0,B.jsx)(zs,{className:`w-3.5 h-3.5 ${o?`animate-spin`:``}`})})]}),(0,B.jsxs)(Iy,{value:c,onValueChange:l,disabled:o,children:[(0,B.jsx)(Ry,{className:`bg-gray-800 border-gray-700 text-white`,children:(0,B.jsx)(Ly,{placeholder:o?`Loading cameras...`:`Select camera`})}),(0,B.jsx)(Vy,{className:`bg-gray-800 border-gray-700`,children:a.map(t=>{let n=e.some(e=>e.camera_index===t.index||t.deviceId&&e.device_id===t.deviceId);return(0,B.jsx)(Uy,{value:t.index.toString(),className:`text-white hover:bg-gray-700`,disabled:!t.available||n,children:(0,B.jsxs)(`div`,{className:`flex flex-col`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`Index `,t.index,n&&` · already added`]})]})},t.index)})})]})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{className:`text-sm font-medium text-gray-300`,children:`Camera Name`}),(0,B.jsx)(b_,{value:u,onChange:e=>d(e.target.value),placeholder:`e.g., workspace_cam`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,B.jsx)(`div`,{className:`space-y-2 flex flex-col justify-end`,children:(0,B.jsxs)(q,{onClick:f,className:`bg-blue-500 hover:bg-blue-600 text-white`,disabled:!c||!u.trim(),children:[(0,B.jsx)(Rs,{className:`w-4 h-4 mr-2`}),`Add Camera`]})})]})]}),e.length>0&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[!r&&(0,B.jsxs)(`h4`,{className:`text-md font-medium text-gray-300`,children:[`Configured Cameras (`,e.length,`)`]}),(0,B.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 gap-4`,children:e.map(e=>(0,B.jsx)(nb,{camera:e,paused:h,readOnly:r,onRemove:()=>p(e.id),onUpdate:t=>m(e.id,t)},e.id))})]}),e.length===0&&(0,B.jsxs)(`div`,{className:`text-center py-8 text-gray-500`,children:[(0,B.jsx)(cs,{className:`w-12 h-12 mx-auto mb-4 text-gray-600`}),(0,B.jsx)(`p`,{children:r?`No cameras are configured for this robot.`:`No cameras configured. Add a camera to get started.`})]})]})},nb=({camera:e,paused:t,readOnly:n,onRemove:r,onUpdate:i})=>{let{videoRef:a,hasError:o}=Xy(e.device_id,t);return(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`aspect-[4/3] bg-gray-800 relative`,children:!t&&e.device_id&&!o?(0,B.jsx)(`video`,{ref:a,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-full object-cover`}):(0,B.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center`,children:[(0,B.jsx)($s,{className:`w-8 h-8 text-gray-500 mb-2`}),(0,B.jsx)(`span`,{className:`text-gray-500 text-sm`,children:t?`Preview paused`:e.device_id?`Preview failed`:`No browser match`})]})}),(0,B.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h5`,{className:`font-medium text-white truncate`,children:e.name}),!n&&(0,B.jsx)(q,{onClick:r,size:`sm`,variant:`ghost`,className:`text-red-400 hover:text-red-300 hover:bg-red-900/20 p-1`,children:(0,B.jsx)(nc,{className:`w-4 h-4`})})]}),n?(0,B.jsxs)(`p`,{className:`text-xs text-gray-400`,children:[e.width,`×`,e.height,e.fps?` · ${e.fps} fps`:``]}):(0,B.jsxs)(Y_,{children:[(0,B.jsxs)(X_,{className:`group flex items-center gap-1.5 text-xs font-medium text-gray-300 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Configuration`]}),(0,B.jsxs)(Z_,{className:`pt-2 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 text-xs text-gray-400`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-16`,children:`Resolution:`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(x_,{value:e.width,onChange:e=>{e!==void 0&&i({width:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`320`,max:`1920`}),(0,B.jsx)(`span`,{className:`flex items-center`,children:`×`}),(0,B.jsx)(x_,{value:e.height,onChange:e=>{e!==void 0&&i({height:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`240`,max:`1080`})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-16`,children:`FPS:`}),(0,B.jsx)(x_,{value:e.fps??30,onChange:e=>{e!==void 0&&i({fps:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`10`,max:`60`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-16`,children:`FOURCC:`}),(0,B.jsxs)(Iy,{value:e.fourcc??Zy,onValueChange:e=>i({fourcc:e===Zy?void 0:e}),children:[(0,B.jsx)(Ry,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,B.jsx)(Ly,{})}),(0,B.jsxs)(Vy,{className:`bg-gray-800 border-gray-700`,children:[(0,B.jsx)(Uy,{value:Zy,className:`text-white hover:bg-gray-700 text-xs`,children:`Auto`}),$y.map(e=>(0,B.jsx)(Uy,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-16`,children:`Backend:`}),(0,B.jsxs)(Iy,{value:e.backend??Qy,onValueChange:e=>i({backend:e===Qy?void 0:e}),children:[(0,B.jsx)(Ry,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,B.jsx)(Ly,{})}),(0,B.jsxs)(Vy,{className:`bg-gray-800 border-gray-700`,children:[(0,B.jsx)(Uy,{value:Qy,className:`text-white hover:bg-gray-700 text-xs`,children:`Default`}),eb.map(e=>(0,B.jsx)(Uy,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,B.jsx)(`p`,{className:`text-[10px] text-gray-500 leading-tight`,children:`Overriding the backend can reorder camera indices on macOS.`})]}),(0,B.jsxs)(`div`,{className:`text-xs text-gray-500`,children:[`Type: `,e.type,` | Device:`,` `,e.device_id?.substring(0,10),`...`]})]})]})]})]})},rb=({open:e,onOpenChange:t,robot:n,datasetName:r,setDatasetName:i,singleTask:a,setSingleTask:o,numEpisodes:s,setNumEpisodes:c,episodeTimeS:l,setEpisodeTimeS:u,resetTimeS:d,setResetTimeS:f,streamingEncoding:p,setStreamingEncoding:m,cameras:h,setCameras:g,onStart:_,releaseStreamsRef:v})=>{let{auth:y}=Dl(),b=!!n&&n.is_clean;return(0,B.jsx)($d,{open:e,onOpenChange:t,children:(0,B.jsxs)(nf,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,B.jsxs)(rf,{children:[(0,B.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,B.jsx)(`div`,{className:`w-8 h-8 bg-red-500 rounded-full flex items-center justify-center`,children:(0,B.jsx)(`span`,{className:`text-white font-bold text-sm`,children:`REC`})})}),(0,B.jsx)(of,{className:`text-white text-center text-2xl font-bold`,children:`Configure Recording`})]}),(0,B.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,B.jsx)(sf,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a configured robot and dataset parameters for recording.`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-6`,children:[(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,B.jsx)(gs,{className:`w-4 h-4 text-green-400`}),(0,B.jsxs)(`span`,{className:`text-slate-200`,children:[`Recording with `,(0,B.jsx)(`strong`,{children:n.name})]})]}):(0,B.jsxs)(Q_,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsxs)(ev,{children:[(0,B.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before recording.`]})]}):(0,B.jsxs)(Q_,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsx)(ev,{children:`Select and configure a robot on the Landing page before recording.`})]})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Dataset Configuration`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`datasetName`,className:`text-sm font-medium text-gray-300`,children:`Dataset Name *`}),(0,B.jsx)(b_,{id:`datasetName`,value:r,onChange:e=>i(e.target.value.replace(/[^A-Za-z0-9._-]/g,`_`)),placeholder:`my_dataset`,className:`bg-gray-800 border-gray-700 text-white`}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Letters, numbers, `,(0,B.jsx)(`code`,{children:`.`}),` `,(0,B.jsx)(`code`,{children:`_`}),` `,(0,B.jsx)(`code`,{children:`-`}),` only — other characters become`,` `,(0,B.jsx)(`code`,{children:`_`}),`.`]}),r&&(y.status===`authenticated`?(0,B.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Will be saved as`,` `,(0,B.jsxs)(`span`,{className:`text-gray-300 font-mono`,children:[y.username,`/`,r]})]}):y.status===`unauthenticated`?(0,B.jsx)(`p`,{className:`text-xs text-amber-400/80`,children:`Log in to Hugging Face to set the repository owner.`}):null)]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`singleTask`,className:`text-sm font-medium text-gray-300`,children:`Task Description *`}),(0,B.jsx)(b_,{id:`singleTask`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g., pick up the red block and place it on the blue square`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`numEpisodes`,className:`text-sm font-medium text-gray-300`,children:`Number of Episodes`}),(0,B.jsx)(x_,{id:`numEpisodes`,min:`1`,max:`100`,value:s,onChange:e=>{e!==void 0&&c(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`episodeTimeS`,className:`text-sm font-medium text-gray-300`,children:`Episode duration (seconds)`}),(0,B.jsx)(x_,{id:`episodeTimeS`,min:`1`,value:l,onChange:e=>{e!==void 0&&u(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`resetTimeS`,className:`text-sm font-medium text-gray-300`,children:`Reset duration (seconds)`}),(0,B.jsx)(x_,{id:`resetTimeS`,min:`1`,value:d,onChange:e=>{e!==void 0&&f(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]})]})]}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(tb,{cameras:h,onCamerasChange:g,releaseStreamsRef:v,readOnly:!0}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`These are the cameras set up for this robot. To add or change a camera, configure it on the Calibration page.`})]}),(0,B.jsxs)(Y_,{className:`space-y-4 group`,children:[(0,B.jsxs)(X_,{className:`flex items-center justify-between w-full text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:[(0,B.jsx)(`span`,{children:`Advanced Parameters`}),(0,B.jsx)(us,{className:`w-4 h-4 transition-transform group-data-[state=open]:rotate-180`})]}),(0,B.jsx)(Z_,{className:`space-y-3`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(B_,{id:`streamingEncoding`,checked:p,onCheckedChange:e=>m(e===!0),className:`mt-0.5 border-gray-500 data-[state=checked]:bg-red-500 data-[state=checked]:border-red-500`}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(J,{htmlFor:`streamingEncoding`,className:`text-sm font-medium text-gray-200 cursor-pointer`,children:`Streaming video encoding`}),(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Encodes frames in real time during capture so each episode saves almost instantly. Uncheck to fall back to the slower PNG-then-encode flow.`})]})]})})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,B.jsx)(q,{onClick:_,disabled:!b,className:`w-full sm:w-auto bg-red-500 hover:bg-red-600 text-white px-10 py-6 text-lg transition-all shadow-md shadow-red-500/30 hover:shadow-lg hover:shadow-red-500/40 disabled:opacity-40 disabled:cursor-not-allowed`,children:`Start Recording`}),(0,B.jsx)(q,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},ib=/^[\w.\-]+\/[\w.\-]+$/,ab=/^[A-Za-z0-9._-]+$/,ob=({datasets:e,loading:t,onPickExisting:n,onCreateNew:r,onOpenCustom:i,children:a})=>{let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(``),u=c.trim(),d=e.some(e=>e.repo_id.toLowerCase()===u.toLowerCase()),f=ib.test(u),p=ab.test(u)&&!u.includes(`/`),m=u.length>0&&p&&!d,h=f&&!d,g=d||u!==``&&!m,v=d?`Already exists`:u===``?`Create new dataset…`:m?`Create "${u}"`:`Use a name without "/"`,y=()=>{g||(r(u),S())},b=e.filter(e=>e.source===`local`||e.source===`both`),x=e.filter(e=>e.source===`hub`),S=()=>{l(``),s(!1)},C=e=>{n(e),S()},w=()=>{m&&(r(u),S())},T=()=>{h&&(i(u),S())},E=e=>(0,B.jsxs)(h_,{value:e.repo_id,onSelect:()=>C(e),className:`text-white aria-selected:bg-gray-700`,children:[(0,B.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,B.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,B.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return(0,B.jsxs)(mg,{open:o,onOpenChange:s,children:[(0,B.jsx)(hg,{asChild:!0,children:a}),(0,B.jsx)(gg,{className:`w-[320px] p-0 bg-gray-800 border-gray-700 text-white`,align:`end`,children:(0,B.jsxs)(l_,{className:`bg-gray-800`,children:[(0,B.jsx)(u_,{placeholder:`Search, type a new name, or org/name…`,value:c,onValueChange:e=>l(e.replace(/[^A-Za-z0-9._\-/]/g,`_`)),onKeyDown:e=>{e.key===`Enter`&&(m?(e.preventDefault(),w()):h&&(e.preventDefault(),T()))},className:`text-white`}),(0,B.jsxs)(d_,{children:[e.length===0&&!m&&!h&&(0,B.jsx)(f_,{className:`py-4 text-sm text-gray-400 text-center`,children:t?`Loading datasets…`:`No datasets yet. Type a name to create one.`}),b.length>0&&(0,B.jsx)(p_,{heading:`Local`,children:b.map(E)}),x.length>0&&(0,B.jsx)(p_,{heading:`Hugging Face`,children:x.map(E)}),h&&(0,B.jsx)(p_,{heading:`Custom repo`,children:(0,B.jsxs)(h_,{value:`__open__${u}`,onSelect:T,className:`text-white aria-selected:bg-gray-700`,children:[(0,B.jsx)(Ds,{className:`mr-2 h-4 w-4`}),`Open "`,u,`" in viewer`]})})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:y,disabled:g,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,B.jsx)(Rs,{className:`h-4 w-4`}),v]})]})})]})},sb=(e,t)=>{let{wsBaseUrl:n}=wl(),r=(0,_.useRef)(e);r.current=e;let i=(0,_.useRef)(t);i.current=t,(0,_.useEffect)(()=>{let e=!1,t=null,a=null,o=()=>{if(!e){try{t=new WebSocket(`${n}/ws/joint-data`)}catch{a=setTimeout(o,3e3);return}t.onmessage=e=>{try{let t=JSON.parse(e.data);t?.type===`jobs_changed`?r.current():t?.type===`job_progress`&&i.current&&Array.isArray(t?.jobs)&&i.current(t.jobs)}catch{}},t.onclose=()=>{e||(a=setTimeout(o,3e3))}}};return o(),()=>{e=!0,a&&clearTimeout(a),t&&t.close()}},[n])},cb=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:K(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));cb.displayName=`Card`;var lb=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:K(`flex flex-col space-y-1.5 p-6`,e),...t}));lb.displayName=`CardHeader`;var ub=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`h3`,{ref:n,className:K(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));ub.displayName=`CardTitle`;var db=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`p`,{ref:n,className:K(`text-sm text-muted-foreground`,e),...t}));db.displayName=`CardDescription`;var fb=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:K(`p-6 pt-0`,e),...t}));fb.displayName=`CardContent`;var pb=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(`div`,{ref:n,className:K(`flex items-center p-6 pt-0`,e),...t}));pb.displayName=`CardFooter`;async function mb(e,t,n,r){return(await uf(e,t,`/jobs/${n}/checkpoints`,{signal:r,action:`List checkpoints`})).checkpoints}async function hb(e,t,n,r,i){return uf(e,t,`/jobs/${n}/checkpoints/${r}/policy-config`,{signal:i,action:`Load policy config`})}var gb=({checkpoints:e,selectedStep:t,onChange:n,disabled:r,placeholder:i=`Select checkpoint`})=>{let a=e=>e===0?`latest`:`step ${e}`;return(0,B.jsxs)(Iy,{value:t==null?void 0:String(t),onValueChange:e=>n(Number(e)),disabled:r||e.length===0,children:[(0,B.jsx)(Ry,{className:`bg-slate-800 border-slate-700 text-white h-8 text-xs px-2 w-auto min-w-[110px]`,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(Ly,{placeholder:i})}),(0,B.jsx)(Vy,{className:`bg-slate-900 border-slate-700 text-white`,children:e.map(e=>(0,B.jsx)(Uy,{value:String(e.step),onClick:e=>e.stopPropagation(),children:a(e.step)},e.step))})]})};function _b(e){let t=Math.max(0,Date.now()/1e3-e);return t<60?`${Math.floor(t)}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}var vb={running:{label:`Running`,color:`text-green-400`,Icon:Ns},done:{label:`Done`,color:`text-slate-400`,Icon:_s},failed:{label:`Failed`,color:`text-red-400`,Icon:ys},interrupted:{label:`Interrupted`,color:`text-amber-400`,Icon:Zs}},yb=({job:e,onStop:t,onDelete:n,onPlay:r})=>{let i=ht(),{baseUrl:a,fetchWithHeaders:o}=wl(),s=vb[e.state],c=s.Icon,l=e.state===`running`,u=e.runner===`imported`,d=e.hf_repo_id||e.output_dir,f=u?`Imported`:s.label,p=l&&e.metrics.total_steps===0,m=e.metrics.total_steps>0?Math.min(100,e.metrics.current_step/e.metrics.total_steps*100):0,h=u?d:p?`starting…`:l?`started ${_b(e.started_at)}`:e.ended_at==null?s.label.toLowerCase():`ended ${_b(e.ended_at)}`,[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(e.checkpoint_count<=0){v([]),b(null);return}let t=!1;return mb(a,o,e.id).then(e=>{if(!t)if(v(e),e.length>0){let t=e[e.length-1].step;b(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else b(null)}).catch(()=>{t||(v([]),b(null))}),()=>{t=!0}},[a,o,e.id,e.checkpoint_count]);let x=r=>{r.stopPropagation(),l?window.confirm(`Stop this run?`)&&t(e.id):u?window.confirm(`Remove this imported model? The source files are left untouched.`)&&n(e.id):window.confirm(`Delete this run? This wipes the output directory.`)&&n(e.id)},S=t=>{t.stopPropagation(),y!=null&&r(e,y)},C=l,w=g.length>0&&y!=null;return(0,B.jsx)(cb,{onClick:()=>{u||i(`/training/${e.id}`)},className:`bg-slate-800/50 border-slate-700 rounded-xl transition-colors ${u?``:`cursor-pointer hover:border-slate-500`}`,children:(0,B.jsxs)(fb,{className:`p-4 space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${s.color}`,children:[(0,B.jsx)(c,{className:`w-3.5 h-3.5 ${l?`animate-spin`:``}`}),f]}),e.runner===`hf_cloud`&&e.hf_job_url?(0,B.jsx)(q,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Open Hub job page`,children:(0,B.jsx)(`a`,{href:e.hf_job_url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(Ds,{className:`w-3.5 h-3.5`})})}):(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:x,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":l?`Stop job`:`Delete job`,children:l?(0,B.jsx)(Js,{className:`w-3.5 h-3.5`}):(0,B.jsx)(nc,{className:`w-3.5 h-3.5`})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-white font-semibold truncate`,title:e.name,children:e.name}),(0,B.jsx)(`div`,{className:`text-xs text-slate-400 truncate`,title:h,style:u?{direction:`rtl`,textAlign:`left`}:void 0,children:u?`‎`+h:h})]}),C?(0,B.jsxs)(`div`,{className:`relative h-5 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,B.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${m}%`}}),(0,B.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs font-semibold text-white tabular-nums drop-shadow`,children:p?`Training starting…`:`${m.toFixed(1)}%`})]}):null,w?(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(gb,{checkpoints:g,selectedStep:y,onChange:b}),(0,B.jsx)(q,{size:`icon`,onClick:S,className:`h-8 w-8 bg-green-500 hover:bg-green-600 text-white`,"aria-label":`Run inference with this checkpoint`,children:(0,B.jsx)(Ls,{className:`w-4 h-4`})})]}):null]})})};function bb(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var xb={RUNNING:{label:`Running`,color:`text-green-400`,Icon:Ns,spin:!0},QUEUED:{label:`Queued`,color:`text-amber-400`,Icon:xs},SCHEDULING:{label:`Scheduling`,color:`text-amber-400`,Icon:xs},COMPLETED:{label:`Done`,color:`text-slate-400`,Icon:_s},FAILED:{label:`Failed`,color:`text-red-400`,Icon:ys},CANCELED:{label:`Cancelled`,color:`text-amber-400`,Icon:Zs},CANCELLED:{label:`Cancelled`,color:`text-amber-400`,Icon:Zs}},Sb=({job:e})=>{let t=e.status?.stage?.toUpperCase()??``,n=xb[t]??{label:t||`Unknown`,color:`text-slate-400`,Icon:vs},r=n.Icon,i=e.docker_image??e.space_id??`Job ${e.id.slice(0,12)}…`;return(0,B.jsx)(cb,{onClick:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,B.jsxs)(fb,{className:`p-4 space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${n.color}`,children:[(0,B.jsx)(r,{className:`w-3.5 h-3.5 ${n.spin?`animate-spin`:``}`}),n.label]}),(0,B.jsx)(q,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,B.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(Ds,{className:`w-3.5 h-3.5`})})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-white font-semibold truncate`,title:i,children:i}),(0,B.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,children:[e.flavor??`—`,` · `,bb(e.created_at),e.owner?` · ${e.owner}`:``]})]}),e.status?.message?(0,B.jsx)(`div`,{className:`text-xs text-slate-500 truncate`,title:e.status.message,children:e.status.message}):null]})})};function Cb(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var wb=({model:e})=>{let t=`https://huggingface.co/${e.repo_id}`,n=e.repo_id.includes(`/`)?e.repo_id.split(`/`).slice(1).join(`/`):e.repo_id;return(0,B.jsx)(cb,{onClick:()=>window.open(t,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,B.jsxs)(fb,{className:`p-4 space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-sky-400`,children:[(0,B.jsx)(Qs,{className:`w-3.5 h-3.5`}),`Uploaded`]}),(0,B.jsx)(q,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,B.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(Ds,{className:`w-3.5 h-3.5`})})})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`text-white font-semibold truncate flex items-center gap-1.5`,title:e.repo_id,children:[e.private?(0,B.jsx)(Ps,{className:`w-3.5 h-3.5 text-slate-400 shrink-0`}):null,(0,B.jsx)(`span`,{className:`truncate`,children:n})]}),(0,B.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,title:e.repo_id,children:[e.repo_id,` · updated `,Cb(e.last_modified)]})]})]})})};async function Tb(e,t,n){return uf(e,t,`/start-inference`,{method:`POST`,body:n,action:`Start inference`})}async function Eb(e,t){return uf(e,t,`/stop-inference`,{method:`POST`,action:`Stop inference`})}async function Db(e,t,n){return uf(e,t,`/inference-status`,{signal:n,action:`Get inference status`})}var Ob=({deviceId:e,paused:t})=>{let{videoRef:n,hasError:r}=Xy(e,t);return t||r||!e?(0,B.jsxs)(`div`,{className:`w-32 h-24 bg-gray-800 rounded border border-gray-700 flex flex-col items-center justify-center`,children:[(0,B.jsx)($s,{className:`w-5 h-5 text-gray-500 mb-1`}),(0,B.jsx)(`span`,{className:`text-[10px] text-gray-500`,children:t?`Released`:`No preview`})]}):(0,B.jsx)(`video`,{ref:n,autoPlay:!0,muted:!0,playsInline:!0,className:`w-32 h-24 object-cover rounded border border-gray-700 bg-black`})},kb=30,Ab=({open:e,onOpenChange:t,robot:n,jobId:r,initialStep:i})=>{let{baseUrl:a,fetchWithHeaders:o}=wl(),{toast:s}=ea(),c=ht(),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(i),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(60),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)({}),{cameras:O}=Ky({enabled:e});(0,_.useEffect)(()=>{if(!e)return;let t=!1;return mb(a,o,r).then(e=>{if(!t&&(u(e),e.length>0)){let t=e[e.length-1].step;f(e=>e??t)}}).catch(()=>{t||u([])}),()=>{t=!0}},[e,a,o,r]),(0,_.useEffect)(()=>{if(!e||d==null){x(null),T(null);return}let t=!1;return C(!0),T(null),hb(a,o,r,d).then(e=>{t||(x(e),D(t=>{let n={};for(let r of Object.keys(e.image_features))n[r]=t[r]??null;return n}))}).catch(e=>{t||(x(null),T(e instanceof Error?e.message:String(e)))}).finally(()=>{t||C(!1)}),()=>{t=!0}},[e,a,o,r,d]),(0,_.useEffect)(()=>{if(!b)return;let e=n?.cameras??[];e.length===0||O.length===0||D(t=>{let n=!1,r={...t};for(let t of Object.keys(b.image_features)){if(r[t]!=null)continue;let i=e.find(e=>e.name.toLowerCase()===t.toLowerCase());if(!i)continue;let a=i.device_id&&O.find(e=>e.deviceId===i.device_id)||O.find(e=>e.index===i.camera_index);a&&(r[t]=a.index,n=!0)}return n?r:t})},[b,n,O]);let k=d==null?null:l.find(e=>e.step===d)?.ref??null,A=b?Object.keys(b.image_features):[],j=A.every(e=>E[e]!=null),M=!!n&&n.is_clean&&k!=null&&!!b&&j&&!v,N=async()=>{if(!n||k==null||!b)return;y(!0),await new Promise(e=>setTimeout(e,300));let e={};for(let[t,n]of Object.entries(b.image_features)){let r=E[t];r!=null&&(e[t]={type:`opencv`,camera_index:r,width:n.width,height:n.height,fps:kb})}try{await Tb(a,o,{follower_port:n.follower_port,follower_config:n.follower_config,policy_ref:k,task:p,cameras:e,duration_s:h}),t(!1),c(`/inference`)}catch(e){s({title:`Couldn't start inference`,description:e instanceof Error?e.message:String(e),variant:`destructive`}),y(!1)}},P=(e,t)=>{let n=Number(t);D(t=>({...t,[e]:n}))};return(0,B.jsx)($d,{open:e,onOpenChange:t,children:(0,B.jsxs)(nf,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,B.jsxs)(rf,{children:[(0,B.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,B.jsx)(`div`,{className:`w-8 h-8 bg-green-500 rounded-full flex items-center justify-center`,children:(0,B.jsx)(Ls,{className:`w-4 h-4 text-white`})})}),(0,B.jsx)(of,{className:`text-white text-center text-2xl font-bold`,children:`Configure Inference`})]}),(0,B.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,B.jsx)(sf,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a checkpoint and confirm hardware. The selected policy will drive the follower autonomously for the configured duration.`}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,B.jsx)(gs,{className:`w-4 h-4 text-green-400`}),(0,B.jsxs)(`span`,{className:`text-slate-200`,children:[`Running on `,(0,B.jsx)(`strong`,{children:n.name})]})]}):(0,B.jsxs)(Q_,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsxs)(ev,{children:[(0,B.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before running inference.`]})]}):(0,B.jsxs)(Q_,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsx)(ev,{children:`Select and configure a robot on the Landing page first.`})]})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Checkpoint`}),l.length===0?(0,B.jsxs)(Q_,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsx)(ev,{children:`No checkpoints available for this job yet.`})]}):(0,B.jsx)(gb,{checkpoints:l,selectedStep:d,onChange:f})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Run parameters`}),b?.requires_task?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`task`,className:`text-sm font-medium text-gray-300`,children:`Task description`}),(0,B.jsx)(b_,{id:`task`,value:p,onChange:e=>m(e.target.value),placeholder:`e.g., pick up the red block`,className:`bg-gray-800 border-gray-700 text-white`}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`This policy is language-conditioned (`,b.policy_type,`).`]})]}):null,(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`durationS`,className:`text-sm font-medium text-gray-300`,children:`Max duration (seconds)`}),(0,B.jsx)(x_,{id:`durationS`,min:1,value:h,onChange:e=>{e!==void 0&&g(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Cameras`}),S?(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-400`,children:[(0,B.jsx)(Ns,{className:`w-4 h-4 animate-spin`}),`Reading policy config…`]}):w?(0,B.jsxs)(Q_,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsxs)(ev,{children:[`Couldn't load policy config: `,w]})]}):b?A.length===0?(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`This policy doesn't use cameras.`}):(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Bind a physical camera to each name the policy was trained with. Resolution comes from the checkpoint.`}),A.map(e=>{let t=b.image_features[e],n=E[e],r=n==null?void 0:O.find(e=>e.index===n);return(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex-1`,children:[(0,B.jsx)(J,{className:`text-sm font-medium text-gray-200`,children:e}),(0,B.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[t.width,`×`,t.height]})]}),(0,B.jsxs)(Iy,{value:n==null?void 0:String(n),onValueChange:t=>P(e,t),children:[(0,B.jsx)(Ry,{className:`bg-gray-800 border-gray-700 text-white w-56`,children:(0,B.jsx)(Ly,{placeholder:`Select a camera`})}),(0,B.jsx)(Vy,{className:`bg-gray-900 border-gray-700 text-white`,children:O.length===0?(0,B.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-gray-500`,children:`No cameras detected`}):O.map(e=>(0,B.jsxs)(Uy,{value:String(e.index),children:[`#`,e.index,` — `,e.name]},e.index))})]}),(0,B.jsx)(Ob,{deviceId:r?.deviceId??``,paused:v})]},e)})]}):null]}),(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,B.jsxs)(q,{onClick:N,disabled:!M,className:`w-full sm:w-auto bg-green-500 hover:bg-green-600 text-white px-10 py-6 text-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:[(0,B.jsx)(Ls,{className:`w-5 h-5 mr-2`}),v?`Starting…`:`Start Inference`]}),(0,B.jsx)(q,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},jb=({open:e,onOpenChange:t,onImported:n})=>{let{baseUrl:r,fetchWithHeaders:i}=wl(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);return(0,B.jsx)($d,{open:e,onOpenChange:t,children:(0,B.jsxs)(nf,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[520px] p-8`,children:[(0,B.jsxs)(rf,{children:[(0,B.jsx)(of,{className:`text-white text-center text-2xl font-bold`,children:`Import a model`}),(0,B.jsx)(sf,{className:`text-gray-400 text-center`,children:`Point at a local directory or a Hugging Face repo. It appears as a job you can run inference on.`})]}),(0,B.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`source`,className:`text-sm font-medium text-gray-300`,children:`Local path or Hugging Face repo id`}),(0,B.jsx)(b_,{id:`source`,value:a,onChange:e=>o(e.target.value),placeholder:`/path/to/pretrained_model or user/my-policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`name`,className:`text-sm font-medium text-gray-300`,children:`Display name (optional)`}),(0,B.jsx)(b_,{id:`name`,value:s,onChange:e=>c(e.target.value),placeholder:`My imported policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),d?(0,B.jsxs)(Q_,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,B.jsx)(Zs,{className:`h-4 w-4`}),(0,B.jsx)(ev,{children:d})]}):null,(0,B.jsxs)(`div`,{className:`flex gap-3 justify-center pt-2`,children:[(0,B.jsxs)(q,{onClick:async()=>{let e=a.trim();if(e){u(!0),f(null);try{await hf(r,i,e,s.trim()||void 0),o(``),c(``),t(!1),n()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},disabled:!a.trim()||l,className:`bg-green-500 hover:bg-green-600 text-white px-8 disabled:opacity-40`,children:[l?(0,B.jsx)(Ns,{className:`w-4 h-4 mr-2 animate-spin`}):(0,B.jsx)(Ts,{className:`w-4 h-4 mr-2`}),l?`Importing…`:`Import`]}),(0,B.jsx)(q,{onClick:()=>t(!1),variant:`outline`,className:`border-gray-500 px-8 text-zinc-400 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Mb=`lelab.selectedRobot`,Nb=()=>{try{let e=localStorage.getItem(Mb);return e&&typeof e==`string`?e:null}catch{return null}},Pb=e=>{try{e?localStorage.setItem(Mb,e):localStorage.removeItem(Mb)}catch{}},Fb=()=>{let{baseUrl:e,fetchWithHeaders:t}=wl(),{toast:n}=ea(),r=ft(),[i,a]=(0,_.useState)({}),[o,s]=(0,_.useState)(()=>Nb()),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let n=!1;return(async()=>{l(!0);try{let r=await(await t(`${e}/robots`)).json();if(n)return;let i={};for(let e of r.robots??[])i[e.name]=e;a(i),s(e=>e&&e in i?e:null)}catch(e){n||console.error(`Failed to fetch robots:`,e)}finally{n||l(!1)}})(),()=>{n=!0}},[e,t,r.key]),(0,_.useEffect)(()=>{Pb(o)},[o]);let u=(0,_.useCallback)(e=>{s(e)},[]),d=(0,_.useCallback)(()=>{s(null)},[]),f=(0,_.useCallback)(async r=>{let i=r.trim();if(!i)return n({title:`Missing name`,description:`Robot name cannot be empty.`,variant:`destructive`}),!1;if(/[/\\]|\.\./.test(i))return n({title:`Invalid name`,description:`Robot names cannot contain '/', '\\', or '..'`,variant:`destructive`}),!1;try{let r=await t(`${e}/robots/${encodeURIComponent(i)}?create=true`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(r.status===409)return n({title:`Already exists`,description:`A robot named "${i}" already exists. Pick it from the dropdown or choose a different name.`,variant:`destructive`}),!1;if(!r.ok)return n({title:`Failed to create`,description:await r.text(),variant:`destructive`}),!1;let o=await r.json();return o.robot&&(a(e=>({...e,[i]:o.robot})),s(i)),!0}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]),p=(0,_.useCallback)(async r=>{try{let i=await t(`${e}/robots/${encodeURIComponent(r)}`,{method:`DELETE`});return i.ok?(a(e=>{let{[r]:t,...n}=e;return n}),s(e=>e===r?null:e),!0):(n({title:`Failed to delete`,description:await i.text(),variant:`destructive`}),!1)}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]);return{records:i,selectedName:o,selectedRecord:(0,_.useMemo)(()=>o?i[o]??null:null,[o,i]),availableNames:(0,_.useMemo)(()=>Object.keys(i).sort(),[i]),isLoading:c,selectRobot:u,clearSelection:d,createRobot:f,deleteRobot:p}},Ib=10,Lb=new Set([`RUNNING`,`QUEUED`,`SCHEDULING`]),Rb=e=>e.state===`running`||e.checkpoint_count>0,zb=e=>Lb.has((e.status?.stage??``).toUpperCase()),Bb=()=>{let{baseUrl:e,fetchWithHeaders:t}=wl(),{toast:n}=ea(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(``),{selectedRecord:h}=Fb(),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),T=(0,_.useCallback)(async()=>{try{let[n,r]=await Promise.all([ff(e,t,Ib),xf(e,t)]);i(n),o(r.jobs),c(r.models),u(r.authenticated),f(null)}catch(e){f(e instanceof Error?e.message:String(e))}},[e,t]);(0,_.useEffect)(()=>{T();let e=()=>{document.visibilityState===`visible`&&T()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,T),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,T)}},[T]),sb(T,(0,_.useCallback)(e=>{e.length!==0&&i(t=>{if(t.length===0)return t;let n=new Map(e.map(e=>[e.id,e])),r=!1,i=t.map(e=>{let t=n.get(e.id);return t?(r=!0,{...e,state:t.state,metrics:t.metrics,wandb_run_url:t.wandb_run_url,checkpoint_count:t.checkpoint_count}):e});return r?i:t})},[]));let E=async r=>{try{await gf(e,t,r),n({title:`Job stopping`}),T()}catch(e){n({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},D=(e,t)=>{S(e),w(t),v(!0)},O=async r=>{try{await _f(e,t,r),n({title:`Job removed`}),T()}catch(e){n({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},k=p.trim().toLowerCase(),A=(0,_.useCallback)(e=>!k||(e??``).toLowerCase().includes(k),[k]),j=(0,_.useMemo)(()=>r.filter(e=>A(e.name)),[r,A]),M=(0,_.useMemo)(()=>a.filter(e=>A(e.docker_image??e.space_id??e.id)),[a,A]),N=(0,_.useMemo)(()=>s.filter(e=>A(e.repo_id)),[s,A]),P=(0,_.useMemo)(()=>j.filter(e=>e.runner===`local`),[j]),F=(0,_.useMemo)(()=>j.filter(e=>e.runner===`hf_cloud`),[j]),ee=(0,_.useMemo)(()=>j.filter(e=>e.runner===`imported`),[j]),te=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_job_id).filter(e=>!!e)),[F]),ne=(0,_.useMemo)(()=>M.filter(e=>!te.has(e.id)),[M,te]),re=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_repo_id).filter(e=>!!e)),[F]),ie=(0,_.useMemo)(()=>N.filter(e=>!re.has(e.repo_id)),[N,re]),ae=(0,_.useMemo)(()=>P.filter(Rb),[P]),oe=(0,_.useMemo)(()=>P.filter(e=>!Rb(e)),[P]),se=(0,_.useMemo)(()=>F.filter(Rb),[F]),ce=(0,_.useMemo)(()=>F.filter(e=>!Rb(e)),[F]),le=(0,_.useMemo)(()=>ne.filter(zb),[ne]),ue=(0,_.useMemo)(()=>ne.filter(e=>!zb(e)),[ne]),de=oe.length+ce.length+ue.length;return(0,B.jsxs)(`section`,{className:`space-y-6`,"data-tour":`jobs-section`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`Jobs`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(Hs,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-slate-400 pointer-events-none`}),(0,B.jsx)(b_,{value:p,onChange:e=>m(e.target.value),placeholder:`Search jobs`,className:`h-8 w-48 sm:w-60 pl-8 bg-slate-800/50 border-slate-700 text-sm text-white placeholder:text-slate-500`,"aria-label":`Search jobs`})]}),(0,B.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>b(!0),className:`h-8 border-slate-700 bg-slate-800/50 text-slate-200 hover:text-white`,children:[(0,B.jsx)(Ts,{className:`w-3.5 h-3.5 mr-1.5`}),`Import model`]}),(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:T,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Refresh jobs`,children:(0,B.jsx)(zs,{className:`w-4 h-4`})})]})]}),d?(0,B.jsxs)(`p`,{className:`text-sm text-red-300`,children:[`Couldn't load jobs: `,d]}):null,(0,B.jsxs)(Y_,{defaultOpen:!0,children:[(0,B.jsxs)(X_,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Local jobs (`,ae.length,`)`]}),(0,B.jsx)(Z_,{className:`pt-3`,children:ae.length===0?(0,B.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No local jobs match your search.`:`No active local jobs. Start one from the Training page.`}):(0,B.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:ae.map(e=>(0,B.jsx)(yb,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]}),ee.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`border-t border-slate-700`}),(0,B.jsxs)(Y_,{defaultOpen:!0,children:[(0,B.jsxs)(X_,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Imported models (`,ee.length,`)`]}),(0,B.jsx)(Z_,{className:`pt-3`,children:(0,B.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:ee.map(e=>(0,B.jsx)(yb,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]})]}):null,(0,B.jsx)(`div`,{className:`border-t border-slate-700`}),(0,B.jsxs)(Y_,{defaultOpen:!0,children:[(0,B.jsxs)(X_,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Online jobs (`,se.length+le.length+ie.length,`)`]}),(0,B.jsx)(Z_,{className:`pt-3`,children:!l&&F.length===0?(0,B.jsx)(`p`,{className:`text-sm text-slate-500`,children:`Sign in with Hugging Face to see your cloud jobs.`}):se.length===0&&le.length===0&&ie.length===0?(0,B.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No online jobs match your search.`:`No active cloud jobs.`}):(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[se.map(e=>(0,B.jsx)(yb,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),le.map(e=>(0,B.jsx)(Sb,{job:e},e.id)),ie.map(e=>(0,B.jsx)(wb,{model:e},e.repo_id))]})})]}),de>0?(0,B.jsxs)(Y_,{children:[(0,B.jsxs)(X_,{className:`group flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Untracked (`,de,`)`]}),(0,B.jsx)(Z_,{className:`pt-3`,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[oe.map(e=>(0,B.jsx)(yb,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),ce.map(e=>(0,B.jsx)(yb,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),ue.map(e=>(0,B.jsx)(Sb,{job:e},e.id))]})})]}):null,x?(0,B.jsx)(Ab,{open:g,onOpenChange:v,robot:h,jobId:x.id,initialStep:C}):null,(0,B.jsx)(jb,{open:y,onOpenChange:b,onImported:T})]})},Vb=`uv tool install git+https://github.com/huggingface/leLab.git && lelab`,Hb=`http://localhost:8000/`,Ub=({open:e,onOpenChange:t,dismissible:n=!0})=>{let[r,i]=(0,_.useState)(!1),a=e=>{n||e.preventDefault()};return(0,B.jsx)($d,{open:e,onOpenChange:n?t:()=>void 0,children:(0,B.jsxs)(nf,{className:`bg-gray-900 border-gray-700 text-gray-300 sm:max-w-xl`,hideClose:!n,onEscapeKeyDown:a,onPointerDownOutside:a,onInteractOutside:a,children:[(0,B.jsxs)(rf,{className:`text-center sm:text-center min-w-0`,children:[(0,B.jsxs)(of,{className:`text-white flex items-center justify-center gap-2 text-xl`,children:[(0,B.jsx)(Ys,{className:`w-6 h-6`}),`Get Started with LeLab`]}),(0,B.jsx)(sf,{children:`LeLab runs on your machine. Click the command to copy it, then paste in a terminal:`})]}),(0,B.jsxs)(`div`,{className:`space-y-4 py-2 min-w-0`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(Vb),i(!0),setTimeout(()=>i(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},"aria-label":`Copy command to clipboard`,className:`group relative w-full bg-gray-800 hover:bg-gray-750 rounded-lg border border-gray-700 hover:border-gray-600 text-left transition-colors cursor-pointer`,children:[(0,B.jsx)(`pre`,{className:`p-4 pr-12 text-xs sm:text-sm overflow-x-auto whitespace-pre-wrap break-all`,children:(0,B.jsx)(`code`,{className:`text-green-400`,children:Vb})}),(0,B.jsx)(`span`,{className:`absolute right-2 top-2 flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 group-hover:text-white bg-gray-900/80`,children:r?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ls,{className:`w-3.5 h-3.5 text-green-400`}),`Copied`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Cs,{className:`w-3.5 h-3.5`}),`Copy`]})})]}),(0,B.jsx)(`p`,{className:`text-gray-400 text-sm text-center`,children:`After running, your browser will open the local LeLab app.`}),(0,B.jsx)(q,{asChild:!0,className:`w-full bg-blue-600 hover:bg-blue-700 text-white`,children:(0,B.jsxs)(`a`,{href:Hb,target:`_blank`,rel:`noopener noreferrer`,children:[(0,B.jsx)(Ds,{className:`w-4 h-4 mr-2`}),`Open LeLab`]})})]})]})})},Wb=()=>{let{baseUrl:e,fetchWithHeaders:t}=wl(),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),o=(0,_.useCallback)(()=>{a(!0),df(e,t).then(r).catch(()=>r([])).finally(()=>a(!1))},[e,t]);return(0,_.useEffect)(()=>{o()},[o]),{datasets:n,loading:i,refresh:o}},Gb=Ef(),Kb=()=>{let[e,t]=(0,_.useState)(Gb),{auth:n}=Dl(),{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}=Fb(),{datasets:u,loading:d}=Wb(),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(5),[x,S]=(0,_.useState)(60),[C,w]=(0,_.useState)(15),[T,E]=(0,_.useState)(!0),[D,O]=(0,_.useState)([]),k=(0,_.useRef)(null),A=ht(),{toast:j}=ea();(0,_.useEffect)(()=>{D.length>0&&(console.log(`🧹 Landing page: Cleaning up camera state from previous session`),k.current&&k.current(),O([]))},[]),(0,_.useEffect)(()=>()=>{k.current&&(console.log(`🧹 Landing page: Cleaning up camera streams on unmount`),k.current())},[]);let M=()=>{O(i?[...i.cameras??[]]:[]),p(!0)},N=e=>{p(e),!e&&k.current&&(console.log(`🧹 Modal closed: Releasing camera streams`),k.current())},P=()=>A(`/training`),F=(e,t)=>{let n=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,r=t?`https://huggingface.co/login?next=${encodeURIComponent(n)}`:`https://huggingface.co${n}`;window.open(r,`_blank`,`noopener,noreferrer`)};return(0,B.jsxs)(`div`,{className:`min-h-screen bg-black text-white pb-16`,style:{"--lelab-topbar-h":`48px`},children:[(0,B.jsx)(Gf,{}),(0,B.jsx)(`div`,{className:`sticky z-20 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70 border-b border-gray-800`,style:{top:`var(--lelab-topbar-h)`},children:(0,B.jsxs)(`div`,{className:`mx-auto max-w-7xl px-4 py-4 grid gap-4 grid-cols-1 lg:grid-cols-[1.2fr_2fr]`,children:[(0,B.jsx)(y_,{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,B.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,"data-tour":`dataset-picker`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Dataset`}),(0,B.jsx)(ob,{datasets:u,loading:d,onPickExisting:e=>{if(e.source===`local`||e.source===`both`){A(`/edit-dataset?dataset=${encodeURIComponent(e.repo_id)}`);return}F(e.repo_id,e.private)},onOpenCustom:e=>{F(e,!0)},onCreateNew:e=>{h(e),M()},children:(0,B.jsxs)(q,{variant:`outline`,role:`combobox`,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[(0,B.jsx)(`span`,{className:`truncate text-gray-300`,children:d?`Loading datasets…`:`Select or create a dataset…`}),(0,B.jsx)(ms,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})})]}),(0,B.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,"data-tour":`training-entry`,children:[(0,B.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Create a model`}),(0,B.jsx)(q,{onClick:P,className:`w-full bg-green-500 hover:bg-green-600 text-white`,children:`Training`})]})]})]})}),(0,B.jsx)(`main`,{className:`mx-auto max-w-7xl px-4 py-6`,children:(0,B.jsx)(Bb,{})}),(0,B.jsx)(qf,{}),(0,B.jsx)(Ub,{open:e,onOpenChange:t,dismissible:!Gb}),(0,B.jsx)(rb,{open:f,onOpenChange:N,robot:i,datasetName:m,setDatasetName:h,singleTask:g,setSingleTask:v,numEpisodes:y,setNumEpisodes:b,episodeTimeS:x,setEpisodeTimeS:S,resetTimeS:C,setResetTimeS:w,streamingEncoding:T,setStreamingEncoding:E,cameras:D,setCameras:O,onStart:async()=>{if(!i){j({title:`No robot selected`,description:`Select or create a robot on the Landing page first.`,variant:`destructive`});return}let e=i;if(!e.is_clean){j({title:`Robot not ready`,description:`${e.name} is missing a calibration. Configure it before recording.`,variant:`destructive`});return}if(!m||!g){j({title:`Missing dataset details`,description:`Please enter a dataset name and task description.`,variant:`destructive`});return}let t=n.status===`authenticated`?`${n.username}/${m}`:m;D.length>0&&k.current&&(console.log(`🔓 Releasing camera streams before starting recording...`),j({title:`Preparing Camera Resources`,description:`Releasing ${D.length} camera stream(s) for recording...`}),k.current(),await new Promise(e=>setTimeout(e,500)),console.log(`✅ Camera streams released, proceeding with recording...`),j({title:`Camera Resources Ready`,description:`Camera streams released successfully. Starting recording...`}));let r=D.reduce((e,t)=>(e[t.name]={type:t.type,camera_index:t.camera_index,width:t.width,height:t.height,fps:t.fps,...t.fourcc?{fourcc:t.fourcc}:{},...t.backend?{backend:t.backend}:{}},e),{}),a={leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config,dataset_repo_id:t,single_task:g,num_episodes:y,episode_time_s:x,reset_time_s:C,fps:30,video:!0,push_to_hub:!1,resume:!1,streaming_encoding:T,cameras:r};p(!1),A(`/recording`,{state:{recordingConfig:a}})},releaseStreamsRef:k})]})},qb={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Jb={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Yb=`attached`,Xb=1e3,Zb=1001,Qb=1002,$b=1003,ex=1004,tx=1005,nx=1006,rx=1007,ix=1008,ax=1009,ox=1010,sx=1011,cx=1012,lx=1013,ux=1014,dx=1015,fx=1016,px=1017,mx=1018,hx=1020,gx=35902,_x=1021,vx=1022,yx=1023,bx=1026,xx=1027,Sx=1028,Cx=1029,wx=1030,Tx=1031,Ex=1033,Dx=33776,Ox=33777,kx=33778,Ax=33779,jx=35840,Mx=35841,Nx=35842,Px=35843,Fx=36196,Ix=37492,Lx=37496,Rx=37808,zx=37809,Bx=37810,Vx=37811,Hx=37812,Ux=37813,Wx=37814,Gx=37815,Kx=37816,qx=37817,Jx=37818,Yx=37819,Xx=37820,Zx=37821,Qx=36492,$x=36494,eS=36495,tS=36283,nS=36284,rS=36285,iS=36286,aS=2300,oS=2301,sS=2302,cS=2400,lS=2401,uS=2402,dS=2500,fS=3200,pS=3201,mS=`srgb`,hS=`srgb-linear`,gS=`linear`,_S=`srgb`,vS=7680,yS=35044,bS=2e3,xS=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+SS[e>>16&255]+SS[e>>24&255]+`-`+SS[t&255]+SS[t>>8&255]+`-`+SS[t>>16&15|64]+SS[t>>24&255]+`-`+SS[n&63|128]+SS[n>>8&255]+`-`+SS[n>>16&255]+SS[n>>24&255]+SS[r&255]+SS[r>>8&255]+SS[r>>16&255]+SS[r>>24&255]).toLowerCase()}function DS(e,t,n){return Math.max(t,Math.min(n,e))}function OS(e,t){return(e%t+t)%t}function kS(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function AS(e,t,n){return e===t?0:(n-e)/(t-e)}function jS(e,t,n){return(1-n)*e+n*t}function MS(e,t,n,r){return jS(e,t,1-Math.exp(-n*r))}function NS(e,t=1){return t-Math.abs(OS(e,t*2)-t)}function PS(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function FS(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function IS(e,t){return e+Math.floor(Math.random()*(t-e+1))}function LS(e,t){return e+Math.random()*(t-e)}function RS(e){return e*(.5-Math.random())}function zS(e){e!==void 0&&(CS=e);let t=CS+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function BS(e){return e*wS}function VS(e){return e*TS}function HS(e){return(e&e-1)==0&&e!==0}function US(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function WS(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function GS(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:console.warn(`THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function KS(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function qS(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var JS={DEG2RAD:wS,RAD2DEG:TS,generateUUID:ES,clamp:DS,euclideanModulo:OS,mapLinear:kS,inverseLerp:AS,lerp:jS,damp:MS,pingpong:NS,smoothstep:PS,smootherstep:FS,randInt:IS,randFloat:LS,randFloatSpread:RS,seededRandom:zS,degToRad:BS,radToDeg:VS,isPowerOfTwo:HS,ceilPowerOfTwo:US,floorPowerOfTwo:WS,setQuaternionFromProperEuler:GS,normalize:qS,denormalize:KS},YS=class e{constructor(t=0,n=0){e.prototype.isVector2=!0,this.x=t,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=DS(this.x,e.x,t.x),this.y=DS(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=DS(this.x,e,t),this.y=DS(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(DS(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(DS(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},XS=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(o===0){e[t+0]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(u!==m||s!==d||c!==f||l!==p){let e=1-o,t=s*d+c*f+l*p+u*m,n=t>=0?1:-1,r=1-t*t;if(r>2**-52){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,o=Math.sin(o*a)/i}let i=o*n;if(s=s*e+d*i,c=c*e+f*i,l=l*e+p*i,u=u*e+m*i,e===1-o){let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<2**-52?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(DS(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let s=1-o*o;if(s<=2**-52){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this}let c=Math.sqrt(s),l=Math.atan2(c,o),u=Math.sin((1-t)*l)/c,d=Math.sin(t*l)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=r*u+this._y*d,this._z=i*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Y=class e{constructor(t=0,n=0,r=0){e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(QS.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(QS.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=DS(this.x,e.x,t.x),this.y=DS(this.y,e.y,t.y),this.z=DS(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=DS(this.x,e,t),this.y=DS(this.y,e,t),this.z=DS(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(DS(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ZS.copy(this).projectOnVector(e),this.sub(ZS)}reflect(e){return this.sub(ZS.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(DS(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},ZS=new Y,QS=new XS,$S=class e{constructor(t,n,r,i,a,o,s,c,l){e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(eC.makeScale(e,t)),this}rotate(e){return this.premultiply(eC.makeRotation(-e)),this}translate(e,t){return this.premultiply(eC.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},eC=new $S;function tC(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function nC(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function rC(){let e=nC(`canvas`);return e.style.display=`block`,e}var iC={};function aC(e){e in iC||(iC[e]=!0,console.warn(e))}function oC(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function sC(e){let t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function cC(e){let t=e.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}var lC=new $S().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),uC=new $S().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function dC(){let e={enabled:!0,workingColorSpace:hS,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=pC(e.r),e.g=pC(e.g),e.b=pC(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=mC(e.r),e.g=mC(e.g),e.b=mC(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?gS:this.spaces[e].transfer},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return aC(`THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return aC(`THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[hS]:{primaries:t,whitePoint:r,transfer:gS,toXYZ:lC,fromXYZ:uC,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:mS},outputColorSpaceConfig:{drawingBufferColorSpace:mS}},[mS]:{primaries:t,whitePoint:r,transfer:_S,toXYZ:lC,fromXYZ:uC,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:mS}}}),e}var fC=dC();function pC(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function mC(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var hC,gC=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{hC===void 0&&(hC=nC(`canvas`)),hC.width=e.width,hC.height=e.height;let t=hC.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=hC}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=nC(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0}get width(){return this.source.getSize(xC).x}get height(){return this.source.getSize(xC).y}get depth(){return this.source.getSize(xC).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Xb:e.x-=Math.floor(e.x);break;case Zb:e.x=e.x<0?0:1;break;case Qb:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Xb:e.y-=Math.floor(e.y);break;case Zb:e.y=e.y<0?0:1;break;case Qb:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};SC.DEFAULT_IMAGE=null,SC.DEFAULT_MAPPING=300,SC.DEFAULT_ANISOTROPY=1;var CC=class e{constructor(t=0,n=0,r=0,i=1){e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)s&&e>_?e_?s1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,AC),AC.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(RC),zC.subVectors(this.max,RC),MC.subVectors(e.a,RC),NC.subVectors(e.b,RC),PC.subVectors(e.c,RC),FC.subVectors(NC,MC),IC.subVectors(PC,NC),LC.subVectors(MC,PC);let t=[0,-FC.z,FC.y,0,-IC.z,IC.y,0,-LC.z,LC.y,FC.z,0,-FC.x,IC.z,0,-IC.x,LC.z,0,-LC.x,-FC.y,FC.x,0,-IC.y,IC.x,0,-LC.y,LC.x,0];return!HC(t,MC,NC,PC,zC)||(t=[1,0,0,0,1,0,0,0,1],!HC(t,MC,NC,PC,zC))?!1:(BC.crossVectors(FC,IC),t=[BC.x,BC.y,BC.z],HC(t,MC,NC,PC,zC))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,AC).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(AC).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(kC[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),kC[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),kC[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),kC[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),kC[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),kC[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),kC[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),kC[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(kC),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},kC=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],AC=new Y,jC=new OC,MC=new Y,NC=new Y,PC=new Y,FC=new Y,IC=new Y,LC=new Y,RC=new Y,zC=new Y,BC=new Y,VC=new Y;function HC(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){VC.fromArray(e,a);let o=i.x*Math.abs(VC.x)+i.y*Math.abs(VC.y)+i.z*Math.abs(VC.z),s=t.dot(VC),c=n.dot(VC),l=r.dot(VC);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var UC=new OC,WC=new Y,GC=new Y,KC=class{constructor(e=new Y,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?UC.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;WC.subVectors(e,this.center);let t=WC.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(WC,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(GC.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(WC.copy(e.center).add(GC)),this.expandByPoint(WC.copy(e.center).sub(GC))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},qC=new Y,JC=new Y,YC=new Y,XC=new Y,ZC=new Y,QC=new Y,$C=new Y,ew=class{constructor(e=new Y,t=new Y(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,qC)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=qC.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qC.copy(this.origin).addScaledVector(this.direction,t),qC.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){JC.copy(e).add(t).multiplyScalar(.5),YC.copy(t).sub(e).normalize(),XC.copy(this.origin).sub(JC);let i=e.distanceTo(t)*.5,a=-this.direction.dot(YC),o=XC.dot(this.direction),s=-XC.dot(YC),c=XC.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(JC).addScaledVector(YC,d),f}intersectSphere(e,t){qC.subVectors(e.center,this.origin);let n=qC.dot(this.direction),r=qC.dot(qC)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,qC)!==null}intersectTriangle(e,t,n,r,i){ZC.subVectors(t,e),QC.subVectors(n,e),$C.crossVectors(ZC,QC);let a=this.direction.dot($C),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;XC.subVectors(this.origin,e);let s=o*this.direction.dot(QC.crossVectors(XC,QC));if(s<0)return null;let c=o*this.direction.dot(ZC.cross(XC));if(c<0||s+c>a)return null;let l=-o*XC.dot($C);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},tw=class e{constructor(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,r=1/nw.setFromMatrixColumn(e,0).length(),i=1/nw.setFromMatrixColumn(e,1).length(),a=1/nw.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(gte,e,_te)}lookAt(e,t,n){let r=this.elements;return ow.subVectors(e,t),ow.lengthSq()===0&&(ow.z=1),ow.normalize(),iw.crossVectors(n,ow),iw.lengthSq()===0&&(Math.abs(n.z)===1?ow.x+=1e-4:ow.z+=1e-4,ow.normalize(),iw.crossVectors(n,ow)),iw.normalize(),aw.crossVectors(ow,iw),r[0]=iw.x,r[4]=aw.x,r[8]=ow.x,r[1]=iw.y,r[5]=aw.y,r[9]=ow.y,r[2]=iw.z,r[6]=aw.z,r[10]=ow.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],ee=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*ee,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*ee,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*ee,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*ee,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=u*h*c-m*d*c+m*s*f-o*h*f-u*s*g+o*d*g,v=p*d*c-l*h*c-p*s*f+a*h*f+l*s*g-a*d*g,y=l*m*c-p*u*c+p*o*f-a*m*f-l*o*g+a*u*g,b=p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h,x=t*_+n*v+r*y+i*b;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/x;return e[0]=_*S,e[1]=(m*d*i-u*h*i-m*r*f+n*h*f+u*r*g-n*d*g)*S,e[2]=(o*h*i-m*s*i+m*r*c-n*h*c-o*r*g+n*s*g)*S,e[3]=(u*s*i-o*d*i-u*r*c+n*d*c+o*r*f-n*s*f)*S,e[4]=v*S,e[5]=(l*h*i-p*d*i+p*r*f-t*h*f-l*r*g+t*d*g)*S,e[6]=(p*s*i-a*h*i-p*r*c+t*h*c+a*r*g-t*s*g)*S,e[7]=(a*d*i-l*s*i+l*r*c-t*d*c-a*r*f+t*s*f)*S,e[8]=y*S,e[9]=(p*u*i-l*m*i-p*n*f+t*m*f+l*n*g-t*u*g)*S,e[10]=(a*m*i-p*o*i+p*n*c-t*m*c-a*n*g+t*o*g)*S,e[11]=(l*o*i-a*u*i-l*n*c+t*u*c+a*n*f-t*o*f)*S,e[12]=b*S,e[13]=(l*m*r-p*u*r+p*n*d-t*m*d-l*n*h+t*u*h)*S,e[14]=(p*o*r-a*m*r-p*n*s+t*m*s+a*n*h-t*o*h)*S,e[15]=(a*u*r-l*o*r+l*n*s-t*u*s-a*n*d+t*o*d)*S,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=nw.set(r[0],r[1],r[2]).length(),a=nw.set(r[4],r[5],r[6]).length(),o=nw.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],rw.copy(this);let s=1/i,c=1/a,l=1/o;return rw.elements[0]*=s,rw.elements[1]*=s,rw.elements[2]*=s,rw.elements[4]*=c,rw.elements[5]*=c,rw.elements[6]*=c,rw.elements[8]*=l,rw.elements[9]*=l,rw.elements[10]*=l,t.setFromRotationMatrix(rw),n.x=i,n.y=a,n.z=o,this}makePerspective(e,t,n,r,i,a,o=bS){let s=this.elements,c=2*i/(t-e),l=2*i/(n-r),u=(t+e)/(t-e),d=(n+r)/(n-r),f,p;if(o===2e3)f=-(a+i)/(a-i),p=-2*a*i/(a-i);else if(o===2001)f=-a/(a-i),p=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return s[0]=c,s[4]=0,s[8]=u,s[12]=0,s[1]=0,s[5]=l,s[9]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=f,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=bS){let s=this.elements,c=1/(t-e),l=1/(n-r),u=1/(a-i),d=(t+e)*c,f=(n+r)*l,p,m;if(o===2e3)p=(a+i)*u,m=-2*u;else if(o===2001)p=i*u,m=-1*u;else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return s[0]=2*c,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-f,s[2]=0,s[6]=0,s[10]=m,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},nw=new Y,rw=new tw,gte=new Y(0,0,0),_te=new Y(1,1,1),iw=new Y,aw=new Y,ow=new Y,sw=new tw,cw=new XS,lw=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(DS(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-DS(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(DS(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-DS(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(DS(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-DS(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:console.warn(`THREE.Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return sw.makeRotationFromQuaternion(e),this.setFromRotationMatrix(sw,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return cw.setFromEuler(this),this.setFromQuaternion(cw,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};lw.DEFAULT_ORDER=`XYZ`;var uw=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Cw.subVectors(r,t),ww.subVectors(n,t),Tw.subVectors(e,t);let a=Cw.dot(Cw),o=Cw.dot(ww),s=Cw.dot(Tw),c=ww.dot(ww),l=ww.dot(Tw),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Ew)===null?!1:Ew.x>=0&&Ew.y>=0&&Ew.x+Ew.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Ew)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,Ew.x),s.addScaledVector(a,Ew.y),s.addScaledVector(o,Ew.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return Nw.setScalar(0),Pw.setScalar(0),Fw.setScalar(0),Nw.fromBufferAttribute(e,t),Pw.fromBufferAttribute(e,n),Fw.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Nw,i.x),a.addScaledVector(Pw,i.y),a.addScaledVector(Fw,i.z),a}static isFrontFacing(e,t,n,r){return Cw.subVectors(n,t),ww.subVectors(e,t),Cw.cross(ww).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Cw.subVectors(this.c,this.b),ww.subVectors(this.a,this.b),Cw.cross(ww).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;Dw.subVectors(r,n),Ow.subVectors(i,n),Aw.subVectors(e,n);let s=Dw.dot(Aw),c=Ow.dot(Aw);if(s<=0&&c<=0)return t.copy(n);jw.subVectors(e,r);let l=Dw.dot(jw),u=Ow.dot(jw);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(Dw,a);Mw.subVectors(e,i);let f=Dw.dot(Mw),p=Ow.dot(Mw);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Ow,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return kw.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(kw,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(Dw,a).addScaledVector(Ow,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Lw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Rw={h:0,s:0,l:0},zw={h:0,s:0,l:0};function Bw(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var X=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=mS){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,fC.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=fC.workingColorSpace){return this.r=e,this.g=t,this.b=n,fC.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=fC.workingColorSpace){if(e=OS(e,1),t=DS(t,0,1),n=DS(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Bw(i,r,e+1/3),this.g=Bw(i,r,e),this.b=Bw(i,r,e-1/3)}return fC.colorSpaceToWorking(this,r),this}setStyle(e,t=mS){function n(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn(`THREE.Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);console.warn(`THREE.Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=mS){let n=Lw[e.toLowerCase()];return n===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=pC(e.r),this.g=pC(e.g),this.b=pC(e.b),this}copyLinearToSRGB(e){return this.r=mC(e.r),this.g=mC(e.g),this.b=mC(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=mS){return fC.workingToColorSpace(Vw.copy(this),e),Math.round(DS(Vw.r*255,0,255))*65536+Math.round(DS(Vw.g*255,0,255))*256+Math.round(DS(Vw.b*255,0,255))}getHexString(e=mS){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=fC.workingColorSpace){fC.workingToColorSpace(Vw.copy(this),t);let n=Vw.r,r=Vw.g,i=Vw.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},Uw=class extends Hw{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new lw,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Ww=new Y,Gw=new YS,Cte=0,Kw=class{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Cte++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=yS,this.updateRanges=[],this.gpuType=dx,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rt.count&&console.warn(`THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new OC);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error(`THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2))&&(rT.copy(i).invert(),iT.copy(e.ray).applyMatrix4(rT),!(n.boundingBox!==null&&iT.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,iT)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;in.far?null:{distance:l,point:pT.clone(),object:e}}function hT(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,sT),e.getVertexPosition(c,cT),e.getVertexPosition(l,lT);let u=Tte(e,t,n,r,sT,cT,lT,fT);if(u){let e=new Y;Iw.getBarycoord(fT,sT,cT,lT,e),i&&(u.uv=Iw.getInterpolatedAttribute(i,s,c,l,e,new YS)),a&&(u.uv1=Iw.getInterpolatedAttribute(a,s,c,l,e,new YS)),o&&(u.normal=Iw.getInterpolatedAttribute(o,s,c,l,e,new Y),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new Y,materialIndex:0};Iw.getNormal(sT,cT,lT,t.normal),u.face=t,u.barycoord=e}return u}var gT=class e extends nT{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new Yw(c,3)),this.setAttribute(`normal`,new Yw(l,3)),this.setAttribute(`uv`,new Yw(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new Y;for(let a=0;a0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},yT=class extends yw{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new KC,this.projectionMatrix=new KC,this.projectionMatrixInverse=new KC,this.coordinateSystem=dS}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},bT=new Y,xT=new BS,ST=new BS,CT=class extends yT{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=gS*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(hS*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return gS*2*Math.atan(Math.tan(hS*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){bT.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(bT.x,bT.y).multiplyScalar(-e/bT.z),bT.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(bT.x,bT.y).multiplyScalar(-e/bT.z)}getViewSize(e,t){return this.getViewBounds(e,xT,ST),t.subVectors(ST,xT)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(hS*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},wT=-90,TT=1,ET=class extends yw{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new CT(wT,TT,e,t);r.layers=this.layers,this.add(r);let i=new CT(wT,TT,e,t);i.layers=this.layers,this.add(i);let a=new CT(wT,TT,e,t);a.layers=this.layers,this.add(a);let o=new CT(wT,TT,e,t);o.layers=this.layers,this.add(o);let s=new CT(wT,TT,e,t);s.layers=this.layers,this.add(s);let c=new CT(wT,TT,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,s),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},DT=class extends pC{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},OT=class extends gC{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new DT(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` +}`,bT=class extends Hw{constructor(e){super(),this.isShaderMaterial=!0,this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Ote,this.fragmentShader=kte,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=_T(e.uniforms),this.uniformsGroups=Ete(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:`t`,value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:`c`,value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:`v2`,value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:`v3`,value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:`v4`,value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:`m3`,value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:`m4`,value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},xT=class extends Sw{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new tw,this.projectionMatrix=new tw,this.projectionMatrixInverse=new tw,this.coordinateSystem=bS}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},ST=new Y,CT=new YS,wT=new YS,TT=class extends xT{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=TS*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(wS*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return TS*2*Math.atan(Math.tan(wS*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ST.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ST.x,ST.y).multiplyScalar(-e/ST.z),ST.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ST.x,ST.y).multiplyScalar(-e/ST.z)}getViewSize(e,t){return this.getViewBounds(e,CT,wT),t.subVectors(wT,CT)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(wS*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},ET=-90,DT=1,Ate=class extends Sw{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new TT(ET,DT,e,t);r.layers=this.layers,this.add(r);let i=new TT(ET,DT,e,t);i.layers=this.layers,this.add(i);let a=new TT(ET,DT,e,t);a.layers=this.layers,this.add(a);let o=new TT(ET,DT,e,t);o.layers=this.layers,this.add(o);let s=new TT(ET,DT,e,t);s.layers=this.layers,this.add(s);let c=new TT(ET,DT,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,s),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},OT=class extends SC{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},kT=class extends TC{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new OT(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -91,7 +91,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},r=new mT(5,5,5),i=new vT({name:`CubemapFromEquirect`,uniforms:hT(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new fT(r,i),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=sx),new ET(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}},kT=class extends yw{constructor(){super(),this.isGroup=!0,this.type=`Group`}},AT={type:`move`},jT=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new kT,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new kT,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new kT,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(AT)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new kT;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},MT=class extends yw{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new nw,this.environmentIntensity=1,this.environmentRotation=new nw,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},NT=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=uS,this.updateRanges=[],this.version=0,this.uuid=_S()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Mte.getNormalMatrix(e),r=this.coplanarPoint(oE).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},lE=new LC,uE=new Y,dE=class{constructor(e=new cE,t=new cE,n=new cE,r=new cE,i=new cE,a=new cE){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=dS){let n=this.planes,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15];if(n[0].setComponents(s-i,d-c,h-f,y-g).normalize(),n[1].setComponents(s+i,d+c,h+f,y+g).normalize(),n[2].setComponents(s+a,d+l,h+p,y+_).normalize(),n[3].setComponents(s-a,d-l,h-p,y-_).normalize(),n[4].setComponents(s-o,d-u,h-m,y-v).normalize(),t===2e3)n[5].setComponents(s+o,d+u,h+m,y+v).normalize();else if(t===2001)n[5].setComponents(o,u,m,v).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),lE.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),lE.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(lE)}intersectsSprite(e){return lE.center.set(0,0,0),lE.radius=.7071067811865476,lE.applyMatrix4(e.matrixWorld),this.intersectsSphere(lE)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,uE.y=r.normal.y>0?e.max.y:e.min.y,uE.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(uE)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},fE=class extends Bw{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new X(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},pE=new Y,mE=new Y,hE=new KC,gE=new GC,_E=new LC,vE=new Y,yE=new Y,bE=class extends yw{constructor(e=new eT,t=new fE){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;vE.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(vE);if(!(ct.far))return{distance:c,point:yE.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var SE=new Y,CE=new Y,wE=class extends bE{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var NE=class extends pC{constructor(e,t,n=hx,r,i,a,o=ix,s=ix,c,l=Tx,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new lC(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},PE=class e extends eT{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new qw(u,3)),this.setAttribute(`normal`,new qw(d,3)),this.setAttribute(`uv`,new qw(f,2));function _(){let a=new Y,_=new Y,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new BS,m=new Y,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e0)&&f.push(t,i,c),(e!==n-1||s0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},BE=class extends Bw{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type=`MeshPhongMaterial`,this.color=new X(16777215),this.specular=new X(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new BS(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new nw,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},VE=class extends Bw{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type=`MeshLambertMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new BS(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new nw,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},HE=class extends Bw{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=rS,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},UE=class extends Bw{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function WE(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function GE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function KE(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function qE(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function JE(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}var YE=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e=i)){let o=t[1];e=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n>>1;et;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&GE(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Qx,i=e.length-1,a=1;for(let o=1;o0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};$E.prototype.ValueTypeName=``,$E.prototype.TimeBufferType=Float32Array,$E.prototype.ValueBufferType=Float32Array,$E.prototype.DefaultInterpolation=Zx;var eD=class extends $E{constructor(e,t,n){super(e,t,n)}};eD.prototype.ValueTypeName=`bool`,eD.prototype.ValueBufferType=Array,eD.prototype.DefaultInterpolation=Xx,eD.prototype.InterpolantFactoryMethodLinear=void 0,eD.prototype.InterpolantFactoryMethodSmooth=void 0;var tD=class extends $E{constructor(e,t,n,r){super(e,t,n,r)}};tD.prototype.ValueTypeName=`color`;var nD=class extends $E{constructor(e,t,n,r){super(e,t,n,r)}};nD.prototype.ValueTypeName=`number`;var rD=class extends YE{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)VS.slerpFlat(i,0,a,c-o,a,c,s);return i}},iD=class extends $E{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new rD(this.times,this.values,this.getValueSize(),e)}};iD.prototype.ValueTypeName=`quaternion`,iD.prototype.InterpolantFactoryMethodSmooth=void 0;var aD=class extends $E{constructor(e,t,n){super(e,t,n)}};aD.prototype.ValueTypeName=`string`,aD.prototype.ValueBufferType=Array,aD.prototype.DefaultInterpolation=Xx,aD.prototype.InterpolantFactoryMethodLinear=void 0,aD.prototype.InterpolantFactoryMethodSmooth=void 0;var oD=class extends $E{constructor(e,t,n,r){super(e,t,n,r)}};oD.prototype.ValueTypeName=`vector`;var sD=class{constructor(e=``,t=-1,n=[],r=nS){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=_S(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(lD(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=n.length;e!==r;++e)t.push($E.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(console.warn(`THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185`),!e)return console.error(`THREE.AnimationClip: No animation in JSONLoader data.`),null;let n=function(e,t,n,r,i){if(n.length!==0){let a=[],o=[];JE(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.fps||30,o=e.blendMode,s=e.length||-1,c=e.hierarchy||[];for(let e=0;e{t&&t(i),this.manager.itemEnd(e)},0),i;if(mD[e]!==void 0){mD[e].push({onLoad:t,onProgress:n,onError:r});return}mD[e]=[],mD[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&console.warn(`THREE.FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=mD[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e{e.error(t)})}}});return new Response(c)}else throw new hD(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{uD.add(e,t);let n=mD[e];delete mD[e];for(let e=0,r=n.length;e{let n=mD[e];if(n===void 0)throw this.manager.itemError(e),t;delete mD[e];for(let e=0,r=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}},_D=class extends pD{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=uD.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;let o=qS(`img`);function s(){l(),uD.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){l(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}},vD=class extends pD{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new qT,o=new gD(this.manager);return o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,function(e){let n;try{n=i.parse(e)}catch(e){if(r!==void 0)r(e);else{console.error(e);return}}n.image===void 0?n.data!==void 0&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data):a.image=n.image,a.wrapS=n.wrapS===void 0?nx:n.wrapS,a.wrapT=n.wrapT===void 0?nx:n.wrapT,a.magFilter=n.magFilter===void 0?sx:n.magFilter,a.minFilter=n.minFilter===void 0?sx:n.minFilter,a.anisotropy=n.anisotropy===void 0?1:n.anisotropy,n.colorSpace!==void 0&&(a.colorSpace=n.colorSpace),n.flipY!==void 0&&(a.flipY=n.flipY),n.format!==void 0&&(a.format=n.format),n.type!==void 0&&(a.type=n.type),n.mipmaps!==void 0&&(a.mipmaps=n.mipmaps,a.minFilter=lx),n.mipmapCount===1&&(a.minFilter=sx),n.generateMipmaps!==void 0&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,r),a}},yD=class extends pD{constructor(e){super(e)}load(e,t,n,r){let i=new pC,a=new _D(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}},bD=class extends yw{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new X(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}},xD=class extends bD{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(yw.DEFAULT_UP),this.updateMatrix(),this.groundColor=new X(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},SD=new KC,CD=new Y,wD=new Y,TD=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new BS(512,512),this.mapType=ux,this.map=null,this.mapPass=null,this.matrix=new KC,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new dE,this._frameExtents=new BS(1,1),this._viewportCount=1,this._viewports=[new mC(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;CD.setFromMatrixPosition(e.matrixWorld),t.position.copy(CD),wD.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(wD),t.updateMatrixWorld(),SD.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(SD),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(SD)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},ED=class extends TD{constructor(){super(new CT(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=gS*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},DD=class extends bD{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(yw.DEFAULT_UP),this.updateMatrix(),this.target=new yw,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new ED}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},OD=new KC,kD=new Y,AD=new Y,jD=class extends TD{constructor(){super(new CT(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new BS(4,2),this._viewportCount=6,this._viewports=[new mC(2,1,1,1),new mC(0,1,1,1),new mC(3,1,1,1),new mC(1,1,1,1),new mC(3,0,1,1),new mC(1,0,1,1)],this._cubeDirections=[new Y(1,0,0),new Y(-1,0,0),new Y(0,0,1),new Y(0,0,-1),new Y(0,1,0),new Y(0,-1,0)],this._cubeUps=[new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,0,1),new Y(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),kD.setFromMatrixPosition(e.matrixWorld),n.position.copy(kD),AD.copy(n.position),AD.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(AD),n.updateMatrixWorld(),r.makeTranslation(-kD.x,-kD.y,-kD.z),OD.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(OD)}},MD=class extends bD{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new jD}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},ND=class extends yT{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},PD=class extends TD{constructor(){super(new ND(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},FD=class extends bD{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(yw.DEFAULT_UP),this.updateMatrix(),this.target=new yw,this.shadow=new PD}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},ID=class extends bD{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=`AmbientLight`}},LD=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},RD=new WeakMap,zD=class extends pD{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>`u`&&console.warn(`THREE.ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&console.warn(`THREE.ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`}}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=uD.get(e);if(a!==void 0){if(i.manager.itemStart(e),a.then){a.then(n=>{if(RD.has(a)===!0)r&&r(RD.get(a)),i.manager.itemError(e),i.manager.itemEnd(e);else return t&&t(n),i.manager.itemEnd(e),n});return}return setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a}let o={};o.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,o.headers=this.requestHeader;let s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:`none`}))}).then(function(n){return uD.add(e,n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),RD.set(s,t),uD.remove(e),i.manager.itemError(e),i.manager.itemEnd(e)});uD.add(e,s),i.manager.itemStart(e)}},BD=class extends CT{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},VD=`\\[\\]\\.:\\/`,HD=RegExp(`[\\[\\]\\.:\\/]`,`g`),UD=`[^\\[\\]\\.:\\/]`,WD=`[^`+VD.replace(`\\.`,``)+`]`,GD=`((?:WC+[\\/:])*)`.replace(`WC`,UD),KD=`(WCOD+)?`.replace(`WCOD`,WD),qD=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,UD),JD=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,UD),YD=RegExp(`^`+GD+KD+qD+JD+`$`),XD=[`material`,`materials`,`bones`,`map`],ZD=class{constructor(e,t,n){let r=n||QD.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},QD=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(HD,``)}static parseTrackName(e){let t=YD.exec(e);if(t===null)throw Error(`PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);XD.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;re.start-t.start);let t=0;for(let e=1;e.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(jte)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new AT;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},MT=class extends Sw{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new lw,this.environmentIntensity=1,this.environmentRotation=new lw,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},NT=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=yS,this.updateRanges=[],this.version=0,this.uuid=ES()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||cE.getNormalMatrix(e),r=this.coplanarPoint(oE).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},uE=new KC,dE=new Y,fE=class{constructor(e=new lE,t=new lE,n=new lE,r=new lE,i=new lE,a=new lE){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=bS){let n=this.planes,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15];if(n[0].setComponents(s-i,d-c,h-f,y-g).normalize(),n[1].setComponents(s+i,d+c,h+f,y+g).normalize(),n[2].setComponents(s+a,d+l,h+p,y+_).normalize(),n[3].setComponents(s-a,d-l,h-p,y-_).normalize(),n[4].setComponents(s-o,d-u,h-m,y-v).normalize(),t===2e3)n[5].setComponents(s+o,d+u,h+m,y+v).normalize();else if(t===2001)n[5].setComponents(o,u,m,v).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),uE.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),uE.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(uE)}intersectsSprite(e){return uE.center.set(0,0,0),uE.radius=.7071067811865476,uE.applyMatrix4(e.matrixWorld),this.intersectsSphere(uE)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,dE.y=r.normal.y>0?e.max.y:e.min.y,dE.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(dE)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},pE=class extends Hw{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new X(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},mE=new Y,hE=new Y,gE=new tw,_E=new ew,vE=new KC,yE=new Y,bE=new Y,xE=class extends Sw{constructor(e=new nT,t=new pE){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;yE.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(yE);if(!(ct.far))return{distance:c,point:bE.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var CE=new Y,wE=new Y,TE=class extends xE{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var PE=class extends SC{constructor(e,t,n=ux,r,i,a,o=$b,s=$b,c,l=bx,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new vC(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},FE=class e extends nT{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new Yw(u,3)),this.setAttribute(`normal`,new Yw(d,3)),this.setAttribute(`uv`,new Yw(f,2));function _(){let a=new Y,_=new Y,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new YS,m=new Y,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e0)&&f.push(t,i,c),(e!==n-1||s0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},VE=class extends Hw{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type=`MeshPhongMaterial`,this.color=new X(16777215),this.specular=new X(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new YS(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new lw,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},HE=class extends Hw{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type=`MeshLambertMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new YS(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new lw,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},UE=class extends Hw{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=fS,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},WE=class extends Hw{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function GE(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function KE(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qE(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function JE(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function YE(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}var XE=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e=i)){let o=t[1];e=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n>>1;et;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&KE(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===sS,i=e.length-1,a=1;for(let o=1;o0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};eD.prototype.ValueTypeName=``,eD.prototype.TimeBufferType=Float32Array,eD.prototype.ValueBufferType=Float32Array,eD.prototype.DefaultInterpolation=oS;var tD=class extends eD{constructor(e,t,n){super(e,t,n)}};tD.prototype.ValueTypeName=`bool`,tD.prototype.ValueBufferType=Array,tD.prototype.DefaultInterpolation=aS,tD.prototype.InterpolantFactoryMethodLinear=void 0,tD.prototype.InterpolantFactoryMethodSmooth=void 0;var nD=class extends eD{constructor(e,t,n,r){super(e,t,n,r)}};nD.prototype.ValueTypeName=`color`;var rD=class extends eD{constructor(e,t,n,r){super(e,t,n,r)}};rD.prototype.ValueTypeName=`number`;var iD=class extends XE{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)XS.slerpFlat(i,0,a,c-o,a,c,s);return i}},aD=class extends eD{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new iD(this.times,this.values,this.getValueSize(),e)}};aD.prototype.ValueTypeName=`quaternion`,aD.prototype.InterpolantFactoryMethodSmooth=void 0;var oD=class extends eD{constructor(e,t,n){super(e,t,n)}};oD.prototype.ValueTypeName=`string`,oD.prototype.ValueBufferType=Array,oD.prototype.DefaultInterpolation=aS,oD.prototype.InterpolantFactoryMethodLinear=void 0,oD.prototype.InterpolantFactoryMethodSmooth=void 0;var sD=class extends eD{constructor(e,t,n,r){super(e,t,n,r)}};sD.prototype.ValueTypeName=`vector`;var cD=class{constructor(e=``,t=-1,n=[],r=dS){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=ES(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(Nte(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=n.length;e!==r;++e)t.push(eD.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(console.warn(`THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185`),!e)return console.error(`THREE.AnimationClip: No animation in JSONLoader data.`),null;let n=function(e,t,n,r,i){if(n.length!==0){let a=[],o=[];YE(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.fps||30,o=e.blendMode,s=e.length||-1,c=e.hierarchy||[];for(let e=0;e{t&&t(i),this.manager.itemEnd(e)},0),i;if(pD[e]!==void 0){pD[e].push({onLoad:t,onProgress:n,onError:r});return}pD[e]=[],pD[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&console.warn(`THREE.FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=pD[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e{e.error(t)})}}});return new Response(c)}else throw new mD(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{lD.add(e,t);let n=pD[e];delete pD[e];for(let e=0,r=n.length;e{let n=pD[e];if(n===void 0)throw this.manager.itemError(e),t;delete pD[e];for(let e=0,r=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}},gD=class extends fD{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=lD.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;let o=nC(`img`);function s(){l(),lD.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){l(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}},_D=class extends fD{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new qT,o=new hD(this.manager);return o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,function(e){let n;try{n=i.parse(e)}catch(e){if(r!==void 0)r(e);else{console.error(e);return}}n.image===void 0?n.data!==void 0&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data):a.image=n.image,a.wrapS=n.wrapS===void 0?Zb:n.wrapS,a.wrapT=n.wrapT===void 0?Zb:n.wrapT,a.magFilter=n.magFilter===void 0?nx:n.magFilter,a.minFilter=n.minFilter===void 0?nx:n.minFilter,a.anisotropy=n.anisotropy===void 0?1:n.anisotropy,n.colorSpace!==void 0&&(a.colorSpace=n.colorSpace),n.flipY!==void 0&&(a.flipY=n.flipY),n.format!==void 0&&(a.format=n.format),n.type!==void 0&&(a.type=n.type),n.mipmaps!==void 0&&(a.mipmaps=n.mipmaps,a.minFilter=ix),n.mipmapCount===1&&(a.minFilter=nx),n.generateMipmaps!==void 0&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,r),a}},vD=class extends fD{constructor(e){super(e)}load(e,t,n,r){let i=new SC,a=new gD(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}},yD=class extends Sw{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new X(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}},bD=class extends yD{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(Sw.DEFAULT_UP),this.updateMatrix(),this.groundColor=new X(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},xD=new tw,SD=new Y,CD=new Y,wD=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new YS(512,512),this.mapType=ax,this.map=null,this.mapPass=null,this.matrix=new tw,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new fE,this._frameExtents=new YS(1,1),this._viewportCount=1,this._viewports=[new CC(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;SD.setFromMatrixPosition(e.matrixWorld),t.position.copy(SD),CD.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(CD),t.updateMatrixWorld(),xD.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(xD),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(xD)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},TD=class extends wD{constructor(){super(new TT(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=TS*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},ED=class extends yD{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(Sw.DEFAULT_UP),this.updateMatrix(),this.target=new Sw,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new TD}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},DD=new tw,OD=new Y,kD=new Y,AD=class extends wD{constructor(){super(new TT(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new YS(4,2),this._viewportCount=6,this._viewports=[new CC(2,1,1,1),new CC(0,1,1,1),new CC(3,1,1,1),new CC(1,1,1,1),new CC(3,0,1,1),new CC(1,0,1,1)],this._cubeDirections=[new Y(1,0,0),new Y(-1,0,0),new Y(0,0,1),new Y(0,0,-1),new Y(0,1,0),new Y(0,-1,0)],this._cubeUps=[new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,0,1),new Y(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),OD.setFromMatrixPosition(e.matrixWorld),n.position.copy(OD),kD.copy(n.position),kD.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(kD),n.updateMatrixWorld(),r.makeTranslation(-OD.x,-OD.y,-OD.z),DD.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(DD)}},jD=class extends yD{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new AD}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},MD=class extends xT{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},ND=class extends wD{constructor(){super(new MD(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},PD=class extends yD{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(Sw.DEFAULT_UP),this.updateMatrix(),this.target=new Sw,this.shadow=new ND}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},FD=class extends yD{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=`AmbientLight`}},ID=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},LD=new WeakMap,RD=class extends fD{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>`u`&&console.warn(`THREE.ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&console.warn(`THREE.ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`}}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=lD.get(e);if(a!==void 0){if(i.manager.itemStart(e),a.then){a.then(n=>{if(LD.has(a)===!0)r&&r(LD.get(a)),i.manager.itemError(e),i.manager.itemEnd(e);else return t&&t(n),i.manager.itemEnd(e),n});return}return setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a}let o={};o.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,o.headers=this.requestHeader;let s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:`none`}))}).then(function(n){return lD.add(e,n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),LD.set(s,t),lD.remove(e),i.manager.itemError(e),i.manager.itemEnd(e)});lD.add(e,s),i.manager.itemStart(e)}},zD=class extends TT{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},BD=`\\[\\]\\.:\\/`,VD=RegExp(`[\\[\\]\\.:\\/]`,`g`),HD=`[^\\[\\]\\.:\\/]`,UD=`[^`+BD.replace(`\\.`,``)+`]`,WD=`((?:WC+[\\/:])*)`.replace(`WC`,HD),GD=`(WCOD+)?`.replace(`WCOD`,UD),KD=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,HD),qD=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,HD),JD=RegExp(`^`+WD+GD+KD+qD+`$`),YD=[`material`,`materials`,`bones`,`map`],XD=class{constructor(e,t,n){let r=n||ZD.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},ZD=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(VD,``)}static parseTrackName(e){let t=JD.exec(e);if(t===null)throw Error(`PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);YD.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;re.start-t.start);let t=0;for(let e=1;e #include #include -}`},Z={common:{diffuse:{value:new X(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new WS},alphaMap:{value:null},alphaMapTransform:{value:new WS},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new WS}},envmap:{envMap:{value:null},envMapRotation:{value:new WS},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new WS}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new WS}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new WS},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new WS},normalScale:{value:new BS(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new WS},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new WS}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new WS}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new WS}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new X(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new X(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new WS},alphaTest:{value:0},uvTransform:{value:new WS}},sprite:{diffuse:{value:new X(16777215)},opacity:{value:1},center:{value:new BS(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new WS},alphaMap:{value:null},alphaMapTransform:{value:new WS},alphaTest:{value:0}}},uO={basic:{uniforms:gT([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:lO.meshbasic_vert,fragmentShader:lO.meshbasic_frag},lambert:{uniforms:gT([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new X(0)}}]),vertexShader:lO.meshlambert_vert,fragmentShader:lO.meshlambert_frag},phong:{uniforms:gT([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new X(0)},specular:{value:new X(1118481)},shininess:{value:30}}]),vertexShader:lO.meshphong_vert,fragmentShader:lO.meshphong_frag},standard:{uniforms:gT([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new X(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lO.meshphysical_vert,fragmentShader:lO.meshphysical_frag},toon:{uniforms:gT([Z.common,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new X(0)}}]),vertexShader:lO.meshtoon_vert,fragmentShader:lO.meshtoon_frag},matcap:{uniforms:gT([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:lO.meshmatcap_vert,fragmentShader:lO.meshmatcap_frag},points:{uniforms:gT([Z.points,Z.fog]),vertexShader:lO.points_vert,fragmentShader:lO.points_frag},dashed:{uniforms:gT([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lO.linedashed_vert,fragmentShader:lO.linedashed_frag},depth:{uniforms:gT([Z.common,Z.displacementmap]),vertexShader:lO.depth_vert,fragmentShader:lO.depth_frag},normal:{uniforms:gT([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),vertexShader:lO.meshnormal_vert,fragmentShader:lO.meshnormal_frag},sprite:{uniforms:gT([Z.sprite,Z.fog]),vertexShader:lO.sprite_vert,fragmentShader:lO.sprite_frag},background:{uniforms:{uvTransform:{value:new WS},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lO.background_vert,fragmentShader:lO.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new WS}},vertexShader:lO.backgroundCube_vert,fragmentShader:lO.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lO.cube_vert,fragmentShader:lO.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lO.equirect_vert,fragmentShader:lO.equirect_frag},distanceRGBA:{uniforms:gT([Z.common,Z.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lO.distanceRGBA_vert,fragmentShader:lO.distanceRGBA_frag},shadow:{uniforms:gT([Z.lights,Z.fog,{color:{value:new X(0)},opacity:{value:1}}]),vertexShader:lO.shadow_vert,fragmentShader:lO.shadow_frag}};uO.physical={uniforms:gT([uO.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new WS},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new WS},clearcoatNormalScale:{value:new BS(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new WS},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new WS},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new WS},sheen:{value:0},sheenColor:{value:new X(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new WS},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new WS},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new WS},transmissionSamplerSize:{value:new BS},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new WS},attenuationDistance:{value:0},attenuationColor:{value:new X(0)},specularColor:{value:new X(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new WS},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new WS},anisotropyVector:{value:new BS},anisotropyMap:{value:null},anisotropyMapTransform:{value:new WS}}]),vertexShader:lO.meshphysical_vert,fragmentShader:lO.meshphysical_frag};var dO={r:0,b:0,g:0},fO=new nw,pO=new KC;function mO(e,t,n,r,i,a,o){let s=new X(0),c=a===!0?0:1,l,u,d=null,f=0,p=null;function m(e){let r=e.isScene===!0?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function h(t){let n=!1,i=m(t);i===null?_(s,c):i&&i.isColor&&(_(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();a===`additive`?r.buffers.color.setClear(0,0,0,1,o):a===`alpha-blend`&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function g(t,n){let r=m(n);r&&(r.isCubeTexture||r.mapping===306)?(u===void 0&&(u=new fT(new mT(1,1,1),new vT({name:`BackgroundCubeMaterial`,uniforms:hT(uO.backgroundCube.uniforms),vertexShader:uO.backgroundCube.vertexShader,fragmentShader:uO.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute(`normal`),u.geometry.deleteAttribute(`uv`),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),fO.copy(n.backgroundRotation),fO.x*=-1,fO.y*=-1,fO.z*=-1,r.isCubeTexture&&r.isRenderTargetTexture===!1&&(fO.y*=-1,fO.z*=-1),u.material.uniforms.envMap.value=r,u.material.uniforms.flipEnvMap.value=r.isCubeTexture&&r.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(pO.makeRotationFromEuler(fO)),u.material.toneMapped=rC.getTransfer(r.colorSpace)!==cS,(d!==r||f!==r.version||p!==e.toneMapping)&&(u.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):r&&r.isTexture&&(l===void 0&&(l=new fT(new FE(2,2),new vT({name:`BackgroundMaterial`,uniforms:hT(uO.background.uniforms),vertexShader:uO.background.vertexShader,fragmentShader:uO.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=rC.getTransfer(r.colorSpace)!==cS,r.matrixAutoUpdate===!0&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}function _(t,n){t.getRGB(dO,_T(e)),r.buffers.color.setClear(dO.r,dO.g,dO.b,n,o)}function v(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),c=t,_(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,_(s,c)},render:h,addToRenderList:g,dispose:v}}function hO(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n){let i=n.wireframe===!0,a=r[e.id];a===void 0&&(a={},r[e.id]=a);let o=a[t.id];o===void 0&&(o={},a[t.id]=o);let s=o[i];return s===void 0&&(s=f(c()),o[i]=s),s}function f(e){let t=[],r=[],i=[];for(let e=0;e=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(console.warn(`THREE.WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reverseDepthBuffer===!0&&t.has(`EXT_clip_control`),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=m>0,S=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,vertexTextures:x,maxSamples:S}}function vO(e){let t=this,n=null,r=0,i=!1,a=!1,o=new cE,s=new WS,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length0){let o=new OT(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener(`dispose`,i),n(o.texture,r.mapping)}else return null}}return r}function i(e){let n=e.target;n.removeEventListener(`dispose`,i);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function a(){t=new WeakMap}return{get:r,dispose:a}}var bO=4,xO=[.125,.215,.35,.446,.526,.582],SO=20,CO=new ND,wO=new X,TO=null,EO=0,DO=0,OO=!1,kO=(1+Math.sqrt(5))/2,AO=1/kO,jO=[new Y(-kO,AO,0),new Y(kO,AO,0),new Y(-AO,0,kO),new Y(AO,0,kO),new Y(0,kO,-AO),new Y(0,kO,AO),new Y(-1,1,-1),new Y(1,1,-1),new Y(-1,1,1),new Y(1,1,1)],MO=new Y,NO=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=MO}=i;TO=this._renderer.getRenderTarget(),EO=this._renderer.getActiveCubeFace(),DO=this._renderer.getActiveMipmapLevel(),OO=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=zO(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=RO(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?l:0,l,l),c.setRenderTarget(r),p&&c.render(f,a),c.render(e,a)}f.geometry.dispose(),f.material.dispose(),c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=zO()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=RO());let i=r?this._cubemapMaterial:this._equirectMaterial,a=new fT(this._lodPlanes[0],i),o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;IO(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,CO)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;tSO&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${SO}`);let h=[],g=0;for(let e=0;e_-bO?r-_+bO:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,CO)}};function PO(e){let t=[],n=[],r=[],i=e,a=e-bO+1+xO.length;for(let o=0;oe-bO?s=xO[o-e+bO-1]:o===0&&(s=0),r.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];f.set(r,18*e),p.set(d,12*e);let i=[e,e,e,e,e,e];m.set(i,6*e)}let h=new eT;h.setAttribute(`position`,new Ww(f,3)),h.setAttribute(`uv`,new Ww(p,2)),h.setAttribute(`faceIndex`,new Ww(m,1)),t.push(h),i>bO&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}function FO(e,t,n){let r=new gC(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function IO(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function LO(e,t,n){let r=new Float32Array(SO),i=new Y(0,1,0);return new vT({name:`SphericalGaussianBlur`,defines:{n:SO,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:BO(),fragmentShader:` +}`},Z={common:{diffuse:{value:new X(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new $S},alphaMap:{value:null},alphaMapTransform:{value:new $S},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new $S}},envmap:{envMap:{value:null},envMapRotation:{value:new $S},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new $S}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new $S}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new $S},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new $S},normalScale:{value:new YS(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new $S},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new $S}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new $S}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new $S}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new X(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new X(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new $S},alphaTest:{value:0},uvTransform:{value:new $S}},sprite:{diffuse:{value:new X(16777215)},opacity:{value:1},center:{value:new YS(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new $S},alphaMap:{value:null},alphaMapTransform:{value:new $S},alphaTest:{value:0}}},uO={basic:{uniforms:vT([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:lO.meshbasic_vert,fragmentShader:lO.meshbasic_frag},lambert:{uniforms:vT([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new X(0)}}]),vertexShader:lO.meshlambert_vert,fragmentShader:lO.meshlambert_frag},phong:{uniforms:vT([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new X(0)},specular:{value:new X(1118481)},shininess:{value:30}}]),vertexShader:lO.meshphong_vert,fragmentShader:lO.meshphong_frag},standard:{uniforms:vT([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new X(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lO.meshphysical_vert,fragmentShader:lO.meshphysical_frag},toon:{uniforms:vT([Z.common,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new X(0)}}]),vertexShader:lO.meshtoon_vert,fragmentShader:lO.meshtoon_frag},matcap:{uniforms:vT([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:lO.meshmatcap_vert,fragmentShader:lO.meshmatcap_frag},points:{uniforms:vT([Z.points,Z.fog]),vertexShader:lO.points_vert,fragmentShader:lO.points_frag},dashed:{uniforms:vT([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lO.linedashed_vert,fragmentShader:lO.linedashed_frag},depth:{uniforms:vT([Z.common,Z.displacementmap]),vertexShader:lO.depth_vert,fragmentShader:lO.depth_frag},normal:{uniforms:vT([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),vertexShader:lO.meshnormal_vert,fragmentShader:lO.meshnormal_frag},sprite:{uniforms:vT([Z.sprite,Z.fog]),vertexShader:lO.sprite_vert,fragmentShader:lO.sprite_frag},background:{uniforms:{uvTransform:{value:new $S},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lO.background_vert,fragmentShader:lO.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new $S}},vertexShader:lO.backgroundCube_vert,fragmentShader:lO.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lO.cube_vert,fragmentShader:lO.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lO.equirect_vert,fragmentShader:lO.equirect_frag},distanceRGBA:{uniforms:vT([Z.common,Z.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lO.distanceRGBA_vert,fragmentShader:lO.distanceRGBA_frag},shadow:{uniforms:vT([Z.lights,Z.fog,{color:{value:new X(0)},opacity:{value:1}}]),vertexShader:lO.shadow_vert,fragmentShader:lO.shadow_frag}};uO.physical={uniforms:vT([uO.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new $S},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new $S},clearcoatNormalScale:{value:new YS(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new $S},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new $S},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new $S},sheen:{value:0},sheenColor:{value:new X(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new $S},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new $S},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new $S},transmissionSamplerSize:{value:new YS},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new $S},attenuationDistance:{value:0},attenuationColor:{value:new X(0)},specularColor:{value:new X(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new $S},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new $S},anisotropyVector:{value:new YS},anisotropyMap:{value:null},anisotropyMapTransform:{value:new $S}}]),vertexShader:lO.meshphysical_vert,fragmentShader:lO.meshphysical_frag};var dO={r:0,b:0,g:0},fO=new lw,pO=new tw;function mO(e,t,n,r,i,a,o){let s=new X(0),c=a===!0?0:1,l,u,d=null,f=0,p=null;function m(e){let r=e.isScene===!0?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function h(t){let n=!1,i=m(t);i===null?_(s,c):i&&i.isColor&&(_(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();a===`additive`?r.buffers.color.setClear(0,0,0,1,o):a===`alpha-blend`&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function g(t,n){let r=m(n);r&&(r.isCubeTexture||r.mapping===306)?(u===void 0&&(u=new mT(new gT(1,1,1),new bT({name:`BackgroundCubeMaterial`,uniforms:_T(uO.backgroundCube.uniforms),vertexShader:uO.backgroundCube.vertexShader,fragmentShader:uO.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute(`normal`),u.geometry.deleteAttribute(`uv`),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),fO.copy(n.backgroundRotation),fO.x*=-1,fO.y*=-1,fO.z*=-1,r.isCubeTexture&&r.isRenderTargetTexture===!1&&(fO.y*=-1,fO.z*=-1),u.material.uniforms.envMap.value=r,u.material.uniforms.flipEnvMap.value=r.isCubeTexture&&r.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(pO.makeRotationFromEuler(fO)),u.material.toneMapped=fC.getTransfer(r.colorSpace)!==_S,(d!==r||f!==r.version||p!==e.toneMapping)&&(u.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):r&&r.isTexture&&(l===void 0&&(l=new mT(new IE(2,2),new bT({name:`BackgroundMaterial`,uniforms:_T(uO.background.uniforms),vertexShader:uO.background.vertexShader,fragmentShader:uO.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=fC.getTransfer(r.colorSpace)!==_S,r.matrixAutoUpdate===!0&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}function _(t,n){t.getRGB(dO,yT(e)),r.buffers.color.setClear(dO.r,dO.g,dO.b,n,o)}function v(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),c=t,_(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,_(s,c)},render:h,addToRenderList:g,dispose:v}}function hO(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n){let i=n.wireframe===!0,a=r[e.id];a===void 0&&(a={},r[e.id]=a);let o=a[t.id];o===void 0&&(o={},a[t.id]=o);let s=o[i];return s===void 0&&(s=f(c()),o[i]=s),s}function f(e){let t=[],r=[],i=[];for(let e=0;e=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(console.warn(`THREE.WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reverseDepthBuffer===!0&&t.has(`EXT_clip_control`),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=m>0,S=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,vertexTextures:x,maxSamples:S}}function vO(e){let t=this,n=null,r=0,i=!1,a=!1,o=new lE,s=new $S,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length0){let o=new kT(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener(`dispose`,i),n(o.texture,r.mapping)}else return null}}return r}function i(e){let n=e.target;n.removeEventListener(`dispose`,i);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function a(){t=new WeakMap}return{get:r,dispose:a}}var bO=4,xO=[.125,.215,.35,.446,.526,.582],SO=20,CO=new MD,wO=new X,TO=null,EO=0,DO=0,OO=!1,kO=(1+Math.sqrt(5))/2,AO=1/kO,jO=[new Y(-kO,AO,0),new Y(kO,AO,0),new Y(-AO,0,kO),new Y(AO,0,kO),new Y(0,kO,-AO),new Y(0,kO,AO),new Y(-1,1,-1),new Y(1,1,-1),new Y(-1,1,1),new Y(1,1,1)],MO=new Y,NO=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=MO}=i;TO=this._renderer.getRenderTarget(),EO=this._renderer.getActiveCubeFace(),DO=this._renderer.getActiveMipmapLevel(),OO=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=zO(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=RO(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?l:0,l,l),c.setRenderTarget(r),p&&c.render(f,a),c.render(e,a)}f.geometry.dispose(),f.material.dispose(),c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=zO()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=RO());let i=r?this._cubemapMaterial:this._equirectMaterial,a=new mT(this._lodPlanes[0],i),o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;IO(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,CO)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;tSO&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${SO}`);let h=[],g=0;for(let e=0;e_-bO?r-_+bO:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,CO)}};function PO(e){let t=[],n=[],r=[],i=e,a=e-bO+1+xO.length;for(let o=0;oe-bO?s=xO[o-e+bO-1]:o===0&&(s=0),r.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];f.set(r,18*e),p.set(d,12*e);let i=[e,e,e,e,e,e];m.set(i,6*e)}let h=new nT;h.setAttribute(`position`,new Kw(f,3)),h.setAttribute(`uv`,new Kw(p,2)),h.setAttribute(`faceIndex`,new Kw(m,1)),t.push(h),i>bO&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}function FO(e,t,n){let r=new TC(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function IO(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function LO(e,t,n){let r=new Float32Array(SO),i=new Y(0,1,0);return new bT({name:`SphericalGaussianBlur`,defines:{n:SO,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:BO(),fragmentShader:` precision mediump float; precision mediump int; @@ -3677,7 +3677,7 @@ void main() { } } - `,blending:0,depthTest:!1,depthWrite:!1})}function RO(){return new vT({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:BO(),fragmentShader:` + `,blending:0,depthTest:!1,depthWrite:!1})}function RO(){return new bT({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:BO(),fragmentShader:` precision mediump float; precision mediump int; @@ -3696,7 +3696,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:0,depthTest:!1,depthWrite:!1})}function zO(){return new vT({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:BO(),fragmentShader:` + `,blending:0,depthTest:!1,depthWrite:!1})}function zO(){return new bT({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:BO(),fragmentShader:` precision mediump float; precision mediump int; @@ -3767,17 +3767,17 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function VO(e){let t=new WeakMap,n=null;function r(r){if(r&&r.isTexture){let o=r.mapping,s=o===303||o===304,c=o===301||o===302;if(s||c){let o=t.get(r),l=o===void 0?0:o.texture.pmremVersion;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return n===null&&(n=new NO(e)),o=s?n.fromEquirectangular(r,o):n.fromCubemap(r,o),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),o.texture;if(o!==void 0)return o.texture;{let l=r.image;return s&&l&&l.height>0||c&&l&&i(l)?(n===null&&(n=new NO(e)),o=s?n.fromEquirectangular(r):n.fromCubemap(r),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),r.addEventListener(`dispose`,a),o.texture):null}}}return r}function i(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function a(e){let n=e.target;n.removeEventListener(`dispose`,a);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function o(){t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function HO(e){let t={};function n(n){if(t[n]!==void 0)return t[n];let r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return n(e)!==null},init:function(){n(`EXT_color_buffer_float`),n(`WEBGL_clip_cull_distance`),n(`OES_texture_float_linear`),n(`EXT_color_buffer_half_float`),n(`WEBGL_multisampled_render_to_texture`),n(`WEBGL_render_shared_exponent`)},get:function(e){let t=n(e);return t===null&&XS(`THREE.WebGLRenderer: `+e+` extension not supported.`),t}}}function UO(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0?t:(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++,t)}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;tt.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*u),g=new _C(h,p,m,u);g.type=gx,g.needsUpdate=!0;let _=f*4;for(let t=0;t0)return e;let i=t*n,a=$O[i];if(a===void 0&&(a=new Float32Array(i),$O[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function ak(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n0||c&&l&&i(l)?(n===null&&(n=new NO(e)),o=s?n.fromEquirectangular(r):n.fromCubemap(r),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),r.addEventListener(`dispose`,a),o.texture):null}}}return r}function i(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function a(e){let n=e.target;n.removeEventListener(`dispose`,a);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function o(){t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function HO(e){let t={};function n(n){if(t[n]!==void 0)return t[n];let r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return n(e)!==null},init:function(){n(`EXT_color_buffer_float`),n(`WEBGL_clip_cull_distance`),n(`OES_texture_float_linear`),n(`EXT_color_buffer_half_float`),n(`WEBGL_multisampled_render_to_texture`),n(`WEBGL_render_shared_exponent`)},get:function(e){let t=n(e);return t===null&&aC(`THREE.WebGLRenderer: `+e+` extension not supported.`),t}}}function UO(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0?t:(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++,t)}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;tt.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*u),g=new EC(h,p,m,u);g.type=dx,g.needsUpdate=!0;let _=f*4;for(let t=0;t0)return e;let i=t*n,a=$O[i];if(a===void 0&&(a=new Float32Array(i),$O[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function ak(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n`:` `} ${i}: ${n[e]}`)}return r.join(` -`)}var _k=new WS;function vk(e){rC._getMatrix(_k,rC.workingColorSpace,e);let t=`mat3( ${_k.elements.map(e=>e.toFixed(4))} )`;switch(rC.getTransfer(e)){case sS:return[t,`LinearTransferOETF`];case cS:return[t,`sRGBTransferOETF`];default:return console.warn(`THREE.WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function yk(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+` +`)}var Ck=new $S;function gne(e){fC._getMatrix(Ck,fC.workingColorSpace,e);let t=`mat3( ${Ck.elements.map(e=>e.toFixed(4))} )`;switch(fC.getTransfer(e)){case gS:return[t,`LinearTransferOETF`];case _S:return[t,`sRGBTransferOETF`];default:return console.warn(`THREE.WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function wk(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+` `+i+` -`+gk(e.getShaderSource(t),r)}else return i}function bk(e,t){let n=vk(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,`}`].join(` -`)}function xk(e,t){let n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Cineon`;break;case 4:n=`ACESFilmic`;break;case 6:n=`AgX`;break;case 7:n=`Neutral`;break;case 5:n=`Custom`;break;default:console.warn(`THREE.WebGLProgram: Unsupported toneMapping:`,t),n=`Linear`}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}var Sk=new Y;function Ck(){return rC.getLuminanceCoefficients(Sk),[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${Sk.x.toFixed(4)}, ${Sk.y.toFixed(4)}, ${Sk.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(` -`)}function wk(e){return[e.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,e.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(Dk).join(` -`)}function Tk(e){let t=[];for(let n in e){let r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(` -`)}function Ek(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function jk(e){return e.replace(Ak,Nk)}var Mk=new Map;function Nk(e,t){let n=lO[t];if(n===void 0){let e=Mk.get(t);if(e!==void 0)n=lO[e],console.warn(`THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`Can not resolve #include <`+t+`>`)}return jk(n)}var Pk=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Fk(e){return e.replace(Pk,Ik)}function Ik(e,t,n,r){let i=``;for(let e=parseInt(t);e/gm;function kk(e){return e.replace(Cne,Ak)}var wne=new Map;function Ak(e,t){let n=lO[t];if(n===void 0){let e=wne.get(t);if(e!==void 0)n=lO[e],console.warn(`THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`Can not resolve #include <`+t+`>`)}return kk(n)}var jk=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Mk(e){return e.replace(jk,Nk)}function Nk(e,t,n,r){let i=``;for(let e=parseInt(t);e0&&(g+=` -`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(Dk).join(` +`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(Ek).join(` `),_.length>0&&(_+=` -`)):(g=[Lk(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionClipCullDistance?`#define USE_CLIP_DISTANCE`:``,n.batching?`#define USE_BATCHING`:``,n.batchingColor?`#define USE_BATCHING_COLOR`:``,n.instancing?`#define USE_INSTANCING`:``,n.instancingColor?`#define USE_INSTANCING_COLOR`:``,n.instancingMorph?`#define USE_INSTANCING_MORPH`:``,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.displacementMap?`#define USE_DISPLACEMENTMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.mapUv?`#define MAP_UV `+n.mapUv:``,n.alphaMapUv?`#define ALPHAMAP_UV `+n.alphaMapUv:``,n.lightMapUv?`#define LIGHTMAP_UV `+n.lightMapUv:``,n.aoMapUv?`#define AOMAP_UV `+n.aoMapUv:``,n.emissiveMapUv?`#define EMISSIVEMAP_UV `+n.emissiveMapUv:``,n.bumpMapUv?`#define BUMPMAP_UV `+n.bumpMapUv:``,n.normalMapUv?`#define NORMALMAP_UV `+n.normalMapUv:``,n.displacementMapUv?`#define DISPLACEMENTMAP_UV `+n.displacementMapUv:``,n.metalnessMapUv?`#define METALNESSMAP_UV `+n.metalnessMapUv:``,n.roughnessMapUv?`#define ROUGHNESSMAP_UV `+n.roughnessMapUv:``,n.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+n.anisotropyMapUv:``,n.clearcoatMapUv?`#define CLEARCOATMAP_UV `+n.clearcoatMapUv:``,n.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+n.clearcoatNormalMapUv:``,n.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+n.clearcoatRoughnessMapUv:``,n.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+n.iridescenceMapUv:``,n.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+n.iridescenceThicknessMapUv:``,n.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+n.sheenColorMapUv:``,n.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+n.sheenRoughnessMapUv:``,n.specularMapUv?`#define SPECULARMAP_UV `+n.specularMapUv:``,n.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+n.specularColorMapUv:``,n.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+n.specularIntensityMapUv:``,n.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+n.transmissionMapUv:``,n.thicknessMapUv?`#define THICKNESSMAP_UV `+n.thicknessMapUv:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.morphColors?`#define USE_MORPHCOLORS`:``,n.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+n.morphTextureStride:``,n.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+n.morphTargetsCount:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,` -`].filter(Dk).join(` -`),_=[Lk(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.maxMip+`.0`:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoat?`#define USE_CLEARCOAT`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.dispersion?`#define USE_DISPERSION`:``,n.iridescence?`#define USE_IRIDESCENCE`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaTest?`#define USE_ALPHATEST`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.sheen?`#define USE_SHEEN`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor||n.batchingColor?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,n.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:lO.tonemapping_pars_fragment,n.toneMapping===0?``:xk(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,lO.colorspace_pars_fragment,bk(`linearToOutputTexel`,n.outputColorSpace),Ck(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,` -`].filter(Dk).join(` -`)),o=jk(o),o=Ok(o,n),o=kk(o,n),s=jk(s),s=Ok(s,n),s=kk(s,n),o=Fk(o),s=Fk(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es +`)):(g=[Pk(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionClipCullDistance?`#define USE_CLIP_DISTANCE`:``,n.batching?`#define USE_BATCHING`:``,n.batchingColor?`#define USE_BATCHING_COLOR`:``,n.instancing?`#define USE_INSTANCING`:``,n.instancingColor?`#define USE_INSTANCING_COLOR`:``,n.instancingMorph?`#define USE_INSTANCING_MORPH`:``,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.displacementMap?`#define USE_DISPLACEMENTMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.mapUv?`#define MAP_UV `+n.mapUv:``,n.alphaMapUv?`#define ALPHAMAP_UV `+n.alphaMapUv:``,n.lightMapUv?`#define LIGHTMAP_UV `+n.lightMapUv:``,n.aoMapUv?`#define AOMAP_UV `+n.aoMapUv:``,n.emissiveMapUv?`#define EMISSIVEMAP_UV `+n.emissiveMapUv:``,n.bumpMapUv?`#define BUMPMAP_UV `+n.bumpMapUv:``,n.normalMapUv?`#define NORMALMAP_UV `+n.normalMapUv:``,n.displacementMapUv?`#define DISPLACEMENTMAP_UV `+n.displacementMapUv:``,n.metalnessMapUv?`#define METALNESSMAP_UV `+n.metalnessMapUv:``,n.roughnessMapUv?`#define ROUGHNESSMAP_UV `+n.roughnessMapUv:``,n.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+n.anisotropyMapUv:``,n.clearcoatMapUv?`#define CLEARCOATMAP_UV `+n.clearcoatMapUv:``,n.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+n.clearcoatNormalMapUv:``,n.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+n.clearcoatRoughnessMapUv:``,n.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+n.iridescenceMapUv:``,n.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+n.iridescenceThicknessMapUv:``,n.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+n.sheenColorMapUv:``,n.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+n.sheenRoughnessMapUv:``,n.specularMapUv?`#define SPECULARMAP_UV `+n.specularMapUv:``,n.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+n.specularColorMapUv:``,n.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+n.specularIntensityMapUv:``,n.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+n.transmissionMapUv:``,n.thicknessMapUv?`#define THICKNESSMAP_UV `+n.thicknessMapUv:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.morphColors?`#define USE_MORPHCOLORS`:``,n.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+n.morphTextureStride:``,n.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+n.morphTargetsCount:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,` +`].filter(Ek).join(` +`),_=[Pk(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.maxMip+`.0`:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoat?`#define USE_CLEARCOAT`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.dispersion?`#define USE_DISPERSION`:``,n.iridescence?`#define USE_IRIDESCENCE`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaTest?`#define USE_ALPHATEST`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.sheen?`#define USE_SHEEN`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor||n.batchingColor?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,n.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:lO.tonemapping_pars_fragment,n.toneMapping===0?``:vne(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,lO.colorspace_pars_fragment,_ne(`linearToOutputTexel`,n.outputColorSpace),yne(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,` +`].filter(Ek).join(` +`)),o=kk(o),o=Dk(o,n),o=Ok(o,n),s=kk(s),s=Dk(s,n),s=Ok(s,n),o=Mk(o),s=Mk(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es `,g=[p,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(` `)+` `+g,_=[`#define varying in`,n.glslVersion===`300 es`?``:`layout(location = 0) out highp vec4 pc_fragColor;`,n.glslVersion===`300 es`?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(` `)+` -`+_);let y=v+g+o,b=v+_+s,x=pk(i,i.VERTEX_SHADER,y),S=pk(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.morphTargets===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h).trim(),r=i.getShaderInfoLog(x).trim(),a=i.getShaderInfoLog(S).trim(),o=!0,s=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1)if(o=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=yk(i,x,`vertex`),r=yk(i,S,`fragment`);console.error(`THREE.WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+` +`+_);let y=v+g+o,b=v+_+s,x=Sk(i,i.VERTEX_SHADER,y),S=Sk(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.morphTargets===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h).trim(),r=i.getShaderInfoLog(x).trim(),a=i.getShaderInfoLog(S).trim(),o=!0,s=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1)if(o=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=wk(i,x,`vertex`),r=wk(i,S,`fragment`);console.error(`THREE.WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+` Material Name: `+t.name+` Material Type: `+t.type+` Program Info Log: `+n+` `+e+` -`+r)}else n===``?(r===``||a===``)&&(s=!1):console.warn(`THREE.WebGLProgram: Program Info Log:`,n);s&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:r,prefix:g},fragmentShader:{log:a,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new fk(i,h),T=Ek(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,mk)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=hk++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}var Wk=0,Gk=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Kk(e),t.set(e,n)),n}},Kk=class{constructor(e){this.id=Wk++,this.code=e,this.usedTimes=0}};function qk(e,t,n,r,i,a,o){let s=new rw,c=new Gk,l=new Set,u=[],d=i.logarithmicDepthBuffer,f=i.vertexTextures,p=i.precision,m={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`};function h(e){return l.add(e),e===0?`uv`:`uv${e}`}function g(a,s,u,g,_){let v=g.fog,y=_.geometry,b=a.isMeshStandardMaterial?g.environment:null,x=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),S=x&&x.mapping===306?x.image.height:null,C=m[a.type];a.precision!==null&&(p=i.getMaxPrecision(a.precision),p!==a.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,a.precision,`not supported, using`,p,`instead.`));let w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,T=w===void 0?0:w.length,E=0;y.morphAttributes.position!==void 0&&(E=1),y.morphAttributes.normal!==void 0&&(E=2),y.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=uO[C];D=e.vertexShader,O=e.fragmentShader}else D=a.vertexShader,O=a.fragmentShader,c.update(a),k=c.getVertexShaderID(a),A=c.getFragmentShaderID(a);let j=e.getRenderTarget(),M=e.state.buffers.depth.getReversed(),N=_.isInstancedMesh===!0,P=_.isBatchedMesh===!0,F=!!a.map,ee=!!a.matcap,te=!!x,ne=!!a.aoMap,re=!!a.lightMap,ie=!!a.bumpMap,ae=!!a.normalMap,oe=!!a.displacementMap,se=!!a.emissiveMap,ce=!!a.metalnessMap,le=!!a.roughnessMap,ue=a.anisotropy>0,de=a.clearcoat>0,fe=a.dispersion>0,I=a.iridescence>0,pe=a.sheen>0,me=a.transmission>0,he=ue&&!!a.anisotropyMap,L=de&&!!a.clearcoatMap,ge=de&&!!a.clearcoatNormalMap,R=de&&!!a.clearcoatRoughnessMap,_e=I&&!!a.iridescenceMap,ve=I&&!!a.iridescenceThicknessMap,ye=pe&&!!a.sheenColorMap,be=pe&&!!a.sheenRoughnessMap,xe=!!a.specularMap,Se=!!a.specularColorMap,Ce=!!a.specularIntensityMap,we=me&&!!a.transmissionMap,Te=me&&!!a.thicknessMap,Ee=!!a.gradientMap,De=!!a.alphaMap,Oe=a.alphaTest>0,ke=!!a.alphaHash,Ae=!!a.extensions,je=0;a.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(je=e.toneMapping);let Me={shaderID:C,shaderType:a.type,shaderName:a.name,vertexShader:D,fragmentShader:O,defines:a.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:a.isRawShaderMaterial===!0,glslVersion:a.glslVersion,precision:p,batching:P,batchingColor:P&&_._colorsTexture!==null,instancing:N,instancingColor:N&&_.instanceColor!==null,instancingMorph:N&&_.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:j===null?e.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:oS,alphaToCoverage:!!a.alphaToCoverage,map:F,matcap:ee,envMap:te,envMapMode:te&&x.mapping,envMapCubeUVHeight:S,aoMap:ne,lightMap:re,bumpMap:ie,normalMap:ae,displacementMap:f&&oe,emissiveMap:se,normalMapObjectSpace:ae&&a.normalMapType===1,normalMapTangentSpace:ae&&a.normalMapType===0,metalnessMap:ce,roughnessMap:le,anisotropy:ue,anisotropyMap:he,clearcoat:de,clearcoatMap:L,clearcoatNormalMap:ge,clearcoatRoughnessMap:R,dispersion:fe,iridescence:I,iridescenceMap:_e,iridescenceThicknessMap:ve,sheen:pe,sheenColorMap:ye,sheenRoughnessMap:be,specularMap:xe,specularColorMap:Se,specularIntensityMap:Ce,transmission:me,transmissionMap:we,thicknessMap:Te,gradientMap:Ee,opaque:a.transparent===!1&&a.blending===1&&a.alphaToCoverage===!1,alphaMap:De,alphaTest:Oe,alphaHash:ke,combine:a.combine,mapUv:F&&h(a.map.channel),aoMapUv:ne&&h(a.aoMap.channel),lightMapUv:re&&h(a.lightMap.channel),bumpMapUv:ie&&h(a.bumpMap.channel),normalMapUv:ae&&h(a.normalMap.channel),displacementMapUv:oe&&h(a.displacementMap.channel),emissiveMapUv:se&&h(a.emissiveMap.channel),metalnessMapUv:ce&&h(a.metalnessMap.channel),roughnessMapUv:le&&h(a.roughnessMap.channel),anisotropyMapUv:he&&h(a.anisotropyMap.channel),clearcoatMapUv:L&&h(a.clearcoatMap.channel),clearcoatNormalMapUv:ge&&h(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:R&&h(a.clearcoatRoughnessMap.channel),iridescenceMapUv:_e&&h(a.iridescenceMap.channel),iridescenceThicknessMapUv:ve&&h(a.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&h(a.sheenColorMap.channel),sheenRoughnessMapUv:be&&h(a.sheenRoughnessMap.channel),specularMapUv:xe&&h(a.specularMap.channel),specularColorMapUv:Se&&h(a.specularColorMap.channel),specularIntensityMapUv:Ce&&h(a.specularIntensityMap.channel),transmissionMapUv:we&&h(a.transmissionMap.channel),thicknessMapUv:Te&&h(a.thicknessMap.channel),alphaMapUv:De&&h(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(ae||ue),vertexColors:a.vertexColors,vertexAlphas:a.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,pointsUvs:_.isPoints===!0&&!!y.attributes.uv&&(F||De),fog:!!v,useFog:a.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:a.flatShading===!0,sizeAttenuation:a.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:M,skinning:_.isSkinnedMesh===!0,morphTargets:y.morphAttributes.position!==void 0,morphNormals:y.morphAttributes.normal!==void 0,morphColors:y.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:je,decodeVideoTexture:F&&a.map.isVideoTexture===!0&&rC.getTransfer(a.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:se&&a.emissiveMap.isVideoTexture===!0&&rC.getTransfer(a.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===2,flipSided:a.side===1,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:Ae&&a.extensions.clipCullDistance===!0&&r.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(Ae&&a.extensions.multiDraw===!0||P)&&r.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:r.has(`KHR_parallel_shader_compile`),customProgramCacheKey:a.customProgramCacheKey()};return Me.vertexUv1s=l.has(1),Me.vertexUv2s=l.has(2),Me.vertexUv3s=l.has(3),l.clear(),Me}function _(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(v(n,t),y(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function v(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function y(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0),t.instancing&&s.enable(1),t.instancingColor&&s.enable(2),t.instancingMorph&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),t.alphaHash&&s.enable(18),t.batching&&s.enable(19),t.dispersion&&s.enable(20),t.batchingColor&&s.enable(21),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.reverseDepthBuffer&&s.enable(4),t.skinning&&s.enable(5),t.morphTargets&&s.enable(6),t.morphNormals&&s.enable(7),t.morphColors&&s.enable(8),t.premultipliedAlpha&&s.enable(9),t.shadowMapEnabled&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.opaque&&s.enable(17),t.pointsUvs&&s.enable(18),t.decodeVideoTexture&&s.enable(19),t.decodeVideoTextureEmissive&&s.enable(20),t.alphaToCoverage&&s.enable(21),e.push(s.mask)}function b(e){let t=m[e.type],n;if(t){let e=uO[t];n=kte.clone(e.uniforms)}else n=e.uniforms;return n}function x(t,n){let r;for(let e=0,t=u.length;e0?r.push(u):a.transparent===!0?i.push(u):n.push(u)}function c(e,t,a,s,c,l){let u=o(e,t,a,s,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function l(e,t){n.length>1&&n.sort(e||Yk),r.length>1&&r.sort(t||Xk),i.length>1&&i.sort(t||Xk)}function u(){for(let n=t,r=e.length;n=r.length?(i=new Zk,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function $k(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={direction:new Y,color:new X};break;case`SpotLight`:n={position:new Y,direction:new Y,color:new X,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new Y,color:new X,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new Y,skyColor:new X,groundColor:new X};break;case`RectAreaLight`:n={color:new X,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return e[t.id]=n,n}}}function eA(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new BS};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new BS};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new BS,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var tA=0;function nA(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function rA(e){let t=new $k,n=eA(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new Y);let i=new Y,a=new KC,o=new KC;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;i.sort(nA);for(let e=0,y=i.length;e0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=Z.LTC_FLOAT_1,r.rectAreaLTC2=Z.LTC_FLOAT_2):(r.rectAreaLTC1=Z.LTC_HALF_1,r.rectAreaLTC2=Z.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let y=r.hash;(y.directionalLength!==c||y.pointLength!==l||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==f||y.numDirectionalShadows!==p||y.numPointShadows!==m||y.numSpotShadows!==h||y.numSpotMaps!==g||y.numLightProbes!==v)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=l,r.hemi.length=f,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=h,r.spotShadowMap.length=h,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=h+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,y.directionalLength=c,y.pointLength=l,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=f,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=h,y.numSpotMaps=g,y.numLightProbes=v,r.version=tA++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t=i.length?(a=new iA(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}var oA=`void main() { +`+r)}else n===``?(r===``||a===``)&&(s=!1):console.warn(`THREE.WebGLProgram: Program Info Log:`,n);s&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:r,prefix:g},fragmentShader:{log:a,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new xk(i,h),T=Sne(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,pne)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=mne++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}var Vk=0,Hk=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new Uk(e),t.set(e,n)),n}},Uk=class{constructor(e){this.id=Vk++,this.code=e,this.usedTimes=0}};function Wk(e,t,n,r,i,a,o){let s=new uw,c=new Hk,l=new Set,u=[],d=i.logarithmicDepthBuffer,f=i.vertexTextures,p=i.precision,m={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`};function h(e){return l.add(e),e===0?`uv`:`uv${e}`}function g(a,s,u,g,_){let v=g.fog,y=_.geometry,b=a.isMeshStandardMaterial?g.environment:null,x=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),S=x&&x.mapping===306?x.image.height:null,C=m[a.type];a.precision!==null&&(p=i.getMaxPrecision(a.precision),p!==a.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,a.precision,`not supported, using`,p,`instead.`));let w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,T=w===void 0?0:w.length,E=0;y.morphAttributes.position!==void 0&&(E=1),y.morphAttributes.normal!==void 0&&(E=2),y.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=uO[C];D=e.vertexShader,O=e.fragmentShader}else D=a.vertexShader,O=a.fragmentShader,c.update(a),k=c.getVertexShaderID(a),A=c.getFragmentShaderID(a);let j=e.getRenderTarget(),M=e.state.buffers.depth.getReversed(),N=_.isInstancedMesh===!0,P=_.isBatchedMesh===!0,F=!!a.map,ee=!!a.matcap,te=!!x,ne=!!a.aoMap,re=!!a.lightMap,ie=!!a.bumpMap,ae=!!a.normalMap,oe=!!a.displacementMap,se=!!a.emissiveMap,ce=!!a.metalnessMap,le=!!a.roughnessMap,ue=a.anisotropy>0,de=a.clearcoat>0,fe=a.dispersion>0,I=a.iridescence>0,pe=a.sheen>0,me=a.transmission>0,he=ue&&!!a.anisotropyMap,L=de&&!!a.clearcoatMap,ge=de&&!!a.clearcoatNormalMap,R=de&&!!a.clearcoatRoughnessMap,_e=I&&!!a.iridescenceMap,ve=I&&!!a.iridescenceThicknessMap,ye=pe&&!!a.sheenColorMap,be=pe&&!!a.sheenRoughnessMap,xe=!!a.specularMap,Se=!!a.specularColorMap,Ce=!!a.specularIntensityMap,we=me&&!!a.transmissionMap,Te=me&&!!a.thicknessMap,Ee=!!a.gradientMap,De=!!a.alphaMap,Oe=a.alphaTest>0,ke=!!a.alphaHash,Ae=!!a.extensions,je=0;a.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(je=e.toneMapping);let Me={shaderID:C,shaderType:a.type,shaderName:a.name,vertexShader:D,fragmentShader:O,defines:a.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:a.isRawShaderMaterial===!0,glslVersion:a.glslVersion,precision:p,batching:P,batchingColor:P&&_._colorsTexture!==null,instancing:N,instancingColor:N&&_.instanceColor!==null,instancingMorph:N&&_.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:j===null?e.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:hS,alphaToCoverage:!!a.alphaToCoverage,map:F,matcap:ee,envMap:te,envMapMode:te&&x.mapping,envMapCubeUVHeight:S,aoMap:ne,lightMap:re,bumpMap:ie,normalMap:ae,displacementMap:f&&oe,emissiveMap:se,normalMapObjectSpace:ae&&a.normalMapType===1,normalMapTangentSpace:ae&&a.normalMapType===0,metalnessMap:ce,roughnessMap:le,anisotropy:ue,anisotropyMap:he,clearcoat:de,clearcoatMap:L,clearcoatNormalMap:ge,clearcoatRoughnessMap:R,dispersion:fe,iridescence:I,iridescenceMap:_e,iridescenceThicknessMap:ve,sheen:pe,sheenColorMap:ye,sheenRoughnessMap:be,specularMap:xe,specularColorMap:Se,specularIntensityMap:Ce,transmission:me,transmissionMap:we,thicknessMap:Te,gradientMap:Ee,opaque:a.transparent===!1&&a.blending===1&&a.alphaToCoverage===!1,alphaMap:De,alphaTest:Oe,alphaHash:ke,combine:a.combine,mapUv:F&&h(a.map.channel),aoMapUv:ne&&h(a.aoMap.channel),lightMapUv:re&&h(a.lightMap.channel),bumpMapUv:ie&&h(a.bumpMap.channel),normalMapUv:ae&&h(a.normalMap.channel),displacementMapUv:oe&&h(a.displacementMap.channel),emissiveMapUv:se&&h(a.emissiveMap.channel),metalnessMapUv:ce&&h(a.metalnessMap.channel),roughnessMapUv:le&&h(a.roughnessMap.channel),anisotropyMapUv:he&&h(a.anisotropyMap.channel),clearcoatMapUv:L&&h(a.clearcoatMap.channel),clearcoatNormalMapUv:ge&&h(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:R&&h(a.clearcoatRoughnessMap.channel),iridescenceMapUv:_e&&h(a.iridescenceMap.channel),iridescenceThicknessMapUv:ve&&h(a.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&h(a.sheenColorMap.channel),sheenRoughnessMapUv:be&&h(a.sheenRoughnessMap.channel),specularMapUv:xe&&h(a.specularMap.channel),specularColorMapUv:Se&&h(a.specularColorMap.channel),specularIntensityMapUv:Ce&&h(a.specularIntensityMap.channel),transmissionMapUv:we&&h(a.transmissionMap.channel),thicknessMapUv:Te&&h(a.thicknessMap.channel),alphaMapUv:De&&h(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(ae||ue),vertexColors:a.vertexColors,vertexAlphas:a.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,pointsUvs:_.isPoints===!0&&!!y.attributes.uv&&(F||De),fog:!!v,useFog:a.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:a.flatShading===!0,sizeAttenuation:a.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:M,skinning:_.isSkinnedMesh===!0,morphTargets:y.morphAttributes.position!==void 0,morphNormals:y.morphAttributes.normal!==void 0,morphColors:y.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:je,decodeVideoTexture:F&&a.map.isVideoTexture===!0&&fC.getTransfer(a.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:se&&a.emissiveMap.isVideoTexture===!0&&fC.getTransfer(a.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===2,flipSided:a.side===1,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:Ae&&a.extensions.clipCullDistance===!0&&r.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(Ae&&a.extensions.multiDraw===!0||P)&&r.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:r.has(`KHR_parallel_shader_compile`),customProgramCacheKey:a.customProgramCacheKey()};return Me.vertexUv1s=l.has(1),Me.vertexUv2s=l.has(2),Me.vertexUv3s=l.has(3),l.clear(),Me}function _(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(v(n,t),y(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function v(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function y(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0),t.instancing&&s.enable(1),t.instancingColor&&s.enable(2),t.instancingMorph&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),t.alphaHash&&s.enable(18),t.batching&&s.enable(19),t.dispersion&&s.enable(20),t.batchingColor&&s.enable(21),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.reverseDepthBuffer&&s.enable(4),t.skinning&&s.enable(5),t.morphTargets&&s.enable(6),t.morphNormals&&s.enable(7),t.morphColors&&s.enable(8),t.premultipliedAlpha&&s.enable(9),t.shadowMapEnabled&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.opaque&&s.enable(17),t.pointsUvs&&s.enable(18),t.decodeVideoTexture&&s.enable(19),t.decodeVideoTextureEmissive&&s.enable(20),t.alphaToCoverage&&s.enable(21),e.push(s.mask)}function b(e){let t=m[e.type],n;if(t){let e=uO[t];n=Dte.clone(e.uniforms)}else n=e.uniforms;return n}function x(t,n){let r;for(let e=0,t=u.length;e0?r.push(u):a.transparent===!0?i.push(u):n.push(u)}function c(e,t,a,s,c,l){let u=o(e,t,a,s,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function l(e,t){n.length>1&&n.sort(e||Kk),r.length>1&&r.sort(t||qk),i.length>1&&i.sort(t||qk)}function u(){for(let n=t,r=e.length;n=r.length?(i=new Jk,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function Xk(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={direction:new Y,color:new X};break;case`SpotLight`:n={position:new Y,direction:new Y,color:new X,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new Y,color:new X,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new Y,skyColor:new X,groundColor:new X};break;case`RectAreaLight`:n={color:new X,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return e[t.id]=n,n}}}function Zk(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new YS};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new YS};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new YS,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var Qk=0;function $k(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function eA(e){let t=new Xk,n=Zk(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new Y);let i=new Y,a=new tw,o=new tw;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;i.sort($k);for(let e=0,y=i.length;e0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=Z.LTC_FLOAT_1,r.rectAreaLTC2=Z.LTC_FLOAT_2):(r.rectAreaLTC1=Z.LTC_HALF_1,r.rectAreaLTC2=Z.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let y=r.hash;(y.directionalLength!==c||y.pointLength!==l||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==f||y.numDirectionalShadows!==p||y.numPointShadows!==m||y.numSpotShadows!==h||y.numSpotMaps!==g||y.numLightProbes!==v)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=l,r.hemi.length=f,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=h,r.spotShadowMap.length=h,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=h+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,y.directionalLength=c,y.pointLength=l,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=f,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=h,y.numSpotMaps=g,y.numLightProbes=v,r.version=Qk++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t=i.length?(a=new tA(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}var rA=`void main() { gl_Position = vec4( position, 1.0 ); -}`,sA=`uniform sampler2D shadow_pass; +}`,iA=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3846,12 +3846,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function cA(e,t,n){let r=new dE,i=new BS,a=new BS,o=new mC,s=new HE({depthPacking:iS}),c=new UE,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new vT({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new BS},radius:{value:4}},vertexShader:oA,fragmentShader:sA}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new eT;m.setAttribute(`position`,new Ww(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new fT(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;this.render=function(t,n,s){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||t.length===0)return;let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=_!==3&&this.type===3,m=_===3&&this.type!==3;for(let c=0,l=t.length;cu||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/h.x),i.x=a.x*h.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/h.y),i.y=a.y*h.y,d.mapSize.y=a.y)),d.map===null||p===!0||m===!0){let e=this.type===3?{}:{minFilter:ix,magFilter:ix};d.map!==null&&d.map.dispose(),d.map=new gC(i.x,i.y,e),d.map.texture.name=l.name+`.shadowMap`,d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();let g=d.getViewportCount();for(let e=0;e0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,x)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function b(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l=2):(N=parseFloat(/^WebGL (\d)/.exec(P)[1]),M=N>=1);let F=null,ee={},te=e.getParameter(e.SCISSOR_BOX),ne=e.getParameter(e.VIEWPORT),re=new mC().fromArray(te),ie=new mC().fromArray(ne);function ae(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new BS,u=new WeakMap,d,f=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function m(e,t){return p?new OffscreenCanvas(e,t):qS(`canvas`)}function h(e,t,n){let r=1,i=ye(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);d===void 0&&(d=m(n,a));let o=t?m(n,a):d;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e;return e}function g(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function v(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function y(n,r,i,a,o=!1){if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),r===e.RGBA){let t=o?sS:rC.getTransfer(a);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return(s===e.R16F||s===e.R32F||s===e.RG16F||s===e.RG32F||s===e.RGBA16F||s===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),s}function b(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,console.warn(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return g(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(e){let t=e.target;t.removeEventListener(`dispose`,S),w(t),t.isVideoTexture&&u.delete(t)}function C(e){let t=e.target;t.removeEventListener(`dispose`,C),E(t)}function w(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=f.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&T(e),Object.keys(i).length===0&&f.delete(n)}r.remove(e)}function T(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=f.get(i);delete a[n.__cacheKey],o.memory.textures--}function E(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r=i.maxTextures&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+i.maxTextures),D+=1,e}function A(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function j(t,i){let a=r.get(t);if(t.isVideoTexture&&_e(t),t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)console.warn(`THREE.WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{oe(a,t,i);return}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function M(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){oe(a,t,i);return}n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)}function N(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){oe(a,t,i);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function P(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){se(a,t,i);return}n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let F={[tx]:e.REPEAT,[nx]:e.CLAMP_TO_EDGE,[rx]:e.MIRRORED_REPEAT},ee={[ix]:e.NEAREST,[ax]:e.NEAREST_MIPMAP_NEAREST,[ox]:e.NEAREST_MIPMAP_LINEAR,[sx]:e.LINEAR,[cx]:e.LINEAR_MIPMAP_NEAREST,[lx]:e.LINEAR_MIPMAP_LINEAR},te={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function ne(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&console.warn(`THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,F[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,F[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,F[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,ee[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,ee[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,te[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function re(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,S));let i=n.source,a=f.get(i);a===void 0&&(a={},f.set(i,a));let s=A(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&T(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function ie(e,t,n){return Math.floor(Math.floor(e/n)/t)}function ae(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e0){T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let r=aO(C.width,C.height,o.format,o.type);for(let i of o.layerUpdates){let a=C.data.subarray(i*r/C.data.BYTES_PER_ELEMENT,(i+1)*r/C.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,C.width,C.height,1,m,a)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,C.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,C.data,0,0);else console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`);else T?D&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,v,C.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,m,v,C.data)}else{T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let t=aO(p.width,p.height,o.format,o.type);for(let r of o.layerUpdates){let i=p.data.subarray(r*t/p.data.BYTES_PER_ELEMENT,(r+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,p.width,p.height,1,m,v,i)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isData3DTexture)T?(E&&n.texStorage3D(e.TEXTURE_3D,O,S,p.width,p.height,p.depth),D&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)):n.texImage3D(e.TEXTURE_3D,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isFramebufferTexture){if(E)if(T)n.texStorage2D(e.TEXTURE_2D,O,S,p.width,p.height);else{let t=p.width,r=p.height;for(let i=0;i>=1,r>>=1}}else if(w.length>0){if(T&&E){let t=ye(w[0]);n.texStorage2D(e.TEXTURE_2D,O,S,t.width,t.height)}for(let t=0,r=w.length;t0&&D++;let t=ye(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,t.width,t.height)}for(let t=0;t<6;t++)if(p){w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,b,S,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,m[t].width,m[t].height,0,b,S,m[t].data);for(let r=0;r>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),R(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,ge(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function le(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=b(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,l=ge(n);R(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,l,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,l,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error(`target.depthTexture not supported in Cube render targets`);let e=t.texture.mipmaps;e&&e.length>0?ue(i.__webglFramebuffer[0],t):ue(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),le(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),le(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function fe(t,n,i){let a=r.get(t);n!==void 0&&ce(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&de(t)}function I(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,C);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n0){s.__webglFramebuffer=[];for(let t=0;t0&&R(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0){if(R(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function _e(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function ve(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(rC.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&console.warn(`THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):console.error(`THREE.WebGLTextures: Unsupported texture color space:`,n)),t}function ye(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=j,this.setTexture2DArray=M,this.setTexture3D=N,this.setTextureCube=P,this.rebindTextures=fe,this.setupRenderTarget=I,this.updateRenderTargetMipmap=pe,this.updateMultisampleRenderTarget=L,this.setupDepthRenderbuffer=de,this.setupFrameBufferTexture=ce,this.useMultisampledRTT=R}function fA(e,t){function n(n,r=``){let i,a=rC.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===`srgb`)if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496)if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821)if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36492)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}var pA=` +}`;function aA(e,t,n){let r=new fE,i=new YS,a=new YS,o=new CC,s=new UE({depthPacking:pS}),c=new WE,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new bT({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new YS},radius:{value:4}},vertexShader:rA,fragmentShader:iA}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new nT;m.setAttribute(`position`,new Kw(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new mT(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;this.render=function(t,n,s){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||t.length===0)return;let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=_!==3&&this.type===3,m=_===3&&this.type!==3;for(let c=0,l=t.length;cu||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/h.x),i.x=a.x*h.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/h.y),i.y=a.y*h.y,d.mapSize.y=a.y)),d.map===null||p===!0||m===!0){let e=this.type===3?{}:{minFilter:$b,magFilter:$b};d.map!==null&&d.map.dispose(),d.map=new TC(i.x,i.y,e),d.map.texture.name=l.name+`.shadowMap`,d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();let g=d.getViewportCount();for(let e=0;e0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,x)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function b(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l=2):(N=parseFloat(/^WebGL (\d)/.exec(P)[1]),M=N>=1);let F=null,ee={},te=e.getParameter(e.SCISSOR_BOX),ne=e.getParameter(e.VIEWPORT),re=new CC().fromArray(te),ie=new CC().fromArray(ne);function ae(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new YS,u=new WeakMap,d,f=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function m(e,t){return p?new OffscreenCanvas(e,t):nC(`canvas`)}function h(e,t,n){let r=1,i=ye(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);d===void 0&&(d=m(n,a));let o=t?m(n,a):d;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e;return e}function g(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function v(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function y(n,r,i,a,o=!1){if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),r===e.RGBA){let t=o?gS:fC.getTransfer(a);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return(s===e.R16F||s===e.R32F||s===e.RG16F||s===e.RG32F||s===e.RGBA16F||s===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),s}function b(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,console.warn(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return g(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(e){let t=e.target;t.removeEventListener(`dispose`,S),w(t),t.isVideoTexture&&u.delete(t)}function C(e){let t=e.target;t.removeEventListener(`dispose`,C),E(t)}function w(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=f.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&T(e),Object.keys(i).length===0&&f.delete(n)}r.remove(e)}function T(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=f.get(i);delete a[n.__cacheKey],o.memory.textures--}function E(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r=i.maxTextures&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+i.maxTextures),D+=1,e}function A(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function j(t,i){let a=r.get(t);if(t.isVideoTexture&&_e(t),t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)console.warn(`THREE.WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{oe(a,t,i);return}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function M(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){oe(a,t,i);return}n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)}function N(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){oe(a,t,i);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function P(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){se(a,t,i);return}n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let F={[Xb]:e.REPEAT,[Zb]:e.CLAMP_TO_EDGE,[Qb]:e.MIRRORED_REPEAT},ee={[$b]:e.NEAREST,[ex]:e.NEAREST_MIPMAP_NEAREST,[tx]:e.NEAREST_MIPMAP_LINEAR,[nx]:e.LINEAR,[rx]:e.LINEAR_MIPMAP_NEAREST,[ix]:e.LINEAR_MIPMAP_LINEAR},te={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function ne(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&console.warn(`THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,F[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,F[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,F[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,ee[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,ee[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,te[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function re(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,S));let i=n.source,a=f.get(i);a===void 0&&(a={},f.set(i,a));let s=A(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&T(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function ie(e,t,n){return Math.floor(Math.floor(e/n)/t)}function ae(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e0){T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let r=aO(C.width,C.height,o.format,o.type);for(let i of o.layerUpdates){let a=C.data.subarray(i*r/C.data.BYTES_PER_ELEMENT,(i+1)*r/C.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,C.width,C.height,1,m,a)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,C.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,C.data,0,0);else console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`);else T?D&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,v,C.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,m,v,C.data)}else{T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let t=aO(p.width,p.height,o.format,o.type);for(let r of o.layerUpdates){let i=p.data.subarray(r*t/p.data.BYTES_PER_ELEMENT,(r+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,p.width,p.height,1,m,v,i)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isData3DTexture)T?(E&&n.texStorage3D(e.TEXTURE_3D,O,S,p.width,p.height,p.depth),D&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)):n.texImage3D(e.TEXTURE_3D,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isFramebufferTexture){if(E)if(T)n.texStorage2D(e.TEXTURE_2D,O,S,p.width,p.height);else{let t=p.width,r=p.height;for(let i=0;i>=1,r>>=1}}else if(w.length>0){if(T&&E){let t=ye(w[0]);n.texStorage2D(e.TEXTURE_2D,O,S,t.width,t.height)}for(let t=0,r=w.length;t0&&D++;let t=ye(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,t.width,t.height)}for(let t=0;t<6;t++)if(p){w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,b,S,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,m[t].width,m[t].height,0,b,S,m[t].data);for(let r=0;r>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),R(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,ge(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function le(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=b(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,l=ge(n);R(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,l,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,l,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error(`target.depthTexture not supported in Cube render targets`);let e=t.texture.mipmaps;e&&e.length>0?ue(i.__webglFramebuffer[0],t):ue(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),le(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),le(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function fe(t,n,i){let a=r.get(t);n!==void 0&&ce(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&de(t)}function I(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,C);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n0){s.__webglFramebuffer=[];for(let t=0;t0&&R(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0){if(R(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function _e(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function ve(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(fC.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&console.warn(`THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):console.error(`THREE.WebGLTextures: Unsupported texture color space:`,n)),t}function ye(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=j,this.setTexture2DArray=M,this.setTexture3D=N,this.setTextureCube=P,this.rebindTextures=fe,this.setupRenderTarget=I,this.updateRenderTargetMipmap=pe,this.updateMultisampleRenderTarget=L,this.setupDepthRenderbuffer=de,this.setupFrameBufferTexture=ce,this.useMultisampledRTT=R}function lA(e,t){function n(n,r=``){let i,a=fC.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===`srgb`)if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496)if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821)if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36492)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}var uA=` void main() { gl_Position = vec4( position, 1.0 ); -}`,mA=` +}`,dA=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -3870,76 +3870,76 @@ void main() { } -}`,hA=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){let r=new pC,i=e.properties.get(r);i.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new vT({vertexShader:pA,fragmentShader:mA,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new fT(new FE(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},gA=class extends fS{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=new hA,h=t.getContextAttributes(),g=null,_=null,v=[],y=[],b=new BS,x=null,S=new CT;S.viewport=new mC;let C=new CT;C.viewport=new mC;let w=[S,C],T=new BD,E=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return t===void 0&&(t=new jT,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return t===void 0&&(t=new jT,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return t===void 0&&(t=new jT,v[e]=t),t.getHandSpace()};function O(e){let t=y.indexOf(e.inputSource);if(t===-1)return;let n=v[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function k(){r.removeEventListener(`select`,O),r.removeEventListener(`selectstart`,O),r.removeEventListener(`selectend`,O),r.removeEventListener(`squeeze`,O),r.removeEventListener(`squeezestart`,O),r.removeEventListener(`squeezeend`,O),r.removeEventListener(`end`,k),r.removeEventListener(`inputsourceschange`,A);for(let e=0;e=0&&(y[r]=null,v[r].disconnect(n))}for(let t=0;t=y.length){y.push(n),r=e;break}else if(y[e]===null){y[e]=n,r=e;break}if(r===-1)break}let i=v[r];i&&i.connect(n)}}let j=new Y,M=new Y;function N(e,t,n){j.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=j.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function P(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;m.texture!==null&&(m.depthNear>0&&(t=m.depthNear),m.depthFar>0&&(n=m.depthFar)),T.near=C.near=S.near=t,T.far=C.far=S.far=n,(E!==T.near||D!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,D=T.far),S.layers.mask=e.layers.mask|2,C.layers.mask=e.layers.mask|4,T.layers.mask=S.layers.mask|C.layers.mask;let i=e.parent,a=T.cameras;P(T,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,_A.copy(o),_A.x*=-1,_A.y*=-1,_A.z*=-1,a.isCubeTexture&&a.isRenderTargetTexture===!1&&(_A.y*=-1,_A.z*=-1),e.envMapRotation.value.setFromMatrix4(vA.makeRotationFromEuler(_A)),e.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===!1?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function bA(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn(`THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.`):console.warn(`THREE.WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var xA=class{constructor(e={}){let{canvas:t=JS(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);f=n.getContextAttributes().alpha}else f=a;let p=new Uint32Array(4),m=new Int32Array(4),h=null,g=null,_=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let y=this,b=!1;this._outputColorSpace=aS;let x=0,S=0,C=null,w=-1,T=null,E=new mC,D=new mC,O=null,k=new X(0),A=0,j=t.width,M=t.height,N=1,P=null,F=null,ee=new mC(0,0,j,M),te=new mC(0,0,j,M),ne=!1,re=new dE,ie=!1,ae=!1,oe=new KC,se=new KC,ce=new Y,le=new mC,ue={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},de=!1;function fe(){return C===null?N:1}let I=n;function pe(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r177`),t.addEventListener(`webglcontextlost`,Re,!1),t.addEventListener(`webglcontextrestored`,ze,!1),t.addEventListener(`webglcontextcreationerror`,Be,!1),I===null){let t=`webgl2`;if(I=pe(t,e),I===null)throw pe(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}let me,he,L,ge,R,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe;function Ie(){me=new HO(I),me.init(),Ne=new fA(I,me),he=new _O(I,me,e,Ne),L=new uA(I,me),he.reverseDepthBuffer&&d&&L.buffers.depth.setReversed(!0),ge=new GO(I),R=new Jk,_e=new dA(I,me,L,R,he,Ne,ge),ve=new yO(y),ye=new VO(y),be=new cO(I),Pe=new hO(I,be),xe=new UO(I,be,ge,Pe),Se=new qO(I,xe,be,ge),Ae=new KO(I,he,_e),De=new vO(R),Ce=new qk(y,ve,ye,me,he,Pe,De),we=new yA(y,R),Te=new Qk,Ee=new aA(me),ke=new mO(y,ve,ye,L,Se,f,s),Oe=new cA(y,Se,he),Fe=new bA(I,ge,he,L),je=new gO(I,me,ge),Me=new WO(I,me,ge),ge.programs=Ce.programs,y.capabilities=he,y.extensions=me,y.properties=R,y.renderLists=Te,y.shadowMap=Oe,y.state=L,y.info=ge}Ie();let Le=new gA(y,I);this.xr=Le,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){let e=me.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=me.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(e){e!==void 0&&(N=e,this.setSize(j,M,!1))},this.getSize=function(e){return e.set(j,M)},this.setSize=function(e,n,r=!0){if(Le.isPresenting){console.warn(`THREE.WebGLRenderer: Can't change size while VR device is presenting.`);return}j=e,M=n,t.width=Math.floor(e*N),t.height=Math.floor(n*N),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(j*N,M*N).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,M=n,N=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(ee)},this.setViewport=function(e,t,n,r){e.isVector4?ee.set(e.x,e.y,e.z,e.w):ee.set(e,t,n,r),L.viewport(E.copy(ee).multiplyScalar(N).round())},this.getScissor=function(e){return e.copy(te)},this.setScissor=function(e,t,n,r){e.isVector4?te.set(e.x,e.y,e.z,e.w):te.set(e,t,n,r),L.scissor(D.copy(te).multiplyScalar(N).round())},this.getScissorTest=function(){return ne},this.setScissorTest=function(e){L.setScissorTest(ne=e)},this.setOpaqueSort=function(e){P=e},this.setTransparentSort=function(e){F=e},this.getClearColor=function(e){return e.copy(ke.getClearColor())},this.setClearColor=function(){ke.setClearColor(...arguments)},this.getClearAlpha=function(){return ke.getClearAlpha()},this.setClearAlpha=function(){ke.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(C!==null){let t=C.texture.format;e=t===1033||t===1031||t===1029}if(e){let e=C.texture.type,t=e===1009||e===1014||e===1012||e===1020||e===1017||e===1018,n=ke.getClearColor(),r=ke.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(p[0]=i,p[1]=a,p[2]=o,p[3]=r,I.clearBufferuiv(I.COLOR,0,p)):(m[0]=i,m[1]=a,m[2]=o,m[3]=r,I.clearBufferiv(I.COLOR,0,m))}else r|=I.COLOR_BUFFER_BIT}t&&(r|=I.DEPTH_BUFFER_BIT),n&&(r|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),I.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Re,!1),t.removeEventListener(`webglcontextrestored`,ze,!1),t.removeEventListener(`webglcontextcreationerror`,Be,!1),ke.dispose(),Te.dispose(),Ee.dispose(),R.dispose(),ve.dispose(),ye.dispose(),Se.dispose(),Pe.dispose(),Fe.dispose(),Ce.dispose(),Le.dispose(),Le.removeEventListener(`sessionstart`,qe),Le.removeEventListener(`sessionend`,Je),Ye.stop()};function Re(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),b=!0}function ze(){console.log(`THREE.WebGLRenderer: Context Restored.`),b=!1;let e=ge.autoReset,t=Oe.enabled,n=Oe.autoUpdate,r=Oe.needsUpdate,i=Oe.type;Ie(),ge.autoReset=e,Oe.enabled=t,Oe.autoUpdate=n,Oe.needsUpdate=r,Oe.type=i}function Be(e){console.error(`THREE.WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function Ve(e){let t=e.target;t.removeEventListener(`dispose`,Ve),He(t)}function He(e){Ue(e),R.remove(e)}function Ue(e){let t=R.get(e).programs;t!==void 0&&(t.forEach(function(e){Ce.releaseProgram(e)}),e.isShaderMaterial&&Ce.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=ue);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=it(e,t,n,r,i);L.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=xe.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Pe.setup(i,r,s,n,c);let h,g=je;if(c!==null&&(h=be.get(c),g=Me,g.setIndex(h)),i.isMesh)r.wireframe===!0?(L.setLineWidth(r.wireframeLinewidth*fe()),g.setMode(I.LINES)):g.setMode(I.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),L.setLineWidth(e*fe()),i.isLineSegments?g.setMode(I.LINES):i.isLineLoop?g.setMode(I.LINE_LOOP):g.setMode(I.LINE_STRIP)}else i.isPoints?g.setMode(I.POINTS):i.isSprite&&g.setMode(I.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null)XS(`THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.`),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(me.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?be.get(c).bytesPerElement:1,o=R.get(r).currentProgram.getUniforms();for(let r=0;r{function n(){if(r.forEach(function(e){R.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}me.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let Ge=null;function Ke(e){Ge&&Ge(e)}function qe(){Ye.stop()}function Je(){Ye.start()}let Ye=new sO;Ye.setAnimationLoop(Ke),typeof self<`u`&&Ye.setContext(self),this.setAnimationLoop=function(e){Ge=e,Le.setAnimationLoop(e),e===null?Ye.stop():Ye.start()},Le.addEventListener(`sessionstart`,qe),Le.addEventListener(`sessionend`,Je),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(b===!0)return;if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Le.enabled===!0&&Le.isPresenting===!0&&(Le.cameraAutoUpdate===!0&&Le.updateCamera(t),t=Le.getCamera()),e.isScene===!0&&e.onBeforeRender(y,e,t,C),g=Ee.get(e,v.length),g.init(t),v.push(g),se.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),re.setFromProjectionMatrix(se),ae=this.localClippingEnabled,ie=De.init(this.clippingPlanes,ae),h=Te.get(e,_.length),h.init(),_.push(h),Le.enabled===!0&&Le.isPresenting===!0){let e=y.xr.getDepthSensingMesh();e!==null&&Xe(e,t,-1/0,y.sortObjects)}Xe(e,t,0,y.sortObjects),h.finish(),y.sortObjects===!0&&h.sort(P,F),de=Le.enabled===!1||Le.isPresenting===!1||Le.hasDepthSensing()===!1,de&&ke.addToRenderList(h,e),this.info.render.frame++,ie===!0&&De.beginShadows();let n=g.state.shadowsArray;Oe.render(n,e,t),ie===!0&&De.endShadows(),this.info.autoReset===!0&&this.info.reset();let r=h.opaque,i=h.transmissive;if(g.setupLights(),t.isArrayCamera){let n=t.cameras;if(i.length>0)for(let t=0,a=n.length;t0&&Qe(r,i,e,t),de&&ke.render(e),Ze(h,e,t);C!==null&&S===0&&(_e.updateMultisampleRenderTarget(C),_e.updateRenderTargetMipmap(C)),e.isScene===!0&&e.onAfterRender(y,e,t),Pe.resetDefaultState(),w=-1,T=null,v.pop(),v.length>0?(g=v[v.length-1],ie===!0&&De.setGlobalState(y.clippingPlanes,g.state.camera)):g=null,_.pop(),h=_.length>0?_[_.length-1]:null};function Xe(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||re.intersectsSprite(e)){r&&le.setFromMatrixPosition(e.matrixWorld).applyMatrix4(se);let t=Se.update(e),i=e.material;i.visible&&h.push(e,t,i,n,le.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||re.intersectsObject(e))){let t=Se.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),le.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),le.copy(e.boundingSphere.center)),le.applyMatrix4(e.matrixWorld).applyMatrix4(se)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a0&&$e(i,t,n),a.length>0&&$e(a,t,n),o.length>0&&$e(o,t,n),L.buffers.depth.setTest(!0),L.buffers.depth.setMask(!0),L.buffers.color.setMask(!0),L.setPolygonOffset(!1)}function Qe(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[r.id]===void 0&&(g.state.transmissionRenderTarget[r.id]=new gC(1,1,{generateMipmaps:!0,type:me.has(`EXT_color_buffer_half_float`)||me.has(`EXT_color_buffer_float`)?_x:ux,minFilter:lx,samples:4,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:rC.workingColorSpace}));let a=g.state.transmissionRenderTarget[r.id],o=r.viewport||E;a.setSize(o.z*y.transmissionResolutionScale,o.w*y.transmissionResolutionScale);let s=y.getRenderTarget();y.setRenderTarget(a),y.getClearColor(k),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear(),de&&ke.render(n);let c=y.toneMapping;y.toneMapping=0;let l=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),g.setupLightsView(r),ie===!0&&De.setGlobalState(y.clippingPlanes,r),$e(e,n,r),_e.updateMultisampleRenderTarget(a),_e.updateRenderTargetMipmap(a),me.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i0),d=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,m=0;r.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(m=y.toneMapping);let h=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=h===void 0?0:h.length,v=R.get(r),b=g.state.lights;if(ie===!0&&(ae===!0||e!==T)){let t=e===T&&r.id===w;De.setState(r,e,t)}let x=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==b.state.version?x=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?x=!0:v.envMap===c?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==De.numPlanes||v.numIntersection!==De.numIntersection)?x=!0:v.vertexAlphas===l&&v.vertexTangents===u&&v.morphTargets===d&&v.morphNormals===f&&v.morphColors===p&&v.toneMapping===m?v.morphTargetsCount!==_&&(x=!0):x=!0:x=!0:x=!0:(x=!0,v.__version=r.version);let S=v.currentProgram;x===!0&&(S=tt(r,t,i));let E=!1,D=!1,O=!1,k=S.getUniforms(),A=v.uniforms;if(L.useProgram(S.program)&&(E=!0,D=!0,O=!0),r.id!==w&&(w=r.id,D=!0),E||T!==e){L.buffers.depth.getReversed()?(oe.copy(e.projectionMatrix),QS(oe),$S(oe),k.setValue(I,`projectionMatrix`,oe)):k.setValue(I,`projectionMatrix`,e.projectionMatrix),k.setValue(I,`viewMatrix`,e.matrixWorldInverse);let t=k.map.cameraPosition;t!==void 0&&t.setValue(I,ce.setFromMatrixPosition(e.matrixWorld)),he.logarithmicDepthBuffer&&k.setValue(I,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&k.setValue(I,`isOrthographic`,e.isOrthographicCamera===!0),T!==e&&(T=e,D=!0,O=!0)}if(i.isSkinnedMesh){k.setOptional(I,i,`bindMatrix`),k.setOptional(I,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),k.setValue(I,`boneTexture`,e.boneTexture,_e))}i.isBatchedMesh&&(k.setOptional(I,i,`batchingTexture`),k.setValue(I,`batchingTexture`,i._matricesTexture,_e),k.setOptional(I,i,`batchingIdTexture`),k.setValue(I,`batchingIdTexture`,i._indirectTexture,_e),k.setOptional(I,i,`batchingColorTexture`),i._colorsTexture!==null&&k.setValue(I,`batchingColorTexture`,i._colorsTexture,_e));let j=n.morphAttributes;if((j.position!==void 0||j.normal!==void 0||j.color!==void 0)&&Ae.update(i,n,S),(D||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,k.setValue(I,`receiveShadow`,i.receiveShadow)),r.isMeshGouraudMaterial&&r.envMap!==null&&(A.envMap.value=c,A.flipEnvMap.value=c.isCubeTexture&&c.isRenderTargetTexture===!1?-1:1),r.isMeshStandardMaterial&&r.envMap===null&&t.environment!==null&&(A.envMapIntensity.value=t.environmentIntensity),D&&(k.setValue(I,`toneMappingExposure`,y.toneMappingExposure),v.needsLights&&at(A,O),a&&r.fog===!0&&we.refreshFogUniforms(A,a),we.refreshMaterialUniforms(A,r,N,M,g.state.transmissionRenderTarget[e.id]),fk.upload(I,nt(v),A,_e)),r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(fk.upload(I,nt(v),A,_e),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&k.setValue(I,`center`,i.center),k.setValue(I,`modelViewMatrix`,i.modelViewMatrix),k.setValue(I,`normalMatrix`,i.normalMatrix),k.setValue(I,`modelMatrix`,i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&_e.useMultisampledRTT(e)===!1?R.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,E.copy(e.viewport),D.copy(e.scissor),O=e.scissorTest}else E.copy(ee).multiplyScalar(N).floor(),D.copy(te).multiplyScalar(N).floor(),O=ne;if(n!==0&&(i=st),L.bindFramebuffer(I.FRAMEBUFFER,i)&&r&&L.drawBuffers(e,i),L.viewport(E),L.scissor(D),L.setScissorTest(O),a){let r=R.get(e.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(o){let r=R.get(e.texture),i=t;I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,r.__webglTexture,n,i)}else if(e!==null&&n!==0){let t=R.get(e.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,t.__webglTexture,n)}w=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=R.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){L.bindFramebuffer(I.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(!he.textureFormatReadable(c)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!he.textureTypeReadable(l)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+s),I.readPixels(t,n,r,i,Ne.convert(c),Ne.convert(l),a))}finally{let e=C===null?null:R.get(C).__webglFramebuffer;L.bindFramebuffer(I.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=R.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){L.bindFramebuffer(I.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(!he.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!he.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,d),I.bufferData(I.PIXEL_PACK_BUFFER,a.byteLength,I.STREAM_READ),e.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+s),I.readPixels(t,n,r,i,Ne.convert(l),Ne.convert(u),0);let f=C===null?null:R.get(C).__webglFramebuffer;L.bindFramebuffer(I.FRAMEBUFFER,f);let p=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await ZS(I,p,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,d),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,a),I.deleteBuffer(d),I.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;_e.setTexture2D(e,0),I.copyTexSubImage2D(I.TEXTURE_2D,n,0,0,o,s,i,a),L.unbindTexture()};let ct=I.createFramebuffer(),lt=I.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=null){a===null&&(i===0?a=0:(XS(`WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.`),a=i,i=0));let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Ne.convert(t.format),_=Ne.convert(t.type),v;t.isData3DTexture?(_e.setTexture3D(t,0),v=I.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(_e.setTexture2DArray(t,0),v=I.TEXTURE_2D_ARRAY):(_e.setTexture2D(t,0),v=I.TEXTURE_2D),I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,t.flipY),I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),I.pixelStorei(I.UNPACK_ALIGNMENT,t.unpackAlignment);let y=I.getParameter(I.UNPACK_ROW_LENGTH),b=I.getParameter(I.UNPACK_IMAGE_HEIGHT),x=I.getParameter(I.UNPACK_SKIP_PIXELS),S=I.getParameter(I.UNPACK_SKIP_ROWS),C=I.getParameter(I.UNPACK_SKIP_IMAGES);I.pixelStorei(I.UNPACK_ROW_LENGTH,h.width),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,h.height),I.pixelStorei(I.UNPACK_SKIP_PIXELS,l),I.pixelStorei(I.UNPACK_SKIP_ROWS,u),I.pixelStorei(I.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=R.get(e),r=R.get(t),h=R.get(n.__renderTarget),g=R.get(r.__renderTarget);L.bindFramebuffer(I.READ_FRAMEBUFFER,h.__webglFramebuffer),L.bindFramebuffer(I.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;nMath.PI&&(n-=kA),r<-Math.PI?r+=kA:r>Math.PI&&(r-=kA),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(OA.setFromSpherical(this._spherical),OA.applyQuaternion(this._quatInverse),t.copy(this.target).add(OA),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=OA.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new Y(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new Y(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=OA.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(TA.origin.copy(this.object.position),TA.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(TA.direction))jA||8*(1-this._lastQuaternion.dot(this.object.quaternion))>jA||this._lastTargetPosition.distanceToSquared(this.target)>jA?(this.dispatchEvent(SA),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?kA/60/60*this.autoRotateSpeed:kA/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){OA.setFromMatrixColumn(t,0),OA.multiplyScalar(-e),this._panOffset.add(OA)}_panUp(e,t){this.screenSpacePanning===!0?OA.setFromMatrixColumn(t,1):(OA.setFromMatrixColumn(t,0),OA.crossVectors(this.object.up,OA)),OA.multiplyScalar(e),this._panOffset.add(OA)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;OA.copy(r).sub(this.target);let i=OA.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(kA*this._rotateDelta.x/t.clientHeight),this._rotateUp(kA*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(kA*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-kA*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(kA*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-kA*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(kA*this._rotateDelta.x/t.clientHeight),this._rotateUp(kA*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t>5&31)/31,a=(e>>10&31)/31)}for(let c=1;c<=3;c++){let l=n+c*12,u=e*3*3+(c-1)*3;p[u]=t.getFloat32(l,!0),p[u+1]=t.getFloat32(l+4,!0),p[u+2]=t.getFloat32(l+8,!0),m[u]=d,m[u+1]=f,m[u+2]=g,o&&(h.setRGB(r,i,a,aS),s[u]=h.r,s[u+1]=h.g,s[u+2]=h.b)}}return f.setAttribute(`position`,new Ww(p,3)),f.setAttribute(`normal`,new Ww(m,3)),o&&(f.setAttribute(`color`,new Ww(s,3)),f.hasColors=!0,f.alpha=d),f}function i(e){let t=new eT,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g,i=/solid\s(.+)/,a=0,o=RegExp(`vertex[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),s=RegExp(`normal[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),c=[],l=[],u=[],d=new Y,f,p=0,m=0,h=0;for(;(f=n.exec(e))!==null;){m=h;let e=f[0],n=(f=i.exec(e))===null?``:f[1];for(u.push(n);(f=r.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=s.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=o.exec(n))!==null;)c.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),l.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let g=m,_=h-m;t.userData.groupNames=u,t.addGroup(g,_,p),p++}return t.setAttribute(`position`,new qw(c,3)),t.setAttribute(`normal`,new qw(l,3)),t}function a(e){return typeof e==`string`?e:new TextDecoder().decode(e)}function o(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n256||e.colormap_size!==24||e.colormap_type!==1)throw Error(`THREE.TGALoader: Invalid type colormap data for indexed type.`);break;case f:case p:case h:case g:if(e.colormap_type)throw Error(`THREE.TGALoader: Invalid type colormap data for colormap type.`);break;case u:throw Error(`THREE.TGALoader: No data.`);default:throw Error(`THREE.TGALoader: Invalid type `+e.image_type)}if(e.width<=0||e.height<=0)throw Error(`THREE.TGALoader: Invalid image size.`);if(e.pixel_size!==8&&e.pixel_size!==16&&e.pixel_size!==24&&e.pixel_size!==32)throw Error(`THREE.TGALoader: Invalid pixel size `+e.pixel_size)}function n(e,t,n,r,i){let a,o,s=n.pixel_size>>3,c=n.width*n.height*s;if(t&&(o=i.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),e){a=new Uint8Array(c);let e,t,n,o=0,l=new Uint8Array(s);for(;o>7,e[(u+f*d)*4+1]=(c&992)>>2,e[(u+f*d)*4+2]=(c&31)<<3,e[(u+f*d)*4+3]=c&32768?0:255;return e}function a(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=3)e[(l+d*u)*4+3]=255,e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2];return e}function o(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=4)e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2],e[(l+d*u)*4+3]=s[c+3];return e}function s(e,t,n,r,i,a,o,s){let c,l=0,u,d,f=T.width;for(d=t;d!==r;d+=n)for(u=i;u!==o;u+=a,l++)c=s[l],e[(u+f*d)*4+0]=c,e[(u+f*d)*4+1]=c,e[(u+f*d)*4+2]=c,e[(u+f*d)*4+3]=255;return e}function c(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=2)e[(l+d*u)*4+0]=s[c+0],e[(l+d*u)*4+1]=s[c+0],e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+3]=s[c+1];return e}function l(e,t,n,l,u){let d,f,p,m,h,g;switch((T.flags&_)>>v){default:case x:d=0,p=1,h=t,f=0,m=1,g=n;break;case y:d=0,p=1,h=t,f=n-1,m=-1,g=-1;break;case S:d=t-1,p=-1,h=-1,f=0,m=1,g=n;break;case b:d=t-1,p=-1,h=-1,f=n-1,m=-1,g=-1;break}if(O)switch(T.pixel_size){case 8:s(e,f,m,g,d,p,h,l);break;case 16:c(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}else switch(T.pixel_size){case 8:r(e,f,m,g,d,p,h,l,u);break;case 16:i(e,f,m,g,d,p,h,l);break;case 24:a(e,f,m,g,d,p,h,l);break;case 32:o(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}return e}let u=0,d=1,f=2,p=3,m=9,h=10,g=11,_=48,v=4,y=0,b=1,x=2,S=3;if(e.length<19)throw Error(`THREE.TGALoader: Not enough data to contain header.`);let C=0,w=new Uint8Array(e),T={id_length:w[C++],colormap_type:w[C++],image_type:w[C++],colormap_index:w[C++]|w[C++]<<8,colormap_length:w[C++]|w[C++]<<8,colormap_size:w[C++],origin:[w[C++]|w[C++]<<8,w[C++]|w[C++]<<8],width:w[C++]|w[C++]<<8,height:w[C++]|w[C++]<<8,pixel_size:w[C++],flags:w[C++]};if(t(T),T.id_length+C>e.length)throw Error(`THREE.TGALoader: No data.`);C+=T.id_length;let E=!1,D=!1,O=!1;switch(T.image_type){case 9:E=!0,D=!0;break;case 1:D=!0;break;case 10:E=!0;break;case 2:break;case 11:E=!0,O=!0;break;case 3:O=!0;break}let k=new Uint8Array(T.width*T.height*4),A=n(E,D,T,C,w);return l(k,T.width,T.height,A.pixel_data,A.palettes),{data:k,width:T.width,height:T.height,flipY:!0,generateMipmaps:!0,minFilter:lx}}},qA=class extends pD{load(e,t,n,r){let i=this,a=i.path===``?LD.extractUrlBase(e):i.path,o=new gD(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e,t){function n(e,t){let n=[],r=e.childNodes;for(let e=0,i=r.length;e0&&t.push(new oD(r+`.position`,i,a)),o.length>0&&t.push(new iD(r+`.quaternion`,i,o)),s.length>0&&t.push(new oD(r+`.scale`,i,s)),t}function E(e,t,n){let r,i=!0,a,o;for(a=0,o=e.length;a=0;){let r=e[t];if(r.value[n]!==null)return r;t--}return null}function k(e,t,n){for(;t>>0)+2);switch(n=n.toLowerCase(),n){case`tga`:t=It;break;default:t=Ft}return t}function Ce(e){let t=be(e.url),n=t.profile.technique,r;switch(n.type){case`phong`:case`blinn`:r=new BE;break;case`lambert`:r=new VE;break;default:r=new Vw;break}r.name=e.name||``;function i(e,n=null){let r=t.profile.samplers[e.id],i=null;if(r!==void 0){let e=t.profile.surfaces[r.source];i=se(e.init_from)}else console.warn(`THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530).`),i=se(e.id);if(i!==null){let t=Se(i);if(t!==void 0){let r=t.load(i),a=e.extra;if(a!==void 0&&a.technique!==void 0&&c(a.technique)===!1){let e=a.technique;r.wrapS=e.wrapU?tx:nx,r.wrapT=e.wrapV?tx:nx,r.offset.set(e.offsetU||0,e.offsetV||0),r.repeat.set(e.repeatU||1,e.repeatV||1)}else r.wrapS=tx,r.wrapT=tx;return n!==null&&(r.colorSpace=n),r}else return console.warn(`THREE.ColladaLoader: Loader for texture %s not found.`,i),null}else return console.warn(`THREE.ColladaLoader: Couldn't create texture with ID:`,e.id),null}let a=n.parameters;for(let e in a){let t=a[e];switch(e){case`diffuse`:t.color&&r.color.fromArray(t.color),t.texture&&(r.map=i(t.texture,aS));break;case`specular`:t.color&&r.specular&&r.specular.fromArray(t.color),t.texture&&(r.specularMap=i(t.texture));break;case`bump`:t.texture&&(r.normalMap=i(t.texture));break;case`ambient`:t.texture&&(r.lightMap=i(t.texture,aS));break;case`shininess`:t.float&&r.shininess&&(r.shininess=t.float);break;case`emission`:t.color&&r.emissive&&r.emissive.fromArray(t.color),t.texture&&(r.emissiveMap=i(t.texture,aS));break}}rC.colorSpaceToWorking(r.color,aS),r.specular&&rC.colorSpaceToWorking(r.specular,aS),r.emissive&&rC.colorSpaceToWorking(r.emissive,aS);let o=a.transparent,s=a.transparency;if(s===void 0&&o&&(s={float:1}),o===void 0&&s&&(o={opaque:`A_ONE`,data:{color:[1,1,1,1]}}),o&&s)if(o.data.texture)r.transparent=!0;else{let e=o.data.color;switch(o.opaque){case`A_ONE`:r.opacity=e[3]*s.float;break;case`RGB_ZERO`:r.opacity=1-e[0]*s.float;break;case`A_ZERO`:r.opacity=1-e[3]*s.float;break;case`RGB_ONE`:r.opacity=e[0]*s.float;break;default:console.warn(`THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.`,o.opaque)}r.opacity<1&&(r.transparent=!0)}if(n.extra!==void 0&&n.extra.technique!==void 0){let e=n.extra.technique;for(let t in e){let n=e[t];switch(t){case`double_sided`:r.side=n===1?2:0;break;case`bump`:r.normalMap=i(n.texture),r.normalScale=new BS(1,1);break}}}return r}function we(e){return m(z.materials[e],Ce)}function Te(e){let t={name:e.getAttribute(`name`)};for(let n=0,r=e.childNodes.length;n0?n+s:n;t.inputs[c]={id:e,offset:i},t.stride=Math.max(t.stride,i+1),n===`TEXCOORD`&&(t.hasUV=!0);break;case`vcount`:t.vcount=a(r.textContent);break;case`p`:t.p=a(r.textContent);break}}return t}function Be(e){let t={};for(let n=0;n0&&t0&&d.setAttribute(`position`,new qw(i.array,i.stride)),a.array.length>0&&d.setAttribute(`normal`,new qw(a.array,a.stride)),c.array.length>0&&d.setAttribute(`color`,new qw(c.array,c.stride)),o.array.length>0&&d.setAttribute(`uv`,new qw(o.array,o.stride)),s.array.length>0&&d.setAttribute(`uv1`,new qw(s.array,s.stride)),l.array.length>0&&d.setAttribute(`skinIndex`,new qw(l.array,l.stride)),u.array.length>0&&d.setAttribute(`skinWeight`,new qw(u.array,u.stride)),r.data=d,r.type=e[0].type,r.materialKeys=f,r}function We(e,t,n,r,i=!1){let a=e.p,o=e.stride,s=e.vcount;function c(e){let t=a[e+n]*u,o=t+u;for(;t4)for(let t=1,r=n-2;t<=r;t++){let n=e+o*0,r=e+o*t,i=e+o*(t+1);c(n),c(r),c(i)}e+=o*n}}else for(let e=0,t=a.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function Qe(e){let t={sid:e.getAttribute(`sid`),name:e.getAttribute(`name`)||``,attachments:[],transforms:[]};for(let n=0;nr.limits.max||t=0&&(y[r]=null,v[r].disconnect(n))}for(let t=0;t=y.length){y.push(n),r=e;break}else if(y[e]===null){y[e]=n,r=e;break}if(r===-1)break}let i=v[r];i&&i.connect(n)}}let j=new Y,M=new Y;function N(e,t,n){j.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=j.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function P(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;m.texture!==null&&(m.depthNear>0&&(t=m.depthNear),m.depthFar>0&&(n=m.depthFar)),T.near=C.near=S.near=t,T.far=C.far=S.far=n,(E!==T.near||D!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,D=T.far),S.layers.mask=e.layers.mask|2,C.layers.mask=e.layers.mask|4,T.layers.mask=S.layers.mask|C.layers.mask;let i=e.parent,a=T.cameras;P(T,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,mA.copy(o),mA.x*=-1,mA.y*=-1,mA.z*=-1,a.isCubeTexture&&a.isRenderTargetTexture===!1&&(mA.y*=-1,mA.z*=-1),e.envMapRotation.value.setFromMatrix4(hA.makeRotationFromEuler(mA)),e.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===!1?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function _A(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn(`THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.`):console.warn(`THREE.WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var vA=class{constructor(e={}){let{canvas:t=rC(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);f=n.getContextAttributes().alpha}else f=a;let p=new Uint32Array(4),m=new Int32Array(4),h=null,g=null,_=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let y=this,b=!1;this._outputColorSpace=mS;let x=0,S=0,C=null,w=-1,T=null,E=new CC,D=new CC,O=null,k=new X(0),A=0,j=t.width,M=t.height,N=1,P=null,F=null,ee=new CC(0,0,j,M),te=new CC(0,0,j,M),ne=!1,re=new fE,ie=!1,ae=!1,oe=new tw,se=new tw,ce=new Y,le=new CC,ue={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},de=!1;function fe(){return C===null?N:1}let I=n;function pe(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r177`),t.addEventListener(`webglcontextlost`,Re,!1),t.addEventListener(`webglcontextrestored`,ze,!1),t.addEventListener(`webglcontextcreationerror`,Be,!1),I===null){let t=`webgl2`;if(I=pe(t,e),I===null)throw pe(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}let me,he,L,ge,R,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe;function Ie(){me=new HO(I),me.init(),Ne=new lA(I,me),he=new _O(I,me,e,Ne),L=new sA(I,me),he.reverseDepthBuffer&&d&&L.buffers.depth.setReversed(!0),ge=new GO(I),R=new Gk,_e=new cA(I,me,L,R,he,Ne,ge),ve=new yO(y),ye=new VO(y),be=new cO(I),Pe=new hO(I,be),xe=new UO(I,be,ge,Pe),Se=new qO(I,xe,be,ge),Ae=new KO(I,he,_e),De=new vO(R),Ce=new Wk(y,ve,ye,me,he,Pe,De),we=new gA(y,R),Te=new Yk,Ee=new nA(me),ke=new mO(y,ve,ye,L,Se,f,s),Oe=new aA(y,Se,he),Fe=new _A(I,ge,he,L),je=new gO(I,me,ge),Me=new WO(I,me,ge),ge.programs=Ce.programs,y.capabilities=he,y.extensions=me,y.properties=R,y.renderLists=Te,y.shadowMap=Oe,y.state=L,y.info=ge}Ie();let Le=new pA(y,I);this.xr=Le,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){let e=me.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=me.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(e){e!==void 0&&(N=e,this.setSize(j,M,!1))},this.getSize=function(e){return e.set(j,M)},this.setSize=function(e,n,r=!0){if(Le.isPresenting){console.warn(`THREE.WebGLRenderer: Can't change size while VR device is presenting.`);return}j=e,M=n,t.width=Math.floor(e*N),t.height=Math.floor(n*N),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(j*N,M*N).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,M=n,N=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(ee)},this.setViewport=function(e,t,n,r){e.isVector4?ee.set(e.x,e.y,e.z,e.w):ee.set(e,t,n,r),L.viewport(E.copy(ee).multiplyScalar(N).round())},this.getScissor=function(e){return e.copy(te)},this.setScissor=function(e,t,n,r){e.isVector4?te.set(e.x,e.y,e.z,e.w):te.set(e,t,n,r),L.scissor(D.copy(te).multiplyScalar(N).round())},this.getScissorTest=function(){return ne},this.setScissorTest=function(e){L.setScissorTest(ne=e)},this.setOpaqueSort=function(e){P=e},this.setTransparentSort=function(e){F=e},this.getClearColor=function(e){return e.copy(ke.getClearColor())},this.setClearColor=function(){ke.setClearColor(...arguments)},this.getClearAlpha=function(){return ke.getClearAlpha()},this.setClearAlpha=function(){ke.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(C!==null){let t=C.texture.format;e=t===1033||t===1031||t===1029}if(e){let e=C.texture.type,t=e===1009||e===1014||e===1012||e===1020||e===1017||e===1018,n=ke.getClearColor(),r=ke.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(p[0]=i,p[1]=a,p[2]=o,p[3]=r,I.clearBufferuiv(I.COLOR,0,p)):(m[0]=i,m[1]=a,m[2]=o,m[3]=r,I.clearBufferiv(I.COLOR,0,m))}else r|=I.COLOR_BUFFER_BIT}t&&(r|=I.DEPTH_BUFFER_BIT),n&&(r|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),I.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Re,!1),t.removeEventListener(`webglcontextrestored`,ze,!1),t.removeEventListener(`webglcontextcreationerror`,Be,!1),ke.dispose(),Te.dispose(),Ee.dispose(),R.dispose(),ve.dispose(),ye.dispose(),Se.dispose(),Pe.dispose(),Fe.dispose(),Ce.dispose(),Le.dispose(),Le.removeEventListener(`sessionstart`,qe),Le.removeEventListener(`sessionend`,Je),Ye.stop()};function Re(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),b=!0}function ze(){console.log(`THREE.WebGLRenderer: Context Restored.`),b=!1;let e=ge.autoReset,t=Oe.enabled,n=Oe.autoUpdate,r=Oe.needsUpdate,i=Oe.type;Ie(),ge.autoReset=e,Oe.enabled=t,Oe.autoUpdate=n,Oe.needsUpdate=r,Oe.type=i}function Be(e){console.error(`THREE.WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function Ve(e){let t=e.target;t.removeEventListener(`dispose`,Ve),He(t)}function He(e){Ue(e),R.remove(e)}function Ue(e){let t=R.get(e).programs;t!==void 0&&(t.forEach(function(e){Ce.releaseProgram(e)}),e.isShaderMaterial&&Ce.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=ue);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=it(e,t,n,r,i);L.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=xe.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Pe.setup(i,r,s,n,c);let h,g=je;if(c!==null&&(h=be.get(c),g=Me,g.setIndex(h)),i.isMesh)r.wireframe===!0?(L.setLineWidth(r.wireframeLinewidth*fe()),g.setMode(I.LINES)):g.setMode(I.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),L.setLineWidth(e*fe()),i.isLineSegments?g.setMode(I.LINES):i.isLineLoop?g.setMode(I.LINE_LOOP):g.setMode(I.LINE_STRIP)}else i.isPoints?g.setMode(I.POINTS):i.isSprite&&g.setMode(I.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null)aC(`THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.`),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(me.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?be.get(c).bytesPerElement:1,o=R.get(r).currentProgram.getUniforms();for(let r=0;r{function n(){if(r.forEach(function(e){R.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}me.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let Ge=null;function Ke(e){Ge&&Ge(e)}function qe(){Ye.stop()}function Je(){Ye.start()}let Ye=new sO;Ye.setAnimationLoop(Ke),typeof self<`u`&&Ye.setContext(self),this.setAnimationLoop=function(e){Ge=e,Le.setAnimationLoop(e),e===null?Ye.stop():Ye.start()},Le.addEventListener(`sessionstart`,qe),Le.addEventListener(`sessionend`,Je),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(b===!0)return;if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Le.enabled===!0&&Le.isPresenting===!0&&(Le.cameraAutoUpdate===!0&&Le.updateCamera(t),t=Le.getCamera()),e.isScene===!0&&e.onBeforeRender(y,e,t,C),g=Ee.get(e,v.length),g.init(t),v.push(g),se.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),re.setFromProjectionMatrix(se),ae=this.localClippingEnabled,ie=De.init(this.clippingPlanes,ae),h=Te.get(e,_.length),h.init(),_.push(h),Le.enabled===!0&&Le.isPresenting===!0){let e=y.xr.getDepthSensingMesh();e!==null&&Xe(e,t,-1/0,y.sortObjects)}Xe(e,t,0,y.sortObjects),h.finish(),y.sortObjects===!0&&h.sort(P,F),de=Le.enabled===!1||Le.isPresenting===!1||Le.hasDepthSensing()===!1,de&&ke.addToRenderList(h,e),this.info.render.frame++,ie===!0&&De.beginShadows();let n=g.state.shadowsArray;Oe.render(n,e,t),ie===!0&&De.endShadows(),this.info.autoReset===!0&&this.info.reset();let r=h.opaque,i=h.transmissive;if(g.setupLights(),t.isArrayCamera){let n=t.cameras;if(i.length>0)for(let t=0,a=n.length;t0&&Qe(r,i,e,t),de&&ke.render(e),Ze(h,e,t);C!==null&&S===0&&(_e.updateMultisampleRenderTarget(C),_e.updateRenderTargetMipmap(C)),e.isScene===!0&&e.onAfterRender(y,e,t),Pe.resetDefaultState(),w=-1,T=null,v.pop(),v.length>0?(g=v[v.length-1],ie===!0&&De.setGlobalState(y.clippingPlanes,g.state.camera)):g=null,_.pop(),h=_.length>0?_[_.length-1]:null};function Xe(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||re.intersectsSprite(e)){r&&le.setFromMatrixPosition(e.matrixWorld).applyMatrix4(se);let t=Se.update(e),i=e.material;i.visible&&h.push(e,t,i,n,le.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||re.intersectsObject(e))){let t=Se.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),le.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),le.copy(e.boundingSphere.center)),le.applyMatrix4(e.matrixWorld).applyMatrix4(se)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a0&&$e(i,t,n),a.length>0&&$e(a,t,n),o.length>0&&$e(o,t,n),L.buffers.depth.setTest(!0),L.buffers.depth.setMask(!0),L.buffers.color.setMask(!0),L.setPolygonOffset(!1)}function Qe(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[r.id]===void 0&&(g.state.transmissionRenderTarget[r.id]=new TC(1,1,{generateMipmaps:!0,type:me.has(`EXT_color_buffer_half_float`)||me.has(`EXT_color_buffer_float`)?fx:ax,minFilter:ix,samples:4,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:fC.workingColorSpace}));let a=g.state.transmissionRenderTarget[r.id],o=r.viewport||E;a.setSize(o.z*y.transmissionResolutionScale,o.w*y.transmissionResolutionScale);let s=y.getRenderTarget();y.setRenderTarget(a),y.getClearColor(k),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear(),de&&ke.render(n);let c=y.toneMapping;y.toneMapping=0;let l=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),g.setupLightsView(r),ie===!0&&De.setGlobalState(y.clippingPlanes,r),$e(e,n,r),_e.updateMultisampleRenderTarget(a),_e.updateRenderTargetMipmap(a),me.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i0),d=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,m=0;r.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(m=y.toneMapping);let h=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=h===void 0?0:h.length,v=R.get(r),b=g.state.lights;if(ie===!0&&(ae===!0||e!==T)){let t=e===T&&r.id===w;De.setState(r,e,t)}let x=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==b.state.version?x=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?x=!0:v.envMap===c?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==De.numPlanes||v.numIntersection!==De.numIntersection)?x=!0:v.vertexAlphas===l&&v.vertexTangents===u&&v.morphTargets===d&&v.morphNormals===f&&v.morphColors===p&&v.toneMapping===m?v.morphTargetsCount!==_&&(x=!0):x=!0:x=!0:x=!0:(x=!0,v.__version=r.version);let S=v.currentProgram;x===!0&&(S=tt(r,t,i));let E=!1,D=!1,O=!1,k=S.getUniforms(),A=v.uniforms;if(L.useProgram(S.program)&&(E=!0,D=!0,O=!0),r.id!==w&&(w=r.id,D=!0),E||T!==e){L.buffers.depth.getReversed()?(oe.copy(e.projectionMatrix),sC(oe),cC(oe),k.setValue(I,`projectionMatrix`,oe)):k.setValue(I,`projectionMatrix`,e.projectionMatrix),k.setValue(I,`viewMatrix`,e.matrixWorldInverse);let t=k.map.cameraPosition;t!==void 0&&t.setValue(I,ce.setFromMatrixPosition(e.matrixWorld)),he.logarithmicDepthBuffer&&k.setValue(I,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&k.setValue(I,`isOrthographic`,e.isOrthographicCamera===!0),T!==e&&(T=e,D=!0,O=!0)}if(i.isSkinnedMesh){k.setOptional(I,i,`bindMatrix`),k.setOptional(I,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),k.setValue(I,`boneTexture`,e.boneTexture,_e))}i.isBatchedMesh&&(k.setOptional(I,i,`batchingTexture`),k.setValue(I,`batchingTexture`,i._matricesTexture,_e),k.setOptional(I,i,`batchingIdTexture`),k.setValue(I,`batchingIdTexture`,i._indirectTexture,_e),k.setOptional(I,i,`batchingColorTexture`),i._colorsTexture!==null&&k.setValue(I,`batchingColorTexture`,i._colorsTexture,_e));let j=n.morphAttributes;if((j.position!==void 0||j.normal!==void 0||j.color!==void 0)&&Ae.update(i,n,S),(D||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,k.setValue(I,`receiveShadow`,i.receiveShadow)),r.isMeshGouraudMaterial&&r.envMap!==null&&(A.envMap.value=c,A.flipEnvMap.value=c.isCubeTexture&&c.isRenderTargetTexture===!1?-1:1),r.isMeshStandardMaterial&&r.envMap===null&&t.environment!==null&&(A.envMapIntensity.value=t.environmentIntensity),D&&(k.setValue(I,`toneMappingExposure`,y.toneMappingExposure),v.needsLights&&at(A,O),a&&r.fog===!0&&we.refreshFogUniforms(A,a),we.refreshMaterialUniforms(A,r,N,M,g.state.transmissionRenderTarget[e.id]),xk.upload(I,nt(v),A,_e)),r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(xk.upload(I,nt(v),A,_e),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&k.setValue(I,`center`,i.center),k.setValue(I,`modelViewMatrix`,i.modelViewMatrix),k.setValue(I,`normalMatrix`,i.normalMatrix),k.setValue(I,`modelMatrix`,i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&_e.useMultisampledRTT(e)===!1?R.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,E.copy(e.viewport),D.copy(e.scissor),O=e.scissorTest}else E.copy(ee).multiplyScalar(N).floor(),D.copy(te).multiplyScalar(N).floor(),O=ne;if(n!==0&&(i=st),L.bindFramebuffer(I.FRAMEBUFFER,i)&&r&&L.drawBuffers(e,i),L.viewport(E),L.scissor(D),L.setScissorTest(O),a){let r=R.get(e.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(o){let r=R.get(e.texture),i=t;I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,r.__webglTexture,n,i)}else if(e!==null&&n!==0){let t=R.get(e.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_2D,t.__webglTexture,n)}w=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=R.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){L.bindFramebuffer(I.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(!he.textureFormatReadable(c)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!he.textureTypeReadable(l)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+s),I.readPixels(t,n,r,i,Ne.convert(c),Ne.convert(l),a))}finally{let e=C===null?null:R.get(C).__webglFramebuffer;L.bindFramebuffer(I.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=R.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){L.bindFramebuffer(I.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(!he.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!he.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,d),I.bufferData(I.PIXEL_PACK_BUFFER,a.byteLength,I.STREAM_READ),e.textures.length>1&&I.readBuffer(I.COLOR_ATTACHMENT0+s),I.readPixels(t,n,r,i,Ne.convert(l),Ne.convert(u),0);let f=C===null?null:R.get(C).__webglFramebuffer;L.bindFramebuffer(I.FRAMEBUFFER,f);let p=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await oC(I,p,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,d),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,a),I.deleteBuffer(d),I.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;_e.setTexture2D(e,0),I.copyTexSubImage2D(I.TEXTURE_2D,n,0,0,o,s,i,a),L.unbindTexture()};let ct=I.createFramebuffer(),lt=I.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=null){a===null&&(i===0?a=0:(aC(`WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.`),a=i,i=0));let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Ne.convert(t.format),_=Ne.convert(t.type),v;t.isData3DTexture?(_e.setTexture3D(t,0),v=I.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(_e.setTexture2DArray(t,0),v=I.TEXTURE_2D_ARRAY):(_e.setTexture2D(t,0),v=I.TEXTURE_2D),I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,t.flipY),I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),I.pixelStorei(I.UNPACK_ALIGNMENT,t.unpackAlignment);let y=I.getParameter(I.UNPACK_ROW_LENGTH),b=I.getParameter(I.UNPACK_IMAGE_HEIGHT),x=I.getParameter(I.UNPACK_SKIP_PIXELS),S=I.getParameter(I.UNPACK_SKIP_ROWS),C=I.getParameter(I.UNPACK_SKIP_IMAGES);I.pixelStorei(I.UNPACK_ROW_LENGTH,h.width),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,h.height),I.pixelStorei(I.UNPACK_SKIP_PIXELS,l),I.pixelStorei(I.UNPACK_SKIP_ROWS,u),I.pixelStorei(I.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=R.get(e),r=R.get(t),h=R.get(n.__renderTarget),g=R.get(r.__renderTarget);L.bindFramebuffer(I.READ_FRAMEBUFFER,h.__webglFramebuffer),L.bindFramebuffer(I.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;nMath.PI&&(n-=EA),r<-Math.PI?r+=EA:r>Math.PI&&(r-=EA),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(TA.setFromSpherical(this._spherical),TA.applyQuaternion(this._quatInverse),t.copy(this.target).add(TA),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=TA.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new Y(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new Y(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=TA.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(SA.origin.copy(this.object.position),SA.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(SA.direction))OA||8*(1-this._lastQuaternion.dot(this.object.quaternion))>OA||this._lastTargetPosition.distanceToSquared(this.target)>OA?(this.dispatchEvent(yA),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?EA/60/60*this.autoRotateSpeed:EA/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){TA.setFromMatrixColumn(t,0),TA.multiplyScalar(-e),this._panOffset.add(TA)}_panUp(e,t){this.screenSpacePanning===!0?TA.setFromMatrixColumn(t,1):(TA.setFromMatrixColumn(t,0),TA.crossVectors(this.object.up,TA)),TA.multiplyScalar(e),this._panOffset.add(TA)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;TA.copy(r).sub(this.target);let i=TA.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(EA*this._rotateDelta.x/t.clientHeight),this._rotateUp(EA*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(EA*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-EA*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(EA*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-EA*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(EA*this._rotateDelta.x/t.clientHeight),this._rotateUp(EA*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t>5&31)/31,a=(e>>10&31)/31)}for(let c=1;c<=3;c++){let l=n+c*12,u=e*3*3+(c-1)*3;p[u]=t.getFloat32(l,!0),p[u+1]=t.getFloat32(l+4,!0),p[u+2]=t.getFloat32(l+8,!0),m[u]=d,m[u+1]=f,m[u+2]=g,o&&(h.setRGB(r,i,a,mS),s[u]=h.r,s[u+1]=h.g,s[u+2]=h.b)}}return f.setAttribute(`position`,new Kw(p,3)),f.setAttribute(`normal`,new Kw(m,3)),o&&(f.setAttribute(`color`,new Kw(s,3)),f.hasColors=!0,f.alpha=d),f}function i(e){let t=new nT,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g,i=/solid\s(.+)/,a=0,o=RegExp(`vertex[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),s=RegExp(`normal[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),c=[],l=[],u=[],d=new Y,f,p=0,m=0,h=0;for(;(f=n.exec(e))!==null;){m=h;let e=f[0],n=(f=i.exec(e))===null?``:f[1];for(u.push(n);(f=r.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=s.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=o.exec(n))!==null;)c.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),l.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let g=m,_=h-m;t.userData.groupNames=u,t.addGroup(g,_,p),p++}return t.setAttribute(`position`,new Yw(c,3)),t.setAttribute(`normal`,new Yw(l,3)),t}function a(e){return typeof e==`string`?e:new TextDecoder().decode(e)}function o(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n256||e.colormap_size!==24||e.colormap_type!==1)throw Error(`THREE.TGALoader: Invalid type colormap data for indexed type.`);break;case f:case p:case h:case g:if(e.colormap_type)throw Error(`THREE.TGALoader: Invalid type colormap data for colormap type.`);break;case u:throw Error(`THREE.TGALoader: No data.`);default:throw Error(`THREE.TGALoader: Invalid type `+e.image_type)}if(e.width<=0||e.height<=0)throw Error(`THREE.TGALoader: Invalid image size.`);if(e.pixel_size!==8&&e.pixel_size!==16&&e.pixel_size!==24&&e.pixel_size!==32)throw Error(`THREE.TGALoader: Invalid pixel size `+e.pixel_size)}function n(e,t,n,r,i){let a,o,s=n.pixel_size>>3,c=n.width*n.height*s;if(t&&(o=i.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),e){a=new Uint8Array(c);let e,t,n,o=0,l=new Uint8Array(s);for(;o>7,e[(u+f*d)*4+1]=(c&992)>>2,e[(u+f*d)*4+2]=(c&31)<<3,e[(u+f*d)*4+3]=c&32768?0:255;return e}function a(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=3)e[(l+d*u)*4+3]=255,e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2];return e}function o(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=4)e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2],e[(l+d*u)*4+3]=s[c+3];return e}function s(e,t,n,r,i,a,o,s){let c,l=0,u,d,f=T.width;for(d=t;d!==r;d+=n)for(u=i;u!==o;u+=a,l++)c=s[l],e[(u+f*d)*4+0]=c,e[(u+f*d)*4+1]=c,e[(u+f*d)*4+2]=c,e[(u+f*d)*4+3]=255;return e}function c(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=2)e[(l+d*u)*4+0]=s[c+0],e[(l+d*u)*4+1]=s[c+0],e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+3]=s[c+1];return e}function l(e,t,n,l,u){let d,f,p,m,h,g;switch((T.flags&_)>>v){default:case x:d=0,p=1,h=t,f=0,m=1,g=n;break;case y:d=0,p=1,h=t,f=n-1,m=-1,g=-1;break;case S:d=t-1,p=-1,h=-1,f=0,m=1,g=n;break;case b:d=t-1,p=-1,h=-1,f=n-1,m=-1,g=-1;break}if(O)switch(T.pixel_size){case 8:s(e,f,m,g,d,p,h,l);break;case 16:c(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}else switch(T.pixel_size){case 8:r(e,f,m,g,d,p,h,l,u);break;case 16:i(e,f,m,g,d,p,h,l);break;case 24:a(e,f,m,g,d,p,h,l);break;case 32:o(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}return e}let u=0,d=1,f=2,p=3,m=9,h=10,g=11,_=48,v=4,y=0,b=1,x=2,S=3;if(e.length<19)throw Error(`THREE.TGALoader: Not enough data to contain header.`);let C=0,w=new Uint8Array(e),T={id_length:w[C++],colormap_type:w[C++],image_type:w[C++],colormap_index:w[C++]|w[C++]<<8,colormap_length:w[C++]|w[C++]<<8,colormap_size:w[C++],origin:[w[C++]|w[C++]<<8,w[C++]|w[C++]<<8],width:w[C++]|w[C++]<<8,height:w[C++]|w[C++]<<8,pixel_size:w[C++],flags:w[C++]};if(t(T),T.id_length+C>e.length)throw Error(`THREE.TGALoader: No data.`);C+=T.id_length;let E=!1,D=!1,O=!1;switch(T.image_type){case 9:E=!0,D=!0;break;case 1:D=!0;break;case 10:E=!0;break;case 2:break;case 11:E=!0,O=!0;break;case 3:O=!0;break}let k=new Uint8Array(T.width*T.height*4),A=n(E,D,T,C,w);return l(k,T.width,T.height,A.pixel_data,A.palettes),{data:k,width:T.width,height:T.height,flipY:!0,generateMipmaps:!0,minFilter:ix}}},WA=class extends fD{load(e,t,n,r){let i=this,a=i.path===``?ID.extractUrlBase(e):i.path,o=new hD(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e,t){function n(e,t){let n=[],r=e.childNodes;for(let e=0,i=r.length;e0&&t.push(new sD(r+`.position`,i,a)),o.length>0&&t.push(new aD(r+`.quaternion`,i,o)),s.length>0&&t.push(new sD(r+`.scale`,i,s)),t}function E(e,t,n){let r,i=!0,a,o;for(a=0,o=e.length;a=0;){let r=e[t];if(r.value[n]!==null)return r;t--}return null}function k(e,t,n){for(;t>>0)+2);switch(n=n.toLowerCase(),n){case`tga`:t=It;break;default:t=Ft}return t}function Ce(e){let t=be(e.url),n=t.profile.technique,r;switch(n.type){case`phong`:case`blinn`:r=new VE;break;case`lambert`:r=new HE;break;default:r=new Uw;break}r.name=e.name||``;function i(e,n=null){let r=t.profile.samplers[e.id],i=null;if(r!==void 0){let e=t.profile.surfaces[r.source];i=se(e.init_from)}else console.warn(`THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530).`),i=se(e.id);if(i!==null){let t=Se(i);if(t!==void 0){let r=t.load(i),a=e.extra;if(a!==void 0&&a.technique!==void 0&&c(a.technique)===!1){let e=a.technique;r.wrapS=e.wrapU?Xb:Zb,r.wrapT=e.wrapV?Xb:Zb,r.offset.set(e.offsetU||0,e.offsetV||0),r.repeat.set(e.repeatU||1,e.repeatV||1)}else r.wrapS=Xb,r.wrapT=Xb;return n!==null&&(r.colorSpace=n),r}else return console.warn(`THREE.ColladaLoader: Loader for texture %s not found.`,i),null}else return console.warn(`THREE.ColladaLoader: Couldn't create texture with ID:`,e.id),null}let a=n.parameters;for(let e in a){let t=a[e];switch(e){case`diffuse`:t.color&&r.color.fromArray(t.color),t.texture&&(r.map=i(t.texture,mS));break;case`specular`:t.color&&r.specular&&r.specular.fromArray(t.color),t.texture&&(r.specularMap=i(t.texture));break;case`bump`:t.texture&&(r.normalMap=i(t.texture));break;case`ambient`:t.texture&&(r.lightMap=i(t.texture,mS));break;case`shininess`:t.float&&r.shininess&&(r.shininess=t.float);break;case`emission`:t.color&&r.emissive&&r.emissive.fromArray(t.color),t.texture&&(r.emissiveMap=i(t.texture,mS));break}}fC.colorSpaceToWorking(r.color,mS),r.specular&&fC.colorSpaceToWorking(r.specular,mS),r.emissive&&fC.colorSpaceToWorking(r.emissive,mS);let o=a.transparent,s=a.transparency;if(s===void 0&&o&&(s={float:1}),o===void 0&&s&&(o={opaque:`A_ONE`,data:{color:[1,1,1,1]}}),o&&s)if(o.data.texture)r.transparent=!0;else{let e=o.data.color;switch(o.opaque){case`A_ONE`:r.opacity=e[3]*s.float;break;case`RGB_ZERO`:r.opacity=1-e[0]*s.float;break;case`A_ZERO`:r.opacity=1-e[3]*s.float;break;case`RGB_ONE`:r.opacity=e[0]*s.float;break;default:console.warn(`THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.`,o.opaque)}r.opacity<1&&(r.transparent=!0)}if(n.extra!==void 0&&n.extra.technique!==void 0){let e=n.extra.technique;for(let t in e){let n=e[t];switch(t){case`double_sided`:r.side=n===1?2:0;break;case`bump`:r.normalMap=i(n.texture),r.normalScale=new YS(1,1);break}}}return r}function we(e){return m(z.materials[e],Ce)}function Te(e){let t={name:e.getAttribute(`name`)};for(let n=0,r=e.childNodes.length;n0?n+s:n;t.inputs[c]={id:e,offset:i},t.stride=Math.max(t.stride,i+1),n===`TEXCOORD`&&(t.hasUV=!0);break;case`vcount`:t.vcount=a(r.textContent);break;case`p`:t.p=a(r.textContent);break}}return t}function Be(e){let t={};for(let n=0;n0&&t0&&d.setAttribute(`position`,new Yw(i.array,i.stride)),a.array.length>0&&d.setAttribute(`normal`,new Yw(a.array,a.stride)),c.array.length>0&&d.setAttribute(`color`,new Yw(c.array,c.stride)),o.array.length>0&&d.setAttribute(`uv`,new Yw(o.array,o.stride)),s.array.length>0&&d.setAttribute(`uv1`,new Yw(s.array,s.stride)),l.array.length>0&&d.setAttribute(`skinIndex`,new Yw(l.array,l.stride)),u.array.length>0&&d.setAttribute(`skinWeight`,new Yw(u.array,u.stride)),r.data=d,r.type=e[0].type,r.materialKeys=f,r}function We(e,t,n,r,i=!1){let a=e.p,o=e.stride,s=e.vcount;function c(e){let t=a[e+n]*u,o=t+u;for(;t4)for(let t=1,r=n-2;t<=r;t++){let n=e+o*0,r=e+o*t,i=e+o*(t+1);c(n),c(r),c(i)}e+=o*n}}else for(let e=0,t=a.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function Qe(e){let t={sid:e.getAttribute(`sid`),name:e.getAttribute(`name`)||``,attachments:[],transforms:[]};for(let n=0;nr.limits.max||te===null?null:parseFloat(e)),(!this.origPosition||!this.origQuaternion)&&(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let t=!1;switch(this.mimicJoints.forEach(n=>{t=n.updateFromMimickedJoint(...e)||t}),this.jointType){case`fixed`:return t;case`continuous`:case`revolute`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(!this.ignoreLimits&&this.jointType===`revolute`&&(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.quaternion.setFromAxisAngle(this.axis,n).premultiply(this.origQuaternion),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`prismatic`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(this.ignoreLimits||(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.position.copy(this.origPosition),JA.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(JA,n),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`floating`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],this.jointValue[3]=e[3]===null?this.jointValue[3]:e[3],this.jointValue[4]=e[4]===null?this.jointValue[4]:e[4],this.jointValue[5]=e[5]===null?this.jointValue[5]:e[5],ZA.compose(this.origPosition,this.origQuaternion,$A),QA.setFromEuler(YA.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],`XYZ`)),ej.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),XA.compose(ej,QA,$A),ZA.premultiply(XA),this.position.setFromMatrixPosition(ZA),this.rotation.setFromRotationMatrix(ZA),this.matrixWorldNeedsUpdate=!0,!0);case`planar`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],ZA.compose(this.origPosition,this.origQuaternion,$A),QA.setFromAxisAngle(this.axis,this.jointValue[2]),ej.set(this.jointValue[0],this.jointValue[1],0),XA.compose(ej,QA,$A),ZA.premultiply(XA),this.position.setFromMatrixPosition(ZA),this.rotation.setFromRotationMatrix(ZA),this.matrixWorldNeedsUpdate=!0,!0)}return t}},oj=class extends aj{constructor(...e){super(...e),this.type=`URDFMimicJoint`,this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...e){let t=e.map(e=>e===null?null:e*this.multiplier+this.offset);return super.setJointValue(...t)}copy(e,t){return super.copy(e,t),this.mimicJoint=e.mimicJoint,this.offset=e.offset,this.multiplier=e.multiplier,this}},sj=class extends ij{constructor(...e){super(...e),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(e,t){super.copy(e,t),this.urdfRobotNode=e.urdfRobotNode,this.robotName=e.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(t=>{t.isURDFJoint&&t.urdfName in e.joints&&(this.joints[t.urdfName]=t),t.isURDFLink&&t.urdfName in e.links&&(this.links[t.urdfName]=t),t.isURDFCollider&&t.urdfName in e.colliders&&(this.colliders[t.urdfName]=t),t.isURDFVisual&&t.urdfName in e.visual&&(this.visual[t.urdfName]=t)});for(let e in this.joints)this.joints[e].mimicJoints=this.joints[e].mimicJoints.map(e=>this.joints[e.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(e){return this.frames[e]}setJointValue(e,...t){let n=this.joints[e];return n?n.setJointValue(...t):!1}setJointValues(e){let t=!1;for(let n in e){let r=e[n];t=Array.isArray(r)?this.setJointValue(n,...r)||t:this.setJointValue(n,r)||t}return t}},cj=new VS,lj=new nw;function uj(e){return e?e.trim().split(/\s+/g).map(e=>parseFloat(e)):[0,0,0]}function dj(e,t,n=!1){n||e.rotation.set(0,0,0),lj.set(t[0],t[1],t[2],`ZYX`),cj.setFromEuler(lj),cj.multiply(e.quaternion),e.quaternion.copy(cj)}var fj=class{constructor(e){this.manager=e||fD,this.loadMeshCb=this.defaultMeshLoader.bind(this),this.parseVisual=!0,this.parseCollision=!1,this.packages=``,this.workingPath=``,this.fetchOptions={}}loadAsync(e){return new Promise((t,n)=>{this.load(e,t,null,n)})}load(e,t,n,r){let i=this.manager,a=LD.extractUrlBase(e),o=this.manager.resolveURL(e);i.itemStart(o),fetch(o,this.fetchOptions).then(e=>{if(e.ok)return n&&n(null),e.text();throw Error(`URDFLoader: Failed to load url '${o}' with error code ${e.status} : ${e.statusText}.`)}).then(e=>{t(this.parse(e,this.workingPath||a)),i.itemEnd(o)}).catch(e=>{r?r(e):console.error(`URDFLoader: Error loading file.`,e),i.itemError(o),i.itemEnd(o)})}parse(e,t=this.workingPath){let n=this.packages,r=this.loadMeshCb,i=this.parseVisual,a=this.parseCollision,o=this.manager,s={},c={},l={};function u(e){if(!/^package:\/\//.test(e))return t?t+e:e;let[r,i]=e.replace(/^package:\/\//,``).split(/\/(.+)/);if(typeof n==`string`)return n.endsWith(r)?n+`/`+i:n+`/`+r+`/`+i;if(typeof n==`function`)return n(r)+`/`+i;if(typeof n==`object`)return r in n?n[r]+`/`+i:(console.error(`URDFLoader : ${r} not found in provided package list.`),null)}function d(e){let t;return t=e instanceof Document?[...e.children]:e instanceof Element?[e]:[...new DOMParser().parseFromString(e,`text/xml`).children],f(t.filter(e=>e.nodeName===`robot`).pop())}function f(e){let t=[...e.children],n=t.filter(e=>e.nodeName.toLowerCase()===`link`),r=t.filter(e=>e.nodeName.toLowerCase()===`joint`),i=t.filter(e=>e.nodeName.toLowerCase()===`material`),a=new sj;a.robotName=e.getAttribute(`name`),a.urdfRobotNode=e,i.forEach(e=>{let t=e.getAttribute(`name`);l[t]=h(e)});let o={},u={};n.forEach(t=>{let n=t.getAttribute(`name`);s[n]=m(t,o,u,e.querySelector(`child[link="${n}"]`)===null?a:null)}),r.forEach(e=>{let t=e.getAttribute(`name`);c[t]=p(e)}),a.joints=c,a.links=s,a.colliders=u,a.visual=o;let d=Object.values(c);return d.forEach(e=>{e instanceof oj&&c[e.mimicJoint].mimicJoints.push(e)}),d.forEach(e=>{let t=new Set,n=e=>{if(t.has(e))throw Error(`URDFLoader: Detected an infinite loop of mimic joints.`);t.add(e),e.mimicJoints.forEach(e=>{n(e)})};n(e)}),a.frames={...u,...o,...s,...c},a}function p(e){let t=[...e.children],n=e.getAttribute(`type`),r,i=t.find(e=>e.nodeName.toLowerCase()===`mimic`);i?(r=new oj,r.mimicJoint=i.getAttribute(`joint`),r.multiplier=parseFloat(i.getAttribute(`multiplier`)||1),r.offset=parseFloat(i.getAttribute(`offset`)||0)):r=new aj,r.urdfNode=e,r.name=e.getAttribute(`name`),r.urdfName=r.name,r.jointType=n;let a=null,o=null,c=[0,0,0],l=[0,0,0];t.forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(c=uj(e.getAttribute(`xyz`)),l=uj(e.getAttribute(`rpy`))):t===`child`?o=s[e.getAttribute(`link`)]:t===`parent`?a=s[e.getAttribute(`link`)]:t===`limit`&&(r.limit.lower=parseFloat(e.getAttribute(`lower`)||r.limit.lower),r.limit.upper=parseFloat(e.getAttribute(`upper`)||r.limit.upper),r.limit.effort=parseFloat(e.getAttribute(`effort`)||r.limit.effort),r.limit.velocity=parseFloat(e.getAttribute(`velocity`)||r.limit.velocity))}),a.add(r),r.add(o),dj(r,l),r.position.set(c[0],c[1],c[2]);let u=t.filter(e=>e.nodeName.toLowerCase()===`axis`)[0];if(u){let e=u.getAttribute(`xyz`).split(/\s+/g).map(e=>parseFloat(e));r.axis=new Y(e[0],e[1],e[2]),r.axis.normalize()}return r}function m(e,t,n,r=null){r===null&&(r=new ij);let o=[...e.children];r.name=e.getAttribute(`name`),r.urdfName=r.name,r.urdfNode=e;let s=o.find(e=>e.nodeName.toLowerCase()===`inertial`);return s&&[...s.children].forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(r.inertial.origin.xyz=uj(e.getAttribute(`xyz`)),r.inertial.origin.rpy=uj(e.getAttribute(`rpy`))):t===`mass`?r.inertial.mass=parseFloat(e.getAttribute(`value`))||0:t===`inertia`&&(r.inertial.inertia.ixx=parseFloat(e.getAttribute(`ixx`))||0,r.inertial.inertia.ixy=parseFloat(e.getAttribute(`ixy`))||0,r.inertial.inertia.ixz=parseFloat(e.getAttribute(`ixz`))||0,r.inertial.inertia.iyy=parseFloat(e.getAttribute(`iyy`))||0,r.inertial.inertia.iyz=parseFloat(e.getAttribute(`iyz`))||0,r.inertial.inertia.izz=parseFloat(e.getAttribute(`izz`))||0)}),i&&o.filter(e=>e.nodeName.toLowerCase()===`visual`).forEach(e=>{let n=g(e,l);if(r.add(n),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);n.name=r,n.urdfName=r,t[r]=n}}),a&&o.filter(e=>e.nodeName.toLowerCase()===`collision`).forEach(e=>{let t=g(e);if(r.add(t),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);t.name=r,t.urdfName=r,n[r]=t}}),r}function h(e){let t=[...e.children],n=new BE;return n.name=e.getAttribute(`name`)||``,t.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`color`){let t=e.getAttribute(`rgba`).split(/\s/g).map(e=>parseFloat(e));n.color.setRGB(t[0],t[1],t[2]),n.opacity=t[3],n.transparent=t[3]<1,n.depthWrite=!n.transparent}else if(t===`texture`){let t=e.getAttribute(`filename`);if(t){let e=new yD(o),r=u(t);n.map=e.load(r),n.map.colorSpace=aS}}}),n}function g(e,t={}){let n=e.nodeName.toLowerCase()===`collision`,i=[...e.children],a=null,s=i.filter(e=>e.nodeName.toLowerCase()===`material`)[0];if(s){let e=s.getAttribute(`name`);a=e&&e in t?t[e]:h(s)}else a=new BE;let c=n?new nj:new rj;return c.urdfNode=e,i.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`geometry`){let t=e.children[0].nodeName.toLowerCase();if(t===`mesh`){let t=u(e.children[0].getAttribute(`filename`));if(t!==null){let n=e.children[0].getAttribute(`scale`);if(n){let e=uj(n);c.scale.set(e[0],e[1],e[2])}r(t,o,(e,t)=>{t?console.error(`URDFLoader: Error loading mesh.`,t):e&&(e instanceof fT&&(e.material=a),e.position.set(0,0,0),e.quaternion.identity(),c.add(e))})}}else if(t===`box`){let t=new fT;t.geometry=new mT(1,1,1),t.material=a;let n=uj(e.children[0].getAttribute(`size`));t.scale.set(n[0],n[1],n[2]),c.add(t)}else if(t===`sphere`){let t=new fT;t.geometry=new IE(1,30,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0;t.scale.set(n,n,n),c.add(t)}else if(t===`cylinder`){let t=new fT;t.geometry=new PE(1,1,1,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0,r=parseFloat(e.children[0].getAttribute(`length`))||0;t.scale.set(n,r,n),t.rotation.set(Math.PI/2,0,0),c.add(t)}}else if(t===`origin`){let t=uj(e.getAttribute(`xyz`)),n=uj(e.getAttribute(`rpy`));c.position.set(t[0],t[1],t[2]),c.rotation.set(0,0,0),dj(c,n)}}),c}return d(e)}defaultMeshLoader(e,t,n){/\.stl$/i.test(e)?new GA(t).load(e,e=>{n(new fT(e,new BE))},null,e=>n(null,e)):/\.dae$/i.test(e)?new qA(t).load(e,e=>n(e.scene),null,e=>n(null,e)):console.warn(`URDFLoader: Could not load model at ${e}.\nNo loader available`)}},pj=new BS,mj=()=>{},hj=class extends HTMLElement{static get observedAttributes(){return[`package`,`urdf`,`up`,`display-shadow`,`ambient-color`,`ignore-limits`,`show-collision`]}get package(){return this.getAttribute(`package`)||``}set package(e){this.setAttribute(`package`,e)}get urdf(){return this.getAttribute(`urdf`)||``}set urdf(e){this.setAttribute(`urdf`,e)}get ignoreLimits(){return this.hasAttribute(`ignore-limits`)||!1}set ignoreLimits(e){e?this.setAttribute(`ignore-limits`,e):this.removeAttribute(`ignore-limits`)}get up(){return this.getAttribute(`up`)||`+Z`}set up(e){this.setAttribute(`up`,e)}get displayShadow(){return this.hasAttribute(`display-shadow`)||!1}set displayShadow(e){e?this.setAttribute(`display-shadow`,``):this.removeAttribute(`display-shadow`)}get ambientColor(){return this.getAttribute(`ambient-color`)||`#8ea0a8`}set ambientColor(e){e?this.setAttribute(`ambient-color`,e):this.removeAttribute(`ambient-color`)}get autoRedraw(){return this.hasAttribute(`auto-redraw`)||!1}set autoRedraw(e){e?this.setAttribute(`auto-redraw`,!0):this.removeAttribute(`auto-redraw`)}get noAutoRecenter(){return this.hasAttribute(`no-auto-recenter`)||!1}set noAutoRecenter(e){e?this.setAttribute(`no-auto-recenter`,!0):this.removeAttribute(`no-auto-recenter`)}get showCollision(){return this.hasAttribute(`show-collision`)||!1}set showCollision(e){e?this.setAttribute(`show-collision`,!0):this.removeAttribute(`show-collision`)}get jointValues(){let e={};if(this.robot)for(let t in this.robot.joints){let n=this.robot.joints[t];e[t]=n.jointValue.length===1?n.angle:[...n.jointValue]}return e}set jointValues(e){this.setJointValues(e)}get angles(){return this.jointValues}set angles(e){this.jointValues=e}constructor(){super(),this._requestId=0,this._dirty=!1,this._loadScheduled=!1,this.robot=null,this.loadMeshFunc=null,this.urlModifierFunc=null;let e=new MT,t=new xD(this.ambientColor,`#000`);t.groundColor.lerp(t.color,.5*Math.PI),t.intensity=.5,t.position.set(0,1,0),e.add(t);let n=new FD(16777215,Math.PI);n.position.set(4,10,1),n.shadow.mapSize.width=2048,n.shadow.mapSize.height=2048,n.shadow.normalBias=.001,n.castShadow=!0,e.add(n),e.add(n.target);let r=new xA({antialias:!0,alpha:!0});r.setClearColor(16777215),r.setClearAlpha(0),r.shadowMap.enabled=!0,r.shadowMap.type=2,r.outputColorSpace=aS;let i=new CT(75,1,.1,1e3);i.position.z=-10;let a=new yw;e.add(a);let o=new fT(new FE(40,40),new LE({side:2,transparent:!0,opacity:.25}));o.rotation.x=-Math.PI/2,o.position.y=-.5,o.receiveShadow=!0,o.scale.set(10,10,10),e.add(o);let s=new MA(i,r.domElement);s.rotateSpeed=2,s.zoomSpeed=5,s.panSpeed=2,s.enableZoom=!0,s.enableDamping=!1,s.maxDistance=50,s.minDistance=.25,s.addEventListener(`change`,()=>this.recenter()),this.scene=e,this.world=a,this.renderer=r,this.camera=i,this.controls=s,this.plane=o,this.directionalLight=n,this.ambientLight=t,this._setUp(this.up),this._collisionMaterial=new BE({transparent:!0,opacity:.35,shininess:2.5,premultipliedAlpha:!0,color:16760376,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});let c=()=>{this.parentNode&&(this.updateSize(),(this._dirty||this.autoRedraw)&&(this.noAutoRecenter||this._updateEnvironment(),this.renderer.render(e,i),this._dirty=!1),this.controls.update()),this._renderLoopId=requestAnimationFrame(c)};c()}connectedCallback(){if(!this.constructor._styletag){let e=document.createElement(`style`);e.innerHTML=` +`,t),null}let Nt=jt.getAttribute(`version`);console.debug(`THREE.ColladaLoader: File version`,Nt);let Pt=l(n(jt,`asset`)[0]),Ft=new vD(this.manager);Ft.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);let It;UA&&(It=new UA(this.manager),It.setPath(this.resourcePath||t));let Lt=new X,Rt=[],zt={},Bt=0,z={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};f(jt,`library_animations`,`animation`,h),f(jt,`library_animation_clips`,`animation_clip`,j),f(jt,`library_controllers`,`controller`,P),f(jt,`library_images`,`image`,ae),f(jt,`library_effects`,`effect`,ce),f(jt,`library_materials`,`material`,xe),f(jt,`library_cameras`,`camera`,Te),f(jt,`library_lights`,`light`,je),f(jt,`library_geometries`,`geometry`,Ie),f(jt,`library_nodes`,`node`,pt),f(jt,`library_visual_scenes`,`visual_scene`,Ct),f(jt,`library_kinematics_models`,`kinematics_model`,Ke),f(jt,`library_physics_models`,`physics_model`,tt),f(jt,`scene`,`instance_kinematics_scene`,it),p(z.animations,v),p(z.clips,M),p(z.controllers,ne),p(z.images,oe),p(z.effects,ye),p(z.materials,Ce),p(z.cameras,ke),p(z.lights,Pe),p(z.geometries,He),p(z.visualScenes,wt),Ot(),ct();let Vt=Dt(n(jt,`scene`)[0]);return Vt.animations=Rt,Pt.upAxis===`Z_UP`&&(console.warn(`THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289.`),Vt.rotation.set(-Math.PI/2,0,0)),Vt.scale.multiplyScalar(Pt.unit),{get animations(){return console.warn(`THREE.ColladaLoader: Please access animations over scene.animations now.`),Rt},kinematics:zt,library:z,scene:Vt}}},GA=new Y,KA=new lw,qA=new tw,JA=new tw,YA=new XS,XA=new Y(1,1,1),ZA=new Y,QA=class extends Sw{constructor(...e){super(...e),this.urdfNode=null,this.urdfName=``}copy(e,t){return super.copy(e,t),this.urdfNode=e.urdfNode,this.urdfName=e.urdfName,this}},$A=class extends QA{constructor(...e){super(...e),this.isURDFCollider=!0,this.type=`URDFCollider`}},ej=class extends QA{constructor(...e){super(...e),this.isURDFVisual=!0,this.type=`URDFVisual`}},tj=class extends QA{constructor(...e){super(...e),this.isURDFLink=!0,this.type=`URDFLink`,this.inertial={mass:0,origin:{xyz:[0,0,0],rpy:[0,0,0]},inertia:{ixx:0,ixy:0,ixz:0,iyy:0,iyz:0,izz:0}}}copy(e,t){return super.copy(e,t),this.inertial={mass:e.inertial.mass,origin:{xyz:[...e.inertial.origin.xyz],rpy:[...e.inertial.origin.rpy]},inertia:{...e.inertial.inertia}},this}},nj=class extends QA{get jointType(){return this._jointType}set jointType(e){if(this.jointType!==e)switch(this._jointType=e,this.matrixWorldNeedsUpdate=!0,e){case`fixed`:this.jointValue=[];break;case`continuous`:case`revolute`:case`prismatic`:this.jointValue=[,].fill(0);break;case`planar`:this.jointValue=[,,,].fill(0),this.axis=new Y(0,0,1);break;case`floating`:this.jointValue=[,,,,,,].fill(0);break}}get angle(){return this.jointValue[0]}constructor(...e){super(...e),this.isURDFJoint=!0,this.type=`URDFJoint`,this.jointValue=null,this.jointType=`fixed`,this.axis=new Y(1,0,0),this.limit={lower:0,upper:0,effort:0,velocity:0},this.ignoreLimits=!1,this.origPosition=null,this.origQuaternion=null,this.mimicJoints=[]}copy(e,t){return super.copy(e,t),this.jointType=e.jointType,this.axis=e.axis.clone(),this.limit.lower=e.limit.lower,this.limit.upper=e.limit.upper,this.limit.effort=e.limit.effort,this.limit.velocity=e.limit.velocity,this.ignoreLimits=!1,this.jointValue=[...e.jointValue],this.origPosition=e.origPosition?e.origPosition.clone():null,this.origQuaternion=e.origQuaternion?e.origQuaternion.clone():null,this.mimicJoints=[...e.mimicJoints],this}setJointValue(...e){e=e.map(e=>e===null?null:parseFloat(e)),(!this.origPosition||!this.origQuaternion)&&(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let t=!1;switch(this.mimicJoints.forEach(n=>{t=n.updateFromMimickedJoint(...e)||t}),this.jointType){case`fixed`:return t;case`continuous`:case`revolute`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(!this.ignoreLimits&&this.jointType===`revolute`&&(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.quaternion.setFromAxisAngle(this.axis,n).premultiply(this.origQuaternion),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`prismatic`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(this.ignoreLimits||(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.position.copy(this.origPosition),GA.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(GA,n),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`floating`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],this.jointValue[3]=e[3]===null?this.jointValue[3]:e[3],this.jointValue[4]=e[4]===null?this.jointValue[4]:e[4],this.jointValue[5]=e[5]===null?this.jointValue[5]:e[5],JA.compose(this.origPosition,this.origQuaternion,XA),YA.setFromEuler(KA.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],`XYZ`)),ZA.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),qA.compose(ZA,YA,XA),JA.premultiply(qA),this.position.setFromMatrixPosition(JA),this.rotation.setFromRotationMatrix(JA),this.matrixWorldNeedsUpdate=!0,!0);case`planar`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],JA.compose(this.origPosition,this.origQuaternion,XA),YA.setFromAxisAngle(this.axis,this.jointValue[2]),ZA.set(this.jointValue[0],this.jointValue[1],0),qA.compose(ZA,YA,XA),JA.premultiply(qA),this.position.setFromMatrixPosition(JA),this.rotation.setFromRotationMatrix(JA),this.matrixWorldNeedsUpdate=!0,!0)}return t}},rj=class extends nj{constructor(...e){super(...e),this.type=`URDFMimicJoint`,this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...e){let t=e.map(e=>e===null?null:e*this.multiplier+this.offset);return super.setJointValue(...t)}copy(e,t){return super.copy(e,t),this.mimicJoint=e.mimicJoint,this.offset=e.offset,this.multiplier=e.multiplier,this}},ij=class extends tj{constructor(...e){super(...e),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(e,t){super.copy(e,t),this.urdfRobotNode=e.urdfRobotNode,this.robotName=e.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(t=>{t.isURDFJoint&&t.urdfName in e.joints&&(this.joints[t.urdfName]=t),t.isURDFLink&&t.urdfName in e.links&&(this.links[t.urdfName]=t),t.isURDFCollider&&t.urdfName in e.colliders&&(this.colliders[t.urdfName]=t),t.isURDFVisual&&t.urdfName in e.visual&&(this.visual[t.urdfName]=t)});for(let e in this.joints)this.joints[e].mimicJoints=this.joints[e].mimicJoints.map(e=>this.joints[e.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(e){return this.frames[e]}setJointValue(e,...t){let n=this.joints[e];return n?n.setJointValue(...t):!1}setJointValues(e){let t=!1;for(let n in e){let r=e[n];t=Array.isArray(r)?this.setJointValue(n,...r)||t:this.setJointValue(n,r)||t}return t}},aj=new XS,oj=new lw;function sj(e){return e?e.trim().split(/\s+/g).map(e=>parseFloat(e)):[0,0,0]}function cj(e,t,n=!1){n||e.rotation.set(0,0,0),oj.set(t[0],t[1],t[2],`ZYX`),aj.setFromEuler(oj),aj.multiply(e.quaternion),e.quaternion.copy(aj)}var lj=class{constructor(e){this.manager=e||dD,this.loadMeshCb=this.defaultMeshLoader.bind(this),this.parseVisual=!0,this.parseCollision=!1,this.packages=``,this.workingPath=``,this.fetchOptions={}}loadAsync(e){return new Promise((t,n)=>{this.load(e,t,null,n)})}load(e,t,n,r){let i=this.manager,a=ID.extractUrlBase(e),o=this.manager.resolveURL(e);i.itemStart(o),fetch(o,this.fetchOptions).then(e=>{if(e.ok)return n&&n(null),e.text();throw Error(`URDFLoader: Failed to load url '${o}' with error code ${e.status} : ${e.statusText}.`)}).then(e=>{t(this.parse(e,this.workingPath||a)),i.itemEnd(o)}).catch(e=>{r?r(e):console.error(`URDFLoader: Error loading file.`,e),i.itemError(o),i.itemEnd(o)})}parse(e,t=this.workingPath){let n=this.packages,r=this.loadMeshCb,i=this.parseVisual,a=this.parseCollision,o=this.manager,s={},c={},l={};function u(e){if(!/^package:\/\//.test(e))return t?t+e:e;let[r,i]=e.replace(/^package:\/\//,``).split(/\/(.+)/);if(typeof n==`string`)return n.endsWith(r)?n+`/`+i:n+`/`+r+`/`+i;if(typeof n==`function`)return n(r)+`/`+i;if(typeof n==`object`)return r in n?n[r]+`/`+i:(console.error(`URDFLoader : ${r} not found in provided package list.`),null)}function d(e){let t;return t=e instanceof Document?[...e.children]:e instanceof Element?[e]:[...new DOMParser().parseFromString(e,`text/xml`).children],f(t.filter(e=>e.nodeName===`robot`).pop())}function f(e){let t=[...e.children],n=t.filter(e=>e.nodeName.toLowerCase()===`link`),r=t.filter(e=>e.nodeName.toLowerCase()===`joint`),i=t.filter(e=>e.nodeName.toLowerCase()===`material`),a=new ij;a.robotName=e.getAttribute(`name`),a.urdfRobotNode=e,i.forEach(e=>{let t=e.getAttribute(`name`);l[t]=h(e)});let o={},u={};n.forEach(t=>{let n=t.getAttribute(`name`);s[n]=m(t,o,u,e.querySelector(`child[link="${n}"]`)===null?a:null)}),r.forEach(e=>{let t=e.getAttribute(`name`);c[t]=p(e)}),a.joints=c,a.links=s,a.colliders=u,a.visual=o;let d=Object.values(c);return d.forEach(e=>{e instanceof rj&&c[e.mimicJoint].mimicJoints.push(e)}),d.forEach(e=>{let t=new Set,n=e=>{if(t.has(e))throw Error(`URDFLoader: Detected an infinite loop of mimic joints.`);t.add(e),e.mimicJoints.forEach(e=>{n(e)})};n(e)}),a.frames={...u,...o,...s,...c},a}function p(e){let t=[...e.children],n=e.getAttribute(`type`),r,i=t.find(e=>e.nodeName.toLowerCase()===`mimic`);i?(r=new rj,r.mimicJoint=i.getAttribute(`joint`),r.multiplier=parseFloat(i.getAttribute(`multiplier`)||1),r.offset=parseFloat(i.getAttribute(`offset`)||0)):r=new nj,r.urdfNode=e,r.name=e.getAttribute(`name`),r.urdfName=r.name,r.jointType=n;let a=null,o=null,c=[0,0,0],l=[0,0,0];t.forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(c=sj(e.getAttribute(`xyz`)),l=sj(e.getAttribute(`rpy`))):t===`child`?o=s[e.getAttribute(`link`)]:t===`parent`?a=s[e.getAttribute(`link`)]:t===`limit`&&(r.limit.lower=parseFloat(e.getAttribute(`lower`)||r.limit.lower),r.limit.upper=parseFloat(e.getAttribute(`upper`)||r.limit.upper),r.limit.effort=parseFloat(e.getAttribute(`effort`)||r.limit.effort),r.limit.velocity=parseFloat(e.getAttribute(`velocity`)||r.limit.velocity))}),a.add(r),r.add(o),cj(r,l),r.position.set(c[0],c[1],c[2]);let u=t.filter(e=>e.nodeName.toLowerCase()===`axis`)[0];if(u){let e=u.getAttribute(`xyz`).split(/\s+/g).map(e=>parseFloat(e));r.axis=new Y(e[0],e[1],e[2]),r.axis.normalize()}return r}function m(e,t,n,r=null){r===null&&(r=new tj);let o=[...e.children];r.name=e.getAttribute(`name`),r.urdfName=r.name,r.urdfNode=e;let s=o.find(e=>e.nodeName.toLowerCase()===`inertial`);return s&&[...s.children].forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(r.inertial.origin.xyz=sj(e.getAttribute(`xyz`)),r.inertial.origin.rpy=sj(e.getAttribute(`rpy`))):t===`mass`?r.inertial.mass=parseFloat(e.getAttribute(`value`))||0:t===`inertia`&&(r.inertial.inertia.ixx=parseFloat(e.getAttribute(`ixx`))||0,r.inertial.inertia.ixy=parseFloat(e.getAttribute(`ixy`))||0,r.inertial.inertia.ixz=parseFloat(e.getAttribute(`ixz`))||0,r.inertial.inertia.iyy=parseFloat(e.getAttribute(`iyy`))||0,r.inertial.inertia.iyz=parseFloat(e.getAttribute(`iyz`))||0,r.inertial.inertia.izz=parseFloat(e.getAttribute(`izz`))||0)}),i&&o.filter(e=>e.nodeName.toLowerCase()===`visual`).forEach(e=>{let n=g(e,l);if(r.add(n),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);n.name=r,n.urdfName=r,t[r]=n}}),a&&o.filter(e=>e.nodeName.toLowerCase()===`collision`).forEach(e=>{let t=g(e);if(r.add(t),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);t.name=r,t.urdfName=r,n[r]=t}}),r}function h(e){let t=[...e.children],n=new VE;return n.name=e.getAttribute(`name`)||``,t.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`color`){let t=e.getAttribute(`rgba`).split(/\s/g).map(e=>parseFloat(e));n.color.setRGB(t[0],t[1],t[2]),n.opacity=t[3],n.transparent=t[3]<1,n.depthWrite=!n.transparent}else if(t===`texture`){let t=e.getAttribute(`filename`);if(t){let e=new vD(o),r=u(t);n.map=e.load(r),n.map.colorSpace=mS}}}),n}function g(e,t={}){let n=e.nodeName.toLowerCase()===`collision`,i=[...e.children],a=null,s=i.filter(e=>e.nodeName.toLowerCase()===`material`)[0];if(s){let e=s.getAttribute(`name`);a=e&&e in t?t[e]:h(s)}else a=new VE;let c=n?new $A:new ej;return c.urdfNode=e,i.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`geometry`){let t=e.children[0].nodeName.toLowerCase();if(t===`mesh`){let t=u(e.children[0].getAttribute(`filename`));if(t!==null){let n=e.children[0].getAttribute(`scale`);if(n){let e=sj(n);c.scale.set(e[0],e[1],e[2])}r(t,o,(e,t)=>{t?console.error(`URDFLoader: Error loading mesh.`,t):e&&(e instanceof mT&&(e.material=a),e.position.set(0,0,0),e.quaternion.identity(),c.add(e))})}}else if(t===`box`){let t=new mT;t.geometry=new gT(1,1,1),t.material=a;let n=sj(e.children[0].getAttribute(`size`));t.scale.set(n[0],n[1],n[2]),c.add(t)}else if(t===`sphere`){let t=new mT;t.geometry=new LE(1,30,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0;t.scale.set(n,n,n),c.add(t)}else if(t===`cylinder`){let t=new mT;t.geometry=new FE(1,1,1,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0,r=parseFloat(e.children[0].getAttribute(`length`))||0;t.scale.set(n,r,n),t.rotation.set(Math.PI/2,0,0),c.add(t)}}else if(t===`origin`){let t=sj(e.getAttribute(`xyz`)),n=sj(e.getAttribute(`rpy`));c.position.set(t[0],t[1],t[2]),c.rotation.set(0,0,0),cj(c,n)}}),c}return d(e)}defaultMeshLoader(e,t,n){/\.stl$/i.test(e)?new HA(t).load(e,e=>{n(new mT(e,new VE))},null,e=>n(null,e)):/\.dae$/i.test(e)?new WA(t).load(e,e=>n(e.scene),null,e=>n(null,e)):console.warn(`URDFLoader: Could not load model at ${e}.\nNo loader available`)}},uj=new YS,dj=()=>{},fj=class extends HTMLElement{static get observedAttributes(){return[`package`,`urdf`,`up`,`display-shadow`,`ambient-color`,`ignore-limits`,`show-collision`]}get package(){return this.getAttribute(`package`)||``}set package(e){this.setAttribute(`package`,e)}get urdf(){return this.getAttribute(`urdf`)||``}set urdf(e){this.setAttribute(`urdf`,e)}get ignoreLimits(){return this.hasAttribute(`ignore-limits`)||!1}set ignoreLimits(e){e?this.setAttribute(`ignore-limits`,e):this.removeAttribute(`ignore-limits`)}get up(){return this.getAttribute(`up`)||`+Z`}set up(e){this.setAttribute(`up`,e)}get displayShadow(){return this.hasAttribute(`display-shadow`)||!1}set displayShadow(e){e?this.setAttribute(`display-shadow`,``):this.removeAttribute(`display-shadow`)}get ambientColor(){return this.getAttribute(`ambient-color`)||`#8ea0a8`}set ambientColor(e){e?this.setAttribute(`ambient-color`,e):this.removeAttribute(`ambient-color`)}get autoRedraw(){return this.hasAttribute(`auto-redraw`)||!1}set autoRedraw(e){e?this.setAttribute(`auto-redraw`,!0):this.removeAttribute(`auto-redraw`)}get noAutoRecenter(){return this.hasAttribute(`no-auto-recenter`)||!1}set noAutoRecenter(e){e?this.setAttribute(`no-auto-recenter`,!0):this.removeAttribute(`no-auto-recenter`)}get showCollision(){return this.hasAttribute(`show-collision`)||!1}set showCollision(e){e?this.setAttribute(`show-collision`,!0):this.removeAttribute(`show-collision`)}get jointValues(){let e={};if(this.robot)for(let t in this.robot.joints){let n=this.robot.joints[t];e[t]=n.jointValue.length===1?n.angle:[...n.jointValue]}return e}set jointValues(e){this.setJointValues(e)}get angles(){return this.jointValues}set angles(e){this.jointValues=e}constructor(){super(),this._requestId=0,this._dirty=!1,this._loadScheduled=!1,this.robot=null,this.loadMeshFunc=null,this.urlModifierFunc=null;let e=new MT,t=new bD(this.ambientColor,`#000`);t.groundColor.lerp(t.color,.5*Math.PI),t.intensity=.5,t.position.set(0,1,0),e.add(t);let n=new PD(16777215,Math.PI);n.position.set(4,10,1),n.shadow.mapSize.width=2048,n.shadow.mapSize.height=2048,n.shadow.normalBias=.001,n.castShadow=!0,e.add(n),e.add(n.target);let r=new vA({antialias:!0,alpha:!0});r.setClearColor(16777215),r.setClearAlpha(0),r.shadowMap.enabled=!0,r.shadowMap.type=2,r.outputColorSpace=mS;let i=new TT(75,1,.1,1e3);i.position.z=-10;let a=new Sw;e.add(a);let o=new mT(new IE(40,40),new RE({side:2,transparent:!0,opacity:.25}));o.rotation.x=-Math.PI/2,o.position.y=-.5,o.receiveShadow=!0,o.scale.set(10,10,10),e.add(o);let s=new kA(i,r.domElement);s.rotateSpeed=2,s.zoomSpeed=5,s.panSpeed=2,s.enableZoom=!0,s.enableDamping=!1,s.maxDistance=50,s.minDistance=.25,s.addEventListener(`change`,()=>this.recenter()),this.scene=e,this.world=a,this.renderer=r,this.camera=i,this.controls=s,this.plane=o,this.directionalLight=n,this.ambientLight=t,this._setUp(this.up),this._collisionMaterial=new VE({transparent:!0,opacity:.35,shininess:2.5,premultipliedAlpha:!0,color:16760376,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});let c=()=>{this.parentNode&&(this.updateSize(),(this._dirty||this.autoRedraw)&&(this.noAutoRecenter||this._updateEnvironment(),this.renderer.render(e,i),this._dirty=!1),this.controls.update()),this._renderLoopId=requestAnimationFrame(c)};c()}connectedCallback(){if(!this.constructor._styletag){let e=document.createElement(`style`);e.innerHTML=` ${this.tagName} { display: block; } ${this.tagName} canvas { width: 100%; height: 100%; } - `,document.head.appendChild(e),this.constructor._styletag=e}this.childElementCount===0&&this.appendChild(this.renderer.domElement),this.updateSize(),requestAnimationFrame(()=>this.updateSize())}disconnectedCallback(){cancelAnimationFrame(this._renderLoopId)}attributeChangedCallback(e,t,n){switch(this._updateCollisionVisibility(),this.noAutoRecenter||this.recenter(),e){case`package`:case`urdf`:this._scheduleLoad();break;case`up`:this._setUp(this.up);break;case`ambient-color`:this.ambientLight.color.set(this.ambientColor),this.ambientLight.groundColor.set(`#000`).lerp(this.ambientLight.color,.5);break;case`ignore-limits`:this._setIgnoreLimits(this.ignoreLimits,!0);break}}updateSize(){let e=this.renderer,t=this.clientWidth,n=this.clientHeight,r=e.getSize(pj);(r.width!==t||r.height!==n)&&this.recenter(),e.setPixelRatio(window.devicePixelRatio),e.setSize(t,n,!1),this.camera.aspect=t/n,this.camera.updateProjectionMatrix()}redraw(){this._dirty=!0}recenter(){this._updateEnvironment(),this.redraw()}setJointValue(e,...t){this.robot&&this.robot.joints[e]&&this.robot.joints[e].setJointValue(...t)&&(this.redraw(),this.dispatchEvent(new CustomEvent(`angle-change`,{bubbles:!0,cancelable:!0,detail:e})))}setJointValues(e){for(let t in e)Array.isArray(e[t])?this.setJointValue(t,...e[t]):this.setJointValue(t,e[t])}_updateEnvironment(){let e=this.robot;if(!e)return;this.world.updateMatrixWorld();let t=new yC;t.makeEmpty(),e.traverse(e=>{e.isURDFVisual&&t.expandByObject(e)});let n=t.getCenter(new Y);this.controls.target.y=n.y,this.plane.position.y=t.min.y-.001;let r=this.directionalLight;if(r.castShadow=this.displayShadow,this.displayShadow){let e=t.getBoundingSphere(new LC).radius,i=r.shadow.camera;i.left=i.bottom=-e,i.right=i.top=e;let a=r.position.clone().sub(r.target.position);r.target.position.copy(n),r.position.copy(n).add(a),i.updateProjectionMatrix()}}_scheduleLoad(){this._prevload!==`${this.package}|${this.urdf}`&&(this._prevload=`${this.package}|${this.urdf}`,!this._loadScheduled&&(this._loadScheduled=!0,this.robot&&=(this.robot.traverse(e=>e.dispose&&e.dispose()),this.robot.parent.remove(this.robot),null),requestAnimationFrame(()=>{this._loadUrdf(this.package,this.urdf),this._loadScheduled=!1})))}_loadUrdf(e,t){if(this.dispatchEvent(new CustomEvent(`urdf-change`,{bubbles:!0,cancelable:!0,composed:!0})),t){this._requestId++;let n=this._requestId,r=e=>{e.traverse(e=>{if(e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0,e.material)){let t=(Array.isArray(e.material)?e.material:[e.material]).map(e=>(e instanceof Vw&&(e=new BE),e.map&&(e.map.colorSpace=aS),e));e.material=t.length===1?t[0]:t}})};e.includes(`:`)&&e.split(`:`)[1].substring(0,2)!==`//`&&(e=e.split(`,`).reduce((e,t)=>{let n=t.split(/:/).filter(e=>!!e),r=n.shift().trim();return e[r]=n.join(`:`).trim(),e},{}));let i=null,a=new dD;a.onLoad=()=>{if(this._requestId!==n){i.traverse(e=>e.dispose&&e.dispose());return}this.robot=i,this.world.add(i),r(i),this._setIgnoreLimits(this.ignoreLimits),this._updateCollisionVisibility(),this.dispatchEvent(new CustomEvent(`urdf-processed`,{bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`geometry-loaded`,{bubbles:!0,cancelable:!0,composed:!0})),this.recenter()},this.urlModifierFunc&&a.setURLModifier(this.urlModifierFunc);let o=new fj(a);o.packages=e,o.loadMeshCb=this.loadMeshFunc,o.fetchOptions={mode:`cors`,credentials:`same-origin`},o.parseCollision=!0,o.load(t,e=>i=e)}}_updateCollisionVisibility(){let e=this.showCollision,t=this._collisionMaterial,n=this.robot;if(n===null)return;let r=[];n.traverse(t=>{t.isURDFCollider&&(t.visible=e,r.push(t))}),r.forEach(e=>{e.traverse(e=>{e.isMesh&&(e.raycast=mj,e.material=t,e.castShadow=!1)})})}_setUp(e){e||=`+Z`,e=e.toUpperCase();let t=e.replace(/[^-+]/g,``)[0]||`+`,n=e.replace(/[^XYZ]/gi,``)[0]||`Z`,r=Math.PI,i=r/2;n===`X`&&this.world.rotation.set(0,0,t===`+`?i:-i),n===`Z`&&this.world.rotation.set(t===`+`?-i:i,0,0),n===`Y`&&this.world.rotation.set(t===`+`?0:r,0,0)}_setIgnoreLimits(e,t=!1){this.robot&&Object.values(this.robot.joints).forEach(t=>{t.ignoreLimits=e,t.setJointValue(...t.jointValue)}),t&&this.dispatchEvent(new CustomEvent(`ignore-limits-change`,{bubbles:!0,cancelable:!0,composed:!0}))}};function gj(e){return e.isURDFJoint&&e.jointType!==`fixed`}function _j(e){let t=e;for(;t;){if(gj(t))return t;t=t.parent}return t}var vj=new Y,yj=new Y,bj=new Y,xj=new Y,Sj=new Y,Cj=new Y,wj=new Y,Tj=new cE,Ej=class{constructor(e){this.enabled=!0,this.scene=e,this.raycaster=new eO,this.initialGrabPoint=new Y,this.hitDistance=-1,this.hovered=null,this.manipulating=null}update(){let{raycaster:e,hovered:t,manipulating:n,scene:r}=this;if(n)return;let i=null,a=e.intersectObject(r,!0);if(a.length!==0){let e=a[0];this.hitDistance=e.distance,i=_j(e.object),this.initialGrabPoint.copy(e.point)}i!==t&&(t&&this.onUnhover(t),this.hovered=i,i&&this.onHover(i))}updateJoint(e,t){e.setJointValue(t)}onDragStart(e){}onDragEnd(e){}onHover(e){}onUnhover(e){}getRevoluteDelta(e,t,n){return xj.copy(e.axis).transformDirection(e.matrixWorld).normalize(),bj.set(0,0,0).applyMatrix4(e.matrixWorld),Tj.setFromNormalAndCoplanarPoint(xj,bj),Tj.projectPoint(t,Cj),Tj.projectPoint(n,wj),Cj.sub(bj),wj.sub(bj),xj.crossVectors(Cj,wj),Math.sign(xj.dot(Tj.normal))*wj.angleTo(Cj)}getPrismaticDelta(e,t,n){return xj.subVectors(n,t),Tj.normal.copy(e.axis).transformDirection(e.parent.matrixWorld).normalize(),xj.dot(Tj.normal)}moveRay(e){let{raycaster:t,hitDistance:n,manipulating:r}=this,{ray:i}=t;if(r){i.at(n,vj),e.at(n,yj);let t=0;r.jointType===`revolute`||r.jointType===`continuous`?t=this.getRevoluteDelta(r,vj,yj):r.jointType===`prismatic`&&(t=this.getPrismaticDelta(r,vj,yj)),t&&this.updateJoint(r,r.angle+t)}this.raycaster.ray.copy(e),this.update()}setGrabbed(e){let{hovered:t,manipulating:n}=this;if(e){if(n!==null||t===null)return;this.manipulating=t,this.onDragStart(t)}else{if(this.manipulating===null)return;this.onDragEnd(this.manipulating),this.manipulating=null,this.update()}}},Dj=class extends Ej{constructor(e,t,n){super(e),this.camera=t,this.domElement=n;let r=new eO,i=new BS;function a(e){let t=n.getBoundingClientRect();i.x=(e.clientX-t.left)/t.width*2-1,i.y=-((e.clientY-t.top)/t.height)*2+1}this._mouseDown=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!0)},this._mouseMove=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray)},this._mouseUp=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!1)},n.addEventListener(`mousedown`,this._mouseDown),n.addEventListener(`mousemove`,this._mouseMove),n.addEventListener(`mouseup`,this._mouseUp)}getRevoluteDelta(e,t,n){let{camera:r,initialGrabPoint:i}=this;return xj.copy(e.axis).transformDirection(e.matrixWorld).normalize(),bj.set(0,0,0).applyMatrix4(e.matrixWorld),Tj.setFromNormalAndCoplanarPoint(xj,bj),xj.copy(r.position).sub(i).normalize(),Math.abs(xj.dot(Tj.normal))>.3?super.getRevoluteDelta(e,t,n):(xj.set(0,1,0).transformDirection(r.matrixWorld),Tj.projectPoint(t,Cj),Tj.projectPoint(n,wj),xj.set(0,0,-1).transformDirection(r.matrixWorld),xj.cross(Tj.normal),Sj.subVectors(n,t),xj.dot(Sj))}dispose(){let{domElement:e}=this;e.removeEventListener(`mousedown`,this._mouseDown),e.removeEventListener(`mousemove`,this._mouseMove),e.removeEventListener(`mouseup`,this._mouseUp)}},Oj=class extends hj{static get observedAttributes(){return[`highlight-color`,...super.observedAttributes]}get disableDragging(){return this.hasAttribute(`disable-dragging`)}set disableDragging(e){e?this.setAttribute(`disable-dragging`,!!e):this.removeAttribute(`disable-dragging`)}get highlightColor(){return this.getAttribute(`highlight-color`)||`#FFFFFF`}set highlightColor(e){e?this.setAttribute(`highlight-color`,e):this.removeAttribute(`highlight-color`)}constructor(...e){super(...e),this.highlightMaterial=new BE({shininess:10,color:this.highlightColor,emissive:this.highlightColor,emissiveIntensity:.25});let t=e=>e.isURDFJoint&&e.jointType!==`fixed`,n=(e,n)=>{let r=i=>{if(i.type===`Mesh`&&(n?(i.material=i.__origMaterial,delete i.__origMaterial):(i.__origMaterial=i.material,i.material=this.highlightMaterial)),i===e||!t(i))for(let e=0;e{this.dispatchEvent(new CustomEvent(`manipulate-start`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!1,this.redraw()},i.onDragEnd=e=>{this.dispatchEvent(new CustomEvent(`manipulate-end`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!0,this.redraw()},i.updateJoint=(e,t)=>{this.setJointValue(e.name,t)},i.onHover=e=>{n(e,!1),this.dispatchEvent(new CustomEvent(`joint-mouseover`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},i.onUnhover=e=>{n(e,!0),this.dispatchEvent(new CustomEvent(`joint-mouseout`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},this.dragControls=i}disconnectedCallback(){super.disconnectedCallback(),this.dragControls.dispose()}attributeChangedCallback(e,t,n){switch(super.attributeChangedCallback(e,t,n),e){case`highlight-color`:this.highlightMaterial.color.set(this.highlightColor),this.highlightMaterial.emissive.set(this.highlightColor);break}}},kj=1e3,Aj=3e4,jj=({viewerRef:e,enabled:t=!0,websocketUrl:n})=>{let{wsBaseUrl:r}=wl(),i=n||`${r}/ws/joint-data`,a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(kj),c=(0,_.useRef)(!1),[l,u]=(0,_.useState)(!1),d=(0,_.useCallback)(t=>{let n=e.current;!n||typeof n.setJointValue!=`function`||Object.entries(t).forEach(([e,t])=>{try{n.setJointValue(e,t)}catch(t){console.warn(`Failed to set joint ${e}:`,t)}})},[e]);return(0,_.useEffect)(()=>{if(!t)return;c.current=!1;let e=()=>{if(c.current)return;let e;try{e=new WebSocket(i)}catch(e){console.error(`Failed to create WebSocket:`,e),n();return}a.current=e,e.onopen=()=>{u(!0),s.current=kj,o.current&&=(clearTimeout(o.current),null)},e.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`joint_update`&&t.joints&&d(t.joints)}catch(e){console.error(`Error parsing WebSocket message:`,e)}},e.onclose=e=>{u(!1),a.current=null,!c.current&&e.code!==1e3&&n()},e.onerror=()=>{u(!1)}},n=()=>{if(o.current)return;let t=s.current;s.current=Math.min(t*2,Aj),o.current=setTimeout(()=>{o.current=null,e()},t)};return e(),()=>{c.current=!0,o.current&&=(clearTimeout(o.current),null),a.current&&=(a.current.close(1e3),null),u(!1)}},[t,i,d]),{isConnected:l}},Mj=[`light`,`dark`],Nj=`(prefers-color-scheme: dark)`;_.createContext(void 0),_.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,attrs:s,nonce:c})=>{let l=a===`system`,u=n===`class`?`var d=document.documentElement,c=d.classList;${`c.remove(${s.map(e=>`'${e}'`).join(`,`)})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=i?Mj.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:`if(e==='light'||e==='dark')d.style.colorScheme=e`:``,f=(e,t=!1,r=!0)=>{let a=o?o[e]:e,s=t?e+`|| ''`:`'${a}'`,c=``;return i&&r&&!t&&Mj.includes(e)&&(c+=`d.style.colorScheme = '${e}';`),n===`class`?t||a?c+=`c.add(${s})`:c+=`null`:a&&(c+=`d[s](n,${s})`),c},p=e?`!function(){${u}${f(e)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${l})){var t='${Nj}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f(`dark`)}}else{${f(`light`)}}}else if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}${l?``:`else{`+f(a,!1,!1)+`}`}${d}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}else{${f(a,!1,!1)};}${d}}catch(t){}}();`;return _.createElement(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:p}})});function Pj(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e=2.0 are supported.`));return}let c=new jM(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}};function Ij(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var Lj={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},Rj=class{constructor(e){this.parser=e,this.name=Lj.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},Qj=class{constructor(e){this.parser=e,this.name=Lj.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},$j=class{constructor(e){this.parser=e,this.name=Lj.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},eM=class{constructor(e){this.name=Lj.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}else return null}},tM=class{constructor(e){this.name=Lj.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==fM.TRIANGLES&&e.mode!==fM.TRIANGLE_STRIP&&e.mode!==fM.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new KC,n=new Y,a=new VS,s=new Y(1,1,1),c=new aE(e.geometry,e.material,r);for(let e=0;e0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}var AM=new KC,jM=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Ij,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>`u`||n&&r<17||i&&a<98?this.textureLoader=new yD(this.options.manager):this.textureLoader=new zD(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new gD(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return SM(i,a,r),CM(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+ e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=mM[n.magFilter]||1006,t.minFilter=mM[n.minFilter]||1008,t.wrapS=hM[n.wrapS]||1e3,t.wrapT=hM[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1;if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new pC(e);t.needsUpdate=!0,n(t)}),t.load(LD.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){return c===!0&&o.revokeObjectURL(s),CM(e,a),e.userData.mimeType=a.mimeType||kM(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[Lj.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[Lj.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[Lj.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new EE,Bw.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new fE,Bw.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return RE}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[Lj.KHR_MATERIALS_UNLIT]){let e=r[Lj.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new X(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],oS),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,aS)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||bM.OPAQUE;if(l===bM.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===bM.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==Vw&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new BS(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==Vw&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==Vw){let e=i.emissiveFactor;o.emissive=new X().setRGB(e[0],e[1],e[2],oS)}return i.emissiveTexture!==void 0&&a!==Vw&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,aS)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),CM(n,i),t.associations.set(n,{materials:e}),i.extensions&&SM(r,n,i),n})}createUniqueName(e){let t=QD.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[Lj.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return NM(n,e,t)})}let a=[];for(let n=0,o=e.length;n0&&TM(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),CM(d,i),u.extensions&&SM(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n1?new kT:t.length===1?t[0]:new yw,o!==t[0])for(let e=0,n=t.length;e1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new kT;n.name&&(i.name=r.createUniqueName(n.name)),CM(i,n),n.extensions&&SM(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e{let t=new Map;for(let[e,n]of r.associations)(e instanceof Bw||e instanceof pC)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];vM[i.path]===vM.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(o);let c;switch(vM[i.path]){case vM.weights:c=nD;break;case vM.rotation:c=iD;break;case vM.translation:case vM.scale:c=oD;break;default:switch(n.itemSize){case 1:c=nD;break;default:c=oD;break}break}let l=r.interpolation===void 0?Zx:yM[r.interpolation],u=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e0?t[t.length-1]:``,smooth:n===void 0?this.smooth:n.smooth,groupStart:n===void 0?0:n.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),t}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;zM.fromArray(r,e),BM.fromArray(r,t),VM.fromArray(r,n),UM.subVectors(VM,BM),HM.subVectors(zM,BM),UM.cross(HM),UM.normalize(),i.push(UM.x,UM.y,UM.z),i.push(UM.x,UM.y,UM.z),i.push(UM.x,UM.y,UM.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;r[e]!==void 0&&i.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&i.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,o,s,c){let l=this.vertices.length,u=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),f=this.parseVertexIndex(n,l);if(this.addVertex(u,d,f),this.addColor(u,d,f),o!==void 0&&o!==``){let e=this.normals.length;u=this.parseNormalIndex(o,e),d=this.parseNormalIndex(s,e),f=this.parseNormalIndex(c,e),this.addNormal(u,d,f)}else this.addFaceNormal(u,d,f);if(r!==void 0&&r!==``){let e=this.uvs.length;u=this.parseUVIndex(r,e),d=this.parseUVIndex(i,e),f=this.parseUVIndex(a,e),this.addUV(u,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type=`Points`;let t=this.vertices.length;for(let n=0,r=e.length;nthis.updateSize())}disconnectedCallback(){cancelAnimationFrame(this._renderLoopId)}attributeChangedCallback(e,t,n){switch(this._updateCollisionVisibility(),this.noAutoRecenter||this.recenter(),e){case`package`:case`urdf`:this._scheduleLoad();break;case`up`:this._setUp(this.up);break;case`ambient-color`:this.ambientLight.color.set(this.ambientColor),this.ambientLight.groundColor.set(`#000`).lerp(this.ambientLight.color,.5);break;case`ignore-limits`:this._setIgnoreLimits(this.ignoreLimits,!0);break}}updateSize(){let e=this.renderer,t=this.clientWidth,n=this.clientHeight,r=e.getSize(uj);(r.width!==t||r.height!==n)&&this.recenter(),e.setPixelRatio(window.devicePixelRatio),e.setSize(t,n,!1),this.camera.aspect=t/n,this.camera.updateProjectionMatrix()}redraw(){this._dirty=!0}recenter(){this._updateEnvironment(),this.redraw()}setJointValue(e,...t){this.robot&&this.robot.joints[e]&&this.robot.joints[e].setJointValue(...t)&&(this.redraw(),this.dispatchEvent(new CustomEvent(`angle-change`,{bubbles:!0,cancelable:!0,detail:e})))}setJointValues(e){for(let t in e)Array.isArray(e[t])?this.setJointValue(t,...e[t]):this.setJointValue(t,e[t])}_updateEnvironment(){let e=this.robot;if(!e)return;this.world.updateMatrixWorld();let t=new OC;t.makeEmpty(),e.traverse(e=>{e.isURDFVisual&&t.expandByObject(e)});let n=t.getCenter(new Y);this.controls.target.y=n.y,this.plane.position.y=t.min.y-.001;let r=this.directionalLight;if(r.castShadow=this.displayShadow,this.displayShadow){let e=t.getBoundingSphere(new KC).radius,i=r.shadow.camera;i.left=i.bottom=-e,i.right=i.top=e;let a=r.position.clone().sub(r.target.position);r.target.position.copy(n),r.position.copy(n).add(a),i.updateProjectionMatrix()}}_scheduleLoad(){this._prevload!==`${this.package}|${this.urdf}`&&(this._prevload=`${this.package}|${this.urdf}`,!this._loadScheduled&&(this._loadScheduled=!0,this.robot&&=(this.robot.traverse(e=>e.dispose&&e.dispose()),this.robot.parent.remove(this.robot),null),requestAnimationFrame(()=>{this._loadUrdf(this.package,this.urdf),this._loadScheduled=!1})))}_loadUrdf(e,t){if(this.dispatchEvent(new CustomEvent(`urdf-change`,{bubbles:!0,cancelable:!0,composed:!0})),t){this._requestId++;let n=this._requestId,r=e=>{e.traverse(e=>{if(e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0,e.material)){let t=(Array.isArray(e.material)?e.material:[e.material]).map(e=>(e instanceof Uw&&(e=new VE),e.map&&(e.map.colorSpace=mS),e));e.material=t.length===1?t[0]:t}})};e.includes(`:`)&&e.split(`:`)[1].substring(0,2)!==`//`&&(e=e.split(`,`).reduce((e,t)=>{let n=t.split(/:/).filter(e=>!!e),r=n.shift().trim();return e[r]=n.join(`:`).trim(),e},{}));let i=null,a=new uD;a.onLoad=()=>{if(this._requestId!==n){i.traverse(e=>e.dispose&&e.dispose());return}this.robot=i,this.world.add(i),r(i),this._setIgnoreLimits(this.ignoreLimits),this._updateCollisionVisibility(),this.dispatchEvent(new CustomEvent(`urdf-processed`,{bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`geometry-loaded`,{bubbles:!0,cancelable:!0,composed:!0})),this.recenter()},this.urlModifierFunc&&a.setURLModifier(this.urlModifierFunc);let o=new lj(a);o.packages=e,o.loadMeshCb=this.loadMeshFunc,o.fetchOptions={mode:`cors`,credentials:`same-origin`},o.parseCollision=!0,o.load(t,e=>i=e)}}_updateCollisionVisibility(){let e=this.showCollision,t=this._collisionMaterial,n=this.robot;if(n===null)return;let r=[];n.traverse(t=>{t.isURDFCollider&&(t.visible=e,r.push(t))}),r.forEach(e=>{e.traverse(e=>{e.isMesh&&(e.raycast=dj,e.material=t,e.castShadow=!1)})})}_setUp(e){e||=`+Z`,e=e.toUpperCase();let t=e.replace(/[^-+]/g,``)[0]||`+`,n=e.replace(/[^XYZ]/gi,``)[0]||`Z`,r=Math.PI,i=r/2;n===`X`&&this.world.rotation.set(0,0,t===`+`?i:-i),n===`Z`&&this.world.rotation.set(t===`+`?-i:i,0,0),n===`Y`&&this.world.rotation.set(t===`+`?0:r,0,0)}_setIgnoreLimits(e,t=!1){this.robot&&Object.values(this.robot.joints).forEach(t=>{t.ignoreLimits=e,t.setJointValue(...t.jointValue)}),t&&this.dispatchEvent(new CustomEvent(`ignore-limits-change`,{bubbles:!0,cancelable:!0,composed:!0}))}};function pj(e){return e.isURDFJoint&&e.jointType!==`fixed`}function mj(e){let t=e;for(;t;){if(pj(t))return t;t=t.parent}return t}var hj=new Y,gj=new Y,_j=new Y,vj=new Y,yj=new Y,bj=new Y,xj=new Y,Sj=new lE,Cj=class{constructor(e){this.enabled=!0,this.scene=e,this.raycaster=new $D,this.initialGrabPoint=new Y,this.hitDistance=-1,this.hovered=null,this.manipulating=null}update(){let{raycaster:e,hovered:t,manipulating:n,scene:r}=this;if(n)return;let i=null,a=e.intersectObject(r,!0);if(a.length!==0){let e=a[0];this.hitDistance=e.distance,i=mj(e.object),this.initialGrabPoint.copy(e.point)}i!==t&&(t&&this.onUnhover(t),this.hovered=i,i&&this.onHover(i))}updateJoint(e,t){e.setJointValue(t)}onDragStart(e){}onDragEnd(e){}onHover(e){}onUnhover(e){}getRevoluteDelta(e,t,n){return vj.copy(e.axis).transformDirection(e.matrixWorld).normalize(),_j.set(0,0,0).applyMatrix4(e.matrixWorld),Sj.setFromNormalAndCoplanarPoint(vj,_j),Sj.projectPoint(t,bj),Sj.projectPoint(n,xj),bj.sub(_j),xj.sub(_j),vj.crossVectors(bj,xj),Math.sign(vj.dot(Sj.normal))*xj.angleTo(bj)}getPrismaticDelta(e,t,n){return vj.subVectors(n,t),Sj.normal.copy(e.axis).transformDirection(e.parent.matrixWorld).normalize(),vj.dot(Sj.normal)}moveRay(e){let{raycaster:t,hitDistance:n,manipulating:r}=this,{ray:i}=t;if(r){i.at(n,hj),e.at(n,gj);let t=0;r.jointType===`revolute`||r.jointType===`continuous`?t=this.getRevoluteDelta(r,hj,gj):r.jointType===`prismatic`&&(t=this.getPrismaticDelta(r,hj,gj)),t&&this.updateJoint(r,r.angle+t)}this.raycaster.ray.copy(e),this.update()}setGrabbed(e){let{hovered:t,manipulating:n}=this;if(e){if(n!==null||t===null)return;this.manipulating=t,this.onDragStart(t)}else{if(this.manipulating===null)return;this.onDragEnd(this.manipulating),this.manipulating=null,this.update()}}},wj=class extends Cj{constructor(e,t,n){super(e),this.camera=t,this.domElement=n;let r=new $D,i=new YS;function a(e){let t=n.getBoundingClientRect();i.x=(e.clientX-t.left)/t.width*2-1,i.y=-((e.clientY-t.top)/t.height)*2+1}this._mouseDown=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!0)},this._mouseMove=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray)},this._mouseUp=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!1)},n.addEventListener(`mousedown`,this._mouseDown),n.addEventListener(`mousemove`,this._mouseMove),n.addEventListener(`mouseup`,this._mouseUp)}getRevoluteDelta(e,t,n){let{camera:r,initialGrabPoint:i}=this;return vj.copy(e.axis).transformDirection(e.matrixWorld).normalize(),_j.set(0,0,0).applyMatrix4(e.matrixWorld),Sj.setFromNormalAndCoplanarPoint(vj,_j),vj.copy(r.position).sub(i).normalize(),Math.abs(vj.dot(Sj.normal))>.3?super.getRevoluteDelta(e,t,n):(vj.set(0,1,0).transformDirection(r.matrixWorld),Sj.projectPoint(t,bj),Sj.projectPoint(n,xj),vj.set(0,0,-1).transformDirection(r.matrixWorld),vj.cross(Sj.normal),yj.subVectors(n,t),vj.dot(yj))}dispose(){let{domElement:e}=this;e.removeEventListener(`mousedown`,this._mouseDown),e.removeEventListener(`mousemove`,this._mouseMove),e.removeEventListener(`mouseup`,this._mouseUp)}},Tj=class extends fj{static get observedAttributes(){return[`highlight-color`,...super.observedAttributes]}get disableDragging(){return this.hasAttribute(`disable-dragging`)}set disableDragging(e){e?this.setAttribute(`disable-dragging`,!!e):this.removeAttribute(`disable-dragging`)}get highlightColor(){return this.getAttribute(`highlight-color`)||`#FFFFFF`}set highlightColor(e){e?this.setAttribute(`highlight-color`,e):this.removeAttribute(`highlight-color`)}constructor(...e){super(...e),this.highlightMaterial=new VE({shininess:10,color:this.highlightColor,emissive:this.highlightColor,emissiveIntensity:.25});let t=e=>e.isURDFJoint&&e.jointType!==`fixed`,n=(e,n)=>{let r=i=>{if(i.type===`Mesh`&&(n?(i.material=i.__origMaterial,delete i.__origMaterial):(i.__origMaterial=i.material,i.material=this.highlightMaterial)),i===e||!t(i))for(let e=0;e{this.dispatchEvent(new CustomEvent(`manipulate-start`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!1,this.redraw()},i.onDragEnd=e=>{this.dispatchEvent(new CustomEvent(`manipulate-end`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!0,this.redraw()},i.updateJoint=(e,t)=>{this.setJointValue(e.name,t)},i.onHover=e=>{n(e,!1),this.dispatchEvent(new CustomEvent(`joint-mouseover`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},i.onUnhover=e=>{n(e,!0),this.dispatchEvent(new CustomEvent(`joint-mouseout`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},this.dragControls=i}disconnectedCallback(){super.disconnectedCallback(),this.dragControls.dispose()}attributeChangedCallback(e,t,n){switch(super.attributeChangedCallback(e,t,n),e){case`highlight-color`:this.highlightMaterial.color.set(this.highlightColor),this.highlightMaterial.emissive.set(this.highlightColor);break}}},Ej=1e3,Dj=3e4,Oj=({viewerRef:e,enabled:t=!0,websocketUrl:n})=>{let{wsBaseUrl:r}=wl(),i=n||`${r}/ws/joint-data`,a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(Ej),c=(0,_.useRef)(!1),[l,u]=(0,_.useState)(!1),d=(0,_.useCallback)(t=>{let n=e.current;!n||typeof n.setJointValue!=`function`||Object.entries(t).forEach(([e,t])=>{try{n.setJointValue(e,t)}catch(t){console.warn(`Failed to set joint ${e}:`,t)}})},[e]);return(0,_.useEffect)(()=>{if(!t)return;c.current=!1;let e=()=>{if(c.current)return;let e;try{e=new WebSocket(i)}catch(e){console.error(`Failed to create WebSocket:`,e),n();return}a.current=e,e.onopen=()=>{u(!0),s.current=Ej,o.current&&=(clearTimeout(o.current),null)},e.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`joint_update`&&t.joints&&d(t.joints)}catch(e){console.error(`Error parsing WebSocket message:`,e)}},e.onclose=e=>{u(!1),a.current=null,!c.current&&e.code!==1e3&&n()},e.onerror=()=>{u(!1)}},n=()=>{if(o.current)return;let t=s.current;s.current=Math.min(t*2,Dj),o.current=setTimeout(()=>{o.current=null,e()},t)};return e(),()=>{c.current=!0,o.current&&=(clearTimeout(o.current),null),a.current&&=(a.current.close(1e3),null),u(!1)}},[t,i,d]),{isConnected:l}},kj=[`light`,`dark`],Aj=`(prefers-color-scheme: dark)`;_.createContext(void 0),_.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,attrs:s,nonce:c})=>{let l=a===`system`,u=n===`class`?`var d=document.documentElement,c=d.classList;${`c.remove(${s.map(e=>`'${e}'`).join(`,`)})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=i?kj.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:`if(e==='light'||e==='dark')d.style.colorScheme=e`:``,f=(e,t=!1,r=!0)=>{let a=o?o[e]:e,s=t?e+`|| ''`:`'${a}'`,c=``;return i&&r&&!t&&kj.includes(e)&&(c+=`d.style.colorScheme = '${e}';`),n===`class`?t||a?c+=`c.add(${s})`:c+=`null`:a&&(c+=`d[s](n,${s})`),c},p=e?`!function(){${u}${f(e)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${l})){var t='${Aj}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f(`dark`)}}else{${f(`light`)}}}else if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}${l?``:`else{`+f(a,!1,!1)+`}`}${d}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}else{${f(a,!1,!1)};}${d}}catch(t){}}();`;return _.createElement(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:p}})});function jj(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e=2.0 are supported.`));return}let c=new OM(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}};function Nj(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var Pj={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},Fj=class{constructor(e){this.parser=e,this.name=Pj.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},Yj=class{constructor(e){this.parser=e,this.name=Pj.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},Xj=class{constructor(e){this.parser=e,this.name=Pj.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},Zj=class{constructor(e){this.name=Pj.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}else return null}},Qj=class{constructor(e){this.name=Pj.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==lM.TRIANGLES&&e.mode!==lM.TRIANGLE_STRIP&&e.mode!==lM.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new tw,n=new Y,a=new XS,s=new Y(1,1,1),c=new aE(e.geometry,e.material,r);for(let e=0;e0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}var DM=new tw,OM=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Nj,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>`u`||n&&r<17||i&&a<98?this.textureLoader=new vD(this.options.manager):this.textureLoader=new RD(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new hD(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return yM(i,a,r),bM(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+ e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=dM[n.magFilter]||1006,t.minFilter=dM[n.minFilter]||1008,t.wrapS=fM[n.wrapS]||1e3,t.wrapT=fM[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1;if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new SC(e);t.needsUpdate=!0,n(t)}),t.load(ID.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){return c===!0&&o.revokeObjectURL(s),bM(e,a),e.userData.mimeType=a.mimeType||EM(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[Pj.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[Pj.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[Pj.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new DE,Hw.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new pE,Hw.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return zE}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[Pj.KHR_MATERIALS_UNLIT]){let e=r[Pj.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new X(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],hS),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,mS)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||_M.OPAQUE;if(l===_M.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===_M.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==Uw&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new YS(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==Uw&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==Uw){let e=i.emissiveFactor;o.emissive=new X().setRGB(e[0],e[1],e[2],hS)}return i.emissiveTexture!==void 0&&a!==Uw&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,mS)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),bM(n,i),t.associations.set(n,{materials:e}),i.extensions&&yM(r,n,i),n})}createUniqueName(e){let t=ZD.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[Pj.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return AM(n,e,t)})}let a=[];for(let n=0,o=e.length;n0&&SM(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),bM(d,i),u.extensions&&yM(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n1?new AT:t.length===1?t[0]:new Sw,o!==t[0])for(let e=0,n=t.length;e1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new AT;n.name&&(i.name=r.createUniqueName(n.name)),bM(i,n),n.extensions&&yM(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e{let t=new Map;for(let[e,n]of r.associations)(e instanceof Hw||e instanceof SC)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];hM[i.path]===hM.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(o);let c;switch(hM[i.path]){case hM.weights:c=rD;break;case hM.rotation:c=aD;break;case hM.translation:case hM.scale:c=sD;break;default:switch(n.itemSize){case 1:c=rD;break;default:c=sD;break}break}let l=r.interpolation===void 0?oS:gM[r.interpolation],u=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e0?t[t.length-1]:``,smooth:n===void 0?this.smooth:n.smooth,groupStart:n===void 0?0:n.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),t}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;IM.fromArray(r,e),LM.fromArray(r,t),RM.fromArray(r,n),BM.subVectors(RM,LM),zM.subVectors(IM,LM),BM.cross(zM),BM.normalize(),i.push(BM.x,BM.y,BM.z),i.push(BM.x,BM.y,BM.z),i.push(BM.x,BM.y,BM.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;r[e]!==void 0&&i.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&i.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,o,s,c){let l=this.vertices.length,u=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),f=this.parseVertexIndex(n,l);if(this.addVertex(u,d,f),this.addColor(u,d,f),o!==void 0&&o!==``){let e=this.normals.length;u=this.parseNormalIndex(o,e),d=this.parseNormalIndex(s,e),f=this.parseNormalIndex(c,e),this.addNormal(u,d,f)}else this.addFaceNormal(u,d,f);if(r!==void 0&&r!==``){let e=this.uvs.length;u=this.parseUVIndex(r,e),d=this.parseUVIndex(i,e),f=this.parseUVIndex(a,e),this.addUV(u,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type=`Points`;let t=this.vertices.length;for(let n=0,r=e.length;n=7?(WM.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),aS),t.colors.push(WM.r,WM.g,WM.b)):t.colors.push(void 0,void 0,void 0);break;case`vn`:t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:t.uvs.push(parseFloat(e[1]),parseFloat(e[2]));break}}else if(a===`f`){let e=i.slice(1).trim().split(RM),n=[];for(let t=0,r=e.length;t0){let e=r.split(`/`);n.push(e)}}let r=n[0];for(let e=1,i=n.length-1;e1){let e=r[1].trim().toLowerCase();t.object.smooth=e!==`0`&&e!==`off`}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}t.finalize();let i=new kT;if(i.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0))for(let e=0,n=t.objects.length;e0&&l.setAttribute(`normal`,new qw(r.normals,3)),r.colors.length>0&&(c=!0,l.setAttribute(`color`,new qw(r.colors,3))),r.hasUVIndices===!0&&l.setAttribute(`uv`,new qw(r.uvs,2));let u=[];for(let e=0,n=a.length;e1){for(let e=0,t=a.length;e0){let e=new EE({size:1,sizeAttenuation:!1}),n=new eT;n.setAttribute(`position`,new qw(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(n.setAttribute(`color`,new qw(t.colors,3)),e.vertexColors=!0);let r=new jE(n,e);i.add(r)}return i}},qM=(e,t,n)=>{let r=e.split(/\./g).pop()?.toLowerCase();if(e.startsWith(`blob:`)&&e.includes(`#.`)){let t=e.split(`#.`).pop();t&&(r=t.toLowerCase())}if(!r){console.error(`Could not determine file extension for: ${e}`),n(null,Error(`Unsupported file format: ${e}`));return}switch(r){case`gltf`:case`glb`:new Fj(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`obj`:new KM(t).load(e,e=>n(e),()=>{},e=>n(null,e));break;case`dae`:new qA(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`stl`:console.log(`🔧 Loading STL file: ${e}`),new GA(t).load(e,t=>{console.log(`✅ STL loaded successfully: ${e}`),n(new fT(t,new BE))},t=>{console.log(`📊 STL loading progress: ${e}`,t)},t=>{console.error(`❌ STL loading failed: ${e}`,t),console.log(`🔄 Creating fallback geometry for: ${e}`),n(new fT(new mT(.05,.05,.05),new BE({color:16739125,transparent:!0,opacity:.7})))});break;default:n(null,Error(`Unsupported file format: ${r}`))}};function JM(e,t){e.innerHTML=``;let n=document.createElement(`urdf-viewer`);n.classList.add(`w-full`,`h-full`),e.appendChild(n),n.setAttribute(`up`,`Z`),QM(n,t?`#2c2b3a`:`#eff4ff`),n.setAttribute(`highlight-color`,t?`#df6dd4`:`#b05ffe`),n.setAttribute(`auto-redraw`,`true`);let r=new ID(14079702,1);n.scene.add(r);let i=new FD(16777215,.8);return i.position.set(5,30,5),i.castShadow=!0,n.scene.add(i),n}function YM(e,t){`loadMeshFunc`in e&&(e.loadMeshFunc=(e,n,r)=>{let i=t?t(e):e;try{qM(i,n,(e,t)=>{t?(console.warn(`Error loading mesh ${i}:`,t),r(null)):r(e)})}catch(e){console.error(`Exception loading mesh ${i}:`,e),r(null,e)}})}function XM(e,t){let n=e=>{t(e.detail)},r=()=>{t(null)};return e.addEventListener(`joint-mouseover`,n),e.addEventListener(`joint-mouseout`,r),()=>{e.removeEventListener(`joint-mouseover`,n),e.removeEventListener(`joint-mouseout`,r)}}function ZM(e,t,n,r,i=[]){let a=t.startsWith(`blob:`)&&!t.includes(`#.`)?t+`#.urdf`:t;e.setAttribute(`urdf`,a),e.setAttribute(`package`,n);let o=()=>{if(i.length>0){let e=i[0];e&&(r(e),gi.info(`Trying alternative model...`,{description:`First model failed to load. Trying ${e.split(`/`).pop()||`alternative model`}`,duration:2e3}))}};return e.addEventListener(`error`,o),()=>{e.removeEventListener(`error`,o)}}function QM(e,t){let n=e.parentElement;n&&(n.style.backgroundColor=t)}typeof window<`u`&&!customElements.get(`urdf-viewer`)&&customElements.define(`urdf-viewer`,Oj);var $M=(0,_.memo)(()=>{let e=(0,_.useRef)(null),[t,n]=(0,_.useState)(null),{registerUrdfProcessor:r,alternativeUrdfModels:i,isDefaultModel:a}=Bi(),o=(0,_.useRef)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(!1),{isConnected:l}=jj({viewerRef:s,enabled:a}),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=(0,_.useRef)(``),h=(0,_.useMemo)(()=>({loadUrdf:e=>{d(e)},setUrlModifierFunc:e=>{p(()=>e)},getPackage:()=>m.current}),[]);(0,_.useEffect)(()=>{r(h)},[r,h]);let g=(0,_.useCallback)(e=>{if(console.log(`🔗 defaultUrlModifier called with: ${e}`),e.startsWith(`package://so_arm_description/meshes/`)){let t=e.replace(`package://so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (package): ${t}`),t}if(e.includes(`so_arm_description/meshes/`)){let t=e.replace(/.*so_arm_description\/meshes\//,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (partial): ${t}`),t}if(e.includes(`/so-101-urdf/so_arm_description/meshes/`)){let t=e.replace(`/so-101-urdf/so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (problematic path): ${t}`),t}if(e.endsWith(`.stl`)&&!e.startsWith(`/`)&&!e.startsWith(`http`)){let t=`/so-101-urdf/meshes/${e}`;return console.log(`🔗 Modified URL (relative): ${t}`),t}return console.log(`🔗 Unmodified URL: ${e}`),e},[]);return(0,_.useEffect)(()=>{if(!e.current)return;let t=JM(e.current,!0);s.current=t,YM(t,a?g:f);let r=a?`/so-101-urdf/urdf/so101_new_calib.urdf`:u||``;a&&(m.current=`/`);let l=()=>{};r&&(l=ZM(t,r,m.current,d,i));let p=XM(t,n),h=e=>{if(!e||!e.robot){console.log(`[RobotViewer] Cannot fit to view: No viewer or robot available`);return}try{let t=new yC().setFromObject(e.robot),n=new Y;t.getCenter(n);let r=new Y;t.getSize(r);let i=Math.max(r.x,r.y,r.z);e.camera.position.copy(n);let a=new Y;e.up===`+Z`||e.up===`Z`||e.up===`+Y`||e.up,a.set(1,1,1),a.normalize().multiplyScalar(i*1.3),e.camera.position.add(a),e.controls.target.copy(n),e.controls.update(),e.redraw(),console.log(`[RobotViewer] Robot auto-fitted to view`)}catch(e){console.error(`[RobotViewer] Error fitting robot to view:`,e)}},_=()=>{h(t)},v=()=>{c.current=!0,`setJointValue`in t&&(o.current&&=(o.current(),null)),_()};return t.addEventListener(`urdf-processed`,v),()=>{o.current&&=(o.current(),null),c.current=!1,p(),l(),t.removeEventListener(`urdf-processed`,v)}},[a,u,f,g,i]),(0,B.jsxs)(`div`,{className:K(`w-full h-full transition-all duration-300 ease-in-out relative`,`bg-gradient-to-br from-gray-900 to-gray-800`),children:[(0,B.jsx)(`div`,{ref:e,className:`w-full h-full`}),t&&(0,B.jsxs)(`div`,{className:`absolute bottom-4 right-4 bg-black/70 text-white px-3 py-2 rounded-md text-sm font-mono z-10`,children:[`Joint: `,t]}),a&&(0,B.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-mono ${l?`bg-green-900/70 text-green-300`:`bg-red-900/70 text-red-300`}`,children:[(0,B.jsx)(`div`,{className:`w-2 h-2 rounded-full ${l?`bg-green-400`:`bg-red-400`}`}),l?`Live Robot Data`:`Disconnected`]})})]})}),eN=({className:e,iconOnly:t=!1})=>(0,B.jsxs)(`div`,{className:K(`flex items-center gap-2`,e),children:[(0,B.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab Logo`,className:`h-8 w-8`}),!t&&(0,B.jsx)(`span`,{className:`font-bold text-white text-2xl`,children:`LeLab`})]}),tN=({onGoBack:e,className:t,rightSlot:n})=>(0,B.jsxs)(`div`,{className:K(`w-full p-2 sm:p-4 space-y-4 lg:space-y-0 lg:space-x-4 flex flex-col lg:flex-row`,t),children:[(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-4 flex-1 flex flex-col`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4 mb-4`,children:[(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:e,className:`text-gray-400 hover:text-white hover:bg-gray-800 flex-shrink-0`,children:(0,B.jsx)(os,{className:`h-5 w-5`})}),(0,B.jsx)(eN,{iconOnly:!0}),(0,B.jsx)(`div`,{className:`w-px h-6 bg-gray-700`}),(0,B.jsx)(`h2`,{className:`text-xl font-medium text-gray-200`,children:`Teleoperation`})]}),(0,B.jsx)(`div`,{className:`flex-1 bg-black rounded border border-gray-800 min-h-[50vh] lg:min-h-0`,children:(0,B.jsx)($M,{})})]}),n&&(0,B.jsx)(`div`,{className:`lg:w-96 flex flex-col`,children:n})]}),nN=`Switch`,[rN,xne]=aa(nN),[iN,aN]=rN(nN),oN=_.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=_.useState(null),m=ra(t,e=>p(e)),h=_.useRef(!1),g=f?u||!!f.closest(`form`):!0,[v,y]=qa({prop:i,defaultProp:a??!1,onChange:l,caller:nN});return(0,B.jsxs)(iN,{scope:n,checked:v,disabled:s,children:[(0,B.jsx)(H.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":dN(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:V(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,B.jsx)(uN,{control:f,bubbles:!h.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});oN.displayName=nN;var sN=`SwitchThumb`,cN=_.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=aN(sN,n);return(0,B.jsx)(H.span,{"data-state":dN(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});cN.displayName=sN;var lN=`SwitchBubbleInput`,uN=_.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=_.useRef(null),s=ra(o,a),c=tv(n),l=Jm(t);return _.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,B.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});uN.displayName=lN;function dN(e){return e?`checked`:`unchecked`}var fN=oN,pN=cN,mN=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(fN,{className:K(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,B.jsx)(pN,{className:K(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)})}));mN.displayName=fN.displayName;var hN=({deviceId:e,label:t})=>{let{videoRef:n,hasError:r}=rb(e,!1);return(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`aspect-[4/3] bg-gray-800 relative`,children:e&&!r?(0,B.jsx)(`video`,{ref:n,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-full object-cover`}):(0,B.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center`,children:[(0,B.jsx)($s,{className:`w-8 h-8 text-gray-500 mb-2`}),(0,B.jsx)(`span`,{className:`text-gray-500 text-sm`,children:e?`Preview failed`:`No camera selected`})]})}),t&&(0,B.jsx)(`div`,{className:`p-2 text-sm text-gray-300 truncate border-t border-gray-800`,children:t})]})},gN=()=>{let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(0),{selectedRecord:i,isLoading:a}=Bb(),o=(i?.cameras??[]).map(e=>({key:e.id,name:e.name,deviceId:e.device_id}));return(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-4 flex flex-col gap-4 h-full`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-medium text-gray-200`,children:`Cameras`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e&&o.length>0&&(0,B.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>r(e=>e+1),className:`h-9 w-9 text-gray-400 hover:text-white flex-shrink-0`,title:`Retry camera feeds (e.g. after reconnecting a camera)`,"aria-label":`Retry camera feeds`,children:(0,B.jsx)(zs,{className:`w-4 h-4`})}),(0,B.jsx)(J,{htmlFor:`teleop-camera-toggle`,className:`text-sm text-gray-400`,children:e?`On`:`Off`}),(0,B.jsx)(mN,{id:`teleop-camera-toggle`,checked:e,onCheckedChange:t})]})]}),e?o.length>0?(0,B.jsx)(`div`,{className:`flex flex-col gap-3 overflow-y-auto`,children:o.map(e=>(0,B.jsx)(hN,{deviceId:e.deviceId,label:e.name},`${e.key}:${n}`))}):(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:a?`Loading robot...`:`No cameras configured for this robot. Add them during calibration to see live feeds here.`}):(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Turn on to watch your cameras while you teleoperate.`})]})},_N=()=>{let e=ht(),{toast:t}=ea(),{baseUrl:n,fetchWithHeaders:r}=wl(),i=(0,_.useRef)(!1),a=(0,_.useCallback)(async()=>{if(!i.current){i.current=!0;try{(await(await r(`${n}/stop-teleoperation`,{method:`POST`})).json())?.success&&t({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly.`})}catch{}}},[n,r,t]);return(0,_.useEffect)(()=>{let e=()=>{try{sessionStorage.setItem(`lelab:teleop-stopped`,`1`)}catch{}fetch(`${n}/stop-teleoperation`,{method:`POST`,keepalive:!0}).catch(()=>{})};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),a()}},[n,a]),(0,B.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center p-2 sm:p-4`,children:(0,B.jsx)(`div`,{className:`w-full h-[95vh] flex`,children:(0,B.jsx)(tN,{onGoBack:async()=>{await a(),e(`/`)},className:`lg:w-full`,rightSlot:(0,B.jsx)(gN,{})})})})},vN=es(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function yN({className:e,variant:t,...n}){return(0,B.jsx)(`div`,{className:K(vN({variant:t}),e),...n})}var bN=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ul(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),xN=`Separator`,SN=`horizontal`,CN=[`horizontal`,`vertical`],wN=_.forwardRef((e,t)=>{let{decorative:n,orientation:r=SN,...i}=e,a=TN(r)?r:SN,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,B.jsx)(bN.div,{"data-orientation":a,...o,...i,ref:t})});wN.displayName=xN;function TN(e){return CN.includes(e)}var EN=wN,DN=_.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,B.jsx)(EN,{ref:i,decorative:n,orientation:t,className:K(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));DN.displayName=EN.displayName;var ON=({onClick:e,robotType:t,className:n=``})=>(0,B.jsxs)(q,{type:`button`,onClick:e,variant:`outline`,size:`sm`,className:` +`),r=[];for(let e=0,i=n.length;e=7?(VM.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),mS),t.colors.push(VM.r,VM.g,VM.b)):t.colors.push(void 0,void 0,void 0);break;case`vn`:t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:t.uvs.push(parseFloat(e[1]),parseFloat(e[2]));break}}else if(a===`f`){let e=i.slice(1).trim().split(FM),n=[];for(let t=0,r=e.length;t0){let e=r.split(`/`);n.push(e)}}let r=n[0];for(let e=1,i=n.length-1;e1){let e=r[1].trim().toLowerCase();t.object.smooth=e!==`0`&&e!==`off`}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}t.finalize();let i=new AT;if(i.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0))for(let e=0,n=t.objects.length;e0&&l.setAttribute(`normal`,new Yw(r.normals,3)),r.colors.length>0&&(c=!0,l.setAttribute(`color`,new Yw(r.colors,3))),r.hasUVIndices===!0&&l.setAttribute(`uv`,new Yw(r.uvs,2));let u=[];for(let e=0,n=a.length;e1){for(let e=0,t=a.length;e0){let e=new DE({size:1,sizeAttenuation:!1}),n=new nT;n.setAttribute(`position`,new Yw(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(n.setAttribute(`color`,new Yw(t.colors,3)),e.vertexColors=!0);let r=new ME(n,e);i.add(r)}return i}},WM=(e,t,n)=>{let r=e.split(/\./g).pop()?.toLowerCase();if(e.startsWith(`blob:`)&&e.includes(`#.`)){let t=e.split(`#.`).pop();t&&(r=t.toLowerCase())}if(!r){console.error(`Could not determine file extension for: ${e}`),n(null,Error(`Unsupported file format: ${e}`));return}switch(r){case`gltf`:case`glb`:new Mj(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`obj`:new UM(t).load(e,e=>n(e),()=>{},e=>n(null,e));break;case`dae`:new WA(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`stl`:console.log(`🔧 Loading STL file: ${e}`),new HA(t).load(e,t=>{console.log(`✅ STL loaded successfully: ${e}`),n(new mT(t,new VE))},t=>{console.log(`📊 STL loading progress: ${e}`,t)},t=>{console.error(`❌ STL loading failed: ${e}`,t),console.log(`🔄 Creating fallback geometry for: ${e}`),n(new mT(new gT(.05,.05,.05),new VE({color:16739125,transparent:!0,opacity:.7})))});break;default:n(null,Error(`Unsupported file format: ${r}`))}},GM=`leLab-floor-grid`;function KM(e,t){e.innerHTML=``;let n=document.createElement(`urdf-viewer`);n.classList.add(`w-full`,`h-full`),e.appendChild(n),n.setAttribute(`up`,`Z`),ZM(n,t?`#2c2b3a`:`#eff4ff`),n.setAttribute(`highlight-color`,t?`#df6dd4`:`#b05ffe`),n.setAttribute(`auto-redraw`,`true`);let r=new FD(14079702,1);n.scene.add(r);let i=new PD(16777215,.8);i.position.set(5,30,5),i.castShadow=!0,n.scene.add(i);let a=new rO(1,10,7039866,4473423);return a.name=GM,n.scene.add(a),n}function qM(e,t,n,r){let i=e.scene.getObjectByName(GM);if(!i)return;let a=Math.max(r*4,.01);i.scale.setScalar(a),i.position.set(t.x,n-a*.001,t.z)}function JM(e,t){`loadMeshFunc`in e&&(e.loadMeshFunc=(e,n,r)=>{let i=t?t(e):e;try{WM(i,n,(e,t)=>{t?(console.warn(`Error loading mesh ${i}:`,t),r(null)):r(e)})}catch(e){console.error(`Exception loading mesh ${i}:`,e),r(null,e)}})}function YM(e,t){let n=e=>{t(e.detail)},r=()=>{t(null)};return e.addEventListener(`joint-mouseover`,n),e.addEventListener(`joint-mouseout`,r),()=>{e.removeEventListener(`joint-mouseover`,n),e.removeEventListener(`joint-mouseout`,r)}}function XM(e,t,n,r,i=[]){let a=t.startsWith(`blob:`)&&!t.includes(`#.`)?t+`#.urdf`:t;e.setAttribute(`urdf`,a),e.setAttribute(`package`,n);let o=()=>{if(i.length>0){let e=i[0];e&&(r(e),gi.info(`Trying alternative model...`,{description:`First model failed to load. Trying ${e.split(`/`).pop()||`alternative model`}`,duration:2e3}))}};return e.addEventListener(`error`,o),()=>{e.removeEventListener(`error`,o)}}function ZM(e,t){let n=e.parentElement;n&&(n.style.backgroundColor=t)}typeof window<`u`&&!customElements.get(`urdf-viewer`)&&customElements.define(`urdf-viewer`,Tj);var QM=(0,_.memo)(()=>{let e=(0,_.useRef)(null),[t,n]=(0,_.useState)(null),{registerUrdfProcessor:r,alternativeUrdfModels:i,isDefaultModel:a}=Bi(),o=(0,_.useRef)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(!1),{isConnected:l}=Oj({viewerRef:s,enabled:a}),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=(0,_.useRef)(``),h=(0,_.useMemo)(()=>({loadUrdf:e=>{d(e)},setUrlModifierFunc:e=>{p(()=>e)},getPackage:()=>m.current}),[]);(0,_.useEffect)(()=>{r(h)},[r,h]);let g=(0,_.useCallback)(e=>{if(console.log(`🔗 defaultUrlModifier called with: ${e}`),e.startsWith(`package://so_arm_description/meshes/`)){let t=e.replace(`package://so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (package): ${t}`),t}if(e.includes(`so_arm_description/meshes/`)){let t=e.replace(/.*so_arm_description\/meshes\//,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (partial): ${t}`),t}if(e.includes(`/so-101-urdf/so_arm_description/meshes/`)){let t=e.replace(`/so-101-urdf/so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (problematic path): ${t}`),t}if(e.endsWith(`.stl`)&&!e.startsWith(`/`)&&!e.startsWith(`http`)){let t=`/so-101-urdf/meshes/${e}`;return console.log(`🔗 Modified URL (relative): ${t}`),t}return console.log(`🔗 Unmodified URL: ${e}`),e},[]);return(0,_.useEffect)(()=>{if(!e.current)return;let t=KM(e.current,!0);s.current=t,JM(t,a?g:f);let r=a?`/so-101-urdf/urdf/so101_new_calib.urdf`:u||``;a&&(m.current=`/`);let l=()=>{};r&&(l=XM(t,r,m.current,d,i));let p=YM(t,n),h=e=>{if(!e||!e.robot){console.log(`[RobotViewer] Cannot fit to view: No viewer or robot available`);return}try{let t=new OC().setFromObject(e.robot),n=new Y;t.getCenter(n);let r=new Y;t.getSize(r);let i=Math.max(r.x,r.y,r.z);qM(e,n,t.min.y,i),e.camera.position.copy(n);let a=new Y;e.up===`+Z`||e.up===`Z`||e.up===`+Y`||e.up,a.set(1,1,1),a.normalize().multiplyScalar(i*1.3),e.camera.position.add(a),e.controls.target.copy(n),e.controls.update(),e.redraw(),console.log(`[RobotViewer] Robot auto-fitted to view`)}catch(e){console.error(`[RobotViewer] Error fitting robot to view:`,e)}},_=()=>{h(t)},v=()=>{c.current=!0,`setJointValue`in t&&(o.current&&=(o.current(),null)),_()};return t.addEventListener(`urdf-processed`,v),()=>{o.current&&=(o.current(),null),c.current=!1,p(),l(),t.removeEventListener(`urdf-processed`,v)}},[a,u,f,g,i]),(0,B.jsxs)(`div`,{className:K(`w-full h-full transition-all duration-300 ease-in-out relative`,`bg-gradient-to-br from-gray-900 to-gray-800`),children:[(0,B.jsx)(`div`,{ref:e,className:`w-full h-full`}),t&&(0,B.jsxs)(`div`,{className:`absolute bottom-4 right-4 bg-black/70 text-white px-3 py-2 rounded-md text-sm font-mono z-10`,children:[`Joint: `,t]}),a&&(0,B.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-mono ${l?`bg-green-900/70 text-green-300`:`bg-red-900/70 text-red-300`}`,children:[(0,B.jsx)(`div`,{className:`w-2 h-2 rounded-full ${l?`bg-green-400`:`bg-red-400`}`}),l?`Live Robot Data`:`Disconnected`]})})]})}),$M=({className:e,iconOnly:t=!1})=>(0,B.jsxs)(`div`,{className:K(`flex items-center gap-2`,e),children:[(0,B.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab Logo`,className:`h-8 w-8`}),!t&&(0,B.jsx)(`span`,{className:`font-bold text-white text-2xl`,children:`LeLab`})]}),eN=({onGoBack:e,className:t,rightSlot:n})=>(0,B.jsxs)(`div`,{className:K(`w-full p-2 sm:p-4 space-y-4 lg:space-y-0 lg:space-x-4 flex flex-col lg:flex-row`,t),children:[(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-4 flex-1 flex flex-col`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4 mb-4`,children:[(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:e,className:`text-gray-400 hover:text-white hover:bg-gray-800 flex-shrink-0`,children:(0,B.jsx)(os,{className:`h-5 w-5`})}),(0,B.jsx)($M,{iconOnly:!0}),(0,B.jsx)(`div`,{className:`w-px h-6 bg-gray-700`}),(0,B.jsx)(`h2`,{className:`text-xl font-medium text-gray-200`,children:`Teleoperation`})]}),(0,B.jsx)(`div`,{className:`flex-1 bg-black rounded border border-gray-800 min-h-[50vh] lg:min-h-0`,children:(0,B.jsx)(QM,{})})]}),n&&(0,B.jsx)(`div`,{className:`lg:w-96 flex flex-col`,children:n})]}),tN=`Switch`,[nN,Tne]=aa(tN),[rN,iN]=nN(tN),aN=_.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=_.useState(null),m=ra(t,e=>p(e)),h=_.useRef(!1),g=f?u||!!f.closest(`form`):!0,[v,y]=qa({prop:i,defaultProp:a??!1,onChange:l,caller:tN});return(0,B.jsxs)(rN,{scope:n,checked:v,disabled:s,children:[(0,B.jsx)(H.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":uN(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:V(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,B.jsx)(lN,{control:f,bubbles:!h.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});aN.displayName=tN;var oN=`SwitchThumb`,sN=_.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=iN(oN,n);return(0,B.jsx)(H.span,{"data-state":uN(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});sN.displayName=oN;var cN=`SwitchBubbleInput`,lN=_.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=_.useRef(null),s=ra(o,a),c=D_(n),l=jm(t);return _.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,B.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});lN.displayName=cN;function uN(e){return e?`checked`:`unchecked`}var dN=aN,fN=sN,pN=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(dN,{className:K(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,B.jsx)(fN,{className:K(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)})}));pN.displayName=dN.displayName;var mN=({deviceId:e,label:t})=>{let{videoRef:n,hasError:r}=Xy(e,!1);return(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`aspect-[4/3] bg-gray-800 relative`,children:e&&!r?(0,B.jsx)(`video`,{ref:n,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-full object-cover`}):(0,B.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center`,children:[(0,B.jsx)($s,{className:`w-8 h-8 text-gray-500 mb-2`}),(0,B.jsx)(`span`,{className:`text-gray-500 text-sm`,children:e?`Preview failed`:`No camera selected`})]})}),t&&(0,B.jsx)(`div`,{className:`p-2 text-sm text-gray-300 truncate border-t border-gray-800`,children:t})]})},hN=()=>{let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(0),{selectedRecord:i,isLoading:a}=Fb(),o=(i?.cameras??[]).map(e=>({key:e.id,name:e.name,deviceId:e.device_id}));return(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-4 flex flex-col gap-4 h-full`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-medium text-gray-200`,children:`Cameras`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e&&o.length>0&&(0,B.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>r(e=>e+1),className:`h-9 w-9 text-gray-400 hover:text-white flex-shrink-0`,title:`Retry camera feeds (e.g. after reconnecting a camera)`,"aria-label":`Retry camera feeds`,children:(0,B.jsx)(zs,{className:`w-4 h-4`})}),(0,B.jsx)(J,{htmlFor:`teleop-camera-toggle`,className:`text-sm text-gray-400`,children:e?`On`:`Off`}),(0,B.jsx)(pN,{id:`teleop-camera-toggle`,checked:e,onCheckedChange:t})]})]}),e?o.length>0?(0,B.jsx)(`div`,{className:`flex flex-col gap-3 overflow-y-auto`,children:o.map(e=>(0,B.jsx)(mN,{deviceId:e.deviceId,label:e.name},`${e.key}:${n}`))}):(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:a?`Loading robot...`:`No cameras configured for this robot. Add them during calibration to see live feeds here.`}):(0,B.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Turn on to watch your cameras while you teleoperate.`})]})},gN=()=>{let e=ht(),{toast:t}=ea(),{baseUrl:n,fetchWithHeaders:r}=wl(),i=(0,_.useRef)(!1),a=(0,_.useCallback)(async()=>{if(!i.current){i.current=!0;try{(await(await r(`${n}/stop-teleoperation`,{method:`POST`})).json())?.success&&t({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly.`})}catch{}}},[n,r,t]);return(0,_.useEffect)(()=>{let e=()=>{try{sessionStorage.setItem(`lelab:teleop-stopped`,`1`)}catch{}fetch(`${n}/stop-teleoperation`,{method:`POST`,keepalive:!0}).catch(()=>{})};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),a()}},[n,a]),(0,B.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center p-2 sm:p-4`,children:(0,B.jsx)(`div`,{className:`w-full h-[95vh] flex`,children:(0,B.jsx)(eN,{onGoBack:async()=>{await a(),e(`/`)},className:`lg:w-full`,rightSlot:(0,B.jsx)(hN,{})})})})},_N=es(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function vN({className:e,variant:t,...n}){return(0,B.jsx)(`div`,{className:K(_N({variant:t}),e),...n})}var yN=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ul(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),bN=`Separator`,xN=`horizontal`,SN=[`horizontal`,`vertical`],CN=_.forwardRef((e,t)=>{let{decorative:n,orientation:r=xN,...i}=e,a=wN(r)?r:xN,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,B.jsx)(yN.div,{"data-orientation":a,...o,...i,ref:t})});CN.displayName=bN;function wN(e){return SN.includes(e)}var TN=CN,EN=_.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,B.jsx)(TN,{ref:i,decorative:n,orientation:t,className:K(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));EN.displayName=TN.displayName;var DN=({onClick:e,robotType:t,className:n=``})=>(0,B.jsxs)(q,{type:`button`,onClick:e,variant:`outline`,size:`sm`,className:` h-8 px-2 border-gray-600 hover:border-blue-500 text-gray-400 hover:text-blue-400 bg-gray-800 hover:bg-gray-700 transition-all duration-200 ${n} - `,title:`Find ${t||`robot`} port automatically`,children:[(0,B.jsx)(Hs,{className:`w-3 h-3 mr-1`}),`Find`]}),kN=2e3,AN=({open:e,onOpenChange:t,robotType:n,onPortDetected:r})=>{let[i,a]=(0,_.useState)(`detecting`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),u=(0,_.useRef)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),{toast:p}=ea(),{baseUrl:m,fetchWithHeaders:h}=wl(),g=async()=>{try{d.current=new AbortController;let e=await(await h(`${m}/start-port-detection`,{method:`POST`,body:JSON.stringify({robot_type:n}),signal:d.current.signal})).json();if(u.current)return;if(e.status!==`success`)throw Error(e.message||`Failed to start port detection`);let i=e.data.ports_before;for(;!u.current;){d.current=new AbortController;let e=await(await h(`${m}/detect-port-after-disconnect`,{method:`POST`,body:JSON.stringify({ports_before:i}),signal:d.current.signal})).json();if(u.current)return;if(e.status===`success`){if(s(e.port),await v(e.port),u.current)return;a(`success`),p({title:`Port Detected Successfully`,description:`${n} port detected: ${e.port}`}),f.current=window.setTimeout(()=>{u.current||(r(e.port),t(!1))},kN);return}let o=typeof e.message==`string`?e.message:``;if(!o.includes(`Timed out`))throw Error(o||`Failed to detect port`)}}catch(e){if(u.current||e instanceof DOMException&&e.name===`AbortError`)return;console.error(`Port detection failed:`,e),l(e instanceof Error?e.message:`Unknown error`),a(`error`)}},v=async e=>{try{await h(`${m}/save-robot-port`,{method:`POST`,body:JSON.stringify({robot_type:n,port:e})})}catch(e){console.error(`Error saving port:`,e)}};(0,_.useEffect)(()=>{if(e)return u.current=!1,a(`detecting`),l(``),s(``),g(),()=>{u.current=!0,d.current?.abort(),f.current!==null&&(window.clearTimeout(f.current),f.current=null)}},[e]);let y=()=>{t(!1)},b=()=>{u.current=!1,d.current?.abort(),a(`detecting`),l(``),s(``),g()};return(0,B.jsx)(lf,{open:e,onOpenChange:t,children:(0,B.jsxs)(ff,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[500px] p-8`,children:[(0,B.jsxs)(pf,{children:[(0,B.jsx)(hf,{className:`text-white text-center text-xl font-bold`,children:`Port Detection`}),(0,B.jsxs)(gf,{className:`text-gray-400 text-center`,children:[`Detect the USB port for your `,n,` arm`]})]}),(0,B.jsx)(`div`,{className:`py-4`,children:(()=>{switch(i){case`detecting`:return(0,B.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,B.jsx)(Ns,{className:`w-16 h-16 text-blue-500 mx-auto animate-spin`}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`h3`,{className:`text-lg font-semibold text-white`,children:[`Unplug the `,n,` arm`]}),(0,B.jsxs)(`p`,{className:`text-gray-400`,children:[`Disconnect the `,n,` robot arm from USB. The port will be detected automatically.`]})]}),(0,B.jsx)(`div`,{className:`flex justify-center`,children:(0,B.jsx)(q,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})})]});case`success`:return(0,B.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,B.jsx)(gs,{className:`w-16 h-16 text-green-500 mx-auto`}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Port Detected`}),(0,B.jsx)(`p`,{className:`text-xl font-mono text-green-400 bg-gray-800 px-4 py-2 rounded inline-block`,children:o})]})]});case`error`:return(0,B.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,B.jsx)(hs,{className:`w-16 h-16 text-red-500 mx-auto`}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Detection Failed`}),(0,B.jsx)(`div`,{className:`bg-red-900/20 border border-red-800 rounded-lg p-3`,children:(0,B.jsx)(`p`,{className:`text-red-400 text-sm`,children:c})})]}),(0,B.jsxs)(`div`,{className:`flex gap-4 justify-center`,children:[(0,B.jsx)(q,{onClick:b,className:`bg-blue-500 hover:bg-blue-600 text-white px-8 py-2`,children:`Try Again`}),(0,B.jsx)(q,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})]})]});default:return null}})()})]})})},jN={teleop:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1150},robot:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1400}},MN=.98;function NN(e,t,n){if(!e)return!1;let r=jN[e]?.[t];return r?n>=r*MN:!1}var PN=`Motor discontinuity detected`,FN=()=>{let e=ht(),t=ft().state?.robot_name??null,{toast:n}=ea(),{baseUrl:r,fetchWithHeaders:i}=wl();(0,_.useRef)(null);let a=(0,_.useRef)(null),[o,s]=(0,_.useState)(`teleop`),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)([]),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null),v=(0,_.useCallback)(async()=>{if(!t)return null;try{let e=await i(`${r}/robots/${encodeURIComponent(t)}`);if(!e.ok)return null;let n=(await e.json()).robot??null;return d(n),n}catch(e){return console.error(`Failed to load robot record:`,e),null}},[t,r,i]);(0,_.useEffect)(()=>{if(!t)return;let e=!1;return(async()=>{let t=await v();if(!t||e)return;let n=t.leader_config?t.follower_config?`teleop`:`robot`:`teleop`;s(n),l(n===`teleop`?t.leader_port||``:t.follower_port||``),p(t.cameras??[])})(),()=>{e=!0}},[t,v]);let y=e=>{p(e),t&&(g.current&&clearTimeout(g.current),g.current=setTimeout(async()=>{try{await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cameras:e})})}catch(e){console.error(`Failed to save cameras to robot record:`,e)}},500))};(0,_.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(`leader`),[w,T]=(0,_.useState)({calibration_active:!1,status:`idle`,device_type:null,error:null,message:``,step:0,total_steps:1,current_positions:null,recorded_ranges:null}),[E,D]=(0,_.useState)(!1),O=(0,_.useRef)(!1);(0,_.useEffect)(()=>{O.current=w.calibration_active},[w.calibration_active]),(0,_.useEffect)(()=>()=>{O.current&&i(`${r}/stop-calibration`,{method:`POST`}).catch(e=>console.error(`Failed to stop calibration on unmount:`,e))},[r,i]);let k=async()=>{try{let e=await i(`${r}/calibration-status`);if(e.ok){let t=await e.json();T(t),!t.calibration_active&&(t.status===`completed`||t.status===`error`||t.status===`idle`)&&D(!1)}}catch(e){console.error(`Error polling status:`,e)}},A=async()=>{if(!t){n({title:`No robot selected`,description:`Open Calibration from a robot's gear icon on the Landing page.`,variant:`destructive`});return}if(!c){n({title:`Missing port`,description:`Set the device's serial port before starting.`,variant:`destructive`});return}let e={device_type:o,port:c,config_file:t,robot_name:t};O.current=!0;try{let t=await(await i(`${r}/start-calibration`,{method:`POST`,body:JSON.stringify(e)})).json();t.success?(n({title:`Calibration Started`,description:`Calibration started for ${o}`}),D(!0)):(O.current=!1,n({title:`Calibration Failed`,description:t.message||`Failed to start calibration`,variant:`destructive`}))}catch(e){O.current=!1,console.error(`Error starting calibration:`,e),n({title:`Error`,description:`Failed to start calibration`,variant:`destructive`})}},j=async()=>{try{let e=await(await i(`${r}/stop-calibration`,{method:`POST`})).json();e.success?n({title:`Calibration Stopped`,description:`Calibration has been stopped`}):n({title:`Error`,description:e.message||`Failed to stop calibration`,variant:`destructive`})}catch(e){console.error(`Error stopping calibration:`,e),n({title:`Error`,description:`Failed to stop calibration`,variant:`destructive`})}},M=async()=>{if(w.calibration_active)try{let e=await(await i(`${r}/complete-calibration-step`,{method:`POST`})).json();e.success?n({title:`Step Completed`,description:e.message}):n({title:`Step Failed`,description:e.message||`Could not complete step`,variant:`destructive`})}catch(e){console.error(`Error completing step:`,e),n({title:`Error`,description:`Could not complete calibration step`,variant:`destructive`})}};(0,_.useEffect)(()=>{w.status===`error`&&w.error?.startsWith(PN)&&a.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[w.status,w.error]),(0,_.useEffect)(()=>{if(!E)return;k();let e=setInterval(()=>{k()},200);return()=>clearInterval(e)},[E]),(0,_.useEffect)(()=>{(async()=>{if(o&&!t)try{let e=await(await i(`${r}/robot-port/${o===`robot`?`follower`:`leader`}`)).json();if(e.status===`success`){let t=e.saved_port||e.default_port;t&&l(t)}}catch(e){console.error(`Error loading default port:`,e)}})()},[o,t,r,i]);let N=e=>{s(e),u&&l(e===`teleop`?u.leader_port||``:u.follower_port||``)};(0,_.useEffect)(()=>{w.status===`completed`&&(async()=>{let e=await v();if(!e)return;let t=e.leader_config?e.follower_config?`teleop`:`robot`:`teleop`;s(t),l(t===`teleop`?e.leader_port||``:e.follower_port||``)})()},[w.status,v]);let P=()=>{C(o===`robot`?`follower`:`leader`),x(!0)},F=(0,_.useCallback)(async e=>{if(!t||!e)return;let n=o===`robot`?`follower_port`:`leader_port`;if(!(u&&u[n]===e))try{let a=await(await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({[n]:e})})).json();a.robot&&d(a.robot)}catch(e){console.error(`Failed to save port to robot record:`,e)}},[t,o,u,r,i]),ee=e=>{l(e),F(e)},te=(()=>{switch(w.status){case`idle`:return{color:`bg-slate-500`,icon:(0,B.jsx)(Us,{className:`w-4 h-4`}),text:`Idle`};case`connecting`:return{color:`bg-yellow-500`,icon:(0,B.jsx)(Ns,{className:`w-4 h-4 animate-spin`}),text:`Connecting`};case`recording`:return{color:`bg-purple-500`,icon:(0,B.jsx)(as,{className:`w-4 h-4`}),text:`Recording Ranges`};case`completed`:return{color:`bg-green-500`,icon:(0,B.jsx)(gs,{className:`w-4 h-4`}),text:`Completed`};case`error`:return{color:`bg-red-500`,icon:(0,B.jsx)(ys,{className:`w-4 h-4`}),text:`Error`};case`stopping`:return{color:`bg-orange-500`,icon:(0,B.jsx)(Js,{className:`w-4 h-4`}),text:`Stopping`};default:return{color:`bg-slate-500`,icon:(0,B.jsx)(Us,{className:`w-4 h-4`}),text:`Unknown`}}})();return(0,B.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,B.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4 mb-6`,children:[(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>e(-1),className:`text-slate-400 hover:text-white hover:bg-slate-800`,children:(0,B.jsx)(os,{className:`w-5 h-5`})}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(eN,{iconOnly:!0}),(0,B.jsx)(`h1`,{className:`text-3xl font-bold`,children:t?`Calibrate "${t}"`:`Device Calibration`})]})]}),!t&&(0,B.jsxs)(Mv,{className:`mb-6 bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(hs,{className:`h-4 w-4`}),(0,B.jsx)(Nv,{children:`Open Calibration from a robot's gear icon on the Landing page. Each robot has its own calibration; running this page directly is not supported.`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,B.jsxs)(hb,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,B.jsx)(gb,{children:(0,B.jsxs)(_b,{className:`flex items-center gap-2 text-slate-200`,children:[(0,B.jsx)(Us,{className:`w-5 h-5 text-blue-400`}),`Configuration`]})}),(0,B.jsxs)(yb,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`deviceType`,className:`text-sm font-medium text-slate-300`,children:`Device Type *`}),(0,B.jsxs)(Uy,{value:o,onValueChange:N,children:[(0,B.jsx)(Gy,{className:`bg-slate-700 border-slate-600 text-white rounded-md`,children:(0,B.jsx)(Wy,{placeholder:`Select device type`})}),(0,B.jsxs)(Jy,{className:`bg-slate-800 border-slate-700 text-white`,children:[(0,B.jsx)(Xy,{value:`teleop`,className:`hover:bg-slate-700`,children:`Teleoperator (Leader)`}),(0,B.jsx)(Xy,{value:`robot`,className:`hover:bg-slate-700`,children:`Robot (Follower)`})]})]})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`port`,className:`text-sm font-medium text-slate-300`,children:`Port *`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(J_,{id:`port`,value:c,onChange:e=>l(e.target.value),onBlur:e=>F(e.target.value),placeholder:`/dev/tty.usbmodem...`,className:`bg-slate-700 border-slate-600 text-white rounded-md flex-1`}),(0,B.jsx)(ON,{onClick:P,robotType:o===`robot`?`follower`:`leader`,className:`border-slate-600 hover:border-blue-500 text-slate-400 hover:text-blue-400 bg-slate-700 hover:bg-slate-600`})]})]}),(0,B.jsx)(DN,{className:`bg-slate-700`}),(0,B.jsx)(`div`,{className:`flex flex-col gap-3`,children:w.calibration_active?(0,B.jsxs)(q,{onClick:j,variant:`destructive`,className:`w-full rounded-full py-6 text-lg`,children:[(0,B.jsx)(Js,{className:`w-5 h-5 mr-2`}),`Cancel Calibration`]}):(0,B.jsxs)(q,{onClick:A,className:`w-full bg-blue-600 hover:bg-blue-700 text-white rounded-full py-6 text-lg`,disabled:!t||!o||!c,"data-tour":`calibration-start`,children:[(0,B.jsx)(Ls,{className:`w-5 h-5 mr-2`}),`Start Calibration`]})}),u&&(0,B.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,B.jsx)(`div`,{className:`text-sm font-medium text-slate-300`,children:`Robot calibration`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.leader_config?(0,B.jsx)(gs,{className:`w-4 h-4 text-green-400`}):(0,B.jsx)(bs,{className:`w-4 h-4 text-slate-500`}),(0,B.jsx)(`span`,{className:u.leader_config?`text-slate-200`:`text-slate-400`,children:`Leader (Teleoperator)`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.follower_config?(0,B.jsx)(gs,{className:`w-4 h-4 text-green-400`}):(0,B.jsx)(bs,{className:`w-4 h-4 text-slate-500`}),(0,B.jsx)(`span`,{className:u.follower_config?`text-slate-200`:`text-slate-400`,children:`Follower (Robot)`})]})]})]})]}),(0,B.jsxs)(hb,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,B.jsx)(gb,{children:(0,B.jsxs)(_b,{className:`flex items-center gap-2 text-slate-200`,children:[(0,B.jsx)(as,{className:`w-5 h-5 text-teal-400`}),`Status`]})}),(0,B.jsxs)(yb,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-slate-900/50 rounded-md`,children:[(0,B.jsx)(`span`,{className:`text-slate-300`,children:`Status:`}),(0,B.jsxs)(yN,{className:`${te.color} text-white rounded-md`,children:[te.icon,(0,B.jsx)(`span`,{className:`ml-2`,children:te.text})]})]}),w.status===`recording`&&w.recorded_ranges&&(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(as,{className:`w-4 h-4 text-purple-400`}),(0,B.jsx)(`span`,{className:`text-sm font-medium text-slate-300`,children:`Live Position Data`})]}),(0,B.jsx)(`div`,{className:`bg-slate-800 rounded-lg p-4 border border-slate-700`,children:(0,B.jsx)(`div`,{className:`space-y-3`,children:Object.entries(w.recorded_ranges).map(([e,t])=>{let n=t.max-t.min,r=t.current-t.min,i=n>0?r/n*100:50,a=NN(w.device_type,e,n);return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-white font-semibold text-sm`,children:e}),a&&(0,B.jsx)(gs,{className:`w-4 h-4 text-green-400`,"aria-label":`Range complete`})]}),(0,B.jsx)(`span`,{className:`text-slate-300 text-xs font-mono`,children:t.current})]}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(`div`,{className:`w-full bg-slate-700 rounded-full h-3`,children:(0,B.jsx)(`div`,{className:`bg-slate-600 h-3 rounded-full relative`,style:{width:`100%`},children:(0,B.jsx)(`div`,{className:`absolute top-0 w-1 h-3 rounded-full transition-all duration-100 ${a?`bg-green-400`:`bg-yellow-400`}`,style:{left:`${Math.max(0,Math.min(100,i))}%`,transform:`translateX(-50%)`}})})}),(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-slate-400 mt-1`,children:[(0,B.jsx)(`span`,{children:t.min}),(0,B.jsx)(`span`,{children:t.max})]})]})]},e)})})})]}),w.status===`connecting`&&(0,B.jsxs)(Mv,{className:`bg-yellow-900/50 border-yellow-700 text-yellow-200`,children:[(0,B.jsx)(hs,{className:`h-4 w-4`}),(0,B.jsx)(Nv,{children:`Connecting to the device. Please ensure it's connected.`})]}),w.status===`recording`&&(()=>{let e=w.recorded_ranges??{},t=Object.entries(e),n=t.length>0&&t.every(([e,t])=>NN(w.device_type,e,t.max-t.min));return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`div`,{className:`flex justify-center`,children:(0,B.jsxs)(q,{onClick:M,disabled:!w.calibration_active,className:`px-8 py-3 rounded-full transition-colors ${n?`bg-green-600 hover:bg-green-700`:`bg-orange-500 hover:bg-orange-600`}`,children:[n?(0,B.jsx)(gs,{className:`w-4 h-4 mr-2`}):(0,B.jsx)(hs,{className:`w-4 h-4 mr-2`}),`Save Calibration`]})}),(0,B.jsxs)(Mv,{className:`bg-purple-900/50 border-purple-700 text-purple-200`,children:[(0,B.jsx)(as,{className:`h-4 w-4`}),(0,B.jsxs)(Nv,{children:[(0,B.jsx)(`strong`,{children:`Important:`}),` Move EACH joint through its full range. A check appears next to each joint once its range is wide enough.`]})]})]})})(),w.status===`completed`&&(0,B.jsxs)(Mv,{className:`bg-green-900/50 border-green-700 text-green-200`,children:[(0,B.jsx)(gs,{className:`h-4 w-4`}),(0,B.jsx)(Nv,{children:`Calibration completed successfully!`})]}),w.status===`error`&&w.error&&(w.error.startsWith(PN)?(0,B.jsxs)(Mv,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,B.jsx)(ys,{className:`h-4 w-4`}),(0,B.jsxs)(Nv,{children:[(0,B.jsx)(`div`,{className:`font-semibold text-base mb-1`,children:`Motor discontinuity detected`}),(0,B.jsx)(`div`,{children:`Make sure to start the calibration with the robot in a middle position — all joints in the middle of their ranges. See the calibration demo below for the correct starting pose.`})]})]}):(0,B.jsxs)(Mv,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,B.jsx)(ys,{className:`h-4 w-4`}),(0,B.jsxs)(Nv,{children:[(0,B.jsx)(`strong`,{children:`Error:`}),` `,w.error]})]})),(0,B.jsxs)(`div`,{ref:a,className:`bg-slate-900/50 p-4 rounded-lg border border-slate-700`,children:[(0,B.jsx)(`h4`,{className:`font-semibold mb-3 text-slate-200`,children:`Calibration Demo:`}),(0,B.jsx)(`div`,{className:`relative rounded-lg overflow-hidden bg-slate-800`,children:(0,B.jsxs)(`video`,{className:`w-full h-auto rounded-md`,controls:!0,preload:`auto`,muted:!0,children:[(0,B.jsx)(`source`,{src:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,type:`video/mp4`}),(0,B.jsxs)(`p`,{className:`text-slate-400 text-sm text-center py-4`,children:[`Your browser does not support the video tag.`,(0,B.jsx)(`br`,{}),(0,B.jsx)(`a`,{href:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,className:`text-blue-400 hover:text-blue-300 underline`,target:`_blank`,rel:`noopener noreferrer`,children:`Click here to view the calibration video`})]})]})})]})]})]})]}),t&&(0,B.jsxs)(hb,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm mt-6`,"data-tour":`calibration-cameras`,children:[(0,B.jsxs)(gb,{className:`flex-row items-center justify-between space-y-0`,children:[(0,B.jsxs)(_b,{className:`flex items-center gap-2 text-slate-200`,children:[(0,B.jsx)(Us,{className:`w-5 h-5 text-blue-400`}),`Attached cameras`]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(J,{htmlFor:`cameras-toggle`,className:`text-sm text-slate-400 cursor-pointer`,children:m?`On`:`Off`}),(0,B.jsx)(mN,{id:`cameras-toggle`,checked:m,onCheckedChange:h,className:`data-[state=checked]:bg-green-500`,"aria-label":`Turn cameras on or off`})]})]}),(0,B.jsx)(yb,{children:m?(0,B.jsx)(cb,{cameras:f,onCamerasChange:y}):(0,B.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-900/40 p-6 text-center space-y-3`,children:[(0,B.jsx)(cs,{className:`w-10 h-10 mx-auto text-slate-500`}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`p`,{className:`text-slate-200 font-medium`,children:`Cameras are off`}),(0,B.jsx)(`p`,{className:`text-sm text-slate-400 max-w-md mx-auto`,children:`Turn cameras on to scan for connected devices and preview them. The browser may briefly open a camera to read device labels, and configured cameras stay active while previews are visible; your browser will ask for camera permission. Nothing is recorded.`}),f.length>0&&(0,B.jsxs)(`p`,{className:`text-xs text-slate-500 pt-1`,children:[f.length,` camera`,f.length===1?``:`s`,` saved to this robot.`]})]}),(0,B.jsxs)(`p`,{className:`flex items-center justify-center gap-1.5 text-xs text-slate-500`,children:[(0,B.jsx)(Ws,{className:`w-3.5 h-3.5`}),`You'll be asked to grant camera access.`]})]})})]})]}),(0,B.jsx)(AN,{open:b,onOpenChange:x,robotType:S,onPortDetected:ee})]})},IN=`rovingFocusGroup.onEntryFocus`,LN={bubbles:!1,cancelable:!0},RN=`RovingFocusGroup`,[zN,BN,VN]=pa(RN),[HN,UN]=aa(RN,[VN]),[WN,GN]=HN(RN),KN=_.forwardRef((e,t)=>(0,B.jsx)(zN.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(zN.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(qN,{...e,ref:t})})}));KN.displayName=RN;var qN=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=_.useRef(null),p=ra(t,f),m=Fv(a),[h,g]=qa({prop:o,defaultProp:s??null,onChange:c,caller:RN}),[v,y]=_.useState(!1),b=xa(l),x=BN(n),S=_.useRef(!1),[C,w]=_.useState(0);return _.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(IN,b),()=>e.removeEventListener(IN,b)},[b]),(0,B.jsx)(WN,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:_.useCallback(e=>g(e),[g]),onItemShiftTab:_.useCallback(()=>y(!0),[]),onFocusableItemAdd:_.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>w(e=>e-1),[]),children:(0,B.jsx)(H.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:V(e.onMouseDown,()=>{S.current=!0}),onFocus:V(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(IN,LN);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);$N([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:V(e.onBlur,()=>y(!1))})})}),JN=`RovingFocusGroupItem`,YN=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Al(),l=a||c,u=GN(JN,n),d=u.currentTabStopId===l,f=BN(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return _.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,B.jsx)(zN.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,B.jsx)(H.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:V(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:V(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:V(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=QN(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?eP(n,r+1):n.slice(r+1)}setTimeout(()=>$N(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});YN.displayName=JN;var XN={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function ZN(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function QN(e,t,n){let r=ZN(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return XN[r]}function $N(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function eP(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var tP=KN,nP=YN;function rP(e){let t=iP(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(oP);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function iP(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=cP(n),i=sP(r,n.props);return n.type!==_.Fragment&&(i.ref=t?na(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var aP=Symbol(`radix.slottable`);function oP(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===aP}function sP(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function cP(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var lP=[`Enter`,` `],uP=[`ArrowDown`,`PageUp`,`Home`],dP=[`ArrowUp`,`PageDown`,`End`],fP=[...uP,...dP],pP={ltr:[...lP,`ArrowRight`],rtl:[...lP,`ArrowLeft`]},mP={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},hP=`Menu`,[gP,_P,vP]=pa(hP),[yP,bP]=aa(hP,[vP,Zm,UN]),xP=Zm(),SP=UN(),[CP,wP]=yP(hP),[TP,EP]=yP(hP),DP=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=xP(t),[c,l]=_.useState(null),u=_.useRef(!1),d=xa(a),f=Fv(i);return _.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,B.jsx)(ph,{...s,children:(0,B.jsx)(CP,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,B.jsx)(TP,{scope:t,onClose:_.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};DP.displayName=hP;var OP=`MenuAnchor`,kP=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=xP(n);return(0,B.jsx)(mh,{...i,...r,ref:t})});kP.displayName=OP;var AP=`MenuPortal`,[jP,MP]=yP(AP,{forceMount:void 0}),NP=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=wP(AP,t);return(0,B.jsx)(jP,{scope:t,forceMount:n,children:(0,B.jsx)(Ha,{present:n||a.open,children:(0,B.jsx)(Ba,{asChild:!0,container:i,children:r})})})};NP.displayName=AP;var PP=`MenuContent`,[FP,IP]=yP(PP),LP=_.forwardRef((e,t)=>{let n=MP(PP,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=wP(PP,e.__scopeMenu),o=EP(PP,e.__scopeMenu);return(0,B.jsx)(gP.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(Ha,{present:r||a.open,children:(0,B.jsx)(gP.Slot,{scope:e.__scopeMenu,children:o.modal?(0,B.jsx)(RP,{...i,ref:t}):(0,B.jsx)(zP,{...i,ref:t})})})})}),RP=_.forwardRef((e,t)=>{let n=wP(PP,e.__scopeMenu),r=_.useRef(null),i=ra(t,r);return _.useEffect(()=>{let e=r.current;if(e)return pd(e)},[]),(0,B.jsx)(VP,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),zP=_.forwardRef((e,t)=>{let n=wP(PP,e.__scopeMenu);return(0,B.jsx)(VP,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),BP=rP(`MenuContent.ScrollLock`),VP=_.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=wP(PP,n),v=EP(PP,n),y=xP(n),b=SP(n),x=_P(n),[S,C]=_.useState(null),w=_.useRef(null),T=ra(t,w,g.onContentChange),E=_.useRef(0),D=_.useRef(``),O=_.useRef(0),k=_.useRef(null),A=_.useRef(`right`),j=_.useRef(0),M=m?id:_.Fragment,N=m?{as:BP,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=TF(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};_.useEffect(()=>()=>window.clearTimeout(E.current),[]),Jl();let F=_.useCallback(e=>A.current===k.current?.side&&DF(e,k.current?.area),[]);return(0,B.jsx)(FP,{scope:n,searchRef:D,onItemEnter:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:_.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:_.useCallback(e=>{k.current=e},[]),children:(0,B.jsx)(M,{...N,children:(0,B.jsx)(Fl,{asChild:!0,trapped:i,onMountAutoFocus:V(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,B.jsx)(ka,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,B.jsx)(tP,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:V(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,B.jsx)(hh,{role:`menu`,"aria-orientation":`vertical`,"data-state":bF(g.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:V(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!fP.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);dP.includes(e.key)&&a.reverse(),CF(a)}),onBlur:V(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:V(e.onPointerMove,OF(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});LP.displayName=PP;var HP=`MenuGroup`,UP=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(H.div,{role:`group`,...r,ref:t})});UP.displayName=HP;var WP=`MenuLabel`,GP=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(H.div,{...r,ref:t})});GP.displayName=WP;var KP=`MenuItem`,qP=`menu.itemSelect`,JP=_.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=_.useRef(null),o=EP(KP,e.__scopeMenu),s=IP(KP,e.__scopeMenu),c=ra(t,a),l=_.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(qP,{bubbles:!0,cancelable:!0});e.addEventListener(qP,e=>r?.(e),{once:!0}),ba(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,B.jsx)(YP,{...i,ref:c,disabled:n,onClick:V(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:V(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:V(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||lP.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});JP.displayName=KP;var YP=_.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=IP(KP,n),s=SP(n),c=_.useRef(null),l=ra(t,c),[u,d]=_.useState(!1),[f,p]=_.useState(``);return _.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,B.jsx)(gP.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,B.jsx)(nP,{asChild:!0,...s,focusable:!r,children:(0,B.jsx)(H.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:V(e.onPointerMove,OF(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:V(e.onPointerLeave,OF(e=>o.onItemLeave(e))),onFocus:V(e.onFocus,()=>d(!0)),onBlur:V(e.onBlur,()=>d(!1))})})})}),XP=`MenuCheckboxItem`,ZP=_.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,B.jsx)(aF,{scope:e.__scopeMenu,checked:n,children:(0,B.jsx)(JP,{role:`menuitemcheckbox`,"aria-checked":xF(n)?`mixed`:n,...i,ref:t,"data-state":SF(n),onSelect:V(i.onSelect,()=>r?.(xF(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ZP.displayName=XP;var QP=`MenuRadioGroup`,[$P,eF]=yP(QP,{value:void 0,onValueChange:()=>{}}),tF=_.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=xa(r);return(0,B.jsx)($P,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,B.jsx)(UP,{...i,ref:t})})});tF.displayName=QP;var nF=`MenuRadioItem`,rF=_.forwardRef((e,t)=>{let{value:n,...r}=e,i=eF(nF,e.__scopeMenu),a=n===i.value;return(0,B.jsx)(aF,{scope:e.__scopeMenu,checked:a,children:(0,B.jsx)(JP,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":SF(a),onSelect:V(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});rF.displayName=nF;var iF=`MenuItemIndicator`,[aF,oF]=yP(iF,{checked:!1}),sF=_.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=oF(iF,n);return(0,B.jsx)(Ha,{present:r||xF(a.checked)||a.checked===!0,children:(0,B.jsx)(H.span,{...i,ref:t,"data-state":SF(a.checked)})})});sF.displayName=iF;var cF=`MenuSeparator`,lF=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(H.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});lF.displayName=cF;var uF=`MenuArrow`,dF=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=xP(n);return(0,B.jsx)(gh,{...i,...r,ref:t})});dF.displayName=uF;var fF=`MenuSub`,[pF,mF]=yP(fF),hF=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=wP(fF,t),o=xP(t),[s,c]=_.useState(null),[l,u]=_.useState(null),d=xa(i);return _.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,B.jsx)(ph,{...o,children:(0,B.jsx)(CP,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,B.jsx)(pF,{scope:t,contentId:Al(),triggerId:Al(),trigger:s,onTriggerChange:c,children:n})})})};hF.displayName=fF;var gF=`MenuSubTrigger`,_F=_.forwardRef((e,t)=>{let n=wP(gF,e.__scopeMenu),r=EP(gF,e.__scopeMenu),i=mF(gF,e.__scopeMenu),a=IP(gF,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>u,[u]),_.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,B.jsx)(kP,{asChild:!0,...l,children:(0,B.jsx)(YP,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":bF(n.open),...e,ref:na(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:V(e.onPointerMove,OF(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:V(e.onPointerLeave,OF(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:V(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||pP[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});_F.displayName=gF;var vF=`MenuSubContent`,yF=_.forwardRef((e,t)=>{let n=MP(PP,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=wP(PP,e.__scopeMenu),o=EP(PP,e.__scopeMenu),s=mF(vF,e.__scopeMenu),c=_.useRef(null),l=ra(t,c);return(0,B.jsx)(gP.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(Ha,{present:r||a.open,children:(0,B.jsx)(gP.Slot,{scope:e.__scopeMenu,children:(0,B.jsx)(VP,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:V(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:V(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:V(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=mP[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});yF.displayName=vF;function bF(e){return e?`open`:`closed`}function xF(e){return e===`indeterminate`}function SF(e){return xF(e)?`indeterminate`:e?`checked`:`unchecked`}function CF(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function wF(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function TF(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=wF(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function EF(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function DF(e,t){return t?EF({x:e.clientX,y:e.clientY},t):!1}function OF(e){return t=>t.pointerType===`mouse`?e(t):void 0}var kF=DP,AF=kP,jF=NP,MF=LP,NF=UP,PF=GP,FF=JP,IF=ZP,LF=tF,RF=rF,zF=sF,BF=lF,VF=dF,HF=_F,UF=yF,WF=`DropdownMenu`,[GF,Sne]=aa(WF,[bP]),KF=bP(),[qF,JF]=GF(WF),YF=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=KF(t),l=_.useRef(null),[u,d]=qa({prop:i,defaultProp:a??!1,onChange:o,caller:WF});return(0,B.jsx)(qF,{scope:t,triggerId:Al(),triggerRef:l,contentId:Al(),open:u,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,B.jsx)(kF,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};YF.displayName=WF;var XF=`DropdownMenuTrigger`,ZF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=JF(XF,n),o=KF(n);return(0,B.jsx)(AF,{asChild:!0,...o,children:(0,B.jsx)(H.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:na(t,a.triggerRef),onPointerDown:V(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:V(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});ZF.displayName=XF;var QF=`DropdownMenuPortal`,$F=e=>{let{__scopeDropdownMenu:t,...n}=e,r=KF(t);return(0,B.jsx)(jF,{...r,...n})};$F.displayName=QF;var eI=`DropdownMenuContent`,tI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=JF(eI,n),a=KF(n),o=_.useRef(!1);return(0,B.jsx)(MF,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:V(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});tI.displayName=eI;var nI=`DropdownMenuGroup`,rI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(NF,{...i,...r,ref:t})});rI.displayName=nI;var iI=`DropdownMenuLabel`,aI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(PF,{...i,...r,ref:t})});aI.displayName=iI;var oI=`DropdownMenuItem`,sI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(FF,{...i,...r,ref:t})});sI.displayName=oI;var cI=`DropdownMenuCheckboxItem`,lI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(IF,{...i,...r,ref:t})});lI.displayName=cI;var uI=`DropdownMenuRadioGroup`,dI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(LF,{...i,...r,ref:t})});dI.displayName=uI;var fI=`DropdownMenuRadioItem`,pI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(RF,{...i,...r,ref:t})});pI.displayName=fI;var mI=`DropdownMenuItemIndicator`,hI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(zF,{...i,...r,ref:t})});hI.displayName=mI;var gI=`DropdownMenuSeparator`,_I=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(BF,{...i,...r,ref:t})});_I.displayName=gI;var Cne=`DropdownMenuArrow`,wne=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(VF,{...i,...r,ref:t})});wne.displayName=Cne;var Tne=`DropdownMenuSubTrigger`,vI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(HF,{...i,...r,ref:t})});vI.displayName=Tne;var Ene=`DropdownMenuSubContent`,yI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=KF(n);return(0,B.jsx)(UF,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});yI.displayName=Ene;var Dne=YF,One=ZF,kne=$F,bI=tI,xI=aI,SI=sI,CI=lI,wI=pI,TI=hI,EI=_I,DI=vI,OI=yI,Ane=Dne,jne=One,Mne=_.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,B.jsxs)(DI,{ref:i,className:K(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent`,t&&`pl-8`,e),...r,children:[n,(0,B.jsx)(fs,{className:`ml-auto h-4 w-4`})]}));Mne.displayName=DI.displayName;var Nne=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(OI,{ref:n,className:K(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));Nne.displayName=OI.displayName;var kI=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,B.jsx)(kne,{children:(0,B.jsx)(bI,{ref:r,sideOffset:t,className:K(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));kI.displayName=bI.displayName;var AI=_.forwardRef(({className:e,inset:t,...n},r)=>(0,B.jsx)(SI,{ref:r,className:K(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));AI.displayName=SI.displayName;var Pne=_.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,B.jsxs)(CI,{ref:i,className:K(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(TI,{children:(0,B.jsx)(ls,{className:`h-4 w-4`})})}),t]}));Pne.displayName=CI.displayName;var Fne=_.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(wI,{ref:r,className:K(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(TI,{children:(0,B.jsx)(bs,{className:`h-2 w-2 fill-current`})})}),t]}));Fne.displayName=wI.displayName;var Ine=_.forwardRef(({className:e,inset:t,...n},r)=>(0,B.jsx)(xI,{ref:r,className:K(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));Ine.displayName=xI.displayName;var Lne=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(EI,{ref:n,className:K(`-mx-1 my-1 h-px bg-muted`,e),...t}));Lne.displayName=EI.displayName;var Rne=({className:e,...t})=>(0,B.jsx)(`span`,{className:K(`ml-auto text-xs tracking-widest opacity-60`,e),...t});Rne.displayName=`DropdownMenuShortcut`;var jI=`lelab.recording.muted`,MI=null,zne=()=>(MI||=new AudioContext,MI),NI=()=>localStorage.getItem(jI)===`1`,Bne=e=>{localStorage.setItem(jI,e?`1`:`0`)},PI=(e,t,n=0)=>{if(NI())return;let r=zne(),i=r.createOscillator(),a=r.createGain();i.frequency.value=e,i.type=`sine`,a.gain.value=0,i.connect(a),a.connect(r.destination);let o=r.currentTime+n/1e3,s=o+t/1e3;a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(.2,o+.01),a.gain.setValueAtTime(.2,s-.02),a.gain.linearRampToValueAtTime(0,s),i.start(o),i.stop(s)},Vne=()=>{PI(660,80,0),PI(880,80,90)},Hne=()=>{PI(660,80,0),PI(440,80,90)},Une=()=>{PI(880,70,0),PI(880,70,1e3),PI(880,70,2e3)},Wne=Symbol(`radix.slottable`);function Gne(e){let t=({children:e})=>(0,B.jsx)(B.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=Wne,t}var FI=`AlertDialog`,[Kne,qne]=aa(FI,[Sd]),II=Sd(),LI=e=>{let{__scopeAlertDialog:t,...n}=e,r=II(t);return(0,B.jsx)(ef,{...r,...n,modal:!0})};LI.displayName=FI;var Jne=`AlertDialogTrigger`,Yne=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=II(n);return(0,B.jsx)(tf,{...i,...r,ref:t})});Yne.displayName=Jne;var Xne=`AlertDialogPortal`,RI=e=>{let{__scopeAlertDialog:t,...n}=e,r=II(t);return(0,B.jsx)(nf,{...r,...n})};RI.displayName=Xne;var Zne=`AlertDialogOverlay`,zI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=II(n);return(0,B.jsx)(rf,{...i,...r,ref:t})});zI.displayName=Zne;var BI=`AlertDialogContent`,[Qne,$ne]=Kne(BI),ere=Gne(`AlertDialogContent`),VI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=II(n),o=_.useRef(null),s=ra(t,o),c=_.useRef(null);return(0,B.jsx)(Yd,{contentName:BI,titleName:HI,docsSlug:`alert-dialog`,children:(0,B.jsx)(Qne,{scope:n,cancelRef:c,children:(0,B.jsxs)(af,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:V(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,B.jsx)(ere,{children:r}),(0,B.jsx)(nre,{contentRef:o})]})})})});VI.displayName=BI;var HI=`AlertDialogTitle`,UI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=II(n);return(0,B.jsx)(of,{...i,...r,ref:t})});UI.displayName=HI;var WI=`AlertDialogDescription`,GI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=II(n);return(0,B.jsx)(sf,{...i,...r,ref:t})});GI.displayName=WI;var tre=`AlertDialogAction`,KI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=II(n);return(0,B.jsx)(cf,{...i,...r,ref:t})});KI.displayName=tre;var qI=`AlertDialogCancel`,JI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=$ne(qI,n),a=II(n),o=ra(t,i);return(0,B.jsx)(cf,{...a,...r,ref:o})});JI.displayName=qI;var nre=({contentRef:e})=>{let t=`\`${BI}\` requires a description for the component to be accessible for screen reader users. + `,title:`Find ${t||`robot`} port automatically`,children:[(0,B.jsx)(Hs,{className:`w-3 h-3 mr-1`}),`Find`]}),ON=2e3,kN=({open:e,onOpenChange:t,robotType:n,onPortDetected:r})=>{let[i,a]=(0,_.useState)(`detecting`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),u=(0,_.useRef)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),{toast:p}=ea(),{baseUrl:m,fetchWithHeaders:h}=wl(),g=async()=>{try{d.current=new AbortController;let e=await(await h(`${m}/start-port-detection`,{method:`POST`,body:JSON.stringify({robot_type:n}),signal:d.current.signal})).json();if(u.current)return;if(e.status!==`success`)throw Error(e.message||`Failed to start port detection`);let i=e.data.ports_before;for(;!u.current;){d.current=new AbortController;let e=await(await h(`${m}/detect-port-after-disconnect`,{method:`POST`,body:JSON.stringify({ports_before:i}),signal:d.current.signal})).json();if(u.current)return;if(e.status===`success`){if(s(e.port),await v(e.port),u.current)return;a(`success`),p({title:`Port Detected Successfully`,description:`${n} port detected: ${e.port}`}),f.current=window.setTimeout(()=>{u.current||(r(e.port),t(!1))},ON);return}let o=typeof e.message==`string`?e.message:``;if(!o.includes(`Timed out`))throw Error(o||`Failed to detect port`)}}catch(e){if(u.current||e instanceof DOMException&&e.name===`AbortError`)return;console.error(`Port detection failed:`,e),l(e instanceof Error?e.message:`Unknown error`),a(`error`)}},v=async e=>{try{await h(`${m}/save-robot-port`,{method:`POST`,body:JSON.stringify({robot_type:n,port:e})})}catch(e){console.error(`Error saving port:`,e)}};(0,_.useEffect)(()=>{if(e)return u.current=!1,a(`detecting`),l(``),s(``),g(),()=>{u.current=!0,d.current?.abort(),f.current!==null&&(window.clearTimeout(f.current),f.current=null)}},[e]);let y=()=>{t(!1)},b=()=>{u.current=!1,d.current?.abort(),a(`detecting`),l(``),s(``),g()};return(0,B.jsx)($d,{open:e,onOpenChange:t,children:(0,B.jsxs)(nf,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[500px] p-8`,children:[(0,B.jsxs)(rf,{children:[(0,B.jsx)(of,{className:`text-white text-center text-xl font-bold`,children:`Port Detection`}),(0,B.jsxs)(sf,{className:`text-gray-400 text-center`,children:[`Detect the USB port for your `,n,` arm`]})]}),(0,B.jsx)(`div`,{className:`py-4`,children:(()=>{switch(i){case`detecting`:return(0,B.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,B.jsx)(Ns,{className:`w-16 h-16 text-blue-500 mx-auto animate-spin`}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`h3`,{className:`text-lg font-semibold text-white`,children:[`Unplug the `,n,` arm`]}),(0,B.jsxs)(`p`,{className:`text-gray-400`,children:[`Disconnect the `,n,` robot arm from USB. The port will be detected automatically.`]})]}),(0,B.jsx)(`div`,{className:`flex justify-center`,children:(0,B.jsx)(q,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})})]});case`success`:return(0,B.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,B.jsx)(gs,{className:`w-16 h-16 text-green-500 mx-auto`}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Port Detected`}),(0,B.jsx)(`p`,{className:`text-xl font-mono text-green-400 bg-gray-800 px-4 py-2 rounded inline-block`,children:o})]})]});case`error`:return(0,B.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,B.jsx)(hs,{className:`w-16 h-16 text-red-500 mx-auto`}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Detection Failed`}),(0,B.jsx)(`div`,{className:`bg-red-900/20 border border-red-800 rounded-lg p-3`,children:(0,B.jsx)(`p`,{className:`text-red-400 text-sm`,children:c})})]}),(0,B.jsxs)(`div`,{className:`flex gap-4 justify-center`,children:[(0,B.jsx)(q,{onClick:b,className:`bg-blue-500 hover:bg-blue-600 text-white px-8 py-2`,children:`Try Again`}),(0,B.jsx)(q,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})]})]});default:return null}})()})]})})},AN={teleop:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1150},robot:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1400}},jN=.98;function MN(e,t,n){if(!e)return!1;let r=AN[e]?.[t];return r?n>=r*jN:!1}var NN=`Motor discontinuity detected`,PN=()=>{let e=ht(),t=ft().state?.robot_name??null,{toast:n}=ea(),{baseUrl:r,fetchWithHeaders:i}=wl();(0,_.useRef)(null);let a=(0,_.useRef)(null),[o,s]=(0,_.useState)(`teleop`),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)([]),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null),v=(0,_.useCallback)(async()=>{if(!t)return null;try{let e=await i(`${r}/robots/${encodeURIComponent(t)}`);if(!e.ok)return null;let n=(await e.json()).robot??null;return d(n),n}catch(e){return console.error(`Failed to load robot record:`,e),null}},[t,r,i]);(0,_.useEffect)(()=>{if(!t)return;let e=!1;return(async()=>{let t=await v();if(!t||e)return;let n=t.leader_config?t.follower_config?`teleop`:`robot`:`teleop`;s(n),l(n===`teleop`?t.leader_port||``:t.follower_port||``),p(t.cameras??[])})(),()=>{e=!0}},[t,v]);let y=e=>{p(e),t&&(g.current&&clearTimeout(g.current),g.current=setTimeout(async()=>{try{await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cameras:e})})}catch(e){console.error(`Failed to save cameras to robot record:`,e)}},500))};(0,_.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(`leader`),[w,T]=(0,_.useState)({calibration_active:!1,status:`idle`,device_type:null,error:null,message:``,step:0,total_steps:1,current_positions:null,recorded_ranges:null}),[E,D]=(0,_.useState)(!1),O=(0,_.useRef)(!1);(0,_.useEffect)(()=>{O.current=w.calibration_active},[w.calibration_active]),(0,_.useEffect)(()=>()=>{O.current&&i(`${r}/stop-calibration`,{method:`POST`}).catch(e=>console.error(`Failed to stop calibration on unmount:`,e))},[r,i]);let k=async()=>{try{let e=await i(`${r}/calibration-status`);if(e.ok){let t=await e.json();T(t),!t.calibration_active&&(t.status===`completed`||t.status===`error`||t.status===`idle`)&&D(!1)}}catch(e){console.error(`Error polling status:`,e)}},A=async()=>{if(!t){n({title:`No robot selected`,description:`Open Calibration from a robot's gear icon on the Landing page.`,variant:`destructive`});return}if(!c){n({title:`Missing port`,description:`Set the device's serial port before starting.`,variant:`destructive`});return}let e={device_type:o,port:c,config_file:t,robot_name:t};O.current=!0;try{let t=await(await i(`${r}/start-calibration`,{method:`POST`,body:JSON.stringify(e)})).json();t.success?(n({title:`Calibration Started`,description:`Calibration started for ${o}`}),D(!0)):(O.current=!1,n({title:`Calibration Failed`,description:t.message||`Failed to start calibration`,variant:`destructive`}))}catch(e){O.current=!1,console.error(`Error starting calibration:`,e),n({title:`Error`,description:`Failed to start calibration`,variant:`destructive`})}},j=async()=>{try{let e=await(await i(`${r}/stop-calibration`,{method:`POST`})).json();e.success?n({title:`Calibration Stopped`,description:`Calibration has been stopped`}):n({title:`Error`,description:e.message||`Failed to stop calibration`,variant:`destructive`})}catch(e){console.error(`Error stopping calibration:`,e),n({title:`Error`,description:`Failed to stop calibration`,variant:`destructive`})}},M=async()=>{if(w.calibration_active)try{let e=await(await i(`${r}/complete-calibration-step`,{method:`POST`})).json();e.success?n({title:`Step Completed`,description:e.message}):n({title:`Step Failed`,description:e.message||`Could not complete step`,variant:`destructive`})}catch(e){console.error(`Error completing step:`,e),n({title:`Error`,description:`Could not complete calibration step`,variant:`destructive`})}};(0,_.useEffect)(()=>{w.status===`error`&&w.error?.startsWith(NN)&&a.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[w.status,w.error]),(0,_.useEffect)(()=>{if(!E)return;k();let e=setInterval(()=>{k()},200);return()=>clearInterval(e)},[E]),(0,_.useEffect)(()=>{(async()=>{if(o&&!t)try{let e=await(await i(`${r}/robot-port/${o===`robot`?`follower`:`leader`}`)).json();if(e.status===`success`){let t=e.saved_port||e.default_port;t&&l(t)}}catch(e){console.error(`Error loading default port:`,e)}})()},[o,t,r,i]);let N=e=>{s(e),u&&l(e===`teleop`?u.leader_port||``:u.follower_port||``)};(0,_.useEffect)(()=>{w.status===`completed`&&(async()=>{let e=await v();if(!e)return;let t=e.leader_config?e.follower_config?`teleop`:`robot`:`teleop`;s(t),l(t===`teleop`?e.leader_port||``:e.follower_port||``)})()},[w.status,v]);let P=()=>{C(o===`robot`?`follower`:`leader`),x(!0)},F=(0,_.useCallback)(async e=>{if(!t||!e)return;let n=o===`robot`?`follower_port`:`leader_port`;if(!(u&&u[n]===e))try{let a=await(await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({[n]:e})})).json();a.robot&&d(a.robot)}catch(e){console.error(`Failed to save port to robot record:`,e)}},[t,o,u,r,i]),ee=e=>{l(e),F(e)},te=(()=>{switch(w.status){case`idle`:return{color:`bg-slate-500`,icon:(0,B.jsx)(Us,{className:`w-4 h-4`}),text:`Idle`};case`connecting`:return{color:`bg-yellow-500`,icon:(0,B.jsx)(Ns,{className:`w-4 h-4 animate-spin`}),text:`Connecting`};case`recording`:return{color:`bg-purple-500`,icon:(0,B.jsx)(as,{className:`w-4 h-4`}),text:`Recording Ranges`};case`completed`:return{color:`bg-green-500`,icon:(0,B.jsx)(gs,{className:`w-4 h-4`}),text:`Completed`};case`error`:return{color:`bg-red-500`,icon:(0,B.jsx)(ys,{className:`w-4 h-4`}),text:`Error`};case`stopping`:return{color:`bg-orange-500`,icon:(0,B.jsx)(Js,{className:`w-4 h-4`}),text:`Stopping`};default:return{color:`bg-slate-500`,icon:(0,B.jsx)(Us,{className:`w-4 h-4`}),text:`Unknown`}}})();return(0,B.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,B.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4 mb-6`,children:[(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>e(-1),className:`text-slate-400 hover:text-white hover:bg-slate-800`,children:(0,B.jsx)(os,{className:`w-5 h-5`})}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)($M,{iconOnly:!0}),(0,B.jsx)(`h1`,{className:`text-3xl font-bold`,children:t?`Calibrate "${t}"`:`Device Calibration`})]})]}),!t&&(0,B.jsxs)(Q_,{className:`mb-6 bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,B.jsx)(hs,{className:`h-4 w-4`}),(0,B.jsx)(ev,{children:`Open Calibration from a robot's gear icon on the Landing page. Each robot has its own calibration; running this page directly is not supported.`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,B.jsxs)(cb,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,B.jsx)(lb,{children:(0,B.jsxs)(ub,{className:`flex items-center gap-2 text-slate-200`,children:[(0,B.jsx)(Us,{className:`w-5 h-5 text-blue-400`}),`Configuration`]})}),(0,B.jsxs)(fb,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`deviceType`,className:`text-sm font-medium text-slate-300`,children:`Device Type *`}),(0,B.jsxs)(Iy,{value:o,onValueChange:N,children:[(0,B.jsx)(Ry,{className:`bg-slate-700 border-slate-600 text-white rounded-md`,children:(0,B.jsx)(Ly,{placeholder:`Select device type`})}),(0,B.jsxs)(Vy,{className:`bg-slate-800 border-slate-700 text-white`,children:[(0,B.jsx)(Uy,{value:`teleop`,className:`hover:bg-slate-700`,children:`Teleoperator (Leader)`}),(0,B.jsx)(Uy,{value:`robot`,className:`hover:bg-slate-700`,children:`Robot (Follower)`})]})]})]}),(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(J,{htmlFor:`port`,className:`text-sm font-medium text-slate-300`,children:`Port *`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(b_,{id:`port`,value:c,onChange:e=>l(e.target.value),onBlur:e=>F(e.target.value),placeholder:`/dev/tty.usbmodem...`,className:`bg-slate-700 border-slate-600 text-white rounded-md flex-1`}),(0,B.jsx)(DN,{onClick:P,robotType:o===`robot`?`follower`:`leader`,className:`border-slate-600 hover:border-blue-500 text-slate-400 hover:text-blue-400 bg-slate-700 hover:bg-slate-600`})]})]}),(0,B.jsx)(EN,{className:`bg-slate-700`}),(0,B.jsx)(`div`,{className:`flex flex-col gap-3`,children:w.calibration_active?(0,B.jsxs)(q,{onClick:j,variant:`destructive`,className:`w-full rounded-full py-6 text-lg`,children:[(0,B.jsx)(Js,{className:`w-5 h-5 mr-2`}),`Cancel Calibration`]}):(0,B.jsxs)(q,{onClick:A,className:`w-full bg-blue-600 hover:bg-blue-700 text-white rounded-full py-6 text-lg`,disabled:!t||!o||!c,"data-tour":`calibration-start`,children:[(0,B.jsx)(Ls,{className:`w-5 h-5 mr-2`}),`Start Calibration`]})}),u&&(0,B.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,B.jsx)(`div`,{className:`text-sm font-medium text-slate-300`,children:`Robot calibration`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.leader_config?(0,B.jsx)(gs,{className:`w-4 h-4 text-green-400`}):(0,B.jsx)(bs,{className:`w-4 h-4 text-slate-500`}),(0,B.jsx)(`span`,{className:u.leader_config?`text-slate-200`:`text-slate-400`,children:`Leader (Teleoperator)`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.follower_config?(0,B.jsx)(gs,{className:`w-4 h-4 text-green-400`}):(0,B.jsx)(bs,{className:`w-4 h-4 text-slate-500`}),(0,B.jsx)(`span`,{className:u.follower_config?`text-slate-200`:`text-slate-400`,children:`Follower (Robot)`})]})]})]})]}),(0,B.jsxs)(cb,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,B.jsx)(lb,{children:(0,B.jsxs)(ub,{className:`flex items-center gap-2 text-slate-200`,children:[(0,B.jsx)(as,{className:`w-5 h-5 text-teal-400`}),`Status`]})}),(0,B.jsxs)(fb,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-slate-900/50 rounded-md`,children:[(0,B.jsx)(`span`,{className:`text-slate-300`,children:`Status:`}),(0,B.jsxs)(vN,{className:`${te.color} text-white rounded-md`,children:[te.icon,(0,B.jsx)(`span`,{className:`ml-2`,children:te.text})]})]}),w.status===`recording`&&w.recorded_ranges&&(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(as,{className:`w-4 h-4 text-purple-400`}),(0,B.jsx)(`span`,{className:`text-sm font-medium text-slate-300`,children:`Live Position Data`})]}),(0,B.jsx)(`div`,{className:`bg-slate-800 rounded-lg p-4 border border-slate-700`,children:(0,B.jsx)(`div`,{className:`space-y-3`,children:Object.entries(w.recorded_ranges).map(([e,t])=>{let n=t.max-t.min,r=t.current-t.min,i=n>0?r/n*100:50,a=MN(w.device_type,e,n);return(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-white font-semibold text-sm`,children:e}),a&&(0,B.jsx)(gs,{className:`w-4 h-4 text-green-400`,"aria-label":`Range complete`})]}),(0,B.jsx)(`span`,{className:`text-slate-300 text-xs font-mono`,children:t.current})]}),(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(`div`,{className:`w-full bg-slate-700 rounded-full h-3`,children:(0,B.jsx)(`div`,{className:`bg-slate-600 h-3 rounded-full relative`,style:{width:`100%`},children:(0,B.jsx)(`div`,{className:`absolute top-0 w-1 h-3 rounded-full transition-all duration-100 ${a?`bg-green-400`:`bg-yellow-400`}`,style:{left:`${Math.max(0,Math.min(100,i))}%`,transform:`translateX(-50%)`}})})}),(0,B.jsxs)(`div`,{className:`flex justify-between text-xs text-slate-400 mt-1`,children:[(0,B.jsx)(`span`,{children:t.min}),(0,B.jsx)(`span`,{children:t.max})]})]})]},e)})})})]}),w.status===`connecting`&&(0,B.jsxs)(Q_,{className:`bg-yellow-900/50 border-yellow-700 text-yellow-200`,children:[(0,B.jsx)(hs,{className:`h-4 w-4`}),(0,B.jsx)(ev,{children:`Connecting to the device. Please ensure it's connected.`})]}),w.status===`recording`&&(()=>{let e=w.recorded_ranges??{},t=Object.entries(e),n=t.length>0&&t.every(([e,t])=>MN(w.device_type,e,t.max-t.min));return(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(`div`,{className:`flex justify-center`,children:(0,B.jsxs)(q,{onClick:M,disabled:!w.calibration_active,className:`px-8 py-3 rounded-full transition-colors ${n?`bg-green-600 hover:bg-green-700`:`bg-orange-500 hover:bg-orange-600`}`,children:[n?(0,B.jsx)(gs,{className:`w-4 h-4 mr-2`}):(0,B.jsx)(hs,{className:`w-4 h-4 mr-2`}),`Save Calibration`]})}),(0,B.jsxs)(Q_,{className:`bg-purple-900/50 border-purple-700 text-purple-200`,children:[(0,B.jsx)(as,{className:`h-4 w-4`}),(0,B.jsxs)(ev,{children:[(0,B.jsx)(`strong`,{children:`Important:`}),` Move EACH joint through its full range. A check appears next to each joint once its range is wide enough.`]})]})]})})(),w.status===`completed`&&(0,B.jsxs)(Q_,{className:`bg-green-900/50 border-green-700 text-green-200`,children:[(0,B.jsx)(gs,{className:`h-4 w-4`}),(0,B.jsx)(ev,{children:`Calibration completed successfully!`})]}),w.status===`error`&&w.error&&(w.error.startsWith(NN)?(0,B.jsxs)(Q_,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,B.jsx)(ys,{className:`h-4 w-4`}),(0,B.jsxs)(ev,{children:[(0,B.jsx)(`div`,{className:`font-semibold text-base mb-1`,children:`Motor discontinuity detected`}),(0,B.jsx)(`div`,{children:`Make sure to start the calibration with the robot in a middle position — all joints in the middle of their ranges. See the calibration demo below for the correct starting pose.`})]})]}):(0,B.jsxs)(Q_,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,B.jsx)(ys,{className:`h-4 w-4`}),(0,B.jsxs)(ev,{children:[(0,B.jsx)(`strong`,{children:`Error:`}),` `,w.error]})]})),(0,B.jsxs)(`div`,{ref:a,className:`bg-slate-900/50 p-4 rounded-lg border border-slate-700`,children:[(0,B.jsx)(`h4`,{className:`font-semibold mb-3 text-slate-200`,children:`Calibration Demo:`}),(0,B.jsx)(`div`,{className:`relative rounded-lg overflow-hidden bg-slate-800`,children:(0,B.jsxs)(`video`,{className:`w-full h-auto rounded-md`,controls:!0,preload:`auto`,muted:!0,children:[(0,B.jsx)(`source`,{src:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,type:`video/mp4`}),(0,B.jsxs)(`p`,{className:`text-slate-400 text-sm text-center py-4`,children:[`Your browser does not support the video tag.`,(0,B.jsx)(`br`,{}),(0,B.jsx)(`a`,{href:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,className:`text-blue-400 hover:text-blue-300 underline`,target:`_blank`,rel:`noopener noreferrer`,children:`Click here to view the calibration video`})]})]})})]})]})]})]}),t&&(0,B.jsxs)(cb,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm mt-6`,"data-tour":`calibration-cameras`,children:[(0,B.jsxs)(lb,{className:`flex-row items-center justify-between space-y-0`,children:[(0,B.jsxs)(ub,{className:`flex items-center gap-2 text-slate-200`,children:[(0,B.jsx)(Us,{className:`w-5 h-5 text-blue-400`}),`Attached cameras`]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(J,{htmlFor:`cameras-toggle`,className:`text-sm text-slate-400 cursor-pointer`,children:m?`On`:`Off`}),(0,B.jsx)(pN,{id:`cameras-toggle`,checked:m,onCheckedChange:h,className:`data-[state=checked]:bg-green-500`,"aria-label":`Turn cameras on or off`})]})]}),(0,B.jsx)(fb,{children:m?(0,B.jsx)(tb,{cameras:f,onCamerasChange:y}):(0,B.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-900/40 p-6 text-center space-y-3`,children:[(0,B.jsx)(cs,{className:`w-10 h-10 mx-auto text-slate-500`}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`p`,{className:`text-slate-200 font-medium`,children:`Cameras are off`}),(0,B.jsx)(`p`,{className:`text-sm text-slate-400 max-w-md mx-auto`,children:`Turn cameras on to scan for connected devices and preview them. The browser may briefly open a camera to read device labels, and configured cameras stay active while previews are visible; your browser will ask for camera permission. Nothing is recorded.`}),f.length>0&&(0,B.jsxs)(`p`,{className:`text-xs text-slate-500 pt-1`,children:[f.length,` camera`,f.length===1?``:`s`,` saved to this robot.`]})]}),(0,B.jsxs)(`p`,{className:`flex items-center justify-center gap-1.5 text-xs text-slate-500`,children:[(0,B.jsx)(Ws,{className:`w-3.5 h-3.5`}),`You'll be asked to grant camera access.`]})]})})]})]}),(0,B.jsx)(kN,{open:b,onOpenChange:x,robotType:S,onPortDetected:ee})]})},FN=`rovingFocusGroup.onEntryFocus`,IN={bubbles:!1,cancelable:!0},LN=`RovingFocusGroup`,[RN,zN,BN]=pa(LN),[VN,HN]=aa(LN,[BN]),[UN,WN]=VN(LN),GN=_.forwardRef((e,t)=>(0,B.jsx)(RN.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(RN.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(KN,{...e,ref:t})})}));GN.displayName=LN;var KN=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=_.useRef(null),p=ra(t,f),m=rv(a),[h,g]=qa({prop:o,defaultProp:s??null,onChange:c,caller:LN}),[v,y]=_.useState(!1),b=xa(l),x=zN(n),S=_.useRef(!1),[C,w]=_.useState(0);return _.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(FN,b),()=>e.removeEventListener(FN,b)},[b]),(0,B.jsx)(UN,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:_.useCallback(e=>g(e),[g]),onItemShiftTab:_.useCallback(()=>y(!0),[]),onFocusableItemAdd:_.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>w(e=>e-1),[]),children:(0,B.jsx)(H.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:V(e.onMouseDown,()=>{S.current=!0}),onFocus:V(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(FN,IN);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);QN([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:V(e.onBlur,()=>y(!1))})})}),qN=`RovingFocusGroupItem`,JN=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Al(),l=a||c,u=WN(qN,n),d=u.currentTabStopId===l,f=zN(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return _.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,B.jsx)(RN.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,B.jsx)(H.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:V(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:V(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:V(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ZN(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?$N(n,r+1):n.slice(r+1)}setTimeout(()=>QN(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});JN.displayName=qN;var YN={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function XN(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function ZN(e,t,n){let r=XN(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return YN[r]}function QN(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function $N(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var eP=GN,tP=JN;function nP(e){let t=rP(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(aP);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function rP(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=sP(n),i=oP(r,n.props);return n.type!==_.Fragment&&(i.ref=t?na(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var iP=Symbol(`radix.slottable`);function aP(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===iP}function oP(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function sP(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var cP=[`Enter`,` `],lP=[`ArrowDown`,`PageUp`,`Home`],uP=[`ArrowUp`,`PageDown`,`End`],dP=[...lP,...uP],fP={ltr:[...cP,`ArrowRight`],rtl:[...cP,`ArrowLeft`]},pP={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},mP=`Menu`,[hP,gP,_P]=pa(mP),[vP,yP]=aa(mP,[_P,Pm,HN]),bP=Pm(),xP=HN(),[SP,CP]=vP(mP),[wP,TP]=vP(mP),EP=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=bP(t),[c,l]=_.useState(null),u=_.useRef(!1),d=xa(a),f=rv(i);return _.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,B.jsx)(Wm,{...s,children:(0,B.jsx)(SP,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,B.jsx)(wP,{scope:t,onClose:_.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};EP.displayName=mP;var DP=`MenuAnchor`,OP=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=bP(n);return(0,B.jsx)(Gm,{...i,...r,ref:t})});OP.displayName=DP;var kP=`MenuPortal`,[AP,jP]=vP(kP,{forceMount:void 0}),MP=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=CP(kP,t);return(0,B.jsx)(AP,{scope:t,forceMount:n,children:(0,B.jsx)(Ha,{present:n||a.open,children:(0,B.jsx)(Ba,{asChild:!0,container:i,children:r})})})};MP.displayName=kP;var NP=`MenuContent`,[PP,FP]=vP(NP),IP=_.forwardRef((e,t)=>{let n=jP(NP,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=CP(NP,e.__scopeMenu),o=TP(NP,e.__scopeMenu);return(0,B.jsx)(hP.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(Ha,{present:r||a.open,children:(0,B.jsx)(hP.Slot,{scope:e.__scopeMenu,children:o.modal?(0,B.jsx)(LP,{...i,ref:t}):(0,B.jsx)(RP,{...i,ref:t})})})})}),LP=_.forwardRef((e,t)=>{let n=CP(NP,e.__scopeMenu),r=_.useRef(null),i=ra(t,r);return _.useEffect(()=>{let e=r.current;if(e)return fd(e)},[]),(0,B.jsx)(BP,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),RP=_.forwardRef((e,t)=>{let n=CP(NP,e.__scopeMenu);return(0,B.jsx)(BP,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),zP=nP(`MenuContent.ScrollLock`),BP=_.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=CP(NP,n),v=TP(NP,n),y=bP(n),b=xP(n),x=gP(n),[S,C]=_.useState(null),w=_.useRef(null),T=ra(t,w,g.onContentChange),E=_.useRef(0),D=_.useRef(``),O=_.useRef(0),k=_.useRef(null),A=_.useRef(`right`),j=_.useRef(0),M=m?id:_.Fragment,N=m?{as:zP,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=wF(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};_.useEffect(()=>()=>window.clearTimeout(E.current),[]),Jl();let F=_.useCallback(e=>A.current===k.current?.side&&EF(e,k.current?.area),[]);return(0,B.jsx)(PP,{scope:n,searchRef:D,onItemEnter:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:_.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:_.useCallback(e=>{k.current=e},[]),children:(0,B.jsx)(M,{...N,children:(0,B.jsx)(Fl,{asChild:!0,trapped:i,onMountAutoFocus:V(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,B.jsx)(ka,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,B.jsx)(eP,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:V(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,B.jsx)(Km,{role:`menu`,"aria-orientation":`vertical`,"data-state":yF(g.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:V(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!dP.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);uP.includes(e.key)&&a.reverse(),SF(a)}),onBlur:V(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:V(e.onPointerMove,DF(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});IP.displayName=NP;var VP=`MenuGroup`,HP=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(H.div,{role:`group`,...r,ref:t})});HP.displayName=VP;var UP=`MenuLabel`,WP=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(H.div,{...r,ref:t})});WP.displayName=UP;var GP=`MenuItem`,KP=`menu.itemSelect`,qP=_.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=_.useRef(null),o=TP(GP,e.__scopeMenu),s=FP(GP,e.__scopeMenu),c=ra(t,a),l=_.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(KP,{bubbles:!0,cancelable:!0});e.addEventListener(KP,e=>r?.(e),{once:!0}),ba(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,B.jsx)(JP,{...i,ref:c,disabled:n,onClick:V(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:V(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:V(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||cP.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});qP.displayName=GP;var JP=_.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=FP(GP,n),s=xP(n),c=_.useRef(null),l=ra(t,c),[u,d]=_.useState(!1),[f,p]=_.useState(``);return _.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,B.jsx)(hP.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,B.jsx)(tP,{asChild:!0,...s,focusable:!r,children:(0,B.jsx)(H.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:V(e.onPointerMove,DF(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:V(e.onPointerLeave,DF(e=>o.onItemLeave(e))),onFocus:V(e.onFocus,()=>d(!0)),onBlur:V(e.onBlur,()=>d(!1))})})})}),YP=`MenuCheckboxItem`,XP=_.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,B.jsx)(iF,{scope:e.__scopeMenu,checked:n,children:(0,B.jsx)(qP,{role:`menuitemcheckbox`,"aria-checked":bF(n)?`mixed`:n,...i,ref:t,"data-state":xF(n),onSelect:V(i.onSelect,()=>r?.(bF(n)?!0:!n),{checkForDefaultPrevented:!1})})})});XP.displayName=YP;var ZP=`MenuRadioGroup`,[QP,$P]=vP(ZP,{value:void 0,onValueChange:()=>{}}),eF=_.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=xa(r);return(0,B.jsx)(QP,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,B.jsx)(HP,{...i,ref:t})})});eF.displayName=ZP;var tF=`MenuRadioItem`,nF=_.forwardRef((e,t)=>{let{value:n,...r}=e,i=$P(tF,e.__scopeMenu),a=n===i.value;return(0,B.jsx)(iF,{scope:e.__scopeMenu,checked:a,children:(0,B.jsx)(qP,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":xF(a),onSelect:V(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});nF.displayName=tF;var rF=`MenuItemIndicator`,[iF,aF]=vP(rF,{checked:!1}),oF=_.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=aF(rF,n);return(0,B.jsx)(Ha,{present:r||bF(a.checked)||a.checked===!0,children:(0,B.jsx)(H.span,{...i,ref:t,"data-state":xF(a.checked)})})});oF.displayName=rF;var sF=`MenuSeparator`,cF=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(H.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});cF.displayName=sF;var lF=`MenuArrow`,uF=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=bP(n);return(0,B.jsx)(qm,{...i,...r,ref:t})});uF.displayName=lF;var dF=`MenuSub`,[fF,pF]=vP(dF),mF=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=CP(dF,t),o=bP(t),[s,c]=_.useState(null),[l,u]=_.useState(null),d=xa(i);return _.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,B.jsx)(Wm,{...o,children:(0,B.jsx)(SP,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,B.jsx)(fF,{scope:t,contentId:Al(),triggerId:Al(),trigger:s,onTriggerChange:c,children:n})})})};mF.displayName=dF;var hF=`MenuSubTrigger`,gF=_.forwardRef((e,t)=>{let n=CP(hF,e.__scopeMenu),r=TP(hF,e.__scopeMenu),i=pF(hF,e.__scopeMenu),a=FP(hF,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>u,[u]),_.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,B.jsx)(OP,{asChild:!0,...l,children:(0,B.jsx)(JP,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":yF(n.open),...e,ref:na(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:V(e.onPointerMove,DF(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:V(e.onPointerLeave,DF(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:V(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||fP[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});gF.displayName=hF;var _F=`MenuSubContent`,vF=_.forwardRef((e,t)=>{let n=jP(NP,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=CP(NP,e.__scopeMenu),o=TP(NP,e.__scopeMenu),s=pF(_F,e.__scopeMenu),c=_.useRef(null),l=ra(t,c);return(0,B.jsx)(hP.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(Ha,{present:r||a.open,children:(0,B.jsx)(hP.Slot,{scope:e.__scopeMenu,children:(0,B.jsx)(BP,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:V(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:V(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:V(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=pP[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});vF.displayName=_F;function yF(e){return e?`open`:`closed`}function bF(e){return e===`indeterminate`}function xF(e){return bF(e)?`indeterminate`:e?`checked`:`unchecked`}function SF(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function CF(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function wF(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=CF(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function TF(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function EF(e,t){return t?TF({x:e.clientX,y:e.clientY},t):!1}function DF(e){return t=>t.pointerType===`mouse`?e(t):void 0}var OF=EP,kF=OP,AF=MP,jF=IP,MF=HP,NF=WP,PF=qP,FF=XP,IF=eF,LF=nF,RF=oF,zF=cF,BF=uF,VF=gF,HF=vF,UF=`DropdownMenu`,[WF,Ene]=aa(UF,[yP]),GF=yP(),[KF,qF]=WF(UF),JF=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=GF(t),l=_.useRef(null),[u,d]=qa({prop:i,defaultProp:a??!1,onChange:o,caller:UF});return(0,B.jsx)(KF,{scope:t,triggerId:Al(),triggerRef:l,contentId:Al(),open:u,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,B.jsx)(OF,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};JF.displayName=UF;var YF=`DropdownMenuTrigger`,XF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=qF(YF,n),o=GF(n);return(0,B.jsx)(kF,{asChild:!0,...o,children:(0,B.jsx)(H.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:na(t,a.triggerRef),onPointerDown:V(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:V(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});XF.displayName=YF;var ZF=`DropdownMenuPortal`,QF=e=>{let{__scopeDropdownMenu:t,...n}=e,r=GF(t);return(0,B.jsx)(AF,{...r,...n})};QF.displayName=ZF;var $F=`DropdownMenuContent`,eI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qF($F,n),a=GF(n),o=_.useRef(!1);return(0,B.jsx)(jF,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:V(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});eI.displayName=$F;var tI=`DropdownMenuGroup`,nI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(MF,{...i,...r,ref:t})});nI.displayName=tI;var rI=`DropdownMenuLabel`,iI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(NF,{...i,...r,ref:t})});iI.displayName=rI;var aI=`DropdownMenuItem`,oI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(PF,{...i,...r,ref:t})});oI.displayName=aI;var sI=`DropdownMenuCheckboxItem`,cI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(FF,{...i,...r,ref:t})});cI.displayName=sI;var lI=`DropdownMenuRadioGroup`,uI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(IF,{...i,...r,ref:t})});uI.displayName=lI;var dI=`DropdownMenuRadioItem`,fI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(LF,{...i,...r,ref:t})});fI.displayName=dI;var pI=`DropdownMenuItemIndicator`,mI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(RF,{...i,...r,ref:t})});mI.displayName=pI;var hI=`DropdownMenuSeparator`,gI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(zF,{...i,...r,ref:t})});gI.displayName=hI;var Dne=`DropdownMenuArrow`,One=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(BF,{...i,...r,ref:t})});One.displayName=Dne;var kne=`DropdownMenuSubTrigger`,_I=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(VF,{...i,...r,ref:t})});_I.displayName=kne;var Ane=`DropdownMenuSubContent`,vI=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=GF(n);return(0,B.jsx)(HF,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});vI.displayName=Ane;var jne=JF,Mne=XF,Nne=QF,yI=eI,bI=iI,xI=oI,SI=cI,CI=fI,wI=mI,TI=gI,EI=_I,DI=vI,Pne=jne,Fne=Mne,Ine=_.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,B.jsxs)(EI,{ref:i,className:K(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent`,t&&`pl-8`,e),...r,children:[n,(0,B.jsx)(fs,{className:`ml-auto h-4 w-4`})]}));Ine.displayName=EI.displayName;var Lne=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(DI,{ref:n,className:K(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));Lne.displayName=DI.displayName;var OI=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,B.jsx)(Nne,{children:(0,B.jsx)(yI,{ref:r,sideOffset:t,className:K(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));OI.displayName=yI.displayName;var kI=_.forwardRef(({className:e,inset:t,...n},r)=>(0,B.jsx)(xI,{ref:r,className:K(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));kI.displayName=xI.displayName;var Rne=_.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,B.jsxs)(SI,{ref:i,className:K(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(wI,{children:(0,B.jsx)(ls,{className:`h-4 w-4`})})}),t]}));Rne.displayName=SI.displayName;var zne=_.forwardRef(({className:e,children:t,...n},r)=>(0,B.jsxs)(CI,{ref:r,className:K(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(wI,{children:(0,B.jsx)(bs,{className:`h-2 w-2 fill-current`})})}),t]}));zne.displayName=CI.displayName;var Bne=_.forwardRef(({className:e,inset:t,...n},r)=>(0,B.jsx)(bI,{ref:r,className:K(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));Bne.displayName=bI.displayName;var Vne=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(TI,{ref:n,className:K(`-mx-1 my-1 h-px bg-muted`,e),...t}));Vne.displayName=TI.displayName;var Hne=({className:e,...t})=>(0,B.jsx)(`span`,{className:K(`ml-auto text-xs tracking-widest opacity-60`,e),...t});Hne.displayName=`DropdownMenuShortcut`;var AI=`lelab.recording.muted`,jI=null,Une=()=>(jI||=new AudioContext,jI),MI=()=>localStorage.getItem(AI)===`1`,Wne=e=>{localStorage.setItem(AI,e?`1`:`0`)},NI=(e,t,n=0)=>{if(MI())return;let r=Une(),i=r.createOscillator(),a=r.createGain();i.frequency.value=e,i.type=`sine`,a.gain.value=0,i.connect(a),a.connect(r.destination);let o=r.currentTime+n/1e3,s=o+t/1e3;a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(.2,o+.01),a.gain.setValueAtTime(.2,s-.02),a.gain.linearRampToValueAtTime(0,s),i.start(o),i.stop(s)},Gne=()=>{NI(660,80,0),NI(880,80,90)},Kne=()=>{NI(660,80,0),NI(440,80,90)},qne=()=>{NI(880,70,0),NI(880,70,1e3),NI(880,70,2e3)},Jne=Symbol(`radix.slottable`);function Yne(e){let t=({children:e})=>(0,B.jsx)(B.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=Jne,t}var PI=`AlertDialog`,[Xne,Zne]=aa(PI,[hd]),FI=hd(),II=e=>{let{__scopeAlertDialog:t,...n}=e,r=FI(t);return(0,B.jsx)(Gd,{...r,...n,modal:!0})};II.displayName=PI;var Qne=`AlertDialogTrigger`,$ne=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=FI(n);return(0,B.jsx)(Kd,{...i,...r,ref:t})});$ne.displayName=Qne;var ere=`AlertDialogPortal`,LI=e=>{let{__scopeAlertDialog:t,...n}=e,r=FI(t);return(0,B.jsx)(qd,{...r,...n})};LI.displayName=ere;var tre=`AlertDialogOverlay`,RI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=FI(n);return(0,B.jsx)(Jd,{...i,...r,ref:t})});RI.displayName=tre;var zI=`AlertDialogContent`,[nre,rre]=Xne(zI),ire=Yne(`AlertDialogContent`),BI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=FI(n),o=_.useRef(null),s=ra(t,o),c=_.useRef(null);return(0,B.jsx)(Bd,{contentName:zI,titleName:VI,docsSlug:`alert-dialog`,children:(0,B.jsx)(nre,{scope:n,cancelRef:c,children:(0,B.jsxs)(Yd,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:V(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,B.jsx)(ire,{children:r}),(0,B.jsx)(ore,{contentRef:o})]})})})});BI.displayName=zI;var VI=`AlertDialogTitle`,HI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=FI(n);return(0,B.jsx)(Xd,{...i,...r,ref:t})});HI.displayName=VI;var UI=`AlertDialogDescription`,WI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=FI(n);return(0,B.jsx)(Zd,{...i,...r,ref:t})});WI.displayName=UI;var are=`AlertDialogAction`,GI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=FI(n);return(0,B.jsx)(Qd,{...i,...r,ref:t})});GI.displayName=are;var KI=`AlertDialogCancel`,qI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=rre(KI,n),a=FI(n),o=ra(t,i);return(0,B.jsx)(Qd,{...a,...r,ref:o})});qI.displayName=KI;var ore=({contentRef:e})=>{let t=`\`${zI}\` requires a description for the component to be accessible for screen reader users. -You can add a description to the \`${BI}\` by passing a \`${WI}\` component as a child, which also benefits sighted users by adding visible context to the dialog. +You can add a description to the \`${zI}\` by passing a \`${UI}\` component as a child, which also benefits sighted users by adding visible context to the dialog. -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${BI}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. +Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${zI}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return _.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},rre=LI,ire=RI,YI=zI,XI=VI,ZI=KI,QI=JI,$I=UI,eL=GI,tL=rre,are=ire,nL=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(YI,{className:K(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));nL.displayName=YI.displayName;var rL=_.forwardRef(({className:e,...t},n)=>(0,B.jsxs)(are,{children:[(0,B.jsx)(nL,{}),(0,B.jsx)(XI,{ref:n,className:K(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));rL.displayName=XI.displayName;var iL=({className:e,...t})=>(0,B.jsx)(`div`,{className:K(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});iL.displayName=`AlertDialogHeader`;var aL=({className:e,...t})=>(0,B.jsx)(`div`,{className:K(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});aL.displayName=`AlertDialogFooter`;var oL=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)($I,{ref:n,className:K(`text-lg font-semibold`,e),...t}));oL.displayName=$I.displayName;var sL=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(eL,{ref:n,className:K(`text-sm text-muted-foreground`,e),...t}));sL.displayName=eL.displayName;var cL=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(ZI,{ref:n,className:K(_l(),e),...t}));cL.displayName=ZI.displayName;var lL=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(QI,{ref:n,className:K(_l({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));lL.displayName=QI.displayName;var ore=()=>{let e=ft(),t=ht(),{toast:n}=ea(),{baseUrl:r,wsBaseUrl:i,fetchWithHeaders:a}=wl(),o=e.state?.recordingConfig,[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(()=>NI()),v=(0,_.useRef)(null),[y,b]=(0,_.useState)(0),x=(0,_.useRef)({phase:null,episode:null,tick:0}),S=(0,_.useRef)(!1),C=(0,_.useMemo)(()=>{let e=o?.cameras,t=(Array.isArray(e)?e:e&&typeof e==`object`?Object.values(e):[])[0];return t?.width&&t?.height?t.width/t.height:4/3},[o]),[w,T]=(0,_.useState)({w:0,h:0}),E=(0,_.useRef)(null),D=(0,_.useCallback)(e=>{if(E.current?.disconnect(),E.current=null,e){let t=new ResizeObserver(e=>{let t=e[0].contentRect;T({w:t.width,h:t.height})});t.observe(e),E.current=t}},[]),O=s?.cameras?.length??0,k=(0,_.useMemo)(()=>{let{w:e,h:t}=w;if(!O||e<=0||t<=0)return{width:0,height:0};let n={width:0,height:0,area:-1};for(let r=1;r<=O;r++){let i=Math.ceil(O/r),a=(e-12*(r-1))/r,o=(t-12*(i-1))/i;if(a<=0||o<=0)continue;let s=Math.min(a,o*C),c=s/C,l=s*c;l>n.area&&(n={width:s,height:c,area:l})}return{width:Math.floor(n.width),height:Math.floor(n.height)}},[w,O,C]),A=(0,_.useCallback)(()=>{g(e=>{let t=!e;return Bne(t),t})},[]);(0,_.useEffect)(()=>{o||(n({title:`No Configuration`,description:`Please start recording from the main page.`,variant:`destructive`}),t(`/`))},[o,t,n]),(0,_.useEffect)(()=>{o&&!S.current&&(S.current=!0,P())},[o]);let j=(0,_.useRef)(d);j.current=d;let M=(0,_.useRef)(y);M.current=y,(0,_.useEffect)(()=>{if(!l)return;let e=async()=>{try{let e=await a(`${r}/recording-status`);if(!e.ok)return;let i=await e.json();c(i);let s=j.current;s&&i.current_phase===s&&f(null);let l=i.current_phase,u=v.current;u!==l&&(l===`recording`&&u!==null?Vne():l===`resetting`&&Hne(),v.current=l,x.current={phase:null,episode:null,tick:0});let d=i.phase_elapsed_seconds||0,p=i.phase_time_limit_s||0,m=p>3&&d>=p-3,h=i.current_episode??null,g=M.current,_=x.current;if(m&&s===null&&(_.phase!==l||_.episode!==h||_.tick!==g)&&(Une(),x.current={phase:l,episode:h,tick:g}),!i.recording_active&&i.session_ended){if(i.current_phase===`error`){let e=i.saved_episodes||0;if(n({title:e>0?`Recording Interrupted`:`Recording Failed`,description:e>0?`${e} episode(s) were saved before the session failed: ${i.error||`unknown error`}`:i.error||`The recording session failed to start.`,variant:`destructive`}),e===0){t(`/`);return}}t(`/upload`,{state:{datasetInfo:{dataset_repo_id:i.dataset_repo_id||o.dataset_repo_id,single_task:o.single_task,num_episodes:o.num_episodes,saved_episodes:i.saved_episodes||0,session_elapsed_seconds:i.session_elapsed_seconds||0}}})}}catch(e){console.error(`Error polling recording status:`,e)}};e();let i=setInterval(e,1e3);return()=>clearInterval(i)},[l,o,t,r,a,n]);let N=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`},P=async()=>{try{let e=await a(`${r}/start-recording`,{method:`POST`,body:JSON.stringify(o)}),i=await e.json();e.ok?(u(!0),n({title:`Recording Started`,description:`Started recording ${o.num_episodes} episodes`})):(n({title:`Error Starting Recording`,description:i.message||`Failed to start recording session.`,variant:`destructive`}),t(`/`))}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`}),t(`/`)}},F=(0,_.useCallback)(async()=>{if(!s?.available_controls.exit_early||d!==null)return;let e=s.current_phase,t=e===`recording`?`resetting`:e===`resetting`?`recording`:null;if(t){f(t);try{let e=await a(`${r}/recording-exit-early`,{method:`POST`});if(!e.ok){let t=await e.json();f(null),n({title:`Error`,description:t.message,variant:`destructive`})}}catch{f(null),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}}},[s,d,r,a,n]),ee=(0,_.useCallback)(async()=>{if(s?.available_controls.rerecord_episode)try{let e=await a(`${r}/recording-rerecord-episode`,{method:`POST`}),t=await e.json();e.ok?(b(e=>e+1),n({title:`Re-recording Episode`,description:`Episode ${s.current_episode} will be re-recorded.`})):n({title:`Error`,description:t.message,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},[s,r,a,n]),te=(0,_.useCallback)(async()=>{if(s?.available_controls.stop_recording)try{await a(`${r}/stop-recording`,{method:`POST`}),n({title:`Stopping recording`,description:`Finalizing dataset…`})}catch{n({title:`Error`,description:`Failed to stop recording.`,variant:`destructive`})}},[s,r,a,n]),ne=(0,_.useCallback)(()=>{s?.available_controls.stop_recording&&m(!0)},[s]),re=(0,_.useCallback)(async()=>{m(!1),await te()},[te]),ie=(0,_.useRef)({handleExitEarly:F,handleRerecordEpisode:ee,requestStopRecording:ne,showStopConfirm:p});(0,_.useEffect)(()=>{ie.current={handleExitEarly:F,handleRerecordEpisode:ee,requestStopRecording:ne,showStopConfirm:p}});let ae=l&&s!==null;if((0,_.useEffect)(()=>{if(!ae)return;let e=e=>{let t=e.target;if(!(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))){if(e.key===` `||e.code===`Space`||e.key===`ArrowRight`)e.preventDefault(),ie.current.handleExitEarly();else if(e.key===`ArrowLeft`)e.preventDefault(),ie.current.handleRerecordEpisode();else if(e.key===`Escape`){if(ie.current.showStopConfirm)return;ie.current.requestStopRecording()}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ae]),!o)return(0,B.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`p`,{className:`text-lg`,children:`No recording configuration found.`}),(0,B.jsx)(q,{onClick:()=>t(`/`),className:`mt-4`,children:`Return to Home`})]})});if(!s)return(0,B.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-red-500 mx-auto mb-4`}),(0,B.jsx)(`p`,{className:`text-lg`,children:`Connecting to recording session...`})]})});let oe=s.current_phase,se=d??oe,ce=s.current_episode??1,le=s.total_episodes??o.num_episodes,ue=d?0:s.phase_elapsed_seconds||0,de=se===`recording`?o.episode_time_s:se===`resetting`?o.reset_time_s:s.phase_time_limit_s||0,fe=s.session_elapsed_seconds||0,I=()=>se===`recording`?`RECORDING EPISODE ${ce}`:se===`resetting`?`RESET — GET READY`:se===`preparing`?`PREPARING SESSION`:`SESSION COMPLETE`,pe=se===`recording`?{dot:`bg-red-500`,pill:`bg-red-500/15 text-red-300`,timer:`text-green-400`,bar:`bg-green-500`,button:`bg-green-500 hover:bg-green-600`}:se===`resetting`?{dot:`bg-orange-500`,pill:`bg-orange-500/15 text-orange-300`,timer:`text-orange-400`,bar:`bg-orange-500`,button:`bg-orange-500 hover:bg-orange-600`}:{dot:`bg-gray-500`,pill:`bg-gray-500/15 text-gray-300`,timer:`text-gray-400`,bar:`bg-gray-500`,button:`bg-gray-500`},me=se===`recording`?`End Episode`:se===`resetting`?`Start Next Episode`:`Advance`,he=se===`recording`?Ks:Ls;return(0,B.jsxs)(`div`,{className:`h-screen bg-black text-white p-6 flex flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`max-w-7xl w-full mx-auto flex-1 min-h-0 flex flex-col`,children:[(0,B.jsx)(`div`,{className:`mb-3 flex-shrink-0`,children:(0,B.jsxs)(q,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,B.jsx)(os,{className:`w-4 h-4 mr-2`}),`Back to Home`]})}),(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-6 flex-1 min-h-0 flex flex-col justify-center`,children:[(0,B.jsxs)(`div`,{className:`flex justify-end items-center gap-4 mb-3 flex-shrink-0 text-sm text-gray-400`,children:[(0,B.jsxs)(`span`,{"aria-label":`Episode ${ce} of ${le}`,children:[`Episode `,(0,B.jsx)(`span`,{className:`text-white font-semibold`,children:ce}),` / `,le]}),(0,B.jsx)(`span`,{className:`font-mono`,"aria-label":`Total session time ${N(fe)}`,children:N(fe)}),(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:A,"aria-label":h?`Unmute`:`Mute`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,children:h?(0,B.jsx)(tc,{className:`w-5 h-5`}):(0,B.jsx)(ec,{className:`w-5 h-5`})}),(0,B.jsxs)(Ane,{children:[(0,B.jsx)(jne,{asChild:!0,children:(0,B.jsx)(q,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,"aria-label":`More actions`,children:(0,B.jsx)(Es,{className:`w-5 h-5`})})}),(0,B.jsxs)(kI,{align:`end`,onCloseAutoFocus:e=>e.preventDefault(),className:`bg-gray-900 border-gray-700 text-white`,children:[(0,B.jsxs)(AI,{onClick:ee,disabled:!s.available_controls.rerecord_episode,className:`focus:bg-gray-800 focus:text-white`,children:[(0,B.jsx)(Bs,{className:`w-4 h-4 mr-2`}),`Re-record episode`]}),(0,B.jsxs)(AI,{onClick:ne,disabled:!s.available_controls.stop_recording,className:`text-red-400 focus:bg-gray-800 focus:text-red-300`,children:[(0,B.jsx)(Js,{className:`w-4 h-4 mr-2`}),`Stop recording`]})]})]})]}),(0,B.jsx)(`div`,{className:`text-center mb-3 flex-shrink-0`,children:(0,B.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${pe.pill}`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full ${pe.dot} ${se===`completed`?``:`animate-pulse`}`}),I()]})}),s.cameras&&s.cameras.length>0&&se!==`completed`&&(0,B.jsx)(`div`,{ref:D,className:`flex-1 min-h-0 flex flex-wrap gap-3 justify-center content-center overflow-hidden mb-3`,children:s.cameras.map(e=>(0,B.jsx)(sre,{baseUrl:r,name:e,live:se===`recording`||se===`resetting`,width:k.width,height:k.height},e))}),(0,B.jsxs)(`div`,{className:`text-center mb-3 flex-shrink-0`,children:[(0,B.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${pe.timer}`,children:N(ue)}),(0,B.jsxs)(`div`,{className:`text-sm text-gray-500 mt-2`,children:[`/ `,N(de)]})]}),(0,B.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-4 flex-shrink-0`,children:(0,B.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${pe.bar}`,style:{width:`${Math.min(ue/de*100,100)}%`}})}),(0,B.jsxs)(q,{onClick:F,disabled:!s.available_controls.exit_early||d!==null||se===`completed`,className:`w-full flex-shrink-0 text-white font-semibold py-6 text-lg disabled:opacity-50 ${pe.button}`,children:[(0,B.jsx)(he,{className:`w-5 h-5 mr-2`}),me,se!==`completed`&&(0,B.jsx)(`span`,{className:`ml-3 px-2 py-0.5 rounded text-xs font-mono bg-black/30 text-white/70`,children:`SPACE / →`})]}),se===`completed`&&(0,B.jsx)(`p`,{className:`text-center text-sm text-gray-400 mt-6`,children:`Recording complete — redirecting to upload…`})]})]}),(0,B.jsx)(tL,{open:p,onOpenChange:m,children:(0,B.jsxs)(rL,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,B.jsxs)(iL,{children:[(0,B.jsx)(oL,{children:`Stop recording?`}),(0,B.jsx)(sL,{className:`text-gray-400`,children:`Saved episodes are kept. The session will end and you'll be taken to the upload page.`})]}),(0,B.jsxs)(aL,{children:[(0,B.jsx)(lL,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep recording`}),(0,B.jsx)(cL,{onClick:re,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})},sre=({baseUrl:e,name:t,live:n,width:r,height:i})=>{let[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=`${e}/camera-feed/${encodeURIComponent(t)}?k=${a}`;(0,_.useEffect)(()=>()=>{l.current&&window.clearTimeout(l.current)},[]);let d=(0,_.useCallback)(()=>{c(!0),l.current&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{c(!1),o(e=>e+1)},1500)},[]);return r<=0||i<=0?null:(0,B.jsxs)(`div`,{style:{width:r,height:i},className:`relative bg-gray-900 rounded-lg border border-gray-700 overflow-hidden flex items-center justify-center`,children:[n?s?(0,B.jsx)(`span`,{className:`text-gray-500 text-sm`,children:`Connecting feed…`}):(0,B.jsx)(`img`,{src:u,alt:`${t} live feed`,onError:d,className:`w-full h-full object-cover`}):(0,B.jsx)(`span`,{className:`text-gray-500 text-sm`,children:`Getting ready…`}),(0,B.jsx)(`span`,{className:`absolute bottom-2 left-2 px-2 py-0.5 rounded bg-black/60 text-sm text-gray-200`,children:t})]})},uL=()=>{let e=ht();return(0,B.jsx)(`div`,{className:`flex items-center justify-between mb-8`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-4 text-3xl`,children:[(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,B.jsx)(os,{className:`w-5 h-5`})}),(0,B.jsx)(eN,{}),(0,B.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Training`})]})})},dL=/^[\w.-]+\/[\w.-]+$/,cre=({datasets:e,loading:t,value:n,onChange:r})=>{let[i,a]=_.useState(!1),[o,s]=_.useState(!1),[c,l]=_.useState(``),u=()=>{let e=c.trim();dL.test(e)&&(r(e),s(!1))},d=e.filter(e=>e.source===`local`||e.source===`both`),f=e.filter(e=>e.source===`hub`),p=e=>(0,B.jsxs)(U_,{value:e.repo_id,onSelect:()=>{r(e.repo_id),a(!1)},className:`text-white aria-selected:bg-gray-700`,children:[(0,B.jsx)(ls,{className:K(`mr-2 h-4 w-4`,n===e.repo_id?`opacity-100`:`opacity-0`)}),(0,B.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,B.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,B.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return o?(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(J_,{autoFocus:!0,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u()},placeholder:`org/dataset-name`,className:`bg-gray-800 border-gray-600 text-white`}),(0,B.jsx)(q,{onClick:u,disabled:!dL.test(c.trim()),children:`Use`}),(0,B.jsx)(q,{variant:`ghost`,onClick:()=>s(!1),children:`Cancel`})]}):(0,B.jsxs)(zg,{open:i,onOpenChange:a,children:[(0,B.jsx)(Bg,{asChild:!0,children:(0,B.jsxs)(q,{variant:`outline`,role:`combobox`,"aria-expanded":i,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[n??(t?`Loading datasets…`:`Select a dataset…`),(0,B.jsx)(ms,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,B.jsx)(Vg,{className:`w-[--radix-popover-trigger-width] p-0 bg-gray-800 border-gray-700`,align:`start`,children:(0,B.jsxs)(L_,{className:`bg-gray-800 text-white`,children:[(0,B.jsx)(R_,{placeholder:`Search datasets…`,className:`text-white`}),(0,B.jsxs)(z_,{children:[(0,B.jsx)(B_,{children:t?`Loading…`:`No datasets.`}),d.length>0&&(0,B.jsx)(V_,{heading:`Local`,children:d.map(p)}),f.length>0&&(0,B.jsx)(V_,{heading:`Hugging Face`,children:f.map(p)}),(0,B.jsx)(V_,{children:(0,B.jsxs)(U_,{onSelect:()=>{s(!0),a(!1)},className:`text-purple-300 aria-selected:bg-gray-700`,children:[(0,B.jsx)(Is,{className:`mr-2 h-4 w-4`}),`Use custom repo ID…`]})})]})]})})]})},lre=1500;function fL(e,t=!0){let{baseUrl:n,fetchWithHeaders:r}=wl(),[i,a]=(0,_.useState)(`idle`),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)([]),u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!t)return;let i=!1;return r(`${n}/${e}/install-status`).then(e=>e.json()).then(e=>{i||(a(e.state),s(e.error),e.logs.length>0&&l(e.logs))}).catch(()=>{}),()=>{i=!0}},[t,n,r,e]),(0,_.useEffect)(()=>{if(i!==`installing`)return;let t=setInterval(async()=>{try{let t=await r(`${n}/${e}/install-status`);if(!t.ok)return;let i=await t.json();i.logs&&i.logs.length>0&&l(e=>[...e,...i.logs]),i.state!==`installing`&&(a(i.state),s(i.error))}catch{}},lre);return()=>clearInterval(t)},[i,n,r,e]),(0,_.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[c]),{state:i,error:o,logs:c,logBoxRef:u,handleInstall:(0,_.useCallback)(async()=>{a(`installing`),s(null),l([]);try{let t=await r(`${n}/${e}/install`,{method:`POST`}),i=await t.json();if(!i.started&&t.ok)return;t.ok||(a(`error`),s(i.message||`Install request failed (${t.status})`))}catch(e){a(`error`),s(`Install request failed: ${e instanceof Error?e.message:String(e)}`)}},[n,r,e]),handleRetry:(0,_.useCallback)(()=>{a(`idle`),s(null),l([])},[])}}function pL(e,t){switch(e){case`done`:return`Install Complete`;case`error`:return`Install Failed`;case`installing`:return`Installing…`;default:return t}}function mL({state:e}){return e===`done`?(0,B.jsx)(_s,{className:`w-6 h-6 text-green-400`}):e===`error`?(0,B.jsx)(ys,{className:`w-6 h-6 text-red-400`}):e===`installing`?(0,B.jsx)(Ns,{className:`w-6 h-6 text-sky-400 animate-spin`}):(0,B.jsx)(Zs,{className:`w-6 h-6 text-amber-400`})}var hL=({state:e,error:t,logs:n,logBoxRef:r,onInstall:i,onRetry:a,installHint:o,packageName:s,idleDescription:c,doneDescription:l})=>{let{toast:u}=ea();return(0,B.jsxs)(B.Fragment,{children:[e===`idle`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`text-slate-300`,children:c}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`code`,{className:`flex-1 bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono`,children:o}),(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:async()=>{try{await navigator.clipboard.writeText(o),u({title:`Copied`,description:o})}catch{u({title:`Copy failed`,description:`Select the command and copy manually.`,variant:`destructive`})}},className:`text-slate-400 hover:text-white`,"aria-label":`Copy install command`,children:(0,B.jsx)(Cs,{className:`w-4 h-4`})})]}),(0,B.jsx)(q,{onClick:i,className:`bg-green-500 hover:bg-green-600 text-white font-semibold`,children:`Install Now`})]}),e===`installing`&&(0,B.jsxs)(`p`,{className:`text-slate-300`,children:[`Installing`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:s}),`. This usually takes about 10 seconds.`]}),e===`done`&&(0,B.jsx)(`div`,{className:`space-y-3 text-slate-300`,children:l}),e===`error`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`text-red-300`,children:t||`Install failed.`}),(0,B.jsx)(q,{onClick:a,className:`bg-slate-700 hover:bg-slate-600 text-white`,children:`Try again`})]}),e===`error`&&n.length>0&&(0,B.jsx)(`div`,{ref:r,className:`bg-slate-900 rounded-lg p-3 h-48 overflow-y-auto font-mono text-xs border border-slate-700 text-slate-300 whitespace-pre-wrap break-words`,children:n.map((e,t)=>(0,B.jsx)(`div`,{children:e.message},t))})]})},gL=({purpose:e})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`p`,{children:[`Install complete. Restart`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`to enable `,e,`:`]}),(0,B.jsxs)(`ol`,{className:`list-decimal list-inside space-y-2 pl-1`,children:[(0,B.jsxs)(`li`,{children:[`Press`,` `,(0,B.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-slate-900 border border-slate-600 text-xs font-mono text-slate-200`,children:`Ctrl+C`}),` `,`in the terminal running`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),`.`]}),(0,B.jsxs)(`li`,{children:[`Run`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`again.`]})]})]}),ure=({open:e,onOpenChange:t,installHint:n})=>{let r=fL(`system/wandb-extra`,e);return(0,B.jsx)(lf,{open:e,onOpenChange:t,children:(0,B.jsxs)(ff,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,B.jsxs)(pf,{children:[(0,B.jsxs)(hf,{className:`flex items-center gap-3 text-white`,children:[(0,B.jsx)(mL,{state:r.state}),pL(r.state,`Weights & Biases Not Installed`)]}),(0,B.jsx)(gf,{className:`sr-only`,children:`Install the wandb package to enable W&B logging.`})]}),(0,B.jsx)(`div`,{className:`space-y-4`,children:(0,B.jsx)(hL,{state:r.state,error:r.error,logs:r.logs,logBoxRef:r.logBoxRef,onInstall:r.handleInstall,onRetry:r.handleRetry,installHint:n,packageName:`wandb`,idleTitle:`Weights & Biases Not Installed`,idleDescription:(0,B.jsxs)(B.Fragment,{children:[`Enabling W&B logging requires the`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`wandb`}),` `,`package, which isn't installed in this environment. Install it to log this run to W&B.`]}),doneDescription:(0,B.jsx)(gL,{purpose:`W&B logging`})})})]})})},dre=({config:e,updateConfig:t,datasets:n,datasetsLoading:r})=>{let{baseUrl:i,fetchWithHeaders:a}=wl(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(`pip install wandb`);return(0,B.jsxs)(hb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(gb,{children:(0,B.jsx)(_b,{className:`text-white`,children:`Run Configuration`})}),(0,B.jsxs)(yb,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{className:`text-slate-300`,children:`Dataset Repository ID *`}),(0,B.jsx)(`div`,{className:`mt-1`,children:(0,B.jsx)(cre,{datasets:n,loading:r,value:e.dataset_repo_id||null,onChange:e=>{e&&t(`dataset_repo_id`,e)}})}),(0,B.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`HuggingFace Hub dataset repository ID`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_type`,className:`text-slate-300`,children:`Policy`}),(0,B.jsxs)(Uy,{value:e.policy_type,onValueChange:e=>t(`policy_type`,e),children:[(0,B.jsx)(Gy,{id:`policy_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,B.jsx)(Wy,{})}),(0,B.jsxs)(Jy,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,B.jsx)(Xy,{value:`act`,children:`ACT (Action Chunking Transformer)`}),(0,B.jsx)(Xy,{value:`diffusion`,children:`Diffusion Policy`}),(0,B.jsx)(Xy,{value:`pi0`,children:`PI0`}),(0,B.jsx)(Xy,{value:`smolvla`,children:`SmolVLA`}),(0,B.jsx)(Xy,{value:`groot`,children:`GR00T N1.7`}),(0,B.jsx)(Xy,{value:`tdmpc`,children:`TD-MPC`}),(0,B.jsx)(Xy,{value:`vqbet`,children:`VQ-BeT`}),(0,B.jsx)(Xy,{value:`pi0_fast`,children:`PI0 Fast`}),(0,B.jsx)(Xy,{value:`sac`,children:`SAC`}),(0,B.jsx)(Xy,{value:`reward_classifier`,children:`Reward Classifier`})]})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`steps`,className:`text-slate-300`,children:`Training Steps`}),(0,B.jsx)(Y_,{id:`steps`,value:e.steps,onChange:e=>{e!==void 0&&t(`steps`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`batch_size`,className:`text-slate-300`,children:`Batch Size`}),(0,B.jsx)(Y_,{id:`batch_size`,value:e.batch_size,onChange:e=>{e!==void 0&&t(`batch_size`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,B.jsx)(mN,{id:`wandb_enable`,checked:e.wandb_enable,onCheckedChange:async e=>{if(!e){t(`wandb_enable`,!1);return}try{let e=await(await a(`${i}/system/wandb-extra`)).json();e.available?t(`wandb_enable`,!0):(l(e.install_hint),s(!0))}catch{t(`wandb_enable`,!0)}},className:`data-[state=checked]:bg-green-500`}),(0,B.jsx)(J,{htmlFor:`wandb_enable`,className:`text-slate-300`,children:`Enable Weights & Biases`})]})]}),(0,B.jsx)(ure,{open:o,onOpenChange:s,installHint:c}),e.wandb_enable&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`wandb_project`,className:`text-slate-300`,children:`W&B Project Name`}),(0,B.jsx)(J_,{id:`wandb_project`,value:e.wandb_project||``,onChange:e=>t(`wandb_project`,e.target.value||void 0),placeholder:`my-robotics-project`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]})},_L={policy_base_model_path:`nvidia/GR00T-N1.7-3B`,policy_embodiment_tag:`new_embodiment`,policy_chunk_size:16,policy_n_action_steps:16,policy_use_relative_actions:!0,policy_relative_exclude_joints:[`gripper`],policy_use_bf16:!0,dataset_image_transforms_enable:!0},fre=({config:e,updateConfig:t})=>{let n=e.policy_type===`groot`,r=(0,_.useRef)(!1);if((0,_.useEffect)(()=>{!n||r.current||(r.current=!0,Object.keys(_L).forEach(n=>{e[n]===void 0&&t(n,_L[n])}))},[n]),!n)return null;let i=(e.policy_relative_exclude_joints??[]).join(`, `);return(0,B.jsxs)(hb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(gb,{children:(0,B.jsx)(_b,{className:`text-white`,children:`GR00T N1.7`})}),(0,B.jsxs)(yb,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_base_model_path`,className:`text-slate-300`,children:`Base Model Path`}),(0,B.jsx)(J_,{id:`policy_base_model_path`,value:e.policy_base_model_path??``,onChange:e=>t(`policy_base_model_path`,e.target.value||void 0),placeholder:`nvidia/GR00T-N1.7-3B`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`}),(0,B.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`HuggingFace repo of the pretrained GR00T backbone to fine-tune.`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_embodiment_tag`,className:`text-slate-300`,children:`Embodiment Tag`}),(0,B.jsx)(J_,{id:`policy_embodiment_tag`,value:e.policy_embodiment_tag??``,onChange:e=>t(`policy_embodiment_tag`,e.target.value||void 0),placeholder:`new_embodiment`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_relative_exclude_joints`,className:`text-slate-300`,children:`Relative Exclude Joints`}),(0,B.jsx)(J_,{id:`policy_relative_exclude_joints`,value:i,onChange:e=>t(`policy_relative_exclude_joints`,e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)),placeholder:`gripper`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`}),(0,B.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`Comma-separated joints kept absolute when relative actions are on.`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_chunk_size`,className:`text-slate-300`,children:`Chunk Size`}),(0,B.jsx)(Y_,{id:`policy_chunk_size`,value:e.policy_chunk_size,onChange:e=>t(`policy_chunk_size`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_n_action_steps`,className:`text-slate-300`,children:`Action Steps`}),(0,B.jsx)(Y_,{id:`policy_n_action_steps`,value:e.policy_n_action_steps,onChange:e=>t(`policy_n_action_steps`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(mN,{id:`policy_use_relative_actions`,checked:e.policy_use_relative_actions??!1,onCheckedChange:e=>t(`policy_use_relative_actions`,e),className:`data-[state=checked]:bg-green-500`}),(0,B.jsx)(J,{htmlFor:`policy_use_relative_actions`,className:`text-slate-300`,children:`Use Relative Actions`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(mN,{id:`policy_use_bf16`,checked:e.policy_use_bf16??!1,onCheckedChange:e=>t(`policy_use_bf16`,e),className:`data-[state=checked]:bg-green-500`}),(0,B.jsx)(J,{htmlFor:`policy_use_bf16`,className:`text-slate-300`,children:`Use bfloat16`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(mN,{id:`dataset_image_transforms_enable`,checked:e.dataset_image_transforms_enable??!1,onCheckedChange:e=>t(`dataset_image_transforms_enable`,e),className:`data-[state=checked]:bg-green-500`}),(0,B.jsx)(J,{htmlFor:`dataset_image_transforms_enable`,className:`text-slate-300`,children:`Enable Image Augmentations`})]})]})]})]})},vL=({children:e})=>(0,B.jsx)(`h4`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider`,children:e}),pre=({config:e,updateConfig:t})=>{let[n,r]=(0,_.useState)(!1);return(0,B.jsxs)(hb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsxs)(gb,{role:`button`,tabIndex:0,"aria-expanded":n,onClick:()=>r(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r(e=>!e))},className:`cursor-pointer select-none flex flex-row items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`text-white font-semibold`,children:`Advanced`}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-slate-400 text-sm`,children:[n?(0,B.jsx)(us,{className:`w-4 h-4`}):(0,B.jsx)(fs,{className:`w-4 h-4`}),n?`Hide`:`Show`]})]}),n&&(0,B.jsxs)(yb,{className:`space-y-8`,children:[(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(vL,{children:`Policy`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_device`,className:`text-slate-300`,children:`Device`}),(0,B.jsxs)(Uy,{value:e.policy_device||`cuda`,onValueChange:e=>t(`policy_device`,e),children:[(0,B.jsx)(Gy,{id:`policy_device`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,B.jsx)(Wy,{})}),(0,B.jsxs)(Jy,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,B.jsx)(Xy,{value:`cuda`,children:`CUDA (GPU)`}),(0,B.jsx)(Xy,{value:`cpu`,children:`CPU`}),(0,B.jsx)(Xy,{value:`mps`,children:`MPS (Apple Silicon)`})]})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,B.jsx)(mN,{id:`policy_use_amp`,checked:e.policy_use_amp,onCheckedChange:e=>t(`policy_use_amp`,e)}),(0,B.jsx)(J,{htmlFor:`policy_use_amp`,className:`text-slate-300`,children:`Use Automatic Mixed Precision`})]})]})]}),(0,B.jsx)(DN,{className:`bg-slate-700`}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(vL,{children:`Training`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`seed`,className:`text-slate-300`,children:`Random Seed`}),(0,B.jsx)(Y_,{id:`seed`,value:e.seed,onChange:e=>t(`seed`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`num_workers`,className:`text-slate-300`,children:`Number of Workers`}),(0,B.jsx)(Y_,{id:`num_workers`,value:e.num_workers,onChange:e=>{e!==void 0&&t(`num_workers`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,B.jsx)(DN,{className:`bg-slate-700`}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(vL,{children:`Optimizer`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`optimizer_type`,className:`text-slate-300`,children:`Optimizer`}),(0,B.jsxs)(Uy,{value:e.optimizer_type||`adam`,onValueChange:e=>t(`optimizer_type`,e),children:[(0,B.jsx)(Gy,{id:`optimizer_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,B.jsx)(Wy,{})}),(0,B.jsxs)(Jy,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,B.jsx)(Xy,{value:`adam`,children:`Adam`}),(0,B.jsx)(Xy,{value:`adamw`,children:`AdamW`}),(0,B.jsx)(Xy,{value:`sgd`,children:`SGD`}),(0,B.jsx)(Xy,{value:`multi_adam`,children:`Multi Adam`})]})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`optimizer_lr`,className:`text-slate-300`,children:`Learning Rate`}),(0,B.jsx)(Y_,{id:`optimizer_lr`,integer:!1,step:`0.0001`,value:e.optimizer_lr,onChange:e=>t(`optimizer_lr`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`optimizer_weight_decay`,className:`text-slate-300`,children:`Weight Decay`}),(0,B.jsx)(Y_,{id:`optimizer_weight_decay`,integer:!1,step:`0.0001`,value:e.optimizer_weight_decay,onChange:e=>t(`optimizer_weight_decay`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`optimizer_grad_clip_norm`,className:`text-slate-300`,children:`Gradient Clipping`}),(0,B.jsx)(Y_,{id:`optimizer_grad_clip_norm`,integer:!1,step:`0.0001`,value:e.optimizer_grad_clip_norm,onChange:e=>t(`optimizer_grad_clip_norm`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,B.jsx)(DN,{className:`bg-slate-700`}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(vL,{children:`Logging & Checkpointing`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`log_freq`,className:`text-slate-300`,children:`Log Frequency`}),(0,B.jsx)(Y_,{id:`log_freq`,value:e.log_freq,onChange:e=>{e!==void 0&&t(`log_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`save_freq`,className:`text-slate-300`,children:`Save Frequency`}),(0,B.jsx)(Y_,{id:`save_freq`,value:e.save_freq,onChange:e=>{e!==void 0&&t(`save_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(mN,{id:`save_checkpoint`,checked:e.save_checkpoint,onCheckedChange:e=>t(`save_checkpoint`,e)}),(0,B.jsx)(J,{htmlFor:`save_checkpoint`,className:`text-slate-300`,children:`Save Checkpoints`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(mN,{id:`resume`,checked:e.resume,onCheckedChange:e=>t(`resume`,e)}),(0,B.jsx)(J,{htmlFor:`resume`,className:`text-slate-300`,children:`Resume from Checkpoint`})]})]}),e.wandb_enable&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(DN,{className:`bg-slate-700`}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(vL,{children:`Weights & Biases`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`wandb_entity`,className:`text-slate-300`,children:`W&B Entity (optional)`}),(0,B.jsx)(J_,{id:`wandb_entity`,value:e.wandb_entity||``,onChange:e=>t(`wandb_entity`,e.target.value||void 0),placeholder:`your-username`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`wandb_notes`,className:`text-slate-300`,children:`W&B Notes (optional)`}),(0,B.jsx)(J_,{id:`wandb_notes`,value:e.wandb_notes||``,onChange:e=>t(`wandb_notes`,e.target.value||void 0),placeholder:`Training run notes...`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`wandb_mode`,className:`text-slate-300`,children:`W&B Mode`}),(0,B.jsxs)(Uy,{value:e.wandb_mode||`online`,onValueChange:e=>t(`wandb_mode`,e),children:[(0,B.jsx)(Gy,{id:`wandb_mode`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,B.jsx)(Wy,{})}),(0,B.jsxs)(Jy,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,B.jsx)(Xy,{value:`online`,children:`Online`}),(0,B.jsx)(Xy,{value:`offline`,children:`Offline`}),(0,B.jsx)(Xy,{value:`disabled`,children:`Disabled`})]})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(mN,{id:`wandb_disable_artifact`,checked:e.wandb_disable_artifact,onCheckedChange:e=>t(`wandb_disable_artifact`,e)}),(0,B.jsx)(J,{htmlFor:`wandb_disable_artifact`,className:`text-slate-300`,children:`Disable Artifacts`})]})]})]}),!e.wandb_enable&&(0,B.jsx)(DN,{className:`bg-slate-700`}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(vL,{children:`Misc`}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(mN,{id:`use_policy_training_preset`,checked:e.use_policy_training_preset,onCheckedChange:e=>t(`use_policy_training_preset`,e)}),(0,B.jsx)(J,{htmlFor:`use_policy_training_preset`,className:`text-slate-300`,children:`Use Policy Training Preset`})]})]})]})]})},mre=(e,t)=>`$${(t===`minute`?e*60:e).toFixed(2)}/hr`,hre=e=>{let t=e.accelerator?e.accelerator:e.cpu;return`${e.pretty_name} · ${t} · ${mre(e.unit_cost_usd,e.unit_label)}`},gre=({config:e,updateConfig:t,authenticated:n,flavors:r,loading:i})=>{let a=e.target,o=a.runner===`local`?`local`:`hf:${a.flavor??``}`;return(0,B.jsxs)(hb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(gb,{children:(0,B.jsx)(_b,{className:`text-white`,children:`Compute target`})}),(0,B.jsx)(yb,{className:`space-y-3`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{className:`text-slate-300`,children:`Run training on`}),(0,B.jsxs)(Uy,{value:o,onValueChange:e=>{e===`local`?t(`target`,{runner:`local`}):e.startsWith(`hf:`)&&t(`target`,{runner:`hf_cloud`,flavor:e.slice(3)})},children:[(0,B.jsx)(Gy,{className:`bg-slate-900 border-slate-600 text-white rounded-lg mt-1`,children:(0,B.jsx)(Wy,{placeholder:i?`Loading…`:`Select target`})}),(0,B.jsxs)(Jy,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,B.jsx)(Xy,{value:`local`,children:`Local — your machine (free)`}),r.map(e=>(0,B.jsxs)(Xy,{value:`hf:${e.name}`,disabled:!n,children:[hre(e),!n&&(0,B.jsx)(`span`,{className:`text-amber-300 ml-2 text-xs`,children:`log in to HF`})]},e.name))]})]}),(0,B.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`Cost shown is per running hour. Final policy uploads to your HF account when training completes.`})]})})]})},_re=({config:e,updateConfig:t,datasets:n,datasetsLoading:r,authenticated:i,flavors:a,hardwareLoading:o})=>(0,B.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,B.jsx)(gre,{config:e,updateConfig:t,authenticated:i,flavors:a,loading:o}),(0,B.jsx)(dre,{config:e,updateConfig:t,datasets:n,datasetsLoading:r}),(0,B.jsx)(fre,{config:e,updateConfig:t}),(0,B.jsx)(pre,{config:e,updateConfig:t})]}),yL=o(((e,t)=>{t.exports=Array.isArray})),bL=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),xL=o(((e,t)=>{var n=bL(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),SL=o(((e,t)=>{t.exports=xL().Symbol})),vre=o(((e,t)=>{var n=SL(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),yre=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),CL=o(((e,t)=>{var n=SL(),r=vre(),i=yre(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),wL=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),TL=o(((e,t)=>{var n=CL(),r=wL(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),EL=o(((e,t)=>{var n=yL(),r=TL(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),DL=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),OL=o(((e,t)=>{var n=CL(),r=DL(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),bre=o(((e,t)=>{t.exports=xL()[`__core-js_shared__`]})),xre=o(((e,t)=>{var n=bre(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),kL=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),Sre=o(((e,t)=>{var n=OL(),r=xre(),i=DL(),a=kL(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Cre=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),AL=o(((e,t)=>{var n=Sre(),r=Cre();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),jL=o(((e,t)=>{t.exports=AL()(Object,`create`)})),wre=o(((e,t)=>{var n=jL();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Tre=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),Ere=o(((e,t)=>{var n=jL(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),Dre=o(((e,t)=>{var n=jL(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),Ore=o(((e,t)=>{var n=jL(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),kre=o(((e,t)=>{var n=wre(),r=Tre(),i=Ere(),a=Dre(),o=Ore();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{function n(){this.__data__=[],this.size=0}t.exports=n})),ML=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),NL=o(((e,t)=>{var n=ML();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),jre=o(((e,t)=>{var n=NL(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),Mre=o(((e,t)=>{var n=NL();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),Nre=o(((e,t)=>{var n=NL();function r(e){return n(this.__data__,e)>-1}t.exports=r})),Pre=o(((e,t)=>{var n=NL();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),PL=o(((e,t)=>{var n=Are(),r=jre(),i=Mre(),a=Nre(),o=Pre();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{t.exports=AL()(xL(),`Map`)})),IL=o(((e,t)=>{var n=kre(),r=PL(),i=FL();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),LL=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),RL=o(((e,t)=>{var n=LL();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),zL=o(((e,t)=>{var n=RL();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),BL=o(((e,t)=>{var n=RL();function r(e){return n(this,e).get(e)}t.exports=r})),VL=o(((e,t)=>{var n=RL();function r(e){return n(this,e).has(e)}t.exports=r})),HL=o(((e,t)=>{var n=RL();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),UL=o(((e,t)=>{var n=IL(),r=zL(),i=BL(),a=VL(),o=HL();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{var n=UL(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),GL=o(((e,t)=>{var n=WL(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),KL=o(((e,t)=>{var n=GL(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),qL=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n{var n=SL(),r=qL(),i=yL(),a=TL(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),YL=o(((e,t)=>{var n=JL();function r(e){return e==null?``:n(e)}t.exports=r})),XL=o(((e,t)=>{var n=yL(),r=EL(),i=KL(),a=YL();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),ZL=o(((e,t)=>{var n=TL(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),QL=o(((e,t)=>{var n=XL(),r=ZL();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i{var n=QL();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),eR=o(((e,t)=>{function n(e){return e==null}t.exports=n})),tR=o(((e,t)=>{var n=CL(),r=yL(),i=wL(),a=`[object String]`;function o(e){return typeof e==`string`||!r(e)&&i(e)&&n(e)==a}t.exports=o})),nR=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.server_context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case u:case d:return e;default:switch(e&&=e.$$typeof,e){case c:case s:case l:case p:case f:case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),rR=o(((e,t)=>{t.exports=nR()})),iR=o(((e,t)=>{var n=CL(),r=wL(),i=`[object Number]`;function a(e){return typeof e==`number`||r(e)&&n(e)==i}t.exports=a})),aR=o(((e,t)=>{var n=iR();function r(e){return n(e)&&e!=+e}t.exports=r})),oR=l(tR()),sR=l(aR()),cR=l($L()),lR=l(iR()),uR=l(eR()),dR=function(e){return e===0?0:e>0?1:-1},fR=function(e){return(0,oR.default)(e)&&e.indexOf(`%`)===e.length-1},Q=function(e){return(0,lR.default)(e)&&!(0,sR.default)(e)},pR=function(e){return(0,uR.default)(e)},mR=function(e){return Q(e)||(0,oR.default)(e)},hR=0,gR=function(e){var t=++hR;return`${e||``}${t}`},_R=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Q(e)&&!(0,oR.default)(e))return n;var i;if(fR(e)){var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return(0,sR.default)(i)&&(i=n),r&&i>t&&(i=t),i},vR=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},yR=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function zR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function BR(e){"@babel/helpers - typeof";return BR=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},BR(e)}var VR={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},HR=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},UR=null,WR=null,GR=function e(t){if(t===UR&&Array.isArray(WR))return WR;var n=[];return _.Children.forEach(t,function(t){(0,uR.default)(t)||((0,FR.isFragment)(t)?n=n.concat(e(t.props.children)):n.push(t))}),WR=n,UR=t,n};function KR(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(function(e){return HR(e)}):[HR(t)],GR(e).forEach(function(e){var t=(0,cR.default)(e,`type.displayName`)||(0,cR.default)(e,`type.name`);r.indexOf(t)!==-1&&n.push(e)}),n}function qR(e,t){var n=KR(e,t);return n&&n[0]}var JR=function(e){if(!e||!e.props)return!1;var t=e.props,n=t.width,r=t.height;return!(!Q(n)||n<=0||!Q(r)||r<=0)},YR=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),XR=function(e){return e&&e.type&&(0,oR.default)(e.type)&&YR.indexOf(e.type)>=0},ZR=function(e){return e&&BR(e)===`object`&&`clipDot`in e},QR=function(e,t,n,r){var i=kR?.[r]??[];return t.startsWith(`data-`)||!(0,PR.default)(e)&&(r&&i.includes(t)||DR.includes(t))||n&&AR.includes(t)},$R=function(e,t,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,_.isValidElement)(e)&&(r=e.props),!(0,wR.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){QR(r?.[e],e,t,n)&&(i[e]=r[e])}),i},ez=function e(t,n){if(t===n)return!0;var r=_.Children.count(t);if(r!==_.Children.count(n))return!1;if(r===0)return!0;if(r===1)return tz(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function cz(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function lz(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,s=e.title,c=e.desc,l=sz(e,az),u=i||{width:n,height:r,x:0,y:0},d=Zo(`recharts-surface`,a);return _.createElement(`svg`,oz({},$R(l,!0,`svg`),{className:d,width:n,height:r,style:o,viewBox:`${u.x} ${u.y} ${u.width} ${u.height}`}),_.createElement(`title`,null,s),_.createElement(`desc`,null,c),t)}var uz=[`children`,`className`];function dz(){return dz=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function pz(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var mz=_.forwardRef(function(e,t){var n=e.children,r=e.className,i=fz(e,uz),a=Zo(`recharts-layer`,r);return _.createElement(`g`,dz({className:a},$R(i,!0),{ref:t}),n)}),hz=!1,gz=function(e,t){var n=[...arguments].slice(2);if(hz&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,function(){return n[r++]}))}},_z=o(((e,t)=>{function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r{var n=_z();function r(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:n(e,t,r)}t.exports=r})),yz=o(((e,t)=>{var n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function r(e){return n.test(e)}t.exports=r})),bz=o(((e,t)=>{function n(e){return e.split(``)}t.exports=n})),xz=o(((e,t)=>{var n=`\\ud800-\\udfff`,r=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,i=`\\ufe0e\\ufe0f`,a=`[`+n+`]`,o=`[`+r+`]`,s=`\\ud83c[\\udffb-\\udfff]`,c=`(?:`+o+`|`+s+`)`,l=`[^`+n+`]`,u=`(?:\\ud83c[\\udde6-\\uddff]){2}`,d=`[\\ud800-\\udbff][\\udc00-\\udfff]`,f=`\\u200d`,p=c+`?`,m=`[`+i+`]?`,h=`(?:`+f+`(?:`+[l,u,d].join(`|`)+`)`+m+p+`)*`,g=m+p+h,_=`(?:`+[l+o+`?`,o,u,d,a].join(`|`)+`)`,v=RegExp(s+`(?=`+s+`)|`+_+g,`g`);function y(e){return e.match(v)||[]}t.exports=y})),Sz=o(((e,t)=>{var n=bz(),r=yz(),i=xz();function a(e){return r(e)?i(e):n(e)}t.exports=a})),Cz=o(((e,t)=>{var n=vz(),r=yz(),i=Sz(),a=YL();function o(e){return function(t){t=a(t);var o=r(t)?i(t):void 0,s=o?o[0]:t.charAt(0),c=o?n(o,1).join(``):t.slice(1);return s[e]()+c}}t.exports=o})),wz=o(((e,t)=>{t.exports=Cz()(`toUpperCase`)}));function Tz(e){return function(){return e}}var Ez=Math.cos,Dz=Math.sin,Oz=Math.sqrt,kz=Math.PI;kz/2;var Az=2*kz,jz=Math.PI,Mz=2*jz,Nz=1e-6,Pz=Mz-Nz;function Fz(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return Fz;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tNz)if(!(Math.abs(u*s-c*l)>Nz)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((jz-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Nz&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Nz||Math.abs(this._y1-l)>Nz)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Mz+Mz),d>Pz?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>Nz&&this._append`A${n},${n},0,${+(d>=jz)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function Rz(){return new Lz}Rz.prototype=Lz.prototype;function zz(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Lz(t)}Array.prototype.slice;function Bz(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Vz(e){this._context=e}Vz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Hz(e){return new Vz(e)}function Uz(e){return e[0]}function Wz(e){return e[1]}function Gz(e,t){var n=Tz(!0),r=null,i=Hz,a=null,o=zz(s);e=typeof e==`function`?e:e===void 0?Uz:Tz(e),t=typeof t==`function`?t:t===void 0?Wz:Tz(t);function s(s){var c,l=(s=Bz(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return Gz().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:Tz(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:Tz(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:Tz(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:Tz(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:Tz(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:Tz(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:Tz(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var qz=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}};function Jz(e){return new qz(e,!0)}function Yz(e){return new qz(e,!1)}var Xz={draw(e,t){let n=Oz(t/kz);e.moveTo(n,0),e.arc(0,0,n,0,Az)}},Zz={draw(e,t){let n=Oz(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Qz=Oz(1/3),$z=Qz*2,eB={draw(e,t){let n=Oz(t/$z),r=n*Qz;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},tB={draw(e,t){let n=Oz(t),r=-n/2;e.rect(r,r,n,n)}},nB=.8908130915292852,rB=Dz(kz/10)/Dz(7*kz/10),iB=Dz(Az/10)*rB,aB=-Ez(Az/10)*rB,oB={draw(e,t){let n=Oz(t*nB),r=iB*n,i=aB*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=Az*t/5,o=Ez(a),s=Dz(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},sB=Oz(3),cB={draw(e,t){let n=-Oz(t/(sB*3));e.moveTo(0,n*2),e.lineTo(-sB*n,-n),e.lineTo(sB*n,-n),e.closePath()}},lB=-.5,uB=Oz(3)/2,dB=1/Oz(12),fB=(dB/2+1)*3,pB={draw(e,t){let n=Oz(t/fB),r=n/2,i=n*dB,a=r,o=n*dB+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(lB*r-uB*i,uB*r+lB*i),e.lineTo(lB*a-uB*o,uB*a+lB*o),e.lineTo(lB*s-uB*c,uB*s+lB*c),e.lineTo(lB*r+uB*i,lB*i-uB*r),e.lineTo(lB*a+uB*o,lB*o-uB*a),e.lineTo(lB*s+uB*c,lB*c-uB*s),e.closePath()}};function mB(e,t){let n=null,r=zz(i);e=typeof e==`function`?e:Tz(e||Xz),t=typeof t==`function`?t:Tz(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:Tz(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:Tz(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function hB(){}function gB(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function _B(e){this._context=e}_B.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:gB(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:gB(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function vB(e){return new _B(e)}function yB(e){this._context=e}yB.prototype={areaStart:hB,areaEnd:hB,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:gB(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function bB(e){return new yB(e)}function xB(e){this._context=e}xB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:gB(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function SB(e){return new xB(e)}function CB(e){this._context=e}CB.prototype={areaStart:hB,areaEnd:hB,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function wB(e){return new CB(e)}function TB(e){return e<0?-1:1}function EB(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(TB(a)+TB(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function DB(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function OB(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function kB(e){this._context=e}kB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:OB(this,this._t0,DB(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,OB(this,DB(this,n=EB(this,e,t)),n);break;default:OB(this,this._t0,n=EB(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function AB(e){this._context=new jB(e)}(AB.prototype=Object.create(kB.prototype)).point=function(e,t){kB.prototype.point.call(this,t,e)};function jB(e){this._context=e}jB.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function MB(e){return new kB(e)}function NB(e){return new AB(e)}function PB(e){this._context=e}PB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=FB(e),i=FB(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}};function RB(e){return new LB(e,.5)}function zB(e){return new LB(e,0)}function BB(e){return new LB(e,1)}function VB(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function UB(e,t){return e[t]}function WB(e){let t=[];return t.key=e,t}function GB(){var e=Tz([]),t=HB,n=VB,r=UB;function i(i){var a=Array.from(e.apply(this,arguments),WB),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function aV(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var oV={symbolCircle:Xz,symbolCross:Zz,symbolDiamond:eB,symbolSquare:tB,symbolStar:oB,symbolTriangle:cB,symbolWye:pB},sV=Math.PI/180,cV=function(e){return oV[`symbol${(0,YB.default)(e)}`]||Xz},lV=function(e,t,n){if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*sV;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},uV=function(e,t){oV[`symbol${(0,YB.default)(e)}`]=t},dV=function(e){var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=eV(eV({},iV(e,ZB)),{},{type:n,size:i,sizeType:o}),c=function(){var e=cV(n);return mB().type(e).size(lV(i,o,n))()},l=s.className,u=s.cx,d=s.cy,f=$R(s,!0);return u===+u&&d===+d&&i===+i?_.createElement(`path`,QB({},f,{className:Zo(`recharts-symbols`,l),transform:`translate(${u}, ${d})`,d:c()})):null};dV.registerSymbol=uV;function fV(e){"@babel/helpers - typeof";return fV=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},fV(e)}function pV(){return pV=Object.assign?Object.assign.bind():function(e){for(var t=1;t{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},sre=II,cre=LI,JI=RI,YI=BI,XI=GI,ZI=qI,QI=HI,$I=WI,eL=sre,lre=cre,tL=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(JI,{className:K(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));tL.displayName=JI.displayName;var nL=_.forwardRef(({className:e,...t},n)=>(0,B.jsxs)(lre,{children:[(0,B.jsx)(tL,{}),(0,B.jsx)(YI,{ref:n,className:K(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));nL.displayName=YI.displayName;var rL=({className:e,...t})=>(0,B.jsx)(`div`,{className:K(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});rL.displayName=`AlertDialogHeader`;var iL=({className:e,...t})=>(0,B.jsx)(`div`,{className:K(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});iL.displayName=`AlertDialogFooter`;var aL=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(QI,{ref:n,className:K(`text-lg font-semibold`,e),...t}));aL.displayName=QI.displayName;var oL=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)($I,{ref:n,className:K(`text-sm text-muted-foreground`,e),...t}));oL.displayName=$I.displayName;var sL=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(XI,{ref:n,className:K(_l(),e),...t}));sL.displayName=XI.displayName;var cL=_.forwardRef(({className:e,...t},n)=>(0,B.jsx)(ZI,{ref:n,className:K(_l({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));cL.displayName=ZI.displayName;var ure=()=>{let e=ft(),t=ht(),{toast:n}=ea(),{baseUrl:r,wsBaseUrl:i,fetchWithHeaders:a}=wl(),o=e.state?.recordingConfig,[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(()=>MI()),v=(0,_.useRef)(null),[y,b]=(0,_.useState)(0),x=(0,_.useRef)({phase:null,episode:null,tick:0}),S=(0,_.useRef)(!1),C=(0,_.useMemo)(()=>{let e=o?.cameras,t=(Array.isArray(e)?e:e&&typeof e==`object`?Object.values(e):[])[0];return t?.width&&t?.height?t.width/t.height:4/3},[o]),[w,T]=(0,_.useState)({w:0,h:0}),E=(0,_.useRef)(null),D=(0,_.useCallback)(e=>{if(E.current?.disconnect(),E.current=null,e){let t=new ResizeObserver(e=>{let t=e[0].contentRect;T({w:t.width,h:t.height})});t.observe(e),E.current=t}},[]),O=s?.cameras?.length??0,k=(0,_.useMemo)(()=>{let{w:e,h:t}=w;if(!O||e<=0||t<=0)return{width:0,height:0};let n={width:0,height:0,area:-1};for(let r=1;r<=O;r++){let i=Math.ceil(O/r),a=(e-12*(r-1))/r,o=(t-12*(i-1))/i;if(a<=0||o<=0)continue;let s=Math.min(a,o*C),c=s/C,l=s*c;l>n.area&&(n={width:s,height:c,area:l})}return{width:Math.floor(n.width),height:Math.floor(n.height)}},[w,O,C]),A=(0,_.useCallback)(()=>{g(e=>{let t=!e;return Wne(t),t})},[]);(0,_.useEffect)(()=>{o||(n({title:`No Configuration`,description:`Please start recording from the main page.`,variant:`destructive`}),t(`/`))},[o,t,n]),(0,_.useEffect)(()=>{o&&!S.current&&(S.current=!0,P())},[o]);let j=(0,_.useRef)(d);j.current=d;let M=(0,_.useRef)(y);M.current=y,(0,_.useEffect)(()=>{if(!l)return;let e=async()=>{try{let e=await a(`${r}/recording-status`);if(!e.ok)return;let i=await e.json();c(i);let s=j.current;s&&i.current_phase===s&&f(null);let l=i.current_phase,u=v.current;u!==l&&(l===`recording`&&u!==null?Gne():l===`resetting`&&Kne(),v.current=l,x.current={phase:null,episode:null,tick:0});let d=i.phase_elapsed_seconds||0,p=i.phase_time_limit_s||0,m=p>3&&d>=p-3,h=i.current_episode??null,g=M.current,_=x.current;if(m&&s===null&&(_.phase!==l||_.episode!==h||_.tick!==g)&&(qne(),x.current={phase:l,episode:h,tick:g}),!i.recording_active&&i.session_ended){if(i.current_phase===`error`){let e=i.saved_episodes||0;if(n({title:e>0?`Recording Interrupted`:`Recording Failed`,description:e>0?`${e} episode(s) were saved before the session failed: ${i.error||`unknown error`}`:i.error||`The recording session failed to start.`,variant:`destructive`}),e===0){t(`/`);return}}t(`/upload`,{state:{datasetInfo:{dataset_repo_id:i.dataset_repo_id||o.dataset_repo_id,single_task:o.single_task,num_episodes:o.num_episodes,saved_episodes:i.saved_episodes||0,session_elapsed_seconds:i.session_elapsed_seconds||0}}})}}catch(e){console.error(`Error polling recording status:`,e)}};e();let i=setInterval(e,1e3);return()=>clearInterval(i)},[l,o,t,r,a,n]);let N=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`},P=async()=>{try{let e=await a(`${r}/start-recording`,{method:`POST`,body:JSON.stringify(o)}),i=await e.json();e.ok?(u(!0),n({title:`Recording Started`,description:`Started recording ${o.num_episodes} episodes`})):(n({title:`Error Starting Recording`,description:i.message||`Failed to start recording session.`,variant:`destructive`}),t(`/`))}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`}),t(`/`)}},F=(0,_.useCallback)(async()=>{if(!s?.available_controls.exit_early||d!==null)return;let e=s.current_phase,t=e===`recording`?`resetting`:e===`resetting`?`recording`:null;if(t){f(t);try{let e=await a(`${r}/recording-exit-early`,{method:`POST`});if(!e.ok){let t=await e.json();f(null),n({title:`Error`,description:t.message,variant:`destructive`})}}catch{f(null),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}}},[s,d,r,a,n]),ee=(0,_.useCallback)(async()=>{if(s?.available_controls.rerecord_episode)try{let e=await a(`${r}/recording-rerecord-episode`,{method:`POST`}),t=await e.json();e.ok?(b(e=>e+1),n({title:`Re-recording Episode`,description:`Episode ${s.current_episode} will be re-recorded.`})):n({title:`Error`,description:t.message,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},[s,r,a,n]),te=(0,_.useCallback)(async()=>{if(s?.available_controls.stop_recording)try{await a(`${r}/stop-recording`,{method:`POST`}),n({title:`Stopping recording`,description:`Finalizing dataset…`})}catch{n({title:`Error`,description:`Failed to stop recording.`,variant:`destructive`})}},[s,r,a,n]),ne=(0,_.useCallback)(()=>{s?.available_controls.stop_recording&&m(!0)},[s]),re=(0,_.useCallback)(async()=>{m(!1),await te()},[te]),ie=(0,_.useRef)({handleExitEarly:F,handleRerecordEpisode:ee,requestStopRecording:ne,showStopConfirm:p});(0,_.useEffect)(()=>{ie.current={handleExitEarly:F,handleRerecordEpisode:ee,requestStopRecording:ne,showStopConfirm:p}});let ae=l&&s!==null;if((0,_.useEffect)(()=>{if(!ae)return;let e=e=>{let t=e.target;if(!(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))){if(e.key===` `||e.code===`Space`||e.key===`ArrowRight`)e.preventDefault(),ie.current.handleExitEarly();else if(e.key===`ArrowLeft`)e.preventDefault(),ie.current.handleRerecordEpisode();else if(e.key===`Escape`){if(ie.current.showStopConfirm)return;ie.current.requestStopRecording()}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[ae]),!o)return(0,B.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`p`,{className:`text-lg`,children:`No recording configuration found.`}),(0,B.jsx)(q,{onClick:()=>t(`/`),className:`mt-4`,children:`Return to Home`})]})});if(!s)return(0,B.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-red-500 mx-auto mb-4`}),(0,B.jsx)(`p`,{className:`text-lg`,children:`Connecting to recording session...`})]})});let oe=s.current_phase,se=d??oe,ce=s.current_episode??1,le=s.total_episodes??o.num_episodes,ue=d?0:s.phase_elapsed_seconds||0,de=se===`recording`?o.episode_time_s:se===`resetting`?o.reset_time_s:s.phase_time_limit_s||0,fe=s.session_elapsed_seconds||0,I=()=>se===`recording`?`RECORDING EPISODE ${ce}`:se===`resetting`?`RESET — GET READY`:se===`preparing`?`PREPARING SESSION`:`SESSION COMPLETE`,pe=se===`recording`?{dot:`bg-red-500`,pill:`bg-red-500/15 text-red-300`,timer:`text-green-400`,bar:`bg-green-500`,button:`bg-green-500 hover:bg-green-600`}:se===`resetting`?{dot:`bg-orange-500`,pill:`bg-orange-500/15 text-orange-300`,timer:`text-orange-400`,bar:`bg-orange-500`,button:`bg-orange-500 hover:bg-orange-600`}:{dot:`bg-gray-500`,pill:`bg-gray-500/15 text-gray-300`,timer:`text-gray-400`,bar:`bg-gray-500`,button:`bg-gray-500`},me=se===`recording`?`End Episode`:se===`resetting`?`Start Next Episode`:`Advance`,he=se===`recording`?Ks:Ls;return(0,B.jsxs)(`div`,{className:`h-screen bg-black text-white p-6 flex flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`max-w-7xl w-full mx-auto flex-1 min-h-0 flex flex-col`,children:[(0,B.jsx)(`div`,{className:`mb-3 flex-shrink-0`,children:(0,B.jsxs)(q,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,B.jsx)(os,{className:`w-4 h-4 mr-2`}),`Back to Home`]})}),(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-6 flex-1 min-h-0 flex flex-col justify-center`,children:[(0,B.jsxs)(`div`,{className:`flex justify-end items-center gap-4 mb-3 flex-shrink-0 text-sm text-gray-400`,children:[(0,B.jsxs)(`span`,{"aria-label":`Episode ${ce} of ${le}`,children:[`Episode `,(0,B.jsx)(`span`,{className:`text-white font-semibold`,children:ce}),` / `,le]}),(0,B.jsx)(`span`,{className:`font-mono`,"aria-label":`Total session time ${N(fe)}`,children:N(fe)}),(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:A,"aria-label":h?`Unmute`:`Mute`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,children:h?(0,B.jsx)(tc,{className:`w-5 h-5`}):(0,B.jsx)(ec,{className:`w-5 h-5`})}),(0,B.jsxs)(Pne,{children:[(0,B.jsx)(Fne,{asChild:!0,children:(0,B.jsx)(q,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,"aria-label":`More actions`,children:(0,B.jsx)(Es,{className:`w-5 h-5`})})}),(0,B.jsxs)(OI,{align:`end`,onCloseAutoFocus:e=>e.preventDefault(),className:`bg-gray-900 border-gray-700 text-white`,children:[(0,B.jsxs)(kI,{onClick:ee,disabled:!s.available_controls.rerecord_episode,className:`focus:bg-gray-800 focus:text-white`,children:[(0,B.jsx)(Bs,{className:`w-4 h-4 mr-2`}),`Re-record episode`]}),(0,B.jsxs)(kI,{onClick:ne,disabled:!s.available_controls.stop_recording,className:`text-red-400 focus:bg-gray-800 focus:text-red-300`,children:[(0,B.jsx)(Js,{className:`w-4 h-4 mr-2`}),`Stop recording`]})]})]})]}),(0,B.jsx)(`div`,{className:`text-center mb-3 flex-shrink-0`,children:(0,B.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${pe.pill}`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full ${pe.dot} ${se===`completed`?``:`animate-pulse`}`}),I()]})}),s.cameras&&s.cameras.length>0&&se!==`completed`&&(0,B.jsx)(`div`,{ref:D,className:`flex-1 min-h-0 flex flex-wrap gap-3 justify-center content-center overflow-hidden mb-3`,children:s.cameras.map(e=>(0,B.jsx)(dre,{baseUrl:r,name:e,live:se===`recording`||se===`resetting`,width:k.width,height:k.height},e))}),(0,B.jsxs)(`div`,{className:`text-center mb-3 flex-shrink-0`,children:[(0,B.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${pe.timer}`,children:N(ue)}),(0,B.jsxs)(`div`,{className:`text-sm text-gray-500 mt-2`,children:[`/ `,N(de)]})]}),(0,B.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-4 flex-shrink-0`,children:(0,B.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${pe.bar}`,style:{width:`${Math.min(ue/de*100,100)}%`}})}),(0,B.jsxs)(q,{onClick:F,disabled:!s.available_controls.exit_early||d!==null||se===`completed`,className:`w-full flex-shrink-0 text-white font-semibold py-6 text-lg disabled:opacity-50 ${pe.button}`,children:[(0,B.jsx)(he,{className:`w-5 h-5 mr-2`}),me,se!==`completed`&&(0,B.jsx)(`span`,{className:`ml-3 px-2 py-0.5 rounded text-xs font-mono bg-black/30 text-white/70`,children:`SPACE / →`})]}),se===`completed`&&(0,B.jsx)(`p`,{className:`text-center text-sm text-gray-400 mt-6`,children:`Recording complete — redirecting to upload…`})]})]}),(0,B.jsx)(eL,{open:p,onOpenChange:m,children:(0,B.jsxs)(nL,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,B.jsxs)(rL,{children:[(0,B.jsx)(aL,{children:`Stop recording?`}),(0,B.jsx)(oL,{className:`text-gray-400`,children:`Saved episodes are kept. The session will end and you'll be taken to the upload page.`})]}),(0,B.jsxs)(iL,{children:[(0,B.jsx)(cL,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep recording`}),(0,B.jsx)(sL,{onClick:re,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})},dre=({baseUrl:e,name:t,live:n,width:r,height:i})=>{let[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=`${e}/camera-feed/${encodeURIComponent(t)}?k=${a}`;(0,_.useEffect)(()=>()=>{l.current&&window.clearTimeout(l.current)},[]);let d=(0,_.useCallback)(()=>{c(!0),l.current&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{c(!1),o(e=>e+1)},1500)},[]);return r<=0||i<=0?null:(0,B.jsxs)(`div`,{style:{width:r,height:i},className:`relative bg-gray-900 rounded-lg border border-gray-700 overflow-hidden flex items-center justify-center`,children:[n?s?(0,B.jsx)(`span`,{className:`text-gray-500 text-sm`,children:`Connecting feed…`}):(0,B.jsx)(`img`,{src:u,alt:`${t} live feed`,onError:d,className:`w-full h-full object-cover`}):(0,B.jsx)(`span`,{className:`text-gray-500 text-sm`,children:`Getting ready…`}),(0,B.jsx)(`span`,{className:`absolute bottom-2 left-2 px-2 py-0.5 rounded bg-black/60 text-sm text-gray-200`,children:t})]})},lL=()=>{let e=ht();return(0,B.jsx)(`div`,{className:`flex items-center justify-between mb-8`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-4 text-3xl`,children:[(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,B.jsx)(os,{className:`w-5 h-5`})}),(0,B.jsx)($M,{}),(0,B.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Training`})]})})},uL=/^[\w.-]+\/[\w.-]+$/,fre=({datasets:e,loading:t,value:n,onChange:r})=>{let[i,a]=_.useState(!1),[o,s]=_.useState(!1),[c,l]=_.useState(``),u=()=>{let e=c.trim();uL.test(e)&&(r(e),s(!1))},d=e.filter(e=>e.source===`local`||e.source===`both`),f=e.filter(e=>e.source===`hub`),p=e=>(0,B.jsxs)(h_,{value:e.repo_id,onSelect:()=>{r(e.repo_id),a(!1)},className:`text-white aria-selected:bg-gray-700`,children:[(0,B.jsx)(ls,{className:K(`mr-2 h-4 w-4`,n===e.repo_id?`opacity-100`:`opacity-0`)}),(0,B.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,B.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,B.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return o?(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(b_,{autoFocus:!0,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u()},placeholder:`org/dataset-name`,className:`bg-gray-800 border-gray-600 text-white`}),(0,B.jsx)(q,{onClick:u,disabled:!uL.test(c.trim()),children:`Use`}),(0,B.jsx)(q,{variant:`ghost`,onClick:()=>s(!1),children:`Cancel`})]}):(0,B.jsxs)(mg,{open:i,onOpenChange:a,children:[(0,B.jsx)(hg,{asChild:!0,children:(0,B.jsxs)(q,{variant:`outline`,role:`combobox`,"aria-expanded":i,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[n??(t?`Loading datasets…`:`Select a dataset…`),(0,B.jsx)(ms,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,B.jsx)(gg,{className:`w-[--radix-popover-trigger-width] p-0 bg-gray-800 border-gray-700`,align:`start`,children:(0,B.jsxs)(l_,{className:`bg-gray-800 text-white`,children:[(0,B.jsx)(u_,{placeholder:`Search datasets…`,className:`text-white`}),(0,B.jsxs)(d_,{children:[(0,B.jsx)(f_,{children:t?`Loading…`:`No datasets.`}),d.length>0&&(0,B.jsx)(p_,{heading:`Local`,children:d.map(p)}),f.length>0&&(0,B.jsx)(p_,{heading:`Hugging Face`,children:f.map(p)}),(0,B.jsx)(p_,{children:(0,B.jsxs)(h_,{onSelect:()=>{s(!0),a(!1)},className:`text-purple-300 aria-selected:bg-gray-700`,children:[(0,B.jsx)(Is,{className:`mr-2 h-4 w-4`}),`Use custom repo ID…`]})})]})]})})]})},pre=1500;function dL(e,t=!0){let{baseUrl:n,fetchWithHeaders:r}=wl(),[i,a]=(0,_.useState)(`idle`),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)([]),u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!t)return;let i=!1;return r(`${n}/${e}/install-status`).then(e=>e.json()).then(e=>{i||(a(e.state),s(e.error),e.logs.length>0&&l(e.logs))}).catch(()=>{}),()=>{i=!0}},[t,n,r,e]),(0,_.useEffect)(()=>{if(i!==`installing`)return;let t=setInterval(async()=>{try{let t=await r(`${n}/${e}/install-status`);if(!t.ok)return;let i=await t.json();i.logs&&i.logs.length>0&&l(e=>[...e,...i.logs]),i.state!==`installing`&&(a(i.state),s(i.error))}catch{}},pre);return()=>clearInterval(t)},[i,n,r,e]),(0,_.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[c]),{state:i,error:o,logs:c,logBoxRef:u,handleInstall:(0,_.useCallback)(async()=>{a(`installing`),s(null),l([]);try{let t=await r(`${n}/${e}/install`,{method:`POST`}),i=await t.json();if(!i.started&&t.ok)return;t.ok||(a(`error`),s(i.message||`Install request failed (${t.status})`))}catch(e){a(`error`),s(`Install request failed: ${e instanceof Error?e.message:String(e)}`)}},[n,r,e]),handleRetry:(0,_.useCallback)(()=>{a(`idle`),s(null),l([])},[])}}function fL(e,t){switch(e){case`done`:return`Install Complete`;case`error`:return`Install Failed`;case`installing`:return`Installing…`;default:return t}}function pL({state:e}){return e===`done`?(0,B.jsx)(_s,{className:`w-6 h-6 text-green-400`}):e===`error`?(0,B.jsx)(ys,{className:`w-6 h-6 text-red-400`}):e===`installing`?(0,B.jsx)(Ns,{className:`w-6 h-6 text-sky-400 animate-spin`}):(0,B.jsx)(Zs,{className:`w-6 h-6 text-amber-400`})}var mL=({state:e,error:t,logs:n,logBoxRef:r,onInstall:i,onRetry:a,installHint:o,packageName:s,idleDescription:c,doneDescription:l})=>{let{toast:u}=ea();return(0,B.jsxs)(B.Fragment,{children:[e===`idle`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`text-slate-300`,children:c}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`code`,{className:`flex-1 bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono`,children:o}),(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:async()=>{try{await navigator.clipboard.writeText(o),u({title:`Copied`,description:o})}catch{u({title:`Copy failed`,description:`Select the command and copy manually.`,variant:`destructive`})}},className:`text-slate-400 hover:text-white`,"aria-label":`Copy install command`,children:(0,B.jsx)(Cs,{className:`w-4 h-4`})})]}),(0,B.jsx)(q,{onClick:i,className:`bg-green-500 hover:bg-green-600 text-white font-semibold`,children:`Install Now`})]}),e===`installing`&&(0,B.jsxs)(`p`,{className:`text-slate-300`,children:[`Installing`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:s}),`. This usually takes about 10 seconds.`]}),e===`done`&&(0,B.jsx)(`div`,{className:`space-y-3 text-slate-300`,children:l}),e===`error`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`text-red-300`,children:t||`Install failed.`}),(0,B.jsx)(q,{onClick:a,className:`bg-slate-700 hover:bg-slate-600 text-white`,children:`Try again`})]}),e===`error`&&n.length>0&&(0,B.jsx)(`div`,{ref:r,className:`bg-slate-900 rounded-lg p-3 h-48 overflow-y-auto font-mono text-xs border border-slate-700 text-slate-300 whitespace-pre-wrap break-words`,children:n.map((e,t)=>(0,B.jsx)(`div`,{children:e.message},t))})]})},hL=({purpose:e})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`p`,{children:[`Install complete. Restart`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`to enable `,e,`:`]}),(0,B.jsxs)(`ol`,{className:`list-decimal list-inside space-y-2 pl-1`,children:[(0,B.jsxs)(`li`,{children:[`Press`,` `,(0,B.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-slate-900 border border-slate-600 text-xs font-mono text-slate-200`,children:`Ctrl+C`}),` `,`in the terminal running`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),`.`]}),(0,B.jsxs)(`li`,{children:[`Run`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`again.`]})]})]}),mre=({open:e,onOpenChange:t,installHint:n})=>{let r=dL(`system/wandb-extra`,e);return(0,B.jsx)($d,{open:e,onOpenChange:t,children:(0,B.jsxs)(nf,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,B.jsxs)(rf,{children:[(0,B.jsxs)(of,{className:`flex items-center gap-3 text-white`,children:[(0,B.jsx)(pL,{state:r.state}),fL(r.state,`Weights & Biases Not Installed`)]}),(0,B.jsx)(sf,{className:`sr-only`,children:`Install the wandb package to enable W&B logging.`})]}),(0,B.jsx)(`div`,{className:`space-y-4`,children:(0,B.jsx)(mL,{state:r.state,error:r.error,logs:r.logs,logBoxRef:r.logBoxRef,onInstall:r.handleInstall,onRetry:r.handleRetry,installHint:n,packageName:`wandb`,idleTitle:`Weights & Biases Not Installed`,idleDescription:(0,B.jsxs)(B.Fragment,{children:[`Enabling W&B logging requires the`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`wandb`}),` `,`package, which isn't installed in this environment. Install it to log this run to W&B.`]}),doneDescription:(0,B.jsx)(hL,{purpose:`W&B logging`})})})]})})},hre=({config:e,updateConfig:t,datasets:n,datasetsLoading:r})=>{let{baseUrl:i,fetchWithHeaders:a}=wl(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(`pip install wandb`);return(0,B.jsxs)(cb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(lb,{children:(0,B.jsx)(ub,{className:`text-white`,children:`Run Configuration`})}),(0,B.jsxs)(fb,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{className:`text-slate-300`,children:`Dataset Repository ID *`}),(0,B.jsx)(`div`,{className:`mt-1`,children:(0,B.jsx)(fre,{datasets:n,loading:r,value:e.dataset_repo_id||null,onChange:e=>{e&&t(`dataset_repo_id`,e)}})}),(0,B.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`HuggingFace Hub dataset repository ID`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_type`,className:`text-slate-300`,children:`Policy`}),(0,B.jsxs)(Iy,{value:e.policy_type,onValueChange:e=>t(`policy_type`,e),children:[(0,B.jsx)(Ry,{id:`policy_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,B.jsx)(Ly,{})}),(0,B.jsxs)(Vy,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,B.jsx)(Uy,{value:`act`,children:`ACT (Action Chunking Transformer)`}),(0,B.jsx)(Uy,{value:`diffusion`,children:`Diffusion Policy`}),(0,B.jsx)(Uy,{value:`pi0`,children:`PI0`}),(0,B.jsx)(Uy,{value:`smolvla`,children:`SmolVLA`}),(0,B.jsx)(Uy,{value:`groot`,children:`GR00T N1.7`}),(0,B.jsx)(Uy,{value:`tdmpc`,children:`TD-MPC`}),(0,B.jsx)(Uy,{value:`vqbet`,children:`VQ-BeT`}),(0,B.jsx)(Uy,{value:`pi0_fast`,children:`PI0 Fast`}),(0,B.jsx)(Uy,{value:`sac`,children:`SAC`}),(0,B.jsx)(Uy,{value:`reward_classifier`,children:`Reward Classifier`})]})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`steps`,className:`text-slate-300`,children:`Training Steps`}),(0,B.jsx)(x_,{id:`steps`,value:e.steps,onChange:e=>{e!==void 0&&t(`steps`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`batch_size`,className:`text-slate-300`,children:`Batch Size`}),(0,B.jsx)(x_,{id:`batch_size`,value:e.batch_size,onChange:e=>{e!==void 0&&t(`batch_size`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,B.jsx)(pN,{id:`wandb_enable`,checked:e.wandb_enable,onCheckedChange:async e=>{if(!e){t(`wandb_enable`,!1);return}try{let e=await(await a(`${i}/system/wandb-extra`)).json();e.available?t(`wandb_enable`,!0):(l(e.install_hint),s(!0))}catch{t(`wandb_enable`,!0)}},className:`data-[state=checked]:bg-green-500`}),(0,B.jsx)(J,{htmlFor:`wandb_enable`,className:`text-slate-300`,children:`Enable Weights & Biases`})]})]}),(0,B.jsx)(mre,{open:o,onOpenChange:s,installHint:c}),e.wandb_enable&&(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`wandb_project`,className:`text-slate-300`,children:`W&B Project Name`}),(0,B.jsx)(b_,{id:`wandb_project`,value:e.wandb_project||``,onChange:e=>t(`wandb_project`,e.target.value||void 0),placeholder:`my-robotics-project`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]})},gL={policy_base_model_path:`nvidia/GR00T-N1.7-3B`,policy_embodiment_tag:`new_embodiment`,policy_chunk_size:16,policy_n_action_steps:16,policy_use_relative_actions:!0,policy_relative_exclude_joints:[`gripper`],policy_use_bf16:!0,dataset_image_transforms_enable:!0},gre=({config:e,updateConfig:t})=>{let n=e.policy_type===`groot`,r=(0,_.useRef)(!1);if((0,_.useEffect)(()=>{!n||r.current||(r.current=!0,Object.keys(gL).forEach(n=>{e[n]===void 0&&t(n,gL[n])}))},[n]),!n)return null;let i=(e.policy_relative_exclude_joints??[]).join(`, `);return(0,B.jsxs)(cb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(lb,{children:(0,B.jsx)(ub,{className:`text-white`,children:`GR00T N1.7`})}),(0,B.jsxs)(fb,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_base_model_path`,className:`text-slate-300`,children:`Base Model Path`}),(0,B.jsx)(b_,{id:`policy_base_model_path`,value:e.policy_base_model_path??``,onChange:e=>t(`policy_base_model_path`,e.target.value||void 0),placeholder:`nvidia/GR00T-N1.7-3B`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`}),(0,B.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`HuggingFace repo of the pretrained GR00T backbone to fine-tune.`})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_embodiment_tag`,className:`text-slate-300`,children:`Embodiment Tag`}),(0,B.jsx)(b_,{id:`policy_embodiment_tag`,value:e.policy_embodiment_tag??``,onChange:e=>t(`policy_embodiment_tag`,e.target.value||void 0),placeholder:`new_embodiment`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_relative_exclude_joints`,className:`text-slate-300`,children:`Relative Exclude Joints`}),(0,B.jsx)(b_,{id:`policy_relative_exclude_joints`,value:i,onChange:e=>t(`policy_relative_exclude_joints`,e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)),placeholder:`gripper`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`}),(0,B.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`Comma-separated joints kept absolute when relative actions are on.`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_chunk_size`,className:`text-slate-300`,children:`Chunk Size`}),(0,B.jsx)(x_,{id:`policy_chunk_size`,value:e.policy_chunk_size,onChange:e=>t(`policy_chunk_size`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_n_action_steps`,className:`text-slate-300`,children:`Action Steps`}),(0,B.jsx)(x_,{id:`policy_n_action_steps`,value:e.policy_n_action_steps,onChange:e=>t(`policy_n_action_steps`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(pN,{id:`policy_use_relative_actions`,checked:e.policy_use_relative_actions??!1,onCheckedChange:e=>t(`policy_use_relative_actions`,e),className:`data-[state=checked]:bg-green-500`}),(0,B.jsx)(J,{htmlFor:`policy_use_relative_actions`,className:`text-slate-300`,children:`Use Relative Actions`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(pN,{id:`policy_use_bf16`,checked:e.policy_use_bf16??!1,onCheckedChange:e=>t(`policy_use_bf16`,e),className:`data-[state=checked]:bg-green-500`}),(0,B.jsx)(J,{htmlFor:`policy_use_bf16`,className:`text-slate-300`,children:`Use bfloat16`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(pN,{id:`dataset_image_transforms_enable`,checked:e.dataset_image_transforms_enable??!1,onCheckedChange:e=>t(`dataset_image_transforms_enable`,e),className:`data-[state=checked]:bg-green-500`}),(0,B.jsx)(J,{htmlFor:`dataset_image_transforms_enable`,className:`text-slate-300`,children:`Enable Image Augmentations`})]})]})]})]})},_L=({children:e})=>(0,B.jsx)(`h4`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider`,children:e}),_re=({config:e,updateConfig:t})=>{let[n,r]=(0,_.useState)(!1);return(0,B.jsxs)(cb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsxs)(lb,{role:`button`,tabIndex:0,"aria-expanded":n,onClick:()=>r(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r(e=>!e))},className:`cursor-pointer select-none flex flex-row items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`text-white font-semibold`,children:`Advanced`}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1 text-slate-400 text-sm`,children:[n?(0,B.jsx)(us,{className:`w-4 h-4`}):(0,B.jsx)(fs,{className:`w-4 h-4`}),n?`Hide`:`Show`]})]}),n&&(0,B.jsxs)(fb,{className:`space-y-8`,children:[(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(_L,{children:`Policy`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`policy_device`,className:`text-slate-300`,children:`Device`}),(0,B.jsxs)(Iy,{value:e.policy_device||`cuda`,onValueChange:e=>t(`policy_device`,e),children:[(0,B.jsx)(Ry,{id:`policy_device`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,B.jsx)(Ly,{})}),(0,B.jsxs)(Vy,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,B.jsx)(Uy,{value:`cuda`,children:`CUDA (GPU)`}),(0,B.jsx)(Uy,{value:`cpu`,children:`CPU`}),(0,B.jsx)(Uy,{value:`mps`,children:`MPS (Apple Silicon)`})]})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,B.jsx)(pN,{id:`policy_use_amp`,checked:e.policy_use_amp,onCheckedChange:e=>t(`policy_use_amp`,e)}),(0,B.jsx)(J,{htmlFor:`policy_use_amp`,className:`text-slate-300`,children:`Use Automatic Mixed Precision`})]})]})]}),(0,B.jsx)(EN,{className:`bg-slate-700`}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(_L,{children:`Training`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`seed`,className:`text-slate-300`,children:`Random Seed`}),(0,B.jsx)(x_,{id:`seed`,value:e.seed,onChange:e=>t(`seed`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`num_workers`,className:`text-slate-300`,children:`Number of Workers`}),(0,B.jsx)(x_,{id:`num_workers`,value:e.num_workers,onChange:e=>{e!==void 0&&t(`num_workers`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,B.jsx)(EN,{className:`bg-slate-700`}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(_L,{children:`Optimizer`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`optimizer_type`,className:`text-slate-300`,children:`Optimizer`}),(0,B.jsxs)(Iy,{value:e.optimizer_type||`adam`,onValueChange:e=>t(`optimizer_type`,e),children:[(0,B.jsx)(Ry,{id:`optimizer_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,B.jsx)(Ly,{})}),(0,B.jsxs)(Vy,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,B.jsx)(Uy,{value:`adam`,children:`Adam`}),(0,B.jsx)(Uy,{value:`adamw`,children:`AdamW`}),(0,B.jsx)(Uy,{value:`sgd`,children:`SGD`}),(0,B.jsx)(Uy,{value:`multi_adam`,children:`Multi Adam`})]})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`optimizer_lr`,className:`text-slate-300`,children:`Learning Rate`}),(0,B.jsx)(x_,{id:`optimizer_lr`,integer:!1,step:`0.0001`,value:e.optimizer_lr,onChange:e=>t(`optimizer_lr`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`optimizer_weight_decay`,className:`text-slate-300`,children:`Weight Decay`}),(0,B.jsx)(x_,{id:`optimizer_weight_decay`,integer:!1,step:`0.0001`,value:e.optimizer_weight_decay,onChange:e=>t(`optimizer_weight_decay`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`optimizer_grad_clip_norm`,className:`text-slate-300`,children:`Gradient Clipping`}),(0,B.jsx)(x_,{id:`optimizer_grad_clip_norm`,integer:!1,step:`0.0001`,value:e.optimizer_grad_clip_norm,onChange:e=>t(`optimizer_grad_clip_norm`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,B.jsx)(EN,{className:`bg-slate-700`}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(_L,{children:`Logging & Checkpointing`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`log_freq`,className:`text-slate-300`,children:`Log Frequency`}),(0,B.jsx)(x_,{id:`log_freq`,value:e.log_freq,onChange:e=>{e!==void 0&&t(`log_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`save_freq`,className:`text-slate-300`,children:`Save Frequency`}),(0,B.jsx)(x_,{id:`save_freq`,value:e.save_freq,onChange:e=>{e!==void 0&&t(`save_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(pN,{id:`save_checkpoint`,checked:e.save_checkpoint,onCheckedChange:e=>t(`save_checkpoint`,e)}),(0,B.jsx)(J,{htmlFor:`save_checkpoint`,className:`text-slate-300`,children:`Save Checkpoints`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(pN,{id:`resume`,checked:e.resume,onCheckedChange:e=>t(`resume`,e)}),(0,B.jsx)(J,{htmlFor:`resume`,className:`text-slate-300`,children:`Resume from Checkpoint`})]})]}),e.wandb_enable&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(EN,{className:`bg-slate-700`}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(_L,{children:`Weights & Biases`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`wandb_entity`,className:`text-slate-300`,children:`W&B Entity (optional)`}),(0,B.jsx)(b_,{id:`wandb_entity`,value:e.wandb_entity||``,onChange:e=>t(`wandb_entity`,e.target.value||void 0),placeholder:`your-username`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`wandb_notes`,className:`text-slate-300`,children:`W&B Notes (optional)`}),(0,B.jsx)(b_,{id:`wandb_notes`,value:e.wandb_notes||``,onChange:e=>t(`wandb_notes`,e.target.value||void 0),placeholder:`Training run notes...`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`wandb_mode`,className:`text-slate-300`,children:`W&B Mode`}),(0,B.jsxs)(Iy,{value:e.wandb_mode||`online`,onValueChange:e=>t(`wandb_mode`,e),children:[(0,B.jsx)(Ry,{id:`wandb_mode`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,B.jsx)(Ly,{})}),(0,B.jsxs)(Vy,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,B.jsx)(Uy,{value:`online`,children:`Online`}),(0,B.jsx)(Uy,{value:`offline`,children:`Offline`}),(0,B.jsx)(Uy,{value:`disabled`,children:`Disabled`})]})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(pN,{id:`wandb_disable_artifact`,checked:e.wandb_disable_artifact,onCheckedChange:e=>t(`wandb_disable_artifact`,e)}),(0,B.jsx)(J,{htmlFor:`wandb_disable_artifact`,className:`text-slate-300`,children:`Disable Artifacts`})]})]})]}),!e.wandb_enable&&(0,B.jsx)(EN,{className:`bg-slate-700`}),(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsx)(_L,{children:`Misc`}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(pN,{id:`use_policy_training_preset`,checked:e.use_policy_training_preset,onCheckedChange:e=>t(`use_policy_training_preset`,e)}),(0,B.jsx)(J,{htmlFor:`use_policy_training_preset`,className:`text-slate-300`,children:`Use Policy Training Preset`})]})]})]})]})},vre=(e,t)=>`$${(t===`minute`?e*60:e).toFixed(2)}/hr`,yre=e=>{let t=e.accelerator?e.accelerator:e.cpu;return`${e.pretty_name} · ${t} · ${vre(e.unit_cost_usd,e.unit_label)}`},bre=({config:e,updateConfig:t,authenticated:n,flavors:r,loading:i})=>{let a=e.target,o=a.runner===`local`?`local`:`hf:${a.flavor??``}`;return(0,B.jsxs)(cb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(lb,{children:(0,B.jsx)(ub,{className:`text-white`,children:`Compute target`})}),(0,B.jsx)(fb,{className:`space-y-3`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{className:`text-slate-300`,children:`Run training on`}),(0,B.jsxs)(Iy,{value:o,onValueChange:e=>{e===`local`?t(`target`,{runner:`local`}):e.startsWith(`hf:`)&&t(`target`,{runner:`hf_cloud`,flavor:e.slice(3)})},children:[(0,B.jsx)(Ry,{className:`bg-slate-900 border-slate-600 text-white rounded-lg mt-1`,children:(0,B.jsx)(Ly,{placeholder:i?`Loading…`:`Select target`})}),(0,B.jsxs)(Vy,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,B.jsx)(Uy,{value:`local`,children:`Local — your machine (free)`}),r.map(e=>(0,B.jsxs)(Uy,{value:`hf:${e.name}`,disabled:!n,children:[yre(e),!n&&(0,B.jsx)(`span`,{className:`text-amber-300 ml-2 text-xs`,children:`log in to HF`})]},e.name))]})]}),(0,B.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`Cost shown is per running hour. Final policy uploads to your HF account when training completes.`})]})})]})},xre=({config:e,updateConfig:t,datasets:n,datasetsLoading:r,authenticated:i,flavors:a,hardwareLoading:o})=>(0,B.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,B.jsx)(bre,{config:e,updateConfig:t,authenticated:i,flavors:a,loading:o}),(0,B.jsx)(hre,{config:e,updateConfig:t,datasets:n,datasetsLoading:r}),(0,B.jsx)(gre,{config:e,updateConfig:t}),(0,B.jsx)(_re,{config:e,updateConfig:t})]}),vL=o(((e,t)=>{t.exports=Array.isArray})),yL=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),bL=o(((e,t)=>{var n=yL(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),xL=o(((e,t)=>{t.exports=bL().Symbol})),Sre=o(((e,t)=>{var n=xL(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),Cre=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),SL=o(((e,t)=>{var n=xL(),r=Sre(),i=Cre(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),CL=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),wL=o(((e,t)=>{var n=SL(),r=CL(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),TL=o(((e,t)=>{var n=vL(),r=wL(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),EL=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),DL=o(((e,t)=>{var n=SL(),r=EL(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),wre=o(((e,t)=>{t.exports=bL()[`__core-js_shared__`]})),Tre=o(((e,t)=>{var n=wre(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),OL=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),Ere=o(((e,t)=>{var n=DL(),r=Tre(),i=EL(),a=OL(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Dre=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),kL=o(((e,t)=>{var n=Ere(),r=Dre();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),AL=o(((e,t)=>{t.exports=kL()(Object,`create`)})),Ore=o(((e,t)=>{var n=AL();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),kre=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),Are=o(((e,t)=>{var n=AL(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),jre=o(((e,t)=>{var n=AL(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),Mre=o(((e,t)=>{var n=AL(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),Nre=o(((e,t)=>{var n=Ore(),r=kre(),i=Are(),a=jre(),o=Mre();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{function n(){this.__data__=[],this.size=0}t.exports=n})),jL=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),ML=o(((e,t)=>{var n=jL();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),Fre=o(((e,t)=>{var n=ML(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),Ire=o(((e,t)=>{var n=ML();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),NL=o(((e,t)=>{var n=ML();function r(e){return n(this.__data__,e)>-1}t.exports=r})),PL=o(((e,t)=>{var n=ML();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),FL=o(((e,t)=>{var n=Pre(),r=Fre(),i=Ire(),a=NL(),o=PL();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{t.exports=kL()(bL(),`Map`)})),LL=o(((e,t)=>{var n=Nre(),r=FL(),i=IL();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),RL=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),zL=o(((e,t)=>{var n=RL();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),BL=o(((e,t)=>{var n=zL();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),VL=o(((e,t)=>{var n=zL();function r(e){return n(this,e).get(e)}t.exports=r})),HL=o(((e,t)=>{var n=zL();function r(e){return n(this,e).has(e)}t.exports=r})),UL=o(((e,t)=>{var n=zL();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),WL=o(((e,t)=>{var n=LL(),r=BL(),i=VL(),a=HL(),o=UL();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{var n=WL(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),KL=o(((e,t)=>{var n=GL(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),qL=o(((e,t)=>{var n=KL(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),JL=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n{var n=xL(),r=JL(),i=vL(),a=wL(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),XL=o(((e,t)=>{var n=YL();function r(e){return e==null?``:n(e)}t.exports=r})),ZL=o(((e,t)=>{var n=vL(),r=TL(),i=qL(),a=XL();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),QL=o(((e,t)=>{var n=wL(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),$L=o(((e,t)=>{var n=ZL(),r=QL();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i{var n=$L();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),tR=o(((e,t)=>{function n(e){return e==null}t.exports=n})),nR=o(((e,t)=>{var n=SL(),r=vL(),i=CL(),a=`[object String]`;function o(e){return typeof e==`string`||!r(e)&&i(e)&&n(e)==a}t.exports=o})),rR=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.server_context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case u:case d:return e;default:switch(e&&=e.$$typeof,e){case c:case s:case l:case p:case f:case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),iR=o(((e,t)=>{t.exports=rR()})),aR=o(((e,t)=>{var n=SL(),r=CL(),i=`[object Number]`;function a(e){return typeof e==`number`||r(e)&&n(e)==i}t.exports=a})),oR=o(((e,t)=>{var n=aR();function r(e){return n(e)&&e!=+e}t.exports=r})),sR=l(nR()),cR=l(oR()),lR=l(eR()),uR=l(aR()),dR=l(tR()),fR=function(e){return e===0?0:e>0?1:-1},pR=function(e){return(0,sR.default)(e)&&e.indexOf(`%`)===e.length-1},Q=function(e){return(0,uR.default)(e)&&!(0,cR.default)(e)},mR=function(e){return(0,dR.default)(e)},hR=function(e){return Q(e)||(0,sR.default)(e)},gR=0,_R=function(e){var t=++gR;return`${e||``}${t}`},vR=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Q(e)&&!(0,sR.default)(e))return n;var i;if(pR(e)){var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return(0,cR.default)(i)&&(i=n),r&&i>t&&(i=t),i},yR=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},bR=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function BR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function VR(e){"@babel/helpers - typeof";return VR=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},VR(e)}var HR={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},UR=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},WR=null,GR=null,KR=function e(t){if(t===WR&&Array.isArray(GR))return GR;var n=[];return _.Children.forEach(t,function(t){(0,dR.default)(t)||((0,IR.isFragment)(t)?n=n.concat(e(t.props.children)):n.push(t))}),GR=n,WR=t,n};function qR(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(function(e){return UR(e)}):[UR(t)],KR(e).forEach(function(e){var t=(0,lR.default)(e,`type.displayName`)||(0,lR.default)(e,`type.name`);r.indexOf(t)!==-1&&n.push(e)}),n}function JR(e,t){var n=qR(e,t);return n&&n[0]}var YR=function(e){if(!e||!e.props)return!1;var t=e.props,n=t.width,r=t.height;return!(!Q(n)||n<=0||!Q(r)||r<=0)},XR=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),ZR=function(e){return e&&e.type&&(0,sR.default)(e.type)&&XR.indexOf(e.type)>=0},QR=function(e){return e&&VR(e)===`object`&&`clipDot`in e},$R=function(e,t,n,r){var i=AR?.[r]??[];return t.startsWith(`data-`)||!(0,FR.default)(e)&&(r&&i.includes(t)||OR.includes(t))||n&&jR.includes(t)},ez=function(e,t,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,_.isValidElement)(e)&&(r=e.props),!(0,TR.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){$R(r?.[e],e,t,n)&&(i[e]=r[e])}),i},tz=function e(t,n){if(t===n)return!0;var r=_.Children.count(t);if(r!==_.Children.count(n))return!1;if(r===0)return!0;if(r===1)return nz(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function lz(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function uz(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,s=e.title,c=e.desc,l=cz(e,oz),u=i||{width:n,height:r,x:0,y:0},d=Zo(`recharts-surface`,a);return _.createElement(`svg`,sz({},ez(l,!0,`svg`),{className:d,width:n,height:r,style:o,viewBox:`${u.x} ${u.y} ${u.width} ${u.height}`}),_.createElement(`title`,null,s),_.createElement(`desc`,null,c),t)}var dz=[`children`,`className`];function fz(){return fz=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mz(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var hz=_.forwardRef(function(e,t){var n=e.children,r=e.className,i=pz(e,dz),a=Zo(`recharts-layer`,r);return _.createElement(`g`,fz({className:a},ez(i,!0),{ref:t}),n)}),gz=!1,_z=function(e,t){var n=[...arguments].slice(2);if(gz&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,function(){return n[r++]}))}},vz=o(((e,t)=>{function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r{var n=vz();function r(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:n(e,t,r)}t.exports=r})),bz=o(((e,t)=>{var n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function r(e){return n.test(e)}t.exports=r})),xz=o(((e,t)=>{function n(e){return e.split(``)}t.exports=n})),Sz=o(((e,t)=>{var n=`\\ud800-\\udfff`,r=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,i=`\\ufe0e\\ufe0f`,a=`[`+n+`]`,o=`[`+r+`]`,s=`\\ud83c[\\udffb-\\udfff]`,c=`(?:`+o+`|`+s+`)`,l=`[^`+n+`]`,u=`(?:\\ud83c[\\udde6-\\uddff]){2}`,d=`[\\ud800-\\udbff][\\udc00-\\udfff]`,f=`\\u200d`,p=c+`?`,m=`[`+i+`]?`,h=`(?:`+f+`(?:`+[l,u,d].join(`|`)+`)`+m+p+`)*`,g=m+p+h,_=`(?:`+[l+o+`?`,o,u,d,a].join(`|`)+`)`,v=RegExp(s+`(?=`+s+`)|`+_+g,`g`);function y(e){return e.match(v)||[]}t.exports=y})),Cz=o(((e,t)=>{var n=xz(),r=bz(),i=Sz();function a(e){return r(e)?i(e):n(e)}t.exports=a})),wz=o(((e,t)=>{var n=yz(),r=bz(),i=Cz(),a=XL();function o(e){return function(t){t=a(t);var o=r(t)?i(t):void 0,s=o?o[0]:t.charAt(0),c=o?n(o,1).join(``):t.slice(1);return s[e]()+c}}t.exports=o})),Tz=o(((e,t)=>{t.exports=wz()(`toUpperCase`)}));function Ez(e){return function(){return e}}var Dz=Math.cos,Oz=Math.sin,kz=Math.sqrt,Az=Math.PI;Az/2;var jz=2*Az,Mz=Math.PI,Nz=2*Mz,Pz=1e-6,Fz=Nz-Pz;function Iz(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return Iz;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tPz)if(!(Math.abs(u*s-c*l)>Pz)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((Mz-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Pz&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Pz||Math.abs(this._y1-l)>Pz)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Nz+Nz),d>Fz?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>Pz&&this._append`A${n},${n},0,${+(d>=Mz)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function zz(){return new Rz}zz.prototype=Rz.prototype;function Bz(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Rz(t)}Array.prototype.slice;function Vz(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Hz(e){this._context=e}Hz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Uz(e){return new Hz(e)}function Wz(e){return e[0]}function Gz(e){return e[1]}function Kz(e,t){var n=Ez(!0),r=null,i=Uz,a=null,o=Bz(s);e=typeof e==`function`?e:e===void 0?Wz:Ez(e),t=typeof t==`function`?t:t===void 0?Gz:Ez(t);function s(s){var c,l=(s=Vz(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return Kz().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:Ez(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:Ez(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:Ez(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:Ez(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:Ez(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:Ez(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:Ez(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Jz=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}};function Yz(e){return new Jz(e,!0)}function Xz(e){return new Jz(e,!1)}var Zz={draw(e,t){let n=kz(t/Az);e.moveTo(n,0),e.arc(0,0,n,0,jz)}},Qz={draw(e,t){let n=kz(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},$z=kz(1/3),eB=$z*2,tB={draw(e,t){let n=kz(t/eB),r=n*$z;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},nB={draw(e,t){let n=kz(t),r=-n/2;e.rect(r,r,n,n)}},rB=.8908130915292852,iB=Oz(Az/10)/Oz(7*Az/10),aB=Oz(jz/10)*iB,oB=-Dz(jz/10)*iB,sB={draw(e,t){let n=kz(t*rB),r=aB*n,i=oB*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=jz*t/5,o=Dz(a),s=Oz(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},cB=kz(3),lB={draw(e,t){let n=-kz(t/(cB*3));e.moveTo(0,n*2),e.lineTo(-cB*n,-n),e.lineTo(cB*n,-n),e.closePath()}},uB=-.5,dB=kz(3)/2,fB=1/kz(12),pB=(fB/2+1)*3,mB={draw(e,t){let n=kz(t/pB),r=n/2,i=n*fB,a=r,o=n*fB+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(uB*r-dB*i,dB*r+uB*i),e.lineTo(uB*a-dB*o,dB*a+uB*o),e.lineTo(uB*s-dB*c,dB*s+uB*c),e.lineTo(uB*r+dB*i,uB*i-dB*r),e.lineTo(uB*a+dB*o,uB*o-dB*a),e.lineTo(uB*s+dB*c,uB*c-dB*s),e.closePath()}};function hB(e,t){let n=null,r=Bz(i);e=typeof e==`function`?e:Ez(e||Zz),t=typeof t==`function`?t:Ez(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:Ez(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:Ez(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function gB(){}function _B(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function vB(e){this._context=e}vB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:_B(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:_B(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yB(e){return new vB(e)}function bB(e){this._context=e}bB.prototype={areaStart:gB,areaEnd:gB,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:_B(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function xB(e){return new bB(e)}function SB(e){this._context=e}SB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:_B(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function CB(e){return new SB(e)}function wB(e){this._context=e}wB.prototype={areaStart:gB,areaEnd:gB,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function TB(e){return new wB(e)}function EB(e){return e<0?-1:1}function DB(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(EB(a)+EB(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function OB(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function kB(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function AB(e){this._context=e}AB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:kB(this,this._t0,OB(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,kB(this,OB(this,n=DB(this,e,t)),n);break;default:kB(this,this._t0,n=DB(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function jB(e){this._context=new MB(e)}(jB.prototype=Object.create(AB.prototype)).point=function(e,t){AB.prototype.point.call(this,t,e)};function MB(e){this._context=e}MB.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function NB(e){return new AB(e)}function PB(e){return new jB(e)}function FB(e){this._context=e}FB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=IB(e),i=IB(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}};function zB(e){return new RB(e,.5)}function BB(e){return new RB(e,0)}function VB(e){return new RB(e,1)}function HB(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function WB(e,t){return e[t]}function GB(e){let t=[];return t.key=e,t}function KB(){var e=Ez([]),t=UB,n=HB,r=WB;function i(i){var a=Array.from(e.apply(this,arguments),GB),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oV(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var sV={symbolCircle:Zz,symbolCross:Qz,symbolDiamond:tB,symbolSquare:nB,symbolStar:sB,symbolTriangle:lB,symbolWye:mB},cV=Math.PI/180,lV=function(e){return sV[`symbol${(0,XB.default)(e)}`]||Zz},uV=function(e,t,n){if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*cV;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},dV=function(e,t){sV[`symbol${(0,XB.default)(e)}`]=t},fV=function(e){var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=tV(tV({},aV(e,QB)),{},{type:n,size:i,sizeType:o}),c=function(){var e=lV(n);return hB().type(e).size(uV(i,o,n))()},l=s.className,u=s.cx,d=s.cy,f=ez(s,!0);return u===+u&&d===+d&&i===+i?_.createElement(`path`,$B({},f,{className:Zo(`recharts-symbols`,l),transform:`translate(${u}, ${d})`,d:c()})):null};fV.registerSymbol=dV;function pV(e){"@babel/helpers - typeof";return pV=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},pV(e)}function mV(){return mV=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var f=t.inactive?o:t.color;return _.createElement(`li`,pV({className:u,style:c,key:`legend-item-${n}`},NR(e.props,t,n)),_.createElement(lz,{width:r,height:r,viewBox:s,style:l},e.renderIcon(t)),_.createElement(`span`,{className:`recharts-legend-item-text`,style:{color:f}},i?i(d,t,n):d))})}},{key:`render`,value:function(){var e=this.props,t=e.payload,n=e.layout,r=e.align;if(!t||!t.length)return null;var i={padding:0,margin:0,textAlign:n===`horizontal`?r:`left`};return _.createElement(`ul`,{className:`recharts-default-legend`,style:i},this.renderItems())}}])}(_.PureComponent);EV(AV,`displayName`,`Legend`),EV(AV,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`middle`,inactiveColor:`#ccc`});var jV=o(((e,t)=>{var n=PL();function r(){this.__data__=new n,this.size=0}t.exports=r})),MV=o(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),NV=o(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),PV=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),FV=o(((e,t)=>{var n=PL(),r=FL(),i=UL(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length{var n=PL(),r=jV(),i=MV(),a=NV(),o=PV(),s=FV();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),LV=o(((e,t)=>{var n=`__lodash_hash_undefined__`;function r(e){return this.__data__.set(e,n),this}t.exports=r})),RV=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),zV=o(((e,t)=>{var n=UL(),r=LV(),i=RV();function a(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new n;++t{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{function n(e,t){return e.has(t)}t.exports=n})),HV=o(((e,t)=>{var n=zV(),r=BV(),i=VV(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g{t.exports=xL().Uint8Array})),WV=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),GV=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}t.exports=n})),KV=o(((e,t)=>{var n=SL(),r=UV(),i=ML(),a=HV(),o=WV(),s=GV(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),qV=o(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n{var n=qV(),r=yL();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),YV=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n{function n(){return[]}t.exports=n})),ZV=o(((e,t)=>{var n=YV(),r=XV(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),QV=o(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n{var n=CL(),r=wL(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),eH=o(((e,t)=>{var n=$V(),r=wL(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),tH=o(((e,t)=>{function n(){return!1}t.exports=n})),nH=o(((e,t)=>{var n=xL(),r=tH(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),rH=o(((e,t)=>{var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t??=n,!!t&&(i==`number`||i!=`symbol`&&r.test(e))&&e>-1&&e%1==0&&e{var n=9007199254740991;function r(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=n}t.exports=r})),aH=o(((e,t)=>{var n=CL(),r=iH(),i=wL(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),oH=o(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),sH=o(((e,t)=>{var n=bL(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),cH=o(((e,t)=>{var n=aH(),r=oH(),i=sH(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),lH=o(((e,t)=>{var n=QV(),r=eH(),i=yL(),a=nH(),o=rH(),s=cH(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),uH=o(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),dH=o(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),fH=o(((e,t)=>{t.exports=dH()(Object.keys,Object)})),pH=o(((e,t)=>{var n=uH(),r=fH(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),mH=o(((e,t)=>{var n=OL(),r=iH();function i(e){return e!=null&&r(e.length)&&!n(e)}t.exports=i})),hH=o(((e,t)=>{var n=lH(),r=pH(),i=mH();function a(e){return i(e)?n(e):r(e)}t.exports=a})),gH=o(((e,t)=>{var n=JV(),r=ZV(),i=hH();function a(e){return n(e,i,r)}t.exports=a})),_H=o(((e,t)=>{var n=gH(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f{t.exports=AL()(xL(),`DataView`)})),yH=o(((e,t)=>{t.exports=AL()(xL(),`Promise`)})),bH=o(((e,t)=>{t.exports=AL()(xL(),`Set`)})),xH=o(((e,t)=>{t.exports=AL()(xL(),`WeakMap`)})),SH=o(((e,t)=>{var n=vH(),r=FL(),i=yH(),a=bH(),o=xH(),s=CL(),c=kL(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),CH=o(((e,t)=>{var n=IV(),r=HV(),i=KV(),a=_H(),o=SH(),s=yL(),c=nH(),l=cH(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),wH=o(((e,t)=>{var n=CH(),r=wL();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),TH=o(((e,t)=>{var n=IV(),r=wH(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c{var n=DL();function r(e){return e===e&&!n(e)}t.exports=r})),DH=o(((e,t)=>{var n=EH(),r=hH();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),OH=o(((e,t)=>{function n(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),kH=o(((e,t)=>{var n=TH(),r=DH(),i=OH();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),AH=o(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),jH=o(((e,t)=>{var n=XL(),r=eH(),i=yL(),a=rH(),o=iH(),s=ZL();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l{var n=AH(),r=jH();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),NH=o(((e,t)=>{var n=wH(),r=$L(),i=MH(),a=EL(),o=EH(),s=OH(),c=ZL(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),PH=o(((e,t)=>{function n(e){return e}t.exports=n})),FH=o(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),IH=o(((e,t)=>{var n=QL();function r(e){return function(t){return n(t,e)}}t.exports=r})),LH=o(((e,t)=>{var n=FH(),r=IH(),i=EL(),a=ZL();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),RH=o(((e,t)=>{var n=kH(),r=NH(),i=PH(),a=yL(),o=LH();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),zH=o(((e,t)=>{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a{function n(e){return e!==e}t.exports=n})),VH=o(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r{var n=zH(),r=BH(),i=VH();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),UH=o(((e,t)=>{var n=HH();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),WH=o(((e,t)=>{function n(e,t,n){for(var r=-1,i=e==null?0:e.length;++r{function n(){}t.exports=n})),KH=o(((e,t)=>{var n=bH(),r=GH(),i=GV();t.exports=n&&1/i(new n([,-0]))[1]==1/0?function(e){return new n(e)}:r})),qH=o(((e,t)=>{var n=zV(),r=UH(),i=WH(),a=VV(),o=KH(),s=GV(),c=200;function l(e,t,l){var u=-1,d=r,f=e.length,p=!0,m=[],h=m;if(l)p=!1,d=i;else if(f>=c){var g=t?null:o(e);if(g)return s(g);p=!1,d=a,h=new n}else h=t?[]:m;outer:for(;++u{var n=RH(),r=qH();function i(e,t){return e&&e.length?r(e,n(t,2)):[]}t.exports=i}))());function YH(e,t,n){return t===!0?(0,JH.default)(e,n):(0,PR.default)(t)?(0,JH.default)(e,t):e}function XH(e){"@babel/helpers - typeof";return XH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},XH(e)}var ZH=[`ref`];function QH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $H(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mU(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hU(e){return e.value}function gU(e,t){if(_.isValidElement(e))return _.cloneElement(e,t);if(typeof e==`function`)return _.createElement(e,t);t.ref;var n=pU(t,ZH);return _.createElement(AV,n)}var _U=1,vU=function(e){function t(){var e;eU(this,t);var n=[...arguments];return e=rU(this,t,[].concat(n)),uU(e,`lastBoundingBox`,{width:-1,height:-1}),e}return cU(t,e),nU(t,[{key:`componentDidMount`,value:function(){this.updateBBox()}},{key:`componentDidUpdate`,value:function(){this.updateBBox()}},{key:`getBBox`,value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();return e.height=this.wrapperNode.offsetHeight,e.width=this.wrapperNode.offsetWidth,e}return null}},{key:`updateBBox`,value:function(){var e=this.props.onBBoxUpdate,t=this.getBBox();t?(Math.abs(t.width-this.lastBoundingBox.width)>_U||Math.abs(t.height-this.lastBoundingBox.height)>_U)&&(this.lastBoundingBox.width=t.width,this.lastBoundingBox.height=t.height,e&&e(t)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,e&&e(null))}},{key:`getBBoxSnapshot`,value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?$H({},this.lastBoundingBox):{width:0,height:0}}},{key:`getDefaultPosition`,value:function(e){var t=this.props,n=t.layout,r=t.align,i=t.verticalAlign,a=t.margin,o=t.chartWidth,s=t.chartHeight,c,l;if(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))if(r===`center`&&n===`vertical`){var u=this.getBBoxSnapshot();c={left:((o||0)-u.width)/2}}else c=r===`right`?{right:a&&a.right||0}:{left:a&&a.left||0};if(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))if(i===`middle`){var d=this.getBBoxSnapshot();l={top:((s||0)-d.height)/2}}else l=i===`bottom`?{bottom:a&&a.bottom||0}:{top:a&&a.top||0};return $H($H({},c),l)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.content,r=t.width,i=t.height,a=t.wrapperStyle,o=t.payloadUniqBy,s=t.payload,c=$H($H({position:`absolute`,width:r||`auto`,height:i||`auto`},this.getDefaultPosition(a)),a);return _.createElement(`div`,{className:`recharts-legend-wrapper`,style:c,ref:function(t){e.wrapperNode=t}},gU(n,$H($H({},this.props),{},{payload:YH(s,o,hU)})))}}],[{key:`getWithHeight`,value:function(e,t){var n=$H($H({},this.defaultProps),e.props).layout;return n===`vertical`&&Q(e.props.height)?{height:e.props.height}:n===`horizontal`?{width:e.props.width||t}:null}}])}(_.PureComponent);uU(vU,`displayName`,`Legend`),uU(vU,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`bottom`});var yU=o(((e,t)=>{var n=SL(),r=eH(),i=yL(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),bU=o(((e,t)=>{var n=qV(),r=yU();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),xU=o(((e,t)=>{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),SU=o(((e,t)=>{t.exports=xU()()})),CU=o(((e,t)=>{var n=SU(),r=hH();function i(e,t){return e&&n(e,t,r)}t.exports=i})),wU=o(((e,t)=>{var n=mH();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o{var n=CU();t.exports=wU()(n)})),EU=o(((e,t)=>{var n=TU(),r=mH();function i(e,t){var i=-1,a=r(e)?Array(e.length):[];return n(e,function(e,n,r){a[++i]=t(e,n,r)}),a}t.exports=i})),DU=o(((e,t)=>{function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}t.exports=n})),OU=o(((e,t)=>{var n=TL();function r(e,t){if(e!==t){var r=e!==void 0,i=e===null,a=e===e,o=n(e),s=t!==void 0,c=t===null,l=t===t,u=n(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e{var n=OU();function r(e,t,r){for(var i=-1,a=e.criteria,o=t.criteria,s=a.length,c=r.length;++i=c?l:l*(r[i]==`desc`?-1:1)}return e.index-t.index}t.exports=r})),AU=o(((e,t)=>{var n=qL(),r=QL(),i=RH(),a=EU(),o=DU(),s=oH(),c=kU(),l=PH(),u=yL();function d(e,t,d){t=t.length?n(t,function(e){return u(e)?function(t){return r(t,e.length===1?e[0]:e)}:e}):[l];var f=-1;return t=n(t,s(i)),o(a(e,function(e,r,i){return{criteria:n(t,function(t){return t(e)}),index:++f,value:e}}),function(e,t){return c(e,t,d)})}t.exports=d})),jU=o(((e,t)=>{function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}t.exports=n})),MU=o(((e,t)=>{var n=jU(),r=Math.max;function i(e,t,i){return t=r(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=r(a.length-t,0),c=Array(s);++o{function n(e){return function(){return e}}t.exports=n})),PU=o(((e,t)=>{var n=AL();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),FU=o(((e,t)=>{var n=NU(),r=PU(),i=PH();t.exports=r?function(e,t){return r(e,`toString`,{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i})),IU=o(((e,t)=>{var n=800,r=16,i=Date.now;function a(e){var t=0,a=0;return function(){var o=i(),s=r-(o-a);if(a=o,s>0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}t.exports=a})),LU=o(((e,t)=>{var n=FU();t.exports=IU()(n)})),RU=o(((e,t)=>{var n=PH(),r=MU(),i=LU();function a(e,t){return i(r(e,t,n),e+``)}t.exports=a})),zU=o(((e,t)=>{var n=ML(),r=mH(),i=rH(),a=DL();function o(e,t,o){if(!a(o))return!1;var s=typeof t;return(s==`number`?r(o)&&i(t,o.length):s==`string`&&t in o)?n(o[t],e):!1}t.exports=o})),BU=l(o(((e,t)=>{var n=bU(),r=AU(),i=RU(),a=zU();t.exports=i(function(e,t){if(e==null)return[];var i=t.length;return i>1&&a(e,t[0],t[1])?t=[]:i>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),r(e,n(t,1),[])})}))());function VU(e){"@babel/helpers - typeof";return VU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},VU(e)}function HU(){return HU=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=t.x),`${oW}-left`,Q(n)&&t&&Q(t.x)&&n=t.y),`${oW}-top`,Q(r)&&t&&Q(t.y)&&rc[r]+l?Math.max(u,c[r]):Math.max(d,c[r])}function uW(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function dW(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,s=e.useTranslate3d,c=e.viewBox,l,u,d;return o.height>0&&o.width>0&&n?(u=lW({allowEscapeViewBox:t,coordinate:n,key:`x`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),d=lW({allowEscapeViewBox:t,coordinate:n,key:`y`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),l=uW({translateX:u,translateY:d,useTranslate3d:s})):l=sW,{cssProperties:l,cssClasses:cW({translateX:u,translateY:d,coordinate:n})}}function fW(e){"@babel/helpers - typeof";return fW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},fW(e)}function pW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mW(e){for(var t=1;tOW||Math.abs(e.height-this.state.lastBoundingBox.height)>OW)&&this.setState({lastBoundingBox:{width:e.width,height:e.height}})}else (this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:`componentDidMount`,value:function(){document.addEventListener(`keydown`,this.handleKeyDown),this.updateBBox()}},{key:`componentWillUnmount`,value:function(){document.removeEventListener(`keydown`,this.handleKeyDown)}},{key:`componentDidUpdate`,value:function(){this.props.active&&this.updateBBox(),this.state.dismissed&&(this.props.coordinate?.x!==this.state.dismissedAtCoordinate.x||this.props.coordinate?.y!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.active,r=t.allowEscapeViewBox,i=t.animationDuration,a=t.animationEasing,o=t.children,s=t.coordinate,c=t.hasPayload,l=t.isAnimationActive,u=t.offset,d=t.position,f=t.reverseDirection,p=t.useTranslate3d,m=t.viewBox,h=t.wrapperStyle,g=dW({allowEscapeViewBox:r,coordinate:s,offsetTopLeft:u,position:d,reverseDirection:f,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:m}),v=g.cssClasses,y=g.cssProperties,b=mW(mW({transition:l&&n?`transform ${i}ms ${a}`:void 0},y),{},{pointerEvents:`none`,visibility:!this.state.dismissed&&n&&c?`visible`:`hidden`,position:`absolute`,top:0,left:0},h);return _.createElement(`div`,{tabIndex:-1,className:v,style:b,ref:function(t){e.wrapperNode=t}},o)}}])}(_.PureComponent),AW={isSsr:function(){return!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)}(),get:function(e){return AW[e]},set:function(e,t){if(typeof e==`string`)AW[e]=t;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(t){AW[t]=e[t]})}}};function jW(e){"@babel/helpers - typeof";return jW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},jW(e)}function MW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function NW(e){for(var t=1;t0;return _.createElement(kW,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:l,active:n,coordinate:s,hasPayload:b,offset:u,position:p,reverseDirection:m,useTranslate3d:h,viewBox:g,wrapperStyle:v},JW(o,NW(NW({},this.props),{},{payload:y})))}}])}(_.PureComponent);WW(YW,`displayName`,`Tooltip`),WW(YW,`defaultProps`,{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:`ease`,contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!AW.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:` : `,trigger:`hover`,useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var XW=o(((e,t)=>{var n=xL();t.exports=function(){return n.Date.now()}})),ZW=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),QW=o(((e,t)=>{var n=ZW(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),$W=o(((e,t)=>{var n=QW(),r=DL(),i=TL(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),eG=o(((e,t)=>{var n=DL(),r=XW(),i=$W(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),tG=l(o(((e,t)=>{var n=eG(),r=DL(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))());function nG(e){"@babel/helpers - typeof";return nG=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},nG(e)}function rG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function iG(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&(e=(0,tG.default)(e,h,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=S.current.getBoundingClientRect(),r=n.width,i=n.height;return D(r,i),t.observe(S.current),function(){t.disconnect()}},[D,h]);var O=(0,_.useMemo)(function(){var e=T.containerWidth,t=T.containerHeight;if(e<0||t<0)return null;gz(fR(o)||fR(c),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,o,c),gz(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var r=fR(o)?e:o,i=fR(c)?t:c;n&&n>0&&(r?i=r/n:i&&(r=i*n),f&&i>f&&(i=f)),gz(r>0||i>0,`The width(%s) and height(%s) of chart should be greater than 0, + H${AV}M${2*i},${n} + A${r},${r},0,1,1,${i},${n}`,className:`recharts-legend-icon`});if(e.type===`rect`)return _.createElement(`path`,{stroke:`none`,fill:a,d:`M0,${AV/8}h${AV}v${AV*3/4}h${-AV}z`,className:`recharts-legend-icon`});if(_.isValidElement(e.legendIcon)){var o=gV({},e);return delete o.legendIcon,_.cloneElement(e.legendIcon,o)}return _.createElement(fV,{fill:a,cx:n,cy:n,size:AV,sizeType:`diameter`,type:e.type})}},{key:`renderItems`,value:function(){var e=this,t=this.props,n=t.payload,r=t.iconSize,i=t.layout,a=t.formatter,o=t.inactiveColor,s={x:0,y:0,width:AV,height:AV},c={display:i===`horizontal`?`inline-block`:`block`,marginRight:10},l={display:`inline-block`,verticalAlign:`middle`,marginRight:4};return n.map(function(t,n){var i=t.formatter||a,u=Zo(DV(DV({"recharts-legend-item":!0},`legend-item-${n}`,!0),`inactive`,t.inactive));if(t.type===`none`)return null;var d=(0,FR.default)(t.value)?null:t.value;_z(!(0,FR.default)(t.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: `);var f=t.inactive?o:t.color;return _.createElement(`li`,mV({className:u,style:c,key:`legend-item-${n}`},PR(e.props,t,n)),_.createElement(uz,{width:r,height:r,viewBox:s,style:l},e.renderIcon(t)),_.createElement(`span`,{className:`recharts-legend-item-text`,style:{color:f}},i?i(d,t,n):d))})}},{key:`render`,value:function(){var e=this.props,t=e.payload,n=e.layout,r=e.align;if(!t||!t.length)return null;var i={padding:0,margin:0,textAlign:n===`horizontal`?r:`left`};return _.createElement(`ul`,{className:`recharts-default-legend`,style:i},this.renderItems())}}])}(_.PureComponent);DV(jV,`displayName`,`Legend`),DV(jV,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`middle`,inactiveColor:`#ccc`});var MV=o(((e,t)=>{var n=FL();function r(){this.__data__=new n,this.size=0}t.exports=r})),NV=o(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),PV=o(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),FV=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),IV=o(((e,t)=>{var n=FL(),r=IL(),i=WL(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length{var n=FL(),r=MV(),i=NV(),a=PV(),o=FV(),s=IV();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),RV=o(((e,t)=>{var n=`__lodash_hash_undefined__`;function r(e){return this.__data__.set(e,n),this}t.exports=r})),zV=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),BV=o(((e,t)=>{var n=WL(),r=RV(),i=zV();function a(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new n;++t{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{function n(e,t){return e.has(t)}t.exports=n})),UV=o(((e,t)=>{var n=BV(),r=VV(),i=HV(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g{t.exports=bL().Uint8Array})),GV=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),KV=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}t.exports=n})),qV=o(((e,t)=>{var n=xL(),r=WV(),i=jL(),a=UV(),o=GV(),s=KV(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),JV=o(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n{var n=JV(),r=vL();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),XV=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n{function n(){return[]}t.exports=n})),QV=o(((e,t)=>{var n=XV(),r=ZV(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),$V=o(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n{var n=SL(),r=CL(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),tH=o(((e,t)=>{var n=eH(),r=CL(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),nH=o(((e,t)=>{function n(){return!1}t.exports=n})),rH=o(((e,t)=>{var n=bL(),r=nH(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),iH=o(((e,t)=>{var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t??=n,!!t&&(i==`number`||i!=`symbol`&&r.test(e))&&e>-1&&e%1==0&&e{var n=9007199254740991;function r(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=n}t.exports=r})),oH=o(((e,t)=>{var n=SL(),r=aH(),i=CL(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),sH=o(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),cH=o(((e,t)=>{var n=yL(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),lH=o(((e,t)=>{var n=oH(),r=sH(),i=cH(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),uH=o(((e,t)=>{var n=$V(),r=tH(),i=vL(),a=rH(),o=iH(),s=lH(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),dH=o(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),fH=o(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),pH=o(((e,t)=>{t.exports=fH()(Object.keys,Object)})),mH=o(((e,t)=>{var n=dH(),r=pH(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),hH=o(((e,t)=>{var n=DL(),r=aH();function i(e){return e!=null&&r(e.length)&&!n(e)}t.exports=i})),gH=o(((e,t)=>{var n=uH(),r=mH(),i=hH();function a(e){return i(e)?n(e):r(e)}t.exports=a})),_H=o(((e,t)=>{var n=YV(),r=QV(),i=gH();function a(e){return n(e,i,r)}t.exports=a})),vH=o(((e,t)=>{var n=_H(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f{t.exports=kL()(bL(),`DataView`)})),bH=o(((e,t)=>{t.exports=kL()(bL(),`Promise`)})),xH=o(((e,t)=>{t.exports=kL()(bL(),`Set`)})),SH=o(((e,t)=>{t.exports=kL()(bL(),`WeakMap`)})),CH=o(((e,t)=>{var n=yH(),r=IL(),i=bH(),a=xH(),o=SH(),s=SL(),c=OL(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),wH=o(((e,t)=>{var n=LV(),r=UV(),i=qV(),a=vH(),o=CH(),s=vL(),c=rH(),l=lH(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),TH=o(((e,t)=>{var n=wH(),r=CL();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),EH=o(((e,t)=>{var n=LV(),r=TH(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c{var n=EL();function r(e){return e===e&&!n(e)}t.exports=r})),OH=o(((e,t)=>{var n=DH(),r=gH();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),kH=o(((e,t)=>{function n(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),AH=o(((e,t)=>{var n=EH(),r=OH(),i=kH();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),jH=o(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),MH=o(((e,t)=>{var n=ZL(),r=tH(),i=vL(),a=iH(),o=aH(),s=QL();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l{var n=jH(),r=MH();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),PH=o(((e,t)=>{var n=TH(),r=eR(),i=NH(),a=TL(),o=DH(),s=kH(),c=QL(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),FH=o(((e,t)=>{function n(e){return e}t.exports=n})),IH=o(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),LH=o(((e,t)=>{var n=$L();function r(e){return function(t){return n(t,e)}}t.exports=r})),RH=o(((e,t)=>{var n=IH(),r=LH(),i=TL(),a=QL();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),zH=o(((e,t)=>{var n=AH(),r=PH(),i=FH(),a=vL(),o=RH();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),BH=o(((e,t)=>{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a{function n(e){return e!==e}t.exports=n})),HH=o(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r{var n=BH(),r=VH(),i=HH();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),WH=o(((e,t)=>{var n=UH();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),GH=o(((e,t)=>{function n(e,t,n){for(var r=-1,i=e==null?0:e.length;++r{function n(){}t.exports=n})),qH=o(((e,t)=>{var n=xH(),r=KH(),i=KV();t.exports=n&&1/i(new n([,-0]))[1]==1/0?function(e){return new n(e)}:r})),JH=o(((e,t)=>{var n=BV(),r=WH(),i=GH(),a=HV(),o=qH(),s=KV(),c=200;function l(e,t,l){var u=-1,d=r,f=e.length,p=!0,m=[],h=m;if(l)p=!1,d=i;else if(f>=c){var g=t?null:o(e);if(g)return s(g);p=!1,d=a,h=new n}else h=t?[]:m;outer:for(;++u{var n=zH(),r=JH();function i(e,t){return e&&e.length?r(e,n(t,2)):[]}t.exports=i}))());function XH(e,t,n){return t===!0?(0,YH.default)(e,n):(0,FR.default)(t)?(0,YH.default)(e,t):e}function ZH(e){"@babel/helpers - typeof";return ZH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ZH(e)}var QH=[`ref`];function $H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eU(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hU(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function gU(e){return e.value}function _U(e,t){if(_.isValidElement(e))return _.cloneElement(e,t);if(typeof e==`function`)return _.createElement(e,t);t.ref;var n=mU(t,QH);return _.createElement(jV,n)}var vU=1,yU=function(e){function t(){var e;tU(this,t);var n=[...arguments];return e=iU(this,t,[].concat(n)),dU(e,`lastBoundingBox`,{width:-1,height:-1}),e}return lU(t,e),rU(t,[{key:`componentDidMount`,value:function(){this.updateBBox()}},{key:`componentDidUpdate`,value:function(){this.updateBBox()}},{key:`getBBox`,value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();return e.height=this.wrapperNode.offsetHeight,e.width=this.wrapperNode.offsetWidth,e}return null}},{key:`updateBBox`,value:function(){var e=this.props.onBBoxUpdate,t=this.getBBox();t?(Math.abs(t.width-this.lastBoundingBox.width)>vU||Math.abs(t.height-this.lastBoundingBox.height)>vU)&&(this.lastBoundingBox.width=t.width,this.lastBoundingBox.height=t.height,e&&e(t)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,e&&e(null))}},{key:`getBBoxSnapshot`,value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?eU({},this.lastBoundingBox):{width:0,height:0}}},{key:`getDefaultPosition`,value:function(e){var t=this.props,n=t.layout,r=t.align,i=t.verticalAlign,a=t.margin,o=t.chartWidth,s=t.chartHeight,c,l;if(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))if(r===`center`&&n===`vertical`){var u=this.getBBoxSnapshot();c={left:((o||0)-u.width)/2}}else c=r===`right`?{right:a&&a.right||0}:{left:a&&a.left||0};if(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))if(i===`middle`){var d=this.getBBoxSnapshot();l={top:((s||0)-d.height)/2}}else l=i===`bottom`?{bottom:a&&a.bottom||0}:{top:a&&a.top||0};return eU(eU({},c),l)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.content,r=t.width,i=t.height,a=t.wrapperStyle,o=t.payloadUniqBy,s=t.payload,c=eU(eU({position:`absolute`,width:r||`auto`,height:i||`auto`},this.getDefaultPosition(a)),a);return _.createElement(`div`,{className:`recharts-legend-wrapper`,style:c,ref:function(t){e.wrapperNode=t}},_U(n,eU(eU({},this.props),{},{payload:XH(s,o,gU)})))}}],[{key:`getWithHeight`,value:function(e,t){var n=eU(eU({},this.defaultProps),e.props).layout;return n===`vertical`&&Q(e.props.height)?{height:e.props.height}:n===`horizontal`?{width:e.props.width||t}:null}}])}(_.PureComponent);dU(yU,`displayName`,`Legend`),dU(yU,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`bottom`});var bU=o(((e,t)=>{var n=xL(),r=tH(),i=vL(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),xU=o(((e,t)=>{var n=JV(),r=bU();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),SU=o(((e,t)=>{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),CU=o(((e,t)=>{t.exports=SU()()})),wU=o(((e,t)=>{var n=CU(),r=gH();function i(e,t){return e&&n(e,t,r)}t.exports=i})),TU=o(((e,t)=>{var n=hH();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o{var n=wU();t.exports=TU()(n)})),DU=o(((e,t)=>{var n=EU(),r=hH();function i(e,t){var i=-1,a=r(e)?Array(e.length):[];return n(e,function(e,n,r){a[++i]=t(e,n,r)}),a}t.exports=i})),OU=o(((e,t)=>{function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}t.exports=n})),kU=o(((e,t)=>{var n=wL();function r(e,t){if(e!==t){var r=e!==void 0,i=e===null,a=e===e,o=n(e),s=t!==void 0,c=t===null,l=t===t,u=n(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e{var n=kU();function r(e,t,r){for(var i=-1,a=e.criteria,o=t.criteria,s=a.length,c=r.length;++i=c?l:l*(r[i]==`desc`?-1:1)}return e.index-t.index}t.exports=r})),jU=o(((e,t)=>{var n=JL(),r=$L(),i=zH(),a=DU(),o=OU(),s=sH(),c=AU(),l=FH(),u=vL();function d(e,t,d){t=t.length?n(t,function(e){return u(e)?function(t){return r(t,e.length===1?e[0]:e)}:e}):[l];var f=-1;return t=n(t,s(i)),o(a(e,function(e,r,i){return{criteria:n(t,function(t){return t(e)}),index:++f,value:e}}),function(e,t){return c(e,t,d)})}t.exports=d})),MU=o(((e,t)=>{function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}t.exports=n})),NU=o(((e,t)=>{var n=MU(),r=Math.max;function i(e,t,i){return t=r(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=r(a.length-t,0),c=Array(s);++o{function n(e){return function(){return e}}t.exports=n})),FU=o(((e,t)=>{var n=kL();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),IU=o(((e,t)=>{var n=PU(),r=FU(),i=FH();t.exports=r?function(e,t){return r(e,`toString`,{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i})),LU=o(((e,t)=>{var n=800,r=16,i=Date.now;function a(e){var t=0,a=0;return function(){var o=i(),s=r-(o-a);if(a=o,s>0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}t.exports=a})),RU=o(((e,t)=>{var n=IU();t.exports=LU()(n)})),zU=o(((e,t)=>{var n=FH(),r=NU(),i=RU();function a(e,t){return i(r(e,t,n),e+``)}t.exports=a})),BU=o(((e,t)=>{var n=jL(),r=hH(),i=iH(),a=EL();function o(e,t,o){if(!a(o))return!1;var s=typeof t;return(s==`number`?r(o)&&i(t,o.length):s==`string`&&t in o)?n(o[t],e):!1}t.exports=o})),VU=l(o(((e,t)=>{var n=xU(),r=jU(),i=zU(),a=BU();t.exports=i(function(e,t){if(e==null)return[];var i=t.length;return i>1&&a(e,t[0],t[1])?t=[]:i>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),r(e,n(t,1),[])})}))());function HU(e){"@babel/helpers - typeof";return HU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},HU(e)}function UU(){return UU=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=t.x),`${sW}-left`,Q(n)&&t&&Q(t.x)&&n=t.y),`${sW}-top`,Q(r)&&t&&Q(t.y)&&rc[r]+l?Math.max(u,c[r]):Math.max(d,c[r])}function dW(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function fW(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,s=e.useTranslate3d,c=e.viewBox,l,u,d;return o.height>0&&o.width>0&&n?(u=uW({allowEscapeViewBox:t,coordinate:n,key:`x`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),d=uW({allowEscapeViewBox:t,coordinate:n,key:`y`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),l=dW({translateX:u,translateY:d,useTranslate3d:s})):l=cW,{cssProperties:l,cssClasses:lW({translateX:u,translateY:d,coordinate:n})}}function pW(e){"@babel/helpers - typeof";return pW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},pW(e)}function mW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hW(e){for(var t=1;tkW||Math.abs(e.height-this.state.lastBoundingBox.height)>kW)&&this.setState({lastBoundingBox:{width:e.width,height:e.height}})}else (this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:`componentDidMount`,value:function(){document.addEventListener(`keydown`,this.handleKeyDown),this.updateBBox()}},{key:`componentWillUnmount`,value:function(){document.removeEventListener(`keydown`,this.handleKeyDown)}},{key:`componentDidUpdate`,value:function(){this.props.active&&this.updateBBox(),this.state.dismissed&&(this.props.coordinate?.x!==this.state.dismissedAtCoordinate.x||this.props.coordinate?.y!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.active,r=t.allowEscapeViewBox,i=t.animationDuration,a=t.animationEasing,o=t.children,s=t.coordinate,c=t.hasPayload,l=t.isAnimationActive,u=t.offset,d=t.position,f=t.reverseDirection,p=t.useTranslate3d,m=t.viewBox,h=t.wrapperStyle,g=fW({allowEscapeViewBox:r,coordinate:s,offsetTopLeft:u,position:d,reverseDirection:f,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:m}),v=g.cssClasses,y=g.cssProperties,b=hW(hW({transition:l&&n?`transform ${i}ms ${a}`:void 0},y),{},{pointerEvents:`none`,visibility:!this.state.dismissed&&n&&c?`visible`:`hidden`,position:`absolute`,top:0,left:0},h);return _.createElement(`div`,{tabIndex:-1,className:v,style:b,ref:function(t){e.wrapperNode=t}},o)}}])}(_.PureComponent),jW={isSsr:function(){return!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)}(),get:function(e){return jW[e]},set:function(e,t){if(typeof e==`string`)jW[e]=t;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(t){jW[t]=e[t]})}}};function MW(e){"@babel/helpers - typeof";return MW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},MW(e)}function NW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function PW(e){for(var t=1;t0;return _.createElement(AW,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:l,active:n,coordinate:s,hasPayload:b,offset:u,position:p,reverseDirection:m,useTranslate3d:h,viewBox:g,wrapperStyle:v},YW(o,PW(PW({},this.props),{},{payload:y})))}}])}(_.PureComponent);GW(XW,`displayName`,`Tooltip`),GW(XW,`defaultProps`,{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:`ease`,contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!jW.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:` : `,trigger:`hover`,useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var ZW=o(((e,t)=>{var n=bL();t.exports=function(){return n.Date.now()}})),QW=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),$W=o(((e,t)=>{var n=QW(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),eG=o(((e,t)=>{var n=$W(),r=EL(),i=wL(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),tG=o(((e,t)=>{var n=EL(),r=ZW(),i=eG(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),nG=l(o(((e,t)=>{var n=tG(),r=EL(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))());function rG(e){"@babel/helpers - typeof";return rG=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},rG(e)}function iG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aG(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&(e=(0,nG.default)(e,h,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=S.current.getBoundingClientRect(),r=n.width,i=n.height;return D(r,i),t.observe(S.current),function(){t.disconnect()}},[D,h]);var O=(0,_.useMemo)(function(){var e=T.containerWidth,t=T.containerHeight;if(e<0||t<0)return null;_z(pR(o)||pR(c),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,o,c),_z(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var r=pR(o)?e:o,i=pR(c)?t:c;n&&n>0&&(r?i=r/n:i&&(r=i*n),f&&i>f&&(i=f)),_z(r>0||i>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,r,i,o,c,u,d,n);var a=!Array.isArray(p)&&HR(p.type).endsWith(`Chart`);return _.Children.map(p,function(e){return _.isValidElement(e)?(0,_.cloneElement)(e,iG({width:r,height:i},a?{style:iG({height:`100%`,width:`100%`,maxHeight:i,maxWidth:r},e.props.style)}:{})):e})},[n,p,c,f,d,u,T,o]);return _.createElement(`div`,{id:g?`${g}`:void 0,className:Zo(`recharts-responsive-container`,v),style:iG(iG({},x),{},{width:o,height:c,minWidth:u,minHeight:d,maxHeight:f}),ref:S},O)}),hG=function(e){return null};hG.displayName=`Cell`;function gG(e){"@babel/helpers - typeof";return gG=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},gG(e)}function _G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vG(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||AW.isSsr)return{width:0,height:0};var n=EG(t),r=JSON.stringify({text:e,copyStyle:n});if(SG.widthCache[r])return SG.widthCache[r];try{var i=document.getElementById(TG);i||(i=document.createElement(`span`),i.setAttribute(`id`,TG),i.setAttribute(`aria-hidden`,`true`),document.body.appendChild(i));var a=vG(vG({},wG),n);Object.assign(i.style,a),i.textContent=`${e}`;var o=i.getBoundingClientRect(),s={width:o.width,height:o.height};return SG.widthCache[r]=s,++SG.cacheCount>CG&&(SG.cacheCount=0,SG.widthCache={}),s}catch{return{width:0,height:0}}},OG=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function kG(e){"@babel/helpers - typeof";return kG=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},kG(e)}function AG(e,t){return FG(e)||PG(e,t)||MG(e,t)||jG()}function jG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MG(e,t){if(e){if(typeof e==`string`)return NG(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return NG(e,t)}}function NG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oK(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function sK(e,t){return fK(e)||dK(e,t)||lK(e,t)||cK()}function cK(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lK(e,t){if(e){if(typeof e==`string`)return uK(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uK(e,t)}}function uK(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&arguments[0]!==void 0?arguments[0]:[]).reduce(function(e,t){var a=t.word,o=t.width,s=e[e.length-1];if(s&&(r==null||i||s.width+o+nt.width?e:t})};if(!l)return f;for(var m=`…`,h=function(e){var t=mK({breakAll:c,style:s,children:u.slice(0,e)+m}).wordsWithComputedWidth,n=d(t);return[n.length>a||p(n).width>Number(r),n]},g=0,_=u.length-1,v=0,y;g<=_&&v<=u.length-1;){var b=Math.floor((g+_)/2),x=sK(h(b-1),2),S=x[0],C=x[1],w=sK(h(b),1)[0];if(!S&&!w&&(g=b+1),S&&w&&(_=b-1),!S&&w){y=C;break}v++}return y||f},gK=function(e){return[{words:(0,uR.default)(e)?[]:e.toString().split(pK)}]},_K=function(e){var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!AW.isSsr){var s,c,l=mK({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return gK(r);return hK({breakAll:a,children:r,maxLines:o,style:i},s,c,t,n)}return gK(r)},vK=`#808080`,yK=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.lineHeight,o=a===void 0?`1em`:a,s=e.capHeight,c=s===void 0?`0.71em`:s,l=e.scaleToFit,u=l===void 0?!1:l,d=e.textAnchor,f=d===void 0?`start`:d,p=e.verticalAnchor,m=p===void 0?`end`:p,h=e.fill,g=h===void 0?vK:h,v=aK(e,nK),y=(0,_.useMemo)(function(){return _K({breakAll:v.breakAll,children:v.children,maxLines:v.maxLines,scaleToFit:u,style:v.style,width:v.width})},[v.breakAll,v.children,v.maxLines,u,v.style,v.width]),b=v.dx,x=v.dy,S=v.angle,C=v.className,w=v.breakAll,T=aK(v,rK);if(!mR(n)||!mR(i))return null;var E=n+(Q(b)?b:0),D=i+(Q(x)?x:0),O;switch(m){case`start`:O=tK(`calc(${c})`);break;case`middle`:O=tK(`calc(${(y.length-1)/2} * -${o} + (${c} / 2))`);break;default:O=tK(`calc(${y.length-1} * -${o})`);break}var k=[];if(u){var A=y[0].width,j=v.width;k.push(`scale(${(Q(j)?j/A:1)/A})`)}return S&&k.push(`rotate(${S}, ${E}, ${D})`),k.length&&(T.transform=k.join(` `)),_.createElement(`text`,iK({},$R(T,!0),{x:E,y:D,className:Zo(`recharts-text`,C),textAnchor:f,fill:g.includes(`url`)?vK:g}),y.map(function(e,t){var n=e.words.join(w?``:` `);return _.createElement(`tspan`,{x:E,dy:t===0?O:o,key:`${n}-${t}`},n)}))};function bK(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function xK(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function SK(e){let t,n,r;e.length===2?(t=e===bK||e===xK?e:CK,n=e,r=e):(t=bK,n=(t,n)=>bK(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function CK(){return 0}function wK(e){return e===null?NaN:+e}function*TK(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var EK=SK(bK),DK=EK.right;EK.left,SK(wK).center;var OK=class extends Map{constructor(e,t=MK){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(kK(this,e))}has(e){return super.has(kK(this,e))}set(e,t){return super.set(AK(this,e),t)}delete(e){return super.delete(jK(this,e))}};function kK({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function AK({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function jK({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function MK(e){return typeof e==`object`&&e?e.valueOf():e}function NK(e=bK){if(e===bK)return PK;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function PK(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var FK=Math.sqrt(50),IK=Math.sqrt(10),LK=Math.sqrt(2);function RK(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=FK?10:a>=IK?5:a>=LK?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function UK(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function WK(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?PK:NK(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));WK(e,t,u,d,i)}let a=e[t],o=n,s=r;for(GK(e,n,t),i(e[r],a)>0&&GK(e,n,r);o0;)--s}i(e[n],a)===0?GK(e,n,s):(++s,GK(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function GK(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function KK(e,t,n){if(e=Float64Array.from(TK(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return UK(e);if(t>=1)return HK(e);var r,i=(r-1)*t,a=Math.floor(i),o=HK(WK(e,a).subarray(0,a+1));return o+(UK(e.subarray(a+1))-o)*(i-a)}}function qK(e,t,n=wK){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function JK(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?wq(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?wq(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=dq.exec(e))?new Dq(t[1],t[2],t[3],1):(t=fq.exec(e))?new Dq(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pq.exec(e))?wq(t[1],t[2],t[3],t[4]):(t=mq.exec(e))?wq(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=hq.exec(e))?Pq(t[1],t[2]/100,t[3]/100,1):(t=gq.exec(e))?Pq(t[1],t[2]/100,t[3]/100,t[4]):_q.hasOwnProperty(e)?Cq(_q[e]):e===`transparent`?new Dq(NaN,NaN,NaN,0):null}function Cq(e){return new Dq(e>>16&255,e>>8&255,e&255,1)}function wq(e,t,n,r){return r<=0&&(e=t=n=NaN),new Dq(e,t,n,r)}function Tq(e){return e instanceof iq||(e=Sq(e)),e?(e=e.rgb(),new Dq(e.r,e.g,e.b,e.opacity)):new Dq}function Eq(e,t,n,r){return arguments.length===1?Tq(e):new Dq(e,t,n,r??1)}function Dq(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}nq(Dq,Eq,rq(iq,{brighter(e){return e=e==null?oq:oq**+e,new Dq(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?aq:aq**+e,new Dq(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Dq(Mq(this.r),Mq(this.g),Mq(this.b),jq(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Oq,formatHex:Oq,formatHex8:kq,formatRgb:Aq,toString:Aq}));function Oq(){return`#${Nq(this.r)}${Nq(this.g)}${Nq(this.b)}`}function kq(){return`#${Nq(this.r)}${Nq(this.g)}${Nq(this.b)}${Nq((isNaN(this.opacity)?1:this.opacity)*255)}`}function Aq(){let e=jq(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Mq(this.r)}, ${Mq(this.g)}, ${Mq(this.b)}${e===1?`)`:`, ${e})`}`}function jq(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Mq(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Nq(e){return e=Mq(e),(e<16?`0`:``)+e.toString(16)}function Pq(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Lq(e,t,n,r)}function Fq(e){if(e instanceof Lq)return new Lq(e.h,e.s,e.l,e.opacity);if(e instanceof iq||(e=Sq(e)),!e)return new Lq;if(e instanceof Lq)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new Lq(o,s,c,e.opacity)}function Iq(e,t,n,r){return arguments.length===1?Fq(e):new Lq(e,t,n,r??1)}function Lq(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}nq(Lq,Iq,rq(iq,{brighter(e){return e=e==null?oq:oq**+e,new Lq(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?aq:aq**+e,new Lq(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Dq(Bq(e>=240?e-240:e+120,i,r),Bq(e,i,r),Bq(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Lq(Rq(this.h),zq(this.s),zq(this.l),jq(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=jq(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Rq(this.h)}, ${zq(this.s)*100}%, ${zq(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Rq(e){return e=(e||0)%360,e<0?e+360:e}function zq(e){return Math.max(0,Math.min(1,e||0))}function Bq(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Vq=e=>()=>e;function Hq(e,t){return function(n){return e+n*t}}function Uq(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Wq(e){return(e=+e)==1?Gq:function(t,n){return n-t?Uq(t,n,e):Vq(isNaN(t)?n:t)}}function Gq(e,t){var n=t-e;return n?Hq(e,n):Vq(isNaN(e)?t:e)}var Kq=(function e(t){var n=Wq(t);function r(e,t){var r=n((e=Eq(e)).r,(t=Eq(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Gq(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function qq(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Zq(r,i)})),n=eJ.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function pJ(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?mJ:pJ,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),Zq))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,cJ),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=aJ,u()},d.clamp=function(e){return arguments.length?(o=e?!0:uJ,u()):o!==uJ},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function _J(){return gJ()(uJ,uJ)}function vJ(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function yJ(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function bJ(e){return e=yJ(Math.abs(e)),e?e[1]:NaN}function xJ(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function SJ(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var CJ=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wJ(e){if(!(t=CJ.exec(e)))throw Error(`invalid format: `+e);var t;return new TJ({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}wJ.prototype=TJ.prototype;function TJ(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}TJ.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function EJ(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var DJ;function OJ(e,t){var n=yJ(e,t);if(!n)return DJ=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(DJ=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+yJ(e,Math.max(0,t+a-1))[0]}function kJ(e,t){var n=yJ(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var AJ={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:vJ,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>kJ(e*100,t),r:kJ,s:OJ,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function jJ(e){return e}var MJ=Array.prototype.map,NJ=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function PJ(e){var t=e.grouping===void 0||e.thousands===void 0?jJ:xJ(MJ.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?jJ:SJ(MJ.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=wJ(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):AJ[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=AJ[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=EJ(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&DJ!==void 0?NJ[8+DJ/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(bJ(t)/3)))*3,r=10**-n,i=l((e=wJ(e),e.type=`f`,e),{suffix:NJ[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var FJ,IJ,LJ;RJ({thousands:`,`,grouping:[3],currency:[`$`,``]});function RJ(e){return FJ=PJ(e),IJ=FJ.format,LJ=FJ.formatPrefix,FJ}function zJ(e){return Math.max(0,-bJ(Math.abs(e)))}function BJ(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(bJ(t)/3)))*3-bJ(Math.abs(e)))}function VJ(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,bJ(t)-bJ(e))+1}function HJ(e,t,n,r){var i=VK(e,t,n),a;switch(r=wJ(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=BJ(i,o))&&(r.precision=a),LJ(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=VJ(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=zJ(i))&&(r.precision=a-(r.type===`%`)*2);break}return IJ(r)}function UJ(e){var t=e.domain;return e.ticks=function(e){var n=t();return zK(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return HJ(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=BK(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function WJ(){var e=_J();return e.copy=function(){return hJ(e,WJ())},YK.apply(e,arguments),UJ(e)}function GJ(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,cJ),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return GJ(e).unknown(t)},e=arguments.length?Array.from(e,cJ):[0,1],UJ(n)}function KJ(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function $J(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function eY(e){return(t,n)=>-e(-t,n)}function tY(e){let t=e(qJ,JJ),n=t.domain,r=10,i,a;function o(){return i=$J(r),a=QJ(r),n()[0]<0?(i=eY(i),a=eY(a),e(YJ,XJ)):e(qJ,JJ),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=wJ(n)).precision==null&&(n.trim=!0),n=IJ(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(KJ(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function nY(){let e=tY(gJ()).domain([1,10]);return e.copy=()=>hJ(e,nY()).base(e.base()),YK.apply(e,arguments),e}function rY(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function iY(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function aY(e){var t=1,n=e(rY(t),iY(t));return n.constant=function(n){return arguments.length?e(rY(t=+n),iY(t)):t},UJ(n)}function oY(){var e=aY(gJ());return e.copy=function(){return hJ(e,oY()).constant(e.constant())},YK.apply(e,arguments)}function sY(e){return function(t){return t<0?-((-t)**+e):t**+e}}function cY(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function lY(e){return e<0?-e*e:e*e}function uY(e){var t=e(uJ,uJ),n=1;function r(){return n===1?e(uJ,uJ):n===.5?e(cY,lY):e(sY(n),sY(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},UJ(t)}function dY(){var e=uY(gJ());return e.copy=function(){return hJ(e,dY()).exponent(e.exponent())},YK.apply(e,arguments),e}function fY(){return dY.apply(null,arguments).exponent(.5)}function pY(e){return Math.sign(e)*e*e}function mY(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function hY(){var e=_J(),t=[0,1],n=!1,r;function i(t){var i=mY(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(pY(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,cJ)).map(pY)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return hY(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},YK.apply(i,arguments),UJ(i)}function gY(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return _Y().domain([e,t]).range(i).unknown(a)},YK.apply(UJ(o),arguments)}function vY(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[DK(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return vY().domain(e).range(t).unknown(n)},YK.apply(i,arguments)}var yY=new Date,bY=new Date;function xY(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sxY(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(yY.setTime(+t),bY.setTime(+r),e(yY),e(bY),Math.floor(n(yY,bY))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var SY=xY(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);SY.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?xY(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):SY),SY.range;var CY=1e3,wY=CY*60,TY=wY*60,EY=TY*24,DY=EY*7,OY=EY*30,kY=EY*365,AY=xY(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*CY)},(e,t)=>(t-e)/CY,e=>e.getUTCSeconds());AY.range;var jY=xY(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*CY)},(e,t)=>{e.setTime(+e+t*wY)},(e,t)=>(t-e)/wY,e=>e.getMinutes());jY.range;var MY=xY(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*wY)},(e,t)=>(t-e)/wY,e=>e.getUTCMinutes());MY.range;var NY=xY(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*CY-e.getMinutes()*wY)},(e,t)=>{e.setTime(+e+t*TY)},(e,t)=>(t-e)/TY,e=>e.getHours());NY.range;var PY=xY(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*TY)},(e,t)=>(t-e)/TY,e=>e.getUTCHours());PY.range;var FY=xY(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*wY)/EY,e=>e.getDate()-1);FY.range;var IY=xY(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/EY,e=>e.getUTCDate()-1);IY.range;var LY=xY(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/EY,e=>Math.floor(e/EY));LY.range;function RY(e){return xY(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*wY)/DY)}var zY=RY(0),BY=RY(1),VY=RY(2),HY=RY(3),UY=RY(4),WY=RY(5),GY=RY(6);zY.range,BY.range,VY.range,HY.range,UY.range,WY.range,GY.range;function KY(e){return xY(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/DY)}var qY=KY(0),JY=KY(1),YY=KY(2),XY=KY(3),ZY=KY(4),QY=KY(5),$Y=KY(6);qY.range,JY.range,YY.range,XY.range,ZY.range,QY.range,$Y.range;var eX=xY(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());eX.range;var tX=xY(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());tX.range;var nX=xY(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());nX.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xY(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),nX.range;var rX=xY(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());rX.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xY(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),rX.range;function iX(e,t,n,r,i,a){let o=[[AY,1,CY],[AY,5,5*CY],[AY,15,15*CY],[AY,30,30*CY],[a,1,wY],[a,5,5*wY],[a,15,15*wY],[a,30,30*wY],[i,1,TY],[i,3,3*TY],[i,6,6*TY],[i,12,12*TY],[r,1,EY],[r,2,2*EY],[n,1,DY],[t,1,OY],[t,3,3*OY],[e,1,kY]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(VK(t/kY,n/kY,r));if(a===0)return SY.every(Math.max(VK(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=uX(dX(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?JY.ceil(a):JY(a),a=IY.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=lX(dX(r.y,0,1)),o=a.getDay(),a=o>4||o===0?BY.ceil(a):BY(a),a=FY.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else (`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?uX(dX(r.y,0,1)).getUTCDay():lX(dX(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,uX(r)):lX(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in pX?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function F(e){return c[e.getMonth()]}function ee(e){return s[e.getMonth()]}function te(e){return i[+(e.getHours()>=12)]}function ne(e){return 1+~~(e.getMonth()/3)}function re(e){return o[e.getUTCDay()]}function ie(e){return a[e.getUTCDay()]}function ae(e){return c[e.getUTCMonth()]}function oe(e){return s[e.getUTCMonth()]}function se(e){return i[+(e.getUTCHours()>=12)]}function ce(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var pX={"-":``,_:` `,0:`0`},mX=/^\s*\d+/,hX=/^%/,gX=/[\\^$*+?|[\]().{}]/g;function _X(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function xX(e,t,n){var r=mX.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function SX(e,t,n){var r=mX.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function CX(e,t,n){var r=mX.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function wX(e,t,n){var r=mX.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function TX(e,t,n){var r=mX.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function EX(e,t,n){var r=mX.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function DX(e,t,n){var r=mX.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function OX(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function kX(e,t,n){var r=mX.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function AX(e,t,n){var r=mX.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function jX(e,t,n){var r=mX.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function MX(e,t,n){var r=mX.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function NX(e,t,n){var r=mX.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function PX(e,t,n){var r=mX.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function FX(e,t,n){var r=mX.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function IX(e,t,n){var r=mX.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function LX(e,t,n){var r=mX.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function RX(e,t,n){var r=hX.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function zX(e,t,n){var r=mX.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function BX(e,t,n){var r=mX.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function VX(e,t){return _X(e.getDate(),t,2)}function HX(e,t){return _X(e.getHours(),t,2)}function UX(e,t){return _X(e.getHours()%12||12,t,2)}function WX(e,t){return _X(1+FY.count(nX(e),e),t,3)}function GX(e,t){return _X(e.getMilliseconds(),t,3)}function KX(e,t){return GX(e,t)+`000`}function qX(e,t){return _X(e.getMonth()+1,t,2)}function JX(e,t){return _X(e.getMinutes(),t,2)}function YX(e,t){return _X(e.getSeconds(),t,2)}function XX(e){var t=e.getDay();return t===0?7:t}function ZX(e,t){return _X(zY.count(nX(e)-1,e),t,2)}function QX(e){var t=e.getDay();return t>=4||t===0?UY(e):UY.ceil(e)}function $X(e,t){return e=QX(e),_X(UY.count(nX(e),e)+(nX(e).getDay()===4),t,2)}function eZ(e){return e.getDay()}function tZ(e,t){return _X(BY.count(nX(e)-1,e),t,2)}function nZ(e,t){return _X(e.getFullYear()%100,t,2)}function rZ(e,t){return e=QX(e),_X(e.getFullYear()%100,t,2)}function iZ(e,t){return _X(e.getFullYear()%1e4,t,4)}function aZ(e,t){var n=e.getDay();return e=n>=4||n===0?UY(e):UY.ceil(e),_X(e.getFullYear()%1e4,t,4)}function oZ(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+_X(t/60|0,`0`,2)+_X(t%60,`0`,2)}function sZ(e,t){return _X(e.getUTCDate(),t,2)}function cZ(e,t){return _X(e.getUTCHours(),t,2)}function lZ(e,t){return _X(e.getUTCHours()%12||12,t,2)}function uZ(e,t){return _X(1+IY.count(rX(e),e),t,3)}function dZ(e,t){return _X(e.getUTCMilliseconds(),t,3)}function fZ(e,t){return dZ(e,t)+`000`}function pZ(e,t){return _X(e.getUTCMonth()+1,t,2)}function mZ(e,t){return _X(e.getUTCMinutes(),t,2)}function hZ(e,t){return _X(e.getUTCSeconds(),t,2)}function gZ(e){var t=e.getUTCDay();return t===0?7:t}function _Z(e,t){return _X(qY.count(rX(e)-1,e),t,2)}function vZ(e){var t=e.getUTCDay();return t>=4||t===0?ZY(e):ZY.ceil(e)}function yZ(e,t){return e=vZ(e),_X(ZY.count(rX(e),e)+(rX(e).getUTCDay()===4),t,2)}function bZ(e){return e.getUTCDay()}function xZ(e,t){return _X(JY.count(rX(e)-1,e),t,2)}function SZ(e,t){return _X(e.getUTCFullYear()%100,t,2)}function CZ(e,t){return e=vZ(e),_X(e.getUTCFullYear()%100,t,2)}function wZ(e,t){return _X(e.getUTCFullYear()%1e4,t,4)}function TZ(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ZY(e):ZY.ceil(e),_X(e.getUTCFullYear()%1e4,t,4)}function EZ(){return`+0000`}function DZ(){return`%`}function OZ(e){return+e}function kZ(e){return Math.floor(e/1e3)}var AZ,jZ,MZ;NZ({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function NZ(e){return AZ=fX(e),jZ=AZ.format,AZ.parse,MZ=AZ.utcFormat,AZ.utcParse,AZ}function PZ(e){return new Date(e)}function FZ(e){return e instanceof Date?+e:+new Date(+e)}function IZ(e,t,n,r,i,a,o,s,c,l){var u=_J(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>KK(e,r/t))},n.copy=function(){return KZ(t).domain(e)},XK.apply(n,arguments)}function qZ(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=uJ,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*e$K,scaleDiverging:()=>JZ,scaleDivergingLog:()=>YZ,scaleDivergingPow:()=>ZZ,scaleDivergingSqrt:()=>QZ,scaleDivergingSymlog:()=>XZ,scaleIdentity:()=>GJ,scaleImplicit:()=>ZK,scaleLinear:()=>WJ,scaleLog:()=>nY,scaleOrdinal:()=>QK,scalePoint:()=>tq,scalePow:()=>dY,scaleQuantile:()=>gY,scaleQuantize:()=>_Y,scaleRadial:()=>hY,scaleSequential:()=>VZ,scaleSequentialLog:()=>HZ,scaleSequentialPow:()=>WZ,scaleSequentialQuantile:()=>KZ,scaleSequentialSqrt:()=>GZ,scaleSequentialSymlog:()=>UZ,scaleSqrt:()=>fY,scaleSymlog:()=>oY,scaleThreshold:()=>vY,scaleTime:()=>LZ,scaleUtc:()=>RZ,tickFormat:()=>HJ}),eQ=o(((e,t)=>{var n=TL();function r(e,t,r){for(var i=-1,a=e.length;++i{function n(e,t){return e>t}t.exports=n})),nQ=o(((e,t)=>{var n=eQ(),r=tQ(),i=PH();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),rQ=o(((e,t)=>{function n(e,t){return e{var n=eQ(),r=rQ(),i=PH();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),aQ=o(((e,t)=>{var n=qL(),r=RH(),i=EU(),a=yL();function o(e,t){return(a(e)?n:i)(e,r(t,3))}t.exports=o})),oQ=o(((e,t)=>{var n=bU(),r=aQ();function i(e,t){return n(r(e,t),1)}t.exports=i})),sQ=o(((e,t)=>{var n=wH();function r(e,t){return n(e,t)}t.exports=r})),cQ=o(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}else if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i);if((i=e[r=`LN10`])!==void 0)if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i);return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}));function lQ(e){return pQ(e)||fQ(e)||dQ(e)||uQ()}function uQ(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dQ(e,t){if(e){if(typeof e==`string`)return mQ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mQ(e,t)}}function fQ(e){if(typeof Symbol<`u`&&Symbol.iterator in Object(e))return Array.from(e)}function pQ(e){if(Array.isArray(e))return mQ(e)}function mQ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=t?n.apply(void 0,r):e(t-i,vQ(function(){var e=[...arguments],t=r.map(function(t){return _Q(t)?e.shift():t});return n.apply(void 0,lQ(t).concat(e))}))})},bQ=function(e){return yQ(e.length,e)},xQ=function(e,t){for(var n=[],r=e;re.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw a}}return n}}function zQ(e){if(Array.isArray(e))return e}function BQ(e){var t=PQ(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]}function VQ(e,t,n){if(e.lte(0))return new EQ.default(0);var r=kQ.getDigitCount(e.toNumber()),i=new EQ.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new EQ.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?s:new EQ.default(Math.ceil(s))}function HQ(e,t,n){var r=1,i=new EQ.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new EQ.default(10).pow(kQ.getDigitCount(e)-1),i=new EQ.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new EQ.default(Math.floor(e)))}else e===0?i=new EQ.default(Math.floor((t-1)/2)):n||(i=new EQ.default(Math.floor(e)));var o=Math.floor((t-1)/2);return CQ(SQ(function(e){return i.add(new EQ.default(e-o).mul(r)).toNumber()}),xQ)(0,t)}function UQ(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new EQ.default(0),tickMin:new EQ.default(0),tickMax:new EQ.default(0)};var a=VQ(new EQ.default(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new EQ.default(0):(o=new EQ.default(e).add(t).div(2),o=o.sub(new EQ.default(o).mod(a)));var s=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new EQ.default(t).sub(o).div(a).toNumber()),l=s+c+1;return l>n?UQ(e,t,n,r,i+1):(l0?c+(n-l):c,s=t>0?s:s+(n-l)),{step:a,tickMin:o.sub(new EQ.default(s).mul(a)),tickMax:o.add(new EQ.default(c).mul(a))})}function WQ(e){var t=PQ(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),s=PQ(BQ([n,r]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0){var u=l===1/0?[c].concat(AQ(xQ(0,i-1).map(function(){return 1/0}))):[].concat(AQ(xQ(0,i-1).map(function(){return-1/0})),[l]);return n>r?wQ(u):u}if(c===l)return HQ(c,i,a);var d=UQ(c,l,o,a),f=d.step,p=d.tickMin,m=d.tickMax,h=kQ.rangeStep(p,m.add(new EQ.default(.1).mul(f)),f);return n>r?wQ(h):h}function GQ(e,t){var n=PQ(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=PQ(BQ([r,i]),2),s=o[0],c=o[1];if(s===-1/0||c===1/0)return[r,i];if(s===c)return[s];var l=Math.max(t,2),u=VQ(new EQ.default(c).sub(s).div(l-1),a,0),d=[].concat(AQ(kQ.rangeStep(new EQ.default(s),new EQ.default(c).sub(new EQ.default(.99).mul(u)),u)),[c]);return r>i?wQ(d):d}var KQ=TQ(WQ),qQ=TQ(GQ),JQ=!0,YQ=`Invariant failed`;function XQ(e,t){if(!e){if(JQ)throw Error(YQ);var n=typeof t==`function`?t():t,r=n?`${YQ}: ${n}`:YQ;throw Error(r)}}var ZQ=[`offset`,`layout`,`width`,`dataKey`,`data`,`dataPointFormatter`,`xAxis`,`yAxis`];function QQ(e){"@babel/helpers - typeof";return QQ=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},QQ(e)}function $Q(){return $Q=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function s$(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function c$(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function l$(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=-1,a=t?.length??0;if(a<=1)return 0;if(r&&r.axisType===`angleAxis`&&Math.abs(Math.abs(r.range[1]-r.range[0])-360)<=1e-6)for(var o=r.range,s=0;s0?n[s-1].coordinate:n[a-1].coordinate,l=n[s].coordinate,u=s>=a-1?n[0].coordinate:n[s+1].coordinate,d=void 0;if(dR(l-c)!==dR(u-l)){var f=[];if(dR(u-l)===dR(o[1]-o[0])){d=u;var p=l+o[1]-o[0];f[0]=Math.min(p,(p+c)/2),f[1]=Math.max(p,(p+c)/2)}else{d=c;var m=u+o[1]-o[0];f[0]=Math.min(l,(m+l)/2),f[1]=Math.max(l,(m+l)/2)}var h=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(e>h[0]&&e<=h[1]||e>=f[0]&&e<=f[1]){i=n[s].index;break}}else{var g=Math.min(c,u),_=Math.max(c,u);if(e>(g+l)/2&&e<=(_+l)/2){i=n[s].index;break}}}else for(var v=0;v0&&v(t[v].coordinate+t[v-1].coordinate)/2&&e<=(t[v].coordinate+t[v+1].coordinate)/2||v===a-1&&e>(t[v].coordinate+t[v-1].coordinate)/2){i=t[v].index;break}return i},J$=function(e){var t,n=e.type.displayName,r=(t=e.type)!=null&&t.defaultProps?V$(V$({},e.type.defaultProps),e.props):e.props,i=r.stroke,a=r.fill,o;switch(n){case`Line`:o=i;break;case`Area`:case`Radar`:o=i&&i!==`none`?i:a;break;default:o=a;break}return o},Y$=function(e){var t=e.barSize,n=e.totalSize,r=e.stackGroups,i=r===void 0?{}:r;if(!i)return{};for(var a={},o=Object.keys(i),s=0,c=o.length;s=0});if(g&&g.length){var _=g[0].type.defaultProps,v=_===void 0?g[0].props:V$(V$({},_),g[0].props),y=v.barSize,b=v[h];a[b]||(a[b]=[]);var x=(0,uR.default)(y)?t:y;a[b].push({item:g[0],stackList:g.slice(1),barSize:(0,uR.default)(x)?void 0:_R(x,n,0)})}}return a},X$=function(e){var t=e.barGap,n=e.barCategoryGap,r=e.bandSize,i=e.sizeList,a=i===void 0?[]:i,o=e.maxBarSize,s=a.length;if(s<1)return null;var c=_R(t,r,0,!0),l,u=[];if(a[0].barSize===+a[0].barSize){var d=!1,f=r/s,p=a.reduce(function(e,t){return e+t.barSize||0},0);p+=(s-1)*c,p>=r&&(p-=(s-1)*c,c=0),p>=r&&f>0&&(d=!0,f*=.9,p=s*f);var m={offset:((r-p)/2>>0)-c,size:0};l=a.reduce(function(e,t){var n={item:t.item,position:{offset:m.offset+m.size+c,size:d?f:t.barSize}},r=[].concat(P$(e),[n]);return m=r[r.length-1].position,t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:m})}),r},u)}else{var h=_R(n,r,0,!0);r-2*h-(s-1)*c<=0&&(c=0);var g=(r-2*h-(s-1)*c)/s;g>1&&(g>>=0);var _=o===+o?Math.min(g,o):g;l=a.reduce(function(e,t,n){var r=[].concat(P$(e),[{item:t.item,position:{offset:h+(g+c)*n+(g-_)/2,size:_}}]);return t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:r[r.length-1].position})}),r},u)}return l},Z$=function(e,t,n,r){var i=n.children,a=n.width,o=n.margin,s=O$({children:i,legendWidth:a-(o.left||0)-(o.right||0)});if(s){var c=r||{},l=c.width,u=c.height,d=s.align,f=s.verticalAlign,p=s.layout;if((p===`vertical`||p===`horizontal`&&f===`middle`)&&d!==`center`&&Q(e[d]))return V$(V$({},e),{},H$({},d,e[d]+(l||0)));if((p===`horizontal`||p===`vertical`&&d===`center`)&&f!==`middle`&&Q(e[f]))return V$(V$({},e),{},H$({},f,e[f]+(u||0)))}return e},Q$=function(e,t,n){return(0,uR.default)(t)?!0:e===`horizontal`?t===`yAxis`:e===`vertical`||n===`x`?t===`xAxis`:n===`y`?t===`yAxis`:!0},$$=function(e,t,n,r,i){var a=t.props.children,o=KR(a,x$).filter(function(e){return Q$(r,i,e.props.direction)});if(o&&o.length){var s=o.map(function(e){return e.props.dataKey});return e.reduce(function(e,t){var r=G$(t,n);if((0,uR.default)(r))return e;var i=Array.isArray(r)?[(0,A$.default)(r),(0,k$.default)(r)]:[r,r],a=s.reduce(function(e,n){var r=G$(t,n,0),a=i[0]-Math.abs(Array.isArray(r)?r[0]:r),o=i[1]+Math.abs(Array.isArray(r)?r[1]:r);return[Math.min(a,e[0]),Math.max(o,e[1])]},[1/0,-1/0]);return[Math.min(a[0],e[0]),Math.max(a[1],e[1])]},[1/0,-1/0])}return null},e1=function(e,t,n,r,i){var a=t.map(function(t){return $$(e,t,n,i,r)}).filter(function(e){return!(0,uR.default)(e)});return a&&a.length?a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]):null},t1=function(e,t,n,r,i){var a=t.map(function(t){var a=t.props.dataKey;return n===`number`&&a&&$$(e,t,a,r)||K$(e,a,n,i)});if(n===`number`)return a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]);var o={};return a.reduce(function(e,t){for(var n=0,r=t.length;n=2?dR(o[0]-o[1])*2*c:c,t&&(e.ticks||e.niceTicks)?(e.ticks||e.niceTicks).map(function(e){return{coordinate:r(i?i.indexOf(e):e)+c,value:e,offset:c}}).filter(function(e){return!(0,sR.default)(e.coordinate)}):e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(e,t){return{coordinate:r(e)+c,value:e,index:t,offset:c}}):r.ticks&&!n?r.ticks(e.tickCount).map(function(e){return{coordinate:r(e)+c,value:e,offset:c}}):r.domain().map(function(e,t){return{coordinate:r(e)+c,value:i?i[e]:e,index:t,offset:c}})},i1=new WeakMap,a1=function(e,t){if(typeof t!=`function`)return e;i1.has(e)||i1.set(e,new WeakMap);var n=i1.get(e);if(n.has(t))return n.get(t);var r=function(){e.apply(void 0,arguments),t.apply(void 0,arguments)};return n.set(t,r),r},o1=function(e,t,n){var r=e.scale,i=e.type,a=e.layout,o=e.axisType;if(r===`auto`)return a===`radial`&&o===`radiusAxis`?{scale:$K(),realScaleType:`band`}:a===`radial`&&o===`angleAxis`?{scale:WJ(),realScaleType:`linear`}:i===`category`&&t&&(t.indexOf(`LineChart`)>=0||t.indexOf(`AreaChart`)>=0||t.indexOf(`ComposedChart`)>=0&&!n)?{scale:tq(),realScaleType:`point`}:i===`category`?{scale:$K(),realScaleType:`band`}:{scale:WJ(),realScaleType:`linear`};if((0,oR.default)(r)){var s=`scale${(0,YB.default)(r)}`;return{scale:($Z[s]||tq)(),realScaleType:$Z[s]?s:`point`}}return(0,PR.default)(r)?{scale:r}:{scale:tq(),realScaleType:`point`}},s1=1e-4,c1=function(e){var t=e.domain();if(!(!t||t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-s1,a=Math.max(r[0],r[1])+s1,o=e(t[0]),s=e(t[n-1]);(oa||sa)&&e.domain([t[0],t[n-1]])}},l1=function(e,t){if(!e)return null;for(var n=0,r=e.length;nr)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]=0?(e[o][n][0]=i,e[o][n][1]=i+s,i=e[o][n][1]):(e[o][n][0]=a,e[o][n][1]=a+s,a=e[o][n][1])}},expand:KB,none:VB,silhouette:qB,wiggle:JB,positive:function(e){var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[a][n][0]=i,e[a][n][1]=i+o,i=e[a][n][1]):(e[a][n][0]=0,e[a][n][1]=0)}}},f1=function(e,t,n){var r=t.map(function(e){return e.props.dataKey}),i=d1[n];return GB().keys(r).value(function(e,t){return+G$(e,t,0)}).order(HB).offset(i)(e)},p1=function(e,t,n,r,i,a){if(!e)return null;var o=(a?t.reverse():t).reduce(function(e,t){var i,a=(i=t.type)!=null&&i.defaultProps?V$(V$({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(a.hide)return e;var s=a[n],c=e[s]||{hasStack:!1,stackGroups:{}};if(mR(o)){var l=c.stackGroups[o]||{numericAxisId:n,cateAxisId:r,items:[]};l.items.push(t),c.hasStack=!0,c.stackGroups[o]=l}else c.stackGroups[gR(`_stackId_`)]={numericAxisId:n,cateAxisId:r,items:[t]};return V$(V$({},e),{},H$({},s,c))},{});return Object.keys(o).reduce(function(t,a){var s=o[a];return s.hasStack&&(s.stackGroups=Object.keys(s.stackGroups).reduce(function(t,a){var o=s.stackGroups[a];return V$(V$({},t),{},H$({},a,{numericAxisId:n,cateAxisId:r,items:o.items,stackedData:f1(e,o.items,i)}))},{})),V$(V$({},t),{},H$({},a,s))},{})},m1=function(e,t){var n=t.realScaleType,r=t.type,i=t.tickCount,a=t.originalDomain,o=t.allowDecimals,s=n||t.scale;if(s!==`auto`&&s!==`linear`)return null;if(i&&r===`number`&&a&&(a[0]===`auto`||a[1]===`auto`)){var c=e.domain();if(!c.length)return null;var l=KQ(c,i,o);return e.domain([(0,A$.default)(l),(0,k$.default)(l)]),{niceTicks:l}}return i&&r===`number`?{niceTicks:qQ(e.domain(),i,o)}:null};function h1(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!(0,uR.default)(i[t.dataKey])){var s=xR(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=G$(i,(0,uR.default)(o)?t.dataKey:o);return(0,uR.default)(c)?null:t.scale(c)}var g1=function(e){var t=e.axis,n=e.ticks,r=e.offset,i=e.bandSize,a=e.entry,o=e.index;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=G$(a,t.dataKey,t.domain[o]);return(0,uR.default)(s)?null:t.scale(s)-i/2+r},_1=function(e){var t=e.numericAxis,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},v1=function(e,t){var n,r=((n=e.type)!=null&&n.defaultProps?V$(V$({},e.type.defaultProps),e.props):e.props).stackId;if(mR(r)){var i=t[r];if(i){var a=i.items.indexOf(e);return a>=0?i.stackedData[a]:null}}return null},y1=function(e){return e.reduce(function(e,t){return[(0,A$.default)(t.concat([e[0]]).filter(Q)),(0,k$.default)(t.concat([e[1]]).filter(Q))]},[1/0,-1/0])},b1=function(e,t,n){return Object.keys(e).reduce(function(r,i){var a=e[i].stackedData.reduce(function(e,r){var i=y1(r.slice(t,n+1));return[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]).map(function(e){return e===1/0||e===-1/0?0:e})},x1=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,S1=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,C1=function(e,t,n){if((0,PR.default)(e))return e(t,n);if(!Array.isArray(e))return t;var r=[];if(Q(e[0]))r[0]=n?e[0]:Math.min(e[0],t[0]);else if(x1.test(e[0])){var i=+x1.exec(e[0])[1];r[0]=t[0]-i}else (0,PR.default)(e[0])?r[0]=e[0](t[0]):r[0]=t[0];if(Q(e[1]))r[1]=n?e[1]:Math.max(e[1],t[1]);else if(S1.test(e[1])){var a=+S1.exec(e[1])[1];r[1]=t[1]+a}else (0,PR.default)(e[1])?r[1]=e[1](t[1]):r[1]=t[1];return r},w1=function(e,t,n){if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,BU.default)(t,function(e){return e.coordinate}),a=1/0,o=1,s=i.length;oa&&(c=2*Math.PI-c),{radius:o,angle:P1(c),angleInRadian:c}},R1=function(e){var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},z1=function(e,t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},B1=function(e,t){var n=e.x,r=e.y,i=L1({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac)return!1;if(a===0)return!0;var l=R1(t),u=l.startAngle,d=l.endAngle,f=o,p;if(u<=d){for(;f>d;)f-=360;for(;f=u&&f<=d}else{for(;f>u;)f-=360;for(;f=d&&f<=u}return p?k1(k1({},t),{},{radius:a,angle:z1(f,t)}):null};function V1(e){"@babel/helpers - typeof";return V1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},V1(e)}var H1=[`offset`];function U1(e){return Fre(e)||K1(e)||G1(e)||W1()}function W1(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G1(e,t){if(e){if(typeof e==`string`)return q1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q1(e,t)}}function K1(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Fre(e){if(Array.isArray(e))return q1(e)}function q1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Y1(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function X1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z1(e){for(var t=1;t=0?1:-1,y,b;r===`insideStart`?(y=f+v*a,b=m):r===`insideEnd`?(y=p-v*a,b=!m):r===`end`&&(y=p+v*a,b=m),b=g<=0?b:!b;var x=F1(c,l,h,y),S=F1(c,l,h,y+(b?1:-1)*359),C=`M${x.x},${x.y} + height and width.`,r,i,o,c,u,d,n);var a=!Array.isArray(p)&&UR(p.type).endsWith(`Chart`);return _.Children.map(p,function(e){return _.isValidElement(e)?(0,_.cloneElement)(e,aG({width:r,height:i},a?{style:aG({height:`100%`,width:`100%`,maxHeight:i,maxWidth:r},e.props.style)}:{})):e})},[n,p,c,f,d,u,T,o]);return _.createElement(`div`,{id:g?`${g}`:void 0,className:Zo(`recharts-responsive-container`,v),style:aG(aG({},x),{},{width:o,height:c,minWidth:u,minHeight:d,maxHeight:f}),ref:S},O)}),gG=function(e){return null};gG.displayName=`Cell`;function _G(e){"@babel/helpers - typeof";return _G=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_G(e)}function vG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yG(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||jW.isSsr)return{width:0,height:0};var n=DG(t),r=JSON.stringify({text:e,copyStyle:n});if(CG.widthCache[r])return CG.widthCache[r];try{var i=document.getElementById(EG);i||(i=document.createElement(`span`),i.setAttribute(`id`,EG),i.setAttribute(`aria-hidden`,`true`),document.body.appendChild(i));var a=yG(yG({},TG),n);Object.assign(i.style,a),i.textContent=`${e}`;var o=i.getBoundingClientRect(),s={width:o.width,height:o.height};return CG.widthCache[r]=s,++CG.cacheCount>wG&&(CG.cacheCount=0,CG.widthCache={}),s}catch{return{width:0,height:0}}},kG=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function AG(e){"@babel/helpers - typeof";return AG=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},AG(e)}function jG(e,t){return IG(e)||FG(e,t)||NG(e,t)||MG()}function MG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NG(e,t){if(e){if(typeof e==`string`)return PG(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return PG(e,t)}}function PG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sK(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function cK(e,t){return pK(e)||fK(e,t)||uK(e,t)||lK()}function lK(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uK(e,t){if(e){if(typeof e==`string`)return dK(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dK(e,t)}}function dK(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&arguments[0]!==void 0?arguments[0]:[]).reduce(function(e,t){var a=t.word,o=t.width,s=e[e.length-1];if(s&&(r==null||i||s.width+o+nt.width?e:t})};if(!l)return f;for(var m=`…`,h=function(e){var t=hK({breakAll:c,style:s,children:u.slice(0,e)+m}).wordsWithComputedWidth,n=d(t);return[n.length>a||p(n).width>Number(r),n]},g=0,_=u.length-1,v=0,y;g<=_&&v<=u.length-1;){var b=Math.floor((g+_)/2),x=cK(h(b-1),2),S=x[0],C=x[1],w=cK(h(b),1)[0];if(!S&&!w&&(g=b+1),S&&w&&(_=b-1),!S&&w){y=C;break}v++}return y||f},_K=function(e){return[{words:(0,dR.default)(e)?[]:e.toString().split(mK)}]},vK=function(e){var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!jW.isSsr){var s,c,l=hK({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return _K(r);return gK({breakAll:a,children:r,maxLines:o,style:i},s,c,t,n)}return _K(r)},yK=`#808080`,bK=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.lineHeight,o=a===void 0?`1em`:a,s=e.capHeight,c=s===void 0?`0.71em`:s,l=e.scaleToFit,u=l===void 0?!1:l,d=e.textAnchor,f=d===void 0?`start`:d,p=e.verticalAnchor,m=p===void 0?`end`:p,h=e.fill,g=h===void 0?yK:h,v=oK(e,rK),y=(0,_.useMemo)(function(){return vK({breakAll:v.breakAll,children:v.children,maxLines:v.maxLines,scaleToFit:u,style:v.style,width:v.width})},[v.breakAll,v.children,v.maxLines,u,v.style,v.width]),b=v.dx,x=v.dy,S=v.angle,C=v.className,w=v.breakAll,T=oK(v,iK);if(!hR(n)||!hR(i))return null;var E=n+(Q(b)?b:0),D=i+(Q(x)?x:0),O;switch(m){case`start`:O=nK(`calc(${c})`);break;case`middle`:O=nK(`calc(${(y.length-1)/2} * -${o} + (${c} / 2))`);break;default:O=nK(`calc(${y.length-1} * -${o})`);break}var k=[];if(u){var A=y[0].width,j=v.width;k.push(`scale(${(Q(j)?j/A:1)/A})`)}return S&&k.push(`rotate(${S}, ${E}, ${D})`),k.length&&(T.transform=k.join(` `)),_.createElement(`text`,aK({},ez(T,!0),{x:E,y:D,className:Zo(`recharts-text`,C),textAnchor:f,fill:g.includes(`url`)?yK:g}),y.map(function(e,t){var n=e.words.join(w?``:` `);return _.createElement(`tspan`,{x:E,dy:t===0?O:o,key:`${n}-${t}`},n)}))};function xK(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function SK(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function CK(e){let t,n,r;e.length===2?(t=e===xK||e===SK?e:wK,n=e,r=e):(t=xK,n=(t,n)=>xK(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function wK(){return 0}function TK(e){return e===null?NaN:+e}function*EK(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var DK=CK(xK),OK=DK.right;DK.left,CK(TK).center;var kK=class extends Map{constructor(e,t=NK){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(AK(this,e))}has(e){return super.has(AK(this,e))}set(e,t){return super.set(jK(this,e),t)}delete(e){return super.delete(MK(this,e))}};function AK({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function jK({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function MK({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function NK(e){return typeof e==`object`&&e?e.valueOf():e}function PK(e=xK){if(e===xK)return FK;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function FK(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var IK=Math.sqrt(50),LK=Math.sqrt(10),RK=Math.sqrt(2);function zK(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=IK?10:a>=LK?5:a>=RK?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function WK(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function GK(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?FK:PK(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));GK(e,t,u,d,i)}let a=e[t],o=n,s=r;for(KK(e,n,t),i(e[r],a)>0&&KK(e,n,r);o0;)--s}i(e[n],a)===0?KK(e,n,s):(++s,KK(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function KK(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function qK(e,t,n){if(e=Float64Array.from(EK(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return WK(e);if(t>=1)return UK(e);var r,i=(r-1)*t,a=Math.floor(i),o=UK(GK(e,a).subarray(0,a+1));return o+(WK(e.subarray(a+1))-o)*(i-a)}}function JK(e,t,n=TK){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function YK(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Tq(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Tq(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=fq.exec(e))?new Oq(t[1],t[2],t[3],1):(t=pq.exec(e))?new Oq(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=mq.exec(e))?Tq(t[1],t[2],t[3],t[4]):(t=hq.exec(e))?Tq(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=gq.exec(e))?Fq(t[1],t[2]/100,t[3]/100,1):(t=_q.exec(e))?Fq(t[1],t[2]/100,t[3]/100,t[4]):vq.hasOwnProperty(e)?wq(vq[e]):e===`transparent`?new Oq(NaN,NaN,NaN,0):null}function wq(e){return new Oq(e>>16&255,e>>8&255,e&255,1)}function Tq(e,t,n,r){return r<=0&&(e=t=n=NaN),new Oq(e,t,n,r)}function Eq(e){return e instanceof aq||(e=Cq(e)),e?(e=e.rgb(),new Oq(e.r,e.g,e.b,e.opacity)):new Oq}function Dq(e,t,n,r){return arguments.length===1?Eq(e):new Oq(e,t,n,r??1)}function Oq(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}rq(Oq,Dq,iq(aq,{brighter(e){return e=e==null?sq:sq**+e,new Oq(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?oq:oq**+e,new Oq(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Oq(Nq(this.r),Nq(this.g),Nq(this.b),Mq(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:kq,formatHex:kq,formatHex8:Aq,formatRgb:jq,toString:jq}));function kq(){return`#${Pq(this.r)}${Pq(this.g)}${Pq(this.b)}`}function Aq(){return`#${Pq(this.r)}${Pq(this.g)}${Pq(this.b)}${Pq((isNaN(this.opacity)?1:this.opacity)*255)}`}function jq(){let e=Mq(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Nq(this.r)}, ${Nq(this.g)}, ${Nq(this.b)}${e===1?`)`:`, ${e})`}`}function Mq(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Nq(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pq(e){return e=Nq(e),(e<16?`0`:``)+e.toString(16)}function Fq(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Rq(e,t,n,r)}function Iq(e){if(e instanceof Rq)return new Rq(e.h,e.s,e.l,e.opacity);if(e instanceof aq||(e=Cq(e)),!e)return new Rq;if(e instanceof Rq)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new Rq(o,s,c,e.opacity)}function Lq(e,t,n,r){return arguments.length===1?Iq(e):new Rq(e,t,n,r??1)}function Rq(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}rq(Rq,Lq,iq(aq,{brighter(e){return e=e==null?sq:sq**+e,new Rq(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?oq:oq**+e,new Rq(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Oq(Vq(e>=240?e-240:e+120,i,r),Vq(e,i,r),Vq(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Rq(zq(this.h),Bq(this.s),Bq(this.l),Mq(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Mq(this.opacity);return`${e===1?`hsl(`:`hsla(`}${zq(this.h)}, ${Bq(this.s)*100}%, ${Bq(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function zq(e){return e=(e||0)%360,e<0?e+360:e}function Bq(e){return Math.max(0,Math.min(1,e||0))}function Vq(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Hq=e=>()=>e;function Uq(e,t){return function(n){return e+n*t}}function Wq(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Gq(e){return(e=+e)==1?Kq:function(t,n){return n-t?Wq(t,n,e):Hq(isNaN(t)?n:t)}}function Kq(e,t){var n=t-e;return n?Uq(e,n):Hq(isNaN(e)?t:e)}var qq=(function e(t){var n=Gq(t);function r(e,t){var r=n((e=Dq(e)).r,(t=Dq(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Kq(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Jq(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Qq(r,i)})),n=tJ.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function mJ(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?hJ:mJ,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),Qq))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,lJ),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=oJ,u()},d.clamp=function(e){return arguments.length?(o=e?!0:dJ,u()):o!==dJ},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function vJ(){return _J()(dJ,dJ)}function yJ(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function bJ(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function xJ(e){return e=bJ(Math.abs(e)),e?e[1]:NaN}function SJ(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function CJ(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var wJ=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function TJ(e){if(!(t=wJ.exec(e)))throw Error(`invalid format: `+e);var t;return new EJ({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}TJ.prototype=EJ.prototype;function EJ(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}EJ.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function DJ(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var OJ;function kJ(e,t){var n=bJ(e,t);if(!n)return OJ=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(OJ=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+bJ(e,Math.max(0,t+a-1))[0]}function AJ(e,t){var n=bJ(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var jJ={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:yJ,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>AJ(e*100,t),r:AJ,s:kJ,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function MJ(e){return e}var NJ=Array.prototype.map,PJ=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function FJ(e){var t=e.grouping===void 0||e.thousands===void 0?MJ:SJ(NJ.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?MJ:CJ(NJ.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=TJ(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):jJ[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=jJ[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=DJ(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&OJ!==void 0?PJ[8+OJ/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(xJ(t)/3)))*3,r=10**-n,i=l((e=TJ(e),e.type=`f`,e),{suffix:PJ[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var IJ,LJ,RJ;zJ({thousands:`,`,grouping:[3],currency:[`$`,``]});function zJ(e){return IJ=FJ(e),LJ=IJ.format,RJ=IJ.formatPrefix,IJ}function BJ(e){return Math.max(0,-xJ(Math.abs(e)))}function VJ(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(xJ(t)/3)))*3-xJ(Math.abs(e)))}function HJ(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,xJ(t)-xJ(e))+1}function UJ(e,t,n,r){var i=HK(e,t,n),a;switch(r=TJ(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=VJ(i,o))&&(r.precision=a),RJ(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=HJ(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=BJ(i))&&(r.precision=a-(r.type===`%`)*2);break}return LJ(r)}function WJ(e){var t=e.domain;return e.ticks=function(e){var n=t();return BK(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return UJ(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=VK(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function GJ(){var e=vJ();return e.copy=function(){return gJ(e,GJ())},XK.apply(e,arguments),WJ(e)}function KJ(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,lJ),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return KJ(e).unknown(t)},e=arguments.length?Array.from(e,lJ):[0,1],WJ(n)}function qJ(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function eY(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function tY(e){return(t,n)=>-e(-t,n)}function nY(e){let t=e(JJ,YJ),n=t.domain,r=10,i,a;function o(){return i=eY(r),a=$J(r),n()[0]<0?(i=tY(i),a=tY(a),e(XJ,ZJ)):e(JJ,YJ),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=TJ(n)).precision==null&&(n.trim=!0),n=LJ(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(qJ(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function rY(){let e=nY(_J()).domain([1,10]);return e.copy=()=>gJ(e,rY()).base(e.base()),XK.apply(e,arguments),e}function iY(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function aY(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function oY(e){var t=1,n=e(iY(t),aY(t));return n.constant=function(n){return arguments.length?e(iY(t=+n),aY(t)):t},WJ(n)}function sY(){var e=oY(_J());return e.copy=function(){return gJ(e,sY()).constant(e.constant())},XK.apply(e,arguments)}function cY(e){return function(t){return t<0?-((-t)**+e):t**+e}}function lY(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function uY(e){return e<0?-e*e:e*e}function dY(e){var t=e(dJ,dJ),n=1;function r(){return n===1?e(dJ,dJ):n===.5?e(lY,uY):e(cY(n),cY(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},WJ(t)}function fY(){var e=dY(_J());return e.copy=function(){return gJ(e,fY()).exponent(e.exponent())},XK.apply(e,arguments),e}function pY(){return fY.apply(null,arguments).exponent(.5)}function mY(e){return Math.sign(e)*e*e}function hY(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function gY(){var e=vJ(),t=[0,1],n=!1,r;function i(t){var i=hY(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(mY(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,lJ)).map(mY)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return gY(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},XK.apply(i,arguments),WJ(i)}function _Y(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return vY().domain([e,t]).range(i).unknown(a)},XK.apply(WJ(o),arguments)}function yY(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[OK(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return yY().domain(e).range(t).unknown(n)},XK.apply(i,arguments)}var bY=new Date,xY=new Date;function SY(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sSY(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(bY.setTime(+t),xY.setTime(+r),e(bY),e(xY),Math.floor(n(bY,xY))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var CY=SY(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);CY.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?SY(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):CY),CY.range;var wY=1e3,TY=wY*60,EY=TY*60,DY=EY*24,OY=DY*7,kY=DY*30,AY=DY*365,jY=SY(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*wY)},(e,t)=>(t-e)/wY,e=>e.getUTCSeconds());jY.range;var MY=SY(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*wY)},(e,t)=>{e.setTime(+e+t*TY)},(e,t)=>(t-e)/TY,e=>e.getMinutes());MY.range;var NY=SY(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*TY)},(e,t)=>(t-e)/TY,e=>e.getUTCMinutes());NY.range;var PY=SY(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*wY-e.getMinutes()*TY)},(e,t)=>{e.setTime(+e+t*EY)},(e,t)=>(t-e)/EY,e=>e.getHours());PY.range;var FY=SY(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*EY)},(e,t)=>(t-e)/EY,e=>e.getUTCHours());FY.range;var IY=SY(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*TY)/DY,e=>e.getDate()-1);IY.range;var LY=SY(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/DY,e=>e.getUTCDate()-1);LY.range;var RY=SY(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/DY,e=>Math.floor(e/DY));RY.range;function zY(e){return SY(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*TY)/OY)}var BY=zY(0),VY=zY(1),HY=zY(2),UY=zY(3),WY=zY(4),GY=zY(5),KY=zY(6);BY.range,VY.range,HY.range,UY.range,WY.range,GY.range,KY.range;function qY(e){return SY(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/OY)}var JY=qY(0),YY=qY(1),XY=qY(2),ZY=qY(3),QY=qY(4),$Y=qY(5),eX=qY(6);JY.range,YY.range,XY.range,ZY.range,QY.range,$Y.range,eX.range;var tX=SY(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());tX.range;var nX=SY(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());nX.range;var rX=SY(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());rX.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:SY(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),rX.range;var iX=SY(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());iX.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:SY(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),iX.range;function aX(e,t,n,r,i,a){let o=[[jY,1,wY],[jY,5,5*wY],[jY,15,15*wY],[jY,30,30*wY],[a,1,TY],[a,5,5*TY],[a,15,15*TY],[a,30,30*TY],[i,1,EY],[i,3,3*EY],[i,6,6*EY],[i,12,12*EY],[r,1,DY],[r,2,2*DY],[n,1,OY],[t,1,kY],[t,3,3*kY],[e,1,AY]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(HK(t/AY,n/AY,r));if(a===0)return CY.every(Math.max(HK(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=dX(fX(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?YY.ceil(a):YY(a),a=LY.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=uX(fX(r.y,0,1)),o=a.getDay(),a=o>4||o===0?VY.ceil(a):VY(a),a=IY.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else (`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?dX(fX(r.y,0,1)).getUTCDay():uX(fX(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,dX(r)):uX(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in mX?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function F(e){return c[e.getMonth()]}function ee(e){return s[e.getMonth()]}function te(e){return i[+(e.getHours()>=12)]}function ne(e){return 1+~~(e.getMonth()/3)}function re(e){return o[e.getUTCDay()]}function ie(e){return a[e.getUTCDay()]}function ae(e){return c[e.getUTCMonth()]}function oe(e){return s[e.getUTCMonth()]}function se(e){return i[+(e.getUTCHours()>=12)]}function ce(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var mX={"-":``,_:` `,0:`0`},hX=/^\s*\d+/,gX=/^%/,_X=/[\\^$*+?|[\]().{}]/g;function vX(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function SX(e,t,n){var r=hX.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function CX(e,t,n){var r=hX.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function wX(e,t,n){var r=hX.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function TX(e,t,n){var r=hX.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function EX(e,t,n){var r=hX.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function DX(e,t,n){var r=hX.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function OX(e,t,n){var r=hX.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function kX(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function AX(e,t,n){var r=hX.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function jX(e,t,n){var r=hX.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function MX(e,t,n){var r=hX.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function NX(e,t,n){var r=hX.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function PX(e,t,n){var r=hX.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function FX(e,t,n){var r=hX.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function IX(e,t,n){var r=hX.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function LX(e,t,n){var r=hX.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function RX(e,t,n){var r=hX.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function zX(e,t,n){var r=gX.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function BX(e,t,n){var r=hX.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function VX(e,t,n){var r=hX.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function HX(e,t){return vX(e.getDate(),t,2)}function UX(e,t){return vX(e.getHours(),t,2)}function WX(e,t){return vX(e.getHours()%12||12,t,2)}function GX(e,t){return vX(1+IY.count(rX(e),e),t,3)}function KX(e,t){return vX(e.getMilliseconds(),t,3)}function qX(e,t){return KX(e,t)+`000`}function JX(e,t){return vX(e.getMonth()+1,t,2)}function YX(e,t){return vX(e.getMinutes(),t,2)}function XX(e,t){return vX(e.getSeconds(),t,2)}function ZX(e){var t=e.getDay();return t===0?7:t}function QX(e,t){return vX(BY.count(rX(e)-1,e),t,2)}function $X(e){var t=e.getDay();return t>=4||t===0?WY(e):WY.ceil(e)}function eZ(e,t){return e=$X(e),vX(WY.count(rX(e),e)+(rX(e).getDay()===4),t,2)}function tZ(e){return e.getDay()}function nZ(e,t){return vX(VY.count(rX(e)-1,e),t,2)}function rZ(e,t){return vX(e.getFullYear()%100,t,2)}function iZ(e,t){return e=$X(e),vX(e.getFullYear()%100,t,2)}function aZ(e,t){return vX(e.getFullYear()%1e4,t,4)}function oZ(e,t){var n=e.getDay();return e=n>=4||n===0?WY(e):WY.ceil(e),vX(e.getFullYear()%1e4,t,4)}function sZ(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+vX(t/60|0,`0`,2)+vX(t%60,`0`,2)}function cZ(e,t){return vX(e.getUTCDate(),t,2)}function lZ(e,t){return vX(e.getUTCHours(),t,2)}function uZ(e,t){return vX(e.getUTCHours()%12||12,t,2)}function dZ(e,t){return vX(1+LY.count(iX(e),e),t,3)}function fZ(e,t){return vX(e.getUTCMilliseconds(),t,3)}function pZ(e,t){return fZ(e,t)+`000`}function mZ(e,t){return vX(e.getUTCMonth()+1,t,2)}function hZ(e,t){return vX(e.getUTCMinutes(),t,2)}function gZ(e,t){return vX(e.getUTCSeconds(),t,2)}function _Z(e){var t=e.getUTCDay();return t===0?7:t}function vZ(e,t){return vX(JY.count(iX(e)-1,e),t,2)}function yZ(e){var t=e.getUTCDay();return t>=4||t===0?QY(e):QY.ceil(e)}function bZ(e,t){return e=yZ(e),vX(QY.count(iX(e),e)+(iX(e).getUTCDay()===4),t,2)}function xZ(e){return e.getUTCDay()}function SZ(e,t){return vX(YY.count(iX(e)-1,e),t,2)}function CZ(e,t){return vX(e.getUTCFullYear()%100,t,2)}function wZ(e,t){return e=yZ(e),vX(e.getUTCFullYear()%100,t,2)}function TZ(e,t){return vX(e.getUTCFullYear()%1e4,t,4)}function EZ(e,t){var n=e.getUTCDay();return e=n>=4||n===0?QY(e):QY.ceil(e),vX(e.getUTCFullYear()%1e4,t,4)}function DZ(){return`+0000`}function OZ(){return`%`}function kZ(e){return+e}function AZ(e){return Math.floor(e/1e3)}var jZ,MZ,NZ;PZ({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function PZ(e){return jZ=pX(e),MZ=jZ.format,jZ.parse,NZ=jZ.utcFormat,jZ.utcParse,jZ}function FZ(e){return new Date(e)}function IZ(e){return e instanceof Date?+e:+new Date(+e)}function LZ(e,t,n,r,i,a,o,s,c,l){var u=vJ(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>qK(e,r/t))},n.copy=function(){return qZ(t).domain(e)},ZK.apply(n,arguments)}function JZ(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=dJ,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*eeq,scaleDiverging:()=>YZ,scaleDivergingLog:()=>XZ,scaleDivergingPow:()=>QZ,scaleDivergingSqrt:()=>$Z,scaleDivergingSymlog:()=>ZZ,scaleIdentity:()=>KJ,scaleImplicit:()=>QK,scaleLinear:()=>GJ,scaleLog:()=>rY,scaleOrdinal:()=>$K,scalePoint:()=>nq,scalePow:()=>fY,scaleQuantile:()=>_Y,scaleQuantize:()=>vY,scaleRadial:()=>gY,scaleSequential:()=>HZ,scaleSequentialLog:()=>UZ,scaleSequentialPow:()=>GZ,scaleSequentialQuantile:()=>qZ,scaleSequentialSqrt:()=>KZ,scaleSequentialSymlog:()=>WZ,scaleSqrt:()=>pY,scaleSymlog:()=>sY,scaleThreshold:()=>yY,scaleTime:()=>RZ,scaleUtc:()=>zZ,tickFormat:()=>UJ}),tQ=o(((e,t)=>{var n=wL();function r(e,t,r){for(var i=-1,a=e.length;++i{function n(e,t){return e>t}t.exports=n})),rQ=o(((e,t)=>{var n=tQ(),r=nQ(),i=FH();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),iQ=o(((e,t)=>{function n(e,t){return e{var n=tQ(),r=iQ(),i=FH();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),oQ=o(((e,t)=>{var n=JL(),r=zH(),i=DU(),a=vL();function o(e,t){return(a(e)?n:i)(e,r(t,3))}t.exports=o})),sQ=o(((e,t)=>{var n=xU(),r=oQ();function i(e,t){return n(r(e,t),1)}t.exports=i})),cQ=o(((e,t)=>{var n=TH();function r(e,t){return n(e,t)}t.exports=r})),lQ=o(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}else if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i);if((i=e[r=`LN10`])!==void 0)if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i);return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}));function uQ(e){return mQ(e)||pQ(e)||fQ(e)||dQ()}function dQ(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fQ(e,t){if(e){if(typeof e==`string`)return hQ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hQ(e,t)}}function pQ(e){if(typeof Symbol<`u`&&Symbol.iterator in Object(e))return Array.from(e)}function mQ(e){if(Array.isArray(e))return hQ(e)}function hQ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=t?n.apply(void 0,r):e(t-i,yQ(function(){var e=[...arguments],t=r.map(function(t){return vQ(t)?e.shift():t});return n.apply(void 0,uQ(t).concat(e))}))})},xQ=function(e){return bQ(e.length,e)},SQ=function(e,t){for(var n=[],r=e;re.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw a}}return n}}function BQ(e){if(Array.isArray(e))return e}function VQ(e){var t=FQ(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]}function HQ(e,t,n){if(e.lte(0))return new DQ.default(0);var r=AQ.getDigitCount(e.toNumber()),i=new DQ.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new DQ.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?s:new DQ.default(Math.ceil(s))}function UQ(e,t,n){var r=1,i=new DQ.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new DQ.default(10).pow(AQ.getDigitCount(e)-1),i=new DQ.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new DQ.default(Math.floor(e)))}else e===0?i=new DQ.default(Math.floor((t-1)/2)):n||(i=new DQ.default(Math.floor(e)));var o=Math.floor((t-1)/2);return wQ(CQ(function(e){return i.add(new DQ.default(e-o).mul(r)).toNumber()}),SQ)(0,t)}function WQ(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new DQ.default(0),tickMin:new DQ.default(0),tickMax:new DQ.default(0)};var a=HQ(new DQ.default(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new DQ.default(0):(o=new DQ.default(e).add(t).div(2),o=o.sub(new DQ.default(o).mod(a)));var s=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new DQ.default(t).sub(o).div(a).toNumber()),l=s+c+1;return l>n?WQ(e,t,n,r,i+1):(l0?c+(n-l):c,s=t>0?s:s+(n-l)),{step:a,tickMin:o.sub(new DQ.default(s).mul(a)),tickMax:o.add(new DQ.default(c).mul(a))})}function GQ(e){var t=FQ(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),s=FQ(VQ([n,r]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0){var u=l===1/0?[c].concat(jQ(SQ(0,i-1).map(function(){return 1/0}))):[].concat(jQ(SQ(0,i-1).map(function(){return-1/0})),[l]);return n>r?TQ(u):u}if(c===l)return UQ(c,i,a);var d=WQ(c,l,o,a),f=d.step,p=d.tickMin,m=d.tickMax,h=AQ.rangeStep(p,m.add(new DQ.default(.1).mul(f)),f);return n>r?TQ(h):h}function KQ(e,t){var n=FQ(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=FQ(VQ([r,i]),2),s=o[0],c=o[1];if(s===-1/0||c===1/0)return[r,i];if(s===c)return[s];var l=Math.max(t,2),u=HQ(new DQ.default(c).sub(s).div(l-1),a,0),d=[].concat(jQ(AQ.rangeStep(new DQ.default(s),new DQ.default(c).sub(new DQ.default(.99).mul(u)),u)),[c]);return r>i?TQ(d):d}var qQ=EQ(GQ),JQ=EQ(KQ),YQ=!0,XQ=`Invariant failed`;function ZQ(e,t){if(!e){if(YQ)throw Error(XQ);var n=typeof t==`function`?t():t,r=n?`${XQ}: ${n}`:XQ;throw Error(r)}}var QQ=[`offset`,`layout`,`width`,`dataKey`,`data`,`dataPointFormatter`,`xAxis`,`yAxis`];function $Q(e){"@babel/helpers - typeof";return $Q=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},$Q(e)}function e$(){return e$=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function c$(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function l$(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function u$(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=-1,a=t?.length??0;if(a<=1)return 0;if(r&&r.axisType===`angleAxis`&&Math.abs(Math.abs(r.range[1]-r.range[0])-360)<=1e-6)for(var o=r.range,s=0;s0?n[s-1].coordinate:n[a-1].coordinate,l=n[s].coordinate,u=s>=a-1?n[0].coordinate:n[s+1].coordinate,d=void 0;if(fR(l-c)!==fR(u-l)){var f=[];if(fR(u-l)===fR(o[1]-o[0])){d=u;var p=l+o[1]-o[0];f[0]=Math.min(p,(p+c)/2),f[1]=Math.max(p,(p+c)/2)}else{d=c;var m=u+o[1]-o[0];f[0]=Math.min(l,(m+l)/2),f[1]=Math.max(l,(m+l)/2)}var h=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(e>h[0]&&e<=h[1]||e>=f[0]&&e<=f[1]){i=n[s].index;break}}else{var g=Math.min(c,u),_=Math.max(c,u);if(e>(g+l)/2&&e<=(_+l)/2){i=n[s].index;break}}}else for(var v=0;v0&&v(t[v].coordinate+t[v-1].coordinate)/2&&e<=(t[v].coordinate+t[v+1].coordinate)/2||v===a-1&&e>(t[v].coordinate+t[v-1].coordinate)/2){i=t[v].index;break}return i},Y$=function(e){var t,n=e.type.displayName,r=(t=e.type)!=null&&t.defaultProps?H$(H$({},e.type.defaultProps),e.props):e.props,i=r.stroke,a=r.fill,o;switch(n){case`Line`:o=i;break;case`Area`:case`Radar`:o=i&&i!==`none`?i:a;break;default:o=a;break}return o},X$=function(e){var t=e.barSize,n=e.totalSize,r=e.stackGroups,i=r===void 0?{}:r;if(!i)return{};for(var a={},o=Object.keys(i),s=0,c=o.length;s=0});if(g&&g.length){var _=g[0].type.defaultProps,v=_===void 0?g[0].props:H$(H$({},_),g[0].props),y=v.barSize,b=v[h];a[b]||(a[b]=[]);var x=(0,dR.default)(y)?t:y;a[b].push({item:g[0],stackList:g.slice(1),barSize:(0,dR.default)(x)?void 0:vR(x,n,0)})}}return a},Z$=function(e){var t=e.barGap,n=e.barCategoryGap,r=e.bandSize,i=e.sizeList,a=i===void 0?[]:i,o=e.maxBarSize,s=a.length;if(s<1)return null;var c=vR(t,r,0,!0),l,u=[];if(a[0].barSize===+a[0].barSize){var d=!1,f=r/s,p=a.reduce(function(e,t){return e+t.barSize||0},0);p+=(s-1)*c,p>=r&&(p-=(s-1)*c,c=0),p>=r&&f>0&&(d=!0,f*=.9,p=s*f);var m={offset:((r-p)/2>>0)-c,size:0};l=a.reduce(function(e,t){var n={item:t.item,position:{offset:m.offset+m.size+c,size:d?f:t.barSize}},r=[].concat(F$(e),[n]);return m=r[r.length-1].position,t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:m})}),r},u)}else{var h=vR(n,r,0,!0);r-2*h-(s-1)*c<=0&&(c=0);var g=(r-2*h-(s-1)*c)/s;g>1&&(g>>=0);var _=o===+o?Math.min(g,o):g;l=a.reduce(function(e,t,n){var r=[].concat(F$(e),[{item:t.item,position:{offset:h+(g+c)*n+(g-_)/2,size:_}}]);return t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:r[r.length-1].position})}),r},u)}return l},Q$=function(e,t,n,r){var i=n.children,a=n.width,o=n.margin,s=k$({children:i,legendWidth:a-(o.left||0)-(o.right||0)});if(s){var c=r||{},l=c.width,u=c.height,d=s.align,f=s.verticalAlign,p=s.layout;if((p===`vertical`||p===`horizontal`&&f===`middle`)&&d!==`center`&&Q(e[d]))return H$(H$({},e),{},U$({},d,e[d]+(l||0)));if((p===`horizontal`||p===`vertical`&&d===`center`)&&f!==`middle`&&Q(e[f]))return H$(H$({},e),{},U$({},f,e[f]+(u||0)))}return e},$$=function(e,t,n){return(0,dR.default)(t)?!0:e===`horizontal`?t===`yAxis`:e===`vertical`||n===`x`?t===`xAxis`:n===`y`?t===`yAxis`:!0},e1=function(e,t,n,r,i){var a=t.props.children,o=qR(a,S$).filter(function(e){return $$(r,i,e.props.direction)});if(o&&o.length){var s=o.map(function(e){return e.props.dataKey});return e.reduce(function(e,t){var r=K$(t,n);if((0,dR.default)(r))return e;var i=Array.isArray(r)?[(0,j$.default)(r),(0,A$.default)(r)]:[r,r],a=s.reduce(function(e,n){var r=K$(t,n,0),a=i[0]-Math.abs(Array.isArray(r)?r[0]:r),o=i[1]+Math.abs(Array.isArray(r)?r[1]:r);return[Math.min(a,e[0]),Math.max(o,e[1])]},[1/0,-1/0]);return[Math.min(a[0],e[0]),Math.max(a[1],e[1])]},[1/0,-1/0])}return null},t1=function(e,t,n,r,i){var a=t.map(function(t){return e1(e,t,n,i,r)}).filter(function(e){return!(0,dR.default)(e)});return a&&a.length?a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]):null},n1=function(e,t,n,r,i){var a=t.map(function(t){var a=t.props.dataKey;return n===`number`&&a&&e1(e,t,a,r)||q$(e,a,n,i)});if(n===`number`)return a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]);var o={};return a.reduce(function(e,t){for(var n=0,r=t.length;n=2?fR(o[0]-o[1])*2*c:c,t&&(e.ticks||e.niceTicks)?(e.ticks||e.niceTicks).map(function(e){return{coordinate:r(i?i.indexOf(e):e)+c,value:e,offset:c}}).filter(function(e){return!(0,cR.default)(e.coordinate)}):e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(e,t){return{coordinate:r(e)+c,value:e,index:t,offset:c}}):r.ticks&&!n?r.ticks(e.tickCount).map(function(e){return{coordinate:r(e)+c,value:e,offset:c}}):r.domain().map(function(e,t){return{coordinate:r(e)+c,value:i?i[e]:e,index:t,offset:c}})},a1=new WeakMap,o1=function(e,t){if(typeof t!=`function`)return e;a1.has(e)||a1.set(e,new WeakMap);var n=a1.get(e);if(n.has(t))return n.get(t);var r=function(){e.apply(void 0,arguments),t.apply(void 0,arguments)};return n.set(t,r),r},s1=function(e,t,n){var r=e.scale,i=e.type,a=e.layout,o=e.axisType;if(r===`auto`)return a===`radial`&&o===`radiusAxis`?{scale:eq(),realScaleType:`band`}:a===`radial`&&o===`angleAxis`?{scale:GJ(),realScaleType:`linear`}:i===`category`&&t&&(t.indexOf(`LineChart`)>=0||t.indexOf(`AreaChart`)>=0||t.indexOf(`ComposedChart`)>=0&&!n)?{scale:nq(),realScaleType:`point`}:i===`category`?{scale:eq(),realScaleType:`band`}:{scale:GJ(),realScaleType:`linear`};if((0,sR.default)(r)){var s=`scale${(0,XB.default)(r)}`;return{scale:(eQ[s]||nq)(),realScaleType:eQ[s]?s:`point`}}return(0,FR.default)(r)?{scale:r}:{scale:nq(),realScaleType:`point`}},c1=1e-4,l1=function(e){var t=e.domain();if(!(!t||t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-c1,a=Math.max(r[0],r[1])+c1,o=e(t[0]),s=e(t[n-1]);(oa||sa)&&e.domain([t[0],t[n-1]])}},u1=function(e,t){if(!e)return null;for(var n=0,r=e.length;nr)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]=0?(e[o][n][0]=i,e[o][n][1]=i+s,i=e[o][n][1]):(e[o][n][0]=a,e[o][n][1]=a+s,a=e[o][n][1])}},expand:qB,none:HB,silhouette:JB,wiggle:YB,positive:function(e){var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[a][n][0]=i,e[a][n][1]=i+o,i=e[a][n][1]):(e[a][n][0]=0,e[a][n][1]=0)}}},p1=function(e,t,n){var r=t.map(function(e){return e.props.dataKey}),i=f1[n];return KB().keys(r).value(function(e,t){return+K$(e,t,0)}).order(UB).offset(i)(e)},m1=function(e,t,n,r,i,a){if(!e)return null;var o=(a?t.reverse():t).reduce(function(e,t){var i,a=(i=t.type)!=null&&i.defaultProps?H$(H$({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(a.hide)return e;var s=a[n],c=e[s]||{hasStack:!1,stackGroups:{}};if(hR(o)){var l=c.stackGroups[o]||{numericAxisId:n,cateAxisId:r,items:[]};l.items.push(t),c.hasStack=!0,c.stackGroups[o]=l}else c.stackGroups[_R(`_stackId_`)]={numericAxisId:n,cateAxisId:r,items:[t]};return H$(H$({},e),{},U$({},s,c))},{});return Object.keys(o).reduce(function(t,a){var s=o[a];return s.hasStack&&(s.stackGroups=Object.keys(s.stackGroups).reduce(function(t,a){var o=s.stackGroups[a];return H$(H$({},t),{},U$({},a,{numericAxisId:n,cateAxisId:r,items:o.items,stackedData:p1(e,o.items,i)}))},{})),H$(H$({},t),{},U$({},a,s))},{})},h1=function(e,t){var n=t.realScaleType,r=t.type,i=t.tickCount,a=t.originalDomain,o=t.allowDecimals,s=n||t.scale;if(s!==`auto`&&s!==`linear`)return null;if(i&&r===`number`&&a&&(a[0]===`auto`||a[1]===`auto`)){var c=e.domain();if(!c.length)return null;var l=qQ(c,i,o);return e.domain([(0,j$.default)(l),(0,A$.default)(l)]),{niceTicks:l}}return i&&r===`number`?{niceTicks:JQ(e.domain(),i,o)}:null};function g1(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!(0,dR.default)(i[t.dataKey])){var s=SR(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=K$(i,(0,dR.default)(o)?t.dataKey:o);return(0,dR.default)(c)?null:t.scale(c)}var _1=function(e){var t=e.axis,n=e.ticks,r=e.offset,i=e.bandSize,a=e.entry,o=e.index;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=K$(a,t.dataKey,t.domain[o]);return(0,dR.default)(s)?null:t.scale(s)-i/2+r},v1=function(e){var t=e.numericAxis,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},y1=function(e,t){var n,r=((n=e.type)!=null&&n.defaultProps?H$(H$({},e.type.defaultProps),e.props):e.props).stackId;if(hR(r)){var i=t[r];if(i){var a=i.items.indexOf(e);return a>=0?i.stackedData[a]:null}}return null},b1=function(e){return e.reduce(function(e,t){return[(0,j$.default)(t.concat([e[0]]).filter(Q)),(0,A$.default)(t.concat([e[1]]).filter(Q))]},[1/0,-1/0])},x1=function(e,t,n){return Object.keys(e).reduce(function(r,i){var a=e[i].stackedData.reduce(function(e,r){var i=b1(r.slice(t,n+1));return[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]).map(function(e){return e===1/0||e===-1/0?0:e})},S1=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,C1=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,w1=function(e,t,n){if((0,FR.default)(e))return e(t,n);if(!Array.isArray(e))return t;var r=[];if(Q(e[0]))r[0]=n?e[0]:Math.min(e[0],t[0]);else if(S1.test(e[0])){var i=+S1.exec(e[0])[1];r[0]=t[0]-i}else (0,FR.default)(e[0])?r[0]=e[0](t[0]):r[0]=t[0];if(Q(e[1]))r[1]=n?e[1]:Math.max(e[1],t[1]);else if(C1.test(e[1])){var a=+C1.exec(e[1])[1];r[1]=t[1]+a}else (0,FR.default)(e[1])?r[1]=e[1](t[1]):r[1]=t[1];return r},T1=function(e,t,n){if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,VU.default)(t,function(e){return e.coordinate}),a=1/0,o=1,s=i.length;oa&&(c=2*Math.PI-c),{radius:o,angle:F1(c),angleInRadian:c}},z1=function(e){var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},B1=function(e,t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},V1=function(e,t){var n=e.x,r=e.y,i=R1({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac)return!1;if(a===0)return!0;var l=z1(t),u=l.startAngle,d=l.endAngle,f=o,p;if(u<=d){for(;f>d;)f-=360;for(;f=u&&f<=d}else{for(;f>u;)f-=360;for(;f=d&&f<=u}return p?A1(A1({},t),{},{radius:a,angle:B1(f,t)}):null};function H1(e){"@babel/helpers - typeof";return H1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},H1(e)}var U1=[`offset`];function W1(e){return J1(e)||q1(e)||K1(e)||G1()}function G1(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K1(e,t){if(e){if(typeof e==`string`)return Y1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Y1(e,t)}}function q1(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function J1(e){if(Array.isArray(e))return Y1(e)}function Y1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function X1(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Z1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q1(e){for(var t=1;t=0?1:-1,y,b;r===`insideStart`?(y=f+v*a,b=m):r===`insideEnd`?(y=p-v*a,b=!m):r===`end`&&(y=p+v*a,b=m),b=g<=0?b:!b;var x=I1(c,l,h,y),S=I1(c,l,h,y+(b?1:-1)*359),C=`M${x.x},${x.y} A${h},${h},0,1,${+!b}, - ${S.x},${S.y}`,w=(0,uR.default)(e.id)?gR(`recharts-radial-line-`):e.id;return _.createElement(`text`,t0({},n,{dominantBaseline:`central`,className:Zo(`recharts-radial-bar-label`,o)}),_.createElement(`defs`,null,_.createElement(`path`,{id:w,d:C})),_.createElement(`textPath`,{xlinkHref:`#${w}`},t))},a0=function(e){var t=e.viewBox,n=e.offset,r=e.position,i=t,a=i.cx,o=i.cy,s=i.innerRadius,c=i.outerRadius,l=(i.startAngle+i.endAngle)/2;if(r===`outside`){var u=F1(a,o,c+n,l),d=u.x;return{x:d,y:u.y,textAnchor:d>=a?`start`:`end`,verticalAnchor:`middle`}}if(r===`center`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`middle`};if(r===`centerTop`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`start`};if(r===`centerBottom`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`end`};var f=F1(a,o,(s+c)/2,l);return{x:f.x,y:f.y,textAnchor:`middle`,verticalAnchor:`middle`}},o0=function(e){var t=e.viewBox,n=e.parentViewBox,r=e.offset,i=e.position,a=t,o=a.x,s=a.y,c=a.width,l=a.height,u=l>=0?1:-1,d=u*r,f=u>0?`end`:`start`,p=u>0?`start`:`end`,m=c>=0?1:-1,h=m*r,g=m>0?`end`:`start`,_=m>0?`start`:`end`;if(i===`top`)return Z1(Z1({},{x:o+c/2,y:s-u*r,textAnchor:`middle`,verticalAnchor:f}),n?{height:Math.max(s-n.y,0),width:c}:{});if(i===`bottom`)return Z1(Z1({},{x:o+c/2,y:s+l+d,textAnchor:`middle`,verticalAnchor:p}),n?{height:Math.max(n.y+n.height-(s+l),0),width:c}:{});if(i===`left`){var v={x:o-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`};return Z1(Z1({},v),n?{width:Math.max(v.x-n.x,0),height:l}:{})}if(i===`right`){var y={x:o+c+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`};return Z1(Z1({},y),n?{width:Math.max(n.x+n.width-y.x,0),height:l}:{})}var b=n?{width:c,height:l}:{};return i===`insideLeft`?Z1({x:o+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`},b):i===`insideRight`?Z1({x:o+c-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`},b):i===`insideTop`?Z1({x:o+c/2,y:s+d,textAnchor:`middle`,verticalAnchor:p},b):i===`insideBottom`?Z1({x:o+c/2,y:s+l-d,textAnchor:`middle`,verticalAnchor:f},b):i===`insideTopLeft`?Z1({x:o+h,y:s+d,textAnchor:_,verticalAnchor:p},b):i===`insideTopRight`?Z1({x:o+c-h,y:s+d,textAnchor:g,verticalAnchor:p},b):i===`insideBottomLeft`?Z1({x:o+h,y:s+l-d,textAnchor:_,verticalAnchor:f},b):i===`insideBottomRight`?Z1({x:o+c-h,y:s+l-d,textAnchor:g,verticalAnchor:f},b):(0,wR.default)(i)&&(Q(i.x)||fR(i.x))&&(Q(i.y)||fR(i.y))?Z1({x:o+_R(i.x,c),y:s+_R(i.y,l),textAnchor:`end`,verticalAnchor:`end`},b):Z1({x:o+c/2,y:s+l/2,textAnchor:`middle`,verticalAnchor:`middle`},b)},s0=function(e){return`cx`in e&&Q(e.cx)};function c0(e){var t=e.offset,n=t===void 0?5:t,r=J1(e,H1),i=Z1({offset:n},r),a=i.viewBox,o=i.position,s=i.value,c=i.children,l=i.content,u=i.className,d=u===void 0?``:u,f=i.textBreakAll;if(!a||(0,uR.default)(s)&&(0,uR.default)(c)&&!(0,_.isValidElement)(l)&&!(0,PR.default)(l))return null;if((0,_.isValidElement)(l))return(0,_.cloneElement)(l,i);var p;if((0,PR.default)(l)){if(p=(0,_.createElement)(l,i),(0,_.isValidElement)(p))return p}else p=n0(i);var m=s0(a),h=$R(i,!0);if(m&&(o===`insideStart`||o===`insideEnd`||o===`end`))return i0(i,p,h);var g=m?a0(i):o0(i);return _.createElement(yK,t0({className:Zo(`recharts-label`,d)},h,g,{breakAll:f}),p)}c0.displayName=`Label`;var l0=function(e){var t=e.cx,n=e.cy,r=e.angle,i=e.startAngle,a=e.endAngle,o=e.r,s=e.radius,c=e.innerRadius,l=e.outerRadius,u=e.x,d=e.y,f=e.top,p=e.left,m=e.width,h=e.height,g=e.clockWise,_=e.labelViewBox;if(_)return _;if(Q(m)&&Q(h)){if(Q(u)&&Q(d))return{x:u,y:d,width:m,height:h};if(Q(f)&&Q(p))return{x:f,y:p,width:m,height:h}}return Q(u)&&Q(d)?{x:u,y:d,width:0,height:0}:Q(t)&&Q(n)?{cx:t,cy:n,startAngle:i||r||0,endAngle:a||r||0,innerRadius:c||0,outerRadius:l||s||o||0,clockWise:g}:e.viewBox?e.viewBox:{}},u0=function(e,t){return e?e===!0?_.createElement(c0,{key:`label-implicit`,viewBox:t}):mR(e)?_.createElement(c0,{key:`label-implicit`,viewBox:t,value:e}):(0,_.isValidElement)(e)?e.type===c0?(0,_.cloneElement)(e,{key:`label-implicit`,viewBox:t}):_.createElement(c0,{key:`label-implicit`,content:e,viewBox:t}):(0,PR.default)(e)?_.createElement(c0,{key:`label-implicit`,content:e,viewBox:t}):(0,wR.default)(e)?_.createElement(c0,t0({viewBox:t},e,{key:`label-implicit`})):null:null};c0.parseViewBox=l0,c0.renderCallByParent=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=l0(e),a=KR(r,c0).map(function(e,n){return(0,_.cloneElement)(e,{viewBox:t||i,key:`label-${n}`})});return n?[u0(e.label,t||i)].concat(U1(a)):a};var d0=l(o(((e,t)=>{function n(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}t.exports=n}))());function f0(e){"@babel/helpers - typeof";return f0=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},f0(e)}var p0=[`valueAccessor`],m0=[`data`,`dataKey`,`clockWise`,`id`,`textBreakAll`];function h0(e){return y0(e)||v0(e)||_0(e)||g0()}function g0(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _0(e,t){if(e){if(typeof e==`string`)return b0(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b0(e,t)}}function v0(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function y0(e){if(Array.isArray(e))return b0(e)}function b0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function O0(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var k0=function(e){return Array.isArray(e.value)?(0,d0.default)(e.value):e.value};function A0(e){var t=e.valueAccessor,n=t===void 0?k0:t,r=D0(e,p0),i=r.data,a=r.dataKey,o=r.clockWise,s=r.id,c=r.textBreakAll,l=D0(r,m0);return!i||!i.length?null:_.createElement(mz,{className:`recharts-label-list`},i.map(function(e,t){var r=(0,uR.default)(a)?n(e,t):G$(e&&e.payload,a),i=(0,uR.default)(s)?{}:{id:`${s}-${t}`};return _.createElement(c0,x0({},$R(e,!0),l,i,{parentViewBox:e.parentViewBox,value:r,textBreakAll:c,viewBox:c0.parseViewBox((0,uR.default)(o)?e:C0(C0({},e),{},{clockWise:o})),key:`label-${t}`,index:t}))}))}A0.displayName=`LabelList`;function j0(e,t){return e?e===!0?_.createElement(A0,{key:`labelList-implicit`,data:t}):_.isValidElement(e)||(0,PR.default)(e)?_.createElement(A0,{key:`labelList-implicit`,data:t,content:e}):(0,wR.default)(e)?_.createElement(A0,x0({data:t},e,{key:`labelList-implicit`})):null:null}function M0(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=KR(r,A0).map(function(e,n){return(0,_.cloneElement)(e,{data:t,key:`labelList-${n}`})});return n?[j0(e.label,t)].concat(h0(i)):i}A0.renderCallByParent=M0;function N0(e){"@babel/helpers - typeof";return N0=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},N0(e)}function P0(){return P0=Object.assign?Object.assign.bind():function(e){for(var t=1;t=a?`start`:`end`,verticalAnchor:`middle`}}if(r===`center`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`middle`};if(r===`centerTop`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`start`};if(r===`centerBottom`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`end`};var f=I1(a,o,(s+c)/2,l);return{x:f.x,y:f.y,textAnchor:`middle`,verticalAnchor:`middle`}},s0=function(e){var t=e.viewBox,n=e.parentViewBox,r=e.offset,i=e.position,a=t,o=a.x,s=a.y,c=a.width,l=a.height,u=l>=0?1:-1,d=u*r,f=u>0?`end`:`start`,p=u>0?`start`:`end`,m=c>=0?1:-1,h=m*r,g=m>0?`end`:`start`,_=m>0?`start`:`end`;if(i===`top`)return Q1(Q1({},{x:o+c/2,y:s-u*r,textAnchor:`middle`,verticalAnchor:f}),n?{height:Math.max(s-n.y,0),width:c}:{});if(i===`bottom`)return Q1(Q1({},{x:o+c/2,y:s+l+d,textAnchor:`middle`,verticalAnchor:p}),n?{height:Math.max(n.y+n.height-(s+l),0),width:c}:{});if(i===`left`){var v={x:o-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`};return Q1(Q1({},v),n?{width:Math.max(v.x-n.x,0),height:l}:{})}if(i===`right`){var y={x:o+c+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`};return Q1(Q1({},y),n?{width:Math.max(n.x+n.width-y.x,0),height:l}:{})}var b=n?{width:c,height:l}:{};return i===`insideLeft`?Q1({x:o+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`},b):i===`insideRight`?Q1({x:o+c-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`},b):i===`insideTop`?Q1({x:o+c/2,y:s+d,textAnchor:`middle`,verticalAnchor:p},b):i===`insideBottom`?Q1({x:o+c/2,y:s+l-d,textAnchor:`middle`,verticalAnchor:f},b):i===`insideTopLeft`?Q1({x:o+h,y:s+d,textAnchor:_,verticalAnchor:p},b):i===`insideTopRight`?Q1({x:o+c-h,y:s+d,textAnchor:g,verticalAnchor:p},b):i===`insideBottomLeft`?Q1({x:o+h,y:s+l-d,textAnchor:_,verticalAnchor:f},b):i===`insideBottomRight`?Q1({x:o+c-h,y:s+l-d,textAnchor:g,verticalAnchor:f},b):(0,TR.default)(i)&&(Q(i.x)||pR(i.x))&&(Q(i.y)||pR(i.y))?Q1({x:o+vR(i.x,c),y:s+vR(i.y,l),textAnchor:`end`,verticalAnchor:`end`},b):Q1({x:o+c/2,y:s+l/2,textAnchor:`middle`,verticalAnchor:`middle`},b)},c0=function(e){return`cx`in e&&Q(e.cx)};function l0(e){var t=e.offset,n=t===void 0?5:t,r=Lre(e,U1),i=Q1({offset:n},r),a=i.viewBox,o=i.position,s=i.value,c=i.children,l=i.content,u=i.className,d=u===void 0?``:u,f=i.textBreakAll;if(!a||(0,dR.default)(s)&&(0,dR.default)(c)&&!(0,_.isValidElement)(l)&&!(0,FR.default)(l))return null;if((0,_.isValidElement)(l))return(0,_.cloneElement)(l,i);var p;if((0,FR.default)(l)){if(p=(0,_.createElement)(l,i),(0,_.isValidElement)(p))return p}else p=r0(i);var m=c0(a),h=ez(i,!0);if(m&&(o===`insideStart`||o===`insideEnd`||o===`end`))return a0(i,p,h);var g=m?o0(i):s0(i);return _.createElement(bK,n0({className:Zo(`recharts-label`,d)},h,g,{breakAll:f}),p)}l0.displayName=`Label`;var u0=function(e){var t=e.cx,n=e.cy,r=e.angle,i=e.startAngle,a=e.endAngle,o=e.r,s=e.radius,c=e.innerRadius,l=e.outerRadius,u=e.x,d=e.y,f=e.top,p=e.left,m=e.width,h=e.height,g=e.clockWise,_=e.labelViewBox;if(_)return _;if(Q(m)&&Q(h)){if(Q(u)&&Q(d))return{x:u,y:d,width:m,height:h};if(Q(f)&&Q(p))return{x:f,y:p,width:m,height:h}}return Q(u)&&Q(d)?{x:u,y:d,width:0,height:0}:Q(t)&&Q(n)?{cx:t,cy:n,startAngle:i||r||0,endAngle:a||r||0,innerRadius:c||0,outerRadius:l||s||o||0,clockWise:g}:e.viewBox?e.viewBox:{}},d0=function(e,t){return e?e===!0?_.createElement(l0,{key:`label-implicit`,viewBox:t}):hR(e)?_.createElement(l0,{key:`label-implicit`,viewBox:t,value:e}):(0,_.isValidElement)(e)?e.type===l0?(0,_.cloneElement)(e,{key:`label-implicit`,viewBox:t}):_.createElement(l0,{key:`label-implicit`,content:e,viewBox:t}):(0,FR.default)(e)?_.createElement(l0,{key:`label-implicit`,content:e,viewBox:t}):(0,TR.default)(e)?_.createElement(l0,n0({viewBox:t},e,{key:`label-implicit`})):null:null};l0.parseViewBox=u0,l0.renderCallByParent=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=u0(e),a=qR(r,l0).map(function(e,n){return(0,_.cloneElement)(e,{viewBox:t||i,key:`label-${n}`})});return n?[d0(e.label,t||i)].concat(W1(a)):a};var f0=l(o(((e,t)=>{function n(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}t.exports=n}))());function p0(e){"@babel/helpers - typeof";return p0=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},p0(e)}var m0=[`valueAccessor`],h0=[`data`,`dataKey`,`clockWise`,`id`,`textBreakAll`];function g0(e){return b0(e)||y0(e)||v0(e)||_0()}function _0(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v0(e,t){if(e){if(typeof e==`string`)return x0(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return x0(e,t)}}function y0(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function b0(e){if(Array.isArray(e))return x0(e)}function x0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function k0(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var A0=function(e){return Array.isArray(e.value)?(0,f0.default)(e.value):e.value};function j0(e){var t=e.valueAccessor,n=t===void 0?A0:t,r=O0(e,m0),i=r.data,a=r.dataKey,o=r.clockWise,s=r.id,c=r.textBreakAll,l=O0(r,h0);return!i||!i.length?null:_.createElement(hz,{className:`recharts-label-list`},i.map(function(e,t){var r=(0,dR.default)(a)?n(e,t):K$(e&&e.payload,a),i=(0,dR.default)(s)?{}:{id:`${s}-${t}`};return _.createElement(l0,S0({},ez(e,!0),l,i,{parentViewBox:e.parentViewBox,value:r,textBreakAll:c,viewBox:l0.parseViewBox((0,dR.default)(o)?e:w0(w0({},e),{},{clockWise:o})),key:`label-${t}`,index:t}))}))}j0.displayName=`LabelList`;function M0(e,t){return e?e===!0?_.createElement(j0,{key:`labelList-implicit`,data:t}):_.isValidElement(e)||(0,FR.default)(e)?_.createElement(j0,{key:`labelList-implicit`,data:t,content:e}):(0,TR.default)(e)?_.createElement(j0,S0({data:t},e,{key:`labelList-implicit`})):null:null}function N0(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=qR(r,j0).map(function(e,n){return(0,_.cloneElement)(e,{data:t,key:`labelList-${n}`})});return n?[M0(e.label,t)].concat(g0(i)):i}j0.renderCallByParent=N0;function P0(e){"@babel/helpers - typeof";return P0=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},P0(e)}function F0(){return F0=Object.assign?Object.assign.bind():function(e){for(var t=1;t180)},${+(a>c)}, ${u.x},${u.y} - `;if(r>0){var f=F1(t,n,r,a),p=F1(t,n,r,c);d+=`L ${p.x},${p.y} + `;if(r>0){var f=I1(t,n,r,a),p=I1(t,n,r,c);d+=`L ${p.x},${p.y} A ${r},${r},0, ${+(Math.abs(s)>180)},${+(a<=c)}, - ${f.x},${f.y} Z`}else d+=`L ${t},${n} Z`;return d},U0=function(e){var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,c=e.startAngle,l=e.endAngle,u=dR(l-c),d=V0({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=V0({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),g=h.circleTangency,_=h.lineTangency,v=h.theta,y=s?Math.abs(c-l):Math.abs(c-l)-m-v;if(y<0)return o?`M ${p.x},${p.y} + ${f.x},${f.y} Z`}else d+=`L ${t},${n} Z`;return d},W0=function(e){var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,c=e.startAngle,l=e.endAngle,u=fR(l-c),d=H0({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=H0({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),g=h.circleTangency,_=h.lineTangency,v=h.theta,y=s?Math.abs(c-l):Math.abs(c-l)-m-v;if(y<0)return o?`M ${p.x},${p.y} a${a},${a},0,0,1,${a*2},0 a${a},${a},0,0,1,${-a*2},0 - `:H0({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=`M ${p.x},${p.y} + `:U0({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=`M ${p.x},${p.y} A${a},${a},0,0,${+(u<0)},${f.x},${f.y} A${i},${i},0,${+(y>180)},${+(u<0)},${g.x},${g.y} A${a},${a},0,0,${+(u<0)},${_.x},${_.y} - `;if(r>0){var x=V0({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),S=x.circleTangency,C=x.lineTangency,w=x.theta,T=V0({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=T.circleTangency,D=T.lineTangency,O=T.theta,k=s?Math.abs(c-l):Math.abs(c-l)-w-O;if(k<0&&a===0)return`${b}L${t},${n}Z`;b+=`L${D.x},${D.y} + `;if(r>0){var x=H0({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),S=x.circleTangency,C=x.lineTangency,w=x.theta,T=H0({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=T.circleTangency,D=T.lineTangency,O=T.theta,k=s?Math.abs(c-l):Math.abs(c-l)-w-O;if(k<0&&a===0)return`${b}L${t},${n}Z`;b+=`L${D.x},${D.y} A${a},${a},0,0,${+(u<0)},${E.x},${E.y} A${r},${r},0,${+(k>180)},${+(u>0)},${S.x},${S.y} - A${a},${a},0,0,${+(u<0)},${C.x},${C.y}Z`}else b+=`L${t},${n}Z`;return b},W0={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},G0=function(e){var t=I0(I0({},W0),e),n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,s=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,u=t.endAngle,d=t.className;if(a0&&Math.abs(l-u)<360?U0({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):H0({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return _.createElement(`path`,P0({},$R(t,!0),{className:f,d:h,role:`img`}))};function K0(e){"@babel/helpers - typeof";return K0=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},K0(e)}function q0(){return q0=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),s2=o(((e,t)=>{var n=o2();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),c2=o(((e,t)=>{t.exports=s2()()})),{getOwnPropertyNames:l2,getOwnPropertySymbols:u2}=Object,{hasOwnProperty:d2}=Object.prototype;function f2(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function p2(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function m2(e){return e?.[Symbol.toStringTag]}function h2(e){return l2(e).concat(u2(e))}var g2=Object.hasOwn||((e,t)=>d2.call(e,t));function _2(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var v2=`__v`,y2=`__o`,b2=`_owner`,{getOwnPropertyDescriptor:x2,keys:S2}=Object;function C2(e,t){return e.byteLength===t.byteLength&&I2(new Uint8Array(e),new Uint8Array(t))}function w2(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function T2(e,t){return e.byteLength===t.byteLength&&I2(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function E2(e,t){return _2(e.getTime(),t.getTime())}function D2(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function O2(e,t){return e===t}function k2(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var A2=_2;function j2(e,t,n){let r=S2(e),i=r.length;if(S2(t).length!==i)return!1;for(;i-- >0;)if(!R2(e,t,n,r[i]))return!1;return!0}function M2(e,t,n){let r=h2(e),i=r.length;if(h2(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!R2(e,t,n,a)||(o=x2(e,a),s=x2(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function N2(e,t){return _2(e.valueOf(),t.valueOf())}function P2(e,t){return e.source===t.source&&e.flags===t.flags}function F2(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function I2(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function L2(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function R2(e,t,n,r){return(r===b2||r===y2||r===v2)&&(e.$$typeof||t.$$typeof)?!0:g2(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var z2=`[object ArrayBuffer]`,B2=`[object Arguments]`,V2=`[object Boolean]`,H2=`[object DataView]`,U2=`[object Date]`,W2=`[object Error]`,G2=`[object Map]`,K2=`[object Number]`,q2=`[object Object]`,J2=`[object RegExp]`,Y2=`[object Set]`,X2=`[object String]`,Z2={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Q2=`[object URL]`,$2=Object.prototype.toString;function e4({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=$2.call(h);if(b===U2)return r(h,g,_);if(b===J2)return u(h,g,_);if(b===G2)return o(h,g,_);if(b===Y2)return d(h,g,_);if(b===q2)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===Q2)return p(h,g,_);if(b===W2)return i(h,g,_);if(b===B2)return c(h,g,_);if(Z2[b])return f(h,g,_);if(b===z2)return e(h,g,_);if(b===H2)return n(h,g,_);if(b===V2||b===K2||b===X2)return l(h,g,_);if(m){let e=m[b];if(!e){let t=m2(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function t4({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:C2,areArraysEqual:n?M2:w2,areDataViewsEqual:T2,areDatesEqual:E2,areErrorsEqual:D2,areFunctionsEqual:O2,areMapsEqual:n?f2(k2,M2):k2,areNumbersEqual:A2,areObjectsEqual:n?M2:j2,arePrimitiveWrappersEqual:N2,areRegExpsEqual:P2,areSetsEqual:n?f2(F2,M2):F2,areTypedArraysEqual:n?f2(I2,M2):I2,areUrlsEqual:L2,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=p2(r.areArraysEqual),t=p2(r.areMapsEqual),n=p2(r.areObjectsEqual),i=p2(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function n4(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function r4({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var i4=a4();a4({strict:!0}),a4({circular:!0}),a4({circular:!0,strict:!0}),a4({createInternalComparator:()=>_2}),a4({strict:!0,createInternalComparator:()=>_2}),a4({circular:!0,createInternalComparator:()=>_2}),a4({circular:!0,createInternalComparator:()=>_2,strict:!0});function a4(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=e4(t4(e));return r4({circular:t,comparator:a,createState:r,equals:n?n(a):n4(a),strict:i})}function o4(e){typeof requestAnimationFrame<`u`&&requestAnimationFrame(e)}function s4(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1;requestAnimationFrame(function r(i){n<0&&(n=i),i-n>t?(e(i),n=-1):o4(r)})}function c4(e){"@babel/helpers - typeof";return c4=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},c4(e)}function l4(e){return m4(e)||p4(e)||d4(e)||u4()}function u4(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d4(e,t){if(e){if(typeof e==`string`)return f4(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f4(e,t)}}function f4(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=0&&e<=1}),`[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s`,e);var s=H4(t,r),c=H4(n,i),l=U4(t,r),u=function(e){return e>1?1:e<0?0:e},d=function(e){for(var t=e>1?1:e,n=t,r=0;r<8;++r){var i=s(n)-t,a=l(n);if(Math.abs(i-t)0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,n=t===void 0?100:t,r=e.damping,i=r===void 0?8:r,a=e.dt,o=a===void 0?17:a,s=function(e,t,r){var a=r+(-(e-t)*n-r*i)*o/1e3,s=r*o/1e3+e;return Math.abs(s-t)e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _3(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}function v3(e){return S3(e)||x3(e)||b3(e)||y3()}function y3(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b3(e,t){if(e){if(typeof e==`string`)return C3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C3(e,t)}}function x3(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function S3(e){if(Array.isArray(e))return C3(e)}function C3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function R3(e){return R3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R3(e)}var z3=function(e){M3(n,e);var t=P3(n);function n(e,r){var i;D3(this,n),i=t.call(this,e,r);var a=i.props,o=a.isActive,s=a.attributeName,c=a.from,l=a.to,u=a.steps,d=a.children,f=a.duration;if(i.handleStyleChange=i.handleStyleChange.bind(I3(i)),i.changeStyle=i.changeStyle.bind(I3(i)),!o||f<=0)return i.state={style:{}},typeof d==`function`&&(i.state={style:l}),F3(i);if(u&&u.length)i.state={style:u[0].style};else if(c){if(typeof d==`function`)return i.state={style:c},F3(i);i.state={style:s?E3({},s,c):c}}else i.state={style:{}};return i}return k3(n,[{key:`componentDidMount`,value:function(){var e=this.props,t=e.isActive,n=e.canBegin;this.mounted=!0,!(!t||!n)&&this.runAnimation(this.props)}},{key:`componentDidUpdate`,value:function(e){var t=this.props,n=t.isActive,r=t.canBegin,i=t.attributeName,a=t.shouldReAnimate,o=t.to,s=t.from,c=this.state.style;if(r){if(!n){var l={style:i?E3({},i,o):o};this.state&&c&&(i&&c[i]!==o||!i&&c!==o)&&this.setState(l);return}if(!(i4(e.to,o)&&e.canBegin&&e.isActive)){var u=!e.canBegin||!e.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var d=u||a?s:e.to;if(this.state&&c){var f={style:i?E3({},i,d):d};(i&&c[i]!==d||!i&&c!==d)&&this.setState(f)}this.runAnimation(T3(T3({},this.props),{},{from:d,begin:0}))}}}},{key:`componentWillUnmount`,value:function(){this.mounted=!1;var e=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&=(this.manager.stop(),null),this.stopJSAnimation&&this.stopJSAnimation(),e&&e()}},{key:`handleStyleChange`,value:function(e){this.changeStyle(e)}},{key:`changeStyle`,value:function(e){this.mounted&&this.setState({style:e})}},{key:`runJSAnimation`,value:function(e){var t=this,n=e.from,r=e.to,i=e.duration,a=e.easing,o=e.begin,s=e.onAnimationEnd,c=e.onAnimationStart,l=f3(n,r,K4(a),i,this.changeStyle);this.manager.start([c,o,function(){t.stopJSAnimation=l()},i,s])}},{key:`runStepAnimation`,value:function(e){var t=this,n=e.steps,r=e.begin,i=e.onAnimationStart,a=n[0],o=a.style,s=a.duration,c=s===void 0?0:s;return this.manager.start([i].concat(v3(n.reduce(function(e,r,i){if(i===0)return e;var a=r.duration,o=r.easing,s=o===void 0?`ease`:o,c=r.style,l=r.properties,u=r.onAnimationEnd,d=i>0?n[i-1]:r,f=l||Object.keys(c);if(typeof s==`function`||s===`spring`)return[].concat(v3(e),[t.runJSAnimation.bind(t,{from:d.style,to:c,duration:a,easing:s}),a]);var p=E4(f,a,s),m=T3(T3(T3({},d.style),c),{},{transition:p});return[].concat(v3(e),[m,a,u]).filter(C4)},[o,Math.max(c,r)])),[e.onAnimationEnd]))}},{key:`runAnimation`,value:function(e){this.manager||=h4();var t=e.begin,n=e.duration,r=e.attributeName,i=e.to,a=e.easing,o=e.onAnimationStart,s=e.onAnimationEnd,c=e.steps,l=e.children,u=this.manager;if(this.unSubscribe=u.subscribe(this.handleStyleChange),typeof a==`function`||typeof l==`function`||a===`spring`){this.runJSAnimation(e);return}if(c.length>1){this.runStepAnimation(e);return}var d=r?E3({},r,i):i,f=E4(Object.keys(d),n,a);u.start([o,t,T3(T3({},d),{},{transition:f}),n,s])}},{key:`render`,value:function(){var e=this.props,t=e.children;e.begin;var n=e.duration;e.attributeName,e.easing;var r=e.isActive;e.steps,e.from,e.to,e.canBegin,e.onAnimationEnd,e.shouldReAnimate,e.onAnimationReStart;var i=g3(e,h3),a=_.Children.count(t),o=this.state.style;if(typeof t==`function`)return t(o);if(!r||a===0||n<=0)return t;var s=function(e){var t=e.props,n=t.style,r=n===void 0?{}:n,a=t.className;return(0,_.cloneElement)(e,T3(T3({},i),{},{style:T3(T3({},r),o),className:a}))};return a===1?s(_.Children.only(t)):_.createElement(`div`,null,_.Children.map(t,function(e){return s(e)}))}}]),n}(_.PureComponent);z3.displayName=`Animate`,z3.defaultProps={begin:0,duration:1e3,from:``,to:``,attributeName:``,easing:`ease`,isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}},z3.propTypes={from:p3.default.oneOfType([p3.default.object,p3.default.string]),to:p3.default.oneOfType([p3.default.object,p3.default.string]),attributeName:p3.default.string,duration:p3.default.number,begin:p3.default.number,easing:p3.default.oneOfType([p3.default.string,p3.default.func]),steps:p3.default.arrayOf(p3.default.shape({duration:p3.default.number.isRequired,style:p3.default.object.isRequired,easing:p3.default.oneOfType([p3.default.oneOf([`ease`,`ease-in`,`ease-out`,`ease-in-out`,`linear`]),p3.default.func]),properties:p3.default.arrayOf(`string`),onAnimationEnd:p3.default.func})),children:p3.default.oneOfType([p3.default.node,p3.default.func]),isActive:p3.default.bool,canBegin:p3.default.bool,onAnimationEnd:p3.default.func,shouldReAnimate:p3.default.bool,onAnimationStart:p3.default.func,onAnimationReStart:p3.default.func};var B3=z3;function V3(e){"@babel/helpers - typeof";return V3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},V3(e)}function H3(){return H3=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0?1:-1,s=n>=0?1:-1,c=+(r>=0&&n>=0||r<0&&n<0),l;if(a>0&&i instanceof Array){for(var u=[0,0,0,0],d=0,f=4;da?a:i[d];l=`M${e},${t+o*u[0]}`,u[0]>0&&(l+=`A ${u[0]},${u[0]},0,0,${c},${e+s*u[0]},${t}`),l+=`L ${e+n-s*u[1]},${t}`,u[1]>0&&(l+=`A ${u[1]},${u[1]},0,0,${c}, + A${a},${a},0,0,${+(u<0)},${C.x},${C.y}Z`}else b+=`L${t},${n}Z`;return b},G0={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},K0=function(e){var t=L0(L0({},G0),e),n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,s=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,u=t.endAngle,d=t.className;if(a0&&Math.abs(l-u)<360?W0({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):U0({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return _.createElement(`path`,F0({},ez(t,!0),{className:f,d:h,role:`img`}))};function q0(e){"@babel/helpers - typeof";return q0=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},q0(e)}function J0(){return J0=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),c2=o(((e,t)=>{var n=s2();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),l2=o(((e,t)=>{t.exports=c2()()})),{getOwnPropertyNames:u2,getOwnPropertySymbols:d2}=Object,{hasOwnProperty:f2}=Object.prototype;function p2(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function m2(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function h2(e){return e?.[Symbol.toStringTag]}function g2(e){return u2(e).concat(d2(e))}var _2=Object.hasOwn||((e,t)=>f2.call(e,t));function v2(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var y2=`__v`,b2=`__o`,x2=`_owner`,{getOwnPropertyDescriptor:S2,keys:C2}=Object;function w2(e,t){return e.byteLength===t.byteLength&&L2(new Uint8Array(e),new Uint8Array(t))}function T2(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function E2(e,t){return e.byteLength===t.byteLength&&L2(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function D2(e,t){return v2(e.getTime(),t.getTime())}function O2(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function k2(e,t){return e===t}function A2(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var j2=v2;function M2(e,t,n){let r=C2(e),i=r.length;if(C2(t).length!==i)return!1;for(;i-- >0;)if(!z2(e,t,n,r[i]))return!1;return!0}function N2(e,t,n){let r=g2(e),i=r.length;if(g2(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!z2(e,t,n,a)||(o=S2(e,a),s=S2(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function P2(e,t){return v2(e.valueOf(),t.valueOf())}function F2(e,t){return e.source===t.source&&e.flags===t.flags}function I2(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function L2(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function R2(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function z2(e,t,n,r){return(r===x2||r===b2||r===y2)&&(e.$$typeof||t.$$typeof)?!0:_2(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var B2=`[object ArrayBuffer]`,V2=`[object Arguments]`,H2=`[object Boolean]`,U2=`[object DataView]`,W2=`[object Date]`,G2=`[object Error]`,K2=`[object Map]`,q2=`[object Number]`,J2=`[object Object]`,Y2=`[object RegExp]`,X2=`[object Set]`,Z2=`[object String]`,Q2={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},$2=`[object URL]`,e4=Object.prototype.toString;function t4({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=e4.call(h);if(b===W2)return r(h,g,_);if(b===Y2)return u(h,g,_);if(b===K2)return o(h,g,_);if(b===X2)return d(h,g,_);if(b===J2)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===$2)return p(h,g,_);if(b===G2)return i(h,g,_);if(b===V2)return c(h,g,_);if(Q2[b])return f(h,g,_);if(b===B2)return e(h,g,_);if(b===U2)return n(h,g,_);if(b===H2||b===q2||b===Z2)return l(h,g,_);if(m){let e=m[b];if(!e){let t=h2(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function n4({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:w2,areArraysEqual:n?N2:T2,areDataViewsEqual:E2,areDatesEqual:D2,areErrorsEqual:O2,areFunctionsEqual:k2,areMapsEqual:n?p2(A2,N2):A2,areNumbersEqual:j2,areObjectsEqual:n?N2:M2,arePrimitiveWrappersEqual:P2,areRegExpsEqual:F2,areSetsEqual:n?p2(I2,N2):I2,areTypedArraysEqual:n?p2(L2,N2):L2,areUrlsEqual:R2,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=m2(r.areArraysEqual),t=m2(r.areMapsEqual),n=m2(r.areObjectsEqual),i=m2(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function r4(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function i4({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var a4=o4();o4({strict:!0}),o4({circular:!0}),o4({circular:!0,strict:!0}),o4({createInternalComparator:()=>v2}),o4({strict:!0,createInternalComparator:()=>v2}),o4({circular:!0,createInternalComparator:()=>v2}),o4({circular:!0,createInternalComparator:()=>v2,strict:!0});function o4(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=t4(n4(e));return i4({circular:t,comparator:a,createState:r,equals:n?n(a):r4(a),strict:i})}function s4(e){typeof requestAnimationFrame<`u`&&requestAnimationFrame(e)}function c4(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1;requestAnimationFrame(function r(i){n<0&&(n=i),i-n>t?(e(i),n=-1):s4(r)})}function l4(e){"@babel/helpers - typeof";return l4=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},l4(e)}function u4(e){return h4(e)||m4(e)||f4(e)||d4()}function d4(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function f4(e,t){if(e){if(typeof e==`string`)return p4(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p4(e,t)}}function p4(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=0&&e<=1}),`[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s`,e);var s=U4(t,r),c=U4(n,i),l=W4(t,r),u=function(e){return e>1?1:e<0?0:e},d=function(e){for(var t=e>1?1:e,n=t,r=0;r<8;++r){var i=s(n)-t,a=l(n);if(Math.abs(i-t)0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,n=t===void 0?100:t,r=e.damping,i=r===void 0?8:r,a=e.dt,o=a===void 0?17:a,s=function(e,t,r){var a=r+(-(e-t)*n-r*i)*o/1e3,s=r*o/1e3+e;return Math.abs(s-t)e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function v3(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}function y3(e){return C3(e)||S3(e)||x3(e)||b3()}function b3(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x3(e,t){if(e){if(typeof e==`string`)return w3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w3(e,t)}}function S3(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function C3(e){if(Array.isArray(e))return w3(e)}function w3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function z3(e){return z3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},z3(e)}var B3=function(e){N3(n,e);var t=F3(n);function n(e,r){var i;O3(this,n),i=t.call(this,e,r);var a=i.props,o=a.isActive,s=a.attributeName,c=a.from,l=a.to,u=a.steps,d=a.children,f=a.duration;if(i.handleStyleChange=i.handleStyleChange.bind(L3(i)),i.changeStyle=i.changeStyle.bind(L3(i)),!o||f<=0)return i.state={style:{}},typeof d==`function`&&(i.state={style:l}),I3(i);if(u&&u.length)i.state={style:u[0].style};else if(c){if(typeof d==`function`)return i.state={style:c},I3(i);i.state={style:s?D3({},s,c):c}}else i.state={style:{}};return i}return A3(n,[{key:`componentDidMount`,value:function(){var e=this.props,t=e.isActive,n=e.canBegin;this.mounted=!0,!(!t||!n)&&this.runAnimation(this.props)}},{key:`componentDidUpdate`,value:function(e){var t=this.props,n=t.isActive,r=t.canBegin,i=t.attributeName,a=t.shouldReAnimate,o=t.to,s=t.from,c=this.state.style;if(r){if(!n){var l={style:i?D3({},i,o):o};this.state&&c&&(i&&c[i]!==o||!i&&c!==o)&&this.setState(l);return}if(!(a4(e.to,o)&&e.canBegin&&e.isActive)){var u=!e.canBegin||!e.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var d=u||a?s:e.to;if(this.state&&c){var f={style:i?D3({},i,d):d};(i&&c[i]!==d||!i&&c!==d)&&this.setState(f)}this.runAnimation(E3(E3({},this.props),{},{from:d,begin:0}))}}}},{key:`componentWillUnmount`,value:function(){this.mounted=!1;var e=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&=(this.manager.stop(),null),this.stopJSAnimation&&this.stopJSAnimation(),e&&e()}},{key:`handleStyleChange`,value:function(e){this.changeStyle(e)}},{key:`changeStyle`,value:function(e){this.mounted&&this.setState({style:e})}},{key:`runJSAnimation`,value:function(e){var t=this,n=e.from,r=e.to,i=e.duration,a=e.easing,o=e.begin,s=e.onAnimationEnd,c=e.onAnimationStart,l=p3(n,r,q4(a),i,this.changeStyle);this.manager.start([c,o,function(){t.stopJSAnimation=l()},i,s])}},{key:`runStepAnimation`,value:function(e){var t=this,n=e.steps,r=e.begin,i=e.onAnimationStart,a=n[0],o=a.style,s=a.duration,c=s===void 0?0:s;return this.manager.start([i].concat(y3(n.reduce(function(e,r,i){if(i===0)return e;var a=r.duration,o=r.easing,s=o===void 0?`ease`:o,c=r.style,l=r.properties,u=r.onAnimationEnd,d=i>0?n[i-1]:r,f=l||Object.keys(c);if(typeof s==`function`||s===`spring`)return[].concat(y3(e),[t.runJSAnimation.bind(t,{from:d.style,to:c,duration:a,easing:s}),a]);var p=D4(f,a,s),m=E3(E3(E3({},d.style),c),{},{transition:p});return[].concat(y3(e),[m,a,u]).filter(w4)},[o,Math.max(c,r)])),[e.onAnimationEnd]))}},{key:`runAnimation`,value:function(e){this.manager||=g4();var t=e.begin,n=e.duration,r=e.attributeName,i=e.to,a=e.easing,o=e.onAnimationStart,s=e.onAnimationEnd,c=e.steps,l=e.children,u=this.manager;if(this.unSubscribe=u.subscribe(this.handleStyleChange),typeof a==`function`||typeof l==`function`||a===`spring`){this.runJSAnimation(e);return}if(c.length>1){this.runStepAnimation(e);return}var d=r?D3({},r,i):i,f=D4(Object.keys(d),n,a);u.start([o,t,E3(E3({},d),{},{transition:f}),n,s])}},{key:`render`,value:function(){var e=this.props,t=e.children;e.begin;var n=e.duration;e.attributeName,e.easing;var r=e.isActive;e.steps,e.from,e.to,e.canBegin,e.onAnimationEnd,e.shouldReAnimate,e.onAnimationReStart;var i=_3(e,g3),a=_.Children.count(t),o=this.state.style;if(typeof t==`function`)return t(o);if(!r||a===0||n<=0)return t;var s=function(e){var t=e.props,n=t.style,r=n===void 0?{}:n,a=t.className;return(0,_.cloneElement)(e,E3(E3({},i),{},{style:E3(E3({},r),o),className:a}))};return a===1?s(_.Children.only(t)):_.createElement(`div`,null,_.Children.map(t,function(e){return s(e)}))}}]),n}(_.PureComponent);B3.displayName=`Animate`,B3.defaultProps={begin:0,duration:1e3,from:``,to:``,attributeName:``,easing:`ease`,isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}},B3.propTypes={from:m3.default.oneOfType([m3.default.object,m3.default.string]),to:m3.default.oneOfType([m3.default.object,m3.default.string]),attributeName:m3.default.string,duration:m3.default.number,begin:m3.default.number,easing:m3.default.oneOfType([m3.default.string,m3.default.func]),steps:m3.default.arrayOf(m3.default.shape({duration:m3.default.number.isRequired,style:m3.default.object.isRequired,easing:m3.default.oneOfType([m3.default.oneOf([`ease`,`ease-in`,`ease-out`,`ease-in-out`,`linear`]),m3.default.func]),properties:m3.default.arrayOf(`string`),onAnimationEnd:m3.default.func})),children:m3.default.oneOfType([m3.default.node,m3.default.func]),isActive:m3.default.bool,canBegin:m3.default.bool,onAnimationEnd:m3.default.func,shouldReAnimate:m3.default.bool,onAnimationStart:m3.default.func,onAnimationReStart:m3.default.func};var V3=B3;function H3(e){"@babel/helpers - typeof";return H3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},H3(e)}function U3(){return U3=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0?1:-1,s=n>=0?1:-1,c=+(r>=0&&n>=0||r<0&&n<0),l;if(a>0&&i instanceof Array){for(var u=[0,0,0,0],d=0,f=4;da?a:i[d];l=`M${e},${t+o*u[0]}`,u[0]>0&&(l+=`A ${u[0]},${u[0]},0,0,${c},${e+s*u[0]},${t}`),l+=`L ${e+n-s*u[1]},${t}`,u[1]>0&&(l+=`A ${u[1]},${u[1]},0,0,${c}, ${e+n},${t+o*u[1]}`),l+=`L ${e+n},${t+r-o*u[2]}`,u[2]>0&&(l+=`A ${u[2]},${u[2]},0,0,${c}, ${e+n-s*u[2]},${t+r}`),l+=`L ${e+s*u[3]},${t+r}`,u[3]>0&&(l+=`A ${u[3]},${u[3]},0,0,${c}, ${e},${t+r-o*u[3]}`),l+=`Z`}else if(a>0&&i===+i&&i>0){var p=Math.min(a,i);l=`M ${e},${t+o*p} @@ -3949,10 +3949,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho L ${e+n},${t+r-o*p} A ${p},${p},0,0,${c},${e+n-s*p},${t+r} L ${e+s*p},${t+r} - A ${p},${p},0,0,${c},${e},${t+r-o*p} Z`}else l=`M ${e},${t} h ${n} v ${r} h ${-n} Z`;return l},t6=function(e,t){if(!e||!t)return!1;var n=e.x,r=e.y,i=t.x,a=t.y,o=t.width,s=t.height;if(Math.abs(o)>0&&Math.abs(s)>0){var c=Math.min(i,i+o),l=Math.max(i,i+o),u=Math.min(a,a+s),d=Math.max(a,a+s);return n>=c&&n<=l&&r>=u&&r<=d}return!1},n6={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},r6=function(e){var t=X3(X3({},n6),e),n=(0,_.useRef)(),r=U3((0,_.useState)(-1),2),i=r[0],a=r[1];(0,_.useEffect)(function(){if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&a(e)}catch{}},[]);var o=t.x,s=t.y,c=t.width,l=t.height,u=t.radius,d=t.className,f=t.animationEasing,p=t.animationDuration,m=t.animationBegin,h=t.isAnimationActive,g=t.isUpdateAnimationActive;if(o!==+o||s!==+s||c!==+c||l!==+l||c===0||l===0)return null;var v=Zo(`recharts-rectangle`,d);return g?_.createElement(B3,{canBegin:i>0,from:{width:c,height:l,x:o,y:s},to:{width:c,height:l,x:o,y:s},duration:p,animationEasing:f,isActive:g},function(e){var r=e.width,a=e.height,o=e.x,s=e.y;return _.createElement(B3,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,isActive:h,easing:f},_.createElement(`path`,H3({},$R(t,!0),{className:v,d:e6(o,s,r,a,u),ref:n})))}):_.createElement(`path`,H3({},$R(t,!0),{className:v,d:e6(o,s,c,l,u)}))};function i6(){return i6=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function h6(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var g6=function(e,t,n,r,i,a){return`M${e},${i}v${r}M${a},${t}h${n}`},_6=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.top,o=a===void 0?0:a,s=e.left,c=s===void 0?0:s,l=e.width,u=l===void 0?0:l,d=e.height,f=d===void 0?0:d,p=e.className,m=m6(e,s6),h=u6({x:n,y:i,top:o,left:c,width:u,height:f},m);return!Q(n)||!Q(i)||!Q(u)||!Q(f)||!Q(o)||!Q(c)?null:_.createElement(`path`,c6({},$R(h,!0),{className:Zo(`recharts-cross`,p),d:g6(n,i,u,f,o,c)}))},v6=o(((e,t)=>{t.exports=dH()(Object.getPrototypeOf,Object)})),y6=o(((e,t)=>{var n=CL(),r=v6(),i=wL(),a=`[object Object]`,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=c.call(Object);function d(e){if(!i(e)||n(e)!=a)return!1;var t=r(e);if(t===null)return!0;var o=l.call(t,`constructor`)&&t.constructor;return typeof o==`function`&&o instanceof o&&c.call(o)==u}t.exports=d})),b6=o(((e,t)=>{var n=CL(),r=wL(),i=`[object Boolean]`;function a(e){return e===!0||e===!1||r(e)&&n(e)==i}t.exports=a}));function x6(e){"@babel/helpers - typeof";return x6=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},x6(e)}function S6(){return S6=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:u,x:o,y:s},to:{upperWidth:c,lowerWidth:l,height:u,x:o,y:s},duration:p,animationEasing:f,isActive:h},function(e){var r=e.upperWidth,a=e.lowerWidth,o=e.height,s=e.x,c=e.y;return _.createElement(B3,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,easing:f},_.createElement(`path`,S6({},$R(t,!0),{className:g,d:P6(s,c,r,a,o),ref:n})))}):_.createElement(`g`,null,_.createElement(`path`,S6({},$R(t,!0),{className:g,d:P6(o,s,c,l,u)})))},L6=l(y6()),R6=l(b6()),z6=[`option`,`shapeType`,`propTransformer`,`activeClassName`,`isActive`];function B6(e){"@babel/helpers - typeof";return B6=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},B6(e)}function V6(e,t){if(e==null)return{};var n=H6(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function H6(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function U6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W6(e){for(var t=1;t{var n=Math.ceil,r=Math.max;function i(e,t,i,a){for(var o=-1,s=r(n((t-e)/(i||1)),0),c=Array(s);s--;)c[a?s:++o]=e,e+=i;return c}t.exports=i})),u8=o(((e,t)=>{var n=$W(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),d8=o(((e,t)=>{var n=l8(),r=zU(),i=u8();function a(e){return function(t,a,o){return o&&typeof o!=`number`&&r(t,a,o)&&(a=o=void 0),t=i(t),a===void 0?(a=t,t=0):a=i(a),o=o===void 0?t{t.exports=d8()()}));function p8(e){"@babel/helpers - typeof";return p8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},p8(e)}function m8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h8(e){for(var t=1;t0&&n.handleDrag(e.changedTouches[0])}),A8(n,`handleDragEnd`,function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var e=n.props,t=e.endIndex,r=e.onDragEnd,i=e.startIndex;r?.({endIndex:t,startIndex:i})}),n.detachDragEndListener()}),A8(n,`handleLeaveWrapper`,function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),A8(n,`handleEnterSlideOrTraveller`,function(){n.setState({isTextActive:!0})}),A8(n,`handleLeaveSlideOrTraveller`,function(){n.setState({isTextActive:!1})}),A8(n,`handleSlideDragStart`,function(e){var t=M8(e)?e.changedTouches[0]:e;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:t.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,`startX`),endX:n.handleTravellerDragStart.bind(n,`endX`)},n.state={},n}return Vre(t,e),Lre(t,[{key:`componentWillUnmount`,value:function(){this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.detachDragEndListener()}},{key:`getIndex`,value:function(e){var n=e.startX,r=e.endX,i=this.state.scaleValues,a=this.props,o=a.gap,s=a.data.length-1,c=Math.min(n,r),l=Math.max(n,r),u=t.getIndexInRange(i,c),d=t.getIndexInRange(i,l);return{startIndex:u-u%o,endIndex:d===s?s:d-d%o}}},{key:`getTextOfTick`,value:function(e){var t=this.props,n=t.data,r=t.tickFormatter,i=t.dataKey,a=G$(n[e],i,e);return(0,PR.default)(r)?r(a,e):a}},{key:`attachDragEndListener`,value:function(){window.addEventListener(`mouseup`,this.handleDragEnd,!0),window.addEventListener(`touchend`,this.handleDragEnd,!0),window.addEventListener(`mousemove`,this.handleDrag,!0)}},{key:`detachDragEndListener`,value:function(){window.removeEventListener(`mouseup`,this.handleDragEnd,!0),window.removeEventListener(`touchend`,this.handleDragEnd,!0),window.removeEventListener(`mousemove`,this.handleDrag,!0)}},{key:`handleSlideDrag`,value:function(e){var t=this.state,n=t.slideMoveStartX,r=t.startX,i=t.endX,a=this.props,o=a.x,s=a.width,c=a.travellerWidth,l=a.startIndex,u=a.endIndex,d=a.onChange,f=e.pageX-n;f>0?f=Math.min(f,o+s-c-i,o+s-c-r):f<0&&(f=Math.max(f,o-r,o-i));var p=this.getIndex({startX:r+f,endX:i+f});(p.startIndex!==l||p.endIndex!==u)&&d&&d(p),this.setState({startX:r+f,endX:i+f,slideMoveStartX:e.pageX})}},{key:`handleTravellerDragStart`,value:function(e,t){var n=M8(t)?t.changedTouches[0]:t;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:e,brushMoveStartX:n.pageX}),this.attachDragEndListener()}},{key:`handleTravellerMove`,value:function(e){var t=this.state,n=t.brushMoveStartX,r=t.movingTravellerId,i=t.endX,a=t.startX,o=this.state[r],s=this.props,c=s.x,l=s.width,u=s.travellerWidth,d=s.onChange,f=s.gap,p=s.data,m={startX:this.state.startX,endX:this.state.endX},h=e.pageX-n;h>0?h=Math.min(h,c+l-u-o):h<0&&(h=Math.max(h,c-o)),m[r]=o+h;var g=this.getIndex(m),_=g.startIndex,v=g.endIndex,y=function(){var e=p.length-1;return r===`startX`&&(i>a?_%f===0:v%f===0)||ia?v%f===0:_%f===0)||i>a&&v===e};this.setState(A8(A8({},r,o+h),`brushMoveStartX`,e.pageX),function(){d&&y()&&d(g)})}},{key:`handleTravellerMoveKeyboard`,value:function(e,t){var n=this,r=this.state,i=r.scaleValues,a=r.startX,o=r.endX,s=this.state[t],c=i.indexOf(s);if(c!==-1){var l=c+e;if(!(l===-1||l>=i.length)){var u=i[l];t===`startX`&&u>=o||t===`endX`&&u<=a||this.setState(A8({},t,u),function(){n.props.onChange(n.getIndex({startX:n.state.startX,endX:n.state.endX}))})}}}},{key:`renderBackground`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.fill,o=e.stroke;return _.createElement(`rect`,{stroke:o,fill:a,x:t,y:n,width:r,height:i})}},{key:`renderPanorama`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.data,o=e.children,s=e.padding,c=_.Children.only(o);return c?_.cloneElement(c,{x:t,y:n,width:r,height:i,margin:s,compact:!0,data:a}):null}},{key:`renderTravellerLayer`,value:function(e,n){var r=this,i=this.props,a=i.y,o=i.travellerWidth,s=i.height,c=i.traveller,l=i.ariaLabel,u=i.data,d=i.startIndex,f=i.endIndex,p=Math.max(e,this.props.x),m=T8(T8({},$R(this.props,!1)),{},{x:p,y:a,width:o,height:s}),h=l||`Min value: ${u[d]?.name}, Max value: ${u[f]?.name}`;return _.createElement(mz,{tabIndex:0,role:`slider`,"aria-label":h,"aria-valuenow":e,className:`recharts-brush-traveller`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[n],onTouchStart:this.travellerDragStartHandlers[n],onKeyDown:function(e){[`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),r.handleTravellerMoveKeyboard(e.key===`ArrowRight`?1:-1,n))},onFocus:function(){r.setState({isTravellerFocused:!0})},onBlur:function(){r.setState({isTravellerFocused:!1})},style:{cursor:`col-resize`}},t.renderTraveller(c,m))}},{key:`renderSlide`,value:function(e,t){var n=this.props,r=n.y,i=n.height,a=n.stroke,o=n.travellerWidth,s=Math.min(e,t)+o,c=Math.max(Math.abs(t-e)-o,0);return _.createElement(`rect`,{className:`recharts-brush-slide`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:`move`},stroke:`none`,fill:a,fillOpacity:.2,x:s,y:r,width:c,height:i})}},{key:`renderText`,value:function(){var e=this.props,t=e.startIndex,n=e.endIndex,r=e.y,i=e.height,a=e.travellerWidth,o=e.stroke,s=this.state,c=s.startX,l=s.endX,u=5,d={pointerEvents:`none`,fill:o};return _.createElement(mz,{className:`recharts-brush-texts`},_.createElement(yK,C8({textAnchor:`end`,verticalAnchor:`middle`,x:Math.min(c,l)-u,y:r+i/2},d),this.getTextOfTick(t)),_.createElement(yK,C8({textAnchor:`start`,verticalAnchor:`middle`,x:Math.max(c,l)+a+u,y:r+i/2},d),this.getTextOfTick(n)))}},{key:`render`,value:function(){var e=this.props,t=e.data,n=e.className,r=e.children,i=e.x,a=e.y,o=e.width,s=e.height,c=e.alwaysShowText,l=this.state,u=l.startX,d=l.endX,f=l.isTextActive,p=l.isSlideMoving,m=l.isTravellerMoving,h=l.isTravellerFocused;if(!t||!t.length||!Q(i)||!Q(a)||!Q(o)||!Q(s)||o<=0||s<=0)return null;var g=Zo(`recharts-brush`,n),v=_.Children.count(r)===1,y=b8(`userSelect`,`none`);return _.createElement(mz,{className:g,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:y},this.renderBackground(),v&&this.renderPanorama(),this.renderSlide(u,d),this.renderTravellerLayer(u,`startX`),this.renderTravellerLayer(d,`endX`),(f||p||m||h||c)&&this.renderText())}}],[{key:`renderDefaultTraveller`,value:function(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.stroke,o=Math.floor(n+i/2)-1;return _.createElement(_.Fragment,null,_.createElement(`rect`,{x:t,y:n,width:r,height:i,fill:a,stroke:`none`}),_.createElement(`line`,{x1:t+1,y1:o,x2:t+r-1,y2:o,fill:`none`,stroke:`#fff`}),_.createElement(`line`,{x1:t+1,y1:o+2,x2:t+r-1,y2:o+2,fill:`none`,stroke:`#fff`}))}},{key:`renderTraveller`,value:function(e,n){return _.isValidElement(e)?_.cloneElement(e,n):(0,PR.default)(e)?e(n):t.renderDefaultTraveller(n)}},{key:`getDerivedStateFromProps`,value:function(e,t){var n=e.data,r=e.width,i=e.x,a=e.travellerWidth,o=e.updateId,s=e.startIndex,c=e.endIndex;if(n!==t.prevData||o!==t.prevUpdateId)return T8({prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r},n&&n.length?Ure({data:n,width:r,x:i,travellerWidth:a,startIndex:s,endIndex:c}):{scale:null,scaleValues:null});if(t.scale&&(r!==t.prevWidth||i!==t.prevX||a!==t.prevTravellerWidth)){t.scale.range([i,i+r-a]);var l=t.scale.domain().map(function(e){return t.scale(e)});return{prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r,startX:t.scale(e.startIndex),endX:t.scale(e.endIndex),scaleValues:l}}return null}},{key:`getIndexInRange`,value:function(e,t){for(var n=e.length,r=0,i=n-1;i-r>1;){var a=Math.floor((r+i)/2);e[a]>t?i=a:r=a}return t>=e[i]?i:r}}])}(_.PureComponent);A8(N8,`displayName`,`Brush`),A8(N8,`defaultProps`,{height:40,travellerWidth:5,gap:1,fill:`#fff`,stroke:`#666`,padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Wre=o(((e,t)=>{var n=TU();function r(e,t){var r;return n(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}t.exports=r})),Gre=o(((e,t)=>{var n=BV(),r=RH(),i=Wre(),a=yL(),o=zU();function s(e,t,s){var c=a(e)?n:i;return s&&o(e,t,s)&&(t=void 0),c(e,r(t,3))}t.exports=s})),P8=function(e,t){var n=e.alwaysShow,r=e.ifOverflow;return n&&(r=`extendDomain`),r===t},Kre=o(((e,t)=>{var n=PU();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),qre=o(((e,t)=>{var n=Kre(),r=CU(),i=RH();function a(e,t){var a={};return t=i(t,3),r(e,function(e,r,i){n(a,r,t(e,r,i))}),a}t.exports=a})),Jre=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{var n=TU();function r(e,t){var r=!0;return n(e,function(e,n,i){return r=!!t(e,n,i),r}),r}t.exports=r})),Xre=o(((e,t)=>{var n=Jre(),r=Yre(),i=RH(),a=yL(),o=zU();function s(e,t,s){var c=a(e)?n:r;return s&&o(e,t,s)&&(t=void 0),c(e,i(t,3))}t.exports=s})),Zre=[`x`,`y`];function F8(e){"@babel/helpers - typeof";return F8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},F8(e)}function I8(){return I8=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function nie(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function rie(e,t){var n=e.x,r=e.y,i=tie(e,Zre),a=`${n}`,o=parseInt(a,10),s=`${r}`,c=parseInt(s,10),l=`${t.height||i.height}`,u=parseInt(l,10),d=`${t.width||i.width}`,f=parseInt(d,10);return R8(R8(R8(R8(R8({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:f,name:t.name,radius:t.radius})}function z8(e){return _.createElement(Q6,I8({shapeType:`rectangle`,propTransformer:rie,activeClassName:`recharts-active-bar`},e))}var iie=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,r){if(typeof e==`number`)return e;var i=Q(n)||pR(n);return i?e(n,r):(!i&&XQ(!1),t)}},aie=[`value`,`background`],B8;function V8(e){"@babel/helpers - typeof";return V8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},V8(e)}function oie(e,t){if(e==null)return{};var n=sie(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sie(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function H8(){return H8=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(g)0&&Math.abs(h)0&&(w=Math.min((e||0)-(T[t-1]||0),w))}),Number.isFinite(w)){var E=w/C,D=c.layout===`vertical`?n.height:n.width;if(c.padding===`gap`&&(v=E*D/2),c.padding===`no-gap`){var O=_R(e.barCategoryGap,E*D),k=E*D/2;v=k-O-(k-O)/D*O}}}y=r===`xAxis`?[n.left+(m.left||0)+(v||0),n.left+n.width-(m.right||0)-(v||0)]:r===`yAxis`?s===`horizontal`?[n.top+n.height-(m.bottom||0),n.top+(m.top||0)]:[n.top+(m.top||0)+(v||0),n.top+n.height-(m.bottom||0)-(v||0)]:c.range,g&&(y=[y[1],y[0]]);var A=o1(c,i,d),j=A.scale,M=A.realScaleType;j.domain(f).range(y),c1(j);var N=m1(j,t5(t5({},c),{},{realScaleType:M}));r===`xAxis`?(S=l===`top`&&!h||l===`bottom`&&h,b=n.left,x=u[_]-S*c.height):r===`yAxis`&&(S=l===`left`&&!h||l===`right`&&h,b=u[_]-S*c.width,x=n.top);var P=t5(t5(t5({},c),N),{},{realScaleType:M,x:b,y:x,scale:j,width:r===`xAxis`?n.width:c.width,height:r===`yAxis`?n.height:c.height});return P.bandSize=w1(P,N),!c.hide&&r===`xAxis`?u[_]+=(S?-1:1)*P.height:c.hide||(u[_]+=(S?-1:1)*P.width),t5(t5({},a),{},n5({},o,P))},{})},a5=function(e,t){var n=e.x,r=e.y,i=t.x,a=t.y;return{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)}},bie=function(e){var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return a5({x:t,y:n},{x:r,y:i})},o5=function(){function e(t){_ie(this,e),this.scale=t}return vie(e,[{key:`domain`,get:function(){return this.scale.domain}},{key:`range`,get:function(){return this.scale.range}},{key:`rangeMin`,get:function(){return this.range()[0]}},{key:`rangeMax`,get:function(){return this.range()[1]}},{key:`bandwidth`,get:function(){return this.scale.bandwidth}},{key:`apply`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.bandAware,r=t.position;if(e!==void 0){if(r)switch(r){case`start`:return this.scale(e);case`middle`:var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+i;case`end`:var a=this.bandwidth?this.bandwidth():0;return this.scale(e)+a;default:return this.scale(e)}if(n){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+o}return this.scale(e)}}},{key:`isInRange`,value:function(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}],[{key:`create`,value:function(t){return new e(t)}}])}();n5(o5,`EPS`,1e-4);var s5=function(e){var t=Object.keys(e).reduce(function(t,n){return t5(t5({},t),{},n5({},n,o5.create(e[n])))},{});return t5(t5({},t),{},{apply:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.bandAware,i=n.position;return(0,hie.default)(e,function(e,n){return t[n].apply(e,{bandAware:r,position:i})})},isInRange:function(e){return(0,gie.default)(e,function(e,n){return t[n].isInRange(e)})}})};function xie(e){return(e%180+180)%180}var Sie=function(e){var t=e.width,n=e.height,r=xie(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{var n=RH(),r=mH(),i=hH();function a(e){return function(t,a,o){var s=Object(t);if(!r(t)){var c=n(a,3);t=i(t),a=function(e){return c(s[e],e,s)}}var l=e(t,a,o);return l>-1?s[c?t[l]:l]:void 0}}t.exports=a})),wie=o(((e,t)=>{var n=u8();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),Tie=o(((e,t)=>{var n=zH(),r=RH(),i=wie(),a=Math.max;function o(e,t,o){var s=e==null?0:e.length;if(!s)return-1;var c=o==null?0:i(o);return c<0&&(c=a(s+c,0)),n(e,r(t,3),c)}t.exports=o})),Eie=o(((e,t)=>{t.exports=Cie()(Tie())})),Die=(0,l(WL()).default)(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return[`l`,e.left,`t`,e.top,`w`,e.width,`h`,e.height].join(``)});Eie();var c5=(0,_.createContext)(void 0),l5=(0,_.createContext)(void 0),u5=(0,_.createContext)(void 0),Oie=(0,_.createContext)({}),d5=(0,_.createContext)(void 0),f5=(0,_.createContext)(0),p5=(0,_.createContext)(0),m5=function(e){var t=e.state,n=t.xAxisMap,r=t.yAxisMap,i=t.offset,a=e.clipPathId,o=e.children,s=e.width,c=e.height,l=Die(i);return _.createElement(c5.Provider,{value:n},_.createElement(l5.Provider,{value:r},_.createElement(Oie.Provider,{value:i},_.createElement(u5.Provider,{value:l},_.createElement(d5.Provider,{value:a},_.createElement(f5.Provider,{value:c},_.createElement(p5.Provider,{value:s},o)))))))},kie=function(){return(0,_.useContext)(d5)},h5=function(e){var t=(0,_.useContext)(c5);t??XQ(!1);var n=t[e];return n??XQ(!1),n},g5=function(e){var t=(0,_.useContext)(l5);t??XQ(!1);var n=t[e];return n??XQ(!1),n},Aie=function(){return(0,_.useContext)(u5)},_5=function(){return(0,_.useContext)(p5)},v5=function(){return(0,_.useContext)(f5)},jie=l(Gre());function y5(e){"@babel/helpers - typeof";return y5=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},y5(e)}function Mie(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function b5(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);ne*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function dae(e,t){return $5(e,t+1)}function fae(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:$5(r,l)};var a=c,d,f=function(){return d===void 0&&(d=n(t,a)),d},p=t.coordinate,m=c===0||e7(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function t7(e){"@babel/helpers - typeof";return t7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t7(e)}function n7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function r7(e){for(var t=1;t0?r.coordinate-d*e:r.coordinate})}else a[t]=r=r7(r7({},r),{},{tickCoord:r.coordinate});e7(e,r.tickCoord,u,s,c)&&(c=r.tickCoord-e*(u()/2+i),a[t]=r7(r7({},r),{},{isShow:!0}))},u=o-1;u>=0;u--)l(u);return a}function _ae(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,l=t.end;if(a){var u=r[s-1],d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=r7(r7({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),e7(e,u.tickCoord,function(){return d},c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=r7(r7({},u),{},{isShow:!0}))}for(var p=a?s-1:s,m=function(t){var r=o[t],a,s=function(){return a===void 0&&(a=n(r,t)),a};if(t===0){var u=e*(r.coordinate-e*s()/2-c);o[t]=r=r7(r7({},r),{},{tickCoord:u<0?r.coordinate-u*e:r.coordinate})}else o[t]=r=r7(r7({},r),{},{tickCoord:r.coordinate});e7(e,r.tickCoord,s,c,l)&&(c=r.tickCoord+e*(s()/2+i),o[t]=r7(r7({},r),{},{isShow:!0}))},h=0;h=2?dR(i[1].coordinate-i[0].coordinate):1,_=uae(a,g,p);return c===`equidistantPreserveStart`?fae(g,_,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?_ae(g,_,h,i,o,c===`preserveStartEnd`):gae(g,_,h,i,o),f.filter(function(e){return e.isShow}))}var yae=[`viewBox`],bae=[`viewBox`],xae=[`ticks`];function i7(e){"@babel/helpers - typeof";return i7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i7(e)}function a7(){return a7=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Sae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Cae(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function l7(e,t){for(var n=0;n0?a(this.props):a(l)),r<=0||i<=0||!u||!u.length?null:_.createElement(mz,{className:Zo(`recharts-cartesian-axis`,o),ref:function(t){e.layerReference=t}},n&&this.renderAxisLine(),this.renderTicks(u,this.state.fontSize,this.state.letterSpacing),c0.renderCallByParent(this.props))}}],[{key:`renderTickItem`,value:function(e,t,n){var r,i=Zo(t.className,`recharts-cartesian-axis-tick-value`);return r=_.isValidElement(e)?_.cloneElement(e,s7(s7({},t),{},{className:i})):(0,PR.default)(e)?e(s7(s7({},t),{},{className:i})):_.createElement(yK,a7({},t,{className:`recharts-cartesian-axis-tick-value`}),n),r}}])}(_.Component);p7(h7,`displayName`,`CartesianAxis`),p7(h7,`defaultProps`,{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`});var Aae=[`type`,`layout`,`connectNulls`,`ref`],jae=[`key`];function g7(e){"@babel/helpers - typeof";return g7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},g7(e)}function _7(e,t){if(e==null)return{};var n=Mae(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Mae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function v7(){return v7=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ns){l=[].concat(x7(i.slice(0,u)),[s-d]);break}var f=l.length%2==0?[0,c]:[c];return[].concat(x7(t.repeat(i,o)),x7(l),f).map(function(e){return`${e}px`}).join(`, `)}),D7(e,`id`,gR(`recharts-line-`)),D7(e,`pathRef`,function(t){e.mainCurve=t}),D7(e,`handleAnimationEnd`,function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),D7(e,`handleAnimationStart`,function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return Hae(t,e),Rae(t,[{key:`componentDidMount`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:`componentDidUpdate`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:`getTotalLength`,value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}},{key:`renderErrorBar`,value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,r=n.points,i=n.xAxis,a=n.yAxis,o=n.layout,s=n.children,c=KR(s,x$);if(!c)return null;var l=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:G$(e.payload,t)}},u={clipPath:e?`url(#clipPath-${t})`:null};return _.createElement(mz,u,c.map(function(e){return _.cloneElement(e,{key:`bar-${e.props.dataKey}`,data:r,xAxis:i,yAxis:a,layout:o,dataPointFormatter:l})}))}},{key:`renderDots`,value:function(e,n,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,a=i.dot,o=i.points,s=i.dataKey,c=$R(this.props,!1),l=$R(a,!0),u=o.map(function(e,n){var r=b7(b7(b7({key:`dot-${n}`,r:3},c),l),{},{index:n,cx:e.x,cy:e.y,value:e.value,dataKey:s,payload:e.payload,points:o});return t.renderDotItem(a,r)}),d={clipPath:e?`url(#clipPath-${n?``:`dots-`}${r})`:null};return _.createElement(mz,v7({className:`recharts-line-dots`,key:`dots`},d),u)}},{key:`renderCurveStatically`,value:function(e,t,n,r){var i=this.props,a=i.type,o=i.layout,s=i.connectNulls;i.ref;var c=b7(b7(b7({},$R(_7(i,Aae),!0)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:t?`url(#clipPath-${n})`:null,points:e},r),{},{type:a,layout:o,connectNulls:s});return _.createElement(a2,v7({},c,{pathRef:this.pathRef}))}},{key:`renderCurveWithAnimation`,value:function(e,t){var n=this,r=this.props,i=r.points,a=r.strokeDasharray,o=r.isAnimationActive,s=r.animationBegin,c=r.animationDuration,l=r.animationEasing,u=r.animationId,d=r.animateNewValues,f=r.width,p=r.height,m=this.state,h=m.prevPoints,g=m.totalLength;return _.createElement(B3,{begin:s,duration:c,isActive:o,easing:l,from:{t:0},to:{t:1},key:`line-${u}`,onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o=r.t;if(h){var s=h.length/i.length,c=i.map(function(e,t){var n=Math.floor(t*s);if(h[n]){var r=h[n],i=bR(r.x,e.x),a=bR(r.y,e.y);return b7(b7({},e),{},{x:i(o),y:a(o)})}if(d){var c=bR(f*2,e.x),l=bR(p/2,e.y);return b7(b7({},e),{},{x:c(o),y:l(o)})}return b7(b7({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(c,e,t)}var l=bR(0,g)(o),u;if(a){var m=`${a}`.split(/[,\s]+/gim).map(function(e){return parseFloat(e)});u=n.getStrokeDasharray(l,g,m)}else u=n.generateSimpleStrokeDasharray(g,l);return n.renderCurveStatically(i,e,t,{strokeDasharray:u})})}},{key:`renderCurve`,value:function(e,t){var n=this.props,r=n.points,i=n.isAnimationActive,a=this.state,o=a.prevPoints,s=a.totalLength;return i&&r&&r.length&&(!o&&s>0||!(0,M$.default)(o,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxis,o=e.yAxis,s=e.top,c=e.left,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=Zo(`recharts-line`,i),g=a&&a.allowDataOverflow,v=o&&o.allowDataOverflow,y=g||v,b=(0,uR.default)(f)?this.id:f,x=$R(n,!1)??{r:3,strokeWidth:2},S=x.r,C=S===void 0?3:S,w=x.strokeWidth,T=w===void 0?2:w,E=(ZR(n)?n:{}).clipDot,D=E===void 0?!0:E,O=C*2+T;return _.createElement(mz,{className:h},g||v?_.createElement(`defs`,null,_.createElement(`clipPath`,{id:`clipPath-${b}`},_.createElement(`rect`,{x:g?c:c-l/2,y:v?s:s-u/2,width:g?l:l*2,height:v?u:u*2})),!D&&_.createElement(`clipPath`,{id:`clipPath-dots-${b}`},_.createElement(`rect`,{x:c-O/2,y:s-O/2,width:l+O,height:u+O}))):null,!m&&this.renderCurve(y,b),this.renderErrorBar(y,b),(m||n)&&this.renderDots(y,D,b),(!d||p)&&A0.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points===t.curPoints?null:{curPoints:e.points}:{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}}},{key:`repeat`,value:function(e,t){for(var n=e.length%2==0?e:[].concat(x7(e),[0]),r=[],i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Kae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function N7(){return N7=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!(0,M$.default)(s,r)||!(0,M$.default)(c,i))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,i,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,o=e.left,s=e.xAxis,c=e.yAxis,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=Zo(`recharts-area`,i),g=s&&s.allowDataOverflow,v=c&&c.allowDataOverflow,y=g||v,b=(0,uR.default)(f)?this.id:f,x=$R(n,!1)??{r:3,strokeWidth:2},S=x.r,C=S===void 0?3:S,w=x.strokeWidth,T=w===void 0?2:w,E=(ZR(n)?n:{}).clipDot,D=E===void 0?!0:E,O=C*2+T;return _.createElement(mz,{className:h},g||v?_.createElement(`defs`,null,_.createElement(`clipPath`,{id:`clipPath-${b}`},_.createElement(`rect`,{x:g?o:o-l/2,y:v?a:a-u/2,width:g?l:l*2,height:v?u:u*2})),!D&&_.createElement(`clipPath`,{id:`clipPath-dots-${b}`},_.createElement(`rect`,{x:o-O/2,y:a-O/2,width:l+O,height:u+O}))):null,m?null:this.renderArea(y,b),(n||m)&&this.renderDots(y,D,b),(!d||p)&&A0.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points!==t.curPoints||e.baseLine!==t.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null:{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:t.curPoints,prevBaseLine:t.curBaseLine}}}])}(_.PureComponent);A7=H7,B7(H7,`displayName`,`Area`),B7(H7,`defaultProps`,{stroke:`#3182bd`,fill:`#3182bd`,fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:`line`,connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!AW.isSsr,animationBegin:0,animationDuration:1500,animationEasing:`ease`}),B7(H7,`getBaseValue`,function(e,t,n,r){var i=e.layout,a=e.baseValue,o=t.props.baseValue??a;if(Q(o)&&typeof o==`number`)return o;var s=i===`horizontal`?r:n,c=s.scale.domain();if(s.type===`number`){var l=Math.max(c[0],c[1]),u=Math.min(c[0],c[1]);return o===`dataMin`?u:o===`dataMax`||l<0?l:Math.max(Math.min(c[0],c[1]),0)}return o===`dataMin`?c[0]:o===`dataMax`?c[1]:c[0]}),B7(H7,`getComposedData`,function(e){var t=e.props,n=e.item,r=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,c=e.dataKey,l=e.stackedData,u=e.dataStartIndex,d=e.displayedData,f=e.offset,p=t.layout,m=l&&l.length,h=A7.getBaseValue(t,n,r,i),g=p===`horizontal`,_=!1,v=d.map(function(e,t){var n;m?n=l[u+t]:(n=G$(e,c),Array.isArray(n)?_=!0:n=[h,n]);var d=n[1]==null||m&&G$(e,c)==null;return g?{x:h1({axis:r,ticks:a,bandSize:s,entry:e,index:t}),y:d?null:i.scale(n[1]),value:n,payload:e}:{x:d?null:r.scale(n[1]),y:h1({axis:i,ticks:o,bandSize:s,entry:e,index:t}),value:n,payload:e}});return F7({points:v,baseLine:m||_?v.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return g?{x:e.x,y:t!=null&&e.y!=null?i.scale(t):null}:{x:t==null?null:r.scale(t),y:e.y}}):g?i.scale(h):r.scale(h),layout:p,isRange:_},f)}),B7(H7,`renderDotItem`,function(e,t){var n;if(_.isValidElement(e))n=_.cloneElement(e,t);else if((0,PR.default)(e))n=e(t);else{var r=Zo(`recharts-area-dot`,typeof e==`boolean`?``:e.className),i=t.key,a=M7(t,Gae);n=_.createElement(a6,N7({},a,{key:i,className:r}))}return n});function U7(e){"@babel/helpers - typeof";return U7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},U7(e)}function eoe(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function W7(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Foe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Ioe(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function T9(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n0?a:e&&e.length&&Q(r)&&Q(i)?e.slice(r,i+1):[]};function R9(e){return e===`number`?[0,`auto`]:void 0}var z9=function(e,t,n,r){var i=e.graphicalItems,a=e.tooltipAxis,o=L9(t,e);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(i,s){var c=s.props.data??t;c&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(c=c.slice(e.dataStartIndex,e.dataEndIndex+1));var l=a.dataKey&&!a.allowDuplicatedCategory?xR(c===void 0?o:c,a.dataKey,r):c&&c[n]||o[n];return l?[].concat(k9(i),[E1(s,l)]):i},[])},B9=function(e,t,n,r){var i=r||{x:e.chartX,y:e.chartY},a=Joe(i,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,l=q$(a,o,c,s);if(l>=0&&c){var u=c[l]&&c[l].value;return{activeTooltipIndex:l,activeLabel:u,activePayload:z9(e,t,l,u),activeCoordinate:Yoe(n,o,l,i)}}return null},Xoe=function(e,t){var n=t.axes,r=t.graphicalItems,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=e.stackOffset,f=n1(l,i);return n.reduce(function(t,n){var p=n.type.defaultProps===void 0?n.props:$($({},n.type.defaultProps),n.props),m=p.type,h=p.dataKey,g=p.allowDataOverflow,_=p.allowDuplicatedCategory,v=p.scale,y=p.ticks,b=p.includeHidden,x=p[a];if(t[x])return t;var S=L9(e.data,{graphicalItems:r.filter(function(e){return(a in e.props?e.props[a]:e.type.defaultProps?.[a])===x}),dataStartIndex:s,dataEndIndex:c}),C=S.length,w,T,E;Coe(p.domain,g,m)&&(w=C1(p.domain,null,g),f&&(m===`number`||v!==`auto`)&&(E=K$(S,h,`category`)));var D=R9(m);if(!w||w.length===0){var O=p.domain??D;if(h){if(w=K$(S,h,m),m===`category`&&f){var k=yR(w);_&&k?(T=w,w=(0,x8.default)(0,C)):_||(w=T1(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(k9(e),[t])},[]))}else if(m===`category`)w=_?w.filter(function(e){return e!==``&&!(0,uR.default)(e)}):T1(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0||t===``||(0,uR.default)(t)?e:[].concat(k9(e),[t])},[]);else if(m===`number`){var A=e1(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===x&&(b||!n)}),h,i,l);A&&(w=A)}f&&(m===`number`||v!==`auto`)&&(E=K$(S,h,`category`))}else w=f?(0,x8.default)(0,C):o&&o[x]&&o[x].hasStack&&m===`number`?d===`expand`?[0,1]:b1(o[x].stackGroups,s,c):t1(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps.hide;return t===x&&(b||!n)}),m,l,!0);if(m===`number`)w=u9(u,w,x,i,y),O&&(w=C1(O,w,g));else if(m===`category`&&O){var j=O;w.every(function(e){return j.indexOf(e)>=0})&&(w=j)}}return $($({},t),{},N9({},x,$($({},p),{},{axisType:i,domain:w,categoricalDomain:E,duplicateDomain:T,originalDomain:p.domain??D,isCategorical:f,layout:l})))},{})},Zoe=function(e,t){var n=t.graphicalItems,r=t.Axis,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=L9(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:c}),f=d.length,p=n1(l,i),m=-1;return n.reduce(function(e,t){var h=(t.type.defaultProps===void 0?t.props:$($({},t.type.defaultProps),t.props))[a],g=R9(`number`);if(!e[h]){m++;var _;return p?_=(0,x8.default)(0,f):o&&o[h]&&o[h].hasStack?(_=b1(o[h].stackGroups,s,c),_=u9(u,_,h,i)):(_=C1(g,t1(d,n.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===h&&!n}),`number`,l),r.defaultProps.allowDataOverflow),_=u9(u,_,h,i)),$($({},e),{},N9({},h,$($({axisType:i},r.defaultProps),{},{hide:!0,orientation:(0,cR.default)(Koe,`${i}.${m%2}`,null),domain:_,originalDomain:g,isCategorical:p,layout:l})))}return e},{})},Qoe=function(e,t){var n=t.axisType,r=n===void 0?`xAxis`:n,i=t.AxisComp,a=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.children,u=`${r}Id`,d=KR(l,i),f={};return d&&d.length?f=Xoe(e,{axes:d,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(f=Zoe(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c})),f},$oe=function(e){var t=vR(e),n=r1(t,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:(0,BU.default)(n,function(e){return e.coordinate}),tooltipAxis:t,tooltipAxisBandSize:w1(t,n)}},V9=function(e){var t=e.children,n=e.defaultShowTooltip,r=qR(t,N8),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},ese=function(e){return!e||!e.length?!1:e.some(function(e){var t=HR(e&&e.type);return t&&t.indexOf(`Bar`)>=0})},H9=function(e){return e===`horizontal`?{numericAxisName:`yAxis`,cateAxisName:`xAxis`}:e===`vertical`?{numericAxisName:`xAxis`,cateAxisName:`yAxis`}:e===`centric`?{numericAxisName:`radiusAxis`,cateAxisName:`angleAxis`}:{numericAxisName:`angleAxis`,cateAxisName:`radiusAxis`}},tse=function(e,t){var n=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,o=e.yAxisMap,s=o===void 0?{}:o,c=n.width,l=n.height,u=n.children,d=n.margin||{},f=qR(u,N8),p=qR(u,vU),m=Object.keys(s).reduce(function(e,t){var n=s[t],r=n.orientation;return!n.mirror&&!n.hide?$($({},e),{},N9({},r,e[r]+n.width)):e},{left:d.left||0,right:d.right||0}),h=$($({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return!n.mirror&&!n.hide?$($({},e),{},N9({},r,(0,cR.default)(e,`${r}`)+n.height)):e},{top:d.top||0,bottom:d.bottom||0})),m),g=h.bottom;f&&(h.bottom+=f.props.height||N8.defaultProps.height),p&&t&&(h=Z$(h,r,n,t));var _=c-h.left-h.right,v=l-h.top-h.bottom;return $($({brushBottom:g},h),{},{width:Math.max(_,0),height:Math.max(v,0)})},nse=function(e,t){if(t===`xAxis`)return e[t].width;if(t===`yAxis`)return e[t].height},U9=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,i=r===void 0?`axis`:r,a=e.validateTooltipEventTypes,o=a===void 0?[`axis`]:a,s=e.axisComponents,c=e.legendContent,l=e.formatAxisMap,u=e.defaultProps,d=function(e,t){var n=t.graphicalItems,r=t.stackGroups,i=t.offset,a=t.updateId,o=t.dataStartIndex,c=t.dataEndIndex,l=e.barSize,u=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,m=H9(u),h=m.numericAxisName,g=m.cateAxisName,_=ese(n),v=[];return n.forEach(function(n,m){var y=L9(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:c}),b=n.type.defaultProps===void 0?n.props:$($({},n.type.defaultProps),n.props),x=b.dataKey,S=b.maxBarSize,C=b[`${h}Id`],w=b[`${g}Id`],T=s.reduce(function(e,n){var r=t[`${n.axisType}Map`],i=b[`${n.axisType}Id`];!(r&&r[i]||n.axisType===`zAxis`)&&XQ(!1);var a=r[i];return $($({},e),{},N9(N9({},n.axisType,a),`${n.axisType}Ticks`,r1(a)))},{}),E=T[g],D=T[`${g}Ticks`],O=r&&r[C]&&r[C].hasStack&&v1(n,r[C].stackGroups),k=HR(n.type).indexOf(`Bar`)>=0,A=w1(E,D),j=[],M=_&&Y$({barSize:l,stackGroups:r,totalSize:nse(T,g)});if(k){var N=(0,uR.default)(S)?p:S,P=w1(E,D,!0)??N??0;j=X$({barGap:d,barCategoryGap:f,bandSize:P===A?A:P,sizeList:M[w],maxBarSize:N}),P!==A&&(j=j.map(function(e){return $($({},e),{},{position:$($({},e.position),{},{offset:e.position.offset-P/2})})}))}var F=n&&n.type&&n.type.getComposedData;F&&v.push({props:$($({},F($($({},T),{},{displayedData:y,props:e,dataKey:x,item:n,bandSize:A,barPosition:j,offset:i,stackedData:O,layout:u,dataStartIndex:o,dataEndIndex:c}))),{},N9(N9(N9({key:n.key||`item-${m}`},h,T[h]),g,T[g]),`animationId`,a)),childIndex:iz(n,e.children),item:n})}),v},f=function(e,r){var i=e.props,a=e.dataStartIndex,o=e.dataEndIndex,c=e.updateId;if(!JR({props:i}))return null;var u=i.children,f=i.layout,p=i.stackOffset,m=i.data,h=i.reverseStackOrder,g=H9(f),_=g.numericAxisName,v=g.cateAxisName,y=KR(u,n),b=p1(m,y,`${_}Id`,`${v}Id`,p,h),x=s.reduce(function(e,t){var n=`${t.axisType}Map`;return $($({},e),{},N9({},n,Qoe(i,$($({},t),{},{graphicalItems:y,stackGroups:t.axisType===_&&b,dataStartIndex:a,dataEndIndex:o}))))},{}),S=tse($($({},x),{},{props:i,graphicalItems:y}),r?.legendBBox);Object.keys(x).forEach(function(e){x[e]=l(i,x[e],S,e.replace(`Map`,``),t)});var C=x[`${v}Map`],w=$oe(C);return $($({formattedGraphicalItems:d(i,$($({},x),{},{dataStartIndex:a,dataEndIndex:o,updateId:c,graphicalItems:y,stackGroups:b,offset:S})),graphicalItems:y,offset:S,stackGroups:b},w),x)},p=function(e){function n(e){var r;return Ioe(this,n),r=Roe(this,n,[e]),N9(r,`eventEmitterSymbol`,Symbol(`rechartsEventEmitter`)),N9(r,`accessibilityManager`,new Soe),N9(r,`handleLegendBBoxUpdate`,function(e){if(e){var t=r.state,n=t.dataStartIndex,i=t.dataEndIndex,a=t.updateId;r.setState($({legendBBox:e},f({props:r.props,dataStartIndex:n,dataEndIndex:i,updateId:a},$($({},r.state),{},{legendBBox:e}))))}}),N9(r,`handleReceiveSyncEvent`,function(e,t,n){if(r.props.syncId===e){if(n===r.eventEmitterSymbol&&typeof r.props.syncMethod!=`function`)return;r.applySyncEvent(t)}}),N9(r,`handleBrushChange`,function(e){var t=e.startIndex,n=e.endIndex;if(t!==r.state.dataStartIndex||n!==r.state.dataEndIndex){var i=r.state.updateId;r.setState(function(){return $({dataStartIndex:t,dataEndIndex:n},f({props:r.props,dataStartIndex:t,dataEndIndex:n,updateId:i},r.state))}),r.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),N9(r,`handleMouseEnter`,function(e){var t=r.getMouseInfo(e);if(t){var n=$($({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseEnter;(0,PR.default)(i)&&i(n,e)}}),N9(r,`triggeredAfterMouseMove`,function(e){var t=r.getMouseInfo(e),n=t?$($({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseMove;(0,PR.default)(i)&&i(n,e)}),N9(r,`handleItemMouseEnter`,function(e){r.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),N9(r,`handleItemMouseLeave`,function(){r.setState(function(){return{isTooltipActive:!1}})}),N9(r,`handleMouseMove`,function(e){e.persist(),r.throttleTriggeredAfterMouseMove(e)}),N9(r,`handleMouseLeave`,function(e){r.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};r.setState(t),r.triggerSyncEvent(t);var n=r.props.onMouseLeave;(0,PR.default)(n)&&n(t,e)}),N9(r,`handleOuterEvent`,function(e){var t=rz(e),n=(0,cR.default)(r.props,`${t}`);t&&(0,PR.default)(n)&&n((/.*touch.*/i.test(t)?r.getMouseInfo(e.changedTouches[0]):r.getMouseInfo(e))??{},e)}),N9(r,`handleClick`,function(e){var t=r.getMouseInfo(e);if(t){var n=$($({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onClick;(0,PR.default)(i)&&i(n,e)}}),N9(r,`handleMouseDown`,function(e){var t=r.props.onMouseDown;(0,PR.default)(t)&&t(r.getMouseInfo(e),e)}),N9(r,`handleMouseUp`,function(e){var t=r.props.onMouseUp;(0,PR.default)(t)&&t(r.getMouseInfo(e),e)}),N9(r,`handleTouchMove`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),N9(r,`handleTouchStart`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseDown(e.changedTouches[0])}),N9(r,`handleTouchEnd`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseUp(e.changedTouches[0])}),N9(r,`handleDoubleClick`,function(e){var t=r.props.onDoubleClick;(0,PR.default)(t)&&t(r.getMouseInfo(e),e)}),N9(r,`handleContextMenu`,function(e){var t=r.props.onContextMenu;(0,PR.default)(t)&&t(r.getMouseInfo(e),e)}),N9(r,`triggerSyncEvent`,function(e){r.props.syncId!==void 0&&d9.emit(f9,r.props.syncId,e,r.eventEmitterSymbol)}),N9(r,`applySyncEvent`,function(e){var t=r.props,n=t.layout,i=t.syncMethod,a=r.state.updateId,o=e.dataStartIndex,s=e.dataEndIndex;if(e.dataStartIndex!==void 0||e.dataEndIndex!==void 0)r.setState($({dataStartIndex:o,dataEndIndex:s},f({props:r.props,dataStartIndex:o,dataEndIndex:s,updateId:a},r.state)));else if(e.activeTooltipIndex!==void 0){var c=e.chartX,l=e.chartY,u=e.activeTooltipIndex,d=r.state,p=d.offset,m=d.tooltipTicks;if(!p)return;if(typeof i==`function`)u=i(m,e);else if(i===`value`){u=-1;for(var h=0;h=0){var D,O;if(c.dataKey&&!c.allowDuplicatedCategory){var k=typeof c.dataKey==`function`?E:`payload.${c.dataKey.toString()}`;D=xR(m,k,u),O=h&&g&&xR(g,k,u)}else D=m?.[l],O=h&&g&&g[l];if(S||x){var A=e.props.activeIndex===void 0?l:e.props.activeIndex;return[(0,_.cloneElement)(e,$($($({},i.props),w),{},{activeIndex:A})),null,null]}if(!(0,uR.default)(D))return[T].concat(k9(r.renderActivePoints({item:i,activePoint:D,basePoint:O,childIndex:l,isRange:h})))}else{var j=(r.getItemByXY(r.state.activeCoordinate)??{graphicalItem:T}).graphicalItem,M=j.item,N=M===void 0?e:M,P=j.childIndex;return[(0,_.cloneElement)(N,$($($({},i.props),w),{},{activeIndex:P})),null,null]}return h?[T,null,null]:[T,null]}),N9(r,`renderCustomized`,function(e,t,n){return(0,_.cloneElement)(e,$($({key:`recharts-customized-${n}`},r.props),r.state))}),N9(r,`renderMap`,{CartesianGrid:{handler:I9,once:!0},ReferenceArea:{handler:r.renderReferenceElement},ReferenceLine:{handler:I9},ReferenceDot:{handler:r.renderReferenceElement},XAxis:{handler:I9},YAxis:{handler:I9},Brush:{handler:r.renderBrush,once:!0},Bar:{handler:r.renderGraphicChild},Line:{handler:r.renderGraphicChild},Area:{handler:r.renderGraphicChild},Radar:{handler:r.renderGraphicChild},RadialBar:{handler:r.renderGraphicChild},Scatter:{handler:r.renderGraphicChild},Pie:{handler:r.renderGraphicChild},Funnel:{handler:r.renderGraphicChild},Tooltip:{handler:r.renderCursor,once:!0},PolarGrid:{handler:r.renderPolarGrid,once:!0},PolarAngleAxis:{handler:r.renderPolarAxis},PolarRadiusAxis:{handler:r.renderPolarAxis},Customized:{handler:r.renderCustomized}}),r.clipPathId=`${e.id??gR(`recharts`)}-clip`,r.throttleTriggeredAfterMouseMove=(0,tG.default)(r.triggeredAfterMouseMove,e.throttleDelay??1e3/60),r.state={},r}return Voe(n,e),Loe(n,[{key:`componentDidMount`,value:function(){this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:this.props.margin.left??0,top:this.props.margin.top??0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:`displayDefaultTooltip`,value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,i=e.layout,a=qR(t,YW);if(a){var o=a.props.defaultIndex;if(!(typeof o!=`number`||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,c=z9(this.state,n,o,s),l=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d=i===`horizontal`?{x:l,y:u}:{y:l,x:u},f=this.state.formattedGraphicalItems.find(function(e){return e.item.type.name===`Scatter`});f&&(d=$($({},d),f.props.points[o].tooltipPosition),c=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:c,activeCoordinate:d};this.setState(p),this.renderCursor(a),this.accessibilityManager.setIndex(o)}}}},{key:`getSnapshotBeforeUpdate`,value:function(e,t){return this.props.accessibilityLayer?(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin&&this.accessibilityManager.setDetails({offset:{left:this.props.margin.left??0,top:this.props.margin.top??0}}),null):null}},{key:`componentDidUpdate`,value:function(e){ez([qR(e.children,YW)],[qR(this.props.children,YW)])||this.displayDefaultTooltip()}},{key:`componentWillUnmount`,value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:`getTooltipEventType`,value:function(){var e=qR(this.props.children,YW);if(e&&typeof e.props.shared==`boolean`){var t=e.props.shared?`axis`:`item`;return o.indexOf(t)>=0?t:i}return i}},{key:`getMouseInfo`,value:function(e){if(!this.container)return null;var t=this.container,n=t.getBoundingClientRect(),r=OG(n),i={chartX:Math.round(e.pageX-r.left),chartY:Math.round(e.pageY-r.top)},a=n.width/t.offsetWidth||1,o=this.inRange(i.chartX,i.chartY,a);if(!o)return null;var s=this.state,c=s.xAxisMap,l=s.yAxisMap,u=this.getTooltipEventType(),d=B9(this.state,this.props.data,this.props.layout,o);if(u!==`axis`&&c&&l){var f=vR(c).scale,p=vR(l).scale,m=f&&f.invert?f.invert(i.chartX):null,h=p&&p.invert?p.invert(i.chartY):null;return $($({},i),{},{xValue:m,yValue:h},d)}return d?$($({},i),d):null}},{key:`inRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=this.props.layout,i=e/n,a=t/n;if(r===`horizontal`||r===`vertical`){var o=this.state.offset;return i>=o.left&&i<=o.left+o.width&&a>=o.top&&a<=o.top+o.height?{x:i,y:a}:null}var s=this.state,c=s.angleAxisMap,l=s.radiusAxisMap;if(c&&l){var u=vR(c);return B1({x:i,y:a},u)}return null}},{key:`parseEventsOfWrapper`,value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=qR(e,YW),r={};return n&&t===`axis`&&(r=n.props.trigger===`click`?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),$($({},jR(this.props,this.handleOuterEvent)),r)}},{key:`addListener`,value:function(){d9.on(f9,this.handleReceiveSyncEvent)}},{key:`removeListener`,value:function(){d9.removeListener(f9,this.handleReceiveSyncEvent)}},{key:`filterFormatItem`,value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,i=0,a=r.length;i{let[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)([]),c=(0,_.useRef)(0),{baseUrl:l,fetchWithHeaders:u}=wl();(0,_.useEffect)(()=>{let t=!1;return iee(l,u,e).then(e=>{if(t||e.length===0)return;let n=e.filter(e=>e.loss!=null).map(e=>({step:e.step,loss:e.loss})).slice(-2e3),r=e.filter(e=>e.lr!=null).map(e=>({step:e.step,lr:e.lr})).slice(-2e3);a(n),s(r),c.current=e[e.length-1]?.step??0}).catch(()=>{}),()=>{t=!0}},[l,u,e]),(0,_.useEffect)(()=>{let e=t.current_step;if(e0&&t.current_loss!=null){let n=t.current_loss;a(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,loss:n}].slice(-2e3)})}if(e>0&&t.current_lr!=null){let n=t.current_lr;s(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,lr:n}].slice(-2e3)})}},[t.current_step,t.current_loss,t.current_lr]);let d=n(),f=t.training_active&&t.total_steps===0,p=f?`Training starting…`:`${t.current_step.toLocaleString()} / ${t.total_steps.toLocaleString()}`,m=t.eta_seconds==null?`—`:r(t.eta_seconds);return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(hb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:(0,B.jsxs)(yb,{className:`p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500/20 text-blue-400`,children:(0,B.jsx)(as,{className:`w-5 h-5`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm text-slate-400`,children:`Progress`}),(0,B.jsx)(`div`,{className:`text-base font-semibold text-white`,children:p})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-slate-300`,children:[(0,B.jsx)(xs,{className:`w-4 h-4 text-purple-400`}),(0,B.jsxs)(`span`,{className:`text-sm`,children:[`ETA `,(0,B.jsx)(`span`,{className:`font-semibold text-white`,children:m})]})]})]}),(0,B.jsxs)(`div`,{className:`relative h-8 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,B.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${d}%`}}),(0,B.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center font-semibold text-white text-sm tabular-nums drop-shadow`,children:f?`warming up…`:`${d.toFixed(1)}%`})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,B.jsxs)(hb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(gb,{className:`pb-2`,children:(0,B.jsxs)(_b,{className:`flex items-center gap-3 text-white text-base`,children:[(0,B.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-green-500/20 text-green-400`,children:(0,B.jsx)(gs,{className:`w-4 h-4`})}),(0,B.jsxs)(`span`,{children:[`Loss`,` `,(0,B.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_loss?.toFixed(4)??`—`,`)`]})]})]})}),(0,B.jsx)(yb,{className:`pt-0`,children:(0,B.jsx)(`div`,{className:`h-48`,children:i.length===0?(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,B.jsx)(mG,{width:`100%`,height:`100%`,children:(0,B.jsxs)(W9,{data:i,margin:{top:8,right:12,left:0,bottom:0},children:[(0,B.jsx)(Z7,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,B.jsx)(s9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48}),(0,B.jsx)(YW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#34d399`},formatter:e=>e.toFixed(4)}),(0,B.jsx)(k7,{type:`monotone`,dataKey:`loss`,stroke:`#34d399`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]}),(0,B.jsxs)(hb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(gb,{className:`pb-2`,children:(0,B.jsxs)(_b,{className:`flex items-center gap-3 text-white text-base`,children:[(0,B.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-orange-500/20 text-orange-400`,children:(0,B.jsx)(as,{className:`w-4 h-4`})}),(0,B.jsxs)(`span`,{children:[`Learning Rate`,` `,(0,B.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_lr?.toExponential(2)??`—`,`)`]})]})]})}),(0,B.jsx)(yb,{className:`pt-0`,children:(0,B.jsx)(`div`,{className:`h-48`,children:o.length===0?(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,B.jsx)(mG,{width:`100%`,height:`100%`,children:(0,B.jsxs)(W9,{data:o,margin:{top:8,right:12,left:0,bottom:0},children:[(0,B.jsx)(Z7,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,B.jsx)(s9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48,tickFormatter:e=>e.toExponential(0)}),(0,B.jsx)(YW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#fb923c`},formatter:e=>e.toExponential(2)}),(0,B.jsx)(k7,{type:`monotone`,dataKey:`lr`,stroke:`#fb923c`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]})]})]})},ase=({logs:e,logContainerRef:t})=>(0,B.jsxs)(hb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(gb,{children:(0,B.jsxs)(_b,{className:`flex items-center gap-3 text-white`,children:[(0,B.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-lg bg-slate-700`,children:(0,B.jsx)(As,{className:`w-5 h-5 text-sky-400`})}),`Training Logs`]})}),(0,B.jsx)(yb,{children:(0,B.jsx)(`div`,{ref:t,className:`bg-slate-900 rounded-lg p-4 h-96 overflow-y-auto font-mono text-sm border border-slate-700`,children:e.length===0?(0,B.jsx)(`div`,{className:`text-slate-500 py-8`,children:`No training logs yet. Start training to see output.`}):e.map((e,t)=>(0,B.jsxs)(`div`,{className:`text-slate-300 break-words whitespace-pre-wrap`,children:[(0,B.jsx)(`span`,{className:`text-slate-500 mr-2 select-none`,children:new Date(e.timestamp*1e3).toLocaleTimeString()}),e.message]},t))})})]}),ose=({installHint:e})=>{let t=fL(`system/training-extra`);return(0,B.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:(0,B.jsxs)(hb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(gb,{children:(0,B.jsxs)(_b,{className:`flex items-center gap-3 text-white`,children:[(0,B.jsx)(mL,{state:t.state}),pL(t.state,`Training Extra Not Installed`)]})}),(0,B.jsx)(yb,{className:`space-y-4`,children:(0,B.jsx)(hL,{state:t.state,error:t.error,logs:t.logs,logBoxRef:t.logBoxRef,onInstall:t.handleInstall,onRetry:t.handleRetry,installHint:e,packageName:`accelerate`,idleTitle:`Training Extra Not Installed`,idleDescription:(0,B.jsxs)(B.Fragment,{children:[`Training requires the`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`accelerate`}),` `,`package, which isn't installed in this environment. Install it to enable the Training page.`]}),doneDescription:(0,B.jsx)(gL,{purpose:`training`})})})]})})},sse=({open:e,onOpenChange:t,policyType:n,packageName:r,installTarget:i,installHint:a})=>{let o=fL(`system/policy-extra/${n}`,e),s=`${n.toUpperCase()} needs an extra package`;return(0,B.jsx)(lf,{open:e,onOpenChange:t,children:(0,B.jsxs)(ff,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,B.jsxs)(pf,{children:[(0,B.jsxs)(hf,{className:`flex items-center gap-3 text-white`,children:[(0,B.jsx)(mL,{state:o.state}),pL(o.state,s)]}),(0,B.jsxs)(gf,{className:`sr-only`,children:[`Install `,i,` to train `,n,`.`]})]}),(0,B.jsx)(`div`,{className:`space-y-4`,children:(0,B.jsx)(hL,{state:o.state,error:o.error,logs:o.logs,logBoxRef:o.logBoxRef,onInstall:o.handleInstall,onRetry:o.handleRetry,installHint:a,packageName:i,idleTitle:s,idleDescription:(0,B.jsxs)(B.Fragment,{children:[`Training a `,(0,B.jsx)(`span`,{className:`font-semibold`,children:n}),` policy needs the`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:r}),` `,`package (installed via`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:i}),`), which isn't in this environment yet. Install it to train this policy.`]}),doneDescription:(0,B.jsx)(gL,{purpose:`${n} training`})})})]})})},cse=()=>{let{auth:e,refetch:t}=Dl(),{baseUrl:n,fetchWithHeaders:r}=wl(),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null);if(e.status===`authenticated`||e.status===`loading`)return null;let u=async()=>{let e=i.trim();if(e){s(!0),l(null);try{let i=await r(`${n}/hf-auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}a(``),await t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}};return(0,B.jsx)(`div`,{className:`bg-amber-950/40 border border-amber-700/60 rounded-lg p-4 mb-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(hs,{className:`w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5`}),(0,B.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm text-amber-100 font-medium`,children:`Hugging Face access required for cloud training`}),(0,B.jsxs)(`p`,{className:`text-xs text-amber-200/80 mt-1`,children:[`Create a token at`,` `,(0,B.jsxs)(`a`,{href:`https://huggingface.co/settings/tokens`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-amber-50 inline-flex items-center gap-1`,children:[`huggingface.co/settings/tokens`,(0,B.jsx)(Ds,{className:`w-3 h-3`})]}),` `,`with `,(0,B.jsx)(`span`,{className:`font-mono`,children:`Write`}),` access (so trained policies can upload to your account), then paste it below.`]})]}),(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u()},className:`flex gap-2`,children:[(0,B.jsx)(J_,{type:`password`,placeholder:`hf_...`,value:i,onChange:e=>a(e.target.value),className:`bg-slate-900 border-slate-600 text-white placeholder:text-slate-500`,disabled:o,autoComplete:`off`}),(0,B.jsx)(q,{type:`submit`,disabled:o||!i.trim(),className:`bg-amber-600 hover:bg-amber-700 text-white`,children:o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ns,{className:`w-4 h-4 mr-2 animate-spin`}),`Saving…`]}):`Save token`})]}),c&&(0,B.jsx)(`p`,{className:`text-xs text-red-300`,children:c})]})]})})},lse=1e3,G9=5e3;function use(e,t){return e?{training_active:e.state===`running`,current_step:e.metrics.current_step,total_steps:e.metrics.total_steps,current_loss:e.metrics.current_loss??void 0,current_lr:e.metrics.current_lr??void 0,grad_norm:e.metrics.grad_norm??void 0,eta_seconds:e.metrics.eta_seconds??void 0,available_controls:{stop_training:e.state===`running`,pause_training:!1,resume_training:!1}}:{training_active:t,current_step:0,total_steps:0,available_controls:{stop_training:!1,pause_training:!1,resume_training:!1}}}function dse(e){return{target:e.target,dataset_repo_id:e.dataset_repo_id,policy_type:e.policy_type,steps:e.steps,batch_size:e.batch_size,seed:e.seed,num_workers:e.num_workers,log_freq:e.log_freq,save_freq:e.save_freq,save_checkpoint:e.save_checkpoint,resume:e.resume,wandb_enable:e.wandb_enable,wandb_project:e.wandb_project,wandb_entity:e.wandb_entity,wandb_notes:e.wandb_notes,wandb_mode:e.wandb_mode,wandb_disable_artifact:e.wandb_disable_artifact,policy_device:e.policy_device,policy_use_amp:e.policy_use_amp,optimizer_type:e.optimizer_type,optimizer_lr:e.optimizer_lr,optimizer_weight_decay:e.optimizer_weight_decay,optimizer_grad_clip_norm:e.optimizer_grad_clip_norm,use_policy_training_preset:e.use_policy_training_preset,dataset_image_transforms_enable:e.dataset_image_transforms_enable,...e.policy_type===`groot`?{policy_base_model_path:e.policy_base_model_path,policy_embodiment_tag:e.policy_embodiment_tag,policy_chunk_size:e.policy_chunk_size,policy_n_action_steps:e.policy_n_action_steps,policy_use_relative_actions:e.policy_use_relative_actions,policy_relative_exclude_joints:e.policy_relative_exclude_joints,policy_use_bf16:e.policy_use_bf16}:{}}}var fse=()=>{let{baseUrl:e,fetchWithHeaders:t}=wl(),{auth:n}=Dl(),{toast:r}=ea(),i=ht(),[a,o]=(0,_.useState)({target:{runner:`local`},dataset_repo_id:ft().state?.datasetRepoId??``,policy_type:`act`,steps:1e4,batch_size:8,seed:1e3,num_workers:4,log_freq:250,save_freq:1e3,save_checkpoint:!0,resume:!1,wandb_enable:!1,wandb_mode:`online`,wandb_disable_artifact:!1,policy_device:`cuda`,policy_use_amp:!1,optimizer_type:`adam`,use_policy_training_preset:!0}),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!0),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(`pip install accelerate`),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)([]),[E,D]=(0,_.useState)(!0);(0,_.useEffect)(()=>{u(!0),Sf(e,t).then(c).catch(()=>c([])).finally(()=>u(!1))},[e,t]),(0,_.useEffect)(()=>{t(`${e}/system/training-extra`).then(e=>e.json()).then(e=>{f(e.available),m(e.install_hint)}).catch(()=>f(!0))},[e,t]),(0,_.useEffect)(()=>{Cf(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>g(!1))},[e,t]),(0,_.useEffect)(()=>{D(!0),cee(e,t).then(e=>{C(e.authenticated),T(e.flavors)}).catch(()=>{C(!1),T([])}).finally(()=>D(!1))},[e,t,n.status]);let O=(e,t)=>{o(n=>({...n,[e]:t}))},k=async()=>{if(!a.dataset_repo_id.trim()){r({title:`Error`,description:`Dataset repository ID is required`,variant:`destructive`});return}if(a.target.runner===`local`)try{let n=await t(`${e}/system/policy-extra/${a.policy_type}`);if(n.ok){let e=await n.json();if(e.needs_extra&&!e.available){x({policyType:a.policy_type,packageName:e.package,installTarget:e.install_target,installHint:e.install_hint});return}}}catch{}y(!0);try{let n=await aee(e,t,dse(a));r({title:`Training Started`,description:n.name}),i(`/training/${n.id}`)}catch(n){r({title:`Error`,description:n instanceof Error?n.message:String(n),variant:`destructive`}),Cf(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>{})}finally{y(!1)}};if(d===null)return(0,B.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,B.jsx)(uL,{}),(0,B.jsxs)(`div`,{className:`flex items-center justify-center py-24 text-slate-400`,children:[(0,B.jsx)(Ns,{className:`w-6 h-6 animate-spin mr-3`}),`Checking training environment…`]})]})});if(d===!1)return(0,B.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,B.jsx)(uL,{}),(0,B.jsx)(ose,{installHint:p})]})});let A=a.target.runner===`hf_cloud`,j=a.target.runner===`hf_cloud`&&!a.target.flavor,M=a.target.runner===`local`&&h,N=v||!a.dataset_repo_id.trim()||M||A&&!S||j,P=M?`Another local training is already running`:A&&!S?`Log in to Hugging Face to use cloud compute`:j?`Select a hardware flavor`:void 0;return(0,B.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,B.jsx)(uL,{}),(0,B.jsx)(cse,{}),(0,B.jsx)(_re,{config:a,updateConfig:O,datasets:s,datasetsLoading:l,authenticated:S,flavors:w,hardwareLoading:E}),(0,B.jsx)(`div`,{className:`max-w-3xl mx-auto mt-6 flex justify-end`,children:(()=>{let e=(0,B.jsx)(q,{onClick:k,disabled:N,size:`lg`,className:`bg-green-500 hover:bg-green-600 text-white font-semibold px-6`,children:v?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ns,{className:`w-5 h-5 mr-2 animate-spin`}),` Starting…`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ls,{className:`w-5 h-5 mr-2`}),` Start Training`]})});return P?(0,B.jsxs)(tg,{children:[(0,B.jsx)(ng,{asChild:!0,children:(0,B.jsx)(`span`,{tabIndex:0,children:e})}),(0,B.jsx)(rg,{children:P})]}):e})()})]}),b&&(0,B.jsx)(sse,{open:!!b,onOpenChange:e=>!e&&x(null),policyType:b.policyType,packageName:b.packageName,installTarget:b.installTarget,installHint:b.installHint})]})},pse=({jobId:e})=>{let{baseUrl:t,fetchWithHeaders:n}=wl(),{toast:r}=ea(),i=ht(),{selectedRecord:a}=Bb(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)([]),f=(0,_.useRef)(null),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let r=!1;return ree(t,n,e).then(e=>{!r&&e.length>0&&d(e)}).catch(()=>{}),()=>{r=!0}},[t,n,e]);let b=(0,_.useRef)(o?.state);b.current=o?.state,(0,_.useEffect)(()=>{let r=!1,i=()=>{bb(t,n,e).then(e=>{if(!r)if(m(e),e.length>0){let t=e[e.length-1].step;g(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else g(null)}).catch(()=>{r||(m([]),g(null))})};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},5e3);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{let r=!1,i=async()=>{try{let i=await tee(t,n,e);if(r)return;if(s(i),i.state===`running`){let i=await nee(t,n,e);!r&&i.length>0&&d(e=>{let t=[...e,...i];return t.length>G9?t.slice(t.length-G9):t})}}catch(e){r||l(e instanceof Error?e.message:String(e))}};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},lse);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[u]);let x=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`},S=()=>!o||o.metrics.total_steps===0?0:o.metrics.current_step/o.metrics.total_steps*100,C=async()=>{if(o&&window.confirm(`Stop this run?`))try{s(await wf(t,n,o.id)),r({title:`Stopping…`})}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},w=async()=>{if(o&&window.confirm(`Delete this run? This wipes the output directory.`))try{await Tf(t,n,o.id),r({title:`Job removed`}),i(`/`)}catch(e){r({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(c&&!o)return(0,B.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-4`,children:[(0,B.jsxs)(q,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400`,children:[(0,B.jsx)(os,{className:`w-4 h-4 mr-2`}),` Back to Jobs`]}),(0,B.jsxs)(`p`,{className:`text-red-300`,children:[`Couldn't load job `,e,`: `,c]})]})});if(!o)return(0,B.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto flex items-center justify-center py-24 text-slate-400`,children:[(0,B.jsx)(Ns,{className:`w-6 h-6 animate-spin mr-3`}),` Loading job…`]})});let T=o.state===`running`;return(0,B.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(q,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400 hover:text-white`,children:[(0,B.jsx)(os,{className:`w-4 h-4 mr-2`}),` Jobs`]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`h1`,{className:`text-xl font-semibold text-white`,children:o.name}),o.runner===`hf_cloud`?(0,B.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-amber-900/40 text-amber-200 border border-amber-700`,children:[`HF · `,o.hf_flavor??`cloud`]}):(0,B.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-slate-700 text-slate-200 border border-slate-600`,children:`Local`}),o.runner===`hf_cloud`&&o.hf_repo_id&&o.state===`done`&&(0,B.jsx)(`a`,{href:`https://huggingface.co/${o.hf_repo_id}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-amber-300 hover:text-amber-200 underline`,children:`View on Hub ↗`}),o.wandb_run_url&&(0,B.jsx)(`a`,{href:o.wandb_run_url,target:`_blank`,rel:`noreferrer`,className:`text-xs text-yellow-300 hover:text-yellow-200 underline`,children:`View on W&B ↗`})]}),(0,B.jsxs)(`p`,{className:`text-xs text-slate-400`,children:[o.state,o.error_message?` — ${o.error_message}`:``]})]})]}),T?(0,B.jsxs)(q,{onClick:C,className:`bg-red-500 hover:bg-red-600 text-white`,children:[(0,B.jsx)(Js,{className:`w-4 h-4 mr-2`}),` Stop`]}):(0,B.jsxs)(q,{onClick:w,variant:`ghost`,className:`text-slate-400 hover:text-white`,children:[(0,B.jsx)(Xs,{className:`w-4 h-4 mr-2`}),` Delete`]})]}),(0,B.jsx)(ise,{jobId:e,trainingStatus:use(o,!1),getProgressPercentage:S,formatTime:x}),(0,B.jsxs)(`div`,{className:`bg-slate-800/40 border border-slate-700 rounded-lg p-4 flex items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`text-sm font-semibold text-slate-300`,children:`Run inference`}),p.length===0?(0,B.jsx)(`span`,{className:`text-xs text-slate-500`,children:`No checkpoints yet — wait for the first save.`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(xb,{checkpoints:p,selectedStep:h,onChange:g}),(0,B.jsxs)(q,{onClick:()=>y(!0),disabled:h==null,className:`bg-green-500 hover:bg-green-600 text-white`,children:[(0,B.jsx)(Ls,{className:`w-4 h-4 mr-2`}),`Run on robot`]})]})]}),(0,B.jsx)(Fb,{open:v,onOpenChange:y,robot:a,jobId:e,initialStep:h}),(0,B.jsx)(ase,{logs:u,logContainerRef:f})]})})},K9=()=>{let{jobId:e}=_t();return e?(0,B.jsx)(pse,{jobId:e}):(0,B.jsx)(fse,{})},mse=1e3;function q9(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/60),r=t%60;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`}var hse=()=>{let e=ht(),{baseUrl:t,fetchWithHeaders:n}=wl(),{toast:r}=ea(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(!1),l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let i=!1,o=async()=>{try{await jb(t,n)}catch{}},s=async()=>{try{let s=await Mb(t,n);if(i)return;if(a(s),!s.inference_active&&!c.current){c.current=!0,s.exited&&r({title:`Inference finished`,description:s.exit_code===0?`Run completed.`:`Exit code ${s.exit_code}. See ${s.log_path}.`,variant:s.exit_code===0?`default`:`destructive`}),e(`/`);return}s.inference_active&&s.rollout_started_at!=null&&s.duration_s!=null&&s.duration_s>0&&s.rollout_elapsed_s>s.duration_s+10&&!l.current&&(l.current=!0,r({title:`Inference seems hung`,description:`Rollout past duration by ${Math.round(s.rollout_elapsed_s-s.duration_s)}s. Stopping.`,variant:`destructive`}),o())}catch(e){i||r({title:`Lost connection to backend`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};s();let u=setInterval(s,mse);return()=>{i=!0,clearInterval(u)}},[t,n,e,r]);let u=async()=>{s(!1);try{await jb(t,n)}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(!i)return(0,B.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:[(0,B.jsx)(Ns,{className:`w-6 h-6 animate-spin mr-3`}),` Connecting to inference…`]});let d=i.elapsed_s??0,f=i.rollout_elapsed_s??0,p=i.duration_s??0,m=i.inference_active&&i.rollout_started_at==null,h=i.inference_active&&i.rollout_started_at!=null,g=h&&p>0?Math.min(100,f/p*100):0;return(0,B.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex flex-col p-4 sm:p-6 lg:p-8`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4 mb-8`,children:[(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,B.jsx)(os,{className:`w-5 h-5`})}),(0,B.jsx)(eN,{}),(0,B.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Inference`})]}),(0,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-8 w-full max-w-xl`,children:[(0,B.jsx)(`div`,{className:`text-center mb-6`,children:(0,B.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${m?`bg-amber-500/15 text-amber-300`:`bg-green-500/15 text-green-300`}`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full ${m?`bg-amber-500`:`bg-green-500`} animate-pulse`}),m?`SETTING UP`:h?`RUNNING`:`FINISHED`]})}),(0,B.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,B.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${m?`text-amber-400`:`text-green-400`}`,children:q9(h?f:d)}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500 mt-2`,children:m?`Loading policy & connecting hardware…`:`/ ${q9(p)}`})]}),(0,B.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-8`,children:(0,B.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${m?`bg-amber-500/40 animate-pulse w-full`:`bg-green-500`}`,style:m?void 0:{width:`${g}%`}})}),(0,B.jsxs)(`div`,{className:`text-xs text-slate-500 break-all mb-6`,children:[`policy: `,i.policy_ref??`(unknown)`]}),(0,B.jsxs)(q,{onClick:()=>s(!0),disabled:!i.inference_active,className:`w-full bg-red-500 hover:bg-red-600 text-white font-semibold py-6 text-lg disabled:opacity-50`,children:[(0,B.jsx)(Js,{className:`w-5 h-5 mr-2`}),`Stop`]})]})}),(0,B.jsx)(tL,{open:o,onOpenChange:s,children:(0,B.jsxs)(rL,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,B.jsxs)(iL,{children:[(0,B.jsx)(oL,{children:`Stop inference?`}),(0,B.jsx)(sL,{className:`text-gray-400`,children:`The follower will hold its current pose. You can launch another run from the job tile.`})]}),(0,B.jsxs)(aL,{children:[(0,B.jsx)(lL,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep running`}),(0,B.jsx)(cL,{onClick:u,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})};async function gse(e,t,n,r){return xf(e,t,`/dataset-episodes?${new URLSearchParams({repo_id:n})}`,{signal:r,action:`List episodes`})}async function _se(e,t,n,r,i){return xf(e,t,`/dataset-episode?${new URLSearchParams({repo_id:n,episode_index:String(r)})}`,{signal:i,action:`Load episode`})}async function vse(e,t,n,r,i){return xf(e,t,`/dataset-motion?${new URLSearchParams({repo_id:n,episode_index:String(r)})}`,{signal:i,action:`Load motion trace`})}async function yse(e,t,n,r,i,a,o){return xf(e,t,`/dataset-thumbnails?${new URLSearchParams({repo_id:n,episode_index:String(r),camera:i,count:String(a)})}`,{signal:o,action:`Load thumbnails`})}function J9(e,t,n,r,i){return`${e}/dataset-video?${new URLSearchParams({repo_id:t,camera:n,chunk:String(r),file:String(i)})}`}function Y9(e,t,n,r,i,a){let o=new URLSearchParams({repo_id:t,episode_index:String(n),camera:r,frame_index:String(i)});return a&&o.set(`max_width`,String(a)),`${e}/dataset-frame?${o}`}function X9(e){if(e==null)return`—`;if(e<60)return`${e.toFixed(1)}s`;let t=Math.floor(e/60),n=Math.round(e%60);return`${t}m ${String(n).padStart(2,`0`)}s`}var bse=({episodes:e,selected:t,onSelect:n})=>{let r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{r.current?.scrollIntoView({block:`nearest`})},[t]),e.length===0?(0,B.jsx)(`div`,{className:`rounded-lg border border-gray-800 bg-gray-950 p-4 text-xs text-gray-500`,children:`No episodes in this dataset.`}):(0,B.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-gray-800 bg-gray-950`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-b border-gray-800 px-3 py-2`,children:[(0,B.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-gray-500`,children:`Episodes`}),(0,B.jsx)(`span`,{className:`text-[11px] tabular-nums text-gray-600`,children:e.length})]}),(0,B.jsx)(`div`,{className:`max-h-[calc(100vh_-_280px)] overflow-y-auto`,children:e.map(e=>{let i=e.episode_index===t;return(0,B.jsxs)(`button`,{ref:i?r:void 0,type:`button`,onClick:()=>n(e.episode_index),className:`flex w-full items-center gap-2 border-b border-gray-900 px-3 py-2 text-left transition last:border-b-0 ${i?`bg-gray-800/80`:`hover:bg-gray-900`} focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-orange-500`,children:[(0,B.jsx)(`span`,{className:`w-8 text-xs tabular-nums ${i?`font-semibold text-orange-400`:`text-gray-500`}`,children:e.episode_index}),(0,B.jsx)(`span`,{className:`flex-1 truncate text-xs text-gray-300`,children:e.tasks.length>0?e.tasks.join(`, `):`—`}),(0,B.jsx)(`span`,{className:`text-[11px] tabular-nums text-gray-500`,children:X9(e.duration_s)})]},e.episode_index)})})]})},xse=({repoId:e,episodeIndex:t,camera:n,currentFrame:r,onSeekFrame:i,count:a=12})=>{let{baseUrl:o,fetchWithHeaders:s}=wl(),[c,l]=(0,_.useState)([]),[u,d]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let r=new AbortController;return d(!0),yse(o,s,e,t,n,a,r.signal).then(e=>{r.signal.aborted||l(e.success?e.thumbnails:[])}).catch(()=>{r.signal.aborted||l([])}).finally(()=>{r.signal.aborted||d(!1)}),()=>r.abort()},[o,s,e,t,n,a]);let f=c.reduce((e,t,n)=>Math.abs(t.frame_index-r)(0,B.jsxs)(`button`,{type:`button`,onClick:()=>i(e.frame_index),title:`Frame ${e.frame_index}`,className:`group relative flex-none overflow-hidden rounded transition ${t===f?`ring-2 ring-orange-500`:`ring-1 ring-gray-800 hover:ring-gray-600`} focus:outline-none focus-visible:ring-2 focus-visible:ring-orange-400`,children:[(0,B.jsx)(`img`,{src:e.data_uri,alt:`Frame ${e.frame_index}`,className:`h-14 w-auto`,draggable:!1}),(0,B.jsx)(`span`,{className:`absolute bottom-0 right-0 bg-black/70 px-1 text-[10px] tabular-nums text-gray-300 opacity-0 transition group-hover:opacity-100`,children:e.frame_index})]},e.frame_index))})},Sse=({repoId:e,episodeIndex:t,currentFrame:n,onSeekFrame:r})=>{let{baseUrl:i,fetchWithHeaders:a}=wl(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null);(0,_.useEffect)(()=>{let n=new AbortController;return l(null),vse(i,a,e,t,n.signal).then(e=>{if(!n.signal.aborted){if(!e.success){s(null),l(e.message??`No action stream`);return}s(e.motion)}}).catch(e=>{n.signal.aborted||(s(null),l(e instanceof Error?e.message:`No action stream`))}),()=>n.abort()},[i,a,e,t]);let u=(0,_.useMemo)(()=>(o??[]).map((e,t)=>({frame:t,motion:e})),[o]);return c?(0,B.jsxs)(`div`,{className:`flex h-[64px] items-center justify-center rounded-md border border-gray-800 bg-gray-950 text-[11px] text-gray-600`,children:[`Joint motion unavailable — `,c]}):o?(0,B.jsxs)(`div`,{className:`rounded-md border border-gray-800 bg-gray-950 px-1 pb-1 pt-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-2 pb-1`,children:[(0,B.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-gray-600`,children:`Joint motion`}),(0,B.jsxs)(`span`,{className:`text-[10px] tabular-nums text-gray-600`,children:[`frame `,n]})]}),(0,B.jsx)(`div`,{className:`h-[52px] w-full cursor-pointer`,children:(0,B.jsx)(mG,{width:`100%`,height:`100%`,children:(0,B.jsxs)(rse,{data:u,margin:{top:2,right:4,bottom:0,left:4},onClick:e=>{let t=e?.activeLabel;t!=null&&r(Number(t))},children:[(0,B.jsx)(`defs`,{children:(0,B.jsxs)(`linearGradient`,{id:`motionFill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#f97316`,stopOpacity:.5}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#f97316`,stopOpacity:.04})]})}),(0,B.jsx)(s9,{hide:!0,domain:[0,`dataMax`]}),(0,B.jsx)(YW,{contentStyle:{background:`#0a0a0a`,border:`1px solid #1f2937`,borderRadius:6,fontSize:11,padding:`4px 8px`},labelStyle:{color:`#9ca3af`},itemStyle:{color:`#fb923c`},formatter:e=>[e.toFixed(2),`motion`],labelFormatter:e=>`Frame ${e}`}),(0,B.jsx)(H7,{type:`monotone`,dataKey:`motion`,stroke:`#f97316`,strokeWidth:1.25,fill:`url(#motionFill)`,isAnimationActive:!1,dot:!1}),(0,B.jsx)(A5,{x:n,stroke:`#e5e7eb`,strokeWidth:1})]})})})]}):(0,B.jsx)(`div`,{className:`h-[64px] rounded-md border border-gray-800 bg-gray-950`})},Cse=[.5,1,2],wse=.2,Tse=({repoId:e,detail:t,onNavigate:n})=>{let{baseUrl:r}=wl(),i=t.cameras,[a,o]=(0,_.useState)(i[0]?.name??``),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(1),[p,m]=(0,_.useState)(0),h=(0,_.useRef)(null),g=(0,_.useRef)({});(0,_.useEffect)(()=>{i.some(e=>e.name===a)||o(i[0]?.name??``)},[i,a]);let v=(0,_.useMemo)(()=>i.find(e=>e.name===a)??i[0]??null,[i,a]),y=t.fps??20,b=v?.from_timestamp??0,x=v?.to_timestamp??b+(t.duration_s??0),S=(0,_.useCallback)(e=>{let n=h.current;if(!n)return;let r=Math.max(0,Math.min(e,Math.max(t.length-1,0)));n.currentTime=b+(r+.5)/y,m(r)},[b,y,t.length]),C=(0,_.useCallback)(()=>{let e=h.current;e&&(e.currentTime=b,e.playbackRate=d,m(0))},[b,d]);(0,_.useEffect)(()=>{let e=h.current;if(!e)return;let t=!e.paused,n=()=>{e.currentTime=b,e.playbackRate=d,m(0),(t||l)&&e.play().catch(()=>u(!1))};if(e.readyState>=1)n();else return e.addEventListener(`loadedmetadata`,n,{once:!0}),()=>e.removeEventListener(`loadedmetadata`,n)},[t.episode_index,a,b]);let w=(0,_.useCallback)(()=>{let e=h.current;if(e&&!e.ended){if(e.currentTime>=x){e.currentTime=b,m(0);return}if(m(Math.max(0,Math.floor((e.currentTime-b)*y))),s)for(let t of i){if(t.name===a)continue;let n=g.current[t.name];if(!n)continue;let r=(t.from_timestamp??0)+(e.currentTime-b);Math.abs(n.currentTime-r)>wse&&(n.currentTime=r),n.playbackRate=e.playbackRate,l&&n.paused&&n.play().catch(()=>void 0),!l&&!n.paused&&n.pause()}}},[x,b,y,s,i,a,l]),T=(0,_.useCallback)(()=>{let e=h.current;e&&(e.paused?e.play().then(()=>u(!0),()=>u(!1)):(e.pause(),u(!1)))},[]);if((0,_.useEffect)(()=>{h.current&&(h.current.playbackRate=d)},[d,a]),(0,_.useEffect)(()=>{let e=e=>{let t=e.target;t&&[`INPUT`,`TEXTAREA`,`SELECT`].includes(t.tagName)||(e.code===`Space`?(e.preventDefault(),T()):e.code===`ArrowLeft`?S(p-1):e.code===`ArrowRight`&&S(p+1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[T,S,p]),!v)return(0,B.jsx)(`div`,{className:`flex h-64 items-center justify-center rounded-lg border border-gray-800 bg-gray-950 text-sm text-gray-500`,children:`This episode has no camera videos on disk.`});let E=i.filter(e=>e.name!==a);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`flex rounded-md border border-gray-800 bg-gray-950 p-0.5`,children:i.map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>o(e.name),className:`rounded px-3 py-1 text-xs font-medium transition ${e.name===a?`bg-gray-800 text-white`:`text-gray-400 hover:text-gray-200`}`,children:e.name},e.name))}),i.length>1&&(0,B.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>c(e=>!e),className:`h-7 gap-1.5 border-gray-800 bg-gray-950 text-xs hover:bg-gray-900 ${s?`text-orange-400`:`text-gray-400`}`,children:[(0,B.jsx)(Ms,{className:`h-3.5 w-3.5`}),`All cameras`]}),(0,B.jsx)(`div`,{className:`ml-auto flex rounded-md border border-gray-800 bg-gray-950 p-0.5`,children:Cse.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>f(e),className:`rounded px-2.5 py-1 text-xs font-medium tabular-nums transition ${e===d?`bg-gray-800 text-white`:`text-gray-400 hover:text-gray-200`}`,children:[e,`x`]},e))})]}),(0,B.jsxs)(`div`,{className:s&&i.length>1?`grid grid-cols-1 gap-2 sm:grid-cols-2`:`grid grid-cols-1`,children:[(0,B.jsxs)(`div`,{className:`relative flex items-center justify-center overflow-hidden rounded-lg border border-gray-800 bg-black`,children:[(0,B.jsx)(`video`,{ref:h,src:J9(r,e,a,v.chunk,v.file_index),poster:Y9(r,e,t.episode_index,a,0,640),className:`w-auto max-w-full bg-black object-contain ${s&&i.length>1?`max-h-[22vh]`:`max-h-[42vh]`}`,preload:`auto`,playsInline:!0,muted:!0,onLoadedMetadata:C,onTimeUpdate:w,onEnded:e=>{let t=e.currentTarget;t.currentTime=b,m(0),t.play().catch(()=>u(!1))},onPlay:()=>u(!0),onPause:()=>u(!1)},`${a}-${v.chunk}-${v.file_index}`),(0,B.jsx)(`span`,{className:`absolute left-2 top-2 rounded bg-black/70 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-gray-300`,children:a})]}),s&&E.map(n=>(0,B.jsxs)(`div`,{className:`relative flex items-center justify-center overflow-hidden rounded-lg border border-gray-800 bg-black`,children:[(0,B.jsx)(`video`,{ref:e=>{g.current[n.name]=e},src:J9(r,e,n.name,n.chunk,n.file_index),poster:Y9(r,e,t.episode_index,n.name,0,640),className:`max-h-[22vh] w-auto max-w-full bg-black object-contain`,preload:`auto`,playsInline:!0,muted:!0,onLoadedMetadata:e=>{e.currentTarget.currentTime=n.from_timestamp??0}},`${n.name}-${n.chunk}-${n.file_index}`),(0,B.jsx)(`span`,{className:`absolute left-2 top-2 rounded bg-black/70 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-gray-300`,children:n.name})]},n.name))]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(q,{size:`sm`,onClick:T,className:`h-8 w-8 bg-orange-600 p-0 hover:bg-orange-500`,title:`Play / pause (Space)`,children:l?(0,B.jsx)(Fs,{className:`h-4 w-4`}):(0,B.jsx)(Ls,{className:`h-4 w-4`})}),(0,B.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>S(p-1),className:`h-8 w-8 border-gray-800 bg-gray-950 p-0 text-gray-300 hover:bg-gray-900`,title:`Previous frame (←)`,children:(0,B.jsx)(Gs,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>S(p+1),className:`h-8 w-8 border-gray-800 bg-gray-950 p-0 text-gray-300 hover:bg-gray-900`,title:`Next frame (→)`,children:(0,B.jsx)(Ks,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`input`,{type:`range`,min:0,max:Math.max(t.length-1,0),value:p,onChange:e=>S(Number(e.target.value)),className:`mx-2 h-1 flex-1 cursor-pointer appearance-none rounded bg-gray-800 accent-orange-500`,"aria-label":`Scrub episode`}),(0,B.jsxs)(`span`,{className:`w-28 text-right text-xs tabular-nums text-gray-400`,children:[p,` / `,Math.max(t.length-1,0)]})]}),(0,B.jsx)(Sse,{repoId:e,episodeIndex:t.episode_index,currentFrame:p,onSeekFrame:S}),(0,B.jsx)(xse,{repoId:e,episodeIndex:t.episode_index,camera:a,currentFrame:p,onSeekFrame:S}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-800 pt-3`,children:[(0,B.jsxs)(q,{variant:`outline`,size:`sm`,disabled:t.prev_episode===null,onClick:()=>t.prev_episode!==null&&n(t.prev_episode),className:`h-7 gap-1 border-gray-800 bg-gray-950 text-xs text-gray-300 hover:bg-gray-900 disabled:opacity-40`,children:[(0,B.jsx)(ds,{className:`h-3.5 w-3.5`}),`Previous`]}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`Episode `,t.episode_index,` of `,t.total_episodes]}),(0,B.jsxs)(q,{variant:`outline`,size:`sm`,disabled:t.next_episode===null,onClick:()=>t.next_episode!==null&&n(t.next_episode),className:`h-7 gap-1 border-gray-800 bg-gray-950 text-xs text-gray-300 hover:bg-gray-900 disabled:opacity-40`,children:[`Next`,(0,B.jsx)(fs,{className:`h-3.5 w-3.5`})]})]})]})},Ese=e=>{let{baseUrl:t,fetchWithHeaders:n}=wl(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(null);return(0,_.useEffect)(()=>{if(i(null),c(null),!e){o(!1);return}let r=new AbortController;return o(!0),gse(t,n,e,r.signal).then(e=>{if(!r.signal.aborted){if(!e.success){i(null),c(e.message??`Could not read dataset`);return}i(e)}}).catch(e=>{r.signal.aborted||(i(null),c(e instanceof Error?e.message:`Could not read dataset`))}).finally(()=>{r.signal.aborted||o(!1)}),()=>r.abort()},[t,n,e]),{data:r?.repo_id===e?r:null,loading:a,error:s}},Dse=(e,t)=>{let{baseUrl:n,fetchWithHeaders:r}=wl(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null);return(0,_.useEffect)(()=>{if(!e||t===null){a(null);return}let i=new AbortController;return s(!0),l(null),_se(n,r,e,t,i.signal).then(e=>{if(!i.signal.aborted){if(!e.success){a(null),l(e.message??`Could not load episode`);return}a(e)}}).catch(e=>{i.signal.aborted||(a(null),l(e instanceof Error?e.message:`Could not load episode`))}).finally(()=>{i.signal.aborted||s(!1)}),()=>i.abort()},[n,r,e,t]),{detail:i,loading:o,error:c}},Z9=({label:e,value:t})=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,B.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-gray-600`,children:e}),(0,B.jsx)(`span`,{className:`font-medium tabular-nums text-gray-200`,children:t})]}),Ose=()=>{let e=ht(),[t,n]=Hn(),{datasets:r,loading:i}=Yb(),a=(0,_.useMemo)(()=>r.filter(e=>e.source===`local`||e.source===`both`),[r]),o=t.get(`dataset`),s=t.get(`episode`),c=s===null?null:Number(s),l=r.find(e=>e.repo_id===o)?.source,{data:u,loading:d,error:f}=Ese(o),{detail:p,loading:m,error:h}=Dse(o,c),g=e=>{let n=t.get(`api`);return n?{...e,api:n}:e},v=e=>n(g({dataset:e})),y=e=>{o&&n(g({dataset:o,episode:String(e)}))};return(0,_.useEffect)(()=>{o&&u?.success&&s===null&&u.episodes.length>0&&n(g({dataset:o,episode:String(u.episodes[0].episode_index)}),{replace:!0})},[o,u,s,n]),(0,B.jsx)(`div`,{className:`min-h-screen bg-black p-6 pb-24 text-white`,children:(0,B.jsxs)(`div`,{className:`mx-auto max-w-[1400px]`,children:[(0,B.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-center gap-3`,children:[(0,B.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:()=>e(`/`),className:`h-8 gap-1.5 px-2 text-gray-400 hover:bg-gray-900 hover:text-white`,children:[(0,B.jsx)(os,{className:`h-4 w-4`}),`Back`]}),(0,B.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold tracking-tight`,children:[(0,B.jsx)(ws,{className:`h-5 w-5 text-orange-500`}),`Browse dataset`]}),(0,B.jsxs)(`div`,{className:`ml-auto flex w-full items-center gap-2 sm:w-auto`,children:[(0,B.jsx)(`div`,{className:`w-full sm:w-[380px]`,children:(0,B.jsxs)(Uy,{value:o??void 0,onValueChange:v,children:[(0,B.jsx)(Gy,{className:`h-9 border-gray-800 bg-gray-950 text-sm text-white`,children:(0,B.jsx)(Wy,{placeholder:i?`Loading datasets…`:`Select a local dataset`})}),(0,B.jsx)(Jy,{className:`border-gray-800 bg-gray-950 text-white`,children:a.map(e=>(0,B.jsx)(Xy,{value:e.repo_id,className:`text-sm`,children:e.repo_id},e.repo_id))})]})}),o&&(0,B.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>e(`/upload`,{state:{datasetInfo:{dataset_repo_id:o,source:l??`local`}}}),className:`h-9 gap-1.5 border-gray-800 bg-gray-950 text-xs text-gray-300 hover:bg-gray-900`,children:[(0,B.jsx)(Qs,{className:`h-3.5 w-3.5`}),`Upload`]})]})]}),!o&&(0,B.jsxs)(`div`,{className:`rounded-lg border border-gray-800 bg-gray-950 p-10 text-center`,children:[(0,B.jsx)(ws,{className:`mx-auto mb-3 h-8 w-8 text-gray-700`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-400`,children:`Select a dataset to browse its episodes.`}),!i&&a.length===0&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-gray-600`,children:`No datasets in the local LeRobot cache. Record one, or download it from the Hub first.`})]}),o&&d&&(0,B.jsxs)(`div`,{className:`flex items-center justify-center gap-2 rounded-lg border border-gray-800 bg-gray-950 p-10 text-sm text-gray-500`,children:[(0,B.jsx)(Ns,{className:`h-4 w-4 animate-spin`}),`Reading dataset…`]}),o&&f&&(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-red-900/50 bg-red-950/30 p-4`,children:[(0,B.jsx)(hs,{className:`mt-0.5 h-4 w-4 flex-none text-red-400`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-red-300`,children:`Could not read this dataset`}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs text-red-400/80`,children:f})]})]}),o&&u?.success&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-5 gap-y-1 rounded-lg border border-gray-800 bg-gray-950 px-4 py-2.5 text-xs`,children:[(0,B.jsx)(Z9,{label:`Episodes`,value:String(u.total_episodes)}),(0,B.jsx)(Z9,{label:`Frames`,value:u.total_frames?.toLocaleString()??`—`}),(0,B.jsx)(Z9,{label:`FPS`,value:String(u.fps??`—`)}),(0,B.jsx)(Z9,{label:`Robot`,value:u.robot_type??`—`}),(0,B.jsx)(Z9,{label:`Cameras`,value:u.cameras.join(`, `)||`—`}),p&&(0,B.jsx)(Z9,{label:`This episode`,value:X9(p.duration_s)})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-[260px_1fr]`,children:[(0,B.jsx)(bse,{episodes:u.episodes,selected:c,onSelect:y}),(0,B.jsxs)(`div`,{children:[m&&!p&&(0,B.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 rounded-lg border border-gray-800 bg-gray-950 text-sm text-gray-500`,children:[(0,B.jsx)(Ns,{className:`h-4 w-4 animate-spin`}),`Loading episode…`]}),h&&(0,B.jsx)(`div`,{className:`rounded-lg border border-red-900/50 bg-red-950/30 p-4 text-xs text-red-400`,children:h}),p&&(0,B.jsx)(Tse,{repoId:o,detail:p,onNavigate:y})]})]})]})]})})},kse=()=>{let e=ft(),t=ht(),{toast:n}=ea(),{baseUrl:r,fetchWithHeaders:i}=wl(),a=e.state?.datasetInfo,[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!0),[u,d]=(0,_.useState)({tags:[`robotics`,`lerobot`],private:!1}),[f,p]=(0,_.useState)(u.tags.join(`, `)),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1);_.useEffect(()=>{(async()=>{if(!a?.dataset_repo_id){n({title:`No Dataset Information`,description:`Please complete a recording session first.`,variant:`destructive`}),t(`/`);return}try{let e=await i(`${r}/dataset-info`,{method:`POST`,body:JSON.stringify({dataset_repo_id:a.dataset_repo_id})}),t=await e.json();e.ok&&t.success?s({...t,saved_episodes:t.num_episodes,session_elapsed_seconds:a.session_elapsed_seconds||0,source:a.source}):(n({title:`Warning`,description:`Could not load complete dataset information. Using session data.`,variant:`destructive`}),s(a))}catch(e){console.error(`Error loading dataset info:`,e),n({title:`Warning`,description:`Could not connect to backend. Using session data.`,variant:`destructive`}),s(a)}finally{l(!1)}})()},[a,t,n]);let C=e=>{let t=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,n=`https://huggingface.co/login?next=${encodeURIComponent(t)}`;window.open(n,`_blank`,`noopener,noreferrer`)},w=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}h ${n}m ${r}s`:n>0?`${n}m ${r}s`:`${r}s`},T=async()=>{if(o){h(!0);try{let e=f.split(`,`).map(e=>e.trim()).filter(e=>e.length>0),t=await i(`${r}/upload-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id,tags:e,private:u.private})}),a=await t.json();if(t.ok&&a.success)v(!0),n({title:`Upload Successful!`,description:`Dataset ${o.dataset_repo_id} has been uploaded to HuggingFace Hub.`});else{let e=`Failed to upload dataset to HuggingFace Hub.`;n({title:`Upload Failed`,description:a.docs_url?(0,B.jsxs)(`span`,{children:[a.message||e,` `,(0,B.jsx)(`a`,{href:a.docs_url,target:`_blank`,rel:`noopener noreferrer`,className:`underline font-medium`,children:`Open setup guide`})]}):a.message||e,variant:`destructive`})}}catch(e){console.error(`Error uploading dataset:`,e),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{h(!1)}}},E=()=>{n({title:`Upload Skipped`,description:`Dataset saved locally. You can upload it manually later.`}),t(`/`)},D=async()=>{if(o){S(!0);try{let e=await i(`${r}/delete-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id})}),a=await e.json();e.ok&&a.success?(n({title:`Dataset Deleted`,description:`${o.dataset_repo_id} has been removed from disk.`}),t(`/`)):n({title:`Delete Failed`,description:a.message||`Could not delete the dataset.`,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{S(!1),b(!1)}}};if(c||!o)return(0,B.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto mb-4`}),(0,B.jsx)(`p`,{className:`text-lg`,children:`Loading dataset information...`})]})});let O=o.source===`both`;return(0,B.jsxs)(`div`,{className:`min-h-screen bg-black text-white p-8`,children:[(0,B.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(q,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,B.jsx)(os,{className:`w-4 h-4 mr-2`}),`Back to Home`]}),(0,B.jsx)(q,{onClick:()=>b(!0),variant:`outline`,size:`icon`,disabled:x,"aria-label":`Delete dataset from disk`,className:`border-red-500/40 text-red-400 hover:border-red-400 hover:text-red-300 hover:bg-red-500/10`,children:(0,B.jsx)(Xs,{className:`w-4 h-4`})})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g?(0,B.jsx)(gs,{className:`w-8 h-8 text-green-500`}):(0,B.jsx)(ws,{className:`w-8 h-8 text-blue-500`}),(0,B.jsx)(`h1`,{className:`text-3xl font-bold`,children:g?`Upload Complete`:`Dataset Upload`})]})]}),g&&(0,B.jsxs)(`div`,{className:`bg-green-900/20 border border-green-600 rounded-lg p-6 mb-8`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,B.jsx)(gs,{className:`w-6 h-6 text-green-500`}),(0,B.jsx)(`h2`,{className:`text-xl font-semibold text-green-400`,children:`Successfully Uploaded!`})]}),(0,B.jsx)(`p`,{className:`text-gray-300 mb-4`,children:`Your dataset has been uploaded to HuggingFace Hub and is now available for training and sharing.`}),(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[(0,B.jsxs)(q,{onClick:()=>{let e=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${o.dataset_repo_id}`)}`,t=u.private?`https://huggingface.co/login?next=${encodeURIComponent(e)}`:`https://huggingface.co${e}`;window.open(t,`_blank`,`noopener,noreferrer`)},className:`bg-blue-500 hover:bg-blue-600 text-white`,children:[(0,B.jsx)(Ds,{className:`w-4 h-4 mr-2`}),`View on HuggingFace Hub`]}),(0,B.jsx)(q,{onClick:()=>t(`/training`,{state:{datasetRepoId:o.dataset_repo_id}}),className:`bg-purple-500 hover:bg-purple-600 text-white`,children:`Start Training`})]})]}),!g&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-4`,children:`Dataset Summary`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-400`,children:`Repository ID:`}),(0,B.jsx)(`p`,{className:`text-white font-mono text-lg`,children:o.dataset_repo_id})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-400`,children:`Task:`}),(0,B.jsx)(`p`,{className:`text-white`,children:o.single_task})]})]}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-400`,children:`Episodes Recorded:`}),(0,B.jsx)(`p`,{className:`text-white text-2xl font-bold text-green-400`,children:o.saved_episodes||o.num_episodes}),o.total_frames&&(0,B.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.total_frames,` total frames`]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-400`,children:`Session Duration:`}),(0,B.jsx)(`p`,{className:`text-white`,children:w(o.session_elapsed_seconds||0)}),o.fps&&(0,B.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.fps,` FPS`]})]})]})]})]}),!O&&(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-6`,children:`Upload Configuration`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`tags`,className:`text-gray-300 mb-2 block`,children:`Tags (comma-separated)`}),(0,B.jsx)(J_,{id:`tags`,value:f,onChange:e=>p(e.target.value),placeholder:`robotics, lerobot, manipulation`,className:`bg-gray-800 border-gray-600 text-white`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:`Tags help others discover your dataset on HuggingFace Hub`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(_v,{id:`private`,checked:u.private,onCheckedChange:e=>d({...u,private:e})}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u.private?(0,B.jsx)(Os,{className:`w-4 h-4 text-gray-400`}):(0,B.jsx)(ks,{className:`w-4 h-4 text-gray-400`}),(0,B.jsx)(J,{htmlFor:`private`,className:`text-gray-300`,children:`Make dataset private`})]})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500 ml-6`,children:u.private?`Only you will be able to access this dataset`:`Dataset will be publicly accessible on HuggingFace Hub`})]})]}),(0,B.jsx)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center`,children:O?(0,B.jsxs)(q,{onClick:()=>C(o.dataset_repo_id),className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:[(0,B.jsx)(Ds,{className:`w-5 h-5 mr-2`}),`View on Hugging Face Hub`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(q,{onClick:T,disabled:m,className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:m?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ns,{className:`w-5 h-5 mr-2 animate-spin`}),`Uploading to Hub...`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qs,{className:`w-5 h-5 mr-2`}),`Upload to HuggingFace Hub`]})}),(0,B.jsx)(q,{onClick:E,disabled:m,variant:`outline`,className:`border-gray-600 text-gray-300 hover:bg-gray-800 hover:text-white py-4 px-8 text-lg`,children:`Skip Upload`})]})}),!O&&(0,B.jsx)(`div`,{className:`mt-8 p-4 bg-blue-900/20 border border-blue-600 rounded-lg`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(hs,{className:`w-5 h-5 text-blue-400 mt-0.5`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold text-blue-400 mb-2`,children:`About HuggingFace Hub Upload`}),(0,B.jsxs)(`ul`,{className:`text-sm text-gray-300 space-y-1`,children:[(0,B.jsx)(`li`,{children:`• Your dataset will be uploaded to HuggingFace Hub for sharing and collaboration`}),(0,B.jsx)(`li`,{children:`• You need to be logged in to HuggingFace CLI on the server`}),(0,B.jsx)(`li`,{children:`• Uploaded datasets can be used for training models and sharing with the community`}),(0,B.jsx)(`li`,{children:`• You can always upload manually later using the HuggingFace CLI`})]})]})]})})]})]}),(0,B.jsx)(tL,{open:y,onOpenChange:b,children:(0,B.jsxs)(rL,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,B.jsxs)(iL,{children:[(0,B.jsx)(oL,{children:`Delete dataset from disk?`}),(0,B.jsxs)(sL,{className:`text-gray-400`,children:[`This permanently removes `,(0,B.jsx)(`span`,{className:`font-mono text-white`,children:o.dataset_repo_id}),` from your local cache. This action cannot be undone.`]})]}),(0,B.jsxs)(aL,{children:[(0,B.jsx)(lL,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep dataset`}),(0,B.jsx)(cL,{onClick:D,disabled:x,className:`bg-red-500 hover:bg-red-600 text-white`,children:x?`Deleting…`:`Delete`})]})]})})]})},Ase=()=>{let e=ft();return(0,_.useEffect)(()=>{console.error(`404 Error: User attempted to access non-existent route:`,e.pathname)},[e.pathname]),(0,B.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-100`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`h1`,{className:`text-4xl font-bold mb-4`,children:`404`}),(0,B.jsx)(`p`,{className:`text-xl text-gray-600 mb-4`,children:`Oops! Page not found`}),(0,B.jsx)(`a`,{href:`/`,className:`text-blue-500 hover:text-blue-700 underline`,children:`Return to Home`})]})})},jse=`lelab-tabs-v1`,Mse=1e3,Nse=3e3,Pse=({children:e})=>{let[t,n]=(0,_.useState)(!0),r=(0,_.useRef)(new Map),i=(0,_.useRef)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(null),s=(0,_.useCallback)(()=>{let e=r.current,t=Date.now()-Nse;for(let[n,r]of e)r.lastSeen{if(typeof window>`u`||typeof BroadcastChannel>`u`)return;i.current=crypto.randomUUID(),a.current=Date.now();let e=new BroadcastChannel(jse);o.current=e;let t=t=>{e.postMessage({type:t,id:i.current,openedAt:a.current})};e.onmessage=e=>{let t=e.data;if(!t||t.id===i.current)return;let n=r.current;t.type===`HEARTBEAT`?n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}):t.type===`RELEASE`?n.delete(t.id):t.type===`TAKEOVER`&&(n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}),a.current<=t.openedAt&&(a.current=t.openedAt+1)),s()},t(`HEARTBEAT`);let n=setInterval(()=>{t(`HEARTBEAT`),s()},Mse),c=()=>t(`RELEASE`);return window.addEventListener(`beforeunload`,c),()=>{window.removeEventListener(`beforeunload`,c),clearInterval(n),t(`RELEASE`),e.close(),o.current=null}},[s]);let c=(0,_.useCallback)(()=>{a.current=0,o.current?.postMessage({type:`TAKEOVER`,id:i.current,openedAt:0}),s()},[s]);return(0,B.jsxs)(B.Fragment,{children:[t&&e,!t&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,children:(0,B.jsxs)(`div`,{className:`mx-4 max-w-md space-y-4 rounded-lg border bg-background p-6 text-center shadow-lg`,children:[(0,B.jsx)(`h2`,{className:`text-lg font-semibold`,children:`LeLab is already open in another tab`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Only one tab can control the robot at a time. Switch back to the original tab, or take over here — the other tab will lock.`}),(0,B.jsx)(q,{onClick:c,children:`Use this tab`})]})})]})},Q9=`lelab:teleop-stopped`,Fse=()=>{let{toast:e}=ea();return(0,_.useEffect)(()=>{let t=!1;try{t=sessionStorage.getItem(Q9)===`1`,t&&sessionStorage.removeItem(Q9)}catch{}t&&e({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly when you left the page.`})},[e]),null},$9=`lelab:update-dismissed-sha`;function Ise(){let{baseUrl:e,fetchWithHeaders:t}=wl(),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(Df())return;let n=!1;return t(`${e}/system/update-check`).then(e=>e.ok?e.json():null).then(e=>{if(n||!e||!e.update_available)return;let t=null;try{t=localStorage.getItem($9)}catch{}t&&t===e.latest_commit||(r(e),a(!0))}).catch(()=>{}),()=>{n=!0}},[e,t]),{status:n,open:i,dismiss:(0,_.useCallback)(e=>{if(e&&n?.latest_commit)try{localStorage.setItem($9,n.latest_commit)}catch{}a(!1)},[n])}}var Lse=()=>{let{status:e,open:t,dismiss:n}=Ise(),{baseUrl:r,fetchWithHeaders:i}=wl(),{toast:a}=ea(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null);if(!e)return null;let f=typeof e.commits_behind==`number`&&e.commits_behind>0?`${e.commits_behind} commit${e.commits_behind===1?``:`s`} behind`:`A new version is available`;return(0,B.jsx)(lf,{open:t,onOpenChange:e=>{!e&&!c&&n(o)},children:(0,B.jsxs)(ff,{className:`bg-slate-800 border-slate-700 text-white max-w-lg`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,B.jsxs)(pf,{children:[(0,B.jsxs)(hf,{className:`flex items-center gap-3 text-white`,children:[(0,B.jsx)(qs,{className:`w-5 h-5 text-amber-400`}),`LeLab update available`]}),(0,B.jsxs)(gf,{className:`text-slate-300`,children:[`You're `,f,` 😱.`,(0,B.jsx)(`br`,{}),`Update to get the latest fixes and features 🤗.`,e.compare_url&&(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsx)(`a`,{href:e.compare_url,target:`_blank`,rel:`noreferrer`,className:`text-sky-300 underline hover:text-sky-200`,children:`See what changed`}),`.`]})]})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(kv,{children:[(0,B.jsxs)(Av,{className:`group flex items-center gap-1.5 text-xs font-medium text-slate-300 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Or update manually`]}),(0,B.jsx)(jv,{className:`pt-2`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(`code`,{className:`min-w-0 flex-1 px-2 py-1.5 rounded bg-slate-900 text-sky-300 text-xs break-all whitespace-pre-wrap`,children:e.update_command}),(0,B.jsx)(q,{variant:`outline`,size:`icon`,onClick:async()=>{if(e.update_command)try{await navigator.clipboard.writeText(e.update_command),a({title:`Copied`,description:`Update command copied to clipboard.`})}catch{a({title:`Copy failed`,description:`Select and copy the command manually.`,variant:`destructive`})}},title:`Copy command`,className:`shrink-0 bg-slate-900 border-slate-600 text-white hover:bg-slate-700`,children:(0,B.jsx)(Cs,{className:`w-4 h-4`})})]})})]}),u&&(0,B.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded bg-slate-900 p-2 text-xs text-slate-300 whitespace-pre-wrap`,children:u}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,B.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,B.jsx)(_v,{checked:o,onCheckedChange:e=>s(e===!0),className:`border-slate-300 data-[state=checked]:bg-slate-300 data-[state=checked]:text-slate-900`}),`Don't ask me again`]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(q,{variant:`ghost`,onClick:()=>n(o),disabled:c,className:`text-slate-300 hover:bg-slate-700 hover:text-white`,children:`Later`}),e.can_auto_update&&(0,B.jsx)(q,{onClick:async()=>{l(!0),d(null);try{let e=await(await i(`${r}/system/update`,{method:`POST`})).json();e.success?(a({title:`Updated`,description:e.message}),n(!1)):(d(e.output||e.message),a({title:`Update failed`,description:e.message,variant:`destructive`}))}catch(e){a({title:`Update failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{l(!1)}},disabled:c,children:c?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ns,{className:`w-4 h-4 mr-2 animate-spin`}),`Updating…`]}):`Update now`})]})]})]})]})})},Rse=new Zr;function zse(){return(0,B.jsx)(ei,{client:Rse,children:(0,B.jsx)(Eh,{children:(0,B.jsx)(ni,{children:(0,B.jsx)(Cl,{children:(0,B.jsx)(El,{children:(0,B.jsx)(zi,{children:(0,B.jsx)(Hi,{children:(0,B.jsxs)(Mn,{children:[(0,B.jsx)(Pse,{children:(0,B.jsxs)(Hf,{children:[(0,B.jsx)(Fse,{}),(0,B.jsx)(Lse,{}),(0,B.jsxs)(Ht,{children:[(0,B.jsx)(z,{path:`/`,element:(0,B.jsx)(Zb,{})}),(0,B.jsx)(z,{path:`/teleoperation`,element:(0,B.jsx)(_N,{})}),(0,B.jsx)(z,{path:`/recording`,element:(0,B.jsx)(ore,{})}),(0,B.jsx)(z,{path:`/upload`,element:(0,B.jsx)(kse,{})}),(0,B.jsx)(z,{path:`/training`,element:(0,B.jsx)(K9,{})}),(0,B.jsx)(z,{path:`/training/:jobId`,element:(0,B.jsx)(K9,{})}),(0,B.jsx)(z,{path:`/inference`,element:(0,B.jsx)(hse,{})}),(0,B.jsx)(z,{path:`/calibration`,element:(0,B.jsx)(FN,{})}),(0,B.jsx)(z,{path:`/edit-dataset`,element:(0,B.jsx)(Ose,{})}),(0,B.jsx)(z,{path:`*`,element:(0,B.jsx)(Ase,{})})]})]})}),(0,B.jsx)(al,{})]})})})})})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,B.jsx)(zse,{})); \ No newline at end of file + A ${p},${p},0,0,${c},${e},${t+r-o*p} Z`}else l=`M ${e},${t} h ${n} v ${r} h ${-n} Z`;return l},n6=function(e,t){if(!e||!t)return!1;var n=e.x,r=e.y,i=t.x,a=t.y,o=t.width,s=t.height;if(Math.abs(o)>0&&Math.abs(s)>0){var c=Math.min(i,i+o),l=Math.max(i,i+o),u=Math.min(a,a+s),d=Math.max(a,a+s);return n>=c&&n<=l&&r>=u&&r<=d}return!1},r6={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},i6=function(e){var t=Z3(Z3({},r6),e),n=(0,_.useRef)(),r=W3((0,_.useState)(-1),2),i=r[0],a=r[1];(0,_.useEffect)(function(){if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&a(e)}catch{}},[]);var o=t.x,s=t.y,c=t.width,l=t.height,u=t.radius,d=t.className,f=t.animationEasing,p=t.animationDuration,m=t.animationBegin,h=t.isAnimationActive,g=t.isUpdateAnimationActive;if(o!==+o||s!==+s||c!==+c||l!==+l||c===0||l===0)return null;var v=Zo(`recharts-rectangle`,d);return g?_.createElement(V3,{canBegin:i>0,from:{width:c,height:l,x:o,y:s},to:{width:c,height:l,x:o,y:s},duration:p,animationEasing:f,isActive:g},function(e){var r=e.width,a=e.height,o=e.x,s=e.y;return _.createElement(V3,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,isActive:h,easing:f},_.createElement(`path`,U3({},ez(t,!0),{className:v,d:t6(o,s,r,a,u),ref:n})))}):_.createElement(`path`,U3({},ez(t,!0),{className:v,d:t6(o,s,c,l,u)}))};function a6(){return a6=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function g6(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var _6=function(e,t,n,r,i,a){return`M${e},${i}v${r}M${a},${t}h${n}`},v6=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.top,o=a===void 0?0:a,s=e.left,c=s===void 0?0:s,l=e.width,u=l===void 0?0:l,d=e.height,f=d===void 0?0:d,p=e.className,m=h6(e,c6),h=d6({x:n,y:i,top:o,left:c,width:u,height:f},m);return!Q(n)||!Q(i)||!Q(u)||!Q(f)||!Q(o)||!Q(c)?null:_.createElement(`path`,l6({},ez(h,!0),{className:Zo(`recharts-cross`,p),d:_6(n,i,u,f,o,c)}))},y6=o(((e,t)=>{t.exports=fH()(Object.getPrototypeOf,Object)})),b6=o(((e,t)=>{var n=SL(),r=y6(),i=CL(),a=`[object Object]`,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=c.call(Object);function d(e){if(!i(e)||n(e)!=a)return!1;var t=r(e);if(t===null)return!0;var o=l.call(t,`constructor`)&&t.constructor;return typeof o==`function`&&o instanceof o&&c.call(o)==u}t.exports=d})),x6=o(((e,t)=>{var n=SL(),r=CL(),i=`[object Boolean]`;function a(e){return e===!0||e===!1||r(e)&&n(e)==i}t.exports=a}));function S6(e){"@babel/helpers - typeof";return S6=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},S6(e)}function C6(){return C6=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:u,x:o,y:s},to:{upperWidth:c,lowerWidth:l,height:u,x:o,y:s},duration:p,animationEasing:f,isActive:h},function(e){var r=e.upperWidth,a=e.lowerWidth,o=e.height,s=e.x,c=e.y;return _.createElement(V3,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,easing:f},_.createElement(`path`,C6({},ez(t,!0),{className:g,d:F6(s,c,r,a,o),ref:n})))}):_.createElement(`g`,null,_.createElement(`path`,C6({},ez(t,!0),{className:g,d:F6(o,s,c,l,u)})))},R6=l(b6()),z6=l(x6()),B6=[`option`,`shapeType`,`propTransformer`,`activeClassName`,`isActive`];function V6(e){"@babel/helpers - typeof";return V6=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},V6(e)}function H6(e,t){if(e==null)return{};var n=U6(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function U6(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function W6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G6(e){for(var t=1;t{var n=Math.ceil,r=Math.max;function i(e,t,i,a){for(var o=-1,s=r(n((t-e)/(i||1)),0),c=Array(s);s--;)c[a?s:++o]=e,e+=i;return c}t.exports=i})),d8=o(((e,t)=>{var n=eG(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),f8=o(((e,t)=>{var n=u8(),r=BU(),i=d8();function a(e){return function(t,a,o){return o&&typeof o!=`number`&&r(t,a,o)&&(a=o=void 0),t=i(t),a===void 0?(a=t,t=0):a=i(a),o=o===void 0?t{t.exports=f8()()}));function m8(e){"@babel/helpers - typeof";return m8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},m8(e)}function h8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function g8(e){for(var t=1;t0&&n.handleDrag(e.changedTouches[0])}),j8(n,`handleDragEnd`,function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var e=n.props,t=e.endIndex,r=e.onDragEnd,i=e.startIndex;r?.({endIndex:t,startIndex:i})}),n.detachDragEndListener()}),j8(n,`handleLeaveWrapper`,function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),j8(n,`handleEnterSlideOrTraveller`,function(){n.setState({isTextActive:!0})}),j8(n,`handleLeaveSlideOrTraveller`,function(){n.setState({isTextActive:!1})}),j8(n,`handleSlideDragStart`,function(e){var t=N8(e)?e.changedTouches[0]:e;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:t.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,`startX`),endX:n.handleTravellerDragStart.bind(n,`endX`)},n.state={},n}return Ure(t,e),zre(t,[{key:`componentWillUnmount`,value:function(){this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.detachDragEndListener()}},{key:`getIndex`,value:function(e){var n=e.startX,r=e.endX,i=this.state.scaleValues,a=this.props,o=a.gap,s=a.data.length-1,c=Math.min(n,r),l=Math.max(n,r),u=t.getIndexInRange(i,c),d=t.getIndexInRange(i,l);return{startIndex:u-u%o,endIndex:d===s?s:d-d%o}}},{key:`getTextOfTick`,value:function(e){var t=this.props,n=t.data,r=t.tickFormatter,i=t.dataKey,a=K$(n[e],i,e);return(0,FR.default)(r)?r(a,e):a}},{key:`attachDragEndListener`,value:function(){window.addEventListener(`mouseup`,this.handleDragEnd,!0),window.addEventListener(`touchend`,this.handleDragEnd,!0),window.addEventListener(`mousemove`,this.handleDrag,!0)}},{key:`detachDragEndListener`,value:function(){window.removeEventListener(`mouseup`,this.handleDragEnd,!0),window.removeEventListener(`touchend`,this.handleDragEnd,!0),window.removeEventListener(`mousemove`,this.handleDrag,!0)}},{key:`handleSlideDrag`,value:function(e){var t=this.state,n=t.slideMoveStartX,r=t.startX,i=t.endX,a=this.props,o=a.x,s=a.width,c=a.travellerWidth,l=a.startIndex,u=a.endIndex,d=a.onChange,f=e.pageX-n;f>0?f=Math.min(f,o+s-c-i,o+s-c-r):f<0&&(f=Math.max(f,o-r,o-i));var p=this.getIndex({startX:r+f,endX:i+f});(p.startIndex!==l||p.endIndex!==u)&&d&&d(p),this.setState({startX:r+f,endX:i+f,slideMoveStartX:e.pageX})}},{key:`handleTravellerDragStart`,value:function(e,t){var n=N8(t)?t.changedTouches[0]:t;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:e,brushMoveStartX:n.pageX}),this.attachDragEndListener()}},{key:`handleTravellerMove`,value:function(e){var t=this.state,n=t.brushMoveStartX,r=t.movingTravellerId,i=t.endX,a=t.startX,o=this.state[r],s=this.props,c=s.x,l=s.width,u=s.travellerWidth,d=s.onChange,f=s.gap,p=s.data,m={startX:this.state.startX,endX:this.state.endX},h=e.pageX-n;h>0?h=Math.min(h,c+l-u-o):h<0&&(h=Math.max(h,c-o)),m[r]=o+h;var g=this.getIndex(m),_=g.startIndex,v=g.endIndex,y=function(){var e=p.length-1;return r===`startX`&&(i>a?_%f===0:v%f===0)||ia?v%f===0:_%f===0)||i>a&&v===e};this.setState(j8(j8({},r,o+h),`brushMoveStartX`,e.pageX),function(){d&&y()&&d(g)})}},{key:`handleTravellerMoveKeyboard`,value:function(e,t){var n=this,r=this.state,i=r.scaleValues,a=r.startX,o=r.endX,s=this.state[t],c=i.indexOf(s);if(c!==-1){var l=c+e;if(!(l===-1||l>=i.length)){var u=i[l];t===`startX`&&u>=o||t===`endX`&&u<=a||this.setState(j8({},t,u),function(){n.props.onChange(n.getIndex({startX:n.state.startX,endX:n.state.endX}))})}}}},{key:`renderBackground`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.fill,o=e.stroke;return _.createElement(`rect`,{stroke:o,fill:a,x:t,y:n,width:r,height:i})}},{key:`renderPanorama`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.data,o=e.children,s=e.padding,c=_.Children.only(o);return c?_.cloneElement(c,{x:t,y:n,width:r,height:i,margin:s,compact:!0,data:a}):null}},{key:`renderTravellerLayer`,value:function(e,n){var r=this,i=this.props,a=i.y,o=i.travellerWidth,s=i.height,c=i.traveller,l=i.ariaLabel,u=i.data,d=i.startIndex,f=i.endIndex,p=Math.max(e,this.props.x),m=E8(E8({},ez(this.props,!1)),{},{x:p,y:a,width:o,height:s}),h=l||`Min value: ${u[d]?.name}, Max value: ${u[f]?.name}`;return _.createElement(hz,{tabIndex:0,role:`slider`,"aria-label":h,"aria-valuenow":e,className:`recharts-brush-traveller`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[n],onTouchStart:this.travellerDragStartHandlers[n],onKeyDown:function(e){[`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),r.handleTravellerMoveKeyboard(e.key===`ArrowRight`?1:-1,n))},onFocus:function(){r.setState({isTravellerFocused:!0})},onBlur:function(){r.setState({isTravellerFocused:!1})},style:{cursor:`col-resize`}},t.renderTraveller(c,m))}},{key:`renderSlide`,value:function(e,t){var n=this.props,r=n.y,i=n.height,a=n.stroke,o=n.travellerWidth,s=Math.min(e,t)+o,c=Math.max(Math.abs(t-e)-o,0);return _.createElement(`rect`,{className:`recharts-brush-slide`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:`move`},stroke:`none`,fill:a,fillOpacity:.2,x:s,y:r,width:c,height:i})}},{key:`renderText`,value:function(){var e=this.props,t=e.startIndex,n=e.endIndex,r=e.y,i=e.height,a=e.travellerWidth,o=e.stroke,s=this.state,c=s.startX,l=s.endX,u=5,d={pointerEvents:`none`,fill:o};return _.createElement(hz,{className:`recharts-brush-texts`},_.createElement(bK,w8({textAnchor:`end`,verticalAnchor:`middle`,x:Math.min(c,l)-u,y:r+i/2},d),this.getTextOfTick(t)),_.createElement(bK,w8({textAnchor:`start`,verticalAnchor:`middle`,x:Math.max(c,l)+a+u,y:r+i/2},d),this.getTextOfTick(n)))}},{key:`render`,value:function(){var e=this.props,t=e.data,n=e.className,r=e.children,i=e.x,a=e.y,o=e.width,s=e.height,c=e.alwaysShowText,l=this.state,u=l.startX,d=l.endX,f=l.isTextActive,p=l.isSlideMoving,m=l.isTravellerMoving,h=l.isTravellerFocused;if(!t||!t.length||!Q(i)||!Q(a)||!Q(o)||!Q(s)||o<=0||s<=0)return null;var g=Zo(`recharts-brush`,n),v=_.Children.count(r)===1,y=x8(`userSelect`,`none`);return _.createElement(hz,{className:g,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:y},this.renderBackground(),v&&this.renderPanorama(),this.renderSlide(u,d),this.renderTravellerLayer(u,`startX`),this.renderTravellerLayer(d,`endX`),(f||p||m||h||c)&&this.renderText())}}],[{key:`renderDefaultTraveller`,value:function(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.stroke,o=Math.floor(n+i/2)-1;return _.createElement(_.Fragment,null,_.createElement(`rect`,{x:t,y:n,width:r,height:i,fill:a,stroke:`none`}),_.createElement(`line`,{x1:t+1,y1:o,x2:t+r-1,y2:o,fill:`none`,stroke:`#fff`}),_.createElement(`line`,{x1:t+1,y1:o+2,x2:t+r-1,y2:o+2,fill:`none`,stroke:`#fff`}))}},{key:`renderTraveller`,value:function(e,n){return _.isValidElement(e)?_.cloneElement(e,n):(0,FR.default)(e)?e(n):t.renderDefaultTraveller(n)}},{key:`getDerivedStateFromProps`,value:function(e,t){var n=e.data,r=e.width,i=e.x,a=e.travellerWidth,o=e.updateId,s=e.startIndex,c=e.endIndex;if(n!==t.prevData||o!==t.prevUpdateId)return E8({prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r},n&&n.length?Gre({data:n,width:r,x:i,travellerWidth:a,startIndex:s,endIndex:c}):{scale:null,scaleValues:null});if(t.scale&&(r!==t.prevWidth||i!==t.prevX||a!==t.prevTravellerWidth)){t.scale.range([i,i+r-a]);var l=t.scale.domain().map(function(e){return t.scale(e)});return{prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r,startX:t.scale(e.startIndex),endX:t.scale(e.endIndex),scaleValues:l}}return null}},{key:`getIndexInRange`,value:function(e,t){for(var n=e.length,r=0,i=n-1;i-r>1;){var a=Math.floor((r+i)/2);e[a]>t?i=a:r=a}return t>=e[i]?i:r}}])}(_.PureComponent);j8(P8,`displayName`,`Brush`),j8(P8,`defaultProps`,{height:40,travellerWidth:5,gap:1,fill:`#fff`,stroke:`#666`,padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Kre=o(((e,t)=>{var n=EU();function r(e,t){var r;return n(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}t.exports=r})),qre=o(((e,t)=>{var n=VV(),r=zH(),i=Kre(),a=vL(),o=BU();function s(e,t,s){var c=a(e)?n:i;return s&&o(e,t,s)&&(t=void 0),c(e,r(t,3))}t.exports=s})),F8=function(e,t){var n=e.alwaysShow,r=e.ifOverflow;return n&&(r=`extendDomain`),r===t},Jre=o(((e,t)=>{var n=FU();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),Yre=o(((e,t)=>{var n=Jre(),r=wU(),i=zH();function a(e,t){var a={};return t=i(t,3),r(e,function(e,r,i){n(a,r,t(e,r,i))}),a}t.exports=a})),Xre=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{var n=EU();function r(e,t){var r=!0;return n(e,function(e,n,i){return r=!!t(e,n,i),r}),r}t.exports=r})),Qre=o(((e,t)=>{var n=Xre(),r=Zre(),i=zH(),a=vL(),o=BU();function s(e,t,s){var c=a(e)?n:r;return s&&o(e,t,s)&&(t=void 0),c(e,i(t,3))}t.exports=s})),$re=[`x`,`y`];function I8(e){"@babel/helpers - typeof";return I8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},I8(e)}function L8(){return L8=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function iie(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function aie(e,t){var n=e.x,r=e.y,i=rie(e,$re),a=`${n}`,o=parseInt(a,10),s=`${r}`,c=parseInt(s,10),l=`${t.height||i.height}`,u=parseInt(l,10),d=`${t.width||i.width}`,f=parseInt(d,10);return z8(z8(z8(z8(z8({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:f,name:t.name,radius:t.radius})}function B8(e){return _.createElement($6,L8({shapeType:`rectangle`,propTransformer:aie,activeClassName:`recharts-active-bar`},e))}var oie=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,r){if(typeof e==`number`)return e;var i=Q(n)||mR(n);return i?e(n,r):(!i&&ZQ(!1),t)}},sie=[`value`,`background`],V8;function H8(e){"@babel/helpers - typeof";return H8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},H8(e)}function cie(e,t){if(e==null)return{};var n=lie(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function lie(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function U8(){return U8=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(g)0&&Math.abs(h)0&&(w=Math.min((e||0)-(T[t-1]||0),w))}),Number.isFinite(w)){var E=w/C,D=c.layout===`vertical`?n.height:n.width;if(c.padding===`gap`&&(v=E*D/2),c.padding===`no-gap`){var O=vR(e.barCategoryGap,E*D),k=E*D/2;v=k-O-(k-O)/D*O}}}y=r===`xAxis`?[n.left+(m.left||0)+(v||0),n.left+n.width-(m.right||0)-(v||0)]:r===`yAxis`?s===`horizontal`?[n.top+n.height-(m.bottom||0),n.top+(m.top||0)]:[n.top+(m.top||0)+(v||0),n.top+n.height-(m.bottom||0)-(v||0)]:c.range,g&&(y=[y[1],y[0]]);var A=s1(c,i,d),j=A.scale,M=A.realScaleType;j.domain(f).range(y),l1(j);var N=h1(j,n5(n5({},c),{},{realScaleType:M}));r===`xAxis`?(S=l===`top`&&!h||l===`bottom`&&h,b=n.left,x=u[_]-S*c.height):r===`yAxis`&&(S=l===`left`&&!h||l===`right`&&h,b=u[_]-S*c.width,x=n.top);var P=n5(n5(n5({},c),N),{},{realScaleType:M,x:b,y:x,scale:j,width:r===`xAxis`?n.width:c.width,height:r===`yAxis`?n.height:c.height});return P.bandSize=T1(P,N),!c.hide&&r===`xAxis`?u[_]+=(S?-1:1)*P.height:c.hide||(u[_]+=(S?-1:1)*P.width),n5(n5({},a),{},r5({},o,P))},{})},o5=function(e,t){var n=e.x,r=e.y,i=t.x,a=t.y;return{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)}},Sie=function(e){var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return o5({x:t,y:n},{x:r,y:i})},s5=function(){function e(t){yie(this,e),this.scale=t}return bie(e,[{key:`domain`,get:function(){return this.scale.domain}},{key:`range`,get:function(){return this.scale.range}},{key:`rangeMin`,get:function(){return this.range()[0]}},{key:`rangeMax`,get:function(){return this.range()[1]}},{key:`bandwidth`,get:function(){return this.scale.bandwidth}},{key:`apply`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.bandAware,r=t.position;if(e!==void 0){if(r)switch(r){case`start`:return this.scale(e);case`middle`:var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+i;case`end`:var a=this.bandwidth?this.bandwidth():0;return this.scale(e)+a;default:return this.scale(e)}if(n){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+o}return this.scale(e)}}},{key:`isInRange`,value:function(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}],[{key:`create`,value:function(t){return new e(t)}}])}();r5(s5,`EPS`,1e-4);var c5=function(e){var t=Object.keys(e).reduce(function(t,n){return n5(n5({},t),{},r5({},n,s5.create(e[n])))},{});return n5(n5({},t),{},{apply:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.bandAware,i=n.position;return(0,_ie.default)(e,function(e,n){return t[n].apply(e,{bandAware:r,position:i})})},isInRange:function(e){return(0,vie.default)(e,function(e,n){return t[n].isInRange(e)})}})};function Cie(e){return(e%180+180)%180}var wie=function(e){var t=e.width,n=e.height,r=Cie(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{var n=zH(),r=hH(),i=gH();function a(e){return function(t,a,o){var s=Object(t);if(!r(t)){var c=n(a,3);t=i(t),a=function(e){return c(s[e],e,s)}}var l=e(t,a,o);return l>-1?s[c?t[l]:l]:void 0}}t.exports=a})),Eie=o(((e,t)=>{var n=d8();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),Die=o(((e,t)=>{var n=BH(),r=zH(),i=Eie(),a=Math.max;function o(e,t,o){var s=e==null?0:e.length;if(!s)return-1;var c=o==null?0:i(o);return c<0&&(c=a(s+c,0)),n(e,r(t,3),c)}t.exports=o})),Oie=o(((e,t)=>{t.exports=Tie()(Die())})),kie=(0,l(GL()).default)(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return[`l`,e.left,`t`,e.top,`w`,e.width,`h`,e.height].join(``)});Oie();var l5=(0,_.createContext)(void 0),u5=(0,_.createContext)(void 0),d5=(0,_.createContext)(void 0),Aie=(0,_.createContext)({}),f5=(0,_.createContext)(void 0),p5=(0,_.createContext)(0),m5=(0,_.createContext)(0),h5=function(e){var t=e.state,n=t.xAxisMap,r=t.yAxisMap,i=t.offset,a=e.clipPathId,o=e.children,s=e.width,c=e.height,l=kie(i);return _.createElement(l5.Provider,{value:n},_.createElement(u5.Provider,{value:r},_.createElement(Aie.Provider,{value:i},_.createElement(d5.Provider,{value:l},_.createElement(f5.Provider,{value:a},_.createElement(p5.Provider,{value:c},_.createElement(m5.Provider,{value:s},o)))))))},jie=function(){return(0,_.useContext)(f5)},g5=function(e){var t=(0,_.useContext)(l5);t??ZQ(!1);var n=t[e];return n??ZQ(!1),n},_5=function(e){var t=(0,_.useContext)(u5);t??ZQ(!1);var n=t[e];return n??ZQ(!1),n},Mie=function(){return(0,_.useContext)(d5)},v5=function(){return(0,_.useContext)(m5)},y5=function(){return(0,_.useContext)(p5)},Nie=l(qre());function b5(e){"@babel/helpers - typeof";return b5=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},b5(e)}function Pie(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function x5(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);ne*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function pae(e,t){return e7(e,t+1)}function mae(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:e7(r,l)};var a=c,d,f=function(){return d===void 0&&(d=n(t,a)),d},p=t.coordinate,m=c===0||t7(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function n7(e){"@babel/helpers - typeof";return n7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n7(e)}function r7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i7(e){for(var t=1;t0?r.coordinate-d*e:r.coordinate})}else a[t]=r=i7(i7({},r),{},{tickCoord:r.coordinate});t7(e,r.tickCoord,u,s,c)&&(c=r.tickCoord-e*(u()/2+i),a[t]=i7(i7({},r),{},{isShow:!0}))},u=o-1;u>=0;u--)l(u);return a}function yae(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,l=t.end;if(a){var u=r[s-1],d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=i7(i7({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),t7(e,u.tickCoord,function(){return d},c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=i7(i7({},u),{},{isShow:!0}))}for(var p=a?s-1:s,m=function(t){var r=o[t],a,s=function(){return a===void 0&&(a=n(r,t)),a};if(t===0){var u=e*(r.coordinate-e*s()/2-c);o[t]=r=i7(i7({},r),{},{tickCoord:u<0?r.coordinate-u*e:r.coordinate})}else o[t]=r=i7(i7({},r),{},{tickCoord:r.coordinate});t7(e,r.tickCoord,s,c,l)&&(c=r.tickCoord+e*(s()/2+i),o[t]=i7(i7({},r),{},{isShow:!0}))},h=0;h=2?fR(i[1].coordinate-i[0].coordinate):1,_=fae(a,g,p);return c===`equidistantPreserveStart`?mae(g,_,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?yae(g,_,h,i,o,c===`preserveStartEnd`):vae(g,_,h,i,o),f.filter(function(e){return e.isShow}))}var xae=[`viewBox`],Sae=[`viewBox`],Cae=[`ticks`];function a7(e){"@babel/helpers - typeof";return a7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a7(e)}function o7(){return o7=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Tae(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function u7(e,t){for(var n=0;n0?a(this.props):a(l)),r<=0||i<=0||!u||!u.length?null:_.createElement(hz,{className:Zo(`recharts-cartesian-axis`,o),ref:function(t){e.layerReference=t}},n&&this.renderAxisLine(),this.renderTicks(u,this.state.fontSize,this.state.letterSpacing),l0.renderCallByParent(this.props))}}],[{key:`renderTickItem`,value:function(e,t,n){var r,i=Zo(t.className,`recharts-cartesian-axis-tick-value`);return r=_.isValidElement(e)?_.cloneElement(e,c7(c7({},t),{},{className:i})):(0,FR.default)(e)?e(c7(c7({},t),{},{className:i})):_.createElement(bK,o7({},t,{className:`recharts-cartesian-axis-tick-value`}),n),r}}])}(_.Component);m7(g7,`displayName`,`CartesianAxis`),m7(g7,`defaultProps`,{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`});var Mae=[`type`,`layout`,`connectNulls`,`ref`],Nae=[`key`];function _7(e){"@babel/helpers - typeof";return _7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_7(e)}function v7(e,t){if(e==null)return{};var n=Pae(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Pae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function y7(){return y7=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ns){l=[].concat(S7(i.slice(0,u)),[s-d]);break}var f=l.length%2==0?[0,c]:[c];return[].concat(S7(t.repeat(i,o)),S7(l),f).map(function(e){return`${e}px`}).join(`, `)}),O7(e,`id`,_R(`recharts-line-`)),O7(e,`pathRef`,function(t){e.mainCurve=t}),O7(e,`handleAnimationEnd`,function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),O7(e,`handleAnimationStart`,function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return Wae(t,e),Bae(t,[{key:`componentDidMount`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:`componentDidUpdate`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:`getTotalLength`,value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}},{key:`renderErrorBar`,value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,r=n.points,i=n.xAxis,a=n.yAxis,o=n.layout,s=n.children,c=qR(s,S$);if(!c)return null;var l=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:K$(e.payload,t)}},u={clipPath:e?`url(#clipPath-${t})`:null};return _.createElement(hz,u,c.map(function(e){return _.cloneElement(e,{key:`bar-${e.props.dataKey}`,data:r,xAxis:i,yAxis:a,layout:o,dataPointFormatter:l})}))}},{key:`renderDots`,value:function(e,n,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,a=i.dot,o=i.points,s=i.dataKey,c=ez(this.props,!1),l=ez(a,!0),u=o.map(function(e,n){var r=x7(x7(x7({key:`dot-${n}`,r:3},c),l),{},{index:n,cx:e.x,cy:e.y,value:e.value,dataKey:s,payload:e.payload,points:o});return t.renderDotItem(a,r)}),d={clipPath:e?`url(#clipPath-${n?``:`dots-`}${r})`:null};return _.createElement(hz,y7({className:`recharts-line-dots`,key:`dots`},d),u)}},{key:`renderCurveStatically`,value:function(e,t,n,r){var i=this.props,a=i.type,o=i.layout,s=i.connectNulls;i.ref;var c=x7(x7(x7({},ez(v7(i,Mae),!0)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:t?`url(#clipPath-${n})`:null,points:e},r),{},{type:a,layout:o,connectNulls:s});return _.createElement(o2,y7({},c,{pathRef:this.pathRef}))}},{key:`renderCurveWithAnimation`,value:function(e,t){var n=this,r=this.props,i=r.points,a=r.strokeDasharray,o=r.isAnimationActive,s=r.animationBegin,c=r.animationDuration,l=r.animationEasing,u=r.animationId,d=r.animateNewValues,f=r.width,p=r.height,m=this.state,h=m.prevPoints,g=m.totalLength;return _.createElement(V3,{begin:s,duration:c,isActive:o,easing:l,from:{t:0},to:{t:1},key:`line-${u}`,onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o=r.t;if(h){var s=h.length/i.length,c=i.map(function(e,t){var n=Math.floor(t*s);if(h[n]){var r=h[n],i=xR(r.x,e.x),a=xR(r.y,e.y);return x7(x7({},e),{},{x:i(o),y:a(o)})}if(d){var c=xR(f*2,e.x),l=xR(p/2,e.y);return x7(x7({},e),{},{x:c(o),y:l(o)})}return x7(x7({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(c,e,t)}var l=xR(0,g)(o),u;if(a){var m=`${a}`.split(/[,\s]+/gim).map(function(e){return parseFloat(e)});u=n.getStrokeDasharray(l,g,m)}else u=n.generateSimpleStrokeDasharray(g,l);return n.renderCurveStatically(i,e,t,{strokeDasharray:u})})}},{key:`renderCurve`,value:function(e,t){var n=this.props,r=n.points,i=n.isAnimationActive,a=this.state,o=a.prevPoints,s=a.totalLength;return i&&r&&r.length&&(!o&&s>0||!(0,N$.default)(o,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxis,o=e.yAxis,s=e.top,c=e.left,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=Zo(`recharts-line`,i),g=a&&a.allowDataOverflow,v=o&&o.allowDataOverflow,y=g||v,b=(0,dR.default)(f)?this.id:f,x=ez(n,!1)??{r:3,strokeWidth:2},S=x.r,C=S===void 0?3:S,w=x.strokeWidth,T=w===void 0?2:w,E=(QR(n)?n:{}).clipDot,D=E===void 0?!0:E,O=C*2+T;return _.createElement(hz,{className:h},g||v?_.createElement(`defs`,null,_.createElement(`clipPath`,{id:`clipPath-${b}`},_.createElement(`rect`,{x:g?c:c-l/2,y:v?s:s-u/2,width:g?l:l*2,height:v?u:u*2})),!D&&_.createElement(`clipPath`,{id:`clipPath-dots-${b}`},_.createElement(`rect`,{x:c-O/2,y:s-O/2,width:l+O,height:u+O}))):null,!m&&this.renderCurve(y,b),this.renderErrorBar(y,b),(m||n)&&this.renderDots(y,D,b),(!d||p)&&j0.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points===t.curPoints?null:{curPoints:e.points}:{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}}},{key:`repeat`,value:function(e,t){for(var n=e.length%2==0?e:[].concat(S7(e),[0]),r=[],i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Jae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function P7(){return P7=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!(0,N$.default)(s,r)||!(0,N$.default)(c,i))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,i,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,o=e.left,s=e.xAxis,c=e.yAxis,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=Zo(`recharts-area`,i),g=s&&s.allowDataOverflow,v=c&&c.allowDataOverflow,y=g||v,b=(0,dR.default)(f)?this.id:f,x=ez(n,!1)??{r:3,strokeWidth:2},S=x.r,C=S===void 0?3:S,w=x.strokeWidth,T=w===void 0?2:w,E=(QR(n)?n:{}).clipDot,D=E===void 0?!0:E,O=C*2+T;return _.createElement(hz,{className:h},g||v?_.createElement(`defs`,null,_.createElement(`clipPath`,{id:`clipPath-${b}`},_.createElement(`rect`,{x:g?o:o-l/2,y:v?a:a-u/2,width:g?l:l*2,height:v?u:u*2})),!D&&_.createElement(`clipPath`,{id:`clipPath-dots-${b}`},_.createElement(`rect`,{x:o-O/2,y:a-O/2,width:l+O,height:u+O}))):null,m?null:this.renderArea(y,b),(n||m)&&this.renderDots(y,D,b),(!d||p)&&j0.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points!==t.curPoints||e.baseLine!==t.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null:{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:t.curPoints,prevBaseLine:t.curBaseLine}}}])}(_.PureComponent);j7=U7,V7(U7,`displayName`,`Area`),V7(U7,`defaultProps`,{stroke:`#3182bd`,fill:`#3182bd`,fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:`line`,connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!jW.isSsr,animationBegin:0,animationDuration:1500,animationEasing:`ease`}),V7(U7,`getBaseValue`,function(e,t,n,r){var i=e.layout,a=e.baseValue,o=t.props.baseValue??a;if(Q(o)&&typeof o==`number`)return o;var s=i===`horizontal`?r:n,c=s.scale.domain();if(s.type===`number`){var l=Math.max(c[0],c[1]),u=Math.min(c[0],c[1]);return o===`dataMin`?u:o===`dataMax`||l<0?l:Math.max(Math.min(c[0],c[1]),0)}return o===`dataMin`?c[0]:o===`dataMax`?c[1]:c[0]}),V7(U7,`getComposedData`,function(e){var t=e.props,n=e.item,r=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,c=e.dataKey,l=e.stackedData,u=e.dataStartIndex,d=e.displayedData,f=e.offset,p=t.layout,m=l&&l.length,h=j7.getBaseValue(t,n,r,i),g=p===`horizontal`,_=!1,v=d.map(function(e,t){var n;m?n=l[u+t]:(n=K$(e,c),Array.isArray(n)?_=!0:n=[h,n]);var d=n[1]==null||m&&K$(e,c)==null;return g?{x:g1({axis:r,ticks:a,bandSize:s,entry:e,index:t}),y:d?null:i.scale(n[1]),value:n,payload:e}:{x:d?null:r.scale(n[1]),y:g1({axis:i,ticks:o,bandSize:s,entry:e,index:t}),value:n,payload:e}});return I7({points:v,baseLine:m||_?v.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return g?{x:e.x,y:t!=null&&e.y!=null?i.scale(t):null}:{x:t==null?null:r.scale(t),y:e.y}}):g?i.scale(h):r.scale(h),layout:p,isRange:_},f)}),V7(U7,`renderDotItem`,function(e,t){var n;if(_.isValidElement(e))n=_.cloneElement(e,t);else if((0,FR.default)(e))n=e(t);else{var r=Zo(`recharts-area-dot`,typeof e==`boolean`?``:e.className),i=t.key,a=N7(t,qae);n=_.createElement(o6,P7({},a,{key:i,className:r}))}return n});function W7(e){"@babel/helpers - typeof";return W7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},W7(e)}function noe(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function G7(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Roe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function zoe(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function T9(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n0?a:e&&e.length&&Q(r)&&Q(i)?e.slice(r,i+1):[]};function R9(e){return e===`number`?[0,`auto`]:void 0}var z9=function(e,t,n,r){var i=e.graphicalItems,a=e.tooltipAxis,o=L9(t,e);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(i,s){var c=s.props.data??t;c&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(c=c.slice(e.dataStartIndex,e.dataEndIndex+1));var l=a.dataKey&&!a.allowDuplicatedCategory?SR(c===void 0?o:c,a.dataKey,r):c&&c[n]||o[n];return l?[].concat(k9(i),[D1(s,l)]):i},[])},B9=function(e,t,n,r){var i=r||{x:e.chartX,y:e.chartY},a=Zoe(i,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,l=J$(a,o,c,s);if(l>=0&&c){var u=c[l]&&c[l].value;return{activeTooltipIndex:l,activeLabel:u,activePayload:z9(e,t,l,u),activeCoordinate:Qoe(n,o,l,i)}}return null},$oe=function(e,t){var n=t.axes,r=t.graphicalItems,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=e.stackOffset,f=r1(l,i);return n.reduce(function(t,n){var p=n.type.defaultProps===void 0?n.props:$($({},n.type.defaultProps),n.props),m=p.type,h=p.dataKey,g=p.allowDataOverflow,_=p.allowDuplicatedCategory,v=p.scale,y=p.ticks,b=p.includeHidden,x=p[a];if(t[x])return t;var S=L9(e.data,{graphicalItems:r.filter(function(e){return(a in e.props?e.props[a]:e.type.defaultProps?.[a])===x}),dataStartIndex:s,dataEndIndex:c}),C=S.length,w,T,E;Eoe(p.domain,g,m)&&(w=w1(p.domain,null,g),f&&(m===`number`||v!==`auto`)&&(E=q$(S,h,`category`)));var D=R9(m);if(!w||w.length===0){var O=p.domain??D;if(h){if(w=q$(S,h,m),m===`category`&&f){var k=bR(w);_&&k?(T=w,w=(0,S8.default)(0,C)):_||(w=E1(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(k9(e),[t])},[]))}else if(m===`category`)w=_?w.filter(function(e){return e!==``&&!(0,dR.default)(e)}):E1(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0||t===``||(0,dR.default)(t)?e:[].concat(k9(e),[t])},[]);else if(m===`number`){var A=t1(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===x&&(b||!n)}),h,i,l);A&&(w=A)}f&&(m===`number`||v!==`auto`)&&(E=q$(S,h,`category`))}else w=f?(0,S8.default)(0,C):o&&o[x]&&o[x].hasStack&&m===`number`?d===`expand`?[0,1]:x1(o[x].stackGroups,s,c):n1(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps.hide;return t===x&&(b||!n)}),m,l,!0);if(m===`number`)w=u9(u,w,x,i,y),O&&(w=w1(O,w,g));else if(m===`category`&&O){var j=O;w.every(function(e){return j.indexOf(e)>=0})&&(w=j)}}return $($({},t),{},N9({},x,$($({},p),{},{axisType:i,domain:w,categoricalDomain:E,duplicateDomain:T,originalDomain:p.domain??D,isCategorical:f,layout:l})))},{})},ese=function(e,t){var n=t.graphicalItems,r=t.Axis,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=L9(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:c}),f=d.length,p=r1(l,i),m=-1;return n.reduce(function(e,t){var h=(t.type.defaultProps===void 0?t.props:$($({},t.type.defaultProps),t.props))[a],g=R9(`number`);if(!e[h]){m++;var _;return p?_=(0,S8.default)(0,f):o&&o[h]&&o[h].hasStack?(_=x1(o[h].stackGroups,s,c),_=u9(u,_,h,i)):(_=w1(g,n1(d,n.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===h&&!n}),`number`,l),r.defaultProps.allowDataOverflow),_=u9(u,_,h,i)),$($({},e),{},N9({},h,$($({axisType:i},r.defaultProps),{},{hide:!0,orientation:(0,lR.default)(Yoe,`${i}.${m%2}`,null),domain:_,originalDomain:g,isCategorical:p,layout:l})))}return e},{})},tse=function(e,t){var n=t.axisType,r=n===void 0?`xAxis`:n,i=t.AxisComp,a=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.children,u=`${r}Id`,d=qR(l,i),f={};return d&&d.length?f=$oe(e,{axes:d,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(f=ese(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c})),f},nse=function(e){var t=yR(e),n=i1(t,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:(0,VU.default)(n,function(e){return e.coordinate}),tooltipAxis:t,tooltipAxisBandSize:T1(t,n)}},V9=function(e){var t=e.children,n=e.defaultShowTooltip,r=JR(t,P8),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},rse=function(e){return!e||!e.length?!1:e.some(function(e){var t=UR(e&&e.type);return t&&t.indexOf(`Bar`)>=0})},H9=function(e){return e===`horizontal`?{numericAxisName:`yAxis`,cateAxisName:`xAxis`}:e===`vertical`?{numericAxisName:`xAxis`,cateAxisName:`yAxis`}:e===`centric`?{numericAxisName:`radiusAxis`,cateAxisName:`angleAxis`}:{numericAxisName:`angleAxis`,cateAxisName:`radiusAxis`}},ise=function(e,t){var n=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,o=e.yAxisMap,s=o===void 0?{}:o,c=n.width,l=n.height,u=n.children,d=n.margin||{},f=JR(u,P8),p=JR(u,yU),m=Object.keys(s).reduce(function(e,t){var n=s[t],r=n.orientation;return!n.mirror&&!n.hide?$($({},e),{},N9({},r,e[r]+n.width)):e},{left:d.left||0,right:d.right||0}),h=$($({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return!n.mirror&&!n.hide?$($({},e),{},N9({},r,(0,lR.default)(e,`${r}`)+n.height)):e},{top:d.top||0,bottom:d.bottom||0})),m),g=h.bottom;f&&(h.bottom+=f.props.height||P8.defaultProps.height),p&&t&&(h=Q$(h,r,n,t));var _=c-h.left-h.right,v=l-h.top-h.bottom;return $($({brushBottom:g},h),{},{width:Math.max(_,0),height:Math.max(v,0)})},ase=function(e,t){if(t===`xAxis`)return e[t].width;if(t===`yAxis`)return e[t].height},U9=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,i=r===void 0?`axis`:r,a=e.validateTooltipEventTypes,o=a===void 0?[`axis`]:a,s=e.axisComponents,c=e.legendContent,l=e.formatAxisMap,u=e.defaultProps,d=function(e,t){var n=t.graphicalItems,r=t.stackGroups,i=t.offset,a=t.updateId,o=t.dataStartIndex,c=t.dataEndIndex,l=e.barSize,u=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,m=H9(u),h=m.numericAxisName,g=m.cateAxisName,_=rse(n),v=[];return n.forEach(function(n,m){var y=L9(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:c}),b=n.type.defaultProps===void 0?n.props:$($({},n.type.defaultProps),n.props),x=b.dataKey,S=b.maxBarSize,C=b[`${h}Id`],w=b[`${g}Id`],T=s.reduce(function(e,n){var r=t[`${n.axisType}Map`],i=b[`${n.axisType}Id`];!(r&&r[i]||n.axisType===`zAxis`)&&ZQ(!1);var a=r[i];return $($({},e),{},N9(N9({},n.axisType,a),`${n.axisType}Ticks`,i1(a)))},{}),E=T[g],D=T[`${g}Ticks`],O=r&&r[C]&&r[C].hasStack&&y1(n,r[C].stackGroups),k=UR(n.type).indexOf(`Bar`)>=0,A=T1(E,D),j=[],M=_&&X$({barSize:l,stackGroups:r,totalSize:ase(T,g)});if(k){var N=(0,dR.default)(S)?p:S,P=T1(E,D,!0)??N??0;j=Z$({barGap:d,barCategoryGap:f,bandSize:P===A?A:P,sizeList:M[w],maxBarSize:N}),P!==A&&(j=j.map(function(e){return $($({},e),{},{position:$($({},e.position),{},{offset:e.position.offset-P/2})})}))}var F=n&&n.type&&n.type.getComposedData;F&&v.push({props:$($({},F($($({},T),{},{displayedData:y,props:e,dataKey:x,item:n,bandSize:A,barPosition:j,offset:i,stackedData:O,layout:u,dataStartIndex:o,dataEndIndex:c}))),{},N9(N9(N9({key:n.key||`item-${m}`},h,T[h]),g,T[g]),`animationId`,a)),childIndex:az(n,e.children),item:n})}),v},f=function(e,r){var i=e.props,a=e.dataStartIndex,o=e.dataEndIndex,c=e.updateId;if(!YR({props:i}))return null;var u=i.children,f=i.layout,p=i.stackOffset,m=i.data,h=i.reverseStackOrder,g=H9(f),_=g.numericAxisName,v=g.cateAxisName,y=qR(u,n),b=m1(m,y,`${_}Id`,`${v}Id`,p,h),x=s.reduce(function(e,t){var n=`${t.axisType}Map`;return $($({},e),{},N9({},n,tse(i,$($({},t),{},{graphicalItems:y,stackGroups:t.axisType===_&&b,dataStartIndex:a,dataEndIndex:o}))))},{}),S=ise($($({},x),{},{props:i,graphicalItems:y}),r?.legendBBox);Object.keys(x).forEach(function(e){x[e]=l(i,x[e],S,e.replace(`Map`,``),t)});var C=x[`${v}Map`],w=nse(C);return $($({formattedGraphicalItems:d(i,$($({},x),{},{dataStartIndex:a,dataEndIndex:o,updateId:c,graphicalItems:y,stackGroups:b,offset:S})),graphicalItems:y,offset:S,stackGroups:b},w),x)},p=function(e){function n(e){var r;return zoe(this,n),r=Voe(this,n,[e]),N9(r,`eventEmitterSymbol`,Symbol(`rechartsEventEmitter`)),N9(r,`accessibilityManager`,new Toe),N9(r,`handleLegendBBoxUpdate`,function(e){if(e){var t=r.state,n=t.dataStartIndex,i=t.dataEndIndex,a=t.updateId;r.setState($({legendBBox:e},f({props:r.props,dataStartIndex:n,dataEndIndex:i,updateId:a},$($({},r.state),{},{legendBBox:e}))))}}),N9(r,`handleReceiveSyncEvent`,function(e,t,n){if(r.props.syncId===e){if(n===r.eventEmitterSymbol&&typeof r.props.syncMethod!=`function`)return;r.applySyncEvent(t)}}),N9(r,`handleBrushChange`,function(e){var t=e.startIndex,n=e.endIndex;if(t!==r.state.dataStartIndex||n!==r.state.dataEndIndex){var i=r.state.updateId;r.setState(function(){return $({dataStartIndex:t,dataEndIndex:n},f({props:r.props,dataStartIndex:t,dataEndIndex:n,updateId:i},r.state))}),r.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),N9(r,`handleMouseEnter`,function(e){var t=r.getMouseInfo(e);if(t){var n=$($({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseEnter;(0,FR.default)(i)&&i(n,e)}}),N9(r,`triggeredAfterMouseMove`,function(e){var t=r.getMouseInfo(e),n=t?$($({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseMove;(0,FR.default)(i)&&i(n,e)}),N9(r,`handleItemMouseEnter`,function(e){r.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),N9(r,`handleItemMouseLeave`,function(){r.setState(function(){return{isTooltipActive:!1}})}),N9(r,`handleMouseMove`,function(e){e.persist(),r.throttleTriggeredAfterMouseMove(e)}),N9(r,`handleMouseLeave`,function(e){r.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};r.setState(t),r.triggerSyncEvent(t);var n=r.props.onMouseLeave;(0,FR.default)(n)&&n(t,e)}),N9(r,`handleOuterEvent`,function(e){var t=iz(e),n=(0,lR.default)(r.props,`${t}`);t&&(0,FR.default)(n)&&n((/.*touch.*/i.test(t)?r.getMouseInfo(e.changedTouches[0]):r.getMouseInfo(e))??{},e)}),N9(r,`handleClick`,function(e){var t=r.getMouseInfo(e);if(t){var n=$($({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onClick;(0,FR.default)(i)&&i(n,e)}}),N9(r,`handleMouseDown`,function(e){var t=r.props.onMouseDown;(0,FR.default)(t)&&t(r.getMouseInfo(e),e)}),N9(r,`handleMouseUp`,function(e){var t=r.props.onMouseUp;(0,FR.default)(t)&&t(r.getMouseInfo(e),e)}),N9(r,`handleTouchMove`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),N9(r,`handleTouchStart`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseDown(e.changedTouches[0])}),N9(r,`handleTouchEnd`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseUp(e.changedTouches[0])}),N9(r,`handleDoubleClick`,function(e){var t=r.props.onDoubleClick;(0,FR.default)(t)&&t(r.getMouseInfo(e),e)}),N9(r,`handleContextMenu`,function(e){var t=r.props.onContextMenu;(0,FR.default)(t)&&t(r.getMouseInfo(e),e)}),N9(r,`triggerSyncEvent`,function(e){r.props.syncId!==void 0&&d9.emit(f9,r.props.syncId,e,r.eventEmitterSymbol)}),N9(r,`applySyncEvent`,function(e){var t=r.props,n=t.layout,i=t.syncMethod,a=r.state.updateId,o=e.dataStartIndex,s=e.dataEndIndex;if(e.dataStartIndex!==void 0||e.dataEndIndex!==void 0)r.setState($({dataStartIndex:o,dataEndIndex:s},f({props:r.props,dataStartIndex:o,dataEndIndex:s,updateId:a},r.state)));else if(e.activeTooltipIndex!==void 0){var c=e.chartX,l=e.chartY,u=e.activeTooltipIndex,d=r.state,p=d.offset,m=d.tooltipTicks;if(!p)return;if(typeof i==`function`)u=i(m,e);else if(i===`value`){u=-1;for(var h=0;h=0){var D,O;if(c.dataKey&&!c.allowDuplicatedCategory){var k=typeof c.dataKey==`function`?E:`payload.${c.dataKey.toString()}`;D=SR(m,k,u),O=h&&g&&SR(g,k,u)}else D=m?.[l],O=h&&g&&g[l];if(S||x){var A=e.props.activeIndex===void 0?l:e.props.activeIndex;return[(0,_.cloneElement)(e,$($($({},i.props),w),{},{activeIndex:A})),null,null]}if(!(0,dR.default)(D))return[T].concat(k9(r.renderActivePoints({item:i,activePoint:D,basePoint:O,childIndex:l,isRange:h})))}else{var j=(r.getItemByXY(r.state.activeCoordinate)??{graphicalItem:T}).graphicalItem,M=j.item,N=M===void 0?e:M,P=j.childIndex;return[(0,_.cloneElement)(N,$($($({},i.props),w),{},{activeIndex:P})),null,null]}return h?[T,null,null]:[T,null]}),N9(r,`renderCustomized`,function(e,t,n){return(0,_.cloneElement)(e,$($({key:`recharts-customized-${n}`},r.props),r.state))}),N9(r,`renderMap`,{CartesianGrid:{handler:I9,once:!0},ReferenceArea:{handler:r.renderReferenceElement},ReferenceLine:{handler:I9},ReferenceDot:{handler:r.renderReferenceElement},XAxis:{handler:I9},YAxis:{handler:I9},Brush:{handler:r.renderBrush,once:!0},Bar:{handler:r.renderGraphicChild},Line:{handler:r.renderGraphicChild},Area:{handler:r.renderGraphicChild},Radar:{handler:r.renderGraphicChild},RadialBar:{handler:r.renderGraphicChild},Scatter:{handler:r.renderGraphicChild},Pie:{handler:r.renderGraphicChild},Funnel:{handler:r.renderGraphicChild},Tooltip:{handler:r.renderCursor,once:!0},PolarGrid:{handler:r.renderPolarGrid,once:!0},PolarAngleAxis:{handler:r.renderPolarAxis},PolarRadiusAxis:{handler:r.renderPolarAxis},Customized:{handler:r.renderCustomized}}),r.clipPathId=`${e.id??_R(`recharts`)}-clip`,r.throttleTriggeredAfterMouseMove=(0,nG.default)(r.triggeredAfterMouseMove,e.throttleDelay??1e3/60),r.state={},r}return Woe(n,e),Boe(n,[{key:`componentDidMount`,value:function(){this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:this.props.margin.left??0,top:this.props.margin.top??0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:`displayDefaultTooltip`,value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,i=e.layout,a=JR(t,XW);if(a){var o=a.props.defaultIndex;if(!(typeof o!=`number`||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,c=z9(this.state,n,o,s),l=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d=i===`horizontal`?{x:l,y:u}:{y:l,x:u},f=this.state.formattedGraphicalItems.find(function(e){return e.item.type.name===`Scatter`});f&&(d=$($({},d),f.props.points[o].tooltipPosition),c=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:c,activeCoordinate:d};this.setState(p),this.renderCursor(a),this.accessibilityManager.setIndex(o)}}}},{key:`getSnapshotBeforeUpdate`,value:function(e,t){return this.props.accessibilityLayer?(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin&&this.accessibilityManager.setDetails({offset:{left:this.props.margin.left??0,top:this.props.margin.top??0}}),null):null}},{key:`componentDidUpdate`,value:function(e){tz([JR(e.children,XW)],[JR(this.props.children,XW)])||this.displayDefaultTooltip()}},{key:`componentWillUnmount`,value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:`getTooltipEventType`,value:function(){var e=JR(this.props.children,XW);if(e&&typeof e.props.shared==`boolean`){var t=e.props.shared?`axis`:`item`;return o.indexOf(t)>=0?t:i}return i}},{key:`getMouseInfo`,value:function(e){if(!this.container)return null;var t=this.container,n=t.getBoundingClientRect(),r=kG(n),i={chartX:Math.round(e.pageX-r.left),chartY:Math.round(e.pageY-r.top)},a=n.width/t.offsetWidth||1,o=this.inRange(i.chartX,i.chartY,a);if(!o)return null;var s=this.state,c=s.xAxisMap,l=s.yAxisMap,u=this.getTooltipEventType(),d=B9(this.state,this.props.data,this.props.layout,o);if(u!==`axis`&&c&&l){var f=yR(c).scale,p=yR(l).scale,m=f&&f.invert?f.invert(i.chartX):null,h=p&&p.invert?p.invert(i.chartY):null;return $($({},i),{},{xValue:m,yValue:h},d)}return d?$($({},i),d):null}},{key:`inRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=this.props.layout,i=e/n,a=t/n;if(r===`horizontal`||r===`vertical`){var o=this.state.offset;return i>=o.left&&i<=o.left+o.width&&a>=o.top&&a<=o.top+o.height?{x:i,y:a}:null}var s=this.state,c=s.angleAxisMap,l=s.radiusAxisMap;if(c&&l){var u=yR(c);return V1({x:i,y:a},u)}return null}},{key:`parseEventsOfWrapper`,value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=JR(e,XW),r={};return n&&t===`axis`&&(r=n.props.trigger===`click`?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),$($({},MR(this.props,this.handleOuterEvent)),r)}},{key:`addListener`,value:function(){d9.on(f9,this.handleReceiveSyncEvent)}},{key:`removeListener`,value:function(){d9.removeListener(f9,this.handleReceiveSyncEvent)}},{key:`filterFormatItem`,value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,i=0,a=r.length;i{let[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)([]),c=(0,_.useRef)(0),{baseUrl:l,fetchWithHeaders:u}=wl();(0,_.useEffect)(()=>{let t=!1;return pf(l,u,e).then(e=>{if(t||e.length===0)return;let n=e.filter(e=>e.loss!=null).map(e=>({step:e.step,loss:e.loss})).slice(-2e3),r=e.filter(e=>e.lr!=null).map(e=>({step:e.step,lr:e.lr})).slice(-2e3);a(n),s(r),c.current=e[e.length-1]?.step??0}).catch(()=>{}),()=>{t=!0}},[l,u,e]),(0,_.useEffect)(()=>{let e=t.current_step;if(e0&&t.current_loss!=null){let n=t.current_loss;a(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,loss:n}].slice(-2e3)})}if(e>0&&t.current_lr!=null){let n=t.current_lr;s(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,lr:n}].slice(-2e3)})}},[t.current_step,t.current_loss,t.current_lr]);let d=n(),f=t.training_active&&t.total_steps===0,p=f?`Training starting…`:`${t.current_step.toLocaleString()} / ${t.total_steps.toLocaleString()}`,m=t.eta_seconds==null?`—`:r(t.eta_seconds);return(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(cb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:(0,B.jsxs)(fb,{className:`p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500/20 text-blue-400`,children:(0,B.jsx)(as,{className:`w-5 h-5`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm text-slate-400`,children:`Progress`}),(0,B.jsx)(`div`,{className:`text-base font-semibold text-white`,children:p})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-slate-300`,children:[(0,B.jsx)(xs,{className:`w-4 h-4 text-purple-400`}),(0,B.jsxs)(`span`,{className:`text-sm`,children:[`ETA `,(0,B.jsx)(`span`,{className:`font-semibold text-white`,children:m})]})]})]}),(0,B.jsxs)(`div`,{className:`relative h-8 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,B.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${d}%`}}),(0,B.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center font-semibold text-white text-sm tabular-nums drop-shadow`,children:f?`warming up…`:`${d.toFixed(1)}%`})]})]})}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,B.jsxs)(cb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(lb,{className:`pb-2`,children:(0,B.jsxs)(ub,{className:`flex items-center gap-3 text-white text-base`,children:[(0,B.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-green-500/20 text-green-400`,children:(0,B.jsx)(gs,{className:`w-4 h-4`})}),(0,B.jsxs)(`span`,{children:[`Loss`,` `,(0,B.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_loss?.toFixed(4)??`—`,`)`]})]})]})}),(0,B.jsx)(fb,{className:`pt-0`,children:(0,B.jsx)(`div`,{className:`h-48`,children:i.length===0?(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,B.jsx)(hG,{width:`100%`,height:`100%`,children:(0,B.jsxs)(W9,{data:i,margin:{top:8,right:12,left:0,bottom:0},children:[(0,B.jsx)(Q7,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,B.jsx)(s9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48}),(0,B.jsx)(XW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#34d399`},formatter:e=>e.toFixed(4)}),(0,B.jsx)(A7,{type:`monotone`,dataKey:`loss`,stroke:`#34d399`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]}),(0,B.jsxs)(cb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(lb,{className:`pb-2`,children:(0,B.jsxs)(ub,{className:`flex items-center gap-3 text-white text-base`,children:[(0,B.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-orange-500/20 text-orange-400`,children:(0,B.jsx)(as,{className:`w-4 h-4`})}),(0,B.jsxs)(`span`,{children:[`Learning Rate`,` `,(0,B.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_lr?.toExponential(2)??`—`,`)`]})]})]})}),(0,B.jsx)(fb,{className:`pt-0`,children:(0,B.jsx)(`div`,{className:`h-48`,children:o.length===0?(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,B.jsx)(hG,{width:`100%`,height:`100%`,children:(0,B.jsxs)(W9,{data:o,margin:{top:8,right:12,left:0,bottom:0},children:[(0,B.jsx)(Q7,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,B.jsx)(s9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48,tickFormatter:e=>e.toExponential(0)}),(0,B.jsx)(XW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#fb923c`},formatter:e=>e.toExponential(2)}),(0,B.jsx)(A7,{type:`monotone`,dataKey:`lr`,stroke:`#fb923c`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]})]})]})},cse=({logs:e,logContainerRef:t})=>(0,B.jsxs)(cb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(lb,{children:(0,B.jsxs)(ub,{className:`flex items-center gap-3 text-white`,children:[(0,B.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-lg bg-slate-700`,children:(0,B.jsx)(As,{className:`w-5 h-5 text-sky-400`})}),`Training Logs`]})}),(0,B.jsx)(fb,{children:(0,B.jsx)(`div`,{ref:t,className:`bg-slate-900 rounded-lg p-4 h-96 overflow-y-auto font-mono text-sm border border-slate-700`,children:e.length===0?(0,B.jsx)(`div`,{className:`text-slate-500 py-8`,children:`No training logs yet. Start training to see output.`}):e.map((e,t)=>(0,B.jsxs)(`div`,{className:`text-slate-300 break-words whitespace-pre-wrap`,children:[(0,B.jsx)(`span`,{className:`text-slate-500 mr-2 select-none`,children:new Date(e.timestamp*1e3).toLocaleTimeString()}),e.message]},t))})})]}),lse=({installHint:e})=>{let t=dL(`system/training-extra`);return(0,B.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:(0,B.jsxs)(cb,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,B.jsx)(lb,{children:(0,B.jsxs)(ub,{className:`flex items-center gap-3 text-white`,children:[(0,B.jsx)(pL,{state:t.state}),fL(t.state,`Training Extra Not Installed`)]})}),(0,B.jsx)(fb,{className:`space-y-4`,children:(0,B.jsx)(mL,{state:t.state,error:t.error,logs:t.logs,logBoxRef:t.logBoxRef,onInstall:t.handleInstall,onRetry:t.handleRetry,installHint:e,packageName:`accelerate`,idleTitle:`Training Extra Not Installed`,idleDescription:(0,B.jsxs)(B.Fragment,{children:[`Training requires the`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`accelerate`}),` `,`package, which isn't installed in this environment. Install it to enable the Training page.`]}),doneDescription:(0,B.jsx)(hL,{purpose:`training`})})})]})})},use=({open:e,onOpenChange:t,policyType:n,packageName:r,installTarget:i,installHint:a})=>{let o=dL(`system/policy-extra/${n}`,e),s=`${n.toUpperCase()} needs an extra package`;return(0,B.jsx)($d,{open:e,onOpenChange:t,children:(0,B.jsxs)(nf,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,B.jsxs)(rf,{children:[(0,B.jsxs)(of,{className:`flex items-center gap-3 text-white`,children:[(0,B.jsx)(pL,{state:o.state}),fL(o.state,s)]}),(0,B.jsxs)(sf,{className:`sr-only`,children:[`Install `,i,` to train `,n,`.`]})]}),(0,B.jsx)(`div`,{className:`space-y-4`,children:(0,B.jsx)(mL,{state:o.state,error:o.error,logs:o.logs,logBoxRef:o.logBoxRef,onInstall:o.handleInstall,onRetry:o.handleRetry,installHint:a,packageName:i,idleTitle:s,idleDescription:(0,B.jsxs)(B.Fragment,{children:[`Training a `,(0,B.jsx)(`span`,{className:`font-semibold`,children:n}),` policy needs the`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:r}),` `,`package (installed via`,` `,(0,B.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:i}),`), which isn't in this environment yet. Install it to train this policy.`]}),doneDescription:(0,B.jsx)(hL,{purpose:`${n} training`})})})]})})},dse=()=>{let{auth:e,refetch:t}=Dl(),{baseUrl:n,fetchWithHeaders:r}=wl(),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null);if(e.status===`authenticated`||e.status===`loading`)return null;let u=async()=>{let e=i.trim();if(e){s(!0),l(null);try{let i=await r(`${n}/hf-auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}a(``),await t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}};return(0,B.jsx)(`div`,{className:`bg-amber-950/40 border border-amber-700/60 rounded-lg p-4 mb-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(hs,{className:`w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5`}),(0,B.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm text-amber-100 font-medium`,children:`Hugging Face access required for cloud training`}),(0,B.jsxs)(`p`,{className:`text-xs text-amber-200/80 mt-1`,children:[`Create a token at`,` `,(0,B.jsxs)(`a`,{href:`https://huggingface.co/settings/tokens`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-amber-50 inline-flex items-center gap-1`,children:[`huggingface.co/settings/tokens`,(0,B.jsx)(Ds,{className:`w-3 h-3`})]}),` `,`with `,(0,B.jsx)(`span`,{className:`font-mono`,children:`Write`}),` access (so trained policies can upload to your account), then paste it below.`]})]}),(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u()},className:`flex gap-2`,children:[(0,B.jsx)(b_,{type:`password`,placeholder:`hf_...`,value:i,onChange:e=>a(e.target.value),className:`bg-slate-900 border-slate-600 text-white placeholder:text-slate-500`,disabled:o,autoComplete:`off`}),(0,B.jsx)(q,{type:`submit`,disabled:o||!i.trim(),className:`bg-amber-600 hover:bg-amber-700 text-white`,children:o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ns,{className:`w-4 h-4 mr-2 animate-spin`}),`Saving…`]}):`Save token`})]}),c&&(0,B.jsx)(`p`,{className:`text-xs text-red-300`,children:c})]})]})})},fse=1e3,G9=5e3;function pse(e,t){return e?{training_active:e.state===`running`,current_step:e.metrics.current_step,total_steps:e.metrics.total_steps,current_loss:e.metrics.current_loss??void 0,current_lr:e.metrics.current_lr??void 0,grad_norm:e.metrics.grad_norm??void 0,eta_seconds:e.metrics.eta_seconds??void 0,available_controls:{stop_training:e.state===`running`,pause_training:!1,resume_training:!1}}:{training_active:t,current_step:0,total_steps:0,available_controls:{stop_training:!1,pause_training:!1,resume_training:!1}}}function mse(e){return{target:e.target,dataset_repo_id:e.dataset_repo_id,policy_type:e.policy_type,steps:e.steps,batch_size:e.batch_size,seed:e.seed,num_workers:e.num_workers,log_freq:e.log_freq,save_freq:e.save_freq,save_checkpoint:e.save_checkpoint,resume:e.resume,wandb_enable:e.wandb_enable,wandb_project:e.wandb_project,wandb_entity:e.wandb_entity,wandb_notes:e.wandb_notes,wandb_mode:e.wandb_mode,wandb_disable_artifact:e.wandb_disable_artifact,policy_device:e.policy_device,policy_use_amp:e.policy_use_amp,optimizer_type:e.optimizer_type,optimizer_lr:e.optimizer_lr,optimizer_weight_decay:e.optimizer_weight_decay,optimizer_grad_clip_norm:e.optimizer_grad_clip_norm,use_policy_training_preset:e.use_policy_training_preset,dataset_image_transforms_enable:e.dataset_image_transforms_enable,...e.policy_type===`groot`?{policy_base_model_path:e.policy_base_model_path,policy_embodiment_tag:e.policy_embodiment_tag,policy_chunk_size:e.policy_chunk_size,policy_n_action_steps:e.policy_n_action_steps,policy_use_relative_actions:e.policy_use_relative_actions,policy_relative_exclude_joints:e.policy_relative_exclude_joints,policy_use_bf16:e.policy_use_bf16}:{}}}var hse=()=>{let{baseUrl:e,fetchWithHeaders:t}=wl(),{auth:n}=Dl(),{toast:r}=ea(),i=ht(),[a,o]=(0,_.useState)({target:{runner:`local`},dataset_repo_id:ft().state?.datasetRepoId??``,policy_type:`act`,steps:1e4,batch_size:8,seed:1e3,num_workers:4,log_freq:250,save_freq:1e3,save_checkpoint:!0,resume:!1,wandb_enable:!1,wandb_mode:`online`,wandb_disable_artifact:!1,policy_device:`cuda`,policy_use_amp:!1,optimizer_type:`adam`,use_policy_training_preset:!0}),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!0),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(`pip install accelerate`),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)([]),[E,D]=(0,_.useState)(!0);(0,_.useEffect)(()=>{u(!0),df(e,t).then(c).catch(()=>c([])).finally(()=>u(!1))},[e,t]),(0,_.useEffect)(()=>{t(`${e}/system/training-extra`).then(e=>e.json()).then(e=>{f(e.available),m(e.install_hint)}).catch(()=>f(!0))},[e,t]),(0,_.useEffect)(()=>{ff(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>g(!1))},[e,t]),(0,_.useEffect)(()=>{D(!0),yf(e,t).then(e=>{C(e.authenticated),T(e.flavors)}).catch(()=>{C(!1),T([])}).finally(()=>D(!1))},[e,t,n.status]);let O=(e,t)=>{o(n=>({...n,[e]:t}))},k=async()=>{if(!a.dataset_repo_id.trim()){r({title:`Error`,description:`Dataset repository ID is required`,variant:`destructive`});return}if(a.target.runner===`local`)try{let n=await t(`${e}/system/policy-extra/${a.policy_type}`);if(n.ok){let e=await n.json();if(e.needs_extra&&!e.available){x({policyType:a.policy_type,packageName:e.package,installTarget:e.install_target,installHint:e.install_hint});return}}}catch{}y(!0);try{let n=await mf(e,t,mse(a));r({title:`Training Started`,description:n.name}),i(`/training/${n.id}`)}catch(n){r({title:`Error`,description:n instanceof Error?n.message:String(n),variant:`destructive`}),ff(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>{})}finally{y(!1)}};if(d===null)return(0,B.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,B.jsx)(lL,{}),(0,B.jsxs)(`div`,{className:`flex items-center justify-center py-24 text-slate-400`,children:[(0,B.jsx)(Ns,{className:`w-6 h-6 animate-spin mr-3`}),`Checking training environment…`]})]})});if(d===!1)return(0,B.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,B.jsx)(lL,{}),(0,B.jsx)(lse,{installHint:p})]})});let A=a.target.runner===`hf_cloud`,j=a.target.runner===`hf_cloud`&&!a.target.flavor,M=a.target.runner===`local`&&h,N=v||!a.dataset_repo_id.trim()||M||A&&!S||j,P=M?`Another local training is already running`:A&&!S?`Log in to Hugging Face to use cloud compute`:j?`Select a hardware flavor`:void 0;return(0,B.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,B.jsx)(lL,{}),(0,B.jsx)(dse,{}),(0,B.jsx)(xre,{config:a,updateConfig:O,datasets:s,datasetsLoading:l,authenticated:S,flavors:w,hardwareLoading:E}),(0,B.jsx)(`div`,{className:`max-w-3xl mx-auto mt-6 flex justify-end`,children:(()=>{let e=(0,B.jsx)(q,{onClick:k,disabled:N,size:`lg`,className:`bg-green-500 hover:bg-green-600 text-white font-semibold px-6`,children:v?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ns,{className:`w-5 h-5 mr-2 animate-spin`}),` Starting…`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ls,{className:`w-5 h-5 mr-2`}),` Start Training`]})});return P?(0,B.jsxs)(Mh,{children:[(0,B.jsx)(Nh,{asChild:!0,children:(0,B.jsx)(`span`,{tabIndex:0,children:e})}),(0,B.jsx)(Ph,{children:P})]}):e})()})]}),b&&(0,B.jsx)(use,{open:!!b,onOpenChange:e=>!e&&x(null),policyType:b.policyType,packageName:b.packageName,installTarget:b.installTarget,installHint:b.installHint})]})},gse=({jobId:e})=>{let{baseUrl:t,fetchWithHeaders:n}=wl(),{toast:r}=ea(),i=ht(),{selectedRecord:a}=Fb(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)([]),f=(0,_.useRef)(null),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let r=!1;return mee(t,n,e).then(e=>{!r&&e.length>0&&d(e)}).catch(()=>{}),()=>{r=!0}},[t,n,e]);let b=(0,_.useRef)(o?.state);b.current=o?.state,(0,_.useEffect)(()=>{let r=!1,i=()=>{mb(t,n,e).then(e=>{if(!r)if(m(e),e.length>0){let t=e[e.length-1].step;g(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else g(null)}).catch(()=>{r||(m([]),g(null))})};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},5e3);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{let r=!1,i=async()=>{try{let i=await fee(t,n,e);if(r)return;if(s(i),i.state===`running`){let i=await pee(t,n,e);!r&&i.length>0&&d(e=>{let t=[...e,...i];return t.length>G9?t.slice(t.length-G9):t})}}catch(e){r||l(e instanceof Error?e.message:String(e))}};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},fse);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[u]);let x=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`},S=()=>!o||o.metrics.total_steps===0?0:o.metrics.current_step/o.metrics.total_steps*100,C=async()=>{if(o&&window.confirm(`Stop this run?`))try{s(await gf(t,n,o.id)),r({title:`Stopping…`})}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},w=async()=>{if(o&&window.confirm(`Delete this run? This wipes the output directory.`))try{await _f(t,n,o.id),r({title:`Job removed`}),i(`/`)}catch(e){r({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(c&&!o)return(0,B.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-4`,children:[(0,B.jsxs)(q,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400`,children:[(0,B.jsx)(os,{className:`w-4 h-4 mr-2`}),` Back to Jobs`]}),(0,B.jsxs)(`p`,{className:`text-red-300`,children:[`Couldn't load job `,e,`: `,c]})]})});if(!o)return(0,B.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto flex items-center justify-center py-24 text-slate-400`,children:[(0,B.jsx)(Ns,{className:`w-6 h-6 animate-spin mr-3`}),` Loading job…`]})});let T=o.state===`running`;return(0,B.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,B.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(q,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400 hover:text-white`,children:[(0,B.jsx)(os,{className:`w-4 h-4 mr-2`}),` Jobs`]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`h1`,{className:`text-xl font-semibold text-white`,children:o.name}),o.runner===`hf_cloud`?(0,B.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-amber-900/40 text-amber-200 border border-amber-700`,children:[`HF · `,o.hf_flavor??`cloud`]}):(0,B.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-slate-700 text-slate-200 border border-slate-600`,children:`Local`}),o.runner===`hf_cloud`&&o.hf_repo_id&&o.state===`done`&&(0,B.jsx)(`a`,{href:`https://huggingface.co/${o.hf_repo_id}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-amber-300 hover:text-amber-200 underline`,children:`View on Hub ↗`}),o.wandb_run_url&&(0,B.jsx)(`a`,{href:o.wandb_run_url,target:`_blank`,rel:`noreferrer`,className:`text-xs text-yellow-300 hover:text-yellow-200 underline`,children:`View on W&B ↗`})]}),(0,B.jsxs)(`p`,{className:`text-xs text-slate-400`,children:[o.state,o.error_message?` — ${o.error_message}`:``]})]})]}),T?(0,B.jsxs)(q,{onClick:C,className:`bg-red-500 hover:bg-red-600 text-white`,children:[(0,B.jsx)(Js,{className:`w-4 h-4 mr-2`}),` Stop`]}):(0,B.jsxs)(q,{onClick:w,variant:`ghost`,className:`text-slate-400 hover:text-white`,children:[(0,B.jsx)(Xs,{className:`w-4 h-4 mr-2`}),` Delete`]})]}),(0,B.jsx)(sse,{jobId:e,trainingStatus:pse(o,!1),getProgressPercentage:S,formatTime:x}),(0,B.jsxs)(`div`,{className:`bg-slate-800/40 border border-slate-700 rounded-lg p-4 flex items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`text-sm font-semibold text-slate-300`,children:`Run inference`}),p.length===0?(0,B.jsx)(`span`,{className:`text-xs text-slate-500`,children:`No checkpoints yet — wait for the first save.`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(gb,{checkpoints:p,selectedStep:h,onChange:g}),(0,B.jsxs)(q,{onClick:()=>y(!0),disabled:h==null,className:`bg-green-500 hover:bg-green-600 text-white`,children:[(0,B.jsx)(Ls,{className:`w-4 h-4 mr-2`}),`Run on robot`]})]})]}),(0,B.jsx)(Ab,{open:v,onOpenChange:y,robot:a,jobId:e,initialStep:h}),(0,B.jsx)(cse,{logs:u,logContainerRef:f})]})})},K9=()=>{let{jobId:e}=_t();return e?(0,B.jsx)(gse,{jobId:e}):(0,B.jsx)(hse,{})},_se=1e3;function q9(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/60),r=t%60;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`}var vse=()=>{let e=ht(),{baseUrl:t,fetchWithHeaders:n}=wl(),{toast:r}=ea(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(!1),l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let i=!1,o=async()=>{try{await Eb(t,n)}catch{}},s=async()=>{try{let s=await Db(t,n);if(i)return;if(a(s),!s.inference_active&&!c.current){c.current=!0,s.exited&&r({title:`Inference finished`,description:s.exit_code===0?`Run completed.`:`Exit code ${s.exit_code}. See ${s.log_path}.`,variant:s.exit_code===0?`default`:`destructive`}),e(`/`);return}s.inference_active&&s.rollout_started_at!=null&&s.duration_s!=null&&s.duration_s>0&&s.rollout_elapsed_s>s.duration_s+10&&!l.current&&(l.current=!0,r({title:`Inference seems hung`,description:`Rollout past duration by ${Math.round(s.rollout_elapsed_s-s.duration_s)}s. Stopping.`,variant:`destructive`}),o())}catch(e){i||r({title:`Lost connection to backend`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};s();let u=setInterval(s,_se);return()=>{i=!0,clearInterval(u)}},[t,n,e,r]);let u=async()=>{s(!1);try{await Eb(t,n)}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(!i)return(0,B.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:[(0,B.jsx)(Ns,{className:`w-6 h-6 animate-spin mr-3`}),` Connecting to inference…`]});let d=i.elapsed_s??0,f=i.rollout_elapsed_s??0,p=i.duration_s??0,m=i.inference_active&&i.rollout_started_at==null,h=i.inference_active&&i.rollout_started_at!=null,g=h&&p>0?Math.min(100,f/p*100):0;return(0,B.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex flex-col p-4 sm:p-6 lg:p-8`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4 mb-8`,children:[(0,B.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,B.jsx)(os,{className:`w-5 h-5`})}),(0,B.jsx)($M,{}),(0,B.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Inference`})]}),(0,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-8 w-full max-w-xl`,children:[(0,B.jsx)(`div`,{className:`text-center mb-6`,children:(0,B.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${m?`bg-amber-500/15 text-amber-300`:`bg-green-500/15 text-green-300`}`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full ${m?`bg-amber-500`:`bg-green-500`} animate-pulse`}),m?`SETTING UP`:h?`RUNNING`:`FINISHED`]})}),(0,B.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,B.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${m?`text-amber-400`:`text-green-400`}`,children:q9(h?f:d)}),(0,B.jsx)(`div`,{className:`text-sm text-gray-500 mt-2`,children:m?`Loading policy & connecting hardware…`:`/ ${q9(p)}`})]}),(0,B.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-8`,children:(0,B.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${m?`bg-amber-500/40 animate-pulse w-full`:`bg-green-500`}`,style:m?void 0:{width:`${g}%`}})}),(0,B.jsxs)(`div`,{className:`text-xs text-slate-500 break-all mb-6`,children:[`policy: `,i.policy_ref??`(unknown)`]}),(0,B.jsxs)(q,{onClick:()=>s(!0),disabled:!i.inference_active,className:`w-full bg-red-500 hover:bg-red-600 text-white font-semibold py-6 text-lg disabled:opacity-50`,children:[(0,B.jsx)(Js,{className:`w-5 h-5 mr-2`}),`Stop`]})]})}),(0,B.jsx)(eL,{open:o,onOpenChange:s,children:(0,B.jsxs)(nL,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,B.jsxs)(rL,{children:[(0,B.jsx)(aL,{children:`Stop inference?`}),(0,B.jsx)(oL,{className:`text-gray-400`,children:`The follower will hold its current pose. You can launch another run from the job tile.`})]}),(0,B.jsxs)(iL,{children:[(0,B.jsx)(cL,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep running`}),(0,B.jsx)(sL,{onClick:u,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})};async function yse(e,t,n,r){return uf(e,t,`/dataset-episodes?${new URLSearchParams({repo_id:n})}`,{signal:r,action:`List episodes`})}async function bse(e,t,n,r,i){return uf(e,t,`/dataset-episode?${new URLSearchParams({repo_id:n,episode_index:String(r)})}`,{signal:i,action:`Load episode`})}async function xse(e,t,n,r,i){return uf(e,t,`/dataset-motion?${new URLSearchParams({repo_id:n,episode_index:String(r)})}`,{signal:i,action:`Load motion trace`})}async function Sse(e,t,n,r,i,a,o){return uf(e,t,`/dataset-thumbnails?${new URLSearchParams({repo_id:n,episode_index:String(r),camera:i,count:String(a)})}`,{signal:o,action:`Load thumbnails`})}function J9(e,t,n,r,i){return`${e}/dataset-video?${new URLSearchParams({repo_id:t,camera:n,chunk:String(r),file:String(i)})}`}function Y9(e,t,n,r,i,a){let o=new URLSearchParams({repo_id:t,episode_index:String(n),camera:r,frame_index:String(i)});return a&&o.set(`max_width`,String(a)),`${e}/dataset-frame?${o}`}function X9(e){if(e==null)return`—`;if(e<60)return`${e.toFixed(1)}s`;let t=Math.floor(e/60),n=Math.round(e%60);return`${t}m ${String(n).padStart(2,`0`)}s`}var Cse=({episodes:e,selected:t,onSelect:n})=>{let r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{r.current?.scrollIntoView({block:`nearest`})},[t]),e.length===0?(0,B.jsx)(`div`,{className:`rounded-lg border border-gray-800 bg-gray-950 p-4 text-xs text-gray-500`,children:`No episodes in this dataset.`}):(0,B.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-gray-800 bg-gray-950`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-b border-gray-800 px-3 py-2`,children:[(0,B.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-gray-500`,children:`Episodes`}),(0,B.jsx)(`span`,{className:`text-[11px] tabular-nums text-gray-600`,children:e.length})]}),(0,B.jsx)(`div`,{className:`max-h-[calc(100vh_-_280px)] overflow-y-auto`,children:e.map(e=>{let i=e.episode_index===t;return(0,B.jsxs)(`button`,{ref:i?r:void 0,type:`button`,onClick:()=>n(e.episode_index),className:`flex w-full items-center gap-2 border-b border-gray-900 px-3 py-2 text-left transition last:border-b-0 ${i?`bg-gray-800/80`:`hover:bg-gray-900`} focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-orange-500`,children:[(0,B.jsx)(`span`,{className:`w-8 text-xs tabular-nums ${i?`font-semibold text-orange-400`:`text-gray-500`}`,children:e.episode_index}),(0,B.jsx)(`span`,{className:`flex-1 truncate text-xs text-gray-300`,children:e.tasks.length>0?e.tasks.join(`, `):`—`}),(0,B.jsx)(`span`,{className:`text-[11px] tabular-nums text-gray-500`,children:X9(e.duration_s)})]},e.episode_index)})})]})},wse=({repoId:e,episodeIndex:t,camera:n,currentFrame:r,onSeekFrame:i,count:a=12})=>{let{baseUrl:o,fetchWithHeaders:s}=wl(),[c,l]=(0,_.useState)([]),[u,d]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let r=new AbortController;return d(!0),Sse(o,s,e,t,n,a,r.signal).then(e=>{r.signal.aborted||l(e.success?e.thumbnails:[])}).catch(()=>{r.signal.aborted||l([])}).finally(()=>{r.signal.aborted||d(!1)}),()=>r.abort()},[o,s,e,t,n,a]);let f=c.reduce((e,t,n)=>Math.abs(t.frame_index-r)(0,B.jsxs)(`button`,{type:`button`,onClick:()=>i(e.frame_index),title:`Frame ${e.frame_index}`,className:`group relative flex-none overflow-hidden rounded transition ${t===f?`ring-2 ring-orange-500`:`ring-1 ring-gray-800 hover:ring-gray-600`} focus:outline-none focus-visible:ring-2 focus-visible:ring-orange-400`,children:[(0,B.jsx)(`img`,{src:e.data_uri,alt:`Frame ${e.frame_index}`,className:`h-14 w-auto`,draggable:!1}),(0,B.jsx)(`span`,{className:`absolute bottom-0 right-0 bg-black/70 px-1 text-[10px] tabular-nums text-gray-300 opacity-0 transition group-hover:opacity-100`,children:e.frame_index})]},e.frame_index))})},Tse=({repoId:e,episodeIndex:t,currentFrame:n,onSeekFrame:r})=>{let{baseUrl:i,fetchWithHeaders:a}=wl(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null);(0,_.useEffect)(()=>{let n=new AbortController;return l(null),xse(i,a,e,t,n.signal).then(e=>{if(!n.signal.aborted){if(!e.success){s(null),l(e.message??`No action stream`);return}s(e.motion)}}).catch(e=>{n.signal.aborted||(s(null),l(e instanceof Error?e.message:`No action stream`))}),()=>n.abort()},[i,a,e,t]);let u=(0,_.useMemo)(()=>(o??[]).map((e,t)=>({frame:t,motion:e})),[o]);return c?(0,B.jsxs)(`div`,{className:`flex h-[64px] items-center justify-center rounded-md border border-gray-800 bg-gray-950 text-[11px] text-gray-600`,children:[`Joint motion unavailable — `,c]}):o?(0,B.jsxs)(`div`,{className:`rounded-md border border-gray-800 bg-gray-950 px-1 pb-1 pt-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between px-2 pb-1`,children:[(0,B.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-gray-600`,children:`Joint motion`}),(0,B.jsxs)(`span`,{className:`text-[10px] tabular-nums text-gray-600`,children:[`frame `,n]})]}),(0,B.jsx)(`div`,{className:`h-[52px] w-full cursor-pointer`,children:(0,B.jsx)(hG,{width:`100%`,height:`100%`,children:(0,B.jsxs)(ose,{data:u,margin:{top:2,right:4,bottom:0,left:4},onClick:e=>{let t=e?.activeLabel;t!=null&&r(Number(t))},children:[(0,B.jsx)(`defs`,{children:(0,B.jsxs)(`linearGradient`,{id:`motionFill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`#f97316`,stopOpacity:.5}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`#f97316`,stopOpacity:.04})]})}),(0,B.jsx)(s9,{hide:!0,domain:[0,`dataMax`]}),(0,B.jsx)(XW,{contentStyle:{background:`#0a0a0a`,border:`1px solid #1f2937`,borderRadius:6,fontSize:11,padding:`4px 8px`},labelStyle:{color:`#9ca3af`},itemStyle:{color:`#fb923c`},formatter:e=>[e.toFixed(2),`motion`],labelFormatter:e=>`Frame ${e}`}),(0,B.jsx)(U7,{type:`monotone`,dataKey:`motion`,stroke:`#f97316`,strokeWidth:1.25,fill:`url(#motionFill)`,isAnimationActive:!1,dot:!1}),(0,B.jsx)(j5,{x:n,stroke:`#e5e7eb`,strokeWidth:1})]})})})]}):(0,B.jsx)(`div`,{className:`h-[64px] rounded-md border border-gray-800 bg-gray-950`})},Ese=[.5,1,2],Dse=.2,Ose=({repoId:e,detail:t,onNavigate:n})=>{let{baseUrl:r}=wl(),i=t.cameras,[a,o]=(0,_.useState)(i[0]?.name??``),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(1),[p,m]=(0,_.useState)(0),h=(0,_.useRef)(null),g=(0,_.useRef)({});(0,_.useEffect)(()=>{i.some(e=>e.name===a)||o(i[0]?.name??``)},[i,a]);let v=(0,_.useMemo)(()=>i.find(e=>e.name===a)??i[0]??null,[i,a]),y=t.fps??20,b=v?.from_timestamp??0,x=v?.to_timestamp??b+(t.duration_s??0),S=(0,_.useCallback)(e=>{let n=h.current;if(!n)return;let r=Math.max(0,Math.min(e,Math.max(t.length-1,0)));n.currentTime=b+(r+.5)/y,m(r)},[b,y,t.length]),C=(0,_.useCallback)(()=>{let e=h.current;e&&(e.currentTime=b,e.playbackRate=d,m(0))},[b,d]);(0,_.useEffect)(()=>{let e=h.current;if(!e)return;let t=!e.paused,n=()=>{e.currentTime=b,e.playbackRate=d,m(0),(t||l)&&e.play().catch(()=>u(!1))};if(e.readyState>=1)n();else return e.addEventListener(`loadedmetadata`,n,{once:!0}),()=>e.removeEventListener(`loadedmetadata`,n)},[t.episode_index,a,b]);let w=(0,_.useCallback)(()=>{let e=h.current;if(e&&!e.ended){if(e.currentTime>=x){e.currentTime=b,m(0);return}if(m(Math.max(0,Math.floor((e.currentTime-b)*y))),s)for(let t of i){if(t.name===a)continue;let n=g.current[t.name];if(!n)continue;let r=(t.from_timestamp??0)+(e.currentTime-b);Math.abs(n.currentTime-r)>Dse&&(n.currentTime=r),n.playbackRate=e.playbackRate,l&&n.paused&&n.play().catch(()=>void 0),!l&&!n.paused&&n.pause()}}},[x,b,y,s,i,a,l]),T=(0,_.useCallback)(()=>{let e=h.current;e&&(e.paused?e.play().then(()=>u(!0),()=>u(!1)):(e.pause(),u(!1)))},[]);if((0,_.useEffect)(()=>{h.current&&(h.current.playbackRate=d)},[d,a]),(0,_.useEffect)(()=>{let e=e=>{let t=e.target;t&&[`INPUT`,`TEXTAREA`,`SELECT`].includes(t.tagName)||(e.code===`Space`?(e.preventDefault(),T()):e.code===`ArrowLeft`?S(p-1):e.code===`ArrowRight`&&S(p+1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[T,S,p]),!v)return(0,B.jsx)(`div`,{className:`flex h-64 items-center justify-center rounded-lg border border-gray-800 bg-gray-950 text-sm text-gray-500`,children:`This episode has no camera videos on disk.`});let E=i.filter(e=>e.name!==a);return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`div`,{className:`flex rounded-md border border-gray-800 bg-gray-950 p-0.5`,children:i.map(e=>(0,B.jsx)(`button`,{type:`button`,onClick:()=>o(e.name),className:`rounded px-3 py-1 text-xs font-medium transition ${e.name===a?`bg-gray-800 text-white`:`text-gray-400 hover:text-gray-200`}`,children:e.name},e.name))}),i.length>1&&(0,B.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>c(e=>!e),className:`h-7 gap-1.5 border-gray-800 bg-gray-950 text-xs hover:bg-gray-900 ${s?`text-orange-400`:`text-gray-400`}`,children:[(0,B.jsx)(Ms,{className:`h-3.5 w-3.5`}),`All cameras`]}),(0,B.jsx)(`div`,{className:`ml-auto flex rounded-md border border-gray-800 bg-gray-950 p-0.5`,children:Ese.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>f(e),className:`rounded px-2.5 py-1 text-xs font-medium tabular-nums transition ${e===d?`bg-gray-800 text-white`:`text-gray-400 hover:text-gray-200`}`,children:[e,`x`]},e))})]}),(0,B.jsxs)(`div`,{className:s&&i.length>1?`grid grid-cols-1 gap-2 sm:grid-cols-2`:`grid grid-cols-1`,children:[(0,B.jsxs)(`div`,{className:`relative flex items-center justify-center overflow-hidden rounded-lg border border-gray-800 bg-black`,children:[(0,B.jsx)(`video`,{ref:h,src:J9(r,e,a,v.chunk,v.file_index),poster:Y9(r,e,t.episode_index,a,0,640),className:`w-auto max-w-full bg-black object-contain ${s&&i.length>1?`max-h-[22vh]`:`max-h-[42vh]`}`,preload:`auto`,playsInline:!0,muted:!0,onLoadedMetadata:C,onTimeUpdate:w,onEnded:e=>{let t=e.currentTarget;t.currentTime=b,m(0),t.play().catch(()=>u(!1))},onPlay:()=>u(!0),onPause:()=>u(!1)},`${a}-${v.chunk}-${v.file_index}`),(0,B.jsx)(`span`,{className:`absolute left-2 top-2 rounded bg-black/70 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-gray-300`,children:a})]}),s&&E.map(n=>(0,B.jsxs)(`div`,{className:`relative flex items-center justify-center overflow-hidden rounded-lg border border-gray-800 bg-black`,children:[(0,B.jsx)(`video`,{ref:e=>{g.current[n.name]=e},src:J9(r,e,n.name,n.chunk,n.file_index),poster:Y9(r,e,t.episode_index,n.name,0,640),className:`max-h-[22vh] w-auto max-w-full bg-black object-contain`,preload:`auto`,playsInline:!0,muted:!0,onLoadedMetadata:e=>{e.currentTarget.currentTime=n.from_timestamp??0}},`${n.name}-${n.chunk}-${n.file_index}`),(0,B.jsx)(`span`,{className:`absolute left-2 top-2 rounded bg-black/70 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-gray-300`,children:n.name})]},n.name))]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(q,{size:`sm`,onClick:T,className:`h-8 w-8 bg-orange-600 p-0 hover:bg-orange-500`,title:`Play / pause (Space)`,children:l?(0,B.jsx)(Fs,{className:`h-4 w-4`}):(0,B.jsx)(Ls,{className:`h-4 w-4`})}),(0,B.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>S(p-1),className:`h-8 w-8 border-gray-800 bg-gray-950 p-0 text-gray-300 hover:bg-gray-900`,title:`Previous frame (←)`,children:(0,B.jsx)(Gs,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>S(p+1),className:`h-8 w-8 border-gray-800 bg-gray-950 p-0 text-gray-300 hover:bg-gray-900`,title:`Next frame (→)`,children:(0,B.jsx)(Ks,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`input`,{type:`range`,min:0,max:Math.max(t.length-1,0),value:p,onChange:e=>S(Number(e.target.value)),className:`mx-2 h-1 flex-1 cursor-pointer appearance-none rounded bg-gray-800 accent-orange-500`,"aria-label":`Scrub episode`}),(0,B.jsxs)(`span`,{className:`w-28 text-right text-xs tabular-nums text-gray-400`,children:[p,` / `,Math.max(t.length-1,0)]})]}),(0,B.jsx)(Tse,{repoId:e,episodeIndex:t.episode_index,currentFrame:p,onSeekFrame:S}),(0,B.jsx)(wse,{repoId:e,episodeIndex:t.episode_index,camera:a,currentFrame:p,onSeekFrame:S}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-800 pt-3`,children:[(0,B.jsxs)(q,{variant:`outline`,size:`sm`,disabled:t.prev_episode===null,onClick:()=>t.prev_episode!==null&&n(t.prev_episode),className:`h-7 gap-1 border-gray-800 bg-gray-950 text-xs text-gray-300 hover:bg-gray-900 disabled:opacity-40`,children:[(0,B.jsx)(ds,{className:`h-3.5 w-3.5`}),`Previous`]}),(0,B.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`Episode `,t.episode_index,` of `,t.total_episodes]}),(0,B.jsxs)(q,{variant:`outline`,size:`sm`,disabled:t.next_episode===null,onClick:()=>t.next_episode!==null&&n(t.next_episode),className:`h-7 gap-1 border-gray-800 bg-gray-950 text-xs text-gray-300 hover:bg-gray-900 disabled:opacity-40`,children:[`Next`,(0,B.jsx)(fs,{className:`h-3.5 w-3.5`})]})]})]})},kse=e=>{let{baseUrl:t,fetchWithHeaders:n}=wl(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(null);return(0,_.useEffect)(()=>{if(i(null),c(null),!e){o(!1);return}let r=new AbortController;return o(!0),yse(t,n,e,r.signal).then(e=>{if(!r.signal.aborted){if(!e.success){i(null),c(e.message??`Could not read dataset`);return}i(e)}}).catch(e=>{r.signal.aborted||(i(null),c(e instanceof Error?e.message:`Could not read dataset`))}).finally(()=>{r.signal.aborted||o(!1)}),()=>r.abort()},[t,n,e]),{data:r?.repo_id===e?r:null,loading:a,error:s}},Ase=(e,t)=>{let{baseUrl:n,fetchWithHeaders:r}=wl(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null);return(0,_.useEffect)(()=>{if(!e||t===null){a(null);return}let i=new AbortController;return s(!0),l(null),bse(n,r,e,t,i.signal).then(e=>{if(!i.signal.aborted){if(!e.success){a(null),l(e.message??`Could not load episode`);return}a(e)}}).catch(e=>{i.signal.aborted||(a(null),l(e instanceof Error?e.message:`Could not load episode`))}).finally(()=>{i.signal.aborted||s(!1)}),()=>i.abort()},[n,r,e,t]),{detail:i,loading:o,error:c}},Z9=({label:e,value:t})=>(0,B.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,B.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-gray-600`,children:e}),(0,B.jsx)(`span`,{className:`font-medium tabular-nums text-gray-200`,children:t})]}),jse=()=>{let e=ht(),[t,n]=Hn(),{datasets:r,loading:i}=Wb(),a=(0,_.useMemo)(()=>r.filter(e=>e.source===`local`||e.source===`both`),[r]),o=t.get(`dataset`),s=t.get(`episode`),c=s===null?null:Number(s),l=r.find(e=>e.repo_id===o)?.source,{data:u,loading:d,error:f}=kse(o),{detail:p,loading:m,error:h}=Ase(o,c),g=e=>{let n=t.get(`api`);return n?{...e,api:n}:e},v=e=>n(g({dataset:e})),y=e=>{o&&n(g({dataset:o,episode:String(e)}))};return(0,_.useEffect)(()=>{o&&u?.success&&s===null&&u.episodes.length>0&&n(g({dataset:o,episode:String(u.episodes[0].episode_index)}),{replace:!0})},[o,u,s,n]),(0,B.jsx)(`div`,{className:`min-h-screen bg-black p-6 pb-24 text-white`,children:(0,B.jsxs)(`div`,{className:`mx-auto max-w-[1400px]`,children:[(0,B.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-center gap-3`,children:[(0,B.jsxs)(q,{variant:`ghost`,size:`sm`,onClick:()=>e(`/`),className:`h-8 gap-1.5 px-2 text-gray-400 hover:bg-gray-900 hover:text-white`,children:[(0,B.jsx)(os,{className:`h-4 w-4`}),`Back`]}),(0,B.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold tracking-tight`,children:[(0,B.jsx)(ws,{className:`h-5 w-5 text-orange-500`}),`Browse dataset`]}),(0,B.jsxs)(`div`,{className:`ml-auto flex w-full items-center gap-2 sm:w-auto`,children:[(0,B.jsx)(`div`,{className:`w-full sm:w-[380px]`,children:(0,B.jsxs)(Iy,{value:o??void 0,onValueChange:v,children:[(0,B.jsx)(Ry,{className:`h-9 border-gray-800 bg-gray-950 text-sm text-white`,children:(0,B.jsx)(Ly,{placeholder:i?`Loading datasets…`:`Select a local dataset`})}),(0,B.jsx)(Vy,{className:`border-gray-800 bg-gray-950 text-white`,children:a.map(e=>(0,B.jsx)(Uy,{value:e.repo_id,className:`text-sm`,children:e.repo_id},e.repo_id))})]})}),o&&(0,B.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>e(`/upload`,{state:{datasetInfo:{dataset_repo_id:o,source:l??`local`}}}),className:`h-9 gap-1.5 border-gray-800 bg-gray-950 text-xs text-gray-300 hover:bg-gray-900`,children:[(0,B.jsx)(Qs,{className:`h-3.5 w-3.5`}),`Upload`]})]})]}),!o&&(0,B.jsxs)(`div`,{className:`rounded-lg border border-gray-800 bg-gray-950 p-10 text-center`,children:[(0,B.jsx)(ws,{className:`mx-auto mb-3 h-8 w-8 text-gray-700`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-400`,children:`Select a dataset to browse its episodes.`}),!i&&a.length===0&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-gray-600`,children:`No datasets in the local LeRobot cache. Record one, or download it from the Hub first.`})]}),o&&d&&(0,B.jsxs)(`div`,{className:`flex items-center justify-center gap-2 rounded-lg border border-gray-800 bg-gray-950 p-10 text-sm text-gray-500`,children:[(0,B.jsx)(Ns,{className:`h-4 w-4 animate-spin`}),`Reading dataset…`]}),o&&f&&(0,B.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-red-900/50 bg-red-950/30 p-4`,children:[(0,B.jsx)(hs,{className:`mt-0.5 h-4 w-4 flex-none text-red-400`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm font-medium text-red-300`,children:`Could not read this dataset`}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs text-red-400/80`,children:f})]})]}),o&&u?.success&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-5 gap-y-1 rounded-lg border border-gray-800 bg-gray-950 px-4 py-2.5 text-xs`,children:[(0,B.jsx)(Z9,{label:`Episodes`,value:String(u.total_episodes)}),(0,B.jsx)(Z9,{label:`Frames`,value:u.total_frames?.toLocaleString()??`—`}),(0,B.jsx)(Z9,{label:`FPS`,value:String(u.fps??`—`)}),(0,B.jsx)(Z9,{label:`Robot`,value:u.robot_type??`—`}),(0,B.jsx)(Z9,{label:`Cameras`,value:u.cameras.join(`, `)||`—`}),p&&(0,B.jsx)(Z9,{label:`This episode`,value:X9(p.duration_s)})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-[260px_1fr]`,children:[(0,B.jsx)(Cse,{episodes:u.episodes,selected:c,onSelect:y}),(0,B.jsxs)(`div`,{children:[m&&!p&&(0,B.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 rounded-lg border border-gray-800 bg-gray-950 text-sm text-gray-500`,children:[(0,B.jsx)(Ns,{className:`h-4 w-4 animate-spin`}),`Loading episode…`]}),h&&(0,B.jsx)(`div`,{className:`rounded-lg border border-red-900/50 bg-red-950/30 p-4 text-xs text-red-400`,children:h}),p&&(0,B.jsx)(Ose,{repoId:o,detail:p,onNavigate:y})]})]})]})]})})},Mse=()=>{let e=ft(),t=ht(),{toast:n}=ea(),{baseUrl:r,fetchWithHeaders:i}=wl(),a=e.state?.datasetInfo,[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!0),[u,d]=(0,_.useState)({tags:[`robotics`,`lerobot`],private:!1}),[f,p]=(0,_.useState)(u.tags.join(`, `)),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1);_.useEffect(()=>{(async()=>{if(!a?.dataset_repo_id){n({title:`No Dataset Information`,description:`Please complete a recording session first.`,variant:`destructive`}),t(`/`);return}try{let e=await i(`${r}/dataset-info`,{method:`POST`,body:JSON.stringify({dataset_repo_id:a.dataset_repo_id})}),t=await e.json();e.ok&&t.success?s({...t,saved_episodes:t.num_episodes,session_elapsed_seconds:a.session_elapsed_seconds||0,source:a.source}):(n({title:`Warning`,description:`Could not load complete dataset information. Using session data.`,variant:`destructive`}),s(a))}catch(e){console.error(`Error loading dataset info:`,e),n({title:`Warning`,description:`Could not connect to backend. Using session data.`,variant:`destructive`}),s(a)}finally{l(!1)}})()},[a,t,n]);let C=e=>{let t=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,n=`https://huggingface.co/login?next=${encodeURIComponent(t)}`;window.open(n,`_blank`,`noopener,noreferrer`)},w=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}h ${n}m ${r}s`:n>0?`${n}m ${r}s`:`${r}s`},T=async()=>{if(o){h(!0);try{let e=f.split(`,`).map(e=>e.trim()).filter(e=>e.length>0),t=await i(`${r}/upload-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id,tags:e,private:u.private})}),a=await t.json();if(t.ok&&a.success)v(!0),n({title:`Upload Successful!`,description:`Dataset ${o.dataset_repo_id} has been uploaded to HuggingFace Hub.`});else{let e=`Failed to upload dataset to HuggingFace Hub.`;n({title:`Upload Failed`,description:a.docs_url?(0,B.jsxs)(`span`,{children:[a.message||e,` `,(0,B.jsx)(`a`,{href:a.docs_url,target:`_blank`,rel:`noopener noreferrer`,className:`underline font-medium`,children:`Open setup guide`})]}):a.message||e,variant:`destructive`})}}catch(e){console.error(`Error uploading dataset:`,e),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{h(!1)}}},E=()=>{n({title:`Upload Skipped`,description:`Dataset saved locally. You can upload it manually later.`}),t(`/`)},D=async()=>{if(o){S(!0);try{let e=await i(`${r}/delete-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id})}),a=await e.json();e.ok&&a.success?(n({title:`Dataset Deleted`,description:`${o.dataset_repo_id} has been removed from disk.`}),t(`/`)):n({title:`Delete Failed`,description:a.message||`Could not delete the dataset.`,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{S(!1),b(!1)}}};if(c||!o)return(0,B.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto mb-4`}),(0,B.jsx)(`p`,{className:`text-lg`,children:`Loading dataset information...`})]})});let O=o.source===`both`;return(0,B.jsxs)(`div`,{className:`min-h-screen bg-black text-white p-8`,children:[(0,B.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(q,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,B.jsx)(os,{className:`w-4 h-4 mr-2`}),`Back to Home`]}),(0,B.jsx)(q,{onClick:()=>b(!0),variant:`outline`,size:`icon`,disabled:x,"aria-label":`Delete dataset from disk`,className:`border-red-500/40 text-red-400 hover:border-red-400 hover:text-red-300 hover:bg-red-500/10`,children:(0,B.jsx)(Xs,{className:`w-4 h-4`})})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g?(0,B.jsx)(gs,{className:`w-8 h-8 text-green-500`}):(0,B.jsx)(ws,{className:`w-8 h-8 text-blue-500`}),(0,B.jsx)(`h1`,{className:`text-3xl font-bold`,children:g?`Upload Complete`:`Dataset Upload`})]})]}),g&&(0,B.jsxs)(`div`,{className:`bg-green-900/20 border border-green-600 rounded-lg p-6 mb-8`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,B.jsx)(gs,{className:`w-6 h-6 text-green-500`}),(0,B.jsx)(`h2`,{className:`text-xl font-semibold text-green-400`,children:`Successfully Uploaded!`})]}),(0,B.jsx)(`p`,{className:`text-gray-300 mb-4`,children:`Your dataset has been uploaded to HuggingFace Hub and is now available for training and sharing.`}),(0,B.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[(0,B.jsxs)(q,{onClick:()=>{let e=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${o.dataset_repo_id}`)}`,t=u.private?`https://huggingface.co/login?next=${encodeURIComponent(e)}`:`https://huggingface.co${e}`;window.open(t,`_blank`,`noopener,noreferrer`)},className:`bg-blue-500 hover:bg-blue-600 text-white`,children:[(0,B.jsx)(Ds,{className:`w-4 h-4 mr-2`}),`View on HuggingFace Hub`]}),(0,B.jsx)(q,{onClick:()=>t(`/training`,{state:{datasetRepoId:o.dataset_repo_id}}),className:`bg-purple-500 hover:bg-purple-600 text-white`,children:`Start Training`})]})]}),!g&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-4`,children:`Dataset Summary`}),(0,B.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-400`,children:`Repository ID:`}),(0,B.jsx)(`p`,{className:`text-white font-mono text-lg`,children:o.dataset_repo_id})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-400`,children:`Task:`}),(0,B.jsx)(`p`,{className:`text-white`,children:o.single_task})]})]}),(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-400`,children:`Episodes Recorded:`}),(0,B.jsx)(`p`,{className:`text-white text-2xl font-bold text-green-400`,children:o.saved_episodes||o.num_episodes}),o.total_frames&&(0,B.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.total_frames,` total frames`]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`text-gray-400`,children:`Session Duration:`}),(0,B.jsx)(`p`,{className:`text-white`,children:w(o.session_elapsed_seconds||0)}),o.fps&&(0,B.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.fps,` FPS`]})]})]})]})]}),!O&&(0,B.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,B.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-6`,children:`Upload Configuration`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(J,{htmlFor:`tags`,className:`text-gray-300 mb-2 block`,children:`Tags (comma-separated)`}),(0,B.jsx)(b_,{id:`tags`,value:f,onChange:e=>p(e.target.value),placeholder:`robotics, lerobot, manipulation`,className:`bg-gray-800 border-gray-600 text-white`}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:`Tags help others discover your dataset on HuggingFace Hub`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,B.jsx)(B_,{id:`private`,checked:u.private,onCheckedChange:e=>d({...u,private:e})}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u.private?(0,B.jsx)(Os,{className:`w-4 h-4 text-gray-400`}):(0,B.jsx)(ks,{className:`w-4 h-4 text-gray-400`}),(0,B.jsx)(J,{htmlFor:`private`,className:`text-gray-300`,children:`Make dataset private`})]})]}),(0,B.jsx)(`p`,{className:`text-sm text-gray-500 ml-6`,children:u.private?`Only you will be able to access this dataset`:`Dataset will be publicly accessible on HuggingFace Hub`})]})]}),(0,B.jsx)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center`,children:O?(0,B.jsxs)(q,{onClick:()=>C(o.dataset_repo_id),className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:[(0,B.jsx)(Ds,{className:`w-5 h-5 mr-2`}),`View on Hugging Face Hub`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(q,{onClick:T,disabled:m,className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:m?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ns,{className:`w-5 h-5 mr-2 animate-spin`}),`Uploading to Hub...`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qs,{className:`w-5 h-5 mr-2`}),`Upload to HuggingFace Hub`]})}),(0,B.jsx)(q,{onClick:E,disabled:m,variant:`outline`,className:`border-gray-600 text-gray-300 hover:bg-gray-800 hover:text-white py-4 px-8 text-lg`,children:`Skip Upload`})]})}),!O&&(0,B.jsx)(`div`,{className:`mt-8 p-4 bg-blue-900/20 border border-blue-600 rounded-lg`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(hs,{className:`w-5 h-5 text-blue-400 mt-0.5`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold text-blue-400 mb-2`,children:`About HuggingFace Hub Upload`}),(0,B.jsxs)(`ul`,{className:`text-sm text-gray-300 space-y-1`,children:[(0,B.jsx)(`li`,{children:`• Your dataset will be uploaded to HuggingFace Hub for sharing and collaboration`}),(0,B.jsx)(`li`,{children:`• You need to be logged in to HuggingFace CLI on the server`}),(0,B.jsx)(`li`,{children:`• Uploaded datasets can be used for training models and sharing with the community`}),(0,B.jsx)(`li`,{children:`• You can always upload manually later using the HuggingFace CLI`})]})]})]})})]})]}),(0,B.jsx)(eL,{open:y,onOpenChange:b,children:(0,B.jsxs)(nL,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,B.jsxs)(rL,{children:[(0,B.jsx)(aL,{children:`Delete dataset from disk?`}),(0,B.jsxs)(oL,{className:`text-gray-400`,children:[`This permanently removes `,(0,B.jsx)(`span`,{className:`font-mono text-white`,children:o.dataset_repo_id}),` from your local cache. This action cannot be undone.`]})]}),(0,B.jsxs)(iL,{children:[(0,B.jsx)(cL,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep dataset`}),(0,B.jsx)(sL,{onClick:D,disabled:x,className:`bg-red-500 hover:bg-red-600 text-white`,children:x?`Deleting…`:`Delete`})]})]})})]})},Nse=()=>{let e=ft();return(0,_.useEffect)(()=>{console.error(`404 Error: User attempted to access non-existent route:`,e.pathname)},[e.pathname]),(0,B.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-100`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(`h1`,{className:`text-4xl font-bold mb-4`,children:`404`}),(0,B.jsx)(`p`,{className:`text-xl text-gray-600 mb-4`,children:`Oops! Page not found`}),(0,B.jsx)(`a`,{href:`/`,className:`text-blue-500 hover:text-blue-700 underline`,children:`Return to Home`})]})})},Pse=`lelab-tabs-v1`,Fse=1e3,Ise=3e3,Lse=({children:e})=>{let[t,n]=(0,_.useState)(!0),r=(0,_.useRef)(new Map),i=(0,_.useRef)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(null),s=(0,_.useCallback)(()=>{let e=r.current,t=Date.now()-Ise;for(let[n,r]of e)r.lastSeen{if(typeof window>`u`||typeof BroadcastChannel>`u`)return;i.current=crypto.randomUUID(),a.current=Date.now();let e=new BroadcastChannel(Pse);o.current=e;let t=t=>{e.postMessage({type:t,id:i.current,openedAt:a.current})};e.onmessage=e=>{let t=e.data;if(!t||t.id===i.current)return;let n=r.current;t.type===`HEARTBEAT`?n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}):t.type===`RELEASE`?n.delete(t.id):t.type===`TAKEOVER`&&(n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}),a.current<=t.openedAt&&(a.current=t.openedAt+1)),s()},t(`HEARTBEAT`);let n=setInterval(()=>{t(`HEARTBEAT`),s()},Fse),c=()=>t(`RELEASE`);return window.addEventListener(`beforeunload`,c),()=>{window.removeEventListener(`beforeunload`,c),clearInterval(n),t(`RELEASE`),e.close(),o.current=null}},[s]);let c=(0,_.useCallback)(()=>{a.current=0,o.current?.postMessage({type:`TAKEOVER`,id:i.current,openedAt:0}),s()},[s]);return(0,B.jsxs)(B.Fragment,{children:[t&&e,!t&&(0,B.jsx)(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,children:(0,B.jsxs)(`div`,{className:`mx-4 max-w-md space-y-4 rounded-lg border bg-background p-6 text-center shadow-lg`,children:[(0,B.jsx)(`h2`,{className:`text-lg font-semibold`,children:`LeLab is already open in another tab`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Only one tab can control the robot at a time. Switch back to the original tab, or take over here — the other tab will lock.`}),(0,B.jsx)(q,{onClick:c,children:`Use this tab`})]})})]})},Q9=`lelab:teleop-stopped`,Rse=()=>{let{toast:e}=ea();return(0,_.useEffect)(()=>{let t=!1;try{t=sessionStorage.getItem(Q9)===`1`,t&&sessionStorage.removeItem(Q9)}catch{}t&&e({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly when you left the page.`})},[e]),null},$9=`lelab:update-dismissed-sha`;function zse(){let{baseUrl:e,fetchWithHeaders:t}=wl(),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(Ef())return;let n=!1;return t(`${e}/system/update-check`).then(e=>e.ok?e.json():null).then(e=>{if(n||!e||!e.update_available)return;let t=null;try{t=localStorage.getItem($9)}catch{}t&&t===e.latest_commit||(r(e),a(!0))}).catch(()=>{}),()=>{n=!0}},[e,t]),{status:n,open:i,dismiss:(0,_.useCallback)(e=>{if(e&&n?.latest_commit)try{localStorage.setItem($9,n.latest_commit)}catch{}a(!1)},[n])}}var Bse=()=>{let{status:e,open:t,dismiss:n}=zse(),{baseUrl:r,fetchWithHeaders:i}=wl(),{toast:a}=ea(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null);if(!e)return null;let f=typeof e.commits_behind==`number`&&e.commits_behind>0?`${e.commits_behind} commit${e.commits_behind===1?``:`s`} behind`:`A new version is available`;return(0,B.jsx)($d,{open:t,onOpenChange:e=>{!e&&!c&&n(o)},children:(0,B.jsxs)(nf,{className:`bg-slate-800 border-slate-700 text-white max-w-lg`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,B.jsxs)(rf,{children:[(0,B.jsxs)(of,{className:`flex items-center gap-3 text-white`,children:[(0,B.jsx)(qs,{className:`w-5 h-5 text-amber-400`}),`LeLab update available`]}),(0,B.jsxs)(sf,{className:`text-slate-300`,children:[`You're `,f,` 😱.`,(0,B.jsx)(`br`,{}),`Update to get the latest fixes and features 🤗.`,e.compare_url&&(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsx)(`a`,{href:e.compare_url,target:`_blank`,rel:`noreferrer`,className:`text-sky-300 underline hover:text-sky-200`,children:`See what changed`}),`.`]})]})]}),(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(Y_,{children:[(0,B.jsxs)(X_,{className:`group flex items-center gap-1.5 text-xs font-medium text-slate-300 hover:text-white transition-colors`,children:[(0,B.jsx)(fs,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Or update manually`]}),(0,B.jsx)(Z_,{className:`pt-2`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(`code`,{className:`min-w-0 flex-1 px-2 py-1.5 rounded bg-slate-900 text-sky-300 text-xs break-all whitespace-pre-wrap`,children:e.update_command}),(0,B.jsx)(q,{variant:`outline`,size:`icon`,onClick:async()=>{if(e.update_command)try{await navigator.clipboard.writeText(e.update_command),a({title:`Copied`,description:`Update command copied to clipboard.`})}catch{a({title:`Copy failed`,description:`Select and copy the command manually.`,variant:`destructive`})}},title:`Copy command`,className:`shrink-0 bg-slate-900 border-slate-600 text-white hover:bg-slate-700`,children:(0,B.jsx)(Cs,{className:`w-4 h-4`})})]})})]}),u&&(0,B.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded bg-slate-900 p-2 text-xs text-slate-300 whitespace-pre-wrap`,children:u}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,B.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,B.jsx)(B_,{checked:o,onCheckedChange:e=>s(e===!0),className:`border-slate-300 data-[state=checked]:bg-slate-300 data-[state=checked]:text-slate-900`}),`Don't ask me again`]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(q,{variant:`ghost`,onClick:()=>n(o),disabled:c,className:`text-slate-300 hover:bg-slate-700 hover:text-white`,children:`Later`}),e.can_auto_update&&(0,B.jsx)(q,{onClick:async()=>{l(!0),d(null);try{let e=await(await i(`${r}/system/update`,{method:`POST`})).json();e.success?(a({title:`Updated`,description:e.message}),n(!1)):(d(e.output||e.message),a({title:`Update failed`,description:e.message,variant:`destructive`}))}catch(e){a({title:`Update failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{l(!1)}},disabled:c,children:c?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ns,{className:`w-4 h-4 mr-2 animate-spin`}),`Updating…`]}):`Update now`})]})]})]})]})})},Vse=new Zr;function Hse(){return(0,B.jsx)(ei,{client:Vse,children:(0,B.jsx)(rh,{children:(0,B.jsx)(ni,{children:(0,B.jsx)(Cl,{children:(0,B.jsx)(El,{children:(0,B.jsx)(zi,{children:(0,B.jsx)(Hi,{children:(0,B.jsxs)(Mn,{children:[(0,B.jsx)(Lse,{children:(0,B.jsxs)(Hf,{children:[(0,B.jsx)(Rse,{}),(0,B.jsx)(Bse,{}),(0,B.jsxs)(Ht,{children:[(0,B.jsx)(z,{path:`/`,element:(0,B.jsx)(Kb,{})}),(0,B.jsx)(z,{path:`/teleoperation`,element:(0,B.jsx)(gN,{})}),(0,B.jsx)(z,{path:`/recording`,element:(0,B.jsx)(ure,{})}),(0,B.jsx)(z,{path:`/upload`,element:(0,B.jsx)(Mse,{})}),(0,B.jsx)(z,{path:`/training`,element:(0,B.jsx)(K9,{})}),(0,B.jsx)(z,{path:`/training/:jobId`,element:(0,B.jsx)(K9,{})}),(0,B.jsx)(z,{path:`/inference`,element:(0,B.jsx)(vse,{})}),(0,B.jsx)(z,{path:`/calibration`,element:(0,B.jsx)(PN,{})}),(0,B.jsx)(z,{path:`/edit-dataset`,element:(0,B.jsx)(jse,{})}),(0,B.jsx)(z,{path:`*`,element:(0,B.jsx)(Nse,{})})]})]})}),(0,B.jsx)(al,{})]})})})})})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,B.jsx)(Hse,{})); \ No newline at end of file diff --git a/frontend/dist/assets/index-CnBnxzjL.css b/frontend/dist/assets/index-CnBnxzjL.css new file mode 100644 index 00000000..bb2b6a4a --- /dev/null +++ b/frontend/dist/assets/index-CnBnxzjL.css @@ -0,0 +1 @@ +*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--secondary:210 40% 96.1%;--secondary-foreground:222.2 47.4% 11.2%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--radius:.5rem;--sidebar-background:0 0% 98%;--sidebar-foreground:240 5.3% 26.1%;--sidebar-primary:240 5.9% 10%;--sidebar-primary-foreground:0 0% 98%;--sidebar-accent:240 4.8% 95.9%;--sidebar-accent-foreground:240 5.9% 10%;--sidebar-border:220 13% 91%;--sidebar-ring:217.2 91.2% 59.8%}.dark{--background:222.2 84% 4.9%;--foreground:210 40% 98%;--card:222.2 84% 4.9%;--card-foreground:210 40% 98%;--popover:222.2 84% 4.9%;--popover-foreground:210 40% 98%;--primary:210 40% 98%;--primary-foreground:222.2 47.4% 11.2%;--secondary:217.2 32.6% 17.5%;--secondary-foreground:210 40% 98%;--muted:217.2 32.6% 17.5%;--muted-foreground:215 20.2% 65.1%;--accent:217.2 32.6% 17.5%;--accent-foreground:210 40% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:210 40% 98%;--border:217.2 32.6% 17.5%;--input:217.2 32.6% 17.5%;--ring:212.7 26.8% 83.9%;--sidebar-background:240 5.9% 10%;--sidebar-foreground:240 4.8% 95.9%;--sidebar-primary:224.3 76.3% 48%;--sidebar-primary-foreground:0 0% 100%;--sidebar-accent:240 3.7% 15.9%;--sidebar-accent-foreground:240 4.8% 95.9%;--sidebar-border:240 3.7% 15.9%;--sidebar-ring:217.2 91.2% 59.8%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem}@media (width>=1400px){.container{max-width:1400px}}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-4{bottom:1rem}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[45\]{z-index:45}.z-\[9999\]{z-index:9999}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.\!grid{display:grid!important}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-\[4\/3\]{aspect-ratio:4/3}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[52px\]{height:52px}.h-\[64px\]{height:64px}.h-\[68px\]{height:68px}.h-\[95vh\]{height:95vh}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-40{max-height:10rem}.max-h-96{max-height:24rem}.max-h-\[22vh\]{max-height:22vh}.max-h-\[300px\]{max-height:300px}.max-h-\[42vh\]{max-height:42vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100vh_-_280px\)\]{max-height:calc(100vh - 280px)}.max-h-screen{max-height:100vh}.min-h-0{min-height:0}.min-h-\[120px\]{min-height:120px}.min-h-\[50vh\]{min-height:50vh}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[--radix-popover-trigger-width\]{width:var(--radix-popover-trigger-width)}.w-\[1px\]{width:1px}.w-\[320px\]{width:320px}.w-\[340px\]{width:340px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0}.min-w-\[110px\]{min-width:110px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-\[1400px\]{max-width:1400px}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.content-center{align-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-px{gap:1px}.gap-x-5{-moz-column-gap:1.25rem;column-gap:1.25rem}.gap-y-1{row-gap:.25rem}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-amber-700{--tw-border-opacity:1;border-color:rgb(180 83 9/var(--tw-border-opacity,1))}.border-amber-700\/60{border-color:#b4530999}.border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity,1))}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity,1))}.border-gray-800{--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity,1))}.border-gray-900{--tw-border-opacity:1;border-color:rgb(17 24 39/var(--tw-border-opacity,1))}.border-green-600{--tw-border-opacity:1;border-color:rgb(22 163 74/var(--tw-border-opacity,1))}.border-green-700{--tw-border-opacity:1;border-color:rgb(21 128 61/var(--tw-border-opacity,1))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-purple-700{--tw-border-opacity:1;border-color:rgb(126 34 206/var(--tw-border-opacity,1))}.border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.border-red-500\/40{border-color:#ef444466}.border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.border-red-800{--tw-border-opacity:1;border-color:rgb(153 27 27/var(--tw-border-opacity,1))}.border-red-900\/50{border-color:#7f1d1d80}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity,1))}.border-slate-600{--tw-border-opacity:1;border-color:rgb(71 85 105/var(--tw-border-opacity,1))}.border-slate-700{--tw-border-opacity:1;border-color:rgb(51 65 85/var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-yellow-700{--tw-border-opacity:1;border-color:rgb(161 98 7/var(--tw-border-opacity,1))}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity:1;background-color:rgb(251 191 36/var(--tw-bg-opacity,1))}.bg-amber-500{--tw-bg-opacity:1;background-color:rgb(245 158 11/var(--tw-bg-opacity,1))}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/40{background-color:#f59e0b66}.bg-amber-600{--tw-bg-opacity:1;background-color:rgb(217 119 6/var(--tw-bg-opacity,1))}.bg-amber-900\/40{background-color:#78350f66}.bg-amber-950\/40{background-color:#451a0366}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/30{background-color:#0000004d}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-emerald-400{--tw-bg-opacity:1;background-color:rgb(52 211 153/var(--tw-bg-opacity,1))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.bg-gray-500\/15{background-color:#6b728026}.bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-800\/80{background-color:#1f2937cc}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.bg-gray-900\/60{background-color:#11182799}.bg-gray-900\/80{background-color:#111827cc}.bg-gray-950{--tw-bg-opacity:1;background-color:rgb(3 7 18/var(--tw-bg-opacity,1))}.bg-green-400{--tw-bg-opacity:1;background-color:rgb(74 222 128/var(--tw-bg-opacity,1))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.bg-green-500\/15{background-color:#22c55e26}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.bg-green-900\/20{background-color:#14532d33}.bg-green-900\/50{background-color:#14532d80}.bg-green-900\/70{background-color:#14532db3}.bg-muted{background-color:hsl(var(--muted))}.bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity:1;background-color:rgb(234 88 12/var(--tw-bg-opacity,1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-purple-500{--tw-bg-opacity:1;background-color:rgb(168 85 247/var(--tw-bg-opacity,1))}.bg-purple-900\/50{background-color:#581c8780}.bg-red-400{--tw-bg-opacity:1;background-color:rgb(248 113 113/var(--tw-bg-opacity,1))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/30{background-color:#ef44444d}.bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/40{background-color:#7f1d1d66}.bg-red-900\/50{background-color:#7f1d1d80}.bg-red-900\/70{background-color:#7f1d1db3}.bg-red-950\/30{background-color:#450a0a4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-500{--tw-bg-opacity:1;background-color:rgb(100 116 139/var(--tw-bg-opacity,1))}.bg-slate-600{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.bg-slate-700{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.bg-slate-800{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.bg-slate-800\/40{background-color:#1e293b66}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity,1))}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-transparent{background-color:#0000}.bg-yellow-400{--tw-bg-opacity:1;background-color:rgb(250 204 21/var(--tw-bg-opacity,1))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity,1))}.bg-yellow-900\/50{background-color:#713f1280}.bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right, var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right, var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from:#3b82f6 var(--tw-gradient-from-position);--tw-gradient-to:#3b82f600 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-900{--tw-gradient-from:#111827 var(--tw-gradient-from-position);--tw-gradient-to:#11182700 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.to-gray-800{--tw-gradient-to:#1f2937 var(--tw-gradient-to-position)}.to-sky-400{--tw-gradient-to:#38bdf8 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-24{padding-bottom:6rem}.pl-1{padding-left:.25rem}.pl-8{padding-left:2rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-7xl{font-size:4.5rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-amber-100{--tw-text-opacity:1;color:rgb(254 243 199/var(--tw-text-opacity,1))}.text-amber-200{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.text-amber-200\/80{color:#fde68acc}.text-amber-300{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.text-amber-400{--tw-text-opacity:1;color:rgb(251 191 36/var(--tw-text-opacity,1))}.text-amber-400\/80{color:#fbbf24cc}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.text-green-200{--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity,1))}.text-green-300{--tw-text-opacity:1;color:rgb(134 239 172/var(--tw-text-opacity,1))}.text-green-400{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity,1))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-orange-300{--tw-text-opacity:1;color:rgb(253 186 116/var(--tw-text-opacity,1))}.text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-200{--tw-text-opacity:1;color:rgb(233 213 255/var(--tw-text-opacity,1))}.text-purple-300{--tw-text-opacity:1;color:rgb(216 180 254/var(--tw-text-opacity,1))}.text-purple-400{--tw-text-opacity:1;color:rgb(192 132 252/var(--tw-text-opacity,1))}.text-red-100{--tw-text-opacity:1;color:rgb(254 226 226/var(--tw-text-opacity,1))}.text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.text-red-400\/80{color:#f87171cc}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sky-300{--tw-text-opacity:1;color:rgb(125 211 252/var(--tw-text-opacity,1))}.text-sky-400{--tw-text-opacity:1;color:rgb(56 189 248/var(--tw-text-opacity,1))}.text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.text-slate-300{--tw-text-opacity:1;color:rgb(203 213 225/var(--tw-text-opacity,1))}.text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.text-teal-400{--tw-text-opacity:1;color:rgb(45 212 191/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-white\/70{color:#ffffffb3}.text-yellow-200{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.text-yellow-300{--tw-text-opacity:1;color:rgb(253 224 71/var(--tw-text-opacity,1))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.accent-orange-500{accent-color:#f97316}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-red-500\/30{--tw-shadow-color:#ef44444d;--tw-shadow:var(--tw-shadow-colored)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-blue-400\/80{--tw-ring-color:#60a5facc}.ring-gray-800{--tw-ring-opacity:1;--tw-ring-color:rgb(31 41 55/var(--tw-ring-opacity,1))}.ring-orange-500{--tw-ring-opacity:1;--tw-ring-color:rgb(249 115 22/var(--tw-ring-opacity,1))}.ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.drop-shadow{--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0), var(--tw-enter-translate-y,0), 0) scale3d(var(--tw-enter-scale,1), var(--tw-enter-scale,1), var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0), var(--tw-exit-translate-y,0), 0) scale3d(var(--tw-exit-scale,1), var(--tw-exit-scale,1), var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.fade-in-0{--tw-enter-opacity:0}.zoom-in-95{--tw-enter-scale:.95}.duration-100{animation-duration:.1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-75{animation-duration:75ms}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.\[appearance\:textfield\]{appearance:textfield}.file\:border-0::file-selector-button{border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.last\:border-b-0:last-child{border-bottom-width:0}.hover\:border-blue-500:hover{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.hover\:border-gray-200:hover{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.hover\:border-gray-600:hover{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.hover\:border-red-400:hover{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.hover\:border-slate-500:hover{--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity,1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-700:hover{--tw-bg-opacity:1;background-color:rgb(180 83 9/var(--tw-bg-opacity,1))}.hover\:bg-amber-900\/40:hover{background-color:#78350f66}.hover\:bg-blue-600:hover{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.hover\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-500:hover{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.hover\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.hover\:bg-gray-900:hover{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.hover\:bg-green-600:hover{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.hover\:bg-green-700:hover{--tw-bg-opacity:1;background-color:rgb(21 128 61/var(--tw-bg-opacity,1))}.hover\:bg-orange-500:hover{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.hover\:bg-orange-600:hover{--tw-bg-opacity:1;background-color:rgb(234 88 12/var(--tw-bg-opacity,1))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-purple-600:hover{--tw-bg-opacity:1;background-color:rgb(147 51 234/var(--tw-bg-opacity,1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.hover\:bg-red-700:hover{--tw-bg-opacity:1;background-color:rgb(185 28 28/var(--tw-bg-opacity,1))}.hover\:bg-red-900\/20:hover{background-color:#7f1d1d33}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-600:hover{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.hover\:bg-slate-700:hover{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.hover\:bg-slate-800:hover{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity:1;background-color:rgb(202 138 4/var(--tw-bg-opacity,1))}.hover\:bg-zinc-800:hover{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-200:hover{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.hover\:text-amber-50:hover{--tw-text-opacity:1;color:rgb(255 251 235/var(--tw-text-opacity,1))}.hover\:text-blue-300:hover{--tw-text-opacity:1;color:rgb(147 197 253/var(--tw-text-opacity,1))}.hover\:text-blue-400:hover{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.hover\:text-blue-700:hover{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-gray-200:hover{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.hover\:text-red-300:hover{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.hover\:text-sky-200:hover{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:text-yellow-200:hover{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.hover\:shadow-red-500\/40:hover{--tw-shadow-color:#ef444466;--tw-shadow:var(--tw-shadow-colored)}.hover\:ring-gray-600:hover{--tw-ring-opacity:1;--tw-ring-color:rgb(75 85 99/var(--tw-ring-opacity,1))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-800:focus{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-red-300:focus{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.focus\:text-white:focus{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline-offset:2px;outline:2px solid #0000}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-inset:focus-visible{--tw-ring-inset:inset}.focus-visible\:ring-orange-400:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(251 146 60/var(--tw-ring-opacity,1))}.focus-visible\:ring-orange-500:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(249 115 22/var(--tw-ring-opacity,1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-gray-500:disabled{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:bg-transparent:hover:disabled{background-color:#0000}.group:hover .group-hover\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity:1;color:rgb(254 242 242/var(--tw-text-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(248 113 113/var(--tw-ring-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color:#dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-selected\:bg-gray-700[aria-selected=true]{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x:1.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x:var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x:var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:border-red-500[data-state=checked]{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=checked\]\:bg-green-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=checked\]\:bg-red-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-slate-300[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity,1))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=checked\]\:text-slate-900[data-state=checked]{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity:.8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:.5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:.5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x:100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y:-100%}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-\[backdrop-filter\]\:bg-black\/70{background-color:#000000b3}}@media (prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}@media (width>=640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:mt-0{margin-top:0}.sm\:w-60{width:15rem}.sm\:w-\[380px\]{width:380px}.sm\:w-auto{width:auto}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[520px\]{max-width:520px}.sm\:max-w-\[600px\]{max-width:600px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-xl{max-width:36rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-row-reverse{flex-direction:row-reverse}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:self-auto{align-self:auto}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-center{text-align:center}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y:100%}}@media (width>=768px){.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (width>=1024px){.lg\:min-h-0{min-height:0}.lg\:w-1\/2{width:50%}.lg\:w-96{width:24rem}.lg\:w-full{width:100%}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1\.2fr_2fr\]{grid-template-columns:1.2fr 2fr}.lg\:grid-cols-\[260px_1fr\]{grid-template-columns:260px 1fr}.lg\:flex-row{flex-direction:row}.lg\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}}.\[\&\:\:-webkit-inner-spin-button\]\:m-0::-webkit-inner-spin-button{margin:0}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:m-0::-webkit-outer-spin-button{margin:0}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{appearance:none}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y:-3px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} diff --git a/frontend/dist/assets/index-DJuBJMLM.css b/frontend/dist/assets/index-DJuBJMLM.css deleted file mode 100644 index 2d08097e..00000000 --- a/frontend/dist/assets/index-DJuBJMLM.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--secondary:210 40% 96.1%;--secondary-foreground:222.2 47.4% 11.2%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--radius:.5rem;--sidebar-background:0 0% 98%;--sidebar-foreground:240 5.3% 26.1%;--sidebar-primary:240 5.9% 10%;--sidebar-primary-foreground:0 0% 98%;--sidebar-accent:240 4.8% 95.9%;--sidebar-accent-foreground:240 5.9% 10%;--sidebar-border:220 13% 91%;--sidebar-ring:217.2 91.2% 59.8%}.dark{--background:222.2 84% 4.9%;--foreground:210 40% 98%;--card:222.2 84% 4.9%;--card-foreground:210 40% 98%;--popover:222.2 84% 4.9%;--popover-foreground:210 40% 98%;--primary:210 40% 98%;--primary-foreground:222.2 47.4% 11.2%;--secondary:217.2 32.6% 17.5%;--secondary-foreground:210 40% 98%;--muted:217.2 32.6% 17.5%;--muted-foreground:215 20.2% 65.1%;--accent:217.2 32.6% 17.5%;--accent-foreground:210 40% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:210 40% 98%;--border:217.2 32.6% 17.5%;--input:217.2 32.6% 17.5%;--ring:212.7 26.8% 83.9%;--sidebar-background:240 5.9% 10%;--sidebar-foreground:240 4.8% 95.9%;--sidebar-primary:224.3 76.3% 48%;--sidebar-primary-foreground:0 0% 100%;--sidebar-accent:240 3.7% 15.9%;--sidebar-accent-foreground:240 4.8% 95.9%;--sidebar-border:240 3.7% 15.9%;--sidebar-ring:217.2 91.2% 59.8%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem}@media (width>=1400px){.container{max-width:1400px}}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-4{bottom:1rem}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[45\]{z-index:45}.z-\[9999\]{z-index:9999}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-\[4\/3\]{aspect-ratio:4/3}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[52px\]{height:52px}.h-\[64px\]{height:64px}.h-\[68px\]{height:68px}.h-\[95vh\]{height:95vh}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-40{max-height:10rem}.max-h-96{max-height:24rem}.max-h-\[22vh\]{max-height:22vh}.max-h-\[300px\]{max-height:300px}.max-h-\[42vh\]{max-height:42vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100vh_-_280px\)\]{max-height:calc(100vh - 280px)}.max-h-screen{max-height:100vh}.min-h-0{min-height:0}.min-h-\[120px\]{min-height:120px}.min-h-\[50vh\]{min-height:50vh}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[--radix-popover-trigger-width\]{width:var(--radix-popover-trigger-width)}.w-\[1px\]{width:1px}.w-\[320px\]{width:320px}.w-\[340px\]{width:340px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0}.min-w-\[110px\]{min-width:110px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-\[1400px\]{max-width:1400px}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.content-center{align-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-px{gap:1px}.gap-x-5{-moz-column-gap:1.25rem;column-gap:1.25rem}.gap-y-1{row-gap:.25rem}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-amber-700{--tw-border-opacity:1;border-color:rgb(180 83 9/var(--tw-border-opacity,1))}.border-amber-700\/60{border-color:#b4530999}.border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity,1))}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity,1))}.border-gray-800{--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity,1))}.border-gray-900{--tw-border-opacity:1;border-color:rgb(17 24 39/var(--tw-border-opacity,1))}.border-green-600{--tw-border-opacity:1;border-color:rgb(22 163 74/var(--tw-border-opacity,1))}.border-green-700{--tw-border-opacity:1;border-color:rgb(21 128 61/var(--tw-border-opacity,1))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-purple-700{--tw-border-opacity:1;border-color:rgb(126 34 206/var(--tw-border-opacity,1))}.border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.border-red-500\/40{border-color:#ef444466}.border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.border-red-800{--tw-border-opacity:1;border-color:rgb(153 27 27/var(--tw-border-opacity,1))}.border-red-900\/50{border-color:#7f1d1d80}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity,1))}.border-slate-600{--tw-border-opacity:1;border-color:rgb(71 85 105/var(--tw-border-opacity,1))}.border-slate-700{--tw-border-opacity:1;border-color:rgb(51 65 85/var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-yellow-700{--tw-border-opacity:1;border-color:rgb(161 98 7/var(--tw-border-opacity,1))}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity:1;background-color:rgb(251 191 36/var(--tw-bg-opacity,1))}.bg-amber-500{--tw-bg-opacity:1;background-color:rgb(245 158 11/var(--tw-bg-opacity,1))}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/40{background-color:#f59e0b66}.bg-amber-600{--tw-bg-opacity:1;background-color:rgb(217 119 6/var(--tw-bg-opacity,1))}.bg-amber-900\/40{background-color:#78350f66}.bg-amber-950\/40{background-color:#451a0366}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/30{background-color:#0000004d}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-emerald-400{--tw-bg-opacity:1;background-color:rgb(52 211 153/var(--tw-bg-opacity,1))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.bg-gray-500\/15{background-color:#6b728026}.bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-800\/80{background-color:#1f2937cc}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.bg-gray-900\/60{background-color:#11182799}.bg-gray-900\/80{background-color:#111827cc}.bg-gray-950{--tw-bg-opacity:1;background-color:rgb(3 7 18/var(--tw-bg-opacity,1))}.bg-green-400{--tw-bg-opacity:1;background-color:rgb(74 222 128/var(--tw-bg-opacity,1))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.bg-green-500\/15{background-color:#22c55e26}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.bg-green-900\/20{background-color:#14532d33}.bg-green-900\/50{background-color:#14532d80}.bg-green-900\/70{background-color:#14532db3}.bg-muted{background-color:hsl(var(--muted))}.bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity:1;background-color:rgb(234 88 12/var(--tw-bg-opacity,1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-purple-500{--tw-bg-opacity:1;background-color:rgb(168 85 247/var(--tw-bg-opacity,1))}.bg-purple-900\/50{background-color:#581c8780}.bg-red-400{--tw-bg-opacity:1;background-color:rgb(248 113 113/var(--tw-bg-opacity,1))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/30{background-color:#ef44444d}.bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/40{background-color:#7f1d1d66}.bg-red-900\/50{background-color:#7f1d1d80}.bg-red-900\/70{background-color:#7f1d1db3}.bg-red-950\/30{background-color:#450a0a4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-500{--tw-bg-opacity:1;background-color:rgb(100 116 139/var(--tw-bg-opacity,1))}.bg-slate-600{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.bg-slate-700{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.bg-slate-800{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.bg-slate-800\/40{background-color:#1e293b66}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity,1))}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-transparent{background-color:#0000}.bg-yellow-400{--tw-bg-opacity:1;background-color:rgb(250 204 21/var(--tw-bg-opacity,1))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity,1))}.bg-yellow-900\/50{background-color:#713f1280}.bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right, var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right, var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from:#3b82f6 var(--tw-gradient-from-position);--tw-gradient-to:#3b82f600 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-900{--tw-gradient-from:#111827 var(--tw-gradient-from-position);--tw-gradient-to:#11182700 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.to-gray-800{--tw-gradient-to:#1f2937 var(--tw-gradient-to-position)}.to-sky-400{--tw-gradient-to:#38bdf8 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-24{padding-bottom:6rem}.pl-1{padding-left:.25rem}.pl-8{padding-left:2rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-7xl{font-size:4.5rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-amber-100{--tw-text-opacity:1;color:rgb(254 243 199/var(--tw-text-opacity,1))}.text-amber-200{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.text-amber-200\/80{color:#fde68acc}.text-amber-300{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.text-amber-400{--tw-text-opacity:1;color:rgb(251 191 36/var(--tw-text-opacity,1))}.text-amber-400\/80{color:#fbbf24cc}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.text-green-200{--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity,1))}.text-green-300{--tw-text-opacity:1;color:rgb(134 239 172/var(--tw-text-opacity,1))}.text-green-400{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity,1))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-orange-300{--tw-text-opacity:1;color:rgb(253 186 116/var(--tw-text-opacity,1))}.text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-200{--tw-text-opacity:1;color:rgb(233 213 255/var(--tw-text-opacity,1))}.text-purple-300{--tw-text-opacity:1;color:rgb(216 180 254/var(--tw-text-opacity,1))}.text-purple-400{--tw-text-opacity:1;color:rgb(192 132 252/var(--tw-text-opacity,1))}.text-red-100{--tw-text-opacity:1;color:rgb(254 226 226/var(--tw-text-opacity,1))}.text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.text-red-400\/80{color:#f87171cc}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sky-300{--tw-text-opacity:1;color:rgb(125 211 252/var(--tw-text-opacity,1))}.text-sky-400{--tw-text-opacity:1;color:rgb(56 189 248/var(--tw-text-opacity,1))}.text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.text-slate-300{--tw-text-opacity:1;color:rgb(203 213 225/var(--tw-text-opacity,1))}.text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.text-teal-400{--tw-text-opacity:1;color:rgb(45 212 191/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-white\/70{color:#ffffffb3}.text-yellow-200{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.text-yellow-300{--tw-text-opacity:1;color:rgb(253 224 71/var(--tw-text-opacity,1))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.accent-orange-500{accent-color:#f97316}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-red-500\/30{--tw-shadow-color:#ef44444d;--tw-shadow:var(--tw-shadow-colored)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-blue-400\/80{--tw-ring-color:#60a5facc}.ring-gray-800{--tw-ring-opacity:1;--tw-ring-color:rgb(31 41 55/var(--tw-ring-opacity,1))}.ring-orange-500{--tw-ring-opacity:1;--tw-ring-color:rgb(249 115 22/var(--tw-ring-opacity,1))}.ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.drop-shadow{--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0), var(--tw-enter-translate-y,0), 0) scale3d(var(--tw-enter-scale,1), var(--tw-enter-scale,1), var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0), var(--tw-exit-translate-y,0), 0) scale3d(var(--tw-exit-scale,1), var(--tw-exit-scale,1), var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.fade-in-0{--tw-enter-opacity:0}.zoom-in-95{--tw-enter-scale:.95}.duration-100{animation-duration:.1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-75{animation-duration:75ms}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.\[appearance\:textfield\]{appearance:textfield}.file\:border-0::file-selector-button{border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.last\:border-b-0:last-child{border-bottom-width:0}.hover\:border-blue-500:hover{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.hover\:border-gray-200:hover{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.hover\:border-gray-600:hover{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.hover\:border-red-400:hover{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.hover\:border-slate-500:hover{--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity,1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-700:hover{--tw-bg-opacity:1;background-color:rgb(180 83 9/var(--tw-bg-opacity,1))}.hover\:bg-amber-900\/40:hover{background-color:#78350f66}.hover\:bg-blue-600:hover{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.hover\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-500:hover{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.hover\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.hover\:bg-gray-900:hover{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.hover\:bg-green-600:hover{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.hover\:bg-green-700:hover{--tw-bg-opacity:1;background-color:rgb(21 128 61/var(--tw-bg-opacity,1))}.hover\:bg-orange-500:hover{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.hover\:bg-orange-600:hover{--tw-bg-opacity:1;background-color:rgb(234 88 12/var(--tw-bg-opacity,1))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-purple-600:hover{--tw-bg-opacity:1;background-color:rgb(147 51 234/var(--tw-bg-opacity,1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.hover\:bg-red-700:hover{--tw-bg-opacity:1;background-color:rgb(185 28 28/var(--tw-bg-opacity,1))}.hover\:bg-red-900\/20:hover{background-color:#7f1d1d33}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-600:hover{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.hover\:bg-slate-700:hover{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.hover\:bg-slate-800:hover{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity:1;background-color:rgb(202 138 4/var(--tw-bg-opacity,1))}.hover\:bg-zinc-800:hover{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-200:hover{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.hover\:text-amber-50:hover{--tw-text-opacity:1;color:rgb(255 251 235/var(--tw-text-opacity,1))}.hover\:text-blue-300:hover{--tw-text-opacity:1;color:rgb(147 197 253/var(--tw-text-opacity,1))}.hover\:text-blue-400:hover{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.hover\:text-blue-700:hover{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-gray-200:hover{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.hover\:text-red-300:hover{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.hover\:text-sky-200:hover{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:text-yellow-200:hover{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.hover\:shadow-red-500\/40:hover{--tw-shadow-color:#ef444466;--tw-shadow:var(--tw-shadow-colored)}.hover\:ring-gray-600:hover{--tw-ring-opacity:1;--tw-ring-color:rgb(75 85 99/var(--tw-ring-opacity,1))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-800:focus{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-red-300:focus{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.focus\:text-white:focus{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline-offset:2px;outline:2px solid #0000}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-inset:focus-visible{--tw-ring-inset:inset}.focus-visible\:ring-orange-400:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(251 146 60/var(--tw-ring-opacity,1))}.focus-visible\:ring-orange-500:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(249 115 22/var(--tw-ring-opacity,1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-gray-500:disabled{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:bg-transparent:hover:disabled{background-color:#0000}.group:hover .group-hover\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity:1;color:rgb(254 242 242/var(--tw-text-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(248 113 113/var(--tw-ring-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color:#dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-selected\:bg-gray-700[aria-selected=true]{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x:1.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x:var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x:var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:border-red-500[data-state=checked]{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=checked\]\:bg-green-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=checked\]\:bg-red-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-slate-300[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity,1))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=checked\]\:text-slate-900[data-state=checked]{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity:.8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:.5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:.5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x:100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y:-100%}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-\[backdrop-filter\]\:bg-black\/70{background-color:#000000b3}}@media (prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}@media (width>=640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:mt-0{margin-top:0}.sm\:w-60{width:15rem}.sm\:w-\[380px\]{width:380px}.sm\:w-auto{width:auto}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[520px\]{max-width:520px}.sm\:max-w-\[600px\]{max-width:600px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-xl{max-width:36rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-row-reverse{flex-direction:row-reverse}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:self-auto{align-self:auto}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-center{text-align:center}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y:100%}}@media (width>=768px){.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (width>=1024px){.lg\:min-h-0{min-height:0}.lg\:w-1\/2{width:50%}.lg\:w-96{width:24rem}.lg\:w-full{width:100%}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1\.2fr_2fr\]{grid-template-columns:1.2fr 2fr}.lg\:grid-cols-\[260px_1fr\]{grid-template-columns:260px 1fr}.lg\:flex-row{flex-direction:row}.lg\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}}.\[\&\:\:-webkit-inner-spin-button\]\:m-0::-webkit-inner-spin-button{margin:0}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:m-0::-webkit-outer-spin-button{margin:0}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{appearance:none}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y:-3px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 60470b3d..9e77a54b 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -10,8 +10,8 @@ - - + + diff --git a/frontend/src/components/UrdfViewer.tsx b/frontend/src/components/UrdfViewer.tsx index 60e0b59f..30e2b5cf 100644 --- a/frontend/src/components/UrdfViewer.tsx +++ b/frontend/src/components/UrdfViewer.tsx @@ -13,6 +13,7 @@ import { useUrdf } from "@/hooks/useUrdf"; import { useRealTimeJoints } from "@/hooks/useRealTimeJoints"; import { createUrdfViewer, + fitGridToRobot, setupMeshLoader, setupJointHighlighting, setupModelLoading, @@ -191,6 +192,11 @@ const UrdfViewer: React.FC = () => { // Get the maximum dimension to ensure the entire robot is visible const maxDim = Math.max(size.x, size.y, size.z); + // Rescale the ground grid to this robot's actual unit scale — it + // starts as a 1x1 placeholder since it's created before any model + // is loaded (see createUrdfViewer). + fitGridToRobot(viewer, center, boundingBox.min.y, maxDim); + // Position camera to see the center of the model viewer.camera.position.copy(center); diff --git a/frontend/src/lib/urdfViewerHelpers.ts b/frontend/src/lib/urdfViewerHelpers.ts index d71df6d5..acd6e2db 100644 --- a/frontend/src/lib/urdfViewerHelpers.ts +++ b/frontend/src/lib/urdfViewerHelpers.ts @@ -6,6 +6,7 @@ import { Color, AmbientLight, DirectionalLight, + GridHelper, Scene, } from "three"; import { toast } from "@/components/ui/sonner"; @@ -32,6 +33,9 @@ export interface URDFViewerElement extends HTMLElement { scene: Scene; } +/** Object3D.name of the ground grid added in createUrdfViewer, for lookup by fitGridToRobot. */ +export const FLOOR_GRID_NAME = "leLab-floor-grid"; + /** * Creates and configures a URDF viewer element */ @@ -66,12 +70,52 @@ export function createUrdfViewer( directionalLight.castShadow = true; viewer.scene.add(directionalLight); + // Ground grid, for a sense of scale and distance while teleoperating. + // Added directly to `scene` (not `world`), which stays in three.js's + // native Y-up frame regardless of the URDF's own up axis — `_setUp` on the + // viewer element compensates for that by rotating `world` instead, so a + // GridHelper here (built flat in the XZ plane) needs no rotation of its + // own to lie under the robot. Sized to a 1x1 unit placeholder at creation; + // `fitGridToRobot` rescales and repositions it once a model's bounding box + // is known, since that can be any real-world unit depending on the URDF. + const grid = new GridHelper(1, 10, 0x6b6b7a, 0x44424f); + grid.name = FLOOR_GRID_NAME; + viewer.scene.add(grid); + // Camera position is no longer adjusted automatically to prevent auto-zooming. // The user can control the view with the mouse. return viewer; } +/** + * Rescale and reposition the ground grid to sit under a newly-loaded robot. + * + * The grid is built at a fixed 1x1 size since createUrdfViewer runs before + * any model exists, so it has no sense of the URDF's unit scale — this call + * (made once the robot's bounding box is known, alongside the existing + * camera auto-fit) is what actually sizes it. `center`/`minY`/`maxDim` are + * passed in rather than recomputed so callers that already have a bounding + * box (fitRobotToView) don't compute it twice. + */ +export function fitGridToRobot( + viewer: URDFViewerElement, + center: Vector3, + minY: number, + maxDim: number +): void { + const grid = viewer.scene.getObjectByName(FLOOR_GRID_NAME); + if (!grid) return; + + // Framed a few grid-widths wider than the robot so it reads as a floor + // rather than a tight box drawn around the model. + const size = Math.max(maxDim * 4, 0.01); + grid.scale.setScalar(size); + // A hair below the robot's lowest point avoids z-fighting with anything + // (a gripper, a mounting plate) that sits flush with its own base. + grid.position.set(center.x, minY - size * 0.001, center.z); +} + /** * Setup mesh loading function for URDF viewer */