@cyca/react-timeline-editor 0.2.3-alpha.6 → 0.2.3-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +5 -12
- package/dist/react-timeline-editor.cjs +4 -4
- package/dist/react-timeline-editor.js +2873 -2962
- package/dist/styles.css +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ It can be mainly used to build animation editors, video editors, etc.
|
|
|
14
14
|
|
|
15
15
|
## Changes from the original library
|
|
16
16
|
- Replaced react-virtualized with @tanstack/virtual
|
|
17
|
-
- Replaced Interact.js with @use-gesture/
|
|
17
|
+
- Replaced Interact.js with @use-gesture/react
|
|
18
18
|
- Uses React-19 as a base
|
|
19
19
|
- Compiled with react-compiler enabled
|
|
20
20
|
- Modern bundling via latest `vite` and docs powered by storybook
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as default_2 } from 'react';
|
|
2
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
3
|
import * as React_2 from 'react';
|
|
3
4
|
|
|
4
5
|
export declare interface EditData {
|
|
@@ -216,17 +217,9 @@ export declare interface EffectSourceParam {
|
|
|
216
217
|
effect: TimelineEffect;
|
|
217
218
|
}
|
|
218
219
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
clientWidth: number;
|
|
223
|
-
scrollHeight: number;
|
|
224
|
-
scrollLeft: number;
|
|
225
|
-
scrollTop: number;
|
|
226
|
-
scrollWidth: number;
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
export declare const Timeline: default_2.ForwardRefExoticComponent<TimelineEditor & default_2.RefAttributes<TimelineState>>;
|
|
220
|
+
export declare function Timeline({ ref, ...props }: TimelineEditor & {
|
|
221
|
+
ref: default_2.RefObject<TimelineState>;
|
|
222
|
+
}): JSX.Element;
|
|
230
223
|
|
|
231
224
|
/**
|
|
232
225
|
* Basic parameters of action
|
|
@@ -265,7 +258,7 @@ export declare interface TimelineEditor extends EditData {
|
|
|
265
258
|
/**
|
|
266
259
|
* @description Editing area scroll callback (used to control synchronization with editing row scrolling)
|
|
267
260
|
*/
|
|
268
|
-
onScroll?: (params:
|
|
261
|
+
onScroll?: (params: EventTarget & HTMLDivElement) => void;
|
|
269
262
|
/**
|
|
270
263
|
* @description Whether to enable auto scroll when dragging
|
|
271
264
|
* @default false
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),xr=require("react-dom");function Cr(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const g=Cr(N);var kt={exports:{}},Tt={};var bn;function Ar(){if(bn)return Tt;bn=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:n,type:r,key:i,ref:s!==void 0?s:null,props:o}}return Tt.Fragment=e,Tt.jsx=t,Tt.jsxs=t,Tt}var Dt={};var _n;function Tr(){return _n||(_n=1,process.env.NODE_ENV!=="production"&&(function(){function n(d){if(d==null)return null;if(typeof d=="function")return d.$$typeof===I?null:d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case p:return"Fragment";case b:return"Profiler";case w:return"StrictMode";case T:return"Suspense";case C:return"SuspenseList";case z:return"Activity"}if(typeof d=="object")switch(typeof d.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),d.$$typeof){case v:return"Portal";case E:return d.displayName||"Context";case _:return(d._context.displayName||"Context")+".Consumer";case P:var y=d.render;return d=d.displayName,d||(d=y.displayName||y.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case F:return y=d.displayName||null,y!==null?y:n(d.type)||"Memo";case D:y=d._payload,d=d._init;try{return n(d(y))}catch{}}return null}function e(d){return""+d}function t(d){try{e(d);var y=!1}catch{y=!0}if(y){y=console;var O=y.error,H=typeof Symbol=="function"&&Symbol.toStringTag&&d[Symbol.toStringTag]||d.constructor.name||"Object";return O.call(y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",H),e(d)}}function r(d){if(d===p)return"<>";if(typeof d=="object"&&d!==null&&d.$$typeof===D)return"<...>";try{var y=n(d);return y?"<"+y+">":"<...>"}catch{return"<...>"}}function s(){var d=$.A;return d===null?null:d.getOwner()}function o(){return Error("react-stack-top-frame")}function i(d){if(M.call(d,"key")){var y=Object.getOwnPropertyDescriptor(d,"key").get;if(y&&y.isReactWarning)return!1}return d.key!==void 0}function c(d,y){function O(){x||(x=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",y))}O.isReactWarning=!0,Object.defineProperty(d,"key",{get:O,configurable:!0})}function a(){var d=n(this.type);return W[d]||(W[d]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),d=this.props.ref,d!==void 0?d:null}function u(d,y,O,H,Q,X){var Y=O.ref;return d={$$typeof:S,type:d,key:y,props:O,_owner:H},(Y!==void 0?Y:null)!==null?Object.defineProperty(d,"ref",{enumerable:!1,get:a}):Object.defineProperty(d,"ref",{enumerable:!1,value:null}),d._store={},Object.defineProperty(d._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(d,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(d,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.defineProperty(d,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d}function l(d,y,O,H,Q,X){var Y=y.children;if(Y!==void 0)if(H)if(B(Y)){for(H=0;H<Y.length;H++)h(Y[H]);Object.freeze&&Object.freeze(Y)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(Y);if(M.call(y,"key")){Y=n(d);var L=Object.keys(y).filter(function(U){return U!=="key"});H=0<L.length?"{key: someKey, "+L.join(": ..., ")+": ...}":"{key: someKey}",ne[Y+H]||(L=0<L.length?"{"+L.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,
|
|
6
|
+
<%s key={someKey} {...props} />`,H,Y,L,Y),ne[Y+H]=!0)}if(Y=null,O!==void 0&&(t(O),Y=""+O),i(y)&&(t(y.key),Y=""+y.key),"key"in y){O={};for(var k in y)k!=="key"&&(O[k]=y[k])}else O=y;return Y&&c(O,typeof d=="function"?d.displayName||d.name||"Unknown":d),u(d,Y,O,s(),Q,X)}function h(d){f(d)?d._store&&(d._store.validated=1):typeof d=="object"&&d!==null&&d.$$typeof===D&&(d._payload.status==="fulfilled"?f(d._payload.value)&&d._payload.value._store&&(d._payload.value._store.validated=1):d._store&&(d._store.validated=1))}function f(d){return typeof d=="object"&&d!==null&&d.$$typeof===S}var m=N,S=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),E=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),I=Symbol.for("react.client.reference"),$=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,B=Array.isArray,A=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(d){return d()}};var x,W={},Z=m.react_stack_bottom_frame.bind(m,o)(),te=A(r(o)),ne={};Dt.Fragment=p,Dt.jsx=function(d,y,O){var H=1e4>$.recentlyCreatedOwnerStacks++;return l(d,y,O,!1,H?Error("react-stack-top-frame"):Z,H?A(r(d)):te)},Dt.jsxs=function(d,y,O){var H=1e4>$.recentlyCreatedOwnerStacks++;return l(d,y,O,!0,H?Error("react-stack-top-frame"):Z,H?A(r(d)):te)}})()),Dt}var Sn;function Dr(){return Sn||(Sn=1,process.env.NODE_ENV==="production"?kt.exports=Ar():kt.exports=Tr()),kt.exports}var R=Dr();const an="timeline-editor",wn=0,Bt=1,qn=10,Yt=160,Gt=20,ln=1,un=8,En=32,yn=20,Gn=5,tn={trace:0,debug:1,info:2,warn:3,error:4,silent:5},Lr=["trace","debug","info","warn","error"];var Pr=class Jn{s;ls=new Map;lvl;def;n;r;c=console;e;trace;debug;info;warn;error;constructor(e,t,r,s){this.s=e,this.e=t,this.n=r,this.r=s,this.bindMethods()}noop=()=>{};bindMethods(){Lr.forEach(e=>{const t=this.e.bind(this.c,e,this.n);Object.defineProperty(this,e,{get:()=>tn[e]>=tn[this.currentLevel()]?t:this.noop,configurable:!0})})}storageKey(){return this.n?`loglevel:${String(this.n)}`:"loglevel"}currentLevel(){if(this.lvl)return this.lvl;const e=this.s.get(this.storageKey());return e&&e in tn?(this.lvl=e,this.lvl):this.def?this.def:this.r?this.r.currentLevel():"trace"}setLevel(e){return this.lvl=e,this.s.set(this.storageKey(),e),this}setDefaultLevel(e){return this.s.get(this.storageKey())||(this.def=e),this}resetLevel(){return this.lvl=void 0,this.s.del(this.storageKey()),this}getLogger(e){if(!e)throw new Error("Logger name required");if(!this.ls.has(e)){const t=new Jn(this.s,this.e,e,this.r||this);this.ls.set(e,Zn(t))}return this.ls.get(e)}getLoggers(){const e={};return this.ls.forEach((t,r)=>{e[String(r)]=t}),e}use(e){this.c=e,this.bindMethods()}};function Zn(n){return new Proxy(n,{get(e,t,r){if(t in e)return Reflect.get(e,t,r);const s=e.c[t];return typeof s=="function"?s.bind(e.c):s}})}var Or=class{get(n){return localStorage.getItem(n)}set(n,e){localStorage.setItem(n,e)}del(n){localStorage.removeItem(n)}};const Mr={trace:"#95bdb7",debug:"#ad95b8",info:"#b6bd73",warn:"#88a1bb",error:"#bf6c69"},Rn={info:"⚡️",success:"✔",warn:"▲",error:"✖",log:"●",trace:"◔",debug:"◌"},Nr={bind(n,e,t){const r=t?`${Rn[e]} ${String(t)}:`:`${Rn[e]}`;return(n[e]||n.log).bind(n,`%c${r}%c`,`color: ${Mr[e]}; font-weight: bold;`,"color: inherit")}},Je=Zn(new Pr(new Or,Nr));function Ir(n){let{editorData:e=[],effects:t={},scale:r=Bt,scaleSplitCount:s=qn,scaleWidth:o=Yt,startLeft:i=Gt,minScaleCount:c=yn,maxScaleCount:a=1/0,rowHeight:u=En}=n;r<=0&&(Je.error("Error: scale must be greater than 0!"),r=Bt),s<=0&&(Je.warn("Warning: scaleSplitCount cannot be less than 1!"),s=1),o<=0&&(Je.warn("Warning: scaleWidth must be greater than 0!"),o=Yt),i<0&&(Je.warn("Warning: startLeft cannot be less than 0!"),i=0),c<1&&(Je.warn("Warning: minScaleCount must be greater than 1!"),c=yn),c=parseInt(c+""),a<c&&(Je.warn("Warning: maxScaleCount cannot be less than minScaleCount!"),a=c),a=a===1/0?1/0:parseInt(a+""),u<=0&&(Je.warn("Warning: rowHeight must be greater than 0!"),u=En);const l={...n};return delete l.style,{...l,editorData:e,effects:t,scale:r,scaleSplitCount:s,scaleWidth:o,startLeft:i,minScaleCount:c,maxScaleCount:a,rowHeight:u}}function ze(n,e){const{startLeft:t,scale:r,scaleWidth:s}=e;return t+n/r*s}function Ke(n,e){const{startLeft:t,scale:r,scaleWidth:s}=e;return(n-t)/s*r}function Lt(n,e){const{left:t,width:r}=n,s=Ke(t,e),o=Ke(t+r,e);return{start:s,end:o}}function hn(n,e){const{start:t,end:r}=n,s=ze(t,e),o=ze(r,e)-s;return{left:s,width:o}}function kr(n,e){let t=0;return n.forEach(s=>{s.actions.forEach(o=>{t=Math.max(t,o.end)})}),Math.ceil(t/e.scale)+Gn}function Wr(n,e){const{startLeft:t,scaleWidth:r}=e,s=Math.ceil((n-t)/r);return Math.max(s+Gn,e.scaleCount)}function zr(n,e){const t=[];return n.forEach(r=>{t.push(ze(r.start,e)),t.push(ze(r.end,e))}),t}var Wt={exports:{}},nn={};var xn;function jr(){if(xn)return nn;xn=1;var n=N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;return nn.c=function(e){return n.H.useMemoCache(e)},nn}var rn={};var Cn;function Fr(){return Cn||(Cn=1,process.env.NODE_ENV!=="production"&&(function(){var n=N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;rn.c=function(e){var t=n.H;return t===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
7
7
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
8
8
|
2. You might be breaking the Rules of Hooks
|
|
9
9
|
3. You might have more than one copy of React in the same app
|
|
10
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),t.useMemoCache(e)}})()),nn}var Cn;function Vr(){return Cn||(Cn=1,process.env.NODE_ENV==="production"?It.exports=zr():It.exports=Fr()),It.exports}var ze=Vr();function Ur(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.map(function(r){return r.split(" ").map(function(s){return s?""+n+s:""}).join(" ")}).join(" ")}function de(...n){return Ur(`${cn}-`,...n)}const $r=n=>{const e=ze.c(11),{isMoving:t,movePositions:r,assistPositions:s}=n;let o,i;if(e[0]!==t||e[1]!==r||e[2]!==s){const l=r===void 0?[]:r;let u;e[5]!==s?(u=s===void 0?[]:s,e[5]=s,e[6]=u):u=e[6];const a=u;e[7]===Symbol.for("react.memo_cache_sentinel")?(o=de("drag-line-container"),e[7]=o):o=e[7],i=t&&l.filter(h=>a.includes(h)).map(Hr),e[0]=t,e[1]=r,e[2]=s,e[3]=o,e[4]=i}else o=e[3],i=e[4];let c;return e[8]!==o||e[9]!==i?(c=R.jsx("div",{className:o,children:i}),e[8]=o,e[9]=i,e[10]=c):c=e[10],c};function Hr(n,e){return R.jsx("div",{className:de("drag-line"),style:{left:n}},e)}const kt=1,Tn=10,An=10;function Br(n){const e=ze.c(7),t=T.useRef(Number.MIN_SAFE_INTEGER),r=T.useRef(Number.MAX_SAFE_INTEGER),s=T.useRef(kt),o=T.useRef(void 0);let i;e[0]!==n?(i=()=>{if(n?.current){const{left:b,width:v}=n.current.getBoundingClientRect();t.current=b,r.current=b+v}},e[0]=n,e[1]=i):i=e[1];const c=i;let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(b,v)=>{if(b.clientX>=r.current||b.clientX<=t.current){o.current!==void 0&&cancelAnimationFrame(o.current);const w=Math.abs(b.clientX>=r.current?b.clientX-r.current:b.clientX-t.current);s.current=Math.min(Number((w/An).toFixed(0))*kt,Tn);const S=(b.clientX>=r.current?1:-1)*s.current,y=()=>{v&&v(S),o.current=requestAnimationFrame(y)};return o.current=requestAnimationFrame(y),!1}else o.current!==void 0&&cancelAnimationFrame(o.current);return!0},e[2]=l):l=e[2];const u=l;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=(b,v,w)=>{if(b.clientX>=r.current||b.clientX<t.current){o.current!==void 0&&cancelAnimationFrame(o.current);const _=Math.abs(b.clientX>=r.current?b.clientX-r.current:b.clientX-t.current);s.current=Math.min(Number((_/An).toFixed(0))*kt,Tn);const y=(b.clientX>=r.current?1:-1)*s.current,P=()=>{w&&w(y),o.current=requestAnimationFrame(P)};return o.current=requestAnimationFrame(P),!1}else o.current!==void 0&&cancelAnimationFrame(o.current);return!0},e[3]=a):a=e[3];const h=a;let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{t.current=Number.MIN_SAFE_INTEGER,r.current=Number.MAX_SAFE_INTEGER,s.current=kt,o.current!==void 0&&cancelAnimationFrame(o.current)},e[4]=f):f=e[4];const m=f;let g;return e[5]!==c?(g={initAutoScroll:c,dealDragAutoScroll:u,dealResizeAutoScroll:h,stopAutoScroll:m},e[5]=c,e[6]=g):g=e[6],g}function Yr(n,e,t){return Math.max(e,Math.min(n,t))}const he={toVector(n,e){return n===void 0&&(n=e),Array.isArray(n)?n:[n,n]},add(n,e){return[n[0]+e[0],n[1]+e[1]]},sub(n,e){return[n[0]-e[0],n[1]-e[1]]},addTo(n,e){n[0]+=e[0],n[1]+=e[1]},subTo(n,e){n[0]-=e[0],n[1]-=e[1]}};function Pn(n,e,t){return e===0||Math.abs(e)===1/0?Math.pow(n,t*5):n*e*t/(e+t*n)}function Dn(n,e,t,r=.15){return r===0?Yr(n,e,t):n<e?-Pn(e-n,t-e,r)+e:n>t?+Pn(n-t,t-e,r)+t:n}function Xr(n,[e,t],[r,s]){const[[o,i],[c,l]]=n;return[Dn(e,o,i,r),Dn(t,c,l,s)]}function Gr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Kr(n){var e=Gr(n,"string");return typeof e=="symbol"?e:String(e)}function ve(n,e,t){return e=Kr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function On(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,r)}return t}function te(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?On(Object(t),!0).forEach(function(r){ve(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):On(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}const Qn={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function Ln(n){return n?n[0].toUpperCase()+n.slice(1):""}const qr=["enter","leave"];function Jr(n=!1,e){return n&&!qr.includes(e)}function Zr(n,e="",t=!1){const r=Qn[n],s=r&&r[e]||e;return"on"+Ln(n)+Ln(s)+(Jr(t,s)?"Capture":"")}const Qr=["gotpointercapture","lostpointercapture"];function es(n){let e=n.substring(2).toLowerCase();const t=!!~e.indexOf("passive");t&&(e=e.replace("passive",""));const r=Qr.includes(e)?"capturecapture":"capture",s=!!~e.indexOf(r);return s&&(e=e.replace("capture","")),{device:e,capture:s,passive:t}}function ts(n,e=""){const t=Qn[n],r=t&&t[e]||e;return n+r}function Kt(n){return"touches"in n}function er(n){return Kt(n)?"touch":"pointerType"in n?n.pointerType:"mouse"}function ns(n){return Array.from(n.touches).filter(e=>{var t,r;return e.target===n.currentTarget||((t=n.currentTarget)===null||t===void 0||(r=t.contains)===null||r===void 0?void 0:r.call(t,e.target))})}function rs(n){return n.type==="touchend"||n.type==="touchcancel"?n.changedTouches:n.targetTouches}function tr(n){return Kt(n)?rs(n)[0]:n}function ss(n){return ns(n).map(e=>e.identifier)}function rn(n){const e=tr(n);return Kt(n)?e.identifier:e.pointerId}function Mn(n){const e=tr(n);return[e.clientX,e.clientY]}function os(n){const e={};if("buttons"in n&&(e.buttons=n.buttons),"shiftKey"in n){const{shiftKey:t,altKey:r,metaKey:s,ctrlKey:o}=n;Object.assign(e,{shiftKey:t,altKey:r,metaKey:s,ctrlKey:o})}return e}function Bt(n,...e){return typeof n=="function"?n(...e):n}function is(){}function cs(...n){return n.length===0?is:n.length===1?n[0]:function(){let e;for(const t of n)e=t.apply(this,arguments)||e;return e}}function Nn(n,e){return Object.assign({},e,n||{})}const as=32;class ls{constructor(e,t,r){this.ctrl=e,this.args=t,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:r,args:s}=this;t[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=s,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,r=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=r.from?Bt(r.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:r,shared:s}=this;t.args=this.args;let o=0;if(e&&(t.event=e,r.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,s.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,s.locked=!!document.pointerLockElement,Object.assign(s,os(e)),s.down=s.pressed=s.buttons%2===1||s.touches>0,o=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const x=t._delta.map(Math.abs);he.addTo(t._distance,x)}this.axisIntent&&this.axisIntent(e);const[i,c]=t._movement,[l,u]=r.threshold,{_step:a,values:h}=t;if(r.hasCustomTransform?(a[0]===!1&&(a[0]=Math.abs(i)>=l&&h[0]),a[1]===!1&&(a[1]=Math.abs(c)>=u&&h[1])):(a[0]===!1&&(a[0]=Math.abs(i)>=l&&Math.sign(i)*l),a[1]===!1&&(a[1]=Math.abs(c)>=u&&Math.sign(c)*u)),t.intentional=a[0]!==!1||a[1]!==!1,!t.intentional)return;const f=[0,0];if(r.hasCustomTransform){const[x,C]=h;f[0]=a[0]!==!1?x-a[0]:0,f[1]=a[1]!==!1?C-a[1]:0}else f[0]=a[0]!==!1?i-a[0]:0,f[1]=a[1]!==!1?c-a[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(f);const m=t.offset,g=t._active&&!t._blocked||t.active;g&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=s[this.ingKey]=t._active,e&&(t.first&&("bounds"in r&&(t._bounds=Bt(r.bounds,t)),this.setup&&this.setup()),t.movement=f,this.computeOffset()));const[b,v]=t.offset,[[w,_],[S,y]]=t._bounds;t.overflow=[b<w?-1:b>_?1:0,v<S?-1:v>y?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const P=t._active?r.rubberband||[0,0]:[0,0];if(t.offset=Xr(t._bounds,t.offset,P),t.delta=he.sub(t.offset,m),this.computeMovement(),g&&(!t.last||o>as)){t.delta=he.sub(t.offset,m);const x=t.delta.map(Math.abs);he.addTo(t.distance,x),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&o>0&&(t.velocity=[x[0]/o,x[1]/o],t.timeDelta=o)}}emit(){const e=this.state,t=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const s=this.handler(te(te(te({},t),e),{},{[this.aliasKey]:e.values}));s!==void 0&&(e.memo=s)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function us([n,e],t){const r=Math.abs(n),s=Math.abs(e);if(r>s&&r>t)return"x";if(s>r&&s>t)return"y"}class fs extends ls{constructor(...e){super(...e),ve(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=he.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=he.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,r=this.config;if(!t.axis&&e){const s=typeof r.axisThreshold=="object"?r.axisThreshold[er(e)]:r.axisThreshold;t.axis=us(t._movement,s)}t._blocked=(r.lockDirection||!!r.axis)&&!t.axis||!!r.axis&&r.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const In=n=>n,kn=.15,mn={enabled(n=!0){return n},eventOptions(n,e,t){return te(te({},t.shared.eventOptions),n)},preventDefault(n=!1){return n},triggerAllEvents(n=!1){return n},rubberband(n=0){switch(n){case!0:return[kn,kn];case!1:return[0,0];default:return he.toVector(n)}},from(n){if(typeof n=="function")return n;if(n!=null)return he.toVector(n)},transform(n,e,t){const r=n||t.shared.transform;if(this.hasCustomTransform=!!r,process.env.NODE_ENV==="development"){const s=r||In;return o=>{const i=s(o);return(!isFinite(i[0])||!isFinite(i[1]))&&console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${i[0]},${[1]}]`),i}}return r||In},threshold(n){return he.toVector(n,0)}};process.env.NODE_ENV==="development"&&Object.assign(mn,{domTarget(n){if(n!==void 0)throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");return NaN},lockDirection(n){if(n!==void 0)throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");return NaN},initial(n){if(n!==void 0)throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");return NaN}});const ds=0,Pt=te(te({},mn),{},{axis(n,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(n=ds){return n},bounds(n={}){if(typeof n=="function")return o=>Pt.bounds(n(o));if("current"in n)return()=>n.current;if(typeof HTMLElement=="function"&&n instanceof HTMLElement)return n;const{left:e=-1/0,right:t=1/0,top:r=-1/0,bottom:s=1/0}=n;return[[e,t],[r,s]]}}),Wn={ArrowRight:(n,e=1)=>[n*e,0],ArrowLeft:(n,e=1)=>[-1*n*e,0],ArrowUp:(n,e=1)=>[0,-1*n*e],ArrowDown:(n,e=1)=>[0,n*e]};class hs extends fs{constructor(...e){super(...e),ve(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),s={left:t.left-r.left+e.offset[0],right:t.right-r.right+e.offset[0],top:t.top-r.top+e.offset[1],bottom:t.bottom-r.bottom+e.offset[1]};e._bounds=Pt.bounds(s)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const s=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(s&&s.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=rn(e),r._pointerActive=!0,this.computeValues(Mn(e)),this.computeInitial(),t.preventScrollAxis&&er(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,r=this.config;if(!t._pointerActive)return;const s=rn(e);if(t._pointerId!==void 0&&s!==t._pointerId)return;const o=Mn(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=he.sub(o,t._values),this.computeValues(o)),he.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{process.env.NODE_ENV==="development"&&console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.")}const t=this.state,r=this.config;if(!t._active||!t._pointerActive)return;const s=rn(e);if(t._pointerId!==void 0&&s!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=t._distance;if(t.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,t.tap&&r.filterTaps)t._force=!0;else{const[c,l]=t._delta,[u,a]=t._movement,[h,f]=r.swipe.velocity,[m,g]=r.swipe.distance,b=r.swipe.duration;if(t.elapsedTime<b){const v=Math.abs(c/t.timeDelta),w=Math.abs(l/t.timeDelta);v>h&&Math.abs(u)>m&&(t.swipe[0]=Math.sign(c)),w>f&&Math.abs(a)>g&&(t.swipe[1]=Math.sign(l))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,r=t.device;if(process.env.NODE_ENV==="development")try{if(r==="pointer"&&t.preventScrollDelay===void 0){const s="uv"in e?e.sourceEvent.currentTarget:e.currentTarget;window.getComputedStyle(s).touchAction==="auto"&&console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.",s)}}catch{}t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,ms(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=Wn[e.key];if(t){const r=this.state,s=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=t(this.config.keyboardDisplacement,s),r._keyboardActive=!0,he.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in Wn&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function ms(n){"persist"in n&&typeof n.persist=="function"&&n.persist()}const Dt=typeof window<"u"&&window.document&&window.document.createElement;function nr(){return Dt&&"ontouchstart"in window}function ps(){return nr()||Dt&&window.navigator.maxTouchPoints>1}function gs(){return Dt&&"onpointerdown"in window}function vs(){return Dt&&"exitPointerLock"in window.document}function bs(){try{return"constructor"in GestureEvent}catch{return!1}}const we={isBrowser:Dt,gesture:bs(),touch:nr(),touchscreen:ps(),pointer:gs(),pointerLock:vs()},_s=250,ws=180,Ss=.5,ys=50,Es=250,Rs=10,jn={mouse:0,touch:0,pen:8},rr=te(te({},Pt),{},{device(n,e,{pointer:{touch:t=!1,lock:r=!1,mouse:s=!1}={}}){return this.pointerLock=r&&we.pointerLock,we.touch&&t?"touch":this.pointerLock?"mouse":we.pointer&&!s?"pointer":we.touch?"touch":"mouse"},preventScrollAxis(n,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&n?_s:void 0,!(!we.touchscreen||t===!1))return n||(t!==void 0?"y":void 0)},pointerCapture(n,e,{pointer:{capture:t=!0,buttons:r=1,keys:s=!0}={}}){return this.pointerButtons=r,this.keys=s,!this.pointerLock&&this.device==="pointer"&&t},threshold(n,e,{filterTaps:t=!1,tapsThreshold:r=3,axis:s=void 0}){const o=he.toVector(n,t?r:s?1:0);return this.filterTaps=t,this.tapsThreshold=r,o},swipe({velocity:n=Ss,distance:e=ys,duration:t=Es}={}){return{velocity:this.transform(he.toVector(n)),distance:this.transform(he.toVector(e)),duration:t}},delay(n=0){switch(n){case!0:return ws;case!1:return 0;default:return n}},axisThreshold(n){return n?te(te({},jn),n):jn},keyboardDisplacement(n=Rs){return n}});process.env.NODE_ENV==="development"&&Object.assign(rr,{useTouch(n){if(n!==void 0)throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");return NaN},experimental_preventWindowScrollY(n){if(n!==void 0)throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");return NaN},swipeVelocity(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");return NaN},swipeDistance(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");return NaN},swipeDuration(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");return NaN}});te(te({},mn),{},{device(n,e,{shared:t,pointer:{touch:r=!1}={}}){if(t.target&&!we.touch&&we.gesture)return"gesture";if(we.touch&&r)return"touch";if(we.touchscreen){if(we.pointer)return"pointer";if(we.touch)return"touch"}},bounds(n,e,{scaleBounds:t={},angleBounds:r={}}){const s=i=>{const c=Nn(Bt(t,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=Nn(Bt(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof t!="function"&&typeof r!="function"?[s(),o()]:i=>[s(i),o(i)]},threshold(n,e,t){return this.lockDirection=t.axis==="lock",he.toVector(n,this.lockDirection?[.1,3]:0)},modifierKey(n){return n===void 0?"ctrlKey":n},pinchOnWheel(n=!0){return n}});te(te({},Pt),{},{mouseOnly:(n=!0)=>n});te(te({},Pt),{},{mouseOnly:(n=!0)=>n});const sr=new Map,fn=new Map;function xs(n){sr.set(n.key,n.engine),fn.set(n.key,n.resolver)}const Cs={key:"drag",engine:hs,resolver:rr};function Ts(n,e){if(n==null)return{};var t={},r=Object.keys(n),s,o;for(o=0;o<r.length;o++)s=r[o],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}function As(n,e){if(n==null)return{};var t=Ts(n,e),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(s=0;s<o.length;s++)r=o[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}const Ps={target(n){if(n)return()=>"current"in n?n.current:n},enabled(n=!0){return n},window(n=we.isBrowser?window:void 0){return n},eventOptions({passive:n=!0,capture:e=!1}={}){return{passive:n,capture:e}},transform(n){return n}},Ds=["target","eventOptions","window","enabled","transform"];function zt(n={},e){const t={};for(const[r,s]of Object.entries(e))switch(typeof s){case"function":if(process.env.NODE_ENV==="development"){const o=s.call(t,n[r],r,n);Number.isNaN(o)||(t[r]=o)}else t[r]=s.call(t,n[r],r,n);break;case"object":t[r]=zt(n[r],s);break;case"boolean":s&&(t[r]=n[r]);break}return t}function Os(n,e,t={}){const r=n,{target:s,eventOptions:o,window:i,enabled:c,transform:l}=r,u=As(r,Ds);if(t.shared=zt({target:s,eventOptions:o,window:i,enabled:c,transform:l},Ps),e){const a=fn.get(e);t[e]=zt(te({shared:t.shared},u),a)}else for(const a in u){const h=fn.get(a);if(h)t[a]=zt(te({shared:t.shared},u[a]),h);else if(process.env.NODE_ENV==="development"&&!["drag","pinch","scroll","wheel","move","hover"].includes(a)){if(a==="domTarget")throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");console.warn(`[@use-gesture]: Unknown config key \`${a}\` was used. Please read the documentation for further information.`)}}return t}class or{constructor(e,t){ve(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,s,o){const i=this._listeners,c=ts(t,r),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},u=te(te({},l),o);e.addEventListener(c,s,u);const a=()=>{e.removeEventListener(c,s,u),i.delete(a)};return i.add(a),a}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Ls{constructor(){ve(this,"_timeouts",new Map)}add(e,t,r=140,...s){this.remove(e),this._timeouts.set(e,window.setTimeout(t,r,...s))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class Ms{constructor(e){ve(this,"gestures",new Set),ve(this,"_targetEventStore",new or(this)),ve(this,"gestureEventStores",{}),ve(this,"gestureTimeoutStores",{}),ve(this,"handlers",{}),ve(this,"config",{}),ve(this,"pointerIds",new Set),ve(this,"touchIds",new Set),ve(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Ns(this,e)}setEventIds(e){if(Kt(e))return this.touchIds=new Set(ss(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=Os(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,r={};let s;if(!(t.target&&(s=t.target(),!s))){if(t.enabled){for(const i of this.gestures){const c=this.config[i],l=zn(r,c.eventOptions,!!s);if(c.enabled){const u=sr.get(i);new u(this,e,i).bind(l)}}const o=zn(r,t.eventOptions,!!s);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](te(te({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=cs(...r[o]);if(!s)return r;for(const o in r){const{device:i,capture:c,passive:l}=es(o);this._targetEventStore.add(s,i,"",r[o],{capture:c,passive:l})}}}}function yt(n,e){n.gestures.add(e),n.gestureEventStores[e]=new or(n,e),n.gestureTimeoutStores[e]=new Ls}function Ns(n,e){e.drag&&yt(n,"drag"),e.wheel&&yt(n,"wheel"),e.scroll&&yt(n,"scroll"),e.move&&yt(n,"move"),e.pinch&&yt(n,"pinch"),e.hover&&yt(n,"hover")}const zn=(n,e,t)=>(r,s,o,i={},c=!1)=>{var l,u;const a=(l=i.capture)!==null&&l!==void 0?l:e.capture,h=(u=i.passive)!==null&&u!==void 0?u:e.passive;let f=c?r:Zr(r,s,a);t&&h&&(f+="Passive"),n[f]=n[f]||[],n[f].push(o)};function Is(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ks(n){var e=Is(n,"string");return typeof e=="symbol"?e:String(e)}function Ws(n,e,t){return e=ks(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fn(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,r)}return t}function Wt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fn(Object(t),!0).forEach(function(r){Ws(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fn(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}class js{constructor(e,t,r,s,o){this._target=e,this._gestureKey=s,this._ctrl=new Ms(t),this._ctrl.applyHandlers(t,o),this._ctrl.applyConfig(Wt(Wt({},r),{},{target:e}),s),this._ctrl.effect()}destroy(){this._ctrl.clean()}setConfig(e){this._ctrl.clean(),this._ctrl.applyConfig(Wt(Wt({},e),{},{target:this._target}),this._gestureKey),this._ctrl.effect()}}const sn=function(e,t,r){return xs(Cs),new js(e,{drag:t},r||{},"drag")};function zs(...n){const e=n.filter(Boolean);return e.length<=1?e[0]||null:function(r){for(const s of e)typeof s=="function"?s(r):s&&(s.current=r)}}const ir=({children:n,...e})=>{const t=T.Children.only(n),r=Fs(t),s=t.props||{},o=s.style||{},i={...e,...s,style:{...e.style??{},...o},ref:zs(r,e.ref)};return T.cloneElement(t,i)};function Fs(n){let e=Object.getOwnPropertyDescriptor(n,"ref")?.get;return e&&"isReactWarning"in e&&e.isReactWarning?n.props.ref:n.props.ref||n.ref}const on=(n,e,t,r,s)=>({target:n,dx:e[0],dy:e[1],clientX:t[0],clientY:t[1],...r&&{edges:r},...s&&{deltaRect:s}}),Vs=(n,e,t)=>n?n===e||n===t||(e?.contains(n)??!1)||(t?.contains(n)??!1):!1,Us=({children:n,interactRef:e,draggable:t,resizable:r,draggableOptions:s,resizableOptions:o})=>{const i=T.useRef(null),c=T.useRef(void 0),l=T.useRef(void 0),u=T.useRef(void 0),a=T.useRef(void 0),h=T.useRef(void 0),f=T.useRef(null),m=T.useRef(null),g=T.useRef(void 0),b=T.useRef(void 0);T.useEffect(()=>{c.current=s,l.current=o},[s,o]);const v=T.useEffectEvent(()=>{const w=i.current;if(!w)return;u.current?.destroy(),a.current?.destroy(),h.current?.destroy(),u.current=void 0,a.current=void 0,h.current=void 0;const _=l.current?.edges?.left,S=l.current?.edges?.right;_!==g.current&&(g.current=_,f.current=_?w.querySelector(_):null),S!==b.current&&(b.current=S,m.current=S?w.querySelector(S):null),t&&c.current&&(u.current=new sn(w,P=>{const{active:x,delta:C,xy:D,event:E,first:O,last:L}=P;if(Vs(E?.target,f.current,m.current))return;const W=on(w,C,D);O?c.current?.onstart?.(W):L?c.current?.onend?.(W):x&&c.current?.onmove?.(W)},{axis:c.current?.lockAxis==="x"?"x":void 0,threshold:0,pointer:{capture:!0}}));const y=l.current;if(r&&y?.edges){const P=y.edges;P.left&&f.current&&(a.current=new sn(f.current,x=>{const{active:C,delta:D,xy:E,first:O,last:L}=x,W=on(w,D,E,{left:!0},{left:D[0]});O?y.onstart?.(W):L?y.onend?.(W):C&&y.onmove?.(W)},{pointer:{capture:!0},threshold:0})),P.right&&m.current&&(h.current=new sn(m.current,x=>{const{active:C,delta:D,xy:E,first:O,last:L}=x,W=on(w,D,E,{right:!0},{right:D[0]});O?y.onstart?.(W):L?y.onend?.(W):C&&y.onmove?.(W)},{pointer:{capture:!0},threshold:0}))}});return T.useEffect(()=>{if(!i.current)return;const w={target:i.current,unset:()=>{u.current?.destroy(),a.current?.destroy(),h.current?.destroy()}};e&&(e.current=w),v()},[t,r]),ir({children:n,ref:i,draggable:!1,style:{...t&&{touchAction:"none"}}})},cr=T.forwardRef((n,e)=>{const t=ze.c(70),{children:r,edges:s,left:o,width:i,start:c,grid:l,getBounds:u,enableResizing:a,enableDragging:h,adsorptionDistance:f,adsorptionPositions:m,onResizeStart:g,onResize:b,onResizeEnd:v,onDragStart:w,onDragEnd:_,onDrag:S,parentRef:y,autoScroll:P}=n,x=c===void 0?Gt:c,C=l===void 0?an:l,D=u===void 0?$s:u,E=a===void 0?!0:a,O=h===void 0?!0:h,L=f===void 0?ln:f;let W;t[0]!==m?(W=m===void 0?[]:m,t[0]=m,t[1]=W):W=t[1];const V=W,q=P===void 0?!0:P,M=T.useRef(void 0),k=T.useRef(0),K=T.useRef(!1),{initAutoScroll:ue,stopAutoScroll:fe,dealDragAutoScroll:me,dealResizeAutoScroll:d}=Br(y);let A,U;t[2]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{const j=M.current;return()=>{j?.unset()}},U=[],t[2]=A,t[3]=U):(A=t[2],U=t[3]),T.useEffect(A,U);let B;t[4]===Symbol.for("react.memo_cache_sentinel")?(B=(j,Z)=>{const X=Z===void 0?!0:Z;if(!M.current||!M.current.target)return;X&&(k.current=0);const F=M.current.target;F.style.left=`${j}px`,Object.assign(F.dataset,{left:j})},t[4]=B):B=t[4];const J=B;let Y;t[5]===Symbol.for("react.memo_cache_sentinel")?(Y=(j,Z)=>{const X=Z===void 0?!0:Z;if(!M.current||!M.current.target)return;X&&(k.current=0);const F=M.current.target;F.style.width=`${j}px`,Object.assign(F.dataset,{width:j})},t[5]=Y):Y=t[5];const $=Y;let N;t[6]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{if(!M.current?.target)return 0;const j=M.current.target;return parseFloat(j?.dataset?.left||"0")},t[6]=N):N=t[6];const I=N;let H;t[7]===Symbol.for("react.memo_cache_sentinel")?(H=()=>{if(!M.current?.target)return 0;const j=M.current.target;return parseFloat(j?.dataset?.width||"0")},t[7]=H):H=t[7];const Zt=H;let rt,Fe;t[8]!==i?(rt=()=>{if(!M.current?.target)return;const j=M.current.target;$(typeof i>"u"?j.offsetWidth:i,!1)},Fe=[i],t[8]=i,t[9]=rt,t[10]=Fe):(rt=t[9],Fe=t[10]),T.useEffect(rt,Fe);let Ae,Re;t[11]!==o?(Ae=()=>{J(o||0,!1)},Re=[o],t[11]=o,t[12]=Ae,t[13]=Re):(Ae=t[12],Re=t[13]),T.useEffect(Ae,Re);let Ve;t[14]===Symbol.for("react.memo_cache_sentinel")?(Ve=()=>({updateLeft:j=>J(j||0,!1),updateWidth:j=>$(j,!1),getLeft:I,getWidth:Zt}),t[14]=Ve):Ve=t[14],T.useImperativeHandle(e,Ve);let Pe;t[15]!==ue||t[16]!==w?(Pe=()=>{k.current=0,K.current=!1,ue(),w&&w()},t[15]=ue,t[16]=w,t[17]=Pe):Pe=t[17];const De=Pe;let Oe;t[18]!==L||t[19]!==V||t[20]!==D||t[21]!==C||t[22]!==S||t[23]!==x?(Oe=j=>{const{preLeft:Z,preWidth:X,scrollDelta:F}=j;F&&(k.current=k.current+F);const ne=K.current?L:C;if(Math.abs(k.current)>=ne){const re=parseInt(k.current/ne+"");let G=Z+re*ne,z=G;const se=Number.MAX_SAFE_INTEGER;if(V.forEach(ee=>{const Q=Math.abs(ee-G);Q<L&&Q<se&&(z=ee);const ce=Math.abs(ee-(G+X));ce<L&&ce<se&&(z=ee-X)}),z!==G?(K.current=!0,G=z):((G-x)%C!==0&&(G=x+C*Math.round((G-x)/C)),K.current=!1),k.current=k.current%ne,G<D().left?G=D().left:G+X>D().right&&(G=D().right-X),S&&S({lastLeft:Z,left:G,lastWidth:X,width:X},F)===!1)return;J(G,!1)}},t[18]=L,t[19]=V,t[20]=D,t[21]=C,t[22]=S,t[23]=x,t[24]=Oe):Oe=t[24];const st=Oe;let ot;t[25]!==q||t[26]!==me||t[27]!==st||t[28]!==y?(ot=j=>{const Z=j.target,{left:X,width:F}=Z.dataset,ne=parseFloat(X||"0"),re=parseFloat(F||"0");k.current=k.current+j.dx,!(q&&y?.current&&!me(j,se=>{if(!y?.current||!M.current?.target)return;y.current.scrollLeft=y.current.scrollLeft+se;const ee=M.current.target,Q=parseFloat(ee.dataset.left||"0"),ce=parseFloat(ee.dataset.width||"0");st({preLeft:Q,preWidth:ce,scrollDelta:se})}))&&st({preLeft:ne,preWidth:re})},t[25]=q,t[26]=me,t[27]=st,t[28]=y,t[29]=ot):ot=t[29];const Ue=ot;let be;t[30]!==_||t[31]!==fe?(be=j=>{k.current=0,K.current=!1,fe();const Z=j.target,{left:X,width:F}=Z.dataset;_&&_({left:parseFloat(X||"0"),width:parseFloat(F||"0")})},t[30]=_,t[31]=fe,t[32]=be):be=t[32];const $e=be;let Le;t[33]!==ue||t[34]!==g?(Le=j=>{k.current=0,K.current=!1,ue();const Z=j.edges?.right?"right":"left";g&&g(Z)},t[33]=ue,t[34]=g,t[35]=Le):Le=t[35];const Ke=Le;let Me;t[36]!==L||t[37]!==V||t[38]!==D||t[39]!==C||t[40]!==b||t[41]!==x?(Me=j=>{const{dir:Z,preWidth:X,preLeft:F,scrollDelta:ne}=j;ne&&(k.current=k.current+ne);const re=K.current?L:C;if(Z==="left"){if(Math.abs(k.current)>=re){const G=parseInt(k.current/re+"");let z=F+G*re,se=z;const ee=Number.MAX_SAFE_INTEGER;V.forEach(_e=>{const We=Math.abs(_e-z);We<L&&We<ee&&(se=_e)}),se!==z?(K.current=!0,z=se):((z-x)%C!==0&&(z=x+C*Math.round((z-x)/C)),K.current=!1),k.current=k.current%re;const Q=F+X;z<D().left&&(z=D().left);const ce=Q-z;if(z>=Q||b&&b("left",{lastLeft:F,lastWidth:X,left:z,width:ce})===!1)return;J(z,!1),$(ce,!1)}}else if(Z==="right"&&Math.abs(k.current)>=re){const G=parseInt(k.current/C+"");let z=X+G*C,se=F+z;const ee=Number.MAX_SAFE_INTEGER;if(V.forEach(Q=>{const ce=Math.abs(Q-(F+z));ce<L&&ce<ee&&(se=Q)}),se!==F+z)K.current=!0,z=se-F;else{let Q=F+z;(Q-x)%C!==0&&(Q=x+C*Math.round((Q-x)/C),z=Q-F),K.current=!1}if(k.current=k.current%re,F+z>D().right&&(z=D().right-F),z<=0||b&&b("right",{lastLeft:F,lastWidth:X,left:F,width:z})===!1)return;$(z,!1)}},t[36]=L,t[37]=V,t[38]=D,t[39]=C,t[40]=b,t[41]=x,t[42]=Me):Me=t[42];const ye=Me;let Ne;t[43]!==q||t[44]!==d||t[45]!==y||t[46]!==ye?(Ne=j=>{const Z=j.target,X=j.edges?.left?"left":"right",{left:F,width:ne}=Z.dataset,re=parseFloat(F||"0"),G=parseFloat(ne||"0");k.current=k.current+(X==="left"?j.deltaRect?.left||0:j.deltaRect?.right||0),!(q&&y?.current&&!d(j,X,ee=>{if(!y?.current||!M.current?.target)return;y.current.scrollLeft=y.current.scrollLeft+ee;const Q=M.current.target,ce=parseFloat(Q.dataset.left||"0"),_e=parseFloat(Q.dataset.width||"0");ye({preLeft:ce,preWidth:_e,dir:X,scrollDelta:ee})}))&&ye({preLeft:re,preWidth:G,dir:X})},t[43]=q,t[44]=d,t[45]=y,t[46]=ye,t[47]=Ne):Ne=t[47];const qe=Ne;let Ie;t[48]!==v||t[49]!==fe?(Ie=j=>{k.current=0,K.current=!1,fe();const Z=j.target,{left:X,width:F}=Z.dataset,ne=j.edges?.right?"right":"left";v&&v(ne,{left:parseFloat(X||"0"),width:parseFloat(F||"0")})},t[48]=v,t[49]=fe,t[50]=Ie):Ie=t[50];const Je=Ie;let Ee;t[51]!==Ue||t[52]!==De||t[53]!==$e?(Ee={lockAxis:"x",onmove:Ue,onstart:De,onend:$e,cursorChecker:Hs},t[51]=Ue,t[52]=De,t[53]=$e,t[54]=Ee):Ee=t[54];let xe;t[55]!==s||t[56]!==qe||t[57]!==Ke||t[58]!==Je?(xe={axis:"x",invert:"none",edges:s,onmove:qe,onstart:Ke,onend:Je},t[55]=s,t[56]=qe,t[57]=Ke,t[58]=Je,t[59]=xe):xe=t[59];const He=r;let Ce;t[60]!==o||t[61]!==He||t[62]!==i?(Ce=ir({children:He,style:{left:o,width:i}}),t[60]=o,t[61]=He,t[62]=i,t[63]=Ce):Ce=t[63];let ke;return t[64]!==O||t[65]!==E||t[66]!==Ee||t[67]!==xe||t[68]!==Ce?(ke=R.jsx(Us,{interactRef:M,draggable:O,resizable:E,draggableOptions:Ee,resizableOptions:xe,children:Ce}),t[64]=O,t[65]=E,t[66]=Ee,t[67]=xe,t[68]=Ce,t[69]=ke):ke=t[69],ke});function $s(){return{left:Number.MIN_SAFE_INTEGER,right:Number.MAX_SAFE_INTEGER}}function Hs(){return""}function Bs(){let n=0,e,t="",r=arguments.length;for(;n<r;n++)(e=arguments[n])&&typeof e=="string"&&(t+=(t&&" ")+e);return t}const Ys=n=>{const e=ze.c(191),{editorData:t,row:r,action:s,effects:o,rowHeight:i,scale:c,scaleWidth:l,scaleSplitCount:u,startLeft:a,gridSnap:h,disableDrag:f,scaleCount:m,maxScaleCount:g,setScaleCount:b,onActionMoveStart:v,onActionMoving:w,onActionMoveEnd:_,onActionResizeStart:S,onActionResizeEnd:y,onActionResizing:P,dragLineData:x,setEditorData:C,onClickAction:D,onClickActionOnly:E,onDoubleClickAction:O,onContextMenuAction:L,getActionRender:W,handleTime:V,scrollContainerRef:q}=n,M=T.useRef(null),k=T.useRef(!1),{id:K,maxEnd:ue,minStart:fe,end:me,start:d,selected:A,flexible:U,movable:B,effectId:J}=s,Y=U===void 0?!0:U,$=B===void 0?!0:B,N=c??$t,I=l??Ht,H=a??Gt,Zt=u??Kn,rt=g??Number.MAX_SAFE_INTEGER,Fe=fe||0;let Ae;e[0]!==N||e[1]!==I||e[2]!==H||e[3]!==Fe?(Ae=je(Fe,{startLeft:H,scale:N,scaleWidth:I}),e[0]=N,e[1]=I,e[2]=H,e[3]=Fe,e[4]=Ae):Ae=e[4];const Re=Ae,Ve=ue||Number.MAX_VALUE;let Pe;e[5]!==N||e[6]!==I||e[7]!==H||e[8]!==Ve?(Pe=je(Ve,{startLeft:H,scale:N,scaleWidth:I}),e[5]=N,e[6]=I,e[7]=H,e[8]=Ve,e[9]=Pe):Pe=e[9];const De=Math.min(rt*I+H,Pe);let Oe;e[10]!==me||e[11]!==N||e[12]!==I||e[13]!==H||e[14]!==d?(Oe=hn({start:d,end:me},{startLeft:H,scale:N,scaleWidth:I}),e[10]=me,e[11]=N,e[12]=I,e[13]=H,e[14]=d,e[15]=Oe):Oe=e[15];const st=Oe,[ot,Ue]=T.useState(null),be=ot??st,$e=I/Zt;let Le;e[16]!==J||e[17]!==o||e[18]!==Y||e[19]!==$||e[20]!==A?(Le=de(Bs("action",$&&"action-movable",A&&"action-selected",Y&&"action-flexible",o[J]&&`action-effect-${J}`)),e[16]=J,e[17]=o,e[18]=Y,e[19]=$,e[20]=A,e[21]=Le):Le=e[21];const Ke=Le;let Me;e[22]!==I||e[23]!==H||e[24]!==m||e[25]!==b?(Me=(pe,ge)=>{const oe=Wr(pe+ge,{startLeft:H,scaleCount:m,scaleWidth:I});oe!==m&&b(oe)},e[22]=I,e[23]=H,e[24]=m,e[25]=b,e[26]=Me):Me=e[26];const ye=Me;let Ne;e[27]!==s||e[28]!==v||e[29]!==r?(Ne=()=>{v&&v({action:s,row:r})},e[27]=s,e[28]=v,e[29]=r,e[30]=Ne):Ne=e[30];const qe=Ne;let Ie;e[31]!==s||e[32]!==ye||e[33]!==w||e[34]!==r||e[35]!==N||e[36]!==I||e[37]!==H?(Ie=pe=>{const{left:ge,width:oe}=pe;if(k.current=!0,w){const{start:le,end:ie}=At({left:ge,width:oe},{scaleWidth:I,scale:N,startLeft:H});if(w({action:s,row:r,start:le,end:ie})===!1)return!1}Ue({left:ge,width:oe}),ye(ge,oe)},e[31]=s,e[32]=ye,e[33]=w,e[34]=r,e[35]=N,e[36]=I,e[37]=H,e[38]=Ie):Ie=e[38];const Je=Ie;let Ee;e[39]!==t||e[40]!==K||e[41]!==_||e[42]!==r||e[43]!==N||e[44]!==I||e[45]!==H||e[46]!==C?(Ee=pe=>{const{left:ge,width:oe}=pe,{start:le,end:ie}=At({left:ge,width:oe},{scaleWidth:I,scale:N,startLeft:H}),ae=t.find(Ge=>Ge.id===r.id);if(!ae)return;const Xe=ae.actions.find(Ge=>Ge.id===K);Xe&&(Xe.start=le,Xe.end=ie,C(t),_&&_({action:Xe,row:r,start:le,end:ie}),Ue(null))},e[39]=t,e[40]=K,e[41]=_,e[42]=r,e[43]=N,e[44]=I,e[45]=H,e[46]=C,e[47]=Ee):Ee=e[47];const xe=Ee;let He;e[48]!==s||e[49]!==S||e[50]!==r?(He=pe=>{S&&S({action:s,row:r,dir:pe})},e[48]=s,e[49]=S,e[50]=r,e[51]=He):He=e[51];const Ce=He;let ke;e[52]!==s||e[53]!==ye||e[54]!==P||e[55]!==r||e[56]!==N||e[57]!==I||e[58]!==H?(ke=(pe,ge)=>{const{left:oe,width:le}=ge;if(k.current=!0,P){const{start:ie,end:ae}=At({left:oe,width:le},{scaleWidth:I,scale:N,startLeft:H});if(P({action:s,row:r,start:ie,end:ae,dir:pe})===!1)return!1}Ue({left:oe,width:le}),ye(oe,le)},e[52]=s,e[53]=ye,e[54]=P,e[55]=r,e[56]=N,e[57]=I,e[58]=H,e[59]=ke):ke=e[59];const j=ke;let Z;e[60]!==t||e[61]!==K||e[62]!==y||e[63]!==r||e[64]!==N||e[65]!==I||e[66]!==H||e[67]!==C?(Z=(pe,ge)=>{const{left:oe,width:le}=ge,{start:ie,end:ae}=At({left:oe,width:le},{scaleWidth:I,scale:N,startLeft:H}),Xe=t.find(Qt=>Qt.id===r.id);if(!Xe)return;const Ge=Xe.actions.find(Qt=>Qt.id===K);Ge&&(Ge.start=ie,Ge.end=ae,C(t),y&&y({action:Ge,row:r,start:ie,end:ae,dir:pe}),Ue(null))},e[60]=t,e[61]=K,e[62]=y,e[63]=r,e[64]=N,e[65]=I,e[66]=H,e[67]=C,e[68]=Z):Z=e[68];const X=Z;let F,ne,re,G,z,se,ee,Q,ce,_e,We,it,ct,at,lt,ut,Be,Ye,ft,dt,ht,mt,pt,gt,vt,bt;if(e[69]!==s||e[70]!==Ke||e[71]!==f||e[72]!==x.assistPositions||e[73]!==Y||e[74]!==W||e[75]!==$e||e[76]!==h||e[77]!==Je||e[78]!==xe||e[79]!==qe||e[80]!==X||e[81]!==Ce||e[82]!==j||e[83]!==V||e[84]!==Re||e[85]!==$||e[86]!==D||e[87]!==E||e[88]!==L||e[89]!==O||e[90]!==De||e[91]!==r||e[92]!==i||e[93]!==N||e[94]!==I||e[95]!==H||e[96]!==q||e[97]!==be.left||e[98]!==be.width){const pe={...s,...At({left:be.left,width:be.width},{startLeft:H,scaleWidth:I,scale:N})},ge={...r,actions:[...r.actions]};r.actions.includes(s)&&(ge.actions[r.actions.indexOf(s)]=pe),F=cr,ce=M,_e=q,We=H,it=be.left,ct=be.width,at=h&&$e||an,lt=h?Math.max(($e||an)/2,ln):ln,ut=x.assistPositions,e[125]!==Re||e[126]!==De?(Be=()=>({left:Re,right:De}),e[125]=Re,e[126]=De,e[127]=Be):Be=e[127];let oe;e[128]!==f||e[129]!==Y?(oe=!f&&Y&&`.${de("action-left-stretch")}`,e[128]=f,e[129]=Y,e[130]=oe):oe=e[130];let le;e[131]!==f||e[132]!==Y?(le=!f&&Y&&`.${de("action-right-stretch")}`,e[131]=f,e[132]=Y,e[133]=le):le=e[133],e[134]!==oe||e[135]!==le?(Ye={left:oe,right:le},e[134]=oe,e[135]=le,e[136]=Ye):Ye=e[136],ft=!f&&$,dt=!f&&Y,ht=qe,mt=Je,pt=xe,gt=Ce,vt=j,bt=X,e[137]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>{k.current=!1},e[137]=ne):ne=e[137],e[138]!==s||e[139]!==V||e[140]!==D||e[141]!==E||e[142]!==r?(re=ie=>{let ae;D&&(ae=V(ie),D(ie,{row:r,action:s,time:ae})),!k.current&&E&&(ae===void 0&&(ae=V(ie)),E(ie,{row:r,action:s,time:ae}))},e[138]=s,e[139]=V,e[140]=D,e[141]=E,e[142]=r,e[143]=re):re=e[143],e[144]!==s||e[145]!==V||e[146]!==O||e[147]!==r?(G=ie=>{if(O){const ae=V(ie);O(ie,{row:r,action:s,time:ae})}},e[144]=s,e[145]=V,e[146]=O,e[147]=r,e[148]=G):G=e[148],e[149]!==s||e[150]!==V||e[151]!==L||e[152]!==r?(z=ie=>{if(L){const ae=V(ie);L(ie,{row:r,action:s,time:ae})}},e[149]=s,e[150]=V,e[151]=L,e[152]=r,e[153]=z):z=e[153],se=Ke,e[154]!==i?(ee={height:i},e[154]=i,e[155]=ee):ee=e[155],Q=W&&W(pe,ge),e[69]=s,e[70]=Ke,e[71]=f,e[72]=x.assistPositions,e[73]=Y,e[74]=W,e[75]=$e,e[76]=h,e[77]=Je,e[78]=xe,e[79]=qe,e[80]=X,e[81]=Ce,e[82]=j,e[83]=V,e[84]=Re,e[85]=$,e[86]=D,e[87]=E,e[88]=L,e[89]=O,e[90]=De,e[91]=r,e[92]=i,e[93]=N,e[94]=I,e[95]=H,e[96]=q,e[97]=be.left,e[98]=be.width,e[99]=F,e[100]=ne,e[101]=re,e[102]=G,e[103]=z,e[104]=se,e[105]=ee,e[106]=Q,e[107]=ce,e[108]=_e,e[109]=We,e[110]=it,e[111]=ct,e[112]=at,e[113]=lt,e[114]=ut,e[115]=Be,e[116]=Ye,e[117]=ft,e[118]=dt,e[119]=ht,e[120]=mt,e[121]=pt,e[122]=gt,e[123]=vt,e[124]=bt}else F=e[99],ne=e[100],re=e[101],G=e[102],z=e[103],se=e[104],ee=e[105],Q=e[106],ce=e[107],_e=e[108],We=e[109],it=e[110],ct=e[111],at=e[112],lt=e[113],ut=e[114],Be=e[115],Ye=e[116],ft=e[117],dt=e[118],ht=e[119],mt=e[120],pt=e[121],gt=e[122],vt=e[123],bt=e[124];let _t;e[156]!==Y?(_t=Y&&R.jsx("div",{className:de("action-left-stretch"),style:{touchAction:"none"}}),e[156]=Y,e[157]=_t):_t=e[157];let wt;e[158]!==Y?(wt=Y&&R.jsx("div",{className:de("action-right-stretch"),style:{touchAction:"none"}}),e[158]=Y,e[159]=wt):wt=e[159];let St;e[160]!==ne||e[161]!==re||e[162]!==G||e[163]!==z||e[164]!==se||e[165]!==ee||e[166]!==Q||e[167]!==_t||e[168]!==wt?(St=R.jsxs("div",{onMouseDown:ne,onClick:re,onDoubleClick:G,onContextMenu:z,className:se,style:ee,children:[Q,_t,wt]}),e[160]=ne,e[161]=re,e[162]=G,e[163]=z,e[164]=se,e[165]=ee,e[166]=Q,e[167]=_t,e[168]=wt,e[169]=St):St=e[169];let Mt;return e[170]!==F||e[171]!==ce||e[172]!==_e||e[173]!==We||e[174]!==it||e[175]!==ct||e[176]!==at||e[177]!==lt||e[178]!==ut||e[179]!==Be||e[180]!==Ye||e[181]!==ft||e[182]!==dt||e[183]!==ht||e[184]!==mt||e[185]!==pt||e[186]!==gt||e[187]!==vt||e[188]!==bt||e[189]!==St?(Mt=R.jsx(F,{ref:ce,parentRef:_e,start:We,left:it,width:ct,grid:at,adsorptionDistance:lt,adsorptionPositions:ut,getBounds:Be,edges:Ye,enableDragging:ft,enableResizing:dt,onDragStart:ht,onDrag:mt,onDragEnd:pt,onResizeStart:gt,onResize:vt,onResizeEnd:bt,children:St}),e[170]=F,e[171]=ce,e[172]=_e,e[173]=We,e[174]=it,e[175]=ct,e[176]=at,e[177]=lt,e[178]=ut,e[179]=Be,e[180]=Ye,e[181]=ft,e[182]=dt,e[183]=ht,e[184]=mt,e[185]=pt,e[186]=gt,e[187]=vt,e[188]=bt,e[189]=St,e[190]=Mt):Mt=e[190],Mt};function Et(n,e,t){let r=t.initialDeps??[],s;function o(){var i,c,l,u;let a;t.key&&((i=t.debug)!=null&&i.call(t))&&(a=Date.now());const h=n();if(!(h.length!==r.length||h.some((g,b)=>r[b]!==g)))return s;r=h;let m;if(t.key&&((c=t.debug)!=null&&c.call(t))&&(m=Date.now()),s=e(...h),t.key&&((l=t.debug)!=null&&l.call(t))){const g=Math.round((Date.now()-a)*100)/100,b=Math.round((Date.now()-m)*100)/100,v=b/16,w=(_,S)=>{for(_=String(_);_.length<S;)_=" "+_;return _};console.info(`%c⏱ ${w(b,5)} /${w(g,5)} ms`,`
|
|
10
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),t.useMemoCache(e)}})()),rn}var An;function Vr(){return An||(An=1,process.env.NODE_ENV==="production"?Wt.exports=jr():Wt.exports=Fr()),Wt.exports}var Le=Vr();function Ur(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.map(function(r){return r.split(" ").map(function(s){return s?""+n+s:""}).join(" ")}).join(" ")}function de(...n){return Ur(`${an}-`,...n)}const $r=n=>{const e=Le.c(11),{isMoving:t,movePositions:r,assistPositions:s}=n;let o,i;if(e[0]!==t||e[1]!==r||e[2]!==s){const a=r===void 0?[]:r;let u;e[5]!==s?(u=s===void 0?[]:s,e[5]=s,e[6]=u):u=e[6];const l=u;e[7]===Symbol.for("react.memo_cache_sentinel")?(o=de("drag-line-container"),e[7]=o):o=e[7],i=t&&a.filter(h=>l.includes(h)).map(Hr),e[0]=t,e[1]=r,e[2]=s,e[3]=o,e[4]=i}else o=e[3],i=e[4];let c;return e[8]!==o||e[9]!==i?(c=R.jsx("div",{className:o,children:i}),e[8]=o,e[9]=i,e[10]=c):c=e[10],c};function Hr(n,e){return R.jsx("div",{className:de("drag-line"),style:{left:n}},e)}const zt=1,Tn=10,Dn=10;function Br(n){const e=Le.c(7),t=N.useRef(Number.MIN_SAFE_INTEGER),r=N.useRef(Number.MAX_SAFE_INTEGER),s=N.useRef(zt),o=N.useRef(void 0);let i;e[0]!==n?(i=()=>{if(n?.current){const{left:v,width:p}=n.current.getBoundingClientRect();t.current=v,r.current=v+p}},e[0]=n,e[1]=i):i=e[1];const c=i;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(v,p)=>{if(v.clientX>=r.current||v.clientX<=t.current){o.current!==void 0&&cancelAnimationFrame(o.current);const w=Math.abs(v.clientX>=r.current?v.clientX-r.current:v.clientX-t.current);s.current=Math.min(Number((w/Dn).toFixed(0))*zt,Tn);const _=(v.clientX>=r.current?1:-1)*s.current,E=()=>{p&&p(_),o.current=requestAnimationFrame(E)};return o.current=requestAnimationFrame(E),!1}else o.current!==void 0&&cancelAnimationFrame(o.current);return!0},e[2]=a):a=e[2];const u=a;let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=(v,p,w)=>{if(v.clientX>=r.current||v.clientX<t.current){o.current!==void 0&&cancelAnimationFrame(o.current);const b=Math.abs(v.clientX>=r.current?v.clientX-r.current:v.clientX-t.current);s.current=Math.min(Number((b/Dn).toFixed(0))*zt,Tn);const E=(v.clientX>=r.current?1:-1)*s.current,P=()=>{w&&w(E),o.current=requestAnimationFrame(P)};return o.current=requestAnimationFrame(P),!1}else o.current!==void 0&&cancelAnimationFrame(o.current);return!0},e[3]=l):l=e[3];const h=l;let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{t.current=Number.MIN_SAFE_INTEGER,r.current=Number.MAX_SAFE_INTEGER,s.current=zt,o.current!==void 0&&cancelAnimationFrame(o.current)},e[4]=f):f=e[4];const m=f;let S;return e[5]!==c?(S={initAutoScroll:c,dealDragAutoScroll:u,dealResizeAutoScroll:h,stopAutoScroll:m},e[5]=c,e[6]=S):S=e[6],S}function Yr(n,e,t){return Math.max(e,Math.min(n,t))}const he={toVector(n,e){return n===void 0&&(n=e),Array.isArray(n)?n:[n,n]},add(n,e){return[n[0]+e[0],n[1]+e[1]]},sub(n,e){return[n[0]-e[0],n[1]-e[1]]},addTo(n,e){n[0]+=e[0],n[1]+=e[1]},subTo(n,e){n[0]-=e[0],n[1]-=e[1]}};function Ln(n,e,t){return e===0||Math.abs(e)===1/0?Math.pow(n,t*5):n*e*t/(e+t*n)}function Pn(n,e,t,r=.15){return r===0?Yr(n,e,t):n<e?-Ln(e-n,t-e,r)+e:n>t?+Ln(n-t,t-e,r)+t:n}function Xr(n,[e,t],[r,s]){const[[o,i],[c,a]]=n;return[Pn(e,o,i,r),Pn(t,c,a,s)]}function Kr(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function qr(n){var e=Kr(n,"string");return typeof e=="symbol"?e:String(e)}function be(n,e,t){return e=qr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function On(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,r)}return t}function ee(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?On(Object(t),!0).forEach(function(r){be(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):On(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}const Qn={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function Mn(n){return n?n[0].toUpperCase()+n.slice(1):""}const Gr=["enter","leave"];function Jr(n=!1,e){return n&&!Gr.includes(e)}function Zr(n,e="",t=!1){const r=Qn[n],s=r&&r[e]||e;return"on"+Mn(n)+Mn(s)+(Jr(t,s)?"Capture":"")}const Qr=["gotpointercapture","lostpointercapture"];function es(n){let e=n.substring(2).toLowerCase();const t=!!~e.indexOf("passive");t&&(e=e.replace("passive",""));const r=Qr.includes(e)?"capturecapture":"capture",s=!!~e.indexOf(r);return s&&(e=e.replace("capture","")),{device:e,capture:s,passive:t}}function ts(n,e=""){const t=Qn[n],r=t&&t[e]||e;return n+r}function Jt(n){return"touches"in n}function er(n){return Jt(n)?"touch":"pointerType"in n?n.pointerType:"mouse"}function ns(n){return Array.from(n.touches).filter(e=>{var t,r;return e.target===n.currentTarget||((t=n.currentTarget)===null||t===void 0||(r=t.contains)===null||r===void 0?void 0:r.call(t,e.target))})}function rs(n){return n.type==="touchend"||n.type==="touchcancel"?n.changedTouches:n.targetTouches}function tr(n){return Jt(n)?rs(n)[0]:n}function ss(n){return ns(n).map(e=>e.identifier)}function sn(n){const e=tr(n);return Jt(n)?e.identifier:e.pointerId}function Nn(n){const e=tr(n);return[e.clientX,e.clientY]}function os(n){const e={};if("buttons"in n&&(e.buttons=n.buttons),"shiftKey"in n){const{shiftKey:t,altKey:r,metaKey:s,ctrlKey:o}=n;Object.assign(e,{shiftKey:t,altKey:r,metaKey:s,ctrlKey:o})}return e}function Xt(n,...e){return typeof n=="function"?n(...e):n}function is(){}function cs(...n){return n.length===0?is:n.length===1?n[0]:function(){let e;for(const t of n)e=t.apply(this,arguments)||e;return e}}function In(n,e){return Object.assign({},e,n||{})}const as=32;class ls{constructor(e,t,r){this.ctrl=e,this.args=t,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:r,args:s}=this;t[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=s,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,r=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=r.from?Xt(r.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:r,shared:s}=this;t.args=this.args;let o=0;if(e&&(t.event=e,r.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,s.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,s.locked=!!document.pointerLockElement,Object.assign(s,os(e)),s.down=s.pressed=s.buttons%2===1||s.touches>0,o=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const T=t._delta.map(Math.abs);he.addTo(t._distance,T)}this.axisIntent&&this.axisIntent(e);const[i,c]=t._movement,[a,u]=r.threshold,{_step:l,values:h}=t;if(r.hasCustomTransform?(l[0]===!1&&(l[0]=Math.abs(i)>=a&&h[0]),l[1]===!1&&(l[1]=Math.abs(c)>=u&&h[1])):(l[0]===!1&&(l[0]=Math.abs(i)>=a&&Math.sign(i)*a),l[1]===!1&&(l[1]=Math.abs(c)>=u&&Math.sign(c)*u)),t.intentional=l[0]!==!1||l[1]!==!1,!t.intentional)return;const f=[0,0];if(r.hasCustomTransform){const[T,C]=h;f[0]=l[0]!==!1?T-l[0]:0,f[1]=l[1]!==!1?C-l[1]:0}else f[0]=l[0]!==!1?i-l[0]:0,f[1]=l[1]!==!1?c-l[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(f);const m=t.offset,S=t._active&&!t._blocked||t.active;S&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=s[this.ingKey]=t._active,e&&(t.first&&("bounds"in r&&(t._bounds=Xt(r.bounds,t)),this.setup&&this.setup()),t.movement=f,this.computeOffset()));const[v,p]=t.offset,[[w,b],[_,E]]=t._bounds;t.overflow=[v<w?-1:v>b?1:0,p<_?-1:p>E?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const P=t._active?r.rubberband||[0,0]:[0,0];if(t.offset=Xr(t._bounds,t.offset,P),t.delta=he.sub(t.offset,m),this.computeMovement(),S&&(!t.last||o>as)){t.delta=he.sub(t.offset,m);const T=t.delta.map(Math.abs);he.addTo(t.distance,T),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&o>0&&(t.velocity=[T[0]/o,T[1]/o],t.timeDelta=o)}}emit(){const e=this.state,t=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const s=this.handler(ee(ee(ee({},t),e),{},{[this.aliasKey]:e.values}));s!==void 0&&(e.memo=s)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function us([n,e],t){const r=Math.abs(n),s=Math.abs(e);if(r>s&&r>t)return"x";if(s>r&&s>t)return"y"}class fs extends ls{constructor(...e){super(...e),be(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=he.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=he.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,r=this.config;if(!t.axis&&e){const s=typeof r.axisThreshold=="object"?r.axisThreshold[er(e)]:r.axisThreshold;t.axis=us(t._movement,s)}t._blocked=(r.lockDirection||!!r.axis)&&!t.axis||!!r.axis&&r.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const kn=n=>n,Wn=.15,mn={enabled(n=!0){return n},eventOptions(n,e,t){return ee(ee({},t.shared.eventOptions),n)},preventDefault(n=!1){return n},triggerAllEvents(n=!1){return n},rubberband(n=0){switch(n){case!0:return[Wn,Wn];case!1:return[0,0];default:return he.toVector(n)}},from(n){if(typeof n=="function")return n;if(n!=null)return he.toVector(n)},transform(n,e,t){const r=n||t.shared.transform;if(this.hasCustomTransform=!!r,process.env.NODE_ENV==="development"){const s=r||kn;return o=>{const i=s(o);return(!isFinite(i[0])||!isFinite(i[1]))&&console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${i[0]},${[1]}]`),i}}return r||kn},threshold(n){return he.toVector(n,0)}};process.env.NODE_ENV==="development"&&Object.assign(mn,{domTarget(n){if(n!==void 0)throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");return NaN},lockDirection(n){if(n!==void 0)throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");return NaN},initial(n){if(n!==void 0)throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");return NaN}});const ds=0,Pt=ee(ee({},mn),{},{axis(n,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(n=ds){return n},bounds(n={}){if(typeof n=="function")return o=>Pt.bounds(n(o));if("current"in n)return()=>n.current;if(typeof HTMLElement=="function"&&n instanceof HTMLElement)return n;const{left:e=-1/0,right:t=1/0,top:r=-1/0,bottom:s=1/0}=n;return[[e,t],[r,s]]}}),zn={ArrowRight:(n,e=1)=>[n*e,0],ArrowLeft:(n,e=1)=>[-1*n*e,0],ArrowUp:(n,e=1)=>[0,-1*n*e],ArrowDown:(n,e=1)=>[0,n*e]};class hs extends fs{constructor(...e){super(...e),be(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),s={left:t.left-r.left+e.offset[0],right:t.right-r.right+e.offset[0],top:t.top-r.top+e.offset[1],bottom:t.bottom-r.bottom+e.offset[1]};e._bounds=Pt.bounds(s)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const s=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(s&&s.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=sn(e),r._pointerActive=!0,this.computeValues(Nn(e)),this.computeInitial(),t.preventScrollAxis&&er(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,r=this.config;if(!t._pointerActive)return;const s=sn(e);if(t._pointerId!==void 0&&s!==t._pointerId)return;const o=Nn(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=he.sub(o,t._values),this.computeValues(o)),he.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{process.env.NODE_ENV==="development"&&console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.")}const t=this.state,r=this.config;if(!t._active||!t._pointerActive)return;const s=sn(e);if(t._pointerId!==void 0&&s!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=t._distance;if(t.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,t.tap&&r.filterTaps)t._force=!0;else{const[c,a]=t._delta,[u,l]=t._movement,[h,f]=r.swipe.velocity,[m,S]=r.swipe.distance,v=r.swipe.duration;if(t.elapsedTime<v){const p=Math.abs(c/t.timeDelta),w=Math.abs(a/t.timeDelta);p>h&&Math.abs(u)>m&&(t.swipe[0]=Math.sign(c)),w>f&&Math.abs(l)>S&&(t.swipe[1]=Math.sign(a))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,r=t.device;if(process.env.NODE_ENV==="development")try{if(r==="pointer"&&t.preventScrollDelay===void 0){const s="uv"in e?e.sourceEvent.currentTarget:e.currentTarget;window.getComputedStyle(s).touchAction==="auto"&&console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.",s)}}catch{}t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,ms(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=zn[e.key];if(t){const r=this.state,s=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=t(this.config.keyboardDisplacement,s),r._keyboardActive=!0,he.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in zn&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function ms(n){"persist"in n&&typeof n.persist=="function"&&n.persist()}const Ot=typeof window<"u"&&window.document&&window.document.createElement;function nr(){return Ot&&"ontouchstart"in window}function ps(){return nr()||Ot&&window.navigator.maxTouchPoints>1}function gs(){return Ot&&"onpointerdown"in window}function vs(){return Ot&&"exitPointerLock"in window.document}function bs(){try{return"constructor"in GestureEvent}catch{return!1}}const we={isBrowser:Ot,gesture:bs(),touch:nr(),touchscreen:ps(),pointer:gs(),pointerLock:vs()},_s=250,Ss=180,ws=.5,Es=50,ys=250,Rs=10,jn={mouse:0,touch:0,pen:8},rr=ee(ee({},Pt),{},{device(n,e,{pointer:{touch:t=!1,lock:r=!1,mouse:s=!1}={}}){return this.pointerLock=r&&we.pointerLock,we.touch&&t?"touch":this.pointerLock?"mouse":we.pointer&&!s?"pointer":we.touch?"touch":"mouse"},preventScrollAxis(n,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&n?_s:void 0,!(!we.touchscreen||t===!1))return n||(t!==void 0?"y":void 0)},pointerCapture(n,e,{pointer:{capture:t=!0,buttons:r=1,keys:s=!0}={}}){return this.pointerButtons=r,this.keys=s,!this.pointerLock&&this.device==="pointer"&&t},threshold(n,e,{filterTaps:t=!1,tapsThreshold:r=3,axis:s=void 0}){const o=he.toVector(n,t?r:s?1:0);return this.filterTaps=t,this.tapsThreshold=r,o},swipe({velocity:n=ws,distance:e=Es,duration:t=ys}={}){return{velocity:this.transform(he.toVector(n)),distance:this.transform(he.toVector(e)),duration:t}},delay(n=0){switch(n){case!0:return Ss;case!1:return 0;default:return n}},axisThreshold(n){return n?ee(ee({},jn),n):jn},keyboardDisplacement(n=Rs){return n}});process.env.NODE_ENV==="development"&&Object.assign(rr,{useTouch(n){if(n!==void 0)throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");return NaN},experimental_preventWindowScrollY(n){if(n!==void 0)throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");return NaN},swipeVelocity(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");return NaN},swipeDistance(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");return NaN},swipeDuration(n){if(n!==void 0)throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");return NaN}});ee(ee({},mn),{},{device(n,e,{shared:t,pointer:{touch:r=!1}={}}){if(t.target&&!we.touch&&we.gesture)return"gesture";if(we.touch&&r)return"touch";if(we.touchscreen){if(we.pointer)return"pointer";if(we.touch)return"touch"}},bounds(n,e,{scaleBounds:t={},angleBounds:r={}}){const s=i=>{const c=In(Xt(t,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=In(Xt(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof t!="function"&&typeof r!="function"?[s(),o()]:i=>[s(i),o(i)]},threshold(n,e,t){return this.lockDirection=t.axis==="lock",he.toVector(n,this.lockDirection?[.1,3]:0)},modifierKey(n){return n===void 0?"ctrlKey":n},pinchOnWheel(n=!0){return n}});ee(ee({},Pt),{},{mouseOnly:(n=!0)=>n});ee(ee({},Pt),{},{mouseOnly:(n=!0)=>n});const sr=new Map,fn=new Map;function xs(n){sr.set(n.key,n.engine),fn.set(n.key,n.resolver)}const Cs={key:"drag",engine:hs,resolver:rr};function As(n,e){if(n==null)return{};var t={},r=Object.keys(n),s,o;for(o=0;o<r.length;o++)s=r[o],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}function Ts(n,e){if(n==null)return{};var t=As(n,e),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(s=0;s<o.length;s++)r=o[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}const Ds={target(n){if(n)return()=>"current"in n?n.current:n},enabled(n=!0){return n},window(n=we.isBrowser?window:void 0){return n},eventOptions({passive:n=!0,capture:e=!1}={}){return{passive:n,capture:e}},transform(n){return n}},Ls=["target","eventOptions","window","enabled","transform"];function Vt(n={},e){const t={};for(const[r,s]of Object.entries(e))switch(typeof s){case"function":if(process.env.NODE_ENV==="development"){const o=s.call(t,n[r],r,n);Number.isNaN(o)||(t[r]=o)}else t[r]=s.call(t,n[r],r,n);break;case"object":t[r]=Vt(n[r],s);break;case"boolean":s&&(t[r]=n[r]);break}return t}function Ps(n,e,t={}){const r=n,{target:s,eventOptions:o,window:i,enabled:c,transform:a}=r,u=Ts(r,Ls);if(t.shared=Vt({target:s,eventOptions:o,window:i,enabled:c,transform:a},Ds),e){const l=fn.get(e);t[e]=Vt(ee({shared:t.shared},u),l)}else for(const l in u){const h=fn.get(l);if(h)t[l]=Vt(ee({shared:t.shared},u[l]),h);else if(process.env.NODE_ENV==="development"&&!["drag","pinch","scroll","wheel","move","hover"].includes(l)){if(l==="domTarget")throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");console.warn(`[@use-gesture]: Unknown config key \`${l}\` was used. Please read the documentation for further information.`)}}return t}class or{constructor(e,t){be(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,s,o){const i=this._listeners,c=ts(t,r),a=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},u=ee(ee({},a),o);e.addEventListener(c,s,u);const l=()=>{e.removeEventListener(c,s,u),i.delete(l)};return i.add(l),l}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Os{constructor(){be(this,"_timeouts",new Map)}add(e,t,r=140,...s){this.remove(e),this._timeouts.set(e,window.setTimeout(t,r,...s))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class Ms{constructor(e){be(this,"gestures",new Set),be(this,"_targetEventStore",new or(this)),be(this,"gestureEventStores",{}),be(this,"gestureTimeoutStores",{}),be(this,"handlers",{}),be(this,"config",{}),be(this,"pointerIds",new Set),be(this,"touchIds",new Set),be(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Ns(this,e)}setEventIds(e){if(Jt(e))return this.touchIds=new Set(ss(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=Ps(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,r={};let s;if(!(t.target&&(s=t.target(),!s))){if(t.enabled){for(const i of this.gestures){const c=this.config[i],a=Fn(r,c.eventOptions,!!s);if(c.enabled){const u=sr.get(i);new u(this,e,i).bind(a)}}const o=Fn(r,t.eventOptions,!!s);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](ee(ee({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=cs(...r[o]);if(!s)return r;for(const o in r){const{device:i,capture:c,passive:a}=es(o);this._targetEventStore.add(s,i,"",r[o],{capture:c,passive:a})}}}}function yt(n,e){n.gestures.add(e),n.gestureEventStores[e]=new or(n,e),n.gestureTimeoutStores[e]=new Os}function Ns(n,e){e.drag&&yt(n,"drag"),e.wheel&&yt(n,"wheel"),e.scroll&&yt(n,"scroll"),e.move&&yt(n,"move"),e.pinch&&yt(n,"pinch"),e.hover&&yt(n,"hover")}const Fn=(n,e,t)=>(r,s,o,i={},c=!1)=>{var a,u;const l=(a=i.capture)!==null&&a!==void 0?a:e.capture,h=(u=i.passive)!==null&&u!==void 0?u:e.passive;let f=c?r:Zr(r,s,l);t&&h&&(f+="Passive"),n[f]=n[f]||[],n[f].push(o)};function Is(n,e={},t,r){const s=N.useMemo(()=>new Ms(n),[]);if(s.applyHandlers(n,r),s.applyConfig(e,t),N.useEffect(s.effect.bind(s)),N.useEffect(()=>s.clean.bind(s),[]),e.target===void 0)return s.bind.bind(s)}function on(n,e){return xs(Cs),Is({drag:n},e||{},"drag")}function Vn(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function ir(...n){return e=>{let t=!1;const r=n.map(s=>{const o=Vn(s,e);return!t&&typeof o=="function"&&(t=!0),o});if(t)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Vn(n[s],null)}}}}function et(...n){return g.useCallback(ir(...n),n)}function cr(n){const e=Ws(n),t=g.forwardRef((r,s)=>{const{children:o,...i}=r,c=g.Children.toArray(o),a=c.find(js);if(a){const u=a.props.children,l=c.map(h=>h===a?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:h);return R.jsx(e,{...i,ref:s,children:g.isValidElement(u)?g.cloneElement(u,void 0,l):null})}return R.jsx(e,{...i,ref:s,children:o})});return t.displayName=`${n}.Slot`,t}var ks=cr("Slot");function Ws(n){const e=g.forwardRef((t,r)=>{const{children:s,...o}=t;if(g.isValidElement(s)){const i=Vs(s),c=Fs(o,s.props);return s.type!==g.Fragment&&(c.ref=r?ir(r,i):i),g.cloneElement(s,c)}return g.Children.count(s)>1?g.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var zs=Symbol("radix.slottable");function js(n){return g.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===zs}function Fs(n,e){const t={...e};for(const r in e){const s=n[r],o=e[r];/^on[A-Z]/.test(r)?s&&o?t[r]=(...c)=>{const a=o(...c);return s(...c),a}:s&&(t[r]=s):r==="style"?t[r]={...s,...o}:r==="className"&&(t[r]=[s,o].filter(Boolean).join(" "))}return{...n,...t}}function Vs(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Us=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mt=Us.reduce((n,e)=>{const t=cr(`Primitive.${e}`),r=g.forwardRef((s,o)=>{const{asChild:i,...c}=s,a=i?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),R.jsx(a,{...c,ref:o})});return r.displayName=`Primitive.${e}`,{...n,[e]:r}},{});function $s(n,e=[]){let t=[];function r(o,i){const c=g.createContext(i),a=t.length;t=[...t,i];const u=h=>{const{scope:f,children:m,...S}=h,v=f?.[n]?.[a]||c,p=g.useMemo(()=>S,Object.values(S));return R.jsx(v.Provider,{value:p,children:m})};u.displayName=o+"Provider";function l(h,f){const m=f?.[n]?.[a]||c,S=g.useContext(m);if(S)return S;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[u,l]}const s=()=>{const o=t.map(i=>g.createContext(i));return function(c){const a=c?.[n]||o;return g.useMemo(()=>({[`__scope${n}`]:{...c,[n]:a}}),[c,a])}};return s.scopeName=n,[r,Hs(s,...e)]}function Hs(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const r=n.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:a,scopeName:u})=>{const h=a(o)[`__scope${u}`];return{...c,...h}},{});return g.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return t.scopeName=e.scopeName,t}function Qe(n,e,{checkForDefaultPrevented:t=!0}={}){return function(s){if(n?.(s),t===!1||!s.defaultPrevented)return e?.(s)}}var dn=globalThis?.document?g.useLayoutEffect:()=>{};function Bs(n,e){return g.useReducer((t,r)=>e[t][r]??t,n)}var Nt=n=>{const{present:e,children:t}=n,r=Ys(e),s=typeof t=="function"?t({present:r.isPresent}):g.Children.only(t),o=et(r.ref,Xs(s));return typeof t=="function"||r.isPresent?g.cloneElement(s,{ref:o}):null};Nt.displayName="Presence";function Ys(n){const[e,t]=g.useState(),r=g.useRef(null),s=g.useRef(n),o=g.useRef("none"),i=n?"mounted":"unmounted",[c,a]=Bs(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=jt(r.current);o.current=c==="mounted"?u:"none"},[c]),dn(()=>{const u=r.current,l=s.current;if(l!==n){const f=o.current,m=jt(u);n?a("MOUNT"):m==="none"||u?.display==="none"?a("UNMOUNT"):a(l&&f!==m?"ANIMATION_OUT":"UNMOUNT"),s.current=n}},[n,a]),dn(()=>{if(e){let u;const l=e.ownerDocument.defaultView??window,h=m=>{const v=jt(r.current).includes(CSS.escape(m.animationName));if(m.target===e&&v&&(a("ANIMATION_END"),!s.current)){const p=e.style.animationFillMode;e.style.animationFillMode="forwards",u=l.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=p)})}},f=m=>{m.target===e&&(o.current=jt(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{l.clearTimeout(u),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:g.useCallback(u=>{r.current=u?getComputedStyle(u):null,t(u)},[])}}function jt(n){return n?.animationName||"none"}function Xs(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Ks=g.createContext(void 0);function qs(n){const e=g.useContext(Ks);return n||e||"ltr"}function Ze(n){const e=g.useRef(n);return g.useEffect(()=>{e.current=n}),g.useMemo(()=>(...t)=>e.current?.(...t),[])}function Gs(n,[e,t]){return Math.min(t,Math.max(e,n))}function Js(n,e){return g.useReducer((t,r)=>e[t][r]??t,n)}var pn="ScrollArea",[ar]=$s(pn),[Zs,Ee]=ar(pn),lr=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=n,[c,a]=g.useState(null),[u,l]=g.useState(null),[h,f]=g.useState(null),[m,S]=g.useState(null),[v,p]=g.useState(null),[w,b]=g.useState(0),[_,E]=g.useState(0),[P,T]=g.useState(!1),[C,F]=g.useState(!1),D=et(e,I=>a(I)),z=qs(s);return R.jsx(Zs,{scope:t,type:r,dir:z,scrollHideDelay:o,scrollArea:c,viewport:u,onViewportChange:l,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:S,scrollbarXEnabled:P,onScrollbarXEnabledChange:T,scrollbarY:v,onScrollbarYChange:p,scrollbarYEnabled:C,onScrollbarYEnabledChange:F,onCornerWidthChange:b,onCornerHeightChange:E,children:R.jsx(Mt.div,{dir:z,...i,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":_+"px",...n.style}})})});lr.displayName=pn;var ur="ScrollAreaViewport",fr=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:s,...o}=n,i=Ee(ur,t),c=g.useRef(null),a=et(e,c,i.onViewportChange);return R.jsxs(R.Fragment,{children:[R.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),R.jsx(Mt.div,{"data-radix-scroll-area-viewport":"",...o,ref:a,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...n.style},children:R.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});fr.displayName=ur;var Pe="ScrollAreaScrollbar",dr=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Ee(Pe,n.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,c=n.orientation==="horizontal";return g.useEffect(()=>(c?o(!0):i(!0),()=>{c?o(!1):i(!1)}),[c,o,i]),s.type==="hover"?R.jsx(Qs,{...r,ref:e,forceMount:t}):s.type==="scroll"?R.jsx(eo,{...r,ref:e,forceMount:t}):s.type==="auto"?R.jsx(hr,{...r,ref:e,forceMount:t}):s.type==="always"?R.jsx(gn,{...r,ref:e}):null});dr.displayName=Pe;var Qs=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Ee(Pe,n.__scopeScrollArea),[o,i]=g.useState(!1);return g.useEffect(()=>{const c=s.scrollArea;let a=0;if(c){const u=()=>{window.clearTimeout(a),i(!0)},l=()=>{a=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",l),()=>{window.clearTimeout(a),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",l)}}},[s.scrollArea,s.scrollHideDelay]),R.jsx(Nt,{present:t||o,children:R.jsx(hr,{"data-state":o?"visible":"hidden",...r,ref:e})})}),eo=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Ee(Pe,n.__scopeScrollArea),o=n.orientation==="horizontal",i=Qt(()=>a("SCROLL_END"),100),[c,a]=Js("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>a("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,s.scrollHideDelay,a]),g.useEffect(()=>{const u=s.viewport,l=o?"scrollLeft":"scrollTop";if(u){let h=u[l];const f=()=>{const m=u[l];h!==m&&(a("SCROLL"),i()),h=m};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,o,a,i]),R.jsx(Nt,{present:t||c!=="hidden",children:R.jsx(gn,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Qe(n.onPointerEnter,()=>a("POINTER_ENTER")),onPointerLeave:Qe(n.onPointerLeave,()=>a("POINTER_LEAVE"))})})}),hr=g.forwardRef((n,e)=>{const t=Ee(Pe,n.__scopeScrollArea),{forceMount:r,...s}=n,[o,i]=g.useState(!1),c=n.orientation==="horizontal",a=Qt(()=>{if(t.viewport){const u=t.viewport.offsetWidth<t.viewport.scrollWidth,l=t.viewport.offsetHeight<t.viewport.scrollHeight;i(c?u:l)}},10);return Ct(t.viewport,a),Ct(t.content,a),R.jsx(Nt,{present:r||o,children:R.jsx(gn,{"data-state":o?"visible":"hidden",...s,ref:e})})}),gn=g.forwardRef((n,e)=>{const{orientation:t="vertical",...r}=n,s=Ee(Pe,n.__scopeScrollArea),o=g.useRef(null),i=g.useRef(0),[c,a]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=br(c.viewport,c.content),l={...r,sizes:c,onSizesChange:a,hasThumb:u>0&&u<1,onThumbChange:f=>o.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function h(f,m){return io(f,i.current,c,m)}return t==="horizontal"?R.jsx(to,{...l,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollLeft,m=Un(f,c,s.dir);o.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=h(f,s.dir))}}):t==="vertical"?R.jsx(no,{...l,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollTop,m=Un(f,c);o.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=h(f))}}):null}),to=g.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=Ee(Pe,n.__scopeScrollArea),[i,c]=g.useState(),a=g.useRef(null),u=et(e,a,o.onScrollbarXChange);return g.useEffect(()=>{a.current&&c(getComputedStyle(a.current))},[a]),R.jsx(pr,{"data-orientation":"horizontal",...s,ref:u,sizes:t,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Zt(t)+"px",...n.style},onThumbPointerDown:l=>n.onThumbPointerDown(l.x),onDragScroll:l=>n.onDragScroll(l.x),onWheelScroll:(l,h)=>{if(o.viewport){const f=o.viewport.scrollLeft+l.deltaX;n.onWheelScroll(f),Sr(f,h)&&l.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:a.current.clientWidth,paddingStart:qt(i.paddingLeft),paddingEnd:qt(i.paddingRight)}})}})}),no=g.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=Ee(Pe,n.__scopeScrollArea),[i,c]=g.useState(),a=g.useRef(null),u=et(e,a,o.onScrollbarYChange);return g.useEffect(()=>{a.current&&c(getComputedStyle(a.current))},[a]),R.jsx(pr,{"data-orientation":"vertical",...s,ref:u,sizes:t,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Zt(t)+"px",...n.style},onThumbPointerDown:l=>n.onThumbPointerDown(l.y),onDragScroll:l=>n.onDragScroll(l.y),onWheelScroll:(l,h)=>{if(o.viewport){const f=o.viewport.scrollTop+l.deltaY;n.onWheelScroll(f),Sr(f,h)&&l.preventDefault()}},onResize:()=>{a.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:a.current.clientHeight,paddingStart:qt(i.paddingTop),paddingEnd:qt(i.paddingBottom)}})}})}),[ro,mr]=ar(Pe),pr=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:a,onDragScroll:u,onWheelScroll:l,onResize:h,...f}=n,m=Ee(Pe,t),[S,v]=g.useState(null),p=et(e,D=>v(D)),w=g.useRef(null),b=g.useRef(""),_=m.viewport,E=r.content-r.viewport,P=Ze(l),T=Ze(a),C=Qt(h,10);function F(D){if(w.current){const z=D.clientX-w.current.left,I=D.clientY-w.current.top;u({x:z,y:I})}}return g.useEffect(()=>{const D=z=>{const I=z.target;S?.contains(I)&&P(z,E)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[_,S,E,P]),g.useEffect(T,[r,T]),Ct(S,C),Ct(m.content,C),R.jsx(ro,{scope:t,scrollbar:S,hasThumb:s,onThumbChange:Ze(o),onThumbPointerUp:Ze(i),onThumbPositionChange:T,onThumbPointerDown:Ze(c),children:R.jsx(Mt.div,{...f,ref:p,style:{position:"absolute",...f.style},onPointerDown:Qe(n.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),w.current=S.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),F(D))}),onPointerMove:Qe(n.onPointerMove,F),onPointerUp:Qe(n.onPointerUp,D=>{const z=D.target;z.hasPointerCapture(D.pointerId)&&z.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=b.current,m.viewport&&(m.viewport.style.scrollBehavior=""),w.current=null})})})}),Kt="ScrollAreaThumb",gr=g.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=mr(Kt,n.__scopeScrollArea);return R.jsx(Nt,{present:t||s.hasThumb,children:R.jsx(so,{ref:e,...r})})}),so=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...s}=n,o=Ee(Kt,t),i=mr(Kt,t),{onThumbPositionChange:c}=i,a=et(e,h=>i.onThumbChange(h)),u=g.useRef(void 0),l=Qt(()=>{u.current&&(u.current(),u.current=void 0)},100);return g.useEffect(()=>{const h=o.viewport;if(h){const f=()=>{if(l(),!u.current){const m=co(h,c);u.current=m,c()}};return c(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[o.viewport,l,c]),R.jsx(Mt.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:a,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Qe(n.onPointerDownCapture,h=>{const m=h.target.getBoundingClientRect(),S=h.clientX-m.left,v=h.clientY-m.top;i.onThumbPointerDown({x:S,y:v})}),onPointerUp:Qe(n.onPointerUp,i.onThumbPointerUp)})});gr.displayName=Kt;var vn="ScrollAreaCorner",vr=g.forwardRef((n,e)=>{const t=Ee(vn,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?R.jsx(oo,{...n,ref:e}):null});vr.displayName=vn;var oo=g.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,s=Ee(vn,t),[o,i]=g.useState(0),[c,a]=g.useState(0),u=!!(o&&c);return Ct(s.scrollbarX,()=>{const l=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(l),a(l)}),Ct(s.scrollbarY,()=>{const l=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(l),i(l)}),u?R.jsx(Mt.div,{...r,ref:e,style:{width:o,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function qt(n){return n?parseInt(n,10):0}function br(n,e){const t=n/e;return isNaN(t)?0:t}function Zt(n){const e=br(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function io(n,e,t,r="ltr"){const s=Zt(t),o=s/2,i=e||o,c=s-i,a=t.scrollbar.paddingStart+i,u=t.scrollbar.size-t.scrollbar.paddingEnd-c,l=t.content-t.viewport,h=r==="ltr"?[0,l]:[l*-1,0];return _r([a,u],h)(n)}function Un(n,e,t="ltr"){const r=Zt(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-s,i=e.content-e.viewport,c=o-r,a=t==="ltr"?[0,i]:[i*-1,0],u=Gs(n,a);return _r([0,i],[0,c])(u)}function _r(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function Sr(n,e){return n>0&&n<e}var co=(n,e=()=>{})=>{let t={left:n.scrollLeft,top:n.scrollTop},r=0;return(function s(){const o={left:n.scrollLeft,top:n.scrollTop},i=t.left!==o.left,c=t.top!==o.top;(i||c)&&e(),t=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function Qt(n,e){const t=Ze(n),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function Ct(n,e){const t=Ze(e);dn(()=>{let r=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(t)});return s.observe(n),()=>{window.cancelAnimationFrame(r),s.unobserve(n)}}},[n,t])}var ao=lr,lo=fr,uo=vr;const cn=(n,e,t,r,s)=>({target:n,dx:e[0],dy:e[1],clientX:t[0],clientY:t[1],...r&&{edges:r},...s&&{deltaRect:s}}),fo=(n,e,t)=>n?n===e||n===t||(e?.contains(n)??!1)||(t?.contains(n)??!1):!1,ho=n=>{const e=Le.c(36),{children:t,style:r,draggable:s,resizable:o,draggableOptions:i,resizableOptions:c,ref:a}=n,u=N.useRef(void 0),l=N.useRef(void 0),h=N.useRef(null),f=N.useRef(null),m=N.useRef(void 0),S=N.useRef(void 0);let v;e[0]!==i||e[1]!==a||e[2]!==c?(v=()=>{if(u.current=i,l.current=c,!a?.current)return;const x=c?.edges?.left,W=c?.edges?.right;x&&x!==m.current&&(m.current=x,h.current=a.current.querySelector(x)),W&&W!==S.current&&(S.current=W,f.current=a.current.querySelector(W))},e[0]=i,e[1]=a,e[2]=c,e[3]=v):v=e[3];let p;e[4]!==i||e[5]!==c?(p=[i,c],e[4]=i,e[5]=c,e[6]=p):p=e[6],N.useEffect(v,p);let w;e[7]!==a?(w=x=>{const{active:W,delta:Z,xy:te,event:ne,first:d,last:y}=x,O=a?.current;if(!O||fo(ne?.target,h.current,f.current))return;const H=cn(O,Z,te);d?u.current?.onstart?.(H):y?u.current?.onend?.(H):W&&u.current?.onmove?.(H)},e[7]=a,e[8]=w):w=e[8];const b=i?.lockAxis==="x"?"x":void 0;let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_={capture:!0},e[9]=_):_=e[9];let E;e[10]!==s||e[11]!==a||e[12]!==b?(E={enabled:s,axis:b,pointer:_,target:a,threshold:0},e[10]=s,e[11]=a,e[12]=b,e[13]=E):E=e[13],on(w,E);let P;e[14]!==a?(P=x=>{const{active:W,delta:Z,xy:te,first:ne,last:d}=x,y=a?.current;if(!y)return;const O=cn(y,Z,te,{left:!0},{left:Z[0]});ne?l.current?.onstart?.(O):d?l.current?.onend?.(O):W&&l.current?.onmove?.(O)},e[14]=a,e[15]=P):P=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T={capture:!0},e[16]=T):T=e[16];let C;e[17]!==o?(C={enabled:o,target:h,pointer:T,threshold:0},e[17]=o,e[18]=C):C=e[18],on(P,C);let F;e[19]!==a?(F=x=>{const{active:W,delta:Z,xy:te,first:ne,last:d}=x,y=a?.current;if(!y)return;const O=cn(y,Z,te,{right:!0},{right:Z[0]});ne?l.current?.onstart?.(O):d?l.current?.onend?.(O):W&&l.current?.onmove?.(O)},e[19]=a,e[20]=F):F=e[20];let D;e[21]===Symbol.for("react.memo_cache_sentinel")?(D={capture:!0},e[21]=D):D=e[21];let z;e[22]!==o?(z={enabled:o,target:f,pointer:D,threshold:0},e[22]=o,e[23]=z):z=e[23],on(F,z);let I,$;e[24]!==a?(I=()=>{const x=a?.current;if(!x)return;const W=l.current?.edges?.left,Z=l.current?.edges?.right;W&&(h.current=x.querySelector(W)),Z&&(f.current=x.querySelector(Z))},$=[a],e[24]=a,e[25]=I,e[26]=$):(I=e[25],$=e[26]),N.useLayoutEffect(I,$);let M;e[27]!==s?(M=s?{touchAction:"none"}:{},e[27]=s,e[28]=M):M=e[28];let B;e[29]!==r||e[30]!==M?(B={...M,...r},e[29]=r,e[30]=M,e[31]=B):B=e[31];let A;return e[32]!==t||e[33]!==a||e[34]!==B?(A=R.jsx(ks,{ref:a,style:B,draggable:!1,children:t}),e[32]=t,e[33]=a,e[34]=B,e[35]=A):A=e[35],A},ve=(n,e=0)=>n?parseFloat(n):e,Ft=(n,e,t,r=Number.MAX_SAFE_INTEGER)=>{let s=n,o=r;for(const i of e){const c=Math.abs(i-n);c<t&&c<o&&(s=i,o=c)}return{adsorption:s,minDis:o}},wr=N.forwardRef((n,e)=>{const t=Le.c(68),{children:r,edges:s,left:o,width:i,start:c,grid:a,getBounds:u,enableResizing:l,enableDragging:h,adsorptionDistance:f,adsorptionPositions:m,onResizeStart:S,onResize:v,onResizeEnd:p,onDragStart:w,onDragEnd:b,onDrag:_,parentRef:E,autoScroll:P}=n,T=c===void 0?Gt:c,C=a===void 0?ln:a,F=u===void 0?mo:u,D=l===void 0?!0:l,z=h===void 0?!0:h,I=f===void 0?un:f;let $;t[0]!==m?($=m===void 0?[]:m,t[0]=m,t[1]=$):$=t[1];const M=$,B=P===void 0?!0:P,A=N.useRef(null),x=N.useRef(0),W=N.useRef(!1),{initAutoScroll:Z,stopAutoScroll:te,dealDragAutoScroll:ne,dealResizeAutoScroll:d}=Br(E);let y;t[2]===Symbol.for("react.memo_cache_sentinel")?(y=(V,J)=>{const K=J===void 0?!0:J;if(!A.current)return;K&&(x.current=0);const G=A.current;G.style.left=`${V}px`,G.dataset.left=String(V)},t[2]=y):y=t[2];const O=y;let H;t[3]===Symbol.for("react.memo_cache_sentinel")?(H=(V,J)=>{const K=J===void 0?!0:J;if(!A.current)return;K&&(x.current=0);const G=A.current;G.style.width=`${V}px`,G.dataset.width=String(V)},t[3]=H):H=t[3];const Q=H;let X;t[4]===Symbol.for("react.memo_cache_sentinel")?(X=()=>A.current?ve(A.current.dataset.left):0,t[4]=X):X=t[4];const Y=X;let L;t[5]===Symbol.for("react.memo_cache_sentinel")?(L=()=>A.current?ve(A.current.dataset.width):0,t[5]=L):L=t[5];const k=L;let U,tt;t[6]!==i?(U=()=>{if(!A.current)return;const V=A.current;Q(typeof i>"u"?V.offsetWidth:i,!1)},tt=[i],t[6]=i,t[7]=U,t[8]=tt):(U=t[7],tt=t[8]),N.useEffect(U,tt);let nt,je;t[9]!==o?(nt=()=>{O(o||0,!1)},je=[o],t[9]=o,t[10]=nt,t[11]=je):(nt=t[10],je=t[11]),N.useEffect(nt,je);let Oe;t[12]===Symbol.for("react.memo_cache_sentinel")?(Oe=()=>({updateLeft:V=>O(V||0,!1),updateWidth:V=>Q(V,!1),getLeft:Y,getWidth:k}),t[12]=Oe):Oe=t[12],N.useImperativeHandle(e,Oe);let xe;t[13]!==Z||t[14]!==w?(xe=()=>{x.current=0,W.current=!1,Z(),w?.()},t[13]=Z,t[14]=w,t[15]=xe):xe=t[15];const qe=xe;let Me;t[16]!==I||t[17]!==M||t[18]!==F||t[19]!==C||t[20]!==_||t[21]!==T?(Me=V=>{const{preLeft:J,preWidth:K,scrollDelta:G}=V;G&&(x.current=x.current+G);const me=W.current?I:C;if(Math.abs(x.current)<me)return;const Se=Math.trunc(x.current/me);let q=J+Se*me;const{adsorption:re}=Ft(q,M,I),{adsorption:j}=Ft(q+K,M,I),oe=Math.abs(re-q),ae=Math.abs(j-(q+K)),ue=oe<ae?re:j-K;if(ue!==q)W.current=!0,q=ue;else{const De=q-T;De%C!==0&&(q=T+C*Math.round(De/C)),W.current=!1}x.current=x.current%me;const ie=F();q<ie.left?q=ie.left:q+K>ie.right&&(q=ie.right-K),!(_&&_({lastLeft:J,left:q,lastWidth:K,width:K},G)===!1)&&O(q,!1)},t[16]=I,t[17]=M,t[18]=F,t[19]=C,t[20]=_,t[21]=T,t[22]=Me):Me=t[22];const Ce=Me;let Ne;t[23]!==B||t[24]!==ne||t[25]!==Ce||t[26]!==E?(Ne=V=>{const J=V.target,K=ve(J.dataset.left),G=ve(J.dataset.width);x.current=x.current+V.dx,!(B&&E?.current&&!ne(V,q=>{if(!E?.current||!A.current)return;E.current.scrollLeft=E.current.scrollLeft+q;const re=A.current,j=ve(re.dataset.left),oe=ve(re.dataset.width);Ce({preLeft:j,preWidth:oe,scrollDelta:q})}))&&Ce({preLeft:K,preWidth:G})},t[23]=B,t[24]=ne,t[25]=Ce,t[26]=E,t[27]=Ne):Ne=t[27];const At=Ne;let rt;t[28]!==b||t[29]!==te?(rt=V=>{x.current=0,W.current=!1,te();const J=V.target;b?.({left:ve(J.dataset.left),width:ve(J.dataset.width)})},t[28]=b,t[29]=te,t[30]=rt):rt=t[30];const Fe=rt;let _e;t[31]!==Z||t[32]!==S?(_e=V=>{x.current=0,W.current=!1,Z();const J=V.edges?.right?"right":"left";S?.(J)},t[31]=Z,t[32]=S,t[33]=_e):_e=t[33];const Ve=_e;let Ie;t[34]!==I||t[35]!==M||t[36]!==F||t[37]!==C||t[38]!==v||t[39]!==T?(Ie=V=>{const{dir:J,preWidth:K,preLeft:G,scrollDelta:me}=V;me&&(x.current=x.current+me);const Se=W.current?I:C;if(Math.abs(x.current)<Se)return;const q=F();if(J==="left"){const re=Math.trunc(x.current/Se);let j=G+re*Se;const{adsorption:oe}=Ft(j,M,I);if(oe!==j)W.current=!0,j=oe;else{const ie=j-T;ie%C!==0&&(j=T+C*Math.round(ie/C)),W.current=!1}x.current=x.current%Se,j<q.left&&(j=q.left);const ae=G+K,ue=ae-j;if(j>=ae||v&&v("left",{lastLeft:G,lastWidth:K,left:j,width:ue})===!1)return;O(j,!1),Q(ue,!1)}else{const re=Math.trunc(x.current/C);let j=K+re*C;const oe=G+j,{adsorption:ae}=Ft(oe,M,I);if(ae!==oe)W.current=!0,j=ae-G;else{let ue=G+j;const ie=ue-T;ie%C!==0&&(ue=T+C*Math.round(ie/C),j=ue-G),W.current=!1}if(x.current=x.current%Se,G+j>q.right&&(j=q.right-G),j<=0||v&&v("right",{lastLeft:G,lastWidth:K,left:G,width:j})===!1)return;Q(j,!1)}},t[34]=I,t[35]=M,t[36]=F,t[37]=C,t[38]=v,t[39]=T,t[40]=Ie):Ie=t[40];const Ue=Ie;let ke;t[41]!==B||t[42]!==d||t[43]!==E||t[44]!==Ue?(ke=V=>{const J=V.target,K=V.edges?.left?"left":"right",G=ve(J.dataset.left),me=ve(J.dataset.width);x.current=x.current+(K==="left"?V.deltaRect?.left||0:V.deltaRect?.right||0),!(B&&E?.current&&!d(V,K,re=>{if(!E?.current||!A.current)return;E.current.scrollLeft=E.current.scrollLeft+re;const j=A.current,oe=ve(j.dataset.left),ae=ve(j.dataset.width);Ue({preLeft:oe,preWidth:ae,dir:K,scrollDelta:re})}))&&Ue({preLeft:G,preWidth:me,dir:K})},t[41]=B,t[42]=d,t[43]=E,t[44]=Ue,t[45]=ke):ke=t[45];const Ae=ke;let We;t[46]!==p||t[47]!==te?(We=V=>{x.current=0,W.current=!1,te();const J=V.target,K=V.edges?.right?"right":"left";p?.(K,{left:ve(J.dataset.left),width:ve(J.dataset.width)})},t[46]=p,t[47]=te,t[48]=We):We=t[48];const Ge=We;let ye;t[49]!==o||t[50]!==i?(ye={left:o,width:i},t[49]=o,t[50]=i,t[51]=ye):ye=t[51];let Te;t[52]!==At||t[53]!==qe||t[54]!==Fe?(Te={lockAxis:"x",onmove:At,onstart:qe,onend:Fe,cursorChecker:po},t[52]=At,t[53]=qe,t[54]=Fe,t[55]=Te):Te=t[55];let Re;t[56]!==s||t[57]!==Ae||t[58]!==Ve||t[59]!==Ge?(Re={axis:"x",invert:"none",edges:s,onmove:Ae,onstart:Ve,onend:Ge},t[56]=s,t[57]=Ae,t[58]=Ve,t[59]=Ge,t[60]=Re):Re=t[60];let $e;return t[61]!==r||t[62]!==z||t[63]!==D||t[64]!==ye||t[65]!==Te||t[66]!==Re?($e=R.jsx(ho,{style:ye,ref:A,draggable:z,resizable:D,draggableOptions:Te,resizableOptions:Re,children:r}),t[61]=r,t[62]=z,t[63]=D,t[64]=ye,t[65]=Te,t[66]=Re,t[67]=$e):$e=t[67],$e});function mo(){return{left:Number.MIN_SAFE_INTEGER,right:Number.MAX_SAFE_INTEGER}}function po(){return""}function go(){let n=0,e,t="",r=arguments.length;for(;n<r;n++)(e=arguments[n])&&typeof e=="string"&&(t+=(t&&" ")+e);return t}const vo=n=>{const e=Le.c(191),{editorData:t,row:r,action:s,effects:o,rowHeight:i,scale:c,scaleWidth:a,scaleSplitCount:u,startLeft:l,gridSnap:h,disableDrag:f,scaleCount:m,maxScaleCount:S,setScaleCount:v,onActionMoveStart:p,onActionMoving:w,onActionMoveEnd:b,onActionResizeStart:_,onActionResizeEnd:E,onActionResizing:P,dragLineData:T,setEditorData:C,onClickAction:F,onClickActionOnly:D,onDoubleClickAction:z,onContextMenuAction:I,getActionRender:$,handleTime:M,scrollContainerRef:B}=n,A=N.useRef(null),x=N.useRef(!1),{id:W,maxEnd:Z,minStart:te,end:ne,start:d,selected:y,flexible:O,movable:H,effectId:Q}=s,X=O===void 0?!0:O,Y=H===void 0?!0:H,L=c??Bt,k=a??Yt,U=l??Gt,tt=u??qn,nt=S??Number.MAX_SAFE_INTEGER,je=te||0;let Oe;e[0]!==L||e[1]!==k||e[2]!==U||e[3]!==je?(Oe=ze(je,{startLeft:U,scale:L,scaleWidth:k}),e[0]=L,e[1]=k,e[2]=U,e[3]=je,e[4]=Oe):Oe=e[4];const xe=Oe,qe=Z||Number.MAX_VALUE;let Me;e[5]!==L||e[6]!==k||e[7]!==U||e[8]!==qe?(Me=ze(qe,{startLeft:U,scale:L,scaleWidth:k}),e[5]=L,e[6]=k,e[7]=U,e[8]=qe,e[9]=Me):Me=e[9];const Ce=Math.min(nt*k+U,Me);let Ne;e[10]!==ne||e[11]!==L||e[12]!==k||e[13]!==U||e[14]!==d?(Ne=hn({start:d,end:ne},{startLeft:U,scale:L,scaleWidth:k}),e[10]=ne,e[11]=L,e[12]=k,e[13]=U,e[14]=d,e[15]=Ne):Ne=e[15];const At=Ne,[rt,Fe]=N.useState(null),_e=rt??At,Ve=k/tt;let Ie;e[16]!==Q||e[17]!==o||e[18]!==X||e[19]!==Y||e[20]!==y?(Ie=de(go("action",Y&&"action-movable",y&&"action-selected",X&&"action-flexible",o[Q]&&`action-effect-${Q}`)),e[16]=Q,e[17]=o,e[18]=X,e[19]=Y,e[20]=y,e[21]=Ie):Ie=e[21];const Ue=Ie;let ke;e[22]!==k||e[23]!==U||e[24]!==m||e[25]!==v?(ke=(pe,ge)=>{const se=Wr(pe+ge,{startLeft:U,scaleCount:m,scaleWidth:k});se!==m&&v(se)},e[22]=k,e[23]=U,e[24]=m,e[25]=v,e[26]=ke):ke=e[26];const Ae=ke;let We;e[27]!==s||e[28]!==p||e[29]!==r?(We=()=>{p&&p({action:s,row:r})},e[27]=s,e[28]=p,e[29]=r,e[30]=We):We=e[30];const Ge=We;let ye;e[31]!==s||e[32]!==Ae||e[33]!==w||e[34]!==r||e[35]!==L||e[36]!==k||e[37]!==U?(ye=pe=>{const{left:ge,width:se}=pe;if(x.current=!0,w){const{start:fe,end:ce}=Lt({left:ge,width:se},{scaleWidth:k,scale:L,startLeft:U});if(w({action:s,row:r,start:fe,end:ce})===!1)return!1}Fe({left:ge,width:se}),Ae(ge,se)},e[31]=s,e[32]=Ae,e[33]=w,e[34]=r,e[35]=L,e[36]=k,e[37]=U,e[38]=ye):ye=e[38];const Te=ye;let Re;e[39]!==t||e[40]!==W||e[41]!==b||e[42]!==r||e[43]!==L||e[44]!==k||e[45]!==U||e[46]!==C?(Re=pe=>{const{left:ge,width:se}=pe,{start:fe,end:ce}=Lt({left:ge,width:se},{scaleWidth:k,scale:L,startLeft:U}),le=t.find(Xe=>Xe.id===r.id);if(!le)return;const Ye=le.actions.find(Xe=>Xe.id===W);Ye&&(Ye.start=fe,Ye.end=ce,C(t),b&&b({action:Ye,row:r,start:fe,end:ce}),Fe(null))},e[39]=t,e[40]=W,e[41]=b,e[42]=r,e[43]=L,e[44]=k,e[45]=U,e[46]=C,e[47]=Re):Re=e[47];const $e=Re;let V;e[48]!==s||e[49]!==_||e[50]!==r?(V=pe=>{_&&_({action:s,row:r,dir:pe})},e[48]=s,e[49]=_,e[50]=r,e[51]=V):V=e[51];const J=V;let K;e[52]!==s||e[53]!==Ae||e[54]!==P||e[55]!==r||e[56]!==L||e[57]!==k||e[58]!==U?(K=(pe,ge)=>{const{left:se,width:fe}=ge;if(x.current=!0,P){const{start:ce,end:le}=Lt({left:se,width:fe},{scaleWidth:k,scale:L,startLeft:U});if(P({action:s,row:r,start:ce,end:le,dir:pe})===!1)return!1}Fe({left:se,width:fe}),Ae(se,fe)},e[52]=s,e[53]=Ae,e[54]=P,e[55]=r,e[56]=L,e[57]=k,e[58]=U,e[59]=K):K=e[59];const G=K;let me;e[60]!==t||e[61]!==W||e[62]!==E||e[63]!==r||e[64]!==L||e[65]!==k||e[66]!==U||e[67]!==C?(me=(pe,ge)=>{const{left:se,width:fe}=ge,{start:ce,end:le}=Lt({left:se,width:fe},{scaleWidth:k,scale:L,startLeft:U}),Ye=t.find(en=>en.id===r.id);if(!Ye)return;const Xe=Ye.actions.find(en=>en.id===W);Xe&&(Xe.start=ce,Xe.end=le,C(t),E&&E({action:Xe,row:r,start:ce,end:le,dir:pe}),Fe(null))},e[60]=t,e[61]=W,e[62]=E,e[63]=r,e[64]=L,e[65]=k,e[66]=U,e[67]=C,e[68]=me):me=e[68];const Se=me;let q,re,j,oe,ae,ue,ie,De,st,ot,it,ct,at,lt,ut,ft,He,Be,dt,ht,mt,pt,gt,vt,bt,_t;if(e[69]!==s||e[70]!==Ue||e[71]!==f||e[72]!==T.assistPositions||e[73]!==X||e[74]!==$||e[75]!==Ve||e[76]!==h||e[77]!==Te||e[78]!==$e||e[79]!==Ge||e[80]!==Se||e[81]!==J||e[82]!==G||e[83]!==M||e[84]!==xe||e[85]!==Y||e[86]!==F||e[87]!==D||e[88]!==I||e[89]!==z||e[90]!==Ce||e[91]!==r||e[92]!==i||e[93]!==L||e[94]!==k||e[95]!==U||e[96]!==B||e[97]!==_e.left||e[98]!==_e.width){const pe={...s,...Lt({left:_e.left,width:_e.width},{startLeft:U,scaleWidth:k,scale:L})},ge={...r,actions:[...r.actions]};r.actions.includes(s)&&(ge.actions[r.actions.indexOf(s)]=pe),q=wr,st=A,ot=B,it=U,ct=_e.left,at=_e.width,lt=h&&Ve||ln,ut=h?Math.max((Ve||ln)/2,un):un,ft=T.assistPositions,e[125]!==xe||e[126]!==Ce?(He=()=>({left:xe,right:Ce}),e[125]=xe,e[126]=Ce,e[127]=He):He=e[127];let se;e[128]!==f||e[129]!==X?(se=!f&&X&&`.${de("action-left-stretch")}`,e[128]=f,e[129]=X,e[130]=se):se=e[130];let fe;e[131]!==f||e[132]!==X?(fe=!f&&X&&`.${de("action-right-stretch")}`,e[131]=f,e[132]=X,e[133]=fe):fe=e[133],e[134]!==se||e[135]!==fe?(Be={left:se,right:fe},e[134]=se,e[135]=fe,e[136]=Be):Be=e[136],dt=!f&&Y,ht=!f&&X,mt=Ge,pt=Te,gt=$e,vt=J,bt=G,_t=Se,e[137]===Symbol.for("react.memo_cache_sentinel")?(re=()=>{x.current=!1},e[137]=re):re=e[137],e[138]!==s||e[139]!==M||e[140]!==F||e[141]!==D||e[142]!==r?(j=ce=>{let le;F&&(le=M(ce),F(ce,{row:r,action:s,time:le})),!x.current&&D&&(le===void 0&&(le=M(ce)),D(ce,{row:r,action:s,time:le}))},e[138]=s,e[139]=M,e[140]=F,e[141]=D,e[142]=r,e[143]=j):j=e[143],e[144]!==s||e[145]!==M||e[146]!==z||e[147]!==r?(oe=ce=>{if(z){const le=M(ce);z(ce,{row:r,action:s,time:le})}},e[144]=s,e[145]=M,e[146]=z,e[147]=r,e[148]=oe):oe=e[148],e[149]!==s||e[150]!==M||e[151]!==I||e[152]!==r?(ae=ce=>{if(I){const le=M(ce);I(ce,{row:r,action:s,time:le})}},e[149]=s,e[150]=M,e[151]=I,e[152]=r,e[153]=ae):ae=e[153],ue=Ue,e[154]!==i?(ie={height:i},e[154]=i,e[155]=ie):ie=e[155],De=$&&$(pe,ge),e[69]=s,e[70]=Ue,e[71]=f,e[72]=T.assistPositions,e[73]=X,e[74]=$,e[75]=Ve,e[76]=h,e[77]=Te,e[78]=$e,e[79]=Ge,e[80]=Se,e[81]=J,e[82]=G,e[83]=M,e[84]=xe,e[85]=Y,e[86]=F,e[87]=D,e[88]=I,e[89]=z,e[90]=Ce,e[91]=r,e[92]=i,e[93]=L,e[94]=k,e[95]=U,e[96]=B,e[97]=_e.left,e[98]=_e.width,e[99]=q,e[100]=re,e[101]=j,e[102]=oe,e[103]=ae,e[104]=ue,e[105]=ie,e[106]=De,e[107]=st,e[108]=ot,e[109]=it,e[110]=ct,e[111]=at,e[112]=lt,e[113]=ut,e[114]=ft,e[115]=He,e[116]=Be,e[117]=dt,e[118]=ht,e[119]=mt,e[120]=pt,e[121]=gt,e[122]=vt,e[123]=bt,e[124]=_t}else q=e[99],re=e[100],j=e[101],oe=e[102],ae=e[103],ue=e[104],ie=e[105],De=e[106],st=e[107],ot=e[108],it=e[109],ct=e[110],at=e[111],lt=e[112],ut=e[113],ft=e[114],He=e[115],Be=e[116],dt=e[117],ht=e[118],mt=e[119],pt=e[120],gt=e[121],vt=e[122],bt=e[123],_t=e[124];let St;e[156]!==X?(St=X&&R.jsx("div",{className:de("action-left-stretch"),style:{touchAction:"none"}}),e[156]=X,e[157]=St):St=e[157];let wt;e[158]!==X?(wt=X&&R.jsx("div",{className:de("action-right-stretch"),style:{touchAction:"none"}}),e[158]=X,e[159]=wt):wt=e[159];let Et;e[160]!==re||e[161]!==j||e[162]!==oe||e[163]!==ae||e[164]!==ue||e[165]!==ie||e[166]!==De||e[167]!==St||e[168]!==wt?(Et=R.jsxs("div",{onMouseDown:re,onClick:j,onDoubleClick:oe,onContextMenu:ae,className:ue,style:ie,children:[De,St,wt]}),e[160]=re,e[161]=j,e[162]=oe,e[163]=ae,e[164]=ue,e[165]=ie,e[166]=De,e[167]=St,e[168]=wt,e[169]=Et):Et=e[169];let It;return e[170]!==q||e[171]!==st||e[172]!==ot||e[173]!==it||e[174]!==ct||e[175]!==at||e[176]!==lt||e[177]!==ut||e[178]!==ft||e[179]!==He||e[180]!==Be||e[181]!==dt||e[182]!==ht||e[183]!==mt||e[184]!==pt||e[185]!==gt||e[186]!==vt||e[187]!==bt||e[188]!==_t||e[189]!==Et?(It=R.jsx(q,{ref:st,parentRef:ot,start:it,left:ct,width:at,grid:lt,adsorptionDistance:ut,adsorptionPositions:ft,getBounds:He,edges:Be,enableDragging:dt,enableResizing:ht,onDragStart:mt,onDrag:pt,onDragEnd:gt,onResizeStart:vt,onResize:bt,onResizeEnd:_t,children:Et}),e[170]=q,e[171]=st,e[172]=ot,e[173]=it,e[174]=ct,e[175]=at,e[176]=lt,e[177]=ut,e[178]=ft,e[179]=He,e[180]=Be,e[181]=dt,e[182]=ht,e[183]=mt,e[184]=pt,e[185]=gt,e[186]=vt,e[187]=bt,e[188]=_t,e[189]=Et,e[190]=It):It=e[190],It};function Rt(n,e,t){let r=t.initialDeps??[],s;function o(){var i,c,a,u;let l;t.key&&((i=t.debug)!=null&&i.call(t))&&(l=Date.now());const h=n();if(!(h.length!==r.length||h.some((S,v)=>r[v]!==S)))return s;r=h;let m;if(t.key&&((c=t.debug)!=null&&c.call(t))&&(m=Date.now()),s=e(...h),t.key&&((a=t.debug)!=null&&a.call(t))){const S=Math.round((Date.now()-l)*100)/100,v=Math.round((Date.now()-m)*100)/100,p=v/16,w=(b,_)=>{for(b=String(b);b.length<_;)b=" "+b;return b};console.info(`%c⏱ ${w(v,5)} /${w(S,5)} ms`,`
|
|
11
11
|
font-size: .6rem;
|
|
12
12
|
font-weight: bold;
|
|
13
|
-
color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,t?.key)}return(u=t?.onChange)==null||u.call(t,s),s}return o.updateDeps=i=>{r=i},o}function Vn(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const Xs=(n,e)=>Math.abs(n-e)<1.01,Gs=(n,e,t)=>{let r;return function(...s){n.clearTimeout(r),r=n.setTimeout(()=>e.apply(this,s),t)}},Un=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},Ks=n=>n,qs=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),r=[];for(let s=e;s<=t;s++)r.push(s);return r},Js=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;const s=i=>{const{width:c,height:l}=i;e({width:Math.round(c),height:Math.round(l)})};if(s(Un(t)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(i=>{const c=()=>{const l=i[0];if(l?.borderBoxSize){const u=l.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(Un(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},$n={passive:!0},Hn=typeof window>"u"?!0:"onscrollend"in window,Zs=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;let s=0;const o=n.options.useScrollendEvent&&Hn?()=>{}:Gs(r,()=>{e(s,!1)},n.options.isScrollingResetDelay),i=a=>()=>{const{horizontal:h,isRtl:f}=n.options;s=h?t.scrollLeft*(f&&-1||1):t.scrollTop,o(),e(s,a)},c=i(!0),l=i(!1);l(),t.addEventListener("scroll",c,$n);const u=n.options.useScrollendEvent&&Hn;return u&&t.addEventListener("scrollend",l,$n),()=>{t.removeEventListener("scroll",c),u&&t.removeEventListener("scrollend",l)}},Qs=(n,e,t)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},eo=(n,{adjustments:e=0,behavior:t},r)=>{var s,o;const i=n+e;(o=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[r.options.horizontal?"left":"top"]:i,behavior:t})};class to{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(o=>{const i=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var o;return(o=r())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=r())==null?void 0:o.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,s])=>{typeof s>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Ks,rangeExtractor:qs,onChange:()=>{},measureElement:Qs,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=Et(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{const s=new Map,o=new Map;for(let i=r-1;i>=0;i--){const c=t[i];if(s.has(c.lane))continue;const l=o.get(c.lane);if(l==null||c.end>l.end?o.set(c.lane,c):c.end<l.end&&s.set(c.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,c)=>i.end===c.end?i.index-c.index:i.end-c.end)[0]:void 0},this.getMeasurementOptions=Et(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,r,s,o,i)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i}),{key:!1}),this.getMeasurements=Et(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i},c)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(a=>{this.itemSizeCache.set(a.key,a.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,l);for(let a=l;a<t;a++){const h=o(a),f=this.options.lanes===1?u[a-1]:this.getFurthestMeasurement(u,a),m=f?f.end+this.options.gap:r+s,g=c.get(h),b=typeof g=="number"?g:this.options.estimateSize(a),v=m+b,w=f?f.lane:a%this.options.lanes;u[a]={index:a,start:m,size:b,end:v,key:h,lane:w}}return this.measurementsCache=u,u},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Et(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,o)=>this.range=t.length>0&&r>0?no({measurements:t,outerSize:r,scrollOffset:s,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Et(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,o,i)=>o===null||i===null?[]:t({startIndex:o,endIndex:i,overscan:r,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(t,r)=>{const s=this.indexFromElement(t),o=this.measurementsCache[s];if(!o)return;const i=o.key,c=this.elementsCache.get(i);c!==t&&(c&&this.observer.unobserve(c),this.observer.observe(t),this.elementsCache.set(i,t)),t.isConnected&&this.resizeItem(s,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{const s=this.measurementsCache[t];if(!s)return;const o=this.itemSizeCache.get(s.key)??s.size,i=r-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,i,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(t,void 0)},this.getVirtualItems=Et(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let o=0,i=t.length;o<i;o++){const c=t[o],l=r[c];s.push(l)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length!==0)return Vn(r[ar(0,r.length-1,s=>Vn(r[s]).start,t)])},this.getOffsetForAlignment=(t,r,s=0)=>{const o=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=t>=i+o?"end":"start"),r==="center"?t+=(s-o)/2:r==="end"&&(t-=o);const c=this.getTotalSize()+this.options.scrollMargin-o;return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.measurementsCache[t];if(!s)return;const o=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(s.end>=i+o-this.options.scrollPaddingEnd)r="end";else if(s.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];const c=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(t,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1));let o=0;const i=10,c=u=>{if(!this.targetWindow)return;const a=this.getOffsetForIndex(t,u);if(!a){console.warn("Failed to get offset for index:",t);return}const[h,f]=a;this._scrollToOffset(h,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const m=this.getScrollOffset(),g=this.getOffsetForIndex(t,f);if(!g){console.warn("Failed to get offset for index:",t);return}Xs(g[0],m)||l(f)})},l=u=>{this.targetWindow&&(o++,o<i?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",o,i),this.targetWindow.requestAnimationFrame(()=>c(u))):console.warn(`Failed to scroll to index ${t} after ${i} attempts.`))};c(r)},this.scrollBy=(t,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=r[r.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&o.some(c=>c===null);){const c=r[i];o[c.lane]===null&&(o[c.lane]=c.end),i--}s=Math.max(...o.filter(c=>c!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const ar=(n,e,t,r)=>{for(;n<=e;){const s=(n+e)/2|0,o=t(s);if(o<r)n=s+1;else if(o>r)e=s-1;else return s}return n>0?n-1:0};function no({measurements:n,outerSize:e,scrollOffset:t,lanes:r}){const s=n.length-1,o=l=>n[l].start;if(n.length<=r)return{startIndex:0,endIndex:s};let i=ar(0,s,o,t),c=i;if(r===1)for(;c<s&&n[c].end<t+e;)c++;else if(r>1){const l=Array(r).fill(0);for(;c<s&&l.some(a=>a<t+e);){const a=n[c];l[a.lane]=a.end,c++}const u=Array(r).fill(t+e);for(;i>=0&&u.some(a=>a>=t);){const a=n[i];u[a.lane]=a.start,i--}i=Math.max(0,i-i%r),c=Math.min(s,c+(r-1-c%r))}return{startIndex:i,endIndex:c}}const Bn=typeof document<"u"?p.useLayoutEffect:p.useEffect;function ro(n){const e=p.useReducer(()=>({}),{})[1],t={...n,onChange:(s,o)=>{var i;o?xr.flushSync(e):e(),(i=n.onChange)==null||i.call(n,s,o)}},[r]=p.useState(()=>new to(t));return r.setOptions(t),Bn(()=>r._didMount(),[]),Bn(()=>r._willUpdate()),r}function lr(n){return ro({observeElementRect:Js,observeElementOffset:Zs,scrollToFn:eo,...n})}const so=n=>{const{rowData:e,style:t={},onClickRow:r,onDoubleClickRow:s,onContextMenuRow:o,scrollContainerRef:i,startLeft:c,scale:l,scaleWidth:u}=n,a=["edit-row"];e?.selected&&a.push("edit-row-selected");const h=l??$t,f=u??Ht,m=c??Gt,g=_=>{if(!i.current)return 0;const y=_.currentTarget.getBoundingClientRect(),x=_.clientX-y.x;return tt(x,{startLeft:m,scale:h,scaleWidth:f})},b=T.useMemo(()=>(e?.actions?[...e.actions]:[]).sort((_,S)=>_.start-S.start),[e]),v=T.useCallback(_=>b[_]?.id??_,[b]),w=lr({horizontal:!0,count:b.length,getItemKey:v,getScrollElement:()=>i.current,estimateSize:_=>{if(!b[_])return 0;let S=_>0?b[_-1].end:0,y=b[_].end;if(S>y)return 0;let{width:P}=hn({start:S,end:y},{startLeft:m,scale:h,scaleWidth:f});return P},overscan:5});return T.useLayoutEffect(()=>{w.measure()},[u,c,w]),R.jsx("div",{className:`${de(...a)} ${(e?.classNames||[]).join(" ")}`,style:t,onClick:_=>{if(e&&r){const S=g(_);r(_,{row:e,time:S})}},onDoubleClick:_=>{if(e&&s){const S=g(_);s(_,{row:e,time:S})}},onContextMenu:_=>{if(e&&o){const S=g(_);o(_,{row:e,time:S})}},children:e&&w.getVirtualItems().map(_=>{const S=b[_.index];if(!S)throw new Error("Action not found");return R.jsx(Ys,{...n,handleTime:g,row:e,action:S},S.id)})})};function oo(){const n=ze.c(6);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e={isMoving:!1,movePositions:[],assistPositions:[]},n[0]=e):e=n[0];const[t,r]=T.useState(e),s=co,o=io;let i;n[1]===Symbol.for("react.memo_cache_sentinel")?(i=m=>{const{movePositions:g,assistPositions:b}=m;r({isMoving:!0,movePositions:g||[],assistPositions:b||[]})},n[1]=i):i=n[1];const c=i;let l;n[2]===Symbol.for("react.memo_cache_sentinel")?(l=m=>{const{movePositions:g,assistPositions:b}=m;r(v=>({...v,movePositions:g||v.movePositions,assistPositions:b||v.assistPositions}))},n[2]=l):l=n[2];const u=l;let a;n[3]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{r({isMoving:!1,movePositions:[],assistPositions:[]})},n[3]=a):a=n[3];const h=a;let f;return n[4]!==t?(f={initDragLine:c,updateDragLine:u,disposeDragLine:h,dragLineData:t,defaultGetAssistPosition:s,defaultGetMovePosition:o},n[4]=t,n[5]=f):f=n[5],f}function io(n){const{start:e,end:t,dir:r,scale:s,scaleWidth:o,startLeft:i}=n,{left:c,width:l}=hn({start:e,end:t},{startLeft:i,scaleWidth:o,scale:s});return r?r==="right"?[c+l]:[c]:[c,c+l]}function co(n){const{editorData:e,assistActionIds:t,action:r,row:s,scale:o,scaleWidth:i,startLeft:c,cursorLeft:l,hideCursor:u}=n,a=[];t?e.forEach(f=>{f.actions.forEach(m=>{t.includes(m.id)&&a.push(m)})}):e.forEach(f=>{f.id!==s.id?a.push(...f.actions):f.actions.forEach(m=>{m.id!==r.id&&a.push(m)})});const h=jr(a,{startLeft:c,scale:o,scaleWidth:i});return u||h.push(l),h}const ao=n=>{const e=ze.c(35);let t,r;e[0]!==n?({ref:r,...t}=n,e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const{dragLineData:s,initDragLine:o,updateDragLine:i,disposeDragLine:c,defaultGetAssistPosition:l,defaultGetMovePosition:u}=oo();let a;e[3]!==l||e[4]!==o||e[5]!==t?(a=O=>{if(t.dragLine){const L=t.getAssistDragLineActionIds&&t.getAssistDragLineActionIds({action:O.action,row:O.row,editorData:t.editorData}),W=t.scaleWidth??160,V=t.scale??1,q=t.startLeft??20,M=t.hideCursor??!1,k=je(t.cursorTime,{scaleWidth:W,scale:V,startLeft:q}),K=l({editorData:t.editorData,assistActionIds:L,action:O.action,row:O.row,scale:V,scaleWidth:W,startLeft:q,hideCursor:M,cursorLeft:k});o({assistPositions:K})}},e[3]=l,e[4]=o,e[5]=t,e[6]=a):a=e[6];const h=a;let f;e[7]!==u||e[8]!==t.dragLine||e[9]!==t.scale||e[10]!==t.scaleWidth||e[11]!==t.startLeft||e[12]!==i?(f=O=>{if(t.dragLine){const L=t.scaleWidth??160,W=t.scale??1,V=t.startLeft??20,q=u({...O,startLeft:V,scaleWidth:L,scale:W});i({movePositions:q})}},e[7]=u,e[8]=t.dragLine,e[9]=t.scale,e[10]=t.scaleWidth,e[11]=t.startLeft,e[12]=i,e[13]=f):f=e[13];const m=f,g=t.rowHeight??32,b=t.scaleWidth??160,v=t.startLeft??20,w=Math.max(t.scaleCount*b+v,t.timelineWidth);let _;if(e[14]!==w||e[15]!==g||e[16]!==c||e[17]!==s||e[18]!==h||e[19]!==m||e[20]!==t){const O=[];let L=0;for(let W=0;W<t.editorData.length;W++){const V=t.editorData[W];if(!V)continue;const q=V.rowHeight||g;O.push(T.createElement(so,{...t,key:V.id,rowData:V,dragLineData:s,scrollContainerRef:t.scrollElementRef,style:{position:"absolute",top:0,left:0,width:w,height:`${q}px`,transform:`translateY(${L}px)`},onActionMoveStart:M=>(h(M),t.onActionMoveStart&&t.onActionMoveStart(M)),onActionResizeStart:M=>(h(M),t.onActionResizeStart&&t.onActionResizeStart(M)),onActionMoving:M=>(m(M),t.onActionMoving&&t.onActionMoving(M)),onActionResizing:M=>(m(M),t.onActionResizing&&t.onActionResizing(M)),onActionResizeEnd:M=>(c(),t.onActionResizeEnd&&t.onActionResizeEnd(M)),onActionMoveEnd:M=>(c(),t.onActionMoveEnd&&t.onActionMoveEnd(M))})),L=L+q}_=[L,O],e[14]=w,e[15]=g,e[16]=c,e[17]=s,e[18]=h,e[19]=m,e[20]=t,e[21]=_}else _=e[21];const[S,y]=_,P=`0, ${t.startLeft??20}px`,x=`${t.startLeft??20}px, ${t.scaleWidth??160}px`;let C;e[22]!==w||e[23]!==P||e[24]!==x||e[25]!==S?(C={width:w,height:S,position:"relative",backgroundPositionX:P,backgroundSize:x},e[22]=w,e[23]=P,e[24]=x,e[25]=S,e[26]=C):C=e[26];let D;e[27]!==s||e[28]!==t.dragLine?(D=t.dragLine&&R.jsx($r,{...s}),e[27]=s,e[28]=t.dragLine,e[29]=D):D=e[29];let E;return e[30]!==r||e[31]!==y||e[32]!==C||e[33]!==D?(E=R.jsxs("div",{ref:r,style:C,className:"timeline-editor-edit-area",children:[y,D]}),e[30]=r,e[31]=y,e[32]=C,e[33]=D,e[34]=E):E=e[34],E};function lo({scaleSplitCount:n,scaleWidth:e,startLeft:t,scaleCount:r,maxScaleCount:s,scale:o,scrollElementRef:i,onClickTimeArea:c,setCursor:l}){const u=n??1,a=e??160,h=t??20,f=(n??0)>0,m=f?r*(n??1)+1:r,g=(f?a/u:a)*(m-1)+h,v=lr({horizontal:!0,count:m,getScrollElement:()=>i.current,estimateSize:w=>{switch(w){case 0:return h;default:return f?a/u:a}},overscan:10});return T.useEffect(()=>v.measure(),[e,t,v]),R.jsx("div",{style:{width:`${g}px`},className:de("time-area"),onClick:w=>{const _=t??20,S=e??160,y=o??1,P=s??1/0,x=w.currentTarget.getBoundingClientRect(),C=w.clientX-x.x,D=Math.max(C,_);if(D>P*S+_)return;const E=tt(D,{startLeft:_,scale:y,scaleWidth:S});c&&c(E,w),!w.defaultPrevented&&l({time:E})},children:v.getVirtualItems().map(w=>{const _=w.index,S=n??1,y=o??1,P=f?_%S===0:!0,x=[de("time-unit"),de(P?"time-unit-big":"time-unit-small")],C=(f?_/S:_)*y;return R.jsx("div",{"data-index":w.index,style:{width:`${w.size}px`,transform:`translateX(${w.start}px)`},className:x.join(" "),children:P&&R.jsx("div",{className:de("time-unit-scale"),children:C})},w.key)})})}function uo(n){return typeof n=="object"&&n!==null}function fo(n,e,t){if(n instanceof EventTarget)return[n];if(typeof n=="string"){const s=document.querySelectorAll(n);return s?Array.from(s):[]}return Array.from(n)}function ho(n){return uo(n)&&"ownerSVGElement"in n}const Ft=new WeakMap;let Vt;const ur=(n,e,t)=>(r,s)=>s&&s[0]?s[0][n+"Size"]:ho(r)&&"getBBox"in r?r.getBBox()[e]:r[t],mo=ur("inline","width","offsetWidth"),po=ur("block","height","offsetHeight");function go({target:n,borderBoxSize:e}){Ft.get(n)?.forEach(t=>{t(n,{get width(){return mo(n,e)},get height(){return po(n,e)}})})}function vo(n){n.forEach(go)}function bo(){typeof ResizeObserver>"u"||(Vt=new ResizeObserver(vo))}function _o(n,e){Vt||bo();const t=fo(n);return t.forEach(r=>{let s=Ft.get(r);s||(s=new Set,Ft.set(r,s)),s.add(e),Vt?.observe(r)}),()=>{t.forEach(r=>{const s=Ft.get(r);s?.delete(e),s?.size||Vt?.unobserve(r)})}}const Ut=new Set;let Rt;function wo(){Rt=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};Ut.forEach(e=>e(n))},window.addEventListener("resize",Rt)}function So(n){return Ut.add(n),Rt||wo(),()=>{Ut.delete(n),!Ut.size&&typeof Rt=="function"&&(window.removeEventListener("resize",Rt),Rt=void 0)}}function yo(n,e){return typeof n=="function"?So(n):_o(n,e)}function Eo(n){const e=({children:t,...r})=>{const s=n(r);return t(s)};return e.displayName=`withHooks(${n.name||"Hook"})`,e}function Ro(n){const e=ze.c(4),{elementRef:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={width:0,height:0},e[0]=r):r=e[0];const[s,o]=T.useState(r);let i,c;return e[1]!==t?(i=()=>{t.current&&yo(t.current,(l,u)=>{o({width:u.width,height:u.height})})},c=[t],e[1]=t,e[2]=i,e[3]=c):(i=e[2],c=e[3]),T.useLayoutEffect(i,c),s}const xo=Eo(Ro),Co=n=>{const e=ze.c(42),{disableDrag:t,cursorTime:r,setCursor:s,startLeft:o,scaleWidth:i,scale:c,scaleCount:l,scaleSplitCount:u,scrollElementRef:a,maxScaleCount:h,onCursorDragStart:f,onCursorDrag:m,onCursorDragEnd:g}=n,b=T.useRef(null),v=T.useRef(void 0);let w,_;e[0]!==r||e[1]!==c||e[2]!==i||e[3]!==o?(w=()=>{if(typeof v.current>"u"&&b.current){const d=o??20,A=i??160,U=c??1;b.current.updateLeft(je(r,{startLeft:d,scaleWidth:A,scale:U}))}},_=[r,o,i,c],e[0]=r,e[1]=c,e[2]=i,e[3]=o,e[4]=w,e[5]=_):(w=e[4],_=e[5]),T.useEffect(w,_);const S=o??20,y=i??160,P=c??1,x=h??1/0,C=(u??0)>0,D=u??1,E=C?l*(u??1)+1:l,O=o??20,L=(C?y/D:y)*(E-1)+O;let W;e[6]!==S||e[7]!==x||e[8]!==a||e[9]!==L||e[10]!==y?(W=()=>({left:0,right:Math.min(L,x*y+S-(a.current?.scrollLeft??0))}),e[6]=S,e[7]=x,e[8]=a,e[9]=L,e[10]=y,e[11]=W):W=e[11];const V=!t;let q;e[12]!==r||e[13]!==S||e[14]!==f||e[15]!==P||e[16]!==y?(q=()=>{f&&f(r),v.current=je(r,{startLeft:S,scaleWidth:y,scale:P}),b.current?.updateLeft(v.current)},e[12]=r,e[13]=S,e[14]=f,e[15]=P,e[16]=y,e[17]=q):q=e[17];let M;e[18]!==S||e[19]!==g||e[20]!==P||e[21]!==s||e[22]!==y?(M=()=>{if(typeof v.current<"u"){const d=tt(v.current,{startLeft:S,scale:P,scaleWidth:y});s({time:d}),g&&g(d)}v.current=void 0},e[18]=S,e[19]=g,e[20]=P,e[21]=s,e[22]=y,e[23]=M):M=e[23];let k;e[24]!==S||e[25]!==m||e[26]!==P||e[27]!==a||e[28]!==s||e[29]!==y?(k=(d,A)=>{const{left:U}=d,B=A===void 0?0:A,J=a.current?.scrollLeft??0,Y=a.current,$=Y?.clientWidth??0;if(B!==0)if(typeof v.current<"u"){v.current=v.current+B;const N=J,I=J+$;v.current<N+10?v.current=N+10:v.current>I-10&&(v.current=I-10),v.current<S-J&&(v.current=S-J)}else{v.current=U+B;const N=J,I=J+$;v.current<N+10?v.current=N+10:v.current>I-10&&(v.current=I-10)}else if(U<S-J?v.current=S-J:v.current=U,Y&&$>0){const N=J,I=J+$;v.current<N+10?v.current=N+10:v.current>I-10&&(v.current=I-10)}if(typeof v.current<"u"){b.current?.updateLeft(v.current);const N=tt(v.current+J,{startLeft:S,scale:P,scaleWidth:y});s({time:N}),m&&m(N)}return!1},e[24]=S,e[25]=m,e[26]=P,e[27]=a,e[28]=s,e[29]=y,e[30]=k):k=e[30];let K,ue;e[31]===Symbol.for("react.memo_cache_sentinel")?(K=de("cursor"),ue=de("cursor-top"),e[31]=K,e[32]=ue):(K=e[31],ue=e[32]);let fe;e[33]===Symbol.for("react.memo_cache_sentinel")?(fe=R.jsxs("div",{className:K,children:[R.jsx("svg",{className:ue,width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",children:R.jsx("path",{d:"M0 1C0 0.447715 0.447715 0 1 0H7C7.55228 0 8 0.447715 8 1V9.38197C8 9.76074 7.786 10.107 7.44721 10.2764L4.44721 11.7764C4.16569 11.9172 3.83431 11.9172 3.55279 11.7764L0.552786 10.2764C0.214002 10.107 0 9.76074 0 9.38197V1Z",fill:"currentColor"})}),R.jsx("div",{className:de("cursor-area")})]}),e[33]=fe):fe=e[33];let me;return e[34]!==S||e[35]!==a||e[36]!==W||e[37]!==V||e[38]!==q||e[39]!==M||e[40]!==k?(me=R.jsx(cr,{start:S,ref:b,parentRef:a,getBounds:W,autoScroll:!0,enableDragging:V,enableResizing:!1,onDragStart:q,onDragEnd:M,onDrag:k,children:fe}),e[34]=S,e[35]=a,e[36]=W,e[37]=V,e[38]=q,e[39]=M,e[40]=k,e[41]=me):me=e[41],me};function Yn(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function fr(...n){return e=>{let t=!1;const r=n.map(s=>{const o=Yn(s,e);return!t&&typeof o=="function"&&(t=!0),o});if(t)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Yn(n[s],null)}}}}function nt(...n){return p.useCallback(fr(...n),n)}function To(n){const e=Ao(n),t=p.forwardRef((r,s)=>{const{children:o,...i}=r,c=p.Children.toArray(o),l=c.find(Do);if(l){const u=l.props.children,a=c.map(h=>h===l?p.Children.count(u)>1?p.Children.only(null):p.isValidElement(u)?u.props.children:null:h);return R.jsx(e,{...i,ref:s,children:p.isValidElement(u)?p.cloneElement(u,void 0,a):null})}return R.jsx(e,{...i,ref:s,children:o})});return t.displayName=`${n}.Slot`,t}function Ao(n){const e=p.forwardRef((t,r)=>{const{children:s,...o}=t;if(p.isValidElement(s)){const i=Lo(s),c=Oo(o,s.props);return s.type!==p.Fragment&&(c.ref=r?fr(r,i):i),p.cloneElement(s,c)}return p.Children.count(s)>1?p.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var Po=Symbol("radix.slottable");function Do(n){return p.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Po}function Oo(n,e){const t={...e};for(const r in e){const s=n[r],o=e[r];/^on[A-Z]/.test(r)?s&&o?t[r]=(...c)=>{const l=o(...c);return s(...c),l}:s&&(t[r]=s):r==="style"?t[r]={...s,...o}:r==="className"&&(t[r]=[s,o].filter(Boolean).join(" "))}return{...n,...t}}function Lo(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Mo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ot=Mo.reduce((n,e)=>{const t=To(`Primitive.${e}`),r=p.forwardRef((s,o)=>{const{asChild:i,...c}=s,l=i?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),R.jsx(l,{...c,ref:o})});return r.displayName=`Primitive.${e}`,{...n,[e]:r}},{});function No(n,e=[]){let t=[];function r(o,i){const c=p.createContext(i),l=t.length;t=[...t,i];const u=h=>{const{scope:f,children:m,...g}=h,b=f?.[n]?.[l]||c,v=p.useMemo(()=>g,Object.values(g));return R.jsx(b.Provider,{value:v,children:m})};u.displayName=o+"Provider";function a(h,f){const m=f?.[n]?.[l]||c,g=p.useContext(m);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[u,a]}const s=()=>{const o=t.map(i=>p.createContext(i));return function(c){const l=c?.[n]||o;return p.useMemo(()=>({[`__scope${n}`]:{...c,[n]:l}}),[c,l])}};return s.scopeName=n,[r,Io(s,...e)]}function Io(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const r=n.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:l,scopeName:u})=>{const h=l(o)[`__scope${u}`];return{...c,...h}},{});return p.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return t.scopeName=e.scopeName,t}function et(n,e,{checkForDefaultPrevented:t=!0}={}){return function(s){if(n?.(s),t===!1||!s.defaultPrevented)return e?.(s)}}var dn=globalThis?.document?p.useLayoutEffect:()=>{};function ko(n,e){return p.useReducer((t,r)=>e[t][r]??t,n)}var Lt=n=>{const{present:e,children:t}=n,r=Wo(e),s=typeof t=="function"?t({present:r.isPresent}):p.Children.only(t),o=nt(r.ref,jo(s));return typeof t=="function"||r.isPresent?p.cloneElement(s,{ref:o}):null};Lt.displayName="Presence";function Wo(n){const[e,t]=p.useState(),r=p.useRef(null),s=p.useRef(n),o=p.useRef("none"),i=n?"mounted":"unmounted",[c,l]=ko(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const u=jt(r.current);o.current=c==="mounted"?u:"none"},[c]),dn(()=>{const u=r.current,a=s.current;if(a!==n){const f=o.current,m=jt(u);n?l("MOUNT"):m==="none"||u?.display==="none"?l("UNMOUNT"):l(a&&f!==m?"ANIMATION_OUT":"UNMOUNT"),s.current=n}},[n,l]),dn(()=>{if(e){let u;const a=e.ownerDocument.defaultView??window,h=m=>{const b=jt(r.current).includes(CSS.escape(m.animationName));if(m.target===e&&b&&(l("ANIMATION_END"),!s.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",u=a.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=m=>{m.target===e&&(o.current=jt(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{a.clearTimeout(u),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:p.useCallback(u=>{r.current=u?getComputedStyle(u):null,t(u)},[])}}function jt(n){return n?.animationName||"none"}function jo(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var zo=p.createContext(void 0);function Fo(n){const e=p.useContext(zo);return n||e||"ltr"}function Qe(n){const e=p.useRef(n);return p.useEffect(()=>{e.current=n}),p.useMemo(()=>(...t)=>e.current?.(...t),[])}function Vo(n,[e,t]){return Math.min(t,Math.max(e,n))}function Uo(n,e){return p.useReducer((t,r)=>e[t][r]??t,n)}var pn="ScrollArea",[dr]=No(pn),[$o,Se]=dr(pn),hr=p.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=n,[c,l]=p.useState(null),[u,a]=p.useState(null),[h,f]=p.useState(null),[m,g]=p.useState(null),[b,v]=p.useState(null),[w,_]=p.useState(0),[S,y]=p.useState(0),[P,x]=p.useState(!1),[C,D]=p.useState(!1),E=nt(e,L=>l(L)),O=Fo(s);return R.jsx($o,{scope:t,type:r,dir:O,scrollHideDelay:o,scrollArea:c,viewport:u,onViewportChange:a,content:h,onContentChange:f,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:P,onScrollbarXEnabledChange:x,scrollbarY:b,onScrollbarYChange:v,scrollbarYEnabled:C,onScrollbarYEnabledChange:D,onCornerWidthChange:_,onCornerHeightChange:y,children:R.jsx(Ot.div,{dir:O,...i,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":S+"px",...n.style}})})});hr.displayName=pn;var mr="ScrollAreaViewport",pr=p.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:s,...o}=n,i=Se(mr,t),c=p.useRef(null),l=nt(e,c,i.onViewportChange);return R.jsxs(R.Fragment,{children:[R.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),R.jsx(Ot.div,{"data-radix-scroll-area-viewport":"",...o,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...n.style},children:R.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});pr.displayName=mr;var Te="ScrollAreaScrollbar",gr=p.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Se(Te,n.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,c=n.orientation==="horizontal";return p.useEffect(()=>(c?o(!0):i(!0),()=>{c?o(!1):i(!1)}),[c,o,i]),s.type==="hover"?R.jsx(Ho,{...r,ref:e,forceMount:t}):s.type==="scroll"?R.jsx(Bo,{...r,ref:e,forceMount:t}):s.type==="auto"?R.jsx(vr,{...r,ref:e,forceMount:t}):s.type==="always"?R.jsx(gn,{...r,ref:e}):null});gr.displayName=Te;var Ho=p.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Se(Te,n.__scopeScrollArea),[o,i]=p.useState(!1);return p.useEffect(()=>{const c=s.scrollArea;let l=0;if(c){const u=()=>{window.clearTimeout(l),i(!0)},a=()=>{l=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",a),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",a)}}},[s.scrollArea,s.scrollHideDelay]),R.jsx(Lt,{present:t||o,children:R.jsx(vr,{"data-state":o?"visible":"hidden",...r,ref:e})})}),Bo=p.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=Se(Te,n.__scopeScrollArea),o=n.orientation==="horizontal",i=Jt(()=>l("SCROLL_END"),100),[c,l]=Uo("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>l("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,s.scrollHideDelay,l]),p.useEffect(()=>{const u=s.viewport,a=o?"scrollLeft":"scrollTop";if(u){let h=u[a];const f=()=>{const m=u[a];h!==m&&(l("SCROLL"),i()),h=m};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,o,l,i]),R.jsx(Lt,{present:t||c!=="hidden",children:R.jsx(gn,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:et(n.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:et(n.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),vr=p.forwardRef((n,e)=>{const t=Se(Te,n.__scopeScrollArea),{forceMount:r,...s}=n,[o,i]=p.useState(!1),c=n.orientation==="horizontal",l=Jt(()=>{if(t.viewport){const u=t.viewport.offsetWidth<t.viewport.scrollWidth,a=t.viewport.offsetHeight<t.viewport.scrollHeight;i(c?u:a)}},10);return xt(t.viewport,l),xt(t.content,l),R.jsx(Lt,{present:r||o,children:R.jsx(gn,{"data-state":o?"visible":"hidden",...s,ref:e})})}),gn=p.forwardRef((n,e)=>{const{orientation:t="vertical",...r}=n,s=Se(Te,n.__scopeScrollArea),o=p.useRef(null),i=p.useRef(0),[c,l]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=yr(c.viewport,c.content),a={...r,sizes:c,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:f=>o.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function h(f,m){return Jo(f,i.current,c,m)}return t==="horizontal"?R.jsx(Yo,{...a,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollLeft,m=Xn(f,c,s.dir);o.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=h(f,s.dir))}}):t==="vertical"?R.jsx(Xo,{...a,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollTop,m=Xn(f,c);o.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=h(f))}}):null}),Yo=p.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=Se(Te,n.__scopeScrollArea),[i,c]=p.useState(),l=p.useRef(null),u=nt(e,l,o.onScrollbarXChange);return p.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),R.jsx(_r,{"data-orientation":"horizontal",...s,ref:u,sizes:t,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qt(t)+"px",...n.style},onThumbPointerDown:a=>n.onThumbPointerDown(a.x),onDragScroll:a=>n.onDragScroll(a.x),onWheelScroll:(a,h)=>{if(o.viewport){const f=o.viewport.scrollLeft+a.deltaX;n.onWheelScroll(f),Rr(f,h)&&a.preventDefault()}},onResize:()=>{l.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Xt(i.paddingLeft),paddingEnd:Xt(i.paddingRight)}})}})}),Xo=p.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=Se(Te,n.__scopeScrollArea),[i,c]=p.useState(),l=p.useRef(null),u=nt(e,l,o.onScrollbarYChange);return p.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),R.jsx(_r,{"data-orientation":"vertical",...s,ref:u,sizes:t,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qt(t)+"px",...n.style},onThumbPointerDown:a=>n.onThumbPointerDown(a.y),onDragScroll:a=>n.onDragScroll(a.y),onWheelScroll:(a,h)=>{if(o.viewport){const f=o.viewport.scrollTop+a.deltaY;n.onWheelScroll(f),Rr(f,h)&&a.preventDefault()}},onResize:()=>{l.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Xt(i.paddingTop),paddingEnd:Xt(i.paddingBottom)}})}})}),[Go,br]=dr(Te),_r=p.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:a,onResize:h,...f}=n,m=Se(Te,t),[g,b]=p.useState(null),v=nt(e,E=>b(E)),w=p.useRef(null),_=p.useRef(""),S=m.viewport,y=r.content-r.viewport,P=Qe(a),x=Qe(l),C=Jt(h,10);function D(E){if(w.current){const O=E.clientX-w.current.left,L=E.clientY-w.current.top;u({x:O,y:L})}}return p.useEffect(()=>{const E=O=>{const L=O.target;g?.contains(L)&&P(O,y)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[S,g,y,P]),p.useEffect(x,[r,x]),xt(g,C),xt(m.content,C),R.jsx(Go,{scope:t,scrollbar:g,hasThumb:s,onThumbChange:Qe(o),onThumbPointerUp:Qe(i),onThumbPositionChange:x,onThumbPointerDown:Qe(c),children:R.jsx(Ot.div,{...f,ref:v,style:{position:"absolute",...f.style},onPointerDown:et(n.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),w.current=g.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),D(E))}),onPointerMove:et(n.onPointerMove,D),onPointerUp:et(n.onPointerUp,E=>{const O=E.target;O.hasPointerCapture(E.pointerId)&&O.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=_.current,m.viewport&&(m.viewport.style.scrollBehavior=""),w.current=null})})})}),Yt="ScrollAreaThumb",wr=p.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=br(Yt,n.__scopeScrollArea);return R.jsx(Lt,{present:t||s.hasThumb,children:R.jsx(Ko,{ref:e,...r})})}),Ko=p.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...s}=n,o=Se(Yt,t),i=br(Yt,t),{onThumbPositionChange:c}=i,l=nt(e,h=>i.onThumbChange(h)),u=p.useRef(void 0),a=Jt(()=>{u.current&&(u.current(),u.current=void 0)},100);return p.useEffect(()=>{const h=o.viewport;if(h){const f=()=>{if(a(),!u.current){const m=Zo(h,c);u.current=m,c()}};return c(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[o.viewport,a,c]),R.jsx(Ot.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:et(n.onPointerDownCapture,h=>{const m=h.target.getBoundingClientRect(),g=h.clientX-m.left,b=h.clientY-m.top;i.onThumbPointerDown({x:g,y:b})}),onPointerUp:et(n.onPointerUp,i.onThumbPointerUp)})});wr.displayName=Yt;var vn="ScrollAreaCorner",Sr=p.forwardRef((n,e)=>{const t=Se(vn,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?R.jsx(qo,{...n,ref:e}):null});Sr.displayName=vn;var qo=p.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,s=Se(vn,t),[o,i]=p.useState(0),[c,l]=p.useState(0),u=!!(o&&c);return xt(s.scrollbarX,()=>{const a=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(a),l(a)}),xt(s.scrollbarY,()=>{const a=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(a),i(a)}),u?R.jsx(Ot.div,{...r,ref:e,style:{width:o,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function Xt(n){return n?parseInt(n,10):0}function yr(n,e){const t=n/e;return isNaN(t)?0:t}function qt(n){const e=yr(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function Jo(n,e,t,r="ltr"){const s=qt(t),o=s/2,i=e||o,c=s-i,l=t.scrollbar.paddingStart+i,u=t.scrollbar.size-t.scrollbar.paddingEnd-c,a=t.content-t.viewport,h=r==="ltr"?[0,a]:[a*-1,0];return Er([l,u],h)(n)}function Xn(n,e,t="ltr"){const r=qt(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-s,i=e.content-e.viewport,c=o-r,l=t==="ltr"?[0,i]:[i*-1,0],u=Vo(n,l);return Er([0,i],[0,c])(u)}function Er(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function Rr(n,e){return n>0&&n<e}var Zo=(n,e=()=>{})=>{let t={left:n.scrollLeft,top:n.scrollTop},r=0;return(function s(){const o={left:n.scrollLeft,top:n.scrollTop},i=t.left!==o.left,c=t.top!==o.top;(i||c)&&e(),t=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function Jt(n,e){const t=Qe(n),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function xt(n,e){const t=Qe(e);dn(()=>{let r=0;if(n){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(t)});return s.observe(n),()=>{window.cancelAnimationFrame(r),s.unobserve(n)}}},[n,t])}var Qo=hr,ei=pr,ti=Sr;function Gn(n){const e=ze.c(9);let t,r,s;e[0]!==n?({className:t,orientation:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const o=s===void 0?"vertical":s;let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=R.jsx(wr,{"data-slot":"scroll-area-thumb"}),e[4]=i):i=e[4];let c;return e[5]!==t||e[6]!==o||e[7]!==r?(c=R.jsx(gr,{"data-slot":"scroll-area-scrollbar",orientation:o,className:t,...r,children:i}),e[5]=t,e[6]=o,e[7]=r,e[8]=c):c=e[8],c}const ni=T.forwardRef((n,e)=>{const t=Ir(n),{style:r}=n;let{editorData:s,hideCursor:o,disableDrag:i,scale:c=1,scaleWidth:l=160,startLeft:u=20,minScaleCount:a=20,maxScaleCount:h=1/0,onChange:f,onScroll:m}=t;const g=T.useRef(null),[b,v]=T.useState(s),[w,_]=T.useState(un),[S,y]=T.useState(Sn),P=T.useRef(Sn),x=T.useCallback(E=>{const O=Math.min(h,Math.max(a,E));_(O)},[h,a]);T.useLayoutEffect(()=>{x(kr(s,{scale:c})),v(s)},[s,a,h,c,x]);const C=E=>{f?.(E)},D=E=>{let{left:O,time:L}=E;return typeof L<"u"?(y(L),P.current=L,!0):typeof O<"u"?(y(P.current=tt(O,{startLeft:u,scale:c,scaleWidth:l})),!0):!1};return T.useImperativeHandle(e,()=>({get target(){return g.current},set time(E){D({time:E})},get time(){return P.current},setScrollLeft:E=>{g.current&&(g.current.scrollLeft=E)},setScrollTop:E=>{g.current&&(g.current.scrollTop=E)}})),R.jsxs(Qo,{style:r,className:`${cn} ${i?cn+"-disable":""}`,"data-slot":"scroll-area",children:[R.jsx(ei,{"data-slot":"scroll-area-viewport",ref:g,onScroll:E=>{m?.(E.currentTarget)},children:R.jsx(xo,{elementRef:g,children:({width:E,height:O})=>R.jsxs(R.Fragment,{children:[R.jsx(lo,{...t,setCursor:D,scaleCount:w,scrollElementRef:g}),R.jsx(ao,{...t,scrollElementRef:g,timelineWidth:E,timelineHeight:O,disableDrag:i,editorData:b,cursorTime:S,scaleCount:w,setScaleCount:x,setEditorData:C}),!o&&R.jsx(Co,{...t,timelineWidth:E,height:O,scaleCount:w,setScaleCount:x,setCursor:D,cursorTime:S,editorData:b,scrollElementRef:g})]})})}),R.jsx(Gn,{orientation:"horizontal"}),R.jsx(Gn,{orientation:"vertical"}),R.jsx(ti,{})]})});exports.Timeline=ni;
|
|
13
|
+
color: hsl(${Math.max(0,Math.min(120-120*p,120))}deg 100% 31%);`,t?.key)}return(u=t?.onChange)==null||u.call(t,s),s}return o.updateDeps=i=>{r=i},o}function $n(n,e){if(n===void 0)throw new Error("Unexpected undefined");return n}const bo=(n,e)=>Math.abs(n-e)<1.01,_o=(n,e,t)=>{let r;return function(...s){n.clearTimeout(r),r=n.setTimeout(()=>e.apply(this,s),t)}},Hn=n=>{const{offsetWidth:e,offsetHeight:t}=n;return{width:e,height:t}},So=n=>n,wo=n=>{const e=Math.max(n.startIndex-n.overscan,0),t=Math.min(n.endIndex+n.overscan,n.count-1),r=[];for(let s=e;s<=t;s++)r.push(s);return r},Eo=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;const s=i=>{const{width:c,height:a}=i;e({width:Math.round(c),height:Math.round(a)})};if(s(Hn(t)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(i=>{const c=()=>{const a=i[0];if(a?.borderBoxSize){const u=a.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(Hn(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},Bn={passive:!0},Yn=typeof window>"u"?!0:"onscrollend"in window,yo=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;let s=0;const o=n.options.useScrollendEvent&&Yn?()=>{}:_o(r,()=>{e(s,!1)},n.options.isScrollingResetDelay),i=l=>()=>{const{horizontal:h,isRtl:f}=n.options;s=h?t.scrollLeft*(f&&-1||1):t.scrollTop,o(),e(s,l)},c=i(!0),a=i(!1);a(),t.addEventListener("scroll",c,Bn);const u=n.options.useScrollendEvent&&Yn;return u&&t.addEventListener("scrollend",a,Bn),()=>{t.removeEventListener("scroll",c),u&&t.removeEventListener("scrollend",a)}},Ro=(n,e,t)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return n[t.options.horizontal?"offsetWidth":"offsetHeight"]},xo=(n,{adjustments:e=0,behavior:t},r)=>{var s,o;const i=n+e;(o=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[r.options.horizontal?"left":"top"]:i,behavior:t})};class Co{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(o=>{const i=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var o;return(o=r())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=r())==null?void 0:o.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,s])=>{typeof s>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:So,rangeExtractor:wo,onChange:()=>{},measureElement:Ro,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=Rt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{const s=new Map,o=new Map;for(let i=r-1;i>=0;i--){const c=t[i];if(s.has(c.lane))continue;const a=o.get(c.lane);if(a==null||c.end>a.end?o.set(c.lane,c):c.end<a.end&&s.set(c.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,c)=>i.end===c.end?i.index-c.index:i.end-c.end)[0]:void 0},this.getMeasurementOptions=Rt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,r,s,o,i)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i}),{key:!1}),this.getMeasurements=Rt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i},c)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(l=>{this.itemSizeCache.set(l.key,l.size)}));const a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,a);for(let l=a;l<t;l++){const h=o(l),f=this.options.lanes===1?u[l-1]:this.getFurthestMeasurement(u,l),m=f?f.end+this.options.gap:r+s,S=c.get(h),v=typeof S=="number"?S:this.options.estimateSize(l),p=m+v,w=f?f.lane:l%this.options.lanes;u[l]={index:l,start:m,size:v,end:p,key:h,lane:w}}return this.measurementsCache=u,u},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Rt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,o)=>this.range=t.length>0&&r>0?Ao({measurements:t,outerSize:r,scrollOffset:s,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Rt(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,o,i)=>o===null||i===null?[]:t({startIndex:o,endIndex:i,overscan:r,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(t,r)=>{const s=this.indexFromElement(t),o=this.measurementsCache[s];if(!o)return;const i=o.key,c=this.elementsCache.get(i);c!==t&&(c&&this.observer.unobserve(c),this.observer.observe(t),this.elementsCache.set(i,t)),t.isConnected&&this.resizeItem(s,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{const s=this.measurementsCache[t];if(!s)return;const o=this.itemSizeCache.get(s.key)??s.size,i=r-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,i,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(t,void 0)},this.getVirtualItems=Rt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let o=0,i=t.length;o<i;o++){const c=t[o],a=r[c];s.push(a)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length!==0)return $n(r[Er(0,r.length-1,s=>$n(r[s]).start,t)])},this.getOffsetForAlignment=(t,r,s=0)=>{const o=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=t>=i+o?"end":"start"),r==="center"?t+=(s-o)/2:r==="end"&&(t-=o);const c=this.getTotalSize()+this.options.scrollMargin-o;return Math.max(Math.min(c,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.measurementsCache[t];if(!s)return;const o=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(s.end>=i+o-this.options.scrollPaddingEnd)r="end";else if(s.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];const c=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(t,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1));let o=0;const i=10,c=u=>{if(!this.targetWindow)return;const l=this.getOffsetForIndex(t,u);if(!l){console.warn("Failed to get offset for index:",t);return}const[h,f]=l;this._scrollToOffset(h,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const m=this.getScrollOffset(),S=this.getOffsetForIndex(t,f);if(!S){console.warn("Failed to get offset for index:",t);return}bo(S[0],m)||a(f)})},a=u=>{this.targetWindow&&(o++,o<i?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",o,i),this.targetWindow.requestAnimationFrame(()=>c(u))):console.warn(`Failed to scroll to index ${t} after ${i} attempts.`))};c(r)},this.scrollBy=(t,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=r[r.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&o.some(c=>c===null);){const c=r[i];o[c.lane]===null&&(o[c.lane]=c.end),i--}s=Math.max(...o.filter(c=>c!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const Er=(n,e,t,r)=>{for(;n<=e;){const s=(n+e)/2|0,o=t(s);if(o<r)n=s+1;else if(o>r)e=s-1;else return s}return n>0?n-1:0};function Ao({measurements:n,outerSize:e,scrollOffset:t,lanes:r}){const s=n.length-1,o=a=>n[a].start;if(n.length<=r)return{startIndex:0,endIndex:s};let i=Er(0,s,o,t),c=i;if(r===1)for(;c<s&&n[c].end<t+e;)c++;else if(r>1){const a=Array(r).fill(0);for(;c<s&&a.some(l=>l<t+e);){const l=n[c];a[l.lane]=l.end,c++}const u=Array(r).fill(t+e);for(;i>=0&&u.some(l=>l>=t);){const l=n[i];u[l.lane]=l.start,i--}i=Math.max(0,i-i%r),c=Math.min(s,c+(r-1-c%r))}return{startIndex:i,endIndex:c}}const Xn=typeof document<"u"?g.useLayoutEffect:g.useEffect;function To(n){const e=g.useReducer(()=>({}),{})[1],t={...n,onChange:(s,o)=>{var i;o?xr.flushSync(e):e(),(i=n.onChange)==null||i.call(n,s,o)}},[r]=g.useState(()=>new Co(t));return r.setOptions(t),Xn(()=>r._didMount(),[]),Xn(()=>r._willUpdate()),r}function yr(n){return To({observeElementRect:Eo,observeElementOffset:yo,scrollToFn:xo,...n})}const Do=n=>{const{rowData:e,style:t={},onClickRow:r,onDoubleClickRow:s,onContextMenuRow:o,scrollContainerRef:i,startLeft:c,scale:a,scaleWidth:u}=n,l=["edit-row"];e?.selected&&l.push("edit-row-selected");const h=a??Bt,f=u??Yt,m=c??Gt,S=b=>{if(!i.current)return 0;const E=b.currentTarget.getBoundingClientRect(),T=b.clientX-E.x;return Ke(T,{startLeft:m,scale:h,scaleWidth:f})},v=N.useMemo(()=>(e?.actions?[...e.actions]:[]).sort((b,_)=>b.start-_.start),[e]),p=N.useCallback(b=>v[b]?.id??b,[v]),w=yr({horizontal:!0,count:v.length,getItemKey:p,getScrollElement:()=>i.current,estimateSize:b=>{if(!v[b])return 0;let _=b>0?v[b-1].end:0,E=v[b].end;if(_>E)return 0;let{width:P}=hn({start:_,end:E},{startLeft:m,scale:h,scaleWidth:f});return P},overscan:5});return N.useLayoutEffect(()=>{w.measure()},[u,c,w]),R.jsx("div",{className:`${de(...l)} ${(e?.classNames||[]).join(" ")}`,style:t,onClick:b=>{if(e&&r){const _=S(b);r(b,{row:e,time:_})}},onDoubleClick:b=>{if(e&&s){const _=S(b);s(b,{row:e,time:_})}},onContextMenu:b=>{if(e&&o){const _=S(b);o(b,{row:e,time:_})}},children:e&&w.getVirtualItems().map(b=>{const _=v[b.index];if(!_)throw new Error("Action not found");return R.jsx(vo,{...n,handleTime:S,row:e,action:_},_.id)})})};function Lo(){const n=Le.c(6);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e={isMoving:!1,movePositions:[],assistPositions:[]},n[0]=e):e=n[0];const[t,r]=N.useState(e),s=Oo,o=Po;let i;n[1]===Symbol.for("react.memo_cache_sentinel")?(i=m=>{const{movePositions:S,assistPositions:v}=m;r({isMoving:!0,movePositions:S||[],assistPositions:v||[]})},n[1]=i):i=n[1];const c=i;let a;n[2]===Symbol.for("react.memo_cache_sentinel")?(a=m=>{const{movePositions:S,assistPositions:v}=m;r(p=>({...p,movePositions:S||p.movePositions,assistPositions:v||p.assistPositions}))},n[2]=a):a=n[2];const u=a;let l;n[3]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{r({isMoving:!1,movePositions:[],assistPositions:[]})},n[3]=l):l=n[3];const h=l;let f;return n[4]!==t?(f={initDragLine:c,updateDragLine:u,disposeDragLine:h,dragLineData:t,defaultGetAssistPosition:s,defaultGetMovePosition:o},n[4]=t,n[5]=f):f=n[5],f}function Po(n){const{start:e,end:t,dir:r,scale:s,scaleWidth:o,startLeft:i}=n,{left:c,width:a}=hn({start:e,end:t},{startLeft:i,scaleWidth:o,scale:s});return r?r==="right"?[c+a]:[c]:[c,c+a]}function Oo(n){const{editorData:e,assistActionIds:t,action:r,row:s,scale:o,scaleWidth:i,startLeft:c,cursorLeft:a,hideCursor:u}=n,l=[];t?e.forEach(f=>{f.actions.forEach(m=>{t.includes(m.id)&&l.push(m)})}):e.forEach(f=>{f.id!==s.id?l.push(...f.actions):f.actions.forEach(m=>{m.id!==r.id&&l.push(m)})});const h=zr(l,{startLeft:c,scale:o,scaleWidth:i});return u||h.push(a),h}const Mo=n=>{const e=Le.c(35);let t,r;e[0]!==n?({ref:r,...t}=n,e[0]=n,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const{dragLineData:s,initDragLine:o,updateDragLine:i,disposeDragLine:c,defaultGetAssistPosition:a,defaultGetMovePosition:u}=Lo();let l;e[3]!==a||e[4]!==o||e[5]!==t?(l=z=>{if(t.dragLine){const I=t.getAssistDragLineActionIds&&t.getAssistDragLineActionIds({action:z.action,row:z.row,editorData:t.editorData}),$=t.scaleWidth??160,M=t.scale??1,B=t.startLeft??20,A=t.hideCursor??!1,x=ze(t.cursorTime,{scaleWidth:$,scale:M,startLeft:B}),W=a({editorData:t.editorData,assistActionIds:I,action:z.action,row:z.row,scale:M,scaleWidth:$,startLeft:B,hideCursor:A,cursorLeft:x});o({assistPositions:W})}},e[3]=a,e[4]=o,e[5]=t,e[6]=l):l=e[6];const h=l;let f;e[7]!==u||e[8]!==t.dragLine||e[9]!==t.scale||e[10]!==t.scaleWidth||e[11]!==t.startLeft||e[12]!==i?(f=z=>{if(t.dragLine){const I=t.scaleWidth??160,$=t.scale??1,M=t.startLeft??20,B=u({...z,startLeft:M,scaleWidth:I,scale:$});i({movePositions:B})}},e[7]=u,e[8]=t.dragLine,e[9]=t.scale,e[10]=t.scaleWidth,e[11]=t.startLeft,e[12]=i,e[13]=f):f=e[13];const m=f,S=t.rowHeight??32,v=t.scaleWidth??160,p=t.startLeft??20,w=Math.max(t.scaleCount*v+p,t.timelineWidth);let b;if(e[14]!==w||e[15]!==S||e[16]!==c||e[17]!==s||e[18]!==h||e[19]!==m||e[20]!==t){const z=[];let I=0;for(let $=0;$<t.editorData.length;$++){const M=t.editorData[$];if(!M)continue;const B=M.rowHeight||S;z.push(N.createElement(Do,{...t,key:M.id,rowData:M,dragLineData:s,scrollContainerRef:t.scrollElementRef,style:{position:"absolute",top:0,left:0,width:w,height:`${B}px`,transform:`translateY(${I}px)`},onActionMoveStart:A=>(h(A),t.onActionMoveStart&&t.onActionMoveStart(A)),onActionResizeStart:A=>(h(A),t.onActionResizeStart&&t.onActionResizeStart(A)),onActionMoving:A=>(m(A),t.onActionMoving&&t.onActionMoving(A)),onActionResizing:A=>(m(A),t.onActionResizing&&t.onActionResizing(A)),onActionResizeEnd:A=>(c(),t.onActionResizeEnd&&t.onActionResizeEnd(A)),onActionMoveEnd:A=>(c(),t.onActionMoveEnd&&t.onActionMoveEnd(A))})),I=I+B}b=[I,z],e[14]=w,e[15]=S,e[16]=c,e[17]=s,e[18]=h,e[19]=m,e[20]=t,e[21]=b}else b=e[21];const[_,E]=b,P=`0, ${t.startLeft??20}px`,T=`${t.startLeft??20}px, ${t.scaleWidth??160}px`;let C;e[22]!==w||e[23]!==P||e[24]!==T||e[25]!==_?(C={width:w,height:_,position:"relative",backgroundPositionX:P,backgroundSize:T},e[22]=w,e[23]=P,e[24]=T,e[25]=_,e[26]=C):C=e[26];let F;e[27]!==s||e[28]!==t.dragLine?(F=t.dragLine&&R.jsx($r,{...s}),e[27]=s,e[28]=t.dragLine,e[29]=F):F=e[29];let D;return e[30]!==r||e[31]!==E||e[32]!==C||e[33]!==F?(D=R.jsxs("div",{ref:r,style:C,className:"timeline-editor-edit-area",children:[E,F]}),e[30]=r,e[31]=E,e[32]=C,e[33]=F,e[34]=D):D=e[34],D};function No({scaleSplitCount:n,scaleWidth:e,startLeft:t,scaleCount:r,maxScaleCount:s,scale:o,scrollElementRef:i,onClickTimeArea:c,setCursor:a}){const u=n??1,l=e??160,h=t??20,f=(n??0)>0,m=f?r*(n??1)+1:r,S=(f?l/u:l)*(m-1)+h,p=yr({horizontal:!0,count:m,getScrollElement:()=>i.current,estimateSize:w=>{switch(w){case 0:return h;default:return f?l/u:l}},overscan:10});return N.useEffect(()=>p.measure(),[e,t,p]),R.jsx("div",{style:{width:`${S}px`},className:de("time-area"),onClick:w=>{const b=t??20,_=e??160,E=o??1,P=s??1/0,T=w.currentTarget.getBoundingClientRect(),C=w.clientX-T.x,F=Math.max(C,b);if(F>P*_+b)return;const D=Ke(F,{startLeft:b,scale:E,scaleWidth:_});c&&c(D,w),!w.defaultPrevented&&a({time:D})},children:p.getVirtualItems().map(w=>{const b=w.index,_=n??1,E=o??1,P=f?b%_===0:!0,T=[de("time-unit"),de(P?"time-unit-big":"time-unit-small")],C=(f?b/_:b)*E;return R.jsx("div",{"data-index":w.index,style:{width:`${w.size}px`,transform:`translateX(${w.start}px)`},className:T.join(" "),children:P&&R.jsx("div",{className:de("time-unit-scale"),children:C})},w.key)})})}function Io(n){return typeof n=="object"&&n!==null}function ko(n,e,t){if(n instanceof EventTarget)return[n];if(typeof n=="string"){const s=document.querySelectorAll(n);return s?Array.from(s):[]}return Array.from(n)}function Wo(n){return Io(n)&&"ownerSVGElement"in n}const Ut=new WeakMap;let $t;const Rr=(n,e,t)=>(r,s)=>s&&s[0]?s[0][n+"Size"]:Wo(r)&&"getBBox"in r?r.getBBox()[e]:r[t],zo=Rr("inline","width","offsetWidth"),jo=Rr("block","height","offsetHeight");function Fo({target:n,borderBoxSize:e}){Ut.get(n)?.forEach(t=>{t(n,{get width(){return zo(n,e)},get height(){return jo(n,e)}})})}function Vo(n){n.forEach(Fo)}function Uo(){typeof ResizeObserver>"u"||($t=new ResizeObserver(Vo))}function $o(n,e){$t||Uo();const t=ko(n);return t.forEach(r=>{let s=Ut.get(r);s||(s=new Set,Ut.set(r,s)),s.add(e),$t?.observe(r)}),()=>{t.forEach(r=>{const s=Ut.get(r);s?.delete(e),s?.size||$t?.unobserve(r)})}}const Ht=new Set;let xt;function Ho(){xt=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};Ht.forEach(e=>e(n))},window.addEventListener("resize",xt)}function Bo(n){return Ht.add(n),xt||Ho(),()=>{Ht.delete(n),!Ht.size&&typeof xt=="function"&&(window.removeEventListener("resize",xt),xt=void 0)}}function Yo(n,e){return typeof n=="function"?Bo(n):$o(n,e)}function Xo(n){const e=Le.c(4),{elementRef:t}=n;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={width:0,height:0},e[0]=r):r=e[0];const[s,o]=N.useState(r);let i,c;return e[1]!==t?(i=()=>{t.current&&Yo(t.current,(a,u)=>{o({width:u.width,height:u.height})})},c=[t],e[1]=t,e[2]=i,e[3]=c):(i=e[2],c=e[3]),N.useLayoutEffect(i,c),s}const Ko=n=>{const e=Le.c(42),{disableDrag:t,cursorTime:r,setCursor:s,startLeft:o,scaleWidth:i,scale:c,scaleCount:a,scaleSplitCount:u,scrollElementRef:l,maxScaleCount:h,onCursorDragStart:f,onCursorDrag:m,onCursorDragEnd:S}=n,v=N.useRef(null),p=N.useRef(void 0);let w,b;e[0]!==r||e[1]!==c||e[2]!==i||e[3]!==o?(w=()=>{if(typeof p.current>"u"&&v.current){const d=o??20,y=i??160,O=c??1;v.current.updateLeft(ze(r,{startLeft:d,scaleWidth:y,scale:O}))}},b=[r,o,i,c],e[0]=r,e[1]=c,e[2]=i,e[3]=o,e[4]=w,e[5]=b):(w=e[4],b=e[5]),N.useEffect(w,b);const _=o??20,E=i??160,P=c??1,T=h??1/0,C=(u??0)>0,F=u??1,D=C?a*(u??1)+1:a,z=o??20,I=(C?E/F:E)*(D-1)+z;let $;e[6]!==_||e[7]!==T||e[8]!==l||e[9]!==I||e[10]!==E?($=()=>({left:0,right:Math.min(I,T*E+_-(l.current?.scrollLeft??0))}),e[6]=_,e[7]=T,e[8]=l,e[9]=I,e[10]=E,e[11]=$):$=e[11];const M=!t;let B;e[12]!==r||e[13]!==_||e[14]!==f||e[15]!==P||e[16]!==E?(B=()=>{const d=v.current?.getLeft()??ze(r,{startLeft:_,scaleWidth:E,scale:P});p.current=d;const y=Ke(d,{startLeft:_,scale:P,scaleWidth:E});f&&f(y),v.current?.updateLeft(d)},e[12]=r,e[13]=_,e[14]=f,e[15]=P,e[16]=E,e[17]=B):B=e[17];let A;e[18]!==_||e[19]!==S||e[20]!==P||e[21]!==s||e[22]!==E?(A=()=>{if(typeof p.current<"u"){const d=Ke(p.current,{startLeft:_,scale:P,scaleWidth:E});s({time:d}),S&&S(d)}p.current=void 0},e[18]=_,e[19]=S,e[20]=P,e[21]=s,e[22]=E,e[23]=A):A=e[23];let x;e[24]!==_||e[25]!==m||e[26]!==P||e[27]!==l||e[28]!==s||e[29]!==E?(x=(d,y)=>{const{left:O}=d,H=y===void 0?0:y,Q=l.current?.scrollLeft??0,X=l.current,Y=X?.clientWidth??0;if(H!==0)if(typeof p.current<"u"){p.current=p.current+H;const L=Q,k=Q+Y;p.current<L+10?p.current=L+10:p.current>k-10&&(p.current=k-10),p.current<_-Q&&(p.current=_-Q)}else{p.current=O+H;const L=Q,k=Q+Y;p.current<L+10?p.current=L+10:p.current>k-10&&(p.current=k-10)}else if(O<_-Q?p.current=_-Q:p.current=O,X&&Y>0){const L=Q,k=Q+Y;p.current<L+10?p.current=L+10:p.current>k-10&&(p.current=k-10)}if(typeof p.current<"u"){v.current?.updateLeft(p.current);const L=Ke(p.current,{startLeft:_,scale:P,scaleWidth:E});s({time:L}),m&&m(L)}return!1},e[24]=_,e[25]=m,e[26]=P,e[27]=l,e[28]=s,e[29]=E,e[30]=x):x=e[30];let W,Z;e[31]===Symbol.for("react.memo_cache_sentinel")?(W=de("cursor"),Z=de("cursor-top"),e[31]=W,e[32]=Z):(W=e[31],Z=e[32]);let te;e[33]===Symbol.for("react.memo_cache_sentinel")?(te=R.jsxs("div",{className:W,children:[R.jsx("svg",{className:Z,width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",children:R.jsx("path",{d:"M0 1C0 0.447715 0.447715 0 1 0H7C7.55228 0 8 0.447715 8 1V9.38197C8 9.76074 7.786 10.107 7.44721 10.2764L4.44721 11.7764C4.16569 11.9172 3.83431 11.9172 3.55279 11.7764L0.552786 10.2764C0.214002 10.107 0 9.76074 0 9.38197V1Z",fill:"currentColor"})}),R.jsx("div",{className:de("cursor-area")})]}),e[33]=te):te=e[33];let ne;return e[34]!==_||e[35]!==l||e[36]!==$||e[37]!==M||e[38]!==B||e[39]!==A||e[40]!==x?(ne=R.jsx(wr,{start:_,ref:v,parentRef:l,getBounds:$,autoScroll:!0,enableDragging:M,enableResizing:!1,onDragStart:B,onDragEnd:A,onDrag:x,children:te}),e[34]=_,e[35]=l,e[36]=$,e[37]=M,e[38]=B,e[39]=A,e[40]=x,e[41]=ne):ne=e[41],ne};function Kn(n){const e=Le.c(9);let t,r,s;e[0]!==n?({className:t,orientation:s,...r}=n,e[0]=n,e[1]=t,e[2]=r,e[3]=s):(t=e[1],r=e[2],s=e[3]);const o=s===void 0?"vertical":s;let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=R.jsx(gr,{"data-slot":"scroll-area-thumb"}),e[4]=i):i=e[4];let c;return e[5]!==t||e[6]!==o||e[7]!==r?(c=R.jsx(dr,{"data-slot":"scroll-area-scrollbar",orientation:o,className:t,...r,children:i}),e[5]=t,e[6]=o,e[7]=r,e[8]=c):c=e[8],c}function qo({ref:n,...e}){const t=Ir(e),r=N.useRef(null),s=Math.min(t.maxScaleCount,Math.max(t.minScaleCount,kr(t.editorData,{scale:t.scale}))),[o,i]=N.useState(s),c=Math.max(s,o),[a,u]=N.useState(wn),l=N.useRef(wn),{width:h,height:f}=Xo({elementRef:r}),m=p=>{i(Math.min(t.maxScaleCount,Math.max(t.minScaleCount,p)))},S=p=>{t.onChange?.(p)},v=p=>{let{left:w,time:b}=p;return typeof b<"u"?(u(b),l.current=b,!0):typeof w<"u"?(u(l.current=Ke(w,{startLeft:t.startLeft,scale:t.scale,scaleWidth:t.scaleWidth})),!0):!1};return N.useImperativeHandle(n,()=>({get target(){return r.current},set time(p){v({time:p})},get time(){return l.current},setScrollLeft:p=>{r.current&&(r.current.scrollLeft=p)},setScrollTop:p=>{r.current&&(r.current.scrollTop=p)}})),R.jsxs(ao,{style:t.style,className:`${an} ${t.disableDrag?an+"-disable":""}`,"data-slot":"scroll-area",children:[R.jsxs(lo,{"data-slot":"scroll-area-viewport",ref:r,onScroll:p=>{t.onScroll?.(p.currentTarget)},children:[R.jsx(No,{...t,setCursor:v,scaleCount:c,scrollElementRef:r}),R.jsx(Mo,{...t,scrollElementRef:r,timelineWidth:h,timelineHeight:f,disableDrag:t.disableDrag,editorData:t.editorData,cursorTime:a,scaleCount:c,setScaleCount:m,setEditorData:S}),!t.hideCursor&&R.jsx(Ko,{...t,timelineWidth:h,height:f,scaleCount:c,setScaleCount:m,setCursor:v,cursorTime:a,editorData:t.editorData,scrollElementRef:r})]}),R.jsx(Kn,{orientation:"horizontal"}),R.jsx(Kn,{orientation:"vertical"}),R.jsx(uo,{})]})}exports.Timeline=qo;
|