@cyca/react-timeline-editor 0.2.4-alpha.6 → 0.2.5-alpha.2

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.
@@ -1,13 +1,1757 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),C=require("./index-6kJWhJ-8.cjs"),yr=require("react-dom");function Tr(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 v=Tr(O);var Vt={exports:{}},Mt={};var _n;function Rr(){if(_n)return Mt;_n=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 a in s)a!=="key"&&(o[a]=s[a])}else o=s;return s=o.ref,{$$typeof:n,type:r,key:i,ref:s!==void 0?s:null,props:o}}return Mt.Fragment=e,Mt.jsx=t,Mt.jsxs=t,Mt}var It={};var wn;function xr(){return wn||(wn=1,process.env.NODE_ENV!=="production"&&(function(){function n(d){if(d==null)return null;if(typeof d=="function")return d.$$typeof===W?null:d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case E:return"Fragment";case b:return"Profiler";case T:return"StrictMode";case _:return"Suspense";case D:return"SuspenseList";case w: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 y:return"Portal";case m:return d.displayName||"Context";case g:return(d._context.displayName||"Context")+".Consumer";case R:var P=d.render;return d=d.displayName,d||(d=P.displayName||P.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case L:return P=d.displayName||null,P!==null?P:n(d.type)||"Memo";case A:P=d._payload,d=d._init;try{return n(d(P))}catch{}}return null}function e(d){return""+d}function t(d){try{e(d);var P=!1}catch{P=!0}if(P){P=console;var k=P.error,X=typeof Symbol=="function"&&Symbol.toStringTag&&d[Symbol.toStringTag]||d.constructor.name||"Object";return k.call(P,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",X),e(d)}}function r(d){if(d===E)return"<>";if(typeof d=="object"&&d!==null&&d.$$typeof===A)return"<...>";try{var P=n(d);return P?"<"+P+">":"<...>"}catch{return"<...>"}}function s(){var d=V.A;return d===null?null:d.getOwner()}function o(){return Error("react-stack-top-frame")}function i(d){if(q.call(d,"key")){var P=Object.getOwnPropertyDescriptor(d,"key").get;if(P&&P.isReactWarning)return!1}return d.key!==void 0}function a(d,P){function k(){K||(K=!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)",P))}k.isReactWarning=!0,Object.defineProperty(d,"key",{get:k,configurable:!0})}function l(){var d=n(this.type);return ee[d]||(ee[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,P,k,X,me,ge){var Y=k.ref;return d={$$typeof:S,type:d,key:P,props:k,_owner:X},(Y!==void 0?Y:null)!==null?Object.defineProperty(d,"ref",{enumerable:!1,get:l}):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:me}),Object.defineProperty(d,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ge}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d}function c(d,P,k,X,me,ge){var Y=P.children;if(Y!==void 0)if(X)if(j(Y)){for(X=0;X<Y.length;X++)h(Y[X]);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(q.call(P,"key")){Y=n(d);var Q=Object.keys(P).filter(function(oe){return oe!=="key"});X=0<Q.length?"{key: someKey, "+Q.join(": ..., ")+": ...}":"{key: someKey}",M[Y+X]||(Q=0<Q.length?"{"+Q.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
- let props = %s;
3
- <%s {...props} />
4
- React keys must be passed directly to JSX without using spread:
5
- let props = %s;
6
- <%s key={someKey} {...props} />`,X,Y,Q,Y),M[Y+X]=!0)}if(Y=null,k!==void 0&&(t(k),Y=""+k),i(P)&&(t(P.key),Y=""+P.key),"key"in P){k={};for(var B in P)B!=="key"&&(k[B]=P[B])}else k=P;return Y&&a(k,typeof d=="function"?d.displayName||d.name||"Unknown":d),u(d,Y,k,s(),me,ge)}function h(d){f(d)?d._store&&(d._store.validated=1):typeof d=="object"&&d!==null&&d.$$typeof===A&&(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 p=O,S=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),m=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),W=Symbol.for("react.client.reference"),V=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,j=Array.isArray,se=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(d){return d()}};var K,ee={},te=p.react_stack_bottom_frame.bind(p,o)(),I=se(r(o)),M={};It.Fragment=E,It.jsx=function(d,P,k){var X=1e4>V.recentlyCreatedOwnerStacks++;return c(d,P,k,!1,X?Error("react-stack-top-frame"):te,X?se(r(d)):I)},It.jsxs=function(d,P,k){var X=1e4>V.recentlyCreatedOwnerStacks++;return c(d,P,k,!0,X?Error("react-stack-top-frame"):te,X?se(r(d)):I)}})()),It}var En;function Ar(){return En||(En=1,process.env.NODE_ENV==="production"?Vt.exports=Rr():Vt.exports=xr()),Vt.exports}var x=Ar();const an={trace:0,debug:1,info:2,warn:3,error:4,silent:5},Cr=["trace","debug","info","warn","error"];var Dr=class Gn{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(){Cr.forEach(e=>{const t=this.e.bind(this.c,e,this.n);Object.defineProperty(this,e,{get:()=>an[e]>=an[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 an?(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 Gn(this.s,this.e,e,this.r||this);this.ls.set(e,qn(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 qn(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 Pr=class{get(n){return localStorage.getItem(n)}set(n,e){localStorage.setItem(n,e)}del(n){localStorage.removeItem(n)}};const Lr={trace:"#95bdb7",debug:"#ad95b8",info:"#b6bd73",warn:"#88a1bb",error:"#bf6c69"},yn={info:"⚡️",success:"✔",warn:"▲",error:"✖",log:"●",trace:"◔",debug:"◌"},Or={bind(n,e,t){const r=t?`${yn[e]} ${String(t)}:`:`${yn[e]}`;return(n[e]||n.log).bind(n,`%c${r}%c`,`color: ${Lr[e]}; font-weight: bold;`,"color: inherit")}},tt=qn(new Dr(new Pr,Or));function Mr(n){let{editorData:e=[],effects:t={},scale:r=C.DEFAULT_SCALE,scaleSplitCount:s=C.DEFAULT_SCALE_SPLIT_COUNT,scaleWidth:o=C.DEFAULT_SCALE_WIDTH,startLeft:i=C.DEFAULT_START_LEFT,minScaleCount:a,maxScaleCount:l=1/0,rowHeight:u=C.DEFAULT_ROW_HEIGHT,autoScrollSpeed:c=1,autoScrollMaxSpeed:h=10}=n;r<=0&&(tt.error("Error: scale must be greater than 0!"),r=C.DEFAULT_SCALE),s<=0&&(tt.warn("Warning: scaleSplitCount cannot be less than 1!"),s=1),o<=0&&(tt.warn("Warning: scaleWidth must be greater than 0!"),o=C.DEFAULT_SCALE_WIDTH),i<0&&(tt.warn("Warning: startLeft cannot be less than 0!"),i=0),a&&typeof a=="number"&&(a<1&&(tt.warn("Warning: minScaleCount must be greater than 1!"),a=C.MIN_SCALE_COUNT),a=parseInt(a+""),l<a&&(tt.warn("Warning: maxScaleCount cannot be less than minScaleCount!"),l=a)),l=l===1/0?1/0:parseInt(l+""),u<=0&&(tt.warn("Warning: rowHeight must be greater than 0!"),u=C.DEFAULT_ROW_HEIGHT);const f={...n};return delete f.style,{...f,editorData:e,effects:t,scale:r,scaleSplitCount:s,scaleWidth:o,startLeft:i,minScaleCount:a,maxScaleCount:l,rowHeight:u,autoScrollSpeed:c,autoScrollMaxSpeed:h}}var $t={exports:{}},ln={};var Tn;function Ir(){if(Tn)return ln;Tn=1;var n=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;return ln.c=function(e){return n.H.useMemoCache(e)},ln}var cn={};var Rn;function Nr(){return Rn||(Rn=1,process.env.NODE_ENV!=="production"&&(function(){var n=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;cn.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
- 1. You might have mismatching versions of React and the renderer (such as React DOM)
8
- 2. You might be breaking the Rules of Hooks
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)}})()),cn}var xn;function kr(){return xn||(xn=1,process.env.NODE_ENV==="production"?$t.exports=Ir():$t.exports=Nr()),$t.exports}var De=kr();function Wr(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 ve(...n){return Wr(`${C.PREFIX}-`,...n)}const zr=n=>{const e=De.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 c=u;e[7]===Symbol.for("react.memo_cache_sentinel")?(o=ve("snap-line-container"),e[7]=o):o=e[7],i=t&&l.filter(h=>c.includes(h)).map(jr),e[0]=t,e[1]=r,e[2]=s,e[3]=o,e[4]=i}else o=e[3],i=e[4];let a;return e[8]!==o||e[9]!==i?(a=x.jsx("div",{className:o,children:i}),e[8]=o,e[9]=i,e[10]=a):a=e[10],a};function jr(n,e){return x.jsx("div",{className:ve("snap-line"),style:{left:n}},e)}const Fr=1,Ur=10,An=10;function Vr(n,e,t){const r=De.c(15),s=e===void 0?Fr:e,o=t===void 0?Ur:t,i=O.useRef(Number.MIN_SAFE_INTEGER),a=O.useRef(Number.MAX_SAFE_INTEGER),l=O.useRef(s),u=O.useRef(void 0);let c;r[0]!==n?(c=()=>{if(n?.current){const{left:g,width:m}=n.current.getBoundingClientRect();i.current=g,a.current=g+m}},r[0]=n,r[1]=c):c=r[1];const h=c;let f;r[2]!==o||r[3]!==s?(f=(g,m)=>{if(g.clientX>=a.current||g.clientX<=i.current){u.current!==void 0&&cancelAnimationFrame(u.current);const R=Math.abs(g.clientX>=a.current?g.clientX-a.current:g.clientX-i.current);l.current=Math.min(Number((R/An).toFixed(0))*s,o);const D=(g.clientX>=a.current?1:-1)*l.current,L=()=>{m&&m(D),u.current=requestAnimationFrame(L)};return u.current=requestAnimationFrame(L),!1}else u.current!==void 0&&cancelAnimationFrame(u.current);return!0},r[2]=o,r[3]=s,r[4]=f):f=r[4];const p=f;let S;r[5]!==o||r[6]!==s?(S=(g,m,R)=>{if(g.clientX>=a.current||g.clientX<i.current){u.current!==void 0&&cancelAnimationFrame(u.current);const _=Math.abs(g.clientX>=a.current?g.clientX-a.current:g.clientX-i.current);l.current=Math.min(Number((_/An).toFixed(0))*s,o);const L=(g.clientX>=a.current?1:-1)*l.current,A=()=>{R&&R(L),u.current=requestAnimationFrame(A)};return u.current=requestAnimationFrame(A),!1}else u.current!==void 0&&cancelAnimationFrame(u.current);return!0},r[5]=o,r[6]=s,r[7]=S):S=r[7];const y=S;let E;r[8]!==s?(E=()=>{i.current=Number.MIN_SAFE_INTEGER,a.current=Number.MAX_SAFE_INTEGER,l.current=s,u.current!==void 0&&cancelAnimationFrame(u.current)},r[8]=s,r[9]=E):E=r[9];const T=E;let b;return r[10]!==p||r[11]!==y||r[12]!==h||r[13]!==T?(b={initAutoScroll:h,dealDragAutoScroll:p,dealResizeAutoScroll:y,stopAutoScroll:T},r[10]=p,r[11]=y,r[12]=h,r[13]=T,r[14]=b):b=r[14],b}function $r(n,e,t){return Math.max(e,Math.min(n,t))}const be={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 Cn(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?$r(n,e,t):n<e?-Cn(e-n,t-e,r)+e:n>t?+Cn(n-t,t-e,r)+t:n}function Hr(n,[e,t],[r,s]){const[[o,i],[a,l]]=n;return[Dn(e,o,i,r),Dn(t,a,l,s)]}function Br(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 Xr(n){var e=Br(n,"string");return typeof e=="symbol"?e:String(e)}function Ee(n,e,t){return e=Xr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pn(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 re(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pn(Object(t),!0).forEach(function(r){Ee(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Pn(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}const Jn={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 Yr=["enter","leave"];function Kr(n=!1,e){return n&&!Yr.includes(e)}function Gr(n,e="",t=!1){const r=Jn[n],s=r&&r[e]||e;return"on"+Ln(n)+Ln(s)+(Kr(t,s)?"Capture":"")}const qr=["gotpointercapture","lostpointercapture"];function Jr(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 Zr(n,e=""){const t=Jn[n],r=t&&t[e]||e;return n+r}function Zt(n){return"touches"in n}function Zn(n){return Zt(n)?"touch":"pointerType"in n?n.pointerType:"mouse"}function Qr(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 es(n){return n.type==="touchend"||n.type==="touchcancel"?n.changedTouches:n.targetTouches}function Qn(n){return Zt(n)?es(n)[0]:n}function ts(n){return Qr(n).map(e=>e.identifier)}function un(n){const e=Qn(n);return Zt(n)?e.identifier:e.pointerId}function On(n){const e=Qn(n);return[e.clientX,e.clientY]}function ns(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 Gt(n,...e){return typeof n=="function"?n(...e):n}function rs(){}function ss(...n){return n.length===0?rs:n.length===1?n[0]:function(){let e;for(const t of n)e=t.apply(this,arguments)||e;return e}}function Mn(n,e){return Object.assign({},e,n||{})}const os=32;class is{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?Gt(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,ns(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._delta.map(Math.abs);be.addTo(t._distance,_)}this.axisIntent&&this.axisIntent(e);const[i,a]=t._movement,[l,u]=r.threshold,{_step:c,values:h}=t;if(r.hasCustomTransform?(c[0]===!1&&(c[0]=Math.abs(i)>=l&&h[0]),c[1]===!1&&(c[1]=Math.abs(a)>=u&&h[1])):(c[0]===!1&&(c[0]=Math.abs(i)>=l&&Math.sign(i)*l),c[1]===!1&&(c[1]=Math.abs(a)>=u&&Math.sign(a)*u)),t.intentional=c[0]!==!1||c[1]!==!1,!t.intentional)return;const f=[0,0];if(r.hasCustomTransform){const[_,D]=h;f[0]=c[0]!==!1?_-c[0]:0,f[1]=c[1]!==!1?D-c[1]:0}else f[0]=c[0]!==!1?i-c[0]:0,f[1]=c[1]!==!1?a-c[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(f);const p=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=Gt(r.bounds,t)),this.setup&&this.setup()),t.movement=f,this.computeOffset()));const[y,E]=t.offset,[[T,b],[g,m]]=t._bounds;t.overflow=[y<T?-1:y>b?1:0,E<g?-1:E>m?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 R=t._active?r.rubberband||[0,0]:[0,0];if(t.offset=Hr(t._bounds,t.offset,R),t.delta=be.sub(t.offset,p),this.computeMovement(),S&&(!t.last||o>os)){t.delta=be.sub(t.offset,p);const _=t.delta.map(Math.abs);be.addTo(t.distance,_),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&o>0&&(t.velocity=[_[0]/o,_[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(re(re(re({},t),e),{},{[this.aliasKey]:e.values}));s!==void 0&&(e.memo=s)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function as([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 ls extends is{constructor(...e){super(...e),Ee(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=be.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=be.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[Zn(e)]:r.axisThreshold;t.axis=as(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,Nn=.15,gn={enabled(n=!0){return n},eventOptions(n,e,t){return re(re({},t.shared.eventOptions),n)},preventDefault(n=!1){return n},triggerAllEvents(n=!1){return n},rubberband(n=0){switch(n){case!0:return[Nn,Nn];case!1:return[0,0];default:return be.toVector(n)}},from(n){if(typeof n=="function")return n;if(n!=null)return be.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 be.toVector(n,0)}};process.env.NODE_ENV==="development"&&Object.assign(gn,{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 cs=0,Nt=re(re({},gn),{},{axis(n,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(n=cs){return n},bounds(n={}){if(typeof n=="function")return o=>Nt.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]]}}),kn={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 us extends ls{constructor(...e){super(...e),Ee(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=Nt.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=un(e),r._pointerActive=!0,this.computeValues(On(e)),this.computeInitial(),t.preventScrollAxis&&Zn(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=un(e);if(t._pointerId!==void 0&&s!==t._pointerId)return;const o=On(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=be.sub(o,t._values),this.computeValues(o)),be.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=un(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[a,l]=t._delta,[u,c]=t._movement,[h,f]=r.swipe.velocity,[p,S]=r.swipe.distance,y=r.swipe.duration;if(t.elapsedTime<y){const E=Math.abs(a/t.timeDelta),T=Math.abs(l/t.timeDelta);E>h&&Math.abs(u)>p&&(t.swipe[0]=Math.sign(a)),T>f&&Math.abs(c)>S&&(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,fs(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=kn[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,be.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in kn&&(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 fs(n){"persist"in n&&typeof n.persist=="function"&&n.persist()}const kt=typeof window<"u"&&window.document&&window.document.createElement;function er(){return kt&&"ontouchstart"in window}function ds(){return er()||kt&&window.navigator.maxTouchPoints>1}function hs(){return kt&&"onpointerdown"in window}function ms(){return kt&&"exitPointerLock"in window.document}function ps(){try{return"constructor"in GestureEvent}catch{return!1}}const Re={isBrowser:kt,gesture:ps(),touch:er(),touchscreen:ds(),pointer:hs(),pointerLock:ms()},gs=250,vs=180,bs=.5,Ss=50,_s=250,ws=10,Wn={mouse:0,touch:0,pen:8},tr=re(re({},Nt),{},{device(n,e,{pointer:{touch:t=!1,lock:r=!1,mouse:s=!1}={}}){return this.pointerLock=r&&Re.pointerLock,Re.touch&&t?"touch":this.pointerLock?"mouse":Re.pointer&&!s?"pointer":Re.touch?"touch":"mouse"},preventScrollAxis(n,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&n?gs:void 0,!(!Re.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=be.toVector(n,t?r:s?1:0);return this.filterTaps=t,this.tapsThreshold=r,o},swipe({velocity:n=bs,distance:e=Ss,duration:t=_s}={}){return{velocity:this.transform(be.toVector(n)),distance:this.transform(be.toVector(e)),duration:t}},delay(n=0){switch(n){case!0:return vs;case!1:return 0;default:return n}},axisThreshold(n){return n?re(re({},Wn),n):Wn},keyboardDisplacement(n=ws){return n}});process.env.NODE_ENV==="development"&&Object.assign(tr,{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}});re(re({},gn),{},{device(n,e,{shared:t,pointer:{touch:r=!1}={}}){if(t.target&&!Re.touch&&Re.gesture)return"gesture";if(Re.touch&&r)return"touch";if(Re.touchscreen){if(Re.pointer)return"pointer";if(Re.touch)return"touch"}},bounds(n,e,{scaleBounds:t={},angleBounds:r={}}){const s=i=>{const a=Mn(Gt(t,i),{min:-1/0,max:1/0});return[a.min,a.max]},o=i=>{const a=Mn(Gt(r,i),{min:-1/0,max:1/0});return[a.min,a.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",be.toVector(n,this.lockDirection?[.1,3]:0)},modifierKey(n){return n===void 0?"ctrlKey":n},pinchOnWheel(n=!0){return n}});re(re({},Nt),{},{mouseOnly:(n=!0)=>n});re(re({},Nt),{},{mouseOnly:(n=!0)=>n});const nr=new Map,mn=new Map;function Es(n){nr.set(n.key,n.engine),mn.set(n.key,n.resolver)}const ys={key:"drag",engine:us,resolver:tr};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 Rs(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 xs={target(n){if(n)return()=>"current"in n?n.current:n},enabled(n=!0){return n},window(n=Re.isBrowser?window:void 0){return n},eventOptions({passive:n=!0,capture:e=!1}={}){return{passive:n,capture:e}},transform(n){return n}},As=["target","eventOptions","window","enabled","transform"];function Bt(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]=Bt(n[r],s);break;case"boolean":s&&(t[r]=n[r]);break}return t}function Cs(n,e,t={}){const r=n,{target:s,eventOptions:o,window:i,enabled:a,transform:l}=r,u=Rs(r,As);if(t.shared=Bt({target:s,eventOptions:o,window:i,enabled:a,transform:l},xs),e){const c=mn.get(e);t[e]=Bt(re({shared:t.shared},u),c)}else for(const c in u){const h=mn.get(c);if(h)t[c]=Bt(re({shared:t.shared},u[c]),h);else if(process.env.NODE_ENV==="development"&&!["drag","pinch","scroll","wheel","move","hover"].includes(c)){if(c==="domTarget")throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");console.warn(`[@use-gesture]: Unknown config key \`${c}\` was used. Please read the documentation for further information.`)}}return t}class rr{constructor(e,t){Ee(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,s,o){const i=this._listeners,a=Zr(t,r),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},u=re(re({},l),o);e.addEventListener(a,s,u);const c=()=>{e.removeEventListener(a,s,u),i.delete(c)};return i.add(c),c}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Ds{constructor(){Ee(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 Ps{constructor(e){Ee(this,"gestures",new Set),Ee(this,"_targetEventStore",new rr(this)),Ee(this,"gestureEventStores",{}),Ee(this,"gestureTimeoutStores",{}),Ee(this,"handlers",{}),Ee(this,"config",{}),Ee(this,"pointerIds",new Set),Ee(this,"touchIds",new Set),Ee(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Ls(this,e)}setEventIds(e){if(Zt(e))return this.touchIds=new Set(ts(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=Cs(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 a=this.config[i],l=zn(r,a.eventOptions,!!s);if(a.enabled){const u=nr.get(i);new u(this,e,i).bind(l)}}const o=zn(r,t.eventOptions,!!s);for(const i in this.nativeHandlers)o(i,"",a=>this.nativeHandlers[i](re(re({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const o in r)r[o]=ss(...r[o]);if(!s)return r;for(const o in r){const{device:i,capture:a,passive:l}=Jr(o);this._targetEventStore.add(s,i,"",r[o],{capture:a,passive:l})}}}}function Ct(n,e){n.gestures.add(e),n.gestureEventStores[e]=new rr(n,e),n.gestureTimeoutStores[e]=new Ds}function Ls(n,e){e.drag&&Ct(n,"drag"),e.wheel&&Ct(n,"wheel"),e.scroll&&Ct(n,"scroll"),e.move&&Ct(n,"move"),e.pinch&&Ct(n,"pinch"),e.hover&&Ct(n,"hover")}const zn=(n,e,t)=>(r,s,o,i={},a=!1)=>{var l,u;const c=(l=i.capture)!==null&&l!==void 0?l:e.capture,h=(u=i.passive)!==null&&u!==void 0?u:e.passive;let f=a?r:Gr(r,s,c);t&&h&&(f+="Passive"),n[f]=n[f]||[],n[f].push(o)};function Os(n,e={},t,r){const s=O.useMemo(()=>new Ps(n),[]);if(s.applyHandlers(n,r),s.applyConfig(e,t),O.useEffect(s.effect.bind(s)),O.useEffect(()=>s.clean.bind(s),[]),e.target===void 0)return s.bind.bind(s)}function fn(n,e){return Es(ys),Os({drag:n},e||{},"drag")}function jn(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function sr(...n){return e=>{let t=!1;const r=n.map(s=>{const o=jn(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():jn(n[s],null)}}}}function ot(...n){return v.useCallback(sr(...n),n)}function or(n){const e=Is(n),t=v.forwardRef((r,s)=>{const{children:o,...i}=r,a=v.Children.toArray(o),l=a.find(ks);if(l){const u=l.props.children,c=a.map(h=>h===l?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:h);return x.jsx(e,{...i,ref:s,children:v.isValidElement(u)?v.cloneElement(u,void 0,c):null})}return x.jsx(e,{...i,ref:s,children:o})});return t.displayName=`${n}.Slot`,t}var Ms=or("Slot");function Is(n){const e=v.forwardRef((t,r)=>{const{children:s,...o}=t;if(v.isValidElement(s)){const i=zs(s),a=Ws(o,s.props);return s.type!==v.Fragment&&(a.ref=r?sr(r,i):i),v.cloneElement(s,a)}return v.Children.count(s)>1?v.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var Ns=Symbol("radix.slottable");function ks(n){return v.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Ns}function Ws(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]=(...a)=>{const l=o(...a);return s(...a),l}:s&&(t[r]=s):r==="style"?t[r]={...s,...o}:r==="className"&&(t[r]=[s,o].filter(Boolean).join(" "))}return{...n,...t}}function zs(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 js=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wt=js.reduce((n,e)=>{const t=or(`Primitive.${e}`),r=v.forwardRef((s,o)=>{const{asChild:i,...a}=s,l=i?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...n,[e]:r}},{});function Fs(n,e=[]){let t=[];function r(o,i){const a=v.createContext(i),l=t.length;t=[...t,i];const u=h=>{const{scope:f,children:p,...S}=h,y=f?.[n]?.[l]||a,E=v.useMemo(()=>S,Object.values(S));return x.jsx(y.Provider,{value:E,children:p})};u.displayName=o+"Provider";function c(h,f){const p=f?.[n]?.[l]||a,S=v.useContext(p);if(S)return S;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[u,c]}const s=()=>{const o=t.map(i=>v.createContext(i));return function(a){const l=a?.[n]||o;return v.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return s.scopeName=n,[r,Us(s,...e)]}function Us(...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((a,{useScope:l,scopeName:u})=>{const h=l(o)[`__scope${u}`];return{...a,...h}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:i}),[i])}};return t.scopeName=e.scopeName,t}function st(n,e,{checkForDefaultPrevented:t=!0}={}){return function(s){if(n?.(s),t===!1||!s.defaultPrevented)return e?.(s)}}var pn=globalThis?.document?v.useLayoutEffect:()=>{};function Vs(n,e){return v.useReducer((t,r)=>e[t][r]??t,n)}var zt=n=>{const{present:e,children:t}=n,r=$s(e),s=typeof t=="function"?t({present:r.isPresent}):v.Children.only(t),o=ot(r.ref,Hs(s));return typeof t=="function"||r.isPresent?v.cloneElement(s,{ref:o}):null};zt.displayName="Presence";function $s(n){const[e,t]=v.useState(),r=v.useRef(null),s=v.useRef(n),o=v.useRef("none"),i=n?"mounted":"unmounted",[a,l]=Vs(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=Ht(r.current);o.current=a==="mounted"?u:"none"},[a]),pn(()=>{const u=r.current,c=s.current;if(c!==n){const f=o.current,p=Ht(u);n?l("MOUNT"):p==="none"||u?.display==="none"?l("UNMOUNT"):l(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=n}},[n,l]),pn(()=>{if(e){let u;const c=e.ownerDocument.defaultView??window,h=p=>{const y=Ht(r.current).includes(CSS.escape(p.animationName));if(p.target===e&&y&&(l("ANIMATION_END"),!s.current)){const E=e.style.animationFillMode;e.style.animationFillMode="forwards",u=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=E)})}},f=p=>{p.target===e&&(o.current=Ht(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{c.clearTimeout(u),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:v.useCallback(u=>{r.current=u?getComputedStyle(u):null,t(u)},[])}}function Ht(n){return n?.animationName||"none"}function Hs(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 Bs=v.createContext(void 0);function Xs(n){const e=v.useContext(Bs);return n||e||"ltr"}function rt(n){const e=v.useRef(n);return v.useEffect(()=>{e.current=n}),v.useMemo(()=>(...t)=>e.current?.(...t),[])}function Ys(n,[e,t]){return Math.min(t,Math.max(e,n))}function Ks(n,e){return v.useReducer((t,r)=>e[t][r]??t,n)}var vn="ScrollArea",[ir]=Fs(vn),[Gs,xe]=ir(vn),ar=v.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:s,scrollHideDelay:o=600,...i}=n,[a,l]=v.useState(null),[u,c]=v.useState(null),[h,f]=v.useState(null),[p,S]=v.useState(null),[y,E]=v.useState(null),[T,b]=v.useState(0),[g,m]=v.useState(0),[R,_]=v.useState(!1),[D,L]=v.useState(!1),A=ot(e,W=>l(W)),w=Xs(s);return x.jsx(Gs,{scope:t,type:r,dir:w,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:c,content:h,onContentChange:f,scrollbarX:p,onScrollbarXChange:S,scrollbarXEnabled:R,onScrollbarXEnabledChange:_,scrollbarY:y,onScrollbarYChange:E,scrollbarYEnabled:D,onScrollbarYEnabledChange:L,onCornerWidthChange:b,onCornerHeightChange:m,children:x.jsx(Wt.div,{dir:w,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":T+"px","--radix-scroll-area-corner-height":g+"px",...n.style}})})});ar.displayName=vn;var lr="ScrollAreaViewport",cr=v.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:s,...o}=n,i=xe(lr,t),a=v.useRef(null),l=ot(e,a,i.onViewportChange);return x.jsxs(x.Fragment,{children:[x.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}),x.jsx(Wt.div,{"data-radix-scroll-area-viewport":"",...o,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...n.style},children:x.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});cr.displayName=lr;var Me="ScrollAreaScrollbar",ur=v.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=xe(Me,n.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=n.orientation==="horizontal";return v.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?x.jsx(qs,{...r,ref:e,forceMount:t}):s.type==="scroll"?x.jsx(Js,{...r,ref:e,forceMount:t}):s.type==="auto"?x.jsx(fr,{...r,ref:e,forceMount:t}):s.type==="always"?x.jsx(bn,{...r,ref:e}):null});ur.displayName=Me;var qs=v.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=xe(Me,n.__scopeScrollArea),[o,i]=v.useState(!1);return v.useEffect(()=>{const a=s.scrollArea;let l=0;if(a){const u=()=>{window.clearTimeout(l),i(!0)},c=()=>{l=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",c),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",c)}}},[s.scrollArea,s.scrollHideDelay]),x.jsx(zt,{present:t||o,children:x.jsx(fr,{"data-state":o?"visible":"hidden",...r,ref:e})})}),Js=v.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=xe(Me,n.__scopeScrollArea),o=n.orientation==="horizontal",i=en(()=>l("SCROLL_END"),100),[a,l]=Ks("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 v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>l("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,l]),v.useEffect(()=>{const u=s.viewport,c=o?"scrollLeft":"scrollTop";if(u){let h=u[c];const f=()=>{const p=u[c];h!==p&&(l("SCROLL"),i()),h=p};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[s.viewport,o,l,i]),x.jsx(zt,{present:t||a!=="hidden",children:x.jsx(bn,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:st(n.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:st(n.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),fr=v.forwardRef((n,e)=>{const t=xe(Me,n.__scopeScrollArea),{forceMount:r,...s}=n,[o,i]=v.useState(!1),a=n.orientation==="horizontal",l=en(()=>{if(t.viewport){const u=t.viewport.offsetWidth<t.viewport.scrollWidth,c=t.viewport.offsetHeight<t.viewport.scrollHeight;i(a?u:c)}},10);return Lt(t.viewport,l),Lt(t.content,l),x.jsx(zt,{present:r||o,children:x.jsx(bn,{"data-state":o?"visible":"hidden",...s,ref:e})})}),bn=v.forwardRef((n,e)=>{const{orientation:t="vertical",...r}=n,s=xe(Me,n.__scopeScrollArea),o=v.useRef(null),i=v.useRef(0),[a,l]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=gr(a.viewport,a.content),c={...r,sizes:a,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:f=>o.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function h(f,p){return ro(f,i.current,a,p)}return t==="horizontal"?x.jsx(Zs,{...c,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollLeft,p=Fn(f,a,s.dir);o.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=h(f,s.dir))}}):t==="vertical"?x.jsx(Qs,{...c,ref:e,onThumbPositionChange:()=>{if(s.viewport&&o.current){const f=s.viewport.scrollTop,p=Fn(f,a);o.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=h(f))}}):null}),Zs=v.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=xe(Me,n.__scopeScrollArea),[i,a]=v.useState(),l=v.useRef(null),u=ot(e,l,o.onScrollbarXChange);return v.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),x.jsx(hr,{"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:c=>n.onThumbPointerDown(c.x),onDragScroll:c=>n.onDragScroll(c.x),onWheelScroll:(c,h)=>{if(o.viewport){const f=o.viewport.scrollLeft+c.deltaX;n.onWheelScroll(f),br(f,h)&&c.preventDefault()}},onResize:()=>{l.current&&o.viewport&&i&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Jt(i.paddingLeft),paddingEnd:Jt(i.paddingRight)}})}})}),Qs=v.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...s}=n,o=xe(Me,n.__scopeScrollArea),[i,a]=v.useState(),l=v.useRef(null),u=ot(e,l,o.onScrollbarYChange);return v.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),x.jsx(hr,{"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:c=>n.onThumbPointerDown(c.y),onDragScroll:c=>n.onDragScroll(c.y),onWheelScroll:(c,h)=>{if(o.viewport){const f=o.viewport.scrollTop+c.deltaY;n.onWheelScroll(f),br(f,h)&&c.preventDefault()}},onResize:()=>{l.current&&o.viewport&&i&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Jt(i.paddingTop),paddingEnd:Jt(i.paddingBottom)}})}})}),[eo,dr]=ir(Me),hr=v.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:c,onResize:h,...f}=n,p=xe(Me,t),[S,y]=v.useState(null),E=ot(e,A=>y(A)),T=v.useRef(null),b=v.useRef(""),g=p.viewport,m=r.content-r.viewport,R=rt(c),_=rt(l),D=en(h,10);function L(A){if(T.current){const w=A.clientX-T.current.left,W=A.clientY-T.current.top;u({x:w,y:W})}}return v.useEffect(()=>{const A=w=>{const W=w.target;S?.contains(W)&&R(w,m)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[g,S,m,R]),v.useEffect(_,[r,_]),Lt(S,D),Lt(p.content,D),x.jsx(eo,{scope:t,scrollbar:S,hasThumb:s,onThumbChange:rt(o),onThumbPointerUp:rt(i),onThumbPositionChange:_,onThumbPointerDown:rt(a),children:x.jsx(Wt.div,{...f,ref:E,style:{position:"absolute",...f.style},onPointerDown:st(n.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),T.current=S.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),L(A))}),onPointerMove:st(n.onPointerMove,L),onPointerUp:st(n.onPointerUp,A=>{const w=A.target;w.hasPointerCapture(A.pointerId)&&w.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),T.current=null})})})}),qt="ScrollAreaThumb",mr=v.forwardRef((n,e)=>{const{forceMount:t,...r}=n,s=dr(qt,n.__scopeScrollArea);return x.jsx(zt,{present:t||s.hasThumb,children:x.jsx(to,{ref:e,...r})})}),to=v.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...s}=n,o=xe(qt,t),i=dr(qt,t),{onThumbPositionChange:a}=i,l=ot(e,h=>i.onThumbChange(h)),u=v.useRef(void 0),c=en(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const h=o.viewport;if(h){const f=()=>{if(c(),!u.current){const p=so(h,a);u.current=p,a()}};return a(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[o.viewport,c,a]),x.jsx(Wt.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:st(n.onPointerDownCapture,h=>{const p=h.target.getBoundingClientRect(),S=h.clientX-p.left,y=h.clientY-p.top;i.onThumbPointerDown({x:S,y})}),onPointerUp:st(n.onPointerUp,i.onThumbPointerUp)})});mr.displayName=qt;var Sn="ScrollAreaCorner",pr=v.forwardRef((n,e)=>{const t=xe(Sn,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?x.jsx(no,{...n,ref:e}):null});pr.displayName=Sn;var no=v.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,s=xe(Sn,t),[o,i]=v.useState(0),[a,l]=v.useState(0),u=!!(o&&a);return Lt(s.scrollbarX,()=>{const c=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(c),l(c)}),Lt(s.scrollbarY,()=>{const c=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(c),i(c)}),u?x.jsx(Wt.div,{...r,ref:e,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function Jt(n){return n?parseInt(n,10):0}function gr(n,e){const t=n/e;return isNaN(t)?0:t}function Qt(n){const e=gr(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function ro(n,e,t,r="ltr"){const s=Qt(t),o=s/2,i=e||o,a=s-i,l=t.scrollbar.paddingStart+i,u=t.scrollbar.size-t.scrollbar.paddingEnd-a,c=t.content-t.viewport,h=r==="ltr"?[0,c]:[c*-1,0];return vr([l,u],h)(n)}function Fn(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,a=o-r,l=t==="ltr"?[0,i]:[i*-1,0],u=Ys(n,l);return vr([0,i],[0,a])(u)}function vr(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 br(n,e){return n>0&&n<e}var so=(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,a=t.top!==o.top;(i||a)&&e(),t=o,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function en(n,e){const t=rt(n),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function Lt(n,e){const t=rt(e);pn(()=>{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 oo=ar,io=cr,ao=pr;const dn=(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}}),lo=(n,e,t)=>n?n===e||n===t||(e?.contains(n)??!1)||(t?.contains(n)??!1):!1,co=n=>{const e=De.c(31),{children:t,style:r,draggable:s,resizable:o,draggableOptions:i,resizableOptions:a,ref:l}=n,u=O.useRef(void 0),c=O.useRef(void 0),h=O.useRef(null),f=O.useRef(null);let p,S;e[0]!==i||e[1]!==l||e[2]!==a?(p=()=>{if(u.current=i,c.current=a,!l?.current)return;const V=a?.edges?.left,q=a?.edges?.right,j=l.current;V&&(h.current=j.querySelector(V)),q&&(f.current=j.querySelector(q))},S=[i,l,a],e[0]=i,e[1]=l,e[2]=a,e[3]=p,e[4]=S):(p=e[3],S=e[4]),O.useLayoutEffect(p,S);let y;e[5]!==l?(y=V=>{const{active:q,delta:j,xy:se,event:K,first:ee,last:te}=V,I=l?.current;if(!I||lo(K?.target,h.current,f.current))return;const M=dn(I,j,se);ee?u.current?.onstart?.(M):te?u.current?.onend?.(M):q&&u.current?.onmove?.(M)},e[5]=l,e[6]=y):y=e[6];const E=i?.lockAxis==="x"?"x":void 0;let T;e[7]===Symbol.for("react.memo_cache_sentinel")?(T={capture:!0},e[7]=T):T=e[7];let b;e[8]!==s||e[9]!==l||e[10]!==E?(b={enabled:s,axis:E,pointer:T,target:l,threshold:0},e[8]=s,e[9]=l,e[10]=E,e[11]=b):b=e[11],fn(y,b);let g;e[12]!==l?(g=V=>{const{active:q,delta:j,xy:se,first:K,last:ee}=V,te=l?.current;if(!te)return;const I=dn(te,j,se,{left:!0},{left:j[0]});K?c.current?.onstart?.(I):ee?c.current?.onend?.(I):q&&c.current?.onmove?.(I)},e[12]=l,e[13]=g):g=e[13];let m;e[14]===Symbol.for("react.memo_cache_sentinel")?(m={capture:!0},e[14]=m):m=e[14];let R;e[15]!==o?(R={enabled:o,target:h,pointer:m,threshold:0},e[15]=o,e[16]=R):R=e[16],fn(g,R);let _;e[17]!==l?(_=V=>{const{active:q,delta:j,xy:se,first:K,last:ee}=V,te=l?.current;if(!te)return;const I=dn(te,j,se,{right:!0},{right:j[0]});K?c.current?.onstart?.(I):ee?c.current?.onend?.(I):q&&c.current?.onmove?.(I)},e[17]=l,e[18]=_):_=e[18];let D;e[19]===Symbol.for("react.memo_cache_sentinel")?(D={capture:!0},e[19]=D):D=e[19];let L;e[20]!==o?(L={enabled:o,target:f,pointer:D,threshold:0},e[20]=o,e[21]=L):L=e[21],fn(_,L);let A;e[22]!==s?(A=s?{touchAction:"none"}:{},e[22]=s,e[23]=A):A=e[23];let w;e[24]!==r||e[25]!==A?(w={...A,...r},e[24]=r,e[25]=A,e[26]=w):w=e[26];let W;return e[27]!==t||e[28]!==l||e[29]!==w?(W=x.jsx(Ms,{ref:l,style:w,draggable:!1,children:t}),e[27]=t,e[28]=l,e[29]=w,e[30]=W):W=e[30],W},Un=tt.getLogger("[Snap Debug]").setLevel("info"),we=(n,e=0)=>n?parseFloat(n):e,hn=(n,e,t,r=Number.MAX_SAFE_INTEGER)=>{let s=n,o=r;for(const i of e){const a=typeof i=="number"?i:i.value,l=Math.abs(a-n);l<t&&l<o&&(s=a,o=l,typeof i=="object"?Un.debug(`Snapped to: ${a} (Distance: ${l}) Row: ${i.rowId??"N/A"} Action: ${i.actionId??"N/A"}`):Un.debug(`Snapped to: ${a} (Distance: ${l})`))}return{snap:s,minDis:o}};function Sr(n){const e=De.c(70),{children:t,edges:r,left:s,width:o,start:i,grid:a,getBounds:l,enableResizing:u,enableDragging:c,snapDistance:h,snapPositions:f,snapOrigin:p,onResizeStart:S,onResize:y,onResizeEnd:E,onDragStart:T,onDragEnd:b,onDrag:g,parentRef:m,autoScroll:R,autoScrollSpeed:_,autoScrollMaxSpeed:D,ref:L}=n,A=i===void 0?C.DEFAULT_START_LEFT:i,w=a===void 0?C.DEFAULT_MOVE_GRID:a,W=l===void 0?fo:l,V=u===void 0?!0:u,q=c===void 0?!0:c,j=h===void 0?C.DEFAULT_SNAP_DISTANCE:h;let se;e[0]!==f?(se=f===void 0?[]:f,e[0]=f,e[1]=se):se=e[1];const K=se,ee=p===void 0?"leading":p,te=R===void 0?!0:R,I=O.useRef(null),M=O.useRef(0),d=O.useRef(!1),{initAutoScroll:P,stopAutoScroll:k,dealDragAutoScroll:X,dealResizeAutoScroll:me}=Vr(m,_,D);let ge;e[2]===Symbol.for("react.memo_cache_sentinel")?(ge=(z,J)=>{const F=J===void 0?!0:J;if(!I.current)return;F&&(M.current=0);const H=I.current;H.style.setProperty("--translate-x",`${z}px`),H.dataset.left=String(z)},e[2]=ge):ge=e[2];const Y=ge;let Q;e[3]===Symbol.for("react.memo_cache_sentinel")?(Q=(z,J)=>{const F=J===void 0?!0:J;if(!I.current)return;F&&(M.current=0);const H=I.current;H.style.width=`${z}px`,H.dataset.width=String(z)},e[3]=Q):Q=e[3];const B=Q;let oe;e[4]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>I.current?we(I.current.dataset.left):0,e[4]=oe):oe=e[4];const Z=oe;let $;e[5]===Symbol.for("react.memo_cache_sentinel")?($=()=>I.current?we(I.current.dataset.width):0,e[5]=$):$=e[5];const G=$;let it,at;e[6]!==o?(it=()=>{if(!I.current)return;const z=I.current;B(typeof o>"u"?z.offsetWidth:o,!1)},at=[o],e[6]=o,e[7]=it,e[8]=at):(it=e[7],at=e[8]),O.useEffect(it,at);let je,Ie;e[9]!==s?(je=()=>{Y(s||0,!1)},Ie=[s],e[9]=s,e[10]=je,e[11]=Ie):(je=e[10],Ie=e[11]),O.useEffect(je,Ie);let Pe;e[12]===Symbol.for("react.memo_cache_sentinel")?(Pe=()=>({updateLeft:z=>Y(z||0,!1),updateWidth:z=>B(z,!1),getLeft:Z,getWidth:G}),e[12]=Pe):Pe=e[12],O.useImperativeHandle(L,Pe);let Fe;e[13]!==P||e[14]!==T?(Fe=()=>{M.current=0,d.current=!1,P(),T?.()},e[13]=P,e[14]=T,e[15]=Fe):Fe=e[15];const Ue=Fe;let Le;e[16]!==W||e[17]!==w||e[18]!==g||e[19]!==j||e[20]!==ee||e[21]!==K||e[22]!==A?(Le=z=>{const{preLeft:J,preWidth:F,scrollDelta:H}=z;H&&(M.current=M.current+H);const ce=d.current?j:w;if(Math.abs(M.current)<ce)return;const ae=Math.trunc(M.current/ce);let U=J+ae*ce;const ue=M.current>0;let N=U;ee==="leading"?N=ue?U+F:U:ee==="right"?N=U+F:ee==="center"&&(N=U+F/2);const{snap:ne}=hn(N,K,j);if(ne!==N)d.current=!0,ee==="leading"?U=ue?ne-F:ne:ee==="right"?U=ne-F:ee==="center"?U=ne-F/2:U=ne;else{const de=U-A;de%w!==0&&(U=A+w*Math.round(de/w)),d.current=!1}M.current=M.current%ce;const fe=W();U<fe.left?U=fe.left:U+F>fe.right&&(U=fe.right-F),!(g&&g({lastLeft:J,left:U,lastWidth:F,width:F},H)===!1)&&Y(U,!1)},e[16]=W,e[17]=w,e[18]=g,e[19]=j,e[20]=ee,e[21]=K,e[22]=A,e[23]=Le):Le=e[23];const Ne=Le;let lt;e[24]!==te||e[25]!==X||e[26]!==Ne||e[27]!==m?(lt=z=>{const J=z.target,F=we(J.dataset.left),H=we(J.dataset.width);M.current=M.current+z.dx,!(te&&m?.current&&!X(z,U=>{if(!m?.current||!I.current)return;m.current.scrollLeft=m.current.scrollLeft+U;const ue=I.current,N=we(ue.dataset.left),ne=we(ue.dataset.width);Ne({preLeft:N,preWidth:ne,scrollDelta:U})}))&&Ne({preLeft:F,preWidth:H})},e[24]=te,e[25]=X,e[26]=Ne,e[27]=m,e[28]=lt):lt=e[28];const Ot=lt;let ke;e[29]!==b||e[30]!==k?(ke=z=>{M.current=0,d.current=!1,k();const J=z.target;b?.({left:we(J.dataset.left),width:we(J.dataset.width)})},e[29]=b,e[30]=k,e[31]=ke):ke=e[31];const Te=ke;let We;e[32]!==P||e[33]!==S?(We=z=>{M.current=0,d.current=!1,P();const J=z.edges?.right?"right":"left";S?.(J)},e[32]=P,e[33]=S,e[34]=We):We=e[34];const Ve=We;let $e;e[35]!==W||e[36]!==w||e[37]!==y||e[38]!==j||e[39]!==K||e[40]!==A?($e=z=>{const{dir:J,preWidth:F,preLeft:H,scrollDelta:ce}=z;ce&&(M.current=M.current+ce);const ae=d.current?j:w;if(Math.abs(M.current)<ae)return;const U=W();if(J==="left"){const ue=Math.trunc(M.current/ae);let N=H+ue*ae;const{snap:ne}=hn(N,K,j);if(ne!==N)d.current=!0,N=ne;else{const ye=N-A;ye%w!==0&&(N=A+w*Math.round(ye/w)),d.current=!1}M.current=M.current%ae,N<U.left&&(N=U.left);const fe=H+F,de=fe-N;if(N>=fe||y&&y("left",{lastLeft:H,lastWidth:F,left:N,width:de})===!1)return;Y(N,!1),B(de,!1)}else{const ue=Math.trunc(M.current/ae);let N=F+ue*ae;const ne=H+N,{snap:fe}=hn(ne,K,j);if(fe!==ne)d.current=!0,N=fe-H;else{let de=H+N;const ye=de-A;ye%w!==0&&(de=A+w*Math.round(ye/w),N=de-H),d.current=!1}if(M.current=M.current%ae,H+N>U.right&&(N=U.right-H),N<=0||y&&y("right",{lastLeft:H,lastWidth:F,left:H,width:N})===!1)return;B(N,!1)}},e[35]=W,e[36]=w,e[37]=y,e[38]=j,e[39]=K,e[40]=A,e[41]=$e):$e=e[41];const ze=$e;let Ae;e[42]!==te||e[43]!==me||e[44]!==m||e[45]!==ze?(Ae=z=>{const J=z.target,F=z.edges?.left?"left":"right",H=we(J.dataset.left),ce=we(J.dataset.width);M.current=M.current+(F==="left"?z.deltaRect?.left||0:z.deltaRect?.right||0),!(te&&m?.current&&!me(z,F,ue=>{if(!m?.current||!I.current)return;m.current.scrollLeft=m.current.scrollLeft+ue;const N=I.current,ne=we(N.dataset.left),fe=we(N.dataset.width);ze({preLeft:ne,preWidth:fe,dir:F,scrollDelta:ue})}))&&ze({preLeft:H,preWidth:ce,dir:F})},e[42]=te,e[43]=me,e[44]=m,e[45]=ze,e[46]=Ae):Ae=e[46];const He=Ae;let Be;e[47]!==E||e[48]!==k?(Be=z=>{M.current=0,d.current=!1,k();const J=z.target,F=z.edges?.right?"right":"left";E?.(F,{left:we(J.dataset.left),width:we(J.dataset.width)})},e[47]=E,e[48]=k,e[49]=Be):Be=e[49];const Xe=Be,nt=s||0,Ye=`${s||0}px`;let Ke;e[50]!==Ye||e[51]!==o?(Ke={"--translate-x":Ye,transform:"translateX(var(--translate-x)) scaleX(var(--scale-x,1))",width:o},e[50]=Ye,e[51]=o,e[52]=Ke):Ke=e[52];const Ge=Ke;let Oe;e[53]!==Ot||e[54]!==Ue||e[55]!==Te?(Oe={lockAxis:"x",onmove:Ot,onstart:Ue,onend:Te,cursorChecker:uo},e[53]=Ot,e[54]=Ue,e[55]=Te,e[56]=Oe):Oe=e[56];let Ce;e[57]!==r||e[58]!==He||e[59]!==Ve||e[60]!==Xe?(Ce={axis:"x",invert:"none",edges:r,onmove:He,onstart:Ve,onend:Xe},e[57]=r,e[58]=He,e[59]=Ve,e[60]=Xe,e[61]=Ce):Ce=e[61];let qe;return e[62]!==t||e[63]!==q||e[64]!==V||e[65]!==nt||e[66]!==Ge||e[67]!==Oe||e[68]!==Ce?(qe=x.jsx(co,{"data-left":nt,style:Ge,ref:I,draggable:q,resizable:V,draggableOptions:Oe,resizableOptions:Ce,children:t}),e[62]=t,e[63]=q,e[64]=V,e[65]=nt,e[66]=Ge,e[67]=Oe,e[68]=Ce,e[69]=qe):qe=e[69],qe}function uo(){return""}function fo(){return{left:Number.MIN_SAFE_INTEGER,right:Number.MAX_SAFE_INTEGER}}function Vn(){let n=0,e,t="",r=arguments.length;for(;n<r;n++)(e=arguments[n])&&typeof e=="string"&&(t+=(t&&" ")+e);return t}const ho=n=>{const e=De.c(204),{editorData:t,row:r,action:s,effects:o,rowHeight:i,scale:a,scaleWidth:l,scaleSplitCount:u,startLeft:c,gridSnap:h,disableDrag:f,autoScroll:p,autoScrollSpeed:S,autoScrollMaxSpeed:y,scaleCount:E,maxScaleCount:T,setScaleCount:b,onActionMoveStart:g,onActionMoving:m,onActionMoveEnd:R,onActionResizeStart:_,onActionResizeEnd:D,onActionResizing:L,snapData:A,setEditorData:w,onClickAction:W,onClickActionOnly:V,onDoubleClickAction:q,onContextMenuAction:j,getActionRender:se,handleTime:K,scrollContainerRef:ee}=n,te=O.useRef(null),I=O.useRef(!1),{id:M,maxEnd:d,minStart:P,end:k,start:X,selected:me,flexible:ge,movable:Y,effectId:Q}=s,B=ge===void 0?!0:ge,oe=Y===void 0?!0:Y,Z=a??C.DEFAULT_SCALE,$=l??C.DEFAULT_SCALE_WIDTH,G=c??C.DEFAULT_START_LEFT,it=u??C.DEFAULT_SCALE_SPLIT_COUNT,at=T??Number.MAX_SAFE_INTEGER,je=P||0;let Ie;e[0]!==Z||e[1]!==$||e[2]!==G||e[3]!==je?(Ie=C.parserTimeToPixel(je,{startLeft:G,scale:Z,scaleWidth:$}),e[0]=Z,e[1]=$,e[2]=G,e[3]=je,e[4]=Ie):Ie=e[4];const Pe=Ie,Fe=d||Number.MAX_VALUE;let Ue;e[5]!==Z||e[6]!==$||e[7]!==G||e[8]!==Fe?(Ue=C.parserTimeToPixel(Fe,{startLeft:G,scale:Z,scaleWidth:$}),e[5]=Z,e[6]=$,e[7]=G,e[8]=Fe,e[9]=Ue):Ue=e[9];const Le=Math.min(at*$+G,Ue);let Ne;e[10]!==k||e[11]!==Z||e[12]!==$||e[13]!==G||e[14]!==X?(Ne=C.parserTimeToTransform({start:X,end:k},{startLeft:G,scale:Z,scaleWidth:$}),e[10]=k,e[11]=Z,e[12]=$,e[13]=G,e[14]=X,e[15]=Ne):Ne=e[15];const lt=Ne,[Ot,ke]=O.useState(null),Te=Ot??lt,We=$/it;let Ve;e[16]!==Q||e[17]!==o||e[18]!==B||e[19]!==oe||e[20]!==me?(Ve=ve(Vn("action",oe&&"action-movable",me&&"action-selected",B&&"action-flexible",o[Q]&&`action-effect-${Q}`)),e[16]=Q,e[17]=o,e[18]=B,e[19]=oe,e[20]=me,e[21]=Ve):Ve=e[21];const $e=Ve;let ze;e[22]!==$||e[23]!==G||e[24]!==E||e[25]!==b?(ze=(Se,_e)=>{const ie=C.getScaleCountByPixel(Se+_e,{startLeft:G,scaleCount:E,scaleWidth:$});ie!==E&&b(ie)},e[22]=$,e[23]=G,e[24]=E,e[25]=b,e[26]=ze):ze=e[26];const Ae=ze;let He;e[27]!==s||e[28]!==g||e[29]!==r?(He=()=>{g&&g({action:s,row:r})},e[27]=s,e[28]=g,e[29]=r,e[30]=He):He=e[30];const Be=He;let Xe;e[31]!==s||e[32]!==Ae||e[33]!==m||e[34]!==r||e[35]!==Z||e[36]!==$||e[37]!==G?(Xe=Se=>{const{left:_e,width:ie}=Se;if(I.current=!0,m){const{start:pe,end:le}=C.parserTransformToTime({left:_e,width:ie},{scaleWidth:$,scale:Z,startLeft:G});if(m({action:s,row:r,start:pe,end:le})===!1)return!1}ke({left:_e,width:ie}),Ae(_e,ie)},e[31]=s,e[32]=Ae,e[33]=m,e[34]=r,e[35]=Z,e[36]=$,e[37]=G,e[38]=Xe):Xe=e[38];const nt=Xe;let Ye;e[39]!==t||e[40]!==M||e[41]!==R||e[42]!==r||e[43]!==Z||e[44]!==$||e[45]!==G||e[46]!==w?(Ye=Se=>{const{left:_e,width:ie}=Se,{start:pe,end:le}=C.parserTransformToTime({left:_e,width:ie},{scaleWidth:$,scale:Z,startLeft:G}),he=t.find(et=>et.id===r.id);if(!he)return;const Qe=he.actions.find(et=>et.id===M);Qe&&(Qe.start=pe,Qe.end=le,w([...t]),R&&R({action:Qe,row:r,start:pe,end:le}),ke(null))},e[39]=t,e[40]=M,e[41]=R,e[42]=r,e[43]=Z,e[44]=$,e[45]=G,e[46]=w,e[47]=Ye):Ye=e[47];const Ke=Ye;let Ge;e[48]!==s||e[49]!==_||e[50]!==r?(Ge=Se=>{_&&_({action:s,row:r,dir:Se})},e[48]=s,e[49]=_,e[50]=r,e[51]=Ge):Ge=e[51];const Oe=Ge;let Ce;e[52]!==s||e[53]!==Ae||e[54]!==L||e[55]!==r||e[56]!==Z||e[57]!==$||e[58]!==G?(Ce=(Se,_e)=>{const{left:ie,width:pe}=_e;if(I.current=!0,L){const{start:le,end:he}=C.parserTransformToTime({left:ie,width:pe},{scaleWidth:$,scale:Z,startLeft:G});if(L({action:s,row:r,start:le,end:he,dir:Se})===!1)return!1}ke({left:ie,width:pe}),Ae(ie,pe)},e[52]=s,e[53]=Ae,e[54]=L,e[55]=r,e[56]=Z,e[57]=$,e[58]=G,e[59]=Ce):Ce=e[59];const qe=Ce;let z;e[60]!==t||e[61]!==M||e[62]!==D||e[63]!==r||e[64]!==Z||e[65]!==$||e[66]!==G||e[67]!==w?(z=(Se,_e)=>{const{left:ie,width:pe}=_e,{start:le,end:he}=C.parserTransformToTime({left:ie,width:pe},{scaleWidth:$,scale:Z,startLeft:G}),Qe=t.find(on=>on.id===r.id);if(!Qe)return;const et=Qe.actions.find(on=>on.id===M);et&&(et.start=le,et.end=he,w([...t]),D&&D({action:et,row:r,start:le,end:he,dir:Se}),ke(null))},e[60]=t,e[61]=M,e[62]=D,e[63]=r,e[64]=Z,e[65]=$,e[66]=G,e[67]=w,e[68]=z):z=e[68];const J=z;let F,H,ce,ae,U,ue,N,ne,fe,de,ye,ct,ut,ft,dt,ht,Je,Ze,mt,pt,gt,vt,bt,St,_t,wt,Et,yt,Tt;if(e[69]!==s||e[70]!==p||e[71]!==y||e[72]!==S||e[73]!==$e||e[74]!==f||e[75]!==B||e[76]!==se||e[77]!==We||e[78]!==h||e[79]!==nt||e[80]!==Ke||e[81]!==Be||e[82]!==J||e[83]!==Oe||e[84]!==qe||e[85]!==K||e[86]!==Pe||e[87]!==oe||e[88]!==W||e[89]!==V||e[90]!==j||e[91]!==q||e[92]!==Le||e[93]!==r||e[94]!==i||e[95]!==Z||e[96]!==$||e[97]!==G||e[98]!==ee||e[99]!==A.assistPositions||e[100]!==Te.left||e[101]!==Te.width){const Se={...s,...C.parserTransformToTime({left:Te.left,width:Te.width},{startLeft:G,scaleWidth:$,scale:Z})},_e={...r,actions:[...r.actions]};r.actions.includes(s)&&(_e.actions[r.actions.indexOf(s)]=Se),F=Sr,fe=te,de=ee,ye=G,ct=Te.left,ut=Te.width,ft=h&&We||C.DEFAULT_MOVE_GRID,dt=h?Math.max((We||C.DEFAULT_MOVE_GRID)/2,C.DEFAULT_SNAP_DISTANCE):C.DEFAULT_SNAP_DISTANCE,ht=A.assistPositions,e[131]!==Pe||e[132]!==Le?(Je=()=>({left:Pe,right:Le}),e[131]=Pe,e[132]=Le,e[133]=Je):Je=e[133];let ie;e[134]!==f||e[135]!==B?(ie=!f&&B&&`.${ve("action-left-stretch")}`,e[134]=f,e[135]=B,e[136]=ie):ie=e[136];let pe;e[137]!==f||e[138]!==B?(pe=!f&&B&&`.${ve("action-right-stretch")}`,e[137]=f,e[138]=B,e[139]=pe):pe=e[139],e[140]!==ie||e[141]!==pe?(Ze={left:ie,right:pe},e[140]=ie,e[141]=pe,e[142]=Ze):Ze=e[142],mt=!f&&oe,pt=!f&&B,gt=Be,vt=nt,bt=Ke,St=Oe,_t=qe,wt=J,Et=p,yt=S,Tt=y,e[143]===Symbol.for("react.memo_cache_sentinel")?(H=()=>{I.current=!1},e[143]=H):H=e[143],e[144]!==s||e[145]!==K||e[146]!==W||e[147]!==V||e[148]!==r?(ce=le=>{let he;W&&(he=K(le),W(le,{row:r,action:s,time:he})),!I.current&&V&&(he===void 0&&(he=K(le)),V(le,{row:r,action:s,time:he}))},e[144]=s,e[145]=K,e[146]=W,e[147]=V,e[148]=r,e[149]=ce):ce=e[149],e[150]!==s||e[151]!==K||e[152]!==q||e[153]!==r?(ae=le=>{if(q){const he=K(le);q(le,{row:r,action:s,time:he})}},e[150]=s,e[151]=K,e[152]=q,e[153]=r,e[154]=ae):ae=e[154],e[155]!==s||e[156]!==K||e[157]!==j||e[158]!==r?(U=le=>{if(j){const he=K(le);j(le,{row:r,action:s,time:he})}},e[155]=s,e[156]=K,e[157]=j,e[158]=r,e[159]=U):U=e[159],ue=$e,e[160]!==i?(N={height:i},e[160]=i,e[161]=N):N=e[161],ne=se&&se(Se,_e),e[69]=s,e[70]=p,e[71]=y,e[72]=S,e[73]=$e,e[74]=f,e[75]=B,e[76]=se,e[77]=We,e[78]=h,e[79]=nt,e[80]=Ke,e[81]=Be,e[82]=J,e[83]=Oe,e[84]=qe,e[85]=K,e[86]=Pe,e[87]=oe,e[88]=W,e[89]=V,e[90]=j,e[91]=q,e[92]=Le,e[93]=r,e[94]=i,e[95]=Z,e[96]=$,e[97]=G,e[98]=ee,e[99]=A.assistPositions,e[100]=Te.left,e[101]=Te.width,e[102]=F,e[103]=H,e[104]=ce,e[105]=ae,e[106]=U,e[107]=ue,e[108]=N,e[109]=ne,e[110]=fe,e[111]=de,e[112]=ye,e[113]=ct,e[114]=ut,e[115]=ft,e[116]=dt,e[117]=ht,e[118]=Je,e[119]=Ze,e[120]=mt,e[121]=pt,e[122]=gt,e[123]=vt,e[124]=bt,e[125]=St,e[126]=_t,e[127]=wt,e[128]=Et,e[129]=yt,e[130]=Tt}else F=e[102],H=e[103],ce=e[104],ae=e[105],U=e[106],ue=e[107],N=e[108],ne=e[109],fe=e[110],de=e[111],ye=e[112],ct=e[113],ut=e[114],ft=e[115],dt=e[116],ht=e[117],Je=e[118],Ze=e[119],mt=e[120],pt=e[121],gt=e[122],vt=e[123],bt=e[124],St=e[125],_t=e[126],wt=e[127],Et=e[128],yt=e[129],Tt=e[130];let jt;e[162]===Symbol.for("react.memo_cache_sentinel")?(jt=Vn(ve("action-left-stretch")),e[162]=jt):jt=e[162];const tn=B?"visible":"hidden",nn=B?"auto":"none";let Rt;e[163]!==tn||e[164]!==nn?(Rt=x.jsx("div",{className:jt,style:{touchAction:"none",visibility:tn,pointerEvents:nn}}),e[163]=tn,e[164]=nn,e[165]=Rt):Rt=e[165];let Ft;e[166]===Symbol.for("react.memo_cache_sentinel")?(Ft=ve("action-right-stretch"),e[166]=Ft):Ft=e[166];const rn=B?"visible":"hidden",sn=B?"auto":"none";let xt;e[167]!==rn||e[168]!==sn?(xt=x.jsx("div",{className:Ft,style:{touchAction:"none",visibility:rn,pointerEvents:sn}}),e[167]=rn,e[168]=sn,e[169]=xt):xt=e[169];let At;e[170]!==H||e[171]!==ce||e[172]!==ae||e[173]!==U||e[174]!==ue||e[175]!==N||e[176]!==ne||e[177]!==Rt||e[178]!==xt?(At=x.jsxs("div",{onMouseDown:H,onClick:ce,onDoubleClick:ae,onContextMenu:U,className:ue,style:N,children:[ne,Rt,xt]}),e[170]=H,e[171]=ce,e[172]=ae,e[173]=U,e[174]=ue,e[175]=N,e[176]=ne,e[177]=Rt,e[178]=xt,e[179]=At):At=e[179];let Ut;return e[180]!==F||e[181]!==fe||e[182]!==de||e[183]!==ye||e[184]!==ct||e[185]!==ut||e[186]!==ft||e[187]!==dt||e[188]!==ht||e[189]!==Je||e[190]!==Ze||e[191]!==mt||e[192]!==pt||e[193]!==gt||e[194]!==vt||e[195]!==bt||e[196]!==St||e[197]!==_t||e[198]!==wt||e[199]!==Et||e[200]!==yt||e[201]!==Tt||e[202]!==At?(Ut=x.jsx(F,{ref:fe,parentRef:de,start:ye,left:ct,width:ut,grid:ft,snapDistance:dt,snapPositions:ht,getBounds:Je,edges:Ze,enableDragging:mt,enableResizing:pt,onDragStart:gt,onDrag:vt,onDragEnd:bt,onResizeStart:St,onResize:_t,onResizeEnd:wt,autoScroll:Et,autoScrollSpeed:yt,autoScrollMaxSpeed:Tt,children:At}),e[180]=F,e[181]=fe,e[182]=de,e[183]=ye,e[184]=ct,e[185]=ut,e[186]=ft,e[187]=dt,e[188]=ht,e[189]=Je,e[190]=Ze,e[191]=mt,e[192]=pt,e[193]=gt,e[194]=vt,e[195]=bt,e[196]=St,e[197]=_t,e[198]=wt,e[199]=Et,e[200]=yt,e[201]=Tt,e[202]=At,e[203]=Ut):Ut=e[203],Ut};function Dt(n,e,t){let r=t.initialDeps??[],s;function o(){var i,a,l,u;let c;t.key&&((i=t.debug)!=null&&i.call(t))&&(c=Date.now());const h=n();if(!(h.length!==r.length||h.some((S,y)=>r[y]!==S)))return s;r=h;let p;if(t.key&&((a=t.debug)!=null&&a.call(t))&&(p=Date.now()),s=e(...h),t.key&&((l=t.debug)!=null&&l.call(t))){const S=Math.round((Date.now()-c)*100)/100,y=Math.round((Date.now()-p)*100)/100,E=y/16,T=(b,g)=>{for(b=String(b);b.length<g;)b=" "+b;return b};console.info(`%c⏱ ${T(y,5)} /${T(S,5)} ms`,`
11
- font-size: .6rem;
12
- font-weight: bold;
13
- color: hsl(${Math.max(0,Math.min(120-120*E,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 mo=(n,e)=>Math.abs(n-e)<1.01,po=(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}},go=n=>n,vo=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},bo=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;const s=i=>{const{width:a,height:l}=i;e({width:Math.round(a),height:Math.round(l)})};if(s(Hn(t)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(i=>{const a=()=>{const l=i[0];if(l?.borderBoxSize){const u=l.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(Hn(t))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},Bn={passive:!0},Xn=typeof window>"u"?!0:"onscrollend"in window,So=(n,e)=>{const t=n.scrollElement;if(!t)return;const r=n.targetWindow;if(!r)return;let s=0;const o=n.options.useScrollendEvent&&Xn?()=>{}:po(r,()=>{e(s,!1)},n.options.isScrollingResetDelay),i=c=>()=>{const{horizontal:h,isRtl:f}=n.options;s=h?t.scrollLeft*(f&&-1||1):t.scrollTop,o(),e(s,c)},a=i(!0),l=i(!1);l(),t.addEventListener("scroll",a,Bn);const u=n.options.useScrollendEvent&&Xn;return u&&t.addEventListener("scrollend",l,Bn),()=>{t.removeEventListener("scroll",a),u&&t.removeEventListener("scrollend",l)}},_o=(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"]},wo=(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 Eo{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:go,rangeExtractor:vo,onChange:()=>{},measureElement:_o,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=Dt(()=>(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 a=t[i];if(s.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.end<l.end&&s.set(a.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Dt(()=>[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=Dt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i},a)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(c=>{this.itemSizeCache.set(c.key,c.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,l);for(let c=l;c<t;c++){const h=o(c),f=this.options.lanes===1?u[c-1]:this.getFurthestMeasurement(u,c),p=f?f.end+this.options.gap:r+s,S=a.get(h),y=typeof S=="number"?S:this.options.estimateSize(c),E=p+y,T=f?f.lane:c%this.options.lanes;u[c]={index:c,start:p,size:y,end:E,key:h,lane:T}}return this.measurementsCache=u,u},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Dt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,o)=>this.range=t.length>0&&r>0?yo({measurements:t,outerSize:r,scrollOffset:s,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Dt(()=>{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,a=this.elementsCache.get(i);a!==t&&(a&&this.observer.unobserve(a),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=Dt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let o=0,i=t.length;o<i;o++){const a=t[o],l=r[a];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 $n(r[_r(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 a=this.getTotalSize()+this.options.scrollMargin-o;return Math.max(Math.min(a,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 a=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,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,a=u=>{if(!this.targetWindow)return;const c=this.getOffsetForIndex(t,u);if(!c){console.warn("Failed to get offset for index:",t);return}const[h,f]=c;this._scrollToOffset(h,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const p=this.getScrollOffset(),S=this.getOffsetForIndex(t,f);if(!S){console.warn("Failed to get offset for index:",t);return}mo(S[0],p)||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(()=>a(u))):console.warn(`Failed to scroll to index ${t} after ${i} attempts.`))};a(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(a=>a===null);){const a=r[i];o[a.lane]===null&&(o[a.lane]=a.end),i--}s=Math.max(...o.filter(a=>a!==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 _r=(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 yo({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=_r(0,s,o,t),a=i;if(r===1)for(;a<s&&n[a].end<t+e;)a++;else if(r>1){const l=Array(r).fill(0);for(;a<s&&l.some(c=>c<t+e);){const c=n[a];l[c.lane]=c.end,a++}const u=Array(r).fill(t+e);for(;i>=0&&u.some(c=>c>=t);){const c=n[i];u[c.lane]=c.start,i--}i=Math.max(0,i-i%r),a=Math.min(s,a+(r-1-a%r))}return{startIndex:i,endIndex:a}}const Yn=typeof document<"u"?v.useLayoutEffect:v.useEffect;function To(n){const e=v.useReducer(()=>({}),{})[1],t={...n,onChange:(s,o)=>{var i;o?yr.flushSync(e):e(),(i=n.onChange)==null||i.call(n,s,o)}},[r]=v.useState(()=>new Eo(t));return r.setOptions(t),Yn(()=>r._didMount(),[]),Yn(()=>r._willUpdate()),r}function wr(n){return To({observeElementRect:bo,observeElementOffset:So,scrollToFn:wo,...n})}const Ro=n=>{const{rowData:e,style:t={},onClickRow:r,onDoubleClickRow:s,onContextMenuRow:o,scrollContainerRef:i,startLeft:a,scale:l,scaleWidth:u,unstable_rowActionsOverscan:c}=n,h=["edit-row"];e?.selected&&h.push("edit-row-selected");const f=l??C.DEFAULT_SCALE,p=u??C.DEFAULT_SCALE_WIDTH,S=a??C.DEFAULT_START_LEFT,y=g=>{if(!i.current)return 0;const R=g.currentTarget.getBoundingClientRect(),D=g.clientX-R.x;return C.parserPixelToTime(D,{startLeft:S,scale:f,scaleWidth:p})},E=O.useMemo(()=>(e?.actions?[...e.actions]:[]).sort((g,m)=>g.start-m.start),[e]),T=O.useCallback(g=>E[g]?.id??g,[E]),b=wr({horizontal:!0,count:E.length,getItemKey:T,getScrollElement:()=>i.current,estimateSize:g=>{if(!E[g])return 0;let m=g>0?E[g-1].end:0,R=E[g].end;if(m>R)return 0;let{width:_}=C.parserTimeToTransform({start:m,end:R},{startLeft:S,scale:f,scaleWidth:p});return _},overscan:c??5});return O.useEffect(()=>b.measure(),[f,p,S,b]),x.jsx("div",{className:`${ve(...h)} ${(e?.classNames||[]).join(" ")}`,style:t,onClick:g=>{if(e&&r){const m=y(g);r(g,{row:e,time:m})}},onDoubleClick:g=>{if(e&&s){const m=y(g);s(g,{row:e,time:m})}},onContextMenu:g=>{if(e&&o){const m=y(g);o(g,{row:e,time:m})}},children:e&&b.getVirtualItems().map(g=>{const m=E[g.index];if(!m)throw new Error("Action not found");return x.jsx(ho,{...n,handleTime:y,row:e,action:m},m.id)})})},xo=n=>{const e=De.c(20);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={isMoving:!1,movePositions:[],assistPositions:[]},e[0]=t):t=e[0];const[r,s]=O.useState(t),o=O.useRef(null);let i;e[1]!==n||e[2]!==r?(i=()=>({...n,snapData:r}),e[1]=n,e[2]=r,e[3]=i):i=e[3];const a=O.useEffectEvent(i);let l;e[4]!==a?(l=()=>{const T=o.current,b=a();if(b.snap&&T&&b.snapData.isMoving&&b.snapPositions){const g=T.assistActionIds,m=b.snapPositions.filter(R=>!(R.actionId===T.action.id||g&&!g.includes(R.actionId))).map(Ao);if(!b.hideCursor){const R=C.parserTimeToPixel(b.cursorTime,{scaleWidth:b.scaleWidth??160,scale:b.scale??1,startLeft:b.startLeft??20});m.push(R)}s(R=>({...R,assistPositions:m}))}else!b.snap&&b.snapData.isMoving&&s(Co)},e[4]=a,e[5]=l):l=e[5];let u;e[6]!==n.snap?(u=[n.snap],e[6]=n.snap,e[7]=u):u=e[7],O.useEffect(l,u);let c;e[8]!==n?(c=T=>{const b=n.getAssistDragLineActionIds&&n.getAssistDragLineActionIds({action:T.action,row:T.row,editorData:n.editorData});if(o.current={action:T.action,row:T.row,assistActionIds:b},n.snap&&n.snapPositions){const g=n.snapPositions.filter(m=>!(m.actionId===T.action.id||b&&!b.includes(m.actionId))).map(Do);if(!n.hideCursor){const m=C.parserTimeToPixel(n.cursorTime,{scaleWidth:n.scaleWidth??160,scale:n.scale??1,startLeft:n.startLeft??20});g.push(m)}s({isMoving:!0,movePositions:[],assistPositions:g})}else s({isMoving:!0,movePositions:[],assistPositions:[]})},e[8]=n,e[9]=c):c=e[9];const h=c;let f;e[10]!==n.scale||e[11]!==n.scaleWidth||e[12]!==n.snap||e[13]!==n.startLeft?(f=T=>{if(n.snap){const b=n.scaleWidth??160,g=n.scale??1,m=n.startLeft??20,{left:R,width:_}=C.parserTimeToTransform({start:T.start,end:T.end},{startLeft:m,scaleWidth:b,scale:g}),D=T.dir?T.dir==="right"?[R+_]:[R]:[R,R+_];s(L=>({...L,movePositions:D}))}},e[10]=n.scale,e[11]=n.scaleWidth,e[12]=n.snap,e[13]=n.startLeft,e[14]=f):f=e[14];const p=f;let S;e[15]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{o.current=null,s({isMoving:!1,movePositions:[],assistPositions:[]})},e[15]=S):S=e[15];const y=S;let E;return e[16]!==h||e[17]!==p||e[18]!==r?(E={snapData:r,handleInitSnap:h,handleUpdateSnap:p,disposeSnap:y},e[16]=h,e[17]=p,e[18]=r,e[19]=E):E=e[19],E};function Ao(n){return n.value}function Co(n){return{...n,assistPositions:[]}}function Do(n){return n.value}const Po=n=>{const e=De.c(34);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]);let s;e[3]!==t.cursorTime||e[4]!==t.editorData||e[5]!==t.getAssistDragLineActionIds||e[6]!==t.hideCursor||e[7]!==t.scale||e[8]!==t.scaleWidth||e[9]!==t.snap||e[10]!==t.snapPositions||e[11]!==t.startLeft?(s={snap:t.snap,hideCursor:t.hideCursor,cursorTime:t.cursorTime,scaleWidth:t.scaleWidth,scale:t.scale,startLeft:t.startLeft,getAssistDragLineActionIds:t.getAssistDragLineActionIds,editorData:t.editorData,snapPositions:t.snapPositions},e[3]=t.cursorTime,e[4]=t.editorData,e[5]=t.getAssistDragLineActionIds,e[6]=t.hideCursor,e[7]=t.scale,e[8]=t.scaleWidth,e[9]=t.snap,e[10]=t.snapPositions,e[11]=t.startLeft,e[12]=s):s=e[12];const{snapData:o,handleInitSnap:i,handleUpdateSnap:a,disposeSnap:l}=xo(s),u=t.rowHeight??32,c=t.scaleWidth??160,h=t.startLeft??20,f=Math.max(t.scaleCount*c+h,t.timelineWidth);let p;if(e[13]!==f||e[14]!==u||e[15]!==l||e[16]!==i||e[17]!==a||e[18]!==t||e[19]!==o){const R=[];let _=0;for(let D=0;D<t.editorData.length;D++){const L=t.editorData[D];if(!L)continue;const A=L.rowHeight||u;R.push(O.createElement(Ro,{...t,key:L.id,rowData:L,snapData:o,scrollContainerRef:t.scrollElementRef,style:{position:"absolute",top:0,left:0,width:f,height:`${A}px`,transform:`translateY(${_}px)`},onActionMoveStart:w=>(i(w),t.onActionMoveStart&&t.onActionMoveStart(w)),onActionResizeStart:w=>(i(w),t.onActionResizeStart&&t.onActionResizeStart(w)),onActionMoving:w=>(a(w),t.onActionMoving&&t.onActionMoving(w)),onActionResizing:w=>(a(w),t.onActionResizing&&t.onActionResizing(w)),onActionResizeEnd:w=>(l(),t.onActionResizeEnd&&t.onActionResizeEnd(w)),onActionMoveEnd:w=>(l(),t.onActionMoveEnd&&t.onActionMoveEnd(w))})),_=_+A}p=[_,R],e[13]=f,e[14]=u,e[15]=l,e[16]=i,e[17]=a,e[18]=t,e[19]=o,e[20]=p}else p=e[20];const[S,y]=p,E=`0, ${t.startLeft??20}px`,T=`${t.startLeft??20}px, ${t.scaleWidth??160}px`;let b;e[21]!==f||e[22]!==E||e[23]!==T||e[24]!==S?(b={width:f,height:S,position:"relative",backgroundPositionX:E,backgroundSize:T},e[21]=f,e[22]=E,e[23]=T,e[24]=S,e[25]=b):b=e[25];let g;e[26]!==t.snap||e[27]!==o?(g=t.snap&&x.jsx(zr,{...o}),e[26]=t.snap,e[27]=o,e[28]=g):g=e[28];let m;return e[29]!==r||e[30]!==y||e[31]!==b||e[32]!==g?(m=x.jsxs("div",{ref:r,style:b,className:"timeline-editor-edit-area",children:[y,g]}),e[29]=r,e[30]=y,e[31]=b,e[32]=g,e[33]=m):m=e[33],m};function Lo({scaleSplitCount:n,scaleWidth:e,startLeft:t,scaleCount:r,maxScaleCount:s,scale:o,scrollElementRef:i,onClickTimeArea:a,setCursor:l,getScaleRender:u}){const c=n??1,h=e??160,f=t??20,p=(n??0)>0,S=p?r*(n??1)+1:r,y=(p?h/c:h)*(S-1)+f,T=wr({horizontal:!0,count:S,getScrollElement:()=>i.current,estimateSize:b=>{switch(b){case 0:return f;default:return p?h/c:h}},overscan:10});return O.useEffect(()=>T.measure(),[o,e,t,T]),x.jsx("div",{style:{width:`${y}px`},className:ve("time-area"),onClick:b=>{const g=t??20,m=e??160,R=o??1,_=s??1/0,D=b.currentTarget.getBoundingClientRect(),L=b.clientX-D.x,A=Math.max(L,g);if(A>_*m+g)return;const w=C.parserPixelToTime(A,{startLeft:g,scale:R,scaleWidth:m});a&&a(w,b),!b.defaultPrevented&&l({time:w})},children:T.getVirtualItems().map(b=>{const g=b.index,m=n??1,R=o??1,_=p?g%m===0:!0,D=[ve("time-unit"),ve(_?"time-unit-big":"time-unit-small")],L=(p?g/m:g)*R;return x.jsx("div",{"data-index":b.index,style:{width:`${b.size}px`,transform:`translateX(${b.start}px)`},className:D.join(" "),children:_&&x.jsx("div",{className:ve("time-unit-scale"),children:u?.(L)??L})},b.key)})})}function Oo(n){return typeof n=="object"&&n!==null}function Mo(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 Io(n){return Oo(n)&&"ownerSVGElement"in n}const Xt=new WeakMap;let Yt;const Er=(n,e,t)=>(r,s)=>s&&s[0]?s[0][n+"Size"]:Io(r)&&"getBBox"in r?r.getBBox()[e]:r[t],No=Er("inline","width","offsetWidth"),ko=Er("block","height","offsetHeight");function Wo({target:n,borderBoxSize:e}){Xt.get(n)?.forEach(t=>{t(n,{get width(){return No(n,e)},get height(){return ko(n,e)}})})}function zo(n){n.forEach(Wo)}function jo(){typeof ResizeObserver>"u"||(Yt=new ResizeObserver(zo))}function Fo(n,e){Yt||jo();const t=Mo(n);return t.forEach(r=>{let s=Xt.get(r);s||(s=new Set,Xt.set(r,s)),s.add(e),Yt?.observe(r)}),()=>{t.forEach(r=>{const s=Xt.get(r);s?.delete(e),s?.size||Yt?.unobserve(r)})}}const Kt=new Set;let Pt;function Uo(){Pt=()=>{const n={get width(){return window.innerWidth},get height(){return window.innerHeight}};Kt.forEach(e=>e(n))},window.addEventListener("resize",Pt)}function Vo(n){return Kt.add(n),Pt||Uo(),()=>{Kt.delete(n),!Kt.size&&typeof Pt=="function"&&(window.removeEventListener("resize",Pt),Pt=void 0)}}function $o(n,e){return typeof n=="function"?Vo(n):Fo(n,e)}function Ho(n){const e=De.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]=O.useState(r);let i,a;return e[1]!==t?(i=()=>{t.current&&$o(t.current,(l,u)=>{o({width:u.width,height:u.height})})},a=[t],e[1]=t,e[2]=i,e[3]=a):(i=e[2],a=e[3]),O.useLayoutEffect(i,a),s}const Bo=n=>{const e=De.c(49),{disableDrag:t,cursorTime:r,setCursor:s,startLeft:o,scaleWidth:i,scale:a,scaleCount:l,scaleSplitCount:u,scrollElementRef:c,maxScaleCount:h,onCursorDragStart:f,onCursorDrag:p,onCursorDragEnd:S,cursorSnap:y,autoScrollSpeed:E,autoScrollMaxSpeed:T,snapPositions:b}=n;let g;e[0]!==b?(g=b===void 0?[]:b,e[0]=b,e[1]=g):g=e[1];const m=g,R=O.useRef(null),_=o??20,D=i??160,L=a??1;let A;e[2]!==y||e[3]!==m?(A=y?m:[],e[2]=y,e[3]=m,e[4]=A):A=e[4];const w=A;let W,V;e[5]!==r||e[6]!==a||e[7]!==i||e[8]!==o?(W=()=>{if(R.current){const Q=o??20,B=i??160,oe=a??1;R.current.updateLeft(C.parserTimeToPixel(r,{startLeft:Q,scaleWidth:B,scale:oe}))}},V=[r,o,i,a],e[5]=r,e[6]=a,e[7]=i,e[8]=o,e[9]=W,e[10]=V):(W=e[9],V=e[10]),O.useEffect(W,V);const q=h??1/0,j=(u??0)>0,se=u??1,K=j?l*(u??1)+1:l,ee=o??20,te=(j?D/se:D)*(K-1)+ee;let I;e[11]!==_||e[12]!==q||e[13]!==c||e[14]!==te||e[15]!==D?(I=()=>({left:0,right:Math.min(te,q*D+_-(c.current?.scrollLeft??0))}),e[11]=_,e[12]=q,e[13]=c,e[14]=te,e[15]=D,e[16]=I):I=e[16];const M=!t;let d;e[17]!==r||e[18]!==_||e[19]!==f||e[20]!==L||e[21]!==D?(d=()=>{const Q=R.current?.getLeft()??C.parserTimeToPixel(r,{startLeft:_,scaleWidth:D,scale:L}),B=C.parserPixelToTime(Q,{startLeft:_,scale:L,scaleWidth:D});f&&f(B)},e[17]=r,e[18]=_,e[19]=f,e[20]=L,e[21]=D,e[22]=d):d=e[22];let P;e[23]!==_||e[24]!==S||e[25]!==L||e[26]!==s||e[27]!==D?(P=Q=>{const{left:B}=Q,oe=C.parserPixelToTime(B,{startLeft:_,scale:L,scaleWidth:D});s({time:oe}),S&&S(oe)},e[23]=_,e[24]=S,e[25]=L,e[26]=s,e[27]=D,e[28]=P):P=e[28];let k;e[29]!==_||e[30]!==p||e[31]!==L||e[32]!==s||e[33]!==D?(k=Q=>{const{left:B}=Q,oe=C.parserPixelToTime(B,{startLeft:_,scale:L,scaleWidth:D});s({time:oe}),p&&p(oe)},e[29]=_,e[30]=p,e[31]=L,e[32]=s,e[33]=D,e[34]=k):k=e[34];let X,me;e[35]===Symbol.for("react.memo_cache_sentinel")?(X=ve("cursor"),me=ve("cursor-top"),e[35]=X,e[36]=me):(X=e[35],me=e[36]);let ge;e[37]===Symbol.for("react.memo_cache_sentinel")?(ge=x.jsxs("div",{className:X,children:[x.jsx("svg",{className:me,width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",children:x.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"})}),x.jsx("div",{className:ve("cursor-area")})]}),e[37]=ge):ge=e[37];let Y;return e[38]!==w||e[39]!==T||e[40]!==E||e[41]!==_||e[42]!==c||e[43]!==k||e[44]!==I||e[45]!==M||e[46]!==d||e[47]!==P?(Y=x.jsx(Sr,{start:_,ref:R,parentRef:c,getBounds:I,autoScroll:!0,autoScrollSpeed:E,autoScrollMaxSpeed:T,enableDragging:M,enableResizing:!1,snapPositions:w,snapDistance:C.DEFAULT_SNAP_DISTANCE,snapOrigin:"left",onDragStart:d,onDragEnd:P,onDrag:k,children:ge}),e[38]=w,e[39]=T,e[40]=E,e[41]=_,e[42]=c,e[43]=k,e[44]=I,e[45]=M,e[46]=d,e[47]=P,e[48]=Y):Y=e[48],Y};function Kn(n){const e=De.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=x.jsx(mr,{"data-slot":"scroll-area-thumb"}),e[4]=i):i=e[4];let a;return e[5]!==t||e[6]!==o||e[7]!==r?(a=x.jsx(ur,{"data-slot":"scroll-area-scrollbar",orientation:o,className:t,...r,children:i}),e[5]=t,e[6]=o,e[7]=r,e[8]=a):a=e[8],a}function Xo(n){const e=De.c(7),{scrollElementRef:t,scale:r,scaleWidth:s,startLeft:o,cursorTimeRef:i}=n,a=O.useRef(null),l=O.useRef(null);let u,c;e[0]!==i||e[1]!==r||e[2]!==s||e[3]!==t||e[4]!==o?(u=()=>{const h=t.current;if(a.current!==null&&l.current!==null&&h&&(a.current!==r||l.current!==s)){const f=h.scrollLeft,p=i.current,S=C.parserTimeToPixel(p,{startLeft:o,scale:a.current,scaleWidth:l.current}),y=C.parserTimeToPixel(p,{startLeft:o,scale:r,scaleWidth:s}),E=S-f,T=y-E;h.scrollLeft=T}a.current=r,l.current=s},c=[r,s,o,t,i],e[0]=i,e[1]=r,e[2]=s,e[3]=t,e[4]=o,e[5]=u,e[6]=c):(u=e[5],c=e[6]),O.useLayoutEffect(u,c)}function Yo({ref:n,...e}){const t=Mr(e),r=O.useRef(null),{width:s,height:o}=Ho({elementRef:r}),i=e.unstable_forceRemountEditorArea??0,a=t.minScaleCount??Math.max(C.getScaleCountByRows(t.editorData,{scale:t.scale,pad:.1}),Math.ceil((s-t.startLeft)/t.scaleWidth)),l=Math.min(t.maxScaleCount,a),u=t.editorData?C.parserActionsToPositions(t.editorData.flatMap(m=>m.actions),{startLeft:t.startLeft,scale:t.scale,scaleWidth:t.scaleWidth}):[],[c,h]=O.useState(null);O.useLayoutEffect(()=>{h(null)},[l]);const f=c??l,p=m=>{const R=Math.min(t.maxScaleCount,m);h(R)},[S,y]=O.useState(C.START_CURSOR_TIME),E=O.useRef(C.START_CURSOR_TIME);Xo({scrollElementRef:r,scale:t.scale,scaleWidth:t.scaleWidth,startLeft:t.startLeft,cursorTimeRef:E});const T=m=>{t.onChange?.(m)},b=m=>{let{left:R,time:_}=m;return typeof _<"u"?(y(_),E.current=_,!0):typeof R<"u"?(y(E.current=C.parserPixelToTime(R,{startLeft:t.startLeft,scale:t.scale,scaleWidth:t.scaleWidth})),!0):!1},g=(m,R={})=>{const _=r.current;if(!_)return;const{block:D="start",offset:L=0,onlyIfNotVisible:A=!1}=R,w=C.parserTimeToPixel(m,{startLeft:t.startLeft,scale:t.scale,scaleWidth:t.scaleWidth}),W=_.clientWidth;if(A){const j=_.scrollLeft;if(w>=j&&w<=j+W)return}let V;D==="end"?V=w-W+L:D==="center"?V=w-W/2:V=w-L;const q=Math.max(0,_.scrollWidth-W);_.scrollTo({left:Math.min(Math.max(V,0),q),behavior:R.behavior??"instant"})};return O.useImperativeHandle(n,()=>({get target(){return r.current},set time(m){b({time:m})},get time(){return E.current},getTime(){return E.current},setTime(m){b({time:m})},getTimePixelPosition(m){return C.parserTimeToPixel(m??E.current,{startLeft:t.startLeft,scale:t.scale,scaleWidth:t.scaleWidth})},setScrollLeft:m=>{r.current&&(r.current.scrollLeft=m)},setScrollTop:m=>{r.current&&(r.current.scrollTop=m)},get scrollLeft(){return r.current?r.current.scrollLeft:0},get scrollTop(){return r.current?r.current.scrollTop:0},set scrollLeft(m){r.current&&(r.current.scrollLeft=m)},set scrollTop(m){r.current&&(r.current.scrollTop=m)},scrollToTime:g})),x.jsxs(oo,{style:t.style,className:`${C.PREFIX} ${t.disableDrag?C.PREFIX+"-disable":""}`,"data-slot":"scroll-area",children:[x.jsxs(io,{"data-slot":"scroll-area-viewport",ref:r,onScroll:m=>{t.onScroll?.(m.currentTarget)},children:[x.jsx(Lo,{...t,setCursor:b,scaleCount:f,scrollElementRef:r}),x.jsx(Po,{...t,scrollElementRef:r,timelineWidth:s,timelineHeight:o,disableDrag:t.disableDrag,editorData:t.editorData,cursorTime:S,scaleCount:f,setScaleCount:p,setEditorData:T,snapPositions:u},`__editor_area_${i}__`),!t.hideCursor&&x.jsx(Bo,{...t,timelineWidth:s,height:o,scaleCount:f,setScaleCount:p,setCursor:b,cursorTime:S,editorData:t.editorData,scrollElementRef:r,snapPositions:u})]}),x.jsx(Kn,{orientation:"horizontal"}),x.jsx(Kn,{orientation:"vertical"}),x.jsx(ao,{})]})}exports.Timeline=Yo;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ const require_deal_data = require("./deal-data-BnM2yYM0.cjs");
25
+ let react = require("react");
26
+ let react$1 = __toESM(react, 1);
27
+ react = __toESM(react);
28
+ let framework_utils = require("framework-utils");
29
+ let react_jsx_runtime = require("react/jsx-runtime");
30
+ let _use_gesture_react = require("@use-gesture/react");
31
+ let radix_ui = require("radix-ui");
32
+ let _tanstack_react_virtual = require("@tanstack/react-virtual");
33
+ let motion = require("motion");
34
+ //#region src/utils/with-defaults.ts
35
+ function withDefaults(props) {
36
+ let { editorData = [], effects = {}, scale = 1, scaleSplitCount = 10, scaleWidth = 160, startLeft = 20, minScaleCount, maxScaleCount = Infinity, rowHeight = 32, collapsedRowHeight, autoScrollSpeed = 1, autoScrollMaxSpeed = 10 } = props;
37
+ if (scale <= 0) {
38
+ console.error("Error: scale must be greater than 0!");
39
+ scale = 1;
40
+ }
41
+ if (scaleSplitCount <= 0) {
42
+ console.warn("Warning: scaleSplitCount cannot be less than 1!");
43
+ scaleSplitCount = 1;
44
+ }
45
+ if (scaleWidth <= 0) {
46
+ console.warn("Warning: scaleWidth must be greater than 0!");
47
+ scaleWidth = 160;
48
+ }
49
+ if (startLeft < 0) {
50
+ console.warn("Warning: startLeft cannot be less than 0!");
51
+ startLeft = 0;
52
+ }
53
+ if (typeof minScaleCount === "number") {
54
+ minScaleCount = parseInt(minScaleCount + "");
55
+ if (minScaleCount < 1) {
56
+ console.warn("Warning: minScaleCount must be greater than 1!");
57
+ minScaleCount = 20;
58
+ }
59
+ }
60
+ maxScaleCount = maxScaleCount === Infinity ? Infinity : parseInt(maxScaleCount + "");
61
+ if (maxScaleCount < 1) {
62
+ console.warn("Warning: maxScaleCount must be greater than 1!");
63
+ maxScaleCount = 20;
64
+ }
65
+ if (typeof minScaleCount === "number" && maxScaleCount < minScaleCount) {
66
+ console.warn("Warning: maxScaleCount cannot be less than minScaleCount!");
67
+ maxScaleCount = minScaleCount;
68
+ }
69
+ if (rowHeight <= 0) {
70
+ console.warn("Warning: rowHeight must be greater than 0!");
71
+ rowHeight = 32;
72
+ }
73
+ if (typeof collapsedRowHeight !== "undefined" && collapsedRowHeight <= 0) {
74
+ console.warn("Warning: collapsedRowHeight must be greater than 0!");
75
+ collapsedRowHeight = rowHeight;
76
+ }
77
+ if (editorData.some((row) => typeof row.collapsed?.height !== "undefined" && row.collapsed.height <= 0)) {
78
+ console.warn("Warning: collapsed row height must be greater than 0!");
79
+ editorData = editorData.map((row) => typeof row.collapsed?.height !== "undefined" && row.collapsed.height <= 0 ? {
80
+ ...row,
81
+ collapsed: {
82
+ ...row.collapsed,
83
+ height: void 0
84
+ }
85
+ } : row);
86
+ }
87
+ const temp = { ...props };
88
+ delete temp["style"];
89
+ return {
90
+ ...temp,
91
+ editorData,
92
+ effects,
93
+ scale,
94
+ scaleSplitCount,
95
+ scaleWidth,
96
+ startLeft,
97
+ minScaleCount,
98
+ maxScaleCount,
99
+ rowHeight,
100
+ collapsedRowHeight,
101
+ autoScrollSpeed,
102
+ autoScrollMaxSpeed
103
+ };
104
+ }
105
+ //#endregion
106
+ //#region src/utils/deal-class-prefix.ts
107
+ function prefix(...classNames) {
108
+ return (0, framework_utils.prefixNames)(`${require_deal_data.PREFIX}-`, ...classNames);
109
+ }
110
+ //#endregion
111
+ //#region src/components/edit_area/snap-lines.tsx
112
+ /** Drag auxiliary lines */
113
+ const SnapGuideLines = ({ isMoving, movePositions = [], assistPositions = [] }) => {
114
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
115
+ className: prefix("snap-line-container"),
116
+ children: isMoving && movePositions.filter((item) => assistPositions.includes(item)).map((linePos, index) => {
117
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
118
+ className: prefix("snap-line"),
119
+ style: { left: linePos }
120
+ }, index);
121
+ })
122
+ });
123
+ };
124
+ //#endregion
125
+ //#region src/components/row_rnd/hooks/use-auto-scroll.ts
126
+ const DEFAULT_SPEED = 1;
127
+ const MAX_SPEED = 10;
128
+ const CRITICAL_SIZE = 10;
129
+ function useAutoScroll(target, autoScrollSpeed = DEFAULT_SPEED, autoScrollMaxSpeed = MAX_SPEED) {
130
+ const leftBoundRef = (0, react$1.useRef)(Number.MIN_SAFE_INTEGER);
131
+ const rightBoundRef = (0, react$1.useRef)(Number.MAX_SAFE_INTEGER);
132
+ const speed = (0, react$1.useRef)(autoScrollSpeed);
133
+ const frame = (0, react$1.useRef)(void 0);
134
+ const initAutoScroll = () => {
135
+ if (target?.current) {
136
+ const { left, width } = target.current.getBoundingClientRect();
137
+ leftBoundRef.current = left;
138
+ rightBoundRef.current = left + width;
139
+ }
140
+ };
141
+ const dealDragAutoScroll = (e, deltaScroll) => {
142
+ if (e.clientX >= rightBoundRef.current || e.clientX <= leftBoundRef.current) {
143
+ if (frame.current !== void 0) cancelAnimationFrame(frame.current);
144
+ const over = Math.abs(e.clientX >= rightBoundRef.current ? e.clientX - rightBoundRef.current : e.clientX - leftBoundRef.current);
145
+ speed.current = Math.min(Math.max(Math.ceil(over / CRITICAL_SIZE) * autoScrollSpeed, autoScrollSpeed), autoScrollMaxSpeed);
146
+ const delta = (e.clientX >= rightBoundRef.current ? 1 : -1) * speed.current;
147
+ const loop = () => {
148
+ deltaScroll && deltaScroll(delta);
149
+ frame.current = requestAnimationFrame(loop);
150
+ };
151
+ frame.current = requestAnimationFrame(loop);
152
+ return false;
153
+ } else if (frame.current !== void 0) cancelAnimationFrame(frame.current);
154
+ return true;
155
+ };
156
+ const dealResizeAutoScroll = (e, _dir, deltaScroll) => {
157
+ if (e.clientX >= rightBoundRef.current || e.clientX < leftBoundRef.current) {
158
+ if (frame.current !== void 0) cancelAnimationFrame(frame.current);
159
+ const over = Math.abs(e.clientX >= rightBoundRef.current ? e.clientX - rightBoundRef.current : e.clientX - leftBoundRef.current);
160
+ speed.current = Math.min(Math.max(Math.ceil(over / CRITICAL_SIZE) * autoScrollSpeed, autoScrollSpeed), autoScrollMaxSpeed);
161
+ const delta = (e.clientX >= rightBoundRef.current ? 1 : -1) * speed.current;
162
+ const loop = () => {
163
+ deltaScroll && deltaScroll(delta);
164
+ frame.current = requestAnimationFrame(loop);
165
+ };
166
+ frame.current = requestAnimationFrame(loop);
167
+ return false;
168
+ } else if (frame.current !== void 0) cancelAnimationFrame(frame.current);
169
+ return true;
170
+ };
171
+ const stopAutoScroll = () => {
172
+ leftBoundRef.current = Number.MIN_SAFE_INTEGER;
173
+ rightBoundRef.current = Number.MAX_SAFE_INTEGER;
174
+ speed.current = autoScrollSpeed;
175
+ if (frame.current !== void 0) cancelAnimationFrame(frame.current);
176
+ };
177
+ return {
178
+ initAutoScroll,
179
+ dealDragAutoScroll,
180
+ dealResizeAutoScroll,
181
+ stopAutoScroll
182
+ };
183
+ }
184
+ //#endregion
185
+ //#region src/components/row_rnd/interactable.tsx
186
+ /**
187
+ * Helper function to create a GestureEvent from gesture state
188
+ */
189
+ const createGestureEvent = (target, delta, xy, edges, deltaRect) => ({
190
+ target,
191
+ dx: delta[0],
192
+ dy: delta[1],
193
+ clientX: xy[0],
194
+ clientY: xy[1],
195
+ ...edges && { edges },
196
+ ...deltaRect && { deltaRect }
197
+ });
198
+ /**
199
+ * Helper function to check if an event target is a resize handle
200
+ */
201
+ const isResizeHandle = (eventTarget, leftHandle, rightHandle) => {
202
+ if (!eventTarget) return false;
203
+ return eventTarget === leftHandle || eventTarget === rightHandle || (leftHandle?.contains(eventTarget) ?? false) || (rightHandle?.contains(eventTarget) ?? false);
204
+ };
205
+ const Interactable = ({ children, style, draggable, resizable, draggableOptions, resizableOptions, ref }) => {
206
+ const draggableOptionsRef = (0, react.useRef)(void 0);
207
+ const resizableOptionsRef = (0, react.useRef)(void 0);
208
+ const leftResizeHandleRef = (0, react.useRef)(null);
209
+ const rightResizeHandleRef = (0, react.useRef)(null);
210
+ (0, react.useLayoutEffect)(() => {
211
+ draggableOptionsRef.current = draggableOptions;
212
+ resizableOptionsRef.current = resizableOptions;
213
+ if (!ref?.current) return;
214
+ const currentLeftSelector = resizableOptions?.edges?.left;
215
+ const currentRightSelector = resizableOptions?.edges?.right;
216
+ const node = ref.current;
217
+ if (currentLeftSelector) leftResizeHandleRef.current = node.querySelector(currentLeftSelector);
218
+ if (currentRightSelector) rightResizeHandleRef.current = node.querySelector(currentRightSelector);
219
+ }, [
220
+ draggableOptions,
221
+ ref,
222
+ resizableOptions
223
+ ]);
224
+ (0, _use_gesture_react.useDrag)(({ active, delta, xy, event, first, last }) => {
225
+ const node = ref?.current;
226
+ if (!node) return;
227
+ if (isResizeHandle(event?.target, leftResizeHandleRef.current, rightResizeHandleRef.current)) return;
228
+ const gestureEvent = createGestureEvent(node, delta, xy);
229
+ if (first) draggableOptionsRef.current?.onstart?.(gestureEvent);
230
+ else if (last) draggableOptionsRef.current?.onend?.(gestureEvent);
231
+ else if (active) draggableOptionsRef.current?.onmove?.(gestureEvent);
232
+ }, {
233
+ enabled: draggable,
234
+ axis: draggableOptions?.lockAxis === "x" ? "x" : void 0,
235
+ pointer: { capture: true },
236
+ target: ref,
237
+ threshold: 0
238
+ });
239
+ (0, _use_gesture_react.useDrag)(({ active, delta, xy, first, last }) => {
240
+ const node = ref?.current;
241
+ if (!node) return;
242
+ const gestureEvent = createGestureEvent(node, delta, xy, { left: true }, { left: delta[0] });
243
+ if (first) resizableOptionsRef.current?.onstart?.(gestureEvent);
244
+ else if (last) resizableOptionsRef.current?.onend?.(gestureEvent);
245
+ else if (active) resizableOptionsRef.current?.onmove?.(gestureEvent);
246
+ }, {
247
+ enabled: resizable,
248
+ target: leftResizeHandleRef,
249
+ pointer: { capture: true },
250
+ threshold: 0
251
+ });
252
+ (0, _use_gesture_react.useDrag)(({ active, delta, xy, first, last }) => {
253
+ const node = ref?.current;
254
+ if (!node) return;
255
+ const gestureEvent = createGestureEvent(node, delta, xy, { right: true }, { right: delta[0] });
256
+ if (first) resizableOptionsRef.current?.onstart?.(gestureEvent);
257
+ else if (last) resizableOptionsRef.current?.onend?.(gestureEvent);
258
+ else if (active) resizableOptionsRef.current?.onmove?.(gestureEvent);
259
+ }, {
260
+ enabled: resizable,
261
+ target: rightResizeHandleRef,
262
+ pointer: { capture: true },
263
+ threshold: 0
264
+ });
265
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.Slot.Root, {
266
+ ref,
267
+ style: {
268
+ ...draggable ? { touchAction: "none" } : {},
269
+ ...style
270
+ },
271
+ draggable: false,
272
+ children
273
+ });
274
+ };
275
+ //#endregion
276
+ //#region src/components/row_rnd/row-rnd.tsx
277
+ const parseDatasetValue = (value, defaultValue = 0) => {
278
+ return value ? parseFloat(value) : defaultValue;
279
+ };
280
+ const calculateSnap = (position, snapPositions, snapDistance, minDis = Number.MAX_SAFE_INTEGER) => {
281
+ let snap = position;
282
+ let currentMinDis = minDis;
283
+ for (const item of snapPositions) {
284
+ const itemValue = typeof item === "number" ? item : item.value;
285
+ const dis = Math.abs(itemValue - position);
286
+ if (dis < snapDistance && dis < currentMinDis) {
287
+ snap = itemValue;
288
+ currentMinDis = dis;
289
+ }
290
+ }
291
+ return {
292
+ snap,
293
+ minDis: currentMinDis
294
+ };
295
+ };
296
+ function RowDnd({ children, edges, left, width, start = 20, grid = 1, getBounds = () => ({
297
+ left: Number.MIN_SAFE_INTEGER,
298
+ right: Number.MAX_SAFE_INTEGER
299
+ }), enableResizing = true, enableDragging = true, snapDistance = 8, snapPositions = [], snapOrigin = "leading", onResizeStart, onResize, onResizeEnd, onDragStart, onDragEnd, onDrag, parentRef, autoScroll = true, autoScrollSpeed, autoScrollMaxSpeed, ref }) {
300
+ const interactableRef = (0, react$1.useRef)(null);
301
+ const deltaX = (0, react$1.useRef)(0);
302
+ const isSnap = (0, react$1.useRef)(false);
303
+ const { initAutoScroll, stopAutoScroll, dealDragAutoScroll, dealResizeAutoScroll } = useAutoScroll(parentRef, autoScrollSpeed, autoScrollMaxSpeed);
304
+ const handleUpdateLeft = (left, reset = true) => {
305
+ if (!interactableRef.current) return;
306
+ if (reset) deltaX.current = 0;
307
+ const target = interactableRef.current;
308
+ target.style.setProperty("--translate-x", `${left}px`);
309
+ target.dataset.left = String(left);
310
+ };
311
+ const handleUpdateWidth = (width, reset = true) => {
312
+ if (!interactableRef.current) return;
313
+ if (reset) deltaX.current = 0;
314
+ const target = interactableRef.current;
315
+ target.style.width = `${width}px`;
316
+ target.dataset.width = String(width);
317
+ };
318
+ const handleGetLeft = () => {
319
+ if (!interactableRef.current) return 0;
320
+ return parseDatasetValue(interactableRef.current.dataset.left);
321
+ };
322
+ const handleGetWidth = () => {
323
+ if (!interactableRef.current) return 0;
324
+ return parseDatasetValue(interactableRef.current.dataset.width);
325
+ };
326
+ (0, react$1.useEffect)(() => {
327
+ if (!interactableRef.current) return;
328
+ const target = interactableRef.current;
329
+ handleUpdateWidth(typeof width === "undefined" ? target.offsetWidth : width, false);
330
+ }, [width]);
331
+ (0, react$1.useEffect)(() => {
332
+ handleUpdateLeft(left || 0, false);
333
+ }, [left]);
334
+ (0, react$1.useImperativeHandle)(ref, () => ({
335
+ updateLeft: (left) => handleUpdateLeft(left || 0, false),
336
+ updateWidth: (width) => handleUpdateWidth(width, false),
337
+ getLeft: handleGetLeft,
338
+ getWidth: handleGetWidth
339
+ }));
340
+ const handleMoveStart = () => {
341
+ deltaX.current = 0;
342
+ isSnap.current = false;
343
+ initAutoScroll();
344
+ onDragStart?.();
345
+ };
346
+ const move = (param) => {
347
+ const { preLeft, preWidth, scrollDelta } = param;
348
+ if (scrollDelta) deltaX.current += scrollDelta;
349
+ const distance = isSnap.current ? snapDistance : grid;
350
+ if (Math.abs(deltaX.current) < distance) return;
351
+ let curLeft = preLeft + Math.trunc(deltaX.current / distance) * distance;
352
+ const movingRight = deltaX.current > 0;
353
+ let checkPosition = curLeft;
354
+ if (snapOrigin === "leading") checkPosition = movingRight ? curLeft + preWidth : curLeft;
355
+ else if (snapOrigin === "right") checkPosition = curLeft + preWidth;
356
+ else if (snapOrigin === "center") checkPosition = curLeft + preWidth / 2;
357
+ const { snap: snapPosition } = calculateSnap(checkPosition, snapPositions, snapDistance);
358
+ if (snapPosition !== checkPosition) {
359
+ isSnap.current = true;
360
+ if (snapOrigin === "leading") curLeft = movingRight ? snapPosition - preWidth : snapPosition;
361
+ else if (snapOrigin === "right") curLeft = snapPosition - preWidth;
362
+ else if (snapOrigin === "center") curLeft = snapPosition - preWidth / 2;
363
+ else curLeft = snapPosition;
364
+ } else {
365
+ const offset = curLeft - start;
366
+ if (offset % grid !== 0) curLeft = start + grid * Math.round(offset / grid);
367
+ isSnap.current = false;
368
+ }
369
+ deltaX.current = deltaX.current % distance;
370
+ const bounds = getBounds();
371
+ if (curLeft < bounds.left) curLeft = bounds.left;
372
+ else if (curLeft + preWidth > bounds.right) curLeft = bounds.right - preWidth;
373
+ if (onDrag) {
374
+ if (onDrag({
375
+ lastLeft: preLeft,
376
+ left: curLeft,
377
+ lastWidth: preWidth,
378
+ width: preWidth
379
+ }, scrollDelta) === false) return;
380
+ }
381
+ handleUpdateLeft(curLeft, false);
382
+ };
383
+ const handleMove = (e) => {
384
+ const target = e.target;
385
+ const preLeft = parseDatasetValue(target.dataset.left);
386
+ const preWidth = parseDatasetValue(target.dataset.width);
387
+ deltaX.current += e.dx;
388
+ if (autoScroll && parentRef?.current) {
389
+ const deltaScroll = (delta) => {
390
+ if (!parentRef?.current || !interactableRef.current) return;
391
+ parentRef.current.scrollLeft += delta;
392
+ const currentTarget = interactableRef.current;
393
+ move({
394
+ preLeft: parseDatasetValue(currentTarget.dataset.left),
395
+ preWidth: parseDatasetValue(currentTarget.dataset.width),
396
+ scrollDelta: delta
397
+ });
398
+ };
399
+ if (!dealDragAutoScroll(e, deltaScroll)) return;
400
+ }
401
+ move({
402
+ preLeft,
403
+ preWidth
404
+ });
405
+ };
406
+ const handleMoveStop = (e) => {
407
+ deltaX.current = 0;
408
+ isSnap.current = false;
409
+ stopAutoScroll();
410
+ const target = e.target;
411
+ onDragEnd?.({
412
+ left: parseDatasetValue(target.dataset.left),
413
+ width: parseDatasetValue(target.dataset.width)
414
+ });
415
+ };
416
+ const handleResizeStart = (e) => {
417
+ deltaX.current = 0;
418
+ isSnap.current = false;
419
+ initAutoScroll();
420
+ const dir = e.edges?.right ? "right" : "left";
421
+ onResizeStart?.(dir);
422
+ };
423
+ const resize = (param) => {
424
+ const { dir, preWidth, preLeft, scrollDelta } = param;
425
+ if (scrollDelta) deltaX.current += scrollDelta;
426
+ const distance = isSnap.current ? snapDistance : grid;
427
+ if (Math.abs(deltaX.current) < distance) return;
428
+ const bounds = getBounds();
429
+ if (dir === "left") {
430
+ let curLeft = preLeft + Math.trunc(deltaX.current / distance) * distance;
431
+ const { snap } = calculateSnap(curLeft, snapPositions, snapDistance);
432
+ if (snap !== curLeft) {
433
+ isSnap.current = true;
434
+ curLeft = snap;
435
+ } else {
436
+ const offset = curLeft - start;
437
+ if (offset % grid !== 0) curLeft = start + grid * Math.round(offset / grid);
438
+ isSnap.current = false;
439
+ }
440
+ deltaX.current = deltaX.current % distance;
441
+ if (curLeft < bounds.left) curLeft = bounds.left;
442
+ const tempRight = preLeft + preWidth;
443
+ const curWidth = tempRight - curLeft;
444
+ if (curLeft >= tempRight) return;
445
+ if (onResize) {
446
+ if (onResize("left", {
447
+ lastLeft: preLeft,
448
+ lastWidth: preWidth,
449
+ left: curLeft,
450
+ width: curWidth
451
+ }) === false) return;
452
+ }
453
+ handleUpdateLeft(curLeft, false);
454
+ handleUpdateWidth(curWidth, false);
455
+ } else {
456
+ let curWidth = preWidth + Math.trunc(deltaX.current / distance) * distance;
457
+ const rightEdge = preLeft + curWidth;
458
+ const { snap } = calculateSnap(rightEdge, snapPositions, snapDistance);
459
+ if (snap !== rightEdge) {
460
+ isSnap.current = true;
461
+ curWidth = snap - preLeft;
462
+ } else {
463
+ let tempRight = preLeft + curWidth;
464
+ const offset = tempRight - start;
465
+ if (offset % grid !== 0) {
466
+ tempRight = start + grid * Math.round(offset / grid);
467
+ curWidth = tempRight - preLeft;
468
+ }
469
+ isSnap.current = false;
470
+ }
471
+ deltaX.current = deltaX.current % distance;
472
+ if (preLeft + curWidth > bounds.right) curWidth = bounds.right - preLeft;
473
+ if (curWidth <= 0) return;
474
+ if (onResize) {
475
+ if (onResize("right", {
476
+ lastLeft: preLeft,
477
+ lastWidth: preWidth,
478
+ left: preLeft,
479
+ width: curWidth
480
+ }) === false) return;
481
+ }
482
+ handleUpdateWidth(curWidth, false);
483
+ }
484
+ };
485
+ const handleResize = (e) => {
486
+ const target = e.target;
487
+ const dir = e.edges?.left ? "left" : "right";
488
+ const preLeft = parseDatasetValue(target.dataset.left);
489
+ const preWidth = parseDatasetValue(target.dataset.width);
490
+ deltaX.current += dir === "left" ? e.deltaRect?.left || 0 : e.deltaRect?.right || 0;
491
+ if (autoScroll && parentRef?.current) {
492
+ const deltaScroll = (delta) => {
493
+ if (!parentRef?.current || !interactableRef.current) return;
494
+ parentRef.current.scrollLeft += delta;
495
+ const currentTarget = interactableRef.current;
496
+ resize({
497
+ preLeft: parseDatasetValue(currentTarget.dataset.left),
498
+ preWidth: parseDatasetValue(currentTarget.dataset.width),
499
+ dir,
500
+ scrollDelta: delta
501
+ });
502
+ };
503
+ if (!dealResizeAutoScroll(e, dir, deltaScroll)) return;
504
+ }
505
+ resize({
506
+ preLeft,
507
+ preWidth,
508
+ dir
509
+ });
510
+ };
511
+ const handleResizeStop = (e) => {
512
+ deltaX.current = 0;
513
+ isSnap.current = false;
514
+ stopAutoScroll();
515
+ const target = e.target;
516
+ const dir = e.edges?.right ? "right" : "left";
517
+ onResizeEnd?.(dir, {
518
+ left: parseDatasetValue(target.dataset.left),
519
+ width: parseDatasetValue(target.dataset.width)
520
+ });
521
+ };
522
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Interactable, {
523
+ "data-left": left || 0,
524
+ style: {
525
+ "--translate-x": `${left || 0}px`,
526
+ transform: `translateX(var(--translate-x)) scaleX(var(--scale-x,1))`,
527
+ width
528
+ },
529
+ ref: interactableRef,
530
+ draggable: enableDragging,
531
+ resizable: enableResizing,
532
+ draggableOptions: {
533
+ lockAxis: "x",
534
+ onmove: handleMove,
535
+ onstart: handleMoveStart,
536
+ onend: handleMoveStop,
537
+ cursorChecker: () => ""
538
+ },
539
+ resizableOptions: {
540
+ axis: "x",
541
+ invert: "none",
542
+ edges,
543
+ onmove: handleResize,
544
+ onstart: handleResizeStart,
545
+ onend: handleResizeStop
546
+ },
547
+ children
548
+ });
549
+ }
550
+ //#endregion
551
+ //#region src/utils/clsx.ts
552
+ function clsx() {
553
+ let i = 0, tmp, str = "", len = arguments.length;
554
+ for (; i < len; i++) if (tmp = arguments[i]) {
555
+ if (typeof tmp === "string") str += (str && " ") + tmp;
556
+ }
557
+ return str;
558
+ }
559
+ //#endregion
560
+ //#region src/components/edit_area/edit-action.tsx
561
+ const EditAction = ({ editorData, row, rowRenderHeight, action, effects, scale, scaleWidth, scaleSplitCount, startLeft, gridSnap, disableDrag, autoScroll, autoScrollSpeed, autoScrollMaxSpeed, scaleCount, maxScaleCount, setScaleCount, onActionMoveStart, onActionMoving, onActionMoveEnd, onActionResizeStart, onActionResizeEnd, onActionResizing, snapData, setEditorData, onClickAction, onClickActionOnly, onDoubleClickAction, onContextMenuAction, getActionRender, handleTime, scrollContainerRef }) => {
562
+ const rowRnd = (0, react.useRef)(null);
563
+ const isDragWhenClick = (0, react.useRef)(false);
564
+ const { id, maxEnd, minStart, end, start, selected, flexible = true, movable = true, effectId } = action;
565
+ const safeScale = scale ?? 1;
566
+ const safeScaleWidth = scaleWidth ?? 160;
567
+ const safeStartLeft = startLeft ?? 20;
568
+ const safeScaleSplitCount = scaleSplitCount ?? 10;
569
+ const safeMaxScaleCount = maxScaleCount ?? Number.MAX_SAFE_INTEGER;
570
+ const leftLimit = require_deal_data.parserTimeToPixel(minStart || 0, {
571
+ startLeft: safeStartLeft,
572
+ scale: safeScale,
573
+ scaleWidth: safeScaleWidth
574
+ });
575
+ const rightLimit = Math.min(safeMaxScaleCount * safeScaleWidth + safeStartLeft, require_deal_data.parserTimeToPixel(maxEnd || Number.MAX_VALUE, {
576
+ startLeft: safeStartLeft,
577
+ scale: safeScale,
578
+ scaleWidth: safeScaleWidth
579
+ }));
580
+ const baseTransform = (0, react.useMemo)(() => {
581
+ return require_deal_data.parserTimeToTransform({
582
+ start,
583
+ end
584
+ }, {
585
+ startLeft: safeStartLeft,
586
+ scale: safeScale,
587
+ scaleWidth: safeScaleWidth
588
+ });
589
+ }, [
590
+ end,
591
+ start,
592
+ safeStartLeft,
593
+ safeScaleWidth,
594
+ safeScale
595
+ ]);
596
+ const [dragTransform, setDragTransform] = (0, react.useState)(null);
597
+ const transform = dragTransform ?? baseTransform;
598
+ const gridSize = safeScaleWidth / safeScaleSplitCount;
599
+ const classNames = prefix(clsx("action", movable && "action-movable", selected && "action-selected", flexible && "action-flexible", effects[effectId] && `action-effect-${effectId}`));
600
+ /** Calculate scale count */
601
+ const handleScaleCount = (left, width) => {
602
+ const curScaleCount = require_deal_data.getScaleCountByPixel(left + width, {
603
+ startLeft: safeStartLeft,
604
+ scaleCount,
605
+ scaleWidth: safeScaleWidth
606
+ });
607
+ if (curScaleCount !== scaleCount) setScaleCount(curScaleCount);
608
+ };
609
+ const handleDragStart = () => {
610
+ onActionMoveStart && onActionMoveStart({
611
+ action,
612
+ row
613
+ });
614
+ };
615
+ const handleDrag = ({ left, width }) => {
616
+ isDragWhenClick.current = true;
617
+ if (onActionMoving) {
618
+ const { start, end } = require_deal_data.parserTransformToTime({
619
+ left,
620
+ width
621
+ }, {
622
+ scaleWidth: safeScaleWidth,
623
+ scale: safeScale,
624
+ startLeft: safeStartLeft
625
+ });
626
+ if (onActionMoving({
627
+ action,
628
+ row,
629
+ start,
630
+ end
631
+ }) === false) return false;
632
+ }
633
+ setDragTransform({
634
+ left,
635
+ width
636
+ });
637
+ handleScaleCount(left, width);
638
+ };
639
+ const handleDragEnd = ({ left, width }) => {
640
+ const { start, end } = require_deal_data.parserTransformToTime({
641
+ left,
642
+ width
643
+ }, {
644
+ scaleWidth: safeScaleWidth,
645
+ scale: safeScale,
646
+ startLeft: safeStartLeft
647
+ });
648
+ const rowItem = editorData.find((item) => item.id === row.id);
649
+ if (!rowItem) return;
650
+ const actionItem = rowItem.actions.find((item) => item.id === id);
651
+ if (!actionItem) return;
652
+ actionItem.start = start;
653
+ actionItem.end = end;
654
+ setEditorData([...editorData]);
655
+ if (onActionMoveEnd) onActionMoveEnd({
656
+ action: actionItem,
657
+ row,
658
+ start,
659
+ end
660
+ });
661
+ setDragTransform(null);
662
+ };
663
+ const handleResizeStart = (dir) => {
664
+ onActionResizeStart && onActionResizeStart({
665
+ action,
666
+ row,
667
+ dir
668
+ });
669
+ };
670
+ const handleResizing = (dir, { left, width }) => {
671
+ isDragWhenClick.current = true;
672
+ if (onActionResizing) {
673
+ const { start, end } = require_deal_data.parserTransformToTime({
674
+ left,
675
+ width
676
+ }, {
677
+ scaleWidth: safeScaleWidth,
678
+ scale: safeScale,
679
+ startLeft: safeStartLeft
680
+ });
681
+ if (onActionResizing({
682
+ action,
683
+ row,
684
+ start,
685
+ end,
686
+ dir
687
+ }) === false) return false;
688
+ }
689
+ setDragTransform({
690
+ left,
691
+ width
692
+ });
693
+ handleScaleCount(left, width);
694
+ };
695
+ const handleResizeEnd = (dir, { left, width }) => {
696
+ const { start, end } = require_deal_data.parserTransformToTime({
697
+ left,
698
+ width
699
+ }, {
700
+ scaleWidth: safeScaleWidth,
701
+ scale: safeScale,
702
+ startLeft: safeStartLeft
703
+ });
704
+ const rowItem = editorData.find((item) => item.id === row.id);
705
+ if (!rowItem) return;
706
+ const actionItem = rowItem.actions.find((item) => item.id === id);
707
+ if (!actionItem) return;
708
+ actionItem.start = start;
709
+ actionItem.end = end;
710
+ setEditorData([...editorData]);
711
+ if (onActionResizeEnd) onActionResizeEnd({
712
+ action: actionItem,
713
+ row,
714
+ start,
715
+ end,
716
+ dir
717
+ });
718
+ setDragTransform(null);
719
+ };
720
+ const nowAction = {
721
+ ...action,
722
+ ...require_deal_data.parserTransformToTime({
723
+ left: transform.left,
724
+ width: transform.width
725
+ }, {
726
+ startLeft: safeStartLeft,
727
+ scaleWidth: safeScaleWidth,
728
+ scale: safeScale
729
+ })
730
+ };
731
+ const nowRow = {
732
+ ...row,
733
+ actions: [...row.actions]
734
+ };
735
+ if (row.actions.includes(action)) nowRow.actions[row.actions.indexOf(action)] = nowAction;
736
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowDnd, {
737
+ ref: rowRnd,
738
+ parentRef: scrollContainerRef,
739
+ start: safeStartLeft,
740
+ left: transform.left,
741
+ width: transform.width,
742
+ grid: gridSnap && gridSize || 1,
743
+ snapDistance: gridSnap ? Math.max((gridSize || 1) / 2, 8) : 8,
744
+ snapPositions: snapData.assistPositions,
745
+ getBounds: () => {
746
+ return {
747
+ left: leftLimit,
748
+ right: rightLimit
749
+ };
750
+ },
751
+ edges: {
752
+ left: !disableDrag && flexible && `.${prefix("action-left-stretch")}`,
753
+ right: !disableDrag && flexible && `.${prefix("action-right-stretch")}`
754
+ },
755
+ enableDragging: !disableDrag && movable,
756
+ enableResizing: !disableDrag && flexible,
757
+ onDragStart: handleDragStart,
758
+ onDrag: handleDrag,
759
+ onDragEnd: handleDragEnd,
760
+ onResizeStart: handleResizeStart,
761
+ onResize: handleResizing,
762
+ onResizeEnd: handleResizeEnd,
763
+ autoScroll,
764
+ autoScrollSpeed,
765
+ autoScrollMaxSpeed,
766
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
767
+ onMouseDown: () => {
768
+ isDragWhenClick.current = false;
769
+ },
770
+ onClick: (e) => {
771
+ let time;
772
+ if (onClickAction) {
773
+ time = handleTime(e);
774
+ onClickAction(e, {
775
+ row,
776
+ action,
777
+ time
778
+ });
779
+ }
780
+ if (isDragWhenClick.current) {
781
+ e.stopPropagation();
782
+ return;
783
+ }
784
+ if (onClickActionOnly) {
785
+ if (time === void 0) time = handleTime(e);
786
+ onClickActionOnly(e, {
787
+ row,
788
+ action,
789
+ time
790
+ });
791
+ }
792
+ },
793
+ onDoubleClick: (e) => {
794
+ if (onDoubleClickAction) onDoubleClickAction(e, {
795
+ row,
796
+ action,
797
+ time: handleTime(e)
798
+ });
799
+ },
800
+ onContextMenu: (e) => {
801
+ if (onContextMenuAction) onContextMenuAction(e, {
802
+ row,
803
+ action,
804
+ time: handleTime(e)
805
+ });
806
+ },
807
+ className: classNames,
808
+ style: { height: rowRenderHeight },
809
+ children: [
810
+ getActionRender && getActionRender(nowAction, nowRow),
811
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
812
+ className: clsx(prefix("action-left-stretch")),
813
+ style: {
814
+ touchAction: "none",
815
+ visibility: flexible ? "visible" : "hidden",
816
+ pointerEvents: flexible ? "auto" : "none"
817
+ }
818
+ }),
819
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
820
+ className: prefix("action-right-stretch"),
821
+ style: {
822
+ touchAction: "none",
823
+ visibility: flexible ? "visible" : "hidden",
824
+ pointerEvents: flexible ? "auto" : "none"
825
+ }
826
+ })
827
+ ]
828
+ })
829
+ });
830
+ };
831
+ //#endregion
832
+ //#region src/components/edit_area/edit-row.tsx
833
+ const EditRow = (props) => {
834
+ const { rowData, rowRenderHeight, isCollapsed = false, style = {}, onClickRow, onPointerMoveRow, onDoubleClickRow, onContextMenuRow, scrollContainerRef, startLeft, scale, scaleWidth, unstable_rowActionsOverscan, getEmptyRowRender, getCollapsedRowLabelRender, getActionPreviewRender, actionPreview } = props;
835
+ const classNames = ["edit-row"];
836
+ if (rowData?.selected) classNames.push("edit-row-selected");
837
+ const safeScale = scale ?? 1;
838
+ const safeScaleWidth = scaleWidth ?? 160;
839
+ const safeStartLeft = startLeft ?? 20;
840
+ const handleTime = (e) => {
841
+ if (!scrollContainerRef.current) return 0;
842
+ const rect = e.currentTarget.getBoundingClientRect();
843
+ return require_deal_data.parserPixelToTime(e.clientX - rect.x, {
844
+ startLeft: safeStartLeft,
845
+ scale: safeScale,
846
+ scaleWidth: safeScaleWidth
847
+ });
848
+ };
849
+ const handleTimelineCursorPreviewPointerMove = (e) => {
850
+ if (!rowData) return;
851
+ const position = e.clientX - e.currentTarget.getBoundingClientRect().x;
852
+ const maxCount = props.maxScaleCount ?? Infinity;
853
+ const maxLeft = Number.isFinite(maxCount) ? maxCount * safeScaleWidth + safeStartLeft : e.currentTarget.offsetWidth;
854
+ if (position < safeStartLeft || position > maxLeft) {
855
+ props.onTimelineCursorPreviewPointerLeave?.();
856
+ return;
857
+ }
858
+ props.onTimelineCursorPreviewPointerMove?.({
859
+ surface: "edit-row",
860
+ row: rowData,
861
+ time: require_deal_data.parserPixelToTime(position, {
862
+ startLeft: safeStartLeft,
863
+ scale: safeScale,
864
+ scaleWidth: safeScaleWidth
865
+ })
866
+ });
867
+ };
868
+ const actions = (0, react.useMemo)(() => (rowData?.actions ? [...rowData.actions] : []).sort((a, b) => a.start - b.start), [rowData]);
869
+ const getItemKey = (0, react.useCallback)((index) => actions[index]?.id ?? index, [actions]);
870
+ const previewAction = rowData && actionPreview?.rowId === rowData.id ? actionPreview.action : null;
871
+ const previewTransform = previewAction ? require_deal_data.parserTimeToTransform({
872
+ start: previewAction.start,
873
+ end: previewAction.end
874
+ }, {
875
+ startLeft: safeStartLeft,
876
+ scale: safeScale,
877
+ scaleWidth: safeScaleWidth
878
+ }) : null;
879
+ const virtualizer = (0, _tanstack_react_virtual.useVirtualizer)({
880
+ horizontal: true,
881
+ count: actions.length,
882
+ getItemKey,
883
+ getScrollElement: () => scrollContainerRef.current,
884
+ estimateSize: (index) => {
885
+ if (!actions[index]) return 0;
886
+ let start = index > 0 ? actions[index - 1].end : 0;
887
+ let end = actions[index].end;
888
+ if (start > end) return 0;
889
+ let { width } = require_deal_data.parserTimeToTransform({
890
+ start,
891
+ end
892
+ }, {
893
+ startLeft: safeStartLeft,
894
+ scale: safeScale,
895
+ scaleWidth: safeScaleWidth
896
+ });
897
+ return width;
898
+ },
899
+ overscan: unstable_rowActionsOverscan ?? 5
900
+ });
901
+ (0, react.useEffect)(() => virtualizer.measure(), [
902
+ safeScale,
903
+ safeScaleWidth,
904
+ safeStartLeft,
905
+ virtualizer
906
+ ]);
907
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
908
+ className: `${prefix(...classNames)} ${(rowData?.classNames || []).join(" ")}`,
909
+ style,
910
+ onPointerEnter: props.onPointerEnter,
911
+ onPointerLeave: props.onPointerLeave,
912
+ onPointerMove: (e) => {
913
+ handleTimelineCursorPreviewPointerMove(e);
914
+ if (rowData && onPointerMoveRow) onPointerMoveRow(e, {
915
+ row: rowData,
916
+ time: handleTime(e)
917
+ });
918
+ },
919
+ onClick: (e) => {
920
+ if (rowData && onClickRow) onClickRow(e, {
921
+ row: rowData,
922
+ time: handleTime(e)
923
+ });
924
+ },
925
+ onDoubleClick: (e) => {
926
+ if (rowData && onDoubleClickRow) onDoubleClickRow(e, {
927
+ row: rowData,
928
+ time: handleTime(e)
929
+ });
930
+ },
931
+ onContextMenu: (e) => {
932
+ if (rowData && onContextMenuRow) onContextMenuRow(e, {
933
+ row: rowData,
934
+ time: handleTime(e)
935
+ });
936
+ },
937
+ children: [
938
+ rowData && isCollapsed && getCollapsedRowLabelRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
939
+ className: prefix("collapsed-row-label"),
940
+ "aria-hidden": "true",
941
+ children: getCollapsedRowLabelRender({
942
+ row: rowData,
943
+ height: rowRenderHeight
944
+ })
945
+ }),
946
+ rowData && actions.length === 0 && getEmptyRowRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
947
+ className: prefix("empty-row"),
948
+ children: getEmptyRowRender({
949
+ row: rowData,
950
+ height: rowRenderHeight
951
+ })
952
+ }),
953
+ rowData && previewAction && previewTransform && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
954
+ className: prefix("action-preview"),
955
+ style: {
956
+ height: rowRenderHeight,
957
+ transform: `translateX(${previewTransform.left}px)`,
958
+ width: previewTransform.width
959
+ },
960
+ "aria-hidden": "true",
961
+ children: getActionPreviewRender?.({
962
+ action: previewAction,
963
+ row: rowData,
964
+ height: rowRenderHeight
965
+ })
966
+ }),
967
+ rowData && virtualizer.getVirtualItems().map((virtualEntry) => {
968
+ const action = actions[virtualEntry.index];
969
+ if (!action) throw new Error("Action not found");
970
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditAction, {
971
+ ...props,
972
+ handleTime,
973
+ row: rowData,
974
+ rowRenderHeight,
975
+ action
976
+ }, action.id);
977
+ })
978
+ ]
979
+ });
980
+ };
981
+ //#endregion
982
+ //#region src/components/edit_area/hooks/use-snap.ts
983
+ const useSnap = (props) => {
984
+ const [snapData, setSnapData] = (0, react$1.useState)({
985
+ isMoving: false,
986
+ movePositions: [],
987
+ assistPositions: []
988
+ });
989
+ const activeDragStateRef = (0, react$1.useRef)(null);
990
+ const snapDataRef = (0, react$1.useEffectEvent)(() => ({
991
+ ...props,
992
+ snapData
993
+ }));
994
+ (0, react$1.useEffect)(() => {
995
+ const activeDragState = activeDragStateRef.current;
996
+ const currentProps = snapDataRef();
997
+ if (currentProps.snap && activeDragState && currentProps.snapData.isMoving && currentProps.snapPositions) {
998
+ const assistActionIds = activeDragState.assistActionIds;
999
+ const assistPositions = currentProps.snapPositions.filter((pos) => {
1000
+ if (pos.actionId === activeDragState.action.id) return false;
1001
+ if (assistActionIds && !assistActionIds.includes(pos.actionId)) return false;
1002
+ return true;
1003
+ }).map((pos) => pos.value);
1004
+ if (!currentProps.hideCursor) {
1005
+ const cursorLeft = require_deal_data.parserTimeToPixel(currentProps.cursorTime, {
1006
+ scaleWidth: currentProps.scaleWidth ?? 160,
1007
+ scale: currentProps.scale ?? 1,
1008
+ startLeft: currentProps.startLeft ?? 20
1009
+ });
1010
+ assistPositions.push(cursorLeft);
1011
+ }
1012
+ setSnapData((pre) => ({
1013
+ ...pre,
1014
+ assistPositions
1015
+ }));
1016
+ } else if (!currentProps.snap && currentProps.snapData.isMoving) setSnapData((pre) => ({
1017
+ ...pre,
1018
+ assistPositions: []
1019
+ }));
1020
+ }, [props.snap]);
1021
+ const handleInitSnap = (data) => {
1022
+ const assistActionIds = props.getAssistDragLineActionIds && props.getAssistDragLineActionIds({
1023
+ action: data.action,
1024
+ row: data.row,
1025
+ editorData: props.editorData
1026
+ });
1027
+ activeDragStateRef.current = {
1028
+ action: data.action,
1029
+ row: data.row,
1030
+ assistActionIds
1031
+ };
1032
+ if (props.snap && props.snapPositions) {
1033
+ const assistPositions = props.snapPositions.filter((pos) => {
1034
+ if (pos.actionId === data.action.id) return false;
1035
+ if (assistActionIds && !assistActionIds.includes(pos.actionId)) return false;
1036
+ return true;
1037
+ }).map((pos) => pos.value);
1038
+ if (!props.hideCursor) {
1039
+ const cursorLeft = require_deal_data.parserTimeToPixel(props.cursorTime, {
1040
+ scaleWidth: props.scaleWidth ?? 160,
1041
+ scale: props.scale ?? 1,
1042
+ startLeft: props.startLeft ?? 20
1043
+ });
1044
+ assistPositions.push(cursorLeft);
1045
+ }
1046
+ setSnapData({
1047
+ isMoving: true,
1048
+ movePositions: [],
1049
+ assistPositions
1050
+ });
1051
+ } else setSnapData({
1052
+ isMoving: true,
1053
+ movePositions: [],
1054
+ assistPositions: []
1055
+ });
1056
+ };
1057
+ const handleUpdateSnap = (data) => {
1058
+ if (props.snap) {
1059
+ const currentScaleWidth = props.scaleWidth ?? 160;
1060
+ const currentScale = props.scale ?? 1;
1061
+ const currentStartLeft = props.startLeft ?? 20;
1062
+ const { left, width } = require_deal_data.parserTimeToTransform({
1063
+ start: data.start,
1064
+ end: data.end
1065
+ }, {
1066
+ startLeft: currentStartLeft,
1067
+ scaleWidth: currentScaleWidth,
1068
+ scale: currentScale
1069
+ });
1070
+ const movePositions = data.dir ? data.dir === "right" ? [left + width] : [left] : [left, left + width];
1071
+ setSnapData((pre) => ({
1072
+ ...pre,
1073
+ movePositions
1074
+ }));
1075
+ }
1076
+ };
1077
+ const disposeSnap = () => {
1078
+ activeDragStateRef.current = null;
1079
+ setSnapData({
1080
+ isMoving: false,
1081
+ movePositions: [],
1082
+ assistPositions: []
1083
+ });
1084
+ };
1085
+ return {
1086
+ snapData,
1087
+ handleInitSnap,
1088
+ handleUpdateSnap,
1089
+ disposeSnap
1090
+ };
1091
+ };
1092
+ //#endregion
1093
+ //#region src/utils/row-layout.ts
1094
+ function getTimelineRowPresentation(params) {
1095
+ const layouts = [];
1096
+ let totalHeight = 0;
1097
+ const collapsibleRowIds = new Set(params.editorData.filter((row) => row.collapsed).map((row) => row.id));
1098
+ const defaultExpandedRowIds = params.editorData.filter((row) => row.collapsed?.expandedByDefault).map((row) => row.id);
1099
+ const focusedRowId = (params.lockedRowId && collapsibleRowIds.has(params.lockedRowId) ? params.lockedRowId : null) ?? (params.hoveredRowId && collapsibleRowIds.has(params.hoveredRowId) ? params.hoveredRowId : null) ?? defaultExpandedRowIds[0] ?? null;
1100
+ for (const row of params.editorData) {
1101
+ const expandedHeight = row.rowHeight || params.rowHeight;
1102
+ const collapsedHeight = row.collapsed?.height ?? params.collapsedRowHeight;
1103
+ const isCollapsed = Boolean(row.collapsed && row.id !== focusedRowId);
1104
+ const height = isCollapsed ? collapsedHeight : expandedHeight;
1105
+ layouts.push({
1106
+ row,
1107
+ top: totalHeight,
1108
+ height,
1109
+ isCollapsed
1110
+ });
1111
+ totalHeight += height;
1112
+ }
1113
+ return {
1114
+ layouts,
1115
+ totalHeight,
1116
+ defaultExpandedRowIds
1117
+ };
1118
+ }
1119
+ //#endregion
1120
+ //#region src/components/edit_area/edit-area.tsx
1121
+ const EditArea = ({ ref, ...props }) => {
1122
+ const { snapData, handleInitSnap, handleUpdateSnap, disposeSnap } = useSnap({
1123
+ snap: props.snap,
1124
+ hideCursor: props.hideCursor,
1125
+ cursorTime: props.cursorTime,
1126
+ scaleWidth: props.scaleWidth,
1127
+ scale: props.scale,
1128
+ startLeft: props.startLeft,
1129
+ getAssistDragLineActionIds: props.getAssistDragLineActionIds,
1130
+ editorData: props.editorData,
1131
+ snapPositions: props.snapPositions
1132
+ });
1133
+ const currentScaleWidth = props.scaleWidth ?? 160;
1134
+ const currentStartLeft = props.startLeft ?? 20;
1135
+ const contentWidth = Math.max(props.scaleCount * currentScaleWidth + currentStartLeft, props.timelineWidth);
1136
+ const rows = (() => {
1137
+ let result = [];
1138
+ for (const { row, top, height, isCollapsed } of props.rowLayouts) result.push(/* @__PURE__ */ (0, react.createElement)(EditRow, {
1139
+ ...props,
1140
+ key: row.id,
1141
+ rowData: row,
1142
+ rowRenderHeight: height,
1143
+ isCollapsed,
1144
+ snapData,
1145
+ scrollContainerRef: props.scrollElementRef,
1146
+ style: {
1147
+ position: "absolute",
1148
+ top: 0,
1149
+ left: 0,
1150
+ width: contentWidth,
1151
+ height: `${height}px`,
1152
+ transform: `translateY(${top}px)`
1153
+ },
1154
+ onPointerEnter: () => {
1155
+ if (row.collapsed) props.setHoveredRowId(row.id);
1156
+ },
1157
+ onPointerLeave: () => {
1158
+ props.clearHoveredRowId(row.id);
1159
+ props.onTimelineCursorPreviewPointerLeave?.();
1160
+ },
1161
+ onTimelineCursorPreviewPointerMove: props.onTimelineCursorPreviewPointerMove,
1162
+ onTimelineCursorPreviewPointerLeave: props.onTimelineCursorPreviewPointerLeave,
1163
+ onActionMoveStart: (data) => {
1164
+ if (row.collapsed) props.setLockedRowId(row.id);
1165
+ handleInitSnap(data);
1166
+ return props.onActionMoveStart && props.onActionMoveStart(data);
1167
+ },
1168
+ onActionResizeStart: (data) => {
1169
+ if (row.collapsed) props.setLockedRowId(row.id);
1170
+ handleInitSnap(data);
1171
+ return props.onActionResizeStart && props.onActionResizeStart(data);
1172
+ },
1173
+ onActionMoving: (data) => {
1174
+ handleUpdateSnap(data);
1175
+ return props.onActionMoving && props.onActionMoving(data);
1176
+ },
1177
+ onActionResizing: (data) => {
1178
+ handleUpdateSnap(data);
1179
+ return props.onActionResizing && props.onActionResizing(data);
1180
+ },
1181
+ onActionResizeEnd: (data) => {
1182
+ props.setLockedRowId(null);
1183
+ disposeSnap();
1184
+ return props.onActionResizeEnd && props.onActionResizeEnd(data);
1185
+ },
1186
+ onActionMoveEnd: (data) => {
1187
+ props.setLockedRowId(null);
1188
+ disposeSnap();
1189
+ return props.onActionMoveEnd && props.onActionMoveEnd(data);
1190
+ }
1191
+ }));
1192
+ return result;
1193
+ })();
1194
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1195
+ ref,
1196
+ style: {
1197
+ width: contentWidth,
1198
+ height: props.rowLayoutsTotalHeight,
1199
+ position: "relative",
1200
+ backgroundPositionX: `0, ${props.startLeft ?? 20}px`,
1201
+ backgroundSize: `${props.startLeft ?? 20}px, ${props.scaleWidth ?? 160}px`
1202
+ },
1203
+ className: "timeline-editor-edit-area",
1204
+ children: [rows, props.snap && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SnapGuideLines, { ...snapData })]
1205
+ });
1206
+ };
1207
+ //#endregion
1208
+ //#region src/components/time_area/time-area.tsx
1209
+ function TimeArea({ scaleSplitCount, scaleWidth, startLeft, scaleCount, maxScaleCount, scale, scrollElementRef, onClickTimeArea, setCursor, getScaleRender, onTimelineCursorPreviewPointerMove, onTimelineCursorPreviewPointerLeave }) {
1210
+ const splitCount = scaleSplitCount ?? 1;
1211
+ const width = scaleWidth ?? 160;
1212
+ const left = startLeft ?? 20;
1213
+ /** Whether to show sub-scale marks */
1214
+ const showUnit = (scaleSplitCount ?? 0) > 0;
1215
+ const columnCount = showUnit ? scaleCount * (scaleSplitCount ?? 1) + 1 : scaleCount;
1216
+ const totalWidth = (showUnit ? width / splitCount : width) * (columnCount - 1) + left;
1217
+ const getTimeFromPointerX = (currentTarget, clientX) => {
1218
+ const leftStart = startLeft ?? 20;
1219
+ const widthValue = scaleWidth ?? 160;
1220
+ const scaleValue = scale ?? 1;
1221
+ const maxCount = maxScaleCount ?? Infinity;
1222
+ const position = clientX - currentTarget.getBoundingClientRect().x;
1223
+ const maxLeft = Number.isFinite(maxCount) ? maxCount * widthValue + leftStart : totalWidth;
1224
+ if (position < leftStart || position > maxLeft) return null;
1225
+ return require_deal_data.parserPixelToTime(position, {
1226
+ startLeft: leftStart,
1227
+ scale: scaleValue,
1228
+ scaleWidth: widthValue
1229
+ });
1230
+ };
1231
+ const getColumnWidth = (index) => {
1232
+ switch (index) {
1233
+ case 0: return left;
1234
+ default: return showUnit ? width / splitCount : width;
1235
+ }
1236
+ };
1237
+ const virtualizer = (0, _tanstack_react_virtual.useVirtualizer)({
1238
+ horizontal: true,
1239
+ count: columnCount,
1240
+ getScrollElement: () => scrollElementRef.current,
1241
+ estimateSize: getColumnWidth,
1242
+ overscan: 10
1243
+ });
1244
+ (0, react.useEffect)(() => virtualizer.measure(), [
1245
+ scale,
1246
+ scaleWidth,
1247
+ startLeft,
1248
+ virtualizer
1249
+ ]);
1250
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1251
+ style: { width: `${totalWidth}px` },
1252
+ className: prefix("time-area"),
1253
+ onPointerMove: (e) => {
1254
+ const time = getTimeFromPointerX(e.currentTarget, e.clientX);
1255
+ if (time === null) {
1256
+ onTimelineCursorPreviewPointerLeave?.();
1257
+ return;
1258
+ }
1259
+ onTimelineCursorPreviewPointerMove?.({
1260
+ surface: "time-area",
1261
+ time
1262
+ });
1263
+ },
1264
+ onPointerLeave: () => {
1265
+ onTimelineCursorPreviewPointerLeave?.();
1266
+ },
1267
+ onClick: (e) => {
1268
+ const leftStart = startLeft ?? 20;
1269
+ const widthValue = scaleWidth ?? 160;
1270
+ const scaleValue = scale ?? 1;
1271
+ const maxCount = maxScaleCount ?? Infinity;
1272
+ const rect = e.currentTarget.getBoundingClientRect();
1273
+ const position = e.clientX - rect.x;
1274
+ const left = Math.max(position, leftStart);
1275
+ if (left > maxCount * widthValue + leftStart) return;
1276
+ const time = require_deal_data.parserPixelToTime(left, {
1277
+ startLeft: leftStart,
1278
+ scale: scaleValue,
1279
+ scaleWidth: widthValue
1280
+ });
1281
+ onClickTimeArea && onClickTimeArea(time, e);
1282
+ if (e.defaultPrevented) return;
1283
+ setCursor({ time });
1284
+ },
1285
+ children: virtualizer.getVirtualItems().map((virtualColumn) => {
1286
+ const columnIndex = virtualColumn.index;
1287
+ const splitCount = scaleSplitCount ?? 1;
1288
+ const scaleValue = scale ?? 1;
1289
+ const isShowScale = showUnit ? columnIndex % splitCount === 0 : true;
1290
+ const classNames = [prefix("time-unit"), isShowScale ? prefix("time-unit-big") : prefix("time-unit-small")];
1291
+ const item = (showUnit ? columnIndex / splitCount : columnIndex) * scaleValue;
1292
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1293
+ "data-index": virtualColumn.index,
1294
+ style: {
1295
+ width: `${virtualColumn.size}px`,
1296
+ transform: `translateX(${virtualColumn.start}px)`
1297
+ },
1298
+ className: classNames.join(" "),
1299
+ children: isShowScale && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1300
+ className: prefix("time-unit-scale"),
1301
+ children: getScaleRender?.(item) ?? item
1302
+ })
1303
+ }, virtualColumn.key);
1304
+ })
1305
+ });
1306
+ }
1307
+ //#endregion
1308
+ //#region src/utils/with-hook.tsx
1309
+ function withHooks(hook) {
1310
+ const Component = ({ children, ...params }) => {
1311
+ return children(hook(params));
1312
+ };
1313
+ Component.displayName = `withHooks(${hook.name || "Hook"})`;
1314
+ return Component;
1315
+ }
1316
+ //#endregion
1317
+ //#region src/utils/measured.tsx
1318
+ function useMeasure({ elementRef }) {
1319
+ const [size, setSize] = (0, react.useState)({
1320
+ width: 0,
1321
+ height: 0
1322
+ });
1323
+ (0, react.useLayoutEffect)(() => {
1324
+ if (!elementRef.current) return;
1325
+ (0, motion.resize)(elementRef.current, (_el, size) => {
1326
+ setSize({
1327
+ width: size.width,
1328
+ height: size.height
1329
+ });
1330
+ });
1331
+ }, [elementRef]);
1332
+ return size;
1333
+ }
1334
+ withHooks(useMeasure);
1335
+ //#endregion
1336
+ //#region src/components/cursor/cursor.tsx
1337
+ const Cursor = ({ disableDrag, height, cursorTime, setCursor, startLeft, scaleWidth, scale, scaleCount, scaleSplitCount, scrollElementRef, maxScaleCount, onCursorDragStart, onCursorDrag, onCursorDragEnd, cursorSnap, autoScrollSpeed, autoScrollMaxSpeed, snapPositions = [] }) => {
1338
+ const rowRnd = (0, react.useRef)(null);
1339
+ const leftStart = startLeft ?? 20;
1340
+ const width = scaleWidth ?? 160;
1341
+ const scaleValue = scale ?? 1;
1342
+ const activeSnapPositions = !cursorSnap ? [] : snapPositions;
1343
+ (0, react.useEffect)(() => {
1344
+ if (rowRnd.current) {
1345
+ const left = startLeft ?? 20;
1346
+ const width = scaleWidth ?? 160;
1347
+ const scaleValue = scale ?? 1;
1348
+ rowRnd.current.updateLeft(require_deal_data.parserTimeToPixel(cursorTime, {
1349
+ startLeft: left,
1350
+ scaleWidth: width,
1351
+ scale: scaleValue
1352
+ }));
1353
+ }
1354
+ }, [
1355
+ cursorTime,
1356
+ startLeft,
1357
+ scaleWidth,
1358
+ scale
1359
+ ]);
1360
+ const maxCount = maxScaleCount ?? Infinity;
1361
+ const showUnit = (scaleSplitCount ?? 0) > 0;
1362
+ const splitCount = scaleSplitCount ?? 1;
1363
+ const columnCount = showUnit ? scaleCount * (scaleSplitCount ?? 1) + 1 : scaleCount;
1364
+ const left = startLeft ?? 20;
1365
+ const totalWidth = (showUnit ? width / splitCount : width) * (columnCount - 1) + left;
1366
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowDnd, {
1367
+ start: leftStart,
1368
+ ref: rowRnd,
1369
+ parentRef: scrollElementRef,
1370
+ getBounds: () => {
1371
+ return {
1372
+ left: 0,
1373
+ right: Math.min(totalWidth, maxCount * width + leftStart - (scrollElementRef.current?.scrollLeft ?? 0))
1374
+ };
1375
+ },
1376
+ autoScroll: true,
1377
+ autoScrollSpeed,
1378
+ autoScrollMaxSpeed,
1379
+ enableDragging: !disableDrag,
1380
+ enableResizing: false,
1381
+ snapPositions: activeSnapPositions,
1382
+ snapDistance: 8,
1383
+ snapOrigin: "left",
1384
+ onDragStart: () => {
1385
+ const time = require_deal_data.parserPixelToTime(rowRnd.current?.getLeft() ?? require_deal_data.parserTimeToPixel(cursorTime, {
1386
+ startLeft: leftStart,
1387
+ scaleWidth: width,
1388
+ scale: scaleValue
1389
+ }), {
1390
+ startLeft: leftStart,
1391
+ scale: scaleValue,
1392
+ scaleWidth: width
1393
+ });
1394
+ onCursorDragStart && onCursorDragStart(time);
1395
+ },
1396
+ onDragEnd: ({ left }) => {
1397
+ const time = require_deal_data.parserPixelToTime(left, {
1398
+ startLeft: leftStart,
1399
+ scale: scaleValue,
1400
+ scaleWidth: width
1401
+ });
1402
+ setCursor({ time });
1403
+ onCursorDragEnd && onCursorDragEnd(time);
1404
+ },
1405
+ onDrag: ({ left }) => {
1406
+ const time = require_deal_data.parserPixelToTime(left, {
1407
+ startLeft: leftStart,
1408
+ scale: scaleValue,
1409
+ scaleWidth: width
1410
+ });
1411
+ setCursor({ time });
1412
+ onCursorDrag && onCursorDrag(time);
1413
+ },
1414
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1415
+ className: prefix("cursor"),
1416
+ style: { height },
1417
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
1418
+ className: prefix("cursor-top"),
1419
+ width: "8",
1420
+ height: "12",
1421
+ viewBox: "0 0 8 12",
1422
+ fill: "none",
1423
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
1424
+ 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",
1425
+ fill: "currentColor"
1426
+ })
1427
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: prefix("cursor-area") })]
1428
+ })
1429
+ });
1430
+ };
1431
+ //#endregion
1432
+ //#region src/components/cursor/timeline-cursor-preview.tsx
1433
+ const HIDDEN_DISTANCE = 2;
1434
+ const VISIBLE_DISTANCE = 16;
1435
+ const MAX_OPACITY = 1;
1436
+ const TimelineCursorPreview = ({ cursorTime, height, preview, startLeft, scaleWidth, scale, getTimelineCursorPreviewHeadRender }) => {
1437
+ const transformOptions = {
1438
+ startLeft: startLeft ?? 20,
1439
+ scaleWidth: scaleWidth ?? 160,
1440
+ scale: scale ?? 1
1441
+ };
1442
+ const previewLeft = require_deal_data.parserTimeToPixel(preview.time, transformOptions);
1443
+ const cursorLeft = require_deal_data.parserTimeToPixel(cursorTime, transformOptions);
1444
+ const distance = Math.abs(previewLeft - cursorLeft);
1445
+ const opacity = distance <= HIDDEN_DISTANCE ? 0 : Math.min(MAX_OPACITY, (distance - HIDDEN_DISTANCE) / (VISIBLE_DISTANCE - HIDDEN_DISTANCE) * MAX_OPACITY);
1446
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1447
+ className: prefix("cursor-preview"),
1448
+ style: {
1449
+ height,
1450
+ opacity,
1451
+ transform: `translateX(${previewLeft}px) scaleX(0.5)`
1452
+ },
1453
+ "aria-hidden": "true",
1454
+ children: [getTimelineCursorPreviewHeadRender ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1455
+ className: prefix("cursor-preview-head"),
1456
+ children: getTimelineCursorPreviewHeadRender(preview)
1457
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
1458
+ className: prefix("cursor-top"),
1459
+ width: "8",
1460
+ height: "12",
1461
+ viewBox: "0 0 8 12",
1462
+ fill: "none",
1463
+ "aria-hidden": "true",
1464
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
1465
+ 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",
1466
+ fill: "currentColor"
1467
+ })
1468
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: prefix("cursor-area") })]
1469
+ });
1470
+ };
1471
+ //#endregion
1472
+ //#region src/components/scroll-area.tsx
1473
+ function ScrollBar({ className, orientation = "vertical", ...props }) {
1474
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.ScrollArea.ScrollAreaScrollbar, {
1475
+ "data-slot": "scroll-area-scrollbar",
1476
+ orientation,
1477
+ className,
1478
+ ...props,
1479
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.ScrollArea.ScrollAreaThumb, { "data-slot": "scroll-area-thumb" })
1480
+ });
1481
+ }
1482
+ //#endregion
1483
+ //#region src/components/hooks/use-stable-scroll.ts
1484
+ /**
1485
+ * Hook to maintain scroll position stability when scale or scaleWidth changes.
1486
+ * Uses the cursor time as a reference point to keep it visually stable.
1487
+ */
1488
+ function useStableScroll({ scrollElementRef, scale, scaleWidth, startLeft, cursorTimeRef }) {
1489
+ const prevScaleRef = (0, react$1.useRef)(null);
1490
+ const prevScaleWidthRef = (0, react$1.useRef)(null);
1491
+ (0, react$1.useLayoutEffect)(() => {
1492
+ const scrollElement = scrollElementRef.current;
1493
+ if (prevScaleRef.current !== null && prevScaleWidthRef.current !== null && scrollElement && (prevScaleRef.current !== scale || prevScaleWidthRef.current !== scaleWidth)) {
1494
+ const currentScrollLeft = scrollElement.scrollLeft;
1495
+ const cursorTime = cursorTimeRef.current;
1496
+ const oldCursorPixelPosition = require_deal_data.parserTimeToPixel(cursorTime, {
1497
+ startLeft,
1498
+ scale: prevScaleRef.current,
1499
+ scaleWidth: prevScaleWidthRef.current
1500
+ });
1501
+ scrollElement.scrollLeft = require_deal_data.parserTimeToPixel(cursorTime, {
1502
+ startLeft,
1503
+ scale,
1504
+ scaleWidth
1505
+ }) - (oldCursorPixelPosition - currentScrollLeft);
1506
+ }
1507
+ prevScaleRef.current = scale;
1508
+ prevScaleWidthRef.current = scaleWidth;
1509
+ }, [
1510
+ scale,
1511
+ scaleWidth,
1512
+ startLeft,
1513
+ scrollElementRef,
1514
+ cursorTimeRef
1515
+ ]);
1516
+ }
1517
+ //#endregion
1518
+ //#region src/components/timeline.tsx
1519
+ function Timeline({ ref, ...props }) {
1520
+ const timelineProps = withDefaults(props);
1521
+ const domRef = (0, react.useRef)(null);
1522
+ const warnedDefaultRowsRef = (0, react.useRef)("");
1523
+ const warnedMissingActionPreviewRowRef = (0, react.useRef)("");
1524
+ const { width, height } = useMeasure({ elementRef: domRef });
1525
+ const [hoveredRowId, setHoveredRowId] = (0, react.useState)(null);
1526
+ const [lockedRowId, setLockedRowId] = (0, react.useState)(null);
1527
+ const [timelineCursorPreview, setTimelineCursorPreview] = (0, react.useState)(null);
1528
+ const [isCursorDragging, setIsCursorDragging] = (0, react.useState)(false);
1529
+ const editorAreaKey = props.unstable_forceRemountEditorArea ?? 0;
1530
+ const minScaleCount = timelineProps.minScaleCount ?? Math.max(require_deal_data.getScaleCountByRows(timelineProps.editorData, {
1531
+ scale: timelineProps.scale,
1532
+ pad: .1
1533
+ }), Math.ceil((width - timelineProps.startLeft) / timelineProps.scaleWidth));
1534
+ const derivedScaleCount = Math.min(timelineProps.maxScaleCount, minScaleCount);
1535
+ const snapPositions = !timelineProps.editorData ? [] : require_deal_data.parserActionsToPositions(timelineProps.editorData.flatMap((row) => row.actions), {
1536
+ startLeft: timelineProps.startLeft,
1537
+ scale: timelineProps.scale,
1538
+ scaleWidth: timelineProps.scaleWidth
1539
+ });
1540
+ const [overrideScaleCount, setOverrideScaleCount] = (0, react.useState)(null);
1541
+ (0, react.useLayoutEffect)(() => {
1542
+ setOverrideScaleCount(null);
1543
+ }, [derivedScaleCount]);
1544
+ const scaleCount = overrideScaleCount ?? derivedScaleCount;
1545
+ const rowPresentation = getTimelineRowPresentation({
1546
+ editorData: timelineProps.editorData,
1547
+ rowHeight: timelineProps.rowHeight,
1548
+ collapsedRowHeight: timelineProps.collapsedRowHeight ?? timelineProps.rowHeight,
1549
+ hoveredRowId,
1550
+ lockedRowId
1551
+ });
1552
+ const duplicateDefaultRowsKey = rowPresentation.defaultExpandedRowIds.join("\n");
1553
+ if (rowPresentation.defaultExpandedRowIds.length > 1 && warnedDefaultRowsRef.current !== duplicateDefaultRowsKey) {
1554
+ warnedDefaultRowsRef.current = duplicateDefaultRowsKey;
1555
+ console.warn("Warning: multiple collapsible rows set expandedByDefault. The first row in editorData wins.");
1556
+ }
1557
+ if (timelineProps.actionPreview && !timelineProps.editorData.some((row) => row.id === timelineProps.actionPreview?.rowId) && warnedMissingActionPreviewRowRef.current !== timelineProps.actionPreview.rowId) {
1558
+ warnedMissingActionPreviewRowRef.current = timelineProps.actionPreview.rowId;
1559
+ console.warn(`Warning: actionPreview rowId "${timelineProps.actionPreview.rowId}" does not match any timeline row.`);
1560
+ }
1561
+ /** Dynamically set scale count - overrides the derived value */
1562
+ const handleSetScaleCount = (value) => {
1563
+ setOverrideScaleCount(Math.min(timelineProps.maxScaleCount, value));
1564
+ };
1565
+ const [cursorTime, setCursorTime] = (0, react.useState)(0);
1566
+ const cursorTimeRef = (0, react.useRef)(0);
1567
+ useStableScroll({
1568
+ scrollElementRef: domRef,
1569
+ scale: timelineProps.scale,
1570
+ scaleWidth: timelineProps.scaleWidth,
1571
+ startLeft: timelineProps.startLeft,
1572
+ cursorTimeRef
1573
+ });
1574
+ /** Handle editor data changes */
1575
+ const handleEditorDataChange = (editorData) => {
1576
+ timelineProps.onChange?.(editorData);
1577
+ };
1578
+ /** Handle cursor */
1579
+ const handleSetCursor = (param) => {
1580
+ let { left, time } = param;
1581
+ if (typeof time !== "undefined") {
1582
+ setCursorTime(time);
1583
+ cursorTimeRef.current = time;
1584
+ return true;
1585
+ }
1586
+ if (typeof left !== "undefined") {
1587
+ setCursorTime(cursorTimeRef.current = require_deal_data.parserPixelToTime(left, {
1588
+ startLeft: timelineProps.startLeft,
1589
+ scale: timelineProps.scale,
1590
+ scaleWidth: timelineProps.scaleWidth
1591
+ }));
1592
+ return true;
1593
+ }
1594
+ return false;
1595
+ };
1596
+ const handleTimelineCursorPreviewPointerMove = (0, react.useCallback)((preview) => {
1597
+ setTimelineCursorPreview(preview);
1598
+ }, []);
1599
+ const handleTimelineCursorPreviewPointerLeave = (0, react.useCallback)(() => {
1600
+ setTimelineCursorPreview(null);
1601
+ }, []);
1602
+ const timelineCursorHeight = Math.max(height, rowPresentation.totalHeight + 42);
1603
+ const showTimelineCursorPreview = timelineProps.showTimelineCursorPreview !== false && (timelineProps.showTimelineCursorPreview === true || Boolean(timelineProps.getTimelineCursorPreviewHeadRender));
1604
+ const handleScrollToTime = (time, options = {}) => {
1605
+ const element = domRef.current;
1606
+ if (!element) return;
1607
+ const { block = "start", offset = 0, onlyIfNotVisible = false } = options;
1608
+ const target = require_deal_data.parserTimeToPixel(time, {
1609
+ startLeft: timelineProps.startLeft,
1610
+ scale: timelineProps.scale,
1611
+ scaleWidth: timelineProps.scaleWidth
1612
+ });
1613
+ const viewportWidth = element.clientWidth;
1614
+ if (onlyIfNotVisible) {
1615
+ const currentScrollLeft = element.scrollLeft;
1616
+ if (target >= currentScrollLeft && target <= currentScrollLeft + viewportWidth) return;
1617
+ }
1618
+ let targetScrollLeft;
1619
+ if (block === "end") targetScrollLeft = target - viewportWidth + offset;
1620
+ else if (block === "center") targetScrollLeft = target - viewportWidth / 2;
1621
+ else targetScrollLeft = target - offset;
1622
+ const maxScrollLeft = Math.max(0, element.scrollWidth - viewportWidth);
1623
+ element.scrollTo({
1624
+ left: Math.min(Math.max(targetScrollLeft, 0), maxScrollLeft),
1625
+ behavior: options.behavior ?? "instant"
1626
+ });
1627
+ };
1628
+ (0, react.useImperativeHandle)(ref, () => ({
1629
+ get target() {
1630
+ return domRef.current;
1631
+ },
1632
+ set time(time) {
1633
+ handleSetCursor({ time });
1634
+ },
1635
+ get time() {
1636
+ return cursorTimeRef.current;
1637
+ },
1638
+ getTime() {
1639
+ return cursorTimeRef.current;
1640
+ },
1641
+ setTime(time) {
1642
+ handleSetCursor({ time });
1643
+ },
1644
+ getTimePixelPosition(time) {
1645
+ return require_deal_data.parserTimeToPixel(time ?? cursorTimeRef.current, {
1646
+ startLeft: timelineProps.startLeft,
1647
+ scale: timelineProps.scale,
1648
+ scaleWidth: timelineProps.scaleWidth
1649
+ });
1650
+ },
1651
+ setScrollLeft: (val) => {
1652
+ if (!domRef.current) return;
1653
+ domRef.current.scrollLeft = val;
1654
+ },
1655
+ setScrollTop: (val) => {
1656
+ if (!domRef.current) return;
1657
+ domRef.current.scrollTop = val;
1658
+ },
1659
+ get scrollLeft() {
1660
+ if (!domRef.current) return 0;
1661
+ return domRef.current.scrollLeft;
1662
+ },
1663
+ get scrollTop() {
1664
+ if (!domRef.current) return 0;
1665
+ return domRef.current.scrollTop;
1666
+ },
1667
+ set scrollLeft(val) {
1668
+ if (!domRef.current) return;
1669
+ domRef.current.scrollLeft = val;
1670
+ },
1671
+ set scrollTop(val) {
1672
+ if (!domRef.current) return;
1673
+ domRef.current.scrollTop = val;
1674
+ },
1675
+ scrollToTime: handleScrollToTime
1676
+ }));
1677
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(radix_ui.ScrollArea.Root, {
1678
+ style: timelineProps.style,
1679
+ className: `${require_deal_data.PREFIX} ${timelineProps.disableDrag ? require_deal_data.PREFIX + "-disable" : ""}`,
1680
+ "data-slot": "scroll-area",
1681
+ children: [
1682
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(radix_ui.ScrollArea.Viewport, {
1683
+ "data-slot": "scroll-area-viewport",
1684
+ ref: domRef,
1685
+ onScroll: (e) => {
1686
+ timelineProps.onScroll?.(e.currentTarget);
1687
+ },
1688
+ children: [
1689
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeArea, {
1690
+ ...timelineProps,
1691
+ setCursor: handleSetCursor,
1692
+ scaleCount,
1693
+ scrollElementRef: domRef,
1694
+ onTimelineCursorPreviewPointerMove: showTimelineCursorPreview ? handleTimelineCursorPreviewPointerMove : void 0,
1695
+ onTimelineCursorPreviewPointerLeave: showTimelineCursorPreview ? handleTimelineCursorPreviewPointerLeave : void 0
1696
+ }),
1697
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditArea, {
1698
+ ...timelineProps,
1699
+ scrollElementRef: domRef,
1700
+ timelineWidth: width,
1701
+ timelineHeight: height,
1702
+ disableDrag: timelineProps.disableDrag,
1703
+ editorData: timelineProps.editorData,
1704
+ cursorTime,
1705
+ scaleCount,
1706
+ setScaleCount: handleSetScaleCount,
1707
+ setEditorData: handleEditorDataChange,
1708
+ snapPositions,
1709
+ rowLayouts: rowPresentation.layouts,
1710
+ rowLayoutsTotalHeight: rowPresentation.totalHeight,
1711
+ setHoveredRowId,
1712
+ clearHoveredRowId: (rowId) => {
1713
+ setHoveredRowId((currentRowId) => currentRowId === rowId ? null : currentRowId);
1714
+ },
1715
+ setLockedRowId,
1716
+ onTimelineCursorPreviewPointerMove: showTimelineCursorPreview ? handleTimelineCursorPreviewPointerMove : void 0,
1717
+ onTimelineCursorPreviewPointerLeave: showTimelineCursorPreview ? handleTimelineCursorPreviewPointerLeave : void 0
1718
+ }, `__editor_area_${editorAreaKey}__`),
1719
+ showTimelineCursorPreview && timelineCursorPreview && !isCursorDragging && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimelineCursorPreview, {
1720
+ cursorTime,
1721
+ height: timelineCursorHeight,
1722
+ preview: timelineCursorPreview,
1723
+ startLeft: timelineProps.startLeft,
1724
+ scaleWidth: timelineProps.scaleWidth,
1725
+ scale: timelineProps.scale,
1726
+ getTimelineCursorPreviewHeadRender: timelineProps.getTimelineCursorPreviewHeadRender
1727
+ }),
1728
+ !timelineProps.hideCursor && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Cursor, {
1729
+ ...timelineProps,
1730
+ timelineWidth: width,
1731
+ height: timelineCursorHeight,
1732
+ scaleCount,
1733
+ setScaleCount: handleSetScaleCount,
1734
+ setCursor: handleSetCursor,
1735
+ cursorTime,
1736
+ editorData: timelineProps.editorData,
1737
+ scrollElementRef: domRef,
1738
+ snapPositions,
1739
+ onCursorDragStart: (time) => {
1740
+ setIsCursorDragging(true);
1741
+ timelineProps.onCursorDragStart?.(time);
1742
+ },
1743
+ onCursorDragEnd: (time) => {
1744
+ setIsCursorDragging(false);
1745
+ timelineProps.onCursorDragEnd?.(time);
1746
+ }
1747
+ })
1748
+ ]
1749
+ }),
1750
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollBar, { orientation: "horizontal" }),
1751
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollBar, { orientation: "vertical" }),
1752
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.ScrollArea.Corner, {})
1753
+ ]
1754
+ });
1755
+ }
1756
+ //#endregion
1757
+ exports.Timeline = Timeline;