@cyca/react-timeline-editor 0.2.4-alpha.6 → 0.2.5-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -9
- package/dist/action-C-MnAPdg.d.cts +52 -0
- package/dist/action-C-MnAPdg.d.mts +52 -0
- package/dist/deal-data-BnM2yYM0.cjs +111 -0
- package/dist/deal-data-DH3Lh6kA.mjs +64 -0
- package/dist/react-timeline-editor.cjs +1597 -13
- package/dist/react-timeline-editor.d.cts +313 -0
- package/dist/react-timeline-editor.d.mts +313 -0
- package/dist/react-timeline-editor.mjs +1572 -0
- package/dist/styles.css +268 -1
- package/dist/styles.css.d.ts +3 -0
- package/dist/utils.cjs +9 -1
- package/dist/utils.d.cts +62 -0
- package/dist/utils.d.mts +62 -0
- package/dist/utils.mjs +2 -0
- package/package.json +53 -32
- package/dist/flag.png +0 -0
- package/dist/icon.png +0 -0
- package/dist/index-6kJWhJ-8.cjs +0 -1
- package/dist/index-aC1-xztU.js +0 -83
- package/dist/index.d.ts +0 -338
- package/dist/react-timeline-editor.js +0 -4161
- package/dist/soundWave.png +0 -0
- package/dist/utils.d.ts +0 -111
- package/dist/utils.js +0 -10
|
@@ -1,13 +1,1597 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
12
|
-
|
|
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 && onClickActionOnly) {
|
|
781
|
+
if (time === void 0) time = handleTime(e);
|
|
782
|
+
onClickActionOnly(e, {
|
|
783
|
+
row,
|
|
784
|
+
action,
|
|
785
|
+
time
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
onDoubleClick: (e) => {
|
|
790
|
+
if (onDoubleClickAction) onDoubleClickAction(e, {
|
|
791
|
+
row,
|
|
792
|
+
action,
|
|
793
|
+
time: handleTime(e)
|
|
794
|
+
});
|
|
795
|
+
},
|
|
796
|
+
onContextMenu: (e) => {
|
|
797
|
+
if (onContextMenuAction) onContextMenuAction(e, {
|
|
798
|
+
row,
|
|
799
|
+
action,
|
|
800
|
+
time: handleTime(e)
|
|
801
|
+
});
|
|
802
|
+
},
|
|
803
|
+
className: classNames,
|
|
804
|
+
style: { height: rowRenderHeight },
|
|
805
|
+
children: [
|
|
806
|
+
getActionRender && getActionRender(nowAction, nowRow),
|
|
807
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
808
|
+
className: clsx(prefix("action-left-stretch")),
|
|
809
|
+
style: {
|
|
810
|
+
touchAction: "none",
|
|
811
|
+
visibility: flexible ? "visible" : "hidden",
|
|
812
|
+
pointerEvents: flexible ? "auto" : "none"
|
|
813
|
+
}
|
|
814
|
+
}),
|
|
815
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
816
|
+
className: prefix("action-right-stretch"),
|
|
817
|
+
style: {
|
|
818
|
+
touchAction: "none",
|
|
819
|
+
visibility: flexible ? "visible" : "hidden",
|
|
820
|
+
pointerEvents: flexible ? "auto" : "none"
|
|
821
|
+
}
|
|
822
|
+
})
|
|
823
|
+
]
|
|
824
|
+
})
|
|
825
|
+
});
|
|
826
|
+
};
|
|
827
|
+
//#endregion
|
|
828
|
+
//#region src/components/edit_area/edit-row.tsx
|
|
829
|
+
const EditRow = (props) => {
|
|
830
|
+
const { rowData, rowRenderHeight, isCollapsed = false, style = {}, onClickRow, onDoubleClickRow, onContextMenuRow, scrollContainerRef, startLeft, scale, scaleWidth, unstable_rowActionsOverscan, getEmptyRowRender, getCollapsedRowLabelRender } = props;
|
|
831
|
+
const classNames = ["edit-row"];
|
|
832
|
+
if (rowData?.selected) classNames.push("edit-row-selected");
|
|
833
|
+
const safeScale = scale ?? 1;
|
|
834
|
+
const safeScaleWidth = scaleWidth ?? 160;
|
|
835
|
+
const safeStartLeft = startLeft ?? 20;
|
|
836
|
+
const handleTime = (e) => {
|
|
837
|
+
if (!scrollContainerRef.current) return 0;
|
|
838
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
839
|
+
return require_deal_data.parserPixelToTime(e.clientX - rect.x, {
|
|
840
|
+
startLeft: safeStartLeft,
|
|
841
|
+
scale: safeScale,
|
|
842
|
+
scaleWidth: safeScaleWidth
|
|
843
|
+
});
|
|
844
|
+
};
|
|
845
|
+
const actions = (0, react.useMemo)(() => (rowData?.actions ? [...rowData.actions] : []).sort((a, b) => a.start - b.start), [rowData]);
|
|
846
|
+
const getItemKey = (0, react.useCallback)((index) => actions[index]?.id ?? index, [actions]);
|
|
847
|
+
const virtualizer = (0, _tanstack_react_virtual.useVirtualizer)({
|
|
848
|
+
horizontal: true,
|
|
849
|
+
count: actions.length,
|
|
850
|
+
getItemKey,
|
|
851
|
+
getScrollElement: () => scrollContainerRef.current,
|
|
852
|
+
estimateSize: (index) => {
|
|
853
|
+
if (!actions[index]) return 0;
|
|
854
|
+
let start = index > 0 ? actions[index - 1].end : 0;
|
|
855
|
+
let end = actions[index].end;
|
|
856
|
+
if (start > end) return 0;
|
|
857
|
+
let { width } = require_deal_data.parserTimeToTransform({
|
|
858
|
+
start,
|
|
859
|
+
end
|
|
860
|
+
}, {
|
|
861
|
+
startLeft: safeStartLeft,
|
|
862
|
+
scale: safeScale,
|
|
863
|
+
scaleWidth: safeScaleWidth
|
|
864
|
+
});
|
|
865
|
+
return width;
|
|
866
|
+
},
|
|
867
|
+
overscan: unstable_rowActionsOverscan ?? 5
|
|
868
|
+
});
|
|
869
|
+
(0, react.useEffect)(() => virtualizer.measure(), [
|
|
870
|
+
safeScale,
|
|
871
|
+
safeScaleWidth,
|
|
872
|
+
safeStartLeft,
|
|
873
|
+
virtualizer
|
|
874
|
+
]);
|
|
875
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
876
|
+
className: `${prefix(...classNames)} ${(rowData?.classNames || []).join(" ")}`,
|
|
877
|
+
style,
|
|
878
|
+
onPointerEnter: props.onPointerEnter,
|
|
879
|
+
onPointerLeave: props.onPointerLeave,
|
|
880
|
+
onClick: (e) => {
|
|
881
|
+
if (rowData && onClickRow) onClickRow(e, {
|
|
882
|
+
row: rowData,
|
|
883
|
+
time: handleTime(e)
|
|
884
|
+
});
|
|
885
|
+
},
|
|
886
|
+
onDoubleClick: (e) => {
|
|
887
|
+
if (rowData && onDoubleClickRow) onDoubleClickRow(e, {
|
|
888
|
+
row: rowData,
|
|
889
|
+
time: handleTime(e)
|
|
890
|
+
});
|
|
891
|
+
},
|
|
892
|
+
onContextMenu: (e) => {
|
|
893
|
+
if (rowData && onContextMenuRow) onContextMenuRow(e, {
|
|
894
|
+
row: rowData,
|
|
895
|
+
time: handleTime(e)
|
|
896
|
+
});
|
|
897
|
+
},
|
|
898
|
+
children: [
|
|
899
|
+
rowData && isCollapsed && getCollapsedRowLabelRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
900
|
+
className: prefix("collapsed-row-label"),
|
|
901
|
+
"aria-hidden": "true",
|
|
902
|
+
children: getCollapsedRowLabelRender({
|
|
903
|
+
row: rowData,
|
|
904
|
+
height: rowRenderHeight
|
|
905
|
+
})
|
|
906
|
+
}),
|
|
907
|
+
rowData && actions.length === 0 && getEmptyRowRender && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
908
|
+
className: prefix("empty-row"),
|
|
909
|
+
children: getEmptyRowRender({
|
|
910
|
+
row: rowData,
|
|
911
|
+
height: rowRenderHeight
|
|
912
|
+
})
|
|
913
|
+
}),
|
|
914
|
+
rowData && virtualizer.getVirtualItems().map((virtualEntry) => {
|
|
915
|
+
const action = actions[virtualEntry.index];
|
|
916
|
+
if (!action) throw new Error("Action not found");
|
|
917
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditAction, {
|
|
918
|
+
...props,
|
|
919
|
+
handleTime,
|
|
920
|
+
row: rowData,
|
|
921
|
+
rowRenderHeight,
|
|
922
|
+
action
|
|
923
|
+
}, action.id);
|
|
924
|
+
})
|
|
925
|
+
]
|
|
926
|
+
});
|
|
927
|
+
};
|
|
928
|
+
//#endregion
|
|
929
|
+
//#region src/components/edit_area/hooks/use-snap.ts
|
|
930
|
+
const useSnap = (props) => {
|
|
931
|
+
const [snapData, setSnapData] = (0, react$1.useState)({
|
|
932
|
+
isMoving: false,
|
|
933
|
+
movePositions: [],
|
|
934
|
+
assistPositions: []
|
|
935
|
+
});
|
|
936
|
+
const activeDragStateRef = (0, react$1.useRef)(null);
|
|
937
|
+
const snapDataRef = (0, react$1.useEffectEvent)(() => ({
|
|
938
|
+
...props,
|
|
939
|
+
snapData
|
|
940
|
+
}));
|
|
941
|
+
(0, react$1.useEffect)(() => {
|
|
942
|
+
const activeDragState = activeDragStateRef.current;
|
|
943
|
+
const currentProps = snapDataRef();
|
|
944
|
+
if (currentProps.snap && activeDragState && currentProps.snapData.isMoving && currentProps.snapPositions) {
|
|
945
|
+
const assistActionIds = activeDragState.assistActionIds;
|
|
946
|
+
const assistPositions = currentProps.snapPositions.filter((pos) => {
|
|
947
|
+
if (pos.actionId === activeDragState.action.id) return false;
|
|
948
|
+
if (assistActionIds && !assistActionIds.includes(pos.actionId)) return false;
|
|
949
|
+
return true;
|
|
950
|
+
}).map((pos) => pos.value);
|
|
951
|
+
if (!currentProps.hideCursor) {
|
|
952
|
+
const cursorLeft = require_deal_data.parserTimeToPixel(currentProps.cursorTime, {
|
|
953
|
+
scaleWidth: currentProps.scaleWidth ?? 160,
|
|
954
|
+
scale: currentProps.scale ?? 1,
|
|
955
|
+
startLeft: currentProps.startLeft ?? 20
|
|
956
|
+
});
|
|
957
|
+
assistPositions.push(cursorLeft);
|
|
958
|
+
}
|
|
959
|
+
setSnapData((pre) => ({
|
|
960
|
+
...pre,
|
|
961
|
+
assistPositions
|
|
962
|
+
}));
|
|
963
|
+
} else if (!currentProps.snap && currentProps.snapData.isMoving) setSnapData((pre) => ({
|
|
964
|
+
...pre,
|
|
965
|
+
assistPositions: []
|
|
966
|
+
}));
|
|
967
|
+
}, [props.snap]);
|
|
968
|
+
const handleInitSnap = (data) => {
|
|
969
|
+
const assistActionIds = props.getAssistDragLineActionIds && props.getAssistDragLineActionIds({
|
|
970
|
+
action: data.action,
|
|
971
|
+
row: data.row,
|
|
972
|
+
editorData: props.editorData
|
|
973
|
+
});
|
|
974
|
+
activeDragStateRef.current = {
|
|
975
|
+
action: data.action,
|
|
976
|
+
row: data.row,
|
|
977
|
+
assistActionIds
|
|
978
|
+
};
|
|
979
|
+
if (props.snap && props.snapPositions) {
|
|
980
|
+
const assistPositions = props.snapPositions.filter((pos) => {
|
|
981
|
+
if (pos.actionId === data.action.id) return false;
|
|
982
|
+
if (assistActionIds && !assistActionIds.includes(pos.actionId)) return false;
|
|
983
|
+
return true;
|
|
984
|
+
}).map((pos) => pos.value);
|
|
985
|
+
if (!props.hideCursor) {
|
|
986
|
+
const cursorLeft = require_deal_data.parserTimeToPixel(props.cursorTime, {
|
|
987
|
+
scaleWidth: props.scaleWidth ?? 160,
|
|
988
|
+
scale: props.scale ?? 1,
|
|
989
|
+
startLeft: props.startLeft ?? 20
|
|
990
|
+
});
|
|
991
|
+
assistPositions.push(cursorLeft);
|
|
992
|
+
}
|
|
993
|
+
setSnapData({
|
|
994
|
+
isMoving: true,
|
|
995
|
+
movePositions: [],
|
|
996
|
+
assistPositions
|
|
997
|
+
});
|
|
998
|
+
} else setSnapData({
|
|
999
|
+
isMoving: true,
|
|
1000
|
+
movePositions: [],
|
|
1001
|
+
assistPositions: []
|
|
1002
|
+
});
|
|
1003
|
+
};
|
|
1004
|
+
const handleUpdateSnap = (data) => {
|
|
1005
|
+
if (props.snap) {
|
|
1006
|
+
const currentScaleWidth = props.scaleWidth ?? 160;
|
|
1007
|
+
const currentScale = props.scale ?? 1;
|
|
1008
|
+
const currentStartLeft = props.startLeft ?? 20;
|
|
1009
|
+
const { left, width } = require_deal_data.parserTimeToTransform({
|
|
1010
|
+
start: data.start,
|
|
1011
|
+
end: data.end
|
|
1012
|
+
}, {
|
|
1013
|
+
startLeft: currentStartLeft,
|
|
1014
|
+
scaleWidth: currentScaleWidth,
|
|
1015
|
+
scale: currentScale
|
|
1016
|
+
});
|
|
1017
|
+
const movePositions = data.dir ? data.dir === "right" ? [left + width] : [left] : [left, left + width];
|
|
1018
|
+
setSnapData((pre) => ({
|
|
1019
|
+
...pre,
|
|
1020
|
+
movePositions
|
|
1021
|
+
}));
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
const disposeSnap = () => {
|
|
1025
|
+
activeDragStateRef.current = null;
|
|
1026
|
+
setSnapData({
|
|
1027
|
+
isMoving: false,
|
|
1028
|
+
movePositions: [],
|
|
1029
|
+
assistPositions: []
|
|
1030
|
+
});
|
|
1031
|
+
};
|
|
1032
|
+
return {
|
|
1033
|
+
snapData,
|
|
1034
|
+
handleInitSnap,
|
|
1035
|
+
handleUpdateSnap,
|
|
1036
|
+
disposeSnap
|
|
1037
|
+
};
|
|
1038
|
+
};
|
|
1039
|
+
//#endregion
|
|
1040
|
+
//#region src/utils/row-layout.ts
|
|
1041
|
+
function getTimelineRowPresentation(params) {
|
|
1042
|
+
const layouts = [];
|
|
1043
|
+
let totalHeight = 0;
|
|
1044
|
+
const collapsibleRowIds = new Set(params.editorData.filter((row) => row.collapsed).map((row) => row.id));
|
|
1045
|
+
const defaultExpandedRowIds = params.editorData.filter((row) => row.collapsed?.expandedByDefault).map((row) => row.id);
|
|
1046
|
+
const focusedRowId = (params.lockedRowId && collapsibleRowIds.has(params.lockedRowId) ? params.lockedRowId : null) ?? (params.hoveredRowId && collapsibleRowIds.has(params.hoveredRowId) ? params.hoveredRowId : null) ?? defaultExpandedRowIds[0] ?? null;
|
|
1047
|
+
for (const row of params.editorData) {
|
|
1048
|
+
const expandedHeight = row.rowHeight || params.rowHeight;
|
|
1049
|
+
const collapsedHeight = row.collapsed?.height ?? params.collapsedRowHeight;
|
|
1050
|
+
const isCollapsed = Boolean(row.collapsed && row.id !== focusedRowId);
|
|
1051
|
+
const height = isCollapsed ? collapsedHeight : expandedHeight;
|
|
1052
|
+
layouts.push({
|
|
1053
|
+
row,
|
|
1054
|
+
top: totalHeight,
|
|
1055
|
+
height,
|
|
1056
|
+
isCollapsed
|
|
1057
|
+
});
|
|
1058
|
+
totalHeight += height;
|
|
1059
|
+
}
|
|
1060
|
+
return {
|
|
1061
|
+
layouts,
|
|
1062
|
+
totalHeight,
|
|
1063
|
+
defaultExpandedRowIds
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
//#endregion
|
|
1067
|
+
//#region src/components/edit_area/edit-area.tsx
|
|
1068
|
+
const EditArea = ({ ref, ...props }) => {
|
|
1069
|
+
const { snapData, handleInitSnap, handleUpdateSnap, disposeSnap } = useSnap({
|
|
1070
|
+
snap: props.snap,
|
|
1071
|
+
hideCursor: props.hideCursor,
|
|
1072
|
+
cursorTime: props.cursorTime,
|
|
1073
|
+
scaleWidth: props.scaleWidth,
|
|
1074
|
+
scale: props.scale,
|
|
1075
|
+
startLeft: props.startLeft,
|
|
1076
|
+
getAssistDragLineActionIds: props.getAssistDragLineActionIds,
|
|
1077
|
+
editorData: props.editorData,
|
|
1078
|
+
snapPositions: props.snapPositions
|
|
1079
|
+
});
|
|
1080
|
+
const currentScaleWidth = props.scaleWidth ?? 160;
|
|
1081
|
+
const currentStartLeft = props.startLeft ?? 20;
|
|
1082
|
+
const contentWidth = Math.max(props.scaleCount * currentScaleWidth + currentStartLeft, props.timelineWidth);
|
|
1083
|
+
const rows = (() => {
|
|
1084
|
+
let result = [];
|
|
1085
|
+
for (const { row, top, height, isCollapsed } of props.rowLayouts) result.push(/* @__PURE__ */ (0, react.createElement)(EditRow, {
|
|
1086
|
+
...props,
|
|
1087
|
+
key: row.id,
|
|
1088
|
+
rowData: row,
|
|
1089
|
+
rowRenderHeight: height,
|
|
1090
|
+
isCollapsed,
|
|
1091
|
+
snapData,
|
|
1092
|
+
scrollContainerRef: props.scrollElementRef,
|
|
1093
|
+
style: {
|
|
1094
|
+
position: "absolute",
|
|
1095
|
+
top: 0,
|
|
1096
|
+
left: 0,
|
|
1097
|
+
width: contentWidth,
|
|
1098
|
+
height: `${height}px`,
|
|
1099
|
+
transform: `translateY(${top}px)`
|
|
1100
|
+
},
|
|
1101
|
+
onPointerEnter: () => {
|
|
1102
|
+
if (row.collapsed) props.setHoveredRowId(row.id);
|
|
1103
|
+
},
|
|
1104
|
+
onPointerLeave: () => {
|
|
1105
|
+
props.clearHoveredRowId(row.id);
|
|
1106
|
+
},
|
|
1107
|
+
onActionMoveStart: (data) => {
|
|
1108
|
+
if (row.collapsed) props.setLockedRowId(row.id);
|
|
1109
|
+
handleInitSnap(data);
|
|
1110
|
+
return props.onActionMoveStart && props.onActionMoveStart(data);
|
|
1111
|
+
},
|
|
1112
|
+
onActionResizeStart: (data) => {
|
|
1113
|
+
if (row.collapsed) props.setLockedRowId(row.id);
|
|
1114
|
+
handleInitSnap(data);
|
|
1115
|
+
return props.onActionResizeStart && props.onActionResizeStart(data);
|
|
1116
|
+
},
|
|
1117
|
+
onActionMoving: (data) => {
|
|
1118
|
+
handleUpdateSnap(data);
|
|
1119
|
+
return props.onActionMoving && props.onActionMoving(data);
|
|
1120
|
+
},
|
|
1121
|
+
onActionResizing: (data) => {
|
|
1122
|
+
handleUpdateSnap(data);
|
|
1123
|
+
return props.onActionResizing && props.onActionResizing(data);
|
|
1124
|
+
},
|
|
1125
|
+
onActionResizeEnd: (data) => {
|
|
1126
|
+
props.setLockedRowId(null);
|
|
1127
|
+
disposeSnap();
|
|
1128
|
+
return props.onActionResizeEnd && props.onActionResizeEnd(data);
|
|
1129
|
+
},
|
|
1130
|
+
onActionMoveEnd: (data) => {
|
|
1131
|
+
props.setLockedRowId(null);
|
|
1132
|
+
disposeSnap();
|
|
1133
|
+
return props.onActionMoveEnd && props.onActionMoveEnd(data);
|
|
1134
|
+
}
|
|
1135
|
+
}));
|
|
1136
|
+
return result;
|
|
1137
|
+
})();
|
|
1138
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1139
|
+
ref,
|
|
1140
|
+
style: {
|
|
1141
|
+
width: contentWidth,
|
|
1142
|
+
height: props.rowLayoutsTotalHeight,
|
|
1143
|
+
position: "relative",
|
|
1144
|
+
backgroundPositionX: `0, ${props.startLeft ?? 20}px`,
|
|
1145
|
+
backgroundSize: `${props.startLeft ?? 20}px, ${props.scaleWidth ?? 160}px`
|
|
1146
|
+
},
|
|
1147
|
+
className: "timeline-editor-edit-area",
|
|
1148
|
+
children: [rows, props.snap && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SnapGuideLines, { ...snapData })]
|
|
1149
|
+
});
|
|
1150
|
+
};
|
|
1151
|
+
//#endregion
|
|
1152
|
+
//#region src/components/time_area/time-area.tsx
|
|
1153
|
+
function TimeArea({ scaleSplitCount, scaleWidth, startLeft, scaleCount, maxScaleCount, scale, scrollElementRef, onClickTimeArea, setCursor, getScaleRender }) {
|
|
1154
|
+
const splitCount = scaleSplitCount ?? 1;
|
|
1155
|
+
const width = scaleWidth ?? 160;
|
|
1156
|
+
const left = startLeft ?? 20;
|
|
1157
|
+
/** Whether to show sub-scale marks */
|
|
1158
|
+
const showUnit = (scaleSplitCount ?? 0) > 0;
|
|
1159
|
+
const columnCount = showUnit ? scaleCount * (scaleSplitCount ?? 1) + 1 : scaleCount;
|
|
1160
|
+
const totalWidth = (showUnit ? width / splitCount : width) * (columnCount - 1) + left;
|
|
1161
|
+
const getColumnWidth = (index) => {
|
|
1162
|
+
switch (index) {
|
|
1163
|
+
case 0: return left;
|
|
1164
|
+
default: return showUnit ? width / splitCount : width;
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1167
|
+
const virtualizer = (0, _tanstack_react_virtual.useVirtualizer)({
|
|
1168
|
+
horizontal: true,
|
|
1169
|
+
count: columnCount,
|
|
1170
|
+
getScrollElement: () => scrollElementRef.current,
|
|
1171
|
+
estimateSize: getColumnWidth,
|
|
1172
|
+
overscan: 10
|
|
1173
|
+
});
|
|
1174
|
+
(0, react.useEffect)(() => virtualizer.measure(), [
|
|
1175
|
+
scale,
|
|
1176
|
+
scaleWidth,
|
|
1177
|
+
startLeft,
|
|
1178
|
+
virtualizer
|
|
1179
|
+
]);
|
|
1180
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1181
|
+
style: { width: `${totalWidth}px` },
|
|
1182
|
+
className: prefix("time-area"),
|
|
1183
|
+
onClick: (e) => {
|
|
1184
|
+
const leftStart = startLeft ?? 20;
|
|
1185
|
+
const widthValue = scaleWidth ?? 160;
|
|
1186
|
+
const scaleValue = scale ?? 1;
|
|
1187
|
+
const maxCount = maxScaleCount ?? Infinity;
|
|
1188
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
1189
|
+
const position = e.clientX - rect.x;
|
|
1190
|
+
const left = Math.max(position, leftStart);
|
|
1191
|
+
if (left > maxCount * widthValue + leftStart) return;
|
|
1192
|
+
const time = require_deal_data.parserPixelToTime(left, {
|
|
1193
|
+
startLeft: leftStart,
|
|
1194
|
+
scale: scaleValue,
|
|
1195
|
+
scaleWidth: widthValue
|
|
1196
|
+
});
|
|
1197
|
+
onClickTimeArea && onClickTimeArea(time, e);
|
|
1198
|
+
if (e.defaultPrevented) return;
|
|
1199
|
+
setCursor({ time });
|
|
1200
|
+
},
|
|
1201
|
+
children: virtualizer.getVirtualItems().map((virtualColumn) => {
|
|
1202
|
+
const columnIndex = virtualColumn.index;
|
|
1203
|
+
const splitCount = scaleSplitCount ?? 1;
|
|
1204
|
+
const scaleValue = scale ?? 1;
|
|
1205
|
+
const isShowScale = showUnit ? columnIndex % splitCount === 0 : true;
|
|
1206
|
+
const classNames = [prefix("time-unit"), isShowScale ? prefix("time-unit-big") : prefix("time-unit-small")];
|
|
1207
|
+
const item = (showUnit ? columnIndex / splitCount : columnIndex) * scaleValue;
|
|
1208
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1209
|
+
"data-index": virtualColumn.index,
|
|
1210
|
+
style: {
|
|
1211
|
+
width: `${virtualColumn.size}px`,
|
|
1212
|
+
transform: `translateX(${virtualColumn.start}px)`
|
|
1213
|
+
},
|
|
1214
|
+
className: classNames.join(" "),
|
|
1215
|
+
children: isShowScale && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1216
|
+
className: prefix("time-unit-scale"),
|
|
1217
|
+
children: getScaleRender?.(item) ?? item
|
|
1218
|
+
})
|
|
1219
|
+
}, virtualColumn.key);
|
|
1220
|
+
})
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
//#endregion
|
|
1224
|
+
//#region src/utils/with-hook.tsx
|
|
1225
|
+
function withHooks(hook) {
|
|
1226
|
+
const Component = ({ children, ...params }) => {
|
|
1227
|
+
return children(hook(params));
|
|
1228
|
+
};
|
|
1229
|
+
Component.displayName = `withHooks(${hook.name || "Hook"})`;
|
|
1230
|
+
return Component;
|
|
1231
|
+
}
|
|
1232
|
+
//#endregion
|
|
1233
|
+
//#region src/utils/measured.tsx
|
|
1234
|
+
function useMeasure({ elementRef }) {
|
|
1235
|
+
const [size, setSize] = (0, react.useState)({
|
|
1236
|
+
width: 0,
|
|
1237
|
+
height: 0
|
|
1238
|
+
});
|
|
1239
|
+
(0, react.useLayoutEffect)(() => {
|
|
1240
|
+
if (!elementRef.current) return;
|
|
1241
|
+
(0, motion.resize)(elementRef.current, (_el, size) => {
|
|
1242
|
+
setSize({
|
|
1243
|
+
width: size.width,
|
|
1244
|
+
height: size.height
|
|
1245
|
+
});
|
|
1246
|
+
});
|
|
1247
|
+
}, [elementRef]);
|
|
1248
|
+
return size;
|
|
1249
|
+
}
|
|
1250
|
+
withHooks(useMeasure);
|
|
1251
|
+
//#endregion
|
|
1252
|
+
//#region src/components/cursor/cursor.tsx
|
|
1253
|
+
const Cursor = ({ disableDrag, height, cursorTime, setCursor, startLeft, scaleWidth, scale, scaleCount, scaleSplitCount, scrollElementRef, maxScaleCount, onCursorDragStart, onCursorDrag, onCursorDragEnd, cursorSnap, autoScrollSpeed, autoScrollMaxSpeed, snapPositions = [] }) => {
|
|
1254
|
+
const rowRnd = (0, react.useRef)(null);
|
|
1255
|
+
const leftStart = startLeft ?? 20;
|
|
1256
|
+
const width = scaleWidth ?? 160;
|
|
1257
|
+
const scaleValue = scale ?? 1;
|
|
1258
|
+
const activeSnapPositions = !cursorSnap ? [] : snapPositions;
|
|
1259
|
+
(0, react.useEffect)(() => {
|
|
1260
|
+
if (rowRnd.current) {
|
|
1261
|
+
const left = startLeft ?? 20;
|
|
1262
|
+
const width = scaleWidth ?? 160;
|
|
1263
|
+
const scaleValue = scale ?? 1;
|
|
1264
|
+
rowRnd.current.updateLeft(require_deal_data.parserTimeToPixel(cursorTime, {
|
|
1265
|
+
startLeft: left,
|
|
1266
|
+
scaleWidth: width,
|
|
1267
|
+
scale: scaleValue
|
|
1268
|
+
}));
|
|
1269
|
+
}
|
|
1270
|
+
}, [
|
|
1271
|
+
cursorTime,
|
|
1272
|
+
startLeft,
|
|
1273
|
+
scaleWidth,
|
|
1274
|
+
scale
|
|
1275
|
+
]);
|
|
1276
|
+
const maxCount = maxScaleCount ?? Infinity;
|
|
1277
|
+
const showUnit = (scaleSplitCount ?? 0) > 0;
|
|
1278
|
+
const splitCount = scaleSplitCount ?? 1;
|
|
1279
|
+
const columnCount = showUnit ? scaleCount * (scaleSplitCount ?? 1) + 1 : scaleCount;
|
|
1280
|
+
const left = startLeft ?? 20;
|
|
1281
|
+
const totalWidth = (showUnit ? width / splitCount : width) * (columnCount - 1) + left;
|
|
1282
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowDnd, {
|
|
1283
|
+
start: leftStart,
|
|
1284
|
+
ref: rowRnd,
|
|
1285
|
+
parentRef: scrollElementRef,
|
|
1286
|
+
getBounds: () => {
|
|
1287
|
+
return {
|
|
1288
|
+
left: 0,
|
|
1289
|
+
right: Math.min(totalWidth, maxCount * width + leftStart - (scrollElementRef.current?.scrollLeft ?? 0))
|
|
1290
|
+
};
|
|
1291
|
+
},
|
|
1292
|
+
autoScroll: true,
|
|
1293
|
+
autoScrollSpeed,
|
|
1294
|
+
autoScrollMaxSpeed,
|
|
1295
|
+
enableDragging: !disableDrag,
|
|
1296
|
+
enableResizing: false,
|
|
1297
|
+
snapPositions: activeSnapPositions,
|
|
1298
|
+
snapDistance: 8,
|
|
1299
|
+
snapOrigin: "left",
|
|
1300
|
+
onDragStart: () => {
|
|
1301
|
+
const time = require_deal_data.parserPixelToTime(rowRnd.current?.getLeft() ?? require_deal_data.parserTimeToPixel(cursorTime, {
|
|
1302
|
+
startLeft: leftStart,
|
|
1303
|
+
scaleWidth: width,
|
|
1304
|
+
scale: scaleValue
|
|
1305
|
+
}), {
|
|
1306
|
+
startLeft: leftStart,
|
|
1307
|
+
scale: scaleValue,
|
|
1308
|
+
scaleWidth: width
|
|
1309
|
+
});
|
|
1310
|
+
onCursorDragStart && onCursorDragStart(time);
|
|
1311
|
+
},
|
|
1312
|
+
onDragEnd: ({ left }) => {
|
|
1313
|
+
const time = require_deal_data.parserPixelToTime(left, {
|
|
1314
|
+
startLeft: leftStart,
|
|
1315
|
+
scale: scaleValue,
|
|
1316
|
+
scaleWidth: width
|
|
1317
|
+
});
|
|
1318
|
+
setCursor({ time });
|
|
1319
|
+
onCursorDragEnd && onCursorDragEnd(time);
|
|
1320
|
+
},
|
|
1321
|
+
onDrag: ({ left }) => {
|
|
1322
|
+
const time = require_deal_data.parserPixelToTime(left, {
|
|
1323
|
+
startLeft: leftStart,
|
|
1324
|
+
scale: scaleValue,
|
|
1325
|
+
scaleWidth: width
|
|
1326
|
+
});
|
|
1327
|
+
setCursor({ time });
|
|
1328
|
+
onCursorDrag && onCursorDrag(time);
|
|
1329
|
+
},
|
|
1330
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1331
|
+
className: prefix("cursor"),
|
|
1332
|
+
style: { height },
|
|
1333
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1334
|
+
className: prefix("cursor-top"),
|
|
1335
|
+
width: "8",
|
|
1336
|
+
height: "12",
|
|
1337
|
+
viewBox: "0 0 8 12",
|
|
1338
|
+
fill: "none",
|
|
1339
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1340
|
+
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",
|
|
1341
|
+
fill: "currentColor"
|
|
1342
|
+
})
|
|
1343
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: prefix("cursor-area") })]
|
|
1344
|
+
})
|
|
1345
|
+
});
|
|
1346
|
+
};
|
|
1347
|
+
//#endregion
|
|
1348
|
+
//#region src/components/scroll-area.tsx
|
|
1349
|
+
function ScrollBar({ className, orientation = "vertical", ...props }) {
|
|
1350
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.ScrollArea.ScrollAreaScrollbar, {
|
|
1351
|
+
"data-slot": "scroll-area-scrollbar",
|
|
1352
|
+
orientation,
|
|
1353
|
+
className,
|
|
1354
|
+
...props,
|
|
1355
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.ScrollArea.ScrollAreaThumb, { "data-slot": "scroll-area-thumb" })
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
//#endregion
|
|
1359
|
+
//#region src/components/hooks/use-stable-scroll.ts
|
|
1360
|
+
/**
|
|
1361
|
+
* Hook to maintain scroll position stability when scale or scaleWidth changes.
|
|
1362
|
+
* Uses the cursor time as a reference point to keep it visually stable.
|
|
1363
|
+
*/
|
|
1364
|
+
function useStableScroll({ scrollElementRef, scale, scaleWidth, startLeft, cursorTimeRef }) {
|
|
1365
|
+
const prevScaleRef = (0, react$1.useRef)(null);
|
|
1366
|
+
const prevScaleWidthRef = (0, react$1.useRef)(null);
|
|
1367
|
+
(0, react$1.useLayoutEffect)(() => {
|
|
1368
|
+
const scrollElement = scrollElementRef.current;
|
|
1369
|
+
if (prevScaleRef.current !== null && prevScaleWidthRef.current !== null && scrollElement && (prevScaleRef.current !== scale || prevScaleWidthRef.current !== scaleWidth)) {
|
|
1370
|
+
const currentScrollLeft = scrollElement.scrollLeft;
|
|
1371
|
+
const cursorTime = cursorTimeRef.current;
|
|
1372
|
+
const oldCursorPixelPosition = require_deal_data.parserTimeToPixel(cursorTime, {
|
|
1373
|
+
startLeft,
|
|
1374
|
+
scale: prevScaleRef.current,
|
|
1375
|
+
scaleWidth: prevScaleWidthRef.current
|
|
1376
|
+
});
|
|
1377
|
+
scrollElement.scrollLeft = require_deal_data.parserTimeToPixel(cursorTime, {
|
|
1378
|
+
startLeft,
|
|
1379
|
+
scale,
|
|
1380
|
+
scaleWidth
|
|
1381
|
+
}) - (oldCursorPixelPosition - currentScrollLeft);
|
|
1382
|
+
}
|
|
1383
|
+
prevScaleRef.current = scale;
|
|
1384
|
+
prevScaleWidthRef.current = scaleWidth;
|
|
1385
|
+
}, [
|
|
1386
|
+
scale,
|
|
1387
|
+
scaleWidth,
|
|
1388
|
+
startLeft,
|
|
1389
|
+
scrollElementRef,
|
|
1390
|
+
cursorTimeRef
|
|
1391
|
+
]);
|
|
1392
|
+
}
|
|
1393
|
+
//#endregion
|
|
1394
|
+
//#region src/components/timeline.tsx
|
|
1395
|
+
function Timeline({ ref, ...props }) {
|
|
1396
|
+
const timelineProps = withDefaults(props);
|
|
1397
|
+
const domRef = (0, react.useRef)(null);
|
|
1398
|
+
const warnedDefaultRowsRef = (0, react.useRef)("");
|
|
1399
|
+
const { width, height } = useMeasure({ elementRef: domRef });
|
|
1400
|
+
const [hoveredRowId, setHoveredRowId] = (0, react.useState)(null);
|
|
1401
|
+
const [lockedRowId, setLockedRowId] = (0, react.useState)(null);
|
|
1402
|
+
const editorAreaKey = props.unstable_forceRemountEditorArea ?? 0;
|
|
1403
|
+
const minScaleCount = timelineProps.minScaleCount ?? Math.max(require_deal_data.getScaleCountByRows(timelineProps.editorData, {
|
|
1404
|
+
scale: timelineProps.scale,
|
|
1405
|
+
pad: .1
|
|
1406
|
+
}), Math.ceil((width - timelineProps.startLeft) / timelineProps.scaleWidth));
|
|
1407
|
+
const derivedScaleCount = Math.min(timelineProps.maxScaleCount, minScaleCount);
|
|
1408
|
+
const snapPositions = !timelineProps.editorData ? [] : require_deal_data.parserActionsToPositions(timelineProps.editorData.flatMap((row) => row.actions), {
|
|
1409
|
+
startLeft: timelineProps.startLeft,
|
|
1410
|
+
scale: timelineProps.scale,
|
|
1411
|
+
scaleWidth: timelineProps.scaleWidth
|
|
1412
|
+
});
|
|
1413
|
+
const [overrideScaleCount, setOverrideScaleCount] = (0, react.useState)(null);
|
|
1414
|
+
(0, react.useLayoutEffect)(() => {
|
|
1415
|
+
setOverrideScaleCount(null);
|
|
1416
|
+
}, [derivedScaleCount]);
|
|
1417
|
+
const scaleCount = overrideScaleCount ?? derivedScaleCount;
|
|
1418
|
+
const rowPresentation = getTimelineRowPresentation({
|
|
1419
|
+
editorData: timelineProps.editorData,
|
|
1420
|
+
rowHeight: timelineProps.rowHeight,
|
|
1421
|
+
collapsedRowHeight: timelineProps.collapsedRowHeight ?? timelineProps.rowHeight,
|
|
1422
|
+
hoveredRowId,
|
|
1423
|
+
lockedRowId
|
|
1424
|
+
});
|
|
1425
|
+
const duplicateDefaultRowsKey = rowPresentation.defaultExpandedRowIds.join("\n");
|
|
1426
|
+
if (rowPresentation.defaultExpandedRowIds.length > 1 && warnedDefaultRowsRef.current !== duplicateDefaultRowsKey) {
|
|
1427
|
+
warnedDefaultRowsRef.current = duplicateDefaultRowsKey;
|
|
1428
|
+
console.warn("Warning: multiple collapsible rows set expandedByDefault. The first row in editorData wins.");
|
|
1429
|
+
}
|
|
1430
|
+
/** Dynamically set scale count - overrides the derived value */
|
|
1431
|
+
const handleSetScaleCount = (value) => {
|
|
1432
|
+
setOverrideScaleCount(Math.min(timelineProps.maxScaleCount, value));
|
|
1433
|
+
};
|
|
1434
|
+
const [cursorTime, setCursorTime] = (0, react.useState)(0);
|
|
1435
|
+
const cursorTimeRef = (0, react.useRef)(0);
|
|
1436
|
+
useStableScroll({
|
|
1437
|
+
scrollElementRef: domRef,
|
|
1438
|
+
scale: timelineProps.scale,
|
|
1439
|
+
scaleWidth: timelineProps.scaleWidth,
|
|
1440
|
+
startLeft: timelineProps.startLeft,
|
|
1441
|
+
cursorTimeRef
|
|
1442
|
+
});
|
|
1443
|
+
/** Handle editor data changes */
|
|
1444
|
+
const handleEditorDataChange = (editorData) => {
|
|
1445
|
+
timelineProps.onChange?.(editorData);
|
|
1446
|
+
};
|
|
1447
|
+
/** Handle cursor */
|
|
1448
|
+
const handleSetCursor = (param) => {
|
|
1449
|
+
let { left, time } = param;
|
|
1450
|
+
if (typeof time !== "undefined") {
|
|
1451
|
+
setCursorTime(time);
|
|
1452
|
+
cursorTimeRef.current = time;
|
|
1453
|
+
return true;
|
|
1454
|
+
}
|
|
1455
|
+
if (typeof left !== "undefined") {
|
|
1456
|
+
setCursorTime(cursorTimeRef.current = require_deal_data.parserPixelToTime(left, {
|
|
1457
|
+
startLeft: timelineProps.startLeft,
|
|
1458
|
+
scale: timelineProps.scale,
|
|
1459
|
+
scaleWidth: timelineProps.scaleWidth
|
|
1460
|
+
}));
|
|
1461
|
+
return true;
|
|
1462
|
+
}
|
|
1463
|
+
return false;
|
|
1464
|
+
};
|
|
1465
|
+
const handleScrollToTime = (time, options = {}) => {
|
|
1466
|
+
const element = domRef.current;
|
|
1467
|
+
if (!element) return;
|
|
1468
|
+
const { block = "start", offset = 0, onlyIfNotVisible = false } = options;
|
|
1469
|
+
const target = require_deal_data.parserTimeToPixel(time, {
|
|
1470
|
+
startLeft: timelineProps.startLeft,
|
|
1471
|
+
scale: timelineProps.scale,
|
|
1472
|
+
scaleWidth: timelineProps.scaleWidth
|
|
1473
|
+
});
|
|
1474
|
+
const viewportWidth = element.clientWidth;
|
|
1475
|
+
if (onlyIfNotVisible) {
|
|
1476
|
+
const currentScrollLeft = element.scrollLeft;
|
|
1477
|
+
if (target >= currentScrollLeft && target <= currentScrollLeft + viewportWidth) return;
|
|
1478
|
+
}
|
|
1479
|
+
let targetScrollLeft;
|
|
1480
|
+
if (block === "end") targetScrollLeft = target - viewportWidth + offset;
|
|
1481
|
+
else if (block === "center") targetScrollLeft = target - viewportWidth / 2;
|
|
1482
|
+
else targetScrollLeft = target - offset;
|
|
1483
|
+
const maxScrollLeft = Math.max(0, element.scrollWidth - viewportWidth);
|
|
1484
|
+
element.scrollTo({
|
|
1485
|
+
left: Math.min(Math.max(targetScrollLeft, 0), maxScrollLeft),
|
|
1486
|
+
behavior: options.behavior ?? "instant"
|
|
1487
|
+
});
|
|
1488
|
+
};
|
|
1489
|
+
(0, react.useImperativeHandle)(ref, () => ({
|
|
1490
|
+
get target() {
|
|
1491
|
+
return domRef.current;
|
|
1492
|
+
},
|
|
1493
|
+
set time(time) {
|
|
1494
|
+
handleSetCursor({ time });
|
|
1495
|
+
},
|
|
1496
|
+
get time() {
|
|
1497
|
+
return cursorTimeRef.current;
|
|
1498
|
+
},
|
|
1499
|
+
getTime() {
|
|
1500
|
+
return cursorTimeRef.current;
|
|
1501
|
+
},
|
|
1502
|
+
setTime(time) {
|
|
1503
|
+
handleSetCursor({ time });
|
|
1504
|
+
},
|
|
1505
|
+
getTimePixelPosition(time) {
|
|
1506
|
+
return require_deal_data.parserTimeToPixel(time ?? cursorTimeRef.current, {
|
|
1507
|
+
startLeft: timelineProps.startLeft,
|
|
1508
|
+
scale: timelineProps.scale,
|
|
1509
|
+
scaleWidth: timelineProps.scaleWidth
|
|
1510
|
+
});
|
|
1511
|
+
},
|
|
1512
|
+
setScrollLeft: (val) => {
|
|
1513
|
+
if (!domRef.current) return;
|
|
1514
|
+
domRef.current.scrollLeft = val;
|
|
1515
|
+
},
|
|
1516
|
+
setScrollTop: (val) => {
|
|
1517
|
+
if (!domRef.current) return;
|
|
1518
|
+
domRef.current.scrollTop = val;
|
|
1519
|
+
},
|
|
1520
|
+
get scrollLeft() {
|
|
1521
|
+
if (!domRef.current) return 0;
|
|
1522
|
+
return domRef.current.scrollLeft;
|
|
1523
|
+
},
|
|
1524
|
+
get scrollTop() {
|
|
1525
|
+
if (!domRef.current) return 0;
|
|
1526
|
+
return domRef.current.scrollTop;
|
|
1527
|
+
},
|
|
1528
|
+
set scrollLeft(val) {
|
|
1529
|
+
if (!domRef.current) return;
|
|
1530
|
+
domRef.current.scrollLeft = val;
|
|
1531
|
+
},
|
|
1532
|
+
set scrollTop(val) {
|
|
1533
|
+
if (!domRef.current) return;
|
|
1534
|
+
domRef.current.scrollTop = val;
|
|
1535
|
+
},
|
|
1536
|
+
scrollToTime: handleScrollToTime
|
|
1537
|
+
}));
|
|
1538
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(radix_ui.ScrollArea.Root, {
|
|
1539
|
+
style: timelineProps.style,
|
|
1540
|
+
className: `${require_deal_data.PREFIX} ${timelineProps.disableDrag ? require_deal_data.PREFIX + "-disable" : ""}`,
|
|
1541
|
+
"data-slot": "scroll-area",
|
|
1542
|
+
children: [
|
|
1543
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(radix_ui.ScrollArea.Viewport, {
|
|
1544
|
+
"data-slot": "scroll-area-viewport",
|
|
1545
|
+
ref: domRef,
|
|
1546
|
+
onScroll: (e) => {
|
|
1547
|
+
timelineProps.onScroll?.(e.currentTarget);
|
|
1548
|
+
},
|
|
1549
|
+
children: [
|
|
1550
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TimeArea, {
|
|
1551
|
+
...timelineProps,
|
|
1552
|
+
setCursor: handleSetCursor,
|
|
1553
|
+
scaleCount,
|
|
1554
|
+
scrollElementRef: domRef
|
|
1555
|
+
}),
|
|
1556
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditArea, {
|
|
1557
|
+
...timelineProps,
|
|
1558
|
+
scrollElementRef: domRef,
|
|
1559
|
+
timelineWidth: width,
|
|
1560
|
+
timelineHeight: height,
|
|
1561
|
+
disableDrag: timelineProps.disableDrag,
|
|
1562
|
+
editorData: timelineProps.editorData,
|
|
1563
|
+
cursorTime,
|
|
1564
|
+
scaleCount,
|
|
1565
|
+
setScaleCount: handleSetScaleCount,
|
|
1566
|
+
setEditorData: handleEditorDataChange,
|
|
1567
|
+
snapPositions,
|
|
1568
|
+
rowLayouts: rowPresentation.layouts,
|
|
1569
|
+
rowLayoutsTotalHeight: rowPresentation.totalHeight,
|
|
1570
|
+
setHoveredRowId,
|
|
1571
|
+
clearHoveredRowId: (rowId) => {
|
|
1572
|
+
setHoveredRowId((currentRowId) => currentRowId === rowId ? null : currentRowId);
|
|
1573
|
+
},
|
|
1574
|
+
setLockedRowId
|
|
1575
|
+
}, `__editor_area_${editorAreaKey}__`),
|
|
1576
|
+
!timelineProps.hideCursor && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Cursor, {
|
|
1577
|
+
...timelineProps,
|
|
1578
|
+
timelineWidth: width,
|
|
1579
|
+
height: Math.max(height, rowPresentation.totalHeight + 42),
|
|
1580
|
+
scaleCount,
|
|
1581
|
+
setScaleCount: handleSetScaleCount,
|
|
1582
|
+
setCursor: handleSetCursor,
|
|
1583
|
+
cursorTime,
|
|
1584
|
+
editorData: timelineProps.editorData,
|
|
1585
|
+
scrollElementRef: domRef,
|
|
1586
|
+
snapPositions
|
|
1587
|
+
})
|
|
1588
|
+
]
|
|
1589
|
+
}),
|
|
1590
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollBar, { orientation: "horizontal" }),
|
|
1591
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollBar, { orientation: "vertical" }),
|
|
1592
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.ScrollArea.Corner, {})
|
|
1593
|
+
]
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
//#endregion
|
|
1597
|
+
exports.Timeline = Timeline;
|