var Cn=Object.defineProperty;var En=(e,t,n)=>t in e?Cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var x=(e,t,n)=>(En(e,typeof t!="symbol"?t+"":t,n),n);import{CameraComponent as Ei}from"./CameraComponent-58fbd542.js";import{DirectLightComponent as Ri}from"./DirectLight-0fa7f53a.js";import{PointLightComponent as Mi}from"./PointLight-f883778e.js";import{SpotLightComponent as _i}from"./SpotLight-02eefed3.js";import{MeshRendererComponent as Oi}from"./MeshRendererComponent-a800772d.js";import{SkinnedMeshRendererComponent as Ti}from"./SkinnedMeshRendererComponent-1cd56322.js";import{A as Ni,a as ki}from"./AnimatorStore-8eb82cef.js";import{SpriteRendererComponent as ji}from"./SpriteRendererComponent-51cfa5b4.js";import{SpriteMaskComponent as $i}from"./SpriteMaskComponent-5f72116d.js";import{C as Xi,D as Wi,F as Yi,H as Hi,P as Ki,a as Vi,S as Ji}from"./PhysicsStore-7031fe98.js";import{ScriptComponent as qi}from"./index-c8441bd1.js";import{TextRendererComponent as Qi}from"./TextRendererComponent-5ed8357f.js";import{LottieAnimationComponent as ts}from"./LottieAnimationComponent-df5c21dc.js";import{SpineAnimationComponent as rs}from"./SpineAnimationComponent-763f6d21.js";import{ParticleRendererComponent as is}from"./ParticleRendererComponent-4364ba69.js";import{TrailRendererComponent as as}from"./TrailRendererComponent-1fd0dcb9.js";import{aN as ct,aI as l,bv as X,e1 as pe,aG as ut,aJ as Fe,aU as Dn,aV as Rn,aC as E,aL as Je,e2 as Pn,e3 as Mn,e4 as An,b6 as _n,cF as In,bb as On,K as Ln,U as jt,O as Tn,e5 as Ge,L as Bn,bR as De,dy as Ft,u as Nn,bd as kn,x as le,bp as zn,aR as ve,be as jn}from"./index-a76b28be.js";import{u as Fn}from"./index-4d966268.js";import"./postmen-a4b10828.js";import{T as qe}from"./Tooltip-1d89ba5a.js";import{I as cs}from"./index-0e6d5ad9.js";import{P as ds}from"./PostProcessComponent-7b87a402.js";import{AudioComponent as hs}from"./AudioComponent-3c1e4e7b.js";import{TransformComponent as gs}from"./TransformComponent-794a7066.js";import{ButtonComponent as ms,ImageComponent as bs,TextComponent as ys,UICanvasComponent as xs,UIGroupComponent as ws,UITransformComponent as Ss}from"./index-27a26c69.js";import"./Component-c8533dc0.js";import"./LightBaseComponent-bf43176c.js";import"./createOnModelChange-b57a0da8.js";import"./ReferencedMaterial-8754168f.js";import"./MaterialInspector-b9e7c829.js";import"./IconPointFilled-4673caaf.js";import"./MeshRendererBaseComponent-817d34b7.js";import"./SpriteBaseComponent-eb3b0350.js";import"./FormItemArray-5fd4d94b.js";import"./Accordion-90fa6bfc.js";import"./create-script-property-context-model-0fe0258f.js";import"./TextureAsset-199dfb12.js";import"./enum-58295f88.js";import"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import"./AssetViewer-06848056.js";import"./ktx2-encoder-f09e14bc.js";import"./TaskQueue-05c94a4d.js";import"./ktx-parse.modern-6c9f771f.js";import"./GlTFAsset-33f6ae7a.js";import"./glTFIO-45ff9a17.js";import"./MaterialAsset-a562f072.js";import"./ProxyConfigs-ab5351dd.js";import"./MeshAsset-876a16c1.js";import"./index-e599c562.js";import"./MeshThumbnail-5c847b20.js";import"./AnimatorControllerAsset-f7c0ef7b.js";import"./bundlers-2baa0360.js";import"./AnimationClipAsset-c562ce9a.js";import"./module-04c2cdff.js";import"./module-6cc65702.js";import"./ShaderChunkAsset-f35271e2.js";import"./AmbientLightAsset-71ac08b2.js";import"./SpineSkeletonDataAsset-df3364ed.js";import"./FontAsset-366d2934.js";import"./SceneAsset-707b4310.js";import"./ShaderAsset-62ee0046.js";import"./ShaderUIScriptAsset-b7befe23.js";import"./PrimitiveMesh-e469ec9c.js";import"./XRReferenceImageAsset-ae1178a2.js";import"./module-0d03e6f6.js";import"./PrefabAsset-67f04dc2.js";import"./PhysicsMaterialAsset-881ae82b.js";import"./RenderTargetAsset-c3a95536.js";import"./AudioAsset-77dc8657.js";import"./index-3610d469.js";import"./MarkdownAsset-c3b198a4.js";import"./TextBaseComponent-ba51e5ac.js";import"./index-8d2137e9.js";import"./Menu-77e63435.js";import"./TransformBaseComponent-4bcb874a.js";import"./Callout-57548e81.js";/**
 * @license @tabler/icons-react v3.24.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var $n=ct("outline","grip-vertical","IconGripVertical",[["path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]]);/**
 * @license @tabler/icons-react v3.24.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var Un=ct("outline","reload","IconReload",[["path",{d:"M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747",key:"svg-0"}],["path",{d:"M20 4v5h-5",key:"svg-1"}]]);/**
 * @license @tabler/icons-react v3.24.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */var Xn=ct("filled","player-stop-filled","IconPlayerStopFilled",[["path",{d:"M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",key:"svg-0"}]]);const We=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function dt(e){return"nodeType"in e}function k(e){var t,n;return e?me(e)?e:dt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function ft(e){const{Document:t}=k(e);return e instanceof t}function _e(e){return me(e)?!1:e instanceof k(e).HTMLElement}function qt(e){return e instanceof k(e).SVGElement}function be(e){return e?me(e)?e.document:dt(e)?ft(e)?e:_e(e)||qt(e)?e.ownerDocument:document:document:document}const oe=We?l.useLayoutEffect:l.useEffect;function ht(e){const t=l.useRef(e);return oe(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Wn(){const e=l.useRef(null),t=l.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function pt(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return oe(()=>{n.current!==e&&(n.current=e)},t),n}function Ie(e,t){const n=l.useRef();return l.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function rt(e){const t=ht(e),n=l.useRef(null),r=l.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function ot(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let Ze={};function gt(e,t){return l.useMemo(()=>{if(t)return t;const n=Ze[e]==null?0:Ze[e]+1;return Ze[e]=n,e+"-"+n},[e,t])}function Zt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,a)=>{const s=Object.entries(a);for(const[c,u]of s){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const ge=Zt(1),$e=Zt(-1);function Yn(e){return"clientX"in e&&"clientY"in e}function Qt(e){if(!e)return!1;const{KeyboardEvent:t}=k(e.target);return t&&e instanceof t}function Hn(e){if(!e)return!1;const{TouchEvent:t}=k(e.target);return t&&e instanceof t}function it(e){if(Hn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Yn(e)?{x:e.clientX,y:e.clientY}:null}const $t="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Kn(e){return e.matches($t)?e:e.querySelector($t)}const Vn={display:"none"};function Jn(e){let{id:t,value:n}=e;return X.createElement("div",{id:t,style:Vn},n)}function Gn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return X.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function qn(){const[e,t]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const en=l.createContext(null);function Zn(e){const t=l.useContext(en);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Qn(){const[e]=l.useState(()=>new Set),t=l.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[l.useCallback(r=>{let{type:o,event:i}=r;e.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[e]),t]}const er={draggable:`
    To pick up a draggable item, press the space bar.
    While dragging, use the arrow keys to move the item.
    Press space again to drop the item in its new position, or press escape to cancel.
  `},tr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function nr(e){let{announcements:t=tr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=er}=e;const{announce:i,announcement:a}=qn(),s=gt("DndLiveRegion"),[c,u]=l.useState(!1);if(l.useEffect(()=>{u(!0)},[]),Zn(l.useMemo(()=>({onDragStart(f){let{active:g}=f;i(t.onDragStart({active:g}))},onDragMove(f){let{active:g,over:h}=f;t.onDragMove&&i(t.onDragMove({active:g,over:h}))},onDragOver(f){let{active:g,over:h}=f;i(t.onDragOver({active:g,over:h}))},onDragEnd(f){let{active:g,over:h}=f;i(t.onDragEnd({active:g,over:h}))},onDragCancel(f){let{active:g,over:h}=f;i(t.onDragCancel({active:g,over:h}))}}),[i,t])),!c)return null;const d=X.createElement(X.Fragment,null,X.createElement(Jn,{id:r,value:o.draggable}),X.createElement(Gn,{id:s,announcement:a}));return n?pe.createPortal(d,n):d}var I;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(I||(I={}));function Ue(){}const V=Object.freeze({x:0,y:0});function rr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function or(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function ir(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,s=i-n;if(r<o&&n<i){const c=t.width*t.height,u=e.width*e.height,d=a*s,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const sr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,s=n.get(a);if(s){const c=ir(s,t);c>0&&o.push({id:a,data:{droppableContainer:i,value:c}})}}return o.sort(rr)};function ar(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function tn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:V}function lr(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,s)=>({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const cr=lr(1);function ur(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function dr(e,t,n){const r=ur(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:s}=r,c=e.left-a-(1-o)*parseFloat(n),u=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const fr={ignoreTransform:!1};function Oe(e,t){t===void 0&&(t=fr);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=k(e).getComputedStyle(e);u&&(n=dr(n,u,d))}const{top:r,left:o,width:i,height:a,bottom:s,right:c}=n;return{top:r,left:o,width:i,height:a,bottom:s,right:c}}function Ut(e){return Oe(e,{ignoreTransform:!0})}function hr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function pr(e,t){return t===void 0&&(t=k(e).getComputedStyle(e)),t.position==="fixed"}function gr(e,t){t===void 0&&(t=k(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function vt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(ft(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!_e(o)||qt(o)||n.includes(o))return n;const i=k(e).getComputedStyle(o);return o!==e&&gr(o,i)&&n.push(o),pr(o,i)?n:r(o.parentNode)}return e?r(e):n}function nn(e){const[t]=vt(e,1);return t??null}function Qe(e){return!We||!e?null:me(e)?e:dt(e)?ft(e)||e===be(e).scrollingElement?window:_e(e)?e:null:null}function rn(e){return me(e)?e.scrollX:e.scrollLeft}function on(e){return me(e)?e.scrollY:e.scrollTop}function st(e){return{x:rn(e),y:on(e)}}var M;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(M||(M={}));function sn(e){return!We||!e?!1:e===document.scrollingElement}function an(e){const t={x:0,y:0},n=sn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const vr={x:.2,y:.2};function mr(e,t,n,r,o){let{top:i,left:a,right:s,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=vr);const{isTop:u,isBottom:d,isLeft:f,isRight:g}=an(e),h={x:0,y:0},S={x:0,y:0},p={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+p.height?(h.y=M.Backward,S.y=r*Math.abs((t.top+p.height-i)/p.height)):!d&&c>=t.bottom-p.height&&(h.y=M.Forward,S.y=r*Math.abs((t.bottom-p.height-c)/p.height)),!g&&s>=t.right-p.width?(h.x=M.Forward,S.x=r*Math.abs((t.right-p.width-s)/p.width)):!f&&a<=t.left+p.width&&(h.x=M.Backward,S.x=r*Math.abs((t.left+p.width-a)/p.width)),{direction:h,speed:S}}function br(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function ln(e){return e.reduce((t,n)=>ge(t,st(n)),V)}function yr(e){return e.reduce((t,n)=>t+rn(n),0)}function xr(e){return e.reduce((t,n)=>t+on(n),0)}function wr(e,t){if(t===void 0&&(t=Oe),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);nn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Sr=[["x",["left","right"],yr],["y",["top","bottom"],xr]];class mt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=vt(n),o=ln(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,s]of Sr)for(const c of a)Object.defineProperty(this,c,{get:()=>{const u=s(r),d=o[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Re{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Cr(e){const{EventTarget:t}=k(e);return e instanceof t?e:be(e)}function et(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var U;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(U||(U={}));function Xt(e){e.preventDefault()}function Er(e){e.stopPropagation()}var b;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(b||(b={}));const cn={start:[b.Space,b.Enter],cancel:[b.Esc],end:[b.Space,b.Enter]},Dr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case b.Right:return{...n,x:n.x+25};case b.Left:return{...n,x:n.x-25};case b.Down:return{...n,y:n.y+25};case b.Up:return{...n,y:n.y-25}}};class un{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Re(be(n)),this.windowListeners=new Re(k(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(U.Resize,this.handleCancel),this.windowListeners.add(U.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(U.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&wr(r),n(V)}handleKeyDown(t){if(Qt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=cn,coordinateGetter:a=Dr,scrollBehavior:s="smooth"}=o,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:V;this.referenceCoordinates||(this.referenceCoordinates=d);const f=a(t,{active:n,context:r.current,currentCoordinates:d});if(f){const g=$e(f,d),h={x:0,y:0},{scrollableAncestors:S}=r.current;for(const p of S){const v=t.code,{isTop:w,isRight:C,isLeft:D,isBottom:N,maxScroll:A,minScroll:R}=an(p),m=br(p),y={x:Math.min(v===b.Right?m.right-m.width/2:m.right,Math.max(v===b.Right?m.left:m.left+m.width/2,f.x)),y:Math.min(v===b.Down?m.bottom-m.height/2:m.bottom,Math.max(v===b.Down?m.top:m.top+m.height/2,f.y))},L=v===b.Right&&!C||v===b.Left&&!D,T=v===b.Down&&!N||v===b.Up&&!w;if(L&&y.x!==f.x){const P=p.scrollLeft+g.x,G=v===b.Right&&P<=A.x||v===b.Left&&P>=R.x;if(G&&!g.y){p.scrollTo({left:P,behavior:s});return}G?h.x=p.scrollLeft-P:h.x=v===b.Right?p.scrollLeft-A.x:p.scrollLeft-R.x,h.x&&p.scrollBy({left:-h.x,behavior:s});break}else if(T&&y.y!==f.y){const P=p.scrollTop+g.y,G=v===b.Down&&P<=A.y||v===b.Up&&P>=R.y;if(G&&!g.x){p.scrollTo({top:P,behavior:s});return}G?h.y=p.scrollTop-P:h.y=v===b.Down?p.scrollTop-A.y:p.scrollTop-R.y,h.y&&p.scrollBy({top:-h.y,behavior:s});break}}this.handleMove(t,ge($e(f,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}un.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=cn,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=i.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function Wt(e){return!!(e&&"distance"in e)}function Yt(e){return!!(e&&"delay"in e)}class bt{constructor(t,n,r){var o;r===void 0&&(r=Cr(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=be(a),this.documentListeners=new Re(this.document),this.listeners=new Re(r),this.windowListeners=new Re(k(a)),this.initialCoordinates=(o=it(i))!=null?o:V,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(U.Resize,this.handleCancel),this.windowListeners.add(U.DragStart,Xt),this.windowListeners.add(U.VisibilityChange,this.handleCancel),this.windowListeners.add(U.ContextMenu,Xt),this.documentListeners.add(U.Keydown,this.handleKeydown),n){if(Wt(n))return;if(Yt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(U.Click,Er,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(U.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!o)return;const c=(n=it(t))!=null?n:V,u=$e(o,c);if(!r&&s){if(Yt(s))return et(u,s.tolerance)?this.handleCancel():void 0;if(Wt(s))return s.tolerance!=null&&et(u,s.tolerance)?this.handleCancel():et(u,s.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),a(c)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===b.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Rr={move:{name:"pointermove"},end:{name:"pointerup"}};class dn extends bt{constructor(t){const{event:n}=t,r=be(n.target);super(t,Rr,r)}}dn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Pr={move:{name:"mousemove"},end:{name:"mouseup"}};var at;(function(e){e[e.RightClick=2]="RightClick"})(at||(at={}));class Mr extends bt{constructor(t){super(t,Pr,be(t.event.target))}}Mr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===at.RightClick?!1:(r==null||r({event:n}),!0)}}];const tt={move:{name:"touchmove"},end:{name:"touchend"}};class Ar extends bt{constructor(t){super(t,tt)}static setup(){return window.addEventListener(tt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(tt.move.name,t)};function t(){}}}Ar.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Pe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Pe||(Pe={}));var Xe;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Xe||(Xe={}));function _r(e){let{acceleration:t,activator:n=Pe.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:s=Xe.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:g}=e;const h=Or({delta:f,disabled:!i}),[S,p]=Wn(),v=l.useRef({x:0,y:0}),w=l.useRef({x:0,y:0}),C=l.useMemo(()=>{switch(n){case Pe.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Pe.DraggableRect:return o}},[n,o,c]),D=l.useRef(null),N=l.useCallback(()=>{const R=D.current;if(!R)return;const m=v.current.x*w.current.x,y=v.current.y*w.current.y;R.scrollBy(m,y)},[]),A=l.useMemo(()=>s===Xe.TreeOrder?[...u].reverse():u,[s,u]);l.useEffect(()=>{if(!i||!u.length||!C){p();return}for(const R of A){if((r==null?void 0:r(R))===!1)continue;const m=u.indexOf(R),y=d[m];if(!y)continue;const{direction:L,speed:T}=mr(R,y,C,t,g);for(const P of["x","y"])h[P][L[P]]||(T[P]=0,L[P]=0);if(T.x>0||T.y>0){p(),D.current=R,S(N,a),v.current=T,w.current=L;return}}v.current={x:0,y:0},w.current={x:0,y:0},p()},[t,N,r,p,i,a,JSON.stringify(C),JSON.stringify(h),S,u,A,d,JSON.stringify(g)])}const Ir={x:{[M.Backward]:!1,[M.Forward]:!1},y:{[M.Backward]:!1,[M.Forward]:!1}};function Or(e){let{delta:t,disabled:n}=e;const r=ot(t);return Ie(o=>{if(n||!r||!o)return Ir;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[M.Backward]:o.x[M.Backward]||i.x===-1,[M.Forward]:o.x[M.Forward]||i.x===1},y:{[M.Backward]:o.y[M.Backward]||i.y===-1,[M.Forward]:o.y[M.Forward]||i.y===1}}},[n,t,r])}function Lr(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return Ie(o=>{var i;return t===null?null:(i=r??o)!=null?i:null},[r,t])}function Tr(e,t){return l.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var Ae;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ae||(Ae={}));var lt;(function(e){e.Optimized="optimized"})(lt||(lt={}));const Ht=new Map;function Br(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=l.useState(null),{frequency:s,measure:c,strategy:u}=o,d=l.useRef(e),f=v(),g=pt(f),h=l.useCallback(function(w){w===void 0&&(w=[]),!g.current&&a(C=>C===null?w:C.concat(w.filter(D=>!C.includes(D))))},[g]),S=l.useRef(null),p=Ie(w=>{if(f&&!n)return Ht;if(!w||w===Ht||d.current!==e||i!=null){const C=new Map;for(let D of e){if(!D)continue;if(i&&i.length>0&&!i.includes(D.id)&&D.rect.current){C.set(D.id,D.rect.current);continue}const N=D.node.current,A=N?new mt(c(N),N):null;D.rect.current=A,A&&C.set(D.id,A)}return C}return w},[e,i,n,f,c]);return l.useEffect(()=>{d.current=e},[e]),l.useEffect(()=>{f||h()},[n,f]),l.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),l.useEffect(()=>{f||typeof s!="number"||S.current!==null||(S.current=setTimeout(()=>{h(),S.current=null},s))},[s,f,h,...r]),{droppableRects:p,measureDroppableContainers:h,measuringScheduled:i!=null};function v(){switch(u){case Ae.Always:return!1;case Ae.BeforeDragging:return n;default:return!n}}}function fn(e,t){return Ie(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Nr(e,t){return fn(e,t)}function kr(e){let{callback:t,disabled:n}=e;const r=ht(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return l.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function yt(e){let{callback:t,disabled:n}=e;const r=ht(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return l.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function zr(e){return new mt(Oe(e),e)}function Kt(e,t,n){t===void 0&&(t=zr);const[r,o]=l.useReducer(s,null),i=kr({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=yt({callback:o});return oe(()=>{o(),e?(a==null||a.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),i==null||i.disconnect())},[e]),r;function s(c){if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d}}function jr(e){const t=fn(e);return tn(e,t)}const Vt=[];function Fr(e){const t=l.useRef(e),n=Ie(r=>e?r&&r!==Vt&&e&&t.current&&e.parentNode===t.current.parentNode?r:vt(e):Vt,[e]);return l.useEffect(()=>{t.current=e},[e]),n}function $r(e){const[t,n]=l.useState(null),r=l.useRef(e),o=l.useCallback(i=>{const a=Qe(i.target);a&&n(s=>s?(s.set(a,st(a)),new Map(s)):null)},[]);return l.useEffect(()=>{const i=r.current;if(e!==i){a(i);const s=e.map(c=>{const u=Qe(c);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,st(u)]):null}).filter(c=>c!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(i)};function a(s){s.forEach(c=>{const u=Qe(c);u==null||u.removeEventListener("scroll",o)})}},[o,e]),l.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>ge(i,a),V):ln(e):V,[e,t])}function Jt(e,t){t===void 0&&(t=[]);const n=l.useRef(null);return l.useEffect(()=>{n.current=null},t),l.useEffect(()=>{const r=e!==V;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?$e(e,n.current):V}function Ur(e){l.useEffect(()=>{if(!We)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Xr(e,t){return l.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function hn(e){return l.useMemo(()=>e?hr(e):null,[e])}const nt=[];function Wr(e,t){t===void 0&&(t=Oe);const[n]=e,r=hn(n?k(n):null),[o,i]=l.useReducer(s,nt),a=yt({callback:i});return e.length>0&&o===nt&&i(),oe(()=>{e.length?e.forEach(c=>a==null?void 0:a.observe(c)):(a==null||a.disconnect(),i())},[e]),o;function s(){return e.length?e.map(c=>sn(c)?r:new mt(t(c),c)):nt}}function Yr(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return _e(t)?t:e}function Hr(e){let{measure:t}=e;const[n,r]=l.useState(null),o=l.useCallback(u=>{for(const{target:d}of u)if(_e(d)){r(f=>{const g=t(d);return f?{...f,width:g.width,height:g.height}:g});break}},[t]),i=yt({callback:o}),a=l.useCallback(u=>{const d=Yr(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),r(d?t(d):null)},[t,i]),[s,c]=rt(a);return l.useMemo(()=>({nodeRef:s,rect:n,setRef:c}),[n,s,c])}const Kr=[{sensor:dn,options:{}},{sensor:un,options:{}}],Vr={current:{}},je={draggable:{measure:Ut},droppable:{measure:Ut,strategy:Ae.WhileDragging,frequency:lt.Optimized},dragOverlay:{measure:Oe}};class Me extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Jr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Me,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ue},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:je,measureDroppableContainers:Ue,windowRect:null,measuringScheduled:!1},Gr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ue,draggableNodes:new Map,over:null,measureDroppableContainers:Ue},xt=l.createContext(Gr),qr=l.createContext(Jr);function Zr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Me}}}function Qr(e,t){switch(t.type){case I.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case I.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case I.DragEnd:case I.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case I.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Me(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case I.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Me(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case I.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Me(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function eo(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=l.useContext(xt),i=ot(r),a=ot(n==null?void 0:n.id);return l.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!Qt(i)||document.activeElement===i.target)return;const s=o.get(a);if(!s)return;const{activatorNode:c,node:u}=s;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=Kn(d);if(f){f.focus();break}}})}},[r,t,o,a,i]),null}function to(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function no(e){return l.useMemo(()=>({draggable:{...je.draggable,...e==null?void 0:e.draggable},droppable:{...je.droppable,...e==null?void 0:e.droppable},dragOverlay:{...je.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function ro(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=l.useRef(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;oe(()=>{if(!a&&!s||!t){i.current=!1;return}if(i.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=tn(d,r);if(a||(f.x=0),s||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=nn(u);g&&g.scrollBy({top:f.y,left:f.x})}},[t,a,s,r,n])}const pn=l.createContext({...V,scaleX:1,scaleY:1});var re;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(re||(re={}));const oo=l.memo(function(t){var n,r,o,i;let{id:a,accessibility:s,autoScroll:c=!0,children:u,sensors:d=Kr,collisionDetection:f=sr,measuring:g,modifiers:h,...S}=t;const p=l.useReducer(Qr,void 0,Zr),[v,w]=p,[C,D]=Qn(),[N,A]=l.useState(re.Uninitialized),R=N===re.Initialized,{draggable:{active:m,nodes:y,translate:L},droppable:{containers:T}}=v,P=m?y.get(m):null,G=l.useRef({initial:null,translated:null}),q=l.useMemo(()=>{var _;return m!=null?{id:m,data:(_=P==null?void 0:P.data)!=null?_:Vr,rect:G}:null},[m,P]),Q=l.useRef(null),[wt,St]=l.useState(null),[Z,Ct]=l.useState(null),ye=pt(S,Object.values(S)),Ye=gt("DndDescribedBy",a),Et=l.useMemo(()=>T.getEnabled(),[T]),ie=no(g),{droppableRects:ce,measureDroppableContainers:Le,measuringScheduled:Dt}=Br(Et,{dragging:R,dependencies:[L.x,L.y],config:ie.droppable}),W=Lr(y,m),Rt=l.useMemo(()=>Z?it(Z):null,[Z]),Pt=Sn(),Mt=Nr(W,ie.draggable.measure);ro({activeNode:m?y.get(m):null,config:Pt.layoutShiftCompensation,initialRect:Mt,measure:ie.draggable.measure});const Y=Kt(W,ie.draggable.measure,Mt),He=Kt(W?W.parentElement:null),se=l.useRef({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:ce,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),At=T.getNodeFor((n=se.current.over)==null?void 0:n.id),ae=Hr({measure:ie.dragOverlay.measure}),Te=(r=ae.nodeRef.current)!=null?r:W,ue=R?(o=ae.rect)!=null?o:Y:null,_t=!!(ae.nodeRef.current&&ae.rect),It=jr(_t?null:Y),Ke=hn(Te?k(Te):null),ee=Fr(R?At??W:null),Be=Wr(ee),Ne=to(h,{transform:{x:L.x-It.x,y:L.y-It.y,scaleX:1,scaleY:1},activatorEvent:Z,active:q,activeNodeRect:Y,containerNodeRect:He,draggingNodeRect:ue,over:se.current.over,overlayNodeRect:ae.rect,scrollableAncestors:ee,scrollableAncestorRects:Be,windowRect:Ke}),Ot=Rt?ge(Rt,L):null,Lt=$r(ee),gn=Jt(Lt),vn=Jt(Lt,[Y]),de=ge(Ne,gn),fe=ue?cr(ue,Ne):null,xe=q&&fe?f({active:q,collisionRect:fe,droppableRects:ce,droppableContainers:Et,pointerCoordinates:Ot}):null,Tt=or(xe,"id"),[te,Bt]=l.useState(null),mn=_t?Ne:ge(Ne,vn),bn=ar(mn,(i=te==null?void 0:te.rect)!=null?i:null,Y),Nt=l.useCallback((_,z)=>{let{sensor:j,options:ne}=z;if(Q.current==null)return;const $=y.get(Q.current);if(!$)return;const H=_.nativeEvent,J=new j({active:Q.current,activeNode:$,event:H,options:ne,context:se,onStart(K){const we=Q.current;if(we==null)return;const Se=y.get(we);if(!Se)return;const{onDragStart:ke}=ye.current,ze={active:{id:we,data:Se.data,rect:G}};pe.unstable_batchedUpdates(()=>{ke==null||ke(ze),A(re.Initializing),w({type:I.DragStart,initialCoordinates:K,active:we}),C({type:"onDragStart",event:ze})})},onMove(K){w({type:I.DragMove,coordinates:K})},onEnd:he(I.DragEnd),onCancel:he(I.DragCancel)});pe.unstable_batchedUpdates(()=>{St(J),Ct(_.nativeEvent)});function he(K){return async function(){const{active:Se,collisions:ke,over:ze,scrollAdjustedTranslate:zt}=se.current;let Ce=null;if(Se&&zt){const{cancelDrop:Ee}=ye.current;Ce={activatorEvent:H,active:Se,collisions:ke,delta:zt,over:ze},K===I.DragEnd&&typeof Ee=="function"&&await Promise.resolve(Ee(Ce))&&(K=I.DragCancel)}Q.current=null,pe.unstable_batchedUpdates(()=>{w({type:K}),A(re.Uninitialized),Bt(null),St(null),Ct(null);const Ee=K===I.DragEnd?"onDragEnd":"onDragCancel";if(Ce){const Ve=ye.current[Ee];Ve==null||Ve(Ce),C({type:Ee,event:Ce})}})}}},[y]),yn=l.useCallback((_,z)=>(j,ne)=>{const $=j.nativeEvent,H=y.get(ne);if(Q.current!==null||!H||$.dndKit||$.defaultPrevented)return;const J={active:H};_(j,z.options,J)===!0&&($.dndKit={capturedBy:z.sensor},Q.current=ne,Nt(j,z))},[y,Nt]),kt=Tr(d,yn);Ur(d),oe(()=>{Y&&N===re.Initializing&&A(re.Initialized)},[Y,N]),l.useEffect(()=>{const{onDragMove:_}=ye.current,{active:z,activatorEvent:j,collisions:ne,over:$}=se.current;if(!z||!j)return;const H={active:z,activatorEvent:j,collisions:ne,delta:{x:de.x,y:de.y},over:$};pe.unstable_batchedUpdates(()=>{_==null||_(H),C({type:"onDragMove",event:H})})},[de.x,de.y]),l.useEffect(()=>{const{active:_,activatorEvent:z,collisions:j,droppableContainers:ne,scrollAdjustedTranslate:$}=se.current;if(!_||Q.current==null||!z||!$)return;const{onDragOver:H}=ye.current,J=ne.get(Tt),he=J&&J.rect.current?{id:J.id,rect:J.rect.current,data:J.data,disabled:J.disabled}:null,K={active:_,activatorEvent:z,collisions:j,delta:{x:$.x,y:$.y},over:he};pe.unstable_batchedUpdates(()=>{Bt(he),H==null||H(K),C({type:"onDragOver",event:K})})},[Tt]),oe(()=>{se.current={activatorEvent:Z,active:q,activeNode:W,collisionRect:fe,collisions:xe,droppableRects:ce,draggableNodes:y,draggingNode:Te,draggingNodeRect:ue,droppableContainers:T,over:te,scrollableAncestors:ee,scrollAdjustedTranslate:de},G.current={initial:ue,translated:fe}},[q,W,xe,fe,y,Te,ue,ce,T,te,ee,de]),_r({...Pt,delta:L,draggingRect:fe,pointerCoordinates:Ot,scrollableAncestors:ee,scrollableAncestorRects:Be});const xn=l.useMemo(()=>({active:q,activeNode:W,activeNodeRect:Y,activatorEvent:Z,collisions:xe,containerNodeRect:He,dragOverlay:ae,draggableNodes:y,droppableContainers:T,droppableRects:ce,over:te,measureDroppableContainers:Le,scrollableAncestors:ee,scrollableAncestorRects:Be,measuringConfiguration:ie,measuringScheduled:Dt,windowRect:Ke}),[q,W,Y,Z,xe,He,ae,y,T,ce,te,Le,ee,Be,ie,Dt,Ke]),wn=l.useMemo(()=>({activatorEvent:Z,activators:kt,active:q,activeNodeRect:Y,ariaDescribedById:{draggable:Ye},dispatch:w,draggableNodes:y,over:te,measureDroppableContainers:Le}),[Z,kt,q,Y,w,Ye,y,te,Le]);return X.createElement(en.Provider,{value:D},X.createElement(xt.Provider,{value:wn},X.createElement(qr.Provider,{value:xn},X.createElement(pn.Provider,{value:bn},u)),X.createElement(eo,{disabled:(s==null?void 0:s.restoreFocus)===!1})),X.createElement(nr,{...s,hiddenTextDescribedById:Ye}));function Sn(){const _=(wt==null?void 0:wt.autoScrollEnabled)===!1,z=typeof c=="object"?c.enabled===!1:c===!1,j=R&&!_&&!z;return typeof c=="object"?{...c,enabled:j}:{enabled:j}}}),io=l.createContext(null),Gt="button",so="Droppable";function ao(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=gt(so),{activators:a,activatorEvent:s,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:g}=l.useContext(xt),{role:h=Gt,roleDescription:S="draggable",tabIndex:p=0}=o??{},v=(c==null?void 0:c.id)===t,w=l.useContext(v?pn:io),[C,D]=rt(),[N,A]=rt(),R=Xr(a,t),m=pt(n);oe(()=>(f.set(t,{id:t,key:i,node:C,activatorNode:N,data:m}),()=>{const L=f.get(t);L&&L.key===i&&f.delete(t)}),[f,t]);const y=l.useMemo(()=>({role:h,tabIndex:p,"aria-disabled":r,"aria-pressed":v&&h===Gt?!0:void 0,"aria-roledescription":S,"aria-describedby":d.draggable}),[r,h,p,v,S,d.draggable]);return{active:c,activatorEvent:s,activeNodeRect:u,attributes:y,isDragging:v,listeners:r?void 0:R,node:C,over:g,setNodeRef:D,setActivatorNodeRef:A,transform:w}}function lo(e,t,n){const r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}const co=e=>{let{containerNodeRect:t,draggingNodeRect:n,transform:r}=e;return!n||!t?r:lo(r,n,t)};var F=(e=>(e[e.Selected=0]="Selected",e[e.Everything=1]="Everything",e))(F||{});const uo=ut("div",{display:"flex",position:"absolute",flexDirection:"column",width:"260px",border:"1px solid $gray6",borderRadius:"$2",backgroundColor:"$panelBg",overflow:"hidden",userSelect:"none"}),fo=ut(Fe,{height:"$6",width:"100%",padding:"0 $1",backgroundColor:"$panelTitleBg",color:"$gray11",flexShrink:0,fontSize:"$sm"}),ho=ut(Fe,{padding:"$1"});function po(){const[{bottom:e,left:t},n]=l.useState({left:4,bottom:4}),r=l.useCallback(o=>{n(({bottom:i,left:a})=>{const{delta:s}=o;return{left:a+s.x,bottom:i+-s.y}})},[]);return E.jsx(oo,{modifiers:[co],onDragEnd:r,children:E.jsx(go,{left:t,bottom:e})})}const go=Dn(function(t){const{attributes:n,listeners:r,setNodeRef:o,transform:i}=ao({id:"ParticlePanel"}),{viewportStore:a}=Fn(),s=a.particleStore,{t:c}=Rn(),u={bottom:`${t.bottom}px`,left:`${t.left}px`,transform:i?`translate3d(${i.x}px, ${i.y}px, 0)`:"none"};return s.isPanelOn?E.jsxs(uo,{ref:o,style:u,...n,children:[E.jsxs(fo,{align:"v",justifyContent:"between",children:[E.jsxs(Fe,{gap:"xxs",children:[E.jsx($n,{size:"12px",...r}),c("effects.particle.title")]}),E.jsxs(Fe,{gap:"xxs",align:"v",children:[E.jsx(qe,{content:c("effects.particle.restart"),children:E.jsx(Je,{size:"xs",variant:"subtle",onClick:()=>s.play(),children:E.jsx(Un,{size:"12px"})})}),E.jsx(qe,{content:s.isPlaying?c("effects.particle.pause"):c("effects.particle.play"),children:E.jsx(Je,{size:"xs",variant:"subtle",onClick:()=>s.togglePauseResume(),children:s.isPlaying?E.jsx(Pn,{size:"12px"}):E.jsx(Mn,{size:"12px"})})}),E.jsx(qe,{content:c("effects.particle.stop"),children:E.jsx(Je,{size:"xs",variant:"subtle",onClick:()=>s.stop(s.mode),disabled:s.isStopped,children:E.jsx(Xn,{size:"12px"})})})]})]}),E.jsxs(ho,{children:[E.jsx(An,{label:c("effects.particle.speed"),value:s.speed,min:0,max:5,step:.1,dragStep:.1,onChange:d=>s.onSpeedChange(d)}),E.jsx(_n,{label:c("effects.particle.scope.label"),value:s.mode,onChange:d=>{s.switchPlayMode(d),s.onBoundingChange(s.mode===F.Selected),s.stop(F.Everything),s.play()},options:[{value:F.Selected,label:c("effects.particle.scope.selected")},{value:F.Everything,label:c("effects.particle.scope.everything")}]}),E.jsx(In,{label:c("effects.particle.bounding"),disabled:s.mode===F.Everything,value:s.isBoundingEnabled,onChange:d=>s.onBoundingChange(d)})]})]}):null});class vo extends On{constructor(){super(...arguments);x(this,"isBoundingEnabled",!1);x(this,"onScriptReset");x(this,"_onScriptStop");x(this,"_onScriptPlay");x(this,"_onScriptPause");x(this,"_hasLastSelectedEntity");x(this,"_selectedParticles",[]);x(this,"_allParticles",[]);x(this,"_mode",F.Selected);x(this,"_speed",1);x(this,"_isSelected",!1);x(this,"_componentArray",[]);x(this,"_center",new Ln);x(this,"_tempBoundingBox",new jt)}set mode(n){this._mode=n}get mode(){return this._mode}set speed(n){this._getParticles(this.mode).forEach(r=>{r.generator.main.simulationSpeed=n}),this._speed=n}get speed(){return this._speed}init(n){this.onScriptReset=n.onScriptReset,this._onScriptPlay=n.onScriptPlay,this._onScriptPause=n.onScriptPause,this._onScriptStop=n.onScriptStop,this._hasLastSelectedEntity=n.hasLastSelectedEntity}onStart(){const n=this.entity.parent.parent.createChild("particle_bounds_drawer");n.addComponent(Tn),n.addComponent(Ge),n.layer=Bn.Outline}onSelectEntity(n){if(this.onScriptReset&&this.onScriptReset(),this._componentArray.length=0,this._isSelected=!1,n){for(const r of n){const o=[];r.getComponentsIncludeChildren(De,o),this._componentArray.push(...o)}this._isSelected=this._componentArray.length>0}this._updateArrayAndPlay()}onAddComponent(n){if(n instanceof De){if(this.mode===F.Selected&&this._hasLastSelectedEntity&&!this._hasLastSelectedEntity())return;this._componentArray.push(n),this._updateArrayAndPlay()}}onRemoveComponent(n){if(n instanceof De)if(this.mode===F.Selected&&this._hasLastSelectedEntity&&!this._hasLastSelectedEntity()){const r=this._allParticles.findIndex(o=>o.instanceId===n.instanceId);r>-1&&this._allParticles.splice(r,1)}else{const r=this._componentArray.findIndex(o=>o.instanceId===n.instanceId);r>-1&&this._componentArray.splice(r,1),this._updateArrayAndPlay()}}onPlay(n){this._updateAllParticles(),n?this.play(F.Everything):this.stop(F.Everything)}onUpdate(){if(this._isSelected&&this.isBoundingEnabled){this._tempBoundingBox.copyFrom(this._selectedParticles[0].bounds);for(let h=1,S=this._selectedParticles.length;h<S;h++)jt.merge(this._tempBoundingBox,this._selectedParticles[h].bounds,this._tempBoundingBox);const{min:n,max:r}=this._tempBoundingBox,{x:o,y:i,z:a}=n,{x:s,y:c,z:u}=r,d=s-o,f=c-i,g=u-a;this._center.set(s+o,c+i,u+a).scale(.5),Ge.flush(),Ge.drawCuboid(d,f,g,this._center)}}_getParticles(n){return n===F.Selected?this._selectedParticles:this._allParticles}play(n=this.mode){this._getParticles(n).forEach(r=>{r.generator.stop(!1,Ft.StopEmittingAndClear),r.generator.main.simulationSpeed=this._speed,r.generator.play()}),this._onScriptPlay&&this._onScriptPlay(n)}pause(n=!1){this._getParticles(this.mode).forEach(r=>{r.generator.main.simulationSpeed=0}),this._onScriptPause&&this._onScriptPause(n)}stop(n){this._getParticles(n).forEach(r=>{r.generator.stop(!1,Ft.StopEmittingAndClear)}),this._onScriptStop&&this._onScriptStop(n)}resume(){this._getParticles(this.mode).forEach(n=>{n.generator.main.simulationSpeed=this._speed,n.generator.play()})}_updateAllParticles(){this._allParticles.length=0;const n=new Set;this.engine.sceneManager.scenes[0].rootEntities.forEach(o=>{const i=[];o.getComponentsIncludeChildren(De,i);for(const a of i)n.has(a.instanceId)||(n.add(a.instanceId),this._allParticles.push(a))})}_updateSelectedParticles(){this._selectedParticles.length=0;const n=new Set;for(const r of this._componentArray){const o=[];r.entity.getComponentsIncludeChildren(De,o);for(const i of o)n.has(i.instanceId)||(n.add(i.instanceId),this._selectedParticles.push(i))}}_updateArrayAndPlay(){const n=this._componentArray.length;this.pause(n!==0),n>0&&(this._updateSelectedParticles(),this._updateAllParticles(),this.play())}}var mo=Object.defineProperty,bo=Object.getOwnPropertyDescriptor,B=(e,t,n,r)=>{for(var o=r>1?void 0:r?bo(t,n):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(r?a(t,n,o):a(o))||o);return r&&o&&mo(t,n,o),o};let O=class{constructor(e){x(this,"isPanelOn",!1);x(this,"speed",1);x(this,"isPlaying",!1);x(this,"isStopped",!1);x(this,"_mode",F.Everything);x(this,"isModeChanged",!1);x(this,"isBoundingEnabled",!1);x(this,"script");x(this,"root");Nn(this),this.root=e.projectStore}get mode(){return this._mode}init(){this.script=kn.addScript(vo),this.speed=this.script.speed,this.isBoundingEnabled=this.script.isBoundingEnabled,this.script.init({onScriptReset:()=>{this.isPanelOn=!1},onScriptPlay:()=>{this.isStopped=!1,this.isPlaying=!0},onScriptPause:e=>{this.isPanelOn=e},onScriptStop:e=>{this.isStopped=!0,this.isPlaying=!1},hasLastSelectedEntity:()=>{const e=this.root.currentScene.sceneUIStore.lastSelectedId;return e&&!!this.root.currentScene.entities.get(e)}}),this._mode=this.script.mode}play(e=this.mode){this.isStopped=!1,this.isPlaying=!0,this.script.play(e)}togglePauseResume(){this.isStopped=!1,this.isPlaying?(this.isPlaying=!1,this.script.pause()):(this.isPlaying=!0,this.script.resume())}stop(e){this.isStopped=!0,this.isPlaying=!1,this.script.stop(e)}onSpeedChange(e){this.speed=e,this.script.speed=e}onBoundingChange(e){this.isBoundingEnabled=e,this.script.isBoundingEnabled=e}switchPlayMode(e){this._mode=e,this.script.mode=e}};B([le],O.prototype,"isPanelOn",2);B([le],O.prototype,"speed",2);B([le],O.prototype,"isPlaying",2);B([le],O.prototype,"isStopped",2);B([le],O.prototype,"_mode",2);B([zn],O.prototype,"mode",1);B([le],O.prototype,"isModeChanged",2);B([le],O.prototype,"isBoundingEnabled",2);B([ve],O.prototype,"play",1);B([ve],O.prototype,"togglePauseResume",1);B([ve],O.prototype,"stop",1);B([ve],O.prototype,"onSpeedChange",1);B([ve],O.prototype,"onBoundingChange",1);B([ve],O.prototype,"switchPlayMode",1);O=B([jn({type:"particleStore",Panel:po})],O);export{Ni as AnimatorComponent,ki as AnimatorStore,hs as AudioComponent,ms as ButtonComponent,Ei as CameraComponent,Xi as CharacterControllerComponent,Ri as DirectLightComponent,Wi as DynamicColliderComponent,Yi as FixedJointComponent,Hi as HingeJointComponent,bs as ImageComponent,cs as ImportScriptComponent,ts as LottieAnimationComponent,Oi as MeshRendererComponent,is as ParticleRendererComponent,O as ParticleStore,Ki as PhysicsStore,Mi as PointLightComponent,ds as PostProcessComponent,qi as ScriptComponent,Ti as SkinnedMeshRendererComponent,rs as SpineAnimationComponent,_i as SpotLightComponent,Vi as SpringJointComponent,$i as SpriteMaskComponent,ji as SpriteRendererComponent,Ji as StaticColliderComponent,ys as TextComponent,Qi as TextRendererComponent,as as TrailRendererComponent,gs as TransformComponent,xs as UICanvasComponent,ws as UIGroupComponent,Ss as UITransformComponent};
